@astl/astrolabe 0.0.0-stage → 0.1.0
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/CHANGELOG.md +119 -0
- package/LICENSE +202 -0
- package/README.md +64 -2
- package/dist/cdn/astrolabe-editor.js +1441 -0
- package/dist/cdn/astrolabe-editor.js.map +1 -0
- package/dist/cdn/astrolabe-player.js +2 -0
- package/dist/cdn/astrolabe-player.js.map +1 -0
- package/dist/cdn/astrolabe.css +238 -0
- package/dist/cdn/astrolabe.js +3 -0
- package/dist/cdn/astrolabe.js.map +1 -0
- package/dist/cdn/astrolabe.standalone.js +8007 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js +48 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js.map +1 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js +2 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js.map +1 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js +68 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js.map +1 -0
- package/dist/cdn/chunks/book-CHzDDaim.js +15 -0
- package/dist/cdn/chunks/book-CHzDDaim.js.map +1 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js +49 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js.map +1 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js +2 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js.map +1 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js +203 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js.map +1 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js +2 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js.map +1 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js +77 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js.map +1 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js +136 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js.map +1 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js +2 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js.map +1 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js +91 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js.map +1 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js +270 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js.map +1 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js +2 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js.map +1 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js +2 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js.map +1 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js +6 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js.map +1 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js +14 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js.map +1 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js +2 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js.map +1 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js +86 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js +87 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js +2 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js.map +1 -0
- package/dist/cdn/chunks/gap-lor-khst.js +78 -0
- package/dist/cdn/chunks/gap-lor-khst.js.map +1 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js +2 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js.map +1 -0
- package/dist/cdn/chunks/help-C-woafz5.js +138 -0
- package/dist/cdn/chunks/help-C-woafz5.js.map +1 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js +160 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +1 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js +2 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js.map +1 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js +154 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js.map +1 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js +295 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js.map +1 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js +2 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js.map +1 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js +177 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js.map +1 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js +2 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js.map +1 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js +80 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js.map +1 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js +80 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js.map +1 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js +51 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js.map +1 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js +2 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js.map +1 -0
- package/dist/cdn/chunks/live-jdiyYln2.js +7 -0
- package/dist/cdn/chunks/live-jdiyYln2.js.map +1 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js +71 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js.map +1 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js +2 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js.map +1 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js +131 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js.map +1 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js +2 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js.map +1 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js +352 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js.map +1 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js +2 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js.map +1 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js +187 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js.map +1 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js +2 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js.map +1 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js +2 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js.map +1 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js +2 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js.map +1 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js +50 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js.map +1 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js +225 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js.map +1 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js +2 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js.map +1 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js +2 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js.map +1 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js +2 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js.map +1 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js +92 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js.map +1 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js +8 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js.map +1 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js +2 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js.map +1 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js +526 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js.map +1 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js +2 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js.map +1 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js +345 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js.map +1 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js +2 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js.map +1 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js +29 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js.map +1 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js +240 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js.map +1 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js +2 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js.map +1 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js +2 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js.map +1 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js +2 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js.map +1 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js +74 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js.map +1 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js +136 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js.map +1 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js +57 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js.map +1 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js +136 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js.map +1 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js +1019 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js.map +1 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js +146 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js.map +1 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js +2 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js.map +1 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js +98 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js.map +1 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js +2 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js.map +1 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js +80 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js.map +1 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js +2 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js.map +1 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js +274 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js.map +1 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js +2 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js.map +1 -0
- package/dist/editor.d.ts +32 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +51 -0
- package/dist/editor.js.map +1 -0
- package/dist/engine.d.ts +33 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +53 -0
- package/dist/engine.js.map +1 -0
- package/dist/player.d.ts +19 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +22 -0
- package/dist/player.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/package.json +70 -3
- package/src/bundles/astrolabe-editor.ts +11 -0
- package/src/bundles/astrolabe-player.ts +10 -0
- package/src/bundles/astrolabe-standalone.ts +23 -0
- package/src/bundles/astrolabe.ts +12 -0
- package/src/editor.ts +98 -0
- package/src/engine.ts +59 -0
- package/src/player.ts +23 -0
- package/src/server.ts +7 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
var e=500,t=`open`,n=2e3,r=2e3,i=`true`;function a(e){return e===`open`?n:500}function o(e,t){let n=a(t);if(e.length<=n)return!0;if(e.length>2*n)return!1;let r=0;for(let t of e)if(++r>n)return!1;return!0}function s(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.entries(e);return t.length>2e3?!1:t.every(([e,t])=>e.length>0&&e.length<=200&&typeof t==`string`)}function c(e,t={},n=[]){return{type:`element`,tag:e,attrs:t,children:n}}function l(e){return{type:`text`,value:e}}function u(e,t){return e!==void 0&&e.type===`element`&&(t===void 0||e.tag===t)}function d(e){if(e.type===`text`)return e.value;let t=``;for(let n of e.children)t+=d(n);return t}function ee(e,t){return e.children.filter(e=>u(e,t))}var f=class extends Error{problem;constructor(e){super(e.detail??e.title),this.name=`CheckerError`,this.problem=e}},p=1;function m(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.format===1&&typeof t.lang==`string`&&typeof t.viewHash==`string`&&typeof t.slots==`object`&&t.slots!==null&&Array.isArray(t.groups)&&Array.isArray(t.pages)&&(t.help===void 0||typeof t.help==`object`&&t.help!==null)}var te=new Set([`p`,`h2`,`h3`,`h4`,`ul`,`ol`,`li`,`blockquote`]),ne=new Set([`strong`,`em`,`b`,`i`,`u`,`s`,`sub`,`sup`,`code`,`mark`,`span`,`a`,`br`,`img`]),re=`figure`,h=`figcaption`,ie=new Set([`script`,`style`,`template`,`iframe`,`object`,`embed`,`noscript`,`svg`,`math`,`video`,`audio`,`form`,`input`,`select`,`textarea`,`button`]),g=new Set([`lang`,`dir`,`style`]),_=`class`,v=`data-astl-style`,ae=/<[a-z](?:[^<>"']|"[^"]*"|'[^']*')*>/gi,y=/"[^"]*"|'[^']*'|(\s)style\s*=/gi,oe=e=>e.replace(ae,e=>e.replace(y,(e,t)=>t===void 0?e:`${t}${v}=`)),se=`astl-style`,ce=`astl-columns`,le=`astl-column`,ue=2,de=4,fe={a:[`href`],ol:[`start`],img:[`src`,`alt`,`width`,`height`]},pe={a:`href`,img:`src`},me=[`format`,`lang`,`dir`,`kind`,`style`,`style-template`],he=[`exercise`,`book`],ge=`exercise`,_e=[`id`,`label`,`lang`,`dir`,`style`],ve=256,ye=100,be=new Set([`http`,`https`,`mailto`]);function b(e){let t=/^([a-z][a-z0-9+.-]*):/i.exec(e.replace(/[\t\n\r]/g,``).trim());return t!==null&&be.has((t[1]??``).toLowerCase())}function xe(e){return e===b?b:(t,n)=>{try{return e(t,n)===!0}catch{return!1}}}var Se=1,Ce=[1],we=`astl-doc`,Te=`astl-page`,Ee=1e6,De=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,Oe=/^k[a-z2-7]{16}$/,ke=/^[a-z][a-z0-9]*-[a-z0-9-]*$/,Ae=`astl-`;function je(e){return De.test(e)}function Me(e){return Oe.test(e)}var Ne=new Set([`ar`,`arc`,`ckb`,`dv`,`fa`,`he`,`ks`,`ku`,`ps`,`sd`,`ug`,`ur`,`yi`]);function x(e){let t=e.toLowerCase().split(`-`);return t.includes(`arab`)||t.includes(`hebr`)||t.includes(`thaa`)||t.includes(`syrc`)?`rtl`:t.includes(`latn`)||t.includes(`cyrl`)?`ltr`:Ne.has(t[0]??``)?`rtl`:`ltr`}var Pe=/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/,Fe=`astl-hint`,Ie=`astl-explanation`,Le=`astl-feedback`,Re=new Set([Fe,Ie,Le]),ze=[`correct`,`incorrect`,`partial`,`omitted`],Be=[`hints`,`explanation`,`feedback`],S=class extends Error{offset;constructor(e,t){super(`${e} at offset ${t}`),this.name=`MessageSyntaxError`,this.offset=t}},Ve=new Set([`zero`,`one`,`two`,`few`,`many`,`other`]),He=class{src;pos=0;constructor(e){this.src=e}parse(){let e=this.message(!1);if(this.pos<this.src.length)throw new S(`Unexpected "}"`,this.pos);return e}message(e){let t=[],n=``,r=()=>{n!==``&&t.push({type:`text`,value:n}),n=``};for(;this.pos<this.src.length;){let i=this.src[this.pos];if(i===`'`)n+=this.apostrophe(e);else if(i===`{`)r(),t.push(this.argument());else if(i===`}`)break;else i===`#`&&e?(r(),t.push({type:`pound`}),this.pos++):(n+=i,this.pos++)}return r(),t}apostrophe(e){let t=this.src[this.pos+1];if(t===`'`)return this.pos+=2,`'`;if(t===`{`||t===`}`||e&&t===`#`){this.pos++;let e=``;for(;this.pos<this.src.length;){let t=this.src[this.pos];if(t===`'`){if(this.src[this.pos+1]===`'`){e+=`'`,this.pos+=2;continue}return this.pos++,e}e+=t,this.pos++}return e}return this.pos++,`'`}argument(){let e=this.pos;this.pos++;let t=this.word();if(t===``)throw new S(`Missing argument name`,this.pos);if(this.space(),this.eat(`}`))return{type:`arg`,name:t,style:`plain`};if(!this.eat(`,`))throw new S(`Expected "," or "}"`,this.pos);this.space();let n=this.word();if(this.space(),n===`number`){let e=`number`;if(this.eat(`,`)){this.space();let t=this.word();if(t!==`integer`&&t!==`percent`)throw new S(`Unsupported number style "${t}"`,this.pos);e=t,this.space()}return this.expect(`}`),{type:`arg`,name:t,style:e}}if(n===`plural`||n===`selectordinal`||n===`select`){this.expect(`,`),this.space();let r=0;if(n!==`select`&&this.src.startsWith(`offset:`,this.pos)){this.pos+=7,this.space();let e=this.word();if(r=Number(e),!Number.isInteger(r)||r<0)throw new S(`Invalid offset "${e}"`,this.pos);this.space()}let i=Object.create(null);for(;!this.eat(`}`);){if(this.pos>=this.src.length)throw new S(`Unclosed argument`,e);let t=this.word();if(t===``)throw new S(`Expected an option key`,this.pos);if(n!==`select`&&!Ve.has(t)&&!/^=\d+$/.test(t))throw new S(`Invalid plural key "${t}"`,this.pos);if(Object.hasOwn(i,t))throw new S(`Duplicate option "${t}"`,this.pos);this.space(),this.expect(`{`),i[t]=this.message(n!==`select`),this.expect(`}`),this.space()}if(!Object.hasOwn(i,`other`))throw new S(`Missing "other" option`,e);return n===`select`?{type:`select`,name:t,options:i}:{type:`plural`,name:t,ordinal:n===`selectordinal`,offset:r,options:i}}throw new S(`Unsupported argument type "${n}"`,this.pos)}word(){let e=/^[^\s{}#,'"]+/u.exec(this.src.slice(this.pos));return e?(this.pos+=e[0].length,e[0]):``}space(){for(;this.pos<this.src.length&&/\s/u.test(this.src[this.pos]);)this.pos++}eat(e){return this.src[this.pos]===e&&(this.pos++,!0)}expect(e){if(!this.eat(e))throw new S(`Expected "${e}"`,this.pos)}};function C(e){return new He(e).parse()}function Ue(e){let t=new Set,n=e=>{for(let r of e)if(r.type===`arg`&&t.add(r.name),r.type===`plural`||r.type===`select`){t.add(r.name);for(let e of Object.values(r.options))n(e)}};return n(e),t}function w(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function We(e,t,n,r){let i=``;for(let a of e)switch(a.type){case`text`:i+=a.value;break;case`pound`:i+=r??`#`;break;case`arg`:{let e=t[a.name];e===void 0?i+=`{${a.name}}`:typeof e==`number`||a.style!==`plain`?i+=qe(Number(e),a.style,n):i+=e;break}case`select`:{let e=t[a.name],o=(e===void 0?void 0:w(a.options,String(e)))??w(a.options,`other`)??[];i+=We(o,t,n,r);break}case`plural`:{let e=Number(t[a.name]);if(Number.isNaN(e)){i+=We(w(a.options,`other`)??[],t,n,`{${a.name}}`);break}let r=w(a.options,`=${e}`),o=e-a.offset,s=Ke(n,a.ordinal).select(o),c=r??w(a.options,s)??w(a.options,`other`)??[];i+=We(c,t,n,qe(o,`number`,n));break}}return i}var Ge=new Map;function Ke(e,t){let n=`${e}|${t?`o`:`c`}`,r=Ge.get(n);return r||(r=new Intl.PluralRules(e,{type:t?`ordinal`:`cardinal`}),Ge.set(n,r)),r}function qe(e,t,n){return t===`integer`?new Intl.NumberFormat(n,{maximumFractionDigits:0}).format(e):t===`percent`?new Intl.NumberFormat(n,{style:`percent`}).format(e):new Intl.NumberFormat(n,{maximumFractionDigits:2}).format(e)}function Je(e,t=!1){return Ke(e,t).resolvedOptions().pluralCategories}var Ye=new Map,Xe={format(e,t,n){let r=Ye.get(e);if(r===void 0){try{r=C(e)}catch{r=null}Ye.set(e,r)}return r===null?e:We(r,t,n,null)}};function Ze(e,t){let n=[],r=e=>{for(let i of e){if(i.type===`plural`){let e=Je(t,i.ordinal).filter(e=>!Object.hasOwn(i.options,e));e.length>0&&n.push(`{${i.name}} lacks ${e.join(`, `)}`)}if(i.type===`plural`||i.type===`select`)for(let e of Object.values(i.options))r(e)}};return r(e),n}function Qe(e){let t=[];for(let[n,r]of Object.entries(e.messages))try{let i=C(r);for(let r of Ze(i,e.locale))t.push({key:n,kind:`plural`,detail:r})}catch(e){t.push({key:n,kind:`syntax`,detail:e.message})}return t}function $e(e,t){let n=Qe(t);for(let[r,i]of Object.entries(e.messages)){let e=Object.hasOwn(t.messages,r)?t.messages[r]:void 0;if(e===void 0)n.push({key:r,kind:`missing`,detail:`missing in ${t.locale}`});else try{let t=[...Ue(C(i))].sort().join(`,`),a=[...Ue(C(e))].sort().join(`,`);t!==a&&n.push({key:r,kind:`params`,detail:`expected {${t}}, got {${a}}`})}catch{}}for(let r of Object.keys(t.messages))Object.hasOwn(e.messages,r)||n.push({key:r,kind:`extra`,detail:`not in ${e.locale}`});return n}function et(e,t,n){let r=new Map(t.map(e=>[e.toLowerCase(),e]));for(let n of e){let e=n.toLowerCase().split(`-`);for(let t=e.length;t>0;t--){let n=r.get(e.slice(0,t).join(`-`));if(n)return n}let i=e[0],a=t.find(e=>e.toLowerCase().split(`-`)[0]===i);if(a)return a}return n}function tt(e){let t=e.split(`-`),n=[];for(let e=t.length;e>0;e--)n.push(t.slice(0,e).join(`-`).toLowerCase());return n}function nt(e){let t=e.fallbackLocale??`en`,n=e.formatter??Xe,r=new Map;for(let t of e.catalogs){let e=r.get(t.namespace);e||(e=new Map,r.set(t.namespace,e));let n=t.locale.toLowerCase(),i=e.get(n)??{locale:t.locale,messages:Object.create(null)};Object.assign(i.messages,t.messages),e.set(n,i)}let i=(e,i,a,o={})=>{let s=r.get(i);if(s)for(let r of[...tt(e),...tt(t)]){let e=s.get(r),t=e&&Object.hasOwn(e.messages,a)?e.messages[a]:void 0;if(e&&t!==void 0)return n.format(t,o,e.locale)}return a};return{fallbackLocale:t,locales(e){let t=new Set;for(let[n,i]of r)if(e===void 0||n===e)for(let e of i.values())t.add(e.locale);return[...t]},t:i,translator(e,t){return(n,r)=>i(e,t,n,r)},with(t){return nt({...e,catalogs:[...e.catalogs,...t]})}}}var rt=`astl.engine`,it={SOURCE_TOO_LARGE:`SOURCE_TOO_LARGE`,SOURCE_TOO_DEEP:`SOURCE_TOO_DEEP`,SOURCE_TOO_COMPLEX:`SOURCE_TOO_COMPLEX`,DOC_ROOT_INVALID:`DOC_ROOT_INVALID`,DOC_FORMAT_UNSUPPORTED:`DOC_FORMAT_UNSUPPORTED`,DOC_LANG_MISSING:`DOC_LANG_MISSING`,DOC_LANG_INVALID:`DOC_LANG_INVALID`,DOC_EMPTY:`DOC_EMPTY`,DOC_MIXED_PAGES:`DOC_MIXED_PAGES`,NO_COMPONENTS:`NO_COMPONENTS`,PAGE_EMPTY:`PAGE_EMPTY`,PAGE_NESTED:`PAGE_NESTED`,ID_MISSING:`ID_MISSING`,ID_INVALID:`ID_INVALID`,ID_DUPLICATE:`ID_DUPLICATE`,ELEMENT_UNKNOWN:`ELEMENT_UNKNOWN`,ELEMENT_REMOVED:`ELEMENT_REMOVED`,ATTRIBUTE_REMOVED:`ATTRIBUTE_REMOVED`,ATTRIBUTE_INVALID:`ATTRIBUTE_INVALID`,ATTRIBUTE_REQUIRED:`ATTRIBUTE_REQUIRED`,CHILD_UNEXPECTED:`CHILD_UNEXPECTED`,CHILD_OUTSIDE:`CHILD_OUTSIDE`,CHILD_COUNT:`CHILD_COUNT`,PLACEMENT_INVALID:`PLACEMENT_INVALID`,COMPONENT_NESTED:`COMPONENT_NESTED`,URL_BLOCKED:`URL_BLOCKED`,IMG_ALT_MISSING:`IMG_ALT_MISSING`,FIGURE_INVALID:`FIGURE_INVALID`,SCORING_MODE_INVALID:`SCORING_MODE_INVALID`,POINTS_INVALID:`POINTS_INVALID`,VERSION_UNSUPPORTED:`VERSION_UNSUPPORTED`,STYLE_TEMPLATE_UNKNOWN:`STYLE_TEMPLATE_UNKNOWN`,STYLE_REMOVED:`STYLE_REMOVED`,STYLE_TOO_LONG:`STYLE_TOO_LONG`,STYLE_UNKNOWN:`STYLE_UNKNOWN`,STYLE_NAME_INVALID:`STYLE_NAME_INVALID`,STYLE_RULES_TOO_MANY:`STYLE_RULES_TOO_MANY`,STYLE_TOO_LARGE:`STYLE_TOO_LARGE`,STYLE_LOW_CONTRAST:`STYLE_LOW_CONTRAST`,HELP_UNGRADED:`HELP_UNGRADED`,HELP_EMPTY:`HELP_EMPTY`,HINT_COST_INVALID:`HINT_COST_INVALID`,FEEDBACK_WHEN_INVALID:`FEEDBACK_WHEN_INVALID`,FEEDBACK_DUPLICATE:`FEEDBACK_DUPLICATE`,EXPLANATION_DUPLICATE:`EXPLANATION_DUPLICATE`,COLUMNS_INVALID:`COLUMNS_INVALID`};function at(e){return e.some(e=>e.severity===`error`)}var ot=`style-template`,st=/^(?=.{1,40}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ct=[`document`,`component`],lt=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ut=e=>e===void 0||lt(e)&&Object.values(e).every(e=>typeof e==`string`);function dt(e){if(!lt(e))return!1;let{name:t,version:n,scopes:r,components:i,messages:a,catalogs:o,tokens:s,light:c,dark:l,parts:u}=e;return typeof t==`string`&&st.test(t)&&typeof n==`number`&&Number.isInteger(n)&&n>=1&&Array.isArray(r)&&r.length>0&&new Set(r).size===r.length&&r.every(e=>ct.includes(e))&&(i===void 0||Array.isArray(i)&&i.every(e=>typeof e==`string`))&&typeof a==`string`&&(o===void 0||Array.isArray(o))&&ut(s)&&ut(c)&&ut(l)&&(u===void 0||lt(u)&&Object.values(u).every(e=>lt(e)&&Object.values(e).every(ut)))}var ft=[{name:`id`,type:`id`,visibility:`public`,required:!0},{name:`v`,type:`integer`,visibility:`public`,min:1},{name:ot,type:`string`,visibility:`public`}],pt=[{name:`scoring`,type:`string`,visibility:`private`},{name:`points`,type:`number`,visibility:`private`,min:.01,max:1e3,default:1}];function mt(e){return{name:`variant`,type:`enum`,visibility:`public`,values:e.values,default:e.default}}function ht(e){let t=e.scoring===null?[]:pt,n=e.variants===null?[]:[mt(e.variants)];return[...ft,...t,...n,...e.attributes]}function gt(e){return JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:1)):t)}function _t(e,t){let n=e=>gt([...e.attributes].sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)));return e.visibility===t.visibility&&n(e)===n(t)}function vt(e){let t=new Map;for(let n of e)for(let e of n.children){let r=t.get(e.tag);if(r===void 0)t.set(e.tag,{component:n.tag,spec:e});else if(!_t(r.spec,e))return{tag:e.tag,components:[r.component,n.tag]}}return null}var T={change:`astl-change`,ready:`astl-ready`,page:`astl-page`,state:`astl-state`,result:`astl-result`,snapshot:`astl-snapshot`,error:`astl-error`},yt={mode:`practice`,navigation:`free`,maxChecks:null,deadline:null,passMark:null,reveal:`answers`,seed:null,hints:!0,checkScope:`interaction`,feedback:`check`,explanations:`check`},bt={mode:`test`,navigation:`free`,maxChecks:0,deadline:null,passMark:null,reveal:`score`,seed:null,hints:!1,checkScope:`exercise`,feedback:`submit`,explanations:`submit`};function xt(e){let t=e.mode===`practice`?yt:bt,n=e.mode===`practice`;return{hints:n&&(e.hints??t.hints)===!0,checkScope:n?e.checkScope??t.checkScope??`exercise`:`exercise`,feedback:e.feedback??t.feedback??`never`,explanations:e.explanations??t.explanations??`never`}}var St=e=>e===`never`||e===`check`||e===`submit`;function Ct(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.mode===`practice`||t.mode===`test`||t.mode===`review`)&&(t.navigation===`free`||t.navigation===`linear`)&&(e=>e===null||typeof e==`number`&&Number.isFinite(e)&&e>=0)(t.maxChecks)&&(t.deadline===null||typeof t.deadline==`string`&&!Number.isNaN(Date.parse(t.deadline)))&&(t.passMark===null||typeof t.passMark==`number`&&t.passMark>=0&&t.passMark<=1)&&(t.reveal===`nothing`||t.reveal===`score`||t.reveal===`answers`)&&(t.seed===null||typeof t.seed==`string`)&&(t.hints===void 0||typeof t.hints==`boolean`)&&(t.checkScope===void 0||t.checkScope===`exercise`||t.checkScope===`interaction`)&&(t.feedback===void 0||St(t.feedback))&&(t.explanations===void 0||St(t.explanations))}var wt=1,Tt=`application/json`,Et=`application/problem+json`,Dt={check:`check`,submit:`submit`,hint:`hint`},E={invalidRequest:`invalid_request`,unauthorized:`unauthorized`,checkNotAllowed:`check_not_allowed`,checksExhausted:`checks_exhausted`,hintsNotAllowed:`hints_not_allowed`,hintsExhausted:`hints_exhausted`,notFound:`not_found`,methodNotAllowed:`method_not_allowed`,attemptClosed:`attempt_closed`,payloadTooLarge:`payload_too_large`,internal:`internal_error`},Ot=262144;function kt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.title==`string`&&typeof t.status==`number`&&typeof t.code==`string`}function At(e){return Math.round(e*100)/100}var jt=[`all-correct`,`per-slot`,`proportional`];function Mt(e,t,n){return e===`per-slot`?t*n:t}var Nt={form:`NFC`,space:`collapse`,case:`insensitive`,marks:`strict`,punctuation:`ignore-edge`,quotes:`fold`},Pt=1;function Ft(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.format===1&&(t.viewHash===null||typeof t.viewHash==`string`)&&s(t.answers)&&Number.isInteger(t.page)&&(t.page??-1)>=0&&Number.isInteger(t.checks)&&typeof t.submitted==`boolean`&&typeof t.ui==`object`&&t.ui!==null&&typeof t.savedAt==`string`}var It={"playful.label":`Playful`,"playful.description":`Rounder shapes, bolder lines and brighter colours, still calm enough to read.`,"notebook.label":`Notebook`,"notebook.description":`Cream paper, ink-blue text and small corners, like a school notebook.`},Lt={"playful.label":`Zabawny`,"playful.description":`Bardziej zaokrąglone kształty, grubsze linie i żywsze kolory, a tekst nadal czyta się spokojnie.`,"notebook.label":`Zeszyt`,"notebook.description":`Kremowy papier, granatowy tekst i małe zaokrąglenia, jak w szkolnym zeszycie.`},Rt=[`palette-1`,`palette-2`,`palette-3`,`palette-4`,`palette-5`,`palette-6`,`palette-7`,`palette-8`],zt=[[`#066086`,`#e5f3fe`,`#59c7fe`,`#152c3a`,`#035678`],[`#7d5036`,`#ffeee4`,`#f9914d`,`#37261c`,`#884501`],[`#6d377e`,`#f8edfb`,`#d08edc`,`#332635`,`#663575`],[`#7c6301`,`#f8f0e1`,`#ffe490`,`#2f2a19`,`#6b5500`],[`#016f6f`,`#def5f5`,`#10c7c8`,`#0f2f2f`,`#045455`],[`#603211`,`#ffede4`,`#bd8c68`,`#37271b`,`#4e2104`],[`#9a2b64`,`#ffecf3`,`#e27eaa`,`#39242d`,`#9a2562`],[`#4b4f00`,`#f3f1e2`,`#bdc16c`,`#2b2b19`,`#3d4100`]];function Bt(e){return Object.fromEntries(Rt.flatMap((t,n)=>{let[r=``,i=``,a=``,o=``,s=``]=zt[n]??[],[c,l]={light:[r,i],dark:[a,o],hc:[s,`#ffffff`],forced:[`CanvasText`,`Canvas`]}[e];return[[t,c],[`${t}-soft`,l]]}))}var Vt=`system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif`,D={scale:{"font-body":Vt,"font-display":Vt,"font-mono":`ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace`,"size-content":`1.1875rem`,"size-ui":`1rem`,"size-small":`0.875rem`,"line-height-content":`1.6`,"space-1":`0.25rem`,"space-2":`0.5rem`,"space-3":`0.75rem`,"space-4":`1rem`,"space-5":`1.5rem`,"space-6":`2rem`,"space-7":`3rem`,"space-8":`4rem`,"radius-s":`4px`,"radius-m":`8px`,"radius-l":`12px`,"radius-pill":`999px`,"outline-width":`2px`,"focus-width":`3px`,"focus-offset":`2px`,"target-min":`44px`,"duration-fast":`120ms`,"duration-normal":`200ms`,"separator-display":`none`},themeScale:{light:{"selected-bar":`0px`,"selected-weight":`normal`},dark:{"selected-bar":`0px`,"selected-weight":`normal`},hc:{"selected-bar":`6px`,"selected-weight":`700`}},themes:{light:{canvas:`#f3f4f6`,surface:`#ffffff`,"surface-raised":`#ffffff`,ink:`#16191d`,"ink-muted":`#4f5763`,line:`#d3d7de`,outline:`#6b7380`,accent:`#1d55c9`,"on-accent":`#ffffff`,"accent-soft":`#e7eefb`,focus:`#1d4fbf`,success:`#1b7337`,"success-soft":`#e5f3e9`,"on-success":`#ffffff`,danger:`#b3261e`,"danger-soft":`#fcebea`,warning:`#8a4f00`,"warning-soft":`#fcf1df`,selected:`#5233b8`,"selected-soft":`#efebfb`,...Bt(`light`)},dark:{canvas:`#0f1114`,surface:`#1a1d21`,"surface-raised":`#23272c`,ink:`#eceef1`,"ink-muted":`#aab1bc`,line:`#3a3f47`,outline:`#8a929e`,accent:`#8bb3ff`,"on-accent":`#0a1530`,"accent-soft":`#1d2a45`,focus:`#9fc0ff`,success:`#6dcf8d`,"success-soft":`#14301f`,"on-success":`#062010`,danger:`#ff8a80`,"danger-soft":`#3d1715`,warning:`#f0bd62`,"warning-soft":`#3a2a0d`,selected:`#b9a6ff`,"selected-soft":`#2a2448`,...Bt(`dark`)},hc:{canvas:`#ffffff`,surface:`#ffffff`,"surface-raised":`#ffffff`,ink:`#000000`,"ink-muted":`#2b2b2b`,line:`#000000`,outline:`#000000`,accent:`#000000`,"on-accent":`#ffffff`,"accent-soft":`#ffffff`,focus:`#000000`,success:`#005a1e`,"success-soft":`#ffffff`,"on-success":`#ffffff`,danger:`#8f0000`,"danger-soft":`#ffffff`,warning:`#5a3600`,"warning-soft":`#ffffff`,selected:`#000000`,"selected-soft":`#ffffff`,...Bt(`hc`)}},forced:{canvas:`Canvas`,surface:`Canvas`,"surface-raised":`Canvas`,ink:`CanvasText`,"ink-muted":`CanvasText`,line:`GrayText`,outline:`ButtonText`,accent:`Highlight`,"on-accent":`HighlightText`,"accent-soft":`Canvas`,focus:`Highlight`,success:`CanvasText`,"success-soft":`Canvas`,"on-success":`Canvas`,danger:`CanvasText`,"danger-soft":`Canvas`,warning:`CanvasText`,"warning-soft":`Canvas`,selected:`Highlight`,"selected-soft":`Canvas`,...Bt(`forced`)}};function Ht(e){let t=D.themes[e];return Object.fromEntries(Rt.flatMap(e=>[[e,t[e]],[`${e}-soft`,t[`${e}-soft`]]]))}function Ut(e){let t=(t,n)=>({namespace:`astl.style.${e}`,locale:t,messages:{label:n[`${e}.label`]??``,description:n[`${e}.description`]??``}});return[t(`en`,It),t(`pl`,Lt)]}var Wt=`ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Nunito, "Varela Round", system-ui, sans-serif`,Gt=`ui-rounded, "Arial Rounded MT Bold", "SF Pro Rounded", Nunito, "Varela Round", system-ui, sans-serif`,Kt=`"Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif`,qt=[`astl-categorise`,`astl-choice`,`astl-crossword`,`astl-hotspot`,`astl-image-drop`,`astl-image-label`,`astl-long-answer`,`astl-mark-words`,`astl-match`,`astl-memory`,`astl-order`,`astl-true-false`,`astl-word-search`],Jt=[{name:`playful`,version:1,scopes:[`document`,`component`],messages:`astl.style.playful`,catalogs:Ut(`playful`),tokens:{"font-body":Wt,"font-display":Gt,"radius-s":`6px`,"radius-m":`16px`,"radius-l":`24px`,"outline-width":`3px`},light:{canvas:`#f5f0ff`,surface:`#ffffff`,"surface-raised":`#ffffff`,ink:`#1f1830`,"ink-muted":`#544a6b`,line:`#d8ccf3`,outline:`#7556b8`,accent:`#7428c9`,"on-accent":`#ffffff`,"accent-soft":`#f0e6ff`,focus:`#b3136a`,success:`#17733f`,"success-soft":`#e3f5ea`,"on-success":`#ffffff`,danger:`#b3261e`,"danger-soft":`#fdebea`,warning:`#8a4b00`,"warning-soft":`#fff0db`,selected:`#1f5bc6`,"selected-soft":`#e8effc`,...Ht(`light`)},dark:{canvas:`#150f1f`,surface:`#211830`,"surface-raised":`#2a1f3d`,ink:`#f3eeff`,"ink-muted":`#c3b6de`,line:`#45385e`,outline:`#a492cf`,accent:`#c7a2ff`,"on-accent":`#1c0b36`,"accent-soft":`#33214f`,focus:`#ff8fd0`,success:`#70d498`,"success-soft":`#15301f`,"on-success":`#06200f`,danger:`#ff8f85`,"danger-soft":`#3d1716`,warning:`#f6bf66`,"warning-soft":`#3a290d`,selected:`#8fb8ff`,"selected-soft":`#16284a`,...Ht(`dark`)},parts:{...Object.fromEntries([`astl-choice`,`astl-true-false`,`astl-match`].map(e=>[e,{option:{"box-shadow":`0 3px 0 var(--astl-line)`}}])),"astl-select":{listbox:{"box-shadow":`0 3px 0 var(--astl-line)`},"option-active":{"border-radius":`var(--astl-radius-s)`}}}},{name:`notebook`,version:1,scopes:[`document`,`component`],messages:`astl.style.notebook`,catalogs:Ut(`notebook`),tokens:{"font-display":Kt,"radius-s":`2px`,"radius-m":`3px`,"radius-l":`4px`,"radius-pill":`4px`,"separator-display":`inline`},light:{canvas:`#ece5d4`,surface:`#fffdf5`,"surface-raised":`#fffbee`,ink:`#1c2333`,"ink-muted":`#485166`,line:`#b4cbea`,outline:`#5c6c8c`,accent:`#1c4ba3`,"on-accent":`#ffffff`,"accent-soft":`#e5edfa`,focus:`#2152b0`,success:`#1d6b3a`,"success-soft":`#e6f2e6`,"on-success":`#ffffff`,danger:`#ad2a22`,"danger-soft":`#fbe9e4`,warning:`#844b00`,"warning-soft":`#fbeed6`,selected:`#6c3796`,"selected-soft":`#f2e9f8`,...Ht(`light`)},dark:{canvas:`#12151b`,surface:`#1b1f27`,"surface-raised":`#232833`,ink:`#e8ecf4`,"ink-muted":`#adb5c6`,line:`#384760`,outline:`#8491a8`,accent:`#9bbfff`,"on-accent":`#0c1a33`,"accent-soft":`#1d2a43`,focus:`#a9c8ff`,success:`#76cf92`,"success-soft":`#15301e`,"on-success":`#06200f`,danger:`#ff8f85`,"danger-soft":`#3b1816`,warning:`#f0be66`,"warning-soft":`#382a10`,selected:`#d4abf2`,"selected-soft":`#2d2340`,...Ht(`dark`)},parts:Object.fromEntries(qt.map(e=>[e,{prompt:{"font-family":`var(--astl-font-display)`}}]))}];function Yt(e,t){if(e===`:host`)return`:host(${t})`;let n=/^:host\((.*)\)$/.exec(e);return n?`:host(${n[1]}${t})`:`${e}${t}`}function Xt(e){return Object.entries(e).map(([e,t])=>` --astl-${e}: ${t};\n`).join(``)}function O(e,t){return`${e} {\n${t}}\n`}function Zt(e,t,n){return` color-scheme: ${t};\n${Xt(n)}${Xt(D.themeScale[e])}`}function Qt(e){let t=e.split(`,`).map(e=>e.trim()).filter(e=>e!==``),n=t.join(`, `),r=e=>t.map(t=>Yt(t,`[data-theme="${e}"]`)).join(`, `),i=`${n}, ${t.map(e=>Yt(e,`[data-theme]`)).join(`, `)}`,{light:a,dark:o,hc:s}=D.themes;return[O(n,`${Xt(D.scale)}${Zt(`light`,`light`,a)}`),O(r(`dark`),Zt(`dark`,`dark`,o)),O(r(`hc`),Zt(`hc`,`light`,s)),`@media (prefers-color-scheme: dark) {\n${O(r(`auto`),Zt(`dark`,`dark`,o))}}\n`,`@media (forced-colors: active) {\n${O(i,Xt(D.forced))}}\n`,`@media (prefers-reduced-motion: reduce) {\n${O(i,` --astl-duration-fast: 0ms;
|
|
2
|
+
--astl-duration-normal: 0ms;
|
|
3
|
+
`)}}\n`].join(``)}var $t=new Set([`border-radius`,`border-start-start-radius`,`border-start-end-radius`,`border-end-start-radius`,`border-end-end-radius`,`box-shadow`,`padding`,`padding-block`,`padding-block-start`,`padding-block-end`,`padding-inline`,`padding-inline-start`,`padding-inline-end`,`gap`,`row-gap`,`column-gap`,`font-family`,`font-style`,`letter-spacing`,`line-height`]);function en(e){if(typeof e!=`string`||e.trim()===``||/[{};<>\\\n\r\f]|\/\*/.test(e))return!1;let t=[],n=null;for(let r of e)if(n!==null)r===n&&(n=null);else if(r===`"`||r===`'`)n=r;else if(r===`(`||r===`[`)t.push(r===`(`?`)`:`]`);else if((r===`)`||r===`]`)&&t.pop()!==r)return!1;return n===null&&t.length===0}var tn=[{tag:`astl-gap`,load:async()=>(await import(`./gap-lor-khst.js`)).gapElement},{tag:`astl-choice`,load:async()=>(await import(`./choice-CExBvqKj.js`)).choiceElement},{tag:`astl-select`,load:async()=>(await import(`./select-DTA3dJzr.js`)).selectElement},{tag:`astl-true-false`,load:async()=>(await import(`./true-false-DP3MO599.js`)).trueFalseElement},{tag:`astl-order`,load:async()=>(await import(`./order-BhG_6IC-.js`)).orderElement},{tag:`astl-categorise`,load:async()=>(await import(`./categorise-BO2tNVJ3.js`)).categoriseElement},{tag:`astl-match`,load:async()=>(await import(`./match-DKE_4o-x.js`)).matchElement},{tag:`astl-word-bank`,load:async()=>(await import(`./word-bank-ARjwUKZf.js`)).wordBankElement},{tag:`astl-drop`,load:async()=>(await import(`./drop-vRXndjHu.js`)).dropElement},{tag:`astl-word-search`,load:async()=>(await import(`./word-search-AHvM7yCJ.js`)).wordSearchElement},{tag:`astl-memory`,load:async()=>(await import(`./memory-B6hSyHyz.js`)).memoryElement},{tag:`astl-crossword`,load:async()=>(await import(`./crossword-Cb-a3Tjj.js`)).crosswordElement},{tag:`astl-flash-cards`,load:async()=>(await import(`./flash-cards-0NrrKdrx.js`)).flashCardsElement},{tag:`astl-long-answer`,load:async()=>(await import(`./long-answer-CtzClLAx.js`)).longAnswerElement},{tag:`astl-mark-words`,load:async()=>(await import(`./mark-words-CpH3gTcX.js`)).markWordsElement},{tag:`astl-callout`,load:async()=>(await import(`./callout-QFLFLPc5.js`)).calloutElement},{tag:`astl-hotspot`,load:async()=>(await import(`./hotspot-oel1Eelo.js`)).hotspotElement},{tag:`astl-image-drop`,load:async()=>(await import(`./image-drop-Dkprw0Kn.js`)).imageDropElement},{tag:`astl-image-label`,load:async()=>(await import(`./image-label-Dm5shQSh.js`)).imageLabelElement},{tag:`astl-video`,load:async()=>(await import(`./video-j9MCH6Kw.js`)).videoElement},{tag:`astl-audio`,load:async()=>(await import(`./audio-B0LSIn5N.js`)).audioElement}],nn=globalThis,rn=nn.ShadowRoot&&(nn.ShadyCSS===void 0||nn.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,an=Symbol(),on=new WeakMap,sn=class{constructor(e,t,n){
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2019 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
if(this._$cssResult$=!0,n!==an)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(rn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=on.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&on.set(t,e))}return e}toString(){return this.cssText}},cn=e=>new sn(typeof e==`string`?e:e+``,void 0,an),k=(e,...t)=>new sn(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,an),ln=(e,t)=>{if(rn)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=nn.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},un=rn?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return cn(t)})(e):e,{is:dn,defineProperty:fn,getOwnPropertyDescriptor:pn,getOwnPropertyNames:mn,getOwnPropertySymbols:hn,getPrototypeOf:gn}=Object,_n=globalThis,vn=_n.trustedTypes,yn=vn?vn.emptyScript:``,bn=_n.reactiveElementPolyfillSupport,A=(e,t)=>e,xn={toAttribute(e,t){
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2017 Google LLC
|
|
13
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
+
*/
|
|
15
|
+
switch(t){case Boolean:e=e?yn:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Sn=(e,t)=>!dn(e,t),Cn={attribute:!0,type:String,converter:xn,reflect:!1,useDefault:!1,hasChanged:Sn};Symbol.metadata??=Symbol(`metadata`),_n.litPropertyMetadata??=new WeakMap;var j=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Cn){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&fn(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=pn(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Cn}static _$Ei(){if(this.hasOwnProperty(A(`elementProperties`)))return;let e=gn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(A(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(A(`properties`))){let e=this.properties,t=[...mn(e),...hn(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(un(e))}else e!==void 0&&t.push(un(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ln(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?xn:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?xn:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Sn)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};j.elementStyles=[],j.shadowRootOptions={mode:`open`},j[A(`elementProperties`)]=new Map,j[A(`finalized`)]=new Map,bn?.({ReactiveElement:j}),(_n.reactiveElementVersions??=[]).push(`2.1.2`);
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2017 Google LLC
|
|
19
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
+
*/
|
|
21
|
+
var wn=globalThis,Tn=e=>e,En=wn.trustedTypes,Dn=En?En.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,On=`$lit$`,M=`lit$${Math.random().toFixed(9).slice(2)}$`,kn=`?`+M,An=`<${kn}>`,N=document,P=()=>N.createComment(``),F=e=>e===null||typeof e!=`object`&&typeof e!=`function`,jn=Array.isArray,Mn=e=>jn(e)||typeof e?.[Symbol.iterator]==`function`,Nn=`[
|
|
22
|
+
\f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Pn=/-->/g,Fn=/>/g,L=RegExp(`>|${Nn}(?:([^\\s"'>=/]+)(${Nn}*=${Nn}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),In=/'/g,Ln=/"/g,Rn=/^(?:script|style|textarea|title)$/i,zn=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),R=zn(1),z=zn(2),B=Symbol.for(`lit-noChange`),V=Symbol.for(`lit-nothing`),Bn=new WeakMap,H=N.createTreeWalker(N,129);function Vn(e,t){if(!jn(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Dn===void 0?t:Dn.createHTML(t)}var Hn=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=I;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===I?c[1]===`!--`?o=Pn:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=L):(Rn.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=L):o=Fn:o===L?c[0]===`>`?(o=i??I,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?L:c[3]===`"`?Ln:In):o===Ln||o===In?o=L:o===Pn||o===Fn?o=I:(o=L,i=void 0);let d=o===L&&e[t+1].startsWith(`/>`)?` `:``;a+=o===I?n+An:l>=0?(r.push(s),n.slice(0,l)+On+n.slice(l)+M+d):n+M+(l===-2?t:d)}return[Vn(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Un=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Hn(t,n);if(this.el=e.createElement(l,r),H.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=H.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(On)){let t=u[o++],n=i.getAttribute(e).split(M),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Kn:r[1]===`?`?qn:r[1]===`@`?Jn:W}),i.removeAttribute(e)}else e.startsWith(M)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Rn.test(i.tagName)){let e=i.textContent.split(M),t=e.length-1;if(t>0){i.textContent=En?En.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],P()),H.nextNode(),c.push({type:2,index:++a});i.append(e[t],P())}}}else if(i.nodeType===8){if(i.data===kn)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(M,e+1))!==-1;)c.push({type:7,index:a}),e+=M.length-1}}a++}}static createElement(e,t){let n=N.createElement(`template`);return n.innerHTML=e,n}};function U(e,t,n=e,r){if(t===B)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=F(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=U(e,i._$AS(e,t.values),i,r)),t}var Wn=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??N).importNode(t,!0);H.currentNode=r;let i=H.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Gn(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Yn(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=H.nextNode(),a++)}return H.currentNode=N,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Gn=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=U(this,e,t),F(e)?e===V||e==null||e===``?(this._$AH!==V&&this._$AR(),this._$AH=V):e!==this._$AH&&e!==B&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Mn(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==V&&F(this._$AH)?this._$AA.nextSibling.data=e:this.T(N.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Un.createElement(Vn(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Wn(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Bn.get(e.strings);return t===void 0&&Bn.set(e.strings,t=new Un(e)),t}k(t){jn(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(P()),this.O(P()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=Tn(e).nextSibling;Tn(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},W=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=V,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=V}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=U(this,e,t,0),a=!F(e)||e!==this._$AH&&e!==B,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=U(this,r[n+o],t,o),s===B&&(s=this._$AH[o]),a||=!F(s)||s!==this._$AH[o],s===V?e=V:e!==V&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Kn=class extends W{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===V?void 0:e}},qn=class extends W{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==V)}},Jn=class extends W{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=U(this,e,t,0)??V)===B)return;let n=this._$AH,r=e===V&&n!==V||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==V&&(n===V||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Yn=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){U(this,e)}},Xn={M:On,P:M,A:kn,C:1,L:Hn,R:Wn,D:Mn,V:U,I:Gn,H:W,N:qn,U:Jn,B:Kn,F:Yn},Zn=wn.litHtmlPolyfillSupport;Zn?.(Un,Gn),(wn.litHtmlVersions??=[]).push(`3.3.3`);var Qn=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Gn(t.insertBefore(P(),e),e,void 0,n??{})}return i._$AI(e),i},$n=globalThis,G=class extends j{constructor(){
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Qn(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};G._$litElement$=!0,G.finalized=!0,$n.litElementHydrateSupport?.({LitElement:G});var er=$n.litElementPolyfillSupport;er?.({LitElement:G}),($n.litElementVersions??=[]).push(`4.2.2`);
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2018 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/var tr=e=>e??V,nr=k`
|
|
34
|
+
.astl-vh {
|
|
35
|
+
position: absolute !important;
|
|
36
|
+
inline-size: 1px !important;
|
|
37
|
+
block-size: 1px !important;
|
|
38
|
+
margin: -1px !important;
|
|
39
|
+
padding: 0 !important;
|
|
40
|
+
border: 0 !important;
|
|
41
|
+
overflow: hidden !important;
|
|
42
|
+
clip-path: inset(50%) !important;
|
|
43
|
+
white-space: nowrap !important;
|
|
44
|
+
}
|
|
45
|
+
`,rr=k`
|
|
46
|
+
[data-verdict='correct'] {
|
|
47
|
+
--astl-verdict-color: var(--astl-success);
|
|
48
|
+
--astl-verdict-soft: var(--astl-success-soft);
|
|
49
|
+
--astl-verdict-border: solid;
|
|
50
|
+
}
|
|
51
|
+
[data-verdict='partial'] {
|
|
52
|
+
--astl-verdict-color: var(--astl-warning);
|
|
53
|
+
--astl-verdict-soft: var(--astl-warning-soft);
|
|
54
|
+
--astl-verdict-border: double;
|
|
55
|
+
}
|
|
56
|
+
[data-verdict='incorrect'] {
|
|
57
|
+
--astl-verdict-color: var(--astl-danger);
|
|
58
|
+
--astl-verdict-soft: var(--astl-danger-soft);
|
|
59
|
+
--astl-verdict-border: dashed;
|
|
60
|
+
}
|
|
61
|
+
[data-verdict='empty'] {
|
|
62
|
+
--astl-verdict-color: var(--astl-ink-muted);
|
|
63
|
+
--astl-verdict-soft: var(--astl-surface);
|
|
64
|
+
--astl-verdict-border: dotted;
|
|
65
|
+
}
|
|
66
|
+
.astl-verdict {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: var(--astl-space-1);
|
|
70
|
+
color: var(--astl-verdict-color);
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
}
|
|
73
|
+
.astl-verdict-icon {
|
|
74
|
+
inline-size: 1.1em;
|
|
75
|
+
block-size: 1.1em;
|
|
76
|
+
flex: none;
|
|
77
|
+
}
|
|
78
|
+
`,ir={correct:z`<path d="M4 10.5l4 4 8-9" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>`,partial:z`<circle cx="10" cy="10" r="7" fill="none" stroke="currentColor" stroke-width="2"/><path d="M10 3a7 7 0 0 0 0 14z" fill="currentColor"/>`,incorrect:z`<path d="M5.5 5.5l9 9m0-9l-9 9" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"/>`,empty:z`<circle cx="10" cy="10" r="7" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="3 3"/>`};function ar(e){return R`<svg class="astl-verdict-icon" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${ir[e]}</svg>`}function or(e,t,n={}){return R`<span class="astl-verdict" data-verdict=${e} part=${tr(n.part)}
|
|
79
|
+
>${ar(e)}<span
|
|
80
|
+
class=${n.hiddenWord?`astl-vh`:`astl-verdict-word`}
|
|
81
|
+
id=${tr(n.id)}
|
|
82
|
+
lang=${tr(n.lang)}
|
|
83
|
+
dir=${tr(n.dir)}
|
|
84
|
+
>${t(`verdict.${e}`)}</span
|
|
85
|
+
></span
|
|
86
|
+
>`}var sr=new WeakMap;function cr(e,t){clearTimeout(sr.get(e)),e.textContent=``,sr.set(e,setTimeout(()=>{e.textContent=t},60))}var K=null;function lr(){return K?.isConnected||(K=document.createElement(`div`),K.setAttribute(`aria-live`,`polite`),K.style.cssText=`position:absolute;inline-size:1px;block-size:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap`,document.body.append(K)),K}function q(e,t,n){return new f({type:`urn:astrolabe:problem:${e}`,title:e,status:t,code:e,...n===void 0?{}:{detail:n}})}function ur(e){return e instanceof f?e:q(E.internal,500,e instanceof Error?e.message:String(e))}var dr=class e{policy;pages;viewHash;restored;checker;#e;#t;#n={};#r=0;#i=0;#a;#o=null;#s=null;#c=null;#l=null;#u=null;#d=new Set;#f;constructor(e){this.policy=e.policy,this.checker=e.checker,this.pages=e.pages,this.viewHash=e.viewHash??null,this.#e=e.now??Date.now,this.#f=new Set(this.pages.flatMap(e=>e.slotIds));let t=this.#_(e.snapshot??null);if(this.restored=t!==null,t){for(let[e,n]of Object.entries(t.answers))this.#f.has(e)&&n!==``&&(this.#n[e]=n);this.#r=Math.min(t.page,Math.max(0,this.pages.length-1)),this.#i=t.checks}this.#a=this.policy.maxChecks===null?null:Math.max(0,this.policy.maxChecks-this.#i),this.#t=this.policy.mode===`review`?`review`:t?.submitted?`submitted`:t&&(Object.keys(this.#n).length>0||this.#i>0)?`active`:`ready`}static restorable(e,t){return Ft(e)&&(e.viewHash===null||e.viewHash===t)?e:null}get state(){return this.#t}get answers(){return{...this.#n}}get page(){return this.#r}get pageCount(){return this.pages.length}get checks(){return this.#i}get checksLeft(){return this.#a}get result(){return this.#o}get solution(){return this.#s}get response(){return this.#c}get readOnly(){return this.#t===`review`||this.#t===`submitting`||this.#t===`submitted`}canCheck(){return this.policy.mode===`practice`&&(this.#t===`ready`||this.#t===`active`)&&this.#a!==0}canSubmit(){return this.policy.mode!==`review`&&(this.#t===`ready`||this.#t===`active`)}canGoTo(e){return!Number.isInteger(e)||e<0||e>=this.pages.length?!1:e>=this.#r||this.policy.navigation===`free`||this.readOnly}subscribe(e){return this.#d.add(e),()=>this.#d.delete(e)}start(){this.#t===`ready`&&this.#v(`active`)}setAnswers(e){if(this.readOnly)return{};let t={};for(let[n,r]of Object.entries(e))this.#f.has(n)&&(this.#n[n]??``)!==r&&(r===``?delete this.#n[n]:this.#n[n]=r,t[n]=r);return Object.keys(t).length===0||(this.start(),this.#y({type:`answers`,answers:t})),t}goTo(e){if(e===this.#r||!this.canGoTo(e))return!1;let t=this.#r;return this.#r=e,this.#y({type:`page`,index:e,previous:t}),!0}next(){return this.goTo(this.#r+1)}previous(){return this.goTo(this.#r-1)}check(e){return this.#p(e)}checkElement(e){return this.#p(void 0,e)}#p(e,t){if(this.#l)return this.#l;let n=this.#m(e,t);if(n)return Promise.reject(n);let r=this.#h(e,t).finally(()=>{this.#l=null});return this.#l=r,r}submit(){if(this.#u)return this.#u;if(this.policy.mode===`review`||this.#t===`submitted`)return Promise.reject(q(E.attemptClosed,409));let e=this.#g().finally(()=>{this.#u=null});return this.#u=e,e}reset(){if(this.#t!==`ready`&&this.#t!==`active`)return!1;this.#n={},this.#o=null,this.#s=null,this.#c=null;let e=this.#r;return this.#r=0,this.#y({type:`reset`}),e!==0&&this.#y({type:`page`,index:0,previous:e}),!0}snapshot(e={}){return{format:1,viewHash:this.viewHash,answers:this.answers,page:this.#r,checks:this.#i,submitted:this.#t===`submitted`,ui:e,savedAt:new Date(this.#e()).toISOString()}}emptySlots(e){return(e===void 0?this.pages:this.pages.slice(e,e+1)).flatMap(e=>e.slotIds).filter(e=>(this.#n[e]??``)===``)}timeLeft(){return this.policy.deadline===null?null:Math.max(0,Date.parse(this.policy.deadline)-this.#e())}#m(e,t){return this.policy.mode!==`practice`||t!==void 0&&xt(this.policy).checkScope!==`interaction`?q(E.checkNotAllowed,403):this.#t===`submitting`||this.#t===`submitted`||this.#t===`review`?q(E.attemptClosed,409):this.#a===0?q(E.checksExhausted,403):e!==void 0&&!this.pages.some(t=>t.id===e)?q(E.notFound,404):null}async#h(e,t){this.start(),this.#v(`checking`);try{let n=this.answers,r=e===void 0?t===void 0?{}:{element:t}:{page:e},i=await this.checker.check({answers:n,...r});return this.#i++,this.#a=i.checksLeft??(this.policy.maxChecks===null?null:Math.max(0,this.policy.maxChecks-this.#i)),t===void 0&&(this.#o=i.result,this.#c=i),this.#v(`active`),this.#y(t===void 0?{type:`result`,response:i}:{type:`element`,id:t,response:i}),i}catch(e){let t=ur(e);throw t.problem.code===E.checksExhausted&&(this.#a=0),this.#v(t.problem.code===E.attemptClosed?`submitted`:`active`),t}}async#g(){if(this.#l&&await this.#l.catch(()=>void 0),this.#t===`submitted`)throw q(E.attemptClosed,409);this.start(),this.#v(`submitting`);try{let e=await this.checker.submit({answers:this.answers});return this.#c=e,this.#o=e.result,this.#s=e.solution,this.#v(`submitted`),this.#y({type:`result`,response:e}),e}catch(e){let t=ur(e);throw this.#v(t.problem.code===E.attemptClosed?`submitted`:`active`),t}}#_(t){return e.restorable(t,this.viewHash)}#v(e){let t=this.#t;e!==t&&(this.#t=e,this.#y({type:`state`,state:e,previous:t}))}#y(e){for(let t of[...this.#d])t(e)}},fr={400:E.invalidRequest,401:E.unauthorized,403:E.unauthorized,404:E.notFound,405:E.methodNotAllowed,409:E.attemptClosed,413:E.payloadTooLarge};function J(e,t,n){return new f({type:`urn:astrolabe:problem:${e}`,title:e,status:t,code:e,...n===void 0?{}:{detail:n}})}function pr(e){try{return e===``?void 0:JSON.parse(e)}catch{return}}function mr({feedback:e,explanations:t}){let n=e=>typeof e==`object`&&!!e&&!Array.isArray(e);return{...n(e)?{feedback:e}:{},...n(t)?{explanations:t}:{}}}function hr(e){let t=e.endpoint.replace(/\/+$/,``),n=e.fetch??((e,t)=>globalThis.fetch(e,t));async function r(r,i){let a={method:`POST`,headers:{"content-type":Tt,accept:`${Tt}, ${Et}`,...e.headers},body:JSON.stringify(i),...e.credentials===void 0?{}:{credentials:e.credentials}},o,s;try{o=await n(`${t}/${r}`,a),s=await o.text()}catch(e){throw J(E.internal,0,e instanceof Error?e.message:String(e))}let c=pr(s),l=(o.headers.get(`content-type`)??``).includes(Et);if(!o.ok||l)throw kt(c)?new f({...c,type:typeof c.type==`string`?c.type:`about:blank`}):J(fr[o.status]??E.internal,o.status);if(typeof c!=`object`||!c||Array.isArray(c))throw J(E.internal,o.status,`response is not a JSON object`);return c}return{async check(e){let t=await r(Dt.check,e);if(typeof t.result!=`object`||t.result===null)throw J(E.internal,200,`check response without a result`);return{result:t.result,checksLeft:t.checksLeft??null,...mr(t)}},async submit(e){let t=await r(Dt.submit,e);if(typeof t.submittedAt!=`string`)throw J(E.internal,200,`submit response without submittedAt`);return{result:t.result??null,solution:t.solution??null,passed:t.passed??null,submittedAt:t.submittedAt,...mr(t)}},async hint(e){let t=await r(Dt.hint,e);if(typeof t.html!=`string`)throw J(E.internal,200,`hint response without html`);return t}}}var gr={loading:`Loading the exercise…`,"page.heading":`Page {n}`,"page.counter":`Page {n} of {total}`,"page.counter.spread":`Pages {from}-{to} of {total}`,"progress.label":`Pages`,"progress.item":`Page {n}, {state, select, done {answered} partial {partly answered} other {not answered}}`,"nav.previous":`Back`,"nav.next":`Next`,"action.check":`Check`,"action.reset":`Start over`,"action.submit":`Hand in`,"confirm.empty":`{count, plural, one {You have # empty answer.} other {You have # empty answers.}} Hand in anyway?`,"confirm.submit":`Hand in anyway`,"confirm.cancel":`Back to the answers`,"checks.left":`{count, plural, =0 {No checks left} one {# check left} other {# checks left}}`,"result.title":`Result`,"result.score":`{score} of {max, plural, one {# point} other {# points}}`,"result.count":`{verdict}: {count}`,"result.passed":`Passed`,"result.notPassed":`Not passed yet`,"result.submitted":`Your answers have been handed in.`,"result.later":`You will see your results later.`,"result.teacher.sent":`Your answers were sent to your teacher.`,"result.teacher.count":`{count, plural, =0 {No answer goes to your teacher to mark.} one {# answer goes to your teacher to mark.} other {# answers go to your teacher to mark.}}`,"result.teacher.unchecked":`Answers for your teacher are not checked here.`,"result.practice":`Practice only: nothing here is scored.`,"result.announce":`Result: {score}.`,"result.countAnnounce":`{verdict}: {count}.`,"verdict.correct":`Correct`,"verdict.partial":`Partly correct`,"verdict.incorrect":`Not yet`,"verdict.empty":`No answer`,"timer.label":`Time left`,"timer.minutes":`{minutes, plural, one {# minute left} other {# minutes left}}`,"timer.expired":`Time is up. Your answers are being handed in.`,unsupported:`This part of the exercise does not work in this player.`,"error.invalid_request":`Your answers could not be sent. Try again.`,"error.unauthorized":`We could not confirm who you are. Sign in and try again.`,"error.check_not_allowed":`Checking is turned off in this exercise.`,"error.checks_exhausted":`You have no checks left.`,"error.not_found":`This exercise could not be found.`,"error.method_not_allowed":`The exercise server turned the request down.`,"error.attempt_closed":`These answers have already been handed in.`,"error.payload_too_large":`Your answers are too long to send.`,"error.internal_error":`We could not reach the exercise server. Try again in a moment.`,"error.no_checker":`This exercise cannot be checked here.`,"error.load_failed":`The exercise could not be loaded.`,"error.view_invalid":`The exercise file is damaged.`,"error.integrity_mismatch":`The exercise file did not pass verification, so it was not opened.`,"error.source_needs_compiler":`This exercise needs the full Astrolabe script to run.`,"error.source_invalid":`This exercise is not written correctly, so it cannot be shown.`},_r={loading:`Wczytywanie zadania…`,"page.heading":`Strona {n}`,"page.counter":`Strona {n} z {total}`,"page.counter.spread":`Strony {from}-{to} z {total}`,"progress.label":`Strony`,"progress.item":`Strona {n}, {state, select, done {wszystko uzupełnione} partial {częściowo uzupełniona} other {bez odpowiedzi}}`,"nav.previous":`Wstecz`,"nav.next":`Dalej`,"action.check":`Sprawdź`,"action.reset":`Zacznij od nowa`,"action.submit":`Oddaj`,"confirm.empty":`{count, plural, one {Masz # pustą odpowiedź.} few {Masz # puste odpowiedzi.} many {Masz # pustych odpowiedzi.} other {Masz # pustej odpowiedzi.}} Oddać mimo to?`,"confirm.submit":`Oddaj mimo to`,"confirm.cancel":`Wróć do odpowiedzi`,"checks.left":`{count, plural, =0 {Nie masz już sprawdzeń} one {Zostało # sprawdzenie} few {Zostały # sprawdzenia} many {Zostało # sprawdzeń} other {Zostało # sprawdzenia}}`,"result.title":`Wynik`,"result.score":`{score} z {max, plural, one {# punktu} few {# punktów} many {# punktów} other {# punktu}}`,"result.count":`{verdict}: {count}`,"result.passed":`Zaliczone`,"result.notPassed":`Jeszcze nie zaliczone`,"result.submitted":`Twoje odpowiedzi zostały oddane.`,"result.later":`Wyniki zobaczysz później.`,"result.teacher.sent":`Twoje odpowiedzi trafiły do nauczyciela.`,"result.teacher.count":`{count, plural, =0 {Żadna odpowiedź nie trafia do nauczyciela do oceny.} one {# odpowiedź trafia do nauczyciela do oceny.} few {# odpowiedzi trafiają do nauczyciela do oceny.} many {# odpowiedzi trafia do nauczyciela do oceny.} other {# odpowiedzi trafia do nauczyciela do oceny.}}`,"result.teacher.unchecked":`Odpowiedzi dla nauczyciela nie są tu sprawdzane.`,"result.practice":`Tylko do ćwiczeń: nic tu nie jest oceniane.`,"result.announce":`Wynik: {score}.`,"result.countAnnounce":`{verdict}: {count}.`,"verdict.correct":`Dobrze`,"verdict.partial":`Częściowo dobrze`,"verdict.incorrect":`Jeszcze nie`,"verdict.empty":`Brak odpowiedzi`,"timer.label":`Pozostały czas`,"timer.minutes":`{minutes, plural, one {Została # minuta} few {Zostały # minuty} many {Zostało # minut} other {Zostało # minuty}}`,"timer.expired":`Czas minął. Oddajemy twoje odpowiedzi.`,unsupported:`Ta część zadania nie działa w tym odtwarzaczu.`,"error.invalid_request":`Nie udało się wysłać odpowiedzi. Spróbuj jeszcze raz.`,"error.unauthorized":`Nie udało się potwierdzić, kim jesteś. Zaloguj się i spróbuj jeszcze raz.`,"error.check_not_allowed":`W tym zadaniu nie można sprawdzać odpowiedzi.`,"error.checks_exhausted":`Nie masz już sprawdzeń.`,"error.not_found":`Nie znaleziono tego zadania.`,"error.method_not_allowed":`Serwer zadania odrzucił prośbę.`,"error.attempt_closed":`Te odpowiedzi zostały już oddane.`,"error.payload_too_large":`Odpowiedzi są za długie, żeby je wysłać.`,"error.internal_error":`Nie udało się połączyć z serwerem zadania. Spróbuj za chwilę.`,"error.no_checker":`Tego zadania nie można tu sprawdzić.`,"error.load_failed":`Nie udało się wczytać zadania.`,"error.view_invalid":`Plik zadania jest uszkodzony.`,"error.integrity_mismatch":`Plik zadania nie przeszedł weryfikacji, więc nie został otwarty.`,"error.source_needs_compiler":`To zadanie wymaga pełnej wersji skryptu Astrolabe.`,"error.source_invalid":`To zadanie nie jest poprawnie zapisane, więc nie da się go wyświetlić.`},Y=`astl.player`,vr=[{namespace:Y,locale:`en`,messages:gr},{namespace:Y,locale:`pl`,messages:_r}];function yr(e,t,n){return(r,i)=>{let a=e.t(t,n,r,i);return a!==r||n===`astl.player`?a:e.t(t,Y,r,i)}}function br(e){return typeof e.load==`function`}var X={elements:new Map,lazy:new Map,loading:new Map,catalogs:[],styleTemplates:new Map,compileSource:null,urlPolicy:b,version:0};function xr(e){let t=X.lazy.get(e);if(t===void 0||X.elements.has(e))return Promise.resolve();let n=X.loading.get(e);return n===void 0&&(n=Promise.resolve().then(()=>t.load()).then(n=>{let r=n?.manifest?.tag;if(r!==e)throw Error(`The lazy element for <${e}> loaded <${String(r)}>`);let i=t.registry.get(e);if(i===void 0)t.registry.define(e,n.element);else if(i!==n.element)throw Error(`<${e}> is already defined by another class`);X.elements.set(e,n),X.version++}).finally(()=>X.loading.delete(e)),X.loading.set(e,n)),n}async function Sr(e){await Promise.all(Array.from(new Set(e),xr))}var Cr=[cn(Qt(`:host`)),nr,rr,k`
|
|
87
|
+
:host {
|
|
88
|
+
display: block;
|
|
89
|
+
color: var(--astl-ink);
|
|
90
|
+
}
|
|
91
|
+
:host([hidden]) {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
.root {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: var(--astl-space-4);
|
|
98
|
+
padding: var(--astl-space-4);
|
|
99
|
+
background: var(--astl-canvas);
|
|
100
|
+
color: var(--astl-ink);
|
|
101
|
+
font-family: var(--astl-font-body);
|
|
102
|
+
font-size: var(--astl-size-ui);
|
|
103
|
+
line-height: 1.4;
|
|
104
|
+
}
|
|
105
|
+
.root > * {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
inline-size: 100%;
|
|
108
|
+
max-inline-size: 760px;
|
|
109
|
+
margin-inline: auto;
|
|
110
|
+
}
|
|
111
|
+
.status {
|
|
112
|
+
margin-block: 0;
|
|
113
|
+
color: var(--astl-ink-muted);
|
|
114
|
+
}
|
|
115
|
+
.problem {
|
|
116
|
+
margin-block: 0;
|
|
117
|
+
padding-block: var(--astl-space-3);
|
|
118
|
+
padding-inline: var(--astl-space-4);
|
|
119
|
+
border: var(--astl-outline-width) solid var(--astl-danger);
|
|
120
|
+
border-radius: var(--astl-radius-m);
|
|
121
|
+
background: var(--astl-danger-soft);
|
|
122
|
+
color: var(--astl-ink);
|
|
123
|
+
}
|
|
124
|
+
`,k`
|
|
125
|
+
.problem-details {
|
|
126
|
+
margin-block: 0;
|
|
127
|
+
padding-block: var(--astl-space-3);
|
|
128
|
+
padding-inline: var(--astl-space-4);
|
|
129
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
130
|
+
border-radius: var(--astl-radius-m);
|
|
131
|
+
background: var(--astl-surface);
|
|
132
|
+
color: var(--astl-ink);
|
|
133
|
+
white-space: pre-wrap;
|
|
134
|
+
overflow-wrap: anywhere;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.header {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-wrap: wrap;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: var(--astl-space-3) var(--astl-space-5);
|
|
142
|
+
}
|
|
143
|
+
.counter {
|
|
144
|
+
margin-block: 0;
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
}
|
|
147
|
+
.progress {
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-wrap: wrap;
|
|
150
|
+
gap: var(--astl-space-1);
|
|
151
|
+
margin: 0;
|
|
152
|
+
padding: 0;
|
|
153
|
+
list-style: none;
|
|
154
|
+
}
|
|
155
|
+
.segment {
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
gap: var(--astl-space-1);
|
|
161
|
+
min-inline-size: var(--astl-target-min);
|
|
162
|
+
min-block-size: var(--astl-target-min);
|
|
163
|
+
padding-inline: var(--astl-space-2);
|
|
164
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
165
|
+
border-radius: var(--astl-radius-m);
|
|
166
|
+
background: var(--astl-surface);
|
|
167
|
+
color: var(--astl-ink);
|
|
168
|
+
font: inherit;
|
|
169
|
+
font-weight: 600;
|
|
170
|
+
text-decoration: none;
|
|
171
|
+
}
|
|
172
|
+
button.segment {
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
}
|
|
175
|
+
`,k`
|
|
176
|
+
.segment-icon {
|
|
177
|
+
flex: none;
|
|
178
|
+
inline-size: 0.875em;
|
|
179
|
+
block-size: 0.875em;
|
|
180
|
+
}
|
|
181
|
+
`,k`
|
|
182
|
+
.segment[aria-current='step'] {
|
|
183
|
+
border-color: var(--astl-accent);
|
|
184
|
+
background: var(--astl-accent);
|
|
185
|
+
color: var(--astl-on-accent);
|
|
186
|
+
}
|
|
187
|
+
.timer {
|
|
188
|
+
margin-block: 0;
|
|
189
|
+
margin-inline-start: auto;
|
|
190
|
+
font-variant-numeric: tabular-nums;
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
}
|
|
193
|
+
.timer-label {
|
|
194
|
+
color: var(--astl-ink-muted);
|
|
195
|
+
font-weight: 400;
|
|
196
|
+
}
|
|
197
|
+
`,k`
|
|
198
|
+
.canvas {
|
|
199
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
200
|
+
padding: var(--astl-space-5);
|
|
201
|
+
border-radius: var(--astl-radius-l);
|
|
202
|
+
background: var(--astl-surface);
|
|
203
|
+
color: var(--astl-ink);
|
|
204
|
+
font-size: var(--astl-size-content);
|
|
205
|
+
line-height: var(--astl-line-height-content);
|
|
206
|
+
overflow-wrap: break-word;
|
|
207
|
+
}
|
|
208
|
+
.canvas[hidden],
|
|
209
|
+
astl-page[hidden] {
|
|
210
|
+
display: none;
|
|
211
|
+
}
|
|
212
|
+
astl-doc,
|
|
213
|
+
astl-page {
|
|
214
|
+
display: block;
|
|
215
|
+
}
|
|
216
|
+
.canvas :where(p, ul, ol, blockquote) {
|
|
217
|
+
margin-block: 0 var(--astl-space-4);
|
|
218
|
+
}
|
|
219
|
+
.canvas :where(h2, h3, h4) {
|
|
220
|
+
margin-block: var(--astl-space-5) var(--astl-space-3);
|
|
221
|
+
font-family: var(--astl-font-display);
|
|
222
|
+
line-height: 1.25;
|
|
223
|
+
}
|
|
224
|
+
`,k`
|
|
225
|
+
.canvas astl-page > :first-child {
|
|
226
|
+
margin-block-start: 0;
|
|
227
|
+
}
|
|
228
|
+
.canvas astl-page > :last-child {
|
|
229
|
+
margin-block-end: 0;
|
|
230
|
+
}
|
|
231
|
+
`,k`
|
|
232
|
+
.canvas .astl-page-heading {
|
|
233
|
+
margin-block: 0 var(--astl-space-4);
|
|
234
|
+
font-size: 1.3em;
|
|
235
|
+
}
|
|
236
|
+
.canvas :where(ul, ol) {
|
|
237
|
+
padding-inline-start: var(--astl-space-5);
|
|
238
|
+
}
|
|
239
|
+
`,k`
|
|
240
|
+
.canvas a[href] {
|
|
241
|
+
color: var(--astl-accent);
|
|
242
|
+
}
|
|
243
|
+
.canvas code {
|
|
244
|
+
font-family: var(--astl-font-mono);
|
|
245
|
+
font-size: 0.9em;
|
|
246
|
+
}
|
|
247
|
+
.canvas mark {
|
|
248
|
+
background: var(--astl-warning-soft);
|
|
249
|
+
color: var(--astl-ink);
|
|
250
|
+
}
|
|
251
|
+
.canvas blockquote {
|
|
252
|
+
margin-inline: 0;
|
|
253
|
+
padding-inline-start: var(--astl-space-4);
|
|
254
|
+
border-inline-start: var(--astl-outline-width) solid var(--astl-line);
|
|
255
|
+
}
|
|
256
|
+
`,k`
|
|
257
|
+
.canvas img {
|
|
258
|
+
display: var(--astl-picture-display, inline);
|
|
259
|
+
max-inline-size: 100%;
|
|
260
|
+
block-size: auto;
|
|
261
|
+
vertical-align: middle;
|
|
262
|
+
}
|
|
263
|
+
.canvas figure {
|
|
264
|
+
margin-block: 0 var(--astl-space-4);
|
|
265
|
+
margin-inline: 0;
|
|
266
|
+
}
|
|
267
|
+
.canvas figure img {
|
|
268
|
+
display: block;
|
|
269
|
+
}
|
|
270
|
+
.canvas figcaption {
|
|
271
|
+
margin-block-start: var(--astl-space-2);
|
|
272
|
+
color: var(--astl-ink-muted);
|
|
273
|
+
font-size: var(--astl-size-small);
|
|
274
|
+
}
|
|
275
|
+
.astl-notice {
|
|
276
|
+
display: inline-block;
|
|
277
|
+
margin-block: var(--astl-space-1);
|
|
278
|
+
padding-block: var(--astl-space-1);
|
|
279
|
+
padding-inline: var(--astl-space-3);
|
|
280
|
+
border: var(--astl-outline-width) solid var(--astl-warning);
|
|
281
|
+
border-radius: var(--astl-radius-m);
|
|
282
|
+
background: var(--astl-warning-soft);
|
|
283
|
+
color: var(--astl-ink);
|
|
284
|
+
font-size: var(--astl-size-small);
|
|
285
|
+
line-height: 1.4;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.result {
|
|
289
|
+
padding-block: var(--astl-space-4);
|
|
290
|
+
padding-inline: var(--astl-space-5);
|
|
291
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
292
|
+
border-radius: var(--astl-radius-l);
|
|
293
|
+
background: var(--astl-surface);
|
|
294
|
+
}
|
|
295
|
+
.result-title {
|
|
296
|
+
margin-block: 0 var(--astl-space-2);
|
|
297
|
+
font-size: 1.125rem;
|
|
298
|
+
}
|
|
299
|
+
.score {
|
|
300
|
+
margin-block: 0 var(--astl-space-2);
|
|
301
|
+
font-size: 1.25rem;
|
|
302
|
+
font-weight: 700;
|
|
303
|
+
}
|
|
304
|
+
.counts {
|
|
305
|
+
display: flex;
|
|
306
|
+
flex-wrap: wrap;
|
|
307
|
+
gap: var(--astl-space-2) var(--astl-space-4);
|
|
308
|
+
margin: 0;
|
|
309
|
+
padding: 0;
|
|
310
|
+
list-style: none;
|
|
311
|
+
}
|
|
312
|
+
.passed,
|
|
313
|
+
.teacher,
|
|
314
|
+
.practice {
|
|
315
|
+
margin-block: var(--astl-space-2) 0;
|
|
316
|
+
font-weight: 600;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.footer {
|
|
320
|
+
display: flex;
|
|
321
|
+
flex-wrap: wrap;
|
|
322
|
+
align-items: center;
|
|
323
|
+
gap: var(--astl-space-3);
|
|
324
|
+
}
|
|
325
|
+
.nav,
|
|
326
|
+
.actions {
|
|
327
|
+
display: flex;
|
|
328
|
+
flex-wrap: wrap;
|
|
329
|
+
align-items: center;
|
|
330
|
+
gap: var(--astl-space-2);
|
|
331
|
+
}
|
|
332
|
+
.actions {
|
|
333
|
+
margin-inline-start: auto;
|
|
334
|
+
}
|
|
335
|
+
.hint {
|
|
336
|
+
color: var(--astl-ink-muted);
|
|
337
|
+
font-size: var(--astl-size-small);
|
|
338
|
+
}
|
|
339
|
+
.button {
|
|
340
|
+
box-sizing: border-box;
|
|
341
|
+
min-inline-size: var(--astl-target-min);
|
|
342
|
+
min-block-size: var(--astl-target-min);
|
|
343
|
+
padding-block: var(--astl-space-2);
|
|
344
|
+
padding-inline: var(--astl-space-4);
|
|
345
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
346
|
+
border-radius: var(--astl-radius-m);
|
|
347
|
+
background: var(--astl-surface);
|
|
348
|
+
color: var(--astl-ink);
|
|
349
|
+
font: inherit;
|
|
350
|
+
font-weight: 600;
|
|
351
|
+
cursor: pointer;
|
|
352
|
+
transition: background-color var(--astl-duration-fast);
|
|
353
|
+
}
|
|
354
|
+
.button:hover {
|
|
355
|
+
background: var(--astl-accent-soft);
|
|
356
|
+
}
|
|
357
|
+
.button.primary {
|
|
358
|
+
border-color: var(--astl-accent);
|
|
359
|
+
background: var(--astl-accent);
|
|
360
|
+
color: var(--astl-on-accent);
|
|
361
|
+
}
|
|
362
|
+
.button.primary:hover {
|
|
363
|
+
text-decoration: underline;
|
|
364
|
+
}
|
|
365
|
+
`,k`
|
|
366
|
+
.button:disabled,
|
|
367
|
+
.button[aria-disabled='true'] {
|
|
368
|
+
border-color: var(--astl-line);
|
|
369
|
+
border-style: dashed;
|
|
370
|
+
background: transparent;
|
|
371
|
+
color: var(--astl-ink-muted);
|
|
372
|
+
text-decoration: none;
|
|
373
|
+
cursor: not-allowed;
|
|
374
|
+
}
|
|
375
|
+
.practice-only {
|
|
376
|
+
margin-block: 0;
|
|
377
|
+
color: var(--astl-ink-muted);
|
|
378
|
+
}
|
|
379
|
+
.confirm {
|
|
380
|
+
display: flex;
|
|
381
|
+
flex-wrap: wrap;
|
|
382
|
+
align-items: center;
|
|
383
|
+
gap: var(--astl-space-3);
|
|
384
|
+
inline-size: 100%;
|
|
385
|
+
padding-block: var(--astl-space-3);
|
|
386
|
+
padding-inline: var(--astl-space-4);
|
|
387
|
+
border: var(--astl-outline-width) solid var(--astl-warning);
|
|
388
|
+
border-radius: var(--astl-radius-m);
|
|
389
|
+
background: var(--astl-warning-soft);
|
|
390
|
+
color: var(--astl-ink);
|
|
391
|
+
}
|
|
392
|
+
.confirm p {
|
|
393
|
+
margin-block: 0;
|
|
394
|
+
}
|
|
395
|
+
:focus-visible {
|
|
396
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
397
|
+
outline-offset: var(--astl-focus-offset);
|
|
398
|
+
}
|
|
399
|
+
`,k`
|
|
400
|
+
@media (forced-colors: active) {
|
|
401
|
+
.button.primary,
|
|
402
|
+
.segment[aria-current='step'] {
|
|
403
|
+
forced-color-adjust: none;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`],wr=`data-style-template`,Tr=/^[a-z][a-z0-9-]*$/,Er=/^[a-z][a-z0-9]*-[a-z0-9-]*$/,Dr=`:not([data-theme="hc"])`;function Or(e){return Object.entries(e??{}).filter(([e,t])=>Tr.test(e)&&en(t)).map(([e,t])=>` --astl-${e}: ${t};\n`).join(``)}function kr(e){return Object.entries(e).filter(([e,t])=>$t.has(e)&&en(t)).map(([e,t])=>` ${e}: ${t};\n`).join(``)}var Ar=(e,t)=>t===``?``:`${e.join(`,
|
|
407
|
+
`)} {\n${t}}\n`;function jr(e,t,n,r){let i=e=>`:host(${t}${e}) ${n}`,a=(e,t)=>t===``?``:`@media ${e} {\n${Ar([i(`[data-theme="auto"]`)],t)}}\n`,o=Or(e.light),s=Or(e.dark),c=[Ar([i(Dr)],Or(e.tokens)),Ar([i(`:not([data-theme])`),i(`[data-theme="light"]`)],o),a(`not all and (prefers-color-scheme: dark)`,o),Ar([i(`[data-theme="dark"]`)],s),a(`(prefers-color-scheme: dark)`,s)];for(let[n,i]of Object.entries(e.parts??{})){let e=Er.test(n)?r(n):null;if(e!==null)for(let[n,r]of Object.entries(i))Tr.test(n)&&c.push(Ar([`:host(${t}${Dr}) ${e}::part(${n})`],kr(r)))}return c.join(``)}function Mr(e,t){let n=e.filter(e=>Tr.test(e.name)),r=n.filter(e=>e.scopes.includes(`document`)),i=n.filter(e=>e.scopes.includes(`component`)),a=e=>`[${wr}="${e}"]`,o=r.length===0?`.root`:`.root:not(${r.map(e=>a(e.name)).join(`, `)})`,s=r.map(e=>jr(e,`[style-template="${e.name}"]`,o,e=>`${o} ${e}`)),c=r.map(e=>{let t=`.root${a(e.name)}`;return jr(e,``,t,e=>`${t} ${e}`)}),l=i.flatMap(e=>{let n=(e.components??t).filter(e=>Er.test(e)),r=t=>`.canvas ${t}[style-template="${e.name}"]`;return n.map(t=>jr(e,``,r(t),e=>e===t?r(t):null))}),u=(e,t)=>`@layer ${e} {\n${t.join(``)}}\n`;return[`@layer astl-default, astl-document, astl-component;
|
|
408
|
+
`,`@media (forced-colors: none) {
|
|
409
|
+
`,u(`astl-default`,s),u(`astl-document`,c),u(`astl-component`,l),`}
|
|
410
|
+
`,`@media (prefers-reduced-motion: reduce) {
|
|
411
|
+
`,`.root,
|
|
412
|
+
.canvas [style-template] {
|
|
413
|
+
--astl-duration-fast: 0ms;
|
|
414
|
+
--astl-duration-normal: 0ms;
|
|
415
|
+
}
|
|
416
|
+
`,`}
|
|
417
|
+
`].join(``)}var Nr=null,Pr=-1;function Fr(){return Nr??=new CSSStyleSheet,Pr!==X.version&&(Nr.replaceSync(Mr([...X.styleTemplates.values()],[...X.elements.keys()])),Pr=X.version),Nr}function Ir(){Nr!==null&&Fr()}var Z=class extends Error{code;constructor(e){super(e),this.name=`LoadError`,this.code=e}};async function Lr(e){let t=globalThis.crypto?.subtle;if(t===void 0)return null;let n=await t.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(n),e=>e.toString(16).padStart(2,`0`)).join(``)}function Rr(e){return Array.from(e.querySelectorAll(`[id]`)).filter(e=>e.localName.includes(`-`)).every(e=>Me(e.id))}var zr=[`id`,`v`,`lang`,`dir`],Br=new Set,Vr=/^[1-9]\d*$/;function Q(e,t,n=b,r=Br){let i=new Set(t),a=e.localName;for(let{name:t,value:o}of Array.from(e.attributes)){let s=r.has(t)&&!n(o,{tag:a,attribute:t});(t===`style`||!i.has(t)||s)&&e.removeAttribute(t)}}function Hr(e,t){Q(e,[...g,...fe.img??[]],t,new Set([`src`]));for(let t of[`width`,`height`])Vr.test(e.getAttribute(t)??`1`)||e.removeAttribute(t);return!e.getAttribute(`src`)||!e.hasAttribute(`alt`)?(e.remove(),!1):(e.replaceChildren(),e.setAttribute(`loading`,`lazy`),e.setAttribute(`decoding`,`async`),e.setAttribute(`referrerpolicy`,`no-referrer`),!0)}function Ur(e,t,n){Q(e,g);for(let r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE)continue;let e=r;r.nodeType===Node.ELEMENT_NODE?e.localName===`img`?Hr(e,t.urlPolicy):e.localName===`figcaption`?(Q(e,g),$(e,t,!0,n)):e.remove():r.remove()}}function $(e,t,n,r=!n,i){let{manifests:a,urlPolicy:o}=t;for(let s of Array.from(e.childNodes)){if(s.nodeType===Node.TEXT_NODE)continue;if(s.nodeType!==Node.ELEMENT_NODE){s.remove();continue}let e=s,c=e.localName,l=i&&Wr(i,c);if(ie.has(c))e.remove();else if(c===`astl-page`&&r&&!n)Q(e,[..._e,...Be]),$(e,t,!1);else if((c===`astl-columns`||c===`astl-column`)&&r&&!n)Q(e,g),$(e,t,!1);else if(c===`img`)Hr(e,o);else if(c===`figure`&&!n)Ur(e,t,r);else if(ne.has(c)||te.has(c)&&!n){let a=pe[c];Q(e,[...g,...fe[c]??[]],o,a===void 0?Br:new Set([a])),$(e,t,n,r,i)}else l?Kr(e,l,t):r&&a.has(c)&&(!n||a.get(c).display===`inline`)?qr(e,a.get(c),t):c.includes(`-`)&&c!==`astl-doc`&&c!==`astl-page`?(Q(e,zr),e.replaceChildren()):($(e,t,n,r,i),e.replaceWith(...Array.from(e.childNodes)))}}var Wr=(e,t)=>e.children.find(e=>e.tag===t&&e.visibility===`public`);function Gr(e,t,n,r=[]){let i=t.filter(e=>e.visibility!==`private`);Q(e,[...g,...i.map(e=>e.name),...r],n.urlPolicy,new Set(i.filter(e=>e.type===`url`).map(e=>e.name)))}function Kr(e,t,n){Gr(e,t.attributes,n),t.content===`text`?e.textContent=e.textContent??``:$(e,n,!0)}function qr(e,t,n){if(Gr(e,ht(t),n,t.graded?Be:[]),t.content===`flow`)$(e,n,!1,!1,t);else for(let r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE)continue;let e=Wr(t,r.localName);r.nodeType!==Node.ELEMENT_NODE||e===void 0?r.remove():Kr(r,e,n)}}function Jr(e){let t=document.createElement(`template`);t.innerHTML=oe(e);let n=Array.from(t.content.children),r=n[0];if(n.length!==1||r===void 0||r.localName!==`astl-doc`)throw new Z(`view_invalid`);for(let e of Array.from(t.content.childNodes))e!==r&&e.remove();return t.content}function Yr(e){return new Set(Array.from(e.querySelectorAll(`*`),e=>e.localName).filter(e=>e.includes(`-`)&&e!==`astl-columns`&&e!==`astl-column`))}function Xr(e){return e.querySelector(Be.map(e=>`[${e}]`).join())!==null}function Zr(e){return e.firstElementChild?.getAttribute(`kind`)===`book`}function Qr(e){return e.querySelector(`[${v}],${ce}`)!==null}function $r(e,t,n=b){let r=e.firstElementChild;return Q(r,me),$(r,{manifests:t,urlPolicy:n},!1),e}var ei=`astl:snapshot:`,ti=300,ni=[`correct`,`partial`,`incorrect`,`empty`],ri=[5,1],ii=[`light`,`dark`,`hc`,`auto`],ai={done:R`<svg class="segment-icon" data-icon="done" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
418
|
+
<circle cx="10" cy="10" r="7" fill="currentColor" stroke="currentColor" stroke-width="2.5" />
|
|
419
|
+
</svg>`,partial:R`<svg class="segment-icon" data-icon="partial" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
420
|
+
<circle cx="10" cy="10" r="7" fill="none" stroke="currentColor" stroke-width="2.5" />
|
|
421
|
+
<path d="M3 10a7 7 0 0 0 14 0z" fill="currentColor" />
|
|
422
|
+
</svg>`,none:V};function oi(e,t){let n={};for(let r of t){let t=e[r];t!==void 0&&(n[r]=t)}return n}function si(e,t){if(e instanceof f)return e.problem.code;if(e instanceof Z)return e.code;let n=e?.code;return typeof n==`string`&&n!==``?n:t}function ci(e){let t=Math.ceil(e/1e3),n=e=>String(e).padStart(2,`0`);return`${n(Math.floor(t/60))}:${n(t%60)}`}var li=class extends G{static properties={view:{attribute:!1},policy:{attribute:!1},checker:{attribute:!1},snapshot:{attribute:!1},locale:{},src:{},integrity:{},endpoint:{},theme:{},styleTemplate:{attribute:ot,reflect:!0},persist:{type:Boolean}};static styles=Cr;#e=`loading`;#t=0;#n=null;#r=null;#i=null;#a=null;#o=null;#s=null;#c=null;#l=[];#u=[];#d=null;#f=null;#p=!1;#m=null;#h=[];#g=null;#_=null;#v=null;#y=null;#b=null;#x=!1;#S;#C;#w=new Set;#T=!1;#E=null;#D={check:e=>this.#he().check(e),submit:e=>this.#he().submit(e)};constructor(){super(),this.view=``,this.policy=yt,this.checker=null,this.snapshot=null,this.locale=null,this.src=null,this.integrity=null,this.endpoint=null,this.theme=`auto`,this.styleTemplate=null,this.persist=!1}get state(){return this.#e}get viewHash(){return this.#r}get page(){return this.#o?.page??0}async load(e){e.policy!==void 0&&(this.policy=e.policy),e.checker!==void 0&&(this.checker=e.checker),e.snapshot!==void 0&&(this.snapshot=e.snapshot),this.view=e.view,await this.#G(e.view)}async check(e){let t=this.#o;if(t===null)return null;if(this.#b=null,this.#me()===null)return this.#re(`no_checker`),null;try{return await(e===void 0?t.check():t.checkElement(e))}catch(e){return this.#re(si(e,`internal_error`)),null}}async submit(){let e=this.#o;if(e===null)return null;if(this.#b=null,this.#x=!1,this.#me()===null)return this.#re(`no_checker`),null;try{let t=await e.submit();return await this.updateComplete,this.#Se(`.result`)?.focus(),t}catch(e){return this.#re(si(e,`internal_error`)),null}}goTo(e){return this.#o?.goTo(e)??!1}next(){return this.#o?.goTo(this.#$(1))??!1}previous(){return this.#o?.goTo(this.#$(-1))??!1}reset(){return this.#o?.reset()??!1}getAnswers(){return this.#o?.answers??{}}setAnswers(e){let t=this.#o;if(t===null||t.readOnly)return;let n={},r=[];for(let{element:t}of this.#l){let i=oi(e,t.slotIds);if(Object.keys(i).length===0)continue;t.setAnswers(i);let a=t.getAnswers();for(let e of t.slotIds)n[e]=a[e]??``;r.push(t)}let i=t.setAnswers(n);for(let e of r)e.slotIds.some(e=>e in i)&&(e.feedback=null);this.requestUpdate()}getSnapshot(){return this.#o?.snapshot(this.#ie())??null}connectedCallback(){super.connectedCallback(),this.#fe(),this.#m?.observe(this),this.#H()}createRenderRoot(){let e=super.createRenderRoot();return rn&&e instanceof ShadowRoot&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,Fr()]),e}disconnectedCallback(){super.disconnectedCallback(),this.#oe(),this.#fe(),this.#m?.disconnect()}firstUpdated(){this.#Se(`.canvas`)?.addEventListener(T.change,e=>{let t=e.detail;t?.answers&&this.#o?.setAnswers(t.answers),this.requestUpdate()})}updated(e){if(e.has(`theme`)&&(this.dataset.theme=this.#be()),e.has(`view`)&&this.view!==``&&this.view!==this.#n){this.#G(this.view).catch(()=>void 0);return}if(e.has(`src`)&&e.get(`src`)!==void 0&&this.src&&this.view===``){this.#W(this.src).catch(()=>void 0);return}let t=this.#o,n=e.has(`policy`)&&t!==null&&t.policy!==this.policy,r=e.has(`locale`)&&t!==null&&this.#a!==this.#ye();(n||r)&&this.#n!==null&&this.#G(this.#n,this.getSnapshot(),this.#g).catch(()=>void 0)}render(){let e=this.#ye(),t=this.#ve().translator(e,Y),n=this.#o;return R`<div
|
|
423
|
+
class="root"
|
|
424
|
+
part="player"
|
|
425
|
+
lang=${e}
|
|
426
|
+
dir=${x(e)}
|
|
427
|
+
data-style-template=${this.#i??V}
|
|
428
|
+
?data-spread=${this.#p}
|
|
429
|
+
aria-busy=${this.#e===`loading`?`true`:`false`}
|
|
430
|
+
>
|
|
431
|
+
${this.#e===`loading`?R`<p class="status">${t(`loading`)}</p>`:V}
|
|
432
|
+
${this.#v===null?V:R`<p class="problem">${this.#V(t,this.#v)}</p>`}
|
|
433
|
+
${this.#y===null?V:R`<div class="problem-details" part="problem-details" role="alert">${this.#y}</div>`}
|
|
434
|
+
${n===null?V:this.#O(n,t)}
|
|
435
|
+
<div class="canvas" part="canvas" tabindex="-1" ?hidden=${n===null}></div>
|
|
436
|
+
${n===null?V:this.#j(n,t)}
|
|
437
|
+
${this.#b===null?V:R`<p class="problem">${this.#V(t,this.#b)}</p>`}
|
|
438
|
+
${n===null?V:this.#F(n,t)}
|
|
439
|
+
<div class="astl-vh live" aria-live="polite"></div>
|
|
440
|
+
</div>`}#O(e,t){let n=e.pageCount>1,r=e.readOnly?null:e.timeLeft();return!n&&r===null?V:R`<div class="header" part="header">
|
|
441
|
+
${n?R`<p class="counter">${this.#k(e,t)}</p>
|
|
442
|
+
<nav aria-label=${t(`progress.label`)}>
|
|
443
|
+
<ol class="progress">
|
|
444
|
+
${e.pages.map((n,r)=>this.#A(e,t,r))}
|
|
445
|
+
</ol>
|
|
446
|
+
</nav>`:V}
|
|
447
|
+
${r===null?V:R`<p class="timer">
|
|
448
|
+
<span class="timer-label" id="timer-label">${t(`timer.label`)}</span>
|
|
449
|
+
<span role="timer" aria-labelledby="timer-label">${ci(r)}</span>
|
|
450
|
+
</p>`}
|
|
451
|
+
</div>`}#k(e,t){let[n,r]=this.#Q(e.page);return r>n?t(`page.counter.spread`,{from:n+1,to:r+1,total:e.pageCount}):t(`page.counter`,{n:n+1,total:e.pageCount})}#A(e,t,n){let r=this.#_e(n),[i,a]=this.#Q(e.page),o=n>=i&&n<=a?`step`:V,s=R`<span aria-hidden="true">${n+1}</span>${ai[r]}<span class="astl-vh"
|
|
452
|
+
>${t(`progress.item`,{n:n+1,state:r})}</span
|
|
453
|
+
>`;return R`<li>
|
|
454
|
+
${e.policy.navigation===`linear`&&!e.readOnly?R`<span class="segment" data-state=${r} aria-current=${o}>${s}</span>`:R`<button
|
|
455
|
+
type="button"
|
|
456
|
+
class="segment"
|
|
457
|
+
data-state=${r}
|
|
458
|
+
aria-current=${o}
|
|
459
|
+
@click=${()=>this.goTo(n)}
|
|
460
|
+
>
|
|
461
|
+
${s}
|
|
462
|
+
</button>`}
|
|
463
|
+
</li>`}#j(e,t){let n=e.response;if(n===null)return V;let r=n.result,i=`passed`in n?n.passed:null,a=r!==null&&this.#M(r),o=this.#N(t,n),s=r!==null&&!a&&o===null;return R`<section class="result" part="result" tabindex="-1" aria-labelledby="result-title">
|
|
464
|
+
<h2 class="result-title" id="result-title">${t(`result.title`)}</h2>
|
|
465
|
+
${r===null?R`<p>${t(`result.submitted`)} ${t(`result.later`)}</p>`:R`${a?R`<p class="score">${this.#z(t,r)}</p>
|
|
466
|
+
<ul class="counts">
|
|
467
|
+
${ni.filter(e=>r.counts[e]>0).map(e=>R`<li class="astl-verdict" data-verdict=${e}>
|
|
468
|
+
${ar(e)}<span>${t(`result.count`,{verdict:t(`verdict.${e}`),count:r.counts[e]})}</span>
|
|
469
|
+
</li>`)}
|
|
470
|
+
</ul>`:V}
|
|
471
|
+
${o===null?V:R`<p class="teacher">${o}</p>`}
|
|
472
|
+
${s?R`<p class="practice">${t(`result.practice`)}</p>`:V}
|
|
473
|
+
${i===null||!a?V:R`<p class="passed">${t(i?`result.passed`:`result.notPassed`)}</p>`}`}
|
|
474
|
+
</section>`}#M(e){return e.max>0}#N(e,t){let n=this.#P();return n.slots===0||t.result===null?null:`submittedAt`in t?t.result.max===0?e(`result.teacher.sent`):e(`result.teacher.count`,{count:n.answered}):e(`result.teacher.unchecked`)}#P(){let e=this.#o?.answers??{},t=0,n=0;for(let{element:r,manifest:i}of this.#l){if(i.graded)continue;let a=i.slotKinds[0]??`open`;for(let i of r.slotIds){t++;let r=e[i]??``;r!==``&&o(r,a)&&n++}}return{slots:t,answered:n}}#F(e,t){let n=e.pageCount>1,r=this.#I(e,t);if(!n&&r===V)return V;let i=e.policy.navigation===`linear`&&!e.readOnly;return R`<div class="footer" part="footer">
|
|
475
|
+
${n?R`<div class="nav">
|
|
476
|
+
${i?V:R`<button
|
|
477
|
+
type="button"
|
|
478
|
+
class="button"
|
|
479
|
+
?disabled=${!e.canGoTo(this.#$(-1))}
|
|
480
|
+
@click=${()=>this.previous()}
|
|
481
|
+
>
|
|
482
|
+
${t(`nav.previous`)}
|
|
483
|
+
</button>`}
|
|
484
|
+
<button type="button" class="button" ?disabled=${!e.canGoTo(this.#$(1))} @click=${()=>this.next()}>
|
|
485
|
+
${t(`nav.next`)}
|
|
486
|
+
</button>
|
|
487
|
+
</div>`:V}
|
|
488
|
+
${r}
|
|
489
|
+
</div>`}#I(e,t){if(e.readOnly)return V;if(this.#x)return R`<div
|
|
490
|
+
class="confirm"
|
|
491
|
+
role="group"
|
|
492
|
+
tabindex="-1"
|
|
493
|
+
aria-labelledby="confirm-text"
|
|
494
|
+
@keydown=${e=>{e.key===`Escape`&&this.#R()}}
|
|
495
|
+
>
|
|
496
|
+
<p id="confirm-text">${t(`confirm.empty`,{count:this.#ge()})}</p>
|
|
497
|
+
<div class="actions">
|
|
498
|
+
<button type="button" class="button" @click=${()=>this.#R()}>${t(`confirm.cancel`)}</button>
|
|
499
|
+
<button type="button" class="button primary" @click=${()=>void this.submit()}>
|
|
500
|
+
${t(`confirm.submit`)}
|
|
501
|
+
</button>
|
|
502
|
+
</div>
|
|
503
|
+
</div>`;if(e.policy.mode===`practice`){if(!this.#l.some(({element:e})=>e.slotIds.length>0))return e.result===null?R`<p class="practice-only">${t(`result.practice`)}</p>`:V;let n=e.checksLeft;return R`<div class="actions">
|
|
504
|
+
${n===null?V:R`<span class="hint">${t(`checks.left`,{count:n})}</span>`}
|
|
505
|
+
${e.result===null?V:R`<button type="button" class="button" @click=${()=>this.reset()}>${t(`action.reset`)}</button>`}
|
|
506
|
+
<button
|
|
507
|
+
type="button"
|
|
508
|
+
class="button primary"
|
|
509
|
+
aria-disabled=${e.canCheck()?V:`true`}
|
|
510
|
+
@click=${()=>{e.canCheck()&&this.check()}}
|
|
511
|
+
>
|
|
512
|
+
${t(`action.check`)}
|
|
513
|
+
</button>
|
|
514
|
+
</div>`}return e.policy.mode===`test`?R`<div class="actions">
|
|
515
|
+
<button
|
|
516
|
+
type="button"
|
|
517
|
+
class="button primary"
|
|
518
|
+
aria-disabled=${e.canSubmit()?V:`true`}
|
|
519
|
+
@click=${()=>this.#L()}
|
|
520
|
+
>
|
|
521
|
+
${t(`action.submit`)}
|
|
522
|
+
</button>
|
|
523
|
+
</div>`:V}#L(){this.#o?.canSubmit()&&(this.#ge()===0?this.submit():(this.#x=!0,this.requestUpdate(),this.updateComplete.then(()=>this.#Se(`.confirm`)?.focus())))}#R(){this.#x=!1,this.requestUpdate(),this.updateComplete.then(()=>this.#Se(`.actions .primary`)?.focus())}#z(e,t){return e(`result.score`,{score:At(t.score),max:At(t.max)})}#B(e){let t=this.#o?.response??null;if(t===null)return null;let n=t.result;if(n===null)return`${e(`result.submitted`)} ${e(`result.later`)}`;let r=this.#M(n),i=r?[e(`result.announce`,{score:this.#z(e,n)})]:[];for(let t of ni){let r=n.counts[t];r>0&&i.push(e(`result.countAnnounce`,{verdict:e(`verdict.${t}`),count:r}))}let a=this.#N(e,t);a===null?r||i.push(e(`result.practice`)):i.push(a);let o=`passed`in t?t.passed:null;return o!==null&&r&&i.push(e(o?`result.passed`:`result.notPassed`)),i.join(` `)}#V(e,t){let n=`error.${t}`,r=e(n);return r===n?e(`error.internal_error`):r}async#H(){if(document.readyState===`loading`&&await new Promise(e=>document.addEventListener(`DOMContentLoaded`,e,{once:!0})),await this.updateComplete,this.#t>0||this.view!==``)return;let e=this.querySelector(`astl-doc`);e===null?this.src&&await this.#W(this.src).catch(()=>void 0):await this.#U(e).catch(()=>void 0)}async#U(e){if(Rr(e))return this.#G(e.outerHTML);let t=this.#K(),n=X.compileSource;if(n===null)throw this.#ne(`source_needs_compiler`);let r=e.getAttribute(`lang`)||e.parentElement?.closest(`[lang]`)?.getAttribute(`lang`)||document.documentElement.lang||``,i=document.createElement(`template`);i.innerHTML=e.outerHTML;let a=i.content.firstElementChild;r!==``&&a!==null&&!a.getAttribute(`lang`)&&a.setAttribute(`lang`,r);let o;try{o=await n(i.innerHTML,{lang:r,locale:this.#ye()})}catch(e){let n=e instanceof Error?e.message:typeof e==`string`?e:``;if(t===this.#t)throw this.#ne(si(e,`source_invalid`),n.trim()||null);return}t===this.#t&&await this.#G(o.view,void 0,o.checker)}async#W(e){let t=this.#K(),n;try{let t=await fetch(e);if(!t.ok)throw new Z(`load_failed`);n=await t.text()}catch{if(t===this.#t)throw this.#ne(`load_failed`);return}if(t===this.#t){if(this.integrity!==null){let e=await Lr(n).catch(()=>null);if(t!==this.#t)return;if(e===null||e!==this.integrity.trim().toLowerCase())throw this.#ne(`integrity_mismatch`)}await this.#G(n)}}async#G(e,t,n){let r=this.#K();this.#n=e,this.#g=n??null;try{await this.#q(e,r,t)}catch(e){if(r===this.#t)throw this.#ne(si(e,`view_invalid`))}}#K(){return this.#oe(),this.#s?.(),this.#s=null,this.#c?.destroy(),this.#c=null,this.#o=null,this.#l=[],this.#u=[],this.#d=null,this.#f=null,this.#p=!1,this.#m?.disconnect(),this.#m=null,this.#h=[],this.#n=null,this.#r=null,this.#i=null,this.#v=null,this.#y=null,this.#b=null,this.#x=!1,this.#w.clear(),this.#T=!1,this.#Se(`.canvas`)?.replaceChildren(),this.#fe(),this.#te(`loading`),++this.#t}async#q(e,t,n){await this.updateComplete;let r=Jr(e),i=Qr(r)?import(`./styled-Dmx5Yjv7.js`).catch(e=>(console.error(e),null)):null,a=Xr(r)?import(`./help-C-woafz5.js`).catch(e=>(console.error(e),null)):null,o=Zr(r)?import(`./book-CHzDDaim.js`).catch(e=>(console.error(e),null)):null;try{await Sr(Yr(r))}catch(e){throw console.error(e),new Z(`load_failed`)}let s=await i;if(t!==this.#t)return;Ir();let c=s?.takeStyles(r);s?.adoptStyledSheet(this.renderRoot),$r(r,new Map([...X.elements].map(([e,t])=>[e,t.manifest])),X.urlPolicy);let l=await Lr(e).catch(()=>null);if(t!==this.#t)return;let u=this.#ye(),d=this.#ve(),ee=d.translator(u,Y),f=document.importNode(r,!0);c!==void 0&&s?.applyStyles(c,r,f),customElements.upgrade(f);let p=f.firstElementChild;p.dir||=x(p.lang||u);let m=Array.from(p.children).filter(e=>e.localName===`astl-page`);m.length===0&&m.push(p);let te=[];this.#J(p,te,()=>{let e=document.createElement(`span`);return e.className=`astl-notice`,e.setAttribute(`role`,`note`),e.lang=u,e.dir=x(u),e.textContent=ee(`unsupported`),e});let ne=m.map((e,t)=>{if(m.length===1&&!e.getAttribute(`label`))return null;let n=document.createElement(`h2`);n.className=`astl-page-heading`,n.tabIndex=-1;let r=e.getAttribute(`label`);if(r)n.textContent=r;else{n.lang=u,n.classList.add(`astl-vh`);let e=document.createElement(`bdi`);e.textContent=ee(`page.heading`,{n:t+1}),n.append(e)}return e.prepend(n),n}),re=0,h=te.map(({element:e,manifest:t})=>{e.attach({locale:u,t:yr(d,u,t.messages),announce:e=>this.#xe(e),number:t.display===`inline`?++re:0,seed:this.policy.seed});let n=m.findIndex(t=>t.contains(e));return{element:e,manifest:t,page:Math.max(0,n)}}),ie=this.#Se(`.canvas`);if(ie===null)throw new Z(`view_invalid`);ie.replaceChildren(f);let g=n===void 0?this.snapshot??this.#le(l):n,_=dr.restorable(g,l);if(_!==null){let e={};for(let{element:t}of h){let n=oi(_.answers,t.slotIds);Object.keys(n).length>0&&t.setAnswers(n),Object.assign(e,oi(t.getAnswers(),t.slotIds))}_={..._,answers:e}}let v=new dr({policy:this.policy,checker:this.#D,pages:m.map((e,t)=>({id:e.id||`page-${t+1}`,slotIds:h.filter(e=>e.page===t).flatMap(e=>[...e.element.slotIds])})),snapshot:_,viewHash:l});this.#o=v,this.#l=h,this.#u=m,this.#d=p,this.#h=ne,this.#r=l,this.#i=p.getAttribute(ot),this.#a=u;for(let{element:e}of h){let t=v.restored?_?.ui[e.id]:void 0;t!==void 0&&e.setUiState?.(t),e.disabled=v.readOnly}this.#s=v.subscribe(e=>this.#Y(e));let ae=await a;if(t!==this.#t)return;this.#c=ae?.mountHelp({controller:v,mounted:h,pages:m,locale:u,urlPolicy:X.urlPolicy,root:this.renderRoot,checker:()=>this.#me(),check:e=>this.check(e),announce:e=>this.#xe(e)})??null;let y=m.length>1?await o:null;if(t!==this.#t||(y&&(this.#f=y,y.adoptBookSheet(this.renderRoot),this.#m=y.watchSpread(this,e=>this.#ee(e))),this.#Z(v.page,!1),this.#te(v.state),this.#fe(),this.requestUpdate(),await this.updateComplete,await Promise.all(h.map(({element:e})=>e.updateComplete)),t!==this.#t))return;let oe={viewHash:l??``,pages:m.length,slots:h.reduce((e,{element:t})=>e+t.slotIds.length,0)};this.#Ce(T.ready,oe)}#J(e,t,n){for(let r of Array.from(e.children)){let e=r.localName;if(e===`astl-page`||e===`astl-columns`||e===`astl-column`||!e.includes(`-`)){this.#J(r,t,n);continue}let i=X.elements.get(e),a=Number.parseInt(r.getAttribute(`v`)??`1`,10);i&&r instanceof i.element&&!(a>i.manifest.version)?t.push({element:r,manifest:i.manifest}):r.replaceWith(n())}}#Y(e){switch(e.type){case`state`:this.#te(e.state);for(let{element:e}of this.#l)e.disabled=this.#o?.readOnly??!0;this.#fe();break;case`answers`:this.#ae();break;case`page`:this.#Z(e.index,!0,e.previous),this.#Ce(T.page,{index:e.index,count:this.#u.length,id:this.#o?.pages[e.index]?.id??``}),this.#ae();break;case`result`:this.#X(),this.#Ce(T.result,e.response),this.#ae();break;case`element`:this.#X(e.id,e.response),this.#ae();break;case`reset`:for(let{element:e}of this.#l)e.setAnswers(Object.fromEntries(e.slotIds.map(e=>[e,``]))),e.feedback=null,e.solution=null;this.#de(),this.#Z(0,!0),this.#ae()}this.requestUpdate()}#X(e,t){let n=this.#o;if(n===null)return;let r=t??n.response,i=r?.result??null,a=n.solution,o=new Map(i?.groups.map(e=>[e.id,e.verdict])??[]);for(let{element:t}of this.#l)if(e===void 0||t.id===e){if(i===null)t.feedback=null;else{let e={};for(let n of t.slotIds){let t=i.slots[n];t!==void 0&&(e[n]=t)}let n=o.get(t.id)??null,a=t.groupIds?.flatMap(e=>{let t=o.get(e);return t===void 0?[]:[[e,t]]}),s={message:r?.feedback?.[t.id]??null,explanation:r?.explanations?.[t.id]??null};t.feedback=a===void 0?{slots:e,group:n,...s}:{slots:e,group:n,groups:Object.fromEntries(a),...s}}e===void 0&&(t.solution=a===null?null:oi(a,t.slotIds),t.disabled=n.readOnly)}let s=e===void 0?this.#B(this.#ve().translator(this.#ye(),Y)):null;s!==null&&this.#xe(s)}#Z(e,t,n){let[r,i]=this.#Q(e);this.#u.forEach((e,t)=>{e.localName===`astl-page`&&(e.hidden=t<r||t>i)}),n!==void 0&&this.#p&&this.#Q(n)[0]!==r&&this.#f?.turn(this.#u.slice(r,i+1),n<e?1:-1,this.#d?.dir===`rtl`),t&&(this.#h[e]??this.#Se(`.canvas`))?.focus()}#Q(e){if(!this.#p)return[e,e];let t=e-e%2;return[t,Math.min(t+1,this.#u.length-1)]}#$(e){let t=this.#o?.page??0;return this.#p?this.#Q(t)[0]+2*e:t+e}#ee(e){e!==this.#p&&(this.#p=e,this.#Z(this.#o?.page??0,!1),this.requestUpdate())}#te(e){let t=this.#e;e!==t&&(this.#e=e,this.#Ce(T.state,{state:e,previous:t}),this.requestUpdate())}#ne(e,t=null){this.#v=e,this.#y=t,this.#te(`error`);let n=this.#V(this.#ve().translator(this.#ye(),Y),e);return this.#xe(n),this.#Ce(T.error,{code:e,message:n}),new Z(e)}#re(e){this.#b=e;let t=this.#V(this.#ve().translator(this.#ye(),Y),e);this.#xe(t),this.#Ce(T.error,{code:e,message:t}),this.requestUpdate()}#ie(){let e={};for(let{element:t}of this.#l){let n=t.getUiState?.();n!==void 0&&(e[t.id]=n)}return e}#ae(){clearTimeout(this.#S),this.#S=setTimeout(()=>this.#se(),ti)}#oe(){this.#S!==void 0&&(clearTimeout(this.#S),this.#se())}#se(){this.#S=void 0;let e=this.getSnapshot();e!==null&&(this.#ue(e),this.#Ce(T.snapshot,e))}#ce(e){return this.persist&&e!==null?`${ei}${e}`:null}#le(e){let t=this.#ce(e);if(t===null)return null;try{let n=localStorage.getItem(t),r=n===null?null:JSON.parse(n);return Ft(r)&&r.viewHash===e?r:null}catch{return null}}#ue(e){let t=this.#ce(e.viewHash);if(t===null)return;let n=Object.keys(e.answers).length===0&&e.page===0&&!e.submitted;try{n?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(e))}catch{}}#de(){let e=this.#ce(this.#r);if(e!==null)try{localStorage.removeItem(e)}catch{}}#fe(){let e=this.#e,t=this.isConnected&&this.#o?.policy.deadline!=null&&(e===`ready`||e===`active`||e===`checking`);t&&this.#C===void 0&&(this.#C=setInterval(()=>this.#pe(),1e3)),!t&&this.#C!==void 0&&(clearInterval(this.#C),this.#C=void 0)}#pe(){let e=this.#o,t=e?.timeLeft()??null;if(e===null||t===null)return;let n=this.#ve().translator(this.#ye(),Y),r=ri.filter(e=>t<=e*6e4);if(t>0&&r.length>0&&!this.#w.has(Math.min(...r))){for(let e of r)this.#w.add(e);this.#xe(n(`timer.minutes`,{minutes:Math.ceil(t/6e4)}))}t===0&&!this.#T&&e.canSubmit()&&(this.#T=!0,this.#xe(n(`timer.expired`)),this.submit()),this.requestUpdate()}#me(){return this.#g===null?this.checker===null?this.endpoint?(this.#_?.endpoint!==this.endpoint&&(this.#_={endpoint:this.endpoint,checker:hr({endpoint:this.endpoint})}),this.#_.checker):null:this.checker:this.#g}#he(){let e=this.#me();if(e===null)throw new Z(`no_checker`);return e}#ge(){let e=0;for(let{element:t,manifest:n}of this.#l){if(!n.graded)continue;let r=t.units();e+=Math.max(0,r.total-r.answered)}return e}#_e(e){let t=0,n=0;for(let{element:r,page:i}of this.#l){if(i!==e)continue;let a=r.units();t+=a.answered,n+=a.total}return t>=n?`done`:t===0?`none`:`partial`}#ve(){if(this.#E?.version!==X.version){let e=[...vr,...[...X.elements.values()].flatMap(e=>e.messages),...X.catalogs];this.#E={version:X.version,i18n:nt({catalogs:e})}}return this.#E.i18n}#ye(){return et(this.locale?[this.locale]:this.lang?[this.lang]:[...navigator.languages??[],navigator.language].filter(e=>!!e),this.#ve().locales(Y),`en`)}#be(){let e=this.theme;return e!==null&&ii.includes(e)?e:`auto`}#xe(e){let t=this.#Se(`.live`);t!==null&&cr(t,e)}#Se(e){return this.renderRoot?.querySelector(e)??null}#Ce(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}},ui=`astl-player`;function di(e){let t=e.registry??customElements,n=new Map,r=(e,r)=>{let i=n.get(e)??t.get(e);if(i!==void 0&&i!==r)throw Error(`<${e}> is already defined by another class`);n.set(e,r)},i=e=>Error(`<${e}> is already registered by another entry`);r(ui,li);let a=[],o=new Map;for(let t of e.elements)if(br(t)){let e=String(t.tag);if(!ke.test(e)||e===ui)throw TypeError(`Lazy element <${e}>: the tag must be a lowercase custom element name`);let r=o.get(e)??X.lazy.get(e)?.load;if(r===t.load)continue;if(r!==void 0||n.has(e)||X.elements.has(e))throw i(e);o.set(e,t.load)}else{let e=t.manifest.tag;if(o.has(e)||X.lazy.has(e))throw i(e);r(e,t.element),a.push(t)}let s=new Map;for(let t of e.styleTemplates??[]){let e=String(t?.name);if(!st.test(e))throw TypeError(`Style template "${e}": the name must be lowercase kebab-case`);if(!dt(t))throw TypeError(`Style template "${e}" needs a version, scopes, messages and string values`);let n=s.get(t.name)??X.styleTemplates.get(t.name);if(n!==void 0&&n!==t)throw Error(`Style template "${t.name}" is already registered`);s.set(t.name,t)}if(e.urlPolicy!==void 0&&typeof e.urlPolicy!=`function`)throw TypeError(`urlPolicy must be a function`);for(let[e,r]of n)t.get(e)===void 0&&t.define(e,r);for(let e of a)X.elements.set(e.manifest.tag,e);for(let[e,n]of o)X.lazy.set(e,{load:n,registry:t});for(let[e,t]of s)X.styleTemplates.set(e,t);e.catalogs&&X.catalogs.push(...e.catalogs),e.compileSource&&(X.compileSource=e.compileSource),e.urlPolicy&&(X.urlPolicy=xe(e.urlPolicy)),X.version++,Ir()}function fi(e){return{locale:`en`,t:yr(nt({catalogs:[...vr,...e.messages]}),`en`,e.manifest?.messages??`astl.player`),announce:e=>cr(lr(),e),number:0,seed:null}}function pi(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function mi(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function hi(e,t){let n=mi(pi(t)),r=[...e];for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r}var gi=class extends G{static manifest=null;static messages=[];static properties={feedback:{attribute:!1},solution:{attribute:!1},disabled:{type:Boolean}};#e=null;#t=(e,t)=>this.t(e,t);constructor(){super(),this.feedback=null,this.solution=null,this.disabled=!1,this.addController({hostUpdated:()=>this.#n()})}connectedCallback(){this.closest(`astl-player`)===null&&super.connectedCallback()}get context(){return this.#e??=fi(this.constructor),this.#e}attach(e){this.#e=e,this.requestUpdate()}t(e,t){return this.context.t(e,t)}announce(e){this.context.announce(e)}get uiLanguage(){let e=this.context.locale;return{lang:e,dir:x(e)}}get contentLang(){return this.closest(`[lang]`)?.getAttribute(`lang`)??``}emitChange(e){let t=this.feedback;if(t){let n={...t.slots};for(let t of Object.keys(e))delete n[t];this.feedback={slots:n,group:null}}this.dispatchEvent(new CustomEvent(T.change,{detail:{answers:e},bubbles:!0,composed:!0}))}slotVerdict(e){return this.feedback?.slots[e]??null}get groupVerdict(){return this.feedback?.group??null}renderVerdict(e,t={}){return e===null?V:or(e,this.#t,{part:`verdict`,...this.uiLanguage,...t})}renderGroupVerdict(e=this.groupVerdict){return e===null?V:R`<p class="group-verdict" part="verdict" data-verdict=${e}>
|
|
524
|
+
${or(e,this.#t,this.uiLanguage)}
|
|
525
|
+
</p>`}childElements(e){return Array.from(this.children).filter(t=>t.localName===e&&t.id!==``)}#n(){let e=this.shadowRoot;if(e?.slotAssignment!==`manual`)return;let t=Array.from(this.children);for(let n of e.querySelectorAll(`slot`)){let{tag:e,...r}=n.dataset,[i]=Object.values(r),a=t.find(t=>e===void 0?i!==``&&t.id===i:t.localName===e);n.assign(...a===void 0?[]:[a])}}shuffled(e){let t=this.context.seed;return t===null?e:hi(e,`${t}:${this.id}`)}attributeSpec(e){let t=this.constructor.manifest;return t?ht(t).find(t=>t.name===e):void 0}stringAttribute(e){let t=this.attributeSpec(e),n=this.getAttribute(e),r=t?.default===void 0?null:String(t.default);return n===null||t?.type===`enum`&&!(t.values??[]).includes(n)?r:n}numberAttribute(e){let t=this.attributeSpec(e),n=typeof t?.default==`number`?t.default:null,r=this.getAttribute(e);if(r===null||r.trim()===``)return n;let i=Number(r);return!Number.isFinite(i)||t?.type===`integer`&&!Number.isInteger(i)||t?.min!==void 0&&i<t.min||t?.max!==void 0&&i>t.max?n:i}booleanAttribute(e){return this.hasAttribute(e)}},_i=class extends gi{static properties={value:{state:!0}};constructor(){super(),this.value=``}get slotIds(){return this.id===``?[]:[this.id]}getAnswers(){return this.id===``||this.value===``?{}:{[this.id]:this.value}}setAnswers(e){let t=e[this.id];t!==void 0&&(this.value=t)}units(){return{answered:this.value.trim()===``?0:1,total:1}}updateValue(e){e!==this.value&&(this.value=e,this.emitChange({[this.id]:e}))}get verdict(){return this.slotVerdict(this.id)??this.groupVerdict}get solutionValue(){return this.solution?.[this.id]??null}};function vi(e={}){di({elements:tn,styleTemplates:Jt,...e})}export{ht as $,_e as $t,Jt as A,Oe as At,Ot as B,ce as Bt,R as C,Fe as Ct,cn as D,Se as Dt,k as E,ke as Et,Nt as F,Me as Ft,kt as G,he as Gt,wt as H,g as Ht,jt as I,je as It,xt as J,ne as Jt,yt as K,re as Kt,Mt as L,te as Lt,D as M,De as Mt,Pt as N,Ce as Nt,tn as O,Pe as Ot,Ft as P,x as Pt,pt as Q,ue as Qt,At as R,h as Rt,B as S,a as Sn,Re as St,z as T,we as Tt,E as U,ge as Ut,Et as V,le as Vt,Dt as W,me as Wt,T as X,de as Xt,Ct as Y,ve as Yt,ft as Z,ye as Zt,nr as _,e as _n,Je as _t,di as a,b as an,dt as at,V as b,o as bn,ze as bt,X as c,m as cn,at as ct,hr as d,c as dn,Qe as dt,ie as en,vt as et,dr as f,u as fn,$e as ft,rr as g,r as gn,C as gt,ar as h,i as hn,Ue as ht,hi as i,oe as in,st as it,Rt as j,Te as jt,Qt as k,Ee as kt,Y as l,f as ln,nt as lt,or as m,d as mn,Xe as mt,gi as n,fe as nn,mt as nt,li as o,xe as on,rt as ot,cr as p,l as pn,S as pt,bt as q,v as qt,_i as r,pe as rn,ot as rt,$ as s,p as sn,it as st,vi as t,se as tn,_t as tt,vr as u,ee as un,et as ut,tr as v,n as vn,Ie as vt,Xn as w,Ae as wt,Qn as x,s as xn,Be as xt,G as y,t as yn,Le as yt,Tt as z,_ as zt};
|
|
526
|
+
//# sourceMappingURL=runtime-DxAbpr3S.js.map
|