ocearo-ui 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/404.html +1 -1
- package/README.fr.md +9 -7
- package/README.md +9 -7
- package/__next.__PAGE__.txt +3 -3
- package/__next._full.txt +3 -3
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/0ath9h2eo-m4-.js +1 -0
- package/_next/static/chunks/0bxzs0khjn1uj.js +1 -0
- package/_next/static/chunks/0ejjon45nq_-h.js +9 -0
- package/_next/static/chunks/{0zvzu5fnwh4_a.js → 0glm63vhzbxk5.js} +2 -2
- package/_next/static/chunks/0n5v9mjln3x9c.js +121 -0
- package/_next/static/chunks/{1l-jew0-1-3eq.js → 0ngl63fz0a-bo.js} +2 -2
- package/_next/static/chunks/0nq1o9-m7bhjg.js +1 -0
- package/_next/static/chunks/0vhk5q54me91_.js +1 -0
- package/_next/static/chunks/0wi5jop1ihbm6.js +2 -0
- package/_next/static/chunks/1442uc2w4y1ve.js +503 -0
- package/_next/static/chunks/18vlmqe7txbmt.js +1 -0
- package/_next/static/chunks/{2gr1d26f-ymoh.js → 192c42s2wc7qe.js} +1 -1
- package/_next/static/chunks/1_twx50ejqan5.js +1 -0
- package/_next/static/chunks/1na56snuhu-pc.js +346 -0
- package/_next/static/chunks/{3qik_nv7zlj4e.js → 1quvj-861o57h.js} +1 -1
- package/_next/static/chunks/1vchkqgn-xw-o.js +1 -0
- package/_next/static/chunks/{0j11dppxb9l0b.js → 1zuex-na8y-w4.js} +1 -1
- package/_next/static/chunks/21408p9d6c0sg.js +1 -0
- package/_next/static/chunks/2393lwi8kee3m.js +48 -0
- package/_next/static/chunks/25v2cwta2fy-7.js +393 -0
- package/_next/static/chunks/28wfa6j-9g_qc.js +1 -0
- package/_next/static/chunks/2cecf_xnd_9em.js +1 -0
- package/_next/static/chunks/2die6btm3_mhq.js +1 -0
- package/_next/static/chunks/{18_i6mf6hb_c7.js → 2gsiwp60towtx.js} +1 -1
- package/_next/static/chunks/2ijx7rln4jshb.css +3 -0
- package/_next/static/chunks/2qch0at4eelx8.js +1 -0
- package/_next/static/chunks/2qylgmdj-32um.js +503 -0
- package/_next/static/chunks/2xntuu6mzh41s.js +1 -0
- package/_next/static/chunks/30p1dpgmonstj.js +1 -0
- package/_next/static/chunks/31p7nz0hfuym7.js +1 -0
- package/_next/static/chunks/{1e-w_-usen7fy.js → 34nhy77liurum.js} +2 -2
- package/_next/static/chunks/3h_m2s30sr9mt.js +430 -0
- package/_next/static/chunks/3j453-2u58qbv.js +1 -0
- package/_next/static/chunks/3k-r-4veivdjr.js +1 -0
- package/_next/static/chunks/3l25j666ze4c1.js +1 -0
- package/_next/static/chunks/3nv6p6vvu2zlg.js +1 -0
- package/_next/static/chunks/3yz0mxxv4vrfg.js +1 -0
- package/_next/static/chunks/3z29h80ysf4f1.js +739 -0
- package/_next/static/chunks/40b8ooaw6x7my.js +180 -0
- package/_next/static/chunks/44f5hh9caupby.js +1 -0
- package/_not-found/__next._full.txt +2 -2
- package/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +2 -2
- package/boats/boats.json +11 -19
- package/boats/windsurf/assets/license.txt +6 -8
- package/boats/windsurf/assets/rider.glb +0 -0
- package/boats/wingfoil/assets/license.txt +9 -0
- package/boats/wingfoil/assets/rider.glb +0 -0
- package/guide/bathymetry.jpg +0 -0
- package/guide/weather.jpg +0 -0
- package/index.html +1 -1
- package/index.txt +3 -3
- package/package.json +2 -2
- package/settings/__next._full.txt +3 -3
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +3 -3
- package/settings.html +1 -1
- package/settings.txt +3 -3
- package/_next/static/chunks/0-jqvc-r0kh0c.js +0 -1
- package/_next/static/chunks/05do10p9ldt1p.js +0 -409
- package/_next/static/chunks/096zaxs1gf_3q.js +0 -2
- package/_next/static/chunks/0b3cus8izqkmg.js +0 -119
- package/_next/static/chunks/0jucaltuccn03.js +0 -1
- package/_next/static/chunks/0m7wbuocx-b4_.js +0 -9
- package/_next/static/chunks/1_g85m2d7jjpo.css +0 -3
- package/_next/static/chunks/1arvue9o-atui.js +0 -739
- package/_next/static/chunks/1bo0ke8gjc1c2.js +0 -1
- package/_next/static/chunks/1cp1kkarm5gxz.js +0 -1
- package/_next/static/chunks/1hz_mzl8l35j8.js +0 -1
- package/_next/static/chunks/1k72cpd0x8veh.js +0 -1
- package/_next/static/chunks/2aivnrnff0avu.js +0 -446
- package/_next/static/chunks/2fthh9f57zzm2.js +0 -1
- package/_next/static/chunks/2mzecccvvbjr1.js +0 -1
- package/_next/static/chunks/2r98jty3a4wel.js +0 -564
- package/_next/static/chunks/2v6ebsavxlgyw.js +0 -1
- package/_next/static/chunks/2w71oj1brox5z.js +0 -1
- package/_next/static/chunks/2wayx8t5r5fi9.js +0 -1
- package/_next/static/chunks/33u782y6vhw-f.js +0 -346
- package/_next/static/chunks/3qzb9nvvw-b-k.js +0 -1
- package/_next/static/chunks/3r8nellt-dsed.js +0 -1
- package/_next/static/chunks/3td9mnhvcj9cq.js +0 -1
- package/_next/static/chunks/3wwn1rti8oc_r.js +0 -1
- package/_next/static/chunks/41odv061mfm6t.js +0 -1
- package/_next/static/chunks/432vtxrssprta.js +0 -1
- package/boats/optimist/Scene.jsx +0 -28
- package/boats/optimist/assets/license.txt +0 -11
- package/boats/optimist/assets/scene-transformed.glb +0 -0
- package/boats/sailboat/Scene.jsx +0 -21
- package/boats/sailboat/assets/license.txt +0 -10
- package/boats/sailboat/assets/scene-transformed.glb +0 -0
- package/boats/windsurf/Scene.jsx +0 -22
- package/boats/windsurf/assets/scene-transformed.glb +0 -0
- /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_buildManifest.js +0 -0
- /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44188,e=>{"use strict";var t=e.i(43476),s=e.i(71645);e.i(85269);var a=e.i(22831),l=e.i(49721),i=e.i(68757),n=e.i(83646),d=e.i(83402),o=e.i(5941);let r=[0,.5,1].map(e=>{let{r:t,g:s,b:a}=(0,o.tensionToColor)(e);return`rgb(${Math.round(255*t)}, ${Math.round(255*s)}, ${Math.round(255*a)})`}),c=({kind:e,colors:s})=>{let[a,l,i]=s;return"chevrons"===e?(0,t.jsxs)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"0",y:"2",width:"28",height:"10",rx:"2",fill:a,opacity:"0.35"}),[4,13,22].map(e=>(0,t.jsx)("path",{d:`M${e} 4 l4 3 l-4 3`,stroke:a,strokeWidth:"2",fill:"none"},e))]}):"bands"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:[a,l,i].filter(Boolean).map((e,s,a)=>(0,t.jsx)("rect",{x:28/a.length*s,y:"4",width:28/a.length,height:"6",fill:e},e))}):"dashed"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("line",{x1:"1",y1:"7",x2:"27",y2:"7",stroke:a,strokeWidth:"2",strokeDasharray:"4 3"})}):"hull"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 7 Q8 1 22 2 L26 7 L22 12 Q8 13 2 7 Z",fill:a,stroke:l,strokeWidth:"1"})}):"arrow"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 7 H20 M15 2 L21 7 L15 12",stroke:a,strokeWidth:"2.5",fill:"none"})}):null},x=()=>{let{t:e}=(0,a.useTranslation)(),{scene:t,accent:s}=(0,n.default)();return[{kind:"chevrons",colors:[t.route],label:e("legend.route")},{kind:"bands",colors:[t.wakeGood,t.wakeFair,t.wakeBad],label:e("legend.wake")},{kind:"bands",colors:[t.laylinePort,t.laylineStarboard],label:e("legend.laylines")},{kind:"dashed",colors:[t.compass],label:e("legend.isochrones")},{kind:"hull",colors:[t.ghost,t.ghost],label:e("legend.ghost")},{kind:"hull",colors:[t.vessel,t.vessel],label:e("legend.vessel")},{kind:"hull",colors:[t.vesselDanger,t.vesselDanger],label:e("legend.danger")},{kind:"hull",colors:[t.vesselYields,t.vesselYields],label:e("legend.yields")},{kind:"hull",colors:[t.vesselClose,t.vesselClose],label:e("legend.close")},{kind:"dashed",colors:[t.vesselDanger],label:e("legend.cpa")},{kind:"hull",colors:[t.giveWay,t.giveWay],label:e("legend.giveWay")},{kind:"dashed",colors:[t.target],label:e("legend.advice")},{kind:"bands",colors:[s],label:e("legend.trim")},{kind:"bands",colors:r,label:e("legend.loads")}]},h=({className:e="gap-1 text-caption"})=>{let s=x();return(0,t.jsx)("ul",{className:`flex flex-col text-hud-main leading-tight ${e}`,children:s.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"shrink-0 w-7 flex justify-center",children:(0,t.jsx)(c,{kind:e.kind,colors:e.colors})}),(0,t.jsx)("span",{children:e.label})]},e.label))})};e.s(["LegendList",0,h,"default",0,()=>{let{t:e}=(0,a.useTranslation)(),[n,o]=(0,s.useState)(()=>!0===d.default.get("sceneLegendOpen")),r=()=>{d.default.set("sceneLegendOpen",!n),o(!n)};return n?(0,t.jsxs)("div",{className:"relative z-40 px-3 py-2 max-w-[19rem] max-h-[45vh] overflow-y-auto select-none rounded-2xl bg-hud-bg/90 backdrop-blur shadow-soft",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted",children:e("legend.title")}),(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":e("common.close"),className:"text-hud-muted hover:text-hud-main px-1",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faXmark})})]}),(0,t.jsx)(h,{})]}):(0,t.jsxs)("button",{type:"button",onClick:r,className:"hud-halo flex items-center gap-2 px-2 py-1 text-caption font-semibold uppercase tracking-widest text-hud-muted hover:text-hud-main",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faCircleInfo}),e("legend.title")]})},"useLegendRows",0,x])},5941,e=>{"use strict";let t=[1,.8,.6];function s(e){return t[Math.min(Math.max(e,0),2)]}function a(e,t){return Math.max(.05,Math.min(1,1-.6*e-.3*t))}function l(e,t){return Math.PI/6*Math.max(0,1-1.9438444924574*t/30)*(1-e)}function i(e,t,s){let a=Math.min(1,1.9438444924574*(e.tws||0)/30),l=t.tension||.5;switch(s){case"mainSheet":return Math.min(1,.5*a+.3*l+.3*t.mainCar);case"jibSheet":return Math.min(1,.5*a+.3*l+.3*t.jibCar);case"vang":return Math.min(1,.6*a+.4*l);case"cunningham":return Math.min(1,.4*a+.6*l);case"backstay":return Math.min(1,Math.max(0,1-Math.abs(Math.atan2(Math.sin(e.awa||0),Math.cos(e.awa||0)))/Math.PI)*a*.9+.3*l);default:return l}}function n(e){let t=Math.max(0,Math.min(1,e));if(t<=.5){let e=2*t;return{r:e,g:1-.3*e,b:0}}return{r:1,g:.7*(1-(t-.5)*2),b:0}}e.s(["getReefHeightFactor",0,s,"tensionToColor",0,n,"updateSailTrim",0,function({tws:e=0,twa:t=0,awa:d=0,mainCar:o=.5,jibCar:r=.5,tension:c=.5}){let x,h=(x=1.9438444924574*e)>25?2:+(x>18),u=s(h),m=a(o,c),g=a(r,c),
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44188,e=>{"use strict";var t=e.i(43476),s=e.i(71645);e.i(85269);var a=e.i(22831),l=e.i(49721),i=e.i(68757),n=e.i(83646),d=e.i(83402),o=e.i(5941);let r=[0,.5,1].map(e=>{let{r:t,g:s,b:a}=(0,o.tensionToColor)(e);return`rgb(${Math.round(255*t)}, ${Math.round(255*s)}, ${Math.round(255*a)})`}),c=({kind:e,colors:s})=>{let[a,l,i]=s;return"chevrons"===e?(0,t.jsxs)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"0",y:"2",width:"28",height:"10",rx:"2",fill:a,opacity:"0.35"}),[4,13,22].map(e=>(0,t.jsx)("path",{d:`M${e} 4 l4 3 l-4 3`,stroke:a,strokeWidth:"2",fill:"none"},e))]}):"bands"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:[a,l,i].filter(Boolean).map((e,s,a)=>(0,t.jsx)("rect",{x:28/a.length*s,y:"4",width:28/a.length,height:"6",fill:e},e))}):"dashed"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("line",{x1:"1",y1:"7",x2:"27",y2:"7",stroke:a,strokeWidth:"2",strokeDasharray:"4 3"})}):"hull"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 7 Q8 1 22 2 L26 7 L22 12 Q8 13 2 7 Z",fill:a,stroke:l,strokeWidth:"1"})}):"arrow"===e?(0,t.jsx)("svg",{width:"28",height:"14",viewBox:"0 0 28 14","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 7 H20 M15 2 L21 7 L15 12",stroke:a,strokeWidth:"2.5",fill:"none"})}):null},x=()=>{let{t:e}=(0,a.useTranslation)(),{scene:t,accent:s}=(0,n.default)();return[{kind:"chevrons",colors:[t.route],label:e("legend.route")},{kind:"bands",colors:[t.wakeGood,t.wakeFair,t.wakeBad],label:e("legend.wake")},{kind:"bands",colors:[t.laylinePort,t.laylineStarboard],label:e("legend.laylines")},{kind:"dashed",colors:[t.compass],label:e("legend.isochrones")},{kind:"hull",colors:[t.ghost,t.ghost],label:e("legend.ghost")},{kind:"hull",colors:[t.vessel,t.vessel],label:e("legend.vessel")},{kind:"hull",colors:[t.vesselDanger,t.vesselDanger],label:e("legend.danger")},{kind:"hull",colors:[t.vesselYields,t.vesselYields],label:e("legend.yields")},{kind:"hull",colors:[t.vesselClose,t.vesselClose],label:e("legend.close")},{kind:"dashed",colors:[t.vesselDanger],label:e("legend.cpa")},{kind:"hull",colors:[t.giveWay,t.giveWay],label:e("legend.giveWay")},{kind:"dashed",colors:[t.target],label:e("legend.advice")},{kind:"bands",colors:[s],label:e("legend.trim")},{kind:"bands",colors:r,label:e("legend.loads")}]},h=({className:e="gap-1 text-caption"})=>{let s=x();return(0,t.jsx)("ul",{className:`flex flex-col text-hud-main leading-tight ${e}`,children:s.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"shrink-0 w-7 flex justify-center",children:(0,t.jsx)(c,{kind:e.kind,colors:e.colors})}),(0,t.jsx)("span",{children:e.label})]},e.label))})};e.s(["LegendList",0,h,"default",0,()=>{let{t:e}=(0,a.useTranslation)(),[n,o]=(0,s.useState)(()=>!0===d.default.get("sceneLegendOpen")),r=()=>{d.default.set("sceneLegendOpen",!n),o(!n)};return n?(0,t.jsxs)("div",{className:"relative z-40 px-3 py-2 max-w-[19rem] max-h-[45vh] overflow-y-auto select-none rounded-2xl bg-hud-bg/90 backdrop-blur shadow-soft",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted",children:e("legend.title")}),(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":e("common.close"),className:"text-hud-muted hover:text-hud-main px-1",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faXmark})})]}),(0,t.jsx)(h,{})]}):(0,t.jsxs)("button",{type:"button",onClick:r,className:"hud-halo flex items-center gap-2 px-2 py-1 text-caption font-semibold uppercase tracking-widest text-hud-muted hover:text-hud-main",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faCircleInfo}),e("legend.title")]})},"useLegendRows",0,x])},5941,e=>{"use strict";let t=[1,.8,.6];function s(e){return t[Math.min(Math.max(e,0),2)]}function a(e,t){return Math.max(.05,Math.min(1,1-.6*e-.3*t))}function l(e,t){return Math.PI/6*Math.max(0,1-1.9438444924574*t/30)*(1-e)}function i(e,t,s){let a=Math.min(1,1.9438444924574*(e.tws||0)/30),l=t.tension||.5;switch(s){case"mainSheet":return Math.min(1,.5*a+.3*l+.3*t.mainCar);case"jibSheet":return Math.min(1,.5*a+.3*l+.3*t.jibCar);case"vang":return Math.min(1,.6*a+.4*l);case"cunningham":return Math.min(1,.4*a+.6*l);case"backstay":return Math.min(1,Math.max(0,1-Math.abs(Math.atan2(Math.sin(e.awa||0),Math.cos(e.awa||0)))/Math.PI)*a*.9+.3*l);default:return l}}function n(e){let t=Math.max(0,Math.min(1,e));if(t<=.5){let e=2*t;return{r:e,g:1-.3*e,b:0}}return{r:1,g:.7*(1-(t-.5)*2),b:0}}e.s(["getReefHeightFactor",0,s,"tensionToColor",0,n,"updateSailTrim",0,function({tws:e=0,twa:t=0,awa:d=0,mainCar:o=.5,jibCar:r=.5,tension:c=.5}){let x,h=(x=1.9438444924574*e)>25?2:+(x>18),u=s(h),m=a(o,c),g=a(r,c),b=l(o,e),p=l(r,e),f={tws:e,twa:t,awa:d},y={mainCar:o,jibCar:r,tension:c},j={mainSheet:i(f,y,"mainSheet"),jibSheet:i(f,y,"jibSheet"),vang:i(f,y,"vang"),cunningham:i(f,y,"cunningham"),backstay:i(f,y,"backstay")},v={mainSheet:n(j.mainSheet),jibSheet:n(j.jibSheet),vang:n(j.vang),cunningham:n(j.cunningham),backstay:n(j.backstay)};return{reefLevel:h,reefHeightFactor:u,mainCamber:m,jibCamber:g,mainTwist:b,jibTwist:p,tensions:j,tensionColors:v}}])},70546,e=>{"use strict";var t=e.i(43476),s=e.i(71645);e.i(85269);var a=e.i(22831),l=e.i(49721),i=e.i(68757);let n=[{id:"start",steps:["connect","demo","views","phone","settings"]},{id:"view",image:"hero.jpg",spots:[{id:"toolbar",x:13.5,y:3},{id:"speed",x:6.5,y:10},{id:"values",x:6,y:23},{id:"legend",x:6,y:33},{id:"sky",x:90,y:3},{id:"sails",x:49,y:33},{id:"ais",x:79,y:29.5},{id:"compass",x:60,y:66},{id:"wake",x:50,y:85},{id:"depth",x:13.5,y:84},{id:"tide",x:82,y:83},{id:"bottom",x:12.8,y:96},{id:"readings",x:94,y:97},{id:"shortcuts",x:50,y:96}]},{id:"route",image:"polars.jpg",spots:[{id:"toggles",x:15,y:3},{id:"waypoint",x:9,y:35},{id:"route",x:40.6,y:33},{id:"isochrones",x:58,y:32},{id:"laylines",x:19,y:48},{id:"wake",x:43,y:87}]},{id:"traffic",image:"traffic.jpg",spots:[{id:"toggle",x:22,y:3.5},{id:"banner",x:50,y:9},{id:"yields",x:34,y:26},{id:"tags",x:57.5,y:21},{id:"danger",x:45,y:45.5},{id:"advice",x:33,y:87}]},{id:"anchor",image:"anchor.jpg",spots:[{id:"button",x:5,y:3.5},{id:"position",x:11,y:8},{id:"values",x:3.5,y:37},{id:"alarm",x:91,y:64},{id:"swing",x:37.5,y:60.5},{id:"track",x:47.5,y:57},{id:"anchorPoint",x:61,y:59}]},{id:"parking",image:"parking.jpg",spots:[{id:"button",x:7.8,y:3.5},{id:"berth",x:50,y:31},{id:"path",x:49,y:41},{id:"wind",x:42,y:64},{id:"depth",x:6,y:81},{id:"guidance",x:40,y:84},{id:"types",x:66,y:90}]},{id:"bathymetry",image:"bathymetry.jpg",spots:[{id:"button",x:17.1,y:4.6},{id:"coast",x:25.8,y:11.8},{id:"soundings",x:76.5,y:14.4},{id:"seabed",x:34.4,y:77.8},{id:"keel",x:52.5,y:57.5}]},{id:"weather",image:"weather.jpg",spots:[{id:"button",x:20.6,y:4.6},{id:"slider",x:50,y:10},{id:"wind",x:76.6,y:16},{id:"current",x:34,y:45.8}]},{id:"mob",image:"mob.jpg",spots:[{id:"button",x:12.75,y:96},{id:"alert",x:66,y:6},{id:"marker",x:75,y:59},{id:"drift",x:68,y:63.5},{id:"return",x:61,y:55.5}]},{id:"dashboard",image:"dashboard.jpg",spots:[{id:"view",x:20,y:44},{id:"radar",x:60,y:39},{id:"range",x:75,y:5},{id:"tactical",x:60,y:79},{id:"weather",x:90,y:24},{id:"course",x:90,y:62}]},{id:"logbook",image:"logbook.jpg",spots:[{id:"tabs",x:69,y:6.3},{id:"add",x:93,y:12},{id:"entries",x:69,y:30}]},{id:"legend",legend:!0}];var d=e.i(44188),o=e.i(83402);let r=e=>Math.min(97,Math.max(3,e)),c=({n:e,x:s,y:a,active:l,label:i,onClick:n})=>(0,t.jsxs)("button",{type:"button",onClick:n,"aria-label":`${e}. ${i}`,"aria-pressed":l,className:`absolute -translate-x-1/2 -translate-y-1/2 rounded-full flex items-center justify-center font-bold leading-none shadow-soft transition-transform duration-200
|
|
2
2
|
w-6 h-6 text-[11px] sm:w-7 sm:h-7 sm:text-xs ring-2 ring-white
|
|
3
|
-
${l?"bg-oYellow text-black scale-125 z-10":"bg-oBlue text-white hover:scale-110"}`,style:{left:`${r(s)}%`,top:`${r(a)}%`},children:[l&&(0,t.jsx)("span",{className:"absolute inset-0 rounded-full bg-oYellow animate-ping opacity-60","aria-hidden":"true"}),(0,t.jsx)("span",{className:"relative",children:e})]}),x=({section:e,base:n})=>{let{t:d}=(0,a.useTranslation)(),[o,r]=(0,s.useState)(0),x=(t,s)=>`guide.${e.id}.spots.${t.id}.${s}`,h=e.spots[o];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("figure",{className:"relative w-full mx-auto rounded-xl overflow-visible bg-hud-elevated",style:{maxWidth:"calc(60vh * 16 / 9)"},children:[(0,t.jsx)("img",{src:`${n}/${e.image}`,alt:d(`guide.${e.id}.title`),className:"w-full h-auto rounded-xl block select-none",draggable:!1}),e.spots.map((e,s)=>(0,t.jsx)(c,{n:s+1,x:e.x,y:e.y,active:s===o,label:d(x(e,"title")),onClick:()=>r(s)},e.id))]}),(0,t.jsxs)("div",{className:"mt-3 mx-auto rounded-xl border border-hud bg-hud-elevated px-4 py-3 flex items-start gap-3",style:{maxWidth:"calc(60vh * 16 / 9)"},"aria-live":"polite",children:[(0,t.jsx)("span",{className:"shrink-0 w-7 h-7 rounded-full bg-oYellow text-black text-xs font-bold flex items-center justify-center",children:o+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-label font-semibold text-hud-main",children:d(x(h,"title"))}),(0,t.jsx)("p",{className:"text-label text-hud-secondary mt-0.5",children:d(x(h,"text"))})]}),(0,t.jsxs)("div",{className:"shrink-0 flex gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>r((o+e.spots.length-1)%e.spots.length),"aria-label":d("guide.previousSpot"),className:"w-8 h-8 rounded-lg text-hud-secondary hover:text-hud-main tesla-hover",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronLeft})}),(0,t.jsx)("button",{type:"button",onClick:()=>r((o+1)%e.spots.length),"aria-label":d("guide.nextSpot"),className:"w-8 h-8 rounded-lg text-hud-secondary hover:text-hud-main tesla-hover",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronRight})})]})]}),(0,t.jsx)("ol",{className:"mt-4 grid gap-2 lg:grid-cols-2",children:e.spots.map((e,s)=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>r(s),className:`w-full text-left flex items-start gap-3 rounded-xl px-3 py-2 transition-colors ${s===o?"bg-hud-elevated":"tesla-hover"}`,children:[(0,t.jsx)("span",{className:`shrink-0 mt-0.5 w-6 h-6 rounded-full text-[11px] font-bold flex items-center justify-center ${s===o?"bg-oYellow text-black":"bg-oBlue text-white"}`,children:s+1}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block text-label font-semibold text-hud-main",children:d(x(e,"title"))}),(0,t.jsx)("span",{className:"block text-label text-hud-secondary",children:d(x(e,"text"))})]})]})},e.id))})]})},h=({section:e})=>{let{t:s}=(0,a.useTranslation)();return(0,t.jsx)("ol",{className:"grid gap-3",children:e.steps.map((e,a)=>(0,t.jsxs)("li",{className:"flex items-start gap-3 rounded-xl bg-hud-elevated px-4 py-3",children:[(0,t.jsx)("span",{className:"shrink-0 mt-0.5 w-6 h-6 rounded-full bg-oBlue text-white text-[11px] font-bold flex items-center justify-center",children:a+1}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block text-label font-semibold text-hud-main",children:s(`guide.start.steps.${e}.title`)}),(0,t.jsx)("span",{className:"block text-label text-hud-secondary",children:s(`guide.start.steps.${e}.text`)})]})]},e))})},u=({base:e="./guide"})=>{let{t:r}=(0,a.useTranslation)(),[c,u]=(0,s.useState)(()=>{let e=n.findIndex(e=>e.id===o.default.get("guideSection"));return e>=0?e:0}),m=(0,s.useRef)(null),g=n[c];(0,s.useEffect)(()=>{o.default.set("guideSection",g.id),m.current?.scrollTo({top:0})},[g.id]);let
|
|
3
|
+
${l?"bg-oYellow text-black scale-125 z-10":"bg-oBlue text-white hover:scale-110"}`,style:{left:`${r(s)}%`,top:`${r(a)}%`},children:[l&&(0,t.jsx)("span",{className:"absolute inset-0 rounded-full bg-oYellow animate-ping opacity-60","aria-hidden":"true"}),(0,t.jsx)("span",{className:"relative",children:e})]}),x=({section:e,base:n})=>{let{t:d}=(0,a.useTranslation)(),[o,r]=(0,s.useState)(0),x=(t,s)=>`guide.${e.id}.spots.${t.id}.${s}`,h=e.spots[o];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("figure",{className:"relative w-full mx-auto rounded-xl overflow-visible bg-hud-elevated",style:{maxWidth:"calc(60vh * 16 / 9)"},children:[(0,t.jsx)("img",{src:`${n}/${e.image}`,alt:d(`guide.${e.id}.title`),className:"w-full h-auto rounded-xl block select-none",draggable:!1}),e.spots.map((e,s)=>(0,t.jsx)(c,{n:s+1,x:e.x,y:e.y,active:s===o,label:d(x(e,"title")),onClick:()=>r(s)},e.id))]}),(0,t.jsxs)("div",{className:"mt-3 mx-auto rounded-xl border border-hud bg-hud-elevated px-4 py-3 flex items-start gap-3",style:{maxWidth:"calc(60vh * 16 / 9)"},"aria-live":"polite",children:[(0,t.jsx)("span",{className:"shrink-0 w-7 h-7 rounded-full bg-oYellow text-black text-xs font-bold flex items-center justify-center",children:o+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-label font-semibold text-hud-main",children:d(x(h,"title"))}),(0,t.jsx)("p",{className:"text-label text-hud-secondary mt-0.5",children:d(x(h,"text"))})]}),(0,t.jsxs)("div",{className:"shrink-0 flex gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>r((o+e.spots.length-1)%e.spots.length),"aria-label":d("guide.previousSpot"),className:"w-8 h-8 rounded-lg text-hud-secondary hover:text-hud-main tesla-hover",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronLeft})}),(0,t.jsx)("button",{type:"button",onClick:()=>r((o+1)%e.spots.length),"aria-label":d("guide.nextSpot"),className:"w-8 h-8 rounded-lg text-hud-secondary hover:text-hud-main tesla-hover",children:(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronRight})})]})]}),(0,t.jsx)("ol",{className:"mt-4 grid gap-2 lg:grid-cols-2",children:e.spots.map((e,s)=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>r(s),className:`w-full text-left flex items-start gap-3 rounded-xl px-3 py-2 transition-colors ${s===o?"bg-hud-elevated":"tesla-hover"}`,children:[(0,t.jsx)("span",{className:`shrink-0 mt-0.5 w-6 h-6 rounded-full text-[11px] font-bold flex items-center justify-center ${s===o?"bg-oYellow text-black":"bg-oBlue text-white"}`,children:s+1}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block text-label font-semibold text-hud-main",children:d(x(e,"title"))}),(0,t.jsx)("span",{className:"block text-label text-hud-secondary",children:d(x(e,"text"))})]})]})},e.id))})]})},h=({section:e})=>{let{t:s}=(0,a.useTranslation)();return(0,t.jsx)("ol",{className:"grid gap-3",children:e.steps.map((e,a)=>(0,t.jsxs)("li",{className:"flex items-start gap-3 rounded-xl bg-hud-elevated px-4 py-3",children:[(0,t.jsx)("span",{className:"shrink-0 mt-0.5 w-6 h-6 rounded-full bg-oBlue text-white text-[11px] font-bold flex items-center justify-center",children:a+1}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block text-label font-semibold text-hud-main",children:s(`guide.start.steps.${e}.title`)}),(0,t.jsx)("span",{className:"block text-label text-hud-secondary",children:s(`guide.start.steps.${e}.text`)})]})]},e))})},u=({base:e="./guide"})=>{let{t:r}=(0,a.useTranslation)(),[c,u]=(0,s.useState)(()=>{let e=n.findIndex(e=>e.id===o.default.get("guideSection"));return e>=0?e:0}),m=(0,s.useRef)(null),g=n[c];(0,s.useEffect)(()=>{o.default.set("guideSection",g.id),m.current?.scrollTo({top:0})},[g.id]);let b=n[c-1],p=n[c+1];return(0,t.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,t.jsx)("nav",{className:"flex gap-1 px-2 py-2 border-b border-hud overflow-x-auto scrollbar-hide shrink-0","aria-label":r("guide.tab"),children:n.map((e,s)=>(0,t.jsx)("button",{type:"button",onClick:()=>u(s),"aria-current":s===c,className:`shrink-0 px-3 py-1.5 rounded-full text-caption font-semibold uppercase tracking-wide whitespace-nowrap transition-colors ${s===c?"bg-oBlue text-white":"text-hud-secondary tesla-hover"}`,children:r(`guide.${e.id}.title`)},e.id))}),(0,t.jsx)("div",{ref:m,className:"flex-1 min-h-0 overflow-y-auto",children:(0,t.jsxs)("article",{className:"max-w-5xl mx-auto px-4 py-4",children:[(0,t.jsx)("h2",{className:"text-value font-semibold text-hud-main",children:r(`guide.${g.id}.title`)}),(0,t.jsx)("p",{className:"text-label text-hud-secondary mt-1 mb-4",children:r(`guide.${g.id}.intro`)}),g.image&&(0,t.jsx)(x,{section:g,base:e},g.id),g.steps&&(0,t.jsx)(h,{section:g}),g.legend&&(0,t.jsx)("div",{className:"rounded-xl bg-hud-elevated px-4 py-3",children:(0,t.jsx)(d.LegendList,{className:"gap-2 text-label"})}),(0,t.jsxs)("div",{className:"flex justify-between gap-2 mt-6",children:[b?(0,t.jsxs)("button",{type:"button",onClick:()=>u(c-1),className:"px-3 py-2 rounded-xl text-label text-hud-secondary hover:text-hud-main tesla-hover",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronLeft,className:"mr-2"}),r(`guide.${b.id}.title`)]}):(0,t.jsx)("span",{}),p&&(0,t.jsxs)("button",{type:"button",onClick:()=>u(c+1),className:"px-3 py-2 rounded-xl text-label font-semibold text-oBlue tesla-hover",children:[r(`guide.${p.id}.title`),(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faChevronRight,className:"ml-2"})]})]})]})})]})},m={guide:!0},g=e=>e.guide?"guide":e.file||e.url;e.s(["default",0,({path:e})=>{let[n,d]=(0,s.useState)([]),[o,r]=(0,s.useState)(m),[c,x]=(0,s.useState)(!1),{t:h}=(0,a.useTranslation)();(0,s.useEffect)(()=>{(async()=>{try{let t=await fetch(`${e}/index.json`);if(!t.ok)throw Error("Network response was not ok");d(await t.json())}catch(e){console.warn("Manuals: cannot list the documents:",e.message),x(!0)}})()},[e]);let b=[{...m,title:h("guide.tab")},...n],p=o.file?`${e}/${o.file}`:null,f=o.file?.toLowerCase().endsWith(".pdf");return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-rightPaneBg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex border-b border-hud bg-hud-bg overflow-x-auto scrollbar-hide shrink-0",children:b.map(e=>(0,t.jsxs)("button",{onClick:()=>r(e),className:`flex-1 py-3 px-3 text-caption font-semibold uppercase flex items-center justify-center transition-all duration-500 whitespace-nowrap ${g(o)===g(e)?"text-oGreen border-b-2 border-oGreen bg-hud-bg":"text-hud-secondary hover:text-hud-main tesla-hover"}`,children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:e.guide?i.faBookOpen:e.url?i.faGlobe:i.faFileAlt,className:"mr-2"}),e.title]},g(e)))}),(0,t.jsxs)("div",{className:"flex-grow min-h-0 bg-hud-bg text-hud-main flex flex-col",children:[o.guide&&(0,t.jsx)(u,{}),p&&f&&(0,t.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 self-end m-2 px-3 py-1.5 rounded-lg text-caption font-semibold uppercase tracking-wide text-oBlue tesla-hover",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faArrowUpRightFromSquare,className:"mr-2"}),h("manual.openNewTab")]}),p&&(0,t.jsx)("iframe",{src:p,title:o.title,className:"flex-1 w-full border-0"}),o.url&&(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-6 text-center",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faGlobe,className:"text-4xl text-hud-muted"}),(0,t.jsx)("div",{className:"text-value font-semibold text-hud-main",children:o.title}),(0,t.jsx)("p",{className:"text-label text-hud-secondary max-w-md",children:h("manual.online")}),(0,t.jsxs)("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 rounded-xl bg-oBlue text-white text-label font-semibold",children:[(0,t.jsx)(l.FontAwesomeIcon,{icon:i.faArrowUpRightFromSquare,className:"mr-2"}),h("manual.openNewTab")]})]}),c&&!o.guide&&(0,t.jsx)("div",{className:"text-label text-hud-secondary p-6 text-center",children:h("manual.unavailable")})]})]})}],70546)},23298,function(e){e.n(e.i(70546))},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])}]);
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43758,e=>{"use strict";var t=e.i(43476),i=e.i(71645),n=e.i(90072),r=e.i(90874),a=e.i(92923),o=a,s=e.i(30728);class l extends s.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setPositions(i),this}setColors(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setColors(i),this}setFromPoints(e){let t=e.length-1,i=new Float32Array(6*t);for(let n=0;n<t;n++)i[6*n]=e[n].x,i[6*n+1]=e[n].y,i[6*n+2]=e[n].z||0,i[6*n+3]=e[n+1].x,i[6*n+4]=e[n+1].y,i[6*n+5]=e[n+1].z||0;return super.setPositions(i),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}var u=e.i(27530);class d extends o.LineSegments2{constructor(e=new l,t=new u.LineMaterial({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let c=e=>e instanceof n.Vector3||e instanceof n.Vector4?[e.x,e.y,e.z]:e instanceof n.Vector2?[e.x,e.y,0]:Array.isArray(e)?2===e.length?[e[0],e[1],0]:[e[0],e[1],e[2]]:[e,0,0],f=e=>e instanceof n.Color?e.toArray():e,h=(0,i.forwardRef)(function({points:e,color:n=0xffffff,vertexColors:o,linewidth:h,lineWidth:p,segments:m,dashed:g,...v},y){let w=(0,r.useThree)(e=>e.size),x=(0,i.useMemo)(()=>m?new a.LineSegments2:new d,[m]),[S]=(0,i.useState)(()=>new u.LineMaterial),b=o?.[0]?.length===4?4:3,M=e.flatMap(c),E=M.join(","),P=o?o.flatMap(f):null,_=P?P.join(","):"",A=(0,i.useMemo)(()=>{let e=m?new s.LineSegmentsGeometry:new l;return e.setPositions(M),P&&e.setColors(P,b),e},[E,_,m,b]);return(0,i.useLayoutEffect)(()=>{x.computeLineDistances()},[A,x]),(0,i.useLayoutEffect)(()=>{g?S.defines.USE_DASH="":delete S.defines.USE_DASH,S.needsUpdate=!0},[g,S]),(0,i.useEffect)(()=>()=>A.dispose(),[A]),(0,i.useEffect)(()=>()=>S.dispose(),[S]),(0,t.jsxs)("primitive",{object:x,ref:y,...v,children:[(0,t.jsx)("primitive",{object:A,attach:"geometry"}),(0,t.jsx)("primitive",{object:S,attach:"material",color:o?0xffffff:n,vertexColors:!!o,resolution:[w.width,w.height],linewidth:h??p??1,dashed:g,transparent:4===b,...v})]})});e.s(["default",0,h],43758)},78461,e=>{"use strict";var t=e.i(71645),i=e.i(85709),n=e.i(67561);let r=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],a=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,n.useOcearoContext)(),o=(0,i.useSignalKPaths)(r),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),u=o["navigation.position"],d=Number.isFinite(u?.latitude)&&Number.isFinite(u?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!d)return{x:0,y:0};let t={lat:u.latitude,lon:u.longitude};return e(t,(a||(a=t),a))},[u,d,e]),hasFix:d,hasHeading:l}},"getSessionOrigin",0,()=>a])},5941,e=>{"use strict";let t=[1,.8,.6];function i(e){return t[Math.min(Math.max(e,0),2)]}function n(e,t){return Math.max(.05,Math.min(1,1-.6*e-.3*t))}function r(e,t){return Math.PI/6*Math.max(0,1-1.9438444924574*t/30)*(1-e)}function a(e,t,i){let n=Math.min(1,1.9438444924574*(e.tws||0)/30),r=t.tension||.5;switch(i){case"mainSheet":return Math.min(1,.5*n+.3*r+.3*t.mainCar);case"jibSheet":return Math.min(1,.5*n+.3*r+.3*t.jibCar);case"vang":return Math.min(1,.6*n+.4*r);case"cunningham":return Math.min(1,.4*n+.6*r);case"backstay":return Math.min(1,Math.max(0,1-Math.abs(Math.atan2(Math.sin(e.awa||0),Math.cos(e.awa||0)))/Math.PI)*n*.9+.3*r);default:return r}}function o(e){let t=Math.max(0,Math.min(1,e));if(t<=.5){let e=2*t;return{r:e,g:1-.3*e,b:0}}return{r:1,g:.7*(1-(t-.5)*2),b:0}}e.s(["getReefHeightFactor",0,i,"tensionToColor",0,o,"updateSailTrim",0,function({tws:e=0,twa:t=0,awa:s=0,mainCar:l=.5,jibCar:u=.5,tension:d=.5}){let c,f=(c=1.9438444924574*e)>25?2:+(c>18),h=i(f),p=n(l,d),m=n(u,d),g=r(l,e),v=r(u,e),y={tws:e,twa:t,awa:s},w={mainCar:l,jibCar:u,tension:d},x={mainSheet:a(y,w,"mainSheet"),jibSheet:a(y,w,"jibSheet"),vang:a(y,w,"vang"),cunningham:a(y,w,"cunningham"),backstay:a(y,w,"backstay")},S={mainSheet:o(x.mainSheet),jibSheet:o(x.jibSheet),vang:o(x.vang),cunningham:o(x.cunningham),backstay:o(x.backstay)};return{reefLevel:f,reefHeightFactor:h,mainCamber:p,jibCamber:m,mainTwist:g,jibTwist:v,tensions:x,tensionColors:S}}])},77291,24752,e=>{"use strict";var t=e.i(71645),i=e.i(62588),n=e.i(85709),r=e.i(61969),a=e.i(539);let o=Math.PI/180,s={power:1,sail:2,fishing:3,restricted:4},l=e=>{let t=String(e.navState||"").toLowerCase();if(/not under command|restricted|constrained/.test(t))return"restricted";if(/fishing/.test(t))return"fishing";if(/sailing/.test(t))return"sail";if(/motoring|engine/.test(t))return"power";let i=Number(e.shipType);return 36===i?"sail":30===i?"fishing":33===i?"restricted":"power"},u=(e,t,i)=>(0,a.wrapPi)(Math.atan2(t.x-e.x,t.y-e.y)-i),d=(e,t,i)=>{let n={x:0,y:0},r=u(n,t,e.course),l=u(t,n,t.course),d=Math.sign(l)||1,c=e=>Math.abs(e)>112.5*o;if(c(r)&&t.speed>e.speed)return{ownRole:"stand-on",rule:"13",reason:"overtakenByTarget",targetTurn:0};if(c(l)&&e.speed>t.speed)return{ownRole:"give-way",rule:"13",reason:"overtaking",targetTurn:0};let f=s[e.category]??1,h=s[t.category]??1;if(f!==h)return f<h?{ownRole:"give-way",rule:"18",reason:`giveWayTo_${t.category}`,targetTurn:0}:{ownRole:"stand-on",rule:"18",reason:`standOnFrom_${t.category}`,targetTurn:d};if("sail"===e.category&&Number.isFinite(i)){let n=(0,a.wrapPi)(i-e.course)>=0?"starboard":"port";return n!==((0,a.wrapPi)(i-t.course)>=0?"starboard":"port")?"port"===n?{ownRole:"give-way",rule:"12a-i",reason:"portTack",targetTurn:0}:{ownRole:"stand-on",rule:"12a-i",reason:"targetPortTack",targetTurn:d}:t.x*Math.sin(i)+t.y*Math.cos(i)>0?{ownRole:"stand-on",rule:"12a-ii",reason:"targetWindward",targetTurn:d}:{ownRole:"give-way",rule:"12a-ii",reason:"ownWindward",targetTurn:0}}return Math.abs((0,a.wrapPi)(t.course-e.course-Math.PI))<10*o&&Math.abs(r)<6*o?{ownRole:"both",rule:"14",reason:"headOn",targetTurn:1}:r>0?{ownRole:"give-way",rule:"15",reason:"crossingStarboard",targetTurn:0}:{ownRole:"stand-on",rule:"15",reason:"crossingPort",targetTurn:d}};e.s(["rightOfWay",0,d,"targetCategory",0,l],24752);var c=e.i(83402),f=e.i(67561);let h=[],p=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,({always:e=!1}={})=>{let a,o,{targets:s}=(0,i.useAIS)({passive:!0}),{states:u}=(0,f.useOcearoContext)(),m=u.anchorWatch||u.parkingMode||u.moored,g=(e||u.ais)&&!m?s:h,{twd:v,heading:y}=(0,r.default)(),w=(0,n.useSignalKPaths)(p),x=(a=(0,n.useSignalKPrefix)("propulsion."),o=c.default.get("ownVesselCategory"),(0,t.useMemo)(()=>"sail"===o||"power"===o?o:Object.entries(a).some(([e,t])=>e.endsWith(".revolutions")&&Number(t)>.5||e.endsWith(".state")&&"started"===t)?"power":"sail",[a,o])),S=c.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let e=w["navigation.courseOverGroundTrue"]??y,t=w["navigation.speedOverGround"]??0,i=[];if(Number.isFinite(e))for(let n of g){if("danger"!==n.risk)continue;let r=n.cog??n.cogMagnetic??n.heading;if(!Number.isFinite(r)||null===n.sceneX)continue;let a=d({course:e,speed:t,category:x},{x:n.sceneX/S,y:-n.sceneZ/S,course:r,speed:n.sog??0,category:l(n)},v);i.push({target:{...n},role:a})}i.sort((e,t)=>(e.target.tcpaSeconds??1/0)-(t.target.tcpaSeconds??1/0));let n={};for(let e of g)"close"===e.risk?n[e.mmsi]="close":"danger"===e.risk&&(n[e.mmsi]="giveWay");for(let e of i)n[e.target.mmsi]="stand-on"===e.role.ownRole?"yields":"giveWay";let r=i.filter(e=>"stand-on"!==e.role.ownRole);return{ownCategory:x,encounters:i,statuses:n,giveWay:r.length>0,giveWayTo:r[0]||null,primary:i[0]||null}},[g,v,y,w,x,S])}],77291)},61969,e=>{"use strict";var t=e.i(71645),i=e.i(85709),n=e.i(539),r=e.i(37256);let a=180/Math.PI,o=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio",...(0,r.coursePaths)("bearingTrue")];e.s(["default",0,()=>{let e=(0,i.useSignalKPaths)(o);return(0,t.useMemo)(()=>{let t=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,i=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,o=e["environment.wind.speedTrue"]??null,s=e["environment.wind.angleTrueWater"]??null,l=e["environment.wind.directionTrue"]??null;null===l&&Number.isFinite(s)&&Number.isFinite(i)&&(l=(0,n.wrapPi)(i+s));let u=e["performance.polarSpeed"]??(Number.isFinite(o)&&Number.isFinite(s)?(0,n.polarSpeedSi)(o,s):null),d=e["performance.polarSpeedRatio"]??null;null===d&&Number.isFinite(t)&&Number.isFinite(u)&&u>.2&&(d=t/u);let c=Number.isFinite(t)&&Number.isFinite(u)?(t-u)*1.943844:null,f=null,h=null,p=!Number.isFinite(s)||Math.abs(s)<Math.PI/2;if(Number.isFinite(o)){let e=p?(0,n.optimalUpwind)(1.943844*o):(0,n.optimalDownwind)(1.943844*o);e&&(f=e.twa/a,Number.isFinite(l)&&Number.isFinite(s)&&(h=(0,n.wrapPi)(l-Math.sign(s||1)*f)))}let m=(0,r.courseValue)(e,"bearingTrue"),g=null;if(Number.isFinite(m)&&Number.isFinite(l)&&Number.isFinite(o)){let e=(0,n.bestVmcHeading)({twd:l,tws:o,bearing:m}),t=Number.isFinite(i)?(0,n.vmcForHeading)({twd:l,tws:o,bearing:m,heading:i}):null;g=e?{bearing:m,best:e,current:t}:null}return{ratio:d,polarSpeed:u,boatSpeed:t,deltaKn:c,heading:i,twd:l,tws:o,twa:s,targetTwa:f,targetHeading:h,upwind:p,vmc:g}},[e])}])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,i;var n=e.i(31067),r=e.i(71645),a=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let u=new o.Vector3,d=new o.Vector3,c=new o.Vector3,f=new o.Vector2;function h(e,t,i){let n=u.setFromMatrixPosition(e.matrixWorld);n.project(t);let r=i.width/2,a=i.height/2;return[n.x*r+r,-(n.y*a)+a]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,i=""){let n="matrix3d(";for(let i=0;16!==i;i++)n+=p(t[i]*e.elements[i])+(15!==i?",":")");return i+n}let g=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),v=(i=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,i(t),"translate(-50%,-50%)")),y=r.forwardRef(({children:e,eps:t=.001,style:i,className:m,prepend:y,center:w,fullscreen:x,portal:S,distanceFactor:b,sprite:M=!1,transform:E=!1,occlude:P,onOcclude:_,castShadow:A,receiveShadow:T,material:z,geometry:U,zIndexRange:L=[0x1000037,0],calculatePosition:F=h,as:B="div",wrapperClass:D,pointerEvents:O="auto",...W},N)=>{let{gl:C,camera:R,scene:I,size:j,raycaster:V,events:H,viewport:G}=(0,s.useThree)(),[k]=r.useState(()=>document.createElement(B)),$=r.useRef(null),K=r.useRef(null),q=r.useRef(0),X=r.useRef([0,0]),Z=r.useRef(null),J=r.useRef(null),Q=(null==S?void 0:S.current)||H.connected||C.domElement.parentNode,Y=r.useRef(null),ee=r.useRef(!1),et=r.useMemo(()=>{var e;return P&&"blending"!==P||Array.isArray(P)&&P.length&&(e=P[0])&&"object"==typeof e&&"current"in e},[P]);r.useLayoutEffect(()=>{let e=C.domElement;P&&"blending"===P?(e.style.zIndex=`${Math.floor(L[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[P]),r.useLayoutEffect(()=>{if(K.current){let e=$.current=a.createRoot(k);if(I.updateMatrixWorld(),E)k.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=F(K.current,R,j);k.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Q&&(y?Q.prepend(k):Q.appendChild(k)),()=>{Q&&Q.removeChild(k),e.unmount()}}},[Q,E]),r.useLayoutEffect(()=>{D&&(k.className=D)},[D]);let ei=r.useMemo(()=>E?{position:"absolute",top:0,left:0,width:j.width,height:j.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:w?"translate3d(-50%,-50%,0)":"none",...x&&{top:-j.height/2,left:-j.width/2,width:j.width,height:j.height},...i},[i,w,x,j,E]),en=r.useMemo(()=>({position:"absolute",pointerEvents:O}),[O]);r.useLayoutEffect(()=>{var t,n;ee.current=!1,E?null==(t=$.current)||t.render(r.createElement("div",{ref:Z,style:ei},r.createElement("div",{ref:J,style:en},r.createElement("div",{ref:N,className:m,style:i,children:e})))):null==(n=$.current)||n.render(r.createElement("div",{ref:N,style:ei,className:m,children:e}))});let er=r.useRef(!0);(0,l.useFrame)(e=>{if(K.current){R.updateMatrixWorld(),K.current.updateWorldMatrix(!0,!1);let e=E?X.current:F(K.current,R,j);if(E||Math.abs(q.current-R.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var i;let t,n,r,a,s=(i=K.current,t=u.setFromMatrixPosition(i.matrixWorld),n=d.setFromMatrixPosition(R.matrixWorld),r=t.sub(n),a=R.getWorldDirection(c),r.angleTo(a)>Math.PI/2),l=!1;et&&(Array.isArray(P)?l=P.map(e=>e.current):"blending"!==P&&(l=[I]));let h=er.current;l?er.current=function(e,t,i,n){let r=u.setFromMatrixPosition(e.matrixWorld),a=r.clone();a.project(t),f.set(a.x,a.y),i.setFromCamera(f,t);let o=i.intersectObjects(n,!0);if(o.length){let e=o[0].distance;return r.distanceTo(i.ray.origin)<e}return!0}(K.current,R,V,l)&&!s:er.current=!s,h!==er.current&&(_?_(!er.current):k.style.display=er.current?"block":"none");let m=Math.floor(L[0]/2),y=P?et?[L[0],m]:[m-1,0]:L;if(k.style.zIndex=`${function(e,t,i){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let n=u.setFromMatrixPosition(e.matrixWorld),r=d.setFromMatrixPosition(t.matrixWorld),a=n.distanceTo(r),o=(i[1]-i[0])/(t.far-t.near),s=i[1]-o*t.far;return Math.round(o*a+s)}}(K.current,R,y)}`,E){let[e,t]=[j.width/2,j.height/2],i=R.projectionMatrix.elements[5]*t,{isOrthographicCamera:n,top:r,left:a,bottom:o,right:s}=R,l=g(R.matrixWorldInverse),u=n?`scale(${i})translate(${p(-(s+a)/2)}px,${p((r+o)/2)}px)`:`translateZ(${i}px)`,d=K.current.matrixWorld;M&&((d=R.matrixWorldInverse.clone().transpose().copyPosition(d).scale(K.current.scale)).elements[3]=d.elements[7]=d.elements[11]=0,d.elements[15]=1),k.style.width=j.width+"px",k.style.height=j.height+"px",k.style.perspective=n?"":`${i}px`,Z.current&&J.current&&(Z.current.style.transform=`${u}${l}translate(${e}px,${t}px)`,J.current.style.transform=v(d,1/((b||10)/400)))}else{let t=void 0===b?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let i=u.setFromMatrixPosition(e.matrixWorld),n=d.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*i.distanceTo(n))}}(K.current,R)*b;k.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,q.current=R.zoom}}if(!et&&Y.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=R;if(t||U)W.scale&&(Array.isArray(W.scale)?W.scale instanceof o.Vector3?Y.current.scale.copy(W.scale.clone().divideScalar(1)):Y.current.scale.set(1/W.scale[0],1/W.scale[1],1/W.scale[2]):Y.current.scale.setScalar(1/W.scale));else{let t=(b||10)/400,i=e.clientWidth*t,n=e.clientHeight*t;Y.current.scale.set(i,n,1)}ee.current=!0}}}else{let t=k.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/G.factor,i=t.clientWidth*e,n=t.clientHeight*e;Y.current.scale.set(i,n,1),ee.current=!0}Y.current.lookAt(e.camera.position)}});let ea=r.useMemo(()=>({vertexShader:E?void 0:`
|
|
2
|
+
/*
|
|
3
|
+
This shader is from the THREE's SpriteMaterial.
|
|
4
|
+
We need to turn the backing plane into a Sprite
|
|
5
|
+
(make it always face the camera) if "transfrom"
|
|
6
|
+
is false.
|
|
7
|
+
*/
|
|
8
|
+
#include <common>
|
|
9
|
+
|
|
10
|
+
void main() {
|
|
11
|
+
vec2 center = vec2(0., 1.);
|
|
12
|
+
float rotation = 0.0;
|
|
13
|
+
|
|
14
|
+
// This is somewhat arbitrary, but it seems to work well
|
|
15
|
+
// Need to figure out how to derive this dynamically if it even matters
|
|
16
|
+
float size = 0.03;
|
|
17
|
+
|
|
18
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
19
|
+
vec2 scale;
|
|
20
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
21
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
22
|
+
|
|
23
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
24
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
25
|
+
|
|
26
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
27
|
+
vec2 rotatedPosition;
|
|
28
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
29
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
30
|
+
mvPosition.xy += rotatedPosition;
|
|
31
|
+
|
|
32
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
33
|
+
}
|
|
34
|
+
`,fragmentShader:`
|
|
35
|
+
void main() {
|
|
36
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
37
|
+
}
|
|
38
|
+
`}),[E]);return r.createElement("group",(0,n.default)({},W,{ref:K}),P&&!et&&r.createElement("mesh",{castShadow:A,receiveShadow:T,ref:Y},U||r.createElement("planeGeometry",null),z||r.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",0,y])},95393,e=>{"use strict";var t=e.i(61949);e.s(["useFrame",()=>t.F])},92923,30728,27530,e=>{"use strict";let t,i;var n=e.i(90072),r=n;let a=new r.Box3,o=new r.Vector3;class s extends r.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new r.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),a.setFromBufferAttribute(t),this.boundingBox.union(a))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,a=e.count;r<a;r++)o.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(o)),o.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}e.s(["LineSegmentsGeometry",0,s],30728);var l=e.i(8560),u=n;l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new u.Vector2},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:u.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
39
|
+
#include <common>
|
|
40
|
+
#include <color_pars_vertex>
|
|
41
|
+
#include <fog_pars_vertex>
|
|
42
|
+
#include <logdepthbuf_pars_vertex>
|
|
43
|
+
#include <clipping_planes_pars_vertex>
|
|
44
|
+
|
|
45
|
+
uniform float linewidth;
|
|
46
|
+
uniform vec2 resolution;
|
|
47
|
+
|
|
48
|
+
attribute vec3 instanceStart;
|
|
49
|
+
attribute vec3 instanceEnd;
|
|
50
|
+
|
|
51
|
+
attribute vec3 instanceColorStart;
|
|
52
|
+
attribute vec3 instanceColorEnd;
|
|
53
|
+
|
|
54
|
+
#ifdef WORLD_UNITS
|
|
55
|
+
|
|
56
|
+
varying vec4 worldPos;
|
|
57
|
+
varying vec3 worldStart;
|
|
58
|
+
varying vec3 worldEnd;
|
|
59
|
+
|
|
60
|
+
#ifdef USE_DASH
|
|
61
|
+
|
|
62
|
+
varying vec2 vUv;
|
|
63
|
+
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#else
|
|
67
|
+
|
|
68
|
+
varying vec2 vUv;
|
|
69
|
+
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#ifdef USE_DASH
|
|
73
|
+
|
|
74
|
+
uniform float dashScale;
|
|
75
|
+
attribute float instanceDistanceStart;
|
|
76
|
+
attribute float instanceDistanceEnd;
|
|
77
|
+
varying float vLineDistance;
|
|
78
|
+
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {
|
|
82
|
+
|
|
83
|
+
// compute the interpolation factor needed to trim the segment so it terminates
|
|
84
|
+
// between the camera plane and the near plane
|
|
85
|
+
|
|
86
|
+
// conservative estimate of the near plane
|
|
87
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
88
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
89
|
+
|
|
90
|
+
// we need different nearEstimate formula for reversed and default depth buffer
|
|
91
|
+
// a is positive with a reversed depth buffer so it can be used for controlling the code flow
|
|
92
|
+
float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );
|
|
93
|
+
|
|
94
|
+
return ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
void main() {
|
|
99
|
+
|
|
100
|
+
#ifdef USE_COLOR
|
|
101
|
+
|
|
102
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
103
|
+
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
float aspect = resolution.x / resolution.y;
|
|
107
|
+
|
|
108
|
+
// camera space
|
|
109
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
110
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
111
|
+
|
|
112
|
+
#ifdef USE_DASH
|
|
113
|
+
|
|
114
|
+
float lineDistanceStart = dashScale * instanceDistanceStart;
|
|
115
|
+
float lineDistanceEnd = dashScale * instanceDistanceEnd;
|
|
116
|
+
|
|
117
|
+
#endif
|
|
118
|
+
|
|
119
|
+
#ifdef WORLD_UNITS
|
|
120
|
+
|
|
121
|
+
worldStart = start.xyz;
|
|
122
|
+
worldEnd = end.xyz;
|
|
123
|
+
|
|
124
|
+
#else
|
|
125
|
+
|
|
126
|
+
vUv = uv;
|
|
127
|
+
|
|
128
|
+
#endif
|
|
129
|
+
|
|
130
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
131
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
132
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
133
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
134
|
+
|
|
135
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
136
|
+
|
|
137
|
+
if ( perspective ) {
|
|
138
|
+
|
|
139
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
140
|
+
|
|
141
|
+
float alpha = trimSegmentAlpha( start, end );
|
|
142
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
143
|
+
|
|
144
|
+
#ifdef USE_DASH
|
|
145
|
+
|
|
146
|
+
lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );
|
|
147
|
+
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
151
|
+
|
|
152
|
+
float alpha = trimSegmentAlpha( end, start );
|
|
153
|
+
start.xyz = mix( end.xyz, start.xyz, alpha );
|
|
154
|
+
|
|
155
|
+
#ifdef USE_DASH
|
|
156
|
+
|
|
157
|
+
lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );
|
|
158
|
+
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#ifdef USE_DASH
|
|
166
|
+
|
|
167
|
+
vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;
|
|
168
|
+
vUv = uv;
|
|
169
|
+
|
|
170
|
+
#endif
|
|
171
|
+
|
|
172
|
+
// clip space
|
|
173
|
+
vec4 clipStart = projectionMatrix * start;
|
|
174
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
175
|
+
|
|
176
|
+
// ndc space
|
|
177
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
178
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
179
|
+
|
|
180
|
+
// direction
|
|
181
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
182
|
+
|
|
183
|
+
// account for clip-space aspect ratio
|
|
184
|
+
dir.x *= aspect;
|
|
185
|
+
dir = normalize( dir );
|
|
186
|
+
|
|
187
|
+
#ifdef WORLD_UNITS
|
|
188
|
+
|
|
189
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
190
|
+
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
191
|
+
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
192
|
+
vec3 worldFwd = cross( worldDir, worldUp );
|
|
193
|
+
worldPos = position.y < 0.5 ? start: end;
|
|
194
|
+
|
|
195
|
+
// height offset
|
|
196
|
+
float hw = linewidth * 0.5;
|
|
197
|
+
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
198
|
+
|
|
199
|
+
// don't extend the line if we're rendering dashes because we
|
|
200
|
+
// won't be rendering the endcaps
|
|
201
|
+
#ifndef USE_DASH
|
|
202
|
+
|
|
203
|
+
// cap extension
|
|
204
|
+
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
205
|
+
|
|
206
|
+
// add width to the box
|
|
207
|
+
worldPos.xyz += worldFwd * hw;
|
|
208
|
+
|
|
209
|
+
// endcaps
|
|
210
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
211
|
+
|
|
212
|
+
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
213
|
+
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
#endif
|
|
217
|
+
|
|
218
|
+
// project the worldpos
|
|
219
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
220
|
+
|
|
221
|
+
// shift the depth of the projected points so the line
|
|
222
|
+
// segments overlap neatly
|
|
223
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
224
|
+
clip.z = clipPose.z * clip.w;
|
|
225
|
+
|
|
226
|
+
#else
|
|
227
|
+
|
|
228
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
229
|
+
// undo aspect ratio adjustment
|
|
230
|
+
dir.x /= aspect;
|
|
231
|
+
offset.x /= aspect;
|
|
232
|
+
|
|
233
|
+
// sign flip
|
|
234
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
235
|
+
|
|
236
|
+
// endcaps
|
|
237
|
+
if ( position.y < 0.0 ) {
|
|
238
|
+
|
|
239
|
+
offset += - dir;
|
|
240
|
+
|
|
241
|
+
} else if ( position.y > 1.0 ) {
|
|
242
|
+
|
|
243
|
+
offset += dir;
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// adjust for linewidth
|
|
248
|
+
offset *= linewidth;
|
|
249
|
+
|
|
250
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
251
|
+
offset /= resolution.y;
|
|
252
|
+
|
|
253
|
+
// select end
|
|
254
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
255
|
+
|
|
256
|
+
// back to clip space
|
|
257
|
+
offset *= clip.w;
|
|
258
|
+
|
|
259
|
+
clip.xy += offset;
|
|
260
|
+
|
|
261
|
+
#endif
|
|
262
|
+
|
|
263
|
+
gl_Position = clip;
|
|
264
|
+
|
|
265
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
266
|
+
|
|
267
|
+
#include <logdepthbuf_vertex>
|
|
268
|
+
#include <clipping_planes_vertex>
|
|
269
|
+
#include <fog_vertex>
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
`,fragmentShader:`
|
|
273
|
+
uniform vec3 diffuse;
|
|
274
|
+
uniform float opacity;
|
|
275
|
+
uniform float linewidth;
|
|
276
|
+
|
|
277
|
+
#ifdef USE_DASH
|
|
278
|
+
|
|
279
|
+
uniform float dashOffset;
|
|
280
|
+
uniform float dashSize;
|
|
281
|
+
uniform float gapSize;
|
|
282
|
+
|
|
283
|
+
#endif
|
|
284
|
+
|
|
285
|
+
varying float vLineDistance;
|
|
286
|
+
|
|
287
|
+
#ifdef WORLD_UNITS
|
|
288
|
+
|
|
289
|
+
varying vec4 worldPos;
|
|
290
|
+
varying vec3 worldStart;
|
|
291
|
+
varying vec3 worldEnd;
|
|
292
|
+
|
|
293
|
+
#ifdef USE_DASH
|
|
294
|
+
|
|
295
|
+
varying vec2 vUv;
|
|
296
|
+
|
|
297
|
+
#endif
|
|
298
|
+
|
|
299
|
+
#else
|
|
300
|
+
|
|
301
|
+
varying vec2 vUv;
|
|
302
|
+
|
|
303
|
+
#endif
|
|
304
|
+
|
|
305
|
+
#include <common>
|
|
306
|
+
#include <color_pars_fragment>
|
|
307
|
+
#include <fog_pars_fragment>
|
|
308
|
+
#include <logdepthbuf_pars_fragment>
|
|
309
|
+
#include <clipping_planes_pars_fragment>
|
|
310
|
+
|
|
311
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
312
|
+
|
|
313
|
+
float mua;
|
|
314
|
+
float mub;
|
|
315
|
+
|
|
316
|
+
vec3 p13 = p1 - p3;
|
|
317
|
+
vec3 p43 = p4 - p3;
|
|
318
|
+
|
|
319
|
+
vec3 p21 = p2 - p1;
|
|
320
|
+
|
|
321
|
+
float d1343 = dot( p13, p43 );
|
|
322
|
+
float d4321 = dot( p43, p21 );
|
|
323
|
+
float d1321 = dot( p13, p21 );
|
|
324
|
+
float d4343 = dot( p43, p43 );
|
|
325
|
+
float d2121 = dot( p21, p21 );
|
|
326
|
+
|
|
327
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
328
|
+
|
|
329
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
330
|
+
|
|
331
|
+
mua = numer / denom;
|
|
332
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
333
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
334
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
335
|
+
|
|
336
|
+
return vec2( mua, mub );
|
|
337
|
+
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
void main() {
|
|
341
|
+
|
|
342
|
+
float alpha = opacity;
|
|
343
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
344
|
+
|
|
345
|
+
#include <clipping_planes_fragment>
|
|
346
|
+
|
|
347
|
+
#ifdef USE_DASH
|
|
348
|
+
|
|
349
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
350
|
+
|
|
351
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
352
|
+
|
|
353
|
+
#endif
|
|
354
|
+
|
|
355
|
+
#ifdef WORLD_UNITS
|
|
356
|
+
|
|
357
|
+
// Find the closest points on the view ray and the line segment
|
|
358
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
359
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
360
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
361
|
+
|
|
362
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
363
|
+
vec3 p2 = rayEnd * params.y;
|
|
364
|
+
vec3 delta = p1 - p2;
|
|
365
|
+
float len = length( delta );
|
|
366
|
+
float norm = len / linewidth;
|
|
367
|
+
|
|
368
|
+
#ifndef USE_DASH
|
|
369
|
+
|
|
370
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
371
|
+
|
|
372
|
+
float dnorm = fwidth( norm );
|
|
373
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
374
|
+
|
|
375
|
+
#else
|
|
376
|
+
|
|
377
|
+
if ( norm > 0.5 ) {
|
|
378
|
+
|
|
379
|
+
discard;
|
|
380
|
+
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
#endif
|
|
384
|
+
|
|
385
|
+
#endif
|
|
386
|
+
|
|
387
|
+
#else
|
|
388
|
+
|
|
389
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
390
|
+
|
|
391
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
392
|
+
float a = vUv.x;
|
|
393
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
394
|
+
float len2 = a * a + b * b;
|
|
395
|
+
float dlen = fwidth( len2 );
|
|
396
|
+
|
|
397
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
398
|
+
|
|
399
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
400
|
+
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
#else
|
|
404
|
+
|
|
405
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
406
|
+
|
|
407
|
+
float a = vUv.x;
|
|
408
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
409
|
+
float len2 = a * a + b * b;
|
|
410
|
+
|
|
411
|
+
if ( len2 > 1.0 ) discard;
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
#endif
|
|
416
|
+
|
|
417
|
+
#endif
|
|
418
|
+
|
|
419
|
+
#include <logdepthbuf_fragment>
|
|
420
|
+
#include <color_fragment>
|
|
421
|
+
|
|
422
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
423
|
+
|
|
424
|
+
#include <tonemapping_fragment>
|
|
425
|
+
#include <colorspace_fragment>
|
|
426
|
+
#include <fog_fragment>
|
|
427
|
+
#include <premultiplied_alpha_fragment>
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
`};class d extends u.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:u.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e!==this.worldUnits&&(this.needsUpdate=!0),!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}e.s(["LineMaterial",0,d],27530);let c=new n.Vector4,f=new n.Vector3,h=new n.Vector3,p=new n.Vector4,m=new n.Vector4,g=new n.Vector4,v=new n.Vector3,y=new n.Matrix4,w=new n.Line3,x=new n.Vector3,S=new n.Box3,b=new n.Sphere,M=new n.Vector4;function E(e,t,n){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=i/n.width,M.y=i/n.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class P extends n.Mesh{constructor(e=new s,t=new d({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,n=0,a=t.count;e<a;e++,n+=2)f.fromBufferAttribute(t,e),h.fromBufferAttribute(i,e),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+f.distanceTo(h);let a=new n.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(a,1,1)),this}raycast(e,r){let a,o,s=this.material.worldUnits,l=e.camera;if(null!==l||s||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===s&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let u=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let d=this.matrixWorld,c=this.geometry,f=this.material;if(i=f.linewidth+u,null===c.boundingSphere&&c.computeBoundingSphere(),b.copy(c.boundingSphere).applyMatrix4(d),s)a=.5*i;else{let e=Math.max(l.near,b.distanceToPoint(t.origin));a=E(l,e,f.resolution)}if(b.radius+=a,!1!==t.intersectsSphere(b)){if(null===c.boundingBox&&c.computeBoundingBox(),S.copy(c.boundingBox).applyMatrix4(d),s)o=.5*i;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));o=E(l,e,f.resolution)}S.expandByScalar(o),!1!==t.intersectsBox(S)&&(s?function(e,r){let a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,l=o.attributes.instanceEnd,u=Math.min(o.instanceCount,s.count);for(let o=0;o<u;o++){w.start.fromBufferAttribute(s,o),w.end.fromBufferAttribute(l,o),w.applyMatrix4(a);let u=new n.Vector3,d=new n.Vector3;t.distanceSqToSegment(w.start,w.end,d,u),d.distanceTo(u)<.5*i&&r.push({point:d,pointOnLine:u,distance:t.origin.distanceTo(d),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,r):function(e,r,a){let o=r.projectionMatrix,s=e.material.resolution,l=e.matrixWorld,u=e.geometry,d=u.attributes.instanceStart,c=u.attributes.instanceEnd,f=Math.min(u.instanceCount,d.count),h=-r.near;t.at(1,g),g.w=1,g.applyMatrix4(r.matrixWorldInverse),g.applyMatrix4(o),g.multiplyScalar(1/g.w),g.x*=s.x/2,g.y*=s.y/2,g.z=0,v.copy(g),y.multiplyMatrices(r.matrixWorldInverse,l);for(let r=0;r<f;r++){if(p.fromBufferAttribute(d,r),m.fromBufferAttribute(c,r),p.w=1,m.w=1,p.applyMatrix4(y),m.applyMatrix4(y),p.z>h&&m.z>h)continue;if(p.z>h){let e=p.z-m.z,t=(p.z-h)/e;p.lerp(m,t)}else if(m.z>h){let e=m.z-p.z,t=(m.z-h)/e;m.lerp(p,t)}p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w),p.x*=s.x/2,p.y*=s.y/2,m.x*=s.x/2,m.y*=s.y/2,w.start.copy(p),w.start.z=0,w.end.copy(m),w.end.z=0;let u=w.closestPointToPointParameter(v,!0);w.at(u,x);let f=n.MathUtils.lerp(p.z,m.z,u),g=f>=-1&&f<=1,S=v.distanceTo(x)<.5*i;if(g&&S){w.start.fromBufferAttribute(d,r),w.end.fromBufferAttribute(c,r),w.start.applyMatrix4(l),w.end.applyMatrix4(l);let i=new n.Vector3,o=new n.Vector3;t.distanceSqToSegment(w.start,w.end,o,i),a.push({point:o,pointOnLine:i,distance:t.origin.distanceTo(o),object:e,face:null,faceIndex:r,uv:null,uv1:null})}}}(this,l,r))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(c),this.material.uniforms.resolution.value.set(c.z,c.w))}}e.s(["LineSegments2",0,P],92923)},74452,(e,t,i)=>{t.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var t=e.i(74452);let i=180/Math.PI,n=t.default.vpp,r=(e,t,i)=>e+(t-e)*i,a=(e,t)=>{if(t<=e[0])return[0,0];let i=e.length-1;if(t>=e[i])return[i-1,1];let n=0;for(;t>e[n+1];)n++;return[n,(t-e[n])/(e[n+1]-e[n])]},o=n.speeds.map((e,t)=>(e=>{let t=n.beat_angle[e],r=n.run_angle[e],a=n.beat_vmg[e]/Math.cos(t/i),o=n.run_vmg[e]/Math.abs(Math.cos(r/i)),s=[[0,0],[.7*t,.55*a],[t,a]];for(let i of n.angles)i>t&&i<r&&s.push([i,n[String(i)][e]]);return s.push([r,o]),r<180&&s.push([180,n.run_vmg[e]]),s})(t)),s=(e,t)=>{let[i,n]=a(e.map(e=>e[0]),t);return r(e[i][1],e[i+1][1],n)},l=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let i=Math.min(180,Math.abs((t+540)%360-180)),l=n.speeds;if(e<l[0])return s(o[0],i)*(e/l[0]);let[u,d]=a(l,e);return r(s(o[u],i),s(o[u+1],i),d)},u=(e,t)=>{let[i,o]=a(n.speeds,t);return r(e[i],e[i+1],o)},d=(e,t)=>{let n=l(1.943844*e,t*i);return null===n?null:n/1.943844},c=e=>{let t=(e+Math.PI)%(2*Math.PI);return t<0&&(t+=2*Math.PI),t-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:t,bearing:n})=>{if(![e,t,n].every(Number.isFinite)||t<=0)return null;let r=null;for(let a=-100;a<=100;a++){let o=n+a/i,s=d(t,c(e-o));if(null===s)continue;let l=s*Math.cos(o-n);(!r||l>r.vmc)&&(r={heading:c(o),speed:s,vmc:l})}return r},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(n.run_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:-r*Math.cos(t/i)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(n.beat_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:r*Math.cos(t/i)}},"polarSpeed",0,l,"polarSpeedSi",0,d,"vmcForHeading",0,({twd:e,tws:t,bearing:i,heading:n})=>{if(![e,t,i,n].every(Number.isFinite))return null;let r=d(t,c(e-n));return null===r?null:r*Math.cos(n-i)},"wrapPi",0,c])}]);
|