!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("preact/compat"));else if("function"==typeof define&&define.amd)define(["preact/compat"],r);else{var t="object"==typeof exports?r(require("preact/compat")):r(e.PreactCompat);for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(Depicter,(e=>(()=>{"use strict";var r={314:r=>{r.exports=e}},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var s=t[e]={exports:{}};return r[e](s,s.exports,o),s.exports}o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{dpcStoriesProgressBar:()=>a});var e=o(314);const r=e=>{const{className:r="dpc-progress-bar",progress:t=50,id:o,onClick:n}=e;return Depicter.h("div",{className:`${r} ${n?"dpc-progress-bar-clickable":""}`,onClick:()=>n?.(o)},Depicter.h("div",{className:"dpc-progress-bar-value",style:{width:`${t}%`}}))},t=e=>{const{className:t="dpc-stories-progress-bar",storiesData:o=[],goToSlideByClick:n=!1,onProgressClick:s}=e;return Depicter.h("div",{className:t},o.map((e=>Depicter.h(r,{id:e.id,key:e.id,progress:e.progress,onClick:n?s:void 0}))))};function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},s.apply(this,arguments)}const a={component:r=>{const{composer:o,...n}=r,[a,c]=(0,e.useState)(o.navigator.currentIndex||1),[i,p]=(0,e.useState)(0),u=(0,e.useRef)(0),l=(0,e.useRef)(0),[d,f]=(0,e.useState)(Array.from({length:o.navigator.count},((e,r)=>1+r)));(0,e.useEffect)((()=>{let e;o.on("countChange",(()=>{f(Array.from({length:o.navigator.count},((e,r)=>r+1)))}));const r=()=>{const t=l.current+(u.current-l.current)/10;Math.abs(u.current-l.current)>=.02&&p(t),l.current=t,e=window.requestAnimationFrame(r)};return r(),()=>{e&&window.cancelAnimationFrame(e)}}),[o]);const g=(0,e.useMemo)((()=>{const e=[];return d.forEach(((r,t)=>{let o=0;t+1===a?o=i:t<a&&(o=100),e.push({id:`${r}`,progress:o})})),e}),[a,i,d]),m=(e,r)=>{c(r+1),p(0),u.current=0,l.current=0},b=(0,e.useCallback)(((e,r)=>{u.current=r/100*115}),[]),y=(0,e.useCallback)((e=>{o.actions.gotoSection({type:"number",to:parseInt(e,10)-1})}),[o.actions]);return(0,e.useEffect)((()=>(o.on("targetIndexChange",m),o.on("slideshowTimerUpdate",b),()=>{o.off("targetIndexChange",m),o.off("slideshowTimerUpdate",b)})),[o,b]),Depicter.h(t,s({storiesData:g,onProgressClick:y},n))},async:!1}})(),n})()));