105 lines
588 KiB
JavaScript
105 lines
588 KiB
JavaScript
|
|
var Y0=Object.defineProperty;var Uv=u=>{throw TypeError(u)};var K0=(u,t,e)=>t in u?Y0(u,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[t]=e;var R=(u,t,e)=>K0(u,typeof t!="symbol"?t+"":t,e),hg=(u,t,e)=>t.has(u)||Uv("Cannot "+e);var n=(u,t,e)=>(hg(u,t,"read from private field"),e?e.call(u):t.get(u)),m=(u,t,e)=>t.has(u)?Uv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,e),p=(u,t,e,s)=>(hg(u,t,"write to private field"),s?s.call(u,e):t.set(u,e),e),v=(u,t,e)=>(hg(u,t,"access private method"),e);var Jt=(u,t,e,s)=>({set _(i){p(u,t,i,e)},get _(){return n(u,t,s)}});import{E as Q0}from"./el-alert-B_M4eVTG.js";import{E as Ml}from"./index-9zpOHVFd.js";import{v as J0}from"./directive-CGqZKDhv.js";import{d as ni,o as O,c as $,q as x,s as V,n as re,aa as G,g as ct,j as st,G as Ey,H as Gp,x as at,w as tt,M as xt,ad as xe,y as it,e as Pt,f as Bt,A as lt,D as Is,aQ as Cy,al as ky,r as Z0,P as vh,t as Hv,aL as ug,z as ap,ac as tA,ag as eA,aR as sA,K as iA,aB as nA,v as rA}from"./index-Dd84m4NL.js";import{A as aA}from"./AppConfirmDialog-D8GYfvI4.js";import{E as Ty,a as Py}from"./el-form-item-BMccCMQS.js";import{E as jd}from"./index-CxrDRhwR.js";import{a as My,E as jp}from"./el-checkbox-DmCZOH3C.js";import{E as Wd}from"./el-input-number-CLGVcD2n.js";/* empty css */import{_ as ri}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{E as Xd,a as qd}from"./el-select-DinjeS4W.js";import{E as oA}from"./el-slider-zfFAQg0d.js";import{E as lA}from"./el-switch-DeGokrBx.js";import"./el-popper-CXiDZrHI.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-scrollbar-CnqWU4CY.js";import{E as cA}from"./el-tag-DPsbND_Z.js";import{E as Iy}from"./el-pagination-CZfi7rql.js";import{E as rv}from"./el-progress-QxrdzpaU.js";import{E as hA}from"./el-upload-CT0Hhwbe.js";import{a as uA,b as Dy,c as dA,e as fA,f as zv,r as pA,h as gA,u as mA,i as Vv,j as Gv,s as vA,k as yA,l as av,m as dg,n as bA,o as op,p as wA,q as AA,t as SA,v as xA,w as _A,x as EA,y as CA,z as kA,A as TA,B as PA}from"./dataProcess-PWnIk5S8.js";import{u as MA}from"./models-DxMjE4y2.js";import"./vnode-CasYkit1.js";import"./castArray-Cc7cuNko.js";import"./_baseClone-C6YdWYHR.js";import"./raf-CGf5YZRu.js";import"./index-BkMrw1Qg.js";import"./index-DEuQ2B0Z.js";import"./omit-njl9pMBF.js";import"./index-CrQUvw33.js";import"./index-KnEmF0FL.js";import"./index-C5oiM9Uu.js";import"./scroll-CJw98M_S.js";import"./clamp-MxoDdpzk.js";import"./toNumber-Dzu6kJGs.js";import"./_baseIteratee-CfOSjoYo.js";import"./debounce-CqM0EiuE.js";import"./validator-BEv3fs9p.js";import"./model-SG-pVLXE.js";const _l={min:1,max:50};function ov(u,t=1){const e=Number(u),s=Number.isFinite(e)?Math.trunc(e):t;return Math.min(_l.max,Math.max(_l.min,s))}const IA={class:"generation-option-row dataset-split-row"},DA={class:"dataset-split-config"},LA={class:"dataset-split-grid"},RA={class:"dataset-split-field"},FA={class:"dataset-split-input"},OA={class:"dataset-split-field"},NA={class:"dataset-split-input"},BA={class:"dataset-split-field"},$A={class:"dataset-split-input"},UA={key:0,role:"alert"},HA=ni({__name:"DatasetSplitEditor",props:{modelValue:{},ariaLabelPrefix:{default:""}},emits:["update:modelValue"],setup(u,{emit:t}){const e=u,s=t,i=st(()=>{const{train:o,validation:l,test:c}=e.modelValue;return o+l+c});function r(o,l){s("update:modelValue",{...e.modelValue,[o]:Math.min(100,Math.max(0,Number(l)||0))})}function a(o){return`${e.ariaLabelPrefix}${o}比例`}return(o,l)=>{const c=Wd;return O(),$("div",IA,[l[9]||(l[9]=x("div",{class:"generation-option-copy"},[x("strong",null,"数据集划分"),x("small",null,"按比例将生成后的问答对随机划分为训练集、验证集和测试集")],-1)),x("div",DA,[x("div",LA,[x("label",RA,[l[4]||(l[4]=x("span",null,"训练集",-1)),x("span",FA,[V(c,{"model-value":u.modelValue.train,min:0,max:100,step:1,precision:0,"controls-position":"right","aria-label":a("训练集"),"onUpdate:modelValue":l[0]||(l[0]=h=>r("train",h))},null,8,["model-value","aria-label"]),l[3]||(l[3]=x("span",null,"%",-1))])]),x("label",OA,[l[6]||(l[6
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
要求:严格依据来源生成问题和最终答案,不输出分析、中间思考过程或来源中不存在的信息;答案应准确、完整、语言自然。`,WA=`你是一名专业的推理数据生成助手。请根据下方来源内容生成可用于推理模型训练的问答数据。
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
要求:每条数据必须包含问题、可核验的中间思考过程和最终答案。中间思考过程需说明关键依据、必要步骤和中间计算,不得跳过推理只给结论,也不得引入来源中不存在的事实。`,XA=`你是一名专业的数据生成专家。你的任务是根据下方的来源内容,提取核心信息并生成高质量的问答数据,用于大模型的监督微调(SFT)。
|
|||
|
|
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
|
|||
|
|
任务要求:
|
|||
|
|
1. 问题构建:基于来源内容设计问题,问题应当具有实际意义,不仅限于表面的事实问答,可以包括对内容的主旨概括、具体细节的询问或应用场景的探讨。
|
|||
|
|
2. 答案生成:严格依据来源内容生成最终答案,答案需准确无误、逻辑连贯、完整且表达自然流畅。
|
|||
|
|
3. 忠于原文:不输出分析、中间思考过程或任何多余的解释,切勿引入来源内容中未提及的事实或主观臆造的信息。`,qA=`你是一名具有深厚专业知识的推理数据生成专家。你的任务是根据给定的来源内容,生成高质量、逻辑严密且可用于训练推理大语言模型(如 O1 或 DeepSeek-R1)的问答数据。
|
|||
|
|
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
|
|||
|
|
任务要求:
|
|||
|
|
1. 多维度提问:从来源内容中提取核心概念或关键逻辑,构建具有挑战性的问题,避免简单的信息抽取,提问可以涉及因果分析、方案设计、逻辑推断或跨段落信息整合。
|
|||
|
|
2. 深度思维链(CoT):
|
|||
|
|
- 必须提供详尽的中间思考过程。
|
|||
|
|
- 在思考过程中,需首先分析问题的核心需求,然后逐步拆解来源内容中的相关事实或数据。
|
|||
|
|
- 对于涉及计算或多步推导的问题,必须一步步展示计算或推导过程,并说明每一步的理论依据或事实来源。
|
|||
|
|
- 如果遇到矛盾或缺失的信息,需在思考过程中指出,并合理假设或推理,但最终答案不得编造来源中完全不相关的事实。
|
|||
|
|
3. 最终答案:在充分推理后给出明确的最终结论。结论应当是对问题的直接回应,语言自然、结构清晰,并且结论必须能从前面的思考过程中自然得出。
|
|||
|
|
|
|||
|
|
数据格式要求:
|
|||
|
|
请确保每条生成的数据清晰包含“问题”、“中间思考过程”和“最终答案”三个部分,且内容充实、专业。`,Wp=`你是一名专业的数据生成专家。请基于下方来源内容,生成高质量、可直接用于大模型监督微调(SFT)的问答数据。
|
|||
|
|
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
|
|||
|
|
任务要求:
|
|||
|
|
1. 提问有价值:问题应聚焦来源内容的核心信息点,避免无意义的字面抄录或过于宽泛的提问;优先设计需要理解、归纳或推理才能回答的问题,例如主旨概括、细节追问、因果解释或场景应用。
|
|||
|
|
2. 答案忠于来源:严格依据来源内容作答,不得引入来源中不存在的事实、观点或数据;若来源信息不足以完整回答该问题,请如实说明不足,不要编造或臆测。
|
|||
|
|
3. 答案完整且自然:回答应直接回应问题,要点完整、逻辑清晰、语言流畅;涉及多项内容时建议分点陈述,但不必照搬原文措辞。`,Ry=`你是一名具有深厚专业知识的推理数据生成专家。请基于下方来源内容,生成包含完整思维链、可用于训练推理大语言模型(如 O1、DeepSeek-R1)的问答数据。
|
|||
|
|
|
|||
|
|
来源内容:
|
|||
|
|
{{ content }}
|
|||
|
|
|
|||
|
|
任务要求:
|
|||
|
|
1. 提问有挑战性:从来源内容中提炼需要多步思考才能回答的问题,避免可直接定位答案的简单事实抽取;可涉及因果分析、逻辑推断或跨信息整合。
|
|||
|
|
2. 推理可核验:逐步展开思考过程,每个关键结论都应标注其在来源中的依据或必要的中间推导;不得跳过关键步骤只给结论,也不得引入来源中完全不存在的事实。
|
|||
|
|
3. 信息不足时如实处理:遇到来源信息缺失或相互矛盾时,需在推理中明确指出,并基于来源做出合理假设,但不得编造与来源无关的内容。
|
|||
|
|
4. 最终答案须能从前面的推理过程中自然得出,语言简洁、结构清晰。`;function Sg(u){return u==="reasoning"?Ry:Wp}function Fy(u){const t=s=>s.replace(/\r\n/g,`
|
|||
|
|
`).trim(),e=t(u);return[zA,VA,jA,XA,GA,WA,qA,Wp,Ry].map(t).includes(e)}function Oy(){return{preprocessOptions:["clean_invalid","detect_structure","deduplicate","normalize_format"],semanticEnrichment:!1,qaPairsPerRow:1,datasetSplit:{train:80,validation:10,test:10},generationModelId:"",generationPrompt:Wp,outputType:"standard",reasoningDetail:"normal",temperature:.7,maxTokens:1024,jsonMode:!1,qualityFilterEnabled:!1,filterLowQuality:!0,filterShortContent:!0,minOutputLength:20}}function Ny(){return{preprocessOptions:["clean_invalid_content","detect_document_structure","merge_short_content","filter_low_quality","deduplicate_content","preserve_context"],chunkMethod:"layout_hybrid",chunkSize:800,chunkOverlap:100,minChunkSize:100,semanticBreakpointPercentile:95,preserveTables:!0,preserveCodeBlocks:!0,preserveLists:!0,semanticEnrichment:!1,qaPairsPerChunk:1,datasetSplit:{train:80,validation:10,test:10},generationModelId:"",generationPrompt:Wp,outputType:"standard",reasoningDetail:"normal",temperature:.7,maxTokens:1024,jsonMode:!1,qualityFilterEnabled:!1,filterLowQuality:!0,filterShortContent:!0,minOutputLength:20}}function Xe(u,t,e){return Object.prototype.hasOwnProperty.call(u,t)?u[t]:e}function vr(u,t,e){const s=Number(Xe(u,t,e));return Number.isFinite(s)?s:e}function By(u,t){const e=u.dataset_split;if(!e||typeof e!="object")return{...t};const s=e,i=r=>{const a=Number(s[r]);return Number.isFinite(a)?a:t[r]};return{train:i("train"),validation:i("validation"),test:i("test")}}function $y(u,t){const e=Xe(u,"output_type",t.outputType)==="reasoning"?"reasoning":"standard",s=String(Xe(u,"generation_prompt",t.generationPrompt));return{generationModelId:Xe(u,"generation_model_id",t.generationModelId),generationPrompt:Fy(s)?Sg(e):s,outputType:e,reasoningDetail:Xe(u,"reasoning_detail",t.reasoningDetail)==="detailed"?"detailed":"normal",temperature:vr(u,"temperature",t.temperature),maxTokens:vr(u,"max_tokens",t.maxTokens),jsonMode:!!Xe(u,"json_mode",t.jsonMode),qualityFilterEnabled:!!Xe(u,"quality_filter_enabled",t.qualityFilterEnabled),filterLowQuality:!!Xe(u,"filter_low_quality",t.filterLowQuality),filterShortContent:!!Xe(u,"filter_short_content",t.filterShortContent),minOutputLength:vr(u,"min_output_length",t.minOutputLength)}}function YA(u){const t=Oy(),e=Xe(u,"preprocess_options",[]);return{...t,...$y(u,t),preprocessOptions:Array.isArray(e)?e.map(String):t.preprocessOptions,semanticEnrichment:!!Xe(u,"semantic_enrichment",t.semanticEnrichment),qaPairsPerRow:ov(vr(u,"qa_pairs_per_row",t.qaPairsPerRow),t.qaPairsPerRow),datasetSplit:By(u,t.datasetSplit)}}function KA(u){const t=Ny(),e=Xe(u,"preprocess_options",[]);return{...t,...$y(u,t),preprocessOptions:Array.isArray(e)?e.map(String):t.preprocessOptions,chunkMethod:Xe(u,"chunk_method",t.chunkMethod),chunkSize:vr(u,"chunk_size",t.chunkSize),chunkOverlap:vr(u,"chunk_overlap",t.chunkOverlap),minChunkSize:vr(u,"min_chunk_size",t.minChunkSize),semanticBreakpointPercentile:vr(u,"semantic_breakpoint_percentile",t.semanticBreakpointPercentile),preserveTables:!!Xe(u,"preserve_tables",t.preserveTables),preserveCodeBlocks:!!Xe(u,"preserve_code_blocks",t.preserveCodeBlocks),preserveLists:!!Xe(u,"preserve_lists",t.preserveLists),semanticEnrichment:!!Xe(u,"semantic_enrichment",t.semanticEnrichment),qaPairsPerChunk:ov(vr(u,"qa_pairs_per_chunk",t.qaPairsPerChunk),t.qaPairsPerChunk),datasetSplit:By(u,t.datasetSplit)}}function QA(u,t,e){if(u==="structured")return{preprocessOptions:t.preprocessOptions};if(u!=="unstructured")return null;const{preprocessOptions:s,chunkMethod:i,chunkSize:r,chunkOverlap:a,minChunkSize:o,semanticBreakpointPercentile:l,preserveTables:c,preserveCodeBlocks:h,preserveLists:d}=e;return{preprocessOptions:s,chunkMethod:i,chunkSize:r,chunkOverlap:a,minChunkSize:o,semanticBreakpointPercentile:l,preserveTables:c,preserveCodeBlocks:h,preserveLists:d}}function JA(u,t,e){const s=u==="unstructured"?e:t;if(u==="external")return null;const i={semanticEnrichment:s.semanticEnrichment,datasetSplit:s.datasetSplit,generationModelId:s.generationModelId,generationPrompt:s.generationPrompt,outputType
|
|||
|
|
`).join("")}}Mr=new WeakMap;function Kh(u,t){const e=t?URL.parse(u,t):URL.parse(u);return/https?:/.test((e==null?void 0:e.protocol)??"")}function Ei(u){u.preventDefault()}function ce(u){u.preventDefault(),u.stopPropagation()}var ru;class cp{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;n(this,ru)||p(this,ru,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));const e=n(this,ru).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,c==="-"?(a+=h,o+=d):c==="+"&&(a-=h,o-=d),new Date(Date.UTC(s,i,r,a,o,l))}}ru=new WeakMap,m(cp,ru);function Qd(u){if(u.startsWith("#")){const e=u.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(u.startsWith("rgb(")){const[e,s,i]=u.slice(4,-1).split(",").map(r=>parseInt(r,10));return[e,s,i,1]}if(u.startsWith("rgba(")){const e=u.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}const t=u.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!=="none"?parseFloat(t[4]):1]:null}function Jd(u){const t=Qd(u);return t?t.slice(0,3):(mt(`Not a valid color format: "${u}"`),[0,0,0])}function Mx(u){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of u.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;u.set(e,Jd(s))}t.remove()}function Kt(u){const{a:t,b:e,c:s,d:i,e:r,f:a}=u.getTransform();return[t,e,s,i,r,a]}function Xi(u){const{a:t,b:e,c:s,d:i,e:r,f:a}=u.getTransform().invertSelf();return[t,e,s,i,r,a]}function El(u,t,e=!1,s=!0){if(t instanceof Kd){const{pageWidth:i,pageHeight:r}=t.rawDims,{style:a}=u,o=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-y))`;!e||t.rotation%180===0?(a.width=o,a.height=l):(a.width=l,a.height=o)}s&&u.setAttribute("data-main-rotation",t.rotation)}class _n{constructor(){const{pixelRatio:t}=_n;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,r=-1){let a=1/0,o=1/0,l=1/0;s=_n.capPixels(s,r),s>0&&(a=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);const c=Math.min(a,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}}const Pg=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Ix{static get isDarkMode(){var t;return ft(this,"isDarkMode",!!((t=window==null?void 0:window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches))}}class Dx{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:s}=window.getComputedStyle(t);return t.remove(),ft(this,"commentForegroundColor",Jd(s))}}function Lx(u,t){t=ee(t??1,0,1);const e=255*(1-t);return u.map(s=>Math.round(s*t+e))}function Xv(u,t){const e=u[0]/255,s=u[1]/255,i=u[2]/255,r=Math.max(e,s,i),a=Math.min(e,s,i),o=(r+a)/2;if(r===a)t[0]=t[1]=0;else{const l=r-a;switch(t[1]=o<.5?l/(r+a):l/(2-r-a),r){case e:t[0]=((s-i)/l+(s<i?6:0))*60;break;case s:t[0]=((i-e)/l+2)*60;break;case i:t
|
|||
|
|
struct Uniforms {
|
|||
|
|
offsetX : f32,
|
|||
|
|
offsetY : f32,
|
|||
|
|
scaleX : f32,
|
|||
|
|
scaleY : f32,
|
|||
|
|
paddedWidth : f32,
|
|||
|
|
paddedHeight : f32,
|
|||
|
|
borderSize : f32,
|
|||
|
|
_pad : f32,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
@group(0) @binding(0) var<uniform> u : Uniforms;
|
|||
|
|
|
|||
|
|
struct VertexInput {
|
|||
|
|
@location(0) position : vec2<f32>,
|
|||
|
|
@location(1) color : vec4<f32>,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
struct VertexOutput {
|
|||
|
|
@builtin(position) position : vec4<f32>,
|
|||
|
|
@location(0) color : vec3<f32>,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
@vertex
|
|||
|
|
fn vs_main(in : VertexInput) -> VertexOutput {
|
|||
|
|
var out : VertexOutput;
|
|||
|
|
let cx = (in.position.x + u.offsetX) * u.scaleX;
|
|||
|
|
let cy = (in.position.y + u.offsetY) * u.scaleY;
|
|||
|
|
out.position = vec4<f32>(
|
|||
|
|
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
|
|||
|
|
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
|
|||
|
|
0.0,
|
|||
|
|
1.0
|
|||
|
|
);
|
|||
|
|
out.color = in.color.rgb;
|
|||
|
|
return out;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@fragment
|
|||
|
|
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|||
|
|
return vec4<f32>(in.color, 1.0);
|
|||
|
|
}
|
|||
|
|
`;var Pp,Yn,Co,Sc,Mp,Ub;class h_{constructor(){m(this,Mp);m(this,Pp,null);m(this,Yn,null);m(this,Co,null);m(this,Sc,null)}init(){return n(this,Pp)||p(this,Pp,v(this,Mp,Ub).call(this))}get isReady(){return n(this,Yn)!==null}loadMeshShader(){if(!n(this,Yn)||n(this,Co))return;const t=n(this,Yn).createShaderModule({code:c_});p(this,Co,n(this,Yn).createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:n(this,Sc)}]},primitive:{topology:"triangle-list"}}))}draw(t,e,s,i,r,a,o,l){this.loadMeshShader();const c=n(this,Yn),{offsetX:h,offsetY:d,scaleX:f,scaleY:g}=i,b=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(b,0,t);const w=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(w,0,e);const A=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(A,0,new Float32Array([h,d,f,g,a,o,l,0]));const y=c.createBindGroup({layout:n(this,Co).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:A}}]}),S=new OffscreenCanvas(a,o),_=S.getContext("webgpu");_.configure({device:c,format:n(this,Sc),alphaMode:r?"opaque":"premultiplied"});const C=r?{r:r[0]/255,g:r[1]/255,b:r[2]/255,a:1}:{r:0,g:0,b:0,a:0},E=c.createCommandEncoder(),k=E.beginRenderPass({colorAttachments:[{view:_.getCurrentTexture().createView(),clearValue:C,loadOp:"clear",storeOp:"store"}]});return s>0&&(k.setPipeline(n(this,Co)),k.setBindGroup(0,y),k.setVertexBuffer(0,b),k.setVertexBuffer(1,w),k.draw(s)),k.end(),c.queue.submit([E.finish()]),b.destroy(),w.destroy(),A.destroy(),S.transferToImageBitmap()}}Pp=new WeakMap,Yn=new WeakMap,Co=new WeakMap,Sc=new WeakMap,Mp=new WeakSet,Ub=async function(){var t;if(!((t=globalThis.navigator)!=null&&t.gpu))return!1;try{const e=await navigator.gpu.requestAdapter();return e?(p(this,Sc,navigator.gpu.getPreferredCanvasFormat()),p(this,Yn,await e.requestDevice()),!0):!1}catch{return!1}};const Jp=new h_;function u_(){return Jp.init()}function d_(){return Jp.isReady}function f_(){Jp.loadMeshShader()}function p_(u,t,e,s,i,r,a,o){return Jp.draw(u,t,e,s,i,r,a,o)}const qe={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function If(u,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),u.clip(i)}class pv{isModifyingCurrentTransform(){return!1}getPattern(){Mt("Abstract method `getPattern` called.")}}class g_ extends pv{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;const t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let s,i=this._p0,r=this._p1;if(e&&(i=i.slice(),r=r.slice(),j.applyTransform(i,e),j.applyTransform(r,e)),this._type==="axial")s=t.createLinearGradient(i[0],i[1],r[0],r[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(e){const l=new Float32Array(2);j.singularValueDecompose2dScale(e,l),a*=l[0],o*=l[0]}s=t.createRadialGradient(i[0],i[1],a,r[0],r[1],o)}for(const a of this._colorStops)s.addColorStop(a[0],a[1]);return s}_createReversedGradient(t,e=null){let s=this._p1,i=this._p0;e&&(s=s.slice(),i=i.slice(),j.applyTransform(s,e),j.applyTransform(i,e));let r=this._r1,a=this._r0;if(e){const c=new Float32Array(2);j.singularValueDecompose2dScale(e,c),r*=c[0],a*=c[0]}const o=t.createRadialGradient(s[0],s[1],r,i[0],i[1],a),l=this._colorStops.map(([c,h])=>[1-c,h]).reverse();for(const[c,h]of l)o.addColorStop(c,h);return o}getPattern(t,e,s,i){let r;if(i===qe.STROKE||i===qe.FILL){if(this.isOriginBa
|
|||
|
|
`))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const h={userValue:o,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=c??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",c??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),t.has(e)&&this.container.classList.add("sandboxModified")),Tl.add(s),this.contentElement=s,s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const{datetimeFormat:d,datetimeType:f,timeStep:g}=this.data,b=!!f&&this.enableScripting;d&&(s.title=d),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",A=>{t.setValue(e,{value:A.target.value}),this.setPropertyOnSiblings(s,"value",A.target.value,"value"),h.formattedValue=null}),s.addEventListener("resetform",A=>{const y=this.data.defaultFieldValue??"";s.value=h.userValue=y,h.formattedValue=null});let w=A=>{const{formattedValue:y}=h;y!=null&&(A.target.value=y),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",y=>{var _;if(h.focused)return;const{target:S}=y;if(b&&(S.type=f,g&&(S.step=g)),h.userValue){const C=h.userValue;if(b)if(f==="time"){const E=new Date(C),k=[E.getHours(),E.getMinutes(),E.getSeconds()];S.value=k.map(D=>D.toString().padStart(2,"0")).join(":")}else S.value=new Date(C-Z_).toISOString().split(f==="date"?"T":".",1)[0];else S.value=C}h.lastCommittedValue=S.value,h.commitKey=1,(_=this.data.actions)!=null&&_.Focus||(h.focused=!0)}),s.addEventListener("updatefromsandbox",y=>{this.container.classList.add("sandboxModified");const S={value(_){h.userValue=_.detail.value??"",b||t.setValue(e,{value:h.userValue.toString()}),_.target.value=h.userValue},formattedValue(_){const{formattedValue:C}=_.detail;h.formattedValue=C,C!=null&&_.target!==document.activeElement&&(_.target.value=C);const E={formattedValue:C};b&&(E.value=C),t.setValue(e,E)},selRange(_){_.target.setSelectionRange(..._.detail.selRange)},charLimit:_=>{var D;const{charLimit:C}=_.detail,{target:E}=_;if(C===0){E.removeAttribute("maxLength");return}E.setAttribute("maxLength",C);let k=h.userValue;!k||k.length<=C||(k=k.slice(0,C),E.value=h.userValue=k,t.setValue(e,{value:k}),(D=this.linkService.eventBus)==null||D.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:k,willCommit:!0,commitKey:1,selStart:E.selectionStart,selEnd:E.selectionEnd}}))}};this._dispatchEventFromSandbox(S,y)}),s.addEventListener("keydown",y=>{var C;h.commitKey=1;let S=-1;if(y.key==="Escape"?S=0:y.key==="Enter"&&!this.data.multiLine?S=2:y.key==="Tab"&&(h.commitKey=3),S===-1)return;const{value:_}=y.target;h.lastCommittedValue!==_&&(h.lastCommittedValue=_,h.userValue=_,(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:S,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});const A=w;w=null,s.addEventListener("blur",y=>{var C,E;if(!h.focused||!y.relatedTarget)return;(C=this.data.actions)!=null&&C.Blur||(h.focused=!1);const{target:S}=y;let{value:_}=S;if(b){if(_&&f==="time"){const k=_.split(":").map(D=>parseInt(D,10));_=new Date(2e3,0,1,k[0],k[1],k[2]||0).valueOf(),S.step=""}else _.includes("T")||(_=`${_}T00:00`),_=new Date(_).valueOf();S.type="text"}h.userValue=_,h.lastCommittedValue!==_&&((E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:h.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}})),A(y)}),(r=this.data.actions)!=null&&r.Keystroke&&s.addEventListener("beforeinput",y=>{var F;h.lastCommittedValue=null;const{data:S,target:_}=y,{value:C,selectionStart:E,selectionEnd:k}=_;let D=E,M=k;switch(y.inputType){case"deleteWordBackward":{const B=C.substring(0,E).match(/\w*\W
|
|||
|
|
`))e.push({name:"span",value:r,attributes:i});return s},yw=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&n(this,fn))&&v(this,bt,Uf).call(this)},bw=function(){if(n(this,nr)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:r}}}=n(this,Vc);let a=!!n(this,Gc),o=a?n(this,Gc):n(this,ud);for(const b of n(this,Jo))if(!o||j.intersect(b.data.rect,o)!==null){o=b.data.rect,a=!0;break}const l=j.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),h=a?o[2]-o[0]+5:0,d=l[0]+h,f=l[1];p(this,nr,[100*(d-i)/e,100*(f-r)/s]);const{style:g}=n(this,ge);g.left=`${n(this,nr)[0]}%`,g.top=`${n(this,nr)[1]}%`},Uf=function(){if(n(this,Vs)){n(this,Vs).toggleCommentPopup(this,!1);return}p(this,fn,!n(this,fn)),n(this,fn)?(v(this,bt,Hf).call(this),n(this,ge).addEventListener("click",n(this,Hc)),n(this,ge).addEventListener("keydown",n(this,ca))):(v(this,bt,Em).call(this),n(this,ge).removeEventListener("click",n(this,Hc)),n(this,ge).removeEventListener("keydown",n(this,ca)))},Hf=function(){n(this,Gs)||this.render(),this.isVisible?n(this,fn)&&n(this,ge).classList.add("focused"):(v(this,bt,bw).call(this),n(this,ge).hidden=!1,n(this,ge).style.zIndex=parseInt(n(this,ge).style.zIndex,10)+1e3)},Em=function(){n(this,ge).classList.remove("focused"),!(n(this,fn)||!this.isVisible)&&(n(this,ge).hidden=!0,n(this,ge).style.zIndex=parseInt(n(this,ge).style.zIndex,10)-1e3)};class ww extends ae{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=pt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var dd;class cE extends ae{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,dd,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=p(this,dd,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,dd)}addHighlightArea(){this.container.classList.add("highlightArea")}}dd=new WeakMap;var fd;class hE extends ae{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,fd,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,fd,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,fd)}addHighlightArea(){this.container.classList.add("highlightArea")}}fd=new WeakMap;var pd;class uE extends ae{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,pd,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,pd,this.svgFactory.createElement("svg:ellipse"));retur
|
|||
|
|
`);if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes(`
|
|||
|
|
`)){o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:c}=o,h=[],d=[];if(l.nodeType===Node.TEXT_NODE){const y=l.parentElement;if(d.push(l.nodeValue.slice(c).replaceAll(ff,"")),y!==this.editorDiv){let S=h;for(const _ of this.editorDiv.childNodes){if(_===y){S=d;continue}S.push(v(w=Zt,Ar,jf).call(w,_))}}h.push(l.nodeValue.slice(0,c).replaceAll(ff,""))}else if(l===this.editorDiv){let y=h,S=0;for(const _ of this.editorDiv.childNodes)S++===c&&(y=d),y.push(v(A=Zt,Ar,jf).call(A,_))}p(this,js,`${h.join(`
|
|||
|
|
`)}${r}${d.join(`
|
|||
|
|
`)}`),v(this,_e,Wf).call(this);const f=new Range;let g=Math.sumPrecise(h.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const S=y.nodeValue.length;if(g<=S){f.setStart(y,g),f.setEnd(y,g);break}g-=S}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=Zt._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,s,i){var o;let r=null;if(e instanceof ww){const{data:{defaultAppearanceData:{fontSize:l,fontColor:c},rect:h,rotation:d,id:f,popupRef:g,richText:b,contentsObj:w,creationDate:A,modificationDate:y},textContent:S,textPosition:_,parent:{page:{pageNumber:C}}}=e;if(!(S!=null&&S.length))return null;r=e={annotationType:pt.FREETEXT,color:Array.from(c),fontSize:l,value:S.join(`
|
|||
|
|
`),position:_,pageIndex:C-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:g,comment:(w==null?void 0:w.str)||null,richText:b,creationDate:A,modificationDate:y}}const a=await super.deserialize(e,s,i);return p(a,Ws,e.fontSize),a.color=j.makeHexColor(...e.color),p(a,js,v(o=Zt,Ar,Im).call(o,e.value)),a._initialData=r,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Rt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:s,fontSize:n(this,Ws),value:v(this,_e,Pw).call(this)});return this.addComment(i),e?(i.isCopy=!0,i):this.annotationElementId&&!v(this,_e,Mw).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(!s)return null;const{style:i}=s;i.fontSize=`calc(${n(this,Ws)}px * var(--total-scale-factor))`,i.color=this.color,s.replaceChildren();for(const r of n(this,js).split(`
|
|||
|
|
`)){const a=document.createElement("div");a.append(r?document.createTextNode(r):document.createElement("br")),s.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:n(this,js)}}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};js=new WeakMap,Sd=new WeakMap,nl=new WeakMap,Ws=new WeakMap,_e=new WeakSet,Cw=function(e){const s=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--total-scale-factor))`,this.translate(0,-(r-n(this,Ws))*this.parentScale),p(this,Ws,r),v(this,_e,Gf).call(this)},i=n(this,Ws);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},kw=function(e){const s=r=>{this.color=r,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:vt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Tw=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const r of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&r.nodeName==="BR"||(e.push(v(i=Zt,Ar,jf).call(i,r)),s=r);return e.join(`
|
|||
|
|
`)},Gf=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:r,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",r.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},Ar=new WeakSet,jf=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(ff,"")},Wf=function(){if(this.editorDiv.replaceChildren(),!!n(this,js))for(const e of n(this,js).split(`
|
|||
|
|
`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},Pw=function(){return n(this,js).replaceAll(" "," ")},Im=function(e){return e.replaceAll(" "," ")},Mw=function(e){const{value:s,fontSize:i,color:r,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==r[l])||e.pageIndex!==a},m(Zt,Ar),R(Zt,"_freeTextDefaultContent",""),R(Zt,"_internalPadding",0),R(Zt,"_defaultColor",null),R(Zt,"_defaultFontSize",10),R(Zt,"_type","freetext"),R(Zt,"_editorType",pt.FREETEXT);let Mm=Zt;class J{toSVGPath(){Mt("Abstract method `toSVGPath` must be implemented.")}get box(){Mt("Abstract getter `box` must be implemented.")}serialize(t,e){Mt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*r;return a}static _rescaleAndSwap(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*r;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let r=0,a=t.length;r<a;r+=2)i[r]=e+t[r],i[r+1]=s+t[r+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,r){switch(r){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static createBezierPoints(t,e,s,i,r,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+r)/6,(5*i+a)/6,(s+r)/2,(i+a)/2]}}R(J,"PRECISION",1e-4);var Xs,$i,qc,Yc,pn,wt,rl,al,xd,_d,Kc,Qc,ga,Ed,Bp,$p,Te,jh,Iw,Dw,Lw,Rw,Fw,Ow;const Ln=class Ln{constructor({x:t,y:e},s,i,r,a,o=0){m(this,Te);m(this,Xs);m(this,$i,[]);m(this,qc);m(this,Yc);m(this,pn,[]);m(this,wt,new Float32Array(18));m(this,rl);m(this,al);m(this,xd);m(this,_d);m(this,Kc);m(this,Qc);m(this,ga,[]);p(this,Xs,s),p(this,Qc,r*i),p(this,Yc,a),n(this,wt).set([NaN,NaN,NaN,NaN,t,e],6),p(this,qc,o),p(this,_d,n(Ln,Ed)*i),p(this,xd,n(Ln,$p)*i),p(this,Kc,i),n(this,ga).push(t,e)}isEmpty(){return isNaN(n(this,wt)[8])}add({x:t,y:e}){var F;p(this,rl,t),p(this,al,e);const[s,i,r,a]=n(this,Xs);let[o,l,c,h]=n(this,wt).subarray(8,12);const d=t-c,f=e-h,g=Math.hypot(d,f);if(g<n(this,xd))return!1;const b=g-n(this,_d),w=b/g,A=w*d,y=w*f;let S=o,_=l;o=c,l=h,c+=A,h+=y,(F=n(this,ga))==null||F.push(t,e);const C=-y/b,E=A/b,k=C*n(this,Qc),D=E*n(this,Qc);return n(this,wt).set(n(this,wt).subarray(2,8),0),n(this,wt).set([c+k,h+D],4),n(this,wt).set(n(this,wt).subarray(14,18),12),n(this,wt).set([c-k,h-D],16),isNaN(n(this,wt)[6])?(n(this,pn).length===0&&(n(this,wt).set([o+k,l+D],2),n(this,pn).push(NaN,NaN,NaN,NaN,(o+k-s)/r,(l+D-i)/a),n(this,wt).set([o-k,l-D],14),n(this,$i).push(NaN,NaN,NaN,NaN,(o-k-s)/r,(l-D-i)/a)),n(this,wt).set([S,_,o,l,c,h],6),!this.isEmpty()):(n(this,wt).set([S,_,o,l,c,h],6),Math.abs(Math.atan2(_-l,S-o)-Math.atan2(y,A))<Math.PI/2?([o,l,c,h]=n(this,wt).subarray(2,6),n(this,pn).push(NaN,NaN,NaN,NaN,((o+c)/2-s)/r,((l+h)/2-i)/a),[o,l,S,_]=n(this,wt).subarray(14,18),n(this,$i).push(NaN,NaN,NaN,NaN,((S+o)/2-s)/r,((_+l)/2-i)/a),!0):([S,_,o,l,c,h]=n(this,wt).subarray(0,6),n(this,pn).push(((S+5*o)/6-s)/r,((_+5*l)/6-i)/a,((5*o+c)/6-s)/r,((5*l+h)/6-i)/a,((o+c)/2-s)/r,((l+h)/2-i)/a),[c,h,o,l,S,_]=n(this,wt).subarray(12,18),n(this,$i).push(((S+5*o)/6-s)/r,((_+5*l)/6-i)/a,((5*o+c)/6-s)/r,((5*l+h)/6-i)/a,((o+c)/2-s)/r,((l+h)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=n(this,pn),e=n(this,$i);if(isNaN(n(this,wt)[6])&&!this.isEmpty())return v(this,Te,Iw).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);v(this,Te,Lw).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return v(this,Te,Dw).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,r,a){return new Nw(t,e,s,i,r,a)}getOutlines(){var d;const t=n(this,pn),e=n(this,$i),s=n(this,wt),[i,r,a,o]=n
|
|||
|
|
`);function GE(u){const t=u.split(`
|
|||
|
|
`);let e=0;return t.map((s,i)=>{const r=e,a=r+s.length;return e=a+(i<t.length-1?1:0),{number:i+1,content:s,start:r,end:a}})}function by(u){var t;return((t=u.match(/[\u3400-\u4dbf\u4e00-\u9fff]|[A-Za-z0-9_]+|[^\s]/gu))==null?void 0:t.length)??0}const jE={class:"preview-step"},WE={class:"preview-file-switcher"},XE={class:"file-switcher-control"},qE={class:"file-option"},YE=["title"],KE={key:0},QE={class:"file-switcher-summary"},JE={class:"preview-workspace"},ZE={class:"source-pane"},tC={class:"pane-header"},eC=["data-source-start"],sC={class:"line-number"},iC={class:"line-content"},nC={class:"preview-pane"},rC={class:"pane-header"},aC={class:"pane-header-actions"},oC={class:"preview-toolbar"},lC={class:"preview-list","aria-label":"预览条目列表"},cC=["data-preview-id","aria-selected","onClick","onKeydown"],hC={class:"item-name"},uC={class:"item-source"},dC={class:"item-actions"},fC={key:0,class:"empty-result"},pC={key:1,class:"preview-editor"},gC={class:"editor-heading"},mC={class:"editor-actions"},kh=10,vC=ni({__name:"PreviewCompareStep",props:{sourceText:{},items:{},selectedId:{},processType:{},fileName:{},fileFormat:{},taskId:{},sourceFileId:{},files:{},selectedFileId:{}},emits:["update:selectedId","update:selectedFileId","update:item-content","restore:item","add:item","remove:item"],setup(u,{emit:t}){const e=u,s=t,i=it(null),r=it(""),a=it(1),o=it(null),l=it(""),c=st(()=>GE(e.sourceText)),h=st(()=>e.items.find(I=>I.id===e.selectedId)??e.items[0]),d=st(()=>e.items.find(I=>I.id===o.value)),f=st(()=>{var I,T;return((I=e.fileFormat)==null?void 0:I.toLowerCase().replace(/^\./,""))||((T=e.fileName.split(".").pop())==null?void 0:T.toLowerCase())||""}),g=st(()=>f.value==="pdf"),b=st(()=>["docx","xlsx"].includes(f.value)),w=st(()=>e.items.filter((I,T)=>!r.value.trim()||I.editedContent.toLowerCase().includes(r.value.trim().toLowerCase())||String(T+1).includes(r.value.trim()))),A=st(()=>{const I=(a.value-1)*kh;return w.value.slice(I,I+kh)});function y(I,T){const N=h.value;return!N||N.sourceStart==null||N.sourceEnd==null?!1:T>=N.sourceStart&&I<=N.sourceEnd}function S(I){s("update:selectedId",I)}function _(I){S(I.id),o.value=I.id,l.value=I.editedContent}function C(){o.value=null,l.value=""}function E(){d.value&&(s("update:item-content",d.value.id,l.value),C())}function k(){d.value&&(s("restore:item",d.value.id),C())}function D(I){S(I.id),s("remove:item",I.id)}function M(){C()}Is(r,()=>{a.value=1,C()}),Is(()=>e.selectedFileId,C),Is(h,async I=>{var H,Z;if(!I)return;const T=w.value.findIndex(P=>P.id===I.id);if(T>=0&&(a.value=Math.floor(T/kh)+1),g.value||b.value||I.sourceStart==null)return;await vh();const N=((H=i.value)==null?void 0:H.querySelector(`[data-source-start="${I.sourceStart}"]`))??((Z=i.value)==null?void 0:Z.querySelector(".source-line.is-highlighted"));N==null||N.scrollIntoView({block:"center",behavior:"smooth"})},{immediate:!0});function F(I){return e.items.findIndex(T=>T.id===I.id)+1}function B(I){var T;if((T=I.sourcePages)!=null&&T.length){const N=I.sourcePages[0],H=I.sourcePages[I.sourcePages.length-1];return N===H?`来源:第 ${N} 页`:`来源:第 ${N}–${H} 页`}return I.sourceStartLine==null||I.sourceEndLine==null?"手动新增,无源文件定位":I.sourceStartLine===I.sourceEndLine?`来源:第 ${I.sourceStartLine} 行`:`来源:第 ${I.sourceStartLine}–${I.sourceEndLine} 行`}return(I,T)=>{const N=qd,H=Xd,Z=Ml,P=jd,K=Iy;return O(),$("section",jE,[x("div",WE,[x("div",XE,[T[5]||(T[5]=x("span",null,"当前文件",-1)),V(H,{"model-value":u.selectedFileId,filterable:"",placeholder:"选择文件","aria-label":"选择当前预览文件","onUpdate:modelValue":T[0]||(T[0]=z=>s("update:selectedFileId",z))},{default:tt(()=>[(O(!0),$(xt,null,xe(u.files,z=>(O(),Pt(N,{key:z.id,label:z.name,value:z.id},{default:tt(()=>[x("div",qE,[x("strong",{title:z.name},G(z.name),9,YE),x("span",null,G(z.count.toLocaleString())+" "+G(u.processType==="unstructured"?"个切片":"条记录"),1),z.modifiedCount?(O(),$("em",KE,G(z.modifiedCount)+" 处已修改",1)):ct("",!0)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["model-
|