@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +196 -144
  2. package/es/cli.js +6 -1
  3. package/es/commands/build/index.d.ts +1 -1
  4. package/es/commands/build/index.js +11 -12
  5. package/es/commands/check/index.d.ts +5 -2
  6. package/es/commands/check/index.js +15 -9
  7. package/es/commands/create/index.d.ts +4 -0
  8. package/es/commands/create/index.js +30 -7
  9. package/es/commands/create/install.d.ts +17 -0
  10. package/es/commands/create/install.js +53 -0
  11. package/es/commands/create/scaffold.d.ts +4 -1
  12. package/es/commands/create/scaffold.js +19 -13
  13. package/es/commands/dev/index.d.ts +1 -1
  14. package/es/commands/dev/index.js +4 -4
  15. package/es/commands/doctor/index.d.ts +11 -1
  16. package/es/commands/doctor/index.js +124 -36
  17. package/es/core/collect.d.ts +5 -2
  18. package/es/core/config.d.ts +95 -29
  19. package/es/core/config.js +253 -47
  20. package/es/core/manifest.d.ts +2 -1
  21. package/es/core/manifest.js +2 -1
  22. package/es/core/minify.js +2 -2
  23. package/es/core/prepare.d.ts +18 -2
  24. package/es/core/prepare.js +46 -15
  25. package/es/core/project-check.d.ts +18 -7
  26. package/es/core/project-check.js +35 -8
  27. package/es/core/sandbox.js +2 -2
  28. package/es/core/sdk.d.ts +39 -0
  29. package/es/core/sdk.js +95 -0
  30. package/es/core/templates.d.ts +3 -3
  31. package/es/core/templates.js +4 -4
  32. package/es/dev/grading.d.ts +1 -1
  33. package/es/dev/grading.js +1 -1
  34. package/es/dev/host-page.js +2 -2
  35. package/es/dev/mock-api.d.ts +7 -8
  36. package/es/dev/mock-api.js +18 -13
  37. package/es/dev/server.js +62 -43
  38. package/es/rules/check.js +45 -9
  39. package/es/rules/manifest.d.ts +1 -1
  40. package/es/rules/manifest.js +1 -1
  41. package/es/rules/types.d.ts +18 -8
  42. package/es/rules.json.js +2 -2
  43. package/es/test-packages.d.ts +7 -0
  44. package/guides/content-development.md +63 -55
  45. package/package.json +2 -2
  46. package/rules.json +18 -3
  47. package/skills/_shared/always.md +2 -2
  48. package/skills/elice-content-check/SKILL.md +3 -1
  49. package/skills/elice-content-create/SKILL.md +5 -4
  50. package/skills/elice-content-migrate/SKILL.md +2 -2
  51. package/skills/elice-content-publish/SKILL.md +4 -3
  52. package/templates/_shared/lib/cdk-mock.js +17 -17
  53. package/templates/_shared/lib/elice-content.css +8 -0
  54. package/templates/_shared/lib/elice-content.d.ts +5 -1
  55. package/templates/_shared/lib/elice-content.js +20 -12
  56. package/templates/blank/README.md +11 -8
  57. package/templates/blank/metadata.json +11 -0
  58. package/templates/blank/package.json +13 -0
  59. package/templates/blank/screens/completion.js +2 -2
  60. package/templates/blank/screens/instructor.js +12 -5
  61. package/templates/blank/screens/learn.js +16 -11
  62. package/templates/quiz/README.md +14 -11
  63. package/templates/quiz/core/editor.d.ts +12 -1
  64. package/templates/quiz/core/editor.js +28 -5
  65. package/templates/quiz/core/model.d.ts +14 -0
  66. package/templates/quiz/core/model.js +73 -1
  67. package/templates/quiz/metadata.json +11 -0
  68. package/templates/quiz/package.json +13 -0
  69. package/templates/quiz/screens/edit.js +85 -29
  70. package/templates/quiz/screens/instructor.js +18 -12
  71. package/templates/quiz/screens/learn.js +42 -36
  72. package/templates/quiz/styles.css +47 -0
  73. package/templates/quiz/template.json +2 -2
  74. package/templates/quiz/ui/templates/edit.d.ts +1 -0
  75. package/templates/quiz/ui/templates/edit.js +37 -5
  76. package/templates/quiz/ui/texts.js +9 -7
  77. package/templates/_shared/lib/cdk.js +0 -3
  78. package/templates/blank/content.json +0 -4
  79. package/templates/blank/elice.config.json +0 -10
  80. package/templates/quiz/content.json +0 -35
  81. package/templates/quiz/elice.config.json +0 -9
  82. package/templates/quiz/grading.json +0 -4
@@ -86,11 +86,41 @@ export const section = ({ label, hint, body }) => html`
86
86
  /** 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨) */
87
87
  export const list = ({ rows, add }) => html`<div class="qe-options">${rows}${add}</div>`;
88
88
 
89
+ /**
90
+ * 보기 줄의 정답 칸. type: 'radio'(단일) · 'checkbox'(복수) · 'select'(그룹 고르기, choices: [그룹 id, 이름]).
91
+ * name: 문항마다 다른 이름 (같은 문항의 radio끼리 묶임). data-role="answer" (input · select, 값은 동작이 넣음)
92
+ */
93
+ const answerControl = ({ type, name, choices = [] }, index) =>
94
+ type === 'select'
95
+ ? html`
96
+ <select
97
+ class="qe-input qe-answer-group"
98
+ data-role="answer"
99
+ name="${name}"
100
+ aria-label="${t.answerGroup(index + 1)}"
101
+ >
102
+ <option value="">${t.answerNoGroup}</option>
103
+ ${choices.map(([value, label]) => html`<option value="${value}">${label}</option>`)}
104
+ </select>
105
+ `
106
+ : html`
107
+ <label class="qe-answer">
108
+ <input
109
+ type="${type}"
110
+ data-role="answer"
111
+ name="${name}"
112
+ aria-label="${t.answerLabel(index + 1)}"
113
+ />
114
+ <span aria-hidden="true">${t.answer}</span>
115
+ </label>
116
+ `;
117
+
89
118
  /**
90
119
  * 보기 · 그룹 한 줄. kind: 'option' | 'group' · index: 0부터 · canDelete: 최소 개수보다 많음
91
- * data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete"
120
+ * answer: 있으면 정답 칸 (answerControl, 단일 · 복수 · 그룹 문항의 보기)
121
+ * data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete" · 있으면 data-role="answer"
92
122
  */
93
- export const row = ({ kind, index, canDelete, min }) => {
123
+ export const row = ({ kind, index, canDelete, min, answer }) => {
94
124
  const k = KIND[kind];
95
125
  return html`
96
126
  <div class="qe-option">
@@ -104,7 +134,8 @@ export const row = ({ kind, index, canDelete, min }) => {
104
134
  ${t.handle}
105
135
  </button>
106
136
  <span class="qe-option-no">${k.marker(index)}</span>
107
- <input class="qe-input" data-role="input" aria-label="${k.input(index)}" />
137
+ <input class="qe-input qe-option-text" data-role="input" aria-label="${k.input(index)}" />
138
+ ${answer && answerControl(answer, index)}
108
139
  <button
109
140
  type="button"
110
141
  class="qe-icon"
@@ -168,8 +199,6 @@ export const card = ({ q, index, count, types, body }) => html`
168
199
  class="qe-icon"
169
200
  data-role="delete"
170
201
  aria-label="${t.questionDelete(index + 1)}"
171
- title="${count <= 1 ? t.questionMin : ''}"
172
- ${count <= 1 && 'disabled'}
173
202
  >
174
203
  ${t.delete}
175
204
  </button>
@@ -188,3 +217,6 @@ export const textAnswers = ({ placeholder }) =>
188
217
  /** 문항 추가 버튼 */
189
218
  export const addQuestion = () =>
190
219
  html`<button type="button" class="qe-add qe-add-question">${t.addQuestion}</button>`;
220
+
221
+ /** 문항이 이미 있어 "문항 추가" 대신 보이는 안내 (퀴즈 하나에 문항 하나) */
222
+ export const singleQuestion = ({ text }) => html`<p class="qe-hint qe-single-question">${text}</p>`;
@@ -22,13 +22,13 @@ export const texts = {
22
22
  /** 편집 화면의 정답 (ADR 0009: 퀴즈는 채점해 통과하면 완료 · 기준 답안 고정, 정답은 문항마다 여기서 고름) */
23
23
  answers: {
24
24
  intro:
25
- '정답은 문항마다 아래 "정답"에서 고릅니다. 저장하면 고른 정답으로 기준 답안(정규표현식)을 만들어 채점에 씁니다. 학생은 모든 문항을 맞혀야 완료(100점)됩니다. 정답은 학생에게 보이지 않습니다.',
25
+ '정답은 문항마다 고릅니다 (객관식 · 그룹 분류는 보기 줄에서, 순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 기준 답안(정규표현식)을 만들어 채점에 씁니다. 학생은 모든 문항을 맞혀야 완료(100점)됩니다. 정답은 학생에게 보이지 않습니다.',
26
26
  label: '정답',
27
27
  hint: {
28
- select_one: '정답 보기를 고르세요.',
29
- select_multiple: '정답 보기를 모두 고르세요.',
28
+ select_one: '정답 보기 옆의 "정답"을 고르세요.',
29
+ select_multiple: '정답 보기 옆의 "정답"을 모두 고르세요.',
30
30
  order: '정답 순서대로 칸에 놓으세요.',
31
- group: '보기를 정답 그룹에 놓으세요. 어느 그룹에도 넣지 않은 보기는 오답 보기입니다.',
31
+ group: '보기마다 정답 그룹을 고르세요. "그룹 없음"인 보기는 오답 보기입니다.',
32
32
  text: '정답으로 인정할 답을 줄마다 하나씩 적으세요. 앞뒤 공백은 무시합니다.',
33
33
  },
34
34
  textPlaceholder: '예: 가중치\nweight',
@@ -92,8 +92,8 @@ export const texts = {
92
92
  questionUp: no => `문항 ${no} 위로`,
93
93
  questionDown: no => `문항 ${no} 아래로`,
94
94
  questionDelete: no => `문항 ${no} 삭제`,
95
- questionMin: '문항은 하나 이상이어야 합니다.',
96
95
  addQuestion: '+ 문항 추가',
96
+ singleQuestion: '퀴즈 하나에 문항은 하나입니다. 여러 문항은 퀴즈 페이지를 여러 개 만들어 주세요.',
97
97
  title: '질문',
98
98
  description: '설명',
99
99
  options: '보기',
@@ -109,8 +109,10 @@ export const texts = {
109
109
  groupsMin: min => `그룹은 ${min}개 이상이어야 합니다.`,
110
110
  groupsMax: max => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
111
111
  addGroup: '+ 그룹 추가',
112
- groupOptionsHint:
113
- '어느 그룹에 속하는지는 아래 정답에서 정합니다. 어느 그룹에도 속하지 않는 보기는 오답 보기가 됩니다.',
112
+ answer: '정답',
113
+ answerLabel: no => `보기 ${no} 정답`,
114
+ answerGroup: no => `보기 ${no} 정답 그룹`,
115
+ answerNoGroup: '그룹 없음 (오답)',
114
116
  slots: '답안 칸 수',
115
117
  slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
116
118
  placeholder: '입력란 힌트',
@@ -1,3 +0,0 @@
1
- /* @eliceio/cdk 1.0.0-alpha.3 — UMD. Copied at build time by scripts/copy-cdk.mjs; do not edit. */
2
- // ecdk-ignore-next-line api.parent-access sec.postmessage-wildcard
3
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).elice=e.elice||{})}(this,function(e){"use strict";function t(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function n(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e){!function(t){var n=function(e,t,i){if(!c(t)||l(t)||d(t)||h(t)||a(t))return t;var r,s=0,o=0;if(u(t))for(r=[],o=t.length;s<o;s++)r.push(n(e,t[s],i));else for(var f in r={},t)Object.prototype.hasOwnProperty.call(t,f)&&(r[e(f,i)]=n(e,t[f],i));return r},i=function(e){return f(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1)},r=function(e){var t=i(e);return t.substr(0,1).toUpperCase()+t.substr(1)},s=function(e,t){return function(e,t){var n=(t=t||{}).separator||"_",i=t.split||/(?=[A-Z])/;return e.split(i).join(n)}(e,t).toLowerCase()},o=Object.prototype.toString,a=function(e){return"function"==typeof e},c=function(e){return e===Object(e)},u=function(e){return"[object Array]"==o.call(e)},l=function(e){return"[object Date]"==o.call(e)},d=function(e){return"[object RegExp]"==o.call(e)},h=function(e){return"[object Boolean]"==o.call(e)},f=function(e){return(e-=0)==e},p=function(e,t){var n=t&&"process"in t?t.process:t;return"function"!=typeof n?e:function(t,i){return n(t,e,i)}},m={camelize:i,decamelize:s,pascalize:r,depascalize:s,camelizeKeys:function(e,t){return n(p(i,t),e)},decamelizeKeys:function(e,t){return n(p(s,t),e,t)},pascalizeKeys:function(e,t){return n(p(r,t),e)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};e.exports?e.exports=m:t.humps=m}(i)}(r);var s=r.exports;const o=e=>s.camelizeKeys(e,(e,t)=>/^\w{2}-\w{2,3}$/.test(e)?e:t(e)),a="http://localhost".replace(/\/+$/,"");class c{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:a}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||p}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return"function"==typeof e?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return"function"==typeof e?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const u=new c;class l{constructor(e=u){this.configuration=e,this.fetchApi=async(e,t)=>{let n,i={url:e,init:t};for(const e of this.middleware)e.pre&&(i=await e.pre(Object.assign({fetch:this.fetchApi},i))||i);try{n=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(e){for(const t of this.middleware)t.onError&&(n=await t.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:e,response:n?n.clone():void 0})||n);if(void 0===n)throw e}for(const e of this.middleware)e.post&&(n=await e.post({fetch:this.fetchApi,url:i.url,init:i.init,response:n.clone()})||n);return n},this.middleware=e.middleware}withMiddleware(...e){const t=this.clone();return t.middleware=t.middleware.concat(...e),t}withPreMiddleware(...e){const t=e.map(e=>({pre:e}));return this.withMiddleware(...t)}withPostMiddleware(...e){const t=e.map(e=>({post:e}));return this.withMiddleware(...t)}async request(e,t){const{url:n,init:i}=await this.createFetchParams(e,t),r=await this.fetchApi(n,i);if(r&&r.status>=200&&r.status<300)return r;const s=await r.json().then(e=>o(e)).catch(()=>({}));throw new h(Object.assign(Object.assign({},function(e){var t,n,i;const r=null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.error;if(r)return{code:r.code,message:r.message,detail:null!==(n=r.details)&&void 0!==n?n:[]};return{code:null==e?void 0:e.code,message:null==e?void 0:e.message,detail:null!==(i=null==e?void 0:e.detail)&&void 0!==i?i:e}}(s)),{status:r.status}))}async createFetchParams(e,t){let n=this.configuration.basePath+e.path;void 0!==e.query&&0!==Object.keys(e.query).length&&(n+="?"+this.configuration.queryParamsStringify(e.query));const i=Object.assign({},this.configuration.headers,e.headers);Object.keys(i).forEach(e=>void 0===i[e]?delete i[e]:{});const r="function"==typeof t?t:async()=>t,o={method:e.method,headers:i,body:e.body,credentials:this.configuration.credentials},a=Object.assign(Object.assign({},o),await r({init:o,context:e}));var c,u;return{url:n,init:Object.assign(Object.assign({},a),{body:(u=a.body,"undefined"!=typeof FormData&&u instanceof FormData||a.body instanceof URLSearchParams||d(a.body)?a.body:JSON.stringify((c=a.body,s.decamelizeKeys(c,(e,t)=>/^\w{2}-\w{2,3}$/.test(e)?e:t(e)))))})}}clone(){const e=new(0,this.constructor)(this.configuration);return e.middleware=this.middleware.slice(),e}}function d(e){return"undefined"!=typeof Blob&&e instanceof Blob}class h extends Error{constructor(e){super(`[${e.code||"unknown"}] ${e.message||"N/A"}`),this.cause=e,this.name="EliceResponseError"}}class f extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}function p(e,t=""){return Object.keys(e).map(n=>m(n,e[n],t)).filter(e=>e.length>0).join("&")}function m(e,t,n=""){const i=n+(n.length?`[${e}]`:e);if(t instanceof Array){const e=t.map(e=>encodeURIComponent(String(e))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${e}`}if(t instanceof Set){return m(e,Array.from(t),n)}return t instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?p(t,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(t))}`}class v{constructor(e,t=e=>e){this.raw=e,this.transformer=t}async value(){return o(this.transformer(await this.raw.json()))}}async function y(e){const{data:t}=await e.value();return t}function w(e,t=""){return`/materials/{material_id}${t}`.replace("{material_id}",encodeURIComponent(String(e)))}class g extends l{async withBearer(e={}){if(this.configuration&&this.configuration.accessToken){const t=this.configuration.accessToken,n=await t("HTTPBearer",[]);n&&(e.Authorization=`Bearer ${n}`)}return e}async authTokenRefreshRaw(e){const t=await this.request({path:"/auth/token/refresh",method:"POST",headers:await this.withBearer(),query:{}},e);return new v(t)}async authTokenRefresh(e){return y(await this.authTokenRefreshRaw(e))}async materialGetRaw(e,t){const n=await this.request({path:w(e.materialId),method:"GET",headers:await this.withBearer(),query:{}},t);return new v(n)}async materialGet(e,t){return y(await this.materialGetRaw(e,t))}async materialMeGetRaw(e,t){const n=await this.request({path:w(e.materialId,"/me"),method:"GET",headers:await this.withBearer(),query:{}},t);return new v(n)}async materialMeGet(e,t){return y(await this.materialMeGetRaw(e,t))}async materialUpdateRaw(e,t){if(null===e.materialUpdateRequest||void 0===e.materialUpdateRequest)throw new f("materialUpdateRequest","Required parameter requestParameters.materialUpdateRequest was null or undefined when calling materialUpdate.");const n={"Content-Type":"application/json"},i=await this.request({path:w(e.materialId),method:"PATCH",headers:await this.withBearer(n),query:{},body:e.materialUpdateRequest},t);return new v(i)}async materialUpdate(e,t){return y(await this.materialUpdateRaw(e,t))}async submissionCreateRaw(e,t){if(null===e.submissionCreateRequest||void 0===e.submissionCreateRequest)throw new f("submissionCreateRequest","Required parameter requestParameters.submissionCreateRequest was null or undefined when calling submissionCreate.");const n={"Content-Type":"application/json"},i=await this.request({path:w(e.materialId,"/submissions"),method:"POST",headers:await this.withBearer(n),query:{},body:e.submissionCreateRequest},t);return new v(i)}async submissionCreate(e,t){return y(await this.submissionCreateRaw(e,t))}async submissionMeListRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit);const i=await this.request({path:w(e.materialId,"/submissions/me"),method:"GET",headers:await this.withBearer(),query:n},t);return new v(i)}async submissionMeList(e,t){return y(await this.submissionMeListRaw(e,t))}}var b;e.ErrorCode=void 0,(b=e.ErrorCode||(e.ErrorCode={})).Init="init",b.InvalidParam="invalid_param",b.InvalidToken="invalid_token",b.NotInitialized="not_initialized",b.Unauthorized="unauthorized",b.SessionExpired="session_expired",b.PermissionDenied="permission_denied",b.ReadOnlyMode="read_only_mode",b.ScreenNotSupported="screen_not_supported",b.DraftNotSaved="draft_not_saved",b.ContentNotReady="content_not_ready",b.InvalidInput="invalid_input",b.RateLimited="rate_limited",b.ExternalServiceError="external_service_error",b.NavigationTimeout="navigation_timeout",b.RequestFailed="request_failed";const _=Object.assign(class e extends Error{constructor(t,n,i){var r;const s=i?i instanceof Error?i:new Error(i):void 0;super(`[@eliceio/cdk] ${t} - ${n}${s?`\n${null!==(r=s.stack)&&void 0!==r?r:""}`:""}`),this.code=t,this.cause=s,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}},{code:e.ErrorCode});var P;const z="preview";class k{constructor(e="learn",t="instructor",n={}){this.scope=e,this.viewer=t,this.settings=n,P.set(this,[])}async authTokenRefresh(){return{accessToken:"",expiresAt:new Date(Date.now()+72e5).toISOString()}}async materialGet(e){return{id:e.materialId,lecturePageId:0,courseId:0,description:{type:"text",text:""},currentVersion:{id:z,contentUrls:{},metadata:{screens:{}},fileTree:[],settings:this.settings}}}async materialMeGet(e){return{scope:this.scope,viewer:this.viewer,user:{anonymousId:"preview",fullname:null},result:null}}async materialUpdate(e){throw new _(_.code.DraftNotSaved,"Settings of an unsaved upload cannot be saved. Save the material in the editor first.")}async submissionCreate(e){const n={isCorrect:!0,score:100};return t(this,P,"f").unshift(Object.assign({id:`preview-${t(this,P,"f").length+1}`,materialVersionId:z,accountId:0,createdAt:(new Date).toISOString(),answer:e.submissionCreateRequest.answer},n)),n}async submissionMeList(e){const{offset:n=0,limit:i=20}=e;return t(this,P,"f").slice(n,n+i)}}P=new WeakMap;function O(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function S(e,t){return"bigint"==typeof t?t.toString():t}class T{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function E(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const j="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function I(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const R=new Set(["string","number","symbol"]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function $(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function M(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function U(e){return"string"==typeof e?e:e?.message}function A(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function L(e,t,n){var i;const r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);const s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:U(e.inst?._zod.def?.error?.(e))??U(s?.(e))??U(t?.error?.(e))??U(n.customError?.(e))??U(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=e.input),a}function q(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function N(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:q(this,t,n.bind(this))},set(e){q(this,t,e)}})}let D,Z=!1;const W={configurable:!0,get(){Z=!0}};function V(e,t,n){const i=Object.getPrototypeOf(e._zod);t in i&&D!==e._zod?D=void 0:(D=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,W);const e=Z;Z=!1;try{const i=n(this);return Z?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Z=Z||e,i}catch(n){throw delete this[t],Z=Z||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function K(e,t,n,i){const r=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:e})}})}function F(e){const t=()=>e;return t["~constantCatch"]=!0,t}var G;const B={value:void 0,enumerable:!1};let J="captureStackTrace"in Error?Error:null;function H(e,t,n,i){function r(e){this.def=e,this.constr=l,this.traits=new Set}r.prototype={};const s=n,o=s&&new WeakSet;function a(n,i){if(n._zod){if(n._zod.traits.has(e))return}else{B.value=new r(i);try{Object.defineProperty(n,"_zod",B)}finally{B.value=void 0}}if(n._zod.traits.add(e),t(n,i),o){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);const r=i??e;o.has(r)||(o.add(r),function(e,t){for(const n in t){const i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):N(e,n,i.value)}}(r,s))}const a=l.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const c=i?.Parent??Object;class u extends c{}function l(e){const t=i?.Parent?function(e){const t=J;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return J=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(u):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const r=globalThis.__zod_globalConfig?.postProcessor;return r&&r(t),t}return Object.defineProperty(u,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!(i?.Parent&&t instanceof i.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class Y extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(G=globalThis).__zod_globalConfig??(G.__zod_globalConfig={});const X=globalThis.__zod_globalConfig;function Q(e){return X}const ee={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,S,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},te={value:void 0,enumerable:!1},ne=new WeakSet([Object.prototype,Error.prototype]),ie=H("$ZodError",(e,t)=>{e.name="$ZodError",te.value=t,Object.defineProperty(e,"issues",te),te.value=void 0,Object.defineProperty(e,"message",ee);const n=Object.getPrototypeOf(e);ne.has(n)||(ne.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},void 0,{Parent:Error}),re=(e=>{const t=(n,i,r,s)=>{const o=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Y;if(a.issues.length){const n=new(s?.Err??e)(a.issues.map(e=>L(e,o,Q())));throw j(n,s?.callee??t),n}return a.value};return t})(ie),se=e=>{const t=async(n,i,r,s)=>{const o=r?{...r,async:!0}:{async:!0};let a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(s?.Err??e)(a.issues.map(e=>L(e,o,Q())));throw j(n,s?.callee??t),n}return a.value};return t},oe=se(ie),ae=(e=>(t,n,i)=>{const r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new Y;return s.issues.length?ce(e,s.issues,r):{success:!0,data:s.value}})(ie);function ce(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(e=>L(e,n,Q()))),t=void 0,n=void 0),i},set error(e){i=e,t=void 0,n=void 0}}}const ue=(e=>async(t,n,i)=>{const r=i?{...i,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?ce(e,s.issues,r):{success:!0,data:s.value}})(ie),le=/^https?$/,de=/^[\s\S]{0,}$/,he=H("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fe=H("$ZodCheckStringFormat",(e,t)=>{var n,i;he.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),pe={major:4,minor:6,patch:7},me=H("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pe;const i=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,i)=>{if(t.memo)return t;let r,s=$(t);for(const o of n){if(o._zod.def.when){if(M(t))continue;if(!o._zod.def.when(t))continue}else if(s)continue;const n=t.issues.length,a=o._zod.check(t);if(a instanceof Promise&&!1===i?.async)throw new Y;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a;t.issues.length!==n&&(A(t.issues,n,e),s||(s=$(t,n)))});else{if(t.issues.length===n)continue;A(t.issues,n,e),s||(s=$(t,n))}}return r?r.then(()=>t):t},n=(n,i,s)=>{if($(n))return n.aborted=!0,n;const o=t(i,r,s);if(o instanceof Promise){if(!1===s.async)throw new Y;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,s)):n(t,i,s)}const o=e._zod.parse(i,s);if(o instanceof Promise){if(!1===s.async)throw new Y;return o.then(e=>t(e,r,s))}return t(o,r,s)}}},{get"~standard"(){return function(e,t,n){return q(e,t,n,!1)}(this,"~standard",(e=this,{validate:t=>{const n={async:!1};try{const i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return ve(i,n)}catch(e){}return async function(e,t){const n={async:!0};return ve(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}));var e},set"~standard"(e){q(this,"~standard",e)}}),ve=(e,t)=>e.issues.length?{issues:e.issues.map(e=>L(e,t,Q()))}:{value:e.value};const ye=H("$ZodString",(e,t)=>{me.init(e,t),e._zod.pattern=t.pattern??de,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),we=H("$ZodStringFormat",(e,t)=>{fe.init(e,t),ye.init(e,t)});function ge(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===le.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):function(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}(e)||2}const be=/[\t\n\r]/g;function _e(e){return e.replace(be,"")}const Pe=H("$ZodURL",(e,t)=>{we.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),r=ge(i,t);return 1===r?void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort}):2===r?void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort}):!0===r?void(n.value=_e(i)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(r,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(r,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),void(n.value=t.normalize?r.href:_e(i)))}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}});const ze=H("$ZodJWT",(e,t)=>{we.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const r=JSON.parse(atob(i));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});function ke(e,t,n,i,r,s){const o=n in i,a="optional"===s;if(o||!a||"optional"!==r){if(e.issues.length){if(void 0!==r&&a&&!o)return;t.issues.push(...(c=n,u=e.issues,u.map(e=>{var t;return(t=e).path??(t.path=[]),e.path.unshift(c),e})))}var c,u;o||void 0!==r?void 0===e.value?(o||"defaulted"===r&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const Oe=[];function Se(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:Oe,r=i.length?[...t,...i]:t;for(const t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const s=(o=e.shape,Object.keys(o).filter(e=>void 0!==o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{...e,allKeys:r,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}const Te=H("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){const e=()=>{const n={...i};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=i,Object.defineProperty(t,"shape",{get:e})}const r=new T(()=>Se(t));V(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const i=t[e]._zod;if(i.values){Object.prototype.hasOwnProperty.call(n,e)||E(n,e,new Set);for(const t of i.values)n[e].add(t);void 0!==i.optin&&n[e].add(void 0)}}return n});const s=I,o=t.catchall;let a;const c=X.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{a??(a=r.value);const i=t.value;if(!s(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};const u=[],l=a.shape,d=n?.abortEarly;let h=t.issues.length;for(const e of a.allKeys){if(d&&t.issues.length!==h){if($(t,h))break;h=t.issues.length}if("__proto__"===e)continue;const r=l[e],s=r._zod.optin,o=r._zod.optout,a=r._zod.run({value:i[e],issues:[]},n);a instanceof Promise?u.push(a.then(n=>ke(n,t,e,i,s,o))):ke(a,t,e,i,s,o)}return o?function(e,t,n,i,r,s,o){const a=[],c=r.keySet,u=r.catchall._zod,l=u.def.type,d=u.optin,h=u.optout;let f=0;for(const r in t){if(o&&n.issues.length!==f){if($(n,f))break;f=n.issues.length}if(c.has(r))continue;if("__proto__"===r){"never"===l&&a.push(r);continue}if("never"===l){a.push(r);continue}const s=u.run({value:t[r],issues:[]},i);s instanceof Promise?e.push(s.then(e=>ke(e,n,r,t,d,h))):ke(s,n,r,t,d,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}(u,i,t,n,r.value,e,!0===d):u.length?Promise.all(u).then(()=>t):t}}),Ee=H("$ZodEnum",(e,t)=>{me.init(e,t);const n=O(t.entries),i=new Set(n);e._zod.values=i,V(e,"pattern",e=>{const t=O(e.def.entries).filter(e=>R.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>C(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,r)=>{const s=t.value;return i.has(s)||t.issues.push({code:"invalid_value",values:n,input:s,inst:e}),t}}),je=H("$ZodLiteral",(e,t)=>{me.init(e,t);const n=new Set(t.values);e._zod.values=n,V(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?C(e):e?C(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,r)=>{const s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}});function Ie(e,t){return e.value=t.issues.length?void 0:t.value,e}const Re=H("$ZodOptional",(e,t)=>{me.init(e,t),V(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",V(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),V(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${function(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const i=t.innerType._zod.run({value:e.value,issues:[]},n);return i instanceof Promise?i.then(t=>Ie(e,t)):Ie(e,i)}return t.innerType._zod.run(e,n)}});function Ce(e,t,n,i){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>L(e,i,Q()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const xe=H("$ZodCatch",(e,t)=>{me.init(e,t),V(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),V(e,"optout",e=>e.def.innerType._zod.optout),V(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run({value:e.value,issues:[]},n);return i instanceof Promise?i.then(i=>Ce(e,i,t,n)):Ce(e,i,t,n)}}),$e=H("$ZodCustom",(e,t)=>{he.init(e,t),me.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(t=>Me(t,n,i,e));Me(r,n,i,e)}});function Me(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(function(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}(e))}}const Ue=H("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");me.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){q(this,"with",e)},parse(e,t){return re(this,e,t,{callee:this.parse})},parseAsync(e,t){return oe(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return ae(this,e,t)},safeParseAsync(e,t){return ue(this,e,t)},check(...e){const t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return function(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return 0===t.length?e(this):e(this,...t)}}),Ae=H("ZodMiniString",(e,t)=>{ye.init(e,t),Ue.init(e,t)}),Le=H("ZodMiniStringFormat",(e,t)=>{we.init(e,t),Ae.init(e,t)}),qe=H("ZodMiniURL",(e,t)=>{Pe.init(e,t),Le.init(e,t)});const Ne=H("ZodMiniJWT",(e,t)=>{ze.init(e,t),Le.init(e,t)});const De=H("ZodMiniObject",(e,t)=>{Te.init(e,t),Ue.init(e,t),K(e,"shape",e=>e._zod.def.shape,!1)});const Ze=H("ZodMiniEnum",(e,t)=>{Ee.init(e,t),Ue.init(e,t),e.options=[...e._zod.values]});const We=H("ZodMiniLiteral",(e,t)=>{je.init(e,t),Ue.init(e,t)});function Ve(e,t){return new We({type:"literal",values:Array.isArray(e)?e:[e],...x(t)})}const Ke=H("ZodMiniOptional",(e,t)=>{Re.init(e,t),Ue.init(e,t)});function Fe(e){return new Ke({type:"optional",innerType:e})}const Ge=H("ZodMiniCatch",(e,t)=>{xe.init(e,t),Ue.init(e,t)});const Be=H("ZodMiniCustom",(e,t)=>{$e.init(e,t),Ue.init(e,t)});const Je=function(e,t){const n={type:"object",shape:e??{},...x(t)};return new De(n)}({token:Fe((Xe="access token(`token`) is not a JWT",function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}(Ne,Xe))),preview:Fe(Ve("1")),edit:Fe(Ve("1")),completionPolicy:Fe(Ve("1")),baseUrl:(He=Fe(function(e){return function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}(qe,e)}({protocol:/^https?$/})),Ye=void 0,new Ge({type:"catch",innerType:He,catchValue:F(Ye)})),screen:Fe(function(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ze({type:"enum",entries:n,...x(t)})}(["learn","instructor","completionPolicy"]))}).check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...x(n)})}(Be,e,t)}(e=>null!=e.token||"1"===e.preview||"1"===e.edit||"1"===e.completionPolicy,{message:"access token(`token`) is not provided"}));var He,Ye,Xe;const Qe=/\/materials\/([0-9a-f-]{36})\//i;const et="undefined"==typeof window,tt="eliceio-content-sdk";function nt(){if(et||window.parent===window)return null;const e=window.parent;return{post(t){e.postMessage(t,"*")},subscribe(t){function n(n){n.source===e&&function(e){if("object"!=typeof e||null===e)return!1;const{source:t,type:n}=e;return t===tt&&"string"==typeof n}(n.data)&&t(n.data)}return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}}}}function it(e){let t="";return t=(e=>{try{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return decodeURIComponent((e=>e.split("").map(e=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}).join(""))(atob(t)))}catch(e){throw new _(_.code.InvalidToken,"Fail to decode base64 format.",e)}})(e.split(".")[1]),t=(e=>{try{return JSON.parse(e)}catch(e){throw new _(_.code.InvalidToken,"Fail to parse JSON format.",e)}})(t),o(t)}var rt,st,ot;const at=Object.freeze({previous:"navigate-prev",next:"navigate-next",navigate:"navigate",stateSync:"navigate-state-sync"}),ct="navigate-state";class ut{constructor(e){rt.add(this),this.ctx=e}async getHasPrevious(){return(await t(this,rt,"m",ot).call(this)).hasPreviousLecturePage}async getHasNext(){return(await t(this,rt,"m",ot).call(this)).hasNextLecturePage}previous(){t(this,rt,"m",st).call(this,at.previous)}next(){t(this,rt,"m",st).call(this,at.next)}navigate(e){t(this,rt,"m",st).call(this,at.navigate,{lecturePageId:e})}}var lt,dt,ht,ft,pt,mt,vt,yt,wt,gt,bt,_t,Pt,zt,kt,Ot,St,Tt,Et,jt,It,Rt,Ct,xt,$t,Mt,Ut,At,Lt,qt,Nt,Dt,Zt;rt=new WeakSet,st=function(e,t,n){const i=this.ctx.assertNavigable();if(this.ctx.isDraft()||null==this.ctx.channel)return!1;const r={source:tt,type:e,materialId:i};return void 0!==t&&(r.payload=t),void 0!==n&&(r.requestId=n),this.ctx.channel.post(r),!0},ot=function(){var e;const n="undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,i=this.ctx.channel,r=null!==(e=this.ctx.stateTimeoutMs)&&void 0!==e?e:1e3;return new Promise((e,s)=>{let o=()=>{},a=null;const c=()=>{o(),null!==a&&clearTimeout(a)};let u;null!=i&&(o=i.subscribe(t=>{var i;if(t.type!==ct||t.requestId!==n)return;c();const r=null!==(i=t.payload)&&void 0!==i?i:{};e({hasPreviousLecturePage:!0===r.hasPreviousLecturePage,hasNextLecturePage:!0===r.hasNextLecturePage})}));try{u=t(this,rt,"m",st).call(this,at.stateSync,void 0,n)}catch(e){return c(),void s(e)}if(!u)return c(),void e({hasPreviousLecturePage:!1,hasNextLecturePage:!1});a=setTimeout(()=>{c(),s(new _(_.code.NavigationTimeout,"The learning page did not answer the navigation state request."))},r)})};const Wt=Object.freeze({AUTH_PERMISSION_DENIED:e.ErrorCode.PermissionDenied,AUTHENTICATION_INVALID:e.ErrorCode.Unauthorized,EXTERNAL_SERVICE_ERROR:e.ErrorCode.ExternalServiceError,INVALID_INPUT:e.ErrorCode.InvalidInput,MATERIAL_CONTENT_NOT_READY:e.ErrorCode.ContentNotReady,MATERIAL_READ_ONLY_MODE:e.ErrorCode.ReadOnlyMode,MATERIAL_TOO_MANY_SUBMISSIONS:e.ErrorCode.RateLimited});function Vt(e,t){var n,i,r;if(e instanceof h){const s=null!==(i=Wt[null!==(n=e.cause.code)&&void 0!==n?n:""])&&void 0!==i?i:_.code.RequestFailed;return new _(s,null!==(r=e.cause.message)&&void 0!==r?r:t,e)}return new _(_.code.RequestFailed,t,e)}function Kt(e){return e instanceof h&&401===e.cause.status}function Ft(e){if(!Kt(e))return!1;const t=e.cause.detail;return Array.isArray(t)&&t.some(e=>{var t;return"session_expired"===(null===(t=null==e?void 0:e.ctx)||void 0===t?void 0:t.reason)})}dt=new WeakMap,ht=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=new WeakMap,vt=new WeakMap,yt=new WeakMap,wt=new WeakMap,gt=new WeakMap,bt=new WeakMap,_t=new WeakMap,Pt=new WeakMap,zt=new WeakMap,kt=new WeakMap,Ot=new WeakMap,St=new WeakMap,Tt=new WeakMap,lt=new WeakSet,Et=function(){if(!this.initialized||!t(this,bt,"f"))throw new _(_.code.NotInitialized,"The SDK is not initialized. Please call the init function first.");if(t(this,mt,"f"))throw new _(_.code.SessionExpired,"The session has expired. Please reload the material.");return t(this,bt,"f").materialId},jt=function(e){var n;if(!t(this,bt,"f"))return;const i={source:tt,type:"settings-saved",materialId:t(this,bt,"f").materialId,payload:e};null===(n=t(this,St,"f"))||void 0===n||n.post(i)},It=function(e){const n=t(this,lt,"m",Rt).call(this,e),i=e instanceof h&&n.code!==_.code.SessionExpired?e.cause.code:void 0;return t(this,lt,"m",jt).call(this,{status:"failed",code:null!=i?i:n.code}),n},Rt=function(e){return e instanceof _?e:Ft(e)?(t(this,lt,"m",Zt).call(this),new _(_.code.SessionExpired,"The session has expired. Please reload the material.",e)):Vt(e,"Failed to save the settings.")},Ct=function(...e){if(null==t(this,wt,"f")||!e.includes(t(this,wt,"f")))throw new _(_.code.ScreenNotSupported,`This call is only available on the ${e.join(" or ")} screen.`)},xt=function(){var e,n,i,r,s;if(t(this,zt,"f"))return{materials:new k(null!==(e=t(this,vt,"f"))&&void 0!==e?e:"learn","instructor")};const o=new c({basePath:(null!==(s=null!==(i=null===(n=this.options)||void 0===n?void 0:n.baseUrl)&&void 0!==i?i:null===(r=t(this,Ot,"f"))||void 0===r?void 0:r.baseUrl)&&void 0!==s?s:"https://api-material.elice.io").replace(/\/+$/,""),accessToken:()=>{var e;return null!==(e=t(this,ht,"f"))&&void 0!==e?e:""}});return{materials:new g(o)}},$t=async function(e){const i=null!=e?e:et?"":window.location.hash,r=/(^|[#&])(token|preview|edit|completionPolicy)=/.test(i);if(void 0===e&&!r&&t(this,Ot,"f"))return t(this,Ot,"f");const s=new URLSearchParams(i.replace(/^#/,"")),{data:o,error:a}=await Je.safeParseAsync(Object.fromEntries(s.entries()));if(a)throw new AggregateError(a.issues.map(e=>new _(_.code.InvalidParam,e.message)),"Failed to resolve fragment params during initialization.");return n(this,Ot,o,"f"),o},Mt=function(){if(et||!window.location.hash.includes("token="))return;const e=new URLSearchParams(window.location.hash.replace(/^#/,""));e.delete("token");const t=e.toString(),{pathname:n,search:i}=window.location;window.history.replaceState(window.history.state,"",`${n}${i}${t?`#${t}`:""}`)},Ut=function(e,i){var r,s,o,a,c,u;n(this,zt,null==e.token,"f"),n(this,mt,!1,"f"),t(this,lt,"m",Lt).call(this,null!==(r=e.token)&&void 0!==r?r:null);const l=t(this,ht,"f")?it(t(this,ht,"f")):null,d=null!==(o=null!==(s=function(e){const t=Qe.exec(e);return t?t[1].toLowerCase():null}(null!=i?i:et?"":window.location.pathname))&&void 0!==s?s:null==l?void 0:l.materialId)&&void 0!==o?o:null;if(null==d)throw new _(_.code.InvalidParam,"The material id is not found in the content URL or the access token.");if(n(this,bt,{materialId:d,lecturePageId:null!==(a=null==l?void 0:l.lecturePageId)&&void 0!==a?a:null,courseId:null!==(c=null==l?void 0:l.courseId)&&void 0!==c?c:null},"f"),n(this,Pt,null!==(u=null==l?void 0:l.locale)&&void 0!==u?u:"ko","f"),t(this,zt,"f")){const t="1"===e.edit||"1"===e.completionPolicy;n(this,vt,t?"edit":"learn","f"),n(this,wt,"1"===e.completionPolicy?"completionPolicy":"1"===e.edit?"edit":"learn","f")}return d},At=async function(e){var i,r,s,o,a,c,u;const[l,d]=await Promise.all([this.internal_apis.materials.materialGet({materialId:e}),this.internal_apis.materials.materialMeGet({materialId:e})]),h=null!==(r=null===(i=l.currentVersion.metadata)||void 0===i?void 0:i.screens)&&void 0!==r?r:{},f={};for(const e of["learn","instructor","edit","completionPolicy"]){const{entry:t,enabled:n}=null!==(s=h[e])&&void 0!==s?s:{};!1!==n&&"string"==typeof t&&(f[e]=t)}n(this,_t,{description:l.description,entries:f,settings:l.currentVersion.settings,completionPolicy:null!==(o=l.currentVersion.completionPolicy)&&void 0!==o?o:null,completionPolicies:null!==(c=null===(a=l.currentVersion.metadata)||void 0===a?void 0:a.completionPolicies)&&void 0!==c?c:null},"f"),n(this,kt,l.currentVersion.id,"f"),n(this,dt,d.user,"f"),n(this,gt,d.result,"f"),n(this,yt,d.viewer,"f"),t(this,zt,"f")||(n(this,vt,d.scope,"f"),n(this,wt,function(e,t,n,i){return"edit"===e?null==i?"edit":"completionPolicy"===i?"completionPolicy":"instructor"===i&&n.instructor?"instructor":"learn":"instructor"===t&&n.instructor?"instructor":"learn"}(d.scope,d.viewer,t(this,_t,"f").entries,null===(u=t(this,Ot,"f"))||void 0===u?void 0:u.screen),"f"))},Lt=function(e){var t;n(this,ht,e,"f");const i=e?null===(t=it(e))||void 0===t?void 0:t.exp:void 0;n(this,ft,i?1e3*i:null,"f")},qt=function(e){if(t(this,lt,"m",Nt).call(this),t(this,zt,"f")||null==t(this,ft,"f")||et)return;const i=null!=e?e:Math.max(0,t(this,ft,"f")-3e5-Date.now());n(this,pt,setTimeout(()=>{t(this,lt,"m",Dt).call(this)},i),"f")},Nt=function(){null!=t(this,pt,"f")&&(clearTimeout(t(this,pt,"f")),n(this,pt,null,"f"))},Dt=async function(){try{const{accessToken:e}=await this.internal_apis.materials.authTokenRefresh();t(this,lt,"m",Lt).call(this,e),t(this,lt,"m",qt).call(this)}catch(e){if(Ft(e)||Kt(e))return void t(this,lt,"m",Zt).call(this);t(this,lt,"m",qt).call(this,3e4)}},Zt=function(){var e,i;t(this,lt,"m",Nt).call(this),n(this,mt,!0,"f"),null===(i=(e=this.options).onSessionExpired)||void 0===i||i.call(e)},e.EliceCDK=class{constructor(e={}){lt.add(this),this.options=e,this.initialized=!1,dt.set(this,null),ht.set(this,null),ft.set(this,null),pt.set(this,null),mt.set(this,!1),vt.set(this,null),yt.set(this,null),wt.set(this,null),gt.set(this,null),bt.set(this,null),_t.set(this,null),Pt.set(this,"ko"),zt.set(this,!1),kt.set(this,null),Ot.set(this,null),St.set(this,void 0),Tt.set(this,void 0),this.internal_apis=t(this,lt,"m",xt).call(this),n(this,St,nt(),"f"),n(this,Tt,new ut({channel:t(this,St,"f"),isDraft:()=>t(this,zt,"f"),assertNavigable:()=>{const e=t(this,lt,"m",Et).call(this);return t(this,lt,"m",Ct).call(this,"learn","instructor"),e}}),"f")}get account(){return t(this,dt,"f")}get scope(){return t(this,vt,"f")}get viewer(){return t(this,yt,"f")}get screen(){return t(this,wt,"f")}get result(){return t(this,gt,"f")}get metadata(){return t(this,bt,"f")}get material(){return t(this,_t,"f")}get locale(){return t(this,Pt,"f")}get isDraft(){return t(this,zt,"f")}get isSessionExpired(){return t(this,mt,"f")}get navigation(){return t(this,Tt,"f")}async init(e={}){this.initialized=!1,t(this,lt,"m",Nt).call(this);const n=await t(this,lt,"m",$t).call(this,e.hash);void 0===e.hash&&t(this,lt,"m",Mt).call(this);try{const i=t(this,lt,"m",Ut).call(this,n,e.pathname);this.internal_apis=t(this,lt,"m",xt).call(this),await t(this,lt,"m",At).call(this,i),this.initialized=!0,t(this,lt,"m",qt).call(this)}catch(e){if(e instanceof _)throw e;throw Vt(e,"Failed to initialize elice content sdk.")}return this}async submit(e){const n=t(this,lt,"m",Et).call(this);t(this,lt,"m",Ct).call(this,"learn","instructor");try{return await this.internal_apis.materials.submissionCreate({materialId:n,submissionCreateRequest:{answer:e}})}catch(e){throw Vt(e,"Failed to submit the answer.")}}async history(e={}){const n=t(this,lt,"m",Et).call(this);try{return await this.internal_apis.materials.submissionMeList(Object.assign({materialId:n},e))}catch(e){throw Vt(e,"Failed to load submissions.")}}async saveSettings(e){var i;this.initialized&&"edit"===t(this,wt,"f")||(t(this,lt,"m",Et).call(this),t(this,lt,"m",Ct).call(this,"edit"));try{if(t(this,zt,"f"))throw new _(_.code.DraftNotSaved,"Settings of an unsaved upload cannot be saved. Save the material in the editor first.");const r=t(this,lt,"m",Et).call(this),s=await this.internal_apis.materials.materialUpdate({materialId:r,materialUpdateRequest:{settings:e,expectedCurrentVersionId:null!==(i=t(this,kt,"f"))&&void 0!==i?i:void 0}});n(this,kt,s.currentVersion.id,"f"),t(this,_t,"f")&&n(this,_t,Object.assign(Object.assign({},t(this,_t,"f")),{settings:s.currentVersion.settings}),"f"),t(this,lt,"m",jt).call(this,{status:"saved"})}catch(e){throw t(this,lt,"m",It).call(this,e)}}async saveCompletionPolicy(e){var i,r;this.initialized&&"completionPolicy"===t(this,wt,"f")||(t(this,lt,"m",Et).call(this),t(this,lt,"m",Ct).call(this,"completionPolicy"));try{if(t(this,zt,"f"))throw new _(_.code.DraftNotSaved,"The completion policy of an unsaved upload cannot be saved. Save the material in the editor first.");const s=t(this,lt,"m",Et).call(this),o=await this.internal_apis.materials.materialUpdate({materialId:s,materialUpdateRequest:{completionPolicy:e,expectedCurrentVersionId:null!==(i=t(this,kt,"f"))&&void 0!==i?i:void 0}});n(this,kt,o.currentVersion.id,"f"),t(this,_t,"f")&&n(this,_t,Object.assign(Object.assign({},t(this,_t,"f")),{completionPolicy:null!==(r=o.currentVersion.completionPolicy)&&void 0!==r?r:e}),"f"),t(this,lt,"m",jt).call(this,{status:"saved"})}catch(e){throw t(this,lt,"m",It).call(this,e)}}dispose(){t(this,lt,"m",Nt).call(this)}},e.EliceCDKError=_,e.EliceCDKNavigation=ut,e.NAVIGATION_MESSAGE_TYPE=at,e.NAVIGATION_STATE_MESSAGE_TYPE=ct});
@@ -1,4 +0,0 @@
1
- {
2
- "title": "새 학습 자료",
3
- "message": "학생에게 보여 줄 내용을 편집 화면에서 고치세요."
4
- }
@@ -1,10 +0,0 @@
1
- {
2
- "kind": "material",
3
- "screens": {
4
- "learn": "index.html",
5
- "instructor": "instructor.html",
6
- "edit": "edit.html",
7
- "completionPolicy": "completion.html"
8
- },
9
- "completionPolicies": ["on_submit", "on_access"]
10
- }
@@ -1,35 +0,0 @@
1
- {
2
- "title": "퍼셉트론 확인 문제",
3
- "description": "문제를 풀고 제출해요.",
4
- "questions": [
5
- {
6
- "id": "q1",
7
- "type": "select_one",
8
- "title": "퍼셉트론이 1을 내보내는 조건은 무엇인가요?",
9
- "description": "가중치와 편향이 어떻게 쓰이는지 떠올려 보세요.",
10
- "options": [
11
- {
12
- "id": "a",
13
- "text": "입력의 합이 0보다 클 때"
14
- },
15
- {
16
- "id": "b",
17
- "text": "가중합에 편향을 더한 값이 0보다 클 때"
18
- },
19
- {
20
- "id": "c",
21
- "text": "두 입력이 모두 1일 때"
22
- },
23
- {
24
- "id": "d",
25
- "text": "편향이 0보다 클 때"
26
- }
27
- ],
28
- "shuffle": false,
29
- "explanation": {
30
- "enabled": true,
31
- "text": "퍼셉트론은 **w1·x1 + w2·x2 + b > 0** 이면 1을 내보냅니다."
32
- }
33
- }
34
- ]
35
- }
@@ -1,9 +0,0 @@
1
- {
2
- "kind": "material",
3
- "screens": {
4
- "learn": "index.html",
5
- "instructor": "instructor.html",
6
- "edit": "edit.html"
7
- },
8
- "completionPolicies": ["on_graded"]
9
- }
@@ -1,4 +0,0 @@
1
- {
2
- "type": "pattern",
3
- "answer_key": "^q1=b$"
4
- }