PageSourceSearch

https://dc-tools.cc/assets/TextSortNaturalTool-DrWpzx9A.js

js dc-tools.cc collected 2026-10-02 01:19:39 UTC 3,278 bytes, 1 lines download raw bytes

1import{r as n,j as e}from"./index-Cp6oVmJn.js";import{T as E}from"./ToolSeoSection-RrG1c4TM.js";import{g as P,r as R}from"./generatedTextTransforms-DWxAXewb.js";/* empty css                     */const p="text_sort_natural",B={name:"text"},y=[],N={},T={zh:{title:"自然排序",subtitle:"用自然排序排列多行文字,讓 item2 排在 item10 前面,適合整理檔名、清單與編號資料。",inputPlaceholder:"在此輸入或貼上內容...",processBtn:"開始處理",processing:"處理中...",copyBtn:"複製結果",downloadBtn:"下載結果",reset:"重置",empty:"請先輸入要處理的內容。",copied:"已複製"},en:{title:"Natural Sort Lines",subtitle:"Sort lines with natural ordering so item2 comes before item10.",inputPlaceholder:"Enter or paste content here...",processBtn:"Process",processing:"Processing...",copyBtn:"Copy Result",downloadBtn:"Download Result",reset:"Reset",empty:"Enter content before processing.",copied:"Copied"}},L=i=>String(i).toLowerCase().startsWith("en")?T.en:T.zh;function D({language:i="zh"}){const[c,u]=n.useState(""),[d,m]=n.useState(N),[a,x]=n.useState(""),[g,l]=n.useState(""),[h,b]=n.useState(!1),s=L(i),j=n.useMemo(()=>c.trim().length>0,[c]),S=(t,o)=>{m(r=>({...r,[t]:o}))},v=()=>{if(!j){l(s.empty);return}b(!0);try{const t=R(p,{text:c,...d});x(t),l("")}catch(t){l(t.message||"Failed to process input.")}finally{b(!1)}},f=async()=>{a&&(await navigator.clipboard.writeText(a),l(s.copied))},w=()=>{if(!a)return;const t=new Blob([a],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(t),r=document.createElement("a");r.href=o,r.download=`${p}-result.txt`,r.click(),URL.revokeObjectURL(o)},C=()=>{u(""),m(N),x(""),l("")};return e.jsxs("div",{className:"tool-page",children:[e.jsxs("div",{className:"tool-page-content",children:[e.jsx("h1",{className:"tool-page-title",children:s.title}),e.jsx("p",{className:"tool-page-subtitle",children:s.subtitle}),e.jsxs("div",{className:"tool-page-body",children:[y.length>0&&e.jsx("div",{className:"tool-page-actions","aria-label":"Tool options",children:y.map(t=>e.jsxs("label",{style:{display:"grid",gap:"6px",minWidth:"180px"},children:[e.jsx("span",{className:"tool-page-stat-label",children:t.name}),e.jsx("input",{className:"tool-page-textarea",style:{minHeight:"auto",resize:"none"},type:"text",value:d[t.name]??"",onChange:o=>S(t.name,o.target.value)})]},t.name))}),e.jsx("textarea",{className:"tool-page-textarea",value:c,onChange:t=>u(t.target.value),placeholder:s.inputPlaceholder,"aria-label":B.name,rows:10}),e.jsxs("div",{className:"tool-page-actions",children:[e.jsx("button",{className:"tool-page-btn primary",onClick:v,disabled:!j||h,children:h?s.processing:s.processBtn}),a&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tool-page-btn secondary",onClick:f,children:s.copyBtn}),e.jsx("button",{className:"tool-page-btn secondary",onClick:w,children:s.downloadBtn}),e.jsx("button",{className:"tool-page-btn secondary",onClick:C,children:s.reset})]})]}),g&&e.jsx("p",{className:"tool-page-subtitle","aria-live":"polite",children:g}),a&&e.jsx("div",{className:"tool-page-result",children:e.jsx("textarea",{className:"tool-page-textarea output",value:a,readOnly:!0,rows:10,"aria-label":"result"})})]})]}),e.jsx(E,{seoData:P[p]})]})}export{D as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.