PageSourceSearch

https://orthobridge.eu/assets/ShowJS-DYst-ySQ.js

js orthobridge.eu collected 2026-10-08 05:44:13 UTC 11,334 bytes, 3 lines download raw bytes

1import{bu as le,u as P,r as s,aa as ae,cH as ie,c as Y,a as c,cu as re,ct as ue,S as de,al as he,G as K,y as fe,T as pe,U as Z,B as Q,cI as me,R as we,bC as xe,o as ge,bb as Se,cJ as Ce,cw as be}from"./index-a1sN8VY_.js";import{c as ke}from"./createToolFlow-BB8VivOj.js";import{u as je}from"./useBaseTool-CVpjH0lc.js";import{D as ve}from"./DownloadRounded-fm7dz1Uc.js";import"./vendor-react-CW0cBZaz.js";import"./pdf-engine-DkeLIkTF.js";import"./ToolStep-Curr4moQ.js";import"./Undo-HulwD6jH.js";import"./TextFields-DfF3ytsK.js";import"./useViewScopedFiles-B_R8NRBe.js";const X={},ye=()=>le({defaultParameters:X,endpointName:"show-javascript"}),ee=()=>{const{t}=P(),[r,d]=s.useState(!1),[u,i]=s.useState(""),[b,w]=s.useState(null),[p,h]=s.useState([]),[l,x]=s.useState(null),[m,g]=s.useState(""),[E,R]=s.useState(null),k=s.useRef(!1),S=s.useRef(null),N=s.useCallback(()=>{S.current&&(URL.revokeObjectURL(S.current),S.current=null)},[]),a=s.useCallback(()=>{k.current=!1,R(null),h([]),N(),x(null),g(""),i(""),w(null)},[N]),$=s.useCallback(()=>{w(null)},[]),L=s.useCallback(async(f,j)=>{if(j.length===0){w(t("noFileSelected","No file loaded"));return}k.current=!1,d(!0),i(t("showJS.processing","Extracting JavaScript...")),w(null),R(null),h([]),N(),x(null),g("");try{const v=j[0],T=new FormData;T.append("fileInput",v);const n=await ae.post("/api/v1/misc/show-javascript",T,{responseType:"text"}
1),o=typeof n.data=="string"?n.data:"";R(o);const C=new File([o],(v.name?.replace(/\.[^.]+$/,"")||"extracted")+".js",{type:"application/javascript"});h([C]);const F=URL.createObjectURL(C);S.current=F,x(F),g(C.name),i(t("showJS.done","JavaScript extracted"))}catch(v){w(ie(v)),i("")}finally{d(!1)}},[t,N]),B=s.useCallback(()=>{k.current=!0,d(!1),i(t("operationCancelled","Operation cancelled"))},[t]),e=s.useCallback(async()=>{i(t("nothingToUndo","Nothing to undo"))},[t]);return{files:p,thumbnails:[],isGeneratingThumbnails:!1,downloadUrl:l,downloadFilename:m,isLoading:r,status:u,errorMessage:b,progress:null,scriptText:E,executeOperation:L,resetResults:a,clearError:$,cancelOperation:B,undoOperation:e}},Ne=Y(c.jsx("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0s.39-1.02 0-1.41l-6.59-6.59a.996.996 0 0 0-1.41 0l-6.6 6.58c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1"})),Te=Y(c.jsx("path",{d:"M11 5v11.17l-4.88-4.88c-.39-.39-1.03-.39-1.42 0s-.39 1.02 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0L13 16.17V5c0-.55-.45-1-1-1s-1 .45-1 1"})),Ee=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","await","of"]);function Re(t,r=Ee){const d=[];let u=[],i=0,b=!1,w=!1,p=null,h=!1;const l=(e,f)=>{f&&u.push({type:e,text:f})},x=(e=1)=>{i+=e},m=()=>{d.push(u),u=[],w=!1,x()},g=e=>{l("com",e),x()},E=()=>{l("com","*/"),b=!1,x(2)},R=e=>{l("com",e),x()},k=e=>{l("str",e),h?h=!1:e==="\\"?h=!0:e===p&&(p=null),x()},S=()=>{l("com","//"),w=!0,x(2)},N=()=>{l("com","/*"),b=!0,x(2)},a=e=>{p=e,l("str",e),x()},$=()=>{let e=i+1;const f=j=>/[0-9._xobA-Fa-f]/.test(j);for(;e<t.length&&f(t[e]);)e++;l("num",t.slice(i,e)),i=e},L=()=>{let e=i+1;const f=T=>/[A-Za-z0-9_$]/.test(T);for(;e<t.length&&f(t[e]);)e++;const j=t.slice(i,e),v=r.has(j);l(v?"kw":"plain",j),i=e},B=e=>{l("plain",e),x()};for(;i<t.length;){const e=t[i],f=t[i+1],j=e===`
2`,v=e==="/"&&f==="/",T=e==="/"&&f==="*",n=e==="'"||e==='"'||e==="`",o=/[0-9]/.test(e),C=/[A-Za-z_$]/.test(e);if(j){m();continue}if(w){g(e);continue}if(b){if(e==="*"&&f==="/"){E();continue}R(e);continue}if(p){k(e);continue}if(v){S();continue}if(T){N();continue}if(n){a(e);continue}if(o){$();continue}if(C){L();continue}B(e)}return d.push(u),d}function Be(t){const r=[];let d=0,u=0,i=!1,b=!1,w=null,p=!1;const h=[],l=(a=1)=>{d+=a},x=()=>
2{u++,b=!1,l()},m=()=>{b=!0,l(2)},g=()=>{i=!0,l(2)},E=()=>{i=!1,l(2)},R=a=>{w=a,l()},k=a=>{p?p=!1:a==="\\"?p=!0:a===w&&(w=null),l()},S=()=>{h.push(u),l()},N=()=>{const a=h.pop();a!=null&&u>a&&r.push({start:a,end:u}),l()};for(;d<t.length;){const a=t[d],$=t[d+1],L=a===`
3`,B=a==="/"&&$==="/",e=a==="/"&&$==="*",f=a==="*"&&$==="/",j=a==="'"||a==='"'||a==="`",v=a==="{",T=a==="}";if(L){x();continue}if(b){l();continue}if(i){f?E():l();continue}if(w){k(a);continue}if(B){m();continue}if(e){g();continue}if(j){R(a);continue}if(v){S();continue}if(T){N();continue}l()}return r}function Ie(t,r){if(!r)return[];const d=r.toLowerCase(),u=[];return t.forEach((i,b)=>{const w=i.map(h=>h.text).join("");let p=0;for(;;){const h=w.toLowerCase().indexOf(d,p);if(h===-1)break;u.push({line:b,start:h,end:h+d.length}),p=h+Math.max(1,d.length)}}),u}async function $e(t,r){try{if(typeof navigator<"u"&&navigator.clipboard)return await navigator.clipboard.writeText(t||""),!0}catch{}if(typeof document>"u"||!r)return!1;const d=window.getSelection(),u=document.createRange();u.selectNodeContents(r),d?.removeAllRanges(),d?.addRange(u);try{return document.execCommand("copy"),!0}finally{d?.removeAllRanges()}}async function Fe(t,r){await re(t,r)}const Le=({data:t})=>{const{t:r}=P(),d=ue(),u=s.useMemo(()=>typeof t=="string"?t:t?.scriptText??"",[t]),i=s.useMemo(()=>typeof t=="string"?null:t?.downloadUrl??null,[t]),b=s.useMemo(()=>typeof t=="string"?null:t?.downloadFilename??null,[t]),[w,p]=s.useState(!1),h=s.useRef(null),l=s.useRef(null),x=s.useCallback(async()=>{await $e(u||"",h.current)&&(p(!0),setTimeout(()=>p(!1),1200))},[u]),m=s.useCallback(()=>{i&&Fe(i,b||"extracted.js")},[i,b]),[g,E]=s.useState([]),[R,k]=s.useState([]),[S,N]=s.useState(new Set);s.useEffect(()=>{const n=u||"";E(Re(n)),k(Be(n)),N(new Set)},[u]);const a=s.useMemo(()=>{const n=new Map;for(const o of R)n.has(o.start)||n.set(o.start,o.end);return n},[R]),$=s.useCallback(n=>{for(const o of S){const C=a.get(o);if(C!=null&&n>o&&n<=C)return!0}return!1},[S,a]),L=n=>{a.has(n)&&N(o=>{const C=new Set(o);return C.has(n)?C.delete(n):C.add(n),C})},[B,e]=s.useState(""),[f,j]=s.useState([]),[v,T]=s.useState(0);return s.useEffect(()=>{if(!B){j([]),T(0);return}const n=Ie(g,B);j(n),T((n.length,0))},[B,g]),s.useEffect(()=>{const n=f[v];if(n){for(const[o,C]of a.entries())n.line>o&&n.line<=C&&S.has(o)&&N(F=>{const J=new Set(F);return J.delete(o),J});if(l.current){const o=l.current.querySelector(`[data-code-line="${n.line}"]`);o&&o.scrollIntoView({block:"nearest",behavior:"smooth"})}}},[v,f,a,S]),c.jsx(de,{gap:"sm",p:"sm",className:"showjs-root",children:c.jsxs(he,{className:"showjs-container",children:[c.jsxs("div",{className:"showjs-toolbar",children:[c.jsxs(K,{gap:"xs",align:"center",className:"showjs-toolbar-controls",children:[c.jsx(fe,{value:B,onChange:n=>e(n.currentTarget.value),size:"xs",placeholder:r("search.placeholder","Enter search term..."),className:"showjs-search-input"}),c.jsx(pe,{size:"xs",c:"dimmed",children:f.length?`${v+1}/${f.length}`:"0/0"}),c.jsx(Z,{size:"sm",variant:"subtle",onClick:()=>{f.length&&T(n=>(n-1+f.length)%f.length)},"aria-label":r("common.previous","Previous"),children:c.jsx(Ne,{fontSize:"small"})}),c.jsx(Z,{size:"sm",variant:"subtle",onClick:()=>{f.length&&T(n=>(n+1)%f.length)},"aria-label":r("common.next","Next"),children:c.jsx(Te,{fontSize:"small"})})]}),c.jsxs(K,{gap:"xs",align:"center",className:"showjs-toolbar-controls",children:[c.jsx(Q,{size:"xs",variant:"subtle",className:"showjs-outline-button",onClick:m,disabled:!i,leftSection:c.jsx(ve,{fontSize:"small"}),children:d.download}),c.jsx(Q,{size:"xs",variant:"subtle",className:"showjs-outline-button",onClick:x,leftSection:c.jsx(me,{fontSize:"small"}),children:w?r("common.copied","Copied!"):r("common.copy","Copy")})]})]}),c.jsx(we,{className:"showjs-scrollarea",offsetScrollbars:!0,children:c.jsx("div",{ref:l,className:"showjs-inner",children:c.jsx("div",{ref:h,className:"showjs-code",children:g.map((n,o)=>{if($(o))return null;const C=a.get(o),F=C!=null&&S.has(o);let J=0;const q=f.map((I,U)=>({...I,idx:U})).filter(I=>I.line===o),z=[];
3return n.forEach((I,U)=>{const D=I.text,W=J,V=J+D.length;if(!B||q.length===0){const y=I.type==="plain"?void 0:`tok-${I.type}`;z.push(c.jsx("span",{className:y,children:D},`t-${o}-${U}`)),J=V;return}const G=q.filter(y=>y.start<V&&y.end>W).sort((y,A)=>y.start-A.start);if(G.length===0){const y=I.type==="plain"?void 0:`tok-${I.type}`;z.push(c.jsx("span",{className:y,children:D},`t-${o}-${U}`)),J=V;return}let M=0;const _=I.type==="plain"?"":`tok-${I.type}`;if(G.forEach((y,A)=>{const O=Math.max(0,y.start-W),H=Math.min(D.length,y.end-W);if(O>M){const oe=D.slice(M,O),ce=_||void 0;z.push(c.jsx("span",{className:ce,children:oe},`t-${o}-${U}-b-${M}`))}const se=D.slice(O,H),ne=["search-hit",y.idx===v?"search-hit-active":"",_].filter(Boolean).join(" ")||void 0;z.push(c.jsx("span",{className:ne,children:se},`t-${o}-${U}-h-${O}-${A}`)),M=H}),M<D.length){const y=D.slice(M),A=_||void 0;z.push(c.jsx("span",{className:A,children:y},`t-${o}-${U}-a-${M}`))}J=V}),c.jsxs("div",{className:"code-line","data-code-line":o,children:[c.jsxs("div",{className:"code-gutter",children:[C!=null?c.jsx("button",{className:`fold-toggle ${F?"fold-collapsed":""}`,onClick:()=>L(o),"aria-label":F?r("common.expand","Expand"):r("common.collapse","Collapse"),children:F?"▸":"▾"}):c.jsx("span",{className:"fold-placeholder"}),c.jsx("span",{className:"line-number",children:o+1})]}),c.jsxs("div",{className:"code-content",children:[z,F&&c.jsx("span",{className:"collapsed-inline",children:"{...}"})]})]},`l-${o}`)})})})})]})})},Je=t=>{const{t:r}=P(),{actions:d}=xe(),u=ge(),{registerCustomWorkbenchView:i,unregisterCustomWorkbenchView:b,setCustomWorkbenchViewData:w,clearCustomWorkbenchViewData:p}=Se(),h="showJSView",l="custom:showJS",x=s.useMemo(()=>c.jsx(Ce,{fontSize:"small"}),[]),m=je("showJS",ye,ee,t,{minFiles:1}),g=m.operation,E=!!g.scriptText,{clearSelections:R}=be();s.useEffect(()=>(i({id:h,workbenchId:l,label:r("showJS.view.title","JavaScript"),icon:x,component:({data:S})=>c.jsx(Le,{data:S})}),()=>{p(h),b(h)}),[p,i,r,b,x]);const k=s.useRef(null);return s.useEffect(()=>{if(g.scriptText){w(h,{scriptText:g.scriptText,downloadUrl:g.downloadUrl,downloadFilename:g.downloadFilename});const S=g.scriptText.length;(k.current==null||S!==k.current)&&(k.current=S,u.selectedTool==="showJS"&&u.workbench!==l&&d.setWorkbench(l))}else p(h),k.current=null},[p,d,u.selectedTool,u.workbench,g.scriptText,w]),s.useEffect(()=>{if((m.selectedFiles?.length??0)===0){try{m.operation.resetResults()}catch{}try{p(h)}catch{}if(u.workbench===l)try{d.setWorkbench("fileEditor")}catch{}k.current=null}},[m.selectedFiles?.length,m.operation,p,d,u.workbench]),ke({files:{selectedFiles:m.selectedFiles,isCollapsed:!1},steps:[],executeButton:{text:E?r("back","Back"):r("showJS.submit","Extract JavaScript"),loadingText:r("loading","Loading..."),onClick:E?async()=>{try{await m.operation.resetResults()}catch{}try{R()}catch{}try{p(h)}catch{}try{d.setWorkbench("fileEditor")}catch{}}:m.handleExecute,disabled:E?!1:!m.hasFiles||(m.selectedFiles?.length??0)!==1||m.operation.isLoading||m.endpointLoading||m.endpointEnabled===!1,isVisible:!0},review:{isVisible:E,operation:m.operation,title:r("showJS.results","Result"),onUndo:void 0}})},te=Je;te.tool=()=>ee;te.getDefaultParameters=()=>({...X});export{te 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.