@classcad/mcp 0.3.3 → 0.3.4
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.
- package/dist/app/SOURCE.txt +2 -2
- package/dist/app/assets/{index-c650c783.js → index-f84cd890.js} +2 -2
- package/dist/app/assets/{troika-three-text.esm-188d86b5.js → troika-three-text.esm-6386308e.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.js +1 -1
- package/package.json +1 -1
package/dist/app/SOURCE.txt
CHANGED
|
@@ -4752,7 +4752,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4752
4752
|
#include <premultiplied_alpha_fragment>
|
|
4753
4753
|
|
|
4754
4754
|
}
|
|
4755
|
-
`,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const pZ=new j,hZ=new j,vo=new Fn,go=new Fn,Ou=new Fn,TL=new j,OL=new Je,Bo=new ZB,mZ=new j,rP=new Br,iP=new oo,ku=new Fn;let Gu,Wz,ove,Vm;function vZ(t,e,n){return ku.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ku.multiplyScalar(1/ku.w),ku.x=Vm/n.width,ku.y=Vm/n.height,ku.applyMatrix4(t.projectionMatrixInverse),ku.multiplyScalar(1/ku.w),Math.abs(Math.max(ku.x,ku.y))}function GQe(t,e){for(let n=0,r=Wz.count;n<r;n++){Bo.start.fromBufferAttribute(Wz,n),Bo.end.fromBufferAttribute(ove,n);const i=new j,a=new j;Gu.distanceSqToSegment(Bo.start,Bo.end,a,i),a.distanceTo(i)<Vm*.5&&e.push({point:a,pointOnLine:i,distance:Gu.origin.distanceTo(a),object:t,face:null,faceIndex:n,uv:null,uv2:null})}}function WQe(t,e,n){const r=e.projectionMatrix,a=t.material.resolution,o=t.matrixWorld,s=t.geometry,l=s.attributes.instanceStart,c=s.attributes.instanceEnd,u=-e.near;Gu.at(1,Ou),Ou.w=1,Ou.applyMatrix4(e.matrixWorldInverse),Ou.applyMatrix4(r),Ou.multiplyScalar(1/Ou.w),Ou.x*=a.x/2,Ou.y*=a.y/2,Ou.z=0,TL.copy(Ou),OL.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,f=l.count;d<f;d++){if(vo.fromBufferAttribute(l,d),go.fromBufferAttribute(c,d),vo.w=1,go.w=1,vo.applyMatrix4(OL),go.applyMatrix4(OL),vo.z>u&&go.z>u)continue;if(vo.z>u){const x=vo.z-go.z,C=(vo.z-u)/x;vo.lerp(go,C)}else if(go.z>u){const x=go.z-vo.z,C=(go.z-u)/x;go.lerp(vo,C)}vo.applyMatrix4(r),go.applyMatrix4(r),vo.multiplyScalar(1/vo.w),go.multiplyScalar(1/go.w),vo.x*=a.x/2,vo.y*=a.y/2,go.x*=a.x/2,go.y*=a.y/2,Bo.start.copy(vo),Bo.start.z=0,Bo.end.copy(go),Bo.end.z=0;const m=Bo.closestPointToPointParameter(TL,!0);Bo.at(m,mZ);const y=Xy.lerp(vo.z,go.z,m),g=y>=-1&&y<=1,v=TL.distanceTo(mZ)<Vm*.5;if(g&&v){Bo.start.fromBufferAttribute(l,d),Bo.end.fromBufferAttribute(c,d),Bo.start.applyMatrix4(o),Bo.end.applyMatrix4(o);const x=new j,C=new j;Gu.distanceSqToSegment(Bo.start,Bo.end,C,x),n.push({point:C,pointOnLine:x,distance:Gu.origin.distanceTo(C),object:t,face:null,faceIndex:d,uv:null,uv2:null})}}}class sve extends Ur{constructor(e=new Jj,n=new e8({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let o=0,s=0,l=n.count;o<l;o++,s+=2)pZ.fromBufferAttribute(n,o),hZ.fromBufferAttribute(r,o),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+pZ.distanceTo(hZ);const a=new eh(i,2,1);return e.setAttribute("instanceDistanceStart",new sa(a,1,0)),e.setAttribute("instanceDistanceEnd",new sa(a,1,1)),this}raycast(e,n){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Gu=e.ray;const o=this.matrixWorld,s=this.geometry,l=this.material;Vm=l.linewidth+a,Wz=s.attributes.instanceStart,ove=s.attributes.instanceEnd,s.boundingSphere===null&&s.computeBoundingSphere(),iP.copy(s.boundingSphere).applyMatrix4(o);let c;if(r)c=Vm*.5;else{const d=Math.max(i.near,iP.distanceToPoint(Gu.origin));c=vZ(i,d,l.resolution)}if(iP.radius+=c,Gu.intersectsSphere(iP)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),rP.copy(s.boundingBox).applyMatrix4(o);let u;if(r)u=Vm*.5;else{const d=Math.max(i.near,rP.distanceToPoint(Gu.origin));u=vZ(i,d,l.resolution)}rP.expandByScalar(u),Gu.intersectsBox(rP)!==!1&&(r?GQe(this,n):WQe(this,i,n))}}class $Qe extends sve{constructor(e=new ave,n=new e8({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const vR=w.forwardRef(function({points:e,color:n="black",vertexColors:r,linewidth:i,lineWidth:a,segments:o,dashed:s,...l},c){const u=Tt(m=>m.size),d=w.useMemo(()=>o?new sve:new $Qe,[o]),[f]=w.useState(()=>new e8),p=w.useMemo(()=>{const m=o?new Jj:new ave,y=e.map(g=>{const v=Array.isArray(g);return g instanceof j?[g.x,g.y,g.z]:g instanceof Fe?[g.x,g.y,0]:v&&g.length===3?[g[0],g[1],g[2]]:v&&g.length===2?[g[0],g[1],0]:g});if(m.setPositions(y.flat()),r){const g=r.map(v=>v instanceof dt?v.toArray():v);m.setColors(g.flat())}return m},[e,o,r]);return w.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),w.useLayoutEffect(()=>{s?f.defines.USE_DASH="":delete f.defines.USE_DASH,f.needsUpdate=!0},[s,f]),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",ce({object:d,ref:c},l),w.createElement("primitive",{object:p,attach:"geometry"}),w.createElement("primitive",ce({object:f,attach:"material",color:n,vertexColors:!!r,resolution:[u.width,u.height],linewidth:i??a,dashed:s},l)))}),qQe="modulepreload",XQe=function(t){return"/"+t},gZ={},YQe=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=XQe(a),a in gZ)return;gZ[a]=!0;const o=a.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(!!r)for(let u=i.length-1;u>=0;u--){const d=i[u];if(d.href===a&&(!o||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${s}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":qQe,o||(c.as="script",c.crossOrigin=""),c.href=a,document.head.appendChild(c),o)return new Promise((u,d)=>{c.addEventListener("load",u),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e()).catch(a=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a})},lve=w.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:a,characters:o,onSync:s,...l},c)=>{const{Text:u,preloadFont:d}=MU(async()=>YQe(()=>import("./troika-three-text.esm-188d86b5.js"),[]),[]),f=Tt(({invalidate:g})=>g),[p]=w.useState(()=>new u),[m,y]=w.useMemo(()=>{const g=[];let v="";return w.Children.forEach(a,x=>{typeof x=="string"||typeof x=="number"?v+=x:g.push(x)}),[g,v]},[a]);return MU(()=>new Promise(g=>d({font:r,characters:o},g)),["troika-text",r,o]),w.useLayoutEffect(()=>void p.sync(()=>{f(),s&&s(p)})),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",ce({object:p,ref:c,font:r,text:y,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)});function KQe(t,e,n,r){const i=class extends kn{constructor(o={}){const s=Object.entries(t);super({uniforms:s.reduce((l,[c,u])=>{const d=Xm.clone({[c]:{value:u}});return{...l,...d}},{}),vertexShader:e,fragmentShader:n}),this.key="",s.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:c=>this.uniforms[l].value=c})),Object.assign(this,o),r&&r(this)}};return i.key=Xy.generateUUID(),i}const ZQe=()=>parseInt(md.replace(/\D+/g,"")),QQe=ZQe();function JQe(t,e,n){const r=Tt(f=>f.size),i=Tt(f=>f.viewport),a=typeof t=="number"?t:r.width*i.dpr,o=typeof e=="number"?e:r.height*i.dpr,s=(typeof t=="number"?n:t)||{},{samples:l=0,depth:c,...u}=s,d=w.useMemo(()=>{const f=new Vn(a,o,{minFilter:Zt,magFilter:Zt,type:hs,...u});return c&&(f.depthTexture=new Hw(a,o,Ii)),f.samples=l,f},[]);return w.useLayoutEffect(()=>{d.setSize(a,o),l&&(d.samples=l)},[l,d,a,o]),w.useEffect(()=>()=>d.dispose(),[]),d}const eJe=t=>typeof t=="function",tJe=w.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:r,makeDefault:i,...a},o)=>{const s=Tt(({set:g})=>g),l=Tt(({camera:g})=>g),c=Tt(({size:g})=>g),u=w.useRef(null),d=w.useRef(null),f=JQe(e);w.useLayoutEffect(()=>{a.manual||u.current.updateProjectionMatrix()},[c,a]),w.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),w.useLayoutEffect(()=>{if(i){const g=l;return s(()=>({camera:u.current})),()=>s(()=>({camera:g}))}},[u,i,s]);let p=0,m=null;const y=eJe(r);return lr(g=>{y&&(n===1/0||p<n)&&(d.current.visible=!1,g.gl.setRenderTarget(f),m=g.scene.background,t&&(g.scene.background=t),g.gl.render(g.scene,u.current),g.scene.background=m,g.gl.setRenderTarget(null),d.current.visible=!0,p++)}),w.createElement(w.Fragment,null,w.createElement("orthographicCamera",ce({left:c.width/-2,right:c.width/2,top:c.height/2,bottom:c.height/-2,ref:uk([u,o])},a),!y&&r),w.createElement("group",{ref:d},y&&r(f.texture)))});function nJe({defaultScene:t,defaultCamera:e,renderPriority:n=1}){const{gl:r,scene:i,camera:a}=Tt();let o;return lr(()=>{o=r.autoClear,n===1&&(r.autoClear=!0,r.render(t,e)),r.autoClear=!1,r.clearDepth(),r.render(i,a),r.autoClear=o},n),w.createElement("group",{onPointerOver:()=>null})}function rJe({children:t,renderPriority:e=1}){const{scene:n,camera:r}=Tt(),[i]=w.useState(()=>new ld);return w.createElement(w.Fragment,null,m6(w.createElement(w.Fragment,null,t,w.createElement(nJe,{defaultScene:n,defaultCamera:r,renderPriority:e})),i,{events:{priority:e+1}}))}const cve=w.createContext({}),t8=()=>w.useContext(cve),iJe=2*Math.PI,kL=new dr,yZ=new Je,[Pg,IL]=[new Jn,new Jn],xZ=new j,CZ=new j,aJe=t=>"minPolarAngle"in t,oJe=({alignment:t="bottom-right",margin:e=[80,80],renderPriority:n=1,onUpdate:r,onTarget:i,children:a})=>{const o=Tt(M=>M.size),s=Tt(M=>M.camera),l=Tt(M=>M.controls),c=Tt(M=>M.invalidate),u=w.useRef(null),d=w.useRef(null),f=w.useRef(!1),p=w.useRef(0),m=w.useRef(new j(0,0,0)),y=w.useRef(new j(0,0,0));w.useEffect(()=>{y.current.copy(s.up)},[s]);const g=w.useCallback(M=>{f.current=!0,(l||i)&&(m.current=(l==null?void 0:l.target)||(i==null?void 0:i())),p.current=s.position.distanceTo(xZ),Pg.copy(s.quaternion),CZ.copy(M).multiplyScalar(p.current).add(xZ),kL.lookAt(CZ),kL.up.copy(s.up),IL.copy(kL.quaternion),c()},[l,s,i,c]);lr((M,P)=>{if(d.current&&u.current){var A;if(f.current)if(Pg.angleTo(IL)<.01)f.current=!1,aJe(l)&&s.up.copy(y.current);else{const R=P*iJe;Pg.rotateTowards(IL,R),s.position.set(0,0,1).applyQuaternion(Pg).multiplyScalar(p.current).add(m.current),s.up.set(0,1,0).applyQuaternion(Pg).normalize(),s.quaternion.copy(Pg),r?r():l&&l.update(),c()}yZ.copy(s.matrix).invert(),(A=u.current)==null||A.quaternion.setFromRotationMatrix(yZ)}});const v=w.useMemo(()=>({tweenCamera:g}),[g]),[x,C]=e,b=t.endsWith("-center")?0:t.endsWith("-left")?-o.width/2+x:o.width/2-x,E=t.startsWith("center-")?0:t.startsWith("top-")?o.height/2-C:-o.height/2+C;return w.createElement(rJe,{renderPriority:n},w.createElement(cve.Provider,{value:v},w.createElement(tJe,{makeDefault:!0,ref:d,position:[0,0,200]}),w.createElement("group",{ref:u,position:[b,E,0]},a)))},Mb={bg:"#f0f0f0",hover:"#999",text:"black",stroke:"black"},sJe=["Right","Left","Top","Bottom","Front","Back"],uve=t=>new j(...t).multiplyScalar(.38),lJe=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]].map(uve),cJe=[.25,.25,.25],dve=[[1,1,0],[1,0,1],[1,0,-1],[1,-1,0],[0,1,1],[0,1,-1],[0,-1,1],[0,-1,-1],[-1,1,0],[-1,0,1],[-1,0,-1],[-1,-1,0]].map(uve),uJe=dve.map(t=>t.toArray().map(e=>e==0?.5:.25)),dJe=({hover:t,index:e,font:n="20px Inter var, Arial, sans-serif",faces:r=sJe,color:i=Mb.bg,hoverColor:a=Mb.hover,textColor:o=Mb.text,strokeColor:s=Mb.stroke,opacity:l=1})=>{const c=Tt(d=>d.gl),u=w.useMemo(()=>{const d=document.createElement("canvas");d.width=128,d.height=128;const f=d.getContext("2d");return f.fillStyle=i,f.fillRect(0,0,d.width,d.height),f.strokeStyle=s,f.strokeRect(0,0,d.width,d.height),f.font=n,f.textAlign="center",f.fillStyle=o,f.fillText(r[e].toUpperCase(),64,76),new bT(d)},[e,r,n,i,o,s]);return w.createElement("meshBasicMaterial",{map:u,"map-anisotropy":c.capabilities.getMaxAnisotropy()||1,attach:`material-${e}`,color:t?a:"white",transparent:!0,opacity:l})},fJe=t=>{const{tweenCamera:e}=t8(),[n,r]=w.useState(null),i=s=>{s.stopPropagation(),r(null)},a=s=>{s.stopPropagation(),e(s.face.normal)},o=s=>{s.stopPropagation(),r(Math.floor(s.faceIndex/2))};return w.createElement("mesh",{onPointerOut:i,onPointerMove:o,onClick:t.onClick||a},[...Array(6)].map((s,l)=>w.createElement(dJe,ce({key:l,index:l,hover:n===l},t))),w.createElement("boxGeometry",null))},bZ=({onClick:t,dimensions:e,position:n,hoverColor:r=Mb.hover})=>{const{tweenCamera:i}=t8(),[a,o]=w.useState(!1),s=u=>{u.stopPropagation(),o(!1)},l=u=>{u.stopPropagation(),o(!0)},c=u=>{u.stopPropagation(),i(n)};return w.createElement("mesh",{scale:1.01,position:n,onPointerOver:l,onPointerOut:s,onClick:t||c},w.createElement("meshBasicMaterial",{color:a?r:"white",transparent:!0,opacity:.6,visible:a}),w.createElement("boxGeometry",{args:e}))},pJe=t=>w.createElement("group",{scale:[60,60,60]},w.createElement(fJe,t),dve.map((e,n)=>w.createElement(bZ,ce({key:n,position:e,dimensions:uJe[n]},t))),lJe.map((e,n)=>w.createElement(bZ,ce({key:n,position:e,dimensions:cJe},t))));function DL({scale:t=[.8,.05,.05],color:e,rotation:n}){return w.createElement("group",{rotation:n},w.createElement("mesh",{position:[.4,0,0]},w.createElement("boxGeometry",{args:t}),w.createElement("meshBasicMaterial",{color:e,toneMapped:!1})))}function Ag({onClick:t,font:e,disabled:n,arcStyle:r,label:i,labelColor:a,axisHeadScale:o=1,...s}){const l=Tt(y=>y.gl),c=w.useMemo(()=>{const y=document.createElement("canvas");y.width=64,y.height=64;const g=y.getContext("2d");return g.beginPath(),g.arc(32,32,16,0,2*Math.PI),g.closePath(),g.fillStyle=r,g.fill(),i&&(g.font=e,g.textAlign="center",g.fillStyle=a,g.fillText(i,32,41)),new bT(y)},[r,i,a,e]),[u,d]=w.useState(!1),f=(i?1:.75)*(u?1.2:1)*o,p=y=>{y.stopPropagation(),d(!0)},m=y=>{y.stopPropagation(),d(!1)};return w.createElement("sprite",ce({scale:f,onPointerOver:n?void 0:p,onPointerOut:n?void 0:t||m},s),w.createElement("spriteMaterial",{map:c,"map-anisotropy":l.capabilities.getMaxAnisotropy()||1,alphaTest:.3,opacity:i?1:.75,toneMapped:!1}))}const hJe=({hideNegativeAxes:t,hideAxisHeads:e,disabled:n,font:r="18px Inter var, Arial, sans-serif",axisColors:i=["#ff2060","#20df80","#2080ff"],axisHeadScale:a=1,axisScale:o,labels:s=["X","Y","Z"],labelColor:l="#000",onClick:c,...u})=>{const[d,f,p]=i,{tweenCamera:m}=t8(),y={font:r,disabled:n,labelColor:l,onClick:c,axisHeadScale:a,onPointerDown:n?void 0:g=>{m(g.object.position),g.stopPropagation()}};return w.createElement("group",ce({scale:40},u),w.createElement(DL,{color:d,rotation:[0,0,0],scale:o}),w.createElement(DL,{color:f,rotation:[0,0,Math.PI/2],scale:o}),w.createElement(DL,{color:p,rotation:[0,-Math.PI/2,0],scale:o}),!e&&w.createElement(w.Fragment,null,w.createElement(Ag,ce({arcStyle:d,position:[1,0,0],label:s[0]},y)),w.createElement(Ag,ce({arcStyle:f,position:[0,1,0],label:s[1]},y)),w.createElement(Ag,ce({arcStyle:p,position:[0,0,1],label:s[2]},y)),!t&&w.createElement(w.Fragment,null,w.createElement(Ag,ce({arcStyle:d,position:[-1,0,0]},y)),w.createElement(Ag,ce({arcStyle:f,position:[0,-1,0]},y)),w.createElement(Ag,ce({arcStyle:p,position:[0,0,-1]},y)))))},mJe=KQe({cellSize:.5,sectionSize:1,fadeDistance:100,fadeStrength:1,cellThickness:.5,sectionThickness:1,cellColor:new dt,sectionColor:new dt,infiniteGrid:!1,followCamera:!1,worldCamProjPosition:new j,worldPlanePosition:new j},`
|
|
4755
|
+
`,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const pZ=new j,hZ=new j,vo=new Fn,go=new Fn,Ou=new Fn,TL=new j,OL=new Je,Bo=new ZB,mZ=new j,rP=new Br,iP=new oo,ku=new Fn;let Gu,Wz,ove,Vm;function vZ(t,e,n){return ku.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ku.multiplyScalar(1/ku.w),ku.x=Vm/n.width,ku.y=Vm/n.height,ku.applyMatrix4(t.projectionMatrixInverse),ku.multiplyScalar(1/ku.w),Math.abs(Math.max(ku.x,ku.y))}function GQe(t,e){for(let n=0,r=Wz.count;n<r;n++){Bo.start.fromBufferAttribute(Wz,n),Bo.end.fromBufferAttribute(ove,n);const i=new j,a=new j;Gu.distanceSqToSegment(Bo.start,Bo.end,a,i),a.distanceTo(i)<Vm*.5&&e.push({point:a,pointOnLine:i,distance:Gu.origin.distanceTo(a),object:t,face:null,faceIndex:n,uv:null,uv2:null})}}function WQe(t,e,n){const r=e.projectionMatrix,a=t.material.resolution,o=t.matrixWorld,s=t.geometry,l=s.attributes.instanceStart,c=s.attributes.instanceEnd,u=-e.near;Gu.at(1,Ou),Ou.w=1,Ou.applyMatrix4(e.matrixWorldInverse),Ou.applyMatrix4(r),Ou.multiplyScalar(1/Ou.w),Ou.x*=a.x/2,Ou.y*=a.y/2,Ou.z=0,TL.copy(Ou),OL.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,f=l.count;d<f;d++){if(vo.fromBufferAttribute(l,d),go.fromBufferAttribute(c,d),vo.w=1,go.w=1,vo.applyMatrix4(OL),go.applyMatrix4(OL),vo.z>u&&go.z>u)continue;if(vo.z>u){const x=vo.z-go.z,C=(vo.z-u)/x;vo.lerp(go,C)}else if(go.z>u){const x=go.z-vo.z,C=(go.z-u)/x;go.lerp(vo,C)}vo.applyMatrix4(r),go.applyMatrix4(r),vo.multiplyScalar(1/vo.w),go.multiplyScalar(1/go.w),vo.x*=a.x/2,vo.y*=a.y/2,go.x*=a.x/2,go.y*=a.y/2,Bo.start.copy(vo),Bo.start.z=0,Bo.end.copy(go),Bo.end.z=0;const m=Bo.closestPointToPointParameter(TL,!0);Bo.at(m,mZ);const y=Xy.lerp(vo.z,go.z,m),g=y>=-1&&y<=1,v=TL.distanceTo(mZ)<Vm*.5;if(g&&v){Bo.start.fromBufferAttribute(l,d),Bo.end.fromBufferAttribute(c,d),Bo.start.applyMatrix4(o),Bo.end.applyMatrix4(o);const x=new j,C=new j;Gu.distanceSqToSegment(Bo.start,Bo.end,C,x),n.push({point:C,pointOnLine:x,distance:Gu.origin.distanceTo(C),object:t,face:null,faceIndex:d,uv:null,uv2:null})}}}class sve extends Ur{constructor(e=new Jj,n=new e8({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let o=0,s=0,l=n.count;o<l;o++,s+=2)pZ.fromBufferAttribute(n,o),hZ.fromBufferAttribute(r,o),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+pZ.distanceTo(hZ);const a=new eh(i,2,1);return e.setAttribute("instanceDistanceStart",new sa(a,1,0)),e.setAttribute("instanceDistanceEnd",new sa(a,1,1)),this}raycast(e,n){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Gu=e.ray;const o=this.matrixWorld,s=this.geometry,l=this.material;Vm=l.linewidth+a,Wz=s.attributes.instanceStart,ove=s.attributes.instanceEnd,s.boundingSphere===null&&s.computeBoundingSphere(),iP.copy(s.boundingSphere).applyMatrix4(o);let c;if(r)c=Vm*.5;else{const d=Math.max(i.near,iP.distanceToPoint(Gu.origin));c=vZ(i,d,l.resolution)}if(iP.radius+=c,Gu.intersectsSphere(iP)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),rP.copy(s.boundingBox).applyMatrix4(o);let u;if(r)u=Vm*.5;else{const d=Math.max(i.near,rP.distanceToPoint(Gu.origin));u=vZ(i,d,l.resolution)}rP.expandByScalar(u),Gu.intersectsBox(rP)!==!1&&(r?GQe(this,n):WQe(this,i,n))}}class $Qe extends sve{constructor(e=new ave,n=new e8({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const vR=w.forwardRef(function({points:e,color:n="black",vertexColors:r,linewidth:i,lineWidth:a,segments:o,dashed:s,...l},c){const u=Tt(m=>m.size),d=w.useMemo(()=>o?new sve:new $Qe,[o]),[f]=w.useState(()=>new e8),p=w.useMemo(()=>{const m=o?new Jj:new ave,y=e.map(g=>{const v=Array.isArray(g);return g instanceof j?[g.x,g.y,g.z]:g instanceof Fe?[g.x,g.y,0]:v&&g.length===3?[g[0],g[1],g[2]]:v&&g.length===2?[g[0],g[1],0]:g});if(m.setPositions(y.flat()),r){const g=r.map(v=>v instanceof dt?v.toArray():v);m.setColors(g.flat())}return m},[e,o,r]);return w.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),w.useLayoutEffect(()=>{s?f.defines.USE_DASH="":delete f.defines.USE_DASH,f.needsUpdate=!0},[s,f]),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",ce({object:d,ref:c},l),w.createElement("primitive",{object:p,attach:"geometry"}),w.createElement("primitive",ce({object:f,attach:"material",color:n,vertexColors:!!r,resolution:[u.width,u.height],linewidth:i??a,dashed:s},l)))}),qQe="modulepreload",XQe=function(t){return"/"+t},gZ={},YQe=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=XQe(a),a in gZ)return;gZ[a]=!0;const o=a.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(!!r)for(let u=i.length-1;u>=0;u--){const d=i[u];if(d.href===a&&(!o||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${s}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":qQe,o||(c.as="script",c.crossOrigin=""),c.href=a,document.head.appendChild(c),o)return new Promise((u,d)=>{c.addEventListener("load",u),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e()).catch(a=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a})},lve=w.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:a,characters:o,onSync:s,...l},c)=>{const{Text:u,preloadFont:d}=MU(async()=>YQe(()=>import("./troika-three-text.esm-6386308e.js"),[]),[]),f=Tt(({invalidate:g})=>g),[p]=w.useState(()=>new u),[m,y]=w.useMemo(()=>{const g=[];let v="";return w.Children.forEach(a,x=>{typeof x=="string"||typeof x=="number"?v+=x:g.push(x)}),[g,v]},[a]);return MU(()=>new Promise(g=>d({font:r,characters:o},g)),["troika-text",r,o]),w.useLayoutEffect(()=>void p.sync(()=>{f(),s&&s(p)})),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",ce({object:p,ref:c,font:r,text:y,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)});function KQe(t,e,n,r){const i=class extends kn{constructor(o={}){const s=Object.entries(t);super({uniforms:s.reduce((l,[c,u])=>{const d=Xm.clone({[c]:{value:u}});return{...l,...d}},{}),vertexShader:e,fragmentShader:n}),this.key="",s.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:c=>this.uniforms[l].value=c})),Object.assign(this,o),r&&r(this)}};return i.key=Xy.generateUUID(),i}const ZQe=()=>parseInt(md.replace(/\D+/g,"")),QQe=ZQe();function JQe(t,e,n){const r=Tt(f=>f.size),i=Tt(f=>f.viewport),a=typeof t=="number"?t:r.width*i.dpr,o=typeof e=="number"?e:r.height*i.dpr,s=(typeof t=="number"?n:t)||{},{samples:l=0,depth:c,...u}=s,d=w.useMemo(()=>{const f=new Vn(a,o,{minFilter:Zt,magFilter:Zt,type:hs,...u});return c&&(f.depthTexture=new Hw(a,o,Ii)),f.samples=l,f},[]);return w.useLayoutEffect(()=>{d.setSize(a,o),l&&(d.samples=l)},[l,d,a,o]),w.useEffect(()=>()=>d.dispose(),[]),d}const eJe=t=>typeof t=="function",tJe=w.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:r,makeDefault:i,...a},o)=>{const s=Tt(({set:g})=>g),l=Tt(({camera:g})=>g),c=Tt(({size:g})=>g),u=w.useRef(null),d=w.useRef(null),f=JQe(e);w.useLayoutEffect(()=>{a.manual||u.current.updateProjectionMatrix()},[c,a]),w.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),w.useLayoutEffect(()=>{if(i){const g=l;return s(()=>({camera:u.current})),()=>s(()=>({camera:g}))}},[u,i,s]);let p=0,m=null;const y=eJe(r);return lr(g=>{y&&(n===1/0||p<n)&&(d.current.visible=!1,g.gl.setRenderTarget(f),m=g.scene.background,t&&(g.scene.background=t),g.gl.render(g.scene,u.current),g.scene.background=m,g.gl.setRenderTarget(null),d.current.visible=!0,p++)}),w.createElement(w.Fragment,null,w.createElement("orthographicCamera",ce({left:c.width/-2,right:c.width/2,top:c.height/2,bottom:c.height/-2,ref:uk([u,o])},a),!y&&r),w.createElement("group",{ref:d},y&&r(f.texture)))});function nJe({defaultScene:t,defaultCamera:e,renderPriority:n=1}){const{gl:r,scene:i,camera:a}=Tt();let o;return lr(()=>{o=r.autoClear,n===1&&(r.autoClear=!0,r.render(t,e)),r.autoClear=!1,r.clearDepth(),r.render(i,a),r.autoClear=o},n),w.createElement("group",{onPointerOver:()=>null})}function rJe({children:t,renderPriority:e=1}){const{scene:n,camera:r}=Tt(),[i]=w.useState(()=>new ld);return w.createElement(w.Fragment,null,m6(w.createElement(w.Fragment,null,t,w.createElement(nJe,{defaultScene:n,defaultCamera:r,renderPriority:e})),i,{events:{priority:e+1}}))}const cve=w.createContext({}),t8=()=>w.useContext(cve),iJe=2*Math.PI,kL=new dr,yZ=new Je,[Pg,IL]=[new Jn,new Jn],xZ=new j,CZ=new j,aJe=t=>"minPolarAngle"in t,oJe=({alignment:t="bottom-right",margin:e=[80,80],renderPriority:n=1,onUpdate:r,onTarget:i,children:a})=>{const o=Tt(M=>M.size),s=Tt(M=>M.camera),l=Tt(M=>M.controls),c=Tt(M=>M.invalidate),u=w.useRef(null),d=w.useRef(null),f=w.useRef(!1),p=w.useRef(0),m=w.useRef(new j(0,0,0)),y=w.useRef(new j(0,0,0));w.useEffect(()=>{y.current.copy(s.up)},[s]);const g=w.useCallback(M=>{f.current=!0,(l||i)&&(m.current=(l==null?void 0:l.target)||(i==null?void 0:i())),p.current=s.position.distanceTo(xZ),Pg.copy(s.quaternion),CZ.copy(M).multiplyScalar(p.current).add(xZ),kL.lookAt(CZ),kL.up.copy(s.up),IL.copy(kL.quaternion),c()},[l,s,i,c]);lr((M,P)=>{if(d.current&&u.current){var A;if(f.current)if(Pg.angleTo(IL)<.01)f.current=!1,aJe(l)&&s.up.copy(y.current);else{const R=P*iJe;Pg.rotateTowards(IL,R),s.position.set(0,0,1).applyQuaternion(Pg).multiplyScalar(p.current).add(m.current),s.up.set(0,1,0).applyQuaternion(Pg).normalize(),s.quaternion.copy(Pg),r?r():l&&l.update(),c()}yZ.copy(s.matrix).invert(),(A=u.current)==null||A.quaternion.setFromRotationMatrix(yZ)}});const v=w.useMemo(()=>({tweenCamera:g}),[g]),[x,C]=e,b=t.endsWith("-center")?0:t.endsWith("-left")?-o.width/2+x:o.width/2-x,E=t.startsWith("center-")?0:t.startsWith("top-")?o.height/2-C:-o.height/2+C;return w.createElement(rJe,{renderPriority:n},w.createElement(cve.Provider,{value:v},w.createElement(tJe,{makeDefault:!0,ref:d,position:[0,0,200]}),w.createElement("group",{ref:u,position:[b,E,0]},a)))},Mb={bg:"#f0f0f0",hover:"#999",text:"black",stroke:"black"},sJe=["Right","Left","Top","Bottom","Front","Back"],uve=t=>new j(...t).multiplyScalar(.38),lJe=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]].map(uve),cJe=[.25,.25,.25],dve=[[1,1,0],[1,0,1],[1,0,-1],[1,-1,0],[0,1,1],[0,1,-1],[0,-1,1],[0,-1,-1],[-1,1,0],[-1,0,1],[-1,0,-1],[-1,-1,0]].map(uve),uJe=dve.map(t=>t.toArray().map(e=>e==0?.5:.25)),dJe=({hover:t,index:e,font:n="20px Inter var, Arial, sans-serif",faces:r=sJe,color:i=Mb.bg,hoverColor:a=Mb.hover,textColor:o=Mb.text,strokeColor:s=Mb.stroke,opacity:l=1})=>{const c=Tt(d=>d.gl),u=w.useMemo(()=>{const d=document.createElement("canvas");d.width=128,d.height=128;const f=d.getContext("2d");return f.fillStyle=i,f.fillRect(0,0,d.width,d.height),f.strokeStyle=s,f.strokeRect(0,0,d.width,d.height),f.font=n,f.textAlign="center",f.fillStyle=o,f.fillText(r[e].toUpperCase(),64,76),new bT(d)},[e,r,n,i,o,s]);return w.createElement("meshBasicMaterial",{map:u,"map-anisotropy":c.capabilities.getMaxAnisotropy()||1,attach:`material-${e}`,color:t?a:"white",transparent:!0,opacity:l})},fJe=t=>{const{tweenCamera:e}=t8(),[n,r]=w.useState(null),i=s=>{s.stopPropagation(),r(null)},a=s=>{s.stopPropagation(),e(s.face.normal)},o=s=>{s.stopPropagation(),r(Math.floor(s.faceIndex/2))};return w.createElement("mesh",{onPointerOut:i,onPointerMove:o,onClick:t.onClick||a},[...Array(6)].map((s,l)=>w.createElement(dJe,ce({key:l,index:l,hover:n===l},t))),w.createElement("boxGeometry",null))},bZ=({onClick:t,dimensions:e,position:n,hoverColor:r=Mb.hover})=>{const{tweenCamera:i}=t8(),[a,o]=w.useState(!1),s=u=>{u.stopPropagation(),o(!1)},l=u=>{u.stopPropagation(),o(!0)},c=u=>{u.stopPropagation(),i(n)};return w.createElement("mesh",{scale:1.01,position:n,onPointerOver:l,onPointerOut:s,onClick:t||c},w.createElement("meshBasicMaterial",{color:a?r:"white",transparent:!0,opacity:.6,visible:a}),w.createElement("boxGeometry",{args:e}))},pJe=t=>w.createElement("group",{scale:[60,60,60]},w.createElement(fJe,t),dve.map((e,n)=>w.createElement(bZ,ce({key:n,position:e,dimensions:uJe[n]},t))),lJe.map((e,n)=>w.createElement(bZ,ce({key:n,position:e,dimensions:cJe},t))));function DL({scale:t=[.8,.05,.05],color:e,rotation:n}){return w.createElement("group",{rotation:n},w.createElement("mesh",{position:[.4,0,0]},w.createElement("boxGeometry",{args:t}),w.createElement("meshBasicMaterial",{color:e,toneMapped:!1})))}function Ag({onClick:t,font:e,disabled:n,arcStyle:r,label:i,labelColor:a,axisHeadScale:o=1,...s}){const l=Tt(y=>y.gl),c=w.useMemo(()=>{const y=document.createElement("canvas");y.width=64,y.height=64;const g=y.getContext("2d");return g.beginPath(),g.arc(32,32,16,0,2*Math.PI),g.closePath(),g.fillStyle=r,g.fill(),i&&(g.font=e,g.textAlign="center",g.fillStyle=a,g.fillText(i,32,41)),new bT(y)},[r,i,a,e]),[u,d]=w.useState(!1),f=(i?1:.75)*(u?1.2:1)*o,p=y=>{y.stopPropagation(),d(!0)},m=y=>{y.stopPropagation(),d(!1)};return w.createElement("sprite",ce({scale:f,onPointerOver:n?void 0:p,onPointerOut:n?void 0:t||m},s),w.createElement("spriteMaterial",{map:c,"map-anisotropy":l.capabilities.getMaxAnisotropy()||1,alphaTest:.3,opacity:i?1:.75,toneMapped:!1}))}const hJe=({hideNegativeAxes:t,hideAxisHeads:e,disabled:n,font:r="18px Inter var, Arial, sans-serif",axisColors:i=["#ff2060","#20df80","#2080ff"],axisHeadScale:a=1,axisScale:o,labels:s=["X","Y","Z"],labelColor:l="#000",onClick:c,...u})=>{const[d,f,p]=i,{tweenCamera:m}=t8(),y={font:r,disabled:n,labelColor:l,onClick:c,axisHeadScale:a,onPointerDown:n?void 0:g=>{m(g.object.position),g.stopPropagation()}};return w.createElement("group",ce({scale:40},u),w.createElement(DL,{color:d,rotation:[0,0,0],scale:o}),w.createElement(DL,{color:f,rotation:[0,0,Math.PI/2],scale:o}),w.createElement(DL,{color:p,rotation:[0,-Math.PI/2,0],scale:o}),!e&&w.createElement(w.Fragment,null,w.createElement(Ag,ce({arcStyle:d,position:[1,0,0],label:s[0]},y)),w.createElement(Ag,ce({arcStyle:f,position:[0,1,0],label:s[1]},y)),w.createElement(Ag,ce({arcStyle:p,position:[0,0,1],label:s[2]},y)),!t&&w.createElement(w.Fragment,null,w.createElement(Ag,ce({arcStyle:d,position:[-1,0,0]},y)),w.createElement(Ag,ce({arcStyle:f,position:[0,-1,0]},y)),w.createElement(Ag,ce({arcStyle:p,position:[0,0,-1]},y)))))},mJe=KQe({cellSize:.5,sectionSize:1,fadeDistance:100,fadeStrength:1,cellThickness:.5,sectionThickness:1,cellColor:new dt,sectionColor:new dt,infiniteGrid:!1,followCamera:!1,worldCamProjPosition:new j,worldPlanePosition:new j},`
|
|
4756
4756
|
varying vec3 localPosition;
|
|
4757
4757
|
varying vec4 worldPosition;
|
|
4758
4758
|
|
|
@@ -10911,7 +10911,7 @@ void main() {
|
|
|
10911
10911
|
animation: none;
|
|
10912
10912
|
}
|
|
10913
10913
|
}
|
|
10914
|
-
`,K5=new Set,F_t=(t,e)=>{e?K5.add(t):K5.delete(t)},Z5=t=>t!==void 0&&K5.has(t),U_t="/session",SCe=U_t.startsWith("/"),g4=(t,e)=>pe.jsxs("span",{className:"rcad-menu-tool",children:[pe.jsx("span",{children:t}),pe.jsxs("code",{children:[".",e]})]});function z_t(t){const e=h.useRef(),{saveFormats:n}=Sl.useSessionConfig(),r=h.useCallback(a=>{(async()=>{try{if(Sl.getInviteFromUrl()){const c=tt(t);await c.v1.common.clear(),a==="Assembly"?await c.v1.assembly.create({name:"Assembly"}):await c.v1.part.create({name:"Part"});return}const s=t,l=await Na.utils.connect(a);if(l){switch(a){case"Assembly":await tt(l).v1.assembly.create({name:"Assembly"});break;case"Part":default:await tt(l).v1.part.create({name:"Part"});break}Zi.getState().api.setActiveDrawing(l)}s&&Zi.getState().api.removeDrawing(s)}catch(s){console.error(s)}})()},[t]),i=h.useCallback(a=>{(async()=>{var s;try{let c=ne(t).name||"drawing";const u=c.lastIndexOf(".");c=c.substring(0,u>=0?u:c.length);const d=await tt(t).v1.common.save({format:a.toUpperCase(),encoding:"base64"}),f=(s=d==null?void 0:d.result)==null?void 0:s.content;if(f){const p=atob(f),m=document.createElement("a");m.href=window.URL.createObjectURL(new Blob([p],{type:"application/octet-stream"})),m.download=`${c}.${a}`,m.click()}}catch(l){console.error(l)}})()},[t]);return h.useMemo(()=>{const a={ofb:{caption:g4("ClassCAD","ofb"),callback:()=>i("ofb")},stp:{caption:g4("STEP","stp"),callback:()=>i("stp")},stl:{caption:g4("STL","stl"),callback:()=>i("stl")}},o=Object.fromEntries(Object.entries(a).filter(([s])=>!n||n.includes(s.toUpperCase())));return{new:{caption:"New",icon:pe.jsx(ut,{name:"plus",size:16}),children:{part:{caption:"Part",icon:pe.jsx(ut,{name:"part",size:16}),callback:()=>r("Part")},assembly:{caption:"Assembly",icon:pe.jsx(ut,{name:"assembly",size:16}),callback:()=>r("Assembly")}}},open:{caption:pe.jsxs(pe.Fragment,{children:["Open …",pe.jsx(Jxe,{ref:e,singleDrawingApp:!0})]}),icon:pe.jsx(ut,{name:"open",size:16}),callback:()=>e.current&&e.current.click()},save:{caption:"Save as",icon:pe.jsx(ut,{name:"download",size:16}),children:o}}},[r,i,n])}const ECe=(t,e)=>{if(e!=null&&e.captionMap){const n=Object.keys(e.captionMap).find(r=>e.captionMap[r].stateName===t);return n?e.captionMap[n].caption:"undefined caption"}return"undefined caption"},_Ce=(t,e)=>{if(e!=null&&e.captionMap){const n=Object.keys(e.captionMap).find(i=>e.captionMap[i].stateName===t),r=n?e.captionMap[n]:void 0;return r&&r.undoable?r.undoable:!1}return!1},MCe=t=>t.stack.filter(e=>Number.parseInt(e)<=t.current&&_Ce(e,t)),PCe=(t,e,n)=>{const r=n.indexOf(e.current.toString());if(r>-1){const i=n.at(r-1);i&&Na.utils.undo(t,i)}else Na.utils.undo(t)},B_t=(t,e)=>{let n=[],r;if(t&&e){r=MCe(e);const i=r.slice(1);n=i.length>0?i.map(a=>({label:ECe(a,e),stateId:a,command:()=>{const o=r.indexOf(a),s=r.at(o===0?0:o-1);s&&Na.utils.undo(t,s)}})):[]}return{label:"Undo",sub:[...n],icon:"undo",command:()=>t&&e&&PCe(t,e,r)}},ACe=t=>t.stack.filter(e=>Number.parseInt(e)>t.current&&_Ce(e,t)),RCe=(t,e)=>{e.length>0&&t&&Na.utils.redo(t,e[0])},V_t=(t,e)=>{let n=[],r;return t&&e&&(r=ACe(e),n=r.length>0?r.map(i=>({label:ECe(i,e),stateId:i,command:()=>{const a=r.indexOf(i),o=r.at(a);o&&Na.utils.redo(t,o)}})):[]),{label:"Redo",sub:[...n],icon:"redo",command:()=>t&&RCe(t,r)}},j_t=t=>`${t} is not available in WebAssembly for the moment. Coming soon.`,H_t=t=>`${t} is not available in a view-only session.`,pre=({command:t,off:e})=>{var o;const n=h.useCallback(s=>{if(t.sub){const l=t.sub.findIndex(u=>u.stateId===s.key);t.sub[l].command()}},[t]),i={items:((o=t.sub)==null?void 0:o.map(s=>({label:s.label,key:s.stateId})))||[],onClick:n},a=!!e||!(t.sub&&t.sub.length>0);return pe.jsxs("span",{className:"rcad-split",children:[pe.jsx(vc,{title:e??t.label,placement:"bottom",mouseEnterDelay:.35,children:pe.jsx("span",{style:{display:"inline-flex"},children:pe.jsx("button",{type:"button",className:"rcad-tool","aria-label":t.label,disabled:a,onClick:t.command,children:t.icon&&pe.jsx(ut,{name:t.icon,size:18})})})}),pe.jsx(DS,{disabled:a,menu:i,trigger:["click"],placement:"bottomLeft",children:pe.jsx("button",{type:"button",className:"rcad-caret","aria-label":`${t.label}: steps`,disabled:a,children:pe.jsx(ut,{name:"caret",size:12})})})]})},G_t=({drawingId:t})=>{const e=z_t(t),n=Sl.useSessionRole()==="view",r=ue(t,c=>c.cad.states),i=h.useMemo(()=>B_t(t,r),[t,r]),a=h.useMemo(()=>V_t(t,r),[t,r]),o=Z5(t),s=n?{save:e.save}:e,l=c=>n?H_t(c):o?j_t(c):void 0;return pe.jsxs(pe.Fragment,{children:[pe.jsx(PCt,{items:s,trigger:["click"],placement:"bottomLeft",children:pe.jsxs("button",{type:"button",className:"rcad-tool rcad-tool-text","aria-label":"File",children:[pe.jsx(ut,{name:"menu",size:18}),pe.jsx("span",{children:"File"})]})}),pe.jsx("span",{className:"rcad-tools-sep"}),pe.jsx(pre,{command:i,off:l("Undo")}),pe.jsx(pre,{command:a,off:l("Redo")})]})},W_t=({drawingId:t})=>{const e=!!Sl.getInviteFromUrl(),n=ue(t,o=>o.cad.connection.connected),r=h.useRef(!1),[i,a]=h.useState(!1);return h.useEffect(()=>{n?r.current=!0:r.current&&a(!0)},[n]),!e||!i?null:pe.jsx($_t,{className:"rcad",role:"alert","aria-live":"assertive",children:pe.jsxs(q_t,{children:[pe.jsx(Y_t,{children:"Session ended"}),pe.jsx("p",{children:"The host ended the shared session, moved it, or your access was revoked."}),pe.jsxs(X_t,{children:[pe.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Join again"}),!SCe&&pe.jsx("button",{type:"button",onClick:()=>{window.location.href=`${window.location.origin}${window.location.pathname}`},children:"Leave"})]})]})})},$_t=tr.div`
|
|
10914
|
+
`,K5=new Set,F_t=(t,e)=>{e?K5.add(t):K5.delete(t)},Z5=t=>t!==void 0&&K5.has(t),U_t="/session",SCe=U_t.startsWith("/"),g4=(t,e)=>pe.jsxs("span",{className:"rcad-menu-tool",children:[pe.jsx("span",{children:t}),pe.jsxs("code",{children:[".",e]})]});function z_t(t){const e=h.useRef(),{saveFormats:n}=Sl.useSessionConfig(),r=h.useCallback(a=>{(async()=>{try{if(Sl.getInviteFromUrl()){const c=tt(t);await c.v1.common.clear(),a==="Assembly"?await c.v1.assembly.create({name:"Assembly"}):await c.v1.part.create({name:"Part"});return}const s=t,l=await Na.utils.connect(a);if(l){switch(a){case"Assembly":await tt(l).v1.assembly.create({name:"Assembly"});break;case"Part":default:await tt(l).v1.part.create({name:"Part"});break}Zi.getState().api.setActiveDrawing(l)}s&&Zi.getState().api.removeDrawing(s)}catch(s){console.error(s)}})()},[t]),i=h.useCallback(a=>{(async()=>{var s;try{let c=ne(t).name||"drawing";const u=c.lastIndexOf(".");c=c.substring(0,u>=0?u:c.length);const d=await tt(t).v1.common.save({format:a.toUpperCase(),encoding:"base64"}),f=(s=d==null?void 0:d.result)==null?void 0:s.content;if(f){const p=Uint8Array.from(atob(f),y=>y.charCodeAt(0)),m=document.createElement("a");m.href=window.URL.createObjectURL(new Blob([p],{type:"application/octet-stream"})),m.download=`${c}.${a}`,m.click()}}catch(l){console.error(l)}})()},[t]);return h.useMemo(()=>{const a={ofb:{caption:g4("ClassCAD","ofb"),callback:()=>i("ofb")},stp:{caption:g4("STEP","stp"),callback:()=>i("stp")},stl:{caption:g4("STL","stl"),callback:()=>i("stl")}},o=Object.fromEntries(Object.entries(a).filter(([s])=>!n||n.includes(s.toUpperCase())));return{new:{caption:"New",icon:pe.jsx(ut,{name:"plus",size:16}),children:{part:{caption:"Part",icon:pe.jsx(ut,{name:"part",size:16}),callback:()=>r("Part")},assembly:{caption:"Assembly",icon:pe.jsx(ut,{name:"assembly",size:16}),callback:()=>r("Assembly")}}},open:{caption:pe.jsxs(pe.Fragment,{children:["Open …",pe.jsx(Jxe,{ref:e,singleDrawingApp:!0})]}),icon:pe.jsx(ut,{name:"open",size:16}),callback:()=>e.current&&e.current.click()},save:{caption:"Save as",icon:pe.jsx(ut,{name:"download",size:16}),children:o}}},[r,i,n])}const ECe=(t,e)=>{if(e!=null&&e.captionMap){const n=Object.keys(e.captionMap).find(r=>e.captionMap[r].stateName===t);return n?e.captionMap[n].caption:"undefined caption"}return"undefined caption"},_Ce=(t,e)=>{if(e!=null&&e.captionMap){const n=Object.keys(e.captionMap).find(i=>e.captionMap[i].stateName===t),r=n?e.captionMap[n]:void 0;return r&&r.undoable?r.undoable:!1}return!1},MCe=t=>t.stack.filter(e=>Number.parseInt(e)<=t.current&&_Ce(e,t)),PCe=(t,e,n)=>{const r=n.indexOf(e.current.toString());if(r>-1){const i=n.at(r-1);i&&Na.utils.undo(t,i)}else Na.utils.undo(t)},B_t=(t,e)=>{let n=[],r;if(t&&e){r=MCe(e);const i=r.slice(1);n=i.length>0?i.map(a=>({label:ECe(a,e),stateId:a,command:()=>{const o=r.indexOf(a),s=r.at(o===0?0:o-1);s&&Na.utils.undo(t,s)}})):[]}return{label:"Undo",sub:[...n],icon:"undo",command:()=>t&&e&&PCe(t,e,r)}},ACe=t=>t.stack.filter(e=>Number.parseInt(e)>t.current&&_Ce(e,t)),RCe=(t,e)=>{e.length>0&&t&&Na.utils.redo(t,e[0])},V_t=(t,e)=>{let n=[],r;return t&&e&&(r=ACe(e),n=r.length>0?r.map(i=>({label:ECe(i,e),stateId:i,command:()=>{const a=r.indexOf(i),o=r.at(a);o&&Na.utils.redo(t,o)}})):[]),{label:"Redo",sub:[...n],icon:"redo",command:()=>t&&RCe(t,r)}},j_t=t=>`${t} is not available in WebAssembly for the moment. Coming soon.`,H_t=t=>`${t} is not available in a view-only session.`,pre=({command:t,off:e})=>{var o;const n=h.useCallback(s=>{if(t.sub){const l=t.sub.findIndex(u=>u.stateId===s.key);t.sub[l].command()}},[t]),i={items:((o=t.sub)==null?void 0:o.map(s=>({label:s.label,key:s.stateId})))||[],onClick:n},a=!!e||!(t.sub&&t.sub.length>0);return pe.jsxs("span",{className:"rcad-split",children:[pe.jsx(vc,{title:e??t.label,placement:"bottom",mouseEnterDelay:.35,children:pe.jsx("span",{style:{display:"inline-flex"},children:pe.jsx("button",{type:"button",className:"rcad-tool","aria-label":t.label,disabled:a,onClick:t.command,children:t.icon&&pe.jsx(ut,{name:t.icon,size:18})})})}),pe.jsx(DS,{disabled:a,menu:i,trigger:["click"],placement:"bottomLeft",children:pe.jsx("button",{type:"button",className:"rcad-caret","aria-label":`${t.label}: steps`,disabled:a,children:pe.jsx(ut,{name:"caret",size:12})})})]})},G_t=({drawingId:t})=>{const e=z_t(t),n=Sl.useSessionRole()==="view",r=ue(t,c=>c.cad.states),i=h.useMemo(()=>B_t(t,r),[t,r]),a=h.useMemo(()=>V_t(t,r),[t,r]),o=Z5(t),s=n?{save:e.save}:e,l=c=>n?H_t(c):o?j_t(c):void 0;return pe.jsxs(pe.Fragment,{children:[pe.jsx(PCt,{items:s,trigger:["click"],placement:"bottomLeft",children:pe.jsxs("button",{type:"button",className:"rcad-tool rcad-tool-text","aria-label":"File",children:[pe.jsx(ut,{name:"menu",size:18}),pe.jsx("span",{children:"File"})]})}),pe.jsx("span",{className:"rcad-tools-sep"}),pe.jsx(pre,{command:i,off:l("Undo")}),pe.jsx(pre,{command:a,off:l("Redo")})]})},W_t=({drawingId:t})=>{const e=!!Sl.getInviteFromUrl(),n=ue(t,o=>o.cad.connection.connected),r=h.useRef(!1),[i,a]=h.useState(!1);return h.useEffect(()=>{n?r.current=!0:r.current&&a(!0)},[n]),!e||!i?null:pe.jsx($_t,{className:"rcad",role:"alert","aria-live":"assertive",children:pe.jsxs(q_t,{children:[pe.jsx(Y_t,{children:"Session ended"}),pe.jsx("p",{children:"The host ended the shared session, moved it, or your access was revoked."}),pe.jsxs(X_t,{children:[pe.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Join again"}),!SCe&&pe.jsx("button",{type:"button",onClick:()=>{window.location.href=`${window.location.origin}${window.location.pathname}`},children:"Leave"})]})]})})},$_t=tr.div`
|
|
10915
10915
|
position: absolute;
|
|
10916
10916
|
inset: 0;
|
|
10917
10917
|
z-index: 100001;
|
package/dist/app/assets/{troika-three-text.esm-188d86b5.js → troika-three-text.esm-6386308e.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{U as xn,M as kn,R as Fn,a as Cn,S as Dn,I as An,b as En,B as Mn,c as Pn,D as on,d as Gn,V as Vt,e as zr,C as yr,f as On,g as br,F as Bn,T as Ln,L as Vr,P as Ur,h as Rn,i as In,j as Wn,k as Nn,l as _r}from"./index-
|
|
1
|
+
import{U as xn,M as kn,R as Fn,a as Cn,S as Dn,I as An,b as En,B as Mn,c as Pn,D as on,d as Gn,V as Vt,e as zr,C as yr,f as On,g as br,F as Bn,T as Ln,L as Vr,P as Ur,h as Rn,i as In,j as Wn,k as Nn,l as _r}from"./index-f84cd890.js";function zn(){var c=Object.create(null);function r(t,e){var o=t.id,a=t.name,n=t.dependencies;n===void 0&&(n=[]);var i=t.init;i===void 0&&(i=function(){});var s=t.getTransferables;if(s===void 0&&(s=null),!c[o])try{n=n.map(function(l){return l&&l.isWorkerModule&&(r(l,function(h){if(h instanceof Error)throw h}),l=c[l.id].value),l}),i=u("<"+a+">.init",i),s&&(s=u("<"+a+">.getTransferables",s));var f=null;typeof i=="function"?f=i.apply(void 0,n):console.error("worker module init function failed to rehydrate"),c[o]={id:o,value:f,getTransferables:s},e(f)}catch(l){l&&l.noLog||console.error(l),e(l)}}function d(t,e){var o,a=t.id,n=t.args;(!c[a]||typeof c[a].value!="function")&&e(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var i=(o=c[a]).value.apply(o,n);i&&typeof i.then=="function"?i.then(s,function(f){return e(f instanceof Error?f:new Error(""+f))}):s(i)}catch(f){e(f)}function s(f){try{var l=c[a].getTransferables&&c[a].getTransferables(f);(!l||!Array.isArray(l)||!l.length)&&(l=void 0),e(f,l)}catch(h){console.error(h),e(h)}}}function u(t,e){var o=void 0;self.troikaDefine=function(n){return o=n};var a=URL.createObjectURL(new Blob(["/** "+t.replace(/\*/g,"")+` **/
|
|
2
2
|
|
|
3
3
|
troikaDefine(
|
|
4
4
|
`+e+`
|
package/dist/app/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="manifest" href="/manifest.json" />
|
|
10
10
|
<title>buerligons</title>
|
|
11
11
|
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-f84cd890.js"></script>
|
|
13
13
|
<link rel="stylesheet" href="/assets/index-54a14bc0.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
package/dist/mcp-server.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import { type Client, type EnginePolicy } from './client.js';
|
|
3
3
|
import { type LocalWasmOptions } from './engine/wasm.js';
|
|
4
4
|
import { type Show } from './share/session.js';
|
|
5
|
-
export declare const VERSION = "0.3.
|
|
5
|
+
export declare const VERSION = "0.3.4";
|
|
6
6
|
export declare const DEFAULT_WS_URL = "ws://0.0.0.0:9094/";
|
|
7
7
|
export type McpServerOptions = {
|
|
8
8
|
/** ClassCAD worker this instance connects to (lazily, on the first tool call). */
|
package/dist/mcp-server.js
CHANGED
|
@@ -19,7 +19,7 @@ import { attachViewer, VIEWER_NOTE } from './tools/viewer.js';
|
|
|
19
19
|
import { appNote, attachShare, registerSelectionTools, registerShareTool, registerViewTool } from './tools/share.js';
|
|
20
20
|
import { appAvailable, joinedHere, listen as listenForApps, waitForPage, SESSION_PATH } from './share/server.js';
|
|
21
21
|
import { sharingFromEnv, showFromEnv } from './share/session.js';
|
|
22
|
-
export const VERSION = '0.3.
|
|
22
|
+
export const VERSION = '0.3.4';
|
|
23
23
|
/** True for the address sessions are joined on on this machine (share/server.ts): an app's own engine, or another agent's. */
|
|
24
24
|
const hostedOnThisMachine = (url) => {
|
|
25
25
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classcad/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"mcpName": "io.github.awv-informatik/classcad",
|
|
5
5
|
"description": "ClassCAD MCP server: build, verify and export 3D CAD parts and assemblies with the ClassCAD engine, running locally",
|
|
6
6
|
"homepage": "https://classcad.ai",
|