@clara.care/react 1.0.5 → 1.0.7
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/clara-widget.cjs.js +41 -31
- package/clara-widget.es.js +337 -327
- package/package.json +2 -2
- package/style.css +1 -1
package/clara-widget.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
${P}px !important;
|
|
7
7
|
top: ${p}px !important;
|
|
8
8
|
}
|
|
9
|
-
`),()=>{x.contains(T)&&x.removeChild(T)}},[e]),jsxRuntime.jsx(PopChildMeasure,{isPresent:e,childRef:r,sizeRef:o,children:React__namespace.cloneElement(n,{ref:u})})}const PresenceChild=({children:n,initial:e,isPresent:i,onExitComplete:a,custom:s,presenceAffectsLayout:r,mode:o,anchorX:l,root:u})=>{const c=useConstant(newChildrenMap),d=React.useId();let p=!0,f=React.useMemo(()=>(p=!1,{id:d,initial:e,isPresent:i,custom:s,onExitComplete:m=>{c.set(m,!0);for(const P of c.values())if(!P)return;a&&a()},register:m=>(c.set(m,!1),()=>c.delete(m))}),[i,c,a]);return r&&p&&(f={...f}),React.useMemo(()=>{c.forEach((m,P)=>c.set(P,!1))},[i]),React__namespace.useEffect(()=>{!i&&!c.size&&a&&a()},[i]),o==="popLayout"&&(n=jsxRuntime.jsx(PopChild,{isPresent:i,anchorX:l,root:u,children:n})),jsxRuntime.jsx(PresenceContext.Provider,{value:f,children:n})};function newChildrenMap(){return new Map}function usePresence(n=!0){const e=React.useContext(PresenceContext);if(e===null)return[!0,null];const{isPresent:i,onExitComplete:a,register:s}=e,r=React.useId();React.useEffect(()=>{if(n)return s(r)},[n]);const o=React.useCallback(()=>n&&a&&a(r),[r,a,n]);return!i&&a?[!1,o]:[!0]}const getChildKey=n=>n.key||"";function onlyElements(n){const e=[];return React.Children.forEach(n,i=>{React.isValidElement(i)&&e.push(i)}),e}const AnimatePresence=({children:n,custom:e,initial:i=!0,onExitComplete:a,presenceAffectsLayout:s=!0,mode:r="sync",propagate:o=!1,anchorX:l="left",root:u})=>{const[c,d]=usePresence(o),p=React.useMemo(()=>onlyElements(n),[n]),f=o&&!c?[]:p.map(getChildKey),m=React.useRef(!0),P=React.useRef(p),T=useConstant(()=>new Map),[x,y]=React.useState(p),[S,g]=React.useState(p);useIsomorphicLayoutEffect(()=>{m.current=!1,P.current=p;for(let B=0;B<S.length;B++){const _=getChildKey(S[B]);f.includes(_)?T.delete(_):T.get(_)!==!0&&T.set(_,!1)}},[S,f.length,f.join("-")]);const C=[];if(p!==x){let B=[...p];for(let _=0;_<S.length;_++){const M=S[_],D=getChildKey(M);f.includes(D)||(B.splice(_,0,M),C.push(M))}return r==="wait"&&C.length&&(B=C),g(onlyElements(B)),y(p),null}process.env.NODE_ENV!=="production"&&r==="wait"&&S.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:E}=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:S.map(B=>{const _=getChildKey(B),M=o&&!c?!1:p===S||f.includes(_),D=()=>{if(T.has(_))T.set(_,!0);else return;let L=!0;T.forEach(F=>{F||(L=!1)}),L&&(E==null||E(),g(P.current),o&&(d==null||d()),a&&a())};return jsxRuntime.jsx(PresenceChild,{isPresent:M,initial:!m.current||i?void 0:!1,custom:e,presenceAffectsLayout:s,mode:r,root:u,onExitComplete:M?void 0:D,anchorX:l,children:B},_)})})},LazyContext=React.createContext({strict:!1}),featureProps={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"]},featureDefinitions={};for(const n in featureProps)featureDefinitions[n]={isEnabled:e=>featureProps[n].some(i=>!!e[i])};function loadFeatures(n){for(const e in n)featureDefinitions[e]={...featureDefinitions[e],...n[e]}}const validMotionProps=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 isValidMotionProp(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||validMotionProps.has(n)}let shouldForward=n=>!isValidMotionProp(n);function loadExternalIsValidProp(n){typeof n=="function"&&(shouldForward=e=>e.startsWith("on")?!isValidMotionProp(e):n(e))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(n,e,i){const a={};for(const s in n)s==="values"&&typeof n.values=="object"||(shouldForward(s)||i===!0&&isValidMotionProp(s)||!e&&!isValidMotionProp(s)||n.draggable&&s.startsWith("onDrag"))&&(a[s]=n[s]);return a}const MotionContext=React.createContext({});function isAnimationControls(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function isVariantLabel(n){return typeof n=="string"||Array.isArray(n)}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(n){return isAnimationControls(n.animate)||variantProps.some(e=>isVariantLabel(n[e]))}function isVariantNode(n){return!!(isControllingVariants(n)||n.variants)}function getCurrentTreeVariants(n,e){if(isControllingVariants(n)){const{initial:i,animate:a}=n;return{initial:i===!1||isVariantLabel(i)?i:void 0,animate:isVariantLabel(a)?a:void 0}}return n.inherit!==!1?e:{}}function useCreateMotionContext(n){const{initial:e,animate:i}=getCurrentTreeVariants(n,React.useContext(MotionContext));return React.useMemo(()=>({initial:e,animate:i}),[variantLabelsAsDependency(e),variantLabelsAsDependency(i)])}function variantLabelsAsDependency(n){return Array.isArray(n)?n.join(" "):n}const scaleCorrectors={};function addScaleCorrector(n){for(const e in n)scaleCorrectors[e]=n[e],isCSSVariableName(e)&&(scaleCorrectors[e].isCSSVariable=!0)}function isForcedMotionValue(n,{layout:e,layoutId:i}){return transformProps.has(n)||n.startsWith("origin")||(e||i!==void 0)&&(!!scaleCorrectors[n]||n==="opacity")}const translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(n,e,i){let a="",s=!0;for(let r=0;r<numTransforms;r++){const o=transformPropOrder[r],l=n[o];if(l===void 0)continue;let u=!0;if(typeof l=="number"?u=l===(o.startsWith("scale")?1:0):u=parseFloat(l)===0,!u||i){const c=getValueAsType(l,numberValueTypes[o]);if(!u){s=!1;const d=translateAlias[o]||o;a+=`${d}(${c}) `}i&&(e[o]=c)}}return a=a.trim(),i?a=i(e,s?"":a):s&&(a="none"),a}function buildHTMLStyles(n,e,i){const{style:a,vars:s,transformOrigin:r}=n;let o=!1,l=!1;for(const u in e){const c=e[u];if(transformProps.has(u)){o=!0;continue}else if(isCSSVariableName(u)){s[u]=c;continue}else{const d=getValueAsType(c,numberValueTypes[u]);u.startsWith("origin")?(l=!0,r[u]=d):a[u]=d}}if(e.transform||(o||i?a.transform=buildTransform(e,n.transform,i):a.transform&&(a.transform="none")),l){const{originX:u="50%",originY:c="50%",originZ:d=0}=r;a.transformOrigin=`${u} ${c} ${d}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(n,e,i){for(const a in e)!isMotionValue(e[a])&&!isForcedMotionValue(a,i)&&(n[a]=e[a])}function useInitialMotionValues({transformTemplate:n},e){return React.useMemo(()=>{const i=createHtmlRenderState();return buildHTMLStyles(i,e,n),Object.assign({},i.vars,i.style)},[e])}function useStyle(n,e){const i=n.style||{},a={};return copyRawValuesOnly(a,i,n),Object.assign(a,useInitialMotionValues(n,e)),a}function useHTMLProps(n,e){const i={},a=useStyle(n,e);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=a,i}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(n,e,i=1,a=0,s=!0){n.pathLength=1;const r=s?dashKeys:camelKeys;n[r.offset]=px.transform(-a);const o=px.transform(e),l=px.transform(i);n[r.array]=`${o} ${l}`}function buildSVGAttrs(n,{attrX:e,attrY:i,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...l},u,c,d){if(buildHTMLStyles(n,l,c),u){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:p,style:f}=n;p.transform&&(f.transform=p.transform,delete p.transform),(f.transform||p.transformOrigin)&&(f.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete p.transformBox),e!==void 0&&(p.x=e),i!==void 0&&(p.y=i),a!==void 0&&(p.scale=a),s!==void 0&&buildSVGPath(p,s,r,o,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=n=>typeof n=="string"&&n.toLowerCase()==="svg";function useSVGProps(n,e,i,a){const s=React.useMemo(()=>{const r=createSvgRenderState();return buildSVGAttrs(r,e,isSVGTag(a),n.transformTemplate,n.style),{...r.attrs,style:{...r.style}}},[e]);if(n.style){const r={};copyRawValuesOnly(r,n.style,n),s.style={...r,...s.style}}return s}const lowercaseSVGElements=["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 isSVGComponent(n){return typeof n!="string"||n.includes("-")?!1:!!(lowercaseSVGElements.indexOf(n)>-1||/[A-Z]/u.test(n))}function useRender(n,e,i,{latestValues:a},s,r=!1){const l=(isSVGComponent(n)?useSVGProps:useHTMLProps)(e,a,s,n),u=filterProps(e,typeof n=="string",r),c=n!==React.Fragment?{...u,...l,ref:i}:{},{children:d}=e,p=React.useMemo(()=>isMotionValue(d)?d.get():d,[d]);return React.createElement(n,{...c,children:p})}function getValueState(n){const e=[{},{}];return n==null||n.values.forEach((i,a)=>{e[0][a]=i.get(),e[1][a]=i.getVelocity()}),e}function resolveVariantFromProps(n,e,i,a){if(typeof e=="function"){const[s,r]=getValueState(a);e=e(i!==void 0?i:n.custom,s,r)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,r]=getValueState(a);e=e(i!==void 0?i:n.custom,s,r)}return e}function resolveMotionValue(n){return isMotionValue(n)?n.get():n}function makeState({scrapeMotionValuesFromProps:n,createRenderState:e},i,a,s){return{latestValues:makeLatestValues(i,a,s,n),renderState:e()}}function makeLatestValues(n,e,i,a){const s={},r=a(n,{});for(const f in r)s[f]=resolveMotionValue(r[f]);let{initial:o,animate:l}=n;const u=isControllingVariants(n),c=isVariantNode(n);e&&c&&!u&&n.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=i?i.initial===!1:!1;d=d||o===!1;const p=d?l:o;if(p&&typeof p!="boolean"&&!isAnimationControls(p)){const f=Array.isArray(p)?p:[p];for(let m=0;m<f.length;m++){const P=resolveVariantFromProps(n,f[m]);if(P){const{transitionEnd:T,transition:x,...y}=P;for(const S in y){let g=y[S];if(Array.isArray(g)){const C=d?g.length-1:0;g=g[C]}g!==null&&(s[S]=g)}for(const S in T)s[S]=T[S]}}}return s}const makeUseVisualState=n=>(e,i)=>{const a=React.useContext(MotionContext),s=React.useContext(PresenceContext),r=()=>makeState(n,e,a,s);return i?r():useConstant(r)};function scrapeMotionValuesFromProps$1(n,e,i){var r;const{style:a}=n,s={};for(const o in a)(isMotionValue(a[o])||e.style&&isMotionValue(e.style[o])||isForcedMotionValue(o,n)||((r=i==null?void 0:i.getValue(o))==null?void 0:r.liveStyle)!==void 0)&&(s[o]=a[o]);return s}const useHTMLVisualState=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState});function scrapeMotionValuesFromProps(n,e,i){const a=scrapeMotionValuesFromProps$1(n,e,i);for(const s in n)if(isMotionValue(n[s])||isMotionValue(e[s])){const r=transformPropOrder.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;a[r]=n[s]}return a}const useSVGVisualState=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function isRefObject(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function useMotionRef(n,e,i){return React.useCallback(a=>{a&&n.onMount&&n.onMount(a),e&&(a?e.mount(a):e.unmount()),i&&(typeof i=="function"?i(a):isRefObject(i)&&(i.current=a))},[e])}const camelToDash=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),SwitchLayoutGroupContext=React.createContext({});function useVisualElement(n,e,i,a,s){var T,x;const{visualElement:r}=React.useContext(MotionContext),o=React.useContext(LazyContext),l=React.useContext(PresenceContext),u=React.useContext(MotionConfigContext).reducedMotion,c=React.useRef(null);a=a||o.renderer,!c.current&&a&&(c.current=a(n,{visualState:e,parent:r,props:i,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u}));const d=c.current,p=React.useContext(SwitchLayoutGroupContext);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&createProjectionNode$1(c.current,i,s,p);const f=React.useRef(!1);React.useInsertionEffect(()=>{d&&f.current&&d.update(i,l)});const m=i[optimizedAppearDataAttribute],P=React.useRef(!!m&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,m))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,m)));return useIsomorphicLayoutEffect(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),P.current&&d.animationState&&d.animationState.animateChanges())}),React.useEffect(()=>{d&&(!P.current&&d.animationState&&d.animationState.animateChanges(),P.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,m)}),P.current=!1),d.enteringChildren=void 0)}),d}function createProjectionNode$1(n,e,i,a){const{layoutId:s,layout:r,drag:o,dragConstraints:l,layoutScroll:u,layoutRoot:c,layoutCrossfade:d}=e;n.projection=new i(n.latestValues,e["data-framer-portal-id"]?void 0:getClosestProjectingNode(n.parent)),n.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!o||l&&isRefObject(l),visualElement:n,animationType:typeof r=="string"?r:"both",initialPromotionConfig:a,crossfade:d,layoutScroll:u,layoutRoot:c})}function getClosestProjectingNode(n){if(n)return n.options.allowProjection!==!1?n.projection:getClosestProjectingNode(n.parent)}function createMotionComponent(n,{forwardMotionProps:e=!1}={},i,a){i&&loadFeatures(i);const s=isSVGComponent(n)?useSVGVisualState:useHTMLVisualState;function r(l,u){let c;const d={...React.useContext(MotionConfigContext),...l,layoutId:useLayoutId(l)},{isStatic:p}=d,f=useCreateMotionContext(l),m=s(l,p);if(!p&&isBrowser){useStrictMode(d,i);const P=getProjectionFunctionality(d);c=P.MeasureLayout,f.visualElement=useVisualElement(n,m,d,a,P.ProjectionNode)}return jsxRuntime.jsxs(MotionContext.Provider,{value:f,children:[c&&f.visualElement?jsxRuntime.jsx(c,{visualElement:f.visualElement,...d}):null,useRender(n,l,useMotionRef(m,f.visualElement,u),m,p,e)]})}r.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const o=React.forwardRef(r);return o[motionComponentSymbol]=n,o}function useLayoutId({layoutId:n}){const e=React.useContext(LayoutGroupContext).id;return e&&n!==void 0?e+"-"+n:n}function useStrictMode(n,e){const i=React.useContext(LazyContext).strict;if(process.env.NODE_ENV!=="production"&&e&&i){const a="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?warning(!1,a,"lazy-strict-mode"):invariant(!1,a,"lazy-strict-mode")}}function getProjectionFunctionality(n){const{drag:e,layout:i}=featureDefinitions;if(!e&&!i)return{};const a={...e,...i};return{MeasureLayout:e!=null&&e.isEnabled(n)||i!=null&&i.isEnabled(n)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function createMotionProxy(n,e){if(typeof Proxy>"u")return createMotionComponent;const i=new Map,a=(r,o)=>createMotionComponent(r,o,n,e),s=(r,o)=>(process.env.NODE_ENV!=="production"&&warnOnce(!1,"motion() is deprecated. Use motion.create() instead."),a(r,o));return new Proxy(s,{get:(r,o)=>o==="create"?a:(i.has(o)||i.set(o,createMotionComponent(o,void 0,n,e)),i.get(o))})}function convertBoundingBoxToBox({top:n,left:e,right:i,bottom:a}){return{x:{min:e,max:i},y:{min:n,max:a}}}function convertBoxToBoundingBox({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function transformBoxPoints(n,e){if(!e)return n;const i=e({x:n.left,y:n.top}),a=e({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:a.y,right:a.x}}function isIdentityScale(n){return n===void 0||n===1}function hasScale({scale:n,scaleX:e,scaleY:i}){return!isIdentityScale(n)||!isIdentityScale(e)||!isIdentityScale(i)}function hasTransform(n){return hasScale(n)||has2DTranslate(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function has2DTranslate(n){return is2DTranslate(n.x)||is2DTranslate(n.y)}function is2DTranslate(n){return n&&n!=="0%"}function scalePoint(n,e,i){const a=n-i,s=e*a;return i+s}function applyPointDelta(n,e,i,a,s){return s!==void 0&&(n=scalePoint(n,s,a)),scalePoint(n,i,a)+e}function applyAxisDelta(n,e=0,i=1,a,s){n.min=applyPointDelta(n.min,e,i,a,s),n.max=applyPointDelta(n.max,e,i,a,s)}function applyBoxDelta(n,{x:e,y:i}){applyAxisDelta(n.x,e.translate,e.scale,e.originPoint),applyAxisDelta(n.y,i.translate,i.scale,i.originPoint)}const TREE_SCALE_SNAP_MIN=.999999999999,TREE_SCALE_SNAP_MAX=1.0000000000001;function applyTreeDeltas(n,e,i,a=!1){const s=i.length;if(!s)return;e.x=e.y=1;let r,o;for(let l=0;l<s;l++){r=i[l],o=r.projectionDelta;const{visualElement:u}=r.options;u&&u.props.style&&u.props.style.display==="contents"||(a&&r.options.layoutScroll&&r.scroll&&r!==r.root&&transformBox(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,applyBoxDelta(n,o)),a&&hasTransform(r.latestValues)&&transformBox(n,r.latestValues))}e.x<TREE_SCALE_SNAP_MAX&&e.x>TREE_SCALE_SNAP_MIN&&(e.x=1),e.y<TREE_SCALE_SNAP_MAX&&e.y>TREE_SCALE_SNAP_MIN&&(e.y=1)}function translateAxis(n,e){n.min=n.min+e,n.max=n.max+e}function transformAxis(n,e,i,a,s=.5){const r=mixNumber$1(n.min,n.max,s);applyAxisDelta(n,e,i,r,a)}function transformBox(n,e){transformAxis(n.x,e.x,e.scaleX,e.scale,e.originX),transformAxis(n.y,e.y,e.scaleY,e.scale,e.originY)}function measureViewportBox(n,e){return convertBoundingBoxToBox(transformBoxPoints(n.getBoundingClientRect(),e))}function measurePageBox(n,e,i){const a=measureViewportBox(n,i),{scroll:s}=e;return s&&(translateAxis(a.x,s.offset.x),translateAxis(a.y,s.offset.y)),a}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>prefersReducedMotion.current=n.matches;n.addEventListener("change",e),e()}else prefersReducedMotion.current=!1}const visualElementStore=new WeakMap;function updateMotionValuesFromProps(n,e,i){for(const a in e){const s=e[a],r=i[a];if(isMotionValue(s))n.addValue(a,s);else if(isMotionValue(r))n.addValue(a,motionValue(s,{owner:n}));else if(r!==s)if(n.hasValue(a)){const o=n.getValue(a);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=n.getStaticValue(a);n.addValue(a,motionValue(o!==void 0?o:s,{owner:n}))}}for(const a in i)e[a]===void 0&&n.removeValue(a);return e}const propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class VisualElement{scrapeMotionValuesFromProps(e,i,a){return{}}constructor({parent:e,props:i,presenceContext:a,reducedMotionConfig:s,blockInitialAnimation:r,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,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=time.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,frame.render(this.render,!1,!0))};const{latestValues:u,renderState:c}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=i.initial?{...u}:{},this.renderState=c,this.parent=e,this.props=i,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!r,this.isControllingVariants=isControllingVariants(i),this.isVariantNode=isVariantNode(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(i,{},this);for(const f in p){const m=p[f];u[f]!==void 0&&isMotionValue(m)&&m.set(u[f])}}mount(e){var i;this.current=e,visualElementStore.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((a,s)=>this.bindToMotionValue(s,a)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(i=>i()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const i in this.events)this.events[i].clear();for(const i in this.features){const a=this.features[i];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,i){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const a=transformProps.has(e);a&&this.onBindTransform&&this.onBindTransform();const s=i.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&frame.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,i)),this.valueSubscriptions.set(e,()=>{s(),r&&r(),i.owner&&i.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 featureDefinitions){const i=featureDefinitions[e];if(!i)continue;const{isEnabled:a,Feature:s}=i;if(!this.features[e]&&s&&a(this.props)&&(this.features[e]=new s(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):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,i){this.latestValues[e]=i}update(e,i){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let a=0;a<propEventHandlers.length;a++){const s=propEventHandlers[a];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const r="on"+s,o=e[r];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}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 i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(e),()=>i.variantChildren.delete(e)}addValue(e,i){const a=this.values.get(e);i!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,i),this.values.set(e,i),this.latestValues[e]=i.get())}removeValue(e){this.values.delete(e);const i=this.valueSubscriptions.get(e);i&&(i(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,i){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&i!==void 0&&(a=motionValue(i===null?void 0:i,{owner:this}),this.addValue(e,a)),a}readValue(e,i){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(isNumericalString(a)||isZeroValueString(a))?a=parseFloat(a):!findValueType(a)&&complex.test(i)&&(a=getAnimatableNone(e,i)),this.setBaseTarget(e,isMotionValue(a)?a.get():a)),isMotionValue(a)?a.get():a}setBaseTarget(e,i){this.baseTarget[e]=i}getBaseTarget(e){var r;const{initial:i}=this.props;let a;if(typeof i=="string"||typeof i=="object"){const o=resolveVariantFromProps(this.props,i,(r=this.presenceContext)==null?void 0:r.custom);o&&(a=o[e])}if(i&&a!==void 0)return a;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!isMotionValue(s)?s:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,i){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(i)}notify(e,...i){this.events[e]&&this.events[e].notify(...i)}scheduleRenderMicrotask(){microtask.render(this.render)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,i){return e.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(e,i){return e.style?e.style[i]:void 0}removeValueFromRenderState(e,{vars:i,style:a}){delete i[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function renderHTML(n,{style:e,vars:i},a,s){const r=n.style;let o;for(o in e)r[o]=e[o];s==null||s.applyProjectionStyles(r,a);for(o in i)r.setProperty(o,i[o])}function getComputedStyle$1(n){return window.getComputedStyle(n)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html",this.renderInstance=renderHTML}readValueFromInstance(e,i){var a;if(transformProps.has(i))return(a=this.projection)!=null&&a.isProjecting?defaultTransformValue(i):readTransformValue(e,i);{const s=getComputedStyle$1(e),r=(isCSSVariableName(i)?s.getPropertyValue(i):s[i])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:i}){return measureViewportBox(e,i)}build(e,i,a){buildHTMLStyles(e,i,a.transformTemplate)}scrapeMotionValuesFromProps(e,i,a){return scrapeMotionValuesFromProps$1(e,i,a)}}const camelCaseAttributes=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 renderSVG(n,e,i,a){renderHTML(n,e,void 0,a);for(const s in e.attrs)n.setAttribute(camelCaseAttributes.has(s)?s:camelToDash(s),e.attrs[s])}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,i){return e[i]}readValueFromInstance(e,i){if(transformProps.has(i)){const a=getDefaultValueType(i);return a&&a.default||0}return i=camelCaseAttributes.has(i)?i:camelToDash(i),e.getAttribute(i)}scrapeMotionValuesFromProps(e,i,a){return scrapeMotionValuesFromProps(e,i,a)}build(e,i,a){buildSVGAttrs(e,i,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,i,a,s){renderSVG(e,i,a,s)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}}const createDomVisualElement=(n,e)=>isSVGComponent(n)?new SVGVisualElement(e):new HTMLVisualElement(e,{allowProjection:n!==React.Fragment});function resolveVariant(n,e,i){const a=n.getProps();return resolveVariantFromProps(a,e,i!==void 0?i:a.custom,n)}const isKeyframesTarget=n=>Array.isArray(n);function setMotionValue(n,e,i){n.hasValue(e)?n.getValue(e).set(i):n.addValue(e,motionValue(i))}function resolveFinalValueInKeyframes(n){return isKeyframesTarget(n)?n[n.length-1]||0:n}function setTarget(n,e){const i=resolveVariant(n,e);let{transitionEnd:a={},transition:s={},...r}=i||{};r={...r,...a};for(const o in r){const l=resolveFinalValueInKeyframes(r[o]);setMotionValue(n,o,l)}}function isWillChangeMotionValue(n){return!!(isMotionValue(n)&&n.add)}function addValueToWillChange(n,e){const i=n.getValue("willChange");if(isWillChangeMotionValue(i))return i.add(e);if(!i&&MotionGlobalConfig.WillChange){const a=new MotionGlobalConfig.WillChange("auto");n.addValue("willChange",a),a.add(e)}}function getOptimisedAppearId(n){return n.props[optimizedAppearDataAttribute]}const isNotNull=n=>n!==null;function getFinalKeyframe(n,{repeat:e,repeatType:i="loop"},a){const s=n.filter(isNotNull),r=e&&i!=="loop"&&e%2===1?0:s.length-1;return!r||a===void 0?s[r]:a}const underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(n,{keyframes:e})=>e.length>2?keyframesTransition:transformProps.has(n)?n.startsWith("scale")?criticallyDampedSpring(e[1]):underDampedSpring:ease;function isTransitionDefined({when:n,delay:e,delayChildren:i,staggerChildren:a,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:l,from:u,elapsed:c,...d}){return!!Object.keys(d).length}const animateMotionValue=(n,e,i,a={},s,r)=>o=>{const l=getValueTransition(a,n)||{},u=l.delay||a.delay||0;let{elapsed:c=0}=a;c=c-secondsToMilliseconds(u);const d={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-c,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:n,motionValue:e,element:r?void 0:s};isTransitionDefined(l)||Object.assign(d,getDefaultTransition(n,d)),d.duration&&(d.duration=secondsToMilliseconds(d.duration)),d.repeatDelay&&(d.repeatDelay=secondsToMilliseconds(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(makeAnimationInstant(d),d.delay===0&&(p=!0)),(MotionGlobalConfig.instantAnimations||MotionGlobalConfig.skipAnimations)&&(p=!0,makeAnimationInstant(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,p&&!r&&e.get()!==void 0){const f=getFinalKeyframe(d.keyframes,l);if(f!==void 0){frame.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new JSAnimation(d):new AsyncMotionValueAnimation(d)};function shouldBlockAnimation({protectedKeys:n,needsAnimating:e},i){const a=n.hasOwnProperty(i)&&e[i]!==!0;return e[i]=!1,a}function animateTarget(n,e,{delay:i=0,transitionOverride:a,type:s}={}){let{transition:r=n.getDefaultTransition(),transitionEnd:o,...l}=e;a&&(r=a);const u=[],c=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const p=n.getValue(d,n.latestValues[d]??null),f=l[d];if(f===void 0||c&&shouldBlockAnimation(c,d))continue;const m={delay:i,...getValueTransition(r||{},d)},P=p.get();if(P!==void 0&&!p.isAnimating&&!Array.isArray(f)&&f===P&&!m.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const y=getOptimisedAppearId(n);if(y){const S=window.MotionHandoffAnimation(y,d,frame);S!==null&&(m.startTime=S,T=!0)}}addValueToWillChange(n,d),p.start(animateMotionValue(d,p,f,n.shouldReduceMotion&&positionalKeys.has(d)?{type:!1}:m,n,T));const x=p.animation;x&&u.push(x)}return o&&Promise.all(u).then(()=>{frame.update(()=>{o&&setTarget(n,o)})}),u}function calcChildStagger(n,e,i,a=0,s=1){const r=Array.from(n).sort((c,d)=>c.sortNodePosition(d)).indexOf(e),o=n.size,l=(o-1)*a;return typeof i=="function"?i(r,o):s===1?r*a:l-r*a}function animateVariant(n,e,i={}){var u;const a=resolveVariant(n,e,i.type==="exit"?(u=n.presenceContext)==null?void 0:u.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=a||{};i.transitionOverride&&(s=i.transitionOverride);const r=a?()=>Promise.all(animateTarget(n,a,i)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:f}=s;return animateChildren(n,e,c,d,p,f,i)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,d]=l==="beforeChildren"?[r,o]:[o,r];return c().then(()=>d())}else return Promise.all([r(),o(i.delay)])}function animateChildren(n,e,i=0,a=0,s=0,r=1,o){const l=[];for(const u of n.variantChildren)u.notify("AnimationStart",e),l.push(animateVariant(u,e,{...o,delay:i+(typeof a=="function"?0:a)+calcChildStagger(n.variantChildren,u,a,s,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(l)}function animateVisualElement(n,e,i={}){n.notify("AnimationStart",e);let a;if(Array.isArray(e)){const s=e.map(r=>animateVariant(n,r,i));a=Promise.all(s)}else if(typeof e=="string")a=animateVariant(n,e,i);else{const s=typeof e=="function"?resolveVariant(n,e,i.custom):e;a=Promise.all(animateTarget(n,s,i))}return a.then(()=>{n.notify("AnimationComplete",e)})}function shallowCompare(n,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==n.length)return!1;for(let a=0;a<i;a++)if(e[a]!==n[a])return!1;return!0}const numVariantProps=variantProps.length;function getVariantContext(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?getVariantContext(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const e={};for(let i=0;i<numVariantProps;i++){const a=variantProps[i],s=n.props[a];(isVariantLabel(s)||s===!1)&&(e[a]=s)}return e}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(n){return e=>Promise.all(e.map(({animation:i,options:a})=>animateVisualElement(n,i,a)))}function createAnimationState(n){let e=animateList(n),i=createState(),a=!0;const s=u=>(c,d)=>{var f;const p=resolveVariant(n,d,u==="exit"?(f=n.presenceContext)==null?void 0:f.custom:void 0);if(p){const{transition:m,transitionEnd:P,...T}=p;c={...c,...T,...P}}return c};function r(u){e=u(n)}function o(u){const{props:c}=n,d=getVariantContext(n.parent)||{},p=[],f=new Set;let m={},P=1/0;for(let x=0;x<numAnimationTypes;x++){const y=reversePriorityOrder[x],S=i[y],g=c[y]!==void 0?c[y]:d[y],C=isVariantLabel(g),E=y===u?S.isActive:null;E===!1&&(P=x);let B=g===d[y]&&g!==c[y]&&C;if(B&&a&&n.manuallyAnimateOnMount&&(B=!1),S.protectedKeys={...m},!S.isActive&&E===null||!g&&!S.prevProp||isAnimationControls(g)||typeof g=="boolean")continue;const _=checkVariantsDidChange(S.prevProp,g);let M=_||y===u&&S.isActive&&!B&&C||x>P&&C,D=!1;const L=Array.isArray(g)?g:[g];let F=L.reduce(s(y),{});E===!1&&(F={});const{prevResolvedValues:N={}}=S,H={...N,...F},$=I=>{M=!0,f.has(I)&&(D=!0,f.delete(I)),S.needsAnimating[I]=!0;const V=n.getValue(I);V&&(V.liveStyle=!1)};for(const I in H){const V=F[I],A=N[I];if(m.hasOwnProperty(I))continue;let k=!1;isKeyframesTarget(V)&&isKeyframesTarget(A)?k=!shallowCompare(V,A):k=V!==A,k?V!=null?$(I):f.add(I):V!==void 0&&f.has(I)?$(I):S.protectedKeys[I]=!0}S.prevProp=g,S.prevResolvedValues=F,S.isActive&&(m={...m,...F}),a&&n.blockInitialAnimation&&(M=!1);const O=B&&_;M&&(!O||D)&&p.push(...L.map(I=>{const V={type:y};if(typeof I=="string"&&a&&!O&&n.manuallyAnimateOnMount&&n.parent){const{parent:A}=n,k=resolveVariant(A,I);if(A.enteringChildren&&k){const{delayChildren:R}=k.transition||{};V.delay=calcChildStagger(A.enteringChildren,n,R)}}return{animation:I,options:V}}))}if(f.size){const x={};if(typeof c.initial!="boolean"){const y=resolveVariant(n,Array.isArray(c.initial)?c.initial[0]:c.initial);y&&y.transition&&(x.transition=y.transition)}f.forEach(y=>{const S=n.getBaseTarget(y),g=n.getValue(y);g&&(g.liveStyle=!0),x[y]=S??null}),p.push({animation:x})}let T=!!p.length;return a&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(T=!1),a=!1,T?e(p):Promise.resolve()}function l(u,c){var p;if(i[u].isActive===c)return Promise.resolve();(p=n.variantChildren)==null||p.forEach(f=>{var m;return(m=f.animationState)==null?void 0:m.setActive(u,c)}),i[u].isActive=c;const d=o(u);for(const f in i)i[f].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:r,getState:()=>i,reset:()=>{i=createState()}}}function checkVariantsDidChange(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!shallowCompare(e,n):!1}function createTypeState(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class Feature{constructor(e){this.isMounted=!1,this.node=e}update(){}}class AnimationFeature extends Feature{constructor(e){super(e),e.animationState||(e.animationState=createAnimationState(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:i}=this.node.prevProps||{};e!==i&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:i}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;const s=this.node.animationState.setActive("exit",!e);i&&!e&&s.then(()=>{i(this.id)})}mount(){const{register:e,onExitComplete:i}=this.node.presenceContext||{};i&&i(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function addDomEvent(n,e,i,a={passive:!0}){return n.addEventListener(e,i,a),()=>n.removeEventListener(e,i)}function extractEventInfo(n){return{point:{x:n.pageX,y:n.pageY}}}const addPointerInfo=n=>e=>isPrimaryPointer(e)&&n(e,extractEventInfo(e));function addPointerEvent(n,e,i,a){return addDomEvent(n,e,addPointerInfo(i),a)}const SCALE_PRECISION=1e-4,SCALE_MIN=1-SCALE_PRECISION,SCALE_MAX=1+SCALE_PRECISION,TRANSLATE_PRECISION=.01,TRANSLATE_MIN=0-TRANSLATE_PRECISION,TRANSLATE_MAX=0+TRANSLATE_PRECISION;function calcLength(n){return n.max-n.min}function isNear(n,e,i){return Math.abs(n-e)<=i}function calcAxisDelta(n,e,i,a=.5){n.origin=a,n.originPoint=mixNumber$1(e.min,e.max,n.origin),n.scale=calcLength(i)/calcLength(e),n.translate=mixNumber$1(i.min,i.max,n.origin)-n.originPoint,(n.scale>=SCALE_MIN&&n.scale<=SCALE_MAX||isNaN(n.scale))&&(n.scale=1),(n.translate>=TRANSLATE_MIN&&n.translate<=TRANSLATE_MAX||isNaN(n.translate))&&(n.translate=0)}function calcBoxDelta(n,e,i,a){calcAxisDelta(n.x,e.x,i.x,a?a.originX:void 0),calcAxisDelta(n.y,e.y,i.y,a?a.originY:void 0)}function calcRelativeAxis(n,e,i){n.min=i.min+e.min,n.max=n.min+calcLength(e)}function calcRelativeBox(n,e,i){calcRelativeAxis(n.x,e.x,i.x),calcRelativeAxis(n.y,e.y,i.y)}function calcRelativeAxisPosition(n,e,i){n.min=e.min-i.min,n.max=n.min+calcLength(e)}function calcRelativePosition(n,e,i){calcRelativeAxisPosition(n.x,e.x,i.x),calcRelativeAxisPosition(n.y,e.y,i.y)}function eachAxis(n){return[n("x"),n("y")]}const getContextWindow=({current:n})=>n?n.ownerDocument.defaultView:null,distance=(n,e)=>Math.abs(n-e);function distance2D(n,e){const i=distance(n.x,e.x),a=distance(n.y,e.y);return Math.sqrt(i**2+a**2)}class PanSession{constructor(e,i,{transformPagePoint:a,contextWindow:s=window,dragSnapToOrigin:r=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=getPanInfo(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,P=distance2D(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!P)return;const{point:T}=f,{timestamp:x}=frameData;this.history.push({...T,timestamp:x});const{onStart:y,onMove:S}=this.handlers;m||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,f)},this.handlePointerMove=(f,m)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=transformPoint(m,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(f,m)=>{this.end();const{onEnd:P,onSessionEnd:T,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=getPanInfo(f.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(m,this.transformPagePoint),this.history);this.startEvent&&P&&P(f,y),T&&T(f,y)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=r,this.handlers=i,this.transformPagePoint=a,this.distanceThreshold=o,this.contextWindow=s||window;const l=extractEventInfo(e),u=transformPoint(l,this.transformPagePoint),{point:c}=u,{timestamp:d}=frameData;this.history=[{...c,timestamp:d}];const{onSessionStart:p}=i;p&&p(e,getPanInfo(u,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(n,e){return e?{point:e(n.point)}:n}function subtractPoint(n,e){return{x:n.x-e.x,y:n.y-e.y}}function getPanInfo({point:n},e){return{point:n,delta:subtractPoint(n,lastDevicePoint(e)),offset:subtractPoint(n,startDevicePoint(e)),velocity:getVelocity(e,.1)}}function startDevicePoint(n){return n[0]}function lastDevicePoint(n){return n[n.length-1]}function getVelocity(n,e){if(n.length<2)return{x:0,y:0};let i=n.length-1,a=null;const s=lastDevicePoint(n);for(;i>=0&&(a=n[i],!(s.timestamp-a.timestamp>secondsToMilliseconds(e)));)i--;if(!a)return{x:0,y:0};const r=millisecondsToSeconds(s.timestamp-a.timestamp);if(r===0)return{x:0,y:0};const o={x:(s.x-a.x)/r,y:(s.y-a.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(n,{min:e,max:i},a){return e!==void 0&&n<e?n=a?mixNumber$1(e,n,a.min):Math.max(n,e):i!==void 0&&n>i&&(n=a?mixNumber$1(i,n,a.max):Math.min(n,i)),n}function calcRelativeAxisConstraints(n,e,i){return{min:e!==void 0?n.min+e:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function calcRelativeConstraints(n,{top:e,left:i,bottom:a,right:s}){return{x:calcRelativeAxisConstraints(n.x,i,s),y:calcRelativeAxisConstraints(n.y,e,a)}}function calcViewportAxisConstraints(n,e){let i=e.min-n.min,a=e.max-n.max;return e.max-e.min<n.max-n.min&&([i,a]=[a,i]),{min:i,max:a}}function calcViewportConstraints(n,e){return{x:calcViewportAxisConstraints(n.x,e.x),y:calcViewportAxisConstraints(n.y,e.y)}}function calcOrigin(n,e){let i=.5;const a=calcLength(n),s=calcLength(e);return s>a?i=progress(e.min,e.max-a,n.min):a>s&&(i=progress(n.min,n.max-s,e.min)),clamp(0,1,i)}function rebaseAxisConstraints(n,e){const i={};return e.min!==void 0&&(i.min=e.min-n.min),e.max!==void 0&&(i.max=e.max-n.min),i}const defaultElastic=.35;function resolveDragElastic(n=defaultElastic){return n===!1?n=0:n===!0&&(n=defaultElastic),{x:resolveAxisElastic(n,"left","right"),y:resolveAxisElastic(n,"top","bottom")}}function resolveAxisElastic(n,e,i){return{min:resolvePointElastic(n,e),max:resolvePointElastic(n,i)}}function resolvePointElastic(n,e){return typeof n=="number"?n:n[e]||0}const elementDragControls=new WeakMap;class VisualElementDragControls{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=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:i=!1,distanceThreshold:a}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const r=p=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(extractEventInfo(p).point)},o=(p,f)=>{const{drag:m,dragPropagation:P,onDragStart:T}=this.getProps();if(m&&!P&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(m),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(y=>{let S=this.getAxisMotionValue(y).get()||0;if(percent.test(S)){const{projection:g}=this.visualElement;if(g&&g.layout){const C=g.layout.layoutBox[y];C&&(S=calcLength(C)*(parseFloat(S)/100))}}this.originPoint[y]=S}),T&&frame.postRender(()=>T(p,f)),addValueToWillChange(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(p,f)=>{this.latestPointerEvent=p,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:P,onDirectionLock:T,onDrag:x}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:y}=f;if(P&&this.currentDirection===null){this.currentDirection=getCurrentDirection(y),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),x&&x(p,f)},u=(p,f)=>{this.latestPointerEvent=p,this.latestPanInfo=f,this.stop(p,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>eachAxis(p=>{var f;return this.getAnimationState(p)==="paused"&&((f=this.getAxisMotionValue(p).animation)==null?void 0:f.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new PanSession(e,{onSessionStart:r,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:a,contextWindow:getContextWindow(this.visualElement)})}stop(e,i){const a=e||this.latestPointerEvent,s=i||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!s||!a)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&frame.postRender(()=>l(a,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:i}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(e,i,a){const{drag:s}=this.getProps();if(!a||!shouldDrag(e,s,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(o=applyConstraints(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){var r;const{dragConstraints:e,dragElastic:i}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,s=this.constraints;e&&isRefObject(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=calcRelativeConstraints(a.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(i),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=rebaseAxisConstraints(a.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:i}=this.getProps();if(!e||!isRefObject(e))return!1;const a=e.current;invariant(a!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=measurePageBox(a,s.root,this.visualElement.getTransformPagePoint());let o=calcViewportConstraints(s.layout.layoutBox,r);if(i){const l=i(convertBoxToBoundingBox(o));this.hasMutatedConstraints=!!l,l&&(o=convertBoundingBoxToBox(l))}return o}startAnimation(e){const{drag:i,dragMomentum:a,dragElastic:s,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},c=eachAxis(d=>{if(!shouldDrag(d,i,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const f=s?200:1e6,m=s?40:1e7,P={type:"inertia",velocity:a?e[d]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...r,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(c).then(l)}startAxisValueAnimation(e,i){const a=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),a.start(animateMotionValue(e,a,0,i,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){eachAxis(e=>{var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.pause()})}getAnimationState(e){var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.state}getAxisMotionValue(e){const i=`_drag${e.toUpperCase()}`,a=this.visualElement.getProps(),s=a[i];return s||this.visualElement.getValue(e,(a.initial?a.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(i=>{const{drag:a}=this.getProps();if(!shouldDrag(i,a,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(i);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[i];r.set(e[i]-mixNumber$1(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:a}=this.visualElement;if(!isRefObject(i)||!a||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};eachAxis(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const u=l.get();s[o]=calcOrigin({min:u,max:u},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),eachAxis(o=>{if(!shouldDrag(o,e,null))return;const l=this.getAxisMotionValue(o),{min:u,max:c}=this.constraints[o];l.set(mixNumber$1(u,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const e=this.visualElement.current,i=addPointerEvent(e,"pointerdown",u=>{const{drag:c,dragListener:d=!0}=this.getProps();c&&d&&this.start(u)}),a=()=>{const{dragConstraints:u}=this.getProps();isRefObject(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",a);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),frame.read(a);const o=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(eachAxis(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),i(),r(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:a=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:o=defaultElastic,dragMomentum:l=!0}=e;return{...e,drag:i,dragDirectionLock:a,dragPropagation:s,dragConstraints:r,dragElastic:o,dragMomentum:l}}}function shouldDrag(n,e,i){return(e===!0||e===n)&&(i===null||i===n)}function getCurrentDirection(n,e=10){let i=null;return Math.abs(n.y)>e?i="y":Math.abs(n.x)>e&&(i="x"),i}class DragGesture extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=n=>(e,i)=>{n&&frame.postRender(()=>n(e,i))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:i,onPan:a,onPanEnd:s}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(i),onMove:a,onEnd:(r,o)=>{delete this.session,s&&frame.postRender(()=>s(r,o))}}}mount(){this.removePointerDownListener=addPointerEvent(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 globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const correctBorderRadius={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(px.test(n))n=parseFloat(n);else return n;const i=pixelsToPercent(n,e.target.x),a=pixelsToPercent(n,e.target.y);return`${i}% ${a}%`}},correctBoxShadow={correct:(n,{treeScale:e,projectionDelta:i})=>{const a=n,s=complex.parse(n);if(s.length>5)return a;const r=complex.createTransformer(n),o=typeof s[0]!="number"?1:0,l=i.x.scale*e.x,u=i.y.scale*e.y;s[0+o]/=l,s[1+o]/=u;const c=mixNumber$1(l,u,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),r(s)}};let hasTakenAnySnapshot=!1;class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a,layoutId:s}=this.props,{projection:r}=e;addScaleCorrector(defaultScaleCorrectors),r&&(i.group&&i.group.add(r),a&&a.register&&s&&a.register(r),hasTakenAnySnapshot&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:i,visualElement:a,drag:s,isPresent:r}=this.props,{projection:o}=a;return o&&(o.isPresent=r,hasTakenAnySnapshot=!0,s||e.layoutDependency!==i||i===void 0||e.isPresent!==r?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||frame.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),microtask.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a}=this.props,{projection:s}=e;hasTakenAnySnapshot=!0,s&&(s.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(s),a&&a.deregister&&a.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function MeasureLayout(n){const[e,i]=usePresence(),a=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(MeasureLayoutWithContext,{...n,layoutGroup:a,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:e,safeToRemove:i})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow};function animateSingleValue(n,e,i){const a=isMotionValue(n)?n:motionValue(n);return a.start(animateMotionValue("",a,e,i)),a.animation}const compareByDepth=(n,e)=>n.depth-e.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}}function delay(n,e){const i=time.now(),a=({timestamp:s})=>{const r=s-i;r>=e&&(cancelFrame(a),n(r-e))};return frame.setup(a,!0),()=>cancelFrame(a)}const borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=n=>typeof n=="string"?parseFloat(n):n,isPx=n=>typeof n=="number"||px.test(n);function mixValues(n,e,i,a,s,r){s?(n.opacity=mixNumber$1(0,i.opacity??1,easeCrossfadeIn(a)),n.opacityExit=mixNumber$1(e.opacity??1,0,easeCrossfadeOut(a))):r&&(n.opacity=mixNumber$1(e.opacity??1,i.opacity??1,a));for(let o=0;o<numBorders;o++){const l=`border${borders[o]}Radius`;let u=getRadius(e,l),c=getRadius(i,l);if(u===void 0&&c===void 0)continue;u||(u=0),c||(c=0),u===0||c===0||isPx(u)===isPx(c)?(n[l]=Math.max(mixNumber$1(asNumber(u),asNumber(c),a),0),(percent.test(c)||percent.test(u))&&(n[l]+="%")):n[l]=c}(e.rotate||i.rotate)&&(n.rotate=mixNumber$1(e.rotate||0,i.rotate||0,a))}function getRadius(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop);function compress(n,e,i){return a=>a<n?0:a>e?1:i(progress(n,e,a))}function copyAxisInto(n,e){n.min=e.min,n.max=e.max}function copyBoxInto(n,e){copyAxisInto(n.x,e.x),copyAxisInto(n.y,e.y)}function copyAxisDeltaInto(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function removePointDelta(n,e,i,a,s){return n-=e,n=scalePoint(n,1/i,a),s!==void 0&&(n=scalePoint(n,1/s,a)),n}function removeAxisDelta(n,e=0,i=1,a=.5,s,r=n,o=n){if(percent.test(e)&&(e=parseFloat(e),e=mixNumber$1(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=mixNumber$1(r.min,r.max,a);n===r&&(l-=e),n.min=removePointDelta(n.min,e,i,l,s),n.max=removePointDelta(n.max,e,i,l,s)}function removeAxisTransforms(n,e,[i,a,s],r,o){removeAxisDelta(n,e[i],e[a],e[s],e.scale,r,o)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(n,e,i,a){removeAxisTransforms(n.x,e,xKeys,i?i.x:void 0,a?a.x:void 0),removeAxisTransforms(n.y,e,yKeys,i?i.y:void 0,a?a.y:void 0)}function isAxisDeltaZero(n){return n.translate===0&&n.scale===1}function isDeltaZero(n){return isAxisDeltaZero(n.x)&&isAxisDeltaZero(n.y)}function axisEquals(n,e){return n.min===e.min&&n.max===e.max}function boxEquals(n,e){return axisEquals(n.x,e.x)&&axisEquals(n.y,e.y)}function axisEqualsRounded(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function boxEqualsRounded(n,e){return axisEqualsRounded(n.x,e.x)&&axisEqualsRounded(n.y,e.y)}function aspectRatio(n){return calcLength(n.x)/calcLength(n.y)}function axisDeltaEquals(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class NodeStack{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e),e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(e){const i=this.members.findIndex(s=>e===s);if(i===0)return!1;let a;for(let s=i;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1){a=r;break}}return a?(this.promote(a),!0):!1}promote(e,i){const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.instance&&a.scheduleRender(),e.scheduleRender(),e.resumeFrom=a,i&&(e.resumeFrom.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:i,resumingFrom:a}=e;i.onExitComplete&&i.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(n,e,i){let a="";const s=n.x.translate/e.x,r=n.y.translate/e.y,o=(i==null?void 0:i.z)||0;if((s||r||o)&&(a=`translate3d(${s}px, ${r}px, ${o}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:c,rotate:d,rotateX:p,rotateY:f,skewX:m,skewY:P}=i;c&&(a=`perspective(${c}px) ${a}`),d&&(a+=`rotate(${d}deg) `),p&&(a+=`rotateX(${p}deg) `),f&&(a+=`rotateY(${f}deg) `),m&&(a+=`skewX(${m}deg) `),P&&(a+=`skewY(${P}deg) `)}const l=n.x.scale*e.x,u=n.y.scale*e.y;return(l!==1||u!==1)&&(a+=`scale(${l}, ${u})`),a||"none"}const transformAxes=["","X","Y","Z"],animationTarget=1e3;let id=0;function resetDistortingTransform(n,e,i,a){const{latestValues:s}=e;s[n]&&(i[n]=s[n],e.setStaticValue(n,0),a&&(a[n]=0))}function cancelTreeOptimisedTransformAnimations(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const i=getOptimisedAppearId(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:s,layoutId:r}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",frame,!(s||r))}const{parent:a}=n;a&&!a.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(a)}function createProjectionNode({attachResizeListener:n,defaultParent:e,measureScroll:i,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=id++,this.animationId=0,this.animationCommitId=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.layoutVersion=0,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(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new SubscriptionManager),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const u=this.eventHandlers.get(o);u&&u.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=isSVGElement(o)&&!isSVGSVGElement(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),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),n){let d,p=0;const f=()=>this.root.updateBlockedByResize=!1;frame.read(()=>{p=window.innerWidth}),n(o,()=>{const m=window.innerWidth;m!==p&&(p=m,this.root.updateBlockedByResize=!0,d&&d(),d=delay(f,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const P=this.options.transition||c.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:T,onLayoutAnimationComplete:x}=c.getProps(),y=!this.targetLayout||!boxEqualsRounded(this.targetLayout,m),S=!p&&f;if(this.options.layoutRoot||this.resumeFrom||S||p&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const g={...getValueTransition(P,"layout"),onPlay:T,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(g.delay=0,g.type=!1),this.startAnimation(g),this.setAnimationOrigin(d,S)}else p||finishAnimation(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,this.eventHandlers.clear(),cancelFrame(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(resetSkewAndRotation),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&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const p=this.path[d];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();const l=time.now();frameData.delta=clamp(0,1e3/60,l-frameData.timestamp),frameData.timestamp=l,frameData.isProcessing=!0,frameSteps.update.process(frameData),frameSteps.preRender.process(frameData),frameSteps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(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 u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const u=a(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!isDeltaZero(this.projectionDelta),u=this.getTransformTemplate(),c=u?u(this.latestValues,""):void 0,d=c!==this.prevTransformTemplateValue;o&&this.instance&&(l||hasTransform(this.latestValues)||d)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return o&&(u=this.removeTransform(u)),roundBox(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return createBox();const l=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(checkNodeWasScrollRoot))){const{scroll:d}=this.root;d&&(translateAxis(l.x,d.offset.x),translateAxis(l.y,d.offset.y))}return l}removeElementScroll(o){var u;const l=createBox();if(copyBoxInto(l,o),(u=this.scroll)!=null&&u.wasRoot)return l;for(let c=0;c<this.path.length;c++){const d=this.path[c],{scroll:p,options:f}=d;d!==this.root&&p&&f.layoutScroll&&(p.wasRoot&©BoxInto(l,o),translateAxis(l.x,p.offset.x),translateAxis(l.y,p.offset.y))}return l}applyTransform(o,l=!1){const u=createBox();copyBoxInto(u,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(u,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),hasTransform(d.latestValues)&&transformBox(u,d.latestValues)}return hasTransform(this.latestValues)&&transformBox(u,this.latestValues),u}removeTransform(o){const l=createBox();copyBoxInto(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];if(!c.instance||!hasTransform(c.latestValues))continue;hasScale(c.latestValues)&&c.updateSnapshot();const d=createBox(),p=c.measurePageBox();copyBoxInto(d,p),removeBoxTransforms(l,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return hasTransform(this.latestValues)&&removeBoxTransforms(l,this.latestValues),l}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!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:p}=this.options;if(!this.layout||!(d||p))return;this.resolvedRelativeTargetAt=frameData.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,l,u),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var P;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||(P=this.parent)!=null&&P.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(u=!1),u)return;const{layout:c,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||d))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,f=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=createBox());const{target:m}=o;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==f||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(o,l=!1){const u=this.snapshot,c=u?u.latestValues:{},d={...this.latestValues},p=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=createBox(),m=u?u.source:void 0,P=this.layout?this.layout.source:void 0,T=m!==P,x=this.getStack(),y=!x||x.members.length<=1,S=!!(T&&!y&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let g;this.mixTargetDelta=C=>{const E=C/1e3;mixAxisDelta(p.x,o.x,E),mixAxisDelta(p.y,o.y,E),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,f,E),g&&boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=createBox()),copyBoxInto(g,this.relativeTarget)),T&&(this.animationValues=d,mixValues(d,c,this.latestValues,E,S,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,u,c;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(c=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||c.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=motionValue(0)),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},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(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:u,layout:c,latestValues:d}=o;if(!(!l||!u||!c)){if(this!==o&&this.layout&&c&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,c.layoutBox)){u=this.target||createBox();const p=calcLength(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const f=calcLength(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+f}copyBoxInto(l,u),transformBox(l,d),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new NodeStack),this.sharedNodes.get(o).add(l);const c=l.options.initialPromotionConfig;l.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:u}={}){const c=this.getStack();c&&c.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const c={};u.z&&resetDistortingTransform("z",o,c,this.animationValues);for(let d=0;d<transformAxes.length;d++)resetDistortingTransform(`rotate${transformAxes[d]}`,o,c,this.animationValues),resetDistortingTransform(`skew${transformAxes[d]}`,o,c,this.animationValues);o.render();for(const d in c)o.setStaticValue(d,c[d]),this.animationValues&&(this.animationValues[d]=c[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=c.animationValues||c.latestValues;this.applyTransformsToTarget();let p=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,d);u&&(p=u(d,p)),o.transform=p;const{x:f,y:m}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${m.origin*100}% 0`,c.animationValues?o.opacity=c===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=c===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const P in scaleCorrectors){if(d[P]===void 0)continue;const{correct:T,applyTo:x,isCSSVariable:y}=scaleCorrectors[P],S=p==="none"?d[P]:T(d[P],c);if(x){const g=x.length;for(let C=0;C<g;C++)o[x[C]]=S}else y?this.options.visualElement.renderState.vars[P]=S:o[P]=S}this.options.layoutId&&(o.pointerEvents=c===this?resolveMotionValue(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(n){n.updateLayout()}function notifyLayoutUpdate(n){var i;const e=((i=n.resumeFrom)==null?void 0:i.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:s}=n.layout,{animationType:r}=n.options,o=e.source!==n.layout.source;r==="size"?eachAxis(p=>{const f=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(f);f.min=a[p].min,f.max=f.min+m}):shouldAnimatePositionOnly(r,e.layoutBox,a)&&eachAxis(p=>{const f=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(a[p]);f.max=f.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[p].max=n.relativeTarget[p].min+m)});const l=createDelta();calcBoxDelta(l,a,e.layoutBox);const u=createDelta();o?calcBoxDelta(u,n.applyTransform(s,!0),e.measuredBox):calcBoxDelta(u,a,e.layoutBox);const c=!isDeltaZero(l);let d=!1;if(!n.resumeFrom){const p=n.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:f,layout:m}=p;if(f&&m){const P=createBox();calcRelativePosition(P,e.layoutBox,f.layoutBox);const T=createBox();calcRelativePosition(T,a,m.layoutBox),boxEqualsRounded(P,T)||(d=!0),p.options.layoutRoot&&(n.relativeTarget=T,n.relativeTargetOrigin=P,n.relativeParent=p)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:u,layoutDelta:l,hasLayoutChanged:c,hasRelativeLayoutChanged:d})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function propagateDirtyNodes(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function cleanDirtyNodes(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function clearSnapshot(n){n.clearSnapshot()}function clearMeasurements(n){n.clearMeasurements()}function clearIsLayoutDirty(n){n.isLayoutDirty=!1}function resetTransformStyle(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function finishAnimation(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function resolveTargetDelta(n){n.resolveTargetDelta()}function calcProjection(n){n.calcProjection()}function resetSkewAndRotation(n){n.resetSkewAndRotation()}function removeLeadSnapshots(n){n.removeLeadSnapshot()}function mixAxisDelta(n,e,i){n.translate=mixNumber$1(e.translate,0,i),n.scale=mixNumber$1(e.scale,1,i),n.origin=e.origin,n.originPoint=e.originPoint}function mixAxis(n,e,i,a){n.min=mixNumber$1(e.min,i.min,a),n.max=mixNumber$1(e.max,i.max,a)}function mixBox(n,e,i,a){mixAxis(n.x,e.x,i.x,a),mixAxis(n.y,e.y,i.y,a)}function hasOpacityCrossfade(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop;function roundAxis(n){n.min=roundPoint(n.min),n.max=roundPoint(n.max)}function roundBox(n){roundAxis(n.x),roundAxis(n.y)}function shouldAnimatePositionOnly(n,e,i){return n==="position"||n==="preserve-aspect"&&!isNear(aspectRatio(e),aspectRatio(i),.2)}function checkNodeWasScrollRoot(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(n,e)=>addDomEvent(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const n=new DocumentProjectionNode({});n.mount(window),n.setOptions({layoutScroll:!0}),rootProjectionNode.current=n}return rootProjectionNode.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}};function handleHoverEvent(n,e,i){const{props:a}=n;n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",i==="Start");const s="onHover"+i,r=a[s];r&&frame.postRender(()=>r(e,extractEventInfo(e)))}class HoverGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=hover(e,(i,a)=>(handleHoverEvent(this.node,a,"Start"),s=>handleHoverEvent(this.node,s,"End"))))}unmount(){}}class FocusGesture extends Feature{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=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function handlePressEvent(n,e,i){const{props:a}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&a.whileTap&&n.animationState.setActive("whileTap",i==="Start");const s="onTap"+(i==="End"?"":i),r=a[s];r&&frame.postRender(()=>r(e,extractEventInfo(e)))}class PressGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=press(e,(i,a)=>(handlePressEvent(this.node,a,"Start"),(s,{success:r})=>handlePressEvent(this.node,s,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=n=>{const e=observerCallbacks.get(n.target);e&&e(n)},fireAllObserverCallbacks=n=>{n.forEach(fireObserverCallback)};function initIntersectionObserver({root:n,...e}){const i=n||document;observers.has(i)||observers.set(i,{});const a=observers.get(i),s=JSON.stringify(e);return a[s]||(a[s]=new IntersectionObserver(fireAllObserverCallbacks,{root:n,...e})),a[s]}function observeIntersection(n,e,i){const a=initIntersectionObserver(e);return observerCallbacks.set(n,i),a.observe(n),()=>{observerCallbacks.delete(n),a.unobserve(n)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:i,margin:a,amount:s="some",once:r}=e,o={root:i?i.current:void 0,rootMargin:a,threshold:typeof s=="number"?s:thresholdNames[s]},l=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,r&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),f=c?d:p;f&&f(u)};return observeIntersection(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:i}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(e,i))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:n={}},{viewport:e={}}={}){return i=>n[i]!==e[i]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},featureBundle={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy(featureBundle,createDomVisualElement);/**
|
|
9
|
+
`),()=>{x.contains(T)&&x.removeChild(T)}},[e]),jsxRuntime.jsx(PopChildMeasure,{isPresent:e,childRef:r,sizeRef:o,children:React__namespace.cloneElement(n,{ref:u})})}const PresenceChild=({children:n,initial:e,isPresent:i,onExitComplete:a,custom:s,presenceAffectsLayout:r,mode:o,anchorX:l,root:u})=>{const c=useConstant(newChildrenMap),d=React.useId();let p=!0,f=React.useMemo(()=>(p=!1,{id:d,initial:e,isPresent:i,custom:s,onExitComplete:m=>{c.set(m,!0);for(const P of c.values())if(!P)return;a&&a()},register:m=>(c.set(m,!1),()=>c.delete(m))}),[i,c,a]);return r&&p&&(f={...f}),React.useMemo(()=>{c.forEach((m,P)=>c.set(P,!1))},[i]),React__namespace.useEffect(()=>{!i&&!c.size&&a&&a()},[i]),o==="popLayout"&&(n=jsxRuntime.jsx(PopChild,{isPresent:i,anchorX:l,root:u,children:n})),jsxRuntime.jsx(PresenceContext.Provider,{value:f,children:n})};function newChildrenMap(){return new Map}function usePresence(n=!0){const e=React.useContext(PresenceContext);if(e===null)return[!0,null];const{isPresent:i,onExitComplete:a,register:s}=e,r=React.useId();React.useEffect(()=>{if(n)return s(r)},[n]);const o=React.useCallback(()=>n&&a&&a(r),[r,a,n]);return!i&&a?[!1,o]:[!0]}const getChildKey=n=>n.key||"";function onlyElements(n){const e=[];return React.Children.forEach(n,i=>{React.isValidElement(i)&&e.push(i)}),e}const AnimatePresence=({children:n,custom:e,initial:i=!0,onExitComplete:a,presenceAffectsLayout:s=!0,mode:r="sync",propagate:o=!1,anchorX:l="left",root:u})=>{const[c,d]=usePresence(o),p=React.useMemo(()=>onlyElements(n),[n]),f=o&&!c?[]:p.map(getChildKey),m=React.useRef(!0),P=React.useRef(p),T=useConstant(()=>new Map),[x,y]=React.useState(p),[S,g]=React.useState(p);useIsomorphicLayoutEffect(()=>{m.current=!1,P.current=p;for(let B=0;B<S.length;B++){const _=getChildKey(S[B]);f.includes(_)?T.delete(_):T.get(_)!==!0&&T.set(_,!1)}},[S,f.length,f.join("-")]);const C=[];if(p!==x){let B=[...p];for(let _=0;_<S.length;_++){const M=S[_],D=getChildKey(M);f.includes(D)||(B.splice(_,0,M),C.push(M))}return r==="wait"&&C.length&&(B=C),g(onlyElements(B)),y(p),null}process.env.NODE_ENV!=="production"&&r==="wait"&&S.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:E}=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:S.map(B=>{const _=getChildKey(B),M=o&&!c?!1:p===S||f.includes(_),D=()=>{if(T.has(_))T.set(_,!0);else return;let L=!0;T.forEach(N=>{N||(L=!1)}),L&&(E==null||E(),g(P.current),o&&(d==null||d()),a&&a())};return jsxRuntime.jsx(PresenceChild,{isPresent:M,initial:!m.current||i?void 0:!1,custom:e,presenceAffectsLayout:s,mode:r,root:u,onExitComplete:M?void 0:D,anchorX:l,children:B},_)})})},LazyContext=React.createContext({strict:!1}),featureProps={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"]},featureDefinitions={};for(const n in featureProps)featureDefinitions[n]={isEnabled:e=>featureProps[n].some(i=>!!e[i])};function loadFeatures(n){for(const e in n)featureDefinitions[e]={...featureDefinitions[e],...n[e]}}const validMotionProps=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 isValidMotionProp(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||validMotionProps.has(n)}let shouldForward=n=>!isValidMotionProp(n);function loadExternalIsValidProp(n){typeof n=="function"&&(shouldForward=e=>e.startsWith("on")?!isValidMotionProp(e):n(e))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(n,e,i){const a={};for(const s in n)s==="values"&&typeof n.values=="object"||(shouldForward(s)||i===!0&&isValidMotionProp(s)||!e&&!isValidMotionProp(s)||n.draggable&&s.startsWith("onDrag"))&&(a[s]=n[s]);return a}const MotionContext=React.createContext({});function isAnimationControls(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function isVariantLabel(n){return typeof n=="string"||Array.isArray(n)}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(n){return isAnimationControls(n.animate)||variantProps.some(e=>isVariantLabel(n[e]))}function isVariantNode(n){return!!(isControllingVariants(n)||n.variants)}function getCurrentTreeVariants(n,e){if(isControllingVariants(n)){const{initial:i,animate:a}=n;return{initial:i===!1||isVariantLabel(i)?i:void 0,animate:isVariantLabel(a)?a:void 0}}return n.inherit!==!1?e:{}}function useCreateMotionContext(n){const{initial:e,animate:i}=getCurrentTreeVariants(n,React.useContext(MotionContext));return React.useMemo(()=>({initial:e,animate:i}),[variantLabelsAsDependency(e),variantLabelsAsDependency(i)])}function variantLabelsAsDependency(n){return Array.isArray(n)?n.join(" "):n}const scaleCorrectors={};function addScaleCorrector(n){for(const e in n)scaleCorrectors[e]=n[e],isCSSVariableName(e)&&(scaleCorrectors[e].isCSSVariable=!0)}function isForcedMotionValue(n,{layout:e,layoutId:i}){return transformProps.has(n)||n.startsWith("origin")||(e||i!==void 0)&&(!!scaleCorrectors[n]||n==="opacity")}const translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(n,e,i){let a="",s=!0;for(let r=0;r<numTransforms;r++){const o=transformPropOrder[r],l=n[o];if(l===void 0)continue;let u=!0;if(typeof l=="number"?u=l===(o.startsWith("scale")?1:0):u=parseFloat(l)===0,!u||i){const c=getValueAsType(l,numberValueTypes[o]);if(!u){s=!1;const d=translateAlias[o]||o;a+=`${d}(${c}) `}i&&(e[o]=c)}}return a=a.trim(),i?a=i(e,s?"":a):s&&(a="none"),a}function buildHTMLStyles(n,e,i){const{style:a,vars:s,transformOrigin:r}=n;let o=!1,l=!1;for(const u in e){const c=e[u];if(transformProps.has(u)){o=!0;continue}else if(isCSSVariableName(u)){s[u]=c;continue}else{const d=getValueAsType(c,numberValueTypes[u]);u.startsWith("origin")?(l=!0,r[u]=d):a[u]=d}}if(e.transform||(o||i?a.transform=buildTransform(e,n.transform,i):a.transform&&(a.transform="none")),l){const{originX:u="50%",originY:c="50%",originZ:d=0}=r;a.transformOrigin=`${u} ${c} ${d}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(n,e,i){for(const a in e)!isMotionValue(e[a])&&!isForcedMotionValue(a,i)&&(n[a]=e[a])}function useInitialMotionValues({transformTemplate:n},e){return React.useMemo(()=>{const i=createHtmlRenderState();return buildHTMLStyles(i,e,n),Object.assign({},i.vars,i.style)},[e])}function useStyle(n,e){const i=n.style||{},a={};return copyRawValuesOnly(a,i,n),Object.assign(a,useInitialMotionValues(n,e)),a}function useHTMLProps(n,e){const i={},a=useStyle(n,e);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=a,i}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(n,e,i=1,a=0,s=!0){n.pathLength=1;const r=s?dashKeys:camelKeys;n[r.offset]=px.transform(-a);const o=px.transform(e),l=px.transform(i);n[r.array]=`${o} ${l}`}function buildSVGAttrs(n,{attrX:e,attrY:i,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...l},u,c,d){if(buildHTMLStyles(n,l,c),u){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:p,style:f}=n;p.transform&&(f.transform=p.transform,delete p.transform),(f.transform||p.transformOrigin)&&(f.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete p.transformBox),e!==void 0&&(p.x=e),i!==void 0&&(p.y=i),a!==void 0&&(p.scale=a),s!==void 0&&buildSVGPath(p,s,r,o,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=n=>typeof n=="string"&&n.toLowerCase()==="svg";function useSVGProps(n,e,i,a){const s=React.useMemo(()=>{const r=createSvgRenderState();return buildSVGAttrs(r,e,isSVGTag(a),n.transformTemplate,n.style),{...r.attrs,style:{...r.style}}},[e]);if(n.style){const r={};copyRawValuesOnly(r,n.style,n),s.style={...r,...s.style}}return s}const lowercaseSVGElements=["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 isSVGComponent(n){return typeof n!="string"||n.includes("-")?!1:!!(lowercaseSVGElements.indexOf(n)>-1||/[A-Z]/u.test(n))}function useRender(n,e,i,{latestValues:a},s,r=!1){const l=(isSVGComponent(n)?useSVGProps:useHTMLProps)(e,a,s,n),u=filterProps(e,typeof n=="string",r),c=n!==React.Fragment?{...u,...l,ref:i}:{},{children:d}=e,p=React.useMemo(()=>isMotionValue(d)?d.get():d,[d]);return React.createElement(n,{...c,children:p})}function getValueState(n){const e=[{},{}];return n==null||n.values.forEach((i,a)=>{e[0][a]=i.get(),e[1][a]=i.getVelocity()}),e}function resolveVariantFromProps(n,e,i,a){if(typeof e=="function"){const[s,r]=getValueState(a);e=e(i!==void 0?i:n.custom,s,r)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,r]=getValueState(a);e=e(i!==void 0?i:n.custom,s,r)}return e}function resolveMotionValue(n){return isMotionValue(n)?n.get():n}function makeState({scrapeMotionValuesFromProps:n,createRenderState:e},i,a,s){return{latestValues:makeLatestValues(i,a,s,n),renderState:e()}}function makeLatestValues(n,e,i,a){const s={},r=a(n,{});for(const f in r)s[f]=resolveMotionValue(r[f]);let{initial:o,animate:l}=n;const u=isControllingVariants(n),c=isVariantNode(n);e&&c&&!u&&n.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=i?i.initial===!1:!1;d=d||o===!1;const p=d?l:o;if(p&&typeof p!="boolean"&&!isAnimationControls(p)){const f=Array.isArray(p)?p:[p];for(let m=0;m<f.length;m++){const P=resolveVariantFromProps(n,f[m]);if(P){const{transitionEnd:T,transition:x,...y}=P;for(const S in y){let g=y[S];if(Array.isArray(g)){const C=d?g.length-1:0;g=g[C]}g!==null&&(s[S]=g)}for(const S in T)s[S]=T[S]}}}return s}const makeUseVisualState=n=>(e,i)=>{const a=React.useContext(MotionContext),s=React.useContext(PresenceContext),r=()=>makeState(n,e,a,s);return i?r():useConstant(r)};function scrapeMotionValuesFromProps$1(n,e,i){var r;const{style:a}=n,s={};for(const o in a)(isMotionValue(a[o])||e.style&&isMotionValue(e.style[o])||isForcedMotionValue(o,n)||((r=i==null?void 0:i.getValue(o))==null?void 0:r.liveStyle)!==void 0)&&(s[o]=a[o]);return s}const useHTMLVisualState=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState});function scrapeMotionValuesFromProps(n,e,i){const a=scrapeMotionValuesFromProps$1(n,e,i);for(const s in n)if(isMotionValue(n[s])||isMotionValue(e[s])){const r=transformPropOrder.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;a[r]=n[s]}return a}const useSVGVisualState=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function isRefObject(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function useMotionRef(n,e,i){return React.useCallback(a=>{a&&n.onMount&&n.onMount(a),e&&(a?e.mount(a):e.unmount()),i&&(typeof i=="function"?i(a):isRefObject(i)&&(i.current=a))},[e])}const camelToDash=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),SwitchLayoutGroupContext=React.createContext({});function useVisualElement(n,e,i,a,s){var T,x;const{visualElement:r}=React.useContext(MotionContext),o=React.useContext(LazyContext),l=React.useContext(PresenceContext),u=React.useContext(MotionConfigContext).reducedMotion,c=React.useRef(null);a=a||o.renderer,!c.current&&a&&(c.current=a(n,{visualState:e,parent:r,props:i,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u}));const d=c.current,p=React.useContext(SwitchLayoutGroupContext);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&createProjectionNode$1(c.current,i,s,p);const f=React.useRef(!1);React.useInsertionEffect(()=>{d&&f.current&&d.update(i,l)});const m=i[optimizedAppearDataAttribute],P=React.useRef(!!m&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,m))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,m)));return useIsomorphicLayoutEffect(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),P.current&&d.animationState&&d.animationState.animateChanges())}),React.useEffect(()=>{d&&(!P.current&&d.animationState&&d.animationState.animateChanges(),P.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,m)}),P.current=!1),d.enteringChildren=void 0)}),d}function createProjectionNode$1(n,e,i,a){const{layoutId:s,layout:r,drag:o,dragConstraints:l,layoutScroll:u,layoutRoot:c,layoutCrossfade:d}=e;n.projection=new i(n.latestValues,e["data-framer-portal-id"]?void 0:getClosestProjectingNode(n.parent)),n.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!o||l&&isRefObject(l),visualElement:n,animationType:typeof r=="string"?r:"both",initialPromotionConfig:a,crossfade:d,layoutScroll:u,layoutRoot:c})}function getClosestProjectingNode(n){if(n)return n.options.allowProjection!==!1?n.projection:getClosestProjectingNode(n.parent)}function createMotionComponent(n,{forwardMotionProps:e=!1}={},i,a){i&&loadFeatures(i);const s=isSVGComponent(n)?useSVGVisualState:useHTMLVisualState;function r(l,u){let c;const d={...React.useContext(MotionConfigContext),...l,layoutId:useLayoutId(l)},{isStatic:p}=d,f=useCreateMotionContext(l),m=s(l,p);if(!p&&isBrowser){useStrictMode(d,i);const P=getProjectionFunctionality(d);c=P.MeasureLayout,f.visualElement=useVisualElement(n,m,d,a,P.ProjectionNode)}return jsxRuntime.jsxs(MotionContext.Provider,{value:f,children:[c&&f.visualElement?jsxRuntime.jsx(c,{visualElement:f.visualElement,...d}):null,useRender(n,l,useMotionRef(m,f.visualElement,u),m,p,e)]})}r.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const o=React.forwardRef(r);return o[motionComponentSymbol]=n,o}function useLayoutId({layoutId:n}){const e=React.useContext(LayoutGroupContext).id;return e&&n!==void 0?e+"-"+n:n}function useStrictMode(n,e){const i=React.useContext(LazyContext).strict;if(process.env.NODE_ENV!=="production"&&e&&i){const a="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?warning(!1,a,"lazy-strict-mode"):invariant(!1,a,"lazy-strict-mode")}}function getProjectionFunctionality(n){const{drag:e,layout:i}=featureDefinitions;if(!e&&!i)return{};const a={...e,...i};return{MeasureLayout:e!=null&&e.isEnabled(n)||i!=null&&i.isEnabled(n)?a.MeasureLayout:void 0,ProjectionNode:a.ProjectionNode}}function createMotionProxy(n,e){if(typeof Proxy>"u")return createMotionComponent;const i=new Map,a=(r,o)=>createMotionComponent(r,o,n,e),s=(r,o)=>(process.env.NODE_ENV!=="production"&&warnOnce(!1,"motion() is deprecated. Use motion.create() instead."),a(r,o));return new Proxy(s,{get:(r,o)=>o==="create"?a:(i.has(o)||i.set(o,createMotionComponent(o,void 0,n,e)),i.get(o))})}function convertBoundingBoxToBox({top:n,left:e,right:i,bottom:a}){return{x:{min:e,max:i},y:{min:n,max:a}}}function convertBoxToBoundingBox({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function transformBoxPoints(n,e){if(!e)return n;const i=e({x:n.left,y:n.top}),a=e({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:a.y,right:a.x}}function isIdentityScale(n){return n===void 0||n===1}function hasScale({scale:n,scaleX:e,scaleY:i}){return!isIdentityScale(n)||!isIdentityScale(e)||!isIdentityScale(i)}function hasTransform(n){return hasScale(n)||has2DTranslate(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function has2DTranslate(n){return is2DTranslate(n.x)||is2DTranslate(n.y)}function is2DTranslate(n){return n&&n!=="0%"}function scalePoint(n,e,i){const a=n-i,s=e*a;return i+s}function applyPointDelta(n,e,i,a,s){return s!==void 0&&(n=scalePoint(n,s,a)),scalePoint(n,i,a)+e}function applyAxisDelta(n,e=0,i=1,a,s){n.min=applyPointDelta(n.min,e,i,a,s),n.max=applyPointDelta(n.max,e,i,a,s)}function applyBoxDelta(n,{x:e,y:i}){applyAxisDelta(n.x,e.translate,e.scale,e.originPoint),applyAxisDelta(n.y,i.translate,i.scale,i.originPoint)}const TREE_SCALE_SNAP_MIN=.999999999999,TREE_SCALE_SNAP_MAX=1.0000000000001;function applyTreeDeltas(n,e,i,a=!1){const s=i.length;if(!s)return;e.x=e.y=1;let r,o;for(let l=0;l<s;l++){r=i[l],o=r.projectionDelta;const{visualElement:u}=r.options;u&&u.props.style&&u.props.style.display==="contents"||(a&&r.options.layoutScroll&&r.scroll&&r!==r.root&&transformBox(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,applyBoxDelta(n,o)),a&&hasTransform(r.latestValues)&&transformBox(n,r.latestValues))}e.x<TREE_SCALE_SNAP_MAX&&e.x>TREE_SCALE_SNAP_MIN&&(e.x=1),e.y<TREE_SCALE_SNAP_MAX&&e.y>TREE_SCALE_SNAP_MIN&&(e.y=1)}function translateAxis(n,e){n.min=n.min+e,n.max=n.max+e}function transformAxis(n,e,i,a,s=.5){const r=mixNumber$1(n.min,n.max,s);applyAxisDelta(n,e,i,r,a)}function transformBox(n,e){transformAxis(n.x,e.x,e.scaleX,e.scale,e.originX),transformAxis(n.y,e.y,e.scaleY,e.scale,e.originY)}function measureViewportBox(n,e){return convertBoundingBoxToBox(transformBoxPoints(n.getBoundingClientRect(),e))}function measurePageBox(n,e,i){const a=measureViewportBox(n,i),{scroll:s}=e;return s&&(translateAxis(a.x,s.offset.x),translateAxis(a.y,s.offset.y)),a}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>prefersReducedMotion.current=n.matches;n.addEventListener("change",e),e()}else prefersReducedMotion.current=!1}const visualElementStore=new WeakMap;function updateMotionValuesFromProps(n,e,i){for(const a in e){const s=e[a],r=i[a];if(isMotionValue(s))n.addValue(a,s);else if(isMotionValue(r))n.addValue(a,motionValue(s,{owner:n}));else if(r!==s)if(n.hasValue(a)){const o=n.getValue(a);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=n.getStaticValue(a);n.addValue(a,motionValue(o!==void 0?o:s,{owner:n}))}}for(const a in i)e[a]===void 0&&n.removeValue(a);return e}const propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class VisualElement{scrapeMotionValuesFromProps(e,i,a){return{}}constructor({parent:e,props:i,presenceContext:a,reducedMotionConfig:s,blockInitialAnimation:r,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,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=time.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,frame.render(this.render,!1,!0))};const{latestValues:u,renderState:c}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=i.initial?{...u}:{},this.renderState=c,this.parent=e,this.props=i,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!r,this.isControllingVariants=isControllingVariants(i),this.isVariantNode=isVariantNode(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(i,{},this);for(const f in p){const m=p[f];u[f]!==void 0&&isMotionValue(m)&&m.set(u[f])}}mount(e){var i;this.current=e,visualElementStore.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((a,s)=>this.bindToMotionValue(s,a)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,process.env.NODE_ENV!=="production"&&warnOnce(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(i=this.parent)==null||i.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach(i=>i()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const i in this.events)this.events[i].clear();for(const i in this.features){const a=this.features[i];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,i){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const a=transformProps.has(e);a&&this.onBindTransform&&this.onBindTransform();const s=i.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&frame.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,i)),this.valueSubscriptions.set(e,()=>{s(),r&&r(),i.owner&&i.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 featureDefinitions){const i=featureDefinitions[e];if(!i)continue;const{isEnabled:a,Feature:s}=i;if(!this.features[e]&&s&&a(this.props)&&(this.features[e]=new s(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):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,i){this.latestValues[e]=i}update(e,i){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let a=0;a<propEventHandlers.length;a++){const s=propEventHandlers[a];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const r="on"+s,o=e[r];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}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 i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(e),()=>i.variantChildren.delete(e)}addValue(e,i){const a=this.values.get(e);i!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,i),this.values.set(e,i),this.latestValues[e]=i.get())}removeValue(e){this.values.delete(e);const i=this.valueSubscriptions.get(e);i&&(i(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,i){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&i!==void 0&&(a=motionValue(i===null?void 0:i,{owner:this}),this.addValue(e,a)),a}readValue(e,i){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(isNumericalString(a)||isZeroValueString(a))?a=parseFloat(a):!findValueType(a)&&complex.test(i)&&(a=getAnimatableNone(e,i)),this.setBaseTarget(e,isMotionValue(a)?a.get():a)),isMotionValue(a)?a.get():a}setBaseTarget(e,i){this.baseTarget[e]=i}getBaseTarget(e){var r;const{initial:i}=this.props;let a;if(typeof i=="string"||typeof i=="object"){const o=resolveVariantFromProps(this.props,i,(r=this.presenceContext)==null?void 0:r.custom);o&&(a=o[e])}if(i&&a!==void 0)return a;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!isMotionValue(s)?s:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,i){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(i)}notify(e,...i){this.events[e]&&this.events[e].notify(...i)}scheduleRenderMicrotask(){microtask.render(this.render)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,i){return e.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(e,i){return e.style?e.style[i]:void 0}removeValueFromRenderState(e,{vars:i,style:a}){delete i[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function renderHTML(n,{style:e,vars:i},a,s){const r=n.style;let o;for(o in e)r[o]=e[o];s==null||s.applyProjectionStyles(r,a);for(o in i)r.setProperty(o,i[o])}function getComputedStyle$1(n){return window.getComputedStyle(n)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html",this.renderInstance=renderHTML}readValueFromInstance(e,i){var a;if(transformProps.has(i))return(a=this.projection)!=null&&a.isProjecting?defaultTransformValue(i):readTransformValue(e,i);{const s=getComputedStyle$1(e),r=(isCSSVariableName(i)?s.getPropertyValue(i):s[i])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:i}){return measureViewportBox(e,i)}build(e,i,a){buildHTMLStyles(e,i,a.transformTemplate)}scrapeMotionValuesFromProps(e,i,a){return scrapeMotionValuesFromProps$1(e,i,a)}}const camelCaseAttributes=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 renderSVG(n,e,i,a){renderHTML(n,e,void 0,a);for(const s in e.attrs)n.setAttribute(camelCaseAttributes.has(s)?s:camelToDash(s),e.attrs[s])}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,i){return e[i]}readValueFromInstance(e,i){if(transformProps.has(i)){const a=getDefaultValueType(i);return a&&a.default||0}return i=camelCaseAttributes.has(i)?i:camelToDash(i),e.getAttribute(i)}scrapeMotionValuesFromProps(e,i,a){return scrapeMotionValuesFromProps(e,i,a)}build(e,i,a){buildSVGAttrs(e,i,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,i,a,s){renderSVG(e,i,a,s)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}}const createDomVisualElement=(n,e)=>isSVGComponent(n)?new SVGVisualElement(e):new HTMLVisualElement(e,{allowProjection:n!==React.Fragment});function resolveVariant(n,e,i){const a=n.getProps();return resolveVariantFromProps(a,e,i!==void 0?i:a.custom,n)}const isKeyframesTarget=n=>Array.isArray(n);function setMotionValue(n,e,i){n.hasValue(e)?n.getValue(e).set(i):n.addValue(e,motionValue(i))}function resolveFinalValueInKeyframes(n){return isKeyframesTarget(n)?n[n.length-1]||0:n}function setTarget(n,e){const i=resolveVariant(n,e);let{transitionEnd:a={},transition:s={},...r}=i||{};r={...r,...a};for(const o in r){const l=resolveFinalValueInKeyframes(r[o]);setMotionValue(n,o,l)}}function isWillChangeMotionValue(n){return!!(isMotionValue(n)&&n.add)}function addValueToWillChange(n,e){const i=n.getValue("willChange");if(isWillChangeMotionValue(i))return i.add(e);if(!i&&MotionGlobalConfig.WillChange){const a=new MotionGlobalConfig.WillChange("auto");n.addValue("willChange",a),a.add(e)}}function getOptimisedAppearId(n){return n.props[optimizedAppearDataAttribute]}const isNotNull=n=>n!==null;function getFinalKeyframe(n,{repeat:e,repeatType:i="loop"},a){const s=n.filter(isNotNull),r=e&&i!=="loop"&&e%2===1?0:s.length-1;return!r||a===void 0?s[r]:a}const underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(n,{keyframes:e})=>e.length>2?keyframesTransition:transformProps.has(n)?n.startsWith("scale")?criticallyDampedSpring(e[1]):underDampedSpring:ease;function isTransitionDefined({when:n,delay:e,delayChildren:i,staggerChildren:a,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:l,from:u,elapsed:c,...d}){return!!Object.keys(d).length}const animateMotionValue=(n,e,i,a={},s,r)=>o=>{const l=getValueTransition(a,n)||{},u=l.delay||a.delay||0;let{elapsed:c=0}=a;c=c-secondsToMilliseconds(u);const d={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-c,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:n,motionValue:e,element:r?void 0:s};isTransitionDefined(l)||Object.assign(d,getDefaultTransition(n,d)),d.duration&&(d.duration=secondsToMilliseconds(d.duration)),d.repeatDelay&&(d.repeatDelay=secondsToMilliseconds(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(makeAnimationInstant(d),d.delay===0&&(p=!0)),(MotionGlobalConfig.instantAnimations||MotionGlobalConfig.skipAnimations)&&(p=!0,makeAnimationInstant(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,p&&!r&&e.get()!==void 0){const f=getFinalKeyframe(d.keyframes,l);if(f!==void 0){frame.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new JSAnimation(d):new AsyncMotionValueAnimation(d)};function shouldBlockAnimation({protectedKeys:n,needsAnimating:e},i){const a=n.hasOwnProperty(i)&&e[i]!==!0;return e[i]=!1,a}function animateTarget(n,e,{delay:i=0,transitionOverride:a,type:s}={}){let{transition:r=n.getDefaultTransition(),transitionEnd:o,...l}=e;a&&(r=a);const u=[],c=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const p=n.getValue(d,n.latestValues[d]??null),f=l[d];if(f===void 0||c&&shouldBlockAnimation(c,d))continue;const m={delay:i,...getValueTransition(r||{},d)},P=p.get();if(P!==void 0&&!p.isAnimating&&!Array.isArray(f)&&f===P&&!m.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const y=getOptimisedAppearId(n);if(y){const S=window.MotionHandoffAnimation(y,d,frame);S!==null&&(m.startTime=S,T=!0)}}addValueToWillChange(n,d),p.start(animateMotionValue(d,p,f,n.shouldReduceMotion&&positionalKeys.has(d)?{type:!1}:m,n,T));const x=p.animation;x&&u.push(x)}return o&&Promise.all(u).then(()=>{frame.update(()=>{o&&setTarget(n,o)})}),u}function calcChildStagger(n,e,i,a=0,s=1){const r=Array.from(n).sort((c,d)=>c.sortNodePosition(d)).indexOf(e),o=n.size,l=(o-1)*a;return typeof i=="function"?i(r,o):s===1?r*a:l-r*a}function animateVariant(n,e,i={}){var u;const a=resolveVariant(n,e,i.type==="exit"?(u=n.presenceContext)==null?void 0:u.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=a||{};i.transitionOverride&&(s=i.transitionOverride);const r=a?()=>Promise.all(animateTarget(n,a,i)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:f}=s;return animateChildren(n,e,c,d,p,f,i)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,d]=l==="beforeChildren"?[r,o]:[o,r];return c().then(()=>d())}else return Promise.all([r(),o(i.delay)])}function animateChildren(n,e,i=0,a=0,s=0,r=1,o){const l=[];for(const u of n.variantChildren)u.notify("AnimationStart",e),l.push(animateVariant(u,e,{...o,delay:i+(typeof a=="function"?0:a)+calcChildStagger(n.variantChildren,u,a,s,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(l)}function animateVisualElement(n,e,i={}){n.notify("AnimationStart",e);let a;if(Array.isArray(e)){const s=e.map(r=>animateVariant(n,r,i));a=Promise.all(s)}else if(typeof e=="string")a=animateVariant(n,e,i);else{const s=typeof e=="function"?resolveVariant(n,e,i.custom):e;a=Promise.all(animateTarget(n,s,i))}return a.then(()=>{n.notify("AnimationComplete",e)})}function shallowCompare(n,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==n.length)return!1;for(let a=0;a<i;a++)if(e[a]!==n[a])return!1;return!0}const numVariantProps=variantProps.length;function getVariantContext(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?getVariantContext(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const e={};for(let i=0;i<numVariantProps;i++){const a=variantProps[i],s=n.props[a];(isVariantLabel(s)||s===!1)&&(e[a]=s)}return e}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(n){return e=>Promise.all(e.map(({animation:i,options:a})=>animateVisualElement(n,i,a)))}function createAnimationState(n){let e=animateList(n),i=createState(),a=!0;const s=u=>(c,d)=>{var f;const p=resolveVariant(n,d,u==="exit"?(f=n.presenceContext)==null?void 0:f.custom:void 0);if(p){const{transition:m,transitionEnd:P,...T}=p;c={...c,...T,...P}}return c};function r(u){e=u(n)}function o(u){const{props:c}=n,d=getVariantContext(n.parent)||{},p=[],f=new Set;let m={},P=1/0;for(let x=0;x<numAnimationTypes;x++){const y=reversePriorityOrder[x],S=i[y],g=c[y]!==void 0?c[y]:d[y],C=isVariantLabel(g),E=y===u?S.isActive:null;E===!1&&(P=x);let B=g===d[y]&&g!==c[y]&&C;if(B&&a&&n.manuallyAnimateOnMount&&(B=!1),S.protectedKeys={...m},!S.isActive&&E===null||!g&&!S.prevProp||isAnimationControls(g)||typeof g=="boolean")continue;const _=checkVariantsDidChange(S.prevProp,g);let M=_||y===u&&S.isActive&&!B&&C||x>P&&C,D=!1;const L=Array.isArray(g)?g:[g];let N=L.reduce(s(y),{});E===!1&&(N={});const{prevResolvedValues:F={}}=S,H={...F,...N},$=I=>{M=!0,f.has(I)&&(D=!0,f.delete(I)),S.needsAnimating[I]=!0;const V=n.getValue(I);V&&(V.liveStyle=!1)};for(const I in H){const V=N[I],A=F[I];if(m.hasOwnProperty(I))continue;let k=!1;isKeyframesTarget(V)&&isKeyframesTarget(A)?k=!shallowCompare(V,A):k=V!==A,k?V!=null?$(I):f.add(I):V!==void 0&&f.has(I)?$(I):S.protectedKeys[I]=!0}S.prevProp=g,S.prevResolvedValues=N,S.isActive&&(m={...m,...N}),a&&n.blockInitialAnimation&&(M=!1);const O=B&&_;M&&(!O||D)&&p.push(...L.map(I=>{const V={type:y};if(typeof I=="string"&&a&&!O&&n.manuallyAnimateOnMount&&n.parent){const{parent:A}=n,k=resolveVariant(A,I);if(A.enteringChildren&&k){const{delayChildren:R}=k.transition||{};V.delay=calcChildStagger(A.enteringChildren,n,R)}}return{animation:I,options:V}}))}if(f.size){const x={};if(typeof c.initial!="boolean"){const y=resolveVariant(n,Array.isArray(c.initial)?c.initial[0]:c.initial);y&&y.transition&&(x.transition=y.transition)}f.forEach(y=>{const S=n.getBaseTarget(y),g=n.getValue(y);g&&(g.liveStyle=!0),x[y]=S??null}),p.push({animation:x})}let T=!!p.length;return a&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(T=!1),a=!1,T?e(p):Promise.resolve()}function l(u,c){var p;if(i[u].isActive===c)return Promise.resolve();(p=n.variantChildren)==null||p.forEach(f=>{var m;return(m=f.animationState)==null?void 0:m.setActive(u,c)}),i[u].isActive=c;const d=o(u);for(const f in i)i[f].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:r,getState:()=>i,reset:()=>{i=createState()}}}function checkVariantsDidChange(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!shallowCompare(e,n):!1}function createTypeState(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class Feature{constructor(e){this.isMounted=!1,this.node=e}update(){}}class AnimationFeature extends Feature{constructor(e){super(e),e.animationState||(e.animationState=createAnimationState(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:i}=this.node.prevProps||{};e!==i&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let id$1=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$1++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:i}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;const s=this.node.animationState.setActive("exit",!e);i&&!e&&s.then(()=>{i(this.id)})}mount(){const{register:e,onExitComplete:i}=this.node.presenceContext||{};i&&i(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const animations={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function addDomEvent(n,e,i,a={passive:!0}){return n.addEventListener(e,i,a),()=>n.removeEventListener(e,i)}function extractEventInfo(n){return{point:{x:n.pageX,y:n.pageY}}}const addPointerInfo=n=>e=>isPrimaryPointer(e)&&n(e,extractEventInfo(e));function addPointerEvent(n,e,i,a){return addDomEvent(n,e,addPointerInfo(i),a)}const SCALE_PRECISION=1e-4,SCALE_MIN=1-SCALE_PRECISION,SCALE_MAX=1+SCALE_PRECISION,TRANSLATE_PRECISION=.01,TRANSLATE_MIN=0-TRANSLATE_PRECISION,TRANSLATE_MAX=0+TRANSLATE_PRECISION;function calcLength(n){return n.max-n.min}function isNear(n,e,i){return Math.abs(n-e)<=i}function calcAxisDelta(n,e,i,a=.5){n.origin=a,n.originPoint=mixNumber$1(e.min,e.max,n.origin),n.scale=calcLength(i)/calcLength(e),n.translate=mixNumber$1(i.min,i.max,n.origin)-n.originPoint,(n.scale>=SCALE_MIN&&n.scale<=SCALE_MAX||isNaN(n.scale))&&(n.scale=1),(n.translate>=TRANSLATE_MIN&&n.translate<=TRANSLATE_MAX||isNaN(n.translate))&&(n.translate=0)}function calcBoxDelta(n,e,i,a){calcAxisDelta(n.x,e.x,i.x,a?a.originX:void 0),calcAxisDelta(n.y,e.y,i.y,a?a.originY:void 0)}function calcRelativeAxis(n,e,i){n.min=i.min+e.min,n.max=n.min+calcLength(e)}function calcRelativeBox(n,e,i){calcRelativeAxis(n.x,e.x,i.x),calcRelativeAxis(n.y,e.y,i.y)}function calcRelativeAxisPosition(n,e,i){n.min=e.min-i.min,n.max=n.min+calcLength(e)}function calcRelativePosition(n,e,i){calcRelativeAxisPosition(n.x,e.x,i.x),calcRelativeAxisPosition(n.y,e.y,i.y)}function eachAxis(n){return[n("x"),n("y")]}const getContextWindow=({current:n})=>n?n.ownerDocument.defaultView:null,distance=(n,e)=>Math.abs(n-e);function distance2D(n,e){const i=distance(n.x,e.x),a=distance(n.y,e.y);return Math.sqrt(i**2+a**2)}class PanSession{constructor(e,i,{transformPagePoint:a,contextWindow:s=window,dragSnapToOrigin:r=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=getPanInfo(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,P=distance2D(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!P)return;const{point:T}=f,{timestamp:x}=frameData;this.history.push({...T,timestamp:x});const{onStart:y,onMove:S}=this.handlers;m||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,f)},this.handlePointerMove=(f,m)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=transformPoint(m,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(f,m)=>{this.end();const{onEnd:P,onSessionEnd:T,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=getPanInfo(f.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(m,this.transformPagePoint),this.history);this.startEvent&&P&&P(f,y),T&&T(f,y)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=r,this.handlers=i,this.transformPagePoint=a,this.distanceThreshold=o,this.contextWindow=s||window;const l=extractEventInfo(e),u=transformPoint(l,this.transformPagePoint),{point:c}=u,{timestamp:d}=frameData;this.history=[{...c,timestamp:d}];const{onSessionStart:p}=i;p&&p(e,getPanInfo(u,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(n,e){return e?{point:e(n.point)}:n}function subtractPoint(n,e){return{x:n.x-e.x,y:n.y-e.y}}function getPanInfo({point:n},e){return{point:n,delta:subtractPoint(n,lastDevicePoint(e)),offset:subtractPoint(n,startDevicePoint(e)),velocity:getVelocity(e,.1)}}function startDevicePoint(n){return n[0]}function lastDevicePoint(n){return n[n.length-1]}function getVelocity(n,e){if(n.length<2)return{x:0,y:0};let i=n.length-1,a=null;const s=lastDevicePoint(n);for(;i>=0&&(a=n[i],!(s.timestamp-a.timestamp>secondsToMilliseconds(e)));)i--;if(!a)return{x:0,y:0};const r=millisecondsToSeconds(s.timestamp-a.timestamp);if(r===0)return{x:0,y:0};const o={x:(s.x-a.x)/r,y:(s.y-a.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(n,{min:e,max:i},a){return e!==void 0&&n<e?n=a?mixNumber$1(e,n,a.min):Math.max(n,e):i!==void 0&&n>i&&(n=a?mixNumber$1(i,n,a.max):Math.min(n,i)),n}function calcRelativeAxisConstraints(n,e,i){return{min:e!==void 0?n.min+e:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function calcRelativeConstraints(n,{top:e,left:i,bottom:a,right:s}){return{x:calcRelativeAxisConstraints(n.x,i,s),y:calcRelativeAxisConstraints(n.y,e,a)}}function calcViewportAxisConstraints(n,e){let i=e.min-n.min,a=e.max-n.max;return e.max-e.min<n.max-n.min&&([i,a]=[a,i]),{min:i,max:a}}function calcViewportConstraints(n,e){return{x:calcViewportAxisConstraints(n.x,e.x),y:calcViewportAxisConstraints(n.y,e.y)}}function calcOrigin(n,e){let i=.5;const a=calcLength(n),s=calcLength(e);return s>a?i=progress(e.min,e.max-a,n.min):a>s&&(i=progress(n.min,n.max-s,e.min)),clamp(0,1,i)}function rebaseAxisConstraints(n,e){const i={};return e.min!==void 0&&(i.min=e.min-n.min),e.max!==void 0&&(i.max=e.max-n.min),i}const defaultElastic=.35;function resolveDragElastic(n=defaultElastic){return n===!1?n=0:n===!0&&(n=defaultElastic),{x:resolveAxisElastic(n,"left","right"),y:resolveAxisElastic(n,"top","bottom")}}function resolveAxisElastic(n,e,i){return{min:resolvePointElastic(n,e),max:resolvePointElastic(n,i)}}function resolvePointElastic(n,e){return typeof n=="number"?n:n[e]||0}const elementDragControls=new WeakMap;class VisualElementDragControls{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=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:i=!1,distanceThreshold:a}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const r=p=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(extractEventInfo(p).point)},o=(p,f)=>{const{drag:m,dragPropagation:P,onDragStart:T}=this.getProps();if(m&&!P&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(m),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(y=>{let S=this.getAxisMotionValue(y).get()||0;if(percent.test(S)){const{projection:g}=this.visualElement;if(g&&g.layout){const C=g.layout.layoutBox[y];C&&(S=calcLength(C)*(parseFloat(S)/100))}}this.originPoint[y]=S}),T&&frame.postRender(()=>T(p,f)),addValueToWillChange(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(p,f)=>{this.latestPointerEvent=p,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:P,onDirectionLock:T,onDrag:x}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:y}=f;if(P&&this.currentDirection===null){this.currentDirection=getCurrentDirection(y),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),x&&x(p,f)},u=(p,f)=>{this.latestPointerEvent=p,this.latestPanInfo=f,this.stop(p,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>eachAxis(p=>{var f;return this.getAnimationState(p)==="paused"&&((f=this.getAxisMotionValue(p).animation)==null?void 0:f.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new PanSession(e,{onSessionStart:r,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:a,contextWindow:getContextWindow(this.visualElement)})}stop(e,i){const a=e||this.latestPointerEvent,s=i||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!s||!a)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&frame.postRender(()=>l(a,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:i}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(e,i,a){const{drag:s}=this.getProps();if(!a||!shouldDrag(e,s,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(o=applyConstraints(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){var r;const{dragConstraints:e,dragElastic:i}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,s=this.constraints;e&&isRefObject(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=calcRelativeConstraints(a.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(i),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=rebaseAxisConstraints(a.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:i}=this.getProps();if(!e||!isRefObject(e))return!1;const a=e.current;invariant(a!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=measurePageBox(a,s.root,this.visualElement.getTransformPagePoint());let o=calcViewportConstraints(s.layout.layoutBox,r);if(i){const l=i(convertBoxToBoundingBox(o));this.hasMutatedConstraints=!!l,l&&(o=convertBoundingBoxToBox(l))}return o}startAnimation(e){const{drag:i,dragMomentum:a,dragElastic:s,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},c=eachAxis(d=>{if(!shouldDrag(d,i,this.currentDirection))return;let p=u&&u[d]||{};o&&(p={min:0,max:0});const f=s?200:1e6,m=s?40:1e7,P={type:"inertia",velocity:a?e[d]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...r,...p};return this.startAxisValueAnimation(d,P)});return Promise.all(c).then(l)}startAxisValueAnimation(e,i){const a=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),a.start(animateMotionValue(e,a,0,i,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){eachAxis(e=>{var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.pause()})}getAnimationState(e){var i;return(i=this.getAxisMotionValue(e).animation)==null?void 0:i.state}getAxisMotionValue(e){const i=`_drag${e.toUpperCase()}`,a=this.visualElement.getProps(),s=a[i];return s||this.visualElement.getValue(e,(a.initial?a.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(i=>{const{drag:a}=this.getProps();if(!shouldDrag(i,a,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(i);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[i];r.set(e[i]-mixNumber$1(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:a}=this.visualElement;if(!isRefObject(i)||!a||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};eachAxis(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const u=l.get();s[o]=calcOrigin({min:u,max:u},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),eachAxis(o=>{if(!shouldDrag(o,e,null))return;const l=this.getAxisMotionValue(o),{min:u,max:c}=this.constraints[o];l.set(mixNumber$1(u,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const e=this.visualElement.current,i=addPointerEvent(e,"pointerdown",u=>{const{drag:c,dragListener:d=!0}=this.getProps();c&&d&&this.start(u)}),a=()=>{const{dragConstraints:u}=this.getProps();isRefObject(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",a);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),frame.read(a);const o=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(eachAxis(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=u[d].translate,p.set(p.get()+u[d].translate))}),this.visualElement.render())});return()=>{o(),i(),r(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:a=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:o=defaultElastic,dragMomentum:l=!0}=e;return{...e,drag:i,dragDirectionLock:a,dragPropagation:s,dragConstraints:r,dragElastic:o,dragMomentum:l}}}function shouldDrag(n,e,i){return(e===!0||e===n)&&(i===null||i===n)}function getCurrentDirection(n,e=10){let i=null;return Math.abs(n.y)>e?i="y":Math.abs(n.x)>e&&(i="x"),i}class DragGesture extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=n=>(e,i)=>{n&&frame.postRender(()=>n(e,i))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:i,onPan:a,onPanEnd:s}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(i),onMove:a,onEnd:(r,o)=>{delete this.session,s&&frame.postRender(()=>s(r,o))}}}mount(){this.removePointerDownListener=addPointerEvent(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 globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const correctBorderRadius={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(px.test(n))n=parseFloat(n);else return n;const i=pixelsToPercent(n,e.target.x),a=pixelsToPercent(n,e.target.y);return`${i}% ${a}%`}},correctBoxShadow={correct:(n,{treeScale:e,projectionDelta:i})=>{const a=n,s=complex.parse(n);if(s.length>5)return a;const r=complex.createTransformer(n),o=typeof s[0]!="number"?1:0,l=i.x.scale*e.x,u=i.y.scale*e.y;s[0+o]/=l,s[1+o]/=u;const c=mixNumber$1(l,u,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),r(s)}};let hasTakenAnySnapshot=!1;class MeasureLayoutWithContext extends React.Component{componentDidMount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a,layoutId:s}=this.props,{projection:r}=e;addScaleCorrector(defaultScaleCorrectors),r&&(i.group&&i.group.add(r),a&&a.register&&s&&a.register(r),hasTakenAnySnapshot&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:i,visualElement:a,drag:s,isPresent:r}=this.props,{projection:o}=a;return o&&(o.isPresent=r,hasTakenAnySnapshot=!0,s||e.layoutDependency!==i||i===void 0||e.isPresent!==r?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||frame.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),microtask.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a}=this.props,{projection:s}=e;hasTakenAnySnapshot=!0,s&&(s.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(s),a&&a.deregister&&a.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function MeasureLayout(n){const[e,i]=usePresence(),a=React.useContext(LayoutGroupContext);return jsxRuntime.jsx(MeasureLayoutWithContext,{...n,layoutGroup:a,switchLayoutGroup:React.useContext(SwitchLayoutGroupContext),isPresent:e,safeToRemove:i})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow};function animateSingleValue(n,e,i){const a=isMotionValue(n)?n:motionValue(n);return a.start(animateMotionValue("",a,e,i)),a.animation}const compareByDepth=(n,e)=>n.depth-e.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}}function delay(n,e){const i=time.now(),a=({timestamp:s})=>{const r=s-i;r>=e&&(cancelFrame(a),n(r-e))};return frame.setup(a,!0),()=>cancelFrame(a)}const borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=n=>typeof n=="string"?parseFloat(n):n,isPx=n=>typeof n=="number"||px.test(n);function mixValues(n,e,i,a,s,r){s?(n.opacity=mixNumber$1(0,i.opacity??1,easeCrossfadeIn(a)),n.opacityExit=mixNumber$1(e.opacity??1,0,easeCrossfadeOut(a))):r&&(n.opacity=mixNumber$1(e.opacity??1,i.opacity??1,a));for(let o=0;o<numBorders;o++){const l=`border${borders[o]}Radius`;let u=getRadius(e,l),c=getRadius(i,l);if(u===void 0&&c===void 0)continue;u||(u=0),c||(c=0),u===0||c===0||isPx(u)===isPx(c)?(n[l]=Math.max(mixNumber$1(asNumber(u),asNumber(c),a),0),(percent.test(c)||percent.test(u))&&(n[l]+="%")):n[l]=c}(e.rotate||i.rotate)&&(n.rotate=mixNumber$1(e.rotate||0,i.rotate||0,a))}function getRadius(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const easeCrossfadeIn=compress(0,.5,circOut),easeCrossfadeOut=compress(.5,.95,noop);function compress(n,e,i){return a=>a<n?0:a>e?1:i(progress(n,e,a))}function copyAxisInto(n,e){n.min=e.min,n.max=e.max}function copyBoxInto(n,e){copyAxisInto(n.x,e.x),copyAxisInto(n.y,e.y)}function copyAxisDeltaInto(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function removePointDelta(n,e,i,a,s){return n-=e,n=scalePoint(n,1/i,a),s!==void 0&&(n=scalePoint(n,1/s,a)),n}function removeAxisDelta(n,e=0,i=1,a=.5,s,r=n,o=n){if(percent.test(e)&&(e=parseFloat(e),e=mixNumber$1(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=mixNumber$1(r.min,r.max,a);n===r&&(l-=e),n.min=removePointDelta(n.min,e,i,l,s),n.max=removePointDelta(n.max,e,i,l,s)}function removeAxisTransforms(n,e,[i,a,s],r,o){removeAxisDelta(n,e[i],e[a],e[s],e.scale,r,o)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(n,e,i,a){removeAxisTransforms(n.x,e,xKeys,i?i.x:void 0,a?a.x:void 0),removeAxisTransforms(n.y,e,yKeys,i?i.y:void 0,a?a.y:void 0)}function isAxisDeltaZero(n){return n.translate===0&&n.scale===1}function isDeltaZero(n){return isAxisDeltaZero(n.x)&&isAxisDeltaZero(n.y)}function axisEquals(n,e){return n.min===e.min&&n.max===e.max}function boxEquals(n,e){return axisEquals(n.x,e.x)&&axisEquals(n.y,e.y)}function axisEqualsRounded(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function boxEqualsRounded(n,e){return axisEqualsRounded(n.x,e.x)&&axisEqualsRounded(n.y,e.y)}function aspectRatio(n){return calcLength(n.x)/calcLength(n.y)}function axisDeltaEquals(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class NodeStack{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e),e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(e){const i=this.members.findIndex(s=>e===s);if(i===0)return!1;let a;for(let s=i;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1){a=r;break}}return a?(this.promote(a),!0):!1}promote(e,i){const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.instance&&a.scheduleRender(),e.scheduleRender(),e.resumeFrom=a,i&&(e.resumeFrom.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:i,resumingFrom:a}=e;i.onExitComplete&&i.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(n,e,i){let a="";const s=n.x.translate/e.x,r=n.y.translate/e.y,o=(i==null?void 0:i.z)||0;if((s||r||o)&&(a=`translate3d(${s}px, ${r}px, ${o}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:c,rotate:d,rotateX:p,rotateY:f,skewX:m,skewY:P}=i;c&&(a=`perspective(${c}px) ${a}`),d&&(a+=`rotate(${d}deg) `),p&&(a+=`rotateX(${p}deg) `),f&&(a+=`rotateY(${f}deg) `),m&&(a+=`skewX(${m}deg) `),P&&(a+=`skewY(${P}deg) `)}const l=n.x.scale*e.x,u=n.y.scale*e.y;return(l!==1||u!==1)&&(a+=`scale(${l}, ${u})`),a||"none"}const transformAxes=["","X","Y","Z"],animationTarget=1e3;let id=0;function resetDistortingTransform(n,e,i,a){const{latestValues:s}=e;s[n]&&(i[n]=s[n],e.setStaticValue(n,0),a&&(a[n]=0))}function cancelTreeOptimisedTransformAnimations(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const i=getOptimisedAppearId(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:s,layoutId:r}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",frame,!(s||r))}const{parent:a}=n;a&&!a.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(a)}function createProjectionNode({attachResizeListener:n,defaultParent:e,measureScroll:i,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=id++,this.animationId=0,this.animationCommitId=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.layoutVersion=0,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(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new SubscriptionManager),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const u=this.eventHandlers.get(o);u&&u.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=isSVGElement(o)&&!isSVGSVGElement(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),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),n){let d,p=0;const f=()=>this.root.updateBlockedByResize=!1;frame.read(()=>{p=window.innerWidth}),n(o,()=>{const m=window.innerWidth;m!==p&&(p=m,this.root.updateBlockedByResize=!0,d&&d(),d=delay(f,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const P=this.options.transition||c.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:T,onLayoutAnimationComplete:x}=c.getProps(),y=!this.targetLayout||!boxEqualsRounded(this.targetLayout,m),S=!p&&f;if(this.options.layoutRoot||this.resumeFrom||S||p&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const g={...getValueTransition(P,"layout"),onPlay:T,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(g.delay=0,g.type=!1),this.startAnimation(g),this.setAnimationOrigin(d,S)}else p||finishAnimation(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,this.eventHandlers.clear(),cancelFrame(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(resetSkewAndRotation),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&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const p=this.path[d];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();const l=time.now();frameData.delta=clamp(0,1e3/60,l-frameData.timestamp),frameData.timestamp=l,frameData.isProcessing=!0,frameSteps.update.process(frameData),frameSteps.preRender.process(frameData),frameSteps.render.process(frameData),frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(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 u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const u=a(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!isDeltaZero(this.projectionDelta),u=this.getTransformTemplate(),c=u?u(this.latestValues,""):void 0,d=c!==this.prevTransformTemplateValue;o&&this.instance&&(l||hasTransform(this.latestValues)||d)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return o&&(u=this.removeTransform(u)),roundBox(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return createBox();const l=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(checkNodeWasScrollRoot))){const{scroll:d}=this.root;d&&(translateAxis(l.x,d.offset.x),translateAxis(l.y,d.offset.y))}return l}removeElementScroll(o){var u;const l=createBox();if(copyBoxInto(l,o),(u=this.scroll)!=null&&u.wasRoot)return l;for(let c=0;c<this.path.length;c++){const d=this.path[c],{scroll:p,options:f}=d;d!==this.root&&p&&f.layoutScroll&&(p.wasRoot&©BoxInto(l,o),translateAxis(l.x,p.offset.x),translateAxis(l.y,p.offset.y))}return l}applyTransform(o,l=!1){const u=createBox();copyBoxInto(u,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&transformBox(u,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),hasTransform(d.latestValues)&&transformBox(u,d.latestValues)}return hasTransform(this.latestValues)&&transformBox(u,this.latestValues),u}removeTransform(o){const l=createBox();copyBoxInto(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];if(!c.instance||!hasTransform(c.latestValues))continue;hasScale(c.latestValues)&&c.updateSnapshot();const d=createBox(),p=c.measurePageBox();copyBoxInto(d,p),removeBoxTransforms(l,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return hasTransform(this.latestValues)&&removeBoxTransforms(l,this.latestValues),l}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!==frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var m;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:p}=this.options;if(!this.layout||!(d||p))return;this.resolvedRelativeTargetAt=frameData.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,l,u),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var P;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||(P=this.parent)!=null&&P.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===frameData.timestamp&&(u=!1),u)return;const{layout:c,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||d))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,f=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=createBox());const{target:m}=o;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==f||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(o,l=!1){const u=this.snapshot,c=u?u.latestValues:{},d={...this.latestValues},p=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=createBox(),m=u?u.source:void 0,P=this.layout?this.layout.source:void 0,T=m!==P,x=this.getStack(),y=!x||x.members.length<=1,S=!!(T&&!y&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let g;this.mixTargetDelta=C=>{const E=C/1e3;mixAxisDelta(p.x,o.x,E),mixAxisDelta(p.y,o.y,E),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,f,E),g&&boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=createBox()),copyBoxInto(g,this.relativeTarget)),T&&(this.animationValues=d,mixValues(d,c,this.latestValues,E,S,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,u,c;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(c=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||c.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=motionValue(0)),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},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(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:u,layout:c,latestValues:d}=o;if(!(!l||!u||!c)){if(this!==o&&this.layout&&c&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,c.layoutBox)){u=this.target||createBox();const p=calcLength(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const f=calcLength(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+f}copyBoxInto(l,u),transformBox(l,d),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new NodeStack),this.sharedNodes.get(o).add(l);const c=l.options.initialPromotionConfig;l.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:u}={}){const c=this.getStack();c&&c.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const c={};u.z&&resetDistortingTransform("z",o,c,this.animationValues);for(let d=0;d<transformAxes.length;d++)resetDistortingTransform(`rotate${transformAxes[d]}`,o,c,this.animationValues),resetDistortingTransform(`skew${transformAxes[d]}`,o,c,this.animationValues);o.render();for(const d in c)o.setStaticValue(d,c[d]),this.animationValues&&(this.animationValues[d]=c[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=resolveMotionValue(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!hasTransform(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=c.animationValues||c.latestValues;this.applyTransformsToTarget();let p=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,d);u&&(p=u(d,p)),o.transform=p;const{x:f,y:m}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${m.origin*100}% 0`,c.animationValues?o.opacity=c===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=c===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const P in scaleCorrectors){if(d[P]===void 0)continue;const{correct:T,applyTo:x,isCSSVariable:y}=scaleCorrectors[P],S=p==="none"?d[P]:T(d[P],c);if(x){const g=x.length;for(let C=0;C<g;C++)o[x[C]]=S}else y?this.options.visualElement.renderState.vars[P]=S:o[P]=S}this.options.layoutId&&(o.pointerEvents=c===this?resolveMotionValue(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(n){n.updateLayout()}function notifyLayoutUpdate(n){var i;const e=((i=n.resumeFrom)==null?void 0:i.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:s}=n.layout,{animationType:r}=n.options,o=e.source!==n.layout.source;r==="size"?eachAxis(p=>{const f=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(f);f.min=a[p].min,f.max=f.min+m}):shouldAnimatePositionOnly(r,e.layoutBox,a)&&eachAxis(p=>{const f=o?e.measuredBox[p]:e.layoutBox[p],m=calcLength(a[p]);f.max=f.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[p].max=n.relativeTarget[p].min+m)});const l=createDelta();calcBoxDelta(l,a,e.layoutBox);const u=createDelta();o?calcBoxDelta(u,n.applyTransform(s,!0),e.measuredBox):calcBoxDelta(u,a,e.layoutBox);const c=!isDeltaZero(l);let d=!1;if(!n.resumeFrom){const p=n.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:f,layout:m}=p;if(f&&m){const P=createBox();calcRelativePosition(P,e.layoutBox,f.layoutBox);const T=createBox();calcRelativePosition(T,a,m.layoutBox),boxEqualsRounded(P,T)||(d=!0),p.options.layoutRoot&&(n.relativeTarget=T,n.relativeTargetOrigin=P,n.relativeParent=p)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:u,layoutDelta:l,hasLayoutChanged:c,hasRelativeLayoutChanged:d})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function propagateDirtyNodes(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function cleanDirtyNodes(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function clearSnapshot(n){n.clearSnapshot()}function clearMeasurements(n){n.clearMeasurements()}function clearIsLayoutDirty(n){n.isLayoutDirty=!1}function resetTransformStyle(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function finishAnimation(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function resolveTargetDelta(n){n.resolveTargetDelta()}function calcProjection(n){n.calcProjection()}function resetSkewAndRotation(n){n.resetSkewAndRotation()}function removeLeadSnapshots(n){n.removeLeadSnapshot()}function mixAxisDelta(n,e,i){n.translate=mixNumber$1(e.translate,0,i),n.scale=mixNumber$1(e.scale,1,i),n.origin=e.origin,n.originPoint=e.originPoint}function mixAxis(n,e,i,a){n.min=mixNumber$1(e.min,i.min,a),n.max=mixNumber$1(e.max,i.max,a)}function mixBox(n,e,i,a){mixAxis(n.x,e.x,i.x,a),mixAxis(n.y,e.y,i.y,a)}function hasOpacityCrossfade(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop;function roundAxis(n){n.min=roundPoint(n.min),n.max=roundPoint(n.max)}function roundBox(n){roundAxis(n.x),roundAxis(n.y)}function shouldAnimatePositionOnly(n,e,i){return n==="position"||n==="preserve-aspect"&&!isNear(aspectRatio(e),aspectRatio(i),.2)}function checkNodeWasScrollRoot(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(n,e)=>addDomEvent(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const n=new DocumentProjectionNode({});n.mount(window),n.setOptions({layoutScroll:!0}),rootProjectionNode.current=n}return rootProjectionNode.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}};function handleHoverEvent(n,e,i){const{props:a}=n;n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",i==="Start");const s="onHover"+i,r=a[s];r&&frame.postRender(()=>r(e,extractEventInfo(e)))}class HoverGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=hover(e,(i,a)=>(handleHoverEvent(this.node,a,"Start"),s=>handleHoverEvent(this.node,s,"End"))))}unmount(){}}class FocusGesture extends Feature{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=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function handlePressEvent(n,e,i){const{props:a}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&a.whileTap&&n.animationState.setActive("whileTap",i==="Start");const s="onTap"+(i==="End"?"":i),r=a[s];r&&frame.postRender(()=>r(e,extractEventInfo(e)))}class PressGesture extends Feature{mount(){const{current:e}=this.node;e&&(this.unmount=press(e,(i,a)=>(handlePressEvent(this.node,a,"Start"),(s,{success:r})=>handlePressEvent(this.node,s,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=n=>{const e=observerCallbacks.get(n.target);e&&e(n)},fireAllObserverCallbacks=n=>{n.forEach(fireObserverCallback)};function initIntersectionObserver({root:n,...e}){const i=n||document;observers.has(i)||observers.set(i,{});const a=observers.get(i),s=JSON.stringify(e);return a[s]||(a[s]=new IntersectionObserver(fireAllObserverCallbacks,{root:n,...e})),a[s]}function observeIntersection(n,e,i){const a=initIntersectionObserver(e);return observerCallbacks.set(n,i),a.observe(n),()=>{observerCallbacks.delete(n),a.unobserve(n)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:i,margin:a,amount:s="some",once:r}=e,o={root:i?i.current:void 0,rootMargin:a,threshold:typeof s=="number"?s:thresholdNames[s]},l=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,r&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),f=c?d:p;f&&f(u)};return observeIntersection(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:i}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(e,i))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:n={}},{viewport:e={}}={}){return i=>n[i]!==e[i]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},featureBundle={...animations,...gestureAnimations,...drag,...layout},motion=createMotionProxy(featureBundle,createDomVisualElement);/**
|
|
10
10
|
* @license lucide-react v0.462.0 - ISC
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the ISC license.
|
|
@@ -146,16 +146,16 @@
|
|
|
146
146
|
*
|
|
147
147
|
* This source code is licensed under the ISC license.
|
|
148
148
|
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/const X=createLucideIcon("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),claraLogo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2074%2019'%3e%3cpath%20d='M%2061.697%2019.219%20C%2060.922%2019.219%2060.192%2019.149%2059.505%2019.008%20C%2058.819%2018.885%2058.211%2018.674%2057.683%2018.374%20C%2057.155%2018.057%2056.741%2017.653%2056.442%2017.16%20C%2056.161%2016.649%2056.02%2016.024%2056.02%2015.285%20C%2056.02%2014.141%2056.337%2013.26%2056.97%2012.644%20C%2057.604%2012.011%2058.484%2011.553%2059.611%2011.271%20C%2060.755%2010.99%2062.075%2010.822%2063.572%2010.77%20C%2065.086%2010.699%2066.714%2010.664%2068.457%2010.664%20L%2068.457%209.845%20C%2068.457%209.053%2068.307%208.437%2068.008%207.997%20C%2067.708%207.539%2067.216%207.222%2066.529%207.046%20C%2065.842%206.853%2064.91%206.756%2063.73%206.756%20C%2062.727%206.756%2061.89%206.844%2061.222%207.02%20C%2060.57%207.178%2060.077%207.407%2059.743%207.707%20C%2059.408%207.988%2059.241%208.323%2059.241%208.71%20L%2059.241%209.185%20L%2056.68%209.185%20C%2056.662%209.115%2056.645%209.044%2056.627%208.974%20C%2056.627%208.886%2056.627%208.789%2056.627%208.683%20C%2056.627%207.839%2056.9%207.126%2057.446%206.545%20C%2058.009%205.946%2058.836%205.488%2059.928%205.172%20C%2061.019%204.837%2062.383%204.67%2064.021%204.67%20C%2065.57%204.67%2066.863%204.819%2067.902%205.119%20C%2068.941%205.418%2069.724%205.92%2070.252%206.624%20C%2070.78%207.31%2071.044%208.252%2071.044%209.449%20L%2071.044%2016.103%20C%2071.044%2016.455%2071.106%2016.72%2071.229%2016.896%20C%2071.352%2017.054%2071.59%2017.133%2071.942%2017.133%20L%2073.262%2017.133%20L%2073.262%2018.823%20C%2072.998%2018.911%2072.664%2018.99%2072.259%2019.061%20C%2071.872%2019.149%2071.484%2019.193%2071.097%2019.193%20C%2070.411%2019.193%2069.891%2019.087%2069.539%2018.876%20C%2069.187%2018.665%2068.941%2018.374%2068.8%2018.005%20C%2068.677%2017.635%2068.597%2017.221%2068.562%2016.764%20L%2068.377%2016.764%20C%2067.884%2017.292%2067.277%2017.741%2066.555%2018.11%20C%2065.851%2018.48%2065.077%2018.753%2064.232%2018.929%20C%2063.404%2019.122%2062.559%2019.219%2061.697%2019.219%20Z%20M%2062.199%2017.133%20C%2062.903%2017.133%2063.616%2017.054%2064.337%2016.896%20C%2065.077%2016.72%2065.754%2016.473%2066.371%2016.156%20C%2067.004%2015.839%2067.506%2015.461%2067.876%2015.021%20C%2068.263%2014.581%2068.457%2014.088%2068.457%2013.542%20L%2068.457%2012.459%20C%2066.274%2012.459%2064.452%2012.53%2062.991%2012.671%20C%2061.547%2012.794%2060.465%2013.049%2059.743%2013.437%20C%2059.021%2013.824%2058.66%2014.413%2058.66%2015.206%20C%2058.66%2015.716%2058.827%2016.112%2059.162%2016.394%20C%2059.514%2016.658%2059.963%2016.852%2060.509%2016.975%20C%2061.072%2017.08%2061.635%2017.133%2062.199%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2047.17%2018.902%20L%2047.17%204.987%20L%2049.23%204.987%20L%2049.441%207.601%20L%2049.626%207.601%20C%2049.749%207.178%2049.969%206.747%2050.286%206.307%20C%2050.621%205.849%2051.061%205.462%2051.607%205.145%20C%2052.17%204.828%2052.839%204.67%2053.613%204.67%20C%2053.913%204.67%2054.203%204.696%2054.485%204.749%20C%2054.784%204.784%2055.048%204.837%2055.277%204.908%20L%2055.277%207.152%20L%2053.877%207.152%20C%2053.085%207.152%2052.416%207.302%2051.871%207.601%20C%2051.342%207.9%2050.92%208.287%2050.603%208.763%20C%2050.304%209.238%2050.084%209.757%2049.943%2010.321%20C%2049.82%2010.866%2049.758%2011.394%2049.758%2011.905%20L%2049.758%2018.902%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2033.52%2019.219%20C%2032.745%2019.219%2032.015%2019.149%2031.328%2019.008%20C%2030.642%2018.885%2030.034%2018.674%2029.506%2018.374%20C%2028.978%2018.057%2028.564%2017.653%2028.265%2017.16%20C%2027.984%2016.649%2027.843%2016.024%2027.843%2015.285%20C%2027.843%2014.141%2028.16%2013.26%2028.793%2012.644%20C%2029.427%2012.011%2030.307%2011.553%2031.434%2011.271%20C%2032.578%2010.99%2033.898%2010.822%2035.395%2010.77%20C%2036.909%2010.699%2038.537%2010.664%2040.28%2010.664%20L%2040.28%209.845%20C%2040.28%209.053%2040.13%208.437%2039.831%207.997%20C%2039.531%207.539%2039.039%207.222%2038.352%207.046%20C%2037.665%206.853%2036.732%206.756%2035.553%206.756%20C%2034.55%206.756%2033.713%206.844%2033.045%207.02%20C%2032.393%207.178%2031.9%207.407%2031.566%207.707%20C%2031.231%207.988%2031.064%208.323%2031.064%208.71%20L%2031.064%209.185%20L%2028.503%209.185%20C%2028.485%209.115%2028.468%209.044%2028.45%208.974%20C%2028.45%208.886%2028.45%208.789%2028.45%208.683%20C%2028.45%207.839%2028.723%207.126%2029.269%206.545%20C%2029.832%205.946%2030.659%205.488%2031.751%205.172%20C%2032.842%204.837%2034.206%204.67%2035.844%204.67%20C%2037.393%204.67%2038.686%204.819%2039.725%205.119%20C%2040.764%205.418%2041.547%205.92%2042.075%206.624%20C%2042.603%207.31%2042.867%208.252%2042.867%209.449%20L%2042.867%2016.103%20C%2042.867%2016.455%2042.929%2016.72%2043.052%2016.896%20C%2043.175%2017.054%2043.413%2017.133%2043.765%2017.133%20L%2045.085%2017.133%20L%2045.085%2018.823%20C%2044.821%2018.911%2044.487%2018.99%2044.082%2019.061%20C%2043.695%2019.149%2043.307%2019.193%2042.92%2019.193%20C%2042.234%2019.193%2041.714%2019.087%2041.362%2018.876%20C%2041.01%2018.665%2040.764%2018.374%2040.623%2018.005%20C%2040.5%2017.635%2040.42%2017.221%2040.385%2016.764%20L%2040.2%2016.764%20C%2039.707%2017.292%2039.1%2017.741%2038.378%2018.11%20C%2037.674%2018.48%2036.9%2018.753%2036.055%2018.929%20C%2035.227%2019.122%2034.382%2019.219%2033.52%2019.219%20Z%20M%2034.022%2017.133%20C%2034.726%2017.133%2035.439%2017.054%2036.16%2016.896%20C%2036.9%2016.72%2037.577%2016.473%2038.194%2016.156%20C%2038.827%2015.839%2039.329%2015.461%2039.699%2015.021%20C%2040.086%2014.581%2040.28%2014.088%2040.28%2013.542%20L%2040.28%2012.459%20C%2038.097%2012.459%2036.275%2012.53%2034.814%2012.671%20C%2033.37%2012.794%2032.288%2013.049%2031.566%2013.437%20C%2030.844%2013.824%2030.483%2014.413%2030.483%2015.206%20C%2030.483%2015.716%2030.65%2016.112%2030.985%2016.394%20C%2031.337%2016.658%2031.786%2016.852%2032.332%2016.975%20C%2032.895%2017.08%2033.458%2017.133%2034.022%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2023.105%2018.903%20L%2023.105%20-0.215%20L%2025.692%20-0.215%20L%2025.692%2018.903%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2010.853%2019.219%20C%208.494%2019.219%206.504%2018.867%204.885%2018.163%20C%203.265%2017.441%202.042%2016.385%201.215%2014.994%20C%200.405%2013.586%200%2011.861%200%209.819%20C%200%206.826%200.933%204.52%202.799%202.901%20C%204.665%201.263%207.332%200.445%2010.8%200.445%20C%2012.824%200.445%2014.602%200.709%2016.134%201.237%20C%2017.665%201.765%2018.853%202.557%2019.698%203.614%20C%2020.561%204.652%2020.992%205.946%2020.992%207.495%20L%2018.167%207.495%20C%2018.167%206.404%2017.859%205.524%2017.243%204.855%20C%2016.626%204.168%2015.755%203.675%2014.628%203.376%20C%2013.52%203.059%2012.226%202.901%2010.747%202.901%20C%209.215%202.901%207.86%203.147%206.681%203.64%20C%205.501%204.115%204.577%204.846%203.908%205.832%20C%203.257%206.8%202.931%208.014%202.931%209.476%20L%202.931%2010.136%20C%202.931%2011.667%203.265%2012.926%203.934%2013.912%20C%204.603%2014.88%205.527%2015.602%206.707%2016.077%20C%207.904%2016.552%209.286%2016.79%2010.853%2016.79%20C%2012.349%2016.79%2013.652%2016.631%2014.761%2016.315%20C%2015.87%2015.98%2016.723%2015.478%2017.322%2014.809%20C%2017.938%2014.123%2018.246%2013.26%2018.246%2012.222%20L%2021.019%2012.222%20C%2021.019%2013.753%2020.587%2015.038%2019.725%2016.077%20C%2018.862%2017.116%2017.665%2017.899%2016.134%2018.427%20C%2014.62%2018.955%2012.859%2019.219%2010.853%2019.219%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3c/svg%3e",createStoreImpl=n=>{let e;const i=new Set,a=(c,d)=>{const p=typeof c=="function"?c(e):c;if(!Object.is(p,e)){const f=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),i.forEach(m=>m(e,f))}},s=()=>e,l={setState:a,getState:s,getInitialState:()=>u,subscribe:c=>(i.add(c),()=>i.delete(c))},u=e=n(a,s,l);return l},createStore=n=>n?createStoreImpl(n):createStoreImpl,identity=n=>n;function useStore(n,e=identity){const i=React.useSyncExternalStore(n.subscribe,React.useCallback(()=>e(n.getState()),[n,e]),React.useCallback(()=>e(n.getInitialState()),[n,e]));return React.useDebugValue(i),i}const createImpl=n=>{const e=createStore(n),i=a=>useStore(e,a);return Object.assign(i,e),i},create=n=>n?createImpl(n):createImpl,initialState={config:{apiKey:null,templateId:null,analysisId:null,primaryColor:"#8b5cf6",position:"bottom-right",autoOpen:!1,demoTemplate:"audiometria",geminiApiKey:void 0,lang:"es"},isAuthenticated:!1,accessToken:null,userProfile:null,templates:[],currentTemplate:null,currentAnalysis:null,isConnected:!1,isPaused:!1,isAutopilot:!1,speechSpeed:"fast",voiceStyle:"formal",remoteSessionActive:!1,remoteSessionInfo:null,userStreamInfo:null,analysisStreamInfo:null,isS2Connected:!1,formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",usageStats:null},useClaraStore=create((n,e)=>({...initialState,setConfig:i=>n(a=>({config:{...a.config,...i},isAuthenticated:i.apiKey?!0:a.isAuthenticated})),setAuthenticated:i=>n({isAuthenticated:i}),setAccessToken:i=>n({accessToken:i}),setUserProfile:i=>n({userProfile:i}),setTemplates:i=>n({templates:i}),setCurrentTemplate:i=>n({currentTemplate:i}),setCurrentAnalysis:i=>n({currentAnalysis:i,config:i?{...e().config,analysisId:i.id}:e().config}),setConnected:i=>n({isConnected:i}),setPaused:i=>n({isPaused:i}),setAutopilot:i=>n({isAutopilot:i}),setSpeechSpeed:i=>n({speechSpeed:i}),setVoiceStyle:i=>n({voiceStyle:i}),setRemoteSessionActive:i=>n({remoteSessionActive:i}),setRemoteSessionInfo:i=>n({remoteSessionInfo:i}),setUserStreamInfo:i=>n({userStreamInfo:i}),setAnalysisStreamInfo:i=>n({analysisStreamInfo:i}),setS2Connected:i=>n({isS2Connected:i}),updateFormData:(i,a,s="user",r="Manual edit")=>n(o=>{const l={fieldId:i,value:a,source:s,reason:r,timestamp:new Date().toISOString()};return{formData:{...o.formData,[i]:a},documentChanges:[...o.documentChanges,l]}}),setFormData:i=>n({formData:i}),addDocumentChange:i=>n(a=>({documentChanges:[...a.documentChanges,i]})),clearDocumentChanges:()=>n({documentChanges:[]}),addTranscriptMessage:i=>n(a=>{if(i.id){const r=a.transcriptMessages.findIndex(o=>o.id===i.id);if(r!==-1){const o=[...a.transcriptMessages];return o[r]={...o[r],...i},{transcriptMessages:o}}}const s=a.transcriptMessages[a.transcriptMessages.length-1];if(s&&s.role===i.role){const r=s.content.trim().toLowerCase(),o=i.content.trim().toLowerCase();if(r===o||r.includes(o)||o.includes(r)){if(o.length>r.length){const l=[...a.transcriptMessages];return l[l.length-1]={...s,content:i.content,id:i.id},{transcriptMessages:l}}return a}}return{transcriptMessages:[...a.transcriptMessages,i]}}),clearTranscript:()=>n({transcriptMessages:[]}),addChatMessage:i=>n(a=>({chatMessages:[...a.chatMessages,i]})),clearChatMessages:()=>n({chatMessages:[]}),setAnalysisTitle:i=>n({analysisTitle:i}),setUsageStats:i=>n({usageStats:i}),clearSessionData:()=>n({formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",currentAnalysis:null,analysisStreamInfo:null,isS2Connected:!1,usageStats:null}),reset:()=>n(initialState)})),ClaraStoreAPI={getConfig:()=>useClaraStore.getState().config,getApiKey:()=>useClaraStore.getState().config.apiKey,getTemplateId:()=>useClaraStore.getState().config.templateId,getAnalysisId:()=>useClaraStore.getState().config.analysisId,getPrimaryColor:()=>useClaraStore.getState().config.primaryColor,getUserProfile:()=>useClaraStore.getState().userProfile,getTemplates:()=>useClaraStore.getState().templates,getCurrentTemplate:()=>useClaraStore.getState().currentTemplate,getCurrentAnalysis:()=>useClaraStore.getState().currentAnalysis,isAuthenticated:()=>useClaraStore.getState().isAuthenticated,isConnected:()=>useClaraStore.getState().isConnected,isPaused:()=>useClaraStore.getState().isPaused,isAutopilot:()=>useClaraStore.getState().isAutopilot,getSpeechSpeed:()=>useClaraStore.getState().speechSpeed,getVoiceStyle:()=>useClaraStore.getState().voiceStyle,getFormData:()=>useClaraStore.getState().formData,getDocumentChanges:()=>useClaraStore.getState().documentChanges,getTranscript:()=>useClaraStore.getState().transcriptMessages,getAnalysisTitle:()=>useClaraStore.getState().analysisTitle,getUserStreamInfo:()=>useClaraStore.getState().userStreamInfo,getAnalysisStreamInfo:()=>useClaraStore.getState().analysisStreamInfo,isS2Connected:()=>useClaraStore.getState().isS2Connected,isRemoteSessionActive:()=>useClaraStore.getState().remoteSessionActive,getRemoteSessionInfo:()=>useClaraStore.getState().remoteSessionInfo,setConfig:n=>useClaraStore.getState().setConfig(n),setAuthenticated:n=>useClaraStore.getState().setAuthenticated(n),setUserProfile:n=>useClaraStore.getState().setUserProfile(n),setTemplates:n=>useClaraStore.getState().setTemplates(n),setCurrentTemplate:n=>useClaraStore.getState().setCurrentTemplate(n),setCurrentAnalysis:n=>useClaraStore.getState().setCurrentAnalysis(n),setConnected:n=>useClaraStore.getState().setConnected(n),setPaused:n=>useClaraStore.getState().setPaused(n),setAutopilot:n=>useClaraStore.getState().setAutopilot(n),setSpeechSpeed:n=>useClaraStore.getState().setSpeechSpeed(n),setVoiceStyle:n=>useClaraStore.getState().setVoiceStyle(n),setUserStreamInfo:n=>useClaraStore.getState().setUserStreamInfo(n),setAnalysisStreamInfo:n=>useClaraStore.getState().setAnalysisStreamInfo(n),setS2Connected:n=>useClaraStore.getState().setS2Connected(n),setRemoteSessionActive:n=>useClaraStore.getState().setRemoteSessionActive(n),setRemoteSessionInfo:n=>useClaraStore.getState().setRemoteSessionInfo(n),updateFormData:(n,e,i,a)=>useClaraStore.getState().updateFormData(n,e,i,a),setFormData:n=>useClaraStore.getState().setFormData(n),addDocumentChange:n=>useClaraStore.getState().addDocumentChange(n),clearDocumentChanges:()=>useClaraStore.getState().clearDocumentChanges(),addTranscriptMessage:n=>useClaraStore.getState().addTranscriptMessage(n),clearTranscript:()=>useClaraStore.getState().clearTranscript(),setAnalysisTitle:n=>useClaraStore.getState().setAnalysisTitle(n),reset:()=>useClaraStore.getState().reset(),subscribe:n=>useClaraStore.subscribe(n)};typeof window<"u"&&(window.ClaraStore=ClaraStoreAPI);const PROJECT_ID="mahjxdopacmbyqewgxpx",API_BASE_URL$1=`https://${PROJECT_ID}.supabase.co/functions/v1/api`;class ClaraApiService{constructor(){ze(this,"apiKey",null);ze(this,"accessToken",null)}setApiKey(e){console.log("[Clara API] 🔑 setApiKey() called"),this.apiKey=e,this.accessToken=null}setAccessToken(e){console.log("[Clara API] 🎫 setAccessToken() called"),this.accessToken=e,this.apiKey=null}getApiKey(){return this.apiKey}getAccessToken(){return this.accessToken}getApiBaseUrl(){return API_BASE_URL$1}hasAuth(){return!!(this.apiKey||this.accessToken)}clearAuth(){console.log("[Clara API] 🧹 clearAuth() called"),this.apiKey=null,this.accessToken=null}getHeadersForEphemeral(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken&&(e.Authorization=`Bearer ${this.accessToken}`),e}getHeaders(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken?e.Authorization=`Bearer ${this.accessToken}`:console.warn("[Clara API] ⚠️ getHeaders() - no auth available!"),e}async login(e,i,a="es"){var s;try{const r=`${API_BASE_URL$1}/auth/login`;console.log("[Clara API] Logging in with language:",a);const o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:i,language:a})}),l=await o.json();if(!o.ok||l.error){const u=((s=l.error)==null?void 0:s.message)||l.error||"Error de autenticación";return console.error("[Clara API] Login failed:",u),{success:!1,error:u}}return l.data?(this.setAccessToken(l.data.accessToken),console.log("[Clara API] Login successful, user:",l.data.user.email),{success:!0,user:l.data.user}):{success:!1,error:"Respuesta inválida del servidor"}}catch(r){return console.error("[Clara API] Login error:",r),{success:!1,error:"Error de conexión"}}}async fetchUserProfile(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/user/profile`;console.log("[Clara API] Fetching user profile from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const a=await i.json();return console.log("[Clara API] User profile received:",a),a.data||a}catch(e){throw console.error("[Clara API] Failed to fetch user profile:",e),e}}async updateUserSettings(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),!1;try{const i=`${API_BASE_URL$1}/user/settings`;console.log("[Clara API] Updating user settings:",e);const a=await fetch(i,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({settings:e})});return a.ok?(console.log("[Clara API] Settings updated successfully"),!0):(console.error("[Clara API] Failed to update settings:",a.status),!1)}catch(i){return console.error("[Clara API] Failed to update user settings:",i),!1}}async fetchTemplates(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Fetching templates from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const a=await i.json();return console.log("[Clara API] Templates received:",a),a.data||a}catch(e){throw console.error("[Clara API] Failed to fetch templates:",e),e}}async fetchTemplate(e){const i=await this.fetchTemplates();return i&&i.find(a=>a.id===e)||null}async createTemplate(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const i=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Creating template at:",i);const a=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({name:e.name,language:e.language||"es",description:e.description||"",custom_prompt:e.custom_prompt||null,structure:e.structure,webhook_config:e.webhook_config||null})});if(!a.ok)throw a.status===401?new Error("Invalid API key"):new Error(`HTTP ${a.status}`);const s=await a.json();return console.log("[Clara API] Template created:",s),s.data||s}catch(i){throw console.error("[Clara API] Failed to create template:",i),i}}async createAnalysis(e,i){var r;if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;const a={id:i.id,name:i.name,description:i.description,custom_prompt:i.custom_prompt,sections:((r=i.structure)==null?void 0:r.sections)||[]},s=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);try{const o=`${API_BASE_URL$1}/analyses`;console.log("[Clara API] Creating analysis at:",o,{templateId:e,isValidUUID:s});const l=await fetch(o,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({templateId:s?e:null,source:"web_live",title:i.name||"Nueva consulta",templateSnapshot:a})});if(!l.ok)throw new Error(`HTTP ${l.status}`);const u=await l.json();return console.log("[Clara API] Analysis created:",u),u.data||u}catch(o){return console.error("[Clara API] Failed to create analysis:",o),null}}async updateFormData(e,i,a,s,r){if(!this.hasAuth()||!e)return!1;console.log("[Clara API] 📊 updateFormData called with usageStats:",r);try{const o=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Updating formData:",o);const l={formData:i};return a&&a.length>0&&(l.documentChanges=a),s&&s.length>0&&(l.chatHistory=s),r&&r.totalTokens>0?(l.usageInputTokens=r.inputTokens,l.usageOutputTokens=r.outputTokens,l.usageTotalTokens=r.totalTokens,l.usageEstimatedCost=r.estimatedCost,console.log("[Clara API] 📊 Including usage in PUT:",l.usageTotalTokens,"tokens")):console.log("[Clara API] ⚠️ No usage stats to include (zeros or undefined)"),(await fetch(o,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify(l)})).ok}catch(o){return console.error("[Clara API] Failed to update formData:",o),!1}}async updateAnalysisTitle(e,i){if(!this.hasAuth()||!e)return!1;try{const a=`${API_BASE_URL$1}/analyses/${e}`;return(await fetch(a,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({title:i})})).ok}catch(a){return console.error("[Clara API] Failed to update analysis title:",a),!1}}async syncChatHistory(e,i){if(!this.hasAuth()||!e)return!1;try{const a=`${API_BASE_URL$1}/analyses/${e}`;return fetch(a,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({chatHistory:i})}).catch(s=>console.error("[Clara API] Chat history sync failed:",s)),!0}catch(a){return console.error("[Clara API] Failed to sync chat history:",a),!1}}async syncTranscriptToDB(e,i){if(!this.hasAuth()||!e)return!1;const a=i.map((s,r)=>({id:s.id||`msg_${r}_${Date.now()}`,role:s.role,content:s.content,timestamp:s.timestamp instanceof Date?s.timestamp.toISOString():s.timestamp,isFinal:s.isFinal??!0}));try{const s=`${API_BASE_URL$1}/analyses/${e}`;return fetch(s,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({transcript:JSON.stringify(a)})}).catch(r=>console.error("[Clara API] Transcript sync failed:",r)),!0}catch(s){return console.error("[Clara API] Failed to sync transcript:",s),!1}}async completeAnalysis(e,i,a,s,r,o){if(!this.hasAuth()||!e)return!1;const l=s.map((c,d)=>({id:c.id||`msg_${d}_${Date.now()}`,role:c.role,content:c.content,timestamp:c.timestamp instanceof Date?c.timestamp.toISOString():c.timestamp,isFinal:c.isFinal??!0})),u=new Date().toISOString();try{const c=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Completing analysis:",c);const d={status:"completed",transcript:JSON.stringify(l),completedAt:u,formData:i,documentChanges:a};r&&r.length>0&&(d.chatHistory=r),o&&o.totalTokens>0&&(d.usageInputTokens=o.inputTokens,d.usageOutputTokens=o.outputTokens,d.usageTotalTokens=o.totalTokens,d.usageEstimatedCost=o.estimatedCost);const p=await fetch(c,{method:"PUT",keepalive:!0,headers:this.getHeaders(),body:JSON.stringify(d)});return p.ok&&console.log("[Clara API] Analysis completed successfully"),p.ok}catch(c){return console.error("[Clara API] Failed to complete analysis:",c),!1}}async fetchBasinToken(e={}){if(!this.hasAuth())return null;try{const i=`${API_BASE_URL$1}/s2/basin/token`;console.log("[Clara API] Fetching S2 basin token from:",i,"with body:",e);const a=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();return console.log("[Clara API] Basin token received:",s),s.data||s}catch(i){return console.error("[Clara API] Failed to fetch basin token:",i),null}}async fetchUserStreamToken(){var i;const e=await this.fetchBasinToken({});return e?{basin:e.basin,token:e.token,id:((i=e.streams)==null?void 0:i.exact)||e.userId||""}:null}async fetchAnalysisStreamToken(e,i){const a=i||e,s=await this.fetchBasinToken({streams:[a],includeUserStream:!1,ops:["list-streams","create-stream","append","read"]});return s?{basin:s.basin,token:s.token,id:a,analysisId:e}:null}}const claraApi=new ClaraApiService,translations={"login.title":{es:"Iniciar Sesión",en:"Sign In"},"login.email":{es:"Correo electrónico",en:"Email"},"login.password":{es:"Contraseña",en:"Password"},"login.submit":{es:"Ingresar",en:"Sign In"},"login.register":{es:"Regístrate en Clara",en:"Register on Clara"},"login.error":{es:"Error al iniciar sesión",en:"Login error"},"login.emailRequired":{es:"El correo electrónico es requerido",en:"Email is required"},"login.emailInvalid":{es:"Ingrese un correo electrónico válido",en:"Please enter a valid email"},"login.passwordRequired":{es:"La contraseña es requerida",en:"Password is required"},"login.invalidCredentials":{es:"Credenciales incorrectas",en:"Invalid credentials"},"login.connectionError":{es:"Error de conexión",en:"Connection error"},"dashboard.title":{es:"Panel de Control",en:"Dashboard"},"dashboard.newConsultation":{es:"Nueva Consulta",en:"New Consultation"},"dashboard.templates":{es:"Plantillas",en:"Templates"},"dashboard.recentSessions":{es:"Sesiones Recientes",en:"Recent Sessions"},"dashboard.noTemplate":{es:"Sin plantilla seleccionada",en:"No template selected"},"dashboard.selectTemplate":{es:"Seleccionar plantilla",en:"Select template"},"dashboard.startSession":{es:"Iniciar Sesión",en:"Start Session"},"dashboard.generate":{es:"Generar",en:"Generate"},"dashboard.logout":{es:"Cerrar Sesión",en:"Log Out"},"session.recording":{es:"Grabando...",en:"Recording..."},"session.paused":{es:"Pausado",en:"Paused"},"session.stop":{es:"Detener",en:"Stop"},"session.pause":{es:"Pausar",en:"Pause"},"session.resume":{es:"Reanudar",en:"Resume"},"session.untitled":{es:"Sin título",en:"Untitled"},"tabs.form":{es:"Formulario",en:"Form"},"tabs.transcript":{es:"Transcripción",en:"Transcript"},"tabs.chat":{es:"Chat",en:"Chat"},"tabs.report":{es:"Reporte",en:"Report"},"chat.placeholder":{es:"Escribe un mensaje...",en:"Type a message..."},"chat.send":{es:"Enviar",en:"Send"},"chat.welcome":{es:"Hola. Soy tu asistente médico con capacidad visual. Envíame imágenes o PDFs para extraer datos y generar el reporte.",en:"Hello. I am your visual medical assistant. Send me images or PDFs to extract data and generate the report."},"chat.thinking":{es:"Pensando...",en:"Thinking..."},"chat.generateSoap":{es:"Generar SOAP",en:"Generate SOAP"},"chat.summarize":{es:"Resumir consulta",en:"Summarize consultation"},"chat.clear":{es:"Limpiar chat",en:"Clear chat"},"chat.noDataToSummarize":{es:"No hay datos capturados para resumir. Complete los campos del formulario primero.",en:"No captured data to summarize. Complete the form fields first."},"form.clear":{es:"Limpiar",en:"Clear"},"form.save":{es:"Guardar",en:"Save"},"form.noTemplate":{es:"No hay plantilla cargada",en:"No template loaded"},"report.export":{es:"Exportar PDF",en:"Export PDF"},"report.fieldsCaptured":{es:"campos capturados",en:"fields captured"},"report.capturedData":{es:"Datos Capturados",en:"Captured Data"},"report.selectTemplate":{es:"Selecciona una plantilla para ver los campos",en:"Select a template to see the fields"},"report.noData":{es:"Sin datos",en:"No data"},"report.title":{es:"Reporte Médico",en:"Medical Report"},"report.generatedOn":{es:"Generado el",en:"Generated on"},"config.title":{es:"Configuración del Widget",en:"Widget Configuration"},"config.realtime":{es:"Los cambios se aplican en tiempo real",en:"Changes apply in real-time"},"config.apiKey":{es:"Clara API Key",en:"Clara API Key"},"config.apiKeyDesc":{es:"Tu clave de API para autenticación con Clara Platform.",en:"Your API key for Clara Platform authentication."},"config.templateId":{es:"Template ID (opcional)",en:"Template ID (optional)"},"config.templateIdDesc":{es:"ID del template remoto a cargar (sobrescribe el demo).",en:"Remote template ID to load (overrides demo)."},"config.primaryColor":{es:"Color Principal",en:"Primary Color"},"config.position":{es:"Posición del Widget",en:"Widget Position"},"config.positionLeft":{es:"Izquierda",en:"Left"},"config.positionCenter":{es:"Centro",en:"Center"},"config.positionRight":{es:"Derecha",en:"Right"},"config.autoOpen":{es:"Abrir Automáticamente",en:"Auto Open"},"config.autoOpenDesc":{es:"Si está activado, el widget aparecerá abierto al cargar la página.",en:"If enabled, the widget will open automatically on page load."},"config.language":{es:"Idioma",en:"Language"},"config.languageDesc":{es:"Idioma de la interfaz del widget.",en:"Widget interface language."},"config.spanish":{es:"Español",en:"Spanish"},"config.english":{es:"Inglés",en:"English"},"config.integrationCode":{es:"Código de Integración",en:"Integration Code"},"config.viewSdk":{es:"Ver SDK y documentación",en:"View SDK and documentation"},"transcript.provisional":{es:"La transcripción es provisional y puede ser corregida al finalizar.",en:"Transcription is provisional and may be corrected upon completion."},"transcript.empty":{es:"La transcripción aparecerá aquí...",en:"Transcription will appear here..."},"transcript.connecting":{es:"Conectando con el modelo de voz...",en:"Connecting to voice model..."},"transcript.listening":{es:"Escuchando conversación...",en:"Listening to conversation..."},"transcript.startSession":{es:"Inicia la sesión para ver la transcripción.",en:"Start the session to see the transcript."},"common.loading":{es:"Cargando...",en:"Loading..."},"common.error":{es:"Error",en:"Error"},"common.success":{es:"Éxito",en:"Success"},"common.cancel":{es:"Cancelar",en:"Cancel"},"common.confirm":{es:"Confirmar",en:"Confirm"},"common.close":{es:"Cerrar",en:"Close"},"page.integration":{es:"Integración",en:"Integration"},"page.configuration":{es:"Configuración",en:"Configuration"},"page.completeFields":{es:"Complete todos los campos requeridos para el registro de la consulta médica",en:"Complete all required fields for the medical consultation record"},"page.noSections":{es:"No hay secciones de formulario cargadas",en:"No form sections loaded"},"page.selectTemplate":{es:"Selecciona un template desde la configuración del widget",en:"Select a template from the widget configuration"},"generate.title":{es:"Generando Template",en:"Generating Template"},"generate.complete":{es:"Template Generado",en:"Template Generated"},"generate.analyzing":{es:"Analizando formulario...",en:"Analyzing form..."},"generate.sections":{es:"secciones",en:"sections"},"generate.fields":{es:"campos",en:"fields"},"embed.title":{es:"Código de Integración",en:"Embed Code"},"embed.subtitle":{es:"Integra Clara en tu sitio web",en:"Integrate Clara into your website"},"embed.widgetDescription":{es:"Agrega este código antes de </body> para mostrar el asistente flotante de Clara.",en:"Add this snippet before </body> to display the floating Clara assistant widget."},"embed.formDescription":{es:"Agrega este código donde quieras renderizar el formulario médico de Clara.",en:"Add this code where you want to render the Clara medical form."},"embed.extensionDescription":{es:"Descarga e instala la extensión de Chrome para inyectar Clara en cualquier sitio web sin modificar el código fuente.",en:"Download and install the Chrome extension to inject Clara into any website without modifying the source code."},"embed.extensionTitle":{es:"Clara Extensión de Chrome",en:"Clara Chrome Extension"},"embed.extensionSubtitle":{es:"Inyecta Clara en cualquier sitio web con un solo clic",en:"Inject Clara into any website with a single click"},"embed.download":{es:"Descargar Extensión",en:"Download Extension"},"embed.installation":{es:"Instalación",en:"Installation"},"embed.step1":{es:"Descarga y descomprime el archivo de la extensión",en:"Download and unzip the extension file"},"embed.step2":{es:"Abre Chrome y ve a",en:"Open Chrome and go to"},"embed.step3":{es:'Activa el "Modo desarrollador" en la esquina superior derecha',en:'Enable "Developer mode" in the top right'},"embed.step4":{es:'Haz clic en "Cargar descomprimida" y selecciona la carpeta',en:'Click "Load unpacked" and select the unzipped folder'},"embed.tipExtension":{es:"Haz clic derecho en cualquier página para abrir la barra lateral de Clara",en:"Right-click on any page to open Clara sidebar"},"embed.tipConfig":{es:"Los cambios de configuración se reflejan en tiempo real",en:"Configuration changes are reflected in real-time"},"embed.copied":{es:"¡Copiado!",en:"Copied!"},"embed.copy":{es:"Copiar",en:"Copy"}};function t(n,e="es"){const i=translations[n];return i?i[e]||i.es:(console.warn(`[Translations] Missing key: ${n}`),n)}function createTranslator(n){return e=>t(e,n)}const ClaraLogin=({onLogin:n,primaryColor:e})=>{const[i,a]=React.useState(""),[s,r]=React.useState(""),[o,l]=React.useState(!1),[u,c]=React.useState(!1),[d,p]=React.useState({}),{config:f,setAccessToken:m,setUserProfile:P,setAuthenticated:T}=useClaraStore(),x=f.lang||"es",y=()=>{const g={};return i?/\S+@\S+\.\S+/.test(i)||(g.email=t("login.emailInvalid",x)):g.email=t("login.emailRequired",x),s||(g.password=t("login.passwordRequired",x)),p(g),Object.keys(g).length===0},S=async g=>{if(g.preventDefault(),!!y()){c(!0),p({});try{const C=await claraApi.login(i,s,x);if(!C.success){p({general:C.error||t("login.invalidCredentials",x)}),c(!1);return}const E=claraApi.getAccessToken();E&&m(E),C.user&&P({id:C.user.id,email:C.user.email,name:`${C.user.user_metadata.first_name||""} ${C.user.user_metadata.last_name||""}`.trim()}),T(!0),n()}catch(C){console.error("[Login] Error:",C),p({general:t("login.connectionError",x)})}finally{c(!1)}}};return jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex flex-col h-full bg-card text-card-foreground px-6 py-8 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"mb-6 text-center",children:jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-8 w-auto"})}),jsxRuntime.jsx("div",{className:"text-center mb-6",children:jsxRuntime.jsx("h2",{className:"text-lg font-bold leading-tight mb-1",style:{color:e},children:t("login.title",x)})}),jsxRuntime.jsxs("form",{onSubmit:S,className:"w-full space-y-4",noValidate:!0,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.email",x)}),jsxRuntime.jsx("input",{type:"email",value:i,onChange:g=>{a(g.target.value),d.email&&p({...d,email:void 0})},placeholder:"tu-correo@clara.care",className:`w-full px-3 py-2.5 rounded-lg border text-sm ${d.email?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),d.email&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:d.email})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.password",x)}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:o?"text":"password",value:s,onChange:g=>{r(g.target.value),d.password&&p({...d,password:void 0})},placeholder:"••••••••",className:`w-full px-3 py-2.5 pr-10 rounded-lg border text-sm ${d.password?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),jsxRuntime.jsx("button",{type:"button",onClick:()=>l(!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:o?jsxRuntime.jsx(EyeOff,{className:"w-4 h-4"}):jsxRuntime.jsx(Eye,{className:"w-4 h-4"})})]}),d.password&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:d.password})]}),d.general&&jsxRuntime.jsx("div",{className:"p-2 bg-destructive/10 border border-destructive/20 rounded-lg",children:jsxRuntime.jsx("p",{className:"text-destructive text-xs text-center",children:d.general})}),jsxRuntime.jsx("button",{type:"submit",disabled:u,style:{backgroundColor:e},className:"w-full text-white font-semibold py-2.5 px-4 rounded-lg transition-all shadow-button text-sm hover:brightness-110 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}),t("common.loading",x)]}):t("login.submit",x)})]}),jsxRuntime.jsx("div",{className:"mt-6 pb-4 text-center",children:jsxRuntime.jsx("a",{href:"https://clara.care",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium text-xs hover:opacity-80 transition-colors",style:{color:e},children:t("login.register",x)})})]})})};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lottie$1={exports:{}};(function(module,exports){typeof document<"u"&&typeof navigator<"u"&&function(n,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(n){return document.createElement(n)}function extendPrototype(n,e){var i,a=n.length,s;for(i=0;i<a;i+=1){s=n[i].prototype;for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e.prototype[r]=s[r])}}function getDescriptor(n,e){return Object.getOwnPropertyDescriptor(n,e)}function createProxyFunction(n){function e(){}return e.prototype=n,e}var audioControllerFactory=function(){function n(e){this.audios=[],this.audioFactory=e,this._volume=1,this._isMuted=!1}return n.prototype={addAudio:function(i){this.audios.push(i)},pause:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].pause()},resume:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].resume()},setRate:function(i){var a,s=this.audios.length;for(a=0;a<s;a+=1)this.audios[a].setRate(i)},createAudio:function(i){return this.audioFactory?this.audioFactory(i):window.Howl?new window.Howl({src:[i]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(i){this.audioFactory=i},setVolume:function(i){this._volume=i,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].volume(this._volume*(this._isMuted?0:1))}},function(){return new n}}(),createTypedArray=function(){function n(i,a){var s=0,r=[],o;switch(i){case"int16":case"uint8c":o=1;break;default:o=1.1;break}for(s=0;s<a;s+=1)r.push(o);return r}function e(i,a){return i==="float32"?new Float32Array(a):i==="int16"?new Int16Array(a):i==="uint8c"?new Uint8ClampedArray(a):n(i,a)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?e:n}();function createSizedArray(n){return Array.apply(null,{length:n})}function _typeof$6(n){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(n)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var n=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],e,i=n.length;for(e=0;e<i;e+=1)BMMath[n[e]]=Math[n[e]]})(),BMMath.random=Math.random,BMMath.abs=function(n){var e=_typeof$6(n);if(e==="object"&&n.length){var i=createSizedArray(n.length),a,s=n.length;for(a=0;a<s;a+=1)i[a]=Math.abs(n[a]);return i}return Math.abs(n)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(n){n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.display="block",n.style.transformOrigin="0 0",n.style.webkitTransformOrigin="0 0",n.style.backfaceVisibility="visible",n.style.webkitBackfaceVisibility="visible",n.style.transformStyle="preserve-3d",n.style.webkitTransformStyle="preserve-3d",n.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(n,e,i,a){this.type=n,this.currentTime=e,this.totalTime=i,this.direction=a<0?-1:1}function BMCompleteEvent(n,e){this.type=n,this.direction=e<0?-1:1}function BMCompleteLoopEvent(n,e,i,a){this.type=n,this.currentLoop=i,this.totalLoops=e,this.direction=a<0?-1:1}function BMSegmentStartEvent(n,e,i){this.type=n,this.firstFrame=e,this.totalFrames=i}function BMDestroyEvent(n,e){this.type=n,this.target=e}function BMRenderFrameErrorEvent(n,e){this.type="renderFrameError",this.nativeError=n,this.currentTime=e}function BMConfigErrorEvent(n){this.type="configError",this.nativeError=n}var createElementID=function(){var n=0;return function(){return n+=1,idPrefix$1+"__lottie_element_"+n}}();function HSVtoRGB(n,e,i){var a,s,r,o,l,u,c,d;switch(o=Math.floor(n*6),l=n*6-o,u=i*(1-e),c=i*(1-l*e),d=i*(1-(1-l)*e),o%6){case 0:a=i,s=d,r=u;break;case 1:a=c,s=i,r=u;break;case 2:a=u,s=i,r=d;break;case 3:a=u,s=c,r=i;break;case 4:a=d,s=u,r=i;break;case 5:a=i,s=u,r=c;break}return[a,s,r]}function RGBtoHSV(n,e,i){var a=Math.max(n,e,i),s=Math.min(n,e,i),r=a-s,o,l=a===0?0:r/a,u=a/255;switch(a){case s:o=0;break;case n:o=e-i+r*(e<i?6:0),o/=6*r;break;case e:o=i-n+r*2,o/=6*r;break;case i:o=n-e+r*4,o/=6*r;break}return[o,l,u]}function addSaturationToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[1]+=e,i[1]>1?i[1]=1:i[1]<=0&&(i[1]=0),HSVtoRGB(i[0],i[1],i[2])}function addBrightnessToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),HSVtoRGB(i[0],i[1],i[2])}function addHueToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),HSVtoRGB(i[0],i[1],i[2])}var rgbToHex=function(){var n=[],e,i;for(e=0;e<256;e+=1)i=e.toString(16),n[e]=i.length===1?"0"+i:i;return function(a,s,r){return a<0&&(a=0),s<0&&(s=0),r<0&&(r=0),"#"+n[a]+n[s]+n[r]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(n){return document.createElementNS(svgNS,n)}function _typeof$5(n){"@babel/helpers - typeof";return _typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(n)}var dataManager=function(){var n=1,e=[],i,a,s={onmessage:function(){},postMessage:function(m){i({data:m})}},r={postMessage:function(m){s.onmessage({data:m})}};function o(f){if(window.Worker&&window.Blob&&getWebWorker()){var m=new Blob(["var _workerSelf = self; self.onmessage = ",f.toString()],{type:"text/javascript"}),P=URL.createObjectURL(m);return new Worker(P)}return i=f,s}function l(){a||(a=o(function(m){function P(){function x(O,b){var I,V,A=O.length,k,R,G,z;for(V=0;V<A;V+=1)if(I=O[V],"ks"in I&&!I.completed){if(I.completed=!0,I.hasMask){var q=I.masksProperties;for(R=q.length,k=0;k<R;k+=1)if(q[k].pt.k.i)E(q[k].pt.k);else for(z=q[k].pt.k.length,G=0;G<z;G+=1)q[k].pt.k[G].s&&E(q[k].pt.k[G].s[0]),q[k].pt.k[G].e&&E(q[k].pt.k[G].e[0])}I.ty===0?(I.layers=g(I.refId,b),x(I.layers,b)):I.ty===4?C(I.shapes):I.ty===5&&H(I)}}function y(O,b){if(O){var I=0,V=O.length;for(I=0;I<V;I+=1)O[I].t===1&&(O[I].data.layers=g(O[I].data.refId,b),x(O[I].data.layers,b))}}function S(O,b){for(var I=0,V=b.length;I<V;){if(b[I].id===O)return b[I];I+=1}return null}function g(O,b){var I=S(O,b);return I?I.layers.__used?JSON.parse(JSON.stringify(I.layers)):(I.layers.__used=!0,I.layers):null}function C(O){var b,I=O.length,V,A;for(b=I-1;b>=0;b-=1)if(O[b].ty==="sh")if(O[b].ks.k.i)E(O[b].ks.k);else for(A=O[b].ks.k.length,V=0;V<A;V+=1)O[b].ks.k[V].s&&E(O[b].ks.k[V].s[0]),O[b].ks.k[V].e&&E(O[b].ks.k[V].e[0]);else O[b].ty==="gr"&&C(O[b].it)}function E(O){var b,I=O.i.length;for(b=0;b<I;b+=1)O.i[b][0]+=O.v[b][0],O.i[b][1]+=O.v[b][1],O.o[b][0]+=O.v[b][0],O.o[b][1]+=O.v[b][1]}function B(O,b){var I=b?b.split("."):[100,100,100];return O[0]>I[0]?!0:I[0]>O[0]?!1:O[1]>I[1]?!0:I[1]>O[1]?!1:O[2]>I[2]?!0:I[2]>O[2]?!1:null}var _=function(){var O=[4,4,14];function b(V){var A=V.t.d;V.t.d={k:[{s:A,t:0}]}}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===5&&b(V[A])}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),M=function(){var O=[4,7,99];return function(b){if(b.chars&&!B(O,b.v)){var I,V=b.chars.length;for(I=0;I<V;I+=1){var A=b.chars[I];A.data&&A.data.shapes&&(C(A.data.shapes),A.data.ip=0,A.data.op=99999,A.data.st=0,A.data.sr=1,A.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},b.chars[I].t||(A.data.shapes.push({ty:"no"}),A.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),D=function(){var O=[5,7,15];function b(V){var A=V.t.p;typeof A.a=="number"&&(A.a={a:0,k:A.a}),typeof A.p=="number"&&(A.p={a:0,k:A.p}),typeof A.r=="number"&&(A.r={a:0,k:A.r})}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===5&&b(V[A])}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),L=function(){var O=[4,1,9];function b(V){var A,k=V.length,R,G;for(A=0;A<k;A+=1)if(V[A].ty==="gr")b(V[A].it);else if(V[A].ty==="fl"||V[A].ty==="st")if(V[A].c.k&&V[A].c.k[0].i)for(G=V[A].c.k.length,R=0;R<G;R+=1)V[A].c.k[R].s&&(V[A].c.k[R].s[0]/=255,V[A].c.k[R].s[1]/=255,V[A].c.k[R].s[2]/=255,V[A].c.k[R].s[3]/=255),V[A].c.k[R].e&&(V[A].c.k[R].e[0]/=255,V[A].c.k[R].e[1]/=255,V[A].c.k[R].e[2]/=255,V[A].c.k[R].e[3]/=255);else V[A].c.k[0]/=255,V[A].c.k[1]/=255,V[A].c.k[2]/=255,V[A].c.k[3]/=255}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===4&&b(V[A].shapes)}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),F=function(){var O=[4,4,18];function b(V){var A,k=V.length,R,G;for(A=k-1;A>=0;A-=1)if(V[A].ty==="sh")if(V[A].ks.k.i)V[A].ks.k.c=V[A].closed;else for(G=V[A].ks.k.length,R=0;R<G;R+=1)V[A].ks.k[R].s&&(V[A].ks.k[R].s[0].c=V[A].closed),V[A].ks.k[R].e&&(V[A].ks.k[R].e[0].c=V[A].closed);else V[A].ty==="gr"&&b(V[A].it)}function I(V){var A,k,R=V.length,G,z,q,U;for(k=0;k<R;k+=1){if(A=V[k],A.hasMask){var K=A.masksProperties;for(z=K.length,G=0;G<z;G+=1)if(K[G].pt.k.i)K[G].pt.k.c=K[G].cl;else for(U=K[G].pt.k.length,q=0;q<U;q+=1)K[G].pt.k[q].s&&(K[G].pt.k[q].s[0].c=K[G].cl),K[G].pt.k[q].e&&(K[G].pt.k[q].e[0].c=K[G].cl)}A.ty===4&&b(A.shapes)}}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}();function N(O){O.__complete||(L(O),_(O),M(O),D(O),F(O),x(O.layers,O.assets),y(O.chars,O.assets),O.__complete=!0)}function H(O){O.t.a.length===0&&"m"in O.t.p}var $={};return $.completeData=N,$.checkColors=L,$.checkChars=M,$.checkPathProperties=D,$.checkShapes=F,$.completeLayers=x,$}if(r.dataManager||(r.dataManager=P()),r.assetLoader||(r.assetLoader=function(){function x(S){var g=S.getResponseHeader("content-type");return g&&S.responseType==="json"&&g.indexOf("json")!==-1||S.response&&_typeof$5(S.response)==="object"?S.response:S.response&&typeof S.response=="string"?JSON.parse(S.response):S.responseText?JSON.parse(S.responseText):null}function y(S,g,C,E){var B,_=new XMLHttpRequest;try{_.responseType="json"}catch{}_.onreadystatechange=function(){if(_.readyState===4)if(_.status===200)B=x(_),C(B);else try{B=x(_),C(B)}catch(M){E&&E(M)}};try{_.open(["G","E","T"].join(""),S,!0)}catch{_.open(["G","E","T"].join(""),g+"/"+S,!0)}_.send()}return{load:y}}()),m.data.type==="loadAnimation")r.assetLoader.load(m.data.path,m.data.fullPath,function(x){r.dataManager.completeData(x),r.postMessage({id:m.data.id,payload:x,status:"success"})},function(){r.postMessage({id:m.data.id,status:"error"})});else if(m.data.type==="complete"){var T=m.data.animation;r.dataManager.completeData(T),r.postMessage({id:m.data.id,payload:T,status:"success"})}else m.data.type==="loadData"&&r.assetLoader.load(m.data.path,m.data.fullPath,function(x){r.postMessage({id:m.data.id,payload:x,status:"success"})},function(){r.postMessage({id:m.data.id,status:"error"})})}),a.onmessage=function(f){var m=f.data,P=m.id,T=e[P];e[P]=null,m.status==="success"?T.onComplete(m.payload):T.onError&&T.onError()})}function u(f,m){n+=1;var P="processId_"+n;return e[P]={onComplete:f,onError:m},P}function c(f,m,P){l();var T=u(m,P);a.postMessage({type:"loadAnimation",path:f,fullPath:window.location.origin+window.location.pathname,id:T})}function d(f,m,P){l();var T=u(m,P);a.postMessage({type:"loadData",path:f,fullPath:window.location.origin+window.location.pathname,id:T})}function p(f,m,P){l();var T=u(m,P);a.postMessage({type:"complete",animation:f,id:T})}return{loadAnimation:c,loadData:d,completeAnimation:p}}(),ImagePreloader=function(){var n=function(){var y=createTag("canvas");y.width=1,y.height=1;var S=y.getContext("2d");return S.fillStyle="rgba(0,0,0,0)",S.fillRect(0,0,1,1),y}();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function a(y,S,g){var C="";if(y.e)C=y.p;else if(S){var E=y.p;E.indexOf("images/")!==-1&&(E=E.split("/")[1]),C=S+E}else C=g,C+=y.u?y.u:"",C+=y.p;return C}function s(y){var S=0,g=setInterval((function(){var C=y.getBBox();(C.width||S>500)&&(this._imageLoaded(),clearInterval(g)),S+=1}).bind(this),50)}function r(y){var S=a(y,this.assetsPath,this.path),g=createNS("image");isSafari?this.testImageLoaded(g):g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){C.img=n,this._imageLoaded()}).bind(this),!1),g.setAttributeNS("http://www.w3.org/1999/xlink","href",S),this._elementHelper.append?this._elementHelper.append(g):this._elementHelper.appendChild(g);var C={img:g,assetData:y};return C}function o(y){var S=a(y,this.assetsPath,this.path),g=createTag("img");g.crossOrigin="anonymous",g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){C.img=n,this._imageLoaded()}).bind(this),!1),g.src=S;var C={img:g,assetData:y};return C}function l(y){var S={assetData:y},g=a(y,this.assetsPath,this.path);return dataManager.loadData(g,(function(C){S.img=C,this._footageLoaded()}).bind(this),(function(){S.img={},this._footageLoaded()}).bind(this)),S}function u(y,S){this.imagesLoadedCb=S;var g,C=y.length;for(g=0;g<C;g+=1)y[g].layers||(!y[g].t||y[g].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(y[g]))):y[g].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(y[g]))))}function c(y){this.path=y||""}function d(y){this.assetsPath=y||""}function p(y){for(var S=0,g=this.images.length;S<g;){if(this.images[S].assetData===y)return this.images[S].img;S+=1}return null}function f(){this.imagesLoadedCb=null,this.images.length=0}function m(){return this.totalImages===this.loadedAssets}function P(){return this.totalFootages===this.loadedFootagesCount}function T(y,S){y==="svg"?(this._elementHelper=S,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function x(){this._imageLoaded=e.bind(this),this._footageLoaded=i.bind(this),this.testImageLoaded=s.bind(this),this.createFootageData=l.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return x.prototype={loadAssets:u,setAssetsPath:d,setPath:c,loadedImages:m,loadedFootages:P,destroy:f,getAsset:p,createImgData:o,createImageData:r,imageLoaded:e,footageLoaded:i,setCacheType:T},x}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(e,i){if(this._cbs[e])for(var a=this._cbs[e],s=0;s<a.length;s+=1)a[s](i)},addEventListener:function(e,i){return this._cbs[e]||(this._cbs[e]=[]),this._cbs[e].push(i),(function(){this.removeEventListener(e,i)}).bind(this)},removeEventListener:function(e,i){if(!i)this._cbs[e]=null;else if(this._cbs[e]){for(var a=0,s=this._cbs[e].length;a<s;)this._cbs[e][a]===i&&(this._cbs[e].splice(a,1),a-=1,s-=1),a+=1;this._cbs[e].length||(this._cbs[e]=null)}}};var markerParser=function(){function n(e){for(var i=e.split(`\r
|
|
150
|
-
`),a={},s,r=0,o=0;o<i.length;o+=1)s=i[o].split(":"),s.length===2&&(a[s[0]]=s[1].trim(),r+=1);if(r===0)throw new Error;return a}return function(e){for(var i=[],a=0;a<e.length;a+=1){var s=e[a],r={time:s.tm,duration:s.dr};try{r.payload=JSON.parse(e[a].cm)}catch{try{r.payload=n(e[a].cm)}catch{r.payload={name:e[a].cm}}}i.push(r)}return i}}(),ProjectInterface=function(){function n(e){this.compositions.push(e)}return function(){function e(i){for(var a=0,s=this.compositions.length;a<s;){if(this.compositions[a].data&&this.compositions[a].data.nm===i)return this.compositions[a].prepareFrame&&this.compositions[a].data.xt&&this.compositions[a].prepareFrame(this.currentFrame),this.compositions[a].compInterface;a+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=n,e}}(),renderers={},registerRenderer=function(e,i){renderers[e]=i};function getRenderer(n){return renderers[n]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var n in renderers)if(renderers[n])return n;return""}function _typeof$4(n){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(n)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(n){(n.wrapper||n.container)&&(this.wrapper=n.wrapper||n.container);var e="svg";n.animType?e=n.animType:n.renderer&&(e=n.renderer);var i=getRenderer(e);this.renderer=new i(this,n.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,n.loop===""||n.loop===null||n.loop===void 0||n.loop===!0?this.loop=!0:n.loop===!1?this.loop=!1:this.loop=parseInt(n.loop,10),this.autoplay="autoplay"in n?n.autoplay:!0,this.name=n.name?n.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(n,"autoloadSegments")?n.autoloadSegments:!0,this.assetsPath=n.assetsPath,this.initialSegment=n.initialSegment,n.audioFactory&&this.audioController.setAudioFactory(n.audioFactory),n.animationData?this.setupAnimation(n.animationData):n.path&&(n.path.lastIndexOf("\\")!==-1?this.path=n.path.substr(0,n.path.lastIndexOf("\\")+1):this.path=n.path.substr(0,n.path.lastIndexOf("/")+1),this.fileName=n.path.substr(n.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(n.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(n){dataManager.completeAnimation(n,this.configAnimation)},AnimationItem.prototype.setData=function(n,e){e&&_typeof$4(e)!=="object"&&(e=JSON.parse(e));var i={wrapper:n,animationData:e},a=n.attributes;i.path=a.getNamedItem("data-animation-path")?a.getNamedItem("data-animation-path").value:a.getNamedItem("data-bm-path")?a.getNamedItem("data-bm-path").value:a.getNamedItem("bm-path")?a.getNamedItem("bm-path").value:"",i.animType=a.getNamedItem("data-anim-type")?a.getNamedItem("data-anim-type").value:a.getNamedItem("data-bm-type")?a.getNamedItem("data-bm-type").value:a.getNamedItem("bm-type")?a.getNamedItem("bm-type").value:a.getNamedItem("data-bm-renderer")?a.getNamedItem("data-bm-renderer").value:a.getNamedItem("bm-renderer")?a.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var s=a.getNamedItem("data-anim-loop")?a.getNamedItem("data-anim-loop").value:a.getNamedItem("data-bm-loop")?a.getNamedItem("data-bm-loop").value:a.getNamedItem("bm-loop")?a.getNamedItem("bm-loop").value:"";s==="false"?i.loop=!1:s==="true"?i.loop=!0:s!==""&&(i.loop=parseInt(s,10));var r=a.getNamedItem("data-anim-autoplay")?a.getNamedItem("data-anim-autoplay").value:a.getNamedItem("data-bm-autoplay")?a.getNamedItem("data-bm-autoplay").value:a.getNamedItem("bm-autoplay")?a.getNamedItem("bm-autoplay").value:!0;i.autoplay=r!=="false",i.name=a.getNamedItem("data-name")?a.getNamedItem("data-name").value:a.getNamedItem("data-bm-name")?a.getNamedItem("data-bm-name").value:a.getNamedItem("bm-name")?a.getNamedItem("bm-name").value:"";var o=a.getNamedItem("data-anim-prerender")?a.getNamedItem("data-anim-prerender").value:a.getNamedItem("data-bm-prerender")?a.getNamedItem("data-bm-prerender").value:a.getNamedItem("bm-prerender")?a.getNamedItem("bm-prerender").value:"";o==="false"&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(n){n.op>this.animationData.op&&(this.animationData.op=n.op,this.totalFrames=Math.floor(n.op-this.animationData.ip));var e=this.animationData.layers,i,a=e.length,s=n.layers,r,o=s.length;for(r=0;r<o;r+=1)for(i=0;i<a;){if(e[i].id===s[r].id){e[i]=s[r];break}i+=1}if((n.chars||n.fonts)&&(this.renderer.globalData.fontManager.addChars(n.chars),this.renderer.globalData.fontManager.addFonts(n.fonts,this.renderer.globalData.defs)),n.assets)for(a=n.assets.length,i=0;i<a;i+=1)this.animationData.assets.push(n.assets[i]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(n){this.animationData=n;var e=getExpressionsPlugin();e&&e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var n=this.animationData.segments;if(!n||n.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var e=n.shift();this.timeCompleted=e.time*this.frameRate;var i=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(i,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},AnimationItem.prototype.loadSegments=function(){var n=this.animationData.segments;n||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(n){if(this.renderer)try{this.animationData=n,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(n),n.assets||(n.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(n.assets),this.markers=markerParser(n.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(e){this.triggerConfigError(e)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var n=getExpressionsPlugin();n&&n.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(n,e){var i=typeof n=="number"?n:void 0,a=typeof e=="number"?e:void 0;this.renderer.updateContainerSize(i,a)},AnimationItem.prototype.setSubframe=function(n){this.isSubframeEnabled=!!n},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(n){this.triggerRenderFrameError(n)}},AnimationItem.prototype.play=function(n){n&&this.name!==n||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(n){n&&this.name!==n||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(n){n&&this.name!==n||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(n){n&&this.name!==n||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(n){for(var e,i=0;i<this.markers.length;i+=1)if(e=this.markers[i],e.payload&&e.payload.name===n)return e;return null},AnimationItem.prototype.goToAndStop=function(n,e,i){if(!(i&&this.name!==i)){var a=Number(n);if(isNaN(a)){var s=this.getMarkerData(n);s&&this.goToAndStop(s.time,!0)}else e?this.setCurrentRawFrameValue(n):this.setCurrentRawFrameValue(n*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(n,e,i){if(!(i&&this.name!==i)){var a=Number(n);if(isNaN(a)){var s=this.getMarkerData(n);s&&(s.duration?this.playSegments([s.time,s.time+s.duration],!0):this.goToAndStop(s.time,!0))}else this.goToAndStop(a,e,i);this.play()}},AnimationItem.prototype.advanceTime=function(n){if(!(this.isPaused===!0||this.isLoaded===!1)){var e=this.currentRawFrame+n*this.frameModifier,i=!1;e>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(i=!0,e=0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(n,e){this.playCount=0,n[1]<n[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=n[0]-n[1],this.timeCompleted=this.totalFrames,this.firstFrame=n[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):n[1]>n[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=n[1]-n[0],this.timeCompleted=this.totalFrames,this.firstFrame=n[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(n,e){var i=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<n?i=n:this.currentRawFrame+this.firstFrame>e&&(i=e-n)),this.firstFrame=n,this.totalFrames=e-n,this.timeCompleted=this.totalFrames,i!==-1&&this.goToAndStop(i,!0)},AnimationItem.prototype.playSegments=function(n,e){if(e&&(this.segments.length=0),_typeof$4(n[0])==="object"){var i,a=n.length;for(i=0;i<a;i+=1)this.segments.push(n[i])}else this.segments.push(n);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(n){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),n&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(n){return this.segments.length?(this.adjustSegment(this.segments.shift(),n),!0):!1},AnimationItem.prototype.destroy=function(n){n&&this.name!==n||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(n){this.currentRawFrame=n,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(n){this.playSpeed=n,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(n){this.playDirection=n<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(n){this.loop=n},AnimationItem.prototype.setVolume=function(n,e){e&&this.name!==e||this.audioController.setVolume(n)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(n){n&&this.name!==n||this.audioController.mute()},AnimationItem.prototype.unmute=function(n){n&&this.name!==n||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(n){var e="";if(n.e)e=n.p;else if(this.assetsPath){var i=n.p;i.indexOf("images/")!==-1&&(i=i.split("/")[1]),e=this.assetsPath+i}else e=this.path,e+=n.u?n.u:"",e+=n.p;return e},AnimationItem.prototype.getAssetData=function(n){for(var e=0,i=this.assets.length;e<i;){if(n===this.assets[e].id)return this.assets[e];e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(n){return n?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(n,e,i){try{var a=this.renderer.getElementByPath(n);a.updateDocumentData(e,i)}catch{}},AnimationItem.prototype.trigger=function(n){if(this._cbs&&this._cbs[n])switch(n){case"enterFrame":this.triggerEvent(n,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(n,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(n,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(n,new BMCompleteEvent(n,this.frameMult));break;case"segmentStart":this.triggerEvent(n,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(n,new BMDestroyEvent(n,this));break;default:this.triggerEvent(n)}n==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameMult)),n==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult)),n==="complete"&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(n,this.frameMult)),n==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames)),n==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(n,this))},AnimationItem.prototype.triggerRenderFrameError=function(n){var e=new BMRenderFrameErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(n){var e=new BMConfigErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var animationManager=function(){var n={},e=[],i=0,a=0,s=0,r=!0,o=!1;function l(b){for(var I=0,V=b.target;I<a;)e[I].animation===V&&(e.splice(I,1),I-=1,a-=1,V.isPaused||p()),I+=1}function u(b,I){if(!b)return null;for(var V=0;V<a;){if(e[V].elem===b&&e[V].elem!==null)return e[V].animation;V+=1}var A=new AnimationItem;return f(A,b),A.setData(b,I),A}function c(){var b,I=e.length,V=[];for(b=0;b<I;b+=1)V.push(e[b].animation);return V}function d(){s+=1,L()}function p(){s-=1}function f(b,I){b.addEventListener("destroy",l),b.addEventListener("_active",d),b.addEventListener("_idle",p),e.push({elem:I,animation:b}),a+=1}function m(b){var I=new AnimationItem;return f(I,null),I.setParams(b),I}function P(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setSpeed(b,I)}function T(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setDirection(b,I)}function x(b){var I;for(I=0;I<a;I+=1)e[I].animation.play(b)}function y(b){var I=b-i,V;for(V=0;V<a;V+=1)e[V].animation.advanceTime(I);i=b,s&&!o?window.requestAnimationFrame(y):r=!0}function S(b){i=b,window.requestAnimationFrame(y)}function g(b){var I;for(I=0;I<a;I+=1)e[I].animation.pause(b)}function C(b,I,V){var A;for(A=0;A<a;A+=1)e[A].animation.goToAndStop(b,I,V)}function E(b){var I;for(I=0;I<a;I+=1)e[I].animation.stop(b)}function B(b){var I;for(I=0;I<a;I+=1)e[I].animation.togglePause(b)}function _(b){var I;for(I=a-1;I>=0;I-=1)e[I].animation.destroy(b)}function M(b,I,V){var A=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),k,R=A.length;for(k=0;k<R;k+=1)V&&A[k].setAttribute("data-bm-type",V),u(A[k],b);if(I&&R===0){V||(V="svg");var G=document.getElementsByTagName("body")[0];G.innerText="";var z=createTag("div");z.style.width="100%",z.style.height="100%",z.setAttribute("data-bm-type",V),G.appendChild(z),u(z,b)}}function D(){var b;for(b=0;b<a;b+=1)e[b].animation.resize()}function L(){!o&&s&&r&&(window.requestAnimationFrame(S),r=!1)}function F(){o=!0}function N(){o=!1,L()}function H(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setVolume(b,I)}function $(b){var I;for(I=0;I<a;I+=1)e[I].animation.mute(b)}function O(b){var I;for(I=0;I<a;I+=1)e[I].animation.unmute(b)}return n.registerAnimation=u,n.loadAnimation=m,n.setSpeed=P,n.setDirection=T,n.play=x,n.pause=g,n.stop=E,n.togglePause=B,n.searchAnimations=M,n.resize=D,n.goToAndStop=C,n.destroy=_,n.freeze=F,n.unfreeze=N,n.setVolume=H,n.mute=$,n.unmute=O,n.getRegisteredAnimations=c,n}(),BezierFactory=function(){var n={};n.getBezierEasing=i;var e={};function i(S,g,C,E,B){var _=B||("bez_"+S+"_"+g+"_"+C+"_"+E).replace(/\./g,"p");if(e[_])return e[_];var M=new y([S,g,C,E]);return e[_]=M,M}var a=4,s=.001,r=1e-7,o=10,l=11,u=1/(l-1),c=typeof Float32Array=="function";function d(S,g){return 1-3*g+3*S}function p(S,g){return 3*g-6*S}function f(S){return 3*S}function m(S,g,C){return((d(g,C)*S+p(g,C))*S+f(g))*S}function P(S,g,C){return 3*d(g,C)*S*S+2*p(g,C)*S+f(g)}function T(S,g,C,E,B){var _,M,D=0;do M=g+(C-g)/2,_=m(M,E,B)-S,_>0?C=M:g=M;while(Math.abs(_)>r&&++D<o);return M}function x(S,g,C,E){for(var B=0;B<a;++B){var _=P(g,C,E);if(_===0)return g;var M=m(g,C,E)-S;g-=M/_}return g}function y(S){this._p=S,this._mSampleValues=c?new Float32Array(l):new Array(l),this._precomputed=!1,this.get=this.get.bind(this)}return y.prototype={get:function(g){var C=this._p[0],E=this._p[1],B=this._p[2],_=this._p[3];return this._precomputed||this._precompute(),C===E&&B===_?g:g===0?0:g===1?1:m(this._getTForX(g),E,_)},_precompute:function(){var g=this._p[0],C=this._p[1],E=this._p[2],B=this._p[3];this._precomputed=!0,(g!==C||E!==B)&&this._calcSampleValues()},_calcSampleValues:function(){for(var g=this._p[0],C=this._p[2],E=0;E<l;++E)this._mSampleValues[E]=m(E*u,g,C)},_getTForX:function(g){for(var C=this._p[0],E=this._p[2],B=this._mSampleValues,_=0,M=1,D=l-1;M!==D&&B[M]<=g;++M)_+=u;--M;var L=(g-B[M])/(B[M+1]-B[M]),F=_+L*u,N=P(F,C,E);return N>=s?x(g,F,C,E):N===0?F:T(g,_,_+u,C,E)}},n}(),pooling=function(){function n(e){return e.concat(createSizedArray(e.length))}return{double:n}}(),poolFactory=function(){return function(n,e,i){var a=0,s=n,r=createSizedArray(s),o={newElement:l,release:u};function l(){var c;return a?(a-=1,c=r[a]):c=e(),c}function u(c){a===s&&(r=pooling.double(r),s*=2),i&&i(c),r[a]=c,a+=1}return o}}(),bezierLengthPool=function(){function n(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,n)}(),segmentsLengthPool=function(){function n(){return{lengths:[],totalLength:0}}function e(i){var a,s=i.lengths.length;for(a=0;a<s;a+=1)bezierLengthPool.release(i.lengths[a]);i.lengths.length=0}return poolFactory(8,n,e)}();function bezFunction(){var n=Math;function e(f,m,P,T,x,y){var S=f*T+m*x+P*y-x*T-y*f-P*m;return S>-.001&&S<.001}function i(f,m,P,T,x,y,S,g,C){if(P===0&&y===0&&C===0)return e(f,m,T,x,S,g);var E=n.sqrt(n.pow(T-f,2)+n.pow(x-m,2)+n.pow(y-P,2)),B=n.sqrt(n.pow(S-f,2)+n.pow(g-m,2)+n.pow(C-P,2)),_=n.sqrt(n.pow(S-T,2)+n.pow(g-x,2)+n.pow(C-y,2)),M;return E>B?E>_?M=E-B-_:M=_-B-E:_>B?M=_-B-E:M=B-E-_,M>-1e-4&&M<1e-4}var a=function(){return function(f,m,P,T){var x=getDefaultCurveSegments(),y,S,g,C,E,B=0,_,M=[],D=[],L=bezierLengthPool.newElement();for(g=P.length,y=0;y<x;y+=1){for(E=y/(x-1),_=0,S=0;S<g;S+=1)C=bmPow(1-E,3)*f[S]+3*bmPow(1-E,2)*E*P[S]+3*(1-E)*bmPow(E,2)*T[S]+bmPow(E,3)*m[S],M[S]=C,D[S]!==null&&(_+=bmPow(M[S]-D[S],2)),D[S]=M[S];_&&(_=bmSqrt(_),B+=_),L.percents[y]=E,L.lengths[y]=B}return L.addedLength=B,L}}();function s(f){var m=segmentsLengthPool.newElement(),P=f.c,T=f.v,x=f.o,y=f.i,S,g=f._length,C=m.lengths,E=0;for(S=0;S<g-1;S+=1)C[S]=a(T[S],T[S+1],x[S],y[S+1]),E+=C[S].addedLength;return P&&g&&(C[S]=a(T[S],T[0],x[S],y[0]),E+=C[S].addedLength),m.totalLength=E,m}function r(f){this.segmentLength=0,this.points=new Array(f)}function o(f,m){this.partialLength=f,this.point=m}var l=function(){var f={};return function(m,P,T,x){var y=(m[0]+"_"+m[1]+"_"+P[0]+"_"+P[1]+"_"+T[0]+"_"+T[1]+"_"+x[0]+"_"+x[1]).replace(/\./g,"p");if(!f[y]){var S=getDefaultCurveSegments(),g,C,E,B,_,M=0,D,L,F=null;m.length===2&&(m[0]!==P[0]||m[1]!==P[1])&&e(m[0],m[1],P[0],P[1],m[0]+T[0],m[1]+T[1])&&e(m[0],m[1],P[0],P[1],P[0]+x[0],P[1]+x[1])&&(S=2);var N=new r(S);for(E=T.length,g=0;g<S;g+=1){for(L=createSizedArray(E),_=g/(S-1),D=0,C=0;C<E;C+=1)B=bmPow(1-_,3)*m[C]+3*bmPow(1-_,2)*_*(m[C]+T[C])+3*(1-_)*bmPow(_,2)*(P[C]+x[C])+bmPow(_,3)*P[C],L[C]=B,F!==null&&(D+=bmPow(L[C]-F[C],2));D=bmSqrt(D),M+=D,N.points[g]=new o(D,L),F=L}N.segmentLength=M,f[y]=N}return f[y]}}();function u(f,m){var P=m.percents,T=m.lengths,x=P.length,y=bmFloor((x-1)*f),S=f*m.addedLength,g=0;if(y===x-1||y===0||S===T[y])return P[y];for(var C=T[y]>S?-1:1,E=!0;E;)if(T[y]<=S&&T[y+1]>S?(g=(S-T[y])/(T[y+1]-T[y]),E=!1):y+=C,y<0||y>=x-1){if(y===x-1)return P[y];E=!1}return P[y]+(P[y+1]-P[y])*g}function c(f,m,P,T,x,y){var S=u(x,y),g=1-S,C=n.round((g*g*g*f[0]+(S*g*g+g*S*g+g*g*S)*P[0]+(S*S*g+g*S*S+S*g*S)*T[0]+S*S*S*m[0])*1e3)/1e3,E=n.round((g*g*g*f[1]+(S*g*g+g*S*g+g*g*S)*P[1]+(S*S*g+g*S*S+S*g*S)*T[1]+S*S*S*m[1])*1e3)/1e3;return[C,E]}var d=createTypedArray("float32",8);function p(f,m,P,T,x,y,S){x<0?x=0:x>1&&(x=1);var g=u(x,S);y=y>1?1:y;var C=u(y,S),E,B=f.length,_=1-g,M=1-C,D=_*_*_,L=g*_*_*3,F=g*g*_*3,N=g*g*g,H=_*_*M,$=g*_*M+_*g*M+_*_*C,O=g*g*M+_*g*C+g*_*C,b=g*g*C,I=_*M*M,V=g*M*M+_*C*M+_*M*C,A=g*C*M+_*C*C+g*M*C,k=g*C*C,R=M*M*M,G=C*M*M+M*C*M+M*M*C,z=C*C*M+M*C*C+C*M*C,q=C*C*C;for(E=0;E<B;E+=1)d[E*4]=n.round((D*f[E]+L*P[E]+F*T[E]+N*m[E])*1e3)/1e3,d[E*4+1]=n.round((H*f[E]+$*P[E]+O*T[E]+b*m[E])*1e3)/1e3,d[E*4+2]=n.round((I*f[E]+V*P[E]+A*T[E]+k*m[E])*1e3)/1e3,d[E*4+3]=n.round((R*f[E]+G*P[E]+z*T[E]+q*m[E])*1e3)/1e3;return d}return{getSegmentsLength:s,getNewSegment:p,getPointInSegment:c,buildBezierData:l,pointOnLine2D:e,pointOnLine3D:i}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(n,e){var i=this.offsetTime,a;this.propType==="multidimensional"&&(a=createTypedArray("float32",this.pv.length));for(var s=e.lastIndex,r=s,o=this.keyframes.length-1,l=!0,u,c,d;l;){if(u=this.keyframes[r],c=this.keyframes[r+1],r===o-1&&n>=c.t-i){u.h&&(u=c),s=0;break}if(c.t-i>n){s=r;break}r<o-1?r+=1:(s=0,l=!1)}d=this.keyframesMetadata[r]||{};var p,f,m,P,T,x,y=c.t-i,S=u.t-i,g;if(u.to){d.bezierData||(d.bezierData=bez.buildBezierData(u.s,c.s||u.e,u.to,u.ti));var C=d.bezierData;if(n>=y||n<S){var E=n>=y?C.points.length-1:0;for(f=C.points[E].point.length,p=0;p<f;p+=1)a[p]=C.points[E].point[p]}else{d.__fnct?x=d.__fnct:(x=BezierFactory.getBezierEasing(u.o.x,u.o.y,u.i.x,u.i.y,u.n).get,d.__fnct=x),m=x((n-S)/(y-S));var B=C.segmentLength*m,_,M=e.lastFrame<n&&e._lastKeyframeIndex===r?e._lastAddedLength:0;for(T=e.lastFrame<n&&e._lastKeyframeIndex===r?e._lastPoint:0,l=!0,P=C.points.length;l;){if(M+=C.points[T].partialLength,B===0||m===0||T===C.points.length-1){for(f=C.points[T].point.length,p=0;p<f;p+=1)a[p]=C.points[T].point[p];break}else if(B>=M&&B<M+C.points[T+1].partialLength){for(_=(B-M)/C.points[T+1].partialLength,f=C.points[T].point.length,p=0;p<f;p+=1)a[p]=C.points[T].point[p]+(C.points[T+1].point[p]-C.points[T].point[p])*_;break}T<P-1?T+=1:l=!1}e._lastPoint=T,e._lastAddedLength=M-C.points[T].partialLength,e._lastKeyframeIndex=r}}else{var D,L,F,N,H;if(o=u.s.length,g=c.s||u.e,this.sh&&u.h!==1)if(n>=y)a[0]=g[0],a[1]=g[1],a[2]=g[2];else if(n<=S)a[0]=u.s[0],a[1]=u.s[1],a[2]=u.s[2];else{var $=createQuaternion(u.s),O=createQuaternion(g),b=(n-S)/(y-S);quaternionToEuler(a,slerp($,O,b))}else for(r=0;r<o;r+=1)u.h!==1&&(n>=y?m=1:n<S?m=0:(u.o.x.constructor===Array?(d.__fnct||(d.__fnct=[]),d.__fnct[r]?x=d.__fnct[r]:(D=u.o.x[r]===void 0?u.o.x[0]:u.o.x[r],L=u.o.y[r]===void 0?u.o.y[0]:u.o.y[r],F=u.i.x[r]===void 0?u.i.x[0]:u.i.x[r],N=u.i.y[r]===void 0?u.i.y[0]:u.i.y[r],x=BezierFactory.getBezierEasing(D,L,F,N).get,d.__fnct[r]=x)):d.__fnct?x=d.__fnct:(D=u.o.x,L=u.o.y,F=u.i.x,N=u.i.y,x=BezierFactory.getBezierEasing(D,L,F,N).get,u.keyframeMetadata=x),m=x((n-S)/(y-S)))),g=c.s||u.e,H=u.h===1?u.s[r]:u.s[r]+(g[r]-u.s[r])*m,this.propType==="multidimensional"?a[r]=H:a=H}return e.lastIndex=s,a}function slerp(n,e,i){var a=[],s=n[0],r=n[1],o=n[2],l=n[3],u=e[0],c=e[1],d=e[2],p=e[3],f,m,P,T,x;return m=s*u+r*c+o*d+l*p,m<0&&(m=-m,u=-u,c=-c,d=-d,p=-p),1-m>1e-6?(f=Math.acos(m),P=Math.sin(f),T=Math.sin((1-i)*f)/P,x=Math.sin(i*f)/P):(T=1-i,x=i),a[0]=T*s+x*u,a[1]=T*r+x*c,a[2]=T*o+x*d,a[3]=T*l+x*p,a}function quaternionToEuler(n,e){var i=e[0],a=e[1],s=e[2],r=e[3],o=Math.atan2(2*a*r-2*i*s,1-2*a*a-2*s*s),l=Math.asin(2*i*a+2*s*r),u=Math.atan2(2*i*r-2*a*s,1-2*i*i-2*s*s);n[0]=o/degToRads,n[1]=l/degToRads,n[2]=u/degToRads}function createQuaternion(n){var e=n[0]*degToRads,i=n[1]*degToRads,a=n[2]*degToRads,s=Math.cos(e/2),r=Math.cos(i/2),o=Math.cos(a/2),l=Math.sin(e/2),u=Math.sin(i/2),c=Math.sin(a/2),d=s*r*o-l*u*c,p=l*u*o+s*r*c,f=l*r*o+s*u*c,m=s*u*o-l*r*c;return[p,f,m,d]}function getValueAtCurrentTime(){var n=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,i=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(n===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=i&&n>=i||this._caching.lastFrame<e&&n<e))){this._caching.lastFrame>=n&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var a=this.interpolateValue(n,this._caching);this.pv=a}return this._caching.lastFrame=n,this.pv}function setVValue(n){var e;if(this.propType==="unidimensional")e=n*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var i=0,a=this.v.length;i<a;)e=n[i]*this.mult,mathAbs(this.v[i]-e)>1e-5&&(this.v[i]=e,this._mdf=!0),i+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var n,e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(n=0;n<e;n+=1)i=this.effectsSequence[n](i);this.setVValue(i),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(n){this.effectsSequence.push(n),this.container.addDynamicProperty(this)}function ValueProperty(n,e,i,a){this.propType="unidimensional",this.mult=i||1,this.data=e,this.v=i?e.k*i:e.k,this.pv=e.k,this._mdf=!1,this.elem=n,this.container=a,this.comp=n.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(n,e,i,a){this.propType="multidimensional",this.mult=i||1,this.data=e,this._mdf=!1,this.elem=n,this.container=a,this.comp=n.comp,this.k=!1,this.kf=!1,this.frameId=-1;var s,r=e.k.length;for(this.v=createTypedArray("float32",r),this.pv=createTypedArray("float32",r),this.vel=createTypedArray("float32",r),s=0;s<r;s+=1)this.v[s]=e.k[s]*this.mult,this.pv[s]=e.k[s];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(n,e,i,a){this.propType="unidimensional",this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=i||1,this.elem=n,this.container=a,this.comp=n.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(n,e,i,a){this.propType="multidimensional";var s,r=e.k.length,o,l,u,c;for(s=0;s<r-1;s+=1)e.k[s].to&&e.k[s].s&&e.k[s+1]&&e.k[s+1].s&&(o=e.k[s].s,l=e.k[s+1].s,u=e.k[s].to,c=e.k[s].ti,(o.length===2&&!(o[0]===l[0]&&o[1]===l[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],o[0]+u[0],o[1]+u[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],l[0]+c[0],l[1]+c[1])||o.length===3&&!(o[0]===l[0]&&o[1]===l[1]&&o[2]===l[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],o[0]+u[0],o[1]+u[1],o[2]+u[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],l[0]+c[0],l[1]+c[1],l[2]+c[2]))&&(e.k[s].to=null,e.k[s].ti=null),o[0]===l[0]&&o[1]===l[1]&&u[0]===0&&u[1]===0&&c[0]===0&&c[1]===0&&(o.length===2||o[2]===l[2]&&u[2]===0&&c[2]===0)&&(e.k[s].to=null,e.k[s].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=i||1,this.elem=n,this.container=a,this.comp=n.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var d=e.k[0].s.length;for(this.v=createTypedArray("float32",d),this.pv=createTypedArray("float32",d),s=0;s<d;s+=1)this.v[s]=initFrame,this.pv[s]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",d)},this.addEffect=addEffect}var PropertyFactory=function(){function n(i,a,s,r,o){a.sid&&(a=i.globalData.slotManager.getProp(a));var l;if(!a.k.length)l=new ValueProperty(i,a,r,o);else if(typeof a.k[0]=="number")l=new MultiDimensionalProperty(i,a,r,o);else switch(s){case 0:l=new KeyframedValueProperty(i,a,r,o);break;case 1:l=new KeyframedMultidimensionalProperty(i,a,r,o);break}return l.effectsSequence.length&&o.addDynamicProperty(l),l}var e={getProp:n};return e}();function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&(this.dynamicProperties.push(e),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var e,i=this.dynamicProperties.length;for(e=0;e<i;e+=1)this.dynamicProperties[e].getValue(),this.dynamicProperties[e]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(e){this.container=e,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=function(){function n(){return createTypedArray("float32",2)}return poolFactory(8,n)}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(n,e){this.c=n,this.setLength(e);for(var i=0;i<e;)this.v[i]=pointPool.newElement(),this.o[i]=pointPool.newElement(),this.i[i]=pointPool.newElement(),i+=1},ShapePath.prototype.setLength=function(n){for(;this._maxLength<n;)this.doubleArrayLength();this._length=n},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(n,e,i,a,s){var r;switch(this._length=Math.max(this._length,a+1),this._length>=this._maxLength&&this.doubleArrayLength(),i){case"v":r=this.v;break;case"i":r=this.i;break;case"o":r=this.o;break;default:r=[];break}(!r[a]||r[a]&&!s)&&(r[a]=pointPool.newElement()),r[a][0]=n,r[a][1]=e},ShapePath.prototype.setTripleAt=function(n,e,i,a,s,r,o,l){this.setXYAt(n,e,"v",o,l),this.setXYAt(i,a,"o",o,l),this.setXYAt(s,r,"i",o,l)},ShapePath.prototype.reverse=function(){var n=new ShapePath;n.setPathData(this.c,this._length);var e=this.v,i=this.o,a=this.i,s=0;this.c&&(n.setTripleAt(e[0][0],e[0][1],a[0][0],a[0][1],i[0][0],i[0][1],0,!1),s=1);var r=this._length-1,o=this._length,l;for(l=s;l<o;l+=1)n.setTripleAt(e[r][0],e[r][1],a[r][0],a[r][1],i[r][0],i[r][1],l,!1),r-=1;return n},ShapePath.prototype.length=function(){return this._length};var shapePool=function(){function n(){return new ShapePath}function e(s){var r=s._length,o;for(o=0;o<r;o+=1)pointPool.release(s.v[o]),pointPool.release(s.i[o]),pointPool.release(s.o[o]),s.v[o]=null,s.i[o]=null,s.o[o]=null;s._length=0,s.c=!1}function i(s){var r=a.newElement(),o,l=s._length===void 0?s.v.length:s._length;for(r.setLength(l),r.c=s.c,o=0;o<l;o+=1)r.setTripleAt(s.v[o][0],s.v[o][1],s.o[o][0],s.o[o][1],s.i[o][0],s.i[o][1],o);return r}var a=poolFactory(4,n,e);return a.clone=i,a}();function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(n){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=n,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var n;for(n=0;n<this._length;n+=1)shapePool.release(this.shapes[n]);this._length=0};var shapeCollectionPool=function(){var n={newShapeCollection:s,release:r},e=0,i=4,a=createSizedArray(i);function s(){var o;return e?(e-=1,o=a[e]):o=new ShapeCollection,o}function r(o){var l,u=o._length;for(l=0;l<u;l+=1)shapePool.release(o.shapes[l]);o._length=0,e===i&&(a=pooling.double(a),i*=2),a[e]=o,e+=1}return n}(),ShapePropertyFactory=function(){var n=-999999;function e(y,S,g){var C=g.lastIndex,E,B,_,M,D,L,F,N,H,$=this.keyframes;if(y<$[0].t-this.offsetTime)E=$[0].s[0],_=!0,C=0;else if(y>=$[$.length-1].t-this.offsetTime)E=$[$.length-1].s?$[$.length-1].s[0]:$[$.length-2].e[0],_=!0;else{for(var O=C,b=$.length-1,I=!0,V,A,k;I&&(V=$[O],A=$[O+1],!(A.t-this.offsetTime>y));)O<b-1?O+=1:I=!1;if(k=this.keyframesMetadata[O]||{},_=V.h===1,C=O,!_){if(y>=A.t-this.offsetTime)N=1;else if(y<V.t-this.offsetTime)N=0;else{var R;k.__fnct?R=k.__fnct:(R=BezierFactory.getBezierEasing(V.o.x,V.o.y,V.i.x,V.i.y).get,k.__fnct=R),N=R((y-(V.t-this.offsetTime))/(A.t-this.offsetTime-(V.t-this.offsetTime)))}B=A.s?A.s[0]:V.e[0]}E=V.s[0]}for(L=S._length,F=E.i[0].length,g.lastIndex=C,M=0;M<L;M+=1)for(D=0;D<F;D+=1)H=_?E.i[M][D]:E.i[M][D]+(B.i[M][D]-E.i[M][D])*N,S.i[M][D]=H,H=_?E.o[M][D]:E.o[M][D]+(B.o[M][D]-E.o[M][D])*N,S.o[M][D]=H,H=_?E.v[M][D]:E.v[M][D]+(B.v[M][D]-E.v[M][D])*N,S.v[M][D]=H}function i(){var y=this.comp.renderedFrame-this.offsetTime,S=this.keyframes[0].t-this.offsetTime,g=this.keyframes[this.keyframes.length-1].t-this.offsetTime,C=this._caching.lastFrame;return C!==n&&(C<S&&y<S||C>g&&y>g)||(this._caching.lastIndex=C<y?this._caching.lastIndex:0,this.interpolateShape(y,this.pv,this._caching)),this._caching.lastFrame=y,this.pv}function a(){this.paths=this.localShapeCollection}function s(y,S){if(y._length!==S._length||y.c!==S.c)return!1;var g,C=y._length;for(g=0;g<C;g+=1)if(y.v[g][0]!==S.v[g][0]||y.v[g][1]!==S.v[g][1]||y.o[g][0]!==S.o[g][0]||y.o[g][1]!==S.o[g][1]||y.i[g][0]!==S.i[g][0]||y.i[g][1]!==S.i[g][1])return!1;return!0}function r(y){s(this.v,y)||(this.v=shapePool.clone(y),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function o(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var y;this.kf?y=this.pv:this.data.ks?y=this.data.ks.k:y=this.data.pt.k;var S,g=this.effectsSequence.length;for(S=0;S<g;S+=1)y=this.effectsSequence[S](y);this.setVValue(y),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function l(y,S,g){this.propType="shape",this.comp=y.comp,this.container=y,this.elem=y,this.data=S,this.k=!1,this.kf=!1,this._mdf=!1;var C=g===3?S.pt.k:S.ks.k;this.v=shapePool.clone(C),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=a,this.effectsSequence=[]}function u(y){this.effectsSequence.push(y),this.container.addDynamicProperty(this)}l.prototype.interpolateShape=e,l.prototype.getValue=o,l.prototype.setVValue=r,l.prototype.addEffect=u;function c(y,S,g){this.propType="shape",this.comp=y.comp,this.elem=y,this.container=y,this.offsetTime=y.data.st,this.keyframes=g===3?S.pt.k:S.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var C=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,C),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=n,this.reset=a,this._caching={lastFrame:n,lastIndex:0},this.effectsSequence=[i.bind(this)]}c.prototype.getValue=o,c.prototype.interpolateShape=e,c.prototype.setVValue=r,c.prototype.addEffect=u;var d=function(){var y=roundCorner;function S(g,C){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=C.d,this.elem=g,this.comp=g.comp,this.frameId=-1,this.initDynamicPropertyContainer(g),this.p=PropertyFactory.getProp(g,C.p,1,0,this),this.s=PropertyFactory.getProp(g,C.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return S.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var C=this.p.v[0],E=this.p.v[1],B=this.s.v[0]/2,_=this.s.v[1]/2,M=this.d!==3,D=this.v;D.v[0][0]=C,D.v[0][1]=E-_,D.v[1][0]=M?C+B:C-B,D.v[1][1]=E,D.v[2][0]=C,D.v[2][1]=E+_,D.v[3][0]=M?C-B:C+B,D.v[3][1]=E,D.i[0][0]=M?C-B*y:C+B*y,D.i[0][1]=E-_,D.i[1][0]=M?C+B:C-B,D.i[1][1]=E-_*y,D.i[2][0]=M?C+B*y:C-B*y,D.i[2][1]=E+_,D.i[3][0]=M?C-B:C+B,D.i[3][1]=E+_*y,D.o[0][0]=M?C+B*y:C-B*y,D.o[0][1]=E-_,D.o[1][0]=M?C+B:C-B,D.o[1][1]=E+_*y,D.o[2][0]=M?C-B*y:C+B*y,D.o[2][1]=E+_,D.o[3][0]=M?C-B:C+B,D.o[3][1]=E-_*y}},extendPrototype([DynamicPropertyContainer],S),S}(),p=function(){function y(S,g){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=S,this.comp=S.comp,this.data=g,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(S),g.sy===1?(this.ir=PropertyFactory.getProp(S,g.ir,0,0,this),this.is=PropertyFactory.getProp(S,g.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(S,g.pt,0,0,this),this.p=PropertyFactory.getProp(S,g.p,1,0,this),this.r=PropertyFactory.getProp(S,g.r,0,degToRads,this),this.or=PropertyFactory.getProp(S,g.or,0,0,this),this.os=PropertyFactory.getProp(S,g.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return y.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var g=Math.floor(this.pt.v)*2,C=Math.PI*2/g,E=!0,B=this.or.v,_=this.ir.v,M=this.os.v,D=this.is.v,L=2*Math.PI*B/(g*2),F=2*Math.PI*_/(g*2),N,H,$,O,b=-Math.PI/2;b+=this.r.v;var I=this.data.d===3?-1:1;for(this.v._length=0,N=0;N<g;N+=1){H=E?B:_,$=E?M:D,O=E?L:F;var V=H*Math.cos(b),A=H*Math.sin(b),k=V===0&&A===0?0:A/Math.sqrt(V*V+A*A),R=V===0&&A===0?0:-V/Math.sqrt(V*V+A*A);V+=+this.p.v[0],A+=+this.p.v[1],this.v.setTripleAt(V,A,V-k*O*$*I,A-R*O*$*I,V+k*O*$*I,A+R*O*$*I,N,!0),E=!E,b+=C*I}},convertPolygonToPath:function(){var g=Math.floor(this.pt.v),C=Math.PI*2/g,E=this.or.v,B=this.os.v,_=2*Math.PI*E/(g*4),M,D=-Math.PI*.5,L=this.data.d===3?-1:1;for(D+=this.r.v,this.v._length=0,M=0;M<g;M+=1){var F=E*Math.cos(D),N=E*Math.sin(D),H=F===0&&N===0?0:N/Math.sqrt(F*F+N*N),$=F===0&&N===0?0:-F/Math.sqrt(F*F+N*N);F+=+this.p.v[0],N+=+this.p.v[1],this.v.setTripleAt(F,N,F-H*_*B*L,N-$*_*B*L,F+H*_*B*L,N+$*_*B*L,M,!0),D+=C*L}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],y),y}(),f=function(){function y(S,g){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=S,this.comp=S.comp,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(S),this.p=PropertyFactory.getProp(S,g.p,1,0,this),this.s=PropertyFactory.getProp(S,g.s,1,0,this),this.r=PropertyFactory.getProp(S,g.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return y.prototype={convertRectToPath:function(){var g=this.p.v[0],C=this.p.v[1],E=this.s.v[0]/2,B=this.s.v[1]/2,_=bmMin(E,B,this.r.v),M=_*(1-roundCorner);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(g+E,C-B+_,g+E,C-B+_,g+E,C-B+M,0,!0),this.v.setTripleAt(g+E,C+B-_,g+E,C+B-M,g+E,C+B-_,1,!0),_!==0?(this.v.setTripleAt(g+E-_,C+B,g+E-_,C+B,g+E-M,C+B,2,!0),this.v.setTripleAt(g-E+_,C+B,g-E+M,C+B,g-E+_,C+B,3,!0),this.v.setTripleAt(g-E,C+B-_,g-E,C+B-_,g-E,C+B-M,4,!0),this.v.setTripleAt(g-E,C-B+_,g-E,C-B+M,g-E,C-B+_,5,!0),this.v.setTripleAt(g-E+_,C-B,g-E+_,C-B,g-E+M,C-B,6,!0),this.v.setTripleAt(g+E-_,C-B,g+E-M,C-B,g+E-_,C-B,7,!0)):(this.v.setTripleAt(g-E,C+B,g-E+M,C+B,g-E,C+B,2),this.v.setTripleAt(g-E,C-B,g-E,C-B+M,g-E,C-B,3))):(this.v.setTripleAt(g+E,C-B+_,g+E,C-B+M,g+E,C-B+_,0,!0),_!==0?(this.v.setTripleAt(g+E-_,C-B,g+E-_,C-B,g+E-M,C-B,1,!0),this.v.setTripleAt(g-E+_,C-B,g-E+M,C-B,g-E+_,C-B,2,!0),this.v.setTripleAt(g-E,C-B+_,g-E,C-B+_,g-E,C-B+M,3,!0),this.v.setTripleAt(g-E,C+B-_,g-E,C+B-M,g-E,C+B-_,4,!0),this.v.setTripleAt(g-E+_,C+B,g-E+_,C+B,g-E+M,C+B,5,!0),this.v.setTripleAt(g+E-_,C+B,g+E-M,C+B,g+E-_,C+B,6,!0),this.v.setTripleAt(g+E,C+B-_,g+E,C+B-_,g+E,C+B-M,7,!0)):(this.v.setTripleAt(g-E,C-B,g-E+M,C-B,g-E,C-B,1,!0),this.v.setTripleAt(g-E,C+B,g-E,C+B-M,g-E,C+B,2,!0),this.v.setTripleAt(g+E,C+B,g+E-M,C+B,g+E,C+B,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:a},extendPrototype([DynamicPropertyContainer],y),y}();function m(y,S,g){var C;if(g===3||g===4){var E=g===3?S.pt:S.ks,B=E.k;B.length?C=new c(y,S,g):C=new l(y,S,g)}else g===5?C=new f(y,S):g===6?C=new d(y,S):g===7&&(C=new p(y,S));return C.k&&y.addDynamicProperty(C),C}function P(){return l}function T(){return c}var x={};return x.getShapeProp=m,x.getConstructorFunction=P,x.getKeyframedConstructorFunction=T,x}();/*!
|
|
149
|
+
*/const X=createLucideIcon("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),claraLogo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2074%2019'%3e%3cpath%20d='M%2061.697%2019.219%20C%2060.922%2019.219%2060.192%2019.149%2059.505%2019.008%20C%2058.819%2018.885%2058.211%2018.674%2057.683%2018.374%20C%2057.155%2018.057%2056.741%2017.653%2056.442%2017.16%20C%2056.161%2016.649%2056.02%2016.024%2056.02%2015.285%20C%2056.02%2014.141%2056.337%2013.26%2056.97%2012.644%20C%2057.604%2012.011%2058.484%2011.553%2059.611%2011.271%20C%2060.755%2010.99%2062.075%2010.822%2063.572%2010.77%20C%2065.086%2010.699%2066.714%2010.664%2068.457%2010.664%20L%2068.457%209.845%20C%2068.457%209.053%2068.307%208.437%2068.008%207.997%20C%2067.708%207.539%2067.216%207.222%2066.529%207.046%20C%2065.842%206.853%2064.91%206.756%2063.73%206.756%20C%2062.727%206.756%2061.89%206.844%2061.222%207.02%20C%2060.57%207.178%2060.077%207.407%2059.743%207.707%20C%2059.408%207.988%2059.241%208.323%2059.241%208.71%20L%2059.241%209.185%20L%2056.68%209.185%20C%2056.662%209.115%2056.645%209.044%2056.627%208.974%20C%2056.627%208.886%2056.627%208.789%2056.627%208.683%20C%2056.627%207.839%2056.9%207.126%2057.446%206.545%20C%2058.009%205.946%2058.836%205.488%2059.928%205.172%20C%2061.019%204.837%2062.383%204.67%2064.021%204.67%20C%2065.57%204.67%2066.863%204.819%2067.902%205.119%20C%2068.941%205.418%2069.724%205.92%2070.252%206.624%20C%2070.78%207.31%2071.044%208.252%2071.044%209.449%20L%2071.044%2016.103%20C%2071.044%2016.455%2071.106%2016.72%2071.229%2016.896%20C%2071.352%2017.054%2071.59%2017.133%2071.942%2017.133%20L%2073.262%2017.133%20L%2073.262%2018.823%20C%2072.998%2018.911%2072.664%2018.99%2072.259%2019.061%20C%2071.872%2019.149%2071.484%2019.193%2071.097%2019.193%20C%2070.411%2019.193%2069.891%2019.087%2069.539%2018.876%20C%2069.187%2018.665%2068.941%2018.374%2068.8%2018.005%20C%2068.677%2017.635%2068.597%2017.221%2068.562%2016.764%20L%2068.377%2016.764%20C%2067.884%2017.292%2067.277%2017.741%2066.555%2018.11%20C%2065.851%2018.48%2065.077%2018.753%2064.232%2018.929%20C%2063.404%2019.122%2062.559%2019.219%2061.697%2019.219%20Z%20M%2062.199%2017.133%20C%2062.903%2017.133%2063.616%2017.054%2064.337%2016.896%20C%2065.077%2016.72%2065.754%2016.473%2066.371%2016.156%20C%2067.004%2015.839%2067.506%2015.461%2067.876%2015.021%20C%2068.263%2014.581%2068.457%2014.088%2068.457%2013.542%20L%2068.457%2012.459%20C%2066.274%2012.459%2064.452%2012.53%2062.991%2012.671%20C%2061.547%2012.794%2060.465%2013.049%2059.743%2013.437%20C%2059.021%2013.824%2058.66%2014.413%2058.66%2015.206%20C%2058.66%2015.716%2058.827%2016.112%2059.162%2016.394%20C%2059.514%2016.658%2059.963%2016.852%2060.509%2016.975%20C%2061.072%2017.08%2061.635%2017.133%2062.199%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2047.17%2018.902%20L%2047.17%204.987%20L%2049.23%204.987%20L%2049.441%207.601%20L%2049.626%207.601%20C%2049.749%207.178%2049.969%206.747%2050.286%206.307%20C%2050.621%205.849%2051.061%205.462%2051.607%205.145%20C%2052.17%204.828%2052.839%204.67%2053.613%204.67%20C%2053.913%204.67%2054.203%204.696%2054.485%204.749%20C%2054.784%204.784%2055.048%204.837%2055.277%204.908%20L%2055.277%207.152%20L%2053.877%207.152%20C%2053.085%207.152%2052.416%207.302%2051.871%207.601%20C%2051.342%207.9%2050.92%208.287%2050.603%208.763%20C%2050.304%209.238%2050.084%209.757%2049.943%2010.321%20C%2049.82%2010.866%2049.758%2011.394%2049.758%2011.905%20L%2049.758%2018.902%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2033.52%2019.219%20C%2032.745%2019.219%2032.015%2019.149%2031.328%2019.008%20C%2030.642%2018.885%2030.034%2018.674%2029.506%2018.374%20C%2028.978%2018.057%2028.564%2017.653%2028.265%2017.16%20C%2027.984%2016.649%2027.843%2016.024%2027.843%2015.285%20C%2027.843%2014.141%2028.16%2013.26%2028.793%2012.644%20C%2029.427%2012.011%2030.307%2011.553%2031.434%2011.271%20C%2032.578%2010.99%2033.898%2010.822%2035.395%2010.77%20C%2036.909%2010.699%2038.537%2010.664%2040.28%2010.664%20L%2040.28%209.845%20C%2040.28%209.053%2040.13%208.437%2039.831%207.997%20C%2039.531%207.539%2039.039%207.222%2038.352%207.046%20C%2037.665%206.853%2036.732%206.756%2035.553%206.756%20C%2034.55%206.756%2033.713%206.844%2033.045%207.02%20C%2032.393%207.178%2031.9%207.407%2031.566%207.707%20C%2031.231%207.988%2031.064%208.323%2031.064%208.71%20L%2031.064%209.185%20L%2028.503%209.185%20C%2028.485%209.115%2028.468%209.044%2028.45%208.974%20C%2028.45%208.886%2028.45%208.789%2028.45%208.683%20C%2028.45%207.839%2028.723%207.126%2029.269%206.545%20C%2029.832%205.946%2030.659%205.488%2031.751%205.172%20C%2032.842%204.837%2034.206%204.67%2035.844%204.67%20C%2037.393%204.67%2038.686%204.819%2039.725%205.119%20C%2040.764%205.418%2041.547%205.92%2042.075%206.624%20C%2042.603%207.31%2042.867%208.252%2042.867%209.449%20L%2042.867%2016.103%20C%2042.867%2016.455%2042.929%2016.72%2043.052%2016.896%20C%2043.175%2017.054%2043.413%2017.133%2043.765%2017.133%20L%2045.085%2017.133%20L%2045.085%2018.823%20C%2044.821%2018.911%2044.487%2018.99%2044.082%2019.061%20C%2043.695%2019.149%2043.307%2019.193%2042.92%2019.193%20C%2042.234%2019.193%2041.714%2019.087%2041.362%2018.876%20C%2041.01%2018.665%2040.764%2018.374%2040.623%2018.005%20C%2040.5%2017.635%2040.42%2017.221%2040.385%2016.764%20L%2040.2%2016.764%20C%2039.707%2017.292%2039.1%2017.741%2038.378%2018.11%20C%2037.674%2018.48%2036.9%2018.753%2036.055%2018.929%20C%2035.227%2019.122%2034.382%2019.219%2033.52%2019.219%20Z%20M%2034.022%2017.133%20C%2034.726%2017.133%2035.439%2017.054%2036.16%2016.896%20C%2036.9%2016.72%2037.577%2016.473%2038.194%2016.156%20C%2038.827%2015.839%2039.329%2015.461%2039.699%2015.021%20C%2040.086%2014.581%2040.28%2014.088%2040.28%2013.542%20L%2040.28%2012.459%20C%2038.097%2012.459%2036.275%2012.53%2034.814%2012.671%20C%2033.37%2012.794%2032.288%2013.049%2031.566%2013.437%20C%2030.844%2013.824%2030.483%2014.413%2030.483%2015.206%20C%2030.483%2015.716%2030.65%2016.112%2030.985%2016.394%20C%2031.337%2016.658%2031.786%2016.852%2032.332%2016.975%20C%2032.895%2017.08%2033.458%2017.133%2034.022%2017.133%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2023.105%2018.903%20L%2023.105%20-0.215%20L%2025.692%20-0.215%20L%2025.692%2018.903%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3cpath%20d='M%2010.853%2019.219%20C%208.494%2019.219%206.504%2018.867%204.885%2018.163%20C%203.265%2017.441%202.042%2016.385%201.215%2014.994%20C%200.405%2013.586%200%2011.861%200%209.819%20C%200%206.826%200.933%204.52%202.799%202.901%20C%204.665%201.263%207.332%200.445%2010.8%200.445%20C%2012.824%200.445%2014.602%200.709%2016.134%201.237%20C%2017.665%201.765%2018.853%202.557%2019.698%203.614%20C%2020.561%204.652%2020.992%205.946%2020.992%207.495%20L%2018.167%207.495%20C%2018.167%206.404%2017.859%205.524%2017.243%204.855%20C%2016.626%204.168%2015.755%203.675%2014.628%203.376%20C%2013.52%203.059%2012.226%202.901%2010.747%202.901%20C%209.215%202.901%207.86%203.147%206.681%203.64%20C%205.501%204.115%204.577%204.846%203.908%205.832%20C%203.257%206.8%202.931%208.014%202.931%209.476%20L%202.931%2010.136%20C%202.931%2011.667%203.265%2012.926%203.934%2013.912%20C%204.603%2014.88%205.527%2015.602%206.707%2016.077%20C%207.904%2016.552%209.286%2016.79%2010.853%2016.79%20C%2012.349%2016.79%2013.652%2016.631%2014.761%2016.315%20C%2015.87%2015.98%2016.723%2015.478%2017.322%2014.809%20C%2017.938%2014.123%2018.246%2013.26%2018.246%2012.222%20L%2021.019%2012.222%20C%2021.019%2013.753%2020.587%2015.038%2019.725%2016.077%20C%2018.862%2017.116%2017.665%2017.899%2016.134%2018.427%20C%2014.62%2018.955%2012.859%2019.219%2010.853%2019.219%20Z'%20fill='rgb(42,66,118)'%3e%3c/path%3e%3c/svg%3e",createStoreImpl=n=>{let e;const i=new Set,a=(c,d)=>{const p=typeof c=="function"?c(e):c;if(!Object.is(p,e)){const f=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),i.forEach(m=>m(e,f))}},s=()=>e,l={setState:a,getState:s,getInitialState:()=>u,subscribe:c=>(i.add(c),()=>i.delete(c))},u=e=n(a,s,l);return l},createStore=n=>n?createStoreImpl(n):createStoreImpl,identity=n=>n;function useStore(n,e=identity){const i=React.useSyncExternalStore(n.subscribe,React.useCallback(()=>e(n.getState()),[n,e]),React.useCallback(()=>e(n.getInitialState()),[n,e]));return React.useDebugValue(i),i}const createImpl=n=>{const e=createStore(n),i=a=>useStore(e,a);return Object.assign(i,e),i},create=n=>n?createImpl(n):createImpl,initialState={config:{apiKey:null,templateId:null,analysisId:null,primaryColor:"#8b5cf6",position:"bottom-right",autoOpen:!1,demoTemplate:"audiometria",geminiApiKey:void 0,lang:"es"},isAuthenticated:!1,accessToken:null,userProfile:null,templates:[],currentTemplate:null,currentAnalysis:null,isConnected:!1,isPaused:!1,isAutopilot:!1,speechSpeed:"fast",voiceStyle:"formal",remoteSessionActive:!1,remoteSessionInfo:null,userStreamInfo:null,analysisStreamInfo:null,isS2Connected:!1,formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",usageStats:null},useClaraStore=create((n,e)=>({...initialState,setConfig:i=>n(a=>({config:{...a.config,...i},isAuthenticated:i.apiKey?!0:a.isAuthenticated})),setAuthenticated:i=>n({isAuthenticated:i}),setAccessToken:i=>n({accessToken:i}),setUserProfile:i=>n({userProfile:i}),setTemplates:i=>n({templates:i}),setCurrentTemplate:i=>n({currentTemplate:i}),setCurrentAnalysis:i=>n({currentAnalysis:i,config:i?{...e().config,analysisId:i.id}:e().config}),setConnected:i=>n({isConnected:i}),setPaused:i=>n({isPaused:i}),setAutopilot:i=>n({isAutopilot:i}),setSpeechSpeed:i=>n({speechSpeed:i}),setVoiceStyle:i=>n({voiceStyle:i}),setRemoteSessionActive:i=>n({remoteSessionActive:i}),setRemoteSessionInfo:i=>n({remoteSessionInfo:i}),setUserStreamInfo:i=>n({userStreamInfo:i}),setAnalysisStreamInfo:i=>n({analysisStreamInfo:i}),setS2Connected:i=>n({isS2Connected:i}),updateFormData:(i,a,s="user",r="Manual edit")=>n(o=>{const l={fieldId:i,value:a,source:s,reason:r,timestamp:new Date().toISOString()};return{formData:{...o.formData,[i]:a},documentChanges:[...o.documentChanges,l]}}),setFormData:i=>n({formData:i}),addDocumentChange:i=>n(a=>({documentChanges:[...a.documentChanges,i]})),clearDocumentChanges:()=>n({documentChanges:[]}),addTranscriptMessage:i=>n(a=>{if(i.id){const r=a.transcriptMessages.findIndex(o=>o.id===i.id);if(r!==-1){const o=[...a.transcriptMessages];return o[r]={...o[r],...i},{transcriptMessages:o}}}const s=a.transcriptMessages[a.transcriptMessages.length-1];if(s&&s.role===i.role){const r=s.content.trim().toLowerCase(),o=i.content.trim().toLowerCase();if(r===o||r.includes(o)||o.includes(r)){if(o.length>r.length){const l=[...a.transcriptMessages];return l[l.length-1]={...s,content:i.content,id:i.id},{transcriptMessages:l}}return a}}return{transcriptMessages:[...a.transcriptMessages,i]}}),clearTranscript:()=>n({transcriptMessages:[]}),addChatMessage:i=>n(a=>({chatMessages:[...a.chatMessages,i]})),clearChatMessages:()=>n({chatMessages:[]}),setAnalysisTitle:i=>n({analysisTitle:i}),setUsageStats:i=>n({usageStats:i}),clearSessionData:()=>n({formData:{},documentChanges:[],transcriptMessages:[],chatMessages:[],analysisTitle:"Sin título",currentAnalysis:null,analysisStreamInfo:null,isS2Connected:!1,usageStats:null}),reset:()=>n(initialState)})),ClaraStoreAPI={getConfig:()=>useClaraStore.getState().config,getApiKey:()=>useClaraStore.getState().config.apiKey,getTemplateId:()=>useClaraStore.getState().config.templateId,getAnalysisId:()=>useClaraStore.getState().config.analysisId,getPrimaryColor:()=>useClaraStore.getState().config.primaryColor,getUserProfile:()=>useClaraStore.getState().userProfile,getTemplates:()=>useClaraStore.getState().templates,getCurrentTemplate:()=>useClaraStore.getState().currentTemplate,getCurrentAnalysis:()=>useClaraStore.getState().currentAnalysis,isAuthenticated:()=>useClaraStore.getState().isAuthenticated,isConnected:()=>useClaraStore.getState().isConnected,isPaused:()=>useClaraStore.getState().isPaused,isAutopilot:()=>useClaraStore.getState().isAutopilot,getSpeechSpeed:()=>useClaraStore.getState().speechSpeed,getVoiceStyle:()=>useClaraStore.getState().voiceStyle,getFormData:()=>useClaraStore.getState().formData,getDocumentChanges:()=>useClaraStore.getState().documentChanges,getTranscript:()=>useClaraStore.getState().transcriptMessages,getAnalysisTitle:()=>useClaraStore.getState().analysisTitle,getUserStreamInfo:()=>useClaraStore.getState().userStreamInfo,getAnalysisStreamInfo:()=>useClaraStore.getState().analysisStreamInfo,isS2Connected:()=>useClaraStore.getState().isS2Connected,isRemoteSessionActive:()=>useClaraStore.getState().remoteSessionActive,getRemoteSessionInfo:()=>useClaraStore.getState().remoteSessionInfo,setConfig:n=>useClaraStore.getState().setConfig(n),setAuthenticated:n=>useClaraStore.getState().setAuthenticated(n),setUserProfile:n=>useClaraStore.getState().setUserProfile(n),setTemplates:n=>useClaraStore.getState().setTemplates(n),setCurrentTemplate:n=>useClaraStore.getState().setCurrentTemplate(n),setCurrentAnalysis:n=>useClaraStore.getState().setCurrentAnalysis(n),setConnected:n=>useClaraStore.getState().setConnected(n),setPaused:n=>useClaraStore.getState().setPaused(n),setAutopilot:n=>useClaraStore.getState().setAutopilot(n),setSpeechSpeed:n=>useClaraStore.getState().setSpeechSpeed(n),setVoiceStyle:n=>useClaraStore.getState().setVoiceStyle(n),setUserStreamInfo:n=>useClaraStore.getState().setUserStreamInfo(n),setAnalysisStreamInfo:n=>useClaraStore.getState().setAnalysisStreamInfo(n),setS2Connected:n=>useClaraStore.getState().setS2Connected(n),setRemoteSessionActive:n=>useClaraStore.getState().setRemoteSessionActive(n),setRemoteSessionInfo:n=>useClaraStore.getState().setRemoteSessionInfo(n),updateFormData:(n,e,i,a)=>useClaraStore.getState().updateFormData(n,e,i,a),setFormData:n=>useClaraStore.getState().setFormData(n),addDocumentChange:n=>useClaraStore.getState().addDocumentChange(n),clearDocumentChanges:()=>useClaraStore.getState().clearDocumentChanges(),addTranscriptMessage:n=>useClaraStore.getState().addTranscriptMessage(n),clearTranscript:()=>useClaraStore.getState().clearTranscript(),setAnalysisTitle:n=>useClaraStore.getState().setAnalysisTitle(n),reset:()=>useClaraStore.getState().reset(),subscribe:n=>useClaraStore.subscribe(n)};typeof window<"u"&&(window.ClaraStore=ClaraStoreAPI);const PROJECT_ID="mahjxdopacmbyqewgxpx",API_BASE_URL$1=`https://${PROJECT_ID}.supabase.co/functions/v1/api`;class ClaraApiService{constructor(){ze(this,"apiKey",null);ze(this,"accessToken",null)}setApiKey(e){console.log("[Clara API] 🔑 setApiKey() called"),this.apiKey=e,this.accessToken=null}setAccessToken(e){console.log("[Clara API] 🎫 setAccessToken() called"),this.accessToken=e,this.apiKey=null}getApiKey(){return this.apiKey}getAccessToken(){return this.accessToken}getApiBaseUrl(){return API_BASE_URL$1}hasAuth(){return!!(this.apiKey||this.accessToken)}clearAuth(){console.log("[Clara API] 🧹 clearAuth() called"),this.apiKey=null,this.accessToken=null}getHeadersForEphemeral(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken&&(e.Authorization=`Bearer ${this.accessToken}`),e}getHeaders(){const e={"Content-Type":"application/json"};return this.apiKey?e["X-API-Key"]=this.apiKey:this.accessToken?e.Authorization=`Bearer ${this.accessToken}`:console.warn("[Clara API] ⚠️ getHeaders() - no auth available!"),e}async login(e,i,a="es"){var s;try{const r=`${API_BASE_URL$1}/auth/login`;console.log("[Clara API] Logging in with language:",a);const o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:i,language:a})}),l=await o.json();if(!o.ok||l.error){const u=((s=l.error)==null?void 0:s.message)||l.error||"Error de autenticación";return console.error("[Clara API] Login failed:",u),{success:!1,error:u}}return l.data?(this.setAccessToken(l.data.accessToken),console.log("[Clara API] Login successful, user:",l.data.user.email),{success:!0,user:l.data.user}):{success:!1,error:"Respuesta inválida del servidor"}}catch(r){return console.error("[Clara API] Login error:",r),{success:!1,error:"Error de conexión"}}}async fetchUserProfile(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/user/profile`;console.log("[Clara API] Fetching user profile from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const a=await i.json();return console.log("[Clara API] User profile received:",a),a.data||a}catch(e){throw console.error("[Clara API] Failed to fetch user profile:",e),e}}async updateUserSettings(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),!1;try{const i=`${API_BASE_URL$1}/user/settings`;console.log("[Clara API] Updating user settings:",e);const a=await fetch(i,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({settings:e})});return a.ok?(console.log("[Clara API] Settings updated successfully"),!0):(console.error("[Clara API] Failed to update settings:",a.status),!1)}catch(i){return console.error("[Clara API] Failed to update user settings:",i),!1}}async fetchTemplates(){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const e=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Fetching templates from:",e);const i=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!i.ok)throw i.status===401?new Error("Invalid API key"):new Error(`HTTP ${i.status}`);const a=await i.json();return console.log("[Clara API] Templates received:",a),a.data||a}catch(e){throw console.error("[Clara API] Failed to fetch templates:",e),e}}async fetchTemplate(e){const i=await this.fetchTemplates();return i&&i.find(a=>a.id===e)||null}async createTemplate(e){if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;try{const i=`${API_BASE_URL$1}/templates`;console.log("[Clara API] Creating template at:",i);const a=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({name:e.name,language:e.language||"es",description:e.description||"",custom_prompt:e.custom_prompt||null,structure:e.structure,webhook_config:e.webhook_config||null})});if(!a.ok)throw a.status===401?new Error("Invalid API key"):new Error(`HTTP ${a.status}`);const s=await a.json();return console.log("[Clara API] Template created:",s),s.data||s}catch(i){throw console.error("[Clara API] Failed to create template:",i),i}}async createAnalysis(e,i){var r;if(!this.hasAuth())return console.error("[Clara API] No auth configured"),null;const a={id:i.id,name:i.name,description:i.description,custom_prompt:i.custom_prompt,sections:((r=i.structure)==null?void 0:r.sections)||[]},s=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);try{const o=`${API_BASE_URL$1}/analyses`;console.log("[Clara API] Creating analysis at:",o,{templateId:e,isValidUUID:s});const l=await fetch(o,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({templateId:s?e:null,source:"web_live",title:i.name||"Nueva consulta",templateSnapshot:a})});if(!l.ok)throw new Error(`HTTP ${l.status}`);const u=await l.json();return console.log("[Clara API] Analysis created:",u),u.data||u}catch(o){return console.error("[Clara API] Failed to create analysis:",o),null}}async updateFormData(e,i,a,s,r){if(!this.hasAuth()||!e)return!1;console.log("[Clara API] 📊 updateFormData called with usageStats:",r);try{const o=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Updating formData:",o);const l={formData:i};return a&&a.length>0&&(l.documentChanges=a),s&&s.length>0&&(l.chatHistory=s),r&&r.totalTokens>0?(l.usageInputTokens=r.inputTokens,l.usageOutputTokens=r.outputTokens,l.usageTotalTokens=r.totalTokens,l.usageEstimatedCost=r.estimatedCost,console.log("[Clara API] 📊 Including usage in PUT:",l.usageTotalTokens,"tokens")):console.log("[Clara API] ⚠️ No usage stats to include (zeros or undefined)"),(await fetch(o,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify(l)})).ok}catch(o){return console.error("[Clara API] Failed to update formData:",o),!1}}async updateAnalysisTitle(e,i){if(!this.hasAuth()||!e)return!1;try{const a=`${API_BASE_URL$1}/analyses/${e}`;return(await fetch(a,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({title:i})})).ok}catch(a){return console.error("[Clara API] Failed to update analysis title:",a),!1}}async syncChatHistory(e,i){if(!this.hasAuth()||!e)return!1;try{const a=`${API_BASE_URL$1}/analyses/${e}`;return fetch(a,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({chatHistory:i})}).catch(s=>console.error("[Clara API] Chat history sync failed:",s)),!0}catch(a){return console.error("[Clara API] Failed to sync chat history:",a),!1}}async syncTranscriptToDB(e,i){if(!this.hasAuth()||!e)return!1;const a=i.map((s,r)=>({id:s.id||`msg_${r}_${Date.now()}`,role:s.role,content:s.content,timestamp:s.timestamp instanceof Date?s.timestamp.toISOString():s.timestamp,isFinal:s.isFinal??!0}));try{const s=`${API_BASE_URL$1}/analyses/${e}`;return fetch(s,{method:"PUT",headers:this.getHeaders(),body:JSON.stringify({transcript:JSON.stringify(a)})}).catch(r=>console.error("[Clara API] Transcript sync failed:",r)),!0}catch(s){return console.error("[Clara API] Failed to sync transcript:",s),!1}}async completeAnalysis(e,i,a,s,r,o){if(!this.hasAuth()||!e)return!1;const l=s.map((c,d)=>({id:c.id||`msg_${d}_${Date.now()}`,role:c.role,content:c.content,timestamp:c.timestamp instanceof Date?c.timestamp.toISOString():c.timestamp,isFinal:c.isFinal??!0})),u=new Date().toISOString();try{const c=`${API_BASE_URL$1}/analyses/${e}`;console.log("[Clara API] Completing analysis:",c);const d={status:"completed",transcript:JSON.stringify(l),completedAt:u,formData:i,documentChanges:a};r&&r.length>0&&(d.chatHistory=r),o&&o.totalTokens>0&&(d.usageInputTokens=o.inputTokens,d.usageOutputTokens=o.outputTokens,d.usageTotalTokens=o.totalTokens,d.usageEstimatedCost=o.estimatedCost);const p=await fetch(c,{method:"PUT",keepalive:!0,headers:this.getHeaders(),body:JSON.stringify(d)});return p.ok&&console.log("[Clara API] Analysis completed successfully"),p.ok}catch(c){return console.error("[Clara API] Failed to complete analysis:",c),!1}}async fetchBasinToken(e={}){if(!this.hasAuth())return null;try{const i=`${API_BASE_URL$1}/s2/basin/token`;console.log("[Clara API] Fetching S2 basin token from:",i,"with body:",e);const a=await fetch(i,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();return console.log("[Clara API] Basin token received:",s),s.data||s}catch(i){return console.error("[Clara API] Failed to fetch basin token:",i),null}}async fetchUserStreamToken(){var i;const e=await this.fetchBasinToken({});return e?{basin:e.basin,token:e.token,id:((i=e.streams)==null?void 0:i.exact)||e.userId||""}:null}async fetchAnalysisStreamToken(e,i){const a=i||e,s=await this.fetchBasinToken({streams:[a],includeUserStream:!1,ops:["list-streams","create-stream","append","read"]});return s?{basin:s.basin,token:s.token,id:a,analysisId:e}:null}}const claraApi=new ClaraApiService,translations={"login.title":{es:"Iniciar Sesión",en:"Sign In"},"login.email":{es:"Correo electrónico",en:"Email"},"login.password":{es:"Contraseña",en:"Password"},"login.submit":{es:"Ingresar",en:"Sign In"},"login.register":{es:"Regístrate en Clara",en:"Register on Clara"},"login.error":{es:"Error al iniciar sesión",en:"Login error"},"login.emailRequired":{es:"El correo electrónico es requerido",en:"Email is required"},"login.emailInvalid":{es:"Ingrese un correo electrónico válido",en:"Please enter a valid email"},"login.passwordRequired":{es:"La contraseña es requerida",en:"Password is required"},"login.invalidCredentials":{es:"Credenciales incorrectas",en:"Invalid credentials"},"login.connectionError":{es:"Error de conexión",en:"Connection error"},"dashboard.title":{es:"Panel de Control",en:"Dashboard"},"dashboard.newConsultation":{es:"Nueva Consulta",en:"New Consultation"},"dashboard.templates":{es:"Plantillas",en:"Templates"},"dashboard.recentSessions":{es:"Sesiones Recientes",en:"Recent Sessions"},"dashboard.noTemplate":{es:"Sin plantilla seleccionada",en:"No template selected"},"dashboard.selectTemplate":{es:"Seleccionar plantilla",en:"Select template"},"dashboard.startSession":{es:"Iniciar Sesión",en:"Start Session"},"dashboard.generate":{es:"Generar",en:"Generate"},"dashboard.logout":{es:"Cerrar Sesión",en:"Log Out"},"session.recording":{es:"Grabando...",en:"Recording..."},"session.paused":{es:"Pausado",en:"Paused"},"session.stop":{es:"Detener",en:"Stop"},"session.pause":{es:"Pausar",en:"Pause"},"session.resume":{es:"Reanudar",en:"Resume"},"session.untitled":{es:"Sin título",en:"Untitled"},"tabs.form":{es:"Formulario",en:"Form"},"tabs.transcript":{es:"Transcripción",en:"Transcript"},"tabs.chat":{es:"Chat",en:"Chat"},"tabs.report":{es:"Reporte",en:"Report"},"chat.placeholder":{es:"Escribe un mensaje...",en:"Type a message..."},"chat.send":{es:"Enviar",en:"Send"},"chat.welcome":{es:"Hola. Soy tu asistente médico con capacidad visual. Envíame imágenes o PDFs para extraer datos y generar el reporte.",en:"Hello. I am your visual medical assistant. Send me images or PDFs to extract data and generate the report."},"chat.thinking":{es:"Pensando...",en:"Thinking..."},"chat.generateSoap":{es:"Generar SOAP",en:"Generate SOAP"},"chat.summarize":{es:"Resumir consulta",en:"Summarize consultation"},"chat.clear":{es:"Limpiar chat",en:"Clear chat"},"chat.noDataToSummarize":{es:"No hay datos capturados para resumir. Complete los campos del formulario primero.",en:"No captured data to summarize. Complete the form fields first."},"form.clear":{es:"Limpiar",en:"Clear"},"form.save":{es:"Guardar",en:"Save"},"form.noTemplate":{es:"No hay plantilla cargada",en:"No template loaded"},"report.export":{es:"Exportar PDF",en:"Export PDF"},"report.fieldsCaptured":{es:"campos capturados",en:"fields captured"},"report.capturedData":{es:"Datos Capturados",en:"Captured Data"},"report.selectTemplate":{es:"Selecciona una plantilla para ver los campos",en:"Select a template to see the fields"},"report.noData":{es:"Sin datos",en:"No data"},"report.title":{es:"Reporte Médico",en:"Medical Report"},"report.generatedOn":{es:"Generado el",en:"Generated on"},"config.title":{es:"Configuración del Widget",en:"Widget Configuration"},"config.realtime":{es:"Los cambios se aplican en tiempo real",en:"Changes apply in real-time"},"config.apiKey":{es:"Clara API Key",en:"Clara API Key"},"config.apiKeyDesc":{es:"Tu clave de API para autenticación con Clara Platform.",en:"Your API key for Clara Platform authentication."},"config.templateId":{es:"Template ID (opcional)",en:"Template ID (optional)"},"config.templateIdDesc":{es:"ID del template remoto a cargar (sobrescribe el demo).",en:"Remote template ID to load (overrides demo)."},"config.primaryColor":{es:"Color Principal",en:"Primary Color"},"config.position":{es:"Posición del Widget",en:"Widget Position"},"config.positionLeft":{es:"Izquierda",en:"Left"},"config.positionCenter":{es:"Centro",en:"Center"},"config.positionRight":{es:"Derecha",en:"Right"},"config.autoOpen":{es:"Abrir Automáticamente",en:"Auto Open"},"config.autoOpenDesc":{es:"Si está activado, el widget aparecerá abierto al cargar la página.",en:"If enabled, the widget will open automatically on page load."},"config.language":{es:"Idioma",en:"Language"},"config.languageDesc":{es:"Idioma de la interfaz del widget.",en:"Widget interface language."},"config.spanish":{es:"Español",en:"Spanish"},"config.english":{es:"Inglés",en:"English"},"config.integrationCode":{es:"Código de Integración",en:"Integration Code"},"config.viewSdk":{es:"Ver SDK y documentación",en:"View SDK and documentation"},"transcript.provisional":{es:"La transcripción es provisional y puede ser corregida al finalizar.",en:"Transcription is provisional and may be corrected upon completion."},"transcript.empty":{es:"La transcripción aparecerá aquí...",en:"Transcription will appear here..."},"transcript.connecting":{es:"Conectando con el modelo de voz...",en:"Connecting to voice model..."},"transcript.listening":{es:"Escuchando conversación...",en:"Listening to conversation..."},"transcript.startSession":{es:"Inicia la sesión para ver la transcripción.",en:"Start the session to see the transcript."},"common.loading":{es:"Cargando...",en:"Loading..."},"common.error":{es:"Error",en:"Error"},"common.success":{es:"Éxito",en:"Success"},"common.cancel":{es:"Cancelar",en:"Cancel"},"common.confirm":{es:"Confirmar",en:"Confirm"},"common.close":{es:"Cerrar",en:"Close"},"page.integration":{es:"Integración",en:"Integration"},"page.configuration":{es:"Configuración",en:"Configuration"},"page.completeFields":{es:"Complete todos los campos requeridos para el registro de la consulta médica",en:"Complete all required fields for the medical consultation record"},"page.noSections":{es:"No hay secciones de formulario cargadas",en:"No form sections loaded"},"page.selectTemplate":{es:"Selecciona un template desde la configuración del widget",en:"Select a template from the widget configuration"},"generate.title":{es:"Generando Template",en:"Generating Template"},"generate.complete":{es:"Template Generado",en:"Template Generated"},"generate.analyzing":{es:"Analizando formulario...",en:"Analyzing form..."},"generate.sections":{es:"secciones",en:"sections"},"generate.fields":{es:"campos",en:"fields"},"embed.title":{es:"Código de Integración",en:"Embed Code"},"embed.subtitle":{es:"Integra Clara en tu sitio web",en:"Integrate Clara into your website"},"embed.widgetDescription":{es:"Agrega este código antes de </body> para mostrar el asistente flotante de Clara.",en:"Add this snippet before </body> to display the floating Clara assistant widget."},"embed.formDescription":{es:"Agrega este código donde quieras renderizar el formulario médico de Clara.",en:"Add this code where you want to render the Clara medical form."},"embed.extensionDescription":{es:"Descarga e instala la extensión de Chrome para inyectar Clara en cualquier sitio web sin modificar el código fuente.",en:"Download and install the Chrome extension to inject Clara into any website without modifying the source code."},"embed.extensionTitle":{es:"Clara Extensión de Chrome",en:"Clara Chrome Extension"},"embed.extensionSubtitle":{es:"Inyecta Clara en cualquier sitio web con un solo clic",en:"Inject Clara into any website with a single click"},"embed.download":{es:"Descargar Extensión",en:"Download Extension"},"embed.installation":{es:"Instalación",en:"Installation"},"embed.step1":{es:"Descarga y descomprime el archivo de la extensión",en:"Download and unzip the extension file"},"embed.step2":{es:"Abre Chrome y ve a",en:"Open Chrome and go to"},"embed.step3":{es:'Activa el "Modo desarrollador" en la esquina superior derecha',en:'Enable "Developer mode" in the top right'},"embed.step4":{es:'Haz clic en "Cargar descomprimida" y selecciona la carpeta',en:'Click "Load unpacked" and select the unzipped folder'},"embed.tipExtension":{es:"Haz clic derecho en cualquier página para abrir la barra lateral de Clara",en:"Right-click on any page to open Clara sidebar"},"embed.tipConfig":{es:"Los cambios de configuración se reflejan en tiempo real",en:"Configuration changes are reflected in real-time"},"embed.copied":{es:"¡Copiado!",en:"Copied!"},"embed.copy":{es:"Copiar",en:"Copy"}};function t(n,e="es"){const i=translations[n];return i?i[e]||i.es:(console.warn(`[Translations] Missing key: ${n}`),n)}function createTranslator(n){return e=>t(e,n)}const ClaraLogin=({onLogin:n,primaryColor:e})=>{const[i,a]=React.useState(""),[s,r]=React.useState(""),[o,l]=React.useState(!1),[u,c]=React.useState(!1),[d,p]=React.useState({}),{config:f,setAccessToken:m,setUserProfile:P,setAuthenticated:T}=useClaraStore(),x=f.lang||"es",y=()=>{const g={};return i?/\S+@\S+\.\S+/.test(i)||(g.email=t("login.emailInvalid",x)):g.email=t("login.emailRequired",x),s||(g.password=t("login.passwordRequired",x)),p(g),Object.keys(g).length===0},S=async g=>{if(g.preventDefault(),!!y()){c(!0),p({});try{const C=await claraApi.login(i,s,x);if(!C.success){p({general:C.error||t("login.invalidCredentials",x)}),c(!1);return}const E=claraApi.getAccessToken();E&&m(E),C.user&&P({id:C.user.id,email:C.user.email,name:`${C.user.user_metadata.first_name||""} ${C.user.user_metadata.last_name||""}`.trim()}),T(!0),n()}catch(C){console.error("[Login] Error:",C),p({general:t("login.connectionError",x)})}finally{c(!1)}}};return jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex flex-col h-full bg-card text-card-foreground px-6 py-8 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"mb-6 text-center",children:jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-8 w-auto"})}),jsxRuntime.jsx("div",{className:"text-center mb-6",children:jsxRuntime.jsx("h2",{className:"text-lg font-bold leading-tight mb-1",style:{color:e},children:t("login.title",x)})}),jsxRuntime.jsxs("form",{onSubmit:S,className:"w-full space-y-4",noValidate:!0,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.email",x)}),jsxRuntime.jsx("input",{type:"email",value:i,onChange:g=>{a(g.target.value),d.email&&p({...d,email:void 0})},placeholder:"tu-correo@clara.care",className:`w-full px-3 py-2.5 rounded-lg border text-sm ${d.email?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),d.email&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:d.email})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5",children:t("login.password",x)}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:o?"text":"password",value:s,onChange:g=>{r(g.target.value),d.password&&p({...d,password:void 0})},placeholder:"••••••••",className:`w-full px-3 py-2.5 pr-10 rounded-lg border text-sm ${d.password?"border-destructive focus:ring-destructive/20":"border-border focus:ring-ring/20"} focus:outline-none focus:ring-2 focus:border-transparent text-foreground bg-background shadow-sm transition-all`}),jsxRuntime.jsx("button",{type:"button",onClick:()=>l(!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:o?jsxRuntime.jsx(EyeOff,{className:"w-4 h-4"}):jsxRuntime.jsx(Eye,{className:"w-4 h-4"})})]}),d.password&&jsxRuntime.jsx("p",{className:"text-destructive text-[10px] mt-1",children:d.password})]}),d.general&&jsxRuntime.jsx("div",{className:"p-2 bg-destructive/10 border border-destructive/20 rounded-lg",children:jsxRuntime.jsx("p",{className:"text-destructive text-xs text-center",children:d.general})}),jsxRuntime.jsx("button",{type:"submit",disabled:u,style:{backgroundColor:e},className:"w-full text-white font-semibold py-2.5 px-4 rounded-lg transition-all shadow-button text-sm hover:brightness-110 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}),t("common.loading",x)]}):t("login.submit",x)})]}),jsxRuntime.jsx("div",{className:"mt-6 pb-4 text-center",children:jsxRuntime.jsx("a",{href:"https://clara.care",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium text-xs hover:opacity-80 transition-colors",style:{color:e},children:t("login.register",x)})})]})})};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lottie$1={exports:{}};(function(module,exports){typeof document<"u"&&typeof navigator<"u"&&function(n,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(n){return document.createElement(n)}function extendPrototype(n,e){var i,a=n.length,s;for(i=0;i<a;i+=1){s=n[i].prototype;for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e.prototype[r]=s[r])}}function getDescriptor(n,e){return Object.getOwnPropertyDescriptor(n,e)}function createProxyFunction(n){function e(){}return e.prototype=n,e}var audioControllerFactory=function(){function n(e){this.audios=[],this.audioFactory=e,this._volume=1,this._isMuted=!1}return n.prototype={addAudio:function(i){this.audios.push(i)},pause:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].pause()},resume:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].resume()},setRate:function(i){var a,s=this.audios.length;for(a=0;a<s;a+=1)this.audios[a].setRate(i)},createAudio:function(i){return this.audioFactory?this.audioFactory(i):window.Howl?new window.Howl({src:[i]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(i){this.audioFactory=i},setVolume:function(i){this._volume=i,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var i,a=this.audios.length;for(i=0;i<a;i+=1)this.audios[i].volume(this._volume*(this._isMuted?0:1))}},function(){return new n}}(),createTypedArray=function(){function n(i,a){var s=0,r=[],o;switch(i){case"int16":case"uint8c":o=1;break;default:o=1.1;break}for(s=0;s<a;s+=1)r.push(o);return r}function e(i,a){return i==="float32"?new Float32Array(a):i==="int16"?new Int16Array(a):i==="uint8c"?new Uint8ClampedArray(a):n(i,a)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?e:n}();function createSizedArray(n){return Array.apply(null,{length:n})}function _typeof$6(n){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(n)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var n=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],e,i=n.length;for(e=0;e<i;e+=1)BMMath[n[e]]=Math[n[e]]})(),BMMath.random=Math.random,BMMath.abs=function(n){var e=_typeof$6(n);if(e==="object"&&n.length){var i=createSizedArray(n.length),a,s=n.length;for(a=0;a<s;a+=1)i[a]=Math.abs(n[a]);return i}return Math.abs(n)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(n){n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.display="block",n.style.transformOrigin="0 0",n.style.webkitTransformOrigin="0 0",n.style.backfaceVisibility="visible",n.style.webkitBackfaceVisibility="visible",n.style.transformStyle="preserve-3d",n.style.webkitTransformStyle="preserve-3d",n.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(n,e,i,a){this.type=n,this.currentTime=e,this.totalTime=i,this.direction=a<0?-1:1}function BMCompleteEvent(n,e){this.type=n,this.direction=e<0?-1:1}function BMCompleteLoopEvent(n,e,i,a){this.type=n,this.currentLoop=i,this.totalLoops=e,this.direction=a<0?-1:1}function BMSegmentStartEvent(n,e,i){this.type=n,this.firstFrame=e,this.totalFrames=i}function BMDestroyEvent(n,e){this.type=n,this.target=e}function BMRenderFrameErrorEvent(n,e){this.type="renderFrameError",this.nativeError=n,this.currentTime=e}function BMConfigErrorEvent(n){this.type="configError",this.nativeError=n}var createElementID=function(){var n=0;return function(){return n+=1,idPrefix$1+"__lottie_element_"+n}}();function HSVtoRGB(n,e,i){var a,s,r,o,l,u,c,d;switch(o=Math.floor(n*6),l=n*6-o,u=i*(1-e),c=i*(1-l*e),d=i*(1-(1-l)*e),o%6){case 0:a=i,s=d,r=u;break;case 1:a=c,s=i,r=u;break;case 2:a=u,s=i,r=d;break;case 3:a=u,s=c,r=i;break;case 4:a=d,s=u,r=i;break;case 5:a=i,s=u,r=c;break}return[a,s,r]}function RGBtoHSV(n,e,i){var a=Math.max(n,e,i),s=Math.min(n,e,i),r=a-s,o,l=a===0?0:r/a,u=a/255;switch(a){case s:o=0;break;case n:o=e-i+r*(e<i?6:0),o/=6*r;break;case e:o=i-n+r*2,o/=6*r;break;case i:o=n-e+r*4,o/=6*r;break}return[o,l,u]}function addSaturationToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[1]+=e,i[1]>1?i[1]=1:i[1]<=0&&(i[1]=0),HSVtoRGB(i[0],i[1],i[2])}function addBrightnessToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),HSVtoRGB(i[0],i[1],i[2])}function addHueToRGB(n,e){var i=RGBtoHSV(n[0]*255,n[1]*255,n[2]*255);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),HSVtoRGB(i[0],i[1],i[2])}var rgbToHex=function(){var n=[],e,i;for(e=0;e<256;e+=1)i=e.toString(16),n[e]=i.length===1?"0"+i:i;return function(a,s,r){return a<0&&(a=0),s<0&&(s=0),r<0&&(r=0),"#"+n[a]+n[s]+n[r]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(n){return document.createElementNS(svgNS,n)}function _typeof$5(n){"@babel/helpers - typeof";return _typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(n)}var dataManager=function(){var n=1,e=[],i,a,s={onmessage:function(){},postMessage:function(m){i({data:m})}},r={postMessage:function(m){s.onmessage({data:m})}};function o(f){if(window.Worker&&window.Blob&&getWebWorker()){var m=new Blob(["var _workerSelf = self; self.onmessage = ",f.toString()],{type:"text/javascript"}),P=URL.createObjectURL(m);return new Worker(P)}return i=f,s}function l(){a||(a=o(function(m){function P(){function x(O,b){var I,V,A=O.length,k,R,G,z;for(V=0;V<A;V+=1)if(I=O[V],"ks"in I&&!I.completed){if(I.completed=!0,I.hasMask){var q=I.masksProperties;for(R=q.length,k=0;k<R;k+=1)if(q[k].pt.k.i)E(q[k].pt.k);else for(z=q[k].pt.k.length,G=0;G<z;G+=1)q[k].pt.k[G].s&&E(q[k].pt.k[G].s[0]),q[k].pt.k[G].e&&E(q[k].pt.k[G].e[0])}I.ty===0?(I.layers=g(I.refId,b),x(I.layers,b)):I.ty===4?C(I.shapes):I.ty===5&&H(I)}}function y(O,b){if(O){var I=0,V=O.length;for(I=0;I<V;I+=1)O[I].t===1&&(O[I].data.layers=g(O[I].data.refId,b),x(O[I].data.layers,b))}}function S(O,b){for(var I=0,V=b.length;I<V;){if(b[I].id===O)return b[I];I+=1}return null}function g(O,b){var I=S(O,b);return I?I.layers.__used?JSON.parse(JSON.stringify(I.layers)):(I.layers.__used=!0,I.layers):null}function C(O){var b,I=O.length,V,A;for(b=I-1;b>=0;b-=1)if(O[b].ty==="sh")if(O[b].ks.k.i)E(O[b].ks.k);else for(A=O[b].ks.k.length,V=0;V<A;V+=1)O[b].ks.k[V].s&&E(O[b].ks.k[V].s[0]),O[b].ks.k[V].e&&E(O[b].ks.k[V].e[0]);else O[b].ty==="gr"&&C(O[b].it)}function E(O){var b,I=O.i.length;for(b=0;b<I;b+=1)O.i[b][0]+=O.v[b][0],O.i[b][1]+=O.v[b][1],O.o[b][0]+=O.v[b][0],O.o[b][1]+=O.v[b][1]}function B(O,b){var I=b?b.split("."):[100,100,100];return O[0]>I[0]?!0:I[0]>O[0]?!1:O[1]>I[1]?!0:I[1]>O[1]?!1:O[2]>I[2]?!0:I[2]>O[2]?!1:null}var _=function(){var O=[4,4,14];function b(V){var A=V.t.d;V.t.d={k:[{s:A,t:0}]}}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===5&&b(V[A])}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),M=function(){var O=[4,7,99];return function(b){if(b.chars&&!B(O,b.v)){var I,V=b.chars.length;for(I=0;I<V;I+=1){var A=b.chars[I];A.data&&A.data.shapes&&(C(A.data.shapes),A.data.ip=0,A.data.op=99999,A.data.st=0,A.data.sr=1,A.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},b.chars[I].t||(A.data.shapes.push({ty:"no"}),A.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),D=function(){var O=[5,7,15];function b(V){var A=V.t.p;typeof A.a=="number"&&(A.a={a:0,k:A.a}),typeof A.p=="number"&&(A.p={a:0,k:A.p}),typeof A.r=="number"&&(A.r={a:0,k:A.r})}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===5&&b(V[A])}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),L=function(){var O=[4,1,9];function b(V){var A,k=V.length,R,G;for(A=0;A<k;A+=1)if(V[A].ty==="gr")b(V[A].it);else if(V[A].ty==="fl"||V[A].ty==="st")if(V[A].c.k&&V[A].c.k[0].i)for(G=V[A].c.k.length,R=0;R<G;R+=1)V[A].c.k[R].s&&(V[A].c.k[R].s[0]/=255,V[A].c.k[R].s[1]/=255,V[A].c.k[R].s[2]/=255,V[A].c.k[R].s[3]/=255),V[A].c.k[R].e&&(V[A].c.k[R].e[0]/=255,V[A].c.k[R].e[1]/=255,V[A].c.k[R].e[2]/=255,V[A].c.k[R].e[3]/=255);else V[A].c.k[0]/=255,V[A].c.k[1]/=255,V[A].c.k[2]/=255,V[A].c.k[3]/=255}function I(V){var A,k=V.length;for(A=0;A<k;A+=1)V[A].ty===4&&b(V[A].shapes)}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}(),N=function(){var O=[4,4,18];function b(V){var A,k=V.length,R,G;for(A=k-1;A>=0;A-=1)if(V[A].ty==="sh")if(V[A].ks.k.i)V[A].ks.k.c=V[A].closed;else for(G=V[A].ks.k.length,R=0;R<G;R+=1)V[A].ks.k[R].s&&(V[A].ks.k[R].s[0].c=V[A].closed),V[A].ks.k[R].e&&(V[A].ks.k[R].e[0].c=V[A].closed);else V[A].ty==="gr"&&b(V[A].it)}function I(V){var A,k,R=V.length,G,z,q,U;for(k=0;k<R;k+=1){if(A=V[k],A.hasMask){var K=A.masksProperties;for(z=K.length,G=0;G<z;G+=1)if(K[G].pt.k.i)K[G].pt.k.c=K[G].cl;else for(U=K[G].pt.k.length,q=0;q<U;q+=1)K[G].pt.k[q].s&&(K[G].pt.k[q].s[0].c=K[G].cl),K[G].pt.k[q].e&&(K[G].pt.k[q].e[0].c=K[G].cl)}A.ty===4&&b(A.shapes)}}return function(V){if(B(O,V.v)&&(I(V.layers),V.assets)){var A,k=V.assets.length;for(A=0;A<k;A+=1)V.assets[A].layers&&I(V.assets[A].layers)}}}();function F(O){O.__complete||(L(O),_(O),M(O),D(O),N(O),x(O.layers,O.assets),y(O.chars,O.assets),O.__complete=!0)}function H(O){O.t.a.length===0&&"m"in O.t.p}var $={};return $.completeData=F,$.checkColors=L,$.checkChars=M,$.checkPathProperties=D,$.checkShapes=N,$.completeLayers=x,$}if(r.dataManager||(r.dataManager=P()),r.assetLoader||(r.assetLoader=function(){function x(S){var g=S.getResponseHeader("content-type");return g&&S.responseType==="json"&&g.indexOf("json")!==-1||S.response&&_typeof$5(S.response)==="object"?S.response:S.response&&typeof S.response=="string"?JSON.parse(S.response):S.responseText?JSON.parse(S.responseText):null}function y(S,g,C,E){var B,_=new XMLHttpRequest;try{_.responseType="json"}catch{}_.onreadystatechange=function(){if(_.readyState===4)if(_.status===200)B=x(_),C(B);else try{B=x(_),C(B)}catch(M){E&&E(M)}};try{_.open(["G","E","T"].join(""),S,!0)}catch{_.open(["G","E","T"].join(""),g+"/"+S,!0)}_.send()}return{load:y}}()),m.data.type==="loadAnimation")r.assetLoader.load(m.data.path,m.data.fullPath,function(x){r.dataManager.completeData(x),r.postMessage({id:m.data.id,payload:x,status:"success"})},function(){r.postMessage({id:m.data.id,status:"error"})});else if(m.data.type==="complete"){var T=m.data.animation;r.dataManager.completeData(T),r.postMessage({id:m.data.id,payload:T,status:"success"})}else m.data.type==="loadData"&&r.assetLoader.load(m.data.path,m.data.fullPath,function(x){r.postMessage({id:m.data.id,payload:x,status:"success"})},function(){r.postMessage({id:m.data.id,status:"error"})})}),a.onmessage=function(f){var m=f.data,P=m.id,T=e[P];e[P]=null,m.status==="success"?T.onComplete(m.payload):T.onError&&T.onError()})}function u(f,m){n+=1;var P="processId_"+n;return e[P]={onComplete:f,onError:m},P}function c(f,m,P){l();var T=u(m,P);a.postMessage({type:"loadAnimation",path:f,fullPath:window.location.origin+window.location.pathname,id:T})}function d(f,m,P){l();var T=u(m,P);a.postMessage({type:"loadData",path:f,fullPath:window.location.origin+window.location.pathname,id:T})}function p(f,m,P){l();var T=u(m,P);a.postMessage({type:"complete",animation:f,id:T})}return{loadAnimation:c,loadData:d,completeAnimation:p}}(),ImagePreloader=function(){var n=function(){var y=createTag("canvas");y.width=1,y.height=1;var S=y.getContext("2d");return S.fillStyle="rgba(0,0,0,0)",S.fillRect(0,0,1,1),y}();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function a(y,S,g){var C="";if(y.e)C=y.p;else if(S){var E=y.p;E.indexOf("images/")!==-1&&(E=E.split("/")[1]),C=S+E}else C=g,C+=y.u?y.u:"",C+=y.p;return C}function s(y){var S=0,g=setInterval((function(){var C=y.getBBox();(C.width||S>500)&&(this._imageLoaded(),clearInterval(g)),S+=1}).bind(this),50)}function r(y){var S=a(y,this.assetsPath,this.path),g=createNS("image");isSafari?this.testImageLoaded(g):g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){C.img=n,this._imageLoaded()}).bind(this),!1),g.setAttributeNS("http://www.w3.org/1999/xlink","href",S),this._elementHelper.append?this._elementHelper.append(g):this._elementHelper.appendChild(g);var C={img:g,assetData:y};return C}function o(y){var S=a(y,this.assetsPath,this.path),g=createTag("img");g.crossOrigin="anonymous",g.addEventListener("load",this._imageLoaded,!1),g.addEventListener("error",(function(){C.img=n,this._imageLoaded()}).bind(this),!1),g.src=S;var C={img:g,assetData:y};return C}function l(y){var S={assetData:y},g=a(y,this.assetsPath,this.path);return dataManager.loadData(g,(function(C){S.img=C,this._footageLoaded()}).bind(this),(function(){S.img={},this._footageLoaded()}).bind(this)),S}function u(y,S){this.imagesLoadedCb=S;var g,C=y.length;for(g=0;g<C;g+=1)y[g].layers||(!y[g].t||y[g].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(y[g]))):y[g].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(y[g]))))}function c(y){this.path=y||""}function d(y){this.assetsPath=y||""}function p(y){for(var S=0,g=this.images.length;S<g;){if(this.images[S].assetData===y)return this.images[S].img;S+=1}return null}function f(){this.imagesLoadedCb=null,this.images.length=0}function m(){return this.totalImages===this.loadedAssets}function P(){return this.totalFootages===this.loadedFootagesCount}function T(y,S){y==="svg"?(this._elementHelper=S,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function x(){this._imageLoaded=e.bind(this),this._footageLoaded=i.bind(this),this.testImageLoaded=s.bind(this),this.createFootageData=l.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return x.prototype={loadAssets:u,setAssetsPath:d,setPath:c,loadedImages:m,loadedFootages:P,destroy:f,getAsset:p,createImgData:o,createImageData:r,imageLoaded:e,footageLoaded:i,setCacheType:T},x}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(e,i){if(this._cbs[e])for(var a=this._cbs[e],s=0;s<a.length;s+=1)a[s](i)},addEventListener:function(e,i){return this._cbs[e]||(this._cbs[e]=[]),this._cbs[e].push(i),(function(){this.removeEventListener(e,i)}).bind(this)},removeEventListener:function(e,i){if(!i)this._cbs[e]=null;else if(this._cbs[e]){for(var a=0,s=this._cbs[e].length;a<s;)this._cbs[e][a]===i&&(this._cbs[e].splice(a,1),a-=1,s-=1),a+=1;this._cbs[e].length||(this._cbs[e]=null)}}};var markerParser=function(){function n(e){for(var i=e.split(`\r
|
|
150
|
+
`),a={},s,r=0,o=0;o<i.length;o+=1)s=i[o].split(":"),s.length===2&&(a[s[0]]=s[1].trim(),r+=1);if(r===0)throw new Error;return a}return function(e){for(var i=[],a=0;a<e.length;a+=1){var s=e[a],r={time:s.tm,duration:s.dr};try{r.payload=JSON.parse(e[a].cm)}catch{try{r.payload=n(e[a].cm)}catch{r.payload={name:e[a].cm}}}i.push(r)}return i}}(),ProjectInterface=function(){function n(e){this.compositions.push(e)}return function(){function e(i){for(var a=0,s=this.compositions.length;a<s;){if(this.compositions[a].data&&this.compositions[a].data.nm===i)return this.compositions[a].prepareFrame&&this.compositions[a].data.xt&&this.compositions[a].prepareFrame(this.currentFrame),this.compositions[a].compInterface;a+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=n,e}}(),renderers={},registerRenderer=function(e,i){renderers[e]=i};function getRenderer(n){return renderers[n]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var n in renderers)if(renderers[n])return n;return""}function _typeof$4(n){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(n)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(n){(n.wrapper||n.container)&&(this.wrapper=n.wrapper||n.container);var e="svg";n.animType?e=n.animType:n.renderer&&(e=n.renderer);var i=getRenderer(e);this.renderer=new i(this,n.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,n.loop===""||n.loop===null||n.loop===void 0||n.loop===!0?this.loop=!0:n.loop===!1?this.loop=!1:this.loop=parseInt(n.loop,10),this.autoplay="autoplay"in n?n.autoplay:!0,this.name=n.name?n.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(n,"autoloadSegments")?n.autoloadSegments:!0,this.assetsPath=n.assetsPath,this.initialSegment=n.initialSegment,n.audioFactory&&this.audioController.setAudioFactory(n.audioFactory),n.animationData?this.setupAnimation(n.animationData):n.path&&(n.path.lastIndexOf("\\")!==-1?this.path=n.path.substr(0,n.path.lastIndexOf("\\")+1):this.path=n.path.substr(0,n.path.lastIndexOf("/")+1),this.fileName=n.path.substr(n.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(n.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(n){dataManager.completeAnimation(n,this.configAnimation)},AnimationItem.prototype.setData=function(n,e){e&&_typeof$4(e)!=="object"&&(e=JSON.parse(e));var i={wrapper:n,animationData:e},a=n.attributes;i.path=a.getNamedItem("data-animation-path")?a.getNamedItem("data-animation-path").value:a.getNamedItem("data-bm-path")?a.getNamedItem("data-bm-path").value:a.getNamedItem("bm-path")?a.getNamedItem("bm-path").value:"",i.animType=a.getNamedItem("data-anim-type")?a.getNamedItem("data-anim-type").value:a.getNamedItem("data-bm-type")?a.getNamedItem("data-bm-type").value:a.getNamedItem("bm-type")?a.getNamedItem("bm-type").value:a.getNamedItem("data-bm-renderer")?a.getNamedItem("data-bm-renderer").value:a.getNamedItem("bm-renderer")?a.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var s=a.getNamedItem("data-anim-loop")?a.getNamedItem("data-anim-loop").value:a.getNamedItem("data-bm-loop")?a.getNamedItem("data-bm-loop").value:a.getNamedItem("bm-loop")?a.getNamedItem("bm-loop").value:"";s==="false"?i.loop=!1:s==="true"?i.loop=!0:s!==""&&(i.loop=parseInt(s,10));var r=a.getNamedItem("data-anim-autoplay")?a.getNamedItem("data-anim-autoplay").value:a.getNamedItem("data-bm-autoplay")?a.getNamedItem("data-bm-autoplay").value:a.getNamedItem("bm-autoplay")?a.getNamedItem("bm-autoplay").value:!0;i.autoplay=r!=="false",i.name=a.getNamedItem("data-name")?a.getNamedItem("data-name").value:a.getNamedItem("data-bm-name")?a.getNamedItem("data-bm-name").value:a.getNamedItem("bm-name")?a.getNamedItem("bm-name").value:"";var o=a.getNamedItem("data-anim-prerender")?a.getNamedItem("data-anim-prerender").value:a.getNamedItem("data-bm-prerender")?a.getNamedItem("data-bm-prerender").value:a.getNamedItem("bm-prerender")?a.getNamedItem("bm-prerender").value:"";o==="false"&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(n){n.op>this.animationData.op&&(this.animationData.op=n.op,this.totalFrames=Math.floor(n.op-this.animationData.ip));var e=this.animationData.layers,i,a=e.length,s=n.layers,r,o=s.length;for(r=0;r<o;r+=1)for(i=0;i<a;){if(e[i].id===s[r].id){e[i]=s[r];break}i+=1}if((n.chars||n.fonts)&&(this.renderer.globalData.fontManager.addChars(n.chars),this.renderer.globalData.fontManager.addFonts(n.fonts,this.renderer.globalData.defs)),n.assets)for(a=n.assets.length,i=0;i<a;i+=1)this.animationData.assets.push(n.assets[i]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(n){this.animationData=n;var e=getExpressionsPlugin();e&&e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var n=this.animationData.segments;if(!n||n.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var e=n.shift();this.timeCompleted=e.time*this.frameRate;var i=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(i,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},AnimationItem.prototype.loadSegments=function(){var n=this.animationData.segments;n||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(n){if(this.renderer)try{this.animationData=n,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(n),n.assets||(n.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(n.assets),this.markers=markerParser(n.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(e){this.triggerConfigError(e)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var n=getExpressionsPlugin();n&&n.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(n,e){var i=typeof n=="number"?n:void 0,a=typeof e=="number"?e:void 0;this.renderer.updateContainerSize(i,a)},AnimationItem.prototype.setSubframe=function(n){this.isSubframeEnabled=!!n},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(n){this.triggerRenderFrameError(n)}},AnimationItem.prototype.play=function(n){n&&this.name!==n||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(n){n&&this.name!==n||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(n){n&&this.name!==n||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(n){n&&this.name!==n||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(n){for(var e,i=0;i<this.markers.length;i+=1)if(e=this.markers[i],e.payload&&e.payload.name===n)return e;return null},AnimationItem.prototype.goToAndStop=function(n,e,i){if(!(i&&this.name!==i)){var a=Number(n);if(isNaN(a)){var s=this.getMarkerData(n);s&&this.goToAndStop(s.time,!0)}else e?this.setCurrentRawFrameValue(n):this.setCurrentRawFrameValue(n*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(n,e,i){if(!(i&&this.name!==i)){var a=Number(n);if(isNaN(a)){var s=this.getMarkerData(n);s&&(s.duration?this.playSegments([s.time,s.time+s.duration],!0):this.goToAndStop(s.time,!0))}else this.goToAndStop(a,e,i);this.play()}},AnimationItem.prototype.advanceTime=function(n){if(!(this.isPaused===!0||this.isLoaded===!1)){var e=this.currentRawFrame+n*this.frameModifier,i=!1;e>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(i=!0,e=0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(n,e){this.playCount=0,n[1]<n[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=n[0]-n[1],this.timeCompleted=this.totalFrames,this.firstFrame=n[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):n[1]>n[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=n[1]-n[0],this.timeCompleted=this.totalFrames,this.firstFrame=n[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(n,e){var i=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<n?i=n:this.currentRawFrame+this.firstFrame>e&&(i=e-n)),this.firstFrame=n,this.totalFrames=e-n,this.timeCompleted=this.totalFrames,i!==-1&&this.goToAndStop(i,!0)},AnimationItem.prototype.playSegments=function(n,e){if(e&&(this.segments.length=0),_typeof$4(n[0])==="object"){var i,a=n.length;for(i=0;i<a;i+=1)this.segments.push(n[i])}else this.segments.push(n);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(n){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),n&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(n){return this.segments.length?(this.adjustSegment(this.segments.shift(),n),!0):!1},AnimationItem.prototype.destroy=function(n){n&&this.name!==n||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(n){this.currentRawFrame=n,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(n){this.playSpeed=n,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(n){this.playDirection=n<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(n){this.loop=n},AnimationItem.prototype.setVolume=function(n,e){e&&this.name!==e||this.audioController.setVolume(n)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(n){n&&this.name!==n||this.audioController.mute()},AnimationItem.prototype.unmute=function(n){n&&this.name!==n||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(n){var e="";if(n.e)e=n.p;else if(this.assetsPath){var i=n.p;i.indexOf("images/")!==-1&&(i=i.split("/")[1]),e=this.assetsPath+i}else e=this.path,e+=n.u?n.u:"",e+=n.p;return e},AnimationItem.prototype.getAssetData=function(n){for(var e=0,i=this.assets.length;e<i;){if(n===this.assets[e].id)return this.assets[e];e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(n){return n?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(n,e,i){try{var a=this.renderer.getElementByPath(n);a.updateDocumentData(e,i)}catch{}},AnimationItem.prototype.trigger=function(n){if(this._cbs&&this._cbs[n])switch(n){case"enterFrame":this.triggerEvent(n,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(n,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(n,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(n,new BMCompleteEvent(n,this.frameMult));break;case"segmentStart":this.triggerEvent(n,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(n,new BMDestroyEvent(n,this));break;default:this.triggerEvent(n)}n==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(n,this.currentFrame,this.totalFrames,this.frameMult)),n==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(n,this.loop,this.playCount,this.frameMult)),n==="complete"&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(n,this.frameMult)),n==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(n,this.firstFrame,this.totalFrames)),n==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(n,this))},AnimationItem.prototype.triggerRenderFrameError=function(n){var e=new BMRenderFrameErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(n){var e=new BMConfigErrorEvent(n,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var animationManager=function(){var n={},e=[],i=0,a=0,s=0,r=!0,o=!1;function l(b){for(var I=0,V=b.target;I<a;)e[I].animation===V&&(e.splice(I,1),I-=1,a-=1,V.isPaused||p()),I+=1}function u(b,I){if(!b)return null;for(var V=0;V<a;){if(e[V].elem===b&&e[V].elem!==null)return e[V].animation;V+=1}var A=new AnimationItem;return f(A,b),A.setData(b,I),A}function c(){var b,I=e.length,V=[];for(b=0;b<I;b+=1)V.push(e[b].animation);return V}function d(){s+=1,L()}function p(){s-=1}function f(b,I){b.addEventListener("destroy",l),b.addEventListener("_active",d),b.addEventListener("_idle",p),e.push({elem:I,animation:b}),a+=1}function m(b){var I=new AnimationItem;return f(I,null),I.setParams(b),I}function P(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setSpeed(b,I)}function T(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setDirection(b,I)}function x(b){var I;for(I=0;I<a;I+=1)e[I].animation.play(b)}function y(b){var I=b-i,V;for(V=0;V<a;V+=1)e[V].animation.advanceTime(I);i=b,s&&!o?window.requestAnimationFrame(y):r=!0}function S(b){i=b,window.requestAnimationFrame(y)}function g(b){var I;for(I=0;I<a;I+=1)e[I].animation.pause(b)}function C(b,I,V){var A;for(A=0;A<a;A+=1)e[A].animation.goToAndStop(b,I,V)}function E(b){var I;for(I=0;I<a;I+=1)e[I].animation.stop(b)}function B(b){var I;for(I=0;I<a;I+=1)e[I].animation.togglePause(b)}function _(b){var I;for(I=a-1;I>=0;I-=1)e[I].animation.destroy(b)}function M(b,I,V){var A=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),k,R=A.length;for(k=0;k<R;k+=1)V&&A[k].setAttribute("data-bm-type",V),u(A[k],b);if(I&&R===0){V||(V="svg");var G=document.getElementsByTagName("body")[0];G.innerText="";var z=createTag("div");z.style.width="100%",z.style.height="100%",z.setAttribute("data-bm-type",V),G.appendChild(z),u(z,b)}}function D(){var b;for(b=0;b<a;b+=1)e[b].animation.resize()}function L(){!o&&s&&r&&(window.requestAnimationFrame(S),r=!1)}function N(){o=!0}function F(){o=!1,L()}function H(b,I){var V;for(V=0;V<a;V+=1)e[V].animation.setVolume(b,I)}function $(b){var I;for(I=0;I<a;I+=1)e[I].animation.mute(b)}function O(b){var I;for(I=0;I<a;I+=1)e[I].animation.unmute(b)}return n.registerAnimation=u,n.loadAnimation=m,n.setSpeed=P,n.setDirection=T,n.play=x,n.pause=g,n.stop=E,n.togglePause=B,n.searchAnimations=M,n.resize=D,n.goToAndStop=C,n.destroy=_,n.freeze=N,n.unfreeze=F,n.setVolume=H,n.mute=$,n.unmute=O,n.getRegisteredAnimations=c,n}(),BezierFactory=function(){var n={};n.getBezierEasing=i;var e={};function i(S,g,C,E,B){var _=B||("bez_"+S+"_"+g+"_"+C+"_"+E).replace(/\./g,"p");if(e[_])return e[_];var M=new y([S,g,C,E]);return e[_]=M,M}var a=4,s=.001,r=1e-7,o=10,l=11,u=1/(l-1),c=typeof Float32Array=="function";function d(S,g){return 1-3*g+3*S}function p(S,g){return 3*g-6*S}function f(S){return 3*S}function m(S,g,C){return((d(g,C)*S+p(g,C))*S+f(g))*S}function P(S,g,C){return 3*d(g,C)*S*S+2*p(g,C)*S+f(g)}function T(S,g,C,E,B){var _,M,D=0;do M=g+(C-g)/2,_=m(M,E,B)-S,_>0?C=M:g=M;while(Math.abs(_)>r&&++D<o);return M}function x(S,g,C,E){for(var B=0;B<a;++B){var _=P(g,C,E);if(_===0)return g;var M=m(g,C,E)-S;g-=M/_}return g}function y(S){this._p=S,this._mSampleValues=c?new Float32Array(l):new Array(l),this._precomputed=!1,this.get=this.get.bind(this)}return y.prototype={get:function(g){var C=this._p[0],E=this._p[1],B=this._p[2],_=this._p[3];return this._precomputed||this._precompute(),C===E&&B===_?g:g===0?0:g===1?1:m(this._getTForX(g),E,_)},_precompute:function(){var g=this._p[0],C=this._p[1],E=this._p[2],B=this._p[3];this._precomputed=!0,(g!==C||E!==B)&&this._calcSampleValues()},_calcSampleValues:function(){for(var g=this._p[0],C=this._p[2],E=0;E<l;++E)this._mSampleValues[E]=m(E*u,g,C)},_getTForX:function(g){for(var C=this._p[0],E=this._p[2],B=this._mSampleValues,_=0,M=1,D=l-1;M!==D&&B[M]<=g;++M)_+=u;--M;var L=(g-B[M])/(B[M+1]-B[M]),N=_+L*u,F=P(N,C,E);return F>=s?x(g,N,C,E):F===0?N:T(g,_,_+u,C,E)}},n}(),pooling=function(){function n(e){return e.concat(createSizedArray(e.length))}return{double:n}}(),poolFactory=function(){return function(n,e,i){var a=0,s=n,r=createSizedArray(s),o={newElement:l,release:u};function l(){var c;return a?(a-=1,c=r[a]):c=e(),c}function u(c){a===s&&(r=pooling.double(r),s*=2),i&&i(c),r[a]=c,a+=1}return o}}(),bezierLengthPool=function(){function n(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,n)}(),segmentsLengthPool=function(){function n(){return{lengths:[],totalLength:0}}function e(i){var a,s=i.lengths.length;for(a=0;a<s;a+=1)bezierLengthPool.release(i.lengths[a]);i.lengths.length=0}return poolFactory(8,n,e)}();function bezFunction(){var n=Math;function e(f,m,P,T,x,y){var S=f*T+m*x+P*y-x*T-y*f-P*m;return S>-.001&&S<.001}function i(f,m,P,T,x,y,S,g,C){if(P===0&&y===0&&C===0)return e(f,m,T,x,S,g);var E=n.sqrt(n.pow(T-f,2)+n.pow(x-m,2)+n.pow(y-P,2)),B=n.sqrt(n.pow(S-f,2)+n.pow(g-m,2)+n.pow(C-P,2)),_=n.sqrt(n.pow(S-T,2)+n.pow(g-x,2)+n.pow(C-y,2)),M;return E>B?E>_?M=E-B-_:M=_-B-E:_>B?M=_-B-E:M=B-E-_,M>-1e-4&&M<1e-4}var a=function(){return function(f,m,P,T){var x=getDefaultCurveSegments(),y,S,g,C,E,B=0,_,M=[],D=[],L=bezierLengthPool.newElement();for(g=P.length,y=0;y<x;y+=1){for(E=y/(x-1),_=0,S=0;S<g;S+=1)C=bmPow(1-E,3)*f[S]+3*bmPow(1-E,2)*E*P[S]+3*(1-E)*bmPow(E,2)*T[S]+bmPow(E,3)*m[S],M[S]=C,D[S]!==null&&(_+=bmPow(M[S]-D[S],2)),D[S]=M[S];_&&(_=bmSqrt(_),B+=_),L.percents[y]=E,L.lengths[y]=B}return L.addedLength=B,L}}();function s(f){var m=segmentsLengthPool.newElement(),P=f.c,T=f.v,x=f.o,y=f.i,S,g=f._length,C=m.lengths,E=0;for(S=0;S<g-1;S+=1)C[S]=a(T[S],T[S+1],x[S],y[S+1]),E+=C[S].addedLength;return P&&g&&(C[S]=a(T[S],T[0],x[S],y[0]),E+=C[S].addedLength),m.totalLength=E,m}function r(f){this.segmentLength=0,this.points=new Array(f)}function o(f,m){this.partialLength=f,this.point=m}var l=function(){var f={};return function(m,P,T,x){var y=(m[0]+"_"+m[1]+"_"+P[0]+"_"+P[1]+"_"+T[0]+"_"+T[1]+"_"+x[0]+"_"+x[1]).replace(/\./g,"p");if(!f[y]){var S=getDefaultCurveSegments(),g,C,E,B,_,M=0,D,L,N=null;m.length===2&&(m[0]!==P[0]||m[1]!==P[1])&&e(m[0],m[1],P[0],P[1],m[0]+T[0],m[1]+T[1])&&e(m[0],m[1],P[0],P[1],P[0]+x[0],P[1]+x[1])&&(S=2);var F=new r(S);for(E=T.length,g=0;g<S;g+=1){for(L=createSizedArray(E),_=g/(S-1),D=0,C=0;C<E;C+=1)B=bmPow(1-_,3)*m[C]+3*bmPow(1-_,2)*_*(m[C]+T[C])+3*(1-_)*bmPow(_,2)*(P[C]+x[C])+bmPow(_,3)*P[C],L[C]=B,N!==null&&(D+=bmPow(L[C]-N[C],2));D=bmSqrt(D),M+=D,F.points[g]=new o(D,L),N=L}F.segmentLength=M,f[y]=F}return f[y]}}();function u(f,m){var P=m.percents,T=m.lengths,x=P.length,y=bmFloor((x-1)*f),S=f*m.addedLength,g=0;if(y===x-1||y===0||S===T[y])return P[y];for(var C=T[y]>S?-1:1,E=!0;E;)if(T[y]<=S&&T[y+1]>S?(g=(S-T[y])/(T[y+1]-T[y]),E=!1):y+=C,y<0||y>=x-1){if(y===x-1)return P[y];E=!1}return P[y]+(P[y+1]-P[y])*g}function c(f,m,P,T,x,y){var S=u(x,y),g=1-S,C=n.round((g*g*g*f[0]+(S*g*g+g*S*g+g*g*S)*P[0]+(S*S*g+g*S*S+S*g*S)*T[0]+S*S*S*m[0])*1e3)/1e3,E=n.round((g*g*g*f[1]+(S*g*g+g*S*g+g*g*S)*P[1]+(S*S*g+g*S*S+S*g*S)*T[1]+S*S*S*m[1])*1e3)/1e3;return[C,E]}var d=createTypedArray("float32",8);function p(f,m,P,T,x,y,S){x<0?x=0:x>1&&(x=1);var g=u(x,S);y=y>1?1:y;var C=u(y,S),E,B=f.length,_=1-g,M=1-C,D=_*_*_,L=g*_*_*3,N=g*g*_*3,F=g*g*g,H=_*_*M,$=g*_*M+_*g*M+_*_*C,O=g*g*M+_*g*C+g*_*C,b=g*g*C,I=_*M*M,V=g*M*M+_*C*M+_*M*C,A=g*C*M+_*C*C+g*M*C,k=g*C*C,R=M*M*M,G=C*M*M+M*C*M+M*M*C,z=C*C*M+M*C*C+C*M*C,q=C*C*C;for(E=0;E<B;E+=1)d[E*4]=n.round((D*f[E]+L*P[E]+N*T[E]+F*m[E])*1e3)/1e3,d[E*4+1]=n.round((H*f[E]+$*P[E]+O*T[E]+b*m[E])*1e3)/1e3,d[E*4+2]=n.round((I*f[E]+V*P[E]+A*T[E]+k*m[E])*1e3)/1e3,d[E*4+3]=n.round((R*f[E]+G*P[E]+z*T[E]+q*m[E])*1e3)/1e3;return d}return{getSegmentsLength:s,getNewSegment:p,getPointInSegment:c,buildBezierData:l,pointOnLine2D:e,pointOnLine3D:i}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(n,e){var i=this.offsetTime,a;this.propType==="multidimensional"&&(a=createTypedArray("float32",this.pv.length));for(var s=e.lastIndex,r=s,o=this.keyframes.length-1,l=!0,u,c,d;l;){if(u=this.keyframes[r],c=this.keyframes[r+1],r===o-1&&n>=c.t-i){u.h&&(u=c),s=0;break}if(c.t-i>n){s=r;break}r<o-1?r+=1:(s=0,l=!1)}d=this.keyframesMetadata[r]||{};var p,f,m,P,T,x,y=c.t-i,S=u.t-i,g;if(u.to){d.bezierData||(d.bezierData=bez.buildBezierData(u.s,c.s||u.e,u.to,u.ti));var C=d.bezierData;if(n>=y||n<S){var E=n>=y?C.points.length-1:0;for(f=C.points[E].point.length,p=0;p<f;p+=1)a[p]=C.points[E].point[p]}else{d.__fnct?x=d.__fnct:(x=BezierFactory.getBezierEasing(u.o.x,u.o.y,u.i.x,u.i.y,u.n).get,d.__fnct=x),m=x((n-S)/(y-S));var B=C.segmentLength*m,_,M=e.lastFrame<n&&e._lastKeyframeIndex===r?e._lastAddedLength:0;for(T=e.lastFrame<n&&e._lastKeyframeIndex===r?e._lastPoint:0,l=!0,P=C.points.length;l;){if(M+=C.points[T].partialLength,B===0||m===0||T===C.points.length-1){for(f=C.points[T].point.length,p=0;p<f;p+=1)a[p]=C.points[T].point[p];break}else if(B>=M&&B<M+C.points[T+1].partialLength){for(_=(B-M)/C.points[T+1].partialLength,f=C.points[T].point.length,p=0;p<f;p+=1)a[p]=C.points[T].point[p]+(C.points[T+1].point[p]-C.points[T].point[p])*_;break}T<P-1?T+=1:l=!1}e._lastPoint=T,e._lastAddedLength=M-C.points[T].partialLength,e._lastKeyframeIndex=r}}else{var D,L,N,F,H;if(o=u.s.length,g=c.s||u.e,this.sh&&u.h!==1)if(n>=y)a[0]=g[0],a[1]=g[1],a[2]=g[2];else if(n<=S)a[0]=u.s[0],a[1]=u.s[1],a[2]=u.s[2];else{var $=createQuaternion(u.s),O=createQuaternion(g),b=(n-S)/(y-S);quaternionToEuler(a,slerp($,O,b))}else for(r=0;r<o;r+=1)u.h!==1&&(n>=y?m=1:n<S?m=0:(u.o.x.constructor===Array?(d.__fnct||(d.__fnct=[]),d.__fnct[r]?x=d.__fnct[r]:(D=u.o.x[r]===void 0?u.o.x[0]:u.o.x[r],L=u.o.y[r]===void 0?u.o.y[0]:u.o.y[r],N=u.i.x[r]===void 0?u.i.x[0]:u.i.x[r],F=u.i.y[r]===void 0?u.i.y[0]:u.i.y[r],x=BezierFactory.getBezierEasing(D,L,N,F).get,d.__fnct[r]=x)):d.__fnct?x=d.__fnct:(D=u.o.x,L=u.o.y,N=u.i.x,F=u.i.y,x=BezierFactory.getBezierEasing(D,L,N,F).get,u.keyframeMetadata=x),m=x((n-S)/(y-S)))),g=c.s||u.e,H=u.h===1?u.s[r]:u.s[r]+(g[r]-u.s[r])*m,this.propType==="multidimensional"?a[r]=H:a=H}return e.lastIndex=s,a}function slerp(n,e,i){var a=[],s=n[0],r=n[1],o=n[2],l=n[3],u=e[0],c=e[1],d=e[2],p=e[3],f,m,P,T,x;return m=s*u+r*c+o*d+l*p,m<0&&(m=-m,u=-u,c=-c,d=-d,p=-p),1-m>1e-6?(f=Math.acos(m),P=Math.sin(f),T=Math.sin((1-i)*f)/P,x=Math.sin(i*f)/P):(T=1-i,x=i),a[0]=T*s+x*u,a[1]=T*r+x*c,a[2]=T*o+x*d,a[3]=T*l+x*p,a}function quaternionToEuler(n,e){var i=e[0],a=e[1],s=e[2],r=e[3],o=Math.atan2(2*a*r-2*i*s,1-2*a*a-2*s*s),l=Math.asin(2*i*a+2*s*r),u=Math.atan2(2*i*r-2*a*s,1-2*i*i-2*s*s);n[0]=o/degToRads,n[1]=l/degToRads,n[2]=u/degToRads}function createQuaternion(n){var e=n[0]*degToRads,i=n[1]*degToRads,a=n[2]*degToRads,s=Math.cos(e/2),r=Math.cos(i/2),o=Math.cos(a/2),l=Math.sin(e/2),u=Math.sin(i/2),c=Math.sin(a/2),d=s*r*o-l*u*c,p=l*u*o+s*r*c,f=l*r*o+s*u*c,m=s*u*o-l*r*c;return[p,f,m,d]}function getValueAtCurrentTime(){var n=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,i=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(n===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=i&&n>=i||this._caching.lastFrame<e&&n<e))){this._caching.lastFrame>=n&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var a=this.interpolateValue(n,this._caching);this.pv=a}return this._caching.lastFrame=n,this.pv}function setVValue(n){var e;if(this.propType==="unidimensional")e=n*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var i=0,a=this.v.length;i<a;)e=n[i]*this.mult,mathAbs(this.v[i]-e)>1e-5&&(this.v[i]=e,this._mdf=!0),i+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var n,e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(n=0;n<e;n+=1)i=this.effectsSequence[n](i);this.setVValue(i),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(n){this.effectsSequence.push(n),this.container.addDynamicProperty(this)}function ValueProperty(n,e,i,a){this.propType="unidimensional",this.mult=i||1,this.data=e,this.v=i?e.k*i:e.k,this.pv=e.k,this._mdf=!1,this.elem=n,this.container=a,this.comp=n.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(n,e,i,a){this.propType="multidimensional",this.mult=i||1,this.data=e,this._mdf=!1,this.elem=n,this.container=a,this.comp=n.comp,this.k=!1,this.kf=!1,this.frameId=-1;var s,r=e.k.length;for(this.v=createTypedArray("float32",r),this.pv=createTypedArray("float32",r),this.vel=createTypedArray("float32",r),s=0;s<r;s+=1)this.v[s]=e.k[s]*this.mult,this.pv[s]=e.k[s];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(n,e,i,a){this.propType="unidimensional",this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=i||1,this.elem=n,this.container=a,this.comp=n.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(n,e,i,a){this.propType="multidimensional";var s,r=e.k.length,o,l,u,c;for(s=0;s<r-1;s+=1)e.k[s].to&&e.k[s].s&&e.k[s+1]&&e.k[s+1].s&&(o=e.k[s].s,l=e.k[s+1].s,u=e.k[s].to,c=e.k[s].ti,(o.length===2&&!(o[0]===l[0]&&o[1]===l[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],o[0]+u[0],o[1]+u[1])&&bez.pointOnLine2D(o[0],o[1],l[0],l[1],l[0]+c[0],l[1]+c[1])||o.length===3&&!(o[0]===l[0]&&o[1]===l[1]&&o[2]===l[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],o[0]+u[0],o[1]+u[1],o[2]+u[2])&&bez.pointOnLine3D(o[0],o[1],o[2],l[0],l[1],l[2],l[0]+c[0],l[1]+c[1],l[2]+c[2]))&&(e.k[s].to=null,e.k[s].ti=null),o[0]===l[0]&&o[1]===l[1]&&u[0]===0&&u[1]===0&&c[0]===0&&c[1]===0&&(o.length===2||o[2]===l[2]&&u[2]===0&&c[2]===0)&&(e.k[s].to=null,e.k[s].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=n.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=i||1,this.elem=n,this.container=a,this.comp=n.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var d=e.k[0].s.length;for(this.v=createTypedArray("float32",d),this.pv=createTypedArray("float32",d),s=0;s<d;s+=1)this.v[s]=initFrame,this.pv[s]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",d)},this.addEffect=addEffect}var PropertyFactory=function(){function n(i,a,s,r,o){a.sid&&(a=i.globalData.slotManager.getProp(a));var l;if(!a.k.length)l=new ValueProperty(i,a,r,o);else if(typeof a.k[0]=="number")l=new MultiDimensionalProperty(i,a,r,o);else switch(s){case 0:l=new KeyframedValueProperty(i,a,r,o);break;case 1:l=new KeyframedMultidimensionalProperty(i,a,r,o);break}return l.effectsSequence.length&&o.addDynamicProperty(l),l}var e={getProp:n};return e}();function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&(this.dynamicProperties.push(e),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var e,i=this.dynamicProperties.length;for(e=0;e<i;e+=1)this.dynamicProperties[e].getValue(),this.dynamicProperties[e]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(e){this.container=e,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=function(){function n(){return createTypedArray("float32",2)}return poolFactory(8,n)}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(n,e){this.c=n,this.setLength(e);for(var i=0;i<e;)this.v[i]=pointPool.newElement(),this.o[i]=pointPool.newElement(),this.i[i]=pointPool.newElement(),i+=1},ShapePath.prototype.setLength=function(n){for(;this._maxLength<n;)this.doubleArrayLength();this._length=n},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(n,e,i,a,s){var r;switch(this._length=Math.max(this._length,a+1),this._length>=this._maxLength&&this.doubleArrayLength(),i){case"v":r=this.v;break;case"i":r=this.i;break;case"o":r=this.o;break;default:r=[];break}(!r[a]||r[a]&&!s)&&(r[a]=pointPool.newElement()),r[a][0]=n,r[a][1]=e},ShapePath.prototype.setTripleAt=function(n,e,i,a,s,r,o,l){this.setXYAt(n,e,"v",o,l),this.setXYAt(i,a,"o",o,l),this.setXYAt(s,r,"i",o,l)},ShapePath.prototype.reverse=function(){var n=new ShapePath;n.setPathData(this.c,this._length);var e=this.v,i=this.o,a=this.i,s=0;this.c&&(n.setTripleAt(e[0][0],e[0][1],a[0][0],a[0][1],i[0][0],i[0][1],0,!1),s=1);var r=this._length-1,o=this._length,l;for(l=s;l<o;l+=1)n.setTripleAt(e[r][0],e[r][1],a[r][0],a[r][1],i[r][0],i[r][1],l,!1),r-=1;return n},ShapePath.prototype.length=function(){return this._length};var shapePool=function(){function n(){return new ShapePath}function e(s){var r=s._length,o;for(o=0;o<r;o+=1)pointPool.release(s.v[o]),pointPool.release(s.i[o]),pointPool.release(s.o[o]),s.v[o]=null,s.i[o]=null,s.o[o]=null;s._length=0,s.c=!1}function i(s){var r=a.newElement(),o,l=s._length===void 0?s.v.length:s._length;for(r.setLength(l),r.c=s.c,o=0;o<l;o+=1)r.setTripleAt(s.v[o][0],s.v[o][1],s.o[o][0],s.o[o][1],s.i[o][0],s.i[o][1],o);return r}var a=poolFactory(4,n,e);return a.clone=i,a}();function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(n){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=n,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var n;for(n=0;n<this._length;n+=1)shapePool.release(this.shapes[n]);this._length=0};var shapeCollectionPool=function(){var n={newShapeCollection:s,release:r},e=0,i=4,a=createSizedArray(i);function s(){var o;return e?(e-=1,o=a[e]):o=new ShapeCollection,o}function r(o){var l,u=o._length;for(l=0;l<u;l+=1)shapePool.release(o.shapes[l]);o._length=0,e===i&&(a=pooling.double(a),i*=2),a[e]=o,e+=1}return n}(),ShapePropertyFactory=function(){var n=-999999;function e(y,S,g){var C=g.lastIndex,E,B,_,M,D,L,N,F,H,$=this.keyframes;if(y<$[0].t-this.offsetTime)E=$[0].s[0],_=!0,C=0;else if(y>=$[$.length-1].t-this.offsetTime)E=$[$.length-1].s?$[$.length-1].s[0]:$[$.length-2].e[0],_=!0;else{for(var O=C,b=$.length-1,I=!0,V,A,k;I&&(V=$[O],A=$[O+1],!(A.t-this.offsetTime>y));)O<b-1?O+=1:I=!1;if(k=this.keyframesMetadata[O]||{},_=V.h===1,C=O,!_){if(y>=A.t-this.offsetTime)F=1;else if(y<V.t-this.offsetTime)F=0;else{var R;k.__fnct?R=k.__fnct:(R=BezierFactory.getBezierEasing(V.o.x,V.o.y,V.i.x,V.i.y).get,k.__fnct=R),F=R((y-(V.t-this.offsetTime))/(A.t-this.offsetTime-(V.t-this.offsetTime)))}B=A.s?A.s[0]:V.e[0]}E=V.s[0]}for(L=S._length,N=E.i[0].length,g.lastIndex=C,M=0;M<L;M+=1)for(D=0;D<N;D+=1)H=_?E.i[M][D]:E.i[M][D]+(B.i[M][D]-E.i[M][D])*F,S.i[M][D]=H,H=_?E.o[M][D]:E.o[M][D]+(B.o[M][D]-E.o[M][D])*F,S.o[M][D]=H,H=_?E.v[M][D]:E.v[M][D]+(B.v[M][D]-E.v[M][D])*F,S.v[M][D]=H}function i(){var y=this.comp.renderedFrame-this.offsetTime,S=this.keyframes[0].t-this.offsetTime,g=this.keyframes[this.keyframes.length-1].t-this.offsetTime,C=this._caching.lastFrame;return C!==n&&(C<S&&y<S||C>g&&y>g)||(this._caching.lastIndex=C<y?this._caching.lastIndex:0,this.interpolateShape(y,this.pv,this._caching)),this._caching.lastFrame=y,this.pv}function a(){this.paths=this.localShapeCollection}function s(y,S){if(y._length!==S._length||y.c!==S.c)return!1;var g,C=y._length;for(g=0;g<C;g+=1)if(y.v[g][0]!==S.v[g][0]||y.v[g][1]!==S.v[g][1]||y.o[g][0]!==S.o[g][0]||y.o[g][1]!==S.o[g][1]||y.i[g][0]!==S.i[g][0]||y.i[g][1]!==S.i[g][1])return!1;return!0}function r(y){s(this.v,y)||(this.v=shapePool.clone(y),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function o(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var y;this.kf?y=this.pv:this.data.ks?y=this.data.ks.k:y=this.data.pt.k;var S,g=this.effectsSequence.length;for(S=0;S<g;S+=1)y=this.effectsSequence[S](y);this.setVValue(y),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function l(y,S,g){this.propType="shape",this.comp=y.comp,this.container=y,this.elem=y,this.data=S,this.k=!1,this.kf=!1,this._mdf=!1;var C=g===3?S.pt.k:S.ks.k;this.v=shapePool.clone(C),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=a,this.effectsSequence=[]}function u(y){this.effectsSequence.push(y),this.container.addDynamicProperty(this)}l.prototype.interpolateShape=e,l.prototype.getValue=o,l.prototype.setVValue=r,l.prototype.addEffect=u;function c(y,S,g){this.propType="shape",this.comp=y.comp,this.elem=y,this.container=y,this.offsetTime=y.data.st,this.keyframes=g===3?S.pt.k:S.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var C=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,C),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=n,this.reset=a,this._caching={lastFrame:n,lastIndex:0},this.effectsSequence=[i.bind(this)]}c.prototype.getValue=o,c.prototype.interpolateShape=e,c.prototype.setVValue=r,c.prototype.addEffect=u;var d=function(){var y=roundCorner;function S(g,C){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=C.d,this.elem=g,this.comp=g.comp,this.frameId=-1,this.initDynamicPropertyContainer(g),this.p=PropertyFactory.getProp(g,C.p,1,0,this),this.s=PropertyFactory.getProp(g,C.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return S.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var C=this.p.v[0],E=this.p.v[1],B=this.s.v[0]/2,_=this.s.v[1]/2,M=this.d!==3,D=this.v;D.v[0][0]=C,D.v[0][1]=E-_,D.v[1][0]=M?C+B:C-B,D.v[1][1]=E,D.v[2][0]=C,D.v[2][1]=E+_,D.v[3][0]=M?C-B:C+B,D.v[3][1]=E,D.i[0][0]=M?C-B*y:C+B*y,D.i[0][1]=E-_,D.i[1][0]=M?C+B:C-B,D.i[1][1]=E-_*y,D.i[2][0]=M?C+B*y:C-B*y,D.i[2][1]=E+_,D.i[3][0]=M?C-B:C+B,D.i[3][1]=E+_*y,D.o[0][0]=M?C+B*y:C-B*y,D.o[0][1]=E-_,D.o[1][0]=M?C+B:C-B,D.o[1][1]=E+_*y,D.o[2][0]=M?C-B*y:C+B*y,D.o[2][1]=E+_,D.o[3][0]=M?C-B:C+B,D.o[3][1]=E-_*y}},extendPrototype([DynamicPropertyContainer],S),S}(),p=function(){function y(S,g){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=S,this.comp=S.comp,this.data=g,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(S),g.sy===1?(this.ir=PropertyFactory.getProp(S,g.ir,0,0,this),this.is=PropertyFactory.getProp(S,g.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(S,g.pt,0,0,this),this.p=PropertyFactory.getProp(S,g.p,1,0,this),this.r=PropertyFactory.getProp(S,g.r,0,degToRads,this),this.or=PropertyFactory.getProp(S,g.or,0,0,this),this.os=PropertyFactory.getProp(S,g.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return y.prototype={reset:a,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var g=Math.floor(this.pt.v)*2,C=Math.PI*2/g,E=!0,B=this.or.v,_=this.ir.v,M=this.os.v,D=this.is.v,L=2*Math.PI*B/(g*2),N=2*Math.PI*_/(g*2),F,H,$,O,b=-Math.PI/2;b+=this.r.v;var I=this.data.d===3?-1:1;for(this.v._length=0,F=0;F<g;F+=1){H=E?B:_,$=E?M:D,O=E?L:N;var V=H*Math.cos(b),A=H*Math.sin(b),k=V===0&&A===0?0:A/Math.sqrt(V*V+A*A),R=V===0&&A===0?0:-V/Math.sqrt(V*V+A*A);V+=+this.p.v[0],A+=+this.p.v[1],this.v.setTripleAt(V,A,V-k*O*$*I,A-R*O*$*I,V+k*O*$*I,A+R*O*$*I,F,!0),E=!E,b+=C*I}},convertPolygonToPath:function(){var g=Math.floor(this.pt.v),C=Math.PI*2/g,E=this.or.v,B=this.os.v,_=2*Math.PI*E/(g*4),M,D=-Math.PI*.5,L=this.data.d===3?-1:1;for(D+=this.r.v,this.v._length=0,M=0;M<g;M+=1){var N=E*Math.cos(D),F=E*Math.sin(D),H=N===0&&F===0?0:F/Math.sqrt(N*N+F*F),$=N===0&&F===0?0:-N/Math.sqrt(N*N+F*F);N+=+this.p.v[0],F+=+this.p.v[1],this.v.setTripleAt(N,F,N-H*_*B*L,F-$*_*B*L,N+H*_*B*L,F+$*_*B*L,M,!0),D+=C*L}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],y),y}(),f=function(){function y(S,g){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=S,this.comp=S.comp,this.frameId=-1,this.d=g.d,this.initDynamicPropertyContainer(S),this.p=PropertyFactory.getProp(S,g.p,1,0,this),this.s=PropertyFactory.getProp(S,g.s,1,0,this),this.r=PropertyFactory.getProp(S,g.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return y.prototype={convertRectToPath:function(){var g=this.p.v[0],C=this.p.v[1],E=this.s.v[0]/2,B=this.s.v[1]/2,_=bmMin(E,B,this.r.v),M=_*(1-roundCorner);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(g+E,C-B+_,g+E,C-B+_,g+E,C-B+M,0,!0),this.v.setTripleAt(g+E,C+B-_,g+E,C+B-M,g+E,C+B-_,1,!0),_!==0?(this.v.setTripleAt(g+E-_,C+B,g+E-_,C+B,g+E-M,C+B,2,!0),this.v.setTripleAt(g-E+_,C+B,g-E+M,C+B,g-E+_,C+B,3,!0),this.v.setTripleAt(g-E,C+B-_,g-E,C+B-_,g-E,C+B-M,4,!0),this.v.setTripleAt(g-E,C-B+_,g-E,C-B+M,g-E,C-B+_,5,!0),this.v.setTripleAt(g-E+_,C-B,g-E+_,C-B,g-E+M,C-B,6,!0),this.v.setTripleAt(g+E-_,C-B,g+E-M,C-B,g+E-_,C-B,7,!0)):(this.v.setTripleAt(g-E,C+B,g-E+M,C+B,g-E,C+B,2),this.v.setTripleAt(g-E,C-B,g-E,C-B+M,g-E,C-B,3))):(this.v.setTripleAt(g+E,C-B+_,g+E,C-B+M,g+E,C-B+_,0,!0),_!==0?(this.v.setTripleAt(g+E-_,C-B,g+E-_,C-B,g+E-M,C-B,1,!0),this.v.setTripleAt(g-E+_,C-B,g-E+M,C-B,g-E+_,C-B,2,!0),this.v.setTripleAt(g-E,C-B+_,g-E,C-B+_,g-E,C-B+M,3,!0),this.v.setTripleAt(g-E,C+B-_,g-E,C+B-M,g-E,C+B-_,4,!0),this.v.setTripleAt(g-E+_,C+B,g-E+_,C+B,g-E+M,C+B,5,!0),this.v.setTripleAt(g+E-_,C+B,g+E-M,C+B,g+E-_,C+B,6,!0),this.v.setTripleAt(g+E,C+B-_,g+E,C+B-_,g+E,C+B-M,7,!0)):(this.v.setTripleAt(g-E,C-B,g-E+M,C-B,g-E,C-B,1,!0),this.v.setTripleAt(g-E,C+B,g-E,C+B-M,g-E,C+B,2,!0),this.v.setTripleAt(g+E,C+B,g+E-M,C+B,g+E,C+B,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:a},extendPrototype([DynamicPropertyContainer],y),y}();function m(y,S,g){var C;if(g===3||g===4){var E=g===3?S.pt:S.ks,B=E.k;B.length?C=new c(y,S,g):C=new l(y,S,g)}else g===5?C=new f(y,S):g===6?C=new d(y,S):g===7&&(C=new p(y,S));return C.k&&y.addDynamicProperty(C),C}function P(){return l}function T(){return c}var x={};return x.getShapeProp=m,x.getConstructorFunction=P,x.getKeyframedConstructorFunction=T,x}();/*!
|
|
151
151
|
Transformation Matrix v2.0
|
|
152
152
|
(c) Epistemex 2014-2015
|
|
153
153
|
www.epistemex.com
|
|
154
154
|
By Ken Fyrstenberg
|
|
155
155
|
Contributions by leeoniya.
|
|
156
156
|
License: MIT, header required.
|
|
157
|
-
*/var Matrix=function(){var n=Math.cos,e=Math.sin,i=Math.tan,a=Math.round;function s(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function r(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,-k,0,0,k,A,0,0,0,0,1,0,0,0,0,1)}function o(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(1,0,0,0,0,A,-k,0,0,k,A,0,0,0,0,1)}function l(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,0,k,0,0,1,0,0,-k,0,A,0,0,0,0,1)}function u(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,-k,0,0,k,A,0,0,0,0,1,0,0,0,0,1)}function c(V,A){return this._t(1,A,V,1,0,0)}function d(V,A){return this.shear(i(V),i(A))}function p(V,A){var k=n(A),R=e(A);return this._t(k,R,0,0,-R,k,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,i(V),1,0,0,0,0,1,0,0,0,0,1)._t(k,-R,0,0,R,k,0,0,0,0,1,0,0,0,0,1)}function f(V,A,k){return!k&&k!==0&&(k=1),V===1&&A===1&&k===1?this:this._t(V,0,0,0,0,A,0,0,0,0,k,0,0,0,0,1)}function m(V,A,k,R,G,z,q,U,K,Q,ne,Ee,ye,ge,xe,oe){return this.props[0]=V,this.props[1]=A,this.props[2]=k,this.props[3]=R,this.props[4]=G,this.props[5]=z,this.props[6]=q,this.props[7]=U,this.props[8]=K,this.props[9]=Q,this.props[10]=ne,this.props[11]=Ee,this.props[12]=ye,this.props[13]=ge,this.props[14]=xe,this.props[15]=oe,this}function P(V,A,k){return k=k||0,V!==0||A!==0||k!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,V,A,k,1):this}function T(V,A,k,R,G,z,q,U,K,Q,ne,Ee,ye,ge,xe,oe){var Y=this.props;if(V===1&&A===0&&k===0&&R===0&&G===0&&z===1&&q===0&&U===0&&K===0&&Q===0&&ne===1&&Ee===0)return Y[12]=Y[12]*V+Y[15]*ye,Y[13]=Y[13]*z+Y[15]*ge,Y[14]=Y[14]*ne+Y[15]*xe,Y[15]*=oe,this._identityCalculated=!1,this;var Ne=Y[0],Oe=Y[1],Le=Y[2],Ce=Y[3],De=Y[4],ae=Y[5],re=Y[6],de=Y[7],Be=Y[8],he=Y[9],Ie=Y[10],Ae=Y[11],we=Y[12],fe=Y[13],ke=Y[14],pe=Y[15];return Y[0]=Ne*V+Oe*G+Le*K+Ce*ye,Y[1]=Ne*A+Oe*z+Le*Q+Ce*ge,Y[2]=Ne*k+Oe*q+Le*ne+Ce*xe,Y[3]=Ne*R+Oe*U+Le*Ee+Ce*oe,Y[4]=De*V+ae*G+re*K+de*ye,Y[5]=De*A+ae*z+re*Q+de*ge,Y[6]=De*k+ae*q+re*ne+de*xe,Y[7]=De*R+ae*U+re*Ee+de*oe,Y[8]=Be*V+he*G+Ie*K+Ae*ye,Y[9]=Be*A+he*z+Ie*Q+Ae*ge,Y[10]=Be*k+he*q+Ie*ne+Ae*xe,Y[11]=Be*R+he*U+Ie*Ee+Ae*oe,Y[12]=we*V+fe*G+ke*K+pe*ye,Y[13]=we*A+fe*z+ke*Q+pe*ge,Y[14]=we*k+fe*q+ke*ne+pe*xe,Y[15]=we*R+fe*U+ke*Ee+pe*oe,this._identityCalculated=!1,this}function x(V){var A=V.props;return this.transform(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15])}function y(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function S(V){for(var A=0;A<16;){if(V.props[A]!==this.props[A])return!1;A+=1}return!0}function g(V){var A;for(A=0;A<16;A+=1)V.props[A]=this.props[A];return V}function C(V){var A;for(A=0;A<16;A+=1)this.props[A]=V[A]}function E(V,A,k){return{x:V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12],y:V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13],z:V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]}}function B(V,A,k){return V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12]}function _(V,A,k){return V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13]}function M(V,A,k){return V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]}function D(){var V=this.props[0]*this.props[5]-this.props[1]*this.props[4],A=this.props[5]/V,k=-this.props[1]/V,R=-this.props[4]/V,G=this.props[0]/V,z=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/V,q=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/V,U=new Matrix;return U.props[0]=A,U.props[1]=k,U.props[4]=R,U.props[5]=G,U.props[12]=z,U.props[13]=q,U}function L(V){var A=this.getInverseMatrix();return A.applyToPointArray(V[0],V[1],V[2]||0)}function F(V){var A,k=V.length,R=[];for(A=0;A<k;A+=1)R[A]=L(V[A]);return R}function N(V,A,k){var R=createTypedArray("float32",6);if(this.isIdentity())R[0]=V[0],R[1]=V[1],R[2]=A[0],R[3]=A[1],R[4]=k[0],R[5]=k[1];else{var G=this.props[0],z=this.props[1],q=this.props[4],U=this.props[5],K=this.props[12],Q=this.props[13];R[0]=V[0]*G+V[1]*q+K,R[1]=V[0]*z+V[1]*U+Q,R[2]=A[0]*G+A[1]*q+K,R[3]=A[0]*z+A[1]*U+Q,R[4]=k[0]*G+k[1]*q+K,R[5]=k[0]*z+k[1]*U+Q}return R}function H(V,A,k){var R;return this.isIdentity()?R=[V,A,k]:R=[V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12],V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13],V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]],R}function $(V,A){if(this.isIdentity())return V+","+A;var k=this.props;return Math.round((V*k[0]+A*k[4]+k[12])*100)/100+","+Math.round((V*k[1]+A*k[5]+k[13])*100)/100}function O(){for(var V=0,A=this.props,k="matrix3d(",R=1e4;V<16;)k+=a(A[V]*R)/R,k+=V===15?")":",",V+=1;return k}function b(V){var A=1e4;return V<1e-6&&V>0||V>-1e-6&&V<0?a(V*A)/A:V}function I(){var V=this.props,A=b(V[0]),k=b(V[1]),R=b(V[4]),G=b(V[5]),z=b(V[12]),q=b(V[13]);return"matrix("+A+","+k+","+R+","+G+","+z+","+q+")"}return function(){this.reset=s,this.rotate=r,this.rotateX=o,this.rotateY=l,this.rotateZ=u,this.skew=d,this.skewFromAxis=p,this.shear=c,this.scale=f,this.setTransform=m,this.translate=P,this.transform=T,this.multiply=x,this.applyToPoint=E,this.applyToX=B,this.applyToY=_,this.applyToZ=M,this.applyToPointArray=H,this.applyToTriplePoints=N,this.applyToPointStringified=$,this.toCSS=O,this.to2dCSS=I,this.clone=g,this.cloneFromProps=C,this.equals=S,this.inversePoints=F,this.inversePoint=L,this.getInverseMatrix=D,this._t=this.transform,this.isIdentity=y,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(n){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(n)}var lottie={};function setLocation(n){setLocationHref(n)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(n){setSubframeEnabled(n)}function setPrefix(n){setIdPrefix(n)}function loadAnimation(n){return animationManager.loadAnimation(n)}function setQuality(n){if(typeof n=="string")switch(n){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(n)&&n>1&&setDefaultCurveSegments(n)}function inBrowser(){return typeof navigator<"u"}function installPlugin(n,e){n==="expressions"&&setExpressionsPlugin(e)}function getFactory(n){switch(n){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.13.0";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(n){for(var e=queryString.split("&"),i=0;i<e.length;i+=1){var a=e[i].split("=");if(decodeURIComponent(a[0])==n)return decodeURIComponent(a[1])}return null}var queryString="";{var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);try{_typeof$3(exports)!=="object"&&(window.bodymovin=lottie)}catch(n){}var ShapeModifiers=function(){var n={},e={};n.registerModifier=i,n.getModifier=a;function i(s,r){e[s]||(e[s]=r)}function a(s,r,o){return new e[s](r,o)}return n}();function ShapeModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(n){if(!this.closed){n.sh.container.addDynamicProperty(n.sh);var e={shape:n.sh,data:n,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&n.setAsAnimated()}},ShapeModifier.prototype.init=function(n,e){this.shapes=[],this.elem=n,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier);function TrimModifier(){}extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(n,e){this.s=PropertyFactory.getProp(n,e.s,0,.01,this),this.e=PropertyFactory.getProp(n,e.e,0,.01,this),this.o=PropertyFactory.getProp(n,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(n){n.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(n,e,i,a,s){var r=[];e<=1?r.push({s:n,e}):n>=1?r.push({s:n-1,e:e-1}):(r.push({s:n,e:1}),r.push({s:0,e:e-1}));var o=[],l,u=r.length,c;for(l=0;l<u;l+=1)if(c=r[l],!(c.e*s<a||c.s*s>a+i)){var d,p;c.s*s<=a?d=0:d=(c.s*s-a)/i,c.e*s>=a+i?p=1:p=(c.e*s-a)/i,o.push([d,p])}return o.length||o.push([0,0]),o},TrimModifier.prototype.releasePathsData=function(n){var e,i=n.length;for(e=0;e<i;e+=1)segmentsLengthPool.release(n[e]);return n.length=0,n},TrimModifier.prototype.processShapes=function(n){var e,i;if(this._mdf||n){var a=this.o.v%360/360;if(a<0&&(a+=1),this.s.v>1?e=1+a:this.s.v<0?e=0+a:e=this.s.v+a,this.e.v>1?i=1+a:this.e.v<0?i=0+a:i=this.e.v+a,e>i){var s=e;e=i,i=s}e=Math.round(e*1e4)*1e-4,i=Math.round(i*1e4)*1e-4,this.sValue=e,this.eValue=i}else e=this.sValue,i=this.eValue;var r,o,l=this.shapes.length,u,c,d,p,f,m=0;if(i===e)for(o=0;o<l;o+=1)this.shapes[o].localShapeCollection.releaseShapes(),this.shapes[o].shape._mdf=!0,this.shapes[o].shape.paths=this.shapes[o].localShapeCollection,this._mdf&&(this.shapes[o].pathsData.length=0);else if(i===1&&e===0||i===0&&e===1){if(this._mdf)for(o=0;o<l;o+=1)this.shapes[o].pathsData.length=0,this.shapes[o].shape._mdf=!0}else{var P=[],T,x;for(o=0;o<l;o+=1)if(T=this.shapes[o],!T.shape._mdf&&!this._mdf&&!n&&this.m!==2)T.shape.paths=T.localShapeCollection;else{if(r=T.shape.paths,c=r._length,f=0,!T.shape._mdf&&T.pathsData.length)f=T.totalShapeLength;else{for(d=this.releasePathsData(T.pathsData),u=0;u<c;u+=1)p=bez.getSegmentsLength(r.shapes[u]),d.push(p),f+=p.totalLength;T.totalShapeLength=f,T.pathsData=d}m+=f,T.shape._mdf=!0}var y=e,S=i,g=0,C;for(o=l-1;o>=0;o-=1)if(T=this.shapes[o],T.shape._mdf){for(x=T.localShapeCollection,x.releaseShapes(),this.m===2&&l>1?(C=this.calculateShapeEdges(e,i,T.totalShapeLength,g,m),g+=T.totalShapeLength):C=[[y,S]],c=C.length,u=0;u<c;u+=1){y=C[u][0],S=C[u][1],P.length=0,S<=1?P.push({s:T.totalShapeLength*y,e:T.totalShapeLength*S}):y>=1?P.push({s:T.totalShapeLength*(y-1),e:T.totalShapeLength*(S-1)}):(P.push({s:T.totalShapeLength*y,e:T.totalShapeLength}),P.push({s:0,e:T.totalShapeLength*(S-1)}));var E=this.addShapes(T,P[0]);if(P[0].s!==P[0].e){if(P.length>1){var B=T.shape.paths.shapes[T.shape.paths._length-1];if(B.c){var _=E.pop();this.addPaths(E,x),E=this.addShapes(T,P[1],_)}else this.addPaths(E,x),E=this.addShapes(T,P[1])}this.addPaths(E,x)}}T.shape.paths=x}}},TrimModifier.prototype.addPaths=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)e.addShape(n[i])},TrimModifier.prototype.addSegment=function(n,e,i,a,s,r,o){s.setXYAt(e[0],e[1],"o",r),s.setXYAt(i[0],i[1],"i",r+1),o&&s.setXYAt(n[0],n[1],"v",r),s.setXYAt(a[0],a[1],"v",r+1)},TrimModifier.prototype.addSegmentFromArray=function(n,e,i,a){e.setXYAt(n[1],n[5],"o",i),e.setXYAt(n[2],n[6],"i",i+1),a&&e.setXYAt(n[0],n[4],"v",i),e.setXYAt(n[3],n[7],"v",i+1)},TrimModifier.prototype.addShapes=function(n,e,i){var a=n.pathsData,s=n.shape.paths.shapes,r,o=n.shape.paths._length,l,u,c=0,d,p,f,m,P=[],T,x=!0;for(i?(p=i._length,T=i._length):(i=shapePool.newElement(),p=0,T=0),P.push(i),r=0;r<o;r+=1){for(f=a[r].lengths,i.c=s[r].c,u=s[r].c?f.length:f.length+1,l=1;l<u;l+=1)if(d=f[l-1],c+d.addedLength<e.s)c+=d.addedLength,i.c=!1;else if(c>e.e){i.c=!1;break}else e.s<=c&&e.e>=c+d.addedLength?(this.addSegment(s[r].v[l-1],s[r].o[l-1],s[r].i[l],s[r].v[l],i,p,x),x=!1):(m=bez.getNewSegment(s[r].v[l-1],s[r].v[l],s[r].o[l-1],s[r].i[l],(e.s-c)/d.addedLength,(e.e-c)/d.addedLength,f[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1),c+=d.addedLength,p+=1;if(s[r].c&&f.length){if(d=f[l-1],c<=e.e){var y=f[l-1].addedLength;e.s<=c&&e.e>=c+y?(this.addSegment(s[r].v[l-1],s[r].o[l-1],s[r].i[0],s[r].v[0],i,p,x),x=!1):(m=bez.getNewSegment(s[r].v[l-1],s[r].v[0],s[r].o[l-1],s[r].i[0],(e.s-c)/y,(e.e-c)/y,f[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1)}else i.c=!1;c+=d.addedLength,p+=1}if(i._length&&(i.setXYAt(i.v[T][0],i.v[T][1],"i",T),i.setXYAt(i.v[i._length-1][0],i.v[i._length-1][1],"o",i._length-1)),c>e.e)break;r<o-1&&(i=shapePool.newElement(),x=!0,P.push(i),p=0)}return P};function PuckerAndBloatModifier(){}extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(n,e){var i=e/100,a=[0,0],s=n._length,r=0;for(r=0;r<s;r+=1)a[0]+=n.v[r][0],a[1]+=n.v[r][1];a[0]/=s,a[1]/=s;var o=shapePool.newElement();o.c=n.c;var l,u,c,d,p,f;for(r=0;r<s;r+=1)l=n.v[r][0]+(a[0]-n.v[r][0])*i,u=n.v[r][1]+(a[1]-n.v[r][1])*i,c=n.o[r][0]+(a[0]-n.o[r][0])*-i,d=n.o[r][1]+(a[1]-n.o[r][1])*-i,p=n.i[r][0]+(a[0]-n.i[r][0])*-i,f=n.i[r][1]+(a[1]-n.i[r][1])*-i,o.setTripleAt(l,u,c,d,p,f,r);return o},PuckerAndBloatModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amount.v;if(o!==0){var l,u;for(i=0;i<a;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,r=l.shape.paths._length,s=0;s<r;s+=1)u.addShape(this.processPath(e[s],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=function(){var n=[0,0];function e(u){var c=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||c,this.a&&u.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&u.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&u.skewFromAxis(-this.sk.v,this.sa.v),this.r?u.rotate(-this.r.v):u.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?u.translate(this.px.v,this.py.v,-this.pz.v):u.translate(this.px.v,this.py.v,0):u.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function i(u){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||u){var c;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var d,p;if(c=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(d=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/c,0),p=this.p.getValueAtTime(this.p.keyframes[0].t/c,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(d=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/c,0),p=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/c,0)):(d=this.p.pv,p=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/c,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){d=[],p=[];var f=this.px,m=this.py;f._caching.lastFrame+f.offsetTime<=f.keyframes[0].t?(d[0]=f.getValueAtTime((f.keyframes[0].t+.01)/c,0),d[1]=m.getValueAtTime((m.keyframes[0].t+.01)/c,0),p[0]=f.getValueAtTime(f.keyframes[0].t/c,0),p[1]=m.getValueAtTime(m.keyframes[0].t/c,0)):f._caching.lastFrame+f.offsetTime>=f.keyframes[f.keyframes.length-1].t?(d[0]=f.getValueAtTime(f.keyframes[f.keyframes.length-1].t/c,0),d[1]=m.getValueAtTime(m.keyframes[m.keyframes.length-1].t/c,0),p[0]=f.getValueAtTime((f.keyframes[f.keyframes.length-1].t-.01)/c,0),p[1]=m.getValueAtTime((m.keyframes[m.keyframes.length-1].t-.01)/c,0)):(d=[f.pv,m.pv],p[0]=f.getValueAtTime((f._caching.lastFrame+f.offsetTime-.01)/c,f.offsetTime),p[1]=m.getValueAtTime((m._caching.lastFrame+m.offsetTime-.01)/c,m.offsetTime))}else p=n,d=p;this.v.rotate(-Math.atan2(d[1]-p[1],d[0]-p[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function a(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function r(u){this._addDynamicProperty(u),this.elem.addDynamicProperty(u),this._isDirty=!0}function o(u,c,d){if(this.elem=u,this.frameId=-1,this.propType="transform",this.data=c,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(d||u),c.p&&c.p.s?(this.px=PropertyFactory.getProp(u,c.p.x,0,0,this),this.py=PropertyFactory.getProp(u,c.p.y,0,0,this),c.p.z&&(this.pz=PropertyFactory.getProp(u,c.p.z,0,0,this))):this.p=PropertyFactory.getProp(u,c.p||{k:[0,0,0]},1,0,this),c.rx){if(this.rx=PropertyFactory.getProp(u,c.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(u,c.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(u,c.rz,0,degToRads,this),c.or.k[0].ti){var p,f=c.or.k.length;for(p=0;p<f;p+=1)c.or.k[p].to=null,c.or.k[p].ti=null}this.or=PropertyFactory.getProp(u,c.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(u,c.r||{k:0},0,degToRads,this);c.sk&&(this.sk=PropertyFactory.getProp(u,c.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(u,c.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(u,c.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(u,c.s||{k:[100,100,100]},1,.01,this),c.o?this.o=PropertyFactory.getProp(u,c.o,0,.01,u):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}o.prototype={applyToMatrix:e,getValue:i,precalculateMatrix:a,autoOrient:s},extendPrototype([DynamicPropertyContainer],o),o.prototype.addDynamicProperty=r,o.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty;function l(u,c,d){return new o(u,c,d)}return{getTransformProperty:l}}();function RepeaterModifier(){}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(n,e.c,0,null,this),this.o=PropertyFactory.getProp(n,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(n,e.tr,this),this.so=PropertyFactory.getProp(n,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(n,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(n,e,i,a,s,r){var o=r?-1:1,l=a.s.v[0]+(1-a.s.v[0])*(1-s),u=a.s.v[1]+(1-a.s.v[1])*(1-s);n.translate(a.p.v[0]*o*s,a.p.v[1]*o*s,a.p.v[2]),e.translate(-a.a.v[0],-a.a.v[1],a.a.v[2]),e.rotate(-a.r.v*o*s),e.translate(a.a.v[0],a.a.v[1],a.a.v[2]),i.translate(-a.a.v[0],-a.a.v[1],a.a.v[2]),i.scale(r?1/l:l,r?1/u:u),i.translate(a.a.v[0],a.a.v[1],a.a.v[2])},RepeaterModifier.prototype.init=function(n,e,i,a){for(this.elem=n,this.arr=e,this.pos=i,this.elemsData=a,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e[i]);i>0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e]._processed=!1,n[e].ty==="gr"&&this.resetElements(n[e].it)},RepeaterModifier.prototype.cloneElements=function(n){var e=JSON.parse(JSON.stringify(n));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)n[i]._render=e,n[i].ty==="gr"&&this.changeGroupRender(n[i].it,e)},RepeaterModifier.prototype.processShapes=function(n){var e,i,a,s,r,o=!1;if(this._mdf||n){var l=Math.ceil(this.c.v);if(this._groups.length<l){for(;this._groups.length<l;){var u={it:this.cloneElements(this._elements),ty:"gr"};u.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,u),this._groups.splice(0,0,u),this._currentCopies+=1}this.elem.reloadShapes(),o=!0}r=0;var c;for(a=0;a<=this._groups.length-1;a+=1){if(c=r<l,this._groups[a]._render=c,this.changeGroupRender(this._groups[a].it,c),!c){var d=this.elemsData[a].it,p=d[d.length-1];p.transform.op.v!==0?(p.transform.op._mdf=!0,p.transform.op.v=0):p.transform.op._mdf=!1}r+=1}this._currentCopies=l;var f=this.o.v,m=f%1,P=f>0?Math.floor(f):Math.ceil(f),T=this.pMatrix.props,x=this.rMatrix.props,y=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var S=0;if(f>0){for(;S<P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),S+=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,m,!1),S+=m)}else if(f<0){for(;S>P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),S-=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-m,!0),S-=m)}a=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,r=this._currentCopies;for(var g,C;r;){if(e=this.elemsData[a].it,i=e[e.length-1].transform.mProps.v.props,C=i.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(a/(this._currentCopies-1)),S!==0){for((a!==0&&s===1||a!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]),this.matrix.transform(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11],y[12],y[13],y[14],y[15]),this.matrix.transform(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],T[8],T[9],T[10],T[11],T[12],T[13],T[14],T[15]),g=0;g<C;g+=1)i[g]=this.matrix.props[g];this.matrix.reset()}else for(this.matrix.reset(),g=0;g<C;g+=1)i[g]=this.matrix.props[g];S+=1,r-=1,a+=s}}else for(r=this._currentCopies,a=0,s=1;r;)e=this.elemsData[a].it,i=e[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,r-=1,a+=s;return o},RepeaterModifier.prototype.addShape=function(){};function RoundCornersModifier(){}extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(n,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(n,e){var i=shapePool.newElement();i.c=n.c;var a,s=n._length,r,o,l,u,c,d,p=0,f,m,P,T,x,y;for(a=0;a<s;a+=1)r=n.v[a],l=n.o[a],o=n.i[a],r[0]===l[0]&&r[1]===l[1]&&r[0]===o[0]&&r[1]===o[1]?(a===0||a===s-1)&&!n.c?(i.setTripleAt(r[0],r[1],l[0],l[1],o[0],o[1],p),p+=1):(a===0?u=n.v[s-1]:u=n.v[a-1],c=Math.sqrt(Math.pow(r[0]-u[0],2)+Math.pow(r[1]-u[1],2)),d=c?Math.min(c/2,e)/c:0,x=r[0]+(u[0]-r[0])*d,f=x,y=r[1]-(r[1]-u[1])*d,m=y,P=f-(f-r[0])*roundCorner,T=m-(m-r[1])*roundCorner,i.setTripleAt(f,m,P,T,x,y,p),p+=1,a===s-1?u=n.v[0]:u=n.v[a+1],c=Math.sqrt(Math.pow(r[0]-u[0],2)+Math.pow(r[1]-u[1],2)),d=c?Math.min(c/2,e)/c:0,P=r[0]+(u[0]-r[0])*d,f=P,T=r[1]+(u[1]-r[1])*d,m=T,x=f-(f-r[0])*roundCorner,y=m-(m-r[1])*roundCorner,i.setTripleAt(f,m,P,T,x,y,p),p+=1):(i.setTripleAt(n.v[a][0],n.v[a][1],n.o[a][0],n.o[a][1],n.i[a][0],n.i[a][1],p),p+=1);return i},RoundCornersModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.rd.v;if(o!==0){var l,u;for(i=0;i<a;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,r=l.shape.paths._length,s=0;s<r;s+=1)u.addShape(this.processPath(e[s],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function floatEqual(n,e){return Math.abs(n-e)*1e5<=Math.min(Math.abs(n),Math.abs(e))}function floatZero(n){return Math.abs(n)<=1e-5}function lerp(n,e,i){return n*(1-i)+e*i}function lerpPoint(n,e,i){return[lerp(n[0],e[0],i),lerp(n[1],e[1],i)]}function quadRoots(n,e,i){if(n===0)return[];var a=e*e-4*n*i;if(a<0)return[];var s=-e/(2*n);if(a===0)return[s];var r=Math.sqrt(a)/(2*n);return[s-r,s+r]}function polynomialCoefficients(n,e,i,a){return[-n+3*e-3*i+a,3*n-6*e+3*i,-3*n+3*e,n]}function singlePoint(n){return new PolynomialBezier(n,n,n,n,!1)}function PolynomialBezier(n,e,i,a,s){s&&pointEqual(n,e)&&(e=lerpPoint(n,a,1/3)),s&&pointEqual(i,a)&&(i=lerpPoint(n,a,2/3));var r=polynomialCoefficients(n[0],e[0],i[0],a[0]),o=polynomialCoefficients(n[1],e[1],i[1],a[1]);this.a=[r[0],o[0]],this.b=[r[1],o[1]],this.c=[r[2],o[2]],this.d=[r[3],o[3]],this.points=[n,e,i,a]}PolynomialBezier.prototype.point=function(n){return[((this.a[0]*n+this.b[0])*n+this.c[0])*n+this.d[0],((this.a[1]*n+this.b[1])*n+this.c[1])*n+this.d[1]]},PolynomialBezier.prototype.derivative=function(n){return[(3*n*this.a[0]+2*this.b[0])*n+this.c[0],(3*n*this.a[1]+2*this.b[1])*n+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(n){var e=this.derivative(n);return Math.atan2(e[1],e[0])},PolynomialBezier.prototype.normalAngle=function(n){var e=this.derivative(n);return Math.atan2(e[0],e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var n=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(n))return[];var e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/n,i=e*e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/n;if(i<0)return[];var a=Math.sqrt(i);return floatZero(a)?a>0&&a<1?[e]:[]:[e-a,e+a].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(n){if(n<=0)return[singlePoint(this.points[0]),this];if(n>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],n),i=lerpPoint(this.points[1],this.points[2],n),a=lerpPoint(this.points[2],this.points[3],n),s=lerpPoint(e,i,n),r=lerpPoint(i,a,n),o=lerpPoint(s,r,n);return[new PolynomialBezier(this.points[0],e,s,o,!0),new PolynomialBezier(o,r,a,this.points[3],!0)]};function extrema(n,e){var i=n.points[0][e],a=n.points[n.points.length-1][e];if(i>a){var s=a;a=i,i=s}for(var r=quadRoots(3*n.a[e],2*n.b[e],n.c[e]),o=0;o<r.length;o+=1)if(r[o]>0&&r[o]<1){var l=n.point(r[o])[e];l<i?i=l:l>a&&(a=l)}return{min:i,max:a}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var n=this.bounds();return{left:n.x.min,right:n.x.max,top:n.y.min,bottom:n.y.max,width:n.x.max-n.x.min,height:n.y.max-n.y.min,cx:(n.x.max+n.x.min)/2,cy:(n.y.max+n.y.min)/2}};function intersectData(n,e,i){var a=n.boundingBox();return{cx:a.cx,cy:a.cy,width:a.width,height:a.height,bez:n,t:(e+i)/2,t1:e,t2:i}}function splitData(n){var e=n.bez.split(.5);return[intersectData(e[0],n.t1,n.t),intersectData(e[1],n.t,n.t2)]}function boxIntersect(n,e){return Math.abs(n.cx-e.cx)*2<n.width+e.width&&Math.abs(n.cy-e.cy)*2<n.height+e.height}function intersectsImpl(n,e,i,a,s,r){if(boxIntersect(n,e)){if(i>=r||n.width<=a&&n.height<=a&&e.width<=a&&e.height<=a){s.push([n.t,e.t]);return}var o=splitData(n),l=splitData(e);intersectsImpl(o[0],l[0],i+1,a,s,r),intersectsImpl(o[0],l[1],i+1,a,s,r),intersectsImpl(o[1],l[0],i+1,a,s,r),intersectsImpl(o[1],l[1],i+1,a,s,r)}}PolynomialBezier.prototype.intersections=function(n,e,i){e===void 0&&(e=2),i===void 0&&(i=7);var a=[];return intersectsImpl(intersectData(this,0,1),intersectData(n,0,1),0,e,a,i),a},PolynomialBezier.shapeSegment=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[e],n.o[e],n.i[i],n.v[i],!0)},PolynomialBezier.shapeSegmentInverted=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[i],n.i[i],n.o[e],n.v[e],!0)};function crossProduct(n,e){return[n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]]}function lineIntersection(n,e,i,a){var s=[n[0],n[1],1],r=[e[0],e[1],1],o=[i[0],i[1],1],l=[a[0],a[1],1],u=crossProduct(crossProduct(s,r),crossProduct(o,l));return floatZero(u[2])?null:[u[0]/u[2],u[1]/u[2]]}function polarOffset(n,e,i){return[n[0]+Math.cos(e)*i,n[1]-Math.sin(e)*i]}function pointDistance(n,e){return Math.hypot(n[0]-e[0],n[1]-e[1])}function pointEqual(n,e){return floatEqual(n[0],e[0])&&floatEqual(n[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(n,e.s,0,null,this),this.frequency=PropertyFactory.getProp(n,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(n,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(n,e,i,a,s,r,o){var l=i-Math.PI/2,u=i+Math.PI/2,c=e[0]+Math.cos(i)*a*s,d=e[1]-Math.sin(i)*a*s;n.setTripleAt(c,d,c+Math.cos(l)*r,d-Math.sin(l)*r,c+Math.cos(u)*o,d-Math.sin(u)*o,n.length())}function getPerpendicularVector(n,e){var i=[e[0]-n[0],e[1]-n[1]],a=-Math.PI*.5,s=[Math.cos(a)*i[0]-Math.sin(a)*i[1],Math.sin(a)*i[0]+Math.cos(a)*i[1]];return s}function getProjectingAngle(n,e){var i=e===0?n.length()-1:e-1,a=(e+1)%n.length(),s=n.v[i],r=n.v[a],o=getPerpendicularVector(s,r);return Math.atan2(0,1)-Math.atan2(o[1],o[0])}function zigZagCorner(n,e,i,a,s,r,o){var l=getProjectingAngle(e,i),u=e.v[i%e._length],c=e.v[i===0?e._length-1:i-1],d=e.v[(i+1)%e._length],p=r===2?Math.sqrt(Math.pow(u[0]-c[0],2)+Math.pow(u[1]-c[1],2)):0,f=r===2?Math.sqrt(Math.pow(u[0]-d[0],2)+Math.pow(u[1]-d[1],2)):0;setPoint(n,e.v[i%e._length],l,o,a,f/((s+1)*2),p/((s+1)*2))}function zigZagSegment(n,e,i,a,s,r){for(var o=0;o<a;o+=1){var l=(o+1)/(a+1),u=s===2?Math.sqrt(Math.pow(e.points[3][0]-e.points[0][0],2)+Math.pow(e.points[3][1]-e.points[0][1],2)):0,c=e.normalAngle(l),d=e.point(l);setPoint(n,d,c,r,i,u/((a+1)*2),u/((a+1)*2)),r=-r}return r}ZigZagModifier.prototype.processPath=function(n,e,i,a){var s=n._length,r=shapePool.newElement();if(r.c=n.c,n.c||(s-=1),s===0)return r;var o=-1,l=PolynomialBezier.shapeSegment(n,0);zigZagCorner(r,n,0,e,i,a,o);for(var u=0;u<s;u+=1)o=zigZagSegment(r,l,e,i,a,-o),u===s-1&&!n.c?l=null:l=PolynomialBezier.shapeSegment(n,(u+1)%s),zigZagCorner(r,n,u+1,e,i,a,o);return r},ZigZagModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amplitude.v,l=Math.max(0,Math.round(this.frequency.v)),u=this.pointsType.v;if(o!==0){var c,d;for(i=0;i<a;i+=1){if(c=this.shapes[i],d=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(d.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,r=c.shape.paths._length,s=0;s<r;s+=1)d.addShape(this.processPath(e[s],o,l,u));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function linearOffset(n,e,i){var a=Math.atan2(e[0]-n[0],e[1]-n[1]);return[polarOffset(n,a,i),polarOffset(e,a,i)]}function offsetSegment(n,e){var i,a,s,r,o,l,u;u=linearOffset(n.points[0],n.points[1],e),i=u[0],a=u[1],u=linearOffset(n.points[1],n.points[2],e),s=u[0],r=u[1],u=linearOffset(n.points[2],n.points[3],e),o=u[0],l=u[1];var c=lineIntersection(i,a,s,r);c===null&&(c=a);var d=lineIntersection(o,l,s,r);return d===null&&(d=o),new PolynomialBezier(i,c,d,l)}function joinLines(n,e,i,a,s){var r=e.points[3],o=i.points[0];if(a===3||pointEqual(r,o))return r;if(a===2){var l=-e.tangentAngle(1),u=-i.tangentAngle(0)+Math.PI,c=lineIntersection(r,polarOffset(r,l+Math.PI/2,100),o,polarOffset(o,l+Math.PI/2,100)),d=c?pointDistance(c,r):pointDistance(r,o)/2,p=polarOffset(r,l,2*d*roundCorner);return n.setXYAt(p[0],p[1],"o",n.length()-1),p=polarOffset(o,u,2*d*roundCorner),n.setTripleAt(o[0],o[1],o[0],o[1],p[0],p[1],n.length()),o}var f=pointEqual(r,e.points[2])?e.points[0]:e.points[2],m=pointEqual(o,i.points[1])?i.points[3]:i.points[1],P=lineIntersection(f,r,o,m);return P&&pointDistance(P,r)<s?(n.setTripleAt(P[0],P[1],P[0],P[1],P[0],P[1],n.length()),P):r}function getIntersection(n,e){var i=n.intersections(e);return i.length&&floatEqual(i[0][0],1)&&i.shift(),i.length?i[0]:null}function pruneSegmentIntersection(n,e){var i=n.slice(),a=e.slice(),s=getIntersection(n[n.length-1],e[0]);return s&&(i[n.length-1]=n[n.length-1].split(s[0])[0],a[0]=e[0].split(s[1])[1]),n.length>1&&e.length>1&&(s=getIntersection(n[0],e[e.length-1]),s)?[[n[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[i,a]}function pruneIntersections(n){for(var e,i=1;i<n.length;i+=1)e=pruneSegmentIntersection(n[i-1],n[i]),n[i-1]=e[0],n[i]=e[1];return n.length>1&&(e=pruneSegmentIntersection(n[n.length-1],n[0]),n[n.length-1]=e[0],n[0]=e[1]),n}function offsetSegmentSplit(n,e){var i=n.inflectionPoints(),a,s,r,o;if(i.length===0)return[offsetSegment(n,e)];if(i.length===1||floatEqual(i[1],1))return r=n.split(i[0]),a=r[0],s=r[1],[offsetSegment(a,e),offsetSegment(s,e)];r=n.split(i[0]),a=r[0];var l=(i[1]-i[0])/(1-i[0]);return r=r[1].split(l),o=r[0],s=r[1],[offsetSegment(a,e),offsetSegment(o,e),offsetSegment(s,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(n,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(n,e,i,a){var s=shapePool.newElement();s.c=n.c;var r=n.length();n.c||(r-=1);var o,l,u,c=[];for(o=0;o<r;o+=1)u=PolynomialBezier.shapeSegment(n,o),c.push(offsetSegmentSplit(u,e));if(!n.c)for(o=r-1;o>=0;o-=1)u=PolynomialBezier.shapeSegmentInverted(n,o),c.push(offsetSegmentSplit(u,e));c=pruneIntersections(c);var d=null,p=null;for(o=0;o<c.length;o+=1){var f=c[o];for(p&&(d=joinLines(s,p,f[0],i,a)),p=f[f.length-1],l=0;l<f.length;l+=1)u=f[l],d&&pointEqual(u.points[0],d)?s.setXYAt(u.points[1][0],u.points[1][1],"o",s.length()-1):s.setTripleAt(u.points[0][0],u.points[0][1],u.points[1][0],u.points[1][1],u.points[0][0],u.points[0][1],s.length()),s.setTripleAt(u.points[3][0],u.points[3][1],u.points[3][0],u.points[3][1],u.points[2][0],u.points[2][1],s.length()),d=u.points[3]}return c.length&&joinLines(s,p,c[0][0],i,a),s},OffsetPathModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amount.v,l=this.miterLimit.v,u=this.lineJoin;if(o!==0){var c,d;for(i=0;i<a;i+=1){if(c=this.shapes[i],d=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(d.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,r=c.shape.paths._length,s=0;s<r;s+=1)d.addShape(this.processPath(e[s],o,u,l));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function getFontProperties(n){for(var e=n.fStyle?n.fStyle.split(" "):[],i="normal",a="normal",s=e.length,r,o=0;o<s;o+=1)switch(r=e[o].toLowerCase(),r){case"italic":a="italic";break;case"bold":i="700";break;case"black":i="900";break;case"medium":i="500";break;case"regular":case"normal":i="400";break;case"light":case"thin":i="200";break}return{style:a,weight:n.fWeight||i}}var FontManager=function(){var n=5e3,e={w:0,size:0,shapes:[],data:{shapes:[]}},i=[];i=i.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var a=127988,s=917631,r=917601,o=917626,l=65039,u=8205,c=127462,d=127487,p=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function f(b){var I=b.split(","),V,A=I.length,k=[];for(V=0;V<A;V+=1)I[V]!=="sans-serif"&&I[V]!=="monospace"&&k.push(I[V]);return k.join(",")}function m(b,I){var V=createTag("span");V.setAttribute("aria-hidden",!0),V.style.fontFamily=I;var A=createTag("span");A.innerText="giItT1WQy@!-/#",V.style.position="absolute",V.style.left="-10000px",V.style.top="-10000px",V.style.fontSize="300px",V.style.fontVariant="normal",V.style.fontStyle="normal",V.style.fontWeight="normal",V.style.letterSpacing="0",V.appendChild(A),document.body.appendChild(V);var k=A.offsetWidth;return A.style.fontFamily=f(b)+", "+I,{node:A,w:k,parent:V}}function P(){var b,I=this.fonts.length,V,A,k=I;for(b=0;b<I;b+=1)this.fonts[b].loaded?k-=1:this.fonts[b].fOrigin==="n"||this.fonts[b].origin===0?this.fonts[b].loaded=!0:(V=this.fonts[b].monoCase.node,A=this.fonts[b].monoCase.w,V.offsetWidth!==A?(k-=1,this.fonts[b].loaded=!0):(V=this.fonts[b].sansCase.node,A=this.fonts[b].sansCase.w,V.offsetWidth!==A&&(k-=1,this.fonts[b].loaded=!0)),this.fonts[b].loaded&&(this.fonts[b].sansCase.parent.parentNode.removeChild(this.fonts[b].sansCase.parent),this.fonts[b].monoCase.parent.parentNode.removeChild(this.fonts[b].monoCase.parent)));k!==0&&Date.now()-this.initTime<n?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function T(b,I){var V=document.body&&I?"svg":"canvas",A,k=getFontProperties(b);if(V==="svg"){var R=createNS("text");R.style.fontSize="100px",R.setAttribute("font-family",b.fFamily),R.setAttribute("font-style",k.style),R.setAttribute("font-weight",k.weight),R.textContent="1",b.fClass?(R.style.fontFamily="inherit",R.setAttribute("class",b.fClass)):R.style.fontFamily=b.fFamily,I.appendChild(R),A=R}else{var G=new OffscreenCanvas(500,500).getContext("2d");G.font=k.style+" "+k.weight+" 100px "+b.fFamily,A=G}function z(q){return V==="svg"?(A.textContent=q,A.getComputedTextLength()):A.measureText(q).width}return{measureText:z}}function x(b,I){if(!b){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=b.list;return}if(!document.body){this.isLoaded=!0,b.list.forEach(function(ne){ne.helper=T(ne),ne.cache={}}),this.fonts=b.list;return}var V=b.list,A,k=V.length,R=k;for(A=0;A<k;A+=1){var G=!0,z,q;if(V[A].loaded=!1,V[A].monoCase=m(V[A].fFamily,"monospace"),V[A].sansCase=m(V[A].fFamily,"sans-serif"),!V[A].fPath)V[A].loaded=!0,R-=1;else if(V[A].fOrigin==="p"||V[A].origin===3){if(z=document.querySelectorAll('style[f-forigin="p"][f-family="'+V[A].fFamily+'"], style[f-origin="3"][f-family="'+V[A].fFamily+'"]'),z.length>0&&(G=!1),G){var U=createTag("style");U.setAttribute("f-forigin",V[A].fOrigin),U.setAttribute("f-origin",V[A].origin),U.setAttribute("f-family",V[A].fFamily),U.type="text/css",U.innerText="@font-face {font-family: "+V[A].fFamily+"; font-style: normal; src: url('"+V[A].fPath+"');}",I.appendChild(U)}}else if(V[A].fOrigin==="g"||V[A].origin===1){for(z=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),q=0;q<z.length;q+=1)z[q].href.indexOf(V[A].fPath)!==-1&&(G=!1);if(G){var K=createTag("link");K.setAttribute("f-forigin",V[A].fOrigin),K.setAttribute("f-origin",V[A].origin),K.type="text/css",K.rel="stylesheet",K.href=V[A].fPath,document.body.appendChild(K)}}else if(V[A].fOrigin==="t"||V[A].origin===2){for(z=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),q=0;q<z.length;q+=1)V[A].fPath===z[q].src&&(G=!1);if(G){var Q=createTag("link");Q.setAttribute("f-forigin",V[A].fOrigin),Q.setAttribute("f-origin",V[A].origin),Q.setAttribute("rel","stylesheet"),Q.setAttribute("href",V[A].fPath),I.appendChild(Q)}}V[A].helper=T(V[A],I),V[A].cache={},this.fonts.push(V[A])}R===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function y(b){if(b){this.chars||(this.chars=[]);var I,V=b.length,A,k=this.chars.length,R;for(I=0;I<V;I+=1){for(A=0,R=!1;A<k;)this.chars[A].style===b[I].style&&this.chars[A].fFamily===b[I].fFamily&&this.chars[A].ch===b[I].ch&&(R=!0),A+=1;R||(this.chars.push(b[I]),k+=1)}}}function S(b,I,V){for(var A=0,k=this.chars.length;A<k;){if(this.chars[A].ch===b&&this.chars[A].style===I&&this.chars[A].fFamily===V)return this.chars[A];A+=1}return(typeof b=="string"&&b.charCodeAt(0)!==13||!b)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",b,I,V)),e}function g(b,I,V){var A=this.getFontByName(I),k=b;if(!A.cache[k]){var R=A.helper;if(b===" "){var G=R.measureText("|"+b+"|"),z=R.measureText("||");A.cache[k]=(G-z)/100}else A.cache[k]=R.measureText(b)/100}return A.cache[k]*V}function C(b){for(var I=0,V=this.fonts.length;I<V;){if(this.fonts[I].fName===b)return this.fonts[I];I+=1}return this.fonts[0]}function E(b){var I=0,V=b.charCodeAt(0);if(V>=55296&&V<=56319){var A=b.charCodeAt(1);A>=56320&&A<=57343&&(I=(V-55296)*1024+A-56320+65536)}return I}function B(b,I){var V=b.toString(16)+I.toString(16);return p.indexOf(V)!==-1}function _(b){return b===u}function M(b){return b===l}function D(b){var I=E(b);return I>=c&&I<=d}function L(b){return D(b.substr(0,2))&&D(b.substr(2,2))}function F(b){return i.indexOf(b)!==-1}function N(b,I){var V=E(b.substr(I,2));if(V!==a)return!1;var A=0;for(I+=2;A<5;){if(V=E(b.substr(I,2)),V<r||V>o)return!1;A+=1,I+=2}return E(b.substr(I,2))===s}function H(){this.isLoaded=!0}var $=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};$.isModifier=B,$.isZeroWidthJoiner=_,$.isFlagEmoji=L,$.isRegionalCode=D,$.isCombinedCharacter=F,$.isRegionalFlag=N,$.isVariationSelector=M,$.BLACK_FLAG_CODE_POINT=a;var O={addChars:y,addFonts:x,getCharData:S,getFontByName:C,measureText:g,checkLoadedFonts:P,setIsLoaded:H};return $.prototype=O,$}();function SlotManager(n){this.animationData=n}SlotManager.prototype.getProp=function(n){return this.animationData.slots&&this.animationData.slots[n.sid]?Object.assign(n,this.animationData.slots[n.sid].p):n};function slotFactory(n){return new SlotManager(n)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,i=this.renderableComponents.length;for(e=0;e<i;e+=1)this.renderableComponents[e].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=function(){var n={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(e){return n[e]||""}}();function SliderEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function AngleEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function ColorEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function PointEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function LayerIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function MaskIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function CheckboxEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function NoValueEffect(){this.p={}}function EffectsManager(n,e){var i=n.ef||[];this.effectElements=[];var a,s=i.length,r;for(a=0;a<s;a+=1)r=new GroupEffect(i[a],e),this.effectElements.push(r)}function GroupEffect(n,e){this.init(n,e)}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(n,e){this.data=n,this.effectElements=[],this.initDynamicPropertyContainer(e);var i,a=this.data.ef.length,s,r=this.data.ef;for(i=0;i<a;i+=1){switch(s=null,r[i].ty){case 0:s=new SliderEffect(r[i],e,this);break;case 1:s=new AngleEffect(r[i],e,this);break;case 2:s=new ColorEffect(r[i],e,this);break;case 3:s=new PointEffect(r[i],e,this);break;case 4:case 7:s=new CheckboxEffect(r[i],e,this);break;case 10:s=new LayerIndexEffect(r[i],e,this);break;case 11:s=new MaskIndexEffect(r[i],e,this);break;case 5:s=new EffectsManager(r[i],e);break;default:s=new NoValueEffect(r[i]);break}s&&this.effectElements.push(s)}};function BaseElement(){}BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var e=0,i=this.data.masksProperties.length;e<i;){if(this.data.masksProperties[e].mode!=="n"&&this.data.masksProperties[e].cl!==!1)return!0;e+=1}return!1},initExpressions:function(){var e=getExpressionInterfaces();if(e){var i=e("layer"),a=e("effects"),s=e("shape"),r=e("text"),o=e("comp");this.layerInterface=i(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var l=a.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(l),this.data.ty===0||this.data.xt?this.compInterface=o(this):this.data.ty===4?(this.layerInterface.shapeInterface=s(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):this.data.ty===5&&(this.layerInterface.textInterface=r(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var e=getBlendMode(this.data.bm),i=this.baseElement||this.layerElement;i.style["mix-blend-mode"]=e},initBaseData:function(e,i,a){this.globalData=i,this.comp=a,this.data=e,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function FrameElement(){}FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(e,i){var a,s=this.dynamicProperties.length;for(a=0;a<s;a+=1)(i||this._isParent&&this.dynamicProperties[a].propType==="transform")&&(this.dynamicProperties[a].getValue(),this.dynamicProperties[a]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&this.dynamicProperties.push(e)}};function FootageElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.footageData=e.imageLoader.getAsset(this.assetData),this.initBaseData(n,e,i)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var n=getExpressionInterfaces();if(n){var e=n("footage");this.layerInterface=e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData};function AudioElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.initBaseData(n,e,i),this._isPlaying=!1,this._canPlay=!1;var a=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(a),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,n.au&&n.au.lv?n.au.lv:{k:[100]},1,.01,this)}AudioElement.prototype.prepareFrame=function(n){if(this.prepareRenderableFrame(n,!0),this.prepareProperties(n,!0),this.tm._placeholder)this._currentTime=n/this.data.sr;else{var e=this.tm.v;this._currentTime=e}this._volume=this.lv.v[0];var i=this._volume*this._volumeMultiplier;this._previousVolume!==i&&(this._previousVolume=i,this.audio.volume(i))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(n){this.audio.rate(n)},AudioElement.prototype.volume=function(n){this._volumeMultiplier=n,this._previousVolume=n*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(n){var e,i=this.layers.length,a;for(this.completeLayers=!0,e=i-1;e>=0;e-=1)this.elements[e]||(a=this.layers[e],a.ip-a.st<=n-this.layers[e].st&&a.op-a.st>n-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(n){switch(n.ty){case 2:return this.createImage(n);case 0:return this.createComp(n);case 1:return this.createSolid(n);case 3:return this.createNull(n);case 4:return this.createShape(n);case 5:return this.createText(n);case 6:return this.createAudio(n);case 13:return this.createCamera(n);case 15:return this.createFootage(n);default:return this.createNull(n)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(n){return new AudioElement(n,this.globalData,this)},BaseRenderer.prototype.createFootage=function(n){return new FootageElement(n,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.buildItem(n);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(n){this.completeLayers=!1;var e,i=n.length,a,s=this.layers.length;for(e=0;e<i;e+=1)for(a=0;a<s;){if(this.layers[a].id===n[e].id){this.layers[a]=n[e];break}a+=1}},BaseRenderer.prototype.setProjectInterface=function(n){this.globalData.projectInterface=n},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(n,e,i){for(var a=this.elements,s=this.layers,r=0,o=s.length;r<o;)s[r].ind==e&&(!a[r]||a[r]===!0?(this.buildItem(r),this.addPendingElement(n)):(i.push(a[r]),a[r].setAsParent(),s[r].parent!==void 0?this.buildElementParenting(n,s[r].parent,i):n.setHierarchy(i))),r+=1},BaseRenderer.prototype.addPendingElement=function(n){this.pendingElements.push(n)},BaseRenderer.prototype.searchExtraCompositions=function(n){var e,i=n.length;for(e=0;e<i;e+=1)if(n[e].xt){var a=this.createComp(n[e]);a.initExpressions(),this.globalData.projectInterface.registerComposition(a)}},BaseRenderer.prototype.getElementById=function(n){var e,i=this.elements.length;for(e=0;e<i;e+=1)if(this.elements[e].data.ind===n)return this.elements[e];return null},BaseRenderer.prototype.getElementByPath=function(n){var e=n.shift(),i;if(typeof e=="number")i=this.elements[e];else{var a,s=this.elements.length;for(a=0;a<s;a+=1)if(this.elements[a].data.nm===e){i=this.elements[a];break}}return n.length===0?i:i.getElementByPath(n)},BaseRenderer.prototype.setupGlobalData=function(n,e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(n),this.globalData.fontManager.addChars(n.chars),this.globalData.fontManager.addFonts(n.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=n.fr,this.globalData.nm=n.nm,this.globalData.compSize={w:n.w,h:n.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}TransformElement.prototype={initTransform:function(){var e=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:e,localMat:e,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var e,i=this.finalTransform.mat,a=0,s=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;a<s;){if(this.hierarchy[a].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}a+=1}if(this.finalTransform._matMdf)for(e=this.finalTransform.mProp.v.props,i.cloneFromProps(e),a=0;a<s;a+=1)i.multiply(this.hierarchy[a].finalTransform.mProp.v)}(!this.localTransforms||this.finalTransform._matMdf)&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var e=0,i=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;e<i;)this.localTransforms[e]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[e]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),e+=1;if(this.finalTransform._localMatMdf){var a=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(a),e=1;e<i;e+=1){var s=this.localTransforms[e].matrix;a.multiply(s)}a.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var r=this.finalTransform.localOpacity;for(e=0;e<i;e+=1)r*=this.localTransforms[e].opacity*.01;this.finalTransform.localOpacity=r}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var e=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(e.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var i=0,a=e.length;for(i=0;i<a;i+=1)this.localTransforms.push(e[i])}}},globalToLocal:function(e){var i=[];i.push(this.finalTransform);for(var a=!0,s=this.comp;a;)s.finalTransform?(s.data.hasMask&&i.splice(0,0,s.finalTransform),s=s.comp):a=!1;var r,o=i.length,l;for(r=0;r<o;r+=1)l=i[r].mat.applyToPointArray(0,0,0),e=[e[0]-l[0],e[1]-l[1],0];return e},mHelper:new Matrix};function MaskElement(n,e,i){this.data=n,this.element=e,this.globalData=i,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var a=this.globalData.defs,s,r=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(r),this.solidPath="";var o,l=this.masksProperties,u=0,c=[],d,p,f=createElementID(),m,P,T,x,y="clipPath",S="clip-path";for(s=0;s<r;s+=1)if((l[s].mode!=="a"&&l[s].mode!=="n"||l[s].inv||l[s].o.k!==100||l[s].o.x)&&(y="mask",S="mask"),(l[s].mode==="s"||l[s].mode==="i")&&u===0?(m=createNS("rect"),m.setAttribute("fill","#ffffff"),m.setAttribute("width",this.element.comp.data.w||0),m.setAttribute("height",this.element.comp.data.h||0),c.push(m)):m=null,o=createNS("path"),l[s].mode==="n")this.viewData[s]={op:PropertyFactory.getProp(this.element,l[s].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[s],3),elem:o,lastPath:""},a.appendChild(o);else{u+=1,o.setAttribute("fill",l[s].mode==="s"?"#000000":"#ffffff"),o.setAttribute("clip-rule","nonzero");var g;if(l[s].x.k!==0?(y="mask",S="mask",x=PropertyFactory.getProp(this.element,l[s].x,0,null,this.element),g=createElementID(),P=createNS("filter"),P.setAttribute("id",g),T=createNS("feMorphology"),T.setAttribute("operator","erode"),T.setAttribute("in","SourceGraphic"),T.setAttribute("radius","0"),P.appendChild(T),a.appendChild(P),o.setAttribute("stroke",l[s].mode==="s"?"#000000":"#ffffff")):(T=null,x=null),this.storedData[s]={elem:o,x,expan:T,lastPath:"",lastOperator:"",filterId:g,lastRadius:0},l[s].mode==="i"){p=c.length;var C=createNS("g");for(d=0;d<p;d+=1)C.appendChild(c[d]);var E=createNS("mask");E.setAttribute("mask-type","alpha"),E.setAttribute("id",f+"_"+u),E.appendChild(o),a.appendChild(E),C.setAttribute("mask","url("+getLocationHref()+"#"+f+"_"+u+")"),c.length=0,c.push(C)}else c.push(o);l[s].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[s]={elem:o,lastPath:"",op:PropertyFactory.getProp(this.element,l[s].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[s],3),invRect:m},this.viewData[s].prop.k||this.drawPath(l[s],this.viewData[s].prop.v,this.viewData[s])}for(this.maskElement=createNS(y),r=c.length,s=0;s<r;s+=1)this.maskElement.appendChild(c[s]);u>0&&(this.maskElement.setAttribute("id",f),this.element.maskedElement.setAttribute(S,"url("+getLocationHref()+"#"+f+")"),a.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(n){return this.viewData[n].prop},MaskElement.prototype.renderFrame=function(n){var e=this.element.finalTransform.mat,i,a=this.masksProperties.length;for(i=0;i<a;i+=1)if((this.viewData[i].prop._mdf||n)&&this.drawPath(this.masksProperties[i],this.viewData[i].prop.v,this.viewData[i]),(this.viewData[i].op._mdf||n)&&this.viewData[i].elem.setAttribute("fill-opacity",this.viewData[i].op.v),this.masksProperties[i].mode!=="n"&&(this.viewData[i].invRect&&(this.element.finalTransform.mProp._mdf||n)&&this.viewData[i].invRect.setAttribute("transform",e.getInverseMatrix().to2dCSS()),this.storedData[i].x&&(this.storedData[i].x._mdf||n))){var s=this.storedData[i].expan;this.storedData[i].x.v<0?(this.storedData[i].lastOperator!=="erode"&&(this.storedData[i].lastOperator="erode",this.storedData[i].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[i].filterId+")")),s.setAttribute("radius",-this.storedData[i].x.v)):(this.storedData[i].lastOperator!=="dilate"&&(this.storedData[i].lastOperator="dilate",this.storedData[i].elem.setAttribute("filter",null)),this.storedData[i].elem.setAttribute("stroke-width",this.storedData[i].x.v*2))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var n="M0,0 ";return n+=" h"+this.globalData.compSize.w,n+=" v"+this.globalData.compSize.h,n+=" h-"+this.globalData.compSize.w,n+=" v-"+this.globalData.compSize.h+" ",n},MaskElement.prototype.drawPath=function(n,e,i){var a=" M"+e.v[0][0]+","+e.v[0][1],s,r;for(r=e._length,s=1;s<r;s+=1)a+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[s][0]+","+e.i[s][1]+" "+e.v[s][0]+","+e.v[s][1];if(e.c&&r>1&&(a+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),i.lastPath!==a){var o="";i.elem&&(e.c&&(o=n.inv?this.solidPath+a:a),i.elem.setAttribute("d",o)),i.lastPath=a}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var n={};n.createFilter=e,n.createAlphaToLuminanceFilter=i;function e(a,s){var r=createNS("filter");return r.setAttribute("id",a),s!==!0&&(r.setAttribute("filterUnits","objectBoundingBox"),r.setAttribute("x","0%"),r.setAttribute("y","0%"),r.setAttribute("width","100%"),r.setAttribute("height","100%")),r}function i(){var a=createNS("feColorMatrix");return a.setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),a}return n}(),featureSupport=function(){var n={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(n.maskType=!1),/firefox/i.test(navigator.userAgent)&&(n.svgLumaHidden=!1),n}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(n){var e,i="SourceGraphic",a=n.data.ef?n.data.ef.length:0,s=createElementID(),r=filtersFactory.createFilter(s,!0),o=0;this.filters=[];var l;for(e=0;e<a;e+=1){l=null;var u=n.data.ef[e].ty;if(registeredEffects$1[u]){var c=registeredEffects$1[u].effect;l=new c(r,n.effectsManager.effectElements[e],n,idPrefix+o,i),i=idPrefix+o,registeredEffects$1[u].countsAsEffect&&(o+=1)}l&&this.filters.push(l)}o&&(n.globalData.defs.appendChild(r),n.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+s+")")),this.filters.length&&n.addRenderableComponent(this)}SVGEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},SVGEffects.prototype.getEffects=function(n){var e,i=this.filters.length,a=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&a.push(this.filters[e]);return a};function registerEffect$1(n,e,i){registeredEffects$1[n]={effect:e,countsAsEffect:i}}function SVGBaseElement(){}SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var e=null;if(this.data.td){this.matteMasks={};var i=createNS("g");i.setAttribute("id",this.layerId),i.appendChild(this.layerElement),e=i,this.globalData.defs.appendChild(i)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),e=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var a=createNS("clipPath"),s=createNS("path");s.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var r=createElementID();if(a.setAttribute("id",r),a.appendChild(s),this.globalData.defs.appendChild(a),this.checkMasks()){var o=createNS("g");o.setAttribute("clip-path","url("+getLocationHref()+"#"+r+")"),o.appendChild(this.layerElement),this.transformedElement=o,e?e.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+r+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(e){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[e]){var i=this.layerId+"_"+e,a,s,r,o;if(e===1||e===3){var l=createNS("mask");l.setAttribute("id",i),l.setAttribute("mask-type",e===3?"luminance":"alpha"),r=createNS("use"),r.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),l.appendChild(r),this.globalData.defs.appendChild(l),!featureSupport.maskType&&e===1&&(l.setAttribute("mask-type","luminance"),a=createElementID(),s=filtersFactory.createFilter(a),this.globalData.defs.appendChild(s),s.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),o.appendChild(r),l.appendChild(o),o.setAttribute("filter","url("+getLocationHref()+"#"+a+")"))}else if(e===2){var u=createNS("mask");u.setAttribute("id",i),u.setAttribute("mask-type","alpha");var c=createNS("g");u.appendChild(c),a=createElementID(),s=filtersFactory.createFilter(a);var d=createNS("feComponentTransfer");d.setAttribute("in","SourceGraphic"),s.appendChild(d);var p=createNS("feFuncA");p.setAttribute("type","table"),p.setAttribute("tableValues","1.0 0.0"),d.appendChild(p),this.globalData.defs.appendChild(s);var f=createNS("rect");f.setAttribute("width",this.comp.data.w),f.setAttribute("height",this.comp.data.h),f.setAttribute("x","0"),f.setAttribute("y","0"),f.setAttribute("fill","#ffffff"),f.setAttribute("opacity","0"),c.setAttribute("filter","url("+getLocationHref()+"#"+a+")"),c.appendChild(f),r=createNS("use"),r.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),c.appendChild(r),featureSupport.maskType||(u.setAttribute("mask-type","luminance"),s.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),c.appendChild(f),o.appendChild(this.layerElement),c.appendChild(o)),this.globalData.defs.appendChild(u)}this.matteMasks[e]=i}return this.matteMasks[e]},setMatte:function(e){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+e+")")}};function HierarchyElement(){}HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(e){this.hierarchy=e},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function RenderableDOMElement(){}(function(){var n={initElement:function(i,a,s){this.initFrame(),this.initBaseData(i,a,s),this.initTransform(i,a,s),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var i=this.baseElement||this.layerElement;i.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var i=this.baseElement||this.layerElement;i.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(i){this._mdf=!1,this.prepareRenderableFrame(i),this.prepareProperties(i,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};extendPrototype([RenderableElement,createProxyFunction(n)],RenderableDOMElement)})();function IImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.assetData&&this.assetData.sid&&(this.assetData=e.slotManager.getProp(this.assetData)),this.initElement(n,e,i),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect};function ProcessedElement(n,e){this.elem=n,this.pos=e}function IShapeElement(){}IShapeElement.prototype={addShapeToModifiers:function(e){var i,a=this.shapeModifiers.length;for(i=0;i<a;i+=1)this.shapeModifiers[i].addShape(e)},isShapeInAnimatedModifiers:function(e){for(var i=0,a=this.shapeModifiers.length;i<a;)if(this.shapeModifiers[i].isAnimatedWithShape(e))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var e,i=this.shapes.length;for(e=0;e<i;e+=1)this.shapes[e].sh.reset();i=this.shapeModifiers.length;var a;for(e=i-1;e>=0&&(a=this.shapeModifiers[e].processShapes(this._isFirstFrame),!a);e-=1);}},searchProcessedElement:function(e){for(var i=this.processedElements,a=0,s=i.length;a<s;){if(i[a].elem===e)return i[a].pos;a+=1}return 0},addProcessedElement:function(e,i){for(var a=this.processedElements,s=a.length;s;)if(s-=1,a[s].elem===e){a[s].pos=i;return}a.push(new ProcessedElement(e,i))},prepareFrame:function(e){this.prepareRenderableFrame(e),this.prepareProperties(e,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(n,e,i){this.caches=[],this.styles=[],this.transformers=n,this.lStr="",this.sh=i,this.lvl=e,this._isAnimated=!!i.k;for(var a=0,s=n.length;a<s;){if(n[a].mProps.dynamicProperties.length){this._isAnimated=!0;break}a+=1}}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0};function SVGStyleData(n,e){this.data=n,this.type=n.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=n.hd===!0,this.pElem=createNS("path"),this.msElem=null}SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1};function DashProperty(n,e,i,a){this.elem=n,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=i,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(a);var s,r=e.length||0,o;for(s=0;s<r;s+=1)o=PropertyFactory.getProp(n,e[s].v,0,0,this),this.k=o.k||this.k,this.dataProps[s]={n:e[s].n,p:o};this.k||this.getValue(!0),this._isAnimated=this.k}DashProperty.prototype.getValue=function(n){if(!(this.elem.globalData.frameId===this.frameId&&!n)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||n,this._mdf)){var e=0,i=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),e=0;e<i;e+=1)this.dataProps[e].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty);function SVGStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i,this._isAnimated=!!this._isAnimated}extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData);function SVGFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i}extendPrototype([DynamicPropertyContainer],SVGFillStyleData);function SVGNoStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.style=i}extendPrototype([DynamicPropertyContainer],SVGNoStyleData);function GradientProperty(n,e,i){this.data=e,this.c=createTypedArray("uint8c",e.p*4);var a=e.k.k[0].s?e.k.k[0].s.length-e.p*4:e.k.k.length-e.p*4;this.o=createTypedArray("float32",a),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=a,this.initDynamicPropertyContainer(i),this.prop=PropertyFactory.getProp(n,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}GradientProperty.prototype.comparePoints=function(n,e){for(var i=0,a=this.o.length/2,s;i<a;){if(s=Math.abs(n[i*4]-n[e*4+i*2]),s>.01)return!1;i+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var n=0,e=this.data.k.k.length;n<e;){if(!this.comparePoints(this.data.k.k[n].s,this.data.p))return!1;n+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(n){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||n){var e,i=this.data.p*4,a,s;for(e=0;e<i;e+=1)a=e%4===0?100:255,s=Math.round(this.prop.v[e]*a),this.c[e]!==s&&(this.c[e]=s,this._cmdf=!n);if(this.o.length)for(i=this.prop.v.length,e=this.data.p*4;e<i;e+=1)a=e%2===0?100:1,s=e%2===0?Math.round(this.prop.v[e]*100):this.prop.v[e],this.o[e-this.data.p*4]!==s&&(this.o[e-this.data.p*4]=s,this._omdf=!n);this._mdf=!n}},extendPrototype([DynamicPropertyContainer],GradientProperty);function SVGGradientFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.initGradientData(n,e,i)}SVGGradientFillStyleData.prototype.initGradientData=function(n,e,i){this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.s=PropertyFactory.getProp(n,e.s,1,null,this),this.e=PropertyFactory.getProp(n,e.e,1,null,this),this.h=PropertyFactory.getProp(n,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(n,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(n,e.g,this),this.style=i,this.stops=[],this.setGradientData(i.pElem,e),this.setGradientOpacity(e,i),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(n,e){var i=createElementID(),a=createNS(e.t===1?"linearGradient":"radialGradient");a.setAttribute("id",i),a.setAttribute("spreadMethod","pad"),a.setAttribute("gradientUnits","userSpaceOnUse");var s=[],r,o,l;for(l=e.g.p*4,o=0;o<l;o+=4)r=createNS("stop"),a.appendChild(r),s.push(r);n.setAttribute(e.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+i+")"),this.gf=a,this.cst=s},SVGGradientFillStyleData.prototype.setGradientOpacity=function(n,e){if(this.g._hasOpacity&&!this.g._collapsable){var i,a,s,r=createNS("mask"),o=createNS("path");r.appendChild(o);var l=createElementID(),u=createElementID();r.setAttribute("id",u);var c=createNS(n.t===1?"linearGradient":"radialGradient");c.setAttribute("id",l),c.setAttribute("spreadMethod","pad"),c.setAttribute("gradientUnits","userSpaceOnUse"),s=n.g.k.k[0].s?n.g.k.k[0].s.length:n.g.k.k.length;var d=this.stops;for(a=n.g.p*4;a<s;a+=2)i=createNS("stop"),i.setAttribute("stop-color","rgb(255,255,255)"),c.appendChild(i),d.push(i);o.setAttribute(n.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+l+")"),n.ty==="gs"&&(o.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),o.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),n.lj===1&&o.setAttribute("stroke-miterlimit",n.ml)),this.of=c,this.ms=r,this.ost=d,this.maskId=u,e.msElem=o}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData);function SVGGradientStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.initGradientData(n,e,i),this._isAnimated=!!this._isAnimated}extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(n,e,i){this.transform={mProps:n,op:e,container:i},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var buildShapeString=function(e,i,a,s){if(i===0)return"";var r=e.o,o=e.i,l=e.v,u,c=" M"+s.applyToPointStringified(l[0][0],l[0][1]);for(u=1;u<i;u+=1)c+=" C"+s.applyToPointStringified(r[u-1][0],r[u-1][1])+" "+s.applyToPointStringified(o[u][0],o[u][1])+" "+s.applyToPointStringified(l[u][0],l[u][1]);return a&&i&&(c+=" C"+s.applyToPointStringified(r[u-1][0],r[u-1][1])+" "+s.applyToPointStringified(o[0][0],o[0][1])+" "+s.applyToPointStringified(l[0][0],l[0][1]),c+="z"),c},SVGElementsRenderer=function(){var n=new Matrix,e=new Matrix,i={createRenderFunction:a};function a(p){switch(p.ty){case"fl":return l;case"gf":return c;case"gs":return u;case"st":return d;case"sh":case"el":case"rc":case"sr":return o;case"tr":return s;case"no":return r;default:return null}}function s(p,f,m){(m||f.transform.op._mdf)&&f.transform.container.setAttribute("opacity",f.transform.op.v),(m||f.transform.mProps._mdf)&&f.transform.container.setAttribute("transform",f.transform.mProps.v.to2dCSS())}function r(){}function o(p,f,m){var P,T,x,y,S,g,C=f.styles.length,E=f.lvl,B,_,M,D;for(g=0;g<C;g+=1){if(y=f.sh._mdf||m,f.styles[g].lvl<E){for(_=e.reset(),M=E-f.styles[g].lvl,D=f.transformers.length-1;!y&&M>0;)y=f.transformers[D].mProps._mdf||y,M-=1,D-=1;if(y)for(M=E-f.styles[g].lvl,D=f.transformers.length-1;M>0;)_.multiply(f.transformers[D].mProps.v),M-=1,D-=1}else _=n;if(B=f.sh.paths,T=B._length,y){for(x="",P=0;P<T;P+=1)S=B.shapes[P],S&&S._length&&(x+=buildShapeString(S,S._length,S.c,_));f.caches[g]=x}else x=f.caches[g];f.styles[g].d+=p.hd===!0?"":x,f.styles[g]._mdf=y||f.styles[g]._mdf}}function l(p,f,m){var P=f.style;(f.c._mdf||m)&&P.pElem.setAttribute("fill","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||m)&&P.pElem.setAttribute("fill-opacity",f.o.v)}function u(p,f,m){c(p,f,m),d(p,f,m)}function c(p,f,m){var P=f.gf,T=f.g._hasOpacity,x=f.s.v,y=f.e.v;if(f.o._mdf||m){var S=p.ty==="gf"?"fill-opacity":"stroke-opacity";f.style.pElem.setAttribute(S,f.o.v)}if(f.s._mdf||m){var g=p.t===1?"x1":"cx",C=g==="x1"?"y1":"cy";P.setAttribute(g,x[0]),P.setAttribute(C,x[1]),T&&!f.g._collapsable&&(f.of.setAttribute(g,x[0]),f.of.setAttribute(C,x[1]))}var E,B,_,M;if(f.g._cmdf||m){E=f.cst;var D=f.g.c;for(_=E.length,B=0;B<_;B+=1)M=E[B],M.setAttribute("offset",D[B*4]+"%"),M.setAttribute("stop-color","rgb("+D[B*4+1]+","+D[B*4+2]+","+D[B*4+3]+")")}if(T&&(f.g._omdf||m)){var L=f.g.o;for(f.g._collapsable?E=f.cst:E=f.ost,_=E.length,B=0;B<_;B+=1)M=E[B],f.g._collapsable||M.setAttribute("offset",L[B*2]+"%"),M.setAttribute("stop-opacity",L[B*2+1])}if(p.t===1)(f.e._mdf||m)&&(P.setAttribute("x2",y[0]),P.setAttribute("y2",y[1]),T&&!f.g._collapsable&&(f.of.setAttribute("x2",y[0]),f.of.setAttribute("y2",y[1])));else{var F;if((f.s._mdf||f.e._mdf||m)&&(F=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)),P.setAttribute("r",F),T&&!f.g._collapsable&&f.of.setAttribute("r",F)),f.s._mdf||f.e._mdf||f.h._mdf||f.a._mdf||m){F||(F=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)));var N=Math.atan2(y[1]-x[1],y[0]-x[0]),H=f.h.v;H>=1?H=.99:H<=-1&&(H=-.99);var $=F*H,O=Math.cos(N+f.a.v)*$+x[0],b=Math.sin(N+f.a.v)*$+x[1];P.setAttribute("fx",O),P.setAttribute("fy",b),T&&!f.g._collapsable&&(f.of.setAttribute("fx",O),f.of.setAttribute("fy",b))}}}function d(p,f,m){var P=f.style,T=f.d;T&&(T._mdf||m)&&T.dashStr&&(P.pElem.setAttribute("stroke-dasharray",T.dashStr),P.pElem.setAttribute("stroke-dashoffset",T.dashoffset[0])),f.c&&(f.c._mdf||m)&&P.pElem.setAttribute("stroke","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||m)&&P.pElem.setAttribute("stroke-opacity",f.o.v),(f.w._mdf||m)&&(P.pElem.setAttribute("stroke-width",f.w.v),P.msElem&&P.msElem.setAttribute("stroke-width",f.w.v))}return i}();function SVGShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(n,e,i),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var n,e=this.shapes.length,i,a,s=this.stylesList.length,r,o=[],l=!1;for(a=0;a<s;a+=1){for(r=this.stylesList[a],l=!1,o.length=0,n=0;n<e;n+=1)i=this.shapes[n],i.styles.indexOf(r)!==-1&&(o.push(i),l=i._isAnimated||l);o.length>1&&l&&this.setShapesAsAnimated(o)}},SVGShapeElement.prototype.setShapesAsAnimated=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(n,e){var i,a=new SVGStyleData(n,e),s=a.pElem;if(n.ty==="st")i=new SVGStrokeStyleData(this,n,a);else if(n.ty==="fl")i=new SVGFillStyleData(this,n,a);else if(n.ty==="gf"||n.ty==="gs"){var r=n.ty==="gf"?SVGGradientFillStyleData:SVGGradientStrokeStyleData;i=new r(this,n,a),this.globalData.defs.appendChild(i.gf),i.maskId&&(this.globalData.defs.appendChild(i.ms),this.globalData.defs.appendChild(i.of),s.setAttribute("mask","url("+getLocationHref()+"#"+i.maskId+")"))}else n.ty==="no"&&(i=new SVGNoStyleData(this,n,a));return(n.ty==="st"||n.ty==="gs")&&(s.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),s.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),s.setAttribute("fill-opacity","0"),n.lj===1&&s.setAttribute("stroke-miterlimit",n.ml)),n.r===2&&s.setAttribute("fill-rule","evenodd"),n.ln&&s.setAttribute("id",n.ln),n.cl&&s.setAttribute("class",n.cl),n.bm&&(s.style["mix-blend-mode"]=getBlendMode(n.bm)),this.stylesList.push(a),this.addToAnimatedContents(n,i),i},SVGShapeElement.prototype.createGroupElement=function(n){var e=new ShapeGroupData;return n.ln&&e.gr.setAttribute("id",n.ln),n.cl&&e.gr.setAttribute("class",n.cl),n.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(n.bm)),e},SVGShapeElement.prototype.createTransformElement=function(n,e){var i=TransformPropertyFactory.getTransformProperty(this,n,this),a=new SVGTransformData(i,i.o,e);return this.addToAnimatedContents(n,a),a},SVGShapeElement.prototype.createShapeElement=function(n,e,i){var a=4;n.ty==="rc"?a=5:n.ty==="el"?a=6:n.ty==="sr"&&(a=7);var s=ShapePropertyFactory.getShapeProp(this,n,a,this),r=new SVGShapeData(e,i,s);return this.shapes.push(r),this.addShapeToModifiers(r),this.addToAnimatedContents(n,r),r},SVGShapeElement.prototype.addToAnimatedContents=function(n,e){for(var i=0,a=this.animatedContents.length;i<a;){if(this.animatedContents[i].element===e)return;i+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(n),element:e,data:n})},SVGShapeElement.prototype.setElementStyles=function(n){var e=n.styles,i,a=this.stylesList.length;for(i=0;i<a;i+=1)e.indexOf(this.stylesList[i])===-1&&!this.stylesList[i].closed&&e.push(this.stylesList[i])},SVGShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(n,e,i,a,s,r,o){var l=[].concat(r),u,c=n.length-1,d,p,f=[],m=[],P,T,x;for(u=c;u>=0;u-=1){if(x=this.searchProcessedElement(n[u]),x?e[u]=i[x-1]:n[u]._render=o,n[u].ty==="fl"||n[u].ty==="st"||n[u].ty==="gf"||n[u].ty==="gs"||n[u].ty==="no")x?e[u].style.closed=n[u].hd:e[u]=this.createStyleElement(n[u],s),n[u]._render&&e[u].style.pElem.parentNode!==a&&a.appendChild(e[u].style.pElem),f.push(e[u].style);else if(n[u].ty==="gr"){if(!x)e[u]=this.createGroupElement(n[u]);else for(p=e[u].it.length,d=0;d<p;d+=1)e[u].prevViewData[d]=e[u].it[d];this.searchShapes(n[u].it,e[u].it,e[u].prevViewData,e[u].gr,s+1,l,o),n[u]._render&&e[u].gr.parentNode!==a&&a.appendChild(e[u].gr)}else n[u].ty==="tr"?(x||(e[u]=this.createTransformElement(n[u],a)),P=e[u].transform,l.push(P)):n[u].ty==="sh"||n[u].ty==="rc"||n[u].ty==="el"||n[u].ty==="sr"?(x||(e[u]=this.createShapeElement(n[u],l,s)),this.setElementStyles(e[u])):n[u].ty==="tm"||n[u].ty==="rd"||n[u].ty==="ms"||n[u].ty==="pb"||n[u].ty==="zz"||n[u].ty==="op"?(x?(T=e[u],T.closed=!1):(T=ShapeModifiers.getModifier(n[u].ty),T.init(this,n[u]),e[u]=T,this.shapeModifiers.push(T)),m.push(T)):n[u].ty==="rp"&&(x?(T=e[u],T.closed=!0):(T=ShapeModifiers.getModifier(n[u].ty),e[u]=T,T.init(this,n,u,e),this.shapeModifiers.push(T),o=!1),m.push(T));this.addProcessedElement(n[u],u+1)}for(c=f.length,u=0;u<c;u+=1)f[u].closed=!0;for(c=m.length,u=0;u<c;u+=1)m[u].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){this.renderModifiers();var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].reset();for(this.renderShape(),n=0;n<e;n+=1)(this.stylesList[n]._mdf||this._isFirstFrame)&&(this.stylesList[n].msElem&&(this.stylesList[n].msElem.setAttribute("d",this.stylesList[n].d),this.stylesList[n].d="M0 0"+this.stylesList[n].d),this.stylesList[n].pElem.setAttribute("d",this.stylesList[n].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var n,e=this.animatedContents.length,i;for(n=0;n<e;n+=1)i=this.animatedContents[n],(this._isFirstFrame||i.element._isAnimated)&&i.data!==!0&&i.fn(i.data,i.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function LetterProps(n,e,i,a,s,r){this.o=n,this.sw=e,this.sc=i,this.fc=a,this.m=s,this.p=r,this._mdf={o:!0,sw:!!e,sc:!!i,fc:!!a,m:!0,p:!0}}LetterProps.prototype.update=function(n,e,i,a,s,r){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var o=!1;return this.o!==n&&(this.o=n,this._mdf.o=!0,o=!0),this.sw!==e&&(this.sw=e,this._mdf.sw=!0,o=!0),this.sc!==i&&(this.sc=i,this._mdf.sc=!0,o=!0),this.fc!==a&&(this.fc=a,this._mdf.fc=!0,o=!0),this.m!==s&&(this.m=s,this._mdf.m=!0,o=!0),r.length&&(this.p[0]!==r[0]||this.p[1]!==r[1]||this.p[4]!==r[4]||this.p[5]!==r[5]||this.p[12]!==r[12]||this.p[13]!==r[13])&&(this.p=r,this._mdf.p=!0,o=!0),o};function TextProperty(n,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,e.d&&e.d.sid&&(e.d=n.globalData.slotManager.getProp(e.d)),this.data=e,this.elem=n,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(n,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},TextProperty.prototype.setCurrentData=function(n){n.__complete||this.completeTextData(n),this.currentData=n,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(n){this.effectsSequence.push(n),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(n){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!n)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,i=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var a,s=this.effectsSequence.length,r=n||this.data.d.k[this.keysIndex].s;for(a=0;a<s;a+=1)i!==this.keysIndex?r=this.effectsSequence[a](r,r.t):r=this.effectsSequence[a](this.currentData,r.t);e!==r&&this.setCurrentData(r),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},TextProperty.prototype.getKeyframeValue=function(){for(var n=this.data.d.k,e=this.elem.comp.renderedFrame,i=0,a=n.length;i<=a-1&&!(i===a-1||n[i+1].t>e);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(n){for(var e=[],i=0,a=n.length,s,r,o=!1,l=!1,u="";i<a;)o=l,l=!1,s=n.charCodeAt(i),u=n.charAt(i),FontManager.isCombinedCharacter(s)?o=!0:s>=55296&&s<=56319?FontManager.isRegionalFlag(n,i)?u=n.substr(i,14):(r=n.charCodeAt(i+1),r>=56320&&r<=57343&&(FontManager.isModifier(s,r)?(u=n.substr(i,2),o=!0):FontManager.isFlagEmoji(n.substr(i,4))?u=n.substr(i,4):u=n.substr(i,2))):s>56319?(r=n.charCodeAt(i+1),FontManager.isVariationSelector(s)&&(o=!0)):FontManager.isZeroWidthJoiner(s)&&(o=!0,l=!0),o?(e[e.length-1]+=u,o=!1):e.push(u),i+=u.length;return e},TextProperty.prototype.completeTextData=function(n){n.__complete=!0;var e=this.elem.globalData.fontManager,i=this.data,a=[],s,r,o,l=0,u,c=i.m.g,d=0,p=0,f=0,m=[],P=0,T=0,x,y,S=e.getFontByName(n.f),g,C=0,E=getFontProperties(S);n.fWeight=E.weight,n.fStyle=E.style,n.finalSize=n.s,n.finalText=this.buildFinalText(n.t),r=n.finalText.length,n.finalLineHeight=n.lh;var B=n.tr/1e3*n.finalSize,_;if(n.sz)for(var M=!0,D=n.sz[0],L=n.sz[1],F,N;M;){N=this.buildFinalText(n.t),F=0,P=0,r=N.length,B=n.tr/1e3*n.finalSize;var H=-1;for(s=0;s<r;s+=1)_=N[s].charCodeAt(0),o=!1,N[s]===" "?H=s:(_===13||_===3)&&(P=0,o=!0,F+=n.finalLineHeight||n.finalSize*1.2),e.chars?(g=e.getCharData(N[s],S.fStyle,S.fFamily),C=o?0:g.w*n.finalSize/100):C=e.measureText(N[s],n.f,n.finalSize),P+C>D&&N[s]!==" "?(H===-1?r+=1:s=H,F+=n.finalLineHeight||n.finalSize*1.2,N.splice(s,H===s?1:0,"\r"),H=-1,P=0):(P+=C,P+=B);F+=S.ascent*n.finalSize/100,this.canResize&&n.finalSize>this.minimumFontSize&&L<F?(n.finalSize-=1,n.finalLineHeight=n.finalSize*n.lh/n.s):(n.finalText=N,r=n.finalText.length,M=!1)}P=-B,C=0;var $=0,O;for(s=0;s<r;s+=1)if(o=!1,O=n.finalText[s],_=O.charCodeAt(0),_===13||_===3?($=0,m.push(P),T=P>T?P:T,P=-2*B,u="",o=!0,f+=1):u=O,e.chars?(g=e.getCharData(O,S.fStyle,e.getFontByName(n.f).fFamily),C=o?0:g.w*n.finalSize/100):C=e.measureText(u,n.f,n.finalSize),O===" "?$+=C+B:(P+=C+B+$,$=0),a.push({l:C,an:C,add:d,n:o,anIndexes:[],val:u,line:f,animatorJustifyOffset:0}),c==2){if(d+=C,u===""||u===" "||s===r-1){for((u===""||u===" ")&&(d-=C);p<=s;)a[p].an=d,a[p].ind=l,a[p].extra=C,p+=1;l+=1,d=0}}else if(c==3){if(d+=C,u===""||s===r-1){for(u===""&&(d-=C);p<=s;)a[p].an=d,a[p].ind=l,a[p].extra=C,p+=1;d=0,l+=1}}else a[l].ind=l,a[l].extra=0,l+=1;if(n.l=a,T=P>T?P:T,m.push(P),n.sz)n.boxWidth=n.sz[0],n.justifyOffset=0;else switch(n.boxWidth=T,n.j){case 1:n.justifyOffset=-n.boxWidth;break;case 2:n.justifyOffset=-n.boxWidth/2;break;default:n.justifyOffset=0}n.lineWidths=m;var b=i.a,I,V;y=b.length;var A,k,R=[];for(x=0;x<y;x+=1){for(I=b[x],I.a.sc&&(n.strokeColorAnim=!0),I.a.sw&&(n.strokeWidthAnim=!0),(I.a.fc||I.a.fh||I.a.fs||I.a.fb)&&(n.fillColorAnim=!0),k=0,A=I.s.b,s=0;s<r;s+=1)V=a[s],V.anIndexes[x]=k,(A==1&&V.val!==""||A==2&&V.val!==""&&V.val!==" "||A==3&&(V.n||V.val==" "||s==r-1)||A==4&&(V.n||s==r-1))&&(I.s.rn===1&&R.push(k),k+=1);i.a[x].s.totalChars=k;var G=-1,z;if(I.s.rn===1)for(s=0;s<r;s+=1)V=a[s],G!=V.anIndexes[x]&&(G=V.anIndexes[x],z=R.splice(Math.floor(Math.random()*R.length),1)[0]),V.anIndexes[x]=z}n.yOffset=n.finalLineHeight||n.finalSize*1.2,n.ls=n.ls||0,n.ascent=S.ascent*n.finalSize/100},TextProperty.prototype.updateDocumentData=function(n,e){e=e===void 0?this.keysIndex:e;var i=this.copyData({},this.data.d.k[e].s);i=this.copyData(i,n),this.data.d.k[e].s=i,this.recalculate(e),this.setCurrentData(i),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(n){var e=this.data.d.k[n].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(n){this.canResize=n,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(n){this.minimumFontSize=Math.floor(n)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var n=Math.max,e=Math.min,i=Math.floor;function a(r,o){this._currentTextLength=-1,this.k=!1,this.data=o,this.elem=r,this.comp=r.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(r),this.s=PropertyFactory.getProp(r,o.s||{k:0},0,0,this),"e"in o?this.e=PropertyFactory.getProp(r,o.e,0,0,this):this.e={v:100},this.o=PropertyFactory.getProp(r,o.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(r,o.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(r,o.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(r,o.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(r,o.a,0,.01,this),this.dynamicProperties.length||this.getValue()}a.prototype={getMult:function(o){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var l=0,u=0,c=1,d=1;this.ne.v>0?l=this.ne.v/100:u=-this.ne.v/100,this.xe.v>0?c=1-this.xe.v/100:d=1+this.xe.v/100;var p=BezierFactory.getBezierEasing(l,u,c,d).get,f=0,m=this.finalS,P=this.finalE,T=this.data.sh;if(T===2)P===m?f=o>=P?1:0:f=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f=p(f);else if(T===3)P===m?f=o>=P?0:1:f=1-n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f=p(f);else if(T===4)P===m?f=0:(f=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f<.5?f*=2:f=1-2*(f-.5)),f=p(f);else if(T===5){if(P===m)f=0;else{var x=P-m;o=e(n(0,o+.5-m),P-m);var y=-x/2+o,S=x/2;f=Math.sqrt(1-y*y/(S*S))}f=p(f)}else T===6?(P===m?f=0:(o=e(n(0,o+.5-m),P-m),f=(1+Math.cos(Math.PI+Math.PI*2*o/(P-m)))/2),f=p(f)):(o>=i(m)&&(o-m<0?f=n(0,e(e(P,1)-(m-o),1)):f=n(0,e(P-o,1))),f=p(f));if(this.sm.v!==100){var g=this.sm.v*.01;g===0&&(g=1e-8);var C=.5-g*.5;f<C?f=0:(f=(f-C)/g,f>1&&(f=1))}return f*this.a.v},getValue:function(o){this.iterateDynamicProperties(),this._mdf=o||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,o&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,u=this.o.v/l,c=this.s.v/l+u,d=this.e.v/l+u;if(c>d){var p=c;c=d,d=p}this.finalS=c,this.finalE=d}},extendPrototype([DynamicPropertyContainer],a);function s(r,o,l){return new a(r,o)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(n,e,i){var a={propType:!1},s=PropertyFactory.getProp,r=e.a;this.a={r:r.r?s(n,r.r,0,degToRads,i):a,rx:r.rx?s(n,r.rx,0,degToRads,i):a,ry:r.ry?s(n,r.ry,0,degToRads,i):a,sk:r.sk?s(n,r.sk,0,degToRads,i):a,sa:r.sa?s(n,r.sa,0,degToRads,i):a,s:r.s?s(n,r.s,1,.01,i):a,a:r.a?s(n,r.a,1,0,i):a,o:r.o?s(n,r.o,0,.01,i):a,p:r.p?s(n,r.p,1,0,i):a,sw:r.sw?s(n,r.sw,0,0,i):a,sc:r.sc?s(n,r.sc,1,0,i):a,fc:r.fc?s(n,r.fc,1,0,i):a,fh:r.fh?s(n,r.fh,0,0,i):a,fs:r.fs?s(n,r.fs,0,.01,i):a,fb:r.fb?s(n,r.fb,0,.01,i):a,t:r.t?s(n,r.t,0,0,i):a},this.s=TextSelectorProp.getTextSelectorProp(n,e.s,i),this.s.t=e.s.t}function TextAnimatorProperty(n,e,i){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=n,this._renderType=e,this._elem=i,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(i)}TextAnimatorProperty.prototype.searchProperties=function(){var n,e=this._textData.a.length,i,a=PropertyFactory.getProp;for(n=0;n<e;n+=1)i=this._textData.a[n],this._animatorsData[n]=new TextAnimatorDataProperty(this._elem,i,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:a(this._elem,this._textData.p.a,0,0,this),f:a(this._elem,this._textData.p.f,0,0,this),l:a(this._elem,this._textData.p.l,0,0,this),r:a(this._elem,this._textData.p.r,0,0,this),p:a(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=a(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(n,e){if(this.lettersChangedFlag=e,!(!this._mdf&&!this._isFirstFrame&&!e&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var i=this._moreOptions.alignment.v,a=this._animatorsData,s=this._textData,r=this.mHelper,o=this._renderType,l=this.renderedLetters.length,u,c,d,p,f=n.l,m,P,T,x,y,S,g,C,E,B,_,M,D,L,F;if(this._hasMaskedPath){if(F=this._pathData.m,!this._pathData.n||this._pathData._mdf){var N=F.v;this._pathData.r.v&&(N=N.reverse()),m={tLength:0,segments:[]},p=N._length-1;var H;for(M=0,d=0;d<p;d+=1)H=bez.buildBezierData(N.v[d],N.v[d+1],[N.o[d][0]-N.v[d][0],N.o[d][1]-N.v[d][1]],[N.i[d+1][0]-N.v[d+1][0],N.i[d+1][1]-N.v[d+1][1]]),m.tLength+=H.segmentLength,m.segments.push(H),M+=H.segmentLength;d=p,F.v.c&&(H=bez.buildBezierData(N.v[d],N.v[0],[N.o[d][0]-N.v[d][0],N.o[d][1]-N.v[d][1]],[N.i[0][0]-N.v[0][0],N.i[0][1]-N.v[0][1]]),m.tLength+=H.segmentLength,m.segments.push(H),M+=H.segmentLength),this._pathData.pi=m}if(m=this._pathData.pi,P=this._pathData.f.v,g=0,S=1,x=0,y=!0,B=m.segments,P<0&&F.v.c)for(m.tLength<Math.abs(P)&&(P=-Math.abs(P)%m.tLength),g=B.length-1,E=B[g].points,S=E.length-1;P<0;)P+=E[S].partialLength,S-=1,S<0&&(g-=1,E=B[g].points,S=E.length-1);E=B[g].points,C=E[S-1],T=E[S],_=T.partialLength}p=f.length,u=0,c=0;var $=n.finalSize*1.2*.714,O=!0,b,I,V,A,k;A=a.length;var R,G=-1,z,q,U,K=P,Q=g,ne=S,Ee=-1,ye,ge,xe,oe,Y,Ne,Oe,Le,Ce="",De=this.defaultPropsArray,ae;if(n.j===2||n.j===1){var re=0,de=0,Be=n.j===2?-.5:-1,he=0,Ie=!0;for(d=0;d<p;d+=1)if(f[d].n){for(re&&(re+=de);he<d;)f[he].animatorJustifyOffset=re,he+=1;re=0,Ie=!0}else{for(V=0;V<A;V+=1)b=a[V].a,b.t.propType&&(Ie&&n.j===2&&(de+=b.t.v*Be),I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?re+=b.t.v*R[0]*Be:re+=b.t.v*R*Be);Ie=!1}for(re&&(re+=de);he<d;)f[he].animatorJustifyOffset=re,he+=1}for(d=0;d<p;d+=1){if(r.reset(),ye=1,f[d].n)u=0,c+=n.yOffset,c+=O?1:0,P=K,O=!1,this._hasMaskedPath&&(g=Q,S=ne,E=B[g].points,C=E[S-1],T=E[S],_=T.partialLength,x=0),Ce="",Le="",Ne="",ae="",De=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Ee!==f[d].line){switch(n.j){case 1:P+=M-n.lineWidths[f[d].line];break;case 2:P+=(M-n.lineWidths[f[d].line])/2;break}Ee=f[d].line}G!==f[d].ind&&(f[G]&&(P+=f[G].extra),P+=f[d].an/2,G=f[d].ind),P+=i[0]*f[d].an*.005;var Ae=0;for(V=0;V<A;V+=1)b=a[V].a,b.p.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?Ae+=b.p.v[0]*R[0]:Ae+=b.p.v[0]*R),b.a.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?Ae+=b.a.v[0]*R[0]:Ae+=b.a.v[0]*R);for(y=!0,this._pathData.a.v&&(P=f[0].an*.5+(M-this._pathData.f.v-f[0].an*.5-f[f.length-1].an*.5)*G/(p-1),P+=this._pathData.f.v);y;)x+_>=P+Ae||!E?(D=(P+Ae-x)/T.partialLength,q=C.point[0]+(T.point[0]-C.point[0])*D,U=C.point[1]+(T.point[1]-C.point[1])*D,r.translate(-i[0]*f[d].an*.005,-(i[1]*$)*.01),y=!1):E&&(x+=T.partialLength,S+=1,S>=E.length&&(S=0,g+=1,B[g]?E=B[g].points:F.v.c?(S=0,g=0,E=B[g].points):(x-=T.partialLength,E=null)),E&&(C=T,T=E[S],_=T.partialLength));z=f[d].an/2-f[d].add,r.translate(-z,0,0)}else z=f[d].an/2-f[d].add,r.translate(-z,0,0),r.translate(-i[0]*f[d].an*.005,-i[1]*$*.01,0);for(V=0;V<A;V+=1)b=a[V].a,b.t.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),(u!==0||n.j!==0)&&(this._hasMaskedPath?R.length?P+=b.t.v*R[0]:P+=b.t.v*R:R.length?u+=b.t.v*R[0]:u+=b.t.v*R));for(n.strokeWidthAnim&&(xe=n.sw||0),n.strokeColorAnim&&(n.sc?ge=[n.sc[0],n.sc[1],n.sc[2]]:ge=[0,0,0]),n.fillColorAnim&&n.fc&&(oe=[n.fc[0],n.fc[1],n.fc[2]]),V=0;V<A;V+=1)b=a[V].a,b.a.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?r.translate(-b.a.v[0]*R[0],-b.a.v[1]*R[1],b.a.v[2]*R[2]):r.translate(-b.a.v[0]*R,-b.a.v[1]*R,b.a.v[2]*R));for(V=0;V<A;V+=1)b=a[V].a,b.s.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?r.scale(1+(b.s.v[0]-1)*R[0],1+(b.s.v[1]-1)*R[1],1):r.scale(1+(b.s.v[0]-1)*R,1+(b.s.v[1]-1)*R,1));for(V=0;V<A;V+=1){if(b=a[V].a,I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),b.sk.propType&&(R.length?r.skewFromAxis(-b.sk.v*R[0],b.sa.v*R[1]):r.skewFromAxis(-b.sk.v*R,b.sa.v*R)),b.r.propType&&(R.length?r.rotateZ(-b.r.v*R[2]):r.rotateZ(-b.r.v*R)),b.ry.propType&&(R.length?r.rotateY(b.ry.v*R[1]):r.rotateY(b.ry.v*R)),b.rx.propType&&(R.length?r.rotateX(b.rx.v*R[0]):r.rotateX(b.rx.v*R)),b.o.propType&&(R.length?ye+=(b.o.v*R[0]-ye)*R[0]:ye+=(b.o.v*R-ye)*R),n.strokeWidthAnim&&b.sw.propType&&(R.length?xe+=b.sw.v*R[0]:xe+=b.sw.v*R),n.strokeColorAnim&&b.sc.propType)for(Y=0;Y<3;Y+=1)R.length?ge[Y]+=(b.sc.v[Y]-ge[Y])*R[0]:ge[Y]+=(b.sc.v[Y]-ge[Y])*R;if(n.fillColorAnim&&n.fc){if(b.fc.propType)for(Y=0;Y<3;Y+=1)R.length?oe[Y]+=(b.fc.v[Y]-oe[Y])*R[0]:oe[Y]+=(b.fc.v[Y]-oe[Y])*R;b.fh.propType&&(R.length?oe=addHueToRGB(oe,b.fh.v*R[0]):oe=addHueToRGB(oe,b.fh.v*R)),b.fs.propType&&(R.length?oe=addSaturationToRGB(oe,b.fs.v*R[0]):oe=addSaturationToRGB(oe,b.fs.v*R)),b.fb.propType&&(R.length?oe=addBrightnessToRGB(oe,b.fb.v*R[0]):oe=addBrightnessToRGB(oe,b.fb.v*R))}}for(V=0;V<A;V+=1)b=a[V].a,b.p.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),this._hasMaskedPath?R.length?r.translate(0,b.p.v[1]*R[0],-b.p.v[2]*R[1]):r.translate(0,b.p.v[1]*R,-b.p.v[2]*R):R.length?r.translate(b.p.v[0]*R[0],b.p.v[1]*R[1],-b.p.v[2]*R[2]):r.translate(b.p.v[0]*R,b.p.v[1]*R,-b.p.v[2]*R));if(n.strokeWidthAnim&&(Ne=xe<0?0:xe),n.strokeColorAnim&&(Oe="rgb("+Math.round(ge[0]*255)+","+Math.round(ge[1]*255)+","+Math.round(ge[2]*255)+")"),n.fillColorAnim&&n.fc&&(Le="rgb("+Math.round(oe[0]*255)+","+Math.round(oe[1]*255)+","+Math.round(oe[2]*255)+")"),this._hasMaskedPath){if(r.translate(0,-n.ls),r.translate(0,i[1]*$*.01+c,0),this._pathData.p.v){L=(T.point[1]-C.point[1])/(T.point[0]-C.point[0]);var we=Math.atan(L)*180/Math.PI;T.point[0]<C.point[0]&&(we+=180),r.rotate(-we*Math.PI/180)}r.translate(q,U,0),P-=i[0]*f[d].an*.005,f[d+1]&&G!==f[d+1].ind&&(P+=f[d].an/2,P+=n.tr*.001*n.finalSize)}else{switch(r.translate(u,c,0),n.ps&&r.translate(n.ps[0],n.ps[1]+n.ascent,0),n.j){case 1:r.translate(f[d].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[f[d].line]),0,0);break;case 2:r.translate(f[d].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[f[d].line])/2,0,0);break}r.translate(0,-n.ls),r.translate(z,0,0),r.translate(i[0]*f[d].an*.005,i[1]*$*.01,0),u+=f[d].l+n.tr*.001*n.finalSize}o==="html"?Ce=r.toCSS():o==="svg"?Ce=r.to2dCSS():De=[r.props[0],r.props[1],r.props[2],r.props[3],r.props[4],r.props[5],r.props[6],r.props[7],r.props[8],r.props[9],r.props[10],r.props[11],r.props[12],r.props[13],r.props[14],r.props[15]],ae=ye}l<=d?(k=new LetterProps(ae,Ne,Oe,Le,Ce,De),this.renderedLetters.push(k),l+=1,this.lettersChangedFlag=!0):(k=this.renderedLetters[d],this.lettersChangedFlag=k.update(ae,Ne,Oe,Le,Ce,De)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty);function ITextElement(){}ITextElement.prototype.initElement=function(n,e,i){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(n,e,i),this.textProperty=new TextProperty(this,n.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(n.t,this.renderType,this),this.initTransform(n,e,i),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(n){this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange)},ITextElement.prototype.createPathShape=function(n,e){var i,a=e.length,s,r="";for(i=0;i<a;i+=1)e[i].ty==="sh"&&(s=e[i].ks.k,r+=buildShapeString(s,s.i.length,!0,n));return r},ITextElement.prototype.updateDocumentData=function(n,e){this.textProperty.updateDocumentData(n,e)},ITextElement.prototype.canResizeFont=function(n){this.textProperty.canResizeFont(n)},ITextElement.prototype.setMinimumFontSize=function(n){this.textProperty.setMinimumFontSize(n)},ITextElement.prototype.applyTextPropertiesToMatrix=function(n,e,i,a,s){switch(n.ps&&e.translate(n.ps[0],n.ps[1]+n.ascent,0),e.translate(0,-n.ls,0),n.j){case 1:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i]),0,0);break;case 2:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i])/2,0,0);break}e.translate(a,s,0)},ITextElement.prototype.buildColor=function(n){return"rgb("+Math.round(n[0]*255)+","+Math.round(n[1]*255)+","+Math.round(n[2]*255)+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(n,e,i){this.textSpans=[],this.renderType="svg",this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(n){for(var e=0,i=n.length,a=[],s="";e<i;)n[e]==="\r"||n[e]===""?(a.push(s),s=""):s+=n[e],e+=1;return a.push(s),a},SVGTextLottieElement.prototype.buildShapeData=function(n,e){if(n.shapes&&n.shapes.length){var i=n.shapes[0];if(i.it){var a=i.it[i.it.length-1];a.s&&(a.s.k[0]=e,a.s.k[1]=e)}}return n},SVGTextLottieElement.prototype.buildNewText=function(){this.addDynamicProperty(this);var n,e,i=this.textProperty.currentData;this.renderedLetters=createSizedArray(i?i.l.length:0),i.fc?this.layerElement.setAttribute("fill",this.buildColor(i.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),i.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(i.sc)),this.layerElement.setAttribute("stroke-width",i.sw)),this.layerElement.setAttribute("font-size",i.finalSize);var a=this.globalData.fontManager.getFontByName(i.f);if(a.fClass)this.layerElement.setAttribute("class",a.fClass);else{this.layerElement.setAttribute("font-family",a.fFamily);var s=i.fWeight,r=i.fStyle;this.layerElement.setAttribute("font-style",r),this.layerElement.setAttribute("font-weight",s)}this.layerElement.setAttribute("aria-label",i.t);var o=i.l||[],l=!!this.globalData.fontManager.chars;e=o.length;var u,c=this.mHelper,d="",p=this.data.singleShape,f=0,m=0,P=!0,T=i.tr*.001*i.finalSize;if(p&&!l&&!i.sz){var x=this.textContainer,y="start";switch(i.j){case 1:y="end";break;case 2:y="middle";break;default:y="start";break}x.setAttribute("text-anchor",y),x.setAttribute("letter-spacing",T);var S=this.buildTextContents(i.finalText);for(e=S.length,m=i.ps?i.ps[1]+i.ascent:0,n=0;n<e;n+=1)u=this.textSpans[n].span||createNS("tspan"),u.textContent=S[n],u.setAttribute("x",0),u.setAttribute("y",m),u.style.display="inherit",x.appendChild(u),this.textSpans[n]||(this.textSpans[n]={span:null,glyph:null}),this.textSpans[n].span=u,m+=i.finalLineHeight;this.layerElement.appendChild(x)}else{var g=this.textSpans.length,C;for(n=0;n<e;n+=1){if(this.textSpans[n]||(this.textSpans[n]={span:null,childSpan:null,glyph:null}),!l||!p||n===0){if(u=g>n?this.textSpans[n].span:createNS(l?"g":"text"),g<=n){if(u.setAttribute("stroke-linecap","butt"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit","4"),this.textSpans[n].span=u,l){var E=createNS("g");u.appendChild(E),this.textSpans[n].childSpan=E}this.textSpans[n].span=u,this.layerElement.appendChild(u)}u.style.display="inherit"}if(c.reset(),p&&(o[n].n&&(f=-T,m+=i.yOffset,m+=P?1:0,P=!1),this.applyTextPropertiesToMatrix(i,c,o[n].line,f,m),f+=o[n].l||0,f+=T),l){C=this.globalData.fontManager.getCharData(i.finalText[n],a.fStyle,this.globalData.fontManager.getFontByName(i.f).fFamily);var B;if(C.t===1)B=new SVGCompElement(C.data,this.globalData,this);else{var _=emptyShapeData;C.data&&C.data.shapes&&(_=this.buildShapeData(C.data,i.finalSize)),B=new SVGShapeElement(_,this.globalData,this)}if(this.textSpans[n].glyph){var M=this.textSpans[n].glyph;this.textSpans[n].childSpan.removeChild(M.layerElement),M.destroy()}this.textSpans[n].glyph=B,B._debug=!0,B.prepareFrame(0),B.renderFrame(),this.textSpans[n].childSpan.appendChild(B.layerElement),C.t===1&&this.textSpans[n].childSpan.setAttribute("transform","scale("+i.finalSize/100+","+i.finalSize/100+")")}else p&&u.setAttribute("transform","translate("+c.props[12]+","+c.props[13]+")"),u.textContent=o[n].val,u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}p&&u&&u.setAttribute("d",d)}for(;n<this.textSpans.length;)this.textSpans[n].span.style.display="none",n+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var n=this.layerElement.getBBox();this.bbox={top:n.y,left:n.x,width:n.width,height:n.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var n,e=this.textSpans.length,i;for(this.renderedFrame=this.comp.renderedFrame,n=0;n<e;n+=1)i=this.textSpans[n].glyph,i&&(i.prepareFrame(this.comp.renderedFrame-this.data.st),i._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var n,e,i=this.textAnimator.renderedLetters,a=this.textProperty.currentData.l;e=a.length;var s,r,o;for(n=0;n<e;n+=1)a[n].n||(s=i[n],r=this.textSpans[n].span,o=this.textSpans[n].glyph,o&&o.renderFrame(),s._mdf.m&&r.setAttribute("transform",s.m),s._mdf.o&&r.setAttribute("opacity",s.o),s._mdf.sw&&r.setAttribute("stroke-width",s.sw),s._mdf.sc&&r.setAttribute("stroke",s.sc),s._mdf.fc&&r.setAttribute("fill",s.fc))}};function ISolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var n=createNS("rect");n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.layerElement.appendChild(n)};function NullElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initFrame(),this.initTransform(n,e,i),this.initHierarchy()}NullElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement);function SVGRendererBase(){}extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(n){return new NullElement(n,this.globalData,this)},SVGRendererBase.prototype.createShape=function(n){return new SVGShapeElement(n,this.globalData,this)},SVGRendererBase.prototype.createText=function(n){return new SVGTextLottieElement(n,this.globalData,this)},SVGRendererBase.prototype.createImage=function(n){return new IImageElement(n,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(n){return new ISolidElement(n,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(n){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+n.w+" "+n.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",n.w),this.svgElement.setAttribute("height",n.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(n,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=n;var i=createNS("clipPath"),a=createNS("rect");a.setAttribute("width",n.w),a.setAttribute("height",n.h),a.setAttribute("x",0),a.setAttribute("y",0);var s=createElementID();i.setAttribute("id",s),i.appendChild(a),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+s+")"),e.appendChild(i),this.layers=n.layers,this.elements=createSizedArray(n.layers.length)},SVGRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(n){var e=0,i=this.layers.length;for(e=0;e<i;e+=1)if(this.layers[e].ind===n)return e;return-1},SVGRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){e[n]=!0;var i=this.createItem(this.layers[n]);if(e[n]=i,getExpressionsPlugin()&&(this.layers[n].ty===0&&this.globalData.projectInterface.registerComposition(i),i.initExpressions()),this.appendElementInPos(i,n),this.layers[n].tt){var a="tp"in this.layers[n]?this.findIndexByInd(this.layers[n].tp):n-1;if(a===-1)return;if(!this.elements[a]||this.elements[a]===!0)this.buildItem(a),this.addPendingElement(i);else{var s=e[a],r=s.getMatte(this.layers[n].tt);i.setMatte(r)}}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();if(n.checkParenting(),n.data.tt)for(var e=0,i=this.elements.length;e<i;){if(this.elements[e]===n){var a="tp"in n.data?this.findIndexByInd(n.data.tp):e-1,s=this.elements[a],r=s.getMatte(this.layers[e].tt);n.setMatte(r);break}e+=1}}},SVGRendererBase.prototype.renderFrame=function(n){if(!(this.renderedFrame===n||this.destroyed)){n===null?n=this.renderedFrame:this.renderedFrame=n,this.globalData.frameNum=n,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=n,this.globalData._mdf=!1;var e,i=this.layers.length;for(this.completeLayers||this.checkLayers(n),e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(n-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<i;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){for(var a=0,s;a<e;)this.elements[a]&&this.elements[a]!==!0&&this.elements[a].getBaseElement()&&(s=this.elements[a].getBaseElement()),a+=1;s?this.layerElement.insertBefore(i,s):this.layerElement.appendChild(i)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"};function ICompElement(){}extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initTransform(n,e,i),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!e.progressiveLoad)&&this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(n){if(this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=n/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var i,a=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&(this.elements[i].prepareFrame(this.renderedFrame-this.layers[i].st),this.elements[i]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)(this.completeLayers||this.elements[n])&&this.elements[n].renderFrame()},ICompElement.prototype.setElements=function(n){this.elements=n},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function SVGCompElement(n,e,i){this.layers=n.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function SVGRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var i="";if(e&&e.title){var a=createNS("title"),s=createElementID();a.setAttribute("id",s),a.textContent=e.title,this.svgElement.appendChild(a),i+=s}if(e&&e.description){var r=createNS("desc"),o=createElementID();r.setAttribute("id",o),r.textContent=e.description,this.svgElement.appendChild(r),i+=" "+o}i&&this.svgElement.setAttribute("aria-labelledby",i);var l=createNS("defs");this.svgElement.appendChild(l);var u=createNS("g");this.svgElement.appendChild(u),this.layerElement=u,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!(e&&e.hideOnTransparent===!1),viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"},width:e&&e.width,height:e&&e.height,runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:l,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}ShapeTransformManager.prototype={addTransformSequence:function(e){var i,a=e.length,s="_";for(i=0;i<a;i+=1)s+=e[i].transform.key+"_";var r=this.sequences[s];return r||(r={transforms:[].concat(e),finalTransform:new Matrix,_mdf:!1},this.sequences[s]=r,this.sequenceList.push(r)),r},processSequence:function(e,i){for(var a=0,s=e.transforms.length,r=i;a<s&&!i;){if(e.transforms[a].transform.mProps._mdf){r=!0;break}a+=1}if(r)for(e.finalTransform.reset(),a=s-1;a>=0;a-=1)e.finalTransform.multiply(e.transforms[a].transform.mProps.v);e._mdf=r},processSequences:function(e){var i,a=this.sequenceList.length;for(i=0;i<a;i+=1)this.processSequence(this.sequenceList[i],e)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var e="__lottie_element_luma_buffer",i=null,a=null,s=null;function r(){var u=createNS("svg"),c=createNS("filter"),d=createNS("feColorMatrix");return c.setAttribute("id",e),d.setAttribute("type","matrix"),d.setAttribute("color-interpolation-filters","sRGB"),d.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),c.appendChild(d),u.appendChild(c),u.setAttribute("id",e+"_svg"),featureSupport.svgLumaHidden&&(u.style.display="none"),u}function o(){i||(s=r(),document.body.appendChild(s),i=createTag("canvas"),a=i.getContext("2d"),a.filter="url(#"+e+")",a.fillStyle="rgba(0,0,0,0)",a.fillRect(0,0,1,1))}function l(u){return i||o(),i.width=u.width,i.height=u.height,a.filter="url(#"+e+")",i}return{load:o,get:l}};function createCanvas(n,e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(n,e);var i=createTag("canvas");return i.width=n,i.height=e,i}var assetLoader=function(){return{loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas}}(),registeredEffects={};function CVEffects(n){var e,i=n.data.ef?n.data.ef.length:0;this.filters=[];var a;for(e=0;e<i;e+=1){a=null;var s=n.data.ef[e].ty;if(registeredEffects[s]){var r=registeredEffects[s].effect;a=new r(n.effectsManager.effectElements[e],n)}a&&this.filters.push(a)}this.filters.length&&n.addRenderableComponent(this)}CVEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},CVEffects.prototype.getEffects=function(n){var e,i=this.filters.length,a=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&a.push(this.filters[e]);return a};function registerEffect(n,e){registeredEffects[n]={effect:e}}function CVMaskElement(n,e){this.data=n,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var i,a=this.masksProperties.length,s=!1;for(i=0;i<a;i+=1)this.masksProperties[i].mode!=="n"&&(s=!0),this.viewData[i]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);this.hasMasks=s,s&&this.element.addRenderableComponent(this)}CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var n=this.element.finalTransform.mat,e=this.element.canvasContext,i,a=this.masksProperties.length,s,r,o;for(e.beginPath(),i=0;i<a;i+=1)if(this.masksProperties[i].mode!=="n"){this.masksProperties[i].inv&&(e.moveTo(0,0),e.lineTo(this.element.globalData.compSize.w,0),e.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),e.lineTo(0,this.element.globalData.compSize.h),e.lineTo(0,0)),o=this.viewData[i].v,s=n.applyToPointArray(o.v[0][0],o.v[0][1],0),e.moveTo(s[0],s[1]);var l,u=o._length;for(l=1;l<u;l+=1)r=n.applyToTriplePoints(o.o[l-1],o.i[l],o.v[l]),e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);r=n.applyToTriplePoints(o.o[l-1],o.i[0],o.v[0]),e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5])}this.element.globalData.renderer.save(!0),e.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};function CVBaseElement(){}var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var e=this.globalData.canvasContext,i=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(i);var a=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(a),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var i=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=i}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var a=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(a.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),r=s.getContext("2d");r.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var i=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(i),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(i),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(n,e,i,a){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;e.ty==="rc"?s=5:e.ty==="el"?s=6:e.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(n,e,s,n);var r,o=i.length,l;for(r=0;r<o;r+=1)i[r].closed||(l={transforms:a.addTransformSequence(i[r].transforms),trNodes:[]},this.styledShapes.push(l),i[r].elements.push(l))}CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated;function CVShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(n,e){var i={data:n,type:n.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:n.hd===!0},a={};if(n.ty==="fl"||n.ty==="st"?(a.c=PropertyFactory.getProp(this,n.c,1,255,this),a.c.k||(i.co="rgb("+bmFloor(a.c.v[0])+","+bmFloor(a.c.v[1])+","+bmFloor(a.c.v[2])+")")):(n.ty==="gf"||n.ty==="gs")&&(a.s=PropertyFactory.getProp(this,n.s,1,null,this),a.e=PropertyFactory.getProp(this,n.e,1,null,this),a.h=PropertyFactory.getProp(this,n.h||{k:0},0,.01,this),a.a=PropertyFactory.getProp(this,n.a||{k:0},0,degToRads,this),a.g=new GradientProperty(this,n.g,this)),a.o=PropertyFactory.getProp(this,n.o,0,.01,this),n.ty==="st"||n.ty==="gs"){if(i.lc=lineCapEnum[n.lc||2],i.lj=lineJoinEnum[n.lj||2],n.lj==1&&(i.ml=n.ml),a.w=PropertyFactory.getProp(this,n.w,0,null,this),a.w.k||(i.wi=a.w.v),n.d){var s=new DashProperty(this,n.d,"canvas",this);a.d=s,a.d.k||(i.da=a.d.dashArray,i.do=a.d.dashoffset[0])}}else i.r=n.r===2?"evenodd":"nonzero";return this.stylesList.push(i),a.style=i,a},CVShapeElement.prototype.createGroupElement=function(){var n={it:[],prevViewData:[]};return n},CVShapeElement.prototype.createTransformElement=function(n){var e={transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,n.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,n,this)}};return e},CVShapeElement.prototype.createShapeElement=function(n){var e=new CVShapeData(this,n,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(n){var e,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(n)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].closed||this.stylesList[n].transforms.pop()},CVShapeElement.prototype.closeStyles=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].closed=!0},CVShapeElement.prototype.searchShapes=function(n,e,i,a,s){var r,o=n.length-1,l,u,c=[],d=[],p,f,m,P=[].concat(s);for(r=o;r>=0;r-=1){if(p=this.searchProcessedElement(n[r]),p?e[r]=i[p-1]:n[r]._shouldRender=a,n[r].ty==="fl"||n[r].ty==="st"||n[r].ty==="gf"||n[r].ty==="gs")p?e[r].style.closed=!1:e[r]=this.createStyleElement(n[r],P),c.push(e[r].style);else if(n[r].ty==="gr"){if(!p)e[r]=this.createGroupElement(n[r]);else for(u=e[r].it.length,l=0;l<u;l+=1)e[r].prevViewData[l]=e[r].it[l];this.searchShapes(n[r].it,e[r].it,e[r].prevViewData,a,P)}else n[r].ty==="tr"?(p||(m=this.createTransformElement(n[r]),e[r]=m),P.push(e[r]),this.addTransformToStyleList(e[r])):n[r].ty==="sh"||n[r].ty==="rc"||n[r].ty==="el"||n[r].ty==="sr"?p||(e[r]=this.createShapeElement(n[r])):n[r].ty==="tm"||n[r].ty==="rd"||n[r].ty==="pb"||n[r].ty==="zz"||n[r].ty==="op"?(p?(f=e[r],f.closed=!1):(f=ShapeModifiers.getModifier(n[r].ty),f.init(this,n[r]),e[r]=f,this.shapeModifiers.push(f)),d.push(f)):n[r].ty==="rp"&&(p?(f=e[r],f.closed=!0):(f=ShapeModifiers.getModifier(n[r].ty),e[r]=f,f.init(this,n,r,e),this.shapeModifiers.push(f),a=!1),d.push(f));this.addProcessedElement(n[r],r+1)}for(this.removeTransformFromStyleList(),this.closeStyles(c),o=d.length,r=0;r<o;r+=1)d[r].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(n,e){(n._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=n.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var n,e=this.stylesList.length,i,a,s,r,o,l,u=this.globalData.renderer,c=this.globalData.canvasContext,d,p;for(n=0;n<e;n+=1)if(p=this.stylesList[n],d=p.type,!((d==="st"||d==="gs")&&p.wi===0||!p.data._shouldRender||p.coOp===0||this.globalData.currentGlobalAlpha===0)){for(u.save(),o=p.elements,d==="st"||d==="gs"?(u.ctxStrokeStyle(d==="st"?p.co:p.grd),u.ctxLineWidth(p.wi),u.ctxLineCap(p.lc),u.ctxLineJoin(p.lj),u.ctxMiterLimit(p.ml||0)):u.ctxFillStyle(d==="fl"?p.co:p.grd),u.ctxOpacity(p.coOp),d!=="st"&&d!=="gs"&&c.beginPath(),u.ctxTransform(p.preTransforms.finalTransform.props),a=o.length,i=0;i<a;i+=1){for((d==="st"||d==="gs")&&(c.beginPath(),p.da&&(c.setLineDash(p.da),c.lineDashOffset=p.do)),l=o[i].trNodes,r=l.length,s=0;s<r;s+=1)l[s].t==="m"?c.moveTo(l[s].p[0],l[s].p[1]):l[s].t==="c"?c.bezierCurveTo(l[s].pts[0],l[s].pts[1],l[s].pts[2],l[s].pts[3],l[s].pts[4],l[s].pts[5]):c.closePath();(d==="st"||d==="gs")&&(u.ctxStroke(),p.da&&c.setLineDash(this.dashResetter))}d!=="st"&&d!=="gs"&&this.globalData.renderer.ctxFill(p.r),u.restore()}},CVShapeElement.prototype.renderShape=function(n,e,i,a){var s,r=e.length-1,o;for(o=n,s=r;s>=0;s-=1)e[s].ty==="tr"?(o=i[s].transform,this.renderShapeTransform(n,o)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],i[s]):e[s].ty==="fl"?this.renderFill(e[s],i[s],o):e[s].ty==="st"?this.renderStroke(e[s],i[s],o):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],i[s],o):e[s].ty==="gr"?this.renderShape(o,e[s].it,i[s].it):e[s].ty;a&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(n,e){if(this._isFirstFrame||e._mdf||n.transforms._mdf){var i=n.trNodes,a=e.paths,s,r,o,l=a._length;i.length=0;var u=n.transforms.finalTransform;for(o=0;o<l;o+=1){var c=a.shapes[o];if(c&&c.v){for(r=c._length,s=1;s<r;s+=1)s===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),i.push({t:"c",pts:u.applyToTriplePoints(c.o[s-1],c.i[s],c.v[s])});r===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),c.c&&r&&(i.push({t:"c",pts:u.applyToTriplePoints(c.o[s-1],c.i[0],c.v[0])}),i.push({t:"z"}))}}n.trNodes=i}},CVShapeElement.prototype.renderPath=function(n,e){if(n.hd!==!0&&n._shouldRender){var i,a=e.styledShapes.length;for(i=0;i<a;i+=1)this.renderStyledShape(e.styledShapes[i],e.sh)}},CVShapeElement.prototype.renderFill=function(n,e,i){var a=e.style;(e.c._mdf||this._isFirstFrame)&&(a.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(a.coOp=e.o.v*i.opacity)},CVShapeElement.prototype.renderGradientFill=function(n,e,i){var a=e.style,s;if(!a.grd||e.g._mdf||e.s._mdf||e.e._mdf||n.t!==1&&(e.h._mdf||e.a._mdf)){var r=this.globalData.canvasContext,o=e.s.v,l=e.e.v;if(n.t===1)s=r.createLinearGradient(o[0],o[1],l[0],l[1]);else{var u=Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),c=Math.atan2(l[1]-o[1],l[0]-o[0]),d=e.h.v;d>=1?d=.99:d<=-1&&(d=-.99);var p=u*d,f=Math.cos(c+e.a.v)*p+o[0],m=Math.sin(c+e.a.v)*p+o[1];s=r.createRadialGradient(f,m,0,o[0],o[1],u)}var P,T=n.g.p,x=e.g.c,y=1;for(P=0;P<T;P+=1)e.g._hasOpacity&&e.g._collapsable&&(y=e.g.o[P*2+1]),s.addColorStop(x[P*4]/100,"rgba("+x[P*4+1]+","+x[P*4+2]+","+x[P*4+3]+","+y+")");a.grd=s}a.coOp=e.o.v*i.opacity},CVShapeElement.prototype.renderStroke=function(n,e,i){var a=e.style,s=e.d;s&&(s._mdf||this._isFirstFrame)&&(a.da=s.dashArray,a.do=s.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(a.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(a.coOp=e.o.v*i.opacity),(e.w._mdf||this._isFirstFrame)&&(a.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0};function CVTextElement(n,e,i){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=!1;n.fc?(e=!0,this.values.fill=this.buildColor(n.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var i=!1;n.sc&&(i=!0,this.values.stroke=this.buildColor(n.sc),this.values.sWidth=n.sw);var a=this.globalData.fontManager.getFontByName(n.f),s,r,o=n.l,l=this.mHelper;this.stroke=i,this.values.fValue=n.finalSize+"px "+this.globalData.fontManager.getFontByName(n.f).fFamily,r=n.finalText.length;var u,c,d,p,f,m,P,T,x,y,S=this.data.singleShape,g=n.tr*.001*n.finalSize,C=0,E=0,B=!0,_=0;for(s=0;s<r;s+=1){u=this.globalData.fontManager.getCharData(n.finalText[s],a.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),c=u&&u.data||{},l.reset(),S&&o[s].n&&(C=-g,E+=n.yOffset,E+=B?1:0,B=!1),f=c.shapes?c.shapes[0].it:[],P=f.length,l.scale(n.finalSize/100,n.finalSize/100),S&&this.applyTextPropertiesToMatrix(n,l,o[s].line,C,E),x=createSizedArray(P-1);var M=0;for(m=0;m<P;m+=1)if(f[m].ty==="sh"){for(p=f[m].ks.k.i.length,T=f[m].ks.k,y=[],d=1;d<p;d+=1)d===1&&y.push(l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),y.push(l.applyToX(T.o[d-1][0],T.o[d-1][1],0),l.applyToY(T.o[d-1][0],T.o[d-1][1],0),l.applyToX(T.i[d][0],T.i[d][1],0),l.applyToY(T.i[d][0],T.i[d][1],0),l.applyToX(T.v[d][0],T.v[d][1],0),l.applyToY(T.v[d][0],T.v[d][1],0));y.push(l.applyToX(T.o[d-1][0],T.o[d-1][1],0),l.applyToY(T.o[d-1][0],T.o[d-1][1],0),l.applyToX(T.i[0][0],T.i[0][1],0),l.applyToY(T.i[0][0],T.i[0][1],0),l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),x[M]=y,M+=1}S&&(C+=o[s].l,C+=g),this.textSpans[_]?this.textSpans[_].elem=x:this.textSpans[_]={elem:x},_+=1}},CVTextElement.prototype.renderInnerContent=function(){this.validateText();var n=this.canvasContext;n.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var e,i,a,s,r,o,l=this.textAnimator.renderedLetters,u=this.textProperty.currentData.l;i=u.length;var c,d=null,p=null,f=null,m,P,T=this.globalData.renderer;for(e=0;e<i;e+=1)if(!u[e].n){if(c=l[e],c&&(T.save(),T.ctxTransform(c.p),T.ctxOpacity(c.o)),this.fill){for(c&&c.fc?d!==c.fc&&(T.ctxFillStyle(c.fc),d=c.fc):d!==this.values.fill&&(d=this.values.fill,T.ctxFillStyle(this.values.fill)),m=this.textSpans[e].elem,s=m.length,this.globalData.canvasContext.beginPath(),a=0;a<s;a+=1)for(P=m[a],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),r=2;r<o;r+=6)this.globalData.canvasContext.bezierCurveTo(P[r],P[r+1],P[r+2],P[r+3],P[r+4],P[r+5]);this.globalData.canvasContext.closePath(),T.ctxFill()}if(this.stroke){for(c&&c.sw?f!==c.sw&&(f=c.sw,T.ctxLineWidth(c.sw)):f!==this.values.sWidth&&(f=this.values.sWidth,T.ctxLineWidth(this.values.sWidth)),c&&c.sc?p!==c.sc&&(p=c.sc,T.ctxStrokeStyle(c.sc)):p!==this.values.stroke&&(p=this.values.stroke,T.ctxStrokeStyle(this.values.stroke)),m=this.textSpans[e].elem,s=m.length,this.globalData.canvasContext.beginPath(),a=0;a<s;a+=1)for(P=m[a],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),r=2;r<o;r+=6)this.globalData.canvasContext.bezierCurveTo(P[r],P[r+1],P[r+2],P[r+3],P[r+4],P[r+5]);this.globalData.canvasContext.closePath(),T.ctxStroke()}c&&this.globalData.renderer.restore()}};function CVImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.img=e.imageLoader.getAsset(this.assetData),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var n=createTag("canvas");n.width=this.assetData.w,n.height=this.assetData.h;var e=n.getContext("2d"),i=this.img.width,a=this.img.height,s=i/a,r=this.assetData.w/this.assetData.h,o,l,u=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;s>r&&u==="xMidYMid slice"||s<r&&u!=="xMidYMid slice"?(l=a,o=l*r):(o=i,l=o/r),e.drawImage(this.img,(i-o)/2,(a-l)/2,o,l,0,0,this.assetData.w,this.assetData.h),this.img=n}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null};function CVSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)};function CanvasRendererBase(){}extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(n){return new CVShapeElement(n,this.globalData,this)},CanvasRendererBase.prototype.createText=function(n){return new CVTextElement(n,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(n){return new CVImageElement(n,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(n){return new CVSolidElement(n,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(n){n[0]===1&&n[1]===0&&n[4]===0&&n[5]===1&&n[12]===0&&n[13]===0||this.canvasContext.transform(n[0],n[1],n[4],n[5],n[12],n[13])},CanvasRendererBase.prototype.ctxOpacity=function(n){this.canvasContext.globalAlpha*=n<0?0:n},CanvasRendererBase.prototype.ctxFillStyle=function(n){this.canvasContext.fillStyle=n},CanvasRendererBase.prototype.ctxStrokeStyle=function(n){this.canvasContext.strokeStyle=n},CanvasRendererBase.prototype.ctxLineWidth=function(n){this.canvasContext.lineWidth=n},CanvasRendererBase.prototype.ctxLineCap=function(n){this.canvasContext.lineCap=n},CanvasRendererBase.prototype.ctxLineJoin=function(n){this.canvasContext.lineJoin=n},CanvasRendererBase.prototype.ctxMiterLimit=function(n){this.canvasContext.miterLimit=n},CanvasRendererBase.prototype.ctxFill=function(n){this.canvasContext.fill(n)},CanvasRendererBase.prototype.ctxFillRect=function(n,e,i,a){this.canvasContext.fillRect(n,e,i,a)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}this.contextData.reset()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(n){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}n&&(this.globalData.blendMode="source-over"),this.contextData.restore(n)},CanvasRendererBase.prototype.configAnimation=function(n){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var e=this.animationItem.container.style;e.width="100%",e.height="100%";var i="0px 0px 0px";e.transformOrigin=i,e.mozTransformOrigin=i,e.webkitTransformOrigin=i,e["-webkit-transform"]=i,e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=n,this.layers=n.layers,this.transformCanvas={w:n.w,h:n.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(n,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(n.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(n,e){this.reset();var i,a;n?(i=n,a=e,this.canvasContext.canvas.width=i,this.canvasContext.canvas.height=a):(this.animationItem.wrapper&&this.animationItem.container?(i=this.animationItem.wrapper.offsetWidth,a=this.animationItem.wrapper.offsetHeight):(i=this.canvasContext.canvas.width,a=this.canvasContext.canvas.height),this.canvasContext.canvas.width=i*this.renderConfig.dpr,this.canvasContext.canvas.height=a*this.renderConfig.dpr);var s,r;if(this.renderConfig.preserveAspectRatio.indexOf("meet")!==-1||this.renderConfig.preserveAspectRatio.indexOf("slice")!==-1){var o=this.renderConfig.preserveAspectRatio.split(" "),l=o[1]||"meet",u=o[0]||"xMidYMid",c=u.substr(0,4),d=u.substr(4);s=i/a,r=this.transformCanvas.w/this.transformCanvas.h,r>s&&l==="meet"||r<s&&l==="slice"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=a/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=a/(this.transformCanvas.h/this.renderConfig.dpr)),c==="xMid"&&(r<s&&l==="meet"||r>s&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(a/this.transformCanvas.h))/2*this.renderConfig.dpr:c==="xMax"&&(r<s&&l==="meet"||r>s&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(a/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,d==="YMid"&&(r>s&&l==="meet"||r<s&&l==="slice")?this.transformCanvas.ty=(a-this.transformCanvas.h*(i/this.transformCanvas.w))/2*this.renderConfig.dpr:d==="YMax"&&(r>s&&l==="meet"||r<s&&l==="slice")?this.transformCanvas.ty=(a-this.transformCanvas.h*(i/this.transformCanvas.w))*this.renderConfig.dpr:this.transformCanvas.ty=0}else this.renderConfig.preserveAspectRatio==="none"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=a/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText="");var n,e=this.layers?this.layers.length:0;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(n,e){if(!(this.renderedFrame===n&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||n===-1)){this.renderedFrame=n,this.globalData.frameNum=n-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=n;var i,a=this.layers.length;for(this.completeLayers||this.checkLayers(n),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(n-this.layers[i].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){var i=this.createItem(this.layers[n],this,this.globalData);e[n]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var n,e=15;for(n=0;n<e;n+=1){var i=new CanvasContext;this.stack[n]=i}this._length=e,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}CVContextData.prototype.duplicate=function(){var n=this._length*2,e=0;for(e=this._length;e<n;e+=1)this.stack[e]=new CanvasContext;this._length=n},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(n){this.cArrPos-=1;var e=this.stack[this.cArrPos],i=e.transform,a,s=this.cTr.props;for(a=0;a<16;a+=1)s[a]=i[a];if(n){this.nativeContext.restore();var r=this.stack[this.cArrPos+1];this.appliedFillStyle=r.fillStyle,this.appliedStrokeStyle=r.strokeStyle,this.appliedLineWidth=r.lineWidth,this.appliedLineCap=r.lineCap,this.appliedLineJoin=r.lineJoin,this.appliedMiterLimit=r.miterLimit}this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13]),(n||e.opacity!==-1&&this.currentOpacity!==e.opacity)&&(this.nativeContext.globalAlpha=e.opacity,this.currentOpacity=e.opacity),this.currentFillStyle=e.fillStyle,this.currentStrokeStyle=e.strokeStyle,this.currentLineWidth=e.lineWidth,this.currentLineCap=e.lineCap,this.currentLineJoin=e.lineJoin,this.currentMiterLimit=e.miterLimit},CVContextData.prototype.save=function(n){n&&this.nativeContext.save();var e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var i=this.stack[this.cArrPos],a;for(a=0;a<16;a+=1)i.transform[a]=e[a];this.cArrPos+=1;var s=this.stack[this.cArrPos];s.opacity=i.opacity,s.fillStyle=i.fillStyle,s.strokeStyle=i.strokeStyle,s.lineWidth=i.lineWidth,s.lineCap=i.lineCap,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit},CVContextData.prototype.setOpacity=function(n){this.stack[this.cArrPos].opacity=n},CVContextData.prototype.setContext=function(n){this.nativeContext=n},CVContextData.prototype.fillStyle=function(n){this.stack[this.cArrPos].fillStyle!==n&&(this.currentFillStyle=n,this.stack[this.cArrPos].fillStyle=n)},CVContextData.prototype.strokeStyle=function(n){this.stack[this.cArrPos].strokeStyle!==n&&(this.currentStrokeStyle=n,this.stack[this.cArrPos].strokeStyle=n)},CVContextData.prototype.lineWidth=function(n){this.stack[this.cArrPos].lineWidth!==n&&(this.currentLineWidth=n,this.stack[this.cArrPos].lineWidth=n)},CVContextData.prototype.lineCap=function(n){this.stack[this.cArrPos].lineCap!==n&&(this.currentLineCap=n,this.stack[this.cArrPos].lineCap=n)},CVContextData.prototype.lineJoin=function(n){this.stack[this.cArrPos].lineJoin!==n&&(this.currentLineJoin=n,this.stack[this.cArrPos].lineJoin=n)},CVContextData.prototype.miterLimit=function(n){this.stack[this.cArrPos].miterLimit!==n&&(this.currentMiterLimit=n,this.stack[this.cArrPos].miterLimit=n)},CVContextData.prototype.transform=function(n){this.transformMat.cloneFromProps(n);var e=this.cTr;this.transformMat.multiply(e),e.cloneFromProps(this.transformMat.props);var i=e.props;this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13])},CVContextData.prototype.opacity=function(n){var e=this.stack[this.cArrPos].opacity;e*=n<0?0:n,this.stack[this.cArrPos].opacity!==e&&(this.currentOpacity!==n&&(this.nativeContext.globalAlpha=n,this.currentOpacity=n),this.stack[this.cArrPos].opacity=e)},CVContextData.prototype.fill=function(n){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(n)},CVContextData.prototype.fillRect=function(n,e,i,a){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(n,e,i,a)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()};function CVCompElement(n,e,i){this.completeLayers=!1,this.layers=n.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var n=this.canvasContext;n.beginPath(),n.moveTo(0,0),n.lineTo(this.data.w,0),n.lineTo(this.data.w,this.data.h),n.lineTo(0,this.data.h),n.lineTo(0,0),n.clip();var e,i=this.layers.length;for(e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var n,e=this.layers.length;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function CanvasRenderer(n,e){this.animationItem=n,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var i=this.finalTransform.mat.toCSS();e.transform=i,e.webkitTransform=i}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var n;this.data.hasMask?(n=createNS("rect"),n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(n=createTag("div"),n.style.width=this.data.sw+"px",n.style.height=this.data.sh+"px",n.style.backgroundColor=this.data.sc),this.layerElement.appendChild(n)};function HShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(n,e,i),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var n;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),n=this.svgElement;else{n=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;n.setAttribute("width",e.w),n.setAttribute("height",e.h),n.appendChild(this.shapesContainer),this.layerElement.appendChild(n)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=n},HShapeElement.prototype.getTransformedPoint=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)e=n[i].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(n,e){var i=n.sh.v,a=n.transformers,s,r=i._length,o,l,u,c;if(!(r<=1)){for(s=0;s<r-1;s+=1)o=this.getTransformedPoint(a,i.v[s]),l=this.getTransformedPoint(a,i.o[s]),u=this.getTransformedPoint(a,i.i[s+1]),c=this.getTransformedPoint(a,i.v[s+1]),this.checkBounds(o,l,u,c,e);i.c&&(o=this.getTransformedPoint(a,i.v[s]),l=this.getTransformedPoint(a,i.o[s]),u=this.getTransformedPoint(a,i.i[0]),c=this.getTransformedPoint(a,i.v[0]),this.checkBounds(o,l,u,c,e))}},HShapeElement.prototype.checkBounds=function(n,e,i,a,s){this.getBoundsOfCurve(n,e,i,a);var r=this.shapeBoundingBox;s.x=bmMin(r.left,s.x),s.xMax=bmMax(r.right,s.xMax),s.y=bmMin(r.top,s.y),s.yMax=bmMax(r.bottom,s.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(n,e,i,a){for(var s=[[n[0],a[0]],[n[1],a[1]]],r,o,l,u,c,d,p,f=0;f<2;++f)o=6*n[f]-12*e[f]+6*i[f],r=-3*n[f]+9*e[f]-9*i[f]+3*a[f],l=3*e[f]-3*n[f],o|=0,r|=0,l|=0,r===0&&o===0||(r===0?(u=-l/o,u>0&&u<1&&s[f].push(this.calculateF(u,n,e,i,a,f))):(c=o*o-4*l*r,c>=0&&(d=(-o+bmSqrt(c))/(2*r),d>0&&d<1&&s[f].push(this.calculateF(d,n,e,i,a,f)),p=(-o-bmSqrt(c))/(2*r),p>0&&p<1&&s[f].push(this.calculateF(p,n,e,i,a,f)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(n,e,i,a,s,r){return bmPow(1-n,3)*e[r]+3*bmPow(1-n,2)*n*i[r]+3*(1-n)*bmPow(n,2)*a[r]+bmPow(n,3)*s[r]},HShapeElement.prototype.calculateBoundingBox=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)n[i]&&n[i].sh?this.calculateShapeBoundingBox(n[i],e):n[i]&&n[i].it?this.calculateBoundingBox(n[i].it,e):n[i]&&n[i].style&&n[i].w&&this.expandStrokeBoundingBox(n[i].w,e)},HShapeElement.prototype.expandStrokeBoundingBox=function(n,e){var i=0;if(n.keyframes){for(var a=0;a<n.keyframes.length;a+=1){var s=n.keyframes[a].s;s>i&&(i=s)}i*=n.mult}else i=n.v*n.mult;e.x-=i,e.xMax+=i,e.y-=i,e.yMax+=i},HShapeElement.prototype.currentBoxContains=function(n){return this.currentBBox.x<=n.x&&this.currentBBox.y<=n.y&&this.currentBBox.width+this.currentBBox.x>=n.x+n.width&&this.currentBBox.height+this.currentBBox.y>=n.y+n.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var n=this.tempBoundingBox,e=999999;if(n.x=e,n.xMax=-e,n.y=e,n.yMax=-e,this.calculateBoundingBox(this.itemsData,n),n.width=n.xMax<n.x?0:n.xMax-n.x,n.height=n.yMax<n.y?0:n.yMax-n.y,this.currentBoxContains(n))return;var i=!1;if(this.currentBBox.w!==n.width&&(this.currentBBox.w=n.width,this.shapeCont.setAttribute("width",n.width),i=!0),this.currentBBox.h!==n.height&&(this.currentBBox.h=n.height,this.shapeCont.setAttribute("height",n.height),i=!0),i||this.currentBBox.x!==n.x||this.currentBBox.y!==n.y){this.currentBBox.w=n.width,this.currentBBox.h=n.height,this.currentBBox.x=n.x,this.currentBBox.y=n.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var a=this.shapeCont.style,s="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";a.transform=s,a.webkitTransform=s}}};function HTextElement(n,e,i){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var n=createNS("g");this.maskedElement.appendChild(n),this.innerElem=n}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=this.innerElem.style,i=n.fc?this.buildColor(n.fc):"rgba(0,0,0,0)";e.fill=i,e.color=i,n.sc&&(e.stroke=this.buildColor(n.sc),e.strokeWidth=n.sw+"px");var a=this.globalData.fontManager.getFontByName(n.f);if(!this.globalData.fontManager.chars)if(e.fontSize=n.finalSize+"px",e.lineHeight=n.finalSize+"px",a.fClass)this.innerElem.className=a.fClass;else{e.fontFamily=a.fFamily;var s=n.fWeight,r=n.fStyle;e.fontStyle=r,e.fontWeight=s}var o,l,u=n.l;l=u.length;var c,d,p,f=this.mHelper,m,P="",T=0;for(o=0;o<l;o+=1){if(this.globalData.fontManager.chars?(this.textPaths[T]?c=this.textPaths[T]:(c=createNS("path"),c.setAttribute("stroke-linecap",lineCapEnum[1]),c.setAttribute("stroke-linejoin",lineJoinEnum[2]),c.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[T]?(d=this.textSpans[T],p=d.children[0]):(d=createTag("div"),d.style.lineHeight=0,p=createNS("svg"),p.appendChild(c),styleDiv(d)))):this.isMasked?c=this.textPaths[T]?this.textPaths[T]:createNS("text"):this.textSpans[T]?(d=this.textSpans[T],c=this.textPaths[T]):(d=createTag("span"),styleDiv(d),c=createTag("span"),styleDiv(c),d.appendChild(c)),this.globalData.fontManager.chars){var x=this.globalData.fontManager.getCharData(n.finalText[o],a.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),y;if(x?y=x.data:y=null,f.reset(),y&&y.shapes&&y.shapes.length&&(m=y.shapes[0].it,f.scale(n.finalSize/100,n.finalSize/100),P=this.createPathShape(f,m),c.setAttribute("d",P)),this.isMasked)this.innerElem.appendChild(c);else{if(this.innerElem.appendChild(d),y&&y.shapes){document.body.appendChild(p);var S=p.getBBox();p.setAttribute("width",S.width+2),p.setAttribute("height",S.height+2),p.setAttribute("viewBox",S.x-1+" "+(S.y-1)+" "+(S.width+2)+" "+(S.height+2));var g=p.style,C="translate("+(S.x-1)+"px,"+(S.y-1)+"px)";g.transform=C,g.webkitTransform=C,u[o].yOffset=S.y-1}else p.setAttribute("width",1),p.setAttribute("height",1);d.appendChild(p)}}else if(c.textContent=u[o].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(c);else{this.innerElem.appendChild(d);var E=c.style,B="translate3d(0,"+-n.finalSize/1.2+"px,0)";E.transform=B,E.webkitTransform=B}this.isMasked?this.textSpans[T]=c:this.textSpans[T]=d,this.textSpans[T].style.display="block",this.textPaths[T]=c,T+=1}for(;T<this.textSpans.length;)this.textSpans[T].style.display="none",T+=1},HTextElement.prototype.renderInnerContent=function(){this.validateText();var n;if(this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),n=this.svgElement.style;var e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";n.transform=e,n.webkitTransform=e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),!(!this.lettersChangedFlag&&!this.textAnimator.lettersChangedFlag)){var i,a,s=0,r=this.textAnimator.renderedLetters,o=this.textProperty.currentData.l;a=o.length;var l,u,c;for(i=0;i<a;i+=1)o[i].n?s+=1:(u=this.textSpans[i],c=this.textPaths[i],l=r[s],s+=1,l._mdf.m&&(this.isMasked?u.setAttribute("transform",l.m):(u.style.webkitTransform=l.m,u.style.transform=l.m)),u.style.opacity=l.o,l.sw&&l._mdf.sw&&c.setAttribute("stroke-width",l.sw),l.sc&&l._mdf.sc&&c.setAttribute("stroke",l.sc),l.fc&&l._mdf.fc&&(c.setAttribute("fill",l.fc),c.style.color=l.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var d=this.innerElem.getBBox();this.currentBBox.w!==d.width&&(this.currentBBox.w=d.width,this.svgElement.setAttribute("width",d.width)),this.currentBBox.h!==d.height&&(this.currentBBox.h=d.height,this.svgElement.setAttribute("height",d.height));var p=1;if(this.currentBBox.w!==d.width+p*2||this.currentBBox.h!==d.height+p*2||this.currentBBox.x!==d.x-p||this.currentBBox.y!==d.y-p){this.currentBBox.w=d.width+p*2,this.currentBBox.h=d.height+p*2,this.currentBBox.x=d.x-p,this.currentBBox.y=d.y-p,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),n=this.svgElement.style;var f="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";n.transform=f,n.webkitTransform=f}}}};function HCameraElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initHierarchy();var a=PropertyFactory.getProp;if(this.pe=a(this,n.pe,0,0,this),n.ks.p.s?(this.px=a(this,n.ks.p.x,1,0,this),this.py=a(this,n.ks.p.y,1,0,this),this.pz=a(this,n.ks.p.z,1,0,this)):this.p=a(this,n.ks.p,1,0,this),n.ks.a&&(this.a=a(this,n.ks.a,1,0,this)),n.ks.or.k.length&&n.ks.or.k[0].to){var s,r=n.ks.or.k.length;for(s=0;s<r;s+=1)n.ks.or.k[s].to=null,n.ks.or.k[s].ti=null}this.or=a(this,n.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=a(this,n.ks.rx,0,degToRads,this),this.ry=a(this,n.ks.ry,0,degToRads,this),this.rz=a(this,n.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var n,e=this.comp.threeDElements.length,i,a,s;for(n=0;n<e;n+=1)if(i=this.comp.threeDElements[n],i.type==="3d"){a=i.perspectiveElem.style,s=i.container.style;var r=this.pe.v+"px",o="0px 0px 0px",l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";a.perspective=r,a.webkitPerspective=r,s.transformOrigin=o,s.mozTransformOrigin=o,s.webkitTransformOrigin=o,a.transform=l,a.webkitTransform=l}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var n=this._isFirstFrame,e,i;if(this.hierarchy)for(i=this.hierarchy.length,e=0;e<i;e+=1)n=this.hierarchy[e].finalTransform.mProp._mdf||n;if(n||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(i=this.hierarchy.length-1,e=i;e>=0;e-=1){var a=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-a.p.v[0],-a.p.v[1],a.p.v[2]),this.mat.rotateX(-a.or.v[0]).rotateY(-a.or.v[1]).rotateZ(a.or.v[2]),this.mat.rotateX(-a.rx.v).rotateY(-a.ry.v).rotateZ(a.rz.v),this.mat.scale(1/a.s.v[0],1/a.s.v[1],1/a.s.v[2]),this.mat.translate(a.a.v[0],a.a.v[1],a.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var r=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),o=[s[0]/r,s[1]/r,s[2]/r],l=Math.sqrt(o[2]*o[2]+o[0]*o[0]),u=Math.atan2(o[1],l),c=Math.atan2(o[0],-o[2]);this.mat.rotateY(c).rotateX(-u)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var d=!this._prevMat.equals(this.mat);if((d||this.pe._mdf)&&this.comp.threeDElements){i=this.comp.threeDElements.length;var p,f,m;for(e=0;e<i;e+=1)if(p=this.comp.threeDElements[e],p.type==="3d"){if(d){var P=this.mat.toCSS();m=p.container.style,m.transform=P,m.webkitTransform=P}this.pe._mdf&&(f=p.perspectiveElem.style,f.perspective=this.pe.v+"px",f.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null};function HImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.crossOrigin="anonymous",e.src=n,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)};function HybridRendererBase(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},HybridRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){var a=this.layers[e];if(!a.ddd||!this.supports3d)if(this.threeDElements)this.addTo3dContainer(i,e);else{for(var s=0,r,o,l;s<e;)this.elements[s]&&this.elements[s]!==!0&&this.elements[s].getBaseElement&&(o=this.elements[s],l=this.layers[s].ddd?this.getThreeDContainerByPos(s):o.getBaseElement(),r=l||r),s+=1;r?(!a.ddd||!this.supports3d)&&this.layerElement.insertBefore(i,r):(!a.ddd||!this.supports3d)&&this.layerElement.appendChild(i)}else this.addTo3dContainer(i,e)}},HybridRendererBase.prototype.createShape=function(n){return this.supports3d?new HShapeElement(n,this.globalData,this):new SVGShapeElement(n,this.globalData,this)},HybridRendererBase.prototype.createText=function(n){return this.supports3d?new HTextElement(n,this.globalData,this):new SVGTextLottieElement(n,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(n){return this.camera=new HCameraElement(n,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(n){return this.supports3d?new HImageElement(n,this.globalData,this):new IImageElement(n,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(n){return this.supports3d?new HSolidElement(n,this.globalData,this):new ISolidElement(n,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(n){for(var e=0,i=this.threeDElements.length;e<i;){if(this.threeDElements[e].startPos<=n&&this.threeDElements[e].endPos>=n)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(n,e){var i=createTag("div"),a,s;styleDiv(i);var r=createTag("div");if(styleDiv(r),e==="3d"){a=i.style,a.width=this.globalData.compSize.w+"px",a.height=this.globalData.compSize.h+"px";var o="50% 50%";a.webkitTransformOrigin=o,a.mozTransformOrigin=o,a.transformOrigin=o,s=r.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}i.appendChild(r);var u={container:r,perspectiveElem:i,startPos:n,endPos:n,type:e};return this.threeDElements.push(u),u},HybridRendererBase.prototype.build3dContainers=function(){var n,e=this.layers.length,i,a="";for(n=0;n<e;n+=1)this.layers[n].ddd&&this.layers[n].ty!==3?(a!=="3d"&&(a="3d",i=this.createThreeDContainer(n,"3d")),i.endPos=Math.max(i.endPos,n)):(a!=="2d"&&(a="2d",i=this.createThreeDContainer(n,"2d")),i.endPos=Math.max(i.endPos,n));for(e=this.threeDElements.length,n=e-1;n>=0;n-=1)this.resizerElem.appendChild(this.threeDElements[n].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(n,e){for(var i=0,a=this.threeDElements.length;i<a;){if(e<=this.threeDElements[i].endPos){for(var s=this.threeDElements[i].startPos,r;s<e;)this.elements[s]&&this.elements[s].getBaseElement&&(r=this.elements[s].getBaseElement()),s+=1;r?this.threeDElements[i].container.insertBefore(n,r):this.threeDElements[i].container.appendChild(n);break}i+=1}},HybridRendererBase.prototype.configAnimation=function(n){var e=createTag("div"),i=this.animationItem.wrapper,a=e.style;a.width=n.w+"px",a.height=n.h+"px",this.resizerElem=e,styleDiv(e),a.transformStyle="flat",a.mozTransformStyle="flat",a.webkitTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),i.appendChild(e),a.overflow="hidden";var s=createNS("svg");s.setAttribute("width","1"),s.setAttribute("height","1"),styleDiv(s),this.resizerElem.appendChild(s);var r=createNS("defs");s.appendChild(r),this.data=n,this.setupGlobalData(n,s),this.globalData.defs=r,this.layers=n.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var n=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight,i=n/e,a=this.globalData.compSize.w/this.globalData.compSize.h,s,r,o,l;a>i?(s=n/this.globalData.compSize.w,r=n/this.globalData.compSize.w,o=0,l=(e-this.globalData.compSize.h*(n/this.globalData.compSize.w))/2):(s=e/this.globalData.compSize.h,r=e/this.globalData.compSize.h,o=(n-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var u=this.resizerElem.style;u.webkitTransform="matrix3d("+s+",0,0,0,0,"+r+",0,0,0,0,1,0,"+o+","+l+",0,1)",u.transform=u.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var n=this.globalData.compSize.w,e=this.globalData.compSize.h,i,a=this.threeDElements.length;for(i=0;i<a;i+=1){var s=this.threeDElements[i].perspectiveElem.style;s.webkitPerspective=Math.sqrt(Math.pow(n,2)+Math.pow(e,2))+"px",s.perspective=s.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(n){var e,i=n.length,a=createTag("div");for(e=0;e<i;e+=1)if(n[e].xt){var s=this.createComp(n[e],a,this.globalData.comp,null);s.initExpressions(),this.globalData.projectInterface.registerComposition(s)}};function HCompElement(n,e,i){this.layers=n.layers,this.supports3d=!n.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(n,e){for(var i=0,a;i<e;)this.elements[i]&&this.elements[i].getBaseElement&&(a=this.elements[i].getBaseElement()),i+=1;a?this.layerElement.insertBefore(n,a):this.layerElement.appendChild(n)},HCompElement.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};function HybridRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"},runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};var CompExpressionInterface=function(){return function(n){function e(i){for(var a=0,s=n.layers.length;a<s;){if(n.layers[a].nm===i||n.layers[a].ind===i)return n.elements[a].layerInterface;a+=1}return null}return Object.defineProperty(e,"_name",{value:n.data.nm}),e.layer=e,e.pixelAspect=1,e.height=n.data.h||n.globalData.compSize.h,e.width=n.data.w||n.globalData.compSize.w,e.pixelAspect=1,e.frameDuration=1/n.globalData.frameRate,e.displayStartTime=0,e.numLayers=n.layers.length,e}}();function _typeof$2(n){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(n)}function seedRandom(n,e){var i=this,a=256,s=6,r=52,o="random",l=e.pow(a,s),u=e.pow(2,r),c=u*2,d=a-1,p;function f(g,C,E){var B=[];C=C===!0?{entropy:!0}:C||{};var _=x(T(C.entropy?[g,S(n)]:g===null?y():g,3),B),M=new m(B),D=function(){for(var F=M.g(s),N=l,H=0;F<u;)F=(F+H)*a,N*=a,H=M.g(1);for(;F>=c;)F/=2,N/=2,H>>>=1;return(F+H)/N};return D.int32=function(){return M.g(4)|0},D.quick=function(){return M.g(4)/4294967296},D.double=D,x(S(M.S),n),(C.pass||E||function(L,F,N,H){return H&&(H.S&&P(H,M),L.state=function(){return P(M,{})}),N?(e[o]=L,F):L})(D,_,"global"in C?C.global:this==e,C.state)}e["seed"+o]=f;function m(g){var C,E=g.length,B=this,_=0,M=B.i=B.j=0,D=B.S=[];for(E||(g=[E++]);_<a;)D[_]=_++;for(_=0;_<a;_++)D[_]=D[M=d&M+g[_%E]+(C=D[_])],D[M]=C;B.g=function(L){for(var F,N=0,H=B.i,$=B.j,O=B.S;L--;)F=O[H=d&H+1],N=N*a+O[d&(O[H]=O[$=d&$+F])+(O[$]=F)];return B.i=H,B.j=$,N}}function P(g,C){return C.i=g.i,C.j=g.j,C.S=g.S.slice(),C}function T(g,C){var E=[],B=_typeof$2(g),_;if(C&&B=="object")for(_ in g)try{E.push(T(g[_],C-1))}catch{}return E.length?E:B=="string"?g:g+"\0"}function x(g,C){for(var E=g+"",B,_=0;_<E.length;)C[d&_]=d&(B^=C[d&_]*19)+E.charCodeAt(_++);return S(C)}function y(){try{var g=new Uint8Array(a);return(i.crypto||i.msCrypto).getRandomValues(g),S(g)}catch{var C=i.navigator,E=C&&C.plugins;return[+new Date,i,E,i.screen,S(n)]}}function S(g){return String.fromCharCode.apply(0,g)}x(e.random(),n)}function initialize$2(n){seedRandom([],n)}var propTypes={SHAPE:"shape"};function _typeof$1(n){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(n)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};initialize$2(BMMath);function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(n){return n.constructor===Array||n.constructor===Float32Array}function isNumerable(n,e){return n==="number"||e instanceof Number||n==="boolean"||n==="string"}function $bm_neg(n){var e=_typeof$1(n);if(e==="number"||n instanceof Number||e==="boolean")return-n;if($bm_isInstanceOfArray(n)){var i,a=n.length,s=[];for(i=0;i<a;i+=1)s[i]=-n[i];return s}return n.propType?n.v:-n}var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(n,e){var i=_typeof$1(n),a=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(a,e)||i==="string"||a==="string")return n+e;if($bm_isInstanceOfArray(n)&&isNumerable(a,e))return n=n.slice(0),n[0]+=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n+e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var s=0,r=n.length,o=e.length,l=[];s<r||s<o;)(typeof n[s]=="number"||n[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?l[s]=n[s]+e[s]:l[s]=e[s]===void 0?n[s]:n[s]||e[s],s+=1;return l}return 0}var add=sum;function sub(n,e){var i=_typeof$1(n),a=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(a,e))return i==="string"&&(n=parseInt(n,10)),a==="string"&&(e=parseInt(e,10)),n-e;if($bm_isInstanceOfArray(n)&&isNumerable(a,e))return n=n.slice(0),n[0]-=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n-e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var s=0,r=n.length,o=e.length,l=[];s<r||s<o;)(typeof n[s]=="number"||n[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?l[s]=n[s]-e[s]:l[s]=e[s]===void 0?n[s]:n[s]||e[s],s+=1;return l}return 0}function mul(n,e){var i=_typeof$1(n),a=_typeof$1(e),s;if(isNumerable(i,n)&&isNumerable(a,e))return n*e;var r,o;if($bm_isInstanceOfArray(n)&&isNumerable(a,e)){for(o=n.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n[r]*e;return s}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n*e[r];return s}return 0}function div(n,e){var i=_typeof$1(n),a=_typeof$1(e),s;if(isNumerable(i,n)&&isNumerable(a,e))return n/e;var r,o;if($bm_isInstanceOfArray(n)&&isNumerable(a,e)){for(o=n.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n[r]/e;return s}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n/e[r];return s}return 0}function mod(n,e){return typeof n=="string"&&(n=parseInt(n,10)),typeof e=="string"&&(e=parseInt(e,10)),n%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(n,e,i){if(e>i){var a=i;i=e,e=a}return Math.min(Math.max(n,e),i)}function radiansToDegrees(n){return n/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(n){return n*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(n,e){if(typeof n=="number"||n instanceof Number)return e=e||0,Math.abs(n-e);e||(e=helperLengthArray);var i,a=Math.min(n.length,e.length),s=0;for(i=0;i<a;i+=1)s+=Math.pow(e[i]-n[i],2);return Math.sqrt(s)}function normalize(n){return div(n,length(n))}function rgbToHsl(n){var e=n[0],i=n[1],a=n[2],s=Math.max(e,i,a),r=Math.min(e,i,a),o,l,u=(s+r)/2;if(s===r)o=0,l=0;else{var c=s-r;switch(l=u>.5?c/(2-s-r):c/(s+r),s){case e:o=(i-a)/c+(i<a?6:0);break;case i:o=(a-e)/c+2;break;case a:o=(e-i)/c+4;break}o/=6}return[o,l,u,n[3]]}function hue2rgb(n,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(e-n)*6*i:i<1/2?e:i<2/3?n+(e-n)*(2/3-i)*6:n}function hslToRgb(n){var e=n[0],i=n[1],a=n[2],s,r,o;if(i===0)s=a,o=a,r=a;else{var l=a<.5?a*(1+i):a+i-a*i,u=2*a-l;s=hue2rgb(u,l,e+1/3),r=hue2rgb(u,l,e),o=hue2rgb(u,l,e-1/3)}return[s,r,o,n[3]]}function linear(n,e,i,a,s){if((a===void 0||s===void 0)&&(a=e,s=i,e=0,i=1),i<e){var r=i;i=e,e=r}if(n<=e)return a;if(n>=i)return s;var o=i===e?0:(n-e)/(i-e);if(!a.length)return a+(s-a)*o;var l,u=a.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=a[l]+(s[l]-a[l])*o;return c}function random(n,e){if(e===void 0&&(n===void 0?(n=0,e=1):(e=n,n=void 0)),e.length){var i,a=e.length;n||(n=createTypedArray("float32",a));var s=createTypedArray("float32",a),r=BMMath.random();for(i=0;i<a;i+=1)s[i]=n[i]+r*(e[i]-n[i]);return s}n===void 0&&(n=0);var o=BMMath.random();return n+o*(e-n)}function createPath(n,e,i,a){var s,r=n.length,o=shapePool.newElement();o.setPathData(!!a,r);var l=[0,0],u,c;for(s=0;s<r;s+=1)u=e&&e[s]?e[s]:l,c=i&&i[s]?i[s]:l,o.setTripleAt(n[s][0],n[s][1],c[0]+n[s][0],c[1]+n[s][1],u[0]+n[s][0],u[1]+n[s][1],s,!0);return o}function initiateExpression(elem,data,property){function noOp(n){return n}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=val.indexOf("random")!==-1,elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty._name=elem.data.nm,thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||this.data.hd!==!0,wiggle=(function n(e,i){var a,s,r=this.pv.length?this.pv.length:1,o=createTypedArray("float32",r);e=5;var l=Math.floor(time*e);for(a=0,s=0;a<l;){for(s=0;s<r;s+=1)o[s]+=-i+i*2*BMMath.random();a+=1}var u=time*e,c=u-Math.floor(u),d=createTypedArray("float32",r);if(r>1){for(s=0;s<r;s+=1)d[s]=this.pv[s]+o[s]+(-i+i*2*BMMath.random())*c;return d}return this.pv+o[0]+(-i+i*2*BMMath.random())*c}).bind(this);thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty));function loopInDuration(n,e){return loopIn(n,e,!0)}function loopOutDuration(n,e){return loopOut(n,e,!0)}this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);function lookAt(n,e){var i=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],a=Math.atan2(i[0],Math.sqrt(i[1]*i[1]+i[2]*i[2]))/degToRads,s=-Math.atan2(i[1],i[2])/degToRads;return[s,a,0]}function easeOut(n,e,i,a,s){return applyEase(easeOutBez,n,e,i,a,s)}function easeIn(n,e,i,a,s){return applyEase(easeInBez,n,e,i,a,s)}function ease(n,e,i,a,s){return applyEase(easeInOutBez,n,e,i,a,s)}function applyEase(n,e,i,a,s,r){s===void 0?(s=i,r=a):e=(e-i)/(a-i),e>1?e=1:e<0&&(e=0);var o=n(e);if($bm_isInstanceOfArray(s)){var l,u=s.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=(r[l]-s[l])*o+s[l];return c}return(r-s)*o+s}function nearestKey(n){var e,i=data.k.length,a,s;if(!data.k.length||typeof data.k[0]=="number")a=0,s=0;else if(a=-1,n*=elem.comp.globalData.frameRate,n<data.k[0].t)a=1,s=data.k[0].t;else{for(e=0;e<i-1;e+=1)if(n===data.k[e].t){a=e+1,s=data.k[e].t;break}else if(n>data.k[e].t&&n<data.k[e+1].t){n-data.k[e].t>data.k[e+1].t-n?(a=e+2,s=data.k[e+1].t):(a=e+1,s=data.k[e].t);break}a===-1&&(a=e+1,s=data.k[e].t)}var r={};return r.index=a,r.time=s/elem.comp.globalData.frameRate,r}function key(n){var e,i,a;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+n);n-=1,e={time:data.k[n].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[n],"s")?data.k[n].s:data.k[n-1].e;for(a=s.length,i=0;i<a;i+=1)e[i]=s[i],e.value[i]=s[i];return e}function framesToTime(n,e){return e||(e=elem.comp.globalData.frameRate),n/e}function timeToFrames(n,e){return!n&&n!==0&&(n=time),e||(e=elem.comp.globalData.frameRate),n*e}function seedRandom(n){BMMath.seedrandom(randSeed+n)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(n,e){return typeof value=="string"?e===void 0?value.substring(n):value.substring(n,e):""}function substr(n,e){return typeof value=="string"?e===void 0?value.substr(n):value.substr(n,e):""}function posterizeTime(n){time=n===0?0:Math.floor(time*n)/n,value=valueAtTime(time)}var time,velocity,value,text,textIndex,textTotal,selectorValue,index=elem.data.ind,hasParent=!!(elem.hierarchy&&elem.hierarchy.length),parent,randSeed=Math.floor(Math.random()*1e6),globalData=elem.globalData;function executeExpression(n){return value=n,this.frameExpressionId===elem.globalData.frameId&&this.propType!=="textSelector"?value:(this.propType==="textSelector"&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),elemType===4&&!content&&(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),hasParent=!!(elem.hierarchy&&elem.hierarchy.length),hasParent&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt,scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob}(),Expressions=function(){var n={};n.initExpressions=e,n.resetFrame=ExpressionManager.resetFrame;function e(i){var a=0,s=[];function r(){a+=1}function o(){a-=1,a===0&&u()}function l(c){s.indexOf(c)===-1&&s.push(c)}function u(){var c,d=s.length;for(c=0;c<d;c+=1)s[c].release();s.length=0}i.renderer.compInterface=CompExpressionInterface(i.renderer),i.renderer.globalData.projectInterface.registerComposition(i.renderer),i.renderer.globalData.pushExpression=r,i.renderer.globalData.popExpression=o,i.renderer.globalData.registerExpressionProperty=l}return n}(),MaskManagerInterface=function(){function n(i,a){this._mask=i,this._data=a}Object.defineProperty(n.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(n.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),this._mask.op.v*100}});var e=function(a){var s=createSizedArray(a.viewData.length),r,o=a.viewData.length;for(r=0;r<o;r+=1)s[r]=new n(a.viewData[r],a.masksProperties[r]);var l=function(c){for(r=0;r<o;){if(a.masksProperties[r].nm===c)return s[r];r+=1}return null};return l};return e}(),ExpressionPropertyInterface=function(){var n={pv:0,v:0,mult:1},e={pv:[0,0,0],v:[0,0,0],mult:1};function i(o,l,u){Object.defineProperty(o,"velocity",{get:function(){return l.getVelocityAtTime(l.comp.currentFrame)}}),o.numKeys=l.keyframes?l.keyframes.length:0,o.key=function(c){if(!o.numKeys)return 0;var d="";"s"in l.keyframes[c-1]?d=l.keyframes[c-1].s:"e"in l.keyframes[c-2]?d=l.keyframes[c-2].e:d=l.keyframes[c-2].s;var p=u==="unidimensional"?new Number(d):Object.assign({},d);return p.time=l.keyframes[c-1].t/l.elem.comp.globalData.frameRate,p.value=u==="unidimensional"?d[0]:d,p},o.valueAtTime=l.getValueAtTime,o.speedAtTime=l.getSpeedAtTime,o.velocityAtTime=l.getVelocityAtTime,o.propertyGroup=l.propertyGroup}function a(o){(!o||!("pv"in o))&&(o=n);var l=1/o.mult,u=o.pv*l,c=new Number(u);return c.value=u,i(c,o,"unidimensional"),function(){return o.k&&o.getValue(),u=o.v*l,c.value!==u&&(c=new Number(u),c.value=u,c[0]=u,i(c,o,"unidimensional")),c}}function s(o){(!o||!("pv"in o))&&(o=e);var l=1/o.mult,u=o.data&&o.data.l||o.pv.length,c=createTypedArray("float32",u),d=createTypedArray("float32",u);return c.value=d,i(c,o,"multidimensional"),function(){o.k&&o.getValue();for(var p=0;p<u;p+=1)d[p]=o.v[p]*l,c[p]=d[p];return c}}function r(){return n}return function(o){return o?o.propType==="unidimensional"?a(o):s(o):r}}(),TransformExpressionInterface=function(){return function(n){function e(o){switch(o){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity;default:return null}}Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(n.r||n.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(n.rz||n.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(n.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(n.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(n.s)});var i,a,s,r;return n.p?r=ExpressionPropertyInterface(n.p):(i=ExpressionPropertyInterface(n.px),a=ExpressionPropertyInterface(n.py),n.pz&&(s=ExpressionPropertyInterface(n.pz))),Object.defineProperty(e,"position",{get:function(){return n.p?r():[i(),a(),s?s():0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(n.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(n.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(n.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(n.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(n.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(n.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(n.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(n.or)}),e}}(),LayerExpressionInterface=function(){function n(c){var d=new Matrix;if(c!==void 0){var p=this._elem.finalTransform.mProp.getValueAtTime(c);p.clone(d)}else{var f=this._elem.finalTransform.mProp;f.applyToMatrix(d)}return d}function e(c,d){var p=this.getMatrix(d);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.applyPoint(p,c)}function i(c,d){var p=this.getMatrix(d);return this.applyPoint(p,c)}function a(c,d){var p=this.getMatrix(d);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.invertPoint(p,c)}function s(c,d){var p=this.getMatrix(d);return this.invertPoint(p,c)}function r(c,d){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.applyToPointArray(d[0],d[1],d[2]||0)}function o(c,d){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.inversePoint(d)}function l(c){var d=new Matrix;if(d.reset(),this._elem.finalTransform.mProp.applyToMatrix(d),this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(d);return d.inversePoint(c)}return d.inversePoint(c)}function u(){return[1,1,1,1]}return function(c){var d;function p(T){m.mask=new MaskManagerInterface(T,c)}function f(T){m.effect=T}function m(T){switch(T){case"ADBE Root Vectors Group":case"Contents":case 2:return m.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return d;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return m.effect;case"ADBE Text Properties":return m.textInterface;default:return null}}m.getMatrix=n,m.invertPoint=o,m.applyPoint=r,m.toWorld=i,m.toWorldVec=e,m.fromWorld=s,m.fromWorldVec=a,m.toComp=i,m.fromComp=l,m.sampleImage=u,m.sourceRectAtTime=c.sourceRectAtTime.bind(c),m._elem=c,d=TransformExpressionInterface(c.finalTransform.mProp);var P=getDescriptor(d,"anchorPoint");return Object.defineProperties(m,{hasParent:{get:function(){return c.hierarchy.length}},parent:{get:function(){return c.hierarchy[0].layerInterface}},rotation:getDescriptor(d,"rotation"),scale:getDescriptor(d,"scale"),position:getDescriptor(d,"position"),opacity:getDescriptor(d,"opacity"),anchorPoint:P,anchor_point:P,transform:{get:function(){return d}},active:{get:function(){return c.isInRange}}}),m.startTime=c.data.st,m.index=c.data.ind,m.source=c.data.refId,m.height=c.data.ty===0?c.data.h:100,m.width=c.data.ty===0?c.data.w:100,m.inPoint=c.data.ip/c.comp.globalData.frameRate,m.outPoint=c.data.op/c.comp.globalData.frameRate,m._name=c.data.nm,m.registerMaskInterface=p,m.registerEffectsInterface=f,m}}(),propertyGroupFactory=function(){return function(n,e){return function(i){return i=i===void 0?1:i,i<=0?n:e(i-1)}}}(),PropertyInterface=function(){return function(n,e){var i={_name:n};function a(s){return s=s===void 0?1:s,s<=0?i:e(s-1)}return a}}(),EffectsExpressionInterface=function(){var n={createEffectsInterface:e};function e(s,r){if(s.effectsManager){var o=[],l=s.data.ef,u,c=s.effectsManager.effectElements.length;for(u=0;u<c;u+=1)o.push(i(l[u],s.effectsManager.effectElements[u],r,s));var d=s.data.ef||[],p=function(m){for(u=0,c=d.length;u<c;){if(m===d[u].nm||m===d[u].mn||m===d[u].ix)return o[u];u+=1}return null};return Object.defineProperty(p,"numProperties",{get:function(){return d.length}}),p}return null}function i(s,r,o,l){function u(m){for(var P=s.ef,T=0,x=P.length;T<x;){if(m===P[T].nm||m===P[T].mn||m===P[T].ix)return P[T].ty===5?d[T]:d[T]();T+=1}throw new Error}var c=propertyGroupFactory(u,o),d=[],p,f=s.ef.length;for(p=0;p<f;p+=1)s.ef[p].ty===5?d.push(i(s.ef[p],r.effectElements[p],r.effectElements[p].propertyGroup,l)):d.push(a(r.effectElements[p],s.ef[p].ty,l,c));return s.mn==="ADBE Color Control"&&Object.defineProperty(u,"color",{get:function(){return d[0]()}}),Object.defineProperties(u,{numProperties:{get:function(){return s.np}},_name:{value:s.nm},propertyGroup:{value:c}}),u.enabled=s.en!==0,u.active=u.enabled,u}function a(s,r,o,l){var u=ExpressionPropertyInterface(s.p);function c(){return r===10?o.comp.compInterface(s.p.v):u()}return s.p.setGroupProperty&&s.p.setGroupProperty(PropertyInterface("",l)),c}return n}(),ShapePathInterface=function(){return function(e,i,a){var s=i.sh;function r(l){return l==="Shape"||l==="shape"||l==="Path"||l==="path"||l==="ADBE Vector Shape"||l===2?r.path:null}var o=propertyGroupFactory(r,a);return s.setGroupProperty(PropertyInterface("Path",o)),Object.defineProperties(r,{path:{get:function(){return s.k&&s.getValue(),s}},shape:{get:function(){return s.k&&s.getValue(),s}},_name:{value:e.nm},ix:{value:e.ix},propertyIndex:{value:e.ix},mn:{value:e.mn},propertyGroup:{value:a}}),r}}(),ShapeExpressionInterface=function(){function n(P,T,x){var y=[],S,g=P?P.length:0;for(S=0;S<g;S+=1)P[S].ty==="gr"?y.push(i(P[S],T[S],x)):P[S].ty==="fl"?y.push(a(P[S],T[S],x)):P[S].ty==="st"?y.push(o(P[S],T[S],x)):P[S].ty==="tm"?y.push(l(P[S],T[S],x)):P[S].ty==="tr"||(P[S].ty==="el"?y.push(c(P[S],T[S],x)):P[S].ty==="sr"?y.push(d(P[S],T[S],x)):P[S].ty==="sh"?y.push(ShapePathInterface(P[S],T[S],x)):P[S].ty==="rc"?y.push(p(P[S],T[S],x)):P[S].ty==="rd"?y.push(f(P[S],T[S],x)):P[S].ty==="rp"?y.push(m(P[S],T[S],x)):P[S].ty==="gf"?y.push(s(P[S],T[S],x)):y.push(r(P[S],T[S])));return y}function e(P,T,x){var y,S=function(E){for(var B=0,_=y.length;B<_;){if(y[B]._name===E||y[B].mn===E||y[B].propertyIndex===E||y[B].ix===E||y[B].ind===E)return y[B];B+=1}return typeof E=="number"?y[E-1]:null};S.propertyGroup=propertyGroupFactory(S,x),y=n(P.it,T.it,S.propertyGroup),S.numProperties=y.length;var g=u(P.it[P.it.length-1],T.it[T.it.length-1],S.propertyGroup);return S.transform=g,S.propertyIndex=P.cix,S._name=P.nm,S}function i(P,T,x){var y=function(E){switch(E){case"ADBE Vectors Group":case"Contents":case 2:return y.content;default:return y.transform}};y.propertyGroup=propertyGroupFactory(y,x);var S=e(P,T,y.propertyGroup),g=u(P.it[P.it.length-1],T.it[T.it.length-1],y.propertyGroup);return y.content=S,y.transform=g,Object.defineProperty(y,"_name",{get:function(){return P.nm}}),y.numProperties=P.np,y.propertyIndex=P.ix,y.nm=P.nm,y.mn=P.mn,y}function a(P,T,x){function y(S){return S==="Color"||S==="color"?y.color:S==="Opacity"||S==="opacity"?y.opacity:null}return Object.defineProperties(y,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function s(P,T,x){function y(S){return S==="Start Point"||S==="start point"?y.startPoint:S==="End Point"||S==="end point"?y.endPoint:S==="Opacity"||S==="opacity"?y.opacity:null}return Object.defineProperties(y,{startPoint:{get:ExpressionPropertyInterface(T.s)},endPoint:{get:ExpressionPropertyInterface(T.e)},opacity:{get:ExpressionPropertyInterface(T.o)},type:{get:function(){return"a"}},_name:{value:P.nm},mn:{value:P.mn}}),T.s.setGroupProperty(PropertyInterface("Start Point",x)),T.e.setGroupProperty(PropertyInterface("End Point",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function r(){function P(){return null}return P}function o(P,T,x){var y=propertyGroupFactory(_,x),S=propertyGroupFactory(B,y);function g(M){Object.defineProperty(B,P.d[M].nm,{get:ExpressionPropertyInterface(T.d.dataProps[M].p)})}var C,E=P.d?P.d.length:0,B={};for(C=0;C<E;C+=1)g(C),T.d.dataProps[C].p.setGroupProperty(S);function _(M){return M==="Color"||M==="color"?_.color:M==="Opacity"||M==="opacity"?_.opacity:M==="Stroke Width"||M==="stroke width"?_.strokeWidth:null}return Object.defineProperties(_,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},strokeWidth:{get:ExpressionPropertyInterface(T.w)},dash:{get:function(){return B}},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",y)),T.o.setGroupProperty(PropertyInterface("Opacity",y)),T.w.setGroupProperty(PropertyInterface("Stroke Width",y)),_}function l(P,T,x){function y(g){return g===P.e.ix||g==="End"||g==="end"?y.end:g===P.s.ix?y.start:g===P.o.ix?y.offset:null}var S=propertyGroupFactory(y,x);return y.propertyIndex=P.ix,T.s.setGroupProperty(PropertyInterface("Start",S)),T.e.setGroupProperty(PropertyInterface("End",S)),T.o.setGroupProperty(PropertyInterface("Offset",S)),y.propertyIndex=P.ix,y.propertyGroup=x,Object.defineProperties(y,{start:{get:ExpressionPropertyInterface(T.s)},end:{get:ExpressionPropertyInterface(T.e)},offset:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm}}),y.mn=P.mn,y}function u(P,T,x){function y(g){return P.a.ix===g||g==="Anchor Point"?y.anchorPoint:P.o.ix===g||g==="Opacity"?y.opacity:P.p.ix===g||g==="Position"?y.position:P.r.ix===g||g==="Rotation"||g==="ADBE Vector Rotation"?y.rotation:P.s.ix===g||g==="Scale"?y.scale:P.sk&&P.sk.ix===g||g==="Skew"?y.skew:P.sa&&P.sa.ix===g||g==="Skew Axis"?y.skewAxis:null}var S=propertyGroupFactory(y,x);return T.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",S)),T.transform.mProps.p.setGroupProperty(PropertyInterface("Position",S)),T.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",S)),T.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",S)),T.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",S)),T.transform.mProps.sk&&(T.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",S)),T.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",S))),T.transform.op.setGroupProperty(PropertyInterface("Opacity",S)),Object.defineProperties(y,{opacity:{get:ExpressionPropertyInterface(T.transform.mProps.o)},position:{get:ExpressionPropertyInterface(T.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(T.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(T.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(T.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(T.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(T.transform.mProps.sa)},_name:{value:P.nm}}),y.ty="tr",y.mn=P.mn,y.propertyGroup=x,y}function c(P,T,x){function y(C){return P.p.ix===C?y.position:P.s.ix===C?y.size:null}var S=propertyGroupFactory(y,x);y.propertyIndex=P.ix;var g=T.sh.ty==="tm"?T.sh.prop:T.sh;return g.s.setGroupProperty(PropertyInterface("Size",S)),g.p.setGroupProperty(PropertyInterface("Position",S)),Object.defineProperties(y,{size:{get:ExpressionPropertyInterface(g.s)},position:{get:ExpressionPropertyInterface(g.p)},_name:{value:P.nm}}),y.mn=P.mn,y}function d(P,T,x){function y(C){return P.p.ix===C?y.position:P.r.ix===C?y.rotation:P.pt.ix===C?y.points:P.or.ix===C||C==="ADBE Vector Star Outer Radius"?y.outerRadius:P.os.ix===C?y.outerRoundness:P.ir&&(P.ir.ix===C||C==="ADBE Vector Star Inner Radius")?y.innerRadius:P.is&&P.is.ix===C?y.innerRoundness:null}var S=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.or.setGroupProperty(PropertyInterface("Outer Radius",S)),g.os.setGroupProperty(PropertyInterface("Outer Roundness",S)),g.pt.setGroupProperty(PropertyInterface("Points",S)),g.p.setGroupProperty(PropertyInterface("Position",S)),g.r.setGroupProperty(PropertyInterface("Rotation",S)),P.ir&&(g.ir.setGroupProperty(PropertyInterface("Inner Radius",S)),g.is.setGroupProperty(PropertyInterface("Inner Roundness",S))),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},rotation:{get:ExpressionPropertyInterface(g.r)},points:{get:ExpressionPropertyInterface(g.pt)},outerRadius:{get:ExpressionPropertyInterface(g.or)},outerRoundness:{get:ExpressionPropertyInterface(g.os)},innerRadius:{get:ExpressionPropertyInterface(g.ir)},innerRoundness:{get:ExpressionPropertyInterface(g.is)},_name:{value:P.nm}}),y.mn=P.mn,y}function p(P,T,x){function y(C){return P.p.ix===C?y.position:P.r.ix===C?y.roundness:P.s.ix===C||C==="Size"||C==="ADBE Vector Rect Size"?y.size:null}var S=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.p.setGroupProperty(PropertyInterface("Position",S)),g.s.setGroupProperty(PropertyInterface("Size",S)),g.r.setGroupProperty(PropertyInterface("Rotation",S)),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},roundness:{get:ExpressionPropertyInterface(g.r)},size:{get:ExpressionPropertyInterface(g.s)},_name:{value:P.nm}}),y.mn=P.mn,y}function f(P,T,x){function y(C){return P.r.ix===C||C==="Round Corners 1"?y.radius:null}var S=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.rd.setGroupProperty(PropertyInterface("Radius",S)),Object.defineProperties(y,{radius:{get:ExpressionPropertyInterface(g.rd)},_name:{value:P.nm}}),y.mn=P.mn,y}function m(P,T,x){function y(C){return P.c.ix===C||C==="Copies"?y.copies:P.o.ix===C||C==="Offset"?y.offset:null}var S=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.c.setGroupProperty(PropertyInterface("Copies",S)),g.o.setGroupProperty(PropertyInterface("Offset",S)),Object.defineProperties(y,{copies:{get:ExpressionPropertyInterface(g.c)},offset:{get:ExpressionPropertyInterface(g.o)},_name:{value:P.nm}}),y.mn=P.mn,y}return function(P,T,x){var y;function S(C){if(typeof C=="number")return C=C===void 0?1:C,C===0?x:y[C-1];for(var E=0,B=y.length;E<B;){if(y[E]._name===C)return y[E];E+=1}return null}function g(){return x}return S.propertyGroup=propertyGroupFactory(S,g),y=n(P,T,S.propertyGroup),S.numProperties=y.length,S._name="Contents",S}}(),TextExpressionInterface=function(){return function(n){var e;function i(a){switch(a){case"ADBE Text Document":return i.sourceText;default:return null}}return Object.defineProperty(i,"sourceText",{get:function(){n.textProperty.getValue();var s=n.textProperty.currentData.t;return(!e||s!==e.value)&&(e=new String(s),e.value=s||new String(s),Object.defineProperty(e,"style",{get:function(){return{fillColor:n.textProperty.currentData.fc}}})),e}}),i}}();function _typeof(n){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(n)}var FootageInterface=function(){var n=function(a){var s="",r=a.getFootageData();function o(){return s="",r=a.getFootageData(),l}function l(u){if(r[u])return s=u,r=r[u],_typeof(r)==="object"?l:r;var c=u.indexOf(s);if(c!==-1){var d=parseInt(u.substr(c+s.length),10);return r=r[d],_typeof(r)==="object"?l:r}return""}return o},e=function(a){function s(r){return r==="Outline"?s.outlineInterface():null}return s._name="Outline",s.outlineInterface=n(a),s};return function(i){function a(s){return s==="Data"?a.dataInterface:null}return a._name="Data",a.dataInterface=e(i),a}}(),interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(n){return interfaces[n]||null}var expressionHelpers=function(){function n(o,l,u){l.x&&(u.k=!0,u.x=!0,u.initiateExpression=ExpressionManager.initiateExpression,u.effectsSequence.push(u.initiateExpression(o,l,u).bind(u)))}function e(o){return o*=this.elem.globalData.frameRate,o-=this.offsetTime,o!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<o?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(o,this._cachingAtTime),this._cachingAtTime.lastFrame=o),this._cachingAtTime.value}function i(o){var l=-.01,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),d=0;if(u.length){var p;for(p=0;p<u.length;p+=1)d+=Math.pow(c[p]-u[p],2);d=Math.sqrt(d)*100}else d=0;return d}function a(o){if(this.vel!==void 0)return this.vel;var l=-.001,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),d;if(u.length){d=createTypedArray("float32",u.length);var p;for(p=0;p<u.length;p+=1)d[p]=(c[p]-u[p])/l}else d=(c-u)/l;return d}function s(){return this.pv}function r(o){this.propertyGroup=o}return{searchExpressions:n,getSpeedAtTime:i,getVelocityAtTime:a,getValueAtTime:e,getStaticValueAtTime:s,setGroupProperty:r}}();function addPropertyDecorator(){function n(f,m,P){if(!this.k||!this.keyframes)return this.pv;f=f?f.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[x.length-1].t;if(T<=y)return this.pv;var S,g;P?(m?S=Math.abs(y-this.elem.comp.globalData.frameRate*m):S=Math.max(0,y-this.elem.data.ip),g=y-S):((!m||m>x.length-1)&&(m=x.length-1),g=x[x.length-1-m].t,S=y-g);var C,E,B;if(f==="pingpong"){var _=Math.floor((T-g)/S);if(_%2!==0)return this.getValueAtTime((S-(T-g)%S+g)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var M=this.getValueAtTime(g/this.comp.globalData.frameRate,0),D=this.getValueAtTime(y/this.comp.globalData.frameRate,0),L=this.getValueAtTime(((T-g)%S+g)/this.comp.globalData.frameRate,0),F=Math.floor((T-g)/S);if(this.pv.length){for(B=new Array(M.length),E=B.length,C=0;C<E;C+=1)B[C]=(D[C]-M[C])*F+L[C];return B}return(D-M)*F+L}else if(f==="continue"){var N=this.getValueAtTime(y/this.comp.globalData.frameRate,0),H=this.getValueAtTime((y-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(B=new Array(N.length),E=B.length,C=0;C<E;C+=1)B[C]=N[C]+(N[C]-H[C])*((T-y)/this.comp.globalData.frameRate)/5e-4;return B}return N+(N-H)*((T-y)/.001)}return this.getValueAtTime(((T-g)%S+g)/this.comp.globalData.frameRate,0)}function e(f,m,P){if(!this.k)return this.pv;f=f?f.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[0].t;if(T>=y)return this.pv;var S,g;P?(m?S=Math.abs(this.elem.comp.globalData.frameRate*m):S=Math.max(0,this.elem.data.op-y),g=y+S):((!m||m>x.length-1)&&(m=x.length-1),g=x[m].t,S=g-y);var C,E,B;if(f==="pingpong"){var _=Math.floor((y-T)/S);if(_%2===0)return this.getValueAtTime(((y-T)%S+y)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var M=this.getValueAtTime(y/this.comp.globalData.frameRate,0),D=this.getValueAtTime(g/this.comp.globalData.frameRate,0),L=this.getValueAtTime((S-(y-T)%S+y)/this.comp.globalData.frameRate,0),F=Math.floor((y-T)/S)+1;if(this.pv.length){for(B=new Array(M.length),E=B.length,C=0;C<E;C+=1)B[C]=L[C]-(D[C]-M[C])*F;return B}return L-(D-M)*F}else if(f==="continue"){var N=this.getValueAtTime(y/this.comp.globalData.frameRate,0),H=this.getValueAtTime((y+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(B=new Array(N.length),E=B.length,C=0;C<E;C+=1)B[C]=N[C]+(N[C]-H[C])*(y-T)/.001;return B}return N+(N-H)*(y-T)/.001}return this.getValueAtTime((S-((y-T)%S+y))/this.comp.globalData.frameRate,0)}function i(f,m){if(!this.k)return this.pv;if(f=(f||.4)*.5,m=Math.floor(m||5),m<=1)return this.pv;var P=this.comp.renderedFrame/this.comp.globalData.frameRate,T=P-f,x=P+f,y=m>1?(x-T)/(m-1):1,S=0,g=0,C;this.pv.length?C=createTypedArray("float32",this.pv.length):C=0;for(var E;S<m;){if(E=this.getValueAtTime(T+S*y),this.pv.length)for(g=0;g<this.pv.length;g+=1)C[g]+=E[g];else C+=E;S+=1}if(this.pv.length)for(g=0;g<this.pv.length;g+=1)C[g]/=m;else C/=m;return C}function a(f){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var m=this._transformCachingAtTime.v;if(m.cloneFromProps(this.pre.props),this.appliedTransformations<1){var P=this.a.getValueAtTime(f);m.translate(-P[0]*this.a.mult,-P[1]*this.a.mult,P[2]*this.a.mult)}if(this.appliedTransformations<2){var T=this.s.getValueAtTime(f);m.scale(T[0]*this.s.mult,T[1]*this.s.mult,T[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var x=this.sk.getValueAtTime(f),y=this.sa.getValueAtTime(f);m.skewFromAxis(-x*this.sk.mult,y*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var S=this.r.getValueAtTime(f);m.rotate(-S*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var g=this.rz.getValueAtTime(f),C=this.ry.getValueAtTime(f),E=this.rx.getValueAtTime(f),B=this.or.getValueAtTime(f);m.rotateZ(-g*this.rz.mult).rotateY(C*this.ry.mult).rotateX(E*this.rx.mult).rotateZ(-B[2]*this.or.mult).rotateY(B[1]*this.or.mult).rotateX(B[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var _=this.px.getValueAtTime(f),M=this.py.getValueAtTime(f);if(this.data.p.z){var D=this.pz.getValueAtTime(f);m.translate(_*this.px.mult,M*this.py.mult,-D*this.pz.mult)}else m.translate(_*this.px.mult,M*this.py.mult,0)}else{var L=this.p.getValueAtTime(f);m.translate(L[0]*this.p.mult,L[1]*this.p.mult,-L[2]*this.p.mult)}return m}function s(){return this.v.clone(new Matrix)}var r=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(f,m,P){var T=r(f,m,P);return T.dynamicProperties.length?T.getValueAtTime=a.bind(T):T.getValueAtTime=s.bind(T),T.setGroupProperty=expressionHelpers.setGroupProperty,T};var o=PropertyFactory.getProp;PropertyFactory.getProp=function(f,m,P,T,x){var y=o(f,m,P,T,x);y.kf?y.getValueAtTime=expressionHelpers.getValueAtTime.bind(y):y.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(y),y.setGroupProperty=expressionHelpers.setGroupProperty,y.loopOut=n,y.loopIn=e,y.smooth=i,y.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(y),y.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(y),y.numKeys=m.a===1?m.k.length:0,y.propertyIndex=m.ix;var S=0;return P!==0&&(S=createTypedArray("float32",m.a===1?m.k[0].s.length:m.k.length)),y._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:S},expressionHelpers.searchExpressions(f,m,y),y.k&&x.addDynamicProperty(y),y};function l(f){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),f*=this.elem.globalData.frameRate,f-=this.offsetTime,f!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<f?this._caching.lastIndex:0,this._cachingAtTime.lastTime=f,this.interpolateShape(f,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue}var u=ShapePropertyFactory.getConstructorFunction(),c=ShapePropertyFactory.getKeyframedConstructorFunction();function d(){}d.prototype={vertices:function(m,P){this.k&&this.getValue();var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0));var x,y=T._length,S=T[m],g=T.v,C=createSizedArray(y);for(x=0;x<y;x+=1)m==="i"||m==="o"?C[x]=[S[x][0]-g[x][0],S[x][1]-g[x][1]]:C[x]=[S[x][0],S[x][1]];return C},points:function(m){return this.vertices("v",m)},inTangents:function(m){return this.vertices("i",m)},outTangents:function(m){return this.vertices("o",m)},isClosed:function(){return this.v.c},pointOnPath:function(m,P){var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(T));for(var x=this._segmentsLength,y=x.lengths,S=x.totalLength*m,g=0,C=y.length,E=0,B;g<C;){if(E+y[g].addedLength>S){var _=g,M=T.c&&g===C-1?0:g+1,D=(S-E)/y[g].addedLength;B=bez.getPointInSegment(T.v[_],T.v[M],T.o[_],T.i[M],D,y[g]);break}else E+=y[g].addedLength;g+=1}return B||(B=T.c?[T.v[0][0],T.v[0][1]]:[T.v[T._length-1][0],T.v[T._length-1][1]]),B},vectorOnPath:function(m,P,T){m==1?m=this.v.c:m==0&&(m=.999);var x=this.pointOnPath(m,P),y=this.pointOnPath(m+.001,P),S=y[0]-x[0],g=y[1]-x[1],C=Math.sqrt(Math.pow(S,2)+Math.pow(g,2));if(C===0)return[0,0];var E=T==="tangent"?[S/C,g/C]:[-g/C,S/C];return E},tangentOnPath:function(m,P){return this.vectorOnPath(m,P,"tangent")},normalOnPath:function(m,P){return this.vectorOnPath(m,P,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([d],u),extendPrototype([d],c),c.prototype.getValueAtTime=l,c.prototype.initiateExpression=ExpressionManager.initiateExpression;var p=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(f,m,P,T,x){var y=p(f,m,P,T,x);return y.propertyIndex=m.ix,y.lock=!1,P===3?expressionHelpers.searchExpressions(f,m.pt,y):P===4&&expressionHelpers.searchExpressions(f,m.ks,y),y.k&&f.addDynamicProperty(y),y}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function n(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,i){var a=this.calculateExpression(i);if(e.t!==a){var s={};return this.copyData(s,e),s.t=a.toString(),s.__complete=!1,s}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),i=this.searchExpressions();return this.kf=e||i,this.kf},TextProperty.prototype.searchExpressions=n}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function n(e,i){var a=createNS("feMerge");a.setAttribute("result",e);var s,r;for(r=0;r<i.length;r+=1)s=createNS("feMergeNode"),s.setAttribute("in",i[r]),a.appendChild(s),a.appendChild(s);return a}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(n,e,i,a,s){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","linearRGB"),r.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=r,r.setAttribute("result",a+"_tint_1"),n.appendChild(r),r=createNS("feColorMatrix"),r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),r.setAttribute("result",a+"_tint_2"),n.appendChild(r),this.matrixFilter=r;var o=this.createMergeNode(a,[s,a+"_tint_1",a+"_tint_2"]);n.appendChild(o)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,a=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+a+" 0"),this.matrixFilter.setAttribute("values",i[0]-e[0]+" 0 0 0 "+e[0]+" "+(i[1]-e[1])+" 0 0 0 "+e[1]+" "+(i[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 1 0")}};function SVGFillFilter(n,e,i,a){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),s.setAttribute("result",a),n.appendChild(s),this.matrixFilter=s}SVGFillFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,i=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+i+" 0")}};function SVGStrokeEffect(n,e,i){this.initialized=!1,this.filterManager=e,this.elem=i,this.paths=[]}SVGStrokeEffect.prototype.initialize=function(){var n=this.elem.layerElement.children||this.elem.layerElement.childNodes,e,i,a,s;for(this.filterManager.effectElements[1].p.v===1?(s=this.elem.maskManager.masksProperties.length,a=0):(a=this.filterManager.effectElements[0].p.v-1,s=a+1),i=createNS("g"),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-dashoffset",1),a;a<s;a+=1)e=createNS("path"),i.appendChild(e),this.paths.push({p:e,m:a});if(this.filterManager.effectElements[10].p.v===3){var r=createNS("mask"),o=createElementID();r.setAttribute("id",o),r.setAttribute("mask-type","alpha"),r.appendChild(i),this.elem.globalData.defs.appendChild(r);var l=createNS("g");for(l.setAttribute("mask","url("+getLocationHref()+"#"+o+")");n[0];)l.appendChild(n[0]);this.elem.layerElement.appendChild(l),this.masker=r,i.setAttribute("stroke","#fff")}else if(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2){if(this.filterManager.effectElements[10].p.v===2)for(n=this.elem.layerElement.children||this.elem.layerElement.childNodes;n.length;)this.elem.layerElement.removeChild(n[0]);this.elem.layerElement.appendChild(i),this.elem.layerElement.removeAttribute("mask"),i.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=i},SVGStrokeEffect.prototype.renderFrame=function(n){this.initialized||this.initialize();var e,i=this.paths.length,a,s;for(e=0;e<i;e+=1)if(this.paths[e].m!==-1&&(a=this.elem.maskManager.viewData[this.paths[e].m],s=this.paths[e].p,(n||this.filterManager._mdf||a.prop._mdf)&&s.setAttribute("d",a.lastPath),n||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||a.prop._mdf)){var r;if(this.filterManager.effectElements[7].p.v!==0||this.filterManager.effectElements[8].p.v!==100){var o=Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,l=Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,u=s.getTotalLength();r="0 0 0 "+u*o+" ";var c=u*(l-o),d=1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01,p=Math.floor(c/d),f;for(f=0;f<p;f+=1)r+="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01+" ";r+="0 "+u*10+" 0 0"}else r="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01;s.setAttribute("stroke-dasharray",r)}if((n||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",this.filterManager.effectElements[4].p.v*2),(n||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2)&&(n||this.filterManager.effectElements[3].p._mdf)){var m=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(m[0]*255)+","+bmFloor(m[1]*255)+","+bmFloor(m[2]*255)+")")}};function SVGTritoneFilter(n,e,i,a){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","linearRGB"),s.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.appendChild(s);var r=createNS("feComponentTransfer");r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("result",a),this.matrixFilter=r;var o=createNS("feFuncR");o.setAttribute("type","table"),r.appendChild(o),this.feFuncR=o;var l=createNS("feFuncG");l.setAttribute("type","table"),r.appendChild(l),this.feFuncG=l;var u=createNS("feFuncB");u.setAttribute("type","table"),r.appendChild(u),this.feFuncB=u,n.appendChild(r)}SVGTritoneFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,a=this.filterManager.effectElements[2].p.v,s=a[0]+" "+i[0]+" "+e[0],r=a[1]+" "+i[1]+" "+e[1],o=a[2]+" "+i[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",s),this.feFuncG.setAttribute("tableValues",r),this.feFuncB.setAttribute("tableValues",o)}};function SVGProLevelsFilter(n,e,i,a){this.filterManager=e;var s=this.filterManager.effectElements,r=createNS("feComponentTransfer");(s[10].p.k||s[10].p.v!==0||s[11].p.k||s[11].p.v!==1||s[12].p.k||s[12].p.v!==1||s[13].p.k||s[13].p.v!==0||s[14].p.k||s[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",r)),(s[17].p.k||s[17].p.v!==0||s[18].p.k||s[18].p.v!==1||s[19].p.k||s[19].p.v!==1||s[20].p.k||s[20].p.v!==0||s[21].p.k||s[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",r)),(s[24].p.k||s[24].p.v!==0||s[25].p.k||s[25].p.v!==1||s[26].p.k||s[26].p.v!==1||s[27].p.k||s[27].p.v!==0||s[28].p.k||s[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",r)),(s[31].p.k||s[31].p.v!==0||s[32].p.k||s[32].p.v!==1||s[33].p.k||s[33].p.v!==1||s[34].p.k||s[34].p.v!==0||s[35].p.k||s[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",r)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(r.setAttribute("color-interpolation-filters","sRGB"),n.appendChild(r)),(s[3].p.k||s[3].p.v!==0||s[4].p.k||s[4].p.v!==1||s[5].p.k||s[5].p.v!==1||s[6].p.k||s[6].p.v!==0||s[7].p.k||s[7].p.v!==1)&&(r=createNS("feComponentTransfer"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("result",a),n.appendChild(r),this.feFuncRComposed=this.createFeFunc("feFuncR",r),this.feFuncGComposed=this.createFeFunc("feFuncG",r),this.feFuncBComposed=this.createFeFunc("feFuncB",r))}SVGProLevelsFilter.prototype.createFeFunc=function(n,e){var i=createNS(n);return i.setAttribute("type","table"),e.appendChild(i),i},SVGProLevelsFilter.prototype.getTableValue=function(n,e,i,a,s){for(var r=0,o=256,l,u=Math.min(n,e),c=Math.max(n,e),d=Array.call(null,{length:o}),p,f=0,m=s-a,P=e-n;r<=256;)l=r/256,l<=u?p=P<0?s:a:l>=c?p=P<0?a:s:p=a+m*Math.pow((l-n)/P,1/i),d[f]=p,f+=1,r+=256/(o-1);return d.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e,i=this.filterManager.effectElements;this.feFuncRComposed&&(n||i[3].p._mdf||i[4].p._mdf||i[5].p._mdf||i[6].p._mdf||i[7].p._mdf)&&(e=this.getTableValue(i[3].p.v,i[4].p.v,i[5].p.v,i[6].p.v,i[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(n||i[10].p._mdf||i[11].p._mdf||i[12].p._mdf||i[13].p._mdf||i[14].p._mdf)&&(e=this.getTableValue(i[10].p.v,i[11].p.v,i[12].p.v,i[13].p.v,i[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(n||i[17].p._mdf||i[18].p._mdf||i[19].p._mdf||i[20].p._mdf||i[21].p._mdf)&&(e=this.getTableValue(i[17].p.v,i[18].p.v,i[19].p.v,i[20].p.v,i[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(n||i[24].p._mdf||i[25].p._mdf||i[26].p._mdf||i[27].p._mdf||i[28].p._mdf)&&(e=this.getTableValue(i[24].p.v,i[25].p.v,i[26].p.v,i[27].p.v,i[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(n||i[31].p._mdf||i[32].p._mdf||i[33].p._mdf||i[34].p._mdf||i[35].p._mdf)&&(e=this.getTableValue(i[31].p.v,i[32].p.v,i[33].p.v,i[34].p.v,i[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(n,e,i,a,s){var r=e.container.globalData.renderConfig.filterSize,o=e.data.fs||r;n.setAttribute("x",o.x||r.x),n.setAttribute("y",o.y||r.y),n.setAttribute("width",o.width||r.width),n.setAttribute("height",o.height||r.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",a+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,n.appendChild(l);var u=createNS("feOffset");u.setAttribute("dx","25"),u.setAttribute("dy","0"),u.setAttribute("in",a+"_drop_shadow_1"),u.setAttribute("result",a+"_drop_shadow_2"),this.feOffset=u,n.appendChild(u);var c=createNS("feFlood");c.setAttribute("flood-color","#00ff00"),c.setAttribute("flood-opacity","1"),c.setAttribute("result",a+"_drop_shadow_3"),this.feFlood=c,n.appendChild(c);var d=createNS("feComposite");d.setAttribute("in",a+"_drop_shadow_3"),d.setAttribute("in2",a+"_drop_shadow_2"),d.setAttribute("operator","in"),d.setAttribute("result",a+"_drop_shadow_4"),n.appendChild(d);var p=this.createMergeNode(a,[a+"_drop_shadow_4",s]);n.appendChild(p)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){if((n||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),n||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((n||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),n||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var i=this.filterManager.effectElements[3].p.v,a=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=i*Math.cos(a),r=i*Math.sin(a);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",r)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(n,e,i){this.initialized=!1,this.filterManager=e,this.filterElem=n,this.elem=i,i.matteElement=createNS("g"),i.matteElement.appendChild(i.layerElement),i.matteElement.appendChild(i.transformedElement),i.baseElement=i.matteElement}SVGMatte3Effect.prototype.findSymbol=function(n){for(var e=0,i=_svgMatteSymbols.length;e<i;){if(_svgMatteSymbols[e]===n)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(n,e){var i=n.layerElement.parentNode;if(i){for(var a=i.children,s=0,r=a.length;s<r&&a[s]!==n.layerElement;)s+=1;var o;s<=r-2&&(o=a[s+1]);var l=createNS("use");l.setAttribute("href","#"+e),o?i.insertBefore(l,o):i.appendChild(l)}},SVGMatte3Effect.prototype.setElementAsMask=function(n,e){if(!this.findSymbol(e)){var i=createElementID(),a=createNS("mask");a.setAttribute("id",e.layerId),a.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var s=n.globalData.defs;s.appendChild(a);var r=createNS("symbol");r.setAttribute("id",i),this.replaceInParent(e,i),r.appendChild(e.layerElement),s.appendChild(r);var o=createNS("use");o.setAttribute("href","#"+i),a.appendChild(o),e.data.hd=!1,e.show()}n.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var n=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,i=0,a=e.length;i<a;)e[i]&&e[i].data.ind===n&&this.setElementAsMask(this.elem,e[i]),i+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()};function SVGGaussianBlurEffect(n,e,i,a){n.setAttribute("x","-100%"),n.setAttribute("y","-100%"),n.setAttribute("width","300%"),n.setAttribute("height","300%"),this.filterManager=e;var s=createNS("feGaussianBlur");s.setAttribute("result",a),n.appendChild(s),this.feGaussianBlur=s}SVGGaussianBlurEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=.3,i=this.filterManager.effectElements[0].p.v*e,a=this.filterManager.effectElements[1].p.v,s=a==3?0:i,r=a==2?0:i;this.feGaussianBlur.setAttribute("stdDeviation",s+" "+r);var o=this.filterManager.effectElements[2].p.v==1?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",o)}};function TransformEffect(){}TransformEffect.prototype.init=function(n){this.effectsManager=n,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(n){if(this._opMdf=!1,this._mdf=!1,n||this.effectsManager._mdf){var e=this.effectsManager.effectElements,i=e[0].p.v,a=e[1].p.v,s=e[2].p.v===1,r=e[3].p.v,o=s?r:e[4].p.v,l=e[5].p.v,u=e[6].p.v,c=e[7].p.v;this.matrix.reset(),this.matrix.translate(-i[0],-i[1],i[2]),this.matrix.scale(o*.01,r*.01,1),this.matrix.rotate(-c*degToRads),this.matrix.skewFromAxis(-l*degToRads,(u+90)*degToRads),this.matrix.translate(a[0],a[1],0),this._mdf=!0,this.opacity!==e[8].p.v&&(this.opacity=e[8].p.v,this._opMdf=!0)}};function SVGTransformEffect(n,e){this.init(e)}extendPrototype([TransformEffect],SVGTransformEffect);function CVTransformEffect(n){this.init(n)}return extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie})})(lottie$1,lottie$1.exports);var lottieExports=lottie$1.exports;const lottie=getDefaultExportFromCjs(lottieExports);function _arrayLikeToArray(n,e){(e==null||e>n.length)&&(e=n.length);for(var i=0,a=Array(e);i<e;i++)a[i]=n[i];return a}function _arrayWithHoles(n){if(Array.isArray(n))return n}function _defineProperty(n,e,i){return(e=_toPropertyKey(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function _iterableToArrayLimit(n,e){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var a,s,r,o,l=[],u=!0,c=!1;try{if(r=(i=i.call(n)).next,e!==0)for(;!(u=(a=r.call(i)).done)&&(l.push(a.value),l.length!==e);u=!0);}catch(d){c=!0,s=d}finally{try{if(!u&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw s}}return l}}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
158
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ownKeys(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),i.push.apply(i,a)}return i}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(a){_defineProperty(n,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(i,a))})}return n}function _objectWithoutProperties(n,e){if(n==null)return{};var i,a,s=_objectWithoutPropertiesLoose(n,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(a=0;a<r.length;a++)i=r[a],e.includes(i)||{}.propertyIsEnumerable.call(n,i)&&(s[i]=n[i])}return s}function _objectWithoutPropertiesLoose(n,e){if(n==null)return{};var i={};for(var a in n)if({}.hasOwnProperty.call(n,a)){if(e.includes(a))continue;i[a]=n[a]}return i}function _slicedToArray(n,e){return _arrayWithHoles(n)||_iterableToArrayLimit(n,e)||_unsupportedIterableToArray(n,e)||_nonIterableRest()}function _toPrimitive(n,e){if(typeof n!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var a=i.call(n,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _toPropertyKey(n){var e=_toPrimitive(n,"string");return typeof e=="symbol"?e:e+""}function _unsupportedIterableToArray(n,e){if(n){if(typeof n=="string")return _arrayLikeToArray(n,e);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(n,e):void 0}}var _excluded$1=["animationData","loop","autoplay","initialSegment","onComplete","onLoopComplete","onEnterFrame","onSegmentStart","onConfigReady","onDataReady","onDataFailed","onLoadedImages","onDOMLoaded","onDestroy","lottieRef","renderer","name","assetsPath","rendererSettings"],useLottie=function n(e,i){var a=e.animationData,s=e.loop,r=e.autoplay,o=e.initialSegment,l=e.onComplete,u=e.onLoopComplete,c=e.onEnterFrame,d=e.onSegmentStart,p=e.onConfigReady,f=e.onDataReady,m=e.onDataFailed,P=e.onLoadedImages,T=e.onDOMLoaded,x=e.onDestroy;e.lottieRef,e.renderer,e.name,e.assetsPath,e.rendererSettings;var y=_objectWithoutProperties(e,_excluded$1),S=React.useState(!1),g=_slicedToArray(S,2),C=g[0],E=g[1],B=React.useRef(),_=React.useRef(null),M=function(){var G;(G=B.current)===null||G===void 0||G.play()},D=function(){var G;(G=B.current)===null||G===void 0||G.stop()},L=function(){var G;(G=B.current)===null||G===void 0||G.pause()},
|
|
157
|
+
*/var Matrix=function(){var n=Math.cos,e=Math.sin,i=Math.tan,a=Math.round;function s(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function r(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,-k,0,0,k,A,0,0,0,0,1,0,0,0,0,1)}function o(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(1,0,0,0,0,A,-k,0,0,k,A,0,0,0,0,1)}function l(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,0,k,0,0,1,0,0,-k,0,A,0,0,0,0,1)}function u(V){if(V===0)return this;var A=n(V),k=e(V);return this._t(A,-k,0,0,k,A,0,0,0,0,1,0,0,0,0,1)}function c(V,A){return this._t(1,A,V,1,0,0)}function d(V,A){return this.shear(i(V),i(A))}function p(V,A){var k=n(A),R=e(A);return this._t(k,R,0,0,-R,k,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,i(V),1,0,0,0,0,1,0,0,0,0,1)._t(k,-R,0,0,R,k,0,0,0,0,1,0,0,0,0,1)}function f(V,A,k){return!k&&k!==0&&(k=1),V===1&&A===1&&k===1?this:this._t(V,0,0,0,0,A,0,0,0,0,k,0,0,0,0,1)}function m(V,A,k,R,G,z,q,U,K,Q,ne,Ee,ye,ge,xe,oe){return this.props[0]=V,this.props[1]=A,this.props[2]=k,this.props[3]=R,this.props[4]=G,this.props[5]=z,this.props[6]=q,this.props[7]=U,this.props[8]=K,this.props[9]=Q,this.props[10]=ne,this.props[11]=Ee,this.props[12]=ye,this.props[13]=ge,this.props[14]=xe,this.props[15]=oe,this}function P(V,A,k){return k=k||0,V!==0||A!==0||k!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,V,A,k,1):this}function T(V,A,k,R,G,z,q,U,K,Q,ne,Ee,ye,ge,xe,oe){var Y=this.props;if(V===1&&A===0&&k===0&&R===0&&G===0&&z===1&&q===0&&U===0&&K===0&&Q===0&&ne===1&&Ee===0)return Y[12]=Y[12]*V+Y[15]*ye,Y[13]=Y[13]*z+Y[15]*ge,Y[14]=Y[14]*ne+Y[15]*xe,Y[15]*=oe,this._identityCalculated=!1,this;var Fe=Y[0],Oe=Y[1],Le=Y[2],Ce=Y[3],De=Y[4],ae=Y[5],re=Y[6],de=Y[7],Be=Y[8],he=Y[9],Ie=Y[10],Ae=Y[11],we=Y[12],fe=Y[13],ke=Y[14],pe=Y[15];return Y[0]=Fe*V+Oe*G+Le*K+Ce*ye,Y[1]=Fe*A+Oe*z+Le*Q+Ce*ge,Y[2]=Fe*k+Oe*q+Le*ne+Ce*xe,Y[3]=Fe*R+Oe*U+Le*Ee+Ce*oe,Y[4]=De*V+ae*G+re*K+de*ye,Y[5]=De*A+ae*z+re*Q+de*ge,Y[6]=De*k+ae*q+re*ne+de*xe,Y[7]=De*R+ae*U+re*Ee+de*oe,Y[8]=Be*V+he*G+Ie*K+Ae*ye,Y[9]=Be*A+he*z+Ie*Q+Ae*ge,Y[10]=Be*k+he*q+Ie*ne+Ae*xe,Y[11]=Be*R+he*U+Ie*Ee+Ae*oe,Y[12]=we*V+fe*G+ke*K+pe*ye,Y[13]=we*A+fe*z+ke*Q+pe*ge,Y[14]=we*k+fe*q+ke*ne+pe*xe,Y[15]=we*R+fe*U+ke*Ee+pe*oe,this._identityCalculated=!1,this}function x(V){var A=V.props;return this.transform(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15])}function y(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function S(V){for(var A=0;A<16;){if(V.props[A]!==this.props[A])return!1;A+=1}return!0}function g(V){var A;for(A=0;A<16;A+=1)V.props[A]=this.props[A];return V}function C(V){var A;for(A=0;A<16;A+=1)this.props[A]=V[A]}function E(V,A,k){return{x:V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12],y:V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13],z:V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]}}function B(V,A,k){return V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12]}function _(V,A,k){return V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13]}function M(V,A,k){return V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]}function D(){var V=this.props[0]*this.props[5]-this.props[1]*this.props[4],A=this.props[5]/V,k=-this.props[1]/V,R=-this.props[4]/V,G=this.props[0]/V,z=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/V,q=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/V,U=new Matrix;return U.props[0]=A,U.props[1]=k,U.props[4]=R,U.props[5]=G,U.props[12]=z,U.props[13]=q,U}function L(V){var A=this.getInverseMatrix();return A.applyToPointArray(V[0],V[1],V[2]||0)}function N(V){var A,k=V.length,R=[];for(A=0;A<k;A+=1)R[A]=L(V[A]);return R}function F(V,A,k){var R=createTypedArray("float32",6);if(this.isIdentity())R[0]=V[0],R[1]=V[1],R[2]=A[0],R[3]=A[1],R[4]=k[0],R[5]=k[1];else{var G=this.props[0],z=this.props[1],q=this.props[4],U=this.props[5],K=this.props[12],Q=this.props[13];R[0]=V[0]*G+V[1]*q+K,R[1]=V[0]*z+V[1]*U+Q,R[2]=A[0]*G+A[1]*q+K,R[3]=A[0]*z+A[1]*U+Q,R[4]=k[0]*G+k[1]*q+K,R[5]=k[0]*z+k[1]*U+Q}return R}function H(V,A,k){var R;return this.isIdentity()?R=[V,A,k]:R=[V*this.props[0]+A*this.props[4]+k*this.props[8]+this.props[12],V*this.props[1]+A*this.props[5]+k*this.props[9]+this.props[13],V*this.props[2]+A*this.props[6]+k*this.props[10]+this.props[14]],R}function $(V,A){if(this.isIdentity())return V+","+A;var k=this.props;return Math.round((V*k[0]+A*k[4]+k[12])*100)/100+","+Math.round((V*k[1]+A*k[5]+k[13])*100)/100}function O(){for(var V=0,A=this.props,k="matrix3d(",R=1e4;V<16;)k+=a(A[V]*R)/R,k+=V===15?")":",",V+=1;return k}function b(V){var A=1e4;return V<1e-6&&V>0||V>-1e-6&&V<0?a(V*A)/A:V}function I(){var V=this.props,A=b(V[0]),k=b(V[1]),R=b(V[4]),G=b(V[5]),z=b(V[12]),q=b(V[13]);return"matrix("+A+","+k+","+R+","+G+","+z+","+q+")"}return function(){this.reset=s,this.rotate=r,this.rotateX=o,this.rotateY=l,this.rotateZ=u,this.skew=d,this.skewFromAxis=p,this.shear=c,this.scale=f,this.setTransform=m,this.translate=P,this.transform=T,this.multiply=x,this.applyToPoint=E,this.applyToX=B,this.applyToY=_,this.applyToZ=M,this.applyToPointArray=H,this.applyToTriplePoints=F,this.applyToPointStringified=$,this.toCSS=O,this.to2dCSS=I,this.clone=g,this.cloneFromProps=C,this.equals=S,this.inversePoints=N,this.inversePoint=L,this.getInverseMatrix=D,this._t=this.transform,this.isIdentity=y,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(n){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(n)}var lottie={};function setLocation(n){setLocationHref(n)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(n){setSubframeEnabled(n)}function setPrefix(n){setIdPrefix(n)}function loadAnimation(n){return animationManager.loadAnimation(n)}function setQuality(n){if(typeof n=="string")switch(n){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(n)&&n>1&&setDefaultCurveSegments(n)}function inBrowser(){return typeof navigator<"u"}function installPlugin(n,e){n==="expressions"&&setExpressionsPlugin(e)}function getFactory(n){switch(n){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.13.0";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(n){for(var e=queryString.split("&"),i=0;i<e.length;i+=1){var a=e[i].split("=");if(decodeURIComponent(a[0])==n)return decodeURIComponent(a[1])}return null}var queryString="";{var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);try{_typeof$3(exports)!=="object"&&(window.bodymovin=lottie)}catch(n){}var ShapeModifiers=function(){var n={},e={};n.registerModifier=i,n.getModifier=a;function i(s,r){e[s]||(e[s]=r)}function a(s,r,o){return new e[s](r,o)}return n}();function ShapeModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(n){if(!this.closed){n.sh.container.addDynamicProperty(n.sh);var e={shape:n.sh,data:n,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&n.setAsAnimated()}},ShapeModifier.prototype.init=function(n,e){this.shapes=[],this.elem=n,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier);function TrimModifier(){}extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(n,e){this.s=PropertyFactory.getProp(n,e.s,0,.01,this),this.e=PropertyFactory.getProp(n,e.e,0,.01,this),this.o=PropertyFactory.getProp(n,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(n){n.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(n,e,i,a,s){var r=[];e<=1?r.push({s:n,e}):n>=1?r.push({s:n-1,e:e-1}):(r.push({s:n,e:1}),r.push({s:0,e:e-1}));var o=[],l,u=r.length,c;for(l=0;l<u;l+=1)if(c=r[l],!(c.e*s<a||c.s*s>a+i)){var d,p;c.s*s<=a?d=0:d=(c.s*s-a)/i,c.e*s>=a+i?p=1:p=(c.e*s-a)/i,o.push([d,p])}return o.length||o.push([0,0]),o},TrimModifier.prototype.releasePathsData=function(n){var e,i=n.length;for(e=0;e<i;e+=1)segmentsLengthPool.release(n[e]);return n.length=0,n},TrimModifier.prototype.processShapes=function(n){var e,i;if(this._mdf||n){var a=this.o.v%360/360;if(a<0&&(a+=1),this.s.v>1?e=1+a:this.s.v<0?e=0+a:e=this.s.v+a,this.e.v>1?i=1+a:this.e.v<0?i=0+a:i=this.e.v+a,e>i){var s=e;e=i,i=s}e=Math.round(e*1e4)*1e-4,i=Math.round(i*1e4)*1e-4,this.sValue=e,this.eValue=i}else e=this.sValue,i=this.eValue;var r,o,l=this.shapes.length,u,c,d,p,f,m=0;if(i===e)for(o=0;o<l;o+=1)this.shapes[o].localShapeCollection.releaseShapes(),this.shapes[o].shape._mdf=!0,this.shapes[o].shape.paths=this.shapes[o].localShapeCollection,this._mdf&&(this.shapes[o].pathsData.length=0);else if(i===1&&e===0||i===0&&e===1){if(this._mdf)for(o=0;o<l;o+=1)this.shapes[o].pathsData.length=0,this.shapes[o].shape._mdf=!0}else{var P=[],T,x;for(o=0;o<l;o+=1)if(T=this.shapes[o],!T.shape._mdf&&!this._mdf&&!n&&this.m!==2)T.shape.paths=T.localShapeCollection;else{if(r=T.shape.paths,c=r._length,f=0,!T.shape._mdf&&T.pathsData.length)f=T.totalShapeLength;else{for(d=this.releasePathsData(T.pathsData),u=0;u<c;u+=1)p=bez.getSegmentsLength(r.shapes[u]),d.push(p),f+=p.totalLength;T.totalShapeLength=f,T.pathsData=d}m+=f,T.shape._mdf=!0}var y=e,S=i,g=0,C;for(o=l-1;o>=0;o-=1)if(T=this.shapes[o],T.shape._mdf){for(x=T.localShapeCollection,x.releaseShapes(),this.m===2&&l>1?(C=this.calculateShapeEdges(e,i,T.totalShapeLength,g,m),g+=T.totalShapeLength):C=[[y,S]],c=C.length,u=0;u<c;u+=1){y=C[u][0],S=C[u][1],P.length=0,S<=1?P.push({s:T.totalShapeLength*y,e:T.totalShapeLength*S}):y>=1?P.push({s:T.totalShapeLength*(y-1),e:T.totalShapeLength*(S-1)}):(P.push({s:T.totalShapeLength*y,e:T.totalShapeLength}),P.push({s:0,e:T.totalShapeLength*(S-1)}));var E=this.addShapes(T,P[0]);if(P[0].s!==P[0].e){if(P.length>1){var B=T.shape.paths.shapes[T.shape.paths._length-1];if(B.c){var _=E.pop();this.addPaths(E,x),E=this.addShapes(T,P[1],_)}else this.addPaths(E,x),E=this.addShapes(T,P[1])}this.addPaths(E,x)}}T.shape.paths=x}}},TrimModifier.prototype.addPaths=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)e.addShape(n[i])},TrimModifier.prototype.addSegment=function(n,e,i,a,s,r,o){s.setXYAt(e[0],e[1],"o",r),s.setXYAt(i[0],i[1],"i",r+1),o&&s.setXYAt(n[0],n[1],"v",r),s.setXYAt(a[0],a[1],"v",r+1)},TrimModifier.prototype.addSegmentFromArray=function(n,e,i,a){e.setXYAt(n[1],n[5],"o",i),e.setXYAt(n[2],n[6],"i",i+1),a&&e.setXYAt(n[0],n[4],"v",i),e.setXYAt(n[3],n[7],"v",i+1)},TrimModifier.prototype.addShapes=function(n,e,i){var a=n.pathsData,s=n.shape.paths.shapes,r,o=n.shape.paths._length,l,u,c=0,d,p,f,m,P=[],T,x=!0;for(i?(p=i._length,T=i._length):(i=shapePool.newElement(),p=0,T=0),P.push(i),r=0;r<o;r+=1){for(f=a[r].lengths,i.c=s[r].c,u=s[r].c?f.length:f.length+1,l=1;l<u;l+=1)if(d=f[l-1],c+d.addedLength<e.s)c+=d.addedLength,i.c=!1;else if(c>e.e){i.c=!1;break}else e.s<=c&&e.e>=c+d.addedLength?(this.addSegment(s[r].v[l-1],s[r].o[l-1],s[r].i[l],s[r].v[l],i,p,x),x=!1):(m=bez.getNewSegment(s[r].v[l-1],s[r].v[l],s[r].o[l-1],s[r].i[l],(e.s-c)/d.addedLength,(e.e-c)/d.addedLength,f[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1),c+=d.addedLength,p+=1;if(s[r].c&&f.length){if(d=f[l-1],c<=e.e){var y=f[l-1].addedLength;e.s<=c&&e.e>=c+y?(this.addSegment(s[r].v[l-1],s[r].o[l-1],s[r].i[0],s[r].v[0],i,p,x),x=!1):(m=bez.getNewSegment(s[r].v[l-1],s[r].v[0],s[r].o[l-1],s[r].i[0],(e.s-c)/y,(e.e-c)/y,f[l-1]),this.addSegmentFromArray(m,i,p,x),x=!1,i.c=!1)}else i.c=!1;c+=d.addedLength,p+=1}if(i._length&&(i.setXYAt(i.v[T][0],i.v[T][1],"i",T),i.setXYAt(i.v[i._length-1][0],i.v[i._length-1][1],"o",i._length-1)),c>e.e)break;r<o-1&&(i=shapePool.newElement(),x=!0,P.push(i),p=0)}return P};function PuckerAndBloatModifier(){}extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(n,e){var i=e/100,a=[0,0],s=n._length,r=0;for(r=0;r<s;r+=1)a[0]+=n.v[r][0],a[1]+=n.v[r][1];a[0]/=s,a[1]/=s;var o=shapePool.newElement();o.c=n.c;var l,u,c,d,p,f;for(r=0;r<s;r+=1)l=n.v[r][0]+(a[0]-n.v[r][0])*i,u=n.v[r][1]+(a[1]-n.v[r][1])*i,c=n.o[r][0]+(a[0]-n.o[r][0])*-i,d=n.o[r][1]+(a[1]-n.o[r][1])*-i,p=n.i[r][0]+(a[0]-n.i[r][0])*-i,f=n.i[r][1]+(a[1]-n.i[r][1])*-i,o.setTripleAt(l,u,c,d,p,f,r);return o},PuckerAndBloatModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amount.v;if(o!==0){var l,u;for(i=0;i<a;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,r=l.shape.paths._length,s=0;s<r;s+=1)u.addShape(this.processPath(e[s],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=function(){var n=[0,0];function e(u){var c=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||c,this.a&&u.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&u.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&u.skewFromAxis(-this.sk.v,this.sa.v),this.r?u.rotate(-this.r.v):u.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?u.translate(this.px.v,this.py.v,-this.pz.v):u.translate(this.px.v,this.py.v,0):u.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function i(u){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||u){var c;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var d,p;if(c=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(d=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/c,0),p=this.p.getValueAtTime(this.p.keyframes[0].t/c,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(d=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/c,0),p=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/c,0)):(d=this.p.pv,p=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/c,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){d=[],p=[];var f=this.px,m=this.py;f._caching.lastFrame+f.offsetTime<=f.keyframes[0].t?(d[0]=f.getValueAtTime((f.keyframes[0].t+.01)/c,0),d[1]=m.getValueAtTime((m.keyframes[0].t+.01)/c,0),p[0]=f.getValueAtTime(f.keyframes[0].t/c,0),p[1]=m.getValueAtTime(m.keyframes[0].t/c,0)):f._caching.lastFrame+f.offsetTime>=f.keyframes[f.keyframes.length-1].t?(d[0]=f.getValueAtTime(f.keyframes[f.keyframes.length-1].t/c,0),d[1]=m.getValueAtTime(m.keyframes[m.keyframes.length-1].t/c,0),p[0]=f.getValueAtTime((f.keyframes[f.keyframes.length-1].t-.01)/c,0),p[1]=m.getValueAtTime((m.keyframes[m.keyframes.length-1].t-.01)/c,0)):(d=[f.pv,m.pv],p[0]=f.getValueAtTime((f._caching.lastFrame+f.offsetTime-.01)/c,f.offsetTime),p[1]=m.getValueAtTime((m._caching.lastFrame+m.offsetTime-.01)/c,m.offsetTime))}else p=n,d=p;this.v.rotate(-Math.atan2(d[1]-p[1],d[0]-p[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function a(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function r(u){this._addDynamicProperty(u),this.elem.addDynamicProperty(u),this._isDirty=!0}function o(u,c,d){if(this.elem=u,this.frameId=-1,this.propType="transform",this.data=c,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(d||u),c.p&&c.p.s?(this.px=PropertyFactory.getProp(u,c.p.x,0,0,this),this.py=PropertyFactory.getProp(u,c.p.y,0,0,this),c.p.z&&(this.pz=PropertyFactory.getProp(u,c.p.z,0,0,this))):this.p=PropertyFactory.getProp(u,c.p||{k:[0,0,0]},1,0,this),c.rx){if(this.rx=PropertyFactory.getProp(u,c.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(u,c.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(u,c.rz,0,degToRads,this),c.or.k[0].ti){var p,f=c.or.k.length;for(p=0;p<f;p+=1)c.or.k[p].to=null,c.or.k[p].ti=null}this.or=PropertyFactory.getProp(u,c.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(u,c.r||{k:0},0,degToRads,this);c.sk&&(this.sk=PropertyFactory.getProp(u,c.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(u,c.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(u,c.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(u,c.s||{k:[100,100,100]},1,.01,this),c.o?this.o=PropertyFactory.getProp(u,c.o,0,.01,u):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}o.prototype={applyToMatrix:e,getValue:i,precalculateMatrix:a,autoOrient:s},extendPrototype([DynamicPropertyContainer],o),o.prototype.addDynamicProperty=r,o.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty;function l(u,c,d){return new o(u,c,d)}return{getTransformProperty:l}}();function RepeaterModifier(){}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(n,e.c,0,null,this),this.o=PropertyFactory.getProp(n,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(n,e.tr,this),this.so=PropertyFactory.getProp(n,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(n,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(n,e,i,a,s,r){var o=r?-1:1,l=a.s.v[0]+(1-a.s.v[0])*(1-s),u=a.s.v[1]+(1-a.s.v[1])*(1-s);n.translate(a.p.v[0]*o*s,a.p.v[1]*o*s,a.p.v[2]),e.translate(-a.a.v[0],-a.a.v[1],a.a.v[2]),e.rotate(-a.r.v*o*s),e.translate(a.a.v[0],a.a.v[1],a.a.v[2]),i.translate(-a.a.v[0],-a.a.v[1],a.a.v[2]),i.scale(r?1/l:l,r?1/u:u),i.translate(a.a.v[0],a.a.v[1],a.a.v[2])},RepeaterModifier.prototype.init=function(n,e,i,a){for(this.elem=n,this.arr=e,this.pos=i,this.elemsData=a,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(n),this.initModifierProperties(n,e[i]);i>0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e]._processed=!1,n[e].ty==="gr"&&this.resetElements(n[e].it)},RepeaterModifier.prototype.cloneElements=function(n){var e=JSON.parse(JSON.stringify(n));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)n[i]._render=e,n[i].ty==="gr"&&this.changeGroupRender(n[i].it,e)},RepeaterModifier.prototype.processShapes=function(n){var e,i,a,s,r,o=!1;if(this._mdf||n){var l=Math.ceil(this.c.v);if(this._groups.length<l){for(;this._groups.length<l;){var u={it:this.cloneElements(this._elements),ty:"gr"};u.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,u),this._groups.splice(0,0,u),this._currentCopies+=1}this.elem.reloadShapes(),o=!0}r=0;var c;for(a=0;a<=this._groups.length-1;a+=1){if(c=r<l,this._groups[a]._render=c,this.changeGroupRender(this._groups[a].it,c),!c){var d=this.elemsData[a].it,p=d[d.length-1];p.transform.op.v!==0?(p.transform.op._mdf=!0,p.transform.op.v=0):p.transform.op._mdf=!1}r+=1}this._currentCopies=l;var f=this.o.v,m=f%1,P=f>0?Math.floor(f):Math.ceil(f),T=this.pMatrix.props,x=this.rMatrix.props,y=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var S=0;if(f>0){for(;S<P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),S+=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,m,!1),S+=m)}else if(f<0){for(;S>P;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),S-=1;m&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-m,!0),S-=m)}a=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,r=this._currentCopies;for(var g,C;r;){if(e=this.elemsData[a].it,i=e[e.length-1].transform.mProps.v.props,C=i.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(a/(this._currentCopies-1)),S!==0){for((a!==0&&s===1||a!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]),this.matrix.transform(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11],y[12],y[13],y[14],y[15]),this.matrix.transform(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],T[8],T[9],T[10],T[11],T[12],T[13],T[14],T[15]),g=0;g<C;g+=1)i[g]=this.matrix.props[g];this.matrix.reset()}else for(this.matrix.reset(),g=0;g<C;g+=1)i[g]=this.matrix.props[g];S+=1,r-=1,a+=s}}else for(r=this._currentCopies,a=0,s=1;r;)e=this.elemsData[a].it,i=e[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,r-=1,a+=s;return o},RepeaterModifier.prototype.addShape=function(){};function RoundCornersModifier(){}extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(n,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(n,e){var i=shapePool.newElement();i.c=n.c;var a,s=n._length,r,o,l,u,c,d,p=0,f,m,P,T,x,y;for(a=0;a<s;a+=1)r=n.v[a],l=n.o[a],o=n.i[a],r[0]===l[0]&&r[1]===l[1]&&r[0]===o[0]&&r[1]===o[1]?(a===0||a===s-1)&&!n.c?(i.setTripleAt(r[0],r[1],l[0],l[1],o[0],o[1],p),p+=1):(a===0?u=n.v[s-1]:u=n.v[a-1],c=Math.sqrt(Math.pow(r[0]-u[0],2)+Math.pow(r[1]-u[1],2)),d=c?Math.min(c/2,e)/c:0,x=r[0]+(u[0]-r[0])*d,f=x,y=r[1]-(r[1]-u[1])*d,m=y,P=f-(f-r[0])*roundCorner,T=m-(m-r[1])*roundCorner,i.setTripleAt(f,m,P,T,x,y,p),p+=1,a===s-1?u=n.v[0]:u=n.v[a+1],c=Math.sqrt(Math.pow(r[0]-u[0],2)+Math.pow(r[1]-u[1],2)),d=c?Math.min(c/2,e)/c:0,P=r[0]+(u[0]-r[0])*d,f=P,T=r[1]+(u[1]-r[1])*d,m=T,x=f-(f-r[0])*roundCorner,y=m-(m-r[1])*roundCorner,i.setTripleAt(f,m,P,T,x,y,p),p+=1):(i.setTripleAt(n.v[a][0],n.v[a][1],n.o[a][0],n.o[a][1],n.i[a][0],n.i[a][1],p),p+=1);return i},RoundCornersModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.rd.v;if(o!==0){var l,u;for(i=0;i<a;i+=1){if(l=this.shapes[i],u=l.localShapeCollection,!(!l.shape._mdf&&!this._mdf&&!n))for(u.releaseShapes(),l.shape._mdf=!0,e=l.shape.paths.shapes,r=l.shape.paths._length,s=0;s<r;s+=1)u.addShape(this.processPath(e[s],o));l.shape.paths=l.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function floatEqual(n,e){return Math.abs(n-e)*1e5<=Math.min(Math.abs(n),Math.abs(e))}function floatZero(n){return Math.abs(n)<=1e-5}function lerp(n,e,i){return n*(1-i)+e*i}function lerpPoint(n,e,i){return[lerp(n[0],e[0],i),lerp(n[1],e[1],i)]}function quadRoots(n,e,i){if(n===0)return[];var a=e*e-4*n*i;if(a<0)return[];var s=-e/(2*n);if(a===0)return[s];var r=Math.sqrt(a)/(2*n);return[s-r,s+r]}function polynomialCoefficients(n,e,i,a){return[-n+3*e-3*i+a,3*n-6*e+3*i,-3*n+3*e,n]}function singlePoint(n){return new PolynomialBezier(n,n,n,n,!1)}function PolynomialBezier(n,e,i,a,s){s&&pointEqual(n,e)&&(e=lerpPoint(n,a,1/3)),s&&pointEqual(i,a)&&(i=lerpPoint(n,a,2/3));var r=polynomialCoefficients(n[0],e[0],i[0],a[0]),o=polynomialCoefficients(n[1],e[1],i[1],a[1]);this.a=[r[0],o[0]],this.b=[r[1],o[1]],this.c=[r[2],o[2]],this.d=[r[3],o[3]],this.points=[n,e,i,a]}PolynomialBezier.prototype.point=function(n){return[((this.a[0]*n+this.b[0])*n+this.c[0])*n+this.d[0],((this.a[1]*n+this.b[1])*n+this.c[1])*n+this.d[1]]},PolynomialBezier.prototype.derivative=function(n){return[(3*n*this.a[0]+2*this.b[0])*n+this.c[0],(3*n*this.a[1]+2*this.b[1])*n+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(n){var e=this.derivative(n);return Math.atan2(e[1],e[0])},PolynomialBezier.prototype.normalAngle=function(n){var e=this.derivative(n);return Math.atan2(e[0],e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var n=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(n))return[];var e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/n,i=e*e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/n;if(i<0)return[];var a=Math.sqrt(i);return floatZero(a)?a>0&&a<1?[e]:[]:[e-a,e+a].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(n){if(n<=0)return[singlePoint(this.points[0]),this];if(n>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],n),i=lerpPoint(this.points[1],this.points[2],n),a=lerpPoint(this.points[2],this.points[3],n),s=lerpPoint(e,i,n),r=lerpPoint(i,a,n),o=lerpPoint(s,r,n);return[new PolynomialBezier(this.points[0],e,s,o,!0),new PolynomialBezier(o,r,a,this.points[3],!0)]};function extrema(n,e){var i=n.points[0][e],a=n.points[n.points.length-1][e];if(i>a){var s=a;a=i,i=s}for(var r=quadRoots(3*n.a[e],2*n.b[e],n.c[e]),o=0;o<r.length;o+=1)if(r[o]>0&&r[o]<1){var l=n.point(r[o])[e];l<i?i=l:l>a&&(a=l)}return{min:i,max:a}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var n=this.bounds();return{left:n.x.min,right:n.x.max,top:n.y.min,bottom:n.y.max,width:n.x.max-n.x.min,height:n.y.max-n.y.min,cx:(n.x.max+n.x.min)/2,cy:(n.y.max+n.y.min)/2}};function intersectData(n,e,i){var a=n.boundingBox();return{cx:a.cx,cy:a.cy,width:a.width,height:a.height,bez:n,t:(e+i)/2,t1:e,t2:i}}function splitData(n){var e=n.bez.split(.5);return[intersectData(e[0],n.t1,n.t),intersectData(e[1],n.t,n.t2)]}function boxIntersect(n,e){return Math.abs(n.cx-e.cx)*2<n.width+e.width&&Math.abs(n.cy-e.cy)*2<n.height+e.height}function intersectsImpl(n,e,i,a,s,r){if(boxIntersect(n,e)){if(i>=r||n.width<=a&&n.height<=a&&e.width<=a&&e.height<=a){s.push([n.t,e.t]);return}var o=splitData(n),l=splitData(e);intersectsImpl(o[0],l[0],i+1,a,s,r),intersectsImpl(o[0],l[1],i+1,a,s,r),intersectsImpl(o[1],l[0],i+1,a,s,r),intersectsImpl(o[1],l[1],i+1,a,s,r)}}PolynomialBezier.prototype.intersections=function(n,e,i){e===void 0&&(e=2),i===void 0&&(i=7);var a=[];return intersectsImpl(intersectData(this,0,1),intersectData(n,0,1),0,e,a,i),a},PolynomialBezier.shapeSegment=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[e],n.o[e],n.i[i],n.v[i],!0)},PolynomialBezier.shapeSegmentInverted=function(n,e){var i=(e+1)%n.length();return new PolynomialBezier(n.v[i],n.i[i],n.o[e],n.v[e],!0)};function crossProduct(n,e){return[n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]]}function lineIntersection(n,e,i,a){var s=[n[0],n[1],1],r=[e[0],e[1],1],o=[i[0],i[1],1],l=[a[0],a[1],1],u=crossProduct(crossProduct(s,r),crossProduct(o,l));return floatZero(u[2])?null:[u[0]/u[2],u[1]/u[2]]}function polarOffset(n,e,i){return[n[0]+Math.cos(e)*i,n[1]-Math.sin(e)*i]}function pointDistance(n,e){return Math.hypot(n[0]-e[0],n[1]-e[1])}function pointEqual(n,e){return floatEqual(n[0],e[0])&&floatEqual(n[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(n,e.s,0,null,this),this.frequency=PropertyFactory.getProp(n,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(n,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(n,e,i,a,s,r,o){var l=i-Math.PI/2,u=i+Math.PI/2,c=e[0]+Math.cos(i)*a*s,d=e[1]-Math.sin(i)*a*s;n.setTripleAt(c,d,c+Math.cos(l)*r,d-Math.sin(l)*r,c+Math.cos(u)*o,d-Math.sin(u)*o,n.length())}function getPerpendicularVector(n,e){var i=[e[0]-n[0],e[1]-n[1]],a=-Math.PI*.5,s=[Math.cos(a)*i[0]-Math.sin(a)*i[1],Math.sin(a)*i[0]+Math.cos(a)*i[1]];return s}function getProjectingAngle(n,e){var i=e===0?n.length()-1:e-1,a=(e+1)%n.length(),s=n.v[i],r=n.v[a],o=getPerpendicularVector(s,r);return Math.atan2(0,1)-Math.atan2(o[1],o[0])}function zigZagCorner(n,e,i,a,s,r,o){var l=getProjectingAngle(e,i),u=e.v[i%e._length],c=e.v[i===0?e._length-1:i-1],d=e.v[(i+1)%e._length],p=r===2?Math.sqrt(Math.pow(u[0]-c[0],2)+Math.pow(u[1]-c[1],2)):0,f=r===2?Math.sqrt(Math.pow(u[0]-d[0],2)+Math.pow(u[1]-d[1],2)):0;setPoint(n,e.v[i%e._length],l,o,a,f/((s+1)*2),p/((s+1)*2))}function zigZagSegment(n,e,i,a,s,r){for(var o=0;o<a;o+=1){var l=(o+1)/(a+1),u=s===2?Math.sqrt(Math.pow(e.points[3][0]-e.points[0][0],2)+Math.pow(e.points[3][1]-e.points[0][1],2)):0,c=e.normalAngle(l),d=e.point(l);setPoint(n,d,c,r,i,u/((a+1)*2),u/((a+1)*2)),r=-r}return r}ZigZagModifier.prototype.processPath=function(n,e,i,a){var s=n._length,r=shapePool.newElement();if(r.c=n.c,n.c||(s-=1),s===0)return r;var o=-1,l=PolynomialBezier.shapeSegment(n,0);zigZagCorner(r,n,0,e,i,a,o);for(var u=0;u<s;u+=1)o=zigZagSegment(r,l,e,i,a,-o),u===s-1&&!n.c?l=null:l=PolynomialBezier.shapeSegment(n,(u+1)%s),zigZagCorner(r,n,u+1,e,i,a,o);return r},ZigZagModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amplitude.v,l=Math.max(0,Math.round(this.frequency.v)),u=this.pointsType.v;if(o!==0){var c,d;for(i=0;i<a;i+=1){if(c=this.shapes[i],d=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(d.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,r=c.shape.paths._length,s=0;s<r;s+=1)d.addShape(this.processPath(e[s],o,l,u));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function linearOffset(n,e,i){var a=Math.atan2(e[0]-n[0],e[1]-n[1]);return[polarOffset(n,a,i),polarOffset(e,a,i)]}function offsetSegment(n,e){var i,a,s,r,o,l,u;u=linearOffset(n.points[0],n.points[1],e),i=u[0],a=u[1],u=linearOffset(n.points[1],n.points[2],e),s=u[0],r=u[1],u=linearOffset(n.points[2],n.points[3],e),o=u[0],l=u[1];var c=lineIntersection(i,a,s,r);c===null&&(c=a);var d=lineIntersection(o,l,s,r);return d===null&&(d=o),new PolynomialBezier(i,c,d,l)}function joinLines(n,e,i,a,s){var r=e.points[3],o=i.points[0];if(a===3||pointEqual(r,o))return r;if(a===2){var l=-e.tangentAngle(1),u=-i.tangentAngle(0)+Math.PI,c=lineIntersection(r,polarOffset(r,l+Math.PI/2,100),o,polarOffset(o,l+Math.PI/2,100)),d=c?pointDistance(c,r):pointDistance(r,o)/2,p=polarOffset(r,l,2*d*roundCorner);return n.setXYAt(p[0],p[1],"o",n.length()-1),p=polarOffset(o,u,2*d*roundCorner),n.setTripleAt(o[0],o[1],o[0],o[1],p[0],p[1],n.length()),o}var f=pointEqual(r,e.points[2])?e.points[0]:e.points[2],m=pointEqual(o,i.points[1])?i.points[3]:i.points[1],P=lineIntersection(f,r,o,m);return P&&pointDistance(P,r)<s?(n.setTripleAt(P[0],P[1],P[0],P[1],P[0],P[1],n.length()),P):r}function getIntersection(n,e){var i=n.intersections(e);return i.length&&floatEqual(i[0][0],1)&&i.shift(),i.length?i[0]:null}function pruneSegmentIntersection(n,e){var i=n.slice(),a=e.slice(),s=getIntersection(n[n.length-1],e[0]);return s&&(i[n.length-1]=n[n.length-1].split(s[0])[0],a[0]=e[0].split(s[1])[1]),n.length>1&&e.length>1&&(s=getIntersection(n[0],e[e.length-1]),s)?[[n[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[i,a]}function pruneIntersections(n){for(var e,i=1;i<n.length;i+=1)e=pruneSegmentIntersection(n[i-1],n[i]),n[i-1]=e[0],n[i]=e[1];return n.length>1&&(e=pruneSegmentIntersection(n[n.length-1],n[0]),n[n.length-1]=e[0],n[0]=e[1]),n}function offsetSegmentSplit(n,e){var i=n.inflectionPoints(),a,s,r,o;if(i.length===0)return[offsetSegment(n,e)];if(i.length===1||floatEqual(i[1],1))return r=n.split(i[0]),a=r[0],s=r[1],[offsetSegment(a,e),offsetSegment(s,e)];r=n.split(i[0]),a=r[0];var l=(i[1]-i[0])/(1-i[0]);return r=r[1].split(l),o=r[0],s=r[1],[offsetSegment(a,e),offsetSegment(o,e),offsetSegment(s,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(n,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(n,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(n,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(n,e,i,a){var s=shapePool.newElement();s.c=n.c;var r=n.length();n.c||(r-=1);var o,l,u,c=[];for(o=0;o<r;o+=1)u=PolynomialBezier.shapeSegment(n,o),c.push(offsetSegmentSplit(u,e));if(!n.c)for(o=r-1;o>=0;o-=1)u=PolynomialBezier.shapeSegmentInverted(n,o),c.push(offsetSegmentSplit(u,e));c=pruneIntersections(c);var d=null,p=null;for(o=0;o<c.length;o+=1){var f=c[o];for(p&&(d=joinLines(s,p,f[0],i,a)),p=f[f.length-1],l=0;l<f.length;l+=1)u=f[l],d&&pointEqual(u.points[0],d)?s.setXYAt(u.points[1][0],u.points[1][1],"o",s.length()-1):s.setTripleAt(u.points[0][0],u.points[0][1],u.points[1][0],u.points[1][1],u.points[0][0],u.points[0][1],s.length()),s.setTripleAt(u.points[3][0],u.points[3][1],u.points[3][0],u.points[3][1],u.points[2][0],u.points[2][1],s.length()),d=u.points[3]}return c.length&&joinLines(s,p,c[0][0],i,a),s},OffsetPathModifier.prototype.processShapes=function(n){var e,i,a=this.shapes.length,s,r,o=this.amount.v,l=this.miterLimit.v,u=this.lineJoin;if(o!==0){var c,d;for(i=0;i<a;i+=1){if(c=this.shapes[i],d=c.localShapeCollection,!(!c.shape._mdf&&!this._mdf&&!n))for(d.releaseShapes(),c.shape._mdf=!0,e=c.shape.paths.shapes,r=c.shape.paths._length,s=0;s<r;s+=1)d.addShape(this.processPath(e[s],o,u,l));c.shape.paths=c.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function getFontProperties(n){for(var e=n.fStyle?n.fStyle.split(" "):[],i="normal",a="normal",s=e.length,r,o=0;o<s;o+=1)switch(r=e[o].toLowerCase(),r){case"italic":a="italic";break;case"bold":i="700";break;case"black":i="900";break;case"medium":i="500";break;case"regular":case"normal":i="400";break;case"light":case"thin":i="200";break}return{style:a,weight:n.fWeight||i}}var FontManager=function(){var n=5e3,e={w:0,size:0,shapes:[],data:{shapes:[]}},i=[];i=i.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var a=127988,s=917631,r=917601,o=917626,l=65039,u=8205,c=127462,d=127487,p=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function f(b){var I=b.split(","),V,A=I.length,k=[];for(V=0;V<A;V+=1)I[V]!=="sans-serif"&&I[V]!=="monospace"&&k.push(I[V]);return k.join(",")}function m(b,I){var V=createTag("span");V.setAttribute("aria-hidden",!0),V.style.fontFamily=I;var A=createTag("span");A.innerText="giItT1WQy@!-/#",V.style.position="absolute",V.style.left="-10000px",V.style.top="-10000px",V.style.fontSize="300px",V.style.fontVariant="normal",V.style.fontStyle="normal",V.style.fontWeight="normal",V.style.letterSpacing="0",V.appendChild(A),document.body.appendChild(V);var k=A.offsetWidth;return A.style.fontFamily=f(b)+", "+I,{node:A,w:k,parent:V}}function P(){var b,I=this.fonts.length,V,A,k=I;for(b=0;b<I;b+=1)this.fonts[b].loaded?k-=1:this.fonts[b].fOrigin==="n"||this.fonts[b].origin===0?this.fonts[b].loaded=!0:(V=this.fonts[b].monoCase.node,A=this.fonts[b].monoCase.w,V.offsetWidth!==A?(k-=1,this.fonts[b].loaded=!0):(V=this.fonts[b].sansCase.node,A=this.fonts[b].sansCase.w,V.offsetWidth!==A&&(k-=1,this.fonts[b].loaded=!0)),this.fonts[b].loaded&&(this.fonts[b].sansCase.parent.parentNode.removeChild(this.fonts[b].sansCase.parent),this.fonts[b].monoCase.parent.parentNode.removeChild(this.fonts[b].monoCase.parent)));k!==0&&Date.now()-this.initTime<n?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function T(b,I){var V=document.body&&I?"svg":"canvas",A,k=getFontProperties(b);if(V==="svg"){var R=createNS("text");R.style.fontSize="100px",R.setAttribute("font-family",b.fFamily),R.setAttribute("font-style",k.style),R.setAttribute("font-weight",k.weight),R.textContent="1",b.fClass?(R.style.fontFamily="inherit",R.setAttribute("class",b.fClass)):R.style.fontFamily=b.fFamily,I.appendChild(R),A=R}else{var G=new OffscreenCanvas(500,500).getContext("2d");G.font=k.style+" "+k.weight+" 100px "+b.fFamily,A=G}function z(q){return V==="svg"?(A.textContent=q,A.getComputedTextLength()):A.measureText(q).width}return{measureText:z}}function x(b,I){if(!b){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=b.list;return}if(!document.body){this.isLoaded=!0,b.list.forEach(function(ne){ne.helper=T(ne),ne.cache={}}),this.fonts=b.list;return}var V=b.list,A,k=V.length,R=k;for(A=0;A<k;A+=1){var G=!0,z,q;if(V[A].loaded=!1,V[A].monoCase=m(V[A].fFamily,"monospace"),V[A].sansCase=m(V[A].fFamily,"sans-serif"),!V[A].fPath)V[A].loaded=!0,R-=1;else if(V[A].fOrigin==="p"||V[A].origin===3){if(z=document.querySelectorAll('style[f-forigin="p"][f-family="'+V[A].fFamily+'"], style[f-origin="3"][f-family="'+V[A].fFamily+'"]'),z.length>0&&(G=!1),G){var U=createTag("style");U.setAttribute("f-forigin",V[A].fOrigin),U.setAttribute("f-origin",V[A].origin),U.setAttribute("f-family",V[A].fFamily),U.type="text/css",U.innerText="@font-face {font-family: "+V[A].fFamily+"; font-style: normal; src: url('"+V[A].fPath+"');}",I.appendChild(U)}}else if(V[A].fOrigin==="g"||V[A].origin===1){for(z=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),q=0;q<z.length;q+=1)z[q].href.indexOf(V[A].fPath)!==-1&&(G=!1);if(G){var K=createTag("link");K.setAttribute("f-forigin",V[A].fOrigin),K.setAttribute("f-origin",V[A].origin),K.type="text/css",K.rel="stylesheet",K.href=V[A].fPath,document.body.appendChild(K)}}else if(V[A].fOrigin==="t"||V[A].origin===2){for(z=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),q=0;q<z.length;q+=1)V[A].fPath===z[q].src&&(G=!1);if(G){var Q=createTag("link");Q.setAttribute("f-forigin",V[A].fOrigin),Q.setAttribute("f-origin",V[A].origin),Q.setAttribute("rel","stylesheet"),Q.setAttribute("href",V[A].fPath),I.appendChild(Q)}}V[A].helper=T(V[A],I),V[A].cache={},this.fonts.push(V[A])}R===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function y(b){if(b){this.chars||(this.chars=[]);var I,V=b.length,A,k=this.chars.length,R;for(I=0;I<V;I+=1){for(A=0,R=!1;A<k;)this.chars[A].style===b[I].style&&this.chars[A].fFamily===b[I].fFamily&&this.chars[A].ch===b[I].ch&&(R=!0),A+=1;R||(this.chars.push(b[I]),k+=1)}}}function S(b,I,V){for(var A=0,k=this.chars.length;A<k;){if(this.chars[A].ch===b&&this.chars[A].style===I&&this.chars[A].fFamily===V)return this.chars[A];A+=1}return(typeof b=="string"&&b.charCodeAt(0)!==13||!b)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",b,I,V)),e}function g(b,I,V){var A=this.getFontByName(I),k=b;if(!A.cache[k]){var R=A.helper;if(b===" "){var G=R.measureText("|"+b+"|"),z=R.measureText("||");A.cache[k]=(G-z)/100}else A.cache[k]=R.measureText(b)/100}return A.cache[k]*V}function C(b){for(var I=0,V=this.fonts.length;I<V;){if(this.fonts[I].fName===b)return this.fonts[I];I+=1}return this.fonts[0]}function E(b){var I=0,V=b.charCodeAt(0);if(V>=55296&&V<=56319){var A=b.charCodeAt(1);A>=56320&&A<=57343&&(I=(V-55296)*1024+A-56320+65536)}return I}function B(b,I){var V=b.toString(16)+I.toString(16);return p.indexOf(V)!==-1}function _(b){return b===u}function M(b){return b===l}function D(b){var I=E(b);return I>=c&&I<=d}function L(b){return D(b.substr(0,2))&&D(b.substr(2,2))}function N(b){return i.indexOf(b)!==-1}function F(b,I){var V=E(b.substr(I,2));if(V!==a)return!1;var A=0;for(I+=2;A<5;){if(V=E(b.substr(I,2)),V<r||V>o)return!1;A+=1,I+=2}return E(b.substr(I,2))===s}function H(){this.isLoaded=!0}var $=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};$.isModifier=B,$.isZeroWidthJoiner=_,$.isFlagEmoji=L,$.isRegionalCode=D,$.isCombinedCharacter=N,$.isRegionalFlag=F,$.isVariationSelector=M,$.BLACK_FLAG_CODE_POINT=a;var O={addChars:y,addFonts:x,getCharData:S,getFontByName:C,measureText:g,checkLoadedFonts:P,setIsLoaded:H};return $.prototype=O,$}();function SlotManager(n){this.animationData=n}SlotManager.prototype.getProp=function(n){return this.animationData.slots&&this.animationData.slots[n.sid]?Object.assign(n,this.animationData.slots[n.sid].p):n};function slotFactory(n){return new SlotManager(n)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,i=this.renderableComponents.length;for(e=0;e<i;e+=1)this.renderableComponents[e].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=function(){var n={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(e){return n[e]||""}}();function SliderEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function AngleEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function ColorEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function PointEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,1,0,i)}function LayerIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function MaskIndexEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function CheckboxEffect(n,e,i){this.p=PropertyFactory.getProp(e,n.v,0,0,i)}function NoValueEffect(){this.p={}}function EffectsManager(n,e){var i=n.ef||[];this.effectElements=[];var a,s=i.length,r;for(a=0;a<s;a+=1)r=new GroupEffect(i[a],e),this.effectElements.push(r)}function GroupEffect(n,e){this.init(n,e)}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(n,e){this.data=n,this.effectElements=[],this.initDynamicPropertyContainer(e);var i,a=this.data.ef.length,s,r=this.data.ef;for(i=0;i<a;i+=1){switch(s=null,r[i].ty){case 0:s=new SliderEffect(r[i],e,this);break;case 1:s=new AngleEffect(r[i],e,this);break;case 2:s=new ColorEffect(r[i],e,this);break;case 3:s=new PointEffect(r[i],e,this);break;case 4:case 7:s=new CheckboxEffect(r[i],e,this);break;case 10:s=new LayerIndexEffect(r[i],e,this);break;case 11:s=new MaskIndexEffect(r[i],e,this);break;case 5:s=new EffectsManager(r[i],e);break;default:s=new NoValueEffect(r[i]);break}s&&this.effectElements.push(s)}};function BaseElement(){}BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var e=0,i=this.data.masksProperties.length;e<i;){if(this.data.masksProperties[e].mode!=="n"&&this.data.masksProperties[e].cl!==!1)return!0;e+=1}return!1},initExpressions:function(){var e=getExpressionInterfaces();if(e){var i=e("layer"),a=e("effects"),s=e("shape"),r=e("text"),o=e("comp");this.layerInterface=i(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var l=a.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(l),this.data.ty===0||this.data.xt?this.compInterface=o(this):this.data.ty===4?(this.layerInterface.shapeInterface=s(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):this.data.ty===5&&(this.layerInterface.textInterface=r(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var e=getBlendMode(this.data.bm),i=this.baseElement||this.layerElement;i.style["mix-blend-mode"]=e},initBaseData:function(e,i,a){this.globalData=i,this.comp=a,this.data=e,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function FrameElement(){}FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(e,i){var a,s=this.dynamicProperties.length;for(a=0;a<s;a+=1)(i||this._isParent&&this.dynamicProperties[a].propType==="transform")&&(this.dynamicProperties[a].getValue(),this.dynamicProperties[a]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(e){this.dynamicProperties.indexOf(e)===-1&&this.dynamicProperties.push(e)}};function FootageElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.footageData=e.imageLoader.getAsset(this.assetData),this.initBaseData(n,e,i)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var n=getExpressionInterfaces();if(n){var e=n("footage");this.layerInterface=e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData};function AudioElement(n,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(n.refId),this.initBaseData(n,e,i),this._isPlaying=!1,this._canPlay=!1;var a=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(a),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,n.au&&n.au.lv?n.au.lv:{k:[100]},1,.01,this)}AudioElement.prototype.prepareFrame=function(n){if(this.prepareRenderableFrame(n,!0),this.prepareProperties(n,!0),this.tm._placeholder)this._currentTime=n/this.data.sr;else{var e=this.tm.v;this._currentTime=e}this._volume=this.lv.v[0];var i=this._volume*this._volumeMultiplier;this._previousVolume!==i&&(this._previousVolume=i,this.audio.volume(i))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(n){this.audio.rate(n)},AudioElement.prototype.volume=function(n){this._volumeMultiplier=n,this._previousVolume=n*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(n){var e,i=this.layers.length,a;for(this.completeLayers=!0,e=i-1;e>=0;e-=1)this.elements[e]||(a=this.layers[e],a.ip-a.st<=n-this.layers[e].st&&a.op-a.st>n-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(n){switch(n.ty){case 2:return this.createImage(n);case 0:return this.createComp(n);case 1:return this.createSolid(n);case 3:return this.createNull(n);case 4:return this.createShape(n);case 5:return this.createText(n);case 6:return this.createAudio(n);case 13:return this.createCamera(n);case 15:return this.createFootage(n);default:return this.createNull(n)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(n){return new AudioElement(n,this.globalData,this)},BaseRenderer.prototype.createFootage=function(n){return new FootageElement(n,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.buildItem(n);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(n){this.completeLayers=!1;var e,i=n.length,a,s=this.layers.length;for(e=0;e<i;e+=1)for(a=0;a<s;){if(this.layers[a].id===n[e].id){this.layers[a]=n[e];break}a+=1}},BaseRenderer.prototype.setProjectInterface=function(n){this.globalData.projectInterface=n},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(n,e,i){for(var a=this.elements,s=this.layers,r=0,o=s.length;r<o;)s[r].ind==e&&(!a[r]||a[r]===!0?(this.buildItem(r),this.addPendingElement(n)):(i.push(a[r]),a[r].setAsParent(),s[r].parent!==void 0?this.buildElementParenting(n,s[r].parent,i):n.setHierarchy(i))),r+=1},BaseRenderer.prototype.addPendingElement=function(n){this.pendingElements.push(n)},BaseRenderer.prototype.searchExtraCompositions=function(n){var e,i=n.length;for(e=0;e<i;e+=1)if(n[e].xt){var a=this.createComp(n[e]);a.initExpressions(),this.globalData.projectInterface.registerComposition(a)}},BaseRenderer.prototype.getElementById=function(n){var e,i=this.elements.length;for(e=0;e<i;e+=1)if(this.elements[e].data.ind===n)return this.elements[e];return null},BaseRenderer.prototype.getElementByPath=function(n){var e=n.shift(),i;if(typeof e=="number")i=this.elements[e];else{var a,s=this.elements.length;for(a=0;a<s;a+=1)if(this.elements[a].data.nm===e){i=this.elements[a];break}}return n.length===0?i:i.getElementByPath(n)},BaseRenderer.prototype.setupGlobalData=function(n,e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(n),this.globalData.fontManager.addChars(n.chars),this.globalData.fontManager.addFonts(n.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=n.fr,this.globalData.nm=n.nm,this.globalData.compSize={w:n.w,h:n.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}TransformElement.prototype={initTransform:function(){var e=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:e,localMat:e,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var e,i=this.finalTransform.mat,a=0,s=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;a<s;){if(this.hierarchy[a].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}a+=1}if(this.finalTransform._matMdf)for(e=this.finalTransform.mProp.v.props,i.cloneFromProps(e),a=0;a<s;a+=1)i.multiply(this.hierarchy[a].finalTransform.mProp.v)}(!this.localTransforms||this.finalTransform._matMdf)&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var e=0,i=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;e<i;)this.localTransforms[e]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[e]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),e+=1;if(this.finalTransform._localMatMdf){var a=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(a),e=1;e<i;e+=1){var s=this.localTransforms[e].matrix;a.multiply(s)}a.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var r=this.finalTransform.localOpacity;for(e=0;e<i;e+=1)r*=this.localTransforms[e].opacity*.01;this.finalTransform.localOpacity=r}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var e=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(e.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var i=0,a=e.length;for(i=0;i<a;i+=1)this.localTransforms.push(e[i])}}},globalToLocal:function(e){var i=[];i.push(this.finalTransform);for(var a=!0,s=this.comp;a;)s.finalTransform?(s.data.hasMask&&i.splice(0,0,s.finalTransform),s=s.comp):a=!1;var r,o=i.length,l;for(r=0;r<o;r+=1)l=i[r].mat.applyToPointArray(0,0,0),e=[e[0]-l[0],e[1]-l[1],0];return e},mHelper:new Matrix};function MaskElement(n,e,i){this.data=n,this.element=e,this.globalData=i,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var a=this.globalData.defs,s,r=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(r),this.solidPath="";var o,l=this.masksProperties,u=0,c=[],d,p,f=createElementID(),m,P,T,x,y="clipPath",S="clip-path";for(s=0;s<r;s+=1)if((l[s].mode!=="a"&&l[s].mode!=="n"||l[s].inv||l[s].o.k!==100||l[s].o.x)&&(y="mask",S="mask"),(l[s].mode==="s"||l[s].mode==="i")&&u===0?(m=createNS("rect"),m.setAttribute("fill","#ffffff"),m.setAttribute("width",this.element.comp.data.w||0),m.setAttribute("height",this.element.comp.data.h||0),c.push(m)):m=null,o=createNS("path"),l[s].mode==="n")this.viewData[s]={op:PropertyFactory.getProp(this.element,l[s].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[s],3),elem:o,lastPath:""},a.appendChild(o);else{u+=1,o.setAttribute("fill",l[s].mode==="s"?"#000000":"#ffffff"),o.setAttribute("clip-rule","nonzero");var g;if(l[s].x.k!==0?(y="mask",S="mask",x=PropertyFactory.getProp(this.element,l[s].x,0,null,this.element),g=createElementID(),P=createNS("filter"),P.setAttribute("id",g),T=createNS("feMorphology"),T.setAttribute("operator","erode"),T.setAttribute("in","SourceGraphic"),T.setAttribute("radius","0"),P.appendChild(T),a.appendChild(P),o.setAttribute("stroke",l[s].mode==="s"?"#000000":"#ffffff")):(T=null,x=null),this.storedData[s]={elem:o,x,expan:T,lastPath:"",lastOperator:"",filterId:g,lastRadius:0},l[s].mode==="i"){p=c.length;var C=createNS("g");for(d=0;d<p;d+=1)C.appendChild(c[d]);var E=createNS("mask");E.setAttribute("mask-type","alpha"),E.setAttribute("id",f+"_"+u),E.appendChild(o),a.appendChild(E),C.setAttribute("mask","url("+getLocationHref()+"#"+f+"_"+u+")"),c.length=0,c.push(C)}else c.push(o);l[s].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[s]={elem:o,lastPath:"",op:PropertyFactory.getProp(this.element,l[s].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,l[s],3),invRect:m},this.viewData[s].prop.k||this.drawPath(l[s],this.viewData[s].prop.v,this.viewData[s])}for(this.maskElement=createNS(y),r=c.length,s=0;s<r;s+=1)this.maskElement.appendChild(c[s]);u>0&&(this.maskElement.setAttribute("id",f),this.element.maskedElement.setAttribute(S,"url("+getLocationHref()+"#"+f+")"),a.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(n){return this.viewData[n].prop},MaskElement.prototype.renderFrame=function(n){var e=this.element.finalTransform.mat,i,a=this.masksProperties.length;for(i=0;i<a;i+=1)if((this.viewData[i].prop._mdf||n)&&this.drawPath(this.masksProperties[i],this.viewData[i].prop.v,this.viewData[i]),(this.viewData[i].op._mdf||n)&&this.viewData[i].elem.setAttribute("fill-opacity",this.viewData[i].op.v),this.masksProperties[i].mode!=="n"&&(this.viewData[i].invRect&&(this.element.finalTransform.mProp._mdf||n)&&this.viewData[i].invRect.setAttribute("transform",e.getInverseMatrix().to2dCSS()),this.storedData[i].x&&(this.storedData[i].x._mdf||n))){var s=this.storedData[i].expan;this.storedData[i].x.v<0?(this.storedData[i].lastOperator!=="erode"&&(this.storedData[i].lastOperator="erode",this.storedData[i].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[i].filterId+")")),s.setAttribute("radius",-this.storedData[i].x.v)):(this.storedData[i].lastOperator!=="dilate"&&(this.storedData[i].lastOperator="dilate",this.storedData[i].elem.setAttribute("filter",null)),this.storedData[i].elem.setAttribute("stroke-width",this.storedData[i].x.v*2))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var n="M0,0 ";return n+=" h"+this.globalData.compSize.w,n+=" v"+this.globalData.compSize.h,n+=" h-"+this.globalData.compSize.w,n+=" v-"+this.globalData.compSize.h+" ",n},MaskElement.prototype.drawPath=function(n,e,i){var a=" M"+e.v[0][0]+","+e.v[0][1],s,r;for(r=e._length,s=1;s<r;s+=1)a+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[s][0]+","+e.i[s][1]+" "+e.v[s][0]+","+e.v[s][1];if(e.c&&r>1&&(a+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),i.lastPath!==a){var o="";i.elem&&(e.c&&(o=n.inv?this.solidPath+a:a),i.elem.setAttribute("d",o)),i.lastPath=a}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var n={};n.createFilter=e,n.createAlphaToLuminanceFilter=i;function e(a,s){var r=createNS("filter");return r.setAttribute("id",a),s!==!0&&(r.setAttribute("filterUnits","objectBoundingBox"),r.setAttribute("x","0%"),r.setAttribute("y","0%"),r.setAttribute("width","100%"),r.setAttribute("height","100%")),r}function i(){var a=createNS("feColorMatrix");return a.setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),a}return n}(),featureSupport=function(){var n={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(n.maskType=!1),/firefox/i.test(navigator.userAgent)&&(n.svgLumaHidden=!1),n}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(n){var e,i="SourceGraphic",a=n.data.ef?n.data.ef.length:0,s=createElementID(),r=filtersFactory.createFilter(s,!0),o=0;this.filters=[];var l;for(e=0;e<a;e+=1){l=null;var u=n.data.ef[e].ty;if(registeredEffects$1[u]){var c=registeredEffects$1[u].effect;l=new c(r,n.effectsManager.effectElements[e],n,idPrefix+o,i),i=idPrefix+o,registeredEffects$1[u].countsAsEffect&&(o+=1)}l&&this.filters.push(l)}o&&(n.globalData.defs.appendChild(r),n.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+s+")")),this.filters.length&&n.addRenderableComponent(this)}SVGEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},SVGEffects.prototype.getEffects=function(n){var e,i=this.filters.length,a=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&a.push(this.filters[e]);return a};function registerEffect$1(n,e,i){registeredEffects$1[n]={effect:e,countsAsEffect:i}}function SVGBaseElement(){}SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var e=null;if(this.data.td){this.matteMasks={};var i=createNS("g");i.setAttribute("id",this.layerId),i.appendChild(this.layerElement),e=i,this.globalData.defs.appendChild(i)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),e=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var a=createNS("clipPath"),s=createNS("path");s.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var r=createElementID();if(a.setAttribute("id",r),a.appendChild(s),this.globalData.defs.appendChild(a),this.checkMasks()){var o=createNS("g");o.setAttribute("clip-path","url("+getLocationHref()+"#"+r+")"),o.appendChild(this.layerElement),this.transformedElement=o,e?e.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+r+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(e){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[e]){var i=this.layerId+"_"+e,a,s,r,o;if(e===1||e===3){var l=createNS("mask");l.setAttribute("id",i),l.setAttribute("mask-type",e===3?"luminance":"alpha"),r=createNS("use"),r.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),l.appendChild(r),this.globalData.defs.appendChild(l),!featureSupport.maskType&&e===1&&(l.setAttribute("mask-type","luminance"),a=createElementID(),s=filtersFactory.createFilter(a),this.globalData.defs.appendChild(s),s.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),o.appendChild(r),l.appendChild(o),o.setAttribute("filter","url("+getLocationHref()+"#"+a+")"))}else if(e===2){var u=createNS("mask");u.setAttribute("id",i),u.setAttribute("mask-type","alpha");var c=createNS("g");u.appendChild(c),a=createElementID(),s=filtersFactory.createFilter(a);var d=createNS("feComponentTransfer");d.setAttribute("in","SourceGraphic"),s.appendChild(d);var p=createNS("feFuncA");p.setAttribute("type","table"),p.setAttribute("tableValues","1.0 0.0"),d.appendChild(p),this.globalData.defs.appendChild(s);var f=createNS("rect");f.setAttribute("width",this.comp.data.w),f.setAttribute("height",this.comp.data.h),f.setAttribute("x","0"),f.setAttribute("y","0"),f.setAttribute("fill","#ffffff"),f.setAttribute("opacity","0"),c.setAttribute("filter","url("+getLocationHref()+"#"+a+")"),c.appendChild(f),r=createNS("use"),r.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),c.appendChild(r),featureSupport.maskType||(u.setAttribute("mask-type","luminance"),s.appendChild(filtersFactory.createAlphaToLuminanceFilter()),o=createNS("g"),c.appendChild(f),o.appendChild(this.layerElement),c.appendChild(o)),this.globalData.defs.appendChild(u)}this.matteMasks[e]=i}return this.matteMasks[e]},setMatte:function(e){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+e+")")}};function HierarchyElement(){}HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(e){this.hierarchy=e},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function RenderableDOMElement(){}(function(){var n={initElement:function(i,a,s){this.initFrame(),this.initBaseData(i,a,s),this.initTransform(i,a,s),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var i=this.baseElement||this.layerElement;i.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var i=this.baseElement||this.layerElement;i.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(i){this._mdf=!1,this.prepareRenderableFrame(i),this.prepareProperties(i,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};extendPrototype([RenderableElement,createProxyFunction(n)],RenderableDOMElement)})();function IImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.assetData&&this.assetData.sid&&(this.assetData=e.slotManager.getProp(this.assetData)),this.initElement(n,e,i),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect};function ProcessedElement(n,e){this.elem=n,this.pos=e}function IShapeElement(){}IShapeElement.prototype={addShapeToModifiers:function(e){var i,a=this.shapeModifiers.length;for(i=0;i<a;i+=1)this.shapeModifiers[i].addShape(e)},isShapeInAnimatedModifiers:function(e){for(var i=0,a=this.shapeModifiers.length;i<a;)if(this.shapeModifiers[i].isAnimatedWithShape(e))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var e,i=this.shapes.length;for(e=0;e<i;e+=1)this.shapes[e].sh.reset();i=this.shapeModifiers.length;var a;for(e=i-1;e>=0&&(a=this.shapeModifiers[e].processShapes(this._isFirstFrame),!a);e-=1);}},searchProcessedElement:function(e){for(var i=this.processedElements,a=0,s=i.length;a<s;){if(i[a].elem===e)return i[a].pos;a+=1}return 0},addProcessedElement:function(e,i){for(var a=this.processedElements,s=a.length;s;)if(s-=1,a[s].elem===e){a[s].pos=i;return}a.push(new ProcessedElement(e,i))},prepareFrame:function(e){this.prepareRenderableFrame(e),this.prepareProperties(e,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(n,e,i){this.caches=[],this.styles=[],this.transformers=n,this.lStr="",this.sh=i,this.lvl=e,this._isAnimated=!!i.k;for(var a=0,s=n.length;a<s;){if(n[a].mProps.dynamicProperties.length){this._isAnimated=!0;break}a+=1}}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0};function SVGStyleData(n,e){this.data=n,this.type=n.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=n.hd===!0,this.pElem=createNS("path"),this.msElem=null}SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1};function DashProperty(n,e,i,a){this.elem=n,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=i,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(a);var s,r=e.length||0,o;for(s=0;s<r;s+=1)o=PropertyFactory.getProp(n,e[s].v,0,0,this),this.k=o.k||this.k,this.dataProps[s]={n:e[s].n,p:o};this.k||this.getValue(!0),this._isAnimated=this.k}DashProperty.prototype.getValue=function(n){if(!(this.elem.globalData.frameId===this.frameId&&!n)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||n,this._mdf)){var e=0,i=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),e=0;e<i;e+=1)this.dataProps[e].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty);function SVGStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i,this._isAnimated=!!this._isAnimated}extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData);function SVGFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.c=PropertyFactory.getProp(n,e.c,1,255,this),this.style=i}extendPrototype([DynamicPropertyContainer],SVGFillStyleData);function SVGNoStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.style=i}extendPrototype([DynamicPropertyContainer],SVGNoStyleData);function GradientProperty(n,e,i){this.data=e,this.c=createTypedArray("uint8c",e.p*4);var a=e.k.k[0].s?e.k.k[0].s.length-e.p*4:e.k.k.length-e.p*4;this.o=createTypedArray("float32",a),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=a,this.initDynamicPropertyContainer(i),this.prop=PropertyFactory.getProp(n,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}GradientProperty.prototype.comparePoints=function(n,e){for(var i=0,a=this.o.length/2,s;i<a;){if(s=Math.abs(n[i*4]-n[e*4+i*2]),s>.01)return!1;i+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var n=0,e=this.data.k.k.length;n<e;){if(!this.comparePoints(this.data.k.k[n].s,this.data.p))return!1;n+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(n){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||n){var e,i=this.data.p*4,a,s;for(e=0;e<i;e+=1)a=e%4===0?100:255,s=Math.round(this.prop.v[e]*a),this.c[e]!==s&&(this.c[e]=s,this._cmdf=!n);if(this.o.length)for(i=this.prop.v.length,e=this.data.p*4;e<i;e+=1)a=e%2===0?100:1,s=e%2===0?Math.round(this.prop.v[e]*100):this.prop.v[e],this.o[e-this.data.p*4]!==s&&(this.o[e-this.data.p*4]=s,this._omdf=!n);this._mdf=!n}},extendPrototype([DynamicPropertyContainer],GradientProperty);function SVGGradientFillStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.initGradientData(n,e,i)}SVGGradientFillStyleData.prototype.initGradientData=function(n,e,i){this.o=PropertyFactory.getProp(n,e.o,0,.01,this),this.s=PropertyFactory.getProp(n,e.s,1,null,this),this.e=PropertyFactory.getProp(n,e.e,1,null,this),this.h=PropertyFactory.getProp(n,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(n,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(n,e.g,this),this.style=i,this.stops=[],this.setGradientData(i.pElem,e),this.setGradientOpacity(e,i),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(n,e){var i=createElementID(),a=createNS(e.t===1?"linearGradient":"radialGradient");a.setAttribute("id",i),a.setAttribute("spreadMethod","pad"),a.setAttribute("gradientUnits","userSpaceOnUse");var s=[],r,o,l;for(l=e.g.p*4,o=0;o<l;o+=4)r=createNS("stop"),a.appendChild(r),s.push(r);n.setAttribute(e.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+i+")"),this.gf=a,this.cst=s},SVGGradientFillStyleData.prototype.setGradientOpacity=function(n,e){if(this.g._hasOpacity&&!this.g._collapsable){var i,a,s,r=createNS("mask"),o=createNS("path");r.appendChild(o);var l=createElementID(),u=createElementID();r.setAttribute("id",u);var c=createNS(n.t===1?"linearGradient":"radialGradient");c.setAttribute("id",l),c.setAttribute("spreadMethod","pad"),c.setAttribute("gradientUnits","userSpaceOnUse"),s=n.g.k.k[0].s?n.g.k.k[0].s.length:n.g.k.k.length;var d=this.stops;for(a=n.g.p*4;a<s;a+=2)i=createNS("stop"),i.setAttribute("stop-color","rgb(255,255,255)"),c.appendChild(i),d.push(i);o.setAttribute(n.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+l+")"),n.ty==="gs"&&(o.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),o.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),n.lj===1&&o.setAttribute("stroke-miterlimit",n.ml)),this.of=c,this.ms=r,this.ost=d,this.maskId=u,e.msElem=o}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData);function SVGGradientStrokeStyleData(n,e,i){this.initDynamicPropertyContainer(n),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(n,e.w,0,null,this),this.d=new DashProperty(n,e.d||{},"svg",this),this.initGradientData(n,e,i),this._isAnimated=!!this._isAnimated}extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(n,e,i){this.transform={mProps:n,op:e,container:i},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var buildShapeString=function(e,i,a,s){if(i===0)return"";var r=e.o,o=e.i,l=e.v,u,c=" M"+s.applyToPointStringified(l[0][0],l[0][1]);for(u=1;u<i;u+=1)c+=" C"+s.applyToPointStringified(r[u-1][0],r[u-1][1])+" "+s.applyToPointStringified(o[u][0],o[u][1])+" "+s.applyToPointStringified(l[u][0],l[u][1]);return a&&i&&(c+=" C"+s.applyToPointStringified(r[u-1][0],r[u-1][1])+" "+s.applyToPointStringified(o[0][0],o[0][1])+" "+s.applyToPointStringified(l[0][0],l[0][1]),c+="z"),c},SVGElementsRenderer=function(){var n=new Matrix,e=new Matrix,i={createRenderFunction:a};function a(p){switch(p.ty){case"fl":return l;case"gf":return c;case"gs":return u;case"st":return d;case"sh":case"el":case"rc":case"sr":return o;case"tr":return s;case"no":return r;default:return null}}function s(p,f,m){(m||f.transform.op._mdf)&&f.transform.container.setAttribute("opacity",f.transform.op.v),(m||f.transform.mProps._mdf)&&f.transform.container.setAttribute("transform",f.transform.mProps.v.to2dCSS())}function r(){}function o(p,f,m){var P,T,x,y,S,g,C=f.styles.length,E=f.lvl,B,_,M,D;for(g=0;g<C;g+=1){if(y=f.sh._mdf||m,f.styles[g].lvl<E){for(_=e.reset(),M=E-f.styles[g].lvl,D=f.transformers.length-1;!y&&M>0;)y=f.transformers[D].mProps._mdf||y,M-=1,D-=1;if(y)for(M=E-f.styles[g].lvl,D=f.transformers.length-1;M>0;)_.multiply(f.transformers[D].mProps.v),M-=1,D-=1}else _=n;if(B=f.sh.paths,T=B._length,y){for(x="",P=0;P<T;P+=1)S=B.shapes[P],S&&S._length&&(x+=buildShapeString(S,S._length,S.c,_));f.caches[g]=x}else x=f.caches[g];f.styles[g].d+=p.hd===!0?"":x,f.styles[g]._mdf=y||f.styles[g]._mdf}}function l(p,f,m){var P=f.style;(f.c._mdf||m)&&P.pElem.setAttribute("fill","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||m)&&P.pElem.setAttribute("fill-opacity",f.o.v)}function u(p,f,m){c(p,f,m),d(p,f,m)}function c(p,f,m){var P=f.gf,T=f.g._hasOpacity,x=f.s.v,y=f.e.v;if(f.o._mdf||m){var S=p.ty==="gf"?"fill-opacity":"stroke-opacity";f.style.pElem.setAttribute(S,f.o.v)}if(f.s._mdf||m){var g=p.t===1?"x1":"cx",C=g==="x1"?"y1":"cy";P.setAttribute(g,x[0]),P.setAttribute(C,x[1]),T&&!f.g._collapsable&&(f.of.setAttribute(g,x[0]),f.of.setAttribute(C,x[1]))}var E,B,_,M;if(f.g._cmdf||m){E=f.cst;var D=f.g.c;for(_=E.length,B=0;B<_;B+=1)M=E[B],M.setAttribute("offset",D[B*4]+"%"),M.setAttribute("stop-color","rgb("+D[B*4+1]+","+D[B*4+2]+","+D[B*4+3]+")")}if(T&&(f.g._omdf||m)){var L=f.g.o;for(f.g._collapsable?E=f.cst:E=f.ost,_=E.length,B=0;B<_;B+=1)M=E[B],f.g._collapsable||M.setAttribute("offset",L[B*2]+"%"),M.setAttribute("stop-opacity",L[B*2+1])}if(p.t===1)(f.e._mdf||m)&&(P.setAttribute("x2",y[0]),P.setAttribute("y2",y[1]),T&&!f.g._collapsable&&(f.of.setAttribute("x2",y[0]),f.of.setAttribute("y2",y[1])));else{var N;if((f.s._mdf||f.e._mdf||m)&&(N=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)),P.setAttribute("r",N),T&&!f.g._collapsable&&f.of.setAttribute("r",N)),f.s._mdf||f.e._mdf||f.h._mdf||f.a._mdf||m){N||(N=Math.sqrt(Math.pow(x[0]-y[0],2)+Math.pow(x[1]-y[1],2)));var F=Math.atan2(y[1]-x[1],y[0]-x[0]),H=f.h.v;H>=1?H=.99:H<=-1&&(H=-.99);var $=N*H,O=Math.cos(F+f.a.v)*$+x[0],b=Math.sin(F+f.a.v)*$+x[1];P.setAttribute("fx",O),P.setAttribute("fy",b),T&&!f.g._collapsable&&(f.of.setAttribute("fx",O),f.of.setAttribute("fy",b))}}}function d(p,f,m){var P=f.style,T=f.d;T&&(T._mdf||m)&&T.dashStr&&(P.pElem.setAttribute("stroke-dasharray",T.dashStr),P.pElem.setAttribute("stroke-dashoffset",T.dashoffset[0])),f.c&&(f.c._mdf||m)&&P.pElem.setAttribute("stroke","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||m)&&P.pElem.setAttribute("stroke-opacity",f.o.v),(f.w._mdf||m)&&(P.pElem.setAttribute("stroke-width",f.w.v),P.msElem&&P.msElem.setAttribute("stroke-width",f.w.v))}return i}();function SVGShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(n,e,i),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var n,e=this.shapes.length,i,a,s=this.stylesList.length,r,o=[],l=!1;for(a=0;a<s;a+=1){for(r=this.stylesList[a],l=!1,o.length=0,n=0;n<e;n+=1)i=this.shapes[n],i.styles.indexOf(r)!==-1&&(o.push(i),l=i._isAnimated||l);o.length>1&&l&&this.setShapesAsAnimated(o)}},SVGShapeElement.prototype.setShapesAsAnimated=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(n,e){var i,a=new SVGStyleData(n,e),s=a.pElem;if(n.ty==="st")i=new SVGStrokeStyleData(this,n,a);else if(n.ty==="fl")i=new SVGFillStyleData(this,n,a);else if(n.ty==="gf"||n.ty==="gs"){var r=n.ty==="gf"?SVGGradientFillStyleData:SVGGradientStrokeStyleData;i=new r(this,n,a),this.globalData.defs.appendChild(i.gf),i.maskId&&(this.globalData.defs.appendChild(i.ms),this.globalData.defs.appendChild(i.of),s.setAttribute("mask","url("+getLocationHref()+"#"+i.maskId+")"))}else n.ty==="no"&&(i=new SVGNoStyleData(this,n,a));return(n.ty==="st"||n.ty==="gs")&&(s.setAttribute("stroke-linecap",lineCapEnum[n.lc||2]),s.setAttribute("stroke-linejoin",lineJoinEnum[n.lj||2]),s.setAttribute("fill-opacity","0"),n.lj===1&&s.setAttribute("stroke-miterlimit",n.ml)),n.r===2&&s.setAttribute("fill-rule","evenodd"),n.ln&&s.setAttribute("id",n.ln),n.cl&&s.setAttribute("class",n.cl),n.bm&&(s.style["mix-blend-mode"]=getBlendMode(n.bm)),this.stylesList.push(a),this.addToAnimatedContents(n,i),i},SVGShapeElement.prototype.createGroupElement=function(n){var e=new ShapeGroupData;return n.ln&&e.gr.setAttribute("id",n.ln),n.cl&&e.gr.setAttribute("class",n.cl),n.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(n.bm)),e},SVGShapeElement.prototype.createTransformElement=function(n,e){var i=TransformPropertyFactory.getTransformProperty(this,n,this),a=new SVGTransformData(i,i.o,e);return this.addToAnimatedContents(n,a),a},SVGShapeElement.prototype.createShapeElement=function(n,e,i){var a=4;n.ty==="rc"?a=5:n.ty==="el"?a=6:n.ty==="sr"&&(a=7);var s=ShapePropertyFactory.getShapeProp(this,n,a,this),r=new SVGShapeData(e,i,s);return this.shapes.push(r),this.addShapeToModifiers(r),this.addToAnimatedContents(n,r),r},SVGShapeElement.prototype.addToAnimatedContents=function(n,e){for(var i=0,a=this.animatedContents.length;i<a;){if(this.animatedContents[i].element===e)return;i+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(n),element:e,data:n})},SVGShapeElement.prototype.setElementStyles=function(n){var e=n.styles,i,a=this.stylesList.length;for(i=0;i<a;i+=1)e.indexOf(this.stylesList[i])===-1&&!this.stylesList[i].closed&&e.push(this.stylesList[i])},SVGShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(n,e,i,a,s,r,o){var l=[].concat(r),u,c=n.length-1,d,p,f=[],m=[],P,T,x;for(u=c;u>=0;u-=1){if(x=this.searchProcessedElement(n[u]),x?e[u]=i[x-1]:n[u]._render=o,n[u].ty==="fl"||n[u].ty==="st"||n[u].ty==="gf"||n[u].ty==="gs"||n[u].ty==="no")x?e[u].style.closed=n[u].hd:e[u]=this.createStyleElement(n[u],s),n[u]._render&&e[u].style.pElem.parentNode!==a&&a.appendChild(e[u].style.pElem),f.push(e[u].style);else if(n[u].ty==="gr"){if(!x)e[u]=this.createGroupElement(n[u]);else for(p=e[u].it.length,d=0;d<p;d+=1)e[u].prevViewData[d]=e[u].it[d];this.searchShapes(n[u].it,e[u].it,e[u].prevViewData,e[u].gr,s+1,l,o),n[u]._render&&e[u].gr.parentNode!==a&&a.appendChild(e[u].gr)}else n[u].ty==="tr"?(x||(e[u]=this.createTransformElement(n[u],a)),P=e[u].transform,l.push(P)):n[u].ty==="sh"||n[u].ty==="rc"||n[u].ty==="el"||n[u].ty==="sr"?(x||(e[u]=this.createShapeElement(n[u],l,s)),this.setElementStyles(e[u])):n[u].ty==="tm"||n[u].ty==="rd"||n[u].ty==="ms"||n[u].ty==="pb"||n[u].ty==="zz"||n[u].ty==="op"?(x?(T=e[u],T.closed=!1):(T=ShapeModifiers.getModifier(n[u].ty),T.init(this,n[u]),e[u]=T,this.shapeModifiers.push(T)),m.push(T)):n[u].ty==="rp"&&(x?(T=e[u],T.closed=!0):(T=ShapeModifiers.getModifier(n[u].ty),e[u]=T,T.init(this,n,u,e),this.shapeModifiers.push(T),o=!1),m.push(T));this.addProcessedElement(n[u],u+1)}for(c=f.length,u=0;u<c;u+=1)f[u].closed=!0;for(c=m.length,u=0;u<c;u+=1)m[u].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){this.renderModifiers();var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].reset();for(this.renderShape(),n=0;n<e;n+=1)(this.stylesList[n]._mdf||this._isFirstFrame)&&(this.stylesList[n].msElem&&(this.stylesList[n].msElem.setAttribute("d",this.stylesList[n].d),this.stylesList[n].d="M0 0"+this.stylesList[n].d),this.stylesList[n].pElem.setAttribute("d",this.stylesList[n].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var n,e=this.animatedContents.length,i;for(n=0;n<e;n+=1)i=this.animatedContents[n],(this._isFirstFrame||i.element._isAnimated)&&i.data!==!0&&i.fn(i.data,i.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function LetterProps(n,e,i,a,s,r){this.o=n,this.sw=e,this.sc=i,this.fc=a,this.m=s,this.p=r,this._mdf={o:!0,sw:!!e,sc:!!i,fc:!!a,m:!0,p:!0}}LetterProps.prototype.update=function(n,e,i,a,s,r){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var o=!1;return this.o!==n&&(this.o=n,this._mdf.o=!0,o=!0),this.sw!==e&&(this.sw=e,this._mdf.sw=!0,o=!0),this.sc!==i&&(this.sc=i,this._mdf.sc=!0,o=!0),this.fc!==a&&(this.fc=a,this._mdf.fc=!0,o=!0),this.m!==s&&(this.m=s,this._mdf.m=!0,o=!0),r.length&&(this.p[0]!==r[0]||this.p[1]!==r[1]||this.p[4]!==r[4]||this.p[5]!==r[5]||this.p[12]!==r[12]||this.p[13]!==r[13])&&(this.p=r,this._mdf.p=!0,o=!0),o};function TextProperty(n,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,e.d&&e.d.sid&&(e.d=n.globalData.slotManager.getProp(e.d)),this.data=e,this.elem=n,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(n,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},TextProperty.prototype.setCurrentData=function(n){n.__complete||this.completeTextData(n),this.currentData=n,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(n){this.effectsSequence.push(n),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(n){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!n)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,i=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var a,s=this.effectsSequence.length,r=n||this.data.d.k[this.keysIndex].s;for(a=0;a<s;a+=1)i!==this.keysIndex?r=this.effectsSequence[a](r,r.t):r=this.effectsSequence[a](this.currentData,r.t);e!==r&&this.setCurrentData(r),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},TextProperty.prototype.getKeyframeValue=function(){for(var n=this.data.d.k,e=this.elem.comp.renderedFrame,i=0,a=n.length;i<=a-1&&!(i===a-1||n[i+1].t>e);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(n){for(var e=[],i=0,a=n.length,s,r,o=!1,l=!1,u="";i<a;)o=l,l=!1,s=n.charCodeAt(i),u=n.charAt(i),FontManager.isCombinedCharacter(s)?o=!0:s>=55296&&s<=56319?FontManager.isRegionalFlag(n,i)?u=n.substr(i,14):(r=n.charCodeAt(i+1),r>=56320&&r<=57343&&(FontManager.isModifier(s,r)?(u=n.substr(i,2),o=!0):FontManager.isFlagEmoji(n.substr(i,4))?u=n.substr(i,4):u=n.substr(i,2))):s>56319?(r=n.charCodeAt(i+1),FontManager.isVariationSelector(s)&&(o=!0)):FontManager.isZeroWidthJoiner(s)&&(o=!0,l=!0),o?(e[e.length-1]+=u,o=!1):e.push(u),i+=u.length;return e},TextProperty.prototype.completeTextData=function(n){n.__complete=!0;var e=this.elem.globalData.fontManager,i=this.data,a=[],s,r,o,l=0,u,c=i.m.g,d=0,p=0,f=0,m=[],P=0,T=0,x,y,S=e.getFontByName(n.f),g,C=0,E=getFontProperties(S);n.fWeight=E.weight,n.fStyle=E.style,n.finalSize=n.s,n.finalText=this.buildFinalText(n.t),r=n.finalText.length,n.finalLineHeight=n.lh;var B=n.tr/1e3*n.finalSize,_;if(n.sz)for(var M=!0,D=n.sz[0],L=n.sz[1],N,F;M;){F=this.buildFinalText(n.t),N=0,P=0,r=F.length,B=n.tr/1e3*n.finalSize;var H=-1;for(s=0;s<r;s+=1)_=F[s].charCodeAt(0),o=!1,F[s]===" "?H=s:(_===13||_===3)&&(P=0,o=!0,N+=n.finalLineHeight||n.finalSize*1.2),e.chars?(g=e.getCharData(F[s],S.fStyle,S.fFamily),C=o?0:g.w*n.finalSize/100):C=e.measureText(F[s],n.f,n.finalSize),P+C>D&&F[s]!==" "?(H===-1?r+=1:s=H,N+=n.finalLineHeight||n.finalSize*1.2,F.splice(s,H===s?1:0,"\r"),H=-1,P=0):(P+=C,P+=B);N+=S.ascent*n.finalSize/100,this.canResize&&n.finalSize>this.minimumFontSize&&L<N?(n.finalSize-=1,n.finalLineHeight=n.finalSize*n.lh/n.s):(n.finalText=F,r=n.finalText.length,M=!1)}P=-B,C=0;var $=0,O;for(s=0;s<r;s+=1)if(o=!1,O=n.finalText[s],_=O.charCodeAt(0),_===13||_===3?($=0,m.push(P),T=P>T?P:T,P=-2*B,u="",o=!0,f+=1):u=O,e.chars?(g=e.getCharData(O,S.fStyle,e.getFontByName(n.f).fFamily),C=o?0:g.w*n.finalSize/100):C=e.measureText(u,n.f,n.finalSize),O===" "?$+=C+B:(P+=C+B+$,$=0),a.push({l:C,an:C,add:d,n:o,anIndexes:[],val:u,line:f,animatorJustifyOffset:0}),c==2){if(d+=C,u===""||u===" "||s===r-1){for((u===""||u===" ")&&(d-=C);p<=s;)a[p].an=d,a[p].ind=l,a[p].extra=C,p+=1;l+=1,d=0}}else if(c==3){if(d+=C,u===""||s===r-1){for(u===""&&(d-=C);p<=s;)a[p].an=d,a[p].ind=l,a[p].extra=C,p+=1;d=0,l+=1}}else a[l].ind=l,a[l].extra=0,l+=1;if(n.l=a,T=P>T?P:T,m.push(P),n.sz)n.boxWidth=n.sz[0],n.justifyOffset=0;else switch(n.boxWidth=T,n.j){case 1:n.justifyOffset=-n.boxWidth;break;case 2:n.justifyOffset=-n.boxWidth/2;break;default:n.justifyOffset=0}n.lineWidths=m;var b=i.a,I,V;y=b.length;var A,k,R=[];for(x=0;x<y;x+=1){for(I=b[x],I.a.sc&&(n.strokeColorAnim=!0),I.a.sw&&(n.strokeWidthAnim=!0),(I.a.fc||I.a.fh||I.a.fs||I.a.fb)&&(n.fillColorAnim=!0),k=0,A=I.s.b,s=0;s<r;s+=1)V=a[s],V.anIndexes[x]=k,(A==1&&V.val!==""||A==2&&V.val!==""&&V.val!==" "||A==3&&(V.n||V.val==" "||s==r-1)||A==4&&(V.n||s==r-1))&&(I.s.rn===1&&R.push(k),k+=1);i.a[x].s.totalChars=k;var G=-1,z;if(I.s.rn===1)for(s=0;s<r;s+=1)V=a[s],G!=V.anIndexes[x]&&(G=V.anIndexes[x],z=R.splice(Math.floor(Math.random()*R.length),1)[0]),V.anIndexes[x]=z}n.yOffset=n.finalLineHeight||n.finalSize*1.2,n.ls=n.ls||0,n.ascent=S.ascent*n.finalSize/100},TextProperty.prototype.updateDocumentData=function(n,e){e=e===void 0?this.keysIndex:e;var i=this.copyData({},this.data.d.k[e].s);i=this.copyData(i,n),this.data.d.k[e].s=i,this.recalculate(e),this.setCurrentData(i),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(n){var e=this.data.d.k[n].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(n){this.canResize=n,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(n){this.minimumFontSize=Math.floor(n)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var n=Math.max,e=Math.min,i=Math.floor;function a(r,o){this._currentTextLength=-1,this.k=!1,this.data=o,this.elem=r,this.comp=r.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(r),this.s=PropertyFactory.getProp(r,o.s||{k:0},0,0,this),"e"in o?this.e=PropertyFactory.getProp(r,o.e,0,0,this):this.e={v:100},this.o=PropertyFactory.getProp(r,o.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(r,o.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(r,o.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(r,o.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(r,o.a,0,.01,this),this.dynamicProperties.length||this.getValue()}a.prototype={getMult:function(o){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var l=0,u=0,c=1,d=1;this.ne.v>0?l=this.ne.v/100:u=-this.ne.v/100,this.xe.v>0?c=1-this.xe.v/100:d=1+this.xe.v/100;var p=BezierFactory.getBezierEasing(l,u,c,d).get,f=0,m=this.finalS,P=this.finalE,T=this.data.sh;if(T===2)P===m?f=o>=P?1:0:f=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f=p(f);else if(T===3)P===m?f=o>=P?0:1:f=1-n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f=p(f);else if(T===4)P===m?f=0:(f=n(0,e(.5/(P-m)+(o-m)/(P-m),1)),f<.5?f*=2:f=1-2*(f-.5)),f=p(f);else if(T===5){if(P===m)f=0;else{var x=P-m;o=e(n(0,o+.5-m),P-m);var y=-x/2+o,S=x/2;f=Math.sqrt(1-y*y/(S*S))}f=p(f)}else T===6?(P===m?f=0:(o=e(n(0,o+.5-m),P-m),f=(1+Math.cos(Math.PI+Math.PI*2*o/(P-m)))/2),f=p(f)):(o>=i(m)&&(o-m<0?f=n(0,e(e(P,1)-(m-o),1)):f=n(0,e(P-o,1))),f=p(f));if(this.sm.v!==100){var g=this.sm.v*.01;g===0&&(g=1e-8);var C=.5-g*.5;f<C?f=0:(f=(f-C)/g,f>1&&(f=1))}return f*this.a.v},getValue:function(o){this.iterateDynamicProperties(),this._mdf=o||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,o&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,u=this.o.v/l,c=this.s.v/l+u,d=this.e.v/l+u;if(c>d){var p=c;c=d,d=p}this.finalS=c,this.finalE=d}},extendPrototype([DynamicPropertyContainer],a);function s(r,o,l){return new a(r,o)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(n,e,i){var a={propType:!1},s=PropertyFactory.getProp,r=e.a;this.a={r:r.r?s(n,r.r,0,degToRads,i):a,rx:r.rx?s(n,r.rx,0,degToRads,i):a,ry:r.ry?s(n,r.ry,0,degToRads,i):a,sk:r.sk?s(n,r.sk,0,degToRads,i):a,sa:r.sa?s(n,r.sa,0,degToRads,i):a,s:r.s?s(n,r.s,1,.01,i):a,a:r.a?s(n,r.a,1,0,i):a,o:r.o?s(n,r.o,0,.01,i):a,p:r.p?s(n,r.p,1,0,i):a,sw:r.sw?s(n,r.sw,0,0,i):a,sc:r.sc?s(n,r.sc,1,0,i):a,fc:r.fc?s(n,r.fc,1,0,i):a,fh:r.fh?s(n,r.fh,0,0,i):a,fs:r.fs?s(n,r.fs,0,.01,i):a,fb:r.fb?s(n,r.fb,0,.01,i):a,t:r.t?s(n,r.t,0,0,i):a},this.s=TextSelectorProp.getTextSelectorProp(n,e.s,i),this.s.t=e.s.t}function TextAnimatorProperty(n,e,i){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=n,this._renderType=e,this._elem=i,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(i)}TextAnimatorProperty.prototype.searchProperties=function(){var n,e=this._textData.a.length,i,a=PropertyFactory.getProp;for(n=0;n<e;n+=1)i=this._textData.a[n],this._animatorsData[n]=new TextAnimatorDataProperty(this._elem,i,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:a(this._elem,this._textData.p.a,0,0,this),f:a(this._elem,this._textData.p.f,0,0,this),l:a(this._elem,this._textData.p.l,0,0,this),r:a(this._elem,this._textData.p.r,0,0,this),p:a(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=a(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(n,e){if(this.lettersChangedFlag=e,!(!this._mdf&&!this._isFirstFrame&&!e&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var i=this._moreOptions.alignment.v,a=this._animatorsData,s=this._textData,r=this.mHelper,o=this._renderType,l=this.renderedLetters.length,u,c,d,p,f=n.l,m,P,T,x,y,S,g,C,E,B,_,M,D,L,N;if(this._hasMaskedPath){if(N=this._pathData.m,!this._pathData.n||this._pathData._mdf){var F=N.v;this._pathData.r.v&&(F=F.reverse()),m={tLength:0,segments:[]},p=F._length-1;var H;for(M=0,d=0;d<p;d+=1)H=bez.buildBezierData(F.v[d],F.v[d+1],[F.o[d][0]-F.v[d][0],F.o[d][1]-F.v[d][1]],[F.i[d+1][0]-F.v[d+1][0],F.i[d+1][1]-F.v[d+1][1]]),m.tLength+=H.segmentLength,m.segments.push(H),M+=H.segmentLength;d=p,N.v.c&&(H=bez.buildBezierData(F.v[d],F.v[0],[F.o[d][0]-F.v[d][0],F.o[d][1]-F.v[d][1]],[F.i[0][0]-F.v[0][0],F.i[0][1]-F.v[0][1]]),m.tLength+=H.segmentLength,m.segments.push(H),M+=H.segmentLength),this._pathData.pi=m}if(m=this._pathData.pi,P=this._pathData.f.v,g=0,S=1,x=0,y=!0,B=m.segments,P<0&&N.v.c)for(m.tLength<Math.abs(P)&&(P=-Math.abs(P)%m.tLength),g=B.length-1,E=B[g].points,S=E.length-1;P<0;)P+=E[S].partialLength,S-=1,S<0&&(g-=1,E=B[g].points,S=E.length-1);E=B[g].points,C=E[S-1],T=E[S],_=T.partialLength}p=f.length,u=0,c=0;var $=n.finalSize*1.2*.714,O=!0,b,I,V,A,k;A=a.length;var R,G=-1,z,q,U,K=P,Q=g,ne=S,Ee=-1,ye,ge,xe,oe,Y,Fe,Oe,Le,Ce="",De=this.defaultPropsArray,ae;if(n.j===2||n.j===1){var re=0,de=0,Be=n.j===2?-.5:-1,he=0,Ie=!0;for(d=0;d<p;d+=1)if(f[d].n){for(re&&(re+=de);he<d;)f[he].animatorJustifyOffset=re,he+=1;re=0,Ie=!0}else{for(V=0;V<A;V+=1)b=a[V].a,b.t.propType&&(Ie&&n.j===2&&(de+=b.t.v*Be),I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?re+=b.t.v*R[0]*Be:re+=b.t.v*R*Be);Ie=!1}for(re&&(re+=de);he<d;)f[he].animatorJustifyOffset=re,he+=1}for(d=0;d<p;d+=1){if(r.reset(),ye=1,f[d].n)u=0,c+=n.yOffset,c+=O?1:0,P=K,O=!1,this._hasMaskedPath&&(g=Q,S=ne,E=B[g].points,C=E[S-1],T=E[S],_=T.partialLength,x=0),Ce="",Le="",Fe="",ae="",De=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Ee!==f[d].line){switch(n.j){case 1:P+=M-n.lineWidths[f[d].line];break;case 2:P+=(M-n.lineWidths[f[d].line])/2;break}Ee=f[d].line}G!==f[d].ind&&(f[G]&&(P+=f[G].extra),P+=f[d].an/2,G=f[d].ind),P+=i[0]*f[d].an*.005;var Ae=0;for(V=0;V<A;V+=1)b=a[V].a,b.p.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?Ae+=b.p.v[0]*R[0]:Ae+=b.p.v[0]*R),b.a.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?Ae+=b.a.v[0]*R[0]:Ae+=b.a.v[0]*R);for(y=!0,this._pathData.a.v&&(P=f[0].an*.5+(M-this._pathData.f.v-f[0].an*.5-f[f.length-1].an*.5)*G/(p-1),P+=this._pathData.f.v);y;)x+_>=P+Ae||!E?(D=(P+Ae-x)/T.partialLength,q=C.point[0]+(T.point[0]-C.point[0])*D,U=C.point[1]+(T.point[1]-C.point[1])*D,r.translate(-i[0]*f[d].an*.005,-(i[1]*$)*.01),y=!1):E&&(x+=T.partialLength,S+=1,S>=E.length&&(S=0,g+=1,B[g]?E=B[g].points:N.v.c?(S=0,g=0,E=B[g].points):(x-=T.partialLength,E=null)),E&&(C=T,T=E[S],_=T.partialLength));z=f[d].an/2-f[d].add,r.translate(-z,0,0)}else z=f[d].an/2-f[d].add,r.translate(-z,0,0),r.translate(-i[0]*f[d].an*.005,-i[1]*$*.01,0);for(V=0;V<A;V+=1)b=a[V].a,b.t.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),(u!==0||n.j!==0)&&(this._hasMaskedPath?R.length?P+=b.t.v*R[0]:P+=b.t.v*R:R.length?u+=b.t.v*R[0]:u+=b.t.v*R));for(n.strokeWidthAnim&&(xe=n.sw||0),n.strokeColorAnim&&(n.sc?ge=[n.sc[0],n.sc[1],n.sc[2]]:ge=[0,0,0]),n.fillColorAnim&&n.fc&&(oe=[n.fc[0],n.fc[1],n.fc[2]]),V=0;V<A;V+=1)b=a[V].a,b.a.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?r.translate(-b.a.v[0]*R[0],-b.a.v[1]*R[1],b.a.v[2]*R[2]):r.translate(-b.a.v[0]*R,-b.a.v[1]*R,b.a.v[2]*R));for(V=0;V<A;V+=1)b=a[V].a,b.s.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),R.length?r.scale(1+(b.s.v[0]-1)*R[0],1+(b.s.v[1]-1)*R[1],1):r.scale(1+(b.s.v[0]-1)*R,1+(b.s.v[1]-1)*R,1));for(V=0;V<A;V+=1){if(b=a[V].a,I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),b.sk.propType&&(R.length?r.skewFromAxis(-b.sk.v*R[0],b.sa.v*R[1]):r.skewFromAxis(-b.sk.v*R,b.sa.v*R)),b.r.propType&&(R.length?r.rotateZ(-b.r.v*R[2]):r.rotateZ(-b.r.v*R)),b.ry.propType&&(R.length?r.rotateY(b.ry.v*R[1]):r.rotateY(b.ry.v*R)),b.rx.propType&&(R.length?r.rotateX(b.rx.v*R[0]):r.rotateX(b.rx.v*R)),b.o.propType&&(R.length?ye+=(b.o.v*R[0]-ye)*R[0]:ye+=(b.o.v*R-ye)*R),n.strokeWidthAnim&&b.sw.propType&&(R.length?xe+=b.sw.v*R[0]:xe+=b.sw.v*R),n.strokeColorAnim&&b.sc.propType)for(Y=0;Y<3;Y+=1)R.length?ge[Y]+=(b.sc.v[Y]-ge[Y])*R[0]:ge[Y]+=(b.sc.v[Y]-ge[Y])*R;if(n.fillColorAnim&&n.fc){if(b.fc.propType)for(Y=0;Y<3;Y+=1)R.length?oe[Y]+=(b.fc.v[Y]-oe[Y])*R[0]:oe[Y]+=(b.fc.v[Y]-oe[Y])*R;b.fh.propType&&(R.length?oe=addHueToRGB(oe,b.fh.v*R[0]):oe=addHueToRGB(oe,b.fh.v*R)),b.fs.propType&&(R.length?oe=addSaturationToRGB(oe,b.fs.v*R[0]):oe=addSaturationToRGB(oe,b.fs.v*R)),b.fb.propType&&(R.length?oe=addBrightnessToRGB(oe,b.fb.v*R[0]):oe=addBrightnessToRGB(oe,b.fb.v*R))}}for(V=0;V<A;V+=1)b=a[V].a,b.p.propType&&(I=a[V].s,R=I.getMult(f[d].anIndexes[V],s.a[V].s.totalChars),this._hasMaskedPath?R.length?r.translate(0,b.p.v[1]*R[0],-b.p.v[2]*R[1]):r.translate(0,b.p.v[1]*R,-b.p.v[2]*R):R.length?r.translate(b.p.v[0]*R[0],b.p.v[1]*R[1],-b.p.v[2]*R[2]):r.translate(b.p.v[0]*R,b.p.v[1]*R,-b.p.v[2]*R));if(n.strokeWidthAnim&&(Fe=xe<0?0:xe),n.strokeColorAnim&&(Oe="rgb("+Math.round(ge[0]*255)+","+Math.round(ge[1]*255)+","+Math.round(ge[2]*255)+")"),n.fillColorAnim&&n.fc&&(Le="rgb("+Math.round(oe[0]*255)+","+Math.round(oe[1]*255)+","+Math.round(oe[2]*255)+")"),this._hasMaskedPath){if(r.translate(0,-n.ls),r.translate(0,i[1]*$*.01+c,0),this._pathData.p.v){L=(T.point[1]-C.point[1])/(T.point[0]-C.point[0]);var we=Math.atan(L)*180/Math.PI;T.point[0]<C.point[0]&&(we+=180),r.rotate(-we*Math.PI/180)}r.translate(q,U,0),P-=i[0]*f[d].an*.005,f[d+1]&&G!==f[d+1].ind&&(P+=f[d].an/2,P+=n.tr*.001*n.finalSize)}else{switch(r.translate(u,c,0),n.ps&&r.translate(n.ps[0],n.ps[1]+n.ascent,0),n.j){case 1:r.translate(f[d].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[f[d].line]),0,0);break;case 2:r.translate(f[d].animatorJustifyOffset+n.justifyOffset+(n.boxWidth-n.lineWidths[f[d].line])/2,0,0);break}r.translate(0,-n.ls),r.translate(z,0,0),r.translate(i[0]*f[d].an*.005,i[1]*$*.01,0),u+=f[d].l+n.tr*.001*n.finalSize}o==="html"?Ce=r.toCSS():o==="svg"?Ce=r.to2dCSS():De=[r.props[0],r.props[1],r.props[2],r.props[3],r.props[4],r.props[5],r.props[6],r.props[7],r.props[8],r.props[9],r.props[10],r.props[11],r.props[12],r.props[13],r.props[14],r.props[15]],ae=ye}l<=d?(k=new LetterProps(ae,Fe,Oe,Le,Ce,De),this.renderedLetters.push(k),l+=1,this.lettersChangedFlag=!0):(k=this.renderedLetters[d],this.lettersChangedFlag=k.update(ae,Fe,Oe,Le,Ce,De)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty);function ITextElement(){}ITextElement.prototype.initElement=function(n,e,i){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(n,e,i),this.textProperty=new TextProperty(this,n.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(n.t,this.renderType,this),this.initTransform(n,e,i),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(n){this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange)},ITextElement.prototype.createPathShape=function(n,e){var i,a=e.length,s,r="";for(i=0;i<a;i+=1)e[i].ty==="sh"&&(s=e[i].ks.k,r+=buildShapeString(s,s.i.length,!0,n));return r},ITextElement.prototype.updateDocumentData=function(n,e){this.textProperty.updateDocumentData(n,e)},ITextElement.prototype.canResizeFont=function(n){this.textProperty.canResizeFont(n)},ITextElement.prototype.setMinimumFontSize=function(n){this.textProperty.setMinimumFontSize(n)},ITextElement.prototype.applyTextPropertiesToMatrix=function(n,e,i,a,s){switch(n.ps&&e.translate(n.ps[0],n.ps[1]+n.ascent,0),e.translate(0,-n.ls,0),n.j){case 1:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i]),0,0);break;case 2:e.translate(n.justifyOffset+(n.boxWidth-n.lineWidths[i])/2,0,0);break}e.translate(a,s,0)},ITextElement.prototype.buildColor=function(n){return"rgb("+Math.round(n[0]*255)+","+Math.round(n[1]*255)+","+Math.round(n[2]*255)+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(n,e,i){this.textSpans=[],this.renderType="svg",this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(n){for(var e=0,i=n.length,a=[],s="";e<i;)n[e]==="\r"||n[e]===""?(a.push(s),s=""):s+=n[e],e+=1;return a.push(s),a},SVGTextLottieElement.prototype.buildShapeData=function(n,e){if(n.shapes&&n.shapes.length){var i=n.shapes[0];if(i.it){var a=i.it[i.it.length-1];a.s&&(a.s.k[0]=e,a.s.k[1]=e)}}return n},SVGTextLottieElement.prototype.buildNewText=function(){this.addDynamicProperty(this);var n,e,i=this.textProperty.currentData;this.renderedLetters=createSizedArray(i?i.l.length:0),i.fc?this.layerElement.setAttribute("fill",this.buildColor(i.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),i.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(i.sc)),this.layerElement.setAttribute("stroke-width",i.sw)),this.layerElement.setAttribute("font-size",i.finalSize);var a=this.globalData.fontManager.getFontByName(i.f);if(a.fClass)this.layerElement.setAttribute("class",a.fClass);else{this.layerElement.setAttribute("font-family",a.fFamily);var s=i.fWeight,r=i.fStyle;this.layerElement.setAttribute("font-style",r),this.layerElement.setAttribute("font-weight",s)}this.layerElement.setAttribute("aria-label",i.t);var o=i.l||[],l=!!this.globalData.fontManager.chars;e=o.length;var u,c=this.mHelper,d="",p=this.data.singleShape,f=0,m=0,P=!0,T=i.tr*.001*i.finalSize;if(p&&!l&&!i.sz){var x=this.textContainer,y="start";switch(i.j){case 1:y="end";break;case 2:y="middle";break;default:y="start";break}x.setAttribute("text-anchor",y),x.setAttribute("letter-spacing",T);var S=this.buildTextContents(i.finalText);for(e=S.length,m=i.ps?i.ps[1]+i.ascent:0,n=0;n<e;n+=1)u=this.textSpans[n].span||createNS("tspan"),u.textContent=S[n],u.setAttribute("x",0),u.setAttribute("y",m),u.style.display="inherit",x.appendChild(u),this.textSpans[n]||(this.textSpans[n]={span:null,glyph:null}),this.textSpans[n].span=u,m+=i.finalLineHeight;this.layerElement.appendChild(x)}else{var g=this.textSpans.length,C;for(n=0;n<e;n+=1){if(this.textSpans[n]||(this.textSpans[n]={span:null,childSpan:null,glyph:null}),!l||!p||n===0){if(u=g>n?this.textSpans[n].span:createNS(l?"g":"text"),g<=n){if(u.setAttribute("stroke-linecap","butt"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit","4"),this.textSpans[n].span=u,l){var E=createNS("g");u.appendChild(E),this.textSpans[n].childSpan=E}this.textSpans[n].span=u,this.layerElement.appendChild(u)}u.style.display="inherit"}if(c.reset(),p&&(o[n].n&&(f=-T,m+=i.yOffset,m+=P?1:0,P=!1),this.applyTextPropertiesToMatrix(i,c,o[n].line,f,m),f+=o[n].l||0,f+=T),l){C=this.globalData.fontManager.getCharData(i.finalText[n],a.fStyle,this.globalData.fontManager.getFontByName(i.f).fFamily);var B;if(C.t===1)B=new SVGCompElement(C.data,this.globalData,this);else{var _=emptyShapeData;C.data&&C.data.shapes&&(_=this.buildShapeData(C.data,i.finalSize)),B=new SVGShapeElement(_,this.globalData,this)}if(this.textSpans[n].glyph){var M=this.textSpans[n].glyph;this.textSpans[n].childSpan.removeChild(M.layerElement),M.destroy()}this.textSpans[n].glyph=B,B._debug=!0,B.prepareFrame(0),B.renderFrame(),this.textSpans[n].childSpan.appendChild(B.layerElement),C.t===1&&this.textSpans[n].childSpan.setAttribute("transform","scale("+i.finalSize/100+","+i.finalSize/100+")")}else p&&u.setAttribute("transform","translate("+c.props[12]+","+c.props[13]+")"),u.textContent=o[n].val,u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}p&&u&&u.setAttribute("d",d)}for(;n<this.textSpans.length;)this.textSpans[n].span.style.display="none",n+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var n=this.layerElement.getBBox();this.bbox={top:n.y,left:n.x,width:n.width,height:n.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var n,e=this.textSpans.length,i;for(this.renderedFrame=this.comp.renderedFrame,n=0;n<e;n+=1)i=this.textSpans[n].glyph,i&&(i.prepareFrame(this.comp.renderedFrame-this.data.st),i._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var n,e,i=this.textAnimator.renderedLetters,a=this.textProperty.currentData.l;e=a.length;var s,r,o;for(n=0;n<e;n+=1)a[n].n||(s=i[n],r=this.textSpans[n].span,o=this.textSpans[n].glyph,o&&o.renderFrame(),s._mdf.m&&r.setAttribute("transform",s.m),s._mdf.o&&r.setAttribute("opacity",s.o),s._mdf.sw&&r.setAttribute("stroke-width",s.sw),s._mdf.sc&&r.setAttribute("stroke",s.sc),s._mdf.fc&&r.setAttribute("fill",s.fc))}};function ISolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var n=createNS("rect");n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.layerElement.appendChild(n)};function NullElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initFrame(),this.initTransform(n,e,i),this.initHierarchy()}NullElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement);function SVGRendererBase(){}extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(n){return new NullElement(n,this.globalData,this)},SVGRendererBase.prototype.createShape=function(n){return new SVGShapeElement(n,this.globalData,this)},SVGRendererBase.prototype.createText=function(n){return new SVGTextLottieElement(n,this.globalData,this)},SVGRendererBase.prototype.createImage=function(n){return new IImageElement(n,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(n){return new ISolidElement(n,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(n){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+n.w+" "+n.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",n.w),this.svgElement.setAttribute("height",n.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(n,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=n;var i=createNS("clipPath"),a=createNS("rect");a.setAttribute("width",n.w),a.setAttribute("height",n.h),a.setAttribute("x",0),a.setAttribute("y",0);var s=createElementID();i.setAttribute("id",s),i.appendChild(a),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+s+")"),e.appendChild(i),this.layers=n.layers,this.elements=createSizedArray(n.layers.length)},SVGRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(n){var e=0,i=this.layers.length;for(e=0;e<i;e+=1)if(this.layers[e].ind===n)return e;return-1},SVGRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){e[n]=!0;var i=this.createItem(this.layers[n]);if(e[n]=i,getExpressionsPlugin()&&(this.layers[n].ty===0&&this.globalData.projectInterface.registerComposition(i),i.initExpressions()),this.appendElementInPos(i,n),this.layers[n].tt){var a="tp"in this.layers[n]?this.findIndexByInd(this.layers[n].tp):n-1;if(a===-1)return;if(!this.elements[a]||this.elements[a]===!0)this.buildItem(a),this.addPendingElement(i);else{var s=e[a],r=s.getMatte(this.layers[n].tt);i.setMatte(r)}}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();if(n.checkParenting(),n.data.tt)for(var e=0,i=this.elements.length;e<i;){if(this.elements[e]===n){var a="tp"in n.data?this.findIndexByInd(n.data.tp):e-1,s=this.elements[a],r=s.getMatte(this.layers[e].tt);n.setMatte(r);break}e+=1}}},SVGRendererBase.prototype.renderFrame=function(n){if(!(this.renderedFrame===n||this.destroyed)){n===null?n=this.renderedFrame:this.renderedFrame=n,this.globalData.frameNum=n,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=n,this.globalData._mdf=!1;var e,i=this.layers.length;for(this.completeLayers||this.checkLayers(n),e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(n-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<i;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){for(var a=0,s;a<e;)this.elements[a]&&this.elements[a]!==!0&&this.elements[a].getBaseElement()&&(s=this.elements[a].getBaseElement()),a+=1;s?this.layerElement.insertBefore(i,s):this.layerElement.appendChild(i)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"};function ICompElement(){}extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initTransform(n,e,i),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!e.progressiveLoad)&&this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(n){if(this._mdf=!1,this.prepareRenderableFrame(n),this.prepareProperties(n,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=n/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var i,a=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&(this.elements[i].prepareFrame(this.renderedFrame-this.layers[i].st),this.elements[i]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)(this.completeLayers||this.elements[n])&&this.elements[n].renderFrame()},ICompElement.prototype.setElements=function(n){this.elements=n},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var n,e=this.layers.length;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function SVGCompElement(n,e,i){this.layers=n.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function SVGRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var i="";if(e&&e.title){var a=createNS("title"),s=createElementID();a.setAttribute("id",s),a.textContent=e.title,this.svgElement.appendChild(a),i+=s}if(e&&e.description){var r=createNS("desc"),o=createElementID();r.setAttribute("id",o),r.textContent=e.description,this.svgElement.appendChild(r),i+=" "+o}i&&this.svgElement.setAttribute("aria-labelledby",i);var l=createNS("defs");this.svgElement.appendChild(l);var u=createNS("g");this.svgElement.appendChild(u),this.layerElement=u,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!(e&&e.hideOnTransparent===!1),viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"},width:e&&e.width,height:e&&e.height,runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:l,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(n){return new SVGCompElement(n,this.globalData,this)};function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}ShapeTransformManager.prototype={addTransformSequence:function(e){var i,a=e.length,s="_";for(i=0;i<a;i+=1)s+=e[i].transform.key+"_";var r=this.sequences[s];return r||(r={transforms:[].concat(e),finalTransform:new Matrix,_mdf:!1},this.sequences[s]=r,this.sequenceList.push(r)),r},processSequence:function(e,i){for(var a=0,s=e.transforms.length,r=i;a<s&&!i;){if(e.transforms[a].transform.mProps._mdf){r=!0;break}a+=1}if(r)for(e.finalTransform.reset(),a=s-1;a>=0;a-=1)e.finalTransform.multiply(e.transforms[a].transform.mProps.v);e._mdf=r},processSequences:function(e){var i,a=this.sequenceList.length;for(i=0;i<a;i+=1)this.processSequence(this.sequenceList[i],e)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var e="__lottie_element_luma_buffer",i=null,a=null,s=null;function r(){var u=createNS("svg"),c=createNS("filter"),d=createNS("feColorMatrix");return c.setAttribute("id",e),d.setAttribute("type","matrix"),d.setAttribute("color-interpolation-filters","sRGB"),d.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),c.appendChild(d),u.appendChild(c),u.setAttribute("id",e+"_svg"),featureSupport.svgLumaHidden&&(u.style.display="none"),u}function o(){i||(s=r(),document.body.appendChild(s),i=createTag("canvas"),a=i.getContext("2d"),a.filter="url(#"+e+")",a.fillStyle="rgba(0,0,0,0)",a.fillRect(0,0,1,1))}function l(u){return i||o(),i.width=u.width,i.height=u.height,a.filter="url(#"+e+")",i}return{load:o,get:l}};function createCanvas(n,e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(n,e);var i=createTag("canvas");return i.width=n,i.height=e,i}var assetLoader=function(){return{loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas}}(),registeredEffects={};function CVEffects(n){var e,i=n.data.ef?n.data.ef.length:0;this.filters=[];var a;for(e=0;e<i;e+=1){a=null;var s=n.data.ef[e].ty;if(registeredEffects[s]){var r=registeredEffects[s].effect;a=new r(n.effectsManager.effectElements[e],n)}a&&this.filters.push(a)}this.filters.length&&n.addRenderableComponent(this)}CVEffects.prototype.renderFrame=function(n){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(n)},CVEffects.prototype.getEffects=function(n){var e,i=this.filters.length,a=[];for(e=0;e<i;e+=1)this.filters[e].type===n&&a.push(this.filters[e]);return a};function registerEffect(n,e){registeredEffects[n]={effect:e}}function CVMaskElement(n,e){this.data=n,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var i,a=this.masksProperties.length,s=!1;for(i=0;i<a;i+=1)this.masksProperties[i].mode!=="n"&&(s=!0),this.viewData[i]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);this.hasMasks=s,s&&this.element.addRenderableComponent(this)}CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var n=this.element.finalTransform.mat,e=this.element.canvasContext,i,a=this.masksProperties.length,s,r,o;for(e.beginPath(),i=0;i<a;i+=1)if(this.masksProperties[i].mode!=="n"){this.masksProperties[i].inv&&(e.moveTo(0,0),e.lineTo(this.element.globalData.compSize.w,0),e.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),e.lineTo(0,this.element.globalData.compSize.h),e.lineTo(0,0)),o=this.viewData[i].v,s=n.applyToPointArray(o.v[0][0],o.v[0][1],0),e.moveTo(s[0],s[1]);var l,u=o._length;for(l=1;l<u;l+=1)r=n.applyToTriplePoints(o.o[l-1],o.i[l],o.v[l]),e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);r=n.applyToTriplePoints(o.o[l-1],o.i[0],o.v[0]),e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5])}this.element.globalData.renderer.save(!0),e.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};function CVBaseElement(){}var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var e=this.globalData.canvasContext,i=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(i);var a=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(a),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var i=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=i}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var a=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(a.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),r=s.getContext("2d");r.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var i=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(i),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(i),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(n,e,i,a){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;e.ty==="rc"?s=5:e.ty==="el"?s=6:e.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(n,e,s,n);var r,o=i.length,l;for(r=0;r<o;r+=1)i[r].closed||(l={transforms:a.addTransformSequence(i[r].transforms),trNodes:[]},this.styledShapes.push(l),i[r].elements.push(l))}CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated;function CVShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(n,e){var i={data:n,type:n.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:n.hd===!0},a={};if(n.ty==="fl"||n.ty==="st"?(a.c=PropertyFactory.getProp(this,n.c,1,255,this),a.c.k||(i.co="rgb("+bmFloor(a.c.v[0])+","+bmFloor(a.c.v[1])+","+bmFloor(a.c.v[2])+")")):(n.ty==="gf"||n.ty==="gs")&&(a.s=PropertyFactory.getProp(this,n.s,1,null,this),a.e=PropertyFactory.getProp(this,n.e,1,null,this),a.h=PropertyFactory.getProp(this,n.h||{k:0},0,.01,this),a.a=PropertyFactory.getProp(this,n.a||{k:0},0,degToRads,this),a.g=new GradientProperty(this,n.g,this)),a.o=PropertyFactory.getProp(this,n.o,0,.01,this),n.ty==="st"||n.ty==="gs"){if(i.lc=lineCapEnum[n.lc||2],i.lj=lineJoinEnum[n.lj||2],n.lj==1&&(i.ml=n.ml),a.w=PropertyFactory.getProp(this,n.w,0,null,this),a.w.k||(i.wi=a.w.v),n.d){var s=new DashProperty(this,n.d,"canvas",this);a.d=s,a.d.k||(i.da=a.d.dashArray,i.do=a.d.dashoffset[0])}}else i.r=n.r===2?"evenodd":"nonzero";return this.stylesList.push(i),a.style=i,a},CVShapeElement.prototype.createGroupElement=function(){var n={it:[],prevViewData:[]};return n},CVShapeElement.prototype.createTransformElement=function(n){var e={transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,n.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,n,this)}};return e},CVShapeElement.prototype.createShapeElement=function(n){var e=new CVShapeData(this,n,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){this._isFirstFrame=!0;var n,e=this.itemsData.length;for(n=0;n<e;n+=1)this.prevViewData[n]=this.itemsData[n];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,n=0;n<e;n+=1)this.dynamicProperties[n].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(n){var e,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(n)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var n,e=this.stylesList.length;for(n=0;n<e;n+=1)this.stylesList[n].closed||this.stylesList[n].transforms.pop()},CVShapeElement.prototype.closeStyles=function(n){var e,i=n.length;for(e=0;e<i;e+=1)n[e].closed=!0},CVShapeElement.prototype.searchShapes=function(n,e,i,a,s){var r,o=n.length-1,l,u,c=[],d=[],p,f,m,P=[].concat(s);for(r=o;r>=0;r-=1){if(p=this.searchProcessedElement(n[r]),p?e[r]=i[p-1]:n[r]._shouldRender=a,n[r].ty==="fl"||n[r].ty==="st"||n[r].ty==="gf"||n[r].ty==="gs")p?e[r].style.closed=!1:e[r]=this.createStyleElement(n[r],P),c.push(e[r].style);else if(n[r].ty==="gr"){if(!p)e[r]=this.createGroupElement(n[r]);else for(u=e[r].it.length,l=0;l<u;l+=1)e[r].prevViewData[l]=e[r].it[l];this.searchShapes(n[r].it,e[r].it,e[r].prevViewData,a,P)}else n[r].ty==="tr"?(p||(m=this.createTransformElement(n[r]),e[r]=m),P.push(e[r]),this.addTransformToStyleList(e[r])):n[r].ty==="sh"||n[r].ty==="rc"||n[r].ty==="el"||n[r].ty==="sr"?p||(e[r]=this.createShapeElement(n[r])):n[r].ty==="tm"||n[r].ty==="rd"||n[r].ty==="pb"||n[r].ty==="zz"||n[r].ty==="op"?(p?(f=e[r],f.closed=!1):(f=ShapeModifiers.getModifier(n[r].ty),f.init(this,n[r]),e[r]=f,this.shapeModifiers.push(f)),d.push(f)):n[r].ty==="rp"&&(p?(f=e[r],f.closed=!0):(f=ShapeModifiers.getModifier(n[r].ty),e[r]=f,f.init(this,n,r,e),this.shapeModifiers.push(f),a=!1),d.push(f));this.addProcessedElement(n[r],r+1)}for(this.removeTransformFromStyleList(),this.closeStyles(c),o=d.length,r=0;r<o;r+=1)d[r].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(n,e){(n._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=n.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var n,e=this.stylesList.length,i,a,s,r,o,l,u=this.globalData.renderer,c=this.globalData.canvasContext,d,p;for(n=0;n<e;n+=1)if(p=this.stylesList[n],d=p.type,!((d==="st"||d==="gs")&&p.wi===0||!p.data._shouldRender||p.coOp===0||this.globalData.currentGlobalAlpha===0)){for(u.save(),o=p.elements,d==="st"||d==="gs"?(u.ctxStrokeStyle(d==="st"?p.co:p.grd),u.ctxLineWidth(p.wi),u.ctxLineCap(p.lc),u.ctxLineJoin(p.lj),u.ctxMiterLimit(p.ml||0)):u.ctxFillStyle(d==="fl"?p.co:p.grd),u.ctxOpacity(p.coOp),d!=="st"&&d!=="gs"&&c.beginPath(),u.ctxTransform(p.preTransforms.finalTransform.props),a=o.length,i=0;i<a;i+=1){for((d==="st"||d==="gs")&&(c.beginPath(),p.da&&(c.setLineDash(p.da),c.lineDashOffset=p.do)),l=o[i].trNodes,r=l.length,s=0;s<r;s+=1)l[s].t==="m"?c.moveTo(l[s].p[0],l[s].p[1]):l[s].t==="c"?c.bezierCurveTo(l[s].pts[0],l[s].pts[1],l[s].pts[2],l[s].pts[3],l[s].pts[4],l[s].pts[5]):c.closePath();(d==="st"||d==="gs")&&(u.ctxStroke(),p.da&&c.setLineDash(this.dashResetter))}d!=="st"&&d!=="gs"&&this.globalData.renderer.ctxFill(p.r),u.restore()}},CVShapeElement.prototype.renderShape=function(n,e,i,a){var s,r=e.length-1,o;for(o=n,s=r;s>=0;s-=1)e[s].ty==="tr"?(o=i[s].transform,this.renderShapeTransform(n,o)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],i[s]):e[s].ty==="fl"?this.renderFill(e[s],i[s],o):e[s].ty==="st"?this.renderStroke(e[s],i[s],o):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],i[s],o):e[s].ty==="gr"?this.renderShape(o,e[s].it,i[s].it):e[s].ty;a&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(n,e){if(this._isFirstFrame||e._mdf||n.transforms._mdf){var i=n.trNodes,a=e.paths,s,r,o,l=a._length;i.length=0;var u=n.transforms.finalTransform;for(o=0;o<l;o+=1){var c=a.shapes[o];if(c&&c.v){for(r=c._length,s=1;s<r;s+=1)s===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),i.push({t:"c",pts:u.applyToTriplePoints(c.o[s-1],c.i[s],c.v[s])});r===1&&i.push({t:"m",p:u.applyToPointArray(c.v[0][0],c.v[0][1],0)}),c.c&&r&&(i.push({t:"c",pts:u.applyToTriplePoints(c.o[s-1],c.i[0],c.v[0])}),i.push({t:"z"}))}}n.trNodes=i}},CVShapeElement.prototype.renderPath=function(n,e){if(n.hd!==!0&&n._shouldRender){var i,a=e.styledShapes.length;for(i=0;i<a;i+=1)this.renderStyledShape(e.styledShapes[i],e.sh)}},CVShapeElement.prototype.renderFill=function(n,e,i){var a=e.style;(e.c._mdf||this._isFirstFrame)&&(a.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(a.coOp=e.o.v*i.opacity)},CVShapeElement.prototype.renderGradientFill=function(n,e,i){var a=e.style,s;if(!a.grd||e.g._mdf||e.s._mdf||e.e._mdf||n.t!==1&&(e.h._mdf||e.a._mdf)){var r=this.globalData.canvasContext,o=e.s.v,l=e.e.v;if(n.t===1)s=r.createLinearGradient(o[0],o[1],l[0],l[1]);else{var u=Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),c=Math.atan2(l[1]-o[1],l[0]-o[0]),d=e.h.v;d>=1?d=.99:d<=-1&&(d=-.99);var p=u*d,f=Math.cos(c+e.a.v)*p+o[0],m=Math.sin(c+e.a.v)*p+o[1];s=r.createRadialGradient(f,m,0,o[0],o[1],u)}var P,T=n.g.p,x=e.g.c,y=1;for(P=0;P<T;P+=1)e.g._hasOpacity&&e.g._collapsable&&(y=e.g.o[P*2+1]),s.addColorStop(x[P*4]/100,"rgba("+x[P*4+1]+","+x[P*4+2]+","+x[P*4+3]+","+y+")");a.grd=s}a.coOp=e.o.v*i.opacity},CVShapeElement.prototype.renderStroke=function(n,e,i){var a=e.style,s=e.d;s&&(s._mdf||this._isFirstFrame)&&(a.da=s.dashArray,a.do=s.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(a.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(a.coOp=e.o.v*i.opacity),(e.w._mdf||this._isFirstFrame)&&(a.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0};function CVTextElement(n,e,i){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=!1;n.fc?(e=!0,this.values.fill=this.buildColor(n.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var i=!1;n.sc&&(i=!0,this.values.stroke=this.buildColor(n.sc),this.values.sWidth=n.sw);var a=this.globalData.fontManager.getFontByName(n.f),s,r,o=n.l,l=this.mHelper;this.stroke=i,this.values.fValue=n.finalSize+"px "+this.globalData.fontManager.getFontByName(n.f).fFamily,r=n.finalText.length;var u,c,d,p,f,m,P,T,x,y,S=this.data.singleShape,g=n.tr*.001*n.finalSize,C=0,E=0,B=!0,_=0;for(s=0;s<r;s+=1){u=this.globalData.fontManager.getCharData(n.finalText[s],a.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),c=u&&u.data||{},l.reset(),S&&o[s].n&&(C=-g,E+=n.yOffset,E+=B?1:0,B=!1),f=c.shapes?c.shapes[0].it:[],P=f.length,l.scale(n.finalSize/100,n.finalSize/100),S&&this.applyTextPropertiesToMatrix(n,l,o[s].line,C,E),x=createSizedArray(P-1);var M=0;for(m=0;m<P;m+=1)if(f[m].ty==="sh"){for(p=f[m].ks.k.i.length,T=f[m].ks.k,y=[],d=1;d<p;d+=1)d===1&&y.push(l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),y.push(l.applyToX(T.o[d-1][0],T.o[d-1][1],0),l.applyToY(T.o[d-1][0],T.o[d-1][1],0),l.applyToX(T.i[d][0],T.i[d][1],0),l.applyToY(T.i[d][0],T.i[d][1],0),l.applyToX(T.v[d][0],T.v[d][1],0),l.applyToY(T.v[d][0],T.v[d][1],0));y.push(l.applyToX(T.o[d-1][0],T.o[d-1][1],0),l.applyToY(T.o[d-1][0],T.o[d-1][1],0),l.applyToX(T.i[0][0],T.i[0][1],0),l.applyToY(T.i[0][0],T.i[0][1],0),l.applyToX(T.v[0][0],T.v[0][1],0),l.applyToY(T.v[0][0],T.v[0][1],0)),x[M]=y,M+=1}S&&(C+=o[s].l,C+=g),this.textSpans[_]?this.textSpans[_].elem=x:this.textSpans[_]={elem:x},_+=1}},CVTextElement.prototype.renderInnerContent=function(){this.validateText();var n=this.canvasContext;n.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var e,i,a,s,r,o,l=this.textAnimator.renderedLetters,u=this.textProperty.currentData.l;i=u.length;var c,d=null,p=null,f=null,m,P,T=this.globalData.renderer;for(e=0;e<i;e+=1)if(!u[e].n){if(c=l[e],c&&(T.save(),T.ctxTransform(c.p),T.ctxOpacity(c.o)),this.fill){for(c&&c.fc?d!==c.fc&&(T.ctxFillStyle(c.fc),d=c.fc):d!==this.values.fill&&(d=this.values.fill,T.ctxFillStyle(this.values.fill)),m=this.textSpans[e].elem,s=m.length,this.globalData.canvasContext.beginPath(),a=0;a<s;a+=1)for(P=m[a],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),r=2;r<o;r+=6)this.globalData.canvasContext.bezierCurveTo(P[r],P[r+1],P[r+2],P[r+3],P[r+4],P[r+5]);this.globalData.canvasContext.closePath(),T.ctxFill()}if(this.stroke){for(c&&c.sw?f!==c.sw&&(f=c.sw,T.ctxLineWidth(c.sw)):f!==this.values.sWidth&&(f=this.values.sWidth,T.ctxLineWidth(this.values.sWidth)),c&&c.sc?p!==c.sc&&(p=c.sc,T.ctxStrokeStyle(c.sc)):p!==this.values.stroke&&(p=this.values.stroke,T.ctxStrokeStyle(this.values.stroke)),m=this.textSpans[e].elem,s=m.length,this.globalData.canvasContext.beginPath(),a=0;a<s;a+=1)for(P=m[a],o=P.length,this.globalData.canvasContext.moveTo(P[0],P[1]),r=2;r<o;r+=6)this.globalData.canvasContext.bezierCurveTo(P[r],P[r+1],P[r+2],P[r+3],P[r+4],P[r+5]);this.globalData.canvasContext.closePath(),T.ctxStroke()}c&&this.globalData.renderer.restore()}};function CVImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.img=e.imageLoader.getAsset(this.assetData),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var n=createTag("canvas");n.width=this.assetData.w,n.height=this.assetData.h;var e=n.getContext("2d"),i=this.img.width,a=this.img.height,s=i/a,r=this.assetData.w/this.assetData.h,o,l,u=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;s>r&&u==="xMidYMid slice"||s<r&&u!=="xMidYMid slice"?(l=a,o=l*r):(o=i,l=o/r),e.drawImage(this.img,(i-o)/2,(a-l)/2,o,l,0,0,this.assetData.w,this.assetData.h),this.img=n}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null};function CVSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)};function CanvasRendererBase(){}extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(n){return new CVShapeElement(n,this.globalData,this)},CanvasRendererBase.prototype.createText=function(n){return new CVTextElement(n,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(n){return new CVImageElement(n,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(n){return new CVSolidElement(n,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(n){n[0]===1&&n[1]===0&&n[4]===0&&n[5]===1&&n[12]===0&&n[13]===0||this.canvasContext.transform(n[0],n[1],n[4],n[5],n[12],n[13])},CanvasRendererBase.prototype.ctxOpacity=function(n){this.canvasContext.globalAlpha*=n<0?0:n},CanvasRendererBase.prototype.ctxFillStyle=function(n){this.canvasContext.fillStyle=n},CanvasRendererBase.prototype.ctxStrokeStyle=function(n){this.canvasContext.strokeStyle=n},CanvasRendererBase.prototype.ctxLineWidth=function(n){this.canvasContext.lineWidth=n},CanvasRendererBase.prototype.ctxLineCap=function(n){this.canvasContext.lineCap=n},CanvasRendererBase.prototype.ctxLineJoin=function(n){this.canvasContext.lineJoin=n},CanvasRendererBase.prototype.ctxMiterLimit=function(n){this.canvasContext.miterLimit=n},CanvasRendererBase.prototype.ctxFill=function(n){this.canvasContext.fill(n)},CanvasRendererBase.prototype.ctxFillRect=function(n,e,i,a){this.canvasContext.fillRect(n,e,i,a)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}this.contextData.reset()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(n){if(!this.renderConfig.clearCanvas){this.canvasContext.restore();return}n&&(this.globalData.blendMode="source-over"),this.contextData.restore(n)},CanvasRendererBase.prototype.configAnimation=function(n){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var e=this.animationItem.container.style;e.width="100%",e.height="100%";var i="0px 0px 0px";e.transformOrigin=i,e.mozTransformOrigin=i,e.webkitTransformOrigin=i,e["-webkit-transform"]=i,e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=n,this.layers=n.layers,this.transformCanvas={w:n.w,h:n.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(n,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(n.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(n,e){this.reset();var i,a;n?(i=n,a=e,this.canvasContext.canvas.width=i,this.canvasContext.canvas.height=a):(this.animationItem.wrapper&&this.animationItem.container?(i=this.animationItem.wrapper.offsetWidth,a=this.animationItem.wrapper.offsetHeight):(i=this.canvasContext.canvas.width,a=this.canvasContext.canvas.height),this.canvasContext.canvas.width=i*this.renderConfig.dpr,this.canvasContext.canvas.height=a*this.renderConfig.dpr);var s,r;if(this.renderConfig.preserveAspectRatio.indexOf("meet")!==-1||this.renderConfig.preserveAspectRatio.indexOf("slice")!==-1){var o=this.renderConfig.preserveAspectRatio.split(" "),l=o[1]||"meet",u=o[0]||"xMidYMid",c=u.substr(0,4),d=u.substr(4);s=i/a,r=this.transformCanvas.w/this.transformCanvas.h,r>s&&l==="meet"||r<s&&l==="slice"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=a/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=a/(this.transformCanvas.h/this.renderConfig.dpr)),c==="xMid"&&(r<s&&l==="meet"||r>s&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(a/this.transformCanvas.h))/2*this.renderConfig.dpr:c==="xMax"&&(r<s&&l==="meet"||r>s&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(a/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,d==="YMid"&&(r>s&&l==="meet"||r<s&&l==="slice")?this.transformCanvas.ty=(a-this.transformCanvas.h*(i/this.transformCanvas.w))/2*this.renderConfig.dpr:d==="YMax"&&(r>s&&l==="meet"||r<s&&l==="slice")?this.transformCanvas.ty=(a-this.transformCanvas.h*(i/this.transformCanvas.w))*this.renderConfig.dpr:this.transformCanvas.ty=0}else this.renderConfig.preserveAspectRatio==="none"?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=a/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText="");var n,e=this.layers?this.layers.length:0;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(n,e){if(!(this.renderedFrame===n&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||n===-1)){this.renderedFrame=n,this.globalData.frameNum=n-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=n;var i,a=this.layers.length;for(this.completeLayers||this.checkLayers(n),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(n-this.layers[i].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=a-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(n){var e=this.elements;if(!(e[n]||this.layers[n].ty===99)){var i=this.createItem(this.layers[n],this,this.globalData);e[n]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var n,e=15;for(n=0;n<e;n+=1){var i=new CanvasContext;this.stack[n]=i}this._length=e,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}CVContextData.prototype.duplicate=function(){var n=this._length*2,e=0;for(e=this._length;e<n;e+=1)this.stack[e]=new CanvasContext;this._length=n},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(n){this.cArrPos-=1;var e=this.stack[this.cArrPos],i=e.transform,a,s=this.cTr.props;for(a=0;a<16;a+=1)s[a]=i[a];if(n){this.nativeContext.restore();var r=this.stack[this.cArrPos+1];this.appliedFillStyle=r.fillStyle,this.appliedStrokeStyle=r.strokeStyle,this.appliedLineWidth=r.lineWidth,this.appliedLineCap=r.lineCap,this.appliedLineJoin=r.lineJoin,this.appliedMiterLimit=r.miterLimit}this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13]),(n||e.opacity!==-1&&this.currentOpacity!==e.opacity)&&(this.nativeContext.globalAlpha=e.opacity,this.currentOpacity=e.opacity),this.currentFillStyle=e.fillStyle,this.currentStrokeStyle=e.strokeStyle,this.currentLineWidth=e.lineWidth,this.currentLineCap=e.lineCap,this.currentLineJoin=e.lineJoin,this.currentMiterLimit=e.miterLimit},CVContextData.prototype.save=function(n){n&&this.nativeContext.save();var e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var i=this.stack[this.cArrPos],a;for(a=0;a<16;a+=1)i.transform[a]=e[a];this.cArrPos+=1;var s=this.stack[this.cArrPos];s.opacity=i.opacity,s.fillStyle=i.fillStyle,s.strokeStyle=i.strokeStyle,s.lineWidth=i.lineWidth,s.lineCap=i.lineCap,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit},CVContextData.prototype.setOpacity=function(n){this.stack[this.cArrPos].opacity=n},CVContextData.prototype.setContext=function(n){this.nativeContext=n},CVContextData.prototype.fillStyle=function(n){this.stack[this.cArrPos].fillStyle!==n&&(this.currentFillStyle=n,this.stack[this.cArrPos].fillStyle=n)},CVContextData.prototype.strokeStyle=function(n){this.stack[this.cArrPos].strokeStyle!==n&&(this.currentStrokeStyle=n,this.stack[this.cArrPos].strokeStyle=n)},CVContextData.prototype.lineWidth=function(n){this.stack[this.cArrPos].lineWidth!==n&&(this.currentLineWidth=n,this.stack[this.cArrPos].lineWidth=n)},CVContextData.prototype.lineCap=function(n){this.stack[this.cArrPos].lineCap!==n&&(this.currentLineCap=n,this.stack[this.cArrPos].lineCap=n)},CVContextData.prototype.lineJoin=function(n){this.stack[this.cArrPos].lineJoin!==n&&(this.currentLineJoin=n,this.stack[this.cArrPos].lineJoin=n)},CVContextData.prototype.miterLimit=function(n){this.stack[this.cArrPos].miterLimit!==n&&(this.currentMiterLimit=n,this.stack[this.cArrPos].miterLimit=n)},CVContextData.prototype.transform=function(n){this.transformMat.cloneFromProps(n);var e=this.cTr;this.transformMat.multiply(e),e.cloneFromProps(this.transformMat.props);var i=e.props;this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13])},CVContextData.prototype.opacity=function(n){var e=this.stack[this.cArrPos].opacity;e*=n<0?0:n,this.stack[this.cArrPos].opacity!==e&&(this.currentOpacity!==n&&(this.nativeContext.globalAlpha=n,this.currentOpacity=n),this.stack[this.cArrPos].opacity=e)},CVContextData.prototype.fill=function(n){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(n)},CVContextData.prototype.fillRect=function(n,e,i,a){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(n,e,i,a)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()};function CVCompElement(n,e,i){this.completeLayers=!1,this.layers=n.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var n=this.canvasContext;n.beginPath(),n.moveTo(0,0),n.lineTo(this.data.w,0),n.lineTo(this.data.w,this.data.h),n.lineTo(0,this.data.h),n.lineTo(0,0),n.clip();var e,i=this.layers.length;for(e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var n,e=this.layers.length;for(n=e-1;n>=0;n-=1)this.elements[n]&&this.elements[n].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function CanvasRenderer(n,e){this.animationItem=n,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(n){return new CVCompElement(n,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var i=this.finalTransform.mat.toCSS();e.transform=i,e.webkitTransform=i}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(n,e,i){this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var n;this.data.hasMask?(n=createNS("rect"),n.setAttribute("width",this.data.sw),n.setAttribute("height",this.data.sh),n.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(n=createTag("div"),n.style.width=this.data.sw+"px",n.style.height=this.data.sh+"px",n.style.backgroundColor=this.data.sc),this.layerElement.appendChild(n)};function HShapeElement(n,e,i){this.shapes=[],this.shapesData=n.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(n,e,i),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var n;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),n=this.svgElement;else{n=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;n.setAttribute("width",e.w),n.setAttribute("height",e.h),n.appendChild(this.shapesContainer),this.layerElement.appendChild(n)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=n},HShapeElement.prototype.getTransformedPoint=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)e=n[i].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(n,e){var i=n.sh.v,a=n.transformers,s,r=i._length,o,l,u,c;if(!(r<=1)){for(s=0;s<r-1;s+=1)o=this.getTransformedPoint(a,i.v[s]),l=this.getTransformedPoint(a,i.o[s]),u=this.getTransformedPoint(a,i.i[s+1]),c=this.getTransformedPoint(a,i.v[s+1]),this.checkBounds(o,l,u,c,e);i.c&&(o=this.getTransformedPoint(a,i.v[s]),l=this.getTransformedPoint(a,i.o[s]),u=this.getTransformedPoint(a,i.i[0]),c=this.getTransformedPoint(a,i.v[0]),this.checkBounds(o,l,u,c,e))}},HShapeElement.prototype.checkBounds=function(n,e,i,a,s){this.getBoundsOfCurve(n,e,i,a);var r=this.shapeBoundingBox;s.x=bmMin(r.left,s.x),s.xMax=bmMax(r.right,s.xMax),s.y=bmMin(r.top,s.y),s.yMax=bmMax(r.bottom,s.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(n,e,i,a){for(var s=[[n[0],a[0]],[n[1],a[1]]],r,o,l,u,c,d,p,f=0;f<2;++f)o=6*n[f]-12*e[f]+6*i[f],r=-3*n[f]+9*e[f]-9*i[f]+3*a[f],l=3*e[f]-3*n[f],o|=0,r|=0,l|=0,r===0&&o===0||(r===0?(u=-l/o,u>0&&u<1&&s[f].push(this.calculateF(u,n,e,i,a,f))):(c=o*o-4*l*r,c>=0&&(d=(-o+bmSqrt(c))/(2*r),d>0&&d<1&&s[f].push(this.calculateF(d,n,e,i,a,f)),p=(-o-bmSqrt(c))/(2*r),p>0&&p<1&&s[f].push(this.calculateF(p,n,e,i,a,f)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(n,e,i,a,s,r){return bmPow(1-n,3)*e[r]+3*bmPow(1-n,2)*n*i[r]+3*(1-n)*bmPow(n,2)*a[r]+bmPow(n,3)*s[r]},HShapeElement.prototype.calculateBoundingBox=function(n,e){var i,a=n.length;for(i=0;i<a;i+=1)n[i]&&n[i].sh?this.calculateShapeBoundingBox(n[i],e):n[i]&&n[i].it?this.calculateBoundingBox(n[i].it,e):n[i]&&n[i].style&&n[i].w&&this.expandStrokeBoundingBox(n[i].w,e)},HShapeElement.prototype.expandStrokeBoundingBox=function(n,e){var i=0;if(n.keyframes){for(var a=0;a<n.keyframes.length;a+=1){var s=n.keyframes[a].s;s>i&&(i=s)}i*=n.mult}else i=n.v*n.mult;e.x-=i,e.xMax+=i,e.y-=i,e.yMax+=i},HShapeElement.prototype.currentBoxContains=function(n){return this.currentBBox.x<=n.x&&this.currentBBox.y<=n.y&&this.currentBBox.width+this.currentBBox.x>=n.x+n.width&&this.currentBBox.height+this.currentBBox.y>=n.y+n.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var n=this.tempBoundingBox,e=999999;if(n.x=e,n.xMax=-e,n.y=e,n.yMax=-e,this.calculateBoundingBox(this.itemsData,n),n.width=n.xMax<n.x?0:n.xMax-n.x,n.height=n.yMax<n.y?0:n.yMax-n.y,this.currentBoxContains(n))return;var i=!1;if(this.currentBBox.w!==n.width&&(this.currentBBox.w=n.width,this.shapeCont.setAttribute("width",n.width),i=!0),this.currentBBox.h!==n.height&&(this.currentBBox.h=n.height,this.shapeCont.setAttribute("height",n.height),i=!0),i||this.currentBBox.x!==n.x||this.currentBBox.y!==n.y){this.currentBBox.w=n.width,this.currentBBox.h=n.height,this.currentBBox.x=n.x,this.currentBBox.y=n.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var a=this.shapeCont.style,s="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";a.transform=s,a.webkitTransform=s}}};function HTextElement(n,e,i){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var n=createNS("g");this.maskedElement.appendChild(n),this.innerElem=n}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var n=this.textProperty.currentData;this.renderedLetters=createSizedArray(n.l?n.l.length:0);var e=this.innerElem.style,i=n.fc?this.buildColor(n.fc):"rgba(0,0,0,0)";e.fill=i,e.color=i,n.sc&&(e.stroke=this.buildColor(n.sc),e.strokeWidth=n.sw+"px");var a=this.globalData.fontManager.getFontByName(n.f);if(!this.globalData.fontManager.chars)if(e.fontSize=n.finalSize+"px",e.lineHeight=n.finalSize+"px",a.fClass)this.innerElem.className=a.fClass;else{e.fontFamily=a.fFamily;var s=n.fWeight,r=n.fStyle;e.fontStyle=r,e.fontWeight=s}var o,l,u=n.l;l=u.length;var c,d,p,f=this.mHelper,m,P="",T=0;for(o=0;o<l;o+=1){if(this.globalData.fontManager.chars?(this.textPaths[T]?c=this.textPaths[T]:(c=createNS("path"),c.setAttribute("stroke-linecap",lineCapEnum[1]),c.setAttribute("stroke-linejoin",lineJoinEnum[2]),c.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[T]?(d=this.textSpans[T],p=d.children[0]):(d=createTag("div"),d.style.lineHeight=0,p=createNS("svg"),p.appendChild(c),styleDiv(d)))):this.isMasked?c=this.textPaths[T]?this.textPaths[T]:createNS("text"):this.textSpans[T]?(d=this.textSpans[T],c=this.textPaths[T]):(d=createTag("span"),styleDiv(d),c=createTag("span"),styleDiv(c),d.appendChild(c)),this.globalData.fontManager.chars){var x=this.globalData.fontManager.getCharData(n.finalText[o],a.fStyle,this.globalData.fontManager.getFontByName(n.f).fFamily),y;if(x?y=x.data:y=null,f.reset(),y&&y.shapes&&y.shapes.length&&(m=y.shapes[0].it,f.scale(n.finalSize/100,n.finalSize/100),P=this.createPathShape(f,m),c.setAttribute("d",P)),this.isMasked)this.innerElem.appendChild(c);else{if(this.innerElem.appendChild(d),y&&y.shapes){document.body.appendChild(p);var S=p.getBBox();p.setAttribute("width",S.width+2),p.setAttribute("height",S.height+2),p.setAttribute("viewBox",S.x-1+" "+(S.y-1)+" "+(S.width+2)+" "+(S.height+2));var g=p.style,C="translate("+(S.x-1)+"px,"+(S.y-1)+"px)";g.transform=C,g.webkitTransform=C,u[o].yOffset=S.y-1}else p.setAttribute("width",1),p.setAttribute("height",1);d.appendChild(p)}}else if(c.textContent=u[o].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(c);else{this.innerElem.appendChild(d);var E=c.style,B="translate3d(0,"+-n.finalSize/1.2+"px,0)";E.transform=B,E.webkitTransform=B}this.isMasked?this.textSpans[T]=c:this.textSpans[T]=d,this.textSpans[T].style.display="block",this.textPaths[T]=c,T+=1}for(;T<this.textSpans.length;)this.textSpans[T].style.display="none",T+=1},HTextElement.prototype.renderInnerContent=function(){this.validateText();var n;if(this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),n=this.svgElement.style;var e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";n.transform=e,n.webkitTransform=e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),!(!this.lettersChangedFlag&&!this.textAnimator.lettersChangedFlag)){var i,a,s=0,r=this.textAnimator.renderedLetters,o=this.textProperty.currentData.l;a=o.length;var l,u,c;for(i=0;i<a;i+=1)o[i].n?s+=1:(u=this.textSpans[i],c=this.textPaths[i],l=r[s],s+=1,l._mdf.m&&(this.isMasked?u.setAttribute("transform",l.m):(u.style.webkitTransform=l.m,u.style.transform=l.m)),u.style.opacity=l.o,l.sw&&l._mdf.sw&&c.setAttribute("stroke-width",l.sw),l.sc&&l._mdf.sc&&c.setAttribute("stroke",l.sc),l.fc&&l._mdf.fc&&(c.setAttribute("fill",l.fc),c.style.color=l.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var d=this.innerElem.getBBox();this.currentBBox.w!==d.width&&(this.currentBBox.w=d.width,this.svgElement.setAttribute("width",d.width)),this.currentBBox.h!==d.height&&(this.currentBBox.h=d.height,this.svgElement.setAttribute("height",d.height));var p=1;if(this.currentBBox.w!==d.width+p*2||this.currentBBox.h!==d.height+p*2||this.currentBBox.x!==d.x-p||this.currentBBox.y!==d.y-p){this.currentBBox.w=d.width+p*2,this.currentBBox.h=d.height+p*2,this.currentBBox.x=d.x-p,this.currentBBox.y=d.y-p,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),n=this.svgElement.style;var f="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";n.transform=f,n.webkitTransform=f}}}};function HCameraElement(n,e,i){this.initFrame(),this.initBaseData(n,e,i),this.initHierarchy();var a=PropertyFactory.getProp;if(this.pe=a(this,n.pe,0,0,this),n.ks.p.s?(this.px=a(this,n.ks.p.x,1,0,this),this.py=a(this,n.ks.p.y,1,0,this),this.pz=a(this,n.ks.p.z,1,0,this)):this.p=a(this,n.ks.p,1,0,this),n.ks.a&&(this.a=a(this,n.ks.a,1,0,this)),n.ks.or.k.length&&n.ks.or.k[0].to){var s,r=n.ks.or.k.length;for(s=0;s<r;s+=1)n.ks.or.k[s].to=null,n.ks.or.k[s].ti=null}this.or=a(this,n.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=a(this,n.ks.rx,0,degToRads,this),this.ry=a(this,n.ks.ry,0,degToRads,this),this.rz=a(this,n.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var n,e=this.comp.threeDElements.length,i,a,s;for(n=0;n<e;n+=1)if(i=this.comp.threeDElements[n],i.type==="3d"){a=i.perspectiveElem.style,s=i.container.style;var r=this.pe.v+"px",o="0px 0px 0px",l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";a.perspective=r,a.webkitPerspective=r,s.transformOrigin=o,s.mozTransformOrigin=o,s.webkitTransformOrigin=o,a.transform=l,a.webkitTransform=l}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var n=this._isFirstFrame,e,i;if(this.hierarchy)for(i=this.hierarchy.length,e=0;e<i;e+=1)n=this.hierarchy[e].finalTransform.mProp._mdf||n;if(n||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(i=this.hierarchy.length-1,e=i;e>=0;e-=1){var a=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-a.p.v[0],-a.p.v[1],a.p.v[2]),this.mat.rotateX(-a.or.v[0]).rotateY(-a.or.v[1]).rotateZ(a.or.v[2]),this.mat.rotateX(-a.rx.v).rotateY(-a.ry.v).rotateZ(a.rz.v),this.mat.scale(1/a.s.v[0],1/a.s.v[1],1/a.s.v[2]),this.mat.translate(a.a.v[0],a.a.v[1],a.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var r=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),o=[s[0]/r,s[1]/r,s[2]/r],l=Math.sqrt(o[2]*o[2]+o[0]*o[0]),u=Math.atan2(o[1],l),c=Math.atan2(o[0],-o[2]);this.mat.rotateY(c).rotateX(-u)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var d=!this._prevMat.equals(this.mat);if((d||this.pe._mdf)&&this.comp.threeDElements){i=this.comp.threeDElements.length;var p,f,m;for(e=0;e<i;e+=1)if(p=this.comp.threeDElements[e],p.type==="3d"){if(d){var P=this.mat.toCSS();m=p.container.style,m.transform=P,m.webkitTransform=P}this.pe._mdf&&(f=p.perspectiveElem.style,f.perspective=this.pe.v+"px",f.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(n){this.prepareProperties(n,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null};function HImageElement(n,e,i){this.assetData=e.getAssetData(n.refId),this.initElement(n,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var n=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",n),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.crossOrigin="anonymous",e.src=n,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)};function HybridRendererBase(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var n=this.pendingElements.pop();n.checkParenting()}},HybridRendererBase.prototype.appendElementInPos=function(n,e){var i=n.getBaseElement();if(i){var a=this.layers[e];if(!a.ddd||!this.supports3d)if(this.threeDElements)this.addTo3dContainer(i,e);else{for(var s=0,r,o,l;s<e;)this.elements[s]&&this.elements[s]!==!0&&this.elements[s].getBaseElement&&(o=this.elements[s],l=this.layers[s].ddd?this.getThreeDContainerByPos(s):o.getBaseElement(),r=l||r),s+=1;r?(!a.ddd||!this.supports3d)&&this.layerElement.insertBefore(i,r):(!a.ddd||!this.supports3d)&&this.layerElement.appendChild(i)}else this.addTo3dContainer(i,e)}},HybridRendererBase.prototype.createShape=function(n){return this.supports3d?new HShapeElement(n,this.globalData,this):new SVGShapeElement(n,this.globalData,this)},HybridRendererBase.prototype.createText=function(n){return this.supports3d?new HTextElement(n,this.globalData,this):new SVGTextLottieElement(n,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(n){return this.camera=new HCameraElement(n,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(n){return this.supports3d?new HImageElement(n,this.globalData,this):new IImageElement(n,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(n){return this.supports3d?new HSolidElement(n,this.globalData,this):new ISolidElement(n,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(n){for(var e=0,i=this.threeDElements.length;e<i;){if(this.threeDElements[e].startPos<=n&&this.threeDElements[e].endPos>=n)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(n,e){var i=createTag("div"),a,s;styleDiv(i);var r=createTag("div");if(styleDiv(r),e==="3d"){a=i.style,a.width=this.globalData.compSize.w+"px",a.height=this.globalData.compSize.h+"px";var o="50% 50%";a.webkitTransformOrigin=o,a.mozTransformOrigin=o,a.transformOrigin=o,s=r.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}i.appendChild(r);var u={container:r,perspectiveElem:i,startPos:n,endPos:n,type:e};return this.threeDElements.push(u),u},HybridRendererBase.prototype.build3dContainers=function(){var n,e=this.layers.length,i,a="";for(n=0;n<e;n+=1)this.layers[n].ddd&&this.layers[n].ty!==3?(a!=="3d"&&(a="3d",i=this.createThreeDContainer(n,"3d")),i.endPos=Math.max(i.endPos,n)):(a!=="2d"&&(a="2d",i=this.createThreeDContainer(n,"2d")),i.endPos=Math.max(i.endPos,n));for(e=this.threeDElements.length,n=e-1;n>=0;n-=1)this.resizerElem.appendChild(this.threeDElements[n].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(n,e){for(var i=0,a=this.threeDElements.length;i<a;){if(e<=this.threeDElements[i].endPos){for(var s=this.threeDElements[i].startPos,r;s<e;)this.elements[s]&&this.elements[s].getBaseElement&&(r=this.elements[s].getBaseElement()),s+=1;r?this.threeDElements[i].container.insertBefore(n,r):this.threeDElements[i].container.appendChild(n);break}i+=1}},HybridRendererBase.prototype.configAnimation=function(n){var e=createTag("div"),i=this.animationItem.wrapper,a=e.style;a.width=n.w+"px",a.height=n.h+"px",this.resizerElem=e,styleDiv(e),a.transformStyle="flat",a.mozTransformStyle="flat",a.webkitTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),i.appendChild(e),a.overflow="hidden";var s=createNS("svg");s.setAttribute("width","1"),s.setAttribute("height","1"),styleDiv(s),this.resizerElem.appendChild(s);var r=createNS("defs");s.appendChild(r),this.data=n,this.setupGlobalData(n,s),this.globalData.defs=r,this.layers=n.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var n,e=this.layers?this.layers.length:0;for(n=0;n<e;n+=1)this.elements[n]&&this.elements[n].destroy&&this.elements[n].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var n=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight,i=n/e,a=this.globalData.compSize.w/this.globalData.compSize.h,s,r,o,l;a>i?(s=n/this.globalData.compSize.w,r=n/this.globalData.compSize.w,o=0,l=(e-this.globalData.compSize.h*(n/this.globalData.compSize.w))/2):(s=e/this.globalData.compSize.h,r=e/this.globalData.compSize.h,o=(n-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var u=this.resizerElem.style;u.webkitTransform="matrix3d("+s+",0,0,0,0,"+r+",0,0,0,0,1,0,"+o+","+l+",0,1)",u.transform=u.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var n=this.globalData.compSize.w,e=this.globalData.compSize.h,i,a=this.threeDElements.length;for(i=0;i<a;i+=1){var s=this.threeDElements[i].perspectiveElem.style;s.webkitPerspective=Math.sqrt(Math.pow(n,2)+Math.pow(e,2))+"px",s.perspective=s.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(n){var e,i=n.length,a=createTag("div");for(e=0;e<i;e+=1)if(n[e].xt){var s=this.createComp(n[e],a,this.globalData.comp,null);s.initExpressions(),this.globalData.projectInterface.registerComposition(s)}};function HCompElement(n,e,i){this.layers=n.layers,this.supports3d=!n.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(n,e,i),this.tm=n.tm?PropertyFactory.getProp(this,n.tm,0,e.frameRate,this):{_placeholder:!0}}extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(n,e){for(var i=0,a;i<e;)this.elements[i]&&this.elements[i].getBaseElement&&(a=this.elements[i].getBaseElement()),i+=1;a?this.layerElement.insertBefore(n,a):this.layerElement.appendChild(n)},HCompElement.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};function HybridRenderer(n,e){this.animationItem=n,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"},runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(n){return this.supports3d?new HCompElement(n,this.globalData,this):new SVGCompElement(n,this.globalData,this)};var CompExpressionInterface=function(){return function(n){function e(i){for(var a=0,s=n.layers.length;a<s;){if(n.layers[a].nm===i||n.layers[a].ind===i)return n.elements[a].layerInterface;a+=1}return null}return Object.defineProperty(e,"_name",{value:n.data.nm}),e.layer=e,e.pixelAspect=1,e.height=n.data.h||n.globalData.compSize.h,e.width=n.data.w||n.globalData.compSize.w,e.pixelAspect=1,e.frameDuration=1/n.globalData.frameRate,e.displayStartTime=0,e.numLayers=n.layers.length,e}}();function _typeof$2(n){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(n)}function seedRandom(n,e){var i=this,a=256,s=6,r=52,o="random",l=e.pow(a,s),u=e.pow(2,r),c=u*2,d=a-1,p;function f(g,C,E){var B=[];C=C===!0?{entropy:!0}:C||{};var _=x(T(C.entropy?[g,S(n)]:g===null?y():g,3),B),M=new m(B),D=function(){for(var N=M.g(s),F=l,H=0;N<u;)N=(N+H)*a,F*=a,H=M.g(1);for(;N>=c;)N/=2,F/=2,H>>>=1;return(N+H)/F};return D.int32=function(){return M.g(4)|0},D.quick=function(){return M.g(4)/4294967296},D.double=D,x(S(M.S),n),(C.pass||E||function(L,N,F,H){return H&&(H.S&&P(H,M),L.state=function(){return P(M,{})}),F?(e[o]=L,N):L})(D,_,"global"in C?C.global:this==e,C.state)}e["seed"+o]=f;function m(g){var C,E=g.length,B=this,_=0,M=B.i=B.j=0,D=B.S=[];for(E||(g=[E++]);_<a;)D[_]=_++;for(_=0;_<a;_++)D[_]=D[M=d&M+g[_%E]+(C=D[_])],D[M]=C;B.g=function(L){for(var N,F=0,H=B.i,$=B.j,O=B.S;L--;)N=O[H=d&H+1],F=F*a+O[d&(O[H]=O[$=d&$+N])+(O[$]=N)];return B.i=H,B.j=$,F}}function P(g,C){return C.i=g.i,C.j=g.j,C.S=g.S.slice(),C}function T(g,C){var E=[],B=_typeof$2(g),_;if(C&&B=="object")for(_ in g)try{E.push(T(g[_],C-1))}catch{}return E.length?E:B=="string"?g:g+"\0"}function x(g,C){for(var E=g+"",B,_=0;_<E.length;)C[d&_]=d&(B^=C[d&_]*19)+E.charCodeAt(_++);return S(C)}function y(){try{var g=new Uint8Array(a);return(i.crypto||i.msCrypto).getRandomValues(g),S(g)}catch{var C=i.navigator,E=C&&C.plugins;return[+new Date,i,E,i.screen,S(n)]}}function S(g){return String.fromCharCode.apply(0,g)}x(e.random(),n)}function initialize$2(n){seedRandom([],n)}var propTypes={SHAPE:"shape"};function _typeof$1(n){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(n)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};initialize$2(BMMath);function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(n){return n.constructor===Array||n.constructor===Float32Array}function isNumerable(n,e){return n==="number"||e instanceof Number||n==="boolean"||n==="string"}function $bm_neg(n){var e=_typeof$1(n);if(e==="number"||n instanceof Number||e==="boolean")return-n;if($bm_isInstanceOfArray(n)){var i,a=n.length,s=[];for(i=0;i<a;i+=1)s[i]=-n[i];return s}return n.propType?n.v:-n}var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(n,e){var i=_typeof$1(n),a=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(a,e)||i==="string"||a==="string")return n+e;if($bm_isInstanceOfArray(n)&&isNumerable(a,e))return n=n.slice(0),n[0]+=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n+e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var s=0,r=n.length,o=e.length,l=[];s<r||s<o;)(typeof n[s]=="number"||n[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?l[s]=n[s]+e[s]:l[s]=e[s]===void 0?n[s]:n[s]||e[s],s+=1;return l}return 0}var add=sum;function sub(n,e){var i=_typeof$1(n),a=_typeof$1(e);if(isNumerable(i,n)&&isNumerable(a,e))return i==="string"&&(n=parseInt(n,10)),a==="string"&&(e=parseInt(e,10)),n-e;if($bm_isInstanceOfArray(n)&&isNumerable(a,e))return n=n.slice(0),n[0]-=e,n;if(isNumerable(i,n)&&$bm_isInstanceOfArray(e))return e=e.slice(0),e[0]=n-e[0],e;if($bm_isInstanceOfArray(n)&&$bm_isInstanceOfArray(e)){for(var s=0,r=n.length,o=e.length,l=[];s<r||s<o;)(typeof n[s]=="number"||n[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?l[s]=n[s]-e[s]:l[s]=e[s]===void 0?n[s]:n[s]||e[s],s+=1;return l}return 0}function mul(n,e){var i=_typeof$1(n),a=_typeof$1(e),s;if(isNumerable(i,n)&&isNumerable(a,e))return n*e;var r,o;if($bm_isInstanceOfArray(n)&&isNumerable(a,e)){for(o=n.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n[r]*e;return s}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n*e[r];return s}return 0}function div(n,e){var i=_typeof$1(n),a=_typeof$1(e),s;if(isNumerable(i,n)&&isNumerable(a,e))return n/e;var r,o;if($bm_isInstanceOfArray(n)&&isNumerable(a,e)){for(o=n.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n[r]/e;return s}if(isNumerable(i,n)&&$bm_isInstanceOfArray(e)){for(o=e.length,s=createTypedArray("float32",o),r=0;r<o;r+=1)s[r]=n/e[r];return s}return 0}function mod(n,e){return typeof n=="string"&&(n=parseInt(n,10)),typeof e=="string"&&(e=parseInt(e,10)),n%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(n,e,i){if(e>i){var a=i;i=e,e=a}return Math.min(Math.max(n,e),i)}function radiansToDegrees(n){return n/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(n){return n*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(n,e){if(typeof n=="number"||n instanceof Number)return e=e||0,Math.abs(n-e);e||(e=helperLengthArray);var i,a=Math.min(n.length,e.length),s=0;for(i=0;i<a;i+=1)s+=Math.pow(e[i]-n[i],2);return Math.sqrt(s)}function normalize(n){return div(n,length(n))}function rgbToHsl(n){var e=n[0],i=n[1],a=n[2],s=Math.max(e,i,a),r=Math.min(e,i,a),o,l,u=(s+r)/2;if(s===r)o=0,l=0;else{var c=s-r;switch(l=u>.5?c/(2-s-r):c/(s+r),s){case e:o=(i-a)/c+(i<a?6:0);break;case i:o=(a-e)/c+2;break;case a:o=(e-i)/c+4;break}o/=6}return[o,l,u,n[3]]}function hue2rgb(n,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(e-n)*6*i:i<1/2?e:i<2/3?n+(e-n)*(2/3-i)*6:n}function hslToRgb(n){var e=n[0],i=n[1],a=n[2],s,r,o;if(i===0)s=a,o=a,r=a;else{var l=a<.5?a*(1+i):a+i-a*i,u=2*a-l;s=hue2rgb(u,l,e+1/3),r=hue2rgb(u,l,e),o=hue2rgb(u,l,e-1/3)}return[s,r,o,n[3]]}function linear(n,e,i,a,s){if((a===void 0||s===void 0)&&(a=e,s=i,e=0,i=1),i<e){var r=i;i=e,e=r}if(n<=e)return a;if(n>=i)return s;var o=i===e?0:(n-e)/(i-e);if(!a.length)return a+(s-a)*o;var l,u=a.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=a[l]+(s[l]-a[l])*o;return c}function random(n,e){if(e===void 0&&(n===void 0?(n=0,e=1):(e=n,n=void 0)),e.length){var i,a=e.length;n||(n=createTypedArray("float32",a));var s=createTypedArray("float32",a),r=BMMath.random();for(i=0;i<a;i+=1)s[i]=n[i]+r*(e[i]-n[i]);return s}n===void 0&&(n=0);var o=BMMath.random();return n+o*(e-n)}function createPath(n,e,i,a){var s,r=n.length,o=shapePool.newElement();o.setPathData(!!a,r);var l=[0,0],u,c;for(s=0;s<r;s+=1)u=e&&e[s]?e[s]:l,c=i&&i[s]?i[s]:l,o.setTripleAt(n[s][0],n[s][1],c[0]+n[s][0],c[1]+n[s][1],u[0]+n[s][0],u[1]+n[s][1],s,!0);return o}function initiateExpression(elem,data,property){function noOp(n){return n}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=val.indexOf("random")!==-1,elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty._name=elem.data.nm,thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||this.data.hd!==!0,wiggle=(function n(e,i){var a,s,r=this.pv.length?this.pv.length:1,o=createTypedArray("float32",r);e=5;var l=Math.floor(time*e);for(a=0,s=0;a<l;){for(s=0;s<r;s+=1)o[s]+=-i+i*2*BMMath.random();a+=1}var u=time*e,c=u-Math.floor(u),d=createTypedArray("float32",r);if(r>1){for(s=0;s<r;s+=1)d[s]=this.pv[s]+o[s]+(-i+i*2*BMMath.random())*c;return d}return this.pv+o[0]+(-i+i*2*BMMath.random())*c}).bind(this);thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty));function loopInDuration(n,e){return loopIn(n,e,!0)}function loopOutDuration(n,e){return loopOut(n,e,!0)}this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);function lookAt(n,e){var i=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],a=Math.atan2(i[0],Math.sqrt(i[1]*i[1]+i[2]*i[2]))/degToRads,s=-Math.atan2(i[1],i[2])/degToRads;return[s,a,0]}function easeOut(n,e,i,a,s){return applyEase(easeOutBez,n,e,i,a,s)}function easeIn(n,e,i,a,s){return applyEase(easeInBez,n,e,i,a,s)}function ease(n,e,i,a,s){return applyEase(easeInOutBez,n,e,i,a,s)}function applyEase(n,e,i,a,s,r){s===void 0?(s=i,r=a):e=(e-i)/(a-i),e>1?e=1:e<0&&(e=0);var o=n(e);if($bm_isInstanceOfArray(s)){var l,u=s.length,c=createTypedArray("float32",u);for(l=0;l<u;l+=1)c[l]=(r[l]-s[l])*o+s[l];return c}return(r-s)*o+s}function nearestKey(n){var e,i=data.k.length,a,s;if(!data.k.length||typeof data.k[0]=="number")a=0,s=0;else if(a=-1,n*=elem.comp.globalData.frameRate,n<data.k[0].t)a=1,s=data.k[0].t;else{for(e=0;e<i-1;e+=1)if(n===data.k[e].t){a=e+1,s=data.k[e].t;break}else if(n>data.k[e].t&&n<data.k[e+1].t){n-data.k[e].t>data.k[e+1].t-n?(a=e+2,s=data.k[e+1].t):(a=e+1,s=data.k[e].t);break}a===-1&&(a=e+1,s=data.k[e].t)}var r={};return r.index=a,r.time=s/elem.comp.globalData.frameRate,r}function key(n){var e,i,a;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+n);n-=1,e={time:data.k[n].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[n],"s")?data.k[n].s:data.k[n-1].e;for(a=s.length,i=0;i<a;i+=1)e[i]=s[i],e.value[i]=s[i];return e}function framesToTime(n,e){return e||(e=elem.comp.globalData.frameRate),n/e}function timeToFrames(n,e){return!n&&n!==0&&(n=time),e||(e=elem.comp.globalData.frameRate),n*e}function seedRandom(n){BMMath.seedrandom(randSeed+n)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(n,e){return typeof value=="string"?e===void 0?value.substring(n):value.substring(n,e):""}function substr(n,e){return typeof value=="string"?e===void 0?value.substr(n):value.substr(n,e):""}function posterizeTime(n){time=n===0?0:Math.floor(time*n)/n,value=valueAtTime(time)}var time,velocity,value,text,textIndex,textTotal,selectorValue,index=elem.data.ind,hasParent=!!(elem.hierarchy&&elem.hierarchy.length),parent,randSeed=Math.floor(Math.random()*1e6),globalData=elem.globalData;function executeExpression(n){return value=n,this.frameExpressionId===elem.globalData.frameId&&this.propType!=="textSelector"?value:(this.propType==="textSelector"&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),elemType===4&&!content&&(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),hasParent=!!(elem.hierarchy&&elem.hierarchy.length),hasParent&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt,scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob}(),Expressions=function(){var n={};n.initExpressions=e,n.resetFrame=ExpressionManager.resetFrame;function e(i){var a=0,s=[];function r(){a+=1}function o(){a-=1,a===0&&u()}function l(c){s.indexOf(c)===-1&&s.push(c)}function u(){var c,d=s.length;for(c=0;c<d;c+=1)s[c].release();s.length=0}i.renderer.compInterface=CompExpressionInterface(i.renderer),i.renderer.globalData.projectInterface.registerComposition(i.renderer),i.renderer.globalData.pushExpression=r,i.renderer.globalData.popExpression=o,i.renderer.globalData.registerExpressionProperty=l}return n}(),MaskManagerInterface=function(){function n(i,a){this._mask=i,this._data=a}Object.defineProperty(n.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(n.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),this._mask.op.v*100}});var e=function(a){var s=createSizedArray(a.viewData.length),r,o=a.viewData.length;for(r=0;r<o;r+=1)s[r]=new n(a.viewData[r],a.masksProperties[r]);var l=function(c){for(r=0;r<o;){if(a.masksProperties[r].nm===c)return s[r];r+=1}return null};return l};return e}(),ExpressionPropertyInterface=function(){var n={pv:0,v:0,mult:1},e={pv:[0,0,0],v:[0,0,0],mult:1};function i(o,l,u){Object.defineProperty(o,"velocity",{get:function(){return l.getVelocityAtTime(l.comp.currentFrame)}}),o.numKeys=l.keyframes?l.keyframes.length:0,o.key=function(c){if(!o.numKeys)return 0;var d="";"s"in l.keyframes[c-1]?d=l.keyframes[c-1].s:"e"in l.keyframes[c-2]?d=l.keyframes[c-2].e:d=l.keyframes[c-2].s;var p=u==="unidimensional"?new Number(d):Object.assign({},d);return p.time=l.keyframes[c-1].t/l.elem.comp.globalData.frameRate,p.value=u==="unidimensional"?d[0]:d,p},o.valueAtTime=l.getValueAtTime,o.speedAtTime=l.getSpeedAtTime,o.velocityAtTime=l.getVelocityAtTime,o.propertyGroup=l.propertyGroup}function a(o){(!o||!("pv"in o))&&(o=n);var l=1/o.mult,u=o.pv*l,c=new Number(u);return c.value=u,i(c,o,"unidimensional"),function(){return o.k&&o.getValue(),u=o.v*l,c.value!==u&&(c=new Number(u),c.value=u,c[0]=u,i(c,o,"unidimensional")),c}}function s(o){(!o||!("pv"in o))&&(o=e);var l=1/o.mult,u=o.data&&o.data.l||o.pv.length,c=createTypedArray("float32",u),d=createTypedArray("float32",u);return c.value=d,i(c,o,"multidimensional"),function(){o.k&&o.getValue();for(var p=0;p<u;p+=1)d[p]=o.v[p]*l,c[p]=d[p];return c}}function r(){return n}return function(o){return o?o.propType==="unidimensional"?a(o):s(o):r}}(),TransformExpressionInterface=function(){return function(n){function e(o){switch(o){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity;default:return null}}Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(n.r||n.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(n.rz||n.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(n.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(n.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(n.s)});var i,a,s,r;return n.p?r=ExpressionPropertyInterface(n.p):(i=ExpressionPropertyInterface(n.px),a=ExpressionPropertyInterface(n.py),n.pz&&(s=ExpressionPropertyInterface(n.pz))),Object.defineProperty(e,"position",{get:function(){return n.p?r():[i(),a(),s?s():0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(n.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(n.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(n.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(n.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(n.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(n.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(n.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(n.or)}),e}}(),LayerExpressionInterface=function(){function n(c){var d=new Matrix;if(c!==void 0){var p=this._elem.finalTransform.mProp.getValueAtTime(c);p.clone(d)}else{var f=this._elem.finalTransform.mProp;f.applyToMatrix(d)}return d}function e(c,d){var p=this.getMatrix(d);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.applyPoint(p,c)}function i(c,d){var p=this.getMatrix(d);return this.applyPoint(p,c)}function a(c,d){var p=this.getMatrix(d);return p.props[12]=0,p.props[13]=0,p.props[14]=0,this.invertPoint(p,c)}function s(c,d){var p=this.getMatrix(d);return this.invertPoint(p,c)}function r(c,d){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.applyToPointArray(d[0],d[1],d[2]||0)}function o(c,d){if(this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(c)}return c.inversePoint(d)}function l(c){var d=new Matrix;if(d.reset(),this._elem.finalTransform.mProp.applyToMatrix(d),this._elem.hierarchy&&this._elem.hierarchy.length){var p,f=this._elem.hierarchy.length;for(p=0;p<f;p+=1)this._elem.hierarchy[p].finalTransform.mProp.applyToMatrix(d);return d.inversePoint(c)}return d.inversePoint(c)}function u(){return[1,1,1,1]}return function(c){var d;function p(T){m.mask=new MaskManagerInterface(T,c)}function f(T){m.effect=T}function m(T){switch(T){case"ADBE Root Vectors Group":case"Contents":case 2:return m.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return d;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return m.effect;case"ADBE Text Properties":return m.textInterface;default:return null}}m.getMatrix=n,m.invertPoint=o,m.applyPoint=r,m.toWorld=i,m.toWorldVec=e,m.fromWorld=s,m.fromWorldVec=a,m.toComp=i,m.fromComp=l,m.sampleImage=u,m.sourceRectAtTime=c.sourceRectAtTime.bind(c),m._elem=c,d=TransformExpressionInterface(c.finalTransform.mProp);var P=getDescriptor(d,"anchorPoint");return Object.defineProperties(m,{hasParent:{get:function(){return c.hierarchy.length}},parent:{get:function(){return c.hierarchy[0].layerInterface}},rotation:getDescriptor(d,"rotation"),scale:getDescriptor(d,"scale"),position:getDescriptor(d,"position"),opacity:getDescriptor(d,"opacity"),anchorPoint:P,anchor_point:P,transform:{get:function(){return d}},active:{get:function(){return c.isInRange}}}),m.startTime=c.data.st,m.index=c.data.ind,m.source=c.data.refId,m.height=c.data.ty===0?c.data.h:100,m.width=c.data.ty===0?c.data.w:100,m.inPoint=c.data.ip/c.comp.globalData.frameRate,m.outPoint=c.data.op/c.comp.globalData.frameRate,m._name=c.data.nm,m.registerMaskInterface=p,m.registerEffectsInterface=f,m}}(),propertyGroupFactory=function(){return function(n,e){return function(i){return i=i===void 0?1:i,i<=0?n:e(i-1)}}}(),PropertyInterface=function(){return function(n,e){var i={_name:n};function a(s){return s=s===void 0?1:s,s<=0?i:e(s-1)}return a}}(),EffectsExpressionInterface=function(){var n={createEffectsInterface:e};function e(s,r){if(s.effectsManager){var o=[],l=s.data.ef,u,c=s.effectsManager.effectElements.length;for(u=0;u<c;u+=1)o.push(i(l[u],s.effectsManager.effectElements[u],r,s));var d=s.data.ef||[],p=function(m){for(u=0,c=d.length;u<c;){if(m===d[u].nm||m===d[u].mn||m===d[u].ix)return o[u];u+=1}return null};return Object.defineProperty(p,"numProperties",{get:function(){return d.length}}),p}return null}function i(s,r,o,l){function u(m){for(var P=s.ef,T=0,x=P.length;T<x;){if(m===P[T].nm||m===P[T].mn||m===P[T].ix)return P[T].ty===5?d[T]:d[T]();T+=1}throw new Error}var c=propertyGroupFactory(u,o),d=[],p,f=s.ef.length;for(p=0;p<f;p+=1)s.ef[p].ty===5?d.push(i(s.ef[p],r.effectElements[p],r.effectElements[p].propertyGroup,l)):d.push(a(r.effectElements[p],s.ef[p].ty,l,c));return s.mn==="ADBE Color Control"&&Object.defineProperty(u,"color",{get:function(){return d[0]()}}),Object.defineProperties(u,{numProperties:{get:function(){return s.np}},_name:{value:s.nm},propertyGroup:{value:c}}),u.enabled=s.en!==0,u.active=u.enabled,u}function a(s,r,o,l){var u=ExpressionPropertyInterface(s.p);function c(){return r===10?o.comp.compInterface(s.p.v):u()}return s.p.setGroupProperty&&s.p.setGroupProperty(PropertyInterface("",l)),c}return n}(),ShapePathInterface=function(){return function(e,i,a){var s=i.sh;function r(l){return l==="Shape"||l==="shape"||l==="Path"||l==="path"||l==="ADBE Vector Shape"||l===2?r.path:null}var o=propertyGroupFactory(r,a);return s.setGroupProperty(PropertyInterface("Path",o)),Object.defineProperties(r,{path:{get:function(){return s.k&&s.getValue(),s}},shape:{get:function(){return s.k&&s.getValue(),s}},_name:{value:e.nm},ix:{value:e.ix},propertyIndex:{value:e.ix},mn:{value:e.mn},propertyGroup:{value:a}}),r}}(),ShapeExpressionInterface=function(){function n(P,T,x){var y=[],S,g=P?P.length:0;for(S=0;S<g;S+=1)P[S].ty==="gr"?y.push(i(P[S],T[S],x)):P[S].ty==="fl"?y.push(a(P[S],T[S],x)):P[S].ty==="st"?y.push(o(P[S],T[S],x)):P[S].ty==="tm"?y.push(l(P[S],T[S],x)):P[S].ty==="tr"||(P[S].ty==="el"?y.push(c(P[S],T[S],x)):P[S].ty==="sr"?y.push(d(P[S],T[S],x)):P[S].ty==="sh"?y.push(ShapePathInterface(P[S],T[S],x)):P[S].ty==="rc"?y.push(p(P[S],T[S],x)):P[S].ty==="rd"?y.push(f(P[S],T[S],x)):P[S].ty==="rp"?y.push(m(P[S],T[S],x)):P[S].ty==="gf"?y.push(s(P[S],T[S],x)):y.push(r(P[S],T[S])));return y}function e(P,T,x){var y,S=function(E){for(var B=0,_=y.length;B<_;){if(y[B]._name===E||y[B].mn===E||y[B].propertyIndex===E||y[B].ix===E||y[B].ind===E)return y[B];B+=1}return typeof E=="number"?y[E-1]:null};S.propertyGroup=propertyGroupFactory(S,x),y=n(P.it,T.it,S.propertyGroup),S.numProperties=y.length;var g=u(P.it[P.it.length-1],T.it[T.it.length-1],S.propertyGroup);return S.transform=g,S.propertyIndex=P.cix,S._name=P.nm,S}function i(P,T,x){var y=function(E){switch(E){case"ADBE Vectors Group":case"Contents":case 2:return y.content;default:return y.transform}};y.propertyGroup=propertyGroupFactory(y,x);var S=e(P,T,y.propertyGroup),g=u(P.it[P.it.length-1],T.it[T.it.length-1],y.propertyGroup);return y.content=S,y.transform=g,Object.defineProperty(y,"_name",{get:function(){return P.nm}}),y.numProperties=P.np,y.propertyIndex=P.ix,y.nm=P.nm,y.mn=P.mn,y}function a(P,T,x){function y(S){return S==="Color"||S==="color"?y.color:S==="Opacity"||S==="opacity"?y.opacity:null}return Object.defineProperties(y,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function s(P,T,x){function y(S){return S==="Start Point"||S==="start point"?y.startPoint:S==="End Point"||S==="end point"?y.endPoint:S==="Opacity"||S==="opacity"?y.opacity:null}return Object.defineProperties(y,{startPoint:{get:ExpressionPropertyInterface(T.s)},endPoint:{get:ExpressionPropertyInterface(T.e)},opacity:{get:ExpressionPropertyInterface(T.o)},type:{get:function(){return"a"}},_name:{value:P.nm},mn:{value:P.mn}}),T.s.setGroupProperty(PropertyInterface("Start Point",x)),T.e.setGroupProperty(PropertyInterface("End Point",x)),T.o.setGroupProperty(PropertyInterface("Opacity",x)),y}function r(){function P(){return null}return P}function o(P,T,x){var y=propertyGroupFactory(_,x),S=propertyGroupFactory(B,y);function g(M){Object.defineProperty(B,P.d[M].nm,{get:ExpressionPropertyInterface(T.d.dataProps[M].p)})}var C,E=P.d?P.d.length:0,B={};for(C=0;C<E;C+=1)g(C),T.d.dataProps[C].p.setGroupProperty(S);function _(M){return M==="Color"||M==="color"?_.color:M==="Opacity"||M==="opacity"?_.opacity:M==="Stroke Width"||M==="stroke width"?_.strokeWidth:null}return Object.defineProperties(_,{color:{get:ExpressionPropertyInterface(T.c)},opacity:{get:ExpressionPropertyInterface(T.o)},strokeWidth:{get:ExpressionPropertyInterface(T.w)},dash:{get:function(){return B}},_name:{value:P.nm},mn:{value:P.mn}}),T.c.setGroupProperty(PropertyInterface("Color",y)),T.o.setGroupProperty(PropertyInterface("Opacity",y)),T.w.setGroupProperty(PropertyInterface("Stroke Width",y)),_}function l(P,T,x){function y(g){return g===P.e.ix||g==="End"||g==="end"?y.end:g===P.s.ix?y.start:g===P.o.ix?y.offset:null}var S=propertyGroupFactory(y,x);return y.propertyIndex=P.ix,T.s.setGroupProperty(PropertyInterface("Start",S)),T.e.setGroupProperty(PropertyInterface("End",S)),T.o.setGroupProperty(PropertyInterface("Offset",S)),y.propertyIndex=P.ix,y.propertyGroup=x,Object.defineProperties(y,{start:{get:ExpressionPropertyInterface(T.s)},end:{get:ExpressionPropertyInterface(T.e)},offset:{get:ExpressionPropertyInterface(T.o)},_name:{value:P.nm}}),y.mn=P.mn,y}function u(P,T,x){function y(g){return P.a.ix===g||g==="Anchor Point"?y.anchorPoint:P.o.ix===g||g==="Opacity"?y.opacity:P.p.ix===g||g==="Position"?y.position:P.r.ix===g||g==="Rotation"||g==="ADBE Vector Rotation"?y.rotation:P.s.ix===g||g==="Scale"?y.scale:P.sk&&P.sk.ix===g||g==="Skew"?y.skew:P.sa&&P.sa.ix===g||g==="Skew Axis"?y.skewAxis:null}var S=propertyGroupFactory(y,x);return T.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",S)),T.transform.mProps.p.setGroupProperty(PropertyInterface("Position",S)),T.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",S)),T.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",S)),T.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",S)),T.transform.mProps.sk&&(T.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",S)),T.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",S))),T.transform.op.setGroupProperty(PropertyInterface("Opacity",S)),Object.defineProperties(y,{opacity:{get:ExpressionPropertyInterface(T.transform.mProps.o)},position:{get:ExpressionPropertyInterface(T.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(T.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(T.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(T.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(T.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(T.transform.mProps.sa)},_name:{value:P.nm}}),y.ty="tr",y.mn=P.mn,y.propertyGroup=x,y}function c(P,T,x){function y(C){return P.p.ix===C?y.position:P.s.ix===C?y.size:null}var S=propertyGroupFactory(y,x);y.propertyIndex=P.ix;var g=T.sh.ty==="tm"?T.sh.prop:T.sh;return g.s.setGroupProperty(PropertyInterface("Size",S)),g.p.setGroupProperty(PropertyInterface("Position",S)),Object.defineProperties(y,{size:{get:ExpressionPropertyInterface(g.s)},position:{get:ExpressionPropertyInterface(g.p)},_name:{value:P.nm}}),y.mn=P.mn,y}function d(P,T,x){function y(C){return P.p.ix===C?y.position:P.r.ix===C?y.rotation:P.pt.ix===C?y.points:P.or.ix===C||C==="ADBE Vector Star Outer Radius"?y.outerRadius:P.os.ix===C?y.outerRoundness:P.ir&&(P.ir.ix===C||C==="ADBE Vector Star Inner Radius")?y.innerRadius:P.is&&P.is.ix===C?y.innerRoundness:null}var S=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.or.setGroupProperty(PropertyInterface("Outer Radius",S)),g.os.setGroupProperty(PropertyInterface("Outer Roundness",S)),g.pt.setGroupProperty(PropertyInterface("Points",S)),g.p.setGroupProperty(PropertyInterface("Position",S)),g.r.setGroupProperty(PropertyInterface("Rotation",S)),P.ir&&(g.ir.setGroupProperty(PropertyInterface("Inner Radius",S)),g.is.setGroupProperty(PropertyInterface("Inner Roundness",S))),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},rotation:{get:ExpressionPropertyInterface(g.r)},points:{get:ExpressionPropertyInterface(g.pt)},outerRadius:{get:ExpressionPropertyInterface(g.or)},outerRoundness:{get:ExpressionPropertyInterface(g.os)},innerRadius:{get:ExpressionPropertyInterface(g.ir)},innerRoundness:{get:ExpressionPropertyInterface(g.is)},_name:{value:P.nm}}),y.mn=P.mn,y}function p(P,T,x){function y(C){return P.p.ix===C?y.position:P.r.ix===C?y.roundness:P.s.ix===C||C==="Size"||C==="ADBE Vector Rect Size"?y.size:null}var S=propertyGroupFactory(y,x),g=T.sh.ty==="tm"?T.sh.prop:T.sh;return y.propertyIndex=P.ix,g.p.setGroupProperty(PropertyInterface("Position",S)),g.s.setGroupProperty(PropertyInterface("Size",S)),g.r.setGroupProperty(PropertyInterface("Rotation",S)),Object.defineProperties(y,{position:{get:ExpressionPropertyInterface(g.p)},roundness:{get:ExpressionPropertyInterface(g.r)},size:{get:ExpressionPropertyInterface(g.s)},_name:{value:P.nm}}),y.mn=P.mn,y}function f(P,T,x){function y(C){return P.r.ix===C||C==="Round Corners 1"?y.radius:null}var S=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.rd.setGroupProperty(PropertyInterface("Radius",S)),Object.defineProperties(y,{radius:{get:ExpressionPropertyInterface(g.rd)},_name:{value:P.nm}}),y.mn=P.mn,y}function m(P,T,x){function y(C){return P.c.ix===C||C==="Copies"?y.copies:P.o.ix===C||C==="Offset"?y.offset:null}var S=propertyGroupFactory(y,x),g=T;return y.propertyIndex=P.ix,g.c.setGroupProperty(PropertyInterface("Copies",S)),g.o.setGroupProperty(PropertyInterface("Offset",S)),Object.defineProperties(y,{copies:{get:ExpressionPropertyInterface(g.c)},offset:{get:ExpressionPropertyInterface(g.o)},_name:{value:P.nm}}),y.mn=P.mn,y}return function(P,T,x){var y;function S(C){if(typeof C=="number")return C=C===void 0?1:C,C===0?x:y[C-1];for(var E=0,B=y.length;E<B;){if(y[E]._name===C)return y[E];E+=1}return null}function g(){return x}return S.propertyGroup=propertyGroupFactory(S,g),y=n(P,T,S.propertyGroup),S.numProperties=y.length,S._name="Contents",S}}(),TextExpressionInterface=function(){return function(n){var e;function i(a){switch(a){case"ADBE Text Document":return i.sourceText;default:return null}}return Object.defineProperty(i,"sourceText",{get:function(){n.textProperty.getValue();var s=n.textProperty.currentData.t;return(!e||s!==e.value)&&(e=new String(s),e.value=s||new String(s),Object.defineProperty(e,"style",{get:function(){return{fillColor:n.textProperty.currentData.fc}}})),e}}),i}}();function _typeof(n){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(n)}var FootageInterface=function(){var n=function(a){var s="",r=a.getFootageData();function o(){return s="",r=a.getFootageData(),l}function l(u){if(r[u])return s=u,r=r[u],_typeof(r)==="object"?l:r;var c=u.indexOf(s);if(c!==-1){var d=parseInt(u.substr(c+s.length),10);return r=r[d],_typeof(r)==="object"?l:r}return""}return o},e=function(a){function s(r){return r==="Outline"?s.outlineInterface():null}return s._name="Outline",s.outlineInterface=n(a),s};return function(i){function a(s){return s==="Data"?a.dataInterface:null}return a._name="Data",a.dataInterface=e(i),a}}(),interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(n){return interfaces[n]||null}var expressionHelpers=function(){function n(o,l,u){l.x&&(u.k=!0,u.x=!0,u.initiateExpression=ExpressionManager.initiateExpression,u.effectsSequence.push(u.initiateExpression(o,l,u).bind(u)))}function e(o){return o*=this.elem.globalData.frameRate,o-=this.offsetTime,o!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<o?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(o,this._cachingAtTime),this._cachingAtTime.lastFrame=o),this._cachingAtTime.value}function i(o){var l=-.01,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),d=0;if(u.length){var p;for(p=0;p<u.length;p+=1)d+=Math.pow(c[p]-u[p],2);d=Math.sqrt(d)*100}else d=0;return d}function a(o){if(this.vel!==void 0)return this.vel;var l=-.001,u=this.getValueAtTime(o),c=this.getValueAtTime(o+l),d;if(u.length){d=createTypedArray("float32",u.length);var p;for(p=0;p<u.length;p+=1)d[p]=(c[p]-u[p])/l}else d=(c-u)/l;return d}function s(){return this.pv}function r(o){this.propertyGroup=o}return{searchExpressions:n,getSpeedAtTime:i,getVelocityAtTime:a,getValueAtTime:e,getStaticValueAtTime:s,setGroupProperty:r}}();function addPropertyDecorator(){function n(f,m,P){if(!this.k||!this.keyframes)return this.pv;f=f?f.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[x.length-1].t;if(T<=y)return this.pv;var S,g;P?(m?S=Math.abs(y-this.elem.comp.globalData.frameRate*m):S=Math.max(0,y-this.elem.data.ip),g=y-S):((!m||m>x.length-1)&&(m=x.length-1),g=x[x.length-1-m].t,S=y-g);var C,E,B;if(f==="pingpong"){var _=Math.floor((T-g)/S);if(_%2!==0)return this.getValueAtTime((S-(T-g)%S+g)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var M=this.getValueAtTime(g/this.comp.globalData.frameRate,0),D=this.getValueAtTime(y/this.comp.globalData.frameRate,0),L=this.getValueAtTime(((T-g)%S+g)/this.comp.globalData.frameRate,0),N=Math.floor((T-g)/S);if(this.pv.length){for(B=new Array(M.length),E=B.length,C=0;C<E;C+=1)B[C]=(D[C]-M[C])*N+L[C];return B}return(D-M)*N+L}else if(f==="continue"){var F=this.getValueAtTime(y/this.comp.globalData.frameRate,0),H=this.getValueAtTime((y-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(B=new Array(F.length),E=B.length,C=0;C<E;C+=1)B[C]=F[C]+(F[C]-H[C])*((T-y)/this.comp.globalData.frameRate)/5e-4;return B}return F+(F-H)*((T-y)/.001)}return this.getValueAtTime(((T-g)%S+g)/this.comp.globalData.frameRate,0)}function e(f,m,P){if(!this.k)return this.pv;f=f?f.toLowerCase():"";var T=this.comp.renderedFrame,x=this.keyframes,y=x[0].t;if(T>=y)return this.pv;var S,g;P?(m?S=Math.abs(this.elem.comp.globalData.frameRate*m):S=Math.max(0,this.elem.data.op-y),g=y+S):((!m||m>x.length-1)&&(m=x.length-1),g=x[m].t,S=g-y);var C,E,B;if(f==="pingpong"){var _=Math.floor((y-T)/S);if(_%2===0)return this.getValueAtTime(((y-T)%S+y)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var M=this.getValueAtTime(y/this.comp.globalData.frameRate,0),D=this.getValueAtTime(g/this.comp.globalData.frameRate,0),L=this.getValueAtTime((S-(y-T)%S+y)/this.comp.globalData.frameRate,0),N=Math.floor((y-T)/S)+1;if(this.pv.length){for(B=new Array(M.length),E=B.length,C=0;C<E;C+=1)B[C]=L[C]-(D[C]-M[C])*N;return B}return L-(D-M)*N}else if(f==="continue"){var F=this.getValueAtTime(y/this.comp.globalData.frameRate,0),H=this.getValueAtTime((y+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(B=new Array(F.length),E=B.length,C=0;C<E;C+=1)B[C]=F[C]+(F[C]-H[C])*(y-T)/.001;return B}return F+(F-H)*(y-T)/.001}return this.getValueAtTime((S-((y-T)%S+y))/this.comp.globalData.frameRate,0)}function i(f,m){if(!this.k)return this.pv;if(f=(f||.4)*.5,m=Math.floor(m||5),m<=1)return this.pv;var P=this.comp.renderedFrame/this.comp.globalData.frameRate,T=P-f,x=P+f,y=m>1?(x-T)/(m-1):1,S=0,g=0,C;this.pv.length?C=createTypedArray("float32",this.pv.length):C=0;for(var E;S<m;){if(E=this.getValueAtTime(T+S*y),this.pv.length)for(g=0;g<this.pv.length;g+=1)C[g]+=E[g];else C+=E;S+=1}if(this.pv.length)for(g=0;g<this.pv.length;g+=1)C[g]/=m;else C/=m;return C}function a(f){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var m=this._transformCachingAtTime.v;if(m.cloneFromProps(this.pre.props),this.appliedTransformations<1){var P=this.a.getValueAtTime(f);m.translate(-P[0]*this.a.mult,-P[1]*this.a.mult,P[2]*this.a.mult)}if(this.appliedTransformations<2){var T=this.s.getValueAtTime(f);m.scale(T[0]*this.s.mult,T[1]*this.s.mult,T[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var x=this.sk.getValueAtTime(f),y=this.sa.getValueAtTime(f);m.skewFromAxis(-x*this.sk.mult,y*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var S=this.r.getValueAtTime(f);m.rotate(-S*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var g=this.rz.getValueAtTime(f),C=this.ry.getValueAtTime(f),E=this.rx.getValueAtTime(f),B=this.or.getValueAtTime(f);m.rotateZ(-g*this.rz.mult).rotateY(C*this.ry.mult).rotateX(E*this.rx.mult).rotateZ(-B[2]*this.or.mult).rotateY(B[1]*this.or.mult).rotateX(B[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var _=this.px.getValueAtTime(f),M=this.py.getValueAtTime(f);if(this.data.p.z){var D=this.pz.getValueAtTime(f);m.translate(_*this.px.mult,M*this.py.mult,-D*this.pz.mult)}else m.translate(_*this.px.mult,M*this.py.mult,0)}else{var L=this.p.getValueAtTime(f);m.translate(L[0]*this.p.mult,L[1]*this.p.mult,-L[2]*this.p.mult)}return m}function s(){return this.v.clone(new Matrix)}var r=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(f,m,P){var T=r(f,m,P);return T.dynamicProperties.length?T.getValueAtTime=a.bind(T):T.getValueAtTime=s.bind(T),T.setGroupProperty=expressionHelpers.setGroupProperty,T};var o=PropertyFactory.getProp;PropertyFactory.getProp=function(f,m,P,T,x){var y=o(f,m,P,T,x);y.kf?y.getValueAtTime=expressionHelpers.getValueAtTime.bind(y):y.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(y),y.setGroupProperty=expressionHelpers.setGroupProperty,y.loopOut=n,y.loopIn=e,y.smooth=i,y.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(y),y.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(y),y.numKeys=m.a===1?m.k.length:0,y.propertyIndex=m.ix;var S=0;return P!==0&&(S=createTypedArray("float32",m.a===1?m.k[0].s.length:m.k.length)),y._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:S},expressionHelpers.searchExpressions(f,m,y),y.k&&x.addDynamicProperty(y),y};function l(f){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),f*=this.elem.globalData.frameRate,f-=this.offsetTime,f!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<f?this._caching.lastIndex:0,this._cachingAtTime.lastTime=f,this.interpolateShape(f,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue}var u=ShapePropertyFactory.getConstructorFunction(),c=ShapePropertyFactory.getKeyframedConstructorFunction();function d(){}d.prototype={vertices:function(m,P){this.k&&this.getValue();var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0));var x,y=T._length,S=T[m],g=T.v,C=createSizedArray(y);for(x=0;x<y;x+=1)m==="i"||m==="o"?C[x]=[S[x][0]-g[x][0],S[x][1]-g[x][1]]:C[x]=[S[x][0],S[x][1]];return C},points:function(m){return this.vertices("v",m)},inTangents:function(m){return this.vertices("i",m)},outTangents:function(m){return this.vertices("o",m)},isClosed:function(){return this.v.c},pointOnPath:function(m,P){var T=this.v;P!==void 0&&(T=this.getValueAtTime(P,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(T));for(var x=this._segmentsLength,y=x.lengths,S=x.totalLength*m,g=0,C=y.length,E=0,B;g<C;){if(E+y[g].addedLength>S){var _=g,M=T.c&&g===C-1?0:g+1,D=(S-E)/y[g].addedLength;B=bez.getPointInSegment(T.v[_],T.v[M],T.o[_],T.i[M],D,y[g]);break}else E+=y[g].addedLength;g+=1}return B||(B=T.c?[T.v[0][0],T.v[0][1]]:[T.v[T._length-1][0],T.v[T._length-1][1]]),B},vectorOnPath:function(m,P,T){m==1?m=this.v.c:m==0&&(m=.999);var x=this.pointOnPath(m,P),y=this.pointOnPath(m+.001,P),S=y[0]-x[0],g=y[1]-x[1],C=Math.sqrt(Math.pow(S,2)+Math.pow(g,2));if(C===0)return[0,0];var E=T==="tangent"?[S/C,g/C]:[-g/C,S/C];return E},tangentOnPath:function(m,P){return this.vectorOnPath(m,P,"tangent")},normalOnPath:function(m,P){return this.vectorOnPath(m,P,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([d],u),extendPrototype([d],c),c.prototype.getValueAtTime=l,c.prototype.initiateExpression=ExpressionManager.initiateExpression;var p=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(f,m,P,T,x){var y=p(f,m,P,T,x);return y.propertyIndex=m.ix,y.lock=!1,P===3?expressionHelpers.searchExpressions(f,m.pt,y):P===4&&expressionHelpers.searchExpressions(f,m.ks,y),y.k&&f.addDynamicProperty(y),y}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function n(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,i){var a=this.calculateExpression(i);if(e.t!==a){var s={};return this.copyData(s,e),s.t=a.toString(),s.__complete=!1,s}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),i=this.searchExpressions();return this.kf=e||i,this.kf},TextProperty.prototype.searchExpressions=n}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function n(e,i){var a=createNS("feMerge");a.setAttribute("result",e);var s,r;for(r=0;r<i.length;r+=1)s=createNS("feMergeNode"),s.setAttribute("in",i[r]),a.appendChild(s),a.appendChild(s);return a}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(n,e,i,a,s){this.filterManager=e;var r=createNS("feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","linearRGB"),r.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=r,r.setAttribute("result",a+"_tint_1"),n.appendChild(r),r=createNS("feColorMatrix"),r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),r.setAttribute("result",a+"_tint_2"),n.appendChild(r),this.matrixFilter=r;var o=this.createMergeNode(a,[s,a+"_tint_1",a+"_tint_2"]);n.appendChild(o)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,a=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+a+" 0"),this.matrixFilter.setAttribute("values",i[0]-e[0]+" 0 0 0 "+e[0]+" "+(i[1]-e[1])+" 0 0 0 "+e[1]+" "+(i[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 1 0")}};function SVGFillFilter(n,e,i,a){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),s.setAttribute("result",a),n.appendChild(s),this.matrixFilter=s}SVGFillFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,i=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+i+" 0")}};function SVGStrokeEffect(n,e,i){this.initialized=!1,this.filterManager=e,this.elem=i,this.paths=[]}SVGStrokeEffect.prototype.initialize=function(){var n=this.elem.layerElement.children||this.elem.layerElement.childNodes,e,i,a,s;for(this.filterManager.effectElements[1].p.v===1?(s=this.elem.maskManager.masksProperties.length,a=0):(a=this.filterManager.effectElements[0].p.v-1,s=a+1),i=createNS("g"),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-dashoffset",1),a;a<s;a+=1)e=createNS("path"),i.appendChild(e),this.paths.push({p:e,m:a});if(this.filterManager.effectElements[10].p.v===3){var r=createNS("mask"),o=createElementID();r.setAttribute("id",o),r.setAttribute("mask-type","alpha"),r.appendChild(i),this.elem.globalData.defs.appendChild(r);var l=createNS("g");for(l.setAttribute("mask","url("+getLocationHref()+"#"+o+")");n[0];)l.appendChild(n[0]);this.elem.layerElement.appendChild(l),this.masker=r,i.setAttribute("stroke","#fff")}else if(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2){if(this.filterManager.effectElements[10].p.v===2)for(n=this.elem.layerElement.children||this.elem.layerElement.childNodes;n.length;)this.elem.layerElement.removeChild(n[0]);this.elem.layerElement.appendChild(i),this.elem.layerElement.removeAttribute("mask"),i.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=i},SVGStrokeEffect.prototype.renderFrame=function(n){this.initialized||this.initialize();var e,i=this.paths.length,a,s;for(e=0;e<i;e+=1)if(this.paths[e].m!==-1&&(a=this.elem.maskManager.viewData[this.paths[e].m],s=this.paths[e].p,(n||this.filterManager._mdf||a.prop._mdf)&&s.setAttribute("d",a.lastPath),n||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||a.prop._mdf)){var r;if(this.filterManager.effectElements[7].p.v!==0||this.filterManager.effectElements[8].p.v!==100){var o=Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,l=Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)*.01,u=s.getTotalLength();r="0 0 0 "+u*o+" ";var c=u*(l-o),d=1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01,p=Math.floor(c/d),f;for(f=0;f<p;f+=1)r+="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01+" ";r+="0 "+u*10+" 0 0"}else r="1 "+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v*.01;s.setAttribute("stroke-dasharray",r)}if((n||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",this.filterManager.effectElements[4].p.v*2),(n||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2)&&(n||this.filterManager.effectElements[3].p._mdf)){var m=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(m[0]*255)+","+bmFloor(m[1]*255)+","+bmFloor(m[2]*255)+")")}};function SVGTritoneFilter(n,e,i,a){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","linearRGB"),s.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),n.appendChild(s);var r=createNS("feComponentTransfer");r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("result",a),this.matrixFilter=r;var o=createNS("feFuncR");o.setAttribute("type","table"),r.appendChild(o),this.feFuncR=o;var l=createNS("feFuncG");l.setAttribute("type","table"),r.appendChild(l),this.feFuncG=l;var u=createNS("feFuncB");u.setAttribute("type","table"),r.appendChild(u),this.feFuncB=u,n.appendChild(r)}SVGTritoneFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,a=this.filterManager.effectElements[2].p.v,s=a[0]+" "+i[0]+" "+e[0],r=a[1]+" "+i[1]+" "+e[1],o=a[2]+" "+i[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",s),this.feFuncG.setAttribute("tableValues",r),this.feFuncB.setAttribute("tableValues",o)}};function SVGProLevelsFilter(n,e,i,a){this.filterManager=e;var s=this.filterManager.effectElements,r=createNS("feComponentTransfer");(s[10].p.k||s[10].p.v!==0||s[11].p.k||s[11].p.v!==1||s[12].p.k||s[12].p.v!==1||s[13].p.k||s[13].p.v!==0||s[14].p.k||s[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",r)),(s[17].p.k||s[17].p.v!==0||s[18].p.k||s[18].p.v!==1||s[19].p.k||s[19].p.v!==1||s[20].p.k||s[20].p.v!==0||s[21].p.k||s[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",r)),(s[24].p.k||s[24].p.v!==0||s[25].p.k||s[25].p.v!==1||s[26].p.k||s[26].p.v!==1||s[27].p.k||s[27].p.v!==0||s[28].p.k||s[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",r)),(s[31].p.k||s[31].p.v!==0||s[32].p.k||s[32].p.v!==1||s[33].p.k||s[33].p.v!==1||s[34].p.k||s[34].p.v!==0||s[35].p.k||s[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",r)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(r.setAttribute("color-interpolation-filters","sRGB"),n.appendChild(r)),(s[3].p.k||s[3].p.v!==0||s[4].p.k||s[4].p.v!==1||s[5].p.k||s[5].p.v!==1||s[6].p.k||s[6].p.v!==0||s[7].p.k||s[7].p.v!==1)&&(r=createNS("feComponentTransfer"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("result",a),n.appendChild(r),this.feFuncRComposed=this.createFeFunc("feFuncR",r),this.feFuncGComposed=this.createFeFunc("feFuncG",r),this.feFuncBComposed=this.createFeFunc("feFuncB",r))}SVGProLevelsFilter.prototype.createFeFunc=function(n,e){var i=createNS(n);return i.setAttribute("type","table"),e.appendChild(i),i},SVGProLevelsFilter.prototype.getTableValue=function(n,e,i,a,s){for(var r=0,o=256,l,u=Math.min(n,e),c=Math.max(n,e),d=Array.call(null,{length:o}),p,f=0,m=s-a,P=e-n;r<=256;)l=r/256,l<=u?p=P<0?s:a:l>=c?p=P<0?a:s:p=a+m*Math.pow((l-n)/P,1/i),d[f]=p,f+=1,r+=256/(o-1);return d.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e,i=this.filterManager.effectElements;this.feFuncRComposed&&(n||i[3].p._mdf||i[4].p._mdf||i[5].p._mdf||i[6].p._mdf||i[7].p._mdf)&&(e=this.getTableValue(i[3].p.v,i[4].p.v,i[5].p.v,i[6].p.v,i[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(n||i[10].p._mdf||i[11].p._mdf||i[12].p._mdf||i[13].p._mdf||i[14].p._mdf)&&(e=this.getTableValue(i[10].p.v,i[11].p.v,i[12].p.v,i[13].p.v,i[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(n||i[17].p._mdf||i[18].p._mdf||i[19].p._mdf||i[20].p._mdf||i[21].p._mdf)&&(e=this.getTableValue(i[17].p.v,i[18].p.v,i[19].p.v,i[20].p.v,i[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(n||i[24].p._mdf||i[25].p._mdf||i[26].p._mdf||i[27].p._mdf||i[28].p._mdf)&&(e=this.getTableValue(i[24].p.v,i[25].p.v,i[26].p.v,i[27].p.v,i[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(n||i[31].p._mdf||i[32].p._mdf||i[33].p._mdf||i[34].p._mdf||i[35].p._mdf)&&(e=this.getTableValue(i[31].p.v,i[32].p.v,i[33].p.v,i[34].p.v,i[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(n,e,i,a,s){var r=e.container.globalData.renderConfig.filterSize,o=e.data.fs||r;n.setAttribute("x",o.x||r.x),n.setAttribute("y",o.y||r.y),n.setAttribute("width",o.width||r.width),n.setAttribute("height",o.height||r.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",a+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,n.appendChild(l);var u=createNS("feOffset");u.setAttribute("dx","25"),u.setAttribute("dy","0"),u.setAttribute("in",a+"_drop_shadow_1"),u.setAttribute("result",a+"_drop_shadow_2"),this.feOffset=u,n.appendChild(u);var c=createNS("feFlood");c.setAttribute("flood-color","#00ff00"),c.setAttribute("flood-opacity","1"),c.setAttribute("result",a+"_drop_shadow_3"),this.feFlood=c,n.appendChild(c);var d=createNS("feComposite");d.setAttribute("in",a+"_drop_shadow_3"),d.setAttribute("in2",a+"_drop_shadow_2"),d.setAttribute("operator","in"),d.setAttribute("result",a+"_drop_shadow_4"),n.appendChild(d);var p=this.createMergeNode(a,[a+"_drop_shadow_4",s]);n.appendChild(p)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){if((n||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),n||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((n||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),n||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var i=this.filterManager.effectElements[3].p.v,a=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=i*Math.cos(a),r=i*Math.sin(a);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",r)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(n,e,i){this.initialized=!1,this.filterManager=e,this.filterElem=n,this.elem=i,i.matteElement=createNS("g"),i.matteElement.appendChild(i.layerElement),i.matteElement.appendChild(i.transformedElement),i.baseElement=i.matteElement}SVGMatte3Effect.prototype.findSymbol=function(n){for(var e=0,i=_svgMatteSymbols.length;e<i;){if(_svgMatteSymbols[e]===n)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(n,e){var i=n.layerElement.parentNode;if(i){for(var a=i.children,s=0,r=a.length;s<r&&a[s]!==n.layerElement;)s+=1;var o;s<=r-2&&(o=a[s+1]);var l=createNS("use");l.setAttribute("href","#"+e),o?i.insertBefore(l,o):i.appendChild(l)}},SVGMatte3Effect.prototype.setElementAsMask=function(n,e){if(!this.findSymbol(e)){var i=createElementID(),a=createNS("mask");a.setAttribute("id",e.layerId),a.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var s=n.globalData.defs;s.appendChild(a);var r=createNS("symbol");r.setAttribute("id",i),this.replaceInParent(e,i),r.appendChild(e.layerElement),s.appendChild(r);var o=createNS("use");o.setAttribute("href","#"+i),a.appendChild(o),e.data.hd=!1,e.show()}n.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var n=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,i=0,a=e.length;i<a;)e[i]&&e[i].data.ind===n&&this.setElementAsMask(this.elem,e[i]),i+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()};function SVGGaussianBlurEffect(n,e,i,a){n.setAttribute("x","-100%"),n.setAttribute("y","-100%"),n.setAttribute("width","300%"),n.setAttribute("height","300%"),this.filterManager=e;var s=createNS("feGaussianBlur");s.setAttribute("result",a),n.appendChild(s),this.feGaussianBlur=s}SVGGaussianBlurEffect.prototype.renderFrame=function(n){if(n||this.filterManager._mdf){var e=.3,i=this.filterManager.effectElements[0].p.v*e,a=this.filterManager.effectElements[1].p.v,s=a==3?0:i,r=a==2?0:i;this.feGaussianBlur.setAttribute("stdDeviation",s+" "+r);var o=this.filterManager.effectElements[2].p.v==1?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",o)}};function TransformEffect(){}TransformEffect.prototype.init=function(n){this.effectsManager=n,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(n){if(this._opMdf=!1,this._mdf=!1,n||this.effectsManager._mdf){var e=this.effectsManager.effectElements,i=e[0].p.v,a=e[1].p.v,s=e[2].p.v===1,r=e[3].p.v,o=s?r:e[4].p.v,l=e[5].p.v,u=e[6].p.v,c=e[7].p.v;this.matrix.reset(),this.matrix.translate(-i[0],-i[1],i[2]),this.matrix.scale(o*.01,r*.01,1),this.matrix.rotate(-c*degToRads),this.matrix.skewFromAxis(-l*degToRads,(u+90)*degToRads),this.matrix.translate(a[0],a[1],0),this._mdf=!0,this.opacity!==e[8].p.v&&(this.opacity=e[8].p.v,this._opMdf=!0)}};function SVGTransformEffect(n,e){this.init(e)}extendPrototype([TransformEffect],SVGTransformEffect);function CVTransformEffect(n){this.init(n)}return extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie})})(lottie$1,lottie$1.exports);var lottieExports=lottie$1.exports;const lottie=getDefaultExportFromCjs(lottieExports);function _arrayLikeToArray(n,e){(e==null||e>n.length)&&(e=n.length);for(var i=0,a=Array(e);i<e;i++)a[i]=n[i];return a}function _arrayWithHoles(n){if(Array.isArray(n))return n}function _defineProperty(n,e,i){return(e=_toPropertyKey(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function _iterableToArrayLimit(n,e){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var a,s,r,o,l=[],u=!0,c=!1;try{if(r=(i=i.call(n)).next,e!==0)for(;!(u=(a=r.call(i)).done)&&(l.push(a.value),l.length!==e);u=!0);}catch(d){c=!0,s=d}finally{try{if(!u&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw s}}return l}}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
158
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ownKeys(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),i.push.apply(i,a)}return i}function _objectSpread2(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(a){_defineProperty(n,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(i,a))})}return n}function _objectWithoutProperties(n,e){if(n==null)return{};var i,a,s=_objectWithoutPropertiesLoose(n,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(a=0;a<r.length;a++)i=r[a],e.includes(i)||{}.propertyIsEnumerable.call(n,i)&&(s[i]=n[i])}return s}function _objectWithoutPropertiesLoose(n,e){if(n==null)return{};var i={};for(var a in n)if({}.hasOwnProperty.call(n,a)){if(e.includes(a))continue;i[a]=n[a]}return i}function _slicedToArray(n,e){return _arrayWithHoles(n)||_iterableToArrayLimit(n,e)||_unsupportedIterableToArray(n,e)||_nonIterableRest()}function _toPrimitive(n,e){if(typeof n!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var a=i.call(n,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _toPropertyKey(n){var e=_toPrimitive(n,"string");return typeof e=="symbol"?e:e+""}function _unsupportedIterableToArray(n,e){if(n){if(typeof n=="string")return _arrayLikeToArray(n,e);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(n,e):void 0}}var _excluded$1=["animationData","loop","autoplay","initialSegment","onComplete","onLoopComplete","onEnterFrame","onSegmentStart","onConfigReady","onDataReady","onDataFailed","onLoadedImages","onDOMLoaded","onDestroy","lottieRef","renderer","name","assetsPath","rendererSettings"],useLottie=function n(e,i){var a=e.animationData,s=e.loop,r=e.autoplay,o=e.initialSegment,l=e.onComplete,u=e.onLoopComplete,c=e.onEnterFrame,d=e.onSegmentStart,p=e.onConfigReady,f=e.onDataReady,m=e.onDataFailed,P=e.onLoadedImages,T=e.onDOMLoaded,x=e.onDestroy;e.lottieRef,e.renderer,e.name,e.assetsPath,e.rendererSettings;var y=_objectWithoutProperties(e,_excluded$1),S=React.useState(!1),g=_slicedToArray(S,2),C=g[0],E=g[1],B=React.useRef(),_=React.useRef(null),M=function(){var G;(G=B.current)===null||G===void 0||G.play()},D=function(){var G;(G=B.current)===null||G===void 0||G.stop()},L=function(){var G;(G=B.current)===null||G===void 0||G.pause()},N=function(G){var z;(z=B.current)===null||z===void 0||z.setSpeed(G)},F=function(G,z){var q;(q=B.current)===null||q===void 0||q.goToAndPlay(G,z)},H=function(G,z){var q;(q=B.current)===null||q===void 0||q.goToAndStop(G,z)},$=function(G){var z;(z=B.current)===null||z===void 0||z.setDirection(G)},O=function(G,z){var q;(q=B.current)===null||q===void 0||q.playSegments(G,z)},b=function(G){var z;(z=B.current)===null||z===void 0||z.setSubframe(G)},I=function(G){var z;return(z=B.current)===null||z===void 0?void 0:z.getDuration(G)},V=function(){var G;(G=B.current)===null||G===void 0||G.destroy(),B.current=void 0},A=function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},z;if(_.current){(z=B.current)===null||z===void 0||z.destroy();var q=_objectSpread2(_objectSpread2(_objectSpread2({},e),G),{},{container:_.current});return B.current=lottie.loadAnimation(q),E(!!B.current),function(){var U;(U=B.current)===null||U===void 0||U.destroy(),B.current=void 0}}};React.useEffect(function(){var R=A();return function(){return R==null?void 0:R()}},[a,s]),React.useEffect(function(){B.current&&(B.current.autoplay=!!r)},[r]),React.useEffect(function(){if(B.current){if(!o){B.current.resetSegments(!0);return}!Array.isArray(o)||!o.length||((B.current.currentRawFrame<o[0]||B.current.currentRawFrame>o[1])&&(B.current.currentRawFrame=o[0]),B.current.setSegment(o[0],o[1]))}},[o]),React.useEffect(function(){var R=[{name:"complete",handler:l},{name:"loopComplete",handler:u},{name:"enterFrame",handler:c},{name:"segmentStart",handler:d},{name:"config_ready",handler:p},{name:"data_ready",handler:f},{name:"data_failed",handler:m},{name:"loaded_images",handler:P},{name:"DOMLoaded",handler:T},{name:"destroy",handler:x}],G=R.filter(function(q){return q.handler!=null});if(G.length){var z=G.map(function(q){var U;return(U=B.current)===null||U===void 0||U.addEventListener(q.name,q.handler),function(){var K;(K=B.current)===null||K===void 0||K.removeEventListener(q.name,q.handler)}});return function(){z.forEach(function(q){return q()})}}},[l,u,c,d,p,f,m,P,T,x]);var k=React.createElement("div",_objectSpread2({style:i,ref:_},y));return{View:k,play:M,stop:D,pause:L,setSpeed:N,goToAndStop:H,goToAndPlay:F,setDirection:$,playSegments:O,setSubframe:b,getDuration:I,destroy:V,animationContainerRef:_,animationLoaded:C,animationItem:B.current}};function getContainerVisibility(n){var e=n.getBoundingClientRect(),i=e.top,a=e.height,s=window.innerHeight-i,r=window.innerHeight+a;return s/r}function getContainerCursorPosition(n,e,i){var a=n.getBoundingClientRect(),s=a.top,r=a.left,o=a.width,l=a.height,u=(e-r)/o,c=(i-s)/l;return{x:u,y:c}}var useInitInteractivity=function n(e){var i=e.wrapperRef,a=e.animationItem,s=e.mode,r=e.actions;React.useEffect(function(){var o=i.current;if(!(!o||!a||!r.length)){a.stop();var l=function(){var d=null,p=function(){var m=getContainerVisibility(o),P=r.find(function(x){var y=x.visibility;return y&&m>=y[0]&&m<=y[1]});if(P){if(P.type==="seek"&&P.visibility&&P.frames.length===2){var T=P.frames[0]+Math.ceil((m-P.visibility[0])/(P.visibility[1]-P.visibility[0])*P.frames[1]);//! goToAndStop must be relative to the start of the current segment
|
|
159
159
|
a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.isPaused)&&(a.playSegments(P.frames,!0),d=P.frames),P.type==="play"&&a.isPaused&&(a.resetSegments(!0),a.play()),P.type==="stop"&&a.goToAndStop(P.frames[0]-a.firstFrame-1,!0)}};return document.addEventListener("scroll",p),function(){document.removeEventListener("scroll",p)}},u=function(){var d=function(P,T){var x=P,y=T;if(x!==-1&&y!==-1){var S=getContainerCursorPosition(o,x,y);x=S.x,y=S.y}var g=r.find(function(B){var _=B.position;return _&&Array.isArray(_.x)&&Array.isArray(_.y)?x>=_.x[0]&&x<=_.x[1]&&y>=_.y[0]&&y<=_.y[1]:_&&!Number.isNaN(_.x)&&!Number.isNaN(_.y)?x===_.x&&y===_.y:!1});if(g){if(g.type==="seek"&&g.position&&Array.isArray(g.position.x)&&Array.isArray(g.position.y)&&g.frames.length===2){var C=(x-g.position.x[0])/(g.position.x[1]-g.position.x[0]),E=(y-g.position.y[0])/(g.position.y[1]-g.position.y[0]);a.playSegments(g.frames,!0),a.goToAndStop(Math.ceil((C+E)/2*(g.frames[1]-g.frames[0])),!0)}g.type==="loop"&&a.playSegments(g.frames,!0),g.type==="play"&&(a.isPaused&&a.resetSegments(!1),a.playSegments(g.frames)),g.type==="stop"&&a.goToAndStop(g.frames[0],!0)}},p=function(P){d(P.clientX,P.clientY)},f=function(){d(-1,-1)};return o.addEventListener("mousemove",p),o.addEventListener("mouseout",f),function(){o.removeEventListener("mousemove",p),o.removeEventListener("mouseout",f)}};switch(s){case"scroll":return l();case"cursor":return u()}}},[s,a])},useLottieInteractivity=function n(e){var i=e.actions,a=e.mode,s=e.lottieObj,r=s.animationItem,o=s.View,l=s.animationContainerRef;return useInitInteractivity({actions:i,animationItem:r,mode:a,wrapperRef:l}),o},_excluded=["style","interactivity"],Lottie=function n(e){var i,a,s,r=e.style,o=e.interactivity,l=_objectWithoutProperties(e,_excluded),u=useLottie(l,r),c=u.View,d=u.play,p=u.stop,f=u.pause,m=u.setSpeed,P=u.goToAndStop,T=u.goToAndPlay,x=u.setDirection,y=u.playSegments,S=u.setSubframe,g=u.getDuration,C=u.destroy,E=u.animationContainerRef,B=u.animationLoaded,_=u.animationItem;return React.useEffect(function(){e.lottieRef&&(e.lottieRef.current={play:d,stop:p,pause:f,setSpeed:m,goToAndPlay:T,goToAndStop:P,setDirection:x,playSegments:y,setSubframe:S,getDuration:g,destroy:C,animationContainerRef:E,animationLoaded:B,animationItem:_})},[(i=e.lottieRef)===null||i===void 0?void 0:i.current]),useLottieInteractivity({lottieObj:{View:c,play:d,stop:p,pause:f,setSpeed:m,goToAndStop:P,goToAndPlay:T,setDirection:x,playSegments:y,setSubframe:S,getDuration:g,destroy:C,animationContainerRef:E,animationLoaded:B,animationItem:_},actions:(a=o==null?void 0:o.actions)!==null&&a!==void 0?a:[],mode:(s=o==null?void 0:o.mode)!==null&&s!==void 0?s:"scroll"})};const v="5.7.4",fr=30,ip=0,op=90,w=200,h=200,nm="AI Generating",ddd=0,assets=[],layers=[{ddd:0,ind:1,ty:4,nm:"Circle 1",sr:1,ks:{o:{a:1,k:[{t:0,s:[100],e:[30]},{t:45,s:[30],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[0],e:[360]},{t:90,s:[360]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[100,100],e:[120,120]},{t:45,s:[120,120],e:[100,100]},{t:90,s:[100,100]}]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[60,60]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},w:{a:0,k:4},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-40]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:2,ty:4,nm:"Circle 2",sr:1,ks:{o:{a:1,k:[{t:0,s:[30],e:[100]},{t:45,s:[100],e:[30]},{t:90,s:[30]}]},r:{a:1,k:[{t:0,s:[120],e:[480]},{t:90,s:[480]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[80,80],e:[100,100]},{t:45,s:[100,100],e:[80,80]},{t:90,s:[80,80]}]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[50,50]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},w:{a:0,k:3},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-35]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:3,ty:4,nm:"Circle 3",sr:1,ks:{o:{a:1,k:[{t:0,s:[60],e:[100]},{t:30,s:[100],e:[60]},{t:60,s:[60],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[240],e:[600]},{t:90,s:[600]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,0]},s:{a:0,k:[40,40]},nm:"Ellipse"},{ty:"st",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},w:{a:0,k:2},lc:2,lj:2,nm:"Stroke"},{ty:"tr",p:{a:0,k:[0,-30]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]},r:{a:0,k:0},o:{a:0,k:100}}]},{ddd:0,ind:4,ty:4,nm:"Center Sparkle",sr:1,ks:{o:{a:1,k:[{t:0,s:[100],e:[50]},{t:15,s:[50],e:[100]},{t:30,s:[100],e:[50]},{t:45,s:[50],e:[100]},{t:60,s:[100],e:[50]},{t:75,s:[50],e:[100]},{t:90,s:[100]}]},r:{a:1,k:[{t:0,s:[0],e:[180]},{t:90,s:[180]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:1,k:[{t:0,s:[100,100],e:[130,130]},{t:22,s:[130,130],e:[90,90]},{t:45,s:[90,90],e:[120,120]},{t:67,s:[120,120],e:[100,100]},{t:90,s:[100,100]}]}},ao:0,shapes:[{ty:"sr",sy:1,d:1,pt:{a:0,k:4},p:{a:0,k:[0,0]},r:{a:0,k:0},ir:{a:0,k:8},is:{a:0,k:0},or:{a:0,k:20},os:{a:0,k:0},nm:"Star"},{ty:"fl",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},r:1,nm:"Fill"}]},{ddd:0,ind:5,ty:4,nm:"Dots",sr:1,ks:{o:{a:0,k:100},r:{a:1,k:[{t:0,s:[0],e:[-360]},{t:90,s:[-360]}]},p:{a:0,k:[100,100]},a:{a:0,k:[0,0]},s:{a:0,k:[100,100]}},ao:0,shapes:[{ty:"el",p:{a:0,k:[0,-50]},s:{a:1,k:[{t:0,s:[8,8],e:[12,12]},{t:22,s:[12,12],e:[6,6]},{t:45,s:[6,6],e:[10,10]},{t:67,s:[10,10],e:[8,8]},{t:90,s:[8,8]}]},nm:"Dot 1"},{ty:"fl",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},r:1,nm:"Fill"},{ty:"el",p:{a:0,k:[43,25]},s:{a:1,k:[{t:0,s:[6,6],e:[10,10]},{t:30,s:[10,10],e:[6,6]},{t:60,s:[6,6],e:[8,8]},{t:90,s:[8,8]}]},nm:"Dot 2"},{ty:"fl",c:{a:0,k:[.42,.275,.776,1]},o:{a:0,k:100},r:1,nm:"Fill 2"},{ty:"el",p:{a:0,k:[-43,25]},s:{a:1,k:[{t:0,s:[10,10],e:[6,6]},{t:45,s:[6,6],e:[12,12]},{t:90,s:[12,12]}]},nm:"Dot 3"},{ty:"fl",c:{a:0,k:[.118,.227,.541,1]},o:{a:0,k:100},r:1,nm:"Fill 3"}]}],aiGeneratingAnimation={v,fr,ip,op,w,h,nm,ddd,assets,layers};/**
|
|
160
160
|
* @license
|
|
161
161
|
* Copyright 2025 Google LLC
|
|
@@ -184,7 +184,7 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
184
184
|
* @license
|
|
185
185
|
* Copyright 2025 Google LLC
|
|
186
186
|
* SPDX-License-Identifier: Apache-2.0
|
|
187
|
-
*/function batchJobDestinationFromMldev(n){const e={},i=getValueByPath(n,["responsesFile"]);i!=null&&setValueByPath(e,["fileName"],i);const a=getValueByPath(n,["inlinedResponses","inlinedResponses"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>inlinedResponseFromMldev(o))),setValueByPath(e,["inlinedResponses"],r)}const s=getValueByPath(n,["inlinedEmbedContentResponses","inlinedResponses"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(e,["inlinedEmbedContentResponses"],r)}return e}function batchJobDestinationFromVertex(n){const e={},i=getValueByPath(n,["predictionsFormat"]);i!=null&&setValueByPath(e,["format"],i);const a=getValueByPath(n,["gcsDestination","outputUriPrefix"]);a!=null&&setValueByPath(e,["gcsUri"],a);const s=getValueByPath(n,["bigqueryDestination","outputUri"]);return s!=null&&setValueByPath(e,["bigqueryUri"],s),e}function batchJobDestinationToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["predictionsFormat"],i);const a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(e,["gcsDestination","outputUriPrefix"],a);const s=getValueByPath(n,["bigqueryUri"]);if(s!=null&&setValueByPath(e,["bigqueryDestination","outputUri"],s),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return e}function batchJobFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata","displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["metadata","state"]);s!=null&&setValueByPath(e,["state"],tJobState(s));const r=getValueByPath(n,["metadata","createTime"]);r!=null&&setValueByPath(e,["createTime"],r);const o=getValueByPath(n,["metadata","endTime"]);o!=null&&setValueByPath(e,["endTime"],o);const l=getValueByPath(n,["metadata","updateTime"]);l!=null&&setValueByPath(e,["updateTime"],l);const u=getValueByPath(n,["metadata","model"]);u!=null&&setValueByPath(e,["model"],u);const c=getValueByPath(n,["metadata","output"]);return c!=null&&setValueByPath(e,["dest"],batchJobDestinationFromMldev(tRecvBatchJobDestination(c))),e}function batchJobFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["state"]);s!=null&&setValueByPath(e,["state"],tJobState(s));const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(e,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(e,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(e,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(e,["updateTime"],c);const d=getValueByPath(n,["model"]);d!=null&&setValueByPath(e,["model"],d);const p=getValueByPath(n,["inputConfig"]);p!=null&&setValueByPath(e,["src"],batchJobSourceFromVertex(p));const f=getValueByPath(n,["outputConfig"]);f!=null&&setValueByPath(e,["dest"],batchJobDestinationFromVertex(tRecvBatchJobDestination(f)));const m=getValueByPath(n,["completionStats"]);return m!=null&&setValueByPath(e,["completionStats"],m),e}function batchJobSourceFromVertex(n){const e={},i=getValueByPath(n,["instancesFormat"]);i!=null&&setValueByPath(e,["format"],i);const a=getValueByPath(n,["gcsSource","uris"]);a!=null&&setValueByPath(e,["gcsUri"],a);const s=getValueByPath(n,["bigquerySource","inputUri"]);return s!=null&&setValueByPath(e,["bigqueryUri"],s),e}function batchJobSourceToMldev(n,e){const i={};if(getValueByPath(e,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(getValueByPath(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(e,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=getValueByPath(e,["fileName"]);a!=null&&setValueByPath(i,["fileName"],a);const s=getValueByPath(e,["inlinedRequests"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>inlinedRequestToMldev(n,o))),setValueByPath(i,["requests","requests"],r)}return i}function batchJobSourceToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["instancesFormat"],i);const a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(e,["gcsSource","uris"],a);const s=getValueByPath(n,["bigqueryUri"]);if(s!=null&&setValueByPath(e,["bigquerySource","inputUri"],s),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return e}function blobToMldev$4(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function cancelBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function cancelBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function candidateFromMldev$1(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const a=getValueByPath(n,["citationMetadata"]);a!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev$1(a));const s=getValueByPath(n,["tokenCount"]);s!=null&&setValueByPath(e,["tokenCount"],s);const r=getValueByPath(n,["finishReason"]);r!=null&&setValueByPath(e,["finishReason"],r);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const d=getValueByPath(n,["safetyRatings"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(m=>m)),setValueByPath(e,["safetyRatings"],f)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev$1(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>s)),setValueByPath(e,["citations"],a)}return e}function contentToMldev$4(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>partToMldev$4(r))),setValueByPath(e,["parts"],s)}const a=getValueByPath(n,["role"]);return a!=null&&setValueByPath(e,["role"],a),e}function createBatchJobConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);if(e!==void 0&&a!=null&&setValueByPath(e,["batch","displayName"],a),getValueByPath(n,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return i}function createBatchJobConfigToVertex(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["dest"]);return e!==void 0&&s!=null&&setValueByPath(e,["outputConfig"],batchJobDestinationToVertex(tBatchJobDestination(s))),i}function createBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["batch","inputConfig"],batchJobSourceToMldev(n,tBatchJobSource(n,s)));const r=getValueByPath(e,["config"]);return r!=null&&createBatchJobConfigToMldev(r,i),i}function createBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["inputConfig"],batchJobSourceToVertex(tBatchJobSource(n,s)));const r=getValueByPath(e,["config"]);return r!=null&&createBatchJobConfigToVertex(r,i),i}function createEmbeddingsBatchJobConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);return e!==void 0&&a!=null&&setValueByPath(e,["batch","displayName"],a),i}function createEmbeddingsBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["batch","inputConfig"],embeddingsBatchJobSourceToMldev(n,s));const r=getValueByPath(e,["config"]);return r!=null&&createEmbeddingsBatchJobConfigToMldev(r,i),i}function deleteBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function deleteBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function deleteResourceJobFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);return r!=null&&setValueByPath(e,["error"],r),e}function deleteResourceJobFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);return r!=null&&setValueByPath(e,["error"],r),e}function embedContentBatchToMldev(n,e){const i={},a=getValueByPath(e,["contents"]);if(a!=null){let r=tContentsForEmbed(n,a);Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(i,["requests[]","request","content"],r)}const s=getValueByPath(e,["config"]);return s!=null&&(setValueByPath(i,["_self"],embedContentConfigToMldev$1(s,i)),moveValueByPath(i,{"requests[].*":"requests[].request.*"})),i}function embedContentConfigToMldev$1(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["requests[]","taskType"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&r!=null&&setValueByPath(e,["requests[]","outputDimensionality"],r),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embeddingsBatchJobSourceToMldev(n,e){const i={},a=getValueByPath(e,["fileName"]);a!=null&&setValueByPath(i,["file_name"],a);const s=getValueByPath(e,["inlinedRequests"]);return s!=null&&setValueByPath(i,["requests"],embedContentBatchToMldev(n,s)),i}function fileDataToMldev$4(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function functionCallToMldev$4(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const a=getValueByPath(n,["args"]);a!=null&&setValueByPath(e,["args"],a);const s=getValueByPath(n,["name"]);if(s!=null&&setValueByPath(e,["name"],s),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev$2(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const a=getValueByPath(n,["allowedFunctionNames"]);if(a!=null&&setValueByPath(e,["allowedFunctionNames"],a),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function generateContentConfigToMldev$1(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$4(tContent(s)));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);if(S!=null&&setValueByPath(a,["responseJsonSchema"],S),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let N=g;Array.isArray(N)&&(N=N.map(H=>safetySettingToMldev$1(H))),setValueByPath(i,["safetySettings"],N)}const C=getValueByPath(e,["tools"]);if(i!==void 0&&C!=null){let N=tTools(C);Array.isArray(N)&&(N=N.map(H=>toolToMldev$4(tTool(H)))),setValueByPath(i,["tools"],N)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev$2(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=getValueByPath(e,["cachedContent"]);i!==void 0&&B!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,B));const _=getValueByPath(e,["responseModalities"]);_!=null&&setValueByPath(a,["responseModalities"],_);const M=getValueByPath(e,["mediaResolution"]);M!=null&&setValueByPath(a,["mediaResolution"],M);const D=getValueByPath(e,["speechConfig"]);if(D!=null&&setValueByPath(a,["speechConfig"],tSpeechConfig(D)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const L=getValueByPath(e,["thinkingConfig"]);L!=null&&setValueByPath(a,["thinkingConfig"],L);const F=getValueByPath(e,["imageConfig"]);return F!=null&&setValueByPath(a,["imageConfig"],imageConfigToMldev$1(F)),a}function generateContentResponseFromMldev$1(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev$1(c))),setValueByPath(e,["candidates"],u)}const s=getValueByPath(n,["modelVersion"]);s!=null&&setValueByPath(e,["modelVersion"],s);const r=getValueByPath(n,["promptFeedback"]);r!=null&&setValueByPath(e,["promptFeedback"],r);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function getBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function getBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function googleMapsToMldev$4(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$4(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev$1(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);if(a!=null&&setValueByPath(e,["imageSize"],a),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function inlinedRequestToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["request","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let l=tContents(s);Array.isArray(l)&&(l=l.map(u=>contentToMldev$4(u))),setValueByPath(i,["request","contents"],l)}const r=getValueByPath(e,["metadata"]);r!=null&&setValueByPath(i,["metadata"],r);const o=getValueByPath(e,["config"]);return o!=null&&setValueByPath(i,["request","generationConfig"],generateContentConfigToMldev$1(n,o,getValueByPath(i,["request"],{}))),i}function inlinedResponseFromMldev(n){const e={},i=getValueByPath(n,["response"]);i!=null&&setValueByPath(e,["response"],generateContentResponseFromMldev$1(i));const a=getValueByPath(n,["error"]);return a!=null&&setValueByPath(e,["error"],a),e}function listBatchJobsConfigToMldev(n,e){const i={},a=getValueByPath(n,["pageSize"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageSize"],a);const s=getValueByPath(n,["pageToken"]);if(e!==void 0&&s!=null&&setValueByPath(e,["_query","pageToken"],s),getValueByPath(n,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return i}function listBatchJobsConfigToVertex(n,e){const i={},a=getValueByPath(n,["pageSize"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageSize"],a);const s=getValueByPath(n,["pageToken"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageToken"],s);const r=getValueByPath(n,["filter"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","filter"],r),i}function listBatchJobsParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToMldev(i,e),e}function listBatchJobsParametersToVertex(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToVertex(i,e),e}function listBatchJobsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["operations"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>batchJobFromMldev(o))),setValueByPath(e,["batchJobs"],r)}return e}function listBatchJobsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["batchPredictionJobs"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>batchJobFromVertex(o))),setValueByPath(e,["batchJobs"],r)}return e}function partToMldev$4(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const a=getValueByPath(n,["codeExecutionResult"]);a!=null&&setValueByPath(e,["codeExecutionResult"],a);const s=getValueByPath(n,["executableCode"]);s!=null&&setValueByPath(e,["executableCode"],s);const r=getValueByPath(n,["fileData"]);r!=null&&setValueByPath(e,["fileData"],fileDataToMldev$4(r));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$4(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$4(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const d=getValueByPath(n,["thought"]);d!=null&&setValueByPath(e,["thought"],d);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const f=getValueByPath(n,["videoMetadata"]);return f!=null&&setValueByPath(e,["videoMetadata"],f),e}function safetySettingToMldev$1(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=getValueByPath(n,["threshold"]);return a!=null&&setValueByPath(e,["threshold"],a),e}function toolConfigToMldev$2(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev$2(i));const a=getValueByPath(n,["retrievalConfig"]);return a!=null&&setValueByPath(e,["retrievalConfig"],a),e}function toolToMldev$4(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let d=i;Array.isArray(d)&&(d=d.map(p=>p)),setValueByPath(e,["functionDeclarations"],d)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=getValueByPath(n,["googleSearchRetrieval"]);a!=null&&setValueByPath(e,["googleSearchRetrieval"],a);const s=getValueByPath(n,["computerUse"]);s!=null&&setValueByPath(e,["computerUse"],s);const r=getValueByPath(n,["fileSearch"]);r!=null&&setValueByPath(e,["fileSearch"],r);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$4(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$4(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}/**
|
|
187
|
+
*/function batchJobDestinationFromMldev(n){const e={},i=getValueByPath(n,["responsesFile"]);i!=null&&setValueByPath(e,["fileName"],i);const a=getValueByPath(n,["inlinedResponses","inlinedResponses"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>inlinedResponseFromMldev(o))),setValueByPath(e,["inlinedResponses"],r)}const s=getValueByPath(n,["inlinedEmbedContentResponses","inlinedResponses"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(e,["inlinedEmbedContentResponses"],r)}return e}function batchJobDestinationFromVertex(n){const e={},i=getValueByPath(n,["predictionsFormat"]);i!=null&&setValueByPath(e,["format"],i);const a=getValueByPath(n,["gcsDestination","outputUriPrefix"]);a!=null&&setValueByPath(e,["gcsUri"],a);const s=getValueByPath(n,["bigqueryDestination","outputUri"]);return s!=null&&setValueByPath(e,["bigqueryUri"],s),e}function batchJobDestinationToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["predictionsFormat"],i);const a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(e,["gcsDestination","outputUriPrefix"],a);const s=getValueByPath(n,["bigqueryUri"]);if(s!=null&&setValueByPath(e,["bigqueryDestination","outputUri"],s),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return e}function batchJobFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata","displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["metadata","state"]);s!=null&&setValueByPath(e,["state"],tJobState(s));const r=getValueByPath(n,["metadata","createTime"]);r!=null&&setValueByPath(e,["createTime"],r);const o=getValueByPath(n,["metadata","endTime"]);o!=null&&setValueByPath(e,["endTime"],o);const l=getValueByPath(n,["metadata","updateTime"]);l!=null&&setValueByPath(e,["updateTime"],l);const u=getValueByPath(n,["metadata","model"]);u!=null&&setValueByPath(e,["model"],u);const c=getValueByPath(n,["metadata","output"]);return c!=null&&setValueByPath(e,["dest"],batchJobDestinationFromMldev(tRecvBatchJobDestination(c))),e}function batchJobFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["state"]);s!=null&&setValueByPath(e,["state"],tJobState(s));const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(e,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(e,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(e,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(e,["updateTime"],c);const d=getValueByPath(n,["model"]);d!=null&&setValueByPath(e,["model"],d);const p=getValueByPath(n,["inputConfig"]);p!=null&&setValueByPath(e,["src"],batchJobSourceFromVertex(p));const f=getValueByPath(n,["outputConfig"]);f!=null&&setValueByPath(e,["dest"],batchJobDestinationFromVertex(tRecvBatchJobDestination(f)));const m=getValueByPath(n,["completionStats"]);return m!=null&&setValueByPath(e,["completionStats"],m),e}function batchJobSourceFromVertex(n){const e={},i=getValueByPath(n,["instancesFormat"]);i!=null&&setValueByPath(e,["format"],i);const a=getValueByPath(n,["gcsSource","uris"]);a!=null&&setValueByPath(e,["gcsUri"],a);const s=getValueByPath(n,["bigquerySource","inputUri"]);return s!=null&&setValueByPath(e,["bigqueryUri"],s),e}function batchJobSourceToMldev(n,e){const i={};if(getValueByPath(e,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(getValueByPath(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(e,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=getValueByPath(e,["fileName"]);a!=null&&setValueByPath(i,["fileName"],a);const s=getValueByPath(e,["inlinedRequests"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>inlinedRequestToMldev(n,o))),setValueByPath(i,["requests","requests"],r)}return i}function batchJobSourceToVertex(n){const e={},i=getValueByPath(n,["format"]);i!=null&&setValueByPath(e,["instancesFormat"],i);const a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(e,["gcsSource","uris"],a);const s=getValueByPath(n,["bigqueryUri"]);if(s!=null&&setValueByPath(e,["bigquerySource","inputUri"],s),getValueByPath(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(getValueByPath(n,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return e}function blobToMldev$4(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function cancelBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function cancelBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function candidateFromMldev$1(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const a=getValueByPath(n,["citationMetadata"]);a!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev$1(a));const s=getValueByPath(n,["tokenCount"]);s!=null&&setValueByPath(e,["tokenCount"],s);const r=getValueByPath(n,["finishReason"]);r!=null&&setValueByPath(e,["finishReason"],r);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const d=getValueByPath(n,["safetyRatings"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(m=>m)),setValueByPath(e,["safetyRatings"],f)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev$1(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>s)),setValueByPath(e,["citations"],a)}return e}function contentToMldev$4(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>partToMldev$4(r))),setValueByPath(e,["parts"],s)}const a=getValueByPath(n,["role"]);return a!=null&&setValueByPath(e,["role"],a),e}function createBatchJobConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);if(e!==void 0&&a!=null&&setValueByPath(e,["batch","displayName"],a),getValueByPath(n,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return i}function createBatchJobConfigToVertex(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["dest"]);return e!==void 0&&s!=null&&setValueByPath(e,["outputConfig"],batchJobDestinationToVertex(tBatchJobDestination(s))),i}function createBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["batch","inputConfig"],batchJobSourceToMldev(n,tBatchJobSource(n,s)));const r=getValueByPath(e,["config"]);return r!=null&&createBatchJobConfigToMldev(r,i),i}function createBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["inputConfig"],batchJobSourceToVertex(tBatchJobSource(n,s)));const r=getValueByPath(e,["config"]);return r!=null&&createBatchJobConfigToVertex(r,i),i}function createEmbeddingsBatchJobConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);return e!==void 0&&a!=null&&setValueByPath(e,["batch","displayName"],a),i}function createEmbeddingsBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["src"]);s!=null&&setValueByPath(i,["batch","inputConfig"],embeddingsBatchJobSourceToMldev(n,s));const r=getValueByPath(e,["config"]);return r!=null&&createEmbeddingsBatchJobConfigToMldev(r,i),i}function deleteBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function deleteBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function deleteResourceJobFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);return r!=null&&setValueByPath(e,["error"],r),e}function deleteResourceJobFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);return r!=null&&setValueByPath(e,["error"],r),e}function embedContentBatchToMldev(n,e){const i={},a=getValueByPath(e,["contents"]);if(a!=null){let r=tContentsForEmbed(n,a);Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(i,["requests[]","request","content"],r)}const s=getValueByPath(e,["config"]);return s!=null&&(setValueByPath(i,["_self"],embedContentConfigToMldev$1(s,i)),moveValueByPath(i,{"requests[].*":"requests[].request.*"})),i}function embedContentConfigToMldev$1(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["requests[]","taskType"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&r!=null&&setValueByPath(e,["requests[]","outputDimensionality"],r),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embeddingsBatchJobSourceToMldev(n,e){const i={},a=getValueByPath(e,["fileName"]);a!=null&&setValueByPath(i,["file_name"],a);const s=getValueByPath(e,["inlinedRequests"]);return s!=null&&setValueByPath(i,["requests"],embedContentBatchToMldev(n,s)),i}function fileDataToMldev$4(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function functionCallToMldev$4(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const a=getValueByPath(n,["args"]);a!=null&&setValueByPath(e,["args"],a);const s=getValueByPath(n,["name"]);if(s!=null&&setValueByPath(e,["name"],s),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev$2(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const a=getValueByPath(n,["allowedFunctionNames"]);if(a!=null&&setValueByPath(e,["allowedFunctionNames"],a),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function generateContentConfigToMldev$1(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$4(tContent(s)));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);if(S!=null&&setValueByPath(a,["responseJsonSchema"],S),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let F=g;Array.isArray(F)&&(F=F.map(H=>safetySettingToMldev$1(H))),setValueByPath(i,["safetySettings"],F)}const C=getValueByPath(e,["tools"]);if(i!==void 0&&C!=null){let F=tTools(C);Array.isArray(F)&&(F=F.map(H=>toolToMldev$4(tTool(H)))),setValueByPath(i,["tools"],F)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev$2(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=getValueByPath(e,["cachedContent"]);i!==void 0&&B!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,B));const _=getValueByPath(e,["responseModalities"]);_!=null&&setValueByPath(a,["responseModalities"],_);const M=getValueByPath(e,["mediaResolution"]);M!=null&&setValueByPath(a,["mediaResolution"],M);const D=getValueByPath(e,["speechConfig"]);if(D!=null&&setValueByPath(a,["speechConfig"],tSpeechConfig(D)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const L=getValueByPath(e,["thinkingConfig"]);L!=null&&setValueByPath(a,["thinkingConfig"],L);const N=getValueByPath(e,["imageConfig"]);return N!=null&&setValueByPath(a,["imageConfig"],imageConfigToMldev$1(N)),a}function generateContentResponseFromMldev$1(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev$1(c))),setValueByPath(e,["candidates"],u)}const s=getValueByPath(n,["modelVersion"]);s!=null&&setValueByPath(e,["modelVersion"],s);const r=getValueByPath(n,["promptFeedback"]);r!=null&&setValueByPath(e,["promptFeedback"],r);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function getBatchJobParametersToMldev(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function getBatchJobParametersToVertex(n,e){const i={},a=getValueByPath(e,["name"]);return a!=null&&setValueByPath(i,["_url","name"],tBatchJobName(n,a)),i}function googleMapsToMldev$4(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$4(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev$1(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);if(a!=null&&setValueByPath(e,["imageSize"],a),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function inlinedRequestToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["request","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let l=tContents(s);Array.isArray(l)&&(l=l.map(u=>contentToMldev$4(u))),setValueByPath(i,["request","contents"],l)}const r=getValueByPath(e,["metadata"]);r!=null&&setValueByPath(i,["metadata"],r);const o=getValueByPath(e,["config"]);return o!=null&&setValueByPath(i,["request","generationConfig"],generateContentConfigToMldev$1(n,o,getValueByPath(i,["request"],{}))),i}function inlinedResponseFromMldev(n){const e={},i=getValueByPath(n,["response"]);i!=null&&setValueByPath(e,["response"],generateContentResponseFromMldev$1(i));const a=getValueByPath(n,["error"]);return a!=null&&setValueByPath(e,["error"],a),e}function listBatchJobsConfigToMldev(n,e){const i={},a=getValueByPath(n,["pageSize"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageSize"],a);const s=getValueByPath(n,["pageToken"]);if(e!==void 0&&s!=null&&setValueByPath(e,["_query","pageToken"],s),getValueByPath(n,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return i}function listBatchJobsConfigToVertex(n,e){const i={},a=getValueByPath(n,["pageSize"]);e!==void 0&&a!=null&&setValueByPath(e,["_query","pageSize"],a);const s=getValueByPath(n,["pageToken"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageToken"],s);const r=getValueByPath(n,["filter"]);return e!==void 0&&r!=null&&setValueByPath(e,["_query","filter"],r),i}function listBatchJobsParametersToMldev(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToMldev(i,e),e}function listBatchJobsParametersToVertex(n){const e={},i=getValueByPath(n,["config"]);return i!=null&&listBatchJobsConfigToVertex(i,e),e}function listBatchJobsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["operations"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>batchJobFromMldev(o))),setValueByPath(e,["batchJobs"],r)}return e}function listBatchJobsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["batchPredictionJobs"]);if(s!=null){let r=s;Array.isArray(r)&&(r=r.map(o=>batchJobFromVertex(o))),setValueByPath(e,["batchJobs"],r)}return e}function partToMldev$4(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const a=getValueByPath(n,["codeExecutionResult"]);a!=null&&setValueByPath(e,["codeExecutionResult"],a);const s=getValueByPath(n,["executableCode"]);s!=null&&setValueByPath(e,["executableCode"],s);const r=getValueByPath(n,["fileData"]);r!=null&&setValueByPath(e,["fileData"],fileDataToMldev$4(r));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$4(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$4(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const d=getValueByPath(n,["thought"]);d!=null&&setValueByPath(e,["thought"],d);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const f=getValueByPath(n,["videoMetadata"]);return f!=null&&setValueByPath(e,["videoMetadata"],f),e}function safetySettingToMldev$1(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=getValueByPath(n,["threshold"]);return a!=null&&setValueByPath(e,["threshold"],a),e}function toolConfigToMldev$2(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev$2(i));const a=getValueByPath(n,["retrievalConfig"]);return a!=null&&setValueByPath(e,["retrievalConfig"],a),e}function toolToMldev$4(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let d=i;Array.isArray(d)&&(d=d.map(p=>p)),setValueByPath(e,["functionDeclarations"],d)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=getValueByPath(n,["googleSearchRetrieval"]);a!=null&&setValueByPath(e,["googleSearchRetrieval"],a);const s=getValueByPath(n,["computerUse"]);s!=null&&setValueByPath(e,["computerUse"],s);const r=getValueByPath(n,["fileSearch"]);r!=null&&setValueByPath(e,["fileSearch"],r);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$4(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$4(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}/**
|
|
188
188
|
* @license
|
|
189
189
|
* Copyright 2025 Google LLC
|
|
190
190
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -224,7 +224,7 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
224
224
|
* @license
|
|
225
225
|
* Copyright 2025 Google LLC
|
|
226
226
|
* SPDX-License-Identifier: Apache-2.0
|
|
227
|
-
*/function blobToMldev$1(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function candidateFromMldev(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const a=getValueByPath(n,["citationMetadata"]);a!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev(a));const s=getValueByPath(n,["tokenCount"]);s!=null&&setValueByPath(e,["tokenCount"],s);const r=getValueByPath(n,["finishReason"]);r!=null&&setValueByPath(e,["finishReason"],r);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const d=getValueByPath(n,["safetyRatings"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(m=>m)),setValueByPath(e,["safetyRatings"],f)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>s)),setValueByPath(e,["citations"],a)}return e}function computeTokensParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let r=tContents(s);Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(i,["contents"],r)}return i}function computeTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["tokensInfo"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["tokensInfo"],s)}return e}function contentEmbeddingFromVertex(n){const e={},i=getValueByPath(n,["values"]);i!=null&&setValueByPath(e,["values"],i);const a=getValueByPath(n,["statistics"]);return a!=null&&setValueByPath(e,["statistics"],contentEmbeddingStatisticsFromVertex(a)),e}function contentEmbeddingStatisticsFromVertex(n){const e={},i=getValueByPath(n,["truncated"]);i!=null&&setValueByPath(e,["truncated"],i);const a=getValueByPath(n,["token_count"]);return a!=null&&setValueByPath(e,["tokenCount"],a),e}function contentToMldev$1(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>partToMldev$1(r))),setValueByPath(e,["parts"],s)}const a=getValueByPath(n,["role"]);return a!=null&&setValueByPath(e,["role"],a),e}function controlReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["controlType"]);i!=null&&setValueByPath(e,["controlType"],i);const a=getValueByPath(n,["enableControlImageComputation"]);return a!=null&&setValueByPath(e,["computeControl"],a),e}function countTokensConfigToMldev(n){const e={};if(getValueByPath(n,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(getValueByPath(n,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(getValueByPath(n,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return e}function countTokensConfigToVertex(n,e){const i={},a=getValueByPath(n,["systemInstruction"]);e!==void 0&&a!=null&&setValueByPath(e,["systemInstruction"],tContent(a));const s=getValueByPath(n,["tools"]);if(e!==void 0&&s!=null){let o=s;Array.isArray(o)&&(o=o.map(l=>toolToVertex(l))),setValueByPath(e,["tools"],o)}const r=getValueByPath(n,["generationConfig"]);return e!==void 0&&r!=null&&setValueByPath(e,["generationConfig"],generationConfigToVertex(r)),i}function countTokensParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&countTokensConfigToMldev(r),i}function countTokensParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&countTokensConfigToVertex(r,i),i}function countTokensResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["totalTokens"]);a!=null&&setValueByPath(e,["totalTokens"],a);const s=getValueByPath(n,["cachedContentTokenCount"]);return s!=null&&setValueByPath(e,["cachedContentTokenCount"],s),e}function countTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["totalTokens"]);return a!=null&&setValueByPath(e,["totalTokens"],a),e}function deleteModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function deleteModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function deleteModelResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function deleteModelResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function editImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["negativePrompt"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","negativePrompt"],s);const r=getValueByPath(n,["numberOfImages"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","sampleCount"],r);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const f=getValueByPath(n,["includeRaiReason"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","includeRaiReason"],f);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const S=getValueByPath(n,["editMode"]);e!==void 0&&S!=null&&setValueByPath(e,["parameters","editMode"],S);const g=getValueByPath(n,["baseSteps"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","editConfig","baseSteps"],g),i}function editImageParametersInternalToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["referenceImages"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(u=>referenceImageAPIInternalToVertex(u))),setValueByPath(i,["instances[0]","referenceImages"],l)}const o=getValueByPath(e,["config"]);return o!=null&&editImageConfigToVertex(o,i),i}function editImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>generatedImageFromVertex(r))),setValueByPath(e,["generatedImages"],s)}return e}function embedContentConfigToMldev(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["requests[]","taskType"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&r!=null&&setValueByPath(e,["requests[]","outputDimensionality"],r),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embedContentConfigToVertex(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[]","task_type"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","outputDimensionality"],r);const o=getValueByPath(n,["mimeType"]);e!==void 0&&o!=null&&setValueByPath(e,["instances[]","mimeType"],o);const l=getValueByPath(n,["autoTruncate"]);return e!==void 0&&l!=null&&setValueByPath(e,["parameters","autoTruncate"],l),i}function embedContentParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let l=tContentsForEmbed(n,s);Array.isArray(l)&&(l=l.map(u=>u)),setValueByPath(i,["requests[]","content"],l)}const r=getValueByPath(e,["config"]);r!=null&&embedContentConfigToMldev(r,i);const o=getValueByPath(e,["model"]);return o!==void 0&&setValueByPath(i,["requests[]","model"],tModel(n,o)),i}function embedContentParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContentsForEmbed(n,s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["instances[]","content"],o)}const r=getValueByPath(e,["config"]);return r!=null&&embedContentConfigToVertex(r,i),i}function embedContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["embeddings"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(e,["embeddings"],r)}const s=getValueByPath(n,["metadata"]);return s!=null&&setValueByPath(e,["metadata"],s),e}function embedContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions[]","embeddings"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>contentEmbeddingFromVertex(o))),setValueByPath(e,["embeddings"],r)}const s=getValueByPath(n,["metadata"]);return s!=null&&setValueByPath(e,["metadata"],s),e}function endpointFromVertex(n){const e={},i=getValueByPath(n,["endpoint"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["deployedModelId"]);return a!=null&&setValueByPath(e,["deployedModelId"],a),e}function fileDataToMldev$1(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function functionCallToMldev$1(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const a=getValueByPath(n,["args"]);a!=null&&setValueByPath(e,["args"],a);const s=getValueByPath(n,["name"]);if(s!=null&&setValueByPath(e,["name"],s),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const a=getValueByPath(n,["allowedFunctionNames"]);if(a!=null&&setValueByPath(e,["allowedFunctionNames"],a),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function functionDeclarationToVertex(n){const e={};if(getValueByPath(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const i=getValueByPath(n,["description"]);i!=null&&setValueByPath(e,["description"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["parameters"]);s!=null&&setValueByPath(e,["parameters"],s);const r=getValueByPath(n,["parametersJsonSchema"]);r!=null&&setValueByPath(e,["parametersJsonSchema"],r);const o=getValueByPath(n,["response"]);o!=null&&setValueByPath(e,["response"],o);const l=getValueByPath(n,["responseJsonSchema"]);return l!=null&&setValueByPath(e,["responseJsonSchema"],l),e}function generateContentConfigToMldev(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$1(tContent(s)));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);if(S!=null&&setValueByPath(a,["responseJsonSchema"],S),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let N=g;Array.isArray(N)&&(N=N.map(H=>safetySettingToMldev(H))),setValueByPath(i,["safetySettings"],N)}const C=getValueByPath(e,["tools"]);if(i!==void 0&&C!=null){let N=tTools(C);Array.isArray(N)&&(N=N.map(H=>toolToMldev$1(tTool(H)))),setValueByPath(i,["tools"],N)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=getValueByPath(e,["cachedContent"]);i!==void 0&&B!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,B));const _=getValueByPath(e,["responseModalities"]);_!=null&&setValueByPath(a,["responseModalities"],_);const M=getValueByPath(e,["mediaResolution"]);M!=null&&setValueByPath(a,["mediaResolution"],M);const D=getValueByPath(e,["speechConfig"]);if(D!=null&&setValueByPath(a,["speechConfig"],tSpeechConfig(D)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const L=getValueByPath(e,["thinkingConfig"]);L!=null&&setValueByPath(a,["thinkingConfig"],L);const F=getValueByPath(e,["imageConfig"]);return F!=null&&setValueByPath(a,["imageConfig"],imageConfigToMldev(F)),a}function generateContentConfigToVertex(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],tContent(s));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);S!=null&&setValueByPath(a,["responseJsonSchema"],S);const g=getValueByPath(e,["routingConfig"]);g!=null&&setValueByPath(a,["routingConfig"],g);const C=getValueByPath(e,["modelSelectionConfig"]);C!=null&&setValueByPath(a,["modelConfig"],C);const E=getValueByPath(e,["safetySettings"]);if(i!==void 0&&E!=null){let b=E;Array.isArray(b)&&(b=b.map(I=>I)),setValueByPath(i,["safetySettings"],b)}const B=getValueByPath(e,["tools"]);if(i!==void 0&&B!=null){let b=tTools(B);Array.isArray(b)&&(b=b.map(I=>toolToVertex(tTool(I)))),setValueByPath(i,["tools"],b)}const _=getValueByPath(e,["toolConfig"]);i!==void 0&&_!=null&&setValueByPath(i,["toolConfig"],_);const M=getValueByPath(e,["labels"]);i!==void 0&&M!=null&&setValueByPath(i,["labels"],M);const D=getValueByPath(e,["cachedContent"]);i!==void 0&&D!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,D));const L=getValueByPath(e,["responseModalities"]);L!=null&&setValueByPath(a,["responseModalities"],L);const F=getValueByPath(e,["mediaResolution"]);F!=null&&setValueByPath(a,["mediaResolution"],F);const N=getValueByPath(e,["speechConfig"]);N!=null&&setValueByPath(a,["speechConfig"],speechConfigToVertex(tSpeechConfig(N)));const H=getValueByPath(e,["audioTimestamp"]);H!=null&&setValueByPath(a,["audioTimestamp"],H);const $=getValueByPath(e,["thinkingConfig"]);$!=null&&setValueByPath(a,["thinkingConfig"],$);const O=getValueByPath(e,["imageConfig"]);return O!=null&&setValueByPath(a,["imageConfig"],imageConfigToVertex(O)),a}function generateContentParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToMldev(n,r,i)),i}function generateContentParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToVertex(n,r,i)),i}function generateContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev(c))),setValueByPath(e,["candidates"],u)}const s=getValueByPath(n,["modelVersion"]);s!=null&&setValueByPath(e,["modelVersion"],s);const r=getValueByPath(n,["promptFeedback"]);r!=null&&setValueByPath(e,["promptFeedback"],r);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function generateContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let c=a;Array.isArray(c)&&(c=c.map(d=>d)),setValueByPath(e,["candidates"],c)}const s=getValueByPath(n,["createTime"]);s!=null&&setValueByPath(e,["createTime"],s);const r=getValueByPath(n,["modelVersion"]);r!=null&&setValueByPath(e,["modelVersion"],r);const o=getValueByPath(n,["promptFeedback"]);o!=null&&setValueByPath(e,["promptFeedback"],o);const l=getValueByPath(n,["responseId"]);l!=null&&setValueByPath(e,["responseId"],l);const u=getValueByPath(n,["usageMetadata"]);return u!=null&&setValueByPath(e,["usageMetadata"],u),e}function generateImagesConfigToMldev(n,e){const i={};if(getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["aspectRatio"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","aspectRatio"],s);const r=getValueByPath(n,["guidanceScale"]);if(e!==void 0&&r!=null&&setValueByPath(e,["parameters","guidanceScale"],r),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const o=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","safetySetting"],o);const l=getValueByPath(n,["personGeneration"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l);const u=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],u);const c=getValueByPath(n,["includeRaiReason"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","includeRaiReason"],c);const d=getValueByPath(n,["language"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","language"],d);const p=getValueByPath(n,["outputMimeType"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],p);const f=getValueByPath(n,["outputCompressionQuality"]);if(e!==void 0&&f!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],f),getValueByPath(n,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const m=getValueByPath(n,["imageSize"]);if(e!==void 0&&m!=null&&setValueByPath(e,["parameters","sampleImageSize"],m),getValueByPath(n,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return i}function generateImagesConfigToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["negativePrompt"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","negativePrompt"],s);const r=getValueByPath(n,["numberOfImages"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","sampleCount"],r);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const f=getValueByPath(n,["includeRaiReason"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","includeRaiReason"],f);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const S=getValueByPath(n,["imageSize"]);e!==void 0&&S!=null&&setValueByPath(e,["parameters","sampleImageSize"],S);const g=getValueByPath(n,["enhancePrompt"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","enhancePrompt"],g),i}function generateImagesParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["config"]);return r!=null&&generateImagesConfigToMldev(r,i),i}function generateImagesParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["config"]);return r!=null&&generateImagesConfigToVertex(r,i),i}function generateImagesResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>generatedImageFromMldev(o))),setValueByPath(e,["generatedImages"],r)}const s=getValueByPath(n,["positivePromptSafetyAttributes"]);return s!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromMldev(s)),e}function generateImagesResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>generatedImageFromVertex(o))),setValueByPath(e,["generatedImages"],r)}const s=getValueByPath(n,["positivePromptSafetyAttributes"]);return s!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromVertex(s)),e}function generateVideosConfigToMldev(n,e){const i={},a=getValueByPath(n,["numberOfVideos"]);if(e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a),getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const s=getValueByPath(n,["durationSeconds"]);if(e!==void 0&&s!=null&&setValueByPath(e,["parameters","durationSeconds"],s),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const r=getValueByPath(n,["aspectRatio"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","aspectRatio"],r);const o=getValueByPath(n,["resolution"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","resolution"],o);const l=getValueByPath(n,["personGeneration"]);if(e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l),getValueByPath(n,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const u=getValueByPath(n,["negativePrompt"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","negativePrompt"],u);const c=getValueByPath(n,["enhancePrompt"]);if(e!==void 0&&c!=null&&setValueByPath(e,["parameters","enhancePrompt"],c),getValueByPath(n,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const d=getValueByPath(n,["lastFrame"]);e!==void 0&&d!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToMldev(d));const p=getValueByPath(n,["referenceImages"]);if(e!==void 0&&p!=null){let f=p;Array.isArray(f)&&(f=f.map(m=>videoGenerationReferenceImageToMldev(m))),setValueByPath(e,["instances[0]","referenceImages"],f)}if(getValueByPath(n,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(getValueByPath(n,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return i}function generateVideosConfigToVertex(n,e){const i={},a=getValueByPath(n,["numberOfVideos"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["outputGcsUri"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","storageUri"],s);const r=getValueByPath(n,["fps"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","fps"],r);const o=getValueByPath(n,["durationSeconds"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","durationSeconds"],o);const l=getValueByPath(n,["seed"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","seed"],l);const u=getValueByPath(n,["aspectRatio"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","aspectRatio"],u);const c=getValueByPath(n,["resolution"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","resolution"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["pubsubTopic"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","pubsubTopic"],p);const f=getValueByPath(n,["negativePrompt"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","negativePrompt"],f);const m=getValueByPath(n,["enhancePrompt"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","enhancePrompt"],m);const P=getValueByPath(n,["generateAudio"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","generateAudio"],P);const T=getValueByPath(n,["lastFrame"]);e!==void 0&&T!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToVertex(T));const x=getValueByPath(n,["referenceImages"]);if(e!==void 0&&x!=null){let g=x;Array.isArray(g)&&(g=g.map(C=>videoGenerationReferenceImageToVertex(C))),setValueByPath(e,["instances[0]","referenceImages"],g)}const y=getValueByPath(n,["mask"]);e!==void 0&&y!=null&&setValueByPath(e,["instances[0]","mask"],videoGenerationMaskToVertex(y));const S=getValueByPath(n,["compressionQuality"]);return e!==void 0&&S!=null&&setValueByPath(e,["parameters","compressionQuality"],S),i}function generateVideosOperationFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata"]);a!=null&&setValueByPath(e,["metadata"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["response","generateVideoResponse"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromMldev(o)),e}function generateVideosOperationFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata"]);a!=null&&setValueByPath(e,["metadata"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromVertex(o)),e}function generateVideosParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["image"]);r!=null&&setValueByPath(i,["instances[0]","image"],imageToMldev(r));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToMldev(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToMldev(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToMldev(u,i),i}function generateVideosParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["image"]);r!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(r));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToVertex(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToVertex(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToVertex(u,i),i}function generateVideosResponseFromMldev(n){const e={},i=getValueByPath(n,["generatedSamples"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(o=>generatedVideoFromMldev(o))),setValueByPath(e,["generatedVideos"],r)}const a=getValueByPath(n,["raiMediaFilteredCount"]);a!=null&&setValueByPath(e,["raiMediaFilteredCount"],a);const s=getValueByPath(n,["raiMediaFilteredReasons"]);return s!=null&&setValueByPath(e,["raiMediaFilteredReasons"],s),e}function generateVideosResponseFromVertex(n){const e={},i=getValueByPath(n,["videos"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(o=>generatedVideoFromVertex(o))),setValueByPath(e,["generatedVideos"],r)}const a=getValueByPath(n,["raiMediaFilteredCount"]);a!=null&&setValueByPath(e,["raiMediaFilteredCount"],a);const s=getValueByPath(n,["raiMediaFilteredReasons"]);return s!=null&&setValueByPath(e,["raiMediaFilteredReasons"],s),e}function generateVideosSourceToMldev(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToMldev(s));const r=getValueByPath(n,["video"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","video"],videoToMldev(r)),i}function generateVideosSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(n,["video"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","video"],videoToVertex(r)),i}function generatedImageFromMldev(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromMldev(i));const a=getValueByPath(n,["raiFilteredReason"]);a!=null&&setValueByPath(e,["raiFilteredReason"],a);const s=getValueByPath(n,["_self"]);return s!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromMldev(s)),e}function generatedImageFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromVertex(i));const a=getValueByPath(n,["raiFilteredReason"]);a!=null&&setValueByPath(e,["raiFilteredReason"],a);const s=getValueByPath(n,["_self"]);s!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromVertex(s));const r=getValueByPath(n,["prompt"]);return r!=null&&setValueByPath(e,["enhancedPrompt"],r),e}function generatedImageMaskFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["mask"],imageFromVertex(i));const a=getValueByPath(n,["labels"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["labels"],s)}return e}function generatedVideoFromMldev(n){const e={},i=getValueByPath(n,["video"]);return i!=null&&setValueByPath(e,["video"],videoFromMldev(i)),e}function generatedVideoFromVertex(n){const e={},i=getValueByPath(n,["_self"]);return i!=null&&setValueByPath(e,["video"],videoFromVertex(i)),e}function generationConfigToVertex(n){const e={},i=getValueByPath(n,["modelSelectionConfig"]);i!=null&&setValueByPath(e,["modelConfig"],i);const a=getValueByPath(n,["responseJsonSchema"]);a!=null&&setValueByPath(e,["responseJsonSchema"],a);const s=getValueByPath(n,["audioTimestamp"]);s!=null&&setValueByPath(e,["audioTimestamp"],s);const r=getValueByPath(n,["candidateCount"]);r!=null&&setValueByPath(e,["candidateCount"],r);const o=getValueByPath(n,["enableAffectiveDialog"]);o!=null&&setValueByPath(e,["enableAffectiveDialog"],o);const l=getValueByPath(n,["frequencyPenalty"]);l!=null&&setValueByPath(e,["frequencyPenalty"],l);const u=getValueByPath(n,["logprobs"]);u!=null&&setValueByPath(e,["logprobs"],u);const c=getValueByPath(n,["maxOutputTokens"]);c!=null&&setValueByPath(e,["maxOutputTokens"],c);const d=getValueByPath(n,["mediaResolution"]);d!=null&&setValueByPath(e,["mediaResolution"],d);const p=getValueByPath(n,["presencePenalty"]);p!=null&&setValueByPath(e,["presencePenalty"],p);const f=getValueByPath(n,["responseLogprobs"]);f!=null&&setValueByPath(e,["responseLogprobs"],f);const m=getValueByPath(n,["responseMimeType"]);m!=null&&setValueByPath(e,["responseMimeType"],m);const P=getValueByPath(n,["responseModalities"]);P!=null&&setValueByPath(e,["responseModalities"],P);const T=getValueByPath(n,["responseSchema"]);T!=null&&setValueByPath(e,["responseSchema"],T);const x=getValueByPath(n,["routingConfig"]);x!=null&&setValueByPath(e,["routingConfig"],x);const y=getValueByPath(n,["seed"]);y!=null&&setValueByPath(e,["seed"],y);const S=getValueByPath(n,["speechConfig"]);S!=null&&setValueByPath(e,["speechConfig"],speechConfigToVertex(S));const g=getValueByPath(n,["stopSequences"]);g!=null&&setValueByPath(e,["stopSequences"],g);const C=getValueByPath(n,["temperature"]);C!=null&&setValueByPath(e,["temperature"],C);const E=getValueByPath(n,["thinkingConfig"]);E!=null&&setValueByPath(e,["thinkingConfig"],E);const B=getValueByPath(n,["topK"]);B!=null&&setValueByPath(e,["topK"],B);const _=getValueByPath(n,["topP"]);if(_!=null&&setValueByPath(e,["topP"],_),getValueByPath(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function getModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function getModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function googleMapsToMldev$1(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$1(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);if(a!=null&&setValueByPath(e,["imageSize"],a),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function imageConfigToVertex(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);a!=null&&setValueByPath(e,["imageSize"],a);const s=getValueByPath(n,["outputMimeType"]);s!=null&&setValueByPath(e,["imageOutputOptions","mimeType"],s);const r=getValueByPath(n,["outputCompressionQuality"]);return r!=null&&setValueByPath(e,["imageOutputOptions","compressionQuality"],r),e}function imageFromMldev(n){const e={},i=getValueByPath(n,["bytesBase64Encoded"]);i!=null&&setValueByPath(e,["imageBytes"],tBytes(i));const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function imageFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["bytesBase64Encoded"]);a!=null&&setValueByPath(e,["imageBytes"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function imageToMldev(n){const e={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const i=getValueByPath(n,["imageBytes"]);i!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(i));const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function imageToVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["imageBytes"]);a!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function listModelsConfigToMldev(n,e,i){const a={},s=getValueByPath(e,["pageSize"]);i!==void 0&&s!=null&&setValueByPath(i,["_query","pageSize"],s);const r=getValueByPath(e,["pageToken"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageToken"],r);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),a}function listModelsConfigToVertex(n,e,i){const a={},s=getValueByPath(e,["pageSize"]);i!==void 0&&s!=null&&setValueByPath(i,["_query","pageSize"],s);const r=getValueByPath(e,["pageToken"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageToken"],r);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),a}function listModelsParametersToMldev(n,e){const i={},a=getValueByPath(e,["config"]);return a!=null&&listModelsConfigToMldev(n,a,i),i}function listModelsParametersToVertex(n,e){const i={},a=getValueByPath(e,["config"]);return a!=null&&listModelsConfigToVertex(n,a,i),i}function listModelsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["_self"]);if(s!=null){let r=tExtractModels(s);Array.isArray(r)&&(r=r.map(o=>modelFromMldev(o))),setValueByPath(e,["models"],r)}return e}function listModelsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["_self"]);if(s!=null){let r=tExtractModels(s);Array.isArray(r)&&(r=r.map(o=>modelFromVertex(o))),setValueByPath(e,["models"],r)}return e}function maskReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["maskMode"]);i!=null&&setValueByPath(e,["maskMode"],i);const a=getValueByPath(n,["segmentationClasses"]);a!=null&&setValueByPath(e,["maskClasses"],a);const s=getValueByPath(n,["maskDilation"]);return s!=null&&setValueByPath(e,["dilation"],s),e}function modelFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["version"]);r!=null&&setValueByPath(e,["version"],r);const o=getValueByPath(n,["_self"]);o!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromMldev(o));const l=getValueByPath(n,["inputTokenLimit"]);l!=null&&setValueByPath(e,["inputTokenLimit"],l);const u=getValueByPath(n,["outputTokenLimit"]);u!=null&&setValueByPath(e,["outputTokenLimit"],u);const c=getValueByPath(n,["supportedGenerationMethods"]);c!=null&&setValueByPath(e,["supportedActions"],c);const d=getValueByPath(n,["temperature"]);d!=null&&setValueByPath(e,["temperature"],d);const p=getValueByPath(n,["maxTemperature"]);p!=null&&setValueByPath(e,["maxTemperature"],p);const f=getValueByPath(n,["topP"]);f!=null&&setValueByPath(e,["topP"],f);const m=getValueByPath(n,["topK"]);m!=null&&setValueByPath(e,["topK"],m);const P=getValueByPath(n,["thinking"]);return P!=null&&setValueByPath(e,["thinking"],P),e}function modelFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["versionId"]);r!=null&&setValueByPath(e,["version"],r);const o=getValueByPath(n,["deployedModels"]);if(o!=null){let p=o;Array.isArray(p)&&(p=p.map(f=>endpointFromVertex(f))),setValueByPath(e,["endpoints"],p)}const l=getValueByPath(n,["labels"]);l!=null&&setValueByPath(e,["labels"],l);const u=getValueByPath(n,["_self"]);u!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromVertex(u));const c=getValueByPath(n,["defaultCheckpointId"]);c!=null&&setValueByPath(e,["defaultCheckpointId"],c);const d=getValueByPath(n,["checkpoints"]);if(d!=null){let p=d;Array.isArray(p)&&(p=p.map(f=>f)),setValueByPath(e,["checkpoints"],p)}return e}function partToMldev$1(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const a=getValueByPath(n,["codeExecutionResult"]);a!=null&&setValueByPath(e,["codeExecutionResult"],a);const s=getValueByPath(n,["executableCode"]);s!=null&&setValueByPath(e,["executableCode"],s);const r=getValueByPath(n,["fileData"]);r!=null&&setValueByPath(e,["fileData"],fileDataToMldev$1(r));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$1(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$1(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const d=getValueByPath(n,["thought"]);d!=null&&setValueByPath(e,["thought"],d);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const f=getValueByPath(n,["videoMetadata"]);return f!=null&&setValueByPath(e,["videoMetadata"],f),e}function productImageToVertex(n){const e={},i=getValueByPath(n,["productImage"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function recontextImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["baseSteps"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","baseSteps"],s);const r=getValueByPath(n,["outputGcsUri"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","storageUri"],r);const o=getValueByPath(n,["seed"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","seed"],o);const l=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","safetySetting"],l);const u=getValueByPath(n,["personGeneration"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","personGeneration"],u);const c=getValueByPath(n,["addWatermark"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","addWatermark"],c);const d=getValueByPath(n,["outputMimeType"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],d);const p=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],p);const f=getValueByPath(n,["enhancePrompt"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","enhancePrompt"],f);const m=getValueByPath(n,["labels"]);return e!==void 0&&m!=null&&setValueByPath(e,["labels"],m),i}function recontextImageParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["source"]);s!=null&&recontextImageSourceToVertex(s,i);const r=getValueByPath(e,["config"]);return r!=null&&recontextImageConfigToVertex(r,i),i}function recontextImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>generatedImageFromVertex(s))),setValueByPath(e,["generatedImages"],a)}return e}function recontextImageSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["personImage"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","personImage","image"],imageToVertex(s));const r=getValueByPath(n,["productImages"]);if(e!==void 0&&r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>productImageToVertex(l))),setValueByPath(e,["instances[0]","productImages"],o)}return i}function referenceImageAPIInternalToVertex(n){const e={},i=getValueByPath(n,["referenceImage"]);i!=null&&setValueByPath(e,["referenceImage"],imageToVertex(i));const a=getValueByPath(n,["referenceId"]);a!=null&&setValueByPath(e,["referenceId"],a);const s=getValueByPath(n,["referenceType"]);s!=null&&setValueByPath(e,["referenceType"],s);const r=getValueByPath(n,["maskImageConfig"]);r!=null&&setValueByPath(e,["maskImageConfig"],maskReferenceConfigToVertex(r));const o=getValueByPath(n,["controlImageConfig"]);o!=null&&setValueByPath(e,["controlImageConfig"],controlReferenceConfigToVertex(o));const l=getValueByPath(n,["styleImageConfig"]);l!=null&&setValueByPath(e,["styleImageConfig"],l);const u=getValueByPath(n,["subjectImageConfig"]);return u!=null&&setValueByPath(e,["subjectImageConfig"],u),e}function safetyAttributesFromMldev(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const a=getValueByPath(n,["safetyAttributes","scores"]);a!=null&&setValueByPath(e,["scores"],a);const s=getValueByPath(n,["contentType"]);return s!=null&&setValueByPath(e,["contentType"],s),e}function safetyAttributesFromVertex(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const a=getValueByPath(n,["safetyAttributes","scores"]);a!=null&&setValueByPath(e,["scores"],a);const s=getValueByPath(n,["contentType"]);return s!=null&&setValueByPath(e,["contentType"],s),e}function safetySettingToMldev(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=getValueByPath(n,["threshold"]);return a!=null&&setValueByPath(e,["threshold"],a),e}function scribbleImageToVertex(n){const e={},i=getValueByPath(n,["image"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function segmentImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["mode"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","mode"],a);const s=getValueByPath(n,["maxPredictions"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","maxPredictions"],s);const r=getValueByPath(n,["confidenceThreshold"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","confidenceThreshold"],r);const o=getValueByPath(n,["maskDilation"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","maskDilation"],o);const l=getValueByPath(n,["binaryColorThreshold"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","binaryColorThreshold"],l);const u=getValueByPath(n,["labels"]);return e!==void 0&&u!=null&&setValueByPath(e,["labels"],u),i}function segmentImageParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["source"]);s!=null&&segmentImageSourceToVertex(s,i);const r=getValueByPath(e,["config"]);return r!=null&&segmentImageConfigToVertex(r,i),i}function segmentImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>generatedImageMaskFromVertex(s))),setValueByPath(e,["generatedMasks"],a)}return e}function segmentImageSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(n,["scribbleImage"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","scribble"],scribbleImageToVertex(r)),i}function speechConfigToVertex(n){const e={},i=getValueByPath(n,["languageCode"]);i!=null&&setValueByPath(e,["languageCode"],i);const a=getValueByPath(n,["voiceConfig"]);if(a!=null&&setValueByPath(e,["voiceConfig"],a),getValueByPath(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}function toolConfigToMldev(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev(i));const a=getValueByPath(n,["retrievalConfig"]);return a!=null&&setValueByPath(e,["retrievalConfig"],a),e}function toolToMldev$1(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let d=i;Array.isArray(d)&&(d=d.map(p=>p)),setValueByPath(e,["functionDeclarations"],d)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=getValueByPath(n,["googleSearchRetrieval"]);a!=null&&setValueByPath(e,["googleSearchRetrieval"],a);const s=getValueByPath(n,["computerUse"]);s!=null&&setValueByPath(e,["computerUse"],s);const r=getValueByPath(n,["fileSearch"]);r!=null&&setValueByPath(e,["fileSearch"],r);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$1(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$1(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}function toolToVertex(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let p=i;Array.isArray(p)&&(p=p.map(f=>functionDeclarationToVertex(f))),setValueByPath(e,["functionDeclarations"],p)}const a=getValueByPath(n,["retrieval"]);a!=null&&setValueByPath(e,["retrieval"],a);const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);if(r!=null&&setValueByPath(e,["computerUse"],r),getValueByPath(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=getValueByPath(n,["codeExecution"]);o!=null&&setValueByPath(e,["codeExecution"],o);const l=getValueByPath(n,["enterpriseWebSearch"]);l!=null&&setValueByPath(e,["enterpriseWebSearch"],l);const u=getValueByPath(n,["googleMaps"]);u!=null&&setValueByPath(e,["googleMaps"],u);const c=getValueByPath(n,["googleSearch"]);c!=null&&setValueByPath(e,["googleSearch"],c);const d=getValueByPath(n,["urlContext"]);return d!=null&&setValueByPath(e,["urlContext"],d),e}function tunedModelInfoFromMldev(n){const e={},i=getValueByPath(n,["baseModel"]);i!=null&&setValueByPath(e,["baseModel"],i);const a=getValueByPath(n,["createTime"]);a!=null&&setValueByPath(e,["createTime"],a);const s=getValueByPath(n,["updateTime"]);return s!=null&&setValueByPath(e,["updateTime"],s),e}function tunedModelInfoFromVertex(n){const e={},i=getValueByPath(n,["labels","google-vertex-llm-tuning-base-model-id"]);i!=null&&setValueByPath(e,["baseModel"],i);const a=getValueByPath(n,["createTime"]);a!=null&&setValueByPath(e,["createTime"],a);const s=getValueByPath(n,["updateTime"]);return s!=null&&setValueByPath(e,["updateTime"],s),e}function updateModelConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);e!==void 0&&s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&r!=null&&setValueByPath(e,["defaultCheckpointId"],r),i}function updateModelConfigToVertex(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);e!==void 0&&s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&r!=null&&setValueByPath(e,["defaultCheckpointId"],r),i}function updateModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","name"],tModel(n,a));const s=getValueByPath(e,["config"]);return s!=null&&updateModelConfigToMldev(s,i),i}function updateModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["config"]);return s!=null&&updateModelConfigToVertex(s,i),i}function upscaleImageAPIConfigInternalToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","safetySetting"],s);const r=getValueByPath(n,["personGeneration"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","personGeneration"],r);const o=getValueByPath(n,["includeRaiReason"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","includeRaiReason"],o);const l=getValueByPath(n,["outputMimeType"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],l);const u=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],u);const c=getValueByPath(n,["enhanceInputImage"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","upscaleConfig","enhanceInputImage"],c);const d=getValueByPath(n,["imagePreservationFactor"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","upscaleConfig","imagePreservationFactor"],d);const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const f=getValueByPath(n,["numberOfImages"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","sampleCount"],f);const m=getValueByPath(n,["mode"]);return e!==void 0&&m!=null&&setValueByPath(e,["parameters","mode"],m),i}function upscaleImageAPIParametersInternalToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["image"]);s!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(e,["upscaleFactor"]);r!=null&&setValueByPath(i,["parameters","upscaleConfig","upscaleFactor"],r);const o=getValueByPath(e,["config"]);return o!=null&&upscaleImageAPIConfigInternalToVertex(o,i),i}function upscaleImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>generatedImageFromVertex(r))),setValueByPath(e,["generatedImages"],s)}return e}function videoFromMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["encodedVideo"]);a!=null&&setValueByPath(e,["videoBytes"],tBytes(a));const s=getValueByPath(n,["encoding"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function videoFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["bytesBase64Encoded"]);a!=null&&setValueByPath(e,["videoBytes"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function videoGenerationMaskToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["_self"],imageToVertex(i));const a=getValueByPath(n,["maskMode"]);return a!=null&&setValueByPath(e,["maskMode"],a),e}function videoGenerationReferenceImageToMldev(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToMldev(i));const a=getValueByPath(n,["referenceType"]);return a!=null&&setValueByPath(e,["referenceType"],a),e}function videoGenerationReferenceImageToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToVertex(i));const a=getValueByPath(n,["referenceType"]);return a!=null&&setValueByPath(e,["referenceType"],a),e}function videoToMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["videoBytes"]);a!=null&&setValueByPath(e,["encodedVideo"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["encoding"],s),e}function videoToVertex(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["videoBytes"]);a!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}/**
|
|
227
|
+
*/function blobToMldev$1(n){const e={},i=getValueByPath(n,["data"]);if(i!=null&&setValueByPath(e,["data"],i),getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function candidateFromMldev(n){const e={},i=getValueByPath(n,["content"]);i!=null&&setValueByPath(e,["content"],i);const a=getValueByPath(n,["citationMetadata"]);a!=null&&setValueByPath(e,["citationMetadata"],citationMetadataFromMldev(a));const s=getValueByPath(n,["tokenCount"]);s!=null&&setValueByPath(e,["tokenCount"],s);const r=getValueByPath(n,["finishReason"]);r!=null&&setValueByPath(e,["finishReason"],r);const o=getValueByPath(n,["avgLogprobs"]);o!=null&&setValueByPath(e,["avgLogprobs"],o);const l=getValueByPath(n,["groundingMetadata"]);l!=null&&setValueByPath(e,["groundingMetadata"],l);const u=getValueByPath(n,["index"]);u!=null&&setValueByPath(e,["index"],u);const c=getValueByPath(n,["logprobsResult"]);c!=null&&setValueByPath(e,["logprobsResult"],c);const d=getValueByPath(n,["safetyRatings"]);if(d!=null){let f=d;Array.isArray(f)&&(f=f.map(m=>m)),setValueByPath(e,["safetyRatings"],f)}const p=getValueByPath(n,["urlContextMetadata"]);return p!=null&&setValueByPath(e,["urlContextMetadata"],p),e}function citationMetadataFromMldev(n){const e={},i=getValueByPath(n,["citationSources"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>s)),setValueByPath(e,["citations"],a)}return e}function computeTokensParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let r=tContents(s);Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(i,["contents"],r)}return i}function computeTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["tokensInfo"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["tokensInfo"],s)}return e}function contentEmbeddingFromVertex(n){const e={},i=getValueByPath(n,["values"]);i!=null&&setValueByPath(e,["values"],i);const a=getValueByPath(n,["statistics"]);return a!=null&&setValueByPath(e,["statistics"],contentEmbeddingStatisticsFromVertex(a)),e}function contentEmbeddingStatisticsFromVertex(n){const e={},i=getValueByPath(n,["truncated"]);i!=null&&setValueByPath(e,["truncated"],i);const a=getValueByPath(n,["token_count"]);return a!=null&&setValueByPath(e,["tokenCount"],a),e}function contentToMldev$1(n){const e={},i=getValueByPath(n,["parts"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(r=>partToMldev$1(r))),setValueByPath(e,["parts"],s)}const a=getValueByPath(n,["role"]);return a!=null&&setValueByPath(e,["role"],a),e}function controlReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["controlType"]);i!=null&&setValueByPath(e,["controlType"],i);const a=getValueByPath(n,["enableControlImageComputation"]);return a!=null&&setValueByPath(e,["computeControl"],a),e}function countTokensConfigToMldev(n){const e={};if(getValueByPath(n,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(getValueByPath(n,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(getValueByPath(n,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return e}function countTokensConfigToVertex(n,e){const i={},a=getValueByPath(n,["systemInstruction"]);e!==void 0&&a!=null&&setValueByPath(e,["systemInstruction"],tContent(a));const s=getValueByPath(n,["tools"]);if(e!==void 0&&s!=null){let o=s;Array.isArray(o)&&(o=o.map(l=>toolToVertex(l))),setValueByPath(e,["tools"],o)}const r=getValueByPath(n,["generationConfig"]);return e!==void 0&&r!=null&&setValueByPath(e,["generationConfig"],generationConfigToVertex(r)),i}function countTokensParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&countTokensConfigToMldev(r),i}function countTokensParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&countTokensConfigToVertex(r,i),i}function countTokensResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["totalTokens"]);a!=null&&setValueByPath(e,["totalTokens"],a);const s=getValueByPath(n,["cachedContentTokenCount"]);return s!=null&&setValueByPath(e,["cachedContentTokenCount"],s),e}function countTokensResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["totalTokens"]);return a!=null&&setValueByPath(e,["totalTokens"],a),e}function deleteModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function deleteModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function deleteModelResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function deleteModelResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);return i!=null&&setValueByPath(e,["sdkHttpResponse"],i),e}function editImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["negativePrompt"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","negativePrompt"],s);const r=getValueByPath(n,["numberOfImages"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","sampleCount"],r);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const f=getValueByPath(n,["includeRaiReason"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","includeRaiReason"],f);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const S=getValueByPath(n,["editMode"]);e!==void 0&&S!=null&&setValueByPath(e,["parameters","editMode"],S);const g=getValueByPath(n,["baseSteps"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","editConfig","baseSteps"],g),i}function editImageParametersInternalToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["referenceImages"]);if(r!=null){let l=r;Array.isArray(l)&&(l=l.map(u=>referenceImageAPIInternalToVertex(u))),setValueByPath(i,["instances[0]","referenceImages"],l)}const o=getValueByPath(e,["config"]);return o!=null&&editImageConfigToVertex(o,i),i}function editImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>generatedImageFromVertex(r))),setValueByPath(e,["generatedImages"],s)}return e}function embedContentConfigToMldev(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["requests[]","taskType"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["requests[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);if(e!==void 0&&r!=null&&setValueByPath(e,["requests[]","outputDimensionality"],r),getValueByPath(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return i}function embedContentConfigToVertex(n,e){const i={},a=getValueByPath(n,["taskType"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[]","task_type"],a);const s=getValueByPath(n,["title"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[]","title"],s);const r=getValueByPath(n,["outputDimensionality"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","outputDimensionality"],r);const o=getValueByPath(n,["mimeType"]);e!==void 0&&o!=null&&setValueByPath(e,["instances[]","mimeType"],o);const l=getValueByPath(n,["autoTruncate"]);return e!==void 0&&l!=null&&setValueByPath(e,["parameters","autoTruncate"],l),i}function embedContentParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let l=tContentsForEmbed(n,s);Array.isArray(l)&&(l=l.map(u=>u)),setValueByPath(i,["requests[]","content"],l)}const r=getValueByPath(e,["config"]);r!=null&&embedContentConfigToMldev(r,i);const o=getValueByPath(e,["model"]);return o!==void 0&&setValueByPath(i,["requests[]","model"],tModel(n,o)),i}function embedContentParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContentsForEmbed(n,s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["instances[]","content"],o)}const r=getValueByPath(e,["config"]);return r!=null&&embedContentConfigToVertex(r,i),i}function embedContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["embeddings"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>o)),setValueByPath(e,["embeddings"],r)}const s=getValueByPath(n,["metadata"]);return s!=null&&setValueByPath(e,["metadata"],s),e}function embedContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions[]","embeddings"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>contentEmbeddingFromVertex(o))),setValueByPath(e,["embeddings"],r)}const s=getValueByPath(n,["metadata"]);return s!=null&&setValueByPath(e,["metadata"],s),e}function endpointFromVertex(n){const e={},i=getValueByPath(n,["endpoint"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["deployedModelId"]);return a!=null&&setValueByPath(e,["deployedModelId"],a),e}function fileDataToMldev$1(n){const e={};if(getValueByPath(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const i=getValueByPath(n,["fileUri"]);i!=null&&setValueByPath(e,["fileUri"],i);const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function functionCallToMldev$1(n){const e={},i=getValueByPath(n,["id"]);i!=null&&setValueByPath(e,["id"],i);const a=getValueByPath(n,["args"]);a!=null&&setValueByPath(e,["args"],a);const s=getValueByPath(n,["name"]);if(s!=null&&setValueByPath(e,["name"],s),getValueByPath(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(getValueByPath(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}function functionCallingConfigToMldev(n){const e={},i=getValueByPath(n,["mode"]);i!=null&&setValueByPath(e,["mode"],i);const a=getValueByPath(n,["allowedFunctionNames"]);if(a!=null&&setValueByPath(e,["allowedFunctionNames"],a),getValueByPath(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}function functionDeclarationToVertex(n){const e={};if(getValueByPath(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const i=getValueByPath(n,["description"]);i!=null&&setValueByPath(e,["description"],i);const a=getValueByPath(n,["name"]);a!=null&&setValueByPath(e,["name"],a);const s=getValueByPath(n,["parameters"]);s!=null&&setValueByPath(e,["parameters"],s);const r=getValueByPath(n,["parametersJsonSchema"]);r!=null&&setValueByPath(e,["parametersJsonSchema"],r);const o=getValueByPath(n,["response"]);o!=null&&setValueByPath(e,["response"],o);const l=getValueByPath(n,["responseJsonSchema"]);return l!=null&&setValueByPath(e,["responseJsonSchema"],l),e}function generateContentConfigToMldev(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],contentToMldev$1(tContent(s)));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);if(S!=null&&setValueByPath(a,["responseJsonSchema"],S),getValueByPath(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(getValueByPath(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const g=getValueByPath(e,["safetySettings"]);if(i!==void 0&&g!=null){let F=g;Array.isArray(F)&&(F=F.map(H=>safetySettingToMldev(H))),setValueByPath(i,["safetySettings"],F)}const C=getValueByPath(e,["tools"]);if(i!==void 0&&C!=null){let F=tTools(C);Array.isArray(F)&&(F=F.map(H=>toolToMldev$1(tTool(H)))),setValueByPath(i,["tools"],F)}const E=getValueByPath(e,["toolConfig"]);if(i!==void 0&&E!=null&&setValueByPath(i,["toolConfig"],toolConfigToMldev(E)),getValueByPath(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=getValueByPath(e,["cachedContent"]);i!==void 0&&B!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,B));const _=getValueByPath(e,["responseModalities"]);_!=null&&setValueByPath(a,["responseModalities"],_);const M=getValueByPath(e,["mediaResolution"]);M!=null&&setValueByPath(a,["mediaResolution"],M);const D=getValueByPath(e,["speechConfig"]);if(D!=null&&setValueByPath(a,["speechConfig"],tSpeechConfig(D)),getValueByPath(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const L=getValueByPath(e,["thinkingConfig"]);L!=null&&setValueByPath(a,["thinkingConfig"],L);const N=getValueByPath(e,["imageConfig"]);return N!=null&&setValueByPath(a,["imageConfig"],imageConfigToMldev(N)),a}function generateContentConfigToVertex(n,e,i){const a={},s=getValueByPath(e,["systemInstruction"]);i!==void 0&&s!=null&&setValueByPath(i,["systemInstruction"],tContent(s));const r=getValueByPath(e,["temperature"]);r!=null&&setValueByPath(a,["temperature"],r);const o=getValueByPath(e,["topP"]);o!=null&&setValueByPath(a,["topP"],o);const l=getValueByPath(e,["topK"]);l!=null&&setValueByPath(a,["topK"],l);const u=getValueByPath(e,["candidateCount"]);u!=null&&setValueByPath(a,["candidateCount"],u);const c=getValueByPath(e,["maxOutputTokens"]);c!=null&&setValueByPath(a,["maxOutputTokens"],c);const d=getValueByPath(e,["stopSequences"]);d!=null&&setValueByPath(a,["stopSequences"],d);const p=getValueByPath(e,["responseLogprobs"]);p!=null&&setValueByPath(a,["responseLogprobs"],p);const f=getValueByPath(e,["logprobs"]);f!=null&&setValueByPath(a,["logprobs"],f);const m=getValueByPath(e,["presencePenalty"]);m!=null&&setValueByPath(a,["presencePenalty"],m);const P=getValueByPath(e,["frequencyPenalty"]);P!=null&&setValueByPath(a,["frequencyPenalty"],P);const T=getValueByPath(e,["seed"]);T!=null&&setValueByPath(a,["seed"],T);const x=getValueByPath(e,["responseMimeType"]);x!=null&&setValueByPath(a,["responseMimeType"],x);const y=getValueByPath(e,["responseSchema"]);y!=null&&setValueByPath(a,["responseSchema"],tSchema(y));const S=getValueByPath(e,["responseJsonSchema"]);S!=null&&setValueByPath(a,["responseJsonSchema"],S);const g=getValueByPath(e,["routingConfig"]);g!=null&&setValueByPath(a,["routingConfig"],g);const C=getValueByPath(e,["modelSelectionConfig"]);C!=null&&setValueByPath(a,["modelConfig"],C);const E=getValueByPath(e,["safetySettings"]);if(i!==void 0&&E!=null){let b=E;Array.isArray(b)&&(b=b.map(I=>I)),setValueByPath(i,["safetySettings"],b)}const B=getValueByPath(e,["tools"]);if(i!==void 0&&B!=null){let b=tTools(B);Array.isArray(b)&&(b=b.map(I=>toolToVertex(tTool(I)))),setValueByPath(i,["tools"],b)}const _=getValueByPath(e,["toolConfig"]);i!==void 0&&_!=null&&setValueByPath(i,["toolConfig"],_);const M=getValueByPath(e,["labels"]);i!==void 0&&M!=null&&setValueByPath(i,["labels"],M);const D=getValueByPath(e,["cachedContent"]);i!==void 0&&D!=null&&setValueByPath(i,["cachedContent"],tCachedContentName(n,D));const L=getValueByPath(e,["responseModalities"]);L!=null&&setValueByPath(a,["responseModalities"],L);const N=getValueByPath(e,["mediaResolution"]);N!=null&&setValueByPath(a,["mediaResolution"],N);const F=getValueByPath(e,["speechConfig"]);F!=null&&setValueByPath(a,["speechConfig"],speechConfigToVertex(tSpeechConfig(F)));const H=getValueByPath(e,["audioTimestamp"]);H!=null&&setValueByPath(a,["audioTimestamp"],H);const $=getValueByPath(e,["thinkingConfig"]);$!=null&&setValueByPath(a,["thinkingConfig"],$);const O=getValueByPath(e,["imageConfig"]);return O!=null&&setValueByPath(a,["imageConfig"],imageConfigToVertex(O)),a}function generateContentParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>contentToMldev$1(l))),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToMldev(n,r,i)),i}function generateContentParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["contents"]);if(s!=null){let o=tContents(s);Array.isArray(o)&&(o=o.map(l=>l)),setValueByPath(i,["contents"],o)}const r=getValueByPath(e,["config"]);return r!=null&&setValueByPath(i,["generationConfig"],generateContentConfigToVertex(n,r,i)),i}function generateContentResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(c=>candidateFromMldev(c))),setValueByPath(e,["candidates"],u)}const s=getValueByPath(n,["modelVersion"]);s!=null&&setValueByPath(e,["modelVersion"],s);const r=getValueByPath(n,["promptFeedback"]);r!=null&&setValueByPath(e,["promptFeedback"],r);const o=getValueByPath(n,["responseId"]);o!=null&&setValueByPath(e,["responseId"],o);const l=getValueByPath(n,["usageMetadata"]);return l!=null&&setValueByPath(e,["usageMetadata"],l),e}function generateContentResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["candidates"]);if(a!=null){let c=a;Array.isArray(c)&&(c=c.map(d=>d)),setValueByPath(e,["candidates"],c)}const s=getValueByPath(n,["createTime"]);s!=null&&setValueByPath(e,["createTime"],s);const r=getValueByPath(n,["modelVersion"]);r!=null&&setValueByPath(e,["modelVersion"],r);const o=getValueByPath(n,["promptFeedback"]);o!=null&&setValueByPath(e,["promptFeedback"],o);const l=getValueByPath(n,["responseId"]);l!=null&&setValueByPath(e,["responseId"],l);const u=getValueByPath(n,["usageMetadata"]);return u!=null&&setValueByPath(e,["usageMetadata"],u),e}function generateImagesConfigToMldev(n,e){const i={};if(getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["aspectRatio"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","aspectRatio"],s);const r=getValueByPath(n,["guidanceScale"]);if(e!==void 0&&r!=null&&setValueByPath(e,["parameters","guidanceScale"],r),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const o=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","safetySetting"],o);const l=getValueByPath(n,["personGeneration"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l);const u=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],u);const c=getValueByPath(n,["includeRaiReason"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","includeRaiReason"],c);const d=getValueByPath(n,["language"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","language"],d);const p=getValueByPath(n,["outputMimeType"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],p);const f=getValueByPath(n,["outputCompressionQuality"]);if(e!==void 0&&f!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],f),getValueByPath(n,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const m=getValueByPath(n,["imageSize"]);if(e!==void 0&&m!=null&&setValueByPath(e,["parameters","sampleImageSize"],m),getValueByPath(n,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return i}function generateImagesConfigToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["negativePrompt"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","negativePrompt"],s);const r=getValueByPath(n,["numberOfImages"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","sampleCount"],r);const o=getValueByPath(n,["aspectRatio"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","aspectRatio"],o);const l=getValueByPath(n,["guidanceScale"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","guidanceScale"],l);const u=getValueByPath(n,["seed"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","seed"],u);const c=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","safetySetting"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["includeSafetyAttributes"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","includeSafetyAttributes"],p);const f=getValueByPath(n,["includeRaiReason"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","includeRaiReason"],f);const m=getValueByPath(n,["language"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","language"],m);const P=getValueByPath(n,["outputMimeType"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],P);const T=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&T!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],T);const x=getValueByPath(n,["addWatermark"]);e!==void 0&&x!=null&&setValueByPath(e,["parameters","addWatermark"],x);const y=getValueByPath(n,["labels"]);e!==void 0&&y!=null&&setValueByPath(e,["labels"],y);const S=getValueByPath(n,["imageSize"]);e!==void 0&&S!=null&&setValueByPath(e,["parameters","sampleImageSize"],S);const g=getValueByPath(n,["enhancePrompt"]);return e!==void 0&&g!=null&&setValueByPath(e,["parameters","enhancePrompt"],g),i}function generateImagesParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["config"]);return r!=null&&generateImagesConfigToMldev(r,i),i}function generateImagesParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["config"]);return r!=null&&generateImagesConfigToVertex(r,i),i}function generateImagesResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>generatedImageFromMldev(o))),setValueByPath(e,["generatedImages"],r)}const s=getValueByPath(n,["positivePromptSafetyAttributes"]);return s!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromMldev(s)),e}function generateImagesResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(o=>generatedImageFromVertex(o))),setValueByPath(e,["generatedImages"],r)}const s=getValueByPath(n,["positivePromptSafetyAttributes"]);return s!=null&&setValueByPath(e,["positivePromptSafetyAttributes"],safetyAttributesFromVertex(s)),e}function generateVideosConfigToMldev(n,e){const i={},a=getValueByPath(n,["numberOfVideos"]);if(e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a),getValueByPath(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const s=getValueByPath(n,["durationSeconds"]);if(e!==void 0&&s!=null&&setValueByPath(e,["parameters","durationSeconds"],s),getValueByPath(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const r=getValueByPath(n,["aspectRatio"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","aspectRatio"],r);const o=getValueByPath(n,["resolution"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","resolution"],o);const l=getValueByPath(n,["personGeneration"]);if(e!==void 0&&l!=null&&setValueByPath(e,["parameters","personGeneration"],l),getValueByPath(n,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const u=getValueByPath(n,["negativePrompt"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","negativePrompt"],u);const c=getValueByPath(n,["enhancePrompt"]);if(e!==void 0&&c!=null&&setValueByPath(e,["parameters","enhancePrompt"],c),getValueByPath(n,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const d=getValueByPath(n,["lastFrame"]);e!==void 0&&d!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToMldev(d));const p=getValueByPath(n,["referenceImages"]);if(e!==void 0&&p!=null){let f=p;Array.isArray(f)&&(f=f.map(m=>videoGenerationReferenceImageToMldev(m))),setValueByPath(e,["instances[0]","referenceImages"],f)}if(getValueByPath(n,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(getValueByPath(n,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return i}function generateVideosConfigToVertex(n,e){const i={},a=getValueByPath(n,["numberOfVideos"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["outputGcsUri"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","storageUri"],s);const r=getValueByPath(n,["fps"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","fps"],r);const o=getValueByPath(n,["durationSeconds"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","durationSeconds"],o);const l=getValueByPath(n,["seed"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","seed"],l);const u=getValueByPath(n,["aspectRatio"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","aspectRatio"],u);const c=getValueByPath(n,["resolution"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","resolution"],c);const d=getValueByPath(n,["personGeneration"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","personGeneration"],d);const p=getValueByPath(n,["pubsubTopic"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","pubsubTopic"],p);const f=getValueByPath(n,["negativePrompt"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","negativePrompt"],f);const m=getValueByPath(n,["enhancePrompt"]);e!==void 0&&m!=null&&setValueByPath(e,["parameters","enhancePrompt"],m);const P=getValueByPath(n,["generateAudio"]);e!==void 0&&P!=null&&setValueByPath(e,["parameters","generateAudio"],P);const T=getValueByPath(n,["lastFrame"]);e!==void 0&&T!=null&&setValueByPath(e,["instances[0]","lastFrame"],imageToVertex(T));const x=getValueByPath(n,["referenceImages"]);if(e!==void 0&&x!=null){let g=x;Array.isArray(g)&&(g=g.map(C=>videoGenerationReferenceImageToVertex(C))),setValueByPath(e,["instances[0]","referenceImages"],g)}const y=getValueByPath(n,["mask"]);e!==void 0&&y!=null&&setValueByPath(e,["instances[0]","mask"],videoGenerationMaskToVertex(y));const S=getValueByPath(n,["compressionQuality"]);return e!==void 0&&S!=null&&setValueByPath(e,["parameters","compressionQuality"],S),i}function generateVideosOperationFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata"]);a!=null&&setValueByPath(e,["metadata"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["response","generateVideoResponse"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromMldev(o)),e}function generateVideosOperationFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["metadata"]);a!=null&&setValueByPath(e,["metadata"],a);const s=getValueByPath(n,["done"]);s!=null&&setValueByPath(e,["done"],s);const r=getValueByPath(n,["error"]);r!=null&&setValueByPath(e,["error"],r);const o=getValueByPath(n,["response"]);return o!=null&&setValueByPath(e,["response"],generateVideosResponseFromVertex(o)),e}function generateVideosParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["image"]);r!=null&&setValueByPath(i,["instances[0]","image"],imageToMldev(r));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToMldev(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToMldev(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToMldev(u,i),i}function generateVideosParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["prompt"]);s!=null&&setValueByPath(i,["instances[0]","prompt"],s);const r=getValueByPath(e,["image"]);r!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(r));const o=getValueByPath(e,["video"]);o!=null&&setValueByPath(i,["instances[0]","video"],videoToVertex(o));const l=getValueByPath(e,["source"]);l!=null&&generateVideosSourceToVertex(l,i);const u=getValueByPath(e,["config"]);return u!=null&&generateVideosConfigToVertex(u,i),i}function generateVideosResponseFromMldev(n){const e={},i=getValueByPath(n,["generatedSamples"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(o=>generatedVideoFromMldev(o))),setValueByPath(e,["generatedVideos"],r)}const a=getValueByPath(n,["raiMediaFilteredCount"]);a!=null&&setValueByPath(e,["raiMediaFilteredCount"],a);const s=getValueByPath(n,["raiMediaFilteredReasons"]);return s!=null&&setValueByPath(e,["raiMediaFilteredReasons"],s),e}function generateVideosResponseFromVertex(n){const e={},i=getValueByPath(n,["videos"]);if(i!=null){let r=i;Array.isArray(r)&&(r=r.map(o=>generatedVideoFromVertex(o))),setValueByPath(e,["generatedVideos"],r)}const a=getValueByPath(n,["raiMediaFilteredCount"]);a!=null&&setValueByPath(e,["raiMediaFilteredCount"],a);const s=getValueByPath(n,["raiMediaFilteredReasons"]);return s!=null&&setValueByPath(e,["raiMediaFilteredReasons"],s),e}function generateVideosSourceToMldev(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToMldev(s));const r=getValueByPath(n,["video"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","video"],videoToMldev(r)),i}function generateVideosSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(n,["video"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","video"],videoToVertex(r)),i}function generatedImageFromMldev(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromMldev(i));const a=getValueByPath(n,["raiFilteredReason"]);a!=null&&setValueByPath(e,["raiFilteredReason"],a);const s=getValueByPath(n,["_self"]);return s!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromMldev(s)),e}function generatedImageFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["image"],imageFromVertex(i));const a=getValueByPath(n,["raiFilteredReason"]);a!=null&&setValueByPath(e,["raiFilteredReason"],a);const s=getValueByPath(n,["_self"]);s!=null&&setValueByPath(e,["safetyAttributes"],safetyAttributesFromVertex(s));const r=getValueByPath(n,["prompt"]);return r!=null&&setValueByPath(e,["enhancedPrompt"],r),e}function generatedImageMaskFromVertex(n){const e={},i=getValueByPath(n,["_self"]);i!=null&&setValueByPath(e,["mask"],imageFromVertex(i));const a=getValueByPath(n,["labels"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(e,["labels"],s)}return e}function generatedVideoFromMldev(n){const e={},i=getValueByPath(n,["video"]);return i!=null&&setValueByPath(e,["video"],videoFromMldev(i)),e}function generatedVideoFromVertex(n){const e={},i=getValueByPath(n,["_self"]);return i!=null&&setValueByPath(e,["video"],videoFromVertex(i)),e}function generationConfigToVertex(n){const e={},i=getValueByPath(n,["modelSelectionConfig"]);i!=null&&setValueByPath(e,["modelConfig"],i);const a=getValueByPath(n,["responseJsonSchema"]);a!=null&&setValueByPath(e,["responseJsonSchema"],a);const s=getValueByPath(n,["audioTimestamp"]);s!=null&&setValueByPath(e,["audioTimestamp"],s);const r=getValueByPath(n,["candidateCount"]);r!=null&&setValueByPath(e,["candidateCount"],r);const o=getValueByPath(n,["enableAffectiveDialog"]);o!=null&&setValueByPath(e,["enableAffectiveDialog"],o);const l=getValueByPath(n,["frequencyPenalty"]);l!=null&&setValueByPath(e,["frequencyPenalty"],l);const u=getValueByPath(n,["logprobs"]);u!=null&&setValueByPath(e,["logprobs"],u);const c=getValueByPath(n,["maxOutputTokens"]);c!=null&&setValueByPath(e,["maxOutputTokens"],c);const d=getValueByPath(n,["mediaResolution"]);d!=null&&setValueByPath(e,["mediaResolution"],d);const p=getValueByPath(n,["presencePenalty"]);p!=null&&setValueByPath(e,["presencePenalty"],p);const f=getValueByPath(n,["responseLogprobs"]);f!=null&&setValueByPath(e,["responseLogprobs"],f);const m=getValueByPath(n,["responseMimeType"]);m!=null&&setValueByPath(e,["responseMimeType"],m);const P=getValueByPath(n,["responseModalities"]);P!=null&&setValueByPath(e,["responseModalities"],P);const T=getValueByPath(n,["responseSchema"]);T!=null&&setValueByPath(e,["responseSchema"],T);const x=getValueByPath(n,["routingConfig"]);x!=null&&setValueByPath(e,["routingConfig"],x);const y=getValueByPath(n,["seed"]);y!=null&&setValueByPath(e,["seed"],y);const S=getValueByPath(n,["speechConfig"]);S!=null&&setValueByPath(e,["speechConfig"],speechConfigToVertex(S));const g=getValueByPath(n,["stopSequences"]);g!=null&&setValueByPath(e,["stopSequences"],g);const C=getValueByPath(n,["temperature"]);C!=null&&setValueByPath(e,["temperature"],C);const E=getValueByPath(n,["thinkingConfig"]);E!=null&&setValueByPath(e,["thinkingConfig"],E);const B=getValueByPath(n,["topK"]);B!=null&&setValueByPath(e,["topK"],B);const _=getValueByPath(n,["topP"]);if(_!=null&&setValueByPath(e,["topP"],_),getValueByPath(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}function getModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function getModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);return a!=null&&setValueByPath(i,["_url","name"],tModel(n,a)),i}function googleMapsToMldev$1(n){const e={};if(getValueByPath(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const i=getValueByPath(n,["enableWidget"]);return i!=null&&setValueByPath(e,["enableWidget"],i),e}function googleSearchToMldev$1(n){const e={};if(getValueByPath(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(getValueByPath(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const i=getValueByPath(n,["timeRangeFilter"]);return i!=null&&setValueByPath(e,["timeRangeFilter"],i),e}function imageConfigToMldev(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);if(a!=null&&setValueByPath(e,["imageSize"],a),getValueByPath(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(getValueByPath(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}function imageConfigToVertex(n){const e={},i=getValueByPath(n,["aspectRatio"]);i!=null&&setValueByPath(e,["aspectRatio"],i);const a=getValueByPath(n,["imageSize"]);a!=null&&setValueByPath(e,["imageSize"],a);const s=getValueByPath(n,["outputMimeType"]);s!=null&&setValueByPath(e,["imageOutputOptions","mimeType"],s);const r=getValueByPath(n,["outputCompressionQuality"]);return r!=null&&setValueByPath(e,["imageOutputOptions","compressionQuality"],r),e}function imageFromMldev(n){const e={},i=getValueByPath(n,["bytesBase64Encoded"]);i!=null&&setValueByPath(e,["imageBytes"],tBytes(i));const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function imageFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["bytesBase64Encoded"]);a!=null&&setValueByPath(e,["imageBytes"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function imageToMldev(n){const e={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const i=getValueByPath(n,["imageBytes"]);i!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(i));const a=getValueByPath(n,["mimeType"]);return a!=null&&setValueByPath(e,["mimeType"],a),e}function imageToVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["imageBytes"]);a!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function listModelsConfigToMldev(n,e,i){const a={},s=getValueByPath(e,["pageSize"]);i!==void 0&&s!=null&&setValueByPath(i,["_query","pageSize"],s);const r=getValueByPath(e,["pageToken"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageToken"],r);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),a}function listModelsConfigToVertex(n,e,i){const a={},s=getValueByPath(e,["pageSize"]);i!==void 0&&s!=null&&setValueByPath(i,["_query","pageSize"],s);const r=getValueByPath(e,["pageToken"]);i!==void 0&&r!=null&&setValueByPath(i,["_query","pageToken"],r);const o=getValueByPath(e,["filter"]);i!==void 0&&o!=null&&setValueByPath(i,["_query","filter"],o);const l=getValueByPath(e,["queryBase"]);return i!==void 0&&l!=null&&setValueByPath(i,["_url","models_url"],tModelsUrl(n,l)),a}function listModelsParametersToMldev(n,e){const i={},a=getValueByPath(e,["config"]);return a!=null&&listModelsConfigToMldev(n,a,i),i}function listModelsParametersToVertex(n,e){const i={},a=getValueByPath(e,["config"]);return a!=null&&listModelsConfigToVertex(n,a,i),i}function listModelsResponseFromMldev(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["_self"]);if(s!=null){let r=tExtractModels(s);Array.isArray(r)&&(r=r.map(o=>modelFromMldev(o))),setValueByPath(e,["models"],r)}return e}function listModelsResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["nextPageToken"]);a!=null&&setValueByPath(e,["nextPageToken"],a);const s=getValueByPath(n,["_self"]);if(s!=null){let r=tExtractModels(s);Array.isArray(r)&&(r=r.map(o=>modelFromVertex(o))),setValueByPath(e,["models"],r)}return e}function maskReferenceConfigToVertex(n){const e={},i=getValueByPath(n,["maskMode"]);i!=null&&setValueByPath(e,["maskMode"],i);const a=getValueByPath(n,["segmentationClasses"]);a!=null&&setValueByPath(e,["maskClasses"],a);const s=getValueByPath(n,["maskDilation"]);return s!=null&&setValueByPath(e,["dilation"],s),e}function modelFromMldev(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["version"]);r!=null&&setValueByPath(e,["version"],r);const o=getValueByPath(n,["_self"]);o!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromMldev(o));const l=getValueByPath(n,["inputTokenLimit"]);l!=null&&setValueByPath(e,["inputTokenLimit"],l);const u=getValueByPath(n,["outputTokenLimit"]);u!=null&&setValueByPath(e,["outputTokenLimit"],u);const c=getValueByPath(n,["supportedGenerationMethods"]);c!=null&&setValueByPath(e,["supportedActions"],c);const d=getValueByPath(n,["temperature"]);d!=null&&setValueByPath(e,["temperature"],d);const p=getValueByPath(n,["maxTemperature"]);p!=null&&setValueByPath(e,["maxTemperature"],p);const f=getValueByPath(n,["topP"]);f!=null&&setValueByPath(e,["topP"],f);const m=getValueByPath(n,["topK"]);m!=null&&setValueByPath(e,["topK"],m);const P=getValueByPath(n,["thinking"]);return P!=null&&setValueByPath(e,["thinking"],P),e}function modelFromVertex(n){const e={},i=getValueByPath(n,["name"]);i!=null&&setValueByPath(e,["name"],i);const a=getValueByPath(n,["displayName"]);a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["versionId"]);r!=null&&setValueByPath(e,["version"],r);const o=getValueByPath(n,["deployedModels"]);if(o!=null){let p=o;Array.isArray(p)&&(p=p.map(f=>endpointFromVertex(f))),setValueByPath(e,["endpoints"],p)}const l=getValueByPath(n,["labels"]);l!=null&&setValueByPath(e,["labels"],l);const u=getValueByPath(n,["_self"]);u!=null&&setValueByPath(e,["tunedModelInfo"],tunedModelInfoFromVertex(u));const c=getValueByPath(n,["defaultCheckpointId"]);c!=null&&setValueByPath(e,["defaultCheckpointId"],c);const d=getValueByPath(n,["checkpoints"]);if(d!=null){let p=d;Array.isArray(p)&&(p=p.map(f=>f)),setValueByPath(e,["checkpoints"],p)}return e}function partToMldev$1(n){const e={},i=getValueByPath(n,["mediaResolution"]);i!=null&&setValueByPath(e,["mediaResolution"],i);const a=getValueByPath(n,["codeExecutionResult"]);a!=null&&setValueByPath(e,["codeExecutionResult"],a);const s=getValueByPath(n,["executableCode"]);s!=null&&setValueByPath(e,["executableCode"],s);const r=getValueByPath(n,["fileData"]);r!=null&&setValueByPath(e,["fileData"],fileDataToMldev$1(r));const o=getValueByPath(n,["functionCall"]);o!=null&&setValueByPath(e,["functionCall"],functionCallToMldev$1(o));const l=getValueByPath(n,["functionResponse"]);l!=null&&setValueByPath(e,["functionResponse"],l);const u=getValueByPath(n,["inlineData"]);u!=null&&setValueByPath(e,["inlineData"],blobToMldev$1(u));const c=getValueByPath(n,["text"]);c!=null&&setValueByPath(e,["text"],c);const d=getValueByPath(n,["thought"]);d!=null&&setValueByPath(e,["thought"],d);const p=getValueByPath(n,["thoughtSignature"]);p!=null&&setValueByPath(e,["thoughtSignature"],p);const f=getValueByPath(n,["videoMetadata"]);return f!=null&&setValueByPath(e,["videoMetadata"],f),e}function productImageToVertex(n){const e={},i=getValueByPath(n,["productImage"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function recontextImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["numberOfImages"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","sampleCount"],a);const s=getValueByPath(n,["baseSteps"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","baseSteps"],s);const r=getValueByPath(n,["outputGcsUri"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","storageUri"],r);const o=getValueByPath(n,["seed"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","seed"],o);const l=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","safetySetting"],l);const u=getValueByPath(n,["personGeneration"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","personGeneration"],u);const c=getValueByPath(n,["addWatermark"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","addWatermark"],c);const d=getValueByPath(n,["outputMimeType"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],d);const p=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&p!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],p);const f=getValueByPath(n,["enhancePrompt"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","enhancePrompt"],f);const m=getValueByPath(n,["labels"]);return e!==void 0&&m!=null&&setValueByPath(e,["labels"],m),i}function recontextImageParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["source"]);s!=null&&recontextImageSourceToVertex(s,i);const r=getValueByPath(e,["config"]);return r!=null&&recontextImageConfigToVertex(r,i),i}function recontextImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>generatedImageFromVertex(s))),setValueByPath(e,["generatedImages"],a)}return e}function recontextImageSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["personImage"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","personImage","image"],imageToVertex(s));const r=getValueByPath(n,["productImages"]);if(e!==void 0&&r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>productImageToVertex(l))),setValueByPath(e,["instances[0]","productImages"],o)}return i}function referenceImageAPIInternalToVertex(n){const e={},i=getValueByPath(n,["referenceImage"]);i!=null&&setValueByPath(e,["referenceImage"],imageToVertex(i));const a=getValueByPath(n,["referenceId"]);a!=null&&setValueByPath(e,["referenceId"],a);const s=getValueByPath(n,["referenceType"]);s!=null&&setValueByPath(e,["referenceType"],s);const r=getValueByPath(n,["maskImageConfig"]);r!=null&&setValueByPath(e,["maskImageConfig"],maskReferenceConfigToVertex(r));const o=getValueByPath(n,["controlImageConfig"]);o!=null&&setValueByPath(e,["controlImageConfig"],controlReferenceConfigToVertex(o));const l=getValueByPath(n,["styleImageConfig"]);l!=null&&setValueByPath(e,["styleImageConfig"],l);const u=getValueByPath(n,["subjectImageConfig"]);return u!=null&&setValueByPath(e,["subjectImageConfig"],u),e}function safetyAttributesFromMldev(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const a=getValueByPath(n,["safetyAttributes","scores"]);a!=null&&setValueByPath(e,["scores"],a);const s=getValueByPath(n,["contentType"]);return s!=null&&setValueByPath(e,["contentType"],s),e}function safetyAttributesFromVertex(n){const e={},i=getValueByPath(n,["safetyAttributes","categories"]);i!=null&&setValueByPath(e,["categories"],i);const a=getValueByPath(n,["safetyAttributes","scores"]);a!=null&&setValueByPath(e,["scores"],a);const s=getValueByPath(n,["contentType"]);return s!=null&&setValueByPath(e,["contentType"],s),e}function safetySettingToMldev(n){const e={},i=getValueByPath(n,["category"]);if(i!=null&&setValueByPath(e,["category"],i),getValueByPath(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=getValueByPath(n,["threshold"]);return a!=null&&setValueByPath(e,["threshold"],a),e}function scribbleImageToVertex(n){const e={},i=getValueByPath(n,["image"]);return i!=null&&setValueByPath(e,["image"],imageToVertex(i)),e}function segmentImageConfigToVertex(n,e){const i={},a=getValueByPath(n,["mode"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","mode"],a);const s=getValueByPath(n,["maxPredictions"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","maxPredictions"],s);const r=getValueByPath(n,["confidenceThreshold"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","confidenceThreshold"],r);const o=getValueByPath(n,["maskDilation"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","maskDilation"],o);const l=getValueByPath(n,["binaryColorThreshold"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","binaryColorThreshold"],l);const u=getValueByPath(n,["labels"]);return e!==void 0&&u!=null&&setValueByPath(e,["labels"],u),i}function segmentImageParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["source"]);s!=null&&segmentImageSourceToVertex(s,i);const r=getValueByPath(e,["config"]);return r!=null&&segmentImageConfigToVertex(r,i),i}function segmentImageResponseFromVertex(n){const e={},i=getValueByPath(n,["predictions"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(s=>generatedImageMaskFromVertex(s))),setValueByPath(e,["generatedMasks"],a)}return e}function segmentImageSourceToVertex(n,e){const i={},a=getValueByPath(n,["prompt"]);e!==void 0&&a!=null&&setValueByPath(e,["instances[0]","prompt"],a);const s=getValueByPath(n,["image"]);e!==void 0&&s!=null&&setValueByPath(e,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(n,["scribbleImage"]);return e!==void 0&&r!=null&&setValueByPath(e,["instances[0]","scribble"],scribbleImageToVertex(r)),i}function speechConfigToVertex(n){const e={},i=getValueByPath(n,["languageCode"]);i!=null&&setValueByPath(e,["languageCode"],i);const a=getValueByPath(n,["voiceConfig"]);if(a!=null&&setValueByPath(e,["voiceConfig"],a),getValueByPath(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}function toolConfigToMldev(n){const e={},i=getValueByPath(n,["functionCallingConfig"]);i!=null&&setValueByPath(e,["functionCallingConfig"],functionCallingConfigToMldev(i));const a=getValueByPath(n,["retrievalConfig"]);return a!=null&&setValueByPath(e,["retrievalConfig"],a),e}function toolToMldev$1(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let d=i;Array.isArray(d)&&(d=d.map(p=>p)),setValueByPath(e,["functionDeclarations"],d)}if(getValueByPath(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=getValueByPath(n,["googleSearchRetrieval"]);a!=null&&setValueByPath(e,["googleSearchRetrieval"],a);const s=getValueByPath(n,["computerUse"]);s!=null&&setValueByPath(e,["computerUse"],s);const r=getValueByPath(n,["fileSearch"]);r!=null&&setValueByPath(e,["fileSearch"],r);const o=getValueByPath(n,["codeExecution"]);if(o!=null&&setValueByPath(e,["codeExecution"],o),getValueByPath(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const l=getValueByPath(n,["googleMaps"]);l!=null&&setValueByPath(e,["googleMaps"],googleMapsToMldev$1(l));const u=getValueByPath(n,["googleSearch"]);u!=null&&setValueByPath(e,["googleSearch"],googleSearchToMldev$1(u));const c=getValueByPath(n,["urlContext"]);return c!=null&&setValueByPath(e,["urlContext"],c),e}function toolToVertex(n){const e={},i=getValueByPath(n,["functionDeclarations"]);if(i!=null){let p=i;Array.isArray(p)&&(p=p.map(f=>functionDeclarationToVertex(f))),setValueByPath(e,["functionDeclarations"],p)}const a=getValueByPath(n,["retrieval"]);a!=null&&setValueByPath(e,["retrieval"],a);const s=getValueByPath(n,["googleSearchRetrieval"]);s!=null&&setValueByPath(e,["googleSearchRetrieval"],s);const r=getValueByPath(n,["computerUse"]);if(r!=null&&setValueByPath(e,["computerUse"],r),getValueByPath(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const o=getValueByPath(n,["codeExecution"]);o!=null&&setValueByPath(e,["codeExecution"],o);const l=getValueByPath(n,["enterpriseWebSearch"]);l!=null&&setValueByPath(e,["enterpriseWebSearch"],l);const u=getValueByPath(n,["googleMaps"]);u!=null&&setValueByPath(e,["googleMaps"],u);const c=getValueByPath(n,["googleSearch"]);c!=null&&setValueByPath(e,["googleSearch"],c);const d=getValueByPath(n,["urlContext"]);return d!=null&&setValueByPath(e,["urlContext"],d),e}function tunedModelInfoFromMldev(n){const e={},i=getValueByPath(n,["baseModel"]);i!=null&&setValueByPath(e,["baseModel"],i);const a=getValueByPath(n,["createTime"]);a!=null&&setValueByPath(e,["createTime"],a);const s=getValueByPath(n,["updateTime"]);return s!=null&&setValueByPath(e,["updateTime"],s),e}function tunedModelInfoFromVertex(n){const e={},i=getValueByPath(n,["labels","google-vertex-llm-tuning-base-model-id"]);i!=null&&setValueByPath(e,["baseModel"],i);const a=getValueByPath(n,["createTime"]);a!=null&&setValueByPath(e,["createTime"],a);const s=getValueByPath(n,["updateTime"]);return s!=null&&setValueByPath(e,["updateTime"],s),e}function updateModelConfigToMldev(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);e!==void 0&&s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&r!=null&&setValueByPath(e,["defaultCheckpointId"],r),i}function updateModelConfigToVertex(n,e){const i={},a=getValueByPath(n,["displayName"]);e!==void 0&&a!=null&&setValueByPath(e,["displayName"],a);const s=getValueByPath(n,["description"]);e!==void 0&&s!=null&&setValueByPath(e,["description"],s);const r=getValueByPath(n,["defaultCheckpointId"]);return e!==void 0&&r!=null&&setValueByPath(e,["defaultCheckpointId"],r),i}function updateModelParametersToMldev(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","name"],tModel(n,a));const s=getValueByPath(e,["config"]);return s!=null&&updateModelConfigToMldev(s,i),i}function updateModelParametersToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["config"]);return s!=null&&updateModelConfigToVertex(s,i),i}function upscaleImageAPIConfigInternalToVertex(n,e){const i={},a=getValueByPath(n,["outputGcsUri"]);e!==void 0&&a!=null&&setValueByPath(e,["parameters","storageUri"],a);const s=getValueByPath(n,["safetyFilterLevel"]);e!==void 0&&s!=null&&setValueByPath(e,["parameters","safetySetting"],s);const r=getValueByPath(n,["personGeneration"]);e!==void 0&&r!=null&&setValueByPath(e,["parameters","personGeneration"],r);const o=getValueByPath(n,["includeRaiReason"]);e!==void 0&&o!=null&&setValueByPath(e,["parameters","includeRaiReason"],o);const l=getValueByPath(n,["outputMimeType"]);e!==void 0&&l!=null&&setValueByPath(e,["parameters","outputOptions","mimeType"],l);const u=getValueByPath(n,["outputCompressionQuality"]);e!==void 0&&u!=null&&setValueByPath(e,["parameters","outputOptions","compressionQuality"],u);const c=getValueByPath(n,["enhanceInputImage"]);e!==void 0&&c!=null&&setValueByPath(e,["parameters","upscaleConfig","enhanceInputImage"],c);const d=getValueByPath(n,["imagePreservationFactor"]);e!==void 0&&d!=null&&setValueByPath(e,["parameters","upscaleConfig","imagePreservationFactor"],d);const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const f=getValueByPath(n,["numberOfImages"]);e!==void 0&&f!=null&&setValueByPath(e,["parameters","sampleCount"],f);const m=getValueByPath(n,["mode"]);return e!==void 0&&m!=null&&setValueByPath(e,["parameters","mode"],m),i}function upscaleImageAPIParametersInternalToVertex(n,e){const i={},a=getValueByPath(e,["model"]);a!=null&&setValueByPath(i,["_url","model"],tModel(n,a));const s=getValueByPath(e,["image"]);s!=null&&setValueByPath(i,["instances[0]","image"],imageToVertex(s));const r=getValueByPath(e,["upscaleFactor"]);r!=null&&setValueByPath(i,["parameters","upscaleConfig","upscaleFactor"],r);const o=getValueByPath(e,["config"]);return o!=null&&upscaleImageAPIConfigInternalToVertex(o,i),i}function upscaleImageResponseFromVertex(n){const e={},i=getValueByPath(n,["sdkHttpResponse"]);i!=null&&setValueByPath(e,["sdkHttpResponse"],i);const a=getValueByPath(n,["predictions"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>generatedImageFromVertex(r))),setValueByPath(e,["generatedImages"],s)}return e}function videoFromMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["encodedVideo"]);a!=null&&setValueByPath(e,["videoBytes"],tBytes(a));const s=getValueByPath(n,["encoding"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function videoFromVertex(n){const e={},i=getValueByPath(n,["gcsUri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["bytesBase64Encoded"]);a!=null&&setValueByPath(e,["videoBytes"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}function videoGenerationMaskToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["_self"],imageToVertex(i));const a=getValueByPath(n,["maskMode"]);return a!=null&&setValueByPath(e,["maskMode"],a),e}function videoGenerationReferenceImageToMldev(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToMldev(i));const a=getValueByPath(n,["referenceType"]);return a!=null&&setValueByPath(e,["referenceType"],a),e}function videoGenerationReferenceImageToVertex(n){const e={},i=getValueByPath(n,["image"]);i!=null&&setValueByPath(e,["image"],imageToVertex(i));const a=getValueByPath(n,["referenceType"]);return a!=null&&setValueByPath(e,["referenceType"],a),e}function videoToMldev(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["uri"],i);const a=getValueByPath(n,["videoBytes"]);a!=null&&setValueByPath(e,["encodedVideo"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["encoding"],s),e}function videoToVertex(n){const e={},i=getValueByPath(n,["uri"]);i!=null&&setValueByPath(e,["gcsUri"],i);const a=getValueByPath(n,["videoBytes"]);a!=null&&setValueByPath(e,["bytesBase64Encoded"],tBytes(a));const s=getValueByPath(n,["mimeType"]);return s!=null&&setValueByPath(e,["mimeType"],s),e}/**
|
|
228
228
|
* @license
|
|
229
229
|
* Copyright 2025 Google LLC
|
|
230
230
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -244,7 +244,7 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
244
244
|
* @license
|
|
245
245
|
* Copyright 2025 Google LLC
|
|
246
246
|
* SPDX-License-Identifier: Apache-2.0
|
|
247
|
-
*/const FUNCTION_RESPONSE_REQUIRES_ID="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function handleWebSocketMessage(n,e,i){const a=new LiveServerMessage;let s;i.data instanceof Blob?s=await i.data.text():i.data instanceof ArrayBuffer?s=new TextDecoder().decode(i.data):s=i.data;const r=JSON.parse(s);if(n.isVertexAI()){const o=liveServerMessageFromVertex(r);Object.assign(a,o)}else Object.assign(a,r);e(a)}class Live{constructor(e,i,a){this.apiClient=e,this.auth=i,this.webSocketFactory=a,this.music=new LiveMusic(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var i,a,s,r,o,l;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const u=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let d;const p=this.apiClient.getHeaders();e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)&&setMcpUsageHeader(p);const f=mapToHeaders(p);if(this.apiClient.isVertexAI())d=`${u}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(f,d);else{const D=this.apiClient.getApiKey();let L="BidiGenerateContent",
|
|
247
|
+
*/const FUNCTION_RESPONSE_REQUIRES_ID="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function handleWebSocketMessage(n,e,i){const a=new LiveServerMessage;let s;i.data instanceof Blob?s=await i.data.text():i.data instanceof ArrayBuffer?s=new TextDecoder().decode(i.data):s=i.data;const r=JSON.parse(s);if(n.isVertexAI()){const o=liveServerMessageFromVertex(r);Object.assign(a,o)}else Object.assign(a,r);e(a)}class Live{constructor(e,i,a){this.apiClient=e,this.auth=i,this.webSocketFactory=a,this.music=new LiveMusic(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var i,a,s,r,o,l;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const u=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let d;const p=this.apiClient.getHeaders();e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)&&setMcpUsageHeader(p);const f=mapToHeaders(p);if(this.apiClient.isVertexAI())d=`${u}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(f,d);else{const D=this.apiClient.getApiKey();let L="BidiGenerateContent",N="key";D!=null&&D.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),c!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),L="BidiGenerateContentConstrained",N="access_token"),d=`${u}/ws/google.ai.generativelanguage.${c}.GenerativeService.${L}?${N}=${D}`}let m=()=>{};const P=new Promise(D=>{m=D}),T=e.callbacks,x=function(){var D;(D=T==null?void 0:T.onopen)===null||D===void 0||D.call(T),m({})},y=this.apiClient,S={onopen:x,onmessage:D=>{handleWebSocketMessage(y,T.onmessage,D)},onerror:(i=T==null?void 0:T.onerror)!==null&&i!==void 0?i:function(D){},onclose:(a=T==null?void 0:T.onclose)!==null&&a!==void 0?a:function(D){}},g=this.webSocketFactory.create(d,headersToMap(f),S);g.connect(),await P;let C=tModel(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&C.startsWith("publishers/")){const D=this.apiClient.getProject(),L=this.apiClient.getLocation();C=`projects/${D}/locations/${L}/`+C}let E={};this.apiClient.isVertexAI()&&((s=e.config)===null||s===void 0?void 0:s.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Modality.AUDIO]}:e.config.responseModalities=[Modality.AUDIO]),!((r=e.config)===null||r===void 0)&&r.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");const B=(l=(o=e.config)===null||o===void 0?void 0:o.tools)!==null&&l!==void 0?l:[],_=[];for(const D of B)if(this.isCallableTool(D)){const L=D;_.push(await L.tool())}else _.push(D);_.length>0&&(e.config.tools=_);const M={model:C,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?E=liveConnectParametersToVertex(this.apiClient,M):E=liveConnectParametersToMldev(this.apiClient,M),delete E.config,g.send(JSON.stringify(E)),new Session(g,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const defaultLiveSendClientContentParamerters={turnComplete:!0};class Session{constructor(e,i){this.conn=e,this.apiClient=i}tLiveClientContent(e,i){if(i.turns!==null&&i.turns!==void 0){let a=[];try{a=tContents(i.turns),e.isVertexAI()||(a=a.map(s=>contentToMldev$1(s)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof i.turns}'`)}return{clientContent:{turns:a,turnComplete:i.turnComplete}}}return{clientContent:{turnComplete:i.turnComplete}}}tLiveClienttToolResponse(e,i){let a=[];if(i.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(i.functionResponses)?a=i.functionResponses:a=[i.functionResponses],a.length===0)throw new Error("functionResponses is required.");for(const r of a){if(typeof r!="object"||r===null||!("name"in r)||!("response"in r))throw new Error(`Could not parse function response, type '${typeof r}'.`);if(!e.isVertexAI()&&!("id"in r))throw new Error(FUNCTION_RESPONSE_REQUIRES_ID)}return{toolResponse:{functionResponses:a}}}sendClientContent(e){e=Object.assign(Object.assign({},defaultLiveSendClientContentParamerters),e);const i=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(i))}sendRealtimeInput(e){let i={};this.apiClient.isVertexAI()?i={realtimeInput:liveSendRealtimeInputParametersToVertex(e)}:i={realtimeInput:liveSendRealtimeInputParametersToMldev(e)},this.conn.send(JSON.stringify(i))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");const i=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(i))}close(){this.conn.close()}}function headersToMap(n){const e={};return n.forEach((i,a)=>{e[a]=i}),e}function mapToHeaders(n){const e=new Headers;for(const[i,a]of Object.entries(n))e.append(i,a);return e}/**
|
|
248
248
|
* @license
|
|
249
249
|
* Copyright 2025 Google LLC
|
|
250
250
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -252,7 +252,7 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
252
252
|
* @license
|
|
253
253
|
* Copyright 2025 Google LLC
|
|
254
254
|
* SPDX-License-Identifier: Apache-2.0
|
|
255
|
-
*/class Models extends BaseModule{constructor(e){super(),this.apiClient=e,this.generateContent=async i=>{var a,s,r,o,l;const u=await this.processParamsMaybeAddMcpUsage(i);if(this.maybeMoveToResponseJsonSchem(i),!hasCallableTools(i)||shouldDisableAfc(i.config))return await this.generateContentInternal(u);const c=findAfcIncompatibleToolIndexes(i);if(c.length>0){const T=c.map(x=>`tools[${x}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${T}.`)}let d,p;const f=tContents(u.contents),m=(r=(s=(a=u.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||s===void 0?void 0:s.maximumRemoteCalls)!==null&&r!==void 0?r:DEFAULT_MAX_REMOTE_CALLS;let P=0;for(;P<m&&(d=await this.generateContentInternal(u),!(!d.functionCalls||d.functionCalls.length===0));){const T=d.candidates[0].content,x=[];for(const y of(l=(o=i.config)===null||o===void 0?void 0:o.tools)!==null&&l!==void 0?l:[])if(isCallableTool(y)){const g=await y.callTool(d.functionCalls);x.push(...g)}P++,p={role:"user",parts:x},u.contents=tContents(u.contents),u.contents.push(T),u.contents.push(p),shouldAppendAfcHistory(u.config)&&(f.push(T),f.push(p))}return shouldAppendAfcHistory(u.config)&&(d.automaticFunctionCallingHistory=f),d},this.generateContentStream=async i=>{var a,s,r,o,l;if(this.maybeMoveToResponseJsonSchem(i),shouldDisableAfc(i.config)){const p=await this.processParamsMaybeAddMcpUsage(i);return await this.generateContentStreamInternal(p)}const u=findAfcIncompatibleToolIndexes(i);if(u.length>0){const p=u.map(f=>`tools[${f}]`).join(", ");throw new Error(`Incompatible tools found at ${p}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const c=(r=(s=(a=i==null?void 0:i.config)===null||a===void 0?void 0:a.toolConfig)===null||s===void 0?void 0:s.functionCallingConfig)===null||r===void 0?void 0:r.streamFunctionCallArguments,d=(l=(o=i==null?void 0:i.config)===null||o===void 0?void 0:o.automaticFunctionCalling)===null||l===void 0?void 0:l.disable;if(c&&!d)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(i)},this.generateImages=async i=>await this.generateImagesInternal(i).then(a=>{var s;let r;const o=[];if(a!=null&&a.generatedImages)for(const u of a.generatedImages)u&&(u!=null&&u.safetyAttributes)&&((s=u==null?void 0:u.safetyAttributes)===null||s===void 0?void 0:s.contentType)==="Positive Prompt"?r=u==null?void 0:u.safetyAttributes:o.push(u);let l;return r?l={generatedImages:o,positivePromptSafetyAttributes:r,sdkHttpResponse:a.sdkHttpResponse}:l={generatedImages:o,sdkHttpResponse:a.sdkHttpResponse},l}),this.list=async i=>{var a;const o={config:Object.assign(Object.assign({},{queryBase:!0}),i==null?void 0:i.config)};if(this.apiClient.isVertexAI()&&!o.config.queryBase){if(!((a=o.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");o.config.filter="labels.tune-type:*"}return new Pager(PagedItem.PAGED_ITEM_MODELS,l=>this.listInternal(l),await this.listInternal(o),o)},this.editImage=async i=>{const a={model:i.model,prompt:i.prompt,referenceImages:[],config:i.config};return i.referenceImages&&i.referenceImages&&(a.referenceImages=i.referenceImages.map(s=>s.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async i=>{let a={numberOfImages:1,mode:"upscale"};i.config&&(a=Object.assign(Object.assign({},a),i.config));const s={model:i.model,image:i.image,upscaleFactor:i.upscaleFactor,config:a};return await this.upscaleImageInternal(s)},this.generateVideos=async i=>{var a,s,r,o,l,u;if((i.prompt||i.image||i.video)&&i.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=i.video)===null||a===void 0)&&a.uri&&(!((s=i.video)===null||s===void 0)&&s.videoBytes)?i.video={uri:i.video.uri,mimeType:i.video.mimeType}:!((o=(r=i.source)===null||r===void 0?void 0:r.video)===null||o===void 0)&&o.uri&&(!((u=(l=i.source)===null||l===void 0?void 0:l.video)===null||u===void 0)&&u.videoBytes)&&(i.source.video={uri:i.source.video.uri,mimeType:i.source.video.mimeType})),await this.generateVideosInternal(i)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes("$schema")&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){var i,a,s;const r=(i=e.config)===null||i===void 0?void 0:i.tools;if(!r)return e;const o=await Promise.all(r.map(async u=>isCallableTool(u)?await u.tool():u)),l={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:o})};if(l.config.tools=o,e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)){const u=(s=(a=e.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&s!==void 0?s:{};let c=Object.assign({},u);Object.keys(c).length===0&&(c=this.apiClient.getDefaultHeaders()),setMcpUsageHeader(c),l.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return l}async initAfcToolsMap(e){var i,a,s;const r=new Map;for(const o of(a=(i=e.config)===null||i===void 0?void 0:i.tools)!==null&&a!==void 0?a:[])if(isCallableTool(o)){const l=o,u=await l.tool();for(const c of(s=u.functionDeclarations)!==null&&s!==void 0?s:[]){if(!c.name)throw new Error("Function declaration name is required.");if(r.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);r.set(c.name,l)}}return r}async processAfcStream(e){var i,a,s;const r=(s=(a=(i=e.config)===null||i===void 0?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&s!==void 0?s:DEFAULT_MAX_REMOTE_CALLS;let o=!1,l=0;const u=await this.initAfcToolsMap(e);return function(c,d,p){var f,m;return __asyncGenerator(this,arguments,function*(){for(var P,T,x,y;l<r;){o&&(l++,o=!1);const E=yield __await(c.processParamsMaybeAddMcpUsage(p)),B=yield __await(c.generateContentStreamInternal(E)),_=[],M=[];try{for(var S=!0,g=(T=void 0,__asyncValues(B)),C;C=yield __await(g.next()),P=C.done,!P;S=!0){y=C.value,S=!1;const D=y;if(yield yield __await(D),D.candidates&&(!((f=D.candidates[0])===null||f===void 0)&&f.content)){M.push(D.candidates[0].content);for(const L of(m=D.candidates[0].content.parts)!==null&&m!==void 0?m:[])if(l<r&&L.functionCall){if(!L.functionCall.name)throw new Error("Function call name was not returned by the model.");if(d.has(L.functionCall.name)){const F=yield __await(d.get(L.functionCall.name).callTool([L.functionCall]));_.push(...F)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${d.keys()}, mising tool: ${L.functionCall.name}`)}}}}catch(D){T={error:D}}finally{try{!S&&!P&&(x=g.return)&&(yield __await(x.call(g)))}finally{if(T)throw T.error}}if(_.length>0){o=!0;const D=new GenerateContentResponse;D.candidates=[{content:{role:"user",parts:_}}],yield yield __await(D);const L=[];L.push(...M),L.push({role:"user",parts:_});const F=tContents(p.contents).concat(L);p.contents=F}else break}})}(this,u,e)}async generateContentInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateContentResponseFromVertex(d),f=new GenerateContentResponse;return Object.assign(f,p),f})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateContentResponseFromMldev(d),f=new GenerateContentResponse;return Object.assign(f,p),f})}}async generateContentStreamInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var f,m,P,T;try{for(var x=!0,y=__asyncValues(p),S;S=yield __await(y.next()),f=S.done,!f;x=!0){T=S.value,x=!1;const g=T,C=generateContentResponseFromVertex(yield __await(g.json()));C.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,C),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!f&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var f,m,P,T;try{for(var x=!0,y=__asyncValues(p),S;S=yield __await(y.next()),f=S.done,!f;x=!0){T=S.value,x=!1;const g=T,C=generateContentResponseFromMldev(yield __await(g.json()));C.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,C),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!f&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}}async embedContent(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=embedContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=embedContentResponseFromVertex(d),f=new EmbedContentResponse;return Object.assign(f,p),f})}else{const c=embedContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:batchEmbedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=embedContentResponseFromMldev(d),f=new EmbedContentResponse;return Object.assign(f,p),f})}}async generateImagesInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateImagesParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateImagesResponseFromVertex(d),f=new GenerateImagesResponse;return Object.assign(f,p),f})}else{const c=generateImagesParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateImagesResponseFromMldev(d),f=new GenerateImagesResponse;return Object.assign(f,p),f})}}async editImageInternal(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=editImageParametersInternalToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=editImageResponseFromVertex(u),d=new EditImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=upscaleImageAPIParametersInternalToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=upscaleImageResponseFromVertex(u),d=new UpscaleImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=recontextImageParametersToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json()),s.then(u=>{const c=recontextImageResponseFromVertex(u),d=new RecontextImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=segmentImageParametersToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json()),s.then(u=>{const c=segmentImageResponseFromVertex(u),d=new SegmentImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>modelFromVertex(d))}else{const c=getModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>modelFromMldev(d))}}async listInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listModelsParametersToVertex(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=listModelsResponseFromVertex(d),f=new ListModelsResponse;return Object.assign(f,p),f})}else{const c=listModelsParametersToMldev(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=listModelsResponseFromMldev(d),f=new ListModelsResponse;return Object.assign(f,p),f})}}async update(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=updateModelParametersToVertex(this.apiClient,e);return l=formatMap("{model}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>modelFromVertex(d))}else{const c=updateModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>modelFromMldev(d))}}async delete(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=deleteModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=deleteModelResponseFromVertex(d),f=new DeleteModelResponse;return Object.assign(f,p),f})}else{const c=deleteModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=deleteModelResponseFromMldev(d),f=new DeleteModelResponse;return Object.assign(f,p),f})}}async countTokens(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=countTokensParametersToVertex(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=countTokensResponseFromVertex(d),f=new CountTokensResponse;return Object.assign(f,p),f})}else{const c=countTokensParametersToMldev(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=countTokensResponseFromMldev(d),f=new CountTokensResponse;return Object.assign(f,p),f})}}async computeTokens(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=computeTokensParametersToVertex(this.apiClient,e);return r=formatMap("{model}:computeTokens",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=computeTokensResponseFromVertex(u),d=new ComputeTokensResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateVideosParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>{const p=generateVideosOperationFromVertex(d),f=new GenerateVideosOperation;return Object.assign(f,p),f})}else{const c=generateVideosParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const p=generateVideosOperationFromMldev(d),f=new GenerateVideosOperation;return Object.assign(f,p),f})}}}/**
|
|
255
|
+
*/class Models extends BaseModule{constructor(e){super(),this.apiClient=e,this.generateContent=async i=>{var a,s,r,o,l;const u=await this.processParamsMaybeAddMcpUsage(i);if(this.maybeMoveToResponseJsonSchem(i),!hasCallableTools(i)||shouldDisableAfc(i.config))return await this.generateContentInternal(u);const c=findAfcIncompatibleToolIndexes(i);if(c.length>0){const T=c.map(x=>`tools[${x}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${T}.`)}let d,p;const f=tContents(u.contents),m=(r=(s=(a=u.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||s===void 0?void 0:s.maximumRemoteCalls)!==null&&r!==void 0?r:DEFAULT_MAX_REMOTE_CALLS;let P=0;for(;P<m&&(d=await this.generateContentInternal(u),!(!d.functionCalls||d.functionCalls.length===0));){const T=d.candidates[0].content,x=[];for(const y of(l=(o=i.config)===null||o===void 0?void 0:o.tools)!==null&&l!==void 0?l:[])if(isCallableTool(y)){const g=await y.callTool(d.functionCalls);x.push(...g)}P++,p={role:"user",parts:x},u.contents=tContents(u.contents),u.contents.push(T),u.contents.push(p),shouldAppendAfcHistory(u.config)&&(f.push(T),f.push(p))}return shouldAppendAfcHistory(u.config)&&(d.automaticFunctionCallingHistory=f),d},this.generateContentStream=async i=>{var a,s,r,o,l;if(this.maybeMoveToResponseJsonSchem(i),shouldDisableAfc(i.config)){const p=await this.processParamsMaybeAddMcpUsage(i);return await this.generateContentStreamInternal(p)}const u=findAfcIncompatibleToolIndexes(i);if(u.length>0){const p=u.map(f=>`tools[${f}]`).join(", ");throw new Error(`Incompatible tools found at ${p}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const c=(r=(s=(a=i==null?void 0:i.config)===null||a===void 0?void 0:a.toolConfig)===null||s===void 0?void 0:s.functionCallingConfig)===null||r===void 0?void 0:r.streamFunctionCallArguments,d=(l=(o=i==null?void 0:i.config)===null||o===void 0?void 0:o.automaticFunctionCalling)===null||l===void 0?void 0:l.disable;if(c&&!d)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(i)},this.generateImages=async i=>await this.generateImagesInternal(i).then(a=>{var s;let r;const o=[];if(a!=null&&a.generatedImages)for(const u of a.generatedImages)u&&(u!=null&&u.safetyAttributes)&&((s=u==null?void 0:u.safetyAttributes)===null||s===void 0?void 0:s.contentType)==="Positive Prompt"?r=u==null?void 0:u.safetyAttributes:o.push(u);let l;return r?l={generatedImages:o,positivePromptSafetyAttributes:r,sdkHttpResponse:a.sdkHttpResponse}:l={generatedImages:o,sdkHttpResponse:a.sdkHttpResponse},l}),this.list=async i=>{var a;const o={config:Object.assign(Object.assign({},{queryBase:!0}),i==null?void 0:i.config)};if(this.apiClient.isVertexAI()&&!o.config.queryBase){if(!((a=o.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");o.config.filter="labels.tune-type:*"}return new Pager(PagedItem.PAGED_ITEM_MODELS,l=>this.listInternal(l),await this.listInternal(o),o)},this.editImage=async i=>{const a={model:i.model,prompt:i.prompt,referenceImages:[],config:i.config};return i.referenceImages&&i.referenceImages&&(a.referenceImages=i.referenceImages.map(s=>s.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async i=>{let a={numberOfImages:1,mode:"upscale"};i.config&&(a=Object.assign(Object.assign({},a),i.config));const s={model:i.model,image:i.image,upscaleFactor:i.upscaleFactor,config:a};return await this.upscaleImageInternal(s)},this.generateVideos=async i=>{var a,s,r,o,l,u;if((i.prompt||i.image||i.video)&&i.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=i.video)===null||a===void 0)&&a.uri&&(!((s=i.video)===null||s===void 0)&&s.videoBytes)?i.video={uri:i.video.uri,mimeType:i.video.mimeType}:!((o=(r=i.source)===null||r===void 0?void 0:r.video)===null||o===void 0)&&o.uri&&(!((u=(l=i.source)===null||l===void 0?void 0:l.video)===null||u===void 0)&&u.videoBytes)&&(i.source.video={uri:i.source.video.uri,mimeType:i.source.video.mimeType})),await this.generateVideosInternal(i)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes("$schema")&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){var i,a,s;const r=(i=e.config)===null||i===void 0?void 0:i.tools;if(!r)return e;const o=await Promise.all(r.map(async u=>isCallableTool(u)?await u.tool():u)),l={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:o})};if(l.config.tools=o,e.config&&e.config.tools&&hasMcpToolUsage(e.config.tools)){const u=(s=(a=e.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&s!==void 0?s:{};let c=Object.assign({},u);Object.keys(c).length===0&&(c=this.apiClient.getDefaultHeaders()),setMcpUsageHeader(c),l.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return l}async initAfcToolsMap(e){var i,a,s;const r=new Map;for(const o of(a=(i=e.config)===null||i===void 0?void 0:i.tools)!==null&&a!==void 0?a:[])if(isCallableTool(o)){const l=o,u=await l.tool();for(const c of(s=u.functionDeclarations)!==null&&s!==void 0?s:[]){if(!c.name)throw new Error("Function declaration name is required.");if(r.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);r.set(c.name,l)}}return r}async processAfcStream(e){var i,a,s;const r=(s=(a=(i=e.config)===null||i===void 0?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&s!==void 0?s:DEFAULT_MAX_REMOTE_CALLS;let o=!1,l=0;const u=await this.initAfcToolsMap(e);return function(c,d,p){var f,m;return __asyncGenerator(this,arguments,function*(){for(var P,T,x,y;l<r;){o&&(l++,o=!1);const E=yield __await(c.processParamsMaybeAddMcpUsage(p)),B=yield __await(c.generateContentStreamInternal(E)),_=[],M=[];try{for(var S=!0,g=(T=void 0,__asyncValues(B)),C;C=yield __await(g.next()),P=C.done,!P;S=!0){y=C.value,S=!1;const D=y;if(yield yield __await(D),D.candidates&&(!((f=D.candidates[0])===null||f===void 0)&&f.content)){M.push(D.candidates[0].content);for(const L of(m=D.candidates[0].content.parts)!==null&&m!==void 0?m:[])if(l<r&&L.functionCall){if(!L.functionCall.name)throw new Error("Function call name was not returned by the model.");if(d.has(L.functionCall.name)){const N=yield __await(d.get(L.functionCall.name).callTool([L.functionCall]));_.push(...N)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${d.keys()}, mising tool: ${L.functionCall.name}`)}}}}catch(D){T={error:D}}finally{try{!S&&!P&&(x=g.return)&&(yield __await(x.call(g)))}finally{if(T)throw T.error}}if(_.length>0){o=!0;const D=new GenerateContentResponse;D.candidates=[{content:{role:"user",parts:_}}],yield yield __await(D);const L=[];L.push(...M),L.push({role:"user",parts:_});const N=tContents(p.contents).concat(L);p.contents=N}else break}})}(this,u,e)}async generateContentInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateContentResponseFromVertex(d),f=new GenerateContentResponse;return Object.assign(f,p),f})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:generateContent",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateContentResponseFromMldev(d),f=new GenerateContentResponse;return Object.assign(f,p),f})}}async generateContentStreamInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var f,m,P,T;try{for(var x=!0,y=__asyncValues(p),S;S=yield __await(y.next()),f=S.done,!f;x=!0){T=S.value,x=!1;const g=T,C=generateContentResponseFromVertex(yield __await(g.json()));C.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,C),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!f&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}else{const c=generateContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:streamGenerateContent?alt=sse",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.requestStream({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}),o.then(function(p){return __asyncGenerator(this,arguments,function*(){var f,m,P,T;try{for(var x=!0,y=__asyncValues(p),S;S=yield __await(y.next()),f=S.done,!f;x=!0){T=S.value,x=!1;const g=T,C=generateContentResponseFromMldev(yield __await(g.json()));C.sdkHttpResponse={headers:g.headers};const E=new GenerateContentResponse;Object.assign(E,C),yield yield __await(E)}}catch(g){m={error:g}}finally{try{!x&&!f&&(P=y.return)&&(yield __await(P.call(y)))}finally{if(m)throw m.error}}})})}}async embedContent(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=embedContentParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=embedContentResponseFromVertex(d),f=new EmbedContentResponse;return Object.assign(f,p),f})}else{const c=embedContentParametersToMldev(this.apiClient,e);return l=formatMap("{model}:batchEmbedContents",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=embedContentResponseFromMldev(d),f=new EmbedContentResponse;return Object.assign(f,p),f})}}async generateImagesInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateImagesParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateImagesResponseFromVertex(d),f=new GenerateImagesResponse;return Object.assign(f,p),f})}else{const c=generateImagesParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predict",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=generateImagesResponseFromMldev(d),f=new GenerateImagesResponse;return Object.assign(f,p),f})}}async editImageInternal(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=editImageParametersInternalToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=editImageResponseFromVertex(u),d=new EditImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=upscaleImageAPIParametersInternalToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=upscaleImageResponseFromVertex(u),d=new UpscaleImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=recontextImageParametersToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json()),s.then(u=>{const c=recontextImageResponseFromVertex(u),d=new RecontextImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=segmentImageParametersToVertex(this.apiClient,e);return r=formatMap("{model}:predict",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json()),s.then(u=>{const c=segmentImageResponseFromVertex(u),d=new SegmentImageResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=getModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>modelFromVertex(d))}else{const c=getModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>modelFromMldev(d))}}async listInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=listModelsParametersToVertex(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=listModelsResponseFromVertex(d),f=new ListModelsResponse;return Object.assign(f,p),f})}else{const c=listModelsParametersToMldev(this.apiClient,e);return l=formatMap("{models_url}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=listModelsResponseFromMldev(d),f=new ListModelsResponse;return Object.assign(f,p),f})}}async update(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=updateModelParametersToVertex(this.apiClient,e);return l=formatMap("{model}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>modelFromVertex(d))}else{const c=updateModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>modelFromMldev(d))}}async delete(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=deleteModelParametersToVertex(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=deleteModelResponseFromVertex(d),f=new DeleteModelResponse;return Object.assign(f,p),f})}else{const c=deleteModelParametersToMldev(this.apiClient,e);return l=formatMap("{name}",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=deleteModelResponseFromMldev(d),f=new DeleteModelResponse;return Object.assign(f,p),f})}}async countTokens(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=countTokensParametersToVertex(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=countTokensResponseFromVertex(d),f=new CountTokensResponse;return Object.assign(f,p),f})}else{const c=countTokensParametersToMldev(this.apiClient,e);return l=formatMap("{model}:countTokens",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json().then(p=>{const f=p;return f.sdkHttpResponse={headers:d.headers},f})),o.then(d=>{const p=countTokensResponseFromMldev(d),f=new CountTokensResponse;return Object.assign(f,p),f})}}async computeTokens(e){var i,a;let s,r="",o={};if(this.apiClient.isVertexAI()){const l=computeTokensParametersToVertex(this.apiClient,e);return r=formatMap("{model}:computeTokens",l._url),o=l._query,delete l._url,delete l._query,s=this.apiClient.request({path:r,queryParams:o,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(u=>u.json().then(c=>{const d=c;return d.sdkHttpResponse={headers:u.headers},d})),s.then(u=>{const c=computeTokensResponseFromVertex(u),d=new ComputeTokensResponse;return Object.assign(d,c),d})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(e){var i,a,s,r;let o,l="",u={};if(this.apiClient.isVertexAI()){const c=generateVideosParametersToVertex(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(d=>d.json()),o.then(d=>{const p=generateVideosOperationFromVertex(d),f=new GenerateVideosOperation;return Object.assign(f,p),f})}else{const c=generateVideosParametersToMldev(this.apiClient,e);return l=formatMap("{model}:predictLongRunning",c._url),u=c._query,delete c._url,delete c._query,o=this.apiClient.request({path:l,queryParams:u,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(s=e.config)===null||s===void 0?void 0:s.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then(d=>d.json()),o.then(d=>{const p=generateVideosOperationFromMldev(d),f=new GenerateVideosOperation;return Object.assign(f,p),f})}}}/**
|
|
256
256
|
* @license
|
|
257
257
|
* Copyright 2025 Google LLC
|
|
258
258
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -280,7 +280,7 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
280
280
|
* @license
|
|
281
281
|
* Copyright 2025 Google LLC
|
|
282
282
|
* SPDX-License-Identifier: Apache-2.0
|
|
283
|
-
*/function cancelTuningJobParametersToMldev(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function cancelTuningJobParametersToVertex(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function cancelTuningJobResponseFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);return a!=null&&setValueByPath(i,["sdkHttpResponse"],a),i}function cancelTuningJobResponseFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);return a!=null&&setValueByPath(i,["sdkHttpResponse"],a),i}function createTuningJobConfigToMldev(n,e,i){const a={};if(getValueByPath(n,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const s=getValueByPath(n,["tunedModelDisplayName"]);if(e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s),getValueByPath(n,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const r=getValueByPath(n,["epochCount"]);e!==void 0&&r!=null&&setValueByPath(e,["tuningTask","hyperparameters","epochCount"],r);const o=getValueByPath(n,["learningRateMultiplier"]);if(o!=null&&setValueByPath(a,["tuningTask","hyperparameters","learningRateMultiplier"],o),getValueByPath(n,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(getValueByPath(n,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(getValueByPath(n,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const l=getValueByPath(n,["batchSize"]);e!==void 0&&l!=null&&setValueByPath(e,["tuningTask","hyperparameters","batchSize"],l);const u=getValueByPath(n,["learningRate"]);if(e!==void 0&&u!=null&&setValueByPath(e,["tuningTask","hyperparameters","learningRate"],u),getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(getValueByPath(n,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return a}function createTuningJobConfigToVertex(n,e,i){const a={};let s=getValueByPath(i,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec"],tuningValidationDatasetToVertex(m))}else if(s==="PREFERENCE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec"],tuningValidationDatasetToVertex(m))}const r=getValueByPath(n,["tunedModelDisplayName"]);e!==void 0&&r!=null&&setValueByPath(e,["tunedModelDisplayName"],r);const o=getValueByPath(n,["description"]);e!==void 0&&o!=null&&setValueByPath(e,["description"],o);let l=getValueByPath(i,["config","method"]);if(l===void 0&&(l="SUPERVISED_FINE_TUNING"),l==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","epochCount"],m)}else if(l==="PREFERENCE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","epochCount"],m)}let u=getValueByPath(i,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],m)}else if(u==="PREFERENCE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],m)}let c=getValueByPath(i,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","exportLastCheckpointOnly"],m)}else if(c==="PREFERENCE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","exportLastCheckpointOnly"],m)}let d=getValueByPath(i,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","adapterSize"],m)}else if(d==="PREFERENCE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","adapterSize"],m)}if(getValueByPath(n,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(getValueByPath(n,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const f=getValueByPath(n,["beta"]);return e!==void 0&&f!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","beta"],f),a}function createTuningJobParametersPrivateToMldev(n,e){const i={},a=getValueByPath(n,["baseModel"]);a!=null&&setValueByPath(i,["baseModel"],a);const s=getValueByPath(n,["preTunedModel"]);s!=null&&setValueByPath(i,["preTunedModel"],s);const r=getValueByPath(n,["trainingDataset"]);r!=null&&tuningDatasetToMldev(r);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToMldev(o,i),i}function createTuningJobParametersPrivateToVertex(n,e){const i={},a=getValueByPath(n,["baseModel"]);a!=null&&setValueByPath(i,["baseModel"],a);const s=getValueByPath(n,["preTunedModel"]);s!=null&&setValueByPath(i,["preTunedModel"],s);const r=getValueByPath(n,["trainingDataset"]);r!=null&&tuningDatasetToVertex(r,i,e);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToVertex(o,i,e),i}function getTuningJobParametersToMldev(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function getTuningJobParametersToVertex(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function listTuningJobsConfigToMldev(n,e,i){const a={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),a}function listTuningJobsConfigToVertex(n,e,i){const a={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),a}function listTuningJobsParametersToMldev(n,e){const i={},a=getValueByPath(n,["config"]);return a!=null&&listTuningJobsConfigToMldev(a,i),i}function listTuningJobsParametersToVertex(n,e){const i={},a=getValueByPath(n,["config"]);return a!=null&&listTuningJobsConfigToVertex(a,i),i}function listTuningJobsResponseFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(i,["nextPageToken"],s);const r=getValueByPath(n,["tunedModels"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>tuningJobFromMldev(l))),setValueByPath(i,["tuningJobs"],o)}return i}function listTuningJobsResponseFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(i,["nextPageToken"],s);const r=getValueByPath(n,["tuningJobs"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>tuningJobFromVertex(l))),setValueByPath(i,["tuningJobs"],o)}return i}function tunedModelFromMldev(n,e){const i={},a=getValueByPath(n,["name"]);a!=null&&setValueByPath(i,["model"],a);const s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["endpoint"],s),i}function tuningDatasetToMldev(n,e){const i={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=getValueByPath(n,["examples"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(i,["examples","examples"],s)}return i}function tuningDatasetToVertex(n,e,i){const a={};let s=getValueByPath(i,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(s==="PREFERENCE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}let r=getValueByPath(i,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(r==="PREFERENCE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}if(getValueByPath(n,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function tuningJobFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["state"]);r!=null&&setValueByPath(i,["state"],tTuningJobStatus(r));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["tuningTask","startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["tuningTask","completeTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const d=getValueByPath(n,["description"]);d!=null&&setValueByPath(i,["description"],d);const p=getValueByPath(n,["baseModel"]);p!=null&&setValueByPath(i,["baseModel"],p);const f=getValueByPath(n,["_self"]);return f!=null&&setValueByPath(i,["tunedModel"],tunedModelFromMldev(f)),i}function tuningJobFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["state"]);r!=null&&setValueByPath(i,["state"],tTuningJobStatus(r));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const d=getValueByPath(n,["error"]);d!=null&&setValueByPath(i,["error"],d);const p=getValueByPath(n,["description"]);p!=null&&setValueByPath(i,["description"],p);const f=getValueByPath(n,["baseModel"]);f!=null&&setValueByPath(i,["baseModel"],f);const m=getValueByPath(n,["tunedModel"]);m!=null&&setValueByPath(i,["tunedModel"],m);const P=getValueByPath(n,["preTunedModel"]);P!=null&&setValueByPath(i,["preTunedModel"],P);const T=getValueByPath(n,["supervisedTuningSpec"]);T!=null&&setValueByPath(i,["supervisedTuningSpec"],T);const x=getValueByPath(n,["preferenceOptimizationSpec"]);x!=null&&setValueByPath(i,["preferenceOptimizationSpec"],x);const y=getValueByPath(n,["tuningDataStats"]);y!=null&&setValueByPath(i,["tuningDataStats"],y);const S=getValueByPath(n,["encryptionSpec"]);S!=null&&setValueByPath(i,["encryptionSpec"],S);const g=getValueByPath(n,["partnerModelTuningSpec"]);g!=null&&setValueByPath(i,["partnerModelTuningSpec"],g);const C=getValueByPath(n,["customBaseModel"]);C!=null&&setValueByPath(i,["customBaseModel"],C);const E=getValueByPath(n,["experiment"]);E!=null&&setValueByPath(i,["experiment"],E);const B=getValueByPath(n,["labels"]);B!=null&&setValueByPath(i,["labels"],B);const _=getValueByPath(n,["outputUri"]);_!=null&&setValueByPath(i,["outputUri"],_);const M=getValueByPath(n,["pipelineJob"]);M!=null&&setValueByPath(i,["pipelineJob"],M);const D=getValueByPath(n,["serviceAccount"]);D!=null&&setValueByPath(i,["serviceAccount"],D);const L=getValueByPath(n,["tunedModelDisplayName"]);L!=null&&setValueByPath(i,["tunedModelDisplayName"],L);const F=getValueByPath(n,["veoTuningSpec"]);return F!=null&&setValueByPath(i,["veoTuningSpec"],F),i}function tuningOperationFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["metadata"]);r!=null&&setValueByPath(i,["metadata"],r);const o=getValueByPath(n,["done"]);o!=null&&setValueByPath(i,["done"],o);const l=getValueByPath(n,["error"]);return l!=null&&setValueByPath(i,["error"],l),i}function tuningValidationDatasetToVertex(n,e){const i={},a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(i,["validationDatasetUri"],a);const s=getValueByPath(n,["vertexDatasetResource"]);return s!=null&&setValueByPath(i,["validationDatasetUri"],s),i}/**
|
|
283
|
+
*/function cancelTuningJobParametersToMldev(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function cancelTuningJobParametersToVertex(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function cancelTuningJobResponseFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);return a!=null&&setValueByPath(i,["sdkHttpResponse"],a),i}function cancelTuningJobResponseFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);return a!=null&&setValueByPath(i,["sdkHttpResponse"],a),i}function createTuningJobConfigToMldev(n,e,i){const a={};if(getValueByPath(n,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const s=getValueByPath(n,["tunedModelDisplayName"]);if(e!==void 0&&s!=null&&setValueByPath(e,["displayName"],s),getValueByPath(n,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const r=getValueByPath(n,["epochCount"]);e!==void 0&&r!=null&&setValueByPath(e,["tuningTask","hyperparameters","epochCount"],r);const o=getValueByPath(n,["learningRateMultiplier"]);if(o!=null&&setValueByPath(a,["tuningTask","hyperparameters","learningRateMultiplier"],o),getValueByPath(n,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(getValueByPath(n,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(getValueByPath(n,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const l=getValueByPath(n,["batchSize"]);e!==void 0&&l!=null&&setValueByPath(e,["tuningTask","hyperparameters","batchSize"],l);const u=getValueByPath(n,["learningRate"]);if(e!==void 0&&u!=null&&setValueByPath(e,["tuningTask","hyperparameters","learningRate"],u),getValueByPath(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(getValueByPath(n,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return a}function createTuningJobConfigToVertex(n,e,i){const a={};let s=getValueByPath(i,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec"],tuningValidationDatasetToVertex(m))}else if(s==="PREFERENCE_TUNING"){const m=getValueByPath(n,["validationDataset"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec"],tuningValidationDatasetToVertex(m))}const r=getValueByPath(n,["tunedModelDisplayName"]);e!==void 0&&r!=null&&setValueByPath(e,["tunedModelDisplayName"],r);const o=getValueByPath(n,["description"]);e!==void 0&&o!=null&&setValueByPath(e,["description"],o);let l=getValueByPath(i,["config","method"]);if(l===void 0&&(l="SUPERVISED_FINE_TUNING"),l==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","epochCount"],m)}else if(l==="PREFERENCE_TUNING"){const m=getValueByPath(n,["epochCount"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","epochCount"],m)}let u=getValueByPath(i,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],m)}else if(u==="PREFERENCE_TUNING"){const m=getValueByPath(n,["learningRateMultiplier"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],m)}let c=getValueByPath(i,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","exportLastCheckpointOnly"],m)}else if(c==="PREFERENCE_TUNING"){const m=getValueByPath(n,["exportLastCheckpointOnly"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","exportLastCheckpointOnly"],m)}let d=getValueByPath(i,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["supervisedTuningSpec","hyperParameters","adapterSize"],m)}else if(d==="PREFERENCE_TUNING"){const m=getValueByPath(n,["adapterSize"]);e!==void 0&&m!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","adapterSize"],m)}if(getValueByPath(n,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(getValueByPath(n,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");const p=getValueByPath(n,["labels"]);e!==void 0&&p!=null&&setValueByPath(e,["labels"],p);const f=getValueByPath(n,["beta"]);return e!==void 0&&f!=null&&setValueByPath(e,["preferenceOptimizationSpec","hyperParameters","beta"],f),a}function createTuningJobParametersPrivateToMldev(n,e){const i={},a=getValueByPath(n,["baseModel"]);a!=null&&setValueByPath(i,["baseModel"],a);const s=getValueByPath(n,["preTunedModel"]);s!=null&&setValueByPath(i,["preTunedModel"],s);const r=getValueByPath(n,["trainingDataset"]);r!=null&&tuningDatasetToMldev(r);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToMldev(o,i),i}function createTuningJobParametersPrivateToVertex(n,e){const i={},a=getValueByPath(n,["baseModel"]);a!=null&&setValueByPath(i,["baseModel"],a);const s=getValueByPath(n,["preTunedModel"]);s!=null&&setValueByPath(i,["preTunedModel"],s);const r=getValueByPath(n,["trainingDataset"]);r!=null&&tuningDatasetToVertex(r,i,e);const o=getValueByPath(n,["config"]);return o!=null&&createTuningJobConfigToVertex(o,i,e),i}function getTuningJobParametersToMldev(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function getTuningJobParametersToVertex(n,e){const i={},a=getValueByPath(n,["name"]);return a!=null&&setValueByPath(i,["_url","name"],a),i}function listTuningJobsConfigToMldev(n,e,i){const a={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),a}function listTuningJobsConfigToVertex(n,e,i){const a={},s=getValueByPath(n,["pageSize"]);e!==void 0&&s!=null&&setValueByPath(e,["_query","pageSize"],s);const r=getValueByPath(n,["pageToken"]);e!==void 0&&r!=null&&setValueByPath(e,["_query","pageToken"],r);const o=getValueByPath(n,["filter"]);return e!==void 0&&o!=null&&setValueByPath(e,["_query","filter"],o),a}function listTuningJobsParametersToMldev(n,e){const i={},a=getValueByPath(n,["config"]);return a!=null&&listTuningJobsConfigToMldev(a,i),i}function listTuningJobsParametersToVertex(n,e){const i={},a=getValueByPath(n,["config"]);return a!=null&&listTuningJobsConfigToVertex(a,i),i}function listTuningJobsResponseFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(i,["nextPageToken"],s);const r=getValueByPath(n,["tunedModels"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>tuningJobFromMldev(l))),setValueByPath(i,["tuningJobs"],o)}return i}function listTuningJobsResponseFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["nextPageToken"]);s!=null&&setValueByPath(i,["nextPageToken"],s);const r=getValueByPath(n,["tuningJobs"]);if(r!=null){let o=r;Array.isArray(o)&&(o=o.map(l=>tuningJobFromVertex(l))),setValueByPath(i,["tuningJobs"],o)}return i}function tunedModelFromMldev(n,e){const i={},a=getValueByPath(n,["name"]);a!=null&&setValueByPath(i,["model"],a);const s=getValueByPath(n,["name"]);return s!=null&&setValueByPath(i,["endpoint"],s),i}function tuningDatasetToMldev(n,e){const i={};if(getValueByPath(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(getValueByPath(n,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=getValueByPath(n,["examples"]);if(a!=null){let s=a;Array.isArray(s)&&(s=s.map(r=>r)),setValueByPath(i,["examples","examples"],s)}return i}function tuningDatasetToVertex(n,e,i){const a={};let s=getValueByPath(i,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(s==="PREFERENCE_TUNING"){const o=getValueByPath(n,["gcsUri"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}let r=getValueByPath(i,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["supervisedTuningSpec","trainingDatasetUri"],o)}else if(r==="PREFERENCE_TUNING"){const o=getValueByPath(n,["vertexDatasetResource"]);e!==void 0&&o!=null&&setValueByPath(e,["preferenceOptimizationSpec","trainingDatasetUri"],o)}if(getValueByPath(n,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function tuningJobFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["state"]);r!=null&&setValueByPath(i,["state"],tTuningJobStatus(r));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["tuningTask","startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["tuningTask","completeTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const d=getValueByPath(n,["description"]);d!=null&&setValueByPath(i,["description"],d);const p=getValueByPath(n,["baseModel"]);p!=null&&setValueByPath(i,["baseModel"],p);const f=getValueByPath(n,["_self"]);return f!=null&&setValueByPath(i,["tunedModel"],tunedModelFromMldev(f)),i}function tuningJobFromVertex(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["state"]);r!=null&&setValueByPath(i,["state"],tTuningJobStatus(r));const o=getValueByPath(n,["createTime"]);o!=null&&setValueByPath(i,["createTime"],o);const l=getValueByPath(n,["startTime"]);l!=null&&setValueByPath(i,["startTime"],l);const u=getValueByPath(n,["endTime"]);u!=null&&setValueByPath(i,["endTime"],u);const c=getValueByPath(n,["updateTime"]);c!=null&&setValueByPath(i,["updateTime"],c);const d=getValueByPath(n,["error"]);d!=null&&setValueByPath(i,["error"],d);const p=getValueByPath(n,["description"]);p!=null&&setValueByPath(i,["description"],p);const f=getValueByPath(n,["baseModel"]);f!=null&&setValueByPath(i,["baseModel"],f);const m=getValueByPath(n,["tunedModel"]);m!=null&&setValueByPath(i,["tunedModel"],m);const P=getValueByPath(n,["preTunedModel"]);P!=null&&setValueByPath(i,["preTunedModel"],P);const T=getValueByPath(n,["supervisedTuningSpec"]);T!=null&&setValueByPath(i,["supervisedTuningSpec"],T);const x=getValueByPath(n,["preferenceOptimizationSpec"]);x!=null&&setValueByPath(i,["preferenceOptimizationSpec"],x);const y=getValueByPath(n,["tuningDataStats"]);y!=null&&setValueByPath(i,["tuningDataStats"],y);const S=getValueByPath(n,["encryptionSpec"]);S!=null&&setValueByPath(i,["encryptionSpec"],S);const g=getValueByPath(n,["partnerModelTuningSpec"]);g!=null&&setValueByPath(i,["partnerModelTuningSpec"],g);const C=getValueByPath(n,["customBaseModel"]);C!=null&&setValueByPath(i,["customBaseModel"],C);const E=getValueByPath(n,["experiment"]);E!=null&&setValueByPath(i,["experiment"],E);const B=getValueByPath(n,["labels"]);B!=null&&setValueByPath(i,["labels"],B);const _=getValueByPath(n,["outputUri"]);_!=null&&setValueByPath(i,["outputUri"],_);const M=getValueByPath(n,["pipelineJob"]);M!=null&&setValueByPath(i,["pipelineJob"],M);const D=getValueByPath(n,["serviceAccount"]);D!=null&&setValueByPath(i,["serviceAccount"],D);const L=getValueByPath(n,["tunedModelDisplayName"]);L!=null&&setValueByPath(i,["tunedModelDisplayName"],L);const N=getValueByPath(n,["veoTuningSpec"]);return N!=null&&setValueByPath(i,["veoTuningSpec"],N),i}function tuningOperationFromMldev(n,e){const i={},a=getValueByPath(n,["sdkHttpResponse"]);a!=null&&setValueByPath(i,["sdkHttpResponse"],a);const s=getValueByPath(n,["name"]);s!=null&&setValueByPath(i,["name"],s);const r=getValueByPath(n,["metadata"]);r!=null&&setValueByPath(i,["metadata"],r);const o=getValueByPath(n,["done"]);o!=null&&setValueByPath(i,["done"],o);const l=getValueByPath(n,["error"]);return l!=null&&setValueByPath(i,["error"],l),i}function tuningValidationDatasetToVertex(n,e){const i={},a=getValueByPath(n,["gcsUri"]);a!=null&&setValueByPath(i,["validationDatasetUri"],a);const s=getValueByPath(n,["vertexDatasetResource"]);return s!=null&&setValueByPath(i,["validationDatasetUri"],s),i}/**
|
|
284
284
|
* @license
|
|
285
285
|
* Copyright 2025 Google LLC
|
|
286
286
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -301,16 +301,16 @@ a.goToAndStop(T-a.firstFrame-1,!0)}P.type==="loop"&&(d===null||d!==P.frames||a.i
|
|
|
301
301
|
* Copyright 2025 Google LLC
|
|
302
302
|
* SPDX-License-Identifier: Apache-2.0
|
|
303
303
|
*/const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var i;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(i=e.vertexai)!==null&&i!==void 0?i:!1,this.apiKey=e.apiKey;const a=getBaseUrl(e.httpOptions,e.vertexai,void 0,void 0);a&&(e.httpOptions?e.httpOptions.baseUrl=a:e.httpOptions={baseUrl:a}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;const s=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:s,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader,downloader:new BrowserDownloader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,s,new BrowserWebSocketFactory),this.batches=new Batches(this.apiClient),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient),this.authTokens=new Tokens(this.apiClient),this.tunings=new Tunings(this.apiClient),this.fileSearchStores=new FileSearchStores(this.apiClient)}}async function sendToS2(n,e){if(!(n!=null&&n.basin)||!(n!=null&&n.token)||!(n!=null&&n.id))return console.warn("[S2] Cannot send: Missing stream info"),!1;const{basin:i,token:a,id:s}=n,r=`https://${i}.b.aws.s2.dev/v1/streams/${s}/records`,o={origin:"web_client",timestamp:new Date().toISOString(),...e};try{const l=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},body:JSON.stringify({records:[{body:JSON.stringify(o)}]})});return l.ok?(console.log("[S2] ✅ Sent:",e.action),!0):(console.error("[S2] Send failed:",l.status),!1)}catch(l){return console.error("[S2] Send error:",l),!1}}async function notifyUserStream(n,e,i=!1){if(!(n!=null&&n.basin)||!(n!=null&&n.token)||!(n!=null&&n.id))return console.warn("[S2] ⚠️ Cannot notify user stream: Missing info"),!1;const{basin:a,token:s,id:r}=n,o=`https://${a}.b.aws.s2.dev/v1/streams/${r}/records`;console.log("[S2] 📡 Notifying User Stream:",e);try{return await fetch(o,{method:"POST",keepalive:i,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify({records:[{body:JSON.stringify({...e,timestamp:Date.now()})}]})}),!0}catch(l){return console.error("[S2] Failed to notify user stream:",l),!1}}class S2StreamListener{constructor(e,i){ze(this,"streamInfo");ze(this,"callbacks");ze(this,"abortController",null);ze(this,"isRunning",!1);this.streamInfo=e,this.callbacks=i}async start(){var o,l,u,c,d,p,f;if(this.isRunning)return;const{basin:e,token:i,id:a}=this.streamInfo;if(!e||!i||!a){console.error("[S2] Cannot start listener: Missing stream info");return}const r=`${`https://${e}.b.aws.s2.dev/v1/streams/${a}/records`}?clamp=true&tail_offset=0`;console.log("[S2] 🎧 Starting SSE listener:",r),this.abortController=new AbortController,this.isRunning=!0;try{const m=await fetch(r,{headers:{Authorization:`Bearer ${i}`,Accept:"text/event-stream"},signal:this.abortController.signal});if(!m.ok){console.error("[S2] SSE connection failed:",m.status),(l=(o=this.callbacks).onError)==null||l.call(o,new Error(`SSE connection failed: ${m.status}`));return}const P=(u=m.body)==null?void 0:u.getReader();if(!P){console.error("[S2] No response body reader");return}const T=new TextDecoder;let x="",y=null,S="";for(;this.isRunning&&!this.abortController.signal.aborted;){const{done:g,value:C}=await P.read();if(g){console.log("[S2] SSE stream ended");break}const E=T.decode(C,{stream:!0});x+=E;const B=x.split(`
|
|
304
|
-
`);if(x=B.pop()||"",x&&x.trim().startsWith("{")&&x.trim().endsWith("}"))try{JSON.parse(x),B.push(x),x=""}catch{}for(const _ of B){const M=_.trim();if(!M){S&&this.processSSEMessage(y,S),y=null,S="";continue}if(M.startsWith("{")&&M.endsWith("}")){this.processSSEMessage("batch",M);continue}if(M.startsWith("event:"))y=M.slice(6).trim();else if(M.startsWith("data:"))S+=M.slice(5).trim();else if(!M.startsWith("id:")){if(_.includes("batch{")){const D=_.indexOf("{");D!==-1&&this.processSSEMessage("batch",_.substring(D))}else if(_.includes("ping{")){const D=_.indexOf("{");D!==-1&&this.processSSEMessage("ping",_.substring(D))}}}}}catch(m){m.name==="AbortError"?console.log("[S2] SSE connection aborted"):(console.error("[S2] SSE error:",m),(d=(c=this.callbacks).onError)==null||d.call(c,m))}finally{this.isRunning=!1,(f=(p=this.callbacks).onDisconnect)==null||f.call(p)}}processSSEMessage(e,i){var s,r;const a=e||"batch";try{const o=JSON.parse(i);if(a==="batch"&&o.records){console.log("[S2] 📦 Processing batch with",o.records.length,"records");for(const l of o.records)try{const u=typeof l.body=="string"?JSON.parse(l.body):l.body;console.log("[S2] 📨 Record:",u),this.handleRecord(u)}catch(u){console.error("[S2] ❌ Error processing record:",u)}}else a==="ping"&&(console.log("[S2] 💓 Ping"),(r=(s=this.callbacks).onPing)==null||r.call(s))}catch(o){console.error("[S2] ❌ Error parsing SSE JSON:",o,"Raw:",i)}}handleRecord(e){var i,a,s,r,o,l,u,c,d,p,f,m,P,T;switch(e.action){case"fill":e.fieldId!==void 0&&e.value!==void 0&&((a=(i=this.callbacks).onFill)==null||a.call(i,e.fieldId,e.value,e.sectionKey));break;case"fillMultiple":e.fields&&Array.isArray(e.fields)&&((r=(s=this.callbacks).onFillMultiple)==null||r.call(s,e.fields));break;case"odontogram":const x=e.payload||{fieldId:e.fieldId,value:e.value};(x.value||x.fieldId)&&((l=(o=this.callbacks).onOdontogram)==null||l.call(o,x));break;case"transcript":e.messages&&((c=(u=this.callbacks).onTranscript)==null||c.call(u,e.messages));break;case"chat":case"assistant_chat":case"chat_history":case"chat_message":if(e.messages&&Array.isArray(e.messages))e.messages.forEach(y=>{var S,g;(g=(S=this.callbacks).onChatMessage)==null||g.call(S,{role:y.role==="assistant"?"model":y.role,content:y.text||y.content,timestamp:y.timestamp||new Date().toISOString(),id:y.id,source:e.source})});else if(e.message){const y=e.message;(p=(d=this.callbacks).onChatMessage)==null||p.call(d,{...y,source:e.source})}break;case"set_title":e.title&&((m=(f=this.callbacks).onTitleUpdate)==null||m.call(f,e.title));break;case"session_status":e.status&&e.analysisId&&(console.log("[S2] 📡 Session status update:",e.status,e.analysisId),(T=(P=this.callbacks).onSessionStatus)==null||T.call(P,{status:e.status,analysisId:e.analysisId,isPaused:e.isPaused,isConnected:e.isConnected,templateName:e.templateName,formDataCount:e.formDataCount,transcriptCount:e.transcriptCount}));break;default:console.log("[S2] Unhandled action:",e.action)}}stop(){var e;console.log("[S2] Stopping SSE listener"),this.isRunning=!1,(e=this.abortController)==null||e.abort(),this.abortController=null}isActive(){return this.isRunning}}async function sendTranscript(n,e){const i={type:"transcript",action:"transcript",messages:e};return console.log("[S2] Sending transcript:",e.length,"messages"),sendToS2(n,i)}async function sendAIFill(n,e,i,a,s){return sendToS2(n,{action:"fill",fieldId:i,value:a,sectionKey:s,editorSource:"clara",source:"web_client",analysisId:e})}async function sendTitleUpdate(n,e){return sendToS2(n,{action:"set_title",title:e,source:"ai_tool"})}async function sendChatToS2(n,e,i="chat"){const a=e.map(r=>({role:r.role==="assistant"?"model":r.role,text:r.text,timestamp:r.timestamp||new Date().toISOString(),id:r.id||Date.now().toString()})),s={action:i,messages:a,source:"widget",origin:"remote"};return console.log("[S2] Sending chat:",i,a.length,"messages"),sendToS2(n,s)}async function sendSessionStatus(n,e){const i={action:"session_status",...e,timestamp:new Date().toISOString(),source:"widget",origin:"remote"};return console.log("[S2] Sending session status:",e.status),sendToS2(n,i)}class GeminiTokenManager{constructor(){ze(this,"geminiToken",null);ze(this,"expiresAt",null);ze(this,"refreshTimer",null);ze(this,"isInitializing",!1);ze(this,"REFRESH_MARGIN_MS",5*60*1e3)}async initialize(){if(console.log("[GeminiToken] 🚀 initialize() called"),this.isInitializing)return console.log("[GeminiToken] ⚠️ Already initializing, skipping..."),!1;if(!claraApi.hasAuth())return console.error("[GeminiToken] ❌ No Clara auth credentials available"),!1;this.isInitializing=!0,console.log("[GeminiToken] 📡 Fetching Gemini token from Clara API...");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Initialization complete"),this.isInitializing=!1,!0):(console.error("[GeminiToken] ❌ Failed to fetch initial token"),this.isInitializing=!1,!1)}catch(e){return console.error("[GeminiToken] ❌ Initialization error:",e),this.isInitializing=!1,!1}}async fetchGeminiToken(){console.log("[GeminiToken] 📡 fetchGeminiToken() - calling POST /auth/ai/token");try{const e=claraApi.getHeadersForEphemeral(),i=await fetch(claraApi.getApiBaseUrl()+"/auth/ai/token",{method:"POST",headers:e});if(console.log("[GeminiToken] 📥 Response status:",i.status),!i.ok){const o=await i.text();return console.error("[GeminiToken] ❌ API error:",i.status,o),null}const a=await i.json(),s=a.data||a;console.log("[GeminiToken] 📥 Response data:",{hasToken:!!s.token,expireTime:s.expireTime});let r=s.expireTime;return typeof r=="string"&&(r=new Date(r).getTime()),{token:s.token,expireTime:r,newSessionExpireTime:s.newSessionExpireTime,raw:s}}catch(e){return console.error("[GeminiToken] ❌ Fetch error:",e),null}}setToken(e){console.log("[GeminiToken] 💾 setToken() - storing Gemini token (internal only)"),this.geminiToken=e.token,this.expiresAt=e.expireTime;const i=this.expiresAt-Date.now(),a=Math.round(i/1e3/60);console.log("[GeminiToken] ⏰ Gemini token expires in",a,"minutes")}scheduleRefresh(){if(console.log("[GeminiToken] ⏲️ scheduleRefresh() called"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),!this.expiresAt){console.warn("[GeminiToken] ⚠️ No expiration time set, cannot schedule refresh");return}const e=this.expiresAt-this.REFRESH_MARGIN_MS,i=Math.max(0,e-Date.now()),a=Math.round(i/1e3/60);console.log("[GeminiToken] ⏲️ Scheduling refresh in",a,"minutes"),this.refreshTimer=setTimeout(()=>{console.log("[GeminiToken] ⏰ Refresh timer fired!"),this.refresh()},i)}async refresh(){console.log("[GeminiToken] 🔄 refresh() called");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Token refreshed successfully"),!0):(console.error("[GeminiToken] ❌ Failed to refresh token"),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1)}catch(e){return console.error("[GeminiToken] ❌ Refresh error:",e),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1}}getToken(){return this.geminiToken}isValid(){return!!(this.geminiToken&&this.expiresAt&&Date.now()<this.expiresAt)}destroy(){console.log("[GeminiToken] 🧹 destroy() - cleaning up"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.geminiToken=null,this.expiresAt=null,this.isInitializing=!1,console.log("[GeminiToken] ✅ Cleanup complete")}}const ephemeralTokenManager=new GeminiTokenManager;function setNativeValue(n,e){var o;const i=String(e),a=Object.getPrototypeOf(n),s=Object.getOwnPropertyDescriptor(a,"value"),r=Object.getOwnPropertyDescriptor(n,"value");s&&(r==null?void 0:r.set)!==s.set?(o=s.set)==null||o.call(n,i):r!=null&&r.set?r.set.call(n,i):n.value=i}function dispatchInputEvents(n){try{n.focus()}catch{}try{const e=new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n.value});n.dispatchEvent(e)}catch{n.dispatchEvent(new Event("input",{bubbles:!0}))}n.dispatchEvent(new Event("change",{bubbles:!0})),n.dispatchEvent(new Event("blur",{bubbles:!0})),triggerReactInputTracker(n)}function triggerReactInputTracker(n){try{const e=n._valueTracker;e&&e.setValue("")}catch{}}function findField(n,e,i=document){var l,u,c;const a=i.getElementById(n);if(a&&isFormElement(a))return a;const s=[];try{s.push(`#${CSS.escape(n)}`)}catch{try{s.push(`[id="${n}"]`)}catch{}}if(s.push(`[name="${n}"]`,`[data-field="${n}"]`,`[data-id="${n}"]`,`[data-clara-field-id="${n}"]`,`input[id="${n}"]`,`select[id="${n}"]`,`textarea[id="${n}"]`),n.includes("__")){const d=n.split("__"),p=d[d.length-1];s.push(`[id$="__${p}"]`,`[name$="__${p}"]`,`[data-field$="__${p}"]`)}let r=null;if(e){const d=[`[data-section="${e}"]`,`[data-clara-section-key="${e}"]`,`#${e}`,`fieldset[data-section="${e}"]`,`.section-${e}`];for(const p of d){const f=i.querySelector(p);if(f)for(const m of s)try{if(r=f.querySelector(m),r&&isFormElement(r))return r}catch{}}}for(const d of s)try{if(r=i.querySelector(d),r&&isFormElement(r))return r}catch{}const o=i.querySelectorAll("input, select, textarea");for(const d of o){const p=d;if(p.id===n||p.name===n||((l=p.dataset)==null?void 0:l.field)===n||((u=p.dataset)==null?void 0:u.id)===n||((c=p.dataset)==null?void 0:c.claraFieldId)===n)return p}return null}function isFormElement(n){const e=n.tagName.toLowerCase();return e==="input"||e==="select"||e==="textarea"}function performLocalFill(n,e,i){var a;try{e==null&&(e=""),console.log("[Clara DOM] 🎯 Filling field:",{fieldName:n,value:e,sectionKey:i,type:typeof e});const s=document.querySelectorAll("input, select, textarea");if(console.log("[Clara DOM] 📋 Total fields in document:",s.length),s.length<50){const c=Array.from(s).map(d=>{const p=d;return`${p.tagName}#${p.id||"(no-id)"}[name=${p.name||"(no-name)"}]`});console.log("[Clara DOM] 📋 Fields:",c)}let r=findField(n,i,document),o=r?"document":"not-found";if(r&&console.log("[Clara DOM] 📍 Found in main document:",r.tagName,r.id||r.name,"type:",r.type),!r){const c=document.getElementsByTagName("iframe");console.log("[Clara DOM] 🔍 Checking",c.length,"iframes...");for(let d=0;d<c.length;d++)try{const p=c[d].contentDocument||((a=c[d].contentWindow)==null?void 0:a.document);if(p){const f=p.querySelectorAll("input, select, textarea");if(console.log(`[Clara DOM] 🔍 Iframe ${d} has ${f.length} fields`),r=findField(n,i,p),r){o="iframe",console.log("[Clara DOM] 📍 Found in iframe:",d,r.tagName,r.id);break}}}catch{console.log(`[Clara DOM] 🔍 Iframe ${d} is cross-origin, will broadcast`)}}if(!r)return console.warn("[Clara DOM] ❌ Field not found locally:",n),{success:!1,fieldId:n,value:e,foundIn:"not-found"};try{const c=r.style.borderColor,d=r.style.boxShadow;r.style.transition="all 0.3s ease",r.style.borderColor="#8b5cf6",r.style.boxShadow="0 0 0 4px rgba(139, 92, 246, 0.2)",setTimeout(()=>{try{r&&(r.style.borderColor=c||"",r.style.boxShadow=d||"")}catch(p){console.warn("[Clara DOM] Visual feedback cleanup error:",p)}},1e3)}catch(c){console.warn("[Clara DOM] Visual feedback error:",c)}const l=r.tagName.toLowerCase(),u=(r.type||"").toLowerCase();try{l==="select"?fillSelect(r,e):u==="checkbox"?fillCheckbox(r,e):u==="radio"?fillRadio(r,e):setNativeValue(r,String(e))}catch(c){return console.error("[Clara DOM] ❌ Fill error for",l,u,":",c),{success:!1,fieldId:n,value:e,foundIn:o}}return dispatchInputEvents(r),console.log("[Clara DOM] ✅ Field filled:",n,"=",e),{success:!0,fieldId:n,value:e,foundIn:o}}catch(s){return console.error("[Clara DOM] ❌ Unexpected error in performLocalFill:",s),{success:!1,fieldId:n,value:e,foundIn:"not-found"}}}function fillSelect(n,e){const i=String(e).toLowerCase().trim();let a=-1;console.log("[Clara DOM] 🔽 Filling SELECT:",n.id||n.name,"with value:",e),console.log("[Clara DOM] 🔽 Available options:",Array.from(n.options).map(s=>`${s.value} (${s.text})`));for(let s=0;s<n.options.length;s++)if(n.options[s].value.toLowerCase().trim()===i){a=s,console.log("[Clara DOM] 🔽 Exact value match found at index:",s);break}if(a===-1){for(let s=0;s<n.options.length;s++)if(n.options[s].text.toLowerCase().trim()===i){a=s,console.log("[Clara DOM] 🔽 Exact text match found at index:",s);break}}if(a===-1)for(let s=0;s<n.options.length;s++){const r=n.options[s];if(r.text.toLowerCase().includes(i)||i.includes(r.text.toLowerCase().trim())){a=s,console.log("[Clara DOM] 🔽 Partial match found at index:",s,"- option:",r.text);break}}a!==-1?(n.selectedIndex=a,console.log("[Clara DOM] ✅ SELECT set to index:",a,"- value:",n.value)):(n.value=String(e),console.warn("[Clara DOM] ⚠️ No option match for SELECT, tried direct value:",e))}function fillCheckbox(n,e){let i;if(typeof e=="boolean")i=e;else{const a=String(e).toLowerCase().trim();i=["si","sí","yes","true","1","on","checked"].includes(a)}if(console.log("[Clara DOM] ☑️ Filling CHECKBOX:",n.id||n.name),console.log("[Clara DOM] ☑️ Input value:",e,"-> shouldCheck:",i),console.log("[Clara DOM] ☑️ Current checked state:",n.checked),n.checked===i){console.log("[Clara DOM] ☑️ Already in correct state, skipping");return}try{const a=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"checked");a&&a.set?a.set.call(n,i):n.checked=i,console.log("[Clara DOM] ☑️ After native set, checked:",n.checked);const s=new Event("change",{bubbles:!0,cancelable:!1});n.dispatchEvent(s);const r=new Event("input",{bubbles:!0,cancelable:!1});n.dispatchEvent(r),console.log("[Clara DOM] ☑️ Events dispatched, final checked:",n.checked)}catch(a){console.error("[Clara DOM] ❌ Checkbox fill error:",a)}}function fillRadio(n,e){const a=(n.closest("form")||n.ownerDocument).querySelectorAll(`input[name="${n.name}"]`),s=String(e).toLowerCase().trim();console.log("[Clara DOM] 🔘 Filling RADIO group:",n.name,"with value:",e),console.log("[Clara DOM] 🔘 Found",a.length,"radio buttons in group");let r=!1;a.forEach(o=>{const l=o;console.log("[Clara DOM] 🔘 Checking radio value:",l.value,"against:",s),l.value.toLowerCase().trim()===s&&(l.checked=!0,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0})),console.log("[Clara DOM] ✅ RADIO selected:",l.value),r=!0)}),r||console.warn("[Clara DOM] ⚠️ No matching radio found for value:",e)}function broadcastToIframes(n){var i;const e=document.getElementsByTagName("iframe");for(let a=0;a<e.length;a++)try{(i=e[a].contentWindow)==null||i.postMessage(n,"*")}catch{}}function broadcast(n,e){var a;if(console.log(`[Clara DOM] 📡 Broadcasting ${n}`,e),n==="CLARA_CMD_FILL"&&performLocalFill(e.fieldName,e.value,e.sectionKey),n==="CLARA_CMD_ODONTO"){console.log("[Clara DOM] 🦷 Dispatching odontograma:command event with:",e.payload),window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload}));const s={type:"FROM_EXTENSION",fieldId:e.fieldId||"odontograma",payload:e.payload};console.log("[Clara DOM] 📤 Sending FROM_EXTENSION postMessage (local):",s),window.postMessage(s,"*");const r=document.getElementsByTagName("iframe");console.log(`[Clara DOM] 📤 Broadcasting FROM_EXTENSION to ${r.length} iframes:`,s);for(let o=0;o<r.length;o++)try{(a=r[o].contentWindow)==null||a.postMessage(s,"*"),console.log(`[Clara DOM] ✅ Sent FROM_EXTENSION to iframe ${o}`)}catch(l){console.log(`[Clara DOM] ❌ Failed to send to iframe ${o}:`,l)}}const i=document.getElementsByTagName("iframe");console.log(`[Clara DOM] 📤 Broadcasting ${n} to ${i.length} iframes:`,{type:n,...e}),broadcastToIframes({type:n,...e})}function setupFieldListeners(n,e=document){e.querySelectorAll("input, textarea, select").forEach(a=>{var l;const s=a;if((l=s.dataset)!=null&&l.claraListener)return;s.dataset.claraListener="true";const r=s.id||s.name;if(!r)return;const o=()=>{const u=s.closest("[data-section], [data-clara-section-key]");return u&&(u.dataset.section||u.dataset.claraSectionKey)||null};s.addEventListener("click",()=>{n({fieldId:r,action:"click",sectionKey:o()})}),s.addEventListener("focus",()=>{n({fieldId:r,action:"focus",sectionKey:o()})}),s.addEventListener("blur",()=>{const u=s.type==="checkbox"?s.checked:s.value;n({fieldId:r,action:"blur",value:u,sectionKey:o()})}),s.addEventListener("change",u=>{if(u.isTrusted){let c=s.value;if(s.type==="checkbox")c=s.checked;else if(s.type==="radio"&&!s.checked)return;n({fieldId:r,action:"change",value:c,sectionKey:o()})}})})}function setupSectionListeners(n,e=document){e.querySelectorAll("[data-section], fieldset").forEach(a=>{var r;const s=a;(r=s.dataset)!=null&&r.claraSectionListener||(s.dataset.claraSectionListener="true",s.dataset.section||s.id,s.addEventListener("click",o=>{const l=o.target;l===s||["LEGEND","H2","H3"].includes(l.tagName)}))})}function isInIframe(){try{return window!==window.top}catch{return!0}}function initClaraListener(){return window.__claraListenerActive?(console.log("[Clara Listener] Already active"),!0):(console.log("[Clara Listener] 🎧 Initializing on:",window.location.pathname),window.addEventListener("message",n=>{var i,a;const e=n.data;if(!(!e||typeof e!="object")&&(i=e.type)!=null&&i.startsWith("CLARA_")){if(console.log("[Clara Listener] 📨 Received:",e.type,e),e.type==="CLARA_CMD_FILL"){const s=performLocalFill(e.fieldName,e.value,e.sectionKey);console.log("[Clara Listener] Fill result:",s)}if(e.type==="CLARA_CMD_FILL_MULTIPLE"&&((a=e.fields)==null||a.forEach(s=>{performLocalFill(s.fieldId,s.value,s.sectionKey)})),e.type==="CLARA_CMD_ODONTO"){console.log("[Clara Listener] 🦷 Received CLARA_CMD_ODONTO, dispatching odontograma:command:",e.payload),window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload}));const s={type:"FROM_EXTENSION",fieldId:e.fieldId||"odontograma",payload:e.payload};console.log("[Clara Listener] 📤 Sending FROM_EXTENSION postMessage:",s),window.postMessage(s,"*")}}}),window.addEventListener("clara:fill",n=>{const{fieldId:e,value:i,sectionKey:a}=n.detail;console.log("[Clara Listener] 🎯 Custom event fill:",e,i),performLocalFill(e,i,a)}),window.addEventListener("clara:fill-multiple",n=>{const{fields:e}=n.detail;e==null||e.forEach(i=>{performLocalFill(i.fieldId,i.value,i.sectionKey)})}),window.__claraListenerActive=!0,console.log("[Clara Listener] ✅ Active and listening"),!0)}function sendFillCommand(n,e,i){console.log("[Clara Fill] 📤 Sending fill command:",n,e);const a=performLocalFill(n,e,i);if(a.success)return console.log("[Clara Fill] ✅ Direct fill succeeded"),a;try{window.dispatchEvent(new CustomEvent("clara:fill",{detail:{fieldId:n,value:e,sectionKey:i}}))}catch(s){console.warn("[Clara Fill] Custom event failed:",s)}try{window.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(s){console.warn("[Clara Fill] Self postMessage failed:",s)}if(broadcastToIframes({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i}),isInIframe())try{window.parent.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(s){console.warn("[Clara Fill] Parent postMessage failed:",s)}return a}const CONDITIONS={hallazgo:[{id:"caries",label:"Caries",areaType:"surface"},{id:"resina_desadaptada",label:"Resina Desadaptada",areaType:"surface"},{id:"amalgama_desadaptada",label:"Amalgama Desadaptada",areaType:"surface"},{id:"linea_factura",label:"Línea Fractura",areaType:"surface"},{id:"obturacion_temporal",label:"Obturación Temporal",areaType:"surface"},{id:"fosas_fisuras_profundas",label:"Fosas/Fisuras Prof.",areaType:"surface"},{id:"resina_cervical",label:"Resina Cervical",areaType:"surface"},{id:"resto_radicular",label:"Resto Radicular",areaType:"whole"},{id:"ausente",label:"Ausente",areaType:"whole"},{id:"exodoncia",label:"Exodoncia Indicada",areaType:"whole"},{id:"corona",label:"Corona (Defectuosa)",areaType:"whole"},{id:"corona_provisional",label:"Corona Provisional",areaType:"whole"},{id:"carilla",label:"Carilla (Defectuosa)",areaType:"whole"},{id:"abrasion_erosion",label:"Abrasion/Erosion",areaType:"whole"},{id:"mov_grado_1",label:"Movilidad I",areaType:"whole"},{id:"mov_grado_2",label:"Movilidad II",areaType:"whole"},{id:"mov_grado_3",label:"Movilidad III",areaType:"whole"},{id:"sin_erupcionar",label:"Sin Erupcionar",areaType:"whole"},{id:"implante_afectado",label:"Implante Afectado",areaType:"whole"},{id:"supernumerario",label:"Supernumerario",areaType:"whole"}],hallazgo_realizado:[{id:"resina_adaptada",label:"Resina",areaType:"surface"},{id:"amalgama_adaptada",label:"Amalgama",areaType:"surface"},{id:"sellante",label:"Sellante",areaType:"surface"},{id:"tratamiento_realizado",label:"Tratamiento Gen.",areaType:"surface"},{id:"corona",label:"Corona",areaType:"whole"},{id:"carilla",label:"Carilla",areaType:"whole"},{id:"implante",label:"Implante",areaType:"whole"},{id:"endodoncia",label:"Endodoncia",areaType:"whole"},{id:"extraido",label:"Extraído (Qx)",areaType:"whole"}]};`${CONDITIONS.hallazgo.map(n=>n.id).join(", ")}${CONDITIONS.hallazgo_realizado.map(n=>n.id).join(", ")}`;const VALID_TOOTH_KEYS=["18","18SN","18SNRX","17","17SN","17SNRX","16","16SN","16SNRX","15","15SN","15SNRX","14","14SN","14SNRX","13","13SN","13SNRX","12","12SN","12SNRX","11","11SN","11SNRX","55","55SN","55SNRX","54","54SN","54SNRX","53","53SN","53SNRX","52","52SN","52SNRX","51","51SN","51SNRX","85","85SN","85SNRX","84","84SN","84SNRX","83","83SN","83SNRX","82","82SN","82SNRX","81","81SN","81SNRX","48","48SN","48SNRX","47","47SN","47SNRX","46","46SN","46SNRX","45","45SN","45SNRX","44","44SN","44SNRX","43","43SN","43SNRX","42","42SN","42SNRX","41","41SN","41SNRX","21","21SN","21SNRX","22","22SN","22SNRX","23","23SN","23SNRX","24","24SN","24SNRX","25","25SN","25SNRX","26","26SN","26SNRX","27","27SN","27SNRX","28","28SN","28SNRX","61","61SN","61SNRX","62","62SN","62SNRX","63","63SN","63SNRX","64","64SN","64SNRX","65","65SN","65SNRX","71","71SN","71SNRX","72","72SN","72SNRX","73","73SN","73SNRX","74","74SN","74SNRX","75","75SN","75SNRX","31","31SN","31SNRX","32","32SN","32SNRX","33","33SN","33SNRX","34","34SN","34SNRX","35","35SN","35SNRX","36","36SN","36SNRX","37","37SN","37SNRX","38","38SN","38SNRX"],VALID_TYPES=["clear","hallazgo","hallazgo_realizado"],VALID_ACTIONS_BY_TYPE_AND_AREA={hallazgo:[["ok","corona","corona_provisional","carilla","resto_radicular","abrasion_erosion","implante_afectado","endodoncia","exodoncia","ausente","sin_erupcionar","exodoncia_qx","mov_grado_1","mov_grado_2","mov_grado_3","pulido","radiografia","supernumerario","supernumerario_rx","parcialmente_erupcionado_o_impactado"],["resina_cervical"],["resina_cervical"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_mesial"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_distal"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"]],hallazgo_realizado:[["corona","carilla","implante","endodoncia","extraido","ausente","sin_erupcionar","parcialmente_erupcionado_o_impactado"],["resina_cervical"],["resina_cervical"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_mesial"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_distal"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"]]},validateOdontogramAction=n=>{var o;const{key:e,type:i,area:a,action:s}=n;if(!VALID_TOOTH_KEYS.includes(e))return{valid:!1,error:`Invalid tooth key: ${e}`};if(!VALID_TYPES.includes(i))return{valid:!1,error:`Invalid type: ${i}. Must be one of: ${VALID_TYPES.join(", ")}`};if(i==="clear")return{valid:!0};if(typeof a!="number"||a<0||a>7)return{valid:!1,error:`Invalid area: ${a}. Must be 0-7`};const r=(o=VALID_ACTIONS_BY_TYPE_AND_AREA[i])==null?void 0:o[a];return r?r.includes(s)?{valid:!0}:{valid:!1,error:`Invalid action "${s}" for type "${i}" area ${a}. Valid: ${r.join(", ")}`}:{valid:!1,error:`No valid actions for type ${i} and area ${a}`}},surfaceToArea$1=n=>{if(!n)return 0;switch(n.toLowerCase()){case"whole":case"completo":return 0;case"vestibular":case"bucal":case"top":return 1;case"lingual":case"palatal":case"palatino":case"bottom":return 2;case"mesial":case"left":return 4;case"distal":case"right":return 6;case"oclusal":case"incisal":case"center":return 7;default:return 7}},ClaraChat=({primaryColor:n})=>{const{config:e,currentAnalysis:i,chatMessages:a,addChatMessage:s,clearChatMessages:r,analysisStreamInfo:o,currentTemplate:l,formData:u,updateFormData:c}=useClaraStore(),d=e.lang||"es",[p,f]=React.useState(""),[m,P]=React.useState(!1),[T,x]=React.useState(!1),[y,S]=React.useState([]),[g,C]=React.useState(!1),E=React.useRef(null),B=React.useRef(null),_=React.useRef(null),M=React.useRef([]);React.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[a,m,y]),React.useEffect(()=>{const I=V=>{V.target.closest(".actions-menu-container")||x(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]),React.useEffect(()=>{if(!(i!=null&&i.id)||a.length===0)return;const V=setTimeout(async()=>{try{const A=a.map(k=>({id:k.id||Date.now().toString(),role:k.role,text:k.content}));await claraApi.syncChatHistory(i.id,A),console.log("[ClaraChat] Chat history synced:",A.length,"messages")}catch(A){console.error("[ClaraChat] Failed to sync chat history:",A)}},2e3);return()=>clearTimeout(V)},[a,i==null?void 0:i.id]);const D=async I=>{if(I.target.files&&I.target.files.length>0){const V=I.target.files[0],A=new FileReader;A.onload=()=>{const k=A.result.split(",")[1],R=V.type.startsWith("image/"),G=V.type==="application/pdf";if(!R&&!G)return;const z={id:Date.now().toString(),file:V,base64:k,type:G?"pdf":"image",previewUrl:R?URL.createObjectURL(V):void 0};S(q=>[...q,z])},A.readAsDataURL(V)}B.current&&(B.current.value="")},L=I=>{S(V=>V.filter(A=>A.id!==I))},F=async()=>{try{const I=await navigator.mediaDevices.getUserMedia({audio:!0}),V=new MediaRecorder(I);_.current=V,M.current=[],V.ondataavailable=A=>{A.data.size>0&&M.current.push(A.data)},V.start(),C(!0)}catch(I){console.error("Error accessing microphone:",I),s({role:"model",content:"No se pudo acceder al micrófono.",timestamp:new Date})}},N=()=>{_.current&&g&&(_.current.stop(),_.current.onstop=async()=>{var A;const I=new Blob(M.current,{type:"audio/webm"}),V=new FileReader;V.onloadend=()=>{const k=V.result.split(",")[1];H("",[{id:Date.now().toString(),file:new File([I],"voice_note.webm",{type:"audio/webm"}),base64:k,type:"audio"}])},V.readAsDataURL(I),(A=_.current)==null||A.stream.getTracks().forEach(k=>k.stop()),C(!1)})},H=async(I,V)=>{var z,q,U,K,Q,ne,Ee;const A=I!==void 0?I:p,k=V||y;if(!A.trim()&&k.length===0)return;let R=A;if(!R){const ye=k.some(oe=>oe.type==="audio"),ge=k.some(oe=>oe.type==="image"),xe=k.some(oe=>oe.type==="pdf");ye?R="🎤 Nota de voz enviada":ge?R="📷 Imagen enviada para análisis":xe&&(R="📄 Documento PDF enviado")}s({role:"user",content:R,timestamp:new Date}),f(""),S([]),P(!0),x(!1);try{o&&await sendChatToS2(o,[{role:"user",text:A||R,timestamp:new Date().toISOString(),id:Date.now().toString()}],"chat");let ye=ephemeralTokenManager.getToken();if(ye||await ephemeralTokenManager.initialize()&&(ye=ephemeralTokenManager.getToken()),!ye)throw new Error("No Gemini API key available");const ge=new GoogleGenAI({apiKey:ye}),xe={name:"updateReport",description:"Updates medical report fields based on user instructions or visual analysis.",parameters:{type:Type.OBJECT,properties:{updates:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{fieldId:{type:Type.STRING},value:{type:Type.STRING},reason:{type:Type.STRING}},required:["fieldId","value"]}}},required:["updates"]}},oe={name:"updateOdontogram",description:"Updates dental odontogram with findings or treatments. Use FDI tooth numbering (11-18, 21-28, 31-38, 41-48, 51-55, 61-65, 71-75, 81-85).",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"FDI tooth number"},type:{type:Type.STRING,description:"hallazgo or hallazgo_realizado"},condition:{type:Type.STRING,description:"Condition/treatment name"},surface:{type:Type.STRING,description:"Optional: vestibular, lingual, mesial, distal, oclusal, whole"}},required:["tooth","type","condition"]}}},required:["actions"]}};let Y="";(z=l==null?void 0:l.structure)!=null&&z.sections&&(Y=l.structure.sections.map(fe=>{var pe;const ke=((pe=fe.fields)==null?void 0:pe.map(Re=>` - ${Re.id} (${Re.type}): ${Re.label}${Re.options?` [opciones: ${Re.options.join(", ")}]`:""}`).join(`
|
|
304
|
+
`);if(x=B.pop()||"",x&&x.trim().startsWith("{")&&x.trim().endsWith("}"))try{JSON.parse(x),B.push(x),x=""}catch{}for(const _ of B){const M=_.trim();if(!M){S&&this.processSSEMessage(y,S),y=null,S="";continue}if(M.startsWith("{")&&M.endsWith("}")){this.processSSEMessage("batch",M);continue}if(M.startsWith("event:"))y=M.slice(6).trim();else if(M.startsWith("data:"))S+=M.slice(5).trim();else if(!M.startsWith("id:")){if(_.includes("batch{")){const D=_.indexOf("{");D!==-1&&this.processSSEMessage("batch",_.substring(D))}else if(_.includes("ping{")){const D=_.indexOf("{");D!==-1&&this.processSSEMessage("ping",_.substring(D))}}}}}catch(m){m.name==="AbortError"?console.log("[S2] SSE connection aborted"):(console.error("[S2] SSE error:",m),(d=(c=this.callbacks).onError)==null||d.call(c,m))}finally{this.isRunning=!1,(f=(p=this.callbacks).onDisconnect)==null||f.call(p)}}processSSEMessage(e,i){var s,r;const a=e||"batch";try{const o=JSON.parse(i);if(a==="batch"&&o.records){console.log("[S2] 📦 Processing batch with",o.records.length,"records");for(const l of o.records)try{const u=typeof l.body=="string"?JSON.parse(l.body):l.body;console.log("[S2] 📨 Record:",u),this.handleRecord(u)}catch(u){console.error("[S2] ❌ Error processing record:",u)}}else a==="ping"&&(console.log("[S2] 💓 Ping"),(r=(s=this.callbacks).onPing)==null||r.call(s))}catch(o){console.error("[S2] ❌ Error parsing SSE JSON:",o,"Raw:",i)}}handleRecord(e){var i,a,s,r,o,l,u,c,d,p,f,m,P,T;switch(e.action){case"fill":e.fieldId!==void 0&&e.value!==void 0&&((a=(i=this.callbacks).onFill)==null||a.call(i,e.fieldId,e.value,e.sectionKey));break;case"fillMultiple":e.fields&&Array.isArray(e.fields)&&((r=(s=this.callbacks).onFillMultiple)==null||r.call(s,e.fields));break;case"odontogram":const x=e.payload||{fieldId:e.fieldId,value:e.value};(x.value||x.fieldId)&&((l=(o=this.callbacks).onOdontogram)==null||l.call(o,x));break;case"transcript":e.messages&&((c=(u=this.callbacks).onTranscript)==null||c.call(u,e.messages));break;case"chat":case"assistant_chat":case"chat_history":case"chat_message":if(e.messages&&Array.isArray(e.messages))e.messages.forEach(y=>{var S,g;(g=(S=this.callbacks).onChatMessage)==null||g.call(S,{role:y.role==="assistant"?"model":y.role,content:y.text||y.content,timestamp:y.timestamp||new Date().toISOString(),id:y.id,source:e.source})});else if(e.message){const y=e.message;(p=(d=this.callbacks).onChatMessage)==null||p.call(d,{...y,source:e.source})}break;case"set_title":e.title&&((m=(f=this.callbacks).onTitleUpdate)==null||m.call(f,e.title));break;case"session_status":e.status&&e.analysisId&&(console.log("[S2] 📡 Session status update:",e.status,e.analysisId),(T=(P=this.callbacks).onSessionStatus)==null||T.call(P,{status:e.status,analysisId:e.analysisId,isPaused:e.isPaused,isConnected:e.isConnected,templateName:e.templateName,formDataCount:e.formDataCount,transcriptCount:e.transcriptCount}));break;default:console.log("[S2] Unhandled action:",e.action)}}stop(){var e;console.log("[S2] Stopping SSE listener"),this.isRunning=!1,(e=this.abortController)==null||e.abort(),this.abortController=null}isActive(){return this.isRunning}}async function sendTranscript(n,e){const i={type:"transcript",action:"transcript",messages:e};return console.log("[S2] Sending transcript:",e.length,"messages"),sendToS2(n,i)}async function sendAIFill(n,e,i,a,s){return sendToS2(n,{action:"fill",fieldId:i,value:a,sectionKey:s,editorSource:"clara",source:"web_client",analysisId:e})}async function sendTitleUpdate(n,e){return sendToS2(n,{action:"set_title",title:e,source:"ai_tool"})}async function sendChatToS2(n,e,i="chat"){const a=e.map(r=>({role:r.role==="assistant"?"model":r.role,text:r.text,timestamp:r.timestamp||new Date().toISOString(),id:r.id||Date.now().toString()})),s={action:i,messages:a,source:"widget",origin:"remote"};return console.log("[S2] Sending chat:",i,a.length,"messages"),sendToS2(n,s)}async function sendSessionStatus(n,e){const i={action:"session_status",...e,timestamp:new Date().toISOString(),source:"widget",origin:"remote"};return console.log("[S2] Sending session status:",e.status),sendToS2(n,i)}class GeminiTokenManager{constructor(){ze(this,"geminiToken",null);ze(this,"expiresAt",null);ze(this,"refreshTimer",null);ze(this,"isInitializing",!1);ze(this,"REFRESH_MARGIN_MS",5*60*1e3)}async initialize(){if(console.log("[GeminiToken] 🚀 initialize() called"),this.isInitializing)return console.log("[GeminiToken] ⚠️ Already initializing, skipping..."),!1;if(!claraApi.hasAuth())return console.error("[GeminiToken] ❌ No Clara auth credentials available"),!1;this.isInitializing=!0,console.log("[GeminiToken] 📡 Fetching Gemini token from Clara API...");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Initialization complete"),this.isInitializing=!1,!0):(console.error("[GeminiToken] ❌ Failed to fetch initial token"),this.isInitializing=!1,!1)}catch(e){return console.error("[GeminiToken] ❌ Initialization error:",e),this.isInitializing=!1,!1}}async fetchGeminiToken(){console.log("[GeminiToken] 📡 fetchGeminiToken() - calling POST /auth/ai/token");try{const e=claraApi.getHeadersForEphemeral(),i=await fetch(claraApi.getApiBaseUrl()+"/auth/ai/token",{method:"POST",headers:e});if(console.log("[GeminiToken] 📥 Response status:",i.status),!i.ok){const o=await i.text();return console.error("[GeminiToken] ❌ API error:",i.status,o),null}const a=await i.json(),s=a.data||a;console.log("[GeminiToken] 📥 Response data:",{hasToken:!!s.token,expireTime:s.expireTime});let r=s.expireTime;return typeof r=="string"&&(r=new Date(r).getTime()),{token:s.token,expireTime:r,newSessionExpireTime:s.newSessionExpireTime,raw:s}}catch(e){return console.error("[GeminiToken] ❌ Fetch error:",e),null}}setToken(e){console.log("[GeminiToken] 💾 setToken() - storing Gemini token (internal only)"),this.geminiToken=e.token,this.expiresAt=e.expireTime;const i=this.expiresAt-Date.now(),a=Math.round(i/1e3/60);console.log("[GeminiToken] ⏰ Gemini token expires in",a,"minutes")}scheduleRefresh(){if(console.log("[GeminiToken] ⏲️ scheduleRefresh() called"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),!this.expiresAt){console.warn("[GeminiToken] ⚠️ No expiration time set, cannot schedule refresh");return}const e=this.expiresAt-this.REFRESH_MARGIN_MS,i=Math.max(0,e-Date.now()),a=Math.round(i/1e3/60);console.log("[GeminiToken] ⏲️ Scheduling refresh in",a,"minutes"),this.refreshTimer=setTimeout(()=>{console.log("[GeminiToken] ⏰ Refresh timer fired!"),this.refresh()},i)}async refresh(){console.log("[GeminiToken] 🔄 refresh() called");try{const e=await this.fetchGeminiToken();return e?(this.setToken(e),this.scheduleRefresh(),console.log("[GeminiToken] ✅ Token refreshed successfully"),!0):(console.error("[GeminiToken] ❌ Failed to refresh token"),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1)}catch(e){return console.error("[GeminiToken] ❌ Refresh error:",e),this.refreshTimer=setTimeout(()=>this.refresh(),60*1e3),!1}}getToken(){return this.geminiToken}isValid(){return!!(this.geminiToken&&this.expiresAt&&Date.now()<this.expiresAt)}destroy(){console.log("[GeminiToken] 🧹 destroy() - cleaning up"),this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.geminiToken=null,this.expiresAt=null,this.isInitializing=!1,console.log("[GeminiToken] ✅ Cleanup complete")}}const ephemeralTokenManager=new GeminiTokenManager;function setNativeValue(n,e){var o;const i=String(e),a=Object.getPrototypeOf(n),s=Object.getOwnPropertyDescriptor(a,"value"),r=Object.getOwnPropertyDescriptor(n,"value");s&&(r==null?void 0:r.set)!==s.set?(o=s.set)==null||o.call(n,i):r!=null&&r.set?r.set.call(n,i):n.value=i}function dispatchInputEvents(n){try{n.focus()}catch{}try{const e=new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n.value});n.dispatchEvent(e)}catch{n.dispatchEvent(new Event("input",{bubbles:!0}))}n.dispatchEvent(new Event("change",{bubbles:!0})),n.dispatchEvent(new Event("blur",{bubbles:!0})),triggerReactInputTracker(n)}function triggerReactInputTracker(n){try{const e=n._valueTracker;e&&e.setValue("")}catch{}}function findField(n,e,i=document){var l,u,c;const a=i.getElementById(n);if(a&&isFormElement(a))return a;const s=[];try{s.push(`#${CSS.escape(n)}`)}catch{try{s.push(`[id="${n}"]`)}catch{}}if(s.push(`[name="${n}"]`,`[data-field="${n}"]`,`[data-id="${n}"]`,`[data-clara-field-id="${n}"]`,`input[id="${n}"]`,`select[id="${n}"]`,`textarea[id="${n}"]`),n.includes("__")){const d=n.split("__"),p=d[d.length-1];s.push(`[id$="__${p}"]`,`[name$="__${p}"]`,`[data-field$="__${p}"]`)}let r=null;if(e){const d=[`[data-section="${e}"]`,`[data-clara-section-key="${e}"]`,`#${e}`,`fieldset[data-section="${e}"]`,`.section-${e}`];for(const p of d){const f=i.querySelector(p);if(f)for(const m of s)try{if(r=f.querySelector(m),r&&isFormElement(r))return r}catch{}}}for(const d of s)try{if(r=i.querySelector(d),r&&isFormElement(r))return r}catch{}const o=i.querySelectorAll("input, select, textarea");for(const d of o){const p=d;if(p.id===n||p.name===n||((l=p.dataset)==null?void 0:l.field)===n||((u=p.dataset)==null?void 0:u.id)===n||((c=p.dataset)==null?void 0:c.claraFieldId)===n)return p}return null}function isFormElement(n){const e=n.tagName.toLowerCase();return e==="input"||e==="select"||e==="textarea"}function performLocalFill(n,e,i){var a;try{e==null&&(e=""),console.log("[Clara DOM] 🎯 Filling field:",{fieldName:n,value:e,sectionKey:i,type:typeof e});const s=document.querySelectorAll("input, select, textarea");if(console.log("[Clara DOM] 📋 Total fields in document:",s.length),s.length<50){const c=Array.from(s).map(d=>{const p=d;return`${p.tagName}#${p.id||"(no-id)"}[name=${p.name||"(no-name)"}]`});console.log("[Clara DOM] 📋 Fields:",c)}let r=findField(n,i,document),o=r?"document":"not-found";if(r&&console.log("[Clara DOM] 📍 Found in main document:",r.tagName,r.id||r.name,"type:",r.type),!r){const c=document.getElementsByTagName("iframe");console.log("[Clara DOM] 🔍 Checking",c.length,"iframes...");for(let d=0;d<c.length;d++)try{const p=c[d].contentDocument||((a=c[d].contentWindow)==null?void 0:a.document);if(p){const f=p.querySelectorAll("input, select, textarea");if(console.log(`[Clara DOM] 🔍 Iframe ${d} has ${f.length} fields`),r=findField(n,i,p),r){o="iframe",console.log("[Clara DOM] 📍 Found in iframe:",d,r.tagName,r.id);break}}}catch{console.log(`[Clara DOM] 🔍 Iframe ${d} is cross-origin, will broadcast`)}}if(!r)return console.warn("[Clara DOM] ❌ Field not found locally:",n),{success:!1,fieldId:n,value:e,foundIn:"not-found"};try{const c=r.style.borderColor,d=r.style.boxShadow;r.style.transition="all 0.3s ease",r.style.borderColor="#8b5cf6",r.style.boxShadow="0 0 0 4px rgba(139, 92, 246, 0.2)",setTimeout(()=>{try{r&&(r.style.borderColor=c||"",r.style.boxShadow=d||"")}catch(p){console.warn("[Clara DOM] Visual feedback cleanup error:",p)}},1e3)}catch(c){console.warn("[Clara DOM] Visual feedback error:",c)}const l=r.tagName.toLowerCase(),u=(r.type||"").toLowerCase();try{l==="select"?fillSelect(r,e):u==="checkbox"?fillCheckbox(r,e):u==="radio"?fillRadio(r,e):setNativeValue(r,String(e))}catch(c){return console.error("[Clara DOM] ❌ Fill error for",l,u,":",c),{success:!1,fieldId:n,value:e,foundIn:o}}return dispatchInputEvents(r),console.log("[Clara DOM] ✅ Field filled:",n,"=",e),{success:!0,fieldId:n,value:e,foundIn:o}}catch(s){return console.error("[Clara DOM] ❌ Unexpected error in performLocalFill:",s),{success:!1,fieldId:n,value:e,foundIn:"not-found"}}}function fillSelect(n,e){const i=String(e).toLowerCase().trim();let a=-1;console.log("[Clara DOM] 🔽 Filling SELECT:",n.id||n.name,"with value:",e),console.log("[Clara DOM] 🔽 Available options:",Array.from(n.options).map(s=>`${s.value} (${s.text})`));for(let s=0;s<n.options.length;s++)if(n.options[s].value.toLowerCase().trim()===i){a=s,console.log("[Clara DOM] 🔽 Exact value match found at index:",s);break}if(a===-1){for(let s=0;s<n.options.length;s++)if(n.options[s].text.toLowerCase().trim()===i){a=s,console.log("[Clara DOM] 🔽 Exact text match found at index:",s);break}}if(a===-1)for(let s=0;s<n.options.length;s++){const r=n.options[s];if(r.text.toLowerCase().includes(i)||i.includes(r.text.toLowerCase().trim())){a=s,console.log("[Clara DOM] 🔽 Partial match found at index:",s,"- option:",r.text);break}}a!==-1?(n.selectedIndex=a,console.log("[Clara DOM] ✅ SELECT set to index:",a,"- value:",n.value)):(n.value=String(e),console.warn("[Clara DOM] ⚠️ No option match for SELECT, tried direct value:",e))}function fillCheckbox(n,e){let i;if(typeof e=="boolean")i=e;else{const a=String(e).toLowerCase().trim();i=["si","sí","yes","true","1","on","checked"].includes(a)}if(console.log("[Clara DOM] ☑️ Filling CHECKBOX:",n.id||n.name),console.log("[Clara DOM] ☑️ Input value:",e,"-> shouldCheck:",i),console.log("[Clara DOM] ☑️ Current checked state:",n.checked),n.checked===i){console.log("[Clara DOM] ☑️ Already in correct state, skipping");return}try{const a=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"checked");a&&a.set?a.set.call(n,i):n.checked=i,console.log("[Clara DOM] ☑️ After native set, checked:",n.checked);const s=new Event("change",{bubbles:!0,cancelable:!1});n.dispatchEvent(s);const r=new Event("input",{bubbles:!0,cancelable:!1});n.dispatchEvent(r),console.log("[Clara DOM] ☑️ Events dispatched, final checked:",n.checked)}catch(a){console.error("[Clara DOM] ❌ Checkbox fill error:",a)}}function fillRadio(n,e){const a=(n.closest("form")||n.ownerDocument).querySelectorAll(`input[name="${n.name}"]`),s=String(e).toLowerCase().trim();console.log("[Clara DOM] 🔘 Filling RADIO group:",n.name,"with value:",e),console.log("[Clara DOM] 🔘 Found",a.length,"radio buttons in group");let r=!1;a.forEach(o=>{const l=o;console.log("[Clara DOM] 🔘 Checking radio value:",l.value,"against:",s),l.value.toLowerCase().trim()===s&&(l.checked=!0,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0})),console.log("[Clara DOM] ✅ RADIO selected:",l.value),r=!0)}),r||console.warn("[Clara DOM] ⚠️ No matching radio found for value:",e)}function broadcastToIframes(n){var i;const e=document.getElementsByTagName("iframe");for(let a=0;a<e.length;a++)try{(i=e[a].contentWindow)==null||i.postMessage(n,"*")}catch{}}function broadcast(n,e){var a;if(console.log(`[Clara DOM] 📡 Broadcasting ${n}`,e),n==="CLARA_CMD_FILL"&&performLocalFill(e.fieldName,e.value,e.sectionKey),n==="CLARA_CMD_ODONTO"){console.log("[Clara DOM] 🦷 Dispatching odontograma:command event with:",e.payload),window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload}));const s={type:"FROM_EXTENSION",fieldId:e.fieldId||"odontograma",payload:e.payload};console.log("[Clara DOM] 📤 Sending FROM_EXTENSION postMessage (local):",s),window.postMessage(s,"*");const r=document.getElementsByTagName("iframe");console.log(`[Clara DOM] 📤 Broadcasting FROM_EXTENSION to ${r.length} iframes:`,s);for(let o=0;o<r.length;o++)try{(a=r[o].contentWindow)==null||a.postMessage(s,"*"),console.log(`[Clara DOM] ✅ Sent FROM_EXTENSION to iframe ${o}`)}catch(l){console.log(`[Clara DOM] ❌ Failed to send to iframe ${o}:`,l)}}const i=document.getElementsByTagName("iframe");console.log(`[Clara DOM] 📤 Broadcasting ${n} to ${i.length} iframes:`,{type:n,...e}),broadcastToIframes({type:n,...e})}function setupFieldListeners(n,e=document){e.querySelectorAll("input, textarea, select").forEach(a=>{var l;const s=a;if((l=s.dataset)!=null&&l.claraListener)return;s.dataset.claraListener="true";const r=s.id||s.name;if(!r)return;const o=()=>{const u=s.closest("[data-section], [data-clara-section-key]");return u&&(u.dataset.section||u.dataset.claraSectionKey)||null};s.addEventListener("click",()=>{n({fieldId:r,action:"click",sectionKey:o()})}),s.addEventListener("focus",()=>{n({fieldId:r,action:"focus",sectionKey:o()})}),s.addEventListener("blur",()=>{const u=s.type==="checkbox"?s.checked:s.value;n({fieldId:r,action:"blur",value:u,sectionKey:o()})}),s.addEventListener("change",u=>{if(u.isTrusted){let c=s.value;if(s.type==="checkbox")c=s.checked;else if(s.type==="radio"&&!s.checked)return;n({fieldId:r,action:"change",value:c,sectionKey:o()})}})})}function setupSectionListeners(n,e=document){e.querySelectorAll("[data-section], fieldset").forEach(a=>{var r;const s=a;(r=s.dataset)!=null&&r.claraSectionListener||(s.dataset.claraSectionListener="true",s.dataset.section||s.id,s.addEventListener("click",o=>{const l=o.target;l===s||["LEGEND","H2","H3"].includes(l.tagName)}))})}function isInIframe(){try{return window!==window.top}catch{return!0}}function initClaraListener(){return window.__claraListenerActive?(console.log("[Clara Listener] Already active"),!0):(console.log("[Clara Listener] 🎧 Initializing on:",window.location.pathname),window.addEventListener("message",n=>{var i,a;const e=n.data;if(!(!e||typeof e!="object")&&(i=e.type)!=null&&i.startsWith("CLARA_")){if(console.log("[Clara Listener] 📨 Received:",e.type,e),e.type==="CLARA_CMD_FILL"){const s=performLocalFill(e.fieldName,e.value,e.sectionKey);console.log("[Clara Listener] Fill result:",s)}if(e.type==="CLARA_CMD_FILL_MULTIPLE"&&((a=e.fields)==null||a.forEach(s=>{performLocalFill(s.fieldId,s.value,s.sectionKey)})),e.type==="CLARA_CMD_ODONTO"){console.log("[Clara Listener] 🦷 Received CLARA_CMD_ODONTO, dispatching odontograma:command:",e.payload),window.dispatchEvent(new CustomEvent("odontograma:command",{detail:e.payload}));const s={type:"FROM_EXTENSION",fieldId:e.fieldId||"odontograma",payload:e.payload};console.log("[Clara Listener] 📤 Sending FROM_EXTENSION postMessage:",s),window.postMessage(s,"*")}}}),window.addEventListener("clara:fill",n=>{const{fieldId:e,value:i,sectionKey:a}=n.detail;console.log("[Clara Listener] 🎯 Custom event fill:",e,i),performLocalFill(e,i,a)}),window.addEventListener("clara:fill-multiple",n=>{const{fields:e}=n.detail;e==null||e.forEach(i=>{performLocalFill(i.fieldId,i.value,i.sectionKey)})}),window.__claraListenerActive=!0,console.log("[Clara Listener] ✅ Active and listening"),!0)}function sendFillCommand(n,e,i){console.log("[Clara Fill] 📤 Sending fill command:",n,e);const a=performLocalFill(n,e,i);if(a.success)return console.log("[Clara Fill] ✅ Direct fill succeeded"),a;try{window.dispatchEvent(new CustomEvent("clara:fill",{detail:{fieldId:n,value:e,sectionKey:i}}))}catch(s){console.warn("[Clara Fill] Custom event failed:",s)}try{window.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(s){console.warn("[Clara Fill] Self postMessage failed:",s)}if(broadcastToIframes({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i}),isInIframe())try{window.parent.postMessage({type:"CLARA_CMD_FILL",fieldName:n,value:e,sectionKey:i},"*")}catch(s){console.warn("[Clara Fill] Parent postMessage failed:",s)}return a}const CONDITIONS={hallazgo:[{id:"caries",label:"Caries",areaType:"surface"},{id:"resina_desadaptada",label:"Resina Desadaptada",areaType:"surface"},{id:"amalgama_desadaptada",label:"Amalgama Desadaptada",areaType:"surface"},{id:"linea_factura",label:"Línea Fractura",areaType:"surface"},{id:"obturacion_temporal",label:"Obturación Temporal",areaType:"surface"},{id:"fosas_fisuras_profundas",label:"Fosas/Fisuras Prof.",areaType:"surface"},{id:"resina_cervical",label:"Resina Cervical",areaType:"surface"},{id:"resto_radicular",label:"Resto Radicular",areaType:"whole"},{id:"ausente",label:"Ausente",areaType:"whole"},{id:"exodoncia",label:"Exodoncia Indicada",areaType:"whole"},{id:"corona",label:"Corona (Defectuosa)",areaType:"whole"},{id:"corona_provisional",label:"Corona Provisional",areaType:"whole"},{id:"carilla",label:"Carilla (Defectuosa)",areaType:"whole"},{id:"abrasion_erosion",label:"Abrasion/Erosion",areaType:"whole"},{id:"mov_grado_1",label:"Movilidad I",areaType:"whole"},{id:"mov_grado_2",label:"Movilidad II",areaType:"whole"},{id:"mov_grado_3",label:"Movilidad III",areaType:"whole"},{id:"sin_erupcionar",label:"Sin Erupcionar",areaType:"whole"},{id:"implante_afectado",label:"Implante Afectado",areaType:"whole"},{id:"supernumerario",label:"Supernumerario",areaType:"whole"}],hallazgo_realizado:[{id:"resina_adaptada",label:"Resina",areaType:"surface"},{id:"amalgama_adaptada",label:"Amalgama",areaType:"surface"},{id:"sellante",label:"Sellante",areaType:"surface"},{id:"tratamiento_realizado",label:"Tratamiento Gen.",areaType:"surface"},{id:"corona",label:"Corona",areaType:"whole"},{id:"carilla",label:"Carilla",areaType:"whole"},{id:"implante",label:"Implante",areaType:"whole"},{id:"endodoncia",label:"Endodoncia",areaType:"whole"},{id:"extraido",label:"Extraído (Qx)",areaType:"whole"}]};`${CONDITIONS.hallazgo.map(n=>n.id).join(", ")}${CONDITIONS.hallazgo_realizado.map(n=>n.id).join(", ")}`;const VALID_TOOTH_KEYS=["18","18SN","18SNRX","17","17SN","17SNRX","16","16SN","16SNRX","15","15SN","15SNRX","14","14SN","14SNRX","13","13SN","13SNRX","12","12SN","12SNRX","11","11SN","11SNRX","55","55SN","55SNRX","54","54SN","54SNRX","53","53SN","53SNRX","52","52SN","52SNRX","51","51SN","51SNRX","85","85SN","85SNRX","84","84SN","84SNRX","83","83SN","83SNRX","82","82SN","82SNRX","81","81SN","81SNRX","48","48SN","48SNRX","47","47SN","47SNRX","46","46SN","46SNRX","45","45SN","45SNRX","44","44SN","44SNRX","43","43SN","43SNRX","42","42SN","42SNRX","41","41SN","41SNRX","21","21SN","21SNRX","22","22SN","22SNRX","23","23SN","23SNRX","24","24SN","24SNRX","25","25SN","25SNRX","26","26SN","26SNRX","27","27SN","27SNRX","28","28SN","28SNRX","61","61SN","61SNRX","62","62SN","62SNRX","63","63SN","63SNRX","64","64SN","64SNRX","65","65SN","65SNRX","71","71SN","71SNRX","72","72SN","72SNRX","73","73SN","73SNRX","74","74SN","74SNRX","75","75SN","75SNRX","31","31SN","31SNRX","32","32SN","32SNRX","33","33SN","33SNRX","34","34SN","34SNRX","35","35SN","35SNRX","36","36SN","36SNRX","37","37SN","37SNRX","38","38SN","38SNRX"],VALID_TYPES=["clear","hallazgo","hallazgo_realizado"],VALID_ACTIONS_BY_TYPE_AND_AREA={hallazgo:[["ok","corona","corona_provisional","carilla","resto_radicular","abrasion_erosion","implante_afectado","endodoncia","exodoncia","ausente","sin_erupcionar","exodoncia_qx","mov_grado_1","mov_grado_2","mov_grado_3","pulido","radiografia","supernumerario","supernumerario_rx","parcialmente_erupcionado_o_impactado"],["resina_cervical"],["resina_cervical"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_mesial"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_distal"],["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"]],hallazgo_realizado:[["corona","carilla","implante","endodoncia","extraido","ausente","sin_erupcionar","parcialmente_erupcionado_o_impactado"],["resina_cervical"],["resina_cervical"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_mesial"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_distal"],["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"]]},validateOdontogramAction=n=>{var o;const{key:e,type:i,area:a,action:s}=n;if(!VALID_TOOTH_KEYS.includes(e))return{valid:!1,error:`Invalid tooth key: ${e}`};if(!VALID_TYPES.includes(i))return{valid:!1,error:`Invalid type: ${i}. Must be one of: ${VALID_TYPES.join(", ")}`};if(i==="clear")return{valid:!0};if(typeof a!="number"||a<0||a>7)return{valid:!1,error:`Invalid area: ${a}. Must be 0-7`};const r=(o=VALID_ACTIONS_BY_TYPE_AND_AREA[i])==null?void 0:o[a];return r?r.includes(s)?{valid:!0}:{valid:!1,error:`Invalid action "${s}" for type "${i}" area ${a}. Valid: ${r.join(", ")}`}:{valid:!1,error:`No valid actions for type ${i} and area ${a}`}},surfaceToArea$1=n=>{if(!n)return 0;switch(n.toLowerCase()){case"whole":case"completo":return 0;case"vestibular":case"bucal":case"top":return 1;case"lingual":case"palatal":case"palatino":case"bottom":return 2;case"mesial":case"left":return 4;case"distal":case"right":return 6;case"oclusal":case"incisal":case"center":return 7;default:return 7}},ClaraChat=({primaryColor:n})=>{const{config:e,currentAnalysis:i,chatMessages:a,addChatMessage:s,clearChatMessages:r,analysisStreamInfo:o,currentTemplate:l,formData:u,updateFormData:c}=useClaraStore(),d=e.lang||"es",[p,f]=React.useState(""),[m,P]=React.useState(!1),[T,x]=React.useState(!1),[y,S]=React.useState([]),[g,C]=React.useState(!1),E=React.useRef(null),B=React.useRef(null),_=React.useRef(null),M=React.useRef([]);React.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[a,m,y]),React.useEffect(()=>{const I=V=>{V.target.closest(".actions-menu-container")||x(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]),React.useEffect(()=>{if(!(i!=null&&i.id)||a.length===0)return;const V=setTimeout(async()=>{try{const A=a.map(k=>({id:k.id||Date.now().toString(),role:k.role,text:k.content}));await claraApi.syncChatHistory(i.id,A),console.log("[ClaraChat] Chat history synced:",A.length,"messages")}catch(A){console.error("[ClaraChat] Failed to sync chat history:",A)}},2e3);return()=>clearTimeout(V)},[a,i==null?void 0:i.id]);const D=async I=>{if(I.target.files&&I.target.files.length>0){const V=I.target.files[0],A=new FileReader;A.onload=()=>{const k=A.result.split(",")[1],R=V.type.startsWith("image/"),G=V.type==="application/pdf";if(!R&&!G)return;const z={id:Date.now().toString(),file:V,base64:k,type:G?"pdf":"image",previewUrl:R?URL.createObjectURL(V):void 0};S(q=>[...q,z])},A.readAsDataURL(V)}B.current&&(B.current.value="")},L=I=>{S(V=>V.filter(A=>A.id!==I))},N=async()=>{try{const I=await navigator.mediaDevices.getUserMedia({audio:!0}),V=new MediaRecorder(I);_.current=V,M.current=[],V.ondataavailable=A=>{A.data.size>0&&M.current.push(A.data)},V.start(),C(!0)}catch(I){console.error("Error accessing microphone:",I),s({role:"model",content:"No se pudo acceder al micrófono.",timestamp:new Date})}},F=()=>{_.current&&g&&(_.current.stop(),_.current.onstop=async()=>{var A;const I=new Blob(M.current,{type:"audio/webm"}),V=new FileReader;V.onloadend=()=>{const k=V.result.split(",")[1];H("",[{id:Date.now().toString(),file:new File([I],"voice_note.webm",{type:"audio/webm"}),base64:k,type:"audio"}])},V.readAsDataURL(I),(A=_.current)==null||A.stream.getTracks().forEach(k=>k.stop()),C(!1)})},H=async(I,V)=>{var z,q,U,K,Q,ne,Ee;const A=I!==void 0?I:p,k=V||y;if(!A.trim()&&k.length===0)return;let R=A;if(!R){const ye=k.some(oe=>oe.type==="audio"),ge=k.some(oe=>oe.type==="image"),xe=k.some(oe=>oe.type==="pdf");ye?R="🎤 Nota de voz enviada":ge?R="📷 Imagen enviada para análisis":xe&&(R="📄 Documento PDF enviado")}s({role:"user",content:R,timestamp:new Date}),f(""),S([]),P(!0),x(!1);try{o&&await sendChatToS2(o,[{role:"user",text:A||R,timestamp:new Date().toISOString(),id:Date.now().toString()}],"chat");let ye=ephemeralTokenManager.getToken();if(ye||await ephemeralTokenManager.initialize()&&(ye=ephemeralTokenManager.getToken()),!ye)throw new Error("No Gemini API key available");const ge=new GoogleGenAI({apiKey:ye}),xe={name:"updateReport",description:"Updates medical report fields based on user instructions or visual analysis.",parameters:{type:Type.OBJECT,properties:{updates:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{fieldId:{type:Type.STRING},value:{type:Type.STRING},reason:{type:Type.STRING}},required:["fieldId","value"]}}},required:["updates"]}},oe={name:"updateOdontogram",description:"Updates dental odontogram with findings or treatments. Use FDI tooth numbering (11-18, 21-28, 31-38, 41-48, 51-55, 61-65, 71-75, 81-85).",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"FDI tooth number"},type:{type:Type.STRING,description:"hallazgo or hallazgo_realizado"},condition:{type:Type.STRING,description:"Condition/treatment name"},surface:{type:Type.STRING,description:"Optional: vestibular, lingual, mesial, distal, oclusal, whole"}},required:["tooth","type","condition"]}}},required:["actions"]}};let Y="";(z=l==null?void 0:l.structure)!=null&&z.sections&&(Y=l.structure.sections.map(fe=>{var pe;const ke=((pe=fe.fields)==null?void 0:pe.map(Re=>` - ${Re.id} (${Re.type}): ${Re.label}${Re.options?` [opciones: ${Re.options.join(", ")}]`:""}`).join(`
|
|
305
305
|
`))||"";return`**${fe.label}** (key: ${fe.key})
|
|
306
306
|
${ke}`}).join(`
|
|
307
307
|
|
|
308
|
-
`));const
|
|
308
|
+
`));const Fe=JSON.stringify(u,null,2),Le=`
|
|
309
309
|
Eres Clara, una asistente médica experta con **CAPACIDADES MULTIMODALES (VISIÓN Y AUDIO)**.
|
|
310
310
|
${d==="en"?"Respond strictly in English.":"Responde estrictamente en español."}
|
|
311
311
|
|
|
312
312
|
CONTEXTO DEL PACIENTE (DATOS ACTUALES):
|
|
313
|
-
${
|
|
313
|
+
${Fe}
|
|
314
314
|
|
|
315
315
|
CAMPOS DEL FORMULARIO DISPONIBLES:
|
|
316
316
|
${Y}
|
|
@@ -344,7 +344,7 @@ ${I.join(`
|
|
|
344
344
|
`),V.length>0&&(k+=`**Datos Clínicos:**
|
|
345
345
|
${V.slice(0,10).join(`
|
|
346
346
|
`)}`,V.length>10&&(k+=`
|
|
347
|
-
... y ${V.length-10} campos más`)),k},b=[{id:"soap",label:t("chat.generateSoap",d),icon:"📋",action:()=>{x(!1),s({role:"user",content:"Genera un reporte SOAP",timestamp:new Date}),P(!0),setTimeout(()=>{const I=$();s({role:"model",content:I,timestamp:new Date}),P(!1)},500)}},{id:"summary",label:t("chat.summarize",d),icon:"📄",action:()=>{x(!1),s({role:"user",content:"Resume la consulta",timestamp:new Date}),P(!0),setTimeout(()=>{const I=O();s({role:"model",content:I,timestamp:new Date}),P(!1)},500)}},{id:"clear",label:t("chat.clear",d),icon:"🗑️",action:()=>{r(),x(!1)}}];return jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-clara-surface relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",ref:E,children:[a.length===0&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsx("div",{className:"max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed text-white rounded-bl-none",style:{backgroundColor:n},children:t("chat.welcome",d)})}),a.map((I,V)=>jsxRuntime.jsx("div",{className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed ${I.role==="user"?"text-white rounded-br-none":"bg-card text-foreground border border-border rounded-bl-none"}`,style:I.role==="user"?{backgroundColor:n}:{},children:I.role==="model"?jsxRuntime.jsx("div",{className:"whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:I.content.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\n- /g,"<br/>• ").replace(/\n/g,"<br/>")}}):I.content})},V)),m&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsxs("div",{className:"bg-card border border-border p-3 rounded-2xl rounded-bl-none shadow-sm flex items-center gap-1",children:[jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:75ms]"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:150ms]"}),jsxRuntime.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t("chat.thinking",d)})]})})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2 bg-card border-t border-border w-full z-20",children:[y.length>0&&jsxRuntime.jsx("div",{className:"flex gap-2 mb-2 overflow-x-auto pb-2",children:y.map(I=>jsxRuntime.jsxs("div",{className:"relative group flex-shrink-0",children:[jsxRuntime.jsxs("div",{className:"w-16 h-16 rounded-lg border border-border bg-secondary flex flex-col items-center justify-center overflow-hidden",children:[I.type==="image"&&I.previewUrl?jsxRuntime.jsx("img",{src:I.previewUrl,alt:"preview",className:"w-full h-full object-cover"}):jsxRuntime.jsx("span",{className:"text-2xl",children:I.type==="pdf"?"📄":"🎤"}),I.type==="pdf"&&jsxRuntime.jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full px-1 text-center",children:I.file.name})]}),jsxRuntime.jsx("button",{onClick:()=>L(I.id),className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full w-4 h-4 flex items-center justify-center text-[10px] shadow-sm hover:brightness-110",children:jsxRuntime.jsx(X,{className:"w-2.5 h-2.5"})})]},I.id))}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 relative",children:[jsxRuntime.jsxs("div",{className:"relative actions-menu-container",children:[jsxRuntime.jsx(AnimatePresence,{children:T&&jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-full mb-2 left-0 w-48 bg-card rounded-xl shadow-xl border border-border overflow-hidden",children:jsxRuntime.jsx("div",{className:"p-1",children:b.map(I=>jsxRuntime.jsxs("button",{onClick:()=>I.action(),className:"w-full text-left px-3 py-2 text-sm hover:bg-secondary text-foreground rounded-lg flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx("span",{children:I.icon}),I.label]},I.id))})})}),jsxRuntime.jsx("button",{onClick:()=>x(!T),className:`h-11 w-11 flex items-center justify-center rounded-xl transition-colors ${T?"bg-accent text-accent-foreground":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Acciones rápidas",children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})})]}),jsxRuntime.jsx("input",{type:"file",ref:B,className:"hidden",accept:"image/*,application/pdf",onChange:D}),jsxRuntime.jsx("button",{onClick:()=>{var I;return(I=B.current)==null?void 0:I.click()},className:"h-11 w-11 flex items-center justify-center bg-secondary text-muted-foreground rounded-xl hover:bg-secondary/80 transition-colors",title:"Adjuntar imagen o PDF",children:jsxRuntime.jsx(Paperclip,{className:"w-5 h-5"})}),jsxRuntime.jsx("input",{type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:I=>I.key==="Enter"&&H(),placeholder:t("chat.placeholder",d),disabled:g,className:"flex-1 h-11 py-2.5 px-4 bg-secondary border-transparent focus:bg-card focus:border-ring focus:ring-2 focus:ring-ring/20 rounded-xl text-sm transition-all outline-none text-foreground placeholder-muted-foreground"}),p.trim()||y.length>0?jsxRuntime.jsx("button",{onClick:()=>H(),disabled:m,className:"h-11 w-11 text-white rounded-xl hover:brightness-110 transition-colors shadow-md disabled:opacity-50 flex items-center justify-center",style:{backgroundColor:n},children:jsxRuntime.jsx(Send,{className:"w-5 h-5"})}):jsxRuntime.jsx("button",{onMouseDown:F,onMouseUp:N,onTouchStart:F,onTouchEnd:N,className:`h-11 w-11 rounded-xl transition-all shadow-md flex items-center justify-center ${g?"bg-destructive text-destructive-foreground scale-110 ring-4 ring-destructive/30":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Mantén presionado para hablar",children:g?jsxRuntime.jsx("div",{className:"w-5 h-5 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-2 h-2 bg-white rounded-full animate-ping"})}):jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})})]})]})]})},getApiKey=async()=>{let n=ephemeralTokenManager.getToken();return n||await ephemeralTokenManager.initialize()&&(n=ephemeralTokenManager.getToken()),n||(console.error("[TemplateGenerator] No Gemini token available"),null)};function extractFormElementsFromDocument(n,e=""){const i=[],a=[];try{const s=["input","select","textarea",'[contenteditable="true"]','[role="textbox"]','[role="combobox"]','[role="listbox"]','[role="checkbox"]','[role="radio"]',"[data-field]","[data-input]",'[class*="input"]','[class*="field"]','[class*="form-control"]','[class*="campo"]','[class*="MuiInput"]','[class*="MuiSelect"]','[class*="MuiTextField"]','[class*="ant-input"]','[class*="ant-select"]'].join(", "),r=n.querySelectorAll(s),o=n.querySelectorAll('label, [class*="label"], [class*="Label"]'),l=new Map;o.forEach(f=>{var T;const m=f.htmlFor,P=((T=f.textContent)==null?void 0:T.trim())||"";m&&P&&l.set(m,P)});const u=new Set;r.forEach(f=>{var _,M;const m=f.tagName.toLowerCase();let P=f.id||"";const T=f.name||"",x=f.type||f.getAttribute("type")||m,y=f.placeholder||f.getAttribute("placeholder")||"",S=f.getAttribute("data-field")||f.getAttribute("data-name")||"";if(x==="hidden"||x==="submit"||x==="button"||x==="reset"||(!P&&T&&(P=T),!P&&S&&(P=S),!P||u.has(P)))return;u.add(P);let g=l.get(P)||"";if(g||(g=f.getAttribute("aria-label")||""),g||(g=f.getAttribute("title")||""),g||(g=y),!g){const D=f.closest("div, td, li, span, p, .form-group, .field-wrapper");if(D){const L=D.querySelector('label, span.label, .field-label, [class*="label"]');L&&L!==f&&(g=((_=L.textContent)==null?void 0:_.trim())||"")}}if(!g){const D=f.previousElementSibling;D&&(D.tagName==="LABEL"||D.classList.contains("label"))&&(g=((M=D.textContent)==null?void 0:M.trim())||"")}let C="text";m==="select"||f.getAttribute("role")==="combobox"||f.getAttribute("role")==="listbox"?C="select":m==="textarea"||f.getAttribute("role")==="textbox"?C="textarea":(x==="checkbox"||f.getAttribute("role")==="checkbox"||x==="radio"||f.getAttribute("role")==="radio")&&(C="checkbox");let E=[];if(m==="select"){const D=f.options;E=Array.from(D).map(L=>{var F;return((F=L.textContent)==null?void 0:F.trim())||L.value}).filter(Boolean)}const B=E.length>0?` options=[${E.slice(0,20).join("|")}]`:"";i.push(`${e}${C.toUpperCase()}[id="${P}" label="${g}"${B}]`)}),n.querySelectorAll('[id*="campo"], [id*="input"], [id*="field"], [id*="pl_"], [id*="txt"], [id*="sel"], [id*="chk"]').forEach(f=>{var x;const m=f.id;if(!m||u.has(m))return;const P=f.tagName.toLowerCase();if(!["input","select","textarea"].includes(P)&&!f.hasAttribute("contenteditable")&&!f.getAttribute("role"))return;u.add(m);let T=f.getAttribute("aria-label")||f.getAttribute("title")||"";if(!T){const y=f.closest("div, td");if(y){const S=y.querySelector("label");S&&(T=((x=S.textContent)==null?void 0:x.trim())||"")}}i.push(`TEXT[id="${m}" label="${T}"]`)}),n.querySelectorAll('h1, h2, h3, h4, h5, h6, legend, .section-title, .section-header, [class*="section"], [class*="header"], [class*="titulo"], [class*="seccion"]').forEach(f=>{var P;const m=(P=f.textContent)==null?void 0:P.trim();m&&m.length>2&&m.length<150&&(a.includes(m)||a.push(m))}),n.querySelectorAll("fieldset").forEach(f=>{var P;const m=f.querySelector("legend");if(m){const T=(P=m.textContent)==null?void 0:P.trim();T&&!a.includes(T)&&a.push(T)}})}catch(s){console.error("[TemplateGenerator] Error extracting from document:",s)}return{formData:i,sectionHints:a}}function extractFormInputsFromHTML(){const n=[],e=[];try{const i=extractFormElementsFromDocument(document,"");n.push(...i.formData),e.push(...i.sectionHints),document.querySelectorAll("iframe").forEach((s,r)=>{var o;try{const l=s.contentDocument||((o=s.contentWindow)==null?void 0:o.document);if(l){const u=extractFormElementsFromDocument(l,`[iframe-${r}] `);n.push(...u.formData),e.push(...u.sectionHints)}}catch{console.log(`[TemplateGenerator] Cannot access iframe ${r} (cross-origin)`)}});try{if(window.parent!==window){const s=window.parent.document,r=extractFormElementsFromDocument(s,"[parent] ");n.push(...r.formData),e.push(...r.sectionHints)}}catch{}return console.log(`[TemplateGenerator] Total extracted: ${n.length} fields, ${e.length} section hints`),`
|
|
347
|
+
... y ${V.length-10} campos más`)),k},b=[{id:"soap",label:t("chat.generateSoap",d),icon:"📋",action:()=>{x(!1),s({role:"user",content:"Genera un reporte SOAP",timestamp:new Date}),P(!0),setTimeout(()=>{const I=$();s({role:"model",content:I,timestamp:new Date}),P(!1)},500)}},{id:"summary",label:t("chat.summarize",d),icon:"📄",action:()=>{x(!1),s({role:"user",content:"Resume la consulta",timestamp:new Date}),P(!0),setTimeout(()=>{const I=O();s({role:"model",content:I,timestamp:new Date}),P(!1)},500)}},{id:"clear",label:t("chat.clear",d),icon:"🗑️",action:()=>{r(),x(!1)}}];return jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-clara-surface relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",ref:E,children:[a.length===0&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsx("div",{className:"max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed text-white rounded-bl-none",style:{backgroundColor:n},children:t("chat.welcome",d)})}),a.map((I,V)=>jsxRuntime.jsx("div",{className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] p-3 rounded-2xl text-sm shadow-sm leading-relaxed ${I.role==="user"?"text-white rounded-br-none":"bg-card text-foreground border border-border rounded-bl-none"}`,style:I.role==="user"?{backgroundColor:n}:{},children:I.role==="model"?jsxRuntime.jsx("div",{className:"whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:I.content.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\n- /g,"<br/>• ").replace(/\n/g,"<br/>")}}):I.content})},V)),m&&jsxRuntime.jsx("div",{className:"flex justify-start",children:jsxRuntime.jsxs("div",{className:"bg-card border border-border p-3 rounded-2xl rounded-bl-none shadow-sm flex items-center gap-1",children:[jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:75ms]"}),jsxRuntime.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground rounded-full animate-bounce [animation-delay:150ms]"}),jsxRuntime.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t("chat.thinking",d)})]})})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2 bg-card border-t border-border w-full z-20",children:[y.length>0&&jsxRuntime.jsx("div",{className:"flex gap-2 mb-2 overflow-x-auto pb-2",children:y.map(I=>jsxRuntime.jsxs("div",{className:"relative group flex-shrink-0",children:[jsxRuntime.jsxs("div",{className:"w-16 h-16 rounded-lg border border-border bg-secondary flex flex-col items-center justify-center overflow-hidden",children:[I.type==="image"&&I.previewUrl?jsxRuntime.jsx("img",{src:I.previewUrl,alt:"preview",className:"w-full h-full object-cover"}):jsxRuntime.jsx("span",{className:"text-2xl",children:I.type==="pdf"?"📄":"🎤"}),I.type==="pdf"&&jsxRuntime.jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full px-1 text-center",children:I.file.name})]}),jsxRuntime.jsx("button",{onClick:()=>L(I.id),className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full w-4 h-4 flex items-center justify-center text-[10px] shadow-sm hover:brightness-110",children:jsxRuntime.jsx(X,{className:"w-2.5 h-2.5"})})]},I.id))}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 relative",children:[jsxRuntime.jsxs("div",{className:"relative actions-menu-container",children:[jsxRuntime.jsx(AnimatePresence,{children:T&&jsxRuntime.jsx(motion.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},className:"absolute bottom-full mb-2 left-0 w-48 bg-card rounded-xl shadow-xl border border-border overflow-hidden",children:jsxRuntime.jsx("div",{className:"p-1",children:b.map(I=>jsxRuntime.jsxs("button",{onClick:()=>I.action(),className:"w-full text-left px-3 py-2 text-sm hover:bg-secondary text-foreground rounded-lg flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx("span",{children:I.icon}),I.label]},I.id))})})}),jsxRuntime.jsx("button",{onClick:()=>x(!T),className:`h-11 w-11 flex items-center justify-center rounded-xl transition-colors ${T?"bg-accent text-accent-foreground":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Acciones rápidas",children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})})]}),jsxRuntime.jsx("input",{type:"file",ref:B,className:"hidden",accept:"image/*,application/pdf",onChange:D}),jsxRuntime.jsx("button",{onClick:()=>{var I;return(I=B.current)==null?void 0:I.click()},className:"h-11 w-11 flex items-center justify-center bg-secondary text-muted-foreground rounded-xl hover:bg-secondary/80 transition-colors",title:"Adjuntar imagen o PDF",children:jsxRuntime.jsx(Paperclip,{className:"w-5 h-5"})}),jsxRuntime.jsx("input",{type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:I=>I.key==="Enter"&&H(),placeholder:t("chat.placeholder",d),disabled:g,className:"flex-1 h-11 py-2.5 px-4 bg-secondary border-transparent focus:bg-card focus:border-ring focus:ring-2 focus:ring-ring/20 rounded-xl text-sm transition-all outline-none text-foreground placeholder-muted-foreground"}),p.trim()||y.length>0?jsxRuntime.jsx("button",{onClick:()=>H(),disabled:m,className:"h-11 w-11 text-white rounded-xl hover:brightness-110 transition-colors shadow-md disabled:opacity-50 flex items-center justify-center",style:{backgroundColor:n},children:jsxRuntime.jsx(Send,{className:"w-5 h-5"})}):jsxRuntime.jsx("button",{onMouseDown:N,onMouseUp:F,onTouchStart:N,onTouchEnd:F,className:`h-11 w-11 rounded-xl transition-all shadow-md flex items-center justify-center ${g?"bg-destructive text-destructive-foreground scale-110 ring-4 ring-destructive/30":"bg-secondary text-muted-foreground hover:bg-secondary/80"}`,title:"Mantén presionado para hablar",children:g?jsxRuntime.jsx("div",{className:"w-5 h-5 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-2 h-2 bg-white rounded-full animate-ping"})}):jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})})]})]})]})},getApiKey=async()=>{let n=ephemeralTokenManager.getToken();return n||await ephemeralTokenManager.initialize()&&(n=ephemeralTokenManager.getToken()),n||(console.error("[TemplateGenerator] No Gemini token available"),null)};function extractFormElementsFromDocument(n,e=""){const i=[],a=[];try{const s=["input","select","textarea",'[contenteditable="true"]','[role="textbox"]','[role="combobox"]','[role="listbox"]','[role="checkbox"]','[role="radio"]',"[data-field]","[data-input]",'[class*="input"]','[class*="field"]','[class*="form-control"]','[class*="campo"]','[class*="MuiInput"]','[class*="MuiSelect"]','[class*="MuiTextField"]','[class*="ant-input"]','[class*="ant-select"]'].join(", "),r=n.querySelectorAll(s),o=n.querySelectorAll('label, [class*="label"], [class*="Label"]'),l=new Map;o.forEach(f=>{var T;const m=f.htmlFor,P=((T=f.textContent)==null?void 0:T.trim())||"";m&&P&&l.set(m,P)});const u=new Set;r.forEach(f=>{var _,M;const m=f.tagName.toLowerCase();let P=f.id||"";const T=f.name||"",x=f.type||f.getAttribute("type")||m,y=f.placeholder||f.getAttribute("placeholder")||"",S=f.getAttribute("data-field")||f.getAttribute("data-name")||"";if(x==="hidden"||x==="submit"||x==="button"||x==="reset"||(!P&&T&&(P=T),!P&&S&&(P=S),!P||u.has(P)))return;u.add(P);let g=l.get(P)||"";if(g||(g=f.getAttribute("aria-label")||""),g||(g=f.getAttribute("title")||""),g||(g=y),!g){const D=f.closest("div, td, li, span, p, .form-group, .field-wrapper");if(D){const L=D.querySelector('label, span.label, .field-label, [class*="label"]');L&&L!==f&&(g=((_=L.textContent)==null?void 0:_.trim())||"")}}if(!g){const D=f.previousElementSibling;D&&(D.tagName==="LABEL"||D.classList.contains("label"))&&(g=((M=D.textContent)==null?void 0:M.trim())||"")}let C="text";m==="select"||f.getAttribute("role")==="combobox"||f.getAttribute("role")==="listbox"?C="select":m==="textarea"||f.getAttribute("role")==="textbox"?C="textarea":(x==="checkbox"||f.getAttribute("role")==="checkbox"||x==="radio"||f.getAttribute("role")==="radio")&&(C="checkbox");let E=[];if(m==="select"){const D=f.options;E=Array.from(D).map(L=>{var N;return((N=L.textContent)==null?void 0:N.trim())||L.value}).filter(Boolean)}const B=E.length>0?` options=[${E.slice(0,20).join("|")}]`:"";i.push(`${e}${C.toUpperCase()}[id="${P}" label="${g}"${B}]`)}),n.querySelectorAll('[id*="campo"], [id*="input"], [id*="field"], [id*="pl_"], [id*="txt"], [id*="sel"], [id*="chk"]').forEach(f=>{var x;const m=f.id;if(!m||u.has(m))return;const P=f.tagName.toLowerCase();if(!["input","select","textarea"].includes(P)&&!f.hasAttribute("contenteditable")&&!f.getAttribute("role"))return;u.add(m);let T=f.getAttribute("aria-label")||f.getAttribute("title")||"";if(!T){const y=f.closest("div, td");if(y){const S=y.querySelector("label");S&&(T=((x=S.textContent)==null?void 0:x.trim())||"")}}i.push(`TEXT[id="${m}" label="${T}"]`)}),n.querySelectorAll('h1, h2, h3, h4, h5, h6, legend, .section-title, .section-header, [class*="section"], [class*="header"], [class*="titulo"], [class*="seccion"]').forEach(f=>{var P;const m=(P=f.textContent)==null?void 0:P.trim();m&&m.length>2&&m.length<150&&(a.includes(m)||a.push(m))}),n.querySelectorAll("fieldset").forEach(f=>{var P;const m=f.querySelector("legend");if(m){const T=(P=m.textContent)==null?void 0:P.trim();T&&!a.includes(T)&&a.push(T)}})}catch(s){console.error("[TemplateGenerator] Error extracting from document:",s)}return{formData:i,sectionHints:a}}function extractFormInputsFromHTML(){const n=[],e=[];try{const i=extractFormElementsFromDocument(document,"");n.push(...i.formData),e.push(...i.sectionHints),document.querySelectorAll("iframe").forEach((s,r)=>{var o;try{const l=s.contentDocument||((o=s.contentWindow)==null?void 0:o.document);if(l){const u=extractFormElementsFromDocument(l,`[iframe-${r}] `);n.push(...u.formData),e.push(...u.sectionHints)}}catch{console.log(`[TemplateGenerator] Cannot access iframe ${r} (cross-origin)`)}});try{if(window.parent!==window){const s=window.parent.document,r=extractFormElementsFromDocument(s,"[parent] ");n.push(...r.formData),e.push(...r.sectionHints)}}catch{}return console.log(`[TemplateGenerator] Total extracted: ${n.length} fields, ${e.length} section hints`),`
|
|
348
348
|
DETECTED FORM ELEMENTS (${n.length} campos encontrados):
|
|
349
349
|
${n.join(`
|
|
350
350
|
`)}
|
|
@@ -404,7 +404,7 @@ INSTRUCCIONES:
|
|
|
404
404
|
|
|
405
405
|
GENERA EL JSON:`;n({phase:"generating",percentage:50,message:"Generando template completo con IA..."});const d=(await o.models.generateContent({model:"gemini-2.5-pro",contents:l+`
|
|
406
406
|
|
|
407
|
-
`+u,config:{temperature:.2,maxOutputTokens:16384}})).text||"";console.log("[TemplateGenerator] AI Response length:",d.length),console.log("[TemplateGenerator] AI Response:",d),n({phase:"generating",percentage:70,message:"Procesando respuesta..."});let p=null;if(p=(g=>{try{return JSON.parse(g)}catch{}const C=g.match(/```(?:json)?\s*([\s\S]*?)\s*```/);if(C&&C[1])try{return JSON.parse(C[1].trim())}catch{}const E=g.indexOf("{");if(E!==-1){let B=g.slice(E),_=0,M=0,D=!1,L=!1;for(let F=0;F<B.length;F++){const N=B[F];if(L){L=!1;continue}if(N==="\\"){L=!0;continue}if(N==='"'){D=!D;continue}D||(N==="{"&&_++,N==="}"&&_--,N==="["&&M++,N==="]"&&M--)}D&&(B+='"'),B=B.replace(/,\s*"[^"]*":\s*"[^"]*$/,"").replace(/,\s*"[^"]*":\s*$/,"").replace(/,\s*"[^"]*$/,"").replace(/,\s*\{[^}]*$/,"").replace(/,\s*$/,""),B+="]".repeat(Math.max(0,M)),B+="}".repeat(Math.max(0,_)),B=B.replace(/,\s*}/g,"}").replace(/,\s*]/g,"]");try{return JSON.parse(B)}catch(F){console.warn("[TemplateGenerator] JSON repair failed:",F)}}return null})(d),!p)throw console.error("[TemplateGenerator] All JSON extraction strategies failed"),new Error("No se pudo parsear la respuesta de la IA. El JSON estaba incompleto o malformado.");console.log("[TemplateGenerator] Parsed response:",p);const m=((e=p.structure)==null?void 0:e.sections)||p.sections||[],P=p.name||p.templateName||p.formName||"Template Generado",T=p.description||p.templateDescription||"Generado automáticamente",x=m.map(g=>{var C;return{key:g.key||((C=g.label)==null?void 0:C.toLowerCase().replace(/\s+/g,"_"))||"section",label:g.label||"Sección",enabled:g.enabled!==!1,fields:(g.fields||[]).map(E=>({id:E.id||E.htmlFieldId,htmlFieldId:E.htmlFieldId||E.id,label:E.label||E.id||"Campo",type:E.type||"text",...E.options&&{options:E.options}}))}}),y=x.reduce((g,C)=>{var E;return g+(((E=C.fields)==null?void 0:E.length)||0)},0),S={name:P,description:T,structure:{sections:x}};return console.log("[TemplateGenerator] Final template:",{name:S.name,sectionsCount:S.structure.sections.length,fieldsCount:y}),n({phase:"complete",percentage:100,message:`Template generado: ${S.structure.sections.length} secciones, ${y} campos`}),S}catch(i){return console.error("[TemplateGenerator] Error:",i),n({phase:"error",percentage:0,message:i instanceof Error?i.message:"Error desconocido"}),null}}const DEMO_TEMPLATE_IDS={audiometria:"a0785251-eb3a-4d6c-8224-10a8c6acfd12",odontologia:"fe2085fd-5f19-44e9-b04c-92e0f0ab7769"},API_BASE_URL="https://ncifcjxnmyjfracfzwrl.supabase.co/functions/v1/api";let demoTemplatesCache={};function isValidApiKey(n){return!!n&&n.length>=20}function getAuthHeaders(n,e){const i={"Content-Type":"application/json"};if(isValidApiKey(n))i["X-API-Key"]=n;else if(e&&e.length>20)i.Authorization=`Bearer ${e}`;else if(isValidApiKey(claraApi.getApiKey()))i["X-API-Key"]=claraApi.getApiKey();else if(claraApi.getAccessToken()&&claraApi.getAccessToken().length>20)i.Authorization=`Bearer ${claraApi.getAccessToken()}`;else return null;return i}async function fetchTemplateById(n,e,i){try{const a=getAuthHeaders(e,i);if(!a)return console.log("[DemoTemplates] No valid authentication available, skipping fetch"),null;const s=`${API_BASE_URL}/templates`;console.log("[DemoTemplates] Fetching templates to find:",n);const r=await fetch(s,{method:"GET",headers:a});if(!r.ok)return console.error("[DemoTemplates] Failed to fetch templates:",r.status),null;const o=await r.json(),u=(o.data||o).find(c=>c.id===n);return u?(console.log("[DemoTemplates] Found template:",u.name),u):(console.warn("[DemoTemplates] Template not found:",n),null)}catch(a){return console.error("[DemoTemplates] Error fetching template:",a),null}}async function getDemoTemplate(n,e,i){if(demoTemplatesCache[n])return console.log("[DemoTemplates] Returning cached template:",n),demoTemplatesCache[n];const a=DEMO_TEMPLATE_IDS[n],s=await fetchTemplateById(a,e,i);return s&&(demoTemplatesCache[n]=s,console.log("[DemoTemplates] Cached template:",n,s.name)),s}function dispatchClaraEvent(n,e){console.log(`[Clara Event] ${n}`,e),window.dispatchEvent(new CustomEvent(n,{detail:e}))}function emitFieldFilled(n,e,i){dispatchClaraEvent("clara:field-filled",{fieldName:n,value:e,sectionKey:i,timestamp:new Date().toISOString()})}function emitFormDataUpdated(n,e,i){dispatchClaraEvent("clara:formdata-updated",{formData:{...n},changedField:e,changedFields:i,timestamp:new Date().toISOString()})}function emitTranscriptUpdated(n,e,i){dispatchClaraEvent("clara:transcript-updated",{role:n,content:e,messages:i,timestamp:new Date().toISOString()})}function emitTitleUpdated(n,e){dispatchClaraEvent("clara:title-updated",{title:n,analysisId:e,timestamp:new Date().toISOString()})}function emitTemplateChanged(n,e,i){dispatchClaraEvent("clara:template-changed",{templateId:n,templateName:e,sections:i,timestamp:new Date().toISOString()})}function emitSessionStarted(n){dispatchClaraEvent("clara:session-started",{analysisId:n,timestamp:new Date().toISOString()})}function emitOdontogramCleared(n,e){dispatchClaraEvent("clara:odontogram-cleared",{fieldId:n,teeth:e,timestamp:new Date().toISOString()})}function emitOdontogramUpdated(n,e){dispatchClaraEvent("clara:odontogram-updated",{fieldId:n,teeth:e,timestamp:new Date().toISOString()})}function emitSessionStopped(n){dispatchClaraEvent("clara:session-stopped",{analysisId:n,timestamp:new Date().toISOString()})}const ClaraDashboard=({onStartSession:n,onLogout:e,primaryColor:i})=>{const{config:a,accessToken:s,templates:r,currentTemplate:o,formData:l,userProfile:u,remoteSessionActive:c,remoteSessionInfo:d,setTemplates:p,setCurrentTemplate:f,setUserProfile:m}=useClaraStore(),P=a.lang||"es",T=!!a.templateId,[x,y]=React.useState("consulta"),[S,g]=React.useState(!1),[C,E]=React.useState(!1),[B,_]=React.useState(!1),[M,D]=React.useState(!1),[L,F]=React.useState(!1),[N,H]=React.useState(null),[$,O]=React.useState(null);o!=null&&o.name||a.templateId||t("dashboard.selectTemplate",P),React.useEffect(()=>{(async()=>{var R,G,z,q;if(!claraApi.hasAuth())if(a.apiKey)claraApi.setApiKey(a.apiKey);else if(s)claraApi.setAccessToken(s);else{console.log("[Dashboard] No auth available, loading demo template from API"),_(!0);try{const U=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);U&&(f(U),console.log("[Dashboard] Loaded demo template:",U.name))}catch(U){console.error("[Dashboard] Error loading demo template:",U)}finally{_(!1)}return}_(!0);try{const U=await claraApi.fetchUserProfile();console.log("[Dashboard] Raw profile response:",JSON.stringify(U,null,2)),U&&(m(U),console.log("[Dashboard] User profile settings:",U.settings));const K=await claraApi.fetchTemplates();if(K&&K.length>0){p(K),console.log("[Dashboard] Templates loaded:",K.length);const Q=a.templateId||((R=U==null?void 0:U.settings)==null?void 0:R.selectedTemplateId);if(console.log("[Dashboard] Template selection - config:",a.templateId,"settings:",(G=U==null?void 0:U.settings)==null?void 0:G.selectedTemplateId,"using:",Q),Q){const ne=K.find(Ee=>Ee.id===Q);if(ne)f(ne),console.log("[Dashboard] Selected template:",ne.name);else{console.log("[Dashboard] Template not found:",Q,"loading demo template from API");const Ee=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);Ee&&f(Ee)}}else{const ne=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);ne&&(f(ne),console.log("[Dashboard] No template configured, using demo:",ne.name))}}else{console.log("[Dashboard] No templates from API, loading demo template");const Q=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);Q&&f(Q)}}catch(U){console.error("[Dashboard] Error loading data:",U),((z=U==null?void 0:U.message)!=null&&z.includes("401")||(q=U==null?void 0:U.message)!=null&&q.toLowerCase().includes("invalid api key"))&&D(!0),console.log("[Dashboard] Falling back to demo template due to error");try{const K=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);K&&f(K)}catch(K){console.error("[Dashboard] Failed to load fallback demo template:",K)}}finally{_(!1)}})()},[a.apiKey,a.templateId,a.demoTemplate,s,p,f,m]),React.useEffect(()=>{!a.templateId&&!a.apiKey&&(async()=>{_(!0);try{const R=await getDemoTemplate(a.demoTemplate);R&&(f(R),console.log("[Dashboard] Demo template changed to:",R.name))}catch(R){console.error("[Dashboard] Error loading demo template:",R)}finally{_(!1)}})()},[a.demoTemplate]);const b=async()=>{F(!0),O(null),H({phase:"analyzing",percentage:0,message:"Iniciando..."});const k=await generateTemplateFromPage(R=>{H(R)});k&&(O(k),await I(k))},I=async k=>{console.log("[Dashboard] Saving generated template:",k),H({phase:"saving",percentage:90,message:"Guardando template..."});try{const R={name:k.name||"Template Generado",description:k.description||"Generado automáticamente desde la página",structure:k.structure};console.log("[Dashboard] Template payload:",R);const G=await claraApi.createTemplate(R);if(console.log("[Dashboard] Saved template response:",G),G)p([...r,G]),f(G),H({phase:"complete",percentage:100,message:"Template guardado exitosamente"}),setTimeout(()=>{F(!1),H(null),O(null)},1500);else throw new Error("No se pudo guardar el template")}catch(R){console.error("[Dashboard] Error saving template:",R),H({phase:"error",percentage:0,message:R instanceof Error?R.message:"Error al guardar"})}},V=()=>{switch(x){case"consulta":const k=B,R=!k&&!!o&&!c;return jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:[c&&d&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 w-full max-w-xs",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[jsxRuntime.jsx(Radio,{className:"w-4 h-4 animate-pulse"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:"Consulta en proceso"})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-amber-600/80 mt-1",children:d.templateName||"Otra sesión está activa"})]}),jsxRuntime.jsx("div",{className:"mb-5 relative",children:jsxRuntime.jsxs("div",{className:"w-24 h-24 rounded-full bg-secondary flex items-center justify-center shadow-inner relative",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center z-10 opacity-10",style:{backgroundColor:i}}),jsxRuntime.jsx("div",{className:"absolute z-20",children:jsxRuntime.jsx(Mic,{className:"w-8 h-8",style:{color:c?"#d97706":i}})}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse-ring opacity-20",style:{backgroundColor:c?"#d97706":i}})]})}),jsxRuntime.jsx("h3",{className:"text-foreground text-base font-semibold mb-1",children:t(c?"session.recording":"dashboard.newConsultation",P)}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-xs mb-6 px-4",children:k?t("common.loading",P):c?t("session.recording",P):""}),jsxRuntime.jsxs("button",{onClick:n,disabled:!R,className:`w-full max-w-xs font-medium py-3 px-5 rounded-xl shadow-button flex items-center justify-center gap-2.5 transition-all mb-5 text-sm ${R?"text-white bg-clara-dark hover:brightness-110 active:scale-95":"bg-clara-dark/60 text-white/80 cursor-not-allowed"}`,children:[k?jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}):c?jsxRuntime.jsx(Radio,{className:"w-4 h-4"}):jsxRuntime.jsx(Mic,{className:"w-4 h-4"}),t(c?"session.recording":"dashboard.startSession",P)]}),!T&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>!k&&E(!0),disabled:k,className:`group flex items-center gap-2.5 bg-card border border-border px-3 py-2 rounded-lg shadow-sm transition-all ${k?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-accent"}`,children:[jsxRuntime.jsx("div",{className:"p-1 rounded-md",style:{backgroundColor:`${i}1A`,color:i},children:k?jsxRuntime.jsx(LoaderCircle,{className:"w-3.5 h-3.5 animate-spin"}):jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("p",{className:"text-[9px] uppercase text-muted-foreground font-bold tracking-wider",children:t("dashboard.templates",P)}),jsxRuntime.jsx("p",{className:"text-xs font-medium text-foreground truncate max-w-[100px]",children:k?t("common.loading",P):(o==null?void 0:o.name)||t("dashboard.selectTemplate",P)})]}),!k&&jsxRuntime.jsx(ChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground"})]})})]});case"chat":return jsxRuntime.jsx(ClaraChat,{primaryColor:i})}},A=[{id:"consulta",label:t("dashboard.newConsultation",P),icon:Mic},{id:"chat",label:t("tabs.chat",P),icon:MessageSquare}];return jsxRuntime.jsxs("div",{className:"flex flex-col h-full bg-card relative",children:[jsxRuntime.jsxs("div",{className:"px-4 py-4 border-b border-border flex items-center justify-between bg-card z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-5 w-auto"}),jsxRuntime.jsx("span",{className:"text-[9px] text-muted-foreground font-medium uppercase tracking-wider ml-1",children:"WIDGET"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:()=>g(!S),className:"text-muted-foreground hover:text-foreground p-1 rounded-full hover:bg-secondary transition-colors",children:jsxRuntime.jsx(Settings,{className:"w-4 h-4"})}),jsxRuntime.jsx(AnimatePresence,{children:S&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},className:"absolute right-0 mt-2 w-44 bg-card rounded-lg shadow-widget border border-border py-1 z-50",children:[!T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>{E(!0),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"}),t("dashboard.templates",P)]}),jsxRuntime.jsxs("button",{onClick:()=>{b(),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(Sparkles,{className:"w-3.5 h-3.5"}),t("dashboard.generate",P)]})]}),jsxRuntime.jsxs("a",{href:"https://clara.care",target:"_blank",rel:"noreferrer",className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(ExternalLink,{className:"w-3.5 h-3.5"}),"Ir a Clara.care"]}),jsxRuntime.jsx("div",{className:"border-t border-border my-1"}),jsxRuntime.jsxs("button",{onClick:e,className:"w-full text-left px-3 py-2 text-xs text-destructive hover:bg-destructive/10 flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(LogOut,{className:"w-3.5 h-3.5"}),t("dashboard.logout",P)]})]})})]})]}),x!=="consulta"&&jsxRuntime.jsx("div",{className:"px-3 mt-4 mb-2",children:jsxRuntime.jsx("div",{className:"bg-clara-dark text-white p-0.5 rounded-lg flex items-center justify-between shadow-lg",children:A.map(k=>jsxRuntime.jsxs("button",{onClick:()=>y(k.id),className:`flex-1 py-1.5 text-xs font-medium rounded-md flex items-center justify-center gap-1.5 transition-all ${x===k.id?"bg-card text-foreground shadow-sm":"text-gray-400 hover:text-white"}`,children:[jsxRuntime.jsx(k.icon,{className:"w-3.5 h-3.5"}),k.label]},k.id))})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:V()}),jsxRuntime.jsx(AnimatePresence,{children:C&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-3",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full h-[80%] flex flex-col shadow-widget overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"p-3 border-b border-border flex justify-between items-center bg-secondary",children:[jsxRuntime.jsx("h3",{className:"font-bold text-sm text-foreground",children:t("dashboard.templates",P)}),jsxRuntime.jsx("button",{onClick:()=>E(!1),className:"p-1 rounded-full hover:bg-muted text-muted-foreground transition-colors",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:B?jsxRuntime.jsx("div",{className:"flex items-center justify-center py-8",children:jsxRuntime.jsx(LoaderCircle,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):r.length===0?jsxRuntime.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No hay plantillas disponibles"}):r.map(k=>{const R=(o==null?void 0:o.id)===k.id;return jsxRuntime.jsxs("button",{onClick:async()=>{var G;f(k),emitTemplateChanged(k.id,k.name,((G=k.structure)==null?void 0:G.sections)||[]),E(!1),await claraApi.updateUserSettings({selectedTemplateId:k.id})},className:`w-full p-3 border rounded-lg cursor-pointer transition-all flex justify-between items-center ${R?"shadow-sm":"border-border hover:bg-secondary"}`,style:R?{borderColor:i,backgroundColor:`${i}0D`}:{},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center ${R?"text-white":"bg-secondary text-muted-foreground"}`,style:R?{backgroundColor:i}:{},children:jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("span",{className:`font-medium text-xs block ${R?"":"text-foreground"}`,style:R?{color:i}:{},children:k.name}),k.description&&jsxRuntime.jsx("span",{className:"text-[10px] text-muted-foreground line-clamp-1",children:k.description})]})]}),R&&jsxRuntime.jsx(Check,{className:"w-4 h-4",style:{color:i}})]},k.id)})})]})})}),jsxRuntime.jsx(AnimatePresence,{children:M&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsx(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden",children:jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mb-4",children:jsxRuntime.jsx(TriangleAlert,{className:"w-6 h-6 text-destructive"})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:"API Key Inválida"}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-5",children:"La API Key proporcionada no es válida o ha expirado. Por favor verifica tu configuración."}),jsxRuntime.jsx("button",{onClick:()=>{D(!1),e()},className:"w-full py-2.5 px-4 rounded-lg bg-destructive text-white font-medium text-sm hover:brightness-110 transition-all",children:"Cerrar y Reintentar"})]})})})}),jsxRuntime.jsx(AnimatePresence,{children:L&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden relative",children:[jsxRuntime.jsx("button",{onClick:()=>{F(!1),H(null),O(null)},className:"absolute top-3 right-3 p-1 rounded-full hover:bg-secondary text-muted-foreground transition-colors z-10",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})}),jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[(N==null?void 0:N.phase)==="complete"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:`${i}20`},children:jsxRuntime.jsx(Check,{className:"w-8 h-8",style:{color:i}})}):(N==null?void 0:N.phase)==="error"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-destructive/20",children:jsxRuntime.jsx(TriangleAlert,{className:"w-8 h-8 text-destructive"})}):jsxRuntime.jsx("div",{className:"w-24 h-24 mb-2",children:jsxRuntime.jsx(Lottie,{animationData:aiGeneratingAnimation,loop:!0,style:{width:"100%",height:"100%"}})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:(N==null?void 0:N.phase)==="complete"?t("generate.complete",P):(N==null?void 0:N.phase)==="error"?t("common.error",P):t("generate.title",P)}),N&&N.phase!=="error"&&jsxRuntime.jsxs("div",{className:"w-full mb-3",children:[jsxRuntime.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:jsxRuntime.jsx(motion.div,{className:"h-full rounded-full",style:{backgroundColor:i},initial:{width:0},animate:{width:`${N.percentage}%`},transition:{duration:.3}})}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[N.percentage,"%"]})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:(N==null?void 0:N.message)||t("generate.analyzing",P)}),$&&(N==null?void 0:N.phase)!=="saving"&&(N==null?void 0:N.phase)!=="complete"&&jsxRuntime.jsxs("div",{className:"w-full text-left mb-4 p-3 bg-secondary rounded-lg",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-foreground mb-1",children:$.name}),jsxRuntime.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[$.structure.sections.length," ",t("generate.sections",P),", "," ",$.structure.sections.reduce((k,R)=>k+R.fields.length,0)," ",t("generate.fields",P)]})]}),jsxRuntime.jsx("div",{className:"flex gap-2 w-full",children:(N==null?void 0:N.phase)==="error"?jsxRuntime.jsx("button",{onClick:()=>{F(!1),H(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.close",P)}):(N==null?void 0:N.phase)==="complete"||(N==null?void 0:N.phase)==="saving"?null:jsxRuntime.jsx("button",{onClick:()=>{F(!1),H(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.cancel",P)})})]})]})})})]})};var ViewState=(n=>(n.LOGIN="login",n.DASHBOARD="dashboard",n.SESSION="session",n))(ViewState||{}),SessionStatus=(n=>(n.CONNECTING="connecting",n.ACTIVE="active",n.PAUSED="paused",n.DISCONNECTED="disconnected",n.ERROR="error",n))(SessionStatus||{});function floatTo16BitPCM(n){const e=new ArrayBuffer(n.length*2),i=new DataView(e);let a=0;for(let s=0;s<n.length;s++,a+=2){let r=Math.max(-1,Math.min(1,n[s]));i.setInt16(a,r<0?r*32768:r*32767,!0)}return e}function arrayBufferToBase64(n){let e="";const i=new Uint8Array(n),a=i.byteLength;for(let s=0;s<a;s++)e+=String.fromCharCode(i[s]);return btoa(e)}function float32To16BitPCMBase64(n){return arrayBufferToBase64(floatTo16BitPCM(n))}function downsampleBuffer(n,e,i=16e3){if(e===i||e<i)return n;const a=e/i,s=Math.floor(n.length/a),r=new Float32Array(s);let o=0,l=0;for(;o<r.length;){const u=Math.round((o+1)*a);let c=0,d=0;for(let p=Math.round(l);p<u&&p<n.length;p++)c+=n[p],d++;r[o]=d>0?c/d:0,o++,l=u}return r}const surfaceToArea=n=>{if(!n)return 0;switch(n.toLowerCase()){case"whole":case"completo":return 0;case"vestibular":case"bucal":case"top":return 1;case"lingual":case"palatal":case"palatino":case"bottom":return 2;case"mesial":case"left":return 4;case"distal":case"right":return 6;case"oclusal":case"incisal":case"center":return 7;default:return 7}},extractJson=n=>{if(n!==null&&typeof n=="object")return n;if(typeof n!="string"||!n.trim())return null;const e=n.trim();try{return JSON.parse(e)}catch{}try{const i=e.replace(/^```(?:json)?\s*/i,"").replace(/\s*```$/i,"").trim();if(i!==e)return JSON.parse(i)}catch{}try{const i=e.match(/\{[\s\S]*\}/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.match(/\[[\s\S]*\]/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.replace(/\\"/g,'"').replace(/\\n/g,`
|
|
407
|
+
`+u,config:{temperature:.2,maxOutputTokens:16384}})).text||"";console.log("[TemplateGenerator] AI Response length:",d.length),console.log("[TemplateGenerator] AI Response:",d),n({phase:"generating",percentage:70,message:"Procesando respuesta..."});let p=null;if(p=(g=>{try{return JSON.parse(g)}catch{}const C=g.match(/```(?:json)?\s*([\s\S]*?)\s*```/);if(C&&C[1])try{return JSON.parse(C[1].trim())}catch{}const E=g.indexOf("{");if(E!==-1){let B=g.slice(E),_=0,M=0,D=!1,L=!1;for(let N=0;N<B.length;N++){const F=B[N];if(L){L=!1;continue}if(F==="\\"){L=!0;continue}if(F==='"'){D=!D;continue}D||(F==="{"&&_++,F==="}"&&_--,F==="["&&M++,F==="]"&&M--)}D&&(B+='"'),B=B.replace(/,\s*"[^"]*":\s*"[^"]*$/,"").replace(/,\s*"[^"]*":\s*$/,"").replace(/,\s*"[^"]*$/,"").replace(/,\s*\{[^}]*$/,"").replace(/,\s*$/,""),B+="]".repeat(Math.max(0,M)),B+="}".repeat(Math.max(0,_)),B=B.replace(/,\s*}/g,"}").replace(/,\s*]/g,"]");try{return JSON.parse(B)}catch(N){console.warn("[TemplateGenerator] JSON repair failed:",N)}}return null})(d),!p)throw console.error("[TemplateGenerator] All JSON extraction strategies failed"),new Error("No se pudo parsear la respuesta de la IA. El JSON estaba incompleto o malformado.");console.log("[TemplateGenerator] Parsed response:",p);const m=((e=p.structure)==null?void 0:e.sections)||p.sections||[],P=p.name||p.templateName||p.formName||"Template Generado",T=p.description||p.templateDescription||"Generado automáticamente",x=m.map(g=>{var C;return{key:g.key||((C=g.label)==null?void 0:C.toLowerCase().replace(/\s+/g,"_"))||"section",label:g.label||"Sección",enabled:g.enabled!==!1,fields:(g.fields||[]).map(E=>({id:E.id||E.htmlFieldId,htmlFieldId:E.htmlFieldId||E.id,label:E.label||E.id||"Campo",type:E.type||"text",...E.options&&{options:E.options}}))}}),y=x.reduce((g,C)=>{var E;return g+(((E=C.fields)==null?void 0:E.length)||0)},0),S={name:P,description:T,structure:{sections:x}};return console.log("[TemplateGenerator] Final template:",{name:S.name,sectionsCount:S.structure.sections.length,fieldsCount:y}),n({phase:"complete",percentage:100,message:`Template generado: ${S.structure.sections.length} secciones, ${y} campos`}),S}catch(i){return console.error("[TemplateGenerator] Error:",i),n({phase:"error",percentage:0,message:i instanceof Error?i.message:"Error desconocido"}),null}}const DEMO_TEMPLATE_IDS={audiometria:"a0785251-eb3a-4d6c-8224-10a8c6acfd12",odontologia:"fe2085fd-5f19-44e9-b04c-92e0f0ab7769"},API_BASE_URL="https://mahjxdopacmbyqewgxpx.supabase.co/functions/v1/api";let demoTemplatesCache={};function isValidApiKey(n){return!!n&&n.length>=20}function getAuthHeaders(n,e){const i={"Content-Type":"application/json"};if(isValidApiKey(n))i["X-API-Key"]=n;else if(e&&e.length>20)i.Authorization=`Bearer ${e}`;else if(isValidApiKey(claraApi.getApiKey()))i["X-API-Key"]=claraApi.getApiKey();else if(claraApi.getAccessToken()&&claraApi.getAccessToken().length>20)i.Authorization=`Bearer ${claraApi.getAccessToken()}`;else return null;return i}async function fetchTemplateById(n,e,i){try{const a=getAuthHeaders(e,i);if(!a)return console.log("[DemoTemplates] No valid authentication available, skipping fetch"),null;const s=`${API_BASE_URL}/templates`;console.log("[DemoTemplates] Fetching templates to find:",n);const r=await fetch(s,{method:"GET",headers:a});if(!r.ok)return console.error("[DemoTemplates] Failed to fetch templates:",r.status),null;const o=await r.json(),u=(o.data||o).find(c=>c.id===n);return u?(console.log("[DemoTemplates] Found template:",u.name),u):(console.warn("[DemoTemplates] Template not found:",n),null)}catch(a){return console.error("[DemoTemplates] Error fetching template:",a),null}}async function getDemoTemplate(n,e,i){if(demoTemplatesCache[n])return console.log("[DemoTemplates] Returning cached template:",n),demoTemplatesCache[n];const a=DEMO_TEMPLATE_IDS[n],s=await fetchTemplateById(a,e,i);return s&&(demoTemplatesCache[n]=s,console.log("[DemoTemplates] Cached template:",n,s.name)),s}function dispatchClaraEvent(n,e){console.log(`[Clara Event] ${n}`,e),window.dispatchEvent(new CustomEvent(n,{detail:e}))}function emitFieldFilled(n,e,i){dispatchClaraEvent("clara:field-filled",{fieldName:n,value:e,sectionKey:i,timestamp:new Date().toISOString()})}function emitFormDataUpdated(n,e,i){dispatchClaraEvent("clara:formdata-updated",{formData:{...n},changedField:e,changedFields:i,timestamp:new Date().toISOString()})}function emitTranscriptUpdated(n,e,i){dispatchClaraEvent("clara:transcript-updated",{role:n,content:e,messages:i,timestamp:new Date().toISOString()})}function emitTitleUpdated(n,e){dispatchClaraEvent("clara:title-updated",{title:n,analysisId:e,timestamp:new Date().toISOString()})}function emitTemplateChanged(n,e,i){dispatchClaraEvent("clara:template-changed",{templateId:n,templateName:e,sections:i,timestamp:new Date().toISOString()})}function emitSessionStarted(n){dispatchClaraEvent("clara:session-started",{analysisId:n,timestamp:new Date().toISOString()})}function emitOdontogramCleared(n,e){dispatchClaraEvent("clara:odontogram-cleared",{fieldId:n,teeth:e,timestamp:new Date().toISOString()})}function emitOdontogramUpdated(n,e){dispatchClaraEvent("clara:odontogram-updated",{fieldId:n,teeth:e,timestamp:new Date().toISOString()})}function emitSessionStopped(n){dispatchClaraEvent("clara:session-stopped",{analysisId:n,timestamp:new Date().toISOString()})}const ClaraDashboard=({onStartSession:n,onLogout:e,primaryColor:i})=>{const{config:a,accessToken:s,templates:r,currentTemplate:o,formData:l,userProfile:u,remoteSessionActive:c,remoteSessionInfo:d,setTemplates:p,setCurrentTemplate:f,setUserProfile:m}=useClaraStore(),P=a.lang||"es",T=!!a.templateId,[x,y]=React.useState("consulta"),[S,g]=React.useState(!1),[C,E]=React.useState(!1),[B,_]=React.useState(!1),[M,D]=React.useState(!1),[L,N]=React.useState(!1),[F,H]=React.useState(null),[$,O]=React.useState(null);o!=null&&o.name||a.templateId||t("dashboard.selectTemplate",P),React.useEffect(()=>{(async()=>{var R,G,z,q;if(!claraApi.hasAuth())if(a.apiKey)claraApi.setApiKey(a.apiKey);else if(s)claraApi.setAccessToken(s);else{console.log("[Dashboard] No auth available, loading demo template from API"),_(!0);try{const U=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);U&&(f(U),console.log("[Dashboard] Loaded demo template:",U.name))}catch(U){console.error("[Dashboard] Error loading demo template:",U)}finally{_(!1)}return}_(!0);try{const U=await claraApi.fetchUserProfile();console.log("[Dashboard] Raw profile response:",JSON.stringify(U,null,2)),U&&(m(U),console.log("[Dashboard] User profile settings:",U.settings));const K=await claraApi.fetchTemplates();if(K&&K.length>0){p(K),console.log("[Dashboard] Templates loaded:",K.length);const Q=a.templateId||((R=U==null?void 0:U.settings)==null?void 0:R.selectedTemplateId);if(console.log("[Dashboard] Template selection - config:",a.templateId,"settings:",(G=U==null?void 0:U.settings)==null?void 0:G.selectedTemplateId,"using:",Q),Q){const ne=K.find(Ee=>Ee.id===Q);if(ne)f(ne),console.log("[Dashboard] Selected template:",ne.name);else{console.log("[Dashboard] Template not found:",Q,"loading demo template from API");const Ee=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);Ee&&f(Ee)}}else{const ne=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);ne&&(f(ne),console.log("[Dashboard] No template configured, using demo:",ne.name))}}else{console.log("[Dashboard] No templates from API, loading demo template");const Q=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);Q&&f(Q)}}catch(U){console.error("[Dashboard] Error loading data:",U),((z=U==null?void 0:U.message)!=null&&z.includes("401")||(q=U==null?void 0:U.message)!=null&&q.toLowerCase().includes("invalid api key"))&&D(!0),console.log("[Dashboard] Falling back to demo template due to error");try{const K=await getDemoTemplate(a.demoTemplate,a.apiKey||void 0,s||void 0);K&&f(K)}catch(K){console.error("[Dashboard] Failed to load fallback demo template:",K)}}finally{_(!1)}})()},[a.apiKey,a.templateId,a.demoTemplate,s,p,f,m]),React.useEffect(()=>{!a.templateId&&!a.apiKey&&(async()=>{_(!0);try{const R=await getDemoTemplate(a.demoTemplate);R&&(f(R),console.log("[Dashboard] Demo template changed to:",R.name))}catch(R){console.error("[Dashboard] Error loading demo template:",R)}finally{_(!1)}})()},[a.demoTemplate]);const b=async()=>{N(!0),O(null),H({phase:"analyzing",percentage:0,message:"Iniciando..."});const k=await generateTemplateFromPage(R=>{H(R)});k&&(O(k),await I(k))},I=async k=>{console.log("[Dashboard] Saving generated template:",k),H({phase:"saving",percentage:90,message:"Guardando template..."});try{const R={name:k.name||"Template Generado",description:k.description||"Generado automáticamente desde la página",structure:k.structure};console.log("[Dashboard] Template payload:",R);const G=await claraApi.createTemplate(R);if(console.log("[Dashboard] Saved template response:",G),G)p([...r,G]),f(G),H({phase:"complete",percentage:100,message:"Template guardado exitosamente"}),setTimeout(()=>{N(!1),H(null),O(null)},1500);else throw new Error("No se pudo guardar el template")}catch(R){console.error("[Dashboard] Error saving template:",R),H({phase:"error",percentage:0,message:R instanceof Error?R.message:"Error al guardar"})}},V=()=>{switch(x){case"consulta":const k=B,R=!k&&!!o&&!c;return jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:[c&&d&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 w-full max-w-xs",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[jsxRuntime.jsx(Radio,{className:"w-4 h-4 animate-pulse"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:"Consulta en proceso"})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-amber-600/80 mt-1",children:d.templateName||"Otra sesión está activa"})]}),jsxRuntime.jsx("div",{className:"mb-5 relative",children:jsxRuntime.jsxs("div",{className:"w-24 h-24 rounded-full bg-secondary flex items-center justify-center shadow-inner relative",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center z-10 opacity-10",style:{backgroundColor:i}}),jsxRuntime.jsx("div",{className:"absolute z-20",children:jsxRuntime.jsx(Mic,{className:"w-8 h-8",style:{color:c?"#d97706":i}})}),jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full animate-pulse-ring opacity-20",style:{backgroundColor:c?"#d97706":i}})]})}),jsxRuntime.jsx("h3",{className:"text-foreground text-base font-semibold mb-1",children:t(c?"session.recording":"dashboard.newConsultation",P)}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-xs mb-6 px-4",children:k?t("common.loading",P):c?t("session.recording",P):""}),jsxRuntime.jsxs("button",{onClick:n,disabled:!R,className:`w-full max-w-xs font-medium py-3 px-5 rounded-xl shadow-button flex items-center justify-center gap-2.5 transition-all mb-5 text-sm ${R?"text-white bg-clara-dark hover:brightness-110 active:scale-95":"bg-clara-dark/60 text-white/80 cursor-not-allowed"}`,children:[k?jsxRuntime.jsx(LoaderCircle,{className:"w-4 h-4 animate-spin"}):c?jsxRuntime.jsx(Radio,{className:"w-4 h-4"}):jsxRuntime.jsx(Mic,{className:"w-4 h-4"}),t(c?"session.recording":"dashboard.startSession",P)]}),!T&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>!k&&E(!0),disabled:k,className:`group flex items-center gap-2.5 bg-card border border-border px-3 py-2 rounded-lg shadow-sm transition-all ${k?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-accent"}`,children:[jsxRuntime.jsx("div",{className:"p-1 rounded-md",style:{backgroundColor:`${i}1A`,color:i},children:k?jsxRuntime.jsx(LoaderCircle,{className:"w-3.5 h-3.5 animate-spin"}):jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("p",{className:"text-[9px] uppercase text-muted-foreground font-bold tracking-wider",children:t("dashboard.templates",P)}),jsxRuntime.jsx("p",{className:"text-xs font-medium text-foreground truncate max-w-[100px]",children:k?t("common.loading",P):(o==null?void 0:o.name)||t("dashboard.selectTemplate",P)})]}),!k&&jsxRuntime.jsx(ChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground"})]})})]});case"chat":return jsxRuntime.jsx(ClaraChat,{primaryColor:i})}},A=[{id:"consulta",label:t("dashboard.newConsultation",P),icon:Mic},{id:"chat",label:t("tabs.chat",P),icon:MessageSquare}];return jsxRuntime.jsxs("div",{className:"flex flex-col h-full bg-card relative",children:[jsxRuntime.jsxs("div",{className:"px-4 py-4 border-b border-border flex items-center justify-between bg-card z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("img",{src:claraLogo,alt:"Clara",className:"h-5 w-auto"}),jsxRuntime.jsx("span",{className:"text-[9px] text-muted-foreground font-medium uppercase tracking-wider ml-1",children:"WIDGET"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:()=>g(!S),className:"text-muted-foreground hover:text-foreground p-1 rounded-full hover:bg-secondary transition-colors",children:jsxRuntime.jsx(Settings,{className:"w-4 h-4"})}),jsxRuntime.jsx(AnimatePresence,{children:S&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},className:"absolute right-0 mt-2 w-44 bg-card rounded-lg shadow-widget border border-border py-1 z-50",children:[!T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>{E(!0),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"}),t("dashboard.templates",P)]}),jsxRuntime.jsxs("button",{onClick:()=>{b(),g(!1)},className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(Sparkles,{className:"w-3.5 h-3.5"}),t("dashboard.generate",P)]})]}),jsxRuntime.jsxs("a",{href:"https://clara.care",target:"_blank",rel:"noreferrer",className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-secondary flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(ExternalLink,{className:"w-3.5 h-3.5"}),"Ir a Clara.care"]}),jsxRuntime.jsx("div",{className:"border-t border-border my-1"}),jsxRuntime.jsxs("button",{onClick:e,className:"w-full text-left px-3 py-2 text-xs text-destructive hover:bg-destructive/10 flex items-center gap-2 transition-colors",children:[jsxRuntime.jsx(LogOut,{className:"w-3.5 h-3.5"}),t("dashboard.logout",P)]})]})})]})]}),x!=="consulta"&&jsxRuntime.jsx("div",{className:"px-3 mt-4 mb-2",children:jsxRuntime.jsx("div",{className:"bg-clara-dark text-white p-0.5 rounded-lg flex items-center justify-between shadow-lg",children:A.map(k=>jsxRuntime.jsxs("button",{onClick:()=>y(k.id),className:`flex-1 py-1.5 text-xs font-medium rounded-md flex items-center justify-center gap-1.5 transition-all ${x===k.id?"bg-card text-foreground shadow-sm":"text-gray-400 hover:text-white"}`,children:[jsxRuntime.jsx(k.icon,{className:"w-3.5 h-3.5"}),k.label]},k.id))})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:V()}),jsxRuntime.jsx(AnimatePresence,{children:C&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-3",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full h-[80%] flex flex-col shadow-widget overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"p-3 border-b border-border flex justify-between items-center bg-secondary",children:[jsxRuntime.jsx("h3",{className:"font-bold text-sm text-foreground",children:t("dashboard.templates",P)}),jsxRuntime.jsx("button",{onClick:()=>E(!1),className:"p-1 rounded-full hover:bg-muted text-muted-foreground transition-colors",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:B?jsxRuntime.jsx("div",{className:"flex items-center justify-center py-8",children:jsxRuntime.jsx(LoaderCircle,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):r.length===0?jsxRuntime.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No hay plantillas disponibles"}):r.map(k=>{const R=(o==null?void 0:o.id)===k.id;return jsxRuntime.jsxs("button",{onClick:async()=>{var G;f(k),emitTemplateChanged(k.id,k.name,((G=k.structure)==null?void 0:G.sections)||[]),E(!1),await claraApi.updateUserSettings({selectedTemplateId:k.id})},className:`w-full p-3 border rounded-lg cursor-pointer transition-all flex justify-between items-center ${R?"shadow-sm":"border-border hover:bg-secondary"}`,style:R?{borderColor:i,backgroundColor:`${i}0D`}:{},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center ${R?"text-white":"bg-secondary text-muted-foreground"}`,style:R?{backgroundColor:i}:{},children:jsxRuntime.jsx(FileText,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"text-left",children:[jsxRuntime.jsx("span",{className:`font-medium text-xs block ${R?"":"text-foreground"}`,style:R?{color:i}:{},children:k.name}),k.description&&jsxRuntime.jsx("span",{className:"text-[10px] text-muted-foreground line-clamp-1",children:k.description})]})]}),R&&jsxRuntime.jsx(Check,{className:"w-4 h-4",style:{color:i}})]},k.id)})})]})})}),jsxRuntime.jsx(AnimatePresence,{children:M&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsx(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden",children:jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mb-4",children:jsxRuntime.jsx(TriangleAlert,{className:"w-6 h-6 text-destructive"})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:"API Key Inválida"}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-5",children:"La API Key proporcionada no es válida o ha expirado. Por favor verifica tu configuración."}),jsxRuntime.jsx("button",{onClick:()=>{D(!1),e()},className:"w-full py-2.5 px-4 rounded-lg bg-destructive text-white font-medium text-sm hover:brightness-110 transition-all",children:"Cerrar y Reintentar"})]})})})}),jsxRuntime.jsx(AnimatePresence,{children:L&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-50 flex items-center justify-center bg-foreground/50 p-4",children:jsxRuntime.jsxs(motion.div,{initial:{scale:.95,y:20},animate:{scale:1,y:0},exit:{scale:.95,y:20},className:"bg-card rounded-xl w-full max-w-xs shadow-widget overflow-hidden relative",children:[jsxRuntime.jsx("button",{onClick:()=>{N(!1),H(null),O(null)},className:"absolute top-3 right-3 p-1 rounded-full hover:bg-secondary text-muted-foreground transition-colors z-10",children:jsxRuntime.jsx(X,{className:"w-4 h-4"})}),jsxRuntime.jsxs("div",{className:"p-5 flex flex-col items-center text-center",children:[(F==null?void 0:F.phase)==="complete"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:`${i}20`},children:jsxRuntime.jsx(Check,{className:"w-8 h-8",style:{color:i}})}):(F==null?void 0:F.phase)==="error"?jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-destructive/20",children:jsxRuntime.jsx(TriangleAlert,{className:"w-8 h-8 text-destructive"})}):jsxRuntime.jsx("div",{className:"w-24 h-24 mb-2",children:jsxRuntime.jsx(Lottie,{animationData:aiGeneratingAnimation,loop:!0,style:{width:"100%",height:"100%"}})}),jsxRuntime.jsx("h3",{className:"font-bold text-base text-foreground mb-2",children:(F==null?void 0:F.phase)==="complete"?t("generate.complete",P):(F==null?void 0:F.phase)==="error"?t("common.error",P):t("generate.title",P)}),F&&F.phase!=="error"&&jsxRuntime.jsxs("div",{className:"w-full mb-3",children:[jsxRuntime.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:jsxRuntime.jsx(motion.div,{className:"h-full rounded-full",style:{backgroundColor:i},initial:{width:0},animate:{width:`${F.percentage}%`},transition:{duration:.3}})}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[F.percentage,"%"]})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:(F==null?void 0:F.message)||t("generate.analyzing",P)}),$&&(F==null?void 0:F.phase)!=="saving"&&(F==null?void 0:F.phase)!=="complete"&&jsxRuntime.jsxs("div",{className:"w-full text-left mb-4 p-3 bg-secondary rounded-lg",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-foreground mb-1",children:$.name}),jsxRuntime.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[$.structure.sections.length," ",t("generate.sections",P),", "," ",$.structure.sections.reduce((k,R)=>k+R.fields.length,0)," ",t("generate.fields",P)]})]}),jsxRuntime.jsx("div",{className:"flex gap-2 w-full",children:(F==null?void 0:F.phase)==="error"?jsxRuntime.jsx("button",{onClick:()=>{N(!1),H(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.close",P)}):(F==null?void 0:F.phase)==="complete"||(F==null?void 0:F.phase)==="saving"?null:jsxRuntime.jsx("button",{onClick:()=>{N(!1),H(null),O(null)},className:"w-full py-2.5 px-4 rounded-lg bg-secondary text-foreground font-medium text-sm hover:bg-muted transition-all",children:t("common.cancel",P)})})]})]})})})]})};var ViewState=(n=>(n.LOGIN="login",n.DASHBOARD="dashboard",n.SESSION="session",n))(ViewState||{}),SessionStatus=(n=>(n.CONNECTING="connecting",n.ACTIVE="active",n.PAUSED="paused",n.DISCONNECTED="disconnected",n.ERROR="error",n))(SessionStatus||{});function floatTo16BitPCM(n){const e=new ArrayBuffer(n.length*2),i=new DataView(e);let a=0;for(let s=0;s<n.length;s++,a+=2){let r=Math.max(-1,Math.min(1,n[s]));i.setInt16(a,r<0?r*32768:r*32767,!0)}return e}function arrayBufferToBase64(n){let e="";const i=new Uint8Array(n),a=i.byteLength;for(let s=0;s<a;s++)e+=String.fromCharCode(i[s]);return btoa(e)}function float32To16BitPCMBase64(n){return arrayBufferToBase64(floatTo16BitPCM(n))}function downsampleBuffer(n,e,i=16e3){if(e===i||e<i)return n;const a=e/i,s=Math.floor(n.length/a),r=new Float32Array(s);let o=0,l=0;for(;o<r.length;){const u=Math.round((o+1)*a);let c=0,d=0;for(let p=Math.round(l);p<u&&p<n.length;p++)c+=n[p],d++;r[o]=d>0?c/d:0,o++,l=u}return r}const surfaceToArea=n=>{if(!n)return 0;switch(n.toLowerCase()){case"whole":case"completo":return 0;case"vestibular":case"bucal":case"top":return 1;case"lingual":case"palatal":case"palatino":case"bottom":return 2;case"mesial":case"left":return 4;case"distal":case"right":return 6;case"oclusal":case"incisal":case"center":return 7;default:return 7}},extractJson=n=>{if(n!==null&&typeof n=="object")return n;if(typeof n!="string"||!n.trim())return null;const e=n.trim();try{return JSON.parse(e)}catch{}try{const i=e.replace(/^```(?:json)?\s*/i,"").replace(/\s*```$/i,"").trim();if(i!==e)return JSON.parse(i)}catch{}try{const i=e.match(/\{[\s\S]*\}/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.match(/\[[\s\S]*\]/);if(i)return JSON.parse(i[0])}catch{}try{const i=e.replace(/\\"/g,'"').replace(/\\n/g,`
|
|
408
408
|
`);if(i!==e)return JSON.parse(i)}catch{}try{const i=e.match(/(?:updates\s*:\s*)(\[[\s\S]*\])/i);if(i&&i[1])return JSON.parse(i[1])}catch{}return null},WORKLET_CODE=`
|
|
409
409
|
class PCMProcessor extends AudioWorkletProcessor {
|
|
410
410
|
process(inputs, outputs, parameters) {
|
|
@@ -417,26 +417,36 @@ class PCMProcessor extends AudioWorkletProcessor {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
registerProcessor('pcm-processor', PCMProcessor);
|
|
420
|
-
`,useGeminiLive=({geminiApiKey:n,onDataExtracted:e,onTranscriptUpdate:i,onTitleUpdate:a,onUsageUpdate:s,onOdontogramUpdate:r,onOdontogramClear:o,selectedMicId:l,isAutopilot:u=!1,voiceName:c="Kore",style:d="formal",speechSpeed:p="normal",sections:f=[],pricingConfig:m={inputCostPer1M:.075,outputCostPer1M:.3}})=>{const[P,T]=React.useState(!1),[x,y]=React.useState(!1),[S,g]=React.useState(!1),[C,E]=React.useState(null),[B,_]=React.useState(0),[M,D]=React.useState(!1),{setConnected:L}=useClaraStore(),
|
|
421
|
-
`);let we="";switch(d){case"empathetic":we="Empático y cálido.";break;case"direct":we="Directo y conciso.";break;case"formal":default:we="Profesional y clínico.";break}const ke=`
|
|
422
|
-
Eres Clara, asistente médica
|
|
423
|
-
${we} ${p==="fast"?"Habla rápido.":p==="slow"?"Habla lento.":""}
|
|
420
|
+
`,useGeminiLive=({geminiApiKey:n,onDataExtracted:e,onTranscriptUpdate:i,onTitleUpdate:a,onUsageUpdate:s,onOdontogramUpdate:r,onOdontogramClear:o,selectedMicId:l,isAutopilot:u=!1,voiceName:c="Kore",style:d="formal",speechSpeed:p="normal",sections:f=[],pricingConfig:m={inputCostPer1M:.075,outputCostPer1M:.3}})=>{const[P,T]=React.useState(!1),[x,y]=React.useState(!1),[S,g]=React.useState(!1),[C,E]=React.useState(null),[B,_]=React.useState(0),[M,D]=React.useState(!1),{setConnected:L}=useClaraStore(),N=React.useRef(null),F=React.useRef(null),H=React.useRef(null),$=React.useRef(null),O=React.useRef([]),b=React.useRef(0),I=4096,V=React.useRef(null),A=React.useRef(null),k=React.useRef(!1),R=React.useRef({inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0}),G=React.useRef(f),z=React.useRef(e),q=React.useRef(i),U=React.useRef(a),K=React.useRef(s),Q=React.useRef(r),ne=React.useRef(o);React.useEffect(()=>{G.current=f,z.current=e,q.current=i,U.current=a,K.current=s,Q.current=r,ne.current=o},[f,e,i,a,s,r,o]);const Ee=React.useCallback((ae,re)=>{const de=ae/1e6*m.inputCostPer1M,Be=re/1e6*m.outputCostPer1M;return de+Be},[m]),ye=React.useRef(!1),ge=React.useRef(!1),xe=React.useCallback(async()=>{var ae,re;if(!ye.current){if(ye.current=!0,ge.current=!1,console.log("[Gemini Live] Cleaning up..."),H.current){H.current.port.onmessage=null;try{H.current.disconnect()}catch{}H.current=null}if($.current){try{$.current.disconnect()}catch{}$.current=null}if(F.current&&(F.current.getTracks().forEach(de=>de.stop()),F.current=null),O.current=[],b.current=0,A.current=null,R.current={inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0},V.current){const de=V.current;V.current=null;try{await de.close()}catch(Be){console.warn("[Gemini Live] Session close error",Be)}}if(((ae=N.current)==null?void 0:ae.state)!=="closed")try{await((re=N.current)==null?void 0:re.close())}catch{}N.current=null,y(!1),L(!1),_(0),ye.current=!1}},[L]),oe=React.useCallback(ae=>{var we,fe,ke;if(!ge.current||k.current)return;let re=0;for(let pe=0;pe<ae.length;pe++)re+=ae[pe]*ae[pe];const de=Math.sqrt(re/ae.length);_(Math.min(1,de*8));const Be=((we=N.current)==null?void 0:we.sampleRate)||16e3;let he=ae;Be!==16e3&&(he=downsampleBuffer(ae,Be,16e3));const Ie=float32To16BitPCMBase64(he),Ae=V.current;if(Ae)try{Ae.sendRealtimeInput({media:{mimeType:"audio/pcm;rate=16000",data:Ie}})}catch(pe){((fe=pe.message)!=null&&fe.includes("CLOSING")||(ke=pe.message)!=null&&ke.includes("CLOSED"))&&(console.warn("[Gemini Live] 🛑 Socket closed while sending. Stopping loop."),ge.current=!1)}},[]),Y=React.useCallback(async()=>{var ae,re;if(!S){g(!0),E(null),await xe();try{console.log("[Gemini Live] 🔐 Getting Gemini token from ephemeralTokenManager...");let de=ephemeralTokenManager.getToken();if(de||(console.log("[Gemini Live] ⚠️ No Gemini token, attempting to initialize..."),await ephemeralTokenManager.initialize()&&(de=ephemeralTokenManager.getToken())),!de&&n&&(console.log("[Gemini Live] ⚠️ Using geminiApiKey prop as fallback"),de=n),!de)throw new Error("No se pudo obtener credenciales de Gemini. Verifica tu autenticación.");console.log("[Gemini Live] ✅ Gemini token obtained"),console.log("[Gemini Live] Connecting with lazy-loading schema strategy...");const Be=window.AudioContext||window.webkitAudioContext,he=new Be({sampleRate:16e3});he.state==="suspended"&&await he.resume(),N.current=he;const Ie=new GoogleGenAI({apiKey:de}),Ae=G.current.map(j=>{const Z=j.fields.slice(0,8).map(me=>me.label||me.id).join(", "),Se=j.fields.length>8?"...":"";return`- "${j.key}" (${j.label}): ${Z}${Se}`}).join(`
|
|
421
|
+
`);let we="";switch(d){case"empathetic":we="Empático y cálido.";break;case"direct":we="Directo y conciso.";break;case"formal":default:we="Profesional y clínico.";break}const fe=p==="fast"?"Habla rápido.":p==="slow"?"Habla lento.":"",ke=`
|
|
422
|
+
Eres Clara, una asistente médica técnica optimizada para el procesamiento de datos.
|
|
424
423
|
|
|
425
|
-
|
|
424
|
+
ESTADO ACTUAL:
|
|
425
|
+
- Modo Autopilot: ${u} (Si es TRUE: Pregunta datos faltantes brevemente. Si es FALSE: Solo procesa datos).
|
|
426
426
|
|
|
427
|
-
|
|
427
|
+
OBJETIVO PRINCIPAL:
|
|
428
|
+
Escuchar la consulta médica, extraer información estructurada y ejecutar las herramientas correspondientes.
|
|
428
429
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
- setAnalysisTitle: úsala cuando tengas contexto.
|
|
434
|
-
- getOdontogramSchema: Llámala UNA VEZ al inicio si la consulta incluye odontograma o revisión dental.
|
|
435
|
-
- findSimilarOdontogramCondition: Úsala cuando el doctor diga sinónimos o frases no exactas (ej: "caries secundaria", "diente roto", "corona filtrada").
|
|
436
|
-
- validateOdontogramActions: SIEMPRE úsala para aplicar condiciones dentales. Valida y auto-aplica acciones válidas.
|
|
430
|
+
FORMATO DE RESPUESTA:
|
|
431
|
+
1. Si necesitas usar una herramienta: EJECUTA LA HERRAMIENTA DIRECTAMENTE. No escribas introducción ni despedida.
|
|
432
|
+
2. Si el modo Autopilot está activo y falta un dato crítico: Haz una pregunta de máximo 5 palabras.
|
|
433
|
+
3. Si no es necesario hablar ni usar herramientas: Responde únicamente con el token "[WAITING]".
|
|
437
434
|
|
|
438
|
-
|
|
439
|
-
`.trim();console.log(`[Gemini Live] SYSTEM INSTRUCTION (Length: ${ke.length})`);const pe=[{functionDeclarations:[{name:"getSectionDetails",description:"Get detailed fields for a form section. Call this before updating fields in that section.",parameters:{type:Type.OBJECT,properties:{sectionId:{type:Type.STRING,description:"Section ID from available sections."}},required:["sectionId"]}},{name:"updateReport",description:"Update fields in the medical report. Use exact fieldId from getSectionDetails.",parameters:{type:Type.OBJECT,properties:{updates:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{fieldId:{type:Type.STRING,description:"Exact htmlFieldId from schema."},value:{type:Type.STRING,description:"Value to set."},reason:{type:Type.STRING,description:"Quote from conversation."}},required:["fieldId","value"]}}},required:["updates"]}},{name:"setAnalysisTitle",description:"Set the analysis title.",parameters:{type:Type.OBJECT,properties:{title:{type:Type.STRING,description:"Title for the analysis."}},required:["title"]}},{name:"updateOdontogram",description:"Update dental chart (odontogram). Use for tooth conditions like caries, crowns, implants, etc.",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"Tooth number (FDI notation: 11-18, 21-28, 31-38, 41-48, 51-55, 61-65, 71-75, 81-85)."},surface:{type:Type.STRING,description:"Optional. Surface: mesial, distal, vestibular, lingual, oclusal, incisal, center. Omit for whole-tooth conditions."},condition:{type:Type.STRING,description:"Condition ID: caries, resina_adaptada, amalgama_adaptada, sellante, ausente, corona, implante, endodoncia, extraido, exodoncia, etc."},type:{type:Type.STRING,description:"hallazgo (pathology) or hallazgo_realizado (existing treatment)."}},required:["tooth","condition","type"]}}},required:["actions"]}},{name:"clearOdontogram",description:"Clear/remove data from odontogram teeth. Use when user says 'limpiar', 'borrar', 'quitar', 'eliminar' tooth data.",parameters:{type:Type.OBJECT,properties:{teeth:{type:Type.ARRAY,items:{type:Type.STRING},description:"Array of tooth numbers to clear (e.g., ['18', '24']). Use ['all'] to clear entire odontogram."}},required:["teeth"]}},{name:"searchFields",description:"Search fields across all sections by keyword (label, description, or keywords). Use when unsure of exact fieldId or need to find related fields.",parameters:{type:Type.OBJECT,properties:{query:{type:Type.STRING,description:"Keyword to search (e.g., 'antecedentes', 'presión arterial', 'alergia')."},maxResults:{type:Type.NUMBER,description:"Maximum results (default 5, max 10)."}},required:["query"]}},{name:"getOdontogramSchema",description:"Get complete odontogram schema and exact rules. Call ONCE at start if consultation includes dental review or odontogram.",parameters:{type:Type.OBJECT,properties:{},required:[]}},{name:"validateOdontogramActions",description:"Validate proposed odontogram actions BEFORE updateOdontogram. Returns validation results and auto-applies valid actions. ALWAYS call this instead of updateOdontogram directly.",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,description:"Actions to validate and apply",items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"FDI tooth number (e.g., '18', '27')"},surface:{type:Type.STRING,description:"Optional: mesial, distal, vestibular, lingual, oclusal, incisal, center"},condition:{type:Type.STRING,description:"Condition to apply (e.g., 'caries', 'corona', 'ausente')"},type:{type:Type.STRING,description:"hallazgo (pathology) or hallazgo_realizado (treatment)"}},required:["tooth","condition","type"]}}},required:["actions"]}},{name:"findSimilarOdontogramCondition",description:"Map natural dental phrases to valid odontogram conditions. Use when doctor says synonyms, abbreviations, or non-exact terms.",parameters:{type:Type.OBJECT,properties:{phrase:{type:Type.STRING,description:"Doctor's phrase (e.g., 'caries secundaria', 'corona filtrada', 'diente roto')"},type:{type:Type.STRING,description:"Suggested type: hallazgo or hallazgo_realizado"},area:{type:Type.NUMBER,description:"Optional area (0-7) to filter valid conditions for that area"}},required:["phrase"]}}]}],Re=await Ie.live.connect({model:"gemini-2.5-flash-native-audio-preview-12-2025",config:{responseModalities:[Modality.AUDIO],systemInstruction:{parts:[{text:ke}]},tools:pe,inputAudioTranscription:{},outputAudioTranscription:{}},callbacks:{onopen:()=>{console.log("[Gemini Live] ✅ Session opened (Handshake complete)"),y(!0),L(!0),g(!1),ge.current=!0},onmessage:async j=>{var ie,Ue,Ve,He,se,ve,Te,We,je,et,tt,Qe,it,at,st,rt,ot,lt,ut,ct,ht,dt,ft;console.log("[Gemini Live] 📨 Full message:",JSON.stringify(j,null,2)),j.toolCallCancellation&&console.error("[Gemini Live] ❌ Tool call CANCELLED");const Z=j.usageMetadata||((ie=j.serverContent)==null?void 0:ie.usageMetadata)||((Ve=(Ue=j.serverContent)==null?void 0:Ue.modelTurn)==null?void 0:Ve.usageMetadata);if((j.usageMetadata||(He=j.serverContent)!=null&&He.usageMetadata)&&console.log("[Gemini Live] 📊 Message keys:",Object.keys(j)),Z){console.log("[Gemini Live] 📊 Usage metadata found:",Z);const _e=Z.promptTokenCount||0,Ke=Z.totalTokenCount||0,ee=Z.candidatesTokenCount||Math.max(0,Ke-_e);Ke>0&&Ke>=R.current.totalTokens&&(R.current.inputTokens=_e,R.current.outputTokens=ee,R.current.totalTokens=Ke,R.current.estimatedCost=Ee(_e,ee),console.log("[Gemini Live] 📊 Session usage UPDATED:",R.current),K.current&&setTimeout(()=>{var ue;return(ue=K.current)==null?void 0:ue.call(K,{...R.current})},0))}const Se=(ve=(se=j.serverContent)==null?void 0:se.inputTranscription)==null?void 0:ve.text,me=(We=(Te=j.serverContent)==null?void 0:Te.outputTranscription)==null?void 0:We.text;if(Se||me){const _e=Se?"user":"model",Ke=Se||me||"",ee=A.current&&A.current.role===_e;let ue="",te="";if(ee&&A.current?(A.current.content+=Ke,te=A.current.content,ue=A.current.id):(ue=Date.now().toString(),te=Ke,A.current={role:_e,content:te,timestamp:new Date,id:ue}),q.current){const ce={role:_e,content:te,timestamp:((je=A.current)==null?void 0:je.timestamp)||new Date,id:ue};setTimeout(()=>{var le;(le=q.current)==null||le.call(q,ce)},0)}}if(((et=j.serverContent)!=null&&et.turnComplete||(tt=j.serverContent)!=null&&tt.interrupted)&&(A.current=null),j.toolCall){const _e=[],Ke=j.toolCall.functionCalls||[];for(const ee of Ke)if(ee.name==="getSectionDetails"){const ue=(Qe=ee.args)==null?void 0:Qe.sectionId,te=G.current.find(ce=>ce.key===ue);if(te){console.log(`[Gemini Live] 📥 Loading section schema: ${ue}`);const ce={id:te.key,title:te.label,description:te.description||"",keywords:te.keywords||[],fields:te.fields.map(le=>{const W={id:le.id,htmlFieldId:le.htmlFieldId||le.id,label:le.label,type:le.type,description:le.description||"",keywords:le.keywords||[]};return le.type==="select"&&le.options&&(W.options=le.options,W.instruction='MUST use EXACT value from options list. Normalize variants (e.g., "pre ingreso" → "PREINGRESO").'),le.type==="checkbox"&&(W.instruction='Set "true" only if EXPLICITLY mentioned. Otherwise leave empty. NEVER assume.'),W}),CRITICAL:"NEVER invent or assume information. Only fill fields with data EXPLICITLY stated in the conversation. If not mentioned, DO NOT fill.",note:"SELECT: use EXACT option value. CHECKBOX: 'true' only if explicitly confirmed, otherwise leave empty."};console.log({id:ee.id,name:ee.name,response:{result:JSON.stringify(ce)}}),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(ce)}})}else console.warn(`[Gemini Live] ⚠️ Section not found: ${ue}`),_e.push({id:ee.id,name:ee.name,response:{result:"Section not found. Check available sections."}})}else if(ee.name==="setAnalysisTitle"){const ue=(it=ee.args)==null?void 0:it.title;ue&&U.current&&setTimeout(()=>{var te;return(te=U.current)==null?void 0:te.call(U,ue)},0),_e.push({id:ee.id,name:ee.name,response:{result:"Title updated"}})}else if(ee.name==="updateReport"){let ue=(at=ee.args)==null?void 0:at.updates;console.log("[Gemini Live] 🔧 updateReport raw args:",JSON.stringify(ee.args));const te=extractJson(ue);console.log("[Gemini Live] 🔧 updateReport parsed:",JSON.stringify(te));const ce=[];if(Array.isArray(te))for(const le of te){const W=extractJson(le)||le;console.log("[Gemini Live] 🔧 Processing item:",JSON.stringify(W)),W&&typeof W=="object"&&W.fieldId&&W.value!==void 0?ce.push({fieldId:String(W.fieldId),value:W.value,confidence:.9,source:"audio_live",reason:W.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid item (missing fieldId/value):",JSON.stringify(W))}else te&&typeof te=="object"?(console.log("[Gemini Live] 🔧 Single object update:",JSON.stringify(te)),te.fieldId&&te.value!==void 0?ce.push({fieldId:String(te.fieldId),value:te.value,confidence:.9,source:"audio_live",reason:te.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid object (missing fieldId/value):",JSON.stringify(te))):console.warn("[Gemini Live] ⚠️ parsedUpdates is not array or object:",typeof te);ce.length>0&&z.current?(console.log(`[Gemini Live] 📝 Updating ${ce.length} fields:`,ce.map(le=>`${le.fieldId}=${le.value}`).join(", ")),setTimeout(()=>{var le;return(le=z.current)==null?void 0:le.call(z,ce)},0)):console.warn("[Gemini Live] ⚠️ No valid updates extracted from updateReport call"),_e.push({id:ee.id,name:ee.name,response:{result:"Fields updated",count:ce.length}})}else if(ee.name==="updateOdontogram"){const ue=(st=ee.args)==null?void 0:st.actions;console.log("[Gemini Live] 🦷 updateOdontogram raw args:",JSON.stringify(ee.args));const te=extractJson(ue)||ue;console.log("[Gemini Live] 🦷 updateOdontogram parsed:",JSON.stringify(te));const ce=[],le=Array.isArray(te)?te:[te];for(const W of le)if(W&&W.tooth&&W.condition&&W.type){const Ge=String(W.tooth),be=surfaceToArea(W.surface),Fe=W.type,Me=validateOdontogramAction({key:Ge,type:Fe,area:be,action:W.condition});Me.valid?(ce.push({tooth:Ge,surface:W.surface,condition:W.condition,type:Fe}),console.log(`[Gemini Live] ✅ Valid odontogram action: tooth=${Ge}, area=${be}, action=${W.condition}`)):console.warn(`[Gemini Live] ❌ Invalid odontogram action: ${Me.error}`)}if(ce.length>0&&Q.current){console.log(`[Gemini Live] 🦷 Updating odontogram with ${ce.length} valid actions:`,ce),setTimeout(()=>{var W;return(W=Q.current)==null?void 0:W.call(Q,ce)},0);for(const W of ce){const Ge=surfaceToArea(W.surface),be={type:"FROM_EXTENSION",fieldId:"odontograma",payload:{key:W.tooth,type:W.type,area:Ge,action:W.condition}};console.log("[Gemini Live] 📤 Sending FROM_EXTENSION postMessage (local):",be),window.postMessage(be,"*");const Fe=document.getElementsByTagName("iframe");console.log(`[Gemini Live] 📤 Broadcasting FROM_EXTENSION to ${Fe.length} iframes`);for(let Me=0;Me<Fe.length;Me++)try{(rt=Fe[Me].contentWindow)==null||rt.postMessage(be,"*"),console.log(`[Gemini Live] ✅ Sent FROM_EXTENSION to iframe ${Me}`)}catch(Xe){console.log(`[Gemini Live] ❌ Failed to send to iframe ${Me}:`,Xe)}}}_e.push({id:ee.id,name:ee.name,response:{result:"Odontogram updated",count:ce.length}})}else if(ee.name==="clearOdontogram"){const ue=(ot=ee.args)==null?void 0:ot.teeth;console.log("[Gemini Live] 🦷 clearOdontogram raw args:",JSON.stringify(ee.args));const te=Array.isArray(ue)?ue.map(String):[String(ue)];te.length>0&&ne.current&&(console.log("[Gemini Live] 🦷 Clearing odontogram teeth:",te),setTimeout(()=>{var ce;return(ce=ne.current)==null?void 0:ce.call(ne,te)},0)),_e.push({id:ee.id,name:ee.name,response:{result:"Odontogram teeth cleared",count:te.length}})}else if(ee.name==="searchFields"){const ue=String(((lt=ee.args)==null?void 0:lt.query)||"").toLowerCase().trim(),te=Math.min(Number((ut=ee.args)==null?void 0:ut.maxResults)||5,10);console.log(`[Gemini Live] 🔍 searchFields query="${ue}", maxResults=${te}`);const ce=G.current.flatMap(le=>le.fields.filter(W=>{var Ge,be,Fe;return((Ge=W.label)==null?void 0:Ge.toLowerCase().includes(ue))||((be=W.description)==null?void 0:be.toLowerCase().includes(ue))||((Fe=W.keywords)==null?void 0:Fe.some(Me=>Me.toLowerCase().includes(ue)))}).map(W=>({sectionId:le.key,sectionLabel:le.label,fieldId:W.htmlFieldId||W.id,label:W.label,type:W.type,description:W.description||""}))).slice(0,te);console.log(`[Gemini Live] 🔍 searchFields found ${ce.length} results:`,ce),_e.push({id:ee.id,name:ee.name,response:{result:ce.length>0?`Found ${ce.length} fields: ${JSON.stringify(ce)}`:"No fields found with that keyword. Use getSectionDetails to explore a specific section."}})}else if(ee.name==="getOdontogramSchema"){console.log("[Gemini Live] 🦷 Loading complete odontogram schema");const ue={description:"Complete Clara odontogram schema. Use these EXACT rules for updateOdontogram.",surfaceMapping:{whole:0,completo:0,vestibular:1,bucal:1,top:1,lingual:2,palatal:2,palatino:2,bottom:2,mesial:3,left:3,distal:4,right:4,oclusal:5,incisal:5,center:5},validToothKeys:["11","11SN","11SNRX","12","12SN","12SNRX","13","13SN","13SNRX","14","14SN","14SNRX","15","15SN","15SNRX","16","16SN","16SNRX","17","17SN","17SNRX","18","18SN","18SNRX","21","21SN","21SNRX","22","22SN","22SNRX","23","23SN","23SNRX","24","24SN","24SNRX","25","25SN","25SNRX","26","26SN","26SNRX","27","27SN","27SNRX","28","28SN","28SNRX","31","31SN","31SNRX","32","32SN","32SNRX","33","33SN","33SNRX","34","34SN","34SNRX","35","35SN","35SNRX","36","36SN","36SNRX","37","37SN","37SNRX","38","38SN","38SNRX","41","41SN","41SNRX","42","42SN","42SNRX","43","43SN","43SNRX","44","44SN","44SNRX","45","45SN","45SNRX","46","46SN","46SNRX","47","47SN","47SNRX","48","48SN","48SNRX","51","51SN","51SNRX","52","52SN","52SNRX","53","53SN","53SNRX","54","54SN","54SNRX","55","55SN","55SNRX","61","61SN","61SNRX","62","62SN","62SNRX","63","63SN","63SNRX","64","64SN","64SNRX","65","65SN","65SNRX","71","71SN","71SNRX","72","72SN","72SNRX","73","73SN","73SNRX","74","74SN","74SNRX","75","75SN","75SNRX","81","81SN","81SNRX","82","82SN","82SNRX","83","83SN","83SNRX","84","84SN","84SNRX","85","85SN","85SNRX"],validActionsByTypeAndArea:{hallazgo:{0:["ok","corona","corona_provisional","carilla","resto_radicular","abrasion_erosion","implante_afectado","endodoncia","exodoncia","ausente","sin_erupcionar","exodoncia_qx","mov_grado_1","mov_grado_2","mov_grado_3","pulido","radiografia","supernumerario","supernumerario_rx","parcialmente_erupcionado_o_impactado"],1:["resina_cervical"],2:["resina_cervical"],3:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],4:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_mesial"],5:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],6:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_distal"],7:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"]},hallazgo_realizado:{0:["corona","carilla","implante","endodoncia","extraido","ausente","sin_erupcionar","parcialmente_erupcionado_o_impactado"],1:["resina_cervical"],2:["resina_cervical"],3:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],4:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_mesial"],5:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],6:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_distal"],7:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"]}},rules:["For whole tooth conditions (ausente, corona, implante, endodoncia), do NOT include surface.","If surface not specified and condition is surface-based (caries, resina), use 'oclusal' or 'center'.","type='hallazgo' for pathologies, 'hallazgo_realizado' for existing treatments.","ALWAYS use EXACT actions from validActionsByTypeAndArea."],voiceExamples:["Caries oclusal en 18 → tooth:'18', surface:'oclusal', condition:'caries', type:'hallazgo'","Corona en 27 → tooth:'27', condition:'corona', type:'hallazgo_realizado' (no surface)","Ausente 48 → tooth:'48', condition:'ausente', type:'hallazgo'"]};_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(ue)}})}else if(ee.name==="validateOdontogramActions"){const ue=(ct=ee.args)==null?void 0:ct.actions,te=Array.isArray(ue)?ue:[];console.log("[Gemini Live] 🦷 validateOdontogramActions received:",te);const ce=te.map(W=>{var Ye,nt,pt;if(!W.tooth||!W.condition||!W.type)return{original:W,valid:!1,error:"Missing required properties: tooth, condition, type"};const Ge=String(W.tooth),be=W.type,Fe=W.surface?surfaceToArea(W.surface):0,Me=validateOdontogramAction({key:Ge,type:be,area:Fe,action:W.condition});if(Me.valid)return{original:W,valid:!0,applied:{tooth:Ge,surface:W.surface||null,condition:W.condition,type:be}};let Xe=null;return(Ye=Me.error)!=null&&Ye.includes("Invalid tooth key")?Xe="Verify FDI tooth number or add SN/SNRX suffix for supernumerary.":(nt=Me.error)!=null&&nt.includes("Invalid action")?Xe="Use a valid condition for this type and area. Check getOdontogramSchema.":(pt=Me.error)!=null&&pt.includes("Invalid area")&&(Xe="Surface not allowed for this condition. Use 'center' for surface conditions, or omit surface for whole tooth."),{original:W,valid:!1,error:Me.error,suggestion:Xe}}),le=ce.filter(W=>W.valid).map(W=>W.applied).filter(Boolean);console.log("[Gemini Live] 🦷 Validation results:",{total:te.length,valid:le.length,invalid:te.length-le.length}),le.length>0&&Q.current&&(console.log(`[Gemini Live] 🦷 Auto-applying ${le.length} valid actions via callback`),setTimeout(()=>{var W;return(W=Q.current)==null?void 0:W.call(Q,le)},0)),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify({summary:`${le.length} of ${te.length} actions valid and applied`,details:ce})}})}else if(ee.name==="findSimilarOdontogramCondition"){const ue=String(((ht=ee.args)==null?void 0:ht.phrase)||"").toLowerCase().trim(),te=((dt=ee.args)==null?void 0:dt.type)||"hallazgo",ce=(ft=ee.args)==null?void 0:ft.area;console.log(`[Gemini Live] 🔍 findSimilarOdontogramCondition: "${ue}", type=${te}, area=${ce}`);const le={caries:{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries secundaria":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries recurrente":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries proximal":{condition:"caries",type:"hallazgo",areas:[3,4]},"caries interproximal":{condition:"caries",type:"hallazgo",areas:[3,4]},"caries cervical":{condition:"caries",type:"hallazgo",areas:[1,2]},"caries de cuello":{condition:"caries",type:"hallazgo",areas:[1,2]},"lesion cariosa":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},cavidad:{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},fractura:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},fracturado:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},roto:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},fisura:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},grieta:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"linea de fractura":{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"diente roto":{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"resina desadaptada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"resina filtrada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"resina con filtracion":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"composite filtrado":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"restauracion desadaptada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"restauracion filtrada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama desadaptada":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama filtrada":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama con filtracion":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"obturacion temporal":{condition:"obturacion_temporal",type:"hallazgo",areas:[3,4,5,6,7]},provisional:{condition:"obturacion_temporal",type:"hallazgo",areas:[3,4,5,6,7]},resina:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina adaptada":{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina ok":{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},composite:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},restauracion:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},amalgama:{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"amalgama adaptada":{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"amalgama ok":{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},sellante:{condition:"sellante",type:"hallazgo_realizado",areas:[3,4,5,6,7]},sellador:{condition:"sellante",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina cervical":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},"clase v":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},"clase 5":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},corona:{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona metal":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona ceramica":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona porcelana":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona zirconio":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona defectuosa":{condition:"corona",type:"hallazgo",areas:[0]},"corona filtrada":{condition:"corona",type:"hallazgo",areas:[0]},"corona provisional":{condition:"corona_provisional",type:"hallazgo",areas:[0]},"corona temporal":{condition:"corona_provisional",type:"hallazgo",areas:[0]},carilla:{condition:"carilla",type:"hallazgo_realizado",areas:[0]},veneer:{condition:"carilla",type:"hallazgo_realizado",areas:[0]},endodoncia:{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"tratamiento de conductos":{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},conducto:{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"tratado endodonticamente":{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"necesita endodoncia":{condition:"endodoncia",type:"hallazgo",areas:[0]},implante:{condition:"implante",type:"hallazgo_realizado",areas:[0]},"implante dental":{condition:"implante",type:"hallazgo_realizado",areas:[0]},"implante afectado":{condition:"implante_afectado",type:"hallazgo",areas:[0]},periimplantitis:{condition:"implante_afectado",type:"hallazgo",areas:[0]},ausente:{condition:"ausente",type:"hallazgo",areas:[0]},falta:{condition:"ausente",type:"hallazgo",areas:[0]},"no esta":{condition:"ausente",type:"hallazgo",areas:[0]},extraido:{condition:"extraido",type:"hallazgo_realizado",areas:[0]},extraccion:{condition:"exodoncia",type:"hallazgo",areas:[0]},exodoncia:{condition:"exodoncia",type:"hallazgo",areas:[0]},"para extraer":{condition:"exodoncia",type:"hallazgo",areas:[0]},"indicado para extraccion":{condition:"exodoncia",type:"hallazgo",areas:[0]},"exodoncia quirurgica":{condition:"exodoncia_qx",type:"hallazgo",areas:[0]},movilidad:{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"movilidad grado 1":{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"movilidad grado 2":{condition:"mov_grado_2",type:"hallazgo",areas:[0]},"movilidad grado 3":{condition:"mov_grado_3",type:"hallazgo",areas:[0]},movil:{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"muy movil":{condition:"mov_grado_2",type:"hallazgo",areas:[0]},"sin erupcionar":{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},"no erupcionado":{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},retenido:{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},impactado:{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"parcialmente erupcionado":{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"semi incluido":{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"resto radicular":{condition:"resto_radicular",type:"hallazgo",areas:[0]},raiz:{condition:"resto_radicular",type:"hallazgo",areas:[0]},abrasion:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},erosion:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},desgaste:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},"fosas profundas":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},"fisuras profundas":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},"surcos profundos":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},supernumerario:{condition:"supernumerario",type:"hallazgo",areas:[0]},"diente extra":{condition:"supernumerario",type:"hallazgo",areas:[0]},ok:{condition:"ok",type:"hallazgo",areas:[0]},sano:{condition:"ok",type:"hallazgo",areas:[0]},normal:{condition:"ok",type:"hallazgo",areas:[0]},"angulo mesial":{condition:"angulo_mesial",type:"hallazgo_realizado",areas:[4]},"angulo distal":{condition:"angulo_distal",type:"hallazgo_realizado",areas:[6]},"angulo mesial roto":{condition:"angulo_mesial",type:"hallazgo",areas:[4]},"angulo distal roto":{condition:"angulo_distal",type:"hallazgo",areas:[6]}};let W=null;for(const be in le)if(ue===be||ue.includes(be)){W={...le[be],confidence:ue===be?1:.9};break}if(!W){const be=ue.split(/\s+/);for(const Fe in le){const Me=Fe.split(/\s+/),Xe=Me.filter(Ye=>be.some(nt=>nt.includes(Ye)||Ye.includes(nt)));if(Xe.length>0){const Ye=Xe.length/Me.length*.7;(!W||Ye>W.confidence)&&(W={...le[Fe],confidence:Ye})}}}W&&te&&(W.type=te),W&&ce!==void 0&&W.areas&&(W.areas.includes(ce)||(W={...W,confidence:W.confidence*.5}));const Ge=W||{condition:"caries",type:te,confidence:.1,note:"No exact match found, defaulting to caries"};console.log(`[Gemini Live] 🔍 Best match for "${ue}":`,Ge),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(Ge)}})}else _e.push({id:ee.id,name:ee.name,response:{result:"Acknowledged"}});if(V.current&&_e.length>0)try{V.current.sendToolResponse({functionResponses:_e})}catch(ee){console.error("[Gemini Live] ❌ Error sending tool responses:",ee)}}},onclose:j=>{ye.current||(console.log("[Gemini Live] Session closed unexpectedly",j),y(!1),L(!1),g(!1),j.code===1011&&E("Payload too large. Contact support."))},onerror:j=>{var Z,Se;console.error("[Gemini Live] ❌ SESSION ERROR:",j),((Z=j.message)!=null&&Z.includes("Fatal")||(Se=j.message)!=null&&Se.includes("Close"))&&(E("Connection error"),y(!1),L(!1))}}});V.current=Re,console.log("[Gemini Live] Session created, waiting for onopen...");const Pe=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:16e3,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0,deviceId:l?{exact:l}:void 0}});N.current=Pe;const $e=new Blob([WORKLET_CODE],{type:"application/javascript"}),Ze=URL.createObjectURL($e);try{await he.audioWorklet.addModule(Ze)}catch{throw new Error("Failed to load audio processor")}finally{URL.revokeObjectURL(Ze)}const Je=he.createMediaStreamSource(Pe),qe=new AudioWorkletNode(he,"pcm-processor");qe.port.onmessage=j=>{if(!ge.current)return;const Z=j.data;if(O.current.push(Z),b.current+=Z.length,b.current>=I){if(!ge.current){O.current=[],b.current=0;return}const Se=new Float32Array(b.current);let me=0;for(const ie of O.current)Se.set(ie,me),me+=ie.length;oe(Se),O.current=[],b.current=0}},Je.connect(qe);const J=he.createGain();J.gain.value=0,qe.connect(J),J.connect(he.destination),$.current=Je,H.current=qe}catch(de){console.error("[Gemini Live] Connection failed",de),g(!1),y(!1),L(!1),(ae=de.message)!=null&&ae.includes("401")||(re=de.message)!=null&&re.includes("API Key")?(E("Invalid API Key"),T(!1)):E("Connection failed")}}},[xe,oe,S,n,l,u,d,p,L]);React.useEffect(()=>{let ae;return P&&!x&&!S&&(ae=setTimeout(()=>{Y()},500)),()=>{ae&&clearTimeout(ae)}},[P,x,S,Y]);const Ne=React.useCallback(()=>{T(!0)},[]),Oe=React.useCallback(()=>{T(!1),xe()},[xe]),Le=React.useCallback(()=>{D(ae=>{const re=!ae;return k.current=re,N.current&&N.current.getAudioTracks().forEach(de=>{de.enabled=!re}),re&&_(0),re})},[]),Ce=React.useCallback(ae=>{if(V.current)try{V.current.sendRealtimeInput({clientContent:{turns:[{parts:[{text:ae}],role:"user"}],turnComplete:!0}})}catch(re){console.error("[Gemini Live] Failed to send text",re)}},[]),De=React.useCallback(()=>({...R.current}),[]);return{isRecording:P,isConnected:x,isConnecting:S,isPaused:M,error:C,audioLevel:B,startRecording:Ne,stopRecording:Oe,togglePause:Le,sendText:Ce,getSessionUsage:De}};function useDebouncedFormDataSync(n,e=500,i){const a=React.useRef(null),s=React.useRef(null),r=React.useRef(!1);React.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const o=React.useCallback(async()=>{if(s.current&&(clearTimeout(s.current),s.current=null),a.current&&n&&!r.current){r.current=!0;const u=a.current;a.current=null;try{console.log("[DebouncedSync] Flushing formData to backend");const c=i==null?void 0:i();await claraApi.updateFormData(n,u.formData,u.documentChanges,u.chatHistory,c)}catch(c){console.error("[DebouncedSync] Error flushing formData:",c)}finally{r.current=!1}}},[n,i]);return{queueSync:React.useCallback((u,c,d)=>{var p,f,m;n&&(a.current={formData:{...(p=a.current)==null?void 0:p.formData,...u},documentChanges:c||((f=a.current)==null?void 0:f.documentChanges),chatHistory:d||((m=a.current)==null?void 0:m.chatHistory)},s.current&&clearTimeout(s.current),s.current=setTimeout(async()=>{if(!a.current||!n||r.current)return;r.current=!0;const P=a.current;a.current=null;try{console.log("[DebouncedSync] Syncing formData to backend");const T=i==null?void 0:i();console.log("[DebouncedSync] 📊 Got usageStats:",T),await claraApi.updateFormData(n,P.formData,P.documentChanges,P.chatHistory,T)}catch(T){console.error("[DebouncedSync] Error syncing formData:",T),a.current=P}finally{r.current=!1}},e))},[n,e,i]),flush:o}}const ClaraActiveSession=({onEndSession:n,primaryColor:e,sessionControlRef:i})=>{var Ze,Je,qe;const[a,s]=React.useState("transcription"),[r,o]=React.useState(!0),[l,u]=React.useState(3),c=React.useRef(null),d=React.useRef(null),p=React.useRef(!1),f=React.useRef(null),m=React.useRef(null),P=React.useRef(new Date().toISOString()),{config:T,accessToken:x,currentTemplate:y,currentAnalysis:S,transcriptMessages:g,chatMessages:C,isAutopilot:E,speechSpeed:B,voiceStyle:_,formData:M,documentChanges:D,userStreamInfo:L,analysisStreamInfo:F,isS2Connected:N,usageStats:H,addTranscriptMessage:$,addChatMessage:O,updateFormData:b,setFormData:I,setAnalysisTitle:V,setCurrentAnalysis:A,setUserStreamInfo:k,setAnalysisStreamInfo:R,setS2Connected:G,setUsageStats:z,clearSessionData:q}=useClaraStore(),U=T.lang||"es",K=React.useRef(null),Q=React.useRef(M);React.useEffect(()=>{Q.current=M},[M]);const{queueSync:ne,flush:Ee}=useDebouncedFormDataSync(S==null?void 0:S.id,500,()=>{var J;return((J=K.current)==null?void 0:J.call(K))??{inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0}}),ye=React.useCallback(J=>{try{console.log("[Session] Data extracted:",J);const j={...Q.current};J.forEach(Z=>{try{b(Z.fieldId,Z.value,"ai_tool",Z.reason||"AI extraction"),j[Z.fieldId]=Z.value,sendFillCommand(Z.fieldId,Z.value),emitFieldFilled(Z.fieldId,Z.value),F&&(S!=null&&S.id)&&sendAIFill(F,S.id,Z.fieldId,Z.value)}catch(Se){console.error("[Session] Error processing field:",Z.fieldId,Se)}}),ne(j),emitFormDataUpdated(j,void 0,J.map(Z=>Z.fieldId))}catch(j){console.error("[Session] ❌ Error in handleDataExtracted:",j)}},[b,F,ne]),ge=React.useCallback(J=>{console.log("[Session] Transcript:",J),$(J);const j=[...g,J];emitTranscriptUpdated(J.role,J.content,j.map(Z=>({role:Z.role,content:Z.content,timestamp:Z.timestamp.toISOString()}))),F&&sendTranscript(F,j.map(Z=>({role:Z.role,content:Z.content,timestamp:Z.timestamp.toISOString()}))),S!=null&&S.id&&claraApi.syncTranscriptToDB(S.id,j)},[$,g,F,S]),xe=React.useCallback(J=>{console.log("[Session] Title updated:",J),V(J),emitTitleUpdated(J,S==null?void 0:S.id),F&&sendTitleUpdate(F,J),S!=null&&S.id&&claraApi.updateAnalysisTitle(S.id,J)},[V,S,F]),oe=React.useCallback(J=>{z(J)},[z]),Y=React.useCallback(J=>{var j,Z,Se;try{console.log("[Session] 🦷 Odontogram actions:",J);const me=(Se=(Z=(j=y==null?void 0:y.structure)==null?void 0:j.sections)==null?void 0:Z.flatMap(ve=>ve.fields))==null?void 0:Se.find(ve=>ve.type==="odontogram");if(!me){console.warn("[Session] ⚠️ No odontogram field found in template");return}const ie=me.htmlFieldId||me.id,Ve={...Q.current[ie]||{}},He={mesial:"left",distal:"right",vestibular:"top",lingual:"bottom",palatal:"bottom",oclusal:"center",incisal:"center",center:"center",top:"top",bottom:"bottom",left:"left",right:"right"};for(const ve of J){const Te=ve.tooth,We=ve.type;if(Ve[Te]||(Ve[Te]={id:Te,surfaces:{}}),ve.surface){const je=He[ve.surface.toLowerCase()]||"center";Ve[Te].surfaces[je]={condition:ve.condition,type:We}}else Ve[Te].whole=ve.condition,Ve[Te].wholeType=We}console.log("[Session] 🦷 Updated teeth map:",Ve),b(ie,Ve,"ai_tool","Odontogram AI update"),emitOdontogramUpdated(ie,Ve),emitFieldFilled(ie,Ve),F&&(S!=null&&S.id)&&sendToS2(F,{action:"odontogram",fieldId:ie,value:Ve,editorSource:"clara",source:"web_client"});const se={...Q.current,[ie]:Ve};ne(se),emitFormDataUpdated(se,void 0,[ie])}catch(me){console.error("[Session] ❌ Error in handleOdontogramUpdate:",me)}},[y,b,F,S,ne]),Ne=React.useCallback(J=>{var j,Z,Se;try{console.log("[Session] 🦷 Clearing odontogram teeth:",J);const me=(Se=(Z=(j=y==null?void 0:y.structure)==null?void 0:j.sections)==null?void 0:Z.flatMap(se=>se.fields))==null?void 0:Se.find(se=>se.type==="odontogram");if(!me){console.warn("[Session] ⚠️ No odontogram field found in template");return}const ie=me.htmlFieldId||me.id,Ue=Q.current[ie]||{};let Ve;if(J.includes("all"))Ve={};else{Ve={...Ue};for(const se of J)delete Ve[se]}b(ie,Ve,"ai_tool",`Cleared teeth: ${J.join(", ")}`),emitOdontogramCleared(ie,J);const He={...Q.current,[ie]:Ve};ne(He),emitFormDataUpdated(He,void 0,[ie])}catch(me){console.error("[Session] ❌ Error in handleOdontogramClear:",me)}},[y,b,ne]),Oe=React.useCallback(J=>{if(console.log("[Session] Field interaction:",J),J.action==="change"&&J.value!==void 0){b(J.fieldId,J.value,"user","Manual edit"),F&&sendToS2(F,{action:"fill",fieldId:J.fieldId,value:J.value,sectionKey:J.sectionKey,editorSource:"user",source:"web_client"});const j={...Q.current,[J.fieldId]:J.value};ne(j)}},[b,F,ne]),{isRecording:Le,isConnected:Ce,isConnecting:De,isPaused:ae,error:re,audioLevel:de,startRecording:Be,stopRecording:he,togglePause:Ie,getSessionUsage:Ae}=useGeminiLive({geminiApiKey:T.geminiApiKey,onDataExtracted:ye,onTranscriptUpdate:ge,onTitleUpdate:xe,onUsageUpdate:oe,onOdontogramUpdate:Y,onOdontogramClear:Ne,isAutopilot:E,speechSpeed:B,style:_,sections:((Ze=y==null?void 0:y.structure)==null?void 0:Ze.sections)||[]});React.useEffect(()=>{K.current=Ae},[Ae]);const fe=De?SessionStatus.CONNECTING:Ce&&!ae?SessionStatus.ACTIVE:Ce&&ae?SessionStatus.PAUSED:SessionStatus.DISCONNECTED;React.useEffect(()=>(f.current=setInterval(()=>{u(J=>J<=1?(f.current&&clearInterval(f.current),0):J-1)},1e3),()=>{f.current&&clearInterval(f.current)}),[]),React.useEffect(()=>{Ce&&(o(!1),f.current&&clearInterval(f.current))},[Ce]);const ke=React.useRef(!1);React.useEffect(()=>{const J=claraApi.hasAuth()||T.apiKey||x;if(!J||ke.current){J||console.log("[Session] Waiting for auth...");return}return(async()=>{var Ve;ke.current=!0,claraApi.hasAuth()||(T.apiKey?claraApi.setApiKey(T.apiKey):x&&claraApi.setAccessToken(x)),console.log("[Session] Initializing session (optimized parallel)...");const Z=performance.now(),[Se,me]=await Promise.all([claraApi.fetchUserStreamToken(),y&&!S?claraApi.createAnalysis(y.id,y):Promise.resolve(S)]);Se&&(k(Se),console.log("[Session] User stream token obtained"));const ie=me||S;if(ie)A(ie),console.log("[Session] Analysis ready:",ie.id);else{console.error("[Session] No analysis available");return}const Ue=await claraApi.fetchAnalysisStreamToken(ie.id,(Ve=ie.stream)==null?void 0:Ve.id);if(Ue){R(Ue);const He=new S2StreamListener(Ue,{onFill:(se,ve,Te)=>{console.log("[S2 → Widget] 📥 Remote fill received:",{fieldId:se,value:ve,sectionKey:Te}),sendFillCommand(se,ve,Te),b(se,ve,"agent","S2 remote fill"),emitFieldFilled(se,ve,Te)},onFillMultiple:se=>{console.log("[S2 → Widget] 📥 Remote fillMultiple received:",se);const ve={...M};se.forEach(Te=>{sendFillCommand(Te.fieldId,Te.value,Te.sectionKey),b(Te.fieldId,Te.value,"agent","S2 remote fill"),ve[Te.fieldId]=Te.value}),emitFormDataUpdated(ve,void 0,se.map(Te=>Te.fieldId))},onChatMessage:se=>{const ve=se;if(ve.source!=="widget"){const Te=ve.id||`${se.role}-${se.content}-${se.timestamp}`;O({id:Te,role:se.role==="assistant"?"model":se.role,content:se.content,timestamp:new Date(se.timestamp||Date.now())})}},onOdontogram:se=>{var je,et,tt;console.log("[S2 → Widget] 🦷 Remote odontogram received:",se);const ve=(tt=(et=(je=y==null?void 0:y.structure)==null?void 0:je.sections)==null?void 0:et.flatMap(Qe=>Qe.fields))==null?void 0:tt.find(Qe=>Qe.type==="odontogram");if(!ve){console.warn("[S2] ⚠️ No odontogram field found in template");return}const Te=se.fieldId||ve.htmlFieldId||ve.id,We=se.value||se;b(Te,We,"agent","S2 remote odontogram"),emitOdontogramUpdated(Te,We),emitFieldFilled(Te,We)},onTranscript:se=>{},onTitleUpdate:se=>{V(se),emitTitleUpdated(se,ie==null?void 0:ie.id)},onPing:()=>{},onError:se=>{console.error("[Session] S2 Error:",se),G(!1)},onDisconnect:()=>G(!1)});d.current=He,He.start(),G(!0)}p.current||(setupFieldListeners(Oe),setupSectionListeners(),p.current=!0),Be(),Se&&ie&&(notifyUserStream(Se,{action:"analysis_selected",analysisId:ie.id,source:"web_agent"}),notifyUserStream(Se,{action:"session_status",status:"started",analysisId:ie.id,source:"web_agent"})),emitSessionStarted(ie.id),console.log(`[Session] Init completed in ${(performance.now()-Z).toFixed(0)}ms`)})(),()=>{d.current&&d.current.stop()}},[T.apiKey]),React.useEffect(()=>{if(!F||!(S!=null&&S.id))return;const J=()=>{sendSessionStatus(F,{status:ae?"paused":"recording",isPaused:ae,isConnected:N,analysisId:S.id,templateName:y==null?void 0:y.name,formDataCount:Object.keys(M).length,transcriptCount:g.length,startedAt:P.current})};return J(),m.current=setInterval(J,5e3),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[F,S==null?void 0:S.id,ae,N]);const pe=React.useCallback(async()=>{console.log("[Session] Stopping session..."),m.current&&(clearInterval(m.current),m.current=null),await Ee();const J=Ae();if(console.log("[Session] Final usage stats:",J),he(),F&&await sendSessionStatus(F,{status:"stopped",isPaused:!1,isConnected:!1,analysisId:S==null?void 0:S.id}),d.current&&(d.current.stop(),d.current=null),G(!1),S!=null&&S.id){const j=C.map(Z=>({id:Z.id||Date.now().toString(),role:Z.role,text:Z.content}));await claraApi.completeAnalysis(S.id,M,D,g,j,J.totalTokens>0?J:void 0)}L&&(S!=null&&S.id)&¬ifyUserStream(L,{action:"session_status",status:"completed",analysisId:S.id,source:"web_agent"},!0),emitSessionStopped(S==null?void 0:S.id),q(),n()},[he,Ae,n,S,M,D,g,C,L,F,G,q,Ee]);React.useEffect(()=>{i&&(i.current={disconnect:pe,togglePause:Ie,isPaused:ae})},[i,pe,Ie,ae]),React.useEffect(()=>{const J=()=>{Ce&&(S!=null&&S.id)&&L&¬ifyUserStream(L,{action:"session_status",status:"completed",analysisId:S.id,source:"web_agent"},!0)};return window.addEventListener("beforeunload",J),()=>window.removeEventListener("beforeunload",J)},[Ce,S,L]),React.useEffect(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[g,a]);const Pe=(()=>{switch(fe){case SessionStatus.ACTIVE:return{bgClass:"bg-clara-success/20",borderClass:"border-clara-success/50",textClass:"text-clara-success",dotClass:"bg-clara-success animate-pulse",label:t("session.recording",U)};case SessionStatus.PAUSED:return{bgClass:"bg-clara-warning/20",borderClass:"border-clara-warning/50",textClass:"text-clara-warning",dotClass:"bg-clara-warning",label:t("session.paused",U)};case SessionStatus.CONNECTING:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground animate-pulse",label:t("common.loading",U)};case SessionStatus.DISCONNECTED:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground",label:U==="en"?"Ready":"Listo"};case SessionStatus.ERROR:default:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground",label:U==="en"?"Ready":"Listo"}}})(),$e=()=>jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 h-4",children:Array.from({length:5}).map((j,Z)=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full transition-all duration-75",style:{backgroundColor:de>Z/5?e:"#374151",height:`${Math.max(20,(Z+1)*20)}%`}},Z))});return jsxRuntime.jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col h-full bg-clara-surface relative",children:[jsxRuntime.jsx(AnimatePresence,{children:r&&l>0&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-[120] flex items-center justify-center bg-black/60 backdrop-blur-sm rounded-2xl",children:jsxRuntime.jsx(motion.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},exit:{scale:1.5,opacity:0},className:"text-white text-8xl font-black drop-shadow-lg",children:l},l)})}),jsxRuntime.jsxs("div",{className:"bg-clara-dark text-white px-3 py-2.5 flex justify-between items-center shadow-md z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ChartColumn,{className:"w-4 h-4 text-clara-success"}),jsxRuntime.jsx("span",{className:"font-semibold text-xs tracking-wide uppercase",children:t("session.recording",U)}),Ce&&$e(),jsxRuntime.jsx("span",{title:N?"S2 Conectado":"S2 Desconectado",children:N?jsxRuntime.jsx(Wifi,{className:"w-3 h-3 text-clara-success"}):jsxRuntime.jsx(WifiOff,{className:"w-3 h-3 text-muted-foreground"})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[re&&jsxRuntime.jsx("span",{className:"text-destructive text-[10px] mr-2",children:re}),jsxRuntime.jsx("button",{onClick:Ie,disabled:!Ce,className:"p-1 rounded-full bg-gray-700 hover:bg-gray-600 transition-colors disabled:opacity-50",title:fe===SessionStatus.ACTIVE?t("session.pause",U):t("session.resume",U),children:fe===SessionStatus.PAUSED?jsxRuntime.jsx(Play,{className:"w-2.5 h-2.5",fill:"currentColor"}):jsxRuntime.jsx(Pause,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsx("button",{onClick:pe,className:"p-1 rounded-full bg-destructive/30 hover:bg-destructive/50 text-destructive-foreground border border-destructive/50 transition-colors",title:t("session.stop",U),children:jsxRuntime.jsx(Square,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:`flex items-center gap-1 px-2 py-0.5 rounded-full border text-[10px] font-medium ${Pe.bgClass} ${Pe.borderClass} ${Pe.textClass}`,children:[jsxRuntime.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${Pe.dotClass}`}),Pe.label]})]})]}),jsxRuntime.jsx("div",{className:"flex bg-card border-b border-border",children:["assistant","transcription","report"].map(J=>jsxRuntime.jsxs("button",{onClick:()=>s(J),className:`flex-1 py-2.5 text-[10px] font-bold tracking-wider uppercase transition-colors relative ${a===J?"":"text-muted-foreground hover:text-foreground"}`,style:a===J?{color:e}:{},children:[t(J==="assistant"?"tabs.chat":J==="transcription"?"tabs.transcript":"tabs.report",U),a===J&&jsxRuntime.jsx(motion.div,{layoutId:"activeSessionTab",className:"absolute bottom-0 left-0 w-full h-0.5",style:{backgroundColor:e}})]},J))}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a==="assistant"&&jsxRuntime.jsx("div",{className:"flex-1 flex flex-col min-h-0",children:jsxRuntime.jsx(ClaraChat,{primaryColor:e})}),a==="transcription"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col p-3",children:[jsxRuntime.jsx("div",{className:"mb-3 p-2 bg-clara-warning/10 border border-clara-warning/30 rounded-lg",children:jsxRuntime.jsxs("p",{className:"text-[10px] text-clara-warning font-medium text-center",children:["⚠️ ",t("transcript.provisional",U)]})}),jsxRuntime.jsx("div",{ref:c,className:"flex-1 overflow-y-auto space-y-3",children:g.length===0?jsxRuntime.jsx("div",{className:"text-center text-muted-foreground mt-12 text-xs",children:t(De?"transcript.connecting":Ce?"transcript.listening":"transcript.startSession",U)}):g.map((J,j)=>jsxRuntime.jsx("div",{className:`flex flex-col ${J.role==="user"?"items-end":"items-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] px-2.5 py-2 rounded-lg text-xs ${J.role==="user"?"bg-card border border-border text-foreground rounded-tr-none shadow-sm":"rounded-tl-none"}`,style:J.role!=="user"?{borderColor:`${e}33`,backgroundColor:`${e}0D`,color:"inherit"}:{},children:J.content})},j))})]}),a==="report"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col overflow-y-auto p-4 bg-card overscroll-contain",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("h2",{className:"text-sm font-bold text-foreground",children:t("report.capturedData",U)}),jsxRuntime.jsxs("button",{onClick:()=>{var me;const J=((me=y==null?void 0:y.structure)==null?void 0:me.sections)||[],j=window.open("","_blank");if(!j)return;let Z=`
|
|
435
|
+
REGLAS DE INTERACCIÓN:
|
|
436
|
+
- Tono: Clínico, neutro, robótico.
|
|
437
|
+
- Prohibido: Saludos, confirmaciones ("Entendido", "Haciendo eso"), agradecimientos.
|
|
438
|
+
- Prioridad: La ejecución de herramientas tiene prioridad sobre cualquier texto.
|
|
439
|
+
|
|
440
|
+
FLUJO DE TRABAJO (ODONTOGRAMA):
|
|
441
|
+
Si detectas intención de odontograma/dental:
|
|
442
|
+
1. Llama a getOdontogramSchema.
|
|
443
|
+
2. Analiza la condición. Si el término no es exacto, usa findSimilarOdontogramCondition.
|
|
444
|
+
3. Finalmente, usa validateOdontogramActions.
|
|
445
|
+
|
|
446
|
+
CONTEXTO TÉCNICO:
|
|
447
|
+
${we}
|
|
448
|
+
${Ae}
|
|
449
|
+
`.trim();console.log(`[Gemini Live] SYSTEM INSTRUCTION (Length: ${ke.length})`);const pe=[{functionDeclarations:[{name:"getSectionDetails",description:"Get detailed fields for a form section. Call this before updating fields in that section.",parameters:{type:Type.OBJECT,properties:{sectionId:{type:Type.STRING,description:"Section ID from available sections."}},required:["sectionId"]}},{name:"updateReport",description:"Update fields in the medical report. Use exact fieldId from getSectionDetails.",parameters:{type:Type.OBJECT,properties:{updates:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{fieldId:{type:Type.STRING,description:"Exact htmlFieldId from schema."},value:{type:Type.STRING,description:"Value to set."},reason:{type:Type.STRING,description:"Quote from conversation."}},required:["fieldId","value"]}}},required:["updates"]}},{name:"setAnalysisTitle",description:"Set the analysis title.",parameters:{type:Type.OBJECT,properties:{title:{type:Type.STRING,description:"Title for the analysis."}},required:["title"]}},{name:"updateOdontogram",description:"Update dental chart (odontogram). Use for tooth conditions like caries, crowns, implants, etc.",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"Tooth number (FDI notation: 11-18, 21-28, 31-38, 41-48, 51-55, 61-65, 71-75, 81-85)."},surface:{type:Type.STRING,description:"Optional. Surface: mesial, distal, vestibular, lingual, oclusal, incisal, center. Omit for whole-tooth conditions."},condition:{type:Type.STRING,description:"Condition ID: caries, resina_adaptada, amalgama_adaptada, sellante, ausente, corona, implante, endodoncia, extraido, exodoncia, etc."},type:{type:Type.STRING,description:"hallazgo (pathology) or hallazgo_realizado (existing treatment)."}},required:["tooth","condition","type"]}}},required:["actions"]}},{name:"clearOdontogram",description:"Clear/remove data from odontogram teeth. Use when user says 'limpiar', 'borrar', 'quitar', 'eliminar' tooth data.",parameters:{type:Type.OBJECT,properties:{teeth:{type:Type.ARRAY,items:{type:Type.STRING},description:"Array of tooth numbers to clear (e.g., ['18', '24']). Use ['all'] to clear entire odontogram."}},required:["teeth"]}},{name:"searchFields",description:"Search fields across all sections by keyword (label, description, or keywords). Use when unsure of exact fieldId or need to find related fields.",parameters:{type:Type.OBJECT,properties:{query:{type:Type.STRING,description:"Keyword to search (e.g., 'antecedentes', 'presión arterial', 'alergia')."},maxResults:{type:Type.NUMBER,description:"Maximum results (default 5, max 10)."}},required:["query"]}},{name:"getOdontogramSchema",description:"Get complete odontogram schema and exact rules. Call ONCE at start if consultation includes dental review or odontogram.",parameters:{type:Type.OBJECT,properties:{},required:[]}},{name:"validateOdontogramActions",description:"Validate proposed odontogram actions BEFORE updateOdontogram. Returns validation results and auto-applies valid actions. ALWAYS call this instead of updateOdontogram directly.",parameters:{type:Type.OBJECT,properties:{actions:{type:Type.ARRAY,description:"Actions to validate and apply",items:{type:Type.OBJECT,properties:{tooth:{type:Type.STRING,description:"FDI tooth number (e.g., '18', '27')"},surface:{type:Type.STRING,description:"Optional: mesial, distal, vestibular, lingual, oclusal, incisal, center"},condition:{type:Type.STRING,description:"Condition to apply (e.g., 'caries', 'corona', 'ausente')"},type:{type:Type.STRING,description:"hallazgo (pathology) or hallazgo_realizado (treatment)"}},required:["tooth","condition","type"]}}},required:["actions"]}},{name:"findSimilarOdontogramCondition",description:"Map natural dental phrases to valid odontogram conditions. Use when doctor says synonyms, abbreviations, or non-exact terms.",parameters:{type:Type.OBJECT,properties:{phrase:{type:Type.STRING,description:"Doctor's phrase (e.g., 'caries secundaria', 'corona filtrada', 'diente roto')"},type:{type:Type.STRING,description:"Suggested type: hallazgo or hallazgo_realizado"},area:{type:Type.NUMBER,description:"Optional area (0-7) to filter valid conditions for that area"}},required:["phrase"]}}]}],Re=await Ie.live.connect({model:"gemini-2.5-flash-native-audio-preview-12-2025",config:{responseModalities:[Modality.AUDIO],systemInstruction:{parts:[{text:ke}]},tools:pe,inputAudioTranscription:{},outputAudioTranscription:{}},callbacks:{onopen:()=>{console.log("[Gemini Live] ✅ Session opened (Handshake complete)"),y(!0),L(!0),g(!1),ge.current=!0},onmessage:async j=>{var ie,Ue,Ve,He,se,ve,Te,We,je,et,tt,Qe,it,at,st,rt,ot,lt,ut,ct,ht,dt,ft;console.log("[Gemini Live] 📨 Full message:",JSON.stringify(j,null,2)),j.toolCallCancellation&&console.error("[Gemini Live] ❌ Tool call CANCELLED");const Z=j.usageMetadata||((ie=j.serverContent)==null?void 0:ie.usageMetadata)||((Ve=(Ue=j.serverContent)==null?void 0:Ue.modelTurn)==null?void 0:Ve.usageMetadata);if((j.usageMetadata||(He=j.serverContent)!=null&&He.usageMetadata)&&console.log("[Gemini Live] 📊 Message keys:",Object.keys(j)),Z){console.log("[Gemini Live] 📊 Usage metadata found:",Z);const _e=Z.promptTokenCount||0,Ke=Z.totalTokenCount||0,ee=Z.candidatesTokenCount||Math.max(0,Ke-_e);Ke>0&&Ke>=R.current.totalTokens&&(R.current.inputTokens=_e,R.current.outputTokens=ee,R.current.totalTokens=Ke,R.current.estimatedCost=Ee(_e,ee),console.log("[Gemini Live] 📊 Session usage UPDATED:",R.current),K.current&&setTimeout(()=>{var ue;return(ue=K.current)==null?void 0:ue.call(K,{...R.current})},0))}const Se=(ve=(se=j.serverContent)==null?void 0:se.inputTranscription)==null?void 0:ve.text,me=(We=(Te=j.serverContent)==null?void 0:Te.outputTranscription)==null?void 0:We.text;if(Se||me){const _e=Se?"user":"model",Ke=Se||me||"",ee=A.current&&A.current.role===_e;let ue="",te="";if(ee&&A.current?(A.current.content+=Ke,te=A.current.content,ue=A.current.id):(ue=Date.now().toString(),te=Ke,A.current={role:_e,content:te,timestamp:new Date,id:ue}),q.current){const ce={role:_e,content:te,timestamp:((je=A.current)==null?void 0:je.timestamp)||new Date,id:ue};setTimeout(()=>{var le;(le=q.current)==null||le.call(q,ce)},0)}}if(((et=j.serverContent)!=null&&et.turnComplete||(tt=j.serverContent)!=null&&tt.interrupted)&&(A.current=null),j.toolCall){const _e=[],Ke=j.toolCall.functionCalls||[];for(const ee of Ke)if(ee.name==="getSectionDetails"){const ue=(Qe=ee.args)==null?void 0:Qe.sectionId,te=G.current.find(ce=>ce.key===ue);if(te){console.log(`[Gemini Live] 📥 Loading section schema: ${ue}`);const ce={id:te.key,title:te.label,description:te.description||"",keywords:te.keywords||[],fields:te.fields.map(le=>{const W={id:le.id,htmlFieldId:le.htmlFieldId||le.id,label:le.label,type:le.type,description:le.description||"",keywords:le.keywords||[]};return le.type==="select"&&le.options&&(W.options=le.options,W.instruction='MUST use EXACT value from options list. Normalize variants (e.g., "pre ingreso" → "PREINGRESO").'),le.type==="checkbox"&&(W.instruction='Set "true" only if EXPLICITLY mentioned. Otherwise leave empty. NEVER assume.'),W}),CRITICAL:"NEVER invent or assume information. Only fill fields with data EXPLICITLY stated in the conversation. If not mentioned, DO NOT fill.",note:"SELECT: use EXACT option value. CHECKBOX: 'true' only if explicitly confirmed, otherwise leave empty."};console.log({id:ee.id,name:ee.name,response:{result:JSON.stringify(ce)}}),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(ce)}})}else console.warn(`[Gemini Live] ⚠️ Section not found: ${ue}`),_e.push({id:ee.id,name:ee.name,response:{result:"Section not found. Check available sections."}})}else if(ee.name==="setAnalysisTitle"){const ue=(it=ee.args)==null?void 0:it.title;ue&&U.current&&setTimeout(()=>{var te;return(te=U.current)==null?void 0:te.call(U,ue)},0),_e.push({id:ee.id,name:ee.name,response:{result:"Title updated"}})}else if(ee.name==="updateReport"){let ue=(at=ee.args)==null?void 0:at.updates;console.log("[Gemini Live] 🔧 updateReport raw args:",JSON.stringify(ee.args));const te=extractJson(ue);console.log("[Gemini Live] 🔧 updateReport parsed:",JSON.stringify(te));const ce=[];if(Array.isArray(te))for(const le of te){const W=extractJson(le)||le;console.log("[Gemini Live] 🔧 Processing item:",JSON.stringify(W)),W&&typeof W=="object"&&W.fieldId&&W.value!==void 0?ce.push({fieldId:String(W.fieldId),value:W.value,confidence:.9,source:"audio_live",reason:W.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid item (missing fieldId/value):",JSON.stringify(W))}else te&&typeof te=="object"?(console.log("[Gemini Live] 🔧 Single object update:",JSON.stringify(te)),te.fieldId&&te.value!==void 0?ce.push({fieldId:String(te.fieldId),value:te.value,confidence:.9,source:"audio_live",reason:te.reason||"Extracted from conversation"}):console.warn("[Gemini Live] ⚠️ Invalid object (missing fieldId/value):",JSON.stringify(te))):console.warn("[Gemini Live] ⚠️ parsedUpdates is not array or object:",typeof te);ce.length>0&&z.current?(console.log(`[Gemini Live] 📝 Updating ${ce.length} fields:`,ce.map(le=>`${le.fieldId}=${le.value}`).join(", ")),setTimeout(()=>{var le;return(le=z.current)==null?void 0:le.call(z,ce)},0)):console.warn("[Gemini Live] ⚠️ No valid updates extracted from updateReport call"),_e.push({id:ee.id,name:ee.name,response:{result:"Fields updated",count:ce.length}})}else if(ee.name==="updateOdontogram"){const ue=(st=ee.args)==null?void 0:st.actions;console.log("[Gemini Live] 🦷 updateOdontogram raw args:",JSON.stringify(ee.args));const te=extractJson(ue)||ue;console.log("[Gemini Live] 🦷 updateOdontogram parsed:",JSON.stringify(te));const ce=[],le=Array.isArray(te)?te:[te];for(const W of le)if(W&&W.tooth&&W.condition&&W.type){const Ge=String(W.tooth),be=surfaceToArea(W.surface),Ne=W.type,Me=validateOdontogramAction({key:Ge,type:Ne,area:be,action:W.condition});Me.valid?(ce.push({tooth:Ge,surface:W.surface,condition:W.condition,type:Ne}),console.log(`[Gemini Live] ✅ Valid odontogram action: tooth=${Ge}, area=${be}, action=${W.condition}`)):console.warn(`[Gemini Live] ❌ Invalid odontogram action: ${Me.error}`)}if(ce.length>0&&Q.current){console.log(`[Gemini Live] 🦷 Updating odontogram with ${ce.length} valid actions:`,ce),setTimeout(()=>{var W;return(W=Q.current)==null?void 0:W.call(Q,ce)},0);for(const W of ce){const Ge=surfaceToArea(W.surface),be={type:"FROM_EXTENSION",fieldId:"odontograma",payload:{key:W.tooth,type:W.type,area:Ge,action:W.condition}};console.log("[Gemini Live] 📤 Sending FROM_EXTENSION postMessage (local):",be),window.postMessage(be,"*");const Ne=document.getElementsByTagName("iframe");console.log(`[Gemini Live] 📤 Broadcasting FROM_EXTENSION to ${Ne.length} iframes`);for(let Me=0;Me<Ne.length;Me++)try{(rt=Ne[Me].contentWindow)==null||rt.postMessage(be,"*"),console.log(`[Gemini Live] ✅ Sent FROM_EXTENSION to iframe ${Me}`)}catch(Xe){console.log(`[Gemini Live] ❌ Failed to send to iframe ${Me}:`,Xe)}}}_e.push({id:ee.id,name:ee.name,response:{result:"Odontogram updated",count:ce.length}})}else if(ee.name==="clearOdontogram"){const ue=(ot=ee.args)==null?void 0:ot.teeth;console.log("[Gemini Live] 🦷 clearOdontogram raw args:",JSON.stringify(ee.args));const te=Array.isArray(ue)?ue.map(String):[String(ue)];te.length>0&&ne.current&&(console.log("[Gemini Live] 🦷 Clearing odontogram teeth:",te),setTimeout(()=>{var ce;return(ce=ne.current)==null?void 0:ce.call(ne,te)},0)),_e.push({id:ee.id,name:ee.name,response:{result:"Odontogram teeth cleared",count:te.length}})}else if(ee.name==="searchFields"){const ue=String(((lt=ee.args)==null?void 0:lt.query)||"").toLowerCase().trim(),te=Math.min(Number((ut=ee.args)==null?void 0:ut.maxResults)||5,10);console.log(`[Gemini Live] 🔍 searchFields query="${ue}", maxResults=${te}`);const ce=G.current.flatMap(le=>le.fields.filter(W=>{var Ge,be,Ne;return((Ge=W.label)==null?void 0:Ge.toLowerCase().includes(ue))||((be=W.description)==null?void 0:be.toLowerCase().includes(ue))||((Ne=W.keywords)==null?void 0:Ne.some(Me=>Me.toLowerCase().includes(ue)))}).map(W=>({sectionId:le.key,sectionLabel:le.label,fieldId:W.htmlFieldId||W.id,label:W.label,type:W.type,description:W.description||""}))).slice(0,te);console.log(`[Gemini Live] 🔍 searchFields found ${ce.length} results:`,ce),_e.push({id:ee.id,name:ee.name,response:{result:ce.length>0?`Found ${ce.length} fields: ${JSON.stringify(ce)}`:"No fields found with that keyword. Use getSectionDetails to explore a specific section."}})}else if(ee.name==="getOdontogramSchema"){console.log("[Gemini Live] 🦷 Loading complete odontogram schema");const ue={description:"Complete Clara odontogram schema. Use these EXACT rules for updateOdontogram.",surfaceMapping:{whole:0,completo:0,vestibular:1,bucal:1,top:1,lingual:2,palatal:2,palatino:2,bottom:2,mesial:3,left:3,distal:4,right:4,oclusal:5,incisal:5,center:5},validToothKeys:["11","11SN","11SNRX","12","12SN","12SNRX","13","13SN","13SNRX","14","14SN","14SNRX","15","15SN","15SNRX","16","16SN","16SNRX","17","17SN","17SNRX","18","18SN","18SNRX","21","21SN","21SNRX","22","22SN","22SNRX","23","23SN","23SNRX","24","24SN","24SNRX","25","25SN","25SNRX","26","26SN","26SNRX","27","27SN","27SNRX","28","28SN","28SNRX","31","31SN","31SNRX","32","32SN","32SNRX","33","33SN","33SNRX","34","34SN","34SNRX","35","35SN","35SNRX","36","36SN","36SNRX","37","37SN","37SNRX","38","38SN","38SNRX","41","41SN","41SNRX","42","42SN","42SNRX","43","43SN","43SNRX","44","44SN","44SNRX","45","45SN","45SNRX","46","46SN","46SNRX","47","47SN","47SNRX","48","48SN","48SNRX","51","51SN","51SNRX","52","52SN","52SNRX","53","53SN","53SNRX","54","54SN","54SNRX","55","55SN","55SNRX","61","61SN","61SNRX","62","62SN","62SNRX","63","63SN","63SNRX","64","64SN","64SNRX","65","65SN","65SNRX","71","71SN","71SNRX","72","72SN","72SNRX","73","73SN","73SNRX","74","74SN","74SNRX","75","75SN","75SNRX","81","81SN","81SNRX","82","82SN","82SNRX","83","83SN","83SNRX","84","84SN","84SNRX","85","85SN","85SNRX"],validActionsByTypeAndArea:{hallazgo:{0:["ok","corona","corona_provisional","carilla","resto_radicular","abrasion_erosion","implante_afectado","endodoncia","exodoncia","ausente","sin_erupcionar","exodoncia_qx","mov_grado_1","mov_grado_2","mov_grado_3","pulido","radiografia","supernumerario","supernumerario_rx","parcialmente_erupcionado_o_impactado"],1:["resina_cervical"],2:["resina_cervical"],3:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],4:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_mesial"],5:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"],6:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas","angulo_distal"],7:["resina_desadaptada","amalgama_desadaptada","linea_factura","obturacion_temporal","caries","fosas_fisuras_profundas"]},hallazgo_realizado:{0:["corona","carilla","implante","endodoncia","extraido","ausente","sin_erupcionar","parcialmente_erupcionado_o_impactado"],1:["resina_cervical"],2:["resina_cervical"],3:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],4:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_mesial"],5:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"],6:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante","angulo_distal"],7:["resina_adaptada","amalgama_adaptada","tratamiento_realizado","sellante"]}},rules:["For whole tooth conditions (ausente, corona, implante, endodoncia), do NOT include surface.","If surface not specified and condition is surface-based (caries, resina), use 'oclusal' or 'center'.","type='hallazgo' for pathologies, 'hallazgo_realizado' for existing treatments.","ALWAYS use EXACT actions from validActionsByTypeAndArea."],voiceExamples:["Caries oclusal en 18 → tooth:'18', surface:'oclusal', condition:'caries', type:'hallazgo'","Corona en 27 → tooth:'27', condition:'corona', type:'hallazgo_realizado' (no surface)","Ausente 48 → tooth:'48', condition:'ausente', type:'hallazgo'"]};_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(ue)}})}else if(ee.name==="validateOdontogramActions"){const ue=(ct=ee.args)==null?void 0:ct.actions,te=Array.isArray(ue)?ue:[];console.log("[Gemini Live] 🦷 validateOdontogramActions received:",te);const ce=te.map(W=>{var Ye,nt,pt;if(!W.tooth||!W.condition||!W.type)return{original:W,valid:!1,error:"Missing required properties: tooth, condition, type"};const Ge=String(W.tooth),be=W.type,Ne=W.surface?surfaceToArea(W.surface):0,Me=validateOdontogramAction({key:Ge,type:be,area:Ne,action:W.condition});if(Me.valid)return{original:W,valid:!0,applied:{tooth:Ge,surface:W.surface||null,condition:W.condition,type:be}};let Xe=null;return(Ye=Me.error)!=null&&Ye.includes("Invalid tooth key")?Xe="Verify FDI tooth number or add SN/SNRX suffix for supernumerary.":(nt=Me.error)!=null&&nt.includes("Invalid action")?Xe="Use a valid condition for this type and area. Check getOdontogramSchema.":(pt=Me.error)!=null&&pt.includes("Invalid area")&&(Xe="Surface not allowed for this condition. Use 'center' for surface conditions, or omit surface for whole tooth."),{original:W,valid:!1,error:Me.error,suggestion:Xe}}),le=ce.filter(W=>W.valid).map(W=>W.applied).filter(Boolean);console.log("[Gemini Live] 🦷 Validation results:",{total:te.length,valid:le.length,invalid:te.length-le.length}),le.length>0&&Q.current&&(console.log(`[Gemini Live] 🦷 Auto-applying ${le.length} valid actions via callback`),setTimeout(()=>{var W;return(W=Q.current)==null?void 0:W.call(Q,le)},0)),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify({summary:`${le.length} of ${te.length} actions valid and applied`,details:ce})}})}else if(ee.name==="findSimilarOdontogramCondition"){const ue=String(((ht=ee.args)==null?void 0:ht.phrase)||"").toLowerCase().trim(),te=((dt=ee.args)==null?void 0:dt.type)||"hallazgo",ce=(ft=ee.args)==null?void 0:ft.area;console.log(`[Gemini Live] 🔍 findSimilarOdontogramCondition: "${ue}", type=${te}, area=${ce}`);const le={caries:{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries secundaria":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries recurrente":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},"caries proximal":{condition:"caries",type:"hallazgo",areas:[3,4]},"caries interproximal":{condition:"caries",type:"hallazgo",areas:[3,4]},"caries cervical":{condition:"caries",type:"hallazgo",areas:[1,2]},"caries de cuello":{condition:"caries",type:"hallazgo",areas:[1,2]},"lesion cariosa":{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},cavidad:{condition:"caries",type:"hallazgo",areas:[3,4,5,6,7]},fractura:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},fracturado:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},roto:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},fisura:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},grieta:{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"linea de fractura":{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"diente roto":{condition:"linea_factura",type:"hallazgo",areas:[3,4,5,6,7]},"resina desadaptada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"resina filtrada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"resina con filtracion":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"composite filtrado":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"restauracion desadaptada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"restauracion filtrada":{condition:"resina_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama desadaptada":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama filtrada":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"amalgama con filtracion":{condition:"amalgama_desadaptada",type:"hallazgo",areas:[3,4,5,6,7]},"obturacion temporal":{condition:"obturacion_temporal",type:"hallazgo",areas:[3,4,5,6,7]},provisional:{condition:"obturacion_temporal",type:"hallazgo",areas:[3,4,5,6,7]},resina:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina adaptada":{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina ok":{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},composite:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},restauracion:{condition:"resina_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},amalgama:{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"amalgama adaptada":{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"amalgama ok":{condition:"amalgama_adaptada",type:"hallazgo_realizado",areas:[3,4,5,6,7]},sellante:{condition:"sellante",type:"hallazgo_realizado",areas:[3,4,5,6,7]},sellador:{condition:"sellante",type:"hallazgo_realizado",areas:[3,4,5,6,7]},"resina cervical":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},"clase v":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},"clase 5":{condition:"resina_cervical",type:"hallazgo_realizado",areas:[1,2]},corona:{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona metal":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona ceramica":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona porcelana":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona zirconio":{condition:"corona",type:"hallazgo_realizado",areas:[0]},"corona defectuosa":{condition:"corona",type:"hallazgo",areas:[0]},"corona filtrada":{condition:"corona",type:"hallazgo",areas:[0]},"corona provisional":{condition:"corona_provisional",type:"hallazgo",areas:[0]},"corona temporal":{condition:"corona_provisional",type:"hallazgo",areas:[0]},carilla:{condition:"carilla",type:"hallazgo_realizado",areas:[0]},veneer:{condition:"carilla",type:"hallazgo_realizado",areas:[0]},endodoncia:{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"tratamiento de conductos":{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},conducto:{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"tratado endodonticamente":{condition:"endodoncia",type:"hallazgo_realizado",areas:[0]},"necesita endodoncia":{condition:"endodoncia",type:"hallazgo",areas:[0]},implante:{condition:"implante",type:"hallazgo_realizado",areas:[0]},"implante dental":{condition:"implante",type:"hallazgo_realizado",areas:[0]},"implante afectado":{condition:"implante_afectado",type:"hallazgo",areas:[0]},periimplantitis:{condition:"implante_afectado",type:"hallazgo",areas:[0]},ausente:{condition:"ausente",type:"hallazgo",areas:[0]},falta:{condition:"ausente",type:"hallazgo",areas:[0]},"no esta":{condition:"ausente",type:"hallazgo",areas:[0]},extraido:{condition:"extraido",type:"hallazgo_realizado",areas:[0]},extraccion:{condition:"exodoncia",type:"hallazgo",areas:[0]},exodoncia:{condition:"exodoncia",type:"hallazgo",areas:[0]},"para extraer":{condition:"exodoncia",type:"hallazgo",areas:[0]},"indicado para extraccion":{condition:"exodoncia",type:"hallazgo",areas:[0]},"exodoncia quirurgica":{condition:"exodoncia_qx",type:"hallazgo",areas:[0]},movilidad:{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"movilidad grado 1":{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"movilidad grado 2":{condition:"mov_grado_2",type:"hallazgo",areas:[0]},"movilidad grado 3":{condition:"mov_grado_3",type:"hallazgo",areas:[0]},movil:{condition:"mov_grado_1",type:"hallazgo",areas:[0]},"muy movil":{condition:"mov_grado_2",type:"hallazgo",areas:[0]},"sin erupcionar":{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},"no erupcionado":{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},retenido:{condition:"sin_erupcionar",type:"hallazgo",areas:[0]},impactado:{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"parcialmente erupcionado":{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"semi incluido":{condition:"parcialmente_erupcionado_o_impactado",type:"hallazgo",areas:[0]},"resto radicular":{condition:"resto_radicular",type:"hallazgo",areas:[0]},raiz:{condition:"resto_radicular",type:"hallazgo",areas:[0]},abrasion:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},erosion:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},desgaste:{condition:"abrasion_erosion",type:"hallazgo",areas:[0]},"fosas profundas":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},"fisuras profundas":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},"surcos profundos":{condition:"fosas_fisuras_profundas",type:"hallazgo",areas:[3,4,5,6,7]},supernumerario:{condition:"supernumerario",type:"hallazgo",areas:[0]},"diente extra":{condition:"supernumerario",type:"hallazgo",areas:[0]},ok:{condition:"ok",type:"hallazgo",areas:[0]},sano:{condition:"ok",type:"hallazgo",areas:[0]},normal:{condition:"ok",type:"hallazgo",areas:[0]},"angulo mesial":{condition:"angulo_mesial",type:"hallazgo_realizado",areas:[4]},"angulo distal":{condition:"angulo_distal",type:"hallazgo_realizado",areas:[6]},"angulo mesial roto":{condition:"angulo_mesial",type:"hallazgo",areas:[4]},"angulo distal roto":{condition:"angulo_distal",type:"hallazgo",areas:[6]}};let W=null;for(const be in le)if(ue===be||ue.includes(be)){W={...le[be],confidence:ue===be?1:.9};break}if(!W){const be=ue.split(/\s+/);for(const Ne in le){const Me=Ne.split(/\s+/),Xe=Me.filter(Ye=>be.some(nt=>nt.includes(Ye)||Ye.includes(nt)));if(Xe.length>0){const Ye=Xe.length/Me.length*.7;(!W||Ye>W.confidence)&&(W={...le[Ne],confidence:Ye})}}}W&&te&&(W.type=te),W&&ce!==void 0&&W.areas&&(W.areas.includes(ce)||(W={...W,confidence:W.confidence*.5}));const Ge=W||{condition:"caries",type:te,confidence:.1,note:"No exact match found, defaulting to caries"};console.log(`[Gemini Live] 🔍 Best match for "${ue}":`,Ge),_e.push({id:ee.id,name:ee.name,response:{result:JSON.stringify(Ge)}})}else _e.push({id:ee.id,name:ee.name,response:{result:"Acknowledged"}});if(V.current&&_e.length>0)try{V.current.sendToolResponse({functionResponses:_e})}catch(ee){console.error("[Gemini Live] ❌ Error sending tool responses:",ee)}}},onclose:j=>{ye.current||(console.log("[Gemini Live] Session closed unexpectedly",j),y(!1),L(!1),g(!1),j.code===1011&&E("Payload too large. Contact support."))},onerror:j=>{var Z,Se;console.error("[Gemini Live] ❌ SESSION ERROR:",j),((Z=j.message)!=null&&Z.includes("Fatal")||(Se=j.message)!=null&&Se.includes("Close"))&&(E("Connection error"),y(!1),L(!1))}}});V.current=Re,console.log("[Gemini Live] Session created, waiting for onopen...");const Pe=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:16e3,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0,deviceId:l?{exact:l}:void 0}});F.current=Pe;const $e=new Blob([WORKLET_CODE],{type:"application/javascript"}),Ze=URL.createObjectURL($e);try{await he.audioWorklet.addModule(Ze)}catch{throw new Error("Failed to load audio processor")}finally{URL.revokeObjectURL(Ze)}const Je=he.createMediaStreamSource(Pe),qe=new AudioWorkletNode(he,"pcm-processor");qe.port.onmessage=j=>{if(!ge.current)return;const Z=j.data;if(O.current.push(Z),b.current+=Z.length,b.current>=I){if(!ge.current){O.current=[],b.current=0;return}const Se=new Float32Array(b.current);let me=0;for(const ie of O.current)Se.set(ie,me),me+=ie.length;oe(Se),O.current=[],b.current=0}},Je.connect(qe);const J=he.createGain();J.gain.value=0,qe.connect(J),J.connect(he.destination),$.current=Je,H.current=qe}catch(de){console.error("[Gemini Live] Connection failed",de),g(!1),y(!1),L(!1),(ae=de.message)!=null&&ae.includes("401")||(re=de.message)!=null&&re.includes("API Key")?(E("Invalid API Key"),T(!1)):E("Connection failed")}}},[xe,oe,S,n,l,u,d,p,L]);React.useEffect(()=>{let ae;return P&&!x&&!S&&(ae=setTimeout(()=>{Y()},500)),()=>{ae&&clearTimeout(ae)}},[P,x,S,Y]);const Fe=React.useCallback(()=>{T(!0)},[]),Oe=React.useCallback(()=>{T(!1),xe()},[xe]),Le=React.useCallback(()=>{D(ae=>{const re=!ae;return k.current=re,F.current&&F.current.getAudioTracks().forEach(de=>{de.enabled=!re}),re&&_(0),re})},[]),Ce=React.useCallback(ae=>{if(V.current)try{V.current.sendRealtimeInput({clientContent:{turns:[{parts:[{text:ae}],role:"user"}],turnComplete:!0}})}catch(re){console.error("[Gemini Live] Failed to send text",re)}},[]),De=React.useCallback(()=>({...R.current}),[]);return{isRecording:P,isConnected:x,isConnecting:S,isPaused:M,error:C,audioLevel:B,startRecording:Fe,stopRecording:Oe,togglePause:Le,sendText:Ce,getSessionUsage:De}};function useDebouncedFormDataSync(n,e=500,i){const a=React.useRef(null),s=React.useRef(null),r=React.useRef(!1);React.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const o=React.useCallback(async()=>{if(s.current&&(clearTimeout(s.current),s.current=null),a.current&&n&&!r.current){r.current=!0;const u=a.current;a.current=null;try{console.log("[DebouncedSync] Flushing formData to backend");const c=i==null?void 0:i();await claraApi.updateFormData(n,u.formData,u.documentChanges,u.chatHistory,c)}catch(c){console.error("[DebouncedSync] Error flushing formData:",c)}finally{r.current=!1}}},[n,i]);return{queueSync:React.useCallback((u,c,d)=>{var p,f,m;n&&(a.current={formData:{...(p=a.current)==null?void 0:p.formData,...u},documentChanges:c||((f=a.current)==null?void 0:f.documentChanges),chatHistory:d||((m=a.current)==null?void 0:m.chatHistory)},s.current&&clearTimeout(s.current),s.current=setTimeout(async()=>{if(!a.current||!n||r.current)return;r.current=!0;const P=a.current;a.current=null;try{console.log("[DebouncedSync] Syncing formData to backend");const T=i==null?void 0:i();console.log("[DebouncedSync] 📊 Got usageStats:",T),await claraApi.updateFormData(n,P.formData,P.documentChanges,P.chatHistory,T)}catch(T){console.error("[DebouncedSync] Error syncing formData:",T),a.current=P}finally{r.current=!1}},e))},[n,e,i]),flush:o}}const ClaraActiveSession=({onEndSession:n,primaryColor:e,sessionControlRef:i})=>{var Ze,Je,qe;const[a,s]=React.useState("transcription"),[r,o]=React.useState(!0),[l,u]=React.useState(3),c=React.useRef(null),d=React.useRef(null),p=React.useRef(!1),f=React.useRef(null),m=React.useRef(null),P=React.useRef(new Date().toISOString()),{config:T,accessToken:x,currentTemplate:y,currentAnalysis:S,transcriptMessages:g,chatMessages:C,isAutopilot:E,speechSpeed:B,voiceStyle:_,formData:M,documentChanges:D,userStreamInfo:L,analysisStreamInfo:N,isS2Connected:F,usageStats:H,addTranscriptMessage:$,addChatMessage:O,updateFormData:b,setFormData:I,setAnalysisTitle:V,setCurrentAnalysis:A,setUserStreamInfo:k,setAnalysisStreamInfo:R,setS2Connected:G,setUsageStats:z,clearSessionData:q}=useClaraStore(),U=T.lang||"es",K=React.useRef(null),Q=React.useRef(M);React.useEffect(()=>{Q.current=M},[M]);const{queueSync:ne,flush:Ee}=useDebouncedFormDataSync(S==null?void 0:S.id,500,()=>{var J;return((J=K.current)==null?void 0:J.call(K))??{inputTokens:0,outputTokens:0,totalTokens:0,estimatedCost:0}}),ye=React.useCallback(J=>{try{console.log("[Session] Data extracted:",J);const j={...Q.current};J.forEach(Z=>{try{b(Z.fieldId,Z.value,"ai_tool",Z.reason||"AI extraction"),j[Z.fieldId]=Z.value,sendFillCommand(Z.fieldId,Z.value),emitFieldFilled(Z.fieldId,Z.value),N&&(S!=null&&S.id)&&sendAIFill(N,S.id,Z.fieldId,Z.value)}catch(Se){console.error("[Session] Error processing field:",Z.fieldId,Se)}}),ne(j),emitFormDataUpdated(j,void 0,J.map(Z=>Z.fieldId))}catch(j){console.error("[Session] ❌ Error in handleDataExtracted:",j)}},[b,N,ne]),ge=React.useCallback(J=>{console.log("[Session] Transcript:",J),$(J);const j=[...g,J];emitTranscriptUpdated(J.role,J.content,j.map(Z=>({role:Z.role,content:Z.content,timestamp:Z.timestamp.toISOString()}))),N&&sendTranscript(N,j.map(Z=>({role:Z.role,content:Z.content,timestamp:Z.timestamp.toISOString()}))),S!=null&&S.id&&claraApi.syncTranscriptToDB(S.id,j)},[$,g,N,S]),xe=React.useCallback(J=>{console.log("[Session] Title updated:",J),V(J),emitTitleUpdated(J,S==null?void 0:S.id),N&&sendTitleUpdate(N,J),S!=null&&S.id&&claraApi.updateAnalysisTitle(S.id,J)},[V,S,N]),oe=React.useCallback(J=>{z(J)},[z]),Y=React.useCallback(J=>{var j,Z,Se;try{console.log("[Session] 🦷 Odontogram actions:",J);const me=(Se=(Z=(j=y==null?void 0:y.structure)==null?void 0:j.sections)==null?void 0:Z.flatMap(ve=>ve.fields))==null?void 0:Se.find(ve=>ve.type==="odontogram");if(!me){console.warn("[Session] ⚠️ No odontogram field found in template");return}const ie=me.htmlFieldId||me.id,Ve={...Q.current[ie]||{}},He={mesial:"left",distal:"right",vestibular:"top",lingual:"bottom",palatal:"bottom",oclusal:"center",incisal:"center",center:"center",top:"top",bottom:"bottom",left:"left",right:"right"};for(const ve of J){const Te=ve.tooth,We=ve.type;if(Ve[Te]||(Ve[Te]={id:Te,surfaces:{}}),ve.surface){const je=He[ve.surface.toLowerCase()]||"center";Ve[Te].surfaces[je]={condition:ve.condition,type:We}}else Ve[Te].whole=ve.condition,Ve[Te].wholeType=We}console.log("[Session] 🦷 Updated teeth map:",Ve),b(ie,Ve,"ai_tool","Odontogram AI update"),emitOdontogramUpdated(ie,Ve),emitFieldFilled(ie,Ve),N&&(S!=null&&S.id)&&sendToS2(N,{action:"odontogram",fieldId:ie,value:Ve,editorSource:"clara",source:"web_client"});const se={...Q.current,[ie]:Ve};ne(se),emitFormDataUpdated(se,void 0,[ie])}catch(me){console.error("[Session] ❌ Error in handleOdontogramUpdate:",me)}},[y,b,N,S,ne]),Fe=React.useCallback(J=>{var j,Z,Se;try{console.log("[Session] 🦷 Clearing odontogram teeth:",J);const me=(Se=(Z=(j=y==null?void 0:y.structure)==null?void 0:j.sections)==null?void 0:Z.flatMap(se=>se.fields))==null?void 0:Se.find(se=>se.type==="odontogram");if(!me){console.warn("[Session] ⚠️ No odontogram field found in template");return}const ie=me.htmlFieldId||me.id,Ue=Q.current[ie]||{};let Ve;if(J.includes("all"))Ve={};else{Ve={...Ue};for(const se of J)delete Ve[se]}b(ie,Ve,"ai_tool",`Cleared teeth: ${J.join(", ")}`),emitOdontogramCleared(ie,J);const He={...Q.current,[ie]:Ve};ne(He),emitFormDataUpdated(He,void 0,[ie])}catch(me){console.error("[Session] ❌ Error in handleOdontogramClear:",me)}},[y,b,ne]),Oe=React.useCallback(J=>{if(console.log("[Session] Field interaction:",J),J.action==="change"&&J.value!==void 0){b(J.fieldId,J.value,"user","Manual edit"),N&&sendToS2(N,{action:"fill",fieldId:J.fieldId,value:J.value,sectionKey:J.sectionKey,editorSource:"user",source:"web_client"});const j={...Q.current,[J.fieldId]:J.value};ne(j)}},[b,N,ne]),{isRecording:Le,isConnected:Ce,isConnecting:De,isPaused:ae,error:re,audioLevel:de,startRecording:Be,stopRecording:he,togglePause:Ie,getSessionUsage:Ae}=useGeminiLive({geminiApiKey:T.geminiApiKey,onDataExtracted:ye,onTranscriptUpdate:ge,onTitleUpdate:xe,onUsageUpdate:oe,onOdontogramUpdate:Y,onOdontogramClear:Fe,isAutopilot:E,speechSpeed:B,style:_,sections:((Ze=y==null?void 0:y.structure)==null?void 0:Ze.sections)||[]});React.useEffect(()=>{K.current=Ae},[Ae]);const fe=De?SessionStatus.CONNECTING:Ce&&!ae?SessionStatus.ACTIVE:Ce&&ae?SessionStatus.PAUSED:SessionStatus.DISCONNECTED;React.useEffect(()=>(f.current=setInterval(()=>{u(J=>J<=1?(f.current&&clearInterval(f.current),0):J-1)},1e3),()=>{f.current&&clearInterval(f.current)}),[]),React.useEffect(()=>{Ce&&(o(!1),f.current&&clearInterval(f.current))},[Ce]);const ke=React.useRef(!1);React.useEffect(()=>{const J=claraApi.hasAuth()||T.apiKey||x;if(!J||ke.current){J||console.log("[Session] Waiting for auth...");return}return(async()=>{var Ve;ke.current=!0,claraApi.hasAuth()||(T.apiKey?claraApi.setApiKey(T.apiKey):x&&claraApi.setAccessToken(x)),console.log("[Session] Initializing session (optimized parallel)...");const Z=performance.now(),[Se,me]=await Promise.all([claraApi.fetchUserStreamToken(),y&&!S?claraApi.createAnalysis(y.id,y):Promise.resolve(S)]);Se&&(k(Se),console.log("[Session] User stream token obtained"));const ie=me||S;if(ie)A(ie),console.log("[Session] Analysis ready:",ie.id);else{console.error("[Session] No analysis available");return}const Ue=await claraApi.fetchAnalysisStreamToken(ie.id,(Ve=ie.stream)==null?void 0:Ve.id);if(Ue){R(Ue);const He=new S2StreamListener(Ue,{onFill:(se,ve,Te)=>{console.log("[S2 → Widget] 📥 Remote fill received:",{fieldId:se,value:ve,sectionKey:Te}),sendFillCommand(se,ve,Te),b(se,ve,"agent","S2 remote fill"),emitFieldFilled(se,ve,Te)},onFillMultiple:se=>{console.log("[S2 → Widget] 📥 Remote fillMultiple received:",se);const ve={...M};se.forEach(Te=>{sendFillCommand(Te.fieldId,Te.value,Te.sectionKey),b(Te.fieldId,Te.value,"agent","S2 remote fill"),ve[Te.fieldId]=Te.value}),emitFormDataUpdated(ve,void 0,se.map(Te=>Te.fieldId))},onChatMessage:se=>{const ve=se;if(ve.source!=="widget"){const Te=ve.id||`${se.role}-${se.content}-${se.timestamp}`;O({id:Te,role:se.role==="assistant"?"model":se.role,content:se.content,timestamp:new Date(se.timestamp||Date.now())})}},onOdontogram:se=>{var je,et,tt;console.log("[S2 → Widget] 🦷 Remote odontogram received:",se);const ve=(tt=(et=(je=y==null?void 0:y.structure)==null?void 0:je.sections)==null?void 0:et.flatMap(Qe=>Qe.fields))==null?void 0:tt.find(Qe=>Qe.type==="odontogram");if(!ve){console.warn("[S2] ⚠️ No odontogram field found in template");return}const Te=se.fieldId||ve.htmlFieldId||ve.id,We=se.value||se;b(Te,We,"agent","S2 remote odontogram"),emitOdontogramUpdated(Te,We),emitFieldFilled(Te,We)},onTranscript:se=>{},onTitleUpdate:se=>{V(se),emitTitleUpdated(se,ie==null?void 0:ie.id)},onPing:()=>{},onError:se=>{console.error("[Session] S2 Error:",se),G(!1)},onDisconnect:()=>G(!1)});d.current=He,He.start(),G(!0)}p.current||(setupFieldListeners(Oe),setupSectionListeners(),p.current=!0),Be(),Se&&ie&&(notifyUserStream(Se,{action:"analysis_selected",analysisId:ie.id,source:"web_agent"}),notifyUserStream(Se,{action:"session_status",status:"started",analysisId:ie.id,source:"web_agent"})),emitSessionStarted(ie.id),console.log(`[Session] Init completed in ${(performance.now()-Z).toFixed(0)}ms`)})(),()=>{d.current&&d.current.stop()}},[T.apiKey]),React.useEffect(()=>{if(!N||!(S!=null&&S.id))return;const J=()=>{sendSessionStatus(N,{status:ae?"paused":"recording",isPaused:ae,isConnected:F,analysisId:S.id,templateName:y==null?void 0:y.name,formDataCount:Object.keys(M).length,transcriptCount:g.length,startedAt:P.current})};return J(),m.current=setInterval(J,5e3),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[N,S==null?void 0:S.id,ae,F]);const pe=React.useCallback(async()=>{console.log("[Session] Stopping session..."),m.current&&(clearInterval(m.current),m.current=null),await Ee();const J=Ae();if(console.log("[Session] Final usage stats:",J),he(),N&&await sendSessionStatus(N,{status:"stopped",isPaused:!1,isConnected:!1,analysisId:S==null?void 0:S.id}),d.current&&(d.current.stop(),d.current=null),G(!1),S!=null&&S.id){const j=C.map(Z=>({id:Z.id||Date.now().toString(),role:Z.role,text:Z.content}));await claraApi.completeAnalysis(S.id,M,D,g,j,J.totalTokens>0?J:void 0)}L&&(S!=null&&S.id)&¬ifyUserStream(L,{action:"session_status",status:"completed",analysisId:S.id,source:"web_agent"},!0),emitSessionStopped(S==null?void 0:S.id),q(),n()},[he,Ae,n,S,M,D,g,C,L,N,G,q,Ee]);React.useEffect(()=>{i&&(i.current={disconnect:pe,togglePause:Ie,isPaused:ae})},[i,pe,Ie,ae]),React.useEffect(()=>{const J=()=>{Ce&&(S!=null&&S.id)&&L&¬ifyUserStream(L,{action:"session_status",status:"completed",analysisId:S.id,source:"web_agent"},!0)};return window.addEventListener("beforeunload",J),()=>window.removeEventListener("beforeunload",J)},[Ce,S,L]),React.useEffect(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[g,a]);const Pe=(()=>{switch(fe){case SessionStatus.ACTIVE:return{bgClass:"bg-clara-success/20",borderClass:"border-clara-success/50",textClass:"text-clara-success",dotClass:"bg-clara-success animate-pulse",label:t("session.recording",U)};case SessionStatus.PAUSED:return{bgClass:"bg-clara-warning/20",borderClass:"border-clara-warning/50",textClass:"text-clara-warning",dotClass:"bg-clara-warning",label:t("session.paused",U)};case SessionStatus.CONNECTING:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground animate-pulse",label:t("common.loading",U)};case SessionStatus.DISCONNECTED:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground",label:U==="en"?"Ready":"Listo"};case SessionStatus.ERROR:default:return{bgClass:"bg-muted",borderClass:"border-border",textClass:"text-muted-foreground",dotClass:"bg-muted-foreground",label:U==="en"?"Ready":"Listo"}}})(),$e=()=>jsxRuntime.jsx("div",{className:"flex items-center gap-0.5 h-4",children:Array.from({length:5}).map((j,Z)=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full transition-all duration-75",style:{backgroundColor:de>Z/5?e:"#374151",height:`${Math.max(20,(Z+1)*20)}%`}},Z))});return jsxRuntime.jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col h-full bg-clara-surface relative",children:[jsxRuntime.jsx(AnimatePresence,{children:r&&l>0&&jsxRuntime.jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-[120] flex items-center justify-center bg-black/60 backdrop-blur-sm rounded-2xl",children:jsxRuntime.jsx(motion.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},exit:{scale:1.5,opacity:0},className:"text-white text-8xl font-black drop-shadow-lg",children:l},l)})}),jsxRuntime.jsxs("div",{className:"bg-clara-dark text-white px-3 py-2.5 flex justify-between items-center shadow-md z-10",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ChartColumn,{className:"w-4 h-4 text-clara-success"}),jsxRuntime.jsx("span",{className:"font-semibold text-xs tracking-wide uppercase",children:t("session.recording",U)}),Ce&&$e(),jsxRuntime.jsx("span",{title:F?"S2 Conectado":"S2 Desconectado",children:F?jsxRuntime.jsx(Wifi,{className:"w-3 h-3 text-clara-success"}):jsxRuntime.jsx(WifiOff,{className:"w-3 h-3 text-muted-foreground"})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[re&&jsxRuntime.jsx("span",{className:"text-destructive text-[10px] mr-2",children:re}),jsxRuntime.jsx("button",{onClick:Ie,disabled:!Ce,className:"p-1 rounded-full bg-gray-700 hover:bg-gray-600 transition-colors disabled:opacity-50",title:fe===SessionStatus.ACTIVE?t("session.pause",U):t("session.resume",U),children:fe===SessionStatus.PAUSED?jsxRuntime.jsx(Play,{className:"w-2.5 h-2.5",fill:"currentColor"}):jsxRuntime.jsx(Pause,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsx("button",{onClick:pe,className:"p-1 rounded-full bg-destructive/30 hover:bg-destructive/50 text-destructive-foreground border border-destructive/50 transition-colors",title:t("session.stop",U),children:jsxRuntime.jsx(Square,{className:"w-2.5 h-2.5",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:`flex items-center gap-1 px-2 py-0.5 rounded-full border text-[10px] font-medium ${Pe.bgClass} ${Pe.borderClass} ${Pe.textClass}`,children:[jsxRuntime.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${Pe.dotClass}`}),Pe.label]})]})]}),jsxRuntime.jsx("div",{className:"flex bg-card border-b border-border",children:["assistant","transcription","report"].map(J=>jsxRuntime.jsxs("button",{onClick:()=>s(J),className:`flex-1 py-2.5 text-[10px] font-bold tracking-wider uppercase transition-colors relative ${a===J?"":"text-muted-foreground hover:text-foreground"}`,style:a===J?{color:e}:{},children:[t(J==="assistant"?"tabs.chat":J==="transcription"?"tabs.transcript":"tabs.report",U),a===J&&jsxRuntime.jsx(motion.div,{layoutId:"activeSessionTab",className:"absolute bottom-0 left-0 w-full h-0.5",style:{backgroundColor:e}})]},J))}),jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a==="assistant"&&jsxRuntime.jsx("div",{className:"flex-1 flex flex-col min-h-0",children:jsxRuntime.jsx(ClaraChat,{primaryColor:e})}),a==="transcription"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col p-3",children:[jsxRuntime.jsx("div",{className:"mb-3 p-2 bg-clara-warning/10 border border-clara-warning/30 rounded-lg",children:jsxRuntime.jsxs("p",{className:"text-[10px] text-clara-warning font-medium text-center",children:["⚠️ ",t("transcript.provisional",U)]})}),jsxRuntime.jsx("div",{ref:c,className:"flex-1 overflow-y-auto space-y-3",children:g.length===0?jsxRuntime.jsx("div",{className:"text-center text-muted-foreground mt-12 text-xs",children:t(De?"transcript.connecting":Ce?"transcript.listening":"transcript.startSession",U)}):g.map((J,j)=>jsxRuntime.jsx("div",{className:`flex flex-col ${J.role==="user"?"items-end":"items-start"}`,children:jsxRuntime.jsx("div",{className:`max-w-[85%] px-2.5 py-2 rounded-lg text-xs ${J.role==="user"?"bg-card border border-border text-foreground rounded-tr-none shadow-sm":"rounded-tl-none"}`,style:J.role!=="user"?{borderColor:`${e}33`,backgroundColor:`${e}0D`,color:"inherit"}:{},children:J.content})},j))})]}),a==="report"&&jsxRuntime.jsxs(motion.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"h-full flex flex-col overflow-y-auto p-4 bg-card overscroll-contain",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("h2",{className:"text-sm font-bold text-foreground",children:t("report.capturedData",U)}),jsxRuntime.jsxs("button",{onClick:()=>{var me;const J=((me=y==null?void 0:y.structure)==null?void 0:me.sections)||[],j=window.open("","_blank");if(!j)return;let Z=`
|
|
440
450
|
<!DOCTYPE html>
|
|
441
451
|
<html>
|
|
442
452
|
<head>
|