import*as fflate from'/content/f815bd5c566c6e46de5cdb6ccb3a7043c63deeba61f4234baea84b602b0d4440i0'

import transform from'/content/7d3dd64f6598ea371aeff4d70b0f1728af0f57dd1747b58a190f7e52a9f5cd30i0'

const PADDING=100

const WIDTH=2048

const TOP_OFFSET=1255

const ATTRIBUTE_OFFSET=TOP_OFFSET+PADDING+220

export default async function(props,element,style){const res=await fetch('/content/83b2e90431c87df3045b80e774a747fa745f655132d25a6ab1600ce1b8307d98i0')

const compressed=new Uint8Array(await res.arrayBuffer())

const inflated=await fflate.decompressSync(compressed)

const base64=btoa(inflated.reduce((data,byte)=>data+String.fromCharCode(byte),''))

const url=`data:model/gltf-binary;base64,${base64}`const modelViewer=document.createElement('model-viewer')

modelViewer.src=url

Object.keys(style).forEach((key)=>{modelViewer.style[key]=style[key]})

let transformations=[{material:0,type:'image',coords:[0,0],size:[WIDTH,WIDTH],image:'/content/20bcaf88ed106f80d16a1bd7aceb5164270ef27a7b5ae95c11873e014a31f950i0'},{material:3,type:'image',coords:[0,0],size:[WIDTH,WIDTH],image:'/content/74c2e0f8c9b7cccf65b6b003f753a1769b3af71292405fe5f5c8981f45391de9i0'},{material:1,type:'image',coords:[0,0],size:[WIDTH,WIDTH],image:props.image},{material:2,type:'text',font:'bold 120px Helvetica',text:props.title,coords:[PADDING,TOP_OFFSET+PADDING+103],color:'white'},{material:2,type:'text',font:'500 60px Helvetica',text:`Inscription#${props.inscription_num}`,coords:[PADDING,ATTRIBUTE_OFFSET],color:'white'}]

props.attributes.forEach((a,index)=>{let TOP_OFFSET=ATTRIBUTE_OFFSET+(index+1)*72

const leftOffset=index%2===0?PADDING:PADDING+800

if(index>0){TOP_OFFSET-=72*(index/2)}

if(index%2===1){TOP_OFFSET-=36}

transformations.push({material:2,type:'text',font:'52px Helvetica',text:`${a.trait_type}:${a.value}`,coords:[leftOffset,TOP_OFFSET],color:'#BABBC7'})})

modelViewer.setAttribute('ar','')

modelViewer.setAttribute('enable-pan','')

modelViewer.setAttribute('shadow-intensity','1')

modelViewer.setAttribute('camera-controls','')

modelViewer.setAttribute('touch-action','pan-y')

modelViewer.addEventListener('load',async()=>{transform(modelViewer,transformations)})

element.appendChild(modelViewer)}