PageSourceSearch

https://cdn.pacdora.com/_pacui/assets/Convert-DlrHF7ppFJ.js

js pacdora.com collected 2026-10-03 22:12:52 UTC 12,638 bytes, 15 lines download raw bytes

1import{Fi as e,Hr as t,er as n}from"./src-D9GYhO4rRw.js";async function r(e,r){let i=new Blob([e],{type:`image/svg+xml`}),a=new File([i],`art-text.svg`,{type:`image/svg+xml`}),o=r||{xapi:`ai/upload`,type:`image`,rename:t()+`.svg`,report:!1};try{return await n(a,o)}catch(t){if(console.error(`Failed to upload SVG:`,t),typeof Buffer<`u`)return`data:image/svg+xml;base64,${Buffer.from(e).toString(`base64`)}`;{let t=new TextEncoder().encode(e),n=``,r=t.byteLength;for(let e=0;e<r;e++)n+=String.fromCharCode(t[e]);return`data:image/svg+xml;base64,${btoa(n)}`}}}function i(e,t,n){if(!e||e.length===0)return null;if(e.length===1)return e[0][n];for(let r=0;r<e.length-1;r++)if(t>=e[r].t&&t<=e[r+1].t){let i=(t-e[r].t)/(e[r+1].t-e[r].t),a=e[r][n],o=e[r+1][n];return typeof a==`number`&&typeof o==`number`?a+i*(o-a):i<.5?a:o}return e[e.length-1][n]}var a=class{constructor(t){e(this,`commands`,[]),e(this,`currentX`,0),e(this,`currentY`,0),e(this,`lastControlX`,0),e(this,`lastControlY`,0),e(this,`previousCommandType`,``),this.parse(t)}parse(e){let t=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,n;for(;(n=t.exec(e))!==null;){let e=n[1],t=n[2].trim(),r=t?t.split(/[\s,]+/).map(Number):[];this.commands.push({type:e,values:r})}}getPointAtLength(e){let t=0,n={x:0,y:0},r=0,i=0,a=``;for(let o of this.commands){let{type:s,values:c}=o;switch(s.toUpperCase()){case`M`:n={x:c[0],y:c[1]},{...n},r=n.x,i=n.y,a=`M`;break;case`L`:let o=c[0]-n.x,l=c[1]-n.y,u=Math.sqrt(o*o+l*l);if(t+u>=e){let r=(e-t)/u;return{x:n.x+r*o,y:n.y+r*l}}t+=u,n={x:c[0],y:c[1]},r=n.x,i=n.y,a=`L`;break;case`Q`:let d=s===`q`?n.x+c[0]:c[0],f=s===`q`?n.y+c[1]:c[1],p=s===`q`?n.x+c[2]:c[2],m=s===`q`?n.y+c[3]:c[3],h=this.estimateQuadraticBezierLength(n,{x:d,y:f},{x:p,y:m});if(t+h>=e){let r=(e-t)/h;return this.interpolateQuadraticBezier(n,{x:d,y:f},{x:p,y:m},r)}t+=h,n={x:p,y:m},r=d,i=f,a=`Q`;break;case`C`:let g=s===`c`?n.x+c[0]:c[0],_=s===`c`?n.y+c[1]:c[1],v=s===`c`?n.x+c[2]:c[2],y=s===`c`?n.y+c[3]:c[3],b=s===`c`?n.x+c[4]:c[4],x=s===`c`?n.y+c[5]:c[5],S=this.estimateCubicBezierLength(n,{x:g,y:_},{x:v,y},{x:b,y:x});if(t+S>=e){let r=(e-t)/S;return this.interpolateCubicBezier(n,{x:g,y:_},{x:v,y},{x:b,y:x},r)}t+=S,n={x:b,y:x},r=v,i=y,a=`C`;break;case`S`:let C,w;a&&[`C`,`S`,`c`,`s`].includes(a)?(C=n.x+(n.x-r),w=n.y+(n.y-i)):(C=n.x,w=n.y);let T=s===`s`?n.x+c[0]:c[0],E=s===`s`?n.y+c[1]:c[1],D=s===`s`?n.x+c[2]:c[2],O=s===`s`?n.y+c[3]:c[3],k=this.estimateCubicBezierLength(n,{x:C,y:w},{x:T,y:E},{x:D,y:O});if(t+k>=e){let r=(e-t)/k;return this.interpolateCubicBezier(n,{x:C,y:w},{x:T,y:E},{x:D,y:O},r)}t+=k,n={x:D,y:O},r=T,i=E,a=`S`;break;case`A`:let A=Math.abs(c[0]),j=Math.abs(c[1]),M=c[2]*Math.PI/180,N=c[3],P=c[4],F=c[5],I=c[6],L=this.estimateArcLength(n,{x:F,y:I},A,j,M,N,P);if(t+L>=e){let r=(e-t)/L;return this.interpolateArc(n,{x:F,y:I},A,j,M,N,P,r)}t+=L,n={x:F,y:I},r=n.x,i=n.y,a=`A`;break}}return n}estimateArcLength(e,t,n,r,i,a,o){let s=t.x-e.x,c=t.y-e.y;return Math.sqrt(s*s+c*c)}interpolateArc(e,t,n,r,i,a,o,s){let c=t.x-e.x,l=t.y-e.y;return{x:e.x+s*c,y:e.y+s*l}}estimateQuadraticBezierLength(e,t,n){let r=0,i=e;for(let a=1;a<=20;a++){let o=a/20,s=this.interpolateQuadraticBezier(e,t,n,o),c=s.x-i.x,l=s.y-i.y;r+=Math.sqrt(c*c+l*l),i=s}return r}interpolateQuadraticBezier(e,t,n,r){let i=1-r,a=r*r,o=i*i,s=2*i*r;return{x:o*e.x+s*t.x+a*n.x,y:o*e.y+s*t.y+a*n.y}}estimateCubicBezierLength(e,t,n,r){let i=0,a=e;for(let o=1;o<=20;o++){let s=o/20,c=this.interpolateCubicBezier(e,t,n,r,s),l=c.x-a.x,u=c.y-a.y;i+=Math.sqrt(l*l+u*u),a=c}return i}interpolateCubicBezier(e,t,n,r,i){let a=1-i,o=i*i,s=a*a,c=a*a*a,l=3*o,u=3*s;return{x:c*e.x+u*i*t.x+a*l*n.x+o*i*r.x,y:c*e.y+u*i*t.y+a*l*n.y+o*i*r.y}}getPreviousNonMoveCommand(e){let t=this.commands.indexOf(e);for(let e=t-1;e>=0;e--){let t=this.commands[e];if(t.type.toUpperCase()!==`M`)return t}return null}getPreviousPoint(e){return{x:0,y:0}}length(){let e=0,t={x:0,y:0},n=0,r=0,i=``;for(let a of this.commands){let{type:o,values:s}=a;switch(o.toUpperCase()){case`M`:t={x:s[0],y:s[1]},n=t.x,r=t.y,i=`M`;break;case`L`:let a=s[0]-t.x,c=s[1]-t.y;e+=Math.sqrt(a*a+c*c),t={x:s[0],y:s[1]},n=t.x,r=t.y,i=`L`;break;case`Q`:let l=o===`q`?t.x+s[0]:s[0],u=o===`q`?t.y+s[1]:s[1],d=o===`q`?t.x+s[2]:s[2],f=o===`q`?t.y+s[3]:s[3],p=this.estimateQuadraticBezierLength(t,{x:l,y:u},{x:d,y:f});e+=p,t={x:d,y:f},n=l,r=u,i=`Q`;break;case`C`:let m=o===`c`?t.x+s[0]:s[0],h=o===`c`?t.y+s[1]:s[1],g=o===`c`?t.x+s[2]:s[2],_=o===`c`?t.y+s[3]:s[3],v=o===`c`?t.x+s[4]:s[4],y=o===`c`?t.y+s[5]:s[5],b=this.estimateCubicBezierLength(t,{x:m,y:h},{x:g,y:_},{x:v,y});e+=b,t={x:v,y},n=g,r=_,i=`C`;break;case`S`:let x,S;i&&[`C`,`S`,`c`,`s`].includes(i)?(x=t.x+(t.x-n),S=t.y+(t.y-r)):(x=t.x,S=t.y);let C=o===`s`?t.x+s[0]:s[0],w=o===`s`?t.y+s[1]:s[1],T=o===`s`?t.x+s[2]:s[2],E=o===`s`?t.y+s[3]:s[3],D=this.estimateCubicBezierLength(t,{x,y:S},{x:C,y:w},{x:T,y:E});e+=D,t={x:T,y:E},n=C,r=w,i=`S`;break;case`A`:let O=s[5],k=s[6],A=O-t.x,j=k-t.y;e+=Math.sqrt(A*A+j*j),t={x:O,y:k},n=t.x,r=t.y,i=`A`;break}}return e}point(e){let t=e*this.length();return this.getPointAtLength(t)}};function o(e,t,n){let r=e.content,o=e.artStyle,s=e.style,c=o.path,l=o.sizeCurve||[],u=o.colorCurve||[],d=e.zIndex||1,f=t||800,p=n||600,m=s.fontFamily||`sans-serif`,h=s.fontWeight||400,g=s.color||`#000000`,_=null,v=null;s.stroke&&(_=s.stroke.color||`#000000`,v=s.stroke.width||1);let y=null,b=``;if(s.shadow){y=`art-text-shadow`;let e=s.shadow.offsetX||0,t=s.shadow.offsetY||0,n=s.shadow.blur||0,r=s.shadow.color||`rgba(0, 0, 0, 0.5)`;b=`
2    <defs>
3        <filter id="${y}">
4            <feDropShadow dx="${e}" dy="${t}" stdDeviation="${n}" flood-color="${r}"/>
5        </filter>
6    </defs>`}let x=new a(c);x.length();let S=Math.max(r.length-1,1),C=[];for(let e=0;e<r.length;e++){let t=r[e],n=r.length===1?.5:e/S,a=x.point(n);console.log(`point===>`,a,n,c);let o=1e-5,s=x.point(Math.max(0,n-o)),d=x.point(Math.min(1,n+o)),f=d.x-s.x,p=d.y-s.y,b=Math.sqrt(f*f+p*p);b===0&&(b=1),f/=b,p/=b,-p;let w=Math.atan2(p,f)*180/Math.PI,T=i(l,e/r.length,`value`)||40,E=g;u&&u.length>0&&(E=i(u,e/r.length,`color`)||g);let D=a.x,O=a.y,k=[`x="${D.toFixed(2)}"`,`y="${O.toFixed(2)}"`,`font-family="${m}"`,`font-weight="${h}"`,`font-size="${T}"`,`fill="${E}"`,`text-anchor="middle"`,`dominant-baseline="middle"`,`transform="rotate(${w.toFixed(2)},${D.toFixed(2)},${O.toFixed(2)})"`];_&&v&&(k.push(`stroke="${_}"`),k.push(`stroke-width="${v}
6"`),k.push(`paint-order="stroke fill"`)),y&&k.push(`filter="url(#${y})"`),C.push(`
7    <text ${k.join(` `)}>
8    ${t}
9    </text>
10    `)}return`
11    <svg style="z-index:${d}; position: absolute; left: 0; top: 0" width="${f}" height="${p}" viewBox="0 0 ${f} ${p}" xmlns="http://www.w3.org/2000/svg" overflow="visible">
12    ${b}
13    ${C.join(``)}
14    </svg>
15    `.trim()}function s(e,t){var n,r,i;let a=Array.from(t).map(e=>e.codePointAt(0)).filter(Boolean),o=/@font-face\s*{([^}]+)}/gs,s=[],l;for(;(l=o.exec(e))!==null;){let e=l[1],t=e.match(/unicode-range:\s*(.*?);/i),n=t?t[1].trim():`U+0-10FFFF`,r=e.match(/src:\s*url\s*\(\s*[`'"]?\s*([^`'"\)]+)[`'"]?\s*\)\s*(?:format\(['"]?\w+['"]?\))?/i),i=r?r[1]:``;i&&s.push({unicodeRange:n,src:i})}for(let e of a)for(let t of s)if(c(e,t.unicodeRange))return t.src;return s.length>0?s[0].src:((n=e.match(/src:\s*url\s*\(\s*[`'"]?\s*([^`'"\)]+)[`'"]?\s*\)\s*format/i))==null?void 0:n[1])??((r=e.match(/src:\s*url\s*\(\s*[`'"]?\s*([^`'"\)]+)[`'"]?\s*\)/i))==null?void 0:r[1])??((i=e.match(/url\(['"]?([^'"]*?)['"]?\)/i))==null?void 0:i[1])??``}function c(e,t){let n=t.split(`,`).map(e=>e.trim());for(let t of n)if(t.startsWith(`U+`)){let n=t.substring(2).trim();if(n.includes(`-`)){let[t,r]=n.split(`-`).map(e=>parseInt(e.trim(),16));if(e>=t&&e<=r)return!0}else if(e===parseInt(n,16))return!0}return!1}function l(e,t){for(let n of e){if(n.id===t)return n;if(n.type===`group`&&n.designs){let e=l(n.designs,t);if(e)return e}}return null}function u(e,t,n,r={x:1,y:1}){let{scale:i,rotation:a}=t,{left:o,top:s}=t.style;i.x*=r.x,i.y*=r.y;let c=JSON.parse(JSON.stringify(e));return c.uuid=t.uuid,c.type===`font`?(c.style.fontSize=(e.style.fontSize||0)*i.x,c.style.width=(e.style.width||0)*i.x,c.style.height=(e.style.height||0)*i.y,c.style.rotate=(e.style.rotate||0)+a):c.type===`img`?(c.style.width=(e.style.width||0)*i.x,c.style.height=(e.style.height||0)*i.y,c.style.rotate=(e.style.rotate||0)+a,c.bg&&(c.bg={...e.bg,width:(e.bg.width||0)*i.x,height:(e.bg.height||0)*i.y})):c.type===`group`&&c.designs&&(c.designs=c.designs.map(e=>{if(e.type===`instance`){let t=e,r=l(n,t.referenceId);if(r)return u(r,t,n,i)}return e.style.fontSize=(e.style.fontSize||0)*i.x,e.style.width=(e.style.width||0)*i.x,e.style.height=(e.style.height||0)*i.y,Object.assign(e.style,{left:e.style.left*i.x,top:e.style.top*i.y}),e}),c.style.width=(e.style.width||0)*i.x,c.style.height=(e.style.height||0)*i.y,c.style.rotate=(e.style.rotate||0)+a),Object.assign(c.style,{left:o*r.x-c.style.width/2,top:s*r.y-c.style.height/2}),c}function d(e){return e.map(t=>{if(t.type===`instance`){let n=t,r=l(e,n.referenceId);return r?u(r,n,e):t}return t.type===`group`&&t.designs?(console.log(`designs===>`,JSON.parse(JSON.stringify(t.designs))),{...t,designs:d(t.designs)}):t})}async function f(e,n,i,a,c=!1){switch(e.type){case`text`:let l=`https://cdn.pacdora.com/font_v2/Poppins/Poppins-Medium.woff2`;try{l=s(await fetch(`https://fonts.googleapis.com/css2?family=${e.style.fontFamily.replace(` `,`+`)}:wght@400;500;600;700&display=swap`).then(e=>e.text()),e.content)}catch(e){console.log(`error==>`,e)}return console.log(`font url==>`,l),{type:`font`,uuid:t(),id:e.id,layerName:n,original_src:l,src:l,value:e.content,style:{left:(e.position.x-e.size.width/2)*i+(c?0:a.x),top:(e.position.y-e.size.height/2)*i+(c?0:a.y),fontSize:e.style.fontSize*i,fontWeight:e.style.fontWeight,fontFamily:e.style.fontFamily,color:e.style.color,textAlign:e.style.textAlign,lineHeight:e.style.fontSize*i,vertical:0,width:e.size.width*i,height:e.size.height*i,rotate:e.rotation??0,fontShadow:e.style.shadow?[{color:e.style.shadow.color,value:[e.style.shadow.offsetX*i,e.style.shadow.offsetY*i,e.style.shadow.blurRadius*i]}]:[]},_layer_name:n};case`image`:return{type:`img`,uuid:t(),id:e.id,layerName:n,src:e.src,original_src:e.src,can_set_color:0,bg:{x:0,y:0,width:e.size.width*i,height:e.size.height*i},style:{left:(e.position.x-e.size.width/2)*i+(c?0:a.x),top:(e.position.y-e.size.height/2)*i+(c?0:a.y),width:e.size.width*i,height:e.size.height*i,rotate:e.rotation??0,opacity:100,rotateX:!1,rotateY:!1},_layer_name:n};case`shape`:case`table`:return{type:`img`,uuid:t(),id:e.id,layerName:n,src:await r(e.svg),original_src:await r(e.svg),can_set_color:1,bg:{x:0,y:0,width:e.size.width*i,height:e.size.height*i},style:{left:(e.position.x-e.size.width/2)*i+(c?0:a.x),top:(e.position.y-e.size.height/2)*i+(c?0:a.y),width:e.size.width*i,height:e.size.height*i,rotate:e.rotation??0,opacity:100,rotateX:!1,rotateY:!1},_layer_name:n};case`artText`:let u=o(e,a.w*10,a.h*10);return console.log(`svgHtml===>`,u,await r(u)),{type:`img`,uuid:t(),id:e.id,layerName:n,src:await r(u),original_src:await r(u),can_set_color:1,bg:{x:0,y:0,width:a.w,height:a.h},style:{left:0+(c?0:a.x),top:0+(c?0:a.y),width:a.w,height:a.h,rotate:0,opacity:100,rotateX:!1,rotateY:!1},_layer_name:n};default:throw Error(`Unknown item type: ${e.type}`)}}async function p(e,n=`traditional`){let r=[],i=[];for(let a of e){let{faceConfig:e,resultData:o,faceKey:s}=a;if(o){let{width:a,height:c,layout:l}=o,u=e.w/a;for(let a=0;a<l.length;a++){let o=l[a],{type:c}=o;switch(c){case`background`:i.push({color:o.color,face:s});break;case`text`:let a=await f(o,n,u,e);a.__faceKey=s,r.push(a);break;case`image`:let c=await f(o,n,u,e);c.__faceKey=s,r.push(c);break;case`instance`:r.push({type:`instance`,uuid:t(),id:o.id,layerName:n,scale:o.scale,rotation:o.rotation??0,referenceId:o.referenceId,style:{left:o.position.x*u+e.x,top:o.position.y*u+e.y},__faceKey:s});break;case`group`:let l=o.children.map(r=>(console.log(`child`,r),r.type===`instance`?{type:`instance`,uuid:t(),id:r.id,layerName:n,scale:r.scale,rotation:r.rotation??0,referenceId:r.referenceId,style:{left:r.position.x*u,top:r.position.y*u}}:f(r,n,u,e,!0))),d=await Promise.all(l);r.push({type:`group`,uuid:t(),id:o.id,layerName:n,designs:d,style:{left:(o.position.x-o.size.width/2)*u+e.x,top:(o.position.y-o.size.height/2)*u+e.y,width:o.size.width*u,height:o.size.height*u,rotate:o.rotation??0},__faceKey:s,_layer_name:n});break;case`shape`:let p=await f(o,n,u,e);p.__faceKey=s,r.push(p);break;case`table`:let m=await f(o,n,u,e);m.__faceKey=s,r.push(m);break;case`artText`:let h=await f(o,n,u,e);h.__faceKey=s,r.push(h);break}}}}return{designs:d(r),faceBg:i}}export{p as t};

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.