ul-question-test-ui 1.0.25 → 1.0.26

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.
@@ -451,4 +451,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
451
451
  `,We+=Ne+`
452
452
  `,We+=Ae[1]+`
453
453
  `,We+=Ae[0]+`
454
- `,We+="UNSIGNED-PAYLOAD",pe+="X-Amz-Signature="+qt(Of(me,ke,this.sk,this.region,We)),{ActualSignedRequestHeaders:oe,SignedUrl:(this.isSecure?"https":"http")+"://"+ge+":"+this.port+pe}},st.prototype.createPostSignatureSync=function(y){var T=y.signatureContext||this.signatureContext;if(T.signature==="v4")return this.createV4PostSignatureSync(y);var R=(y=y||{}).Bucket?String(y.Bucket):null,j=y.Key?String(y.Key):null,X=y.Expires?parseInt(y.Expires,10):300,G={};if(y.FormParams&&y.FormParams instanceof Object&&!(y.FormParams instanceof Array))for(var U in y.FormParams)({}).hasOwnProperty.call(y.FormParams,U)&&(G[U]=y.FormParams[U]);this.securityToken&&!G[T.headerPrefix+"security-token"]&&(G[T.headerPrefix+"security-token"]=this.securityToken);var oe=new Date;oe.setTime(parseInt(new Date().getTime(),10)+1e3*X),oe=Lf(oe.toUTCString()),R&&(G.bucket=R),j&&(G.key=j);var ie=[];ie.push('{"expiration":"'),ie.push(oe),ie.push('", "conditions":[');var le=!0,ve=!0,pe=["acl","bucket","key","success_action_redirect","redirect","success_action_status"];for(var de in G)if(de){var ge=G[de];(de=String(de).toLowerCase())==="bucket"?le=!1:de==="key"&&(ve=!1),jt.indexOf(de)<0&&pe.indexOf(de)<0&&de.indexOf(T.headerPrefix)!==0||(ie.push('{"'),ie.push(de),ie.push('":"'),ie.push(ge!==null?String(ge):""),ie.push('"},'))}le&&ie.push('["starts-with", "$bucket", ""],'),ve&&ie.push('["starts-with", "$key", ""],'),ie.push("]}");var we=ie.join("");ie=window.btoa?window.btoa(we):_o.encode(we);var me=Je("sha1",this.sk).update(ie).digest("base64");return{OriginPolicy:we,Policy:ie,Signature:me,Token:this.ak+":"+me+":"+ie}},st.prototype.createV4PostSignatureSync=function(y){var T=(y=y||{}).signatureContext||this.signatureContext,R=y.Bucket?String(y.Bucket):null,j=y.Key?String(y.Key):null,X=y.Expires?parseInt(y.Expires,10):300,G={};if(y.FormParams&&y.FormParams instanceof Object&&!(y.FormParams instanceof Array))for(var U in y.FormParams)({}).hasOwnProperty.call(y.FormParams,U)&&(G[U]=y.FormParams[U]);this.securityToken&&!G[T.headerPrefix+"security-token"]&&(G[T.headerPrefix+"security-token"]=this.securityToken);var oe=dc(new Date().toUTCString()),ie=oe[0],le=oe[1],ve=this.ak+"/"+ie+"/"+this.region+"/s3/aws4_request",pe=new Date;pe.setTime(parseInt(new Date().getTime(),10)+1e3*X),pe=Lf(pe.toUTCString()),G["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",G["X-Amz-Date"]=le,G["X-Amz-Credential"]=ve,R&&(G.bucket=R),j&&(G.key=j);var de=[];de.push('{"expiration":"'),de.push(pe),de.push('", "conditions":[');var ge=!0,we=!0,me=["acl","bucket","key","success_action_redirect","redirect","success_action_status"];for(var ke in G)if(ke){var Ae=G[ke];(ke=String(ke).toLowerCase())==="bucket"?ge=!1:ke==="key"&&(we=!1),jt.indexOf(ke)<0&&me.indexOf(ke)<0&&ke.indexOf(T.headerPrefix)!==0||(de.push('{"'),de.push(ke),de.push('":"'),de.push(Ae!==null?String(Ae):""),de.push('"},'))}ge&&de.push('["starts-with", "$bucket", ""],'),we&&de.push('["starts-with", "$key", ""],'),de.push("]}");var Me=de.join("");de=window.btoa?window.btoa(Me):_o.encode(Me);var $e=Nf(ie,this.sk,this.region,de);return{OriginPolicy:Me,Policy:de,Algorithm:G["X-Amz-Algorithm"],Credential:G["X-Amz-Credential"],Date:G["X-Amz-Date"],Signature:$e}};var Ik=st,Df=Number.MAX_VALUE;function Td(){this.consoleLog=window.console,this._level=Df}Td.prototype.setLevel=function(y){y&&(y=(y=String(y).toLowerCase())==="info"?20:y==="warn"?30:y==="error"?40:y==="debug"?10:Df,this._level=y)},Td.prototype.runLog=function(y,T,R){if(y){var j=[new Date().toLocaleString(),y.toLowerCase(),T,R].join("|");y.toLowerCase()==="debug"&&this._level<=10?this.consoleLog.debug(j):y.toLowerCase()==="info"&&this._level<=20?this.consoleLog.info(j):y.toLowerCase()==="warn"&&this._level<=30?this.consoleLog.warn(j):y.toLowerCase()==="error"&&this._level<=40&&this.consoleLog.error(j)}};var Nk=Td,Ok=u(1062),Dk=u.t(Ok,2),Bf=function(y){return Object.prototype.toString.call(y)==="[object String]"&&y.lastIndexOf("/")!==y.length-1&&(y+="/"),y},Bk={extend:function(y){y.prototype.dropFile=function(T,R){this.deleteObject(T,R)},y.prototype.dropFolder=function(T,R){var j=this;T=T||{};var X=(function(de,ge,we){de=de||function(){};var me=new Date().getTime();return function(ke,Ae){return ge.runLog("info","dropFolder","ObsClient cost "+(new Date().getTime()-me)+" ms"),Object.prototype.toString.call(ke)==="[object String]"?de(new Error(ke),Ae):de(ke,Ae)}})(R,j.log),G=(function(de){return de=de||function(){},function(ge,we,me){return Object.prototype.toString.call(me)==="[object Error]"?de(ge,we,me):Object.prototype.toString.call(me)==="[object String]"?de(ge,we,new Error(me)):me?me.CommonMsg.Status>300?de(ge,we,new Error("status:"+me.CommonMsg.Status+", code:"+me.CommonMsg.Code+", message:"+me.CommonMsg.Message)):void de(ge,we,me):void 0}})(T.EventCallback),U=T.TaskNum||1,oe=0,ie=[],le=function(de,ge,we,me){if(me)return ge.finished++,void we(ge);var ke=function(){oe++,j.dropFile({Bucket:ge.bucket,Key:de},function(Ae,Me){oe--,ge.finished++,(function(){for(;oe<U&&ie.length>0;)ie.shift()()})(),Ae?(G("dropFileFailed",de,Ae),ge.subDeleted=!1):Me.CommonMsg.Status>=300?(G("dropFileFailed",de,Me),ge.subDeleted=!1):G("dropFileSucceed",de,Me),we(ge)})};oe<U?ke():ie.push(ke)},ve=function(de,ge,we){return function(me){!me.isTruncated&&me.finished===me.total&&me.subDeleted&&le(de,ge,we,!1)}},pe=Bf(T.Prefix);(function de(ge,we,me,ke,Ae){oe++,j.listObjects({Bucket:we,Prefix:me,Delimiter:"/",Marker:ke},function(Me,$e){if(oe--,Me)return X(Me);if($e.CommonMsg.Status>=300)return X(null,$e);if(ge.total+=$e.InterfaceResult.Contents.length,ge.total+=$e.InterfaceResult.CommonPrefixes.length,ge.total!==0){ge.isTruncated=$e.InterfaceResult.IsTruncated==="true";for(var Le=function(Ze){return function(){de({total:0,finished:0,isTruncated:!1,bucket:we,subDeleted:!0},we,Ze,null,ve(Ze,ge,Ae))}},ze=0;ze<$e.InterfaceResult.CommonPrefixes.length;ze++){var Ne=Bf($e.InterfaceResult.CommonPrefixes[ze].Prefix);oe<U?de({total:0,finished:0,isTruncated:!1,bucket:we,subDeleted:!0},we,Ne,null,ve(Ne,ge,Ae)):ie.push(Le(Ne))}for(var Ve=0;Ve<$e.InterfaceResult.Contents.length;Ve++){var We=$e.InterfaceResult.Contents[Ve].Key;le(We,ge,Ae,We.lastIndexOf("/")===We.length-1)}ge.isTruncated&&(oe<U?de(ge,we,me,$e.InterfaceResult.NextMarker,Ae):ie.push(function(){de(ge,we,me,$e.InterfaceResult.NextMarker,Ae)}))}else Ae(ge)})})({total:0,finished:0,isTruncated:!1,bucket:T.Bucket,subDeleted:!0},T.Bucket,pe,null,function(de){if(!de.isTruncated&&de.finished===de.total)if(de.subDeleted)j.dropFile({Bucket:de.bucket,Key:pe},function(we,me){return we?(G("dropFileFailed",pe,we),X(we)):me.CommonMsg.Status>=300?(G("dropFileFailed",pe,me),X(null,me)):(G("dropFileSucceed",pe,me),X(null,me))});else{var ge="drop folder "+pe+" failed due to child file deletion failed";G("dropFileFailed",pe,new Error(ge)),X(ge)}})}}},qk=Bk,kd=5368709120,pc=function(y){var T=[];if(T.push(y.bucket),T.push(y.key),T.push(y.sourceFile.name),T.push(String(y.partSize)),T.push(String(y.partCount)),T.push(String(y.fileStat.fileSize)),T.push(String(y.fileStat.lastModified)),y.uploadId&&T.push(y.uploadId),y.sseC&&T.push(y.sseC),y.sseCKey&&T.push(y.sseCKey),y.parts)for(var R=0;R<y.parts.length;R++){var j=y.parts[R];j&&(T.push(String(j.partNumber)),T.push(String(j.offset)),T.push(String(j.partSize)),T.push(String(j.isCompleted)),j.etag&&T.push(String(j.etag)))}return window.btoa(Bn()(T.join(""),!1,!0))},Cd=function(y,T,R){y&&y.uploadId&&R.abortMultipartUpload({Bucket:y.bucket,Key:y.key,RequestDate:y.requestDate,UploadId:y.uploadId},function(j,X){j?R.log.runLog("warn",T,"abort multipart upload failed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId+", err:"+j):X.CommonMsg.Status>=300?R.log.runLog("warn",T,"abort multipart upload failed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId+", status:"+X.CommonMsg.Status+", code:"+X.CommonMsg.Code+", message:"+X.CommonMsg.Message):(delete y.uploadId,R.log.runLog("warn",T,"abort multipart upload succeed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId))})},qf=function(y){if(!(y.finishedCount<y.uploadCheckpoint.partCount)){if(y.isAbort)return Cd(y.uploadCheckpoint,y.funcName,y.that),y.callback("uploadFile failed the upload task is aborted");if(y.isSuspend)return y.callback("the process of uploadFile is suspened, you can retry with the uploadCheckpoint");if(y.hasError)return y.callback("uploadFile finished with error, you can retry with the uploadCheckpoint");for(var T=[],R=0;R<y.uploadCheckpoint.partCount;R++){var j=y.uploadCheckpoint.parts[R];T.push({PartNumber:j.partNumber,ETag:j.etag})}y.that.completeMultipartUpload({Bucket:y.uploadCheckpoint.bucket,Key:y.uploadCheckpoint.key,RequestDate:y.uploadCheckpoint.requestDate,UploadId:y.uploadCheckpoint.uploadId,Parts:T,CallbackUrl:y.callbackUrl,CallbackHost:y.callbackHost,CallbackBody:y.callbackBody,CallbackBodyType:y.callbackBodyType},function(X,G){var U={bucket:y.uploadCheckpoint.bucket,key:y.uploadCheckpoint.key,uploadId:y.uploadCheckpoint.uploadId};return X?(y.eventCallback("completeMultipartUploadFailed",U,X),y.callback(X)):G.CommonMsg.Status>=500?(y.eventCallback("completeMultipartUploadFailed",U,G),y.callback(null,G)):G.CommonMsg.Status>=300&&G.CommonMsg.Status<500?(y.eventCallback("completeMultipartUploadAborted",U,G),Cd(y.uploadCheckpoint,y.funcName,y.that),y.callback(null,G)):(y.eventCallback("completeMultipartUploadSucceed",U,G),void y.callback(null,G))})}},Ff=function(y){y.resumeCallback({cancel:function(){y.isSuspend=!0;for(var oe=0;oe<y.uploadPartParams.length;oe++){var ie=y.uploadPartParams[oe].cancelHook;le=ie,Object.prototype.toString.call(le)==="[object Function]"&&ie()}var le}},y.uploadCheckpoint);var T=[],R=function(){for(;y.runningTask<y.taskNum&&T.length>0;)T.shift()();T.length===0&&qf(y)},j=window.btoa?window.btoa:_o.encode,X=function(oe){return function(){if(y.runningTask++,y.isSuspend||y.isAbort)return y.runningTask--,y.finishedCount++,y.finishedCount+=T.length,T=[],R();var ie,le,ve,pe,de=0,ge=function(ke){if(!de){de=1;var Ae,Me={Bucket:y.uploadCheckpoint.bucket,Key:y.uploadCheckpoint.key,RequestDate:y.uploadCheckpoint.requestDate,PartNumber:oe.partNumber,UploadId:y.uploadCheckpoint.uploadId,SourceFile:y.uploadCheckpoint.sourceFile,Offset:oe.offset,PartSize:oe.partSize,SseC:y.uploadCheckpoint.sseC,SseCKey:y.uploadCheckpoint.sseCKey,ProgressCallback:(Ae=oe.partNumber,function($e,Le,ze){y.progressCallback(Ae,$e)}),ContentMD5:ke};y.uploadPartParams.push(Me),y.that.uploadPart(Me,function($e,Le){if(y.runningTask--,y.finishedCount++,y.isSuspend)return R();var ze={partNumber:oe.partNumber,bucket:y.uploadCheckpoint.bucket,key:y.uploadCheckpoint.key,uploadId:y.uploadCheckpoint.uploadId};$e?(y.eventCallback("uploadPartFailed",ze,$e),y.hasError=!0):Le.CommonMsg.Status>=500||Le.CommonMsg.Status===400&&Le.CommonMsg.Code==="BadDigest"?(y.eventCallback("uploadPartFailed",ze,Le),y.hasError=!0):Le.CommonMsg.Status>=300&&Le.CommonMsg.Status<500?(y.isAbort=!0,y.hasError=!0,y.eventCallback("uploadPartAborted",ze,Le)):(oe.etag=Le.InterfaceResult.ETag,oe.isCompleted=!0,ze.etag=oe.etag,y.uploadCheckpoint.md5=pc(y.uploadCheckpoint),y.eventCallback("uploadPartSucceed",ze,Le),y.that.log.runLog("debug",y.funcName,"Part "+String(oe.partNumber)+" is finished, uploadId "+y.uploadCheckpoint.uploadId)),R()})}};if(y.verifyMd5&&window.FileReader&&(y.uploadCheckpoint.sourceFile instanceof window.File||y.uploadCheckpoint.sourceFile instanceof window.Blob)){var we=(ie=y.uploadCheckpoint.sourceFile,le=oe.offset,ve=oe.offset+oe.partSize,pe=pe||ie.type,ie.mozSlice?ie.mozSlice(le,ve,pe):ie.webkitSlice?ie.webkitSlice(le,ve,pe):ie.slice(le,ve,pe)),me=new window.FileReader;return me.onload=function(ke){var Ae=(function($e){$e=new Uint8Array($e);for(var Le,ze=0;ze<$e.length;){var Ne=ze+16384;Ne=Ne<=$e.length?Ne:$e.length,Le?Le+=String.fromCharCode.apply(null,$e.slice(ze,Ne)):Le=String.fromCharCode.apply(null,$e.slice(ze,Ne)),ze=Ne}return $e=null,Le})(ke.target.result),Me=j(Bn()(Ae,!1,!0));Ae=null,ge(Me)},me.onerror=function(ke){y.that.log.runLog("error",y.funcName,"Caculate md5 for part "+String(oe.partNumber)+" failed"),ge()},void me.readAsArrayBuffer(we)}ge()}};if(!y.isSuspend){for(var G=0;G<y.uploadCheckpoint.partCount;G++){var U=y.uploadCheckpoint.parts[G];U.isCompleted?(y.finishedCount++,y.finishedBytes+=U.partSize):T.push(X(U))}return T.length===0?qf(y):R()}y.callback("the process of uploadFile is suspened, you can retry with the uploadCheckpoint")},Fk={extend:function(y){y.prototype.uploadFile=function(T,R){var j=this;T=T||{};var X="uploadFile",G=(function(Ne,Ve,We){Ne=Ne||function(){};var Ze=new Date().getTime();return function(bt,wt){return Ve.runLog("info","uploadFile","ObsClient cost "+(new Date().getTime()-Ze)+" ms"),Object.prototype.toString.call(bt)==="[object String]"?Ne(new Error(bt),wt):Ne(bt,wt)}})(R,j.log),U=(function(Ne){return Ne=Ne||function(){},function(Ve,We,Ze){return Object.prototype.toString.call(Ze)==="[object Error]"?Ne(Ve,We,Ze):Object.prototype.toString.call(Ze)==="[object String]"?Ne(Ve,We,new Error(Ze)):Ze?Ze.CommonMsg.Status>300?Ne(Ve,We,new Error("status:"+Ze.CommonMsg.Status+", code:"+Ze.CommonMsg.Code+", message:"+Ze.CommonMsg.Message)):void Ne(Ve,We,Ze):void 0}})(T.EventCallback),oe=T.TaskNum||1,ie=T.ProgressCallback||function(){},le=T.ResumeCallback||function(){},ve=T.VerifyMd5||!1;j.log.runLog("info",X,"enter uploadFile...");var pe=null;if(T.UploadCheckpoint&&T.UploadCheckpoint.sourceFile&&T.UploadCheckpoint.fileStat&&T.UploadCheckpoint.uploadId&&T.UploadCheckpoint.md5===pc(T.UploadCheckpoint)?pe=T.UploadCheckpoint:Cd(T.UploadCheckpoint,X,j),pe){var de=pe.sourceFile;if(!(de instanceof window.File||de instanceof window.Blob))return G("source file is not valid, must be an instanceof [File | Blob]");if(!de.mozSlice&&!de.webkitSlice&&!de.slice)return G("your browser cannot support the slice method for [File | Blob]")}else{var ge=T.SourceFile;if(!(ge instanceof window.File||ge instanceof window.Blob))return G("source file is not valid, must be an instanceof [File | Blob]");if(!ge.mozSlice&&!ge.webkitSlice&&!ge.slice)return G("your browser cannot support the slice method for [File | Blob]");j.log.runLog("debug",X,"Begin to uploadFile to OBS from file:"+ge.name);var we=ge.size,me=parseInt(T.PartSize,10),ke=0,Ae=[];if(we===0)me=0,ke=1,Ae.push({partNumber:1,offset:0,partSize:0,isCompleted:!1});else{if(me=isNaN(me)||me<102400?9437184:me>kd?kd:me,(ke=Math.floor(we/me))>=1e4&&(me=Math.floor(we/1e4),we%1e4!=0&&(me+=1),ke=Math.floor(we/me)),me>kd)return G("The source file "+ge.name+" is too large");var Me=we%me;Me!==0&&ke++;for(var $e=0;$e<ke;$e++)Ae.push({partNumber:$e+1,offset:$e*me,partSize:me,isCompleted:!1});Me!==0&&(Ae[ke-1].partSize=Me)}j.log.runLog("debug",X,"Total parts count "+ke),(pe={bucket:T.Bucket,key:T.Key,sourceFile:ge,partSize:me,partCount:ke,parts:Ae}).fileStat={fileSize:we,lastModified:ge.lastModified},T.SseC&&T.SseCKey&&(pe.sseC=T.SseC,pe.sseCKey=T.SseCKey),pe.md5=pc(pe)}pe.requestDate=T.RequestDate;var Le={start:new Date().getTime(),uploadCheckpoint:pe,funcName:X,taskNum:oe,callback:G,that:j,runningTask:0,finishedCount:0,hasError:!1,finishedBytes:0,isAbort:!1,resumeCallback:le,isSuspend:!1,partsLoaded:{},requestDate:T.RequestDate,uploadPartParams:[],verifyMd5:ve,callbackUrl:T.CallbackUrl,callbackHost:T.CallbackHost,callbackBody:T.CallbackBody,callbackBodyType:T.CallbackBodyType,eventCallback:function(Ne,Ve,We){Le.isSuspend||U(Ne,Ve,We)},progressCallback:function(Ne,Ve){Le.isSuspend||(Le.finishedBytes+=Ve,Le.partsLoaded[Ne]&&(Le.finishedBytes-=Le.partsLoaded[Ne]),Le.partsLoaded[Ne]=Ve,ie(Le.finishedBytes,Le.uploadCheckpoint.fileStat.fileSize,(new Date().getTime()-Le.start)/1e3))}};if(!pe.uploadId){var ze=T.ContentType;return!ze&&pe.key&&(ze=j.util.mimeTypes[pe.key.substring(pe.key.lastIndexOf(".")+1)]),!ze&&pe.sourceFile.name&&(ze=j.util.mimeTypes[pe.sourceFile.name.substring(pe.sourceFile.name.lastIndexOf(".")+1)]),void j.initiateMultipartUpload({Bucket:T.Bucket,Key:T.Key,RequestDate:T.RequestDate,ACL:T.ACL,Metadata:T.Metadata,WebsiteRedirectLocation:T.WebsiteRedirectLocation,StorageClass:T.StorageClass,ContentType:ze,Expires:T.Expires,SseKms:T.SseKms,SseKmsKey:T.SseKmsKey,SseC:T.SseC,SseCKey:T.SseCKey},function(Ne,Ve){var We={bucket:T.Bucket,key:T.Key};if(Ne)return Le.eventCallback("initiateMultipartUploadFailed",We,Ne),G(Ne);if(Ve.CommonMsg.Status>=300)return Le.eventCallback("initiateMultipartUploadFailed",We,Ve),G(null,Ve);var Ze=Ve.InterfaceResult.UploadId;pe.uploadId=Ze,pe.md5=pc(pe),Le.uploadCheckpoint=pe,We.uploadId=Ze,j.log.runLog("info",X,"Claim a new upload id "+Ze),Le.eventCallback("initiateMultipartUploadSucceed",We,Ve),Ff(Le)})}Ff(Le)}}},Rk=Fk;function Fe(y){this.factory(y)}function Rf(y){return y.slice(0,1).toUpperCase()+y.slice(1)}var jf=["createBucket","listBuckets","getBucketMetadata","headBucket","deleteBucket","setBucketQuota","getBucketQuota","getBucketStorageInfo","setBucketPolicy","getBucketPolicy","deleteBucketPolicy","setBucketVersioningConfiguration","getBucketVersioningConfiguration","putBackToSource","deleteBackToSource","getBackToSource","getBucketLocation","listVersions","listObjects","setBucketLifecycleConfiguration","getBucketLifecycleConfiguration","deleteBucketLifecycleConfiguration","setBucketAcl","getBucketAcl","setBucketLoggingConfiguration","getBucketLoggingConfiguration","setBucketWebsiteConfiguration","getBucketWebsiteConfiguration","deleteBucketWebsiteConfiguration","setBucketNotification","getBucketNotification","setBucketTagging","getBucketTagging","deleteBucketTagging","getBucketCors","deleteBucketCors","setBucketStoragePolicy","getBucketStoragePolicy","getObject","getObjectMetadata","setObjectMetadata","setObjectAcl","getObjectAcl","deleteObject","deleteObjects","listMultipartUploads","listParts","abortMultipartUpload","completeMultipartUpload","getBucketInventory","setBucketInventory","deleteBucketInventory","getBucketEncryption","setBucketEncryption","deleteBucketEncryption","getBucketRequesterPay","setBucketRequesterPay","setMirrorBackToSource","getMirrorBackToSource","deleteMirrorBackToSource","getWorkflowTrigger","deleteWorkflowTrigger","createWorkflowTrigger","restoreFailedWorkflowExecution","createTemplate","createWorkflow","getWorkflowList","deleteWorkflow","getWorkflowTemplateList","getWorkflowInstanceList","deleteTemplate","updateWorkflow","getActionTemplates","getWorkflowAuthorization","openWorkflowAuthorization","getBucketDirectColdAccess","setBucketDirectColdAccess","deleteBucketDirectColdAccess","getBucketCustomDomain","setBucketCustomDomain","deleteBucketCustomDomain","setBucketCors","getBucketReplication","setBucketReplication","deleteBucketReplication","getCDNNotifyConfiguration","setCdnNotifyConfiguration","getQuota","getBucketDisPolicy","setBucketDisPolicy","deleteBucketDisPolicy","createOnlineDecom","getOnlineDecom","getWorkflowAgreements","openWorkflowAgreements","deleteOnlineDecom","getMyActionTemplates","createMyActionTemplate","getMyactiontemplateDetail","updateMyActionTemplate","deleteMyActionTemplate","forbidMyActionTemplate","updatePublicActionTemplate","getOmPublicActionTemplates","setSFSAcl","getSFSAcl","deleteSFSAcl","setBucketAlias","bindBucketAlias","unbindBucketAlias","deleteBucketAlias","listBucketsAlias","getBucketAlias"];function jk(y){return function(T,R){this.exec(Rf(y),T,R)}}for(var Ad=0;Ad<jf.length;Ad++){var zf=jf[Ad];Fe.prototype[zf]=jk(zf)}function Sd(y){return Object.prototype.toString.call(y)==="[object Function]"}function zk(y){return function(T,R){if(Sd(T))y.call(this,null,T);else{if(!Sd(R)){var j=this;return new Promise(function(X,G){y.call(j,T,function(U,oe){if(U)return G(U);X(oe)})})}y.call(this,T,R)}}}if(Fe.prototype.createTemplate=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("CreateTemplate",y,T)},Fe.prototype.createWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("CreateWorkflow",y,T)},Fe.prototype.restoreFailedWorkflowExecution=function(y,T){y.ApiPath="v2/workflowexecutions",this.exec("RestoreFailedWorkflowExecution",y,T)},Fe.prototype.getWorkflowList=function(y,T){y.ApiPath="v2/workflows",this.exec("GetWorkflowList",y,T)},Fe.prototype.deleteWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("DeleteWorkflow",y,T)},Fe.prototype.deleteTemplate=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("DeleteTemplate",y,T)},Fe.prototype.getWorkflowTemplateList=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("GetWorkflowTemplateList",y,T)},Fe.prototype.getWorkflowInstanceList=function(y,T){y.ApiPath="v2/workflowexecutions",this.exec("GetWorkflowInstanceList",y,T)},Fe.prototype.updateWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("UpdateWorkflow",y,T)},Fe.prototype.getActionTemplates=function(y,T){y.ApiPath="v2/actiontemplates",this.exec("GetActionTemplates",y,T)},Fe.prototype.getWorkflowAuthorization=function(y,T){y.ApiPath="v2/workflow-authorization",this.exec("GetWorkflowAuthorization",y,T)},Fe.prototype.openWorkflowAuthorization=function(y,T){y.ApiPath="v2/workflow-authorization",this.exec("OpenWorkflowAuthorization",y,T)},Fe.prototype.getPublicationTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/publicactiontemplates",this.exec("GetPublicationTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.getPublicationTemplateDetail=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/publicactiontemplates",this.exec("GetPublicationTemplateDetail",y,T),this.util.pathStyle=!1},Fe.prototype.getWorkflowAgreements=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/workflow-agreements",this.exec("GetWorkflowAgreements",y,T),this.util.pathStyle=!1},Fe.prototype.openWorkflowAgreements=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/workflow-agreements",this.exec("OpenWorkflowAgreements",y,T),this.util.pathStyle=!1},Fe.prototype.createMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("CreateMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.getMyActionTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("GetMyActionTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.getMyactiontemplateDetail=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("GetMyactiontemplateDetail",y,T),this.util.pathStyle=!1},Fe.prototype.updateMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("UpdateMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.deleteMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("DeleteMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.forbidMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("ForbidMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.updatePublicActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/ompublicactiontemplates",this.exec("UpdatePublicActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.getOmPublicActionTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/ompublicactiontemplates",this.exec("GetOmPublicActionTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.putObject=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time,please specify one of eigther a string or file to be send!";return this.log.runLog("error","PutObject",R),T(new Error(R),null)}if(!("ContentType"in y)&&("Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),!y.ContentType&&"SourceFile"in y)){var j=y.SourceFile.name;y.ContentType=this.util.mimeTypes[j.substring(j.lastIndexOf(".")+1)]}this.exec("PutObject",y,T)},Fe.prototype.appendObject=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time,please specify one of eigther a string or file to be send!";return this.log.isLevelEnabled("error")&&this.log.runLog("error","PutObject",R),T(new Error(R),null)}"ContentType"in y||("Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),!y.ContentType&&"SourceFile"in y&&(y.ContentType=this.util.mimeTypes[y.SourceFile.substring(y.SourceFile.lastIndexOf(".")+1)])),this.exec("AppendObject",y,T)},Fe.prototype.copyObject=function(y,T){var R="CopySource";if(R in y){var j=y[R],X=j.lastIndexOf("?versionId=");y[R]=X>0?this.util.encodeURIWithSafe(j.slice(0,X))+j.slice(X):this.util.encodeURIWithSafe(j)}this.exec("CopyObject",y,T)},Fe.prototype.copyPart=function(y,T){var R="CopySource";if(R in y){var j=y[R],X=j.lastIndexOf("?versionId=");y[R]=X>0?this.util.encodeURIWithSafe(j.slice(0,X))+j.slice(X):this.util.encodeURIWithSafe(j)}this.exec("CopyPart",y,T)},Fe.prototype.restoreObject=function(y,T){this.exec("RestoreObject",y,function(R,j){!R&&j.InterfaceResult&&j.CommonMsg.Status<300&&(j.InterfaceResult.RestoreStatus=j.CommonMsg.Status===200?"AVALIABLE":"INPROGRESS"),T(R,j)})},Fe.prototype.initiateMultipartUpload=function(y,T){"ContentType"in y||"Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),this.exec("InitiateMultipartUpload",y,T)},Fe.prototype.uploadPart=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time, please specify one of eigther a string or file to be send!";return this.log.runLog("error","UploadPart",R),T(new Error(R),null)}this.exec("UploadPart",y,T)},qk.extend(Fe),Rk.extend(Fe),Sd(Promise)){for(var Ed in Fe.prototype)if({}.hasOwnProperty.call(Fe.prototype,Ed)){var Uk=Fe.prototype[Ed];Fe.prototype[Ed]=zk(Uk)}}for(var $d in Fe.prototype.exec=function(y,T,R){var j=this.log;j.runLog("info",y,"enter "+y+"...");var X=new Date().getTime();T=T||{},R=R||function(){},this.util.exec(y,T,function G(U,oe){G.$called||(G.$called=!0,!U||U instanceof Error||(U=new Error(U)),j.runLog("debug",y,"ObsClient cost "+(new Date().getTime()-X)+" ms"),R(U,oe))})},Fe.prototype.initLog=function(y){y=y||{},this.log.setLevel(y.level);var T=["[OBS SDK Version="+this.util.obsSdkVersion];if(this.util.server){var R=this.util.port?":"+this.util.port:"";T.push("Endpoint="+(this.util.is_secure?"https":"http")+"://"+this.util.server+R)}T.push("Access Mode="+(this.util.path_style?"Path":"Virtual Hosting")+"]"),this.log.runLog("warn","init",T.join("];["))},Fe.prototype.factory=function(y){this.log=new Nk,this.util=new Ik(this.log),y=y||{},this.util.initFactory(y.access_key_id,y.secret_access_key,y.is_secure,y.server,y.path_style,y.signature,y.region,y.port,y.timeout,y.security_token,y.is_signature_negotiation,y.is_cname,y.url_prefix,y.region_domains,y.setRequestHeaderHook,y.useRawXhr)},Fe.prototype.refresh=function(y,T,R){this.util.refresh(y,T,R)},Fe.prototype.createSignedUrlSync=function(y){return this.util.createSignedUrlSync(y)},Fe.prototype.createV2SignedUrlSync=function(y){return this.util.createV2SignedUrlSync(y)},Fe.prototype.createV4SignedUrlSync=function(y){return this.util.createV4SignedUrlSync(y)},Fe.prototype.createPostSignatureSync=function(y){return this.util.createPostSignatureSync(y)},Fe.prototype.createV4PostSignatureSync=function(y){return this.util.createV4PostSignatureSync(y)},Fe.prototype.enums=Dk,Fe.prototype)({}).hasOwnProperty.call(Fe.prototype,$d)&&(Fe.prototype[Rf($d)]=Fe.prototype[$d]);for(var Ks in Fe.prototype)if({}.hasOwnProperty.call(Fe.prototype,Ks)){var Pd=Ks.indexOf("Configuration");Pd>0&&Pd+13===Ks.length&&(Fe.prototype[Ks.slice(0,Pd)]=Fe.prototype[Ks])}var Vk=Fe})(),m.default})()}).call(this,r(5),r(4).Buffer)},function(n,o,r){var i="";i=r(6);var a={document:"doc,docx,xls,xlsx,ppt,pptx,pdf,txt,epub,pps,psd,xmind,dwg",image:"png,jpg,gif,jpeg,bmp",video:"mp4,avi,wmv,rm,rmvb,mpeg,mpg,mkv,mov,flv",audio:"mp3,wav,wma",zip:"zip,rar,7z",flash:"swf",srt:"srt",favico:"ico"},l=["document","image","video","audio","zip","flash","srt"];function s(d,u,m){if(d.indexOf(u)>-1){var h=new RegExp("("+u+"=)([^&]*)","gi");d=d.replace(h,u+"="+m)}else{var p=u+"="+m,v=d.indexOf("?");v<0?d+="?":v>=0&&v!=d.length-1&&(d+="&"),d+=p}return d}function c(d){d=d||{},this.multiple=!!d.multiple,this.maxSize=d.maxSize||512,this.fileTypes=d.fileTypes&&d.fileTypes.length>0?d.fileTypes:l,this.exts=d.exts||"",this.accetp="",this.mode=d.mode||"huawei",this.files=[],this.$trigger="",this.uptokenHost=d.uptokenHost||"https://courseapi.tongshike.cn",this.obsHost=d.obsHost||"",this.m3u8=d.m3u8,this.authorization=d.authorization,this.obsSign=d.obsSign,this.config=d.config||{},this.putExtra=d.putExtra||{},this.config.uphost||(this.config.uphost=""),this.obsHost&&this.obsHost.charAt(this.obsHost.length-1)=="/"&&(this.obsHost=this.obsHost.substring(0,this.obsHost.length-1))}c.prototype.initUpBtn=function(d){this.$trigger=d;var u=this,m=[];if(this.fileTypes.length>0)for(var h=0;h<this.fileTypes.length;h++){var p=this.fileTypes[h];m.push(a[p])}for(m=m.join(","),this.exts&&(m=this.exts),m=m.split(","),h=0;h<m.length;h++)m[h]="."+m[h];this.accetp=m.join(","),this.$el=document.createElement("input"),this.$el.style.display="none",this.$el.type="file",this.multiple&&this.$el.setAttribute("multiple",!0),this.$el.accept=this.accetp,document.body.appendChild(this.$el),this.$el.onchange=function(){this.files.length>0&&(u.handleFileChange(this.files),u.$el.value="")},this.$trigger.onclick=function(){u.$el.click()}},c.prototype.handleFileChange=function(d){this.uploadFiles(d)},c.prototype.uploadFiles=function(d){for(var u=0;u<d.length;u++){var m=d[u];if(m.ext=m.name.substring(m.name.lastIndexOf(".")).toLowerCase(),m.key="resources/web/"+Date.now()+Math.round(1e4*Math.random())+m.ext,m.percent=0,this.accetp.indexOf(m.ext)===-1)return this.error(m,{code:50001,msg:"不支持该类型文件"});if(1024*this.maxSize*1024<m.size)return this.error(m,{code:50002,msg:"文件不能超过"+this.maxSize+"mb"});this.onBeforeUpload&&this.onBeforeUpload(m),this.startUpload(m)}},c.prototype.startUpload=function(d){var u=this;switch(u.files.push(d),this.mode){case"qiniu":u.getToken(d,function(m){u.qiniuUploadByToken(d,m)});break;case"huawei":d.ext=d.ext||d.name.substring(d.name.lastIndexOf(".")),d.key=d.key||"resources/web/"+Date.now()+Math.round(1e4*Math.random())+d.ext,u.getObsClient(d.key,function(){u.putObject(d)})}},c.prototype.qiniuUploadByToken=function(d,u){var m=this;d.obsHost=m.obsHost,d.size>4194304&&(m.config.chunkSize=5);var h="".upload(d,d.key,u,m.putExtra,m.config);d.subscription=h.subscribe({next:function(p){m.onProgress&&m.onProgress(d,p.total.percent),d.onProgress&&d.onProgress(p.total.percent)},error:function(p){m.error(d,{code:50071,msg:"上传失败",err:p})},complete:function(p){d.duration=p.duration,d.key=p.key,m.success(d)}})},c.prototype.putObject=function(d){var u=this;this.obsClient.putObject({Bucket:u.obsClientConfig.bucket,Key:d.key,Metadata:{property:"property-value"},SourceFile:d,ProgressCallback:function(m,h,p){var v=Math.floor(100*m/h);v=v>99?99:v,d.percent=v,u.onProgress&&u.onProgress(d,v),d.onProgress&&d.onProgress(v)}}).then(function(m){if(console.log(m),m.CommonMsg.Status<300){d.obsHost=u.obsHost,d.ext.toLowerCase().includes("wma")&&(d.originKey=d.key,d.key=d.key.substring(0,d.key.lastIndexOf("."))+".mp3",u.hwAudioTranscoding(d)),d.ext.toLowerCase().includes("mp3")&&u.hwMp3Transcoding(d),d.ext.substring(1).toLowerCase();var h=u.getFileType(d.key);h=="video"?(u.m3u8&&(d.m3u8Key="resources/web/"+Date.now()+Math.round(1e4*Math.random())+".m3u8"),u.hwVideoTranscoding(d)):h=="audio"?u.getHuaweiMetadata(d.originKey||d.key,function(p){d.duration=p.duration,u.success(d)}):u.success(d)}}).catch(function(m){u.error(d,{code:50081,msg:"上传失败",err:m})})},c.prototype.download=function(d,u){var m=d.substring(d.lastIndexOf("/")+1);if(d.indexOf("?")>-1){var h=d.substring(0,d.lastIndexOf("?"));m=h.substring(h.lastIndexOf("/")+1)}u=u||m,this.mode=="qiniu"?this.qiniuDownload(d,u):this.huaweiDownload(d,u)},c.prototype.getDownloadUrl=function(d,u,m){var h=d.substring(d.lastIndexOf("/")+1);if(d.indexOf("?")>-1){var p=d.substring(0,d.lastIndexOf("?"));h=p.substring(p.lastIndexOf("/")+1)}u=u||h,this.mode=="qiniu"?m(s(d,"attname",u)):this.getHuaweiDownloadUrl(d,u,m)},c.prototype.getHuaweiDownloadUrl=function(d,u,m){var h=this,p=d.replace(/^(http|https):\/\/[^/]+\//,"");this.getDownloadObsClient(p,function(){h.getFileType(p)=="video"&&(p=p.substring(0,p.lastIndexOf("."))+".mp4",u=u.substring(0,u.lastIndexOf("."))+".mp4");var v=h.obsClient.createSignedUrlSync({Method:"GET",Bucket:h.obsClientConfig.bucket,Key:p,QueryParams:{"response-content-disposition":"attachment;fileName="+encodeURIComponent(u)},Expires:3600});m(v.SignedUrl)})},c.prototype.qiniuDownload=function(d,u){var m=s(d,"attname",u);window.open(m)},c.prototype.huaweiDownload=function(d,u){this.getHuaweiDownloadUrl(d,u,function(m){var h=document.createElement("a");h.style.display="none",h.href=m,document.body.appendChild(h),h.click()})},c.prototype.cancelUpload=function(d){switch(this.mode){case"qiniu":d.subscription.unsubscribe()}},c.prototype.error=function(d,u){this.onError&&this.onError(d,u),d&&d.onError&&d.onError(u)},c.prototype.success=function(d){d.isSuccessCalled||(d.percent=100,this.onProgress&&this.onProgress(d,100),d.onProgress&&d.onProgress(100),this.onSuccess&&this.onSuccess(d),d.onSuccess&&d.onSuccess(d),d.isSuccessCalled=!0)},c.prototype.getToken=function(d,u){var m=this;d.name&&d.name!=""||(d.name=String(new Date().getTime()+d.ext));var h=this.uptokenHost+"/files/getUptoken?fileName="+encodeURIComponent(d.name),p=new XMLHttpRequest;p.open("get",h),p.setRequestHeader("AUTHORIZATION",this.authorization),p.onreadystatechange=function(){if(p.readyState===4)if(p.status===200){var v=JSON.parse(p.responseText).uptoken;u&&u(v)}else m.error(d,{code:50070,msg:"上传失败"})},p.send(),console.log(p)},c.prototype.getObsClient=function(d,u){var m=this,h=this.uptokenHost+"/obs/uploadToken",p=new XMLHttpRequest;this.obsSign&&(h=this.uptokenHost+"/obs/uploadToken/sign"),p.open("get",h+"?path="+d,!0),this.obsSign?p.setRequestHeader("obsSign",this.obsSign):p.setRequestHeader("authorization",this.authorization),p.onreadystatechange=function(){m.getObsConfigCb(p,u)},p.send()},c.prototype.getDownloadObsClient=function(d,u){var m=this,h=this.uptokenHost+"/obs/downloadToken",p=new XMLHttpRequest;p.open("get",h+"?path="+d,!0),p.onreadystatechange=function(){m.getObsConfigCb(p,u)},p.send()},c.prototype.getObsConfigCb=function(d,u){if(d.readyState===4)if(d.status===200){var m=JSON.parse(d.responseText);m.code==1?(this.obsClientConfig=m.result,this.obsClient=new i({access_key_id:m.result.ak,secret_access_key:m.result.sk,security_token:m.result.securitytoken,server:m.result.endpoint,timeout:1800}),this.obsHost=this.obsClientConfig.domain,u&&u()):this.error("",{code:50080,msg:"上传失败"})}else this.error("",{code:50080,msg:"上传失败"})},c.prototype.getObjectData=function(d,u,m){var h=this;this.getDownloadObsClient(d,function(){h.obsClient.getObject({Bucket:h.obsClientConfig.bucket,Key:d},function(p,v){p?(console.error("Error-->"+p),m&&m(p)):v.CommonMsg.Status==200&&v.InterfaceResult&&u&&u(v.InterfaceResult)})})},c.prototype.dataURLtoBlob=function(d){for(var u=d.split(","),m=u[0].match(/:(.*?);/)[1],h=atob(u[1]),p=h.length,v=new Uint8Array(p);p--;)v[p]=h.charCodeAt(p);return new Blob([v],{type:m})},c.prototype.hwVideoTranscoding=function(d){var u=this,m=d.key.substring(d.key.indexOf("resources/")),h=m.substring(m.lastIndexOf("/")+1);h=h.substring(0,h.lastIndexOf("."));var p=this.uptokenHost+"/obs/transcoding/video/multi?path="+m,v=[{outputFileName:h,outputFormat:"mp4"}];if(this.m3u8){var f=d.m3u8Key.substring(d.m3u8Key.lastIndexOf("/")+1);f=f.substring(0,f.lastIndexOf(".")),v.push({outputFileName:f,outputFormat:"m3u8"})}var b=new XMLHttpRequest;b.onreadystatechange=function(){if(b.readyState===4){var x=JSON.parse(b.responseText);x.code==1?u.getVideoMetadata(d,function(){u.success(d)},function(){var w=setInterval(function(){console.log(Date.now()),u.getMediaLength(d.key,function(E){d.duration=E,u.success(d),clearInterval(w)})},3e3)}):x.code==2?(d.m3u8Key="",u.success(d)):x.code==0?u.error(d,{code:50082,msg:"文件编码格式无法解析,请尝试转码成mp4后再上传。"}):u.error(d,{code:50081,msg:"上传失败"})}},b.open("POST",p,!0),b.setRequestHeader("Content-Type","application/json"),b.send(JSON.stringify(v))},c.prototype.hwAudioTranscoding=function(d){if(d.ext.toLowerCase().includes("wma")){var u=d.key.substring(0,d.key.lastIndexOf("."))+d.ext,m=u.substring(u.lastIndexOf("/")+1);m=m.substring(0,m.lastIndexOf("."));var h=this.uptokenHost+"/obs/transcoding/audio?path="+u+"&outputFileName="+m,p=new XMLHttpRequest;p.onreadystatechange=function(){if(p.readyState===4){var v=JSON.parse(p.responseText);console.log(v)}},p.open("POST",h,!0),p.setRequestHeader("Content-Type","application/json"),p.send()}},c.prototype.hwMp3Transcoding=function(d){var u=this.uptokenHost+"/obs/transcoding/mp3?path="+d.key,m=new XMLHttpRequest;m.onreadystatechange=function(){if(m.readyState===4){var h=JSON.parse(m.responseText);console.log(h)}},m.open("POST",u,!0),m.setRequestHeader("authorization",this.authorization),m.setRequestHeader("Content-Type","application/json"),m.send()},c.prototype.getFileType=function(d){var u=d.substring(d.lastIndexOf(".")+1).toLowerCase();for(var m in a)if(a[m].includes(u))return m;return""},c.prototype.getVideoMetadata=function(d,u,m){var h=document.createElement("video");h.src=URL.createObjectURL(d),h.addEventListener("loadedmetadata",function(){console.log(h),h.duration!=1/0?(d.duration=h.duration,u&&u()):m&&m()}),h.addEventListener("error",function(p){console.log(p),m&&m()})},c.prototype.getHuaweiMetadata=function(d,u){var m=this.uptokenHost+"/obs/video/info?path="+d,h=new XMLHttpRequest;h.open("GET",m,!0),h.onreadystatechange=function(){if(h.readyState===4){var p=JSON.parse(h.responseText);p.code==1&&u&&u(p.result)}},h.send()},c.prototype.getMediaLength=function(d,u){var m=this.uptokenHost+"/obs/video/length?path="+d,h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState===4){var p=JSON.parse(h.responseText);p.code==1&&u&&u(p.result)}},h.open("GET",m,!0),h.send()},n.exports=c}])})})(Sp)),Sp.exports}var Yin=Win();const Pk=Ym(Yin),Xin=Ce.defineComponent({name:"FileList",components:{Preview:Gin,TinyBaseSelect:cs,TinyOption:Hi,TinyDialogBox:Qr,TinyButton:Pt},props:{list:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},type:{type:String,default:"block"},isPreview:{type:Boolean,default:!0},isShowLimitTimes:{type:Boolean,default:!0},canPreview:{type:Boolean,default:!0},editorble:{type:Boolean,default:!1},showDownLoad:{type:Boolean,default:!0},isQuestionBank:{type:Boolean,default:!1},hideFullScreen:{type:Boolean,default:!1},customFullSreen:{type:Boolean,default:!0},audioMode:{type:String,default:"bar"},isMobile:{type:Boolean,default:!1},audioTime:{type:Number,default:0},actionIndex:{type:Number,default:0}},setup(t,{emit:e}){const n=lc(),o=Ce.ref(!1),r=Ce.reactive({item:{},index:0});return{...Ce.reactive({obs:{},currentFile:{},playerTimes:[-1,1,2,3,4,5]}),t:n,fileIcon:Ain,getFileSvg:Tin,formatSize:Cin,cancelUpload:(h,p)=>{h.cancel&&h.cancel(),e("deleteFile",h,p)},deleteFile:(h,p)=>{r.item=h,r.index=p,o.value=!0},download:h=>{new Pk(t.uploadOptions).download(h)},showPreview:h=>{},isFileCanPreview:h=>{const p=ta(h.fileUrl);return["audio","video","image","document"].includes(p)},isAudio:h=>ta(h.fileUrl)==="audio",boxVisibility:o,curDeleteFile:r,deleteConfirm:()=>{e("deleteFile",r.item,r.index),o.value=!1}}}});var Zin=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"files-component"},[e.list&&e.list.length>0&&e.type==="block"?n("ul",{staticClass:"file-list-block"},e._l(e.list,function(o,r){return n("li",{key:r+o.fileUrl+o.fileKey},[!e.isPreview||o.status===1||o.status===3?[n("div",{staticClass:"icon-wrapper"},[n("img",{staticClass:"svg-img",attrs:{src:e.getFileSvg(o.fileUrl),alt:""}})]),n("div",{staticClass:"detail"},[n("div",{staticClass:"name"},[e._v(e._s(o.fileName))]),n("div",{staticClass:"info"},[n("span",{staticClass:"size"},[e._v(e._s(e.formatSize(o.fileSize)))]),e.mode==="edit"&&o.progress>=0&&o.progress<100&&o.status!==3?n("div",{staticClass:"progress-wrapper"},[n("div",{staticClass:"progress-bar"},[n("div",{staticClass:"bar",style:{width:o.progress+"%"}})]),n("span",{staticClass:"progress-value"},[e._v(e._s(o.progress)+"%")]),n("span",{staticClass:"cancel",on:{click:function(i){return e.cancelUpload(o,r)}}},[e._v(e._s(e.t("cancel")))])]):n("div",{staticClass:"operations"},[o.status===3?n("span",{staticClass:"upload-fail"},[e._v(e._s(o.errMessage))]):e._e(),e.mode==="edit"?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return i.stopPropagation(),e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")]):e._e()])])])]:e.isPreview&&o.status!==3?n("div",{staticClass:"preview-container"},[n("div",{staticClass:"preview-content",class:{"audio-preview":e.isAudio(o)}},[n("Preview",{attrs:{resource:o,times:e.isShowLimitTimes?o.lisCount:0,"is-question-bank":e.isQuestionBank,showDownLoad:e.showDownLoad,customFullSreen:e.customFullSreen,audioMode:e.audioMode,isMobile:e.isMobile,audioTime:e.audioTime}}),e.mode==="edit"?n("div",{staticClass:"operations"},[n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return i.stopPropagation(),e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")])]):e._e()],1)]):e._e()],2)}),0):e._e(),e.list&&e.list.length>0&&e.type==="inline"?n("div",[n("ul",{staticClass:"file-list-inline"},e._l(e.list,function(o,r){return n("li",{key:r},[n("img",{staticClass:"svg-img",attrs:{src:e.getFileSvg(o.fileUrl),alt:""}}),n("span",{staticClass:"name"},[e._v(e._s(o.fileName))]),n("span",{staticClass:"size"},[e._v(e._s(e.formatSize(o.fileSize)))]),e.mode==="edit"&&o.progress>=0&&o.progress<100?n("div",{staticClass:"progress-wrapper"},[n("div",{staticClass:"progress-bar"},[n("div",{staticClass:"bar",style:{width:o.progress+"%"}})]),n("span",{staticClass:"progress-value"},[e._v(e._s(o.progress)+"%")]),n("span",{staticClass:"cancel",on:{click:function(i){return e.cancelUpload(o,r)}}},[e._v(e._s(e.t("cancel")))])]):e._e(),e.canPreview&&e.isFileCanPreview(o)&&o.status!==3?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.showPreview(o)}}},[e._v(" "+e._s(e.t("view"))+" ")]):e._e(),o.status===3?n("span",{staticClass:"upload-fail"},[e._v(e._s(o.errMessage))]):e._e(),e.mode==="edit"?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")]):n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.download(o.fileUrl)}}},[e._v(" "+e._s(e.t("download"))+" ")])])}),0)]):e._e(),n("TinyDialogBox",{attrs:{title:e.t("messageTip"),width:"40%","append-to-body":!0},scopedSlots:e._u([{key:"footer",fn:function(){return[n("TinyButton",{on:{click:function(o){e.boxVisibility=!1}}},[e._v(e._s(e.t("cancel")))]),n("TinyButton",{attrs:{type:"primary"},on:{click:e.deleteConfirm}},[e._v(e._s(e.t("confirm")))])]},proxy:!0}]),model:{value:e.boxVisibility,callback:function(o){e.boxVisibility=o},expression:"boxVisibility"}},[n("span",[e._v(e._s(e.t("confirmDelete")))])])],1)},Jin=[],ean=Nn(Xin,Zin,Jin,!1,null,"8204fcc8");const cc=ean.exports,tan={obsHost:Sk,uptokenHost:Kae,authorization:eo.get("token")||eo.get("authorization")};class nan{constructor({id:e=0,fileName:n="",fileSize:o="",fileType:r="",fileUrl:i="",srt:a="",avatar:l="",lisCount:s=-1,progress:c=0,status:d=0,markedImage:u="",angle:m=0,location:h,title:p,contentSize:v,type:f}){this.id=e||Bu(),this.fileName=n||p,this.fileSize=o||v,this.fileType=r||f,this.fileUrl=i||h,this.srt=a,this.avatar=l||"",this.lisCount=s,this.progress=c,this.status=d,this.markedImage=u,this.angle=m}handleOldAttach(e){let n={contentSize:e.contentSize||e.fileSize,title:e.title||e.fileName,location:e.location||e.fileUrl,duration:e.duration||0},o="";return n.location&&n.location.length>0&&(o=n.location.substring(n.location.lastIndexOf(".")+1).toLowerCase()),n.mimeType=e.mimeType||o,n.type=e.type||ta(n.location),{...e,...n}}}const oan=Ce.defineComponent({name:"RichTextarea",components:{TinyFluentEditor:fs,FileList:cc,TinyDialogBox:Qr,TinyButton:Pt},model:{prop:"value",event:"change"},props:{value:String,list:{type:Array,default(){return[]}},maxNum:{type:Number,default:1},isShowLimitTimes:{type:Boolean,default:!0},actionIndex:{type:Number,default:0},placeholderText:{type:String,default:""},isQuestionBank:{type:Boolean,default:!1},type:{type:Number,default:0}},emits:["change","addFile","deleteFile"],setup(t,{emit:e}){const n=Ce.ref(null),o=Ce.ref(t.value||""),r=Ce.ref(null),i=Ce.ref(Bu()),a=Ce.ref(!1),l=Ce.computed(()=>"formula/index.html");Ce.onMounted(()=>{const v=r.value.state.quill.getModule("toolbar");n.value=new Pk({...tan});const f=document.getElementById(`upload-${i.value}`);n.value.initUpBtn(f),n.value.onBeforeUpload=b=>{let x=new nan({fileName:b.name,fileSize:b.size,fileUrl:b.name,status:1,lisCount:-1}),w=ta(x.fileUrl);b.onProgress=E=>{x.progress=gm(E,2,"floor")},b.onSuccess=()=>{x.fileUrl=b.obsHost+"/"+b.key,x.status=2,w=="image"&&c(`<img src="${x.fileUrl}" devui-editorx-image="true" data-image-id=${x.key} />`)},b.onError=E=>{x.errMessage=Sin(E.code),x.status=3},x.cancel=()=>{n.value.cancelUpload(b)},x.key=Bu(),w!="image"&&e("addFile",x,t.actionIndex)},v.addHandler("image1",function(b){n.value.$el.accept=Cp(["image"]),f.click()}),v.addHandler("video1",function(b){n.value.$el.accept=Cp(["video"]),f.click()}),v.addHandler("audio",function(b){n.value.$el.accept=Cp(["audio"]),f.click()}),v.addHandler("math",function(b){a.value=!0})}),Ce.onUnmounted(()=>{var p;(p=n.value)!=null&&p.$el&&n.value.$el.parentNode&&n.value.$el.parentNode.removeChild(n.value.$el)});const s=()=>{var b;const f=`\\(${((b=document.querySelector(".math-dialog iframe").contentWindow.document.getElementById("formulaTextarea"))==null?void 0:b.value)||""}\\)`;c(f),a.value=!1},c=p=>{if(!r.value)return;const v=r.value.state.quill,f=v.getSelection(),b=f?f.index:0;v.clipboard.dangerouslyPasteHTML(b,p);const x=new DOMParser().parseFromString(p,"text/html").body.textContent.length;v.setSelection(b+x)};Ce.watch(o,(p,v)=>{if(t.type==3){const f=/\s*\(\s*\)\s*/g;p=p.replace(f,"(&nbsp;)")}e("change",p)});const d=Ce.ref({placeholder:t.placeholderText,modules:{toolbar:[[{font:["yahei","songti","kaiti","heiti","lishu","mono","arial","arialblack","comic","impact","times"]},{size:["12px","13px","14px","15px","16px","17px","18px","19px","20px","22px","24px","26px","29px","32px","36px","40px","48px","72px"]},{lineheight:["1","1.2","1.5","2","2.5","3","4","5"]}],["bold","italic","underline","strike",{color:[]},{background:[]},{list:"ordered"},{list:"bullet"},{align:[]},{script:"sub"},{script:"super"},"image1","audio","video1","math","better-table"]]}});return{content:o,initSrtUploder:(p,v)=>{const f=document.getElementById(p);f&&(console.log("字幕上传按钮已找到",f),f.onclick=()=>{console.warn("字幕上传功能暂时不可用")})},deleteFile:(p,v)=>{e("deleteFile",v,t.actionIndex)},options:d,fluentEditorRef:r,insertContent:c,beforeEditorInit:p=>{const v='<svg t="1734490908682" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5918" width="200" height="200"><path d="M1084.416 32c52.288 0 95.296 40.064 99.84 91.136l0.448 9.152v764.288c0 52.288-40.064 95.232-91.136 99.84l-9.152 0.448H132.288a100.288 100.288 0 0 1-99.84-91.2L32 896.64V132.288c0-52.288 40.064-95.296 91.136-99.84L132.288 32h952.128z m-221.568 474.24l-223.808 167.872 87.936 62.336a41.216 41.216 0 0 1 12.992 51.584l-3.392 5.76a41.216 41.216 0 0 1-51.584 12.928l-5.76-3.392-275.2-196.096-290.112 201.856v87.488c0 8.768 5.952 16 14.08 17.92l4.288 0.448h952.128c8.832 0 16-5.952 17.92-14.08l0.448-4.288 3.136-176.448-2.688-1.472a35.2 35.2 0 0 1-4.672-2.944L862.848 506.24z m221.568-392.32H132.288a18.176 18.176 0 0 0-17.92 14.08l-0.448 4.288v579.712l266.368-188.608a40.32 40.32 0 0 1 41.792-3.392l5.376 3.392 141.888 100.928 271.104-203.392a41.28 41.28 0 0 1 46.784-1.792l4.992 3.84 210.56 187.008V132.288a18.176 18.176 0 0 0-14.08-17.92l-4.288-0.448z m-703.296 51.2a144 144 0 1 1-0.128 288.128 144 144 0 0 1 0.128-288.128z m0 69.12c-41.472 0-74.88 33.408-74.88 74.88 0 41.472 33.408 74.88 74.88 74.88 41.472 0 74.88-33.408 74.88-74.88 0-41.472-33.408-74.88-74.88-74.88z" fill-rule="nonzero"></path></svg>',f='<svg t="1734490908682" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5918" width="200" height="200"><path d="M992 705.6c-4.992 26.88-14.528 50.88-28.8 72.064-12.032 18.368-30.08 35.008-54.272 49.856-24.128 14.784-56.768 22.208-97.92 22.208-27.008 0-52.48-1.728-76.672-5.248a233.728 233.728 0 0 1-63.872-18.048 128.96 128.96 0 0 1-45.248-33.408 90.688 90.688 0 0 1-20.8-50.304 137.6 137.6 0 0 1 8.512-62.08c7.808-21.504 19.52-41.152 35.2-58.816a188.8 188.8 0 0 1 56.96-43.456 159.36 159.36 0 0 1 72.96-16.96c44.672 0 83.712 7.808 117.12 23.36V141.696L411.648 211.648l4.288 590.4v26.496c0 21.184-4.288 41.856-12.8 62.016a170.56 170.56 0 0 1-35.648 53.504 169.088 169.088 0 0 1-55.36 37.12 182.144 182.144 0 0 1-71.872 13.76c-28.416 0-54.656-2.624-78.784-7.936a234.688 234.688 0 0 1-63.872-23.296 139.072 139.072 0 0 1-44.8-38.144 104.64 104.64 0 0 1-20.16-52.48c-2.176-19.84 0.64-39.04 8.512-57.792 7.808-18.752 19.712-35.52 35.648-50.368 16-14.848 35.2-27.392 57.472-37.632 22.4-10.24 46.72-16.768 72.96-19.584a216.96 216.96 0 0 1 58.56-0.512c19.2 2.432 37.248 6.528 54.272 12.16V127.872L992 31.424v674.176z"></path></svg>',b='<svg t="1734491308472" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3380" width="200" height="200"><path d="M752.384 479.168a40.96 40.96 0 0 1 0 70.464l-205.696 122.88a41.28 41.28 0 0 1-62.08-35.2v-245.76a41.28 41.28 0 0 1 62.08-35.2l205.696 122.88z m-185.536-15.104v100.736l84.736-50.368-84.736-50.368z m534.848 450.88V113.92H114.304v801.024h987.392z m0 81.92H114.304c-45.44 0-82.304-36.672-82.304-81.92V113.92C32 68.672 68.864 32 114.304 32h987.392c45.44 0 82.304 36.672 82.304 81.92v801.024c0 45.248-36.864 81.92-82.304 81.92zM196.544 72.96c0-22.592 18.432-40.96 41.152-40.96 22.72 0 41.152 18.368 41.152 40.96v841.984c0 22.592-18.432 40.96-41.152 40.96a41.024 41.024 0 0 1-41.152-40.96V72.96z m41.152 277.632c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96H73.152a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544z m0 245.76c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96H73.152a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544zM937.152 72.96c0-22.592 18.432-40.96 41.152-40.96 22.72 0 41.152 18.368 41.152 40.96v841.984c0 22.592-18.432 40.96-41.152 40.96a41.024 41.024 0 0 1-41.152-40.96V72.96z m41.152 359.552a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96h-164.544z m0 245.76a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96h-164.544z"></path></svg>',x='<svg viewBox="0 0 1280 1024" width="24" height="24"><path d="M1106.944 340.416h-448V414.72l242.688 222.976-242.688 223.04v74.304h448v-111.488h-261.312l186.624-185.856-186.624-185.792h261.312z"></path><path d="M546.88 127.68L546.752 128 1330.944 128v76.48H529.728L359.04 972.48H267.648c-23.232-61.376-47.168-120.96-71.808-178.688A6116.032 6116.032 0 0 0 119.68 622.72l-96.832 30.272L0 581.504l176.256-56.32 36.992 79.616a2801.92 2801.92 0 0 1 99.008 241.024l145.408-718.08h89.216z"></path></svg>',w=p.import("ui/icons");w.image1=v,w.audio=f,w.video1=b,w.math=x;const E=p.import("parchment"),S=new E.StyleAttributor("image1","color",{scope:E.Scope.INLINE}),$=new E.StyleAttributor("video1","color",{scope:E.Scope.INLINE}),q=new E.StyleAttributor("audio","color",{scope:E.Scope.INLINE}),B=new E.StyleAttributor("math","color",{scope:E.Scope.INLINE});p.register("formats/image1",S),p.register("formats/video1",$),p.register("formats/audio",q),p.register("formats/math",B)},containerId:i,boxVisibility:a,mathConfirm:s,iframeUrl:l}}});var ran=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"ritchtextarea-container",attrs:{id:e.containerId}},[n("TinyFluentEditor",{ref:"fluentEditorRef",attrs:{"data-type":!1,"data-upgrade":!1,options:e.options,"before-editor-init":e.beforeEditorInit},model:{value:e.content,callback:function(o){e.content=o},expression:"content"}}),n("FileList",{ref:"fileList",attrs:{mode:"edit",type:"block",isPreview:!0,list:e.list,isShowLimitTimes:e.isShowLimitTimes,"is-question-bank":e.isQuestionBank},on:{deleteFile:e.deleteFile}}),n("button",{staticStyle:{display:"none"},attrs:{id:`upload-${e.containerId}`}}),n("TinyDialogBox",{attrs:{"dialog-class":"math-dialog",title:"消息",width:"60%","append-to-body":!0,"destroy-on-close":""},scopedSlots:e._u([{key:"footer",fn:function(){return[n("TinyButton",{on:{click:function(o){e.boxVisibility=!1}}},[e._v("取 消")]),n("TinyButton",{attrs:{type:"primary"},on:{click:e.mathConfirm}},[e._v("确 定")])]},proxy:!0}]),model:{value:e.boxVisibility,callback:function(o){e.boxVisibility=o},expression:"boxVisibility"}},[n("iframe",{attrs:{src:e.iframeUrl,frameborder:"0"}})])],1)},ian=[],aan=Nn(oan,ran,ian,!1,null,null);const _k=aan.exports,san=Ce.defineComponent({name:"Base",components:{RichTextarea:_k,FileList:cc,TinyButton:Pt},props:{question:{type:Object,required:!0,default:()=>{}},mode:{type:Number,default:0},isQuestionBank:{type:Boolean,default:!1},isSubmitted:{type:Boolean,default:!1}},emits:["blankAnswerChange"],setup(t,{emit:e}){const n=lc(),o=Ce.ref(null),r=Ce.ref([]),i=Ce.computed(()=>{if(t.question.type!==3||!t.question.title)return[{type:"text",content:t.question.title||""}];const h=/\(&nbsp;\)/g,p=[];let v=0,f,b=t.question.title.replace(/^<p>|<\/p>$/g,"");for(;(f=h.exec(b))!==null;)f.index>v&&p.push({type:"text",content:b.slice(v,f.index)}),p.push({type:"blank",content:f[0]}),v=h.lastIndex;return v<b.length&&p.push({type:"text",content:b.slice(v)}),p}),a=Ce.computed(()=>i.value.filter(h=>h.type==="blank").length);t.question.record||(t.question.record={}),t.mode!=1&&Ce.nextTick(()=>{Wl()}),Ce.watch(i,()=>{const h=i.value.filter(p=>p.type==="blank").length;if(h>r.value.length)for(let p=r.value.length;p<h;p++)r.value.push("");else h<r.value.length&&(r.value=r.value.slice(0,h));t.mode==3&&(r.value=t.question.record.answer)},{immediate:!0,deep:!0}),Ce.watch(()=>t.mode,h=>{var p,v;try{if(t.question.type==3)if(h==3&&((p=t.question.record)==null?void 0:p.answer.length)>0){const f=(v=t.question.record)==null?void 0:v.answer;Array.isArray(f)?r.value=[...f]:r.value=f.split(";")}else h==2&&(r.value=[]);h!=1&&Ce.nextTick(()=>{Wl()})}catch(f){console.error("Failed to parse record answer:",f)}});const l=h=>i.value.slice(0,h).filter(p=>p.type==="blank").length,s=h=>{Ce.nextTick(()=>{Jae(h.target,h.target.value)})},c=h=>{t.question.link.push(h)},d=h=>{t.question.link.splice(h,1)},u=()=>{o.value&&o.value.insertContent("(&nbsp;)")};return Ce.watch(r,(h,p)=>{e("blankAnswerChange",h),t.question.record&&(t.question.record.answer=h)},{deep:!0}),{t:n,insert:u,richTextareaRef:o,titleParts:i,blankCount:a,userAnswers:r,editWidth:s,checkAnswerCorrect:h=>{var b,x;const p=i.value.slice(0,h).filter(w=>w.type==="blank").length,v=(b=r.value[p])==null?void 0:b.trim();if(!v)return!1;let f=t.question.correctAnswer||[];if(t.question.allowExchange){const w=new Set;return f.forEach(E=>{E!=null&&E.trim().includes("//")?E.split("//").map($=>$.trim()).forEach($=>w.add($)):E!=null&&E.trim()&&w.add(E.trim())}),w.has(v)}else{const w=(x=f[p])==null?void 0:x.trim();return w&&w.includes("//")?w.split("//").map(S=>S.trim()).includes(v):w===v}},blankIndex:l,addTitleFile:c,deleteTitleFile:d}}});var lan=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"base-container"},[e.mode==2||e.mode==3?[e.question.type==3?n("div",{staticClass:"completion-preview"},[e.mode==2?n("div",{staticClass:"ql-editor preview-title"},[e._l(e.titleParts,function(o,r){return[o.type==="text"?n("span",{domProps:{innerHTML:e._s(o.content)}}):n("div",[n("span",{staticClass:"blank-index"},[e._v("["+e._s(e.blankIndex(r)+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:e.userAnswers[e.blankIndex(r)],expression:"userAnswers[blankIndex(index)]"}],staticClass:"completion-input",class:{"answer-correct":e.mode===3&&e.isSubmitted&&e.checkAnswerCorrect(r),"answer-error":e.mode===3&&e.isSubmitted&&!e.checkAnswerCorrect(r)},staticStyle:{margin:"0 2px"},attrs:{type:"text",disabled:!0},domProps:{value:e.userAnswers[e.blankIndex(r)]},on:{input:[function(i){i.target.composing||e.$set(e.userAnswers,e.blankIndex(r),i.target.value)},e.editWidth]}})])]})],2):e._e(),e.mode==3?n("div",{staticClass:"ql-editor preview-title"},[e._l(e.titleParts,function(o,r){return[o.type==="text"?n("span",{domProps:{innerHTML:e._s(o.content)}}):n("div",[n("span",{staticClass:"blank-index"},[e._v("["+e._s(e.blankIndex(r)+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:e.userAnswers[e.blankIndex(r)],expression:"userAnswers[blankIndex(index)]"}],staticClass:"completion-input",class:{"answer-correct":e.mode===3&&e.isSubmitted&&e.checkAnswerCorrect(r),"answer-error":e.mode===3&&e.isSubmitted&&!e.checkAnswerCorrect(r)},staticStyle:{margin:"0 2px"},attrs:{type:"text",disabled:e.mode==3&&e.isSubmitted},domProps:{value:e.userAnswers[e.blankIndex(r)]},on:{input:[function(i){i.target.composing||e.$set(e.userAnswers,e.blankIndex(r),i.target.value)},e.editWidth]}})])]})],2):e._e(),e.question.allowExchange?n("div",{staticClass:"can-exchange"},[e._v("*"+e._s(e.t("answerCanChangeTip")))]):e._e()]):n("div",{staticClass:"ql-editor preview-title",domProps:{innerHTML:e._s(e.question.title||"")}}),n("FileList",{attrs:{mode:"view",type:"block",isPreview:!0,list:e.question.link},on:{deleteFile:function(o){}}})]:n("RichTextarea",{ref:"richTextareaRef",attrs:{placeholderText:e.t("inputQuestionTitle"),list:e.question.link,maxNum:5,"is-question-bank":e.isQuestionBank,type:e.question.type},on:{addFile:e.addTitleFile,deleteFile:e.deleteTitleFile},model:{value:e.question.title,callback:function(o){e.$set(e.question,"title",o)},expression:"question.title"}}),e.question.type==3&&e.mode==1?n("TinyButton",{staticClass:"insert-blank",on:{click:e.insert}},[e._v(" "+e._s(e.t("insertQue"))+" ")]):e._e(),e._t("default")],2)},can=[],uan=Nn(san,lan,can,!1,null,"e2efce64");const $f=uan.exports;class io{constructor({id:e,questionId:n="",type:o=0,title:r="",score:i=1,correctAnswer:a=[],reply:l="",record:s={},lisCount:c=-1,link:d=[],analyLinkList:u=[],answerlink:m="",correctChoiceIds:h=[],tags:p=[],hardlevel:v=3,knowledgeDTOS:f=[]}){this.id=e||n,this.questionid=this.id,this.type=o,this.title=r,this.score=i,this.correctAnswer=a,this.reply=l,this.record=new dan(s),this.lisCount=c,this.link=d||[],this.analyLinkList=u||[],this.answerlink=m,this.correctChoiceIds=h,this.tags=p||[],this.hardlevel=v,this.knowledgeDTOS=f||[]}scoring(){console.error("子类自行实现接口")}getOption(e){return String.fromCharCode(65+e)}getAnswer(){const e=this.record.answer;return e&&e.length>0?e[0]:""}getCorrectAnswer(){}}class dan{constructor({id:e="",answer:n=[],attachments:o=[],grade:r,reply:i="",remark1:a=""}){this.id=e,this.answer=n,this.attachments=o,this.score=r,this.reply=i||a}}let Ep=class{constructor({id:e="",questionID:n="",choiceId:o=0,text:r="",attachments:i=[],record:a={}}){this.id=e||n,this.choiceId=o,this.text=r,this.attachments=i,this.record=a}};class pan extends io{constructor(e){super(e),this.choices=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new Ep({id:Math.random(),choiceId:o.choiceId||0,text:o.title,attachments:o.link?[{fileUrl:o.link}]:[]}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new Ep({id:Math.random(),text:""}))}scoring(){}createChoice(){this.choices.push(new Ep({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}getAnswer(){return Array.isArray(this.record.answer)?this.record.answer.join(""):this.record.answer}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join(""):this.correctAnswer}handleAnswer(e,n){if(!e||this.getAnswer().length===0)return"";const o=this.getOption(n),r=this.correctAnswer&&this.correctAnswer.includes(o);return this.record.answer&&this.record.answer.includes(o)?r?"correct":"error":r&&this.type===2?"no-select error":""}}let kb=class{constructor({id:e="",correctAnswer:n=""}){this.id=e,this.correctAnswer=n}},han=class extends io{constructor(e){super(e),this.allowExchange=e.allowExchange||e.blankOrder||e.blackOrder||0,this.blanks=[];let n=0;this.title.replace(/[((](\s|&nbsp;)+[))]|_{5,}/gi,()=>{this.createBlank(),this.blanks[n].correctAnswer=this.correctAnswer[n],this.blanks[n].blankIndex=n+1,n++}),this.oldNums=this.blanks.length}createBlank(){this.blanks.push(new kb({id:Math.random(),correctAnswer:""})),this.correctAnswer.length<this.blanks.length&&this.correctAnswer.push("")}deleteBlank(e,n=1){this.blanks.splice(e,n),this.correctAnswer.splice(e,n)}createBlankByIndex(e,n){let o=new kb({id:Math.random(),correctAnswer:""});o.blankIndex=n,this.blanks.splice(e,0,o),this.correctAnswer.splice(e,0,"")}};class man extends io{constructor(e){super(e)}scoring(){}getAnswerResult(e){return e&&e.length>0&&e[0]?e[0].toLowerCase()==="true"||e[0]===!0:""}handleAnswer(e,n){const o=this.getAnswerResult(this.record.answer)===n;if(!e)return o?"select":"";const r=this.getAnswerResult(this.correctAnswer)===n;return o?r?"correct":"error":""}}class fan extends io{constructor(e){super(e),this.answerLinkList=e.answerLinkList||[],this.answerLinkList.length==0&&this.answerlink&&this.answerLinkList.push({fileUrl:this.answerlink})}scoring(){}getAnswer(){return(this.record.answer.join("")||"").trim()}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer[0]:this.correctAnswer}}class gan extends io{constructor(e){super(e),this.subQuestions=[];for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];o.type=1,o=Pf(o),o.qIndex=n+1,this.subQuestions.push(o)}this.oldNums=this.subQuestions.length}scoring(){}createSubQuestion(){this.subQuestions.push(Yl(1))}deleteSubQuestion(e,n){this.subQuestions.splice(e,n||1)}createSubQuestionByIndex(e,n){let o=Yl(1);o.qIndex=n,o.isNew=1,this.subQuestions.splice(e,0,o)}getAnswerText(e){if(e.correctAnswer.length===0)return"";let n=e.correctAnswer[0].charCodeAt(0)-65;return e.choices[n].text}}let $p=class{constructor({id:e="",text:n="",option:o="",attachments:r=[]}){this.id=e,this.text=n,this.option=o,this.attachments=r}};class van extends io{constructor(e){super(e),this.choices=[],this.subQuestions=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new $p({id:Math.random(),text:o.title}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new $p({id:Math.random(),text:""}));for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];o=Pf(o),o.qIndex=n+1,this.subQuestions.push(o)}this.oldNums=this.subQuestions.length}scoring(){}createChoice(){this.choices.push(new $p({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}createSubQuestion(){this.subQuestions.push(Yl(1))}deleteSubQuestion(e,n){this.subQuestions.splice(e,n||1)}createSubQuestionByIndex(e,n){let o=Yl(1);o.qIndex=n,o.isNew=1,this.subQuestions.splice(e,0,o)}getAnswerText(e){if(e.correctAnswer.length===0||!e.correctAnswer[0])return"";let n=e.correctAnswer[0].charCodeAt(0)-65;return this.choices[n].text}getAnswer(){return Array.isArray(this.record.answer)?this.record.answer.join(""):this.record.answer}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join(""):this.correctAnswer}handleAnswer(e,n){if(!e)return"";const o=this.getOption(n),r=this.correctAnswer&&this.correctAnswer.includes(o);return this.record.answer&&this.record.answer.includes(o)?r?"correct":"error":""}}class yan extends io{constructor(e){super(e),this.subQuestions=[];for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];this.subQuestions.push(Pf(o))}}scoring(){}createSubQuestion(e){let n=Yl(e);n.isEdit=!0,n.isNew=1,this.subQuestions.push(n)}deleteSubQuestion(e){this.subQuestions.splice(e,1)}}let Pp=class{constructor({id:e="",text:n="",option:o=""}){this.id=e,this.text=n,this.option=o}};class ban extends io{constructor(e){super(e),this.choices=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new Pp({id:Math.random(),text:o.title}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new Pp({id:Math.random(),text:""}))}scoring(){this.record.score=0}createChoice(){this.choices.push(new Pp({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}getAnswer(){const e=Array.isArray(this.record.answer)?this.record.answer:[this.record.answer];return e.filter(o=>o&&o.length>0).length>0?e.join("-"):""}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join("-"):this.correctAnswer}handleAnswer(e,n){return e&&this.record.answer&&this.record.answer[n]?this.correctAnswer[n]===this.record.answer[n]?"correct":"error":""}}class wan extends io{constructor(e){super(e)}scoring(){}getAnswer(){return this.record.answer.join("")||""}}class xan extends io{constructor(e){super(e)}scoring(){}}class Cb{constructor({name:e="",precision:n,max:o,min:r}){this.name=e,this.precision=n||1,this.max=o,this.min=r}}class _p{constructor({formula:e="",answerRange:n=0,precision:o=1}){this.formula=e,this.answerRange=n,this.precision=o}}class Tan extends io{constructor(e){super(e),this.variables=[],this.blanks=[],this.scope={},this.desc1=e.desc1;try{for(let o=0;e.formulaVar&&o<e.formulaVar.length;o++){let r=e.formulaVar[o];this.variables.push(new Cb(r)),r.value!==void 0&&(this.scope[r.name]=r.value)}}catch(o){console.log(o)}let n=0;this.title.replace(/[((](\s|&nbsp;)+[))]|_{5,}/gi,()=>{let o={};const r=this.correctAnswer[n];r&&(o=typeof r=="string"&&r.length>0?JSON.parse(r):r);let i=new _p(o);i.blankIndex=n+1,this.blanks.push(i),n++}),this.oldNums=this.blanks.length}createVariable(e){this.variables.push(new Cb({name:e}))}deleteVariable(e){for(let n=0;n<this.variables.length;n++)if(this.variables[n].name===e){this.variables.splice(n,1);return}}createBlank(){this.blanks.push(new _p({}))}deleteBlank(e,n){this.blanks.splice(e,n||1)}createBlankByIndex(e,n){let o=new _p({});o.blankIndex=n,this.blanks.splice(e,0,o)}initVariables(e){let n={};for(let o=0;o<this.variables.length;o++){let r=this.variables[o],i=r.min*1+Math.random()*(r.max-r.min);i=new Number(i);let a=0;r.precision!=1&&(a=(Math.round(.1/r.precision)+"").length),i=i.toFixed(a);let l=new RegExp("\\>"+r.name+"\\*\\<","g");e=e.replace(l,">"+i+"<"),n[r.name]=i}return this.scope=n,e}initDomVariables(e){for(let n in this.scope){let o=new RegExp("\\>"+n+"\\*\\<","g");e=e.replace(o,">"+this.scope[n]+"<")}return e}checkAnswer(e){let n=[];for(let i=0;i<this.blanks.length;i++)n.push({text:this.record.answer[i]||""});let o={scope:this.scope,answerResult:[]},r=0;for(let i=0;Object.values(this.scope).length>0&&i<n.length;i++)if(n[i].text&&n[i].text.trim().length>0){let a=this.blanks[i],l=a.formula,s=e.format(e.evaluate(l,this.scope),{precision:14})*1,c=n[i].text*1,d=0;a.precision!=1&&(d=(Math.round(.1/a.precision)+"").length),s=s.toFixed(d)*1,c=c.toFixed(d)*1,c>=s-a.answerRange*1&&c<=s+a.answerRange*1?(o.answerResult[i]=!0,r++):o.answerResult[i]=!1}else o.answerResult[i]=!1;this.record.extraAnswer=o,this.record.grade=this.score*(r/this.blanks.length),this.checkResult=o.answerResult}}function uc(t){let e=null;switch(t.type){case 1:case 2:e=new pan(t);break;case 3:e=new han(t);break;case 4:e=new man(t);break;case 5:e=new fan(t);break;case 12:e=new ban(t);break;case 11:case 23:e=new gan(t);break;case 17:e=new van(t);break;case 16:e=new wan(t);break;case 19:e=new xan(t);break;case 24:e=new yan(t);break;case 25:e=new Tan(t);break;default:e=new io(t)}return e}function Yl(t){let e=uc({id:Math.random(),type:t});return e.key=Math.random(),e}function Pf(t){if(t.id=t.id||t.questionid,t.allowExchange=t.allowExchange||t.blankOrder||t.blackOrder||0,t.correctAnswerAndReplay){let{correctAnswer:e,correctReplay:n,correctChoiceIds:o}=t.correctAnswerAndReplay;t.correctAnswer=e||t.correctAnswer,t.reply=n||t.reply,t.correctChoiceIds=o||[]}else t.correctAnswer=t.correctAnswer||t.correctanswer,t.reply=t.reply||t.correctreply;return t.correctAnswer=t.correctAnswer||t.correctanswer,t.reply=t.reply||t.correctreply,t.subQuestions=t.questionlist||t.subQuestions,t.subQuestions&&t.subQuestions.length>0&&(t.score=0,t.subQuestions.forEach((e,n)=>{e.score=e.score===0||e.score>0?Number(gm(e.score,2)):1,t.score+=e.score})),t.score=t.score===0||t.score>0?Number(gm(t.score,2)):1,t.type==25&&!t.formulaVar&&t.desc1&&(t.formulaVar=JSON.parse(t.desc1)),uc(t)}const Mk="data:image/png;base64,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",kan="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='18'%20height='18'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.57917%2015.9145C8.70747%2016.0428%208.8824%2016.1134%209.06382%2016.1102C9.43813%2016.1092%209.74175%2015.8068%209.74422%2015.4325V9.67071H15.5051C15.8805%209.66972%2016.1845%209.36568%2016.1855%208.99031C16.1887%208.8089%2016.118%208.63397%2015.9897%208.50567C15.8614%208.37737%2015.6865%208.30671%2015.5051%208.30991H9.74422V2.57151C9.74422%202.19574%209.43959%201.89111%209.06382%201.89111C8.68804%201.89111%208.38342%202.19574%208.38342%202.57151V8.30991H2.645C2.26923%208.30991%201.9646%208.61454%201.9646%208.99031C1.9646%209.36609%202.26923%209.67071%202.645%209.67071H8.38342V15.4298C8.38021%2015.6112%208.45087%2015.7862%208.57917%2015.9145ZM8.38342%209.67071H9.74422V8.30991H8.38342V9.67071Z'%20fill='%23529FFF'/%3e%3c/svg%3e",Can=Ce.defineComponent({name:"Choice",components:{TinyButton:Pt,TinyRadioGroup:Wi,TinyRadio:Jn,TinyCheckboxGroup:as,TinyCheckbox:Zn,TinyAlert:Vi,FileList:cc,Base:$f,RichTextarea:_k},props:{oriQuestion:{type:Object,required:!0,default:()=>({type:1,choices:[],correctAnswer:null,record:{answer:null}})},mode:{type:Number,default:1,validator:t=>[1,2,3].includes(t)},needRichText:{type:Boolean,default:!0},isSubmitted:{type:Boolean,default:!1},showAnswer:{type:Boolean,default:!1}},emits:["save","cancel","change"],setup(t,{emit:e}){const n=lc(),o=Ce.ref({type:"warning",text:""}),r=($,q)=>{o.value={type:$,text:q},setTimeout(()=>{o.value.text=""},2e3)},i=Ce.ref(null),a=Ce.ref({}),l=Ce.ref(""),s=Ce.ref([]),c=Ce.ref(),d=()=>{var $,q,B,P;t.mode===3?($=a.value.record)!=null&&$.answer?a.value.type===1?(l.value=a.value.record.answer,c.value=a.value.record.answer):(s.value=Array.isArray(a.value.record.answer)?a.value.record.answer:((q=a.value.record.answer)==null?void 0:q.split(","))||[],c.value=Array.isArray(a.value.record.answer)?a.value.record.answer:((B=a.value.record.answer)==null?void 0:B.split(","))||[]):(l.value="",s.value=[]):a.value.correctAnswer?a.value.type===1?l.value=a.value.correctAnswer[0]:s.value=Array.isArray(a.value.correctAnswer)?a.value.correctAnswer:((P=a.value.correctAnswer)==null?void 0:P.split(","))||[]:(l.value="",s.value=[])};Ce.watch(()=>t.oriQuestion,$=>{a.value=uc($),d(),Ce.nextTick(()=>{Wl()}),console.log(a.value,"--------Choice--------",$)},{immediate:!0}),Ce.watch([()=>t.mode,()=>t.isSubmitted],()=>{d()});const u=$=>String.fromCharCode(65+$),m=$=>$?Array.isArray($)?$.join(","):$:"-",h=$=>{var C;if(t.mode!==3||!t.isSubmitted)return"";const q=u($),B=((C=a.value.record)==null?void 0:C.answer)||"",P=a.value.correctAnswer||"",N=Array.isArray(B)?B:(B==null?void 0:B.split(","))||[],D=Array.isArray(P)?P:(P==null?void 0:P.split(","))||[],W=N.includes(q),M=D.includes(q);return M&&W?"correct":!M&&W?"wrong":M&&!W?"missed":""},p=()=>{t.mode===1&&(a.value.choices.length<20?v():console.warn(n("optionLimit")||"选项数量已达上限(20个)"))},v=()=>{a.value.choices||(a.value.choices=[]),a.value.choices.push({id:Date.now(),text:"",attachments:[]})},f=$=>{t.mode===1&&t.needRichText&&(i.value=$)},b=($,q)=>{t.mode===1&&a.value.choices[q].attachments.splice($,1)},x=($,q)=>{console.log($,q,a.value,"question.valuequestion.value"),t.mode===1&&a.value.choices[q].attachments.push($)},w=($,q)=>{if(t.mode===1)if(a.value.choices&&Array.isArray(a.value.choices)&&a.value.choices.length>2){if(a.value.choices.splice(q,1),a.value.correctAnswer){const P=(Array.isArray(a.value.correctAnswer)?a.value.correctAnswer:a.value.correctAnswer.split(",")).filter(N=>{const D=N.charCodeAt(0)-65;return D!==q&&D<a.value.choices.length});a.value.correctAnswer=a.value.type===1?P[0]||"":P}}else console.warn(n("atLeastTwo")||"至少需要两个选项")},E=()=>{if(t.mode!==1)return;if(!a.value.title){r("warning",n("questionTitleTip1"));return}if(a.value.choices.some(q=>!q.text)){r("warning",n("optionContentTip1"));return}if(!a.value.correctAnswer||a.value.correctAnswer.length===0){r("warning",n("inputAnswerTip4"));return}const $=JSON.parse(JSON.stringify(a.value));e("save",$)},S=()=>{e("cancel")};return Ce.watch(l,$=>{a.value.type===1&&(t.mode===1?a.value.correctAnswer=$:t.mode===3&&(a.value.record||(a.value.record={}),a.value.record.answer=$,e("change",a.value)))}),Ce.watch(s,$=>{a.value.type===2&&(t.mode===1?a.value.correctAnswer=$:t.mode===3&&!t.isSubmitted&&(a.value.record||(a.value.record={}),a.value.record.answer=$,e("change",a.value)))}),{t:n,question:a,radioAnswer:l,checkboxAnswer:s,getOption:u,formatAnswer:m,handleAnswerClass:h,addChoice:p,saveQuestion:E,cancel:S,createChoice:v,activeIndex:i,activeRichText:f,deleteFile:b,addFile:x,deleteChoice:w,userAnswer:c,alertInfo:o,showAlertHandler:r}}});var Aan=function(){var o;var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{staticClass:"choice-container",attrs:{question:e.question,mode:e.mode}},[e.mode===1?n("div",{staticClass:"edit-mode"},[n("div",{staticClass:"choice-list-base"},[e._l(e.question.choices,function(r,i){return n("div",{key:r.id},[n("div",{staticClass:"choice-item"},[n("span",{staticClass:"choice-option"},[e._v(e._s(e.getOption(i)))]),e.activeIndex===i?n("RichTextarea",{staticClass:"choice-input-wrap",attrs:{placeholder:e.t("optionContent"),list:r.attachments,isShowLimitTimes:!1,actionIndex:i,placeholderText:e.t("optionContent")},on:{addFile:e.addFile,deleteFile:e.deleteFile},model:{value:r.text,callback:function(a){e.$set(r,"text",a)},expression:"choice.text"}}):n("div",{staticClass:"choice-input-wrap"},[e.needRichText?n("div",{staticClass:"choice-input",on:{click:function(a){return e.activeRichText(i)}}},[r.text||r.attachments&&r.attachments.length>0?e._e():n("span",{staticClass:"no-content-tip"},[e._v(e._s(e.t("optionContent")))]),r.text?n("div",{staticClass:"rich-text",domProps:{innerHTML:e._s(r.text)}}):e._e(),n("FileList",{ref:"fileList",refInFor:!0,attrs:{mode:"edit",type:"block",isPreview:!0,list:r.attachments||[],isShowLimitTimes:!1,actionIndex:i},on:{deleteFile:e.deleteFile}})],1):n("input",{directives:[{name:"model",rawName:"v-model",value:r.text,expression:"choice.text"}],staticClass:"choice-input",attrs:{type:"text",placeholder:e.t("optionContent")},domProps:{value:r.text},on:{input:function(a){a.target.composing||e.$set(r,"text",a.target.value)}}})]),i>1?n("img",{staticClass:"btn-delete",attrs:{src:Mk,alt:""},on:{click:function(a){return e.deleteChoice(r,i)}}}):e._e()],1)])}),n("div",{staticClass:"btn-add",on:{click:e.addChoice}},[n("img",{attrs:{src:kan,alt:""}}),e._v(e._s(e.t("addOption"))+" ")])],2),n("div",{staticClass:"choice-list"},[n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])]),e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i)))])])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i)))])])}),1):e._e()],1),n("div",{staticClass:"btn-save"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)]):e._e(),e.mode===2?n("div",{staticClass:"preview-mode"},[n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",attrs:{disabled:""},model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",attrs:{disabled:""},model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1}}):e._e()],1)])}),1):e._e()],1),n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])])]):e._e(),e.mode===3?n("div",{staticClass:"answer-mode"},[e.isSubmitted?n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",attrs:{disabled:!0},model:{value:e.userAnswer,callback:function(r){e.userAnswer=r},expression:"userAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",class:e.handleAnswerClass(i),attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",attrs:{disabled:!0},model:{value:e.userAnswer,callback:function(r){e.userAnswer=r},expression:"userAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",class:e.handleAnswerClass(i),attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e()],1):n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e()],1),e.isSubmitted&&e.showAnswer?n("div",[n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("stuAnswer"))+":")]),n("span",[e._v(e._s(e.formatAnswer((o=e.question.record)==null?void 0:o.answer)))])]),n("div",{staticClass:"correct-answer"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])])]):e._e()]):e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],1)},San=[],Ean=Nn(Can,Aan,San,!1,null,"13d78562");const Ll=Ean.exports;Ll.install=t=>t.component(Ll.name,Ll);const $an=Ce.defineComponent({name:"Completion",components:{Base:$f,FileList:cc,TinyButton:Pt,TinyCheckbox:Zn,TinyAlert:Vi},props:{mode:{type:Number,default:1},oriQuestion:{type:Object,default:()=>({})},isSubmitted:{type:Boolean,default:!1},showAnswer:{type:Boolean,default:!1}},emits:["save","cancel","submit"],setup(t,{emit:e}){const n=Ce.ref({}),o=Ce.ref([]),r=Ce.ref({type:"warning",text:""}),i=(h,p)=>{r.value={type:h,text:p},setTimeout(()=>{r.value.text=""},2e3)},a=h=>{var W,M,C,V;if(t.mode!==1)return;const p=/\(&nbsp;\)/g;let v;const f=[];let b=0,x="<p>";for(;(v=p.exec(h))!==null;)f.push(v.index-5*b-x.length),b++;let w=0;if((W=u.value)!=null&&W.richTextareaRef){const k=(C=(M=u.value.richTextareaRef.$refs.fluentEditorRef.state.quill)==null?void 0:M.getSelection)==null?void 0:C.call(M);w=(k==null?void 0:k.index)??((V=n.value.title)==null?void 0:V.length)??0}let E=0;for(let k=0;k<f.length&&w>f[k];k++)E=k;const S=[...n.value.blanks||[]].sort((k,z)=>(k.orderIndex||0)-(z.orderIndex||0)),$=S.map(k=>k.correctAnswer||""),q=[];let B=0;const P=f.length,N=S.length,D=Array(P).fill("");if(N>0){const k=P>N;if(k)for(let z=0;z<P;z++)if(k&&z===E)D[z]="";else if(z<E)z<$.length&&(D[z]=$[z]);else{const O=z-1;O<$.length&&(D[z]=$[O])}else for(let z=0;z<P;z++)D[z]=$[z]}for(let k=0;k<f.length;k++)q.push({id:Bu(),blankIndex:f[k],orderIndex:B,correctAnswer:D[k]}),B++;n.value.blanks=q,o.value=n.value.blanks.map(()=>""),l()};Ce.watch(()=>n.value.title,a),Ce.watch(()=>t.oriQuestion,h=>{n.value=uc(h),Ce.nextTick(()=>{Wl()})},{immediate:!0});const l=()=>{if(t.mode!==1)return;let h=[];if(n.value.blanks)for(let p=0;p<n.value.blanks.length;p++){let v=n.value.blanks[p];h.push(v.correctAnswer||"")}n.value.correctAnswer=h},s=()=>{if(t.mode!==1)return;if(l(),!n.value.title){i("warning",ar("questionTitleTip1"));return}let h=!1;for(let v=0;v<n.value.blanks.length;v++)if(!n.value.blanks[v].correctAnswer||n.value.blanks[v].correctAnswer.trim()===""){h=!0;break}if(h){i("warning",ar("optionContentTip1"));return}let p=!1;for(let v=0;v<n.value.blanks.length;v++)if((n.value.blanks[v].correctAnswer||"").length>1e3){p=!0;break}if(p){i("warning",ar("optionContentTip3"));return}console.log("save-completion",n.value),e("save",n.value)},c=()=>{e("cancel")},d=h=>{t.mode===3&&(n.value.record.answer=h,e("change",n.value))},u=Ce.ref(null);return{t:ar,question:n,userAnswers:o,saveQuestion:s,cancel:c,answerChange:l,blankAnswerChange:d,deleteBlank:(h,p)=>{var E;if(t.mode!==1)return;const v=n.value.blanks.findIndex(S=>S.id===h.id);if(v===-1)return;n.value.blanks.splice(v,1);let f=n.value.title;const b=/\(&nbsp;\)/g;let x,w=[];for(;(x=b.exec(f))!==null;)w.push(x.index);if(p>=0&&p<w.length){const S=w[p];f=f.substring(0,S)+f.substring(S+8),n.value.title=f,(E=u.value)!=null&&E.richTextareaRef&&(u.value.richTextareaRef.content=f);const $=/\(&nbsp;\)/g;let q,B=[];for(;(q=$.exec(f))!==null;)B.push(q.index);n.value.blanks.forEach((P,N)=>{B[N]!==void 0&&(P.blankIndex=B[N])})}o.value=n.value.blanks.map(()=>""),l()},baseComponent:u,alertInfo:r,showAlertHandler:i}}});var Pan=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{ref:"baseComponent",staticClass:"completion-question",attrs:{question:e.question,mode:e.mode,isSubmitted:e.isSubmitted},on:{blankAnswerChange:e.blankAnswerChange}},[e.mode===1?[n("div",{staticClass:"edit-mode"},[n("div",{staticClass:"title"}),n("div",{staticClass:"correct-answer"},[n("span",{staticClass:"tip"},[e._v(e._s(e.t("answer"))+":")]),n("span",{staticClass:"correct-answer-tip"},[e._v("( "+e._s(e.t("inputAnswerTip2"))+" )")]),e._l(e.question.blanks,function(o,r){return n("div",{key:o.id||r},[n("div",{staticClass:"answer-item"},[n("span",{staticClass:"answer-option"},[e._v("["+e._s(r+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:o.correctAnswer,expression:"blank.correctAnswer"}],staticClass:"answer-input",attrs:{placeholder:e.t("inputAnswer"),type:"text"},domProps:{value:o.correctAnswer},on:{change:e.answerChange,input:function(i){i.target.composing||e.$set(o,"correctAnswer",i.target.value)}}}),n("div",{staticClass:"btn-delete"},[n("img",{attrs:{src:Mk,alt:""},on:{click:function(i){return e.deleteBlank(o,r)}}})])])])}),n("div",{staticClass:"can-exchange"},[n("TinyCheckbox",{attrs:{"false-label":0,"true-label":1},model:{value:e.question.allowExchange,callback:function(o){e.$set(e.question,"allowExchange",o)},expression:"question.allowExchange"}},[e._v("答案可互换顺序")])],1),n("div",{staticClass:"btn-save"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)],2)])]:(e.mode===2||e.mode===3)&&e.showAnswer?[n("div",{staticClass:"preview-mode"},[n("FileList",{attrs:{list:e.question.link}}),n("div",{staticClass:"correct-answer-preview"},[n("div",{class:{title:e.mode===3}},[e._v(e._s(e.t("correctAnswer"))+":")]),e._l(e.question.blanks,function(o,r){return n("span",{key:o.id||r,staticClass:"answer-item"},[n("span",{staticClass:"answer-option"},[e._v("["+e._s(r+1)+"]")]),n("span",{staticClass:"answer-value"},[e._v(e._s(`${o.correctAnswer}${r!==e.question.blanks.length-1?"、":""}`||"-"))])])})],2)],1)]:e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],2)},_an=[],Man=Nn($an,Pan,_an,!1,null,"cb349b86");const Il=Man.exports;Il.install=t=>t.component(Il.name,Il);const il="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='18'%20height='18'%20fill='%23475467'/%3e%3cpath%20d='M6.77719%2012.6257L2.59039%207.87367C2.34614%207.5802%201.96178%207.44255%201.58677%207.51423C1.21175%207.58592%200.905259%207.85563%200.786475%208.21849C0.66769%208.58135%200.755358%208.98009%201.01539%209.25967L5.96539%2014.8865C6.16186%2015.1092%206.4434%2015.2385%206.74039%2015.2422C7.03739%2015.246%207.32212%2015.124%207.52419%2014.9063L17.2712%204.40687C17.5406%204.13474%2017.6404%203.73748%2017.5316%203.37035C17.4227%203.00321%2017.1226%202.7245%2016.7484%202.64313C16.3742%202.56177%2015.9854%202.69067%2015.734%202.97947L6.77719%2012.6275V12.6257Z'%20fill='%23475467'/%3e%3c/svg%3e",al="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='16'%20height='16'%20fill='%23475467'/%3e%3cpath%20d='M9.48719%208.00012L15.2562%202.23012C15.6662%201.82112%2015.6662%201.15012%2015.2562%200.741117C14.8462%200.331117%2014.1762%200.331117%2013.7662%200.741117L7.99719%206.51112L2.22719%200.740117C1.81819%200.330117%201.14719%200.330117%200.738187%200.740117C0.328187%201.15012%200.328187%201.82012%200.738187%202.23012L6.50819%208.00012L0.737188%2013.7701C0.327188%2014.1791%200.327188%2014.8501%200.737188%2015.2591C1.14719%2015.6691%201.81719%2015.6691%202.22719%2015.2591L7.99719%209.48912L13.7672%2015.2591C14.1762%2015.6691%2014.8472%2015.6691%2015.2562%2015.2591C15.6662%2014.8491%2015.6662%2014.1791%2015.2562%2013.7691L9.48619%208.00012H9.48719Z'%20fill='%23475467'/%3e%3c/svg%3e",Lan=Ce.defineComponent({name:"JudgeQuestion",components:{Base:$f,TinyRadio:Jn,TinyRadioGroup:Wi,TinyButton:Pt,FileList:cc,TinyAlert:Vi},props:{mode:{type:Number,default:1},oriQuestion:{type:Object,default:()=>({})},showAnswer:{type:Boolean,default:!1},isSubmitted:{type:Boolean,default:!1}},emits:["save","cancel","change"],setup(t,{emit:e}){const n=lc(),o=Ce.ref({type:"warning",text:""}),r=(h,p)=>{o.value={type:h,text:p},setTimeout(()=>{o.value.text=""},2e3)},i=Ce.ref({}),a=Ce.ref(""),l=Ce.ref(""),s=Ce.computed(()=>t.isSubmitted&&a.value===l.value);Ce.watch(()=>t.oriQuestion,h=>{var p;i.value=uc(h),i.value.correctAnswer&&i.value.correctAnswer.length>0&&(l.value=i.value.correctAnswer[0]),t.mode===3&&((p=i.value.record)!=null&&p.answer?a.value=i.value.record.answer:a.value=""),Ce.nextTick(()=>{Wl()}),console.log(i.value,"--------Judge--------")},{immediate:!0}),Ce.watch(()=>t.mode,h=>{var p;h!==3?a.value="":(p=i.value.record)!=null&&p.answer?a.value=i.value.record.answer:a.value=""}),Ce.watch(()=>t.isSubmitted,h=>{var p;h&&((p=i.value.record)!=null&&p.answer)&&(a.value=i.value.record.answer)});const c=()=>{if(t.mode===1){if(!i.value.title||!i.value.title.trim()){r("warning",n("questionTitleTip1"));return}if(!l.value){r("warning",n("inputAnswerTip4"));return}i.value.correctAnswer||(i.value.correctAnswer=[]),i.value.correctAnswer[0]=l.value,e("save",i.value)}},d=()=>{e("cancel")};return Ce.watch(a,h=>{t.mode===3&&h&&(i.value.record||(i.value.record={}),i.value.record.answer=h,e("change",i.value))}),{t:n,cancel:d,question:i,userAnswer:a,correctAnswer:l,isCorrect:s,saveQuestion:c,handleAnswerClass:h=>{if(!t.isSubmitted)return"";const p=(h?"true":"false")==a.value,v=(h?"true":"false")==l.value;return p?v?"correct":"wrong":""},handleCorrectAnswerClass:h=>t.isSubmitted&&(h?"true":"false")==l.value?"correct":"",alertInfo:o,showAlertHandler:r}}});var Ian=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{staticClass:"true-or-false-question",attrs:{question:e.question,mode:e.mode}},[e.mode===1?[n("div",{staticClass:"correct-answer"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("TinyRadioGroup",{model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1),n("div",{staticClass:"action-buttons"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)]:e.mode===2?[n("div",{staticClass:"preview-mode"},[n("div",{staticClass:"correct-answer-preview"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1)])]:e.mode===3?[n("div",{staticClass:"answer-mode"},[n("div",{staticClass:"user-answer"},[e.isSubmitted?n("div",{staticClass:"submit-result"},[n("div",{staticClass:"user-answer-display"},[n("span",[e._v(e._s(e.t("yourAnswer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.userAnswer,callback:function(o){e.userAnswer=o},expression:"userAnswer"}},[n("TinyRadio",{class:e.handleAnswerClass(!0),attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{class:e.handleAnswerClass(!1),attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1),e.showAnswer?n("div",{staticClass:"correct-answer-hint"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{class:e.handleCorrectAnswerClass(!0),attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{class:e.handleCorrectAnswerClass(!1),attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1):e._e()]):n("div",[n("TinyRadioGroup",{model:{value:e.userAnswer,callback:function(o){e.userAnswer=o},expression:"userAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1)])])]:e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],2)},Nan=[],Oan=Nn(Lan,Ian,Nan,!1,null,"fb1a6c3b");const Nl=Oan.exports;Nl.install=t=>t.component(Nl.name,Nl);pin();const Dan=[fl,Pl,_l,Ll,Il,Nl],Ban=t=>{Dan.forEach(e=>t.use(e))},qan={install:Ban};exports.Choice=Ll;exports.Completion=Il;exports.Judge=Nl;exports.MyButton=fl;exports.MyTinyButton=Pl;exports.MyTinyRadio=_l;exports.default=qan;
454
+ `,We+="UNSIGNED-PAYLOAD",pe+="X-Amz-Signature="+qt(Of(me,ke,this.sk,this.region,We)),{ActualSignedRequestHeaders:oe,SignedUrl:(this.isSecure?"https":"http")+"://"+ge+":"+this.port+pe}},st.prototype.createPostSignatureSync=function(y){var T=y.signatureContext||this.signatureContext;if(T.signature==="v4")return this.createV4PostSignatureSync(y);var R=(y=y||{}).Bucket?String(y.Bucket):null,j=y.Key?String(y.Key):null,X=y.Expires?parseInt(y.Expires,10):300,G={};if(y.FormParams&&y.FormParams instanceof Object&&!(y.FormParams instanceof Array))for(var U in y.FormParams)({}).hasOwnProperty.call(y.FormParams,U)&&(G[U]=y.FormParams[U]);this.securityToken&&!G[T.headerPrefix+"security-token"]&&(G[T.headerPrefix+"security-token"]=this.securityToken);var oe=new Date;oe.setTime(parseInt(new Date().getTime(),10)+1e3*X),oe=Lf(oe.toUTCString()),R&&(G.bucket=R),j&&(G.key=j);var ie=[];ie.push('{"expiration":"'),ie.push(oe),ie.push('", "conditions":[');var le=!0,ve=!0,pe=["acl","bucket","key","success_action_redirect","redirect","success_action_status"];for(var de in G)if(de){var ge=G[de];(de=String(de).toLowerCase())==="bucket"?le=!1:de==="key"&&(ve=!1),jt.indexOf(de)<0&&pe.indexOf(de)<0&&de.indexOf(T.headerPrefix)!==0||(ie.push('{"'),ie.push(de),ie.push('":"'),ie.push(ge!==null?String(ge):""),ie.push('"},'))}le&&ie.push('["starts-with", "$bucket", ""],'),ve&&ie.push('["starts-with", "$key", ""],'),ie.push("]}");var we=ie.join("");ie=window.btoa?window.btoa(we):_o.encode(we);var me=Je("sha1",this.sk).update(ie).digest("base64");return{OriginPolicy:we,Policy:ie,Signature:me,Token:this.ak+":"+me+":"+ie}},st.prototype.createV4PostSignatureSync=function(y){var T=(y=y||{}).signatureContext||this.signatureContext,R=y.Bucket?String(y.Bucket):null,j=y.Key?String(y.Key):null,X=y.Expires?parseInt(y.Expires,10):300,G={};if(y.FormParams&&y.FormParams instanceof Object&&!(y.FormParams instanceof Array))for(var U in y.FormParams)({}).hasOwnProperty.call(y.FormParams,U)&&(G[U]=y.FormParams[U]);this.securityToken&&!G[T.headerPrefix+"security-token"]&&(G[T.headerPrefix+"security-token"]=this.securityToken);var oe=dc(new Date().toUTCString()),ie=oe[0],le=oe[1],ve=this.ak+"/"+ie+"/"+this.region+"/s3/aws4_request",pe=new Date;pe.setTime(parseInt(new Date().getTime(),10)+1e3*X),pe=Lf(pe.toUTCString()),G["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",G["X-Amz-Date"]=le,G["X-Amz-Credential"]=ve,R&&(G.bucket=R),j&&(G.key=j);var de=[];de.push('{"expiration":"'),de.push(pe),de.push('", "conditions":[');var ge=!0,we=!0,me=["acl","bucket","key","success_action_redirect","redirect","success_action_status"];for(var ke in G)if(ke){var Ae=G[ke];(ke=String(ke).toLowerCase())==="bucket"?ge=!1:ke==="key"&&(we=!1),jt.indexOf(ke)<0&&me.indexOf(ke)<0&&ke.indexOf(T.headerPrefix)!==0||(de.push('{"'),de.push(ke),de.push('":"'),de.push(Ae!==null?String(Ae):""),de.push('"},'))}ge&&de.push('["starts-with", "$bucket", ""],'),we&&de.push('["starts-with", "$key", ""],'),de.push("]}");var Me=de.join("");de=window.btoa?window.btoa(Me):_o.encode(Me);var $e=Nf(ie,this.sk,this.region,de);return{OriginPolicy:Me,Policy:de,Algorithm:G["X-Amz-Algorithm"],Credential:G["X-Amz-Credential"],Date:G["X-Amz-Date"],Signature:$e}};var Ik=st,Df=Number.MAX_VALUE;function Td(){this.consoleLog=window.console,this._level=Df}Td.prototype.setLevel=function(y){y&&(y=(y=String(y).toLowerCase())==="info"?20:y==="warn"?30:y==="error"?40:y==="debug"?10:Df,this._level=y)},Td.prototype.runLog=function(y,T,R){if(y){var j=[new Date().toLocaleString(),y.toLowerCase(),T,R].join("|");y.toLowerCase()==="debug"&&this._level<=10?this.consoleLog.debug(j):y.toLowerCase()==="info"&&this._level<=20?this.consoleLog.info(j):y.toLowerCase()==="warn"&&this._level<=30?this.consoleLog.warn(j):y.toLowerCase()==="error"&&this._level<=40&&this.consoleLog.error(j)}};var Nk=Td,Ok=u(1062),Dk=u.t(Ok,2),Bf=function(y){return Object.prototype.toString.call(y)==="[object String]"&&y.lastIndexOf("/")!==y.length-1&&(y+="/"),y},Bk={extend:function(y){y.prototype.dropFile=function(T,R){this.deleteObject(T,R)},y.prototype.dropFolder=function(T,R){var j=this;T=T||{};var X=(function(de,ge,we){de=de||function(){};var me=new Date().getTime();return function(ke,Ae){return ge.runLog("info","dropFolder","ObsClient cost "+(new Date().getTime()-me)+" ms"),Object.prototype.toString.call(ke)==="[object String]"?de(new Error(ke),Ae):de(ke,Ae)}})(R,j.log),G=(function(de){return de=de||function(){},function(ge,we,me){return Object.prototype.toString.call(me)==="[object Error]"?de(ge,we,me):Object.prototype.toString.call(me)==="[object String]"?de(ge,we,new Error(me)):me?me.CommonMsg.Status>300?de(ge,we,new Error("status:"+me.CommonMsg.Status+", code:"+me.CommonMsg.Code+", message:"+me.CommonMsg.Message)):void de(ge,we,me):void 0}})(T.EventCallback),U=T.TaskNum||1,oe=0,ie=[],le=function(de,ge,we,me){if(me)return ge.finished++,void we(ge);var ke=function(){oe++,j.dropFile({Bucket:ge.bucket,Key:de},function(Ae,Me){oe--,ge.finished++,(function(){for(;oe<U&&ie.length>0;)ie.shift()()})(),Ae?(G("dropFileFailed",de,Ae),ge.subDeleted=!1):Me.CommonMsg.Status>=300?(G("dropFileFailed",de,Me),ge.subDeleted=!1):G("dropFileSucceed",de,Me),we(ge)})};oe<U?ke():ie.push(ke)},ve=function(de,ge,we){return function(me){!me.isTruncated&&me.finished===me.total&&me.subDeleted&&le(de,ge,we,!1)}},pe=Bf(T.Prefix);(function de(ge,we,me,ke,Ae){oe++,j.listObjects({Bucket:we,Prefix:me,Delimiter:"/",Marker:ke},function(Me,$e){if(oe--,Me)return X(Me);if($e.CommonMsg.Status>=300)return X(null,$e);if(ge.total+=$e.InterfaceResult.Contents.length,ge.total+=$e.InterfaceResult.CommonPrefixes.length,ge.total!==0){ge.isTruncated=$e.InterfaceResult.IsTruncated==="true";for(var Le=function(Ze){return function(){de({total:0,finished:0,isTruncated:!1,bucket:we,subDeleted:!0},we,Ze,null,ve(Ze,ge,Ae))}},ze=0;ze<$e.InterfaceResult.CommonPrefixes.length;ze++){var Ne=Bf($e.InterfaceResult.CommonPrefixes[ze].Prefix);oe<U?de({total:0,finished:0,isTruncated:!1,bucket:we,subDeleted:!0},we,Ne,null,ve(Ne,ge,Ae)):ie.push(Le(Ne))}for(var Ve=0;Ve<$e.InterfaceResult.Contents.length;Ve++){var We=$e.InterfaceResult.Contents[Ve].Key;le(We,ge,Ae,We.lastIndexOf("/")===We.length-1)}ge.isTruncated&&(oe<U?de(ge,we,me,$e.InterfaceResult.NextMarker,Ae):ie.push(function(){de(ge,we,me,$e.InterfaceResult.NextMarker,Ae)}))}else Ae(ge)})})({total:0,finished:0,isTruncated:!1,bucket:T.Bucket,subDeleted:!0},T.Bucket,pe,null,function(de){if(!de.isTruncated&&de.finished===de.total)if(de.subDeleted)j.dropFile({Bucket:de.bucket,Key:pe},function(we,me){return we?(G("dropFileFailed",pe,we),X(we)):me.CommonMsg.Status>=300?(G("dropFileFailed",pe,me),X(null,me)):(G("dropFileSucceed",pe,me),X(null,me))});else{var ge="drop folder "+pe+" failed due to child file deletion failed";G("dropFileFailed",pe,new Error(ge)),X(ge)}})}}},qk=Bk,kd=5368709120,pc=function(y){var T=[];if(T.push(y.bucket),T.push(y.key),T.push(y.sourceFile.name),T.push(String(y.partSize)),T.push(String(y.partCount)),T.push(String(y.fileStat.fileSize)),T.push(String(y.fileStat.lastModified)),y.uploadId&&T.push(y.uploadId),y.sseC&&T.push(y.sseC),y.sseCKey&&T.push(y.sseCKey),y.parts)for(var R=0;R<y.parts.length;R++){var j=y.parts[R];j&&(T.push(String(j.partNumber)),T.push(String(j.offset)),T.push(String(j.partSize)),T.push(String(j.isCompleted)),j.etag&&T.push(String(j.etag)))}return window.btoa(Bn()(T.join(""),!1,!0))},Cd=function(y,T,R){y&&y.uploadId&&R.abortMultipartUpload({Bucket:y.bucket,Key:y.key,RequestDate:y.requestDate,UploadId:y.uploadId},function(j,X){j?R.log.runLog("warn",T,"abort multipart upload failed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId+", err:"+j):X.CommonMsg.Status>=300?R.log.runLog("warn",T,"abort multipart upload failed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId+", status:"+X.CommonMsg.Status+", code:"+X.CommonMsg.Code+", message:"+X.CommonMsg.Message):(delete y.uploadId,R.log.runLog("warn",T,"abort multipart upload succeed, bucket:"+y.bucket+", key:"+y.key+", uploadId:"+y.uploadId))})},qf=function(y){if(!(y.finishedCount<y.uploadCheckpoint.partCount)){if(y.isAbort)return Cd(y.uploadCheckpoint,y.funcName,y.that),y.callback("uploadFile failed the upload task is aborted");if(y.isSuspend)return y.callback("the process of uploadFile is suspened, you can retry with the uploadCheckpoint");if(y.hasError)return y.callback("uploadFile finished with error, you can retry with the uploadCheckpoint");for(var T=[],R=0;R<y.uploadCheckpoint.partCount;R++){var j=y.uploadCheckpoint.parts[R];T.push({PartNumber:j.partNumber,ETag:j.etag})}y.that.completeMultipartUpload({Bucket:y.uploadCheckpoint.bucket,Key:y.uploadCheckpoint.key,RequestDate:y.uploadCheckpoint.requestDate,UploadId:y.uploadCheckpoint.uploadId,Parts:T,CallbackUrl:y.callbackUrl,CallbackHost:y.callbackHost,CallbackBody:y.callbackBody,CallbackBodyType:y.callbackBodyType},function(X,G){var U={bucket:y.uploadCheckpoint.bucket,key:y.uploadCheckpoint.key,uploadId:y.uploadCheckpoint.uploadId};return X?(y.eventCallback("completeMultipartUploadFailed",U,X),y.callback(X)):G.CommonMsg.Status>=500?(y.eventCallback("completeMultipartUploadFailed",U,G),y.callback(null,G)):G.CommonMsg.Status>=300&&G.CommonMsg.Status<500?(y.eventCallback("completeMultipartUploadAborted",U,G),Cd(y.uploadCheckpoint,y.funcName,y.that),y.callback(null,G)):(y.eventCallback("completeMultipartUploadSucceed",U,G),void y.callback(null,G))})}},Ff=function(y){y.resumeCallback({cancel:function(){y.isSuspend=!0;for(var oe=0;oe<y.uploadPartParams.length;oe++){var ie=y.uploadPartParams[oe].cancelHook;le=ie,Object.prototype.toString.call(le)==="[object Function]"&&ie()}var le}},y.uploadCheckpoint);var T=[],R=function(){for(;y.runningTask<y.taskNum&&T.length>0;)T.shift()();T.length===0&&qf(y)},j=window.btoa?window.btoa:_o.encode,X=function(oe){return function(){if(y.runningTask++,y.isSuspend||y.isAbort)return y.runningTask--,y.finishedCount++,y.finishedCount+=T.length,T=[],R();var ie,le,ve,pe,de=0,ge=function(ke){if(!de){de=1;var Ae,Me={Bucket:y.uploadCheckpoint.bucket,Key:y.uploadCheckpoint.key,RequestDate:y.uploadCheckpoint.requestDate,PartNumber:oe.partNumber,UploadId:y.uploadCheckpoint.uploadId,SourceFile:y.uploadCheckpoint.sourceFile,Offset:oe.offset,PartSize:oe.partSize,SseC:y.uploadCheckpoint.sseC,SseCKey:y.uploadCheckpoint.sseCKey,ProgressCallback:(Ae=oe.partNumber,function($e,Le,ze){y.progressCallback(Ae,$e)}),ContentMD5:ke};y.uploadPartParams.push(Me),y.that.uploadPart(Me,function($e,Le){if(y.runningTask--,y.finishedCount++,y.isSuspend)return R();var ze={partNumber:oe.partNumber,bucket:y.uploadCheckpoint.bucket,key:y.uploadCheckpoint.key,uploadId:y.uploadCheckpoint.uploadId};$e?(y.eventCallback("uploadPartFailed",ze,$e),y.hasError=!0):Le.CommonMsg.Status>=500||Le.CommonMsg.Status===400&&Le.CommonMsg.Code==="BadDigest"?(y.eventCallback("uploadPartFailed",ze,Le),y.hasError=!0):Le.CommonMsg.Status>=300&&Le.CommonMsg.Status<500?(y.isAbort=!0,y.hasError=!0,y.eventCallback("uploadPartAborted",ze,Le)):(oe.etag=Le.InterfaceResult.ETag,oe.isCompleted=!0,ze.etag=oe.etag,y.uploadCheckpoint.md5=pc(y.uploadCheckpoint),y.eventCallback("uploadPartSucceed",ze,Le),y.that.log.runLog("debug",y.funcName,"Part "+String(oe.partNumber)+" is finished, uploadId "+y.uploadCheckpoint.uploadId)),R()})}};if(y.verifyMd5&&window.FileReader&&(y.uploadCheckpoint.sourceFile instanceof window.File||y.uploadCheckpoint.sourceFile instanceof window.Blob)){var we=(ie=y.uploadCheckpoint.sourceFile,le=oe.offset,ve=oe.offset+oe.partSize,pe=pe||ie.type,ie.mozSlice?ie.mozSlice(le,ve,pe):ie.webkitSlice?ie.webkitSlice(le,ve,pe):ie.slice(le,ve,pe)),me=new window.FileReader;return me.onload=function(ke){var Ae=(function($e){$e=new Uint8Array($e);for(var Le,ze=0;ze<$e.length;){var Ne=ze+16384;Ne=Ne<=$e.length?Ne:$e.length,Le?Le+=String.fromCharCode.apply(null,$e.slice(ze,Ne)):Le=String.fromCharCode.apply(null,$e.slice(ze,Ne)),ze=Ne}return $e=null,Le})(ke.target.result),Me=j(Bn()(Ae,!1,!0));Ae=null,ge(Me)},me.onerror=function(ke){y.that.log.runLog("error",y.funcName,"Caculate md5 for part "+String(oe.partNumber)+" failed"),ge()},void me.readAsArrayBuffer(we)}ge()}};if(!y.isSuspend){for(var G=0;G<y.uploadCheckpoint.partCount;G++){var U=y.uploadCheckpoint.parts[G];U.isCompleted?(y.finishedCount++,y.finishedBytes+=U.partSize):T.push(X(U))}return T.length===0?qf(y):R()}y.callback("the process of uploadFile is suspened, you can retry with the uploadCheckpoint")},Fk={extend:function(y){y.prototype.uploadFile=function(T,R){var j=this;T=T||{};var X="uploadFile",G=(function(Ne,Ve,We){Ne=Ne||function(){};var Ze=new Date().getTime();return function(bt,wt){return Ve.runLog("info","uploadFile","ObsClient cost "+(new Date().getTime()-Ze)+" ms"),Object.prototype.toString.call(bt)==="[object String]"?Ne(new Error(bt),wt):Ne(bt,wt)}})(R,j.log),U=(function(Ne){return Ne=Ne||function(){},function(Ve,We,Ze){return Object.prototype.toString.call(Ze)==="[object Error]"?Ne(Ve,We,Ze):Object.prototype.toString.call(Ze)==="[object String]"?Ne(Ve,We,new Error(Ze)):Ze?Ze.CommonMsg.Status>300?Ne(Ve,We,new Error("status:"+Ze.CommonMsg.Status+", code:"+Ze.CommonMsg.Code+", message:"+Ze.CommonMsg.Message)):void Ne(Ve,We,Ze):void 0}})(T.EventCallback),oe=T.TaskNum||1,ie=T.ProgressCallback||function(){},le=T.ResumeCallback||function(){},ve=T.VerifyMd5||!1;j.log.runLog("info",X,"enter uploadFile...");var pe=null;if(T.UploadCheckpoint&&T.UploadCheckpoint.sourceFile&&T.UploadCheckpoint.fileStat&&T.UploadCheckpoint.uploadId&&T.UploadCheckpoint.md5===pc(T.UploadCheckpoint)?pe=T.UploadCheckpoint:Cd(T.UploadCheckpoint,X,j),pe){var de=pe.sourceFile;if(!(de instanceof window.File||de instanceof window.Blob))return G("source file is not valid, must be an instanceof [File | Blob]");if(!de.mozSlice&&!de.webkitSlice&&!de.slice)return G("your browser cannot support the slice method for [File | Blob]")}else{var ge=T.SourceFile;if(!(ge instanceof window.File||ge instanceof window.Blob))return G("source file is not valid, must be an instanceof [File | Blob]");if(!ge.mozSlice&&!ge.webkitSlice&&!ge.slice)return G("your browser cannot support the slice method for [File | Blob]");j.log.runLog("debug",X,"Begin to uploadFile to OBS from file:"+ge.name);var we=ge.size,me=parseInt(T.PartSize,10),ke=0,Ae=[];if(we===0)me=0,ke=1,Ae.push({partNumber:1,offset:0,partSize:0,isCompleted:!1});else{if(me=isNaN(me)||me<102400?9437184:me>kd?kd:me,(ke=Math.floor(we/me))>=1e4&&(me=Math.floor(we/1e4),we%1e4!=0&&(me+=1),ke=Math.floor(we/me)),me>kd)return G("The source file "+ge.name+" is too large");var Me=we%me;Me!==0&&ke++;for(var $e=0;$e<ke;$e++)Ae.push({partNumber:$e+1,offset:$e*me,partSize:me,isCompleted:!1});Me!==0&&(Ae[ke-1].partSize=Me)}j.log.runLog("debug",X,"Total parts count "+ke),(pe={bucket:T.Bucket,key:T.Key,sourceFile:ge,partSize:me,partCount:ke,parts:Ae}).fileStat={fileSize:we,lastModified:ge.lastModified},T.SseC&&T.SseCKey&&(pe.sseC=T.SseC,pe.sseCKey=T.SseCKey),pe.md5=pc(pe)}pe.requestDate=T.RequestDate;var Le={start:new Date().getTime(),uploadCheckpoint:pe,funcName:X,taskNum:oe,callback:G,that:j,runningTask:0,finishedCount:0,hasError:!1,finishedBytes:0,isAbort:!1,resumeCallback:le,isSuspend:!1,partsLoaded:{},requestDate:T.RequestDate,uploadPartParams:[],verifyMd5:ve,callbackUrl:T.CallbackUrl,callbackHost:T.CallbackHost,callbackBody:T.CallbackBody,callbackBodyType:T.CallbackBodyType,eventCallback:function(Ne,Ve,We){Le.isSuspend||U(Ne,Ve,We)},progressCallback:function(Ne,Ve){Le.isSuspend||(Le.finishedBytes+=Ve,Le.partsLoaded[Ne]&&(Le.finishedBytes-=Le.partsLoaded[Ne]),Le.partsLoaded[Ne]=Ve,ie(Le.finishedBytes,Le.uploadCheckpoint.fileStat.fileSize,(new Date().getTime()-Le.start)/1e3))}};if(!pe.uploadId){var ze=T.ContentType;return!ze&&pe.key&&(ze=j.util.mimeTypes[pe.key.substring(pe.key.lastIndexOf(".")+1)]),!ze&&pe.sourceFile.name&&(ze=j.util.mimeTypes[pe.sourceFile.name.substring(pe.sourceFile.name.lastIndexOf(".")+1)]),void j.initiateMultipartUpload({Bucket:T.Bucket,Key:T.Key,RequestDate:T.RequestDate,ACL:T.ACL,Metadata:T.Metadata,WebsiteRedirectLocation:T.WebsiteRedirectLocation,StorageClass:T.StorageClass,ContentType:ze,Expires:T.Expires,SseKms:T.SseKms,SseKmsKey:T.SseKmsKey,SseC:T.SseC,SseCKey:T.SseCKey},function(Ne,Ve){var We={bucket:T.Bucket,key:T.Key};if(Ne)return Le.eventCallback("initiateMultipartUploadFailed",We,Ne),G(Ne);if(Ve.CommonMsg.Status>=300)return Le.eventCallback("initiateMultipartUploadFailed",We,Ve),G(null,Ve);var Ze=Ve.InterfaceResult.UploadId;pe.uploadId=Ze,pe.md5=pc(pe),Le.uploadCheckpoint=pe,We.uploadId=Ze,j.log.runLog("info",X,"Claim a new upload id "+Ze),Le.eventCallback("initiateMultipartUploadSucceed",We,Ve),Ff(Le)})}Ff(Le)}}},Rk=Fk;function Fe(y){this.factory(y)}function Rf(y){return y.slice(0,1).toUpperCase()+y.slice(1)}var jf=["createBucket","listBuckets","getBucketMetadata","headBucket","deleteBucket","setBucketQuota","getBucketQuota","getBucketStorageInfo","setBucketPolicy","getBucketPolicy","deleteBucketPolicy","setBucketVersioningConfiguration","getBucketVersioningConfiguration","putBackToSource","deleteBackToSource","getBackToSource","getBucketLocation","listVersions","listObjects","setBucketLifecycleConfiguration","getBucketLifecycleConfiguration","deleteBucketLifecycleConfiguration","setBucketAcl","getBucketAcl","setBucketLoggingConfiguration","getBucketLoggingConfiguration","setBucketWebsiteConfiguration","getBucketWebsiteConfiguration","deleteBucketWebsiteConfiguration","setBucketNotification","getBucketNotification","setBucketTagging","getBucketTagging","deleteBucketTagging","getBucketCors","deleteBucketCors","setBucketStoragePolicy","getBucketStoragePolicy","getObject","getObjectMetadata","setObjectMetadata","setObjectAcl","getObjectAcl","deleteObject","deleteObjects","listMultipartUploads","listParts","abortMultipartUpload","completeMultipartUpload","getBucketInventory","setBucketInventory","deleteBucketInventory","getBucketEncryption","setBucketEncryption","deleteBucketEncryption","getBucketRequesterPay","setBucketRequesterPay","setMirrorBackToSource","getMirrorBackToSource","deleteMirrorBackToSource","getWorkflowTrigger","deleteWorkflowTrigger","createWorkflowTrigger","restoreFailedWorkflowExecution","createTemplate","createWorkflow","getWorkflowList","deleteWorkflow","getWorkflowTemplateList","getWorkflowInstanceList","deleteTemplate","updateWorkflow","getActionTemplates","getWorkflowAuthorization","openWorkflowAuthorization","getBucketDirectColdAccess","setBucketDirectColdAccess","deleteBucketDirectColdAccess","getBucketCustomDomain","setBucketCustomDomain","deleteBucketCustomDomain","setBucketCors","getBucketReplication","setBucketReplication","deleteBucketReplication","getCDNNotifyConfiguration","setCdnNotifyConfiguration","getQuota","getBucketDisPolicy","setBucketDisPolicy","deleteBucketDisPolicy","createOnlineDecom","getOnlineDecom","getWorkflowAgreements","openWorkflowAgreements","deleteOnlineDecom","getMyActionTemplates","createMyActionTemplate","getMyactiontemplateDetail","updateMyActionTemplate","deleteMyActionTemplate","forbidMyActionTemplate","updatePublicActionTemplate","getOmPublicActionTemplates","setSFSAcl","getSFSAcl","deleteSFSAcl","setBucketAlias","bindBucketAlias","unbindBucketAlias","deleteBucketAlias","listBucketsAlias","getBucketAlias"];function jk(y){return function(T,R){this.exec(Rf(y),T,R)}}for(var Ad=0;Ad<jf.length;Ad++){var zf=jf[Ad];Fe.prototype[zf]=jk(zf)}function Sd(y){return Object.prototype.toString.call(y)==="[object Function]"}function zk(y){return function(T,R){if(Sd(T))y.call(this,null,T);else{if(!Sd(R)){var j=this;return new Promise(function(X,G){y.call(j,T,function(U,oe){if(U)return G(U);X(oe)})})}y.call(this,T,R)}}}if(Fe.prototype.createTemplate=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("CreateTemplate",y,T)},Fe.prototype.createWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("CreateWorkflow",y,T)},Fe.prototype.restoreFailedWorkflowExecution=function(y,T){y.ApiPath="v2/workflowexecutions",this.exec("RestoreFailedWorkflowExecution",y,T)},Fe.prototype.getWorkflowList=function(y,T){y.ApiPath="v2/workflows",this.exec("GetWorkflowList",y,T)},Fe.prototype.deleteWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("DeleteWorkflow",y,T)},Fe.prototype.deleteTemplate=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("DeleteTemplate",y,T)},Fe.prototype.getWorkflowTemplateList=function(y,T){y.ApiPath="v2/workflowtemplates",this.exec("GetWorkflowTemplateList",y,T)},Fe.prototype.getWorkflowInstanceList=function(y,T){y.ApiPath="v2/workflowexecutions",this.exec("GetWorkflowInstanceList",y,T)},Fe.prototype.updateWorkflow=function(y,T){y.ApiPath="v2/workflows",this.exec("UpdateWorkflow",y,T)},Fe.prototype.getActionTemplates=function(y,T){y.ApiPath="v2/actiontemplates",this.exec("GetActionTemplates",y,T)},Fe.prototype.getWorkflowAuthorization=function(y,T){y.ApiPath="v2/workflow-authorization",this.exec("GetWorkflowAuthorization",y,T)},Fe.prototype.openWorkflowAuthorization=function(y,T){y.ApiPath="v2/workflow-authorization",this.exec("OpenWorkflowAuthorization",y,T)},Fe.prototype.getPublicationTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/publicactiontemplates",this.exec("GetPublicationTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.getPublicationTemplateDetail=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/publicactiontemplates",this.exec("GetPublicationTemplateDetail",y,T),this.util.pathStyle=!1},Fe.prototype.getWorkflowAgreements=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/workflow-agreements",this.exec("GetWorkflowAgreements",y,T),this.util.pathStyle=!1},Fe.prototype.openWorkflowAgreements=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/workflow-agreements",this.exec("OpenWorkflowAgreements",y,T),this.util.pathStyle=!1},Fe.prototype.createMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("CreateMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.getMyActionTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("GetMyActionTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.getMyactiontemplateDetail=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("GetMyactiontemplateDetail",y,T),this.util.pathStyle=!1},Fe.prototype.updateMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("UpdateMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.deleteMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("DeleteMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.forbidMyActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/myactiontemplates",this.exec("ForbidMyActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.updatePublicActionTemplate=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/ompublicactiontemplates",this.exec("UpdatePublicActionTemplate",y,T),this.util.pathStyle=!1},Fe.prototype.getOmPublicActionTemplates=function(y,T){this.util.pathStyle=!0,y.ApiPath="v2/ompublicactiontemplates",this.exec("GetOmPublicActionTemplates",y,T),this.util.pathStyle=!1},Fe.prototype.putObject=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time,please specify one of eigther a string or file to be send!";return this.log.runLog("error","PutObject",R),T(new Error(R),null)}if(!("ContentType"in y)&&("Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),!y.ContentType&&"SourceFile"in y)){var j=y.SourceFile.name;y.ContentType=this.util.mimeTypes[j.substring(j.lastIndexOf(".")+1)]}this.exec("PutObject",y,T)},Fe.prototype.appendObject=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time,please specify one of eigther a string or file to be send!";return this.log.isLevelEnabled("error")&&this.log.runLog("error","PutObject",R),T(new Error(R),null)}"ContentType"in y||("Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),!y.ContentType&&"SourceFile"in y&&(y.ContentType=this.util.mimeTypes[y.SourceFile.substring(y.SourceFile.lastIndexOf(".")+1)])),this.exec("AppendObject",y,T)},Fe.prototype.copyObject=function(y,T){var R="CopySource";if(R in y){var j=y[R],X=j.lastIndexOf("?versionId=");y[R]=X>0?this.util.encodeURIWithSafe(j.slice(0,X))+j.slice(X):this.util.encodeURIWithSafe(j)}this.exec("CopyObject",y,T)},Fe.prototype.copyPart=function(y,T){var R="CopySource";if(R in y){var j=y[R],X=j.lastIndexOf("?versionId=");y[R]=X>0?this.util.encodeURIWithSafe(j.slice(0,X))+j.slice(X):this.util.encodeURIWithSafe(j)}this.exec("CopyPart",y,T)},Fe.prototype.restoreObject=function(y,T){this.exec("RestoreObject",y,function(R,j){!R&&j.InterfaceResult&&j.CommonMsg.Status<300&&(j.InterfaceResult.RestoreStatus=j.CommonMsg.Status===200?"AVALIABLE":"INPROGRESS"),T(R,j)})},Fe.prototype.initiateMultipartUpload=function(y,T){"ContentType"in y||"Key"in y&&(y.ContentType=this.util.mimeTypes[y.Key.substring(y.Key.lastIndexOf(".")+1)]),this.exec("InitiateMultipartUpload",y,T)},Fe.prototype.uploadPart=function(y,T){if("Body"in y&&"SourceFile"in y){var R="the input body and sourcefile exist at same time, please specify one of eigther a string or file to be send!";return this.log.runLog("error","UploadPart",R),T(new Error(R),null)}this.exec("UploadPart",y,T)},qk.extend(Fe),Rk.extend(Fe),Sd(Promise)){for(var Ed in Fe.prototype)if({}.hasOwnProperty.call(Fe.prototype,Ed)){var Uk=Fe.prototype[Ed];Fe.prototype[Ed]=zk(Uk)}}for(var $d in Fe.prototype.exec=function(y,T,R){var j=this.log;j.runLog("info",y,"enter "+y+"...");var X=new Date().getTime();T=T||{},R=R||function(){},this.util.exec(y,T,function G(U,oe){G.$called||(G.$called=!0,!U||U instanceof Error||(U=new Error(U)),j.runLog("debug",y,"ObsClient cost "+(new Date().getTime()-X)+" ms"),R(U,oe))})},Fe.prototype.initLog=function(y){y=y||{},this.log.setLevel(y.level);var T=["[OBS SDK Version="+this.util.obsSdkVersion];if(this.util.server){var R=this.util.port?":"+this.util.port:"";T.push("Endpoint="+(this.util.is_secure?"https":"http")+"://"+this.util.server+R)}T.push("Access Mode="+(this.util.path_style?"Path":"Virtual Hosting")+"]"),this.log.runLog("warn","init",T.join("];["))},Fe.prototype.factory=function(y){this.log=new Nk,this.util=new Ik(this.log),y=y||{},this.util.initFactory(y.access_key_id,y.secret_access_key,y.is_secure,y.server,y.path_style,y.signature,y.region,y.port,y.timeout,y.security_token,y.is_signature_negotiation,y.is_cname,y.url_prefix,y.region_domains,y.setRequestHeaderHook,y.useRawXhr)},Fe.prototype.refresh=function(y,T,R){this.util.refresh(y,T,R)},Fe.prototype.createSignedUrlSync=function(y){return this.util.createSignedUrlSync(y)},Fe.prototype.createV2SignedUrlSync=function(y){return this.util.createV2SignedUrlSync(y)},Fe.prototype.createV4SignedUrlSync=function(y){return this.util.createV4SignedUrlSync(y)},Fe.prototype.createPostSignatureSync=function(y){return this.util.createPostSignatureSync(y)},Fe.prototype.createV4PostSignatureSync=function(y){return this.util.createV4PostSignatureSync(y)},Fe.prototype.enums=Dk,Fe.prototype)({}).hasOwnProperty.call(Fe.prototype,$d)&&(Fe.prototype[Rf($d)]=Fe.prototype[$d]);for(var Ks in Fe.prototype)if({}.hasOwnProperty.call(Fe.prototype,Ks)){var Pd=Ks.indexOf("Configuration");Pd>0&&Pd+13===Ks.length&&(Fe.prototype[Ks.slice(0,Pd)]=Fe.prototype[Ks])}var Vk=Fe})(),m.default})()}).call(this,r(5),r(4).Buffer)},function(n,o,r){var i="";i=r(6);var a={document:"doc,docx,xls,xlsx,ppt,pptx,pdf,txt,epub,pps,psd,xmind,dwg",image:"png,jpg,gif,jpeg,bmp",video:"mp4,avi,wmv,rm,rmvb,mpeg,mpg,mkv,mov,flv",audio:"mp3,wav,wma",zip:"zip,rar,7z",flash:"swf",srt:"srt",favico:"ico"},l=["document","image","video","audio","zip","flash","srt"];function s(d,u,m){if(d.indexOf(u)>-1){var h=new RegExp("("+u+"=)([^&]*)","gi");d=d.replace(h,u+"="+m)}else{var p=u+"="+m,v=d.indexOf("?");v<0?d+="?":v>=0&&v!=d.length-1&&(d+="&"),d+=p}return d}function c(d){d=d||{},this.multiple=!!d.multiple,this.maxSize=d.maxSize||512,this.fileTypes=d.fileTypes&&d.fileTypes.length>0?d.fileTypes:l,this.exts=d.exts||"",this.accetp="",this.mode=d.mode||"huawei",this.files=[],this.$trigger="",this.uptokenHost=d.uptokenHost||"https://courseapi.tongshike.cn",this.obsHost=d.obsHost||"",this.m3u8=d.m3u8,this.authorization=d.authorization,this.obsSign=d.obsSign,this.config=d.config||{},this.putExtra=d.putExtra||{},this.config.uphost||(this.config.uphost=""),this.obsHost&&this.obsHost.charAt(this.obsHost.length-1)=="/"&&(this.obsHost=this.obsHost.substring(0,this.obsHost.length-1))}c.prototype.initUpBtn=function(d){this.$trigger=d;var u=this,m=[];if(this.fileTypes.length>0)for(var h=0;h<this.fileTypes.length;h++){var p=this.fileTypes[h];m.push(a[p])}for(m=m.join(","),this.exts&&(m=this.exts),m=m.split(","),h=0;h<m.length;h++)m[h]="."+m[h];this.accetp=m.join(","),this.$el=document.createElement("input"),this.$el.style.display="none",this.$el.type="file",this.multiple&&this.$el.setAttribute("multiple",!0),this.$el.accept=this.accetp,document.body.appendChild(this.$el),this.$el.onchange=function(){this.files.length>0&&(u.handleFileChange(this.files),u.$el.value="")},this.$trigger.onclick=function(){u.$el.click()}},c.prototype.handleFileChange=function(d){this.uploadFiles(d)},c.prototype.uploadFiles=function(d){for(var u=0;u<d.length;u++){var m=d[u];if(m.ext=m.name.substring(m.name.lastIndexOf(".")).toLowerCase(),m.key="resources/web/"+Date.now()+Math.round(1e4*Math.random())+m.ext,m.percent=0,this.accetp.indexOf(m.ext)===-1)return this.error(m,{code:50001,msg:"不支持该类型文件"});if(1024*this.maxSize*1024<m.size)return this.error(m,{code:50002,msg:"文件不能超过"+this.maxSize+"mb"});this.onBeforeUpload&&this.onBeforeUpload(m),this.startUpload(m)}},c.prototype.startUpload=function(d){var u=this;switch(u.files.push(d),this.mode){case"qiniu":u.getToken(d,function(m){u.qiniuUploadByToken(d,m)});break;case"huawei":d.ext=d.ext||d.name.substring(d.name.lastIndexOf(".")),d.key=d.key||"resources/web/"+Date.now()+Math.round(1e4*Math.random())+d.ext,u.getObsClient(d.key,function(){u.putObject(d)})}},c.prototype.qiniuUploadByToken=function(d,u){var m=this;d.obsHost=m.obsHost,d.size>4194304&&(m.config.chunkSize=5);var h="".upload(d,d.key,u,m.putExtra,m.config);d.subscription=h.subscribe({next:function(p){m.onProgress&&m.onProgress(d,p.total.percent),d.onProgress&&d.onProgress(p.total.percent)},error:function(p){m.error(d,{code:50071,msg:"上传失败",err:p})},complete:function(p){d.duration=p.duration,d.key=p.key,m.success(d)}})},c.prototype.putObject=function(d){var u=this;this.obsClient.putObject({Bucket:u.obsClientConfig.bucket,Key:d.key,Metadata:{property:"property-value"},SourceFile:d,ProgressCallback:function(m,h,p){var v=Math.floor(100*m/h);v=v>99?99:v,d.percent=v,u.onProgress&&u.onProgress(d,v),d.onProgress&&d.onProgress(v)}}).then(function(m){if(console.log(m),m.CommonMsg.Status<300){d.obsHost=u.obsHost,d.ext.toLowerCase().includes("wma")&&(d.originKey=d.key,d.key=d.key.substring(0,d.key.lastIndexOf("."))+".mp3",u.hwAudioTranscoding(d)),d.ext.toLowerCase().includes("mp3")&&u.hwMp3Transcoding(d),d.ext.substring(1).toLowerCase();var h=u.getFileType(d.key);h=="video"?(u.m3u8&&(d.m3u8Key="resources/web/"+Date.now()+Math.round(1e4*Math.random())+".m3u8"),u.hwVideoTranscoding(d)):h=="audio"?u.getHuaweiMetadata(d.originKey||d.key,function(p){d.duration=p.duration,u.success(d)}):u.success(d)}}).catch(function(m){u.error(d,{code:50081,msg:"上传失败",err:m})})},c.prototype.download=function(d,u){var m=d.substring(d.lastIndexOf("/")+1);if(d.indexOf("?")>-1){var h=d.substring(0,d.lastIndexOf("?"));m=h.substring(h.lastIndexOf("/")+1)}u=u||m,this.mode=="qiniu"?this.qiniuDownload(d,u):this.huaweiDownload(d,u)},c.prototype.getDownloadUrl=function(d,u,m){var h=d.substring(d.lastIndexOf("/")+1);if(d.indexOf("?")>-1){var p=d.substring(0,d.lastIndexOf("?"));h=p.substring(p.lastIndexOf("/")+1)}u=u||h,this.mode=="qiniu"?m(s(d,"attname",u)):this.getHuaweiDownloadUrl(d,u,m)},c.prototype.getHuaweiDownloadUrl=function(d,u,m){var h=this,p=d.replace(/^(http|https):\/\/[^/]+\//,"");this.getDownloadObsClient(p,function(){h.getFileType(p)=="video"&&(p=p.substring(0,p.lastIndexOf("."))+".mp4",u=u.substring(0,u.lastIndexOf("."))+".mp4");var v=h.obsClient.createSignedUrlSync({Method:"GET",Bucket:h.obsClientConfig.bucket,Key:p,QueryParams:{"response-content-disposition":"attachment;fileName="+encodeURIComponent(u)},Expires:3600});m(v.SignedUrl)})},c.prototype.qiniuDownload=function(d,u){var m=s(d,"attname",u);window.open(m)},c.prototype.huaweiDownload=function(d,u){this.getHuaweiDownloadUrl(d,u,function(m){var h=document.createElement("a");h.style.display="none",h.href=m,document.body.appendChild(h),h.click()})},c.prototype.cancelUpload=function(d){switch(this.mode){case"qiniu":d.subscription.unsubscribe()}},c.prototype.error=function(d,u){this.onError&&this.onError(d,u),d&&d.onError&&d.onError(u)},c.prototype.success=function(d){d.isSuccessCalled||(d.percent=100,this.onProgress&&this.onProgress(d,100),d.onProgress&&d.onProgress(100),this.onSuccess&&this.onSuccess(d),d.onSuccess&&d.onSuccess(d),d.isSuccessCalled=!0)},c.prototype.getToken=function(d,u){var m=this;d.name&&d.name!=""||(d.name=String(new Date().getTime()+d.ext));var h=this.uptokenHost+"/files/getUptoken?fileName="+encodeURIComponent(d.name),p=new XMLHttpRequest;p.open("get",h),p.setRequestHeader("AUTHORIZATION",this.authorization),p.onreadystatechange=function(){if(p.readyState===4)if(p.status===200){var v=JSON.parse(p.responseText).uptoken;u&&u(v)}else m.error(d,{code:50070,msg:"上传失败"})},p.send(),console.log(p)},c.prototype.getObsClient=function(d,u){var m=this,h=this.uptokenHost+"/obs/uploadToken",p=new XMLHttpRequest;this.obsSign&&(h=this.uptokenHost+"/obs/uploadToken/sign"),p.open("get",h+"?path="+d,!0),this.obsSign?p.setRequestHeader("obsSign",this.obsSign):p.setRequestHeader("authorization",this.authorization),p.onreadystatechange=function(){m.getObsConfigCb(p,u)},p.send()},c.prototype.getDownloadObsClient=function(d,u){var m=this,h=this.uptokenHost+"/obs/downloadToken",p=new XMLHttpRequest;p.open("get",h+"?path="+d,!0),p.onreadystatechange=function(){m.getObsConfigCb(p,u)},p.send()},c.prototype.getObsConfigCb=function(d,u){if(d.readyState===4)if(d.status===200){var m=JSON.parse(d.responseText);m.code==1?(this.obsClientConfig=m.result,this.obsClient=new i({access_key_id:m.result.ak,secret_access_key:m.result.sk,security_token:m.result.securitytoken,server:m.result.endpoint,timeout:1800}),this.obsHost=this.obsClientConfig.domain,u&&u()):this.error("",{code:50080,msg:"上传失败"})}else this.error("",{code:50080,msg:"上传失败"})},c.prototype.getObjectData=function(d,u,m){var h=this;this.getDownloadObsClient(d,function(){h.obsClient.getObject({Bucket:h.obsClientConfig.bucket,Key:d},function(p,v){p?(console.error("Error-->"+p),m&&m(p)):v.CommonMsg.Status==200&&v.InterfaceResult&&u&&u(v.InterfaceResult)})})},c.prototype.dataURLtoBlob=function(d){for(var u=d.split(","),m=u[0].match(/:(.*?);/)[1],h=atob(u[1]),p=h.length,v=new Uint8Array(p);p--;)v[p]=h.charCodeAt(p);return new Blob([v],{type:m})},c.prototype.hwVideoTranscoding=function(d){var u=this,m=d.key.substring(d.key.indexOf("resources/")),h=m.substring(m.lastIndexOf("/")+1);h=h.substring(0,h.lastIndexOf("."));var p=this.uptokenHost+"/obs/transcoding/video/multi?path="+m,v=[{outputFileName:h,outputFormat:"mp4"}];if(this.m3u8){var f=d.m3u8Key.substring(d.m3u8Key.lastIndexOf("/")+1);f=f.substring(0,f.lastIndexOf(".")),v.push({outputFileName:f,outputFormat:"m3u8"})}var b=new XMLHttpRequest;b.onreadystatechange=function(){if(b.readyState===4){var x=JSON.parse(b.responseText);x.code==1?u.getVideoMetadata(d,function(){u.success(d)},function(){var w=setInterval(function(){console.log(Date.now()),u.getMediaLength(d.key,function(E){d.duration=E,u.success(d),clearInterval(w)})},3e3)}):x.code==2?(d.m3u8Key="",u.success(d)):x.code==0?u.error(d,{code:50082,msg:"文件编码格式无法解析,请尝试转码成mp4后再上传。"}):u.error(d,{code:50081,msg:"上传失败"})}},b.open("POST",p,!0),b.setRequestHeader("Content-Type","application/json"),b.send(JSON.stringify(v))},c.prototype.hwAudioTranscoding=function(d){if(d.ext.toLowerCase().includes("wma")){var u=d.key.substring(0,d.key.lastIndexOf("."))+d.ext,m=u.substring(u.lastIndexOf("/")+1);m=m.substring(0,m.lastIndexOf("."));var h=this.uptokenHost+"/obs/transcoding/audio?path="+u+"&outputFileName="+m,p=new XMLHttpRequest;p.onreadystatechange=function(){if(p.readyState===4){var v=JSON.parse(p.responseText);console.log(v)}},p.open("POST",h,!0),p.setRequestHeader("Content-Type","application/json"),p.send()}},c.prototype.hwMp3Transcoding=function(d){var u=this.uptokenHost+"/obs/transcoding/mp3?path="+d.key,m=new XMLHttpRequest;m.onreadystatechange=function(){if(m.readyState===4){var h=JSON.parse(m.responseText);console.log(h)}},m.open("POST",u,!0),m.setRequestHeader("authorization",this.authorization),m.setRequestHeader("Content-Type","application/json"),m.send()},c.prototype.getFileType=function(d){var u=d.substring(d.lastIndexOf(".")+1).toLowerCase();for(var m in a)if(a[m].includes(u))return m;return""},c.prototype.getVideoMetadata=function(d,u,m){var h=document.createElement("video");h.src=URL.createObjectURL(d),h.addEventListener("loadedmetadata",function(){console.log(h),h.duration!=1/0?(d.duration=h.duration,u&&u()):m&&m()}),h.addEventListener("error",function(p){console.log(p),m&&m()})},c.prototype.getHuaweiMetadata=function(d,u){var m=this.uptokenHost+"/obs/video/info?path="+d,h=new XMLHttpRequest;h.open("GET",m,!0),h.onreadystatechange=function(){if(h.readyState===4){var p=JSON.parse(h.responseText);p.code==1&&u&&u(p.result)}},h.send()},c.prototype.getMediaLength=function(d,u){var m=this.uptokenHost+"/obs/video/length?path="+d,h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState===4){var p=JSON.parse(h.responseText);p.code==1&&u&&u(p.result)}},h.open("GET",m,!0),h.send()},n.exports=c}])})})(Sp)),Sp.exports}var Yin=Win();const Pk=Ym(Yin),Xin=Ce.defineComponent({name:"FileList",components:{Preview:Gin,TinyBaseSelect:cs,TinyOption:Hi,TinyDialogBox:Qr,TinyButton:Pt},props:{list:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},type:{type:String,default:"block"},isPreview:{type:Boolean,default:!0},isShowLimitTimes:{type:Boolean,default:!0},canPreview:{type:Boolean,default:!0},editorble:{type:Boolean,default:!1},showDownLoad:{type:Boolean,default:!0},isQuestionBank:{type:Boolean,default:!1},hideFullScreen:{type:Boolean,default:!1},customFullSreen:{type:Boolean,default:!0},audioMode:{type:String,default:"bar"},isMobile:{type:Boolean,default:!1},audioTime:{type:Number,default:0},actionIndex:{type:Number,default:0}},setup(t,{emit:e}){const n=lc(),o=Ce.ref(!1),r=Ce.reactive({item:{},index:0});return{...Ce.reactive({obs:{},currentFile:{},playerTimes:[-1,1,2,3,4,5]}),t:n,fileIcon:Ain,getFileSvg:Tin,formatSize:Cin,cancelUpload:(h,p)=>{h.cancel&&h.cancel(),e("deleteFile",h,p)},deleteFile:(h,p)=>{r.item=h,r.index=p,o.value=!0},download:h=>{new Pk(t.uploadOptions).download(h)},showPreview:h=>{},isFileCanPreview:h=>{const p=ta(h.fileUrl);return["audio","video","image","document"].includes(p)},isAudio:h=>ta(h.fileUrl)==="audio",boxVisibility:o,curDeleteFile:r,deleteConfirm:()=>{e("deleteFile",r.item,r.index),o.value=!1}}}});var Zin=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"files-component"},[e.list&&e.list.length>0&&e.type==="block"?n("ul",{staticClass:"file-list-block"},e._l(e.list,function(o,r){return n("li",{key:r+o.fileUrl+o.fileKey},[!e.isPreview||o.status===1||o.status===3?[n("div",{staticClass:"icon-wrapper"},[n("img",{staticClass:"svg-img",attrs:{src:e.getFileSvg(o.fileUrl),alt:""}})]),n("div",{staticClass:"detail"},[n("div",{staticClass:"name"},[e._v(e._s(o.fileName))]),n("div",{staticClass:"info"},[n("span",{staticClass:"size"},[e._v(e._s(e.formatSize(o.fileSize)))]),e.mode==="edit"&&o.progress>=0&&o.progress<100&&o.status!==3?n("div",{staticClass:"progress-wrapper"},[n("div",{staticClass:"progress-bar"},[n("div",{staticClass:"bar",style:{width:o.progress+"%"}})]),n("span",{staticClass:"progress-value"},[e._v(e._s(o.progress)+"%")]),n("span",{staticClass:"cancel",on:{click:function(i){return e.cancelUpload(o,r)}}},[e._v(e._s(e.t("cancel")))])]):n("div",{staticClass:"operations"},[o.status===3?n("span",{staticClass:"upload-fail"},[e._v(e._s(o.errMessage))]):e._e(),e.mode==="edit"?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return i.stopPropagation(),e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")]):e._e()])])])]:e.isPreview&&o.status!==3?n("div",{staticClass:"preview-container"},[n("div",{staticClass:"preview-content",class:{"audio-preview":e.isAudio(o)}},[n("Preview",{attrs:{resource:o,times:e.isShowLimitTimes?o.lisCount:0,"is-question-bank":e.isQuestionBank,showDownLoad:e.showDownLoad,customFullSreen:e.customFullSreen,audioMode:e.audioMode,isMobile:e.isMobile,audioTime:e.audioTime}}),e.mode==="edit"?n("div",{staticClass:"operations"},[n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return i.stopPropagation(),e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")])]):e._e()],1)]):e._e()],2)}),0):e._e(),e.list&&e.list.length>0&&e.type==="inline"?n("div",[n("ul",{staticClass:"file-list-inline"},e._l(e.list,function(o,r){return n("li",{key:r},[n("img",{staticClass:"svg-img",attrs:{src:e.getFileSvg(o.fileUrl),alt:""}}),n("span",{staticClass:"name"},[e._v(e._s(o.fileName))]),n("span",{staticClass:"size"},[e._v(e._s(e.formatSize(o.fileSize)))]),e.mode==="edit"&&o.progress>=0&&o.progress<100?n("div",{staticClass:"progress-wrapper"},[n("div",{staticClass:"progress-bar"},[n("div",{staticClass:"bar",style:{width:o.progress+"%"}})]),n("span",{staticClass:"progress-value"},[e._v(e._s(o.progress)+"%")]),n("span",{staticClass:"cancel",on:{click:function(i){return e.cancelUpload(o,r)}}},[e._v(e._s(e.t("cancel")))])]):e._e(),e.canPreview&&e.isFileCanPreview(o)&&o.status!==3?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.showPreview(o)}}},[e._v(" "+e._s(e.t("view"))+" ")]):e._e(),o.status===3?n("span",{staticClass:"upload-fail"},[e._v(e._s(o.errMessage))]):e._e(),e.mode==="edit"?n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.deleteFile(o,r)}}},[e._v(" "+e._s(e.t("delete"))+" ")]):n("a",{staticClass:"ul-link",attrs:{href:"javascript:;"},on:{click:function(i){return e.download(o.fileUrl)}}},[e._v(" "+e._s(e.t("download"))+" ")])])}),0)]):e._e(),n("TinyDialogBox",{attrs:{title:e.t("messageTip"),width:"40%","append-to-body":!0},scopedSlots:e._u([{key:"footer",fn:function(){return[n("TinyButton",{on:{click:function(o){e.boxVisibility=!1}}},[e._v(e._s(e.t("cancel")))]),n("TinyButton",{attrs:{type:"primary"},on:{click:e.deleteConfirm}},[e._v(e._s(e.t("confirm")))])]},proxy:!0}]),model:{value:e.boxVisibility,callback:function(o){e.boxVisibility=o},expression:"boxVisibility"}},[n("span",[e._v(e._s(e.t("confirmDelete")))])])],1)},Jin=[],ean=Nn(Xin,Zin,Jin,!1,null,"8204fcc8");const cc=ean.exports,tan={obsHost:Sk,uptokenHost:Kae,authorization:eo.get("token")||eo.get("authorization")};class nan{constructor({id:e=0,fileName:n="",fileSize:o="",fileType:r="",fileUrl:i="",srt:a="",avatar:l="",lisCount:s=-1,progress:c=0,status:d=0,markedImage:u="",angle:m=0,location:h,title:p,contentSize:v,type:f}){this.id=e||Bu(),this.fileName=n||p,this.fileSize=o||v,this.fileType=r||f,this.fileUrl=i||h,this.srt=a,this.avatar=l||"",this.lisCount=s,this.progress=c,this.status=d,this.markedImage=u,this.angle=m}handleOldAttach(e){let n={contentSize:e.contentSize||e.fileSize,title:e.title||e.fileName,location:e.location||e.fileUrl,duration:e.duration||0},o="";return n.location&&n.location.length>0&&(o=n.location.substring(n.location.lastIndexOf(".")+1).toLowerCase()),n.mimeType=e.mimeType||o,n.type=e.type||ta(n.location),{...e,...n}}}const oan=Ce.defineComponent({name:"RichTextarea",components:{TinyFluentEditor:fs,FileList:cc,TinyDialogBox:Qr,TinyButton:Pt},model:{prop:"value",event:"change"},props:{value:String,list:{type:Array,default(){return[]}},maxNum:{type:Number,default:1},isShowLimitTimes:{type:Boolean,default:!0},actionIndex:{type:Number,default:0},placeholderText:{type:String,default:""},isQuestionBank:{type:Boolean,default:!1},type:{type:Number,default:0}},emits:["change","addFile","deleteFile"],setup(t,{emit:e}){const n=Ce.ref(null),o=Ce.ref(t.value||""),r=Ce.ref(null),i=Ce.ref(Bu()),a=Ce.ref(!1),l=Ce.computed(()=>"formula/index.html");Ce.onMounted(()=>{const v=r.value.state.quill.getModule("toolbar");n.value=new Pk({...tan});const f=document.getElementById(`upload-${i.value}`);n.value.initUpBtn(f),n.value.onBeforeUpload=b=>{let x=new nan({fileName:b.name,fileSize:b.size,fileUrl:b.name,status:1,lisCount:-1}),w=ta(x.fileUrl);b.onProgress=E=>{x.progress=gm(E,2,"floor")},b.onSuccess=()=>{x.fileUrl=b.obsHost+"/"+b.key,x.status=2,w=="image"&&c(`<img src="${x.fileUrl}" devui-editorx-image="true" data-image-id=${x.key} />`)},b.onError=E=>{x.errMessage=Sin(E.code),x.status=3},x.cancel=()=>{n.value.cancelUpload(b)},x.key=Bu(),w!="image"&&e("addFile",x,t.actionIndex)},v.addHandler("image1",function(b){n.value.$el.accept=Cp(["image"]),f.click()}),v.addHandler("video1",function(b){n.value.$el.accept=Cp(["video"]),f.click()}),v.addHandler("audio",function(b){n.value.$el.accept=Cp(["audio"]),f.click()}),v.addHandler("math",function(b){a.value=!0})}),Ce.onUnmounted(()=>{var p;(p=n.value)!=null&&p.$el&&n.value.$el.parentNode&&n.value.$el.parentNode.removeChild(n.value.$el)});const s=()=>{var b;const f=`\\(${((b=document.querySelector(".math-dialog iframe").contentWindow.document.getElementById("formulaTextarea"))==null?void 0:b.value)||""}\\)`;c(f),a.value=!1},c=p=>{if(!r.value)return;const v=r.value.state.quill,f=v.getSelection(),b=f?f.index:0;v.clipboard.dangerouslyPasteHTML(b,p);const x=new DOMParser().parseFromString(p,"text/html").body.textContent.length;v.setSelection(b+x)};Ce.watch(o,(p,v)=>{if(t.type==3){const f=/\s*\(\s*\)\s*/g;p=p.replace(f,"(&nbsp;)")}e("change",p)});const d=Ce.ref({placeholder:t.placeholderText,modules:{toolbar:[[{font:["yahei","songti","kaiti","heiti","lishu","mono","arial","arialblack","comic","impact","times"]},{size:["12px","13px","14px","15px","16px","17px","18px","19px","20px","22px","24px","26px","29px","32px","36px","40px","48px","72px"]},{lineheight:["1","1.2","1.5","2","2.5","3","4","5"]}],["bold","italic","underline","strike",{color:[]},{background:[]},{list:"ordered"},{list:"bullet"},{align:[]},{script:"sub"},{script:"super"},"image1","audio","video1","math","better-table"]]}});return{content:o,initSrtUploder:(p,v)=>{const f=document.getElementById(p);f&&(console.log("字幕上传按钮已找到",f),f.onclick=()=>{console.warn("字幕上传功能暂时不可用")})},deleteFile:(p,v)=>{e("deleteFile",v,t.actionIndex)},options:d,fluentEditorRef:r,insertContent:c,beforeEditorInit:p=>{const v='<svg t="1734490908682" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5918" width="200" height="200"><path d="M1084.416 32c52.288 0 95.296 40.064 99.84 91.136l0.448 9.152v764.288c0 52.288-40.064 95.232-91.136 99.84l-9.152 0.448H132.288a100.288 100.288 0 0 1-99.84-91.2L32 896.64V132.288c0-52.288 40.064-95.296 91.136-99.84L132.288 32h952.128z m-221.568 474.24l-223.808 167.872 87.936 62.336a41.216 41.216 0 0 1 12.992 51.584l-3.392 5.76a41.216 41.216 0 0 1-51.584 12.928l-5.76-3.392-275.2-196.096-290.112 201.856v87.488c0 8.768 5.952 16 14.08 17.92l4.288 0.448h952.128c8.832 0 16-5.952 17.92-14.08l0.448-4.288 3.136-176.448-2.688-1.472a35.2 35.2 0 0 1-4.672-2.944L862.848 506.24z m221.568-392.32H132.288a18.176 18.176 0 0 0-17.92 14.08l-0.448 4.288v579.712l266.368-188.608a40.32 40.32 0 0 1 41.792-3.392l5.376 3.392 141.888 100.928 271.104-203.392a41.28 41.28 0 0 1 46.784-1.792l4.992 3.84 210.56 187.008V132.288a18.176 18.176 0 0 0-14.08-17.92l-4.288-0.448z m-703.296 51.2a144 144 0 1 1-0.128 288.128 144 144 0 0 1 0.128-288.128z m0 69.12c-41.472 0-74.88 33.408-74.88 74.88 0 41.472 33.408 74.88 74.88 74.88 41.472 0 74.88-33.408 74.88-74.88 0-41.472-33.408-74.88-74.88-74.88z" fill-rule="nonzero"></path></svg>',f='<svg t="1734490908682" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5918" width="200" height="200"><path d="M992 705.6c-4.992 26.88-14.528 50.88-28.8 72.064-12.032 18.368-30.08 35.008-54.272 49.856-24.128 14.784-56.768 22.208-97.92 22.208-27.008 0-52.48-1.728-76.672-5.248a233.728 233.728 0 0 1-63.872-18.048 128.96 128.96 0 0 1-45.248-33.408 90.688 90.688 0 0 1-20.8-50.304 137.6 137.6 0 0 1 8.512-62.08c7.808-21.504 19.52-41.152 35.2-58.816a188.8 188.8 0 0 1 56.96-43.456 159.36 159.36 0 0 1 72.96-16.96c44.672 0 83.712 7.808 117.12 23.36V141.696L411.648 211.648l4.288 590.4v26.496c0 21.184-4.288 41.856-12.8 62.016a170.56 170.56 0 0 1-35.648 53.504 169.088 169.088 0 0 1-55.36 37.12 182.144 182.144 0 0 1-71.872 13.76c-28.416 0-54.656-2.624-78.784-7.936a234.688 234.688 0 0 1-63.872-23.296 139.072 139.072 0 0 1-44.8-38.144 104.64 104.64 0 0 1-20.16-52.48c-2.176-19.84 0.64-39.04 8.512-57.792 7.808-18.752 19.712-35.52 35.648-50.368 16-14.848 35.2-27.392 57.472-37.632 22.4-10.24 46.72-16.768 72.96-19.584a216.96 216.96 0 0 1 58.56-0.512c19.2 2.432 37.248 6.528 54.272 12.16V127.872L992 31.424v674.176z"></path></svg>',b='<svg t="1734491308472" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3380" width="200" height="200"><path d="M752.384 479.168a40.96 40.96 0 0 1 0 70.464l-205.696 122.88a41.28 41.28 0 0 1-62.08-35.2v-245.76a41.28 41.28 0 0 1 62.08-35.2l205.696 122.88z m-185.536-15.104v100.736l84.736-50.368-84.736-50.368z m534.848 450.88V113.92H114.304v801.024h987.392z m0 81.92H114.304c-45.44 0-82.304-36.672-82.304-81.92V113.92C32 68.672 68.864 32 114.304 32h987.392c45.44 0 82.304 36.672 82.304 81.92v801.024c0 45.248-36.864 81.92-82.304 81.92zM196.544 72.96c0-22.592 18.432-40.96 41.152-40.96 22.72 0 41.152 18.368 41.152 40.96v841.984c0 22.592-18.432 40.96-41.152 40.96a41.024 41.024 0 0 1-41.152-40.96V72.96z m41.152 277.632c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96H73.152a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544z m0 245.76c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96H73.152a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544zM937.152 72.96c0-22.592 18.432-40.96 41.152-40.96 22.72 0 41.152 18.368 41.152 40.96v841.984c0 22.592-18.432 40.96-41.152 40.96a41.024 41.024 0 0 1-41.152-40.96V72.96z m41.152 359.552a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96h-164.544z m0 245.76a41.024 41.024 0 0 1-41.152-40.96c0-22.656 18.432-40.96 41.152-40.96h164.544c22.72 0 41.152 18.304 41.152 40.96 0 22.592-18.432 40.96-41.152 40.96h-164.544z"></path></svg>',x='<svg viewBox="0 0 1280 1024" width="24" height="24"><path d="M1106.944 340.416h-448V414.72l242.688 222.976-242.688 223.04v74.304h448v-111.488h-261.312l186.624-185.856-186.624-185.792h261.312z"></path><path d="M546.88 127.68L546.752 128 1330.944 128v76.48H529.728L359.04 972.48H267.648c-23.232-61.376-47.168-120.96-71.808-178.688A6116.032 6116.032 0 0 0 119.68 622.72l-96.832 30.272L0 581.504l176.256-56.32 36.992 79.616a2801.92 2801.92 0 0 1 99.008 241.024l145.408-718.08h89.216z"></path></svg>',w=p.import("ui/icons");w.image1=v,w.audio=f,w.video1=b,w.math=x;const E=p.import("parchment"),S=new E.StyleAttributor("image1","color",{scope:E.Scope.INLINE}),$=new E.StyleAttributor("video1","color",{scope:E.Scope.INLINE}),q=new E.StyleAttributor("audio","color",{scope:E.Scope.INLINE}),B=new E.StyleAttributor("math","color",{scope:E.Scope.INLINE});p.register("formats/image1",S),p.register("formats/video1",$),p.register("formats/audio",q),p.register("formats/math",B)},containerId:i,boxVisibility:a,mathConfirm:s,iframeUrl:l}}});var ran=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"ritchtextarea-container",attrs:{id:e.containerId}},[n("TinyFluentEditor",{ref:"fluentEditorRef",attrs:{"data-type":!1,"data-upgrade":!1,options:e.options,"before-editor-init":e.beforeEditorInit},model:{value:e.content,callback:function(o){e.content=o},expression:"content"}}),n("FileList",{ref:"fileList",attrs:{mode:"edit",type:"block",isPreview:!0,list:e.list,isShowLimitTimes:e.isShowLimitTimes,"is-question-bank":e.isQuestionBank},on:{deleteFile:e.deleteFile}}),n("button",{staticStyle:{display:"none"},attrs:{id:`upload-${e.containerId}`}}),n("TinyDialogBox",{attrs:{"dialog-class":"math-dialog",title:"消息",width:"60%","append-to-body":!0,"destroy-on-close":""},scopedSlots:e._u([{key:"footer",fn:function(){return[n("TinyButton",{on:{click:function(o){e.boxVisibility=!1}}},[e._v("取 消")]),n("TinyButton",{attrs:{type:"primary"},on:{click:e.mathConfirm}},[e._v("确 定")])]},proxy:!0}]),model:{value:e.boxVisibility,callback:function(o){e.boxVisibility=o},expression:"boxVisibility"}},[n("iframe",{attrs:{src:e.iframeUrl,frameborder:"0"}})])],1)},ian=[],aan=Nn(oan,ran,ian,!1,null,null);const _k=aan.exports,san=Ce.defineComponent({name:"Base",components:{RichTextarea:_k,FileList:cc,TinyButton:Pt},props:{question:{type:Object,required:!0,default:()=>{}},mode:{type:Number,default:0},isQuestionBank:{type:Boolean,default:!1},isSubmitted:{type:Boolean,default:!1}},emits:["blankAnswerChange"],setup(t,{emit:e}){const n=lc(),o=Ce.ref(null),r=Ce.ref([]),i=Ce.computed(()=>{if(t.question.type!==3||!t.question.title)return[{type:"text",content:t.question.title||""}];const h=/\(&nbsp;\)/g,p=[];let v=0,f,b=t.question.title.replace(/^<p>|<\/p>$/g,"");for(;(f=h.exec(b))!==null;)f.index>v&&p.push({type:"text",content:b.slice(v,f.index)}),p.push({type:"blank",content:f[0]}),v=h.lastIndex;return v<b.length&&p.push({type:"text",content:b.slice(v)}),p}),a=Ce.computed(()=>i.value.filter(h=>h.type==="blank").length);t.question.record||(t.question.record={}),t.mode!=1&&Ce.nextTick(()=>{Wl()}),Ce.watch(i,()=>{const h=i.value.filter(p=>p.type==="blank").length;if(h>r.value.length)for(let p=r.value.length;p<h;p++)r.value.push("");else h<r.value.length&&(r.value=r.value.slice(0,h));t.mode==3&&(r.value=t.question.record.answer)},{immediate:!0,deep:!0}),Ce.watch(()=>t.mode,h=>{var p,v;try{if(t.question.type==3)if(h==3&&((p=t.question.record)==null?void 0:p.answer.length)>0){const f=(v=t.question.record)==null?void 0:v.answer;Array.isArray(f)?r.value=[...f]:r.value=f.split(";")}else h==2&&(r.value=[]);h!=1&&Ce.nextTick(()=>{Wl()})}catch(f){console.error("Failed to parse record answer:",f)}});const l=h=>i.value.slice(0,h).filter(p=>p.type==="blank").length,s=h=>{Ce.nextTick(()=>{Jae(h.target,h.target.value)})},c=h=>{t.question.link.push(h)},d=h=>{t.question.link.splice(h,1)},u=()=>{o.value&&o.value.insertContent("(&nbsp;)")};return Ce.watch(r,(h,p)=>{e("blankAnswerChange",h),t.question.record&&(t.question.record.answer=h)},{deep:!0}),{t:n,insert:u,richTextareaRef:o,titleParts:i,blankCount:a,userAnswers:r,editWidth:s,checkAnswerCorrect:h=>{var b,x;const p=i.value.slice(0,h).filter(w=>w.type==="blank").length,v=(b=r.value[p])==null?void 0:b.trim();if(!v)return!1;let f=t.question.correctAnswer||[];if(t.question.allowExchange){const w=new Set;return f.forEach(E=>{E!=null&&E.trim().includes("//")?E.split("//").map($=>$.trim()).forEach($=>w.add($)):E!=null&&E.trim()&&w.add(E.trim())}),w.has(v)}else{const w=(x=f[p])==null?void 0:x.trim();return w&&w.includes("//")?w.split("//").map(S=>S.trim()).includes(v):w===v}},blankIndex:l,addTitleFile:c,deleteTitleFile:d}}});var lan=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("div",{staticClass:"base-container"},[e.mode==2||e.mode==3?[e.question.type==3?n("div",{staticClass:"completion-preview"},[e.mode==2?n("div",{staticClass:"ql-editor preview-title"},[e._l(e.titleParts,function(o,r){return[o.type==="text"?n("span",{domProps:{innerHTML:e._s(o.content)}}):n("div",[n("span",{staticClass:"blank-index"},[e._v("["+e._s(e.blankIndex(r)+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:e.userAnswers[e.blankIndex(r)],expression:"userAnswers[blankIndex(index)]"}],staticClass:"completion-input",class:{"answer-correct":e.mode===3&&e.isSubmitted&&e.checkAnswerCorrect(r),"answer-error":e.mode===3&&e.isSubmitted&&!e.checkAnswerCorrect(r)},staticStyle:{margin:"0 2px"},attrs:{type:"text",disabled:!0},domProps:{value:e.userAnswers[e.blankIndex(r)]},on:{input:[function(i){i.target.composing||e.$set(e.userAnswers,e.blankIndex(r),i.target.value)},e.editWidth]}})])]})],2):e._e(),e.mode==3?n("div",{staticClass:"ql-editor preview-title"},[e._l(e.titleParts,function(o,r){return[o.type==="text"?n("span",{domProps:{innerHTML:e._s(o.content)}}):n("div",[n("span",{staticClass:"blank-index"},[e._v("["+e._s(e.blankIndex(r)+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:e.userAnswers[e.blankIndex(r)],expression:"userAnswers[blankIndex(index)]"}],staticClass:"completion-input",class:{"answer-correct":e.mode===3&&e.isSubmitted&&e.checkAnswerCorrect(r),"answer-error":e.mode===3&&e.isSubmitted&&!e.checkAnswerCorrect(r)},staticStyle:{margin:"0 2px"},attrs:{type:"text",disabled:e.mode==3&&e.isSubmitted},domProps:{value:e.userAnswers[e.blankIndex(r)]},on:{input:[function(i){i.target.composing||e.$set(e.userAnswers,e.blankIndex(r),i.target.value)},e.editWidth]}})])]})],2):e._e(),e.question.allowExchange?n("div",{staticClass:"can-exchange"},[e._v("*"+e._s(e.t("answerCanChangeTip")))]):e._e()]):n("div",{staticClass:"ql-editor preview-title",domProps:{innerHTML:e._s(e.question.title||"")}}),n("FileList",{attrs:{mode:"view",type:"block",isPreview:!0,list:e.question.link},on:{deleteFile:function(o){}}})]:n("RichTextarea",{ref:"richTextareaRef",attrs:{placeholderText:e.t("inputQuestionTitle"),list:e.question.link,maxNum:5,"is-question-bank":e.isQuestionBank,type:e.question.type},on:{addFile:e.addTitleFile,deleteFile:e.deleteTitleFile},model:{value:e.question.title,callback:function(o){e.$set(e.question,"title",o)},expression:"question.title"}}),e.question.type==3&&e.mode==1?n("TinyButton",{staticClass:"insert-blank",on:{click:e.insert}},[e._v(" "+e._s(e.t("insertQue"))+" ")]):e._e(),e._t("default")],2)},can=[],uan=Nn(san,lan,can,!1,null,"2627c5ed");const $f=uan.exports;class io{constructor({id:e,questionId:n="",type:o=0,title:r="",score:i=1,correctAnswer:a=[],reply:l="",record:s={},lisCount:c=-1,link:d=[],analyLinkList:u=[],answerlink:m="",correctChoiceIds:h=[],tags:p=[],hardlevel:v=3,knowledgeDTOS:f=[]}){this.id=e||n,this.questionid=this.id,this.type=o,this.title=r,this.score=i,this.correctAnswer=a,this.reply=l,this.record=new dan(s),this.lisCount=c,this.link=d||[],this.analyLinkList=u||[],this.answerlink=m,this.correctChoiceIds=h,this.tags=p||[],this.hardlevel=v,this.knowledgeDTOS=f||[]}scoring(){console.error("子类自行实现接口")}getOption(e){return String.fromCharCode(65+e)}getAnswer(){const e=this.record.answer;return e&&e.length>0?e[0]:""}getCorrectAnswer(){}}class dan{constructor({id:e="",answer:n=[],attachments:o=[],grade:r,reply:i="",remark1:a=""}){this.id=e,this.answer=n,this.attachments=o,this.score=r,this.reply=i||a}}let Ep=class{constructor({id:e="",questionID:n="",choiceId:o=0,text:r="",attachments:i=[],record:a={}}){this.id=e||n,this.choiceId=o,this.text=r,this.attachments=i,this.record=a}};class pan extends io{constructor(e){super(e),this.choices=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new Ep({id:Math.random(),choiceId:o.choiceId||0,text:o.title,attachments:o.link?[{fileUrl:o.link}]:[]}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new Ep({id:Math.random(),text:""}))}scoring(){}createChoice(){this.choices.push(new Ep({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}getAnswer(){return Array.isArray(this.record.answer)?this.record.answer.join(""):this.record.answer}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join(""):this.correctAnswer}handleAnswer(e,n){if(!e||this.getAnswer().length===0)return"";const o=this.getOption(n),r=this.correctAnswer&&this.correctAnswer.includes(o);return this.record.answer&&this.record.answer.includes(o)?r?"correct":"error":r&&this.type===2?"no-select error":""}}let kb=class{constructor({id:e="",correctAnswer:n=""}){this.id=e,this.correctAnswer=n}},han=class extends io{constructor(e){super(e),this.allowExchange=e.allowExchange||e.blankOrder||e.blackOrder||0,this.blanks=[];let n=0;this.title.replace(/[((](\s|&nbsp;)+[))]|_{5,}/gi,()=>{this.createBlank(),this.blanks[n].correctAnswer=this.correctAnswer[n],this.blanks[n].blankIndex=n+1,n++}),this.oldNums=this.blanks.length}createBlank(){this.blanks.push(new kb({id:Math.random(),correctAnswer:""})),this.correctAnswer.length<this.blanks.length&&this.correctAnswer.push("")}deleteBlank(e,n=1){this.blanks.splice(e,n),this.correctAnswer.splice(e,n)}createBlankByIndex(e,n){let o=new kb({id:Math.random(),correctAnswer:""});o.blankIndex=n,this.blanks.splice(e,0,o),this.correctAnswer.splice(e,0,"")}};class man extends io{constructor(e){super(e)}scoring(){}getAnswerResult(e){return e&&e.length>0&&e[0]?e[0].toLowerCase()==="true"||e[0]===!0:""}handleAnswer(e,n){const o=this.getAnswerResult(this.record.answer)===n;if(!e)return o?"select":"";const r=this.getAnswerResult(this.correctAnswer)===n;return o?r?"correct":"error":""}}class fan extends io{constructor(e){super(e),this.answerLinkList=e.answerLinkList||[],this.answerLinkList.length==0&&this.answerlink&&this.answerLinkList.push({fileUrl:this.answerlink})}scoring(){}getAnswer(){return(this.record.answer.join("")||"").trim()}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer[0]:this.correctAnswer}}class gan extends io{constructor(e){super(e),this.subQuestions=[];for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];o.type=1,o=Pf(o),o.qIndex=n+1,this.subQuestions.push(o)}this.oldNums=this.subQuestions.length}scoring(){}createSubQuestion(){this.subQuestions.push(Yl(1))}deleteSubQuestion(e,n){this.subQuestions.splice(e,n||1)}createSubQuestionByIndex(e,n){let o=Yl(1);o.qIndex=n,o.isNew=1,this.subQuestions.splice(e,0,o)}getAnswerText(e){if(e.correctAnswer.length===0)return"";let n=e.correctAnswer[0].charCodeAt(0)-65;return e.choices[n].text}}let $p=class{constructor({id:e="",text:n="",option:o="",attachments:r=[]}){this.id=e,this.text=n,this.option=o,this.attachments=r}};class van extends io{constructor(e){super(e),this.choices=[],this.subQuestions=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new $p({id:Math.random(),text:o.title}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new $p({id:Math.random(),text:""}));for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];o=Pf(o),o.qIndex=n+1,this.subQuestions.push(o)}this.oldNums=this.subQuestions.length}scoring(){}createChoice(){this.choices.push(new $p({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}createSubQuestion(){this.subQuestions.push(Yl(1))}deleteSubQuestion(e,n){this.subQuestions.splice(e,n||1)}createSubQuestionByIndex(e,n){let o=Yl(1);o.qIndex=n,o.isNew=1,this.subQuestions.splice(e,0,o)}getAnswerText(e){if(e.correctAnswer.length===0||!e.correctAnswer[0])return"";let n=e.correctAnswer[0].charCodeAt(0)-65;return this.choices[n].text}getAnswer(){return Array.isArray(this.record.answer)?this.record.answer.join(""):this.record.answer}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join(""):this.correctAnswer}handleAnswer(e,n){if(!e)return"";const o=this.getOption(n),r=this.correctAnswer&&this.correctAnswer.includes(o);return this.record.answer&&this.record.answer.includes(o)?r?"correct":"error":""}}class yan extends io{constructor(e){super(e),this.subQuestions=[];for(let n=0;e.subQuestions&&n<e.subQuestions.length;n++){let o=e.subQuestions[n];this.subQuestions.push(Pf(o))}}scoring(){}createSubQuestion(e){let n=Yl(e);n.isEdit=!0,n.isNew=1,this.subQuestions.push(n)}deleteSubQuestion(e){this.subQuestions.splice(e,1)}}let Pp=class{constructor({id:e="",text:n="",option:o=""}){this.id=e,this.text=n,this.option=o}};class ban extends io{constructor(e){super(e),this.choices=[];for(let n=0;e.item&&n<e.item.length;n++){let o=e.item[n];this.choices.push(new Pp({id:Math.random(),text:o.title}))}if(this.choices.length===0)for(let n=1;n<=4;n++)this.choices.push(new Pp({id:Math.random(),text:""}))}scoring(){this.record.score=0}createChoice(){this.choices.push(new Pp({id:Math.random()}))}deleteChoice(e,n){this.choices.splice(n,1)}getAnswer(){const e=Array.isArray(this.record.answer)?this.record.answer:[this.record.answer];return e.filter(o=>o&&o.length>0).length>0?e.join("-"):""}getCorrectAnswer(){return Array.isArray(this.correctAnswer)?this.correctAnswer.join("-"):this.correctAnswer}handleAnswer(e,n){return e&&this.record.answer&&this.record.answer[n]?this.correctAnswer[n]===this.record.answer[n]?"correct":"error":""}}class wan extends io{constructor(e){super(e)}scoring(){}getAnswer(){return this.record.answer.join("")||""}}class xan extends io{constructor(e){super(e)}scoring(){}}class Cb{constructor({name:e="",precision:n,max:o,min:r}){this.name=e,this.precision=n||1,this.max=o,this.min=r}}class _p{constructor({formula:e="",answerRange:n=0,precision:o=1}){this.formula=e,this.answerRange=n,this.precision=o}}class Tan extends io{constructor(e){super(e),this.variables=[],this.blanks=[],this.scope={},this.desc1=e.desc1;try{for(let o=0;e.formulaVar&&o<e.formulaVar.length;o++){let r=e.formulaVar[o];this.variables.push(new Cb(r)),r.value!==void 0&&(this.scope[r.name]=r.value)}}catch(o){console.log(o)}let n=0;this.title.replace(/[((](\s|&nbsp;)+[))]|_{5,}/gi,()=>{let o={};const r=this.correctAnswer[n];r&&(o=typeof r=="string"&&r.length>0?JSON.parse(r):r);let i=new _p(o);i.blankIndex=n+1,this.blanks.push(i),n++}),this.oldNums=this.blanks.length}createVariable(e){this.variables.push(new Cb({name:e}))}deleteVariable(e){for(let n=0;n<this.variables.length;n++)if(this.variables[n].name===e){this.variables.splice(n,1);return}}createBlank(){this.blanks.push(new _p({}))}deleteBlank(e,n){this.blanks.splice(e,n||1)}createBlankByIndex(e,n){let o=new _p({});o.blankIndex=n,this.blanks.splice(e,0,o)}initVariables(e){let n={};for(let o=0;o<this.variables.length;o++){let r=this.variables[o],i=r.min*1+Math.random()*(r.max-r.min);i=new Number(i);let a=0;r.precision!=1&&(a=(Math.round(.1/r.precision)+"").length),i=i.toFixed(a);let l=new RegExp("\\>"+r.name+"\\*\\<","g");e=e.replace(l,">"+i+"<"),n[r.name]=i}return this.scope=n,e}initDomVariables(e){for(let n in this.scope){let o=new RegExp("\\>"+n+"\\*\\<","g");e=e.replace(o,">"+this.scope[n]+"<")}return e}checkAnswer(e){let n=[];for(let i=0;i<this.blanks.length;i++)n.push({text:this.record.answer[i]||""});let o={scope:this.scope,answerResult:[]},r=0;for(let i=0;Object.values(this.scope).length>0&&i<n.length;i++)if(n[i].text&&n[i].text.trim().length>0){let a=this.blanks[i],l=a.formula,s=e.format(e.evaluate(l,this.scope),{precision:14})*1,c=n[i].text*1,d=0;a.precision!=1&&(d=(Math.round(.1/a.precision)+"").length),s=s.toFixed(d)*1,c=c.toFixed(d)*1,c>=s-a.answerRange*1&&c<=s+a.answerRange*1?(o.answerResult[i]=!0,r++):o.answerResult[i]=!1}else o.answerResult[i]=!1;this.record.extraAnswer=o,this.record.grade=this.score*(r/this.blanks.length),this.checkResult=o.answerResult}}function uc(t){let e=null;switch(t.type){case 1:case 2:e=new pan(t);break;case 3:e=new han(t);break;case 4:e=new man(t);break;case 5:e=new fan(t);break;case 12:e=new ban(t);break;case 11:case 23:e=new gan(t);break;case 17:e=new van(t);break;case 16:e=new wan(t);break;case 19:e=new xan(t);break;case 24:e=new yan(t);break;case 25:e=new Tan(t);break;default:e=new io(t)}return e}function Yl(t){let e=uc({id:Math.random(),type:t});return e.key=Math.random(),e}function Pf(t){if(t.id=t.id||t.questionid,t.allowExchange=t.allowExchange||t.blankOrder||t.blackOrder||0,t.correctAnswerAndReplay){let{correctAnswer:e,correctReplay:n,correctChoiceIds:o}=t.correctAnswerAndReplay;t.correctAnswer=e||t.correctAnswer,t.reply=n||t.reply,t.correctChoiceIds=o||[]}else t.correctAnswer=t.correctAnswer||t.correctanswer,t.reply=t.reply||t.correctreply;return t.correctAnswer=t.correctAnswer||t.correctanswer,t.reply=t.reply||t.correctreply,t.subQuestions=t.questionlist||t.subQuestions,t.subQuestions&&t.subQuestions.length>0&&(t.score=0,t.subQuestions.forEach((e,n)=>{e.score=e.score===0||e.score>0?Number(gm(e.score,2)):1,t.score+=e.score})),t.score=t.score===0||t.score>0?Number(gm(t.score,2)):1,t.type==25&&!t.formulaVar&&t.desc1&&(t.formulaVar=JSON.parse(t.desc1)),uc(t)}const Mk="data:image/png;base64,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",kan="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='18'%20height='18'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.57917%2015.9145C8.70747%2016.0428%208.8824%2016.1134%209.06382%2016.1102C9.43813%2016.1092%209.74175%2015.8068%209.74422%2015.4325V9.67071H15.5051C15.8805%209.66972%2016.1845%209.36568%2016.1855%208.99031C16.1887%208.8089%2016.118%208.63397%2015.9897%208.50567C15.8614%208.37737%2015.6865%208.30671%2015.5051%208.30991H9.74422V2.57151C9.74422%202.19574%209.43959%201.89111%209.06382%201.89111C8.68804%201.89111%208.38342%202.19574%208.38342%202.57151V8.30991H2.645C2.26923%208.30991%201.9646%208.61454%201.9646%208.99031C1.9646%209.36609%202.26923%209.67071%202.645%209.67071H8.38342V15.4298C8.38021%2015.6112%208.45087%2015.7862%208.57917%2015.9145ZM8.38342%209.67071H9.74422V8.30991H8.38342V9.67071Z'%20fill='%23529FFF'/%3e%3c/svg%3e",Can=Ce.defineComponent({name:"Choice",components:{TinyButton:Pt,TinyRadioGroup:Wi,TinyRadio:Jn,TinyCheckboxGroup:as,TinyCheckbox:Zn,TinyAlert:Vi,FileList:cc,Base:$f,RichTextarea:_k},props:{oriQuestion:{type:Object,required:!0,default:()=>({type:1,choices:[],correctAnswer:null,record:{answer:null}})},mode:{type:Number,default:1,validator:t=>[1,2,3].includes(t)},needRichText:{type:Boolean,default:!0},isSubmitted:{type:Boolean,default:!1},showAnswer:{type:Boolean,default:!1}},emits:["save","cancel","change"],setup(t,{emit:e}){const n=lc(),o=Ce.ref({type:"warning",text:""}),r=($,q)=>{o.value={type:$,text:q},setTimeout(()=>{o.value.text=""},2e3)},i=Ce.ref(null),a=Ce.ref({}),l=Ce.ref(""),s=Ce.ref([]),c=Ce.ref(),d=()=>{var $,q,B,P;t.mode===3?($=a.value.record)!=null&&$.answer?a.value.type===1?(l.value=a.value.record.answer,c.value=a.value.record.answer):(s.value=Array.isArray(a.value.record.answer)?a.value.record.answer:((q=a.value.record.answer)==null?void 0:q.split(","))||[],c.value=Array.isArray(a.value.record.answer)?a.value.record.answer:((B=a.value.record.answer)==null?void 0:B.split(","))||[]):(l.value="",s.value=[]):a.value.correctAnswer?a.value.type===1?l.value=a.value.correctAnswer[0]:s.value=Array.isArray(a.value.correctAnswer)?a.value.correctAnswer:((P=a.value.correctAnswer)==null?void 0:P.split(","))||[]:(l.value="",s.value=[])};Ce.watch(()=>t.oriQuestion,$=>{a.value=uc($),d(),Ce.nextTick(()=>{Wl()}),console.log(a.value,"--------Choice--------",$)},{immediate:!0}),Ce.watch([()=>t.mode,()=>t.isSubmitted],()=>{d()});const u=$=>String.fromCharCode(65+$),m=$=>$?Array.isArray($)?$.join(","):$:"-",h=$=>{var C;if(t.mode!==3||!t.isSubmitted)return"";const q=u($),B=((C=a.value.record)==null?void 0:C.answer)||"",P=a.value.correctAnswer||"",N=Array.isArray(B)?B:(B==null?void 0:B.split(","))||[],D=Array.isArray(P)?P:(P==null?void 0:P.split(","))||[],W=N.includes(q),M=D.includes(q);return M&&W?"correct":!M&&W?"wrong":M&&!W?"missed":""},p=()=>{t.mode===1&&(a.value.choices.length<20?v():console.warn(n("optionLimit")||"选项数量已达上限(20个)"))},v=()=>{a.value.choices||(a.value.choices=[]),a.value.choices.push({id:Date.now(),text:"",attachments:[]})},f=$=>{t.mode===1&&t.needRichText&&(i.value=$)},b=($,q)=>{t.mode===1&&a.value.choices[q].attachments.splice($,1)},x=($,q)=>{console.log($,q,a.value,"question.valuequestion.value"),t.mode===1&&a.value.choices[q].attachments.push($)},w=($,q)=>{if(t.mode===1)if(a.value.choices&&Array.isArray(a.value.choices)&&a.value.choices.length>2){if(a.value.choices.splice(q,1),a.value.correctAnswer){const P=(Array.isArray(a.value.correctAnswer)?a.value.correctAnswer:a.value.correctAnswer.split(",")).filter(N=>{const D=N.charCodeAt(0)-65;return D!==q&&D<a.value.choices.length});a.value.correctAnswer=a.value.type===1?P[0]||"":P}}else console.warn(n("atLeastTwo")||"至少需要两个选项")},E=()=>{if(t.mode!==1)return;if(!a.value.title){r("warning",n("questionTitleTip1"));return}if(a.value.choices.some(q=>!q.text)){r("warning",n("optionContentTip1"));return}if(!a.value.correctAnswer||a.value.correctAnswer.length===0){r("warning",n("inputAnswerTip4"));return}const $=JSON.parse(JSON.stringify(a.value));e("save",$)},S=()=>{e("cancel")};return Ce.watch(l,$=>{a.value.type===1&&(t.mode===1?a.value.correctAnswer=$:t.mode===3&&(a.value.record||(a.value.record={}),a.value.record.answer=$,e("change",a.value)))}),Ce.watch(s,$=>{a.value.type===2&&(t.mode===1?a.value.correctAnswer=$:t.mode===3&&!t.isSubmitted&&(a.value.record||(a.value.record={}),a.value.record.answer=$,e("change",a.value)))}),{t:n,question:a,radioAnswer:l,checkboxAnswer:s,getOption:u,formatAnswer:m,handleAnswerClass:h,addChoice:p,saveQuestion:E,cancel:S,createChoice:v,activeIndex:i,activeRichText:f,deleteFile:b,addFile:x,deleteChoice:w,userAnswer:c,alertInfo:o,showAlertHandler:r}}});var Aan=function(){var o;var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{staticClass:"choice-container",attrs:{question:e.question,mode:e.mode}},[e.mode===1?n("div",{staticClass:"edit-mode"},[n("div",{staticClass:"choice-list-base"},[e._l(e.question.choices,function(r,i){return n("div",{key:r.id},[n("div",{staticClass:"choice-item"},[n("span",{staticClass:"choice-option"},[e._v(e._s(e.getOption(i)))]),e.activeIndex===i?n("RichTextarea",{staticClass:"choice-input-wrap",attrs:{placeholder:e.t("optionContent"),list:r.attachments,isShowLimitTimes:!1,actionIndex:i,placeholderText:e.t("optionContent")},on:{addFile:e.addFile,deleteFile:e.deleteFile},model:{value:r.text,callback:function(a){e.$set(r,"text",a)},expression:"choice.text"}}):n("div",{staticClass:"choice-input-wrap"},[e.needRichText?n("div",{staticClass:"choice-input",on:{click:function(a){return e.activeRichText(i)}}},[r.text||r.attachments&&r.attachments.length>0?e._e():n("span",{staticClass:"no-content-tip"},[e._v(e._s(e.t("optionContent")))]),r.text?n("div",{staticClass:"rich-text",domProps:{innerHTML:e._s(r.text)}}):e._e(),n("FileList",{ref:"fileList",refInFor:!0,attrs:{mode:"edit",type:"block",isPreview:!0,list:r.attachments||[],isShowLimitTimes:!1,actionIndex:i},on:{deleteFile:e.deleteFile}})],1):n("input",{directives:[{name:"model",rawName:"v-model",value:r.text,expression:"choice.text"}],staticClass:"choice-input",attrs:{type:"text",placeholder:e.t("optionContent")},domProps:{value:r.text},on:{input:function(a){a.target.composing||e.$set(r,"text",a.target.value)}}})]),i>1?n("img",{staticClass:"btn-delete",attrs:{src:Mk,alt:""},on:{click:function(a){return e.deleteChoice(r,i)}}}):e._e()],1)])}),n("div",{staticClass:"btn-add",on:{click:e.addChoice}},[n("img",{attrs:{src:kan,alt:""}}),e._v(e._s(e.t("addOption"))+" ")])],2),n("div",{staticClass:"choice-list"},[n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])]),e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i)))])])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i)))])])}),1):e._e()],1),n("div",{staticClass:"btn-save"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)]):e._e(),e.mode===2?n("div",{staticClass:"preview-mode"},[n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",attrs:{disabled:""},model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",attrs:{disabled:""},model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1}}):e._e()],1)])}),1):e._e()],1),n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])])]):e._e(),e.mode===3?n("div",{staticClass:"answer-mode"},[e.isSubmitted?n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",attrs:{disabled:!0},model:{value:e.userAnswer,callback:function(r){e.userAnswer=r},expression:"userAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",class:e.handleAnswerClass(i),attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",attrs:{disabled:!0},model:{value:e.userAnswer,callback:function(r){e.userAnswer=r},expression:"userAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",class:e.handleAnswerClass(i),attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e()],1):n("div",{staticClass:"choice-list"},[e.question.type===1?n("TinyRadioGroup",{staticClass:"choices",model:{value:e.radioAnswer,callback:function(r){e.radioAnswer=r},expression:"radioAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyRadio",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e(),e.question.type===2?n("TinyCheckboxGroup",{staticClass:"choices",model:{value:e.checkboxAnswer,callback:function(r){e.checkboxAnswer=r},expression:"checkboxAnswer"}},e._l(e.question.choices,function(r,i){var a;return n("TinyCheckbox",{key:r.id,staticClass:"choice-item",attrs:{label:e.getOption(i)}},[n("span",{staticClass:"index"},[e._v(e._s(e.getOption(i))+". ")]),n("div",{staticClass:"choice-content"},[n("span",{staticClass:"rich-text ql-editor not-edit",domProps:{innerHTML:e._s(r.text)}}),(a=r.attachments)!=null&&a.length?n("FileList",{staticClass:"choice-file-list",attrs:{mode:"preview",type:"block",isPreview:!0,list:r.attachments,isShowLimitTimes:!1,showDownLoad:e.mode!==3}}):e._e()],1)])}),1):e._e()],1),e.isSubmitted&&e.showAnswer?n("div",[n("div",{staticClass:"answer-display"},[n("span",[e._v(e._s(e.t("stuAnswer"))+":")]),n("span",[e._v(e._s(e.formatAnswer((o=e.question.record)==null?void 0:o.answer)))])]),n("div",{staticClass:"correct-answer"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("span",[e._v(e._s(e.formatAnswer(e.question.correctAnswer)))])])]):e._e()]):e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],1)},San=[],Ean=Nn(Can,Aan,San,!1,null,"13d78562");const Ll=Ean.exports;Ll.install=t=>t.component(Ll.name,Ll);const $an=Ce.defineComponent({name:"Completion",components:{Base:$f,FileList:cc,TinyButton:Pt,TinyCheckbox:Zn,TinyAlert:Vi},props:{mode:{type:Number,default:1},oriQuestion:{type:Object,default:()=>({})},isSubmitted:{type:Boolean,default:!1},showAnswer:{type:Boolean,default:!1}},emits:["save","cancel","submit"],setup(t,{emit:e}){const n=Ce.ref({}),o=Ce.ref([]),r=Ce.ref({type:"warning",text:""}),i=(h,p)=>{r.value={type:h,text:p},setTimeout(()=>{r.value.text=""},2e3)},a=h=>{var W,M,C,V;if(t.mode!==1)return;const p=/\(&nbsp;\)/g;let v;const f=[];let b=0,x="<p>";for(;(v=p.exec(h))!==null;)f.push(v.index-5*b-x.length),b++;let w=0;if((W=u.value)!=null&&W.richTextareaRef){const k=(C=(M=u.value.richTextareaRef.$refs.fluentEditorRef.state.quill)==null?void 0:M.getSelection)==null?void 0:C.call(M);w=(k==null?void 0:k.index)??((V=n.value.title)==null?void 0:V.length)??0}let E=0;for(let k=0;k<f.length&&w>f[k];k++)E=k;const S=[...n.value.blanks||[]].sort((k,z)=>(k.orderIndex||0)-(z.orderIndex||0)),$=S.map(k=>k.correctAnswer||""),q=[];let B=0;const P=f.length,N=S.length,D=Array(P).fill("");if(N>0){const k=P>N;if(k)for(let z=0;z<P;z++)if(k&&z===E)D[z]="";else if(z<E)z<$.length&&(D[z]=$[z]);else{const O=z-1;O<$.length&&(D[z]=$[O])}else for(let z=0;z<P;z++)D[z]=$[z]}for(let k=0;k<f.length;k++)q.push({id:Bu(),blankIndex:f[k],orderIndex:B,correctAnswer:D[k]}),B++;n.value.blanks=q,o.value=n.value.blanks.map(()=>""),l()};Ce.watch(()=>n.value.title,a),Ce.watch(()=>t.oriQuestion,h=>{n.value=uc(h),Ce.nextTick(()=>{Wl()})},{immediate:!0});const l=()=>{if(t.mode!==1)return;let h=[];if(n.value.blanks)for(let p=0;p<n.value.blanks.length;p++){let v=n.value.blanks[p];h.push(v.correctAnswer||"")}n.value.correctAnswer=h},s=()=>{if(t.mode!==1)return;if(l(),!n.value.title){i("warning",ar("questionTitleTip1"));return}let h=!1;for(let v=0;v<n.value.blanks.length;v++)if(!n.value.blanks[v].correctAnswer||n.value.blanks[v].correctAnswer.trim()===""){h=!0;break}if(h){i("warning",ar("optionContentTip1"));return}let p=!1;for(let v=0;v<n.value.blanks.length;v++)if((n.value.blanks[v].correctAnswer||"").length>1e3){p=!0;break}if(p){i("warning",ar("optionContentTip3"));return}console.log("save-completion",n.value),e("save",n.value)},c=()=>{e("cancel")},d=h=>{t.mode===3&&(n.value.record.answer=h,e("change",n.value))},u=Ce.ref(null);return{t:ar,question:n,userAnswers:o,saveQuestion:s,cancel:c,answerChange:l,blankAnswerChange:d,deleteBlank:(h,p)=>{var E;if(t.mode!==1)return;const v=n.value.blanks.findIndex(S=>S.id===h.id);if(v===-1)return;n.value.blanks.splice(v,1);let f=n.value.title;const b=/\(&nbsp;\)/g;let x,w=[];for(;(x=b.exec(f))!==null;)w.push(x.index);if(p>=0&&p<w.length){const S=w[p];f=f.substring(0,S)+f.substring(S+8),n.value.title=f,(E=u.value)!=null&&E.richTextareaRef&&(u.value.richTextareaRef.content=f);const $=/\(&nbsp;\)/g;let q,B=[];for(;(q=$.exec(f))!==null;)B.push(q.index);n.value.blanks.forEach((P,N)=>{B[N]!==void 0&&(P.blankIndex=B[N])})}o.value=n.value.blanks.map(()=>""),l()},baseComponent:u,alertInfo:r,showAlertHandler:i}}});var Pan=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{ref:"baseComponent",staticClass:"completion-question",attrs:{question:e.question,mode:e.mode,isSubmitted:e.isSubmitted},on:{blankAnswerChange:e.blankAnswerChange}},[e.mode===1?[n("div",{staticClass:"edit-mode"},[n("div",{staticClass:"title"}),n("div",{staticClass:"correct-answer"},[n("span",{staticClass:"tip"},[e._v(e._s(e.t("answer"))+":")]),n("span",{staticClass:"correct-answer-tip"},[e._v("( "+e._s(e.t("inputAnswerTip2"))+" )")]),e._l(e.question.blanks,function(o,r){return n("div",{key:o.id||r},[n("div",{staticClass:"answer-item"},[n("span",{staticClass:"answer-option"},[e._v("["+e._s(r+1)+"]")]),n("input",{directives:[{name:"model",rawName:"v-model",value:o.correctAnswer,expression:"blank.correctAnswer"}],staticClass:"answer-input",attrs:{placeholder:e.t("inputAnswer"),type:"text"},domProps:{value:o.correctAnswer},on:{change:e.answerChange,input:function(i){i.target.composing||e.$set(o,"correctAnswer",i.target.value)}}}),n("div",{staticClass:"btn-delete"},[n("img",{attrs:{src:Mk,alt:""},on:{click:function(i){return e.deleteBlank(o,r)}}})])])])}),n("div",{staticClass:"can-exchange"},[n("TinyCheckbox",{attrs:{"false-label":0,"true-label":1},model:{value:e.question.allowExchange,callback:function(o){e.$set(e.question,"allowExchange",o)},expression:"question.allowExchange"}},[e._v("答案可互换顺序")])],1),n("div",{staticClass:"btn-save"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)],2)])]:(e.mode===2||e.mode===3)&&e.showAnswer?[n("div",{staticClass:"preview-mode"},[n("FileList",{attrs:{list:e.question.link}}),n("div",{staticClass:"correct-answer-preview"},[n("div",{class:{title:e.mode===3}},[e._v(e._s(e.t("correctAnswer"))+":")]),e._l(e.question.blanks,function(o,r){return n("span",{key:o.id||r,staticClass:"answer-item"},[n("span",{staticClass:"answer-option"},[e._v("["+e._s(r+1)+"]")]),n("span",{staticClass:"answer-value"},[e._v(e._s(`${o.correctAnswer}${r!==e.question.blanks.length-1?"、":""}`||"-"))])])})],2)],1)]:e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],2)},_an=[],Man=Nn($an,Pan,_an,!1,null,"cb349b86");const Il=Man.exports;Il.install=t=>t.component(Il.name,Il);const il="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='18'%20height='18'%20fill='%23475467'/%3e%3cpath%20d='M6.77719%2012.6257L2.59039%207.87367C2.34614%207.5802%201.96178%207.44255%201.58677%207.51423C1.21175%207.58592%200.905259%207.85563%200.786475%208.21849C0.66769%208.58135%200.755358%208.98009%201.01539%209.25967L5.96539%2014.8865C6.16186%2015.1092%206.4434%2015.2385%206.74039%2015.2422C7.03739%2015.246%207.32212%2015.124%207.52419%2014.9063L17.2712%204.40687C17.5406%204.13474%2017.6404%203.73748%2017.5316%203.37035C17.4227%203.00321%2017.1226%202.7245%2016.7484%202.64313C16.3742%202.56177%2015.9854%202.69067%2015.734%202.97947L6.77719%2012.6275V12.6257Z'%20fill='%23475467'/%3e%3c/svg%3e",al="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='16'%20height='16'%20fill='%23475467'/%3e%3cpath%20d='M9.48719%208.00012L15.2562%202.23012C15.6662%201.82112%2015.6662%201.15012%2015.2562%200.741117C14.8462%200.331117%2014.1762%200.331117%2013.7662%200.741117L7.99719%206.51112L2.22719%200.740117C1.81819%200.330117%201.14719%200.330117%200.738187%200.740117C0.328187%201.15012%200.328187%201.82012%200.738187%202.23012L6.50819%208.00012L0.737188%2013.7701C0.327188%2014.1791%200.327188%2014.8501%200.737188%2015.2591C1.14719%2015.6691%201.81719%2015.6691%202.22719%2015.2591L7.99719%209.48912L13.7672%2015.2591C14.1762%2015.6691%2014.8472%2015.6691%2015.2562%2015.2591C15.6662%2014.8491%2015.6662%2014.1791%2015.2562%2013.7691L9.48619%208.00012H9.48719Z'%20fill='%23475467'/%3e%3c/svg%3e",Lan=Ce.defineComponent({name:"JudgeQuestion",components:{Base:$f,TinyRadio:Jn,TinyRadioGroup:Wi,TinyButton:Pt,FileList:cc,TinyAlert:Vi},props:{mode:{type:Number,default:1},oriQuestion:{type:Object,default:()=>({})},showAnswer:{type:Boolean,default:!1},isSubmitted:{type:Boolean,default:!1}},emits:["save","cancel","change"],setup(t,{emit:e}){const n=lc(),o=Ce.ref({type:"warning",text:""}),r=(h,p)=>{o.value={type:h,text:p},setTimeout(()=>{o.value.text=""},2e3)},i=Ce.ref({}),a=Ce.ref(""),l=Ce.ref(""),s=Ce.computed(()=>t.isSubmitted&&a.value===l.value);Ce.watch(()=>t.oriQuestion,h=>{var p;i.value=uc(h),i.value.correctAnswer&&i.value.correctAnswer.length>0&&(l.value=i.value.correctAnswer[0]),t.mode===3&&((p=i.value.record)!=null&&p.answer?a.value=i.value.record.answer:a.value=""),Ce.nextTick(()=>{Wl()}),console.log(i.value,"--------Judge--------")},{immediate:!0}),Ce.watch(()=>t.mode,h=>{var p;h!==3?a.value="":(p=i.value.record)!=null&&p.answer?a.value=i.value.record.answer:a.value=""}),Ce.watch(()=>t.isSubmitted,h=>{var p;h&&((p=i.value.record)!=null&&p.answer)&&(a.value=i.value.record.answer)});const c=()=>{if(t.mode===1){if(!i.value.title||!i.value.title.trim()){r("warning",n("questionTitleTip1"));return}if(!l.value){r("warning",n("inputAnswerTip4"));return}i.value.correctAnswer||(i.value.correctAnswer=[]),i.value.correctAnswer[0]=l.value,e("save",i.value)}},d=()=>{e("cancel")};return Ce.watch(a,h=>{t.mode===3&&h&&(i.value.record||(i.value.record={}),i.value.record.answer=h,e("change",i.value))}),{t:n,cancel:d,question:i,userAnswer:a,correctAnswer:l,isCorrect:s,saveQuestion:c,handleAnswerClass:h=>{if(!t.isSubmitted)return"";const p=(h?"true":"false")==a.value,v=(h?"true":"false")==l.value;return p?v?"correct":"wrong":""},handleCorrectAnswerClass:h=>t.isSubmitted&&(h?"true":"false")==l.value?"correct":"",alertInfo:o,showAlertHandler:r}}});var Ian=function(){var e=this,n=e._self._c;return e._self._setupProxy,n("Base",{staticClass:"true-or-false-question",attrs:{question:e.question,mode:e.mode}},[e.mode===1?[n("div",{staticClass:"correct-answer"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("TinyRadioGroup",{model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1),n("div",{staticClass:"action-buttons"},[n("TinyButton",{attrs:{type:"primary"},on:{click:e.saveQuestion}},[e._v(e._s(e.t("save")))]),n("TinyButton",{on:{click:e.cancel}},[e._v(e._s(e.t("cancel")))])],1)]:e.mode===2?[n("div",{staticClass:"preview-mode"},[n("div",{staticClass:"correct-answer-preview"},[n("span",[e._v(e._s(e.t("answer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1)])]:e.mode===3?[n("div",{staticClass:"answer-mode"},[n("div",{staticClass:"user-answer"},[e.isSubmitted?n("div",{staticClass:"submit-result"},[n("div",{staticClass:"user-answer-display"},[n("span",[e._v(e._s(e.t("yourAnswer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.userAnswer,callback:function(o){e.userAnswer=o},expression:"userAnswer"}},[n("TinyRadio",{class:e.handleAnswerClass(!0),attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{class:e.handleAnswerClass(!1),attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1),e.showAnswer?n("div",{staticClass:"correct-answer-hint"},[n("span",[e._v(e._s(e.t("correctAnswer"))+":")]),n("TinyRadioGroup",{attrs:{disabled:""},model:{value:e.correctAnswer,callback:function(o){e.correctAnswer=o},expression:"correctAnswer"}},[n("TinyRadio",{class:e.handleCorrectAnswerClass(!0),attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{class:e.handleCorrectAnswerClass(!1),attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1):e._e()]):n("div",[n("TinyRadioGroup",{model:{value:e.userAnswer,callback:function(o){e.userAnswer=o},expression:"userAnswer"}},[n("TinyRadio",{attrs:{label:"true"}},[n("img",{attrs:{src:il,alt:""}})]),n("TinyRadio",{attrs:{label:"false"}},[n("img",{attrs:{src:al,alt:""}})])],1)],1)])])]:e._e(),e.alertInfo.text?n("TinyAlert",{staticClass:"alert-warning",attrs:{type:e.alertInfo.type},scopedSlots:e._u([{key:"description",fn:function(){return[e._v(e._s(e.alertInfo.text))]},proxy:!0}],null,!1,3471111397)}):e._e()],2)},Nan=[],Oan=Nn(Lan,Ian,Nan,!1,null,"fb1a6c3b");const Nl=Oan.exports;Nl.install=t=>t.component(Nl.name,Nl);pin();const Dan=[fl,Pl,_l,Ll,Il,Nl],Ban=t=>{Dan.forEach(e=>t.use(e))},qan={install:Ban};exports.Choice=Ll;exports.Completion=Il;exports.Judge=Nl;exports.MyButton=fl;exports.MyTinyButton=Pl;exports.MyTinyRadio=_l;exports.default=qan;
@@ -64014,7 +64014,7 @@ var ban = function() {
64014
64014
  wan,
64015
64015
  !1,
64016
64016
  null,
64017
- "e2efce64"
64017
+ "2627c5ed"
64018
64018
  );
64019
64019
  const Nf = xan.exports;
64020
64020
  class ao {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ul-question-test-ui",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"