diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index acb6596..c9b450f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm ci + - run: npm install - run: npm run lint pages: @@ -32,7 +32,7 @@ jobs: node-version: 14.x - run: npm install -g npm@7.21.1 - - run: npm ci + - run: npm install - run: npm run example.build - name: Deploy diff --git a/.gitignore b/.gitignore index c9a0612..36abee4 100755 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,5 @@ node_modules/ coverage/ docs/ -browser/ -esm/ -styles/ .nyc_output/ npm-debug.log \ No newline at end of file diff --git a/browser/index.js b/browser/index.js new file mode 100644 index 0000000..bdcbdc1 --- /dev/null +++ b/browser/index.js @@ -0,0 +1,2 @@ +import{SvelteComponent as t,init as e,safe_not_equal as i,flush as s,append_styles as n,svg_element as r,text as o,attr as a,insert as c,append as l,set_data as h,detach as u,noop as d,destroy_each as p,component_subscribe as $,empty as f,create_component as g,mount_component as y,transition_in as m,transition_out as v,destroy_component as x,space as b,group_outros as w,check_outros as k,assign as O,set_svg_attributes as S,toggle_class as _,get_spread_update as M,compute_rest_props as A,exclude_internal_props as P,get_spread_object as E,binding_callbacks as j,create_slot as T,element as L,add_render_callback as D,add_resize_listener as C,update_slot_base as I,get_all_dirty_from_scope as K,get_slot_changes as V}from"https://unpkg.com/svelte@3/internal/index.mjs";import{range as z}from"https://unpkg.com/@aicacia/core@0/browser/index.js";import{getContext as Y,setContext as q,onMount as X}from"https://unpkg.com/svelte@3/index.mjs";import{vec2 as U,mat2d as H}from"https://unpkg.com/gl-matrix@3/esm";import{writable as B}from"https://unpkg.com/svelte@3/store/index.mjs";const R={};function N(){return Y(R)}const G={};function W(){return Y(G)}const F={};function J(){return Y(F)}const Q={};function Z(){return Y(Q)}function tt(t,e,i){return z(Math.floor(t/i)*i,Math.ceil(e/i)*i,i).iter().toArray()}function et(t){n(t,"svelte-133qdtd","g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75}")}function it(t,e,i){const s=t.slice();return s[9]=e[i],s}function st(t){let e,i,s,n,d=(t[0]?t[0](t[9]):t[9])+"";return{c(){e=r("text"),i=o(d),a(e,"x",s=t[1](t[9])),a(e,"y",n=5),a(e,"alignment-baseline","hanging"),a(e,"text-anchor","middle")},m(t,s){c(t,e,s),l(e,i)},p(t,n){5&n&&d!==(d=(t[0]?t[0](t[9]):t[9])+"")&&h(i,d),6&n&&s!==(s=t[1](t[9]))&&a(e,"x",s)},d(t){t&&u(e)}}}function nt(t){let e,i=t[2],s=[];for(let e=0;ei(8,a=t)));let u=Z();return $(t,u,(t=>i(7,o=t))),t.$$set=t=>{"separation"in t&&i(5,c=t.separation),"labelMaker"in t&&i(0,l=t.labelMaker)},t.$$.update=()=>{256&t.$$.dirty&&i(1,s=a.scaleX),128&t.$$.dirty&&i(6,n=o.xPanes),98&t.$$.dirty&&i(2,r=tt(n[0][0]-c,n[n.length-1][1]+c,c).filter((t=>Math.abs(s(t)-s(0))>1)))},[l,s,r,h,u,c,n,o,a]}class ot extends t{constructor(t){super(),e(this,t,rt,nt,i,{separation:5,labelMaker:0},et)}get separation(){return this.$$.ctx[5]}set separation(t){this.$$set({separation:t}),s()}get labelMaker(){return this.$$.ctx[0]}set labelMaker(t){this.$$set({labelMaker:t}),s()}}function at(t){n(t,"svelte-133qdtd","g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75}")}function ct(t,e,i){const s=t.slice();return s[9]=e[i],s}function lt(t){let e,i,s,n,d=(t[0]?t[0](t[9]):t[9])+"";return{c(){e=r("text"),i=o(d),a(e,"x",s=5),a(e,"y",n=t[1](t[9])),a(e,"alignment-baseline","central")},m(t,s){c(t,e,s),l(e,i)},p(t,s){5&s&&d!==(d=(t[0]?t[0](t[9]):t[9])+"")&&h(i,d),6&s&&n!==(n=t[1](t[9]))&&a(e,"y",n)},d(t){t&&u(e)}}}function ht(t){let e,i=t[2],s=[];for(let e=0;ei(8,a=t)));let u=Z();return $(t,u,(t=>i(7,o=t))),t.$$set=t=>{"separation"in t&&i(5,c=t.separation),"labelMaker"in t&&i(0,l=t.labelMaker)},t.$$.update=()=>{256&t.$$.dirty&&i(1,s=a.scaleY),128&t.$$.dirty&&i(6,n=o.yPanes),98&t.$$.dirty&&i(2,r=tt(n[0][0]-c,n[n.length-1][1]+c,c).filter((t=>Math.abs(s(t)-s(0))>1)))},[l,s,r,h,u,c,n,o,a]}class dt extends t{constructor(t){super(),e(this,t,ut,ht,i,{separation:5,labelMaker:0},at)}get separation(){return this.$$.ctx[5]}set separation(t){this.$$set({separation:t}),s()}get labelMaker(){return this.$$.ctx[0]}set labelMaker(t){this.$$set({labelMaker:t}),s()}}function pt(t,e,i){const s=t.slice();return s[13]=e[i],s}function $t(t,e,i){const s=t.slice();return s[16]=e[i],s}function ft(t){let e,i,s,n,o;return{c(){e=r("line"),a(e,"x1",i=t[16]),a(e,"y1",s=0),a(e,"x2",n=t[16]),a(e,"y2",t[3]),a(e,"style",o="stroke: var(--grid-line-subdivision-color)")},m(t,i){c(t,e,i)},p(t,s){32&s&&i!==(i=t[16])&&a(e,"x1",i),32&s&&n!==(n=t[16])&&a(e,"x2",n),8&s&&a(e,"y2",t[3])},d(t){t&&u(e)}}}function gt(t){let e,i,s,n,o;return{c(){e=r("line"),a(e,"y1",i=t[13]),a(e,"x1",s=0),a(e,"y2",n=t[13]),a(e,"x2",t[4]),a(e,"style",o="stroke: var(--grid-line-subdivision-color)")},m(t,i){c(t,e,i)},p(t,s){64&s&&i!==(i=t[13])&&a(e,"y1",i),64&s&&n!==(n=t[13])&&a(e,"y2",n),16&s&&a(e,"x2",t[4])},d(t){t&&u(e)}}}function yt(t){let e,i,s,n,o,l,h,d;return{c(){e=r("line"),l=r("line"),a(e,"x1",i=0),a(e,"y1",s=0),a(e,"x2",n=0),a(e,"y2",t[3]),a(e,"style",o="stroke: var(--visual-math-line-color)"),a(l,"x1",t[4]),a(l,"y1",h=0),a(l,"x2",t[4]),a(l,"y2",t[3]),a(l,"style",d="stroke: var(--visual-math-line-color)")},m(t,i){c(t,e,i),c(t,l,i)},p(t,i){8&i&&a(e,"y2",t[3]),16&i&&a(l,"x1",t[4]),16&i&&a(l,"x2",t[4]),8&i&&a(l,"y2",t[3])},d(t){t&&u(e),t&&u(l)}}}function mt(t){let e,i,s,n,o,l,h,d;return{c(){e=r("line"),l=r("line"),a(e,"x1",i=0),a(e,"y1",s=0),a(e,"x2",t[4]),a(e,"y2",n=0),a(e,"style",o="stroke: var(--visual-math-line-color)"),a(l,"x1",h=0),a(l,"y1",t[3]),a(l,"x2",t[4]),a(l,"y2",t[3]),a(l,"style",d="stroke: var(--visual-math-line-color)")},m(t,i){c(t,e,i),c(t,l,i)},p(t,i){16&i&&a(e,"x2",t[4]),8&i&&a(l,"y1",t[3]),16&i&&a(l,"x2",t[4]),8&i&&a(l,"y2",t[3])},d(t){t&&u(e),t&&u(l)}}}function vt(t){let e,i,s,n,o=t[5],h=[];for(let e=0;ei(12,a=t)));let f=[],g=[];return t.$$set=t=>{"id"in t&&i(0,c=t.id),"xLines"in t&&i(1,l=t.xLines),"yLines"in t&&i(2,h=t.yLines),"xSubdivisions"in t&&i(8,u=t.xSubdivisions),"ySubdivisions"in t&&i(9,d=t.ySubdivisions)},t.$$.update=()=>{if(4096&t.$$.dirty&&i(11,s=a.scaleX),4096&t.$$.dirty&&i(10,n=a.scaleY),2050&t.$$.dirty&&i(4,r=s(l||1)),1028&t.$$.dirty&&i(3,o=-n(h||1)),272&t.$$.dirty&&u&&u>1){const t=r/u;i(5,f=z(0,r+1.1*t,t).iter().toArray())}if(520&t.$$.dirty&&d&&d>1){const t=o/d;i(6,g=z(0,o+1.1*t,t).iter().toArray())}},[c,l,h,o,r,f,g,p,u,d,n,s,a]}class bt extends t{constructor(t){super(),e(this,t,xt,vt,i,{id:0,xLines:1,yLines:2,xSubdivisions:8,ySubdivisions:9})}get id(){return this.$$.ctx[0]}set id(t){this.$$set({id:t}),s()}get xLines(){return this.$$.ctx[1]}set xLines(t){this.$$set({xLines:t}),s()}get yLines(){return this.$$.ctx[2]}set yLines(t){this.$$set({yLines:t}),s()}get xSubdivisions(){return this.$$.ctx[8]}set xSubdivisions(t){this.$$set({xSubdivisions:t}),s()}get ySubdivisions(){return this.$$.ctx[9]}set ySubdivisions(t){this.$$set({ySubdivisions:t}),s()}}function wt(t){n(t,"svelte-xqsvde","line.svelte-xqsvde{stroke:var(--visual-math-origin-color)}")}function kt(t){let e,i;return e=new ot({props:{labelMaker:t[3].labels,separation:t[3].lines||1}}),{c(){g(e.$$.fragment)},m(t,s){y(e,t,s),i=!0},p(t,i){const s={};8&i&&(s.labelMaker=t[3].labels),8&i&&(s.separation=t[3].lines||1),e.$set(s)},i(t){i||(m(e.$$.fragment,t),i=!0)},o(t){v(e.$$.fragment,t),i=!1},d(t){x(e,t)}}}function Ot(t){let e,i;return e=new dt({props:{labelMaker:t[2].labels,separation:t[2].lines||1}}),{c(){g(e.$$.fragment)},m(t,s){y(e,t,s),i=!0},p(t,i){const s={};4&i&&(s.labelMaker=t[2].labels),4&i&&(s.separation=t[2].lines||1),e.$set(s)},i(t){i||(m(e.$$.fragment,t),i=!0)},o(t){v(e.$$.fragment,t),i=!1},d(t){x(e,t)}}}function St(t){let e,i,s,n,o;return{c(){e=r("line"),a(e,"x1",i=-1e7),a(e,"x2",s=1e7),a(e,"y1",n=0),a(e,"y2",o=0),a(e,"class","transform-y-to-center svelte-xqsvde")},m(t,i){c(t,e,i)},d(t){t&&u(e)}}}function _t(t){let e,i,s,n,o;return{c(){e=r("line"),a(e,"x1",i=0),a(e,"x2",s=0),a(e,"y1",n=-1e7),a(e,"y2",o=1e7),a(e,"class","transform-x-to-center svelte-xqsvde")},m(t,i){c(t,e,i)},d(t){t&&u(e)}}}function Mt(t){let e,i,s,n,o,l,h,d,p,$;i=new bt({props:{id:t[4],xLines:t[3].lines,yLines:t[2].lines,xSubdivisions:t[3].subdivisions,ySubdivisions:t[2].subdivisions}});let O=t[0].labels&&kt(t),S=t[1].labels&&Ot(t),_=t[3].axis&&St(),M=t[2].axis&&_t();return{c(){e=r("defs"),g(i.$$.fragment),s=b(),n=r("rect"),o=b(),O&&O.c(),l=b(),S&&S.c(),h=b(),_&&_.c(),d=b(),M&&M.c(),p=f(),a(n,"fill",`url(#${t[4]})`),a(n,"x",-1e7),a(n,"y",-1e7),a(n,"width",2e7),a(n,"height",2e7)},m(t,r){c(t,e,r),y(i,e,null),c(t,s,r),c(t,n,r),c(t,o,r),O&&O.m(t,r),c(t,l,r),S&&S.m(t,r),c(t,h,r),_&&_.m(t,r),c(t,d,r),M&&M.m(t,r),c(t,p,r),$=!0},p(t,[e]){const s={};8&e&&(s.xLines=t[3].lines),4&e&&(s.yLines=t[2].lines),8&e&&(s.xSubdivisions=t[3].subdivisions),4&e&&(s.ySubdivisions=t[2].subdivisions),i.$set(s),t[0].labels?O?(O.p(t,e),1&e&&m(O,1)):(O=kt(t),O.c(),m(O,1),O.m(l.parentNode,l)):O&&(w(),v(O,1,1,(()=>{O=null})),k()),t[1].labels?S?(S.p(t,e),2&e&&m(S,1)):(S=Ot(t),S.c(),m(S,1),S.m(h.parentNode,h)):S&&(w(),v(S,1,1,(()=>{S=null})),k()),t[3].axis?_||(_=St(),_.c(),_.m(d.parentNode,d)):_&&(_.d(1),_=null),t[2].axis?M||(M=_t(),M.c(),M.m(p.parentNode,p)):M&&(M.d(1),M=null)},i(t){$||(m(i.$$.fragment,t),m(O),m(S),$=!0)},o(t){v(i.$$.fragment,t),v(O),v(S),$=!1},d(t){t&&u(e),x(i),t&&u(s),t&&u(n),t&&u(o),O&&O.d(t),t&&u(l),S&&S.d(t),t&&u(h),_&&_.d(t),t&&u(d),M&&M.d(t),t&&u(p)}}}let At=0;const Pt={axis:!0,lines:1,labels:t=>t};function Et(t,e,i){let s,n,{subdivisions:r=!1}=e,{xAxis:o=Object.assign({subdivisions:r},Pt)}=e,{yAxis:a=Object.assign({subdivisions:r},Pt)}=e;const c="visual-math-grid-"+At++;return t.$$set=t=>{"subdivisions"in t&&i(5,r=t.subdivisions),"xAxis"in t&&i(0,o=t.xAxis),"yAxis"in t&&i(1,a=t.yAxis)},t.$$.update=()=>{33&t.$$.dirty&&i(3,s=Object.assign(Object.assign({subdivisions:r},Pt),o)),34&t.$$.dirty&&i(2,n=Object.assign(Object.assign({subdivisions:r},Pt),a))},[o,a,n,s,c,r]}class jt extends t{constructor(t){super(),e(this,t,Et,Mt,i,{subdivisions:5,xAxis:0,yAxis:1},wt)}get subdivisions(){return this.$$.ctx[5]}set subdivisions(t){this.$$set({subdivisions:t}),s()}get xAxis(){return this.$$.ctx[0]}set xAxis(t){this.$$set({xAxis:t}),s()}get yAxis(){return this.$$.ctx[1]}set yAxis(t){this.$$set({yAxis:t}),s()}}function Tt(t){n(t,"svelte-cc8k9r","ellipse.svelte-cc8k9r{vector-effect:non-scaling-stroke}")}function Lt(t){let e,i,s,n,o,a,l,h,p=[{cx:i=t[0][0]},{cy:s=t[0][1]},{rx:n=Math.abs(t[1][0])},{ry:o=Math.abs(t[1][1])},{"stroke-width":t[4]},{"stroke-dasharray":a="dashed"===t[2]?"4,3":void 0},{transform:l=`${t[8]} ${t[7]}`},t[10],{style:h=`\n stroke: ${t[5]};\n fill: ${t[5]};\n fill-opacity: ${t[6]};\n stroke-opacity: ${t[3]};\n ${t[10].style||""}\n `}],$={};for(let t=0;ti(12,o=t))),t.$$set=t=>{e=O(O({},e),P(t)),i(10,a=A(e,r)),"center"in t&&i(0,c=t.center),"radius"in t&&i(1,l=t.radius),"angle"in t&&i(11,h=t.angle),"strokeStyle"in t&&i(2,u=t.strokeStyle),"strokeOpacity"in t&&i(3,d=t.strokeOpacity),"weight"in t&&i(4,p=t.weight),"color"in t&&i(5,f=t.color),"fillOpacity"in t&&i(6,g=t.fillOpacity)},t.$$.update=()=>{4096&t.$$.dirty&&i(8,s=o.cssScale),2049&t.$$.dirty&&i(7,n=`rotate(${180*h/Math.PI} ${c[0]} ${c[1]})`)},[c,l,u,d,p,f,g,n,s,y,a,h,o]}class Ct extends t{constructor(t){super(),e(this,t,Dt,Lt,i,{center:0,radius:1,angle:11,strokeStyle:2,strokeOpacity:3,weight:4,color:5,fillOpacity:6},Tt)}get center(){return this.$$.ctx[0]}set center(t){this.$$set({center:t}),s()}get radius(){return this.$$.ctx[1]}set radius(t){this.$$set({radius:t}),s()}get angle(){return this.$$.ctx[11]}set angle(t){this.$$set({angle:t}),s()}get strokeStyle(){return this.$$.ctx[2]}set strokeStyle(t){this.$$set({strokeStyle:t}),s()}get strokeOpacity(){return this.$$.ctx[3]}set strokeOpacity(t){this.$$set({strokeOpacity:t}),s()}get weight(){return this.$$.ctx[4]}set weight(t){this.$$set({weight:t}),s()}get color(){return this.$$.ctx[5]}set color(t){this.$$set({color:t}),s()}get fillOpacity(){return this.$$.ctx[6]}set fillOpacity(t){this.$$set({fillOpacity:t}),s()}}function It(t){let e,i;const s=[{center:t[0]},{radius:t[7]},{angle:t[1]},{strokeStyle:t[2]},{strokeOpacity:t[3]},{weight:t[4]},{color:t[5]},{fillOpacity:t[6]},t[8]];let n={};for(let t=0;t{e=O(O({},e),P(t)),i(8,n=A(e,s)),"center"in t&&i(0,r=t.center),"radius"in t&&i(9,o=t.radius),"angle"in t&&i(1,a=t.angle),"strokeStyle"in t&&i(2,c=t.strokeStyle),"strokeOpacity"in t&&i(3,l=t.strokeOpacity),"weight"in t&&i(4,h=t.weight),"color"in t&&i(5,u=t.color),"fillOpacity"in t&&i(6,d=t.fillOpacity)},t.$$.update=()=>{640&t.$$.dirty&&i(7,p=U.set(p,o,o))},[r,a,c,l,h,u,d,p,n,o]}class Vt extends t{constructor(t){super(),e(this,t,Kt,It,i,{center:0,radius:9,angle:1,strokeStyle:2,strokeOpacity:3,weight:4,color:5,fillOpacity:6})}get center(){return this.$$.ctx[0]}set center(t){this.$$set({center:t}),s()}get radius(){return this.$$.ctx[9]}set radius(t){this.$$set({radius:t}),s()}get angle(){return this.$$.ctx[1]}set angle(t){this.$$set({angle:t}),s()}get strokeStyle(){return this.$$.ctx[2]}set strokeStyle(t){this.$$set({strokeStyle:t}),s()}get strokeOpacity(){return this.$$.ctx[3]}set strokeOpacity(t){this.$$set({strokeOpacity:t}),s()}get weight(){return this.$$.ctx[4]}set weight(t){this.$$set({weight:t}),s()}get color(){return this.$$.ctx[5]}set color(t){this.$$set({color:t}),s()}get fillOpacity(){return this.$$.ctx[6]}set fillOpacity(t){this.$$set({fillOpacity:t}),s()}}const zt={toVector:(t,e)=>(void 0===t&&(t=e),Array.isArray(t)?t:[t,t]),add:(t,e)=>[t[0]+e[0],t[1]+e[1]],sub:(t,e)=>[t[0]-e[0],t[1]-e[1]],addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Yt(t,e,i){return 0===e||Math.abs(e)===1/0?Math.pow(t,5*i):t*e*i/(e+i*t)}function qt(t,e,i,s=.15){return 0===s?function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e,i):ti?+Yt(t-i,i-e,s)+i:t}function Xt(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ut(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function Ht(t){for(var e=1;e{var i,s;return e.target===t.currentTarget||(null===(i=t.currentTarget)||void 0===i||null===(s=i.contains)||void 0===s?void 0:s.call(i,e.target))}))}(t).map((t=>t.identifier))}function Ft(t){const e=Gt(t);return Nt(t)?e.identifier:e.pointerId}function Jt(t){const e=Gt(t);return[e.clientX,e.clientY]}function Qt(t,...e){return"function"==typeof t?t(...e):t}function Zt(){}function te(...t){return 0===t.length?Zt:1===t.length?t[0]:function(){let e;for(const i of t)e=i.apply(this,arguments)||e;return e}}function ee(t,e){return Object.assign({},e,t||{})}class ie extends class{constructor(t,e,i){this.ctrl=t,this.args=e,this.key=i,this.state||(this.state={values:[0,0],initial:[0,0]},this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:e,config:i,ingKey:s,args:n}=this,{transform:r,threshold:o=[0,0]}=i;e[s]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._delta=[0,0],t._threshold=zt.sub(r(o),r([0,0])).map(Math.abs),t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=n,t.axis=void 0,t.memo=void 0,t.elapsedTime=0,t.direction=[0,0],t.distance=[0,0],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const e=this.state,i=this.config;e._active||(this.reset(),e._active=!0,e.target=t.target,e.currentTarget=t.currentTarget,e.initial=e.values,e.lastOffset=i.from?Qt(i.from,e):e.offset,e.offset=e.lastOffset),e.startTime=e.timeStamp=t.timeStamp}compute(t){const{state:e,config:i,shared:s}=this;e.args=this.args;let n=0;if(t&&(e.event=t,e.type=t.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,function(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:i,altKey:s,metaKey:n,ctrlKey:r}=t;Object.assign(e,{shiftKey:i,altKey:s,metaKey:n,ctrlKey:r})}return e}(t)),s.down=s.pressed=s.buttons%2==1||s.touches>0,n=t.timeStamp-e.timeStamp,e.timeStamp=t.timeStamp,e.elapsedTime=e.timeStamp-e.startTime),e._active){const t=e._delta.map(Math.abs);zt.addTo(e._distance,t)}const[r,o]=i.transform(e._movement),[a,c]=e._threshold;let[l,h]=e._step;if(!1===l&&(l=Math.abs(r)>=a&&Math.sign(r)*a),!1===h&&(h=Math.abs(o)>=c&&Math.sign(o)*c),e.intentional=!1!==l||!1!==h,!e.intentional)return;e._step=[l,h];const u=[0,0];if(u[0]=!1!==l?r-l:0,u[1]=!1!==h?o-h:0,this.intent&&this.intent(u),(e._active&&!e._blocked||e.active)&&(e.first=e._active&&!e.active,e.last=!e._active&&e.active,e.active=s[this.ingKey]=e._active,t)){e.first&&("bounds"in i&&(e._bounds=Qt(i.bounds,e)),this.setup&&this.setup());const t=e.movement;if(e.movement=u,this.computeOffset(),!e.last){e.delta=zt.sub(u,t);const i=e.delta.map(Math.abs);zt.addTo(e.distance,i),e.direction=e.delta.map(Math.sign),!e.first&&n>0&&(e.velocity=[i[0]/n,i[1]/n])}}const d=e._active&&i.rubberband||[0,0];e.offset=function(t,[e,i],[s,n]){const[[r,o],[a,c]]=t;return[qt(e,r,o,s),qt(i,a,c,n)]}(e._bounds,e.offset,d),this.computeMovement()}emit(){const t=this.state,e=this.shared,i=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!i.triggerAllEvents)return;const s=this.handler(Ht(Ht(Ht({},e),t),{},{[this.aliasKey]:t.values}));void 0!==s&&(t.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}{constructor(...t){super(...t),Xt(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=zt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=zt.sub(this.state.offset,this.state.lastOffset)}intent(t){this.state.axis=this.state.axis||function([t,e]){const i=Math.abs(t)-Math.abs(e);return i>0?"x":i<0?"y":void 0}(t),this.state._blocked=(this.config.lockDirection||!!this.config.axis)&&!this.state.axis||!!this.config.axis&&this.config.axis!==this.state.axis,this.state._blocked||(this.config.axis||this.config.lockDirection)&&function(t,e){switch(e){case"x":t[1]=0;break;case"y":t[0]=0}}(t,this.state.axis)}}const se={enabled:(t=!0)=>t,triggerAllEvents:(t=!1)=>t,rubberband(t=0){switch(t){case!0:return[.15,.15];case!1:return[0,0];default:return zt.toVector(t)}},from:t=>"function"==typeof t?t:null!=t?zt.toVector(t):void 0,transform:(t,e,i)=>t||i.shared.transform},ne=Ht(Ht({},se),{},{axis(t,e,{axis:i}){if(this.lockDirection="lock"===i,!this.lockDirection)return i},bounds(t={}){if("function"==typeof t)return e=>ne.bounds(t(e));if("current"in t)return()=>t.current;if("function"==typeof HTMLElement&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:i=1/0,top:s=-1/0,bottom:n=1/0}=t;return[[e,i],[s,n]]}}),re={ArrowRight:(t=1)=>[10*t,0],ArrowLeft:(t=1)=>[-10*t,0],ArrowUp:(t=1)=>[0,-10*t],ArrowDown:(t=1)=>[0,10*t]};const oe="undefined"!=typeof window&&window.document&&window.document.createElement;function ae(){return oe&&"ontouchstart"in window}const ce={isBrowser:oe,gesture:function(){try{return"constructor"in GestureEvent}catch(t){return!1}}(),touch:ae(),touchscreen:ae()||oe&&navigator.maxTouchPoints>1,pointer:oe&&"onpointerdown"in window,pointerLock:oe&&"exitPointerLock"in window.document},le=Ht(Ht({},ne),{},{pointerLock(t,e,{pointer:{lock:i=!1,touch:s=!1}={}}){return this.useTouch=ce.touch&&s,ce.pointerLock&&i},device(t,e){return this.useTouch?"touch":this.pointerLock?"mouse":ce.pointer?"pointer":ce.touch?"touch":"mouse"},preventScroll(t=!1,e,{preventScrollAxis:i="y"}){return i&&(this.preventScrollAxis=i),!!ce.touchscreen&&("number"==typeof t?t:!!t&&250)},pointerCapture(t,e,{pointer:{capture:i=!0}={}}){return!this.pointerLock&&"pointer"===this.device&&i},threshold(t,e,{filterTaps:i=!1,axis:s}){const n=zt.toVector(t,i?3:s?1:0);return this.filterTaps=i,n},swipe({velocity:t=.5,distance:e=50,duration:i=250}={}){return{velocity:this.transform(zt.toVector(t)),distance:this.transform(zt.toVector(e)),duration:i}},delay(t=0){switch(t){case!0:return 180;case!1:return 0;default:return t}}});Ht(Ht({},se),{},{useTouch:(t,e,{pointer:{touch:i=!1}={}})=>ce.touch&&i,device(t,e,i){if(i.shared.target&&!ce.touch&&ce.gesture)return"gesture";if(this.useTouch)return"touch";if(ce.touchscreen){if(ce.pointer)return"pointer";if(ce.touch)return"touch"}},bounds(t,e,{scaleBounds:i={},angleBounds:s={}}){const n=t=>{const e=ee(Qt(i,t),{min:-1/0,max:1/0});return[e.min,e.max]},r=t=>{const e=ee(Qt(s,t),{min:-1/0,max:1/0});return[e.min,e.max]};return"function"!=typeof i&&"function"!=typeof s?[n(),r()]:t=>[n(t),r(t)]},threshold(t,e,i){this.lockDirection="lock"===i.axis;return zt.toVector(t,this.lockDirection?[.1,3]:0)}}),Ht(Ht({},ne),{},{mouseOnly:(t=!0)=>t});const he=ne;Ht(Ht({},ne),{},{mouseOnly:(t=!0)=>t});const ue=new Map,de=new Map;function pe(t){ue.set(t.key,t.engine),de.set(t.key,t.resolver)}const $e={key:"drag",engine:class extends ie{constructor(...t){super(...t),Xt(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const e=t._bounds.getBoundingClientRect(),i=t.currentTarget.getBoundingClientRect(),s={left:e.left-i.left+t.offset[0],right:e.right-i.right+t.offset[0],top:e.top-i.top+t.offset[1],bottom:e.bottom-i.bottom+t.offset[1]};t._bounds=ne.bounds(s)}}cancel(){const t=this.state;t.canceled||setTimeout((()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()}),0)}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){if(null!=t.buttons&&t.buttons%2!=1)return;this.ctrl.setEventIds(t),this.config.pointerCapture&&t.target.setPointerCapture(t.pointerId);const e=this.state,i=this.config;e._pointerActive||(this.start(t),this.setupPointer(t),e._pointerId=Ft(t),e._pointerActive=!0,e.values=Jt(t),e.initial=e.values,i.preventScroll?this.setupScrollPrevention(t):i.delay>0?this.setupDelayTrigger(t):this.startPointerDrag(t))}startPointerDrag(t){const e=this.state;e._active=!0,e._preventScroll=!0,e._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const e=this.state,i=this.config;if(!e._pointerActive)return;if(e.type===t.type&&t.timeStamp===e.timeStamp)return;const s=Ft(t);if(e._pointerId&&s!==e._pointerId)return;const n=Jt(t);return document.pointerLockElement===t.target?e._delta=[t.movementX,t.movementY]:(e._delta=zt.sub(n,e.values),e.values=n),zt.addTo(e._movement,e._delta),this.compute(t),e._delayed?(this.timeoutStore.remove("dragDelay"),void this.startPointerDrag(t)):i.preventScroll&&!e._preventScroll?e.axis?e.axis===i.preventScrollAxis||"xy"===i.preventScrollAxis?(e._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(t)):void 0:void this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch(t){}const e=this.state,i=this.config;if(!e._pointerActive)return;const s=Ft(t);if(e._pointerId&&s!==e._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[n,r]=e._distance;if(e.tap=n<=3&&r<=3,e.tap&&i.filterTaps)e._force=!0;else{const[t,s]=e.direction,[n,r]=e.velocity,[o,a]=e.movement,[c,l]=i.swipe.velocity,[h,u]=i.swipe.distance,d=i.swipe.duration;e.elapsedTimec&&Math.abs(o)>h&&(e.swipe[0]=t),Math.abs(r)>l&&Math.abs(a)>u&&(e.swipe[1]=s))}this.emit()}pointerClick(t){this.state.tap||(t.preventDefault(),t.stopPropagation())}setupPointer(t){const e=this.config;let i=e.device;e.pointerLock&&t.currentTarget.requestPointerLock(),e.pointerCapture||(this.eventStore.add(this.sharedConfig.window,i,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"end",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){!function(t){"persist"in t&&"function"==typeof t.persist&&t.persist()}(t),this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1}),this.eventStore.add(this.sharedConfig.window,"touch","end",this.clean.bind(this),{passive:!1}),this.eventStore.add(this.sharedConfig.window,"touch","cancel",this.clean.bind(this),{passive:!1}),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScroll,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",this.startPointerDrag.bind(this),this.config.delay,t)}keyDown(t){const e=re[t.key],i=this.state;if(e){const s=t.shiftKey?10:t.altKey?.1:1;i._delta=e(s),this.start(t),i._keyboardActive=!0,zt.addTo(i._movement,i._delta),this.compute(t),this.emit()}}keyUp(t){t.key in re&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const e=this.config.device;t(e,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(e,"change",this.pointerMove.bind(this)),t(e,"end",this.pointerUp.bind(this)),t(e,"cancel",this.pointerUp.bind(this))),t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this)),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0})}},resolver:le},fe={key:"wheel",engine:class extends ie{constructor(...t){super(...t),Xt(this,"ingKey","wheeling")}wheel(t){this.state._active||this.start(t),this.wheelChange(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(t){const e=this.state;e._delta=function(t){let{deltaX:e,deltaY:i,deltaMode:s}=t;return 1===s?(e*=40,i*=40):2===s&&(e*=800,i*=800),[e,i]}(t),zt.addTo(this.state._movement,e._delta),this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("wheel","",this.wheel.bind(this))}},resolver:he};function ge(t,e){if(null==t)return{};var i,s,n=function(t,e){if(null==t)return{};var i,s,n={},r=Object.keys(t);for(s=0;s=0||(n[i]=t[i]);return n}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}const ye=t=>t,me={target(t){if(t)return()=>"current"in t?t.current:t},enabled:(t=!0)=>t,window:(t=(ce.isBrowser?window:void 0))=>t,eventOptions:({passive:t=!0,capture:e=!1}={})=>({passive:t,capture:e}),transform:(t=ye)=>t},ve=["target","eventOptions","window","enabled","transform"];function xe(t={},e){const i={};for(const[s,n]of Object.entries(e))switch(typeof n){case"function":i[s]=n.call(i,t[s],s,t);break;case"object":i[s]=xe(t[s],n);break;case"boolean":n&&(i[s]=t[s])}return i}class be{constructor(t){Xt(this,"_listeners",[]),this._ctrl=t}add(t,e,i,s,n){const r=function(t,e=""){const i=Bt[t];return t+(i&&i[e]||e)}(e,i),o=Ht(Ht({},this._ctrl.config.shared.eventOptions),n);t.addEventListener(r,s,o),this._listeners.push((()=>t.removeEventListener(r,s,o)))}clean(){this._listeners.forEach((t=>t())),this._listeners=[]}}class we{constructor(){Xt(this,"_timeouts",new Map)}add(t,e,i=140,...s){this.remove(t),this._timeouts.set(t,window.setTimeout(e,i,...s))}remove(t){const e=this._timeouts.get(t);e&&window.clearTimeout(e)}clean(){this._timeouts.forEach((t=>{window.clearTimeout(t)})),this._timeouts.clear()}}class ke{constructor(t){Xt(this,"gestures",new Set),Xt(this,"_targetEventStore",new be(this)),Xt(this,"gestureEventStores",{}),Xt(this,"gestureTimeoutStores",{}),Xt(this,"handlers",{}),Xt(this,"config",{}),Xt(this,"pointerIds",new Set),Xt(this,"touchIds",new Set),Xt(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(t,e){e.drag&&Oe(t,"drag");e.wheel&&Oe(t,"wheel");e.scroll&&Oe(t,"scroll");e.move&&Oe(t,"move");e.pinch&&Oe(t,"pinch");e.hover&&Oe(t,"hover")}(this,t)}setEventIds(t){Nt(t)?this.touchIds=new Set(Wt(t)):"pointerId"in t&&("pointerup"===t.type?this.pointerIds.delete(t.pointerId):this.pointerIds.add(t.pointerId))}applyHandlers(t,e){this.handlers=t,this.nativeHandlers=e}applyConfig(t,e){this.config=function(t,e){const i=t,{target:s,eventOptions:n,window:r,enabled:o,transform:a}=i,c=ge(i,ve),l={shared:xe({target:s,eventOptions:n,window:r,enabled:o},me)};if(e){const t=de.get(e);l[e]=xe(Ht({shared:l.shared},c),t)}else for(const t in c){const e=de.get(t);e&&(l[t]=xe(Ht({shared:l.shared},c[t]),e))}return l}(t,e)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const e=this.config.shared,i=e.eventOptions,s={};let n;if(e.target&&(n=e.target(),!n))return;const r=Se(s,i,!!n);if(e.enabled){for(const e of this.gestures)if(this.config[e].enabled){new(ue.get(e))(this,t,e).bind(r)}for(const e in this.nativeHandlers)r(e,"",(i=>this.nativeHandlers[e](Ht(Ht({},this.state.shared),{},{event:i,args:t}))),void 0,!0)}for(const t in s)s[t]=te(...s[t]);if(!n)return s;for(const t in s){let e=t.substr(2).toLowerCase();const i=!!~e.indexOf("capture"),r=!!~e.indexOf("passive");(i||r)&&(e=e.replace(/capture|passive/g,"")),this._targetEventStore.add(n,e,"",s[t],{capture:i,passive:r})}}}function Oe(t,e){t.gestures.add(e),t.gestureEventStores[e]=new be(t),t.gestureTimeoutStores[e]=new we}const Se=(t,e,i)=>(s,n,r,o={},a=!1)=>{var c,l;const h=null!==(c=o.capture)&&void 0!==c?c:e.capture,u=null!==(l=o.passive)&&void 0!==l?l:e.passive;let d=a?s:function(t,e="",i=!1){const s=Bt[t],n=s&&s[e]||e;return"on"+Rt(t)+Rt(n)+(i?"Capture":"")}(s,n,h);i&&u&&(d+="Passive"),t[d]=t[d]||[],t[d].push(r)};function _e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Me(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function Ae(t){for(var e=1;et;c=p(c);let f=N();$(t,f,(t=>i(14,a=t)));let g,y=U.create(),m=H.create(),v=U.create(),x=!1;return X((()=>{const t=new Ee(g,o);return()=>{t.destroy()}})),t.$$set=t=>{"point"in t&&i(7,c=t.point),"color"in t&&i(0,l=t.color),"transform"in t&&i(8,h=t.transform),"constrain"in t&&i(9,u=t.constrain)},t.$$.update=()=>{512&t.$$.dirty&&("horizontal"===u?i(10,p=([t,e])=>[t,d[1]]):"vertical"===u?i(10,p=([t,e])=>[d[0],e]):"function"==typeof u&&i(10,p=u)),16384&t.$$.dirty&&i(5,s=a.scaleX),16384&t.$$.dirty&&i(4,n=a.scaleY),16384&t.$$.dirty&&i(13,r=a.inversePixelMatrix),2304&t.$$.dirty&&i(11,m=H.invert(m,h)),15744&t.$$.dirty&&(o=t=>{var e;null===(e=t.event)||void 0===e||e.stopPropagation(),i(3,x=t.down);const s=U.transformMat2d(Le,t.movement,r);t.first&&i(12,v=U.transformMat2d(v,c,h)),U.add(c,v,s),U.transformMat2d(c,c,m),i(7,c=p(c))}),386&t.$$.dirty&&i(1,y=U.transformMat2d(y,c,h))},[l,y,g,x,n,s,f,c,h,u,p,m,v,r,a,function(t){j[t?"unshift":"push"]((()=>{g=t,i(2,g)}))}]}class Ce extends t{constructor(t){super(),e(this,t,De,Te,i,{point:7,color:0,transform:8,constrain:9})}get point(){return this.$$.ctx[7]}set point(t){this.$$set({point:t}),s()}get color(){return this.$$.ctx[0]}set color(t){this.$$set({color:t}),s()}get transform(){return this.$$.ctx[8]}set transform(t){this.$$set({transform:t}),s()}get constrain(){return this.$$.ctx[9]}set constrain(t){this.$$set({constrain:t}),s()}}function Ie(t){let e,i,s,n,o,a=[{cx:i=t[4](t[0][0])},{cy:s=t[3](t[0][1])},{r:n=6},t[6],{style:o=`fill: ${t[1]}; opacity: ${t[2]}; ${t[6].style}`}],l={};for(let t=0;ti(7,o=t))),t.$$set=t=>{e=O(O({},e),P(t)),i(6,a=A(e,r)),"point"in t&&i(0,c=t.point),"color"in t&&i(1,l=t.color),"opacity"in t&&i(2,h=t.opacity)},t.$$.update=()=>{128&t.$$.dirty&&i(4,s=o.scaleX),128&t.$$.dirty&&i(3,n=o.scaleY)},[c,l,h,n,s,u,a,o]}class Ve extends t{constructor(t){super(),e(this,t,Ke,Ie,i,{point:0,color:1,opacity:2})}get point(){return this.$$.ctx[0]}set point(t){this.$$set({point:t}),s()}get color(){return this.$$.ctx[1]}set color(t){this.$$set({color:t}),s()}get opacity(){return this.$$.ctx[2]}set opacity(t){this.$$set({opacity:t}),s()}}function ze(t){let e,i,s,n,o,l,h;return{c(){e=r("line"),a(e,"x1",i=t[4][0]),a(e,"y1",s=t[4][1]),a(e,"x2",n=t[5][0]),a(e,"y2",o=t[5][1]),a(e,"style",l=`stroke: ${t[0]}`),a(e,"stroke-width",t[2]),a(e,"opacity",t[3]),a(e,"stroke-dasharray",h="dashed"===t[1]?"4,3":void 0)},m(t,i){c(t,e,i)},p(t,[r]){16&r&&i!==(i=t[4][0])&&a(e,"x1",i),16&r&&s!==(s=t[4][1])&&a(e,"y1",s),32&r&&n!==(n=t[5][0])&&a(e,"x2",n),32&r&&o!==(o=t[5][1])&&a(e,"y2",o),1&r&&l!==(l=`stroke: ${t[0]}`)&&a(e,"style",l),4&r&&a(e,"stroke-width",t[2]),8&r&&a(e,"opacity",t[3]),2&r&&h!==(h="dashed"===t[1]?"4,3":void 0)&&a(e,"stroke-dasharray",h)},i:d,o:d,d(t){t&&u(e)}}}const Ye=U.create();function qe(t,e,i){let s,n,{point1:r=U.create()}=e,{point2:o=U.create()}=e,{color:a="var(--visual-math-fg)"}=e,{style:c="solid"}=e,{weight:l=2}=e,{opacity:h=1}=e;const u=N();$(t,u,(t=>i(11,n=t)));let d=U.create(),p=U.create(),f=U.create();return t.$$set=t=>{"point1"in t&&i(7,r=t.point1),"point2"in t&&i(8,o=t.point2),"color"in t&&i(0,a=t.color),"style"in t&&i(1,c=t.style),"weight"in t&&i(2,l=t.weight),"opacity"in t&&i(3,h=t.opacity)},t.$$.update=()=>{2048&t.$$.dirty&&i(10,s=n.pixelMatrix),896&t.$$.dirty&&i(9,d=U.scale(d,U.normalize(d,U.sub(Ye,o,r)),1e5)),1680&t.$$.dirty&&i(4,p=U.transformMat2d(p,U.sub(Ye,r,d),s)),1824&t.$$.dirty&&i(5,f=U.transformMat2d(f,U.add(Ye,o,d),s))},[a,c,l,h,p,f,u,r,o,d,s,n]}class Xe extends t{constructor(t){super(),e(this,t,qe,ze,i,{point1:7,point2:8,color:0,style:1,weight:2,opacity:3})}get point1(){return this.$$.ctx[7]}set point1(t){this.$$set({point1:t}),s()}get point2(){return this.$$.ctx[8]}set point2(t){this.$$set({point2:t}),s()}get color(){return this.$$.ctx[0]}set color(t){this.$$set({color:t}),s()}get style(){return this.$$.ctx[1]}set style(t){this.$$set({style:t}),s()}get weight(){return this.$$.ctx[2]}set weight(t){this.$$set({weight:t}),s()}get opacity(){return this.$$.ctx[3]}set opacity(t){this.$$set({opacity:t}),s()}}function Ue(t){let e,i;return e=new Xe({props:{point1:t[0],point2:t[5],color:t[1],opacity:t[4],style:t[2],weight:t[3]}}),{c(){g(e.$$.fragment)},m(t,s){y(e,t,s),i=!0},p(t,[i]){const s={};1&i&&(s.point1=t[0]),32&i&&(s.point2=t[5]),2&i&&(s.color=t[1]),16&i&&(s.opacity=t[4]),4&i&&(s.style=t[2]),8&i&&(s.weight=t[3]),e.$set(s)},i(t){i||(m(e.$$.fragment,t),i=!0)},o(t){v(e.$$.fragment,t),i=!1},d(t){x(e,t)}}}const He=U.create(),Be=U.create(),Re=U.fromValues(1,0);function Ne(t,e,i){let{point:s=U.create()}=e,{angle:n=0}=e,{color:r="var(--visual-math-fg)"}=e,{style:o="solid"}=e,{weight:a=2}=e,{opacity:c=1}=e,l=U.create();return t.$$set=t=>{"point"in t&&i(0,s=t.point),"angle"in t&&i(6,n=t.angle),"color"in t&&i(1,r=t.color),"style"in t&&i(2,o=t.style),"weight"in t&&i(3,a=t.weight),"opacity"in t&&i(4,c=t.opacity)},t.$$.update=()=>{97&t.$$.dirty&&i(5,l=U.add(l,s,U.rotate(He,Re,Be,n)))},[s,r,o,a,c,l,n]}class Ge extends t{constructor(t){super(),e(this,t,Ne,Ue,i,{point:0,angle:6,color:1,style:2,weight:3,opacity:4})}get point(){return this.$$.ctx[0]}set point(t){this.$$set({point:t}),s()}get angle(){return this.$$.ctx[6]}set angle(t){this.$$set({angle:t}),s()}get color(){return this.$$.ctx[1]}set color(t){this.$$set({color:t}),s()}get style(){return this.$$.ctx[2]}set style(t){this.$$set({style:t}),s()}get weight(){return this.$$.ctx[3]}set weight(t){this.$$set({weight:t}),s()}get opacity(){return this.$$.ctx[4]}set opacity(t){this.$$set({opacity:t}),s()}}function We(t){let e,i;return e=new Ge({props:{point:t[0],angle:t[5],color:t[1],opacity:t[4],style:t[2],weight:t[3]}}),{c(){g(e.$$.fragment)},m(t,s){y(e,t,s),i=!0},p(t,[i]){const s={};1&i&&(s.point=t[0]),32&i&&(s.angle=t[5]),2&i&&(s.color=t[1]),16&i&&(s.opacity=t[4]),4&i&&(s.style=t[2]),8&i&&(s.weight=t[3]),e.$set(s)},i(t){i||(m(e.$$.fragment,t),i=!0)},o(t){v(e.$$.fragment,t),i=!1},d(t){x(e,t)}}}function Fe(t,e,i){let{point:s=U.create()}=e,{slope:n=0}=e,{color:r="var(--visual-math-fg)"}=e,{style:o="solid"}=e,{weight:a=2}=e,{opacity:c=1}=e,l=Math.atan(n);return t.$$set=t=>{"point"in t&&i(0,s=t.point),"slope"in t&&i(6,n=t.slope),"color"in t&&i(1,r=t.color),"style"in t&&i(2,o=t.style),"weight"in t&&i(3,a=t.weight),"opacity"in t&&i(4,c=t.opacity)},t.$$.update=()=>{64&t.$$.dirty&&i(5,l=Math.atan(n))},[s,r,o,a,c,l,n]}class Je extends t{constructor(t){super(),e(this,t,Fe,We,i,{point:0,slope:6,color:1,style:2,weight:3,opacity:4})}get point(){return this.$$.ctx[0]}set point(t){this.$$set({point:t}),s()}get slope(){return this.$$.ctx[6]}set slope(t){this.$$set({slope:t}),s()}get color(){return this.$$.ctx[1]}set color(t){this.$$set({color:t}),s()}get style(){return this.$$.ctx[2]}set style(t){this.$$set({style:t}),s()}get weight(){return this.$$.ctx[3]}set weight(t){this.$$set({weight:t}),s()}get opacity(){return this.$$.ctx[4]}set opacity(t){this.$$set({opacity:t}),s()}}function Qe(t){n(t,"svelte-5trppw",".visual-math.svelte-5trppw{display:block;background:var(--visual-math-bg);overflow:hidden;user-select:none;font-family:sans-serif;font-variant-numeric:tabular-nums;--visual-math-bg:#f1f1f1;--visual-math-fg:black;--visual-math-origin-color:var(--visual-math-fg);--visual-math-line-color:#555;--grid-line-subdivision-color:#222;--visual-math-red:#f10000;--visual-math-orange:#f18100;--visual-math-yellow:#f1f100;--visual-math-green:#00f181;--visual-math-blue:#0000f1;--visual-math-indigo:#8100f1;--visual-math-violet:#8100f1;--visual-math-pink:#f18181}")}function Ze(t){let e,i,s,n,o,h,d;const p=t[38].default,$=T(p,t,t[37],null);return{c(){e=L("div"),i=r("svg"),$&&$.c(),a(i,"width",t[2]),a(i,"height",t[3]),a(i,"viewBox",s=`${-t[5](0)} ${-t[4](0)} ${t[2]} ${t[3]}`),a(i,"preserveAspectRatio","xMidYMin"),a(i,"style",n=`width: ${t[0]}; touch-action: ${t[1]?"none":"auto"};`),a(e,"class","visual-math svelte-5trppw"),a(e,"style",o=`width: ${t[8]}; height: ${t[7]}`),D((()=>t[40].call(e)))},m(s,n){c(s,e,n),l(e,i),$&&$.m(i,null),t[39](e),h=C(e,t[40].bind(e)),d=!0},p(t,r){$&&$.p&&(!d||64&r[1])&&I($,p,t,t[37],d?V(p,t[37],r,null):K(t[37]),null),(!d||4&r[0])&&a(i,"width",t[2]),(!d||8&r[0])&&a(i,"height",t[3]),(!d||60&r[0]&&s!==(s=`${-t[5](0)} ${-t[4](0)} ${t[2]} ${t[3]}`))&&a(i,"viewBox",s),(!d||3&r[0]&&n!==(n=`width: ${t[0]}; touch-action: ${t[1]?"none":"auto"};`))&&a(i,"style",n),(!d||384&r[0]&&o!==(o=`width: ${t[8]}; height: ${t[7]}`))&&a(e,"style",o)},i(t){d||(m($,t),d=!0)},o(t){v($,t),d=!1},d(i){i&&u(e),$&&$.d(i),t[39](null),h()}}}const ti=U.create();function ei(t,e,i){let s,n,r,o,a,c,l,h,u,d,p,$,f,g,y,m,v,x,b,{$$slots:w={},$$scope:k}=e,{width:O=500}=e,{height:S=500}=e,{pan:_=!0}=e,{zoom:M=!0}=e,{xAxisExtent:A=U.fromValues(-5.5,5.5)}=e,{yAxisExtent:P=U.fromValues(-5.5,5.5)}=e,E="number"==typeof O?O:500,T="number"==typeof S?S:500,L=Math.min(A[1]-A[0],P[1]-P[0]),D=U.fromValues(0,0),C=U.fromValues(A[0],P[0]),I=U.fromValues(A[1],P[1]),K=U.create(),V=H.create(),Y=H.create(),N=[],W=[],J=U.create(),Z=U.create(),tt=B({xPanes:N,yPanes:W,xPaneRange:J,yPaneRange:Z});q(Q,tt);let et=B({min:C,max:I,width:E,height:T});!function(t){q(G,t)}(et);let it=B({zoomAmount:L,scaleX:a,scaleY:c,span:K,pixelMatrix:V,inversePixelMatrix:Y,cssScale:u});!function(t){q(R,t)}(it);let st,nt=B({mapX:r,mapY:o});return function(t){q(F,t)}(nt),X((()=>{const t=new Ee(st,x),e=new je(st,b);return()=>{t.destroy(),e.destroy()}})),t.$$set=t=>{"width"in t&&i(0,O=t.width),"height"in t&&i(11,S=t.height),"pan"in t&&i(1,_=t.pan),"zoom"in t&&i(12,M=t.zoom),"xAxisExtent"in t&&i(9,A=t.xAxisExtent),"yAxisExtent"in t&&i(10,P=t.yAxisExtent),"$$scope"in t&&i(37,k=t.$$scope)},t.$$.update=()=>{if(1&t.$$.dirty[0]&&i(8,s="auto"===O?"100%":`${O}px`),2048&t.$$.dirty[0]&&i(7,n="auto"===S?"100%":`${S}px`),13824&t.$$.dirty[0]&&(b=t=>{if(!M||t.last)return;const e=function(t){if("number"==typeof t.detail&&0!==t.detail){if(t.detail>0)return-1;if(t.detail<0)return 1}else if("number"==typeof t.wheelDelta){if(t.wheelDelta<0)return-1;if(t.wheelDelta>0)return 1}}(t.event);e&&(L>3||e<0)&&(i(9,A=U.set(A,A[0]+e,A[1]-e)),i(10,P=U.set(P,P[0]+e,P[1]-e)),i(13,L=Math.min(A[1]-A[0],P[1]-P[0])))}),8204&t.$$.dirty[0]){const t=.5*L,e=.5*(L*(E/T));i(9,A[0]=-e,A),i(9,A[1]=e,A),i(10,P[0]=-t,P),i(10,P[1]=t,P)}1550&t.$$.dirty[0]&&(x=t=>{_&&(i(14,D[0]=-t.offset[0]/E*(A[1]-A[0]),D),i(14,D[1]=-t.offset[1]/T*(P[1]-P[0]),D))}),50688&t.$$.dirty[0]&&i(15,C=U.add(C,D,U.set(ti,A[0],P[0]))),83456&t.$$.dirty[0]&&i(16,I=U.add(I,D,U.set(ti,A[1],P[1]))),98308&t.$$.dirty[0]&&i(5,r=t=>(t-C[0])/(I[0]-C[0])*E),98312&t.$$.dirty[0]&&i(4,o=t=>(t-C[1])/(I[1]-C[1])*T),229376&t.$$.dirty[0]&&i(17,K=U.sub(K,I,C)),131076&t.$$.dirty[0]&&i(26,a=t=>t/K[0]*E),131080&t.$$.dirty[0]&&i(25,c=t=>-t/K[1]*T),98304&t.$$.dirty[0]&&i(34,d=I[0]-C[0]),4&t.$$.dirty[0]|8&t.$$.dirty[1]&&i(36,l=t=>t/E*d),98304&t.$$.dirty[0]&&i(30,g=I[1]-C[1]),1073741832&t.$$.dirty[0]&&i(35,h=t=>-t/T*g),100925440&t.$$.dirty[0]&&i(18,V=H.fromScaling(V,U.set(ti,a(1),c(1)))),524288&t.$$.dirty[0]|48&t.$$.dirty[1]&&i(19,Y=H.fromScaling(Y,U.set(ti,l(1),h(1)))),100663296&t.$$.dirty[0]&&i(24,u=`scale(${a(1)} ${c(1)})`),8&t.$$.dirty[1]&&i(33,p=Math.pow(2,Math.round(Math.log10(d)/Math.log10(2)))),32768&t.$$.dirty[0]|4&t.$$.dirty[1]&&i(32,$=Math.floor(C[0]/p)*p),65536&t.$$.dirty[0]|4&t.$$.dirty[1]&&i(31,f=Math.ceil(I[0]/p)*p),7&t.$$.dirty[1]&&i(20,N=z($,f,p).iter().map((t=>U.fromValues(t,t+p))).toArray()),4194304&t.$$.dirty[0]|3&t.$$.dirty[1]&&i(22,J=U.set(J,$,f)),1073741824&t.$$.dirty[0]&&i(29,y=Math.pow(2,Math.round(Math.log10(g)/Math.log10(2)))),536903680&t.$$.dirty[0]&&i(28,m=Math.floor(C[0]/y)*y),536936448&t.$$.dirty[0]&&i(27,v=Math.ceil(I[0]/y)*y),939524096&t.$$.dirty[0]&&i(21,W=z(m,v,y).iter().map((t=>U.fromValues(t,t+y))).toArray()),411041792&t.$$.dirty[0]&&i(23,Z=U.set(Z,m,v)),15728640&t.$$.dirty[0]&&tt.set({xPanes:N,yPanes:W,xPaneRange:J,yPaneRange:Z}),98316&t.$$.dirty[0]&&et.set({min:C,max:I,width:E,height:T}),118366208&t.$$.dirty[0]&&it.set({zoomAmount:L,scaleX:a,scaleY:c,span:K,pixelMatrix:V,inversePixelMatrix:Y,cssScale:u}),48&t.$$.dirty[0]&&nt.set({mapX:r,mapY:o})},[O,_,E,T,o,r,st,n,s,A,P,S,M,L,D,C,I,K,V,Y,N,W,J,Z,u,c,a,v,m,y,g,f,$,p,d,h,l,k,w,function(t){j[t?"unshift":"push"]((()=>{st=t,i(6,st)}))},function(){E=this.offsetWidth,T=this.offsetHeight,i(2,E),i(3,T)}]}class ii extends t{constructor(t){super(),e(this,t,ei,Ze,i,{width:0,height:11,pan:1,zoom:12,xAxisExtent:9,yAxisExtent:10},Qe,[-1,-1])}get width(){return this.$$.ctx[0]}set width(t){this.$$set({width:t}),s()}get height(){return this.$$.ctx[11]}set height(t){this.$$set({height:t}),s()}get pan(){return this.$$.ctx[1]}set pan(t){this.$$set({pan:t}),s()}get zoom(){return this.$$.ctx[12]}set zoom(t){this.$$set({zoom:t}),s()}get xAxisExtent(){return this.$$.ctx[9]}set xAxisExtent(t){this.$$set({xAxisExtent:t}),s()}get yAxisExtent(){return this.$$.ctx[10]}set yAxisExtent(t){this.$$set({yAxisExtent:t}),s()}}export{jt as CartesianCoordinates,Vt as Circle,Ct as Ellipse,bt as GridPattern,Ce as MovablePoint,Ve as Point,Ge as PointAngle,Je as PointSlope,Xe as ThroughPoints,ii as VisualMath,ot as XLabels,dt as YLabels,W as getCoordinateContext,J as getMapContext,Z as getPanesContext,N as getScaleContext,tt as snappedRange}; +//# sourceMappingURL=index.js.map diff --git a/browser/index.js.map b/browser/index.js.map new file mode 100644 index 0000000..a12c7a9 --- /dev/null +++ b/browser/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../src/math.ts","../src/XLabels.svelte","../src/YLabels.svelte","../src/GridPattern.svelte","../src/CartesianCoordinates.svelte","../src/Ellipse.svelte","../src/Circle.svelte","../node_modules/@use-gesture/core/dist/maths-b2a210f4.esm.js","../node_modules/@use-gesture/core/dist/actions-0efe52f5.esm.js","../node_modules/@use-gesture/core/dist/use-gesture-core.esm.js","../node_modules/@use-gesture/vanilla/dist/use-gesture-vanilla.esm.js","../src/MovablePoint.svelte","../src/Point.svelte","../src/ThroughPoints.svelte","../src/PointAngle.svelte","../src/PointSlope.svelte","../src/VisualMath.svelte"],"sourcesContent":[null,"\n\n\n {#each xs as x}\n \n {labelMaker ? labelMaker(x) : x}\n \n {/each}\n\n\n\n","\n\n\n {#each ys as y}\n \n {labelMaker ? labelMaker(y) : y}\n \n {/each}\n\n\n\n","\n\n\n {#each xs as x}\n \n {/each}\n {#each ys as y}\n \n {/each}\n\n {#if xLines}\n \n \n {/if}\n {#if yLines}\n \n \n {/if}\n\n","\n\n\n\n\n \n\n\n\n\n{#if xAxis.labels}\n \n{/if}\n{#if yAxis.labels}\n \n{/if}\n\n{#if xAxisOptions.axis}\n \n{/if}\n\n{#if yAxisOptions.axis}\n \n{/if}\n\n\n","\n\n\n\n\n","\n\n\n","function clamp(v, min, max) {\n return Math.max(min, Math.min(v, max));\n}\nconst V = {\n toVector(v, fallback) {\n if (v === undefined) v = fallback;\n return Array.isArray(v) ? v : [v, v];\n },\n\n add(v1, v2) {\n return [v1[0] + v2[0], v1[1] + v2[1]];\n },\n\n sub(v1, v2) {\n return [v1[0] - v2[0], v1[1] - v2[1]];\n },\n\n addTo(v1, v2) {\n v1[0] += v2[0];\n v1[1] += v2[1];\n },\n\n subTo(v1, v2) {\n v1[0] -= v2[0];\n v1[1] -= v2[1];\n }\n\n};\n\nfunction rubberband(distance, dimension, constant) {\n if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5);\n return distance * dimension * constant / (dimension + constant * distance);\n}\n\nfunction rubberbandIfOutOfBounds(position, min, max, constant = 0.15) {\n if (constant === 0) return clamp(position, min, max);\n if (position < min) return -rubberband(min - position, max - min, constant) + min;\n if (position > max) return +rubberband(position - max, max - min, constant) + max;\n return position;\n}\nfunction computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) {\n const [[X0, X1], [Y0, Y1]] = bounds;\n return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)];\n}\n\nexport { V, computeRubberband as c, rubberbandIfOutOfBounds as r };\n","import { V, c as computeRubberband } from './maths-b2a210f4.esm.js';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nconst EVENT_TYPE_MAP = {\n pointer: {\n start: 'down',\n change: 'move',\n end: 'up'\n },\n mouse: {\n start: 'down',\n change: 'move',\n end: 'up'\n },\n touch: {\n start: 'start',\n change: 'move',\n end: 'end'\n },\n gesture: {\n start: 'start',\n change: 'change',\n end: 'end'\n }\n};\n\nfunction capitalize(string) {\n if (!string) return '';\n return string[0].toUpperCase() + string.slice(1);\n}\n\nfunction toHandlerProp(device, action = '', capture = false) {\n const deviceProps = EVENT_TYPE_MAP[device];\n const actionKey = deviceProps ? deviceProps[action] || action : action;\n return 'on' + capitalize(device) + capitalize(actionKey) + (capture ? 'Capture' : '');\n}\nfunction toDomEventType(device, action = '') {\n const deviceProps = EVENT_TYPE_MAP[device];\n const actionKey = deviceProps ? deviceProps[action] || action : action;\n return device + actionKey;\n}\nfunction isTouch(event) {\n return 'touches' in event;\n}\n\nfunction getCurrentTargetTouchList(event) {\n return Array.from(event.touches).filter(e => {\n var _event$currentTarget, _event$currentTarget$;\n\n return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target));\n });\n}\n\nfunction getTouchList(event) {\n return event.type === 'touchend' ? event.changedTouches : event.targetTouches;\n}\n\nfunction getValueEvent(event) {\n return isTouch(event) ? getTouchList(event)[0] : event;\n}\n\nfunction distanceAngle(P1, P2) {\n const dx = P2.clientX - P1.clientX;\n const dy = P2.clientY - P1.clientY;\n const cx = (P2.clientX + P1.clientX) / 2;\n const cy = (P2.clientY + P1.clientY) / 2;\n const distance = Math.hypot(dx, dy);\n const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;\n const origin = [cx, cy];\n return {\n angle,\n distance,\n origin\n };\n}\nfunction touchIds(event) {\n return getCurrentTargetTouchList(event).map(touch => touch.identifier);\n}\nfunction touchDistanceAngle(event, ids) {\n const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));\n return distanceAngle(P1, P2);\n}\nfunction pointerId(event) {\n const valueEvent = getValueEvent(event);\n return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;\n}\nfunction pointerValues(event) {\n const valueEvent = getValueEvent(event);\n return [valueEvent.clientX, valueEvent.clientY];\n}\nconst LINE_HEIGHT = 40;\nconst PAGE_HEIGHT = 800;\nfunction wheelValues(event) {\n let {\n deltaX,\n deltaY,\n deltaMode\n } = event;\n\n if (deltaMode === 1) {\n deltaX *= LINE_HEIGHT;\n deltaY *= LINE_HEIGHT;\n } else if (deltaMode === 2) {\n deltaX *= PAGE_HEIGHT;\n deltaY *= PAGE_HEIGHT;\n }\n\n return [deltaX, deltaY];\n}\nfunction scrollValues(event) {\n var _ref, _ref2;\n\n const {\n scrollX,\n scrollY,\n scrollLeft,\n scrollTop\n } = event.currentTarget;\n return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0];\n}\nfunction getEventDetails(event) {\n const payload = {};\n if ('buttons' in event) payload.buttons = event.buttons;\n\n if ('shiftKey' in event) {\n const {\n shiftKey,\n altKey,\n metaKey,\n ctrlKey\n } = event;\n Object.assign(payload, {\n shiftKey,\n altKey,\n metaKey,\n ctrlKey\n });\n }\n\n return payload;\n}\n\nfunction call(v, ...args) {\n if (typeof v === 'function') {\n return v(...args);\n } else {\n return v;\n }\n}\nfunction noop() {}\nfunction chain(...fns) {\n if (fns.length === 0) return noop;\n if (fns.length === 1) return fns[0];\n return function () {\n let result;\n\n for (const fn of fns) {\n result = fn.apply(this, arguments) || result;\n }\n\n return result;\n };\n}\nfunction assignDefault(value, fallback) {\n return Object.assign({}, fallback, value || {});\n}\n\nclass Engine {\n constructor(ctrl, args, key) {\n this.ctrl = ctrl;\n this.args = args;\n this.key = key;\n\n if (!this.state) {\n this.state = {\n values: [0, 0],\n initial: [0, 0]\n };\n if (this.init) this.init();\n this.reset();\n }\n }\n\n get state() {\n return this.ctrl.state[this.key];\n }\n\n set state(state) {\n this.ctrl.state[this.key] = state;\n }\n\n get shared() {\n return this.ctrl.state.shared;\n }\n\n get eventStore() {\n return this.ctrl.gestureEventStores[this.key];\n }\n\n get timeoutStore() {\n return this.ctrl.gestureTimeoutStores[this.key];\n }\n\n get config() {\n return this.ctrl.config[this.key];\n }\n\n get sharedConfig() {\n return this.ctrl.config.shared;\n }\n\n get handler() {\n return this.ctrl.handlers[this.key];\n }\n\n reset() {\n const {\n state,\n shared,\n config,\n ingKey,\n args\n } = this;\n const {\n transform,\n threshold = [0, 0]\n } = config;\n shared[ingKey] = state._active = state.active = state._blocked = state._force = false;\n state._step = [false, false];\n state.intentional = false;\n state._movement = [0, 0];\n state._distance = [0, 0];\n state._delta = [0, 0];\n state._threshold = V.sub(transform(threshold), transform([0, 0])).map(Math.abs);\n state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];\n state.args = args;\n state.axis = undefined;\n state.memo = undefined;\n state.elapsedTime = 0;\n state.direction = [0, 0];\n state.distance = [0, 0];\n state.velocity = [0, 0];\n state.movement = [0, 0];\n state.delta = [0, 0];\n state.timeStamp = 0;\n }\n\n start(event) {\n const state = this.state;\n const config = this.config;\n\n if (!state._active) {\n this.reset();\n state._active = true;\n state.target = event.target;\n state.currentTarget = event.currentTarget;\n state.initial = state.values;\n state.lastOffset = config.from ? call(config.from, state) : state.offset;\n state.offset = state.lastOffset;\n }\n\n state.startTime = state.timeStamp = event.timeStamp;\n }\n\n compute(event) {\n const {\n state,\n config,\n shared\n } = this;\n state.args = this.args;\n let dt = 0;\n\n if (event) {\n state.event = event;\n state.type = event.type;\n shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;\n shared.locked = !!document.pointerLockElement;\n Object.assign(shared, getEventDetails(event));\n shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;\n dt = event.timeStamp - state.timeStamp;\n state.timeStamp = event.timeStamp;\n state.elapsedTime = state.timeStamp - state.startTime;\n }\n\n if (state._active) {\n const _absoluteDelta = state._delta.map(Math.abs);\n\n V.addTo(state._distance, _absoluteDelta);\n }\n\n const [_m0, _m1] = config.transform(state._movement);\n const [_t0, _t1] = state._threshold;\n let [_s0, _s1] = state._step;\n if (_s0 === false) _s0 = Math.abs(_m0) >= _t0 && Math.sign(_m0) * _t0;\n if (_s1 === false) _s1 = Math.abs(_m1) >= _t1 && Math.sign(_m1) * _t1;\n state.intentional = _s0 !== false || _s1 !== false;\n if (!state.intentional) return;\n state._step = [_s0, _s1];\n const movement = [0, 0];\n movement[0] = _s0 !== false ? _m0 - _s0 : 0;\n movement[1] = _s1 !== false ? _m1 - _s1 : 0;\n if (this.intent) this.intent(movement);\n\n if (state._active && !state._blocked || state.active) {\n state.first = state._active && !state.active;\n state.last = !state._active && state.active;\n state.active = shared[this.ingKey] = state._active;\n\n if (event) {\n if (state.first) {\n if ('bounds' in config) state._bounds = call(config.bounds, state);\n if (this.setup) this.setup();\n }\n\n const previousMovement = state.movement;\n state.movement = movement;\n this.computeOffset();\n\n if (!state.last) {\n state.delta = V.sub(movement, previousMovement);\n const absoluteDelta = state.delta.map(Math.abs);\n V.addTo(state.distance, absoluteDelta);\n state.direction = state.delta.map(Math.sign);\n\n if (!state.first && dt > 0) {\n state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];\n }\n }\n }\n }\n\n const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];\n state.offset = computeRubberband(state._bounds, state.offset, rubberband);\n this.computeMovement();\n }\n\n emit() {\n const state = this.state;\n const shared = this.shared;\n const config = this.config;\n if (!state._active) this.clean();\n if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;\n const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, {\n [this.aliasKey]: state.values\n }));\n if (memo !== undefined) state.memo = memo;\n }\n\n clean() {\n this.eventStore.clean();\n this.timeoutStore.clean();\n }\n\n}\n\nfunction selectAxis([dx, dy]) {\n const d = Math.abs(dx) - Math.abs(dy);\n if (d > 0) return 'x';\n if (d < 0) return 'y';\n return undefined;\n}\n\nfunction restrictVectorToAxis(v, axis) {\n switch (axis) {\n case 'x':\n v[1] = 0;\n break;\n\n case 'y':\n v[0] = 0;\n break;\n }\n}\n\nclass CoordinatesEngine extends Engine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"aliasKey\", 'xy');\n }\n\n reset() {\n super.reset();\n this.state.axis = undefined;\n }\n\n init() {\n this.state.offset = [0, 0];\n this.state.lastOffset = [0, 0];\n }\n\n computeOffset() {\n this.state.offset = V.add(this.state.lastOffset, this.state.movement);\n }\n\n computeMovement() {\n this.state.movement = V.sub(this.state.offset, this.state.lastOffset);\n }\n\n intent(v) {\n this.state.axis = this.state.axis || selectAxis(v);\n this.state._blocked = (this.config.lockDirection || !!this.config.axis) && !this.state.axis || !!this.config.axis && this.config.axis !== this.state.axis;\n if (this.state._blocked) return;\n\n if (this.config.axis || this.config.lockDirection) {\n restrictVectorToAxis(v, this.state.axis);\n }\n }\n\n}\n\nconst DEFAULT_RUBBERBAND = 0.15;\nconst commonConfigResolver = {\n enabled(value = true) {\n return value;\n },\n\n triggerAllEvents(value = false) {\n return value;\n },\n\n rubberband(value = 0) {\n switch (value) {\n case true:\n return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];\n\n case false:\n return [0, 0];\n\n default:\n return V.toVector(value);\n }\n },\n\n from(value) {\n if (typeof value === 'function') return value;\n if (value != null) return V.toVector(value);\n },\n\n transform(value, _k, config) {\n return value || config.shared.transform;\n }\n\n};\n\nif (process.env.NODE_ENV === 'development') {\n Object.assign(commonConfigResolver, {\n domTarget(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`domTarget\\` option has been renamed to \\`target\\`.`);\n }\n },\n\n lockDirection(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`lockDirection\\` option has been merged with \\`axis\\`. Use it as in \\`{ axis: 'lock' }\\``);\n }\n },\n\n initial(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`initial\\` option has been renamed to \\`from\\`.`);\n }\n }\n\n });\n}\n\nconst coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {\n axis(_v, _k, {\n axis\n }) {\n this.lockDirection = axis === 'lock';\n if (!this.lockDirection) return axis;\n },\n\n bounds(value = {}) {\n if (typeof value === 'function') {\n return state => coordinatesConfigResolver.bounds(value(state));\n }\n\n if ('current' in value) {\n return () => value.current;\n }\n\n if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {\n return value;\n }\n\n const {\n left = -Infinity,\n right = Infinity,\n top = -Infinity,\n bottom = Infinity\n } = value;\n return [[left, right], [top, bottom]];\n }\n\n});\n\nconst DISPLACEMENT = 10;\nconst KEYS_DELTA_MAP = {\n ArrowRight: (factor = 1) => [DISPLACEMENT * factor, 0],\n ArrowLeft: (factor = 1) => [-DISPLACEMENT * factor, 0],\n ArrowUp: (factor = 1) => [0, -DISPLACEMENT * factor],\n ArrowDown: (factor = 1) => [0, DISPLACEMENT * factor]\n};\nclass DragEngine extends CoordinatesEngine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'dragging');\n }\n\n reset() {\n super.reset();\n const state = this.state;\n state._pointerId = undefined;\n state._pointerActive = false;\n state._keyboardActive = false;\n state._preventScroll = false;\n state._delayed = false;\n state.swipe = [0, 0];\n state.tap = false;\n state.canceled = false;\n state.cancel = this.cancel.bind(this);\n }\n\n setup() {\n const state = this.state;\n\n if (state._bounds instanceof HTMLElement) {\n const boundRect = state._bounds.getBoundingClientRect();\n\n const targetRect = state.currentTarget.getBoundingClientRect();\n const _bounds = {\n left: boundRect.left - targetRect.left + state.offset[0],\n right: boundRect.right - targetRect.right + state.offset[0],\n top: boundRect.top - targetRect.top + state.offset[1],\n bottom: boundRect.bottom - targetRect.bottom + state.offset[1]\n };\n state._bounds = coordinatesConfigResolver.bounds(_bounds);\n }\n }\n\n cancel() {\n const state = this.state;\n if (state.canceled) return;\n setTimeout(() => {\n state.canceled = true;\n state._active = false;\n this.compute();\n this.emit();\n }, 0);\n }\n\n setActive() {\n this.state._active = this.state._pointerActive || this.state._keyboardActive;\n }\n\n clean() {\n this.pointerClean();\n this.state._pointerActive = false;\n this.state._keyboardActive = false;\n super.clean();\n }\n\n pointerDown(event) {\n if (event.buttons != null && event.buttons % 2 !== 1) return;\n this.ctrl.setEventIds(event);\n\n if (this.config.pointerCapture) {\n event.target.setPointerCapture(event.pointerId);\n }\n\n const state = this.state;\n const config = this.config;\n if (state._pointerActive) return;\n this.start(event);\n this.setupPointer(event);\n state._pointerId = pointerId(event);\n state._pointerActive = true;\n state.values = pointerValues(event);\n state.initial = state.values;\n\n if (config.preventScroll) {\n this.setupScrollPrevention(event);\n } else if (config.delay > 0) {\n this.setupDelayTrigger(event);\n } else {\n this.startPointerDrag(event);\n }\n }\n\n startPointerDrag(event) {\n const state = this.state;\n state._active = true;\n state._preventScroll = true;\n state._delayed = false;\n this.compute(event);\n this.emit();\n }\n\n pointerMove(event) {\n const state = this.state;\n const config = this.config;\n if (!state._pointerActive) return;\n if (state.type === event.type && event.timeStamp === state.timeStamp) return;\n const id = pointerId(event);\n if (state._pointerId && id !== state._pointerId) return;\n const values = pointerValues(event);\n\n if (document.pointerLockElement === event.target) {\n state._delta = [event.movementX, event.movementY];\n } else {\n state._delta = V.sub(values, state.values);\n state.values = values;\n }\n\n V.addTo(state._movement, state._delta);\n this.compute(event);\n\n if (state._delayed) {\n this.timeoutStore.remove('dragDelay');\n this.startPointerDrag(event);\n return;\n }\n\n if (config.preventScroll && !state._preventScroll) {\n if (state.axis) {\n if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {\n state._active = false;\n this.clean();\n return;\n } else {\n this.timeoutStore.remove('startPointerDrag');\n this.startPointerDrag(event);\n return;\n }\n } else {\n return;\n }\n }\n\n this.emit();\n }\n\n pointerUp(event) {\n this.ctrl.setEventIds(event);\n\n try {\n if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {\n ;\n event.target.releasePointerCapture(event.pointerId);\n }\n } catch (_unused) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`[@use-gesture]: If you see this message, it's likely that you're using an outdated version of \\`@react-three/fiber\\`. \\n\\nPlease upgrade to the latest version.`);\n }\n }\n\n const state = this.state;\n const config = this.config;\n if (!state._pointerActive) return;\n const id = pointerId(event);\n if (state._pointerId && id !== state._pointerId) return;\n this.state._pointerActive = false;\n this.setActive();\n this.compute(event);\n const [dx, dy] = state._distance;\n state.tap = dx <= 3 && dy <= 3;\n\n if (state.tap && config.filterTaps) {\n state._force = true;\n } else {\n const [dirx, diry] = state.direction;\n const [vx, vy] = state.velocity;\n const [mx, my] = state.movement;\n const [svx, svy] = config.swipe.velocity;\n const [sx, sy] = config.swipe.distance;\n const sdt = config.swipe.duration;\n\n if (state.elapsedTime < sdt) {\n if (Math.abs(vx) > svx && Math.abs(mx) > sx) state.swipe[0] = dirx;\n if (Math.abs(vy) > svy && Math.abs(my) > sy) state.swipe[1] = diry;\n }\n }\n\n this.emit();\n }\n\n pointerClick(event) {\n if (!this.state.tap) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n setupPointer(event) {\n const config = this.config;\n let device = config.device;\n\n if (process.env.NODE_ENV === 'development') {\n try {\n if (device === 'pointer') {\n const currentTarget = 'uv' in event ? event.sourceEvent.currentTarget : event.currentTarget;\n const style = window.getComputedStyle(currentTarget);\n\n if (style.touchAction === 'auto') {\n console.warn(`[@use-gesture]: The drag target has its \\`touch-action\\` style property set to \\`auto\\`. It is recommended to add \\`touch-action: 'none'\\` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\\n\\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.`, currentTarget);\n }\n }\n } catch (_unused2) {}\n }\n\n if (config.pointerLock) {\n event.currentTarget.requestPointerLock();\n }\n\n if (!config.pointerCapture) {\n this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));\n this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));\n }\n }\n\n pointerClean() {\n if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {\n document.exitPointerLock();\n }\n }\n\n preventScroll(event) {\n if (this.state._preventScroll && event.cancelable) {\n event.preventDefault();\n }\n }\n\n setupScrollPrevention(event) {\n persistEvent(event);\n this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {\n passive: false\n });\n this.eventStore.add(this.sharedConfig.window, 'touch', 'end', this.clean.bind(this), {\n passive: false\n });\n this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', this.clean.bind(this), {\n passive: false\n });\n this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScroll, event);\n }\n\n setupDelayTrigger(event) {\n this.state._delayed = true;\n this.timeoutStore.add('dragDelay', this.startPointerDrag.bind(this), this.config.delay, event);\n }\n\n keyDown(event) {\n const deltaFn = KEYS_DELTA_MAP[event.key];\n const state = this.state;\n\n if (deltaFn) {\n const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;\n state._delta = deltaFn(factor);\n this.start(event);\n state._keyboardActive = true;\n V.addTo(state._movement, state._delta);\n this.compute(event);\n this.emit();\n }\n }\n\n keyUp(event) {\n if (!(event.key in KEYS_DELTA_MAP)) return;\n this.state._keyboardActive = false;\n this.setActive();\n this.compute(event);\n this.emit();\n }\n\n bind(bindFunction) {\n const device = this.config.device;\n bindFunction(device, 'start', this.pointerDown.bind(this));\n\n if (this.config.pointerCapture) {\n bindFunction(device, 'change', this.pointerMove.bind(this));\n bindFunction(device, 'end', this.pointerUp.bind(this));\n bindFunction(device, 'cancel', this.pointerUp.bind(this));\n }\n\n bindFunction('key', 'down', this.keyDown.bind(this));\n bindFunction('key', 'up', this.keyUp.bind(this));\n\n if (this.config.filterTaps) {\n bindFunction('click', '', this.pointerClick.bind(this), {\n capture: true\n });\n }\n }\n\n}\n\nfunction persistEvent(event) {\n 'persist' in event && typeof event.persist === 'function' && event.persist();\n}\n\nconst isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;\n\nfunction supportsTouchEvents() {\n return isBrowser && 'ontouchstart' in window;\n}\n\nfunction isTouchScreen() {\n return supportsTouchEvents() || isBrowser && navigator.maxTouchPoints > 1;\n}\n\nfunction supportsPointerEvents() {\n return isBrowser && 'onpointerdown' in window;\n}\n\nfunction supportsPointerLock() {\n return isBrowser && 'exitPointerLock' in window.document;\n}\n\nfunction supportsGestureEvents() {\n try {\n return 'constructor' in GestureEvent;\n } catch (e) {\n return false;\n }\n}\n\nconst SUPPORT = {\n isBrowser,\n gesture: supportsGestureEvents(),\n touch: supportsTouchEvents(),\n touchscreen: isTouchScreen(),\n pointer: supportsPointerEvents(),\n pointerLock: supportsPointerLock()\n};\n\nconst DEFAULT_PREVENT_SCROLL_DELAY = 250;\nconst DEFAULT_DRAG_DELAY = 180;\nconst DEFAULT_SWIPE_VELOCITY = 0.5;\nconst DEFAULT_SWIPE_DISTANCE = 50;\nconst DEFAULT_SWIPE_DURATION = 250;\nconst dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {\n pointerLock(_v, _k, {\n pointer: {\n lock = false,\n touch = false\n } = {}\n }) {\n this.useTouch = SUPPORT.touch && touch;\n return SUPPORT.pointerLock && lock;\n },\n\n device(_v, _k) {\n if (this.useTouch) return 'touch';\n if (this.pointerLock) return 'mouse';\n if (SUPPORT.pointer) return 'pointer';\n if (SUPPORT.touch) return 'touch';\n return 'mouse';\n },\n\n preventScroll(value = false, _k, {\n preventScrollAxis = 'y'\n }) {\n if (preventScrollAxis) this.preventScrollAxis = preventScrollAxis;\n if (!SUPPORT.touchscreen) return false;\n if (typeof value === 'number') return value;\n return value ? DEFAULT_PREVENT_SCROLL_DELAY : false;\n },\n\n pointerCapture(_v, _k, {\n pointer: {\n capture = true\n } = {}\n }) {\n return !this.pointerLock && this.device === 'pointer' && capture;\n },\n\n threshold(value, _k, {\n filterTaps = false,\n axis = undefined\n }) {\n const threshold = V.toVector(value, filterTaps ? 3 : axis ? 1 : 0);\n this.filterTaps = filterTaps;\n return threshold;\n },\n\n swipe({\n velocity = DEFAULT_SWIPE_VELOCITY,\n distance = DEFAULT_SWIPE_DISTANCE,\n duration = DEFAULT_SWIPE_DURATION\n } = {}) {\n return {\n velocity: this.transform(V.toVector(velocity)),\n distance: this.transform(V.toVector(distance)),\n duration\n };\n },\n\n delay(value = 0) {\n switch (value) {\n case true:\n return DEFAULT_DRAG_DELAY;\n\n case false:\n return 0;\n\n default:\n return value;\n }\n }\n\n});\n\nif (process.env.NODE_ENV === 'development') {\n Object.assign(dragConfigResolver, {\n useTouch(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`useTouch\\` option has been renamed to \\`pointer.touch\\`. Use it as in \\`{ pointer: { touch: true } }\\`.`);\n }\n },\n\n experimental_preventWindowScrollY(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`experimental_preventWindowScrollY\\` option has been renamed to \\`preventScroll\\`.`);\n }\n },\n\n swipeVelocity(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`swipeVelocity\\` option has been renamed to \\`swipe.velocity\\`. Use it as in \\`{ swipe: { velocity: 0.5 } }\\`.`);\n }\n },\n\n swipeDistance(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`swipeDistance\\` option has been renamed to \\`swipe.distance\\`. Use it as in \\`{ swipe: { distance: 50 } }\\`.`);\n }\n },\n\n swipeDuration(value) {\n if (value !== undefined) {\n throw Error(`[@use-gesture]: \\`swipeDuration\\` option has been renamed to \\`swipe.duration\\`. Use it as in \\`{ swipe: { duration: 250 } }\\`.`);\n }\n }\n\n });\n}\n\nconst SCALE_ANGLE_RATIO_INTENT_DEG = 30;\nconst PINCH_WHEEL_RATIO = 60;\nclass PinchEngine extends Engine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'pinching');\n\n _defineProperty(this, \"aliasKey\", 'da');\n }\n\n init() {\n this.state.offset = [1, 0];\n this.state.lastOffset = [1, 0];\n this.state._pointerEvents = new Map();\n }\n\n reset() {\n super.reset();\n const state = this.state;\n state._touchIds = [];\n state.canceled = false;\n state.cancel = this.cancel.bind(this);\n state.turns = 0;\n }\n\n computeOffset() {\n const {\n movement,\n lastOffset\n } = this.state;\n this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];\n }\n\n computeMovement() {\n const {\n offset,\n lastOffset\n } = this.state;\n this.state.movement = [offset[0] / lastOffset[0] - 1, offset[1] - lastOffset[1]];\n }\n\n intent(v) {\n const state = this.state;\n\n if (!state.axis) {\n const axisMovementDifference = Math.abs(v[0]) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(v[1]);\n if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';\n }\n\n if (this.config.lockDirection) {\n if (state.axis === 'scale') v[1] = 0;else if (state.axis === 'angle') v[0] = 0;\n }\n }\n\n cancel() {\n const state = this.state;\n if (state.canceled) return;\n setTimeout(() => {\n state.canceled = true;\n state._active = false;\n this.compute();\n this.emit();\n }, 0);\n }\n\n touchStart(event) {\n this.ctrl.setEventIds(event);\n const state = this.state;\n const ctrlTouchIds = this.ctrl.touchIds;\n\n if (state._active) {\n if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;\n }\n\n if (ctrlTouchIds.size < 2) return;\n this.start(event);\n state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);\n const payload = touchDistanceAngle(event, state._touchIds);\n this.pinchStart(event, payload);\n }\n\n pointerStart(event) {\n if (event.buttons != null && event.buttons % 2 !== 1) return;\n this.ctrl.setEventIds(event);\n event.target.setPointerCapture(event.pointerId);\n const state = this.state;\n const _pointerEvents = state._pointerEvents;\n const ctrlPointerIds = this.ctrl.pointerIds;\n\n if (state._active) {\n if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;\n }\n\n if (_pointerEvents.size < 2) {\n _pointerEvents.set(event.pointerId, event);\n }\n\n if (state._pointerEvents.size < 2) return;\n this.start(event);\n const payload = distanceAngle(...Array.from(_pointerEvents.values()));\n this.pinchStart(event, payload);\n }\n\n pinchStart(event, payload) {\n const state = this.state;\n state.origin = payload.origin;\n state.values = [payload.distance, payload.angle];\n state.initial = state.values;\n this.compute(event);\n this.emit();\n }\n\n touchMove(event) {\n if (!this.state._active) return;\n const payload = touchDistanceAngle(event, this.state._touchIds);\n this.pinchMove(event, payload);\n }\n\n pointerMove(event) {\n const _pointerEvents = this.state._pointerEvents;\n\n if (_pointerEvents.has(event.pointerId)) {\n _pointerEvents.set(event.pointerId, event);\n }\n\n if (!this.state._active) return;\n const payload = distanceAngle(...Array.from(_pointerEvents.values()));\n this.pinchMove(event, payload);\n }\n\n pinchMove(event, payload) {\n const state = this.state;\n const prev_a = state.values[1];\n const delta_a = payload.angle - prev_a;\n let delta_turns = 0;\n if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);\n state.values = [payload.distance, payload.angle - 360 * delta_turns];\n state.origin = payload.origin;\n state.turns = delta_turns;\n state._movement = [state.values[0] / state.initial[0] - 1, state.values[1] - state.initial[1]];\n this.compute(event);\n this.emit();\n }\n\n touchEnd(event) {\n this.ctrl.setEventIds(event);\n if (!this.state._active) return;\n\n if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {\n this.state._active = false;\n this.compute(event);\n this.emit();\n }\n }\n\n pointerEnd(event) {\n const state = this.state;\n this.ctrl.setEventIds(event);\n\n try {\n event.target.releasePointerCapture(event.pointerId);\n } catch (_unused) {}\n\n if (state._pointerEvents.has(event.pointerId)) {\n state._pointerEvents.delete(event.pointerId);\n }\n\n if (!state._active) return;\n\n if (state._pointerEvents.size < 2) {\n state._active = false;\n this.compute(event);\n this.emit();\n }\n }\n\n gestureStart(event) {\n if (event.cancelable) event.preventDefault();\n const state = this.state;\n if (state._active) return;\n this.start(event);\n state.values = [event.scale, event.rotation];\n state.origin = [event.clientX, event.clientY];\n this.compute(event);\n this.emit();\n }\n\n gestureMove(event) {\n if (event.cancelable) event.preventDefault();\n if (!this.state._active) return;\n const state = this.state;\n state.values = [event.scale, event.rotation];\n state.origin = [event.clientX, event.clientY];\n const _previousMovement = state._movement;\n state._movement = [event.scale - 1, event.rotation];\n state._delta = V.sub(state._movement, _previousMovement);\n this.compute(event);\n this.emit();\n }\n\n gestureEnd(event) {\n if (!this.state._active) return;\n this.state._active = false;\n this.compute(event);\n this.emit();\n }\n\n wheel(event) {\n if (!event.ctrlKey) return;\n if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);\n this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));\n }\n\n wheelStart(event) {\n this.start(event);\n this.wheelChange(event);\n }\n\n wheelChange(event) {\n const isR3f = ('uv' in event);\n\n if (!isR3f) {\n if (event.cancelable) {\n event.preventDefault();\n }\n\n if (process.env.NODE_ENV === 'development' && !event.defaultPrevented) {\n console.warn(`[@use-gesture]: To properly support zoom on trackpads, try using the \\`target\\` option.\\n\\nThis message will only appear in development mode.`);\n }\n }\n\n const state = this.state;\n state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO, 0];\n V.addTo(state._movement, state._delta);\n this.state.origin = [event.clientX, event.clientY];\n this.compute(event);\n this.emit();\n }\n\n wheelEnd() {\n if (!this.state._active) return;\n this.state._active = false;\n this.compute();\n this.emit();\n }\n\n bind(bindFunction) {\n const device = this.config.device;\n\n if (!!device) {\n bindFunction(device, 'start', this[device + 'Start'].bind(this));\n bindFunction(device, 'change', this[device + 'Move'].bind(this));\n bindFunction(device, 'end', this[device + 'End'].bind(this));\n bindFunction(device, 'cancel', this[device + 'End'].bind(this));\n } else {\n bindFunction('wheel', '', this.wheel.bind(this), {\n passive: false\n });\n }\n }\n\n}\n\nconst pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {\n useTouch(_v, _k, {\n pointer: {\n touch = false\n } = {}\n }) {\n return SUPPORT.touch && touch;\n },\n\n device(_v, _k, config) {\n const sharedConfig = config.shared;\n if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';\n if (this.useTouch) return 'touch';\n\n if (SUPPORT.touchscreen) {\n if (SUPPORT.pointer) return 'pointer';\n if (SUPPORT.touch) return 'touch';\n }\n },\n\n bounds(_v, _k, {\n scaleBounds = {},\n angleBounds = {}\n }) {\n const _scaleBounds = state => {\n const D = assignDefault(call(scaleBounds, state), {\n min: -Infinity,\n max: Infinity\n });\n return [D.min, D.max];\n };\n\n const _angleBounds = state => {\n const A = assignDefault(call(angleBounds, state), {\n min: -Infinity,\n max: Infinity\n });\n return [A.min, A.max];\n };\n\n if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];\n return state => [_scaleBounds(state), _angleBounds(state)];\n },\n\n threshold(value, _k, config) {\n this.lockDirection = config.axis === 'lock';\n const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);\n return threshold;\n }\n\n});\n\nclass MoveEngine extends CoordinatesEngine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'moving');\n }\n\n move(event) {\n if (this.config.mouseOnly && event.pointerType !== 'mouse') return;\n if (!this.state._active) this.moveStart(event);else this.moveChange(event);\n this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));\n }\n\n moveStart(event) {\n this.start(event);\n const state = this.state;\n state.values = pointerValues(event);\n this.compute(event);\n state.initial = state.values;\n this.emit();\n }\n\n moveChange(event) {\n if (!this.state._active) return;\n const values = pointerValues(event);\n const state = this.state;\n state._delta = V.sub(values, state.values);\n V.addTo(state._movement, state._delta);\n state.values = values;\n this.compute(event);\n this.emit();\n }\n\n moveEnd(event) {\n if (!this.state._active) return;\n this.state._active = false;\n this.compute(event);\n this.emit();\n }\n\n bind(bindFunction) {\n bindFunction('pointer', 'change', this.move.bind(this));\n bindFunction('pointer', 'leave', this.moveEnd.bind(this));\n }\n\n}\n\nconst moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {\n mouseOnly: (value = true) => value\n});\n\nclass ScrollEngine extends CoordinatesEngine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'scrolling');\n }\n\n scroll(event) {\n if (!this.state._active) this.start(event);\n this.scrollChange(event);\n this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));\n }\n\n scrollChange(event) {\n if (event.cancelable) event.preventDefault();\n const state = this.state;\n const values = scrollValues(event);\n state._delta = V.sub(values, state.values);\n V.addTo(state._movement, state._delta);\n state.values = values;\n this.compute(event);\n this.emit();\n }\n\n scrollEnd() {\n if (!this.state._active) return;\n this.state._active = false;\n this.compute();\n this.emit();\n }\n\n bind(bindFunction) {\n bindFunction('scroll', '', this.scroll.bind(this));\n }\n\n}\n\nconst scrollConfigResolver = coordinatesConfigResolver;\n\nclass WheelEngine extends CoordinatesEngine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'wheeling');\n }\n\n wheel(event) {\n if (!this.state._active) this.start(event);\n this.wheelChange(event);\n this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));\n }\n\n wheelChange(event) {\n const state = this.state;\n state._delta = wheelValues(event);\n V.addTo(this.state._movement, state._delta);\n this.compute(event);\n this.emit();\n }\n\n wheelEnd() {\n if (!this.state._active) return;\n this.state._active = false;\n this.compute();\n this.emit();\n }\n\n bind(bindFunction) {\n bindFunction('wheel', '', this.wheel.bind(this));\n }\n\n}\n\nconst wheelConfigResolver = coordinatesConfigResolver;\n\nclass HoverEngine extends CoordinatesEngine {\n constructor(...args) {\n super(...args);\n\n _defineProperty(this, \"ingKey\", 'hovering');\n }\n\n enter(event) {\n if (this.config.mouseOnly && event.pointerType !== 'mouse') return;\n this.start(event);\n this.state.values = pointerValues(event);\n this.compute(event);\n this.emit();\n }\n\n leave(event) {\n if (this.config.mouseOnly && event.pointerType !== 'mouse') return;\n const state = this.state;\n if (!state._active) return;\n state._active = false;\n const values = pointerValues(event);\n state._movement = state._delta = V.sub(values, state.values);\n state.values = values;\n this.compute(event);\n state.delta = state.movement;\n this.emit();\n }\n\n bind(bindFunction) {\n bindFunction('pointer', 'enter', this.enter.bind(this));\n bindFunction('pointer', 'leave', this.leave.bind(this));\n }\n\n}\n\nconst hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {\n mouseOnly: (value = true) => value\n});\n\nconst EngineMap = new Map();\nconst ConfigResolverMap = new Map();\nfunction registerAction(action) {\n EngineMap.set(action.key, action.engine);\n ConfigResolverMap.set(action.key, action.resolver);\n}\nconst dragAction = {\n key: 'drag',\n engine: DragEngine,\n resolver: dragConfigResolver\n};\nconst hoverAction = {\n key: 'hover',\n engine: HoverEngine,\n resolver: hoverConfigResolver\n};\nconst moveAction = {\n key: 'move',\n engine: MoveEngine,\n resolver: moveConfigResolver\n};\nconst pinchAction = {\n key: 'pinch',\n engine: PinchEngine,\n resolver: pinchConfigResolver\n};\nconst scrollAction = {\n key: 'scroll',\n engine: ScrollEngine,\n resolver: scrollConfigResolver\n};\nconst wheelAction = {\n key: 'wheel',\n engine: WheelEngine,\n resolver: wheelConfigResolver\n};\n\nexport { ConfigResolverMap as C, EngineMap as E, SUPPORT as S, _objectSpread2 as _, _defineProperty as a, touchIds as b, chain as c, toHandlerProp as d, dragAction as e, hoverAction as h, isTouch as i, moveAction as m, pinchAction as p, registerAction as r, scrollAction as s, toDomEventType as t, wheelAction as w };\n","import { S as SUPPORT, C as ConfigResolverMap, _ as _objectSpread2, a as _defineProperty, t as toDomEventType, i as isTouch, b as touchIds, E as EngineMap, c as chain, d as toHandlerProp } from './actions-0efe52f5.esm.js';\nimport './maths-b2a210f4.esm.js';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nconst identity = v => v;\nconst sharedConfigResolver = {\n target(value) {\n if (value) {\n return () => 'current' in value ? value.current : value;\n }\n\n return undefined;\n },\n\n enabled(value = true) {\n return value;\n },\n\n window(value = SUPPORT.isBrowser ? window : undefined) {\n return value;\n },\n\n eventOptions({\n passive = true,\n capture = false\n } = {}) {\n return {\n passive,\n capture\n };\n },\n\n transform(value = identity) {\n return value;\n }\n\n};\n\nconst _excluded = [\"target\", \"eventOptions\", \"window\", \"enabled\", \"transform\"];\nfunction resolveWith(config = {}, resolvers) {\n const result = {};\n\n for (const [key, resolver] of Object.entries(resolvers)) switch (typeof resolver) {\n case 'function':\n result[key] = resolver.call(result, config[key], key, config);\n break;\n\n case 'object':\n result[key] = resolveWith(config[key], resolver);\n break;\n\n case 'boolean':\n if (resolver) result[key] = config[key];\n break;\n }\n\n return result;\n}\nfunction parse(config, gestureKey) {\n const _ref = config,\n {\n target,\n eventOptions,\n window,\n enabled,\n transform\n } = _ref,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n const _config = {\n shared: resolveWith({\n target,\n eventOptions,\n window,\n enabled\n }, sharedConfigResolver)\n };\n\n if (gestureKey) {\n const resolver = ConfigResolverMap.get(gestureKey);\n _config[gestureKey] = resolveWith(_objectSpread2({\n shared: _config.shared\n }, rest), resolver);\n } else {\n for (const key in rest) {\n const resolver = ConfigResolverMap.get(key);\n\n if (resolver) {\n _config[key] = resolveWith(_objectSpread2({\n shared: _config.shared\n }, rest[key]), resolver);\n } else if (process.env.NODE_ENV === 'development') {\n if (!['drag', 'pinch', 'scroll', 'wheel', 'move', 'hover'].includes(key)) {\n if (key === 'domTarget') {\n throw Error(`[@use-gesture]: \\`domTarget\\` option has been renamed to \\`target\\`.`);\n }\n\n console.warn(`[@use-gesture]: Unknown config key \\`${key}\\` was used. Please read the documentation for further information.`);\n }\n }\n }\n }\n\n return _config;\n}\n\nclass EventStore {\n constructor(ctrl) {\n _defineProperty(this, \"_listeners\", []);\n\n this._ctrl = ctrl;\n }\n\n add(element, device, action, handler, options) {\n const type = toDomEventType(device, action);\n\n const eventOptions = _objectSpread2(_objectSpread2({}, this._ctrl.config.shared.eventOptions), options);\n\n element.addEventListener(type, handler, eventOptions);\n\n this._listeners.push(() => element.removeEventListener(type, handler, eventOptions));\n }\n\n clean() {\n this._listeners.forEach(remove => remove());\n\n this._listeners = [];\n }\n\n}\n\nclass TimeoutStore {\n constructor() {\n _defineProperty(this, \"_timeouts\", new Map());\n }\n\n add(key, callback, ms = 140, ...args) {\n this.remove(key);\n\n this._timeouts.set(key, window.setTimeout(callback, ms, ...args));\n }\n\n remove(key) {\n const timeout = this._timeouts.get(key);\n\n if (timeout) window.clearTimeout(timeout);\n }\n\n clean() {\n this._timeouts.forEach(timeout => void window.clearTimeout(timeout));\n\n this._timeouts.clear();\n }\n\n}\n\nclass Controller {\n constructor(handlers) {\n _defineProperty(this, \"gestures\", new Set());\n\n _defineProperty(this, \"_targetEventStore\", new EventStore(this));\n\n _defineProperty(this, \"gestureEventStores\", {});\n\n _defineProperty(this, \"gestureTimeoutStores\", {});\n\n _defineProperty(this, \"handlers\", {});\n\n _defineProperty(this, \"config\", {});\n\n _defineProperty(this, \"pointerIds\", new Set());\n\n _defineProperty(this, \"touchIds\", new Set());\n\n _defineProperty(this, \"state\", {\n shared: {\n shiftKey: false,\n metaKey: false,\n ctrlKey: false,\n altKey: false\n }\n });\n\n resolveGestures(this, handlers);\n }\n\n setEventIds(event) {\n if (isTouch(event)) {\n this.touchIds = new Set(touchIds(event));\n } else if ('pointerId' in event) {\n if (event.type === 'pointerup') this.pointerIds.delete(event.pointerId);else this.pointerIds.add(event.pointerId);\n }\n }\n\n applyHandlers(handlers, nativeHandlers) {\n this.handlers = handlers;\n this.nativeHandlers = nativeHandlers;\n }\n\n applyConfig(config, gestureKey) {\n this.config = parse(config, gestureKey);\n }\n\n clean() {\n this._targetEventStore.clean();\n\n for (const key of this.gestures) {\n this.gestureEventStores[key].clean();\n this.gestureTimeoutStores[key].clean();\n }\n }\n\n effect() {\n if (this.config.shared.target) this.bind();\n return () => this._targetEventStore.clean();\n }\n\n bind(...args) {\n const sharedConfig = this.config.shared;\n const eventOptions = sharedConfig.eventOptions;\n const props = {};\n let target;\n\n if (sharedConfig.target) {\n target = sharedConfig.target();\n if (!target) return;\n }\n\n const bindFunction = bindToProps(props, eventOptions, !!target);\n\n if (sharedConfig.enabled) {\n for (const gestureKey of this.gestures) {\n if (this.config[gestureKey].enabled) {\n const Engine = EngineMap.get(gestureKey);\n new Engine(this, args, gestureKey).bind(bindFunction);\n }\n }\n\n for (const eventKey in this.nativeHandlers) {\n bindFunction(eventKey, '', event => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {\n event,\n args\n })), undefined, true);\n }\n }\n\n for (const handlerProp in props) {\n props[handlerProp] = chain(...props[handlerProp]);\n }\n\n if (!target) return props;\n\n for (const handlerProp in props) {\n let eventKey = handlerProp.substr(2).toLowerCase();\n const capture = !!~eventKey.indexOf('capture');\n const passive = !!~eventKey.indexOf('passive');\n if (capture || passive) eventKey = eventKey.replace(/capture|passive/g, '');\n\n this._targetEventStore.add(target, eventKey, '', props[handlerProp], {\n capture,\n passive\n });\n }\n }\n\n}\n\nfunction setupGesture(ctrl, gestureKey) {\n ctrl.gestures.add(gestureKey);\n ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl);\n ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore();\n}\n\nfunction resolveGestures(ctrl, internalHandlers) {\n if (internalHandlers.drag) setupGesture(ctrl, 'drag');\n if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');\n if (internalHandlers.scroll) setupGesture(ctrl, 'scroll');\n if (internalHandlers.move) setupGesture(ctrl, 'move');\n if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');\n if (internalHandlers.hover) setupGesture(ctrl, 'hover');\n}\n\nconst bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {\n var _options$capture, _options$passive;\n\n const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;\n const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;\n let handlerProp = isNative ? device : toHandlerProp(device, action, capture);\n if (withPassiveOption && passive) handlerProp += 'Passive';\n props[handlerProp] = props[handlerProp] || [];\n props[handlerProp].push(handler);\n};\n\nconst RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;\n\nfunction sortHandlers(_handlers) {\n const native = {};\n const handlers = {};\n const actions = new Set();\n\n for (let key in _handlers) {\n if (RE_NOT_NATIVE.test(key)) {\n actions.add(RegExp.lastMatch);\n handlers[key] = _handlers[key];\n } else {\n native[key] = _handlers[key];\n }\n }\n\n return [handlers, native, actions];\n}\n\nfunction registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) {\n if (!actions.has(handlerKey)) return;\n\n if (!EngineMap.has(key)) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`[@use-gesture]: You've created a custom handler that that uses the \\`${key}\\` gesture but isn't properly configured.\\n\\nPlease add \\`${key}Action\\` when creating your handler.`);\n }\n\n return;\n }\n\n const startKey = handlerKey + 'Start';\n const endKey = handlerKey + 'End';\n\n const fn = state => {\n let memo = undefined;\n if (state.first && startKey in handlers) handlers[startKey](state);\n if (handlerKey in handlers) memo = handlers[handlerKey](state);\n if (state.last && endKey in handlers) handlers[endKey](state);\n return memo;\n };\n\n internalHandlers[key] = fn;\n config[key] = config[key] || {};\n}\n\nfunction parseMergedHandlers(mergedHandlers, mergedConfig) {\n const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers);\n const internalHandlers = {};\n registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig);\n registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig);\n registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig);\n registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig);\n registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig);\n registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig);\n return {\n handlers: internalHandlers,\n config: mergedConfig,\n nativeHandlers\n };\n}\n\nexport { Controller, parseMergedHandlers };\n","import { registerAction, dragAction, pinchAction, wheelAction, scrollAction, moveAction, hoverAction } from '@use-gesture/core/actions';\nexport * from '@use-gesture/core/actions';\nimport { Controller, parseMergedHandlers } from '@use-gesture/core';\nexport * from '@use-gesture/core/utils';\nexport * from '@use-gesture/core/types';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nconst Recognizer = function Recognizer(target, handlers, config, gestureKey, nativeHandlers) {\n this._gestureKey = gestureKey;\n this._ctrl = new Controller(handlers);\n\n this._ctrl.applyHandlers(handlers, nativeHandlers);\n\n this._ctrl.applyConfig(_objectSpread2(_objectSpread2({}, config), {}, {\n target\n }), this._gestureKey);\n\n this._ctrl.effect();\n};\n\nRecognizer.prototype.destroy = function () {\n this._ctrl.clean();\n};\n\nconst DragGesture = function DragGesture(target, handler, config = {}) {\n registerAction(dragAction);\n return new Recognizer(target, {\n drag: handler\n }, config, 'drag');\n};\n\nconst PinchGesture = function PinchGesture(target, handler, config = {}) {\n registerAction(pinchAction);\n return new Recognizer(target, {\n pinch: handler\n }, config, 'pinch');\n};\n\nconst WheelGesture = function WheelGesture(target, handler, config = {}) {\n registerAction(wheelAction);\n return new Recognizer(target, {\n wheel: handler\n }, config, 'wheel');\n};\n\nconst ScrollGesture = function ScrollGesture(target, handler, config = {}) {\n registerAction(scrollAction);\n return new Recognizer(target, {\n scroll: handler\n }, config, 'scroll');\n};\n\nconst MoveGesture = function MoveGesture(target, handler, config = {}) {\n registerAction(moveAction);\n return new Recognizer(target, {\n move: handler\n }, config, 'move');\n};\n\nconst HoverGesture = function HoverGesture(target, handler, config = {}) {\n registerAction(hoverAction);\n return new Recognizer(target, {\n hover: handler\n }, config, 'hover');\n};\n\nfunction createGesture(actions) {\n actions.forEach(registerAction);\n return function (target, _handlers, _config = {}) {\n const {\n handlers,\n nativeHandlers,\n config\n } = parseMergedHandlers(_handlers, _config);\n return new Recognizer(target, handlers, config, undefined, nativeHandlers);\n };\n}\n\nconst Gesture = function Gesture(target, handlers, config = {}) {\n const gestureFunction = createGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);\n return gestureFunction(target, handlers, config);\n};\n\nexport { DragGesture, Gesture, HoverGesture, MoveGesture, PinchGesture, ScrollGesture, WheelGesture };\n","\n\n\n\n\n \n \n\n","\n\n\n","\n\n\n\n\n","\n\n\n\n\n","\n\n\n","\n\n\n\n\n \n \n \n\n\n\n"],"names":["SCALE_CONTEXT_KEY","getScaleContext","getContext","COORDINATE_CONTEXT_KEY","getCoordinateContext","MAP_CONTEXT_KEY","getMapContext","PANES_CONTEXT_KEY","getPanesContext","snappedRange","min","max","step","range","Math","floor","ceil","iter","toArray","ctx","insert","length","separation","labelMaker","scaleContext","panesContext","scaleX","$scaleContext","xPanes","$panesContext","xs","filter","x","abs","scaleY","yPanes","ys","y","id","xLines","yLines","xSubdivisions","ySubdivisions","context","$context","width","height","pixelXDistance","pixelYDistance","labels","lines","subdivisions","axis","incrementer","defaultAxisOptions","xAxis","Object","assign","yAxis","xAxisOptions","yAxisOptions","undefined","style","center","vec2","fromValues","radius","angle","strokeStyle","strokeOpacity","weight","color","fillOpacity","cssScale","rotate","PI","ellipseRadius","set","V","toVector","v","fallback","Array","isArray","add","v1","v2","sub","addTo","subTo","rubberband","distance","dimension","constant","Infinity","pow","rubberbandIfOutOfBounds","position","clamp","_defineProperty","obj","key","value","defineProperty","enumerable","configurable","writable","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","sym","getOwnPropertyDescriptor","push","apply","_objectSpread2","target","i","arguments","source","forEach","getOwnPropertyDescriptors","defineProperties","EVENT_TYPE_MAP","pointer","start","change","end","mouse","touch","gesture","capitalize","string","toUpperCase","slice","isTouch","event","getValueEvent","type","changedTouches","targetTouches","getTouchList","touchIds","from","touches","e","_event$currentTarget","_event$currentTarget$","currentTarget","contains","call","getCurrentTargetTouchList","map","identifier","pointerId","valueEvent","pointerValues","clientX","clientY","args","noop","chain","fns","result","fn","this","assignDefault","CoordinatesEngine","constructor","ctrl","state","values","initial","init","reset","shared","eventStore","gestureEventStores","timeoutStore","gestureTimeoutStores","config","sharedConfig","handler","handlers","ingKey","transform","threshold","_active","active","_blocked","_force","_step","intentional","_movement","_distance","_delta","_threshold","_bounds","memo","elapsedTime","direction","velocity","movement","delta","timeStamp","lastOffset","offset","startTime","compute","dt","pointerIds","size","locked","document","pointerLockElement","payload","buttons","shiftKey","altKey","metaKey","ctrlKey","getEventDetails","down","pressed","_absoluteDelta","_m0","_m1","_t0","_t1","_s0","_s1","sign","intent","first","last","bounds","setup","previousMovement","computeOffset","absoluteDelta","Vx","Vy","Rx","Ry","X0","X1","Y0","Y1","computeRubberband","computeMovement","emit","clean","triggerAllEvents","aliasKey","super","dx","dy","d","selectAxis","lockDirection","restrictVectorToAxis","commonConfigResolver","enabled","_k","coordinatesConfigResolver","_v","current","HTMLElement","left","right","top","bottom","KEYS_DELTA_MAP","ArrowRight","factor","ArrowLeft","ArrowUp","ArrowDown","isBrowser","window","createElement","supportsTouchEvents","SUPPORT","GestureEvent","supportsGestureEvents","touchscreen","navigator","maxTouchPoints","pointerLock","dragConfigResolver","lock","useTouch","device","preventScroll","preventScrollAxis","pointerCapture","capture","filterTaps","swipe","duration","delay","scaleBounds","angleBounds","_scaleBounds","D","_angleBounds","A","mouseOnly","wheelConfigResolver","EngineMap","Map","ConfigResolverMap","registerAction","action","engine","resolver","dragAction","_pointerId","_pointerActive","_keyboardActive","_preventScroll","_delayed","tap","canceled","cancel","bind","boundRect","getBoundingClientRect","targetRect","setTimeout","setActive","pointerClean","pointerDown","setEventIds","setPointerCapture","setupPointer","setupScrollPrevention","setupDelayTrigger","startPointerDrag","pointerMove","movementX","movementY","remove","pointerUp","hasPointerCapture","releasePointerCapture","_unused","dirx","diry","vx","vy","mx","my","svx","svy","sx","sy","sdt","pointerClick","preventDefault","stopPropagation","requestPointerLock","exitPointerLock","cancelable","persist","persistEvent","passive","keyDown","deltaFn","keyUp","bindFunction","wheelAction","wheel","wheelChange","wheelEnd","deltaX","deltaY","deltaMode","wheelValues","_objectWithoutProperties","excluded","sourceKeys","indexOf","_objectWithoutPropertiesLoose","sourceSymbolKeys","prototype","propertyIsEnumerable","identity","sharedConfigResolver","eventOptions","_excluded","resolveWith","resolvers","entries","EventStore","_ctrl","element","options","deviceProps","toDomEventType","addEventListener","_listeners","removeEventListener","TimeoutStore","callback","ms","_timeouts","timeout","get","clearTimeout","clear","Controller","Set","internalHandlers","drag","setupGesture","scroll","move","pinch","hover","resolveGestures","delete","applyHandlers","nativeHandlers","applyConfig","gestureKey","_ref","rest","_config","parse","_targetEventStore","gestures","effect","props","bindToProps","eventKey","handlerProp","substr","toLowerCase","replace","withPassiveOption","isNative","_options$capture","_options$passive","actionKey","toHandlerProp","Recognizer","_gestureKey","destroy","DragGesture","WheelGesture","append","VEC2_0","create","point","mat2d","constrain","intialPoint","constraintFunction","display","inverseTransform","startPoint","dragging","onMount","dragGesture","onDrag","_y","_x","inversePixelMatrix","invert","_a","transformMat2d","opacity","point1","point2","segment","scaledPoint1","scaledPoint2","pixelMatrix","scale","normalize","ZERO","RIGHT","slope","atan","pan","zoom","xAxisExtent","yAxisExtent","actualWidth","actualHeight","zoomAmount","span","xPaneRange","yPaneRange","setContext","coordinateContext","setCoordinateContext","setScaleContext","mapContext","mapX","mapY","setMapContext","wheelGesture","onMouseWheel","desiredCssWidth","desiredCssHeight","wheelDirection","detail","wheelDelta","getMouseWheelDirection","halfZoomAmount","halfNewZoomAmount","xSpan","unscaleX","ySpan","unscaleY","fromScaling","xStep","round","log10","xLowerBound","xUpperBound","xMin","yStep","yLowerBound","yUpperBound","yMin"],"mappings":"wjCAcA,MAAMA,EAAoB,YAUVC,IACd,OAAOC,EAAoCF,GAM7C,MAAMG,EAAyB,YAOfC,IACd,OAAOF,EAAyCC,GAMlD,MAAME,EAAkB,YAKRC,IACd,OAAOJ,EAAkCG,GAM3C,MAAME,EAAoB,YAOVC,IACd,OAAON,EAAoCK,YAM7BE,GAAaC,EAAaC,EAAaC,GACrD,OAAOC,EACLC,KAAKC,MAAML,EAAME,GAAQA,EACzBE,KAAKE,KAAKL,EAAMC,GAAQA,EACxBA,GAECK,OACAC,sPCvDEC,KAAaA,KAAWA,MAAKA,iDADvBA,KAAOA,iBAAO,2EAAvBC,qCACGD,KAAaA,KAAWA,MAAKA,8BADvBA,KAAOA,0DADXA,0BAALE,8HADJD,kFACSD,aAALE,+HAAAA,oFAjBJC,iBACAC,KAEAC,EAAAvB,6BACAwB,EAAAjB,8JAEAkB,EAAA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AE,EAAA,oCAKA7b,WAAA/C,EAAA,MAAAQ,EAAA,6BASAse,EAAA1f,KAAAiF,IAPA,EAOAjF,KAAA2f,MAAA3f,KAAA4f,MAAAP,GAAArf,KAAA4f,MAPA,gDAQAC,EAAA7f,KAAAC,MAAAL,EAAA,GAAA8f,GAAAA,6CACAI,EAAA9f,KAAAE,KAAAL,EAAA,GAAA6f,GAAAA,yBACA5e,EAAAf,EAAA8f,EAAAC,EAAAJ,GACAvf,OACAyI,KAAAmX,GAAA7c,EAAAC,WAAA4c,EAAAA,EAAAL,KACAtf,uDACA6d,EAAA/a,EAAAa,IAAAka,EAAA4B,EAAAC,mCAGAE,EAAAhgB,KAAAiF,IAjBA,EAiBAjF,KAAA2f,MAAA3f,KAAA4f,MAAAL,GAAAvf,KAAA4f,MAjBA,oCAkBAK,EAAAjgB,KAAAC,MAAAL,EAAA,GAAAogB,GAAAA,iCACAE,EAAAlgB,KAAAE,KAAAL,EAAA,GAAAmgB,GAAAA,iCACA3e,EAAAtB,EAAAkgB,EAAAC,EAAAF,GACA7f,OACAyI,KAAAuX,GAAAjd,EAAAC,WAAAgd,EAAAA,EAAAH,KACA5f,yCACA8d,EAAAhb,EAAAa,IAAAma,EAAA+B,EAAAC,4BAUAvf,GAAAoD,KACAjD,OAAAA,EACAO,OAAAA,EACA4c,WAAAA,EACAC,WAAAA,yBAUAE,GAAAra,KACAnE,IAAAA,EACAC,IAAAA,EACAkC,MAAA8b,EACA7b,OAAA8b,6BAaApd,GAAAqD,KACAga,WAAAA,EACAnd,OAAAA,EACAQ,OAAAA,EACA4c,KAAAA,EACAd,YAAAA,EACAV,mBAAAA,EACA7Y,SAAAA,sBAQA4a,GAAAxa,KACAya,KAAAA,EACAC,KAAAA,6HA2DazG,4BACO6F,mBACCC"} \ No newline at end of file diff --git a/esm/CartesianCoordinates.svelte.js b/esm/CartesianCoordinates.svelte.js new file mode 100644 index 0000000..43dcf65 --- /dev/null +++ b/esm/CartesianCoordinates.svelte.js @@ -0,0 +1,382 @@ +import { SvelteComponent, init, safe_not_equal, flush, append_styles, create_component, mount_component, transition_in, transition_out, destroy_component, svg_element, attr, insert, detach, space, empty, group_outros, check_outros } from 'svelte/internal'; +import XLabels from './XLabels.svelte.js'; +import YLabels from './YLabels.svelte.js'; +import GridPattern from './GridPattern.svelte.js'; + +/* src/CartesianCoordinates.svelte generated by Svelte v3.42.4 */ + +function add_css(target) { + append_styles(target, "svelte-xqsvde", "line.svelte-xqsvde{stroke:var(--visual-math-origin-color)}"); +} + +// (38:0) {#if xAxis.labels} +function create_if_block_3(ctx) { + let xlabels; + let current; + + xlabels = new XLabels({ + props: { + labelMaker: /*xAxisOptions*/ ctx[3].labels, + separation: /*xAxisOptions*/ ctx[3].lines || 1 + } + }); + + return { + c() { + create_component(xlabels.$$.fragment); + }, + m(target, anchor) { + mount_component(xlabels, target, anchor); + current = true; + }, + p(ctx, dirty) { + const xlabels_changes = {}; + if (dirty & /*xAxisOptions*/ 8) xlabels_changes.labelMaker = /*xAxisOptions*/ ctx[3].labels; + if (dirty & /*xAxisOptions*/ 8) xlabels_changes.separation = /*xAxisOptions*/ ctx[3].lines || 1; + xlabels.$set(xlabels_changes); + }, + i(local) { + if (current) return; + transition_in(xlabels.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(xlabels.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(xlabels, detaching); + } + }; +} + +// (44:0) {#if yAxis.labels} +function create_if_block_2(ctx) { + let ylabels; + let current; + + ylabels = new YLabels({ + props: { + labelMaker: /*yAxisOptions*/ ctx[2].labels, + separation: /*yAxisOptions*/ ctx[2].lines || 1 + } + }); + + return { + c() { + create_component(ylabels.$$.fragment); + }, + m(target, anchor) { + mount_component(ylabels, target, anchor); + current = true; + }, + p(ctx, dirty) { + const ylabels_changes = {}; + if (dirty & /*yAxisOptions*/ 4) ylabels_changes.labelMaker = /*yAxisOptions*/ ctx[2].labels; + if (dirty & /*yAxisOptions*/ 4) ylabels_changes.separation = /*yAxisOptions*/ ctx[2].lines || 1; + ylabels.$set(ylabels_changes); + }, + i(local) { + if (current) return; + transition_in(ylabels.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(ylabels.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(ylabels, detaching); + } + }; +} + +// (51:0) {#if xAxisOptions.axis} +function create_if_block_1(ctx) { + let line; + let line_x__value; + let line_x__value_1; + let line_y__value; + let line_y__value_1; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = -10000000); + attr(line, "x2", line_x__value_1 = 10000000); + attr(line, "y1", line_y__value = 0); + attr(line, "y2", line_y__value_1 = 0); + attr(line, "class", "transform-y-to-center svelte-xqsvde"); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (61:0) {#if yAxisOptions.axis} +function create_if_block(ctx) { + let line; + let line_x__value; + let line_x__value_1; + let line_y__value; + let line_y__value_1; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = 0); + attr(line, "x2", line_x__value_1 = 0); + attr(line, "y1", line_y__value = -10000000); + attr(line, "y2", line_y__value_1 = 10000000); + attr(line, "class", "transform-x-to-center svelte-xqsvde"); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +function create_fragment(ctx) { + let defs; + let gridpattern; + let t0; + let rect; + let t1; + let t2; + let t3; + let t4; + let if_block3_anchor; + let current; + + gridpattern = new GridPattern({ + props: { + id: /*id*/ ctx[4], + xLines: /*xAxisOptions*/ ctx[3].lines, + yLines: /*yAxisOptions*/ ctx[2].lines, + xSubdivisions: /*xAxisOptions*/ ctx[3].subdivisions, + ySubdivisions: /*yAxisOptions*/ ctx[2].subdivisions + } + }); + + let if_block0 = /*xAxis*/ ctx[0].labels && create_if_block_3(ctx); + let if_block1 = /*yAxis*/ ctx[1].labels && create_if_block_2(ctx); + let if_block2 = /*xAxisOptions*/ ctx[3].axis && create_if_block_1(); + let if_block3 = /*yAxisOptions*/ ctx[2].axis && create_if_block(); + + return { + c() { + defs = svg_element("defs"); + create_component(gridpattern.$$.fragment); + t0 = space(); + rect = svg_element("rect"); + t1 = space(); + if (if_block0) if_block0.c(); + t2 = space(); + if (if_block1) if_block1.c(); + t3 = space(); + if (if_block2) if_block2.c(); + t4 = space(); + if (if_block3) if_block3.c(); + if_block3_anchor = empty(); + attr(rect, "fill", `url(#${/*id*/ ctx[4]})`); + attr(rect, "x", -10000000); + attr(rect, "y", -10000000); + attr(rect, "width", 20000000); + attr(rect, "height", 20000000); + }, + m(target, anchor) { + insert(target, defs, anchor); + mount_component(gridpattern, defs, null); + insert(target, t0, anchor); + insert(target, rect, anchor); + insert(target, t1, anchor); + if (if_block0) if_block0.m(target, anchor); + insert(target, t2, anchor); + if (if_block1) if_block1.m(target, anchor); + insert(target, t3, anchor); + if (if_block2) if_block2.m(target, anchor); + insert(target, t4, anchor); + if (if_block3) if_block3.m(target, anchor); + insert(target, if_block3_anchor, anchor); + current = true; + }, + p(ctx, [dirty]) { + const gridpattern_changes = {}; + if (dirty & /*xAxisOptions*/ 8) gridpattern_changes.xLines = /*xAxisOptions*/ ctx[3].lines; + if (dirty & /*yAxisOptions*/ 4) gridpattern_changes.yLines = /*yAxisOptions*/ ctx[2].lines; + if (dirty & /*xAxisOptions*/ 8) gridpattern_changes.xSubdivisions = /*xAxisOptions*/ ctx[3].subdivisions; + if (dirty & /*yAxisOptions*/ 4) gridpattern_changes.ySubdivisions = /*yAxisOptions*/ ctx[2].subdivisions; + gridpattern.$set(gridpattern_changes); + + if (/*xAxis*/ ctx[0].labels) { + if (if_block0) { + if_block0.p(ctx, dirty); + + if (dirty & /*xAxis*/ 1) { + transition_in(if_block0, 1); + } + } else { + if_block0 = create_if_block_3(ctx); + if_block0.c(); + transition_in(if_block0, 1); + if_block0.m(t2.parentNode, t2); + } + } else if (if_block0) { + group_outros(); + + transition_out(if_block0, 1, 1, () => { + if_block0 = null; + }); + + check_outros(); + } + + if (/*yAxis*/ ctx[1].labels) { + if (if_block1) { + if_block1.p(ctx, dirty); + + if (dirty & /*yAxis*/ 2) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block_2(ctx); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(t3.parentNode, t3); + } + } else if (if_block1) { + group_outros(); + + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + + check_outros(); + } + + if (/*xAxisOptions*/ ctx[3].axis) { + if (if_block2) ; else { + if_block2 = create_if_block_1(); + if_block2.c(); + if_block2.m(t4.parentNode, t4); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + + if (/*yAxisOptions*/ ctx[2].axis) { + if (if_block3) ; else { + if_block3 = create_if_block(); + if_block3.c(); + if_block3.m(if_block3_anchor.parentNode, if_block3_anchor); + } + } else if (if_block3) { + if_block3.d(1); + if_block3 = null; + } + }, + i(local) { + if (current) return; + transition_in(gridpattern.$$.fragment, local); + transition_in(if_block0); + transition_in(if_block1); + current = true; + }, + o(local) { + transition_out(gridpattern.$$.fragment, local); + transition_out(if_block0); + transition_out(if_block1); + current = false; + }, + d(detaching) { + if (detaching) detach(defs); + destroy_component(gridpattern); + if (detaching) detach(t0); + if (detaching) detach(rect); + if (detaching) detach(t1); + if (if_block0) if_block0.d(detaching); + if (detaching) detach(t2); + if (if_block1) if_block1.d(detaching); + if (detaching) detach(t3); + if (if_block2) if_block2.d(detaching); + if (detaching) detach(t4); + if (if_block3) if_block3.d(detaching); + if (detaching) detach(if_block3_anchor); + } + }; +} + +let incrementer = 0; +const defaultAxisOptions = { axis: true, lines: 1, labels: x => x }; + +function instance($$self, $$props, $$invalidate) { + let xAxisOptions; + let yAxisOptions; + let { subdivisions = false } = $$props; + let { xAxis = Object.assign({ subdivisions }, defaultAxisOptions) } = $$props; + let { yAxis = Object.assign({ subdivisions }, defaultAxisOptions) } = $$props; + const id = `visual-math-grid-${incrementer++}`; + + $$self.$$set = $$props => { + if ('subdivisions' in $$props) $$invalidate(5, subdivisions = $$props.subdivisions); + if ('xAxis' in $$props) $$invalidate(0, xAxis = $$props.xAxis); + if ('yAxis' in $$props) $$invalidate(1, yAxis = $$props.yAxis); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*subdivisions, xAxis*/ 33) { + $$invalidate(3, xAxisOptions = Object.assign(Object.assign({ subdivisions }, defaultAxisOptions), xAxis)); + } + + if ($$self.$$.dirty & /*subdivisions, yAxis*/ 34) { + $$invalidate(2, yAxisOptions = Object.assign(Object.assign({ subdivisions }, defaultAxisOptions), yAxis)); + } + }; + + return [xAxis, yAxis, yAxisOptions, xAxisOptions, id, subdivisions]; +} + +class CartesianCoordinates extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { subdivisions: 5, xAxis: 0, yAxis: 1 }, add_css); + } + + get subdivisions() { + return this.$$.ctx[5]; + } + + set subdivisions(subdivisions) { + this.$$set({ subdivisions }); + flush(); + } + + get xAxis() { + return this.$$.ctx[0]; + } + + set xAxis(xAxis) { + this.$$set({ xAxis }); + flush(); + } + + get yAxis() { + return this.$$.ctx[1]; + } + + set yAxis(yAxis) { + this.$$set({ yAxis }); + flush(); + } +} + +export { CartesianCoordinates as default }; +//# sourceMappingURL=CartesianCoordinates.svelte.js.map diff --git a/esm/CartesianCoordinates.svelte.js.map b/esm/CartesianCoordinates.svelte.js.map new file mode 100644 index 0000000..5974664 --- /dev/null +++ b/esm/CartesianCoordinates.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CartesianCoordinates.svelte.js","sources":["../src/CartesianCoordinates.svelte"],"sourcesContent":["\n\n\n\n\n \n\n\n\n\n{#if xAxis.labels}\n \n{/if}\n{#if yAxis.labels}\n \n{/if}\n\n{#if xAxisOptions.axis}\n \n{/if}\n\n{#if yAxisOptions.axis}\n \n{/if}\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;iCA4DgB,GAAY,IAAC,MAAM;iCACnB,GAAY,IAAC,KAAK,IAA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AAA,EAAA,CAAA,IAAA,CAAA;;;;;OAUA,YAAA,GAAA,KAAA;OACA,KAAA,GAAA,MAAA,CAAA,MAAA,GAAA,YAAA,IAAA,kBAAA;OAIA,KAAA,GAAA,MAAA,CAAA,MAAA,GAAA,YAAA,IAAA,kBAAA;OAgBA,EAAA,uBAAA,WAAA;;;;;;;;;;mBAXA,YAAA,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,GAAA,YAAA,IAAA,kBAAA,GAAA,KAAA;;;;mBAKA,YAAA,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,GAAA,YAAA,IAAA,kBAAA,GAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/Circle.svelte.js b/esm/Circle.svelte.js new file mode 100644 index 0000000..fed40fb --- /dev/null +++ b/esm/Circle.svelte.js @@ -0,0 +1,210 @@ +import { SvelteComponent, init, safe_not_equal, flush, assign, create_component, mount_component, get_spread_update, get_spread_object, transition_in, transition_out, destroy_component, compute_rest_props, exclude_internal_props } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import Ellipse from './Ellipse.svelte.js'; + +/* src/Circle.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let ellipse; + let current; + + const ellipse_spread_levels = [ + { center: /*center*/ ctx[0] }, + { radius: /*ellipseRadius*/ ctx[7] }, + { angle: /*angle*/ ctx[1] }, + { strokeStyle: /*strokeStyle*/ ctx[2] }, + { strokeOpacity: /*strokeOpacity*/ ctx[3] }, + { weight: /*weight*/ ctx[4] }, + { color: /*color*/ ctx[5] }, + { fillOpacity: /*fillOpacity*/ ctx[6] }, + /*$$restProps*/ ctx[8] + ]; + + let ellipse_props = {}; + + for (let i = 0; i < ellipse_spread_levels.length; i += 1) { + ellipse_props = assign(ellipse_props, ellipse_spread_levels[i]); + } + + ellipse = new Ellipse({ props: ellipse_props }); + + return { + c() { + create_component(ellipse.$$.fragment); + }, + m(target, anchor) { + mount_component(ellipse, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const ellipse_changes = (dirty & /*center, ellipseRadius, angle, strokeStyle, strokeOpacity, weight, color, fillOpacity, $$restProps*/ 511) + ? get_spread_update(ellipse_spread_levels, [ + dirty & /*center*/ 1 && { center: /*center*/ ctx[0] }, + dirty & /*ellipseRadius*/ 128 && { radius: /*ellipseRadius*/ ctx[7] }, + dirty & /*angle*/ 2 && { angle: /*angle*/ ctx[1] }, + dirty & /*strokeStyle*/ 4 && { strokeStyle: /*strokeStyle*/ ctx[2] }, + dirty & /*strokeOpacity*/ 8 && { strokeOpacity: /*strokeOpacity*/ ctx[3] }, + dirty & /*weight*/ 16 && { weight: /*weight*/ ctx[4] }, + dirty & /*color*/ 32 && { color: /*color*/ ctx[5] }, + dirty & /*fillOpacity*/ 64 && { fillOpacity: /*fillOpacity*/ ctx[6] }, + dirty & /*$$restProps*/ 256 && get_spread_object(/*$$restProps*/ ctx[8]) + ]) + : {}; + + ellipse.$set(ellipse_changes); + }, + i(local) { + if (current) return; + transition_in(ellipse.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(ellipse.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(ellipse, detaching); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + const omit_props_names = [ + "center","radius","angle","strokeStyle","strokeOpacity","weight","color","fillOpacity" + ]; + + let $$restProps = compute_rest_props($$props, omit_props_names); + let { center = vec2.fromValues(0, 0) } = $$props; + let { radius = 1 } = $$props; + let { angle = 0 } = $$props; + let { strokeStyle = "solid" } = $$props; + let { strokeOpacity = 1.0 } = $$props; + let { weight = 2 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { fillOpacity = 0.15 } = $$props; + let ellipseRadius = vec2.fromValues(radius, radius); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(8, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('center' in $$new_props) $$invalidate(0, center = $$new_props.center); + if ('radius' in $$new_props) $$invalidate(9, radius = $$new_props.radius); + if ('angle' in $$new_props) $$invalidate(1, angle = $$new_props.angle); + if ('strokeStyle' in $$new_props) $$invalidate(2, strokeStyle = $$new_props.strokeStyle); + if ('strokeOpacity' in $$new_props) $$invalidate(3, strokeOpacity = $$new_props.strokeOpacity); + if ('weight' in $$new_props) $$invalidate(4, weight = $$new_props.weight); + if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color); + if ('fillOpacity' in $$new_props) $$invalidate(6, fillOpacity = $$new_props.fillOpacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*ellipseRadius, radius*/ 640) { + $$invalidate(7, ellipseRadius = vec2.set(ellipseRadius, radius, radius)); + } + }; + + return [ + center, + angle, + strokeStyle, + strokeOpacity, + weight, + color, + fillOpacity, + ellipseRadius, + $$restProps, + radius + ]; +} + +class Circle extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + center: 0, + radius: 9, + angle: 1, + strokeStyle: 2, + strokeOpacity: 3, + weight: 4, + color: 5, + fillOpacity: 6 + }); + } + + get center() { + return this.$$.ctx[0]; + } + + set center(center) { + this.$$set({ center }); + flush(); + } + + get radius() { + return this.$$.ctx[9]; + } + + set radius(radius) { + this.$$set({ radius }); + flush(); + } + + get angle() { + return this.$$.ctx[1]; + } + + set angle(angle) { + this.$$set({ angle }); + flush(); + } + + get strokeStyle() { + return this.$$.ctx[2]; + } + + set strokeStyle(strokeStyle) { + this.$$set({ strokeStyle }); + flush(); + } + + get strokeOpacity() { + return this.$$.ctx[3]; + } + + set strokeOpacity(strokeOpacity) { + this.$$set({ strokeOpacity }); + flush(); + } + + get weight() { + return this.$$.ctx[4]; + } + + set weight(weight) { + this.$$set({ weight }); + flush(); + } + + get color() { + return this.$$.ctx[5]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get fillOpacity() { + return this.$$.ctx[6]; + } + + set fillOpacity(fillOpacity) { + this.$$set({ fillOpacity }); + flush(); + } +} + +export { Circle as default }; +//# sourceMappingURL=Circle.svelte.js.map diff --git a/esm/Circle.svelte.js.map b/esm/Circle.svelte.js.map new file mode 100644 index 0000000..32b105e --- /dev/null +++ b/esm/Circle.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Circle.svelte.js","sources":["../src/Circle.svelte"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;8BAmBU,GAAa;;;;;;;kBAOjB,GAAW;;;;;;;;;;;;;;;;;;;;;;;kEAPP,GAAa;;;;;;;sEAOjB,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;OAtBjB,MAAA,GAAA,IAAA,CAAA,UAAA,CAAA,CAAA,EAAA,CAAA;OACA,MAAA,GAAA,CAAA;OACA,KAAA,GAAA,CAAA;OACA,WAAA,GAAA,OAAA;OACA,aAAA,GAAA,GAAA;OACA,MAAA,GAAA,CAAA;OACA,KAAA,GAAA,uBAAA;OACA,WAAA,GAAA,IAAA;KAEA,aAAA,GAAA,IAAA,CAAA,UAAA,CAAA,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;mBACA,aAAA,GAAA,IAAA,CAAA,GAAA,CAAA,aAAA,EAAA,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/Ellipse.svelte.js b/esm/Ellipse.svelte.js new file mode 100644 index 0000000..5d2448e --- /dev/null +++ b/esm/Ellipse.svelte.js @@ -0,0 +1,258 @@ +import { SvelteComponent, init, safe_not_equal, flush, append_styles, assign, svg_element, set_svg_attributes, toggle_class, insert, get_spread_update, noop, detach, compute_rest_props, component_subscribe, exclude_internal_props } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import { getScaleContext } from './math.js'; + +/* src/Ellipse.svelte generated by Svelte v3.42.4 */ + +function add_css(target) { + append_styles(target, "svelte-cc8k9r", "ellipse.svelte-cc8k9r{vector-effect:non-scaling-stroke}"); +} + +function create_fragment(ctx) { + let ellipse; + let ellipse_cx_value; + let ellipse_cy_value; + let ellipse_rx_value; + let ellipse_ry_value; + let ellipse_stroke_dasharray_value; + let ellipse_transform_value; + let ellipse_style_value; + + let ellipse_levels = [ + { + cx: ellipse_cx_value = /*center*/ ctx[0][0] + }, + { + cy: ellipse_cy_value = /*center*/ ctx[0][1] + }, + { + rx: ellipse_rx_value = Math.abs(/*radius*/ ctx[1][0]) + }, + { + ry: ellipse_ry_value = Math.abs(/*radius*/ ctx[1][1]) + }, + { "stroke-width": /*weight*/ ctx[4] }, + { + "stroke-dasharray": ellipse_stroke_dasharray_value = /*strokeStyle*/ ctx[2] === "dashed" ? "4,3" : undefined + }, + { + transform: ellipse_transform_value = `${/*cssScale*/ ctx[8]} ${/*rotate*/ ctx[7]}` + }, + /*$$restProps*/ ctx[10], + { + style: ellipse_style_value = ` + stroke: ${/*color*/ ctx[5]}; + fill: ${/*color*/ ctx[5]}; + fill-opacity: ${/*fillOpacity*/ ctx[6]}; + stroke-opacity: ${/*strokeOpacity*/ ctx[3]}; + ${/*$$restProps*/ ctx[10].style || ""} + ` + } + ]; + + let ellipse_data = {}; + + for (let i = 0; i < ellipse_levels.length; i += 1) { + ellipse_data = assign(ellipse_data, ellipse_levels[i]); + } + + return { + c() { + ellipse = svg_element("ellipse"); + set_svg_attributes(ellipse, ellipse_data); + toggle_class(ellipse, "svelte-cc8k9r", true); + }, + m(target, anchor) { + insert(target, ellipse, anchor); + }, + p(ctx, [dirty]) { + set_svg_attributes(ellipse, ellipse_data = get_spread_update(ellipse_levels, [ + dirty & /*center*/ 1 && ellipse_cx_value !== (ellipse_cx_value = /*center*/ ctx[0][0]) && { cx: ellipse_cx_value }, + dirty & /*center*/ 1 && ellipse_cy_value !== (ellipse_cy_value = /*center*/ ctx[0][1]) && { cy: ellipse_cy_value }, + dirty & /*radius*/ 2 && ellipse_rx_value !== (ellipse_rx_value = Math.abs(/*radius*/ ctx[1][0])) && { rx: ellipse_rx_value }, + dirty & /*radius*/ 2 && ellipse_ry_value !== (ellipse_ry_value = Math.abs(/*radius*/ ctx[1][1])) && { ry: ellipse_ry_value }, + dirty & /*weight*/ 16 && { "stroke-width": /*weight*/ ctx[4] }, + dirty & /*strokeStyle*/ 4 && ellipse_stroke_dasharray_value !== (ellipse_stroke_dasharray_value = /*strokeStyle*/ ctx[2] === "dashed" ? "4,3" : undefined) && { + "stroke-dasharray": ellipse_stroke_dasharray_value + }, + dirty & /*cssScale, rotate*/ 384 && ellipse_transform_value !== (ellipse_transform_value = `${/*cssScale*/ ctx[8]} ${/*rotate*/ ctx[7]}`) && { transform: ellipse_transform_value }, + dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10], + dirty & /*color, fillOpacity, strokeOpacity, $$restProps*/ 1128 && ellipse_style_value !== (ellipse_style_value = ` + stroke: ${/*color*/ ctx[5]}; + fill: ${/*color*/ ctx[5]}; + fill-opacity: ${/*fillOpacity*/ ctx[6]}; + stroke-opacity: ${/*strokeOpacity*/ ctx[3]}; + ${/*$$restProps*/ ctx[10].style || ""} + `) && { style: ellipse_style_value } + ])); + + toggle_class(ellipse, "svelte-cc8k9r", true); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(ellipse); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let cssScale; + let rotate; + + const omit_props_names = [ + "center","radius","angle","strokeStyle","strokeOpacity","weight","color","fillOpacity" + ]; + + let $$restProps = compute_rest_props($$props, omit_props_names); + let $scaleContext; + let { center = vec2.fromValues(0, 0) } = $$props; + let { radius = vec2.fromValues(1, 1) } = $$props; + let { angle = 0 } = $$props; + let { strokeStyle = "solid" } = $$props; + let { strokeOpacity = 1.0 } = $$props; + let { weight = 2 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { fillOpacity = 0.15 } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(12, $scaleContext = value)); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('center' in $$new_props) $$invalidate(0, center = $$new_props.center); + if ('radius' in $$new_props) $$invalidate(1, radius = $$new_props.radius); + if ('angle' in $$new_props) $$invalidate(11, angle = $$new_props.angle); + if ('strokeStyle' in $$new_props) $$invalidate(2, strokeStyle = $$new_props.strokeStyle); + if ('strokeOpacity' in $$new_props) $$invalidate(3, strokeOpacity = $$new_props.strokeOpacity); + if ('weight' in $$new_props) $$invalidate(4, weight = $$new_props.weight); + if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color); + if ('fillOpacity' in $$new_props) $$invalidate(6, fillOpacity = $$new_props.fillOpacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 4096) { + $$invalidate(8, cssScale = $scaleContext.cssScale); + } + + if ($$self.$$.dirty & /*angle, center*/ 2049) { + $$invalidate(7, rotate = `rotate(${angle * 180 / Math.PI} ${center[0]} ${center[1]})`); + } + }; + + return [ + center, + radius, + strokeStyle, + strokeOpacity, + weight, + color, + fillOpacity, + rotate, + cssScale, + scaleContext, + $$restProps, + angle, + $scaleContext + ]; +} + +class Ellipse extends SvelteComponent { + constructor(options) { + super(); + + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + center: 0, + radius: 1, + angle: 11, + strokeStyle: 2, + strokeOpacity: 3, + weight: 4, + color: 5, + fillOpacity: 6 + }, + add_css + ); + } + + get center() { + return this.$$.ctx[0]; + } + + set center(center) { + this.$$set({ center }); + flush(); + } + + get radius() { + return this.$$.ctx[1]; + } + + set radius(radius) { + this.$$set({ radius }); + flush(); + } + + get angle() { + return this.$$.ctx[11]; + } + + set angle(angle) { + this.$$set({ angle }); + flush(); + } + + get strokeStyle() { + return this.$$.ctx[2]; + } + + set strokeStyle(strokeStyle) { + this.$$set({ strokeStyle }); + flush(); + } + + get strokeOpacity() { + return this.$$.ctx[3]; + } + + set strokeOpacity(strokeOpacity) { + this.$$set({ strokeOpacity }); + flush(); + } + + get weight() { + return this.$$.ctx[4]; + } + + set weight(weight) { + this.$$set({ weight }); + flush(); + } + + get color() { + return this.$$.ctx[5]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get fillOpacity() { + return this.$$.ctx[6]; + } + + set fillOpacity(fillOpacity) { + this.$$set({ fillOpacity }); + flush(); + } +} + +export { Ellipse as default }; +//# sourceMappingURL=Ellipse.svelte.js.map diff --git a/esm/Ellipse.svelte.js.map b/esm/Ellipse.svelte.js.map new file mode 100644 index 0000000..8248ef3 --- /dev/null +++ b/esm/Ellipse.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Ellipse.svelte.js","sources":["../src/Ellipse.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;qCAmBM,GAAM,IAAC,CAAC;;;qCACR,GAAM,IAAC,CAAC;;;0BACR,IAAI,CAAC,GAAG,YAAC,GAAM,IAAC,CAAC;;;0BACjB,IAAI,CAAC,GAAG,YAAC,GAAM,IAAC,CAAC;;+BACP,GAAM;;wEACF,GAAW,QAAK,QAAQ,GAAG,KAAK,GAAG,SAAS;;;wDAChD,GAAQ,kBAAI,GAAM;;kBAC5B,GAAW;;;wBAEH,GAAK;sBACP,GAAK;oCACG,GAAW;wCACT,GAAa;sBAC7B,GAAW,KAAC,KAAK,IAAI,EAAE;;;;;;;;;;;;;;;;;;GAd7B,MAgBC;;;;gFAfK,GAAM,IAAC,CAAC;gFACR,GAAM,IAAC,CAAC;qEACR,IAAI,CAAC,GAAG,YAAC,GAAM,IAAC,CAAC;qEACjB,IAAI,CAAC,GAAG,YAAC,GAAM,IAAC,CAAC;0DACP,GAAM;sHACF,GAAW,QAAK,QAAQ,GAAG,KAAK,GAAG,SAAS;;;+GAChD,GAAQ,kBAAI,GAAM;oDAC5B,GAAW;;wBAEH,GAAK;sBACP,GAAK;oCACG,GAAW;wCACT,GAAa;sBAC7B,GAAW,KAAC,KAAK,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;OA5B7B,MAAA,GAAA,IAAA,CAAA,UAAA,CAAA,CAAA,EAAA,CAAA;OACA,MAAA,GAAA,IAAA,CAAA,UAAA,CAAA,CAAA,EAAA,CAAA;OACA,KAAA,GAAA,CAAA;OACA,WAAA,GAAA,OAAA;OACA,aAAA,GAAA,GAAA;OACA,MAAA,GAAA,CAAA;OACA,KAAA,GAAA,uBAAA;OACA,WAAA,GAAA,IAAA;KAEA,YAAA,GAAA,eAAA;;;;;;;;;;;;;;;;;;mBACA,QAAA,GAAA,aAAA,CAAA,QAAA;;;;mBACA,MAAA,aAAA,KAAA,GAAA,GAAA,GAAA,IAAA,CAAA,EAAA,IAAA,MAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/GridPattern.svelte.js b/esm/GridPattern.svelte.js new file mode 100644 index 0000000..92dc759 --- /dev/null +++ b/esm/GridPattern.svelte.js @@ -0,0 +1,500 @@ +import { SvelteComponent, init, safe_not_equal, flush, svg_element, attr, insert, detach, empty, append, noop, destroy_each, component_subscribe } from 'svelte/internal'; +import { range } from '@aicacia/core'; +import { getScaleContext } from './math.js'; + +/* src/GridPattern.svelte generated by Svelte v3.42.4 */ + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[16] = list[i]; + return child_ctx; +} + +// (30:2) {#each xs as x} +function create_each_block_1(ctx) { + let line; + let line_x__value; + let line_y__value; + let line_x__value_1; + let line_style_value; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = /*x*/ ctx[16]); + attr(line, "y1", line_y__value = 0); + attr(line, "x2", line_x__value_1 = /*x*/ ctx[16]); + attr(line, "y2", /*height*/ ctx[3]); + attr(line, "style", line_style_value = `stroke: var(--grid-line-subdivision-color)`); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, dirty) { + if (dirty & /*xs*/ 32 && line_x__value !== (line_x__value = /*x*/ ctx[16])) { + attr(line, "x1", line_x__value); + } + + if (dirty & /*xs*/ 32 && line_x__value_1 !== (line_x__value_1 = /*x*/ ctx[16])) { + attr(line, "x2", line_x__value_1); + } + + if (dirty & /*height*/ 8) { + attr(line, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (39:2) {#each ys as y} +function create_each_block(ctx) { + let line; + let line_y__value; + let line_x__value; + let line_y__value_1; + let line_style_value; + + return { + c() { + line = svg_element("line"); + attr(line, "y1", line_y__value = /*y*/ ctx[13]); + attr(line, "x1", line_x__value = 0); + attr(line, "y2", line_y__value_1 = /*y*/ ctx[13]); + attr(line, "x2", /*width*/ ctx[4]); + attr(line, "style", line_style_value = `stroke: var(--grid-line-subdivision-color)`); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, dirty) { + if (dirty & /*ys*/ 64 && line_y__value !== (line_y__value = /*y*/ ctx[13])) { + attr(line, "y1", line_y__value); + } + + if (dirty & /*ys*/ 64 && line_y__value_1 !== (line_y__value_1 = /*y*/ ctx[13])) { + attr(line, "y2", line_y__value_1); + } + + if (dirty & /*width*/ 16) { + attr(line, "x2", /*width*/ ctx[4]); + } + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (49:2) {#if xLines} +function create_if_block_1(ctx) { + let line0; + let line0_x__value; + let line0_y__value; + let line0_x__value_1; + let line0_style_value; + let line1; + let line1_y__value; + let line1_style_value; + + return { + c() { + line0 = svg_element("line"); + line1 = svg_element("line"); + attr(line0, "x1", line0_x__value = 0); + attr(line0, "y1", line0_y__value = 0); + attr(line0, "x2", line0_x__value_1 = 0); + attr(line0, "y2", /*height*/ ctx[3]); + attr(line0, "style", line0_style_value = `stroke: var(--visual-math-line-color)`); + attr(line1, "x1", /*width*/ ctx[4]); + attr(line1, "y1", line1_y__value = 0); + attr(line1, "x2", /*width*/ ctx[4]); + attr(line1, "y2", /*height*/ ctx[3]); + attr(line1, "style", line1_style_value = `stroke: var(--visual-math-line-color)`); + }, + m(target, anchor) { + insert(target, line0, anchor); + insert(target, line1, anchor); + }, + p(ctx, dirty) { + if (dirty & /*height*/ 8) { + attr(line0, "y2", /*height*/ ctx[3]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x1", /*width*/ ctx[4]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line0); + if (detaching) detach(line1); + } + }; +} + +// (65:2) {#if yLines} +function create_if_block(ctx) { + let line0; + let line0_x__value; + let line0_y__value; + let line0_y__value_1; + let line0_style_value; + let line1; + let line1_x__value; + let line1_style_value; + + return { + c() { + line0 = svg_element("line"); + line1 = svg_element("line"); + attr(line0, "x1", line0_x__value = 0); + attr(line0, "y1", line0_y__value = 0); + attr(line0, "x2", /*width*/ ctx[4]); + attr(line0, "y2", line0_y__value_1 = 0); + attr(line0, "style", line0_style_value = `stroke: var(--visual-math-line-color)`); + attr(line1, "x1", line1_x__value = 0); + attr(line1, "y1", /*height*/ ctx[3]); + attr(line1, "x2", /*width*/ ctx[4]); + attr(line1, "y2", /*height*/ ctx[3]); + attr(line1, "style", line1_style_value = `stroke: var(--visual-math-line-color)`); + }, + m(target, anchor) { + insert(target, line0, anchor); + insert(target, line1, anchor); + }, + p(ctx, dirty) { + if (dirty & /*width*/ 16) { + attr(line0, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y1", /*height*/ ctx[3]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line0); + if (detaching) detach(line1); + } + }; +} + +function create_fragment(ctx) { + let pattern; + let each0_anchor; + let each1_anchor; + let if_block0_anchor; + let each_value_1 = /*xs*/ ctx[5]; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + let each_value = /*ys*/ ctx[6]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + let if_block0 = /*xLines*/ ctx[1] && create_if_block_1(ctx); + let if_block1 = /*yLines*/ ctx[2] && create_if_block(ctx); + + return { + c() { + pattern = svg_element("pattern"); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + each0_anchor = empty(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + each1_anchor = empty(); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + attr(pattern, "id", /*id*/ ctx[0]); + attr(pattern, "x", "0"); + attr(pattern, "y", "0"); + attr(pattern, "width", /*width*/ ctx[4]); + attr(pattern, "height", /*height*/ ctx[3]); + attr(pattern, "patternUnits", "userSpaceOnUse"); + }, + m(target, anchor) { + insert(target, pattern, anchor); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(pattern, null); + } + + append(pattern, each0_anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(pattern, null); + } + + append(pattern, each1_anchor); + if (if_block0) if_block0.m(pattern, null); + append(pattern, if_block0_anchor); + if (if_block1) if_block1.m(pattern, null); + }, + p(ctx, [dirty]) { + if (dirty & /*xs, height*/ 40) { + each_value_1 = /*xs*/ ctx[5]; + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_1(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(pattern, each0_anchor); + } + } + + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + + each_blocks_1.length = each_value_1.length; + } + + if (dirty & /*ys, width*/ 80) { + each_value = /*ys*/ ctx[6]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(pattern, each1_anchor); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + + if (/*xLines*/ ctx[1]) { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_1(ctx); + if_block0.c(); + if_block0.m(pattern, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if (/*yLines*/ ctx[2]) { + if (if_block1) { + if_block1.p(ctx, dirty); + } else { + if_block1 = create_if_block(ctx); + if_block1.c(); + if_block1.m(pattern, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if (dirty & /*id*/ 1) { + attr(pattern, "id", /*id*/ ctx[0]); + } + + if (dirty & /*width*/ 16) { + attr(pattern, "width", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(pattern, "height", /*height*/ ctx[3]); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(pattern); + destroy_each(each_blocks_1, detaching); + destroy_each(each_blocks, detaching); + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + let width; + let height; + let $context; + let { id } = $$props; + let { xLines = 1 } = $$props; + let { yLines = 1 } = $$props; + let { xSubdivisions = 1 } = $$props; + let { ySubdivisions = 1 } = $$props; + let context = getScaleContext(); + component_subscribe($$self, context, value => $$invalidate(12, $context = value)); + let xs = []; + let ys = []; + + $$self.$$set = $$props => { + if ('id' in $$props) $$invalidate(0, id = $$props.id); + if ('xLines' in $$props) $$invalidate(1, xLines = $$props.xLines); + if ('yLines' in $$props) $$invalidate(2, yLines = $$props.yLines); + if ('xSubdivisions' in $$props) $$invalidate(8, xSubdivisions = $$props.xSubdivisions); + if ('ySubdivisions' in $$props) $$invalidate(9, ySubdivisions = $$props.ySubdivisions); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$context*/ 4096) { + $$invalidate(11, scaleX = $context.scaleX); + } + + if ($$self.$$.dirty & /*$context*/ 4096) { + $$invalidate(10, scaleY = $context.scaleY); + } + + if ($$self.$$.dirty & /*scaleX, xLines*/ 2050) { + $$invalidate(4, width = scaleX(xLines || 1)); + } + + if ($$self.$$.dirty & /*scaleY, yLines*/ 1028) { + $$invalidate(3, height = -scaleY(yLines || 1)); + } + + if ($$self.$$.dirty & /*xSubdivisions, width*/ 272) { + if (xSubdivisions && xSubdivisions > 1) { + const pixelXDistance = width / xSubdivisions; + $$invalidate(5, xs = range(0, width + pixelXDistance * 1.1, pixelXDistance).iter().toArray()); + } + } + + if ($$self.$$.dirty & /*ySubdivisions, height*/ 520) { + if (ySubdivisions && ySubdivisions > 1) { + const pixelYDistance = height / ySubdivisions; + $$invalidate(6, ys = range(0, height + pixelYDistance * 1.1, pixelYDistance).iter().toArray()); + } + } + }; + + return [ + id, + xLines, + yLines, + height, + width, + xs, + ys, + context, + xSubdivisions, + ySubdivisions, + scaleY, + scaleX, + $context + ]; +} + +class GridPattern extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + id: 0, + xLines: 1, + yLines: 2, + xSubdivisions: 8, + ySubdivisions: 9 + }); + } + + get id() { + return this.$$.ctx[0]; + } + + set id(id) { + this.$$set({ id }); + flush(); + } + + get xLines() { + return this.$$.ctx[1]; + } + + set xLines(xLines) { + this.$$set({ xLines }); + flush(); + } + + get yLines() { + return this.$$.ctx[2]; + } + + set yLines(yLines) { + this.$$set({ yLines }); + flush(); + } + + get xSubdivisions() { + return this.$$.ctx[8]; + } + + set xSubdivisions(xSubdivisions) { + this.$$set({ xSubdivisions }); + flush(); + } + + get ySubdivisions() { + return this.$$.ctx[9]; + } + + set ySubdivisions(ySubdivisions) { + this.$$set({ ySubdivisions }); + flush(); + } +} + +export { GridPattern as default }; +//# sourceMappingURL=GridPattern.svelte.js.map diff --git a/esm/GridPattern.svelte.js.map b/esm/GridPattern.svelte.js.map new file mode 100644 index 0000000..019723a --- /dev/null +++ b/esm/GridPattern.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GridPattern.svelte.js","sources":["../src/GridPattern.svelte"],"sourcesContent":["\n\n\n {#each xs as x}\n \n {/each}\n {#each ys as y}\n \n {/each}\n\n {#if xLines}\n \n \n {/if}\n {#if yLines}\n \n \n {/if}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAqCU,GAAC;oCACD,CAAC;4CACD,GAAC;+BACD,GAAM;;;;GAJZ,MAMC;;;qEALK,GAAC;;;;yEAED,GAAC;;;;;gCACD,GAAM;;;;;;;;;;;;;;;;;;;;0CAMN,GAAC;oCACD,CAAC;4CACD,GAAC;8BACD,GAAK;;;;GAJX,MAMC;;;qEALK,GAAC;;;;yEAED,GAAC;;;;;+BACD,GAAK;;;;;;;;;;;;;;;;;;;;;;;;sCAOL,CAAC;sCACD,CAAC;wCACD,CAAC;gCACD,GAAM;;+BAIN,GAAK;sCACL,CAAC;+BACD,GAAK;gCACL,GAAM;;;;GAXZ,MAMC;GACD,MAMC;;;;iCATK,GAAM;;;;gCAIN,GAAK;;;;gCAEL,GAAK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,aAAA;oBACA,EAAA,GAAA,KAAA,CAAA,CAAA,EAAA,MAAA,GAAA,cAAA,GAAA,GAAA,EAAA,cAAA,EACA,IAAA,GACA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/MovablePoint.svelte.js b/esm/MovablePoint.svelte.js new file mode 100644 index 0000000..4842fd0 --- /dev/null +++ b/esm/MovablePoint.svelte.js @@ -0,0 +1,248 @@ +import { SvelteComponent, init, safe_not_equal, flush, svg_element, attr, toggle_class, insert, append, noop, detach, component_subscribe, binding_callbacks } from 'svelte/internal'; +import { DragGesture } from '@use-gesture/vanilla'; +import { vec2, mat2d } from 'gl-matrix'; +import { onMount } from 'svelte'; +import { getScaleContext } from './math.js'; + +/* src/MovablePoint.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let g; + let circle0; + let circle0_cx_value; + let circle0_cy_value; + let circle1; + let circle1_cx_value; + let circle1_cy_value; + + return { + c() { + g = svg_element("g"); + circle0 = svg_element("circle"); + circle1 = svg_element("circle"); + attr(circle0, "cx", circle0_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0])); + attr(circle0, "cy", circle0_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1])); + attr(circle0, "r", 30); + attr(circle0, "fill", "transparent"); + attr(circle1, "cx", circle1_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0])); + attr(circle1, "cy", circle1_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1])); + attr(circle1, "r", 6); + attr(circle1, "fill", /*color*/ ctx[0]); + attr(circle1, "stroke", /*color*/ ctx[0]); + attr(circle1, "stroke-opacity", 0.25); + attr(circle1, "tabindex", 0); + toggle_class(circle1, "draggable", /*dragging*/ ctx[3]); + }, + m(target, anchor) { + insert(target, g, anchor); + append(g, circle0); + append(g, circle1); + /*g_binding*/ ctx[15](g); + }, + p(ctx, [dirty]) { + if (dirty & /*scaleX, display*/ 34 && circle0_cx_value !== (circle0_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0]))) { + attr(circle0, "cx", circle0_cx_value); + } + + if (dirty & /*scaleY, display*/ 18 && circle0_cy_value !== (circle0_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1]))) { + attr(circle0, "cy", circle0_cy_value); + } + + if (dirty & /*scaleX, display*/ 34 && circle1_cx_value !== (circle1_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0]))) { + attr(circle1, "cx", circle1_cx_value); + } + + if (dirty & /*scaleY, display*/ 18 && circle1_cy_value !== (circle1_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1]))) { + attr(circle1, "cy", circle1_cy_value); + } + + if (dirty & /*color*/ 1) { + attr(circle1, "fill", /*color*/ ctx[0]); + } + + if (dirty & /*color*/ 1) { + attr(circle1, "stroke", /*color*/ ctx[0]); + } + + if (dirty & /*dragging*/ 8) { + toggle_class(circle1, "draggable", /*dragging*/ ctx[3]); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + /*g_binding*/ ctx[15](null); + } + }; +} + +const VEC2_0 = vec2.create(); + +function instance($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + let inversePixelMatrix; + let onDrag; + let $scaleContext; + let { point = vec2.create() } = $$props; + let { color = "var(--visual-math-blue)" } = $$props; + let { transform = mat2d.create() } = $$props; + let { constrain = undefined } = $$props; + let intialPoint = vec2.fromValues(point[0], point[1]); + let constraintFunction = point => point; + point = constraintFunction(point); + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(14, $scaleContext = value)); + let display = vec2.create(); + let inverseTransform = mat2d.create(); + let element; + let startPoint = vec2.create(); + let dragging = false; + + onMount(() => { + const dragGesture = new DragGesture(element, onDrag); + + return () => { + dragGesture.destroy(); + }; + }); + + function g_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + element = $$value; + $$invalidate(2, element); + }); + } + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(7, point = $$props.point); + if ('color' in $$props) $$invalidate(0, color = $$props.color); + if ('transform' in $$props) $$invalidate(8, transform = $$props.transform); + if ('constrain' in $$props) $$invalidate(9, constrain = $$props.constrain); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*constrain*/ 512) { + if (constrain === "horizontal") { + $$invalidate(10, constraintFunction = ([x, _y]) => [x, intialPoint[1]]); + } else if (constrain === "vertical") { + $$invalidate(10, constraintFunction = ([_x, y]) => [intialPoint[0], y]); + } else if (typeof constrain === "function") { + $$invalidate(10, constraintFunction = constrain); + } + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(5, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(4, scaleY = $scaleContext.scaleY); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(13, inversePixelMatrix = $scaleContext.inversePixelMatrix); + } + + if ($$self.$$.dirty & /*inverseTransform, transform*/ 2304) { + $$invalidate(11, inverseTransform = mat2d.invert(inverseTransform, transform)); + } + + if ($$self.$$.dirty & /*inversePixelMatrix, startPoint, point, transform, inverseTransform, constraintFunction*/ 15744) { + onDrag = state => { + var _a; + + (_a = state.event) === null || _a === void 0 + ? void 0 + : _a.stopPropagation(); + + $$invalidate(3, dragging = state.down); + const movement = vec2.transformMat2d(VEC2_0, state.movement, inversePixelMatrix); + + if (state.first) { + $$invalidate(12, startPoint = vec2.transformMat2d(startPoint, point, transform)); + } + + vec2.add(point, startPoint, movement); + vec2.transformMat2d(point, point, inverseTransform); + $$invalidate(7, point = constraintFunction(point)); + }; + } + + if ($$self.$$.dirty & /*display, point, transform*/ 386) { + $$invalidate(1, display = vec2.transformMat2d(display, point, transform)); + } + }; + + return [ + color, + display, + element, + dragging, + scaleY, + scaleX, + scaleContext, + point, + transform, + constrain, + constraintFunction, + inverseTransform, + startPoint, + inversePixelMatrix, + $scaleContext, + g_binding + ]; +} + +class MovablePoint extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + point: 7, + color: 0, + transform: 8, + constrain: 9 + }); + } + + get point() { + return this.$$.ctx[7]; + } + + set point(point) { + this.$$set({ point }); + flush(); + } + + get color() { + return this.$$.ctx[0]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get transform() { + return this.$$.ctx[8]; + } + + set transform(transform) { + this.$$set({ transform }); + flush(); + } + + get constrain() { + return this.$$.ctx[9]; + } + + set constrain(constrain) { + this.$$set({ constrain }); + flush(); + } +} + +export { MovablePoint as default }; +//# sourceMappingURL=MovablePoint.svelte.js.map diff --git a/esm/MovablePoint.svelte.js.map b/esm/MovablePoint.svelte.js.map new file mode 100644 index 0000000..b649a3c --- /dev/null +++ b/esm/MovablePoint.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MovablePoint.svelte.js","sources":["../src/MovablePoint.svelte"],"sourcesContent":["\n\n\n\n\n \n \n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;qDA8EQ,GAAM,gBAAC,GAAO,IAAC,CAAC;qDAChB,GAAM,gBAAC,GAAO,IAAC,CAAC;sBACjB,EAAE;;qDAID,GAAM,gBAAC,GAAO,IAAC,CAAC;qDAChB,GAAM,gBAAC,GAAO,IAAC,CAAC;sBACjB,CAAC;mCACE,GAAK;qCACH,GAAK;mCACG,IAAI;6BAEV,CAAC;mDADM,GAAQ;;;GAd7B,MAiBG;GAhBD,MAKC;GACD,MASC;;;;6FAdK,GAAM,gBAAC,GAAO,IAAC,CAAC;;;;6FAChB,GAAM,gBAAC,GAAO,IAAC,CAAC;;;;6FAKhB,GAAM,gBAAC,GAAO,IAAC,CAAC;;;;6FAChB,GAAM,gBAAC,GAAO,IAAC,CAAC;;;;;oCAEd,GAAK;;;;sCACH,GAAK;;;;oDAEI,GAAQ;;;;;;;;;;;;MAzF7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A,IAAA,CAAA,cAAA,CAAA,MAAA,EAAA,KAAA,CAAA,QAAA,EAAA,kBAAA;;QAMA,KAAA,CAAA,KAAA;sBACA,UAAA,GAAA,IAAA,CAAA,cAAA,CAAA,UAAA,EAAA,KAAA,EAAA,SAAA;;;IAEA,IAAA,CAAA,GAAA,CAAA,KAAA,EAAA,UAAA,EAAA,QAAA;IACA,IAAA,CAAA,cAAA,CAAA,KAAA,EAAA,KAAA,EAAA,gBAAA;oBACA,KAAA,GAAA,kBAAA,CAAA,KAAA;;;;;mBA3BA,OAAA,GAAA,IAAA,CAAA,cAAA,CAAA,OAAA,EAAA,KAAA,EAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/Point.svelte.js b/esm/Point.svelte.js new file mode 100644 index 0000000..81004ec --- /dev/null +++ b/esm/Point.svelte.js @@ -0,0 +1,136 @@ +import { SvelteComponent, init, safe_not_equal, flush, assign, svg_element, set_svg_attributes, insert, get_spread_update, noop, detach, compute_rest_props, component_subscribe, exclude_internal_props } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import { getScaleContext } from './math.js'; + +/* src/Point.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let circle; + let circle_cx_value; + let circle_cy_value; + let circle_r_value; + let circle_style_value; + + let circle_levels = [ + { + cx: circle_cx_value = /*scaleX*/ ctx[4](/*point*/ ctx[0][0]) + }, + { + cy: circle_cy_value = /*scaleY*/ ctx[3](/*point*/ ctx[0][1]) + }, + { r: circle_r_value = 6 }, + /*$$restProps*/ ctx[6], + { + style: circle_style_value = `fill: ${/*color*/ ctx[1]}; opacity: ${/*opacity*/ ctx[2]}; ${/*$$restProps*/ ctx[6].style}` + } + ]; + + let circle_data = {}; + + for (let i = 0; i < circle_levels.length; i += 1) { + circle_data = assign(circle_data, circle_levels[i]); + } + + return { + c() { + circle = svg_element("circle"); + set_svg_attributes(circle, circle_data); + }, + m(target, anchor) { + insert(target, circle, anchor); + }, + p(ctx, [dirty]) { + set_svg_attributes(circle, circle_data = get_spread_update(circle_levels, [ + dirty & /*scaleX, point*/ 17 && circle_cx_value !== (circle_cx_value = /*scaleX*/ ctx[4](/*point*/ ctx[0][0])) && { cx: circle_cx_value }, + dirty & /*scaleY, point*/ 9 && circle_cy_value !== (circle_cy_value = /*scaleY*/ ctx[3](/*point*/ ctx[0][1])) && { cy: circle_cy_value }, + { r: circle_r_value }, + dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6], + dirty & /*color, opacity, $$restProps*/ 70 && circle_style_value !== (circle_style_value = `fill: ${/*color*/ ctx[1]}; opacity: ${/*opacity*/ ctx[2]}; ${/*$$restProps*/ ctx[6].style}`) && { style: circle_style_value } + ])); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(circle); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + const omit_props_names = ["point","color","opacity"]; + let $$restProps = compute_rest_props($$props, omit_props_names); + let $scaleContext; + let { point = vec2.create() } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { opacity = 1 } = $$props; + const scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(7, $scaleContext = value)); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('point' in $$new_props) $$invalidate(0, point = $$new_props.point); + if ('color' in $$new_props) $$invalidate(1, color = $$new_props.color); + if ('opacity' in $$new_props) $$invalidate(2, opacity = $$new_props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 128) { + $$invalidate(4, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 128) { + $$invalidate(3, scaleY = $scaleContext.scaleY); + } + }; + + return [ + point, + color, + opacity, + scaleY, + scaleX, + scaleContext, + $$restProps, + $scaleContext + ]; +} + +class Point extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { point: 0, color: 1, opacity: 2 }); + } + + get point() { + return this.$$.ctx[0]; + } + + set point(point) { + this.$$set({ point }); + flush(); + } + + get color() { + return this.$$.ctx[1]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get opacity() { + return this.$$.ctx[2]; + } + + set opacity(opacity) { + this.$$set({ opacity }); + flush(); + } +} + +export { Point as default }; +//# sourceMappingURL=Point.svelte.js.map diff --git a/esm/Point.svelte.js.map b/esm/Point.svelte.js.map new file mode 100644 index 0000000..5a40b9a --- /dev/null +++ b/esm/Point.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Point.svelte.js","sources":["../src/Point.svelte"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;oCAcM,GAAM,cAAC,GAAK,IAAC,CAAC;;;oCACd,GAAM,cAAC,GAAK,IAAC,CAAC;;wBACf,CAAC;kBACA,GAAW;;kDACC,GAAK,6BAAc,GAAO,wBAAK,GAAW,IAAC,KAAK;;;;;;;;;;;;;;;;GALlE,MAMC;;;;sFALK,GAAM,cAAC,GAAK,IAAC,CAAC;qFACd,GAAM,cAAC,GAAK,IAAC,CAAC;;kDAEd,GAAW;kHACC,GAAK,6BAAc,GAAO,wBAAK,GAAW,IAAC,KAAK;;;;;;;;;;;;;;;;;OAdlE,KAAA,GAAA,IAAA,CAAA,MAAA;OACA,KAAA,GAAA,uBAAA;OACA,OAAA,GAAA,CAAA;OAEA,YAAA,GAAA,eAAA;;;;;;;;;;;;;mBACA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;mBACA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/PointAngle.svelte.js b/esm/PointAngle.svelte.js new file mode 100644 index 0000000..00e3fa6 --- /dev/null +++ b/esm/PointAngle.svelte.js @@ -0,0 +1,156 @@ +import { SvelteComponent, init, safe_not_equal, flush, create_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import ThroughPoints from './ThroughPoints.svelte.js'; + +/* src/PointAngle.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let throughpoints; + let current; + + throughpoints = new ThroughPoints({ + props: { + point1: /*point*/ ctx[0], + point2: /*point2*/ ctx[5], + color: /*color*/ ctx[1], + opacity: /*opacity*/ ctx[4], + style: /*style*/ ctx[2], + weight: /*weight*/ ctx[3] + } + }); + + return { + c() { + create_component(throughpoints.$$.fragment); + }, + m(target, anchor) { + mount_component(throughpoints, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const throughpoints_changes = {}; + if (dirty & /*point*/ 1) throughpoints_changes.point1 = /*point*/ ctx[0]; + if (dirty & /*point2*/ 32) throughpoints_changes.point2 = /*point2*/ ctx[5]; + if (dirty & /*color*/ 2) throughpoints_changes.color = /*color*/ ctx[1]; + if (dirty & /*opacity*/ 16) throughpoints_changes.opacity = /*opacity*/ ctx[4]; + if (dirty & /*style*/ 4) throughpoints_changes.style = /*style*/ ctx[2]; + if (dirty & /*weight*/ 8) throughpoints_changes.weight = /*weight*/ ctx[3]; + throughpoints.$set(throughpoints_changes); + }, + i(local) { + if (current) return; + transition_in(throughpoints.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(throughpoints.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(throughpoints, detaching); + } + }; +} + +const VEC2_0 = vec2.create(); +const ZERO = vec2.create(); +const RIGHT = vec2.fromValues(1, 0); + +function instance($$self, $$props, $$invalidate) { + let { point = vec2.create() } = $$props; + let { angle = 0 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + let point2 = vec2.create(); + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(0, point = $$props.point); + if ('angle' in $$props) $$invalidate(6, angle = $$props.angle); + if ('color' in $$props) $$invalidate(1, color = $$props.color); + if ('style' in $$props) $$invalidate(2, style = $$props.style); + if ('weight' in $$props) $$invalidate(3, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(4, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*point2, point, angle*/ 97) { + $$invalidate(5, point2 = vec2.add(point2, point, vec2.rotate(VEC2_0, RIGHT, ZERO, angle))); + } + }; + + return [point, color, style, weight, opacity, point2, angle]; +} + +class PointAngle extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + point: 0, + angle: 6, + color: 1, + style: 2, + weight: 3, + opacity: 4 + }); + } + + get point() { + return this.$$.ctx[0]; + } + + set point(point) { + this.$$set({ point }); + flush(); + } + + get angle() { + return this.$$.ctx[6]; + } + + set angle(angle) { + this.$$set({ angle }); + flush(); + } + + get color() { + return this.$$.ctx[1]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get style() { + return this.$$.ctx[2]; + } + + set style(style) { + this.$$set({ style }); + flush(); + } + + get weight() { + return this.$$.ctx[3]; + } + + set weight(weight) { + this.$$set({ weight }); + flush(); + } + + get opacity() { + return this.$$.ctx[4]; + } + + set opacity(opacity) { + this.$$set({ opacity }); + flush(); + } +} + +export { PointAngle as default }; +//# sourceMappingURL=PointAngle.svelte.js.map diff --git a/esm/PointAngle.svelte.js.map b/esm/PointAngle.svelte.js.map new file mode 100644 index 0000000..c38c6dc --- /dev/null +++ b/esm/PointAngle.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PointAngle.svelte.js","sources":["../src/PointAngle.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;sBAqBuB,GAAK;;;;;;;;;;;;;;;;;;;qEAAL,GAAK;;;;;;;;;;;;;;;;;;;;;;;MApB5B,MAAA,GAAA,IAAA,CAAA,MAAA;MACA,IAAA,GAAA,IAAA,CAAA,MAAA;MACA,KAAA,GAAA,IAAA,CAAA,UAAA,CAAA,CAAA,EAAA,CAAA;;;OAOA,KAAA,GAAA,IAAA,CAAA,MAAA;OACA,KAAA,GAAA,CAAA;OACA,KAAA,GAAA,uBAAA;OACA,KAAA,GAAA,OAAA;OACA,MAAA,GAAA,CAAA;OACA,OAAA,GAAA,CAAA;KAEA,MAAA,GAAA,IAAA,CAAA,MAAA;;;;;;;;;;;;;mBACA,MAAA,GAAA,IAAA,CAAA,GAAA,CAAA,MAAA,EAAA,KAAA,EAAA,IAAA,CAAA,MAAA,CAAA,MAAA,EAAA,KAAA,EAAA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/PointSlope.svelte.js b/esm/PointSlope.svelte.js new file mode 100644 index 0000000..47ed428 --- /dev/null +++ b/esm/PointSlope.svelte.js @@ -0,0 +1,152 @@ +import { SvelteComponent, init, safe_not_equal, flush, create_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import PointAngle from './PointAngle.svelte.js'; + +/* src/PointSlope.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let pointangle; + let current; + + pointangle = new PointAngle({ + props: { + point: /*point*/ ctx[0], + angle: /*angle*/ ctx[5], + color: /*color*/ ctx[1], + opacity: /*opacity*/ ctx[4], + style: /*style*/ ctx[2], + weight: /*weight*/ ctx[3] + } + }); + + return { + c() { + create_component(pointangle.$$.fragment); + }, + m(target, anchor) { + mount_component(pointangle, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const pointangle_changes = {}; + if (dirty & /*point*/ 1) pointangle_changes.point = /*point*/ ctx[0]; + if (dirty & /*angle*/ 32) pointangle_changes.angle = /*angle*/ ctx[5]; + if (dirty & /*color*/ 2) pointangle_changes.color = /*color*/ ctx[1]; + if (dirty & /*opacity*/ 16) pointangle_changes.opacity = /*opacity*/ ctx[4]; + if (dirty & /*style*/ 4) pointangle_changes.style = /*style*/ ctx[2]; + if (dirty & /*weight*/ 8) pointangle_changes.weight = /*weight*/ ctx[3]; + pointangle.$set(pointangle_changes); + }, + i(local) { + if (current) return; + transition_in(pointangle.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(pointangle.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(pointangle, detaching); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let { point = vec2.create() } = $$props; + let { slope = 0 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + let angle = Math.atan(slope); + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(0, point = $$props.point); + if ('slope' in $$props) $$invalidate(6, slope = $$props.slope); + if ('color' in $$props) $$invalidate(1, color = $$props.color); + if ('style' in $$props) $$invalidate(2, style = $$props.style); + if ('weight' in $$props) $$invalidate(3, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(4, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*slope*/ 64) { + $$invalidate(5, angle = Math.atan(slope)); + } + }; + + return [point, color, style, weight, opacity, angle, slope]; +} + +class PointSlope extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + point: 0, + slope: 6, + color: 1, + style: 2, + weight: 3, + opacity: 4 + }); + } + + get point() { + return this.$$.ctx[0]; + } + + set point(point) { + this.$$set({ point }); + flush(); + } + + get slope() { + return this.$$.ctx[6]; + } + + set slope(slope) { + this.$$set({ slope }); + flush(); + } + + get color() { + return this.$$.ctx[1]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get style() { + return this.$$.ctx[2]; + } + + set style(style) { + this.$$set({ style }); + flush(); + } + + get weight() { + return this.$$.ctx[3]; + } + + set weight(weight) { + this.$$set({ weight }); + flush(); + } + + get opacity() { + return this.$$.ctx[4]; + } + + set opacity(opacity) { + this.$$set({ opacity }); + flush(); + } +} + +export { PointSlope as default }; +//# sourceMappingURL=PointSlope.svelte.js.map diff --git a/esm/PointSlope.svelte.js.map b/esm/PointSlope.svelte.js.map new file mode 100644 index 0000000..edc0f4c --- /dev/null +++ b/esm/PointSlope.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PointSlope.svelte.js","sources":["../src/PointSlope.svelte"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAIA,KAAA,GAAA,IAAA,CAAA,MAAA;OACA,KAAA,GAAA,CAAA;OACA,KAAA,GAAA,uBAAA;OACA,KAAA,GAAA,OAAA;OACA,MAAA,GAAA,CAAA;OACA,OAAA,GAAA,CAAA;KAEA,KAAA,GAAA,IAAA,CAAA,IAAA,CAAA,KAAA;;;;;;;;;;;;;mBACA,KAAA,GAAA,IAAA,CAAA,IAAA,CAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/ThroughPoints.svelte.js b/esm/ThroughPoints.svelte.js new file mode 100644 index 0000000..0f7aea2 --- /dev/null +++ b/esm/ThroughPoints.svelte.js @@ -0,0 +1,202 @@ +import { SvelteComponent, init, safe_not_equal, flush, svg_element, attr, insert, noop, detach, component_subscribe } from 'svelte/internal'; +import { vec2 } from 'gl-matrix'; +import { getScaleContext } from './math.js'; + +/* src/ThroughPoints.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let line; + let line_x__value; + let line_y__value; + let line_x__value_1; + let line_y__value_1; + let line_style_value; + let line_stroke_dasharray_value; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = /*scaledPoint1*/ ctx[4][0]); + attr(line, "y1", line_y__value = /*scaledPoint1*/ ctx[4][1]); + attr(line, "x2", line_x__value_1 = /*scaledPoint2*/ ctx[5][0]); + attr(line, "y2", line_y__value_1 = /*scaledPoint2*/ ctx[5][1]); + attr(line, "style", line_style_value = `stroke: ${/*color*/ ctx[0]}`); + attr(line, "stroke-width", /*weight*/ ctx[2]); + attr(line, "opacity", /*opacity*/ ctx[3]); + attr(line, "stroke-dasharray", line_stroke_dasharray_value = /*style*/ ctx[1] === "dashed" ? "4,3" : undefined); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, [dirty]) { + if (dirty & /*scaledPoint1*/ 16 && line_x__value !== (line_x__value = /*scaledPoint1*/ ctx[4][0])) { + attr(line, "x1", line_x__value); + } + + if (dirty & /*scaledPoint1*/ 16 && line_y__value !== (line_y__value = /*scaledPoint1*/ ctx[4][1])) { + attr(line, "y1", line_y__value); + } + + if (dirty & /*scaledPoint2*/ 32 && line_x__value_1 !== (line_x__value_1 = /*scaledPoint2*/ ctx[5][0])) { + attr(line, "x2", line_x__value_1); + } + + if (dirty & /*scaledPoint2*/ 32 && line_y__value_1 !== (line_y__value_1 = /*scaledPoint2*/ ctx[5][1])) { + attr(line, "y2", line_y__value_1); + } + + if (dirty & /*color*/ 1 && line_style_value !== (line_style_value = `stroke: ${/*color*/ ctx[0]}`)) { + attr(line, "style", line_style_value); + } + + if (dirty & /*weight*/ 4) { + attr(line, "stroke-width", /*weight*/ ctx[2]); + } + + if (dirty & /*opacity*/ 8) { + attr(line, "opacity", /*opacity*/ ctx[3]); + } + + if (dirty & /*style*/ 2 && line_stroke_dasharray_value !== (line_stroke_dasharray_value = /*style*/ ctx[1] === "dashed" ? "4,3" : undefined)) { + attr(line, "stroke-dasharray", line_stroke_dasharray_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +const VEC2_0 = vec2.create(); + +function instance($$self, $$props, $$invalidate) { + let pixelMatrix; + let $scaleContext; + let { point1 = vec2.create() } = $$props; + let { point2 = vec2.create() } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + const scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(11, $scaleContext = value)); + let segment = vec2.create(); + let scaledPoint1 = vec2.create(); + let scaledPoint2 = vec2.create(); + + $$self.$$set = $$props => { + if ('point1' in $$props) $$invalidate(7, point1 = $$props.point1); + if ('point2' in $$props) $$invalidate(8, point2 = $$props.point2); + if ('color' in $$props) $$invalidate(0, color = $$props.color); + if ('style' in $$props) $$invalidate(1, style = $$props.style); + if ('weight' in $$props) $$invalidate(2, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(3, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 2048) { + $$invalidate(10, pixelMatrix = $scaleContext.pixelMatrix); + } + + if ($$self.$$.dirty & /*segment, point2, point1*/ 896) { + $$invalidate(9, segment = vec2.scale(segment, vec2.normalize(segment, vec2.sub(VEC2_0, point2, point1)), 100000)); + } + + if ($$self.$$.dirty & /*scaledPoint1, point1, segment, pixelMatrix*/ 1680) { + $$invalidate(4, scaledPoint1 = vec2.transformMat2d(scaledPoint1, vec2.sub(VEC2_0, point1, segment), pixelMatrix)); + } + + if ($$self.$$.dirty & /*scaledPoint2, point2, segment, pixelMatrix*/ 1824) { + $$invalidate(5, scaledPoint2 = vec2.transformMat2d(scaledPoint2, vec2.add(VEC2_0, point2, segment), pixelMatrix)); + } + }; + + return [ + color, + style, + weight, + opacity, + scaledPoint1, + scaledPoint2, + scaleContext, + point1, + point2, + segment, + pixelMatrix, + $scaleContext + ]; +} + +class ThroughPoints extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance, create_fragment, safe_not_equal, { + point1: 7, + point2: 8, + color: 0, + style: 1, + weight: 2, + opacity: 3 + }); + } + + get point1() { + return this.$$.ctx[7]; + } + + set point1(point1) { + this.$$set({ point1 }); + flush(); + } + + get point2() { + return this.$$.ctx[8]; + } + + set point2(point2) { + this.$$set({ point2 }); + flush(); + } + + get color() { + return this.$$.ctx[0]; + } + + set color(color) { + this.$$set({ color }); + flush(); + } + + get style() { + return this.$$.ctx[1]; + } + + set style(style) { + this.$$set({ style }); + flush(); + } + + get weight() { + return this.$$.ctx[2]; + } + + set weight(weight) { + this.$$set({ weight }); + flush(); + } + + get opacity() { + return this.$$.ctx[3]; + } + + set opacity(opacity) { + this.$$set({ opacity }); + flush(); + } +} + +export { ThroughPoints as default }; +//# sourceMappingURL=ThroughPoints.svelte.js.map diff --git a/esm/ThroughPoints.svelte.js.map b/esm/ThroughPoints.svelte.js.map new file mode 100644 index 0000000..39ceb59 --- /dev/null +++ b/esm/ThroughPoints.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ThroughPoints.svelte.js","sources":["../src/ThroughPoints.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;qDAuCM,GAAY,IAAC,CAAC;qDACd,GAAY,IAAC,CAAC;uDACd,GAAY,IAAC,CAAC;uDACd,GAAY,IAAC,CAAC;+DACA,GAAK;yCACT,GAAM;;0EAEF,GAAK,QAAK,QAAQ,GAAG,KAAK,GAAG,SAAS;;;GAR1D,MASC;;;0FARK,GAAY,IAAC,CAAC;;;;0FACd,GAAY,IAAC,CAAC;;;;8FACd,GAAY,IAAC,CAAC;;;;8FACd,GAAY,IAAC,CAAC;;;;4FACA,GAAK;;;;;0CACT,GAAM;;;;;;;uGAEF,GAAK,QAAK,QAAQ,GAAG,KAAK,GAAG,SAAS;;;;;;;;;;;;MA7C1D,MAAA,GAAA,IAAA,CAAA,MAAA;;;;;OAOA,MAAA,GAAA,IAAA,CAAA,MAAA;OACA,MAAA,GAAA,IAAA,CAAA,MAAA;OACA,KAAA,GAAA,uBAAA;OACA,KAAA,GAAA,OAAA;OACA,MAAA,GAAA,CAAA;OACA,OAAA,GAAA,CAAA;OAEA,YAAA,GAAA,eAAA;;KAEA,OAAA,GAAA,IAAA,CAAA,MAAA;KAOA,YAAA,GAAA,IAAA,CAAA,MAAA;KACA,YAAA,GAAA,IAAA,CAAA,MAAA;;;;;;;;;;;;;oBATA,WAAA,GAAA,aAAA,CAAA,WAAA;;;;mBAEA,OAAA,GAAA,IAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,EAAA,IAAA,CAAA,GAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,IAAA,MAAA;;;;mBAQA,YAAA,GAAA,IAAA,CAAA,cAAA,CAAA,YAAA,EAAA,IAAA,CAAA,GAAA,CAAA,MAAA,EAAA,MAAA,EAAA,OAAA,GAAA,WAAA;;;;mBAKA,YAAA,GAAA,IAAA,CAAA,cAAA,CAAA,YAAA,EAAA,IAAA,CAAA,GAAA,CAAA,MAAA,EAAA,MAAA,EAAA,OAAA,GAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/VisualMath.svelte.js b/esm/VisualMath.svelte.js new file mode 100644 index 0000000..1d46a89 --- /dev/null +++ b/esm/VisualMath.svelte.js @@ -0,0 +1,529 @@ +import { SvelteComponent, init, safe_not_equal, flush, append_styles, create_slot, element, svg_element, attr, add_render_callback, insert, append, add_resize_listener, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, detach, binding_callbacks } from 'svelte/internal'; +import { DragGesture, WheelGesture } from '@use-gesture/vanilla'; +import { range } from '@aicacia/core'; +import { vec2, mat2d } from 'gl-matrix'; +import { setPanesContext, setCoordinateContext, setScaleContext, setMapContext } from './math.js'; +import { writable } from 'svelte/store'; +import { onMount } from 'svelte'; + +/* src/VisualMath.svelte generated by Svelte v3.42.4 */ + +function add_css(target) { + append_styles(target, "svelte-5trppw", ".visual-math.svelte-5trppw{display:block;background:var(--visual-math-bg);overflow:hidden;user-select:none;font-family:sans-serif;font-variant-numeric:tabular-nums;--visual-math-bg:#f1f1f1;--visual-math-fg:black;--visual-math-origin-color:var(--visual-math-fg);--visual-math-line-color:#555;--grid-line-subdivision-color:#222;--visual-math-red:#f10000;--visual-math-orange:#f18100;--visual-math-yellow:#f1f100;--visual-math-green:#00f181;--visual-math-blue:#0000f1;--visual-math-indigo:#8100f1;--visual-math-violet:#8100f1;--visual-math-pink:#f18181}"); +} + +function create_fragment(ctx) { + let div; + let svg; + let svg_viewBox_value; + let svg_style_value; + let div_style_value; + let div_resize_listener; + let current; + const default_slot_template = /*#slots*/ ctx[38].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[37], null); + + return { + c() { + div = element("div"); + svg = svg_element("svg"); + if (default_slot) default_slot.c(); + attr(svg, "width", /*actualWidth*/ ctx[2]); + attr(svg, "height", /*actualHeight*/ ctx[3]); + attr(svg, "viewBox", svg_viewBox_value = `${-/*mapX*/ ctx[5](0)} ${-/*mapY*/ ctx[4](0)} ${/*actualWidth*/ ctx[2]} ${/*actualHeight*/ ctx[3]}`); + attr(svg, "preserveAspectRatio", "xMidYMin"); + attr(svg, "style", svg_style_value = `width: ${/*width*/ ctx[0]}; touch-action: ${/*pan*/ ctx[1] ? "none" : "auto"};`); + attr(div, "class", "visual-math svelte-5trppw"); + attr(div, "style", div_style_value = `width: ${/*desiredCssWidth*/ ctx[8]}; height: ${/*desiredCssHeight*/ ctx[7]}`); + add_render_callback(() => /*div_elementresize_handler*/ ctx[40].call(div)); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, svg); + + if (default_slot) { + default_slot.m(svg, null); + } + + /*div_binding*/ ctx[39](div); + div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[40].bind(div)); + current = true; + }, + p(ctx, dirty) { + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 64)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ ctx[37], + !current + ? get_all_dirty_from_scope(/*$$scope*/ ctx[37]) + : get_slot_changes(default_slot_template, /*$$scope*/ ctx[37], dirty, null), + null + ); + } + } + + if (!current || dirty[0] & /*actualWidth*/ 4) { + attr(svg, "width", /*actualWidth*/ ctx[2]); + } + + if (!current || dirty[0] & /*actualHeight*/ 8) { + attr(svg, "height", /*actualHeight*/ ctx[3]); + } + + if (!current || dirty[0] & /*mapX, mapY, actualWidth, actualHeight*/ 60 && svg_viewBox_value !== (svg_viewBox_value = `${-/*mapX*/ ctx[5](0)} ${-/*mapY*/ ctx[4](0)} ${/*actualWidth*/ ctx[2]} ${/*actualHeight*/ ctx[3]}`)) { + attr(svg, "viewBox", svg_viewBox_value); + } + + if (!current || dirty[0] & /*width, pan*/ 3 && svg_style_value !== (svg_style_value = `width: ${/*width*/ ctx[0]}; touch-action: ${/*pan*/ ctx[1] ? "none" : "auto"};`)) { + attr(svg, "style", svg_style_value); + } + + if (!current || dirty[0] & /*desiredCssWidth, desiredCssHeight*/ 384 && div_style_value !== (div_style_value = `width: ${/*desiredCssWidth*/ ctx[8]}; height: ${/*desiredCssHeight*/ ctx[7]}`)) { + attr(div, "style", div_style_value); + } + }, + i(local) { + if (current) return; + transition_in(default_slot, local); + current = true; + }, + o(local) { + transition_out(default_slot, local); + current = false; + }, + d(detaching) { + if (detaching) detach(div); + if (default_slot) default_slot.d(detaching); + /*div_binding*/ ctx[39](null); + div_resize_listener(); + } + }; +} + +const VEC2_0 = vec2.create(); + +function getMouseWheelDirection(e) { + if (typeof e.detail == "number" && e.detail !== 0) { + if (e.detail > 0) { + return -1; + } else if (e.detail < 0) { + return 1; + } + } else if (typeof e.wheelDelta === "number") { + if (e.wheelDelta < 0) { + return -1; + } else if (e.wheelDelta > 0) { + return 1; + } + } + + return undefined; +} + +let base = 2; + +function instance($$self, $$props, $$invalidate) { + let desiredCssWidth; + let desiredCssHeight; + let mapX; + let mapY; + let scaleX; + let scaleY; + let unscaleX; + let unscaleY; + let cssScale; + let xSpan; + let xStep; + let xLowerBound; + let xUpperBound; + let ySpan; + let yStep; + let yLowerBound; + let yUpperBound; + let onDrag; + let onMouseWheel; + let { $$slots: slots = {}, $$scope } = $$props; + let { width = 500 } = $$props; + let { height = 500 } = $$props; + let { pan = true } = $$props; + let { zoom = true } = $$props; + let { xAxisExtent = vec2.fromValues(-5.5, 5.5) } = $$props; + let { yAxisExtent = vec2.fromValues(-5.5, 5.5) } = $$props; + let actualWidth = typeof width === "number" ? width : 500; + let actualHeight = typeof height === "number" ? height : 500; + let zoomAmount = Math.min(xAxisExtent[1] - xAxisExtent[0], yAxisExtent[1] - yAxisExtent[0]); + let offset = vec2.fromValues(0, 0); + let min = vec2.fromValues(xAxisExtent[0], yAxisExtent[0]); + let max = vec2.fromValues(xAxisExtent[1], yAxisExtent[1]); + let span = vec2.create(); + let pixelMatrix = mat2d.create(); + let inversePixelMatrix = mat2d.create(); + let xPanes = []; + let yPanes = []; + let xPaneRange = vec2.create(); + let yPaneRange = vec2.create(); + let panesContext = writable({ xPanes, yPanes, xPaneRange, yPaneRange }); + setPanesContext(panesContext); + + let coordinateContext = writable({ + min, + max, + width: actualWidth, + height: actualHeight + }); + + setCoordinateContext(coordinateContext); + + let scaleContext = writable({ + zoomAmount, + scaleX, + scaleY, + span, + pixelMatrix, + inversePixelMatrix, + cssScale + }); + + setScaleContext(scaleContext); + let mapContext = writable({ mapX, mapY }); + setMapContext(mapContext); + let element; + + onMount(() => { + const dragGesture = new DragGesture(element, onDrag), + wheelGesture = new WheelGesture(element, onMouseWheel); + + return () => { + dragGesture.destroy(); + wheelGesture.destroy(); + }; + }); + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + element = $$value; + $$invalidate(6, element); + }); + } + + function div_elementresize_handler() { + actualWidth = this.offsetWidth; + actualHeight = this.offsetHeight; + $$invalidate(2, actualWidth); + $$invalidate(3, actualHeight); + } + + $$self.$$set = $$props => { + if ('width' in $$props) $$invalidate(0, width = $$props.width); + if ('height' in $$props) $$invalidate(11, height = $$props.height); + if ('pan' in $$props) $$invalidate(1, pan = $$props.pan); + if ('zoom' in $$props) $$invalidate(12, zoom = $$props.zoom); + if ('xAxisExtent' in $$props) $$invalidate(9, xAxisExtent = $$props.xAxisExtent); + if ('yAxisExtent' in $$props) $$invalidate(10, yAxisExtent = $$props.yAxisExtent); + if ('$$scope' in $$props) $$invalidate(37, $$scope = $$props.$$scope); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*width*/ 1) { + $$invalidate(8, desiredCssWidth = width === "auto" ? "100%" : `${width}px`); + } + + if ($$self.$$.dirty[0] & /*height*/ 2048) { + $$invalidate(7, desiredCssHeight = height === "auto" ? "100%" : `${height}px`); + } + + if ($$self.$$.dirty[0] & /*zoom, zoomAmount, xAxisExtent, yAxisExtent*/ 13824) { + onMouseWheel = state => { + if (!zoom || state.last) { + return; + } + + const wheelDirection = getMouseWheelDirection(state.event); + + if (wheelDirection && (zoomAmount > 3 || wheelDirection < 0)) { + $$invalidate(9, xAxisExtent = vec2.set(xAxisExtent, xAxisExtent[0] + wheelDirection, xAxisExtent[1] - wheelDirection)); + $$invalidate(10, yAxisExtent = vec2.set(yAxisExtent, yAxisExtent[0] + wheelDirection, yAxisExtent[1] - wheelDirection)); + $$invalidate(13, zoomAmount = Math.min(xAxisExtent[1] - xAxisExtent[0], yAxisExtent[1] - yAxisExtent[0])); + } + }; + } + + if ($$self.$$.dirty[0] & /*actualWidth, actualHeight, zoomAmount*/ 8204) { + { + const aspect = actualWidth / actualHeight, + halfZoomAmount = zoomAmount * 0.5, + newZoomAmount = zoomAmount * aspect, + halfNewZoomAmount = newZoomAmount * 0.5; + + $$invalidate(9, xAxisExtent[0] = -halfNewZoomAmount, xAxisExtent); + $$invalidate(9, xAxisExtent[1] = halfNewZoomAmount, xAxisExtent); + $$invalidate(10, yAxisExtent[0] = -halfZoomAmount, yAxisExtent); + $$invalidate(10, yAxisExtent[1] = halfZoomAmount, yAxisExtent); + } + } + + if ($$self.$$.dirty[0] & /*pan, actualWidth, xAxisExtent, actualHeight, yAxisExtent*/ 1550) { + onDrag = state => { + if (!pan) { + return; + } + + $$invalidate(14, offset[0] = -state.offset[0] / actualWidth * (xAxisExtent[1] - xAxisExtent[0]), offset); + $$invalidate(14, offset[1] = -state.offset[1] / actualHeight * (yAxisExtent[1] - yAxisExtent[0]), offset); + }; + } + + if ($$self.$$.dirty[0] & /*min, offset, xAxisExtent, yAxisExtent*/ 50688) { + $$invalidate(15, min = vec2.add(min, offset, vec2.set(VEC2_0, xAxisExtent[0], yAxisExtent[0]))); + } + + if ($$self.$$.dirty[0] & /*max, offset, xAxisExtent, yAxisExtent*/ 83456) { + $$invalidate(16, max = vec2.add(max, offset, vec2.set(VEC2_0, xAxisExtent[1], yAxisExtent[1]))); + } + + if ($$self.$$.dirty[0] & /*min, max, actualWidth*/ 98308) { + $$invalidate(5, mapX = x => (x - min[0]) / (max[0] - min[0]) * actualWidth); + } + + if ($$self.$$.dirty[0] & /*min, max, actualHeight*/ 98312) { + $$invalidate(4, mapY = y => (y - min[1]) / (max[1] - min[1]) * actualHeight); + } + + if ($$self.$$.dirty[0] & /*span, max, min*/ 229376) { + $$invalidate(17, span = vec2.sub(span, max, min)); + } + + if ($$self.$$.dirty[0] & /*span, actualWidth*/ 131076) { + $$invalidate(26, scaleX = x => x / span[0] * actualWidth); + } + + if ($$self.$$.dirty[0] & /*span, actualHeight*/ 131080) { + $$invalidate(25, scaleY = y => -y / span[1] * actualHeight); + } + + if ($$self.$$.dirty[0] & /*max, min*/ 98304) { + $$invalidate(34, xSpan = max[0] - min[0]); + } + + if ($$self.$$.dirty[0] & /*actualWidth*/ 4 | $$self.$$.dirty[1] & /*xSpan*/ 8) { + $$invalidate(36, unscaleX = x => x / actualWidth * xSpan); + } + + if ($$self.$$.dirty[0] & /*max, min*/ 98304) { + $$invalidate(30, ySpan = max[1] - min[1]); + } + + if ($$self.$$.dirty[0] & /*actualHeight, ySpan*/ 1073741832) { + $$invalidate(35, unscaleY = y => -y / actualHeight * ySpan); + } + + if ($$self.$$.dirty[0] & /*pixelMatrix, scaleX, scaleY*/ 100925440) { + $$invalidate(18, pixelMatrix = mat2d.fromScaling(pixelMatrix, vec2.set(VEC2_0, scaleX(1), scaleY(1)))); + } + + if ($$self.$$.dirty[0] & /*inversePixelMatrix*/ 524288 | $$self.$$.dirty[1] & /*unscaleX, unscaleY*/ 48) { + $$invalidate(19, inversePixelMatrix = mat2d.fromScaling(inversePixelMatrix, vec2.set(VEC2_0, unscaleX(1), unscaleY(1)))); + } + + if ($$self.$$.dirty[0] & /*scaleX, scaleY*/ 100663296) { + $$invalidate(24, cssScale = `scale(${scaleX(1)} ${scaleY(1)})`); + } + + if ($$self.$$.dirty[1] & /*xSpan*/ 8) { + $$invalidate(33, xStep = Math.pow(base, Math.round(Math.log10(xSpan) / Math.log10(base)))); + } + + if ($$self.$$.dirty[0] & /*min*/ 32768 | $$self.$$.dirty[1] & /*xStep*/ 4) { + $$invalidate(32, xLowerBound = Math.floor(min[0] / xStep) * xStep); + } + + if ($$self.$$.dirty[0] & /*max*/ 65536 | $$self.$$.dirty[1] & /*xStep*/ 4) { + $$invalidate(31, xUpperBound = Math.ceil(max[0] / xStep) * xStep); + } + + if ($$self.$$.dirty[1] & /*xLowerBound, xUpperBound, xStep*/ 7) { + $$invalidate(20, xPanes = range(xLowerBound, xUpperBound, xStep).iter().map(xMin => vec2.fromValues(xMin, xMin + xStep)).toArray()); + } + + if ($$self.$$.dirty[0] & /*xPaneRange*/ 4194304 | $$self.$$.dirty[1] & /*xLowerBound, xUpperBound*/ 3) { + $$invalidate(22, xPaneRange = vec2.set(xPaneRange, xLowerBound, xUpperBound)); + } + + if ($$self.$$.dirty[0] & /*ySpan*/ 1073741824) { + $$invalidate(29, yStep = Math.pow(base, Math.round(Math.log10(ySpan) / Math.log10(base)))); + } + + if ($$self.$$.dirty[0] & /*min, yStep*/ 536903680) { + $$invalidate(28, yLowerBound = Math.floor(min[0] / yStep) * yStep); + } + + if ($$self.$$.dirty[0] & /*max, yStep*/ 536936448) { + $$invalidate(27, yUpperBound = Math.ceil(max[0] / yStep) * yStep); + } + + if ($$self.$$.dirty[0] & /*yLowerBound, yUpperBound, yStep*/ 939524096) { + $$invalidate(21, yPanes = range(yLowerBound, yUpperBound, yStep).iter().map(yMin => vec2.fromValues(yMin, yMin + yStep)).toArray()); + } + + if ($$self.$$.dirty[0] & /*yPaneRange, yLowerBound, yUpperBound*/ 411041792) { + $$invalidate(23, yPaneRange = vec2.set(yPaneRange, yLowerBound, yUpperBound)); + } + + if ($$self.$$.dirty[0] & /*xPanes, yPanes, xPaneRange, yPaneRange*/ 15728640) { + panesContext.set({ xPanes, yPanes, xPaneRange, yPaneRange }); + } + + if ($$self.$$.dirty[0] & /*min, max, actualWidth, actualHeight*/ 98316) { + coordinateContext.set({ + min, + max, + width: actualWidth, + height: actualHeight + }); + } + + if ($$self.$$.dirty[0] & /*zoomAmount, scaleX, scaleY, span, pixelMatrix, inversePixelMatrix, cssScale*/ 118366208) { + scaleContext.set({ + zoomAmount, + scaleX, + scaleY, + span, + pixelMatrix, + inversePixelMatrix, + cssScale + }); + } + + if ($$self.$$.dirty[0] & /*mapX, mapY*/ 48) { + mapContext.set({ mapX, mapY }); + } + }; + + return [ + width, + pan, + actualWidth, + actualHeight, + mapY, + mapX, + element, + desiredCssHeight, + desiredCssWidth, + xAxisExtent, + yAxisExtent, + height, + zoom, + zoomAmount, + offset, + min, + max, + span, + pixelMatrix, + inversePixelMatrix, + xPanes, + yPanes, + xPaneRange, + yPaneRange, + cssScale, + scaleY, + scaleX, + yUpperBound, + yLowerBound, + yStep, + ySpan, + xUpperBound, + xLowerBound, + xStep, + xSpan, + unscaleY, + unscaleX, + $$scope, + slots, + div_binding, + div_elementresize_handler + ]; +} + +class VisualMath extends SvelteComponent { + constructor(options) { + super(); + + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + width: 0, + height: 11, + pan: 1, + zoom: 12, + xAxisExtent: 9, + yAxisExtent: 10 + }, + add_css, + [-1, -1] + ); + } + + get width() { + return this.$$.ctx[0]; + } + + set width(width) { + this.$$set({ width }); + flush(); + } + + get height() { + return this.$$.ctx[11]; + } + + set height(height) { + this.$$set({ height }); + flush(); + } + + get pan() { + return this.$$.ctx[1]; + } + + set pan(pan) { + this.$$set({ pan }); + flush(); + } + + get zoom() { + return this.$$.ctx[12]; + } + + set zoom(zoom) { + this.$$set({ zoom }); + flush(); + } + + get xAxisExtent() { + return this.$$.ctx[9]; + } + + set xAxisExtent(xAxisExtent) { + this.$$set({ xAxisExtent }); + flush(); + } + + get yAxisExtent() { + return this.$$.ctx[10]; + } + + set yAxisExtent(yAxisExtent) { + this.$$set({ yAxisExtent }); + flush(); + } +} + +export { VisualMath as default }; +//# sourceMappingURL=VisualMath.svelte.js.map diff --git a/esm/VisualMath.svelte.js.map b/esm/VisualMath.svelte.js.map new file mode 100644 index 0000000..e8d1196 --- /dev/null +++ b/esm/VisualMath.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"VisualMath.svelte.js","sources":["../src/VisualMath.svelte"],"sourcesContent":["\n\n\n\n\n \n \n \n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCA4PW,GAAW;wCACV,GAAY;yDACP,GAAI,IAAC,CAAC,eAAM,GAAI,IAAC,CAAC,qBAAK,GAAW,wBAAI,GAAY;;4DAE9C,GAAK,8BAAmB,GAAG,MAAG,MAAM,GAAG,MAAM;;sEAP/C,GAAe,qCAAa,GAAgB;;;;GAL/D,MAgBK;GATH,MAQK;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAPI,GAAW;;;;yCACV,GAAY;;;sIACP,GAAI,IAAC,CAAC,eAAM,GAAI,IAAC,CAAC,qBAAK,GAAW,wBAAI,GAAY;;;;6GAE9C,GAAK,8BAAmB,GAAG,MAAG,MAAM,GAAG,MAAM;;;;gJAP/C,GAAe,qCAAa,GA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/XLabels.svelte.js b/esm/XLabels.svelte.js new file mode 100644 index 0000000..f052d01 --- /dev/null +++ b/esm/XLabels.svelte.js @@ -0,0 +1,186 @@ +import { SvelteComponent, init, safe_not_equal, flush, append_styles, svg_element, text, attr, insert, append, set_data, detach, noop, destroy_each, component_subscribe } from 'svelte/internal'; +import { getScaleContext, getPanesContext, snappedRange } from './math.js'; + +/* src/XLabels.svelte generated by Svelte v3.42.4 */ + +function add_css(target) { + append_styles(target, "svelte-133qdtd", "g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75}"); +} + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i]; + return child_ctx; +} + +// (12:2) {#each xs as x} +function create_each_block(ctx) { + let text_1; + + let t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*x*/ ctx[9]) + : /*x*/ ctx[9]) + ""; + + let t; + let text_1_x_value; + let text_1_y_value; + + return { + c() { + text_1 = svg_element("text"); + t = text(t_value); + attr(text_1, "x", text_1_x_value = /*scaleX*/ ctx[1](/*x*/ ctx[9])); + attr(text_1, "y", text_1_y_value = 5); + attr(text_1, "alignment-baseline", "hanging"); + attr(text_1, "text-anchor", "middle"); + }, + m(target, anchor) { + insert(target, text_1, anchor); + append(text_1, t); + }, + p(ctx, dirty) { + if (dirty & /*labelMaker, xs*/ 5 && t_value !== (t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*x*/ ctx[9]) + : /*x*/ ctx[9]) + "")) set_data(t, t_value); + + if (dirty & /*scaleX, xs*/ 6 && text_1_x_value !== (text_1_x_value = /*scaleX*/ ctx[1](/*x*/ ctx[9]))) { + attr(text_1, "x", text_1_x_value); + } + }, + d(detaching) { + if (detaching) detach(text_1); + } + }; +} + +function create_fragment(ctx) { + let g; + let each_value = /*xs*/ ctx[2]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + return { + c() { + g = svg_element("g"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(g, "class", "svelte-133qdtd"); + }, + m(target, anchor) { + insert(target, g, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(g, null); + } + }, + p(ctx, [dirty]) { + if (dirty & /*scaleX, xs, labelMaker*/ 7) { + each_value = /*xs*/ ctx[2]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(g, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + destroy_each(each_blocks, detaching); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let scaleX; + let xPanes; + let xs; + let $panesContext; + let $scaleContext; + let { separation } = $$props; + let { labelMaker } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(8, $scaleContext = value)); + let panesContext = getPanesContext(); + component_subscribe($$self, panesContext, value => $$invalidate(7, $panesContext = value)); + + $$self.$$set = $$props => { + if ('separation' in $$props) $$invalidate(5, separation = $$props.separation); + if ('labelMaker' in $$props) $$invalidate(0, labelMaker = $$props.labelMaker); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 256) { + $$invalidate(1, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$panesContext*/ 128) { + $$invalidate(6, xPanes = $panesContext.xPanes); + } + + if ($$self.$$.dirty & /*xPanes, separation, scaleX*/ 98) { + $$invalidate(2, xs = snappedRange(xPanes[0][0] - separation, xPanes[xPanes.length - 1][1] + separation, separation).filter(x => Math.abs(scaleX(x) - scaleX(0)) > 1)); + } + }; + + return [ + labelMaker, + scaleX, + xs, + scaleContext, + panesContext, + separation, + xPanes, + $panesContext, + $scaleContext + ]; +} + +class XLabels extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { separation: 5, labelMaker: 0 }, add_css); + } + + get separation() { + return this.$$.ctx[5]; + } + + set separation(separation) { + this.$$set({ separation }); + flush(); + } + + get labelMaker() { + return this.$$.ctx[0]; + } + + set labelMaker(labelMaker) { + this.$$set({ labelMaker }); + flush(); + } +} + +export { XLabels as default }; +//# sourceMappingURL=XLabels.svelte.js.map diff --git a/esm/XLabels.svelte.js.map b/esm/XLabels.svelte.js.map new file mode 100644 index 0000000..b8f4f02 --- /dev/null +++ b/esm/XLabels.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"XLabels.svelte.js","sources":["../src/XLabels.svelte"],"sourcesContent":["\n\n\n {#each xs as x}\n \n {labelMaker ? labelMaker(x) : x}\n \n {/each}\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;+BAuBO,GAAU;kBAAG,GAAU,UAAC,GAAC;SAAI,GAAC;;;;;;;;;;iDADxB,GAAM,UAAC,GAAC;sCAAM,CAAC;;;;;GAAxB,MAEM;;;;8EADH,GAAU;oBAAG,GAAU,UAAC,GAAC;WAAI,GAAC;;mFADxB,GAAM,UAAC,GAAC;;;;;;;;;;;;yBADZ,GAAE;;;gCAAP,MAAI;;;;;;;;;;;;;;;GADR,MAMG;;;;;;;;wBALM,GAAE;;;+BAAP,MAAI;;;;;;;;;;;;;;;;oCAAJ,MAAI;;;;;;;;;;;;;;;;;;OAjBR,UAAA;OACA,UAAA;KAEA,YAAA,GAAA,eAAA;;KACA,YAAA,GAAA,eAAA;;;;;;;;;;mBAEA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;mBACA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;mBAEA,EAAA,GAAA,YAAA,CAAA,MAAA,CAAA,CAAA,EAAA,CAAA,IAAA,UAAA,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,GAAA,CAAA,EAAA,CAAA,IAAA,UAAA,EAAA,UAAA,EAAA,MAAA,CAAA,CAAA,IAAA,IAAA,CAAA,GAAA,CAAA,MAAA,CAAA,CAAA,IAAA,MAAA,CAAA,CAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/YLabels.svelte.js b/esm/YLabels.svelte.js new file mode 100644 index 0000000..1008297 --- /dev/null +++ b/esm/YLabels.svelte.js @@ -0,0 +1,185 @@ +import { SvelteComponent, init, safe_not_equal, flush, append_styles, svg_element, text, attr, insert, append, set_data, detach, noop, destroy_each, component_subscribe } from 'svelte/internal'; +import { getScaleContext, getPanesContext, snappedRange } from './math.js'; + +/* src/YLabels.svelte generated by Svelte v3.42.4 */ + +function add_css(target) { + append_styles(target, "svelte-133qdtd", "g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75}"); +} + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i]; + return child_ctx; +} + +// (12:2) {#each ys as y} +function create_each_block(ctx) { + let text_1; + + let t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*y*/ ctx[9]) + : /*y*/ ctx[9]) + ""; + + let t; + let text_1_x_value; + let text_1_y_value; + + return { + c() { + text_1 = svg_element("text"); + t = text(t_value); + attr(text_1, "x", text_1_x_value = 5); + attr(text_1, "y", text_1_y_value = /*scaleY*/ ctx[1](/*y*/ ctx[9])); + attr(text_1, "alignment-baseline", "central"); + }, + m(target, anchor) { + insert(target, text_1, anchor); + append(text_1, t); + }, + p(ctx, dirty) { + if (dirty & /*labelMaker, ys*/ 5 && t_value !== (t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*y*/ ctx[9]) + : /*y*/ ctx[9]) + "")) set_data(t, t_value); + + if (dirty & /*scaleY, ys*/ 6 && text_1_y_value !== (text_1_y_value = /*scaleY*/ ctx[1](/*y*/ ctx[9]))) { + attr(text_1, "y", text_1_y_value); + } + }, + d(detaching) { + if (detaching) detach(text_1); + } + }; +} + +function create_fragment(ctx) { + let g; + let each_value = /*ys*/ ctx[2]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + return { + c() { + g = svg_element("g"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(g, "class", "svelte-133qdtd"); + }, + m(target, anchor) { + insert(target, g, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(g, null); + } + }, + p(ctx, [dirty]) { + if (dirty & /*scaleY, ys, labelMaker*/ 7) { + each_value = /*ys*/ ctx[2]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(g, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + destroy_each(each_blocks, detaching); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let scaleY; + let yPanes; + let ys; + let $panesContext; + let $scaleContext; + let { separation } = $$props; + let { labelMaker } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(8, $scaleContext = value)); + let panesContext = getPanesContext(); + component_subscribe($$self, panesContext, value => $$invalidate(7, $panesContext = value)); + + $$self.$$set = $$props => { + if ('separation' in $$props) $$invalidate(5, separation = $$props.separation); + if ('labelMaker' in $$props) $$invalidate(0, labelMaker = $$props.labelMaker); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 256) { + $$invalidate(1, scaleY = $scaleContext.scaleY); + } + + if ($$self.$$.dirty & /*$panesContext*/ 128) { + $$invalidate(6, yPanes = $panesContext.yPanes); + } + + if ($$self.$$.dirty & /*yPanes, separation, scaleY*/ 98) { + $$invalidate(2, ys = snappedRange(yPanes[0][0] - separation, yPanes[yPanes.length - 1][1] + separation, separation).filter(y => Math.abs(scaleY(y) - scaleY(0)) > 1)); + } + }; + + return [ + labelMaker, + scaleY, + ys, + scaleContext, + panesContext, + separation, + yPanes, + $panesContext, + $scaleContext + ]; +} + +class YLabels extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { separation: 5, labelMaker: 0 }, add_css); + } + + get separation() { + return this.$$.ctx[5]; + } + + set separation(separation) { + this.$$set({ separation }); + flush(); + } + + get labelMaker() { + return this.$$.ctx[0]; + } + + set labelMaker(labelMaker) { + this.$$set({ labelMaker }); + flush(); + } +} + +export { YLabels as default }; +//# sourceMappingURL=YLabels.svelte.js.map diff --git a/esm/YLabels.svelte.js.map b/esm/YLabels.svelte.js.map new file mode 100644 index 0000000..e88ac2c --- /dev/null +++ b/esm/YLabels.svelte.js.map @@ -0,0 +1 @@ +{"version":3,"file":"YLabels.svelte.js","sources":["../src/YLabels.svelte"],"sourcesContent":["\n\n\n {#each ys as y}\n \n {labelMaker ? labelMaker(y) : y}\n \n {/each}\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;+BAuBO,GAAU;kBAAG,GAAU,UAAC,GAAC;SAAI,GAAC;;;;;;;;;;sCADxB,CAAC;iDAAK,GAAM,UAAC,GAAC;;;;GAAvB,MAEM;;;;8EADH,GAAU;oBAAG,GAAU,UAAC,GAAC;WAAI,GAAC;;mFADlB,GAAM,UAAC,GAAC;;;;;;;;;;;;yBADlB,GAAE;;;gCAAP,MAAI;;;;;;;;;;;;;;;GADR,MAMG;;;;;;;;wBALM,GAAE;;;+BAAP,MAAI;;;;;;;;;;;;;;;;oCAAJ,MAAI;;;;;;;;;;;;;;;;;;OAjBR,UAAA;OACA,UAAA;KAEA,YAAA,GAAA,eAAA;;KACA,YAAA,GAAA,eAAA;;;;;;;;;;mBAEA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;mBACA,MAAA,GAAA,aAAA,CAAA,MAAA;;;;mBAEA,EAAA,GAAA,YAAA,CAAA,MAAA,CAAA,CAAA,EAAA,CAAA,IAAA,UAAA,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,GAAA,CAAA,EAAA,CAAA,IAAA,UAAA,EAAA,UAAA,EAAA,MAAA,CAAA,CAAA,IAAA,IAAA,CAAA,GAAA,CAAA,MAAA,CAAA,CAAA,IAAA,MAAA,CAAA,CAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/index.js b/esm/index.js new file mode 100644 index 0000000..3fb34df --- /dev/null +++ b/esm/index.js @@ -0,0 +1,14 @@ +export { default as CartesianCoordinates } from './CartesianCoordinates.svelte.js'; +export { default as Circle } from './Circle.svelte.js'; +export { default as Ellipse } from './Ellipse.svelte.js'; +export { default as GridPattern } from './GridPattern.svelte.js'; +export { getCoordinateContext, getMapContext, getPanesContext, getScaleContext, snappedRange } from './math.js'; +export { default as MovablePoint } from './MovablePoint.svelte.js'; +export { default as Point } from './Point.svelte.js'; +export { default as PointAngle } from './PointAngle.svelte.js'; +export { default as PointSlope } from './PointSlope.svelte.js'; +export { default as ThroughPoints } from './ThroughPoints.svelte.js'; +export { default as VisualMath } from './VisualMath.svelte.js'; +export { default as XLabels } from './XLabels.svelte.js'; +export { default as YLabels } from './YLabels.svelte.js'; +//# sourceMappingURL=index.js.map diff --git a/esm/index.js.map b/esm/index.js.map new file mode 100644 index 0000000..dff53ae --- /dev/null +++ b/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"} \ No newline at end of file diff --git a/esm/math.js b/esm/math.js new file mode 100644 index 0000000..af7e9ba --- /dev/null +++ b/esm/math.js @@ -0,0 +1,39 @@ +import { range } from '@aicacia/core'; +import { getContext, setContext } from 'svelte'; + +const SCALE_CONTEXT_KEY = {}; +function getScaleContext() { + return getContext(SCALE_CONTEXT_KEY); +} +function setScaleContext(context) { + setContext(SCALE_CONTEXT_KEY, context); +} +const COORDINATE_CONTEXT_KEY = {}; +function getCoordinateContext() { + return getContext(COORDINATE_CONTEXT_KEY); +} +function setCoordinateContext(context) { + setContext(COORDINATE_CONTEXT_KEY, context); +} +const MAP_CONTEXT_KEY = {}; +function getMapContext() { + return getContext(MAP_CONTEXT_KEY); +} +function setMapContext(context) { + setContext(MAP_CONTEXT_KEY, context); +} +const PANES_CONTEXT_KEY = {}; +function getPanesContext() { + return getContext(PANES_CONTEXT_KEY); +} +function setPanesContext(context) { + setContext(PANES_CONTEXT_KEY, context); +} +function snappedRange(min, max, step) { + return range(Math.floor(min / step) * step, Math.ceil(max / step) * step, step) + .iter() + .toArray(); +} + +export { getCoordinateContext, getMapContext, getPanesContext, getScaleContext, setCoordinateContext, setMapContext, setPanesContext, setScaleContext, snappedRange }; +//# sourceMappingURL=math.js.map diff --git a/esm/math.js.map b/esm/math.js.map new file mode 100644 index 0000000..3957385 --- /dev/null +++ b/esm/math.js.map @@ -0,0 +1 @@ +{"version":3,"file":"math.js","sources":["../src/math.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAcA,MAAM,iBAAiB,GAAG,EAAE,CAAC;SAUb,eAAe;IAC7B,OAAO,UAAU,CAA0B,iBAAiB,CAAC,CAAC;AAChE,CAAC;SACe,eAAe,CAAC,OAAgC;IAC9D,UAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,sBAAsB,GAAG,EAAE,CAAC;SAOlB,oBAAoB;IAClC,OAAO,UAAU,CAA+B,sBAAsB,CAAC,CAAC;AAC1E,CAAC;SACe,oBAAoB,CAAC,OAAqC;IACxE,UAAU,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,eAAe,GAAG,EAAE,CAAC;SAKX,aAAa;IAC3B,OAAO,UAAU,CAAwB,eAAe,CAAC,CAAC;AAC5D,CAAC;SACe,aAAa,CAAC,OAA8B;IAC1D,UAAU,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,iBAAiB,GAAG,EAAE,CAAC;SAOb,eAAe;IAC7B,OAAO,UAAU,CAA0B,iBAAiB,CAAC,CAAC;AAChE,CAAC;SACe,eAAe,CAAC,OAAgC;IAC9D,UAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;SAEe,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,IAAY;IACjE,OAAO,KAAK,CACV,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAC5B,IAAI,CACL;SACE,IAAI,EAAE;SACN,OAAO,EAAE,CAAC;AACf;;;;"} \ No newline at end of file diff --git a/example/vite.config.js b/example/vite.config.js index 213507d..977d229 100644 --- a/example/vite.config.js +++ b/example/vite.config.js @@ -28,9 +28,6 @@ export default defineConfig({ exclude: Object.keys(imports), include: [], }, - build: { - minify: false, - }, plugins: [ { ...esmImportToUrl({ diff --git a/styles/index.css b/styles/index.css new file mode 100644 index 0000000..2d41d3c --- /dev/null +++ b/styles/index.css @@ -0,0 +1,5 @@ +g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75} +g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75} +line.svelte-xqsvde{stroke:var(--visual-math-origin-color)} +ellipse.svelte-cc8k9r{vector-effect:non-scaling-stroke} +.visual-math.svelte-5trppw{display:block;background:var(--visual-math-bg);overflow:hidden;user-select:none;font-family:sans-serif;font-variant-numeric:tabular-nums;--visual-math-bg:#f1f1f1;--visual-math-fg:black;--visual-math-origin-color:var(--visual-math-fg);--visual-math-line-color:#555;--grid-line-subdivision-color:#222;--visual-math-red:#f10000;--visual-math-orange:#f18100;--visual-math-yellow:#f1f100;--visual-math-green:#00f181;--visual-math-blue:#0000f1;--visual-math-indigo:#8100f1;--visual-math-violet:#8100f1;--visual-math-pink:#f18181} \ No newline at end of file diff --git a/styles/index.js b/styles/index.js new file mode 100644 index 0000000..8447836 --- /dev/null +++ b/styles/index.js @@ -0,0 +1,2549 @@ +import { SvelteComponent, init, safe_not_equal, svg_element, text, attr, insert, append, set_data, detach, noop, destroy_each, component_subscribe, empty, create_component, mount_component, transition_in, transition_out, destroy_component, space, group_outros, check_outros, assign, set_svg_attributes, toggle_class, get_spread_update, compute_rest_props, exclude_internal_props, get_spread_object, binding_callbacks, create_slot, element, add_render_callback, add_resize_listener, update_slot_base, get_all_dirty_from_scope, get_slot_changes } from 'svelte/internal'; +import { range } from '@aicacia/core'; +import { getContext, setContext, onMount } from 'svelte'; +import { vec2, mat2d } from 'gl-matrix'; +import { DragGesture, WheelGesture } from '@use-gesture/vanilla'; +import { writable } from 'svelte/store'; + +const SCALE_CONTEXT_KEY = {}; +function getScaleContext() { + return getContext(SCALE_CONTEXT_KEY); +} +function setScaleContext(context) { + setContext(SCALE_CONTEXT_KEY, context); +} +const COORDINATE_CONTEXT_KEY = {}; +function getCoordinateContext() { + return getContext(COORDINATE_CONTEXT_KEY); +} +function setCoordinateContext(context) { + setContext(COORDINATE_CONTEXT_KEY, context); +} +const MAP_CONTEXT_KEY = {}; +function getMapContext() { + return getContext(MAP_CONTEXT_KEY); +} +function setMapContext(context) { + setContext(MAP_CONTEXT_KEY, context); +} +const PANES_CONTEXT_KEY = {}; +function getPanesContext() { + return getContext(PANES_CONTEXT_KEY); +} +function setPanesContext(context) { + setContext(PANES_CONTEXT_KEY, context); +} +function snappedRange(min, max, step) { + return range(Math.floor(min / step) * step, Math.ceil(max / step) * step, step) + .iter() + .toArray(); +} + +/* src/XLabels.svelte generated by Svelte v3.42.4 */ + +function get_each_context$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i]; + return child_ctx; +} + +// (12:2) {#each xs as x} +function create_each_block$2(ctx) { + let text_1; + + let t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*x*/ ctx[9]) + : /*x*/ ctx[9]) + ""; + + let t; + let text_1_x_value; + let text_1_y_value; + + return { + c() { + text_1 = svg_element("text"); + t = text(t_value); + attr(text_1, "x", text_1_x_value = /*scaleX*/ ctx[1](/*x*/ ctx[9])); + attr(text_1, "y", text_1_y_value = 5); + attr(text_1, "alignment-baseline", "hanging"); + attr(text_1, "text-anchor", "middle"); + }, + m(target, anchor) { + insert(target, text_1, anchor); + append(text_1, t); + }, + p(ctx, dirty) { + if (dirty & /*labelMaker, xs*/ 5 && t_value !== (t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*x*/ ctx[9]) + : /*x*/ ctx[9]) + "")) set_data(t, t_value); + + if (dirty & /*scaleX, xs*/ 6 && text_1_x_value !== (text_1_x_value = /*scaleX*/ ctx[1](/*x*/ ctx[9]))) { + attr(text_1, "x", text_1_x_value); + } + }, + d(detaching) { + if (detaching) detach(text_1); + } + }; +} + +function create_fragment$b(ctx) { + let g; + let each_value = /*xs*/ ctx[2]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); + } + + return { + c() { + g = svg_element("g"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(g, "class", "svelte-133qdtd"); + }, + m(target, anchor) { + insert(target, g, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(g, null); + } + }, + p(ctx, [dirty]) { + if (dirty & /*scaleX, xs, labelMaker*/ 7) { + each_value = /*xs*/ ctx[2]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$2(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block$2(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(g, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + destroy_each(each_blocks, detaching); + } + }; +} + +function instance$b($$self, $$props, $$invalidate) { + let scaleX; + let xPanes; + let xs; + let $panesContext; + let $scaleContext; + let { separation } = $$props; + let { labelMaker } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(8, $scaleContext = value)); + let panesContext = getPanesContext(); + component_subscribe($$self, panesContext, value => $$invalidate(7, $panesContext = value)); + + $$self.$$set = $$props => { + if ('separation' in $$props) $$invalidate(5, separation = $$props.separation); + if ('labelMaker' in $$props) $$invalidate(0, labelMaker = $$props.labelMaker); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 256) { + $$invalidate(1, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$panesContext*/ 128) { + $$invalidate(6, xPanes = $panesContext.xPanes); + } + + if ($$self.$$.dirty & /*xPanes, separation, scaleX*/ 98) { + $$invalidate(2, xs = snappedRange(xPanes[0][0] - separation, xPanes[xPanes.length - 1][1] + separation, separation).filter(x => Math.abs(scaleX(x) - scaleX(0)) > 1)); + } + }; + + return [ + labelMaker, + scaleX, + xs, + scaleContext, + panesContext, + separation, + xPanes, + $panesContext, + $scaleContext + ]; +} + +class XLabels extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$b, create_fragment$b, safe_not_equal, { separation: 5, labelMaker: 0 }); + } +} + +/* src/YLabels.svelte generated by Svelte v3.42.4 */ + +function get_each_context$1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i]; + return child_ctx; +} + +// (12:2) {#each ys as y} +function create_each_block$1(ctx) { + let text_1; + + let t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*y*/ ctx[9]) + : /*y*/ ctx[9]) + ""; + + let t; + let text_1_x_value; + let text_1_y_value; + + return { + c() { + text_1 = svg_element("text"); + t = text(t_value); + attr(text_1, "x", text_1_x_value = 5); + attr(text_1, "y", text_1_y_value = /*scaleY*/ ctx[1](/*y*/ ctx[9])); + attr(text_1, "alignment-baseline", "central"); + }, + m(target, anchor) { + insert(target, text_1, anchor); + append(text_1, t); + }, + p(ctx, dirty) { + if (dirty & /*labelMaker, ys*/ 5 && t_value !== (t_value = (/*labelMaker*/ ctx[0] + ? /*labelMaker*/ ctx[0](/*y*/ ctx[9]) + : /*y*/ ctx[9]) + "")) set_data(t, t_value); + + if (dirty & /*scaleY, ys*/ 6 && text_1_y_value !== (text_1_y_value = /*scaleY*/ ctx[1](/*y*/ ctx[9]))) { + attr(text_1, "y", text_1_y_value); + } + }, + d(detaching) { + if (detaching) detach(text_1); + } + }; +} + +function create_fragment$a(ctx) { + let g; + let each_value = /*ys*/ ctx[2]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); + } + + return { + c() { + g = svg_element("g"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(g, "class", "svelte-133qdtd"); + }, + m(target, anchor) { + insert(target, g, anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(g, null); + } + }, + p(ctx, [dirty]) { + if (dirty & /*scaleY, ys, labelMaker*/ 7) { + each_value = /*ys*/ ctx[2]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$1(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block$1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(g, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + destroy_each(each_blocks, detaching); + } + }; +} + +function instance$a($$self, $$props, $$invalidate) { + let scaleY; + let yPanes; + let ys; + let $panesContext; + let $scaleContext; + let { separation } = $$props; + let { labelMaker } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(8, $scaleContext = value)); + let panesContext = getPanesContext(); + component_subscribe($$self, panesContext, value => $$invalidate(7, $panesContext = value)); + + $$self.$$set = $$props => { + if ('separation' in $$props) $$invalidate(5, separation = $$props.separation); + if ('labelMaker' in $$props) $$invalidate(0, labelMaker = $$props.labelMaker); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 256) { + $$invalidate(1, scaleY = $scaleContext.scaleY); + } + + if ($$self.$$.dirty & /*$panesContext*/ 128) { + $$invalidate(6, yPanes = $panesContext.yPanes); + } + + if ($$self.$$.dirty & /*yPanes, separation, scaleY*/ 98) { + $$invalidate(2, ys = snappedRange(yPanes[0][0] - separation, yPanes[yPanes.length - 1][1] + separation, separation).filter(y => Math.abs(scaleY(y) - scaleY(0)) > 1)); + } + }; + + return [ + labelMaker, + scaleY, + ys, + scaleContext, + panesContext, + separation, + yPanes, + $panesContext, + $scaleContext + ]; +} + +class YLabels extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$a, create_fragment$a, safe_not_equal, { separation: 5, labelMaker: 0 }); + } +} + +/* src/GridPattern.svelte generated by Svelte v3.42.4 */ + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[16] = list[i]; + return child_ctx; +} + +// (30:2) {#each xs as x} +function create_each_block_1(ctx) { + let line; + let line_x__value; + let line_y__value; + let line_x__value_1; + let line_style_value; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = /*x*/ ctx[16]); + attr(line, "y1", line_y__value = 0); + attr(line, "x2", line_x__value_1 = /*x*/ ctx[16]); + attr(line, "y2", /*height*/ ctx[3]); + attr(line, "style", line_style_value = `stroke: var(--grid-line-subdivision-color)`); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, dirty) { + if (dirty & /*xs*/ 32 && line_x__value !== (line_x__value = /*x*/ ctx[16])) { + attr(line, "x1", line_x__value); + } + + if (dirty & /*xs*/ 32 && line_x__value_1 !== (line_x__value_1 = /*x*/ ctx[16])) { + attr(line, "x2", line_x__value_1); + } + + if (dirty & /*height*/ 8) { + attr(line, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (39:2) {#each ys as y} +function create_each_block(ctx) { + let line; + let line_y__value; + let line_x__value; + let line_y__value_1; + let line_style_value; + + return { + c() { + line = svg_element("line"); + attr(line, "y1", line_y__value = /*y*/ ctx[13]); + attr(line, "x1", line_x__value = 0); + attr(line, "y2", line_y__value_1 = /*y*/ ctx[13]); + attr(line, "x2", /*width*/ ctx[4]); + attr(line, "style", line_style_value = `stroke: var(--grid-line-subdivision-color)`); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, dirty) { + if (dirty & /*ys*/ 64 && line_y__value !== (line_y__value = /*y*/ ctx[13])) { + attr(line, "y1", line_y__value); + } + + if (dirty & /*ys*/ 64 && line_y__value_1 !== (line_y__value_1 = /*y*/ ctx[13])) { + attr(line, "y2", line_y__value_1); + } + + if (dirty & /*width*/ 16) { + attr(line, "x2", /*width*/ ctx[4]); + } + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (49:2) {#if xLines} +function create_if_block_1$1(ctx) { + let line0; + let line0_x__value; + let line0_y__value; + let line0_x__value_1; + let line0_style_value; + let line1; + let line1_y__value; + let line1_style_value; + + return { + c() { + line0 = svg_element("line"); + line1 = svg_element("line"); + attr(line0, "x1", line0_x__value = 0); + attr(line0, "y1", line0_y__value = 0); + attr(line0, "x2", line0_x__value_1 = 0); + attr(line0, "y2", /*height*/ ctx[3]); + attr(line0, "style", line0_style_value = `stroke: var(--visual-math-line-color)`); + attr(line1, "x1", /*width*/ ctx[4]); + attr(line1, "y1", line1_y__value = 0); + attr(line1, "x2", /*width*/ ctx[4]); + attr(line1, "y2", /*height*/ ctx[3]); + attr(line1, "style", line1_style_value = `stroke: var(--visual-math-line-color)`); + }, + m(target, anchor) { + insert(target, line0, anchor); + insert(target, line1, anchor); + }, + p(ctx, dirty) { + if (dirty & /*height*/ 8) { + attr(line0, "y2", /*height*/ ctx[3]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x1", /*width*/ ctx[4]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line0); + if (detaching) detach(line1); + } + }; +} + +// (65:2) {#if yLines} +function create_if_block$1(ctx) { + let line0; + let line0_x__value; + let line0_y__value; + let line0_y__value_1; + let line0_style_value; + let line1; + let line1_x__value; + let line1_style_value; + + return { + c() { + line0 = svg_element("line"); + line1 = svg_element("line"); + attr(line0, "x1", line0_x__value = 0); + attr(line0, "y1", line0_y__value = 0); + attr(line0, "x2", /*width*/ ctx[4]); + attr(line0, "y2", line0_y__value_1 = 0); + attr(line0, "style", line0_style_value = `stroke: var(--visual-math-line-color)`); + attr(line1, "x1", line1_x__value = 0); + attr(line1, "y1", /*height*/ ctx[3]); + attr(line1, "x2", /*width*/ ctx[4]); + attr(line1, "y2", /*height*/ ctx[3]); + attr(line1, "style", line1_style_value = `stroke: var(--visual-math-line-color)`); + }, + m(target, anchor) { + insert(target, line0, anchor); + insert(target, line1, anchor); + }, + p(ctx, dirty) { + if (dirty & /*width*/ 16) { + attr(line0, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y1", /*height*/ ctx[3]); + } + + if (dirty & /*width*/ 16) { + attr(line1, "x2", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(line1, "y2", /*height*/ ctx[3]); + } + }, + d(detaching) { + if (detaching) detach(line0); + if (detaching) detach(line1); + } + }; +} + +function create_fragment$9(ctx) { + let pattern; + let each0_anchor; + let each1_anchor; + let if_block0_anchor; + let each_value_1 = /*xs*/ ctx[5]; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + + let each_value = /*ys*/ ctx[6]; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + let if_block0 = /*xLines*/ ctx[1] && create_if_block_1$1(ctx); + let if_block1 = /*yLines*/ ctx[2] && create_if_block$1(ctx); + + return { + c() { + pattern = svg_element("pattern"); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + each0_anchor = empty(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + each1_anchor = empty(); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + attr(pattern, "id", /*id*/ ctx[0]); + attr(pattern, "x", "0"); + attr(pattern, "y", "0"); + attr(pattern, "width", /*width*/ ctx[4]); + attr(pattern, "height", /*height*/ ctx[3]); + attr(pattern, "patternUnits", "userSpaceOnUse"); + }, + m(target, anchor) { + insert(target, pattern, anchor); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(pattern, null); + } + + append(pattern, each0_anchor); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(pattern, null); + } + + append(pattern, each1_anchor); + if (if_block0) if_block0.m(pattern, null); + append(pattern, if_block0_anchor); + if (if_block1) if_block1.m(pattern, null); + }, + p(ctx, [dirty]) { + if (dirty & /*xs, height*/ 40) { + each_value_1 = /*xs*/ ctx[5]; + let i; + + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx, each_value_1, i); + + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_1(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(pattern, each0_anchor); + } + } + + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + + each_blocks_1.length = each_value_1.length; + } + + if (dirty & /*ys, width*/ 80) { + each_value = /*ys*/ ctx[6]; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(pattern, each1_anchor); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + + if (/*xLines*/ ctx[1]) { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_1$1(ctx); + if_block0.c(); + if_block0.m(pattern, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if (/*yLines*/ ctx[2]) { + if (if_block1) { + if_block1.p(ctx, dirty); + } else { + if_block1 = create_if_block$1(ctx); + if_block1.c(); + if_block1.m(pattern, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if (dirty & /*id*/ 1) { + attr(pattern, "id", /*id*/ ctx[0]); + } + + if (dirty & /*width*/ 16) { + attr(pattern, "width", /*width*/ ctx[4]); + } + + if (dirty & /*height*/ 8) { + attr(pattern, "height", /*height*/ ctx[3]); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(pattern); + destroy_each(each_blocks_1, detaching); + destroy_each(each_blocks, detaching); + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} + +function instance$9($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + let width; + let height; + let $context; + let { id } = $$props; + let { xLines = 1 } = $$props; + let { yLines = 1 } = $$props; + let { xSubdivisions = 1 } = $$props; + let { ySubdivisions = 1 } = $$props; + let context = getScaleContext(); + component_subscribe($$self, context, value => $$invalidate(12, $context = value)); + let xs = []; + let ys = []; + + $$self.$$set = $$props => { + if ('id' in $$props) $$invalidate(0, id = $$props.id); + if ('xLines' in $$props) $$invalidate(1, xLines = $$props.xLines); + if ('yLines' in $$props) $$invalidate(2, yLines = $$props.yLines); + if ('xSubdivisions' in $$props) $$invalidate(8, xSubdivisions = $$props.xSubdivisions); + if ('ySubdivisions' in $$props) $$invalidate(9, ySubdivisions = $$props.ySubdivisions); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$context*/ 4096) { + $$invalidate(11, scaleX = $context.scaleX); + } + + if ($$self.$$.dirty & /*$context*/ 4096) { + $$invalidate(10, scaleY = $context.scaleY); + } + + if ($$self.$$.dirty & /*scaleX, xLines*/ 2050) { + $$invalidate(4, width = scaleX(xLines || 1)); + } + + if ($$self.$$.dirty & /*scaleY, yLines*/ 1028) { + $$invalidate(3, height = -scaleY(yLines || 1)); + } + + if ($$self.$$.dirty & /*xSubdivisions, width*/ 272) { + if (xSubdivisions && xSubdivisions > 1) { + const pixelXDistance = width / xSubdivisions; + $$invalidate(5, xs = range(0, width + pixelXDistance * 1.1, pixelXDistance).iter().toArray()); + } + } + + if ($$self.$$.dirty & /*ySubdivisions, height*/ 520) { + if (ySubdivisions && ySubdivisions > 1) { + const pixelYDistance = height / ySubdivisions; + $$invalidate(6, ys = range(0, height + pixelYDistance * 1.1, pixelYDistance).iter().toArray()); + } + } + }; + + return [ + id, + xLines, + yLines, + height, + width, + xs, + ys, + context, + xSubdivisions, + ySubdivisions, + scaleY, + scaleX, + $context + ]; +} + +class GridPattern extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$9, create_fragment$9, safe_not_equal, { + id: 0, + xLines: 1, + yLines: 2, + xSubdivisions: 8, + ySubdivisions: 9 + }); + } +} + +/* src/CartesianCoordinates.svelte generated by Svelte v3.42.4 */ + +function create_if_block_3(ctx) { + let xlabels; + let current; + + xlabels = new XLabels({ + props: { + labelMaker: /*xAxisOptions*/ ctx[3].labels, + separation: /*xAxisOptions*/ ctx[3].lines || 1 + } + }); + + return { + c() { + create_component(xlabels.$$.fragment); + }, + m(target, anchor) { + mount_component(xlabels, target, anchor); + current = true; + }, + p(ctx, dirty) { + const xlabels_changes = {}; + if (dirty & /*xAxisOptions*/ 8) xlabels_changes.labelMaker = /*xAxisOptions*/ ctx[3].labels; + if (dirty & /*xAxisOptions*/ 8) xlabels_changes.separation = /*xAxisOptions*/ ctx[3].lines || 1; + xlabels.$set(xlabels_changes); + }, + i(local) { + if (current) return; + transition_in(xlabels.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(xlabels.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(xlabels, detaching); + } + }; +} + +// (44:0) {#if yAxis.labels} +function create_if_block_2(ctx) { + let ylabels; + let current; + + ylabels = new YLabels({ + props: { + labelMaker: /*yAxisOptions*/ ctx[2].labels, + separation: /*yAxisOptions*/ ctx[2].lines || 1 + } + }); + + return { + c() { + create_component(ylabels.$$.fragment); + }, + m(target, anchor) { + mount_component(ylabels, target, anchor); + current = true; + }, + p(ctx, dirty) { + const ylabels_changes = {}; + if (dirty & /*yAxisOptions*/ 4) ylabels_changes.labelMaker = /*yAxisOptions*/ ctx[2].labels; + if (dirty & /*yAxisOptions*/ 4) ylabels_changes.separation = /*yAxisOptions*/ ctx[2].lines || 1; + ylabels.$set(ylabels_changes); + }, + i(local) { + if (current) return; + transition_in(ylabels.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(ylabels.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(ylabels, detaching); + } + }; +} + +// (51:0) {#if xAxisOptions.axis} +function create_if_block_1(ctx) { + let line; + let line_x__value; + let line_x__value_1; + let line_y__value; + let line_y__value_1; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = -10000000); + attr(line, "x2", line_x__value_1 = 10000000); + attr(line, "y1", line_y__value = 0); + attr(line, "y2", line_y__value_1 = 0); + attr(line, "class", "transform-y-to-center svelte-xqsvde"); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +// (61:0) {#if yAxisOptions.axis} +function create_if_block(ctx) { + let line; + let line_x__value; + let line_x__value_1; + let line_y__value; + let line_y__value_1; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = 0); + attr(line, "x2", line_x__value_1 = 0); + attr(line, "y1", line_y__value = -10000000); + attr(line, "y2", line_y__value_1 = 10000000); + attr(line, "class", "transform-x-to-center svelte-xqsvde"); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +function create_fragment$8(ctx) { + let defs; + let gridpattern; + let t0; + let rect; + let t1; + let t2; + let t3; + let t4; + let if_block3_anchor; + let current; + + gridpattern = new GridPattern({ + props: { + id: /*id*/ ctx[4], + xLines: /*xAxisOptions*/ ctx[3].lines, + yLines: /*yAxisOptions*/ ctx[2].lines, + xSubdivisions: /*xAxisOptions*/ ctx[3].subdivisions, + ySubdivisions: /*yAxisOptions*/ ctx[2].subdivisions + } + }); + + let if_block0 = /*xAxis*/ ctx[0].labels && create_if_block_3(ctx); + let if_block1 = /*yAxis*/ ctx[1].labels && create_if_block_2(ctx); + let if_block2 = /*xAxisOptions*/ ctx[3].axis && create_if_block_1(); + let if_block3 = /*yAxisOptions*/ ctx[2].axis && create_if_block(); + + return { + c() { + defs = svg_element("defs"); + create_component(gridpattern.$$.fragment); + t0 = space(); + rect = svg_element("rect"); + t1 = space(); + if (if_block0) if_block0.c(); + t2 = space(); + if (if_block1) if_block1.c(); + t3 = space(); + if (if_block2) if_block2.c(); + t4 = space(); + if (if_block3) if_block3.c(); + if_block3_anchor = empty(); + attr(rect, "fill", `url(#${/*id*/ ctx[4]})`); + attr(rect, "x", -10000000); + attr(rect, "y", -10000000); + attr(rect, "width", 20000000); + attr(rect, "height", 20000000); + }, + m(target, anchor) { + insert(target, defs, anchor); + mount_component(gridpattern, defs, null); + insert(target, t0, anchor); + insert(target, rect, anchor); + insert(target, t1, anchor); + if (if_block0) if_block0.m(target, anchor); + insert(target, t2, anchor); + if (if_block1) if_block1.m(target, anchor); + insert(target, t3, anchor); + if (if_block2) if_block2.m(target, anchor); + insert(target, t4, anchor); + if (if_block3) if_block3.m(target, anchor); + insert(target, if_block3_anchor, anchor); + current = true; + }, + p(ctx, [dirty]) { + const gridpattern_changes = {}; + if (dirty & /*xAxisOptions*/ 8) gridpattern_changes.xLines = /*xAxisOptions*/ ctx[3].lines; + if (dirty & /*yAxisOptions*/ 4) gridpattern_changes.yLines = /*yAxisOptions*/ ctx[2].lines; + if (dirty & /*xAxisOptions*/ 8) gridpattern_changes.xSubdivisions = /*xAxisOptions*/ ctx[3].subdivisions; + if (dirty & /*yAxisOptions*/ 4) gridpattern_changes.ySubdivisions = /*yAxisOptions*/ ctx[2].subdivisions; + gridpattern.$set(gridpattern_changes); + + if (/*xAxis*/ ctx[0].labels) { + if (if_block0) { + if_block0.p(ctx, dirty); + + if (dirty & /*xAxis*/ 1) { + transition_in(if_block0, 1); + } + } else { + if_block0 = create_if_block_3(ctx); + if_block0.c(); + transition_in(if_block0, 1); + if_block0.m(t2.parentNode, t2); + } + } else if (if_block0) { + group_outros(); + + transition_out(if_block0, 1, 1, () => { + if_block0 = null; + }); + + check_outros(); + } + + if (/*yAxis*/ ctx[1].labels) { + if (if_block1) { + if_block1.p(ctx, dirty); + + if (dirty & /*yAxis*/ 2) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block_2(ctx); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(t3.parentNode, t3); + } + } else if (if_block1) { + group_outros(); + + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + + check_outros(); + } + + if (/*xAxisOptions*/ ctx[3].axis) { + if (if_block2) ; else { + if_block2 = create_if_block_1(); + if_block2.c(); + if_block2.m(t4.parentNode, t4); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + + if (/*yAxisOptions*/ ctx[2].axis) { + if (if_block3) ; else { + if_block3 = create_if_block(); + if_block3.c(); + if_block3.m(if_block3_anchor.parentNode, if_block3_anchor); + } + } else if (if_block3) { + if_block3.d(1); + if_block3 = null; + } + }, + i(local) { + if (current) return; + transition_in(gridpattern.$$.fragment, local); + transition_in(if_block0); + transition_in(if_block1); + current = true; + }, + o(local) { + transition_out(gridpattern.$$.fragment, local); + transition_out(if_block0); + transition_out(if_block1); + current = false; + }, + d(detaching) { + if (detaching) detach(defs); + destroy_component(gridpattern); + if (detaching) detach(t0); + if (detaching) detach(rect); + if (detaching) detach(t1); + if (if_block0) if_block0.d(detaching); + if (detaching) detach(t2); + if (if_block1) if_block1.d(detaching); + if (detaching) detach(t3); + if (if_block2) if_block2.d(detaching); + if (detaching) detach(t4); + if (if_block3) if_block3.d(detaching); + if (detaching) detach(if_block3_anchor); + } + }; +} + +let incrementer = 0; +const defaultAxisOptions = { axis: true, lines: 1, labels: x => x }; + +function instance$8($$self, $$props, $$invalidate) { + let xAxisOptions; + let yAxisOptions; + let { subdivisions = false } = $$props; + let { xAxis = Object.assign({ subdivisions }, defaultAxisOptions) } = $$props; + let { yAxis = Object.assign({ subdivisions }, defaultAxisOptions) } = $$props; + const id = `visual-math-grid-${incrementer++}`; + + $$self.$$set = $$props => { + if ('subdivisions' in $$props) $$invalidate(5, subdivisions = $$props.subdivisions); + if ('xAxis' in $$props) $$invalidate(0, xAxis = $$props.xAxis); + if ('yAxis' in $$props) $$invalidate(1, yAxis = $$props.yAxis); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*subdivisions, xAxis*/ 33) { + $$invalidate(3, xAxisOptions = Object.assign(Object.assign({ subdivisions }, defaultAxisOptions), xAxis)); + } + + if ($$self.$$.dirty & /*subdivisions, yAxis*/ 34) { + $$invalidate(2, yAxisOptions = Object.assign(Object.assign({ subdivisions }, defaultAxisOptions), yAxis)); + } + }; + + return [xAxis, yAxis, yAxisOptions, xAxisOptions, id, subdivisions]; +} + +class CartesianCoordinates extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$8, create_fragment$8, safe_not_equal, { subdivisions: 5, xAxis: 0, yAxis: 1 }); + } +} + +/* src/Ellipse.svelte generated by Svelte v3.42.4 */ + +function create_fragment$7(ctx) { + let ellipse; + let ellipse_cx_value; + let ellipse_cy_value; + let ellipse_rx_value; + let ellipse_ry_value; + let ellipse_stroke_dasharray_value; + let ellipse_transform_value; + let ellipse_style_value; + + let ellipse_levels = [ + { + cx: ellipse_cx_value = /*center*/ ctx[0][0] + }, + { + cy: ellipse_cy_value = /*center*/ ctx[0][1] + }, + { + rx: ellipse_rx_value = Math.abs(/*radius*/ ctx[1][0]) + }, + { + ry: ellipse_ry_value = Math.abs(/*radius*/ ctx[1][1]) + }, + { "stroke-width": /*weight*/ ctx[4] }, + { + "stroke-dasharray": ellipse_stroke_dasharray_value = /*strokeStyle*/ ctx[2] === "dashed" ? "4,3" : undefined + }, + { + transform: ellipse_transform_value = `${/*cssScale*/ ctx[8]} ${/*rotate*/ ctx[7]}` + }, + /*$$restProps*/ ctx[10], + { + style: ellipse_style_value = ` + stroke: ${/*color*/ ctx[5]}; + fill: ${/*color*/ ctx[5]}; + fill-opacity: ${/*fillOpacity*/ ctx[6]}; + stroke-opacity: ${/*strokeOpacity*/ ctx[3]}; + ${/*$$restProps*/ ctx[10].style || ""} + ` + } + ]; + + let ellipse_data = {}; + + for (let i = 0; i < ellipse_levels.length; i += 1) { + ellipse_data = assign(ellipse_data, ellipse_levels[i]); + } + + return { + c() { + ellipse = svg_element("ellipse"); + set_svg_attributes(ellipse, ellipse_data); + toggle_class(ellipse, "svelte-cc8k9r", true); + }, + m(target, anchor) { + insert(target, ellipse, anchor); + }, + p(ctx, [dirty]) { + set_svg_attributes(ellipse, ellipse_data = get_spread_update(ellipse_levels, [ + dirty & /*center*/ 1 && ellipse_cx_value !== (ellipse_cx_value = /*center*/ ctx[0][0]) && { cx: ellipse_cx_value }, + dirty & /*center*/ 1 && ellipse_cy_value !== (ellipse_cy_value = /*center*/ ctx[0][1]) && { cy: ellipse_cy_value }, + dirty & /*radius*/ 2 && ellipse_rx_value !== (ellipse_rx_value = Math.abs(/*radius*/ ctx[1][0])) && { rx: ellipse_rx_value }, + dirty & /*radius*/ 2 && ellipse_ry_value !== (ellipse_ry_value = Math.abs(/*radius*/ ctx[1][1])) && { ry: ellipse_ry_value }, + dirty & /*weight*/ 16 && { "stroke-width": /*weight*/ ctx[4] }, + dirty & /*strokeStyle*/ 4 && ellipse_stroke_dasharray_value !== (ellipse_stroke_dasharray_value = /*strokeStyle*/ ctx[2] === "dashed" ? "4,3" : undefined) && { + "stroke-dasharray": ellipse_stroke_dasharray_value + }, + dirty & /*cssScale, rotate*/ 384 && ellipse_transform_value !== (ellipse_transform_value = `${/*cssScale*/ ctx[8]} ${/*rotate*/ ctx[7]}`) && { transform: ellipse_transform_value }, + dirty & /*$$restProps*/ 1024 && /*$$restProps*/ ctx[10], + dirty & /*color, fillOpacity, strokeOpacity, $$restProps*/ 1128 && ellipse_style_value !== (ellipse_style_value = ` + stroke: ${/*color*/ ctx[5]}; + fill: ${/*color*/ ctx[5]}; + fill-opacity: ${/*fillOpacity*/ ctx[6]}; + stroke-opacity: ${/*strokeOpacity*/ ctx[3]}; + ${/*$$restProps*/ ctx[10].style || ""} + `) && { style: ellipse_style_value } + ])); + + toggle_class(ellipse, "svelte-cc8k9r", true); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(ellipse); + } + }; +} + +function instance$7($$self, $$props, $$invalidate) { + let cssScale; + let rotate; + + const omit_props_names = [ + "center","radius","angle","strokeStyle","strokeOpacity","weight","color","fillOpacity" + ]; + + let $$restProps = compute_rest_props($$props, omit_props_names); + let $scaleContext; + let { center = vec2.fromValues(0, 0) } = $$props; + let { radius = vec2.fromValues(1, 1) } = $$props; + let { angle = 0 } = $$props; + let { strokeStyle = "solid" } = $$props; + let { strokeOpacity = 1.0 } = $$props; + let { weight = 2 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { fillOpacity = 0.15 } = $$props; + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(12, $scaleContext = value)); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('center' in $$new_props) $$invalidate(0, center = $$new_props.center); + if ('radius' in $$new_props) $$invalidate(1, radius = $$new_props.radius); + if ('angle' in $$new_props) $$invalidate(11, angle = $$new_props.angle); + if ('strokeStyle' in $$new_props) $$invalidate(2, strokeStyle = $$new_props.strokeStyle); + if ('strokeOpacity' in $$new_props) $$invalidate(3, strokeOpacity = $$new_props.strokeOpacity); + if ('weight' in $$new_props) $$invalidate(4, weight = $$new_props.weight); + if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color); + if ('fillOpacity' in $$new_props) $$invalidate(6, fillOpacity = $$new_props.fillOpacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 4096) { + $$invalidate(8, cssScale = $scaleContext.cssScale); + } + + if ($$self.$$.dirty & /*angle, center*/ 2049) { + $$invalidate(7, rotate = `rotate(${angle * 180 / Math.PI} ${center[0]} ${center[1]})`); + } + }; + + return [ + center, + radius, + strokeStyle, + strokeOpacity, + weight, + color, + fillOpacity, + rotate, + cssScale, + scaleContext, + $$restProps, + angle, + $scaleContext + ]; +} + +class Ellipse extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$7, create_fragment$7, safe_not_equal, { + center: 0, + radius: 1, + angle: 11, + strokeStyle: 2, + strokeOpacity: 3, + weight: 4, + color: 5, + fillOpacity: 6 + }); + } +} + +/* src/Circle.svelte generated by Svelte v3.42.4 */ + +function create_fragment$6(ctx) { + let ellipse; + let current; + + const ellipse_spread_levels = [ + { center: /*center*/ ctx[0] }, + { radius: /*ellipseRadius*/ ctx[7] }, + { angle: /*angle*/ ctx[1] }, + { strokeStyle: /*strokeStyle*/ ctx[2] }, + { strokeOpacity: /*strokeOpacity*/ ctx[3] }, + { weight: /*weight*/ ctx[4] }, + { color: /*color*/ ctx[5] }, + { fillOpacity: /*fillOpacity*/ ctx[6] }, + /*$$restProps*/ ctx[8] + ]; + + let ellipse_props = {}; + + for (let i = 0; i < ellipse_spread_levels.length; i += 1) { + ellipse_props = assign(ellipse_props, ellipse_spread_levels[i]); + } + + ellipse = new Ellipse({ props: ellipse_props }); + + return { + c() { + create_component(ellipse.$$.fragment); + }, + m(target, anchor) { + mount_component(ellipse, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const ellipse_changes = (dirty & /*center, ellipseRadius, angle, strokeStyle, strokeOpacity, weight, color, fillOpacity, $$restProps*/ 511) + ? get_spread_update(ellipse_spread_levels, [ + dirty & /*center*/ 1 && { center: /*center*/ ctx[0] }, + dirty & /*ellipseRadius*/ 128 && { radius: /*ellipseRadius*/ ctx[7] }, + dirty & /*angle*/ 2 && { angle: /*angle*/ ctx[1] }, + dirty & /*strokeStyle*/ 4 && { strokeStyle: /*strokeStyle*/ ctx[2] }, + dirty & /*strokeOpacity*/ 8 && { strokeOpacity: /*strokeOpacity*/ ctx[3] }, + dirty & /*weight*/ 16 && { weight: /*weight*/ ctx[4] }, + dirty & /*color*/ 32 && { color: /*color*/ ctx[5] }, + dirty & /*fillOpacity*/ 64 && { fillOpacity: /*fillOpacity*/ ctx[6] }, + dirty & /*$$restProps*/ 256 && get_spread_object(/*$$restProps*/ ctx[8]) + ]) + : {}; + + ellipse.$set(ellipse_changes); + }, + i(local) { + if (current) return; + transition_in(ellipse.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(ellipse.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(ellipse, detaching); + } + }; +} + +function instance$6($$self, $$props, $$invalidate) { + const omit_props_names = [ + "center","radius","angle","strokeStyle","strokeOpacity","weight","color","fillOpacity" + ]; + + let $$restProps = compute_rest_props($$props, omit_props_names); + let { center = vec2.fromValues(0, 0) } = $$props; + let { radius = 1 } = $$props; + let { angle = 0 } = $$props; + let { strokeStyle = "solid" } = $$props; + let { strokeOpacity = 1.0 } = $$props; + let { weight = 2 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { fillOpacity = 0.15 } = $$props; + let ellipseRadius = vec2.fromValues(radius, radius); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(8, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('center' in $$new_props) $$invalidate(0, center = $$new_props.center); + if ('radius' in $$new_props) $$invalidate(9, radius = $$new_props.radius); + if ('angle' in $$new_props) $$invalidate(1, angle = $$new_props.angle); + if ('strokeStyle' in $$new_props) $$invalidate(2, strokeStyle = $$new_props.strokeStyle); + if ('strokeOpacity' in $$new_props) $$invalidate(3, strokeOpacity = $$new_props.strokeOpacity); + if ('weight' in $$new_props) $$invalidate(4, weight = $$new_props.weight); + if ('color' in $$new_props) $$invalidate(5, color = $$new_props.color); + if ('fillOpacity' in $$new_props) $$invalidate(6, fillOpacity = $$new_props.fillOpacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*ellipseRadius, radius*/ 640) { + $$invalidate(7, ellipseRadius = vec2.set(ellipseRadius, radius, radius)); + } + }; + + return [ + center, + angle, + strokeStyle, + strokeOpacity, + weight, + color, + fillOpacity, + ellipseRadius, + $$restProps, + radius + ]; +} + +class Circle extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$6, create_fragment$6, safe_not_equal, { + center: 0, + radius: 9, + angle: 1, + strokeStyle: 2, + strokeOpacity: 3, + weight: 4, + color: 5, + fillOpacity: 6 + }); + } +} + +/* src/MovablePoint.svelte generated by Svelte v3.42.4 */ + +function create_fragment$5(ctx) { + let g; + let circle0; + let circle0_cx_value; + let circle0_cy_value; + let circle1; + let circle1_cx_value; + let circle1_cy_value; + + return { + c() { + g = svg_element("g"); + circle0 = svg_element("circle"); + circle1 = svg_element("circle"); + attr(circle0, "cx", circle0_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0])); + attr(circle0, "cy", circle0_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1])); + attr(circle0, "r", 30); + attr(circle0, "fill", "transparent"); + attr(circle1, "cx", circle1_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0])); + attr(circle1, "cy", circle1_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1])); + attr(circle1, "r", 6); + attr(circle1, "fill", /*color*/ ctx[0]); + attr(circle1, "stroke", /*color*/ ctx[0]); + attr(circle1, "stroke-opacity", 0.25); + attr(circle1, "tabindex", 0); + toggle_class(circle1, "draggable", /*dragging*/ ctx[3]); + }, + m(target, anchor) { + insert(target, g, anchor); + append(g, circle0); + append(g, circle1); + /*g_binding*/ ctx[15](g); + }, + p(ctx, [dirty]) { + if (dirty & /*scaleX, display*/ 34 && circle0_cx_value !== (circle0_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0]))) { + attr(circle0, "cx", circle0_cx_value); + } + + if (dirty & /*scaleY, display*/ 18 && circle0_cy_value !== (circle0_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1]))) { + attr(circle0, "cy", circle0_cy_value); + } + + if (dirty & /*scaleX, display*/ 34 && circle1_cx_value !== (circle1_cx_value = /*scaleX*/ ctx[5](/*display*/ ctx[1][0]))) { + attr(circle1, "cx", circle1_cx_value); + } + + if (dirty & /*scaleY, display*/ 18 && circle1_cy_value !== (circle1_cy_value = /*scaleY*/ ctx[4](/*display*/ ctx[1][1]))) { + attr(circle1, "cy", circle1_cy_value); + } + + if (dirty & /*color*/ 1) { + attr(circle1, "fill", /*color*/ ctx[0]); + } + + if (dirty & /*color*/ 1) { + attr(circle1, "stroke", /*color*/ ctx[0]); + } + + if (dirty & /*dragging*/ 8) { + toggle_class(circle1, "draggable", /*dragging*/ ctx[3]); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(g); + /*g_binding*/ ctx[15](null); + } + }; +} + +const VEC2_0$3 = vec2.create(); + +function instance$5($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + let inversePixelMatrix; + let onDrag; + let $scaleContext; + let { point = vec2.create() } = $$props; + let { color = "var(--visual-math-blue)" } = $$props; + let { transform = mat2d.create() } = $$props; + let { constrain = undefined } = $$props; + let intialPoint = vec2.fromValues(point[0], point[1]); + let constraintFunction = point => point; + point = constraintFunction(point); + let scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(14, $scaleContext = value)); + let display = vec2.create(); + let inverseTransform = mat2d.create(); + let element; + let startPoint = vec2.create(); + let dragging = false; + + onMount(() => { + const dragGesture = new DragGesture(element, onDrag); + + return () => { + dragGesture.destroy(); + }; + }); + + function g_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + element = $$value; + $$invalidate(2, element); + }); + } + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(7, point = $$props.point); + if ('color' in $$props) $$invalidate(0, color = $$props.color); + if ('transform' in $$props) $$invalidate(8, transform = $$props.transform); + if ('constrain' in $$props) $$invalidate(9, constrain = $$props.constrain); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*constrain*/ 512) { + if (constrain === "horizontal") { + $$invalidate(10, constraintFunction = ([x, _y]) => [x, intialPoint[1]]); + } else if (constrain === "vertical") { + $$invalidate(10, constraintFunction = ([_x, y]) => [intialPoint[0], y]); + } else if (typeof constrain === "function") { + $$invalidate(10, constraintFunction = constrain); + } + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(5, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(4, scaleY = $scaleContext.scaleY); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 16384) { + $$invalidate(13, inversePixelMatrix = $scaleContext.inversePixelMatrix); + } + + if ($$self.$$.dirty & /*inverseTransform, transform*/ 2304) { + $$invalidate(11, inverseTransform = mat2d.invert(inverseTransform, transform)); + } + + if ($$self.$$.dirty & /*inversePixelMatrix, startPoint, point, transform, inverseTransform, constraintFunction*/ 15744) { + onDrag = state => { + var _a; + + (_a = state.event) === null || _a === void 0 + ? void 0 + : _a.stopPropagation(); + + $$invalidate(3, dragging = state.down); + const movement = vec2.transformMat2d(VEC2_0$3, state.movement, inversePixelMatrix); + + if (state.first) { + $$invalidate(12, startPoint = vec2.transformMat2d(startPoint, point, transform)); + } + + vec2.add(point, startPoint, movement); + vec2.transformMat2d(point, point, inverseTransform); + $$invalidate(7, point = constraintFunction(point)); + }; + } + + if ($$self.$$.dirty & /*display, point, transform*/ 386) { + $$invalidate(1, display = vec2.transformMat2d(display, point, transform)); + } + }; + + return [ + color, + display, + element, + dragging, + scaleY, + scaleX, + scaleContext, + point, + transform, + constrain, + constraintFunction, + inverseTransform, + startPoint, + inversePixelMatrix, + $scaleContext, + g_binding + ]; +} + +class MovablePoint extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$5, create_fragment$5, safe_not_equal, { + point: 7, + color: 0, + transform: 8, + constrain: 9 + }); + } +} + +/* src/Point.svelte generated by Svelte v3.42.4 */ + +function create_fragment$4(ctx) { + let circle; + let circle_cx_value; + let circle_cy_value; + let circle_r_value; + let circle_style_value; + + let circle_levels = [ + { + cx: circle_cx_value = /*scaleX*/ ctx[4](/*point*/ ctx[0][0]) + }, + { + cy: circle_cy_value = /*scaleY*/ ctx[3](/*point*/ ctx[0][1]) + }, + { r: circle_r_value = 6 }, + /*$$restProps*/ ctx[6], + { + style: circle_style_value = `fill: ${/*color*/ ctx[1]}; opacity: ${/*opacity*/ ctx[2]}; ${/*$$restProps*/ ctx[6].style}` + } + ]; + + let circle_data = {}; + + for (let i = 0; i < circle_levels.length; i += 1) { + circle_data = assign(circle_data, circle_levels[i]); + } + + return { + c() { + circle = svg_element("circle"); + set_svg_attributes(circle, circle_data); + }, + m(target, anchor) { + insert(target, circle, anchor); + }, + p(ctx, [dirty]) { + set_svg_attributes(circle, circle_data = get_spread_update(circle_levels, [ + dirty & /*scaleX, point*/ 17 && circle_cx_value !== (circle_cx_value = /*scaleX*/ ctx[4](/*point*/ ctx[0][0])) && { cx: circle_cx_value }, + dirty & /*scaleY, point*/ 9 && circle_cy_value !== (circle_cy_value = /*scaleY*/ ctx[3](/*point*/ ctx[0][1])) && { cy: circle_cy_value }, + { r: circle_r_value }, + dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6], + dirty & /*color, opacity, $$restProps*/ 70 && circle_style_value !== (circle_style_value = `fill: ${/*color*/ ctx[1]}; opacity: ${/*opacity*/ ctx[2]}; ${/*$$restProps*/ ctx[6].style}`) && { style: circle_style_value } + ])); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(circle); + } + }; +} + +function instance$4($$self, $$props, $$invalidate) { + let scaleX; + let scaleY; + const omit_props_names = ["point","color","opacity"]; + let $$restProps = compute_rest_props($$props, omit_props_names); + let $scaleContext; + let { point = vec2.create() } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { opacity = 1 } = $$props; + const scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(7, $scaleContext = value)); + + $$self.$$set = $$new_props => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names)); + if ('point' in $$new_props) $$invalidate(0, point = $$new_props.point); + if ('color' in $$new_props) $$invalidate(1, color = $$new_props.color); + if ('opacity' in $$new_props) $$invalidate(2, opacity = $$new_props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 128) { + $$invalidate(4, scaleX = $scaleContext.scaleX); + } + + if ($$self.$$.dirty & /*$scaleContext*/ 128) { + $$invalidate(3, scaleY = $scaleContext.scaleY); + } + }; + + return [ + point, + color, + opacity, + scaleY, + scaleX, + scaleContext, + $$restProps, + $scaleContext + ]; +} + +class Point extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$4, create_fragment$4, safe_not_equal, { point: 0, color: 1, opacity: 2 }); + } +} + +/* src/ThroughPoints.svelte generated by Svelte v3.42.4 */ + +function create_fragment$3(ctx) { + let line; + let line_x__value; + let line_y__value; + let line_x__value_1; + let line_y__value_1; + let line_style_value; + let line_stroke_dasharray_value; + + return { + c() { + line = svg_element("line"); + attr(line, "x1", line_x__value = /*scaledPoint1*/ ctx[4][0]); + attr(line, "y1", line_y__value = /*scaledPoint1*/ ctx[4][1]); + attr(line, "x2", line_x__value_1 = /*scaledPoint2*/ ctx[5][0]); + attr(line, "y2", line_y__value_1 = /*scaledPoint2*/ ctx[5][1]); + attr(line, "style", line_style_value = `stroke: ${/*color*/ ctx[0]}`); + attr(line, "stroke-width", /*weight*/ ctx[2]); + attr(line, "opacity", /*opacity*/ ctx[3]); + attr(line, "stroke-dasharray", line_stroke_dasharray_value = /*style*/ ctx[1] === "dashed" ? "4,3" : undefined); + }, + m(target, anchor) { + insert(target, line, anchor); + }, + p(ctx, [dirty]) { + if (dirty & /*scaledPoint1*/ 16 && line_x__value !== (line_x__value = /*scaledPoint1*/ ctx[4][0])) { + attr(line, "x1", line_x__value); + } + + if (dirty & /*scaledPoint1*/ 16 && line_y__value !== (line_y__value = /*scaledPoint1*/ ctx[4][1])) { + attr(line, "y1", line_y__value); + } + + if (dirty & /*scaledPoint2*/ 32 && line_x__value_1 !== (line_x__value_1 = /*scaledPoint2*/ ctx[5][0])) { + attr(line, "x2", line_x__value_1); + } + + if (dirty & /*scaledPoint2*/ 32 && line_y__value_1 !== (line_y__value_1 = /*scaledPoint2*/ ctx[5][1])) { + attr(line, "y2", line_y__value_1); + } + + if (dirty & /*color*/ 1 && line_style_value !== (line_style_value = `stroke: ${/*color*/ ctx[0]}`)) { + attr(line, "style", line_style_value); + } + + if (dirty & /*weight*/ 4) { + attr(line, "stroke-width", /*weight*/ ctx[2]); + } + + if (dirty & /*opacity*/ 8) { + attr(line, "opacity", /*opacity*/ ctx[3]); + } + + if (dirty & /*style*/ 2 && line_stroke_dasharray_value !== (line_stroke_dasharray_value = /*style*/ ctx[1] === "dashed" ? "4,3" : undefined)) { + attr(line, "stroke-dasharray", line_stroke_dasharray_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(line); + } + }; +} + +const VEC2_0$2 = vec2.create(); + +function instance$3($$self, $$props, $$invalidate) { + let pixelMatrix; + let $scaleContext; + let { point1 = vec2.create() } = $$props; + let { point2 = vec2.create() } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + const scaleContext = getScaleContext(); + component_subscribe($$self, scaleContext, value => $$invalidate(11, $scaleContext = value)); + let segment = vec2.create(); + let scaledPoint1 = vec2.create(); + let scaledPoint2 = vec2.create(); + + $$self.$$set = $$props => { + if ('point1' in $$props) $$invalidate(7, point1 = $$props.point1); + if ('point2' in $$props) $$invalidate(8, point2 = $$props.point2); + if ('color' in $$props) $$invalidate(0, color = $$props.color); + if ('style' in $$props) $$invalidate(1, style = $$props.style); + if ('weight' in $$props) $$invalidate(2, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(3, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$scaleContext*/ 2048) { + $$invalidate(10, pixelMatrix = $scaleContext.pixelMatrix); + } + + if ($$self.$$.dirty & /*segment, point2, point1*/ 896) { + $$invalidate(9, segment = vec2.scale(segment, vec2.normalize(segment, vec2.sub(VEC2_0$2, point2, point1)), 100000)); + } + + if ($$self.$$.dirty & /*scaledPoint1, point1, segment, pixelMatrix*/ 1680) { + $$invalidate(4, scaledPoint1 = vec2.transformMat2d(scaledPoint1, vec2.sub(VEC2_0$2, point1, segment), pixelMatrix)); + } + + if ($$self.$$.dirty & /*scaledPoint2, point2, segment, pixelMatrix*/ 1824) { + $$invalidate(5, scaledPoint2 = vec2.transformMat2d(scaledPoint2, vec2.add(VEC2_0$2, point2, segment), pixelMatrix)); + } + }; + + return [ + color, + style, + weight, + opacity, + scaledPoint1, + scaledPoint2, + scaleContext, + point1, + point2, + segment, + pixelMatrix, + $scaleContext + ]; +} + +class ThroughPoints extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$3, create_fragment$3, safe_not_equal, { + point1: 7, + point2: 8, + color: 0, + style: 1, + weight: 2, + opacity: 3 + }); + } +} + +/* src/PointAngle.svelte generated by Svelte v3.42.4 */ + +function create_fragment$2(ctx) { + let throughpoints; + let current; + + throughpoints = new ThroughPoints({ + props: { + point1: /*point*/ ctx[0], + point2: /*point2*/ ctx[5], + color: /*color*/ ctx[1], + opacity: /*opacity*/ ctx[4], + style: /*style*/ ctx[2], + weight: /*weight*/ ctx[3] + } + }); + + return { + c() { + create_component(throughpoints.$$.fragment); + }, + m(target, anchor) { + mount_component(throughpoints, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const throughpoints_changes = {}; + if (dirty & /*point*/ 1) throughpoints_changes.point1 = /*point*/ ctx[0]; + if (dirty & /*point2*/ 32) throughpoints_changes.point2 = /*point2*/ ctx[5]; + if (dirty & /*color*/ 2) throughpoints_changes.color = /*color*/ ctx[1]; + if (dirty & /*opacity*/ 16) throughpoints_changes.opacity = /*opacity*/ ctx[4]; + if (dirty & /*style*/ 4) throughpoints_changes.style = /*style*/ ctx[2]; + if (dirty & /*weight*/ 8) throughpoints_changes.weight = /*weight*/ ctx[3]; + throughpoints.$set(throughpoints_changes); + }, + i(local) { + if (current) return; + transition_in(throughpoints.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(throughpoints.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(throughpoints, detaching); + } + }; +} + +const VEC2_0$1 = vec2.create(); +const ZERO = vec2.create(); +const RIGHT = vec2.fromValues(1, 0); + +function instance$2($$self, $$props, $$invalidate) { + let { point = vec2.create() } = $$props; + let { angle = 0 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + let point2 = vec2.create(); + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(0, point = $$props.point); + if ('angle' in $$props) $$invalidate(6, angle = $$props.angle); + if ('color' in $$props) $$invalidate(1, color = $$props.color); + if ('style' in $$props) $$invalidate(2, style = $$props.style); + if ('weight' in $$props) $$invalidate(3, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(4, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*point2, point, angle*/ 97) { + $$invalidate(5, point2 = vec2.add(point2, point, vec2.rotate(VEC2_0$1, RIGHT, ZERO, angle))); + } + }; + + return [point, color, style, weight, opacity, point2, angle]; +} + +class PointAngle extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$2, create_fragment$2, safe_not_equal, { + point: 0, + angle: 6, + color: 1, + style: 2, + weight: 3, + opacity: 4 + }); + } +} + +/* src/PointSlope.svelte generated by Svelte v3.42.4 */ + +function create_fragment$1(ctx) { + let pointangle; + let current; + + pointangle = new PointAngle({ + props: { + point: /*point*/ ctx[0], + angle: /*angle*/ ctx[5], + color: /*color*/ ctx[1], + opacity: /*opacity*/ ctx[4], + style: /*style*/ ctx[2], + weight: /*weight*/ ctx[3] + } + }); + + return { + c() { + create_component(pointangle.$$.fragment); + }, + m(target, anchor) { + mount_component(pointangle, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const pointangle_changes = {}; + if (dirty & /*point*/ 1) pointangle_changes.point = /*point*/ ctx[0]; + if (dirty & /*angle*/ 32) pointangle_changes.angle = /*angle*/ ctx[5]; + if (dirty & /*color*/ 2) pointangle_changes.color = /*color*/ ctx[1]; + if (dirty & /*opacity*/ 16) pointangle_changes.opacity = /*opacity*/ ctx[4]; + if (dirty & /*style*/ 4) pointangle_changes.style = /*style*/ ctx[2]; + if (dirty & /*weight*/ 8) pointangle_changes.weight = /*weight*/ ctx[3]; + pointangle.$set(pointangle_changes); + }, + i(local) { + if (current) return; + transition_in(pointangle.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(pointangle.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(pointangle, detaching); + } + }; +} + +function instance$1($$self, $$props, $$invalidate) { + let { point = vec2.create() } = $$props; + let { slope = 0 } = $$props; + let { color = "var(--visual-math-fg)" } = $$props; + let { style = "solid" } = $$props; + let { weight = 2 } = $$props; + let { opacity = 1 } = $$props; + let angle = Math.atan(slope); + + $$self.$$set = $$props => { + if ('point' in $$props) $$invalidate(0, point = $$props.point); + if ('slope' in $$props) $$invalidate(6, slope = $$props.slope); + if ('color' in $$props) $$invalidate(1, color = $$props.color); + if ('style' in $$props) $$invalidate(2, style = $$props.style); + if ('weight' in $$props) $$invalidate(3, weight = $$props.weight); + if ('opacity' in $$props) $$invalidate(4, opacity = $$props.opacity); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*slope*/ 64) { + $$invalidate(5, angle = Math.atan(slope)); + } + }; + + return [point, color, style, weight, opacity, angle, slope]; +} + +class PointSlope extends SvelteComponent { + constructor(options) { + super(); + + init(this, options, instance$1, create_fragment$1, safe_not_equal, { + point: 0, + slope: 6, + color: 1, + style: 2, + weight: 3, + opacity: 4 + }); + } +} + +/* src/VisualMath.svelte generated by Svelte v3.42.4 */ + +function create_fragment(ctx) { + let div; + let svg; + let svg_viewBox_value; + let svg_style_value; + let div_style_value; + let div_resize_listener; + let current; + const default_slot_template = /*#slots*/ ctx[38].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[37], null); + + return { + c() { + div = element("div"); + svg = svg_element("svg"); + if (default_slot) default_slot.c(); + attr(svg, "width", /*actualWidth*/ ctx[2]); + attr(svg, "height", /*actualHeight*/ ctx[3]); + attr(svg, "viewBox", svg_viewBox_value = `${-/*mapX*/ ctx[5](0)} ${-/*mapY*/ ctx[4](0)} ${/*actualWidth*/ ctx[2]} ${/*actualHeight*/ ctx[3]}`); + attr(svg, "preserveAspectRatio", "xMidYMin"); + attr(svg, "style", svg_style_value = `width: ${/*width*/ ctx[0]}; touch-action: ${/*pan*/ ctx[1] ? "none" : "auto"};`); + attr(div, "class", "visual-math svelte-5trppw"); + attr(div, "style", div_style_value = `width: ${/*desiredCssWidth*/ ctx[8]}; height: ${/*desiredCssHeight*/ ctx[7]}`); + add_render_callback(() => /*div_elementresize_handler*/ ctx[40].call(div)); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, svg); + + if (default_slot) { + default_slot.m(svg, null); + } + + /*div_binding*/ ctx[39](div); + div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[40].bind(div)); + current = true; + }, + p(ctx, dirty) { + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ 64)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ ctx[37], + !current + ? get_all_dirty_from_scope(/*$$scope*/ ctx[37]) + : get_slot_changes(default_slot_template, /*$$scope*/ ctx[37], dirty, null), + null + ); + } + } + + if (!current || dirty[0] & /*actualWidth*/ 4) { + attr(svg, "width", /*actualWidth*/ ctx[2]); + } + + if (!current || dirty[0] & /*actualHeight*/ 8) { + attr(svg, "height", /*actualHeight*/ ctx[3]); + } + + if (!current || dirty[0] & /*mapX, mapY, actualWidth, actualHeight*/ 60 && svg_viewBox_value !== (svg_viewBox_value = `${-/*mapX*/ ctx[5](0)} ${-/*mapY*/ ctx[4](0)} ${/*actualWidth*/ ctx[2]} ${/*actualHeight*/ ctx[3]}`)) { + attr(svg, "viewBox", svg_viewBox_value); + } + + if (!current || dirty[0] & /*width, pan*/ 3 && svg_style_value !== (svg_style_value = `width: ${/*width*/ ctx[0]}; touch-action: ${/*pan*/ ctx[1] ? "none" : "auto"};`)) { + attr(svg, "style", svg_style_value); + } + + if (!current || dirty[0] & /*desiredCssWidth, desiredCssHeight*/ 384 && div_style_value !== (div_style_value = `width: ${/*desiredCssWidth*/ ctx[8]}; height: ${/*desiredCssHeight*/ ctx[7]}`)) { + attr(div, "style", div_style_value); + } + }, + i(local) { + if (current) return; + transition_in(default_slot, local); + current = true; + }, + o(local) { + transition_out(default_slot, local); + current = false; + }, + d(detaching) { + if (detaching) detach(div); + if (default_slot) default_slot.d(detaching); + /*div_binding*/ ctx[39](null); + div_resize_listener(); + } + }; +} + +const VEC2_0 = vec2.create(); + +function getMouseWheelDirection(e) { + if (typeof e.detail == "number" && e.detail !== 0) { + if (e.detail > 0) { + return -1; + } else if (e.detail < 0) { + return 1; + } + } else if (typeof e.wheelDelta === "number") { + if (e.wheelDelta < 0) { + return -1; + } else if (e.wheelDelta > 0) { + return 1; + } + } + + return undefined; +} + +let base = 2; + +function instance($$self, $$props, $$invalidate) { + let desiredCssWidth; + let desiredCssHeight; + let mapX; + let mapY; + let scaleX; + let scaleY; + let unscaleX; + let unscaleY; + let cssScale; + let xSpan; + let xStep; + let xLowerBound; + let xUpperBound; + let ySpan; + let yStep; + let yLowerBound; + let yUpperBound; + let onDrag; + let onMouseWheel; + let { $$slots: slots = {}, $$scope } = $$props; + let { width = 500 } = $$props; + let { height = 500 } = $$props; + let { pan = true } = $$props; + let { zoom = true } = $$props; + let { xAxisExtent = vec2.fromValues(-5.5, 5.5) } = $$props; + let { yAxisExtent = vec2.fromValues(-5.5, 5.5) } = $$props; + let actualWidth = typeof width === "number" ? width : 500; + let actualHeight = typeof height === "number" ? height : 500; + let zoomAmount = Math.min(xAxisExtent[1] - xAxisExtent[0], yAxisExtent[1] - yAxisExtent[0]); + let offset = vec2.fromValues(0, 0); + let min = vec2.fromValues(xAxisExtent[0], yAxisExtent[0]); + let max = vec2.fromValues(xAxisExtent[1], yAxisExtent[1]); + let span = vec2.create(); + let pixelMatrix = mat2d.create(); + let inversePixelMatrix = mat2d.create(); + let xPanes = []; + let yPanes = []; + let xPaneRange = vec2.create(); + let yPaneRange = vec2.create(); + let panesContext = writable({ xPanes, yPanes, xPaneRange, yPaneRange }); + setPanesContext(panesContext); + + let coordinateContext = writable({ + min, + max, + width: actualWidth, + height: actualHeight + }); + + setCoordinateContext(coordinateContext); + + let scaleContext = writable({ + zoomAmount, + scaleX, + scaleY, + span, + pixelMatrix, + inversePixelMatrix, + cssScale + }); + + setScaleContext(scaleContext); + let mapContext = writable({ mapX, mapY }); + setMapContext(mapContext); + let element; + + onMount(() => { + const dragGesture = new DragGesture(element, onDrag), + wheelGesture = new WheelGesture(element, onMouseWheel); + + return () => { + dragGesture.destroy(); + wheelGesture.destroy(); + }; + }); + + function div_binding($$value) { + binding_callbacks[$$value ? 'unshift' : 'push'](() => { + element = $$value; + $$invalidate(6, element); + }); + } + + function div_elementresize_handler() { + actualWidth = this.offsetWidth; + actualHeight = this.offsetHeight; + $$invalidate(2, actualWidth); + $$invalidate(3, actualHeight); + } + + $$self.$$set = $$props => { + if ('width' in $$props) $$invalidate(0, width = $$props.width); + if ('height' in $$props) $$invalidate(11, height = $$props.height); + if ('pan' in $$props) $$invalidate(1, pan = $$props.pan); + if ('zoom' in $$props) $$invalidate(12, zoom = $$props.zoom); + if ('xAxisExtent' in $$props) $$invalidate(9, xAxisExtent = $$props.xAxisExtent); + if ('yAxisExtent' in $$props) $$invalidate(10, yAxisExtent = $$props.yAxisExtent); + if ('$$scope' in $$props) $$invalidate(37, $$scope = $$props.$$scope); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*width*/ 1) { + $$invalidate(8, desiredCssWidth = width === "auto" ? "100%" : `${width}px`); + } + + if ($$self.$$.dirty[0] & /*height*/ 2048) { + $$invalidate(7, desiredCssHeight = height === "auto" ? "100%" : `${height}px`); + } + + if ($$self.$$.dirty[0] & /*zoom, zoomAmount, xAxisExtent, yAxisExtent*/ 13824) { + onMouseWheel = state => { + if (!zoom || state.last) { + return; + } + + const wheelDirection = getMouseWheelDirection(state.event); + + if (wheelDirection && (zoomAmount > 3 || wheelDirection < 0)) { + $$invalidate(9, xAxisExtent = vec2.set(xAxisExtent, xAxisExtent[0] + wheelDirection, xAxisExtent[1] - wheelDirection)); + $$invalidate(10, yAxisExtent = vec2.set(yAxisExtent, yAxisExtent[0] + wheelDirection, yAxisExtent[1] - wheelDirection)); + $$invalidate(13, zoomAmount = Math.min(xAxisExtent[1] - xAxisExtent[0], yAxisExtent[1] - yAxisExtent[0])); + } + }; + } + + if ($$self.$$.dirty[0] & /*actualWidth, actualHeight, zoomAmount*/ 8204) { + { + const aspect = actualWidth / actualHeight, + halfZoomAmount = zoomAmount * 0.5, + newZoomAmount = zoomAmount * aspect, + halfNewZoomAmount = newZoomAmount * 0.5; + + $$invalidate(9, xAxisExtent[0] = -halfNewZoomAmount, xAxisExtent); + $$invalidate(9, xAxisExtent[1] = halfNewZoomAmount, xAxisExtent); + $$invalidate(10, yAxisExtent[0] = -halfZoomAmount, yAxisExtent); + $$invalidate(10, yAxisExtent[1] = halfZoomAmount, yAxisExtent); + } + } + + if ($$self.$$.dirty[0] & /*pan, actualWidth, xAxisExtent, actualHeight, yAxisExtent*/ 1550) { + onDrag = state => { + if (!pan) { + return; + } + + $$invalidate(14, offset[0] = -state.offset[0] / actualWidth * (xAxisExtent[1] - xAxisExtent[0]), offset); + $$invalidate(14, offset[1] = -state.offset[1] / actualHeight * (yAxisExtent[1] - yAxisExtent[0]), offset); + }; + } + + if ($$self.$$.dirty[0] & /*min, offset, xAxisExtent, yAxisExtent*/ 50688) { + $$invalidate(15, min = vec2.add(min, offset, vec2.set(VEC2_0, xAxisExtent[0], yAxisExtent[0]))); + } + + if ($$self.$$.dirty[0] & /*max, offset, xAxisExtent, yAxisExtent*/ 83456) { + $$invalidate(16, max = vec2.add(max, offset, vec2.set(VEC2_0, xAxisExtent[1], yAxisExtent[1]))); + } + + if ($$self.$$.dirty[0] & /*min, max, actualWidth*/ 98308) { + $$invalidate(5, mapX = x => (x - min[0]) / (max[0] - min[0]) * actualWidth); + } + + if ($$self.$$.dirty[0] & /*min, max, actualHeight*/ 98312) { + $$invalidate(4, mapY = y => (y - min[1]) / (max[1] - min[1]) * actualHeight); + } + + if ($$self.$$.dirty[0] & /*span, max, min*/ 229376) { + $$invalidate(17, span = vec2.sub(span, max, min)); + } + + if ($$self.$$.dirty[0] & /*span, actualWidth*/ 131076) { + $$invalidate(26, scaleX = x => x / span[0] * actualWidth); + } + + if ($$self.$$.dirty[0] & /*span, actualHeight*/ 131080) { + $$invalidate(25, scaleY = y => -y / span[1] * actualHeight); + } + + if ($$self.$$.dirty[0] & /*max, min*/ 98304) { + $$invalidate(34, xSpan = max[0] - min[0]); + } + + if ($$self.$$.dirty[0] & /*actualWidth*/ 4 | $$self.$$.dirty[1] & /*xSpan*/ 8) { + $$invalidate(36, unscaleX = x => x / actualWidth * xSpan); + } + + if ($$self.$$.dirty[0] & /*max, min*/ 98304) { + $$invalidate(30, ySpan = max[1] - min[1]); + } + + if ($$self.$$.dirty[0] & /*actualHeight, ySpan*/ 1073741832) { + $$invalidate(35, unscaleY = y => -y / actualHeight * ySpan); + } + + if ($$self.$$.dirty[0] & /*pixelMatrix, scaleX, scaleY*/ 100925440) { + $$invalidate(18, pixelMatrix = mat2d.fromScaling(pixelMatrix, vec2.set(VEC2_0, scaleX(1), scaleY(1)))); + } + + if ($$self.$$.dirty[0] & /*inversePixelMatrix*/ 524288 | $$self.$$.dirty[1] & /*unscaleX, unscaleY*/ 48) { + $$invalidate(19, inversePixelMatrix = mat2d.fromScaling(inversePixelMatrix, vec2.set(VEC2_0, unscaleX(1), unscaleY(1)))); + } + + if ($$self.$$.dirty[0] & /*scaleX, scaleY*/ 100663296) { + $$invalidate(24, cssScale = `scale(${scaleX(1)} ${scaleY(1)})`); + } + + if ($$self.$$.dirty[1] & /*xSpan*/ 8) { + $$invalidate(33, xStep = Math.pow(base, Math.round(Math.log10(xSpan) / Math.log10(base)))); + } + + if ($$self.$$.dirty[0] & /*min*/ 32768 | $$self.$$.dirty[1] & /*xStep*/ 4) { + $$invalidate(32, xLowerBound = Math.floor(min[0] / xStep) * xStep); + } + + if ($$self.$$.dirty[0] & /*max*/ 65536 | $$self.$$.dirty[1] & /*xStep*/ 4) { + $$invalidate(31, xUpperBound = Math.ceil(max[0] / xStep) * xStep); + } + + if ($$self.$$.dirty[1] & /*xLowerBound, xUpperBound, xStep*/ 7) { + $$invalidate(20, xPanes = range(xLowerBound, xUpperBound, xStep).iter().map(xMin => vec2.fromValues(xMin, xMin + xStep)).toArray()); + } + + if ($$self.$$.dirty[0] & /*xPaneRange*/ 4194304 | $$self.$$.dirty[1] & /*xLowerBound, xUpperBound*/ 3) { + $$invalidate(22, xPaneRange = vec2.set(xPaneRange, xLowerBound, xUpperBound)); + } + + if ($$self.$$.dirty[0] & /*ySpan*/ 1073741824) { + $$invalidate(29, yStep = Math.pow(base, Math.round(Math.log10(ySpan) / Math.log10(base)))); + } + + if ($$self.$$.dirty[0] & /*min, yStep*/ 536903680) { + $$invalidate(28, yLowerBound = Math.floor(min[0] / yStep) * yStep); + } + + if ($$self.$$.dirty[0] & /*max, yStep*/ 536936448) { + $$invalidate(27, yUpperBound = Math.ceil(max[0] / yStep) * yStep); + } + + if ($$self.$$.dirty[0] & /*yLowerBound, yUpperBound, yStep*/ 939524096) { + $$invalidate(21, yPanes = range(yLowerBound, yUpperBound, yStep).iter().map(yMin => vec2.fromValues(yMin, yMin + yStep)).toArray()); + } + + if ($$self.$$.dirty[0] & /*yPaneRange, yLowerBound, yUpperBound*/ 411041792) { + $$invalidate(23, yPaneRange = vec2.set(yPaneRange, yLowerBound, yUpperBound)); + } + + if ($$self.$$.dirty[0] & /*xPanes, yPanes, xPaneRange, yPaneRange*/ 15728640) { + panesContext.set({ xPanes, yPanes, xPaneRange, yPaneRange }); + } + + if ($$self.$$.dirty[0] & /*min, max, actualWidth, actualHeight*/ 98316) { + coordinateContext.set({ + min, + max, + width: actualWidth, + height: actualHeight + }); + } + + if ($$self.$$.dirty[0] & /*zoomAmount, scaleX, scaleY, span, pixelMatrix, inversePixelMatrix, cssScale*/ 118366208) { + scaleContext.set({ + zoomAmount, + scaleX, + scaleY, + span, + pixelMatrix, + inversePixelMatrix, + cssScale + }); + } + + if ($$self.$$.dirty[0] & /*mapX, mapY*/ 48) { + mapContext.set({ mapX, mapY }); + } + }; + + return [ + width, + pan, + actualWidth, + actualHeight, + mapY, + mapX, + element, + desiredCssHeight, + desiredCssWidth, + xAxisExtent, + yAxisExtent, + height, + zoom, + zoomAmount, + offset, + min, + max, + span, + pixelMatrix, + inversePixelMatrix, + xPanes, + yPanes, + xPaneRange, + yPaneRange, + cssScale, + scaleY, + scaleX, + yUpperBound, + yLowerBound, + yStep, + ySpan, + xUpperBound, + xLowerBound, + xStep, + xSpan, + unscaleY, + unscaleX, + $$scope, + slots, + div_binding, + div_elementresize_handler + ]; +} + +class VisualMath extends SvelteComponent { + constructor(options) { + super(); + + init( + this, + options, + instance, + create_fragment, + safe_not_equal, + { + width: 0, + height: 11, + pan: 1, + zoom: 12, + xAxisExtent: 9, + yAxisExtent: 10 + }, + null, + [-1, -1] + ); + } +} + +export { CartesianCoordinates, Circle, Ellipse, GridPattern, MovablePoint, Point, PointAngle, PointSlope, ThroughPoints, VisualMath, XLabels, YLabels, getCoordinateContext, getMapContext, getPanesContext, getScaleContext, snappedRange };