PageSourceSearch

https://app.paperlessparts.com/app/v33.129.1-8e1e372/dxf_renderer.chunk.f06eb88c.js

js paperlessparts.com collected 2026-10-03 20:37:49 UTC 10,126 bytes, 3 lines download raw bytes

1/*! For license information please see dxf_renderer.chunk.f06eb88c.js.LICENSE.txt */
2"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[27407],{937787:(e,t,n)=>{n.r(t),n.d(t,{DxfSceneCanvas:()=>Y,createDxfRenderer:()=>y});var r=n(63696),o=n(99451),l=n(213893),i=n(665795),s=n(514422),a=n(685943),c=n(739777);const h=({positions:e,colorHex:t,widthPx:n},r)=>{if(e.length<6)return null;const l=r.track(new c.n);l.setPositions(e);const i=r.track(new s.G({color:new o.Q1f(t).getHex(),linewidth:n,worldUnits:!1}));return{object:new a.b(l,i),material:i}},d=(e,t)=>{e.forEach((e=>{e.resolution.set(t.width,t.height)}))},u=()=>{const e=[];return{track:t=>(e.push(t),t),disposeAll(){e.forEach((e=>e.dispose())),e.length=0}}},m=(e,t,n,r)=>{if(e.length<3)return;const l=e.map((([e,t])=>new o.I9Y(e,t)));let i,s=0;for(let e=0;e<l.length;e+=1){const t=l[e],n=l[(e+1)%l.length];s+=t.x*n.y-n.x*t.y}s<0&&l.reverse();try{i=o.xJ6.triangulateShape(l,[])}catch{return}if(0===i.length)return;const a=t.length/3;l.forEach((({x:e,y:n})=>{t.push(e,n,0),e<r.minX&&(r.minX=e),n<r.minY&&(r.minY=n),e>r.maxX&&(r.maxX=e),n>r.maxY&&(r.maxY=n)})),i.forEach((([e,t,r])=>{n.push(a+e,a+t,a+r)}))},p=({rings:e,colorHex:t,opacity:n},r)=>e.reduce(((e,{holes:t})=>Math.max(e,t.length)),0)>=64||e.length>=64||(e=>{const t=e.filter((({outer:e})=>e.length>=3)).map((({outer:e})=>(e=>{let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.forEach((([e,l])=>{e<t&&(t=e),l<n&&(n=l),e>r&&(r=e),l>o&&(o=l)})),{minX:t,minY:n,maxX:r,maxY:o}})(e)));for(let e=0;e<t.length;e+=1)for(let o=e+1;o<t.length;o+=1)if(n=t[e],r=t[o],n.minX<=r.maxX&&r.minX<=n.maxX&&n.minY<=r.maxY&&r.minY<=n.maxY)return!0;var n,r;return!1})(e)?((e,t,n,r)=>{const l=[],i=[],s={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY};
2if(e.forEach((({outer:e,holes:t})=>{m(e,l,i,s),t.forEach((e=>{m(e,l,i,s)}))})),0===i.length)return null;const a=r.track(new o.LoY);a.setAttribute("position",new o.THS(new Float32Array(l),3)),a.setIndex(i);const c=r.track(new o.V9B({side:o.hB5,colorWrite:!1,depthWrite:!1,depthTest:!1,stencilWrite:!0,stencilRef:0,stencilFunc:o.sKt,stencilFail:o.oVO,stencilZFail:o.oVO,stencilZPass:o.oVO})),h=new o.eaF(a,c);h.frustumCulled=!1;const{minX:d,minY:u,maxX:p,maxY:w}=s,f=r.track(new o.LoY);f.setAttribute("position",new o.THS(new Float32Array([d,u,0,p,u,0,p,w,0,d,w,0]),3)),f.setIndex([0,1,2,0,2,3]);const x=r.track(new o.V9B({color:new o.Q1f(t),transparent:!0,opacity:n,depthWrite:!1,depthTest:!0,side:o.hB5,stencilWrite:!0,stencilWriteMask:0,stencilFunc:o.klZ,stencilRef:0,stencilFail:o.VVr,stencilZFail:o.VVr,stencilZPass:o.VVr})),g=new o.eaF(f,x);return g.frustumCulled=!1,{objects:[h,g],mask:h,cover:g,material:x}})(e,t,n,r):((e,t,n,r)=>{const l=((e,t,n)=>n.track(new o.V9B({color:new o.Q1f(e),transparent:!0,opacity:t,depthWrite:!1,depthTest:!0,side:o.$EB})))(t,n,r),i=e.filter((({outer:e})=>e.length>=3)).map((({outer:e,holes:t})=>{const n=new o.ypk(e.map((([e,t])=>new o.I9Y(e,t))));return t.forEach((e=>{e.length<3||n.holes.push(new o.wAk(e.map((([e,t])=>new o.I9Y(e,t)))))})),new o.eaF(r.track(new o.MSw(n)),l)}));return i.length>0?{objects:i,material:l}:null})(e,t,n,r);var w=n(107047),f=n(800318);const x=e=>Math.max(2,e),g=e=>new o.Q1f(e).getHex(),I=new Set([w.kmU.LINE,w.kmU.POLYLINE,w.kmU.LWPOLYLINE]),b=new Set,v=(e,t)=>{const n=e.slice();for(let e=2;e<n.length;e+=3)n[e]=t;return n},y=(e,{backgroundColor:t,monochromeColor:n})=>{const r=new o.Q1f(n).getHex(),a=new o.JeP({antialias:!0,alpha:!1,stencil:!0});a.setPixelRatio(window.devicePixelRatio),a.setClearColor(t,1),a.domElement.style.display="block",a.domElement.style.width="100%",a.domElement.style.height="100%",e.appendChild(a.domElement);const c=new o.Z58,m=(()=>{const e=new o.qUd(-1,1,1,-1,.1,10);return e.position.set(0,0,5),{camera:e,apply(t,n){const r=n.width/2/t.scale,o=n.height/2/t.scale,[l,i]=t.center;e.left=-r,e.right=r,e.top=o,e.bottom=-o,e.position.set(l,i,5),e.rotation.z=t.quarterTurns*Math.PI/2,e.updateProjectionMatrix()}}})(),w=new o.YJl;c.add(w);let y=null,E=null,Y=null;const k=new o.YJl;c.add(k);let N=null,P=[];const H=new o.YJl;c.add(H);let V=null,A=[],T=null,F=null,S=null,j={width:0,height:0},C=b,O=!1,X=!0,M=!0,L=!1;const z=()=>{T?.strokes.forEach((({material:e,colorHex:t})=>{e.color.setHex(X?t:r)})),T?.fills.forEach((({material:e,colorHex:t})=>{e.color.setHex(X?t:r)}))},Q=()=>{T?.strokes.forEach((({material:e})=>{e.visible=M}))},R=(e=>{let t=null,n=!1;const r=()=>{t=null,n||e()};return{invalidate(){n||null!==t||(t=requestAnimationFrame(r))},dispose(){n=!0,null!==t&&(cancelAnimationFrame(t),t=null)}}})((()=>{L||!S||j.width<=0||j.height<=0||(T?.layers.forEach((({layerIndex:e,group:t})=>{t.visible=!C.has(e)})),T&&(T.pmiRoot.visible=O),m.apply(S,j),a.setPixelRatio(window.devicePixelRatio),a.setSize(j.width,j.height,!1),d(T?.lineMaterials??[],j),d(P,j),d(A,j),a.render(c,m.camera))}));let $=null;const B=()=>{null!==$&&(clearTimeout($),$=null)},W=()=>{var e,t;S&&(e=P,t=S.scale,e.forEach((e=>{const n=e.userData.baseDash;n&&(e.dashSize=n[0]/t,e.gapSize=n[1]/t)})),R.invalidate())},J=()=>{H.clear(),V?.disposeAll(),V=null,A=[]},_=()=>{k.clear(),N?.disposeAll(),N=null,P=[]},D=()=>{w.clear(),y?.disposeAll(),y=null,E=null,Y=null},G=()=>{T&&(c.remove(T.root),(e=>{e.scope.disposeAll(),e.root.clear()})(T),T=null)};return{setScene(e,t){e!==F&&(F=e,G(),e&&(T=((e,t=new Set)=>{const n=u(),r=new o.YJl,l=new o.YJl;l.name="dxf-pmi",r.add(l);const i=[],s=[],a=[],c=new Map,d=e=>{const t=c.get(e);if(t)return t;const n=new o.YJl;return n.name=`dxf-layer-${e}`,c.set(e,n),r.add(n),n};e.layers.forEach(((e,t)=>d(t)));const m=new Map;e.entities.forEach((r=>{if(0===r.pts.length)return;const i=((e,t)=>e.styles[t.style]??e.layers[t.layer]?.style??{rgb:"#000000",lineweight:0,dash:[]})(e,r),s=t.has((e=>e.src?.length?`${e.h}/${e.src.join("/")}`:e.h)(r));if(r.fill){const e=g(i.rgb),t=(({ring:e,holes:t,colorHex:n},r)=>{if(e.length<3)return null;const l=new o.ypk(e.map((([e,t])=>new o.I9Y(e,t))));
2(t??[]).forEach((e=>{e.length<3||l.holes.push(new o.wAk(e.map((([e,t])=>new o.I9Y(e,t)))))}));const i=r.track(new o.MSw(l)),s=r.track(new o.V9B({color:new o.Q1f(n),side:o.$EB}));return new o.eaF(i,s)})({ring:r.pts,holes:r.holes,colorHex:e},n);if(t){(s?l:d(r.layer)).add(t);const n=t.material;n&&"object"==typeof n&&"color"in n&&a.push({material:n,colorHex:e})}return}const c=`${s?"pmi":r.layer}|${(e=>`${e.rgb}|${e.lineweight}|${e.dash.join(",")}`)(i)}`;let h=m.get(c);if(h||(h={rgb:i.rgb,lineweight:i.lineweight,layerIndex:r.layer,isPmi:s,expansion:{segments:[],dots:[]}},m.set(c,h)),1!==r.pts.length)(0,f.bv)(r.pts,i.dash,h.expansion,{restartAtVertices:I.has(r.t)});else{const[e,t]=r.pts[0];h.expansion.dots.push(e,t,0)}})),m.forEach((({rgb:e,lineweight:t,layerIndex:r,isPmi:a,expansion:c})=>{const u=a?l:d(r),m=g(e),p=(w=t,Math.max(1,3.7795275590551185*(w||0)));var w;const f=h({positions:c.segments,colorHex:m,widthPx:p},n);f&&(i.push(f.material),s.push({material:f.material,colorHex:m}),u.add(f.object));const I=(({positions:e,colorHex:t,sizePx:n},r)=>{if(e.length<3)return null;const l=r.track(new o.LoY);l.setAttribute("position",new o.qtW(e,3));const i=r.track(new o.BH$({color:new o.Q1f(t),size:n,sizeAttenuation:!1}));return new o.ONl(l,i)})({positions:c.dots,colorHex:m,sizePx:x(p)},n);I&&u.add(I)}));const p=Array.from(c.entries()).map((([e,t])=>({layerIndex:e,group:t}))).sort(((e,t)=>e.layerIndex-t.layerIndex));return{root:r,layers:p,pmiRoot:l,lineMaterials:i,strokes:s,fills:a,scope:n}})(e,t),c.add(T.root),z(),Q()),R.invalidate())},setView(e,t){S===e&&j.width===t.width&&j.height===t.height||(S=e,j=t,R.invalidate(),B(),$=setTimeout((()=>{$=null,L||W()}),350))},setHiddenLayers(e){e!==C&&(C=e,R.invalidate())},setPmiVisible(e){e!==O&&(O=e,R.invalidate())},setLayerColoring(e){e!==X&&(X=e,z(),R.invalidate())},setStrokesVisible(e){e!==M&&(M=e,Q(),R.invalidate())},setAccents(e){if(J(),e){const t=u();[e.hover,e.selection,e.preview].forEach((e=>{if(!e||0===e.positions.length)return;const n=h({positions:v(e.positions,.01),colorHex:new o.Q1f(e.color).getHex(),widthPx:e.widthPx},t);n&&(n.object.renderOrder=2,A.push(n.material),H.add(n.object))})),V=t}R.invalidate()},setOverlayBatches(e){if(_(),e?.length){const t=u();e.forEach((e=>{if(e.dash){const n=(({polylines:e,colorHex:t,widthPx:n,dash:r},a)=>{const c=a.track(new s.G({color:new o.Q1f(t).getHex(),linewidth:n,worldUnits:!1,dashed:!0}));c.userData.baseDash=r;const h=e.filter((e=>e.length>=6)).map((e=>{const t=a.track(new i.v);t.setPositions(e);const n=new l.X(t,c);return n.computeLineDistances(),n}));return h.length>0?{objects:h,material:c}:null})({polylines:(e.polylines??[]).map((e=>v(e,.005))),colorHex:new o.Q1f(e.color).getHex(),widthPx:e.widthPx,dash:e.dash},t);return void(n&&(n.objects.forEach((e=>{e.renderOrder=1,k.add(e)})),P.push(n.material)))}if(0===e.positions.length)return;const n=h({positions:v(e.positions,.005),colorHex:new o.Q1f(e.color).getHex(),widthPx:e.widthPx},t);n&&(n.object.renderOrder=1,P.push(n.material),k.add(n.object))})),N=t}W(),R.invalidate()},setMaterialFill(e){if(e===Y)return;if(!e?.length)return w.visible=!1,Y=null,void R.invalidate();if(e===E&&y)return w.visible=!0,Y=e,void R.invalidate();D();const t=u(),n=p({rings:e,colorHex:16777215,opacity:.06},t);if(!n)return t.disposeAll(),w.visible=!1,void R.invalidate();n.objects.forEach((e=>{e.renderOrder=0,e.position.z=-.001,w.add(e)})),y=t,E=e,Y=e,w.visible=!0,R.invalidate()},invalidate:R.invalidate,dispose(){L=!0,B(),R.dispose(),J(),_(),D(),G(),a.domElement.remove(),a.dispose()}}};var E=n(562540);const Y=({onAttach:e,backgroundColor:t,monochromeColor:n,zIndex:o})=>{const l=(0,r.useRef)(null),i=(0,r.useRef)(e);return i.current=e,(0,r.useEffect)((()=>{const e=l.current;if(!e)return;const r=y(e,{backgroundColor:t,monochromeColor:n}),o=i.current(r);return()=>{o(),r.dispose()}}),[t,n]),(0,E.jsx)("div",{ref:l,style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:o},"data-testid":"dxf-scene-canvas"})}}}]);
3//# sourceMappingURL=dxf_renderer.chunk.f06eb88c.js.map

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.