1import{Ai as e,Ct as t,J as n,Q as r,Qi as i,Tn as a,Zi as o,nt as s}from"./src-D9GYhO4rRw.js";import{F as c,an as l,ft as u}from"./vue-DR-_0DQxXA.js";import{c as d,d as f,l as p,o as m}from"./pacdora-3d-wnulKoNRJ_.js";import{t as h}from"./Date-DT3R-DfHsl.js";import{n as g,t as _}from"./boxMaterialSpherePresetApplier-DreQocAhqt.js";import{n as v,r as y}from"./useGlobal-BxA8x9BHT1.js";import{n as ee,t as te}from"./useRender-DyEBaTnkLt.js";import{n as b,t as x}from"./scene-C8OAcv9tzS.js";import{t as S}from"./AppEmitter-dnlzq1LHt6.js";import{d as ne,f as C,p as re,u as ie}from"./api-B8Y66gIssQ.js";import{n as w}from"./useLight-DlEsQrAoWs.js";import{n as ae}from"./useModelPanel-DRvGd1mYsr.js";var T=l([]),E=u(()=>{let e=o().model_cover,t=T.value.reduce((e,t)=>{switch(t.type){case p.Project:e.projects.push(t);break;case p.Base:case p.Decorator:e.elements.push(t);break}return e},{projects:[],elements:[]});return Object.keys(t).map(n=>({key:n,label:i(n===`elements`?`menus.elements`:`menus.models`),children:t[n].map((t,n)=>({key:t.uuid,type:t.type,value:t.name,gtm:t.type===p.Project?`ga-render_upload_model_choose`:`ga-render_upload_element_choose`,icon:ae(t.project,t.cover)||e,action:async()=>{var e;let n=await s(r);n.attachModelByUUID(t.uuid,d.OUTSIDE),(e=n.renderer.instance.domElement)==null||e.focus()},mouseEnter:async()=>{let e=await s(r);e.model.toggleBoundingBoxHelperWithoutGroup(!1),e.model.showBoxHelper(t.uuid,!0)},mouseLeave:async()=>{(await s(r)).model.showBoxHelper(t.uuid,!1)}}))}))}),D=u(()=>T.value.length===1),oe=u(()=>T.value.length>1),O=async()=>{let e=await s(r);E.value.forEach(t=>{if(t.children.every(e=>!e.value))t.children.forEach((t,n)=>{let r=n+1;e.renameModel(t.key,t.type===p.Project?`${i(`model`)} ${r}`:`${i(`element`)} ${r}`)});else{let n=Math.max(...t.children.map(e=>{var t;let n=(t=e.value)==null?void 0:t.match(/\d+$/);return n?parseInt(n[0]):0}).filter(e=>!isNaN(e)),0),r=0;t.children.forEach(t=>{if(!t.value){let a=n+1+ r++;e.renameModel(t.key,t.type===p.Project?`${i(`model`)} ${a}`:`${i(`element`)} ${a}`)}})}}),e.panel.updatePanelItems()},k,se=new Promise(e=>{k=e});function ce(){return{initScenePanel:async()=>{T.value=(await s(r)).panel.getItems(),await O(),k(!0)}}}var le=(e,t)=>!e||!t?!1:e.direction===t.direction&&(e.type||`linear`)===(t.type||`linear`)&&e.colors[0].color===t.colors[0].color&&e.colors[1].color===t.colors[1].color,A=150010,j=l(`unavailable`),M=l(),N=l(0),ue=l([]),P=l(),F=l([]),I=l(!0),L=l(0),R=new Map,z=l(!1),B=l(-1),V=l(),H=l(`sceneThemePanel`),U=l(!0),W=l();function de(e){if(e==null||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function G(){let n=async(e,n=!1,a)=>{try{V.value=await x(e);let t=V.value.class===1,d=!U.value&&t,p=await s(r),h=p.model.group.children.some(e=>e instanceof m||e instanceof f);if(await p.applySceneTemplate(V.value.params,n,!d),a!=null&&a.clearDesign&&!h)for(let e of p.model.group.children){var o;if((o=e.project)!=null&&o.layer){var c,l,u;let t=e.project;Object.keys(t.layer).forEach(e=>{let n=t.layer[e];n&&(n.design_list=[],n.inside_design_list=[])}),(c=e.setSizeShowOnly)==null||c.call(e,!0),(l=e.painter)==null||l.setProject(t),await((u=e.updateMaterial)==null?void 0:u.call(e,t))}}return M.value=V.value.params.camera,S.emit(`change:recommendColor`,{}),await i(V.value,d),N.value=e,S.emit(`load:sceneTemplate`,{}),!0}catch(e){return t().dealError(e),!1}},i=async(t,n=!1)=>{try{var i,a,o;let e=await s(r);if(((i=t.themes)==null?void 0:i.length)>0&&!R.has(t.id)){let n=e.getSceneTemplateDefaultThemeData(t.params),{userData:{backgroundType:r,gradient:i},color:a}=t.params;R.set(t.id,n)}let n=e.getSceneThemeData();z.value=((a=t.themes)==null?void 0:a.length)>0;let c=(o=t.themes)==null?void 0:o.findIndex(e=>{let{background:{type:t,value:r}}=e;if(t===`gradient`){var i;return le(r,n==null||(i=n.background)==null?void 0:i.value)}else if(t===`color`){var a;return r===(n==null||(a=n.background)==null?void 0:a.value)}return!1});B.value=c>-1?c:-1}catch(t){console.error(t),e({text:`Failed to init scene-theme`,type:`error`})}},a=async()=>{var e,t;let n=(e=T.value.filter(e=>e.type===p.Project)[0])==null?void 0:e.project,r=de(n==null||(t=n.cate)==null?void 0:t.cate_no)??A;r!==L.value&&(L.value=r,await o(r))},o=async(e=A)=>{try{I.value=!0;let[t,n]=await Promise.all([b({modelNo:e,showInScenes:1}),b({showInSeries:1})]);return F.value=n,P.value=t.flatMap(e=>e.list.map(e=>
1e)),{showInScenesData:P.value,showInSeriesData:F.value}}finally{I.value=!1}};return{loadSceneTemplateById:n,getScenes:o,effectSceneModelChange:a,scenes:ue,showInScenesData:P,showInSeriesData:F,sceneLoading:I,sceneThemeVisible:z,sceneTemplateId:N,activeThemeId:B,defaultThemeMap:R,sceneDetails:V,activePanel:H,renderStatus:j,cameraResetState:M,dirtySceneTemplateBackgroundEditable:U,initSceneTheme:i}}var K=l(``),q=l(),J=l(),Y=l(i(`renderCommon.untitledModeling`));function X(e){return JSON.parse(JSON.stringify(e))}function Z(e){return!!(e!=null&&e.material)&&typeof e.material==`object`&&Object.keys(e.material).length>0}function fe(e){let t=new Map;if(!Array.isArray(e==null?void 0:e.groups))return t;for(let n of e.groups)!Z(n)||n.typeId===void 0||n.typeId===null||t.set(`${n.typeId}`,n.material);return t}function pe(e){let t=e.name??e.typeId;return t==null||t===``?``:`${t}`}function me(e){return!!(e!=null&&e.isSoftPackage)&&typeof e.setMaterialSetting==`function`}function Q(e){var t,n;return(e==null||(t=e.knife)==null||(t=t.modeCate)==null?void 0:t.code)===`SoftPacking`||(e==null||(n=e.info)==null||(n=n.cate)==null?void 0:n.code)===`SoftPacking`}function $(e){if(!Array.isArray(e==null?void 0:e.materials))return e;let t=fe(e);if(!t.size)return e;let n=!1,r=e.materials.map(e=>{let r=t.get(`${e==null?void 0:e.typeId}`),i=e==null?void 0:e.info;return!r||!i?e:(n=!0,{...e,info:{...i,user_data:{...i.user_data||{},materialSetting:X(r)}}})});return n?{...e,materials:r}:e}function he(e){return Array.isArray(e==null?void 0:e.materials)?{...e,materials:e.materials.map(e=>{var t;let n=e==null?void 0:e.info;return!n||Q(e)?e:{...e,info:g({projectData:n,knifeData:e.knife,material:{id:n.science_id,name:n.science_name,zhName:(t=n.layer)==null||(t=t.traditional)==null?void 0:t.science_name},withMaterialSetting:!0})}})}:e}async function ge(e,t){if(Array.isArray(t==null?void 0:t.materials))for(let r of t.materials){var n;let t=r==null?void 0:r.info;t&&(Q(r)||await _({D3:e,projectData:t,knifeData:r.knife,material:{id:t.science_id,name:t.science_name,zhName:(n=t.layer)==null||(n=n.traditional)==null?void 0:n.science_name},applyMode:`runtime`}))}}async function _e(e,t){if(!Array.isArray(t==null?void 0:t.groups))return;let n=!1;for(let s of t.groups){var r,i;if(!Z(s))continue;let t=pe(s);if(!t)continue;let c=X(s.material),l=(r=e.model)==null||(i=r.getModel)==null?void 0:i.call(r,t);if(me(l))await l.setMaterialSetting(c,!1);else{var a,o;await((a=e.material)==null||(o=a.setMaterialSetting)==null?void 0:o.call(a,t,c))}l!=null&&l.project&&(l.project.user_data={...l.project.user_data||{},materialSetting:X(c)}),n=!0}n&&(e.needRenderOnce=!0)}function ve(){let{organizeRenderData:e}=ee(n),{dealError:o}=t(),{cameraResetState:l,sceneTemplateId:u}=G(),d=async e=>{try{var t;let n=await s(r),{config:o,name:c,templateId:d,defaultLightTemplate:f,id:p}=await a(e),m=$(o),h=he(m);n.showModelMainFaceInfoWithAi=(((h==null?void 0:h.materials)||[]).map(e=>e==null?void 0:e.info).filter(e=>!!e)||[]).some(e=>{var t,n;return(e==null||(t=e.cate)==null?void 0:t.otherFaces)&&(e==null||(n=e.cate)==null||(n=n.otherFaces)==null?void 0:n.length)>0});let g={...h,knifes:{},projects:{},modelSettings:{}};return K.value=e,u.value=d,J.value=p,await n.loadRenderProject(g),await ge(n,h),await _e(n,h),n.scene.metadata={activeTab:(t=o.userData)==null||(t=t.backgroundMetadata)==null?void 0:t.activeTab},l.value=g.camera,f&&(w.value=f),S.emit(`change:recommendColor`,{}),Y.value=c||i(`renderCommon.untitledModeling`),q.value=m,e}catch(e){throw o(e),e}},f=c();async function p(e={w:1,h:1},t={w:1920,h:1920},n=!0){try{var i;v.value=!0;let a=await s(r),o=$({...a.getRenderData(),materials:(i=q.value)==null?void 0:i.materials});q.value=o;let c={config:{...o,ratio:e,size:t,userData:{...o.userData,backgroundMetadata:{activeTab:W.value}}},version:`6.0.0`,templateId:u.value||void 0,defaultLightTemplate:w.value};if(n&&(c.screenshot=await te(await a.snapshot({width:600},`jpeg`),`render-cover`,!1,`jpeg`)),K.value)return await re(K.value,c),{id:K.value,screenshot:c.screenshot};{let{renderId:e,id:t}=await ne(c);return await C(e,Y.value),K.value=e,J.value=t,f.push({name:`render`,query:{id:e}}),{id:e,screenshot:c.screenshot}}}catch(e){o(e)}finally{v.value=!1}}return{loadRenderProject:d,saveRenderProject:p,renderId:K,tempRenderData:q,needSaveRenderProject:async()=>q.value?await(await s(r)).hasChange(q.value):!1,convertRenderProject:async()=>{let{renderId:e,mapping:t}=await ie(K.value);return(await s(r)).convertProjectIds(t),e}
1,isSaving:v,organizeRenderData:e,savedTime:y,renderProjectName:Y,saveProjectName:async e=>{try{v.value=!0,K.value||await p(),await C(K.value,e)}catch(e){o({type:`updateProject`,error:e})}finally{v.value=!1,y.value=h(new Date,`hh:mm`)}},renderProjectId:J,createProjectWithoutAProject:async()=>{K.value||await p()}}}export{oe as a,E as c,se as i,D as l,W as n,O as o,G as r,T as s,ve as t,ce as u};
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.