@vived/sandbox 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(){try{var s=document.createElement("style");s.textContent=`._parent_1wcp6_1{display:grid;place-items:center}@media(prefers-color-scheme:dark){.wmde-markdown,.wmde-markdown-var{color-scheme:dark;--color-prettylights-syntax-comment: #8b949e;--color-prettylights-syntax-constant: #79c0ff;--color-prettylights-syntax-entity: #d2a8ff;--color-prettylights-syntax-storage-modifier-import: #c9d1d9;--color-prettylights-syntax-entity-tag: #7ee787;--color-prettylights-syntax-keyword: #ff7b72;--color-prettylights-syntax-string: #a5d6ff;--color-prettylights-syntax-variable: #ffa657;--color-prettylights-syntax-brackethighlighter-unmatched: #f85149;--color-prettylights-syntax-invalid-illegal-text: #f0f6fc;--color-prettylights-syntax-invalid-illegal-bg: #8e1519;--color-prettylights-syntax-carriage-return-text: #f0f6fc;--color-prettylights-syntax-carriage-return-bg: #b62324;--color-prettylights-syntax-string-regexp: #7ee787;--color-prettylights-syntax-markup-list: #f2cc60;--color-prettylights-syntax-markup-heading: #1f6feb;--color-prettylights-syntax-markup-italic: #c9d1d9;--color-prettylights-syntax-markup-bold: #c9d1d9;--color-prettylights-syntax-markup-deleted-text: #ffdcd7;--color-prettylights-syntax-markup-deleted-bg: #67060c;--color-prettylights-syntax-markup-inserted-text: #aff5b4;--color-prettylights-syntax-markup-inserted-bg: #033a16;--color-prettylights-syntax-markup-changed-text: #ffdfb6;--color-prettylights-syntax-markup-changed-bg: #5a1e02;--color-prettylights-syntax-markup-ignored-text: #c9d1d9;--color-prettylights-syntax-markup-ignored-bg: #1158c7;--color-prettylights-syntax-meta-diff-range: #d2a8ff;--color-prettylights-syntax-brackethighlighter-angle: #8b949e;--color-prettylights-syntax-sublimelinter-gutter-mark: #484f58;--color-prettylights-syntax-constant-other-reference-link: #a5d6ff;--color-fg-default: #c9d1d9;--color-fg-muted: #8b949e;--color-fg-subtle: #484f58;--color-canvas-default: #0d1117;--color-canvas-subtle: #161b22;--color-border-default: #30363d;--color-border-muted: #21262d;--color-neutral-muted: rgba(110, 118, 129, .4);--color-accent-fg: #58a6ff;--color-accent-emphasis: #1f6feb;--color-attention-subtle: rgba(187, 128, 9, .15);--color-danger-fg: #f85149}}@media(prefers-color-scheme:light){.wmde-markdown,.wmde-markdown-var{color-scheme:light;--color-prettylights-syntax-comment: #6e7781;--color-prettylights-syntax-constant: #0550ae;--color-prettylights-syntax-entity: #8250df;--color-prettylights-syntax-storage-modifier-import: #24292f;--color-prettylights-syntax-entity-tag: #116329;--color-prettylights-syntax-keyword: #cf222e;--color-prettylights-syntax-string: #0a3069;--color-prettylights-syntax-variable: #953800;--color-prettylights-syntax-brackethighlighter-unmatched: #82071e;--color-prettylights-syntax-invalid-illegal-text: #f6f8fa;--color-prettylights-syntax-invalid-illegal-bg: #82071e;--color-prettylights-syntax-carriage-return-text: #f6f8fa;--color-prettylights-syntax-carriage-return-bg: #cf222e;--color-prettylights-syntax-string-regexp: #116329;--color-prettylights-syntax-markup-list: #3b2300;--color-prettylights-syntax-markup-heading: #0550ae;--color-prettylights-syntax-markup-italic: #24292f;--color-prettylights-syntax-markup-bold: #24292f;--color-prettylights-syntax-markup-deleted-text: #82071e;--color-prettylights-syntax-markup-deleted-bg: #ffebe9;--color-prettylights-syntax-markup-inserted-text: #116329;--color-prettylights-syntax-markup-inserted-bg: #dafbe1;--color-prettylights-syntax-markup-changed-text: #953800;--color-prettylights-syntax-markup-changed-bg: #ffd8b5;--color-prettylights-syntax-markup-ignored-text: #eaeef2;--color-prettylights-syntax-markup-ignored-bg: #0550ae;--color-prettylights-syntax-meta-diff-range: #8250df;--color-prettylights-syntax-brackethighlighter-angle: #57606a;--color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f;--color-prettylights-syntax-constant-other-reference-link: #0a3069;--color-fg-default: #24292f;--color-fg-muted: #57606a;--color-fg-subtle: #6e7781;--color-canvas-default: #ffffff;--color-canvas-subtle: #f6f8fa;--color-border-default: #d0d7de;--color-border-muted: hsl(210, 18%, 87%);--color-neutral-muted: rgba(175, 184, 193, .2);--color-accent-fg: #0969da;--color-accent-emphasis: #0969da;--color-attention-subtle: #fff8c5;--color-danger-fg: #cf222e}}[data-color-mode*=dark] .wmde-markdown,[data-color-mode*=dark] .wmde-markdown-var,.wmde-markdown-var[data-color-mode*=dark],.wmde-markdown[data-color-mode*=dark],body[data-color-mode*=dark]{color-scheme:dark;--color-prettylights-syntax-comment: #8b949e;--color-prettylights-syntax-constant: #79c0ff;--color-prettylights-syntax-entity: #d2a8ff;--color-prettylights-syntax-storage-modifier-import: #c9d1d9;--color-prettylights-syntax-entity-tag: #7ee787;--color-prettylights-syntax-keyword: #ff7b72;--color-prettylights-syntax-string: #a5d6ff;--color-prettylights-syntax-variable: #ffa657;--color-prettylights-syntax-brackethighlighter-unmatched: #f85149;--color-prettylights-syntax-invalid-illegal-text: #f0f6fc;--color-prettylights-syntax-invalid-illegal-bg: #8e1519;--color-prettylights-syntax-carriage-return-text: #f0f6fc;--color-prettylights-syntax-carriage-return-bg: #b62324;--color-prettylights-syntax-string-regexp: #7ee787;--color-prettylights-syntax-markup-list: #f2cc60;--color-prettylights-syntax-markup-heading: #1f6feb;--color-prettylights-syntax-markup-italic: #c9d1d9;--color-prettylights-syntax-markup-bold: #c9d1d9;--color-prettylights-syntax-markup-deleted-text: #ffdcd7;--color-prettylights-syntax-markup-deleted-bg: #67060c;--color-prettylights-syntax-markup-inserted-text: #aff5b4;--color-prettylights-syntax-markup-inserted-bg: #033a16;--color-prettylights-syntax-markup-changed-text: #ffdfb6;--color-prettylights-syntax-markup-changed-bg: #5a1e02;--color-prettylights-syntax-markup-ignored-text: #c9d1d9;--color-prettylights-syntax-markup-ignored-bg: #1158c7;--color-prettylights-syntax-meta-diff-range: #d2a8ff;--color-prettylights-syntax-brackethighlighter-angle: #8b949e;--color-prettylights-syntax-sublimelinter-gutter-mark: #484f58;--color-prettylights-syntax-constant-other-reference-link: #a5d6ff;--color-fg-default: #c9d1d9;--color-fg-muted: #8b949e;--color-fg-subtle: #484f58;--color-canvas-default: #0d1117;--color-canvas-subtle: #161b22;--color-border-default: #30363d;--color-border-muted: #21262d;--color-neutral-muted: rgba(110, 118, 129, .4);--color-accent-fg: #58a6ff;--color-accent-emphasis: #1f6feb;--color-attention-subtle: rgba(187, 128, 9, .15);--color-danger-fg: #f85149}[data-color-mode*=light] .wmde-markdown,[data-color-mode*=light] .wmde-markdown-var,.wmde-markdown-var[data-color-mode*=light],.wmde-markdown[data-color-mode*=light],body[data-color-mode*=light]{color-scheme:light;--color-prettylights-syntax-comment: #6e7781;--color-prettylights-syntax-constant: #0550ae;--color-prettylights-syntax-entity: #8250df;--color-prettylights-syntax-storage-modifier-import: #24292f;--color-prettylights-syntax-entity-tag: #116329;--color-prettylights-syntax-keyword: #cf222e;--color-prettylights-syntax-string: #0a3069;--color-prettylights-syntax-variable: #953800;--color-prettylights-syntax-brackethighlighter-unmatched: #82071e;--color-prettylights-syntax-invalid-illegal-text: #f6f8fa;--color-prettylights-syntax-invalid-illegal-bg: #82071e;--color-prettylights-syntax-carriage-return-text: #f6f8fa;--color-prettylights-syntax-carriage-return-bg: #cf222e;--color-prettylights-syntax-string-regexp: #116329;--color-prettylights-syntax-markup-list: #3b2300;--color-prettylights-syntax-markup-heading: #0550ae;--color-prettylights-syntax-markup-italic: #24292f;--color-prettylights-syntax-markup-bold: #24292f;--color-prettylights-syntax-markup-deleted-text: #82071e;--color-prettylights-syntax-markup-deleted-bg: #ffebe9;--color-prettylights-syntax-markup-inserted-text: #116329;--color-prettylights-syntax-markup-inserted-bg: #dafbe1;--color-prettylights-syntax-markup-changed-text: #953800;--color-prettylights-syntax-markup-changed-bg: #ffd8b5;--color-prettylights-syntax-markup-ignored-text: #eaeef2;--color-prettylights-syntax-markup-ignored-bg: #0550ae;--color-prettylights-syntax-meta-diff-range: #8250df;--color-prettylights-syntax-brackethighlighter-angle: #57606a;--color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f;--color-prettylights-syntax-constant-other-reference-link: #0a3069;--color-fg-default: #24292f;--color-fg-muted: #57606a;--color-fg-subtle: #6e7781;--color-canvas-default: #ffffff;--color-canvas-subtle: #f6f8fa;--color-border-default: #d0d7de;--color-border-muted: hsl(210, 18%, 87%);--color-neutral-muted: rgba(175, 184, 193, .2);--color-accent-fg: #0969da;--color-accent-emphasis: #0969da;--color-attention-subtle: #fff8c5;--color-danger-fg: #cf222e}.wmde-markdown{-webkit-text-size-adjust:100%;font-family:-apple-system,Segoe UI,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;line-height:1.5;word-wrap:break-word;color:var(--color-fg-default);background-color:var(--color-canvas-default)}.wmde-markdown details,.wmde-markdown figcaption,.wmde-markdown figure{display:block}.wmde-markdown summary{display:list-item}.wmde-markdown [hidden]{display:none!important}.wmde-markdown a{background-color:transparent;color:var(--color-accent-fg);text-decoration:none}.wmde-markdown a:active,.wmde-markdown a:hover{outline-width:0}.wmde-markdown abbr[title]{border-bottom:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.wmde-markdown b,.wmde-markdown strong{font-weight:600}.wmde-markdown dfn{font-style:italic}.wmde-markdown h1{margin:.67em 0;font-weight:600;padding-bottom:.3em;font-size:2em;border-bottom:1px solid var(--color-border-muted)}.wmde-markdown mark{background-color:var(--color-attention-subtle);color:var(--color-text-primary)}.wmde-markdown small{font-size:90%}.wmde-markdown sub,.wmde-markdown sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.wmde-markdown sub{bottom:-.25em}.wmde-markdown sup{top:-.5em}.wmde-markdown img{display:inline-block;border-style:none;max-width:100%;box-sizing:content-box;background-color:var(--color-canvas-default)}.wmde-markdown code,.wmde-markdown kbd,.wmde-markdown pre,.wmde-markdown samp{font-family:monospace,monospace;font-size:1em}.wmde-markdown figure{margin:1em 40px}.wmde-markdown hr{box-sizing:content-box;overflow:hidden;background:transparent;border:0;border-bottom:1px solid var(--color-border-muted);height:.25em;padding:0;margin:24px 0;background-color:var(--color-border-default)}.wmde-markdown input{font:inherit;margin:0;overflow:visible;font-family:inherit;font-size:inherit;line-height:inherit}.wmde-markdown [type=button],.wmde-markdown [type=reset],.wmde-markdown [type=submit]{-webkit-appearance:button}.wmde-markdown [type=button]::-moz-focus-inner,.wmde-markdown [type=reset]::-moz-focus-inner,.wmde-markdown [type=submit]::-moz-focus-inner{border-style:none;padding:0}.wmde-markdown [type=button]:-moz-focusring,.wmde-markdown [type=reset]:-moz-focusring,.wmde-markdown [type=submit]:-moz-focusring{outline:1px dotted ButtonText}.wmde-markdown [type=checkbox],.wmde-markdown [type=radio]{box-sizing:border-box;padding:0}.wmde-markdown [type=number]::-webkit-inner-spin-button,.wmde-markdown [type=number]::-webkit-outer-spin-button{height:auto}.wmde-markdown [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.wmde-markdown [type=search]::-webkit-search-cancel-button,.wmde-markdown [type=search]::-webkit-search-decoration{-webkit-appearance:none}.wmde-markdown ::-webkit-input-placeholder{color:inherit;opacity:.54}.wmde-markdown ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.wmde-markdown a:hover{text-decoration:underline}.wmde-markdown hr:before{display:table;content:""}.wmde-markdown hr:after{display:table;clear:both;content:""}.wmde-markdown table{border-spacing:0;border-collapse:collapse;display:block;width:-webkit-max-content;width:max-content;max-width:100%}.wmde-markdown td,.wmde-markdown th{padding:0}.wmde-markdown details summary{cursor:pointer}.wmde-markdown details:not([open])>*:not(summary){display:none!important}.wmde-markdown kbd{display:inline-block;padding:3px 5px;font:11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;line-height:10px;color:var(--color-fg-default);vertical-align:middle;background-color:var(--color-canvas-subtle);border:solid 1px var(--color-neutral-muted);border-bottom-color:var(--color-neutral-muted);border-radius:6px;box-shadow:inset 0 -1px 0 var(--color-neutral-muted)}.wmde-markdown h1,.wmde-markdown h2,.wmde-markdown h3,.wmde-markdown h4,.wmde-markdown h5,.wmde-markdown h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.wmde-markdown h2{font-weight:600;padding-bottom:.3em;font-size:1.5em;border-bottom:1px solid var(--color-border-muted)}.wmde-markdown h3{font-weight:600;font-size:1.25em}.wmde-markdown h4{font-weight:600;font-size:1em}.wmde-markdown h5{font-weight:600;font-size:.875em}.wmde-markdown h6{font-weight:600;font-size:.85em;color:var(--color-fg-muted)}.wmde-markdown p{margin-top:0;margin-bottom:10px}.wmde-markdown blockquote{margin:0;padding:0 1em;color:var(--color-fg-muted);border-left:.25em solid var(--color-border-default)}.wmde-markdown ul,.wmde-markdown ol{margin-top:0;margin-bottom:0;padding-left:2em}.wmde-markdown ol ol,.wmde-markdown ul ol{list-style-type:lower-roman}.wmde-markdown ul ul ol,.wmde-markdown ul ol ol,.wmde-markdown ol ul ol,.wmde-markdown ol ol ol{list-style-type:lower-alpha}.wmde-markdown dd{margin-left:0}.wmde-markdown tt,.wmde-markdown code{font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:12px}.wmde-markdown pre{margin-top:0;margin-bottom:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:12px;word-wrap:normal}.wmde-markdown .octicon{display:inline-block;overflow:visible!important;vertical-align:text-bottom;fill:currentColor}.wmde-markdown ::-webkit-input-placeholder{color:var(--color-fg-subtle);opacity:1}.wmde-markdown ::placeholder{color:var(--color-fg-subtle);opacity:1}.wmde-markdown input::-webkit-outer-spin-button,.wmde-markdown input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wmde-markdown [data-catalyst]{display:block}.wmde-markdown:before{display:table;content:""}.wmde-markdown:after{display:table;clear:both;content:""}.wmde-markdown>*:first-child{margin-top:0!important}.wmde-markdown>*:last-child{margin-bottom:0!important}.wmde-markdown a:not([href]){color:inherit;text-decoration:none}.wmde-markdown .absent{color:var(--color-danger-fg)}.wmde-markdown a.anchor{float:left;padding-right:4px;margin-left:-20px;line-height:1}.wmde-markdown .anchor:focus{outline:none}.wmde-markdown p,.wmde-markdown blockquote,.wmde-markdown ul,.wmde-markdown ol,.wmde-markdown dl,.wmde-markdown table,.wmde-markdown pre,.wmde-markdown details{margin-top:0;margin-bottom:16px}.wmde-markdown blockquote>:first-child{margin-top:0}.wmde-markdown blockquote>:last-child{margin-bottom:0}.wmde-markdown sup>a:before{content:"["}.wmde-markdown sup>a:after{content:"]"}.wmde-markdown h1 .octicon-link,.wmde-markdown h2 .octicon-link,.wmde-markdown h3 .octicon-link,.wmde-markdown h4 .octicon-link,.wmde-markdown h5 .octicon-link,.wmde-markdown h6 .octicon-link{color:var(--color-fg-default);vertical-align:middle;visibility:hidden}.wmde-markdown h1:hover .anchor,.wmde-markdown h2:hover .anchor,.wmde-markdown h3:hover .anchor,.wmde-markdown h4:hover .anchor,.wmde-markdown h5:hover .anchor,.wmde-markdown h6:hover .anchor{text-decoration:none}.wmde-markdown h1:hover .anchor .octicon-link,.wmde-markdown h2:hover .anchor .octicon-link,.wmde-markdown h3:hover .anchor .octicon-link,.wmde-markdown h4:hover .anchor .octicon-link,.wmde-markdown h5:hover .anchor .octicon-link,.wmde-markdown h6:hover .anchor .octicon-link{visibility:visible}.wmde-markdown h1 tt,.wmde-markdown h1 code,.wmde-markdown h2 tt,.wmde-markdown h2 code,.wmde-markdown h3 tt,.wmde-markdown h3 code,.wmde-markdown h4 tt,.wmde-markdown h4 code,.wmde-markdown h5 tt,.wmde-markdown h5 code,.wmde-markdown h6 tt,.wmde-markdown h6 code{padding:0 .2em;font-size:inherit}.wmde-markdown ul.no-list,.wmde-markdown ol.no-list{padding:0;list-style-type:none}.wmde-markdown ol[type="1"]{list-style-type:decimal}.wmde-markdown ol[type=a]{list-style-type:lower-alpha}.wmde-markdown ol[type=i]{list-style-type:lower-roman}.wmde-markdown div>ol:not([type]){list-style-type:decimal}.wmde-markdown ul ul,.wmde-markdown ul ol,.wmde-markdown ol ol,.wmde-markdown ol ul{margin-top:0;margin-bottom:0}.wmde-markdown li>p{margin-top:16px}.wmde-markdown li+li{margin-top:.25em}.wmde-markdown dl{padding:0}.wmde-markdown dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:600}.wmde-markdown dl dd{padding:0 16px;margin-bottom:16px}.wmde-markdown table th{font-weight:600}.wmde-markdown table th,.wmde-markdown table td{padding:6px 13px;border:1px solid var(--color-border-default)}.wmde-markdown table tr{background-color:var(--color-canvas-default);border-top:1px solid var(--color-border-muted)}.wmde-markdown table tr:nth-child(2n){background-color:var(--color-canvas-subtle)}.wmde-markdown table img{background-color:transparent}.wmde-markdown img[align=right]{padding-left:20px}.wmde-markdown img[align=left]{padding-right:20px}.wmde-markdown .emoji{max-width:none;vertical-align:text-top;background-color:transparent}.wmde-markdown span.frame{display:block;overflow:hidden}.wmde-markdown span.frame>span{display:block;float:left;width:auto;padding:7px;margin:13px 0 0;overflow:hidden;border:1px solid var(--color-border-default)}.wmde-markdown span.frame span img{display:block;float:left}.wmde-markdown span.frame span span{display:block;padding:5px 0 0;clear:both;color:var(--color-fg-default)}.wmde-markdown span.align-center{display:block;overflow:hidden;clear:both}.wmde-markdown span.align-center>span{display:block;margin:13px auto 0;overflow:hidden;text-align:center}.wmde-markdown span.align-center span img{margin:0 auto;text-align:center}.wmde-markdown span.align-right{display:block;overflow:hidden;clear:both}.wmde-markdown span.align-right>span{display:block;margin:13px 0 0;overflow:hidden;text-align:right}.wmde-markdown span.align-right span img{margin:0;text-align:right}.wmde-markdown span.float-left{display:block;float:left;margin-right:13px;overflow:hidden}.wmde-markdown span.float-left span{margin:13px 0 0}.wmde-markdown span.float-right{display:block;float:right;margin-left:13px;overflow:hidden}.wmde-markdown span.float-right>span{display:block;margin:13px auto 0;overflow:hidden;text-align:right}.wmde-markdown code,.wmde-markdown tt{padding:.2em .4em;margin:0;font-size:85%;background-color:var(--color-neutral-muted);border-radius:6px}.wmde-markdown code br,.wmde-markdown tt br{display:none}.wmde-markdown del code{text-decoration:inherit}.wmde-markdown pre code{font-size:100%}.wmde-markdown pre>code{padding:0;margin:0;word-break:normal;white-space:pre;background:transparent;border:0}.wmde-markdown pre{font-size:85%;line-height:1.45;background-color:var(--color-canvas-subtle);border-radius:6px}.wmde-markdown pre code,.wmde-markdown pre tt{display:inline;max-width:auto;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.wmde-markdown pre>code{padding:16px;overflow:auto;display:block}.wmde-markdown .csv-data td,.wmde-markdown .csv-data th{padding:5px;overflow:hidden;font-size:12px;line-height:1;text-align:left;white-space:nowrap}.wmde-markdown .csv-data .blob-num{padding:10px 8px 9px;text-align:right;background:var(--color-canvas-default);border:0}.wmde-markdown .csv-data tr{border-top:0}.wmde-markdown .csv-data th{font-weight:600;background:var(--color-canvas-subtle);border-top:0}.wmde-markdown .footnotes{font-size:12px;color:var(--color-fg-muted);border-top:1px solid var(--color-border-default)}.wmde-markdown .footnotes ol{padding-left:16px}.wmde-markdown .footnotes li{position:relative}.wmde-markdown .footnotes li:target:before{position:absolute;top:-8px;right:-8px;bottom:-8px;left:-24px;pointer-events:none;content:"";border:2px solid var(--color-accent-emphasis);border-radius:6px}.wmde-markdown .footnotes li:target{color:var(--color-fg-default)}.wmde-markdown .footnotes .data-footnote-backref g-emoji{font-family:monospace}.wmde-markdown .task-list-item{list-style-type:none}.wmde-markdown .task-list-item label{font-weight:400}.wmde-markdown .task-list-item.enabled label{cursor:pointer}.wmde-markdown .task-list-item+.wmde-markdown .task-list-item{margin-top:3px}.wmde-markdown .task-list-item .handle{display:none}.wmde-markdown .task-list-item-checkbox,.wmde-markdown .contains-task-list input[type=checkbox]{margin:0 .2em .25em -1.6em;vertical-align:middle}.wmde-markdown .contains-task-list:dir(rtl) .task-list-item-checkbox,.wmde-markdown .contains-task-list:dir(rtl) input[type=checkbox]{margin:0 -1.6em .25em .2em}.wmde-markdown ::-webkit-calendar-picker-indicator{-webkit-filter:invert(50%);filter:invert(50%)}.wmde-markdown pre{position:relative}.wmde-markdown pre .copied{visibility:hidden;display:flex;position:absolute;cursor:pointer;color:var(--color-fg-defaul);top:6px;right:6px;border-radius:5px;background:var(--color-border-default);padding:6px;font-size:12px;transition:all .3s}.wmde-markdown pre .copied .octicon-copy{display:block}.wmde-markdown pre .copied .octicon-check{display:none}.wmde-markdown pre:hover .copied{visibility:visible}.wmde-markdown pre:hover .copied:hover{background:var(--color-prettylights-syntax-entity-tag);color:var(--color-canvas-default)}.wmde-markdown pre:hover .copied:active,.wmde-markdown pre .copied.active{background:#2e9b33;color:var(--color-canvas-default)}.wmde-markdown pre .active .octicon-copy{display:none}.wmde-markdown pre .active .octicon-check{display:block}.highlight-line{background-color:var(--color-neutral-muted)}.code-line.line-number:before{display:inline-block;width:1rem;text-align:right;margin-right:16px;color:var(--color-fg-subtle);content:attr(line);white-space:nowrap}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:var(--color-prettylights-syntax-comment)}.token.namespace{opacity:.7}.token.property,.token.tag,.token.selector,.token.constant,.token.symbol,.token.deleted{color:var(--color-prettylights-syntax-entity-tag)}.token.maybe-class-name{color:var(--color-prettylights-syntax-variable)}.token.property-access,.token.operator,.token.boolean,.token.number,.token.selector .token.class,.token.attr-name,.token.string,.token.char,.token.builtin{color:var(--color-prettylights-syntax-constant)}.token.deleted{color:var(--color-prettylights-syntax-markup-deleted-text)}.code-line .token.deleted{background-color:var(--color-prettylights-syntax-markup-deleted-bg)}.token.inserted{color:var(--color-prettylights-syntax-markup-inserted-text)}.code-line .token.inserted{background-color:var(--color-prettylights-syntax-markup-inserted-bg)}.token.variable{color:var(--color-prettylights-syntax-constant)}.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.color,.token.atrule,.token.attr-value,.token.function,.token.class-name{color:var(--color-prettylights-syntax-string)}.token.rule,.token.regex,.token.important,.token.keyword{color:var(--color-prettylights-syntax-keyword)}.token.coord{color:var(--color-prettylights-syntax-meta-diff-range)}.token.important,.token.bold{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.w-md-editor-area{overflow:auto;border-radius:5px}.w-md-editor-text{min-height:100%;position:relative;text-align:left;white-space:pre-wrap;word-break:keep-all;overflow-wrap:break-word;box-sizing:border-box;padding:10px;margin:0;font-size:14px!important;line-height:18px!important;font-variant-ligatures:common-ligatures}.w-md-editor-text-pre,.w-md-editor-text-input,.w-md-editor-text>.w-md-editor-text-pre{margin:0;border:0;background:none;box-sizing:inherit;display:inherit;font-family:inherit;font-family:var(--md-editor-font-family)!important;font-size:inherit;font-style:inherit;font-variant-ligatures:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;-moz-tab-size:inherit;tab-size:inherit;text-indent:inherit;text-rendering:inherit;text-transform:inherit;white-space:inherit;overflow-wrap:inherit;word-break:inherit;word-break:normal;padding:0}.w-md-editor-text-pre{position:relative;margin:0!important;pointer-events:none;background-color:transparent!important}.w-md-editor-text-pre>code{padding:0!important;font-family:var(--md-editor-font-family)!important;font-size:14px!important;line-height:18px!important}.w-md-editor-text-input{position:absolute;top:0;left:0;height:100%;width:100%;resize:none;color:inherit;overflow:hidden;outline:0;padding:inherit;-webkit-font-smoothing:antialiased;-webkit-text-fill-color:transparent}.w-md-editor-text-input:empty{-webkit-text-fill-color:inherit!important}.w-md-editor-text-pre,.w-md-editor-text-input{word-wrap:pre;word-break:break-word;white-space:pre-wrap}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.w-md-editor-text-input{color:transparent!important}.w-md-editor-text-input::selection{background-color:#accef7!important;color:transparent!important}}.w-md-editor-text-pre .punctuation{color:var(--color-prettylights-syntax-comment, #8b949e)!important}.w-md-editor-text-pre .token.url,.w-md-editor-text-pre .token.content{color:var(--color-prettylights-syntax-constant, #0550ae)!important}.w-md-editor-text-pre .token.title.important{color:var(--color-prettylights-syntax-markup-bold, #24292f)}.w-md-editor-text-pre .token.code-block .function{color:var(--color-prettylights-syntax-entity, #8250df)}.w-md-editor-text-pre .token.bold{font-weight:unset!important}.w-md-editor-text-pre .token.title{line-height:unset!important;font-size:unset!important;font-weight:unset!important}.w-md-editor-text-pre .token.code.keyword{color:var(--color-prettylights-syntax-constant, #0550ae)!important}.w-md-editor-text-pre .token.strike,.w-md-editor-text-pre .token.strike .content{color:var(--color-prettylights-syntax-markup-deleted-text, #82071e)!important}.w-md-editor-toolbar-child{position:absolute;border-radius:3px;box-shadow:0 0 0 1px var(--md-editor-box-shadow-color),0 0 0 var(--md-editor-box-shadow-color),0 1px 1px var(--md-editor-box-shadow-color);background-color:var(--md-editor-background-color);z-index:1;display:none}.w-md-editor-toolbar-child.active{display:block}.w-md-editor-toolbar-child .w-md-editor-toolbar{border-bottom:0;padding:3px;border-radius:3px}.w-md-editor-toolbar-child .w-md-editor-toolbar ul>li{display:block}.w-md-editor-toolbar-child .w-md-editor-toolbar ul>li button{width:-webkit-fill-available;height:initial;box-sizing:border-box;padding:3px 4px 2px;margin:0}.w-md-editor-toolbar{border-bottom:1px solid var(--md-editor-box-shadow-color);background-color:var(--md-editor-background-color);padding:5px;display:flex;justify-content:space-between;align-items:center;border-radius:3px 3px 0 0;-webkit-user-select:none;user-select:none;flex-wrap:wrap}.w-md-editor-toolbar.bottom{border-bottom:0px;border-top:1px solid var(--md-editor-box-shadow-color);border-radius:0 0 3px 3px}.w-md-editor-toolbar ul,.w-md-editor-toolbar li{margin:0;padding:0;list-style:none;line-height:initial}.w-md-editor-toolbar li{display:inline-block;font-size:14px}.w-md-editor-toolbar li+li{margin:0}.w-md-editor-toolbar li>button{border:none;height:20px;line-height:14px;background:none;padding:4px;margin:0 1px;border-radius:2px;text-transform:none;font-weight:400;overflow:visible;outline:none;cursor:pointer;transition:all .3s;white-space:nowrap;color:var(--color-fg-default)}.w-md-editor-toolbar li>button:hover,.w-md-editor-toolbar li>button:focus{background-color:var(--color-neutral-muted);color:var(--color-accent-fg)}.w-md-editor-toolbar li>button:active{background-color:var(--color-neutral-muted);color:var(--color-danger-fg)}.w-md-editor-toolbar li>button:disabled{color:var(--md-editor-box-shadow-color);cursor:not-allowed}.w-md-editor-toolbar li>button:disabled:hover{background-color:transparent;color:var(--md-editor-box-shadow-color)}.w-md-editor-toolbar li.active>button{color:var(--color-accent-fg);background-color:var(--color-neutral-muted)}.w-md-editor-toolbar-divider{height:14px;width:1px;margin:-3px 3px 0!important;vertical-align:middle;background-color:var(--md-editor-box-shadow-color)}.w-md-editor-bar{position:absolute;cursor:s-resize;right:0;bottom:0;margin-top:-11px;margin-right:0;width:14px;z-index:3;height:10px;border-radius:0 0 3px;-webkit-user-select:none;user-select:none}.w-md-editor-bar svg{display:block;margin:0 auto}.w-md-editor{text-align:left;border-radius:3px;padding-bottom:1px;position:relative;color:var(--color-fg-default);--md-editor-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;--md-editor-background-color: var(--color-canvas-default, #ffffff);--md-editor-box-shadow-color: var(--color-border-default, #d0d7de);box-shadow:0 0 0 1px var(--md-editor-box-shadow-color),0 0 0 var(--md-editor-box-shadow-color),0 1px 1px var(--md-editor-box-shadow-color);background-color:var(--md-editor-background-color);font-family:Helvetica Neue,Helvetica,Arial,sans-serif;display:flex;flex-direction:column}.w-md-editor.w-md-editor-rtl{direction:rtl!important;text-align:right!important}.w-md-editor.w-md-editor-rtl .w-md-editor-preview{right:unset!important;left:0;text-align:right!important;box-shadow:inset -1px 0 0 0 var(--md-editor-box-shadow-color)}.w-md-editor.w-md-editor-rtl .w-md-editor-text{text-align:right!important}.w-md-editor-toolbar{height:-webkit-fit-content;height:fit-content}.w-md-editor-content{height:100%;overflow:auto;position:relative;border-radius:0 0 3px}.w-md-editor .copied{display:none!important}.w-md-editor-input{width:50%;height:100%}.w-md-editor-text-pre>code{word-break:break-word!important;white-space:pre-wrap!important}.w-md-editor-preview{width:50%;box-sizing:border-box;box-shadow:inset 1px 0 0 0 var(--md-editor-box-shadow-color);position:absolute;padding:10px 20px;overflow:auto;top:0;right:0;bottom:0;border-radius:0 0 5px;display:flex;flex-direction:column}.w-md-editor-preview .anchor{display:none}.w-md-editor-preview .contains-task-list li.task-list-item{list-style:none}.w-md-editor-show-preview .w-md-editor-input{width:0%;overflow:hidden;background-color:var(--md-editor-background-color)}.w-md-editor-show-preview .w-md-editor-preview{width:100%;box-shadow:inset 0 0}.w-md-editor-show-edit .w-md-editor-input{width:100%}.w-md-editor-show-edit .w-md-editor-preview{width:0%;padding:0}.w-md-editor-fullscreen{overflow:hidden;position:fixed;z-index:99999;top:0;left:0;right:0;bottom:0;height:100%!important}.w-md-editor-fullscreen .w-md-editor-content{height:100%}._content_hkjyx_1{white-space:pre-line}@media screen and (max-width:447px){._content_hkjyx_1{width:calc(100vw - 112px);height:400px}}@media screen and (min-width:448px)and (max-width:895px){._content_hkjyx_1{width:calc(100vw - 192px);height:600px}}@media screen and (min-width:896px){._content_hkjyx_1{width:calc(80vw - 264px);height:800px}}.assetCard{background-color:#d3d3d3;padding:5px;margin:5px;border-style:solid;border-radius:5px;display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}.assetCard h3,.assetCard p{width:100%;margin:0}.archivedAssetCard{background-color:#fafad2;padding:5px;margin:5px;border-style:solid;border-radius:5px;display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}.archivedAssetCard h3,.archivedAssetCard p{width:100%;margin:0}.challengeCard{background-color:#90bed8;padding:5px;margin:5px;border-style:solid;border-radius:5px}.stateCard{background-color:#d3d3d3;padding:5px;margin:5px;border-style:solid;border-radius:5px}._container_4mx88_1{position:relative;display:flex;flex-flow:row nowrap;background-color:#f0f8ff;height:40px}._container_gmwfm_1{position:relative;display:flex;flex-flow:row nowrap;background-color:#f0f8ff;height:48px;padding:4px 8px;box-sizing:border-box;flex-shrink:0}._container_1wlrm_1{width:100%;height:100%;position:relative;display:flex;flex-flow:column nowrap;overflow:hidden;box-sizing:border-box}._container_1wlrm_1 *{box-sizing:border-box}._container_8h263_1{position:relative;display:flex;flex-flow:column nowrap;flex-grow:0;flex-shrink:1;flex-basis:200px;max-width:320px;min-width:160px;overflow-y:auto;padding-right:8px}._container_16qvk_1{position:relative;display:flex;flex-flow:column nowrap;flex-grow:0;flex-shrink:1;flex-basis:280px;max-width:360px;min-width:200px;overflow-y:auto;padding-right:8px}._container_13v4b_1{position:relative;display:flex;flex-flow:column nowrap;flex:1 1 auto;overflow:hidden}._container_9iwjy_1{position:relative;display:flex;flex-flow:row nowrap;flex-grow:1;min-height:10%;min-width:0}._slideContentContainer_55puj_1{position:relative;display:flex;flex-flow:column nowrap;flex:1 1 auto;overflow:auto;background-color:#d0d0d0}
2
2
  `;document.head.appendChild(s)}catch(e){console.error("sandbox css inject failed",e)}})();
3
- "use strict";var Z8=Object.defineProperty;var Q8=(e,t,n)=>t in e?Z8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hl=(e,t,n)=>Q8(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@vived/core"),C=require("react/jsx-runtime"),J8=require("react-dom/client"),K=require("react"),La=require("react-dom");function i4(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=i4(K),eI=i4(La);class pm extends k.AppObjectPM{static get(t){return t.getSingleton(pm.type)}}pm.type="ActiveAppPM";var Dn;(function(e){e.INIT="INIT",e.LOADING="LOADING",e.READY="READY",e.ERROR="ERROR"})(Dn||(Dn={}));class nr extends k.AppObjectEntity{static get(t){if(!t)throw new Error("AppObject cannot be null or undefined");return t.getComponent(nr.type)}static getById(t,n){if(!t)throw new Error("ID cannot be empty");if(!n)throw new Error("AppObjectRepo cannot be null or undefined");const r=n.get(t);if(!r){n.submitWarning("AppEntity.getById",`Unable to find app object by ID: ${t}`);return}return r.getComponent(nr.type)}static addIfMissing(t){if(!t)throw new Error("AppObject cannot be null or undefined");const n=t.getComponent(nr.type);return n||pu(t)}}nr.type="AppEntity";function pu(e){return new tI(e)}class tI extends nr{get id(){return this.appObject.id}get name(){return this.memoizedName.val}set name(t){this.memoizedName.val=t}get description(){return this.memoizedDescription.val}set description(t){this.memoizedDescription.val=t}get image_url(){return this.memoizedImageUrl.val}set image_url(t){this.memoizedImageUrl.val=t}get imageAssetId(){const t=this.memoizedImageAssetId.val;return t===""?void 0:t}set imageAssetId(t){this.memoizedImageAssetId.val=t??""}get latestVersion(){return k.Version.GetLatest(this.versions)}get mountedVersion(){return this._mountedVersion}set mountedVersion(t){this._mountedVersion!==t&&(this._mountedVersion=t,this.notifyOnChange())}get updateIsAvailable(){if(this._mountedVersion!==void 0&&this.latestVersion!==void 0)return!k.Version.AreEqual(this._mountedVersion,this.latestVersion)}get state(){return this._state}set state(t){this._state=t,this.notifyOnChange()}get assignedToOwner(){return this._assignedToOwner}set assignedToOwner(t){this._assignedToOwner=t,this.notifyOnChange()}get isMounted(){return this._mountedVersion!==void 0}get errorMessage(){return this._errorMsg}set errorMessage(t){this._errorMsg!==t&&(this._errorMsg=t,this.notifyOnChange())}get hasError(){return this._errorMsg!==void 0}constructor(t){super(t,nr.type),this.memoizedName=new k.MemoizedString("",this.notifyOnChange),this.memoizedDescription=new k.MemoizedString("",this.notifyOnChange),this.memoizedImageUrl=new k.MemoizedString("",this.notifyOnChange),this.memoizedImageAssetId=new k.MemoizedString("",this.notifyOnChange),this.versions=[],this._state=Dn.INIT,this._assignedToOwner=!1,this.styles=[]}}var Jf;(function(e){e.RELEASE="RELEASE",e.BETA="BETA",e.ALPHA="ALPHA"})(Jf||(Jf={}));class yi extends k.AppObjectEntityRepo{static get(t){return t.getSingleton(yi.type)}}yi.type="AppRepoEntity";function nI(e){return new rI(e)}class rI extends yi{constructor(t){super(t,yi.type),this.appReleaseStage=Jf.RELEASE,this.appFactory=n=>pu(this.appObjects.getOrCreate(n)),this.getOrCreate=n=>{const r=this.getForAppObject(n);if(r)return r;const i=this.appFactory(n);return this.add(i),i},this.getApp=n=>this.getForAppObject(n),this.getAllApps=()=>this.getAll(),this.deleteApp=n=>{this.removeForAppObject(n)},this.deleteAllApps=()=>{this.getAllApps().forEach(r=>{this.deleteApp(r.id)})},this.hasApp=n=>this.hasForAppObject(n),this.appObjects.registerSingleton(this)}}class $l extends k.AppObjectPM{static get(t){return t.getSingleton($l.type)}}$l.type="AppsListPM";function iI(e){return new sI(e)}class sI extends $l{get slideApps(){return this.getCachedSingleton(yi.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{const a=n[s];i!==a&&(r=!1)}),r}constructor(t){var n;super(t,$l.type),this.onEntityChange=()=>{if(!this.slideApps)return;const r=this.slideApps.getAllApps(),i=[];r.forEach(s=>{s.assignedToOwner&&i.push(s.id)}),this.doUpdateView(i)},(n=this.slideApps)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}class Sr extends k.AppObjectEntity{static get(t){const n=t.getComponent(Sr.type);return n||t.appObjectRepo.submitWarning("AssetEntity.get","Unable to find AssetEntity on app object "+t.id),n}}Sr.type="AssetEntity";function s4(e){return new aI(e)}class aI extends Sr{get id(){return this.appObject.id}get name(){return this._memoizedName.val}set name(t){this._memoizedName.val=t}get owner(){return this._memoizedOwner.val}set owner(t){this._memoizedOwner.val=t}get description(){return this._memoizedDescription.val}set description(t){this._memoizedDescription.val=t}get archived(){return this._memoizedArchived.val}set archived(t){this._memoizedArchived.val=t}get filename(){return this._memoizedFilename.val}set filename(t){this._memoizedFilename.val=t}get fileURL(){return this._memoizedFileURL.val}set fileURL(t){this._memoizedFileURL.val=t}get file(){return this._file}get blobURL(){return this._blobURL}get fileHasBeenFetched(){return this._file!==void 0}get linkedAssets(){return[...this._linkedAssets]}get isFetchingFile(){return this._memoizedIsFetchingFile.val}set isFetchingFile(t){this._memoizedIsFetchingFile.val=t}get fetchError(){return this._fetchError}set fetchError(t){t===void 0&&this.fetchError===void 0||t!==void 0&&this.fetchError!==void 0&&t.message===this.fetchError.message||(this._fetchError=t,this.notifyOnChange())}constructor(t){super(t,Sr.type),this._memoizedName=new k.MemoizedString("",this.notifyOnChange),this._memoizedOwner=new k.MemoizedString("",this.notifyOnChange),this._memoizedDescription=new k.MemoizedString("",this.notifyOnChange),this._memoizedArchived=new k.MemoizedBoolean(!1,this.notifyOnChange),this._memoizedFileURL=new k.MemoizedString("",this.notifyOnChange),this._memoizedFilename=new k.MemoizedString("",this.notifyOnChange),this._file=void 0,this._blobURL=void 0,this.setFile=n=>{this._file=n,this._blobURL=URL.createObjectURL(n),this.notifyOnChange()},this._linkedAssets=[],this.addLinkedAsset=(n,r)=>{this._linkedAssets.find(s=>s.id===r)===void 0&&(this._linkedAssets.push({id:r,type:n}),this.notifyOnChange())},this.removeLinkedAsset=(n,r)=>{let i=!1;this._linkedAssets.forEach(s=>{s.type===n&&s.id===r&&(i=!0)}),i&&(this._linkedAssets=this._linkedAssets.filter(s=>s.id!==r),this.notifyOnChange())},this.getLinkedAssetByType=n=>{const r=[];return this._linkedAssets.forEach(i=>{i.type===n&&r.push(i.id)}),r},this._memoizedIsFetchingFile=new k.MemoizedBoolean(!1,this.notifyOnChange),this._fetchError=void 0,this.dispose=()=>{this._blobURL!==void 0&&(URL.revokeObjectURL(this._blobURL),this._blobURL=void 0,this.notifyOnChange()),super.dispose()}}}class fm extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(r)return r.getComponent(fm.type)}}fm.type="AppPM";class Fc extends k.AppObjectUC{static get(t){const n=t.getComponent(Fc.type);return n||t.appObjectRepo.submitWarning("UpdateAppUC.get","Unable to find UpdateAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAppUC.getByID","Unable to find App Object by id "+t);return}return Fc.get(r)}}Fc.type="UpdateAppUC";class oI extends k.DomainFactory{constructor(t){super(t),this.factoryName="AppsFeatureFactory"}setupEntities(){nI(this.appObject)}setupUCs(){}setupPMs(){iI(this.appObject)}finalSetup(){}}function lI(e){const t=e.getOrCreate("Apps");return new oI(t)}class En extends k.AppObjectEntity{static get(t){const n=t.getComponent(En.type);return n||t.appObjectRepo.submitWarning("AssetEntity.get","Unable to find HostDispatchEntity on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetEntity.getByID","Unable to find app object "+t);return}return En.get(r)}}En.type="HostDispatchEntity";function a4(e){return new cI(e)}class cI extends En{get appHandlerVersion(){return this._appHandlerVersion}getAppHandlerVersion(){const t="GET_APP_HANDLER_VERSION",n={callback:this.setupVersion};try{this.formRequestAndDispatch(t,1,n)}catch{}}constructor(t){super(t,En.type),this._appHandlerVersion=0,this.appPayloadVersions=new Map,this.registerAppHandler=n=>{this.appHandler=n,this.getAppHandlerVersion()},this.clearAppHandler=()=>{this.appHandler=void 0},this.getRequestPayloadVersion=n=>this.appPayloadVersions.get(n),this.setupVersion=n=>{this._appHandlerVersion=n,this.getPayloadVersions()},this.getPayloadVersions=()=>{const n="GET_APP_PAYLOAD_VERSION",r={callback:this.setupPayloadVersions};this.formRequestAndDispatch(n,2,r)},this.setupPayloadVersions=n=>{this.appPayloadVersions=n},this.dispatch=n=>{if(!this.appHandler){this.error("No app handler has been registered");return}try{this.appHandler(n)}catch(r){this.warn(r.message)}},this.formRequestAndDispatch=(n,r,i)=>{if(!this.appHandler){this.error("No app handler has been registered");return}const s={type:n,version:r,payload:i};this.dispatch(s)}}}class Et extends k.AppObjectEntity{static get(t){return t.getComponent(Et.type)}}Et.type="HostHandlerEntity";function o4(e){return new uI(e)}class uI extends Et{constructor(t){super(t,Et.type),this.handlers=new Map,this.handler=n=>{const r=this.handlers.get(n.type);if(!r){this.warn(`Unsupported request type received: ${n.type}`);return}try{r.handleRequest(n.version,n.payload)}catch(i){this.warn(`${i}`)}},this.registerRequestHandler=n=>{this.handlers.has(n.requestType)&&this.warn(`More than one handler is being registered for ${n.requestType}. Previous handler is being overwritten`),this.handlers.set(n.requestType,n)}}}class Kt extends Error{constructor(t,n){const r=`Version ${n} of request type ${t} is not supported`;super(r)}}class dI extends Error{constructor(t){const n=`Action for request type ${t} is not implemented`;super(n)}}class rn extends Error{constructor(t,n,r){const i=`Unable to parse paylod for version ${n} of request type ${t}: ${r}`;super(i)}}var ps;(function(e){e.PRODUCTION="Production",e.STAGING="Staging",e.DEVELOPMENT="Development",e.LOCAL="LOCAL"})(ps||(ps={}));class bn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(bn.type,t)}get apiStage(){return this.memoizedApiState.val}set apiStage(t){this.memoizedApiState.val=t}get baseUrl(){return this.memoizedApiState.val===ps.PRODUCTION?"https://api.vivedlearning.com":this.memoizedApiState.val===ps.STAGING?"https://api-staging.vivedlearning.com":this.memoizedApiState.val===ps.DEVELOPMENT?"https://api-test.vivedlearning.com":"http://localhost:3001"}get userToken(){return this.memoizedUserToken.val}set userToken(t){this.memoizedUserToken.val=t}constructor(t){super(t,bn.type),this.productionURL="https://api.vivedlearning.com",this.stagingURL="https://api-staging.vivedlearning.com",this.developmentURL="https://api-test.vivedlearning.com",this.localURL="http://localhost:3001",this.memoizedApiState=new k.MemoizedString(ps.PRODUCTION,this.notifyOnChange),this.getEndpointURL=n=>new URL(n,this.baseUrl),this.memoizedUserToken=new k.MemoizedString("",this.notifyOnChange),this.appObjects.registerSingleton(this)}}bn.type="VivedAPIEntity";class Hn extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Hn.type,t)}}Hn.type="JsonRequestUC";class ar extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ar.type,t)}}ar.type="SignedAuthTokenUC";class za extends k.AppObjectUC{static get(t){return k.getSingletonComponent(za.type,t)}}za.type="GetAppFromAPIUC";function pI(e){return new fI(e)}class fI extends za{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,za.type),this.getApp=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!i||!s||!a?Promise.reject():new Promise((o,c)=>{i().then(u=>{const p=s.getEndpointURL(`apps/${n}/${r}`);p.searchParams.set("function_version","2");const h={method:"GET",headers:{Authorization:"Bearer "+u}};return a(p,h)}).then(u=>{const p=u.app,h={interfaceVersion:p.appInterfaceVersion,assetFolderURL:p.baseAssetsUrl,entrypoints:[...p.files]};o(h)}).catch(u=>{c(u)})})},this.appObjects.registerSingleton(this)}}function _p(e,t){const n=t.baseVersionString.split(".").join("_");return`${e.id}-${n}`}class Ar extends k.AppObjectUC{static get(t){return t.getComponent(Ar.type)}static getById(t,n){const r=n.get(t);return r==null?void 0:r.getComponent(Ar.type)}}Ar.type="MounterUC";function hI(e){return new mI(e)}class mI extends Ar{get getAppFromAPI(){return this.getCachedSingleton(za.type)}get app(){return this.getCachedLocalComponent(nr.type)}get hostHandler(){return this.getCachedLocalComponent(Et.type)}get hostDispatcher(){return this.getCachedLocalComponent(En.type)}getAppVersion(t,n){if(!this.app)return;let r=k.Version.GetLatestWithMajorMinor(this.app.versions,t,n);return r||(r=k.Version.GetLatestWithMajor(this.app.versions,t)),r||this.error(`Unable to find version ${t}.${n}.X for App ${this.app.name}`),r}mountLatestVersion(){if(!this.app)return this.error("Missing Components"),Promise.reject();const t=this.app.latestVersion;return t?this.mount(t.major,t.minor):(this.error("No Version"),Promise.reject())}parseEndpoints(t){const n=[],r=[];return t.forEach(i=>{i.includes(".js")?n.push(i):i.includes(".css")?r.push(i):this.warn("Unknown endpoint: "+i)}),{scripts:n,styles:r}}waitForAppIsReady(t,n){return t.id==="app4e48fbaa815a4857821bf7569b003751"&&n.major===1&&n.minor===0||t.id==="appe860b51f49414e20ae7995dff4d9b152"&&n.major===1&&n.minor<=2||t.id==="app41df8a36f628451d9f633f8a9bdf3edb"&&n.major===1&&n.minor<=1||t.id==="app448f8f293fbb493a9e233f113ce8b56a"||t.id==="APP_FOR_JEST_TEST"?(t.state=Dn.READY,Promise.resolve()):new Promise(r=>{const i=()=>{t.state===Dn.READY&&(t.removeChangeObserver(i),r())};t.addChangeObserver(i),i()})}constructor(t){super(t,Ar.type),this.scriptElements=[],this.unmount=()=>{if(!this.app||!this.app.mountedVersion)return;const n=_p(this.app,this.app.mountedVersion);window[n]=void 0,delete window[n],this.scriptElements.forEach(r=>{r.remove()}),this.scriptElements=[],this.app.styles=[],this.app.appAssetFolderURL=void 0,this.app.mountedVersion=void 0,this.app.state=Dn.INIT},this.mount=(n,r)=>{const i=this.getAppFromAPI;if(!i)return this.error("No Fetch App UC"),Promise.reject();const s=this.app;if(!s)return this.error("No App"),Promise.reject();const a=this.hostHandler;if(!a)return this.error("No Host Handler"),Promise.reject();const o=this.hostDispatcher;if(!o)return this.error("No Host Dispatcher"),Promise.reject();const c=this.getAppVersion(n,r);if(!c)return Promise.reject(new Error(`Unable to find version ${n}.${r}.X for App ${s.name}`));if(this.log(`Initializing App ${s.name} [${s.id}] version ${c.displayString}`),s.mountedVersion){if(k.Version.AreEqual(s.mountedVersion,c))return Promise.resolve();this.unmount()}return s.state=Dn.LOADING,new Promise((u,p)=>{i.getApp(this.appObject.id,c.baseVersionString).then(h=>{s.appAssetFolderURL=h.assetFolderURL;const{scripts:y,styles:l}=this.parseEndpoints(h.entrypoints);return s.styles=l,this.loadScripts(y,c)}).then(h=>{const y=h.mount(a.handler);return o.registerAppHandler(y),this.waitForAppIsReady(s,c)}).then(()=>{s.mountedVersion=c,u()}).catch(h=>{s.state=Dn.ERROR,p(h)})})},this.loadScripts=(n,r)=>{const i=this.app;if(!i)return this.error("No app entity"),Promise.reject();let s=this.getAppInterface(r);const a=_p(i,r);return s?Promise.resolve(s):new Promise((o,c)=>{const u=n.map(p=>this.loadScriptIntoDocument(p,a));Promise.all(u).then(()=>{s=this.getAppInterface(r),s?o(s):c("App is undefined for ID: "+i.id+". Make sure ID is correct in the 3 files in the app project.")}).catch(p=>{c(p)})})},this.loadScriptIntoDocument=(n,r)=>new Promise((i,s)=>{const a=document.createElement("script");a.onload=function(){i()},a.onerror=function(c){s(new Error("Failed to add script to document"))},a.type="text/javascript",a.src=n,a.className=r,this.scriptElements.push(a),document.head.appendChild(a)}),this.getAppInterface=n=>{if(!this.app)return;const r=_p(this.app,n);let i=window[r];return i||(i=window[this.app.id]),i}}}var Ht;(function(e){e.UNMOUNTED="UNMOUNTED",e.LOADING="LOADING",e.MOUNTED="MOUNTED",e.PLAYING="PLAYING",e.FATAL_ERROR="FATAL_ERROR",e.EDIT_ASSET="EDIT_ASSET",e.NEW_APP_ASSET="NEW_APP_ASSET"})(Ht||(Ht={}));class qe extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qe.type,t)}}qe.type="AppSandboxEntity";function gI(e){return new EI(e)}class EI extends qe{get appID(){return this.appObject.id}get startInZSpace(){return this.memoizedStartInZSpace.val}set startInZSpace(t){this.memoizedStartInZSpace.val=t}get appContainer(){return this._playerContainer}set appContainer(t){t!==this._playerContainer&&(this._playerContainer=t,this.notifyOnChange())}get showBabylonInspector(){return this.memoizedShowInspector.val}set showBabylonInspector(t){this.memoizedShowInspector.val=t}get babylonInspectorSupported(){return this.memoizedBabylonInspectorSupported.val}set babylonInspectorSupported(t){this.memoizedBabylonInspectorSupported.val=t}get enableDevFeatures(){return this.memoisedEnableDevFeatures.val}set enableDevFeatures(t){this.memoisedEnableDevFeatures.val=t}get isDevMode(){return this.memoizedIsDevMode.val}set isDevMode(t){this.memoizedIsDevMode.val=t}get state(){return this._state}set state(t){this._state!==t&&(this._state=t,this.notifyOnChange())}constructor(t){super(t,qe.type),this.mockActivityID="74ec8149-ced4-44b7-a4e4-5238593ab36f",this.channelID="abad8cd4-6379-4325-a7c0-3679c358ebe6",this.channelName="Development Channel",this.memoizedStartInZSpace=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedShowInspector=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedBabylonInspectorSupported=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoisedEnableDevFeatures=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoizedIsDevMode=new k.MemoizedBoolean(!0,this.notifyOnChange),this.devFeatures=[],this._state=Ht.UNMOUNTED,this.app=pu(t),this.appObjects.registerSingleton(this)}}function bI(e){return new TI(e)}class TI extends Ar{get appEntity(){return this.getCachedLocalComponent(nr.type)}get hostDispatcher(){return this.getCachedLocalComponent(En.type)}get hostHandler(){return this.getCachedLocalComponent(Et.type)}get sandbox(){return this.getCachedSingleton(qe.type)}getAppVersion(t,n){if(!this.appEntity)return;let r=k.Version.GetLatestWithMajorMinor(this.appEntity.versions,t,n);return r||(r=k.Version.GetLatestWithMajor(this.appEntity.versions,t)),r||this.error(`Unable to find version ${t}.${n}.X for App ${this.appEntity.name}`),r}loadScriptIntoDocument(t,n){return Promise.resolve()}getAppInterface(t){const n=t.baseVersionString.split(".").join("_"),r=`${this.appObject.id}-${n}`,i=window[r];if(!i){this.appObjects.submitFatal("LocalMounterUC","Unable to find App Interface");return}return i}constructor(t){super(t,Ar.type),this.mountLatestVersion=()=>{if(!this.appEntity)return this.error("Missing Components"),Promise.reject();const n=this.appEntity.latestVersion;return n?this.mount(n.major,n.minor):(this.error("No Version"),Promise.reject())},this.mount=(n,r)=>{if(!this.appEntity||!this.hostDispatcher||!this.hostHandler||!this.sandbox)return this.error("Missing Components"),Promise.reject();const i=this.getAppVersion(n,r);if(!i)return this.error("No Version"),Promise.reject();const s=this.getAppInterface(i);if(!s)return this.error("No App Interface"),Promise.reject();const a=s.mount(this.hostHandler.handler);this.hostDispatcher.registerAppHandler(a);const o=this.appEntity,c=this.sandbox;return new Promise(u=>{const p=()=>{o.state===Dn.READY&&(c.state=Ht.MOUNTED,o.removeChangeObserver(p),u())};o.addChangeObserver(p),p()})},this.unmount=()=>{if(!this.sandbox||!this.hostDispatcher){this.error("Missing Components");return}this.hostDispatcher.clearAppHandler(),this.sandbox.state=Ht.UNMOUNTED}}}class ms extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ENABLE_FEATURE"}static get(t){const n=t.getComponent(ms.type);return n||t.appObjectRepo.submitWarning("DispatchEnableFeatureUC.get","Unable to find DispatchEnableFeatureUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchEnableFeatureUC.getByID","Unable to find App Object by id "+t);return}return ms.get(r)}}ms.type="DispatchEnableFeatureUC";function yI(e){return new SI(e)}class SI extends ms{get dispatcher(){return this.getCachedLocalComponent(En.type)}doDispatch(t){if(!this.dispatcher)return;const n={featureFlag:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,ms.type),this.requestVersion=1,this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Xr extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_IS_AUTHORING"}static get(t){const n=t.getComponent(Xr.type);return n||t.appObjectRepo.submitWarning("DispatchIsAuthoringUC.get","Unable to find DispatchIsAuthoringUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchIsAuthoringUC.getByID","Unable to find App Object by id "+t);return}return Xr.get(r)}}Xr.type="DispatchIsAuthoringUC";function AI(e){return new CI(e)}class CI extends Xr{doDispatch(t){if(!this.dispatcher)return;const n={isAuthoring:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Xr.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Zr extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_APP_STATE"}static get(t){const n=t.getComponent(Zr.type);return n||t.appObjectRepo.submitWarning("DispatchSetStateUC.get","Unable to find DispatchSetStateUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchSetStateUC.getByID","Unable to find App Object by id "+t);return}return Zr.get(r)}}Zr.type="DispatchSetStateUC";function _I(e){return new II(e)}class II extends Zr{get dispatcher(){return this.getCachedLocalComponent(En.type)}doDispatch(t){if(!this.dispatcher)return;const{finalState:n,duration:r,hasNextSlide:i,hasPreviousSlide:s,hideNavigation:a}=t,o=this.dispatcher.getRequestPayloadVersion(this.requestType);if(!o||o<=2){this.dispatchV2(n,r);return}const c={finalState:n,duration:r,hasNextSlide:i,hasPreviousSlide:s,hideNavigation:a};this.dispatcher.formRequestAndDispatch(this.requestType,3,c)}dispatchV2(t,n){var s;const i={finalState:t?JSON.stringify(t):"",duration:n};(s=this.dispatcher)==null||s.formRequestAndDispatch(this.requestType,2,i)}constructor(t){super(t,Zr.type)}}class gs extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_APP"}static get(t){const n=t.getComponent(gs.type);return n||t.appObjectRepo.submitWarning("DispatchStartAppUC.get","Unable to find DispatchStartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartAppUC.getByID","Unable to find App Object by id "+t);return}return gs.get(r)}}gs.type="DispatchStartAppUC";function NI(e){return new RI(e)}class RI extends gs{doDispatch(t){if(!this.dispatcher)return;const n={container:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,gs.type),this.requestVersion=2,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}var uT;(function(e){e.primary="primary",e.onPrimary="onPrimary",e.primaryContainer="primaryContainer",e.onPrimaryContainer="onPrimaryContainer",e.primaryFixed="primaryFixed",e.onPrimaryFixed="onPrimaryFixed",e.primaryFixedDim="primaryFixedDim",e.onPrimaryFixedVariant="onPrimaryFixedVariant",e.secondary="secondary",e.onSecondary="onSecondary",e.secondaryContainer="secondaryContainer",e.onSecondaryContainer="onSecondaryContainer",e.secondaryFixed="secondaryFixed",e.onSecondaryFixed="onSecondaryFixed",e.secondaryFixedDim="secondaryFixedDim",e.onSecondaryFixedVariant="onSecondaryFixedVariant",e.tertiary="tertiary",e.onTertiary="onTertiary",e.tertiaryContainer="tertiaryContainer",e.onTertiaryContainer="onTertiaryContainer",e.tertiaryFixed="tertiaryFixed",e.onTertiaryFixed="onTertiaryFixed",e.tertiaryFixedDim="tertiaryFixedDim",e.onTertiaryFixedVariant="onTertiaryFixedVariant",e.error="error",e.onError="onError",e.errorContainer="errorContainer",e.onErrorContainer="onErrorContainer",e.outline="outline",e.background="background",e.onBackground="onBackground",e.surface="surface",e.onSurface="onSurface",e.surfaceVariant="surfaceVariant",e.onSurfaceVariant="onSurfaceVariant",e.inverseSurface="inverseSurface",e.inverseOnSurface="inverseOnSurface",e.inversePrimary="inversePrimary",e.shadow="shadow",e.surfaceTint="surfaceTint",e.outlineVariant="outlineVariant",e.scrim="scrim",e.surfaceContainerHighest="surfaceContainerHighest",e.surfaceContainerHigh="surfaceContainerHigh",e.surfaceContainer="surfaceContainer",e.surfaceContainerLow="surfaceContainerLow",e.surfaceContainerLowest="surfaceContainerLowest",e.surfaceBright="surfaceBright",e.surfaceDim="surfaceDim"})(uT||(uT={}));class Hi extends k.AppObjectEntity{}Hi.type="HostThemeEntity";Hi.get=e=>k.getSingletonComponent(Hi.type,e);function vI(e){return new xI(e)}class xI extends Hi{get activeScheme(){return this.schemeLookup.get(this.activeSchemeName)??OI}getHexForType(t){const n=this.schemeLookup.get(this.activeSchemeName);return n?n[t]:(this.error("No active scheme"),"#000000")}get activeSchemeName(){return this.memoizedActiveScheme.val}set activeSchemeName(t){if(!this.schemeLookup.has(t)){this.warn(`Unknown theme schema: ${t}. Ignoring.`);return}this.memoizedActiveScheme.val=t}constructor(t){super(t,Hi.type),this.schemeLookup=new Map,this.submitScheme=(n,r)=>{this.schemeLookup.has(n)&&this.warn("Duplicate scheme name submitted. Overwriting"),this.schemeLookup.set(n,r),this.activeSchemeName||(this.activeSchemeName=n)},this.memoizedActiveScheme=new k.MemoizedString("",this.notifyOnChange),this.getColorForType=n=>{const r=this.schemeLookup.get(this.activeSchemeName);if(!r)return this.error("No active scheme"),k.Color.RGB(0,0,0);const i=r[n];return k.Color.Hex(i)},this.appObjects.registerSingleton(this)}}const OI={primary:"#7BD0FF",onPrimary:"#003549",primaryContainer:"#004C69",onPrimaryContainer:"#C4E7FF",primaryFixed:"#C4E7FF",onPrimaryFixed:"#001E2C",primaryFixedDim:"#7BD0FF",onPrimaryFixedVariant:"#004C69",secondary:"#B5C9D7",onSecondary:"#20333E",secondaryContainer:"#374955",onSecondaryContainer:"#D1E5F4",secondaryFixed:"#D1E5F4",onSecondaryFixed:"#0A1E28",secondaryFixedDim:"#B5C9D7",onSecondaryFixedVariant:"#374955",tertiary:"#CAC1E9",onTertiary:"#322C4C",tertiaryContainer:"#484264",onTertiaryContainer:"#E6DEFF",tertiaryFixed:"#E6DEFF",onTertiaryFixed:"#1D1736",tertiaryFixedDim:"#CAC1E9",onTertiaryFixedVariant:"#484264",error:"#FFB4AB",onError:"#690005",errorContainer:"#93000A",onErrorContainer:"#FFDAD6",outline:"#8B9297",background:"#191C1E",onBackground:"#E1E2E5",surface:"#111416",onSurface:"#C5C6C9",surfaceVariant:"#41484D",onSurfaceVariant:"#C0C7CD",inverseSurface:"#E1E2E5",inverseOnSurface:"#191C1E",inversePrimary:"#00668A",shadow:"#000000",surfaceTint:"#7BD0FF",outlineVariant:"#41484D",scrim:"#000000",surfaceContainerHighest:"#333537",surfaceContainerHigh:"#282A2C",surfaceContainer:"#1D2022",surfaceContainerLow:"#191C1E",surfaceContainerLowest:"#0C0F10",surfaceBright:"#37393C",surfaceDim:"#111416"};class Gl extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Gl.type,t)}}Gl.type="ThemeColorsPM";function wI(e){return new DI(e)}class DI extends Gl{vmsAreEqual(t,n){return t.themeName===n.themeName}constructor(t){if(super(t,Gl.type),this.onThemeChange=()=>{this.themeColors&&this.doUpdateView({themeName:this.themeColors.activeSchemeName,scheme:this.themeColors.activeScheme})},this.appObjects.registerSingleton(this),this.themeColors=Hi.get(t.appObjectRepo),this.themeColors)this.themeColors.addChangeObserver(this.onThemeChange),this.onThemeChange();else{this.error("Unable to find HostThemeEntity");return}}}class Va extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Va.type,t)}}Va.type="SetThemeUC";function kI(e){return new LI(e)}class LI extends Va{get theme(){return this.getCachedSingleton(Hi.type)}setThemeByName(t){this.theme&&(this.theme.activeSchemeName=t)}tryDetectTheme(){if(!this.theme||!window.matchMedia)return;window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme.activeSchemeName=this.darkThemeName:this.theme.activeSchemeName=this.darkThemeName}constructor(t){super(t,Va.type),this.lightThemeName="light",this.darkThemeName="dark",this.appObjects.registerSingleton(this)}}function MI(e,t){const n=Va.get(e);n?n.setThemeByName(t):e.submitError("setThemeByName","Unable to find SetThemeUC")}const PI="#7BD0FF",FI="#003549",UI="#004C69",BI="#C4E7FF",HI="#C4E7FF",$I="#001E2C",GI="#7BD0FF",jI="#004C69",zI="#B5C9D7",VI="#20333E",WI="#374955",qI="#D1E5F4",KI="#D1E5F4",YI="#0A1E28",XI="#B5C9D7",ZI="#374955",QI="#CAC1E9",JI="#322C4C",eN="#484264",tN="#E6DEFF",nN="#E6DEFF",rN="#1D1736",iN="#CAC1E9",sN="#484264",aN="#FFB4AB",oN="#690005",lN="#93000A",cN="#FFDAD6",uN="#8B9297",dN="#191C1E",pN="#E1E2E5",fN="#111416",hN="#C5C6C9",mN="#41484D",gN="#C0C7CD",EN="#E1E2E5",bN="#191C1E",TN="#00668A",yN="#000000",SN="#7BD0FF",AN="#41484D",CN="#000000",_N="#333537",IN="#282A2C",NN="#1D2022",RN="#191C1E",vN="#0C0F10",xN="#37393C",ON="#111416",wN={primary:PI,onPrimary:FI,primaryContainer:UI,onPrimaryContainer:BI,primaryFixed:HI,onPrimaryFixed:$I,primaryFixedDim:GI,onPrimaryFixedVariant:jI,secondary:zI,onSecondary:VI,secondaryContainer:WI,onSecondaryContainer:qI,secondaryFixed:KI,onSecondaryFixed:YI,secondaryFixedDim:XI,onSecondaryFixedVariant:ZI,tertiary:QI,onTertiary:JI,tertiaryContainer:eN,onTertiaryContainer:tN,tertiaryFixed:nN,onTertiaryFixed:rN,tertiaryFixedDim:iN,onTertiaryFixedVariant:sN,error:aN,onError:oN,errorContainer:lN,onErrorContainer:cN,outline:uN,background:dN,onBackground:pN,surface:fN,onSurface:hN,surfaceVariant:mN,onSurfaceVariant:gN,inverseSurface:EN,inverseOnSurface:bN,inversePrimary:TN,shadow:yN,surfaceTint:SN,outlineVariant:AN,scrim:CN,surfaceContainerHighest:_N,surfaceContainerHigh:IN,surfaceContainer:NN,surfaceContainerLow:RN,surfaceContainerLowest:vN,surfaceBright:xN,surfaceDim:ON},DN="#00668A",kN="#FFFFFF",LN="#C4E7FF",MN="#001E2C",PN="#C4E7FF",FN="#001E2C",UN="#7BD0FF",BN="#004C69",HN="#4E616D",$N="#FFFFFF",GN="#D1E5F4",jN="#0A1E28",zN="#D1E5F4",VN="#0A1E28",WN="#B5C9D7",qN="#374955",KN="#605A7D",YN="#FFFFFF",XN="#E6DEFF",ZN="#1D1736",QN="#E6DEFF",JN="#1D1736",e6="#CAC1E9",t6="#484264",n6="#BA1A1A",r6="#FFFFFF",i6="#FFDAD6",s6="#410002",a6="#71787D",o6="#FBFCFF",l6="#191C1E",c6="#F8F9FC",u6="#191C1E",d6="#DCE3E9",p6="#41484D",f6="#2E3133",h6="#F0F1F3",m6="#7BD0FF",g6="#000000",E6="#00668A",b6="#C0C7CD",T6="#000000",y6="#E1E2E5",S6="#E7E8EA",A6="#EDEEF0",C6="#F3F3F6",_6="#FFFFFF",I6="#F8F9FC",N6="#D9DADC",R6={primary:DN,onPrimary:kN,primaryContainer:LN,onPrimaryContainer:MN,primaryFixed:PN,onPrimaryFixed:FN,primaryFixedDim:UN,onPrimaryFixedVariant:BN,secondary:HN,onSecondary:$N,secondaryContainer:GN,onSecondaryContainer:jN,secondaryFixed:zN,onSecondaryFixed:VN,secondaryFixedDim:WN,onSecondaryFixedVariant:qN,tertiary:KN,onTertiary:YN,tertiaryContainer:XN,onTertiaryContainer:ZN,tertiaryFixed:QN,onTertiaryFixed:JN,tertiaryFixedDim:e6,onTertiaryFixedVariant:t6,error:n6,onError:r6,errorContainer:i6,onErrorContainer:s6,outline:a6,background:o6,onBackground:l6,surface:c6,onSurface:u6,surfaceVariant:d6,onSurfaceVariant:p6,inverseSurface:f6,inverseOnSurface:h6,inversePrimary:m6,shadow:g6,surfaceTint:E6,outlineVariant:b6,scrim:T6,surfaceContainerHighest:y6,surfaceContainerHigh:S6,surfaceContainer:A6,surfaceContainerLow:C6,surfaceContainerLowest:_6,surfaceBright:I6,surfaceDim:N6};class v6 extends k.DomainFactory{constructor(t){super(t),this.factoryName="ThemeFactory",this.theme=null,this.setThemeUC=null}setupEntities(){this.theme=vI(this.appObject)}setupUCs(){this.setThemeUC=kI(this.appObject)}setupPMs(){wI(this.appObject)}finalSetup(){if(!this.theme||!this.setThemeUC)throw new Error("Theme or SetThemeUC not initialized");this.theme.submitScheme("light",R6),this.theme.submitScheme("dark",wN),this.setThemeUC.setThemeByName("light")}}function x6(e){const t=e.getOrCreate("Theme");return new v6(t)}class Es extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_THEME_COLORS"}static get(t){const n=t.getComponent(Es.type);return n||t.appObjectRepo.submitWarning("DispatchThemeUC.get","Unable to find DispatchThemeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchThemeUC.getByID","Unable to find App Object by id "+t);return}return Es.get(r)}}Es.type="DispatchThemeUC";function O6(e){return new w6(e)}class w6 extends Es{get theme(){return this.getCachedSingleton(Hi.type)}doDispatch(){if(!this.dispatcher||!this.theme)return;const n={colors:{...this.theme.activeScheme}};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Es.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}var In;(function(e){e.NONE="NONE",e.SCORE="SCORE",e.HIT="HIT",e.MULTIHIT="MULTIHIT",e.PROGRESS="PROGRESS",e.QUALITY="QUALITY"})(In||(In={}));var Uc;(function(e){e.INIT="INIT",e.LOADING="LOADING",e.READY="READY",e.ERROR="ERROR"})(Uc||(Uc={}));class Wa extends k.AppObjectEntity{static get(t,n){const r=n.get(t);return r==null?void 0:r.getComponent(Wa.type)}}Wa.type="HostStateEntity";function l4(e){return new D6(e)}class D6 extends Wa{get id(){return this.appObject.id}get name(){return this.memoizedName.val}set name(t){this.memoizedName.val=t}get stateData(){return this._data}setStateData(t,n){let r=!0;if(n){const i=JSON.stringify(this._data),s=JSON.stringify(t);i===s&&(r=!1)}this._data=t,r&&this.notifyOnChange()}get assets(){return[...this._assets]}set assets(t){if(t.length!==this._assets.length){this._assets=t,this.notifyOnChange();return}let n=!1;t.forEach((r,i)=>{this._assets[i]!==r&&(n=!0)}),n&&(this._assets=t,this.notifyOnChange())}get expectedResponse(){return this._expectedResponse}set expectedResponse(t){t!==this._expectedResponse&&(this._expectedResponse=t,this.notifyOnChange())}getDTO(){return{id:this.id,assets:[...this._assets],data:this._data,name:this.memoizedName.val,response:this._expectedResponse,appID:this.appID}}setDTO(t){if(t.id!==this.id){this.warn("DTO id does not match my ID. Skipping");return}this.setStateData(t.data,!0),this.assets=[...t.assets],this.memoizedName.val=t.name,this.memoisedAppID.val=t.appID,Object.values(In).includes(t.response)?this.expectedResponse=t.response:this.expectedResponse=void 0}get appID(){return this.memoisedAppID.val}set appID(t){this.memoisedAppID.val=t}get streamState(){return this.memoizedStreamState.val}set streamState(t){this.memoizedStreamState.val=t}constructor(t){super(t,Wa.type),this.memoizedName=new k.MemoizedString("",this.notifyOnChange),this._data={},this._assets=[],this.memoisedAppID=new k.MemoizedString("",this.notifyOnChange),this.memoizedStreamState=new k.MemoizedString(Uc.INIT,this.notifyOnChange)}}class bt extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(bt.type,t)}}bt.type="HostStateMachine";function k6(e){return new L6(e)}class L6 extends bt{get states(){return this._states.map(t=>t.id)}get stateCount(){return this._states.length}get activeState(){return this._activeState}get previousState(){if(!this._activeState)return;const t=this.getStateIndex(this._activeState);if(!(t===void 0||t===0))return this._states[t-1].id}get nextState(){if(!this._activeState)return;const t=this.getStateIndex(this._activeState);if(!(t===void 0||t>=this._states.length-1))return this._states[t+1].id}get isAuthoring(){return this.memoizedIsAuthoring.val}set isAuthoring(t){this.memoizedIsAuthoring.val=t}get lastEditingState(){return this._lastEditingState}set lastEditingState(t){if(this._lastEditingState===void 0&&t===void 0)return;const n=this.lastEditingState===void 0?"":JSON.stringify(this.lastEditingState),r=t===void 0?"":JSON.stringify(t);n!==r&&(this._lastEditingState=t,this.notifyOnChange())}get lastAssets(){return this._lastAssets}set lastAssets(t){this._lastAssets=t}findStateByID(t){for(const n of this._states)if(n.id===t)return n}constructor(t){super(t,bt.type),this._states=[],this.transitionDuration=1,this.memoizedIsAuthoring=new k.MemoizedBoolean(!1,this.notifyOnChange),this._lastAssets=[],this.hasState=n=>!!this.findStateByID(n),this.setActiveStateByID=n=>{const r=this.findStateByID(n);r&&r.id!==this._activeState&&(this._activeState=r.id,this.notifyOnChange())},this.setActiveStateByIndex=n=>{if(n<0||n>=this._states.length)return;const r=this._states[n];this.setActiveStateByID(r.id)},this.clearActiveState=()=>{this.activeState&&(this._activeState=void 0,this.notifyOnChange())},this.setStates=n=>{this._states=n,this.notifyOnChange()},this.stateFactory=n=>{const r=this.appObjects.getOrCreate(n);return l4(r)},this.createNewState=()=>{const n=this.stateFactory(k.generateUniqueID());return this._states.push(n),this.notifyOnChange(),n},this.getStateByID=n=>this.findStateByID(n),this.deleteState=n=>{const r=this.getStateIndex(n);if(r===void 0)return;const i=this.getStateByID(n);i==null||i.appObject.dispose(),this._states.splice(r,1),this.notifyOnChange()},this.deleteAllStates=()=>{this._states.length!==0&&(this._states.forEach(n=>{n.appObject.dispose()}),this._states=[],this.clearActiveState(),this.notifyOnChange())},this.getStateIndex=n=>{let r=-1;if(this._states.forEach((i,s)=>{i.id===n&&(r=s)}),r>=0)return r},this.setPreviousStateActive=()=>{this.previousState&&this.setActiveStateByID(this.previousState)},this.setNextStateActive=()=>{this.nextState&&this.setActiveStateByID(this.nextState)},this.setStateIndex=(n,r)=>{if(!this.getStateByID(n)||r<0||r>=this._states.length)return;const s=this.getStateIndex(n);if(s===void 0||s===r)return;const a=this._states.splice(s,1)[0];this._states.splice(r,0,a),n===this._activeState&&this.setActiveStateByID(n),this.notifyOnChange()},this.appObjects.registerSingleton(this)}}class Wn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Wn.type,t)}}Wn.type="HostEditingStateEntity";function M6(e){return new P6(e)}class P6 extends Wn{get editingState(){return this._editingState}get isEditing(){return this._editingState!==void 0}get isNewState(){return this._isNewState}get stateValidationMessage(){return this._stateValidationMessage}set stateValidationMessage(t){this._stateValidationMessage!==t&&(this._stateValidationMessage=t,this.notifyOnChange())}get hostStateMachine(){return this.getCachedSingleton(bt.type)}get somethingHasChanged(){return this.memoizedSomethingHasChanged.val}constructor(t){super(t,Wn.type),this._isNewState=!1,this.memoizedSomethingHasChanged=new k.MemoizedBoolean(!1,this.notifyOnChange),this.checkForChange=()=>{var s;if(!this._editingState)return!1;if(!this.originalStateData||this._editingState.name!==this.originalStateData.name||this._editingState.expectedResponse!==this.originalStateData.response||this._editingState.assets.length!==this.originalStateData.assets.length)return!0;let n=!1;if(this._editingState.assets.forEach((a,o)=>{this.originalStateData.assets[o]!==a&&(n=!0)}),n)return!0;const r=JSON.stringify(this._editingState.stateData),i=JSON.stringify(((s=this.originalStateData)==null?void 0:s.data)??"");return r!==i},this.onStateEntityChange=()=>{this.memoizedSomethingHasChanged.val=this.checkForChange()},this.startNewState=()=>{if(this.hostStateMachine)return this.originalStateData=void 0,this._isNewState=!0,this._editingState=this.hostStateMachine.createNewState(),this._editingState.addChangeObserver(this.onStateEntityChange),this.memoizedSomethingHasChanged.val=!0,this._editingState},this.startEditing=n=>{this._editingState=n,this.originalStateData=n.getDTO(),this._editingState.addChangeObserver(this.onStateEntityChange),this.notifyOnChange()},this.cancelEditState=()=>{var n;this._editingState&&(this.originalStateData?this._editingState.setDTO(this.originalStateData):(n=this.hostStateMachine)==null||n.deleteState(this._editingState.id),this.resetInternalState())},this.finishEditing=()=>{this.resetInternalState()},this.resetInternalState=()=>{this._editingState&&(this._isNewState=!1,this._editingState.removeChangeObserver(this.onStateEntityChange),this._stateValidationMessage=void 0,this._editingState=void 0,this.memoizedSomethingHasChanged.val=!1,this.notifyOnChange())},this.appObjects.registerSingleton(this)}}class Pi extends k.AppObjectUC{static get(t){const n=t.getComponent(Pi.type);return n||t.appObjectRepo.submitWarning("StartAppUC.get","Unable to find StartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("StartAppUC.getByID","Unable to find App Object by id "+t);return}return Pi.get(r)}static startByID(t,n,r){var i;(i=Pi.getByID(n,r))==null||i.start(t)}}Pi.type="StartAppUC";function F6(e){return new U6(e)}let U6=class extends Pi{get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}get dispatchStart(){return this.getCachedLocalComponent(gs.type)}get dispatchSetState(){return this.getCachedLocalComponent(Zr.type)}get dispatchSetIsAuthoring(){return this.getCachedLocalComponent(Xr.type)}get dispatchThemeColors(){return this.getCachedLocalComponent(Es.type)}get dispatchEnableFeature(){return this.getCachedLocalComponent(ms.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,Pi.type),this.start=n=>{var u,p,h,y;if(!this.stateMachine||!this.dispatchStart||!this.editStateEntity||!this.sandbox)return;this.dispatchStart.doDispatch(n);let r;this.stateMachine.activeState&&(r=(u=this.stateMachine.getStateByID(this.stateMachine.activeState))==null?void 0:u.stateData);const i=this.stateMachine.states.length<=1,s=this.stateMachine.nextState!==void 0,a=this.stateMachine.previousState!==void 0,o={finalState:r,hideNavigation:i,hasNextSlide:s,hasPreviousSlide:a};(p=this.dispatchSetState)==null||p.doDispatch(o);let c=this.editStateEntity.isEditing;this.stateMachine.activeState===void 0&&(c=!0),(h=this.dispatchSetIsAuthoring)==null||h.doDispatch(c),(y=this.dispatchThemeColors)==null||y.doDispatch(),this.sandbox.enableDevFeatures&&this.sandbox.devFeatures.forEach(l=>{var E;(E=this.dispatchEnableFeature)==null||E.doDispatch(l)})}}};class Si extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_APP"}static get(t){const n=t.getComponent(Si.type);return n||t.appObjectRepo.submitWarning("DispatchStopAppUC.get","Unable to find DispatchStopAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStopAppUC.getByID","Unable to find App Object by id "+t);return}return Si.get(r)}}Si.type="DispatchStopAppUC";function c4(e){return new B6(e)}class B6 extends Si{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Si.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Fi extends k.AppObjectUC{static get(t){const n=t.getComponent(Fi.type);return n||t.appObjectRepo.submitWarning("StopAppUC.get","Unable to find StartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("StopAppUC.getByID","Unable to find App Object by id "+t);return}return Fi.get(r)}static stopByID(t,n){var r;(r=Fi.getByID(t,n))==null||r.stop()}}Fi.type="StopAppUC";function H6(e){return new $6(e)}class $6 extends Fi{get dispatchStop(){return this.getCachedLocalComponent(Si.type)}stop(){var t;(t=this.dispatchStop)==null||t.doDispatch()}constructor(t){super(t,Fi.type)}}class jl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(jl.type,t)}}jl.type="BabylonInspectorSupportedPM";function G6(e){return new j6(e)}class j6 extends jl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,jl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.babylonInspectorSupported)},this.sandbox&&this.observeEntity(this.sandbox)}}class zl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(zl.type,t)}}zl.type="DevFeaturesEnabledPM";function z6(e){return new V6(e)}class V6 extends zl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,zl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.enableDevFeatures)},this.sandbox&&this.observeEntity(this.sandbox)}}class bs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(bs.type,t)}}bs.type="DevModePM";function W6(e){return new q6(e)}class q6 extends bs{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,bs.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.isDevMode)},this.sandbox&&this.observeEntity(this.sandbox)}}const K6={defaultVM:!0,subscribe:(e,t)=>{const n=bs.get(e);if(!n){e.submitError("devModeAdapter","Unable to find DevModePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=bs.get(e);if(!n){e.submitError("devModeAdapter","Unable to find DevModePM");return}n.removeView(t)}};class Ts extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Ts.type,t)}}Ts.type="SandboxStatePM";function Y6(e){return new X6(e)}class X6 extends Ts{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){var n;super(t,Ts.type),this.onEntityChange=()=>{this.sandbox&&this.doUpdateView(this.sandbox.state)},this.appObjects.registerSingleton(this),(n=this.sandbox)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange()}}const Z6={defaultVM:Ht.UNMOUNTED,subscribe:(e,t)=>{const n=Ts.get(e);if(!n){e.submitError("renderAppAdapter","Unable to find SandboxStatePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Ts.get(e);if(!n){e.submitError("renderAppAdapter","Unable to find SandboxStatePM");return}n.removeView(t)}};class Vl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Vl.type,t)}}Vl.type="ShowInspectorPM";function Q6(e){return new J6(e)}class J6 extends Vl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Vl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.showBabylonInspector)},this.sandbox&&this.observeEntity(this.sandbox)}}class ys extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(ys.type,t)}}ys.type="StartInZSpacePM";function eR(e){return new tR(e)}class tR extends ys{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,ys.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.startInZSpace)},this.sandbox&&this.observeEntity(this.sandbox)}}const u4={defaultVM:!1,subscribe:(e,t)=>{const n=ys.get(e);if(!n){e.submitError("startInZSpaceAdapter","Unable to find StartInZSpacePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ys.get(e);if(!n){e.submitError("startInZSpaceAdapter","Unable to find StartInZSpacePM");return}n.removeView(t)}};function d4(e){const t=qe.get(e);if(!t){e.submitWarning("mountSandboxApp","Could not find AppSandboxEntity");return}const n=Ar.getById(t.appID,e);if(!n){e.submitWarning("mountSandboxApp","Could not find MounterUC");return}n.mountLatestVersion()}class Ss extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="DISPOSE_APP"}static get(t){const n=t.getComponent(Ss.type);return n||t.appObjectRepo.submitWarning("DispatchAppDispatcherUC.get","Unable to find DispatchAppDispatcherUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchDisposeAppUC.getByID","Unable to find App Object by id "+t);return}return Ss.get(r)}}Ss.type="DispatchDisposeAppUC";function p4(e){return new nR(e)}class nR extends Ss{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Ss.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class As extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_DEV_MODE"}static get(t){const n=t.getComponent(As.type);return n||t.appObjectRepo.submitWarning("DispatchSetDevModeUC.get","Unable to find DispatchSetDevModeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchSetDevModeUC.getByID","Unable to find App Object by id "+t);return}return As.get(r)}}As.type="DispatchSetDevModeUC";function rR(e){return new iR(e)}class iR extends As{doDispatch(t){if(!this.dispatcher)return;const n={isDevMode:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,As.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Wl extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_BABYLON_INSPECTOR"}static get(t){const n=t.getComponent(Wl.type);return n||t.appObjectRepo.submitWarning("DispatchShowBabylonInspectorUC.get","Unable to find DispatchShowBabylonInspectorUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchShowBabylonInspectorUC.getByID","Unable to find App Object by id "+t);return}return Wl.get(r)}}Wl.type="DispatchShowBabylonInspectorUC";class Cs extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_SELECT_CHANNEL_MODEL"}static get(t){const n=t.getComponent(Cs.type);return n||t.appObjectRepo.submitWarning("DispatchStartBrowseChannelsUC.get","Unable to find DispatchStartBrowseChannelsUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartBrowseChannelsUC.getByID","Unable to find App Object by id "+t);return}return Cs.get(r)}}Cs.type="DispatchStartBrowseChannelsUC";function sR(e){return new aR(e)}class aR extends Cs{doDispatch(t){if(!this.dispatcher)return;const n={channelID:t.channelID,container:t.container,baseApiUrl:t.baseApiURL,callback:t.callback};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Cs.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class _s extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_ZSPACE"}static get(t){const n=t.getComponent(_s.type);return n||t.appObjectRepo.submitWarning("DispatchStartZSpaceUC.get","Unable to find DispatchStartZSpaceUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartZSpaceUC.getByID","Unable to find App Object by id "+t);return}return _s.get(r)}}_s.type="DispatchStartZSpaceUC";function oR(e){return new lR(e)}class lR extends _s{dispatchVersion2(t,n){if(!this.dispatcher)return;const r={device:"INSPIRE",session:t,emulate:n};this.dispatcher.formRequestAndDispatch(this.requestType,2,r)}dispatchDefault(t,n){if(!this.dispatcher)return;const r={session:t,emulate:n};this.dispatcher.formRequestAndDispatch(this.requestType,3,r)}constructor(t){super(t,_s.type),this.doDispatch=(n,r)=>{if(!this.dispatcher)return;const i=this.dispatcher.getRequestPayloadVersion(this.requestType);i===2?this.dispatchVersion2(n,r):i===3||i===void 0?this.dispatchDefault(n,r):(this.warn(`Unsupported version ${i} requested. Defaulting`),this.dispatchDefault(n,r))},this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Is extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_ZSPACE"}static get(t){const n=t.getComponent(Is.type);return n||t.appObjectRepo.submitWarning("DispatchStopZSpaceUC.get","Unable to find DispatchStopZSpaceUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStopZSpaceUC.getByID","Unable to find App Object by id "+t);return}return Is.get(r)}}Is.type="DispatchStopZSpaceUC";function cR(e){return new uR(e)}class uR extends Is{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Is.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}function dR(e){p4(e),yI(e),AI(e),rR(e),_I(e),NI(e),oR(e),c4(e),cR(e),O6(e)}class Ns extends k.AppObjectUC{static get(t){const n=t.getComponent(Ns.type);return n||t.appObjectRepo.submitWarning("SetDevModeUC.get","Unable to find SetDevModeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("SetDevModeUC.getByID","Unable to find App Object by id "+t);return}return Ns.get(r)}}Ns.type="SetDevModeUC";function pR(e){return new fR(e)}class fR extends Ns{get sandbox(){return this.getCachedSingleton(qe.type)}get dispatchSetDevMode(){return this.getCachedLocalComponent(As.type)}constructor(t){super(t,Ns.type),this.setDevMode=n=>{!this.sandbox||!this.dispatchSetDevMode||(this.sandbox.isDevMode=n,this.dispatchSetDevMode.doDispatch(n))}}}function hR(e,t){const n=qe.get(t);if(!n){t.submitWarning("setDevMode","Could not find AppSandboxEntity");return}const r=Ns.getByID(n.appID,t);if(!r){t.submitWarning("setDevMode","Could not find SetDevModeUC");return}r.setDevMode(e)}function Bc(e,t){const n=qe.get(t);n&&(n.state=e)}function mR(e,t){const n=qe.get(t);if(!n){t.submitWarning("startSandboxApp","Could not find AppSandboxEntity");return}Pi.startByID(e,n.appID,t)}function gR(e){const t=qe.get(e);if(!t){e.submitWarning("stopSandboxApp","Could not find AppSandboxEntity");return}Fi.stopByID(t.appID,e)}class qa extends k.AppObjectUC{static get(t){const n=t.getComponent(qa.type);return n||t.appObjectRepo.submitWarning("ShowBabylonInspectorUC.get","Unable to find ShowBabylonInspectorUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("ShowBabylonInspectorUC.getByID","Unable to find App Object by id "+t);return}return qa.get(r)}}qa.type="ShowBabylonInspectorUC";function ER(e){return new bR(e)}class bR extends qa{get sandbox(){return this.getCachedSingleton(qe.type)}get dispatchShowBabylon(){return this.getCachedLocalComponent(Wl.type)}constructor(t){super(t,qa.type),this.toggleShow=()=>{!this.sandbox||!this.dispatchShowBabylon||(this.sandbox.showBabylonInspector=!this.sandbox.showBabylonInspector,this.dispatchShowBabylon.doDispatch(this.sandbox.showBabylonInspector))},this.hide=()=>{!this.sandbox||!this.dispatchShowBabylon||(this.sandbox.showBabylonInspector=!1,this.dispatchShowBabylon.doDispatch(!1))}}}function TR(e){const t=qe.get(e);t&&(t.startInZSpace=!t.startInZSpace)}function yR(e){const t=qe.get(e);if(!t){e.submitWarning("unmountSandboxApp","Could not find AppSandboxEntity");return}const n=Ar.getById(t.appID,e);if(!n){e.submitWarning("unmountSandboxApp","Could not find MounterUC");return}n.unmount()}class Ai extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ai.type,t)}}Ai.type="AssetPluginEntity";function SR(e){return new AR(e)}class AR extends Ai{get version(){return this._version}set version(t){this._version=t,this._app.versions.push(t)}get app(){return this._app}get show(){return this.memoizedShowApp.val}set show(t){this.memoizedShowApp.val=t}constructor(t){super(t,Ai.type),this._version=new k.Version(0,0,0,k.VersionStage.RELEASED),this.memoizedShowApp=new k.MemoizedBoolean(!1,this.notifyOnChange),this.callback=(n,r)=>{this.warn("Callback has not been injected")},this._app=pu(this.appObject),this._app.addChangeObserver(this.notifyOnChange),this.appObjects.registerSingleton(this)}}let E1=class extends k.AppObjectEntity{};class or extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(or.type,t)}}or.type="DialogQueue";function CR(e){return new _R(e)}class _R extends or{get activeDialog(){return this.dialogQueue.length>0?this.dialogQueue[0]:null}constructor(t){super(t,or.type),this.dialogQueue=[],this.submitDialog=n=>{this.dialogQueue.push(n),this.activeDialog===n&&(n.isOpen=!0),n.addChangeObserver(this.notifyOnChange),this.notifyOnChange()},this.activeDialogHasClosed=()=>{const n=this.activeDialog;if(n!==null){n.removeChangeObserver(this.notifyOnChange),this.filterOutClosedDialogs(),this.dialogQueue.splice(0,1);const r=this.activeDialog;r!==null&&(r.isOpen=!0),this.notifyOnChange()}},this.filterOutClosedDialogs=()=>{const n=[];this.dialogQueue.forEach(r=>{r.hasBeenClosed?r.removeChangeObserver(this.notifyOnChange):n.push(r)}),this.dialogQueue=n},this.appObjects.registerSingleton(this)}}const IR="ALERT";class Rs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("AlertDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Rs.type);if(!i){n.submitWarning("AlertDialogEntity.get","App Object does not have AlertDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,Rs.type),this.dialogType=IR,this.preventOutsideDismiss=!1,this.hasBeenClosed=!1,this.close=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postClose&&this.postClose()},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.buttonLabel=t.buttonLabel,this.message=t.message,this.title=t.title,this.postClose=t.onClose,t.preventOutsideDismiss!==void 0&&(this.preventOutsideDismiss=t.preventOutsideDismiss)}}Rs.type="AlertDialogEntity";const NR="CONFIRM";class vs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ConfirmDialogEntity.get","Unable to find app object");return}const i=r.getComponent(vs.type);if(!i){n.submitWarning("ConfirmDialogEntity.get","App Object does not have ConfirmDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,vs.type),this.dialogType=NR,this.preventOutsideDismiss=!0,this.hasBeenClosed=!1,this.cancel=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postCancel&&this.postCancel()},this.confirm=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postConfirm&&this.postConfirm()},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.confirmButtonLabel=t.confirmButtonLabel,this.cancelButtonLabel=t.cancelButtonLabel,this.message=t.message,this.title=t.title,this.postCancel=t.onCancel,this.postConfirm=t.onConfirm}}vs.type="ConfirmDialogEntity";const RR="MARKDOWN_EDITOR";class xs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("MarkDownEditorDialogEntity.get","Unable to find app object");return}const i=r.getComponent(xs.type);if(!i){n.submitWarning("MarkDownEditorDialogEntity.get","App Object does not have DialogAlertEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,xs.type),this.dialogType=RR,this.preventOutsideDismiss=!0,this.hasBeenClosed=!1,this.cancel=()=>{this.hasBeenClosed=!0,this.isOpen=!1},this.confirm=r=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postConfirm(r)},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.initialText=t.initialText,this.postConfirm=t.onConfirm}}xs.type="MarkDownEditorDialogEntity";const vR="SELECT_CHANNEL_MODEL";class Ka extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SelectModelDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Ka.type);if(!i){n.submitWarning("SelectModelDialogEntity.get","App Object does not have SelectModelDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}get container(){return this._container}set container(t){this._container=t,this.notifyOnChange()}get isReady(){return this.memoizedIsReady.val}set isReady(t){this.memoizedIsReady.val=t}constructor(t){super(t,Ka.type),this.dialogType=vR,this.hasBeenClosed=!1,this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.preventOutsideDismiss=!0,this.memoizedIsReady=new k.MemoizedBoolean(!1,this.notifyOnChange)}}Ka.type="SelectModelDialogEntity";const xR="SPINNER";class Os extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SpinnerDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Os.type);if(!i){n.submitWarning("SpinnerDialogEntity.get","App Object does not have SpinnerDialogEntity");return}return i}get message(){return this.memoizedMessage.val}set message(t){this.memoizedMessage.val=t}set isOpen(t){t&&this.createdAt===void 0&&(this.createdAt=Date.now()),this._isOpen.val=t}get isOpen(){return this._isOpen.val}constructor(t,n){super(n,Os.type),this.dialogType=xR,this.mininumuLifespan=2e3,this.preventOutsideDismiss=!0,this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.hasBeenClosed=!1,this.close=()=>{if(this.hasBeenClosed=!0,this.createdAt===void 0){this.isOpen=!1;return}const r=Date.now()-this.createdAt,i=this.mininumuLifespan-r;i<=0?this.isOpen=!1:setTimeout(()=>{this.isOpen=!1},i)},this.memoizedMessage=new k.MemoizedString(t.message,this.notifyOnChange),this.title=t.title}}Os.type="SpinnerDialogEntity";class eh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="CLOSE_PLUGIN",this.payloadVersion=1}}eh.type="CloseAssetSystemPluginUC";function OR(e){return new wR(e)}class wR extends eh{get dialogQueue(){return this.getCachedSingleton(or.type)}get assetSystemPlugin(){return this.getCachedLocalComponent(Ai.type)}constructor(t){super(t,eh.type),this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)},this.action=()=>{if(!this.assetSystemPlugin||!this.dialogQueue)return;this.dialogQueue.activeDialogHasClosed();const r=Ss.get(this.appObject);if(!r){this.error("Cannot find DispatchDisposeAppUC");return}const i=Si.get(this.appObject);if(!i){this.error("Cannot find DispatchDisposeAppUC");return}const s=Ar.get(this.appObject);if(!s){this.error("Cannot find MounterUC");return}i.doDispatch(),r.doDispatch(),s.unmount(),this.assetSystemPlugin.show=!1};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class qn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qn.type,t)}}qn.type="AppAssetsEntity";function DR(e){return new kR(e)}class kR extends qn{get editingAsset(){return this._editingAsset}set editingAsset(t){var n;(t==null?void 0:t.id)!==((n=this._editingAsset)==null?void 0:n.id)&&(this._editingAsset&&this._editingAsset.removeChangeObserver(this.notifyOnChange),this._editingAsset=t,this._editingAsset&&this._editingAsset.addChangeObserver(this.notifyOnChange),this.notifyOnChange())}has(t){return this.appAssets.includes(t)}remove(t){const n=this.appAssets.indexOf(t,0);n>-1&&(this.appAssets.splice(n,1),this.notifyOnChange())}get showArchived(){return this.memoizedShowArchived.val}set showArchived(t){this.memoizedShowArchived.val=t}constructor(t){super(t,qn.type),this.appAssets=[],this.getAll=()=>[...this.appAssets],this.add=n=>{this.appAssets.includes(n)||(this.appAssets.push(n),this.notifyOnChange())},this.memoizedShowArchived=new k.MemoizedBoolean(!1,this.notifyOnChange),this.appObjects.registerSingleton(this)}}class Kn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Kn.type,t)}}Kn.type="AssetRepository";function LR(e){return new MR(e)}class MR extends Kn{addFromDTO(t){const n=this.getOrCreate(t.id);this.setAssetFromDTO(t,n);const r=[];return this.addLinkedAssetDTOsRecursively(t.linkedAssets,r),r.forEach(i=>{const s=this.getOrCreate(i.id);this.setAssetFromDTO(i,s)}),n}addLinkedAssetDTOsRecursively(t,n){t.forEach(r=>{n.push(r.asset),this.addLinkedAssetDTOsRecursively(r.asset.linkedAssets,n)})}constructor(t){super(t,Kn.type),this.assetLookup=new Map,this.has=n=>this.assetLookup.has(n),this.assetFactory=n=>s4(this.appObjects.getOrCreate(n)),this.add=n=>{this.assetLookup.has(n.id)||(this.assetLookup.set(n.id,n),this.notifyOnChange())},this.get=n=>this.assetLookup.get(n),this.getOrCreate=n=>{const r=this.assetLookup.get(n);if(r)return r;const i=this.assetFactory(n);return this.add(i),i},this.getAll=()=>Array.from(this.assetLookup.values()),this.remove=n=>{this.assetLookup.has(n)&&(this.assetLookup.delete(n),this.notifyOnChange())},this.setAssetFromDTO=(n,r)=>(r.description=n.description,r.name=n.name,r.archived=n.archived,r.filename=n.filename,r.owner=n.ownerId,r.fileURL=n.fileURL,n.linkedAssets.forEach(i=>{r.addLinkedAsset(i.type,i.asset.id)}),r),this.appObjects.registerSingleton(this)}}class ws extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ws.type,t)}}ws.type="AppAssetListPM";function PR(e){return new FR(e)}class FR extends ws{get assetRepo(){return this.getCachedSingleton(Kn.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{n[s]!==i&&(r=!1)}),r}constructor(t){if(super(t,ws.type),this.onAppAssetsChange=()=>{if(!this.appAssets)return;const n=this.appAssets.getAll();if(this.appAssets.showArchived){this.doUpdateView(n);return}const r=[];n.forEach(i=>{var a;const s=(a=this.assetRepo)==null?void 0:a.get(i);s&&s.archived===!1&&r.push(i)}),this.doUpdateView(r)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("PM has been added to an app object without an AppAssetsEntity");return}this.appAssets.addChangeObserver(this.onAppAssetsChange),this.appObjects.registerSingleton(this),this.onAppAssetsChange()}}const f4={defaultVM:[],subscribe:(e,t)=>{const n=ws.get(e);if(!n){e.submitError("activeAppPMAdapter","Unable to find AppAssetListPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ws.get(e);if(!n){e.submitError("activeAppPMAdapter","Unable to find AppAssetListPM");return}n.removeView(t)}};class Ds extends k.AppObjectPM{static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetPM.getByID","Unable to find app object by ID "+t);return}const i=r.getComponent(Ds.type);if(!i){n.submitWarning("AssetPM.getByID","App Object does not have a AssetPM");return}return i}}Ds.type="AssetPM";function UR(e){return new BR(e)}class BR extends Ds{vmsAreEqual(t,n){return!(t.archived!==n.archived||t.description!==n.description||t.name!==n.name||t.id!==n.id)}constructor(t){if(super(t,Ds.type),this.onAssetChange=()=>{if(!this.asset)return;const n={archived:this.asset.archived,description:this.asset.description,id:this.asset.id,name:this.asset.name};this.doUpdateView(n)},this.asset=t.getComponent(Sr.type),!this.asset){this.warn("PM has been added to an App Object without an AssetEntity");return}this.asset.addChangeObserver(this.onAssetChange),this.onAssetChange()}}const HR={archived:!1,description:"",id:"",name:""},$R={defaultVM:HR,subscribe:(e,t,n)=>{const r=Ds.getByID(e,t);if(!r){t.submitError("assetAdapter","Unable to find AssetPM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ds.getByID(e,t);if(!r){t.submitError("assetAdapter","Unable to find AssetPM");return}r.removeView(n)}};class ql extends k.AppObjectPM{static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetFilePM.getByID","Unable to find app object by ID "+t);return}const i=r.getComponent(ql.type);if(!i){n.submitWarning("AssetFilePM.getByID","App Object does not have a AssetFilePM");return}return i}}ql.type="AssetFilePM";function GR(e){return new jR(e)}class jR extends ql{get asset(){return this.getCachedLocalComponent(Sr.type)}vmsAreEqual(t,n){return!(t.blobURL!==n.blobURL||t.isFetchingFile!==n.isFetchingFile||t.fileHasBeenFetched!==n.fileHasBeenFetched||t.fetchError!==n.fetchError&&(t.fetchError===void 0&&n.fetchError!==void 0||t.fetchError!==void 0&&n.fetchError===void 0||t.fetchError!==void 0&&n.fetchError!==void 0&&t.fetchError.message!==n.fetchError.message))}constructor(t){super(t,ql.type),this.formVM=()=>{if(!this.asset)return;const n={blobURL:this.asset.blobURL,isFetchingFile:this.asset.isFetchingFile,fileHasBeenFetched:this.asset.fileHasBeenFetched,fetchError:this.asset.fetchError};this.doUpdateView(n)},this.asset&&this.observeEntity(this.asset)}}class ks extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ks.type,t)}}ks.type="EditingAppAssetPM";function zR(e){return new VR(e)}class VR extends ks{vmsAreEqual(t,n){return t===void 0&&n===void 0?!0:!((t==null?void 0:t.archived)!==(n==null?void 0:n.archived)||(t==null?void 0:t.description)!==(n==null?void 0:n.description)||(t==null?void 0:t.filename)!==(n==null?void 0:n.filename)||(t==null?void 0:t.id)!==(n==null?void 0:n.id)||(t==null?void 0:t.name)!==(n==null?void 0:n.name))}constructor(t){if(super(t,ks.type),this.onAssetChange=()=>{if(this.appAssets)if(this.appAssets.editingAsset){const{id:n,name:r,description:i,archived:s,filename:a}=this.appAssets.editingAsset,o={id:n,name:r,description:i,archived:s,filename:a};this.doUpdateView(o)}else this.doUpdateView(void 0)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.warn("PM has been added to an App Object without an AppAssetsEntity");return}this.appObjects.registerSingleton(this),this.appAssets.addChangeObserver(this.onAssetChange),this.onAssetChange()}}const h4={defaultVM:void 0,subscribe:(e,t)=>{const n=ks.get(e);if(!n){e.submitError("editingAppAssetAdapter","Unable to find EditingAppAssetPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ks.get(e);if(!n){e.submitError("editingAppAssetAdapter","Unable to find EditingAppAssetPM");return}n.removeView(t)}};class Ls extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Ls.type,t)}}Ls.type="ShowArchivedAppAssetPM";function WR(e){return new qR(e)}class qR extends Ls{vmsAreEqual(t,n){return t===n}constructor(t){if(super(t,Ls.type),this.defaultVM=!1,this.formVM=()=>{if(!this.appAssets)return;const n=this.appAssets.showArchived;this.doUpdateView(n)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.warn("PM has been added to an App Object without an AppAssetsEntity");return}this.observeEntity(this.appAssets)}}const KR={defaultVM:!1,subscribe:(e,t)=>{const n=Ls.get(e);if(!n){e.submitError("showArchivedAppAssetAdapter","Unable to find ShowArchivedAppAssetPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Ls.get(e);if(!n){e.submitError("showArchivedAppAssetAdapter","Unable to find ShowArchivedAppAssetPM");return}n.removeView(t)}},YR={message:"",buttonLabel:"",close:()=>{},title:""};class Ms extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("AlertDialogPM.get","Unable to find app object");return}const i=r.getComponent(Ms.type);if(!i){n.submitWarning("AlertDialogPM.get","App Object does not have AlertDialogPM");return}return i}}Ms.type="AlertDialogPM";function XR(e){return new ZR(e)}class ZR extends Ms{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title||t.buttonLabel!==n.buttonLabel)}constructor(t){if(super(t,Ms.type),this.onAlertChange=()=>{this.alert&&this.doUpdateView({buttonLabel:this.alert.buttonLabel,close:this.alert.close,message:this.alert.message,title:this.alert.title})},this.alert=t.getComponent(Rs.type),!this.alert){this.error("PM added to an app object that does not have a DialogAlertEntity");return}this.alert.addChangeObserver(this.onAlertChange),this.onAlertChange()}}class Ps extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ConfirmDialogPM.get","Unable to find app object");return}const i=r.getComponent(Ps.type);if(!i){n.submitWarning("ConfirmDialogPM.get","App Object does not have ConfirmDialogPM");return}return i}}Ps.type="ConfirmDialogPM";function QR(e){return new JR(e)}class JR extends Ps{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title||t.cancelButtonLabel!==n.cancelButtonLabel||t.confirmButtonLabel!==n.confirmButtonLabel)}constructor(t){if(super(t,Ps.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({confirmButtonLabel:this.dialog.confirmButtonLabel,cancelButtonLabel:this.dialog.cancelButtonLabel,cancel:this.dialog.cancel,message:this.dialog.message,title:this.dialog.title,confirm:this.dialog.confirm})},this.dialog=t.getComponent(vs.type),!this.dialog){this.error("PM added to an app object that does not have a DialogConfirmEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const e3={message:"Generic confirm message",title:"Confirm",cancel:()=>{console.warn("[ConfirmDialogVM.cancel] default VM")},cancelButtonLabel:"",confirm:()=>{console.warn("[ConfirmDialogVM.confirm] default VM")},confirmButtonLabel:""};class Fs extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Fs.type,t)}}Fs.type="DialogQueuePM";function t3(e){return new n3(e)}class n3 extends Fs{vmsAreEqual(t,n){return!(t.open!==n.open||t.id!==n.id||t.dialogType!==n.dialogType||t.preventOutsideDismiss!==n.preventOutsideDismiss)}constructor(t){if(super(t,Fs.type),this.onQueueChange=()=>{if(!this.queue)return;let n={open:!1};const r=this.queue.activeDialog;r&&(n={open:r.isOpen,dialogType:r.dialogType,preventOutsideDismiss:r.preventOutsideDismiss,id:r.appObject.id}),this.doUpdateView(n)},this.queue=t.getComponent(or.type),!this.queue){this.error("PM added to an app object that does not have a DialogQueue");return}this.queue.addChangeObserver(this.onQueueChange),this.onQueueChange(),this.appObjects.registerSingleton(this)}}const r3={open:!1};class Us extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("MarkDownEditorDialogPM.get","Unable to find app object");return}const i=r.getComponent(Us.type);if(!i){n.submitWarning("MarkDownEditorDialogPM.get","App Object does not have MarkDownEditorDialogPM");return}return i}}Us.type="MarkDownEditorDialogPM";function i3(e){return new s3(e)}class s3 extends Us{vmsAreEqual(t,n){return t.initialText===n.initialText}constructor(t){if(super(t,Us.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({initialText:this.dialog.initialText,confirm:this.dialog.confirm})},this.dialog=t.getComponent(xs.type),!this.dialog){this.error("PM added to an app object that does not have a DialogMarkDownEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const a3={initialText:"",confirm:e=>{console.warn("[MarkDownEditorDialogVM.confirm] default VM!")}};class Bs extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SpinnerDialogPM.get","Unable to find app object");return}const i=r.getComponent(Bs.type);if(!i){n.submitWarning("SpinnerDialogPM.get","App Object does not have SpinnerDialogPM");return}return i}}Bs.type="SpinnerDialogPM";function o3(e){return new l3(e)}class l3 extends Bs{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title)}constructor(t){if(super(t,Bs.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({message:this.dialog.message,title:this.dialog.title})},this.dialog=t.getComponent(Os.type),!this.dialog){this.error("PM added to an app object that does not have a DialogSpinnerEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const c3={message:"Default spinner message",title:"Spinner"},u3={defaultVM:YR,subscribe:(e,t,n)=>{const r=Ms.get(e,t);if(!r){t.submitError("alertDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ms.get(e,t);if(!r){t.submitError("alertDialogAdapter","Unable to find PM");return}r.removeView(n)}},d3={defaultVM:e3,subscribe:(e,t,n)=>{const r=Ps.get(e,t);if(!r){t.submitError("confirmDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ps.get(e,t);if(!r){t.submitError("confirmDialogAdapter","Unable to find PM");return}r.removeView(n)}},p3={defaultVM:r3,subscribe:(e,t)=>{const n=Fs.get(e);if(!n){e.submitError("dialogQueueAdapter","Unable to find DialogQueuePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Fs.get(e);if(!n){e.submitError("dialogQueueAdapter","Unable to find DialogQueuePM");return}n.removeView(t)}},f3={defaultVM:a3,subscribe:(e,t,n)=>{const r=Us.get(e,t);if(!r){t.submitError("markDownEditorDialogAdapters","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Us.get(e,t);if(!r){t.submitError("markDownEditorDialogAdapters","Unable to find PM");return}r.removeView(n)}},h3={defaultVM:c3,subscribe:(e,t,n)=>{const r=Bs.get(e,t);if(!r){t.submitError("spinnerDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Bs.get(e,t);if(!r){t.submitError("spinnerDialogAdapter","Unable to find PM");return}r.removeView(n)}};function m3(e){const t=or.get(e);t?t.activeDialogHasClosed():e.submitWarning("activeDialogHasClosed","Unable to find DialogQueue")}function g3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new Rs(n,r);return XR(r),i}}function E3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new vs(n,r);return QR(r),i}}function b3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new xs(n,r);return i3(r),i}}class lr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(lr.type,t)}static make(t,n){const r=lr.get(n);r==null||r.make(t)}}lr.type="MakeAlertDialogUC";function T3(e){return new y3(e)}class y3 extends lr{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new Rs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,lr.type),this.appObjects.registerSingleton(this)}}class $i extends k.AppObjectUC{static get(t){return k.getSingletonComponent($i.type,t)}static make(t,n){const r=$i.get(n);r==null||r.make(t)}}$i.type="MakeConfirmDialogUC";function S3(e){return new A3(e)}class A3 extends $i{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new vs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,$i.type),this.appObjects.registerSingleton(this)}}class Hs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Hs.type,t)}static make(t,n){const r=Hs.get(n);r==null||r.make(t)}}Hs.type="MakeMarkdownDialogUC";function C3(e){return new _3(e)}class _3 extends Hs{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new xs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,Hs.type),this.appObjects.registerSingleton(this)}}class $s extends k.AppObjectUC{static get(t){return k.getSingletonComponent($s.type,t)}static make(t){const n=$s.get(t);n==null||n.make()}}$s.type="MakeSelectModelDialogUC";function I3(e){return new N3(e)}class N3 extends $s{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(){const t=this.appObjects.getOrCreate(k.generateUniqueID());return new Ka(t)}make(){if(!this.dialogRepo)return;const t=this.factory();this.dialogRepo.submitDialog(t)}constructor(t){super(t,$s.type),this.appObjects.registerSingleton(this)}}class cr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(cr.type,t)}static make(t,n){const r=cr.get(n);return r==null?void 0:r.make(t)}}cr.type="MakeSpinnerDialogUC";function R3(e){return new v3(e)}class v3 extends cr{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new Os(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);return this.dialogRepo.submitDialog(n),n}constructor(t){super(t,cr.type),this.appObjects.registerSingleton(this)}}function x3(e){return function(){const n=e.getOrCreate(k.generateUniqueID());return new Ka(n)}}function O3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new Os(n,r);return o3(r),i}}class w3 extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxDialogFactory"}setupEntities(){CR(this.appObject)}setupUCs(){}setupPMs(){t3(this.appObject)}finalSetup(){T3(this.appObject).factory=g3(this.appObjects),S3(this.appObject).factory=E3(this.appObjects),C3(this.appObject).factory=b3(this.appObjects),R3(this.appObject).factory=O3(this.appObjects),I3(this.appObject).factory=x3(this.appObjects)}}function D3(e){const t=e.getOrCreate("Dialog");return new w3(t)}class hm extends k.AppObjectPM{static get(t){return k.getSingletonComponent(hm.type,t)}}hm.type="ApiStagePM";ps.PRODUCTION;class Gs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Gs.type,t)}}Gs.type="UserTokenPM";function k3(e){return new L3(e)}class L3 extends Gs{get sandbox(){return this.getCachedSingleton(bn.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Gs.type),this.defaultVM="",this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.userToken)},this.sandbox&&this.observeEntity(this.sandbox)}}const M3={defaultVM:"",subscribe:(e,t)=>{const n=Gs.get(e);if(!n){e.submitError("userTokenAdapter","Unable to find UserTokenPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Gs.get(e);if(!n){e.submitError("userTokenAdapter","Unable to find UserTokenPM");return}n.removeView(t)}};class Ya extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ya.type,t)}}Ya.type="BasicFetchUC";class Xa extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xa.type,t)}}Xa.type="BlobRequestUC";class Za extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Za.type,t)}}Za.type="DeleteAssetOnAPIUC";function P3(e){return new F3(e)}let F3=class extends Za{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Za.type),this.doDelete=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{r().then(c=>{const u=i.getEndpointURL(`assets/${n}`),p={method:"DELETE",headers:{Authorization:"Bearer "+c}};return s(u,p)}).then(c=>{a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}};class js extends k.AppObjectUC{static get(t){return k.getSingletonComponent(js.type,t)}}js.type="FetchAssetFileFromAPIUC";function U3(e){return new B3(e)}class B3 extends js{get requestBlob(){var t;return(t=this.getCachedSingleton(Xa.type))==null?void 0:t.doRequest}constructor(t){super(t,js.type),this.doFetch=n=>{const r=this.requestBlob;return r?n.fileURL?n.filename?new Promise((i,s)=>{const a=n.filename,o=new URL(n.fileURL);r(o).then(c=>{if(c&&a){const u=new File([c],a);i(u)}}).catch(c=>{this.warn(c.message),s(c)})}):Promise.reject(new Error(`${n.id} does not have a filename`)):Promise.reject(new Error(`${n.id} does not have a file URL`)):Promise.reject()},this.appObjects.registerSingleton(this)}}class Qa extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Qa.type,t)}}Qa.type="FetchAssetMetaFromAPIUC";function H3(e){return new $3(e)}class $3 extends Qa{get requestJSON(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Qa.type),this.doFetch=n=>{const r=this.vivedAPI,i=this.requestJSON;return!r||!i?Promise.reject():new Promise((s,a)=>{const o=r.getEndpointURL(`assets/${n}`);i(o,{method:"GET"}).then(u=>{const p=m4(u.asset);p.id=n,s(p)}).catch(u=>{this.warn(u.message),a(u)})})},this.appObjects.registerSingleton(this)}}function m4(e){const t=e.linkedAssets.map(r=>({type:r.type,asset:m4(r.asset)}));return{archived:e.archived,description:e.description,fileURL:e.fileURL,filename:e.filename,id:e.id,name:e.name,linkedAssets:t,ownerId:e.ownerId}}class Gi extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Gi.type,t)}}Gi.type="FileUploadUC";function G3(e){return new j3(e)}class j3 extends Gi{get vivedAPI(){return this.getCachedSingleton(bn.type)}get requestJSON(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get basicFetch(){var t;return(t=this.getCachedSingleton(Ya.type))==null?void 0:t.doRequest}constructor(t){super(t,Gi.type),this.doUpload=n=>{const r=this.vivedAPI,i=this.requestJSON,s=this.basicFetch;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{const c=r.getEndpointURL(`upload/large/DataVariants/${n.name}`);i(c).then(u=>{const p=new URL(u);return s(p,{method:"PUT",body:n})}).then(u=>{a()}).catch(u=>{this.warn(u.message),o(u)})})},this.appObjects.registerSingleton(this)}}class Ja extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ja.type,t)}}Ja.type="GetAssetsForOwnerFromAPIUC";function z3(e){return new V3(e)}class V3 extends Ja{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}responseToDTO(t){const n=t.linkedAssets.map(i=>({type:i.type,asset:this.responseToDTO(i.asset)}));return{archived:t.archived,description:t.description,fileURL:t.fileURL,filename:t.filename,id:t.id,name:t.name,linkedAssets:n,ownerId:t.ownerId}}constructor(t){super(t,Ja.type),this.getAssets=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{r().then(c=>{const u=i.getEndpointURL(`assets/group/${n}`),p=1,h=100;return u.searchParams.append("page",p.toString()),u.searchParams.append("itemsPerPage",h.toString()),s(u,{method:"GET"})}).then(c=>{const u=c.assets.map(p=>this.responseToDTO(p));a(u)}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}}class eo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(eo.type,t)}}eo.type="PatchAssetFileUC";function W3(e){return new q3(e)}class q3 extends eo{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUpload(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,eo.type),this.doPatch=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester,o=this.fileUpload;if(!i||!s||!a||!o)return Promise.reject();let c="";const u=r.name.split(".");c=u[u.length-1];const p=`${k.generateUniqueID()}.${c}`,h=new File([r],`${p}`,{lastModified:Date.now()});return new Promise((y,l)=>{o(h).then(E=>i()).then(E=>{const T=s.getEndpointURL(`assets/${n}`),A={method:"PATCH",body:JSON.stringify({filename:p}),headers:{Authorization:"Bearer "+E}};return a(T,A)}).then(E=>{y(p)}).catch(E=>{l(E)})})},this.appObjects.registerSingleton(this)}}class to extends k.AppObjectUC{static get(t){return k.getSingletonComponent(to.type,t)}}to.type="PatchAssetIsArchivedUC";function K3(e){return new Y3(e)}class Y3 extends to{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,to.type),this.doPatch=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!i||!s||!a?Promise.reject():new Promise((o,c)=>{i().then(u=>{const p=s.getEndpointURL(`assets/${n}`),y={method:"PATCH",body:JSON.stringify({archived:r}),headers:{Authorization:"Bearer "+u}};return a(p,y)}).then(u=>{o()}).catch(u=>{c(u)})})},this.appObjects.registerSingleton(this)}}class no extends k.AppObjectUC{static get(t){return k.getSingletonComponent(no.type,t)}}no.type="PatchAssetMetaUC";function X3(e){return new Z3(e)}class Z3 extends no{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,no.type),this.doPatch=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;if(!r||!i||!s)return Promise.reject();const{id:a,name:o,description:c,archived:u}=n;return new Promise((p,h)=>{r().then(y=>{const l=i.getEndpointURL(`assets/${a}`),T={method:"PATCH",body:JSON.stringify({name:o,description:c,archived:u}),headers:{Authorization:"Bearer "+y}};return s(l,T)}).then(y=>{p()}).catch(y=>{h(y)})})},this.appObjects.registerSingleton(this)}}class Kl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Kl.type,t)}}Kl.type="PatchAssetUC";function Q3(e){return new J3(e)}class J3 extends Kl{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUpload(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Kl.type),this.doPatch=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester,a=this.fileUpload;if(!r||!i||!s||!a)return Promise.reject();const{id:o,file:c,name:u,description:p,archived:h}=n;let y="";const l=c.name.split(".");y=l[l.length-1];const E=`${k.generateUniqueID()}.${y}`,T=new File([c],`${E}`,{lastModified:Date.now()});return new Promise((S,A)=>{a(T).then(R=>r()).then(R=>{const I=i.getEndpointURL(`assets/${o}`),N={method:"PATCH",body:JSON.stringify({archived:h,description:p,filename:E,name:u}),headers:{Authorization:"Bearer "+R}};return s(I,N)}).then(R=>{S()}).catch(R=>{A(R)})})},this.appObjects.registerSingleton(this)}}class zs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(zs.type,t)}}zs.type="PostNewAssetUC";function ev(e){return new tv(e)}class tv extends zs{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getPlayerAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUploader(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,zs.type),this.doPost=n=>{const r=this.fileUploader,i=this.getPlayerAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!r||!i||!s||!a?Promise.reject():new Promise((o,c)=>{const{description:u,file:p,name:h,ownerID:y}=n;let l;const E=p.name.split("."),T=E[E.length-1],S=`${k.generateUniqueID()}.${T}`,A=new File([p],S,{lastModified:Date.now()});r(A).then(R=>i()).then(R=>{const I=s.getEndpointURL("assets"),N={method:"POST",body:JSON.stringify({ownerId:y,name:h,description:u,filename:S}),headers:{Authorization:"Bearer "+R}};return a(I,N)}).then(R=>{l=R.assetId,o({id:l,filename:S})}).catch(R=>{c(R)})})},this.appObjects.registerSingleton(this)}}class Vs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Vs.type,t)}}Vs.type="UserAuthUC";function nv(e,t,n){const r=Vs.get(n);return r?r.login(e,t):(n.submitWarning("loginUser","Unable to find UserAuthUC"),Promise.reject(new Error("Unable to find UserAuthUC")))}function rv(e){const t=Vs.get(e);return t?t.refreshAuthenticatedUser():(e.submitError("refreshAuthenticatedUser","Unable to find UserAuthUC"),Promise.reject(new Error("Unable to find UserAuthUC")))}class iv extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxVivedAPIFactory"}setupEntities(){new bn(this.appObject)}setupUCs(){P3(this.appObject),U3(this.appObject),H3(this.appObject),G3(this.appObject),pI(this.appObject),z3(this.appObject),W3(this.appObject),K3(this.appObject),X3(this.appObject),Q3(this.appObject),ev(this.appObject)}setupPMs(){k3(this.appObject)}finalSetup(){}}function sv(e){const t=e.getOrCreate("VIVED API");return new iv(t)}class ro extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ArchiveAssetUC.get","Unable to find app object");return}const i=r.getComponent(ro.type);if(!i){n.submitWarning("ArchiveAssetUC.get","App Object does not have ArchiveAssetUC");return}return i}}ro.type="ArchiveAssetUC";function av(e){return new ov(e)}class ov extends ro{get patchAssetIsArchived(){var t;return(t=this.getCachedSingleton(to.type))==null?void 0:t.doPatch}get appAssets(){return this.getCachedSingleton(qn.type)}constructor(t){super(t,ro.type),this.setArchived=n=>{const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));if(r.archived===n)return Promise.resolve();const i=this.patchAssetIsArchived;if(!i)return Promise.reject();const s=n?"Archiving Asset":"Unarchive Asset",a=cr.make({title:s,message:"Updating asset's archived flag..."},this.appObjects);return new Promise((o,c)=>{i(r.id,n).then(()=>{r.archived=n,this.appAssets&&this.appAssets.has(r.id)&&this.appAssets.notifyOnChange(),a==null||a.close(),o()}).catch(u=>{this.error("Archive asset error: "+u.message),a==null||a.close();const p={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${u.message}`,title:"Archive Asset Error"};lr.make(p,this.appObjects),o()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function dT(e,t,n){const r=ro.get(e,n);return r?r.setArchived(t):(n.submitWarning("archiveAsset","Unable to find ArchiveAssetUC"),Promise.reject())}class io extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("DeleteAssetUC.get","Unable to find app object");return}const i=r.getComponent(io.type);if(!i){n.submitWarning("DeleteAssetUC.get","App Object does not have DeleteAssetUC");return}return i}}io.type="DeleteAssetUC";function lv(e){return new cv(e)}class cv extends io{get doDelete(){var t;return(t=this.getCachedSingleton(Za.type))==null?void 0:t.doDelete}get appAssets(){return this.getCachedSingleton(qn.type)}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){super(t,io.type),this.deleteWithConfirm=()=>{$i.make({cancelButtonLabel:"Cancel",confirmButtonLabel:"Delete Asset",message:"Are you sure you want to delete this asset. This cannot be undone and could affect users. Consider archiving it instead",title:"Delete Asset",onConfirm:this.delete},this.appObjects)},this.delete=()=>{const n=this.asset;if(!n)return Promise.reject(new Error("No Asset Entity"));const r=this.doDelete;if(!r)return Promise.reject();const s=cr.make({title:"Delete Asset",message:"Deleting asset..."},this.appObjects);return new Promise(a=>{r(n.id).then(()=>{this.appAssets&&this.appAssets.has(n.id)&&this.appAssets.remove(n.id),this.assetRepo&&this.assetRepo.has(n.id)&&this.assetRepo.remove(n.id),s==null||s.close(),a()}).catch(o=>{this.error("Archive asset error: "+o.message),s==null||s.close();const c={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${o.message}`,title:"Archive Asset Error"};lr.make(c,this.appObjects),a()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function uv(e,t){const n=io.get(e,t);if(!n){t.submitWarning("deleteAsset","Unable to find DeleteAssetUC");return}n.deleteWithConfirm()}class Ci extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ci.type,t)}}Ci.type="CacheEntity";function dv(e){return new pv(e)}class pv extends Ci{constructor(t){super(t,Ci.type),this.cache=new Map,this.appObjects.registerSingleton(this)}async get(t){if(!this.cache.has(t))throw new Error(`Cache key not found: ${t}`);return this.cache.get(t)}async store(t,n,r){this.cache.set(t,{value:n,metadata:r})}async has(t){return this.cache.has(t)}async invalidate(t){this.cache.delete(t)}async clear(){this.cache.clear()}async size(){return this.cache.size}}class Ws extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ws.type,t)}}Ws.type="ScriptCacheEntity";function fv(e){return new hv(e)}class hv extends Ws{get cacheEntity(){return this.getCachedSingleton(Ci.type)}constructor(t){super(t,Ws.type),this.appObjects.registerSingleton(this)}async getScript(t,n,r){const i=this.generateCacheKey(t,n,r),s=this.cacheEntity;if(!s){this.warn("CacheEntity not found");return}try{const{value:a}=await s.get(i);return a}catch{return}}async storeScript(t,n,r,i){const s=this.generateCacheKey(t,n,r),a=this.cacheEntity;if(!a){this.warn("CacheEntity not found");return}const o={appId:t,version:n,scriptPath:r,timestamp:Date.now()};await a.store(s,i,o)}async hasScript(t,n,r){const i=this.generateCacheKey(t,n,r),s=this.cacheEntity;return s?await s.has(i):(this.warn("CacheEntity not found"),!1)}async invalidateScript(t,n,r){const i=this.cacheEntity;if(!i){this.warn("CacheEntity not found");return}if(t&&n&&r){const s=this.generateCacheKey(t,n,r);await i.invalidate(s);return}if(!n&&!r){this.warn("Partial invalidation not fully implemented");return}}extractScriptInfo(t){try{const r=new URL(t).pathname.split("/"),i=r.findIndex(u=>u==="apps");if(i===-1||i+2>=r.length)throw new Error(`Invalid app URL format: ${t}`);const s=r[i+1],a=r[i+2],c=r.slice(i+3).join("/");return{appId:s,version:a,scriptPath:c}}catch{return this.error(`Failed to extract script info from URL: ${t}`),{appId:"unknown",version:"unknown",scriptPath:"unknown"}}}generateCacheKey(t,n,r){return`script:${t}:${n}:${r}`}}class qs extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qs.type,t)}}qs.type="AssetCacheEntity";function mv(e){return new gv(e)}class gv extends qs{get cacheEntity(){return this.getCachedSingleton(Ci.type)}constructor(t){super(t,qs.type),this.appObjects.registerSingleton(this)}async getAsset(t){const n=this.generateCacheKey(t),r=this.cacheEntity;if(!r){this.warn("CacheEntity not found");return}try{const{value:i,metadata:s}=await r.get(n);if(i instanceof Blob)return i;if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){const a=(s==null?void 0:s.contentType)||"application/octet-stream";return new Blob([i],{type:a})}this.warn("Cached asset is not a Blob or ArrayBuffer");return}catch{return}}async storeAsset(t,n,r){const i=this.generateCacheKey(t),s=this.cacheEntity;if(!s){this.warn("CacheEntity not found");return}const a={assetId:t,timestamp:Date.now(),contentType:r||n.type};await s.store(i,n,a)}async hasAsset(t){const n=this.generateCacheKey(t),r=this.cacheEntity;return r?await r.has(n):(this.warn("CacheEntity not found"),!1)}async invalidateAsset(t){const n=this.cacheEntity;if(!n){this.warn("CacheEntity not found");return}const r=this.generateCacheKey(t);await n.invalidate(r)}generateCacheKey(t){return`asset:${t}`}}class Ks extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ks.type,t)}}Ks.type="GetAssetFromCacheUC";function Ev(e){return new bv(e)}class bv extends Ks{get assetCacheEntity(){return this.getCachedSingleton(qs.type)}constructor(t){super(t,Ks.type),this.getAsset=async n=>{const r=this.assetCacheEntity;if(!r){this.warn("AssetCacheEntity not found");return}try{return await r.getAsset(n)}catch{this.warn(`Error retrieving asset from cache for ID: ${n}`);return}},this.appObjects.registerSingleton(this)}}class Yl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Yl.type,t)}}Yl.type="GetScriptFromCacheUC";function Tv(e){return new yv(e)}class yv extends Yl{get scriptCacheEntity(){return this.getCachedSingleton(Ws.type)}extractScriptInfo(t){const n=this.scriptCacheEntity;return n?n.extractScriptInfo(t):(this.warn("ScriptCacheEntity not found"),{appId:"unknown",version:"unknown",scriptPath:"unknown"})}constructor(t){super(t,Yl.type),this.getScript=async n=>{const r=this.scriptCacheEntity;if(!r){this.warn("ScriptCacheEntity not found");return}try{const{appId:i,version:s,scriptPath:a}=this.extractScriptInfo(n);return await r.getScript(i,s,a)}catch{this.warn(`Error retrieving script from cache for URL: ${n}`);return}},this.appObjects.registerSingleton(this)}}class Ys extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ys.type,t)}}Ys.type="StoreAssetInCacheUC";function Sv(e){return new Av(e)}class Av extends Ys{get assetCacheEntity(){return this.getCachedSingleton(qs.type)}constructor(t){super(t,Ys.type),this.storeAsset=async(n,r,i)=>{const s=this.assetCacheEntity;if(!s){this.warn("AssetCacheEntity not found");return}try{await s.storeAsset(n,r,i)}catch{this.warn(`Error storing asset in cache for ID: ${n}`)}},this.appObjects.registerSingleton(this)}}class Xl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xl.type,t)}}Xl.type="StoreScriptInCacheUC";function Cv(e){return new _v(e)}class _v extends Xl{get scriptCacheEntity(){return this.getCachedSingleton(Ws.type)}extractScriptInfo(t){const n=this.scriptCacheEntity;return n?n.extractScriptInfo(t):(this.warn("ScriptCacheEntity not found"),{appId:"unknown",version:"unknown",scriptPath:"unknown"})}constructor(t){super(t,Xl.type),this.storeScript=async(n,r)=>{const i=this.scriptCacheEntity;if(!i){this.warn("ScriptCacheEntity not found");return}try{const{appId:s,version:a,scriptPath:o}=this.extractScriptInfo(n);await i.storeScript(s,a,o,r)}catch{this.warn(`Error storing script in cache for URL: ${n}`)}},this.appObjects.registerSingleton(this)}}class Iv extends k.DomainFactory{constructor(t){super(t),this.factoryName="CacheFeatureFactory"}setupEntities(){fv(this.appObject),mv(this.appObject)}setupUCs(){Tv(this.appObject),Cv(this.appObject),Ev(this.appObject),Sv(this.appObject)}setupPMs(){}finalSetup(){}}function Nv(e){const t=e.getOrCreate("Cache");return new Iv(t)}class Qr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Qr.type,t)}}Qr.type="GetAssetUC";function Rv(e){return new vv(e)}let vv=class extends Qr{get fetchAssetMeta(){var t;return(t=this.getCachedSingleton(Qa.type))==null?void 0:t.doFetch}constructor(t){if(super(t,Qr.type),this.getAsset=n=>{const r=this.assetRepo,i=this.fetchAssetMeta;return!r||!i?Promise.reject():r.has(n)?Promise.resolve(r.get(n)):new Promise((s,a)=>{i(n).then(o=>{const c=r.addFromDTO(o);s(c)}).catch(o=>{this.warn(o.message),a(o)})})},this.appObjects.registerSingleton(this),this.assetRepo=t.getComponent(Kn.type),!this.assetRepo){this.error("UC added to an App Object that does not have AssetRepo");return}}};class Xs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xs.type,t)}}Xs.type="GetAssetFileUC";function xv(e){return new Ov(e)}class Ov extends Xs{get assetRepo(){return this.getCachedSingleton(Kn.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(js.type))==null?void 0:t.doFetch}get getAsset(){var t;return(t=this.getCachedSingleton(Qr.type))==null?void 0:t.getAsset}get getAssetFromCache(){var t;return(t=this.getCachedSingleton(Ks.type))==null?void 0:t.getAsset}get storeAssetInCache(){var t;return(t=this.getCachedSingleton(Ys.type))==null?void 0:t.storeAsset}async tryGetFromCacheOrFetch(t){const n=this.getAssetFromCache;if(!n)return this.fetchAssetDirectly(t);const r=await n(t);return r?this.createFileFromCachedBlob(t,r):this.fetchAssetDirectly(t)}async createFileFromCachedBlob(t,n){const r=this.getAsset;if(!r)throw new Error("Required dependencies not found");const i=await r(t),s=i.filename||"cached-asset",a=new File([n],s,{type:n.type});return i.setFile(a),i.isFetchingFile=!1,a}async fetchAssetDirectly(t){const n=this.getAsset,r=this.fetchAssetFile;if(!n||!r)throw new Error("Required dependencies not found");try{const i=await n(t);i.isFetchingFile=!0,i.fetchError=void 0;const s=await r(i);return i.setFile(s),i.isFetchingFile=!1,await this.tryCacheAssetFile(t,s),s}catch(i){throw await this.handleFetchError(t,i),i}}async handleFetchError(t,n){const r=this.getAsset;if(r)try{const i=await r(t);i.fetchError=n,i.isFetchingFile=!1}catch{}}async tryCacheAssetFile(t,n){const r=this.storeAssetInCache;if(r)try{await r(t,new Blob([n],{type:n.type}),n.type)}catch(i){this.warn(`Failed to cache asset: ${i.message}`)}}constructor(t){super(t,Xs.type),this.getAssetFile=async n=>{const r=this.assetRepo,i=this.getAsset,s=this.fetchAssetFile;if(!r||!i||!s)return Promise.reject(new Error("Missing required dependencies"));const a=r.get(n);if(a!=null&&a.file)return a.file;try{return await this.tryGetFromCacheOrFetch(n)}catch(o){return this.warn(`Cache error: ${o.message}`),this.fetchAssetDirectly(n)}},this.appObjects.registerSingleton(this)}}class so extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("DownloadAssetFileUC.get","Unable to find app object");return}const i=r.getComponent(so.type);if(!i){n.submitWarning("DownloadAssetFileUC.get","App Object does not have DownloadAssetFileUC");return}return i}}so.type="DownloadAssetFileUC";function wv(e){return new Dv(e)}class Dv extends so{get getAssetFile(){var t;return(t=this.getCachedSingleton(Xs.type))==null?void 0:t.getAssetFile}constructor(t){super(t,so.type),this.download=()=>{const n=this.asset;if(!n)return Promise.reject(new Error("No Asset Entity"));if(n.blobURL)return this.saveFileLocally(),Promise.resolve();const r=this.getAssetFile;if(!r)return Promise.reject();const s=cr.make({title:"Download Asset",message:"Downloading asset..."},this.appObjects);return new Promise(a=>{r(n.id).then(()=>{s==null||s.close(),this.saveFileLocally(),a()}).catch(o=>{this.error("Archive asset error: "+o.message),s==null||s.close();const c={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${o.message}`,title:"Archive Asset Error"};lr.make(c,this.appObjects),a()})})},this.saveFileLocally=()=>{if(!this.asset){this.error("No Asset");return}if(!this.asset.blobURL){this.error("No blob URL");return}const n=document.createElement("a");n.href=this.asset.blobURL,n.download=this.asset.filename,n.click()},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function kv(e,t){const n=so.get(e,t);if(!n){t.submitWarning("deleteAsset","Unable to find DownloadAssetFileUC");return}n.download()}class ao extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ao.type,t)}}ao.type="EditAppAssetUC";function Lv(e){return new Mv(e)}class Mv extends ao{get appAssets(){return this.getCachedSingleton(qn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){if(super(t,ao.type),this.editAsset=n=>{if(!this.assetRepo||!this.appAssets||!this.sandbox)return;const r=this.assetRepo.get(n);if(!r){this.warn("Unable to find asset by id: "+n);return}this.appAssets.editingAsset=r,this.sandbox.state=Ht.EDIT_ASSET},this.appObjects.registerSingleton(this),this.assetRepo=t.getComponent(Kn.type),!this.assetRepo){this.error("UC added to an App Object that does not have AssetRepo");return}}}function Pv(e,t){const n=ao.get(t);if(!n){t.submitWarning("editAppAsset","Unable to find EditAppAssetUC");return}n.editAsset(e)}class oo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(oo.type,t)}}oo.type="GetAppAssetsUC";function Fv(e){return new Uv(e)}class Uv extends oo{get getAssetsUC(){var t;return(t=this.getCachedSingleton(Ja.type))==null?void 0:t.getAssets}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){if(super(t,oo.type),this.getAppAssets=n=>{const r=this.appAssets,i=this.getAssetsUC,s=this.assetRepo;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{i(n).then(c=>{c.forEach(u=>{s.addFromDTO(u),r.add(u.id)}),a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this),this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("UC added to an App Object that does not have AppAssetsEntity");return}}}function Bv(e,t){const n=oo.get(t);if(!n){t.submitWarning("getAppAssets","Unable to find GetAppAssetsUC");return}n.getAppAssets(e)}class lo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(lo.type,t)}}lo.type="NewAppAssetUC";function Hv(e){return new $v(e)}class $v extends lo{get postNewAsset(){var t;return(t=this.getCachedSingleton(zs.type))==null?void 0:t.doPost}get assetRepo(){return this.getCachedSingleton(Kn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get spinnerFactory(){return this.getCachedSingleton(cr.type)}get alertFactory(){return this.getCachedSingleton(lr.type)}constructor(t){if(super(t,lo.type),this.create=n=>{const r=this.appAssets,i=this.postNewAsset,s=this.sandbox,a=this.assetRepo;return!r||!i||!s||!a?Promise.reject():new Promise(o=>{var l;const{description:c,file:u,name:p}=n,h={description:c,name:p,file:u,ownerID:s.appID},y=(l=this.spinnerFactory)==null?void 0:l.make({title:"New App Asset",message:"Posting new app asset..."});i(h).then(E=>{r.add(E.id);const T=a.assetFactory(E.id);T.setFile(u),T.description=c,T.name=p,T.filename=E.filename,a.add(T),this.sandbox.state=Ht.MOUNTED,y==null||y.close(),o()}).catch(E=>{var S;this.error("create new asset error: "+E.message),y==null||y.close();const T={buttonLabel:"OK",message:`Something went wrong when creating a new app asset. Check the console. ${E.message}`,title:"New App Asset Error"};(S=this.alertFactory)==null||S.make(T),o()})})},this.appObjects.registerSingleton(this),this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("UC added to an App Object that does not have AppAssetsEntity");return}}}function Gv(e,t){const n=lo.get(t);return n?n.create(e):(t.submitWarning("newAppAsset","Unable to find NewAppAssetUC"),Promise.reject())}function jv(e){const t=qn.get(e);t?t.showArchived=!t.showArchived:e.submitWarning("toggleShowArchivedAssets","Unable to find AppAssetsEntity")}class co extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAppAssetMetaUC.get","Unable to find app object");return}const i=r.getComponent(co.type);if(!i){n.submitWarning("UpdateAppAssetMetaUC.get","App Object does not have UpdateAssetMetaUC");return}return i}}co.type="UpdateAppAssetMetaUC";function zv(e){return new Vv(e)}class Vv extends co{get asset(){return this.getCachedLocalComponent(Sr.type)}get spinnerFactory(){return this.getCachedSingleton(cr.type)}get patchAssetMeta(){var t;return(t=this.getCachedSingleton(no.type))==null?void 0:t.doPatch}get alertFactory(){return this.getCachedSingleton(lr.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,co.type),this.updateMeta=n=>{var u;const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));const i=this.patchAssetMeta;if(!i)return Promise.reject(new Error("No Patch UC"));const{archived:s,description:a,name:o}=n,c=(u=this.spinnerFactory)==null?void 0:u.make({title:"Asset Meta",message:"Updating asset's meta..."});return new Promise((p,h)=>{i({archived:s,description:a,id:r.id,name:o}).then(()=>{r.archived=s,r.name=o,r.description=a,c==null||c.close(),this.sandbox&&(this.sandbox.state=Ht.MOUNTED),p()}).catch(y=>{var E;this.error("Patch asset error: "+y.message),c==null||c.close();const l={buttonLabel:"OK",message:`Something went wrong when updating the assets meta. Check the console. ${y.message}`,title:"Update Asset Error"};(E=this.alertFactory)==null||E.make(l),p()})})}}}function Wv(e,t,n){const r=co.get(t,n);if(!r){n.submitWarning("updateAppAssetMeta","Unable to find UpdateAssetMetaUC");return}r.updateMeta(e)}class uo extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAssetFileUC.get","Unable to find app object");return}const i=r.getComponent(uo.type);if(!i){n.submitWarning("UpdateAssetFileUC.get","App Object does not have UpdateAssetFileUC");return}return i}}uo.type="UpdateAssetFileUC";function qv(e){return new Kv(e)}class Kv extends uo{get patchAssetFile(){var t;return(t=this.getCachedSingleton(eo.type))==null?void 0:t.doPatch}constructor(t){super(t,uo.type),this.updateFile=n=>{const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));const i=this.patchAssetFile;if(!i)return Promise.reject();const s=cr.make({title:"Asset File",message:"Updating asset's file..."},this.appObjects);return new Promise((a,o)=>{i(r.id,n).then(c=>{r.setFile(n),r.filename=c,s==null||s.close(),a()}).catch(c=>{this.error("Patch asset file error: "+c.message),s==null||s.close();const u={buttonLabel:"OK",message:`Something went wrong when updating the asset's file. Check the console. ${c.message}`,title:"Update Asset File Error"};lr.make(u,this.appObjects),a()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function Yv(e,t,n){const r=uo.get(t,n);if(!r){n.submitWarning("updateAssetFile","Unable to find UpdateAssetFileUC");return}r.updateFile(e)}class po extends k.AppObjectUC{static get(t){return k.getSingletonComponent(po.type,t)}}po.type="GetAssetBlobURLUC";function Xv(e){return new Zv(e)}class Zv extends po{get assetRepo(){return this.getCachedSingleton(Kn.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(js.type))==null?void 0:t.doFetch}get getAsset(){var t;return(t=this.getCachedSingleton(Qr.type))==null?void 0:t.getAsset}get getAssetFromCache(){var t;return(t=this.getCachedSingleton(Ks.type))==null?void 0:t.getAsset}get storeAssetInCache(){var t;return(t=this.getCachedSingleton(Ys.type))==null?void 0:t.storeAsset}constructor(t){super(t,po.type),this.getAssetBlobURL=(n,r=!0)=>{const i=this.assetRepo,s=this.getAsset,a=this.fetchAssetFile,o=this.getAssetFromCache,c=this.storeAssetInCache;if(!i||!s||!a)return Promise.reject();if(!r)return new Promise((p,h)=>{this.fetchAssetNormally(n,p,h)});const u=i.get(n);return u&&u.blobURL?Promise.resolve(u.blobURL):new Promise((p,h)=>{let y;o?o(n).then(l=>l?s(n).then(E=>{y=E;const T=E.filename||"cached-asset";return new File([l],T,{type:l.type})}):s(n).then(E=>(E.isFetchingFile=!0,E.fetchError=void 0,y=E,a(E)))).then(l=>{if(y&&(y.setFile(l),y.isFetchingFile=!1,c&&c(n,new Blob([l],{type:l.type}),l.type).catch(E=>{this.warn(`Failed to cache asset: ${E.message}`)}),y.blobURL)){p(y.blobURL);return}h(new Error("Blob URL is empty"))}).catch(l=>{this.warn(`Cache error or fetch error: ${l.message}`),this.fetchAssetNormally(n,p,h)}):this.fetchAssetNormally(n,p,h)})},this.fetchAssetNormally=(n,r,i)=>{const s=this.getAsset,a=this.fetchAssetFile,o=this.storeAssetInCache;if(!s||!a){i(new Error("Required dependencies not found"));return}let c;s(n).then(u=>(u.isFetchingFile=!0,u.fetchError=void 0,c=u,a(u))).then(u=>{if(c&&(c.setFile(u),c.isFetchingFile=!1,o&&o(n,new Blob([u],{type:u.type}),u.type).catch(p=>{this.warn(`Failed to cache asset: ${p.message}`)}),c.blobURL)){r(c.blobURL);return}i(new Error("Blob URL is empty"))}).catch(u=>{c&&(c.fetchError=u,c.isFetchingFile=!1),i(u)})},this.appObjects.registerSingleton(this)}}class fo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(fo.type,t)}}fo.type="NewAssetUC";function Qv(e){return new Jv(e)}class Jv extends fo{get postNewAsset(){var t;return(t=this.getCachedSingleton(zs.type))==null?void 0:t.doPost}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){super(t,fo.type),this.create=n=>{const r=this.postNewAsset,i=this.assetRepo;if(!r||!i)return Promise.reject(new Error("Missing dependencies"));const{description:s,file:a,name:o,owner:c}=n;return r({description:s,name:o,file:a,ownerID:c}).then(p=>{const h=i.assetFactory(p.id);return h.setFile(a),h.description=s,h.name=o,h.filename=p.filename,i.add(h),p.id})},this.appObjects.registerSingleton(this)}}class Zl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Zl.type,t)}}Zl.type="PrefetchAssetsUC";function ex(e){return new tx(e)}class tx extends Zl{get stateMachine(){return this.getCachedSingleton(bt.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(Xs.type))==null?void 0:t.getAssetFile}constructor(t){super(t,Zl.type),this.prefetchAssets=async()=>{const n=this.fetchAssetFile;if(!this.stateMachine||!n)return Promise.reject();const r=this.stateMachine.states.reduce((s,a)=>{var c;const o=(c=this.stateMachine)==null?void 0:c.getStateByID(a);return o?s.concat(o.assets):[]},[]),i=Array.from(new Set(r));return new Promise((s,a)=>{const o=i.map(c=>n(c));Promise.all(o).then(()=>{s()}).catch(c=>{this.warn(c.message),a(c)})})},this.appObjects.registerSingleton(this)}}class nx extends k.DomainFactory{constructor(t,n){super(t),this.factoryName="SandboxAssetsFactory",this.assetRepoAO=n.getOrCreate("Asset Repository"),this.appAssetsAO=n.getOrCreate("App Assets")}setupEntities(){const t=LR(this.assetRepoAO);t.assetFactory=this.makeAssetFactory(),DR(this.appAssetsAO)}setupUCs(){Lv(this.assetRepoAO),Xv(this.assetRepoAO),xv(this.assetRepoAO),Rv(this.assetRepoAO),ex(this.assetRepoAO),Qv(this.assetRepoAO),Hv(this.appAssetsAO),Fv(this.appAssetsAO)}setupPMs(){PR(this.appAssetsAO),WR(this.appAssetsAO),zR(this.appAssetsAO)}finalSetup(){}makeAssetFactory(){return t=>{const n=this.appObjects.getOrCreate(t),r=s4(n);return av(n),lv(n),wv(n),qv(n),zv(n),UR(n),GR(n),r}}}function rx(e){const t=e.getOrCreate("SandboxAssets");return new nx(t,e)}class th extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_BLOB"}}th.type="GetAssetBlobURLHandler";function ix(e){return new sx(e)}class sx extends th{get getBlobUC(){return this.getCachedSingleton(po.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,th.type),this.action=(r,i)=>{if(!this.getBlobUC){this.error("Unable to find GetAssetBlobURLUC"),i(void 0);return}this.getBlobUC.getAssetBlobURL(r).then(s=>{i(s)}).catch(s=>{this.appObjects.submitError("GetAssetBlob",s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class nh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_APP_ASSET_URL"}}nh.type="GetAssetFolderURLHandler";function g4(e){return new ax(e)}class ax extends nh{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,nh.type),this.action=r=>{if(!this.app){this.error("No AppEntity"),r("");return}r(this.app.appAssetFolderURL??"")},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class rh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_META"}}rh.type="GetAssetMetaHandler";function ox(e){return new lx(e)}class lx extends rh{get getAssetUC(){return this.getCachedSingleton(Qr.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,rh.type),this.action=(r,i)=>{if(!this.getAssetUC){this.error("Unable to find GetAssetUC"),i(void 0);return}this.getAssetUC.getAsset(r).then(s=>{const{id:a,name:o,description:c}=s;i({id:a,name:o,description:c})}).catch(s=>{this.error(s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ih extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_STREAM_URL"}}ih.type="GetAssetStreamURLHandler";function cx(e){return new ux(e)}class ux extends ih{get getAssetUC(){try{return this.getCachedSingleton(Qr.type)}catch{return}}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,ih.type),this.action=(r,i)=>{if(!this.getAssetUC){this.error("Unable to find GetAssetUC"),i(void 0);return}this.getAssetUC.getAsset(r).then(s=>{i(s.fileURL?s.fileURL:void 0)}).catch(s=>{this.error(s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class dx extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_FOR_OWNER"}}dx.type="GetAssetsForOwnerHandler";class sh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_LINKED_ASSETS"}}sh.type="GetLinkedAssetsHandler";function px(e){return new fx(e)}class fx extends sh{get getAssetUC(){return this.getCachedSingleton(Qr.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback||!n.type)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,sh.type),this.action=(r,i,s)=>{const a=this.getAssetUC;if(!a){this.error("Unable to find GetAssetUC"),s(void 0);return}a.getAsset(r).then(o=>{const{linkedAssets:c}=o,u=[];return c.forEach(p=>{p.type===i&&u.push(a.getAsset(p.id))}),Promise.all(u)}).then(o=>{const c=o.map(u=>({description:u.description,id:u.id,name:u.name}));s(c)}).catch(o=>{this.appObjects.submitError("GetLinkedAssets",o.message),s(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a,type:o}=this.castPayloadV1(i);this.action(s,o,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ho extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ho.type,t)}}ho.type="CancelEditingUC";function hx(e){return new mx(e)}class mx extends ho{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,ho.type),this.cancel=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("App does not have DispatchIsAuthoringUC");return}const r=Zr.getByID(this.sandbox.appID,this.appObjects);if(!r){this.error("App does not have DispatchSetStateUC");return}if(this.editStateEntity.cancelEditState(),n.doDispatch(!1),this.stateMachine.activeState){const i=this.stateMachine.getStateByID(this.stateMachine.activeState);if(i){const s=this.stateMachine.states.length<=1,a=this.stateMachine.nextState!==void 0,o=this.stateMachine.previousState!==void 0,c={finalState:i.stateData,hideNavigation:s,hasNextSlide:a,hasPreviousSlide:o};r.doDispatch(c)}}else this.sandbox.state=Ht.MOUNTED},this.appObjects.registerSingleton(this)}}class Yn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Yn.type,t)}}Yn.type="ZSpaceHostEntity";function gx(e){return new Ex(e)}class Ex extends Yn{get isEnabled(){return this.memoizedEnabled.val}set isEnabled(t){this.memoizedEnabled.val=t}get isSupported(){return this.memoizedIsSupported.val}set isSupported(t){this.memoizedIsSupported.val=t}get emulate(){return this.memoizedEmulate.val}set emulate(t){this.memoizedEmulate.val=t}get isActive(){return this.memoizedActive.val}set isActive(t){this.memoizedActive.val=t}setSupportedAppVersions(t){this.supportedVersionLookup=t}isAppSupported(t,n){const r=this.supportedVersionLookup.get(t);return r?n.major>r.major?!0:n.major<r.major?!1:n.minor>r.minor?!0:!(n.minor<r.minor||n.patch<r.patch):!1}constructor(t){super(t,Yn.type),this.memoizedEnabled=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedIsSupported=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedEmulate=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoizedActive=new k.MemoizedBoolean(!1,this.notifyOnChange),this.supportedVersionLookup=new Map,this.appObjects.registerSingleton(this)}}class _i extends k.AppObjectUC{static get(t){return k.getSingletonComponent(_i.type,t)}}_i.type="StopZSpaceUC";class ji extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ji.type,t)}}ji.type="StartZSpaceUC";function bx(e){return new Tx(e)}class Tx extends ji{get zSpace(){return this.getCachedSingleton(Yn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get stopUC(){return this.getCachedSingleton(_i.type)}constructor(t){super(t,ji.type),this.startZSpace=()=>{if(!this.zSpace||!this.sandbox||!this.stopUC)return Promise.reject("Missing Components");const n=_s.getByID(this.sandbox.appID,this.appObjects);if(!n)return Promise.reject("Missing Dispatcher");if(this.zSpace.isActive)return Promise.resolve();if(this.zSpace.emulate)return this.sandbox.state===Ht.PLAYING&&n.doDispatch({},!0),this.zSpace.isActive=!0,Promise.resolve();if(!this.zSpace.isSupported)return Promise.reject(new Error("ZSpace is not supported"));const r=this.zSpace,i=this.sandbox,s=this.stopUC;return new Promise((a,o)=>{navigator.xr.requestSession("immersive-vr").then(c=>{c.addEventListener("end",s.stopZSpace,{once:!0}),r.session=c,i.state===Ht.PLAYING&&n.doDispatch(c,!1),r.isActive=!0,a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}}function yx(e){return new Sx(e)}class Sx extends _i{get zSpace(){return this.getCachedSingleton(Yn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,_i.type),this.stopZSpace=()=>{var r,i;if(!this.sandbox||!this.zSpace)return;const n=Is.getByID(this.sandbox.appID,this.appObjects);if(!n){this.warn("Unable to find DispatchStopZSpaceUC");return}this.zSpace.isActive&&(n.doDispatch(),(r=this.zSpace.session)==null||r.removeEventListener("end",this.stopZSpace),(i=this.zSpace.session)==null||i.end(),this.zSpace.session=void 0,this.zSpace.isActive=!1)},this.appObjects.registerSingleton(this)}}class mo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(mo.type,t)}}mo.type="ConsumeStateUC";function Ax(e){return new Cx(e)}class Cx extends mo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}get startZSpaceUC(){return this.getCachedSingleton(ji.type)}constructor(t){super(t,mo.type),this.consume=n=>{var r;if(!this.sandbox||!this.stateMachine||!this.editStateEntity||!this.startZSpaceUC){this.error("Missing component");return}this.editStateEntity.cancelEditState(),this.stateMachine.hasState(n)?((r=this.stateMachine)==null||r.setActiveStateByID(n),this.sandbox&&(this.sandbox.state=Ht.PLAYING),this.sandbox.startInZSpace&&this.startZSpaceUC.startZSpace()):this.error("Unable to find state by id "+n)},this.appObjects.registerSingleton(this)}}class go extends k.AppObjectUC{static get(t){return k.getSingletonComponent(go.type,t)}}go.type="DeleteStateUC";function _x(e){return new Ix(e)}class Ix extends go{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,go.type),this.deleteState=n=>{if(this.stateMachine)if(this.stateMachine.getStateByID(n),this.stateMachine.hasState(n))this.stateMachine.deleteState(n);else{this.warn("Unable to find state to delete");return}},this.appObjects.registerSingleton(this)}}class Eo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Eo.type,t)}}Eo.type="DuplicateStateUC";function Nx(e){return new Rx(e)}class Rx extends Eo{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,Eo.type),this.duplicateState=n=>{if(!this.stateMachine)return;const r=this.stateMachine.getStateByID(n);if(!r){this.warn("Unable to find state to duplicate");return}const i=this.stateMachine.createNewState(),s=r.getDTO();s.id=i.id,s.name=s.name+" Copy",i.setDTO(s)},this.appObjects.registerSingleton(this)}}class vx extends k.AppObjectUC{static get(t){return t.getComponent(this.type)}static getById(t,n){var r;return(r=n.get(t))==null?void 0:r.getComponent(this.type)}}vx.type="EditStateNameUC";class bo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(bo.type,t)}}bo.type="EditActiveStateUC";function xx(e){return new Ox(e)}class Ox extends bo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,bo.type),this.editActiveState=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchIsAuthoringUC");return}const r=Zr.getByID(this.sandbox.appID,this.appObjects);if(!r){this.error("Unable to find DispatchIsAuthoringUC");return}if(!this.stateMachine.activeState){this.error("No active slide");return}const i=this.stateMachine.getStateByID(this.stateMachine.activeState);if(!i){this.warn("Unable to find state");return}const s=this.stateMachine.states.length<=1,a=this.stateMachine.nextState!==void 0,o=this.stateMachine.previousState!==void 0,c={finalState:i.stateData,hideNavigation:s,hasNextSlide:a,hasPreviousSlide:o};r.doDispatch(c),n.doDispatch(!0),this.editStateEntity.startEditing(i)},this.appObjects.registerSingleton(this)}}class To extends k.AppObjectUC{static get(t){return k.getSingletonComponent(To.type,t)}}To.type="EditStateUC";function wx(e){return new Dx(e)}class Dx extends To{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}edit(t){if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=this.stateMachine.getStateByID(t);if(!n){this.warn("Unable to find state");return}this.stateMachine.setActiveStateByID(t),this.editStateEntity.startEditing(n),this.sandbox.state=Ht.PLAYING}constructor(t){super(t,To.type),this.appObjects.registerSingleton(this)}}class zi extends k.AppObjectUC{static get(t){return k.getSingletonComponent(zi.type,t)}}zi.type="EndActivityUC";class Zs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Zs.type,t)}}Zs.type="EmulateZSpacePM";function kx(e){return new Lx(e)}class Lx extends Zs{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Zs.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.emulate)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const Mx={defaultVM:!1,subscribe:(e,t)=>{const n=Zs.get(e);if(!n){e.submitError("emulateZSpaceAdapter","Unable to find EmulateZSpacePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Zs.get(e);if(!n){e.submitError("emulateZSpaceAdapter","Unable to find EmulateZSpacePM");return}n.removeView(t)}};class Qs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Qs.type,t)}}Qs.type="ZSpaceIsActivePM";function Px(e){return new Fx(e)}class Fx extends Qs{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Qs.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.isActive)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const Ux={defaultVM:!1,subscribe:(e,t)=>{const n=Qs.get(e);if(!n){e.submitError("zSpaceIsActiveAdapter","Unable to find ZSpaceIsActivePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Qs.get(e);if(!n){e.submitError("zSpaceIsActiveAdapter","Unable to find ZSpaceIsActivePM");return}n.removeView(t)}};class Js extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Js.type,t)}}Js.type="ZSpaceIsSupportedPM";function Bx(e){return new Hx(e)}class Hx extends Js{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Js.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.isSupported)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const E4={defaultVM:!1,subscribe:(e,t)=>{const n=Js.get(e);if(!n){e.submitError("zSpaceIsSupportedAdapter","Unable to find ZSpaceIsSupportedPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Js.get(e);if(!n){e.submitError("zSpaceIsSupportedAdapter","Unable to find ZSpaceIsSupportedPM");return}n.removeView(t)}};function $x(e,t){const n=Yn.get(e);if(!n){e.submitError("setZSpaceIsSupported","Unable to find ZSpaceHostEntity");return}n.isSupported=t}function Gx(e){const t=ji.get(e);if(!t){e.submitError("startZSpace","Unable to find StartZSpaceUC");return}t.startZSpace()}function jx(e){const t=_i.get(e);if(!t){e.submitError("stopZSpace","Unable to find StartZSpaceUC");return}t.stopZSpace()}function zx(e){const t=Yn.get(e);if(!t){e.submitError("toggleEmulateZSpace","Unable to find ZSpaceHostEntity");return}t.emulate=!t.emulate}class Vx extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxZSpaceFactory"}setupEntities(){gx(this.appObject)}setupUCs(){yx(this.appObject),bx(this.appObject)}setupPMs(){kx(this.appObject),Px(this.appObject),Bx(this.appObject)}finalSetup(){}}function Wx(e){const t=e.getOrCreate("zSpace");return new Vx(t)}function qx(e){return new Kx(e)}class Kx extends zi{get zSpace(){return this.getCachedSingleton(Yn.type)}get stopZSpaceUC(){return this.getCachedSingleton(_i.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}end(){var t,n,r;(t=this.zSpace)!=null&&t.isActive&&((n=this.stopZSpaceUC)==null||n.stopZSpace()),(r=this.stateMachine)==null||r.clearActiveState(),this.sandbox&&(this.sandbox.state=Ht.MOUNTED)}constructor(t){super(t,zi.type)}}class yo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(yo.type,t)}}yo.type="NewStateUC";function Yx(e){return new Xx(e)}class Xx extends yo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,yo.type),this.createState=()=>{!this.sandbox||!this.stateMachine||!this.editStateEntity||(this.stateMachine.clearActiveState(),!this.editStateEntity.startNewState())||(this.sandbox.state=Ht.PLAYING)},this.appObjects.registerSingleton(this)}}class So extends k.AppObjectUC{static get(t){return k.getSingletonComponent(So.type,t)}}So.type="SaveAuthoringUC";function Zx(e){return new Qx(e)}class Qx extends So{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,So.type),this.newStateDefaultName="New State",this.saveAuthoring=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;if(this.editStateEntity.stateValidationMessage){window.alert(this.editStateEntity.stateValidationMessage);return}this.editStateEntity.isNewState&&this.editStateEntity.editingState&&(this.stateMachine.setActiveStateByID(this.editStateEntity.editingState.id),this.editStateEntity.editingState.name="New State"),this.editStateEntity.finishEditing();const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchIsAuthoringUC");return}n.doDispatch(!1)},this.appObjects.registerSingleton(this)}}class Ii extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ii.type,t)}}Ii.type="TransitionToStateUC";function Jx(e){return new eO(e)}class eO extends Ii{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}transitionToState(t){if(!this.sandbox||!this.stateMachine)return;const n=Zr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchSetStateUC");return}const r=this.stateMachine,i=this.stateMachine.getStateByID(t);if(!i){this.warn(`Unable to find state ${t}`);return}r.setActiveStateByID(t);const s=r.transitionDuration,a=r.states.length<=1,o=r.nextState!==void 0,c=r.previousState!==void 0,u={finalState:i.stateData,duration:s,hideNavigation:a,hasNextSlide:o,hasPreviousSlide:c};n.doDispatch(u)}constructor(t){super(t,Ii.type),this.appObjects.registerSingleton(this)}}class Ao extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ao.type,t)}}Ao.type="SavePersistentStatesUC";function tO(e){return new nO(e)}class nO extends Ao{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,Ao.type),this.saveLocally=()=>{if(!this.stateMachine)return;const n=[];this.stateMachine.states.forEach(a=>{var c;const o=(c=this.stateMachine)==null?void 0:c.getStateByID(a);if(o){const u={assets:o.assets,data:o.stateData,id:o.id,name:o.name};n.push(u)}});const r=JSON.stringify(n),i=document.createElement("a"),s=new Blob([r],{type:"text/plain"});i.href=URL.createObjectURL(s),i.download="persistentStates.json",i.click()},this.appObjects.registerSingleton(this)}}function rO(e,t){const n=bt.get(t);if(!n){t.submitError("setSandboxStatesFromData","Unable to find StateMachineEntity");return}const r=qe.get(t);if(!r){t.submitWarning("setSandboxStatesFromData","Could not find AppSandboxEntity");return}const i=[];e.forEach(s=>{const{data:a,id:o,name:c,assets:u}=s,p=n.stateFactory(o);p.setStateData(a),p.name=c,p.appID=r.appID,p.assets=u,i.push(p)}),n.setStates(i)}class ah extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GO_TO_NEXT_STATE"}}ah.type="GoToNextStateHandler";function iO(e){return new sO(e)}class sO extends ah{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}get endActivityUC(){return this.getCachedSingleton(zi.type)}constructor(t){super(t,ah.type),this.payloadVersion=1,this.action=()=>{var i,s,a;const r=(i=this.stateMachine)==null?void 0:i.nextState;r?(s=this.transitionToStateUC)==null||s.transitionToState(r):(a=this.endActivityUC)==null||a.end()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class oh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GO_TO_PREVIOUS_STATE"}}oh.type="GoToPreviousStateHandler";function aO(e){return new oO(e)}class oO extends oh{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}constructor(t){super(t,oh.type),this.payloadVersion=1,this.action=()=>{var i,s;const r=(i=this.stateMachine)==null?void 0:i.previousState;r&&((s=this.transitionToStateUC)==null||s.transitionToState(r))},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}const lO={hasChanges:!1,isEditing:!1,isNewState:!1};class ea extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ea.type,t)}}ea.type="EditingStatePM";function cO(e){return new uO(e)}class uO extends ea{get editingEntity(){return this.getCachedSingleton(Wn.type)}vmsAreEqual(t,n){return!(t.isEditing!==n.isEditing||t.isNewState!==n.isNewState||t.hasChanges!==n.hasChanges)}constructor(t){var n;super(t,ea.type),this.onEntityChange=()=>{if(!this.editingEntity)return;const r=this.editingEntity.isEditing,i=this.editingEntity.isNewState,s=this.editingEntity.somethingHasChanged;this.doUpdateView({isEditing:r,isNewState:i,hasChanges:s})},(n=this.editingEntity)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const b4={defaultVM:lO,subscribe:(e,t)=>{const n=ea.get(e);if(!n){e.submitError("editingStateAdapter","Unable to find EditingStatePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ea.get(e);if(!n){e.submitError("editingStateAdapter","Unable to find EditingStatePM");return}n.removeView(t)}};class ta extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ta.type,t)}}ta.type="HostStateMachinePM";function dO(e){return new pO(e)}class pO extends ta{vmsAreEqual(t,n){if(t.activeSlideID!==n.activeSlideID||t.activeSlideName!==n.activeSlideName||t.nextSlideID!==n.nextSlideID||t.previousSlideID!==n.previousSlideID||t.states.length!==n.states.length||t.isSingleSlide!==n.isSingleSlide)return!1;for(let r=0;r<t.states.length;r++)if(t.states[r]!==n.states[r])return!1;return!0}constructor(t){if(super(t,ta.type),this.onEntityChange=()=>{var s;if(!this.stateMachine)return;const n=[...this.stateMachine.states],r=this.stateMachine.activeState?(s=this.stateMachine.getStateByID(this.stateMachine.activeState))==null?void 0:s.name:void 0,i={activeSlideID:this.stateMachine.activeState,activeSlideName:r,nextSlideID:this.stateMachine.nextState,previousSlideID:this.stateMachine.previousState,states:n,isSingleSlide:n.length===1};this.doUpdateView(i)},this.stateMachine=t.getComponent(bt.type),!this.stateMachine){this.error("PM has been added to an App Object that does not have a HostStateMachine");return}this.stateMachine.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const fO={activeSlideID:void 0,activeSlideName:void 0,nextSlideID:void 0,previousSlideID:void 0,states:[],isSingleSlide:!1};class bi extends k.AppObjectPM{static getById(t,n){var r;return(r=n.get(t))==null?void 0:r.getComponent(bi.type)}}bi.type="HostStatePM";bi.defaultVM={id:"",name:"",data:{},isActive:!1,appName:"",canBumpBackwards:!1,canBumpForward:!1,index:-1,streamState:Uc.INIT};function hO(e){return new mO(e)}class mO extends bi{get hostStateEntity(){return this.getCachedLocalComponent(Wa.type)}get hostStateMachine(){return this.getCachedSingleton(bt.type)}get appRepo(){return this.getCachedSingleton(yi.type)}vmsAreEqual(t,n){if(t.id!==n.id||t.name!==n.name||t.isActive!==n.isActive||t.appName!==n.appName||t.canBumpBackwards!==n.canBumpBackwards||t.canBumpForward!==n.canBumpForward||t.index!==n.index||t.streamState!==n.streamState)return!1;const r=JSON.stringify(t.data),i=JSON.stringify(n.data);return r===i}updateViewModel(){const t=this.hostStateMachine.activeState===this.hostStateEntity.id;let n="";try{const c=this.appRepo.getApp(this.hostStateEntity.appID);c&&(n=c.name)}catch{}let r=!1,i=!1,s=-1;const a=this.hostStateMachine.getStateIndex(this.hostStateEntity.id);a!==void 0&&(s=a,r=a>0,i=a<this.hostStateMachine.stateCount-1);const o={id:this.hostStateEntity.id,name:this.hostStateEntity.name,data:this.hostStateEntity.stateData,isActive:t||!1,appName:n,canBumpBackwards:r,canBumpForward:i,index:s,streamState:this.hostStateEntity.streamState};this.doUpdateView(o)}constructor(t){var n,r;super(t,bi.type),this.onEntityChange=()=>{this.updateViewModel()},this.onStateMachineChange=()=>{this.updateViewModel()},this.dispose=()=>{var i,s;(i=this.hostStateEntity)==null||i.removeChangeObserver(this.onEntityChange),(s=this.hostStateMachine)==null||s.removeChangeObserver(this.onStateMachineChange),super.dispose()},(n=this.hostStateEntity)==null||n.addChangeObserver(this.onEntityChange),(r=this.hostStateMachine)==null||r.addChangeObserver(this.onStateMachineChange),this.updateViewModel()}}const fu={defaultVM:fO,subscribe:(e,t)=>{const n=ta.get(e);if(!n){e.submitError("hostStateMachinePMAdapter","Unable to find HostStateMachinePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ta.get(e);if(!n){e.submitError("hostStateMachinePMAdapter","Unable to find HostStateMachinePM");return}n.removeView(t)}},gO={defaultVM:bi.defaultVM,subscribe:(e,t,n)=>{if(!e)return;const r=bi.getById(e,t);if(!r){t.submitError("hostStateAdapter",`Unable to find HostStatePM for ID: ${e}`);return}r.addView(n)},unsubscribe:(e,t,n)=>{var r;e&&((r=bi.getById(e,t))==null||r.removeView(n))}};function EO(e){const t=ho.get(e);if(!t){e.submitWarning("cancelEditing","Unable to find CancelEditingUC");return}t.cancel()}function bO(e,t){const n=mo.get(t);if(!n){t.submitWarning("consumeState","Unable to find ConsumeStateUC");return}n.consume(e)}function TO(e,t){const n=go.get(t);if(!n){t.submitWarning("duplicateState","Unable to find DeleteStateUC");return}n.deleteState(e)}function yO(e,t){const n=Eo.get(t);if(!n){t.submitWarning("duplicateState","Unable to find DuplicateStateUC");return}n.duplicateState(e)}function SO(e){const t=bo.get(e);if(!t){e.submitWarning("editActiveState Controller","Unable to find EditActiveStateUC");return}t.editActiveState()}function AO(e,t){const n=To.get(t);if(!n){t.submitWarning("editState","Unable to find EditStateUC");return}n.edit(e)}function CO(e){const t=zi.get(e);if(!t){e.submitWarning("endActivity Controller","Unable to find EndActivityUC");return}t.end()}function _O(e){const t=yo.get(e);if(!t){e.submitWarning("newState","Unable to find NewStateUC");return}t.createState()}function IO(e){const t=So.get(e);if(!t){e.submitWarning("saveAuthoring Controller","Unable to find SaveAuthoringUC");return}t.saveAuthoring()}function NO(e,t){const n=bt.get(e);if(!n){e.submitError("setTransitionDuration","Unable to find HostStateMachine");return}n.transitionDuration=t}function T4(e,t){const n=Ii.get(t);if(!n){t.submitWarning("transitionToState Controller","Unable to find TransitionToStateUC");return}n.transitionToState(e)}function RO(e){const t=Ao.get(e);if(!t){e.submitWarning("savePersistentStates","Unable to find SavePersistentStatesUC");return}t.saveLocally()}class vO extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxStateMachineFactory",this.stateFactory=n=>{const r=this.appObjects.getOrCreate(n),i=l4(r);return hO(r),i}}setupEntities(){const t=k6(this.appObject);M6(this.appObject),t.stateFactory=this.stateFactory}setupUCs(){hx(this.appObject),Ax(this.appObject),xx(this.appObject),wx(this.appObject),qx(this.appObject),Yx(this.appObject),Zx(this.appObject),Jx(this.appObject),_x(this.appObject),Nx(this.appObject),tO(this.appObject)}setupPMs(){cO(this.appObject),dO(this.appObject)}finalSetup(){}}function xO(e){const t=e.getOrCreate("State Machine");return new vO(t)}class lh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="HAS_NEXT_STATE"}}lh.type="HasNextStateHandler";function OO(e){return new wO(e)}class wO extends lh{get stateMachine(){return this.getCachedSingleton(bt.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,lh.type),this.action=r=>{if(!this.stateMachine){r(!1);return}this.stateMachine.nextState?r(!0):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ch extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="HAS_PREVIOUS_STATE"}}ch.type="HasPreviousStateHandler";function DO(e){return new kO(e)}class kO extends ch{get stateMachine(){return this.getCachedSingleton(bt.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,ch.type),this.action=r=>{if(!this.stateMachine){r(!1);return}this.stateMachine.previousState?r(!0):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class LO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="IS_ASSET_FILE_FETCHED"}}LO.type="IsAssetFetchedHandler";class uh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="IS_ZSPACE_AVAILABLE"}}uh.type="IsZSpaceAvailableHandler";function MO(e){return new PO(e)}class PO extends uh{get zSpace(){return this.getCachedSingleton(Yn.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,uh.type),this.action=r=>{this.zSpace?r(this.zSpace.isSupported):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class FO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="NEW_ACTIVITY_ASSET"}}FO.type="NewActivityAssetHandler";class dh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="APP_IS_READY"}}dh.type="OnAppIsReadyHandler";function UO(e){return new BO(e)}class BO extends dh{get app(){return this.getCachedLocalComponent(nr.type)}constructor(t){super(t,dh.type),this.action=()=>{if(!this.app){this.error("No App");return}this.app.state=Dn.READY},this.handleRequest=r=>{if(r===1)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ph extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ON_STATE_CHANGE"}}ph.type="OnStateChangeHandler";function HO(e){return new $O(e)}class $O extends ph{get editStateEntity(){return this.getCachedSingleton(Wn.type)}castPayloadV1(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}castPayloadV2(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,2,JSON.stringify(t));return n}castPayloadV3(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,3,JSON.stringify(t));return n}castPayloadV4(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,3,JSON.stringify(t));return n}constructor(t){super(t,ph.type),this.action=(r,i,s,a)=>{if(!this.editStateEntity)return;const o=this.editStateEntity.editingState;if(!o||(o.setStateData(r),o.assets=i,this.editStateEntity.stateValidationMessage=s,!a))return;const c=GO.get(a.toUpperCase());c||this.warn(`Unable to parse ${a} into an expected response`),o.expectedResponse=c},this.handleRequest=(r,i)=>{if(r===1){const{stateObject:s}=this.castPayloadV1(i);this.action(s,[])}else if(r===2){const{stateObject:s,validationErrorMessage:a}=this.castPayloadV2(i);this.action(s,[],a)}else if(r===3){const{stateObject:s,assets:a,validationErrorMessage:o}=this.castPayloadV3(i);this.action(s,a,o)}else if(r===4){const{stateObject:s,assets:a,validationErrorMessage:o,responseType:c}=this.castPayloadV4(i);this.action(s,a,o,c)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}const GO=new Map([["HIT",In.HIT],["MULTIHIT",In.MULTIHIT],["NONE",In.NONE],["PROGRESS",In.PROGRESS],["QUALITY",In.QUALITY],["SCORE",In.SCORE]]);class fh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ON_STATE_COMPLETED"}}fh.type="OnStateCompleteHandler";function jO(e){return new zO(e)}class zO extends fh{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}get endActivityUC(){return this.getCachedSingleton(zi.type)}constructor(t){super(t,fh.type),this.action=()=>{var i,s,a;const r=(i=this.stateMachine)==null?void 0:i.nextState;r?(s=this.transitionToStateUC)==null||s.transitionToState(r):(a=this.endActivityUC)==null||a.end()},this.handleRequest=r=>{if(r===1)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class hh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="REGISTER_EXTERNAL_STYLESHEETS"}}hh.type="RegisterExternalStyleSheetsHandler";function y4(e){return new VO(e)}class VO extends hh{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(n.stylesheets===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,hh.type),this.requestType="REGISTER_EXTERNAL_STYLESHEETS",this.action=r=>{this.app&&(r.forEach(i=>{var s;(s=this.app)==null||s.styles.push(i)}),this.app.notifyOnChange())},this.handleRequest=(r,i)=>{if(r===1){const{stylesheets:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class WO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="RESTORE_CURRENT_STATE"}}WO.type="RestoreCurrentStateHandler";class mh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_ALERT"}}mh.type="ShowAlertHandler";function qO(e){return new KO(e)}class KO extends mh{castPayloadV1(t){const n=t;if(n.title===void 0||n.message===void 0||n.closeButtonLabel===void 0||n.closeCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,mh.type),this.action=r=>{const{closeButtonLabel:i,closeCallback:s,message:a,title:o}=r;lr.make({buttonLabel:i,message:a,title:o,onClose:s},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class gh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_CONFIRM"}}gh.type="ShowConfirmHandler";function YO(e){return new XO(e)}class XO extends gh{castPayloadV1(t){const n=t;if(n.title===void 0||n.message===void 0||n.confirmButtonLabel===void 0||n.cancelButtonLabel===void 0||n.confirmCallback===void 0||n.cancelCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,gh.type),this.action=r=>{const{cancelButtonLabel:i,cancelCallback:s,confirmButtonLabel:a,confirmCallback:o,message:c,title:u}=r;$i.make({cancelButtonLabel:i,confirmButtonLabel:a,message:c,title:u,onCancel:s,onConfirm:o},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Eh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_MARKDOWN_EDITOR"}}Eh.type="ShowMarkDownEditorHandler";function ZO(e){return new QO(e)}class QO extends Eh{castPayloadV1(t){const n=t;if(n.initialText===void 0||n.submitCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Eh.type),this.action=r=>{const{initialText:i,submitCallback:s}=r;Hs.make({initialText:i,onConfirm:s},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class bh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_SELECT_MODEL"}}bh.type="ShowSelectModelHandler";function JO(e){return new e7(e)}class e7 extends bh{get assetPlugin(){return this.getCachedSingleton(Ai.type)}castPayloadV1(t){const n=t;if(n.callback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n.callback}constructor(t){super(t,bh.type),this.action=r=>{this.assetPlugin&&(this.assetPlugin.callback=r,this.assetPlugin.show=!0,$s.make(this.appObjects))},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Th extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_SPINNER"}}Th.type="ShowSpinnerHandler";function t7(e){return new n7(e)}class n7 extends Th{castPayloadV1(t){const n=t;if(n.message===void 0||n.title===void 0||n.closeCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Th.type),this.action=r=>{const{title:i,message:s,closeCallback:a}=r,o=cr.make({title:i,message:s},this.appObjects);a(()=>o==null?void 0:o.close())},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class yh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_ZSPACE"}}yh.type="StartZSpaceHandler";function r7(e){return new i7(e)}class i7 extends yh{get startZSpaceUC(){return this.getCachedSingleton(ji.type)}constructor(t){super(t,yh.type),this.payloadVersion=1,this.action=()=>{var r;(r=this.startZSpaceUC)==null||r.startZSpace()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Sh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_ZSPACE"}}Sh.type="StopZSpaceHandler";function s7(e){return new a7(e)}class a7 extends Sh{get stopUC(){return this.getCachedSingleton(_i.type)}constructor(t){super(t,Sh.type),this.payloadVersion=1,this.action=()=>{var r;(r=this.stopUC)==null||r.stopZSpace()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Hc extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_ACTIVITY_ASSET"}}Hc.type="SubmitActivityAssetHandler";function o7(e){return new l7(e)}class l7 extends Hc{castPayloadV1(t){const n=t;if(!n.assetFile||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Hc.type),this.action=()=>{throw new dI(this.requestType)},this.handleRequest=(r,i)=>{if(r===1){const{assetFile:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Ah extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_LOG"}}Ah.type="SubmitLogHandler";function c7(e){return new u7(e)}class u7 extends Ah{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(n.sender===void 0||n.severity===void 0||n.message===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Ah.type),this.action=(r,i,s)=>{if(!this.app)return;const a=`[${this.app.name}] ${r}`;i==="LOG"?this.appObjects.submitLog(a,s):i==="WARNING"?this.appObjects.submitWarning(a,s):i==="ERROR"?this.appObjects.submitError(a,s):i==="FATAL"?this.appObjects.submitFatal(a,s):(this.appObjects.submitLog(a,s),this.appObjects.submitWarning("Host Handler - Submit Log",`Received an unsupported log severity type of ${i}`))},this.handleRequest=(r,i)=>{if(r===1){const{sender:s,message:a,severity:o}=this.castPayloadV1(i);this.action(s,o,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Ni extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ni.type,t)}}Ni.type="ChallengeResultsEntity";function d7(e){return new p7(e)}class p7 extends Ni{get results(){return Array.from(this.resultLookup.values())}get postActivityProgress(){return this._postActivityProgress}set postActivityProgress(t){this._postActivityProgress!==t&&(this._postActivityProgress=t,this.notifyOnChange())}constructor(t){super(t,Ni.type),this.resultLookup=new Map,this.newAttemptInProgress=new Set,this.initialResultsState={},this.submitHitResult=(n,r,i,s)=>{const a=this.resultLookup.get(n);if(a&&a.type==="HIT"&&a.resultData.success===!0)return;const c={slideID:n,message:s,resultData:{success:r},tries:i,type:"HIT"};this.resultLookup.set(n,c),this.notifyOnChange()},this.submitMultiHitResult=(n,r,i,s,a,o)=>{const c=this.resultLookup.get(n);if(c&&c.type==="MULTIHIT"){const y=c.resultData;if(y.hits>r){this.newAttemptInProgress.add(n);return}if(y.hits===r&&y.misses<=i)return}this.newAttemptInProgress.has(n)&&(a+=1,this.newAttemptInProgress.delete(n));const h={slideID:n,message:o,resultData:{hits:r,misses:i,unanswered:s},tries:a,type:"MULTIHIT"};this.resultLookup.set(n,h),this.notifyOnChange()},this.submitQualityResult=(n,r,i,s,a)=>{const c={slideID:n,message:a,resultData:{stars:r,maxStars:i},tries:s,type:"QUALITY"};this.resultLookup.set(n,c),this.notifyOnChange()},this.submitScoreResult=(n,r,i,s,a)=>{const c={slideID:n,message:a,resultData:{score:r,maxScore:i},tries:s,type:"SCORE"};this.resultLookup.set(n,c),this.notifyOnChange()},this.getResultForSlide=n=>this.resultLookup.get(n),this.getScoreForSlide=n=>{const r=this.getResultForSlide(n);if(!r)return 0;switch(r.type){case"HIT":return r.resultData.success?1:0;case"MULTIHIT":{const i=r.resultData,s=i.hits+i.unanswered;return s>0?i.hits/s:0}case"QUALITY":{const i=r.resultData;return i.maxStars>0?i.stars/i.maxStars:0}case"SCORE":{const i=r.resultData;return i.maxScore>0?i.score/i.maxScore:0}case"PROGRESS":return r.resultData.maxProgress/100;default:return 0}},this.submitProgressResult=(n,r,i)=>{const s=this.getResultForSlide(n);if(s&&s.resultData.maxProgress>r)return;const o={slideID:n,message:i,resultData:{maxProgress:r},tries:1,type:"PROGRESS"};this.resultLookup.set(n,o),this.notifyOnChange()},this.getResultsState=()=>{const n={};return this.resultLookup.forEach((r,i)=>{n[i]=r}),n},this.getInitialResultsState=()=>this.initialResultsState,this.setResultsState=n=>{this.resultLookup.clear(),this.newAttemptInProgress.clear(),this.initialResultsState={...n},Object.entries(n).forEach(([r,i])=>{this.resultLookup.set(r,i)}),this.notifyOnChange()},this.appObjects.registerSingleton(this)}}class na extends k.AppObjectPM{static get(t){return t.getSingleton(na.type)}}na.type="ChallengeResultsListPM";function f7(e){return new h7(e)}class h7 extends na{get results(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{const a=n[s];(i.id!==a.id||i.attempts!==a.attempts||i.resultData!==a.resultData)&&(r=!1)}),r}constructor(t){var n,r;super(t,na.type),this.onEntityChange=()=>{if(!this.results||!this.stateMachine)return;const i=[];this.stateMachine.states.forEach(a=>{const o=this.stateMachine.getStateByID(a);if(!o)return;const c=this.stateMachine.getStateIndex(a)??-1,u=this.results.getResultForSlide(a);if(u){const p={id:a,slideName:o.name,attempts:u.tries,resultType:u.type,message:u.message,stateIndex:c,resultData:u.resultData};i.push(p)}else if(o.expectedResponse!==void 0&&o.expectedResponse!==In.NONE){const p={id:a,slideName:o.name,attempts:0,stateIndex:c,message:"Incomplete"};i.push(p)}}),this.doUpdateView(i)},this.doUpdateView([]),(n=this.results)==null||n.addChangeObserver(this.onEntityChange),(r=this.stateMachine)==null||r.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const S4={defaultVM:[],subscribe:(e,t)=>{const n=na.get(e);if(!n){e.submitError("challengeResultsListAdapter","Unable to find ChallengeResultsListPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=na.get(e);if(!n){e.submitError("challengeResultsListAdapter","Unable to find ChallengeResultsListPM");return}n.removeView(t)}};class Ql extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Ql.type,t)}}Ql.type="HasChallengeResultsPM";function m7(e){return new g7(e)}class g7 extends Ql{get resultsEntity(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Ql.type),this.defaultVM=!1,this.formVM=()=>{var r;if(!this.resultsEntity)return;let n=((r=this.resultsEntity.results)==null?void 0:r.length)>0||!1;if(!n&&this.stateMachine){const i=this.stateMachine.states;for(const s of i){const a=this.stateMachine.getStateByID(s);if(a&&a.expectedResponse!==void 0&&a.expectedResponse!==In.NONE){n=!0;break}}}this.doUpdateView(n)},this.resultsEntity&&this.observeEntity(this.resultsEntity),this.stateMachine&&this.observeEntity(this.stateMachine)}}class Jl extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Jl.type,t)}}Jl.type="ChallengeScoreListPM";function E7(e){return new b7(e)}class b7 extends Jl{get challengeResults(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r].id!==n[r].id||t[r].displayName!==n[r].displayName||t[r].score!==n[r].score)return!1;return!0}constructor(t){var n,r;super(t,Jl.type),this.onEntityChange=()=>{if(!this.challengeResults||!this.stateMachine)return;const i=[];this.stateMachine.states.forEach((a,o)=>{const c=this.challengeResults.getResultForSlide(a),u=this.stateMachine.getStateByID(a);if(!(!c&&(!u||u.expectedResponse===void 0||u.expectedResponse===In.NONE))&&u){const p=this.challengeResults.getScoreForSlide(a),h=`Slide ${o+1}: ${u.name}`;i.push({id:a,displayName:h,score:p})}}),this.doUpdateView(i)},this.doUpdateView([]),(n=this.challengeResults)==null||n.addChangeObserver(this.onEntityChange),(r=this.stateMachine)==null||r.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}class T7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="ChallengeResultsFactory"}setupEntities(){d7(this.appObject)}setupUCs(){}setupPMs(){f7(this.appObject),E7(this.appObject),m7(this.appObject)}finalSetup(){}}function y7(e){const t=e.getOrCreate("ChallengeResults");return new T7(t)}class Ch extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_RESULTS"}}Ch.type="SubmitResultHandler";function S7(e){return new A7(e)}class A7 extends Ch{get challengeResults(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}handleHitV1(t,n,r,i){var a;const s=t;if(s.success===void 0){this.warn(`Cannot parse Hit Result V1 payload: ${JSON.stringify(t)}`);return}(a=this.challengeResults)==null||a.submitHitResult(r,s.success,n,i)}handleProgressV1(t,n,r){var s;const i=t;if(i.progress===void 0){this.warn(`Cannot parse Progress Result V1 payload: ${JSON.stringify(t)}`);return}(s=this.challengeResults)==null||s.submitProgressResult(n,i.progress,r)}handleMultiHitV1(t,n,r,i){var p,h;const{hits:s,misses:a,unanswered:o}=t;if(s===void 0||a===void 0||o===void 0){this.warn(`Cannot parse Multi Hit Result V1 payload: ${JSON.stringify(t)}`);return}let c=1;const u=(p=this.challengeResults)==null?void 0:p.results.find(y=>y.slideID===r);u&&u.type==="MULTIHIT"&&(c=u.tries),(h=this.challengeResults)==null||h.submitMultiHitResult(r,s,a,o,c,i)}handleQualityV1(t,n,r,i){var o;const{maxStars:s,stars:a}=t;if(s===void 0||a===void 0){this.warn(`Cannot parse Quality Result V1 payload: ${JSON.stringify(t)}`);return}(o=this.challengeResults)==null||o.submitQualityResult(r,a,s,n,i)}handleScoreV1(t,n,r,i){var o;const{score:s,maxScore:a}=t;if(a===void 0||s===void 0){this.warn(`Cannot parse Score Result V1 payload: ${JSON.stringify(t)}`);return}(o=this.challengeResults)==null||o.submitScoreResult(r,s,a,n,i)}castPayloadV2(t){const n=t;if(n.result===void 0||n.resultType===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}castPayloadV3(t){const n=t;if(n.result===void 0||n.resultType===void 0)throw new rn(this.requestType,2,JSON.stringify(t));return n}constructor(t){super(t,Ch.type),this.resultTypeToResponseMap={HIT_V1:In.HIT,MULTIHIT_V1:In.MULTIHIT,QUALITY_V1:In.QUALITY,SCORE_V1:In.SCORE,PROGRESS_V1:In.PROGRESS},this.action=(r,i,s)=>{var u;if(!this.challengeResults||!this.stateMachine){this.error("Missing Component");return}if(this.stateMachine.activeState===void 0){this.warn("Cannot store result because there is no active slide");return}const a=this.stateMachine.activeState,o=this.stateMachine.getStateByID(a);if(!o){this.warn("Cannot find active state entity");return}o.expectedResponse=this.resultTypeToResponseMap[r];let c=((u=this.challengeResults.getResultForSlide(a))==null?void 0:u.tries)??0;r!=="PROGRESS_V1"&&(c+=1),r==="HIT_V1"?this.handleHitV1(i,c,a,s):r==="MULTIHIT_V1"?this.handleMultiHitV1(i,c,a,s):r==="QUALITY_V1"?this.handleQualityV1(i,c,a,s):r==="SCORE_V1"?this.handleScoreV1(i,c,a,s):r==="PROGRESS_V1"&&this.handleProgressV1(i,a,s)},this.handleRequest=(r,i)=>{if(r===2){const{description:s,result:a,resultType:o}=this.castPayloadV2(i);this.action(o,a,s)}else if(r===3){const{description:s,result:a,resultType:o}=this.castPayloadV3(i);this.action(o,a,s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}function C7(e){ix(e),g4(e),ox(e),cx(e),px(e),iO(e),aO(e),OO(e),DO(e),MO(e),UO(e),HO(e),jO(e),y4(e),qO(e),YO(e),ZO(e),JO(e),t7(e),r7(e),s7(e),o7(e),c7(e),S7(e)}function _7(e){return function(n,r){const i=qe.get(e);if(!i){e.submitError("makeSubmitActivityAssetHandlerSandbox","Unable to find AppSandboxEntity"),r(void 0);return}if(!i.mockActivityID){e.submitError("makeSubmitActivityAssetHandlerSandbox","No activity ID found"),r(void 0);return}const s=i.mockActivityID,a={name:"Activity Asset",description:"Asset for activity "+s,file:n,owner:s},o=fo.get(e);if(!o){e.submitError("makeSubmitActivityAssetHandlerSandbox","Unable to find NewAssetUC"),r(void 0);return}o.create(a).then(c=>{r(c)})}}class I7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="AppSandboxFeatureFactory"}setupEntities(){this.sandbox=gI(this.appObject),a4(this.appObject),o4(this.appObject)}setupUCs(){dR(this.appObject),C7(this.appObject),F6(this.appObject),H6(this.appObject),pR(this.appObject),ER(this.appObject),bI(this.appObject)}setupPMs(){G6(this.appObject),z6(this.appObject),W6(this.appObject),Y6(this.appObject),Q6(this.appObject),eR(this.appObject)}finalSetup(){const t=this.appObjects.getSingleton(Hc.type);if(t&&(t.action=_7(this.appObjects)),!this.sandbox){this.error("AppSandboxEntity not found during final setup.");return}const n=yi.get(this.appObjects);if(!n){this.error("AppRepoEntity not found in AppObjects.");return}n.add(this.sandbox.app)}}function N7(e,t){const n=t.getOrCreate(e);return new I7(n)}class ra extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ra.type,t)}}ra.type="AssetSystemPluginPM";function R7(e){return new v7(e)}class v7 extends ra{get assetPlugin(){return this.getCachedSingleton(Ai.type)}vmsAreEqual(t,n){if(t.loading!==n.loading||t.show!==n.show||t.styleSheets.length!==n.styleSheets.length)return!1;let r=!0;return t.styleSheets.forEach((i,s)=>{const a=n.styleSheets[s];i!==a&&(r=!1)}),r}constructor(t){var n;super(t,ra.type),this.onChange=()=>{var a,o,c;if(!this.assetPlugin)return;const r=this.assetPlugin.show;let i=!1;(r&&((a=this.assetPlugin.app)==null?void 0:a.state)===Dn.INIT||r&&((o=this.assetPlugin.app)==null?void 0:o.state)===Dn.LOADING)&&(i=!0);const s={show:r,loading:i,styleSheets:((c=this.assetPlugin.app)==null?void 0:c.styles)??[]};this.doUpdateView(s)},(n=this.assetPlugin)==null||n.addChangeObserver(this.onChange),this.onChange(),this.appObjects.registerSingleton(this)}}const x7={defaultVM:{show:!1,loading:!1,styleSheets:[]},subscribe:(e,t)=>{const n=ra.get(e);if(!n){e.submitError("assetPluginPMAdapter","Unable to find AssetPluginPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ra.get(e);if(!n){e.submitError("assetPluginPMAdapter","Unable to find AssetPluginPM");return}n.removeView(t)}};class ia extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ia.type,t)}}ia.type="AssetPluginContainerUC";function O7(e){const t=ia.get(e);t?t.clearContainer():e.submitWarning("clearAssetPluginContainer","Unable to find AssetPluginContainerUC")}function w7(e,t){const n=ia.get(t);n?n.setContainer(e):t.submitWarning("setAssetPluginContainer","Unable to find AssetPluginContainerUC")}function D7(e){return new k7(e)}class k7 extends ia{get mounterUC(){return this.getCachedLocalComponent(Ar.type)}get assetPlugin(){return this.getCachedSingleton(Ai.type)}get dispatchStart(){return this.getCachedLocalComponent(Cs.type)}get dispatchStop(){return this.getCachedLocalComponent(Si.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,ia.type),this.clearContainer=()=>{var n;!this.assetPlugin||!this.dispatchStop||(n=this.assetPlugin.app)!=null&&n.isMounted&&(this.assetPlugin.container=void 0,this.dispatchStop.doDispatch())},this.setContainer=n=>{const r=this.assetPlugin,i=this.mounterUC,s=this.dispatchStart;if(!i||!r||!s||!this.vivedAPI||!this.sandbox)return Promise.resolve();r.container=n;const a=this.sandbox.channelID??"",o={baseApiURL:this.vivedAPI.baseUrl,channelID:a,container:n,callback:r.callback};return new Promise(c=>{i.mount(r.version.major,r.version.minor).then(()=>{s.doDispatch(o),c()})})},this.appObjects.registerSingleton(this)}}const L7="app448f8f293fbb493a9e233f113ce8b56a",M7="1.2.0";class P7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="AssetPluginFeatureFactory"}setupEntities(){this.assetPlugin=SR(this.appObject),o4(this.appObject),a4(this.appObject)}setupUCs(){hI(this.appObject),D7(this.appObject),sR(this.appObject),c4(this.appObject),p4(this.appObject),g4(this.appObject),y4(this.appObject),OR(this.appObject)}setupPMs(){R7(this.appObject)}finalSetup(){if(!this.assetPlugin){this.error("AssetPlugin entity not initialized");return}this.assetPlugin.version=k.Version.FromString(M7);const t=yi.get(this.appObjects);t?t.add(this.assetPlugin.app):this.error("Unable to find app repo. Make sure it is setup before setting up the Asset Plugin")}}function F7(e){const t=e.getOrCreate(L7);return new P7(t)}var pT;(function(e){e.MOUNT_PLAYER="MOUNT_PLAYER",e.UNMOUNT_PLAYER="UNMOUNT_PLAYER",e.APP_REQUESTED="APP_REQUESTED",e.APP_READY="APP_READY",e.ASSET_REQUESTED="ASSET_REQUESTED",e.ASSET_RECEIVED="ASSET_RECEIVED",e.SLIDE_START="SLIDE_START",e.SLIDE_STOP="SLIDE_STOP",e.START_ACTIVITY="START_ACTIVITY",e.ACTIVITY_COMPLETED="ACTIVITY_COMPLETED",e.ACTIVITY_PUBLISHED="ACTIVITY_PUBLISHED"})(pT||(pT={}));class mm extends k.AppObjectPM{static get(t){return k.getSingletonComponent(mm.type,t)}}mm.type="FatalErrorPM";class Ri extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ri.type,t)}}Ri.type="LoggerEntity";function U7(e){return new B7(e)}class B7 extends Ri{formConsoleString(t){const{sender:n,message:r}=t;return`[${n}] ${r}`}setNewLog(t,n,r){const i={sender:t,message:n,severity:r};return this.logs.push(i),this._lastLog=i,i}get forwardLogsToConsole(){return this.memoisedForwardLogs.val}set forwardLogsToConsole(t){this.memoisedForwardLogs.val=t}get lastLog(){return this._lastLog}constructor(t){super(t,Ri.type),this.logs=[],this.submitLog=(n,r)=>{const i=this.setNewLog(n,r,"LOG");this.forwardLogsToConsole&&console.log(this.formConsoleString(i)),this.notifyOnChange()},this.submitWarning=(n,r)=>{const i=this.setNewLog(n,r,"WARNING");console.warn(this.formConsoleString(i)),this.notifyOnChange()},this.submitError=(n,r)=>{const i=this.setNewLog(n,r,"ERROR");console.error(this.formConsoleString(i)),this.notifyOnChange()},this.submitFatal=(n,r)=>{const i=this.setNewLog(n,r,"FATAL");console.error(this.formConsoleString(i)),this.notifyOnChange()},this.memoisedForwardLogs=new k.MemoizedBoolean(!1,this.notifyOnChange),this.clear=()=>{this.logs=[],this._lastLog=void 0},this.appObjects.registerSingleton(this),this.appObjects.submitLog=this.submitLog,this.appObjects.submitWarning=this.submitWarning,this.appObjects.submitError=this.submitError,this.appObjects.submitFatal=this.submitFatal}}class sa extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(sa.type,t)}}sa.type="ForwardLogsToConsolePM";function H7(e){return new $7(e)}class $7 extends sa{get logger(){return this.getCachedSingleton(Ri.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,sa.type),this.defaultVM=!1,this.formVM=()=>{this.logger&&this.doUpdateView(this.logger.forwardLogsToConsole)},this.logger&&this.observeEntity(this.logger)}}class aa extends k.AppObjectPM{static get(t){return k.getSingletonComponent(aa.type,t)}}aa.type="LogSummaryPM";function G7(e){return new j7(e)}class j7 extends aa{get logger(){return this.getCachedSingleton(Ri.type)}vmsAreEqual(t,n){return!(t.errorsLabel!==n.errorsLabel||t.logsLabel!==n.logsLabel||t.warningsLabel!==n.warningsLabel)}constructor(t){var n;super(t,aa.type),this.onEntityChange=()=>{if(!this.logger)return;const r={logsLabel:"No Logs have been submitted",warningsLabel:"No Warnings have been submitted",errorsLabel:"No Errors have been submitted"},i=this.logger.logs;let s=0,a=0,o=0;i.forEach(c=>{c.severity==="LOG"?s++:c.severity==="WARNING"?a++:o++}),s>0&&(r.logsLabel=`${s} Logs have been submitted`),a>0&&(r.warningsLabel=`${a} Warnings have been submitted`),o>0&&(r.errorsLabel=`${o} Errors have been submitted`),this.doUpdateView(r)},this.onEntityChange(),(n=this.logger)==null||n.addChangeObserver(this.onEntityChange),this.appObjects.registerSingleton(this)}}const z7={logsLabel:"",warningsLabel:"",errorsLabel:""},V7={defaultVM:!1,subscribe:(e,t)=>{const n=sa.get(e);if(!n){e.submitError("forwardLogsToConsoleAdapter","Unable to find ForwardLogsToConsolePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=sa.get(e);if(!n){e.submitError("forwardLogsToConsoleAdapter","Unable to find ForwardLogsToConsolePM");return}n.removeView(t)}},A4={defaultVM:z7,subscribe:(e,t)=>{const n=aa.get(e);if(!n){e.submitError("logSummaryAdapter","Unable to find LogSummaryPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=aa.get(e);if(!n){e.submitError("logSummaryAdapter","Unable to find LogSummaryPM");return}n.removeView(t)}};class e1 extends k.AppObjectUC{static get(t){return k.getSingletonComponent(e1.type,t)}}e1.type="DownloadLogUC";function W7(e){return new q7(e)}class q7 extends e1{get logger(){return this.getCachedSingleton(Ri.type)}doDownload(){if(!this.logger)return;const t="vivedPlayerLog.json",n=this.logger.logs,r=JSON.stringify(n,null,2),i=new Blob([r],{type:"application/pdf"});this.downloadFile(t,i)}constructor(t){super(t,e1.type),this.downloadFile=k.downloadFile,this.appObjects.registerSingleton(this)}}function K7(e){const t=Ri.get(e);t?t.forwardLogsToConsole=!t.forwardLogsToConsole:e.submitError("toggleForwardLogs","Unable to find LoggerEntity")}class Y7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxLoggerFactory"}setupEntities(){U7(this.appObject)}setupUCs(){W7(this.appObject)}setupPMs(){G7(this.appObject),H7(this.appObject)}finalSetup(){}}function X7(e){const t=e.getOrCreate("Logger");return new Y7(t)}class gm extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(gm.type,t)}}gm.type="SnackbarRepo";class Em extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Em.type,t)}}Em.type="SnackbarPM";function Z7(e,t){const n=k.makeAppObjectRepo(),r=new k.DomainFactoryRepo(n.getOrCreate("DomainFactory"));N7(e,n),lI(n),rx(n),F7(n),xO(n),y7(n),D3(n),X7(n),x6(n),sv(n),Wx(n),Nv(n),r.setupDomain();const i=qe.get(n);if(!i)throw new Error("Failed to create AppSandboxEntity");return i.app.versions=[k.Version.FromString(t.version)],i.app.appAssetFolderURL=new URL("/assets/",window.location.href).toString(),rO(t.persistentStates,n),NO(n,1),$x(n,t.zSpaceSupported??!0),MI(n,"light"),n}const Tt=K.createContext(k.makeAppObjectRepo());function wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y1={exports:{}},X1={exports:{}},Rt={};/** @license React v16.13.1
3
+ "use strict";var Z8=Object.defineProperty;var Q8=(e,t,n)=>t in e?Z8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hl=(e,t,n)=>Q8(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@vived/core"),C=require("react/jsx-runtime"),J8=require("react-dom/client"),K=require("react"),La=require("react-dom");function i4(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=i4(K),eI=i4(La);class pm extends k.AppObjectPM{static get(t){return t.getSingleton(pm.type)}}pm.type="ActiveAppPM";var Dn;(function(e){e.INIT="INIT",e.LOADING="LOADING",e.READY="READY",e.ERROR="ERROR"})(Dn||(Dn={}));class nr extends k.AppObjectEntity{static get(t){if(!t)throw new Error("AppObject cannot be null or undefined");return t.getComponent(nr.type)}static getById(t,n){if(!t)throw new Error("ID cannot be empty");if(!n)throw new Error("AppObjectRepo cannot be null or undefined");const r=n.get(t);if(!r){n.submitWarning("AppEntity.getById",`Unable to find app object by ID: ${t}`);return}return r.getComponent(nr.type)}static addIfMissing(t){if(!t)throw new Error("AppObject cannot be null or undefined");const n=t.getComponent(nr.type);return n||pu(t)}}nr.type="AppEntity";function pu(e){return new tI(e)}class tI extends nr{get id(){return this.appObject.id}get name(){return this.memoizedName.val}set name(t){this.memoizedName.val=t}get description(){return this.memoizedDescription.val}set description(t){this.memoizedDescription.val=t}get image_url(){return this.memoizedImageUrl.val}set image_url(t){this.memoizedImageUrl.val=t}get imageAssetId(){const t=this.memoizedImageAssetId.val;return t===""?void 0:t}set imageAssetId(t){this.memoizedImageAssetId.val=t??""}get latestVersion(){return k.Version.GetLatest(this.versions)}get mountedVersion(){return this._mountedVersion}set mountedVersion(t){this._mountedVersion!==t&&(this._mountedVersion=t,this.notifyOnChange())}get updateIsAvailable(){if(this._mountedVersion!==void 0&&this.latestVersion!==void 0)return!k.Version.AreEqual(this._mountedVersion,this.latestVersion)}get state(){return this._state}set state(t){this._state=t,this.notifyOnChange()}get assignedToOwner(){return this._assignedToOwner}set assignedToOwner(t){this._assignedToOwner=t,this.notifyOnChange()}get isMounted(){return this._mountedVersion!==void 0}get errorMessage(){return this._errorMsg}set errorMessage(t){this._errorMsg!==t&&(this._errorMsg=t,this.notifyOnChange())}get hasError(){return this._errorMsg!==void 0}constructor(t){super(t,nr.type),this.memoizedName=new k.MemoizedString("",this.notifyOnChange),this.memoizedDescription=new k.MemoizedString("",this.notifyOnChange),this.memoizedImageUrl=new k.MemoizedString("",this.notifyOnChange),this.memoizedImageAssetId=new k.MemoizedString("",this.notifyOnChange),this.versions=[],this._state=Dn.INIT,this._assignedToOwner=!1,this.styles=[]}}var Jf;(function(e){e.RELEASE="RELEASE",e.BETA="BETA",e.ALPHA="ALPHA"})(Jf||(Jf={}));class yi extends k.AppObjectEntityRepo{static get(t){return t.getSingleton(yi.type)}}yi.type="AppRepoEntity";function nI(e){return new rI(e)}class rI extends yi{constructor(t){super(t,yi.type),this.appReleaseStage=Jf.RELEASE,this.appFactory=n=>pu(this.appObjects.getOrCreate(n)),this.getOrCreate=n=>{const r=this.getForAppObject(n);if(r)return r;const i=this.appFactory(n);return this.add(i),i},this.getApp=n=>this.getForAppObject(n),this.getAllApps=()=>this.getAll(),this.deleteApp=n=>{this.removeForAppObject(n)},this.deleteAllApps=()=>{this.getAllApps().forEach(r=>{this.deleteApp(r.id)})},this.hasApp=n=>this.hasForAppObject(n),this.appObjects.registerSingleton(this)}}class $l extends k.AppObjectPM{static get(t){return t.getSingleton($l.type)}}$l.type="AppsListPM";function iI(e){return new sI(e)}class sI extends $l{get slideApps(){return this.getCachedSingleton(yi.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{const a=n[s];i!==a&&(r=!1)}),r}constructor(t){var n;super(t,$l.type),this.onEntityChange=()=>{if(!this.slideApps)return;const r=this.slideApps.getAllApps(),i=[];r.forEach(s=>{s.assignedToOwner&&i.push(s.id)}),this.doUpdateView(i)},(n=this.slideApps)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}class Sr extends k.AppObjectEntity{static get(t){const n=t.getComponent(Sr.type);return n||t.appObjectRepo.submitWarning("AssetEntity.get","Unable to find AssetEntity on app object "+t.id),n}}Sr.type="AssetEntity";function s4(e){return new aI(e)}class aI extends Sr{get id(){return this.appObject.id}get name(){return this._memoizedName.val}set name(t){this._memoizedName.val=t}get owner(){return this._memoizedOwner.val}set owner(t){this._memoizedOwner.val=t}get description(){return this._memoizedDescription.val}set description(t){this._memoizedDescription.val=t}get archived(){return this._memoizedArchived.val}set archived(t){this._memoizedArchived.val=t}get filename(){return this._memoizedFilename.val}set filename(t){this._memoizedFilename.val=t}get fileURL(){return this._memoizedFileURL.val}set fileURL(t){this._memoizedFileURL.val=t}get file(){return this._file}get blobURL(){return this._blobURL}get fileHasBeenFetched(){return this._file!==void 0}get linkedAssets(){return[...this._linkedAssets]}get isFetchingFile(){return this._memoizedIsFetchingFile.val}set isFetchingFile(t){this._memoizedIsFetchingFile.val=t}get fetchError(){return this._fetchError}set fetchError(t){t===void 0&&this.fetchError===void 0||t!==void 0&&this.fetchError!==void 0&&t.message===this.fetchError.message||(this._fetchError=t,this.notifyOnChange())}constructor(t){super(t,Sr.type),this._memoizedName=new k.MemoizedString("",this.notifyOnChange),this._memoizedOwner=new k.MemoizedString("",this.notifyOnChange),this._memoizedDescription=new k.MemoizedString("",this.notifyOnChange),this._memoizedArchived=new k.MemoizedBoolean(!1,this.notifyOnChange),this._memoizedFileURL=new k.MemoizedString("",this.notifyOnChange),this._memoizedFilename=new k.MemoizedString("",this.notifyOnChange),this._file=void 0,this._blobURL=void 0,this.setFile=n=>{this._file=n,this._blobURL=URL.createObjectURL(n),this.notifyOnChange()},this._linkedAssets=[],this.addLinkedAsset=(n,r)=>{this._linkedAssets.find(s=>s.id===r)===void 0&&(this._linkedAssets.push({id:r,type:n}),this.notifyOnChange())},this.removeLinkedAsset=(n,r)=>{let i=!1;this._linkedAssets.forEach(s=>{s.type===n&&s.id===r&&(i=!0)}),i&&(this._linkedAssets=this._linkedAssets.filter(s=>s.id!==r),this.notifyOnChange())},this.getLinkedAssetByType=n=>{const r=[];return this._linkedAssets.forEach(i=>{i.type===n&&r.push(i.id)}),r},this._memoizedIsFetchingFile=new k.MemoizedBoolean(!1,this.notifyOnChange),this._fetchError=void 0,this.dispose=()=>{this._blobURL!==void 0&&(URL.revokeObjectURL(this._blobURL),this._blobURL=void 0,this.notifyOnChange()),super.dispose()}}}class fm extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(r)return r.getComponent(fm.type)}}fm.type="AppPM";class Fc extends k.AppObjectUC{static get(t){const n=t.getComponent(Fc.type);return n||t.appObjectRepo.submitWarning("UpdateAppUC.get","Unable to find UpdateAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAppUC.getByID","Unable to find App Object by id "+t);return}return Fc.get(r)}}Fc.type="UpdateAppUC";class oI extends k.DomainFactory{constructor(t){super(t),this.factoryName="AppsFeatureFactory"}setupEntities(){nI(this.appObject)}setupUCs(){}setupPMs(){iI(this.appObject)}finalSetup(){}}function lI(e){const t=e.getOrCreate("Apps");return new oI(t)}class En extends k.AppObjectEntity{static get(t){const n=t.getComponent(En.type);return n||t.appObjectRepo.submitWarning("AssetEntity.get","Unable to find HostDispatchEntity on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetEntity.getByID","Unable to find app object "+t);return}return En.get(r)}}En.type="HostDispatchEntity";function a4(e){return new cI(e)}class cI extends En{get appHandlerVersion(){return this._appHandlerVersion}getAppHandlerVersion(){const t="GET_APP_HANDLER_VERSION",n={callback:this.setupVersion};try{this.formRequestAndDispatch(t,1,n)}catch{}}constructor(t){super(t,En.type),this._appHandlerVersion=0,this.appPayloadVersions=new Map,this.registerAppHandler=n=>{this.appHandler=n,this.getAppHandlerVersion()},this.clearAppHandler=()=>{this.appHandler=void 0},this.getRequestPayloadVersion=n=>this.appPayloadVersions.get(n),this.setupVersion=n=>{this._appHandlerVersion=n,this.getPayloadVersions()},this.getPayloadVersions=()=>{const n="GET_APP_PAYLOAD_VERSION",r={callback:this.setupPayloadVersions};this.formRequestAndDispatch(n,2,r)},this.setupPayloadVersions=n=>{this.appPayloadVersions=n},this.dispatch=n=>{if(!this.appHandler){this.error("No app handler has been registered");return}try{this.appHandler(n)}catch(r){this.warn(r.message)}},this.formRequestAndDispatch=(n,r,i)=>{if(!this.appHandler){this.error("No app handler has been registered");return}const s={type:n,version:r,payload:i};this.dispatch(s)}}}class Et extends k.AppObjectEntity{static get(t){return t.getComponent(Et.type)}}Et.type="HostHandlerEntity";function o4(e){return new uI(e)}class uI extends Et{constructor(t){super(t,Et.type),this.handlers=new Map,this.handler=n=>{const r=this.handlers.get(n.type);if(!r){this.warn(`Unsupported request type received: ${n.type}`);return}try{r.handleRequest(n.version,n.payload)}catch(i){this.warn(`${i}`)}},this.registerRequestHandler=n=>{this.handlers.has(n.requestType)&&this.warn(`More than one handler is being registered for ${n.requestType}. Previous handler is being overwritten`),this.handlers.set(n.requestType,n)}}}class Kt extends Error{constructor(t,n){const r=`Version ${n} of request type ${t} is not supported`;super(r)}}class dI extends Error{constructor(t){const n=`Action for request type ${t} is not implemented`;super(n)}}class rn extends Error{constructor(t,n,r){const i=`Unable to parse paylod for version ${n} of request type ${t}: ${r}`;super(i)}}var ps;(function(e){e.PRODUCTION="Production",e.STAGING="Staging",e.DEVELOPMENT="Development",e.LOCAL="LOCAL"})(ps||(ps={}));class bn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(bn.type,t)}get apiStage(){return this.memoizedApiState.val}set apiStage(t){this.memoizedApiState.val=t}get baseUrl(){return this.memoizedApiState.val===ps.PRODUCTION?"https://api.vivedlearning.com":this.memoizedApiState.val===ps.STAGING?"https://api-staging.vivedlearning.com":this.memoizedApiState.val===ps.DEVELOPMENT?"https://api-test.vivedlearning.com":"http://localhost:3001"}get userToken(){return this.memoizedUserToken.val}set userToken(t){this.memoizedUserToken.val=t}constructor(t){super(t,bn.type),this.productionURL="https://api.vivedlearning.com",this.stagingURL="https://api-staging.vivedlearning.com",this.developmentURL="https://api-test.vivedlearning.com",this.localURL="http://localhost:3001",this.memoizedApiState=new k.MemoizedString(ps.PRODUCTION,this.notifyOnChange),this.getEndpointURL=n=>new URL(n,this.baseUrl),this.memoizedUserToken=new k.MemoizedString("",this.notifyOnChange),this.appObjects.registerSingleton(this)}}bn.type="VivedAPIEntity";class Hn extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Hn.type,t)}}Hn.type="JsonRequestUC";class ar extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ar.type,t)}}ar.type="SignedAuthTokenUC";class za extends k.AppObjectUC{static get(t){return k.getSingletonComponent(za.type,t)}}za.type="GetAppFromAPIUC";function pI(e){return new fI(e)}class fI extends za{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,za.type),this.getApp=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!i||!s||!a?Promise.reject():new Promise((o,c)=>{i().then(u=>{const p=s.getEndpointURL(`apps/${n}/${r}`);p.searchParams.set("function_version","2");const h={method:"GET",headers:{Authorization:"Bearer "+u}};return a(p,h)}).then(u=>{const p=u.app,h={interfaceVersion:p.appInterfaceVersion,assetFolderURL:p.baseAssetsUrl,entrypoints:[...p.files]};o(h)}).catch(u=>{c(u)})})},this.appObjects.registerSingleton(this)}}function _p(e,t){const n=t.baseVersionString.split(".").join("_");return`${e.id}-${n}`}class Ar extends k.AppObjectUC{static get(t){return t.getComponent(Ar.type)}static getById(t,n){const r=n.get(t);return r==null?void 0:r.getComponent(Ar.type)}}Ar.type="MounterUC";function hI(e){return new mI(e)}class mI extends Ar{get getAppFromAPI(){return this.getCachedSingleton(za.type)}get app(){return this.getCachedLocalComponent(nr.type)}get hostHandler(){return this.getCachedLocalComponent(Et.type)}get hostDispatcher(){return this.getCachedLocalComponent(En.type)}getAppVersion(t,n){if(!this.app)return;let r=k.Version.GetLatestWithMajorMinor(this.app.versions,t,n);return r||(r=k.Version.GetLatestWithMajor(this.app.versions,t)),r||this.error(`Unable to find version ${t}.${n}.X for App ${this.app.name}`),r}mountLatestVersion(){if(!this.app)return this.error("Missing Components"),Promise.reject();const t=this.app.latestVersion;return t?this.mount(t.major,t.minor):(this.error("No Version"),Promise.reject())}parseEndpoints(t){const n=[],r=[];return t.forEach(i=>{i.includes(".js")?n.push(i):i.includes(".css")?r.push(i):this.warn("Unknown endpoint: "+i)}),{scripts:n,styles:r}}waitForAppIsReady(t,n){return t.id==="app4e48fbaa815a4857821bf7569b003751"&&n.major===1&&n.minor===0||t.id==="appe860b51f49414e20ae7995dff4d9b152"&&n.major===1&&n.minor<=2||t.id==="app41df8a36f628451d9f633f8a9bdf3edb"&&n.major===1&&n.minor<=1||t.id==="app448f8f293fbb493a9e233f113ce8b56a"||t.id==="APP_FOR_JEST_TEST"?(t.state=Dn.READY,Promise.resolve()):new Promise(r=>{const i=()=>{t.state===Dn.READY&&(t.removeChangeObserver(i),r())};t.addChangeObserver(i),i()})}constructor(t){super(t,Ar.type),this.scriptElements=[],this.unmount=()=>{if(!this.app||!this.app.mountedVersion)return;const n=_p(this.app,this.app.mountedVersion);window[n]=void 0,delete window[n],this.scriptElements.forEach(r=>{r.remove()}),this.scriptElements=[],this.app.styles=[],this.app.appAssetFolderURL=void 0,this.app.mountedVersion=void 0,this.app.state=Dn.INIT},this.mount=(n,r)=>{const i=this.getAppFromAPI;if(!i)return this.error("No Fetch App UC"),Promise.reject();const s=this.app;if(!s)return this.error("No App"),Promise.reject();const a=this.hostHandler;if(!a)return this.error("No Host Handler"),Promise.reject();const o=this.hostDispatcher;if(!o)return this.error("No Host Dispatcher"),Promise.reject();const c=this.getAppVersion(n,r);if(!c)return Promise.reject(new Error(`Unable to find version ${n}.${r}.X for App ${s.name}`));if(this.log(`Initializing App ${s.name} [${s.id}] version ${c.displayString}`),s.mountedVersion){if(k.Version.AreEqual(s.mountedVersion,c))return Promise.resolve();this.unmount()}return s.state=Dn.LOADING,new Promise((u,p)=>{i.getApp(this.appObject.id,c.baseVersionString).then(h=>{s.appAssetFolderURL=h.assetFolderURL;const{scripts:y,styles:l}=this.parseEndpoints(h.entrypoints);return s.styles=l,this.loadScripts(y,c)}).then(h=>{const y=h.mount(a.handler);return o.registerAppHandler(y),this.waitForAppIsReady(s,c)}).then(()=>{s.mountedVersion=c,u()}).catch(h=>{s.state=Dn.ERROR,p(h)})})},this.loadScripts=(n,r)=>{const i=this.app;if(!i)return this.error("No app entity"),Promise.reject();let s=this.getAppInterface(r);const a=_p(i,r);return s?Promise.resolve(s):new Promise((o,c)=>{const u=n.map(p=>this.loadScriptIntoDocument(p,a));Promise.all(u).then(()=>{s=this.getAppInterface(r),s?o(s):c("App is undefined for ID: "+i.id+". Make sure ID is correct in the 3 files in the app project.")}).catch(p=>{c(p)})})},this.loadScriptIntoDocument=(n,r)=>new Promise((i,s)=>{const a=document.createElement("script");a.onload=function(){i()},a.onerror=function(c){s(new Error("Failed to add script to document"))},a.type="text/javascript",a.src=n,a.className=r,this.scriptElements.push(a),document.head.appendChild(a)}),this.getAppInterface=n=>{if(!this.app)return;const r=_p(this.app,n);let i=window[r];return i||(i=window[this.app.id]),i}}}var Ht;(function(e){e.UNMOUNTED="UNMOUNTED",e.LOADING="LOADING",e.MOUNTED="MOUNTED",e.PLAYING="PLAYING",e.FATAL_ERROR="FATAL_ERROR",e.EDIT_ASSET="EDIT_ASSET",e.NEW_APP_ASSET="NEW_APP_ASSET"})(Ht||(Ht={}));class qe extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qe.type,t)}}qe.type="AppSandboxEntity";function gI(e){return new EI(e)}class EI extends qe{get appID(){return this.appObject.id}get startInZSpace(){return this.memoizedStartInZSpace.val}set startInZSpace(t){this.memoizedStartInZSpace.val=t}get appContainer(){return this._playerContainer}set appContainer(t){t!==this._playerContainer&&(this._playerContainer=t,this.notifyOnChange())}get showBabylonInspector(){return this.memoizedShowInspector.val}set showBabylonInspector(t){this.memoizedShowInspector.val=t}get babylonInspectorSupported(){return this.memoizedBabylonInspectorSupported.val}set babylonInspectorSupported(t){this.memoizedBabylonInspectorSupported.val=t}get enableDevFeatures(){return this.memoisedEnableDevFeatures.val}set enableDevFeatures(t){this.memoisedEnableDevFeatures.val=t}get isDevMode(){return this.memoizedIsDevMode.val}set isDevMode(t){this.memoizedIsDevMode.val=t}get state(){return this._state}set state(t){this._state!==t&&(this._state=t,this.notifyOnChange())}constructor(t){super(t,qe.type),this.mockActivityID="93701ef1-ee94-4765-b27f-e1ddbee7c989",this.channelID="93701ef1-ee94-4765-b27f-e1ddbee7c989",this.channelName="Development Channel",this.memoizedStartInZSpace=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedShowInspector=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedBabylonInspectorSupported=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoisedEnableDevFeatures=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoizedIsDevMode=new k.MemoizedBoolean(!0,this.notifyOnChange),this.devFeatures=[],this._state=Ht.UNMOUNTED,this.app=pu(t),this.appObjects.registerSingleton(this)}}function bI(e){return new TI(e)}class TI extends Ar{get appEntity(){return this.getCachedLocalComponent(nr.type)}get hostDispatcher(){return this.getCachedLocalComponent(En.type)}get hostHandler(){return this.getCachedLocalComponent(Et.type)}get sandbox(){return this.getCachedSingleton(qe.type)}getAppVersion(t,n){if(!this.appEntity)return;let r=k.Version.GetLatestWithMajorMinor(this.appEntity.versions,t,n);return r||(r=k.Version.GetLatestWithMajor(this.appEntity.versions,t)),r||this.error(`Unable to find version ${t}.${n}.X for App ${this.appEntity.name}`),r}loadScriptIntoDocument(t,n){return Promise.resolve()}getAppInterface(t){const n=t.baseVersionString.split(".").join("_"),r=`${this.appObject.id}-${n}`,i=window[r];if(!i){this.appObjects.submitFatal("LocalMounterUC","Unable to find App Interface");return}return i}constructor(t){super(t,Ar.type),this.mountLatestVersion=()=>{if(!this.appEntity)return this.error("Missing Components"),Promise.reject();const n=this.appEntity.latestVersion;return n?this.mount(n.major,n.minor):(this.error("No Version"),Promise.reject())},this.mount=(n,r)=>{if(!this.appEntity||!this.hostDispatcher||!this.hostHandler||!this.sandbox)return this.error("Missing Components"),Promise.reject();const i=this.getAppVersion(n,r);if(!i)return this.error("No Version"),Promise.reject();const s=this.getAppInterface(i);if(!s)return this.error("No App Interface"),Promise.reject();const a=s.mount(this.hostHandler.handler);this.hostDispatcher.registerAppHandler(a);const o=this.appEntity,c=this.sandbox;return new Promise(u=>{const p=()=>{o.state===Dn.READY&&(c.state=Ht.MOUNTED,o.removeChangeObserver(p),u())};o.addChangeObserver(p),p()})},this.unmount=()=>{if(!this.sandbox||!this.hostDispatcher){this.error("Missing Components");return}this.hostDispatcher.clearAppHandler(),this.sandbox.state=Ht.UNMOUNTED}}}class ms extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ENABLE_FEATURE"}static get(t){const n=t.getComponent(ms.type);return n||t.appObjectRepo.submitWarning("DispatchEnableFeatureUC.get","Unable to find DispatchEnableFeatureUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchEnableFeatureUC.getByID","Unable to find App Object by id "+t);return}return ms.get(r)}}ms.type="DispatchEnableFeatureUC";function yI(e){return new SI(e)}class SI extends ms{get dispatcher(){return this.getCachedLocalComponent(En.type)}doDispatch(t){if(!this.dispatcher)return;const n={featureFlag:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,ms.type),this.requestVersion=1,this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Xr extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_IS_AUTHORING"}static get(t){const n=t.getComponent(Xr.type);return n||t.appObjectRepo.submitWarning("DispatchIsAuthoringUC.get","Unable to find DispatchIsAuthoringUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchIsAuthoringUC.getByID","Unable to find App Object by id "+t);return}return Xr.get(r)}}Xr.type="DispatchIsAuthoringUC";function AI(e){return new CI(e)}class CI extends Xr{doDispatch(t){if(!this.dispatcher)return;const n={isAuthoring:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Xr.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Zr extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_APP_STATE"}static get(t){const n=t.getComponent(Zr.type);return n||t.appObjectRepo.submitWarning("DispatchSetStateUC.get","Unable to find DispatchSetStateUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchSetStateUC.getByID","Unable to find App Object by id "+t);return}return Zr.get(r)}}Zr.type="DispatchSetStateUC";function _I(e){return new II(e)}class II extends Zr{get dispatcher(){return this.getCachedLocalComponent(En.type)}doDispatch(t){if(!this.dispatcher)return;const{finalState:n,duration:r,hasNextSlide:i,hasPreviousSlide:s,hideNavigation:a}=t,o=this.dispatcher.getRequestPayloadVersion(this.requestType);if(!o||o<=2){this.dispatchV2(n,r);return}const c={finalState:n,duration:r,hasNextSlide:i,hasPreviousSlide:s,hideNavigation:a};this.dispatcher.formRequestAndDispatch(this.requestType,3,c)}dispatchV2(t,n){var s;const i={finalState:t?JSON.stringify(t):"",duration:n};(s=this.dispatcher)==null||s.formRequestAndDispatch(this.requestType,2,i)}constructor(t){super(t,Zr.type)}}class gs extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_APP"}static get(t){const n=t.getComponent(gs.type);return n||t.appObjectRepo.submitWarning("DispatchStartAppUC.get","Unable to find DispatchStartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartAppUC.getByID","Unable to find App Object by id "+t);return}return gs.get(r)}}gs.type="DispatchStartAppUC";function NI(e){return new RI(e)}class RI extends gs{doDispatch(t){if(!this.dispatcher)return;const n={container:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,gs.type),this.requestVersion=2,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}var uT;(function(e){e.primary="primary",e.onPrimary="onPrimary",e.primaryContainer="primaryContainer",e.onPrimaryContainer="onPrimaryContainer",e.primaryFixed="primaryFixed",e.onPrimaryFixed="onPrimaryFixed",e.primaryFixedDim="primaryFixedDim",e.onPrimaryFixedVariant="onPrimaryFixedVariant",e.secondary="secondary",e.onSecondary="onSecondary",e.secondaryContainer="secondaryContainer",e.onSecondaryContainer="onSecondaryContainer",e.secondaryFixed="secondaryFixed",e.onSecondaryFixed="onSecondaryFixed",e.secondaryFixedDim="secondaryFixedDim",e.onSecondaryFixedVariant="onSecondaryFixedVariant",e.tertiary="tertiary",e.onTertiary="onTertiary",e.tertiaryContainer="tertiaryContainer",e.onTertiaryContainer="onTertiaryContainer",e.tertiaryFixed="tertiaryFixed",e.onTertiaryFixed="onTertiaryFixed",e.tertiaryFixedDim="tertiaryFixedDim",e.onTertiaryFixedVariant="onTertiaryFixedVariant",e.error="error",e.onError="onError",e.errorContainer="errorContainer",e.onErrorContainer="onErrorContainer",e.outline="outline",e.background="background",e.onBackground="onBackground",e.surface="surface",e.onSurface="onSurface",e.surfaceVariant="surfaceVariant",e.onSurfaceVariant="onSurfaceVariant",e.inverseSurface="inverseSurface",e.inverseOnSurface="inverseOnSurface",e.inversePrimary="inversePrimary",e.shadow="shadow",e.surfaceTint="surfaceTint",e.outlineVariant="outlineVariant",e.scrim="scrim",e.surfaceContainerHighest="surfaceContainerHighest",e.surfaceContainerHigh="surfaceContainerHigh",e.surfaceContainer="surfaceContainer",e.surfaceContainerLow="surfaceContainerLow",e.surfaceContainerLowest="surfaceContainerLowest",e.surfaceBright="surfaceBright",e.surfaceDim="surfaceDim"})(uT||(uT={}));class Hi extends k.AppObjectEntity{}Hi.type="HostThemeEntity";Hi.get=e=>k.getSingletonComponent(Hi.type,e);function vI(e){return new xI(e)}class xI extends Hi{get activeScheme(){return this.schemeLookup.get(this.activeSchemeName)??OI}getHexForType(t){const n=this.schemeLookup.get(this.activeSchemeName);return n?n[t]:(this.error("No active scheme"),"#000000")}get activeSchemeName(){return this.memoizedActiveScheme.val}set activeSchemeName(t){if(!this.schemeLookup.has(t)){this.warn(`Unknown theme schema: ${t}. Ignoring.`);return}this.memoizedActiveScheme.val=t}constructor(t){super(t,Hi.type),this.schemeLookup=new Map,this.submitScheme=(n,r)=>{this.schemeLookup.has(n)&&this.warn("Duplicate scheme name submitted. Overwriting"),this.schemeLookup.set(n,r),this.activeSchemeName||(this.activeSchemeName=n)},this.memoizedActiveScheme=new k.MemoizedString("",this.notifyOnChange),this.getColorForType=n=>{const r=this.schemeLookup.get(this.activeSchemeName);if(!r)return this.error("No active scheme"),k.Color.RGB(0,0,0);const i=r[n];return k.Color.Hex(i)},this.appObjects.registerSingleton(this)}}const OI={primary:"#7BD0FF",onPrimary:"#003549",primaryContainer:"#004C69",onPrimaryContainer:"#C4E7FF",primaryFixed:"#C4E7FF",onPrimaryFixed:"#001E2C",primaryFixedDim:"#7BD0FF",onPrimaryFixedVariant:"#004C69",secondary:"#B5C9D7",onSecondary:"#20333E",secondaryContainer:"#374955",onSecondaryContainer:"#D1E5F4",secondaryFixed:"#D1E5F4",onSecondaryFixed:"#0A1E28",secondaryFixedDim:"#B5C9D7",onSecondaryFixedVariant:"#374955",tertiary:"#CAC1E9",onTertiary:"#322C4C",tertiaryContainer:"#484264",onTertiaryContainer:"#E6DEFF",tertiaryFixed:"#E6DEFF",onTertiaryFixed:"#1D1736",tertiaryFixedDim:"#CAC1E9",onTertiaryFixedVariant:"#484264",error:"#FFB4AB",onError:"#690005",errorContainer:"#93000A",onErrorContainer:"#FFDAD6",outline:"#8B9297",background:"#191C1E",onBackground:"#E1E2E5",surface:"#111416",onSurface:"#C5C6C9",surfaceVariant:"#41484D",onSurfaceVariant:"#C0C7CD",inverseSurface:"#E1E2E5",inverseOnSurface:"#191C1E",inversePrimary:"#00668A",shadow:"#000000",surfaceTint:"#7BD0FF",outlineVariant:"#41484D",scrim:"#000000",surfaceContainerHighest:"#333537",surfaceContainerHigh:"#282A2C",surfaceContainer:"#1D2022",surfaceContainerLow:"#191C1E",surfaceContainerLowest:"#0C0F10",surfaceBright:"#37393C",surfaceDim:"#111416"};class Gl extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Gl.type,t)}}Gl.type="ThemeColorsPM";function wI(e){return new DI(e)}class DI extends Gl{vmsAreEqual(t,n){return t.themeName===n.themeName}constructor(t){if(super(t,Gl.type),this.onThemeChange=()=>{this.themeColors&&this.doUpdateView({themeName:this.themeColors.activeSchemeName,scheme:this.themeColors.activeScheme})},this.appObjects.registerSingleton(this),this.themeColors=Hi.get(t.appObjectRepo),this.themeColors)this.themeColors.addChangeObserver(this.onThemeChange),this.onThemeChange();else{this.error("Unable to find HostThemeEntity");return}}}class Va extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Va.type,t)}}Va.type="SetThemeUC";function kI(e){return new LI(e)}class LI extends Va{get theme(){return this.getCachedSingleton(Hi.type)}setThemeByName(t){this.theme&&(this.theme.activeSchemeName=t)}tryDetectTheme(){if(!this.theme||!window.matchMedia)return;window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme.activeSchemeName=this.darkThemeName:this.theme.activeSchemeName=this.darkThemeName}constructor(t){super(t,Va.type),this.lightThemeName="light",this.darkThemeName="dark",this.appObjects.registerSingleton(this)}}function MI(e,t){const n=Va.get(e);n?n.setThemeByName(t):e.submitError("setThemeByName","Unable to find SetThemeUC")}const PI="#7BD0FF",FI="#003549",UI="#004C69",BI="#C4E7FF",HI="#C4E7FF",$I="#001E2C",GI="#7BD0FF",jI="#004C69",zI="#B5C9D7",VI="#20333E",WI="#374955",qI="#D1E5F4",KI="#D1E5F4",YI="#0A1E28",XI="#B5C9D7",ZI="#374955",QI="#CAC1E9",JI="#322C4C",eN="#484264",tN="#E6DEFF",nN="#E6DEFF",rN="#1D1736",iN="#CAC1E9",sN="#484264",aN="#FFB4AB",oN="#690005",lN="#93000A",cN="#FFDAD6",uN="#8B9297",dN="#191C1E",pN="#E1E2E5",fN="#111416",hN="#C5C6C9",mN="#41484D",gN="#C0C7CD",EN="#E1E2E5",bN="#191C1E",TN="#00668A",yN="#000000",SN="#7BD0FF",AN="#41484D",CN="#000000",_N="#333537",IN="#282A2C",NN="#1D2022",RN="#191C1E",vN="#0C0F10",xN="#37393C",ON="#111416",wN={primary:PI,onPrimary:FI,primaryContainer:UI,onPrimaryContainer:BI,primaryFixed:HI,onPrimaryFixed:$I,primaryFixedDim:GI,onPrimaryFixedVariant:jI,secondary:zI,onSecondary:VI,secondaryContainer:WI,onSecondaryContainer:qI,secondaryFixed:KI,onSecondaryFixed:YI,secondaryFixedDim:XI,onSecondaryFixedVariant:ZI,tertiary:QI,onTertiary:JI,tertiaryContainer:eN,onTertiaryContainer:tN,tertiaryFixed:nN,onTertiaryFixed:rN,tertiaryFixedDim:iN,onTertiaryFixedVariant:sN,error:aN,onError:oN,errorContainer:lN,onErrorContainer:cN,outline:uN,background:dN,onBackground:pN,surface:fN,onSurface:hN,surfaceVariant:mN,onSurfaceVariant:gN,inverseSurface:EN,inverseOnSurface:bN,inversePrimary:TN,shadow:yN,surfaceTint:SN,outlineVariant:AN,scrim:CN,surfaceContainerHighest:_N,surfaceContainerHigh:IN,surfaceContainer:NN,surfaceContainerLow:RN,surfaceContainerLowest:vN,surfaceBright:xN,surfaceDim:ON},DN="#00668A",kN="#FFFFFF",LN="#C4E7FF",MN="#001E2C",PN="#C4E7FF",FN="#001E2C",UN="#7BD0FF",BN="#004C69",HN="#4E616D",$N="#FFFFFF",GN="#D1E5F4",jN="#0A1E28",zN="#D1E5F4",VN="#0A1E28",WN="#B5C9D7",qN="#374955",KN="#605A7D",YN="#FFFFFF",XN="#E6DEFF",ZN="#1D1736",QN="#E6DEFF",JN="#1D1736",e6="#CAC1E9",t6="#484264",n6="#BA1A1A",r6="#FFFFFF",i6="#FFDAD6",s6="#410002",a6="#71787D",o6="#FBFCFF",l6="#191C1E",c6="#F8F9FC",u6="#191C1E",d6="#DCE3E9",p6="#41484D",f6="#2E3133",h6="#F0F1F3",m6="#7BD0FF",g6="#000000",E6="#00668A",b6="#C0C7CD",T6="#000000",y6="#E1E2E5",S6="#E7E8EA",A6="#EDEEF0",C6="#F3F3F6",_6="#FFFFFF",I6="#F8F9FC",N6="#D9DADC",R6={primary:DN,onPrimary:kN,primaryContainer:LN,onPrimaryContainer:MN,primaryFixed:PN,onPrimaryFixed:FN,primaryFixedDim:UN,onPrimaryFixedVariant:BN,secondary:HN,onSecondary:$N,secondaryContainer:GN,onSecondaryContainer:jN,secondaryFixed:zN,onSecondaryFixed:VN,secondaryFixedDim:WN,onSecondaryFixedVariant:qN,tertiary:KN,onTertiary:YN,tertiaryContainer:XN,onTertiaryContainer:ZN,tertiaryFixed:QN,onTertiaryFixed:JN,tertiaryFixedDim:e6,onTertiaryFixedVariant:t6,error:n6,onError:r6,errorContainer:i6,onErrorContainer:s6,outline:a6,background:o6,onBackground:l6,surface:c6,onSurface:u6,surfaceVariant:d6,onSurfaceVariant:p6,inverseSurface:f6,inverseOnSurface:h6,inversePrimary:m6,shadow:g6,surfaceTint:E6,outlineVariant:b6,scrim:T6,surfaceContainerHighest:y6,surfaceContainerHigh:S6,surfaceContainer:A6,surfaceContainerLow:C6,surfaceContainerLowest:_6,surfaceBright:I6,surfaceDim:N6};class v6 extends k.DomainFactory{constructor(t){super(t),this.factoryName="ThemeFactory",this.theme=null,this.setThemeUC=null}setupEntities(){this.theme=vI(this.appObject)}setupUCs(){this.setThemeUC=kI(this.appObject)}setupPMs(){wI(this.appObject)}finalSetup(){if(!this.theme||!this.setThemeUC)throw new Error("Theme or SetThemeUC not initialized");this.theme.submitScheme("light",R6),this.theme.submitScheme("dark",wN),this.setThemeUC.setThemeByName("light")}}function x6(e){const t=e.getOrCreate("Theme");return new v6(t)}class Es extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_THEME_COLORS"}static get(t){const n=t.getComponent(Es.type);return n||t.appObjectRepo.submitWarning("DispatchThemeUC.get","Unable to find DispatchThemeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchThemeUC.getByID","Unable to find App Object by id "+t);return}return Es.get(r)}}Es.type="DispatchThemeUC";function O6(e){return new w6(e)}class w6 extends Es{get theme(){return this.getCachedSingleton(Hi.type)}doDispatch(){if(!this.dispatcher||!this.theme)return;const n={colors:{...this.theme.activeScheme}};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Es.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}var In;(function(e){e.NONE="NONE",e.SCORE="SCORE",e.HIT="HIT",e.MULTIHIT="MULTIHIT",e.PROGRESS="PROGRESS",e.QUALITY="QUALITY"})(In||(In={}));var Uc;(function(e){e.INIT="INIT",e.LOADING="LOADING",e.READY="READY",e.ERROR="ERROR"})(Uc||(Uc={}));class Wa extends k.AppObjectEntity{static get(t,n){const r=n.get(t);return r==null?void 0:r.getComponent(Wa.type)}}Wa.type="HostStateEntity";function l4(e){return new D6(e)}class D6 extends Wa{get id(){return this.appObject.id}get name(){return this.memoizedName.val}set name(t){this.memoizedName.val=t}get stateData(){return this._data}setStateData(t,n){let r=!0;if(n){const i=JSON.stringify(this._data),s=JSON.stringify(t);i===s&&(r=!1)}this._data=t,r&&this.notifyOnChange()}get assets(){return[...this._assets]}set assets(t){if(t.length!==this._assets.length){this._assets=t,this.notifyOnChange();return}let n=!1;t.forEach((r,i)=>{this._assets[i]!==r&&(n=!0)}),n&&(this._assets=t,this.notifyOnChange())}get expectedResponse(){return this._expectedResponse}set expectedResponse(t){t!==this._expectedResponse&&(this._expectedResponse=t,this.notifyOnChange())}getDTO(){return{id:this.id,assets:[...this._assets],data:this._data,name:this.memoizedName.val,response:this._expectedResponse,appID:this.appID}}setDTO(t){if(t.id!==this.id){this.warn("DTO id does not match my ID. Skipping");return}this.setStateData(t.data,!0),this.assets=[...t.assets],this.memoizedName.val=t.name,this.memoisedAppID.val=t.appID,Object.values(In).includes(t.response)?this.expectedResponse=t.response:this.expectedResponse=void 0}get appID(){return this.memoisedAppID.val}set appID(t){this.memoisedAppID.val=t}get streamState(){return this.memoizedStreamState.val}set streamState(t){this.memoizedStreamState.val=t}constructor(t){super(t,Wa.type),this.memoizedName=new k.MemoizedString("",this.notifyOnChange),this._data={},this._assets=[],this.memoisedAppID=new k.MemoizedString("",this.notifyOnChange),this.memoizedStreamState=new k.MemoizedString(Uc.INIT,this.notifyOnChange)}}class bt extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(bt.type,t)}}bt.type="HostStateMachine";function k6(e){return new L6(e)}class L6 extends bt{get states(){return this._states.map(t=>t.id)}get stateCount(){return this._states.length}get activeState(){return this._activeState}get previousState(){if(!this._activeState)return;const t=this.getStateIndex(this._activeState);if(!(t===void 0||t===0))return this._states[t-1].id}get nextState(){if(!this._activeState)return;const t=this.getStateIndex(this._activeState);if(!(t===void 0||t>=this._states.length-1))return this._states[t+1].id}get isAuthoring(){return this.memoizedIsAuthoring.val}set isAuthoring(t){this.memoizedIsAuthoring.val=t}get lastEditingState(){return this._lastEditingState}set lastEditingState(t){if(this._lastEditingState===void 0&&t===void 0)return;const n=this.lastEditingState===void 0?"":JSON.stringify(this.lastEditingState),r=t===void 0?"":JSON.stringify(t);n!==r&&(this._lastEditingState=t,this.notifyOnChange())}get lastAssets(){return this._lastAssets}set lastAssets(t){this._lastAssets=t}findStateByID(t){for(const n of this._states)if(n.id===t)return n}constructor(t){super(t,bt.type),this._states=[],this.transitionDuration=1,this.memoizedIsAuthoring=new k.MemoizedBoolean(!1,this.notifyOnChange),this._lastAssets=[],this.hasState=n=>!!this.findStateByID(n),this.setActiveStateByID=n=>{const r=this.findStateByID(n);r&&r.id!==this._activeState&&(this._activeState=r.id,this.notifyOnChange())},this.setActiveStateByIndex=n=>{if(n<0||n>=this._states.length)return;const r=this._states[n];this.setActiveStateByID(r.id)},this.clearActiveState=()=>{this.activeState&&(this._activeState=void 0,this.notifyOnChange())},this.setStates=n=>{this._states=n,this.notifyOnChange()},this.stateFactory=n=>{const r=this.appObjects.getOrCreate(n);return l4(r)},this.createNewState=()=>{const n=this.stateFactory(k.generateUniqueID());return this._states.push(n),this.notifyOnChange(),n},this.getStateByID=n=>this.findStateByID(n),this.deleteState=n=>{const r=this.getStateIndex(n);if(r===void 0)return;const i=this.getStateByID(n);i==null||i.appObject.dispose(),this._states.splice(r,1),this.notifyOnChange()},this.deleteAllStates=()=>{this._states.length!==0&&(this._states.forEach(n=>{n.appObject.dispose()}),this._states=[],this.clearActiveState(),this.notifyOnChange())},this.getStateIndex=n=>{let r=-1;if(this._states.forEach((i,s)=>{i.id===n&&(r=s)}),r>=0)return r},this.setPreviousStateActive=()=>{this.previousState&&this.setActiveStateByID(this.previousState)},this.setNextStateActive=()=>{this.nextState&&this.setActiveStateByID(this.nextState)},this.setStateIndex=(n,r)=>{if(!this.getStateByID(n)||r<0||r>=this._states.length)return;const s=this.getStateIndex(n);if(s===void 0||s===r)return;const a=this._states.splice(s,1)[0];this._states.splice(r,0,a),n===this._activeState&&this.setActiveStateByID(n),this.notifyOnChange()},this.appObjects.registerSingleton(this)}}class Wn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Wn.type,t)}}Wn.type="HostEditingStateEntity";function M6(e){return new P6(e)}class P6 extends Wn{get editingState(){return this._editingState}get isEditing(){return this._editingState!==void 0}get isNewState(){return this._isNewState}get stateValidationMessage(){return this._stateValidationMessage}set stateValidationMessage(t){this._stateValidationMessage!==t&&(this._stateValidationMessage=t,this.notifyOnChange())}get hostStateMachine(){return this.getCachedSingleton(bt.type)}get somethingHasChanged(){return this.memoizedSomethingHasChanged.val}constructor(t){super(t,Wn.type),this._isNewState=!1,this.memoizedSomethingHasChanged=new k.MemoizedBoolean(!1,this.notifyOnChange),this.checkForChange=()=>{var s;if(!this._editingState)return!1;if(!this.originalStateData||this._editingState.name!==this.originalStateData.name||this._editingState.expectedResponse!==this.originalStateData.response||this._editingState.assets.length!==this.originalStateData.assets.length)return!0;let n=!1;if(this._editingState.assets.forEach((a,o)=>{this.originalStateData.assets[o]!==a&&(n=!0)}),n)return!0;const r=JSON.stringify(this._editingState.stateData),i=JSON.stringify(((s=this.originalStateData)==null?void 0:s.data)??"");return r!==i},this.onStateEntityChange=()=>{this.memoizedSomethingHasChanged.val=this.checkForChange()},this.startNewState=()=>{if(this.hostStateMachine)return this.originalStateData=void 0,this._isNewState=!0,this._editingState=this.hostStateMachine.createNewState(),this._editingState.addChangeObserver(this.onStateEntityChange),this.memoizedSomethingHasChanged.val=!0,this._editingState},this.startEditing=n=>{this._editingState=n,this.originalStateData=n.getDTO(),this._editingState.addChangeObserver(this.onStateEntityChange),this.notifyOnChange()},this.cancelEditState=()=>{var n;this._editingState&&(this.originalStateData?this._editingState.setDTO(this.originalStateData):(n=this.hostStateMachine)==null||n.deleteState(this._editingState.id),this.resetInternalState())},this.finishEditing=()=>{this.resetInternalState()},this.resetInternalState=()=>{this._editingState&&(this._isNewState=!1,this._editingState.removeChangeObserver(this.onStateEntityChange),this._stateValidationMessage=void 0,this._editingState=void 0,this.memoizedSomethingHasChanged.val=!1,this.notifyOnChange())},this.appObjects.registerSingleton(this)}}class Pi extends k.AppObjectUC{static get(t){const n=t.getComponent(Pi.type);return n||t.appObjectRepo.submitWarning("StartAppUC.get","Unable to find StartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("StartAppUC.getByID","Unable to find App Object by id "+t);return}return Pi.get(r)}static startByID(t,n,r){var i;(i=Pi.getByID(n,r))==null||i.start(t)}}Pi.type="StartAppUC";function F6(e){return new U6(e)}let U6=class extends Pi{get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}get dispatchStart(){return this.getCachedLocalComponent(gs.type)}get dispatchSetState(){return this.getCachedLocalComponent(Zr.type)}get dispatchSetIsAuthoring(){return this.getCachedLocalComponent(Xr.type)}get dispatchThemeColors(){return this.getCachedLocalComponent(Es.type)}get dispatchEnableFeature(){return this.getCachedLocalComponent(ms.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,Pi.type),this.start=n=>{var u,p,h,y;if(!this.stateMachine||!this.dispatchStart||!this.editStateEntity||!this.sandbox)return;this.dispatchStart.doDispatch(n);let r;this.stateMachine.activeState&&(r=(u=this.stateMachine.getStateByID(this.stateMachine.activeState))==null?void 0:u.stateData);const i=this.stateMachine.states.length<=1,s=this.stateMachine.nextState!==void 0,a=this.stateMachine.previousState!==void 0,o={finalState:r,hideNavigation:i,hasNextSlide:s,hasPreviousSlide:a};(p=this.dispatchSetState)==null||p.doDispatch(o);let c=this.editStateEntity.isEditing;this.stateMachine.activeState===void 0&&(c=!0),(h=this.dispatchSetIsAuthoring)==null||h.doDispatch(c),(y=this.dispatchThemeColors)==null||y.doDispatch(),this.sandbox.enableDevFeatures&&this.sandbox.devFeatures.forEach(l=>{var E;(E=this.dispatchEnableFeature)==null||E.doDispatch(l)})}}};class Si extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_APP"}static get(t){const n=t.getComponent(Si.type);return n||t.appObjectRepo.submitWarning("DispatchStopAppUC.get","Unable to find DispatchStopAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStopAppUC.getByID","Unable to find App Object by id "+t);return}return Si.get(r)}}Si.type="DispatchStopAppUC";function c4(e){return new B6(e)}class B6 extends Si{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Si.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Fi extends k.AppObjectUC{static get(t){const n=t.getComponent(Fi.type);return n||t.appObjectRepo.submitWarning("StopAppUC.get","Unable to find StartAppUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("StopAppUC.getByID","Unable to find App Object by id "+t);return}return Fi.get(r)}static stopByID(t,n){var r;(r=Fi.getByID(t,n))==null||r.stop()}}Fi.type="StopAppUC";function H6(e){return new $6(e)}class $6 extends Fi{get dispatchStop(){return this.getCachedLocalComponent(Si.type)}stop(){var t;(t=this.dispatchStop)==null||t.doDispatch()}constructor(t){super(t,Fi.type)}}class jl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(jl.type,t)}}jl.type="BabylonInspectorSupportedPM";function G6(e){return new j6(e)}class j6 extends jl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,jl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.babylonInspectorSupported)},this.sandbox&&this.observeEntity(this.sandbox)}}class zl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(zl.type,t)}}zl.type="DevFeaturesEnabledPM";function z6(e){return new V6(e)}class V6 extends zl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,zl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.enableDevFeatures)},this.sandbox&&this.observeEntity(this.sandbox)}}class bs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(bs.type,t)}}bs.type="DevModePM";function W6(e){return new q6(e)}class q6 extends bs{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,bs.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.isDevMode)},this.sandbox&&this.observeEntity(this.sandbox)}}const K6={defaultVM:!0,subscribe:(e,t)=>{const n=bs.get(e);if(!n){e.submitError("devModeAdapter","Unable to find DevModePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=bs.get(e);if(!n){e.submitError("devModeAdapter","Unable to find DevModePM");return}n.removeView(t)}};class Ts extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Ts.type,t)}}Ts.type="SandboxStatePM";function Y6(e){return new X6(e)}class X6 extends Ts{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){var n;super(t,Ts.type),this.onEntityChange=()=>{this.sandbox&&this.doUpdateView(this.sandbox.state)},this.appObjects.registerSingleton(this),(n=this.sandbox)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange()}}const Z6={defaultVM:Ht.UNMOUNTED,subscribe:(e,t)=>{const n=Ts.get(e);if(!n){e.submitError("renderAppAdapter","Unable to find SandboxStatePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Ts.get(e);if(!n){e.submitError("renderAppAdapter","Unable to find SandboxStatePM");return}n.removeView(t)}};class Vl extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Vl.type,t)}}Vl.type="ShowInspectorPM";function Q6(e){return new J6(e)}class J6 extends Vl{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Vl.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.showBabylonInspector)},this.sandbox&&this.observeEntity(this.sandbox)}}class ys extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(ys.type,t)}}ys.type="StartInZSpacePM";function eR(e){return new tR(e)}class tR extends ys{get sandbox(){return this.getCachedSingleton(qe.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,ys.type),this.defaultVM=!1,this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.startInZSpace)},this.sandbox&&this.observeEntity(this.sandbox)}}const u4={defaultVM:!1,subscribe:(e,t)=>{const n=ys.get(e);if(!n){e.submitError("startInZSpaceAdapter","Unable to find StartInZSpacePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ys.get(e);if(!n){e.submitError("startInZSpaceAdapter","Unable to find StartInZSpacePM");return}n.removeView(t)}};function d4(e){const t=qe.get(e);if(!t){e.submitWarning("mountSandboxApp","Could not find AppSandboxEntity");return}const n=Ar.getById(t.appID,e);if(!n){e.submitWarning("mountSandboxApp","Could not find MounterUC");return}n.mountLatestVersion()}class Ss extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="DISPOSE_APP"}static get(t){const n=t.getComponent(Ss.type);return n||t.appObjectRepo.submitWarning("DispatchAppDispatcherUC.get","Unable to find DispatchAppDispatcherUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchDisposeAppUC.getByID","Unable to find App Object by id "+t);return}return Ss.get(r)}}Ss.type="DispatchDisposeAppUC";function p4(e){return new nR(e)}class nR extends Ss{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Ss.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class As extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SET_DEV_MODE"}static get(t){const n=t.getComponent(As.type);return n||t.appObjectRepo.submitWarning("DispatchSetDevModeUC.get","Unable to find DispatchSetDevModeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchSetDevModeUC.getByID","Unable to find App Object by id "+t);return}return As.get(r)}}As.type="DispatchSetDevModeUC";function rR(e){return new iR(e)}class iR extends As{doDispatch(t){if(!this.dispatcher)return;const n={isDevMode:t};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,As.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Wl extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_BABYLON_INSPECTOR"}static get(t){const n=t.getComponent(Wl.type);return n||t.appObjectRepo.submitWarning("DispatchShowBabylonInspectorUC.get","Unable to find DispatchShowBabylonInspectorUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchShowBabylonInspectorUC.getByID","Unable to find App Object by id "+t);return}return Wl.get(r)}}Wl.type="DispatchShowBabylonInspectorUC";class Cs extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_SELECT_CHANNEL_MODEL"}static get(t){const n=t.getComponent(Cs.type);return n||t.appObjectRepo.submitWarning("DispatchStartBrowseChannelsUC.get","Unable to find DispatchStartBrowseChannelsUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartBrowseChannelsUC.getByID","Unable to find App Object by id "+t);return}return Cs.get(r)}}Cs.type="DispatchStartBrowseChannelsUC";function sR(e){return new aR(e)}class aR extends Cs{doDispatch(t){if(!this.dispatcher)return;const n={channelID:t.channelID,container:t.container,baseApiUrl:t.baseApiURL,callback:t.callback};this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion,n)}constructor(t){super(t,Cs.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class _s extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_ZSPACE"}static get(t){const n=t.getComponent(_s.type);return n||t.appObjectRepo.submitWarning("DispatchStartZSpaceUC.get","Unable to find DispatchStartZSpaceUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStartZSpaceUC.getByID","Unable to find App Object by id "+t);return}return _s.get(r)}}_s.type="DispatchStartZSpaceUC";function oR(e){return new lR(e)}class lR extends _s{dispatchVersion2(t,n){if(!this.dispatcher)return;const r={device:"INSPIRE",session:t,emulate:n};this.dispatcher.formRequestAndDispatch(this.requestType,2,r)}dispatchDefault(t,n){if(!this.dispatcher)return;const r={session:t,emulate:n};this.dispatcher.formRequestAndDispatch(this.requestType,3,r)}constructor(t){super(t,_s.type),this.doDispatch=(n,r)=>{if(!this.dispatcher)return;const i=this.dispatcher.getRequestPayloadVersion(this.requestType);i===2?this.dispatchVersion2(n,r):i===3||i===void 0?this.dispatchDefault(n,r):(this.warn(`Unsupported version ${i} requested. Defaulting`),this.dispatchDefault(n,r))},this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}class Is extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_ZSPACE"}static get(t){const n=t.getComponent(Is.type);return n||t.appObjectRepo.submitWarning("DispatchStopZSpaceUC.get","Unable to find DispatchStopZSpaceUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("DispatchStopZSpaceUC.getByID","Unable to find App Object by id "+t);return}return Is.get(r)}}Is.type="DispatchStopZSpaceUC";function cR(e){return new uR(e)}class uR extends Is{doDispatch(){this.dispatcher&&this.dispatcher.formRequestAndDispatch(this.requestType,this.requestVersion)}constructor(t){super(t,Is.type),this.requestVersion=1,this.dispatcher=t.getComponent(En.type),this.dispatcher||(this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first"),this.dispose())}}function dR(e){p4(e),yI(e),AI(e),rR(e),_I(e),NI(e),oR(e),c4(e),cR(e),O6(e)}class Ns extends k.AppObjectUC{static get(t){const n=t.getComponent(Ns.type);return n||t.appObjectRepo.submitWarning("SetDevModeUC.get","Unable to find SetDevModeUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("SetDevModeUC.getByID","Unable to find App Object by id "+t);return}return Ns.get(r)}}Ns.type="SetDevModeUC";function pR(e){return new fR(e)}class fR extends Ns{get sandbox(){return this.getCachedSingleton(qe.type)}get dispatchSetDevMode(){return this.getCachedLocalComponent(As.type)}constructor(t){super(t,Ns.type),this.setDevMode=n=>{!this.sandbox||!this.dispatchSetDevMode||(this.sandbox.isDevMode=n,this.dispatchSetDevMode.doDispatch(n))}}}function hR(e,t){const n=qe.get(t);if(!n){t.submitWarning("setDevMode","Could not find AppSandboxEntity");return}const r=Ns.getByID(n.appID,t);if(!r){t.submitWarning("setDevMode","Could not find SetDevModeUC");return}r.setDevMode(e)}function Bc(e,t){const n=qe.get(t);n&&(n.state=e)}function mR(e,t){const n=qe.get(t);if(!n){t.submitWarning("startSandboxApp","Could not find AppSandboxEntity");return}Pi.startByID(e,n.appID,t)}function gR(e){const t=qe.get(e);if(!t){e.submitWarning("stopSandboxApp","Could not find AppSandboxEntity");return}Fi.stopByID(t.appID,e)}class qa extends k.AppObjectUC{static get(t){const n=t.getComponent(qa.type);return n||t.appObjectRepo.submitWarning("ShowBabylonInspectorUC.get","Unable to find ShowBabylonInspectorUC on app object "+t.id),n}static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("ShowBabylonInspectorUC.getByID","Unable to find App Object by id "+t);return}return qa.get(r)}}qa.type="ShowBabylonInspectorUC";function ER(e){return new bR(e)}class bR extends qa{get sandbox(){return this.getCachedSingleton(qe.type)}get dispatchShowBabylon(){return this.getCachedLocalComponent(Wl.type)}constructor(t){super(t,qa.type),this.toggleShow=()=>{!this.sandbox||!this.dispatchShowBabylon||(this.sandbox.showBabylonInspector=!this.sandbox.showBabylonInspector,this.dispatchShowBabylon.doDispatch(this.sandbox.showBabylonInspector))},this.hide=()=>{!this.sandbox||!this.dispatchShowBabylon||(this.sandbox.showBabylonInspector=!1,this.dispatchShowBabylon.doDispatch(!1))}}}function TR(e){const t=qe.get(e);t&&(t.startInZSpace=!t.startInZSpace)}function yR(e){const t=qe.get(e);if(!t){e.submitWarning("unmountSandboxApp","Could not find AppSandboxEntity");return}const n=Ar.getById(t.appID,e);if(!n){e.submitWarning("unmountSandboxApp","Could not find MounterUC");return}n.unmount()}class Ai extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ai.type,t)}}Ai.type="AssetPluginEntity";function SR(e){return new AR(e)}class AR extends Ai{get version(){return this._version}set version(t){this._version=t,this._app.versions.push(t)}get app(){return this._app}get show(){return this.memoizedShowApp.val}set show(t){this.memoizedShowApp.val=t}constructor(t){super(t,Ai.type),this._version=new k.Version(0,0,0,k.VersionStage.RELEASED),this.memoizedShowApp=new k.MemoizedBoolean(!1,this.notifyOnChange),this.callback=(n,r)=>{this.warn("Callback has not been injected")},this._app=pu(this.appObject),this._app.addChangeObserver(this.notifyOnChange),this.appObjects.registerSingleton(this)}}let E1=class extends k.AppObjectEntity{};class or extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(or.type,t)}}or.type="DialogQueue";function CR(e){return new _R(e)}class _R extends or{get activeDialog(){return this.dialogQueue.length>0?this.dialogQueue[0]:null}constructor(t){super(t,or.type),this.dialogQueue=[],this.submitDialog=n=>{this.dialogQueue.push(n),this.activeDialog===n&&(n.isOpen=!0),n.addChangeObserver(this.notifyOnChange),this.notifyOnChange()},this.activeDialogHasClosed=()=>{const n=this.activeDialog;if(n!==null){n.removeChangeObserver(this.notifyOnChange),this.filterOutClosedDialogs(),this.dialogQueue.splice(0,1);const r=this.activeDialog;r!==null&&(r.isOpen=!0),this.notifyOnChange()}},this.filterOutClosedDialogs=()=>{const n=[];this.dialogQueue.forEach(r=>{r.hasBeenClosed?r.removeChangeObserver(this.notifyOnChange):n.push(r)}),this.dialogQueue=n},this.appObjects.registerSingleton(this)}}const IR="ALERT";class Rs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("AlertDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Rs.type);if(!i){n.submitWarning("AlertDialogEntity.get","App Object does not have AlertDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,Rs.type),this.dialogType=IR,this.preventOutsideDismiss=!1,this.hasBeenClosed=!1,this.close=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postClose&&this.postClose()},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.buttonLabel=t.buttonLabel,this.message=t.message,this.title=t.title,this.postClose=t.onClose,t.preventOutsideDismiss!==void 0&&(this.preventOutsideDismiss=t.preventOutsideDismiss)}}Rs.type="AlertDialogEntity";const NR="CONFIRM";class vs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ConfirmDialogEntity.get","Unable to find app object");return}const i=r.getComponent(vs.type);if(!i){n.submitWarning("ConfirmDialogEntity.get","App Object does not have ConfirmDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,vs.type),this.dialogType=NR,this.preventOutsideDismiss=!0,this.hasBeenClosed=!1,this.cancel=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postCancel&&this.postCancel()},this.confirm=()=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postConfirm&&this.postConfirm()},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.confirmButtonLabel=t.confirmButtonLabel,this.cancelButtonLabel=t.cancelButtonLabel,this.message=t.message,this.title=t.title,this.postCancel=t.onCancel,this.postConfirm=t.onConfirm}}vs.type="ConfirmDialogEntity";const RR="MARKDOWN_EDITOR";class xs extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("MarkDownEditorDialogEntity.get","Unable to find app object");return}const i=r.getComponent(xs.type);if(!i){n.submitWarning("MarkDownEditorDialogEntity.get","App Object does not have DialogAlertEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}constructor(t,n){super(n,xs.type),this.dialogType=RR,this.preventOutsideDismiss=!0,this.hasBeenClosed=!1,this.cancel=()=>{this.hasBeenClosed=!0,this.isOpen=!1},this.confirm=r=>{this.hasBeenClosed=!0,this.isOpen=!1,this.postConfirm(r)},this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.initialText=t.initialText,this.postConfirm=t.onConfirm}}xs.type="MarkDownEditorDialogEntity";const vR="SELECT_CHANNEL_MODEL";class Ka extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SelectModelDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Ka.type);if(!i){n.submitWarning("SelectModelDialogEntity.get","App Object does not have SelectModelDialogEntity");return}return i}get isOpen(){return this._isOpen.val}set isOpen(t){this._isOpen.val=t}get container(){return this._container}set container(t){this._container=t,this.notifyOnChange()}get isReady(){return this.memoizedIsReady.val}set isReady(t){this.memoizedIsReady.val=t}constructor(t){super(t,Ka.type),this.dialogType=vR,this.hasBeenClosed=!1,this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.preventOutsideDismiss=!0,this.memoizedIsReady=new k.MemoizedBoolean(!1,this.notifyOnChange)}}Ka.type="SelectModelDialogEntity";const xR="SPINNER";class Os extends E1{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SpinnerDialogEntity.get","Unable to find app object");return}const i=r.getComponent(Os.type);if(!i){n.submitWarning("SpinnerDialogEntity.get","App Object does not have SpinnerDialogEntity");return}return i}get message(){return this.memoizedMessage.val}set message(t){this.memoizedMessage.val=t}set isOpen(t){t&&this.createdAt===void 0&&(this.createdAt=Date.now()),this._isOpen.val=t}get isOpen(){return this._isOpen.val}constructor(t,n){super(n,Os.type),this.dialogType=xR,this.mininumuLifespan=2e3,this.preventOutsideDismiss=!0,this._isOpen=new k.MemoizedBoolean(!1,this.notifyOnChange),this.hasBeenClosed=!1,this.close=()=>{if(this.hasBeenClosed=!0,this.createdAt===void 0){this.isOpen=!1;return}const r=Date.now()-this.createdAt,i=this.mininumuLifespan-r;i<=0?this.isOpen=!1:setTimeout(()=>{this.isOpen=!1},i)},this.memoizedMessage=new k.MemoizedString(t.message,this.notifyOnChange),this.title=t.title}}Os.type="SpinnerDialogEntity";class eh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="CLOSE_PLUGIN",this.payloadVersion=1}}eh.type="CloseAssetSystemPluginUC";function OR(e){return new wR(e)}class wR extends eh{get dialogQueue(){return this.getCachedSingleton(or.type)}get assetSystemPlugin(){return this.getCachedLocalComponent(Ai.type)}constructor(t){super(t,eh.type),this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)},this.action=()=>{if(!this.assetSystemPlugin||!this.dialogQueue)return;this.dialogQueue.activeDialogHasClosed();const r=Ss.get(this.appObject);if(!r){this.error("Cannot find DispatchDisposeAppUC");return}const i=Si.get(this.appObject);if(!i){this.error("Cannot find DispatchDisposeAppUC");return}const s=Ar.get(this.appObject);if(!s){this.error("Cannot find MounterUC");return}i.doDispatch(),r.doDispatch(),s.unmount(),this.assetSystemPlugin.show=!1};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class qn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qn.type,t)}}qn.type="AppAssetsEntity";function DR(e){return new kR(e)}class kR extends qn{get editingAsset(){return this._editingAsset}set editingAsset(t){var n;(t==null?void 0:t.id)!==((n=this._editingAsset)==null?void 0:n.id)&&(this._editingAsset&&this._editingAsset.removeChangeObserver(this.notifyOnChange),this._editingAsset=t,this._editingAsset&&this._editingAsset.addChangeObserver(this.notifyOnChange),this.notifyOnChange())}has(t){return this.appAssets.includes(t)}remove(t){const n=this.appAssets.indexOf(t,0);n>-1&&(this.appAssets.splice(n,1),this.notifyOnChange())}get showArchived(){return this.memoizedShowArchived.val}set showArchived(t){this.memoizedShowArchived.val=t}constructor(t){super(t,qn.type),this.appAssets=[],this.getAll=()=>[...this.appAssets],this.add=n=>{this.appAssets.includes(n)||(this.appAssets.push(n),this.notifyOnChange())},this.memoizedShowArchived=new k.MemoizedBoolean(!1,this.notifyOnChange),this.appObjects.registerSingleton(this)}}class Kn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Kn.type,t)}}Kn.type="AssetRepository";function LR(e){return new MR(e)}class MR extends Kn{addFromDTO(t){const n=this.getOrCreate(t.id);this.setAssetFromDTO(t,n);const r=[];return this.addLinkedAssetDTOsRecursively(t.linkedAssets,r),r.forEach(i=>{const s=this.getOrCreate(i.id);this.setAssetFromDTO(i,s)}),n}addLinkedAssetDTOsRecursively(t,n){t.forEach(r=>{n.push(r.asset),this.addLinkedAssetDTOsRecursively(r.asset.linkedAssets,n)})}constructor(t){super(t,Kn.type),this.assetLookup=new Map,this.has=n=>this.assetLookup.has(n),this.assetFactory=n=>s4(this.appObjects.getOrCreate(n)),this.add=n=>{this.assetLookup.has(n.id)||(this.assetLookup.set(n.id,n),this.notifyOnChange())},this.get=n=>this.assetLookup.get(n),this.getOrCreate=n=>{const r=this.assetLookup.get(n);if(r)return r;const i=this.assetFactory(n);return this.add(i),i},this.getAll=()=>Array.from(this.assetLookup.values()),this.remove=n=>{this.assetLookup.has(n)&&(this.assetLookup.delete(n),this.notifyOnChange())},this.setAssetFromDTO=(n,r)=>(r.description=n.description,r.name=n.name,r.archived=n.archived,r.filename=n.filename,r.owner=n.ownerId,r.fileURL=n.fileURL,n.linkedAssets.forEach(i=>{r.addLinkedAsset(i.type,i.asset.id)}),r),this.appObjects.registerSingleton(this)}}class ws extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ws.type,t)}}ws.type="AppAssetListPM";function PR(e){return new FR(e)}class FR extends ws{get assetRepo(){return this.getCachedSingleton(Kn.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{n[s]!==i&&(r=!1)}),r}constructor(t){if(super(t,ws.type),this.onAppAssetsChange=()=>{if(!this.appAssets)return;const n=this.appAssets.getAll();if(this.appAssets.showArchived){this.doUpdateView(n);return}const r=[];n.forEach(i=>{var a;const s=(a=this.assetRepo)==null?void 0:a.get(i);s&&s.archived===!1&&r.push(i)}),this.doUpdateView(r)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("PM has been added to an app object without an AppAssetsEntity");return}this.appAssets.addChangeObserver(this.onAppAssetsChange),this.appObjects.registerSingleton(this),this.onAppAssetsChange()}}const f4={defaultVM:[],subscribe:(e,t)=>{const n=ws.get(e);if(!n){e.submitError("activeAppPMAdapter","Unable to find AppAssetListPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ws.get(e);if(!n){e.submitError("activeAppPMAdapter","Unable to find AppAssetListPM");return}n.removeView(t)}};class Ds extends k.AppObjectPM{static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetPM.getByID","Unable to find app object by ID "+t);return}const i=r.getComponent(Ds.type);if(!i){n.submitWarning("AssetPM.getByID","App Object does not have a AssetPM");return}return i}}Ds.type="AssetPM";function UR(e){return new BR(e)}class BR extends Ds{vmsAreEqual(t,n){return!(t.archived!==n.archived||t.description!==n.description||t.name!==n.name||t.id!==n.id)}constructor(t){if(super(t,Ds.type),this.onAssetChange=()=>{if(!this.asset)return;const n={archived:this.asset.archived,description:this.asset.description,id:this.asset.id,name:this.asset.name};this.doUpdateView(n)},this.asset=t.getComponent(Sr.type),!this.asset){this.warn("PM has been added to an App Object without an AssetEntity");return}this.asset.addChangeObserver(this.onAssetChange),this.onAssetChange()}}const HR={archived:!1,description:"",id:"",name:""},$R={defaultVM:HR,subscribe:(e,t,n)=>{const r=Ds.getByID(e,t);if(!r){t.submitError("assetAdapter","Unable to find AssetPM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ds.getByID(e,t);if(!r){t.submitError("assetAdapter","Unable to find AssetPM");return}r.removeView(n)}};class ql extends k.AppObjectPM{static getByID(t,n){const r=n.get(t);if(!r){n.submitWarning("AssetFilePM.getByID","Unable to find app object by ID "+t);return}const i=r.getComponent(ql.type);if(!i){n.submitWarning("AssetFilePM.getByID","App Object does not have a AssetFilePM");return}return i}}ql.type="AssetFilePM";function GR(e){return new jR(e)}class jR extends ql{get asset(){return this.getCachedLocalComponent(Sr.type)}vmsAreEqual(t,n){return!(t.blobURL!==n.blobURL||t.isFetchingFile!==n.isFetchingFile||t.fileHasBeenFetched!==n.fileHasBeenFetched||t.fetchError!==n.fetchError&&(t.fetchError===void 0&&n.fetchError!==void 0||t.fetchError!==void 0&&n.fetchError===void 0||t.fetchError!==void 0&&n.fetchError!==void 0&&t.fetchError.message!==n.fetchError.message))}constructor(t){super(t,ql.type),this.formVM=()=>{if(!this.asset)return;const n={blobURL:this.asset.blobURL,isFetchingFile:this.asset.isFetchingFile,fileHasBeenFetched:this.asset.fileHasBeenFetched,fetchError:this.asset.fetchError};this.doUpdateView(n)},this.asset&&this.observeEntity(this.asset)}}class ks extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ks.type,t)}}ks.type="EditingAppAssetPM";function zR(e){return new VR(e)}class VR extends ks{vmsAreEqual(t,n){return t===void 0&&n===void 0?!0:!((t==null?void 0:t.archived)!==(n==null?void 0:n.archived)||(t==null?void 0:t.description)!==(n==null?void 0:n.description)||(t==null?void 0:t.filename)!==(n==null?void 0:n.filename)||(t==null?void 0:t.id)!==(n==null?void 0:n.id)||(t==null?void 0:t.name)!==(n==null?void 0:n.name))}constructor(t){if(super(t,ks.type),this.onAssetChange=()=>{if(this.appAssets)if(this.appAssets.editingAsset){const{id:n,name:r,description:i,archived:s,filename:a}=this.appAssets.editingAsset,o={id:n,name:r,description:i,archived:s,filename:a};this.doUpdateView(o)}else this.doUpdateView(void 0)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.warn("PM has been added to an App Object without an AppAssetsEntity");return}this.appObjects.registerSingleton(this),this.appAssets.addChangeObserver(this.onAssetChange),this.onAssetChange()}}const h4={defaultVM:void 0,subscribe:(e,t)=>{const n=ks.get(e);if(!n){e.submitError("editingAppAssetAdapter","Unable to find EditingAppAssetPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ks.get(e);if(!n){e.submitError("editingAppAssetAdapter","Unable to find EditingAppAssetPM");return}n.removeView(t)}};class Ls extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Ls.type,t)}}Ls.type="ShowArchivedAppAssetPM";function WR(e){return new qR(e)}class qR extends Ls{vmsAreEqual(t,n){return t===n}constructor(t){if(super(t,Ls.type),this.defaultVM=!1,this.formVM=()=>{if(!this.appAssets)return;const n=this.appAssets.showArchived;this.doUpdateView(n)},this.appAssets=t.getComponent(qn.type),!this.appAssets){this.warn("PM has been added to an App Object without an AppAssetsEntity");return}this.observeEntity(this.appAssets)}}const KR={defaultVM:!1,subscribe:(e,t)=>{const n=Ls.get(e);if(!n){e.submitError("showArchivedAppAssetAdapter","Unable to find ShowArchivedAppAssetPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Ls.get(e);if(!n){e.submitError("showArchivedAppAssetAdapter","Unable to find ShowArchivedAppAssetPM");return}n.removeView(t)}},YR={message:"",buttonLabel:"",close:()=>{},title:""};class Ms extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("AlertDialogPM.get","Unable to find app object");return}const i=r.getComponent(Ms.type);if(!i){n.submitWarning("AlertDialogPM.get","App Object does not have AlertDialogPM");return}return i}}Ms.type="AlertDialogPM";function XR(e){return new ZR(e)}class ZR extends Ms{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title||t.buttonLabel!==n.buttonLabel)}constructor(t){if(super(t,Ms.type),this.onAlertChange=()=>{this.alert&&this.doUpdateView({buttonLabel:this.alert.buttonLabel,close:this.alert.close,message:this.alert.message,title:this.alert.title})},this.alert=t.getComponent(Rs.type),!this.alert){this.error("PM added to an app object that does not have a DialogAlertEntity");return}this.alert.addChangeObserver(this.onAlertChange),this.onAlertChange()}}class Ps extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ConfirmDialogPM.get","Unable to find app object");return}const i=r.getComponent(Ps.type);if(!i){n.submitWarning("ConfirmDialogPM.get","App Object does not have ConfirmDialogPM");return}return i}}Ps.type="ConfirmDialogPM";function QR(e){return new JR(e)}class JR extends Ps{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title||t.cancelButtonLabel!==n.cancelButtonLabel||t.confirmButtonLabel!==n.confirmButtonLabel)}constructor(t){if(super(t,Ps.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({confirmButtonLabel:this.dialog.confirmButtonLabel,cancelButtonLabel:this.dialog.cancelButtonLabel,cancel:this.dialog.cancel,message:this.dialog.message,title:this.dialog.title,confirm:this.dialog.confirm})},this.dialog=t.getComponent(vs.type),!this.dialog){this.error("PM added to an app object that does not have a DialogConfirmEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const e3={message:"Generic confirm message",title:"Confirm",cancel:()=>{console.warn("[ConfirmDialogVM.cancel] default VM")},cancelButtonLabel:"",confirm:()=>{console.warn("[ConfirmDialogVM.confirm] default VM")},confirmButtonLabel:""};class Fs extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Fs.type,t)}}Fs.type="DialogQueuePM";function t3(e){return new n3(e)}class n3 extends Fs{vmsAreEqual(t,n){return!(t.open!==n.open||t.id!==n.id||t.dialogType!==n.dialogType||t.preventOutsideDismiss!==n.preventOutsideDismiss)}constructor(t){if(super(t,Fs.type),this.onQueueChange=()=>{if(!this.queue)return;let n={open:!1};const r=this.queue.activeDialog;r&&(n={open:r.isOpen,dialogType:r.dialogType,preventOutsideDismiss:r.preventOutsideDismiss,id:r.appObject.id}),this.doUpdateView(n)},this.queue=t.getComponent(or.type),!this.queue){this.error("PM added to an app object that does not have a DialogQueue");return}this.queue.addChangeObserver(this.onQueueChange),this.onQueueChange(),this.appObjects.registerSingleton(this)}}const r3={open:!1};class Us extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("MarkDownEditorDialogPM.get","Unable to find app object");return}const i=r.getComponent(Us.type);if(!i){n.submitWarning("MarkDownEditorDialogPM.get","App Object does not have MarkDownEditorDialogPM");return}return i}}Us.type="MarkDownEditorDialogPM";function i3(e){return new s3(e)}class s3 extends Us{vmsAreEqual(t,n){return t.initialText===n.initialText}constructor(t){if(super(t,Us.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({initialText:this.dialog.initialText,confirm:this.dialog.confirm})},this.dialog=t.getComponent(xs.type),!this.dialog){this.error("PM added to an app object that does not have a DialogMarkDownEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const a3={initialText:"",confirm:e=>{console.warn("[MarkDownEditorDialogVM.confirm] default VM!")}};class Bs extends k.AppObjectPM{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("SpinnerDialogPM.get","Unable to find app object");return}const i=r.getComponent(Bs.type);if(!i){n.submitWarning("SpinnerDialogPM.get","App Object does not have SpinnerDialogPM");return}return i}}Bs.type="SpinnerDialogPM";function o3(e){return new l3(e)}class l3 extends Bs{vmsAreEqual(t,n){return!(t.message!==n.message||t.title!==n.title)}constructor(t){if(super(t,Bs.type),this.onAlertChange=()=>{this.dialog&&this.doUpdateView({message:this.dialog.message,title:this.dialog.title})},this.dialog=t.getComponent(Os.type),!this.dialog){this.error("PM added to an app object that does not have a DialogSpinnerEntity");return}this.dialog.addChangeObserver(this.onAlertChange),this.onAlertChange()}}const c3={message:"Default spinner message",title:"Spinner"},u3={defaultVM:YR,subscribe:(e,t,n)=>{const r=Ms.get(e,t);if(!r){t.submitError("alertDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ms.get(e,t);if(!r){t.submitError("alertDialogAdapter","Unable to find PM");return}r.removeView(n)}},d3={defaultVM:e3,subscribe:(e,t,n)=>{const r=Ps.get(e,t);if(!r){t.submitError("confirmDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Ps.get(e,t);if(!r){t.submitError("confirmDialogAdapter","Unable to find PM");return}r.removeView(n)}},p3={defaultVM:r3,subscribe:(e,t)=>{const n=Fs.get(e);if(!n){e.submitError("dialogQueueAdapter","Unable to find DialogQueuePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Fs.get(e);if(!n){e.submitError("dialogQueueAdapter","Unable to find DialogQueuePM");return}n.removeView(t)}},f3={defaultVM:a3,subscribe:(e,t,n)=>{const r=Us.get(e,t);if(!r){t.submitError("markDownEditorDialogAdapters","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Us.get(e,t);if(!r){t.submitError("markDownEditorDialogAdapters","Unable to find PM");return}r.removeView(n)}},h3={defaultVM:c3,subscribe:(e,t,n)=>{const r=Bs.get(e,t);if(!r){t.submitError("spinnerDialogAdapter","Unable to find PM");return}r.addView(n)},unsubscribe:(e,t,n)=>{const r=Bs.get(e,t);if(!r){t.submitError("spinnerDialogAdapter","Unable to find PM");return}r.removeView(n)}};function m3(e){const t=or.get(e);t?t.activeDialogHasClosed():e.submitWarning("activeDialogHasClosed","Unable to find DialogQueue")}function g3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new Rs(n,r);return XR(r),i}}function E3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new vs(n,r);return QR(r),i}}function b3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new xs(n,r);return i3(r),i}}class lr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(lr.type,t)}static make(t,n){const r=lr.get(n);r==null||r.make(t)}}lr.type="MakeAlertDialogUC";function T3(e){return new y3(e)}class y3 extends lr{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new Rs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,lr.type),this.appObjects.registerSingleton(this)}}class $i extends k.AppObjectUC{static get(t){return k.getSingletonComponent($i.type,t)}static make(t,n){const r=$i.get(n);r==null||r.make(t)}}$i.type="MakeConfirmDialogUC";function S3(e){return new A3(e)}class A3 extends $i{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new vs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,$i.type),this.appObjects.registerSingleton(this)}}class Hs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Hs.type,t)}static make(t,n){const r=Hs.get(n);r==null||r.make(t)}}Hs.type="MakeMarkdownDialogUC";function C3(e){return new _3(e)}class _3 extends Hs{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new xs(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);this.dialogRepo.submitDialog(n)}constructor(t){super(t,Hs.type),this.appObjects.registerSingleton(this)}}class $s extends k.AppObjectUC{static get(t){return k.getSingletonComponent($s.type,t)}static make(t){const n=$s.get(t);n==null||n.make()}}$s.type="MakeSelectModelDialogUC";function I3(e){return new N3(e)}class N3 extends $s{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(){const t=this.appObjects.getOrCreate(k.generateUniqueID());return new Ka(t)}make(){if(!this.dialogRepo)return;const t=this.factory();this.dialogRepo.submitDialog(t)}constructor(t){super(t,$s.type),this.appObjects.registerSingleton(this)}}class cr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(cr.type,t)}static make(t,n){const r=cr.get(n);return r==null?void 0:r.make(t)}}cr.type="MakeSpinnerDialogUC";function R3(e){return new v3(e)}class v3 extends cr{get dialogRepo(){return this.getCachedSingleton(or.type)}factory(t){const n=this.appObjects.getOrCreate(k.generateUniqueID());return new Os(t,n)}make(t){if(!this.dialogRepo)return;const n=this.factory(t);return this.dialogRepo.submitDialog(n),n}constructor(t){super(t,cr.type),this.appObjects.registerSingleton(this)}}function x3(e){return function(){const n=e.getOrCreate(k.generateUniqueID());return new Ka(n)}}function O3(e){return function(n){const r=e.getOrCreate(k.generateUniqueID()),i=new Os(n,r);return o3(r),i}}class w3 extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxDialogFactory"}setupEntities(){CR(this.appObject)}setupUCs(){}setupPMs(){t3(this.appObject)}finalSetup(){T3(this.appObject).factory=g3(this.appObjects),S3(this.appObject).factory=E3(this.appObjects),C3(this.appObject).factory=b3(this.appObjects),R3(this.appObject).factory=O3(this.appObjects),I3(this.appObject).factory=x3(this.appObjects)}}function D3(e){const t=e.getOrCreate("Dialog");return new w3(t)}class hm extends k.AppObjectPM{static get(t){return k.getSingletonComponent(hm.type,t)}}hm.type="ApiStagePM";ps.PRODUCTION;class Gs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Gs.type,t)}}Gs.type="UserTokenPM";function k3(e){return new L3(e)}class L3 extends Gs{get sandbox(){return this.getCachedSingleton(bn.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Gs.type),this.defaultVM="",this.formVM=()=>{this.sandbox&&this.doUpdateView(this.sandbox.userToken)},this.sandbox&&this.observeEntity(this.sandbox)}}const M3={defaultVM:"",subscribe:(e,t)=>{const n=Gs.get(e);if(!n){e.submitError("userTokenAdapter","Unable to find UserTokenPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Gs.get(e);if(!n){e.submitError("userTokenAdapter","Unable to find UserTokenPM");return}n.removeView(t)}};class Ya extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ya.type,t)}}Ya.type="BasicFetchUC";class Xa extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xa.type,t)}}Xa.type="BlobRequestUC";class Za extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Za.type,t)}}Za.type="DeleteAssetOnAPIUC";function P3(e){return new F3(e)}let F3=class extends Za{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Za.type),this.doDelete=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{r().then(c=>{const u=i.getEndpointURL(`assets/${n}`),p={method:"DELETE",headers:{Authorization:"Bearer "+c}};return s(u,p)}).then(c=>{a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}};class js extends k.AppObjectUC{static get(t){return k.getSingletonComponent(js.type,t)}}js.type="FetchAssetFileFromAPIUC";function U3(e){return new B3(e)}class B3 extends js{get requestBlob(){var t;return(t=this.getCachedSingleton(Xa.type))==null?void 0:t.doRequest}constructor(t){super(t,js.type),this.doFetch=n=>{const r=this.requestBlob;return r?n.fileURL?n.filename?new Promise((i,s)=>{const a=n.filename,o=new URL(n.fileURL);r(o).then(c=>{if(c&&a){const u=new File([c],a);i(u)}}).catch(c=>{this.warn(c.message),s(c)})}):Promise.reject(new Error(`${n.id} does not have a filename`)):Promise.reject(new Error(`${n.id} does not have a file URL`)):Promise.reject()},this.appObjects.registerSingleton(this)}}class Qa extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Qa.type,t)}}Qa.type="FetchAssetMetaFromAPIUC";function H3(e){return new $3(e)}class $3 extends Qa{get requestJSON(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Qa.type),this.doFetch=n=>{const r=this.vivedAPI,i=this.requestJSON;return!r||!i?Promise.reject():new Promise((s,a)=>{const o=r.getEndpointURL(`assets/${n}`);i(o,{method:"GET"}).then(u=>{const p=m4(u.asset);p.id=n,s(p)}).catch(u=>{this.warn(u.message),a(u)})})},this.appObjects.registerSingleton(this)}}function m4(e){const t=e.linkedAssets.map(r=>({type:r.type,asset:m4(r.asset)}));return{archived:e.archived,description:e.description,fileURL:e.fileURL,filename:e.filename,id:e.id,name:e.name,linkedAssets:t,ownerId:e.ownerId}}class Gi extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Gi.type,t)}}Gi.type="FileUploadUC";function G3(e){return new j3(e)}class j3 extends Gi{get vivedAPI(){return this.getCachedSingleton(bn.type)}get requestJSON(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get basicFetch(){var t;return(t=this.getCachedSingleton(Ya.type))==null?void 0:t.doRequest}constructor(t){super(t,Gi.type),this.doUpload=n=>{const r=this.vivedAPI,i=this.requestJSON,s=this.basicFetch;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{const c=r.getEndpointURL(`upload/large/DataVariants/${n.name}?function_version=2`);i(c).then(u=>{const{url:p,contentType:h}=u,y=new URL(p);return s(y,{method:"PUT",body:n,headers:{"Content-Type":h}})}).then(u=>{a()}).catch(u=>{this.warn(u.message),o(u)})})},this.appObjects.registerSingleton(this)}}class Ja extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ja.type,t)}}Ja.type="GetAssetsForOwnerFromAPIUC";function z3(e){return new V3(e)}class V3 extends Ja{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}responseToDTO(t){const n=t.linkedAssets.map(i=>({type:i.type,asset:this.responseToDTO(i.asset)}));return{archived:t.archived,description:t.description,fileURL:t.fileURL,filename:t.filename,id:t.id,name:t.name,linkedAssets:n,ownerId:t.ownerId}}constructor(t){super(t,Ja.type),this.getAssets=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{r().then(c=>{const u=i.getEndpointURL(`assets/group/${n}`),p=1,h=100;return u.searchParams.append("page",p.toString()),u.searchParams.append("itemsPerPage",h.toString()),s(u,{method:"GET"})}).then(c=>{const u=c.assets.map(p=>this.responseToDTO(p));a(u)}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}}class eo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(eo.type,t)}}eo.type="PatchAssetFileUC";function W3(e){return new q3(e)}class q3 extends eo{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUpload(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,eo.type),this.doPatch=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester,o=this.fileUpload;if(!i||!s||!a||!o)return Promise.reject();let c="";const u=r.name.split(".");c=u[u.length-1];const p=`${k.generateUniqueID()}.${c}`,h=new File([r],`${p}`,{lastModified:Date.now()});return new Promise((y,l)=>{o(h).then(E=>i()).then(E=>{const T=s.getEndpointURL(`assets/${n}`),A={method:"PATCH",body:JSON.stringify({filename:p}),headers:{Authorization:"Bearer "+E}};return a(T,A)}).then(E=>{y(p)}).catch(E=>{l(E)})})},this.appObjects.registerSingleton(this)}}class to extends k.AppObjectUC{static get(t){return k.getSingletonComponent(to.type,t)}}to.type="PatchAssetIsArchivedUC";function K3(e){return new Y3(e)}class Y3 extends to{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,to.type),this.doPatch=(n,r)=>{const i=this.getAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!i||!s||!a?Promise.reject():new Promise((o,c)=>{i().then(u=>{const p=s.getEndpointURL(`assets/${n}`),y={method:"PATCH",body:JSON.stringify({archived:r}),headers:{Authorization:"Bearer "+u}};return a(p,y)}).then(u=>{o()}).catch(u=>{c(u)})})},this.appObjects.registerSingleton(this)}}class no extends k.AppObjectUC{static get(t){return k.getSingletonComponent(no.type,t)}}no.type="PatchAssetMetaUC";function X3(e){return new Z3(e)}class Z3 extends no{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,no.type),this.doPatch=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester;if(!r||!i||!s)return Promise.reject();const{id:a,name:o,description:c,archived:u}=n;return new Promise((p,h)=>{r().then(y=>{const l=i.getEndpointURL(`assets/${a}`),T={method:"PATCH",body:JSON.stringify({name:o,description:c,archived:u}),headers:{Authorization:"Bearer "+y}};return s(l,T)}).then(y=>{p()}).catch(y=>{h(y)})})},this.appObjects.registerSingleton(this)}}class Kl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Kl.type,t)}}Kl.type="PatchAssetUC";function Q3(e){return new J3(e)}class J3 extends Kl{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUpload(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,Kl.type),this.doPatch=n=>{const r=this.getAuthToken,i=this.vivedAPI,s=this.jsonRequester,a=this.fileUpload;if(!r||!i||!s||!a)return Promise.reject();const{id:o,file:c,name:u,description:p,archived:h}=n;let y="";const l=c.name.split(".");y=l[l.length-1];const E=`${k.generateUniqueID()}.${y}`,T=new File([c],`${E}`,{lastModified:Date.now()});return new Promise((S,A)=>{a(T).then(R=>r()).then(R=>{const I=i.getEndpointURL(`assets/${o}`),N={method:"PATCH",body:JSON.stringify({archived:h,description:p,filename:E,name:u}),headers:{Authorization:"Bearer "+R}};return s(I,N)}).then(R=>{S()}).catch(R=>{A(R)})})},this.appObjects.registerSingleton(this)}}class zs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(zs.type,t)}}zs.type="PostNewAssetUC";function ev(e){return new tv(e)}class tv extends zs{get jsonRequester(){var t;return(t=this.getCachedSingleton(Hn.type))==null?void 0:t.doRequest}get getPlayerAuthToken(){var t;return(t=this.getCachedSingleton(ar.type))==null?void 0:t.getAuthToken}get fileUploader(){var t;return(t=this.getCachedSingleton(Gi.type))==null?void 0:t.doUpload}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,zs.type),this.doPost=n=>{const r=this.fileUploader,i=this.getPlayerAuthToken,s=this.vivedAPI,a=this.jsonRequester;return!r||!i||!s||!a?Promise.reject():new Promise((o,c)=>{const{description:u,file:p,name:h,ownerID:y,ownerType:l}=n;let E;const T=p.name.split("."),S=T[T.length-1],A=`${k.generateUniqueID()}.${S}`,R=new File([p],A,{type:p.type,lastModified:Date.now()});r(R).then(I=>i()).then(I=>{const v=s.getEndpointURL("assets"),N={ownerId:y,name:h,description:u,filename:A,...l!==void 0&&{ownerType:l}},x={method:"POST",body:JSON.stringify(N),headers:{Authorization:"Bearer "+I}};return a(v,x)}).then(I=>{E=I.assetId,o({id:E,filename:A})}).catch(I=>{c(I)})})},this.appObjects.registerSingleton(this)}}class Vs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Vs.type,t)}}Vs.type="UserAuthUC";function nv(e,t,n){const r=Vs.get(n);return r?r.login(e,t):(n.submitWarning("loginUser","Unable to find UserAuthUC"),Promise.reject(new Error("Unable to find UserAuthUC")))}function rv(e){const t=Vs.get(e);return t?t.refreshAuthenticatedUser():(e.submitError("refreshAuthenticatedUser","Unable to find UserAuthUC"),Promise.reject(new Error("Unable to find UserAuthUC")))}class iv extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxVivedAPIFactory"}setupEntities(){new bn(this.appObject)}setupUCs(){P3(this.appObject),U3(this.appObject),H3(this.appObject),G3(this.appObject),pI(this.appObject),z3(this.appObject),W3(this.appObject),K3(this.appObject),X3(this.appObject),Q3(this.appObject),ev(this.appObject)}setupPMs(){k3(this.appObject)}finalSetup(){}}function sv(e){const t=e.getOrCreate("VIVED API");return new iv(t)}class ro extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("ArchiveAssetUC.get","Unable to find app object");return}const i=r.getComponent(ro.type);if(!i){n.submitWarning("ArchiveAssetUC.get","App Object does not have ArchiveAssetUC");return}return i}}ro.type="ArchiveAssetUC";function av(e){return new ov(e)}class ov extends ro{get patchAssetIsArchived(){var t;return(t=this.getCachedSingleton(to.type))==null?void 0:t.doPatch}get appAssets(){return this.getCachedSingleton(qn.type)}constructor(t){super(t,ro.type),this.setArchived=n=>{const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));if(r.archived===n)return Promise.resolve();const i=this.patchAssetIsArchived;if(!i)return Promise.reject();const s=n?"Archiving Asset":"Unarchive Asset",a=cr.make({title:s,message:"Updating asset's archived flag..."},this.appObjects);return new Promise((o,c)=>{i(r.id,n).then(()=>{r.archived=n,this.appAssets&&this.appAssets.has(r.id)&&this.appAssets.notifyOnChange(),a==null||a.close(),o()}).catch(u=>{this.error("Archive asset error: "+u.message),a==null||a.close();const p={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${u.message}`,title:"Archive Asset Error"};lr.make(p,this.appObjects),o()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function dT(e,t,n){const r=ro.get(e,n);return r?r.setArchived(t):(n.submitWarning("archiveAsset","Unable to find ArchiveAssetUC"),Promise.reject())}class io extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("DeleteAssetUC.get","Unable to find app object");return}const i=r.getComponent(io.type);if(!i){n.submitWarning("DeleteAssetUC.get","App Object does not have DeleteAssetUC");return}return i}}io.type="DeleteAssetUC";function lv(e){return new cv(e)}class cv extends io{get doDelete(){var t;return(t=this.getCachedSingleton(Za.type))==null?void 0:t.doDelete}get appAssets(){return this.getCachedSingleton(qn.type)}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){super(t,io.type),this.deleteWithConfirm=()=>{$i.make({cancelButtonLabel:"Cancel",confirmButtonLabel:"Delete Asset",message:"Are you sure you want to delete this asset. This cannot be undone and could affect users. Consider archiving it instead",title:"Delete Asset",onConfirm:this.delete},this.appObjects)},this.delete=()=>{const n=this.asset;if(!n)return Promise.reject(new Error("No Asset Entity"));const r=this.doDelete;if(!r)return Promise.reject();const s=cr.make({title:"Delete Asset",message:"Deleting asset..."},this.appObjects);return new Promise(a=>{r(n.id).then(()=>{this.appAssets&&this.appAssets.has(n.id)&&this.appAssets.remove(n.id),this.assetRepo&&this.assetRepo.has(n.id)&&this.assetRepo.remove(n.id),s==null||s.close(),a()}).catch(o=>{this.error("Archive asset error: "+o.message),s==null||s.close();const c={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${o.message}`,title:"Archive Asset Error"};lr.make(c,this.appObjects),a()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function uv(e,t){const n=io.get(e,t);if(!n){t.submitWarning("deleteAsset","Unable to find DeleteAssetUC");return}n.deleteWithConfirm()}class Ci extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ci.type,t)}}Ci.type="CacheEntity";function dv(e){return new pv(e)}class pv extends Ci{constructor(t){super(t,Ci.type),this.cache=new Map,this.appObjects.registerSingleton(this)}async get(t){if(!this.cache.has(t))throw new Error(`Cache key not found: ${t}`);return this.cache.get(t)}async store(t,n,r){this.cache.set(t,{value:n,metadata:r})}async has(t){return this.cache.has(t)}async invalidate(t){this.cache.delete(t)}async clear(){this.cache.clear()}async size(){return this.cache.size}}class Ws extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ws.type,t)}}Ws.type="ScriptCacheEntity";function fv(e){return new hv(e)}class hv extends Ws{get cacheEntity(){return this.getCachedSingleton(Ci.type)}constructor(t){super(t,Ws.type),this.appObjects.registerSingleton(this)}async getScript(t,n,r){const i=this.generateCacheKey(t,n,r),s=this.cacheEntity;if(!s){this.warn("CacheEntity not found");return}try{const{value:a}=await s.get(i);return a}catch{return}}async storeScript(t,n,r,i){const s=this.generateCacheKey(t,n,r),a=this.cacheEntity;if(!a){this.warn("CacheEntity not found");return}const o={appId:t,version:n,scriptPath:r,timestamp:Date.now()};await a.store(s,i,o)}async hasScript(t,n,r){const i=this.generateCacheKey(t,n,r),s=this.cacheEntity;return s?await s.has(i):(this.warn("CacheEntity not found"),!1)}async invalidateScript(t,n,r){const i=this.cacheEntity;if(!i){this.warn("CacheEntity not found");return}if(t&&n&&r){const s=this.generateCacheKey(t,n,r);await i.invalidate(s);return}if(!n&&!r){this.warn("Partial invalidation not fully implemented");return}}extractScriptInfo(t){try{const r=new URL(t).pathname.split("/"),i=r.findIndex(u=>u==="apps");if(i===-1||i+2>=r.length)throw new Error(`Invalid app URL format: ${t}`);const s=r[i+1],a=r[i+2],c=r.slice(i+3).join("/");return{appId:s,version:a,scriptPath:c}}catch{return this.error(`Failed to extract script info from URL: ${t}`),{appId:"unknown",version:"unknown",scriptPath:"unknown"}}}generateCacheKey(t,n,r){return`script:${t}:${n}:${r}`}}class qs extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(qs.type,t)}}qs.type="AssetCacheEntity";function mv(e){return new gv(e)}class gv extends qs{get cacheEntity(){return this.getCachedSingleton(Ci.type)}constructor(t){super(t,qs.type),this.appObjects.registerSingleton(this)}async getAsset(t){const n=this.generateCacheKey(t),r=this.cacheEntity;if(!r){this.warn("CacheEntity not found");return}try{const{value:i,metadata:s}=await r.get(n);if(i instanceof Blob)return i;if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){const a=(s==null?void 0:s.contentType)||"application/octet-stream";return new Blob([i],{type:a})}this.warn("Cached asset is not a Blob or ArrayBuffer");return}catch{return}}async storeAsset(t,n,r){const i=this.generateCacheKey(t),s=this.cacheEntity;if(!s){this.warn("CacheEntity not found");return}const a={assetId:t,timestamp:Date.now(),contentType:r||n.type};await s.store(i,n,a)}async hasAsset(t){const n=this.generateCacheKey(t),r=this.cacheEntity;return r?await r.has(n):(this.warn("CacheEntity not found"),!1)}async invalidateAsset(t){const n=this.cacheEntity;if(!n){this.warn("CacheEntity not found");return}const r=this.generateCacheKey(t);await n.invalidate(r)}generateCacheKey(t){return`asset:${t}`}}class Ks extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ks.type,t)}}Ks.type="GetAssetFromCacheUC";function Ev(e){return new bv(e)}class bv extends Ks{get assetCacheEntity(){return this.getCachedSingleton(qs.type)}constructor(t){super(t,Ks.type),this.getAsset=async n=>{const r=this.assetCacheEntity;if(!r){this.warn("AssetCacheEntity not found");return}try{return await r.getAsset(n)}catch{this.warn(`Error retrieving asset from cache for ID: ${n}`);return}},this.appObjects.registerSingleton(this)}}class Yl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Yl.type,t)}}Yl.type="GetScriptFromCacheUC";function Tv(e){return new yv(e)}class yv extends Yl{get scriptCacheEntity(){return this.getCachedSingleton(Ws.type)}extractScriptInfo(t){const n=this.scriptCacheEntity;return n?n.extractScriptInfo(t):(this.warn("ScriptCacheEntity not found"),{appId:"unknown",version:"unknown",scriptPath:"unknown"})}constructor(t){super(t,Yl.type),this.getScript=async n=>{const r=this.scriptCacheEntity;if(!r){this.warn("ScriptCacheEntity not found");return}try{const{appId:i,version:s,scriptPath:a}=this.extractScriptInfo(n);return await r.getScript(i,s,a)}catch{this.warn(`Error retrieving script from cache for URL: ${n}`);return}},this.appObjects.registerSingleton(this)}}class Ys extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ys.type,t)}}Ys.type="StoreAssetInCacheUC";function Sv(e){return new Av(e)}class Av extends Ys{get assetCacheEntity(){return this.getCachedSingleton(qs.type)}constructor(t){super(t,Ys.type),this.storeAsset=async(n,r,i)=>{const s=this.assetCacheEntity;if(!s){this.warn("AssetCacheEntity not found");return}try{await s.storeAsset(n,r,i)}catch{this.warn(`Error storing asset in cache for ID: ${n}`)}},this.appObjects.registerSingleton(this)}}class Xl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xl.type,t)}}Xl.type="StoreScriptInCacheUC";function Cv(e){return new _v(e)}class _v extends Xl{get scriptCacheEntity(){return this.getCachedSingleton(Ws.type)}extractScriptInfo(t){const n=this.scriptCacheEntity;return n?n.extractScriptInfo(t):(this.warn("ScriptCacheEntity not found"),{appId:"unknown",version:"unknown",scriptPath:"unknown"})}constructor(t){super(t,Xl.type),this.storeScript=async(n,r)=>{const i=this.scriptCacheEntity;if(!i){this.warn("ScriptCacheEntity not found");return}try{const{appId:s,version:a,scriptPath:o}=this.extractScriptInfo(n);await i.storeScript(s,a,o,r)}catch{this.warn(`Error storing script in cache for URL: ${n}`)}},this.appObjects.registerSingleton(this)}}class Iv extends k.DomainFactory{constructor(t){super(t),this.factoryName="CacheFeatureFactory"}setupEntities(){fv(this.appObject),mv(this.appObject)}setupUCs(){Tv(this.appObject),Cv(this.appObject),Ev(this.appObject),Sv(this.appObject)}setupPMs(){}finalSetup(){}}function Nv(e){const t=e.getOrCreate("Cache");return new Iv(t)}class Qr extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Qr.type,t)}}Qr.type="GetAssetUC";function Rv(e){return new vv(e)}let vv=class extends Qr{get fetchAssetMeta(){var t;return(t=this.getCachedSingleton(Qa.type))==null?void 0:t.doFetch}constructor(t){if(super(t,Qr.type),this.getAsset=n=>{const r=this.assetRepo,i=this.fetchAssetMeta;return!r||!i?Promise.reject():r.has(n)?Promise.resolve(r.get(n)):new Promise((s,a)=>{i(n).then(o=>{const c=r.addFromDTO(o);s(c)}).catch(o=>{this.warn(o.message),a(o)})})},this.appObjects.registerSingleton(this),this.assetRepo=t.getComponent(Kn.type),!this.assetRepo){this.error("UC added to an App Object that does not have AssetRepo");return}}};class Xs extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Xs.type,t)}}Xs.type="GetAssetFileUC";function xv(e){return new Ov(e)}class Ov extends Xs{get assetRepo(){return this.getCachedSingleton(Kn.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(js.type))==null?void 0:t.doFetch}get getAsset(){var t;return(t=this.getCachedSingleton(Qr.type))==null?void 0:t.getAsset}get getAssetFromCache(){var t;return(t=this.getCachedSingleton(Ks.type))==null?void 0:t.getAsset}get storeAssetInCache(){var t;return(t=this.getCachedSingleton(Ys.type))==null?void 0:t.storeAsset}async tryGetFromCacheOrFetch(t){const n=this.getAssetFromCache;if(!n)return this.fetchAssetDirectly(t);const r=await n(t);return r?this.createFileFromCachedBlob(t,r):this.fetchAssetDirectly(t)}async createFileFromCachedBlob(t,n){const r=this.getAsset;if(!r)throw new Error("Required dependencies not found");const i=await r(t),s=i.filename||"cached-asset",a=new File([n],s,{type:n.type});return i.setFile(a),i.isFetchingFile=!1,a}async fetchAssetDirectly(t){const n=this.getAsset,r=this.fetchAssetFile;if(!n||!r)throw new Error("Required dependencies not found");try{const i=await n(t);i.isFetchingFile=!0,i.fetchError=void 0;const s=await r(i);return i.setFile(s),i.isFetchingFile=!1,await this.tryCacheAssetFile(t,s),s}catch(i){throw await this.handleFetchError(t,i),i}}async handleFetchError(t,n){const r=this.getAsset;if(r)try{const i=await r(t);i.fetchError=n,i.isFetchingFile=!1}catch{}}async tryCacheAssetFile(t,n){const r=this.storeAssetInCache;if(r)try{await r(t,new Blob([n],{type:n.type}),n.type)}catch(i){this.warn(`Failed to cache asset: ${i.message}`)}}constructor(t){super(t,Xs.type),this.getAssetFile=async n=>{const r=this.assetRepo,i=this.getAsset,s=this.fetchAssetFile;if(!r||!i||!s)return Promise.reject(new Error("Missing required dependencies"));const a=r.get(n);if(a!=null&&a.file)return a.file;try{return await this.tryGetFromCacheOrFetch(n)}catch(o){return this.warn(`Cache error: ${o.message}`),this.fetchAssetDirectly(n)}},this.appObjects.registerSingleton(this)}}class so extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("DownloadAssetFileUC.get","Unable to find app object");return}const i=r.getComponent(so.type);if(!i){n.submitWarning("DownloadAssetFileUC.get","App Object does not have DownloadAssetFileUC");return}return i}}so.type="DownloadAssetFileUC";function wv(e){return new Dv(e)}class Dv extends so{get getAssetFile(){var t;return(t=this.getCachedSingleton(Xs.type))==null?void 0:t.getAssetFile}constructor(t){super(t,so.type),this.download=()=>{const n=this.asset;if(!n)return Promise.reject(new Error("No Asset Entity"));if(n.blobURL)return this.saveFileLocally(),Promise.resolve();const r=this.getAssetFile;if(!r)return Promise.reject();const s=cr.make({title:"Download Asset",message:"Downloading asset..."},this.appObjects);return new Promise(a=>{r(n.id).then(()=>{s==null||s.close(),this.saveFileLocally(),a()}).catch(o=>{this.error("Archive asset error: "+o.message),s==null||s.close();const c={buttonLabel:"OK",message:`Something went wrong when setting the asset's archived flag. Check the console. ${o.message}`,title:"Archive Asset Error"};lr.make(c,this.appObjects),a()})})},this.saveFileLocally=()=>{if(!this.asset){this.error("No Asset");return}if(!this.asset.blobURL){this.error("No blob URL");return}const n=document.createElement("a");n.href=this.asset.blobURL,n.download=this.asset.filename,n.click()},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function kv(e,t){const n=so.get(e,t);if(!n){t.submitWarning("deleteAsset","Unable to find DownloadAssetFileUC");return}n.download()}class ao extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ao.type,t)}}ao.type="EditAppAssetUC";function Lv(e){return new Mv(e)}class Mv extends ao{get appAssets(){return this.getCachedSingleton(qn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){if(super(t,ao.type),this.editAsset=n=>{if(!this.assetRepo||!this.appAssets||!this.sandbox)return;const r=this.assetRepo.get(n);if(!r){this.warn("Unable to find asset by id: "+n);return}this.appAssets.editingAsset=r,this.sandbox.state=Ht.EDIT_ASSET},this.appObjects.registerSingleton(this),this.assetRepo=t.getComponent(Kn.type),!this.assetRepo){this.error("UC added to an App Object that does not have AssetRepo");return}}}function Pv(e,t){const n=ao.get(t);if(!n){t.submitWarning("editAppAsset","Unable to find EditAppAssetUC");return}n.editAsset(e)}class oo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(oo.type,t)}}oo.type="GetAppAssetsUC";function Fv(e){return new Uv(e)}class Uv extends oo{get getAssetsUC(){var t;return(t=this.getCachedSingleton(Ja.type))==null?void 0:t.getAssets}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){if(super(t,oo.type),this.getAppAssets=n=>{const r=this.appAssets,i=this.getAssetsUC,s=this.assetRepo;return!r||!i||!s?Promise.reject():new Promise((a,o)=>{i(n).then(c=>{c.forEach(u=>{s.addFromDTO(u),r.add(u.id)}),a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this),this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("UC added to an App Object that does not have AppAssetsEntity");return}}}function Bv(e,t){const n=oo.get(t);if(!n){t.submitWarning("getAppAssets","Unable to find GetAppAssetsUC");return}n.getAppAssets(e)}class lo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(lo.type,t)}}lo.type="NewAppAssetUC";function Hv(e){return new $v(e)}class $v extends lo{get postNewAsset(){var t;return(t=this.getCachedSingleton(zs.type))==null?void 0:t.doPost}get assetRepo(){return this.getCachedSingleton(Kn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get spinnerFactory(){return this.getCachedSingleton(cr.type)}get alertFactory(){return this.getCachedSingleton(lr.type)}constructor(t){if(super(t,lo.type),this.create=n=>{const r=this.appAssets,i=this.postNewAsset,s=this.sandbox,a=this.assetRepo;return!r||!i||!s||!a?Promise.reject():new Promise(o=>{var l;const{description:c,file:u,name:p}=n,h={description:c,name:p,file:u,ownerID:s.appID,ownerType:"app"},y=(l=this.spinnerFactory)==null?void 0:l.make({title:"New App Asset",message:"Posting new app asset..."});i(h).then(E=>{r.add(E.id);const T=a.assetFactory(E.id);T.setFile(u),T.description=c,T.name=p,T.filename=E.filename,a.add(T),this.sandbox.state=Ht.MOUNTED,y==null||y.close(),o()}).catch(E=>{var S;this.error("create new asset error: "+E.message),y==null||y.close();const T={buttonLabel:"OK",message:`Something went wrong when creating a new app asset. Check the console. ${E.message}`,title:"New App Asset Error"};(S=this.alertFactory)==null||S.make(T),o()})})},this.appObjects.registerSingleton(this),this.appAssets=t.getComponent(qn.type),!this.appAssets){this.error("UC added to an App Object that does not have AppAssetsEntity");return}}}function Gv(e,t){const n=lo.get(t);return n?n.create(e):(t.submitWarning("newAppAsset","Unable to find NewAppAssetUC"),Promise.reject())}function jv(e){const t=qn.get(e);t?t.showArchived=!t.showArchived:e.submitWarning("toggleShowArchivedAssets","Unable to find AppAssetsEntity")}class co extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAppAssetMetaUC.get","Unable to find app object");return}const i=r.getComponent(co.type);if(!i){n.submitWarning("UpdateAppAssetMetaUC.get","App Object does not have UpdateAssetMetaUC");return}return i}}co.type="UpdateAppAssetMetaUC";function zv(e){return new Vv(e)}class Vv extends co{get asset(){return this.getCachedLocalComponent(Sr.type)}get spinnerFactory(){return this.getCachedSingleton(cr.type)}get patchAssetMeta(){var t;return(t=this.getCachedSingleton(no.type))==null?void 0:t.doPatch}get alertFactory(){return this.getCachedSingleton(lr.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,co.type),this.updateMeta=n=>{var u;const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));const i=this.patchAssetMeta;if(!i)return Promise.reject(new Error("No Patch UC"));const{archived:s,description:a,name:o}=n,c=(u=this.spinnerFactory)==null?void 0:u.make({title:"Asset Meta",message:"Updating asset's meta..."});return new Promise((p,h)=>{i({archived:s,description:a,id:r.id,name:o}).then(()=>{r.archived=s,r.name=o,r.description=a,c==null||c.close(),this.sandbox&&(this.sandbox.state=Ht.MOUNTED),p()}).catch(y=>{var E;this.error("Patch asset error: "+y.message),c==null||c.close();const l={buttonLabel:"OK",message:`Something went wrong when updating the assets meta. Check the console. ${y.message}`,title:"Update Asset Error"};(E=this.alertFactory)==null||E.make(l),p()})})}}}function Wv(e,t,n){const r=co.get(t,n);if(!r){n.submitWarning("updateAppAssetMeta","Unable to find UpdateAssetMetaUC");return}r.updateMeta(e)}class uo extends k.AppObjectUC{static get(t,n){const r=n.get(t);if(!r){n.submitWarning("UpdateAssetFileUC.get","Unable to find app object");return}const i=r.getComponent(uo.type);if(!i){n.submitWarning("UpdateAssetFileUC.get","App Object does not have UpdateAssetFileUC");return}return i}}uo.type="UpdateAssetFileUC";function qv(e){return new Kv(e)}class Kv extends uo{get patchAssetFile(){var t;return(t=this.getCachedSingleton(eo.type))==null?void 0:t.doPatch}constructor(t){super(t,uo.type),this.updateFile=n=>{const r=this.asset;if(!r)return Promise.reject(new Error("No Asset Entity"));const i=this.patchAssetFile;if(!i)return Promise.reject();const s=cr.make({title:"Asset File",message:"Updating asset's file..."},this.appObjects);return new Promise((a,o)=>{i(r.id,n).then(c=>{r.setFile(n),r.filename=c,s==null||s.close(),a()}).catch(c=>{this.error("Patch asset file error: "+c.message),s==null||s.close();const u={buttonLabel:"OK",message:`Something went wrong when updating the asset's file. Check the console. ${c.message}`,title:"Update Asset File Error"};lr.make(u,this.appObjects),a()})})},this.asset=t.getComponent(Sr.type),this.asset||this.error("UC has been added to an App Object that does not have ArchiveAssetUC")}}function Yv(e,t,n){const r=uo.get(t,n);if(!r){n.submitWarning("updateAssetFile","Unable to find UpdateAssetFileUC");return}r.updateFile(e)}class po extends k.AppObjectUC{static get(t){return k.getSingletonComponent(po.type,t)}}po.type="GetAssetBlobURLUC";function Xv(e){return new Zv(e)}class Zv extends po{get assetRepo(){return this.getCachedSingleton(Kn.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(js.type))==null?void 0:t.doFetch}get getAsset(){var t;return(t=this.getCachedSingleton(Qr.type))==null?void 0:t.getAsset}get getAssetFromCache(){var t;return(t=this.getCachedSingleton(Ks.type))==null?void 0:t.getAsset}get storeAssetInCache(){var t;return(t=this.getCachedSingleton(Ys.type))==null?void 0:t.storeAsset}constructor(t){super(t,po.type),this.getAssetBlobURL=(n,r=!0)=>{const i=this.assetRepo,s=this.getAsset,a=this.fetchAssetFile,o=this.getAssetFromCache,c=this.storeAssetInCache;if(!i||!s||!a)return Promise.reject();if(!r)return new Promise((p,h)=>{this.fetchAssetNormally(n,p,h)});const u=i.get(n);return u&&u.blobURL?Promise.resolve(u.blobURL):new Promise((p,h)=>{let y;o?o(n).then(l=>l?s(n).then(E=>{y=E;const T=E.filename||"cached-asset";return new File([l],T,{type:l.type})}):s(n).then(E=>(E.isFetchingFile=!0,E.fetchError=void 0,y=E,a(E)))).then(l=>{if(y&&(y.setFile(l),y.isFetchingFile=!1,c&&c(n,new Blob([l],{type:l.type}),l.type).catch(E=>{this.warn(`Failed to cache asset: ${E.message}`)}),y.blobURL)){p(y.blobURL);return}h(new Error("Blob URL is empty"))}).catch(l=>{this.warn(`Cache error or fetch error: ${l.message}`),this.fetchAssetNormally(n,p,h)}):this.fetchAssetNormally(n,p,h)})},this.fetchAssetNormally=(n,r,i)=>{const s=this.getAsset,a=this.fetchAssetFile,o=this.storeAssetInCache;if(!s||!a){i(new Error("Required dependencies not found"));return}let c;s(n).then(u=>(u.isFetchingFile=!0,u.fetchError=void 0,c=u,a(u))).then(u=>{if(c&&(c.setFile(u),c.isFetchingFile=!1,o&&o(n,new Blob([u],{type:u.type}),u.type).catch(p=>{this.warn(`Failed to cache asset: ${p.message}`)}),c.blobURL)){r(c.blobURL);return}i(new Error("Blob URL is empty"))}).catch(u=>{c&&(c.fetchError=u,c.isFetchingFile=!1),i(u)})},this.appObjects.registerSingleton(this)}}class fo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(fo.type,t)}}fo.type="NewAssetUC";function Qv(e){return new Jv(e)}class Jv extends fo{get postNewAsset(){var t;return(t=this.getCachedSingleton(zs.type))==null?void 0:t.doPost}get assetRepo(){return this.getCachedSingleton(Kn.type)}constructor(t){super(t,fo.type),this.create=n=>{const r=this.postNewAsset,i=this.assetRepo;if(!r||!i)return Promise.reject(new Error("Missing dependencies"));const{description:s,file:a,name:o,owner:c}=n;return r({description:s,name:o,file:a,ownerID:c}).then(p=>{const h=i.assetFactory(p.id);return h.setFile(a),h.description=s,h.name=o,h.filename=p.filename,i.add(h),p.id})},this.appObjects.registerSingleton(this)}}class Zl extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Zl.type,t)}}Zl.type="PrefetchAssetsUC";function ex(e){return new tx(e)}class tx extends Zl{get stateMachine(){return this.getCachedSingleton(bt.type)}get fetchAssetFile(){var t;return(t=this.getCachedSingleton(Xs.type))==null?void 0:t.getAssetFile}constructor(t){super(t,Zl.type),this.prefetchAssets=async()=>{const n=this.fetchAssetFile;if(!this.stateMachine||!n)return Promise.reject();const r=this.stateMachine.states.reduce((s,a)=>{var c;const o=(c=this.stateMachine)==null?void 0:c.getStateByID(a);return o?s.concat(o.assets):[]},[]),i=Array.from(new Set(r));return new Promise((s,a)=>{const o=i.map(c=>n(c));Promise.all(o).then(()=>{s()}).catch(c=>{this.warn(c.message),a(c)})})},this.appObjects.registerSingleton(this)}}class nx extends k.DomainFactory{constructor(t,n){super(t),this.factoryName="SandboxAssetsFactory",this.assetRepoAO=n.getOrCreate("Asset Repository"),this.appAssetsAO=n.getOrCreate("App Assets")}setupEntities(){const t=LR(this.assetRepoAO);t.assetFactory=this.makeAssetFactory(),DR(this.appAssetsAO)}setupUCs(){Lv(this.assetRepoAO),Xv(this.assetRepoAO),xv(this.assetRepoAO),Rv(this.assetRepoAO),ex(this.assetRepoAO),Qv(this.assetRepoAO),Hv(this.appAssetsAO),Fv(this.appAssetsAO)}setupPMs(){PR(this.appAssetsAO),WR(this.appAssetsAO),zR(this.appAssetsAO)}finalSetup(){}makeAssetFactory(){return t=>{const n=this.appObjects.getOrCreate(t),r=s4(n);return av(n),lv(n),wv(n),qv(n),zv(n),UR(n),GR(n),r}}}function rx(e){const t=e.getOrCreate("SandboxAssets");return new nx(t,e)}class th extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_BLOB"}}th.type="GetAssetBlobURLHandler";function ix(e){return new sx(e)}class sx extends th{get getBlobUC(){return this.getCachedSingleton(po.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,th.type),this.action=(r,i)=>{if(!this.getBlobUC){this.error("Unable to find GetAssetBlobURLUC"),i(void 0);return}this.getBlobUC.getAssetBlobURL(r).then(s=>{i(s)}).catch(s=>{this.appObjects.submitError("GetAssetBlob",s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class nh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_APP_ASSET_URL"}}nh.type="GetAssetFolderURLHandler";function g4(e){return new ax(e)}class ax extends nh{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,nh.type),this.action=r=>{if(!this.app){this.error("No AppEntity"),r("");return}r(this.app.appAssetFolderURL??"")},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class rh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_META"}}rh.type="GetAssetMetaHandler";function ox(e){return new lx(e)}class lx extends rh{get getAssetUC(){return this.getCachedSingleton(Qr.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,rh.type),this.action=(r,i)=>{if(!this.getAssetUC){this.error("Unable to find GetAssetUC"),i(void 0);return}this.getAssetUC.getAsset(r).then(s=>{const{id:a,name:o,description:c}=s;i({id:a,name:o,description:c})}).catch(s=>{this.error(s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ih extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_STREAM_URL"}}ih.type="GetAssetStreamURLHandler";function cx(e){return new ux(e)}class ux extends ih{get getAssetUC(){try{return this.getCachedSingleton(Qr.type)}catch{return}}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,ih.type),this.action=(r,i)=>{if(!this.getAssetUC){this.error("Unable to find GetAssetUC"),i(void 0);return}this.getAssetUC.getAsset(r).then(s=>{i(s.fileURL?s.fileURL:void 0)}).catch(s=>{this.error(s.message),i(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class dx extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_ASSET_FOR_OWNER"}}dx.type="GetAssetsForOwnerHandler";class sh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GET_LINKED_ASSETS"}}sh.type="GetLinkedAssetsHandler";function px(e){return new fx(e)}class fx extends sh{get getAssetUC(){return this.getCachedSingleton(Qr.type)}castPayloadV1(t){const n=t;if(!n.assetID||!n.callback||!n.type)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,sh.type),this.action=(r,i,s)=>{const a=this.getAssetUC;if(!a){this.error("Unable to find GetAssetUC"),s(void 0);return}a.getAsset(r).then(o=>{const{linkedAssets:c}=o,u=[];return c.forEach(p=>{p.type===i&&u.push(a.getAsset(p.id))}),Promise.all(u)}).then(o=>{const c=o.map(u=>({description:u.description,id:u.id,name:u.name}));s(c)}).catch(o=>{this.appObjects.submitError("GetLinkedAssets",o.message),s(void 0)})},this.handleRequest=(r,i)=>{if(r===1){const{assetID:s,callback:a,type:o}=this.castPayloadV1(i);this.action(s,o,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ho extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ho.type,t)}}ho.type="CancelEditingUC";function hx(e){return new mx(e)}class mx extends ho{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,ho.type),this.cancel=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("App does not have DispatchIsAuthoringUC");return}const r=Zr.getByID(this.sandbox.appID,this.appObjects);if(!r){this.error("App does not have DispatchSetStateUC");return}if(this.editStateEntity.cancelEditState(),n.doDispatch(!1),this.stateMachine.activeState){const i=this.stateMachine.getStateByID(this.stateMachine.activeState);if(i){const s=this.stateMachine.states.length<=1,a=this.stateMachine.nextState!==void 0,o=this.stateMachine.previousState!==void 0,c={finalState:i.stateData,hideNavigation:s,hasNextSlide:a,hasPreviousSlide:o};r.doDispatch(c)}}else this.sandbox.state=Ht.MOUNTED},this.appObjects.registerSingleton(this)}}class Yn extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Yn.type,t)}}Yn.type="ZSpaceHostEntity";function gx(e){return new Ex(e)}class Ex extends Yn{get isEnabled(){return this.memoizedEnabled.val}set isEnabled(t){this.memoizedEnabled.val=t}get isSupported(){return this.memoizedIsSupported.val}set isSupported(t){this.memoizedIsSupported.val=t}get emulate(){return this.memoizedEmulate.val}set emulate(t){this.memoizedEmulate.val=t}get isActive(){return this.memoizedActive.val}set isActive(t){this.memoizedActive.val=t}setSupportedAppVersions(t){this.supportedVersionLookup=t}isAppSupported(t,n){const r=this.supportedVersionLookup.get(t);return r?n.major>r.major?!0:n.major<r.major?!1:n.minor>r.minor?!0:!(n.minor<r.minor||n.patch<r.patch):!1}constructor(t){super(t,Yn.type),this.memoizedEnabled=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedIsSupported=new k.MemoizedBoolean(!1,this.notifyOnChange),this.memoizedEmulate=new k.MemoizedBoolean(!0,this.notifyOnChange),this.memoizedActive=new k.MemoizedBoolean(!1,this.notifyOnChange),this.supportedVersionLookup=new Map,this.appObjects.registerSingleton(this)}}class _i extends k.AppObjectUC{static get(t){return k.getSingletonComponent(_i.type,t)}}_i.type="StopZSpaceUC";class ji extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ji.type,t)}}ji.type="StartZSpaceUC";function bx(e){return new Tx(e)}class Tx extends ji{get zSpace(){return this.getCachedSingleton(Yn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get stopUC(){return this.getCachedSingleton(_i.type)}constructor(t){super(t,ji.type),this.startZSpace=()=>{if(!this.zSpace||!this.sandbox||!this.stopUC)return Promise.reject("Missing Components");const n=_s.getByID(this.sandbox.appID,this.appObjects);if(!n)return Promise.reject("Missing Dispatcher");if(this.zSpace.isActive)return Promise.resolve();if(this.zSpace.emulate)return this.sandbox.state===Ht.PLAYING&&n.doDispatch({},!0),this.zSpace.isActive=!0,Promise.resolve();if(!this.zSpace.isSupported)return Promise.reject(new Error("ZSpace is not supported"));const r=this.zSpace,i=this.sandbox,s=this.stopUC;return new Promise((a,o)=>{navigator.xr.requestSession("immersive-vr").then(c=>{c.addEventListener("end",s.stopZSpace,{once:!0}),r.session=c,i.state===Ht.PLAYING&&n.doDispatch(c,!1),r.isActive=!0,a()}).catch(c=>{o(c)})})},this.appObjects.registerSingleton(this)}}function yx(e){return new Sx(e)}class Sx extends _i{get zSpace(){return this.getCachedSingleton(Yn.type)}get sandbox(){return this.getCachedSingleton(qe.type)}constructor(t){super(t,_i.type),this.stopZSpace=()=>{var r,i;if(!this.sandbox||!this.zSpace)return;const n=Is.getByID(this.sandbox.appID,this.appObjects);if(!n){this.warn("Unable to find DispatchStopZSpaceUC");return}this.zSpace.isActive&&(n.doDispatch(),(r=this.zSpace.session)==null||r.removeEventListener("end",this.stopZSpace),(i=this.zSpace.session)==null||i.end(),this.zSpace.session=void 0,this.zSpace.isActive=!1)},this.appObjects.registerSingleton(this)}}class mo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(mo.type,t)}}mo.type="ConsumeStateUC";function Ax(e){return new Cx(e)}class Cx extends mo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}get startZSpaceUC(){return this.getCachedSingleton(ji.type)}constructor(t){super(t,mo.type),this.consume=n=>{var r;if(!this.sandbox||!this.stateMachine||!this.editStateEntity||!this.startZSpaceUC){this.error("Missing component");return}this.editStateEntity.cancelEditState(),this.stateMachine.hasState(n)?((r=this.stateMachine)==null||r.setActiveStateByID(n),this.sandbox&&(this.sandbox.state=Ht.PLAYING),this.sandbox.startInZSpace&&this.startZSpaceUC.startZSpace()):this.error("Unable to find state by id "+n)},this.appObjects.registerSingleton(this)}}class go extends k.AppObjectUC{static get(t){return k.getSingletonComponent(go.type,t)}}go.type="DeleteStateUC";function _x(e){return new Ix(e)}class Ix extends go{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,go.type),this.deleteState=n=>{if(this.stateMachine)if(this.stateMachine.getStateByID(n),this.stateMachine.hasState(n))this.stateMachine.deleteState(n);else{this.warn("Unable to find state to delete");return}},this.appObjects.registerSingleton(this)}}class Eo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Eo.type,t)}}Eo.type="DuplicateStateUC";function Nx(e){return new Rx(e)}class Rx extends Eo{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,Eo.type),this.duplicateState=n=>{if(!this.stateMachine)return;const r=this.stateMachine.getStateByID(n);if(!r){this.warn("Unable to find state to duplicate");return}const i=this.stateMachine.createNewState(),s=r.getDTO();s.id=i.id,s.name=s.name+" Copy",i.setDTO(s)},this.appObjects.registerSingleton(this)}}class vx extends k.AppObjectUC{static get(t){return t.getComponent(this.type)}static getById(t,n){var r;return(r=n.get(t))==null?void 0:r.getComponent(this.type)}}vx.type="EditStateNameUC";class bo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(bo.type,t)}}bo.type="EditActiveStateUC";function xx(e){return new Ox(e)}class Ox extends bo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,bo.type),this.editActiveState=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchIsAuthoringUC");return}const r=Zr.getByID(this.sandbox.appID,this.appObjects);if(!r){this.error("Unable to find DispatchIsAuthoringUC");return}if(!this.stateMachine.activeState){this.error("No active slide");return}const i=this.stateMachine.getStateByID(this.stateMachine.activeState);if(!i){this.warn("Unable to find state");return}const s=this.stateMachine.states.length<=1,a=this.stateMachine.nextState!==void 0,o=this.stateMachine.previousState!==void 0,c={finalState:i.stateData,hideNavigation:s,hasNextSlide:a,hasPreviousSlide:o};r.doDispatch(c),n.doDispatch(!0),this.editStateEntity.startEditing(i)},this.appObjects.registerSingleton(this)}}class To extends k.AppObjectUC{static get(t){return k.getSingletonComponent(To.type,t)}}To.type="EditStateUC";function wx(e){return new Dx(e)}class Dx extends To{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}edit(t){if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;const n=this.stateMachine.getStateByID(t);if(!n){this.warn("Unable to find state");return}this.stateMachine.setActiveStateByID(t),this.editStateEntity.startEditing(n),this.sandbox.state=Ht.PLAYING}constructor(t){super(t,To.type),this.appObjects.registerSingleton(this)}}class zi extends k.AppObjectUC{static get(t){return k.getSingletonComponent(zi.type,t)}}zi.type="EndActivityUC";class Zs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Zs.type,t)}}Zs.type="EmulateZSpacePM";function kx(e){return new Lx(e)}class Lx extends Zs{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Zs.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.emulate)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const Mx={defaultVM:!1,subscribe:(e,t)=>{const n=Zs.get(e);if(!n){e.submitError("emulateZSpaceAdapter","Unable to find EmulateZSpacePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Zs.get(e);if(!n){e.submitError("emulateZSpaceAdapter","Unable to find EmulateZSpacePM");return}n.removeView(t)}};class Qs extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Qs.type,t)}}Qs.type="ZSpaceIsActivePM";function Px(e){return new Fx(e)}class Fx extends Qs{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Qs.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.isActive)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const Ux={defaultVM:!1,subscribe:(e,t)=>{const n=Qs.get(e);if(!n){e.submitError("zSpaceIsActiveAdapter","Unable to find ZSpaceIsActivePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Qs.get(e);if(!n){e.submitError("zSpaceIsActiveAdapter","Unable to find ZSpaceIsActivePM");return}n.removeView(t)}};class Js extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Js.type,t)}}Js.type="ZSpaceIsSupportedPM";function Bx(e){return new Hx(e)}class Hx extends Js{vmsAreEqual(t,n){return t===n}get zSpace(){return this.getCachedSingleton(Yn.type)}constructor(t){super(t,Js.type),this.defaultVM=!1,this.formVM=()=>{this.zSpace&&this.doUpdateView(this.zSpace.isSupported)};const n=this.zSpace;if(!n){this.error("PM Has been added to an app object that does not have a ZSpaceHostEntity");return}this.observeEntity(n)}}const E4={defaultVM:!1,subscribe:(e,t)=>{const n=Js.get(e);if(!n){e.submitError("zSpaceIsSupportedAdapter","Unable to find ZSpaceIsSupportedPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=Js.get(e);if(!n){e.submitError("zSpaceIsSupportedAdapter","Unable to find ZSpaceIsSupportedPM");return}n.removeView(t)}};function $x(e,t){const n=Yn.get(e);if(!n){e.submitError("setZSpaceIsSupported","Unable to find ZSpaceHostEntity");return}n.isSupported=t}function Gx(e){const t=ji.get(e);if(!t){e.submitError("startZSpace","Unable to find StartZSpaceUC");return}t.startZSpace()}function jx(e){const t=_i.get(e);if(!t){e.submitError("stopZSpace","Unable to find StartZSpaceUC");return}t.stopZSpace()}function zx(e){const t=Yn.get(e);if(!t){e.submitError("toggleEmulateZSpace","Unable to find ZSpaceHostEntity");return}t.emulate=!t.emulate}class Vx extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxZSpaceFactory"}setupEntities(){gx(this.appObject)}setupUCs(){yx(this.appObject),bx(this.appObject)}setupPMs(){kx(this.appObject),Px(this.appObject),Bx(this.appObject)}finalSetup(){}}function Wx(e){const t=e.getOrCreate("zSpace");return new Vx(t)}function qx(e){return new Kx(e)}class Kx extends zi{get zSpace(){return this.getCachedSingleton(Yn.type)}get stopZSpaceUC(){return this.getCachedSingleton(_i.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}end(){var t,n,r;(t=this.zSpace)!=null&&t.isActive&&((n=this.stopZSpaceUC)==null||n.stopZSpace()),(r=this.stateMachine)==null||r.clearActiveState(),this.sandbox&&(this.sandbox.state=Ht.MOUNTED)}constructor(t){super(t,zi.type)}}class yo extends k.AppObjectUC{static get(t){return k.getSingletonComponent(yo.type,t)}}yo.type="NewStateUC";function Yx(e){return new Xx(e)}class Xx extends yo{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,yo.type),this.createState=()=>{!this.sandbox||!this.stateMachine||!this.editStateEntity||(this.stateMachine.clearActiveState(),!this.editStateEntity.startNewState())||(this.sandbox.state=Ht.PLAYING)},this.appObjects.registerSingleton(this)}}class So extends k.AppObjectUC{static get(t){return k.getSingletonComponent(So.type,t)}}So.type="SaveAuthoringUC";function Zx(e){return new Qx(e)}class Qx extends So{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}get editStateEntity(){return this.getCachedSingleton(Wn.type)}constructor(t){super(t,So.type),this.newStateDefaultName="New State",this.saveAuthoring=()=>{if(!this.sandbox||!this.stateMachine||!this.editStateEntity)return;if(this.editStateEntity.stateValidationMessage){window.alert(this.editStateEntity.stateValidationMessage);return}this.editStateEntity.isNewState&&this.editStateEntity.editingState&&(this.stateMachine.setActiveStateByID(this.editStateEntity.editingState.id),this.editStateEntity.editingState.name="New State"),this.editStateEntity.finishEditing();const n=Xr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchIsAuthoringUC");return}n.doDispatch(!1)},this.appObjects.registerSingleton(this)}}class Ii extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ii.type,t)}}Ii.type="TransitionToStateUC";function Jx(e){return new eO(e)}class eO extends Ii{get sandbox(){return this.getCachedSingleton(qe.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}transitionToState(t){if(!this.sandbox||!this.stateMachine)return;const n=Zr.getByID(this.sandbox.appID,this.appObjects);if(!n){this.error("Unable to find DispatchSetStateUC");return}const r=this.stateMachine,i=this.stateMachine.getStateByID(t);if(!i){this.warn(`Unable to find state ${t}`);return}r.setActiveStateByID(t);const s=r.transitionDuration,a=r.states.length<=1,o=r.nextState!==void 0,c=r.previousState!==void 0,u={finalState:i.stateData,duration:s,hideNavigation:a,hasNextSlide:o,hasPreviousSlide:c};n.doDispatch(u)}constructor(t){super(t,Ii.type),this.appObjects.registerSingleton(this)}}class Ao extends k.AppObjectUC{static get(t){return k.getSingletonComponent(Ao.type,t)}}Ao.type="SavePersistentStatesUC";function tO(e){return new nO(e)}class nO extends Ao{get stateMachine(){return this.getCachedSingleton(bt.type)}constructor(t){super(t,Ao.type),this.saveLocally=()=>{if(!this.stateMachine)return;const n=[];this.stateMachine.states.forEach(a=>{var c;const o=(c=this.stateMachine)==null?void 0:c.getStateByID(a);if(o){const u={assets:o.assets,data:o.stateData,id:o.id,name:o.name};n.push(u)}});const r=JSON.stringify(n),i=document.createElement("a"),s=new Blob([r],{type:"text/plain"});i.href=URL.createObjectURL(s),i.download="persistentStates.json",i.click()},this.appObjects.registerSingleton(this)}}function rO(e,t){const n=bt.get(t);if(!n){t.submitError("setSandboxStatesFromData","Unable to find StateMachineEntity");return}const r=qe.get(t);if(!r){t.submitWarning("setSandboxStatesFromData","Could not find AppSandboxEntity");return}const i=[];e.forEach(s=>{const{data:a,id:o,name:c,assets:u}=s,p=n.stateFactory(o);p.setStateData(a),p.name=c,p.appID=r.appID,p.assets=u,i.push(p)}),n.setStates(i)}class ah extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GO_TO_NEXT_STATE"}}ah.type="GoToNextStateHandler";function iO(e){return new sO(e)}class sO extends ah{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}get endActivityUC(){return this.getCachedSingleton(zi.type)}constructor(t){super(t,ah.type),this.payloadVersion=1,this.action=()=>{var i,s,a;const r=(i=this.stateMachine)==null?void 0:i.nextState;r?(s=this.transitionToStateUC)==null||s.transitionToState(r):(a=this.endActivityUC)==null||a.end()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class oh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="GO_TO_PREVIOUS_STATE"}}oh.type="GoToPreviousStateHandler";function aO(e){return new oO(e)}class oO extends oh{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}constructor(t){super(t,oh.type),this.payloadVersion=1,this.action=()=>{var i,s;const r=(i=this.stateMachine)==null?void 0:i.previousState;r&&((s=this.transitionToStateUC)==null||s.transitionToState(r))},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}const lO={hasChanges:!1,isEditing:!1,isNewState:!1};class ea extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ea.type,t)}}ea.type="EditingStatePM";function cO(e){return new uO(e)}class uO extends ea{get editingEntity(){return this.getCachedSingleton(Wn.type)}vmsAreEqual(t,n){return!(t.isEditing!==n.isEditing||t.isNewState!==n.isNewState||t.hasChanges!==n.hasChanges)}constructor(t){var n;super(t,ea.type),this.onEntityChange=()=>{if(!this.editingEntity)return;const r=this.editingEntity.isEditing,i=this.editingEntity.isNewState,s=this.editingEntity.somethingHasChanged;this.doUpdateView({isEditing:r,isNewState:i,hasChanges:s})},(n=this.editingEntity)==null||n.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const b4={defaultVM:lO,subscribe:(e,t)=>{const n=ea.get(e);if(!n){e.submitError("editingStateAdapter","Unable to find EditingStatePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ea.get(e);if(!n){e.submitError("editingStateAdapter","Unable to find EditingStatePM");return}n.removeView(t)}};class ta extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ta.type,t)}}ta.type="HostStateMachinePM";function dO(e){return new pO(e)}class pO extends ta{vmsAreEqual(t,n){if(t.activeSlideID!==n.activeSlideID||t.activeSlideName!==n.activeSlideName||t.nextSlideID!==n.nextSlideID||t.previousSlideID!==n.previousSlideID||t.states.length!==n.states.length||t.isSingleSlide!==n.isSingleSlide)return!1;for(let r=0;r<t.states.length;r++)if(t.states[r]!==n.states[r])return!1;return!0}constructor(t){if(super(t,ta.type),this.onEntityChange=()=>{var s;if(!this.stateMachine)return;const n=[...this.stateMachine.states],r=this.stateMachine.activeState?(s=this.stateMachine.getStateByID(this.stateMachine.activeState))==null?void 0:s.name:void 0,i={activeSlideID:this.stateMachine.activeState,activeSlideName:r,nextSlideID:this.stateMachine.nextState,previousSlideID:this.stateMachine.previousState,states:n,isSingleSlide:n.length===1};this.doUpdateView(i)},this.stateMachine=t.getComponent(bt.type),!this.stateMachine){this.error("PM has been added to an App Object that does not have a HostStateMachine");return}this.stateMachine.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const fO={activeSlideID:void 0,activeSlideName:void 0,nextSlideID:void 0,previousSlideID:void 0,states:[],isSingleSlide:!1};class bi extends k.AppObjectPM{static getById(t,n){var r;return(r=n.get(t))==null?void 0:r.getComponent(bi.type)}}bi.type="HostStatePM";bi.defaultVM={id:"",name:"",data:{},isActive:!1,appName:"",canBumpBackwards:!1,canBumpForward:!1,index:-1,streamState:Uc.INIT};function hO(e){return new mO(e)}class mO extends bi{get hostStateEntity(){return this.getCachedLocalComponent(Wa.type)}get hostStateMachine(){return this.getCachedSingleton(bt.type)}get appRepo(){return this.getCachedSingleton(yi.type)}vmsAreEqual(t,n){if(t.id!==n.id||t.name!==n.name||t.isActive!==n.isActive||t.appName!==n.appName||t.canBumpBackwards!==n.canBumpBackwards||t.canBumpForward!==n.canBumpForward||t.index!==n.index||t.streamState!==n.streamState)return!1;const r=JSON.stringify(t.data),i=JSON.stringify(n.data);return r===i}updateViewModel(){const t=this.hostStateMachine.activeState===this.hostStateEntity.id;let n="";try{const c=this.appRepo.getApp(this.hostStateEntity.appID);c&&(n=c.name)}catch{}let r=!1,i=!1,s=-1;const a=this.hostStateMachine.getStateIndex(this.hostStateEntity.id);a!==void 0&&(s=a,r=a>0,i=a<this.hostStateMachine.stateCount-1);const o={id:this.hostStateEntity.id,name:this.hostStateEntity.name,data:this.hostStateEntity.stateData,isActive:t||!1,appName:n,canBumpBackwards:r,canBumpForward:i,index:s,streamState:this.hostStateEntity.streamState};this.doUpdateView(o)}constructor(t){var n,r;super(t,bi.type),this.onEntityChange=()=>{this.updateViewModel()},this.onStateMachineChange=()=>{this.updateViewModel()},this.dispose=()=>{var i,s;(i=this.hostStateEntity)==null||i.removeChangeObserver(this.onEntityChange),(s=this.hostStateMachine)==null||s.removeChangeObserver(this.onStateMachineChange),super.dispose()},(n=this.hostStateEntity)==null||n.addChangeObserver(this.onEntityChange),(r=this.hostStateMachine)==null||r.addChangeObserver(this.onStateMachineChange),this.updateViewModel()}}const fu={defaultVM:fO,subscribe:(e,t)=>{const n=ta.get(e);if(!n){e.submitError("hostStateMachinePMAdapter","Unable to find HostStateMachinePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ta.get(e);if(!n){e.submitError("hostStateMachinePMAdapter","Unable to find HostStateMachinePM");return}n.removeView(t)}},gO={defaultVM:bi.defaultVM,subscribe:(e,t,n)=>{if(!e)return;const r=bi.getById(e,t);if(!r){t.submitError("hostStateAdapter",`Unable to find HostStatePM for ID: ${e}`);return}r.addView(n)},unsubscribe:(e,t,n)=>{var r;e&&((r=bi.getById(e,t))==null||r.removeView(n))}};function EO(e){const t=ho.get(e);if(!t){e.submitWarning("cancelEditing","Unable to find CancelEditingUC");return}t.cancel()}function bO(e,t){const n=mo.get(t);if(!n){t.submitWarning("consumeState","Unable to find ConsumeStateUC");return}n.consume(e)}function TO(e,t){const n=go.get(t);if(!n){t.submitWarning("duplicateState","Unable to find DeleteStateUC");return}n.deleteState(e)}function yO(e,t){const n=Eo.get(t);if(!n){t.submitWarning("duplicateState","Unable to find DuplicateStateUC");return}n.duplicateState(e)}function SO(e){const t=bo.get(e);if(!t){e.submitWarning("editActiveState Controller","Unable to find EditActiveStateUC");return}t.editActiveState()}function AO(e,t){const n=To.get(t);if(!n){t.submitWarning("editState","Unable to find EditStateUC");return}n.edit(e)}function CO(e){const t=zi.get(e);if(!t){e.submitWarning("endActivity Controller","Unable to find EndActivityUC");return}t.end()}function _O(e){const t=yo.get(e);if(!t){e.submitWarning("newState","Unable to find NewStateUC");return}t.createState()}function IO(e){const t=So.get(e);if(!t){e.submitWarning("saveAuthoring Controller","Unable to find SaveAuthoringUC");return}t.saveAuthoring()}function NO(e,t){const n=bt.get(e);if(!n){e.submitError("setTransitionDuration","Unable to find HostStateMachine");return}n.transitionDuration=t}function T4(e,t){const n=Ii.get(t);if(!n){t.submitWarning("transitionToState Controller","Unable to find TransitionToStateUC");return}n.transitionToState(e)}function RO(e){const t=Ao.get(e);if(!t){e.submitWarning("savePersistentStates","Unable to find SavePersistentStatesUC");return}t.saveLocally()}class vO extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxStateMachineFactory",this.stateFactory=n=>{const r=this.appObjects.getOrCreate(n),i=l4(r);return hO(r),i}}setupEntities(){const t=k6(this.appObject);M6(this.appObject),t.stateFactory=this.stateFactory}setupUCs(){hx(this.appObject),Ax(this.appObject),xx(this.appObject),wx(this.appObject),qx(this.appObject),Yx(this.appObject),Zx(this.appObject),Jx(this.appObject),_x(this.appObject),Nx(this.appObject),tO(this.appObject)}setupPMs(){cO(this.appObject),dO(this.appObject)}finalSetup(){}}function xO(e){const t=e.getOrCreate("State Machine");return new vO(t)}class lh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="HAS_NEXT_STATE"}}lh.type="HasNextStateHandler";function OO(e){return new wO(e)}class wO extends lh{get stateMachine(){return this.getCachedSingleton(bt.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,lh.type),this.action=r=>{if(!this.stateMachine){r(!1);return}this.stateMachine.nextState?r(!0):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ch extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="HAS_PREVIOUS_STATE"}}ch.type="HasPreviousStateHandler";function DO(e){return new kO(e)}class kO extends ch{get stateMachine(){return this.getCachedSingleton(bt.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,ch.type),this.action=r=>{if(!this.stateMachine){r(!1);return}this.stateMachine.previousState?r(!0):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class LO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="IS_ASSET_FILE_FETCHED"}}LO.type="IsAssetFetchedHandler";class uh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="IS_ZSPACE_AVAILABLE"}}uh.type="IsZSpaceAvailableHandler";function MO(e){return new PO(e)}class PO extends uh{get zSpace(){return this.getCachedSingleton(Yn.type)}castPayloadV1(t){const n=t;if(!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,uh.type),this.action=r=>{this.zSpace?r(this.zSpace.isSupported):r(!1)},this.handleRequest=(r,i)=>{if(r===1){const{callback:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class FO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="NEW_ACTIVITY_ASSET"}}FO.type="NewActivityAssetHandler";class dh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="APP_IS_READY"}}dh.type="OnAppIsReadyHandler";function UO(e){return new BO(e)}class BO extends dh{get app(){return this.getCachedLocalComponent(nr.type)}constructor(t){super(t,dh.type),this.action=()=>{if(!this.app){this.error("No App");return}this.app.state=Dn.READY},this.handleRequest=r=>{if(r===1)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class ph extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ON_STATE_CHANGE"}}ph.type="OnStateChangeHandler";function HO(e){return new $O(e)}class $O extends ph{get editStateEntity(){return this.getCachedSingleton(Wn.type)}castPayloadV1(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}castPayloadV2(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,2,JSON.stringify(t));return n}castPayloadV3(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,3,JSON.stringify(t));return n}castPayloadV4(t){const n=t;if(n.stateObject===void 0)throw new rn(this.requestType,3,JSON.stringify(t));return n}constructor(t){super(t,ph.type),this.action=(r,i,s,a)=>{if(!this.editStateEntity)return;const o=this.editStateEntity.editingState;if(!o||(o.setStateData(r),o.assets=i,this.editStateEntity.stateValidationMessage=s,!a))return;const c=GO.get(a.toUpperCase());c||this.warn(`Unable to parse ${a} into an expected response`),o.expectedResponse=c},this.handleRequest=(r,i)=>{if(r===1){const{stateObject:s}=this.castPayloadV1(i);this.action(s,[])}else if(r===2){const{stateObject:s,validationErrorMessage:a}=this.castPayloadV2(i);this.action(s,[],a)}else if(r===3){const{stateObject:s,assets:a,validationErrorMessage:o}=this.castPayloadV3(i);this.action(s,a,o)}else if(r===4){const{stateObject:s,assets:a,validationErrorMessage:o,responseType:c}=this.castPayloadV4(i);this.action(s,a,o,c)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}const GO=new Map([["HIT",In.HIT],["MULTIHIT",In.MULTIHIT],["NONE",In.NONE],["PROGRESS",In.PROGRESS],["QUALITY",In.QUALITY],["SCORE",In.SCORE]]);class fh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="ON_STATE_COMPLETED"}}fh.type="OnStateCompleteHandler";function jO(e){return new zO(e)}class zO extends fh{get stateMachine(){return this.getCachedSingleton(bt.type)}get transitionToStateUC(){return this.getCachedSingleton(Ii.type)}get endActivityUC(){return this.getCachedSingleton(zi.type)}constructor(t){super(t,fh.type),this.action=()=>{var i,s,a;const r=(i=this.stateMachine)==null?void 0:i.nextState;r?(s=this.transitionToStateUC)==null||s.transitionToState(r):(a=this.endActivityUC)==null||a.end()},this.handleRequest=r=>{if(r===1)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class hh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="REGISTER_EXTERNAL_STYLESHEETS"}}hh.type="RegisterExternalStyleSheetsHandler";function y4(e){return new VO(e)}class VO extends hh{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(n.stylesheets===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,hh.type),this.requestType="REGISTER_EXTERNAL_STYLESHEETS",this.action=r=>{this.app&&(r.forEach(i=>{var s;(s=this.app)==null||s.styles.push(i)}),this.app.notifyOnChange())},this.handleRequest=(r,i)=>{if(r===1){const{stylesheets:s}=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class WO extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="RESTORE_CURRENT_STATE"}}WO.type="RestoreCurrentStateHandler";class mh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_ALERT"}}mh.type="ShowAlertHandler";function qO(e){return new KO(e)}class KO extends mh{castPayloadV1(t){const n=t;if(n.title===void 0||n.message===void 0||n.closeButtonLabel===void 0||n.closeCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,mh.type),this.action=r=>{const{closeButtonLabel:i,closeCallback:s,message:a,title:o}=r;lr.make({buttonLabel:i,message:a,title:o,onClose:s},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class gh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_CONFIRM"}}gh.type="ShowConfirmHandler";function YO(e){return new XO(e)}class XO extends gh{castPayloadV1(t){const n=t;if(n.title===void 0||n.message===void 0||n.confirmButtonLabel===void 0||n.cancelButtonLabel===void 0||n.confirmCallback===void 0||n.cancelCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,gh.type),this.action=r=>{const{cancelButtonLabel:i,cancelCallback:s,confirmButtonLabel:a,confirmCallback:o,message:c,title:u}=r;$i.make({cancelButtonLabel:i,confirmButtonLabel:a,message:c,title:u,onCancel:s,onConfirm:o},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Eh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_MARKDOWN_EDITOR"}}Eh.type="ShowMarkDownEditorHandler";function ZO(e){return new QO(e)}class QO extends Eh{castPayloadV1(t){const n=t;if(n.initialText===void 0||n.submitCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Eh.type),this.action=r=>{const{initialText:i,submitCallback:s}=r;Hs.make({initialText:i,onConfirm:s},this.appObjects)},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class bh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_SELECT_MODEL"}}bh.type="ShowSelectModelHandler";function JO(e){return new e7(e)}class e7 extends bh{get assetPlugin(){return this.getCachedSingleton(Ai.type)}castPayloadV1(t){const n=t;if(n.callback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n.callback}constructor(t){super(t,bh.type),this.action=r=>{this.assetPlugin&&(this.assetPlugin.callback=r,this.assetPlugin.show=!0,$s.make(this.appObjects))},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Th extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SHOW_SPINNER"}}Th.type="ShowSpinnerHandler";function t7(e){return new n7(e)}class n7 extends Th{castPayloadV1(t){const n=t;if(n.message===void 0||n.title===void 0||n.closeCallback===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Th.type),this.action=r=>{const{title:i,message:s,closeCallback:a}=r,o=cr.make({title:i,message:s},this.appObjects);a(()=>o==null?void 0:o.close())},this.handleRequest=(r,i)=>{if(r===1){const s=this.castPayloadV1(i);this.action(s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class yh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="START_ZSPACE"}}yh.type="StartZSpaceHandler";function r7(e){return new i7(e)}class i7 extends yh{get startZSpaceUC(){return this.getCachedSingleton(ji.type)}constructor(t){super(t,yh.type),this.payloadVersion=1,this.action=()=>{var r;(r=this.startZSpaceUC)==null||r.startZSpace()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Sh extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="STOP_ZSPACE"}}Sh.type="StopZSpaceHandler";function s7(e){return new a7(e)}class a7 extends Sh{get stopUC(){return this.getCachedSingleton(_i.type)}constructor(t){super(t,Sh.type),this.payloadVersion=1,this.action=()=>{var r;(r=this.stopUC)==null||r.stopZSpace()},this.handleRequest=r=>{if(r===this.payloadVersion)this.action();else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Hc extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_ACTIVITY_ASSET"}}Hc.type="SubmitActivityAssetHandler";function o7(e){return new l7(e)}class l7 extends Hc{castPayloadV1(t){const n=t;if(!n.assetFile||!n.callback)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Hc.type),this.action=()=>{throw new dI(this.requestType)},this.handleRequest=(r,i)=>{if(r===1){const{assetFile:s,callback:a}=this.castPayloadV1(i);this.action(s,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Ah extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_LOG"}}Ah.type="SubmitLogHandler";function c7(e){return new u7(e)}class u7 extends Ah{get app(){return this.getCachedLocalComponent(nr.type)}castPayloadV1(t){const n=t;if(n.sender===void 0||n.severity===void 0||n.message===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}constructor(t){super(t,Ah.type),this.action=(r,i,s)=>{if(!this.app)return;const a=`[${this.app.name}] ${r}`;i==="LOG"?this.appObjects.submitLog(a,s):i==="WARNING"?this.appObjects.submitWarning(a,s):i==="ERROR"?this.appObjects.submitError(a,s):i==="FATAL"?this.appObjects.submitFatal(a,s):(this.appObjects.submitLog(a,s),this.appObjects.submitWarning("Host Handler - Submit Log",`Received an unsupported log severity type of ${i}`))},this.handleRequest=(r,i)=>{if(r===1){const{sender:s,message:a,severity:o}=this.castPayloadV1(i);this.action(s,o,a)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}class Ni extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ni.type,t)}}Ni.type="ChallengeResultsEntity";function d7(e){return new p7(e)}class p7 extends Ni{get results(){return Array.from(this.resultLookup.values())}get postActivityProgress(){return this._postActivityProgress}set postActivityProgress(t){this._postActivityProgress!==t&&(this._postActivityProgress=t,this.notifyOnChange())}constructor(t){super(t,Ni.type),this.resultLookup=new Map,this.newAttemptInProgress=new Set,this.initialResultsState={},this.submitHitResult=(n,r,i,s)=>{const a=this.resultLookup.get(n);if(a&&a.type==="HIT"&&a.resultData.success===!0)return;const c={slideID:n,message:s,resultData:{success:r},tries:i,type:"HIT"};this.resultLookup.set(n,c),this.notifyOnChange()},this.submitMultiHitResult=(n,r,i,s,a,o)=>{const c=this.resultLookup.get(n);if(c&&c.type==="MULTIHIT"){const y=c.resultData;if(y.hits>r){this.newAttemptInProgress.add(n);return}if(y.hits===r&&y.misses<=i)return}this.newAttemptInProgress.has(n)&&(a+=1,this.newAttemptInProgress.delete(n));const h={slideID:n,message:o,resultData:{hits:r,misses:i,unanswered:s},tries:a,type:"MULTIHIT"};this.resultLookup.set(n,h),this.notifyOnChange()},this.submitQualityResult=(n,r,i,s,a)=>{const c={slideID:n,message:a,resultData:{stars:r,maxStars:i},tries:s,type:"QUALITY"};this.resultLookup.set(n,c),this.notifyOnChange()},this.submitScoreResult=(n,r,i,s,a)=>{const c={slideID:n,message:a,resultData:{score:r,maxScore:i},tries:s,type:"SCORE"};this.resultLookup.set(n,c),this.notifyOnChange()},this.getResultForSlide=n=>this.resultLookup.get(n),this.getScoreForSlide=n=>{const r=this.getResultForSlide(n);if(!r)return 0;switch(r.type){case"HIT":return r.resultData.success?1:0;case"MULTIHIT":{const i=r.resultData,s=i.hits+i.unanswered;return s>0?i.hits/s:0}case"QUALITY":{const i=r.resultData;return i.maxStars>0?i.stars/i.maxStars:0}case"SCORE":{const i=r.resultData;return i.maxScore>0?i.score/i.maxScore:0}case"PROGRESS":return r.resultData.maxProgress/100;default:return 0}},this.submitProgressResult=(n,r,i)=>{const s=this.getResultForSlide(n);if(s&&s.resultData.maxProgress>r)return;const o={slideID:n,message:i,resultData:{maxProgress:r},tries:1,type:"PROGRESS"};this.resultLookup.set(n,o),this.notifyOnChange()},this.getResultsState=()=>{const n={};return this.resultLookup.forEach((r,i)=>{n[i]=r}),n},this.getInitialResultsState=()=>this.initialResultsState,this.setResultsState=n=>{this.resultLookup.clear(),this.newAttemptInProgress.clear(),this.initialResultsState={...n},Object.entries(n).forEach(([r,i])=>{this.resultLookup.set(r,i)}),this.notifyOnChange()},this.appObjects.registerSingleton(this)}}class na extends k.AppObjectPM{static get(t){return t.getSingleton(na.type)}}na.type="ChallengeResultsListPM";function f7(e){return new h7(e)}class h7 extends na{get results(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;let r=!0;return t.forEach((i,s)=>{const a=n[s];(i.id!==a.id||i.attempts!==a.attempts||i.resultData!==a.resultData)&&(r=!1)}),r}constructor(t){var n,r;super(t,na.type),this.onEntityChange=()=>{if(!this.results||!this.stateMachine)return;const i=[];this.stateMachine.states.forEach(a=>{const o=this.stateMachine.getStateByID(a);if(!o)return;const c=this.stateMachine.getStateIndex(a)??-1,u=this.results.getResultForSlide(a);if(u){const p={id:a,slideName:o.name,attempts:u.tries,resultType:u.type,message:u.message,stateIndex:c,resultData:u.resultData};i.push(p)}else if(o.expectedResponse!==void 0&&o.expectedResponse!==In.NONE){const p={id:a,slideName:o.name,attempts:0,stateIndex:c,message:"Incomplete"};i.push(p)}}),this.doUpdateView(i)},this.doUpdateView([]),(n=this.results)==null||n.addChangeObserver(this.onEntityChange),(r=this.stateMachine)==null||r.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}const S4={defaultVM:[],subscribe:(e,t)=>{const n=na.get(e);if(!n){e.submitError("challengeResultsListAdapter","Unable to find ChallengeResultsListPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=na.get(e);if(!n){e.submitError("challengeResultsListAdapter","Unable to find ChallengeResultsListPM");return}n.removeView(t)}};class Ql extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(Ql.type,t)}}Ql.type="HasChallengeResultsPM";function m7(e){return new g7(e)}class g7 extends Ql{get resultsEntity(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,Ql.type),this.defaultVM=!1,this.formVM=()=>{var r;if(!this.resultsEntity)return;let n=((r=this.resultsEntity.results)==null?void 0:r.length)>0||!1;if(!n&&this.stateMachine){const i=this.stateMachine.states;for(const s of i){const a=this.stateMachine.getStateByID(s);if(a&&a.expectedResponse!==void 0&&a.expectedResponse!==In.NONE){n=!0;break}}}this.doUpdateView(n)},this.resultsEntity&&this.observeEntity(this.resultsEntity),this.stateMachine&&this.observeEntity(this.stateMachine)}}class Jl extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Jl.type,t)}}Jl.type="ChallengeScoreListPM";function E7(e){return new b7(e)}class b7 extends Jl{get challengeResults(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}vmsAreEqual(t,n){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r].id!==n[r].id||t[r].displayName!==n[r].displayName||t[r].score!==n[r].score)return!1;return!0}constructor(t){var n,r;super(t,Jl.type),this.onEntityChange=()=>{if(!this.challengeResults||!this.stateMachine)return;const i=[];this.stateMachine.states.forEach((a,o)=>{const c=this.challengeResults.getResultForSlide(a),u=this.stateMachine.getStateByID(a);if(!(!c&&(!u||u.expectedResponse===void 0||u.expectedResponse===In.NONE))&&u){const p=this.challengeResults.getScoreForSlide(a),h=`Slide ${o+1}: ${u.name}`;i.push({id:a,displayName:h,score:p})}}),this.doUpdateView(i)},this.doUpdateView([]),(n=this.challengeResults)==null||n.addChangeObserver(this.onEntityChange),(r=this.stateMachine)==null||r.addChangeObserver(this.onEntityChange),this.onEntityChange(),this.appObjects.registerSingleton(this)}}class T7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="ChallengeResultsFactory"}setupEntities(){d7(this.appObject)}setupUCs(){}setupPMs(){f7(this.appObject),E7(this.appObject),m7(this.appObject)}finalSetup(){}}function y7(e){const t=e.getOrCreate("ChallengeResults");return new T7(t)}class Ch extends k.AppObjectUC{constructor(){super(...arguments),this.requestType="SUBMIT_RESULTS"}}Ch.type="SubmitResultHandler";function S7(e){return new A7(e)}class A7 extends Ch{get challengeResults(){return this.getCachedSingleton(Ni.type)}get stateMachine(){return this.getCachedSingleton(bt.type)}handleHitV1(t,n,r,i){var a;const s=t;if(s.success===void 0){this.warn(`Cannot parse Hit Result V1 payload: ${JSON.stringify(t)}`);return}(a=this.challengeResults)==null||a.submitHitResult(r,s.success,n,i)}handleProgressV1(t,n,r){var s;const i=t;if(i.progress===void 0){this.warn(`Cannot parse Progress Result V1 payload: ${JSON.stringify(t)}`);return}(s=this.challengeResults)==null||s.submitProgressResult(n,i.progress,r)}handleMultiHitV1(t,n,r,i){var p,h;const{hits:s,misses:a,unanswered:o}=t;if(s===void 0||a===void 0||o===void 0){this.warn(`Cannot parse Multi Hit Result V1 payload: ${JSON.stringify(t)}`);return}let c=1;const u=(p=this.challengeResults)==null?void 0:p.results.find(y=>y.slideID===r);u&&u.type==="MULTIHIT"&&(c=u.tries),(h=this.challengeResults)==null||h.submitMultiHitResult(r,s,a,o,c,i)}handleQualityV1(t,n,r,i){var o;const{maxStars:s,stars:a}=t;if(s===void 0||a===void 0){this.warn(`Cannot parse Quality Result V1 payload: ${JSON.stringify(t)}`);return}(o=this.challengeResults)==null||o.submitQualityResult(r,a,s,n,i)}handleScoreV1(t,n,r,i){var o;const{score:s,maxScore:a}=t;if(a===void 0||s===void 0){this.warn(`Cannot parse Score Result V1 payload: ${JSON.stringify(t)}`);return}(o=this.challengeResults)==null||o.submitScoreResult(r,s,a,n,i)}castPayloadV2(t){const n=t;if(n.result===void 0||n.resultType===void 0)throw new rn(this.requestType,1,JSON.stringify(t));return n}castPayloadV3(t){const n=t;if(n.result===void 0||n.resultType===void 0)throw new rn(this.requestType,2,JSON.stringify(t));return n}constructor(t){super(t,Ch.type),this.resultTypeToResponseMap={HIT_V1:In.HIT,MULTIHIT_V1:In.MULTIHIT,QUALITY_V1:In.QUALITY,SCORE_V1:In.SCORE,PROGRESS_V1:In.PROGRESS},this.action=(r,i,s)=>{var u;if(!this.challengeResults||!this.stateMachine){this.error("Missing Component");return}if(this.stateMachine.activeState===void 0){this.warn("Cannot store result because there is no active slide");return}const a=this.stateMachine.activeState,o=this.stateMachine.getStateByID(a);if(!o){this.warn("Cannot find active state entity");return}o.expectedResponse=this.resultTypeToResponseMap[r];let c=((u=this.challengeResults.getResultForSlide(a))==null?void 0:u.tries)??0;r!=="PROGRESS_V1"&&(c+=1),r==="HIT_V1"?this.handleHitV1(i,c,a,s):r==="MULTIHIT_V1"?this.handleMultiHitV1(i,c,a,s):r==="QUALITY_V1"?this.handleQualityV1(i,c,a,s):r==="SCORE_V1"?this.handleScoreV1(i,c,a,s):r==="PROGRESS_V1"&&this.handleProgressV1(i,a,s)},this.handleRequest=(r,i)=>{if(r===2){const{description:s,result:a,resultType:o}=this.castPayloadV2(i);this.action(o,a,s)}else if(r===3){const{description:s,result:a,resultType:o}=this.castPayloadV3(i);this.action(o,a,s)}else throw new Kt(this.requestType,r)};const n=Et.get(t);if(!n){this.error("UC added to an entity that does not have HostHandlerEntity");return}n.registerRequestHandler(this)}}function C7(e){ix(e),g4(e),ox(e),cx(e),px(e),iO(e),aO(e),OO(e),DO(e),MO(e),UO(e),HO(e),jO(e),y4(e),qO(e),YO(e),ZO(e),JO(e),t7(e),r7(e),s7(e),o7(e),c7(e),S7(e)}function _7(e){return function(n,r){const i=qe.get(e);if(!i){e.submitError("makeSubmitActivityAssetHandlerSandbox","Unable to find AppSandboxEntity"),r(void 0);return}if(!i.mockActivityID){e.submitError("makeSubmitActivityAssetHandlerSandbox","No activity ID found"),r(void 0);return}const s=i.mockActivityID,a={name:"Activity Asset",description:"Asset for activity "+s,file:n,owner:s},o=fo.get(e);if(!o){e.submitError("makeSubmitActivityAssetHandlerSandbox","Unable to find NewAssetUC"),r(void 0);return}o.create(a).then(c=>{r(c)})}}class I7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="AppSandboxFeatureFactory"}setupEntities(){this.sandbox=gI(this.appObject),a4(this.appObject),o4(this.appObject)}setupUCs(){dR(this.appObject),C7(this.appObject),F6(this.appObject),H6(this.appObject),pR(this.appObject),ER(this.appObject),bI(this.appObject)}setupPMs(){G6(this.appObject),z6(this.appObject),W6(this.appObject),Y6(this.appObject),Q6(this.appObject),eR(this.appObject)}finalSetup(){const t=this.appObjects.getSingleton(Hc.type);if(t&&(t.action=_7(this.appObjects)),!this.sandbox){this.error("AppSandboxEntity not found during final setup.");return}const n=yi.get(this.appObjects);if(!n){this.error("AppRepoEntity not found in AppObjects.");return}n.add(this.sandbox.app)}}function N7(e,t){const n=t.getOrCreate(e);return new I7(n)}class ra extends k.AppObjectPM{static get(t){return k.getSingletonComponent(ra.type,t)}}ra.type="AssetSystemPluginPM";function R7(e){return new v7(e)}class v7 extends ra{get assetPlugin(){return this.getCachedSingleton(Ai.type)}vmsAreEqual(t,n){if(t.loading!==n.loading||t.show!==n.show||t.styleSheets.length!==n.styleSheets.length)return!1;let r=!0;return t.styleSheets.forEach((i,s)=>{const a=n.styleSheets[s];i!==a&&(r=!1)}),r}constructor(t){var n;super(t,ra.type),this.onChange=()=>{var a,o,c;if(!this.assetPlugin)return;const r=this.assetPlugin.show;let i=!1;(r&&((a=this.assetPlugin.app)==null?void 0:a.state)===Dn.INIT||r&&((o=this.assetPlugin.app)==null?void 0:o.state)===Dn.LOADING)&&(i=!0);const s={show:r,loading:i,styleSheets:((c=this.assetPlugin.app)==null?void 0:c.styles)??[]};this.doUpdateView(s)},(n=this.assetPlugin)==null||n.addChangeObserver(this.onChange),this.onChange(),this.appObjects.registerSingleton(this)}}const x7={defaultVM:{show:!1,loading:!1,styleSheets:[]},subscribe:(e,t)=>{const n=ra.get(e);if(!n){e.submitError("assetPluginPMAdapter","Unable to find AssetPluginPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=ra.get(e);if(!n){e.submitError("assetPluginPMAdapter","Unable to find AssetPluginPM");return}n.removeView(t)}};class ia extends k.AppObjectUC{static get(t){return k.getSingletonComponent(ia.type,t)}}ia.type="AssetPluginContainerUC";function O7(e){const t=ia.get(e);t?t.clearContainer():e.submitWarning("clearAssetPluginContainer","Unable to find AssetPluginContainerUC")}function w7(e,t){const n=ia.get(t);n?n.setContainer(e):t.submitWarning("setAssetPluginContainer","Unable to find AssetPluginContainerUC")}function D7(e){return new k7(e)}class k7 extends ia{get mounterUC(){return this.getCachedLocalComponent(Ar.type)}get assetPlugin(){return this.getCachedSingleton(Ai.type)}get dispatchStart(){return this.getCachedLocalComponent(Cs.type)}get dispatchStop(){return this.getCachedLocalComponent(Si.type)}get sandbox(){return this.getCachedSingleton(qe.type)}get vivedAPI(){return this.getCachedSingleton(bn.type)}constructor(t){super(t,ia.type),this.clearContainer=()=>{var n;!this.assetPlugin||!this.dispatchStop||(n=this.assetPlugin.app)!=null&&n.isMounted&&(this.assetPlugin.container=void 0,this.dispatchStop.doDispatch())},this.setContainer=n=>{const r=this.assetPlugin,i=this.mounterUC,s=this.dispatchStart;if(!i||!r||!s||!this.vivedAPI||!this.sandbox)return Promise.resolve();r.container=n;const a=this.sandbox.channelID??"",o={baseApiURL:this.vivedAPI.baseUrl,channelID:a,container:n,callback:r.callback};return new Promise(c=>{i.mount(r.version.major,r.version.minor).then(()=>{s.doDispatch(o),c()})})},this.appObjects.registerSingleton(this)}}const L7="app448f8f293fbb493a9e233f113ce8b56a",M7="1.2.0";class P7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="AssetPluginFeatureFactory"}setupEntities(){this.assetPlugin=SR(this.appObject),o4(this.appObject),a4(this.appObject)}setupUCs(){hI(this.appObject),D7(this.appObject),sR(this.appObject),c4(this.appObject),p4(this.appObject),g4(this.appObject),y4(this.appObject),OR(this.appObject)}setupPMs(){R7(this.appObject)}finalSetup(){if(!this.assetPlugin){this.error("AssetPlugin entity not initialized");return}this.assetPlugin.version=k.Version.FromString(M7);const t=yi.get(this.appObjects);t?t.add(this.assetPlugin.app):this.error("Unable to find app repo. Make sure it is setup before setting up the Asset Plugin")}}function F7(e){const t=e.getOrCreate(L7);return new P7(t)}var pT;(function(e){e.MOUNT_PLAYER="MOUNT_PLAYER",e.UNMOUNT_PLAYER="UNMOUNT_PLAYER",e.APP_REQUESTED="APP_REQUESTED",e.APP_READY="APP_READY",e.ASSET_REQUESTED="ASSET_REQUESTED",e.ASSET_RECEIVED="ASSET_RECEIVED",e.SLIDE_START="SLIDE_START",e.SLIDE_STOP="SLIDE_STOP",e.START_ACTIVITY="START_ACTIVITY",e.ACTIVITY_COMPLETED="ACTIVITY_COMPLETED",e.ACTIVITY_PUBLISHED="ACTIVITY_PUBLISHED"})(pT||(pT={}));class mm extends k.AppObjectPM{static get(t){return k.getSingletonComponent(mm.type,t)}}mm.type="FatalErrorPM";class Ri extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(Ri.type,t)}}Ri.type="LoggerEntity";function U7(e){return new B7(e)}class B7 extends Ri{formConsoleString(t){const{sender:n,message:r}=t;return`[${n}] ${r}`}setNewLog(t,n,r){const i={sender:t,message:n,severity:r};return this.logs.push(i),this._lastLog=i,i}get forwardLogsToConsole(){return this.memoisedForwardLogs.val}set forwardLogsToConsole(t){this.memoisedForwardLogs.val=t}get lastLog(){return this._lastLog}constructor(t){super(t,Ri.type),this.logs=[],this.submitLog=(n,r)=>{const i=this.setNewLog(n,r,"LOG");this.forwardLogsToConsole&&console.log(this.formConsoleString(i)),this.notifyOnChange()},this.submitWarning=(n,r)=>{const i=this.setNewLog(n,r,"WARNING");console.warn(this.formConsoleString(i)),this.notifyOnChange()},this.submitError=(n,r)=>{const i=this.setNewLog(n,r,"ERROR");console.error(this.formConsoleString(i)),this.notifyOnChange()},this.submitFatal=(n,r)=>{const i=this.setNewLog(n,r,"FATAL");console.error(this.formConsoleString(i)),this.notifyOnChange()},this.memoisedForwardLogs=new k.MemoizedBoolean(!1,this.notifyOnChange),this.clear=()=>{this.logs=[],this._lastLog=void 0},this.appObjects.registerSingleton(this),this.appObjects.submitLog=this.submitLog,this.appObjects.submitWarning=this.submitWarning,this.appObjects.submitError=this.submitError,this.appObjects.submitFatal=this.submitFatal}}class sa extends k.AppObjectSingletonPM{static get(t){return k.getSingletonComponent(sa.type,t)}}sa.type="ForwardLogsToConsolePM";function H7(e){return new $7(e)}class $7 extends sa{get logger(){return this.getCachedSingleton(Ri.type)}vmsAreEqual(t,n){return t===n}constructor(t){super(t,sa.type),this.defaultVM=!1,this.formVM=()=>{this.logger&&this.doUpdateView(this.logger.forwardLogsToConsole)},this.logger&&this.observeEntity(this.logger)}}class aa extends k.AppObjectPM{static get(t){return k.getSingletonComponent(aa.type,t)}}aa.type="LogSummaryPM";function G7(e){return new j7(e)}class j7 extends aa{get logger(){return this.getCachedSingleton(Ri.type)}vmsAreEqual(t,n){return!(t.errorsLabel!==n.errorsLabel||t.logsLabel!==n.logsLabel||t.warningsLabel!==n.warningsLabel)}constructor(t){var n;super(t,aa.type),this.onEntityChange=()=>{if(!this.logger)return;const r={logsLabel:"No Logs have been submitted",warningsLabel:"No Warnings have been submitted",errorsLabel:"No Errors have been submitted"},i=this.logger.logs;let s=0,a=0,o=0;i.forEach(c=>{c.severity==="LOG"?s++:c.severity==="WARNING"?a++:o++}),s>0&&(r.logsLabel=`${s} Logs have been submitted`),a>0&&(r.warningsLabel=`${a} Warnings have been submitted`),o>0&&(r.errorsLabel=`${o} Errors have been submitted`),this.doUpdateView(r)},this.onEntityChange(),(n=this.logger)==null||n.addChangeObserver(this.onEntityChange),this.appObjects.registerSingleton(this)}}const z7={logsLabel:"",warningsLabel:"",errorsLabel:""},V7={defaultVM:!1,subscribe:(e,t)=>{const n=sa.get(e);if(!n){e.submitError("forwardLogsToConsoleAdapter","Unable to find ForwardLogsToConsolePM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=sa.get(e);if(!n){e.submitError("forwardLogsToConsoleAdapter","Unable to find ForwardLogsToConsolePM");return}n.removeView(t)}},A4={defaultVM:z7,subscribe:(e,t)=>{const n=aa.get(e);if(!n){e.submitError("logSummaryAdapter","Unable to find LogSummaryPM");return}n.addView(t)},unsubscribe:(e,t)=>{const n=aa.get(e);if(!n){e.submitError("logSummaryAdapter","Unable to find LogSummaryPM");return}n.removeView(t)}};class e1 extends k.AppObjectUC{static get(t){return k.getSingletonComponent(e1.type,t)}}e1.type="DownloadLogUC";function W7(e){return new q7(e)}class q7 extends e1{get logger(){return this.getCachedSingleton(Ri.type)}doDownload(){if(!this.logger)return;const t="vivedPlayerLog.json",n=this.logger.logs,r=JSON.stringify(n,null,2),i=new Blob([r],{type:"application/pdf"});this.downloadFile(t,i)}constructor(t){super(t,e1.type),this.downloadFile=k.downloadFile,this.appObjects.registerSingleton(this)}}function K7(e){const t=Ri.get(e);t?t.forwardLogsToConsole=!t.forwardLogsToConsole:e.submitError("toggleForwardLogs","Unable to find LoggerEntity")}class Y7 extends k.DomainFactory{constructor(t){super(t),this.factoryName="SandboxLoggerFactory"}setupEntities(){U7(this.appObject)}setupUCs(){W7(this.appObject)}setupPMs(){G7(this.appObject),H7(this.appObject)}finalSetup(){}}function X7(e){const t=e.getOrCreate("Logger");return new Y7(t)}class gm extends k.AppObjectEntity{static get(t){return k.getSingletonComponent(gm.type,t)}}gm.type="SnackbarRepo";class Em extends k.AppObjectPM{static get(t){return k.getSingletonComponent(Em.type,t)}}Em.type="SnackbarPM";function Z7(e,t){const n=k.makeAppObjectRepo(),r=new k.DomainFactoryRepo(n.getOrCreate("DomainFactory"));N7(e,n),lI(n),rx(n),F7(n),xO(n),y7(n),D3(n),X7(n),x6(n),sv(n),Wx(n),Nv(n),r.setupDomain();const i=qe.get(n);if(!i)throw new Error("Failed to create AppSandboxEntity");return i.app.versions=[k.Version.FromString(t.version)],i.app.appAssetFolderURL=new URL("/assets/",window.location.href).toString(),t.mockActivityID&&(i.mockActivityID=t.mockActivityID),t.channelID&&(i.channelID=t.channelID),t.channelName&&(i.channelName=t.channelName),rO(t.persistentStates,n),NO(n,1),$x(n,t.zSpaceSupported??!0),MI(n,"light"),n}const Tt=K.createContext(k.makeAppObjectRepo());function wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y1={exports:{}},X1={exports:{}},Rt={};/** @license React v16.13.1
4
4
  * react-is.production.min.js
5
5
  *
6
6
  * Copyright (c) Facebook, Inc. and its affiliates.