@pie-element/math-inline 13.0.8-next.20261026154827 → 13.0.8-next.20261026164747
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/browser/author/index.js +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/dist-CJIrihAw.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +1 -1
- package/dist/browser/editor-runtime/controller/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -1
- package/dist/browser/editor-runtime/dist-DNExGB_k.js.map +1 -1
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/print/index.js +1 -1
- package/dist/schemas/configuration.schema.json +1 -1
- package/dist/schemas/model.schema.json +1 -1
- package/dist/schemas/session.schema.json +1 -1
- package/module/print.js.map +1 -1
- package/package.json +9 -9
|
@@ -37308,7 +37308,7 @@ var nL = class extends L.Component {
|
|
|
37308
37308
|
}
|
|
37309
37309
|
}, yL = Object.freeze({
|
|
37310
37310
|
name: "@pie-element/math-inline",
|
|
37311
|
-
version: "13.0.8-next.
|
|
37311
|
+
version: "13.0.8-next.20261026164747"
|
|
37312
37312
|
});
|
|
37313
37313
|
//#endregion
|
|
37314
37314
|
export { vL as default, yL as piePackage };
|
|
@@ -37850,7 +37850,7 @@ var Q_ = (e, t, n) => {
|
|
|
37850
37850
|
return o(s) || (c.responsesErrors = s), c;
|
|
37851
37851
|
}, lv = Object.freeze({
|
|
37852
37852
|
name: "@pie-element/math-inline",
|
|
37853
|
-
version: "13.0.8-next.
|
|
37853
|
+
version: "13.0.8-next.20261026164747"
|
|
37854
37854
|
});
|
|
37855
37855
|
//#endregion
|
|
37856
37856
|
export { ov as createCorrectResponseSession, Z_ as createDefaultModel, Q_ as getLogTrace, tv as model, ev as normalize, $_ as outcome, lv as piePackage, cv as validate };
|
|
@@ -130,7 +130,7 @@ var h = class e extends CustomEvent {
|
|
|
130
130
|
}
|
|
131
131
|
}, x = Object.freeze({
|
|
132
132
|
name: "@pie-element/math-inline",
|
|
133
|
-
version: "13.0.8-next.
|
|
133
|
+
version: "13.0.8-next.20261026164747"
|
|
134
134
|
});
|
|
135
135
|
//#endregion
|
|
136
136
|
export { i as Component, b as default, x as piePackage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Translator","debug","createSessionNotifier","SessionChangedEvent","ModelSetEvent","__toESM","require_browser","r$1","k","Main","React","import_browser","e","t","n","r","i","a","o","s","c","l","u","d","f","x","S","defaults","log","MathInline","language","playerContainer","translator","m","key","el","createRoot","piePackage","\"name\"","\"version\""],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) d();\n\t\t\telse try {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/events.js\nfunction s(e, t, n) {\n\tlet r = t.ownerDocument?.defaultView?.Event ?? Event;\n\treturn Object.assign(new r(e, {\n\t\tbubbles: !0,\n\t\tcomposed: !0\n\t}), n);\n}\nvar c = /* @__PURE__ */ new WeakSet(), l = (e, t) => typeof t == \"object\" && !!t && e.has(t), u = class {\n\tconstructor(e, t, n, r) {\n\t\tlet i = s(\"context-request\", t, {\n\t\t\tcontext: e,\n\t\t\tcontextTarget: t,\n\t\t\tcallback: n,\n\t\t\tsubscribe: r ?? !1\n\t\t});\n\t\treturn c.add(i), i;\n\t}\n\tstatic [Symbol.hasInstance](e) {\n\t\treturn l(c, e);\n\t}\n}, d = (e) => {\n\tlet t = [];\n\tfor (let n of e) n.requestorRef.deref() && n.callbackRef.deref() && t.push(n);\n\treturn t;\n}, f = class {\n\thost;\n\tpendingByContext = /* @__PURE__ */ new Map();\n\tattached = !1;\n\tconstructor(e) {\n\t\tthis.host = e;\n\t}\n\tattach() {\n\t\tthis.attached || (this.attached = !0, this.host.addEventListener(\"context-request\", this.onContextRequest), this.host.addEventListener(\"context-provider\", this.onContextProvider));\n\t}\n\tdetach() {\n\t\tthis.attached && (this.attached = !1, this.host.removeEventListener(\"context-request\", this.onContextRequest), this.host.removeEventListener(\"context-provider\", this.onContextProvider), this.pendingByContext.clear());\n\t}\n\tonContextRequest = (e) => {\n\t\tif (e.cancelBubble) return;\n\t\tlet t = e;\n\t\tif (t.subscribe !== !0 || typeof t.callback != \"function\" || t.context === void 0) return;\n\t\tlet n = t.contextTarget ?? e.composedPath?.()[0];\n\t\tif (!n) return;\n\t\tlet r = this.pendingByContext.get(t.context);\n\t\tr || (r = {\n\t\t\tcallbacks: /* @__PURE__ */ new WeakMap(),\n\t\t\trequests: []\n\t\t}, this.pendingByContext.set(t.context, r));\n\t\tlet i = t.callback, a = r.callbacks.get(n);\n\t\ta || (a = /* @__PURE__ */ new WeakSet(), r.callbacks.set(n, a)), !a.has(i) && (a.add(i), r.requests.push({\n\t\t\trequestorRef: new WeakRef(n),\n\t\t\tcallbackRef: new WeakRef(i)\n\t\t}), r.requests = d(r.requests));\n\t};\n\tonContextProvider = (e) => {\n\t\tlet t = e.context;\n\t\tif (t === void 0) return;\n\t\tlet n = this.pendingByContext.get(t);\n\t\tif (n && n.requests.length !== 0) {\n\t\t\tthis.pendingByContext.delete(t);\n\t\t\tfor (let e of n.requests) {\n\t\t\t\tlet n = e.requestorRef.deref(), r = e.callbackRef.deref();\n\t\t\t\tn && r && n.dispatchEvent(new u(t, n, r, !0));\n\t\t\t}\n\t\t}\n\t};\n}, p = Symbol.for(\"pie.context.documentRoot\");\nfunction m(e) {\n\tif (!e) return;\n\tlet t = e;\n\tif (t[p]) return;\n\tlet n = e.documentElement;\n\tif (!n) return;\n\tlet r = new f(n);\n\tr.attach(), t[p] = r;\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/consumer.js\nvar h = class {\n\thost;\n\tcontext;\n\tsubscribe;\n\tonValue;\n\tisConnected = !1;\n\tisDisconnected = !1;\n\tunsubscribe;\n\tcurrentValue;\n\tconstructor(e, t) {\n\t\tthis.host = e, this.context = t.context, this.subscribe = t.subscribe ?? !0, this.onValue = t.onValue;\n\t}\n\tconnect() {\n\t\tthis.isConnected || (this.isConnected = !0, this.isDisconnected = !1, this.subscribe && m(this.host.ownerDocument), this.requestValue());\n\t}\n\tdisconnect() {\n\t\tthis.isConnected && (this.isConnected = !1, this.isDisconnected = !0, this.unsubscribe?.(), this.unsubscribe = void 0);\n\t}\n\tget value() {\n\t\treturn this.currentValue;\n\t}\n\thandleValue = (e, t) => {\n\t\tthis.isDisconnected ? t?.() : (t !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e));\n\t};\n\trequestValue() {\n\t\tthis.host.dispatchEvent(new u(this.context, this.host, this.handleValue, this.subscribe));\n\t}\n}, g = (e, t, n) => {\n\tlet r = new h(e, {\n\t\tcontext: t,\n\t\tsubscribe: !0,\n\t\tonValue: n\n\t});\n\tr.connect();\n\tlet i = (e) => {\n\t\te.context === t && r.requestValue();\n\t};\n\treturn e.addEventListener(\"context-provider\", i), () => {\n\t\te.removeEventListener(\"context-provider\", i), r.disconnect();\n\t};\n}, _ = ((e) => e)(Symbol.for(\"pie.sessionCommit\")), v = 1500;\nfunction y(e) {\n\treturn typeof e == \"number\" && Number.isFinite(e) && e >= 0 ? e : v;\n}\nfunction b(e, t) {\n\treturn g(e, _, (e) => {\n\t\tt(y(e?.idleSaveDelayMs));\n\t});\n}\n//#endregion\n//#region src/index.ts\nvar x = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, S = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { v as DEFAULT_IDLE_SAVE_DELAY_MS, x as ModelSetEvent, e as SESSION_COMMIT_METHOD, S as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers, y as resolveIdleSaveDelay, b as subscribeIdleSaveDelay };\n","// @ts-nocheck\n\nimport { stampElementLanguage } from '@pie-element/shared-i18n';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n createSessionNotifier,\n flushSessionNotifiers,\n} from '@pie-element/shared-player-events';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\n// Inlined from the legacy configure/lib/defaults, which is ESM-incompatible and was not ported\nconst defaults = {\n configuration: {\n // Minimal configuration for student-facing UI\n // Full authoring configuration is only needed in the configure package\n } as any\n};;\nimport Main from './main.js';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._configuration = defaults.configuration;\n // Session state is already written synchronously in `sessionChanged`; only\n // this dispatch is coalesced, and `disconnectedCallback` flushes it.\n this._sessionNotifier = createSessionNotifier(\n this,\n () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n },\n { delayMs: 1000 },\n );\n this.sessionChangedEventCaller = () => this._sessionNotifier.notify();\n }\n\n setLangAttribute() {\n // The element asserts the language the item declares, canonicalized, and\n // nothing when it declares none: an `en` default claimed undeclared\n // content — Spanish items included — for English.\n const language = this._model?.language ?? null;\n stampElementLanguage(this, language);\n\n // set the lang attribute for the nearest parent div with class 'player-container' for MPI items as per PD-2483,\n // under the same declared-only rule: the container may hold several items.\n const playerContainer = this.closest('.player-container');\n if (playerContainer) {\n stampElementLanguage(playerContainer, language);\n }\n }\n\n /** Names the region in the item language, which can change with any model set. */\n setRegionLabel() {\n this.setAttribute('aria-label', translator.t('mathInline.mathResponseQuestion', { lng: this._model?.language }));\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this.setLangAttribute();\n this.setRegionLabel();\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map((key) => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this.setRegionLabel();\n this.setAttribute('role', 'region');\n\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n\n disconnectedCallback() {\n flushSessionNotifiers(this);\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;A,mCACIY,IAAI,wBAAwBC,oBAAoB,IAAI,QAAQ;AAChE,SAASC,EAAE,GAAG,GAAG;CAChB,IAAIC,IAAIF,EAAE,IAAI,CAAC;CACf,MAAM,oBAAoB,IAAI,IAAI,GAAGA,EAAE,IAAI,GAAGE,CAAC,IAAIA,EAAE,IAAID,CAAC;AAC3D;AACA,SAASC,EAAE,GAAG;CACb,OAAO,OAAO,yBAAyBF,GAAGD,CAAC,MAAM,KAAK;AACvD;AACA,SAASI,EAAE,GAAG;CACb,IAAID,EAAEF,CAAC,GAAG;CACV,IAAIC,IAAID,EAAED;CACV,OAAO,eAAeC,GAAGD,GAAG;EAC3B,aAAa;GACZ,IAAI,OAAOE,KAAK,YAAY,IAAI;IAC/B,EAAE,KAAKD,CAAC;GACT,QAAQ,CAAC;GACT,EAAEA,CAAC;EACJ;EACA,cAAc,CAAC;EACf,YAAY,CAAC;EACb,UAAU,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B,AADA,KAAK,iBAAiBC,GACtB,KAAK,QAAQ;CACf;CAEA,eAAe,GAAG;EAMhB,AALA,OAAO,KAAKD,CAAC,CAAC,CAAC,KAAK,MAAQ;GAC1B,KAAK,SAASe,KAAOf,EAAEe;EACzB,CAAC,GAED,KAAK,0BAA0B,GAC/BN,EAAI,aAAa,KAAK,QAAQ;CAChC;CAEA,oBAAoB;EAIlB,AAHA,KAAK,eAAe,GACpB,KAAK,aAAa,QAAQ,QAAQ,GAElC,KAAK,QAAQ;CACf;CAEA,UAAU;EACR,IAAI,CAAC,KAAK,UAAU,CAAC,KAAK,UACxB;EAGF,IAAMO,IAAKzB,EAAM,cAAcD,GAAM;GACnC,OAAO,KAAK;GACZ,SAAS,KAAK;GACd,eAAe,KAAK;GACpB,iBAAiB,KAAK,eAAe,KAAK,IAAI;EAChD,CAAC;EAKD,AAHA,AACE,KAAK,UAAQ2B,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAOD,CAAE;CACtB;CAEA,uBAAuB;EAGrB,AAFAjB,EAAsB,IAAI,GAE1B,AAEE,KAAK,WADL,KAAK,MAAM,QAAQ,GACN;CAEjB;AACF,G"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Translator","debug","createSessionNotifier","SessionChangedEvent","ModelSetEvent","__toESM","require_browser","r$1","k","Main","React","import_browser","e","t","n","r","i","a","o","s","c","l","u","d","f","x","S","defaults","log","MathInline","language","playerContainer","translator","m","key","el","createRoot","piePackage","\"name\"","\"version\""],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) d();\n\t\t\telse try {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.6/node_modules/@pie-players/pie-context/dist/events.js\nfunction s(e, t, n) {\n\tlet r = t.ownerDocument?.defaultView?.Event ?? Event;\n\treturn Object.assign(new r(e, {\n\t\tbubbles: !0,\n\t\tcomposed: !0\n\t}), n);\n}\nvar c = /* @__PURE__ */ new WeakSet(), l = (e, t) => typeof t == \"object\" && !!t && e.has(t), u = class {\n\tconstructor(e, t, n, r) {\n\t\tlet i = s(\"context-request\", t, {\n\t\t\tcontext: e,\n\t\t\tcontextTarget: t,\n\t\t\tcallback: n,\n\t\t\tsubscribe: r ?? !1\n\t\t});\n\t\treturn c.add(i), i;\n\t}\n\tstatic [Symbol.hasInstance](e) {\n\t\treturn l(c, e);\n\t}\n}, d = (e) => {\n\tlet t = [];\n\tfor (let n of e) n.requestorRef.deref() && n.callbackRef.deref() && t.push(n);\n\treturn t;\n}, f = class {\n\thost;\n\tpendingByContext = /* @__PURE__ */ new Map();\n\tattached = !1;\n\tconstructor(e) {\n\t\tthis.host = e;\n\t}\n\tattach() {\n\t\tthis.attached || (this.attached = !0, this.host.addEventListener(\"context-request\", this.onContextRequest), this.host.addEventListener(\"context-provider\", this.onContextProvider));\n\t}\n\tdetach() {\n\t\tthis.attached && (this.attached = !1, this.host.removeEventListener(\"context-request\", this.onContextRequest), this.host.removeEventListener(\"context-provider\", this.onContextProvider), this.pendingByContext.clear());\n\t}\n\tonContextRequest = (e) => {\n\t\tif (e.cancelBubble) return;\n\t\tlet t = e;\n\t\tif (t.subscribe !== !0 || typeof t.callback != \"function\" || t.context === void 0) return;\n\t\tlet n = t.contextTarget ?? e.composedPath?.()[0];\n\t\tif (!n) return;\n\t\tlet r = this.pendingByContext.get(t.context);\n\t\tr || (r = {\n\t\t\tcallbacks: /* @__PURE__ */ new WeakMap(),\n\t\t\trequests: []\n\t\t}, this.pendingByContext.set(t.context, r));\n\t\tlet i = t.callback, a = r.callbacks.get(n);\n\t\ta || (a = /* @__PURE__ */ new WeakSet(), r.callbacks.set(n, a)), !a.has(i) && (a.add(i), r.requests.push({\n\t\t\trequestorRef: new WeakRef(n),\n\t\t\tcallbackRef: new WeakRef(i)\n\t\t}), r.requests = d(r.requests));\n\t};\n\tonContextProvider = (e) => {\n\t\tlet t = e.context;\n\t\tif (t === void 0) return;\n\t\tlet n = this.pendingByContext.get(t);\n\t\tif (n && n.requests.length !== 0) {\n\t\t\tthis.pendingByContext.delete(t);\n\t\t\tfor (let e of n.requests) {\n\t\t\t\tlet n = e.requestorRef.deref(), r = e.callbackRef.deref();\n\t\t\t\tn && r && n.dispatchEvent(new u(t, n, r, !0));\n\t\t\t}\n\t\t}\n\t};\n}, p = Symbol.for(\"pie.context.documentRoot\");\nfunction m(e) {\n\tif (!e) return;\n\tlet t = e;\n\tif (t[p]) return;\n\tlet n = e.documentElement;\n\tif (!n) return;\n\tlet r = new f(n);\n\tr.attach(), t[p] = r;\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.6/node_modules/@pie-players/pie-context/dist/consumer.js\nvar h = class {\n\thost;\n\tcontext;\n\tsubscribe;\n\tonValue;\n\tisConnected = !1;\n\tisDisconnected = !1;\n\tunsubscribe;\n\tcurrentValue;\n\tconstructor(e, t) {\n\t\tthis.host = e, this.context = t.context, this.subscribe = t.subscribe ?? !0, this.onValue = t.onValue;\n\t}\n\tconnect() {\n\t\tthis.isConnected || (this.isConnected = !0, this.isDisconnected = !1, this.subscribe && m(this.host.ownerDocument), this.requestValue());\n\t}\n\tdisconnect() {\n\t\tthis.isConnected && (this.isConnected = !1, this.isDisconnected = !0, this.unsubscribe?.(), this.unsubscribe = void 0);\n\t}\n\tget value() {\n\t\treturn this.currentValue;\n\t}\n\thandleValue = (e, t) => {\n\t\tthis.isDisconnected ? t?.() : (t !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e));\n\t};\n\trequestValue() {\n\t\tthis.host.dispatchEvent(new u(this.context, this.host, this.handleValue, this.subscribe));\n\t}\n}, g = (e, t, n) => {\n\tlet r = new h(e, {\n\t\tcontext: t,\n\t\tsubscribe: !0,\n\t\tonValue: n\n\t});\n\tr.connect();\n\tlet i = (e) => {\n\t\te.context === t && r.requestValue();\n\t};\n\treturn e.addEventListener(\"context-provider\", i), () => {\n\t\te.removeEventListener(\"context-provider\", i), r.disconnect();\n\t};\n}, _ = ((e) => e)(Symbol.for(\"pie.sessionCommit\")), v = 1500;\nfunction y(e) {\n\treturn typeof e == \"number\" && Number.isFinite(e) && e >= 0 ? e : v;\n}\nfunction b(e, t) {\n\treturn g(e, _, (e) => {\n\t\tt(y(e?.idleSaveDelayMs));\n\t});\n}\n//#endregion\n//#region src/index.ts\nvar x = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, S = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { v as DEFAULT_IDLE_SAVE_DELAY_MS, x as ModelSetEvent, e as SESSION_COMMIT_METHOD, S as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers, y as resolveIdleSaveDelay, b as subscribeIdleSaveDelay };\n","// @ts-nocheck\n\nimport { stampElementLanguage } from '@pie-element/shared-i18n';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n createSessionNotifier,\n flushSessionNotifiers,\n} from '@pie-element/shared-player-events';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\n// Inlined from the legacy configure/lib/defaults, which is ESM-incompatible and was not ported\nconst defaults = {\n configuration: {\n // Minimal configuration for student-facing UI\n // Full authoring configuration is only needed in the configure package\n } as any\n};;\nimport Main from './main.js';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._configuration = defaults.configuration;\n // Session state is already written synchronously in `sessionChanged`; only\n // this dispatch is coalesced, and `disconnectedCallback` flushes it.\n this._sessionNotifier = createSessionNotifier(\n this,\n () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n },\n { delayMs: 1000 },\n );\n this.sessionChangedEventCaller = () => this._sessionNotifier.notify();\n }\n\n setLangAttribute() {\n // The element asserts the language the item declares, canonicalized, and\n // nothing when it declares none: an `en` default claimed undeclared\n // content — Spanish items included — for English.\n const language = this._model?.language ?? null;\n stampElementLanguage(this, language);\n\n // set the lang attribute for the nearest parent div with class 'player-container' for MPI items as per PD-2483,\n // under the same declared-only rule: the container may hold several items.\n const playerContainer = this.closest('.player-container');\n if (playerContainer) {\n stampElementLanguage(playerContainer, language);\n }\n }\n\n /** Names the region in the item language, which can change with any model set. */\n setRegionLabel() {\n this.setAttribute('aria-label', translator.t('mathInline.mathResponseQuestion', { lng: this._model?.language }));\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this.setLangAttribute();\n this.setRegionLabel();\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map((key) => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this.setRegionLabel();\n this.setAttribute('role', 'region');\n\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n\n disconnectedCallback() {\n flushSessionNotifiers(this);\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;A,mCACIY,IAAI,wBAAwBC,oBAAoB,IAAI,QAAQ;AAChE,SAASC,EAAE,GAAG,GAAG;CAChB,IAAIC,IAAIF,EAAE,IAAI,CAAC;CACf,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