{"version":3,"file":"index.Bb_3DmDK.js","sources":["../../../../../../src/lib/utils/orientation-store/store.ts","../../../../../../src/lib/utils/orientation-store/index.ts"],"sourcesContent":["import type { SubmitOrientationRequestRequest } from '$lib/api/generated/cta-services';\n\nimport { get, writable } from 'svelte/store';\nimport type { Writable } from 'svelte/store';\nimport { browser } from '$app/environment';\n\nexport class OrientationStore {\n\n private static _instance: OrientationStore;\n private _orientationRequest: Writable;\n private _isLastStepSubmitted: Writable;\n private _occupationChoosen: Writable;\n\n constructor() {\n this._orientationRequest = writable(null);\n this._isLastStepSubmitted = writable(false);\n this._occupationChoosen = writable(null);\n }\n\n setOrientationRequest(orientationRequest: SubmitOrientationRequestRequest) {\n this._orientationRequest.set(orientationRequest);\n if (browser) {\n localStorage.setItem('orientation', JSON.stringify(orientationRequest));\n }\n }\n\n setIsLastStepSubmitted(isLastStepSubmitted: boolean) {\n this._isLastStepSubmitted.set(isLastStepSubmitted);\n }\n\n setOccupationChoosen(occupationChoosen: string) {\n this._occupationChoosen.set(occupationChoosen);\n }\n\n getOrientationRequest() { \n if (get(this._orientationRequest)) {\n return get(this._orientationRequest);\n }\n if (browser) {\n const orientationRequest = localStorage.getItem('orientation');\n return JSON.parse(orientationRequest);\n }\n }\n\n getIsLastStepSubmitted() {\n return get(this._isLastStepSubmitted);\n }\n\n getOccupationChoosen() {\n if (get(this._occupationChoosen)) {\n return get(this._occupationChoosen);\n }\n if (browser) {\n const orientationRequest = localStorage.getItem('orientation');\n return JSON.parse(orientationRequest)?.orientation?.currentOccupation;\n }\n }\n\n clearOrientation() {\n this._orientationRequest.set(null);\n this._occupationChoosen.set(null);\n if (browser) {\n localStorage.removeItem('orientation');\n }\n \n }\n\n static getInstance() {\n if (!OrientationStore._instance) {\n OrientationStore._instance = new OrientationStore();\n }\n return OrientationStore._instance;\n }\n}","import { OrientationStore } from './store';\n\nexport const useOrientationStore = OrientationStore.getInstance;\n"],"names":["_OrientationStore","__publicField","writable","orientationRequest","isLastStepSubmitted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