@kosdev-code/kos-ddk-models 0.1.0-dev.5092 → 0.1.0-dev.5097

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.
Files changed (47) hide show
  1. package/index.d.ts +0 -4
  2. package/index.d.ts.map +1 -1
  3. package/index.js +1 -1
  4. package/index.mjs +1211 -1699
  5. package/lib/carb-water/carb-water-model.d.ts +1 -2
  6. package/lib/carb-water/carb-water-model.d.ts.map +1 -1
  7. package/lib/plain-water/plain-water-model.d.ts +1 -2
  8. package/lib/plain-water/plain-water-model.d.ts.map +1 -1
  9. package/package.json +5 -5
  10. package/lib/cgp-pump/cgp-pump-model.d.ts +0 -25
  11. package/lib/cgp-pump/cgp-pump-model.d.ts.map +0 -1
  12. package/lib/cgp-pump/index.d.ts +0 -4
  13. package/lib/cgp-pump/index.d.ts.map +0 -1
  14. package/lib/cgp-pump/types/index.d.ts +0 -5
  15. package/lib/fcm-pump/fcm-pump-model.d.ts +0 -28
  16. package/lib/fcm-pump/fcm-pump-model.d.ts.map +0 -1
  17. package/lib/fcm-pump/fcm-pump-registration.d.ts +0 -87
  18. package/lib/fcm-pump/fcm-pump-registration.d.ts.map +0 -1
  19. package/lib/fcm-pump/index.d.ts +0 -5
  20. package/lib/fcm-pump/index.d.ts.map +0 -1
  21. package/lib/fcm-pump/services/fcm-pump-services.d.ts +0 -17
  22. package/lib/fcm-pump/services/fcm-pump-services.d.ts.map +0 -1
  23. package/lib/fcm-pump/services/index.d.ts +0 -2
  24. package/lib/fcm-pump/services/index.d.ts.map +0 -1
  25. package/lib/fcm-pump/types/index.d.ts +0 -5
  26. package/lib/lfcv-pump/index.d.ts +0 -5
  27. package/lib/lfcv-pump/index.d.ts.map +0 -1
  28. package/lib/lfcv-pump/lfcv-pump-model.d.ts +0 -20
  29. package/lib/lfcv-pump/lfcv-pump-model.d.ts.map +0 -1
  30. package/lib/lfcv-pump/lfcv-pump-registration.d.ts +0 -87
  31. package/lib/lfcv-pump/lfcv-pump-registration.d.ts.map +0 -1
  32. package/lib/lfcv-pump/services/index.d.ts +0 -2
  33. package/lib/lfcv-pump/services/index.d.ts.map +0 -1
  34. package/lib/lfcv-pump/services/lfcv-pump-services.d.ts +0 -10
  35. package/lib/lfcv-pump/services/lfcv-pump-services.d.ts.map +0 -1
  36. package/lib/lfcv-pump/types/index.d.ts +0 -5
  37. package/lib/spm-pump/index.d.ts +0 -5
  38. package/lib/spm-pump/index.d.ts.map +0 -1
  39. package/lib/spm-pump/services/index.d.ts +0 -2
  40. package/lib/spm-pump/services/index.d.ts.map +0 -1
  41. package/lib/spm-pump/services/spm-pump-services.d.ts +0 -7
  42. package/lib/spm-pump/services/spm-pump-services.d.ts.map +0 -1
  43. package/lib/spm-pump/spm-pump-model.d.ts +0 -26
  44. package/lib/spm-pump/spm-pump-model.d.ts.map +0 -1
  45. package/lib/spm-pump/spm-pump-registration.d.ts +0 -87
  46. package/lib/spm-pump/spm-pump-registration.d.ts.map +0 -1
  47. package/lib/spm-pump/types/index.d.ts +0 -5
package/index.d.ts CHANGED
@@ -4,16 +4,13 @@ export * from './lib/animation';
4
4
  export * from './lib/application';
5
5
  export * from './lib/auth';
6
6
  export * from './lib/carb-water';
7
- export * from './lib/cgp-pump';
8
7
  export * from './lib/copy-logs';
9
8
  export * from './lib/dashboard-operations';
10
9
  export * from './lib/dispenser';
11
10
  export * from './lib/dispenser-info';
12
11
  export * from './lib/door';
13
12
  export * from './lib/enrollment';
14
- export * from './lib/fcm-pump';
15
13
  export * from './lib/ingredient-summary';
16
- export * from './lib/lfcv-pump';
17
14
  export * from './lib/lockout';
18
15
  export * from './lib/macro-assignment';
19
16
  export * from './lib/network-test';
@@ -23,7 +20,6 @@ export * from './lib/reboot';
23
20
  export * from './lib/registration';
24
21
  export * from './lib/settings';
25
22
  export * from './lib/setup-step';
26
- export * from './lib/spm-pump';
27
23
  export * from './lib/trouble-action';
28
24
  export * from './lib/utilities';
29
25
  export * from './lib/utils';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/ddk/kos-ddk-models/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/ddk/kos-ddk-models/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Ir=Object.defineProperty;var Ar=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var a=(e,t,r)=>(Ar(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@kosdev-code/kos-ui-sdk"),ae=require("@kosdev-code/kos-freestyle-sdk"),L=require("@kosdev-code/kos-dispense-sdk"),Ke="PurgeTrouble",pt="PrimeTrouble",{URL:Ye}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:Kr,postModel:xr}=s.ServiceFactory.build({basePath:`${Ye}/api/auth`}),gt=s.KosLog.createLogger({name:"auth-service",group:"Services"}),ht=async()=>(gt.debug("sending GET for auth"),await Kr({urlOverride:`${Ye}/api/app/kosdev.ddk/auth/role`})),ft=async e=>(gt.debug("sending POST for auth"),await xr({urlOverride:`${Ye}/api/app/kosdev.ddk/auth/pincode/${e}`,model:{}})),Ur=Object.freeze(Object.defineProperty({__proto__:null,getCurrentRole:ht,sendPinCode:ft},Symbol.toStringTag,{value:"Module"}));var jr=Object.defineProperty,Vr=Object.getOwnPropertyDescriptor,mt=(e,t,r,i)=>{for(var o=i>1?void 0:i?Vr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&jr(t,r,o),o};const K="auth-model",at=e=>e.toLowerCase();let ge=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"currentRole");this.id=e,this.logger=r.logger,this.currentRole="crew"}async authorize(e){if(!e)return!1;const t=await ft(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 ht();(e==null?void 0:e.status)===200&&(this.logger.debug(`response ${e.data}`),s.kosAction(()=>{this.currentRole=at(e.data)}))}handleRoleChange(e){this.currentRole=at(e)}forceRole(e){this.currentRole=e}};mt([s.kosTopicHandler({topic:"/app/kosdev.ddk/auth/role",websocket:!0})],ge.prototype,"handleRoleChange",1);ge=mt([s.kosModel(K)],ge);const Me={registration:{[K]:{class:ge,singleton:!1}},type:K,predicate:s.isKosModel(K),factory:s.Kos.Factory.create(K)};var Hr=Object.defineProperty,Wr=Object.getOwnPropertyDescriptor,yt=(e,t,r,i)=>{for(var o=i>1?void 0:i?Wr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Hr(t,r,o),o};const bt="door-model",Nr=s.createPropKey("doorPath");let he=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"doorPath");a(this,"open");this.id=e,this.logger=r.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}};yt([s.kosStateProp({path:Nr,attribute:"state"})],he.prototype,"open",2);he=yt([s.kosModel(bt)],he);const vt=new s.KosModelRegistrationFactory({class:he,type:bt}),{URL:qe}=s.resolveServiceUrl("SETUP-STEP_SERVICE"),{getAll:zr,postModel:Br}=s.ServiceFactory.build({basePath:`${qe}/api/setup-step`}),_t=s.KosLog.createLogger({name:"setup-step-service",group:"Services"}),Pt=async()=>(_t.debug("sending GET for setup-step"),await zr({urlOverride:`${qe}/api/app/kosdev.ddk/setup/steps`})),Mt=async e=>(_t.debug("sending POST for setup-step"),await Br({urlOverride:`${qe}/api/app/kosdev.ddk/setup/complete/${e}`,model:{}})),Yr=Object.freeze(Object.defineProperty({__proto__:null,getSetupSteps:Pt,markStepComplete:Mt},Symbol.toStringTag,{value:"Module"}));var qr=Object.getOwnPropertyDescriptor,Gr=(e,t,r,i)=>{for(var o=i>1?void 0:i?qr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const x="setup-step-model";let xe=class{constructor(e,t,r){a(this,"id");a(this,"idx");a(this,"name");a(this,"complete");a(this,"preStep");a(this,"exclusive");a(this,"logger");this.id=e,this.idx=t.idx,this.logger=r.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 Mt(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}`)}};xe=Gr([s.kosModel(x)],xe);const Ge={registration:{[x]:{class:xe,singleton:!1}},type:x,predicate:s.isKosModel(x),factory:s.Kos.Factory.create(x)};var Qr=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,Te=(e,t,r,i)=>{for(var o=i>1?void 0:i?Xr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Qr(t,r,o),o};const U="setup-step-container-model";function nt(e){return t=>{const r=Ge.factory(t.id)(t);r.updateModel(t),e.addModel(r)}}function lt(e){return t=>{e.removeModel(t)}}let $=class{constructor(e,t,r){a(this,"id");a(this,"_currentStep");a(this,"logger");a(this,"models");a(this,"authModel");this.id=e,this.logger=r.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(r=>r.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 Pt();if(e!=null&&e.data){const t=e.data.map((r,i)=>({...r,idx:i,id:`setup-${r.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:nt(this),onRemoveItem:lt(this)})(t)}this.nextStep()}handleStepChanges(e){const t=e.map((r,i)=>({...r,idx:i,id:`setup-${r.name}`}));s.resolveContainerDeltas({container:this.models,onAddItem:nt(this),onRemoveItem:lt(this)})(t)}};Te([s.kosChild],$.prototype,"models",2);Te([s.kosDependency({modelType:Me.type})],$.prototype,"authModel",2);Te([s.kosTopicHandler({topic:"/app/kosdev.ddk/setup/steps",websocket:!0})],$.prototype,"handleStepChanges",1);$=Te([s.kosModel(U)],$);const Qe={registration:{[U]:{class:$,singleton:!0},...Ge.registration},type:U,predicate:s.isKosModel(U),factory:s.Kos.Singleton.create(U)},{URL:P}=s.resolveServiceUrl("AUTH_SERVICE"),{getOne:Tt,getAll:de}=s.ServiceFactory.build({basePath:`${P}/api/app/kosdev.ddk/ncui/`}),oe=s.KosLog.createLogger({name:"auth-service",group:"Services"}),Jr=async()=>{oe.debug("sending GET for cuis");const e=await de({urlOverride:`${P}/api/app/kosdev.ddk/cui`});if((e==null?void 0:e.status)!==200)throw new Error("Failed to retrieve cuis");return e.data},Zr=async()=>{oe.debug("sending GET for navigation");try{const e=await de({urlOverride:`${P}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`});if((e==null?void 0:e.status)!==200){oe.info("no extensions found, using base data");const t=await de({urlOverride:`${P}/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 de({urlOverride:`${P}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}},eo=async()=>(oe.debug("navigating to CUI"),await Tt({urlOverride:`${P}/api/app/kosdev.ddk/cui/open`})),to=async()=>(oe.debug("navigating to NCUI"),await Tt({urlOverride:`${P}/api/app/kosdev.ddk/ncui/open`}));var ro=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,v=(e,t,r,i)=>{for(var o=i>1?void 0:i?oo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&ro(t,r,o),o};const j="application-model",$t=(e,t="")=>e.reduce((r,i)=>{const o=t?`${t}.${i.name}`:i.name;if(r[o]={...i,root:!t},i.children){const l=$t(i.children,o);Object.keys(l).forEach(n=>{r[n]=l[n]})}return r},{});let f=class{constructor(e,t,r){a(this,"id");a(this,"device");a(this,"authModel");a(this,"setupStepContainer");a(this,"door");a(this,"ncuiLanguage");a(this,"activeCui");a(this,"fallbackCui");a(this,"_cuis",[]);a(this,"_navigationItems",[]);a(this,"languages");a(this,"logger");this.id=e,this.languages=[],this._cuis=[],this.logger=r.logger,this.door=vt.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 $t(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 to()}async exit(){this.logger.info("navigating to CUI"),await eo()}async load(){var r,i;this.logger.debug(`loading application ${this.id}`);const e=await Zr();this._navigationItems=e;const t=await Jr();this._cuis=t,(r=this.setupStepContainer)!=null&&r.hasIncompletePreSteps&&((i=this.authModel)==null||i.forceRole("technician")),this.languages=[{name:"English",locale:"en"}]}};v([s.kosDependency({modelType:s.Device.type})],f.prototype,"device",2);v([s.kosDependency({modelType:Me.type})],f.prototype,"authModel",2);v([s.kosDependency({modelType:Qe.type})],f.prototype,"setupStepContainer",2);v([s.kosChild],f.prototype,"door",2);v([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],f.prototype,"ncuiLanguage",2);v([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"activeCui"})],f.prototype,"activeCui",2);v([s.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"fallbackCui"})],f.prototype,"fallbackCui",2);f=v([s.kosModel(j)],f);const $e={registration:{[j]:{class:f,singleton:!0}},type:j,predicate:s.isKosModel(j),factory:s.Kos.Singleton.create(j)},ue={none:999,crew:0,technician:1,manager:2},Xe=e=>t=>{if(t.type===ae.AGITATION_REQUIRED_TROUBLE)return!1;const r=(t==null?void 0:t.role)||"technician";if(e&&r){const i=ue[e.toLowerCase()]??ue.crew,o=ue[r.toLowerCase()]??ue.crew;return i>=o}return!1};var so=Object.defineProperty,io=Object.getOwnPropertyDescriptor,D=(e,t,r,i)=>{for(var o=i>1?void 0:i?io(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&so(t,r,o),o};const St="agitation-control-model",Ue="resolve",ao="agitate";let y=class{constructor(e,t,r){a(this,"id");a(this,"futureHandler");a(this,"logger");a(this,"troubleContainer");a(this,"_agitationFutureId");a(this,"_canExit",!0);a(this,"_exiting",!1);a(this,"_isFailed",!1);a(this,"disposer");a(this,"application");a(this,"inProgress",[]);this.id=e,this.logger=r.logger,this.troubleContainer=t.companionParent,this.futureHandler=new s.MultipleFutureHandler(this,Ue)}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),r=e>0&&t.length===0;return this.isDoorClosed&&r&&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(Xe(e)).filter(t=>t.type!==ae.AGITATION_REQUIRED_TROUBLE)}get future(){return this.futureHandler.future}get resolveFuture(){return this.futureHandler.getFuture(Ue)}get agitateFuture(){return this.futureHandler.getFuture(ao)}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}`)}};D([s.kosDependency({modelType:$e.type})],y.prototype,"application",2);D([s.kosFuture({alias:Ue})],y.prototype,"resolveDeferredTroubles",1);D([s.kosTopicHandler({topic:ae.CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED})],y.prototype,"handleAgitationStarted",1);D([s.kosTopicHandler({topic:ae.CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED})],y.prototype,"handleAgitationEnded",1);D([s.kosModelEffect({dependencies:e=>[e.readyToResolve,e._agitationFutureId]})],y.prototype,"handleReadyToResolve",1);y=D([s.kosModel(St)],y);const no=new s.SingletonKosModelRegistrationFactory({class:y,type:St});var lo=Object.defineProperty,co=Object.getOwnPropertyDescriptor,ne=(e,t,r,i)=>{for(var o=i>1?void 0:i?co(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&lo(t,r,o),o};const V="animation-model";let M=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"disableAll");a(this,"enableDial");a(this,"enableModal");a(this,"enableSideBar");this.id=e,this.logger=r.logger}};ne([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.disableAll"})],M.prototype,"disableAll",2);ne([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableDial"})],M.prototype,"enableDial",2);ne([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableModal"})],M.prototype,"enableModal",2);ne([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableSideBar"})],M.prototype,"enableSideBar",2);M=ne([s.kosModel(V)],M);const Ct={registration:{[V]:{class:M,singleton:!0}},type:V,predicate:s.isKosModel(V),factory:s.Kos.Singleton.create(V)},{URL:uo}=s.resolveServiceUrl("ANIMATION_SERVICE"),{getAll:po}=s.ServiceFactory.build({basePath:`${uo}/api/animation`}),go=s.KosLog.createLogger({name:"animation-service",group:"Services"}),ho=async()=>(go.debug("sending GET for animation"),await po({})),fo=Object.freeze(Object.defineProperty({__proto__:null,getAnimations:ho},Symbol.toStringTag,{value:"Module"})),{URL:F}=s.resolveServiceUrl("FCM-PUMP_SERVICE"),{postModel:le}=s.ServiceFactory.build({basePath:`${F}/api/fcm-pump`}),u=s.KosLog.createLogger({name:"fcm-pump-service",group:"Services"}),Ot=async e=>{var t,r,i,o,l;u.debug(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`);try{const n=await le({model:{},urlOverride:`${F}/api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`});return u.debug("performElectricalTest - response:",n),((n==null?void 0:n.status)===200||(n==null?void 0:n.status)===499)&&((t=n.data)!=null&&t.error)?[n.data.error||"unknownError",n.data]:[void 0,n==null?void 0:n.data]}catch(n){if(u.error(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`,n),n instanceof s.FetchError){const h=((i=(r=n.payload)==null?void 0:r.data)==null?void 0:i.error)||((o=n.payload)==null?void 0:o.error)||"unknownError";return[h,((l=n.payload)==null?void 0:l.data)||{error:h}]}}return["unknownError",{error:"unknownError"}]},kt=async(e,t)=>{u.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`);try{const r=await le({model:{},urlOverride:`${F}/api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,tracker:t});return u.debug("performPreCalibrate - response:",r),r!=null&&r.data&&s.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){u.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,r);const i={id:t||"",endState:s.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(i),i}},Et=async(e,t)=>{u.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`);try{const r=await le({model:{},urlOverride:`${F}/api/ext/freestyle/fcm/calibration/${e}/calibrate`,tracker:t});return u.debug("performPreCalibrate - response:",r),r!=null&&r.data&&s.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){u.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`,r);const i={id:t||"",endState:s.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(i),i}},wt=async(e,t,r)=>{u.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`);try{const i=await le({model:{},urlOverride:`${F}/api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,tracker:r});return u.debug("performVerify - response:",i),i!=null&&i.data&&s.FutureManager.initiateFuture(i.data),i==null?void 0:i.data}catch(i){u.error(`performVerify - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,i);const o={id:r||"",endState:s.FutureEndState.Fail,tracker:r,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(o),o}},mo=e=>e?e.data==="success"||!e.data?"success":e.data:"error",Lt=async(e,t,r)=>{u.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`);try{const i=await le({model:{},urlOverride:`${F}/api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`});return u.debug("performPreCalibrate - response:",i),mo(i==null?void 0:i.data)}catch(i){u.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`,i);return}},yo=Object.freeze(Object.defineProperty({__proto__:null,performCalibrate:Et,performComplete:Lt,performElectricalTest:Ot,performPreCalibrate:kt,performVerify:wt},Symbol.toStringTag,{value:"Module"}));var bo=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,Se=(e,t,r,i)=>{for(var o=i>1?void 0:i?vo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&bo(t,r,o),o};const Dt="fcm-pump-model",_o=s.KosLog.createLogger({name:"fcm-pump-model"});let S=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"pumpModel");a(this,"futureHandler");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent,this.futureHandler=new s.FutureHandler(this)}get future(){return this.futureHandler.future}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async performElectricalTest(){const[e,t]=await Ot(this.pumpModel.path);return e&&_o.error(`Failed to perform electrical test on pump ${this.id}`,e),t}getChildren(){return[...this.futureHandler.allFutures]}async performPreCalibrate(e){return kt(this.pumpModel.path,e)}async performCalibrate(e){return Et(this.pumpModel.path,e)}async performVerify(e,t){return wt(this.pumpModel.path,e,t)}async performComplete(e,t){return Lt(this.pumpModel.path,e,t)}async init(){this.logger.debug(`initializing fcm-pump ${this.id}`)}async load(){this.logger.debug(`loading fcm-pump ${this.id}`)}};Se([s.kosFuture()],S.prototype,"performPreCalibrate",1);Se([s.kosFuture()],S.prototype,"performCalibrate",1);Se([s.kosFuture()],S.prototype,"performVerify",1);S=Se([s.kosModel(Dt)],S);const Je=new s.KosModelRegistrationFactory({class:S,type:Dt});var Po=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,Ft=(e,t,r,i)=>{for(var o=i>1?void 0:i?Mo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Po(t,r,o),o};const H="carb-water-model";let fe=class{constructor(e,t,r){a(this,"id");a(this,"assemblyModel");a(this,"logger");this.id=e,this.logger=r.logger}getPump(){const t=this.assemblyModel.getHoldersByGroup("carb")[0].pumps.data[0];return s.getKosCompanionModel(t,Je.type)}async init(){this.logger.debug(`initializing carb-water ${this.id}`)}async load(){this.logger.debug(`loading carb-water ${this.id}`)}};Ft([s.kosDependency({modelType:L.Assembly.type})],fe.prototype,"assemblyModel",2);fe=Ft([s.kosModel(H)],fe);const Rt={registration:{[H]:{class:fe,singleton:!1}},type:H,predicate:s.isKosModel(H),factory:s.Kos.Factory.create(H)};var It=Object.defineProperty,To=Object.getOwnPropertyDescriptor,$o=(e,t,r)=>t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ce=(e,t,r,i)=>{for(var o=i>1?void 0:i?To(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&It(t,r,o),o},So=(e,t,r)=>($o(e,t+"",r),r);const Co="cgp-pump-model",Ze=s.createPropKey("statePath");let T=class{constructor(e,t){a(this,"highProbeWet");a(this,"lowProbeWet");a(this,"filling");a(this,"id");a(this,"state");a(this,"parent");var r;this.id=e,this.parent=t.companionParent,this.state=((r=t.data)==null?void 0:r.state)??{name:"unknown",path:""}}get statePath(){return this.state.path}};So(T,"Registration");Ce([s.kosStateProp({path:Ze,attribute:"highProbeWet"})],T.prototype,"highProbeWet",2);Ce([s.kosStateProp({path:Ze,attribute:"lowProbeWet"})],T.prototype,"lowProbeWet",2);Ce([s.kosStateProp({path:Ze,attribute:"filling"})],T.prototype,"filling",2);T=Ce([s.kosModel({modelTypeId:Co,singleton:!1}),s.kosParentAware(),s.kosLoggerAware()],T);const Oo=T.Registration,{URL:R}=s.resolveServiceUrl("COPY-LOGS_SERVICE"),{getAll:ko,getOne:Eo,postModel:At,deleteModel:wo}=s.ServiceFactory.build({basePath:`${R}/api/copy-logs`}),me=s.KosLog.createLogger({name:"copy-logs-service",group:"Services"}),Kt=async(e,t)=>{const r=await wo({tracker:t,id:e,urlOverride:`${R}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data},xt=async(e,t)=>{const r=await At({model:{},tracker:t,urlOverride:`${R}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${e}`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data},Ut=async(e,t)=>{const r=await At({model:{},tracker:t,urlOverride:`${R}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data},jt=async()=>{me.debug("sending GET for copy-logs");try{const e=await ko({urlOverride:`${R}/api/app/kosdev.ddk/copyLogs/volumes/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return me.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},Vt=async()=>{me.debug("sending GET for log file size");try{const e=await Eo({urlOverride:`${R}/api/app/kosdev.ddk/copyLogs/files/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof s.FetchError)return me.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},Lo=Object.freeze(Object.defineProperty({__proto__:null,copyLogFromVolume:Ut,eraseAndCopyLogsToVolume:xt,eraseVolume:Kt,getLogFileSize:Vt,getVolumes:jt},Symbol.toStringTag,{value:"Module"}));var Ht=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Fo=(e,t,r)=>t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I=(e,t,r,i)=>{for(var o=i>1?void 0:i?Do(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Ht(t,r,o),o},Ro=(e,t,r)=>(Fo(e,t+"",r),r);const Io="copy-logs-model";let m=class{constructor(e){a(this,"id");a(this,"_volumes");a(this,"storageDeviceContainer");a(this,"_activeVolume");a(this,"_logFileSize",0);a(this,"_actionState","idle");a(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}`),xt(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}`),Kt(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}`),Ut(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 jt(),[r,i]=await Vt();if(r){this.logger.error(`Error fetching log file size: ${r}`);return}if(e){this.logger.error(`Error fetching volumes: ${e}`);return}t&&(t.forEach(o=>{const l=this.storageDeviceContainer.getModel(o.id);if(l){const n={id:o.id,name:l.label,freeBytes:o.info.freeBytes,totalBytes:o.info.totalBytes};this._volumes.addModel(n)}}),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}`)}};Ro(m,"Registration");I([s.kosDependency({modelType:s.StorageDeviceContainer.type})],m.prototype,"storageDeviceContainer",2);I([s.kosFuture()],m.prototype,"eraseAndCopyVolume",1);I([s.kosFuture()],m.prototype,"eraseVolume",1);I([s.kosFuture()],m.prototype,"copyLogs",1);I([s.kosModelEffect({dependencies:e=>[e.inserted]})],m.prototype,"handleInsertion",1);m=I([s.kosModel({modelTypeId:Io,singleton:!0}),s.kosFutureAware(),s.kosLoggerAware()],m);const Ao=m.Registration,Wt=s.KosLog.createLogger({name:"dashboard-operations-service",group:"Services"}),Nt=async(e,t)=>(Wt.debug("resolveAll"),await s.TroubleServices.bulkResolveTroubles(e,void 0,t)),zt=async(e,t)=>(Wt.debug("resolveTrouble"),await s.TroubleServices.resolveTrouble(e,void 0,t)),Ko=Object.freeze(Object.defineProperty({__proto__:null,resolveAll:Nt,resolveTrouble:zt},Symbol.toStringTag,{value:"Module"}));var xo=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,Oe=(e,t,r,i)=>{for(var o=i>1?void 0:i?Uo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&xo(t,r,o),o};const W="dashboard-operations-model";function ct(e){return!e.deferred}function ut(e){return e.deferred}let C=class{constructor(e,t,r){a(this,"id");a(this,"troubles");a(this,"futureHandler");a(this,"logger");this.id=e,this.futureHandler=new s.FutureHandler(this),this.logger=r.logger}get troublesByType(){return this.troubles.troubles.data.reduce(s.troubleByTypeReducer,{})}get queuedPurgeTroubles(){return this.purgeTroubles.filter(ut)}get queuedPrimeTroubles(){return this.primeTroubles.filter(ut)}get resolvablePrimeTroubles(){return this.primeTroubles.filter(ct)}get resolvablePurgeTroubles(){return this.purgeTroubles.filter(ct)}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[pt]||[]}get future(){return this.futureHandler.getFuture()}async resolveAllTroubles(e,t){if(!t)throw new Error("No tracker provided");const r=e===Ke?this.purgeTroubles:this.primeTroubles;r.filter(n=>n.shouldDefer).forEach(n=>{this.logger.info(`Deferring trouble ${n.rawId}`),n.defer()});const o=r.filter(n=>!n.shouldDefer).map(n=>n.rawId);return o.length===0?void 0:await Nt(o,t)}async resolveTrouble(e,t){if(!t)throw new Error("No tracker provided");return await zt(e,t)}async init(){this.logger.debug(`initializing dashboard-operations ${this.id}`)}async load(){this.logger.debug(`loading dashboard-operations ${this.id}`)}};Oe([s.kosDependency({modelType:s.TroubleContainer.type})],C.prototype,"troubles",2);Oe([s.kosFuture()],C.prototype,"resolveAllTroubles",1);Oe([s.kosFuture()],C.prototype,"resolveTrouble",1);C=Oe([s.kosModel(W)],C);const ke={registration:{[W]:{class:C,singleton:!0}},type:W,predicate:s.isKosModel(W),factory:s.Kos.Singleton.create(W)};var jo=Object.getOwnPropertyDescriptor,Vo=(e,t,r,i)=>{for(var o=i>1?void 0:i?jo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const N="dispenser-model";let je=class{constructor(e,t,r){a(this,"id");a(this,"logger");this.id=e,this.logger=r.logger}updateModel(){}async init(){this.logger.debug(`initializing dispenser ${this.id}`)}async load(){this.logger.debug(`loading dispenser ${this.id}`)}};je=Vo([s.kosModel(N)],je);const Bt={registration:{[N]:{class:je,singleton:!0}},type:N,predicate:s.isKosModel(N),factory:s.Kos.Singleton.create(N)},{URL:Ho}=s.resolveServiceUrl("DISPENSER_SERVICE"),{getAll:Wo}=s.ServiceFactory.build({basePath:`${Ho}/api/dispenser`}),No=s.KosLog.createLogger({name:"dispenser-service",group:"Services"}),zo=async()=>(No.debug("sending GET for dispenser"),await Wo({})),Bo=Object.freeze(Object.defineProperty({__proto__:null,getDispensers:zo},Symbol.toStringTag,{value:"Module"}));var Yo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Yt=(e,t,r,i)=>{for(var o=i>1?void 0:i?qo(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Yo(t,r,o),o};const z="dispenser-info-model";let ye=class{constructor(e,t,r){a(this,"logger");a(this,"id");a(this,"name");this.id=e,this.logger=r.logger}async init(){this.logger.debug(`initializing dispenser-info ${this.id}`)}async load(){this.logger.debug(`loading dispenser-info ${this.id}`)}};Yt([s.kosConfigProperty({path:"kos:device",attribute:"name"})],ye.prototype,"name",2);ye=Yt([s.kosModel(z)],ye);const qt={registration:{[z]:{class:ye,singleton:!1}},type:z,predicate:s.isKosModel(z),factory:s.Kos.Factory.create(z)},{URL:Go}=s.resolveServiceUrl("DISPENSER-INFO_SERVICE"),{getAll:Qo}=s.ServiceFactory.build({basePath:`${Go}/api/dispenser-info`}),Xo=s.KosLog.createLogger({name:"dispenser-info-service",group:"Services"}),Jo=async()=>(Xo.debug("sending GET for dispenser-info"),await Qo({})),Zo=Object.freeze(Object.defineProperty({__proto__:null,getDispenserInfos:Jo},Symbol.toStringTag,{value:"Module"}));var es=Object.getOwnPropertyDescriptor,ts=(e,t,r,i)=>{for(var o=i>1?void 0:i?es(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const B="enrollment-model";let Ve=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"enrolled");this.id=e,this.logger=r.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}`)}};Ve=ts([s.kosModel(B)],Ve);const Gt={registration:{[B]:{class:Ve,singleton:!0}},type:B,predicate:s.isKosModel(B),factory:s.Kos.Singleton.create(B)},{URL:rs}=s.resolveServiceUrl("ENROLLMENT_SERVICE"),{getAll:os}=s.ServiceFactory.build({basePath:`${rs}/api/enrollment`}),ss=s.KosLog.createLogger({name:"enrollment-service",group:"Services"}),is=async()=>(ss.debug("sending GET for enrollment"),await os({})),as=Object.freeze(Object.defineProperty({__proto__:null,getEnrollments:is},Symbol.toStringTag,{value:"Module"})),ns=e=>e.toLowerCase().includes("micros"),ls=e=>!e.toLowerCase().includes("micros"),cs=e=>t=>{const r=e==null?void 0:e.getHoldersByGroup(t);return r?r.map(i=>({id:i.id,name:i.ingredientName,path:i.path})):null},us=["water","carb","ns","nss"],O="dashboardKeyFactory",Re=[];s.registerExtensionPoint(O,{register:(e,t)=>{Re.includes(t)||Re.push(t)},execute:(e,t)=>{const r=Re.sort((i,o)=>i.rank-o.rank);for(const i of r){const o=i.factory(t);if(o)return o}}});const Qt=e=>{s.ExtensionManager[O].register(O,e)},Xt=e=>s.ExtensionManager[O].execute(O,e);s.ExtensionManager.registerDashboardKeyFactory=Qt;s.ExtensionManager.executeDashboardKeyFactory=Xt;const He=3600,Jt=60,ds=e=>{const t=Math.floor(e/He),r=Math.floor(e%He/Jt);return{hours:t,minutes:r}},ps=(e,t)=>e*He+t*Jt,Zt=e=>{const r=new Date().valueOf()-e.valueOf(),i=Math.floor(r/(1e3*60)),o=Math.floor(i/60),l=Math.floor(o/24),n=i%60,h=o%24;let _="";return l>0&&(_+=`${l} day${l>1?"s":""} `),h>0&&(_+=`${h} hour${h>1?"s":""} `),(n>0||l===0&&h===0)&&(_+=`${n} minute${n>1?"s":""} `),_};var gs=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,Ee=(e,t,r,i)=>{for(var o=i>1?void 0:i?hs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&gs(t,r,o),o};const Y="ingredient-summary-model";let k=class{constructor(e,t,r){a(this,"id");a(this,"assemblyModel");a(this,"dashboardOperationModel");a(this,"appModel");a(this,"logger");this.id=e,this.logger=r.logger,this.dashboardOperationModel=ke.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=Xe(e);return this.assemblyModel.allHolders.filter(r=>{const i=s.getKosCompanionModel(r,ae.FreestyleHolder.type);if(i!=null&&i.isRemote)return!1;const o=r.troubles.filter(t);return o.length>0&&o.find(l=>l.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}`)}};Ee([s.kosDependency({modelType:L.Assembly.type})],k.prototype,"assemblyModel",2);Ee([s.kosDependency({modelType:ke.type})],k.prototype,"dashboardOperationModel",2);Ee([s.kosDependency({modelType:$e.type})],k.prototype,"appModel",2);k=Ee([s.kosModel(Y)],k);const er={registration:{[Y]:{class:k,singleton:!1}},type:Y,predicate:s.isKosModel(Y),factory:s.Kos.Factory.create(Y)};var fs=Object.getOwnPropertyDescriptor,ms=(e,t,r,i)=>{for(var o=i>1?void 0:i?fs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const tr="lfcv-pump-model";let We=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"pumpModel");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async init(){this.logger.debug(`initializing lfcv-pump ${this.id}`)}async load(){this.logger.debug(`loading lfcv-pump ${this.id}`)}};We=ms([s.kosModel(tr)],We);const ys=new s.KosModelRegistrationFactory({class:We,type:tr}),{URL:bs}=s.resolveServiceUrl("LFCV-PUMP_SERVICE"),{getAll:vs}=s.ServiceFactory.build({basePath:`${bs}/api/lfcv-pump`}),_s=s.KosLog.createLogger({name:"lfcv-pump-service",group:"Services"}),Ps=async()=>(_s.debug("sending GET for lfcv-pump"),await vs({})),Ms=Object.freeze(Object.defineProperty({__proto__:null,getLfcvPumps:Ps},Symbol.toStringTag,{value:"Module"})),{URL:et}=s.resolveServiceUrl("LOCKOUT_SERVICE"),{postModel:rr}=s.ServiceFactory.build({basePath:`${et}/api/app/kosdev.ddk/lockout`}),or=s.KosLog.createLogger({name:"lockout-service",group:"Services"}),Ts=async()=>(or.info("lock"),await rr({model:{},urlOverride:`${et}/api/app/kosdev.ddk/lockout/lockNow`})),sr=async e=>{or.info("unlock");const t=await rr({model:{},urlOverride:`${et}/api/app/kosdev.ddk/lockout/unlock/${e}`});return t==null?void 0:t.data},$s=Object.freeze(Object.defineProperty({__proto__:null,lock:Ts,unlock:sr},Symbol.toStringTag,{value:"Module"}));var Ss=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,A=(e,t,r,i)=>{for(var o=i>1?void 0:i?Cs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Ss(t,r,o),o};const ir="lockout-model",Os=[{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 b=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"dayEnabledList",["dayWiseLockConfigMap.Sun.enabled","dayWiseLockConfigMap.Mon.enabled","dayWiseLockConfigMap.Tue.enabled","dayWiseLockConfigMap.Wed.enabled","dayWiseLockConfigMap.Thu.enabled","dayWiseLockConfigMap.Fri.enabled","dayWiseLockConfigMap.Sat.enabled"]);a(this,"dayOpenAtList",["dayWiseLockConfigMap.Sun.unlockTime","dayWiseLockConfigMap.Mon.unlockTime","dayWiseLockConfigMap.Tue.unlockTime","dayWiseLockConfigMap.Wed.unlockTime","dayWiseLockConfigMap.Thu.unlockTime","dayWiseLockConfigMap.Fri.unlockTime","dayWiseLockConfigMap.Sat.unlockTime"]);a(this,"dayCloseAtList",["dayWiseLockConfigMap.Sun.lockTime","dayWiseLockConfigMap.Mon.lockTime","dayWiseLockConfigMap.Tue.lockTime","dayWiseLockConfigMap.Wed.lockTime","dayWiseLockConfigMap.Thu.lockTime","dayWiseLockConfigMap.Fri.lockTime","dayWiseLockConfigMap.Sat.lockTime"]);a(this,"saveMap");a(this,"pin");a(this,"nextLockSkipped");a(this,"nextLockTime");a(this,"nextUnLockTime");a(this,"cuiLockout");this.id=e,this.logger=r.logger,this.saveMap=new Map}get enabled(){const e=this.getProp("oneTimeLockConfig.lockTime"),t=e!==void 0&&e!=="",r=this.getProp("lockScheduleEnabled");return t||r}get schedule(){return Os}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 sr(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}`)}};A([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"pin"})],b.prototype,"pin",2);A([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockSkipped"})],b.prototype,"nextLockSkipped",2);A([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockTime"})],b.prototype,"nextLockTime",2);A([s.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextUnLockTime"})],b.prototype,"nextUnLockTime",2);A([s.kosConfigBean({path:"app:kosdev.ddk:service:cuiLockout"})],b.prototype,"cuiLockout",2);b=A([s.kosModel(ir)],b);const ks=new s.SingletonKosModelRegistrationFactory({class:b,type:ir}),Es=async(e,t)=>await s.TroubleServices.bulkResolveTroubles(e,void 0,t);var ws=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,we=(e,t,r,i)=>{for(var o=i>1?void 0:i?Ls(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&ws(t,r,o),o};const q="macro-assignment-model",dt="PurgeTrouble",Ds="PrimeTrouble";let E=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"futureHandler");a(this,"holders");a(this,"ingredients");this.id=e,this.futureHandler=new s.FutureHandler,this.logger=r.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,r)=>{const i=r.troublesByType[dt]||[];return t=[...t,...i],t},[])}get holderPrimeTroubles(){return this.macroHolders.reduce((t,r)=>{const i=r.troublesByType[Ds]||[];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===dt?this.holderPurgeTroubles:this.holderPrimeTroubles).map(l=>l.rawId);return await Es(i,t)}};we([s.kosDependency({modelType:L.HolderContainer.type})],E.prototype,"holders",2);we([s.kosDependency({modelType:L.IngredientContainer.type})],E.prototype,"ingredients",2);we([s.kosFuture()],E.prototype,"resolveAll",1);E=we([s.kosModel(q)],E);const ar={registration:{[q]:{class:E,singleton:!0}},type:q,predicate:s.isKosModel(q),factory:s.Kos.Singleton.create(q)};var Fs=Object.getOwnPropertyDescriptor,Rs=(e,t,r,i)=>{for(var o=i>1?void 0:i?Fs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const G="network-test-model";let Ne=class{constructor(e,t,r){a(this,"id");a(this,"group");a(this,"passed");a(this,"inProgress");a(this,"failureTime");a(this,"timestamp");a(this,"name");a(this,"results");a(this,"logger");this.id=e,this.logger=r.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}`)}};Ne=Rs([s.kosModel(G)],Ne);const tt={registration:{[G]:{class:Ne,singleton:!1}},type:G,predicate:s.isKosModel(G),factory:s.Kos.Factory.create(G)},{URL:Le}=s.resolveServiceUrl("NETWORK-TEST_SERVICE"),{getAll:Is,getOne:nr}=s.ServiceFactory.build({basePath:`${Le}/api/app/ncui/network/tests`}),As=s.KosLog.createLogger({name:"network-test-service",group:"Services"}),lr=async()=>{As.debug("sending GET for network-test");const e=await Is({urlOverride:`${Le}/api/app/kosdev.ddk/network/tests`});return e==null?void 0:e.data},cr=async()=>{const e=await nr({urlOverride:`${Le}/api/app/kosdev.ddk/network/reports`});return e==null?void 0:e.data},ur=async(e,t)=>await nr({urlOverride:`${Le}/api/app/kosdev.ddk/network/tests/run/group/${e}`,tracker:t}),Ks=Object.freeze(Object.defineProperty({__proto__:null,getNetworkTests:lr,getTestsReports:cr,performGroupTest:ur},Symbol.toStringTag,{value:"Module"}));var xs=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,rt=(e,t,r,i)=>{for(var o=i>1?void 0:i?Us(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&xs(t,r,o),o};const Q="network-test-container-model";let se=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"lastTested");a(this,"futureHandler");a(this,"models");this.id=e,this.logger=r.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)),r=Math.max(...t.map(i=>i?i.getTime():0));return r?Zt(new Date(r)):""}async load(){this.logger.debug(`loading network-test-container container ${this.id}`);const e=await lr(),t=await cr();e&&e.forEach(r=>{const i=tt.factory(r.id)(r);this.addModel(i)}),e&&t&&e.forEach(r=>{const i=t==null?void 0:t[r.group],o=i==null?void 0:i[r.id],l=this.getModel(r.id);if(l&&o){const n={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};l.updateModel(n)}})}async performTest(e,t){if(!t)throw new Error("No tracker provided");const r=await ur(e,t);return r==null?void 0:r.data}onFutureUpdate(e){const{clientData:t}=e;t&&t.forEach(r=>{const i=this.getModel(r.id);if(s.kosAction(()=>{this.lastTested=this.lastTested>new Date(r.timestamp)?this.lastTested:new Date(r.timestamp)}),i){const o={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};s.kosAction(()=>{i.updateModel(o)})}})}};rt([s.kosChild],se.prototype,"models",2);rt([s.kosFuture()],se.prototype,"performTest",1);se=rt([s.kosModel(Q)],se);const dr={registration:{[Q]:{class:se,singleton:!0},...tt.registration},type:Q,predicate:s.isKosModel(Q),factory:s.Kos.Singleton.create(Q)};var js=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,ot=(e,t,r,i)=>{for(var o=i>1?void 0:i?Vs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&js(t,r,o),o};const X="nutritive-sweetener-model",Hs=s.createPropKey("statePath");let ie=class{constructor(e,t){a(this,"id");a(this,"assemblyModel");a(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}};ot([s.kosDependency({modelType:L.Assembly.type})],ie.prototype,"assemblyModel",2);ot([s.kosStateBean({path:Hs})],ie.prototype,"pumpState",2);ie=ot([s.kosModel(X),s.kosLoggerAware()],ie);const pr={registration:{[X]:{class:ie,singleton:!1}},type:X,predicate:s.isKosModel(X),factory:s.Kos.Factory.create(X)};var Ws=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,gr=(e,t,r,i)=>{for(var o=i>1?void 0:i?Ns(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Ws(t,r,o),o};const J="plain-water-model";let be=class{constructor(e,t,r){a(this,"id");a(this,"assemblyModel");a(this,"logger");this.id=e,this.logger=r.logger}getHolder(){return this.assemblyModel.getHoldersByGroup("water")[0]}getPump(){var i,o;const e=this.getHolder(),t=(o=(i=e==null?void 0:e.pumps)==null?void 0:i.data)==null?void 0:o[0];return s.getKosCompanionModel(t,Je.type)}async init(){this.logger.debug(`initializing plain-water ${this.id}`)}async load(){this.logger.debug(`loading plain-water ${this.id}`)}};gr([s.kosDependency({modelType:L.Assembly.type})],be.prototype,"assemblyModel",2);be=gr([s.kosModel(J)],be);const hr={registration:{[J]:{class:be,singleton:!1}},type:J,predicate:s.isKosModel(J),factory:s.Kos.Factory.create(J)},{URL:fr}=s.resolveServiceUrl("REBOOT_SERVICE"),{postModel:zs}=s.ServiceFactory.build({basePath:`${fr}/api/reboot`}),Bs=s.KosLog.createLogger({name:"reboot-service",group:"Services"}),mr=async()=>(Bs.debug("sending POST call for Reboot Dispenser"),await zs({urlOverride:`${fr}/api/app/kosdev.ddk/ncui/reboot`,model:{}})),Ys=Object.freeze(Object.defineProperty({__proto__:null,rebootDispenser:mr},Symbol.toStringTag,{value:"Module"}));var qs=Object.getOwnPropertyDescriptor,Gs=(e,t,r,i)=>{for(var o=i>1?void 0:i?qs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const Z="reboot-model";let ze=class{constructor(e,t,r){a(this,"id");a(this,"logger");this.id=e,this.logger=r.logger}async completeReboot(){await mr()}updateModel(){}async init(){this.logger.debug(`initializing reboot ${this.id}`)}async load(){this.logger.debug(`loading reboot ${this.id}`)}};ze=Gs([s.kosModel(Z)],ze);const yr={registration:{[Z]:{class:ze,singleton:!1}},type:Z,predicate:s.isKosModel(Z),factory:s.Kos.Factory.create(Z)};var Qs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,g=(e,t,r,i)=>{for(var o=i>1?void 0:i?Xs(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&Qs(t,r,o),o};const ee="settings-model";let d=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"ncuiLanguageData");a(this,"resolveDelaysMs");a(this,"dateFormat");a(this,"timeFormat");a(this,"hidePlainWaterBev");a(this,"hideCarbWaterBev");a(this,"ncuiLanguage");a(this,"name");a(this,"activateAndRebootTime");a(this,"horizontalMode");this.id=e,this.logger=r.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")}};g([s.kosConfigProperty({path:"system:app",attribute:"resolveDelaysMs"})],d.prototype,"resolveDelaysMs",2);g([s.kosConfigProperty({path:"system:app",attribute:"dateFormat"})],d.prototype,"dateFormat",2);g([s.kosConfigProperty({path:"system:app",attribute:"timeFormat"})],d.prototype,"timeFormat",2);g([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hidePlainWaterBev"})],d.prototype,"hidePlainWaterBev",2);g([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hideCarbWaterBev"})],d.prototype,"hideCarbWaterBev",2);g([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],d.prototype,"ncuiLanguage",2);g([s.kosConfigProperty({path:"kos:device",attribute:"name"})],d.prototype,"name",2);g([s.kosConfigProperty({path:"kos:service:OTA",attribute:"activateAndRebootTime"})],d.prototype,"activateAndRebootTime",2);g([s.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.display.horizontalMode"})],d.prototype,"horizontalMode",2);g([s.kosModelEffect({dependencies:e=>[e.horizontalMode.value]})],d.prototype,"handleUpdateDisplayMode",1);d=g([s.kosModel(ee)],d);const br={registration:{[ee]:{class:d,singleton:!0}},type:ee,predicate:s.isKosModel(ee),factory:s.Kos.Singleton.create(ee)},{URL:vr}=s.resolveServiceUrl("SETTINGS_SERVICE"),{getAll:_r}=s.ServiceFactory.build({basePath:`${vr}/api/settings`}),Js=s.KosLog.createLogger({name:"settings-service",group:"Services"}),Zs=async()=>(Js.debug("sending GET for settings"),await _r({})),ei=async()=>await _r({urlOverride:`${vr}api/app/kosdev.ddk/ncui/languages`}),ti=Object.freeze(Object.defineProperty({__proto__:null,getNcuiLanguage:ei,getSettings:Zs},Symbol.toStringTag,{value:"Module"}));var ri=Object.getOwnPropertyDescriptor,oi=(e,t,r,i)=>{for(var o=i>1?void 0:i?ri(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=n(o)||o);return o};const te="utilities-model";let Be=class{constructor(e,t,r){a(this,"id");a(this,"name");a(this,"options");a(this,"roles");a(this,"columnId");a(this,"logger");this.id=e,this.logger=r.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}`)}};Be=oi([s.kosModel(te)],Be);const st={registration:{[te]:{class:Be,singleton:!1}},type:te,predicate:s.isKosModel(te),factory:s.Kos.Factory.create(te)},{URL:pe}=s.resolveServiceUrl("UTILITIES_SERVICE"),{getAll:Ie}=s.ServiceFactory.build({basePath:`${pe}/api/utilities`}),Ae=s.KosLog.createLogger({name:"utilities-service",group:"Services"}),Pr=async()=>{Ae.debug("sending GET for utilities");try{const e=await Ie({urlOverride:`${pe}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`});if((e==null?void 0:e.status)!==200){Ae.info("no extensions found, using base data");const t=await Ie({urlOverride:`${pe}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch(e){Ae.info(`error fetching utilities: ${e}. Using base data`);const t=await Ie({urlOverride:`${pe}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}},si=Object.freeze(Object.defineProperty({__proto__:null,getUtilities:Pr},Symbol.toStringTag,{value:"Module"}));var ii=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,Mr=(e,t,r,i)=>{for(var o=i>1?void 0:i?ai(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&ii(t,r,o),o};const re="utilities-container-model";let ve=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"_models");this.id=e,this.logger=r.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 Pr();e==null||e.forEach((t,r)=>{t.forEach(i=>{const o={...i,columnId:String(r)},l=st.factory(i.name)(o);this.addModel(l)})})}};Mr([s.kosChild],ve.prototype,"_models",2);ve=Mr([s.kosModel(re)],ve);const Tr={registration:{[re]:{class:ve,singleton:!0},...st.registration},type:re,predicate:s.isKosModel(re),factory:s.Kos.Singleton.create(re)},ni={...Ct.registration,...$e.registration,...Me.registration,...Rt.registration,...ke.registration,...Bt.registration,...qt.registration,...Gt.registration,...er.registration,...ar.registration,...dr.registration,...pr.registration,...hr.registration,...yr.registration,...br.registration,...Qe.registration,...Tr.registration},{URL:ce}=s.resolveServiceUrl("SPM-PUMP_SERVICE"),{postModel:De}=s.ServiceFactory.build({basePath:`${ce}/api/spm-pump`}),p=s.KosLog.createLogger({name:"spm-pump-service",group:"Services"}),$r=async(e,t)=>{p.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`);try{const r=await De({model:{},urlOverride:`${ce}/api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,tracker:t});return p.debug("performPreCalibrate - response:",r),r!=null&&r.data&&s.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){p.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,r);const i={id:t||"",endState:s.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(i),i}},Sr=async(e,t)=>{p.debug(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`);try{const r=await De({model:{},urlOverride:`${ce}/api/ext/freestyle/microCalibration/pour/${e}/calibrate`,tracker:t});return p.debug("performCalibrate - response:",r),r!=null&&r.data&&s.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){p.error(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`,r);const i={id:t||"",endState:s.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(i),i}},Cr=async(e,t,r,i)=>{p.debug(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`);try{const o=await De({model:{...r,measuredCalibrationVolume:t},urlOverride:`${ce}/api/ext/freestyle/microCalibration/pour/${e}/verify`,tracker:i});return p.debug("performVerify - response:",o),o!=null&&o.data&&s.FutureManager.initiateFuture(o.data),o==null?void 0:o.data}catch(o){p.error(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`,o);const l={id:i||"",endState:s.FutureEndState.Fail,tracker:i,reason:"Failed to resolve trouble"};return s.FutureManager.initiateFuture(l),l}},Or=async(e,t,r,i)=>{var o,l,n,h,_;p.debug(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`);try{const c=await De({model:{...i,measuredCalibrationVolume:t,measuredVerificationVolume:r},urlOverride:`${ce}/api/ext/freestyle/microCalibration/pour/${e}/complete`});return p.debug("performComplete - response:",c),((c==null?void 0:c.status)===200||(c==null?void 0:c.status)===499)&&((o=c.data)!=null&&o.error)?[c.data.error||"unknownError",c.data]:[void 0,c==null?void 0:c.data]}catch(c){if(p.error(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`,c),c instanceof s.FetchError){const it=((n=(l=c.payload)==null?void 0:l.data)==null?void 0:n.error)||((h=c.payload)==null?void 0:h.error)||"unknownError";return[it,((_=c.payload)==null?void 0:_.data)||{error:it}]}}return["unknownError",{error:"unknownError"}]},li=Object.freeze(Object.defineProperty({__proto__:null,performCalibrate:Sr,performComplete:Or,performPreCalibrate:$r,performVerify:Cr},Symbol.toStringTag,{value:"Module"}));var ci=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,Fe=(e,t,r,i)=>{for(var o=i>1?void 0:i?ui(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&ci(t,r,o),o};const kr="spm-pump-model";let w=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"pump");a(this,"futureHandler");this.id=e,this.logger=r.logger,this.pump=t.companionParent,this.futureHandler=new s.FutureHandler(this)}get name(){return this.pump.name}get canPour(){return this.pump.canPour}get isPouring(){return this.pump.isPouring}async cancelPour(){return this.pump.cancelPour()}performIntent(e){return this.pump.performIntent(e)}get future(){return this.futureHandler.future}async performPreCalibrate(e){return $r(this.pump.path,e)}async performCalibrate(e){return Sr(this.pump.path,e)}async performVerify(e,t,r){return Cr(this.pump.path,e,t,r)}async performComplete(e,t,r){return Or(this.pump.path,e,t,r)}async init(){this.logger.debug(`initializing spm-pump ${this.id}`)}async load(){this.logger.debug(`loading spm-pump ${this.id}`)}};Fe([s.kosFuture()],w.prototype,"performPreCalibrate",1);Fe([s.kosFuture()],w.prototype,"performCalibrate",1);Fe([s.kosFuture()],w.prototype,"performVerify",1);w=Fe([s.kosModel(kr)],w);const di=new s.KosModelRegistrationFactory({class:w,type:kr});var pi=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,Er=(e,t,r,i)=>{for(var o=i>1?void 0:i?gi(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&pi(t,r,o),o};const wr="trouble-action-model";let _e=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"troubleContainer");a(this,"disposer");a(this,"state");a(this,"troubleActionData");this.id=e,this.logger=r.logger,this.state=s.ObservableData(),this.troubleActionData=t.definitions.reduce((i,o)=>(i[o.troubleType]=o,i),{})}get activeTrouble(){const e=Object.keys(this.troubleActionData);if(e.length>0){const t=e[0],r=this.troubleContainer.troubles.getIndexByKey("byType",t);return r.length>0?r[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,r)=>{const i=r.type;if(this.troubleActionData[i]){const o=this.troubleActionData[i].stateKey??i,l=this.troubleActionData[i].stateValue??i;t[o]=l}return t},{});this.state.setValues(e),Object.keys(this.troubleActionData).forEach(t=>{if(this.troubleContainer.troubles.getIndexByKey("byType",t).length===0){const r=this.troubleActionData[t].stateKey??t;this.state[r]=void 0}})})}unload(){var e;(e=this.disposer)==null||e.call(this)}async load(){this.logger.debug(`loading trouble-action ${this.id}`)}};Er([s.kosDependency({modelType:s.TroubleContainer.type})],_e.prototype,"troubleContainer",2);_e=Er([s.kosModel(wr)],_e);const hi=new s.SingletonKosModelRegistrationFactory({class:_e,type:wr}),{URL:Lr}=s.resolveServiceUrl("START_SERVICE"),{getOne:fi}=s.ServiceFactory.build({basePath:`${Lr}/api/start`}),mi=s.KosLog.createLogger({name:"start-service",group:"Services"}),Dr=async()=>(mi.debug("navigating to NCUI"),await fi({urlOverride:`${Lr}/api/app/kosdev.ddk/ncui/open`})),yi=Object.freeze(Object.defineProperty({__proto__:null,navigateToNCui:Dr},Symbol.toStringTag,{value:"Module"}));var bi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,Fr=(e,t,r,i)=>{for(var o=i>1?void 0:i?vi(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&bi(t,r,o),o};const Rr="start-model";let Pe=class{constructor(e,t,r){a(this,"id");a(this,"logger");a(this,"troubles");this.id=e,this.logger=r.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 Dr()}async init(){this.logger.debug(`initializing start ${this.id}`)}async load(){this.logger.debug(`loading start ${this.id}`)}};Fr([s.kosDependency({modelType:s.TroubleContainer.type})],Pe.prototype,"troubles",2);Pe=Fr([s.kosModel(Rr)],Pe);const _i=new s.SingletonKosModelRegistrationFactory({class:Pe,type:Rr});exports.AgitationControl=no;exports.Animation=Ct;exports.AnimationServices=fo;exports.Application=$e;exports.Auth=Me;exports.AuthServices=Ur;exports.CarbWater=Rt;exports.CgpPump=Oo;exports.CopyLogs=Ao;exports.CopyLogsServices=Lo;exports.DDKModels=ni;exports.DashboardOperations=ke;exports.DashboardOperationsServices=Ko;exports.Dispenser=Bt;exports.DispenserInfo=qt;exports.DispenserInfoServices=Zo;exports.DispenserServices=Bo;exports.Door=vt;exports.EXTENSION_POINT_DASHBOARD_KEY_FACTORY=O;exports.Enrollment=Gt;exports.EnrollmentServices=as;exports.FcmPump=Je;exports.FcmPumpServices=yo;exports.IngredientSummary=er;exports.LfcvPump=ys;exports.LfcvPumpServices=Ms;exports.Lockout=ks;exports.LockoutServices=$s;exports.MACRO_KEYS=us;exports.MacroAssignment=ar;exports.NetworkTest=tt;exports.NetworkTestContainer=dr;exports.NetworkTestServices=Ks;exports.NutritiveSweetener=pr;exports.PlainWater=hr;exports.Reboot=yr;exports.RebootServices=Ys;exports.Settings=br;exports.SettingsServices=ti;exports.SetupStep=Ge;exports.SetupStepContainer=Qe;exports.SetupStepServices=Yr;exports.SpmPump=di;exports.SpmPumpServices=li;exports.Start=_i;exports.StartServices=yi;exports.TROUBLE_TYPE_PRIME=pt;exports.TROUBLE_TYPE_PURGE=Ke;exports.TroubleActionManager=hi;exports.Utilities=st;exports.UtilitiesContainer=Tr;exports.UtilitiesServices=si;exports.calculateTimeDifference=Zt;exports.executeDashboardKeyFactory=Xt;exports.isMacroGroup=ls;exports.isMicroGroup=ns;exports.macroHolderMap=cs;exports.registerDashboardKeyFactory=Qt;exports.toSeconds=ps;exports.toTimeComponents=ds;exports.troubleVisibilityFilter=Xe;
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;