@kosdev-code/kos-ddk-models 0.1.0-dev.5169 → 0.1.0-dev.5170
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/index.js +1 -1
- package/index.mjs +141 -131
- package/lib/door/door-model.d.ts +2 -1
- package/lib/door/door-model.d.ts.map +1 -1
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var io=Object.defineProperty;var no=(e,t,o)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var n=(e,t,o)=>(no(e,typeof t!="symbol"?t+"":t,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@kosdev-code/kos-ui-sdk"),m=require("@kosdev-code/kos-freestyle-sdk"),k=require("@kosdev-code/kos-dispense-sdk"),ke="PurgeTrouble",qe="PrimeTrouble",{URL:Ae}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:ao,postModel:lo}=s.ServiceFactory.build({basePath:`${Ae}/api/auth`}),Qe=s.KosLog.createLogger({name:"auth-service",group:"Services"}),Xe=async()=>(Qe.debug("sending GET for auth"),await ao({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/role`})),Je=async e=>(Qe.debug("sending POST for auth"),await lo({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/pincode/${e}`,model:{}})),co=Object.freeze(Object.defineProperty({__proto__:null,getCurrentRole:Xe,sendPinCode:Je},Symbol.toStringTag,{value:"Module"}));var uo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,Ze=(e,t,o,i)=>{for(var r=i>1?void 0:i?po(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&uo(t,o,r),r};const E="auth-model",He=e=>e.toLowerCase();let se=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"currentRole");this.id=e,this.logger=o.logger,this.currentRole="crew"}async authorize(e){if(!e)return!1;const t=await Je(e);return(t==null?void 0:t.status)===200?t.data:!1}async init(){this.logger.debug(`initializing auth ${this.id}`)}async load(){this.logger.debug(`loading auth ${this.id}`);const e=await Xe();(e==null?void 0:e.status)===200&&(this.logger.debug(`response ${e.data}`),s.kosAction(()=>{this.currentRole=He(e.data)}))}handleRoleChange(e){this.currentRole=He(e)}forceRole(e){this.currentRole=e}};Ze([s.kosTopicHandler({topic:"/app/kosdev.ddk/auth/role",websocket:!0})],se.prototype,"handleRoleChange",1);se=Ze([s.kosModel(E)],se);const ge={registration:{[E]:{class:se,singleton:!1}},type:E,predicate:s.isKosModel(E),factory:s.Kos.Factory.create(E)};var go=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,et=(e,t,o,i)=>{for(var r=i>1?void 0:i?ho(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&go(t,o,r),r};const tt="door-model",yo=s.createPropKey("doorPath");let ie=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"doorPath");n(this,"open");this.id=e,this.logger=o.logger,this.doorPath=t.doorPath}get currentState(){return this.open.value===void 0?"UNKNOWN":this.open.value?"OPEN":"CLOSED"}get isOpen(){return this.open.value===void 0?!0:this.open.value}};et([s.kosStateProp({path:yo,attribute:"state"})],ie.prototype,"open",2);ie=et([s.kosModel(tt)],ie);const ot=new s.KosModelRegistrationFactory({class:ie,type:tt}),{URL:Ie}=s.resolveServiceUrl("SETUP-STEP_SERVICE"),{getAll:vo,postModel:fo}=s.ServiceFactory.build({basePath:`${Ie}/api/setup-step`}),rt=s.KosLog.createLogger({name:"setup-step-service",group:"Services"}),st=async()=>(rt.debug("sending GET for setup-step"),await vo({urlOverride:`${Ie}/api/app/kosdev.ddk/setup/steps`})),it=async e=>(rt.debug("sending POST for setup-step"),await fo({urlOverride:`${Ie}/api/app/kosdev.ddk/setup/complete/${e}`,model:{}})),mo=Object.freeze(Object.defineProperty({__proto__:null,getSetupSteps:st,markStepComplete:it},Symbol.toStringTag,{value:"Module"}));var bo=Object.getOwnPropertyDescriptor,_o=(e,t,o,i)=>{for(var r=i>1?void 0:i?bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const w="setup-step-model";let Pe=class{constructor(e,t,o){n(this,"id");n(this,"idx");n(this,"name");n(this,"complete");n(this,"preStep");n(this,"exclusive");n(this,"logger");this.id=e,this.idx=t.idx,this.logger=o.logger,this.name=t.name,this.complete=t.complete,this.preStep=t.preStep,this.exclusive=t.exclusive}updateModel(e){this.name=e.name,this.idx=e.idx,this.complete=e.complete,this.preStep=e.preStep,this.exclusive=e.exclusive}get titleKey(){return`setup.${this.name}.title`}get bodyKey(){return`setup.${this.name}.body`}async completeStep(){const e=await it(this.name);(e==null?void 0:e.status)===200&&s.kosAction(()=>{this.complete=!0})}async init(){this.logger.debug(`initializing setup-step ${this.id}`)}async load(){this.logger.debug(`loading setup-step ${this.id}`)}};Pe=_o([s.kosModel(w)],Pe);const Re={registration:{[w]:{class:Pe,singleton:!1}},type:w,predicate:s.isKosModel(w),factory:s.Kos.Factory.create(w)};var To=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,he=(e,t,o,i)=>{for(var r=i>1?void 0:i?Mo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&To(t,o,r),r};const L="setup-step-container-model";function ze(e){return t=>{const o=Re.factory(t.id)(t);o.updateModel(t),e.addModel(o)}}function Ve(e){return t=>{e.removeModel(t)}}let b=class{constructor(e,t,o){n(this,"id");n(this,"_currentStep");n(this,"logger");n(this,"models");n(this,"authModel");this.id=e,this.logger=o.logger,this._currentStep=void 0,this.models=new s.KosModelContainer({parentId:e,sortKey:"idx"})}get currentStep(){return this._currentStep}setCurrentStep(e){const t=this.models.getModel(e);t&&(this._currentStep=t)}nextStep(){if(!this._currentStep)this._currentStep=this.firstIncompleteStep;else{const e=this._currentStep.idx,t=this.models.data.find(o=>o.idx>e);t&&(this._currentStep=t)}}get hasIncompletePreSteps(){return this.models.data.some(e=>e.preStep&&!e.complete)}get setupRequired(){return this.models.data.some(e=>!e.complete)}get firstIncompleteStep(){return this.models.data.find(e=>!e.complete)}get isLastStep(){var e;return this.models.data[this.models.data.length-1].id===((e=this._currentStep)==null?void 0:e.id)}get data(){return this.models.data}getModel(e){return this.models.getModel(e)}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}async init(){this.logger.debug(`initializing setup-step-container container ${this.id}`)}async load(){this.logger.debug(`loading setup-step-container container ${this.id}`);const e=await st();if(e!=null&&e.data){const t=e.data.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:ze(this),onRemoveItem:Ve(this)})(t)}this.nextStep()}handleStepChanges(e){const t=e.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:ze(this),onRemoveItem:Ve(this)})(t)}};he([s.kosChild],b.prototype,"models",2);he([s.kosDependency({modelType:ge.type})],b.prototype,"authModel",2);he([s.kosTopicHandler({topic:"/app/kosdev.ddk/setup/steps",websocket:!0})],b.prototype,"handleStepChanges",1);b=he([s.kosModel(L)],b);const Fe={registration:{[L]:{class:b,singleton:!0},...Re.registration},type:L,predicate:s.isKosModel(L),factory:s.Kos.Singleton.create(L)},{URL:v}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:nt,getAll:oe}=s.ServiceFactory.build({basePath:`${v}/api/app/kosdev.ddk/ncui/`}),q=s.KosLog.createLogger({name:"auth-service",group:"Services"}),So=async()=>{q.debug("sending GET for cuis");const e=await oe({urlOverride:`${v}/api/app/kosdev.ddk/cui`});if((e==null?void 0:e.status)!==200)throw new Error("Failed to retrieve cuis");return e.data},ko=async()=>{q.debug("sending GET for navigation");try{const e=await oe({urlOverride:`${v}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`});if((e==null?void 0:e.status)!==200){q.info("no extensions found, using base data");const t=await oe({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch{const t=await oe({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}},Po=async()=>(q.debug("navigating to CUI"),await nt({urlOverride:`${v}/api/app/kosdev.ddk/cui/open`})),$o=async()=>(q.debug("navigating to NCUI"),await nt({urlOverride:`${v}/api/app/kosdev.ddk/ncui/open`}));var Oo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,y=(e,t,o,i)=>{for(var r=i>1?void 0:i?Co(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Oo(t,o,r),r};const D="application-model",at=(e,t="")=>e.reduce((o,i)=>{const r=t?`${t}.${i.name}`:i.name;if(o[r]={...i,root:!t},i.children){const a=at(i.children,r);Object.keys(a).forEach(l=>{o[l]=a[l]})}return o},{});let u=class{constructor(e,t,o){n(this,"id");n(this,"device");n(this,"authModel");n(this,"setupStepContainer");n(this,"door");n(this,"ncuiLanguage");n(this,"activeCui");n(this,"fallbackCui");n(this,"_cuis",[]);n(this,"_navigationItems",[]);n(this,"languages");n(this,"logger");this.id=e,this.languages=[],this._cuis=[],this.logger=o.logger,this.door=ot.instance("app:kosdev.ddk:service:door:door").options({doorPath:"app:kosdev.ddk:service:door:door"}).build()}get setupRequired(){return this.authModel.currentRole==="crew"?!1:this.setupStepContainer.setupRequired}get currentRole(){return this.authModel.currentRole}get cuis(){return this._cuis.reduce((e,t)=>(e[t.appId]=t,e),{})}get navigationItems(){return at(this._navigationItems)}get hasCuiDefined(){return!!this.activeCui.value||!!this.fallbackCui.value}get doorIsOpen(){return this.door.isOpen}async enter(){this.logger.info("navigating to NCUI"),await $o()}async exit(){this.logger.info("navigating to CUI"),await Po()}async load(){var o,i;this.logger.debug(`loading application ${this.id}`);const e=await ko();this._navigationItems=e;const t=await So();this._cuis=t,(o=this.setupStepContainer)!=null&&o.hasIncompletePreSteps&&((i=this.authModel)==null||i.forceRole("technician")),this.languages=[{name:"English",locale:"en"}]}};y([s.kosDependency({modelType:s.Device.type})],u.prototype,"device",2);y([s.kosDependency({modelType:ge.type})],u.prototype,"authModel",2);y([s.kosDependency({modelType:Fe.type})],u.prototype,"setupStepContainer",2);y([s.kosChild],u.prototype,"door",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],u.prototype,"ncuiLanguage",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"activeCui"})],u.prototype,"activeCui",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"fallbackCui"})],u.prototype,"fallbackCui",2);u=y([s.kosModel(D)],u);const ye={registration:{[D]:{class:u,singleton:!0}},type:D,predicate:s.isKosModel(D),factory:s.Kos.Singleton.create(D)},te={none:999,crew:0,technician:1,manager:2},Ke=e=>t=>{if(t.type===m.AGITATION_REQUIRED_TROUBLE)return!1;const o=(t==null?void 0:t.role)||"technician";if(e&&o){const i=te[e.toLowerCase()]??te.crew,r=te[o.toLowerCase()]??te.crew;return i>=r}return!1};var Eo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,P=(e,t,o,i)=>{for(var r=i>1?void 0:i?wo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Eo(t,o,r),r};const lt="agitation-control-model",$e="resolve",Lo="agitate";let g=class{constructor(e,t,o){n(this,"id");n(this,"futureHandler");n(this,"logger");n(this,"troubleContainer");n(this,"_agitationFutureId");n(this,"_canExit",!0);n(this,"_exiting",!1);n(this,"_isFailed",!1);n(this,"disposer");n(this,"application");n(this,"inProgress",[]);this.id=e,this.logger=o.logger,this.troubleContainer=t.companionParent,this.futureHandler=new s.MultipleFutureHandler(this,$e)}set isFailed(e){this._isFailed=e}get isFailed(){return this._isFailed}get isDoorClosed(){return!this.application.doorIsOpen}get isAgitating(){return!!this._agitationFutureId}set exiting(e){this._exiting=e}get exiting(){return this._exiting}get canExit(){return this.queuedTroubles.length===0&&this._canExit}clearAll(){this.queuedTroubles.forEach(e=>{e.clearDefer()})}get readyToResolve(){const e=this.queuedTroubles.length,t=this.queuedTroubles.filter(i=>i.shouldDefer),o=e>0&&t.length===0;return this.isDoorClosed&&o&&this.exiting}onFutureUpdate(e){e.endState===s.FutureEndState.Success?(this.logger.debug(`Resolve deferred troubles future ${e.id} completed successfully`),this.queuedTroubles.forEach(t=>{t.clearDefer()}),s.kosAction(()=>{this._canExit=!0,this._isFailed=!1})):(e.endState===s.FutureEndState.Fail||e.endState===s.FutureEndState.Canceled||e.endState===s.FutureEndState.Aborted)&&(this.logger.error(`Resolve deferred troubles future ${e.id} failed`),this.clearAll(),s.kosAction(()=>{this._canExit=!1,this._isFailed=!0}))}async resolveDeferredTroubles(e){const t=this.queuedTroubles.filter(i=>!i.shouldDefer).map(i=>i.rawId).filter(i=>!this.inProgress.includes(i));return this.inProgress.push(...t),t.length===0?void 0:await s.TroubleServices.bulkResolveTroubles(t,void 0,e)}get hasQueuedTroubles(){return this.queuedTroubles.length>0}get queuedTroubles(){return this.troubleContainer.troubles.getIndexByKey(s.Troubles.INDEX_TROUBLES_BY_DEFERRED,s.Troubles.TROUBLES_DEFERRED)}get visibleTroubles(){const e=this.application.currentRole;return this.troubleContainer.troubles.data.filter(Ke(e)).filter(t=>t.type!==m.AGITATION_REQUIRED_TROUBLE)}get future(){return this.futureHandler.future}get resolveFuture(){return this.futureHandler.getFuture($e)}get agitateFuture(){return this.futureHandler.getFuture(Lo)}handleAgitationStarted(e){this.logger.info(`Agitation started for ${e.path}`),this._agitationFutureId=String(e.futureId)}handleAgitationEnded(e){this.logger.info(`Agitation ended for ${e.path}`),this._agitationFutureId=void 0}async init(){this.logger.debug(`initializing agitation-control ${this.id}`)}unload(){this.logger.debug(`unloading agitation-control ${this.id}`),this.disposer&&this.disposer()}handleReadyToResolve(){this.readyToResolve&&(this.logger.info("AgitationControl - Resolving deferred troubles"),this.resolveDeferredTroubles()),this._agitationFutureId&&this.logger.info("AgitationControl - Agitation started")}async load(){this.logger.debug(`loading agitation-control ${this.id}`)}};P([s.kosDependency({modelType:ye.type})],g.prototype,"application",2);P([s.kosFuture({alias:$e})],g.prototype,"resolveDeferredTroubles",1);P([s.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED})],g.prototype,"handleAgitationStarted",1);P([s.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED})],g.prototype,"handleAgitationEnded",1);P([s.kosModelEffect({dependencies:e=>[e.readyToResolve,e._agitationFutureId]})],g.prototype,"handleReadyToResolve",1);g=P([s.kosModel(lt)],g);const Do=new s.SingletonKosModelRegistrationFactory({class:g,type:lt});var Ao=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,J=(e,t,o,i)=>{for(var r=i>1?void 0:i?Io(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Ao(t,o,r),r};const A="animation-model";let f=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"disableAll");n(this,"enableDial");n(this,"enableModal");n(this,"enableSideBar");this.id=e,this.logger=o.logger}};J([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.disableAll"})],f.prototype,"disableAll",2);J([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableDial"})],f.prototype,"enableDial",2);J([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableModal"})],f.prototype,"enableModal",2);J([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableSideBar"})],f.prototype,"enableSideBar",2);f=J([s.kosModel(A)],f);const dt={registration:{[A]:{class:f,singleton:!0}},type:A,predicate:s.isKosModel(A),factory:s.Kos.Singleton.create(A)},{URL:Ro}=s.resolveServiceUrl("ANIMATION_SERVICE"),{getAll:Fo}=s.ServiceFactory.build({basePath:`${Ro}/api/animation`}),Ko=s.KosLog.createLogger({name:"animation-service",group:"Services"}),Uo=async()=>(Ko.debug("sending GET for animation"),await Fo({})),xo=Object.freeze(Object.defineProperty({__proto__:null,getAnimations:Uo},Symbol.toStringTag,{value:"Module"}));var jo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,ct=(e,t,o,i)=>{for(var r=i>1?void 0:i?No(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&jo(t,o,r),r};const I="carb-water-model";let ne=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getPump(){const t=this.assemblyModel.getHoldersByGroup("carb")[0].pumps.data[0];return s.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing carb-water ${this.id}`)}async load(){this.logger.debug(`loading carb-water ${this.id}`)}};ct([s.kosDependency({modelType:k.Assembly.type})],ne.prototype,"assemblyModel",2);ne=ct([s.kosModel(I)],ne);const ut={registration:{[I]:{class:ne,singleton:!1}},type:I,predicate:s.isKosModel(I),factory:s.Kos.Factory.create(I)},{URL:$}=s.resolveServiceUrl("COPY-LOGS_SERVICE"),{getAll:Wo,getOne:Ho,postModel:pt,deleteModel:zo}=s.ServiceFactory.build({basePath:`${$}/api/copy-logs`}),ae=s.KosLog.createLogger({name:"copy-logs-service",group:"Services"}),gt=async(e,t)=>{const o=await zo({tracker:t,id:e,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},ht=async(e,t)=>{const o=await pt({model:{},tracker:t,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},yt=async(e,t)=>{const o=await pt({model:{},tracker:t,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},vt=async()=>{ae.debug("sending GET for copy-logs");try{const e=await Wo({urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/volumes/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return ae.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},ft=async()=>{ae.debug("sending GET for log file size");try{const e=await Ho({urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/files/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return ae.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},Vo=Object.freeze(Object.defineProperty({__proto__:null,copyLogFromVolume:yt,eraseAndCopyLogsToVolume:ht,eraseVolume:gt,getLogFileSize:ft,getVolumes:vt},Symbol.toStringTag,{value:"Module"}));var mt=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,Yo=(e,t,o)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,O=(e,t,o,i)=>{for(var r=i>1?void 0:i?Bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&mt(t,o,r),r},Go=(e,t,o)=>(Yo(e,t+"",o),o);const qo="copy-logs-model";let p=class{constructor(e){n(this,"id");n(this,"_volumes");n(this,"storageDeviceContainer");n(this,"_activeVolume");n(this,"_logFileSize",0);n(this,"_actionState","idle");n(this,"copyProgress");this.id=e,this._volumes=new s.KosDataContainer,this._activeVolume=void 0,this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}get volumes(){return this._volumes.data}get activeVolume(){return this._activeVolume}get logFileSize(){return this._logFileSize}reset(){this.clearActiveVolume(),this.futureHandler.removeFuture()}clearActiveVolume(){this._activeVolume=void 0}updateActiveVolume(e){this._activeVolume=e}get inserted(){return this.storageDeviceContainer.isStorageInserted}updateLogFileSize(e){this._logFileSize=e}get canCopyLogs(){return this.inserted&&this._activeVolume}get actionState(){return this._actionState}get diskFull(){var e;return((e=this.future)==null?void 0:e.status)===s.FutureEndState.Success&&this.copyProgress.filesSkipped>0}onFutureUpdate(e){this.logger.info(`Future update: ${e.status}`),e.status===s.FutureEndState.Success&&(this.logger.info(`Future success: ${e.status}`),this.diskFull&&s.kosAction(()=>{e.endState=s.FutureEndState.Fail,e.reason="errDiskFull"})),e.status===s.FutureEndState.Fail&&this.logger.error(`Future failed: ${e.status}`),e.note==="copy"?s.kosAction(()=>{this._actionState="copying",this.copyProgress=e.clientData||{bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}):(this._actionState="erasing",s.kosAction(()=>{this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}))}async eraseAndCopyVolume(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),ht(this._activeVolume.id,e)}async eraseVolume(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),gt(this._activeVolume.id,e)}async copyLogs(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="copying"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Copying logs to ${(t=this._activeVolume)==null?void 0:t.name}`),yt(this._activeVolume.id,e)}handleInsertion(){this.inserted?this.syncVolumes():(this._volumes.clear(),this.clearActiveVolume())}async init(){this.logger.debug(`initializing copy-logs ${this.id}`)}async syncVolumes(){const[e,t]=await vt(),[o,i]=await ft();if(o){this.logger.error(`Error fetching log file size: ${o}`);return}if(e){this.logger.error(`Error fetching volumes: ${e}`);return}t&&(t.forEach(r=>{const a=this.storageDeviceContainer.getModel(r.id);if(a){const l={id:r.id,name:a.label,freeBytes:r.info.freeBytes,totalBytes:r.info.totalBytes};this._volumes.addModel(l)}}),t.length===1?this.updateActiveVolume(this._volumes.data[0]):this.clearActiveVolume()),i&&(this.logger.info(`Log file size: ${i}`),this.updateLogFileSize(parseInt(i,10)))}async activate(){this.logger.debug(`activating copy-logs ${this.id}`),await this.syncVolumes()}async load(){this.logger.debug(`loading copy-logs ${this.id}`)}};Go(p,"Registration");O([s.kosDependency({modelType:s.StorageDeviceContainer.type})],p.prototype,"storageDeviceContainer",2);O([s.kosFuture()],p.prototype,"eraseAndCopyVolume",1);O([s.kosFuture()],p.prototype,"eraseVolume",1);O([s.kosFuture()],p.prototype,"copyLogs",1);O([s.kosModelEffect({dependencies:e=>[e.inserted]})],p.prototype,"handleInsertion",1);p=O([s.kosModel({modelTypeId:qo,singleton:!0}),s.kosFutureAware(),s.kosLoggerAware()],p);const Qo=p.Registration,bt=s.KosLog.createLogger({name:"dashboard-operations-service",group:"Services"}),_t=async(e,t)=>(bt.debug("resolveAll"),await s.TroubleServices.bulkResolveTroubles(e,void 0,t)),Tt=async(e,t)=>(bt.debug("resolveTrouble"),await s.TroubleServices.resolveTrouble(e,void 0,t)),Xo=Object.freeze(Object.defineProperty({__proto__:null,resolveAll:_t,resolveTrouble:Tt},Symbol.toStringTag,{value:"Module"}));var Jo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,ve=(e,t,o,i)=>{for(var r=i>1?void 0:i?Zo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Jo(t,o,r),r};const R="dashboard-operations-model";function Be(e){return!e.deferred}function Ye(e){return e.deferred}let _=class{constructor(e,t,o){n(this,"id");n(this,"troubles");n(this,"futureHandler");n(this,"logger");this.id=e,this.futureHandler=new s.FutureHandler(this),this.logger=o.logger}get troublesByType(){return this.troubles.troubles.data.reduce(s.troubleByTypeReducer,{})}get queuedPurgeTroubles(){return this.purgeTroubles.filter(Ye)}get queuedPrimeTroubles(){return this.primeTroubles.filter(Ye)}get resolvablePrimeTroubles(){return this.primeTroubles.filter(Be)}get resolvablePurgeTroubles(){return this.purgeTroubles.filter(Be)}get hasResolvablePurgeTroubles(){return this.resolvablePurgeTroubles.length>0}get hasResolvablePrimeTroubles(){return this.resolvablePrimeTroubles.length>0}get hasPurgeTroubles(){return this.purgeTroubles.length>0}get hasPrimeTroubles(){return this.primeTroubles.length>0}get purgeTroubles(){return this.troublesByType[ke]||[]}get primeTroubles(){return this.troublesByType[qe]||[]}get future(){return this.futureHandler.getFuture()}async resolveAllTroubles(e,t){if(!t)throw new Error("No tracker provided");const o=e===ke?this.purgeTroubles:this.primeTroubles;o.filter(l=>l.shouldDefer).forEach(l=>{this.logger.info(`Deferring trouble ${l.rawId}`),l.defer()});const r=o.filter(l=>!l.shouldDefer).map(l=>l.rawId);return r.length===0?void 0:await _t(r,t)}async resolveTrouble(e,t){if(!t)throw new Error("No tracker provided");return await Tt(e,t)}async init(){this.logger.debug(`initializing dashboard-operations ${this.id}`)}async load(){this.logger.debug(`loading dashboard-operations ${this.id}`)}};ve([s.kosDependency({modelType:s.TroubleContainer.type})],_.prototype,"troubles",2);ve([s.kosFuture()],_.prototype,"resolveAllTroubles",1);ve([s.kosFuture()],_.prototype,"resolveTrouble",1);_=ve([s.kosModel(R)],_);const fe={registration:{[R]:{class:_,singleton:!0}},type:R,predicate:s.isKosModel(R),factory:s.Kos.Singleton.create(R)};var er=Object.getOwnPropertyDescriptor,tr=(e,t,o,i)=>{for(var r=i>1?void 0:i?er(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const F="dispenser-model";let Oe=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}updateModel(){}async init(){this.logger.debug(`initializing dispenser ${this.id}`)}async load(){this.logger.debug(`loading dispenser ${this.id}`)}};Oe=tr([s.kosModel(F)],Oe);const Mt={registration:{[F]:{class:Oe,singleton:!0}},type:F,predicate:s.isKosModel(F),factory:s.Kos.Singleton.create(F)},{URL:or}=s.resolveServiceUrl("DISPENSER_SERVICE"),{getAll:rr}=s.ServiceFactory.build({basePath:`${or}/api/dispenser`}),sr=s.KosLog.createLogger({name:"dispenser-service",group:"Services"}),ir=async()=>(sr.debug("sending GET for dispenser"),await rr({})),nr=Object.freeze(Object.defineProperty({__proto__:null,getDispensers:ir},Symbol.toStringTag,{value:"Module"}));var ar=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,St=(e,t,o,i)=>{for(var r=i>1?void 0:i?lr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&ar(t,o,r),r};const K="dispenser-info-model";let le=class{constructor(e,t,o){n(this,"logger");n(this,"id");n(this,"name");this.id=e,this.logger=o.logger}async init(){this.logger.debug(`initializing dispenser-info ${this.id}`)}async load(){this.logger.debug(`loading dispenser-info ${this.id}`)}};St([s.kosConfigProperty({path:"kos:device",attribute:"name"})],le.prototype,"name",2);le=St([s.kosModel(K)],le);const kt={registration:{[K]:{class:le,singleton:!1}},type:K,predicate:s.isKosModel(K),factory:s.Kos.Factory.create(K)},{URL:dr}=s.resolveServiceUrl("DISPENSER-INFO_SERVICE"),{getAll:cr}=s.ServiceFactory.build({basePath:`${dr}/api/dispenser-info`}),ur=s.KosLog.createLogger({name:"dispenser-info-service",group:"Services"}),pr=async()=>(ur.debug("sending GET for dispenser-info"),await cr({})),gr=Object.freeze(Object.defineProperty({__proto__:null,getDispenserInfos:pr},Symbol.toStringTag,{value:"Module"}));var hr=Object.getOwnPropertyDescriptor,yr=(e,t,o,i)=>{for(var r=i>1?void 0:i?hr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const U="enrollment-model";let Ce=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"enrolled");this.id=e,this.logger=o.logger,this.enrolled=!1}updateModel(e){console.log("updateModel:",e)}async init(){this.logger.debug(`initializing enrollment ${this.id}`)}async load(){this.logger.debug(`loading enrollment ${this.id}`)}};Ce=yr([s.kosModel(U)],Ce);const Pt={registration:{[U]:{class:Ce,singleton:!0}},type:U,predicate:s.isKosModel(U),factory:s.Kos.Singleton.create(U)},{URL:vr}=s.resolveServiceUrl("ENROLLMENT_SERVICE"),{getAll:fr}=s.ServiceFactory.build({basePath:`${vr}/api/enrollment`}),mr=s.KosLog.createLogger({name:"enrollment-service",group:"Services"}),br=async()=>(mr.debug("sending GET for enrollment"),await fr({})),_r=Object.freeze(Object.defineProperty({__proto__:null,getEnrollments:br},Symbol.toStringTag,{value:"Module"})),Tr=e=>e.toLowerCase().includes("micros"),Mr=e=>!e.toLowerCase().includes("micros"),Sr=e=>t=>{const o=e==null?void 0:e.getHoldersByGroup(t);return o?o.map(i=>({id:i.id,name:i.ingredientName,path:i.path})):null},kr=["water","carb","ns","nss"],T="dashboardKeyFactory",Te=[];s.registerExtensionPoint(T,{register:(e,t)=>{Te.includes(t)||Te.push(t)},execute:(e,t)=>{const o=Te.sort((i,r)=>i.rank-r.rank);for(const i of o){const r=i.factory(t);if(r)return r}}});const $t=e=>{s.ExtensionManager[T].register(T,e)},Ot=e=>s.ExtensionManager[T].execute(T,e);s.ExtensionManager.registerDashboardKeyFactory=$t;s.ExtensionManager.executeDashboardKeyFactory=Ot;const Ee=3600,Ct=60,Pr=e=>{const t=Math.floor(e/Ee),o=Math.floor(e%Ee/Ct);return{hours:t,minutes:o}},$r=(e,t)=>e*Ee+t*Ct,Et=e=>{const o=new Date().valueOf()-e.valueOf(),i=Math.floor(o/(1e3*60)),r=Math.floor(i/60),a=Math.floor(r/24),l=i%60,Z=r%24;let ee="";return a>0&&(ee+=`${a} day${a>1?"s":""} `),Z>0&&(ee+=`${Z} hour${Z>1?"s":""} `),(l>0||a===0&&Z===0)&&(ee+=`${l} minute${l>1?"s":""} `),ee};var Or=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,me=(e,t,o,i)=>{for(var r=i>1?void 0:i?Cr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Or(t,o,r),r};const x="ingredient-summary-model";let M=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"dashboardOperationModel");n(this,"appModel");n(this,"logger");this.id=e,this.logger=o.logger,this.dashboardOperationModel=fe.factory({})}get highPriorityHolders(){return this.assemblyModel.allHolders.filter(e=>e.troubles.length>0&&e.troubles.find(t=>t.rank>=400))}get actionRequiredHolders(){const e=this.appModel.currentRole,t=Ke(e);return this.assemblyModel.allHolders.filter(o=>{const i=s.getKosCompanionModel(o,m.FreestyleHolder.type);if(i!=null&&i.isRemote)return!1;const r=o.troubles.filter(t);return r.length>0&&r.find(a=>a.resolvable)})}get lowLevelHolders(){return this.assemblyModel.allHolders.filter(e=>{const t=e.fillPercent;return e.hasFuelGuage&&t<20})}async init(){this.logger.debug(`initializing ingredient-summary ${this.id}`)}async load(){this.logger.debug(`loading ingredient-summary ${this.id}`)}};me([s.kosDependency({modelType:k.Assembly.type})],M.prototype,"assemblyModel",2);me([s.kosDependency({modelType:fe.type})],M.prototype,"dashboardOperationModel",2);me([s.kosDependency({modelType:ye.type})],M.prototype,"appModel",2);M=me([s.kosModel(x)],M);const wt={registration:{[x]:{class:M,singleton:!1}},type:x,predicate:s.isKosModel(x),factory:s.Kos.Factory.create(x)},{URL:Ue}=s.resolveServiceUrl("LOCKOUT_SERVICE"),{postModel:Lt}=s.ServiceFactory.build({basePath:`${Ue}/api/app/kosdev.ddk/lockout`}),Dt=s.KosLog.createLogger({name:"lockout-service",group:"Services"}),Er=async()=>(Dt.info("lock"),await Lt({model:{},urlOverride:`${Ue}/api/app/kosdev.ddk/lockout/lockNow`})),At=async e=>{Dt.info("unlock");const t=await Lt({model:{},urlOverride:`${Ue}/api/app/kosdev.ddk/lockout/unlock/${e}`});return t==null?void 0:t.data},wr=Object.freeze(Object.defineProperty({__proto__:null,lock:Er,unlock:At},Symbol.toStringTag,{value:"Module"}));var Lr=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,C=(e,t,o,i)=>{for(var r=i>1?void 0:i?Dr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Lr(t,o,r),r};const It="lockout-model",Ar=[{day:"monday",lock:"dayWiseLockConfigMap.Mon.enabled",open:"dayWiseLockConfigMap.Mon.unlockTime",close:"dayWiseLockConfigMap.Mon.lockTime"},{day:"tuesday",lock:"dayWiseLockConfigMap.Tue.enabled",open:"dayWiseLockConfigMap.Tue.unlockTime",close:"dayWiseLockConfigMap.Tue.lockTime"},{day:"wednesday",lock:"dayWiseLockConfigMap.Wed.enabled",open:"dayWiseLockConfigMap.Wed.unlockTime",close:"dayWiseLockConfigMap.Wed.lockTime"},{day:"thursday",lock:"dayWiseLockConfigMap.Thu.enabled",open:"dayWiseLockConfigMap.Thu.unlockTime",close:"dayWiseLockConfigMap.Thu.lockTime"},{day:"friday",lock:"dayWiseLockConfigMap.Fri.enabled",open:"dayWiseLockConfigMap.Fri.unlockTime",close:"dayWiseLockConfigMap.Fri.lockTime"},{day:"saturday",lock:"dayWiseLockConfigMap.Sat.enabled",open:"dayWiseLockConfigMap.Sat.unlockTime",close:"dayWiseLockConfigMap.Sat.lockTime"},{day:"sunday",lock:"dayWiseLockConfigMap.Sun.enabled",open:"dayWiseLockConfigMap.Sun.unlockTime",close:"dayWiseLockConfigMap.Sun.lockTime"}];let h=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"dayEnabledList",["dayWiseLockConfigMap.Sun.enabled","dayWiseLockConfigMap.Mon.enabled","dayWiseLockConfigMap.Tue.enabled","dayWiseLockConfigMap.Wed.enabled","dayWiseLockConfigMap.Thu.enabled","dayWiseLockConfigMap.Fri.enabled","dayWiseLockConfigMap.Sat.enabled"]);n(this,"dayOpenAtList",["dayWiseLockConfigMap.Sun.unlockTime","dayWiseLockConfigMap.Mon.unlockTime","dayWiseLockConfigMap.Tue.unlockTime","dayWiseLockConfigMap.Wed.unlockTime","dayWiseLockConfigMap.Thu.unlockTime","dayWiseLockConfigMap.Fri.unlockTime","dayWiseLockConfigMap.Sat.unlockTime"]);n(this,"dayCloseAtList",["dayWiseLockConfigMap.Sun.lockTime","dayWiseLockConfigMap.Mon.lockTime","dayWiseLockConfigMap.Tue.lockTime","dayWiseLockConfigMap.Wed.lockTime","dayWiseLockConfigMap.Thu.lockTime","dayWiseLockConfigMap.Fri.lockTime","dayWiseLockConfigMap.Sat.lockTime"]);n(this,"saveMap");n(this,"pin");n(this,"nextLockSkipped");n(this,"nextLockTime");n(this,"nextUnLockTime");n(this,"cuiLockout");this.id=e,this.logger=o.logger,this.saveMap=new Map}get enabled(){const e=this.getProp("oneTimeLockConfig.lockTime"),t=e!==void 0&&e!=="",o=this.getProp("lockScheduleEnabled");return t||o}get schedule(){return Ar}getProp(e){return this.saveMap.get(e)}setProp(e,t){this.saveMap.set(e,t)}toggleSkip(){if(this.nextLockSkipped.value==="0"){const t=this.nextLockTime.value;t!==void 0&&this.nextLockSkipped.updateProperty(t)}else this.nextLockSkipped.updateProperty("0")}async unlock(e){return await At(e)}async save(){return this.saveMap.forEach((e,t)=>{e!==this.cuiLockout.props[t]&&(this.cuiLockout.props[t]=e)}),this.cuiLockout.updateConfigBean()}reset(){this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async init(){this.logger.debug(`initializing lockout ${this.id}`),this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async load(){this.logger.debug(`loading lockout ${this.id}`)}};C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"pin"})],h.prototype,"pin",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockSkipped"})],h.prototype,"nextLockSkipped",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockTime"})],h.prototype,"nextLockTime",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextUnLockTime"})],h.prototype,"nextUnLockTime",2);C([s.kosConfigBean({path:"app:kosdev.ddk:service:cuiLockout"})],h.prototype,"cuiLockout",2);h=C([s.kosModel(It)],h);const Ir=new s.SingletonKosModelRegistrationFactory({class:h,type:It}),Rr=async(e,t)=>await s.TroubleServices.bulkResolveTroubles(e,void 0,t);var Fr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,be=(e,t,o,i)=>{for(var r=i>1?void 0:i?Kr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Fr(t,o,r),r};const j="macro-assignment-model",Ge="PurgeTrouble",Ur="PrimeTrouble";let S=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"futureHandler");n(this,"holders");n(this,"ingredients");this.id=e,this.futureHandler=new s.FutureHandler,this.logger=o.logger}get future(){return this.futureHandler.future}get macroHolders(){return this.holders.holders.getIndexByKey("group","macros").sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}get hasMacroHolders(){return this.macroHolders.length>0}get holderPurgeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[Ge]||[];return t=[...t,...i],t},[])}get holderPrimeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[Ur]||[];return t=[...t,...i],t},[])}get hasHolderPurgeTroubles(){return this.holderPurgeTroubles.length>0}get hasHolderPrimeTroubles(){return this.holderPrimeTroubles.length>0}get macroIngredients(){return this.ingredients.ingredients.getIndexByKey("macro","macro")}get hasMacroIngredients(){return this.macroIngredients.length>0}async resolveAll(e,t){if(!t)throw new Error("No tracker provided");const i=(e===Ge?this.holderPurgeTroubles:this.holderPrimeTroubles).map(a=>a.rawId);return await Rr(i,t)}};be([s.kosDependency({modelType:k.HolderContainer.type})],S.prototype,"holders",2);be([s.kosDependency({modelType:k.IngredientContainer.type})],S.prototype,"ingredients",2);be([s.kosFuture()],S.prototype,"resolveAll",1);S=be([s.kosModel(j)],S);const Rt={registration:{[j]:{class:S,singleton:!0}},type:j,predicate:s.isKosModel(j),factory:s.Kos.Singleton.create(j)};var xr=Object.getOwnPropertyDescriptor,jr=(e,t,o,i)=>{for(var r=i>1?void 0:i?xr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const N="network-test-model";let we=class{constructor(e,t,o){n(this,"id");n(this,"group");n(this,"passed");n(this,"inProgress");n(this,"failureTime");n(this,"timestamp");n(this,"name");n(this,"results");n(this,"logger");this.id=e,this.logger=o.logger,this.group=t.group,this.passed=!1,this.inProgress=!1,this.name=t.name,this.results=[]}updateModel(e){this.group=e.group,this.name=e.name,this.passed=e.passed,this.failureTime=e.failureTime,this.inProgress=e.inProgress,this.timestamp=e.timestamp,this.results=e.results}async init(){this.logger.debug(`initializing network-test ${this.id}`)}async load(){this.logger.debug(`loading network-test ${this.id}`)}};we=jr([s.kosModel(N)],we);const xe={registration:{[N]:{class:we,singleton:!1}},type:N,predicate:s.isKosModel(N),factory:s.Kos.Factory.create(N)},{URL:_e}=s.resolveServiceUrl("NETWORK-TEST_SERVICE"),{getAll:Nr,getOne:Ft}=s.ServiceFactory.build({basePath:`${_e}/api/app/ncui/network/tests`}),Wr=s.KosLog.createLogger({name:"network-test-service",group:"Services"}),Kt=async()=>{Wr.debug("sending GET for network-test");const e=await Nr({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests`});return e==null?void 0:e.data},Ut=async()=>{const e=await Ft({urlOverride:`${_e}/api/app/kosdev.ddk/network/reports`});return e==null?void 0:e.data},xt=async(e,t)=>await Ft({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests/run/group/${e}`,tracker:t}),Hr=Object.freeze(Object.defineProperty({__proto__:null,getNetworkTests:Kt,getTestsReports:Ut,performGroupTest:xt},Symbol.toStringTag,{value:"Module"}));var zr=Object.defineProperty,Vr=Object.getOwnPropertyDescriptor,je=(e,t,o,i)=>{for(var r=i>1?void 0:i?Vr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&zr(t,o,r),r};const W="network-test-container-model";let Q=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"lastTested");n(this,"futureHandler");n(this,"models");this.id=e,this.logger=o.logger,this.futureHandler=new s.FutureHandler(this),this.models=new s.KosModelContainer({parentId:e,indexMap:{group:"group"}}),this.lastTested=new Date("default")}get data(){return this.models.data}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}getModel(e){return this.models.getModel(e)}async init(){this.logger.debug(`initializing network-test-container container ${this.id}`)}getLastTested(e){const t=this.models.getIndexByKey("group",e).map(i=>i.timestamp&&new Date(i.timestamp)),o=Math.max(...t.map(i=>i?i.getTime():0));return o?Et(new Date(o)):""}async load(){this.logger.debug(`loading network-test-container container ${this.id}`);const e=await Kt(),t=await Ut();e&&e.forEach(o=>{const i=xe.factory(o.id)(o);this.addModel(i)}),e&&t&&e.forEach(o=>{const i=t==null?void 0:t[o.group],r=i==null?void 0:i[o.id],a=this.getModel(o.id);if(a&&r){const l={group:r.group,name:r.name,passed:r.passed,failureTime:r.failureTime?new Date(r.failureTime):void 0,inProgress:r.inProgress,timestamp:new Date(r.timestamp),results:r.results};a.updateModel(l)}})}async performTest(e,t){if(!t)throw new Error("No tracker provided");const o=await xt(e,t);return o==null?void 0:o.data}onFutureUpdate(e){const{clientData:t}=e;t&&t.forEach(o=>{const i=this.getModel(o.id);if(s.kosAction(()=>{this.lastTested=this.lastTested>new Date(o.timestamp)?this.lastTested:new Date(o.timestamp)}),i){const r={group:o.group,name:o.name,passed:o.passed,failureTime:o.failureTime?new Date(o.failureTime):void 0,inProgress:o.inProgress,timestamp:new Date(o.timestamp),results:o.results};s.kosAction(()=>{i.updateModel(r)})}})}};je([s.kosChild],Q.prototype,"models",2);je([s.kosFuture()],Q.prototype,"performTest",1);Q=je([s.kosModel(W)],Q);const jt={registration:{[W]:{class:Q,singleton:!0},...xe.registration},type:W,predicate:s.isKosModel(W),factory:s.Kos.Singleton.create(W)};var Br=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Ne=(e,t,o,i)=>{for(var r=i>1?void 0:i?Yr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Br(t,o,r),r};const H="nutritive-sweetener-model",Gr=s.createPropKey("statePath");let X=class{constructor(e,t){n(this,"id");n(this,"assemblyModel");n(this,"pumpState");this.id=e}get holder(){return this.assemblyModel.getHoldersByGroup("ns")[0]}getHolder(){return this.holder}get statePath(){return`${this.pump.path}:airVent:state`}get pump(){return this.holder.pumps.data[0]}getPump(){return this.pump}};Ne([s.kosDependency({modelType:k.Assembly.type})],X.prototype,"assemblyModel",2);Ne([s.kosStateBean({path:Gr})],X.prototype,"pumpState",2);X=Ne([s.kosModel(H),s.kosLoggerAware()],X);const Nt={registration:{[H]:{class:X,singleton:!1}},type:H,predicate:s.isKosModel(H),factory:s.Kos.Factory.create(H)};var qr=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,Wt=(e,t,o,i)=>{for(var r=i>1?void 0:i?Qr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&qr(t,o,r),r};const z="plain-water-model";let de=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getHolder(){return this.assemblyModel.getHoldersByGroup("water")[0]}getPump(){var i,r;const e=this.getHolder(),t=(r=(i=e==null?void 0:e.pumps)==null?void 0:i.data)==null?void 0:r[0];return s.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing plain-water ${this.id}`)}async load(){this.logger.debug(`loading plain-water ${this.id}`)}};Wt([s.kosDependency({modelType:k.Assembly.type})],de.prototype,"assemblyModel",2);de=Wt([s.kosModel(z)],de);const Ht={registration:{[z]:{class:de,singleton:!1}},type:z,predicate:s.isKosModel(z),factory:s.Kos.Factory.create(z)},{URL:zt}=s.resolveServiceUrl("REBOOT_SERVICE"),{postModel:Xr}=s.ServiceFactory.build({basePath:`${zt}/api/reboot`}),Jr=s.KosLog.createLogger({name:"reboot-service",group:"Services"}),Vt=async()=>(Jr.debug("sending POST call for Reboot Dispenser"),await Xr({urlOverride:`${zt}/api/app/kosdev.ddk/ncui/reboot`,model:{}})),Zr=Object.freeze(Object.defineProperty({__proto__:null,rebootDispenser:Vt},Symbol.toStringTag,{value:"Module"}));var es=Object.getOwnPropertyDescriptor,ts=(e,t,o,i)=>{for(var r=i>1?void 0:i?es(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const V="reboot-model";let Le=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}async completeReboot(){await Vt()}updateModel(){}async init(){this.logger.debug(`initializing reboot ${this.id}`)}async load(){this.logger.debug(`loading reboot ${this.id}`)}};Le=ts([s.kosModel(V)],Le);const Bt={registration:{[V]:{class:Le,singleton:!1}},type:V,predicate:s.isKosModel(V),factory:s.Kos.Factory.create(V)};var os=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,c=(e,t,o,i)=>{for(var r=i>1?void 0:i?rs(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&os(t,o,r),r};const B="settings-model";let d=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"ncuiLanguageData");n(this,"resolveDelaysMs");n(this,"dateFormat");n(this,"timeFormat");n(this,"hidePlainWaterBev");n(this,"hideCarbWaterBev");n(this,"ncuiLanguage");n(this,"name");n(this,"activateAndRebootTime");n(this,"horizontalMode");this.id=e,this.logger=o.logger}async ready(){this.updateDisplayMode()}async getNcuiLanguageList(){this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}async load(){this.logger.debug(`loading settings ${this.id}`),this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}handleUpdateDisplayMode(){this.updateDisplayMode()}updateDisplayMode(){this.horizontalMode.value?document.body.setAttribute("data-dashboard-layout","horizontal"):document.body.setAttribute("data-dashboard-layout","vertical")}};c([s.kosConfigProperty({path:"system:app",attribute:"resolveDelaysMs"})],d.prototype,"resolveDelaysMs",2);c([s.kosConfigProperty({path:"system:app",attribute:"dateFormat"})],d.prototype,"dateFormat",2);c([s.kosConfigProperty({path:"system:app",attribute:"timeFormat"})],d.prototype,"timeFormat",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hidePlainWaterBev"})],d.prototype,"hidePlainWaterBev",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hideCarbWaterBev"})],d.prototype,"hideCarbWaterBev",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],d.prototype,"ncuiLanguage",2);c([s.kosConfigProperty({path:"kos:device",attribute:"name"})],d.prototype,"name",2);c([s.kosConfigProperty({path:"kos:service:OTA",attribute:"activateAndRebootTime"})],d.prototype,"activateAndRebootTime",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.display.horizontalMode"})],d.prototype,"horizontalMode",2);c([s.kosModelEffect({dependencies:e=>[e.horizontalMode.value]})],d.prototype,"handleUpdateDisplayMode",1);d=c([s.kosModel(B)],d);const Yt={registration:{[B]:{class:d,singleton:!0}},type:B,predicate:s.isKosModel(B),factory:s.Kos.Singleton.create(B)},{URL:Gt}=s.resolveServiceUrl("SETTINGS_SERVICE"),{getAll:qt}=s.ServiceFactory.build({basePath:`${Gt}/api/settings`}),ss=s.KosLog.createLogger({name:"settings-service",group:"Services"}),is=async()=>(ss.debug("sending GET for settings"),await qt({})),ns=async()=>await qt({urlOverride:`${Gt}api/app/kosdev.ddk/ncui/languages`}),as=Object.freeze(Object.defineProperty({__proto__:null,getNcuiLanguage:ns,getSettings:is},Symbol.toStringTag,{value:"Module"}));var ls=Object.getOwnPropertyDescriptor,ds=(e,t,o,i)=>{for(var r=i>1?void 0:i?ls(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const Y="utilities-model";let De=class{constructor(e,t,o){n(this,"id");n(this,"name");n(this,"options");n(this,"roles");n(this,"columnId");n(this,"logger");this.id=e,this.logger=o.logger,this.name=t.name,this.options=t.options,this.roles=t==null?void 0:t.roles,this.columnId=t.columnId}updateModel(e){this.name=e.name,this.options=e.options,this.roles=e==null?void 0:e.roles}get titleKey(){return`utility.${this.id}.title`}get bodyKey(){return`utility.${this.id}.body`}async init(){this.logger.debug(`initializing utilities ${this.id}`)}async load(){this.logger.debug(`loading utilities ${this.id}`)}};De=ds([s.kosModel(Y)],De);const We={registration:{[Y]:{class:De,singleton:!1}},type:Y,predicate:s.isKosModel(Y),factory:s.Kos.Factory.create(Y)},{URL:re}=s.resolveServiceUrl("UTILITIES_SERVICE"),{getAll:Me}=s.ServiceFactory.build({basePath:`${re}/api/utilities`}),Se=s.KosLog.createLogger({name:"utilities-service",group:"Services"}),Qt=async()=>{Se.debug("sending GET for utilities");try{const e=await Me({urlOverride:`${re}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`});if((e==null?void 0:e.status)!==200){Se.info("no extensions found, using base data");const t=await Me({urlOverride:`${re}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch(e){Se.info(`error fetching utilities: ${e}. Using base data`);const t=await Me({urlOverride:`${re}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}},cs=Object.freeze(Object.defineProperty({__proto__:null,getUtilities:Qt},Symbol.toStringTag,{value:"Module"}));var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,Xt=(e,t,o,i)=>{for(var r=i>1?void 0:i?ps(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&us(t,o,r),r};const G="utilities-container-model";let ce=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"_models");this.id=e,this.logger=o.logger,this._models=new s.KosModelContainer({parentId:e,sortKey:"id",indexMap:{byColumn:"columnId"}})}get data(){return this._models.data}get models(){return this._models}get columns(){return this._models.getIndexKeys("byColumn").sort((e,t)=>e.localeCompare(t))}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}getModel(e){return this._models.getModel(e)}getUtilitiesByColumn(e){return this._models.getIndexByKey("byColumn",e)}async load(){this.logger.debug(`loading utilities-container container ${this.id}`);const e=await Qt();e==null||e.forEach((t,o)=>{t.forEach(i=>{const r={...i,columnId:String(o)},a=We.factory(i.name)(r);this.addModel(a)})})}};Xt([s.kosChild],ce.prototype,"_models",2);ce=Xt([s.kosModel(G)],ce);const Jt={registration:{[G]:{class:ce,singleton:!0},...We.registration},type:G,predicate:s.isKosModel(G),factory:s.Kos.Singleton.create(G)},gs={...dt.registration,...ye.registration,...ge.registration,...ut.registration,...fe.registration,...Mt.registration,...kt.registration,...Pt.registration,...wt.registration,...Rt.registration,...jt.registration,...Nt.registration,...Ht.registration,...Bt.registration,...Yt.registration,...Fe.registration,...Jt.registration};var hs=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,Zt=(e,t,o,i)=>{for(var r=i>1?void 0:i?ys(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&hs(t,o,r),r};const eo="trouble-action-model";let ue=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"troubleContainer");n(this,"disposer");n(this,"state");n(this,"troubleActionData");this.id=e,this.logger=o.logger,this.state=s.ObservableData(),this.troubleActionData=t.definitions.reduce((i,r)=>(i[r.troubleType]=r,i),{})}get activeTrouble(){const e=Object.keys(this.troubleActionData);if(e.length>0){const t=e[0],o=this.troubleContainer.troubles.getIndexByKey("byType",t);return o.length>0?o[0]:void 0}}get activeTroubleType(){var e;return(e=this.activeTrouble)==null?void 0:e.type}async init(){this.logger.debug(`initializing trouble-action ${this.id}`),this.disposer=s.kosAutoEffect(()=>{const e=this.troubleContainer.troubles.data.reduce((t,o)=>{const i=o.type;if(this.troubleActionData[i]){const r=this.troubleActionData[i].stateKey??i,a=this.troubleActionData[i].stateValue??i;t[r]=a}return t},{});this.state.setValues(e),Object.keys(this.troubleActionData).forEach(t=>{if(this.troubleContainer.troubles.getIndexByKey("byType",t).length===0){const o=this.troubleActionData[t].stateKey??t;this.state[o]=void 0}})})}unload(){var e;(e=this.disposer)==null||e.call(this)}async load(){this.logger.debug(`loading trouble-action ${this.id}`)}};Zt([s.kosDependency({modelType:s.TroubleContainer.type})],ue.prototype,"troubleContainer",2);ue=Zt([s.kosModel(eo)],ue);const vs=new s.SingletonKosModelRegistrationFactory({class:ue,type:eo}),{URL:to}=s.resolveServiceUrl("START_SERVICE"),{getOne:fs}=s.ServiceFactory.build({basePath:`${to}/api/start`}),ms=s.KosLog.createLogger({name:"start-service",group:"Services"}),oo=async()=>(ms.debug("navigating to NCUI"),await fs({urlOverride:`${to}/api/app/kosdev.ddk/ncui/open`})),bs=Object.freeze(Object.defineProperty({__proto__:null,navigateToNCui:oo},Symbol.toStringTag,{value:"Module"}));var _s=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ro=(e,t,o,i)=>{for(var r=i>1?void 0:i?Ts(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&_s(t,o,r),r};const so="start-model";let pe=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"troubles");this.id=e,this.logger=o.logger}get firmwareFailed(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateFailedTrouble").length>0}get firmwareInProgress(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateInProgressTrouble").length>0}async navigate(){await oo()}async init(){this.logger.debug(`initializing start ${this.id}`)}async load(){this.logger.debug(`loading start ${this.id}`)}};ro([s.kosDependency({modelType:s.TroubleContainer.type})],pe.prototype,"troubles",2);pe=ro([s.kosModel(so)],pe);const Ms=new s.SingletonKosModelRegistrationFactory({class:pe,type:so});exports.AgitationControl=Do;exports.Animation=dt;exports.AnimationServices=xo;exports.Application=ye;exports.Auth=ge;exports.AuthServices=co;exports.CarbWater=ut;exports.CopyLogs=Qo;exports.CopyLogsServices=Vo;exports.DDKModels=gs;exports.DashboardOperations=fe;exports.DashboardOperationsServices=Xo;exports.Dispenser=Mt;exports.DispenserInfo=kt;exports.DispenserInfoServices=gr;exports.DispenserServices=nr;exports.Door=ot;exports.EXTENSION_POINT_DASHBOARD_KEY_FACTORY=T;exports.Enrollment=Pt;exports.EnrollmentServices=_r;exports.IngredientSummary=wt;exports.Lockout=Ir;exports.LockoutServices=wr;exports.MACRO_KEYS=kr;exports.MacroAssignment=Rt;exports.NetworkTest=xe;exports.NetworkTestContainer=jt;exports.NetworkTestServices=Hr;exports.NutritiveSweetener=Nt;exports.PlainWater=Ht;exports.Reboot=Bt;exports.RebootServices=Zr;exports.Settings=Yt;exports.SettingsServices=as;exports.SetupStep=Re;exports.SetupStepContainer=Fe;exports.SetupStepServices=mo;exports.Start=Ms;exports.StartServices=bs;exports.TROUBLE_TYPE_PRIME=qe;exports.TROUBLE_TYPE_PURGE=ke;exports.TroubleActionManager=vs;exports.Utilities=We;exports.UtilitiesContainer=Jt;exports.UtilitiesServices=cs;exports.calculateTimeDifference=Et;exports.executeDashboardKeyFactory=Ot;exports.isMacroGroup=Mr;exports.isMicroGroup=Tr;exports.macroHolderMap=Sr;exports.registerDashboardKeyFactory=$t;exports.toSeconds=$r;exports.toTimeComponents=Pr;exports.troubleVisibilityFilter=Ke;
|
|
1
|
+
"use strict";var io=Object.defineProperty;var no=(e,t,o)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var n=(e,t,o)=>(no(e,typeof t!="symbol"?t+"":t,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@kosdev-code/kos-ui-sdk"),m=require("@kosdev-code/kos-freestyle-sdk"),k=require("@kosdev-code/kos-dispense-sdk"),ke="PurgeTrouble",Qe="PrimeTrouble",{URL:Ae}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:ao,postModel:lo}=s.ServiceFactory.build({basePath:`${Ae}/api/auth`}),Xe=s.KosLog.createLogger({name:"auth-service",group:"Services"}),Je=async()=>(Xe.debug("sending GET for auth"),await ao({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/role`})),Ze=async e=>(Xe.debug("sending POST for auth"),await lo({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/pincode/${e}`,model:{}})),co=Object.freeze(Object.defineProperty({__proto__:null,getCurrentRole:Je,sendPinCode:Ze},Symbol.toStringTag,{value:"Module"}));var uo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,et=(e,t,o,i)=>{for(var r=i>1?void 0:i?po(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&uo(t,o,r),r};const E="auth-model",ze=e=>e.toLowerCase();let ie=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"currentRole");this.id=e,this.logger=o.logger,this.currentRole="crew"}async authorize(e){if(!e)return!1;const t=await Ze(e);return(t==null?void 0:t.status)===200?t.data:!1}async init(){this.logger.debug(`initializing auth ${this.id}`)}async load(){this.logger.debug(`loading auth ${this.id}`);const e=await Je();(e==null?void 0:e.status)===200&&(this.logger.debug(`response ${e.data}`),s.kosAction(()=>{this.currentRole=ze(e.data)}))}handleRoleChange(e){this.currentRole=ze(e)}forceRole(e){this.currentRole=e}};et([s.kosTopicHandler({topic:"/app/kosdev.ddk/auth/role",websocket:!0})],ie.prototype,"handleRoleChange",1);ie=et([s.kosModel(E)],ie);const ge={registration:{[E]:{class:ie,singleton:!1}},type:E,predicate:s.isKosModel(E),factory:s.Kos.Factory.create(E)};var go=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,Ie=(e,t,o,i)=>{for(var r=i>1?void 0:i?ho(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&go(t,o,r),r};const tt="door-model",yo=s.createPropKey("doorPath");let q=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"doorPath");n(this,"open");n(this,"ignoreDoor");this.id=e,this.logger=o.logger,this.doorPath=t.doorPath}get currentState(){return this.open.value===void 0?"UNKNOWN":this.open.value?"OPEN":"CLOSED"}get isOpen(){const e=this.open.value===void 0?!0:this.open.value;return this.ignoreDoor.value?(this.logger.debug("Door state is being ignored (treating as closed) due to ignoreDoor config property being true."),!1):e}};Ie([s.kosStateProp({path:yo,attribute:"state"})],q.prototype,"open",2);Ie([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ignoreDoorStateOnExit"})],q.prototype,"ignoreDoor",2);q=Ie([s.kosModel(tt)],q);const ot=new s.KosModelRegistrationFactory({class:q,type:tt}),{URL:Re}=s.resolveServiceUrl("SETUP-STEP_SERVICE"),{getAll:vo,postModel:fo}=s.ServiceFactory.build({basePath:`${Re}/api/setup-step`}),rt=s.KosLog.createLogger({name:"setup-step-service",group:"Services"}),st=async()=>(rt.debug("sending GET for setup-step"),await vo({urlOverride:`${Re}/api/app/kosdev.ddk/setup/steps`})),it=async e=>(rt.debug("sending POST for setup-step"),await fo({urlOverride:`${Re}/api/app/kosdev.ddk/setup/complete/${e}`,model:{}})),mo=Object.freeze(Object.defineProperty({__proto__:null,getSetupSteps:st,markStepComplete:it},Symbol.toStringTag,{value:"Module"}));var bo=Object.getOwnPropertyDescriptor,_o=(e,t,o,i)=>{for(var r=i>1?void 0:i?bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const w="setup-step-model";let Pe=class{constructor(e,t,o){n(this,"id");n(this,"idx");n(this,"name");n(this,"complete");n(this,"preStep");n(this,"exclusive");n(this,"logger");this.id=e,this.idx=t.idx,this.logger=o.logger,this.name=t.name,this.complete=t.complete,this.preStep=t.preStep,this.exclusive=t.exclusive}updateModel(e){this.name=e.name,this.idx=e.idx,this.complete=e.complete,this.preStep=e.preStep,this.exclusive=e.exclusive}get titleKey(){return`setup.${this.name}.title`}get bodyKey(){return`setup.${this.name}.body`}async completeStep(){const e=await it(this.name);(e==null?void 0:e.status)===200&&s.kosAction(()=>{this.complete=!0})}async init(){this.logger.debug(`initializing setup-step ${this.id}`)}async load(){this.logger.debug(`loading setup-step ${this.id}`)}};Pe=_o([s.kosModel(w)],Pe);const Fe={registration:{[w]:{class:Pe,singleton:!1}},type:w,predicate:s.isKosModel(w),factory:s.Kos.Factory.create(w)};var To=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,he=(e,t,o,i)=>{for(var r=i>1?void 0:i?Mo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&To(t,o,r),r};const L="setup-step-container-model";function Ve(e){return t=>{const o=Fe.factory(t.id)(t);o.updateModel(t),e.addModel(o)}}function Be(e){return t=>{e.removeModel(t)}}let b=class{constructor(e,t,o){n(this,"id");n(this,"_currentStep");n(this,"logger");n(this,"models");n(this,"authModel");this.id=e,this.logger=o.logger,this._currentStep=void 0,this.models=new s.KosModelContainer({parentId:e,sortKey:"idx"})}get currentStep(){return this._currentStep}setCurrentStep(e){const t=this.models.getModel(e);t&&(this._currentStep=t)}nextStep(){if(!this._currentStep)this._currentStep=this.firstIncompleteStep;else{const e=this._currentStep.idx,t=this.models.data.find(o=>o.idx>e);t&&(this._currentStep=t)}}get hasIncompletePreSteps(){return this.models.data.some(e=>e.preStep&&!e.complete)}get setupRequired(){return this.models.data.some(e=>!e.complete)}get firstIncompleteStep(){return this.models.data.find(e=>!e.complete)}get isLastStep(){var e;return this.models.data[this.models.data.length-1].id===((e=this._currentStep)==null?void 0:e.id)}get data(){return this.models.data}getModel(e){return this.models.getModel(e)}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}async init(){this.logger.debug(`initializing setup-step-container container ${this.id}`)}async load(){this.logger.debug(`loading setup-step-container container ${this.id}`);const e=await st();if(e!=null&&e.data){const t=e.data.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:Ve(this),onRemoveItem:Be(this)})(t)}this.nextStep()}handleStepChanges(e){const t=e.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:Ve(this),onRemoveItem:Be(this)})(t)}};he([s.kosChild],b.prototype,"models",2);he([s.kosDependency({modelType:ge.type})],b.prototype,"authModel",2);he([s.kosTopicHandler({topic:"/app/kosdev.ddk/setup/steps",websocket:!0})],b.prototype,"handleStepChanges",1);b=he([s.kosModel(L)],b);const Ke={registration:{[L]:{class:b,singleton:!0},...Fe.registration},type:L,predicate:s.isKosModel(L),factory:s.Kos.Singleton.create(L)},{URL:v}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:nt,getAll:re}=s.ServiceFactory.build({basePath:`${v}/api/app/kosdev.ddk/ncui/`}),Q=s.KosLog.createLogger({name:"auth-service",group:"Services"}),So=async()=>{Q.debug("sending GET for cuis");const e=await re({urlOverride:`${v}/api/app/kosdev.ddk/cui`});if((e==null?void 0:e.status)!==200)throw new Error("Failed to retrieve cuis");return e.data},ko=async()=>{Q.debug("sending GET for navigation");try{const e=await re({urlOverride:`${v}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`});if((e==null?void 0:e.status)!==200){Q.info("no extensions found, using base data");const t=await re({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch{const t=await re({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}},Po=async()=>(Q.debug("navigating to CUI"),await nt({urlOverride:`${v}/api/app/kosdev.ddk/cui/open`})),$o=async()=>(Q.debug("navigating to NCUI"),await nt({urlOverride:`${v}/api/app/kosdev.ddk/ncui/open`}));var Oo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,y=(e,t,o,i)=>{for(var r=i>1?void 0:i?Co(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Oo(t,o,r),r};const D="application-model",at=(e,t="")=>e.reduce((o,i)=>{const r=t?`${t}.${i.name}`:i.name;if(o[r]={...i,root:!t},i.children){const a=at(i.children,r);Object.keys(a).forEach(l=>{o[l]=a[l]})}return o},{});let u=class{constructor(e,t,o){n(this,"id");n(this,"device");n(this,"authModel");n(this,"setupStepContainer");n(this,"door");n(this,"ncuiLanguage");n(this,"activeCui");n(this,"fallbackCui");n(this,"_cuis",[]);n(this,"_navigationItems",[]);n(this,"languages");n(this,"logger");this.id=e,this.languages=[],this._cuis=[],this.logger=o.logger,this.door=ot.instance("app:kosdev.ddk:service:door:door").options({doorPath:"app:kosdev.ddk:service:door:door"}).build()}get setupRequired(){return this.authModel.currentRole==="crew"?!1:this.setupStepContainer.setupRequired}get currentRole(){return this.authModel.currentRole}get cuis(){return this._cuis.reduce((e,t)=>(e[t.appId]=t,e),{})}get navigationItems(){return at(this._navigationItems)}get hasCuiDefined(){return!!this.activeCui.value||!!this.fallbackCui.value}get doorIsOpen(){return this.door.isOpen}async enter(){this.logger.info("navigating to NCUI"),await $o()}async exit(){this.logger.info("navigating to CUI"),await Po()}async load(){var o,i;this.logger.debug(`loading application ${this.id}`);const e=await ko();this._navigationItems=e;const t=await So();this._cuis=t,(o=this.setupStepContainer)!=null&&o.hasIncompletePreSteps&&((i=this.authModel)==null||i.forceRole("technician")),this.languages=[{name:"English",locale:"en"}]}};y([s.kosDependency({modelType:s.Device.type})],u.prototype,"device",2);y([s.kosDependency({modelType:ge.type})],u.prototype,"authModel",2);y([s.kosDependency({modelType:Ke.type})],u.prototype,"setupStepContainer",2);y([s.kosChild],u.prototype,"door",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],u.prototype,"ncuiLanguage",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"activeCui"})],u.prototype,"activeCui",2);y([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"fallbackCui"})],u.prototype,"fallbackCui",2);u=y([s.kosModel(D)],u);const ye={registration:{[D]:{class:u,singleton:!0}},type:D,predicate:s.isKosModel(D),factory:s.Kos.Singleton.create(D)},oe={none:999,crew:0,technician:1,manager:2},Ue=e=>t=>{if(t.type===m.AGITATION_REQUIRED_TROUBLE)return!1;const o=(t==null?void 0:t.role)||"technician";if(e&&o){const i=oe[e.toLowerCase()]??oe.crew,r=oe[o.toLowerCase()]??oe.crew;return i>=r}return!1};var Eo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,P=(e,t,o,i)=>{for(var r=i>1?void 0:i?wo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Eo(t,o,r),r};const lt="agitation-control-model",$e="resolve",Lo="agitate";let g=class{constructor(e,t,o){n(this,"id");n(this,"futureHandler");n(this,"logger");n(this,"troubleContainer");n(this,"_agitationFutureId");n(this,"_canExit",!0);n(this,"_exiting",!1);n(this,"_isFailed",!1);n(this,"disposer");n(this,"application");n(this,"inProgress",[]);this.id=e,this.logger=o.logger,this.troubleContainer=t.companionParent,this.futureHandler=new s.MultipleFutureHandler(this,$e)}set isFailed(e){this._isFailed=e}get isFailed(){return this._isFailed}get isDoorClosed(){return!this.application.doorIsOpen}get isAgitating(){return!!this._agitationFutureId}set exiting(e){this._exiting=e}get exiting(){return this._exiting}get canExit(){return this.queuedTroubles.length===0&&this._canExit}clearAll(){this.queuedTroubles.forEach(e=>{e.clearDefer()})}get readyToResolve(){const e=this.queuedTroubles.length,t=this.queuedTroubles.filter(i=>i.shouldDefer),o=e>0&&t.length===0;return this.isDoorClosed&&o&&this.exiting}onFutureUpdate(e){e.endState===s.FutureEndState.Success?(this.logger.debug(`Resolve deferred troubles future ${e.id} completed successfully`),this.queuedTroubles.forEach(t=>{t.clearDefer()}),s.kosAction(()=>{this._canExit=!0,this._isFailed=!1})):(e.endState===s.FutureEndState.Fail||e.endState===s.FutureEndState.Canceled||e.endState===s.FutureEndState.Aborted)&&(this.logger.error(`Resolve deferred troubles future ${e.id} failed`),this.clearAll(),s.kosAction(()=>{this._canExit=!1,this._isFailed=!0}))}async resolveDeferredTroubles(e){const t=this.queuedTroubles.filter(i=>!i.shouldDefer).map(i=>i.rawId).filter(i=>!this.inProgress.includes(i));return this.inProgress.push(...t),t.length===0?void 0:await s.TroubleServices.bulkResolveTroubles(t,void 0,e)}get hasQueuedTroubles(){return this.queuedTroubles.length>0}get queuedTroubles(){return this.troubleContainer.troubles.getIndexByKey(s.Troubles.INDEX_TROUBLES_BY_DEFERRED,s.Troubles.TROUBLES_DEFERRED)}get visibleTroubles(){const e=this.application.currentRole;return this.troubleContainer.troubles.data.filter(Ue(e)).filter(t=>t.type!==m.AGITATION_REQUIRED_TROUBLE)}get future(){return this.futureHandler.future}get resolveFuture(){return this.futureHandler.getFuture($e)}get agitateFuture(){return this.futureHandler.getFuture(Lo)}handleAgitationStarted(e){this.logger.info(`Agitation started for ${e.path}`),this._agitationFutureId=String(e.futureId)}handleAgitationEnded(e){this.logger.info(`Agitation ended for ${e.path}`),this._agitationFutureId=void 0}async init(){this.logger.debug(`initializing agitation-control ${this.id}`)}unload(){this.logger.debug(`unloading agitation-control ${this.id}`),this.disposer&&this.disposer()}handleReadyToResolve(){this.readyToResolve&&(this.logger.info("AgitationControl - Resolving deferred troubles"),this.resolveDeferredTroubles()),this._agitationFutureId&&this.logger.info("AgitationControl - Agitation started")}async load(){this.logger.debug(`loading agitation-control ${this.id}`)}};P([s.kosDependency({modelType:ye.type})],g.prototype,"application",2);P([s.kosFuture({alias:$e})],g.prototype,"resolveDeferredTroubles",1);P([s.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED})],g.prototype,"handleAgitationStarted",1);P([s.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED})],g.prototype,"handleAgitationEnded",1);P([s.kosModelEffect({dependencies:e=>[e.readyToResolve,e._agitationFutureId]})],g.prototype,"handleReadyToResolve",1);g=P([s.kosModel(lt)],g);const Do=new s.SingletonKosModelRegistrationFactory({class:g,type:lt});var Ao=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,Z=(e,t,o,i)=>{for(var r=i>1?void 0:i?Io(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Ao(t,o,r),r};const A="animation-model";let f=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"disableAll");n(this,"enableDial");n(this,"enableModal");n(this,"enableSideBar");this.id=e,this.logger=o.logger}};Z([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.disableAll"})],f.prototype,"disableAll",2);Z([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableDial"})],f.prototype,"enableDial",2);Z([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableModal"})],f.prototype,"enableModal",2);Z([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableSideBar"})],f.prototype,"enableSideBar",2);f=Z([s.kosModel(A)],f);const dt={registration:{[A]:{class:f,singleton:!0}},type:A,predicate:s.isKosModel(A),factory:s.Kos.Singleton.create(A)},{URL:Ro}=s.resolveServiceUrl("ANIMATION_SERVICE"),{getAll:Fo}=s.ServiceFactory.build({basePath:`${Ro}/api/animation`}),Ko=s.KosLog.createLogger({name:"animation-service",group:"Services"}),Uo=async()=>(Ko.debug("sending GET for animation"),await Fo({})),xo=Object.freeze(Object.defineProperty({__proto__:null,getAnimations:Uo},Symbol.toStringTag,{value:"Module"}));var jo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,ct=(e,t,o,i)=>{for(var r=i>1?void 0:i?No(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&jo(t,o,r),r};const I="carb-water-model";let ne=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getPump(){const t=this.assemblyModel.getHoldersByGroup("carb")[0].pumps.data[0];return s.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing carb-water ${this.id}`)}async load(){this.logger.debug(`loading carb-water ${this.id}`)}};ct([s.kosDependency({modelType:k.Assembly.type})],ne.prototype,"assemblyModel",2);ne=ct([s.kosModel(I)],ne);const ut={registration:{[I]:{class:ne,singleton:!1}},type:I,predicate:s.isKosModel(I),factory:s.Kos.Factory.create(I)},{URL:$}=s.resolveServiceUrl("COPY-LOGS_SERVICE"),{getAll:Wo,getOne:Ho,postModel:pt,deleteModel:zo}=s.ServiceFactory.build({basePath:`${$}/api/copy-logs`}),ae=s.KosLog.createLogger({name:"copy-logs-service",group:"Services"}),gt=async(e,t)=>{const o=await zo({tracker:t,id:e,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},ht=async(e,t)=>{const o=await pt({model:{},tracker:t,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},yt=async(e,t)=>{const o=await pt({model:{},tracker:t,urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},vt=async()=>{ae.debug("sending GET for copy-logs");try{const e=await Wo({urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/volumes/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return ae.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},ft=async()=>{ae.debug("sending GET for log file size");try{const e=await Ho({urlOverride:`${$}/api/app/kosdev.ddk/copyLogs/files/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return ae.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},Vo=Object.freeze(Object.defineProperty({__proto__:null,copyLogFromVolume:yt,eraseAndCopyLogsToVolume:ht,eraseVolume:gt,getLogFileSize:ft,getVolumes:vt},Symbol.toStringTag,{value:"Module"}));var mt=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,Yo=(e,t,o)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,O=(e,t,o,i)=>{for(var r=i>1?void 0:i?Bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&mt(t,o,r),r},Go=(e,t,o)=>(Yo(e,t+"",o),o);const qo="copy-logs-model";let p=class{constructor(e){n(this,"id");n(this,"_volumes");n(this,"storageDeviceContainer");n(this,"_activeVolume");n(this,"_logFileSize",0);n(this,"_actionState","idle");n(this,"copyProgress");this.id=e,this._volumes=new s.KosDataContainer,this._activeVolume=void 0,this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}get volumes(){return this._volumes.data}get activeVolume(){return this._activeVolume}get logFileSize(){return this._logFileSize}reset(){this.clearActiveVolume(),this.futureHandler.removeFuture()}clearActiveVolume(){this._activeVolume=void 0}updateActiveVolume(e){this._activeVolume=e}get inserted(){return this.storageDeviceContainer.isStorageInserted}updateLogFileSize(e){this._logFileSize=e}get canCopyLogs(){return this.inserted&&this._activeVolume}get actionState(){return this._actionState}get diskFull(){var e;return((e=this.future)==null?void 0:e.status)===s.FutureEndState.Success&&this.copyProgress.filesSkipped>0}onFutureUpdate(e){this.logger.info(`Future update: ${e.status}`),e.status===s.FutureEndState.Success&&(this.logger.info(`Future success: ${e.status}`),this.diskFull&&s.kosAction(()=>{e.endState=s.FutureEndState.Fail,e.reason="errDiskFull"})),e.status===s.FutureEndState.Fail&&this.logger.error(`Future failed: ${e.status}`),e.note==="copy"?s.kosAction(()=>{this._actionState="copying",this.copyProgress=e.clientData||{bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}):(this._actionState="erasing",s.kosAction(()=>{this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}))}async eraseAndCopyVolume(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),ht(this._activeVolume.id,e)}async eraseVolume(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),gt(this._activeVolume.id,e)}async copyLogs(e){var t;if(!e)throw new Error("No tracker provided");if(s.kosAction(()=>{this._actionState="copying"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Copying logs to ${(t=this._activeVolume)==null?void 0:t.name}`),yt(this._activeVolume.id,e)}handleInsertion(){this.inserted?this.syncVolumes():(this._volumes.clear(),this.clearActiveVolume())}async init(){this.logger.debug(`initializing copy-logs ${this.id}`)}async syncVolumes(){const[e,t]=await vt(),[o,i]=await ft();if(o){this.logger.error(`Error fetching log file size: ${o}`);return}if(e){this.logger.error(`Error fetching volumes: ${e}`);return}t&&(t.forEach(r=>{const a=this.storageDeviceContainer.getModel(r.id);if(a){const l={id:r.id,name:a.label,freeBytes:r.info.freeBytes,totalBytes:r.info.totalBytes};this._volumes.addModel(l)}}),t.length===1?this.updateActiveVolume(this._volumes.data[0]):this.clearActiveVolume()),i&&(this.logger.info(`Log file size: ${i}`),this.updateLogFileSize(parseInt(i,10)))}async activate(){this.logger.debug(`activating copy-logs ${this.id}`),await this.syncVolumes()}async load(){this.logger.debug(`loading copy-logs ${this.id}`)}};Go(p,"Registration");O([s.kosDependency({modelType:s.StorageDeviceContainer.type})],p.prototype,"storageDeviceContainer",2);O([s.kosFuture()],p.prototype,"eraseAndCopyVolume",1);O([s.kosFuture()],p.prototype,"eraseVolume",1);O([s.kosFuture()],p.prototype,"copyLogs",1);O([s.kosModelEffect({dependencies:e=>[e.inserted]})],p.prototype,"handleInsertion",1);p=O([s.kosModel({modelTypeId:qo,singleton:!0}),s.kosFutureAware(),s.kosLoggerAware()],p);const Qo=p.Registration,bt=s.KosLog.createLogger({name:"dashboard-operations-service",group:"Services"}),_t=async(e,t)=>(bt.debug("resolveAll"),await s.TroubleServices.bulkResolveTroubles(e,void 0,t)),Tt=async(e,t)=>(bt.debug("resolveTrouble"),await s.TroubleServices.resolveTrouble(e,void 0,t)),Xo=Object.freeze(Object.defineProperty({__proto__:null,resolveAll:_t,resolveTrouble:Tt},Symbol.toStringTag,{value:"Module"}));var Jo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,ve=(e,t,o,i)=>{for(var r=i>1?void 0:i?Zo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Jo(t,o,r),r};const R="dashboard-operations-model";function Ye(e){return!e.deferred}function Ge(e){return e.deferred}let _=class{constructor(e,t,o){n(this,"id");n(this,"troubles");n(this,"futureHandler");n(this,"logger");this.id=e,this.futureHandler=new s.FutureHandler(this),this.logger=o.logger}get troublesByType(){return this.troubles.troubles.data.reduce(s.troubleByTypeReducer,{})}get queuedPurgeTroubles(){return this.purgeTroubles.filter(Ge)}get queuedPrimeTroubles(){return this.primeTroubles.filter(Ge)}get resolvablePrimeTroubles(){return this.primeTroubles.filter(Ye)}get resolvablePurgeTroubles(){return this.purgeTroubles.filter(Ye)}get hasResolvablePurgeTroubles(){return this.resolvablePurgeTroubles.length>0}get hasResolvablePrimeTroubles(){return this.resolvablePrimeTroubles.length>0}get hasPurgeTroubles(){return this.purgeTroubles.length>0}get hasPrimeTroubles(){return this.primeTroubles.length>0}get purgeTroubles(){return this.troublesByType[ke]||[]}get primeTroubles(){return this.troublesByType[Qe]||[]}get future(){return this.futureHandler.getFuture()}async resolveAllTroubles(e,t){if(!t)throw new Error("No tracker provided");const o=e===ke?this.purgeTroubles:this.primeTroubles;o.filter(l=>l.shouldDefer).forEach(l=>{this.logger.info(`Deferring trouble ${l.rawId}`),l.defer()});const r=o.filter(l=>!l.shouldDefer).map(l=>l.rawId);return r.length===0?void 0:await _t(r,t)}async resolveTrouble(e,t){if(!t)throw new Error("No tracker provided");return await Tt(e,t)}async init(){this.logger.debug(`initializing dashboard-operations ${this.id}`)}async load(){this.logger.debug(`loading dashboard-operations ${this.id}`)}};ve([s.kosDependency({modelType:s.TroubleContainer.type})],_.prototype,"troubles",2);ve([s.kosFuture()],_.prototype,"resolveAllTroubles",1);ve([s.kosFuture()],_.prototype,"resolveTrouble",1);_=ve([s.kosModel(R)],_);const fe={registration:{[R]:{class:_,singleton:!0}},type:R,predicate:s.isKosModel(R),factory:s.Kos.Singleton.create(R)};var er=Object.getOwnPropertyDescriptor,tr=(e,t,o,i)=>{for(var r=i>1?void 0:i?er(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const F="dispenser-model";let Oe=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}updateModel(){}async init(){this.logger.debug(`initializing dispenser ${this.id}`)}async load(){this.logger.debug(`loading dispenser ${this.id}`)}};Oe=tr([s.kosModel(F)],Oe);const Mt={registration:{[F]:{class:Oe,singleton:!0}},type:F,predicate:s.isKosModel(F),factory:s.Kos.Singleton.create(F)},{URL:or}=s.resolveServiceUrl("DISPENSER_SERVICE"),{getAll:rr}=s.ServiceFactory.build({basePath:`${or}/api/dispenser`}),sr=s.KosLog.createLogger({name:"dispenser-service",group:"Services"}),ir=async()=>(sr.debug("sending GET for dispenser"),await rr({})),nr=Object.freeze(Object.defineProperty({__proto__:null,getDispensers:ir},Symbol.toStringTag,{value:"Module"}));var ar=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,St=(e,t,o,i)=>{for(var r=i>1?void 0:i?lr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&ar(t,o,r),r};const K="dispenser-info-model";let le=class{constructor(e,t,o){n(this,"logger");n(this,"id");n(this,"name");this.id=e,this.logger=o.logger}async init(){this.logger.debug(`initializing dispenser-info ${this.id}`)}async load(){this.logger.debug(`loading dispenser-info ${this.id}`)}};St([s.kosConfigProperty({path:"kos:device",attribute:"name"})],le.prototype,"name",2);le=St([s.kosModel(K)],le);const kt={registration:{[K]:{class:le,singleton:!1}},type:K,predicate:s.isKosModel(K),factory:s.Kos.Factory.create(K)},{URL:dr}=s.resolveServiceUrl("DISPENSER-INFO_SERVICE"),{getAll:cr}=s.ServiceFactory.build({basePath:`${dr}/api/dispenser-info`}),ur=s.KosLog.createLogger({name:"dispenser-info-service",group:"Services"}),pr=async()=>(ur.debug("sending GET for dispenser-info"),await cr({})),gr=Object.freeze(Object.defineProperty({__proto__:null,getDispenserInfos:pr},Symbol.toStringTag,{value:"Module"}));var hr=Object.getOwnPropertyDescriptor,yr=(e,t,o,i)=>{for(var r=i>1?void 0:i?hr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const U="enrollment-model";let Ce=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"enrolled");this.id=e,this.logger=o.logger,this.enrolled=!1}updateModel(e){console.log("updateModel:",e)}async init(){this.logger.debug(`initializing enrollment ${this.id}`)}async load(){this.logger.debug(`loading enrollment ${this.id}`)}};Ce=yr([s.kosModel(U)],Ce);const Pt={registration:{[U]:{class:Ce,singleton:!0}},type:U,predicate:s.isKosModel(U),factory:s.Kos.Singleton.create(U)},{URL:vr}=s.resolveServiceUrl("ENROLLMENT_SERVICE"),{getAll:fr}=s.ServiceFactory.build({basePath:`${vr}/api/enrollment`}),mr=s.KosLog.createLogger({name:"enrollment-service",group:"Services"}),br=async()=>(mr.debug("sending GET for enrollment"),await fr({})),_r=Object.freeze(Object.defineProperty({__proto__:null,getEnrollments:br},Symbol.toStringTag,{value:"Module"})),Tr=e=>e.toLowerCase().includes("micros"),Mr=e=>!e.toLowerCase().includes("micros"),Sr=e=>t=>{const o=e==null?void 0:e.getHoldersByGroup(t);return o?o.map(i=>({id:i.id,name:i.ingredientName,path:i.path})):null},kr=["water","carb","ns","nss"],T="dashboardKeyFactory",Te=[];s.registerExtensionPoint(T,{register:(e,t)=>{Te.includes(t)||Te.push(t)},execute:(e,t)=>{const o=Te.sort((i,r)=>i.rank-r.rank);for(const i of o){const r=i.factory(t);if(r)return r}}});const $t=e=>{s.ExtensionManager[T].register(T,e)},Ot=e=>s.ExtensionManager[T].execute(T,e);s.ExtensionManager.registerDashboardKeyFactory=$t;s.ExtensionManager.executeDashboardKeyFactory=Ot;const Ee=3600,Ct=60,Pr=e=>{const t=Math.floor(e/Ee),o=Math.floor(e%Ee/Ct);return{hours:t,minutes:o}},$r=(e,t)=>e*Ee+t*Ct,Et=e=>{const o=new Date().valueOf()-e.valueOf(),i=Math.floor(o/(1e3*60)),r=Math.floor(i/60),a=Math.floor(r/24),l=i%60,ee=r%24;let te="";return a>0&&(te+=`${a} day${a>1?"s":""} `),ee>0&&(te+=`${ee} hour${ee>1?"s":""} `),(l>0||a===0&&ee===0)&&(te+=`${l} minute${l>1?"s":""} `),te};var Or=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,me=(e,t,o,i)=>{for(var r=i>1?void 0:i?Cr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Or(t,o,r),r};const x="ingredient-summary-model";let M=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"dashboardOperationModel");n(this,"appModel");n(this,"logger");this.id=e,this.logger=o.logger,this.dashboardOperationModel=fe.factory({})}get highPriorityHolders(){return this.assemblyModel.allHolders.filter(e=>e.troubles.length>0&&e.troubles.find(t=>t.rank>=400))}get actionRequiredHolders(){const e=this.appModel.currentRole,t=Ue(e);return this.assemblyModel.allHolders.filter(o=>{const i=s.getKosCompanionModel(o,m.FreestyleHolder.type);if(i!=null&&i.isRemote)return!1;const r=o.troubles.filter(t);return r.length>0&&r.find(a=>a.resolvable)})}get lowLevelHolders(){return this.assemblyModel.allHolders.filter(e=>{const t=e.fillPercent;return e.hasFuelGuage&&t<20})}async init(){this.logger.debug(`initializing ingredient-summary ${this.id}`)}async load(){this.logger.debug(`loading ingredient-summary ${this.id}`)}};me([s.kosDependency({modelType:k.Assembly.type})],M.prototype,"assemblyModel",2);me([s.kosDependency({modelType:fe.type})],M.prototype,"dashboardOperationModel",2);me([s.kosDependency({modelType:ye.type})],M.prototype,"appModel",2);M=me([s.kosModel(x)],M);const wt={registration:{[x]:{class:M,singleton:!1}},type:x,predicate:s.isKosModel(x),factory:s.Kos.Factory.create(x)},{URL:xe}=s.resolveServiceUrl("LOCKOUT_SERVICE"),{postModel:Lt}=s.ServiceFactory.build({basePath:`${xe}/api/app/kosdev.ddk/lockout`}),Dt=s.KosLog.createLogger({name:"lockout-service",group:"Services"}),Er=async()=>(Dt.info("lock"),await Lt({model:{},urlOverride:`${xe}/api/app/kosdev.ddk/lockout/lockNow`})),At=async e=>{Dt.info("unlock");const t=await Lt({model:{},urlOverride:`${xe}/api/app/kosdev.ddk/lockout/unlock/${e}`});return t==null?void 0:t.data},wr=Object.freeze(Object.defineProperty({__proto__:null,lock:Er,unlock:At},Symbol.toStringTag,{value:"Module"}));var Lr=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,C=(e,t,o,i)=>{for(var r=i>1?void 0:i?Dr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Lr(t,o,r),r};const It="lockout-model",Ar=[{day:"monday",lock:"dayWiseLockConfigMap.Mon.enabled",open:"dayWiseLockConfigMap.Mon.unlockTime",close:"dayWiseLockConfigMap.Mon.lockTime"},{day:"tuesday",lock:"dayWiseLockConfigMap.Tue.enabled",open:"dayWiseLockConfigMap.Tue.unlockTime",close:"dayWiseLockConfigMap.Tue.lockTime"},{day:"wednesday",lock:"dayWiseLockConfigMap.Wed.enabled",open:"dayWiseLockConfigMap.Wed.unlockTime",close:"dayWiseLockConfigMap.Wed.lockTime"},{day:"thursday",lock:"dayWiseLockConfigMap.Thu.enabled",open:"dayWiseLockConfigMap.Thu.unlockTime",close:"dayWiseLockConfigMap.Thu.lockTime"},{day:"friday",lock:"dayWiseLockConfigMap.Fri.enabled",open:"dayWiseLockConfigMap.Fri.unlockTime",close:"dayWiseLockConfigMap.Fri.lockTime"},{day:"saturday",lock:"dayWiseLockConfigMap.Sat.enabled",open:"dayWiseLockConfigMap.Sat.unlockTime",close:"dayWiseLockConfigMap.Sat.lockTime"},{day:"sunday",lock:"dayWiseLockConfigMap.Sun.enabled",open:"dayWiseLockConfigMap.Sun.unlockTime",close:"dayWiseLockConfigMap.Sun.lockTime"}];let h=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"dayEnabledList",["dayWiseLockConfigMap.Sun.enabled","dayWiseLockConfigMap.Mon.enabled","dayWiseLockConfigMap.Tue.enabled","dayWiseLockConfigMap.Wed.enabled","dayWiseLockConfigMap.Thu.enabled","dayWiseLockConfigMap.Fri.enabled","dayWiseLockConfigMap.Sat.enabled"]);n(this,"dayOpenAtList",["dayWiseLockConfigMap.Sun.unlockTime","dayWiseLockConfigMap.Mon.unlockTime","dayWiseLockConfigMap.Tue.unlockTime","dayWiseLockConfigMap.Wed.unlockTime","dayWiseLockConfigMap.Thu.unlockTime","dayWiseLockConfigMap.Fri.unlockTime","dayWiseLockConfigMap.Sat.unlockTime"]);n(this,"dayCloseAtList",["dayWiseLockConfigMap.Sun.lockTime","dayWiseLockConfigMap.Mon.lockTime","dayWiseLockConfigMap.Tue.lockTime","dayWiseLockConfigMap.Wed.lockTime","dayWiseLockConfigMap.Thu.lockTime","dayWiseLockConfigMap.Fri.lockTime","dayWiseLockConfigMap.Sat.lockTime"]);n(this,"saveMap");n(this,"pin");n(this,"nextLockSkipped");n(this,"nextLockTime");n(this,"nextUnLockTime");n(this,"cuiLockout");this.id=e,this.logger=o.logger,this.saveMap=new Map}get enabled(){const e=this.getProp("oneTimeLockConfig.lockTime"),t=e!==void 0&&e!=="",o=this.getProp("lockScheduleEnabled");return t||o}get schedule(){return Ar}getProp(e){return this.saveMap.get(e)}setProp(e,t){this.saveMap.set(e,t)}toggleSkip(){if(this.nextLockSkipped.value==="0"){const t=this.nextLockTime.value;t!==void 0&&this.nextLockSkipped.updateProperty(t)}else this.nextLockSkipped.updateProperty("0")}async unlock(e){return await At(e)}async save(){return this.saveMap.forEach((e,t)=>{e!==this.cuiLockout.props[t]&&(this.cuiLockout.props[t]=e)}),this.cuiLockout.updateConfigBean()}reset(){this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async init(){this.logger.debug(`initializing lockout ${this.id}`),this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async load(){this.logger.debug(`loading lockout ${this.id}`)}};C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"pin"})],h.prototype,"pin",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockSkipped"})],h.prototype,"nextLockSkipped",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockTime"})],h.prototype,"nextLockTime",2);C([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextUnLockTime"})],h.prototype,"nextUnLockTime",2);C([s.kosConfigBean({path:"app:kosdev.ddk:service:cuiLockout"})],h.prototype,"cuiLockout",2);h=C([s.kosModel(It)],h);const Ir=new s.SingletonKosModelRegistrationFactory({class:h,type:It}),Rr=async(e,t)=>await s.TroubleServices.bulkResolveTroubles(e,void 0,t);var Fr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,be=(e,t,o,i)=>{for(var r=i>1?void 0:i?Kr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Fr(t,o,r),r};const j="macro-assignment-model",qe="PurgeTrouble",Ur="PrimeTrouble";let S=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"futureHandler");n(this,"holders");n(this,"ingredients");this.id=e,this.futureHandler=new s.FutureHandler,this.logger=o.logger}get future(){return this.futureHandler.future}get macroHolders(){return this.holders.holders.getIndexByKey("group","macros").sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}get hasMacroHolders(){return this.macroHolders.length>0}get holderPurgeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[qe]||[];return t=[...t,...i],t},[])}get holderPrimeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[Ur]||[];return t=[...t,...i],t},[])}get hasHolderPurgeTroubles(){return this.holderPurgeTroubles.length>0}get hasHolderPrimeTroubles(){return this.holderPrimeTroubles.length>0}get macroIngredients(){return this.ingredients.ingredients.getIndexByKey("macro","macro")}get hasMacroIngredients(){return this.macroIngredients.length>0}async resolveAll(e,t){if(!t)throw new Error("No tracker provided");const i=(e===qe?this.holderPurgeTroubles:this.holderPrimeTroubles).map(a=>a.rawId);return await Rr(i,t)}};be([s.kosDependency({modelType:k.HolderContainer.type})],S.prototype,"holders",2);be([s.kosDependency({modelType:k.IngredientContainer.type})],S.prototype,"ingredients",2);be([s.kosFuture()],S.prototype,"resolveAll",1);S=be([s.kosModel(j)],S);const Rt={registration:{[j]:{class:S,singleton:!0}},type:j,predicate:s.isKosModel(j),factory:s.Kos.Singleton.create(j)};var xr=Object.getOwnPropertyDescriptor,jr=(e,t,o,i)=>{for(var r=i>1?void 0:i?xr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const N="network-test-model";let we=class{constructor(e,t,o){n(this,"id");n(this,"group");n(this,"passed");n(this,"inProgress");n(this,"failureTime");n(this,"timestamp");n(this,"name");n(this,"results");n(this,"logger");this.id=e,this.logger=o.logger,this.group=t.group,this.passed=!1,this.inProgress=!1,this.name=t.name,this.results=[]}updateModel(e){this.group=e.group,this.name=e.name,this.passed=e.passed,this.failureTime=e.failureTime,this.inProgress=e.inProgress,this.timestamp=e.timestamp,this.results=e.results}async init(){this.logger.debug(`initializing network-test ${this.id}`)}async load(){this.logger.debug(`loading network-test ${this.id}`)}};we=jr([s.kosModel(N)],we);const je={registration:{[N]:{class:we,singleton:!1}},type:N,predicate:s.isKosModel(N),factory:s.Kos.Factory.create(N)},{URL:_e}=s.resolveServiceUrl("NETWORK-TEST_SERVICE"),{getAll:Nr,getOne:Ft}=s.ServiceFactory.build({basePath:`${_e}/api/app/ncui/network/tests`}),Wr=s.KosLog.createLogger({name:"network-test-service",group:"Services"}),Kt=async()=>{Wr.debug("sending GET for network-test");const e=await Nr({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests`});return e==null?void 0:e.data},Ut=async()=>{const e=await Ft({urlOverride:`${_e}/api/app/kosdev.ddk/network/reports`});return e==null?void 0:e.data},xt=async(e,t)=>await Ft({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests/run/group/${e}`,tracker:t}),Hr=Object.freeze(Object.defineProperty({__proto__:null,getNetworkTests:Kt,getTestsReports:Ut,performGroupTest:xt},Symbol.toStringTag,{value:"Module"}));var zr=Object.defineProperty,Vr=Object.getOwnPropertyDescriptor,Ne=(e,t,o,i)=>{for(var r=i>1?void 0:i?Vr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&zr(t,o,r),r};const W="network-test-container-model";let X=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"lastTested");n(this,"futureHandler");n(this,"models");this.id=e,this.logger=o.logger,this.futureHandler=new s.FutureHandler(this),this.models=new s.KosModelContainer({parentId:e,indexMap:{group:"group"}}),this.lastTested=new Date("default")}get data(){return this.models.data}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}getModel(e){return this.models.getModel(e)}async init(){this.logger.debug(`initializing network-test-container container ${this.id}`)}getLastTested(e){const t=this.models.getIndexByKey("group",e).map(i=>i.timestamp&&new Date(i.timestamp)),o=Math.max(...t.map(i=>i?i.getTime():0));return o?Et(new Date(o)):""}async load(){this.logger.debug(`loading network-test-container container ${this.id}`);const e=await Kt(),t=await Ut();e&&e.forEach(o=>{const i=je.factory(o.id)(o);this.addModel(i)}),e&&t&&e.forEach(o=>{const i=t==null?void 0:t[o.group],r=i==null?void 0:i[o.id],a=this.getModel(o.id);if(a&&r){const l={group:r.group,name:r.name,passed:r.passed,failureTime:r.failureTime?new Date(r.failureTime):void 0,inProgress:r.inProgress,timestamp:new Date(r.timestamp),results:r.results};a.updateModel(l)}})}async performTest(e,t){if(!t)throw new Error("No tracker provided");const o=await xt(e,t);return o==null?void 0:o.data}onFutureUpdate(e){const{clientData:t}=e;t&&t.forEach(o=>{const i=this.getModel(o.id);if(s.kosAction(()=>{this.lastTested=this.lastTested>new Date(o.timestamp)?this.lastTested:new Date(o.timestamp)}),i){const r={group:o.group,name:o.name,passed:o.passed,failureTime:o.failureTime?new Date(o.failureTime):void 0,inProgress:o.inProgress,timestamp:new Date(o.timestamp),results:o.results};s.kosAction(()=>{i.updateModel(r)})}})}};Ne([s.kosChild],X.prototype,"models",2);Ne([s.kosFuture()],X.prototype,"performTest",1);X=Ne([s.kosModel(W)],X);const jt={registration:{[W]:{class:X,singleton:!0},...je.registration},type:W,predicate:s.isKosModel(W),factory:s.Kos.Singleton.create(W)};var Br=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,We=(e,t,o,i)=>{for(var r=i>1?void 0:i?Yr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&Br(t,o,r),r};const H="nutritive-sweetener-model",Gr=s.createPropKey("statePath");let J=class{constructor(e,t){n(this,"id");n(this,"assemblyModel");n(this,"pumpState");this.id=e}get holder(){return this.assemblyModel.getHoldersByGroup("ns")[0]}getHolder(){return this.holder}get statePath(){return`${this.pump.path}:airVent:state`}get pump(){return this.holder.pumps.data[0]}getPump(){return this.pump}};We([s.kosDependency({modelType:k.Assembly.type})],J.prototype,"assemblyModel",2);We([s.kosStateBean({path:Gr})],J.prototype,"pumpState",2);J=We([s.kosModel(H),s.kosLoggerAware()],J);const Nt={registration:{[H]:{class:J,singleton:!1}},type:H,predicate:s.isKosModel(H),factory:s.Kos.Factory.create(H)};var qr=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,Wt=(e,t,o,i)=>{for(var r=i>1?void 0:i?Qr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&qr(t,o,r),r};const z="plain-water-model";let de=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getHolder(){return this.assemblyModel.getHoldersByGroup("water")[0]}getPump(){var i,r;const e=this.getHolder(),t=(r=(i=e==null?void 0:e.pumps)==null?void 0:i.data)==null?void 0:r[0];return s.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing plain-water ${this.id}`)}async load(){this.logger.debug(`loading plain-water ${this.id}`)}};Wt([s.kosDependency({modelType:k.Assembly.type})],de.prototype,"assemblyModel",2);de=Wt([s.kosModel(z)],de);const Ht={registration:{[z]:{class:de,singleton:!1}},type:z,predicate:s.isKosModel(z),factory:s.Kos.Factory.create(z)},{URL:zt}=s.resolveServiceUrl("REBOOT_SERVICE"),{postModel:Xr}=s.ServiceFactory.build({basePath:`${zt}/api/reboot`}),Jr=s.KosLog.createLogger({name:"reboot-service",group:"Services"}),Vt=async()=>(Jr.debug("sending POST call for Reboot Dispenser"),await Xr({urlOverride:`${zt}/api/app/kosdev.ddk/ncui/reboot`,model:{}})),Zr=Object.freeze(Object.defineProperty({__proto__:null,rebootDispenser:Vt},Symbol.toStringTag,{value:"Module"}));var es=Object.getOwnPropertyDescriptor,ts=(e,t,o,i)=>{for(var r=i>1?void 0:i?es(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const V="reboot-model";let Le=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}async completeReboot(){await Vt()}updateModel(){}async init(){this.logger.debug(`initializing reboot ${this.id}`)}async load(){this.logger.debug(`loading reboot ${this.id}`)}};Le=ts([s.kosModel(V)],Le);const Bt={registration:{[V]:{class:Le,singleton:!1}},type:V,predicate:s.isKosModel(V),factory:s.Kos.Factory.create(V)};var os=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,c=(e,t,o,i)=>{for(var r=i>1?void 0:i?rs(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&os(t,o,r),r};const B="settings-model";let d=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"ncuiLanguageData");n(this,"resolveDelaysMs");n(this,"dateFormat");n(this,"timeFormat");n(this,"hidePlainWaterBev");n(this,"hideCarbWaterBev");n(this,"ncuiLanguage");n(this,"name");n(this,"activateAndRebootTime");n(this,"horizontalMode");this.id=e,this.logger=o.logger}async ready(){this.updateDisplayMode()}async getNcuiLanguageList(){this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}async load(){this.logger.debug(`loading settings ${this.id}`),this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}handleUpdateDisplayMode(){this.updateDisplayMode()}updateDisplayMode(){this.horizontalMode.value?document.body.setAttribute("data-dashboard-layout","horizontal"):document.body.setAttribute("data-dashboard-layout","vertical")}};c([s.kosConfigProperty({path:"system:app",attribute:"resolveDelaysMs"})],d.prototype,"resolveDelaysMs",2);c([s.kosConfigProperty({path:"system:app",attribute:"dateFormat"})],d.prototype,"dateFormat",2);c([s.kosConfigProperty({path:"system:app",attribute:"timeFormat"})],d.prototype,"timeFormat",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hidePlainWaterBev"})],d.prototype,"hidePlainWaterBev",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hideCarbWaterBev"})],d.prototype,"hideCarbWaterBev",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],d.prototype,"ncuiLanguage",2);c([s.kosConfigProperty({path:"kos:device",attribute:"name"})],d.prototype,"name",2);c([s.kosConfigProperty({path:"kos:service:OTA",attribute:"activateAndRebootTime"})],d.prototype,"activateAndRebootTime",2);c([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.display.horizontalMode"})],d.prototype,"horizontalMode",2);c([s.kosModelEffect({dependencies:e=>[e.horizontalMode.value]})],d.prototype,"handleUpdateDisplayMode",1);d=c([s.kosModel(B)],d);const Yt={registration:{[B]:{class:d,singleton:!0}},type:B,predicate:s.isKosModel(B),factory:s.Kos.Singleton.create(B)},{URL:Gt}=s.resolveServiceUrl("SETTINGS_SERVICE"),{getAll:qt}=s.ServiceFactory.build({basePath:`${Gt}/api/settings`}),ss=s.KosLog.createLogger({name:"settings-service",group:"Services"}),is=async()=>(ss.debug("sending GET for settings"),await qt({})),ns=async()=>await qt({urlOverride:`${Gt}api/app/kosdev.ddk/ncui/languages`}),as=Object.freeze(Object.defineProperty({__proto__:null,getNcuiLanguage:ns,getSettings:is},Symbol.toStringTag,{value:"Module"}));var ls=Object.getOwnPropertyDescriptor,ds=(e,t,o,i)=>{for(var r=i>1?void 0:i?ls(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=l(r)||r);return r};const Y="utilities-model";let De=class{constructor(e,t,o){n(this,"id");n(this,"name");n(this,"options");n(this,"roles");n(this,"columnId");n(this,"logger");this.id=e,this.logger=o.logger,this.name=t.name,this.options=t.options,this.roles=t==null?void 0:t.roles,this.columnId=t.columnId}updateModel(e){this.name=e.name,this.options=e.options,this.roles=e==null?void 0:e.roles}get titleKey(){return`utility.${this.id}.title`}get bodyKey(){return`utility.${this.id}.body`}async init(){this.logger.debug(`initializing utilities ${this.id}`)}async load(){this.logger.debug(`loading utilities ${this.id}`)}};De=ds([s.kosModel(Y)],De);const He={registration:{[Y]:{class:De,singleton:!1}},type:Y,predicate:s.isKosModel(Y),factory:s.Kos.Factory.create(Y)},{URL:se}=s.resolveServiceUrl("UTILITIES_SERVICE"),{getAll:Me}=s.ServiceFactory.build({basePath:`${se}/api/utilities`}),Se=s.KosLog.createLogger({name:"utilities-service",group:"Services"}),Qt=async()=>{Se.debug("sending GET for utilities");try{const e=await Me({urlOverride:`${se}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`});if((e==null?void 0:e.status)!==200){Se.info("no extensions found, using base data");const t=await Me({urlOverride:`${se}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch(e){Se.info(`error fetching utilities: ${e}. Using base data`);const t=await Me({urlOverride:`${se}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}},cs=Object.freeze(Object.defineProperty({__proto__:null,getUtilities:Qt},Symbol.toStringTag,{value:"Module"}));var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,Xt=(e,t,o,i)=>{for(var r=i>1?void 0:i?ps(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&us(t,o,r),r};const G="utilities-container-model";let ce=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"_models");this.id=e,this.logger=o.logger,this._models=new s.KosModelContainer({parentId:e,sortKey:"id",indexMap:{byColumn:"columnId"}})}get data(){return this._models.data}get models(){return this._models}get columns(){return this._models.getIndexKeys("byColumn").sort((e,t)=>e.localeCompare(t))}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}getModel(e){return this._models.getModel(e)}getUtilitiesByColumn(e){return this._models.getIndexByKey("byColumn",e)}async load(){this.logger.debug(`loading utilities-container container ${this.id}`);const e=await Qt();e==null||e.forEach((t,o)=>{t.forEach(i=>{const r={...i,columnId:String(o)},a=He.factory(i.name)(r);this.addModel(a)})})}};Xt([s.kosChild],ce.prototype,"_models",2);ce=Xt([s.kosModel(G)],ce);const Jt={registration:{[G]:{class:ce,singleton:!0},...He.registration},type:G,predicate:s.isKosModel(G),factory:s.Kos.Singleton.create(G)},gs={...dt.registration,...ye.registration,...ge.registration,...ut.registration,...fe.registration,...Mt.registration,...kt.registration,...Pt.registration,...wt.registration,...Rt.registration,...jt.registration,...Nt.registration,...Ht.registration,...Bt.registration,...Yt.registration,...Ke.registration,...Jt.registration};var hs=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,Zt=(e,t,o,i)=>{for(var r=i>1?void 0:i?ys(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&hs(t,o,r),r};const eo="trouble-action-model";let ue=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"troubleContainer");n(this,"disposer");n(this,"state");n(this,"troubleActionData");this.id=e,this.logger=o.logger,this.state=s.ObservableData(),this.troubleActionData=t.definitions.reduce((i,r)=>(i[r.troubleType]=r,i),{})}get activeTrouble(){const e=Object.keys(this.troubleActionData);if(e.length>0){const t=e[0],o=this.troubleContainer.troubles.getIndexByKey("byType",t);return o.length>0?o[0]:void 0}}get activeTroubleType(){var e;return(e=this.activeTrouble)==null?void 0:e.type}async init(){this.logger.debug(`initializing trouble-action ${this.id}`),this.disposer=s.kosAutoEffect(()=>{const e=this.troubleContainer.troubles.data.reduce((t,o)=>{const i=o.type;if(this.troubleActionData[i]){const r=this.troubleActionData[i].stateKey??i,a=this.troubleActionData[i].stateValue??i;t[r]=a}return t},{});this.state.setValues(e),Object.keys(this.troubleActionData).forEach(t=>{if(this.troubleContainer.troubles.getIndexByKey("byType",t).length===0){const o=this.troubleActionData[t].stateKey??t;this.state[o]=void 0}})})}unload(){var e;(e=this.disposer)==null||e.call(this)}async load(){this.logger.debug(`loading trouble-action ${this.id}`)}};Zt([s.kosDependency({modelType:s.TroubleContainer.type})],ue.prototype,"troubleContainer",2);ue=Zt([s.kosModel(eo)],ue);const vs=new s.SingletonKosModelRegistrationFactory({class:ue,type:eo}),{URL:to}=s.resolveServiceUrl("START_SERVICE"),{getOne:fs}=s.ServiceFactory.build({basePath:`${to}/api/start`}),ms=s.KosLog.createLogger({name:"start-service",group:"Services"}),oo=async()=>(ms.debug("navigating to NCUI"),await fs({urlOverride:`${to}/api/app/kosdev.ddk/ncui/open`})),bs=Object.freeze(Object.defineProperty({__proto__:null,navigateToNCui:oo},Symbol.toStringTag,{value:"Module"}));var _s=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ro=(e,t,o,i)=>{for(var r=i>1?void 0:i?Ts(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(r=(i?l(t,o,r):l(r))||r);return i&&r&&_s(t,o,r),r};const so="start-model";let pe=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"troubles");this.id=e,this.logger=o.logger}get firmwareFailed(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateFailedTrouble").length>0}get firmwareInProgress(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateInProgressTrouble").length>0}async navigate(){await oo()}async init(){this.logger.debug(`initializing start ${this.id}`)}async load(){this.logger.debug(`loading start ${this.id}`)}};ro([s.kosDependency({modelType:s.TroubleContainer.type})],pe.prototype,"troubles",2);pe=ro([s.kosModel(so)],pe);const Ms=new s.SingletonKosModelRegistrationFactory({class:pe,type:so});exports.AgitationControl=Do;exports.Animation=dt;exports.AnimationServices=xo;exports.Application=ye;exports.Auth=ge;exports.AuthServices=co;exports.CarbWater=ut;exports.CopyLogs=Qo;exports.CopyLogsServices=Vo;exports.DDKModels=gs;exports.DashboardOperations=fe;exports.DashboardOperationsServices=Xo;exports.Dispenser=Mt;exports.DispenserInfo=kt;exports.DispenserInfoServices=gr;exports.DispenserServices=nr;exports.Door=ot;exports.EXTENSION_POINT_DASHBOARD_KEY_FACTORY=T;exports.Enrollment=Pt;exports.EnrollmentServices=_r;exports.IngredientSummary=wt;exports.Lockout=Ir;exports.LockoutServices=wr;exports.MACRO_KEYS=kr;exports.MacroAssignment=Rt;exports.NetworkTest=je;exports.NetworkTestContainer=jt;exports.NetworkTestServices=Hr;exports.NutritiveSweetener=Nt;exports.PlainWater=Ht;exports.Reboot=Bt;exports.RebootServices=Zr;exports.Settings=Yt;exports.SettingsServices=as;exports.SetupStep=Fe;exports.SetupStepContainer=Ke;exports.SetupStepServices=mo;exports.Start=Ms;exports.StartServices=bs;exports.TROUBLE_TYPE_PRIME=Qe;exports.TROUBLE_TYPE_PURGE=ke;exports.TroubleActionManager=vs;exports.Utilities=He;exports.UtilitiesContainer=Jt;exports.UtilitiesServices=cs;exports.calculateTimeDifference=Et;exports.executeDashboardKeyFactory=Ot;exports.isMacroGroup=Mr;exports.isMicroGroup=Tr;exports.macroHolderMap=Sr;exports.registerDashboardKeyFactory=$t;exports.toSeconds=$r;exports.toTimeComponents=Pr;exports.troubleVisibilityFilter=Ue;
|
package/index.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var yo = Object.defineProperty;
|
|
2
2
|
var fo = (e, t, o) => t in e ? yo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
3
|
var i = (e, t, o) => (fo(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
-
import { resolveServiceUrl as h, ServiceFactory as y, KosLog as g, kosTopicHandler as Te, kosModel as l, kosAction as v, Kos as c, isKosModel as u, createPropKey as
|
|
5
|
-
import { AGITATION_REQUIRED_TROUBLE as
|
|
4
|
+
import { resolveServiceUrl as h, ServiceFactory as y, KosLog as g, kosTopicHandler as Te, kosModel as l, kosAction as v, Kos as c, isKosModel as u, createPropKey as pt, kosStateProp as vo, kosConfigProperty as d, KosModelRegistrationFactory as mo, kosDependency as p, KosModelContainer as Ve, resolveContainerDeltas as rt, kosChild as $e, Device as bo, kosFuture as P, kosModelEffect as He, MultipleFutureHandler as _o, FutureEndState as T, TroubleServices as Me, Troubles as st, SingletonKosModelRegistrationFactory as Pe, getKosCompanionModel as Be, FetchError as gt, StorageDeviceContainer as To, kosFutureAware as $o, kosLoggerAware as ht, KosDataContainer as Mo, TroubleContainer as Ke, FutureHandler as Ye, troubleByTypeReducer as Po, registerExtensionPoint as Oo, ExtensionManager as Oe, kosConfigBean as So, kosStateBean as wo, ObservableData as Eo, kosAutoEffect as Lo } from "@kosdev-code/kos-ui-sdk";
|
|
5
|
+
import { AGITATION_REQUIRED_TROUBLE as yt, CartridgeAgitatorEvents as ft, FcmPump as vt, FreestyleHolder as Co } from "@kosdev-code/kos-freestyle-sdk";
|
|
6
6
|
import { Assembly as Se, HolderContainer as ko, IngredientContainer as Do } from "@kosdev-code/kos-dispense-sdk";
|
|
7
|
-
const
|
|
7
|
+
const it = "PurgeTrouble", Io = "PrimeTrouble", { URL: Ge } = h("AUTH_SERVICE"), { getOne: Ro, postModel: Ao } = y.build({
|
|
8
8
|
basePath: `${Ge}/api/auth`
|
|
9
|
-
}),
|
|
9
|
+
}), mt = g.createLogger({ name: "auth-service", group: "Services" }), bt = async () => (mt.debug("sending GET for auth"), await Ro({
|
|
10
10
|
urlOverride: `${Ge}/api/app/kosdev.ddk/auth/role`
|
|
11
|
-
})),
|
|
11
|
+
})), _t = async (e) => (mt.debug("sending POST for auth"), await Ao({
|
|
12
12
|
urlOverride: `${Ge}/api/app/kosdev.ddk/auth/pincode/${e}`,
|
|
13
13
|
model: {}
|
|
14
14
|
})), Hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
15
15
|
__proto__: null,
|
|
16
|
-
getCurrentRole:
|
|
17
|
-
sendPinCode:
|
|
16
|
+
getCurrentRole: bt,
|
|
17
|
+
sendPinCode: _t
|
|
18
18
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19
|
-
var Fo = Object.defineProperty, xo = Object.getOwnPropertyDescriptor,
|
|
19
|
+
var Fo = Object.defineProperty, xo = Object.getOwnPropertyDescriptor, Tt = (e, t, o, s) => {
|
|
20
20
|
for (var r = s > 1 ? void 0 : s ? xo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
21
21
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
22
22
|
return s && r && Fo(t, o, r), r;
|
|
23
23
|
};
|
|
24
|
-
const F = "auth-model",
|
|
25
|
-
let
|
|
24
|
+
const F = "auth-model", nt = (e) => e.toLowerCase();
|
|
25
|
+
let ge = class {
|
|
26
26
|
constructor(e, t, o) {
|
|
27
27
|
i(this, "id");
|
|
28
28
|
i(this, "logger");
|
|
@@ -32,7 +32,7 @@ let pe = class {
|
|
|
32
32
|
async authorize(e) {
|
|
33
33
|
if (!e)
|
|
34
34
|
return !1;
|
|
35
|
-
const t = await
|
|
35
|
+
const t = await _t(e);
|
|
36
36
|
return (t == null ? void 0 : t.status) === 200 ? t.data : !1;
|
|
37
37
|
}
|
|
38
38
|
// -------------------LIFECYCLE----------------------------
|
|
@@ -41,31 +41,31 @@ let pe = class {
|
|
|
41
41
|
}
|
|
42
42
|
async load() {
|
|
43
43
|
this.logger.debug(`loading auth ${this.id}`);
|
|
44
|
-
const e = await
|
|
44
|
+
const e = await bt();
|
|
45
45
|
(e == null ? void 0 : e.status) === 200 && (this.logger.debug(`response ${e.data}`), v(() => {
|
|
46
|
-
this.currentRole =
|
|
46
|
+
this.currentRole = nt(e.data);
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
handleRoleChange(e) {
|
|
50
|
-
this.currentRole =
|
|
50
|
+
this.currentRole = nt(e);
|
|
51
51
|
}
|
|
52
52
|
forceRole(e) {
|
|
53
53
|
this.currentRole = e;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
Tt([
|
|
57
57
|
Te({
|
|
58
58
|
topic: "/app/kosdev.ddk/auth/role",
|
|
59
59
|
websocket: !0
|
|
60
60
|
})
|
|
61
|
-
],
|
|
62
|
-
|
|
61
|
+
], ge.prototype, "handleRoleChange", 1);
|
|
62
|
+
ge = Tt([
|
|
63
63
|
l(F)
|
|
64
|
-
],
|
|
64
|
+
], ge);
|
|
65
65
|
const qe = {
|
|
66
66
|
registration: {
|
|
67
67
|
[F]: {
|
|
68
|
-
class:
|
|
68
|
+
class: ge,
|
|
69
69
|
singleton: !1
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -73,45 +73,55 @@ const qe = {
|
|
|
73
73
|
predicate: u(F),
|
|
74
74
|
factory: c.Factory.create(F)
|
|
75
75
|
};
|
|
76
|
-
var jo = Object.defineProperty, Uo = Object.getOwnPropertyDescriptor,
|
|
76
|
+
var jo = Object.defineProperty, Uo = Object.getOwnPropertyDescriptor, Qe = (e, t, o, s) => {
|
|
77
77
|
for (var r = s > 1 ? void 0 : s ? Uo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
78
78
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
79
79
|
return s && r && jo(t, o, r), r;
|
|
80
80
|
};
|
|
81
|
-
const $t = "door-model", Wo =
|
|
82
|
-
let
|
|
81
|
+
const $t = "door-model", Wo = pt("doorPath");
|
|
82
|
+
let oe = class {
|
|
83
83
|
constructor(e, t, o) {
|
|
84
84
|
i(this, "id");
|
|
85
85
|
i(this, "logger");
|
|
86
86
|
i(this, "doorPath");
|
|
87
87
|
i(this, "open");
|
|
88
|
+
i(this, "ignoreDoor");
|
|
88
89
|
this.id = e, this.logger = o.logger, this.doorPath = t.doorPath;
|
|
89
90
|
}
|
|
90
91
|
get currentState() {
|
|
91
92
|
return this.open.value === void 0 ? "UNKNOWN" : this.open.value ? "OPEN" : "CLOSED";
|
|
92
93
|
}
|
|
93
94
|
get isOpen() {
|
|
94
|
-
|
|
95
|
+
const e = this.open.value === void 0 ? !0 : this.open.value;
|
|
96
|
+
return this.ignoreDoor.value ? (this.logger.debug(
|
|
97
|
+
"Door state is being ignored (treating as closed) due to ignoreDoor config property being true."
|
|
98
|
+
), !1) : e;
|
|
95
99
|
}
|
|
96
100
|
};
|
|
97
|
-
|
|
101
|
+
Qe([
|
|
98
102
|
vo({ path: Wo, attribute: "state" })
|
|
99
|
-
],
|
|
100
|
-
|
|
103
|
+
], oe.prototype, "open", 2);
|
|
104
|
+
Qe([
|
|
105
|
+
d({
|
|
106
|
+
path: "app:kosdev.ddk:app",
|
|
107
|
+
attribute: "ncui.ignoreDoorStateOnExit"
|
|
108
|
+
})
|
|
109
|
+
], oe.prototype, "ignoreDoor", 2);
|
|
110
|
+
oe = Qe([
|
|
101
111
|
l($t)
|
|
102
|
-
],
|
|
112
|
+
], oe);
|
|
103
113
|
const No = new mo({
|
|
104
|
-
class:
|
|
114
|
+
class: oe,
|
|
105
115
|
type: $t
|
|
106
|
-
}), { URL:
|
|
107
|
-
basePath: `${
|
|
116
|
+
}), { URL: Xe } = h("SETUP-STEP_SERVICE"), { getAll: zo, postModel: Vo } = y.build({
|
|
117
|
+
basePath: `${Xe}/api/setup-step`
|
|
108
118
|
}), Mt = g.createLogger({
|
|
109
119
|
name: "setup-step-service",
|
|
110
120
|
group: "Services"
|
|
111
121
|
}), Pt = async () => (Mt.debug("sending GET for setup-step"), await zo({
|
|
112
|
-
urlOverride: `${
|
|
122
|
+
urlOverride: `${Xe}/api/app/kosdev.ddk/setup/steps`
|
|
113
123
|
})), Ot = async (e) => (Mt.debug("sending POST for setup-step"), await Vo({
|
|
114
|
-
urlOverride: `${
|
|
124
|
+
urlOverride: `${Xe}/api/app/kosdev.ddk/setup/complete/${e}`,
|
|
115
125
|
model: {}
|
|
116
126
|
})), Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
117
127
|
__proto__: null,
|
|
@@ -178,13 +188,13 @@ var Ko = Object.defineProperty, Yo = Object.getOwnPropertyDescriptor, we = (e, t
|
|
|
178
188
|
return s && r && Ko(t, o, r), r;
|
|
179
189
|
};
|
|
180
190
|
const j = "setup-step-container-model";
|
|
181
|
-
function
|
|
191
|
+
function at(e) {
|
|
182
192
|
return (t) => {
|
|
183
193
|
const o = St.factory(t.id)(t);
|
|
184
194
|
o.updateModel(t), e.addModel(o);
|
|
185
195
|
};
|
|
186
196
|
}
|
|
187
|
-
function
|
|
197
|
+
function lt(e) {
|
|
188
198
|
return (t) => {
|
|
189
199
|
e.removeModel(t);
|
|
190
200
|
};
|
|
@@ -256,10 +266,10 @@ let E = class {
|
|
|
256
266
|
id: `setup-${o.name}`
|
|
257
267
|
})
|
|
258
268
|
);
|
|
259
|
-
|
|
269
|
+
rt({
|
|
260
270
|
container: this.models,
|
|
261
|
-
onAddItem:
|
|
262
|
-
onRemoveItem:
|
|
271
|
+
onAddItem: at(this),
|
|
272
|
+
onRemoveItem: lt(this)
|
|
263
273
|
})(t);
|
|
264
274
|
}
|
|
265
275
|
this.nextStep();
|
|
@@ -270,10 +280,10 @@ let E = class {
|
|
|
270
280
|
idx: s,
|
|
271
281
|
id: `setup-${o.name}`
|
|
272
282
|
}));
|
|
273
|
-
|
|
283
|
+
rt({
|
|
274
284
|
container: this.models,
|
|
275
|
-
onAddItem:
|
|
276
|
-
onRemoveItem:
|
|
285
|
+
onAddItem: at(this),
|
|
286
|
+
onRemoveItem: lt(this)
|
|
277
287
|
})(t);
|
|
278
288
|
}
|
|
279
289
|
};
|
|
@@ -303,39 +313,39 @@ const wt = {
|
|
|
303
313
|
type: j,
|
|
304
314
|
predicate: u(j),
|
|
305
315
|
factory: c.Singleton.create(j)
|
|
306
|
-
}, { URL: S } = h("AUTH_SERVICE"), { getOne: Et, getAll:
|
|
316
|
+
}, { URL: S } = h("AUTH_SERVICE"), { getOne: Et, getAll: ue } = y.build({
|
|
307
317
|
basePath: `${S}/api/app/kosdev.ddk/ncui/`
|
|
308
|
-
}),
|
|
309
|
-
|
|
310
|
-
const e = await
|
|
318
|
+
}), re = g.createLogger({ name: "auth-service", group: "Services" }), Go = async () => {
|
|
319
|
+
re.debug("sending GET for cuis");
|
|
320
|
+
const e = await ue({
|
|
311
321
|
urlOverride: `${S}/api/app/kosdev.ddk/cui`
|
|
312
322
|
});
|
|
313
323
|
if ((e == null ? void 0 : e.status) !== 200)
|
|
314
324
|
throw new Error("Failed to retrieve cuis");
|
|
315
325
|
return e.data;
|
|
316
326
|
}, qo = async () => {
|
|
317
|
-
|
|
327
|
+
re.debug("sending GET for navigation");
|
|
318
328
|
try {
|
|
319
|
-
const e = await
|
|
329
|
+
const e = await ue({
|
|
320
330
|
urlOverride: `${S}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`
|
|
321
331
|
});
|
|
322
332
|
if ((e == null ? void 0 : e.status) !== 200) {
|
|
323
|
-
|
|
324
|
-
const t = await
|
|
333
|
+
re.info("no extensions found, using base data");
|
|
334
|
+
const t = await ue({
|
|
325
335
|
urlOverride: `${S}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
326
336
|
});
|
|
327
337
|
return (t == null ? void 0 : t.data) ?? [];
|
|
328
338
|
}
|
|
329
339
|
return (e == null ? void 0 : e.data) ?? [];
|
|
330
340
|
} catch {
|
|
331
|
-
const t = await
|
|
341
|
+
const t = await ue({
|
|
332
342
|
urlOverride: `${S}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
333
343
|
});
|
|
334
344
|
return (t == null ? void 0 : t.data) ?? [];
|
|
335
345
|
}
|
|
336
|
-
}, Qo = async () => (
|
|
346
|
+
}, Qo = async () => (re.debug("navigating to CUI"), await Et({
|
|
337
347
|
urlOverride: `${S}/api/app/kosdev.ddk/cui/open`
|
|
338
|
-
})), Xo = async () => (
|
|
348
|
+
})), Xo = async () => (re.debug("navigating to NCUI"), await Et({
|
|
339
349
|
urlOverride: `${S}/api/app/kosdev.ddk/ncui/open`
|
|
340
350
|
}));
|
|
341
351
|
var Jo = Object.defineProperty, Zo = Object.getOwnPropertyDescriptor, O = (e, t, o, s) => {
|
|
@@ -459,7 +469,7 @@ O([
|
|
|
459
469
|
b = O([
|
|
460
470
|
l(U)
|
|
461
471
|
], b);
|
|
462
|
-
const
|
|
472
|
+
const Je = {
|
|
463
473
|
registration: {
|
|
464
474
|
[U]: {
|
|
465
475
|
class: b,
|
|
@@ -471,17 +481,17 @@ const Xe = {
|
|
|
471
481
|
factory: c.Singleton.create(
|
|
472
482
|
U
|
|
473
483
|
)
|
|
474
|
-
},
|
|
484
|
+
}, ce = {
|
|
475
485
|
none: 999,
|
|
476
486
|
crew: 0,
|
|
477
487
|
technician: 1,
|
|
478
488
|
manager: 2
|
|
479
489
|
}, Ct = (e) => (t) => {
|
|
480
|
-
if (t.type ===
|
|
490
|
+
if (t.type === yt)
|
|
481
491
|
return !1;
|
|
482
492
|
const o = (t == null ? void 0 : t.role) || "technician";
|
|
483
493
|
if (e && o) {
|
|
484
|
-
const s =
|
|
494
|
+
const s = ce[e.toLowerCase()] ?? ce.crew, r = ce[o.toLowerCase()] ?? ce.crew;
|
|
485
495
|
return s >= r;
|
|
486
496
|
}
|
|
487
497
|
return !1;
|
|
@@ -561,13 +571,13 @@ let $ = class {
|
|
|
561
571
|
}
|
|
562
572
|
get queuedTroubles() {
|
|
563
573
|
return this.troubleContainer.troubles.getIndexByKey(
|
|
564
|
-
|
|
565
|
-
|
|
574
|
+
st.INDEX_TROUBLES_BY_DEFERRED,
|
|
575
|
+
st.TROUBLES_DEFERRED
|
|
566
576
|
);
|
|
567
577
|
}
|
|
568
578
|
get visibleTroubles() {
|
|
569
579
|
const e = this.application.currentRole;
|
|
570
|
-
return this.troubleContainer.troubles.data.filter(Ct(e)).filter((t) => t.type !==
|
|
580
|
+
return this.troubleContainer.troubles.data.filter(Ct(e)).filter((t) => t.type !== yt);
|
|
571
581
|
}
|
|
572
582
|
// -------------------LIFECYCLE----------------------------
|
|
573
583
|
get future() {
|
|
@@ -599,16 +609,16 @@ let $ = class {
|
|
|
599
609
|
}
|
|
600
610
|
};
|
|
601
611
|
D([
|
|
602
|
-
p({ modelType:
|
|
612
|
+
p({ modelType: Je.type })
|
|
603
613
|
], $.prototype, "application", 2);
|
|
604
614
|
D([
|
|
605
615
|
P({ alias: Fe })
|
|
606
616
|
], $.prototype, "resolveDeferredTroubles", 1);
|
|
607
617
|
D([
|
|
608
|
-
Te({ topic:
|
|
618
|
+
Te({ topic: ft.TOPIC_AGITATION_STARTED })
|
|
609
619
|
], $.prototype, "handleAgitationStarted", 1);
|
|
610
620
|
D([
|
|
611
|
-
Te({ topic:
|
|
621
|
+
Te({ topic: ft.TOPIC_AGITATION_ENDED })
|
|
612
622
|
], $.prototype, "handleAgitationEnded", 1);
|
|
613
623
|
D([
|
|
614
624
|
He({
|
|
@@ -622,7 +632,7 @@ const Ks = new Pe({
|
|
|
622
632
|
class: $,
|
|
623
633
|
type: kt
|
|
624
634
|
});
|
|
625
|
-
var rr = Object.defineProperty, sr = Object.getOwnPropertyDescriptor,
|
|
635
|
+
var rr = Object.defineProperty, sr = Object.getOwnPropertyDescriptor, ae = (e, t, o, s) => {
|
|
626
636
|
for (var r = s > 1 ? void 0 : s ? sr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
627
637
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
628
638
|
return s && r && rr(t, o, r), r;
|
|
@@ -639,31 +649,31 @@ let w = class {
|
|
|
639
649
|
this.id = e, this.logger = o.logger;
|
|
640
650
|
}
|
|
641
651
|
};
|
|
642
|
-
|
|
652
|
+
ae([
|
|
643
653
|
d({
|
|
644
654
|
path: "app:kosdev.ddk:app",
|
|
645
655
|
attribute: "ncui.uiConfig.animations.disableAll"
|
|
646
656
|
})
|
|
647
657
|
], w.prototype, "disableAll", 2);
|
|
648
|
-
|
|
658
|
+
ae([
|
|
649
659
|
d({
|
|
650
660
|
path: "app:kosdev.ddk:app",
|
|
651
661
|
attribute: "ncui.uiConfig.animations.enableDial"
|
|
652
662
|
})
|
|
653
663
|
], w.prototype, "enableDial", 2);
|
|
654
|
-
|
|
664
|
+
ae([
|
|
655
665
|
d({
|
|
656
666
|
path: "app:kosdev.ddk:app",
|
|
657
667
|
attribute: "ncui.uiConfig.animations.enableModal"
|
|
658
668
|
})
|
|
659
669
|
], w.prototype, "enableModal", 2);
|
|
660
|
-
|
|
670
|
+
ae([
|
|
661
671
|
d({
|
|
662
672
|
path: "app:kosdev.ddk:app",
|
|
663
673
|
attribute: "ncui.uiConfig.animations.enableSideBar"
|
|
664
674
|
})
|
|
665
675
|
], w.prototype, "enableSideBar", 2);
|
|
666
|
-
w =
|
|
676
|
+
w = ae([
|
|
667
677
|
l(W)
|
|
668
678
|
], w);
|
|
669
679
|
const ir = {
|
|
@@ -700,7 +710,7 @@ let he = class {
|
|
|
700
710
|
}
|
|
701
711
|
getPump() {
|
|
702
712
|
const t = this.assemblyModel.getHoldersByGroup("carb")[0].pumps.data[0];
|
|
703
|
-
return Be(t,
|
|
713
|
+
return Be(t, vt.type);
|
|
704
714
|
}
|
|
705
715
|
// -------------------LIFECYCLE----------------------------
|
|
706
716
|
async init() {
|
|
@@ -766,7 +776,7 @@ const pr = {
|
|
|
766
776
|
});
|
|
767
777
|
return [void 0, e == null ? void 0 : e.data];
|
|
768
778
|
} catch (e) {
|
|
769
|
-
if (e instanceof
|
|
779
|
+
if (e instanceof gt)
|
|
770
780
|
return ye.error(`Error fetching log file size: ${e.payload.error}`), [e.payload.error, void 0];
|
|
771
781
|
}
|
|
772
782
|
return ["unknownError", void 0];
|
|
@@ -778,7 +788,7 @@ const pr = {
|
|
|
778
788
|
});
|
|
779
789
|
return [void 0, e == null ? void 0 : e.data];
|
|
780
790
|
} catch (e) {
|
|
781
|
-
if (e instanceof
|
|
791
|
+
if (e instanceof gt)
|
|
782
792
|
return ye.error(`Error fetching log file size: ${e.payload.error}`), [e.payload.error, void 0];
|
|
783
793
|
}
|
|
784
794
|
return ["unknownError", void 0];
|
|
@@ -953,7 +963,7 @@ R([
|
|
|
953
963
|
_ = R([
|
|
954
964
|
l({ modelTypeId: br, singleton: !0 }),
|
|
955
965
|
$o(),
|
|
956
|
-
|
|
966
|
+
ht()
|
|
957
967
|
], _);
|
|
958
968
|
const qs = _.Registration, Wt = g.createLogger({
|
|
959
969
|
name: "dashboard-operations-service",
|
|
@@ -977,10 +987,10 @@ var _r = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ee = (e, t
|
|
|
977
987
|
return s && r && _r(t, o, r), r;
|
|
978
988
|
};
|
|
979
989
|
const z = "dashboard-operations-model";
|
|
980
|
-
function
|
|
990
|
+
function dt(e) {
|
|
981
991
|
return !e.deferred;
|
|
982
992
|
}
|
|
983
|
-
function
|
|
993
|
+
function ct(e) {
|
|
984
994
|
return e.deferred;
|
|
985
995
|
}
|
|
986
996
|
let L = class {
|
|
@@ -998,16 +1008,16 @@ let L = class {
|
|
|
998
1008
|
);
|
|
999
1009
|
}
|
|
1000
1010
|
get queuedPurgeTroubles() {
|
|
1001
|
-
return this.purgeTroubles.filter(
|
|
1011
|
+
return this.purgeTroubles.filter(ct);
|
|
1002
1012
|
}
|
|
1003
1013
|
get queuedPrimeTroubles() {
|
|
1004
|
-
return this.primeTroubles.filter(
|
|
1014
|
+
return this.primeTroubles.filter(ct);
|
|
1005
1015
|
}
|
|
1006
1016
|
get resolvablePrimeTroubles() {
|
|
1007
|
-
return this.primeTroubles.filter(
|
|
1017
|
+
return this.primeTroubles.filter(dt);
|
|
1008
1018
|
}
|
|
1009
1019
|
get resolvablePurgeTroubles() {
|
|
1010
|
-
return this.purgeTroubles.filter(
|
|
1020
|
+
return this.purgeTroubles.filter(dt);
|
|
1011
1021
|
}
|
|
1012
1022
|
get hasResolvablePurgeTroubles() {
|
|
1013
1023
|
return this.resolvablePurgeTroubles.length > 0;
|
|
@@ -1022,7 +1032,7 @@ let L = class {
|
|
|
1022
1032
|
return this.primeTroubles.length > 0;
|
|
1023
1033
|
}
|
|
1024
1034
|
get purgeTroubles() {
|
|
1025
|
-
return this.troublesByType[
|
|
1035
|
+
return this.troublesByType[it] || [];
|
|
1026
1036
|
}
|
|
1027
1037
|
get primeTroubles() {
|
|
1028
1038
|
return this.troublesByType[Io] || [];
|
|
@@ -1033,7 +1043,7 @@ let L = class {
|
|
|
1033
1043
|
async resolveAllTroubles(e, t) {
|
|
1034
1044
|
if (!t)
|
|
1035
1045
|
throw new Error("No tracker provided");
|
|
1036
|
-
const o = e ===
|
|
1046
|
+
const o = e === it ? this.purgeTroubles : this.primeTroubles;
|
|
1037
1047
|
o.filter((a) => a.shouldDefer).forEach((a) => {
|
|
1038
1048
|
this.logger.info(`Deferring trouble ${a.rawId}`), a.defer();
|
|
1039
1049
|
});
|
|
@@ -1065,7 +1075,7 @@ Ee([
|
|
|
1065
1075
|
L = Ee([
|
|
1066
1076
|
l(z)
|
|
1067
1077
|
], L);
|
|
1068
|
-
const
|
|
1078
|
+
const Ze = {
|
|
1069
1079
|
registration: {
|
|
1070
1080
|
[z]: {
|
|
1071
1081
|
class: L,
|
|
@@ -1219,8 +1229,8 @@ const jr = {
|
|
|
1219
1229
|
}, Symbol.toStringTag, { value: "Module" })), ei = (e) => e.toLowerCase().includes("micros"), ti = (e) => !e.toLowerCase().includes("micros"), oi = (e) => (t) => {
|
|
1220
1230
|
const o = e == null ? void 0 : e.getHoldersByGroup(t);
|
|
1221
1231
|
return o ? o.map((s) => ({ id: s.id, name: s.ingredientName, path: s.path })) : null;
|
|
1222
|
-
}, ri = ["water", "carb", "ns", "nss"],
|
|
1223
|
-
Oo(
|
|
1232
|
+
}, ri = ["water", "carb", "ns", "nss"], se = "dashboardKeyFactory", De = [];
|
|
1233
|
+
Oo(se, {
|
|
1224
1234
|
register: (e, t) => {
|
|
1225
1235
|
De.includes(t) || De.push(t);
|
|
1226
1236
|
},
|
|
@@ -1234,12 +1244,12 @@ Oo(re, {
|
|
|
1234
1244
|
}
|
|
1235
1245
|
});
|
|
1236
1246
|
const Vr = (e) => {
|
|
1237
|
-
Oe[
|
|
1238
|
-
|
|
1247
|
+
Oe[se].register(
|
|
1248
|
+
se,
|
|
1239
1249
|
e
|
|
1240
1250
|
);
|
|
1241
|
-
}, Hr = (e) => Oe[
|
|
1242
|
-
|
|
1251
|
+
}, Hr = (e) => Oe[se].execute(
|
|
1252
|
+
se,
|
|
1243
1253
|
e
|
|
1244
1254
|
);
|
|
1245
1255
|
Oe.registerDashboardKeyFactory = Vr;
|
|
@@ -1248,9 +1258,9 @@ const Ue = 3600, Ht = 60, si = (e) => {
|
|
|
1248
1258
|
const t = Math.floor(e / Ue), o = Math.floor(e % Ue / Ht);
|
|
1249
1259
|
return { hours: t, minutes: o };
|
|
1250
1260
|
}, ii = (e, t) => e * Ue + t * Ht, Br = (e) => {
|
|
1251
|
-
const o = (/* @__PURE__ */ new Date()).valueOf() - e.valueOf(), s = Math.floor(o / (1e3 * 60)), r = Math.floor(s / 60), n = Math.floor(r / 24), a = s % 60,
|
|
1252
|
-
let
|
|
1253
|
-
return n > 0 && (
|
|
1261
|
+
const o = (/* @__PURE__ */ new Date()).valueOf() - e.valueOf(), s = Math.floor(o / (1e3 * 60)), r = Math.floor(s / 60), n = Math.floor(r / 24), a = s % 60, le = r % 24;
|
|
1262
|
+
let de = "";
|
|
1263
|
+
return n > 0 && (de += `${n} day${n > 1 ? "s" : ""} `), le > 0 && (de += `${le} hour${le > 1 ? "s" : ""} `), (a > 0 || n === 0 && le === 0) && (de += `${a} minute${a > 1 ? "s" : ""} `), de;
|
|
1254
1264
|
};
|
|
1255
1265
|
var Kr = Object.defineProperty, Yr = Object.getOwnPropertyDescriptor, Le = (e, t, o, s) => {
|
|
1256
1266
|
for (var r = s > 1 ? void 0 : s ? Yr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
@@ -1265,7 +1275,7 @@ let C = class {
|
|
|
1265
1275
|
i(this, "dashboardOperationModel");
|
|
1266
1276
|
i(this, "appModel");
|
|
1267
1277
|
i(this, "logger");
|
|
1268
|
-
this.id = e, this.logger = o.logger, this.dashboardOperationModel =
|
|
1278
|
+
this.id = e, this.logger = o.logger, this.dashboardOperationModel = Ze.factory({});
|
|
1269
1279
|
}
|
|
1270
1280
|
get highPriorityHolders() {
|
|
1271
1281
|
return this.assemblyModel.allHolders.filter(
|
|
@@ -1303,10 +1313,10 @@ Le([
|
|
|
1303
1313
|
p({ modelType: Se.type })
|
|
1304
1314
|
], C.prototype, "assemblyModel", 2);
|
|
1305
1315
|
Le([
|
|
1306
|
-
p({ modelType:
|
|
1316
|
+
p({ modelType: Ze.type })
|
|
1307
1317
|
], C.prototype, "dashboardOperationModel", 2);
|
|
1308
1318
|
Le([
|
|
1309
|
-
p({ modelType:
|
|
1319
|
+
p({ modelType: Je.type })
|
|
1310
1320
|
], C.prototype, "appModel", 2);
|
|
1311
1321
|
C = Le([
|
|
1312
1322
|
l(K)
|
|
@@ -1323,16 +1333,16 @@ const Gr = {
|
|
|
1323
1333
|
factory: c.Factory.create(
|
|
1324
1334
|
K
|
|
1325
1335
|
)
|
|
1326
|
-
}, { URL:
|
|
1327
|
-
basePath: `${
|
|
1336
|
+
}, { URL: et } = h("LOCKOUT_SERVICE"), { postModel: Bt } = y.build({
|
|
1337
|
+
basePath: `${et}/api/app/kosdev.ddk/lockout`
|
|
1328
1338
|
}), Kt = g.createLogger({ name: "lockout-service", group: "Services" }), qr = async () => (Kt.info("lock"), await Bt({
|
|
1329
1339
|
model: {},
|
|
1330
|
-
urlOverride: `${
|
|
1340
|
+
urlOverride: `${et}/api/app/kosdev.ddk/lockout/lockNow`
|
|
1331
1341
|
})), Yt = async (e) => {
|
|
1332
1342
|
Kt.info("unlock");
|
|
1333
1343
|
const t = await Bt({
|
|
1334
1344
|
model: {},
|
|
1335
|
-
urlOverride: `${
|
|
1345
|
+
urlOverride: `${et}/api/app/kosdev.ddk/lockout/unlock/${e}`
|
|
1336
1346
|
});
|
|
1337
1347
|
return t == null ? void 0 : t.data;
|
|
1338
1348
|
}, ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -1482,7 +1492,7 @@ var es = Object.defineProperty, ts = Object.getOwnPropertyDescriptor, Ce = (e, t
|
|
|
1482
1492
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
1483
1493
|
return s && r && es(t, o, r), r;
|
|
1484
1494
|
};
|
|
1485
|
-
const Y = "macro-assignment-model",
|
|
1495
|
+
const Y = "macro-assignment-model", ut = "PurgeTrouble", os = "PrimeTrouble";
|
|
1486
1496
|
let k = class {
|
|
1487
1497
|
constructor(e, t, o) {
|
|
1488
1498
|
i(this, "id");
|
|
@@ -1523,7 +1533,7 @@ let k = class {
|
|
|
1523
1533
|
*/
|
|
1524
1534
|
get holderPurgeTroubles() {
|
|
1525
1535
|
return this.macroHolders.reduce((t, o) => {
|
|
1526
|
-
const s = o.troublesByType[
|
|
1536
|
+
const s = o.troublesByType[ut] || [];
|
|
1527
1537
|
return t = [...t, ...s], t;
|
|
1528
1538
|
}, []);
|
|
1529
1539
|
}
|
|
@@ -1565,7 +1575,7 @@ let k = class {
|
|
|
1565
1575
|
async resolveAll(e, t) {
|
|
1566
1576
|
if (!t)
|
|
1567
1577
|
throw new Error("No tracker provided");
|
|
1568
|
-
const s = (e ===
|
|
1578
|
+
const s = (e === ut ? this.holderPurgeTroubles : this.holderPrimeTroubles).map((n) => n.rawId);
|
|
1569
1579
|
return await Zr(s, t);
|
|
1570
1580
|
}
|
|
1571
1581
|
};
|
|
@@ -1662,13 +1672,13 @@ const qt = {
|
|
|
1662
1672
|
getTestsReports: Jt,
|
|
1663
1673
|
performGroupTest: Zt
|
|
1664
1674
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1665
|
-
var ls = Object.defineProperty, ds = Object.getOwnPropertyDescriptor,
|
|
1675
|
+
var ls = Object.defineProperty, ds = Object.getOwnPropertyDescriptor, tt = (e, t, o, s) => {
|
|
1666
1676
|
for (var r = s > 1 ? void 0 : s ? ds(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
1667
1677
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
1668
1678
|
return s && r && ls(t, o, r), r;
|
|
1669
1679
|
};
|
|
1670
1680
|
const q = "network-test-container-model";
|
|
1671
|
-
let
|
|
1681
|
+
let ie = class {
|
|
1672
1682
|
constructor(e, t, o) {
|
|
1673
1683
|
i(this, "id");
|
|
1674
1684
|
i(this, "logger");
|
|
@@ -1757,19 +1767,19 @@ let se = class {
|
|
|
1757
1767
|
});
|
|
1758
1768
|
}
|
|
1759
1769
|
};
|
|
1760
|
-
|
|
1770
|
+
tt([
|
|
1761
1771
|
$e
|
|
1762
|
-
],
|
|
1763
|
-
|
|
1772
|
+
], ie.prototype, "models", 2);
|
|
1773
|
+
tt([
|
|
1764
1774
|
P()
|
|
1765
|
-
],
|
|
1766
|
-
|
|
1775
|
+
], ie.prototype, "performTest", 1);
|
|
1776
|
+
ie = tt([
|
|
1767
1777
|
l(q)
|
|
1768
|
-
],
|
|
1778
|
+
], ie);
|
|
1769
1779
|
const cs = {
|
|
1770
1780
|
registration: {
|
|
1771
1781
|
[q]: {
|
|
1772
|
-
class:
|
|
1782
|
+
class: ie,
|
|
1773
1783
|
singleton: !0
|
|
1774
1784
|
},
|
|
1775
1785
|
...qt.registration
|
|
@@ -1778,13 +1788,13 @@ const cs = {
|
|
|
1778
1788
|
predicate: u(q),
|
|
1779
1789
|
factory: c.Singleton.create(q)
|
|
1780
1790
|
};
|
|
1781
|
-
var us = Object.defineProperty, ps = Object.getOwnPropertyDescriptor,
|
|
1791
|
+
var us = Object.defineProperty, ps = Object.getOwnPropertyDescriptor, ot = (e, t, o, s) => {
|
|
1782
1792
|
for (var r = s > 1 ? void 0 : s ? ps(t, o) : t, n = e.length - 1, a; n >= 0; n--)
|
|
1783
1793
|
(a = e[n]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
1784
1794
|
return s && r && us(t, o, r), r;
|
|
1785
1795
|
};
|
|
1786
|
-
const Q = "nutritive-sweetener-model", gs =
|
|
1787
|
-
let
|
|
1796
|
+
const Q = "nutritive-sweetener-model", gs = pt("statePath");
|
|
1797
|
+
let ne = class {
|
|
1788
1798
|
constructor(e, t) {
|
|
1789
1799
|
i(this, "id");
|
|
1790
1800
|
i(this, "assemblyModel");
|
|
@@ -1807,22 +1817,22 @@ let ie = class {
|
|
|
1807
1817
|
return this.pump;
|
|
1808
1818
|
}
|
|
1809
1819
|
};
|
|
1810
|
-
|
|
1820
|
+
ot([
|
|
1811
1821
|
p({ modelType: Se.type })
|
|
1812
|
-
],
|
|
1813
|
-
|
|
1822
|
+
], ne.prototype, "assemblyModel", 2);
|
|
1823
|
+
ot([
|
|
1814
1824
|
wo({
|
|
1815
1825
|
path: gs
|
|
1816
1826
|
})
|
|
1817
|
-
],
|
|
1818
|
-
|
|
1827
|
+
], ne.prototype, "pumpState", 2);
|
|
1828
|
+
ne = ot([
|
|
1819
1829
|
l(Q),
|
|
1820
|
-
|
|
1821
|
-
],
|
|
1830
|
+
ht()
|
|
1831
|
+
], ne);
|
|
1822
1832
|
const hs = {
|
|
1823
1833
|
registration: {
|
|
1824
1834
|
[Q]: {
|
|
1825
|
-
class:
|
|
1835
|
+
class: ne,
|
|
1826
1836
|
singleton: !1
|
|
1827
1837
|
}
|
|
1828
1838
|
},
|
|
@@ -1849,7 +1859,7 @@ let ve = class {
|
|
|
1849
1859
|
getPump() {
|
|
1850
1860
|
var s, r;
|
|
1851
1861
|
const e = this.getHolder(), t = (r = (s = e == null ? void 0 : e.pumps) == null ? void 0 : s.data) == null ? void 0 : r[0];
|
|
1852
|
-
return Be(t,
|
|
1862
|
+
return Be(t, vt.type);
|
|
1853
1863
|
}
|
|
1854
1864
|
// -------------------LIFECYCLE----------------------------
|
|
1855
1865
|
async init() {
|
|
@@ -2115,8 +2125,8 @@ const io = {
|
|
|
2115
2125
|
type: ee,
|
|
2116
2126
|
predicate: u(ee),
|
|
2117
2127
|
factory: c.Factory.create(ee)
|
|
2118
|
-
}, { URL:
|
|
2119
|
-
basePath: `${
|
|
2128
|
+
}, { URL: pe } = h("UTILITIES_SERVICE"), { getAll: Ie } = y.build({
|
|
2129
|
+
basePath: `${pe}/api/utilities`
|
|
2120
2130
|
}), Re = g.createLogger({
|
|
2121
2131
|
name: "utilities-service",
|
|
2122
2132
|
group: "Services"
|
|
@@ -2124,12 +2134,12 @@ const io = {
|
|
|
2124
2134
|
Re.debug("sending GET for utilities");
|
|
2125
2135
|
try {
|
|
2126
2136
|
const e = await Ie({
|
|
2127
|
-
urlOverride: `${
|
|
2137
|
+
urlOverride: `${pe}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`
|
|
2128
2138
|
});
|
|
2129
2139
|
if ((e == null ? void 0 : e.status) !== 200) {
|
|
2130
2140
|
Re.info("no extensions found, using base data");
|
|
2131
2141
|
const t = await Ie({
|
|
2132
|
-
urlOverride: `${
|
|
2142
|
+
urlOverride: `${pe}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2133
2143
|
});
|
|
2134
2144
|
return (t == null ? void 0 : t.data) ?? [];
|
|
2135
2145
|
}
|
|
@@ -2137,7 +2147,7 @@ const io = {
|
|
|
2137
2147
|
} catch (e) {
|
|
2138
2148
|
Re.info(`error fetching utilities: ${e}. Using base data`);
|
|
2139
2149
|
const t = await Ie({
|
|
2140
|
-
urlOverride: `${
|
|
2150
|
+
urlOverride: `${pe}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2141
2151
|
});
|
|
2142
2152
|
return (t == null ? void 0 : t.data) ?? [];
|
|
2143
2153
|
}
|
|
@@ -2221,10 +2231,10 @@ const Is = {
|
|
|
2221
2231
|
factory: c.Singleton.create(te)
|
|
2222
2232
|
}, pi = {
|
|
2223
2233
|
...ir.registration,
|
|
2224
|
-
...
|
|
2234
|
+
...Je.registration,
|
|
2225
2235
|
...qe.registration,
|
|
2226
2236
|
...pr.registration,
|
|
2227
|
-
...
|
|
2237
|
+
...Ze.registration,
|
|
2228
2238
|
...Pr.registration,
|
|
2229
2239
|
...kr.registration,
|
|
2230
2240
|
...jr.registration,
|
|
@@ -2362,21 +2372,21 @@ export {
|
|
|
2362
2372
|
Ks as AgitationControl,
|
|
2363
2373
|
ir as Animation,
|
|
2364
2374
|
Ys as AnimationServices,
|
|
2365
|
-
|
|
2375
|
+
Je as Application,
|
|
2366
2376
|
qe as Auth,
|
|
2367
2377
|
Hs as AuthServices,
|
|
2368
2378
|
pr as CarbWater,
|
|
2369
2379
|
qs as CopyLogs,
|
|
2370
2380
|
Gs as CopyLogsServices,
|
|
2371
2381
|
pi as DDKModels,
|
|
2372
|
-
|
|
2382
|
+
Ze as DashboardOperations,
|
|
2373
2383
|
Qs as DashboardOperationsServices,
|
|
2374
2384
|
Pr as Dispenser,
|
|
2375
2385
|
kr as DispenserInfo,
|
|
2376
2386
|
Js as DispenserInfoServices,
|
|
2377
2387
|
Xs as DispenserServices,
|
|
2378
2388
|
No as Door,
|
|
2379
|
-
|
|
2389
|
+
se as EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
2380
2390
|
jr as Enrollment,
|
|
2381
2391
|
Zs as EnrollmentServices,
|
|
2382
2392
|
Gr as IngredientSummary,
|
|
@@ -2399,7 +2409,7 @@ export {
|
|
|
2399
2409
|
yi as Start,
|
|
2400
2410
|
hi as StartServices,
|
|
2401
2411
|
Io as TROUBLE_TYPE_PRIME,
|
|
2402
|
-
|
|
2412
|
+
it as TROUBLE_TYPE_PURGE,
|
|
2403
2413
|
gi as TroubleActionManager,
|
|
2404
2414
|
io as Utilities,
|
|
2405
2415
|
Is as UtilitiesContainer,
|
package/lib/door/door-model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DoorOptions } from './types';
|
|
2
|
-
import { IKosDataModel, IKosIdentifiable, KosCreationContext, PublicModelInterface } from '../../../../../sdk/kos-ui-sdk/src/index.ts';
|
|
2
|
+
import { IKosDataModel, IKosIdentifiable, KosConfigProperty, KosCreationContext, PublicModelInterface } from '../../../../../sdk/kos-ui-sdk/src/index.ts';
|
|
3
3
|
|
|
4
4
|
export declare const MODEL_TYPE = "door-model";
|
|
5
5
|
export type DoorModel = PublicModelInterface<DoorModelImpl>;
|
|
@@ -13,6 +13,7 @@ export declare class DoorModelImpl implements IKosDataModel, IKosIdentifiable {
|
|
|
13
13
|
private logger;
|
|
14
14
|
readonly doorPath: string;
|
|
15
15
|
private open;
|
|
16
|
+
ignoreDoor: KosConfigProperty<boolean>;
|
|
16
17
|
constructor(modelId: string, options: DoorOptions, context: KosCreationContext);
|
|
17
18
|
get currentState(): DoorState;
|
|
18
19
|
get isOpen(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"door-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/door/door-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"door-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/door/door-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAElB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;AAI5D,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AACD,qBACa,aAAc,YAAW,aAAa,EAAE,gBAAgB;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAG1B,OAAO,CAAC,IAAI,CAAyB;IAMrC,UAAU,EAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAGtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,kBAAkB;IAQ7B,IAAI,YAAY,IAAI,SAAS,CAM5B;IAED,IAAI,MAAM,IAAI,OAAO,CAWpB;CACF"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ddk-models",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.5170",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.
|
|
6
|
-
"@kosdev-code/kos-dispense-sdk": "0.1.0-dev.
|
|
7
|
-
"@kosdev-code/kos-freestyle-sdk": "0.1.0-dev.
|
|
5
|
+
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.5170",
|
|
6
|
+
"@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5170",
|
|
7
|
+
"@kosdev-code/kos-freestyle-sdk": "0.1.0-dev.5170"
|
|
8
8
|
},
|
|
9
9
|
"main": "./index.js",
|
|
10
10
|
"module": "./index.mjs",
|
|
11
11
|
"typings": "./index.d.ts",
|
|
12
12
|
"kos": {
|
|
13
13
|
"build": {
|
|
14
|
-
"gitHash": "
|
|
14
|
+
"gitHash": "d43cb137cc7c4fa1e215474491d3c4119e2442f6"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|