import{n as je,f as b,m as ut,a as u,c as te,p as T,s as ft,B as ht}from"./props-b4vEeO_8.js";import{B as ve,a4 as C,ae as Ge,ah as bt,I as s,F as a,J as M,k as e,N as X,G as ge,C as L,a3 as w,e as xt,h as _t,u as wt}from"./runtime-C3rQLW--.js";import{b as $e}from"./window-DXjFTZv5.js";import{c as kt,d as St}from"./create-runtime-stories-7AWWVphH.js";import{T as Pt,s as ze,q as Ne}from"./tweened-4Ja_XIbT.js";import{o as Xe}from"./index-client-BAw8T8-V.js";import{i as H,s as N}from"./svelte-component-C8Ginrj8.js";import{s as At}from"./snippet-C5kbqVpq.js";import{a as Tt}from"./actions-BHcvdwVC.js";import{s as Ct,a as qt}from"./attributes-Cg6aLqN3.js";import{s as A}from"./style-DvJ3IcV1.js";import{b as De}from"./size-DMdj3-I9.js";import{b as Me}from"./this-CrUBQEQ_.js";import{e as Te,i as Ce}from"./each-CVpBMMjG.js";import{B as ae}from"./BodyText-CXnxLnBi.js";import{B as pe}from"./Block-D3Ui8rd-.js";import{D as Dt}from"./DatawrapperChart-BBvguXT3.js";import{H as Bt}from"./Headline-C-tkYFZ6.js";import{h as qe}from"./html-CPeakWmR.js";import{S as $t}from"./ScrollerBase-DJMKplMV.js";function Le(m,t,p){const n=Math.min(t,p),o=Math.max(t,p);return Math.max(n,Math.min(m,o))}function se(m,t,p,n,o,g=!0){const h=p-t;if(h===0)return g?Le(n,n,o):n;const r=(m-t)/h*(o-n)+n;return g?Le(r,n,o):r}function Et(m,t){w(t,!0),m.preventDefault()}function It(m,t,p){e(t)&&(w(t,!1),setTimeout(()=>{w(p,!1)},5),m.stopImmediatePropagation()),m.preventDefault()}function Wt(m,t,p){e(t)&&m.preventDefault(),w(p,!1)}var Ht=b('|'),Mt=b('|'),Lt=b(''),Vt=b(''),Ft=b('
');function ce(m,t){ve(t,!0);let p=T(t,"id",3,""),n=T(t,"class",3,""),o=T(t,"height",3,"200lvh"),g=T(t,"direction",3,"right"),h=T(t,"progress",15,0),y=T(t,"mappedStart",3,0),r=T(t,"mappedEnd",3,1),i=T(t,"stops",19,()=>[]),l=T(t,"handleScroll",3,!0),d=T(t,"scrubbed",3,!0),x=T(t,"easing",3,v=>v),q=T(t,"duration",3,400),_=T(t,"showDebugInfo",3,!1),P=Ge(new Pt(y(),{duration:q(),easing:x()})),E=C(void 0),k=C(0),D=C(0),R=C(void 0),j=C(0),J=C(0),f=X(()=>[...i(),y(),r()].sort((v,c)=>v-c)),le=X(()=>e(f).length-1),B=C(0),Q=X(()=>{let v=Le(P.current,y(),r()),c=v;return c=g()==="right"?v:r()-v,-(e(j)-e(D))*c}),oe=X(()=>({progress:h(),mappedProgress:e(B),easedProgress:P.current,direction:g(),mappedStart:y(),mappedEnd:r(),triggerStops:d()?i():e(f),stops:i(),handleScroll:l(),scrubbed:d(),easing:x(),duration:q()}));Xe(()=>{w(B,y())});const G=()=>{l()?window.addEventListener("scroll",me,{passive:!0}):window.addEventListener("scroll",()=>Z(h()),{passive:!0})};function me(){var v;e(E)&&(h((-((v=e(E))==null?void 0:v.offsetTop)+(window==null?void 0:window.scrollY))/(e(k)-e(J))),Z(h()))}function Z(v){if(w(B,se(v,0,1,y(),r()),!0),!i()||i().length===0){P.set(x()(se(v,0,1,y(),r())),{duration:0});return}if(d())for(let c=0;c=ye&&e(B)e(f)[c]&&e(B)<=(e(f)[c+1]??e(f)[e(f).length-1])){const F=e(f)[c]+((e(f)[c+1]??e(f)[e(f).length-1])-e(f)[c])*.5;if(e(B)>=F&&P.target!==(e(f)[c+1]??e(f)[e(f).length-1])){P.set(e(f)[c+1]??e(f)[e(f).length-1]);return}else if(e(B){var c=te(),F=L(c);At(F,()=>t.children),u(v,c)};H(ne,v=>{t.children&&v($)})}var I=a(ne,2);{var W=v=>{var c=Nt(),F=s(c);Je(F,{get componentState(){return e(oe)}}),M(()=>A(c,`position: absolute; left: ${-e(Q)}px; top: 0px;`)),u(v,c)};H(I,v=>{_()&&v(W)})}Me(z,v=>w(R,v),()=>e(R)),xt(()=>De(z,"clientWidth",v=>w(j,v))),Tt(z,v=>G==null?void 0:G()),Me(V,v=>w(E,v),()=>e(E)),M(()=>{Ct(V,"id",p()),qt(V,1,`horizontal-scroller-container ${n()??""}`,"svelte-jo0qqs"),A(V,`height: ${o()??""};`),A(z,`transform: translateX(${e(Q)??""}px);`)}),$e("innerHeight",v=>w(J,v,!0)),De(V,"clientHeight",v=>w(k,v)),De(V,"clientWidth",v=>w(D,v)),u(m,V),ge()}ce.__docgen={data:[{name:"id",visibility:"public",description:"Optional id for the scroller container",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"class",visibility:"public",description:"Optional additional classes for the scroller container",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"height",visibility:"public",description:"Height of the scroller container in CSS `vh` units. Set it to `100lvh` when using inside ScrollerBase.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'"200lvh"'},{name:"progress",visibility:"public",description:"Bindable progress value. Ideal range: `[0-1]`. Bind ScrollerBase's progress to this prop.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"..."},{name:"direction",visibility:"public",description:"Direction of movement",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"left",text:'"left"'},{kind:"const",type:"string",value:"right",text:'"right"'}],text:'"left" | "right"'},static:!1,readonly:!1,defaultValue:'"right"'},{name:"children",visibility:"public",description:"Content to scroll",keywords:[],kind:"let",type:{kind:"function",text:"Snippet<[]>"},static:!1,readonly:!1},{name:"stops",visibility:"public",description:"Array of numbers desired as stops for the scroller",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"number[]"},static:!1,readonly:!1,defaultValue:"[]"},{name:"handleScroll",visibility:"public",description:"Should the component handle scroll events? Set it to `false` when using inside ScrollerBase.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"scrubbed",visibility:"public",description:"Whether the stops should be scrubbed",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"easing",visibility:"public",description:"Easing function for the progress/stops",keywords:[],kind:"let",type:{kind:"function",text:"(t: number) => number"},static:!1,readonly:!1},{name:"duration",visibility:"public",description:"Duration of the easing animation in milliseconds. Effective only when scrubbed is false.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"400"},{name:"showDebugInfo",visibility:"public",description:"Whether to show debug info",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"mappedStart",visibility:"public",description:"Modified starting scale. Default is 0",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"},{name:"mappedEnd",visibility:"public",description:"Modified ending scale. Default is 1",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"1"}],name:"HorizontalScroller.svelte"};var Gt=(m,t)=>w(t,!e(t)),zt=b(''),Xt=b(" ",1);function we(m,t){ve(t,!0);let p=ht(t,["$$slots","$$events","$$legacy"]);const n="In the mystical land of Foobaristan, the legendary hero Foo set out on an epic quest to find his missing semicolon, only to discover that Bar had accidentally used it as a bookmark inside a JSON file. Naturally, the entire kingdom crashed immediately. As the villagers panicked, Foo and Bar tried to fix the situation by turning everything off and on again, but all that did was anger the ancient deity known as “The Build System,” which now demanded three sacrifices: a clean cache, a fresh node_modules folder, and someone’s weekend. And thus began the saga nobody asked for, yet every developer somehow relates to.";let o=C(!0);var g=Xt(),h=L(g);ae(h,{text:n});var y=a(h,2);{var r=d=>{pe(d,{children:(x,q)=>{var _=zt();_.__click=[Gt,o];var P=s(_);M(()=>N(P,`Toggle scrubbed: ${e(o)??""}`)),u(x,_)},$$slots:{default:!0}})};H(y,d=>{t.toggleScrub&&d(r)})}var i=a(y,2);pe(i,{width:"fluid",children:(d,x)=>{ce(d,ft({showDebugInfo:!0},()=>p,{get scrubbed(){return e(o)}}))},$$slots:{default:!0}});var l=a(i,2);ae(l,{text:n}),u(m,g),ge()}je(["click"]);we.__docgen={data:[],name:"Demo.svelte"};var Jt=b('
');function Ee(m,t){ve(t,!0);let p=T(t,"onAiMounted",3,()=>{}),n=T(t,"onArtboardChange",3,()=>{}),o=T(t,"taggedText",19,()=>({text:{},htext:{}})),g=T(t,"debugTaggedText",3,!1),h=T(t,"artboardWidth",11,void 0),y,r=C(0),i=X(()=>h()??e(r)),l=C(void 0);Xe(()=>{p()()}),_t(()=>{var k;if(e(i)){const D=y.querySelectorAll(".g-artboard")[0];(D==null?void 0:D.id)!==((k=e(l))==null?void 0:k.id)&&(w(l,wt(()=>D),!0),n()(e(l)))}});var d=ds();let x;var q=s(d);{var _=k=>{var D=ns(),R=s(D),j=a(R,2);M(()=>{A(R,`background-image: url(${is});`),A(j,`opacity:1;;background-image: url(${os});`)}),u(k,D)};H(q,k=>{e(i)&&e(i)>=0&&e(i)<1200&&k(_)})}var P=a(q,2);{var E=k=>{var D=rs(),R=s(D),j=a(R,2),J=a(j,2),f=s(J),le=s(f);qe(le,()=>{var $,I,W;return((W=(I=($=o())==null?void 0:$.htext)==null?void 0:I.captions)==null?void 0:W.caption2)||""});var B=a(J,2),Q=s(B),oe=s(Q);qe(oe,()=>{var $,I,W;return((W=(I=($=o())==null?void 0:$.htext)==null?void 0:I.captions)==null?void 0:W.caption3)||""});var G=a(B,2),me=s(G),Z=s(me);qe(Z,()=>{var $,I,W;return((W=(I=($=o())==null?void 0:$.htext)==null?void 0:I.captions)==null?void 0:W.caption4)||""});var V=a(G,2),z=s(V),ne=s(z);qe(ne,()=>{var $,I,W;return((W=(I=($=o())==null?void 0:$.htext)==null?void 0:I.captions)==null?void 0:W.caption1)||""}),M(()=>{A(R,`background-image: url(${as});`),A(j,`opacity:1;;background-image: url(${ls});`)}),u(k,D)};H(P,k=>{e(i)&&e(i)>=1200&&k(E)})}Me(d,k=>y=k,()=>y),M(k=>x=A(d,"",x,k),[()=>({"--debug-tagged-text":g()?"visible":"hidden","--debug-stroke":g()?"2px":"0px"})]),$e("innerWidth",k=>w(r,k,!0)),u(m,d),ge()}Ee.__docgen={data:[{name:"onAiMounted",visibility:"public",keywords:[],kind:"let",type:{kind:"type",type:"object",text:"Function"},static:!1,readonly:!1,defaultValue:"function"},{name:"onArtboardChange",visibility:"public",keywords:[],kind:"let",type:{kind:"type",type:"object",text:"Function"},static:!1,readonly:!1,defaultValue:"function"},{name:"taggedText",visibility:"public",keywords:[],kind:"let",type:{kind:"type",type:"object",text:"Record"},static:!1,readonly:!1,defaultValue:"{ text: {}, htext: {} }"},{name:"debugTaggedText",visibility:"public",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"artboardWidth",visibility:"public",keywords:[],kind:"let",type:{kind:"type",type:"any",text:"any"},static:!1,readonly:!1,defaultValue:"..."}],name:"demo.svelte"};var ps=b(" ",1);function Ke(m){const t="In the mystical land of Foobaristan, the legendary hero Foo set out on an epic quest to find his missing semicolon, only to discover that Bar had accidentally used it as a bookmark inside a JSON file. Naturally, the entire kingdom crashed immediately. As the villagers panicked, Foo and Bar tried to fix the situation by turning everything off and on again, but all that did was anger the ancient deity known as “The Build System,” which now demanded three sacrifices: a clean cache, a fresh node_modules folder, and someone’s weekend. And thus began the saga nobody asked for, yet every developer somehow relates to.";var p=ps(),n=L(p);ae(n,{text:t});var o=a(n,2);pe(o,{width:"fluid",children:(h,y)=>{ce(h,{height:"800lvh",get easing(){return ze},children:(r,i)=>{Ee(r,{})},$$slots:{default:!0}})},$$slots:{default:!0}});var g=a(o,2);ae(g,{text:t}),u(m,p)}Ke.__docgen={version:3,name:"ScrollableGraphic.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};var vs=b(" ",1);function Qe(m,t){ve(t,!0);const p="In the mystical land of Foobaristan, the legendary hero Foo set out on an epic quest to find his missing semicolon, only to discover that Bar had accidentally used it as a bookmark inside a JSON file. Naturally, the entire kingdom crashed immediately. As the villagers panicked, Foo and Bar tried to fix the situation by turning everything off and on again, but all that did was anger the ancient deity known as “The Build System,” which now demanded three sacrifices: a clean cache, a fresh node_modules folder, and someone’s weekend. And thus began the saga nobody asked for, yet every developer somehow relates to.";let n=C(0),o,g,h=.8,y=C(0);function r(){o&&(o.style.transform=`scale(1.5) translateX(${se(e(n),0,1,-15,85)}%)`),g!=null&&g.length&&g.forEach(_=>{let P=_.getBoundingClientRect().width,E=_.getBoundingClientRect().left+P/2;Ee(y)*h&&_.style.opacity!=="0"&&(_.style.opacity="0")})}function i(_){o=_.querySelector(".g-png-layer-overlay"),g=Array.from(_.querySelectorAll(".g-captions")),o&&(window.removeEventListener("scroll",r),window.addEventListener("scroll",r,{passive:!0}),r())}var l=vs(),d=L(l);ae(d,{text:p});var x=a(d,2);pe(x,{width:"fluid",children:(_,P)=>{ce(_,{height:"800lvh",get easing(){return ze},showDebugInfo:!0,get progress(){return e(n)},set progress(E){w(n,E,!0)},children:(E,k)=>{Ee(E,{onArtboardChange:i,taggedText:{htext:{captions:{caption1:'
Caption 1! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
',caption2:'
Caption 2! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
',caption3:'
Caption 3! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
',caption4:'
Caption 4! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
',1),cs=b(" ",1);function Ze(m){const t="In the mystical land of Foobaristan, the legendary hero Foo set out on an epic quest to find his missing semicolon, only to discover that Bar had accidentally used it as a bookmark inside a JSON file. Naturally, the entire kingdom crashed immediately. As the villagers panicked, Foo and Bar tried to fix the situation by turning everything off and on again, but all that did was anger the ancient deity known as “The Build System,” which now demanded three sacrifices: a clean cache, a fresh node_modules folder, and someone’s weekend. And thus began the saga nobody asked for, yet every developer somehow relates to.";let p=C(0);var n=cs(),o=L(n);ae(o,{text:t});var g=a(o,2);$t(g,{query:"div.step-foreground-container",get progress(){return e(p)},set progress(r){w(p,r,!0)},backgroundSnippet:r=>{pe(r,{width:"fluid",children:(i,l)=>{ce(i,{height:"100lvh",handleScroll:!1,showDebugInfo:!0,get progress(){return e(p)},set progress(d){w(p,d,!0)},children:(d,x)=>{Ee(d,{})},$$slots:{default:!0}})},$$slots:{default:!0}})},foregroundSnippet:r=>{var i=gs();u(r,i)},$$slots:{backgroundSnippet:!0,foregroundSnippet:!0}}),u(m,n)}Ze.__docgen={version:3,name:"withScrollerBase.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const et={title:"Components/Graphics/HorizontalScroller",component:ce,tags:["autodocs"],parameters:{chromatic:{disableSnapshot:!0}}},{Story:ee}=St();let ms=C(0);var ys=b(" ",1);function tt(m,t){ve(t,!0);var p=ys(),n=L(p);ee(n,{name:"Demo",children:(l,d)=>{we(l,{children:(x,q)=>{Be(x)},$$slots:{default:!0}})},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:``}}});var o=a(n,2);ee(o,{name:"With stops and easing",exportName:"WithStops",children:(l,d)=>{we(l,{stops:[.2,.5,.9],duration:400,toggleScrub:!0,get easing(){return Ne},children:(x,q)=>{Be(x)},$$slots:{default:!0}})},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:``}}});var g=a(o,2);ee(g,{name:"Extended boundaries",children:(l,d)=>{we(l,{mappedStart:-.5,mappedEnd:1.5,get easing(){return Ne},stops:[0,1],children:(x,q)=>{Be(x)},$$slots:{default:!0}})},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:``}}});var h=a(g,2);ee(h,{name:"Custom children",children:(l,d)=>{we(l,{children:(x,q)=>{Ye(x)},$$slots:{default:!0}})},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:``}}});var y=a(h,2);ee(y,{name:"Scrollable ai2svelte",children:(l,d)=>{Ke(l)},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:""}}});var r=a(y,2);ee(r,{name:"Scrollable ai2svelte (advanced)",children:(l,d)=>{Qe(l,{})},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:""}}});var i=a(r,2);ee(i,{name:"With ScrollerBase",children:(l,d)=>{Ze(l)},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:""}}}),$e("innerWidth",l=>w(ms,l,!0)),u(m,p),ge()}tt.__docgen={version:3,name:"HorizontalScroller.stories.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const ie=kt(tt,et),us=["Demo","WithStops","ExtendedBoundaries","CustomChildren","ScrollableAi2svelte","ScrollableAi2svelteAdvanced","WithScrollerBase"],fs=ie.Demo,hs=ie.WithStops,bs=ie.ExtendedBoundaries,xs=ie.CustomChildren,_s=ie.ScrollableAi2svelte,ws=ie.ScrollableAi2svelteAdvanced,ks=ie.WithScrollerBase,js=Object.freeze(Object.defineProperty({__proto__:null,CustomChildren:xs,Demo:fs,ExtendedBoundaries:bs,ScrollableAi2svelte:_s,ScrollableAi2svelteAdvanced:ws,WithScrollerBase:ks,WithStops:hs,__namedExportsOrder:us,default:et},Symbol.toStringTag,{value:"Module"}));export{js as H};