@kosdev-code/kos-ui-sdk 0.1.0-dev.5784 → 0.1.0-dev.5785
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.js +18 -18
- package/index.js.map +1 -1
- package/kos-models.json +1 -1
- package/models/utils/services-index.d.ts +2 -2
- package/models/utils/services-index.d.ts.map +1 -1
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -142,7 +142,7 @@ ${c}topics:${e}
|
|
|
142
142
|
gl_FragColor = vec4(rgb, 1.0);
|
|
143
143
|
}
|
|
144
144
|
`,i=this.compileShader(r.VERTEX_SHADER,o),a=this.compileShader(r.FRAGMENT_SHADER,n);this.program=this.createProgram(i,a),this.posBuffer=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,this.posBuffer),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),r.STATIC_DRAW),this.aPosition=r.getAttribLocation(this.program,"a_position"),this.uMinHue=r.getUniformLocation(this.program,"minHue"),this.uMaxHue=r.getUniformLocation(this.program,"maxHue"),this.uHueOffset=r.getUniformLocation(this.program,"hueOffset"),this.uGridHeight=r.getUniformLocation(this.program,"gridHeight")}reset(){this.hueOffset=0,this.lastUpdate=performance.now()}renderFrame(s,r){const o=this.gl;if(this.canvas.width=s,this.canvas.height=r,this.shouldStep(50)){const n=this.speedPx/r;this.hueOffset=(this.hueOffset+n)%1}o.viewport(0,0,s,r),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(this.program),o.enableVertexAttribArray(this.aPosition),o.bindBuffer(o.ARRAY_BUFFER,this.posBuffer),o.vertexAttribPointer(this.aPosition,2,o.FLOAT,!1,0,0),o.uniform1f(this.uMinHue,this.minHue/360),o.uniform1f(this.uMaxHue,this.maxHue/360),o.uniform1f(this.uHueOffset,this.hueOffset),o.uniform1f(this.uGridHeight,r),o.drawArrays(o.TRIANGLES,0,6)}compileShader(s,r){const o=this.gl.createShader(s);if(this.gl.shaderSource(o,r),this.gl.compileShader(o),!this.gl.getShaderParameter(o,this.gl.COMPILE_STATUS))throw new Error(this.gl.getShaderInfoLog(o)||"Shader compile failed");return o}createProgram(s,r){const o=this.gl.createProgram();if(this.gl.attachShader(o,s),this.gl.attachShader(o,r),this.gl.linkProgram(o),!this.gl.getProgramParameter(o,this.gl.LINK_STATUS))throw new Error("Program linking failed");return o}}class St{constructor(){l(this,"canvas");l(this,"ctx");l(this,"lastUpdate",0);this.canvas=document.createElement("canvas");const e=this.canvas.getContext("2d");if(!e)throw new Error("2D canvas not supported");this.ctx=e}dispose(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.remove()}shouldStep(e){const s=performance.now();return s-this.lastUpdate>=e?(this.lastUpdate=s,!0):!1}readPixels(e,s){return this.ctx.getImageData(0,0,e,s).data}}function Pi(t){class e extends t{constructor(){super(...arguments);l(this,"doneCallback",null);l(this,"oneShotDone",!1)}isOneShot(){return!0}onDone(o){this.doneCallback=o}signalDoneIfNeeded(){var o;this.oneShotDone||((o=this.doneCallback)==null||o.call(this),this.oneShotDone=!0)}resetOneShot(){this.doneCallback=null,this.oneShotDone=!1}get isOneShotDone(){return this.oneShotDone}}return e}const BE=Pi(St);class KE extends BE{constructor({colors:s=["red","yellow","green"],direction:r="horizontal",speed:o=2,loop:n=!0}={}){super();l(this,"offset",0);l(this,"speed");l(this,"colors");l(this,"direction");l(this,"loop");this.colors=s,this.direction=r,this.speed=o,this.loop=n}reset(){this.offset=0,this.lastUpdate=performance.now(),this.loop||this.resetOneShot()}renderFrame(s,r){if(!this.loop&&this.isOneShotDone)return;this.loop&&this.shouldStep(50)&&(this.offset+=this.speed);const o=this.loop?-this.offset:0,n=this.loop?s*2-this.offset:s,i=this.ctx.createLinearGradient(o,0,n,0),a=1/(this.colors.length-1);this.colors.forEach((c,u)=>{i.addColorStop(u*a,c)}),this.ctx.fillStyle=i,this.ctx.fillRect(0,0,s,r),!this.loop&&!this.isOneShotDone&&this.signalDoneIfNeeded()}}const HE=Pi(St);class Gd extends HE{constructor({src:s}){super();l(this,"img");l(this,"loaded",!1);this.img=new Image,this.img.src=s,this.img.crossOrigin="anonymous",this.img.onload=()=>{this.loaded=!0}}reset(){this.resetOneShot()}renderFrame(s,r){!this.loaded||this.isOneShotDone||(this.canvas.width=s,this.canvas.height=r,this.ctx.drawImage(this.img,0,0,s,r),this.signalDoneIfNeeded())}}class qE extends Vd{constructor(s){super(s);l(this,"loopConfig");l(this,"currentLoopCount",0);l(this,"startTime");l(this,"endTime");l(this,"completionCallback",null);this.loopConfig=s.loop??!1,this.startTime=s.startTime??0,this.endTime=s.endTime??null,this.video.removeEventListener("ended",this.handleEnded),this.video.addEventListener("ended",this.handleVideoEnd.bind(this)),this.startTime>0&&(this.video.currentTime=this.startTime),this.endTime!==null&&this.video.addEventListener("timeupdate",this.handleTimeUpdate.bind(this))}handleTimeUpdate(){this.endTime!==null&&this.video.currentTime>=this.endTime&&this.handleVideoEnd()}handleVideoEnd(){this.loopConfig===!0?(this.video.currentTime=this.startTime,this.video.play().catch(console.warn)):typeof this.loopConfig=="number"&&this.currentLoopCount<this.loopConfig-1?(this.currentLoopCount++,this.video.currentTime=this.startTime,this.video.play().catch(console.warn)):(this.video.pause(),this.completionCallback&&this.completionCallback())}reset(){super.reset(),this.currentLoopCount=0,this.video.currentTime=this.startTime}onDone(s){this.completionCallback=s}isOneShot(){return this.loopConfig===!1||this.loopConfig===1}dispose(){this.video.removeEventListener("ended",this.handleVideoEnd),this.video.removeEventListener("timeupdate",this.handleTimeUpdate),this.completionCallback=null,super.dispose()}}function zE(t){const e=t.replace("#","");if(!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e))throw new Error(`Invalid hex color: ${t}`);let s,r,o;return e.length===3?(s=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),o=parseInt(e[2]+e[2],16)):(s=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16)),{r:s,g:r,b:o}}function Yd(t){return typeof t=="string"?zE(t):t}function Gr(t){const e=Yd(t);return`rgb(${e.r},${e.g},${e.b})`}class VE extends St{constructor(s={}){super();l(this,"columns",[]);l(this,"fallChance");l(this,"speed");l(this,"baseColor");l(this,"trailColors");this.speed=s.speed??1,this.fallChance=s.fallChance??.7,s.baseColor?this.baseColor=Yd(s.baseColor):this.baseColor={r:0,g:255,b:255},this.trailColors=this.calculateTrailColors()}calculateTrailColors(){const r=[];for(let o=0;o<=5;o++){const n=1-o/5*.6;r.push({r:Math.floor(this.baseColor.r*n),g:Math.floor(this.baseColor.g*n),b:Math.floor(this.baseColor.b*n)})}return r}reset(){this.columns=[],this.lastUpdate=performance.now()}renderFrame(s,r){this.columns.length!==s&&(this.columns=Array(s).fill(0).map(()=>Math.floor(Math.random()*r))),this.shouldStep(50)&&(this.columns=this.columns.map(i=>i>r+5?0:i+(Math.random()<this.fallChance?this.speed:0)));const o=this.ctx.createImageData(s,r),n=o.data;n.fill(0);for(let i=0;i<r;i++)for(let a=0;a<s;a++){const c=this.columns[a];let u=0,d=0,h=0;if(i===c)u=this.baseColor.r,d=this.baseColor.g,h=this.baseColor.b;else if(i<c&&i>c-this.trailColors.length){const p=c-i;if(p<this.trailColors.length){const y=this.trailColors[p];u=y.r,d=y.g,h=y.b}}const f=(i*s+a)*4;n[f]=u,n[f+1]=d,n[f+2]=h,n[f+3]=255}this.ctx.putImageData(o,0,0)}}class GE{constructor(e,s){l(this,"baseRenderer");l(this,"overlayIcons",new Map);l(this,"overlayConfigs");l(this,"loadedIcons",new Set);l(this,"canvas");l(this,"ctx");l(this,"persistOverlaysOnComplete");l(this,"baseRendererCompleted",!1);l(this,"completionCallback",null);l(this,"hasSignaledCompletion",!1);this.baseRenderer=s(e.baseRenderer.type,e.baseRenderer.data),this.overlayConfigs=e.overlays,this.persistOverlaysOnComplete=e.persistOverlaysOnComplete!==!1,this.canvas=document.createElement("canvas");const r=this.canvas.getContext("2d");if(!r)throw new Error("2D canvas not supported");this.ctx=r,this.loadOverlayImages(),"onDone"in this.baseRenderer&&typeof this.baseRenderer.onDone=="function"&&this.baseRenderer.onDone(()=>{this.baseRendererCompleted=!0,!this.persistOverlaysOnComplete&&this.completionCallback&&this.completionCallback()})}async loadOverlayImages(){for(const e of this.overlayConfigs){const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{this.loadedIcons.add(e.src)},s.onerror=r=>{console.error(`Failed to load overlay image: ${e.src}`,r)},s.src=e.src,this.overlayIcons.set(e.src,s)}}calculateOverlayPosition(e,s,r){let o,n;if(typeof e.position=="string")switch(e.position){case"top-left":o=0,n=0;break;case"top-center":o=(s-e.size)/2,n=0;break;case"top-right":o=s-e.size,n=0;break;case"center-left":o=0,n=(r-e.size)/2;break;case"center":o=(s-e.size)/2,n=(r-e.size)/2;break;case"center-right":o=s-e.size,n=(r-e.size)/2;break;case"bottom-left":o=0,n=r-e.size;break;case"bottom-center":o=(s-e.size)/2,n=r-e.size;break;case"bottom-right":o=s-e.size,n=r-e.size;break;default:o=0,n=0}else o=e.position.x,n=e.position.y;return e.offset&&(o+=e.offset.x||0,n+=e.offset.y||0),{x:o,y:n}}reset(){this.baseRenderer.reset(),this.baseRendererCompleted=!1,this.hasSignaledCompletion=!1}renderFrame(e,s){if(this.canvas.width=e,this.canvas.height=s,this.ctx.clearRect(0,0,e,s),this.baseRendererCompleted&&this.persistOverlaysOnComplete)this.renderOverlays(e,s);else{this.baseRenderer.renderFrame(e,s);const r=this.baseRenderer.readPixels(e,s);if(r&&r.length>0){const o=new ImageData(r,e,s);this.ctx.putImageData(o,0,0)}this.renderOverlays(e,s)}}renderOverlays(e,s){for(const r of this.overlayConfigs){if(!r.persistent&&r.persistent!==void 0)continue;const o=this.overlayIcons.get(r.src);if(!o||!this.loadedIcons.has(r.src))continue;const n=this.calculateOverlayPosition(r,e,s);this.ctx.save(),r.opacity!==void 0&&(this.ctx.globalAlpha=Math.max(0,Math.min(1,r.opacity))),this.ctx.drawImage(o,n.x,n.y,r.size,r.size),this.ctx.restore()}}readPixels(e,s){return this.ctx.getImageData(0,0,e,s).data}play(){this.baseRenderer.play&&this.baseRenderer.play()}pause(){this.baseRenderer.pause&&this.baseRenderer.pause()}dispose(){this.overlayIcons.clear(),this.loadedIcons.clear(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.remove(),this.baseRenderer.dispose&&this.baseRenderer.dispose()}onDone(e){this.completionCallback=e,this.hasSignaledCompletion&&e()}isOneShot(){return this.persistOverlaysOnComplete?!1:"isOneShot"in this.baseRenderer&&typeof this.baseRenderer.isOneShot=="function"?this.baseRenderer.isOneShot():!1}}class Wd extends St{constructor(s){super();l(this,"img");l(this,"loaded",!1);l(this,"scrollConfig");l(this,"loopConfig");l(this,"duration");l(this,"pauseDuration");l(this,"colorOverride");l(this,"originalSvgData",null);l(this,"position",0);l(this,"startTime",0);l(this,"lastFrameTime",0);l(this,"currentLoopCount",0);l(this,"completionCallback",null);l(this,"isPlaying",!1);l(this,"completed",!1);l(this,"isPaused",!1);l(this,"pauseStartTime",0);this.img=new Image,this.img.crossOrigin="anonymous",this.scrollConfig=s.scroll,this.loopConfig=s.loop??!1,this.duration=s.duration,this.pauseDuration=s.pauseBetweenLoops??0,this.colorOverride=s.colorOverride,this.colorOverride&&s.src.toLowerCase().includes(".svg")?this.loadAndProcessSvg(s.src):this.img.src=s.src,this.img.onload=()=>{this.loaded=!0},this.img.onerror=r=>{console.error("Failed to load image:",r)}}reset(){this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime,this.currentLoopCount=0,this.completed=!1,this.isPlaying=!1,this.isPaused=!1,this.pauseStartTime=0}play(){this.isPlaying||(this.isPlaying=!0,this.startTime=performance.now(),this.lastFrameTime=this.startTime)}pause(){this.isPlaying=!1}renderFrame(s,r){var a;if(!this.loaded||this.completed)return;if(this.isPaused){this.canvas.width=s,this.canvas.height=r,this.ctx.clearRect(0,0,s,r),this.pauseDuration>0&&performance.now()-this.pauseStartTime>=this.pauseDuration&&(this.isPaused=!1,this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime);return}if(this.canvas.width=s,this.canvas.height=r,this.ctx.clearRect(0,0,s,r),!((a=this.scrollConfig)!=null&&a.enabled)){this.ctx.drawImage(this.img,0,0,s,r),this.duration&&this.isPlaying&&performance.now()-this.startTime>=this.duration&&this.handleCompletion();return}const o=this.scrollConfig.direction||"left",n=this.scrollConfig.speed||50,i=this.scrollConfig.gap||0;if(this.isPlaying){const c=performance.now(),u=(c-this.lastFrameTime)/1e3;this.lastFrameTime=c;const d=n*u;switch(o){case"left":this.position+=d;break;case"right":this.position+=d;break;case"up":this.position+=d;break;case"down":this.position+=d;break}}this.drawScrollingImage(s,r,o,i),this.checkScrollCompletion(s,r,o,i)}drawScrollingImage(s,r,o,n){var h,f,p,y,b,M,$,U,A;const i=this.img.width/this.img.height;let a,c;((h=this.scrollConfig)==null?void 0:h.maintainAspectRatio)!==!1?(f=this.scrollConfig)!=null&&f.height?(c=this.scrollConfig.height,a=c*i):(p=this.scrollConfig)!=null&&p.width?(a=this.scrollConfig.width,c=a/i):o==="left"||o==="right"?(c=r,a=c*i):(a=s,c=a/i):(a=((y=this.scrollConfig)==null?void 0:y.width)||s,c=((b=this.scrollConfig)==null?void 0:b.height)||r);let u,d;switch(o==="left"||o==="right"?(u=0,((M=this.scrollConfig)==null?void 0:M.offsetY)==="center"||(($=this.scrollConfig)==null?void 0:$.offsetY)===void 0?d=(r-c)/2:d=this.scrollConfig.offsetY):(((U=this.scrollConfig)==null?void 0:U.offsetX)==="center"||((A=this.scrollConfig)==null?void 0:A.offsetX)===void 0?u=(s-a)/2:u=this.scrollConfig.offsetX,d=0),o){case"left":{const O=s-this.position;if(O<s&&O>-a&&this.ctx.drawImage(this.img,O,d,a,c),this.loopConfig&&this.pauseDuration===0&&this.position>n){const L=O+a+n;L<s&&this.ctx.drawImage(this.img,L,d,a,c)}break}case"right":{const O=-a+this.position;if(O>-a&&O<s&&this.ctx.drawImage(this.img,O,d,a,c),this.loopConfig&&this.pauseDuration===0&&O-n-a>-a){const L=O-a-n;L<s&&this.ctx.drawImage(this.img,L,d,a,c)}break}case"up":{const O=r-this.position;if(O>-c&&O<r&&this.ctx.drawImage(this.img,u,O,a,c),this.loopConfig&&this.pauseDuration===0&&O+c+n<r){const L=O+c+n;L>-c&&this.ctx.drawImage(this.img,u,L,a,c)}break}case"down":{const O=-c+this.position;if(O>-c&&O<r&&this.ctx.drawImage(this.img,u,O,a,c),this.loopConfig&&this.pauseDuration===0&&O-n-c>-c){const L=O-c-n;L<r&&this.ctx.drawImage(this.img,u,L,a,c)}break}}}checkScrollCompletion(s,r,o,n){var h,f,p,y,b;if(!this.isPlaying)return;const i=this.img.width/this.img.height;let a,c;switch(((h=this.scrollConfig)==null?void 0:h.maintainAspectRatio)!==!1?(f=this.scrollConfig)!=null&&f.height?(c=this.scrollConfig.height,a=c*i):(p=this.scrollConfig)!=null&&p.width?(a=this.scrollConfig.width,c=a/i):o==="left"||o==="right"?(c=r,a=c*i):(a=s,c=a/i):(a=((y=this.scrollConfig)==null?void 0:y.width)||s,c=((b=this.scrollConfig)==null?void 0:b.height)||r),o){case"left":case"right":this.loopConfig;break;case"up":case"down":this.loopConfig;break}let u=!1;const d=1;switch(o){case"left":u=s-this.position<-a-d;break;case"right":u=-a+this.position>s+d;break;case"up":u=r-this.position<-c-d;break;case"down":u=-c+this.position>r+d;break}u&&(this.loopConfig===!1||typeof this.loopConfig=="number"&&this.loopConfig===1?this.handleCompletion():typeof this.loopConfig=="number"&&this.loopConfig>1?(this.currentLoopCount++,this.currentLoopCount>=this.loopConfig?this.handleCompletion():this.startPauseOrNextLoop()):this.loopConfig===!0&&this.startPauseOrNextLoop())}startPauseOrNextLoop(){this.pauseDuration>0?(this.isPaused=!0,this.pauseStartTime=performance.now()):this.position=0}handleCompletion(){this.completed=!0,this.isPlaying=!1,this.completionCallback&&this.completionCallback()}onDone(s){this.completionCallback=s}isOneShot(){var s;return!((s=this.scrollConfig)!=null&&s.enabled)&&!this.loopConfig}async loadAndProcessSvg(s){try{const o=await(await fetch(s)).text();this.originalSvgData=o;const n=this.applySvgColorOverride(o),i=`data:image/svg+xml;base64,${btoa(n)}`;this.img.src=i}catch(r){console.error("Failed to load and process SVG:",r),this.img.src=s}}applySvgColorOverride(s){if(!this.colorOverride)return s;const r=Gr(this.colorOverride);return s.replace(/fill\s*=\s*["'][^"']*["']/gi,`fill="${r}"`).replace(/fill\s*:\s*[^;"]*/gi,`fill:${r}`).replace(/stroke\s*=\s*["'][^"']*["']/gi,`stroke="${r}"`).replace(/stroke\s*:\s*[^;"]*/gi,`stroke:${r}`)}dispose(){this.img.removeAttribute("src"),this.completionCallback=null,this.originalSvgData=null}}class YE extends St{constructor(s){super();l(this,"text");l(this,"lines");l(this,"fontSize");l(this,"fontFamily");l(this,"lineHeight");l(this,"textColor");l(this,"scrollConfig");l(this,"loopConfig");l(this,"duration");l(this,"pauseDuration");l(this,"position",0);l(this,"startTime",0);l(this,"lastFrameTime",0);l(this,"currentLoopCount",0);l(this,"completionCallback",null);l(this,"isPlaying",!1);l(this,"completed",!1);l(this,"isPaused",!1);l(this,"pauseStartTime",0);l(this,"textWidth",0);l(this,"textHeight",0);l(this,"lineWidths",[]);l(this,"textMeasured",!1);this.text=s.text,this.lines=s.text.split(`
|
|
145
|
-
`),this.fontSize=s.fontSize??8,this.lineHeight=s.lineHeight??this.fontSize+2,this.fontFamily=s.fontFamily??"monospace, 'Lucida Console', 'Courier New', Courier",this.scrollConfig=s.scroll,this.loopConfig=s.loop??!1,this.duration=s.duration,this.pauseDuration=s.pauseBetweenLoops??0,s.color?this.textColor=Gr(s.color):this.textColor="rgb(255,255,255)"}measureText(){if(this.textMeasured)return;this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.lineWidths=[];let s=0;for(const r of this.lines){const n=this.ctx.measureText(r).width;this.lineWidths.push(n),s=Math.max(s,n)}this.textWidth=s,this.textHeight=this.lines.length*this.lineHeight,this.textMeasured=!0}reset(){this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime,this.currentLoopCount=0,this.completed=!1,this.isPlaying=!1,this.isPaused=!1,this.pauseStartTime=0,this.textMeasured=!1,this.lineWidths=[]}play(){this.isPlaying||(this.isPlaying=!0,this.startTime=performance.now(),this.lastFrameTime=this.startTime)}pause(){this.isPlaying=!1}renderFrame(s,r){var a;if(this.canvas.width=s,this.canvas.height=r,this.measureText(),this.completed)return;if(this.isPaused){this.ctx.clearRect(0,0,s,r),this.pauseDuration>0&&performance.now()-this.pauseStartTime>=this.pauseDuration&&(this.isPaused=!1,this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime);return}if(this.ctx.clearRect(0,0,s,r),!((a=this.scrollConfig)!=null&&a.enabled)){this.drawStaticText(s,r),this.duration&&this.isPlaying&&performance.now()-this.startTime>=this.duration&&this.handleCompletion();return}const o=this.scrollConfig.direction||"left",n=this.scrollConfig.speed||50,i=this.scrollConfig.gap||0;if(this.isPlaying){const c=performance.now(),u=(c-this.lastFrameTime)/1e3;this.lastFrameTime=c;const d=n*u;switch(o){case"left":case"right":case"up":case"down":this.position+=d;break}}this.drawScrollingText(s,r,o,i),this.checkScrollCompletion(s,r,o)}drawStaticText(s,r){this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.ctx.fillStyle=this.textColor,this.ctx.textBaseline="top";const o=this.textHeight;let n=(r-o)/2;for(let i=0;i<this.lines.length;i++){const a=this.lines[i],c=this.lineWidths[i],u=(s-c)/2,d=n+i*this.lineHeight;this.ctx.fillText(a,u,d)}}drawScrollingText(s,r,o,n){var c,u,d,h;this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.ctx.fillStyle=this.textColor,this.ctx.textBaseline="top";let i,a;o==="left"||o==="right"?(i=0,((c=this.scrollConfig)==null?void 0:c.offsetY)==="center"||((u=this.scrollConfig)==null?void 0:u.offsetY)===void 0?a=(r-this.textHeight)/2:a=this.scrollConfig.offsetY):(((d=this.scrollConfig)==null?void 0:d.offsetX)==="center"||((h=this.scrollConfig)==null?void 0:h.offsetX)===void 0?(i=s/2,this.ctx.textAlign="center"):(i=this.scrollConfig.offsetX,this.ctx.textAlign="left"),a=0),this.drawMultiLineScrollText(o,s,r,n,i,a)}drawMultiLineScrollText(s,r,o,n,i,a){switch(s){case"left":{const c=r-this.position;if(c<r&&c>-this.textWidth&&this.drawTextBlock(c,a,"left"),this.loopConfig&&this.pauseDuration===0&&this.position>n){const u=c+this.textWidth+n;u<r&&this.drawTextBlock(u,a,"left")}break}case"right":{const c=-this.textWidth+this.position;if(c>-this.textWidth&&c<r&&this.drawTextBlock(c,a,"left"),this.loopConfig&&this.pauseDuration===0&&c-n-this.textWidth>-this.textWidth){const u=c-this.textWidth-n;u<r&&this.drawTextBlock(u,a,"left")}break}case"up":{const c=o-this.position;if(c>-this.textHeight&&c<o&&this.drawTextBlock(i,c,"center"),this.loopConfig&&this.pauseDuration===0&&c+this.textHeight+n<o){const u=c+this.textHeight+n;u>-this.textHeight&&this.drawTextBlock(i,u,"center")}break}case"down":{const c=-this.textHeight+this.position;if(c>-this.textHeight&&c<o&&this.drawTextBlock(i,c,"center"),this.loopConfig&&this.pauseDuration===0&&c-n-this.textHeight>-this.textHeight){const u=c-this.textHeight-n;u<o&&this.drawTextBlock(i,u,"center")}break}}}drawTextBlock(s,r,o){for(let n=0;n<this.lines.length;n++){const i=this.lines[n],a=this.lineWidths[n];let c;o==="center"?c=s-a/2:c=s;const u=r+n*this.lineHeight;this.ctx.fillText(i,c,u)}}checkScrollCompletion(s,r,o){if(!this.isPlaying)return;let n=!1;const i=1;switch(o){case"left":n=s-this.position<-this.textWidth-i;break;case"right":n=-this.textWidth+this.position>s+i;break;case"up":n=r-this.position<-this.textHeight-i;break;case"down":n=-this.textHeight+this.position>r+i;break}n&&(this.loopConfig===!1||typeof this.loopConfig=="number"&&this.loopConfig===1?this.handleCompletion():typeof this.loopConfig=="number"&&this.loopConfig>1?(this.currentLoopCount++,this.currentLoopCount>=this.loopConfig?this.handleCompletion():this.startPauseOrNextLoop()):this.loopConfig===!0&&this.startPauseOrNextLoop())}startPauseOrNextLoop(){this.pauseDuration>0?(this.isPaused=!0,this.pauseStartTime=performance.now()):this.position=0}handleCompletion(){this.completed=!0,this.isPlaying=!1,this.completionCallback&&this.completionCallback()}onDone(s){this.completionCallback=s}isOneShot(){var s;return!((s=this.scrollConfig)!=null&&s.enabled)&&!this.loopConfig}dispose(){this.completionCallback=null}}class WE{constructor(e){l(this,"patterns");l(this,"currentPatternIndex",0);l(this,"currentRenderer",null);l(this,"loopConfig");l(this,"currentLoopCount",0);l(this,"transitionDuration");l(this,"patternOverrides");l(this,"completionCallback",null);l(this,"patternStore");l(this,"canvas");l(this,"ctx");l(this,"width",0);l(this,"height",0);this.patterns=e.patterns,this.loopConfig=e.loop??!1,this.transitionDuration=e.transitionDuration??0,this.patternOverrides=e.patternOverrides??{},this.patternStore=e.patternStore??new Map,this.canvas=document.createElement("canvas");const s=this.canvas.getContext("2d");if(!s)throw new Error("2D canvas not supported");if(this.ctx=s,this.patterns.length===0)throw new Error("SequenceRenderer requires at least one pattern");this.loadCurrentPattern()}loadCurrentPattern(){var n,i,a,c;const e=this.patterns[this.currentPatternIndex],s=this.patternStore.get(e);if(!s){console.warn(`Pattern "${e}" not found in store, skipping`),this.moveToNextPattern();return}this.currentRenderer&&((i=(n=this.currentRenderer).dispose)==null||i.call(n));const r=this.patternOverrides[e]??{},o={...s.data,...r};try{this.currentRenderer=Yr({mode:s.type,data:o}),this.currentRenderer&&this.isDoneAware(this.currentRenderer)&&this.currentRenderer.onDone(()=>{this.handlePatternComplete()}),this.currentRenderer&&(this.currentRenderer.reset(),(c=(a=this.currentRenderer).play)==null||c.call(a),this.width>0&&this.height>0&&this.currentRenderer.renderFrame(this.width,this.height))}catch(u){console.error(`Failed to create renderer for pattern "${e}":`,u),this.moveToNextPattern()}}isDoneAware(e){return typeof(e==null?void 0:e.onDone)=="function"}handlePatternComplete(){this.transitionDuration>0?setTimeout(()=>{this.moveToNextPattern()},this.transitionDuration):this.moveToNextPattern()}moveToNextPattern(){this.currentPatternIndex++,this.currentPatternIndex>=this.patterns.length?this.loopConfig===!0?(this.currentPatternIndex=0,this.loadCurrentPattern()):typeof this.loopConfig=="number"&&this.currentLoopCount<this.loopConfig-1?(this.currentLoopCount++,this.currentPatternIndex=0,this.loadCurrentPattern()):this.completionCallback&&this.completionCallback():this.loadCurrentPattern()}reset(){this.currentPatternIndex=0,this.currentLoopCount=0,this.loadCurrentPattern()}play(){var e,s;(s=(e=this.currentRenderer)==null?void 0:e.play)==null||s.call(e)}pause(){var e,s;(s=(e=this.currentRenderer)==null?void 0:e.pause)==null||s.call(e)}renderFrame(e,s){this.width=e,this.height=s,this.canvas.width=e,this.canvas.height=s,this.currentRenderer&&this.currentRenderer.renderFrame(e,s)}readPixels(e,s){return this.currentRenderer?this.currentRenderer.readPixels(e,s):this.ctx.getImageData(0,0,e,s).data}onDone(e){this.completionCallback=e}isOneShot(){var e,s;return this.loopConfig===!1||this.loopConfig===1?this.patterns.length===1&&this.currentRenderer?((s=(e=this.currentRenderer).isOneShot)==null?void 0:s.call(e))??!1:!0:!1}dispose(){var e,s;this.currentRenderer&&((s=(e=this.currentRenderer).dispose)==null||s.call(e)),this.completionCallback=null}setPatternStore(e){this.patternStore=e,this.patterns.length>0&&this.loadCurrentPattern()}}const QE=Pi(St);class XE extends QE{constructor(s={r:0,g:0,b:0}){super();l(this,"color");let r;s.color!==void 0?r=s.color:s.r!==void 0&&s.g!==void 0&&s.b!==void 0?r={r:s.r,g:s.g,b:s.b}:r={r:0,g:0,b:0},this.color=Gr(r)}setColor(s){this.color=Gr(s),this.resetOneShot()}reset(){this.resetOneShot()}renderFrame(s,r){this.isOneShotDone||(this.canvas.width=s,this.canvas.height=r,this.ctx.fillStyle=this.color,this.ctx.fillRect(0,0,s,r),this.signalDoneIfNeeded())}}class ZE extends St{constructor({minHue:s=0,maxHue:r=360,speed:o=1}={}){super();l(this,"offset",0);l(this,"minHue");l(this,"maxHue");l(this,"speed");this.minHue=s,this.maxHue=r,this.speed=o}reset(){this.offset=0,this.lastUpdate=performance.now()}hslToRgb(s,r,o){let n,i,a;if(r===0)n=i=a=o;else{const c=(h,f,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?h+(f-h)*6*p:p<.5?f:p<.6666666666666666?h+(f-h)*(.6666666666666666-p)*6:h),u=o<.5?o*(1+r):o+r-o*r,d=2*o-u;n=c(d,u,s+1/3),i=c(d,u,s),a=c(d,u,s-1/3)}return[Math.round(n*255),Math.round(i*255),Math.round(a*255)]}renderFrame(s,r){this.shouldStep(50)&&(this.offset=(this.offset+this.speed)%s);const o=this.ctx.createImageData(s,r),n=o.data;let i=0;for(let a=0;a<r;a++)for(let c=0;c<s;c++){const u=(c+this.offset)%s/s,d=this.minHue/360+u*((this.maxHue-this.minHue)/360),[h,f,p]=this.hslToRgb(d,1,.5);n[i++]=h,n[i++]=f,n[i++]=p,n[i++]=255}this.ctx.putImageData(o,0,0)}}const Ba=new Map;Zt(re,{register(t,e){Ba.set(t,e)},execute(t,e){const s=Ba.get(t);return s?new s(e):null}});T.canvas.registerRenderer("video",qE);T.canvas.registerRenderer("video-basic",Vd);T[re].register("image-static",Gd);T[re].register("image-scrolling",Wd);const JE=class{constructor(t){var e;return(e=t.scroll)!=null&&e.enabled?new Wd(t):new Gd(t)}};T[re].register("image",JE);T[re].register("color",XE);T[re].register("matrix",VE);T[re].register("sweep",ZE);T[re].register("gradient",KE);T[re].register("drop",jE);T[re].register("sequence",WE);T[re].register("text",YE);const eM=class{constructor(t){const e=(s,r)=>{const o=Yr({mode:s,data:r});if(!o)throw new Error(`Failed to create renderer of type: ${s}`);return o};return new GE(t,e)}};T[re].register("overlay",eM);const Yr=({mode:t,data:e})=>{const s=T[re].execute(t,e);if(s)return s;throw new Error(`Unknown mode: ${t}`)};var tM=Object.defineProperty,sM=Object.getOwnPropertyDescriptor,is=(t,e,s,r)=>{for(var o=r>1?void 0:r?sM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&tM(e,s,o),o};const Qd="canvas-dispatcher-model";function rM(t){if(t=t.replace(/^#/,""),t.length===3&&(t=t.split("").map(s=>s+s).join("")),t.length!==6)return null;const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}}let rt=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_content",new Map);l(this,"_patterns",new Map);l(this,"_endpointRenderers");l(this,"pattern");l(this,"data");this.id=t,this.logger=s.logger,this._endpointRenderers=new Fe}addNamedEndpoint(t,e){this._endpointRenderers.getModel(t)&&this.logger.warn(`Endpoint "${t}" already exists. Overwriting.`);const s=Ri.instance(t).options({apiPath:e.apiPath,width:e.width,height:e.height,fps:e.fps,durationMs:e.durationMs??null,endpoint:t}).build();return this._endpointRenderers.addModel(s),s}addContent(t,e){this._content.has(t)&&this.logger.warn(`Content "${t}" already exists. Overwriting.`),this._content.set(t,e)}addPattern(t,e){this._patterns.has(t)&&this.logger.warn(`Pattern "${t}" already exists. Overwriting.`),this._patterns.set(t,e)}async handlePatternsPost(t,e){var o,n;const s=t.body,r=Array.isArray(s)?s:[s];if(r.some(i=>!i.id||!i.type||!i.data)){(o=e.status)==null||o.call(e,400).send({error:"Invalid pattern data"});return}for(const i of r)this._patterns.has(i.id)&&this.logger.warn(`Pattern "${i.id}" already exists. Overwriting.`),this.addPattern(i.id,i);(n=e.status)==null||n.call(e,200).send({status:"OK"})}async handlePatternApplication(t,e){var u,d,h;const s=t.params.pattern,r=t.params.endpoint,o=this._endpointRenderers.getModel(r);if(!o){(u=e.status)==null||u.call(e,404).send({error:`Endpoint "${r}" not found`});return}if(!this._patterns.has(s)){(d=e.status)==null||d.call(e,404).send({error:`Pattern "${s}" not found`});return}const n=this._patterns.get(s),i=n.type,a=t.body||{};this.data={...n.data,...a};const c=i==="sequence"?{...this.data,patternStore:this._patterns}:this.data;o.renderer=Yr({mode:i,data:c}),o.setClearOnComplete(n.clearOnComplete),o.startStreaming(),(h=e.status)==null||h.call(e,200).send({status:"OK"})}async handleColorApplication(t,e){var u,d,h;const s=t.params.color,r=rM(s);if(!r){(u=e.status)==null||u.call(e,400).send({error:"Invalid color format"});return}const o=t.params.endpoint,n=this._endpointRenderers.getModel(o);if(!n){(d=e.status)==null||d.call(e,404).send({error:`Endpoint "${o}" not found`});return}const{r:i,b:a,g:c}=r;n.renderer=Yr({mode:"color",data:{r:i,g:c,b:a}}),n.startStreaming(),(h=e.status)==null||h.call(e,200).send({status:"OK"})}async handleEndpointCreation(t,e){var r,o;const s=t.body;if(!s.apiPath||!s.id){(r=e.status)==null||r.call(e,400).send({error:"Name and path are required"});return}this.addNamedEndpoint(s.id,s),(o=e.status)==null||o.call(e,200).send({status:"OK"})}async load(t){var s;const e=t==null?void 0:t.get(zt.loader);e&&((s=e.patterns)==null||s.forEach(r=>{if(!r.id||!r.type||!r.data){this.logger.warn(`Invalid pattern data: ${JSON.stringify(r)}`);return}this.addPattern(r.id,r)}))}};is([Oe],rt.prototype,"_endpointRenderers",2);is([Xs("/api/ui/canvas/patterns")],rt.prototype,"handlePatternsPost",1);is([Xs("/api/ui/canvas/pattern/:endpoint/:pattern")],rt.prototype,"handlePatternApplication",1);is([Xs("/api/ui/canvas/color/:endpoint/:color")],rt.prototype,"handleColorApplication",1);is([Xs("/api/ui/canvas/endpoint")],rt.prototype,"handleEndpointCreation",1);rt=is([D(Qd)],rt);const zt=new Ce({class:rt,type:Qd}),{URL:ki}=fe(),{getOne:Xd}=ce.build({basePath:`${ki}/api/device`}),Wr=g.createLogger({name:"device-service",group:"Services"}),Zd=async()=>{Wr.debug("sending GET for device serial number");try{const t=await Xd({urlOverride:`${ki}/api/kos/device/serialNumber`});return[void 0,t==null?void 0:t.data.serialNumber]}catch(t){if(t instanceof z)return Wr.error(`Error fetching device serial number: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},Jd=async()=>{Wr.debug("sending GET for device details");try{const t=await Xd({urlOverride:`${ki}/api/kos/device`});return t?[void 0,t.data]:["unknownError",void 0]}catch(t){if(t instanceof z)return Wr.error(`Error fetching device serial number: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},oM=Object.freeze(Object.defineProperty({__proto__:null,getDeviceDetails:Jd,getSerialNumber:Zd},Symbol.toStringTag,{value:"Module"}));var nM=Object.defineProperty,iM=Object.getOwnPropertyDescriptor,eh=(t,e,s,r)=>{for(var o=r>1?void 0:r?iM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&nM(e,s,o),o};const th="device-model",aM="/kos/criticalData/changed",cM="/kos/criticalData/available";let Qr=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_serialNumber");l(this,"_name");l(this,"_nodeId");this.id=t,this.logger=s.logger,this._serialNumber="unassigned",this._name="unassigned",this._nodeId="unassigned"}get serialNumber(){return this._serialNumber}get name(){return this._name}get nodeId(){return this._nodeId}get nodeType(){const[t]=this.nodeId.split("-");return t}get nodeName(){const[,t]=this.nodeId.split("-");return t}updateModel(t){this._serialNumber=t.serialNumber??"unassigned",this._name=t.name??"unassigned",this._nodeId=t.nodeId??"unassigned"}async loadDeviceData(){const[t,e]=await Jd();if(t){this.logger.error(`Error fetching device serial number: ${t}`);return}if(e){const{name:s,nodeId:r}=e;this.updateModel({name:s,nodeId:r,serialNumber:this.serialNumber})}}async loadSerialNumber(){const[t,e]=await Zd();if(t){this.logger.error(`Error fetching device serial number: ${t}`);return}this.updateModel({serialNumber:e,name:this.name,nodeId:this.nodeId})}async handleCriticalDataChanged(){this.logger.debug(`Critical data changed for device ${this.id}`),await this.loadSerialNumber()}async init(){this.logger.debug(`initializing device ${this.id}`)}async load(){this.logger.debug(`loading device ${this.id}`),await this.loadDeviceData(),await this.loadSerialNumber()}};eh([B({topic:[aM,cM],websocket:!0})],Qr.prototype,"handleCriticalDataChanged",1);Qr=eh([D(th)],Qr);const Xr=new Ce({class:Qr,type:th});var lM=Object.getOwnPropertyDescriptor,uM=(t,e,s,r)=>{for(var o=r>1?void 0:r?lM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const sh="network-interface-model";let fn=class{constructor(t,e,s){l(this,"id");l(this,"name");l(this,"type");l(this,"nmdevicestate");l(this,"hwaddress");l(this,"mtu");l(this,"configured");l(this,"wifi");l(this,"ethernet");l(this,"ip4settings");l(this,"category");l(this,"logger");this.id=t,this.logger=s.logger,this.name=e.name,this.type=e.type,this.nmdevicestate=e.nmdevicestate,this.hwaddress=e.hwaddress,this.mtu=e.mtu,this.configured=e.configured,this.wifi=e.wifi,this.ethernet=e.ethernet,this.ip4settings=e.ip4settings,this.category=e.category}updateModel(t){this.name=t.name,this.type=t.type,this.nmdevicestate=t.nmdevicestate,this.hwaddress=t.hwaddress,this.mtu=t.mtu,this.configured=t.configured,this.wifi=t.wifi,this.ethernet=t.ethernet,this.ip4settings=t.ip4settings,this.category=t.category}async init(){this.logger.debug(`initializing network-interface ${this.id}`)}async load(){this.logger.debug(`loading network-interface ${this.id}`)}};fn=uM([D(sh)],fn);const Li=new Ee({class:fn,type:sh}),{URL:dM}=fe(),{getAll:hM}=ce.build({basePath:`${dM}/api/kos/network/interfaces`}),fM=Oi(),Ka=g.createLogger({name:"network-interface-service",group:"Services"}),rh=async()=>{Ka.debug("sending GET for copy-logs");try{const t=await hM({destinationAddress:fM});return[void 0,t==null?void 0:t.data]}catch(t){if(t instanceof z)return Ka.error(`Error fetching log file size: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},pM=Object.freeze(Object.defineProperty({__proto__:null,getNetworkInterfaces:rh},Symbol.toStringTag,{value:"Module"}));var gM=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,oh=(t,e,s,r)=>{for(var o=r>1?void 0:r?mM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&gM(e,s,o),o};const nh="network-interface-container-model";let Zr=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t,indexMap:{byCategory:"category"}})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}async init(){this.logger.debug(`initializing network-interface-container container ${this.id}`)}async refreshInterfaces(){this.logger.debug("refreshing interfaces");const[t,e]=await rh();if(t){this.logger.error(`Error loading network interfaces: ${t}`);return}e&&e.forEach(s=>{const r=Li.instance(s.name).forceUpdate.options(s).build();this.addModel(r)})}async load(){this.logger.debug(`loading network-interface-container container ${this.id}`),this.refreshInterfaces()}};oh([Oe],Zr.prototype,"_models",2);Zr=oh([D(nh)],Zr);const Hs=new Ce({class:Zr,type:nh});Hs.addRelatedModel(Li);const{URL:yM}=fe(),{getAll:bM}=ce.build({basePath:`${yM}/api/kos/storage/devices`}),Ha=g.createLogger({name:"storage-device-service",group:"Services"}),ih=async()=>{Ha.debug("sending GET for storage-device");const t=await bM({});return!(t!=null&&t.data)||t.status!==200?(Ha.error("Failed to retrieve storage-device data",t),[]):t.data},vM=Object.freeze(Object.defineProperty({__proto__:null,getStorageDevices:ih},Symbol.toStringTag,{value:"Module"}));var wM=Object.getOwnPropertyDescriptor,EM=(t,e,s,r)=>{for(var o=r>1?void 0:r?wM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const ah="storage-device-model";let pn=class{constructor(t,e,s){l(this,"id");l(this,"mountDir");l(this,"removed");l(this,"vendor");l(this,"runTimeMs");l(this,"model");l(this,"nodeId");l(this,"local");l(this,"label");l(this,"syspath");l(this,"logger");this.id=t,this.logger=s.logger,this.mountDir=e.mountDir,this.removed=e.removed,this.vendor=e.vendor,this.runTimeMs=e.runTimeMs,this.model=e.model,this.nodeId=e.nodeId,this.local=e.local,this.label=e.label,this.syspath=e.syspath}updateModel(t){this.mountDir=t.mountDir,this.removed=t.removed,this.vendor=t.vendor,this.runTimeMs=t.runTimeMs,this.model=t.model,this.nodeId=t.nodeId,this.local=t.local,this.label=t.label,this.syspath=t.syspath}async init(){this.logger.debug(`initializing storage-device ${this.id}`)}async load(){this.logger.debug(`loading storage-device ${this.id}`)}};pn=EM([lo(),D(ah)],pn);const Jr=new Ee({class:pn,type:ah});var MM=Object.defineProperty,_M=Object.getOwnPropertyDescriptor,Fi=(t,e,s,r)=>{for(var o=r>1?void 0:r?_M(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&MM(e,s,o),o};const ch="storage-device-container-model",TM="/kos/storage";let qs=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}async init(){this.logger.debug(`initializing storage-device-container container ${this.id}`)}get isStorageInserted(){return this.data.length>0}get volumes(){return this.data}handleStorageAvailability(t){this._models.data.filter(s=>!t.find(r=>r.id===s.id)).forEach(s=>{this.removeModel(s.id)}),t.forEach(s=>{const r=this.getModel(s.id);if(r){const o={...s,kosParentId:this.id};r.updateModel(o)}else{const o={...s,kosParentId:this.id},n=Jr.instance(s.id).options(o).build();this.addModel(n)}})}async load(){this.logger.debug(`loading storage-device-container container ${this.id}`),(await ih()).forEach(e=>{if(e.deviceType!=="disk"){const s={...e,kosParentId:this.id},r=Jr.instance(e.id).options(s).build();this.addModel(r)}})}};Fi([Oe],qs.prototype,"_models",2);Fi([B({topic:TM,websocket:!0})],qs.prototype,"handleStorageAvailability",1);qs=Fi([D(ch)],qs);const Vt=new Ce({class:qs,type:ch});Vt.addRelatedModel(Jr);const{URL:Ni}=fe(),{getAll:SM,postModel:$M}=ce.build({basePath:`${Ni}/api/kos/update/available`}),qa=g.createLogger({name:"usb-update-service",group:"Services"}),lh=async()=>{qa.debug("sending GET for usb-update");const t=await SM({urlOverride:`${Ni}/api/kos/update/available`});return!(t!=null&&t.data)||(t==null?void 0:t.status)!==200?(qa.error("Failed to retrieve usb-update data",t),[]):t.data},uh=async(t,e,s)=>{const r=await $M({model:{manifestId:t,deviceId:e},tracker:s,urlOverride:`${Ni}/api/kos/update/install`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data},OM=Object.freeze(Object.defineProperty({__proto__:null,getAvailableUpdates:lh,installUpdate:uh},Symbol.toStringTag,{value:"Module"}));var IM=Object.defineProperty,CM=Object.getOwnPropertyDescriptor,dh=(t,e,s,r)=>{for(var o=r>1?void 0:r?CM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&IM(e,s,o),o};const hh="usb-update-model";let eo=class{constructor(t,e,s){l(this,"id");l(this,"active");l(this,"blocked");l(this,"createTime");l(this,"deviceId");l(this,"manifestId");l(this,"notes");l(this,"futureHandler");l(this,"logger");this.id=t,this.logger=s.logger,this.active=e.active,this.blocked=e.blocked,this.createTime=e.createTime,this.deviceId=e.deviceId,this.manifestId=e.manifestId,this.notes=e.notes,this.futureHandler=new po(this)}updateModel(t){this.active=t.active,this.blocked=t.blocked,this.createTime=t.createTime,this.deviceId=t.deviceId,this.manifestId=t.manifestId,this.notes=t.notes}reset(){this.futureHandler.removeFuture()}get future(){return this.futureHandler.future}async install(t){if(!t)throw new Error("No tracker provided");return this.logger.info(`Installing update for manifest ${this.manifestId} from device ${this.deviceId}`),uh(this.manifestId,this.deviceId,t)}async init(){this.logger.debug(`initializing usb-update ${this.id}`)}async load(){this.logger.debug(`loading usb-update ${this.id}`)}};dh([Do()],eo.prototype,"install",1);eo=dh([D(hh)],eo);const Ui=new Ee({class:eo,type:hh});var DM=Object.defineProperty,xM=Object.getOwnPropertyDescriptor,Co=(t,e,s,r)=>{for(var o=r>1?void 0:r?xM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&DM(e,s,o),o};const fh="usb-update-container-model";let Gt=class{constructor(t,e,s){l(this,"id");l(this,"disposer");l(this,"storageService");l(this,"_activeUpdate");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}get activeUpdate(){return this._activeUpdate}reset(){this.clearActiveUpdate()}clearActiveUpdate(){this._activeUpdate=void 0}updateActiveUpdate(t){this._activeUpdate=t}get isUsbInserted(){return this.storageService.isStorageInserted}get hasAvailableUpdates(){return this._models.data.length>0}async syncAvailableUpdates(){const t=await lh();ee(()=>{const e=t.map(s=>`${s.deviceId}-${s.manifestId}`);this._models.data.filter(s=>!e.includes(s.id)).forEach(s=>this.removeModel(s.id)),t.forEach(s=>{const r=`${s.deviceId}-${s.manifestId}`,o=Ui.instance(r).forceUpdate.options({...s,createTime:new Date(s.createTime)}).build();this.addModel(o)}),this.data.length===1?this.updateActiveUpdate(this.data[0]):this.clearActiveUpdate()})}usbInsertedEffect(){this.isUsbInserted?this.syncAvailableUpdates():(this._models.clear(),this.clearActiveUpdate())}async init(){this.logger.debug(`initializing usb-update-container container ${this.id}`)}unload(){var t;(t=this.disposer)==null||t.call(this)}async activate(){this.logger.debug(`activating usb-update-container container ${this.id}`),await this.syncAvailableUpdates()}async load(){this.logger.debug(`loading usb-update-container container ${this.id}`)}};Co([Xt({modelType:Vt.type})],Gt.prototype,"storageService",2);Co([Oe],Gt.prototype,"_models",2);Co([qc({dependencies:t=>[t.isUsbInserted]})],Gt.prototype,"usbInsertedEffect",1);Gt=Co([D(fh)],Gt);const zs=new Ce({class:Gt,type:fh});zs.addRelatedModel(Ui);const AM=()=>({...{[ts.type]:{class:Uu},[st.type]:{class:Ku,singleton:!0},...ae.registration,...Et.registration,...Ht.registration,...qr.registration,...Ve.registration,[xi.type]:{class:exports.WsEventModel,singleton:!0},...Ks.registration,...Ci.registration,...kr.registration}}),ji=AM(),RM={models:ji,preloadModels:[]},PM=!0,ph=t=>()=>{const e=ji;return nl(gn)(Bs).model(Ht).model(Vt).model(zs).model(Xr).model(jr).model(Rs).model(Br).model(bi).model(Hs).model(zt).model(Ri).model(Ju).model(gi,PM).model(tr).model(sd),Object.keys(e).forEach(s=>{const r=e[s];ol(gn)(s,r)}),{preload:R.model.preloadModel(t),model:R.model.register(t),companion:R.companion.register(t),legacy:R.model.registerLegacyModel(t)}},$e={};$e.core={models:ph($e)};$e.preload=R.model.preloadModel($e);$e.model=R.model.register($e);$e.companion=R.companion.register($e);$e.legacy=R.model.registerLegacyModel($e);const gn=$e;class kM{registerTroubleRankMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleRank,e,s),this}registerTroubleRoleMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleRole,e,s),this}registerTroubleColorMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleColor,e,s),this}registerModelLoader(e,s,r){T.loader.registerLoader(e,s,r)}registerRegionServicePathMapper(e){return T.propertyMapper.registerPropertyMapper(te.RegionServicePath,e),this}registerCanvasPatternLoader(e,s){T.loader.registerLoader(zt.loader,e,s)}registerConfigServicePathMapper(e){return T.propertyMapper.registerPropertyMapper(te.ConfigServicePath,e),this}}const LM=async(t,e)=>{const s=bi.instance(t).options({}).build(),r=e?`${e}-`:"";return await ye(s),{getState:o=>s.data[`${r}${o}`],updateState:async(o,n)=>{await s.updateState(`${r}${o}`,n)},clean:async()=>{for(const o of s.data.keys)await s.updateState(`${r}${o}`,void 0)},unsubscribe:()=>{Re(s)}}},gh="kos:service:region",mh="regionId",FM=`${gh}-${mh}`,yh=async t=>{const e=Et.factory(FM)({path:gh,attribute:mh});await ye(e),e.updateProperty(t)};async function NM(){const{default:t}=await Promise.resolve().then(()=>Wn);return t}function UM(t){return Ye(t)}const za=De(),jM=Object.freeze(Object.defineProperty({__proto__:null,api:za,default:za,kosServiceRequest:UM},Symbol.toStringTag,{value:"Module"}));function BM(t){return Ye(t)}const Va=De(),KM=Object.freeze(Object.defineProperty({__proto__:null,api:Va,default:Va,kosServiceRequest:BM},Symbol.toStringTag,{value:"Module"}));function HM(t){return Ye(t)}const Ga=De(),qM=Object.freeze(Object.defineProperty({__proto__:null,api:Ga,default:Ga,kosServiceRequest:HM},Symbol.toStringTag,{value:"Module"}));function bh(t){return Ye(t)}const mn=De(),zM=Object.freeze(Object.defineProperty({__proto__:null,api:mn,default:mn,kosServiceRequest:bh},Symbol.toStringTag,{value:"Module"}));function VM(t){return Ye(t)}const Ya=De(),GM=Object.freeze(Object.defineProperty({__proto__:null,api:Ya,default:Ya,kosServiceRequest:VM},Symbol.toStringTag,{value:"Module"}));function YM(t){return Ye(t)}const Wa=De(),WM=Object.freeze(Object.defineProperty({__proto__:null,api:Wa,default:Wa,kosServiceRequest:YM},Symbol.toStringTag,{value:"Module"}));function QM(t){return Ye(t)}const Qa=De(),XM=Object.freeze(Object.defineProperty({__proto__:null,api:Qa,default:Qa,kosServiceRequest:QM},Symbol.toStringTag,{value:"Module"}));function ZM(t){return Ye(t)}const Xa=De(),JM=Object.freeze(Object.defineProperty({__proto__:null,api:Xa,default:Xa,kosServiceRequest:ZM},Symbol.toStringTag,{value:"Module"})),Bi="/kos-timer-event",Ki="/kos-timer-event/tick",Hi="defaultTimerEnd",ys=g.createLogger({name:"timer-manager"}),e_=t=>t.updateProperty!==void 0;class vh{constructor(e,s,r){l(this,"name");l(this,"timeout");l(this,"timer");l(this,"state","inactive");l(this,"decrementValue",1);l(this,"remainingTime");l(this,"timeoutActions",new Map);this.name=e;const o=typeof s=="number"?s:s.value||60;this.timeout=o,this.state="inactive",this.remainingTime=o,e_(s)&&X(()=>{g.info(`Updating config value timer ${e} with new timeout value ${s.value}`);const n=s.value||60;this.updateTimeout(n)}),this.addTimeoutAction({name:Hi}),r&&r.forEach(n=>{this.addTimeoutAction(n)})}get id(){return this.name}start(){if(this.state==="active"){ys.debug(`Timer ${this.name} already started`);return}(this.state==="inactive"||this.state==="paused")&&(this.state="active",this.timer=setInterval(()=>this.updateTimer(),1e3))}pause(){this.timer&&(ys.debug(`Pausing timer ${this.name}`),this.state="paused",clearInterval(this.timer))}restart(){this.pause(),this.remainingTime=this.timeout,this.start()}reset(){this.pause(),this.remainingTime=this.timeout,this.state="inactive"}updateTimeout(e){this.timeout=e,this.restart()}addTimeoutAction(e){const s=e.remainingTime??0;this.timeoutActions.has(s)||this.timeoutActions.set(s,[]);const r=e.name,o=this.timeoutActions.get(s).find(n=>n.name===r);o?o.action=e.action:this.timeoutActions.get(s).push(e)}removeTimeoutAction(e){for(const[s,r]of this.timeoutActions.entries()){const o=r.filter(n=>n.name!==e);o.length===0?this.timeoutActions.delete(s):this.timeoutActions.set(s,o)}}updateTimer(){if(this.remainingTime=Math.round((this.remainingTime-this.decrementValue)*100)/100,this.remainingTime<=0){this.state==="active"&&this.executeActions(0),this.pause();return}this.state==="active"&&this.executeActions(this.remainingTime)}executeActions(e){this.timeoutActions.has(e)&&this.timeoutActions.get(e).forEach(s=>{var r;ys.debug(`Executing timer action ${s.name} at ${e}`),(r=s.action)==null||r.call(s,s.name,e),this.notifyTimeoutAction(s),s.singleUse&&(ys.info(`${this.name} Removing single-use action ${s.name}`),this.removeTimeoutAction(s.name))}),this.notifyTick()}notifyTick(){H(`${Ki}/${this.name}`,{name:this.name,remainingTime:this.remainingTime})}notifyTimeoutAction(e){H(Bi,{name:this.name,action:e.name,remainingTime:this.remainingTime})}}const bs=new Map,Dt=(t,e)=>{const s=bs.get(t);if(!s){ys.error(`Timer ${t} not found`);return}e(s)},wh={createRelativeTimer(t,e,s){const r=new Date,o=Math.round((e.getTime()-r.getTime())/1e3);return this.createTimer(t,o,s)},createTimer(t,e=60,s){if(bs.has(t))return bs.get(t);const r=new vh(t,e,s);return bs.set(t,r),r},getTimer(t){return bs.get(t)},clearTimer(t){Dt(t,e=>e.pause())},restartTimer(t){Dt(t,e=>e.restart())},resetTimer(t){Dt(t,e=>e.reset())},addTimeoutAction(t,e){Dt(t,s=>s.addTimeoutAction(e))},removeTimeoutAction(t,e){Dt(t,s=>s.removeTimeoutAction(e))},startTimer(t){Dt(t,e=>e.start())}},Eh="kos:service:region:settings",Mh="timeZone",t_=`${Eh}-${Mh}`,yn=async t=>{const e=Et.factory(t_)({path:Eh,attribute:Mh});await ye(e),e.updateProperty(t)},s_=t=>!t||!t.data;function qi(t,e,s={}){const{alias:r,namespace:o,abortController:n=!1,trackerPolicy:i="id"}=s;return async function(...a){const c=wt();g.debug(`Calling future service ${e} with tracker ${c}`);let u,d;n&&(u=new AbortController);const h=mt.initiateFuture({tracker:c,id:oi});o&&(h.namespace=o),g.debug(`waiting for future ${h.id} to be ready`),await ye(h),g.debug(`future ${h.id} is ready`),ee(()=>{g.debug(`Adding future ${h.id} to futureHandler`),this.futureHandler.addFuture(h,r)}),n&&u&&(d=X(()=>{(h.status==="CANCELLED"||h.endState===tt.Canceled)&&(g.debug(`Future ${h.id} cancelled, aborting request`),u==null||u.abort())}),u.signal.addEventListener("abort",async()=>{if(h.status!=="CANCELLED"&&h.endState!==tt.Canceled&&!h.endState){g.debug(`AbortController aborted, cancelling future ${h.id}`);try{await h.cancelFuture()}catch(p){g.error(`Failed to cancel future ${h.id}:`,p)}}},{once:!0}));const f=()=>{d&&(d(),d=void 0)};try{const p=[...a];if(n&&u){const M=p[p.length-1];M&&typeof M=="object"&&"aborted"in M?p[p.length-1]=u.signal:p.push(u.signal)}if(i==="context"){const M=p[p.length-1];if(Kn(M))M.$tracker=c;else{const $={[ho]:!0,$tracker:c};p.push($)}}else p.push(c);const y=await t.apply(this,p);g.debug(`received future response for ${c}`,y);const b=s_(y)?y:y==null?void 0:y.data;return b?(b.progress=1,g.debug("mapping future response to future model"),h.endState?g.debug(`future ${h.id} has already completed. Not updating the model`):fi(b,h)):this.futureHandler.removeFuture(r),f(),b}catch(p){if(f(),n&&(u!=null&&u.signal.aborted)){const y=new Error("Operation cancelled");throw g.debug(`Operation ${e} was cancelled`),y}throw g.error(p),p}}}Zt(Jc,{register:()=>{},execute:()=>qi});function Do(t={}){const{alias:e}=t;return(s,r,o)=>{s[Es]=s[Es]||{},e&&(s[Ts]=s[Ts]||new Map,s[Ts].set(r,e));const n=o.value,i=qi(n,r,t);s[Es][r]={handler:i}}}const r_=({path:t})=>(e,s)=>{e[F]=e[F]||{},e[F][s]={modelType:Ks.type,id:`${Ks.type}-${t}`,options:{path:t},lifecycle:I.INIT}};function o_(t){const{path:e,attribute:s}=t;return(r,o)=>{r[F]=r[F]||{},r[F][o]={modelType:Ci.type,id:`${e}-${s}`,options:{path:e,attribute:s},lifecycle:I.INIT}}}const kt=g.createLogger({name:"services",group:"Services"}),n_=async(t,e)=>_h(t,e,`${exports.BASE_URL}/api/server/login`),_h=async(t,e,s=`${exports.BASE_URL}/api/login`)=>{const r=await exports.kosFetch(`${s}`,{method:"POST",destinationAddress:"",body:JSON.stringify({email:t,password:e})});if(!r.ok){const n=await r.json();throw Error(`${n==null?void 0:n.error}`)}return await r.json()},i_=async t=>Th(t,`${exports.BASE_URL}/api/server/startPasswordReset`,""),Th=async(t,e=`${exports.BASE_URL}/api/startPasswordReset`,s="server")=>{const r=await exports.kosFetch(`${e}?email=${t}`,{method:"POST",destinationAddress:s});if(!r.ok)throw Error(`There was a problem reseting config; returned status ${r.status}`);return await r.json()},a_=async(t,e)=>Sh(t,e,`${exports.BASE_URL}/api/server/resetPassword`),Sh=async(t,e,s=`${exports.BASE_URL}/api/resetPassword`)=>{kt.debug(`resetting password with token ${t} and password ${e.replace(/./g,"*")}`);const r=await exports.kosFetch(`${s}`,{method:"POST",destinationAddress:"",body:JSON.stringify({token:t,password:e})});if(kt.debug(`password reset returned status ${r.status}`),!r.ok){kt.error(`password reset failed with message ${r.statusText}`);const n=await r.json();throw Error(`${n==null?void 0:n.error}:There was a problem resetting the password.`)}return await r.json()},c_=async(t,e,s)=>$h(t,e,s,`${exports.BASE_URL}/api/server/acceptInvite`),$h=async(t,e,s,r=`${exports.BASE_URL}/api/server/acceptInvite`)=>{kt.debug(`accepting invite with token ${t} and password ${e.replace(/./g,"*")}`);const o=await exports.kosFetch(`${r}`,{method:"POST",destinationAddress:"",body:JSON.stringify({token:t,password:e,name:s})});if(kt.debug(`invitation accept returned status ${o.status}`),!o.ok){kt.error(`invite failed with message ${o.statusText}`);const i=await o.json();throw Error(`${i==null?void 0:i.error}:There was a problem accepting the invite.`)}return await o.json()};function l_(t,e,s,r){const o=t instanceof Promise?{promise:t,abortController:e,cancelFuture:s,future:r}:t,{promise:n,abortController:i,cancelFuture:a,future:c}=o,u=n;let d=0,h="PENDING",f=!0;const p=new Set;let y;return c&&typeof c=="object"&&(y=E.autorun(()=>{const b=c.progress||0,M=c.status||"PENDING",$=!c.endState;(b!==d||M!==h||$!==f)&&(d=b,h=M,f=$,p.forEach(U=>{try{U(d,h)}catch(A){console.warn("Progress callback error:",A)}}))})),n.finally(()=>{f=!1,i!=null&&i.signal.aborted||(h="COMPLETED",p.forEach(b=>{try{b(d,h)}catch(M){console.warn("Progress callback error:",M)}})),y&&y(),p.clear()}),u.cancel=async()=>{i&&!i.signal.aborted&&i.abort(),a&&await a(),f=!1,h="CANCELLED",p.forEach(b=>{try{b(d,h)}catch(M){console.warn("Progress callback error:",M)}}),y&&y()},u.getController=()=>i,u.isCancelled=()=>(i==null?void 0:i.signal.aborted)??!1,Object.defineProperty(u,"progress",{get:()=>d,enumerable:!0}),Object.defineProperty(u,"status",{get:()=>h,enumerable:!0}),Object.defineProperty(u,"isRunning",{get:()=>f,enumerable:!0}),u.onProgressUpdate=b=>(p.add(b),b(d,h),()=>p.delete(b)),u}const u_=dt.keyframes`
|
|
145
|
+
`),this.fontSize=s.fontSize??8,this.lineHeight=s.lineHeight??this.fontSize+2,this.fontFamily=s.fontFamily??"monospace, 'Lucida Console', 'Courier New', Courier",this.scrollConfig=s.scroll,this.loopConfig=s.loop??!1,this.duration=s.duration,this.pauseDuration=s.pauseBetweenLoops??0,s.color?this.textColor=Gr(s.color):this.textColor="rgb(255,255,255)"}measureText(){if(this.textMeasured)return;this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.lineWidths=[];let s=0;for(const r of this.lines){const n=this.ctx.measureText(r).width;this.lineWidths.push(n),s=Math.max(s,n)}this.textWidth=s,this.textHeight=this.lines.length*this.lineHeight,this.textMeasured=!0}reset(){this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime,this.currentLoopCount=0,this.completed=!1,this.isPlaying=!1,this.isPaused=!1,this.pauseStartTime=0,this.textMeasured=!1,this.lineWidths=[]}play(){this.isPlaying||(this.isPlaying=!0,this.startTime=performance.now(),this.lastFrameTime=this.startTime)}pause(){this.isPlaying=!1}renderFrame(s,r){var a;if(this.canvas.width=s,this.canvas.height=r,this.measureText(),this.completed)return;if(this.isPaused){this.ctx.clearRect(0,0,s,r),this.pauseDuration>0&&performance.now()-this.pauseStartTime>=this.pauseDuration&&(this.isPaused=!1,this.position=0,this.startTime=performance.now(),this.lastFrameTime=this.startTime);return}if(this.ctx.clearRect(0,0,s,r),!((a=this.scrollConfig)!=null&&a.enabled)){this.drawStaticText(s,r),this.duration&&this.isPlaying&&performance.now()-this.startTime>=this.duration&&this.handleCompletion();return}const o=this.scrollConfig.direction||"left",n=this.scrollConfig.speed||50,i=this.scrollConfig.gap||0;if(this.isPlaying){const c=performance.now(),u=(c-this.lastFrameTime)/1e3;this.lastFrameTime=c;const d=n*u;switch(o){case"left":case"right":case"up":case"down":this.position+=d;break}}this.drawScrollingText(s,r,o,i),this.checkScrollCompletion(s,r,o)}drawStaticText(s,r){this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.ctx.fillStyle=this.textColor,this.ctx.textBaseline="top";const o=this.textHeight;let n=(r-o)/2;for(let i=0;i<this.lines.length;i++){const a=this.lines[i],c=this.lineWidths[i],u=(s-c)/2,d=n+i*this.lineHeight;this.ctx.fillText(a,u,d)}}drawScrollingText(s,r,o,n){var c,u,d,h;this.ctx.font=`${this.fontSize}px ${this.fontFamily}`,this.ctx.fillStyle=this.textColor,this.ctx.textBaseline="top";let i,a;o==="left"||o==="right"?(i=0,((c=this.scrollConfig)==null?void 0:c.offsetY)==="center"||((u=this.scrollConfig)==null?void 0:u.offsetY)===void 0?a=(r-this.textHeight)/2:a=this.scrollConfig.offsetY):(((d=this.scrollConfig)==null?void 0:d.offsetX)==="center"||((h=this.scrollConfig)==null?void 0:h.offsetX)===void 0?(i=s/2,this.ctx.textAlign="center"):(i=this.scrollConfig.offsetX,this.ctx.textAlign="left"),a=0),this.drawMultiLineScrollText(o,s,r,n,i,a)}drawMultiLineScrollText(s,r,o,n,i,a){switch(s){case"left":{const c=r-this.position;if(c<r&&c>-this.textWidth&&this.drawTextBlock(c,a,"left"),this.loopConfig&&this.pauseDuration===0&&this.position>n){const u=c+this.textWidth+n;u<r&&this.drawTextBlock(u,a,"left")}break}case"right":{const c=-this.textWidth+this.position;if(c>-this.textWidth&&c<r&&this.drawTextBlock(c,a,"left"),this.loopConfig&&this.pauseDuration===0&&c-n-this.textWidth>-this.textWidth){const u=c-this.textWidth-n;u<r&&this.drawTextBlock(u,a,"left")}break}case"up":{const c=o-this.position;if(c>-this.textHeight&&c<o&&this.drawTextBlock(i,c,"center"),this.loopConfig&&this.pauseDuration===0&&c+this.textHeight+n<o){const u=c+this.textHeight+n;u>-this.textHeight&&this.drawTextBlock(i,u,"center")}break}case"down":{const c=-this.textHeight+this.position;if(c>-this.textHeight&&c<o&&this.drawTextBlock(i,c,"center"),this.loopConfig&&this.pauseDuration===0&&c-n-this.textHeight>-this.textHeight){const u=c-this.textHeight-n;u<o&&this.drawTextBlock(i,u,"center")}break}}}drawTextBlock(s,r,o){for(let n=0;n<this.lines.length;n++){const i=this.lines[n],a=this.lineWidths[n];let c;o==="center"?c=s-a/2:c=s;const u=r+n*this.lineHeight;this.ctx.fillText(i,c,u)}}checkScrollCompletion(s,r,o){if(!this.isPlaying)return;let n=!1;const i=1;switch(o){case"left":n=s-this.position<-this.textWidth-i;break;case"right":n=-this.textWidth+this.position>s+i;break;case"up":n=r-this.position<-this.textHeight-i;break;case"down":n=-this.textHeight+this.position>r+i;break}n&&(this.loopConfig===!1||typeof this.loopConfig=="number"&&this.loopConfig===1?this.handleCompletion():typeof this.loopConfig=="number"&&this.loopConfig>1?(this.currentLoopCount++,this.currentLoopCount>=this.loopConfig?this.handleCompletion():this.startPauseOrNextLoop()):this.loopConfig===!0&&this.startPauseOrNextLoop())}startPauseOrNextLoop(){this.pauseDuration>0?(this.isPaused=!0,this.pauseStartTime=performance.now()):this.position=0}handleCompletion(){this.completed=!0,this.isPlaying=!1,this.completionCallback&&this.completionCallback()}onDone(s){this.completionCallback=s}isOneShot(){var s;return!((s=this.scrollConfig)!=null&&s.enabled)&&!this.loopConfig}dispose(){this.completionCallback=null}}class WE{constructor(e){l(this,"patterns");l(this,"currentPatternIndex",0);l(this,"currentRenderer",null);l(this,"loopConfig");l(this,"currentLoopCount",0);l(this,"transitionDuration");l(this,"patternOverrides");l(this,"completionCallback",null);l(this,"patternStore");l(this,"canvas");l(this,"ctx");l(this,"width",0);l(this,"height",0);this.patterns=e.patterns,this.loopConfig=e.loop??!1,this.transitionDuration=e.transitionDuration??0,this.patternOverrides=e.patternOverrides??{},this.patternStore=e.patternStore??new Map,this.canvas=document.createElement("canvas");const s=this.canvas.getContext("2d");if(!s)throw new Error("2D canvas not supported");if(this.ctx=s,this.patterns.length===0)throw new Error("SequenceRenderer requires at least one pattern");this.loadCurrentPattern()}loadCurrentPattern(){var n,i,a,c;const e=this.patterns[this.currentPatternIndex],s=this.patternStore.get(e);if(!s){console.warn(`Pattern "${e}" not found in store, skipping`),this.moveToNextPattern();return}this.currentRenderer&&((i=(n=this.currentRenderer).dispose)==null||i.call(n));const r=this.patternOverrides[e]??{},o={...s.data,...r};try{this.currentRenderer=Yr({mode:s.type,data:o}),this.currentRenderer&&this.isDoneAware(this.currentRenderer)&&this.currentRenderer.onDone(()=>{this.handlePatternComplete()}),this.currentRenderer&&(this.currentRenderer.reset(),(c=(a=this.currentRenderer).play)==null||c.call(a),this.width>0&&this.height>0&&this.currentRenderer.renderFrame(this.width,this.height))}catch(u){console.error(`Failed to create renderer for pattern "${e}":`,u),this.moveToNextPattern()}}isDoneAware(e){return typeof(e==null?void 0:e.onDone)=="function"}handlePatternComplete(){this.transitionDuration>0?setTimeout(()=>{this.moveToNextPattern()},this.transitionDuration):this.moveToNextPattern()}moveToNextPattern(){this.currentPatternIndex++,this.currentPatternIndex>=this.patterns.length?this.loopConfig===!0?(this.currentPatternIndex=0,this.loadCurrentPattern()):typeof this.loopConfig=="number"&&this.currentLoopCount<this.loopConfig-1?(this.currentLoopCount++,this.currentPatternIndex=0,this.loadCurrentPattern()):this.completionCallback&&this.completionCallback():this.loadCurrentPattern()}reset(){this.currentPatternIndex=0,this.currentLoopCount=0,this.loadCurrentPattern()}play(){var e,s;(s=(e=this.currentRenderer)==null?void 0:e.play)==null||s.call(e)}pause(){var e,s;(s=(e=this.currentRenderer)==null?void 0:e.pause)==null||s.call(e)}renderFrame(e,s){this.width=e,this.height=s,this.canvas.width=e,this.canvas.height=s,this.currentRenderer&&this.currentRenderer.renderFrame(e,s)}readPixels(e,s){return this.currentRenderer?this.currentRenderer.readPixels(e,s):this.ctx.getImageData(0,0,e,s).data}onDone(e){this.completionCallback=e}isOneShot(){var e,s;return this.loopConfig===!1||this.loopConfig===1?this.patterns.length===1&&this.currentRenderer?((s=(e=this.currentRenderer).isOneShot)==null?void 0:s.call(e))??!1:!0:!1}dispose(){var e,s;this.currentRenderer&&((s=(e=this.currentRenderer).dispose)==null||s.call(e)),this.completionCallback=null}setPatternStore(e){this.patternStore=e,this.patterns.length>0&&this.loadCurrentPattern()}}const QE=Pi(St);class XE extends QE{constructor(s={r:0,g:0,b:0}){super();l(this,"color");let r;s.color!==void 0?r=s.color:s.r!==void 0&&s.g!==void 0&&s.b!==void 0?r={r:s.r,g:s.g,b:s.b}:r={r:0,g:0,b:0},this.color=Gr(r)}setColor(s){this.color=Gr(s),this.resetOneShot()}reset(){this.resetOneShot()}renderFrame(s,r){this.isOneShotDone||(this.canvas.width=s,this.canvas.height=r,this.ctx.fillStyle=this.color,this.ctx.fillRect(0,0,s,r),this.signalDoneIfNeeded())}}class ZE extends St{constructor({minHue:s=0,maxHue:r=360,speed:o=1}={}){super();l(this,"offset",0);l(this,"minHue");l(this,"maxHue");l(this,"speed");this.minHue=s,this.maxHue=r,this.speed=o}reset(){this.offset=0,this.lastUpdate=performance.now()}hslToRgb(s,r,o){let n,i,a;if(r===0)n=i=a=o;else{const c=(h,f,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?h+(f-h)*6*p:p<.5?f:p<.6666666666666666?h+(f-h)*(.6666666666666666-p)*6:h),u=o<.5?o*(1+r):o+r-o*r,d=2*o-u;n=c(d,u,s+1/3),i=c(d,u,s),a=c(d,u,s-1/3)}return[Math.round(n*255),Math.round(i*255),Math.round(a*255)]}renderFrame(s,r){this.shouldStep(50)&&(this.offset=(this.offset+this.speed)%s);const o=this.ctx.createImageData(s,r),n=o.data;let i=0;for(let a=0;a<r;a++)for(let c=0;c<s;c++){const u=(c+this.offset)%s/s,d=this.minHue/360+u*((this.maxHue-this.minHue)/360),[h,f,p]=this.hslToRgb(d,1,.5);n[i++]=h,n[i++]=f,n[i++]=p,n[i++]=255}this.ctx.putImageData(o,0,0)}}const Ba=new Map;Zt(re,{register(t,e){Ba.set(t,e)},execute(t,e){const s=Ba.get(t);return s?new s(e):null}});T.canvas.registerRenderer("video",qE);T.canvas.registerRenderer("video-basic",Vd);T[re].register("image-static",Gd);T[re].register("image-scrolling",Wd);const JE=class{constructor(t){var e;return(e=t.scroll)!=null&&e.enabled?new Wd(t):new Gd(t)}};T[re].register("image",JE);T[re].register("color",XE);T[re].register("matrix",VE);T[re].register("sweep",ZE);T[re].register("gradient",KE);T[re].register("drop",jE);T[re].register("sequence",WE);T[re].register("text",YE);const eM=class{constructor(t){const e=(s,r)=>{const o=Yr({mode:s,data:r});if(!o)throw new Error(`Failed to create renderer of type: ${s}`);return o};return new GE(t,e)}};T[re].register("overlay",eM);const Yr=({mode:t,data:e})=>{const s=T[re].execute(t,e);if(s)return s;throw new Error(`Unknown mode: ${t}`)};var tM=Object.defineProperty,sM=Object.getOwnPropertyDescriptor,is=(t,e,s,r)=>{for(var o=r>1?void 0:r?sM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&tM(e,s,o),o};const Qd="canvas-dispatcher-model";function rM(t){if(t=t.replace(/^#/,""),t.length===3&&(t=t.split("").map(s=>s+s).join("")),t.length!==6)return null;const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}}let rt=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_content",new Map);l(this,"_patterns",new Map);l(this,"_endpointRenderers");l(this,"pattern");l(this,"data");this.id=t,this.logger=s.logger,this._endpointRenderers=new Fe}addNamedEndpoint(t,e){this._endpointRenderers.getModel(t)&&this.logger.warn(`Endpoint "${t}" already exists. Overwriting.`);const s=Ri.instance(t).options({apiPath:e.apiPath,width:e.width,height:e.height,fps:e.fps,durationMs:e.durationMs??null,endpoint:t}).build();return this._endpointRenderers.addModel(s),s}addContent(t,e){this._content.has(t)&&this.logger.warn(`Content "${t}" already exists. Overwriting.`),this._content.set(t,e)}addPattern(t,e){this._patterns.has(t)&&this.logger.warn(`Pattern "${t}" already exists. Overwriting.`),this._patterns.set(t,e)}async handlePatternsPost(t,e){var o,n;const s=t.body,r=Array.isArray(s)?s:[s];if(r.some(i=>!i.id||!i.type||!i.data)){(o=e.status)==null||o.call(e,400).send({error:"Invalid pattern data"});return}for(const i of r)this._patterns.has(i.id)&&this.logger.warn(`Pattern "${i.id}" already exists. Overwriting.`),this.addPattern(i.id,i);(n=e.status)==null||n.call(e,200).send({status:"OK"})}async handlePatternApplication(t,e){var u,d,h;const s=t.params.pattern,r=t.params.endpoint,o=this._endpointRenderers.getModel(r);if(!o){(u=e.status)==null||u.call(e,404).send({error:`Endpoint "${r}" not found`});return}if(!this._patterns.has(s)){(d=e.status)==null||d.call(e,404).send({error:`Pattern "${s}" not found`});return}const n=this._patterns.get(s),i=n.type,a=t.body||{};this.data={...n.data,...a};const c=i==="sequence"?{...this.data,patternStore:this._patterns}:this.data;o.renderer=Yr({mode:i,data:c}),o.setClearOnComplete(n.clearOnComplete),o.startStreaming(),(h=e.status)==null||h.call(e,200).send({status:"OK"})}async handleColorApplication(t,e){var u,d,h;const s=t.params.color,r=rM(s);if(!r){(u=e.status)==null||u.call(e,400).send({error:"Invalid color format"});return}const o=t.params.endpoint,n=this._endpointRenderers.getModel(o);if(!n){(d=e.status)==null||d.call(e,404).send({error:`Endpoint "${o}" not found`});return}const{r:i,b:a,g:c}=r;n.renderer=Yr({mode:"color",data:{r:i,g:c,b:a}}),n.startStreaming(),(h=e.status)==null||h.call(e,200).send({status:"OK"})}async handleEndpointCreation(t,e){var r,o;const s=t.body;if(!s.apiPath||!s.id){(r=e.status)==null||r.call(e,400).send({error:"Name and path are required"});return}this.addNamedEndpoint(s.id,s),(o=e.status)==null||o.call(e,200).send({status:"OK"})}async load(t){var s;const e=t==null?void 0:t.get(zt.loader);e&&((s=e.patterns)==null||s.forEach(r=>{if(!r.id||!r.type||!r.data){this.logger.warn(`Invalid pattern data: ${JSON.stringify(r)}`);return}this.addPattern(r.id,r)}))}};is([Oe],rt.prototype,"_endpointRenderers",2);is([Xs("/api/ui/canvas/patterns")],rt.prototype,"handlePatternsPost",1);is([Xs("/api/ui/canvas/pattern/:endpoint/:pattern")],rt.prototype,"handlePatternApplication",1);is([Xs("/api/ui/canvas/color/:endpoint/:color")],rt.prototype,"handleColorApplication",1);is([Xs("/api/ui/canvas/endpoint")],rt.prototype,"handleEndpointCreation",1);rt=is([D(Qd)],rt);const zt=new Ce({class:rt,type:Qd}),{URL:ki}=fe(),{getOne:Xd}=ce.build({basePath:`${ki}/api/device`}),Wr=g.createLogger({name:"device-service",group:"Services"}),Zd=async()=>{Wr.debug("sending GET for device serial number");try{const t=await Xd({urlOverride:`${ki}/api/kos/device/serialNumber`});return[void 0,t==null?void 0:t.data.serialNumber]}catch(t){if(t instanceof z)return Wr.error(`Error fetching device serial number: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},Jd=async()=>{Wr.debug("sending GET for device details");try{const t=await Xd({urlOverride:`${ki}/api/kos/device`});return t?[void 0,t.data]:["unknownError",void 0]}catch(t){if(t instanceof z)return Wr.error(`Error fetching device serial number: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},oM=Object.freeze(Object.defineProperty({__proto__:null,getDeviceDetails:Jd,getSerialNumber:Zd},Symbol.toStringTag,{value:"Module"}));var nM=Object.defineProperty,iM=Object.getOwnPropertyDescriptor,eh=(t,e,s,r)=>{for(var o=r>1?void 0:r?iM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&nM(e,s,o),o};const th="device-model",aM="/kos/criticalData/changed",cM="/kos/criticalData/available";let Qr=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_serialNumber");l(this,"_name");l(this,"_nodeId");this.id=t,this.logger=s.logger,this._serialNumber="unassigned",this._name="unassigned",this._nodeId="unassigned"}get serialNumber(){return this._serialNumber}get name(){return this._name}get nodeId(){return this._nodeId}get nodeType(){const[t]=this.nodeId.split("-");return t}get nodeName(){const[,t]=this.nodeId.split("-");return t}updateModel(t){this._serialNumber=t.serialNumber??"unassigned",this._name=t.name??"unassigned",this._nodeId=t.nodeId??"unassigned"}async loadDeviceData(){const[t,e]=await Jd();if(t){this.logger.error(`Error fetching device serial number: ${t}`);return}if(e){const{name:s,nodeId:r}=e;this.updateModel({name:s,nodeId:r,serialNumber:this.serialNumber})}}async loadSerialNumber(){const[t,e]=await Zd();if(t){this.logger.error(`Error fetching device serial number: ${t}`);return}this.updateModel({serialNumber:e,name:this.name,nodeId:this.nodeId})}async handleCriticalDataChanged(){this.logger.debug(`Critical data changed for device ${this.id}`),await this.loadSerialNumber()}async init(){this.logger.debug(`initializing device ${this.id}`)}async load(){this.logger.debug(`loading device ${this.id}`),await this.loadDeviceData(),await this.loadSerialNumber()}};eh([B({topic:[aM,cM],websocket:!0})],Qr.prototype,"handleCriticalDataChanged",1);Qr=eh([D(th)],Qr);const Xr=new Ce({class:Qr,type:th});var lM=Object.getOwnPropertyDescriptor,uM=(t,e,s,r)=>{for(var o=r>1?void 0:r?lM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const sh="network-interface-model";let fn=class{constructor(t,e,s){l(this,"id");l(this,"name");l(this,"type");l(this,"nmdevicestate");l(this,"hwaddress");l(this,"mtu");l(this,"configured");l(this,"wifi");l(this,"ethernet");l(this,"ip4settings");l(this,"category");l(this,"logger");this.id=t,this.logger=s.logger,this.name=e.name,this.type=e.type,this.nmdevicestate=e.nmdevicestate,this.hwaddress=e.hwaddress,this.mtu=e.mtu,this.configured=e.configured,this.wifi=e.wifi,this.ethernet=e.ethernet,this.ip4settings=e.ip4settings,this.category=e.category}updateModel(t){this.name=t.name,this.type=t.type,this.nmdevicestate=t.nmdevicestate,this.hwaddress=t.hwaddress,this.mtu=t.mtu,this.configured=t.configured,this.wifi=t.wifi,this.ethernet=t.ethernet,this.ip4settings=t.ip4settings,this.category=t.category}async init(){this.logger.debug(`initializing network-interface ${this.id}`)}async load(){this.logger.debug(`loading network-interface ${this.id}`)}};fn=uM([D(sh)],fn);const Li=new Ee({class:fn,type:sh}),{URL:dM}=fe(),{getAll:hM}=ce.build({basePath:`${dM}/api/kos/network/interfaces`}),fM=Oi(),Ka=g.createLogger({name:"network-interface-service",group:"Services"}),rh=async()=>{Ka.debug("sending GET for copy-logs");try{const t=await hM({destinationAddress:fM});return[void 0,t==null?void 0:t.data]}catch(t){if(t instanceof z)return Ka.error(`Error fetching log file size: ${t.payload.error}`),[t.payload.error,void 0]}return["unknownError",void 0]},pM=Object.freeze(Object.defineProperty({__proto__:null,getNetworkInterfaces:rh},Symbol.toStringTag,{value:"Module"}));var gM=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,oh=(t,e,s,r)=>{for(var o=r>1?void 0:r?mM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&gM(e,s,o),o};const nh="network-interface-container-model";let Zr=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t,indexMap:{byCategory:"category"}})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}async init(){this.logger.debug(`initializing network-interface-container container ${this.id}`)}async refreshInterfaces(){this.logger.debug("refreshing interfaces");const[t,e]=await rh();if(t){this.logger.error(`Error loading network interfaces: ${t}`);return}e&&e.forEach(s=>{const r=Li.instance(s.name).forceUpdate.options(s).build();this.addModel(r)})}async load(){this.logger.debug(`loading network-interface-container container ${this.id}`),this.refreshInterfaces()}};oh([Oe],Zr.prototype,"_models",2);Zr=oh([D(nh)],Zr);const Hs=new Ce({class:Zr,type:nh});Hs.addRelatedModel(Li);const{URL:yM}=fe(),{getAll:bM}=ce.build({basePath:`${yM}/api/kos/storage/devices`}),Ha=g.createLogger({name:"storage-device-service",group:"Services"}),ih=async()=>{Ha.debug("sending GET for storage-device");const t=await bM({});return!(t!=null&&t.data)||t.status!==200?(Ha.error("Failed to retrieve storage-device data",t),[]):t.data},vM=Object.freeze(Object.defineProperty({__proto__:null,getStorageDevices:ih},Symbol.toStringTag,{value:"Module"}));var wM=Object.getOwnPropertyDescriptor,EM=(t,e,s,r)=>{for(var o=r>1?void 0:r?wM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const ah="storage-device-model";let pn=class{constructor(t,e,s){l(this,"id");l(this,"mountDir");l(this,"removed");l(this,"vendor");l(this,"runTimeMs");l(this,"model");l(this,"nodeId");l(this,"local");l(this,"label");l(this,"syspath");l(this,"logger");this.id=t,this.logger=s.logger,this.mountDir=e.mountDir,this.removed=e.removed,this.vendor=e.vendor,this.runTimeMs=e.runTimeMs,this.model=e.model,this.nodeId=e.nodeId,this.local=e.local,this.label=e.label,this.syspath=e.syspath}updateModel(t){this.mountDir=t.mountDir,this.removed=t.removed,this.vendor=t.vendor,this.runTimeMs=t.runTimeMs,this.model=t.model,this.nodeId=t.nodeId,this.local=t.local,this.label=t.label,this.syspath=t.syspath}async init(){this.logger.debug(`initializing storage-device ${this.id}`)}async load(){this.logger.debug(`loading storage-device ${this.id}`)}};pn=EM([lo(),D(ah)],pn);const Jr=new Ee({class:pn,type:ah});var MM=Object.defineProperty,_M=Object.getOwnPropertyDescriptor,Fi=(t,e,s,r)=>{for(var o=r>1?void 0:r?_M(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&MM(e,s,o),o};const ch="storage-device-container-model",TM="/kos/storage";let qs=class{constructor(t,e,s){l(this,"id");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}async init(){this.logger.debug(`initializing storage-device-container container ${this.id}`)}get isStorageInserted(){return this.data.length>0}get volumes(){return this.data}handleStorageAvailability(t){this._models.data.filter(s=>!t.find(r=>r.id===s.id)).forEach(s=>{this.removeModel(s.id)}),t.forEach(s=>{const r=this.getModel(s.id);if(r){const o={...s,kosParentId:this.id};r.updateModel(o)}else{const o={...s,kosParentId:this.id},n=Jr.instance(s.id).options(o).build();this.addModel(n)}})}async load(){this.logger.debug(`loading storage-device-container container ${this.id}`),(await ih()).forEach(e=>{if(e.deviceType!=="disk"){const s={...e,kosParentId:this.id},r=Jr.instance(e.id).options(s).build();this.addModel(r)}})}};Fi([Oe],qs.prototype,"_models",2);Fi([B({topic:TM,websocket:!0})],qs.prototype,"handleStorageAvailability",1);qs=Fi([D(ch)],qs);const Vt=new Ce({class:qs,type:ch});Vt.addRelatedModel(Jr);const{URL:Ni}=fe(),{getAll:SM,postModel:$M}=ce.build({basePath:`${Ni}/api/kos/update/available`}),qa=g.createLogger({name:"usb-update-service",group:"Services"}),lh=async()=>{qa.debug("sending GET for usb-update");const t=await SM({urlOverride:`${Ni}/api/kos/update/available`});return!(t!=null&&t.data)||(t==null?void 0:t.status)!==200?(qa.error("Failed to retrieve usb-update data",t),[]):t.data},uh=async(t,e,s)=>{const r=await $M({model:{manifestId:t,deviceId:e},tracker:s,urlOverride:`${Ni}/api/kos/update/install`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data},OM=Object.freeze(Object.defineProperty({__proto__:null,getAvailableUpdates:lh,installUpdate:uh},Symbol.toStringTag,{value:"Module"}));var IM=Object.defineProperty,CM=Object.getOwnPropertyDescriptor,dh=(t,e,s,r)=>{for(var o=r>1?void 0:r?CM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&IM(e,s,o),o};const hh="usb-update-model";let eo=class{constructor(t,e,s){l(this,"id");l(this,"active");l(this,"blocked");l(this,"createTime");l(this,"deviceId");l(this,"manifestId");l(this,"notes");l(this,"futureHandler");l(this,"logger");this.id=t,this.logger=s.logger,this.active=e.active,this.blocked=e.blocked,this.createTime=e.createTime,this.deviceId=e.deviceId,this.manifestId=e.manifestId,this.notes=e.notes,this.futureHandler=new po(this)}updateModel(t){this.active=t.active,this.blocked=t.blocked,this.createTime=t.createTime,this.deviceId=t.deviceId,this.manifestId=t.manifestId,this.notes=t.notes}reset(){this.futureHandler.removeFuture()}get future(){return this.futureHandler.future}async install(t){if(!t)throw new Error("No tracker provided");return this.logger.info(`Installing update for manifest ${this.manifestId} from device ${this.deviceId}`),uh(this.manifestId,this.deviceId,t)}async init(){this.logger.debug(`initializing usb-update ${this.id}`)}async load(){this.logger.debug(`loading usb-update ${this.id}`)}};dh([Do()],eo.prototype,"install",1);eo=dh([D(hh)],eo);const Ui=new Ee({class:eo,type:hh});var DM=Object.defineProperty,xM=Object.getOwnPropertyDescriptor,Co=(t,e,s,r)=>{for(var o=r>1?void 0:r?xM(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&DM(e,s,o),o};const fh="usb-update-container-model";let Gt=class{constructor(t,e,s){l(this,"id");l(this,"disposer");l(this,"storageService");l(this,"_activeUpdate");l(this,"logger");l(this,"_models");this.id=t,this.logger=s.logger,this._models=new Fe({parentId:t})}getModel(t){return this._models.getModel(t)}get models(){return this._models}get data(){return this._models.data}addModel(t){this._models.addModel(t)}removeModel(t){this._models.removeModel(t)}get activeUpdate(){return this._activeUpdate}reset(){this.clearActiveUpdate()}clearActiveUpdate(){this._activeUpdate=void 0}updateActiveUpdate(t){this._activeUpdate=t}get isUsbInserted(){return this.storageService.isStorageInserted}get hasAvailableUpdates(){return this._models.data.length>0}async syncAvailableUpdates(){const t=await lh();ee(()=>{const e=t.map(s=>`${s.deviceId}-${s.manifestId}`);this._models.data.filter(s=>!e.includes(s.id)).forEach(s=>this.removeModel(s.id)),t.forEach(s=>{const r=`${s.deviceId}-${s.manifestId}`,o=Ui.instance(r).forceUpdate.options({...s,createTime:new Date(s.createTime)}).build();this.addModel(o)}),this.data.length===1?this.updateActiveUpdate(this.data[0]):this.clearActiveUpdate()})}usbInsertedEffect(){this.isUsbInserted?this.syncAvailableUpdates():(this._models.clear(),this.clearActiveUpdate())}async init(){this.logger.debug(`initializing usb-update-container container ${this.id}`)}unload(){var t;(t=this.disposer)==null||t.call(this)}async activate(){this.logger.debug(`activating usb-update-container container ${this.id}`),await this.syncAvailableUpdates()}async load(){this.logger.debug(`loading usb-update-container container ${this.id}`)}};Co([Xt({modelType:Vt.type})],Gt.prototype,"storageService",2);Co([Oe],Gt.prototype,"_models",2);Co([qc({dependencies:t=>[t.isUsbInserted]})],Gt.prototype,"usbInsertedEffect",1);Gt=Co([D(fh)],Gt);const zs=new Ce({class:Gt,type:fh});zs.addRelatedModel(Ui);const AM=()=>({...{[ts.type]:{class:Uu},[st.type]:{class:Ku,singleton:!0},...ae.registration,...Et.registration,...Ht.registration,...qr.registration,...Ve.registration,[xi.type]:{class:exports.WsEventModel,singleton:!0},...Ks.registration,...Ci.registration,...kr.registration}}),ji=AM(),RM={models:ji,preloadModels:[]},PM=!0,ph=t=>()=>{const e=ji;return nl(gn)(Bs).model(Ht).model(Vt).model(zs).model(Xr).model(jr).model(Rs).model(Br).model(bi).model(Hs).model(zt).model(Ri).model(Ju).model(gi,PM).model(tr).model(sd),Object.keys(e).forEach(s=>{const r=e[s];ol(gn)(s,r)}),{preload:R.model.preloadModel(t),model:R.model.register(t),companion:R.companion.register(t),legacy:R.model.registerLegacyModel(t)}},$e={};$e.core={models:ph($e)};$e.preload=R.model.preloadModel($e);$e.model=R.model.register($e);$e.companion=R.companion.register($e);$e.legacy=R.model.registerLegacyModel($e);const gn=$e;class kM{registerTroubleRankMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleRank,e,s),this}registerTroubleRoleMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleRole,e,s),this}registerTroubleColorMapper(e,s){return T.propertyMapper.registerPropertyMapper(te.TroubleColor,e,s),this}registerModelLoader(e,s,r){T.loader.registerLoader(e,s,r)}registerRegionServicePathMapper(e){return T.propertyMapper.registerPropertyMapper(te.RegionServicePath,e),this}registerCanvasPatternLoader(e,s){T.loader.registerLoader(zt.loader,e,s)}registerConfigServicePathMapper(e){return T.propertyMapper.registerPropertyMapper(te.ConfigServicePath,e),this}}const LM=async(t,e)=>{const s=bi.instance(t).options({}).build(),r=e?`${e}-`:"";return await ye(s),{getState:o=>s.data[`${r}${o}`],updateState:async(o,n)=>{await s.updateState(`${r}${o}`,n)},clean:async()=>{for(const o of s.data.keys)await s.updateState(`${r}${o}`,void 0)},unsubscribe:()=>{Re(s)}}},gh="kos:service:region",mh="regionId",FM=`${gh}-${mh}`,yh=async t=>{const e=Et.factory(FM)({path:gh,attribute:mh});await ye(e),e.updateProperty(t)};async function NM(){const{default:t}=await Promise.resolve().then(()=>Wn);return t}function UM(t){return Ye(t)}const za=De(),jM=Object.freeze(Object.defineProperty({__proto__:null,api:za,default:za,kosServiceRequest:UM},Symbol.toStringTag,{value:"Module"}));function BM(t){return Ye(t)}const Va=De(),KM=Object.freeze(Object.defineProperty({__proto__:null,api:Va,default:Va,kosServiceRequest:BM},Symbol.toStringTag,{value:"Module"}));function bh(t){return Ye(t)}const mn=De(),HM=Object.freeze(Object.defineProperty({__proto__:null,api:mn,default:mn,kosServiceRequest:bh},Symbol.toStringTag,{value:"Module"}));function qM(t){return Ye(t)}const Ga=De(),zM=Object.freeze(Object.defineProperty({__proto__:null,api:Ga,default:Ga,kosServiceRequest:qM},Symbol.toStringTag,{value:"Module"}));function VM(t){return Ye(t)}const Ya=De(),GM=Object.freeze(Object.defineProperty({__proto__:null,api:Ya,default:Ya,kosServiceRequest:VM},Symbol.toStringTag,{value:"Module"}));function YM(t){return Ye(t)}const Wa=De(),WM=Object.freeze(Object.defineProperty({__proto__:null,api:Wa,default:Wa,kosServiceRequest:YM},Symbol.toStringTag,{value:"Module"}));function QM(t){return Ye(t)}const Qa=De(),XM=Object.freeze(Object.defineProperty({__proto__:null,api:Qa,default:Qa,kosServiceRequest:QM},Symbol.toStringTag,{value:"Module"}));function ZM(t){return Ye(t)}const Xa=De(),JM=Object.freeze(Object.defineProperty({__proto__:null,api:Xa,default:Xa,kosServiceRequest:ZM},Symbol.toStringTag,{value:"Module"})),Bi="/kos-timer-event",Ki="/kos-timer-event/tick",Hi="defaultTimerEnd",ys=g.createLogger({name:"timer-manager"}),e_=t=>t.updateProperty!==void 0;class vh{constructor(e,s,r){l(this,"name");l(this,"timeout");l(this,"timer");l(this,"state","inactive");l(this,"decrementValue",1);l(this,"remainingTime");l(this,"timeoutActions",new Map);this.name=e;const o=typeof s=="number"?s:s.value||60;this.timeout=o,this.state="inactive",this.remainingTime=o,e_(s)&&X(()=>{g.info(`Updating config value timer ${e} with new timeout value ${s.value}`);const n=s.value||60;this.updateTimeout(n)}),this.addTimeoutAction({name:Hi}),r&&r.forEach(n=>{this.addTimeoutAction(n)})}get id(){return this.name}start(){if(this.state==="active"){ys.debug(`Timer ${this.name} already started`);return}(this.state==="inactive"||this.state==="paused")&&(this.state="active",this.timer=setInterval(()=>this.updateTimer(),1e3))}pause(){this.timer&&(ys.debug(`Pausing timer ${this.name}`),this.state="paused",clearInterval(this.timer))}restart(){this.pause(),this.remainingTime=this.timeout,this.start()}reset(){this.pause(),this.remainingTime=this.timeout,this.state="inactive"}updateTimeout(e){this.timeout=e,this.restart()}addTimeoutAction(e){const s=e.remainingTime??0;this.timeoutActions.has(s)||this.timeoutActions.set(s,[]);const r=e.name,o=this.timeoutActions.get(s).find(n=>n.name===r);o?o.action=e.action:this.timeoutActions.get(s).push(e)}removeTimeoutAction(e){for(const[s,r]of this.timeoutActions.entries()){const o=r.filter(n=>n.name!==e);o.length===0?this.timeoutActions.delete(s):this.timeoutActions.set(s,o)}}updateTimer(){if(this.remainingTime=Math.round((this.remainingTime-this.decrementValue)*100)/100,this.remainingTime<=0){this.state==="active"&&this.executeActions(0),this.pause();return}this.state==="active"&&this.executeActions(this.remainingTime)}executeActions(e){this.timeoutActions.has(e)&&this.timeoutActions.get(e).forEach(s=>{var r;ys.debug(`Executing timer action ${s.name} at ${e}`),(r=s.action)==null||r.call(s,s.name,e),this.notifyTimeoutAction(s),s.singleUse&&(ys.info(`${this.name} Removing single-use action ${s.name}`),this.removeTimeoutAction(s.name))}),this.notifyTick()}notifyTick(){H(`${Ki}/${this.name}`,{name:this.name,remainingTime:this.remainingTime})}notifyTimeoutAction(e){H(Bi,{name:this.name,action:e.name,remainingTime:this.remainingTime})}}const bs=new Map,Dt=(t,e)=>{const s=bs.get(t);if(!s){ys.error(`Timer ${t} not found`);return}e(s)},wh={createRelativeTimer(t,e,s){const r=new Date,o=Math.round((e.getTime()-r.getTime())/1e3);return this.createTimer(t,o,s)},createTimer(t,e=60,s){if(bs.has(t))return bs.get(t);const r=new vh(t,e,s);return bs.set(t,r),r},getTimer(t){return bs.get(t)},clearTimer(t){Dt(t,e=>e.pause())},restartTimer(t){Dt(t,e=>e.restart())},resetTimer(t){Dt(t,e=>e.reset())},addTimeoutAction(t,e){Dt(t,s=>s.addTimeoutAction(e))},removeTimeoutAction(t,e){Dt(t,s=>s.removeTimeoutAction(e))},startTimer(t){Dt(t,e=>e.start())}},Eh="kos:service:region:settings",Mh="timeZone",t_=`${Eh}-${Mh}`,yn=async t=>{const e=Et.factory(t_)({path:Eh,attribute:Mh});await ye(e),e.updateProperty(t)},s_=t=>!t||!t.data;function qi(t,e,s={}){const{alias:r,namespace:o,abortController:n=!1,trackerPolicy:i="id"}=s;return async function(...a){const c=wt();g.debug(`Calling future service ${e} with tracker ${c}`);let u,d;n&&(u=new AbortController);const h=mt.initiateFuture({tracker:c,id:oi});o&&(h.namespace=o),g.debug(`waiting for future ${h.id} to be ready`),await ye(h),g.debug(`future ${h.id} is ready`),ee(()=>{g.debug(`Adding future ${h.id} to futureHandler`),this.futureHandler.addFuture(h,r)}),n&&u&&(d=X(()=>{(h.status==="CANCELLED"||h.endState===tt.Canceled)&&(g.debug(`Future ${h.id} cancelled, aborting request`),u==null||u.abort())}),u.signal.addEventListener("abort",async()=>{if(h.status!=="CANCELLED"&&h.endState!==tt.Canceled&&!h.endState){g.debug(`AbortController aborted, cancelling future ${h.id}`);try{await h.cancelFuture()}catch(p){g.error(`Failed to cancel future ${h.id}:`,p)}}},{once:!0}));const f=()=>{d&&(d(),d=void 0)};try{const p=[...a];if(n&&u){const M=p[p.length-1];M&&typeof M=="object"&&"aborted"in M?p[p.length-1]=u.signal:p.push(u.signal)}if(i==="context"){const M=p[p.length-1];if(Kn(M))M.$tracker=c;else{const $={[ho]:!0,$tracker:c};p.push($)}}else p.push(c);const y=await t.apply(this,p);g.debug(`received future response for ${c}`,y);const b=s_(y)?y:y==null?void 0:y.data;return b?(b.progress=1,g.debug("mapping future response to future model"),h.endState?g.debug(`future ${h.id} has already completed. Not updating the model`):fi(b,h)):this.futureHandler.removeFuture(r),f(),b}catch(p){if(f(),n&&(u!=null&&u.signal.aborted)){const y=new Error("Operation cancelled");throw g.debug(`Operation ${e} was cancelled`),y}throw g.error(p),p}}}Zt(Jc,{register:()=>{},execute:()=>qi});function Do(t={}){const{alias:e}=t;return(s,r,o)=>{s[Es]=s[Es]||{},e&&(s[Ts]=s[Ts]||new Map,s[Ts].set(r,e));const n=o.value,i=qi(n,r,t);s[Es][r]={handler:i}}}const r_=({path:t})=>(e,s)=>{e[F]=e[F]||{},e[F][s]={modelType:Ks.type,id:`${Ks.type}-${t}`,options:{path:t},lifecycle:I.INIT}};function o_(t){const{path:e,attribute:s}=t;return(r,o)=>{r[F]=r[F]||{},r[F][o]={modelType:Ci.type,id:`${e}-${s}`,options:{path:e,attribute:s},lifecycle:I.INIT}}}const kt=g.createLogger({name:"services",group:"Services"}),n_=async(t,e)=>_h(t,e,`${exports.BASE_URL}/api/server/login`),_h=async(t,e,s=`${exports.BASE_URL}/api/login`)=>{const r=await exports.kosFetch(`${s}`,{method:"POST",destinationAddress:"",body:JSON.stringify({email:t,password:e})});if(!r.ok){const n=await r.json();throw Error(`${n==null?void 0:n.error}`)}return await r.json()},i_=async t=>Th(t,`${exports.BASE_URL}/api/server/startPasswordReset`,""),Th=async(t,e=`${exports.BASE_URL}/api/startPasswordReset`,s="server")=>{const r=await exports.kosFetch(`${e}?email=${t}`,{method:"POST",destinationAddress:s});if(!r.ok)throw Error(`There was a problem reseting config; returned status ${r.status}`);return await r.json()},a_=async(t,e)=>Sh(t,e,`${exports.BASE_URL}/api/server/resetPassword`),Sh=async(t,e,s=`${exports.BASE_URL}/api/resetPassword`)=>{kt.debug(`resetting password with token ${t} and password ${e.replace(/./g,"*")}`);const r=await exports.kosFetch(`${s}`,{method:"POST",destinationAddress:"",body:JSON.stringify({token:t,password:e})});if(kt.debug(`password reset returned status ${r.status}`),!r.ok){kt.error(`password reset failed with message ${r.statusText}`);const n=await r.json();throw Error(`${n==null?void 0:n.error}:There was a problem resetting the password.`)}return await r.json()},c_=async(t,e,s)=>$h(t,e,s,`${exports.BASE_URL}/api/server/acceptInvite`),$h=async(t,e,s,r=`${exports.BASE_URL}/api/server/acceptInvite`)=>{kt.debug(`accepting invite with token ${t} and password ${e.replace(/./g,"*")}`);const o=await exports.kosFetch(`${r}`,{method:"POST",destinationAddress:"",body:JSON.stringify({token:t,password:e,name:s})});if(kt.debug(`invitation accept returned status ${o.status}`),!o.ok){kt.error(`invite failed with message ${o.statusText}`);const i=await o.json();throw Error(`${i==null?void 0:i.error}:There was a problem accepting the invite.`)}return await o.json()};function l_(t,e,s,r){const o=t instanceof Promise?{promise:t,abortController:e,cancelFuture:s,future:r}:t,{promise:n,abortController:i,cancelFuture:a,future:c}=o,u=n;let d=0,h="PENDING",f=!0;const p=new Set;let y;return c&&typeof c=="object"&&(y=E.autorun(()=>{const b=c.progress||0,M=c.status||"PENDING",$=!c.endState;(b!==d||M!==h||$!==f)&&(d=b,h=M,f=$,p.forEach(U=>{try{U(d,h)}catch(A){console.warn("Progress callback error:",A)}}))})),n.finally(()=>{f=!1,i!=null&&i.signal.aborted||(h="COMPLETED",p.forEach(b=>{try{b(d,h)}catch(M){console.warn("Progress callback error:",M)}})),y&&y(),p.clear()}),u.cancel=async()=>{i&&!i.signal.aborted&&i.abort(),a&&await a(),f=!1,h="CANCELLED",p.forEach(b=>{try{b(d,h)}catch(M){console.warn("Progress callback error:",M)}}),y&&y()},u.getController=()=>i,u.isCancelled=()=>(i==null?void 0:i.signal.aborted)??!1,Object.defineProperty(u,"progress",{get:()=>d,enumerable:!0}),Object.defineProperty(u,"status",{get:()=>h,enumerable:!0}),Object.defineProperty(u,"isRunning",{get:()=>f,enumerable:!0}),u.onProgressUpdate=b=>(p.add(b),b(d,h),()=>p.delete(b)),u}const u_=dt.keyframes`
|
|
146
146
|
0% {
|
|
147
147
|
left: -90px;
|
|
148
148
|
color: #eee;
|
|
@@ -224,5 +224,5 @@ ${c}topics:${e}
|
|
|
224
224
|
display: flex;
|
|
225
225
|
flex-direction: column;
|
|
226
226
|
align-items: center;
|
|
227
|
-
`,jh=()=>{const t=Xr.type;return J({modelId:t,modelType:Xr.type,options:{}})};function W_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=jh();return _.jsx(o,{...r,children:_.jsx(t,{...e,device:s})})}}function Q_(t,e,s){const r=new Promise(o=>{S.getInstance().whenReady().then(()=>{const{model:n}=S.getInstance().modelManager.createModelInstance(t,e??t,s);return n.whenReady().then(()=>{o(n.modelData)})})});return xn(r)}function X_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=zi();return _.jsx(o,{...r,children:_.jsx(t,{...e,kosTime:s})})}}const Bh=()=>{const t=Hs.type;return J({modelId:t,modelType:Hs.type,options:{}})};function Z_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Bh();return _.jsx(o,{...r,children:_.jsx(t,{...e,networkInterfaceContainer:s})})}}const Kh=()=>{const t=jr.type;return J({modelId:t,modelType:jr.type,options:{}})};function J_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Kh();return _.jsx(o,{...r,children:_.jsx(t,{...e,oTA:s})})}}function eT(t,e){m.useEffect(()=>{function s(o){t.current&&!t.current.contains(o.target)&&e()}function r(o){o.key==="Escape"&&e()}return document.addEventListener("mousedown",s),document.addEventListener("keydown",r,!1),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",r,!1)}},[t,e])}function tT(t){const e=m.useRef(null),s=t.onAlert;return eT(e,s),_.jsx("div",{ref:e,style:{width:"100%"},children:t.children})}const sT=t=>{var u;const{stateProp:e}=t,[s,r]=m.useState((u=t.stateProp)==null?void 0:u.value),[o,n]=m.useState(!1),[i,a]=m.useState(void 0);return m.useEffect(()=>{async function d(h){try{h&&(await ye(h),n(!0))}catch(f){a(f.message)}}d(e)},[e]),m.useEffect(()=>{const d=X(()=>{e&&o&&r(e.value)});return()=>{d()}},[o,e]),[s,{ready:o,error:i}]},Hh=()=>{const[t,e]=m.useState(!1),[s,r]=m.useState([]),o=Vt.type,n=J({modelId:o,modelType:Vt.type,options:{}});return m.useEffect(()=>{const i=X(()=>{var a,c;e(((a=n.model)==null?void 0:a.isStorageInserted)??!1),r(((c=n.model)==null?void 0:c.data)??[])});return()=>{i()}},[n.model]),{...n,inserted:t,devices:s}};function rT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Hh();return _.jsx(o,{...r,children:_.jsx(t,{...e,storageDeviceContainer:s})})}}const Qo=g.createLogger({name:"use-timer"}),oT=({timerName:t,onTimerExpired:e,onTimerTick:s,timerEventActions:r,autoStart:o})=>{const n=wh.getTimer(t);m.useEffect(()=>{if(!n){console.warn(`Timer with name ${t} does not exist.`);return}const u=C(Bi,d=>{const{name:h,action:f,remainingTime:p}=d==null?void 0:d.body;h===t&&(f===Hi?e({name:h,action:f,remainingTime:p,timer:n}):r!=null&&r[f]&&r[f]({name:h,action:f,remainingTime:p,timer:n}))});return o&&n.start(),()=>{u.unsubscribe()}},[o,e,r,t,n]),m.useEffect(()=>{if(!n||!s)return;const u=`${Ki}/${t}`,d=C(u,h=>{const{name:f,remainingTime:p}=h==null?void 0:h.body;f===t&&s({name:f,remainingTime:p,timer:n})});return()=>{d.unsubscribe()}},[s,t,n]);const i=m.useCallback(()=>{n?n.start():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]),a=m.useCallback(()=>{n?n.reset():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]),c=m.useCallback(()=>{n?n.pause():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]);return{timer:n,start:i,reset:a,pause:c}},nT=t=>{const e=/[\\^$.*+?()[\]{}|]/g;return RegExp(e.source).test(t)?t.replace(e,"\\$&"):t},iT=t=>t instanceof RegExp,aT=t=>typeof t=="string",cT=(t,e,s)=>{if(t===""||e==="")return t;let r=e;iT(r)||(r=new RegExp("("+nT(r)+")","gi"));const o=t.split(r);for(let n=1,i=o.length;n<i;n+=2)o[n]=s(o[n],n);return o},qh=(t,e,s)=>{let r=t;return Array.isArray(r)||(r=[r]),r.flatMap(o=>aT(o)?cT(o,e,s):o)};function lT(t,e){let s=t;return Object.entries(e).forEach(([r,o])=>{const n=new RegExp(`<${r}>(.*?)</${r}>|<${r}/>`,"g");s=qh(s,n,(i,a)=>o.type==="br"?_.jsx("br",{}):m.cloneElement(o,{key:`${r}-${a}`},i))}),s}const uT=t=>{const{i18nKey:e,t:s,defaults:r,components:o,values:n={},context:i}=t,a=s(e,{defaultValue:r,data:n,context:i,returnObjects:!0}),c=lT(a,o||{});return _.jsx("span",{className:t.className,children:c})},xt=new Map;function dT(t,e){if(xt.has(t)){const s=xt.get(t);if(s.status==="finished")return s.result;throw s.promise}else{const s=e().then(o=>{xt.set(t,{status:"finished",result:o})},o=>{throw xt.set(t,{status:"error",error:o}),o}),r={status:"pending",promise:s};throw xt.set(t,r),s}}function bn(t,e){return dT(t,e)}const hT=async()=>{const t=await tl(Ve.type);return await ye(t.model),t.model},fT=async(t,e,s)=>{const r=t.resolveNamespace(e);await ye(r);for(const o of s){const n=t.resolveNamespace(o);await ye(n),xt.set(o,{status:"finished",result:n})}return r},pT=(t,e)=>{const s=[t].flat(),[r,...o]=s,n=bn(Ve.type,hT),i=s.join("__"),a=bn(i,()=>fT(n,r,o)),c=m.useMemo(()=>({exists:d=>{const h=e!=null&&e.keyPrefix?`${e.keyPrefix}.${d}`:d;return a?a.exists(h):!1}}),[e==null?void 0:e.keyPrefix,a]);return{t:m.useCallback((d,h)=>{const f=e!=null&&e.keyPrefix?`${e.keyPrefix}.${d}`:d;return a?a.resolveKey(f,h):(g.debug(`Translation model ${t} not ready for key: ${f}`),f)},[e==null?void 0:e.keyPrefix,t,a]),i18n:c}},zh=()=>{const t=Ve.type;return J({modelId:t,modelType:Ve.type,options:{}})};function gT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=zh();return _.jsx(o,{...r,children:_.jsx(t,{...e,translationContainer:s})})}}const mT=t=>J({modelId:t,modelType:Bs.type}),Qi=()=>J({modelId:Ht.type,modelType:Ht.type,options:{}}),yT=({troubleType:t,condition:e})=>{const{model:s}=Qi(),[r,o]=m.useState(!1),[n,i]=m.useState([]),a=m.useCallback(()=>{var c,u;return n.length>0&&((c=n[0])!=null&&c.resolvable)?(u=n[0])==null?void 0:u.resolve():Promise.resolve(void 0)},[n]);return m.useEffect(()=>X(()=>{const u=(t?s==null?void 0:s.troubles.getIndexByKey("byType",t):s==null?void 0:s.troubles.data)||[],d=e?u.filter(e):u;o(d.length>0),i(d)}),[e,s,t]),[r,a,n.length>0?n[0]:void 0,n]};function bT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Qi();return _.jsx(o,{...r,children:_.jsx(t,{...e,troubleContainer:s})})}}const Vh=()=>{const t=zs.type,e=J({modelId:t,modelType:zs.type,options:{},activate:!0,destroyOnUnmount:!0}),[s,r]=m.useState(!1),[o,n]=m.useState(!1),[i,a]=m.useState([]);return m.useEffect(()=>{const c=X(()=>{var u,d,h;r(((u=e.model)==null?void 0:u.isUsbInserted)??!1),n(((d=e.model)==null?void 0:d.hasAvailableUpdates)??!1),a(((h=e.model)==null?void 0:h.data)??[])});return()=>{c()}},[e.model]),{...e,inserted:s,updateAvailable:o,updates:i}};function vT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Vh();return _.jsx(o,{...r,children:_.jsx(t,{...e,usbUpdateContainer:s})})}}const wT=({path:t,propKey:e})=>{const{status:s}=J({modelType:Rs.type,modelId:t,options:{path:t}}),[r,o]=m.useState(!1),[n,i]=m.useState(),[a,c]=m.useState(""),[u,d]=m.useState(),h=f=>{n&&e&&n.updateProperty(e,f)};return m.useEffect(()=>{var f;s.model&&i(s.model),s.model&&e&&((f=s.model)!=null&&f.props.has(e)?c(s.model.props[e]):d(`property ${e} not found`)),s.ready&&o(s.ready)},[s.ready,s.model,e]),m.useEffect(()=>{e&&E.autorun(()=>{const f=n==null?void 0:n.props[e];c(f||"")})},[n,e]),{config:n,ready:r,value:a,error:u,updateValue:h}},ET=(t,e)=>{switch(e.type){case"UPDATE":return e.payload;default:return t}},Gh=({configProperty:t,optionsTransformer:e})=>{const[s,r]=m.useState(!1),[o,n]=m.useState(""),[i,a]=m.useReducer(ET,{value:String(t==null?void 0:t.value),displayValue:t==null?void 0:t.displayValue,significantValue:t==null?void 0:t.significantValue,unit:t==null?void 0:t.unit,options:t==null?void 0:t.options,mappedOptions:[],updateProperty:t==null?void 0:t.updateProperty,displayOptions:t==null?void 0:t.displayOptions}),c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&(t==null||t.updateProperty(d))},[t]);return m.useEffect(()=>{async function u(d){try{d&&(await ye(d),r(!0))}catch(h){n(h.message)}}u(t)},[t]),m.useEffect(()=>{const u=X(()=>{if(t&&s){let d=[];e&&(d=e(t.options)),a({type:"UPDATE",payload:{value:String(t.value),displayValue:t.displayValue,significantValue:t.significantValue,unit:t.unit,options:t.options,mappedOptions:d,updateProperty:t.updateProperty,displayOptions:t==null?void 0:t.displayOptions}})}});return()=>{u()}},[t,e,s]),{...i,configSelectProps:{onChange:c,value:i.value,options:e?i.mappedOptions||[]:i.options||[]},ready:s,error:o}};function MT(t,e){const s=e??new Date().getFullYear(),r=[31,28,31,30,31,30,31,31,30,31,30,31];return t===1&&(s%4===0&&s%100!==0||s%400===0)?29:r[t]??0}function _T(t,e){return new Date(t,e,0).getDate()}function Yh(t,e){const s=MT(e,t),r=[];for(let o=1;o<=s;o++)r.push(o);return r}function Wh(){return[...Array(12).keys()].map(e=>new Date(0,e).getMonth())}function Qh(t=[2018,2028]){const e=[];for(let s=t[0];s<=t[1];s++)e.push(s);return e}function Xh(t,e=[2018,2028]){const s=Qh(e);return t==="long"?s:s.map(r=>Number(r.toString().substring(2)))}function Xi(t="numeric",e="en-US"){const s=new Intl.DateTimeFormat(e,{month:t,timeZone:"UTC"}).format;return[...Array(12).keys()].map(r=>s(new Date(Date.UTC(0,r,1))))}function TT({locale:t="en-US",year:e,month:s,day:r,formatOptions:o={weekday:"long",year:"numeric",month:"long",day:"numeric"},displayOrder:n}){const i=s-1,a=new Date(e,i,r),c=new Intl.DateTimeFormat(t,{month:o.month}).format(a),u=new Intl.DateTimeFormat(t,{year:o.year}).format(a),d=new Intl.DateTimeFormat(t,{day:o.day}).format(a);return n?n=="MMDDYY"?`${c} ${d} ${u}`:n==="DDMMYY"?`${d} ${c} ${u}`:n==="YYMMDD"?`${u} ${c} ${d}`:`${u} ${d} ${c}`:new Intl.DateTimeFormat(t,o).format(a)}function _e(t){return t.toString().length===2?new Date(Date.parse(`01 Jan 20${t}`)).getFullYear():t}function ST(t){return typeof t=="string"?new Date(Date.parse(`01 ${t.substring(0,3)} 2023`)).getMonth()+1:t}function Zh(t,e,s){const r=_e(e),o=new Date(r,t,1).getDay(),n=new Date(r,t+1,0).getDate();return[...Array(42).keys()].map(a=>a<o||a>n+o-1?{label:"",value:0,disabled:!0}:s[a-o])}function vs(t,e,s){const r=e-1,o=new Date(t,r,s);return new Date(o).getMonth()===r&&new Date(o).getDate()===s}function ws(t,e){return new Date(t,e,0).getDate()}function Jh(t="en-US",e="short"){const s=new Intl.DateTimeFormat(t,{weekday:e}).format;return[...Array(7).keys()].map(r=>s(new Date(Date.UTC(2021,5,r))))}function ef({locale:t="en-US",year:e=new Date().getFullYear(),month:s=new Date().getMonth(),yearRange:r=[2018,2028],daysOfWeekFilter:o=[],formatOptions:{yearFormat:n="long",monthFormat:i="long",dayFormat:a="short"}={}}){const c=Zi(n,r),u=tf(n,r,t),d=sf(i,t),h=rf(i,t),f=Ji(e,s),p=of(e,s,t,o),y=cf(s,e,p),b=nf(t,a);return{daysArray:f,monthsArray:d,yearsArray:c,yearsOptionsArray:u,monthsOptionsArray:h,daysOptionsArray:p,calendarDayArray:y,dayNamesArray:b}}function Zi(t="long",e=[2018,2028]){return m.useMemo(()=>Xh(t,e),[t,e])}function tf(t="long",e=[2018,2028],s="en-US"){const r=Zi(t,e);return m.useMemo(()=>r.map(n=>({label:n.toLocaleString(s).replace(",",""),value:n})),[s,r])}function sf(t,e="en-US"){return m.useMemo(()=>Xi(t,e),[t,e])}function rf(t,e="en-US"){const s=m.useMemo(()=>Wh(),[]),r=m.useMemo(()=>Xi(t,e),[t,e]);return m.useMemo(()=>[...Array(12).keys()].map(n=>({label:r[n],value:Number(s[n])})),[r,s])}function Ji(t,e){const s=_e(t);return m.useMemo(()=>Yh(s,e),[e,s])}const $T=(t,e,s,r=[])=>{const o=new Date(t,e,s).getDay();return r.length>0&&r.includes(o)};function of(t,e,s="en-US",r=[]){const o=Ji(t,e);return m.useMemo(()=>o.map(i=>({label:i.toLocaleString(s),value:i,disabled:$T(t,e,i,r)})),[r,s,e,o,t])}function nf(t="en-US",e="short"){return m.useMemo(()=>Jh(t,e),[t,e])}function af({year:t=new Date().getFullYear(),month:e=new Date().getMonth(),day:s=new Date().getDate(),formatString:r}){const o=e,n=new Date(t,o,s);return{formattedDate:Xe.format(n,r)}}function cf(t,e,s){return m.useMemo(()=>Zh(t,e,s),[t,e,s])}var lf=(t=>(t.MMDDYY="MMDDYY",t.DDMMYY="DDMMYY",t.YYMMDD="YYMMDD",t.YYDDMM="YYDDMM",t))(lf||{});function OT({locale:t="en-US",date:{year:e=new Date().getFullYear(),month:s=new Date().getMonth(),day:r=new Date().getDate()}={year:new Date().getFullYear(),month:new Date().getMonth(),day:new Date().getDate()},formatOptions:{yearFormat:o="long",monthFormat:n="long",dayFormat:i="short",formatString:a="yyyy/MM/dd"}={},filterOptions:{yearsRange:c=[2018,2028],daysOfWeekFilter:u=[]}={}}){const[d,h]=m.useState(e),[f,p]=m.useState(c),[y,b]=m.useState(s),[M,$]=m.useState(r);m.useEffect(()=>{h(e)},[e]),m.useEffect(()=>{b(s)},[s]),m.useEffect(()=>{$(r)},[r]);const{yearsArray:U,yearsOptionsArray:A,monthsArray:O,monthsOptionsArray:L,daysArray:Y,daysOptionsArray:oe,calendarDayArray:K,dayNamesArray:as}=ef({locale:t,year:d,yearRange:f,month:y,formatOptions:{yearFormat:o,monthFormat:n,dayFormat:i},daysOfWeekFilter:u}),{formattedDate:se}=af({year:d,month:y,day:M,formatString:a});return{dateActions:{setYear:h,setYearRange:p,setMonth:b,setDay:$,nextMonth:()=>{const ne=y<11?_e(d):_e(d+1),pe=y<11?y+1:0;if(!vs(ne,pe,M)){const nt=ws(ne,pe);$(nt)}pe===0&&h(ne),b(pe)},previousMonth:()=>{const ne=_e(y===0?d-1:d),pe=y===0?11:y-1;if(!vs(ne,pe,M)){const nt=ws(ne,pe);$(nt)}pe===11&&h(ne),b(pe)},nextYear:()=>{const ne=d<f[1]?d+1:f[0],pe=_e(ne);if(vs(pe,y,M))h(ne);else{const nt=ws(_e(d+1),y);$(nt),h(ne)}},previousYear:()=>{const ne=d>f[0]?d-1:f[0],pe=_e(ne);if(vs(pe,y,M))h(ne);else{const nt=ws(_e(d-1),y);$(nt),h(ne)}}},dateState:{year:d,yearRange:f,month:y,day:M,yearsArray:U,yearsOptionsArray:A,monthsArray:O,monthsOptionsArray:L,daysArray:Y,daysOptionsArray:oe,calendarDayNames:as,calendarDayArray:K,formattedDate:se}}}function uf({date:t=new Date,dateFormat:e,timeFormat:s,options:r={}}){const[o,n]=m.useState("Formatting Time..."),[i,a]=m.useState("Formatting Date..."),c=!!r.ignoreDateFormat,{model:u,ready:d}=J({modelId:ae.type,modelType:ae.type,options:{}}),h=typeof t=="string"?Xe.parseISO(t):t;return m.useEffect(()=>{c?a(""):e?a(Xe.format(h,e)):d&&a(Xe.format(h,u!=null&&u.selectedDateFormat?u==null?void 0:u.selectedDateFormat:""))},[c,t,e,h,u,d]),m.useEffect(()=>{s?n(Xe.format(h,s)):d&&n(Xe.format(h,u!=null&&u.selectedTimeFormat?u==null?void 0:u.selectedTimeFormat:""))},[t,s,h,u,d]),{formattedDate:i,formattedTime:o}}const df=({secondsFromMidnight:t=0})=>{const[e,s]=m.useState(0),[r,o]=m.useState(0),[n,i]=m.useState(0),[a,c]=m.useState(new Date),{formattedTime:u}=uf({date:a,options:{ignoreDateFormat:!0}});return m.useEffect(()=>{const d=Number(t),h=Math.floor(d/3600),f=Math.floor(d%3600/60),p=d%60;s(h),o(f),i(p);const y=new Date;y.setHours(0,0,0,0);const b=new Date(y.getTime()+d*1e3);c(new Date(b))},[t]),{hours:e,minutes:r,seconds:n,formattedTime:u,timeActions:{setHours:s,setMinutes:o,setSeconds:i}}},IT=({configProperty:t})=>{const{value:e}=Gh({configProperty:t}),s=parseInt(e||"0",10),{hours:r,minutes:o,seconds:n,formattedTime:i,timeActions:a}=df({secondsFromMidnight:s}),c=m.useRef();return m.useEffect(()=>{const u=r*3600+o*60+n;return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{t&&t.updateProperty(u.toString())},100),()=>{c.current&&clearTimeout(c.current)}},[t,r,o,n]),{hours:r,minutes:o,seconds:n,formattedTime:i,timeActions:a}};function CT(t,e={}){const{intervalMs:s=5*60*1e3,immediate:r=!0}=e;m.useEffect(()=>{const o=()=>{try{t({__warmup:!0})}catch{}};r&&("requestIdleCallback"in window?requestIdleCallback(o):setTimeout(o,1));const n=s?setInterval(o,s):null;return()=>{n&&clearInterval(n)}},[t,s,r])}const DT=t=>_.jsx("option",{title:t.id,value:t.format,children:t.format},t.id),xT=(t=DT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}});m.useEffect(()=>{const c=X(()=>{s((n==null?void 0:n.dateFormatOptions.map(t))||[])});return()=>{c()}},[n,i,t]),m.useEffect(()=>{const c=X(()=>{n!=null&&n.dateFormatId&&(n!=null&&n.selectedDateFormat)&&o({id:n==null?void 0:n.dateFormatId,value:n==null?void 0:n.selectedDateFormat})});return()=>{c()}},[n==null?void 0:n.selectedDateFormat,n==null?void 0:n.dateFormatId]);const a=m.useCallback(c=>{var d;let u="";typeof c=="string"?u=c:(d=c==null?void 0:c.target)!=null&&d.value&&(u=c.target.value),u&&(n==null||n.setSelectedDateFormat(u))},[n]);return{raw:(n==null?void 0:n.dateFormatOptions.map(c=>c.id))??[],regionModel:n,selectedDateFormat:(r==null?void 0:r.value)||"",dateFormatId:(r==null?void 0:r.id)||"",updateDateFormat:a,props:{onChange:a,value:(r==null?void 0:r.id)||"",options:e}}},AT=t=>_.jsx("option",{title:t,value:t,children:t},t),hf="kos:service:region:settings",ff="timeZone",RT=`${hf}-${ff}`,PT=(t=AT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(""),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}}),a=Et.factory(RT)({path:hf,attribute:ff});m.useEffect(()=>{const u=X(()=>{s((n==null?void 0:n.timeZones.map(t))||[]),n!=null&&n.timeZones.length&&yn(n==null?void 0:n.timeZones[0])});return()=>{u()}},[n,i,t]),m.useEffect(()=>{const u=X(()=>{o(a.value||"")});return()=>{u()}},[a.value]);const c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&yn(d)},[]);return{options:e,raw:(n==null?void 0:n.timeZones)??[],regionModel:n,selectedTimeZone:r,timeZones:(n==null?void 0:n.timeZones)??[],updateTimeZone:c,selectProps:{onChange:c,value:r,options:e}}},pf="kos:service:region",gf="regionId",kT=`${pf}-${gf}`,LT=t=>_.jsx("option",{title:t,value:t,children:t},t),mf=(t=LT)=>{const[e,s]=m.useState([]),[r,o]=m.useState("factory"),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type}),a=Et.factory(kT)({path:pf,attribute:gf});m.useEffect(()=>{const u=X(()=>{s((n==null?void 0:n.availableRegions.map(t))||[])});return()=>{u()}},[n,i,t]),m.useEffect(()=>{const u=X(()=>{o(a.value||"factory")});return()=>{u()}},[a.value]);const c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&yh(d)},[]);return{raw:(n==null?void 0:n.availableRegions)??[],regionModel:n,regionData:n==null?void 0:n.selectedRegion,selectedRegion:r,updateRegion:c,regionSelectProps:{onChange:c,value:r,options:e}}},FT=t=>_.jsx("option",{title:t.id,value:t.format,children:t.format},t.id),NT=(t=FT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}});m.useEffect(()=>{const c=X(()=>{s((n==null?void 0:n.timeFormatOptions.map(t))||[])});return()=>{c()}},[n,i,t]),m.useEffect(()=>{const c=X(()=>{n!=null&&n.timeFormatId&&(n!=null&&n.selectedTimeFormat)&&o({id:n==null?void 0:n.timeFormatId,value:n==null?void 0:n.selectedTimeFormat})});return()=>{c()}},[n==null?void 0:n.selectedTimeFormat,n==null?void 0:n.timeFormatId]);const a=m.useCallback(c=>{var d;let u="";typeof c=="string"?u=c:(d=c==null?void 0:c.target)!=null&&d.value&&(u=c.target.value),u&&(n==null||n.setSelectedTimeFormat(u))},[n]);return{raw:(n==null?void 0:n.timeFormatOptions.map(c=>c.id))??[],regionModel:n,selectedTimeFormat:(r==null?void 0:r.value)??"",timeFormatId:(r==null?void 0:r.id)??"",updateTimeFormat:a,props:{onChange:a,value:(r==null?void 0:r.id)??"",options:e}}},UT=(t,e)=>m.useMemo(()=>si(t),e),jT={config:{attributes:!0,childList:!0,subtree:!0}};function BT(t,e,s=jT){const[r,o]=m.useState(null);m.useEffect(()=>{if(!e||typeof e!="function")throw new Error("A valid callback function is required");const n=new MutationObserver(e);o(n)},[e,s,o]),m.useEffect(()=>{if(!r)return()=>{};if(!t)throw new Error("A valid DOM element is required");const{config:n}=s;try{r.observe(t,n)}catch(i){g.error(i)}return()=>{r&&r.disconnect()}},[r,t,s])}const yf={validateStart:function(t){return!0},validateStop:function(t){const e=t.event.currentTarget.getBoundingClientRect(),[s,r]=t.xy;return s<e.left||s>e.right||r<e.top||r>e.bottom}},Xo=g.createLogger({name:"usePressGesture",group:"kos-hooks"});function KT({onPressed:t,onRelease:e,intersectionStrategy:s=yf}){const r=m.useRef(!1),o=Lf.useGesture({onDragStart:c=>{Xo.info("onDragStart",c.type),s.validateStart(c)&&(t&&t(),r.current=!0)},onDrag:c=>{Xo.info("onDrag",c.type),r.current&&s.validateStop(c)&&(e&&e(),r.current=!1)},onDragEnd:c=>{Xo.info("onDragEnd",c.type),r.current&&e&&(e(),r.current=!1)}}),n=()=>{t&&t(),r.current=!0},i=()=>{r.current&&e&&(e(),r.current=!1)},a=()=>{r.current&&e&&(e(),r.current=!1)};return{dom:o,mesh:()=>({onPointerDown:n,onPointerUp:i,onPointerOut:a})}}const bf=()=>{const[t,e]=m.useState(!1),s=S.getInstance();return m.useEffect(()=>{const r=X(()=>{s&&s.reloading!==t&&e(s.reloading)});return()=>{r()}},[s,t]),[t]};function vf(t=!1,e="2-digit"){return m.useMemo(()=>{const s=t?12:24;return Array.from({length:s},(r,o)=>{const n=t&&o===0?12:o%s;return{id:o,label:e==="2-digit"?n.toString().padStart(2,"0"):n.toString()}})},[e,t])}function vn(t,e="2-digit",s=0,r=0){return m.useMemo(()=>Array.from({length:t},(o,n)=>{const i=String(n+s);return{id:n+r,label:e==="2-digit"?i.padStart(2,"0"):i}}),[t,s,r,e])}function wf(t="en-US"){return m.useMemo(()=>["AM","PM"].map(e=>{const s=new Intl.DateTimeFormat(t,{hour:"2-digit",hour12:!0}).formatToParts(new Date().setHours(e==="AM"?0:12))[2].value;return{id:s,label:s}}),[t])}function Ef({formatOptions:{hour12:t=!0,hour:e="2-digit",minute:s="2-digit",second:r="2-digit"}={hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"},locale:o="en-US"}){const n=vf(t,e),i=vn(60,s),a=vn(60,r),c=wf(o);return{hourOptions:n,minuteOptions:i,secondOptions:a,amPmOptions:c}}function Mf(t,e){return Xe.format(t,e)}function _f({formatOptions:t,initialDate:e=new Date,locale:s="en-US",format:r="HH:mm"}){const[o,n]=m.useState(e),i=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setHours(Number(b)),$})},[]),a=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setMinutes(Number(b)),$})},[]),c=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setSeconds(Number(b)),$})},[]),u=m.useCallback(b=>{const M=new Date(b);n(M)},[]),d=Mf(o,r),{hourOptions:h,minuteOptions:f,secondOptions:p,amPmOptions:y}=Ef({formatOptions:t,locale:s});return{amPmOptions:y,formattedTime:d,hourOptions:h,minuteOptions:f,secondOptions:p,setHours:i,setMinutes:a,setSeconds:c,setTime:u,time:new Date(o)}}const HT=t=>{const{regionModel:e}=mf(),s=m.useMemo(()=>({hour12:e==null?void 0:e.is12HourTimeFormat}),[e==null?void 0:e.is12HourTimeFormat]);return _f({...t,locale:e==null?void 0:e.regionId,format:e==null?void 0:e.selectedTimeFormat,formatOptions:s})};function qT(t,e,s={}){const{disposeOnUnmount:r=!0}=s,[o,n]=m.useState(!1),[i,a]=m.useState(void 0),c=m.useRef(null),u=m.useRef(!0),d=m.useRef(!1),h=m.useMemo(()=>{if(!u.current&&c.current&&r&&yr(c.current)){const p=c.current;Promise.resolve().then(()=>{yr(p)&&p.dispose()})}u.current=!1,d.current=!1;const f=t();return c.current=f,f},e);return m.useEffect(()=>{d.current||(dl(h)?(d.current=!0,n(!1),a(void 0),h.ready().then(()=>{n(!0)}).catch(f=>{a(f),n(!1)})):(n(!0),a(void 0)))},[h]),m.useEffect(()=>()=>{r&&c.current&&yr(c.current)&&c.current.dispose(),c.current=null},[r]),{viewModel:h,ready:o,error:i}}function zT(t){return e=>{const[s]=bf();return s?_.jsx(Oh,{message:"Wait a moment while your project reloads..."}):_.jsx(t,{...e})}}const Za=g.createLogger({name:"studio-properties-service",group:"Services"}),VT="/api/kos/studio/properties",Tf=async t=>{if(Za.debug("sending GET for studio-properties"),!t)throw Za.error("connectionId is undefined"),new Error("connectionId is undefined");return await Ne.get(VT,{},{destinationAddress:t,timeout:500})},GT=Object.freeze(Object.defineProperty({__proto__:null,getStudioProperties:Tf},Symbol.toStringTag,{value:"Module"}));var YT=Object.getOwnPropertyDescriptor,WT=(t,e,s,r)=>{for(var o=r>1?void 0:r?YT(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const Sf="studio-properties-model",QT="/kos/studio/properties",Ja={"kos.studio.tool.legacy":1};let wn=class{constructor(t,e,s){l(this,"id");l(this,"connectionId");l(this,"unsubscribe",null);l(this,"logger");l(this,"data");this.id=t,this.logger=s.logger,this.data=Pe(),this.connectionId=e.connectionId}async init(){this.logger.debug(`initializing studio-properties ${this.id}`)}async load(){this.logger.debug(`loading studio-properties ${this.id}`)}async terminatePropertiesSession(){var t;(t=this.unsubscribe)==null||t.call(this)}async initializePropertiesSession(){this.unsubscribe=Lt.getInstance().subscribeTopic({topic:QT,destinationAddress:this.connectionId,callback:s=>{this.logger.error(`Received studio-properties message for connection ${this.connectionId}: ${JSON.stringify(s)}`)}});const[t,e]=await Tf(this.connectionId);if(t){this.logger.error(`Error loading studio-properties: ${t}`),this.data.setValues(Ja);return}if(e){const s=Object.keys(e).reduce((r,o)=>(r[o]=e[o]??o,r),{});this.data.setValues(s??Ja),g.ifDebug(()=>this.logger.debug(`studio-properties loaded: ${JSON.stringify(s)}`))}}get(t){return this.data[t]}createObservableProperty(t){return si(()=>this.get(t))}};wn=WT([D(Sf)],wn);const XT=new Ee({class:wn,type:Sf});var ZT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,eS=(t,e,s)=>e in t?ZT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,tS=(t,e,s,r)=>{for(var o=r>1?void 0:r?JT(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o},sS=(t,e,s)=>(eS(t,e+"",s),s);const rS="gpio-pin-model";let to=class{constructor(t,e){l(this,"id");l(this,"pinNum");l(this,"chipNum");l(this,"name");l(this,"status");l(this,"connected");this.id=t,this.chipNum=e.chipNum,this.pinNum=e.pinNum,this.name=e.name,this.status="free",this.connected=e.connected??!1}updateModel(t){this.status=t.status??this.status,this.connected=t.connected??this.connected}async init(){this.logger.debug(`initializing gpio-pin ${this.id}`)}async load(){this.logger.debug(`loading gpio-pin ${this.id}`)}};sS(to,"Registration");to=tS([D({modelTypeId:rS,singleton:!1}),Qt()],to);const ea=to.Registration;var oS=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,iS=(t,e,s)=>e in t?oS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,aS=(t,e,s,r)=>{for(var o=r>1?void 0:r?nS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o},cS=(t,e,s)=>(iS(t,e+"",s),s);const lS="gpio-pin-container-model";let so=class{constructor(t,e){l(this,"id");this.id=t}updateModel(t){}getPin(t){const e=this.data[t];if(!e){this.logger.warn(`Pin number ${t} not found in container ${this.id}`);return}if(e.pinNum!==t){this.logger.warn(`Pin number mismatch for pin ${e.id} in container ${this.id}: expected ${t}, got ${e.pinNum}`);return}return this.data[t]}async init(){this.logger.debug(`initializing gpio-pin-container container ${this.id}`)}async load(){this.logger.debug(`loading gpio-pin-container container ${this.id}`)}};cS(so,"Registration");so=aS([D({modelTypeId:lS,singleton:!1}),uo({containerOptions:{sortKey:"pinNum"}}),Qt()],so);const ta=so.Registration;ta.addRelatedModel(ea);var $f=Object.defineProperty,uS=Object.getOwnPropertyDescriptor,dS=(t,e,s)=>e in t?$f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Of=(t,e,s,r)=>{for(var o=r>1?void 0:r?uS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&$f(e,s,o),o},hS=(t,e,s)=>(dS(t,e+"",s),s);const fS="gpio-chip-model";let Vs=class{constructor(t,e){l(this,"id");l(this,"num");l(this,"devName");l(this,"name");l(this,"pinCount");l(this,"pinNames");l(this,"_pins");this.id=t,this.num=e.num,this.devName=e.devName,this.name=e.name,this.pinCount=e.pinCount,this.pinNames=e.pinNames,this._pins=ta.instance(`${this.id}-pins`).options({}).build()}get pinManager(){return this._pins}updateModel(t){}async handleGpioChipLoad(){}async init(){this.logger.debug(`initializing gpio-chip ${this.id}`)}async load(){this.logger.debug(`loading gpio-chip ${this.id}`)}};hS(Vs,"Registration");Of([Oe],Vs.prototype,"_pins",2);Vs=Of([D({modelTypeId:fS,singleton:!1}),Qt()],Vs);const ro=Vs.Registration;g.createLogger({name:"gpio-chip-container-service",group:"Services"});const If="/api/kos/gpio/chips",pS="/api/kos/gpio/pins",Cf=bh,Df=mn,gS=Object.freeze(Object.defineProperty({__proto__:null,GPIO_CHIP_PATH:If,GPIO_PIN_PATH:pS,gpioApi:Df,gpioServiceRequest:Cf},Symbol.toStringTag,{value:"Module"}));var xf=Object.defineProperty,mS=Object.getOwnPropertyDescriptor,yS=(t,e,s)=>e in t?xf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Af=(t,e,s,r)=>{for(var o=r>1?void 0:r?mS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&xf(e,s,o),o},bS=(t,e,s)=>(yS(t,e+"",s),s);const vS="gpio-chip-container-model";let Gs=class{constructor(t,e){l(this,"id");l(this,"destinationAddress");this.id=t,this.destinationAddress=e.destinationAddress??""}updateModel(t){}async handleGpioChipInit(t,e){const[s,r]=await Df.get("/api/kos/gpio/pins",void 0,{destinationAddress:this.destinationAddress});if(s){this.logger.error("Failed to fetch GPIO pins",s);return}Object.entries(e).forEach(([n,i])=>{i.forEach(a=>{var u;if(!a.num&&a.num!==0){this.logger.warn("Skipping GPIO chip with missing number",a);return}const c=ro.instance(`${ro.type}-${a.num}}`).options({num:a.num,devName:a.devName??"",name:a.name??"",pinCount:a.pinCount??0,pinNames:a.pinNames??[]}).build();(u=a.pinNames)==null||u.forEach((d,h)=>{const f=ea.instance(`${c.name}-${d}`).options({name:d,pinNum:h,chipNum:a.num}).build();c.pinManager.addModel(f)}),this.addModel(c)})});const o=["bound","pending","invalid","free"];for(const n of o)Object.entries(r).forEach(([i,a])=>{var c;(c=a==null?void 0:a[n])==null||c.forEach(u=>{const d=u.pinNum,h=u.chipNum;if(h===void 0||d===void 0){this.logger.warn("Skipping pin with missing chipNum or pinNum",u);return}const f=this.data[h];if(!f||f.num!==h){this.logger.warn(`No chip model found for chipNum ${h} when processing pin ${d}`);return}const p=f.pinManager.getPin(d);if(!p){this.logger.warn(`No pin model found for pinNum ${d} in chipNum ${h}`);return}p.updateModel({connected:u.connected,status:n})})})}async init(){this.logger.debug(`initializing gpio-chip-container container ${this.id}`)}async load(){this.logger.debug(`loading gpio-chip-container container ${this.id}`)}};bS(Gs,"Registration");Af([Cf({path:If,method:"get",errorHandler:{strategy:"log",defaultValue:[]},lifecycle:I.INIT,requestOptions:t=>({destinationAddress:t.destinationAddress})})],Gs.prototype,"handleGpioChipInit",1);Gs=Af([D({modelTypeId:vS,singleton:!0}),uo({containerOptions:{sortKey:"num"}}),Qt()],Gs);const Rf=Gs.Registration;Rf.addRelatedModel(ro);Object.defineProperty(exports,"makeAutoObservable",{enumerable:!0,get:()=>E.makeAutoObservable});Object.defineProperty(exports,"makeObservable",{enumerable:!0,get:()=>E.makeObservable});Object.defineProperty(exports,"kosComponent",{enumerable:!0,get:()=>Mn.observer});exports.AncestorPathVisitor=gy;exports.AuthState=zl;exports.BrowserKosRouter=fu;exports.BrowserRouter=gi;exports.CanvasDispatcher=zt;exports.CanvasDispatcherServices=LE;exports.CanvasRenderer=Ri;exports.CanvasStreamer=V_;exports.CanvasStreamerBase=Uh;exports.ChildModels=Je;exports.CompanionParentModel=et;exports.ConfigBean=Rs;exports.ContainerAwareSetup=Nn;exports.CoreExtensionManager=kM;exports.CoreModels=ji;exports.CreateModelTranslationsContext=Ph;exports.CreateModelTranslationsProvider=T_;exports.DateDisplayFormat=lf;exports.DateHelpers=My;exports.DependencyLifecycle=I;exports.DependencyModels=F;exports.DependencyResolutionPolicy=Ze;exports.Device=Xr;exports.DeviceServices=oM;exports.DomIntersectionStrategy=yf;exports.EVENT_KOS_MODEL_READY=$n;exports.EVENT_TROUBLE_ADDED=eb;exports.EVENT_TROUBLE_REMOVED=tb;exports.EXTENSION_CANVAS_RENDERER=re;exports.EXTENSION_FEATURE_FLAG_RESOLVER=su;exports.EXTENSION_FUTURE_LIFECYCLE_WRAPPER=Jc;exports.EXTENSION_TROUBLE_DATA_MAPPER=Nr;exports.EXTENSION_TROUBLE_MAPPER=sr;exports.ErrorBoundaryWithFallback=Ih;exports.EventBus=jf;exports.EventBusFunctional=Kf;exports.EventBusState=qf;exports.ExtensionException=mr;exports.ExtensionManager=T;exports.FUTURE_CONTAINER_MODEL_TYPE=ju;exports.FUTURE_MODEL_TYPE=Fu;exports.FUTURE_NOT_ASSIGNED=oi;exports.FeatureFlagService=ru;exports.FetchError=z;exports.FutureAliases=Ts;exports.FutureContainerFactory=st;exports.FutureContainerModel=Ku;exports.FutureContainerSetup=Pn;exports.FutureEndState=tt;exports.FutureFactory=ts;exports.FutureHandler=po;exports.FutureManager=mt;exports.FutureModel=Uu;exports.FutureService=Es;exports.GpioChip=ro;exports.GpioChipContainer=Rf;exports.GpioChipServices=gS;exports.GpioPin=ea;exports.GpioPinContainer=ta;exports.HEADER_CACHE_CONTROL=nc;exports.HEADER_CONTENT_TYPE=oc;exports.HEADER_DESTINATION_ADDR=Ge;exports.HEADER_FOS_REQUEST_ID=ic;exports.HEADER_METHOD=oo;exports.HEADER_ORDERED=Tn;exports.HEADER_REQUEST_ID=Ys;exports.HEADER_REQUEST_TYPE=Le;exports.HEADER_RESPONSE_ID=no;exports.HEADER_SOURCE_ADDR=rc;exports.HEADER_TOPIC=sc;exports.HEADER_URL=Yt;exports.HEADER_WORK_TRACKER=Sn;exports.HttpRouteHandlers=Ke;exports.KOS_EXECUTION_CONTEXT=ho;exports.KOS_MODEL_ID=Tr;exports.KOS_SERVICE=jM;exports.KOS_SERVICE_1_6_5=KM;exports.KOS_SERVICE_1_8_1=qM;exports.KOS_SERVICE_1_9_X=zM;exports.KeyValue=bi;exports.KeyValueServices=Xb;exports.Kos=he;exports.KosConfigPropertySpec=Et;exports.KosContainerIndex=qn;exports.KosContextBean=du;exports.KosContextManager=Q;exports.KosCore=S;exports.KosCoreModelPropertyMapper=te;exports.KosDataContainer=ti;exports.KosDependencyTypes=Cp;exports.KosExpressionEvaluator=Ju;exports.KosExtensionUtils=zp;exports.KosFeatureFlags=ou;exports.KosFetchMethods=Yc;exports.KosGlobalConfig=An;exports.KosHttpRouteManager=Yn;exports.KosLog=g;exports.KosLogManager=sd;exports.KosLogManagerServices=ow;exports.KosLoggerFactory=Hn;exports.KosMockEvents=lc;exports.KosModel=Kl;exports.KosModelCollectionProvider=v_;exports.KosModelContainer=Fe;exports.KosModelContext=xo;exports.KosModelEvents=k;exports.KosModelFactory=$s;exports.KosModelLoader=Ah;exports.KosModelLoaderDisplay=Rh;exports.KosModelManager=ql;exports.KosModelProvider=Ch;exports.KosModelRegistrationFactory=Ee;exports.KosModelRegistry=gn;exports.KosModelState=w;exports.KosModelSymbol=Rn;exports.KosModelVisitor=Vl;exports.KosObservableData=Xc;exports.KosRegistration=Gy;exports.KosSingletonRegistration=Yy;exports.KosTime=kr;exports.KosTimeContext=Vi;exports.KosTimeProvider=A_;exports.KosTimeServices=dw;exports.KosTimer=vh;exports.KosToken=hu;exports.KosTranslationProvider=U_;exports.KosTranslations=Bd;exports.KosViewModelSymbol=Fc;exports.KosWSTransportStatus=Bl;exports.KosWsEvents=Ws;exports.LOADER_FEATURE_FLAG=_y;exports.LOGIN_HOST=ac;exports.LOGIN_URL=Ff;exports.LoadingMessage=Oh;exports.LogBlock=Us;exports.LogBlockContainer=So;exports.LogConfig=_s;exports.LogStream=Cs;exports.LogStreamContainer=tr;exports.LogStreamServices=Mw;exports.LoggerSetup=Fn;exports.MODEL_DELETION_DELAY=Hl;exports.MiddlewareChain=cu;exports.ModelEffects=Be;exports.ModelError=yl;exports.MultipleFutureContainerSetup=kn;exports.MultipleFutureHandler=Wc;exports.NestedModelContext=Ao;exports.NetworkInterface=Li;exports.NetworkInterfaceContainer=Hs;exports.NetworkInterfaceServices=pM;exports.ObservableData=Pe;exports.OptionsRequired=Qs;exports.Ota=jr;exports.OutsideAlerter=tT;exports.PLUGIN_EXTENSION_NAME=Vp;exports.PORT=cc;exports.PROFILE_ENABLE_RELEASES=Vf;exports.PROFILE_LOG_DEBUG=Oc;exports.PROFILE_LOG_INFO=Ic;exports.PROFILE_RELAX_STORE_VALIDATION=Gf;exports.PROFILE_TOOLS_PREVIEW=$c;exports.ParentModel=Ms;exports.PluginExtensionManager=Gp;exports.ProgressBar=g_;exports.ReferenceConfig=gr;exports.RegionInfo=ae;exports.RegionServices=hb;exports.RegistrationManager=R;exports.Registry=RM;exports.ReloadAwareSetup=Nc;exports.ReplayStrategy=pt;exports.ResponseRetention=ie;exports.STATUS=_n;exports.ServiceFactory=ce;exports.ServiceRequestError=Or;exports.ServiceRequestHandlers=gt;exports.SingletonKosModelRegistrationFactory=Ce;exports.SoftwareInfo=Br;exports.SoftwareInfoContext=Yi;exports.SoftwareInfoProvider=k_;exports.SoftwareInfoServices=oE;exports.StateActionHandlers=sp;exports.StateBean=Ks;exports.StateBeanServices=lE;exports.StateEntryHandlers=Rt;exports.StateExitHandlers=Ss;exports.StateMachineSetup=Wt;exports.StateProp=Ci;exports.StatePropServices=vE;exports.StorageDevice=Jr;exports.StorageDeviceContainer=Vt;exports.StorageDeviceServices=vM;exports.StudioProperties=XT;exports.StudioPropertiesServices=GT;exports.SubscriptionHandlers=Z;exports.TIMER_END=Hi;exports.TIMER_EVENT=Bi;exports.TOPIC_TIMER_TICK_EVENT=Ki;exports.TimerManager=wh;exports.TokenContext=Nh;exports.TokenProvider=F_;exports.Topics=Is;exports.Trans=uT;exports.TransitionMap=vr;exports.Transitions=Vn;exports.Translation=qr;exports.TranslationContainer=Ve;exports.TranslationContainerContext=Wi;exports.TranslationContext=CE;exports.TransportFactory=rn;exports.Trouble=Bs;exports.TroubleAwareSetup=Ln;exports.TroubleContainer=Ht;exports.TroubleServices=jw;exports.Troubles=we;exports.UsbUpdate=Ui;exports.UsbUpdateContainer=zs;exports.UsbUpdateServices=OM;exports.VFS_SERVICE=GM;exports.VFS_SERVICE_1_6_5=WM;exports.VFS_SERVICE_1_8_1=XM;exports.VFS_SERVICE_1_9_X=JM;exports.ViewModelConfig=Un;exports.WS_EVENT_TYPE=Kd;exports.WebSocketEvents=Te;exports.WebSocketTransport=Lt;exports.WsEventFactory=xi;exports.acceptOrgInvitation=$h;exports.addDaysToDate=Ql;exports.addFuture=Au;exports.addMonthsToDate=Wl;exports.api=Pu;exports.applyFunctionalEnhancements=ul;exports.applyMixins=my;exports.arraysEqual=yy;exports.buildConfigBeanModel=ob;exports.buildFuture=pi;exports.buildFutureModel=Du;exports.cancelFuture=Ru;exports.checkAppsStarted=Zy;exports.checkWildcardPattern=ll;exports.clearAllServiceResponses=By;exports.clearPath=jy;exports.clearServiceResponse=Uy;exports.convert=ui;exports.convertFileSizeRaw=zf;exports.convertWithUnits=vb;exports.createBaseMessage=Ol;exports.createBroadcastMessageResponse=Rl;exports.createCancellablePromise=l_;exports.createClient=De;exports.createFosBaseMessage=$l;exports.createHeaders=Il;exports.createKosHtpMessageResponse=Pl;exports.createKosMessage=xl;exports.createKosMessageResponse=kl;exports.createMessageBody=ot;exports.createModelDependency=wl;exports.createOptionKey=Tp;exports.createPropKey=vt;exports.createReadableStream=Cl;exports.createStudioMessage=Sl;exports.createStudioMessageRequest=Dl;exports.createStudioMessageResponse=Al;exports.debounce=al;exports.del=Kc;exports.deleteFuture=xu;exports.destroyKosModel=Re;exports.evaluateScopes=Eu;exports.executeApiMethod=Vc;exports.executeChildrenModelLifecycle=_l;exports.executeDependentModelLifecycle=ls;exports.executeListLifecycle=Ml;exports.fetchModel=Q_;exports.findModel=Jp;exports.findModels=sl;exports.formatDate=Jl;exports.formatDateSince=Yl;exports.formatDateTime=tu;exports.formatTime=eu;exports.get=Bc;exports.getAllKosCompanionModels=rl;exports.getCalendarMonthArray=Zh;exports.getConfigBean=wu;exports.getDayStrings=Jh;exports.getDays=_T;exports.getDaysArray=Yh;exports.getDaysInMonth=Jn;exports.getDependenciesByLifecycle=El;exports.getFormattedDate=TT;exports.getFormattedMonth=ST;exports.getFormattedMonthsArray=Xi;exports.getFormattedYear=_e;exports.getFormattedYearsArray=Xh;exports.getFutures=Lb;exports.getHttpRouteHandlers=Hc;exports.getKosCompanionModel=eg;exports.getKosConnectionId=Oi;exports.getKosLocalizationDescriptor=Ld;exports.getKosMessageLogging=Ac;exports.getKosModel=tl;exports.getKosModelSync=ke;exports.getKosModelType=Zp;exports.getKosServiceApi=NM;exports.getKosSessionKey=uu;exports.getLastDayOfMonth=ws;exports.getLocalizationDescriptor=EE;exports.getLogLevel=xc;exports.getLogMessageToStudio=Rc;exports.getMessageBody=sn;exports.getMonthsArray=Wh;exports.getObservableCompanions=tg;exports.getQueryParams=de;exports.getServiceResponse=Fy;exports.getStartedApps=Jy;exports.getTranslations=kd;exports.getYearsArray=Qh;exports.handleServiceRequestError=Gc;exports.hasCachedResponse=Ny;exports.hasDecimals=bu;exports.hasHttpRouteHandlers=$r;exports.hasKosProfile=Zo;exports.hasReadyHook=dl;exports.hslStringToHex=iu;exports.hslToHex=nu;exports.httpDelete=xp;exports.initKosProvider=$_;exports.initializeStateMachine=Uc;exports.injectStateMachineSupport=Bn;exports.isBoolean=ii;exports.isDisposable=yr;exports.isKosCompanionTypeFactory=fl;exports.isKosDataModel=Os;exports.isKosExecutionContext=Kn;exports.isKosLoggingEnabled=Qf;exports.isKosModel=Ie;exports.isKosModelContainer=Gn;exports.isKosModelReady=Ir;exports.isLeapYear=Zn;exports.isLocalRefId=Hy;exports.isNumber=go;exports.isPrintable=Gg;exports.isTroubleAware=DE;exports.isValidDate=vs;exports.kosAction=ee;exports.kosAutoEffect=X;exports.kosChild=Oe;exports.kosCompanion=$p;exports.kosComputed=si;exports.kosConfigBean=mo;exports.kosConfigProperty=Cb;exports.kosContainerAware=uo;exports.kosContext=Op;exports.kosDependency=Xt;exports.kosEffect=mu;exports.kosFuture=Do;exports.kosFutureAware=jc;exports.kosLogger=Ap;exports.kosLoggerAware=Qt;exports.kosModel=D;exports.kosModelEffect=qc;exports.kosMultipleFutureAware=Ip;exports.kosObservable=ri;exports.kosParentAware=lo;exports.kosReference=Rp;exports.kosServiceRequest=Ye;exports.kosStateBean=r_;exports.kosStateEntry=Fp;exports.kosStateExit=Np;exports.kosStateGuard=Up;exports.kosStateMachine=Lp;exports.kosStateProp=o_;exports.kosSubscribe=mg;exports.kosTopicHandler=B;exports.kosTroubleAware=jp;exports.kosViewModel=Lg;exports.kosWhen=nn;exports.login=_h;exports.mapConfigBeanModelToDto=Su;exports.mapDataToModel=on;exports.mapDtoToConfigBeanModel=_u;exports.mapDtoToFutureModel=fi;exports.mapDtoToFutureOptions=hi;exports.mapUpdateDtoToConfigBeanModel=Tu;exports.modelEventTopicFactory=pl;exports.modelFactory=Jt;exports.modelTypeEventTopicFactory=gl;exports.modifyConfigBean=vu;exports.modifyFuture=Fb;exports.pairedClientHeartbeat=Cy;exports.parseWildcardSegment=cl;exports.pipe=lu;exports.post=Xs;exports.preloadKosModel=og;exports.processId=Ey;exports.processMiddleware=$y;exports.put=Dp;exports.registerCompanionModel=rg;exports.registerCoreModels=ph;exports.registerExtensionPoint=Zt;exports.registerHttpRoutes=im;exports.registerKosModel=nl;exports.registerLegacyModel=ol;exports.resetKosModel=Xp;exports.resetPassword=Sh;exports.resolveBaseUrl=Nl;exports.resolveChild=vl;exports.resolveContainerDeltas=by;exports.resolveItemListDeltas=wy;exports.resolveKosCompanion=Jo;exports.resolveKosContext=Vy;exports.resolveKosProfiles=Dc;exports.resolveListDeltas=vy;exports.resolveServiceRequestParameters=zc;exports.resolveServiceUrl=fe;exports.resolveVariable=au;exports.retryWithExponentialBackoff=xy;exports.sendAsyncIntent=Qy;exports.sendBroadcastMessage=bm;exports.sendIntent=Wy;exports.sendKosHttpMessageResponse=Fl;exports.sendKosMessage=gm;exports.sendKosMessageResponse=Ll;exports.sendRequest=qy;exports.sendStudioMessage=ym;exports.sendStudioMessageRequest=mm;exports.startPasswordReset=Th;exports.stringComponentInsert=qh;exports.studioAcceptOrgInvitation=c_;exports.studioLogin=n_;exports.studioResetPassword=a_;exports.studioStartPasswordReset=i_;exports.subscribeStore=LM;exports.syncPublish=zy;exports.troubleByTypeReducer=Qc;exports.troubleDataFactory=Sd;exports.unloadKosModel=Qp;exports.updateCompanionModelRegistration=Iy;exports.updateModelRegistration=Oy;exports.updateRegion=yh;exports.updateTimeZone=yn;exports.useAmPmValues=wf;exports.useCalendarDayArray=cf;exports.useConfigBean=wT;exports.useConfigProperty=Gh;exports.useContextModel=y_;exports.useContextModelHierarchy=xh;exports.useDateArrays=ef;exports.useDateProps=OT;exports.useDateRelativeConfig=IT;exports.useDateRelativeData=df;exports.useDayNames=nf;exports.useDayOptions=of;exports.useDays=Ji;exports.useDevice=jh;exports.useFormattedDate=af;exports.useFormattedTime=Mf;exports.useFunctionWarmup=CT;exports.useHourValues=vf;exports.useKosCore=Lh;exports.useKosDateFormats=xT;exports.useKosModel=J;exports.useKosRegions=mf;exports.useKosTime=zi;exports.useKosTimeContext=R_;exports.useKosTimeFormats=NT;exports.useKosTimeZones=PT;exports.useKosTranslation=pT;exports.useKosTranslationContext=j_;exports.useLocalComputed=UT;exports.useModelFromHierarchy=E_;exports.useMonths=sf;exports.useMonthsOptions=rf;exports.useMutationObserver=BT;exports.useNetworkInterfaceContainer=Bh;exports.useOta=Kh;exports.usePressGesture=KT;exports.useProjectReload=bf;exports.useRegionTimeProps=HT;exports.useRegionalTimeDate=uf;exports.useSoftwareInfo=Gi;exports.useSoftwareInfoContext=L_;exports.useStateProperty=sT;exports.useStorageDeviceContainer=Hh;exports.useSuspenseData=bn;exports.useTimeOptions=Ef;exports.useTimeProps=_f;exports.useTimeValues=vn;exports.useTimer=oT;exports.useTranslationContainer=zh;exports.useTroubleContainerModel=Qi;exports.useTroubleModel=mT;exports.useTroublePresence=yT;exports.useUsbUpdateContainer=Vh;exports.useViewModel=qT;exports.useYears=Zi;exports.useYearsOptions=tf;exports.uuid=wt;exports.variableToHex=Ty;exports.waitForAppToStart=Xy;exports.waitForAppsToStart=gu;exports.waitForRequest=ei;exports.whenReady=ye;exports.withDevice=W_;exports.withKosTime=X_;exports.withNetworkInterfaceContainer=Z_;exports.withOta=J_;exports.withProjectReloading=zT;exports.withSoftwareInfo=P_;exports.withStorageDeviceContainer=rT;exports.withTranslationContainer=gT;exports.withTroubleContainer=bT;exports.withUsbUpdateContainer=vT;exports.wrapPromise=xn;exports.wrapWithFutureLifecycle=qi;
|
|
227
|
+
`,jh=()=>{const t=Xr.type;return J({modelId:t,modelType:Xr.type,options:{}})};function W_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=jh();return _.jsx(o,{...r,children:_.jsx(t,{...e,device:s})})}}function Q_(t,e,s){const r=new Promise(o=>{S.getInstance().whenReady().then(()=>{const{model:n}=S.getInstance().modelManager.createModelInstance(t,e??t,s);return n.whenReady().then(()=>{o(n.modelData)})})});return xn(r)}function X_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=zi();return _.jsx(o,{...r,children:_.jsx(t,{...e,kosTime:s})})}}const Bh=()=>{const t=Hs.type;return J({modelId:t,modelType:Hs.type,options:{}})};function Z_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Bh();return _.jsx(o,{...r,children:_.jsx(t,{...e,networkInterfaceContainer:s})})}}const Kh=()=>{const t=jr.type;return J({modelId:t,modelType:jr.type,options:{}})};function J_(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Kh();return _.jsx(o,{...r,children:_.jsx(t,{...e,oTA:s})})}}function eT(t,e){m.useEffect(()=>{function s(o){t.current&&!t.current.contains(o.target)&&e()}function r(o){o.key==="Escape"&&e()}return document.addEventListener("mousedown",s),document.addEventListener("keydown",r,!1),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",r,!1)}},[t,e])}function tT(t){const e=m.useRef(null),s=t.onAlert;return eT(e,s),_.jsx("div",{ref:e,style:{width:"100%"},children:t.children})}const sT=t=>{var u;const{stateProp:e}=t,[s,r]=m.useState((u=t.stateProp)==null?void 0:u.value),[o,n]=m.useState(!1),[i,a]=m.useState(void 0);return m.useEffect(()=>{async function d(h){try{h&&(await ye(h),n(!0))}catch(f){a(f.message)}}d(e)},[e]),m.useEffect(()=>{const d=X(()=>{e&&o&&r(e.value)});return()=>{d()}},[o,e]),[s,{ready:o,error:i}]},Hh=()=>{const[t,e]=m.useState(!1),[s,r]=m.useState([]),o=Vt.type,n=J({modelId:o,modelType:Vt.type,options:{}});return m.useEffect(()=>{const i=X(()=>{var a,c;e(((a=n.model)==null?void 0:a.isStorageInserted)??!1),r(((c=n.model)==null?void 0:c.data)??[])});return()=>{i()}},[n.model]),{...n,inserted:t,devices:s}};function rT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Hh();return _.jsx(o,{...r,children:_.jsx(t,{...e,storageDeviceContainer:s})})}}const Qo=g.createLogger({name:"use-timer"}),oT=({timerName:t,onTimerExpired:e,onTimerTick:s,timerEventActions:r,autoStart:o})=>{const n=wh.getTimer(t);m.useEffect(()=>{if(!n){console.warn(`Timer with name ${t} does not exist.`);return}const u=C(Bi,d=>{const{name:h,action:f,remainingTime:p}=d==null?void 0:d.body;h===t&&(f===Hi?e({name:h,action:f,remainingTime:p,timer:n}):r!=null&&r[f]&&r[f]({name:h,action:f,remainingTime:p,timer:n}))});return o&&n.start(),()=>{u.unsubscribe()}},[o,e,r,t,n]),m.useEffect(()=>{if(!n||!s)return;const u=`${Ki}/${t}`,d=C(u,h=>{const{name:f,remainingTime:p}=h==null?void 0:h.body;f===t&&s({name:f,remainingTime:p,timer:n})});return()=>{d.unsubscribe()}},[s,t,n]);const i=m.useCallback(()=>{n?n.start():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]),a=m.useCallback(()=>{n?n.reset():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]),c=m.useCallback(()=>{n?n.pause():Qo.warn(`Timer with name ${t} does not exist.`)},[n,t]);return{timer:n,start:i,reset:a,pause:c}},nT=t=>{const e=/[\\^$.*+?()[\]{}|]/g;return RegExp(e.source).test(t)?t.replace(e,"\\$&"):t},iT=t=>t instanceof RegExp,aT=t=>typeof t=="string",cT=(t,e,s)=>{if(t===""||e==="")return t;let r=e;iT(r)||(r=new RegExp("("+nT(r)+")","gi"));const o=t.split(r);for(let n=1,i=o.length;n<i;n+=2)o[n]=s(o[n],n);return o},qh=(t,e,s)=>{let r=t;return Array.isArray(r)||(r=[r]),r.flatMap(o=>aT(o)?cT(o,e,s):o)};function lT(t,e){let s=t;return Object.entries(e).forEach(([r,o])=>{const n=new RegExp(`<${r}>(.*?)</${r}>|<${r}/>`,"g");s=qh(s,n,(i,a)=>o.type==="br"?_.jsx("br",{}):m.cloneElement(o,{key:`${r}-${a}`},i))}),s}const uT=t=>{const{i18nKey:e,t:s,defaults:r,components:o,values:n={},context:i}=t,a=s(e,{defaultValue:r,data:n,context:i,returnObjects:!0}),c=lT(a,o||{});return _.jsx("span",{className:t.className,children:c})},xt=new Map;function dT(t,e){if(xt.has(t)){const s=xt.get(t);if(s.status==="finished")return s.result;throw s.promise}else{const s=e().then(o=>{xt.set(t,{status:"finished",result:o})},o=>{throw xt.set(t,{status:"error",error:o}),o}),r={status:"pending",promise:s};throw xt.set(t,r),s}}function bn(t,e){return dT(t,e)}const hT=async()=>{const t=await tl(Ve.type);return await ye(t.model),t.model},fT=async(t,e,s)=>{const r=t.resolveNamespace(e);await ye(r);for(const o of s){const n=t.resolveNamespace(o);await ye(n),xt.set(o,{status:"finished",result:n})}return r},pT=(t,e)=>{const s=[t].flat(),[r,...o]=s,n=bn(Ve.type,hT),i=s.join("__"),a=bn(i,()=>fT(n,r,o)),c=m.useMemo(()=>({exists:d=>{const h=e!=null&&e.keyPrefix?`${e.keyPrefix}.${d}`:d;return a?a.exists(h):!1}}),[e==null?void 0:e.keyPrefix,a]);return{t:m.useCallback((d,h)=>{const f=e!=null&&e.keyPrefix?`${e.keyPrefix}.${d}`:d;return a?a.resolveKey(f,h):(g.debug(`Translation model ${t} not ready for key: ${f}`),f)},[e==null?void 0:e.keyPrefix,t,a]),i18n:c}},zh=()=>{const t=Ve.type;return J({modelId:t,modelType:Ve.type,options:{}})};function gT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=zh();return _.jsx(o,{...r,children:_.jsx(t,{...e,translationContainer:s})})}}const mT=t=>J({modelId:t,modelType:Bs.type}),Qi=()=>J({modelId:Ht.type,modelType:Ht.type,options:{}}),yT=({troubleType:t,condition:e})=>{const{model:s}=Qi(),[r,o]=m.useState(!1),[n,i]=m.useState([]),a=m.useCallback(()=>{var c,u;return n.length>0&&((c=n[0])!=null&&c.resolvable)?(u=n[0])==null?void 0:u.resolve():Promise.resolve(void 0)},[n]);return m.useEffect(()=>X(()=>{const u=(t?s==null?void 0:s.troubles.getIndexByKey("byType",t):s==null?void 0:s.troubles.data)||[],d=e?u.filter(e):u;o(d.length>0),i(d)}),[e,s,t]),[r,a,n.length>0?n[0]:void 0,n]};function bT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Qi();return _.jsx(o,{...r,children:_.jsx(t,{...e,troubleContainer:s})})}}const Vh=()=>{const t=zs.type,e=J({modelId:t,modelType:zs.type,options:{},activate:!0,destroyOnUnmount:!0}),[s,r]=m.useState(!1),[o,n]=m.useState(!1),[i,a]=m.useState([]);return m.useEffect(()=>{const c=X(()=>{var u,d,h;r(((u=e.model)==null?void 0:u.isUsbInserted)??!1),n(((d=e.model)==null?void 0:d.hasAvailableUpdates)??!1),a(((h=e.model)==null?void 0:h.data)??[])});return()=>{c()}},[e.model]),{...e,inserted:s,updateAvailable:o,updates:i}};function vT(t){return e=>{const{model:s,status:r,KosModelLoader:o}=Vh();return _.jsx(o,{...r,children:_.jsx(t,{...e,usbUpdateContainer:s})})}}const wT=({path:t,propKey:e})=>{const{status:s}=J({modelType:Rs.type,modelId:t,options:{path:t}}),[r,o]=m.useState(!1),[n,i]=m.useState(),[a,c]=m.useState(""),[u,d]=m.useState(),h=f=>{n&&e&&n.updateProperty(e,f)};return m.useEffect(()=>{var f;s.model&&i(s.model),s.model&&e&&((f=s.model)!=null&&f.props.has(e)?c(s.model.props[e]):d(`property ${e} not found`)),s.ready&&o(s.ready)},[s.ready,s.model,e]),m.useEffect(()=>{e&&E.autorun(()=>{const f=n==null?void 0:n.props[e];c(f||"")})},[n,e]),{config:n,ready:r,value:a,error:u,updateValue:h}},ET=(t,e)=>{switch(e.type){case"UPDATE":return e.payload;default:return t}},Gh=({configProperty:t,optionsTransformer:e})=>{const[s,r]=m.useState(!1),[o,n]=m.useState(""),[i,a]=m.useReducer(ET,{value:String(t==null?void 0:t.value),displayValue:t==null?void 0:t.displayValue,significantValue:t==null?void 0:t.significantValue,unit:t==null?void 0:t.unit,options:t==null?void 0:t.options,mappedOptions:[],updateProperty:t==null?void 0:t.updateProperty,displayOptions:t==null?void 0:t.displayOptions}),c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&(t==null||t.updateProperty(d))},[t]);return m.useEffect(()=>{async function u(d){try{d&&(await ye(d),r(!0))}catch(h){n(h.message)}}u(t)},[t]),m.useEffect(()=>{const u=X(()=>{if(t&&s){let d=[];e&&(d=e(t.options)),a({type:"UPDATE",payload:{value:String(t.value),displayValue:t.displayValue,significantValue:t.significantValue,unit:t.unit,options:t.options,mappedOptions:d,updateProperty:t.updateProperty,displayOptions:t==null?void 0:t.displayOptions}})}});return()=>{u()}},[t,e,s]),{...i,configSelectProps:{onChange:c,value:i.value,options:e?i.mappedOptions||[]:i.options||[]},ready:s,error:o}};function MT(t,e){const s=e??new Date().getFullYear(),r=[31,28,31,30,31,30,31,31,30,31,30,31];return t===1&&(s%4===0&&s%100!==0||s%400===0)?29:r[t]??0}function _T(t,e){return new Date(t,e,0).getDate()}function Yh(t,e){const s=MT(e,t),r=[];for(let o=1;o<=s;o++)r.push(o);return r}function Wh(){return[...Array(12).keys()].map(e=>new Date(0,e).getMonth())}function Qh(t=[2018,2028]){const e=[];for(let s=t[0];s<=t[1];s++)e.push(s);return e}function Xh(t,e=[2018,2028]){const s=Qh(e);return t==="long"?s:s.map(r=>Number(r.toString().substring(2)))}function Xi(t="numeric",e="en-US"){const s=new Intl.DateTimeFormat(e,{month:t,timeZone:"UTC"}).format;return[...Array(12).keys()].map(r=>s(new Date(Date.UTC(0,r,1))))}function TT({locale:t="en-US",year:e,month:s,day:r,formatOptions:o={weekday:"long",year:"numeric",month:"long",day:"numeric"},displayOrder:n}){const i=s-1,a=new Date(e,i,r),c=new Intl.DateTimeFormat(t,{month:o.month}).format(a),u=new Intl.DateTimeFormat(t,{year:o.year}).format(a),d=new Intl.DateTimeFormat(t,{day:o.day}).format(a);return n?n=="MMDDYY"?`${c} ${d} ${u}`:n==="DDMMYY"?`${d} ${c} ${u}`:n==="YYMMDD"?`${u} ${c} ${d}`:`${u} ${d} ${c}`:new Intl.DateTimeFormat(t,o).format(a)}function _e(t){return t.toString().length===2?new Date(Date.parse(`01 Jan 20${t}`)).getFullYear():t}function ST(t){return typeof t=="string"?new Date(Date.parse(`01 ${t.substring(0,3)} 2023`)).getMonth()+1:t}function Zh(t,e,s){const r=_e(e),o=new Date(r,t,1).getDay(),n=new Date(r,t+1,0).getDate();return[...Array(42).keys()].map(a=>a<o||a>n+o-1?{label:"",value:0,disabled:!0}:s[a-o])}function vs(t,e,s){const r=e-1,o=new Date(t,r,s);return new Date(o).getMonth()===r&&new Date(o).getDate()===s}function ws(t,e){return new Date(t,e,0).getDate()}function Jh(t="en-US",e="short"){const s=new Intl.DateTimeFormat(t,{weekday:e}).format;return[...Array(7).keys()].map(r=>s(new Date(Date.UTC(2021,5,r))))}function ef({locale:t="en-US",year:e=new Date().getFullYear(),month:s=new Date().getMonth(),yearRange:r=[2018,2028],daysOfWeekFilter:o=[],formatOptions:{yearFormat:n="long",monthFormat:i="long",dayFormat:a="short"}={}}){const c=Zi(n,r),u=tf(n,r,t),d=sf(i,t),h=rf(i,t),f=Ji(e,s),p=of(e,s,t,o),y=cf(s,e,p),b=nf(t,a);return{daysArray:f,monthsArray:d,yearsArray:c,yearsOptionsArray:u,monthsOptionsArray:h,daysOptionsArray:p,calendarDayArray:y,dayNamesArray:b}}function Zi(t="long",e=[2018,2028]){return m.useMemo(()=>Xh(t,e),[t,e])}function tf(t="long",e=[2018,2028],s="en-US"){const r=Zi(t,e);return m.useMemo(()=>r.map(n=>({label:n.toLocaleString(s).replace(",",""),value:n})),[s,r])}function sf(t,e="en-US"){return m.useMemo(()=>Xi(t,e),[t,e])}function rf(t,e="en-US"){const s=m.useMemo(()=>Wh(),[]),r=m.useMemo(()=>Xi(t,e),[t,e]);return m.useMemo(()=>[...Array(12).keys()].map(n=>({label:r[n],value:Number(s[n])})),[r,s])}function Ji(t,e){const s=_e(t);return m.useMemo(()=>Yh(s,e),[e,s])}const $T=(t,e,s,r=[])=>{const o=new Date(t,e,s).getDay();return r.length>0&&r.includes(o)};function of(t,e,s="en-US",r=[]){const o=Ji(t,e);return m.useMemo(()=>o.map(i=>({label:i.toLocaleString(s),value:i,disabled:$T(t,e,i,r)})),[r,s,e,o,t])}function nf(t="en-US",e="short"){return m.useMemo(()=>Jh(t,e),[t,e])}function af({year:t=new Date().getFullYear(),month:e=new Date().getMonth(),day:s=new Date().getDate(),formatString:r}){const o=e,n=new Date(t,o,s);return{formattedDate:Xe.format(n,r)}}function cf(t,e,s){return m.useMemo(()=>Zh(t,e,s),[t,e,s])}var lf=(t=>(t.MMDDYY="MMDDYY",t.DDMMYY="DDMMYY",t.YYMMDD="YYMMDD",t.YYDDMM="YYDDMM",t))(lf||{});function OT({locale:t="en-US",date:{year:e=new Date().getFullYear(),month:s=new Date().getMonth(),day:r=new Date().getDate()}={year:new Date().getFullYear(),month:new Date().getMonth(),day:new Date().getDate()},formatOptions:{yearFormat:o="long",monthFormat:n="long",dayFormat:i="short",formatString:a="yyyy/MM/dd"}={},filterOptions:{yearsRange:c=[2018,2028],daysOfWeekFilter:u=[]}={}}){const[d,h]=m.useState(e),[f,p]=m.useState(c),[y,b]=m.useState(s),[M,$]=m.useState(r);m.useEffect(()=>{h(e)},[e]),m.useEffect(()=>{b(s)},[s]),m.useEffect(()=>{$(r)},[r]);const{yearsArray:U,yearsOptionsArray:A,monthsArray:O,monthsOptionsArray:L,daysArray:Y,daysOptionsArray:oe,calendarDayArray:K,dayNamesArray:as}=ef({locale:t,year:d,yearRange:f,month:y,formatOptions:{yearFormat:o,monthFormat:n,dayFormat:i},daysOfWeekFilter:u}),{formattedDate:se}=af({year:d,month:y,day:M,formatString:a});return{dateActions:{setYear:h,setYearRange:p,setMonth:b,setDay:$,nextMonth:()=>{const ne=y<11?_e(d):_e(d+1),pe=y<11?y+1:0;if(!vs(ne,pe,M)){const nt=ws(ne,pe);$(nt)}pe===0&&h(ne),b(pe)},previousMonth:()=>{const ne=_e(y===0?d-1:d),pe=y===0?11:y-1;if(!vs(ne,pe,M)){const nt=ws(ne,pe);$(nt)}pe===11&&h(ne),b(pe)},nextYear:()=>{const ne=d<f[1]?d+1:f[0],pe=_e(ne);if(vs(pe,y,M))h(ne);else{const nt=ws(_e(d+1),y);$(nt),h(ne)}},previousYear:()=>{const ne=d>f[0]?d-1:f[0],pe=_e(ne);if(vs(pe,y,M))h(ne);else{const nt=ws(_e(d-1),y);$(nt),h(ne)}}},dateState:{year:d,yearRange:f,month:y,day:M,yearsArray:U,yearsOptionsArray:A,monthsArray:O,monthsOptionsArray:L,daysArray:Y,daysOptionsArray:oe,calendarDayNames:as,calendarDayArray:K,formattedDate:se}}}function uf({date:t=new Date,dateFormat:e,timeFormat:s,options:r={}}){const[o,n]=m.useState("Formatting Time..."),[i,a]=m.useState("Formatting Date..."),c=!!r.ignoreDateFormat,{model:u,ready:d}=J({modelId:ae.type,modelType:ae.type,options:{}}),h=typeof t=="string"?Xe.parseISO(t):t;return m.useEffect(()=>{c?a(""):e?a(Xe.format(h,e)):d&&a(Xe.format(h,u!=null&&u.selectedDateFormat?u==null?void 0:u.selectedDateFormat:""))},[c,t,e,h,u,d]),m.useEffect(()=>{s?n(Xe.format(h,s)):d&&n(Xe.format(h,u!=null&&u.selectedTimeFormat?u==null?void 0:u.selectedTimeFormat:""))},[t,s,h,u,d]),{formattedDate:i,formattedTime:o}}const df=({secondsFromMidnight:t=0})=>{const[e,s]=m.useState(0),[r,o]=m.useState(0),[n,i]=m.useState(0),[a,c]=m.useState(new Date),{formattedTime:u}=uf({date:a,options:{ignoreDateFormat:!0}});return m.useEffect(()=>{const d=Number(t),h=Math.floor(d/3600),f=Math.floor(d%3600/60),p=d%60;s(h),o(f),i(p);const y=new Date;y.setHours(0,0,0,0);const b=new Date(y.getTime()+d*1e3);c(new Date(b))},[t]),{hours:e,minutes:r,seconds:n,formattedTime:u,timeActions:{setHours:s,setMinutes:o,setSeconds:i}}},IT=({configProperty:t})=>{const{value:e}=Gh({configProperty:t}),s=parseInt(e||"0",10),{hours:r,minutes:o,seconds:n,formattedTime:i,timeActions:a}=df({secondsFromMidnight:s}),c=m.useRef();return m.useEffect(()=>{const u=r*3600+o*60+n;return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{t&&t.updateProperty(u.toString())},100),()=>{c.current&&clearTimeout(c.current)}},[t,r,o,n]),{hours:r,minutes:o,seconds:n,formattedTime:i,timeActions:a}};function CT(t,e={}){const{intervalMs:s=5*60*1e3,immediate:r=!0}=e;m.useEffect(()=>{const o=()=>{try{t({__warmup:!0})}catch{}};r&&("requestIdleCallback"in window?requestIdleCallback(o):setTimeout(o,1));const n=s?setInterval(o,s):null;return()=>{n&&clearInterval(n)}},[t,s,r])}const DT=t=>_.jsx("option",{title:t.id,value:t.format,children:t.format},t.id),xT=(t=DT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}});m.useEffect(()=>{const c=X(()=>{s((n==null?void 0:n.dateFormatOptions.map(t))||[])});return()=>{c()}},[n,i,t]),m.useEffect(()=>{const c=X(()=>{n!=null&&n.dateFormatId&&(n!=null&&n.selectedDateFormat)&&o({id:n==null?void 0:n.dateFormatId,value:n==null?void 0:n.selectedDateFormat})});return()=>{c()}},[n==null?void 0:n.selectedDateFormat,n==null?void 0:n.dateFormatId]);const a=m.useCallback(c=>{var d;let u="";typeof c=="string"?u=c:(d=c==null?void 0:c.target)!=null&&d.value&&(u=c.target.value),u&&(n==null||n.setSelectedDateFormat(u))},[n]);return{raw:(n==null?void 0:n.dateFormatOptions.map(c=>c.id))??[],regionModel:n,selectedDateFormat:(r==null?void 0:r.value)||"",dateFormatId:(r==null?void 0:r.id)||"",updateDateFormat:a,props:{onChange:a,value:(r==null?void 0:r.id)||"",options:e}}},AT=t=>_.jsx("option",{title:t,value:t,children:t},t),hf="kos:service:region:settings",ff="timeZone",RT=`${hf}-${ff}`,PT=(t=AT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(""),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}}),a=Et.factory(RT)({path:hf,attribute:ff});m.useEffect(()=>{const u=X(()=>{s((n==null?void 0:n.timeZones.map(t))||[]),n!=null&&n.timeZones.length&&yn(n==null?void 0:n.timeZones[0])});return()=>{u()}},[n,i,t]),m.useEffect(()=>{const u=X(()=>{o(a.value||"")});return()=>{u()}},[a.value]);const c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&yn(d)},[]);return{options:e,raw:(n==null?void 0:n.timeZones)??[],regionModel:n,selectedTimeZone:r,timeZones:(n==null?void 0:n.timeZones)??[],updateTimeZone:c,selectProps:{onChange:c,value:r,options:e}}},pf="kos:service:region",gf="regionId",kT=`${pf}-${gf}`,LT=t=>_.jsx("option",{title:t,value:t,children:t},t),mf=(t=LT)=>{const[e,s]=m.useState([]),[r,o]=m.useState("factory"),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type}),a=Et.factory(kT)({path:pf,attribute:gf});m.useEffect(()=>{const u=X(()=>{s((n==null?void 0:n.availableRegions.map(t))||[])});return()=>{u()}},[n,i,t]),m.useEffect(()=>{const u=X(()=>{o(a.value||"factory")});return()=>{u()}},[a.value]);const c=m.useCallback(u=>{var h;let d="factory";typeof u=="string"?d=u:(h=u==null?void 0:u.target)!=null&&h.value&&(d=u.target.value),d&&yh(d)},[]);return{raw:(n==null?void 0:n.availableRegions)??[],regionModel:n,regionData:n==null?void 0:n.selectedRegion,selectedRegion:r,updateRegion:c,regionSelectProps:{onChange:c,value:r,options:e}}},FT=t=>_.jsx("option",{title:t.id,value:t.format,children:t.format},t.id),NT=(t=FT)=>{const[e,s]=m.useState([]),[r,o]=m.useState(),{model:n,ready:i}=J({modelType:ae.type,modelId:ae.type,options:{}});m.useEffect(()=>{const c=X(()=>{s((n==null?void 0:n.timeFormatOptions.map(t))||[])});return()=>{c()}},[n,i,t]),m.useEffect(()=>{const c=X(()=>{n!=null&&n.timeFormatId&&(n!=null&&n.selectedTimeFormat)&&o({id:n==null?void 0:n.timeFormatId,value:n==null?void 0:n.selectedTimeFormat})});return()=>{c()}},[n==null?void 0:n.selectedTimeFormat,n==null?void 0:n.timeFormatId]);const a=m.useCallback(c=>{var d;let u="";typeof c=="string"?u=c:(d=c==null?void 0:c.target)!=null&&d.value&&(u=c.target.value),u&&(n==null||n.setSelectedTimeFormat(u))},[n]);return{raw:(n==null?void 0:n.timeFormatOptions.map(c=>c.id))??[],regionModel:n,selectedTimeFormat:(r==null?void 0:r.value)??"",timeFormatId:(r==null?void 0:r.id)??"",updateTimeFormat:a,props:{onChange:a,value:(r==null?void 0:r.id)??"",options:e}}},UT=(t,e)=>m.useMemo(()=>si(t),e),jT={config:{attributes:!0,childList:!0,subtree:!0}};function BT(t,e,s=jT){const[r,o]=m.useState(null);m.useEffect(()=>{if(!e||typeof e!="function")throw new Error("A valid callback function is required");const n=new MutationObserver(e);o(n)},[e,s,o]),m.useEffect(()=>{if(!r)return()=>{};if(!t)throw new Error("A valid DOM element is required");const{config:n}=s;try{r.observe(t,n)}catch(i){g.error(i)}return()=>{r&&r.disconnect()}},[r,t,s])}const yf={validateStart:function(t){return!0},validateStop:function(t){const e=t.event.currentTarget.getBoundingClientRect(),[s,r]=t.xy;return s<e.left||s>e.right||r<e.top||r>e.bottom}},Xo=g.createLogger({name:"usePressGesture",group:"kos-hooks"});function KT({onPressed:t,onRelease:e,intersectionStrategy:s=yf}){const r=m.useRef(!1),o=Lf.useGesture({onDragStart:c=>{Xo.info("onDragStart",c.type),s.validateStart(c)&&(t&&t(),r.current=!0)},onDrag:c=>{Xo.info("onDrag",c.type),r.current&&s.validateStop(c)&&(e&&e(),r.current=!1)},onDragEnd:c=>{Xo.info("onDragEnd",c.type),r.current&&e&&(e(),r.current=!1)}}),n=()=>{t&&t(),r.current=!0},i=()=>{r.current&&e&&(e(),r.current=!1)},a=()=>{r.current&&e&&(e(),r.current=!1)};return{dom:o,mesh:()=>({onPointerDown:n,onPointerUp:i,onPointerOut:a})}}const bf=()=>{const[t,e]=m.useState(!1),s=S.getInstance();return m.useEffect(()=>{const r=X(()=>{s&&s.reloading!==t&&e(s.reloading)});return()=>{r()}},[s,t]),[t]};function vf(t=!1,e="2-digit"){return m.useMemo(()=>{const s=t?12:24;return Array.from({length:s},(r,o)=>{const n=t&&o===0?12:o%s;return{id:o,label:e==="2-digit"?n.toString().padStart(2,"0"):n.toString()}})},[e,t])}function vn(t,e="2-digit",s=0,r=0){return m.useMemo(()=>Array.from({length:t},(o,n)=>{const i=String(n+s);return{id:n+r,label:e==="2-digit"?i.padStart(2,"0"):i}}),[t,s,r,e])}function wf(t="en-US"){return m.useMemo(()=>["AM","PM"].map(e=>{const s=new Intl.DateTimeFormat(t,{hour:"2-digit",hour12:!0}).formatToParts(new Date().setHours(e==="AM"?0:12))[2].value;return{id:s,label:s}}),[t])}function Ef({formatOptions:{hour12:t=!0,hour:e="2-digit",minute:s="2-digit",second:r="2-digit"}={hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"},locale:o="en-US"}){const n=vf(t,e),i=vn(60,s),a=vn(60,r),c=wf(o);return{hourOptions:n,minuteOptions:i,secondOptions:a,amPmOptions:c}}function Mf(t,e){return Xe.format(t,e)}function _f({formatOptions:t,initialDate:e=new Date,locale:s="en-US",format:r="HH:mm"}){const[o,n]=m.useState(e),i=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setHours(Number(b)),$})},[]),a=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setMinutes(Number(b)),$})},[]),c=m.useCallback(b=>{n(M=>{const $=new Date(M);return $.setSeconds(Number(b)),$})},[]),u=m.useCallback(b=>{const M=new Date(b);n(M)},[]),d=Mf(o,r),{hourOptions:h,minuteOptions:f,secondOptions:p,amPmOptions:y}=Ef({formatOptions:t,locale:s});return{amPmOptions:y,formattedTime:d,hourOptions:h,minuteOptions:f,secondOptions:p,setHours:i,setMinutes:a,setSeconds:c,setTime:u,time:new Date(o)}}const HT=t=>{const{regionModel:e}=mf(),s=m.useMemo(()=>({hour12:e==null?void 0:e.is12HourTimeFormat}),[e==null?void 0:e.is12HourTimeFormat]);return _f({...t,locale:e==null?void 0:e.regionId,format:e==null?void 0:e.selectedTimeFormat,formatOptions:s})};function qT(t,e,s={}){const{disposeOnUnmount:r=!0}=s,[o,n]=m.useState(!1),[i,a]=m.useState(void 0),c=m.useRef(null),u=m.useRef(!0),d=m.useRef(!1),h=m.useMemo(()=>{if(!u.current&&c.current&&r&&yr(c.current)){const p=c.current;Promise.resolve().then(()=>{yr(p)&&p.dispose()})}u.current=!1,d.current=!1;const f=t();return c.current=f,f},e);return m.useEffect(()=>{d.current||(dl(h)?(d.current=!0,n(!1),a(void 0),h.ready().then(()=>{n(!0)}).catch(f=>{a(f),n(!1)})):(n(!0),a(void 0)))},[h]),m.useEffect(()=>()=>{r&&c.current&&yr(c.current)&&c.current.dispose(),c.current=null},[r]),{viewModel:h,ready:o,error:i}}function zT(t){return e=>{const[s]=bf();return s?_.jsx(Oh,{message:"Wait a moment while your project reloads..."}):_.jsx(t,{...e})}}const Za=g.createLogger({name:"studio-properties-service",group:"Services"}),VT="/api/kos/studio/properties",Tf=async t=>{if(Za.debug("sending GET for studio-properties"),!t)throw Za.error("connectionId is undefined"),new Error("connectionId is undefined");return await Ne.get(VT,{},{destinationAddress:t,timeout:500})},GT=Object.freeze(Object.defineProperty({__proto__:null,getStudioProperties:Tf},Symbol.toStringTag,{value:"Module"}));var YT=Object.getOwnPropertyDescriptor,WT=(t,e,s,r)=>{for(var o=r>1?void 0:r?YT(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o};const Sf="studio-properties-model",QT="/kos/studio/properties",Ja={"kos.studio.tool.legacy":1};let wn=class{constructor(t,e,s){l(this,"id");l(this,"connectionId");l(this,"unsubscribe",null);l(this,"logger");l(this,"data");this.id=t,this.logger=s.logger,this.data=Pe(),this.connectionId=e.connectionId}async init(){this.logger.debug(`initializing studio-properties ${this.id}`)}async load(){this.logger.debug(`loading studio-properties ${this.id}`)}async terminatePropertiesSession(){var t;(t=this.unsubscribe)==null||t.call(this)}async initializePropertiesSession(){this.unsubscribe=Lt.getInstance().subscribeTopic({topic:QT,destinationAddress:this.connectionId,callback:s=>{this.logger.error(`Received studio-properties message for connection ${this.connectionId}: ${JSON.stringify(s)}`)}});const[t,e]=await Tf(this.connectionId);if(t){this.logger.error(`Error loading studio-properties: ${t}`),this.data.setValues(Ja);return}if(e){const s=Object.keys(e).reduce((r,o)=>(r[o]=e[o]??o,r),{});this.data.setValues(s??Ja),g.ifDebug(()=>this.logger.debug(`studio-properties loaded: ${JSON.stringify(s)}`))}}get(t){return this.data[t]}createObservableProperty(t){return si(()=>this.get(t))}};wn=WT([D(Sf)],wn);const XT=new Ee({class:wn,type:Sf});var ZT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,eS=(t,e,s)=>e in t?ZT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,tS=(t,e,s,r)=>{for(var o=r>1?void 0:r?JT(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o},sS=(t,e,s)=>(eS(t,e+"",s),s);const rS="gpio-pin-model";let to=class{constructor(t,e){l(this,"id");l(this,"pinNum");l(this,"chipNum");l(this,"name");l(this,"status");l(this,"connected");this.id=t,this.chipNum=e.chipNum,this.pinNum=e.pinNum,this.name=e.name,this.status="free",this.connected=e.connected??!1}updateModel(t){this.status=t.status??this.status,this.connected=t.connected??this.connected}async init(){this.logger.debug(`initializing gpio-pin ${this.id}`)}async load(){this.logger.debug(`loading gpio-pin ${this.id}`)}};sS(to,"Registration");to=tS([D({modelTypeId:rS,singleton:!1}),Qt()],to);const ea=to.Registration;var oS=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,iS=(t,e,s)=>e in t?oS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,aS=(t,e,s,r)=>{for(var o=r>1?void 0:r?nS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=i(o)||o);return o},cS=(t,e,s)=>(iS(t,e+"",s),s);const lS="gpio-pin-container-model";let so=class{constructor(t,e){l(this,"id");this.id=t}updateModel(t){}getPin(t){const e=this.data[t];if(!e){this.logger.warn(`Pin number ${t} not found in container ${this.id}`);return}if(e.pinNum!==t){this.logger.warn(`Pin number mismatch for pin ${e.id} in container ${this.id}: expected ${t}, got ${e.pinNum}`);return}return this.data[t]}async init(){this.logger.debug(`initializing gpio-pin-container container ${this.id}`)}async load(){this.logger.debug(`loading gpio-pin-container container ${this.id}`)}};cS(so,"Registration");so=aS([D({modelTypeId:lS,singleton:!1}),uo({containerOptions:{sortKey:"pinNum"}}),Qt()],so);const ta=so.Registration;ta.addRelatedModel(ea);var $f=Object.defineProperty,uS=Object.getOwnPropertyDescriptor,dS=(t,e,s)=>e in t?$f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Of=(t,e,s,r)=>{for(var o=r>1?void 0:r?uS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&$f(e,s,o),o},hS=(t,e,s)=>(dS(t,e+"",s),s);const fS="gpio-chip-model";let Vs=class{constructor(t,e){l(this,"id");l(this,"num");l(this,"devName");l(this,"name");l(this,"pinCount");l(this,"pinNames");l(this,"_pins");this.id=t,this.num=e.num,this.devName=e.devName,this.name=e.name,this.pinCount=e.pinCount,this.pinNames=e.pinNames,this._pins=ta.instance(`${this.id}-pins`).options({}).build()}get pinManager(){return this._pins}updateModel(t){}async handleGpioChipLoad(){}async init(){this.logger.debug(`initializing gpio-chip ${this.id}`)}async load(){this.logger.debug(`loading gpio-chip ${this.id}`)}};hS(Vs,"Registration");Of([Oe],Vs.prototype,"_pins",2);Vs=Of([D({modelTypeId:fS,singleton:!1}),Qt()],Vs);const ro=Vs.Registration;g.createLogger({name:"gpio-chip-container-service",group:"Services"});const If="/api/kos/gpio/chips",pS="/api/kos/gpio/pins",Cf=bh,Df=mn,gS=Object.freeze(Object.defineProperty({__proto__:null,GPIO_CHIP_PATH:If,GPIO_PIN_PATH:pS,gpioApi:Df,gpioServiceRequest:Cf},Symbol.toStringTag,{value:"Module"}));var xf=Object.defineProperty,mS=Object.getOwnPropertyDescriptor,yS=(t,e,s)=>e in t?xf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Af=(t,e,s,r)=>{for(var o=r>1?void 0:r?mS(e,s):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&xf(e,s,o),o},bS=(t,e,s)=>(yS(t,e+"",s),s);const vS="gpio-chip-container-model";let Gs=class{constructor(t,e){l(this,"id");l(this,"destinationAddress");this.id=t,this.destinationAddress=e.destinationAddress??""}updateModel(t){}async handleGpioChipInit(t,e){const[s,r]=await Df.get("/api/kos/gpio/pins",void 0,{destinationAddress:this.destinationAddress});if(s){this.logger.error("Failed to fetch GPIO pins",s);return}Object.entries(e).forEach(([n,i])=>{i.forEach(a=>{var u;if(!a.num&&a.num!==0){this.logger.warn("Skipping GPIO chip with missing number",a);return}const c=ro.instance(`${ro.type}-${a.num}}`).options({num:a.num,devName:a.devName??"",name:a.name??"",pinCount:a.pinCount??0,pinNames:a.pinNames??[]}).build();(u=a.pinNames)==null||u.forEach((d,h)=>{const f=ea.instance(`${c.name}-${d}`).options({name:d,pinNum:h,chipNum:a.num}).build();c.pinManager.addModel(f)}),this.addModel(c)})});const o=["bound","pending","invalid","free"];for(const n of o)Object.entries(r).forEach(([i,a])=>{var c;(c=a==null?void 0:a[n])==null||c.forEach(u=>{const d=u.pinNum,h=u.chipNum;if(h===void 0||d===void 0){this.logger.warn("Skipping pin with missing chipNum or pinNum",u);return}const f=this.data[h];if(!f||f.num!==h){this.logger.warn(`No chip model found for chipNum ${h} when processing pin ${d}`);return}const p=f.pinManager.getPin(d);if(!p){this.logger.warn(`No pin model found for pinNum ${d} in chipNum ${h}`);return}p.updateModel({connected:u.connected,status:n})})})}async init(){this.logger.debug(`initializing gpio-chip-container container ${this.id}`)}async load(){this.logger.debug(`loading gpio-chip-container container ${this.id}`)}};bS(Gs,"Registration");Af([Cf({path:If,method:"get",errorHandler:{strategy:"log",defaultValue:[]},lifecycle:I.INIT,requestOptions:t=>({destinationAddress:t.destinationAddress})})],Gs.prototype,"handleGpioChipInit",1);Gs=Af([D({modelTypeId:vS,singleton:!0}),uo({containerOptions:{sortKey:"num"}}),Qt()],Gs);const Rf=Gs.Registration;Rf.addRelatedModel(ro);Object.defineProperty(exports,"makeAutoObservable",{enumerable:!0,get:()=>E.makeAutoObservable});Object.defineProperty(exports,"makeObservable",{enumerable:!0,get:()=>E.makeObservable});Object.defineProperty(exports,"kosComponent",{enumerable:!0,get:()=>Mn.observer});exports.AncestorPathVisitor=gy;exports.AuthState=zl;exports.BrowserKosRouter=fu;exports.BrowserRouter=gi;exports.CanvasDispatcher=zt;exports.CanvasDispatcherServices=LE;exports.CanvasRenderer=Ri;exports.CanvasStreamer=V_;exports.CanvasStreamerBase=Uh;exports.ChildModels=Je;exports.CompanionParentModel=et;exports.ConfigBean=Rs;exports.ContainerAwareSetup=Nn;exports.CoreExtensionManager=kM;exports.CoreModels=ji;exports.CreateModelTranslationsContext=Ph;exports.CreateModelTranslationsProvider=T_;exports.DateDisplayFormat=lf;exports.DateHelpers=My;exports.DependencyLifecycle=I;exports.DependencyModels=F;exports.DependencyResolutionPolicy=Ze;exports.Device=Xr;exports.DeviceServices=oM;exports.DomIntersectionStrategy=yf;exports.EVENT_KOS_MODEL_READY=$n;exports.EVENT_TROUBLE_ADDED=eb;exports.EVENT_TROUBLE_REMOVED=tb;exports.EXTENSION_CANVAS_RENDERER=re;exports.EXTENSION_FEATURE_FLAG_RESOLVER=su;exports.EXTENSION_FUTURE_LIFECYCLE_WRAPPER=Jc;exports.EXTENSION_TROUBLE_DATA_MAPPER=Nr;exports.EXTENSION_TROUBLE_MAPPER=sr;exports.ErrorBoundaryWithFallback=Ih;exports.EventBus=jf;exports.EventBusFunctional=Kf;exports.EventBusState=qf;exports.ExtensionException=mr;exports.ExtensionManager=T;exports.FUTURE_CONTAINER_MODEL_TYPE=ju;exports.FUTURE_MODEL_TYPE=Fu;exports.FUTURE_NOT_ASSIGNED=oi;exports.FeatureFlagService=ru;exports.FetchError=z;exports.FutureAliases=Ts;exports.FutureContainerFactory=st;exports.FutureContainerModel=Ku;exports.FutureContainerSetup=Pn;exports.FutureEndState=tt;exports.FutureFactory=ts;exports.FutureHandler=po;exports.FutureManager=mt;exports.FutureModel=Uu;exports.FutureService=Es;exports.GpioChip=ro;exports.GpioChipContainer=Rf;exports.GpioChipServices=gS;exports.GpioPin=ea;exports.GpioPinContainer=ta;exports.HEADER_CACHE_CONTROL=nc;exports.HEADER_CONTENT_TYPE=oc;exports.HEADER_DESTINATION_ADDR=Ge;exports.HEADER_FOS_REQUEST_ID=ic;exports.HEADER_METHOD=oo;exports.HEADER_ORDERED=Tn;exports.HEADER_REQUEST_ID=Ys;exports.HEADER_REQUEST_TYPE=Le;exports.HEADER_RESPONSE_ID=no;exports.HEADER_SOURCE_ADDR=rc;exports.HEADER_TOPIC=sc;exports.HEADER_URL=Yt;exports.HEADER_WORK_TRACKER=Sn;exports.HttpRouteHandlers=Ke;exports.KOS_EXECUTION_CONTEXT=ho;exports.KOS_MODEL_ID=Tr;exports.KOS_SERVICE=zM;exports.KOS_SERVICE_1_6_5=jM;exports.KOS_SERVICE_1_8_1=KM;exports.KOS_SERVICE_1_9_X=HM;exports.KeyValue=bi;exports.KeyValueServices=Xb;exports.Kos=he;exports.KosConfigPropertySpec=Et;exports.KosContainerIndex=qn;exports.KosContextBean=du;exports.KosContextManager=Q;exports.KosCore=S;exports.KosCoreModelPropertyMapper=te;exports.KosDataContainer=ti;exports.KosDependencyTypes=Cp;exports.KosExpressionEvaluator=Ju;exports.KosExtensionUtils=zp;exports.KosFeatureFlags=ou;exports.KosFetchMethods=Yc;exports.KosGlobalConfig=An;exports.KosHttpRouteManager=Yn;exports.KosLog=g;exports.KosLogManager=sd;exports.KosLogManagerServices=ow;exports.KosLoggerFactory=Hn;exports.KosMockEvents=lc;exports.KosModel=Kl;exports.KosModelCollectionProvider=v_;exports.KosModelContainer=Fe;exports.KosModelContext=xo;exports.KosModelEvents=k;exports.KosModelFactory=$s;exports.KosModelLoader=Ah;exports.KosModelLoaderDisplay=Rh;exports.KosModelManager=ql;exports.KosModelProvider=Ch;exports.KosModelRegistrationFactory=Ee;exports.KosModelRegistry=gn;exports.KosModelState=w;exports.KosModelSymbol=Rn;exports.KosModelVisitor=Vl;exports.KosObservableData=Xc;exports.KosRegistration=Gy;exports.KosSingletonRegistration=Yy;exports.KosTime=kr;exports.KosTimeContext=Vi;exports.KosTimeProvider=A_;exports.KosTimeServices=dw;exports.KosTimer=vh;exports.KosToken=hu;exports.KosTranslationProvider=U_;exports.KosTranslations=Bd;exports.KosViewModelSymbol=Fc;exports.KosWSTransportStatus=Bl;exports.KosWsEvents=Ws;exports.LOADER_FEATURE_FLAG=_y;exports.LOGIN_HOST=ac;exports.LOGIN_URL=Ff;exports.LoadingMessage=Oh;exports.LogBlock=Us;exports.LogBlockContainer=So;exports.LogConfig=_s;exports.LogStream=Cs;exports.LogStreamContainer=tr;exports.LogStreamServices=Mw;exports.LoggerSetup=Fn;exports.MODEL_DELETION_DELAY=Hl;exports.MiddlewareChain=cu;exports.ModelEffects=Be;exports.ModelError=yl;exports.MultipleFutureContainerSetup=kn;exports.MultipleFutureHandler=Wc;exports.NestedModelContext=Ao;exports.NetworkInterface=Li;exports.NetworkInterfaceContainer=Hs;exports.NetworkInterfaceServices=pM;exports.ObservableData=Pe;exports.OptionsRequired=Qs;exports.Ota=jr;exports.OutsideAlerter=tT;exports.PLUGIN_EXTENSION_NAME=Vp;exports.PORT=cc;exports.PROFILE_ENABLE_RELEASES=Vf;exports.PROFILE_LOG_DEBUG=Oc;exports.PROFILE_LOG_INFO=Ic;exports.PROFILE_RELAX_STORE_VALIDATION=Gf;exports.PROFILE_TOOLS_PREVIEW=$c;exports.ParentModel=Ms;exports.PluginExtensionManager=Gp;exports.ProgressBar=g_;exports.ReferenceConfig=gr;exports.RegionInfo=ae;exports.RegionServices=hb;exports.RegistrationManager=R;exports.Registry=RM;exports.ReloadAwareSetup=Nc;exports.ReplayStrategy=pt;exports.ResponseRetention=ie;exports.STATUS=_n;exports.ServiceFactory=ce;exports.ServiceRequestError=Or;exports.ServiceRequestHandlers=gt;exports.SingletonKosModelRegistrationFactory=Ce;exports.SoftwareInfo=Br;exports.SoftwareInfoContext=Yi;exports.SoftwareInfoProvider=k_;exports.SoftwareInfoServices=oE;exports.StateActionHandlers=sp;exports.StateBean=Ks;exports.StateBeanServices=lE;exports.StateEntryHandlers=Rt;exports.StateExitHandlers=Ss;exports.StateMachineSetup=Wt;exports.StateProp=Ci;exports.StatePropServices=vE;exports.StorageDevice=Jr;exports.StorageDeviceContainer=Vt;exports.StorageDeviceServices=vM;exports.StudioProperties=XT;exports.StudioPropertiesServices=GT;exports.SubscriptionHandlers=Z;exports.TIMER_END=Hi;exports.TIMER_EVENT=Bi;exports.TOPIC_TIMER_TICK_EVENT=Ki;exports.TimerManager=wh;exports.TokenContext=Nh;exports.TokenProvider=F_;exports.Topics=Is;exports.Trans=uT;exports.TransitionMap=vr;exports.Transitions=Vn;exports.Translation=qr;exports.TranslationContainer=Ve;exports.TranslationContainerContext=Wi;exports.TranslationContext=CE;exports.TransportFactory=rn;exports.Trouble=Bs;exports.TroubleAwareSetup=Ln;exports.TroubleContainer=Ht;exports.TroubleServices=jw;exports.Troubles=we;exports.UsbUpdate=Ui;exports.UsbUpdateContainer=zs;exports.UsbUpdateServices=OM;exports.VFS_SERVICE=JM;exports.VFS_SERVICE_1_6_5=GM;exports.VFS_SERVICE_1_8_1=WM;exports.VFS_SERVICE_1_9_X=XM;exports.ViewModelConfig=Un;exports.WS_EVENT_TYPE=Kd;exports.WebSocketEvents=Te;exports.WebSocketTransport=Lt;exports.WsEventFactory=xi;exports.acceptOrgInvitation=$h;exports.addDaysToDate=Ql;exports.addFuture=Au;exports.addMonthsToDate=Wl;exports.api=Pu;exports.applyFunctionalEnhancements=ul;exports.applyMixins=my;exports.arraysEqual=yy;exports.buildConfigBeanModel=ob;exports.buildFuture=pi;exports.buildFutureModel=Du;exports.cancelFuture=Ru;exports.checkAppsStarted=Zy;exports.checkWildcardPattern=ll;exports.clearAllServiceResponses=By;exports.clearPath=jy;exports.clearServiceResponse=Uy;exports.convert=ui;exports.convertFileSizeRaw=zf;exports.convertWithUnits=vb;exports.createBaseMessage=Ol;exports.createBroadcastMessageResponse=Rl;exports.createCancellablePromise=l_;exports.createClient=De;exports.createFosBaseMessage=$l;exports.createHeaders=Il;exports.createKosHtpMessageResponse=Pl;exports.createKosMessage=xl;exports.createKosMessageResponse=kl;exports.createMessageBody=ot;exports.createModelDependency=wl;exports.createOptionKey=Tp;exports.createPropKey=vt;exports.createReadableStream=Cl;exports.createStudioMessage=Sl;exports.createStudioMessageRequest=Dl;exports.createStudioMessageResponse=Al;exports.debounce=al;exports.del=Kc;exports.deleteFuture=xu;exports.destroyKosModel=Re;exports.evaluateScopes=Eu;exports.executeApiMethod=Vc;exports.executeChildrenModelLifecycle=_l;exports.executeDependentModelLifecycle=ls;exports.executeListLifecycle=Ml;exports.fetchModel=Q_;exports.findModel=Jp;exports.findModels=sl;exports.formatDate=Jl;exports.formatDateSince=Yl;exports.formatDateTime=tu;exports.formatTime=eu;exports.get=Bc;exports.getAllKosCompanionModels=rl;exports.getCalendarMonthArray=Zh;exports.getConfigBean=wu;exports.getDayStrings=Jh;exports.getDays=_T;exports.getDaysArray=Yh;exports.getDaysInMonth=Jn;exports.getDependenciesByLifecycle=El;exports.getFormattedDate=TT;exports.getFormattedMonth=ST;exports.getFormattedMonthsArray=Xi;exports.getFormattedYear=_e;exports.getFormattedYearsArray=Xh;exports.getFutures=Lb;exports.getHttpRouteHandlers=Hc;exports.getKosCompanionModel=eg;exports.getKosConnectionId=Oi;exports.getKosLocalizationDescriptor=Ld;exports.getKosMessageLogging=Ac;exports.getKosModel=tl;exports.getKosModelSync=ke;exports.getKosModelType=Zp;exports.getKosServiceApi=NM;exports.getKosSessionKey=uu;exports.getLastDayOfMonth=ws;exports.getLocalizationDescriptor=EE;exports.getLogLevel=xc;exports.getLogMessageToStudio=Rc;exports.getMessageBody=sn;exports.getMonthsArray=Wh;exports.getObservableCompanions=tg;exports.getQueryParams=de;exports.getServiceResponse=Fy;exports.getStartedApps=Jy;exports.getTranslations=kd;exports.getYearsArray=Qh;exports.handleServiceRequestError=Gc;exports.hasCachedResponse=Ny;exports.hasDecimals=bu;exports.hasHttpRouteHandlers=$r;exports.hasKosProfile=Zo;exports.hasReadyHook=dl;exports.hslStringToHex=iu;exports.hslToHex=nu;exports.httpDelete=xp;exports.initKosProvider=$_;exports.initializeStateMachine=Uc;exports.injectStateMachineSupport=Bn;exports.isBoolean=ii;exports.isDisposable=yr;exports.isKosCompanionTypeFactory=fl;exports.isKosDataModel=Os;exports.isKosExecutionContext=Kn;exports.isKosLoggingEnabled=Qf;exports.isKosModel=Ie;exports.isKosModelContainer=Gn;exports.isKosModelReady=Ir;exports.isLeapYear=Zn;exports.isLocalRefId=Hy;exports.isNumber=go;exports.isPrintable=Gg;exports.isTroubleAware=DE;exports.isValidDate=vs;exports.kosAction=ee;exports.kosAutoEffect=X;exports.kosChild=Oe;exports.kosCompanion=$p;exports.kosComputed=si;exports.kosConfigBean=mo;exports.kosConfigProperty=Cb;exports.kosContainerAware=uo;exports.kosContext=Op;exports.kosDependency=Xt;exports.kosEffect=mu;exports.kosFuture=Do;exports.kosFutureAware=jc;exports.kosLogger=Ap;exports.kosLoggerAware=Qt;exports.kosModel=D;exports.kosModelEffect=qc;exports.kosMultipleFutureAware=Ip;exports.kosObservable=ri;exports.kosParentAware=lo;exports.kosReference=Rp;exports.kosServiceRequest=Ye;exports.kosStateBean=r_;exports.kosStateEntry=Fp;exports.kosStateExit=Np;exports.kosStateGuard=Up;exports.kosStateMachine=Lp;exports.kosStateProp=o_;exports.kosSubscribe=mg;exports.kosTopicHandler=B;exports.kosTroubleAware=jp;exports.kosViewModel=Lg;exports.kosWhen=nn;exports.login=_h;exports.mapConfigBeanModelToDto=Su;exports.mapDataToModel=on;exports.mapDtoToConfigBeanModel=_u;exports.mapDtoToFutureModel=fi;exports.mapDtoToFutureOptions=hi;exports.mapUpdateDtoToConfigBeanModel=Tu;exports.modelEventTopicFactory=pl;exports.modelFactory=Jt;exports.modelTypeEventTopicFactory=gl;exports.modifyConfigBean=vu;exports.modifyFuture=Fb;exports.pairedClientHeartbeat=Cy;exports.parseWildcardSegment=cl;exports.pipe=lu;exports.post=Xs;exports.preloadKosModel=og;exports.processId=Ey;exports.processMiddleware=$y;exports.put=Dp;exports.registerCompanionModel=rg;exports.registerCoreModels=ph;exports.registerExtensionPoint=Zt;exports.registerHttpRoutes=im;exports.registerKosModel=nl;exports.registerLegacyModel=ol;exports.resetKosModel=Xp;exports.resetPassword=Sh;exports.resolveBaseUrl=Nl;exports.resolveChild=vl;exports.resolveContainerDeltas=by;exports.resolveItemListDeltas=wy;exports.resolveKosCompanion=Jo;exports.resolveKosContext=Vy;exports.resolveKosProfiles=Dc;exports.resolveListDeltas=vy;exports.resolveServiceRequestParameters=zc;exports.resolveServiceUrl=fe;exports.resolveVariable=au;exports.retryWithExponentialBackoff=xy;exports.sendAsyncIntent=Qy;exports.sendBroadcastMessage=bm;exports.sendIntent=Wy;exports.sendKosHttpMessageResponse=Fl;exports.sendKosMessage=gm;exports.sendKosMessageResponse=Ll;exports.sendRequest=qy;exports.sendStudioMessage=ym;exports.sendStudioMessageRequest=mm;exports.startPasswordReset=Th;exports.stringComponentInsert=qh;exports.studioAcceptOrgInvitation=c_;exports.studioLogin=n_;exports.studioResetPassword=a_;exports.studioStartPasswordReset=i_;exports.subscribeStore=LM;exports.syncPublish=zy;exports.troubleByTypeReducer=Qc;exports.troubleDataFactory=Sd;exports.unloadKosModel=Qp;exports.updateCompanionModelRegistration=Iy;exports.updateModelRegistration=Oy;exports.updateRegion=yh;exports.updateTimeZone=yn;exports.useAmPmValues=wf;exports.useCalendarDayArray=cf;exports.useConfigBean=wT;exports.useConfigProperty=Gh;exports.useContextModel=y_;exports.useContextModelHierarchy=xh;exports.useDateArrays=ef;exports.useDateProps=OT;exports.useDateRelativeConfig=IT;exports.useDateRelativeData=df;exports.useDayNames=nf;exports.useDayOptions=of;exports.useDays=Ji;exports.useDevice=jh;exports.useFormattedDate=af;exports.useFormattedTime=Mf;exports.useFunctionWarmup=CT;exports.useHourValues=vf;exports.useKosCore=Lh;exports.useKosDateFormats=xT;exports.useKosModel=J;exports.useKosRegions=mf;exports.useKosTime=zi;exports.useKosTimeContext=R_;exports.useKosTimeFormats=NT;exports.useKosTimeZones=PT;exports.useKosTranslation=pT;exports.useKosTranslationContext=j_;exports.useLocalComputed=UT;exports.useModelFromHierarchy=E_;exports.useMonths=sf;exports.useMonthsOptions=rf;exports.useMutationObserver=BT;exports.useNetworkInterfaceContainer=Bh;exports.useOta=Kh;exports.usePressGesture=KT;exports.useProjectReload=bf;exports.useRegionTimeProps=HT;exports.useRegionalTimeDate=uf;exports.useSoftwareInfo=Gi;exports.useSoftwareInfoContext=L_;exports.useStateProperty=sT;exports.useStorageDeviceContainer=Hh;exports.useSuspenseData=bn;exports.useTimeOptions=Ef;exports.useTimeProps=_f;exports.useTimeValues=vn;exports.useTimer=oT;exports.useTranslationContainer=zh;exports.useTroubleContainerModel=Qi;exports.useTroubleModel=mT;exports.useTroublePresence=yT;exports.useUsbUpdateContainer=Vh;exports.useViewModel=qT;exports.useYears=Zi;exports.useYearsOptions=tf;exports.uuid=wt;exports.variableToHex=Ty;exports.waitForAppToStart=Xy;exports.waitForAppsToStart=gu;exports.waitForRequest=ei;exports.whenReady=ye;exports.withDevice=W_;exports.withKosTime=X_;exports.withNetworkInterfaceContainer=Z_;exports.withOta=J_;exports.withProjectReloading=zT;exports.withSoftwareInfo=P_;exports.withStorageDeviceContainer=rT;exports.withTranslationContainer=gT;exports.withTroubleContainer=bT;exports.withUsbUpdateContainer=vT;exports.wrapPromise=xn;exports.wrapWithFutureLifecycle=qi;
|
|
228
228
|
//# sourceMappingURL=index.cjs.map
|