@aarsteinmedia/dotlottie-player 4.0.11 → 4.0.13

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.
@@ -7,9 +7,657 @@
7
7
  "path": "dist/index.js",
8
8
  "declarations": [
9
9
  {
10
- "kind": "variable",
10
+ "kind": "class",
11
+ "description": "",
11
12
  "name": "DotLottiePlayer",
12
- "default": "class extends EnhancedElement{async connectedCallback(){super.connectedCallback(),this._render(),this._container=this.shadow.querySelector(\".animation\"),this._renderControls(),void 0!==document.hidden&&document.addEventListener(\"visibilitychange\",this._onVisibilityChange),this._addIntersectionObserver(),await this.load(this.src),this.dispatchEvent(new CustomEvent(PlayerEvents.Rendered))}disconnectedCallback(){this._intersectionObserver&&(this._intersectionObserver.disconnect(),this._intersectionObserver=void 0),this._lottieInstance&&this._lottieInstance.destroy(),document.removeEventListener(\"visibilitychange\",this._onVisibilityChange)}static get observedAttributes(){return[\"animateOnScroll\",\"autoplay\",\"controls\",\"direction\",\"hover\",\"loop\",\"mode\",\"speed\",\"src\",\"subframe\"]}async attributeChangedCallback(t,e,i){if(this._lottieInstance){if(\"animateOnScroll\"===t){if(\"\"===i||i){this._lottieInstance.autoplay=!1,addEventListener(\"scroll\",this._handleScroll,{capture:!0,passive:!0});return}removeEventListener(\"scroll\",this._handleScroll,!0)}if(\"autoplay\"===t){if(this.animateOnScroll)return;if(\"\"===i||i){this.play();return}this.stop()}if(\"controls\"===t&&this._renderControls(),\"direction\"===t){if(-1===Number(i))return this.setDirection(-1);this.setDirection(1)}if(\"hover\"===t&&this._container){if(\"\"===i||i){this._container.addEventListener(\"mouseenter\",this._mouseEnter),this._container.addEventListener(\"mouseleave\",this._mouseLeave);return}this._container.removeEventListener(\"mouseenter\",this._mouseEnter),this._container.removeEventListener(\"mouseleave\",this._mouseLeave)}if(\"loop\"===t){let t=this.shadow.querySelector(\".toggleLoop\");t instanceof HTMLButtonElement&&(t.dataset.active=i),this.setLoop(\"\"===i||!!i)}if(\"mode\"===t){let t=this.shadow.querySelector(\".toggleBoomerang\");t instanceof HTMLButtonElement&&(t.dataset.active=(i===PlayMode.Bounce).toString()),this._isBounce=i===PlayMode.Bounce}if(\"speed\"===t){let t=Number(i);t&&!isNaN(t)&&this.setSpeed(t)}\"src\"===t&&await this.load(i),\"subframe\"===t&&this.setSubframe(\"\"===i||!!i)}}static get observedProperties(){return[\"playerState\",\"_isSettingsOpen\",\"_seeker\",\"_currentAnimation\",\"_animations\"]}propertyChangedCallback(t,e,i){if(!this.shadow)return;let s=this.shadow.querySelector(\".togglePlay\"),r=this.shadow.querySelector(\".stop\"),n=this.shadow.querySelector(\".prev\"),a=this.shadow.querySelector(\".next\"),o=this.shadow.querySelector(\".seeker\"),h=this.shadow.querySelector(\"progress\"),l=this.shadow.querySelector(\".popover\"),p=this.shadow.querySelector(\".convert\");s instanceof HTMLButtonElement&&r instanceof HTMLButtonElement&&a instanceof HTMLButtonElement&&n instanceof HTMLButtonElement&&o instanceof HTMLInputElement&&h instanceof HTMLProgressElement&&(\"playerState\"===t&&(s.dataset.active=(i===PlayerState.Playing||i===PlayerState.Paused).toString(),r.dataset.active=(i===PlayerState.Stopped).toString(),i===PlayerState.Playing?s.innerHTML='<svg width=\"24\" height=\"24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M14.016 5.016H18v13.969h-3.984V5.016zM6 18.984V5.015h3.984v13.969H6z\"/></svg>':s.innerHTML='<svg width=\"24\" height=\"24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M8.016 5.016L18.985 12 8.016 18.984V5.015z\"/></svg>'),\"_seeker\"===t&&\"number\"==typeof i&&(o.value=i.toString(),o.ariaValueNow=i.toString(),h.value=i),\"_animations\"===t&&Array.isArray(i)&&this._currentAnimation+1<i.length&&(a.hidden=!1),\"_currentAnimation\"===t&&\"number\"==typeof i&&(i+1>=this._animations.length?a.hidden=!0:a.hidden=!1,i?n.hidden=!1:n.hidden=!0),\"_isSettingsOpen\"===t&&\"boolean\"==typeof i&&l instanceof HTMLDivElement&&p instanceof HTMLButtonElement&&(l.hidden=!i,p.hidden=this._isDotLottie))}set animateOnScroll(t){this.setAttribute(\"animateOnScroll\",(!!t).toString())}get animateOnScroll(){let t=this.getAttribute(\"animateOnScroll\");return\"true\"===t||\"\"===t||\"1\"===t}set autoplay(t){this.setAttribute(\"autoplay\",(!!t).toString())}get autoplay(){let t=this.getAttribute(\"autoplay\");return\"true\"===t||\"\"===t||\"1\"===t}set background(t){this.setAttribute(\"background\",t)}get background(){return this.getAttribute(\"background\")||\"transparent\"}set controls(t){this.setAttribute(\"controls\",(!!t).toString())}get controls(){let t=this.getAttribute(\"controls\");return\"true\"===t||\"\"===t||\"1\"===t}set count(t){this.setAttribute(\"count\",t.toString())}get count(){let t=this.getAttribute(\"count\");return t?Number(t):0}set description(t){t&&this.setAttribute(\"description\",t)}get description(){return this.getAttribute(\"description\")}set direction(t){this.setAttribute(\"direction\",t.toString())}get direction(){let t=Number(this.getAttribute(\"direction\"));return -1===t?t:1}set hover(t){this.setAttribute(\"hover\",t.toString())}get hover(){let t=this.getAttribute(\"hover\");return\"true\"===t||\"\"===t||\"1\"===t}set intermission(t){this.setAttribute(\"intermission\",t.toString())}get intermission(){let t=Number(this.getAttribute(\"intermission\"));return isNaN(t)?0:t}set loop(t){this.setAttribute(\"loop\",(!!t).toString())}get loop(){let t=this.getAttribute(\"loop\");return\"true\"===t||\"\"===t||\"1\"===t}set mode(t){this.setAttribute(\"mode\",t.toString())}get mode(){let t=this.getAttribute(\"mode\");return t===PlayMode.Bounce?t:PlayMode.Normal}set objectfit(t){this.setAttribute(\"objectfit\",t)}get objectfit(){let t=this.getAttribute(\"objectfit\");return t&&Object.values(ObjectFit).includes(t)?t:ObjectFit.Contain}set preserveAspectRatio(t){this.setAttribute(\"preserveAspectRatio\",t||PreserveAspectRatio.Contain)}get preserveAspectRatio(){let t=this.getAttribute(\"preserveAspectRatio\");return t&&Object.values(PreserveAspectRatio).includes(t)?t:null}set renderer(t){this.setAttribute(\"renderer\",t)}get renderer(){let t=this.getAttribute(\"renderer\");return\"canvas\"===t||\"html\"===t?t:\"svg\"}set simple(t){this.setAttribute(\"simple\",t.toString())}get simple(){let t=this.getAttribute(\"simple\");return\"true\"===t||\"\"===t||\"1\"===t}set speed(t){this.setAttribute(\"speed\",t?.toString())}get speed(){let t=this.getAttribute(\"speed\");return null===t||isNaN(Number(t))?1:Number(t)}set src(t){this.setAttribute(\"src\",t||\"\")}get src(){return this.getAttribute(\"src\")}set subframe(t){this.setAttribute(\"subframe\",(!!t).toString())}get subframe(){let t=this.getAttribute(\"subframe\");return\"true\"===t||\"\"===t||\"1\"===t}getMultiAnimationSettings(){return this._multiAnimationSettings}setMultiAnimationSettings(t){this._multiAnimationSettings=t}setSegment(t){this._segment=t}getSegment(){return this._segment}_getOptions(){if(!this._container)throw Error(\"Container not rendered\");let t=this.preserveAspectRatio??(this.objectfit&&aspectRatio(this.objectfit)),e=this._multiAnimationSettings?.length?this._multiAnimationSettings?.[this._currentAnimation]:void 0,i=this._manifest.animations?.[this._currentAnimation],s=!!this.loop;void 0!==i.loop&&void 0===this.loop&&(s=!!i.loop),e?.loop!==void 0&&(s=!!e.loop);let r=!!this.autoplay;void 0!==i.autoplay&&void 0===this.autoplay&&(r=!!i.autoplay),e?.autoplay!==void 0&&(r=!!e.autoplay),this.animateOnScroll&&(r=!1);let n=this._segment;this._segment?.every(t=>t>0)&&(n=[this._segment[0]-1,this._segment[1]-1]),this._segment?.some(t=>t<0)&&(n=void 0);let a={autoplay:r,container:this._container,initialSegment:n,loop:s,renderer:this.renderer,rendererSettings:{imagePreserveAspectRatio:t}};switch(this.renderer){case\"svg\":a.rendererSettings={...a.rendererSettings,hideOnTransparent:!0,preserveAspectRatio:t,progressiveLoad:!0};break;case\"canvas\":a.rendererSettings={...a.rendererSettings,clearCanvas:!0,preserveAspectRatio:t,progressiveLoad:!0};break;case\"html\":a.rendererSettings={...a.rendererSettings,hideOnTransparent:!0}}return a}_addIntersectionObserver(){this._container&&!this._intersectionObserver&&\"IntersectionObserver\"in window&&(this._intersectionObserver=new IntersectionObserver(t=>{for(let e of t){if(!e.isIntersecting||document.hidden){this.playerState===PlayerState.Playing&&this._freeze(),this._playerState.visible=!1;continue}this.animateOnScroll||this.playerState!==PlayerState.Frozen||this.play(),this._playerState.scrollY||(this._playerState.scrollY=scrollY),this._playerState.visible=!0}}),this._intersectionObserver.observe(this._container))}async load(t){if(!this.shadowRoot||!t)return;try{let{animations:e,isDotLottie:i,manifest:s}=await getAnimationData(t);if(!e||e.some(t=>!this._isLottie(t)))throw Error(\"Broken or corrupted file\");this._isBounce=this.mode===PlayMode.Bounce,this._multiAnimationSettings?.length&&this._multiAnimationSettings[this._currentAnimation]?.mode&&(this._isBounce=this._multiAnimationSettings[this._currentAnimation].mode===PlayMode.Bounce),this._isDotLottie=!!i,this._animations=e,this._manifest=s??{animations:[{autoplay:!this.animateOnScroll&&this.autoplay,direction:this.direction,id:useId(),loop:this.loop,mode:this.mode,speed:this.speed}]},this._lottieInstance&&this._lottieInstance.destroy(),this.playerState=PlayerState.Stopped,!this.animateOnScroll&&(this.autoplay||this._multiAnimationSettings?.[this._currentAnimation]?.autoplay)&&(this.playerState=PlayerState.Playing),this._lottieInstance=lottie.loadAnimation({...this._getOptions(),animationData:e[this._currentAnimation]})}catch(t){this._errorMessage=handleErrors(t).message,this.playerState=PlayerState.Error,this.dispatchEvent(new CustomEvent(PlayerEvents.Error));return}this._addEventListeners();let e=this._multiAnimationSettings?.[this._currentAnimation]?.speed??this.speed??this._manifest.animations[this._currentAnimation].speed,i=this._multiAnimationSettings?.[this._currentAnimation]?.direction??this.direction??this._manifest.animations[this._currentAnimation].direction??1;this._lottieInstance.setSpeed(e),this._lottieInstance.setDirection(i),this._lottieInstance.setSubframe(!!this.subframe),(this.autoplay||this.animateOnScroll)&&(-1===this.direction&&this.seek(\"99%\"),\"IntersectionObserver\"in window||(this.animateOnScroll||this.play(),this._playerState.visible=!0),this._addIntersectionObserver())}getManifest(){return this._manifest}_toggleEventListeners(t){let e=\"add\"===t?\"addEventListener\":\"removeEventListener\";this._lottieInstance&&(this._lottieInstance[e](\"enterFrame\",this._enterFrame),this._lottieInstance[e](\"complete\",this._complete),this._lottieInstance[e](\"loopComplete\",this._loopComplete),this._lottieInstance[e](\"DOMLoaded\",this._DOMLoaded),this._lottieInstance[e](\"data_ready\",this._dataReady),this._lottieInstance[e](\"data_failed\",this._dataFailed)),this._container&&this.hover&&(this._container[e](\"mouseenter\",this._mouseEnter),this._container[e](\"mouseleave\",this._mouseLeave)),window[e](\"focus\",this._handleWindowBlur,{capture:!1,passive:!0}),window[e](\"blur\",this._handleWindowBlur,{capture:!1,passive:!0}),this.animateOnScroll&&window[e](\"scroll\",this._handleScroll,{capture:!0,passive:!0})}_addEventListeners(){this._toggleEventListeners(\"add\")}_removeEventListeners(){this._toggleEventListeners(\"remove\")}_loopComplete(){if(!this._lottieInstance)return;let{playDirection:t,totalFrames:e}=this._lottieInstance,i=this._segment?this._segment[0]:0,s=this._segment?this._segment[0]:e;if(this.count&&(this._isBounce?this._playerState.count+=.5:this._playerState.count+=1,this._playerState.count>=this.count)){this.setLoop(!1),this.playerState=PlayerState.Completed,this.dispatchEvent(new CustomEvent(PlayerEvents.Complete));return}return(this.dispatchEvent(new CustomEvent(PlayerEvents.Loop)),this._isBounce)?(this._lottieInstance.goToAndStop(-1===t?i:.99*s,!0),this._lottieInstance.setDirection(-1*t),setTimeout(()=>{this.animateOnScroll||this._lottieInstance?.play()},this.intermission)):(this._lottieInstance.goToAndStop(-1===t?.99*s:i,!0),setTimeout(()=>{this.animateOnScroll||this._lottieInstance?.play()},this.intermission))}_enterFrame(){if(!this._lottieInstance)return;let{currentFrame:t,totalFrames:e}=this._lottieInstance;this._seeker=Math.round(t/e*100),this.dispatchEvent(new CustomEvent(PlayerEvents.Frame,{detail:{frame:t,seeker:this._seeker}}))}_complete(){if(!this._lottieInstance)return;if(this._animations.length>1){if(this._multiAnimationSettings?.[this._currentAnimation+1]?.autoplay)return this.next();if(this.loop&&this._currentAnimation===this._animations.length-1)return this._currentAnimation=0,this._switchInstance()}let{currentFrame:t,totalFrames:e}=this._lottieInstance;this._seeker=Math.round(t/e*100),this.playerState=PlayerState.Completed,this.dispatchEvent(new CustomEvent(PlayerEvents.Complete,{detail:{frame:t,seeker:this._seeker}}))}_DOMLoaded(){this._playerState.loaded=!0,this.dispatchEvent(new CustomEvent(PlayerEvents.Ready))}_dataReady(){this.dispatchEvent(new CustomEvent(PlayerEvents.Load))}_dataFailed(){this.playerState=PlayerState.Error,this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}_handleWindowBlur({type:t}){this.playerState===PlayerState.Playing&&\"blur\"===t&&this._freeze(),this.playerState===PlayerState.Frozen&&\"focus\"===t&&this.play()}_mouseEnter(){this.hover&&this.playerState!==PlayerState.Playing&&this.play()}_mouseLeave(){this.hover&&this.playerState===PlayerState.Playing&&this.stop()}_onVisibilityChange(){if(document.hidden&&this.playerState===PlayerState.Playing){this._freeze();return}this.playerState===PlayerState.Frozen&&this.play()}_handleScroll(){if(this.animateOnScroll&&this._lottieInstance){if(isServer()){console.warn(\"DotLottie: Scroll animations might not work properly in a Server Side Rendering context. Try to wrap this in a client component.\");return}if(this._playerState.visible){this._playerState.scrollTimeout&&clearTimeout(this._playerState.scrollTimeout),this._playerState.scrollTimeout=setTimeout(()=>{this.playerState=PlayerState.Paused},400);let t=Math.min(Math.max((scrollY>this._playerState.scrollY?scrollY-this._playerState.scrollY:this._playerState.scrollY-scrollY)/3,1),3*this._lottieInstance.totalFrames)/3;requestAnimationFrame(()=>{t<(this._lottieInstance?.totalFrames??0)?(this.playerState=PlayerState.Playing,this._lottieInstance?.goToAndStop(t,!0)):this.playerState=PlayerState.Paused})}}}_handleSeekChange({target:t}){!(t instanceof HTMLInputElement)||!this._lottieInstance||isNaN(Number(t.value))||this.seek(Math.round(Number(t.value)/100*this._lottieInstance.totalFrames))}_isLottie(t){return[\"v\",\"ip\",\"op\",\"layers\",\"fr\",\"w\",\"h\"].every(e=>Object.prototype.hasOwnProperty.call(t,e))}async addAnimation(t,e,i=!0){let{animations:s=[],manifest:r={animations:this.src?[{id:this._identifier}]:[]}}=this.src?await getAnimationData(this.src):{};try{for(let e of(r.generator=pkg.name,t)){let{url:t}=e,{animations:i}=await getAnimationData(t);if(!i)throw Error(\"No animation loaded\");if(r.animations.some(({id:t})=>t===e.id))throw Error(\"Duplicate id for animation\");r.animations=[...r.animations,{id:e.id}],s?.push(...i)}return{result:await createDotLottie({animations:s,fileName:e,manifest:r,shouldDownload:i}),success:!0}}catch(t){return{error:handleErrors(t).message,success:!1}}}getLottie(){return this._lottieInstance}async play(){if(this._lottieInstance){this.playerState&&(this._playerState.prev=this.playerState);try{this._lottieInstance.play(),this.dispatchEvent(new CustomEvent(PlayerEvents.Play))}finally{this.playerState=PlayerState.Playing}}}pause(){if(this._lottieInstance){this.playerState&&(this._playerState.prev=this.playerState);try{this._lottieInstance.pause(),this.dispatchEvent(new CustomEvent(PlayerEvents.Pause))}finally{this.playerState=PlayerState.Paused}}}stop(){if(this._lottieInstance){this.playerState&&(this._playerState.prev=this.playerState),this._playerState.count=0;try{this._lottieInstance.stop(),this.dispatchEvent(new CustomEvent(PlayerEvents.Stop))}finally{this.playerState=PlayerState.Stopped}}}destroy(){this._lottieInstance&&(this.playerState=PlayerState.Destroyed,this._lottieInstance.destroy(),this._lottieInstance=null,this.dispatchEvent(new CustomEvent(PlayerEvents.Destroyed)),this.remove(),document.removeEventListener(\"visibilitychange\",this._onVisibilityChange))}seek(t){if(!this._lottieInstance)return;let e=t.toString().match(/^([0-9]+)(%?)$/);if(!e)return;let i=Math.round(\"%\"===e[2]?this._lottieInstance.totalFrames*Number(e[1])/100:Number(e[1]));if(this._seeker=i,this.playerState===PlayerState.Playing||this.playerState===PlayerState.Frozen&&this._playerState.prev===PlayerState.Playing){this._lottieInstance.goToAndPlay(i,!0),this.playerState=PlayerState.Playing;return}this._lottieInstance.goToAndStop(i,!0),this._lottieInstance.pause()}snapshot(t=!0,e=\"AM Lottie\"){try{if(!this.shadowRoot)throw Error(\"Unknown error\");let i=this.shadowRoot.querySelector(\".animation svg\");if(!i)throw Error(\"Could not retrieve animation from DOM\");let s=i instanceof Node?new XMLSerializer().serializeToString(i):null;if(!s)throw Error(\"Could not serialize SVG element\");return t&&download(s,{mimeType:\"image/svg+xml\",name:`${getFilename(this.src||e)}-${frameOutput(this._seeker)}.svg`}),s}catch(t){return console.error(t),null}}setSubframe(t){this._lottieInstance&&this._lottieInstance.setSubframe(t)}setCount(t){this.count=t}_freeze(){if(this._lottieInstance){this.playerState&&(this._playerState.prev=this.playerState);try{this._lottieInstance.pause(),this.dispatchEvent(new CustomEvent(PlayerEvents.Freeze))}finally{this.playerState=PlayerState.Frozen}}}async reload(){this._lottieInstance&&this.src&&(this._lottieInstance.destroy(),await this.load(this.src))}setSpeed(t=1){this._lottieInstance&&this._lottieInstance.setSpeed(t)}setDirection(t){this._lottieInstance&&this._lottieInstance.setDirection(t)}setLoop(t){this._lottieInstance&&this._lottieInstance.setLoop(t)}togglePlay(){if(!this._lottieInstance)return;let{currentFrame:t,playDirection:e,totalFrames:i}=this._lottieInstance;return this.playerState===PlayerState.Playing?this.pause():this.playerState!==PlayerState.Completed?this.play():(this.playerState=PlayerState.Playing,this._isBounce)?(this.setDirection(-1*e),this._lottieInstance.goToAndPlay(t,!0)):-1===e?this._lottieInstance.goToAndPlay(i,!0):this._lottieInstance.goToAndPlay(0,!0)}toggleLoop(){let t=!this.loop;this.loop=t,this.setLoop(t)}toggleBoomerang(){let t=this._multiAnimationSettings?.[this._currentAnimation];if(t?.mode!==void 0){if(t.mode===PlayMode.Normal){t.mode=PlayMode.Bounce,this._isBounce=!0;return}t.mode=PlayMode.Normal,this._isBounce=!1;return}if(this.mode===PlayMode.Normal){this.mode=PlayMode.Bounce,this._isBounce=!0;return}this.mode=PlayMode.Normal,this._isBounce=!1}_toggleSettings(t){if(void 0===t){this._isSettingsOpen=!this._isSettingsOpen;return}this._isSettingsOpen=t}_handleBlur(){setTimeout(()=>this._toggleSettings(!1),200)}_switchInstance(t=!1){if(this._animations[this._currentAnimation])try{if(this._lottieInstance&&this._lottieInstance.destroy(),this._lottieInstance=lottie.loadAnimation({...this._getOptions(),animationData:this._animations[this._currentAnimation]}),this._multiAnimationSettings?.[this._currentAnimation]?.mode&&(this._isBounce=this._multiAnimationSettings[this._currentAnimation].mode===PlayMode.Bounce),this._removeEventListeners(),this._addEventListeners(),this.dispatchEvent(new CustomEvent(t?PlayerEvents.Previous:PlayerEvents.Next)),this._multiAnimationSettings?.[this._currentAnimation]?.autoplay??this.autoplay){if(this.animateOnScroll){this._lottieInstance?.goToAndStop(0,!0),this.playerState=PlayerState.Paused;return}this._lottieInstance?.goToAndPlay(0,!0),this.playerState=PlayerState.Playing;return}this._lottieInstance?.goToAndStop(0,!0),this.playerState=PlayerState.Stopped}catch(t){this._errorMessage=handleErrors(t).message,this.playerState=PlayerState.Error,this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}}next(){this._currentAnimation++,this._switchInstance()}prev(){this._currentAnimation--,this._switchInstance(!0)}async convert({animations:t,fileName:e,manifest:i,shouldDownload:s=!0,src:r,typeCheck:n}){return n||this._isDotLottie?createJSON({animation:(await getAnimationData(r||this.src))?.animations?.[0],fileName:`${getFilename(e||this.src||\"converted\")}.json`,shouldDownload:s}):createDotLottie({animations:t||(await getAnimationData(this.src))?.animations,fileName:`${getFilename(e||this.src||\"converted\")}.lottie`,manifest:{...i||this._manifest,generator:pkg.name},shouldDownload:s})}static get styles(){let t=new CSSStyleSheet;return t.replace(css_248z),t}constructor(){super(),this._renderControls=renderControls,this._render=renderPlayer,this._multiAnimationSettings=[],this._container=null,this.playerState=PlayerState.Loading,this._isSettingsOpen=!1,this._seeker=0,this._currentAnimation=0,this._lottieInstance=null,this._identifier=this.id||useId(\"dotlottie\"),this._errorMessage=\"Something went wrong\",this._isBounce=!1,this._isDotLottie=!1,this._playerState={count:0,loaded:!1,prev:PlayerState.Loading,scrollTimeout:null,scrollY:0,visible:!1},this._handleSettingsClick=({target:t})=>{this._toggleSettings(),t instanceof HTMLElement&&t.focus()},this._complete=this._complete.bind(this),this._dataFailed=this._dataFailed.bind(this),this._dataReady=this._dataReady.bind(this),this._DOMLoaded=this._DOMLoaded.bind(this),this._enterFrame=this._enterFrame.bind(this),this._freeze=this._freeze.bind(this),this._handleBlur=this._handleBlur.bind(this),this._handleScroll=this._handleScroll.bind(this),this._handleSeekChange=this._handleSeekChange.bind(this),this._handleWindowBlur=this._handleWindowBlur.bind(this),this._loopComplete=this._loopComplete.bind(this),this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._switchInstance=this._switchInstance.bind(this),this.togglePlay=this.togglePlay.bind(this),this.stop=this.stop.bind(this),this.prev=this.prev.bind(this),this.next=this.next.bind(this),this._renderControls=this._renderControls.bind(this),this.snapshot=this.snapshot.bind(this),this.toggleLoop=this.toggleLoop.bind(this),this.toggleBoomerang=this.toggleBoomerang.bind(this),this.convert=this.convert.bind(this),this.destroy=this.destroy.bind(this),this.template=document.createElement(\"template\"),this.shadow=this.attachShadow({mode:\"open\"})}}"
13
+ "members": [
14
+ {
15
+ "kind": "field",
16
+ "name": "observedProperties",
17
+ "static": true,
18
+ "readonly": true
19
+ },
20
+ {
21
+ "kind": "method",
22
+ "name": "propertyChangedCallback",
23
+ "parameters": [
24
+ {
25
+ "name": "t"
26
+ },
27
+ {
28
+ "name": "e"
29
+ },
30
+ {
31
+ "name": "i"
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ "kind": "field",
37
+ "name": "animateOnScroll"
38
+ },
39
+ {
40
+ "kind": "field",
41
+ "name": "autoplay"
42
+ },
43
+ {
44
+ "kind": "field",
45
+ "name": "background"
46
+ },
47
+ {
48
+ "kind": "field",
49
+ "name": "controls"
50
+ },
51
+ {
52
+ "kind": "field",
53
+ "name": "count"
54
+ },
55
+ {
56
+ "kind": "field",
57
+ "name": "description"
58
+ },
59
+ {
60
+ "kind": "field",
61
+ "name": "direction"
62
+ },
63
+ {
64
+ "kind": "field",
65
+ "name": "hover"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "name": "intermission"
70
+ },
71
+ {
72
+ "kind": "field",
73
+ "name": "loop"
74
+ },
75
+ {
76
+ "kind": "field",
77
+ "name": "mode"
78
+ },
79
+ {
80
+ "kind": "field",
81
+ "name": "objectfit"
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "name": "preserveAspectRatio"
86
+ },
87
+ {
88
+ "kind": "field",
89
+ "name": "renderer"
90
+ },
91
+ {
92
+ "kind": "field",
93
+ "name": "simple"
94
+ },
95
+ {
96
+ "kind": "field",
97
+ "name": "speed"
98
+ },
99
+ {
100
+ "kind": "field",
101
+ "name": "src"
102
+ },
103
+ {
104
+ "kind": "field",
105
+ "name": "subframe"
106
+ },
107
+ {
108
+ "kind": "method",
109
+ "name": "getMultiAnimationSettings"
110
+ },
111
+ {
112
+ "kind": "method",
113
+ "name": "setMultiAnimationSettings",
114
+ "parameters": [
115
+ {
116
+ "name": "t"
117
+ }
118
+ ]
119
+ },
120
+ {
121
+ "kind": "method",
122
+ "name": "setSegment",
123
+ "parameters": [
124
+ {
125
+ "name": "t"
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "kind": "method",
131
+ "name": "getSegment"
132
+ },
133
+ {
134
+ "kind": "method",
135
+ "name": "_getOptions"
136
+ },
137
+ {
138
+ "kind": "method",
139
+ "name": "_addIntersectionObserver"
140
+ },
141
+ {
142
+ "kind": "method",
143
+ "name": "load",
144
+ "parameters": [
145
+ {
146
+ "name": "t"
147
+ }
148
+ ]
149
+ },
150
+ {
151
+ "kind": "method",
152
+ "name": "getManifest"
153
+ },
154
+ {
155
+ "kind": "method",
156
+ "name": "_toggleEventListeners",
157
+ "parameters": [
158
+ {
159
+ "name": "t"
160
+ }
161
+ ]
162
+ },
163
+ {
164
+ "kind": "method",
165
+ "name": "_addEventListeners"
166
+ },
167
+ {
168
+ "kind": "method",
169
+ "name": "_removeEventListeners"
170
+ },
171
+ {
172
+ "kind": "method",
173
+ "name": "_loopComplete"
174
+ },
175
+ {
176
+ "kind": "method",
177
+ "name": "_enterFrame"
178
+ },
179
+ {
180
+ "kind": "method",
181
+ "name": "_complete"
182
+ },
183
+ {
184
+ "kind": "method",
185
+ "name": "_DOMLoaded"
186
+ },
187
+ {
188
+ "kind": "method",
189
+ "name": "_dataReady"
190
+ },
191
+ {
192
+ "kind": "method",
193
+ "name": "_dataFailed"
194
+ },
195
+ {
196
+ "kind": "method",
197
+ "name": "_handleWindowBlur",
198
+ "parameters": [
199
+ {
200
+ "name": "{type:t}"
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ "kind": "method",
206
+ "name": "_mouseEnter"
207
+ },
208
+ {
209
+ "kind": "method",
210
+ "name": "_mouseLeave"
211
+ },
212
+ {
213
+ "kind": "method",
214
+ "name": "_onVisibilityChange"
215
+ },
216
+ {
217
+ "kind": "method",
218
+ "name": "_handleScroll"
219
+ },
220
+ {
221
+ "kind": "method",
222
+ "name": "_handleSeekChange",
223
+ "parameters": [
224
+ {
225
+ "name": "{target:t}"
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "kind": "method",
231
+ "name": "_isLottie",
232
+ "parameters": [
233
+ {
234
+ "name": "t"
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "kind": "method",
240
+ "name": "addAnimation",
241
+ "parameters": [
242
+ {
243
+ "name": "t"
244
+ },
245
+ {
246
+ "name": "e"
247
+ },
248
+ {
249
+ "name": "i",
250
+ "default": "!0"
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ "kind": "method",
256
+ "name": "getLottie"
257
+ },
258
+ {
259
+ "kind": "method",
260
+ "name": "play"
261
+ },
262
+ {
263
+ "kind": "method",
264
+ "name": "pause"
265
+ },
266
+ {
267
+ "kind": "method",
268
+ "name": "stop"
269
+ },
270
+ {
271
+ "kind": "method",
272
+ "name": "destroy"
273
+ },
274
+ {
275
+ "kind": "method",
276
+ "name": "seek",
277
+ "parameters": [
278
+ {
279
+ "name": "t"
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "kind": "method",
285
+ "name": "snapshot",
286
+ "parameters": [
287
+ {
288
+ "name": "t",
289
+ "default": "!0"
290
+ },
291
+ {
292
+ "name": "e",
293
+ "default": "\"AM Lottie\""
294
+ }
295
+ ]
296
+ },
297
+ {
298
+ "kind": "method",
299
+ "name": "setSubframe",
300
+ "parameters": [
301
+ {
302
+ "name": "t"
303
+ }
304
+ ]
305
+ },
306
+ {
307
+ "kind": "method",
308
+ "name": "setCount",
309
+ "parameters": [
310
+ {
311
+ "name": "t"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "kind": "method",
317
+ "name": "_freeze"
318
+ },
319
+ {
320
+ "kind": "method",
321
+ "name": "reload"
322
+ },
323
+ {
324
+ "kind": "method",
325
+ "name": "setSpeed",
326
+ "parameters": [
327
+ {
328
+ "name": "t",
329
+ "default": "1"
330
+ }
331
+ ]
332
+ },
333
+ {
334
+ "kind": "method",
335
+ "name": "setDirection",
336
+ "parameters": [
337
+ {
338
+ "name": "t"
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ "kind": "method",
344
+ "name": "setLoop",
345
+ "parameters": [
346
+ {
347
+ "name": "t"
348
+ }
349
+ ]
350
+ },
351
+ {
352
+ "kind": "method",
353
+ "name": "togglePlay"
354
+ },
355
+ {
356
+ "kind": "method",
357
+ "name": "toggleLoop"
358
+ },
359
+ {
360
+ "kind": "method",
361
+ "name": "toggleBoomerang"
362
+ },
363
+ {
364
+ "kind": "method",
365
+ "name": "_toggleSettings",
366
+ "parameters": [
367
+ {
368
+ "name": "t"
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ "kind": "method",
374
+ "name": "_handleBlur"
375
+ },
376
+ {
377
+ "kind": "method",
378
+ "name": "_switchInstance",
379
+ "parameters": [
380
+ {
381
+ "name": "t",
382
+ "default": "!1"
383
+ }
384
+ ]
385
+ },
386
+ {
387
+ "kind": "method",
388
+ "name": "next"
389
+ },
390
+ {
391
+ "kind": "method",
392
+ "name": "prev"
393
+ },
394
+ {
395
+ "kind": "method",
396
+ "name": "convert",
397
+ "parameters": [
398
+ {
399
+ "name": "{animations:t,fileName:e,manifest:i,shouldDownload:s=!0,src:r,typeCheck:n}"
400
+ }
401
+ ]
402
+ },
403
+ {
404
+ "kind": "field",
405
+ "name": "styles",
406
+ "static": true,
407
+ "readonly": true
408
+ },
409
+ {
410
+ "kind": "field",
411
+ "name": "_renderControls",
412
+ "default": "renderControls"
413
+ },
414
+ {
415
+ "kind": "field",
416
+ "name": "_render",
417
+ "default": "renderPlayer"
418
+ },
419
+ {
420
+ "kind": "field",
421
+ "name": "_multiAnimationSettings",
422
+ "type": {
423
+ "text": "array"
424
+ },
425
+ "default": "[]"
426
+ },
427
+ {
428
+ "kind": "field",
429
+ "name": "_container",
430
+ "type": {
431
+ "text": "null"
432
+ },
433
+ "default": "null"
434
+ },
435
+ {
436
+ "kind": "field",
437
+ "name": "playerState"
438
+ },
439
+ {
440
+ "kind": "field",
441
+ "name": "_isSettingsOpen",
442
+ "type": {
443
+ "text": "boolean"
444
+ },
445
+ "default": "!1"
446
+ },
447
+ {
448
+ "kind": "field",
449
+ "name": "_seeker",
450
+ "type": {
451
+ "text": "number"
452
+ },
453
+ "default": "0"
454
+ },
455
+ {
456
+ "kind": "field",
457
+ "name": "_currentAnimation",
458
+ "type": {
459
+ "text": "number"
460
+ },
461
+ "default": "0"
462
+ },
463
+ {
464
+ "kind": "field",
465
+ "name": "_lottieInstance",
466
+ "type": {
467
+ "text": "null"
468
+ },
469
+ "default": "null"
470
+ },
471
+ {
472
+ "kind": "field",
473
+ "name": "_identifier"
474
+ },
475
+ {
476
+ "kind": "field",
477
+ "name": "_errorMessage",
478
+ "type": {
479
+ "text": "string"
480
+ },
481
+ "default": "\"Something went wrong\""
482
+ },
483
+ {
484
+ "kind": "field",
485
+ "name": "_isBounce",
486
+ "type": {
487
+ "text": "boolean"
488
+ },
489
+ "default": "!1"
490
+ },
491
+ {
492
+ "kind": "field",
493
+ "name": "_isDotLottie",
494
+ "type": {
495
+ "text": "boolean"
496
+ },
497
+ "default": "!1"
498
+ },
499
+ {
500
+ "kind": "field",
501
+ "name": "_playerState",
502
+ "type": {
503
+ "text": "object"
504
+ },
505
+ "default": "{count:0,loaded:!1,prev:PlayerState.Loading,scrollTimeout:null,scrollY:0,visible:!1}"
506
+ },
507
+ {
508
+ "kind": "field",
509
+ "name": "_handleSettingsClick"
510
+ },
511
+ {
512
+ "kind": "field",
513
+ "name": "_complete"
514
+ },
515
+ {
516
+ "kind": "field",
517
+ "name": "_dataFailed"
518
+ },
519
+ {
520
+ "kind": "field",
521
+ "name": "_dataReady"
522
+ },
523
+ {
524
+ "kind": "field",
525
+ "name": "_DOMLoaded"
526
+ },
527
+ {
528
+ "kind": "field",
529
+ "name": "_enterFrame"
530
+ },
531
+ {
532
+ "kind": "field",
533
+ "name": "_freeze"
534
+ },
535
+ {
536
+ "kind": "field",
537
+ "name": "_handleBlur"
538
+ },
539
+ {
540
+ "kind": "field",
541
+ "name": "_handleScroll"
542
+ },
543
+ {
544
+ "kind": "field",
545
+ "name": "_handleSeekChange"
546
+ },
547
+ {
548
+ "kind": "field",
549
+ "name": "_handleWindowBlur"
550
+ },
551
+ {
552
+ "kind": "field",
553
+ "name": "_loopComplete"
554
+ },
555
+ {
556
+ "kind": "field",
557
+ "name": "_mouseEnter"
558
+ },
559
+ {
560
+ "kind": "field",
561
+ "name": "_mouseLeave"
562
+ },
563
+ {
564
+ "kind": "field",
565
+ "name": "_onVisibilityChange"
566
+ },
567
+ {
568
+ "kind": "field",
569
+ "name": "_switchInstance"
570
+ },
571
+ {
572
+ "kind": "field",
573
+ "name": "togglePlay"
574
+ },
575
+ {
576
+ "kind": "field",
577
+ "name": "stop"
578
+ },
579
+ {
580
+ "kind": "field",
581
+ "name": "prev"
582
+ },
583
+ {
584
+ "kind": "field",
585
+ "name": "next"
586
+ },
587
+ {
588
+ "kind": "field",
589
+ "name": "snapshot"
590
+ },
591
+ {
592
+ "kind": "field",
593
+ "name": "toggleLoop"
594
+ },
595
+ {
596
+ "kind": "field",
597
+ "name": "toggleBoomerang"
598
+ },
599
+ {
600
+ "kind": "field",
601
+ "name": "convert"
602
+ },
603
+ {
604
+ "kind": "field",
605
+ "name": "destroy"
606
+ },
607
+ {
608
+ "kind": "field",
609
+ "name": "template"
610
+ },
611
+ {
612
+ "kind": "field",
613
+ "name": "shadow"
614
+ }
615
+ ],
616
+ "events": [
617
+ {
618
+ "type": {
619
+ "text": "CustomEvent"
620
+ }
621
+ }
622
+ ],
623
+ "attributes": [
624
+ {
625
+ "name": "animateOnScroll"
626
+ },
627
+ {
628
+ "name": "autoplay"
629
+ },
630
+ {
631
+ "name": "controls"
632
+ },
633
+ {
634
+ "name": "direction"
635
+ },
636
+ {
637
+ "name": "hover"
638
+ },
639
+ {
640
+ "name": "loop"
641
+ },
642
+ {
643
+ "name": "mode"
644
+ },
645
+ {
646
+ "name": "speed"
647
+ },
648
+ {
649
+ "name": "src"
650
+ },
651
+ {
652
+ "name": "subframe"
653
+ }
654
+ ],
655
+ "superclass": {
656
+ "name": "EnhancedElement",
657
+ "module": "dist/index.js"
658
+ },
659
+ "tagName": "dotlottie-player",
660
+ "customElement": true
13
661
  }
14
662
  ],
15
663
  "exports": [