@qxs-bns/components-wc 0.0.29 → 0.0.30

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.
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("../base/uid.cjs"),r=require("./sorting-card.cjs"),o=require("./types.cjs"),a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,l=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?n(t,s):t,l=e.length-1;l>=0;l--)(r=e[l])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&a(t,s,o),o};class c extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(e),this.code=t,this.field=s,this.row=i,this.name="SubjectError"}static from(e){return new c(e.message,e.code,e.field,e.row)}}const p=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,h=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`,d=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;function u(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()[\]【】\-_/\\]+/g,"").toLowerCase()}function x(e){return String(e??"").trim()}function g(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}exports.QxsSubjectSingle=class extends e.LitElement{constructor(){super(...arguments),this["order-index"]=0,this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-set-correct-answer"]=!1,this.lockAnswerKey=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-analysis"]=!1,this.type="single",this["answer-check-type"]=1,this["exam-answer-relation-type"]=0,this["rich-text-content"]="",this.analysis="",this["least-answer-count"]=null,this["exam-expand"]="",this["custom-id"]="",this["exam-id"]=0,this["category-id"]="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["tag-list"]=[],this["category-list"]=[],this["ai-answer"]="",this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["has-jump"]=!1,this["search-api"]="",this["model-value"]="",this["use-model"]=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.title="",this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=null,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._changeTypeDialogOpen=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get"answer-list"(){return this._answers}set"answer-list"(e){if(this["is-edit"])return;const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>this._normalizeAnswerItem(e)):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answer-list")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps()}firstUpdated(){this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(e.has("title")||e.has("answer-list")||e.has("analysis")||e.has("least-answer-count")||e.has("answer-check-type")||e.has("tag-list")||e.has("category-id")||e.has("rich-text-content"))&&this._syncExternalProps(),e.has("is-key")&&(this._isKey=this["is-key"]),e.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[]),e.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):""),(e.has("exam-expand")||e.has("answer-list"))&&this._syncExamExpand(),e.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_supportsLeastAnswerCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;return"multiple"===e||"sort"===e}_normalizeLeastAnswerCount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;if(!this._supportsLeastAnswerCount(t)||""===e||null==e)return null;const s=Number(e);return Number.isFinite(s)&&s>0?s:null}_leastAnswerCountSuffix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return this._supportsLeastAnswerCount(t)&&null!==e?`,至少选${e}项${"sort"===t?"并排序":""}`:""}_normalizeAnswerItem(e){const t={...e,title:x(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect},s=e?.answerId??e?.examAnswerId;return void 0!==s&&(t.answerId=s),t}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e)))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e))),this._syncExamExpand()}_syncExamExpand(){if(!this["exam-expand"]||!this["answer-list"]?.length)return;const e=this["exam-expand"].split(","),t=this["answer-list"];this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this["search-api"]&&"function"!=typeof this["search-handler"])return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this["search-handler"])s=await this["search-handler"](e,this._searchAnswerType());else if(this["search-api"]){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this["search-api"]}${this["search-api"].includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],g(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title})),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this["custom-id"]||""})}_applyAiAnswer(){if(!this["ai-answer"]?.trim())return void g("暂无 AI 推荐答案");const e=this["ai-answer"].split(/\r?\n/).map(e=>u(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(u(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(u(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():g("未找到匹配的选项,请检查选项内容是否一致")}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||i.uid()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_emitEditResultItem(e,t){this._emit("edit-result-item",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:{...e},resultItem:e.resultItem||""})}_resultSlotName(e){return`business-result-item-${e}`}_imageResources(){return(this["resource-list"]||[]).filter(e=>1===e.resourceType).map(e=>e.resource.middle||e.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(e=>2===e.resourceType)?.resource||null}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){this.lockAnswerKey||(e.isCorrect=t,this.requestUpdate())}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this._queueSearch(this._title),this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(e,t){const s=e.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[t].title=s.value,this.requestUpdate()}_addAnswer(e){const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:i.uid()}),this._answers=t}_deleteAnswer(e){this._answers.length<3||(this._answers=this._answers.filter((t,s)=>s!==e))}_toggleSortItem(e){const t=this._orderList.indexOf(e);this._orderList=t>=0?this._orderList.filter(t=>t!==e):[...this._orderList,e],this.requestUpdate()}_removeSortItem(e){this._orderList=this._orderList.filter(t=>t!==e),this.requestUpdate()}_getSortOrder(e){const t=this._orderList.indexOf(this._label(e));return t>=0?t+1:null}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_rowMeta(){return{customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]}}_collectSnapshot(){const e=(this["is-edit"]?this._answers:this["answer-list"]||[]).map(e=>({...e,title:x(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect,resultItem:x(e?.resultItem??"")})),t=this["is-edit"]?[...this._orderList]:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();return{title:x(this["is-edit"]?this._title:this.title||""),answers:e,analysis:x(this["is-edit"]?this._analysis:this.analysis||""),leastAnswerCount:this["is-edit"]?this._leastAnswerCount:this._normalizeLeastAnswerCount(this["least-answer-count"]),selectedTagList:Array.isArray(this._selectedTagList)?[...this._selectedTagList]:[],examExpand:this["is-edit"]?t.map(e=>this._sortAnswerValue(e)).join(","):this["exam-expand"]||"",showRichText:this["is-edit"]?this._showRichText:!!this["rich-text-content"],richText:this["is-edit"]?this._richText:this["rich-text-content"]||"",orderList:t}}_validateSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;const s=this._rowMeta(),i=[];e.title||i.push(new c("题目标题不能为空!","EMPTY_TITLE","title",s));let r=!1,o=0;e.answers.forEach((e,a)=>{e.title?.trim()||i.push(new c(`选项${String.fromCharCode(65+a)}未填写`,"ANSWER_EMPTY","answers",s)),"sort"!==t&&e.isCorrect&&(r=!0,o++)});return new Set(e.answers.map(e=>e.title)).size!==e.answers.length&&e.answers.length>0&&i.push(new c("选项不能重复","DUPLICATE_ANSWERS","answers",s)),"single"===t&&o>1&&i.push(new c("此题为单选题,设置了多个推荐/正确选项,请保存时确认是否切换为多选题","SINGLE_MULTI_CORRECT","answers",s)),"multiple"===t&&(1===o&&i.push(new c("请设置至少两个推荐/正确选项","CORRECT_COUNT_INVALID","answers",s)),o>0&&(r=!0),r&&null!==e.leastAnswerCount&&o<e.leastAnswerCount&&i.push(new c("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))),"sort"===t&&(r=e.orderList.length>0,null!==e.leastAnswerCount&&e.orderList.length<e.leastAnswerCount&&i.push(new c("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","orderList",s))),{errors:i,isSetCorrectAnswer:r,correctAnswerCount:o}}_serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;const t=this._collectSnapshot(),{errors:s,isSetCorrectAnswer:i}=this._validateSnapshot(t,e);if(s.length)throw s[0];const r={answerType:String(e),examTypeEnum:String(e),title:t.title,answers:t.answers.map((e,t)=>{const s=e.resultItem?1:Array.isArray(e.answerRelations)&&e.answerRelations.length?2:null,i={...e,orderIndex:t+1,answer:e.title,relationType:s};return void 0!==e.answerId&&(i.examAnswerId=e.answerId),null===s&&delete i.relationType,i}),examExpand:t.examExpand,analysis:t.analysis,isSetCorrectAnswer:i,examRichTextContent:t.showRichText?t.richText:""};return this["exam-answer-relation-type"]&&(r.examAnswerRelationType=this["exam-answer-relation-type"]),this._supportsLeastAnswerCount(e)&&(r.leastAnswerCount=t.leastAnswerCount),this["custom-id"]&&(r.customId=this["custom-id"]),r}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async _finalizeSave(){try{const e=await this.toJSON();this._emit("save",e)}catch(e){g(e.message)}}async toJSON(){return Promise.resolve(this._serialize())}validate(){return this._validateSnapshot(this._collectSnapshot()).errors}setResultItem(e,t){e<0||e>=this._answers.length||(this._answers=this._answers.map((s,i)=>i===e?{...s,resultItem:t||""}:s),this.requestUpdate())}setAnswerRelation(e,t){e&&(this._answers=this._answers.map(s=>String(s.customAnswerId??s.answerId??"")===String(e)?{...s,answerRelations:t}:s),this.requestUpdate())}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e.html`
1
+ "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("../base/uid.cjs"),r=require("./sorting-card.cjs"),o=require("./title-prefix.cjs"),a=require("./types.cjs"),n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?l(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&n(t,s,o),o};class p extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(e),this.code=t,this.field=s,this.row=i,this.name="SubjectError"}static from(e){return new p(e.message,e.code,e.field,e.row)}}const h=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,d=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`,u=e.html`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;function x(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()[\]【】\-_/\\]+/g,"").toLowerCase()}function g(e){return String(e??"").trim()}function m(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}exports.QxsSubjectSingle=class extends e.LitElement{constructor(){super(...arguments),this["order-index"]=0,this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-set-correct-answer"]=!1,this.lockAnswerKey=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-analysis"]=!1,this.type="single",this["answer-check-type"]=1,this["exam-answer-relation-type"]=0,this["rich-text-content"]="",this.analysis="",this["least-answer-count"]=null,this["exam-expand"]="",this["custom-id"]="",this["exam-id"]=0,this["category-id"]="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["tag-list"]=[],this["category-list"]=[],this["ai-answer"]="",this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["has-jump"]=!1,this["search-api"]="",this["model-value"]="",this["use-model"]=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.title="",this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=null,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._changeTypeDialogOpen=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get"answer-list"(){return this._answers}set"answer-list"(e){if(this["is-edit"])return;const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>this._normalizeAnswerItem(e)):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answer-list")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps()}firstUpdated(){this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(e.has("title")||e.has("answer-list")||e.has("analysis")||e.has("least-answer-count")||e.has("answer-check-type")||e.has("tag-list")||e.has("category-id")||e.has("rich-text-content"))&&this._syncExternalProps(),e.has("is-key")&&(this._isKey=this["is-key"]),e.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[]),e.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):""),(e.has("exam-expand")||e.has("answer-list"))&&this._syncExamExpand(),e.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_supportsLeastAnswerCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;return"multiple"===e||"sort"===e}_normalizeLeastAnswerCount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;if(!this._supportsLeastAnswerCount(t)||""===e||null==e)return null;const s=Number(e);return Number.isFinite(s)&&s>0?s:null}_leastAnswerCountSuffix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return this._supportsLeastAnswerCount(t)&&null!==e?`,至少选${e}项${"sort"===t?"并排序":""}`:""}_normalizeAnswerItem(e){const t={...e,title:g(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect},s=e?.answerId??e?.examAnswerId;return void 0!==s&&(t.answerId=s),t}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e)))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e))),this._syncExamExpand()}_syncExamExpand(){if(!this["exam-expand"]||!this["answer-list"]?.length)return;const e=this["exam-expand"].split(","),t=this["answer-list"];this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this["search-api"]&&"function"!=typeof this["search-handler"])return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this["search-handler"])s=await this["search-handler"](e,this._searchAnswerType());else if(this["search-api"]){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this["search-api"]}${this["search-api"].includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],m(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title})),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this["custom-id"]||""})}_applyAiAnswer(){if(!this["ai-answer"]?.trim())return void m("暂无 AI 推荐答案");const e=this["ai-answer"].split(/\r?\n/).map(e=>x(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(x(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(x(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():m("未找到匹配的选项,请检查选项内容是否一致")}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||i.uid()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_emitEditResultItem(e,t){this._emit("edit-result-item",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:{...e},resultItem:e.resultItem||""})}_resultSlotName(e){return`business-result-item-${e}`}_imageResources(){return(this["resource-list"]||[]).filter(e=>1===e.resourceType).map(e=>e.resource.middle||e.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(e=>2===e.resourceType)?.resource||null}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){this.lockAnswerKey||(e.isCorrect=t,this.requestUpdate())}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this._queueSearch(this._title),this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(e,t){const s=e.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[t].title=s.value,this.requestUpdate()}_addAnswer(e){const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:i.uid()}),this._answers=t}_deleteAnswer(e){this._answers.length<3||(this._answers=this._answers.filter((t,s)=>s!==e))}_toggleSortItem(e){const t=this._orderList.indexOf(e);this._orderList=t>=0?this._orderList.filter(t=>t!==e):[...this._orderList,e],this.requestUpdate()}_removeSortItem(e){this._orderList=this._orderList.filter(t=>t!==e),this.requestUpdate()}_getSortOrder(e){const t=this._orderList.indexOf(this._label(e));return t>=0?t+1:null}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_rowMeta(){return{customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]}}_collectSnapshot(){const e=(this["is-edit"]?this._answers:this["answer-list"]||[]).map(e=>({...e,title:g(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect,resultItem:g(e?.resultItem??"")})),t=this["is-edit"]?[...this._orderList]:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();return{title:g(this["is-edit"]?this._title:this.title||""),answers:e,analysis:g(this["is-edit"]?this._analysis:this.analysis||""),leastAnswerCount:this["is-edit"]?this._leastAnswerCount:this._normalizeLeastAnswerCount(this["least-answer-count"]),selectedTagList:Array.isArray(this._selectedTagList)?[...this._selectedTagList]:[],examExpand:this["is-edit"]?t.map(e=>this._sortAnswerValue(e)).join(","):this["exam-expand"]||"",showRichText:this["is-edit"]?this._showRichText:!!this["rich-text-content"],richText:this["is-edit"]?this._richText:this["rich-text-content"]||"",orderList:t}}_validateSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;const s=this._rowMeta(),i=[];e.title||i.push(new p("题目标题不能为空!","EMPTY_TITLE","title",s));let r=!1,o=0;e.answers.forEach((e,a)=>{e.title?.trim()||i.push(new p(`选项${String.fromCharCode(65+a)}未填写`,"ANSWER_EMPTY","answers",s)),"sort"!==t&&e.isCorrect&&(r=!0,o++)});return new Set(e.answers.map(e=>e.title)).size!==e.answers.length&&e.answers.length>0&&i.push(new p("选项不能重复","DUPLICATE_ANSWERS","answers",s)),"single"===t&&o>1&&i.push(new p("此题为单选题,设置了多个推荐/正确选项,请保存时确认是否切换为多选题","SINGLE_MULTI_CORRECT","answers",s)),"multiple"===t&&(1===o&&i.push(new p("请设置至少两个推荐/正确选项","CORRECT_COUNT_INVALID","answers",s)),o>0&&(r=!0),r&&null!==e.leastAnswerCount&&o<e.leastAnswerCount&&i.push(new p("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))),"sort"===t&&(r=e.orderList.length>0,null!==e.leastAnswerCount&&e.orderList.length<e.leastAnswerCount&&i.push(new p("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","orderList",s))),{errors:i,isSetCorrectAnswer:r,correctAnswerCount:o}}_serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;const t=this._collectSnapshot(),{errors:s,isSetCorrectAnswer:i}=this._validateSnapshot(t,e);if(s.length)throw s[0];const r={answerType:String(e),examTypeEnum:String(e),title:t.title,answers:t.answers.map((e,t)=>{const s=e.resultItem?1:Array.isArray(e.answerRelations)&&e.answerRelations.length?2:null,i={...e,orderIndex:t+1,answer:e.title,relationType:s};return void 0!==e.answerId&&(i.examAnswerId=e.answerId),null===s&&delete i.relationType,i}),examExpand:t.examExpand,analysis:t.analysis,isSetCorrectAnswer:i,examRichTextContent:t.showRichText?t.richText:""};return this["exam-answer-relation-type"]&&(r.examAnswerRelationType=this["exam-answer-relation-type"]),this._supportsLeastAnswerCount(e)&&(r.leastAnswerCount=t.leastAnswerCount),this["custom-id"]&&(r.customId=this["custom-id"]),r}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async _finalizeSave(){try{const e=await this.toJSON();this._emit("save",e)}catch(e){m(e.message)}}async toJSON(){return Promise.resolve(this._serialize())}validate(){return this._validateSnapshot(this._collectSnapshot()).errors}setResultItem(e,t){e<0||e>=this._answers.length||(this._answers=this._answers.map((s,i)=>i===e?{...s,resultItem:t||""}:s),this.requestUpdate())}setAnswerRelation(e,t){e&&(this._answers=this._answers.map(s=>String(s.customAnswerId??s.answerId??"")===String(e)?{...s,answerRelations:t}:s),this.requestUpdate())}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e.html`
2
2
  <div class="modal-backdrop" @click=${()=>{this._correctHintDialogOpen=!1}}>
3
3
  <div class="modal correct-hint-dialog" @click=${e=>e.stopPropagation()}>
4
4
  <div class="modal-header">
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  <div class="modal-footer">
29
29
  <button @click=${()=>{this._changeTypeDialogOpen=!1}}>取消</button>
30
- <button class="primary" @click=${()=>{try{const e=this._serialize("multiple");this._changeTypeDialogOpen=!1,this._emit("save",e)}catch(e){g(e?.message||"保存失败")}}}>切换</button>
30
+ <button class="primary" @click=${()=>{try{const e=this._serialize("multiple");this._changeTypeDialogOpen=!1,this._emit("save",e)}catch(e){m(e?.message||"保存失败")}}}>切换</button>
31
31
  </div>
32
32
  </div>
33
33
  </div>
@@ -120,9 +120,9 @@
120
120
  </div>
121
121
  </div>
122
122
  </div>
123
- `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate(),s=t.find(e=>"SINGLE_MULTI_CORRECT"===e.code),i=t.filter(e=>"SINGLE_MULTI_CORRECT"!==e.code);i.length?g(i[0].message):s?this._changeTypeDialogOpen=!0:this._hasShownCorrectHint||!this._shouldShowCorrectHint()?await this._finalizeSave():this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this._leastAnswerCountSuffix(this._normalizeLeastAnswerCount(this["least-answer-count"]))})`,s=this["answer-list"];return e.html`
123
+ `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate(),s=t.find(e=>"SINGLE_MULTI_CORRECT"===e.code),i=t.filter(e=>"SINGLE_MULTI_CORRECT"!==e.code);i.length?m(i[0].message):s?this._changeTypeDialogOpen=!0:this._hasShownCorrectHint||!this._shouldShowCorrectHint()?await this._finalizeSave():this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this._leastAnswerCountSuffix(this._normalizeLeastAnswerCount(this["least-answer-count"]))})`,s=this["answer-list"],i=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}.`),this.title||"");return e.html`
124
124
  <div class="preview">
125
- <div><span class="title">${this["order-index"]+1}.${this.title||""}${t}</span></div>
125
+ <div><span class="title">${i}${t}</span></div>
126
126
  ${this["show-rich-text"]&&this["rich-text-content"]?e.html`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
127
127
  <div class="preview-answer">
128
128
  ${s.map((t,s)=>e.html`
@@ -138,7 +138,7 @@
138
138
  ${this["show-category"]&&this._categoryId?e.html`<div class="section-row"><span class="value-text">分类:${this["category-list"].find(e=>String(e.categoryId)===String(this._categoryId))?.title||this._categoryId}</span></div>`:""}
139
139
  ${this["show-resource"]?this._renderResourceSection():""}
140
140
  </div>
141
- `}_renderSorting(){const e=x(this["is-edit"]?this._title:this.title||"")||"未命名题目",t=`${this["order-index"]+1}. ${e}`;return r.renderSortingCard(t,o.SubjectTypeLabel[this.type]||this.type)}_renderEdit(){return e.html`
141
+ `}_renderSorting(){const e=g(this["is-edit"]?this._title:this.title||"")||"未命名题目",t=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}. `),e);return r.renderSortingCard(t,a.SubjectTypeLabel[this.type]||this.type)}_renderEdit(){return e.html`
142
142
  <div class="flex-items-start">
143
143
  <div class="label"><span>题目:</span></div>
144
144
  <div style="flex:1">
@@ -190,11 +190,11 @@
190
190
 
191
191
  <span class="icon"
192
192
  @click=${()=>this._addAnswer(s)}>
193
- ${p}
193
+ ${h}
194
194
  </span>
195
195
  <span class="icon ${this._answers.length<3?"disabled":""}"
196
196
  @click=${()=>this._deleteAnswer(s)}>
197
- ${h}
197
+ ${d}
198
198
  </span>
199
199
 
200
200
  ${1===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`
@@ -228,7 +228,7 @@
228
228
  <span class="tag-close" @click=${e=>{this.lockAnswerKey||(e.stopPropagation(),this._removeSortItem(t))}}>&#x2715;</span>
229
229
  </span>
230
230
  `):e.html`<span class="placeholder">请按顺序选择排序答案</span>`}
231
- <span class="arrow">${d}</span>
231
+ <span class="arrow">${u}</span>
232
232
  </div>
233
233
  ${this._sortDropdownOpen?e.html`
234
234
  <div class="multi-select-dropdown">
@@ -527,5 +527,5 @@
527
527
  font-size: 14px;
528
528
  border-radius: 4px;
529
529
  }
530
- `],l([t.property({type:Number,attribute:"order-index"})],exports.QxsSubjectSingle.prototype,"order-index",2),l([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectSingle.prototype,"is-edit",2),l([t.property({type:Boolean,attribute:"is-save"})],exports.QxsSubjectSingle.prototype,"is-save",2),l([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectSingle.prototype,"is-set",2),l([t.property({type:Boolean,attribute:"is-set-correct-answer"})],exports.QxsSubjectSingle.prototype,"is-set-correct-answer",2),l([t.property({type:Boolean,attribute:"lock-answer-key"})],exports.QxsSubjectSingle.prototype,"lockAnswerKey",2),l([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectSingle.prototype,"is-key",2),l([t.property({type:Boolean,attribute:"show-action"})],exports.QxsSubjectSingle.prototype,"show-action",2),l([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectSingle.prototype,"show-add",2),l([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectSingle.prototype,"hide-add-rich-text",2),l([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectSingle.prototype,"show-rich-text",2),l([t.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsSubjectSingle.prototype,"show-delete-action",2),l([t.property({type:Boolean,attribute:"show-save-action"})],exports.QxsSubjectSingle.prototype,"show-save-action",2),l([t.property({type:Boolean,reflect:!0})],exports.QxsSubjectSingle.prototype,"sorting",2),l([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectSingle.prototype,"show-answer-setting",2),l([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectSingle.prototype,"show-key",2),l([t.property({type:Boolean,attribute:"show-analysis"})],exports.QxsSubjectSingle.prototype,"show-analysis",2),l([t.property({attribute:"question-type",reflect:!0})],exports.QxsSubjectSingle.prototype,"type",2),l([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectSingle.prototype,"answer-check-type",2),l([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectSingle.prototype,"exam-answer-relation-type",2),l([t.property({type:String,attribute:"rich-text-content"})],exports.QxsSubjectSingle.prototype,"rich-text-content",2),l([t.property({type:String})],exports.QxsSubjectSingle.prototype,"analysis",2),l([t.property({type:Number,attribute:"least-answer-count"})],exports.QxsSubjectSingle.prototype,"least-answer-count",2),l([t.property({type:String,attribute:"exam-expand"})],exports.QxsSubjectSingle.prototype,"exam-expand",2),l([t.property({type:String,attribute:"custom-id"})],exports.QxsSubjectSingle.prototype,"custom-id",2),l([t.property({type:Number,attribute:"exam-id"})],exports.QxsSubjectSingle.prototype,"exam-id",2),l([t.property({type:String,attribute:"category-id"})],exports.QxsSubjectSingle.prototype,"category-id",2),l([t.property({type:Object,attribute:"upload-image"})],exports.QxsSubjectSingle.prototype,"upload-image",2),l([t.property({type:Array,attribute:"answer-list"})],exports.QxsSubjectSingle.prototype,"answer-list",1),l([t.property({type:Array,attribute:"tag-list"})],exports.QxsSubjectSingle.prototype,"tag-list",2),l([t.property({type:Array,attribute:"category-list"})],exports.QxsSubjectSingle.prototype,"category-list",2),l([t.property({type:String,attribute:"ai-answer"})],exports.QxsSubjectSingle.prototype,"ai-answer",2),l([t.property({type:Array,attribute:"resource-list"})],exports.QxsSubjectSingle.prototype,"resource-list",2),l([t.property({type:Boolean,attribute:"show-tag"})],exports.QxsSubjectSingle.prototype,"show-tag",2),l([t.property({type:Boolean,attribute:"show-category"})],exports.QxsSubjectSingle.prototype,"show-category",2),l([t.property({type:Boolean,attribute:"show-ai"})],exports.QxsSubjectSingle.prototype,"show-ai",2),l([t.property({type:Boolean,attribute:"show-resource"})],exports.QxsSubjectSingle.prototype,"show-resource",2),l([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectSingle.prototype,"show-jump",2),l([t.property({type:Boolean,attribute:"has-jump"})],exports.QxsSubjectSingle.prototype,"has-jump",2),l([t.property({type:String,attribute:"search-api"})],exports.QxsSubjectSingle.prototype,"search-api",2),l([t.property({type:Object,attribute:"search-handler"})],exports.QxsSubjectSingle.prototype,"search-handler",2),l([t.property({type:String,attribute:"model-value"})],exports.QxsSubjectSingle.prototype,"model-value",2),l([t.property({type:Boolean,attribute:"use-model"})],exports.QxsSubjectSingle.prototype,"use-model",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_answers",2),l([t.property({type:String})],exports.QxsSubjectSingle.prototype,"title",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_title",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_analysis",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_richText",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_showRichText",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_leastAnswerCount",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_answerCheckType",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_isKey",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_orderList",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_selectedTagList",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_categoryId",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_searchResults",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_searchOpen",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_searchLoading",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_sortDropdownOpen",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerOpen",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerIndex",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_videoViewerOpen",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_correctHintDialogOpen",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_hasShownCorrectHint",2),l([t.state()],exports.QxsSubjectSingle.prototype,"_changeTypeDialogOpen",2),exports.QxsSubjectSingle=l([s.safeCustomElement("qxs-subject-single")],exports.QxsSubjectSingle),exports.SubjectError=c,exports.trimCommaSeparatedText=function(e){return String(e??"").split(",").map(e=>e.trim()).filter(Boolean).join(",")},exports.trimText=x;
530
+ `],c([t.property({type:Number,attribute:"order-index"})],exports.QxsSubjectSingle.prototype,"order-index",2),c([t.property({type:String,attribute:"subject-prefix"})],exports.QxsSubjectSingle.prototype,"subject-prefix",2),c([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectSingle.prototype,"is-edit",2),c([t.property({type:Boolean,attribute:"is-save"})],exports.QxsSubjectSingle.prototype,"is-save",2),c([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectSingle.prototype,"is-set",2),c([t.property({type:Boolean,attribute:"is-set-correct-answer"})],exports.QxsSubjectSingle.prototype,"is-set-correct-answer",2),c([t.property({type:Boolean,attribute:"lock-answer-key"})],exports.QxsSubjectSingle.prototype,"lockAnswerKey",2),c([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectSingle.prototype,"is-key",2),c([t.property({type:Boolean,attribute:"show-action"})],exports.QxsSubjectSingle.prototype,"show-action",2),c([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectSingle.prototype,"show-add",2),c([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectSingle.prototype,"hide-add-rich-text",2),c([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectSingle.prototype,"show-rich-text",2),c([t.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsSubjectSingle.prototype,"show-delete-action",2),c([t.property({type:Boolean,attribute:"show-save-action"})],exports.QxsSubjectSingle.prototype,"show-save-action",2),c([t.property({type:Boolean,reflect:!0})],exports.QxsSubjectSingle.prototype,"sorting",2),c([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectSingle.prototype,"show-answer-setting",2),c([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectSingle.prototype,"show-key",2),c([t.property({type:Boolean,attribute:"show-analysis"})],exports.QxsSubjectSingle.prototype,"show-analysis",2),c([t.property({attribute:"question-type",reflect:!0})],exports.QxsSubjectSingle.prototype,"type",2),c([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectSingle.prototype,"answer-check-type",2),c([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectSingle.prototype,"exam-answer-relation-type",2),c([t.property({type:String,attribute:"rich-text-content"})],exports.QxsSubjectSingle.prototype,"rich-text-content",2),c([t.property({type:String})],exports.QxsSubjectSingle.prototype,"analysis",2),c([t.property({type:Number,attribute:"least-answer-count"})],exports.QxsSubjectSingle.prototype,"least-answer-count",2),c([t.property({type:String,attribute:"exam-expand"})],exports.QxsSubjectSingle.prototype,"exam-expand",2),c([t.property({type:String,attribute:"custom-id"})],exports.QxsSubjectSingle.prototype,"custom-id",2),c([t.property({type:Number,attribute:"exam-id"})],exports.QxsSubjectSingle.prototype,"exam-id",2),c([t.property({type:String,attribute:"category-id"})],exports.QxsSubjectSingle.prototype,"category-id",2),c([t.property({type:Object,attribute:"upload-image"})],exports.QxsSubjectSingle.prototype,"upload-image",2),c([t.property({type:Array,attribute:"answer-list"})],exports.QxsSubjectSingle.prototype,"answer-list",1),c([t.property({type:Array,attribute:"tag-list"})],exports.QxsSubjectSingle.prototype,"tag-list",2),c([t.property({type:Array,attribute:"category-list"})],exports.QxsSubjectSingle.prototype,"category-list",2),c([t.property({type:String,attribute:"ai-answer"})],exports.QxsSubjectSingle.prototype,"ai-answer",2),c([t.property({type:Array,attribute:"resource-list"})],exports.QxsSubjectSingle.prototype,"resource-list",2),c([t.property({type:Boolean,attribute:"show-tag"})],exports.QxsSubjectSingle.prototype,"show-tag",2),c([t.property({type:Boolean,attribute:"show-category"})],exports.QxsSubjectSingle.prototype,"show-category",2),c([t.property({type:Boolean,attribute:"show-ai"})],exports.QxsSubjectSingle.prototype,"show-ai",2),c([t.property({type:Boolean,attribute:"show-resource"})],exports.QxsSubjectSingle.prototype,"show-resource",2),c([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectSingle.prototype,"show-jump",2),c([t.property({type:Boolean,attribute:"has-jump"})],exports.QxsSubjectSingle.prototype,"has-jump",2),c([t.property({type:String,attribute:"search-api"})],exports.QxsSubjectSingle.prototype,"search-api",2),c([t.property({type:Object,attribute:"search-handler"})],exports.QxsSubjectSingle.prototype,"search-handler",2),c([t.property({type:String,attribute:"model-value"})],exports.QxsSubjectSingle.prototype,"model-value",2),c([t.property({type:Boolean,attribute:"use-model"})],exports.QxsSubjectSingle.prototype,"use-model",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_answers",2),c([t.property({type:String})],exports.QxsSubjectSingle.prototype,"title",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_title",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_analysis",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_richText",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_showRichText",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_leastAnswerCount",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_answerCheckType",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_isKey",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_orderList",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_selectedTagList",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_categoryId",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchResults",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchLoading",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_sortDropdownOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerIndex",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_videoViewerOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_correctHintDialogOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_hasShownCorrectHint",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_changeTypeDialogOpen",2),exports.QxsSubjectSingle=c([s.safeCustomElement("qxs-subject-single")],exports.QxsSubjectSingle),exports.SubjectError=p,exports.trimCommaSeparatedText=function(e){return String(e??"").split(",").map(e=>e.trim()).filter(Boolean).join(",")},exports.trimText=g;
531
531
  //# sourceMappingURL=single.cjs.map