ocearo-ui 2.1.0 → 2.1.1

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.
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5445,t=>{"use strict";var e=t.i(71645),i=t.i(18566),a=t.i(83402);t.s(["default",0,function(){let t=(0,i.useRouter)();return(0,e.useEffect)(()=>{a.default.setCurrentView("settings"),t.replace("/")},[t]),null}])},18566,(t,e,i)=>{e.exports=t.r(76562)},79866,(t,e,i)=>{e.exports={boats:[{name:"Default",modelPath:"default",capabilities:["navigation","rudder","sail","color"]},{name:"Racer 10.8",modelPath:"racer",capabilities:["navigation","sail","color"]},{name:"Catamaran 14",modelPath:"catamaran",capabilities:["navigation","sail","color"]},{name:"Optimist",modelPath:"optimist",capabilities:["navigation","ais"]},{name:"Sailboat",modelPath:"sailboat",capabilities:["navigation","ais"]},{name:"Ship",modelPath:"ship",capabilities:["navigation","ais"]},{name:"Windsurf",modelPath:"windsurf",capabilities:["navigation","ais"]}]}},83402,t=>{"use strict";var e=t.i(79866);let i=new class{constructor(){this.defaultConfig={signalkUrl:"http://localhost:3000",username:"",password:"",useAuthentication:!1,signalKUrlSet:!1,debugMode:!1,selectedBoat:"Racer 10.8",primaryColor:null,metallicEffect:!1,aisLengthScalingFactor:.7,compassNorthUp:!1,hide3DCompass:!1,hideTrueWind:!1,showCustomUrls:!1,customExternalUrls:{},currentView:"default",theme:"dark",language:"en",distanceUnits:"nm",depthUnits:"m",speedUnits:"kn",temperatureUnits:"C",positionFormat:"DD",preferTrueValues:!0,preferredWindSpeedPath:"speedTrue",preferredWindDirectionPath:"directionTrue",preferredHeadingPath:"courseOverGroundTrue",debugWindOverride:!1,debugWindSpeed:10,debugWindDirection:0,debugShowAxes:!1,showSailTrimSliders:!0,showRigging:!0,showSeamarks3D:!0,seamarksOverpass:!0},this.configKey="ocearoConfig",this.inMemoryConfig={...this.defaultConfig},this.config=this.loadConfig()}isLocalStorageAvailable(){try{return"u">typeof localStorage}catch{return!1}}loadConfig(){if(this.isLocalStorageAvailable()){let t=localStorage.getItem(this.configKey);if(!t)return this.saveConfig(this.defaultConfig),{...this.defaultConfig};try{let e={...this.defaultConfig,...JSON.parse(t)};return(e.boatChosen||"Default"!==e.selectedBoat)&&"RM1080"!==e.selectedBoat||(e.selectedBoat="Racer 10.8"),e}catch(t){return console.error("Failed to parse stored configuration:",t),{...this.defaultConfig}}}return{...this.inMemoryConfig}}saveConfig(t){this.config={...this.config,...t},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.config}}get(t){return this.config[t]}set(t,e){this.config[t]=e,this.saveConfig(this.config)}resetConfig(){this.config={...this.defaultConfig},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.defaultConfig}}getAll(){return{...this.config}}getDefaultConfig(){return{...this.defaultConfig}}getSelectedBoat(){let t=this.config.selectedBoat;return t?this.getBoatsData().find(e=>e.name===t):null}getBoatsData(){return e.default.boats}getSignalKUrl(){return this.config.signalKUrlSet&&this.config.signalkUrl?this.normalizeSignalKUrl(this.config.signalkUrl):this.getComputedSignalKUrl()}normalizeSignalKUrl(t){let e=String(t).trim().replace(/\/+$/,"");if(!e)return e;e=e.replace(/^wss:\/\//i,"https://").replace(/^ws:\/\//i,"http://");let i="https:"===window.location.protocol;return/^https?:\/\//i.test(e)||(e=`${i?"https":"http"}://${e}`),e=e.replace(/^https?:/i,t=>t.toLowerCase()),i&&e.startsWith("http://")&&(e="https://"+e.slice(7).replace(/:80(?=\/|$)/,"")),e}getComputedSignalKUrl(){return this.config.debugMode?"https://demo.signalk.org:443":`${window.location.protocol}//${window.location.hostname}${window.location.port?":"+window.location.port:""}`}getCurrentView(){return this.config.currentView||this.defaultConfig.currentView}setCurrentView(t){this.set("currentView",t)}};t.s(["default",0,i])}]);