UNPKG

lingo3d-vanilla

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

1 lines 21 kB
"use strict";(self.webpackChunklingo3d_vanilla=self.webpackChunklingo3d_vanilla||[]).push([[559],{4559:(t,e,n)=>{n.r(e),n.d(e,{default:()=>l});var r=n(7002);class o extends r.aNw{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,n,o){const i=this,s=new r.hH6(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(n){try{e(i.parse(n))}catch(r){o?o(r):console.error(r),i.manager.itemError(t)}}),n,o)}parse(t){const e=this;function n(t,e,n,r,i,s,c,a){if(0==e||0==n)return void t.lineTo(a.x,a.y);r=r*Math.PI/180,e=Math.abs(e),n=Math.abs(n);const l=(c.x-a.x)/2,u=(c.y-a.y)/2,y=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u;let h=e*e,p=n*n;const d=y*y,x=f*f,b=d/h+x/p;if(b>1){const t=Math.sqrt(b);h=(e*=t)*e,p=(n*=t)*n}const g=h*x+p*d,m=(h*p-g)/g;let k=Math.sqrt(Math.max(0,m));i===s&&(k=-k);const w=k*e*f/n,M=-k*n*y/e,v=Math.cos(r)*w-Math.sin(r)*M+(c.x+a.x)/2,A=Math.sin(r)*w+Math.cos(r)*M+(c.y+a.y)/2,T=o(1,0,(y-w)/e,(f-M)/n),P=o((y-w)/e,(f-M)/n,(-y-w)/e,(-f-M)/n)%(2*Math.PI);t.currentPath.absellipse(v,A,e,n,T,T+P,0===s,r)}function o(t,e,n,r){const o=t*n+e*r,i=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+r*r);let s=Math.acos(Math.max(-1,Math.min(1,o/i)));return t*r-e*n<0&&(s=-s),s}function i(t,e){e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)n=Object.assign(n,p["."+e[t]])}function r(r,o,i){void 0===i&&(i=function(t){return t.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),t}),t.hasAttribute(r)&&(e[o]=i(t.getAttribute(r))),n[r]&&(e[o]=i(n[r])),t.style&&""!==t.style[r]&&(e[o]=i(t.style[r]))}function o(t){return Math.max(0,Math.min(1,u(t)))}function i(t){return Math.max(0,u(t))}return t.hasAttribute("id")&&(n=Object.assign(n,p["#"+t.getAttribute("id")])),r("fill","fill"),r("fill-opacity","fillOpacity",o),r("fill-rule","fillRule"),r("opacity","opacity",o),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",o),r("stroke-width","strokeWidth",i),r("stroke-linejoin","strokeLineJoin"),r("stroke-linecap","strokeLineCap"),r("stroke-miterlimit","strokeMiterLimit",i),r("visibility","visibility"),e}function s(t,e){return t-(e-t)}function c(t,e,n){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let o=0,i=!0,s="",c="";const a=[];function l(t,e,n){const r=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw r.partial=n,r}function u(){""!==s&&(""===c?a.push(Number(s)):a.push(Number(s)*Math.pow(10,Number(c)))),s="",c=""}let y;const f=t.length;for(let h=0;h<f;h++)if(y=t[h],Array.isArray(e)&&e.includes(a.length%n)&&r.FLAGS.test(y))o=1,s=y,u();else{if(0===o){if(r.WHITESPACE.test(y))continue;if(r.DIGIT.test(y)||r.SIGN.test(y)){o=1,s=y;continue}if(r.POINT.test(y)){o=2,s=y;continue}r.COMMA.test(y)&&(i&&l(y,h,a),i=!0)}if(1===o){if(r.DIGIT.test(y)){s+=y;continue}if(r.POINT.test(y)){s+=y,o=2;continue}if(r.EXP.test(y)){o=3;continue}r.SIGN.test(y)&&1===s.length&&r.SIGN.test(s[0])&&l(y,h,a)}if(2===o){if(r.DIGIT.test(y)){s+=y;continue}if(r.EXP.test(y)){o=3;continue}r.POINT.test(y)&&"."===s[s.length-1]&&l(y,h,a)}if(3===o){if(r.DIGIT.test(y)){c+=y;continue}if(r.SIGN.test(y)){if(""===c){c+=y;continue}1===c.length&&r.SIGN.test(c)&&l(y,h,a)}}r.WHITESPACE.test(y)?(u(),o=0,i=!1):r.COMMA.test(y)?(u(),o=0,i=!0):r.SIGN.test(y)?(u(),o=1,s=y):r.POINT.test(y)?(u(),o=2,s=y):l(y,h,a)}return u(),a}const a=["mm","cm","in","pt","pc","px"],l={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function u(t){let n,r="px";if("string"==typeof t||t instanceof String)for(let e=0,o=a.length;e<o;e++){const n=a[e];if(t.endsWith(n)){r=n,t=t.substring(0,t.length-n.length);break}}return"px"===r&&"px"!==e.defaultUnit?n=l.in[e.defaultUnit]/e.defaultDPI:(n=l[r][e.defaultUnit],n<0&&(n=l[r].in*e.defaultDPI)),n*parseFloat(t)}function y(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function f(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const h=[],p={},d=[],x=new r.Vkp,b=new r.Vkp,g=new r.Vkp,m=new r.Vkp,k=new r.FM8,w=new r.Pa4,M=new r.Vkp,v=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(e,o){if(1!==e.nodeType)return;const a=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new r.Vkp,n=x;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const n=u(t.getAttribute("x")),r=u(t.getAttribute("y"));e.translate(n,r)}if(t.hasAttribute("transform")){const r=t.getAttribute("transform").split(")");for(let t=r.length-1;t>=0;t--){const o=r[t].trim();if(""===o)continue;const i=o.indexOf("("),s=o.length;if(i>0&&i<s){const t=o.slice(0,i),e=c(o.slice(i+1));switch(n.identity(),t){case"translate":if(e.length>=1){const t=e[0];let r=0;e.length>=2&&(r=e[1]),n.translate(t,r)}break;case"rotate":if(e.length>=1){let t=0,r=0,o=0;t=-e[0]*Math.PI/180,e.length>=3&&(r=e[1],o=e[2]),b.identity().translate(-r,-o),g.identity().rotate(t),m.multiplyMatrices(g,b),b.identity().translate(r,o),n.multiplyMatrices(b,m)}break;case"scale":if(e.length>=1){const t=e[0];let r=t;e.length>=2&&(r=e[1]),n.scale(t,r)}break;case"skewX":1===e.length&&n.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&n.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&n.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(n)}}return e}(t);d.length>0&&e.premultiply(d[d.length-1]);return M.copy(e),d.push(e),e}(e);let l=!1,v=null;switch(e.nodeName){case"svg":case"g":o=i(e,o);break;case"style":!function(t){if(!t.sheet||!t.sheet.cssRules||!t.sheet.cssRules.length)return;for(let e=0;e<t.sheet.cssRules.length;e++){const n=t.sheet.cssRules[e];if(1!==n.type)continue;const r=n.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<r.length;t++){const e=Object.fromEntries(Object.entries(n.style).filter((([,t])=>""!==t)));p[r[t]]=Object.assign(p[r[t]]||{},e)}}}(e);break;case"path":o=i(e,o),e.hasAttribute("d")&&(v=function(t){const e=new r.T_1,o=new r.FM8,i=new r.FM8,a=new r.FM8;let l=!0,u=!1;const y=t.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let r=0,f=y.length;r<f;r++){const t=y[r],f=t.charAt(0),h=t.slice(1).trim();let p;switch(!0===l&&(u=!0,l=!1),f){case"M":p=c(h);for(let t=0,n=p.length;t<n;t+=2)o.x=p[t+0],o.y=p[t+1],i.x=o.x,i.y=o.y,0===t?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y),0===t&&a.copy(o);break;case"H":p=c(h);for(let t=0,n=p.length;t<n;t++)o.x=p[t],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"V":p=c(h);for(let t=0,n=p.length;t<n;t++)o.y=p[t],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"L":p=c(h);for(let t=0,n=p.length;t<n;t+=2)o.x=p[t+0],o.y=p[t+1],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"C":p=c(h);for(let t=0,n=p.length;t<n;t+=6)e.bezierCurveTo(p[t+0],p[t+1],p[t+2],p[t+3],p[t+4],p[t+5]),i.x=p[t+2],i.y=p[t+3],o.x=p[t+4],o.y=p[t+5],0===t&&!0===u&&a.copy(o);break;case"S":p=c(h);for(let t=0,n=p.length;t<n;t+=4)e.bezierCurveTo(s(o.x,i.x),s(o.y,i.y),p[t+0],p[t+1],p[t+2],p[t+3]),i.x=p[t+0],i.y=p[t+1],o.x=p[t+2],o.y=p[t+3],0===t&&!0===u&&a.copy(o);break;case"Q":p=c(h);for(let t=0,n=p.length;t<n;t+=4)e.quadraticCurveTo(p[t+0],p[t+1],p[t+2],p[t+3]),i.x=p[t+0],i.y=p[t+1],o.x=p[t+2],o.y=p[t+3],0===t&&!0===u&&a.copy(o);break;case"T":p=c(h);for(let t=0,n=p.length;t<n;t+=2){const n=s(o.x,i.x),r=s(o.y,i.y);e.quadraticCurveTo(n,r,p[t+0],p[t+1]),i.x=n,i.y=r,o.x=p[t+0],o.y=p[t+1],0===t&&!0===u&&a.copy(o)}break;case"A":p=c(h,[3,4],7);for(let t=0,r=p.length;t<r;t+=7){if(p[t+5]==o.x&&p[t+6]==o.y)continue;const r=o.clone();o.x=p[t+5],o.y=p[t+6],i.x=o.x,i.y=o.y,n(e,p[t],p[t+1],p[t+2],p[t+3],p[t+4],r,o),0===t&&!0===u&&a.copy(o)}break;case"m":p=c(h);for(let t=0,n=p.length;t<n;t+=2)o.x+=p[t+0],o.y+=p[t+1],i.x=o.x,i.y=o.y,0===t?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y),0===t&&a.copy(o);break;case"h":p=c(h);for(let t=0,n=p.length;t<n;t++)o.x+=p[t],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"v":p=c(h);for(let t=0,n=p.length;t<n;t++)o.y+=p[t],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"l":p=c(h);for(let t=0,n=p.length;t<n;t+=2)o.x+=p[t+0],o.y+=p[t+1],i.x=o.x,i.y=o.y,e.lineTo(o.x,o.y),0===t&&!0===u&&a.copy(o);break;case"c":p=c(h);for(let t=0,n=p.length;t<n;t+=6)e.bezierCurveTo(o.x+p[t+0],o.y+p[t+1],o.x+p[t+2],o.y+p[t+3],o.x+p[t+4],o.y+p[t+5]),i.x=o.x+p[t+2],i.y=o.y+p[t+3],o.x+=p[t+4],o.y+=p[t+5],0===t&&!0===u&&a.copy(o);break;case"s":p=c(h);for(let t=0,n=p.length;t<n;t+=4)e.bezierCurveTo(s(o.x,i.x),s(o.y,i.y),o.x+p[t+0],o.y+p[t+1],o.x+p[t+2],o.y+p[t+3]),i.x=o.x+p[t+0],i.y=o.y+p[t+1],o.x+=p[t+2],o.y+=p[t+3],0===t&&!0===u&&a.copy(o);break;case"q":p=c(h);for(let t=0,n=p.length;t<n;t+=4)e.quadraticCurveTo(o.x+p[t+0],o.y+p[t+1],o.x+p[t+2],o.y+p[t+3]),i.x=o.x+p[t+0],i.y=o.y+p[t+1],o.x+=p[t+2],o.y+=p[t+3],0===t&&!0===u&&a.copy(o);break;case"t":p=c(h);for(let t=0,n=p.length;t<n;t+=2){const n=s(o.x,i.x),r=s(o.y,i.y);e.quadraticCurveTo(n,r,o.x+p[t+0],o.y+p[t+1]),i.x=n,i.y=r,o.x=o.x+p[t+0],o.y=o.y+p[t+1],0===t&&!0===u&&a.copy(o)}break;case"a":p=c(h,[3,4],7);for(let t=0,r=p.length;t<r;t+=7){if(0==p[t+5]&&0==p[t+6])continue;const r=o.clone();o.x+=p[t+5],o.y+=p[t+6],i.x=o.x,i.y=o.y,n(e,p[t],p[t+1],p[t+2],p[t+3],p[t+4],r,o),0===t&&!0===u&&a.copy(o)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(o.copy(a),e.currentPath.currentPoint.copy(o),l=!0);break;default:console.warn(t)}u=!1}return e}(e));break;case"rect":o=i(e,o),v=function(t){const e=u(t.getAttribute("x")||0),n=u(t.getAttribute("y")||0),o=u(t.getAttribute("rx")||t.getAttribute("ry")||0),i=u(t.getAttribute("ry")||t.getAttribute("rx")||0),s=u(t.getAttribute("width")),c=u(t.getAttribute("height")),a=.448084975506,l=new r.T_1;l.moveTo(e+o,n),l.lineTo(e+s-o,n),(0!==o||0!==i)&&l.bezierCurveTo(e+s-o*a,n,e+s,n+i*a,e+s,n+i);l.lineTo(e+s,n+c-i),(0!==o||0!==i)&&l.bezierCurveTo(e+s,n+c-i*a,e+s-o*a,n+c,e+s-o,n+c);l.lineTo(e+o,n+c),(0!==o||0!==i)&&l.bezierCurveTo(e+o*a,n+c,e,n+c-i*a,e,n+c-i);l.lineTo(e,n+i),(0!==o||0!==i)&&l.bezierCurveTo(e,n+i*a,e+o*a,n,e+o,n);return l}(e);break;case"polygon":o=i(e,o),v=function(t){function e(t,e,n){const r=u(e),s=u(n);0===i?o.moveTo(r,s):o.lineTo(r,s),i++}const n=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,o=new r.T_1;let i=0;return t.getAttribute("points").replace(n,e),o.currentPath.autoClose=!0,o}(e);break;case"polyline":o=i(e,o),v=function(t){function e(t,e,n){const r=u(e),s=u(n);0===i?o.moveTo(r,s):o.lineTo(r,s),i++}const n=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,o=new r.T_1;let i=0;return t.getAttribute("points").replace(n,e),o.currentPath.autoClose=!1,o}(e);break;case"circle":o=i(e,o),v=function(t){const e=u(t.getAttribute("cx")||0),n=u(t.getAttribute("cy")||0),o=u(t.getAttribute("r")||0),i=new r.y$t;i.absarc(e,n,o,0,2*Math.PI);const s=new r.T_1;return s.subPaths.push(i),s}(e);break;case"ellipse":o=i(e,o),v=function(t){const e=u(t.getAttribute("cx")||0),n=u(t.getAttribute("cy")||0),o=u(t.getAttribute("rx")||0),i=u(t.getAttribute("ry")||0),s=new r.y$t;s.absellipse(e,n,o,i,0,2*Math.PI);const c=new r.T_1;return c.subPaths.push(s),c}(e);break;case"line":o=i(e,o),v=function(t){const e=u(t.getAttribute("x1")||0),n=u(t.getAttribute("y1")||0),o=u(t.getAttribute("x2")||0),i=u(t.getAttribute("y2")||0),s=new r.T_1;return s.moveTo(e,n),s.lineTo(o,i),s.currentPath.autoClose=!1,s}(e);break;case"defs":l=!0;break;case"use":o=i(e,o);const a=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),y=e.viewportElement.getElementById(a);y?t(y,o):console.warn("SVGLoader: 'use node' references non-existent node id: "+a)}v&&(void 0!==o.fill&&"none"!==o.fill&&v.color.setStyle(o.fill),function(t,e){function n(t){w.set(t.x,t.y,1).applyMatrix3(e),t.set(w.x,w.y)}const r=function(t){return 0!==t.elements[1]||0!==t.elements[3]}(e),o=t.subPaths;for(let i=0,s=o.length;i<s;i++){const t=o[i].curves;for(let o=0;o<t.length;o++){const i=t[o];i.isLineCurve?(n(i.v1),n(i.v2)):i.isCubicBezierCurve?(n(i.v0),n(i.v1),n(i.v2),n(i.v3)):i.isQuadraticBezierCurve?(n(i.v0),n(i.v1),n(i.v2)):i.isEllipseCurve&&(r&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),k.set(i.aX,i.aY),n(k),i.aX=k.x,i.aY=k.y,i.xRadius*=y(e),i.yRadius*=f(e))}}}(v,M),h.push(v),v.userData={node:e,style:o});const A=e.childNodes;for(let n=0;n<A.length;n++){const e=A[n];l&&"style"!==e.nodeName&&"defs"!==e.nodeName||t(e,o)}a&&(d.pop(),d.length>0?M.copy(d[d.length-1]):M.identity())}(v.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:h,xml:v.documentElement}}static createShapes(t){const e=999999999,n=0,o=1,i=2,s=3,c=4,a=5,l=6,u={loc:n,t:0};function y(t,e,r,o){const s=t.x,c=e.x,a=r.x,l=o.x,y=t.y,h=e.y,p=r.y,d=o.y,x=(l-a)*(y-p)-(d-p)*(s-a),b=(d-p)*(c-s)-(l-a)*(h-y),g=x/b,m=((c-s)*(y-p)-(h-y)*(s-a))/b;if(0===b&&0!==x||g<=0||g>=1||m<0||m>1)return null;if(0===x&&0===b){for(let a=0;a<2;a++){if(f(0===a?r:o,t,e),u.loc==n){const t=0===a?r:o;return{x:t.x,y:t.y,t:u.t}}if(u.loc==i){return{x:+(s+u.t*(c-s)).toPrecision(10),y:+(y+u.t*(h-y)).toPrecision(10),t:u.t}}}return null}for(let i=0;i<2;i++)if(f(0===i?r:o,t,e),u.loc==n){const t=0===i?r:o;return{x:t.x,y:t.y,t:u.t}}return{x:+(s+g*(c-s)).toPrecision(10),y:+(y+g*(h-y)).toPrecision(10),t:g}}function f(t,e,r){const y=r.x-e.x,f=r.y-e.y,h=t.x-e.x,p=t.y-e.y,d=y*p-h*f;if(t.x===e.x&&t.y===e.y)return u.loc=n,void(u.t=0);if(t.x===r.x&&t.y===r.y)return u.loc=o,void(u.t=1);if(d<-Number.EPSILON)return void(u.loc=s);if(d>Number.EPSILON)return void(u.loc=c);if(y*h<0||f*p<0)return void(u.loc=a);if(Math.sqrt(y*y+f*f)<Math.sqrt(h*h+p*p))return void(u.loc=l);let x;x=0!==y?h/y:p/f,u.loc=i,u.t=x}function h(t,e,n){const o=new r.FM8;e.getCenter(o);const i=[];return n.forEach((e=>{if(e.boundingBox.containsPoint(o)){(function(t,e){const n=[],o=[];for(let i=1;i<t.length;i++){const s=t[i-1],c=t[i];for(let t=1;t<e.length;t++){const i=y(s,c,e[t-1],e[t]);null!==i&&void 0===n.find((t=>t.t<=i.t+Number.EPSILON&&t.t>=i.t-Number.EPSILON))&&(n.push(i),o.push(new r.FM8(i.x,i.y)))}}return o})(t,e.points).forEach((t=>{i.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),i.sort(((t,e)=>t.point.x-e.point.x)),i}let p=0,d=e,x=-999999999,b=t.subPaths.map((t=>{const n=t.getPoints();let o=-999999999,i=e,s=-999999999,c=e;for(let e=0;e<n.length;e++){const t=n[e];t.y>o&&(o=t.y),t.y<i&&(i=t.y),t.x>s&&(s=t.x),t.x<c&&(c=t.x)}return x<=s&&(x=s+1),d>=c&&(d=c-1),{curves:t.curves,points:n,isCW:r.iDF.isClockWise(n),identifier:p++,boundingBox:new r.TUj(new r.FM8(c,i),new r.FM8(s,o))}}));b=b.filter((t=>t.points.length>1));const g=b.map((e=>{var n;return function(t,e,n,o,i){null!=i&&""!==i||(i="nonzero");const s=new r.FM8;t.boundingBox.getCenter(s);const c=h([new r.FM8(n,s.y),new r.FM8(o,s.y)],t.boundingBox,e);c.sort(((t,e)=>t.point.x-e.point.x));const a=[],l=[];c.forEach((e=>{e.identifier===t.identifier?a.push(e):l.push(e)}));const u=a[0].point.x,y=[];let f=0;for(;f<l.length&&l[f].point.x<u;)y.length>0&&y[y.length-1]===l[f].identifier?y.pop():y.push(l[f].identifier),f++;if(y.push(t.identifier),"evenodd"===i){const e=y.length%2==0,n=y[y.length-2];return{identifier:t.identifier,isHole:e,for:n}}if("nonzero"===i){let n=!0,r=null,o=null;for(let t=0;t<y.length;t++){const i=y[t];n?(o=e[i].isCW,n=!1,r=i):o!==e[i].isCW&&(o=e[i].isCW,n=!0)}return{identifier:t.identifier,isHole:n,for:r}}console.warn('fill-rule: "'+i+'" is currently not implemented.')}(e,b,d,x,null===(n=t.userData)||void 0===n?void 0:n.style.fillRule)})),m=[];return b.forEach((t=>{if(!g[t.identifier].isHole){const e=new r.bnF;e.curves=t.curves;g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const n=b[t.identifier],o=new r.y$t;o.curves=n.curves,e.holes.push(o)})),m.push(e)}})),m}static getStrokeStyle(t,e,n,r,o){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:r=void 0!==r?r:"butt",strokeMiterLimit:o=void 0!==o?o:4}}static pointsToStroke(t,e,n,i){const s=[],c=[],a=[];if(0===o.pointsToStrokeWithBuffers(t,e,n,i,s,c,a))return null;const l=new r.u9r;return l.setAttribute("position",new r.a$l(s,3)),l.setAttribute("normal",new r.a$l(c,3)),l.setAttribute("uv",new r.a$l(a,2)),l}static pointsToStrokeWithBuffers(t,e,n,o,i,s,c,a){const l=new r.FM8,u=new r.FM8,y=new r.FM8,f=new r.FM8,h=new r.FM8,p=new r.FM8,d=new r.FM8,x=new r.FM8,b=new r.FM8,g=new r.FM8,m=new r.FM8,k=new r.FM8,w=new r.FM8,M=new r.FM8,v=new r.FM8,A=new r.FM8,T=new r.FM8;n=void 0!==n?n:12,o=void 0!==o?o:.001,a=void 0!==a?a:0;const P=(t=function(t){let e=!1;for(let r=1,i=t.length-1;r<i;r++)if(t[r].distanceTo(t[r+1])<o){e=!0;break}if(!e)return t;const n=[];n.push(t[0]);for(let r=1,i=t.length-1;r<i;r++)t[r].distanceTo(t[r+1])>=o&&n.push(t[r]);return n.push(t[t.length-1]),n}(t)).length;if(P<2)return 0;const C=t[0].equals(t[P-1]);let I,S,F=t[0];const N=e.strokeWidth/2,E=1/(P-1);let O,L,V,z,W=0,q=!1,G=0,D=3*a,B=2*a;H(t[0],t[1],l).multiplyScalar(N),x.copy(t[0]).sub(l),b.copy(t[0]).add(l),g.copy(x),m.copy(b);for(let r=1;r<P;r++){I=t[r],S=r===P-1?C?t[1]:void 0:t[r+1];const n=l;if(H(F,I,n),y.copy(n).multiplyScalar(N),k.copy(I).sub(y),w.copy(I).add(y),O=W+E,L=!1,void 0!==S){H(I,S,u),y.copy(u).multiplyScalar(N),M.copy(I).sub(y),v.copy(I).add(y),V=!0,y.subVectors(S,F),n.dot(y)<0&&(V=!1),1===r&&(q=V),y.subVectors(S,I),y.normalize();const t=Math.abs(n.dot(y));if(t>Number.EPSILON){const n=N/t;y.multiplyScalar(-n),f.subVectors(I,F),h.copy(f).setLength(n).add(y),A.copy(h).negate();const r=h.length(),o=f.length();f.divideScalar(o),p.subVectors(S,I);const i=p.length();switch(p.divideScalar(i),f.dot(A)<o&&p.dot(A)<i&&(L=!0),T.copy(h).add(I),A.add(I),z=!1,L?V?(v.copy(A),w.copy(A)):(M.copy(A),k.copy(A)):_(),e.strokeLineJoin){case"bevel":U(V,L,O);break;case"round":X(V,L),V?j(I,k,M,O,0):j(I,v,w,O,1);break;default:const t=N*e.strokeMiterLimit/r;if(t<1){if("miter-clip"!==e.strokeLineJoin){U(V,L,O);break}X(V,L),V?(p.subVectors(T,k).multiplyScalar(t).add(k),d.subVectors(T,M).multiplyScalar(t).add(M),R(k,O,0),R(p,O,0),R(I,O,.5),R(I,O,.5),R(p,O,0),R(d,O,0),R(I,O,.5),R(d,O,0),R(M,O,0)):(p.subVectors(T,w).multiplyScalar(t).add(w),d.subVectors(T,v).multiplyScalar(t).add(v),R(w,O,1),R(p,O,1),R(I,O,.5),R(I,O,.5),R(p,O,1),R(d,O,1),R(I,O,.5),R(d,O,1),R(v,O,1))}else L?(V?(R(b,W,1),R(x,W,0),R(T,O,0),R(b,W,1),R(T,O,0),R(A,O,1)):(R(b,W,1),R(x,W,0),R(T,O,1),R(x,W,0),R(A,O,0),R(T,O,1)),V?M.copy(T):v.copy(T)):V?(R(k,O,0),R(T,O,0),R(I,O,.5),R(I,O,.5),R(T,O,0),R(M,O,0)):(R(w,O,1),R(T,O,1),R(I,O,.5),R(I,O,.5),R(T,O,1),R(v,O,1)),z=!0}}else _()}else _();C||r!==P-1||$(t[0],g,m,V,!0,W),W=O,F=I,x.copy(M),b.copy(v)}if(C){if(L&&i){let t=T,e=A;q!==V&&(t=A,e=T),V?(z||q)&&(e.toArray(i,0),e.toArray(i,9),z&&t.toArray(i,3)):!z&&q||(e.toArray(i,3),e.toArray(i,9),z&&t.toArray(i,0))}}else $(I,k,w,V,!1,O);return G;function H(t,e,n){return n.subVectors(e,t),n.set(-n.y,n.x).normalize()}function R(t,e,n){i&&(i[D]=t.x,i[D+1]=t.y,i[D+2]=0,s&&(s[D]=0,s[D+1]=0,s[D+2]=1),D+=3,c&&(c[B]=e,c[B+1]=n,B+=2)),G+=3}function j(t,e,r,o,i){l.copy(e).sub(t).normalize(),u.copy(r).sub(t).normalize();let s=Math.PI;const c=l.dot(u);Math.abs(c)<1&&(s=Math.abs(Math.acos(c))),s/=n,y.copy(e);for(let a=0,l=n-1;a<l;a++)f.copy(y).rotateAround(t,s),R(y,o,i),R(f,o,i),R(t,o,.5),y.copy(f);R(f,o,i),R(r,o,i),R(t,o,.5)}function _(){R(b,W,1),R(x,W,0),R(k,O,0),R(b,W,1),R(k,O,1),R(w,O,0)}function U(t,e,n){e?t?(R(b,W,1),R(x,W,0),R(k,O,0),R(b,W,1),R(k,O,0),R(A,O,1),R(k,n,0),R(M,n,0),R(A,n,.5)):(R(b,W,1),R(x,W,0),R(w,O,1),R(x,W,0),R(A,O,0),R(w,O,1),R(w,n,1),R(v,n,0),R(A,n,.5)):t?(R(k,n,0),R(M,n,0),R(I,n,.5)):(R(w,n,1),R(v,n,0),R(I,n,.5))}function X(t,e){e&&(t?(R(b,W,1),R(x,W,0),R(k,O,0),R(b,W,1),R(k,O,0),R(A,O,1),R(k,W,0),R(I,O,.5),R(A,O,1),R(I,O,.5),R(M,W,0),R(A,O,1)):(R(b,W,1),R(x,W,0),R(w,O,1),R(x,W,0),R(A,O,0),R(w,O,1),R(w,W,1),R(A,O,0),R(I,O,.5),R(I,O,.5),R(A,O,0),R(v,W,1)))}function $(t,n,r,o,s,c){switch(e.strokeLineCap){case"round":s?j(t,r,n,c,.5):j(t,n,r,c,.5);break;case"square":if(s)l.subVectors(n,t),u.set(l.y,-l.x),y.addVectors(l,u).add(t),f.subVectors(u,l).add(t),o?(y.toArray(i,3),f.toArray(i,0),f.toArray(i,9)):(y.toArray(i,3),y.toArray(i,9),f.toArray(i,0));else{l.subVectors(r,t),u.set(l.y,-l.x),y.addVectors(l,u).add(t),f.subVectors(u,l).add(t);const e=i.length;o?(y.toArray(i,e-3),f.toArray(i,e-6),f.toArray(i,e-12)):(y.toArray(i,e-6),f.toArray(i,e-3),f.toArray(i,e-12))}}}}}var i=n(6721),s=n(3429);const c=new Map,a=new o,l=t=>(0,i.Ze)(c,t,(()=>new Promise(((e,n)=>{a.load(t,(t=>e(Object.freeze(t))),(0,s.C7)(t),n)}))))}}]);