@carandesign/drawui 0.1.0
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/README.md +73 -0
- package/dist/drawui.cjs.js +15 -0
- package/dist/drawui.css +1 -0
- package/dist/drawui.es.js +2242 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");var ae={exports:{}},V={};var Ae;function et(){if(Ae)return V;Ae=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,t,r){var i=null;if(r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),"key"in t){r={};for(var a in t)a!=="key"&&(r[a]=t[a])}else r=t;return t=r.ref,{$$typeof:o,type:s,key:i,ref:t!==void 0?t:null,props:r}}return V.Fragment=e,V.jsx=n,V.jsxs=n,V}var B={};var je;function tt(){return je||(je=1,process.env.NODE_ENV!=="production"&&(function(){function o(p){if(p==null)return null;if(typeof p=="function")return p.$$typeof===se?null:p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case b:return"Fragment";case _:return"Profiler";case v:return"StrictMode";case J:return"Suspense";case K:return"SuspenseList";case te:return"Activity"}if(typeof p=="object")switch(typeof p.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),p.$$typeof){case m:return"Portal";case q:return p.displayName||"Context";case D:return(p._context.displayName||"Context")+".Consumer";case Q:var w=p.render;return p=p.displayName,p||(p=w.displayName||w.name||"",p=p!==""?"ForwardRef("+p+")":"ForwardRef"),p;case ee:return w=p.displayName||null,w!==null?w:o(p.type)||"Memo";case j:w=p._payload,p=p._init;try{return o(p(w))}catch{}}return null}function e(p){return""+p}function n(p){try{e(p);var w=!1}catch{w=!0}if(w){w=console;var S=w.error,T=typeof Symbol=="function"&&Symbol.toStringTag&&p[Symbol.toStringTag]||p.constructor.name||"Object";return S.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),e(p)}}function s(p){if(p===b)return"<>";if(typeof p=="object"&&p!==null&&p.$$typeof===j)return"<...>";try{var w=o(p);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function t(){var p=R.A;return p===null?null:p.getOwner()}function r(){return Error("react-stack-top-frame")}function i(p){if(P.call(p,"key")){var w=Object.getOwnPropertyDescriptor(p,"key").get;if(w&&w.isReactWarning)return!1}return p.key!==void 0}function a(p,w){function S(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}S.isReactWarning=!0,Object.defineProperty(p,"key",{get:S,configurable:!0})}function u(){var p=o(this.type);return W[p]||(W[p]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),p=this.props.ref,p!==void 0?p:null}function l(p,w,S,T,oe,ve){var E=S.ref;return p={$$typeof:g,type:p,key:w,props:S,_owner:T},(E!==void 0?E:null)!==null?Object.defineProperty(p,"ref",{enumerable:!1,get:u}):Object.defineProperty(p,"ref",{enumerable:!1,value:null}),p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(p,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(p,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.defineProperty(p,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ve}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p}function c(p,w,S,T,oe,ve){var E=w.children;if(E!==void 0)if(T)if(A(E)){for(T=0;T<E.length;T++)h(E[T]);Object.freeze&&Object.freeze(E)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(E);if(P.call(w,"key")){E=o(p);var F=Object.keys(w).filter(function(Ke){return Ke!=="key"});T=0<F.length?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}",G[E+T]||(F=0<F.length?"{"+F.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,T,E,F,E),G[E+T]=!0)}if(E=null,S!==void 0&&(n(S),E=""+S),i(w)&&(n(w.key),E=""+w.key),"key"in w){S={};for(var we in w)we!=="key"&&(S[we]=w[we])}else S=w;return E&&a(S,typeof p=="function"?p.displayName||p.name||"Unknown":p),l(p,E,S,t(),oe,ve)}function h(p){f(p)?p._store&&(p._store.validated=1):typeof p=="object"&&p!==null&&p.$$typeof===j&&(p._payload.status==="fulfilled"?f(p._payload.value)&&p._payload.value._store&&(p._payload.value._store.validated=1):p._store&&(p._store.validated=1))}function f(p){return typeof p=="object"&&p!==null&&p.$$typeof===g}var d=y,g=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),q=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),R=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,A=Array.isArray,z=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(p){return p()}};var $,W={},ne=d.react_stack_bottom_frame.bind(d,r)(),re=z(s(r)),G={};B.Fragment=b,B.jsx=function(p,w,S){var T=1e4>R.recentlyCreatedOwnerStacks++;return c(p,w,S,!1,T?Error("react-stack-top-frame"):ne,T?z(s(p)):re)},B.jsxs=function(p,w,S){var T=1e4>R.recentlyCreatedOwnerStacks++;return c(p,w,S,!0,T?Error("react-stack-top-frame"):ne,T?z(s(p)):re)}})()),B}var $e;function st(){return $e||($e=1,process.env.NODE_ENV==="production"?ae.exports=et():ae.exports=tt()),ae.exports}var M=st();function Se(o,e,n){if(o&&o.length){const[s,t]=e,r=Math.PI/180*n,i=Math.cos(r),a=Math.sin(r);for(const u of o){const[l,c]=u;u[0]=(l-s)*i-(c-t)*a+s,u[1]=(l-s)*a+(c-t)*i+t}}}function nt(o,e,n){const s=[];o.forEach(t=>s.push(...t)),Se(s,e,n)}function rt(o,e){return o[0]===e[0]&&o[1]===e[1]}function ot(o,e,n,s=1){const t=n,r=Math.max(e,.1),i=o[0]&&o[0][0]&&typeof o[0][0]=="number"?[o]:o,a=[0,0];if(t)for(const l of i)Se(l,a,t);const u=at(i,r,s);if(t){for(const l of i)Se(l,a,-t);nt(u,a,-t)}return u}function at(o,e,n){const s=[];for(const l of o){const c=[...l];rt(c[0],c[c.length-1])||c.push([c[0][0],c[0][1]]),c.length>2&&s.push(c)}const t=[];e=Math.max(e,.1);const r=[];for(const l of s)for(let c=0;c<l.length-1;c++){const h=l[c],f=l[c+1];if(h[1]!==f[1]){const d=Math.min(h[1],f[1]);r.push({ymin:d,ymax:Math.max(h[1],f[1]),x:d===h[1]?h[0]:f[0],islope:(f[0]-h[0])/(f[1]-h[1])})}}if(r.sort((l,c)=>l.ymin<c.ymin?-1:l.ymin>c.ymin?1:l.x<c.x?-1:l.x>c.x?1:l.ymax===c.ymax?0:(l.ymax-c.ymax)/Math.abs(l.ymax-c.ymax)),!r.length)return t;let i=[],a=r[0].ymin,u=0;for(;i.length||r.length;){if(r.length){let l=-1;for(let h=0;h<r.length&&!(r[h].ymin>a);h++)l=h;r.splice(0,l+1).forEach(h=>{i.push({s:a,edge:h})})}if(i=i.filter(l=>!(l.edge.ymax<=a)),i.sort((l,c)=>l.edge.x===c.edge.x?0:(l.edge.x-c.edge.x)/Math.abs(l.edge.x-c.edge.x)),(n!==1||u%e===0)&&i.length>1)for(let l=0;l<i.length;l=l+2){const c=l+1;if(c>=i.length)break;const h=i[l].edge,f=i[c].edge;t.push([[Math.round(h.x),a],[Math.round(f.x),a]])}a+=n,i.forEach(l=>{l.edge.x=l.edge.x+n*l.edge.islope}),u++}return t}function U(o,e){var n;const s=e.hachureAngle+90;let t=e.hachureGap;t<0&&(t=e.strokeWidth*4),t=Math.round(Math.max(t,.1));let r=1;return e.roughness>=1&&(((n=e.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(r=t),ot(o,t,s,r||1)}class Ce{constructor(e){this.helper=e}fillPolygons(e,n){return this._fillPolygons(e,n)}_fillPolygons(e,n){const s=U(e,n);return{type:"fillSketch",ops:this.renderLines(s,n)}}renderLines(e,n){const s=[];for(const t of e)s.push(...this.helper.doubleLineOps(t[0][0],t[0][1],t[1][0],t[1][1],n));return s}}function be(o){const e=o[0],n=o[1];return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2))}class it extends Ce{fillPolygons(e,n){let s=n.hachureGap;s<0&&(s=n.strokeWidth*4),s=Math.max(s,.1);const t=Object.assign({},n,{hachureGap:s}),r=U(e,t),i=Math.PI/180*n.hachureAngle,a=[],u=s*.5*Math.cos(i),l=s*.5*Math.sin(i);for(const[h,f]of r)be([h,f])&&a.push([[h[0]-u,h[1]+l],[...f]],[[h[0]+u,h[1]-l],[...f]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}}class ct extends Ce{fillPolygons(e,n){const s=this._fillPolygons(e,n),t=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),r=this._fillPolygons(e,t);return s.ops=s.ops.concat(r.ops),s}}class ut{constructor(e){this.helper=e}fillPolygons(e,n){n=Object.assign({},n,{hachureAngle:0});const s=U(e,n);return this.dotsOnLines(s,n)}dotsOnLines(e,n){const s=[];let t=n.hachureGap;t<0&&(t=n.strokeWidth*4),t=Math.max(t,.1);let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);const i=t/4;for(const a of e){const u=be(a),l=u/t,c=Math.ceil(l)-1,h=u-c*t,f=(a[0][0]+a[1][0])/2-t/4,d=Math.min(a[0][1],a[1][1]);for(let g=0;g<c;g++){const m=d+h+g*t,b=f-i+Math.random()*2*i,v=m-i+Math.random()*2*i,_=this.helper.ellipse(b,v,r,r,n);s.push(..._.ops)}}return{type:"fillSketch",ops:s}}}class lt{constructor(e){this.helper=e}fillPolygons(e,n){const s=U(e,n);return{type:"fillSketch",ops:this.dashedLine(s,n)}}dashedLine(e,n){const s=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,t=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,r=[];return e.forEach(i=>{const a=be(i),u=Math.floor(a/(s+t)),l=(a+t-u*(s+t))/2;let c=i[0],h=i[1];c[0]>h[0]&&(c=i[1],h=i[0]);const f=Math.atan((h[1]-c[1])/(h[0]-c[0]));for(let d=0;d<u;d++){const g=d*(s+t),m=g+s,b=[c[0]+g*Math.cos(f)+l*Math.cos(f),c[1]+g*Math.sin(f)+l*Math.sin(f)],v=[c[0]+m*Math.cos(f)+l*Math.cos(f),c[1]+m*Math.sin(f)+l*Math.sin(f)];r.push(...this.helper.doubleLineOps(b[0],b[1],v[0],v[1],n))}}),r}}class ht{constructor(e){this.helper=e}fillPolygons(e,n){const s=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,t=n.zigzagOffset<0?s:n.zigzagOffset;n=Object.assign({},n,{hachureGap:s+t});const r=U(e,n);return{type:"fillSketch",ops:this.zigzagLines(r,t,n)}}zigzagLines(e,n,s){const t=[];return e.forEach(r=>{const i=be(r),a=Math.round(i/(2*n));let u=r[0],l=r[1];u[0]>l[0]&&(u=r[1],l=r[0]);const c=Math.atan((l[1]-u[1])/(l[0]-u[0]));for(let h=0;h<a;h++){const f=h*2*n,d=(h+1)*2*n,g=Math.sqrt(2*Math.pow(n,2)),m=[u[0]+f*Math.cos(c),u[1]+f*Math.sin(c)],b=[u[0]+d*Math.cos(c),u[1]+d*Math.sin(c)],v=[m[0]+g*Math.cos(c+Math.PI/4),m[1]+g*Math.sin(c+Math.PI/4)];t.push(...this.helper.doubleLineOps(m[0],m[1],v[0],v[1],s),...this.helper.doubleLineOps(v[0],v[1],b[0],b[1],s))}}),t}}const x={};function ft(o,e){let n=o.fillStyle||"hachure";if(!x[n])switch(n){case"zigzag":x[n]||(x[n]=new it(e));break;case"cross-hatch":x[n]||(x[n]=new ct(e));break;case"dots":x[n]||(x[n]=new ut(e));break;case"dashed":x[n]||(x[n]=new lt(e));break;case"zigzag-line":x[n]||(x[n]=new ht(e));break;default:n="hachure",x[n]||(x[n]=new Ce(e));break}return x[n]}function dt(){return Math.floor(Math.random()*2**31)}class pt{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const gt=0,Pe=1,Ve=2,ie={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function mt(o){const e=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:gt,text:RegExp.$1},o=o.substr(RegExp.$1.length);else if(o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))e[e.length]={type:Pe,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length);else return[];return e[e.length]={type:Ve,text:""},e}function Me(o,e){return o.type===e}function Le(o){const e=[],n=mt(o);let s="BOD",t=0,r=n[t];for(;!Me(r,Ve);){let i=0;const a=[];if(s==="BOD")if(r.text==="M"||r.text==="m")t++,i=ie[r.text],s=r.text;else return Le("M0,0"+o);else Me(r,Pe)?i=ie[s]:(t++,i=ie[r.text],s=r.text);if(t+i<n.length){for(let u=t;u<t+i;u++){const l=n[u];if(Me(l,Pe))a[a.length]=+l.text;else throw new Error("Param not a number: "+s+","+l.text)}if(typeof ie[s]=="number"){const u={key:s,data:a};e.push(u),t+=i,r=n[t],s==="M"&&(s="L"),s==="m"&&(s="l")}else throw new Error("Bad segment: "+s)}else throw new Error("Path data ended short")}return e}function Be(o){let e=0,n=0,s=0,t=0;const r=[];for(const{key:i,data:a}of o)switch(i){case"M":r.push({key:"M",data:[...a]}),[e,n]=a,[s,t]=a;break;case"m":e+=a[0],n+=a[1],r.push({key:"M",data:[e,n]}),s=e,t=n;break;case"L":r.push({key:"L",data:[...a]}),[e,n]=a;break;case"l":e+=a[0],n+=a[1],r.push({key:"L",data:[e,n]});break;case"C":r.push({key:"C",data:[...a]}),e=a[4],n=a[5];break;case"c":{const u=a.map((l,c)=>c%2?l+n:l+e);r.push({key:"C",data:u}),e=u[4],n=u[5];break}case"Q":r.push({key:"Q",data:[...a]}),e=a[2],n=a[3];break;case"q":{const u=a.map((l,c)=>c%2?l+n:l+e);r.push({key:"Q",data:u}),e=u[2],n=u[3];break}case"A":r.push({key:"A",data:[...a]}),e=a[5],n=a[6];break;case"a":e+=a[5],n+=a[6],r.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],e,n]});break;case"H":r.push({key:"H",data:[...a]}),e=a[0];break;case"h":e+=a[0],r.push({key:"H",data:[e]});break;case"V":r.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],r.push({key:"V",data:[n]});break;case"S":r.push({key:"S",data:[...a]}),e=a[2],n=a[3];break;case"s":{const u=a.map((l,c)=>c%2?l+n:l+e);r.push({key:"S",data:u}),e=u[2],n=u[3];break}case"T":r.push({key:"T",data:[...a]}),e=a[0],n=a[1];break;case"t":e+=a[0],n+=a[1],r.push({key:"T",data:[e,n]});break;case"Z":case"z":r.push({key:"Z",data:[]}),e=s,n=t;break}return r}function Ye(o){const e=[];let n="",s=0,t=0,r=0,i=0,a=0,u=0;for(const{key:l,data:c}of o){switch(l){case"M":e.push({key:"M",data:[...c]}),[s,t]=c,[r,i]=c;break;case"C":e.push({key:"C",data:[...c]}),s=c[4],t=c[5],a=c[2],u=c[3];break;case"L":e.push({key:"L",data:[...c]}),[s,t]=c;break;case"H":s=c[0],e.push({key:"L",data:[s,t]});break;case"V":t=c[0],e.push({key:"L",data:[s,t]});break;case"S":{let h=0,f=0;n==="C"||n==="S"?(h=s+(s-a),f=t+(t-u)):(h=s,f=t),e.push({key:"C",data:[h,f,...c]}),a=c[0],u=c[1],s=c[2],t=c[3];break}case"T":{const[h,f]=c;let d=0,g=0;n==="Q"||n==="T"?(d=s+(s-a),g=t+(t-u)):(d=s,g=t);const m=s+2*(d-s)/3,b=t+2*(g-t)/3,v=h+2*(d-h)/3,_=f+2*(g-f)/3;e.push({key:"C",data:[m,b,v,_,h,f]}),a=d,u=g,s=h,t=f;break}case"Q":{const[h,f,d,g]=c,m=s+2*(h-s)/3,b=t+2*(f-t)/3,v=d+2*(h-d)/3,_=g+2*(f-g)/3;e.push({key:"C",data:[m,b,v,_,d,g]}),a=h,u=f,s=d,t=g;break}case"A":{const h=Math.abs(c[0]),f=Math.abs(c[1]),d=c[2],g=c[3],m=c[4],b=c[5],v=c[6];h===0||f===0?(e.push({key:"C",data:[s,t,b,v,b,v]}),s=b,t=v):(s!==b||t!==v)&&(Ze(s,t,b,v,h,f,d,g,m).forEach(function(D){e.push({key:"C",data:D})}),s=b,t=v);break}case"Z":e.push({key:"Z",data:[]}),s=r,t=i;break}n=l}return e}function kt(o){return Math.PI*o/180}function Y(o,e,n){const s=o*Math.cos(n)-e*Math.sin(n),t=o*Math.sin(n)+e*Math.cos(n);return[s,t]}function Ze(o,e,n,s,t,r,i,a,u,l){const c=kt(i);let h=[],f=0,d=0,g=0,m=0;if(l)[f,d,g,m]=l;else{[o,e]=Y(o,e,-c),[n,s]=Y(n,s,-c);const R=(o-n)/2,P=(e-s)/2;let A=R*R/(t*t)+P*P/(r*r);A>1&&(A=Math.sqrt(A),t=A*t,r=A*r);const z=a===u?-1:1,$=t*t,W=r*r,ne=$*W-$*P*P-W*R*R,re=$*P*P+W*R*R,G=z*Math.sqrt(Math.abs(ne/re));g=G*t*P/r+(o+n)/2,m=G*-r*R/t+(e+s)/2,f=Math.asin(parseFloat(((e-m)/r).toFixed(9))),d=Math.asin(parseFloat(((s-m)/r).toFixed(9))),o<g&&(f=Math.PI-f),n<g&&(d=Math.PI-d),f<0&&(f=Math.PI*2+f),d<0&&(d=Math.PI*2+d),u&&f>d&&(f=f-Math.PI*2),!u&&d>f&&(d=d-Math.PI*2)}let b=d-f;if(Math.abs(b)>Math.PI*120/180){const R=d,P=n,A=s;u&&d>f?d=f+Math.PI*120/180*1:d=f+Math.PI*120/180*-1,n=g+t*Math.cos(d),s=m+r*Math.sin(d),h=Ze(n,s,P,A,t,r,i,0,u,[d,R,g,m])}b=d-f;const v=Math.cos(f),_=Math.sin(f),D=Math.cos(d),q=Math.sin(d),Q=Math.tan(b/4),J=4/3*t*Q,K=4/3*r*Q,ee=[o,e],j=[o+J*_,e-K*v],te=[n+J*q,s-K*D],se=[n,s];if(j[0]=2*ee[0]-j[0],j[1]=2*ee[1]-j[1],l)return[j,te,se].concat(h);{h=[j,te,se].concat(h);const R=[];for(let P=0;P<h.length;P+=3){const A=Y(h[P][0],h[P][1],c),z=Y(h[P+1][0],h[P+1][1],c),$=Y(h[P+2][0],h[P+2][1],c);R.push([A[0],A[1],z[0],z[1],$[0],$[1]])}return R}}const bt={randOffset:_t,randOffsetWithRange:St,ellipse:Mt,doubleLineOps:Pt};function Ue(o,e,n,s,t){return{type:"path",ops:I(o,e,n,s,t)}}function he(o,e,n){const s=(o||[]).length;if(s>2){const t=[];for(let r=0;r<s-1;r++)t.push(...I(o[r][0],o[r][1],o[r+1][0],o[r+1][1],n));return e&&t.push(...I(o[s-1][0],o[s-1][1],o[0][0],o[0][1],n)),{type:"path",ops:t}}else if(s===2)return Ue(o[0][0],o[0][1],o[1][0],o[1][1],n);return{type:"path",ops:[]}}function vt(o,e){return he(o,!0,e)}function wt(o,e,n,s,t){const r=[[o,e],[o+n,e],[o+n,e+s],[o,e+s]];return vt(r,t)}function De(o,e){if(o.length){const s=typeof o[0][0]=="number"?[o]:o,t=ce(s[0],1*(1+e.roughness*.2),e),r=e.disableMultiStroke?[]:ce(s[0],1.5*(1+e.roughness*.22),Ne(e));for(let i=1;i<s.length;i++){const a=s[i];if(a.length){const u=ce(a,1*(1+e.roughness*.2),e),l=e.disableMultiStroke?[]:ce(a,1.5*(1+e.roughness*.22),Ne(e));for(const c of u)c.op!=="move"&&t.push(c);for(const c of l)c.op!=="move"&&r.push(c)}}return{type:"path",ops:t.concat(r)}}return{type:"path",ops:[]}}function Mt(o,e,n,s,t){const r=Xe(n,s,t);return Te(o,e,t,r).opset}function Xe(o,e,n){const s=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(o/2,2)+Math.pow(e/2,2))/2)),t=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*s)),r=Math.PI*2/t;let i=Math.abs(o/2),a=Math.abs(e/2);const u=1-n.curveFitting;return i+=k(i*u,n),a+=k(a*u,n),{increment:r,rx:i,ry:a}}function Te(o,e,n,s){const[t,r]=We(s.increment,o,e,s.rx,s.ry,1,s.increment*pe(.1,pe(.4,1,n),n),n);let i=ge(t,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[a]=We(s.increment,o,e,s.rx,s.ry,1.5,0,n),u=ge(a,null,n);i=i.concat(u)}return{estimatedPoints:r,opset:{type:"path",ops:i}}}function ze(o,e,n,s,t,r,i,a,u){const l=o,c=e;let h=Math.abs(n/2),f=Math.abs(s/2);h+=k(h*.01,u),f+=k(f*.01,u);let d=t,g=r;for(;d<0;)d+=Math.PI*2,g+=Math.PI*2;g-d>Math.PI*2&&(d=0,g=Math.PI*2);const m=Math.PI*2/u.curveStepCount,b=Math.min(m/2,(g-d)/2),v=Fe(b,l,c,h,f,d,g,1,u);if(!u.disableMultiStroke){const _=Fe(b,l,c,h,f,d,g,1.5,u);v.push(..._)}return i&&(a?v.push(...I(l,c,l+h*Math.cos(d),c+f*Math.sin(d),u),...I(l,c,l+h*Math.cos(g),c+f*Math.sin(g),u)):v.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+h*Math.cos(d),c+f*Math.sin(d)]})),{type:"path",ops:v}}function Ie(o,e){const n=Ye(Be(Le(o))),s=[];let t=[0,0],r=[0,0];for(const{key:i,data:a}of n)switch(i){case"M":{r=[a[0],a[1]],t=[a[0],a[1]];break}case"L":s.push(...I(r[0],r[1],a[0],a[1],e)),r=[a[0],a[1]];break;case"C":{const[u,l,c,h,f,d]=a;s.push(...Tt(u,l,c,h,f,d,r,e)),r=[f,d];break}case"Z":s.push(...I(r[0],r[1],t[0],t[1],e)),r=[t[0],t[1]];break}return{type:"path",ops:s}}function ye(o,e){const n=[];for(const s of o)if(s.length){const t=e.maxRandomnessOffset||0,r=s.length;if(r>2){n.push({op:"move",data:[s[0][0]+k(t,e),s[0][1]+k(t,e)]});for(let i=1;i<r;i++)n.push({op:"lineTo",data:[s[i][0]+k(t,e),s[i][1]+k(t,e)]})}}return{type:"fillPath",ops:n}}function H(o,e){return ft(e,bt).fillPolygons(o,e)}function yt(o,e,n,s,t,r,i){const a=o,u=e;let l=Math.abs(n/2),c=Math.abs(s/2);l+=k(l*.01,i),c+=k(c*.01,i);let h=t,f=r;for(;h<0;)h+=Math.PI*2,f+=Math.PI*2;f-h>Math.PI*2&&(h=0,f=Math.PI*2);const d=(f-h)/i.curveStepCount,g=[];for(let m=h;m<=f;m=m+d)g.push([a+l*Math.cos(m),u+c*Math.sin(m)]);return g.push([a+l*Math.cos(f),u+c*Math.sin(f)]),g.push([a,u]),H([g],i)}function _t(o,e){return k(o,e)}function St(o,e,n){return pe(o,e,n)}function Pt(o,e,n,s,t){return I(o,e,n,s,t,!0)}function Ne(o){const e=Object.assign({},o);return e.randomizer=void 0,o.seed&&(e.seed=o.seed+1),e}function Qe(o){return o.randomizer||(o.randomizer=new pt(o.seed||0)),o.randomizer.next()}function pe(o,e,n,s=1){return n.roughness*s*(Qe(n)*(e-o)+o)}function k(o,e,n=1){return pe(-o,o,e,n)}function I(o,e,n,s,t,r=!1){const i=r?t.disableMultiStrokeFill:t.disableMultiStroke,a=Ee(o,e,n,s,t,!0,!1);if(i)return a;const u=Ee(o,e,n,s,t,!0,!0);return a.concat(u)}function Ee(o,e,n,s,t,r,i){const a=Math.pow(o-n,2)+Math.pow(e-s,2),u=Math.sqrt(a);let l=1;u<200?l=1:u>500?l=.4:l=-.0016668*u+1.233334;let c=t.maxRandomnessOffset||0;c*c*100>a&&(c=u/10);const h=c/2,f=.2+Qe(t)*.2;let d=t.bowing*t.maxRandomnessOffset*(s-e)/200,g=t.bowing*t.maxRandomnessOffset*(o-n)/200;d=k(d,t,l),g=k(g,t,l);const m=[],b=()=>k(h,t,l),v=()=>k(c,t,l),_=t.preserveVertices;return i?m.push({op:"move",data:[o+(_?0:b()),e+(_?0:b())]}):m.push({op:"move",data:[o+(_?0:k(c,t,l)),e+(_?0:k(c,t,l))]}),i?m.push({op:"bcurveTo",data:[d+o+(n-o)*f+b(),g+e+(s-e)*f+b(),d+o+2*(n-o)*f+b(),g+e+2*(s-e)*f+b(),n+(_?0:b()),s+(_?0:b())]}):m.push({op:"bcurveTo",data:[d+o+(n-o)*f+v(),g+e+(s-e)*f+v(),d+o+2*(n-o)*f+v(),g+e+2*(s-e)*f+v(),n+(_?0:v()),s+(_?0:v())]}),m}function ce(o,e,n){if(!o.length)return[];const s=[];s.push([o[0][0]+k(e,n),o[0][1]+k(e,n)]),s.push([o[0][0]+k(e,n),o[0][1]+k(e,n)]);for(let t=1;t<o.length;t++)s.push([o[t][0]+k(e,n),o[t][1]+k(e,n)]),t===o.length-1&&s.push([o[t][0]+k(e,n),o[t][1]+k(e,n)]);return ge(s,null,n)}function ge(o,e,n){const s=o.length,t=[];if(s>3){const r=[],i=1-n.curveTightness;t.push({op:"move",data:[o[1][0],o[1][1]]});for(let a=1;a+2<s;a++){const u=o[a];r[0]=[u[0],u[1]],r[1]=[u[0]+(i*o[a+1][0]-i*o[a-1][0])/6,u[1]+(i*o[a+1][1]-i*o[a-1][1])/6],r[2]=[o[a+1][0]+(i*o[a][0]-i*o[a+2][0])/6,o[a+1][1]+(i*o[a][1]-i*o[a+2][1])/6],r[3]=[o[a+1][0],o[a+1][1]],t.push({op:"bcurveTo",data:[r[1][0],r[1][1],r[2][0],r[2][1],r[3][0],r[3][1]]})}}else s===3?(t.push({op:"move",data:[o[1][0],o[1][1]]}),t.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[2][0],o[2][1]]})):s===2&&t.push(...Ee(o[0][0],o[0][1],o[1][0],o[1][1],n,!0,!0));return t}function We(o,e,n,s,t,r,i,a){const u=a.roughness===0,l=[],c=[];if(u){o=o/4,c.push([e+s*Math.cos(-o),n+t*Math.sin(-o)]);for(let h=0;h<=Math.PI*2;h=h+o){const f=[e+s*Math.cos(h),n+t*Math.sin(h)];l.push(f),c.push(f)}c.push([e+s*Math.cos(0),n+t*Math.sin(0)]),c.push([e+s*Math.cos(o),n+t*Math.sin(o)])}else{const h=k(.5,a)-Math.PI/2;c.push([k(r,a)+e+.9*s*Math.cos(h-o),k(r,a)+n+.9*t*Math.sin(h-o)]);const f=Math.PI*2+h-.01;for(let d=h;d<f;d=d+o){const g=[k(r,a)+e+s*Math.cos(d),k(r,a)+n+t*Math.sin(d)];l.push(g),c.push(g)}c.push([k(r,a)+e+s*Math.cos(h+Math.PI*2+i*.5),k(r,a)+n+t*Math.sin(h+Math.PI*2+i*.5)]),c.push([k(r,a)+e+.98*s*Math.cos(h+i),k(r,a)+n+.98*t*Math.sin(h+i)]),c.push([k(r,a)+e+.9*s*Math.cos(h+i*.5),k(r,a)+n+.9*t*Math.sin(h+i*.5)])}return[c,l]}function Fe(o,e,n,s,t,r,i,a,u){const l=r+k(.1,u),c=[];c.push([k(a,u)+e+.9*s*Math.cos(l-o),k(a,u)+n+.9*t*Math.sin(l-o)]);for(let h=l;h<=i;h=h+o)c.push([k(a,u)+e+s*Math.cos(h),k(a,u)+n+t*Math.sin(h)]);return c.push([e+s*Math.cos(i),n+t*Math.sin(i)]),c.push([e+s*Math.cos(i),n+t*Math.sin(i)]),ge(c,null,u)}function Tt(o,e,n,s,t,r,i,a){const u=[],l=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let c=[0,0];const h=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let d=0;d<h;d++)d===0?u.push({op:"move",data:[i[0],i[1]]}):u.push({op:"move",data:[i[0]+(f?0:k(l[0],a)),i[1]+(f?0:k(l[0],a))]}),c=f?[t,r]:[t+k(l[d],a),r+k(l[d],a)],u.push({op:"bcurveTo",data:[o+k(l[d],a),e+k(l[d],a),n+k(l[d],a),s+k(l[d],a),c[0],c[1]]});return u}function Z(o){return[...o]}function He(o,e=0){const n=o.length;if(n<3)throw new Error("A curve must have at least three points.");const s=[];if(n===3)s.push(Z(o[0]),Z(o[1]),Z(o[2]),Z(o[2]));else{const t=[];t.push(o[0],o[0]);for(let a=1;a<o.length;a++)t.push(o[a]),a===o.length-1&&t.push(o[a]);const r=[],i=1-e;s.push(Z(t[0]));for(let a=1;a+2<t.length;a++){const u=t[a];r[0]=[u[0],u[1]],r[1]=[u[0]+(i*t[a+1][0]-i*t[a-1][0])/6,u[1]+(i*t[a+1][1]-i*t[a-1][1])/6],r[2]=[t[a+1][0]+(i*t[a][0]-i*t[a+2][0])/6,t[a+1][1]+(i*t[a][1]-i*t[a+2][1])/6],r[3]=[t[a+1][0],t[a+1][1]],s.push(r[1],r[2],r[3])}}return s}function Et(o,e){return Math.sqrt(fe(o,e))}function fe(o,e){return Math.pow(o[0]-e[0],2)+Math.pow(o[1]-e[1],2)}function Rt(o,e,n){const s=fe(e,n);if(s===0)return fe(o,e);let t=((o[0]-e[0])*(n[0]-e[0])+(o[1]-e[1])*(n[1]-e[1]))/s;return t=Math.max(0,Math.min(1,t)),fe(o,N(e,n,t))}function N(o,e,n){return[o[0]+(e[0]-o[0])*n,o[1]+(e[1]-o[1])*n]}function xt(o,e){const n=o[e+0],s=o[e+1],t=o[e+2],r=o[e+3];let i=3*s[0]-2*n[0]-r[0];i*=i;let a=3*s[1]-2*n[1]-r[1];a*=a;let u=3*t[0]-2*r[0]-n[0];u*=u;let l=3*t[1]-2*r[1]-n[1];return l*=l,i<u&&(i=u),a<l&&(a=l),i+a}function Re(o,e,n,s){const t=s||[];if(xt(o,e)<n){const r=o[e+0];t.length?Et(t[t.length-1],r)>1&&t.push(r):t.push(r),t.push(o[e+3])}else{const i=o[e+0],a=o[e+1],u=o[e+2],l=o[e+3],c=N(i,a,.5),h=N(a,u,.5),f=N(u,l,.5),d=N(c,h,.5),g=N(h,f,.5),m=N(d,g,.5);Re([i,c,d,m],0,n,t),Re([m,g,f,l],0,n,t)}return t}function Ot(o,e){return me(o,0,o.length,e)}function me(o,e,n,s,t){const r=t||[],i=o[e],a=o[n-1];let u=0,l=1;for(let c=e+1;c<n-1;++c){const h=Rt(o[c],i,a);h>u&&(u=h,l=c)}return Math.sqrt(u)>s?(me(o,e,l+1,s,r),me(o,l,n,s,r)):(r.length||r.push(i),r.push(a)),r}function xe(o,e=.15,n){const s=[],t=(o.length-1)/3;for(let r=0;r<t;r++){const i=r*3;Re(o,i,e,s)}return n&&n>0?me(s,0,s.length,n):s}function Ct(o,e,n){const s=Le(o),t=Ye(Be(s)),r=[];let i=[],a=[0,0],u=[];const l=()=>{u.length>=4&&i.push(...xe(u,e)),u=[]},c=()=>{l(),i.length&&(r.push(i),i=[])};for(const{key:f,data:d}of t)switch(f){case"M":c(),a=[d[0],d[1]],i.push(a);break;case"L":l(),i.push([d[0],d[1]]);break;case"C":if(!u.length){const g=i.length?i[i.length-1]:a;u.push([g[0],g[1]])}u.push([d[0],d[1]]),u.push([d[2],d[3]]),u.push([d[4],d[5]]);break;case"Z":l(),i.push([a[0],a[1]]);break}if(c(),!n)return r;const h=[];for(const f of r){const d=Ot(f,n);d.length&&h.push(d)}return h}const C="none";class ke{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return dt()}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,n,s){return{shape:e,sets:n||[],options:s||this.defaultOptions}}line(e,n,s,t,r){const i=this._o(r);return this._d("line",[Ue(e,n,s,t,i)],i)}rectangle(e,n,s,t,r){const i=this._o(r),a=[],u=wt(e,n,s,t,i);if(i.fill){const l=[[e,n],[e+s,n],[e+s,n+t],[e,n+t]];i.fillStyle==="solid"?a.push(ye([l],i)):a.push(H([l],i))}return i.stroke!==C&&a.push(u),this._d("rectangle",a,i)}ellipse(e,n,s,t,r){const i=this._o(r),a=[],u=Xe(s,t,i),l=Te(e,n,i,u);if(i.fill)if(i.fillStyle==="solid"){const c=Te(e,n,i,u).opset;c.type="fillPath",a.push(c)}else a.push(H([l.estimatedPoints],i));return i.stroke!==C&&a.push(l.opset),this._d("ellipse",a,i)}circle(e,n,s,t){const r=this.ellipse(e,n,s,s,t);return r.shape="circle",r}linearPath(e,n){const s=this._o(n);return this._d("linearPath",[he(e,!1,s)],s)}arc(e,n,s,t,r,i,a=!1,u){const l=this._o(u),c=[],h=ze(e,n,s,t,r,i,a,!0,l);if(a&&l.fill)if(l.fillStyle==="solid"){const f=Object.assign({},l);f.disableMultiStroke=!0;const d=ze(e,n,s,t,r,i,!0,!1,f);d.type="fillPath",c.push(d)}else c.push(yt(e,n,s,t,r,i,l));return l.stroke!==C&&c.push(h),this._d("arc",c,l)}curve(e,n){const s=this._o(n),t=[],r=De(e,s);if(s.fill&&s.fill!==C)if(s.fillStyle==="solid"){const i=De(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));t.push({type:"fillPath",ops:this._mergedShape(i.ops)})}else{const i=[],a=e;if(a.length){const l=typeof a[0][0]=="number"?[a]:a;for(const c of l)c.length<3?i.push(...c):c.length===3?i.push(...xe(He([c[0],c[0],c[1],c[2]]),10,(1+s.roughness)/2)):i.push(...xe(He(c),10,(1+s.roughness)/2))}i.length&&t.push(H([i],s))}return s.stroke!==C&&t.push(r),this._d("curve",t,s)}polygon(e,n){const s=this._o(n),t=[],r=he(e,!0,s);return s.fill&&(s.fillStyle==="solid"?t.push(ye([e],s)):t.push(H([e],s))),s.stroke!==C&&t.push(r),this._d("polygon",t,s)}path(e,n){const s=this._o(n),t=[];if(!e)return this._d("path",t,s);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const r=s.fill&&s.fill!=="transparent"&&s.fill!==C,i=s.stroke!==C,a=!!(s.simplification&&s.simplification<1),u=a?4-4*(s.simplification||1):(1+s.roughness)/2,l=Ct(e,1,u),c=Ie(e,s);if(r)if(s.fillStyle==="solid")if(l.length===1){const h=Ie(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));t.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else t.push(ye(l,s));else t.push(H(l,s));return i&&(a?l.forEach(h=>{t.push(he(h,!1,s))}):t.push(c)),this._d("path",t,s)}opsToPath(e,n){let s="";for(const t of e.ops){const r=typeof n=="number"&&n>=0?t.data.map(i=>+i.toFixed(n)):t.data;switch(t.op){case"move":s+=`M${r[0]} ${r[1]} `;break;case"bcurveTo":s+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `;break;case"lineTo":s+=`L${r[0]} ${r[1]} `;break}}return s.trim()}toPaths(e){const n=e.sets||[],s=e.options||this.defaultOptions,t=[];for(const r of n){let i=null;switch(r.type){case"path":i={d:this.opsToPath(r),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:C};break;case"fillPath":i={d:this.opsToPath(r),stroke:C,strokeWidth:0,fill:s.fill||C};break;case"fillSketch":i=this.fillSketch(r,s);break}i&&t.push(i)}return t}fillSketch(e,n){let s=n.fillWeight;return s<0&&(s=n.strokeWidth/2),{d:this.opsToPath(e),stroke:n.fill||C,strokeWidth:s,fill:C}}_mergedShape(e){return e.filter((n,s)=>s===0?!0:n.op!=="move")}}class Lt{constructor(e,n){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new ke(n)}draw(e){const n=e.sets||[],s=e.options||this.getDefaultOptions(),t=this.ctx,r=e.options.fixedDecimalPlaceDigits;for(const i of n)switch(i.type){case"path":t.save(),t.strokeStyle=s.stroke==="none"?"transparent":s.stroke,t.lineWidth=s.strokeWidth,s.strokeLineDash&&t.setLineDash(s.strokeLineDash),s.strokeLineDashOffset&&(t.lineDashOffset=s.strokeLineDashOffset),this._drawToContext(t,i,r),t.restore();break;case"fillPath":{t.save(),t.fillStyle=s.fill||"";const a=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(t,i,r,a),t.restore();break}case"fillSketch":this.fillSketch(t,i,s);break}}fillSketch(e,n,s){let t=s.fillWeight;t<0&&(t=s.strokeWidth/2),e.save(),s.fillLineDash&&e.setLineDash(s.fillLineDash),s.fillLineDashOffset&&(e.lineDashOffset=s.fillLineDashOffset),e.strokeStyle=s.fill||"",e.lineWidth=t,this._drawToContext(e,n,s.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,n,s,t="nonzero"){e.beginPath();for(const r of n.ops){const i=typeof s=="number"&&s>=0?r.data.map(a=>+a.toFixed(s)):r.data;switch(r.op){case"move":e.moveTo(i[0],i[1]);break;case"bcurveTo":e.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]);break;case"lineTo":e.lineTo(i[0],i[1]);break}}n.type==="fillPath"?e.fill(t):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,n,s,t,r){const i=this.gen.line(e,n,s,t,r);return this.draw(i),i}rectangle(e,n,s,t,r){const i=this.gen.rectangle(e,n,s,t,r);return this.draw(i),i}ellipse(e,n,s,t,r){const i=this.gen.ellipse(e,n,s,t,r);return this.draw(i),i}circle(e,n,s,t){const r=this.gen.circle(e,n,s,t);return this.draw(r),r}linearPath(e,n){const s=this.gen.linearPath(e,n);return this.draw(s),s}polygon(e,n){const s=this.gen.polygon(e,n);return this.draw(s),s}arc(e,n,s,t,r,i,a=!1,u){const l=this.gen.arc(e,n,s,t,r,i,a,u);return this.draw(l),l}curve(e,n){const s=this.gen.curve(e,n);return this.draw(s),s}path(e,n){const s=this.gen.path(e,n);return this.draw(s),s}}const ue="http://www.w3.org/2000/svg";class At{constructor(e,n){this.svg=e,this.gen=new ke(n)}draw(e){const n=e.sets||[],s=e.options||this.getDefaultOptions(),t=this.svg.ownerDocument||window.document,r=t.createElementNS(ue,"g"),i=e.options.fixedDecimalPlaceDigits;for(const a of n){let u=null;switch(a.type){case"path":{u=t.createElementNS(ue,"path"),u.setAttribute("d",this.opsToPath(a,i)),u.setAttribute("stroke",s.stroke),u.setAttribute("stroke-width",s.strokeWidth+""),u.setAttribute("fill","none"),s.strokeLineDash&&u.setAttribute("stroke-dasharray",s.strokeLineDash.join(" ").trim()),s.strokeLineDashOffset&&u.setAttribute("stroke-dashoffset",`${s.strokeLineDashOffset}`);break}case"fillPath":{u=t.createElementNS(ue,"path"),u.setAttribute("d",this.opsToPath(a,i)),u.setAttribute("stroke","none"),u.setAttribute("stroke-width","0"),u.setAttribute("fill",s.fill||""),(e.shape==="curve"||e.shape==="polygon")&&u.setAttribute("fill-rule","evenodd");break}case"fillSketch":{u=this.fillSketch(t,a,s);break}}u&&r.appendChild(u)}return r}fillSketch(e,n,s){let t=s.fillWeight;t<0&&(t=s.strokeWidth/2);const r=e.createElementNS(ue,"path");return r.setAttribute("d",this.opsToPath(n,s.fixedDecimalPlaceDigits)),r.setAttribute("stroke",s.fill||""),r.setAttribute("stroke-width",t+""),r.setAttribute("fill","none"),s.fillLineDash&&r.setAttribute("stroke-dasharray",s.fillLineDash.join(" ").trim()),s.fillLineDashOffset&&r.setAttribute("stroke-dashoffset",`${s.fillLineDashOffset}`),r}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,n){return this.gen.opsToPath(e,n)}line(e,n,s,t,r){const i=this.gen.line(e,n,s,t,r);return this.draw(i)}rectangle(e,n,s,t,r){const i=this.gen.rectangle(e,n,s,t,r);return this.draw(i)}ellipse(e,n,s,t,r){const i=this.gen.ellipse(e,n,s,t,r);return this.draw(i)}circle(e,n,s,t){const r=this.gen.circle(e,n,s,t);return this.draw(r)}linearPath(e,n){const s=this.gen.linearPath(e,n);return this.draw(s)}polygon(e,n){const s=this.gen.polygon(e,n);return this.draw(s)}arc(e,n,s,t,r,i,a=!1,u){const l=this.gen.arc(e,n,s,t,r,i,a,u);return this.draw(l)}curve(e,n){const s=this.gen.curve(e,n);return this.draw(s)}path(e,n){const s=this.gen.path(e,n);return this.draw(s)}}const L={canvas(o,e){return new Lt(o,e)},svg(o,e){return new At(o,e)},generator(o){return new ke(o)},newSeed(){return ke.newSeed()}},X=(o,e,n,s,t)=>`M${o+t},${e}
|
|
7
|
+
H${o+n-t}
|
|
8
|
+
A${t},${t} 0 0 1 ${o+n},${e+t}
|
|
9
|
+
V${e+s-t}
|
|
10
|
+
A${t},${t} 0 0 1 ${o+n-t},${e+s}
|
|
11
|
+
H${o+t}
|
|
12
|
+
A${t},${t} 0 0 1 ${o},${e+s-t}
|
|
13
|
+
V${e+t}
|
|
14
|
+
A${t},${t} 0 0 1 ${o+t},${e}
|
|
15
|
+
Z`,jt={"drawui-button":"_drawui-button_1nx7z_1"},de={stroke:{thin:{color:"#333",width:1.5},medium:{color:"#333",width:2.5},thick:{color:"#333",width:4}},roughness:{roughness:1.8,bowing:2},fill:{background:"#ccccccff"},radius:{none:0,sm:6,md:10,lg:16,full:30},buttonSize:{sm:{width:100,height:40,fontSize:12},md:{width:130,height:50,fontSize:15},lg:{width:150,height:60,fontSize:18},xl:{width:170,height:70,fontSize:20}},inputSize:{sm:{height:32,fontSize:12,paddingX:8},md:{height:40,fontSize:14,paddingX:12},lg:{height:48,fontSize:16,paddingX:16},xl:{height:48,fontSize:16,paddingX:16}}},Je=y.createContext(de),$t=({theme:o,children:e})=>{const n={...de,...o,stroke:{...de.stroke,...o?.stroke},radius:{...de.radius,...o?.radius}};return M.jsx(Je.Provider,{value:n,children:e})},O=()=>y.useContext(Je),Dt=({strokeWeight:o="medium",radius:e="md",size:n="sm",backgroundColor:s,children:t,...r})=>{const i=O(),a=y.useRef(null),[u,l]=y.useState(!1),c=i.buttonSize[n].width,h=i.buttonSize[n].height,f=i.buttonSize[n].fontSize;return y.useEffect(()=>{if(!a.current)return;const d=L.svg(a.current);a.current.innerHTML="";const g=i.stroke[o],m=d.path(X(0,0,c,h,i.radius[e]),{stroke:g.color,strokeWidth:g.width,fill:s??i.fill.background,roughness:u?i.roughness.roughness+1:i.roughness.roughness,bowing:i.roughness.bowing});a.current.appendChild(m)},[u,o,e,i]),M.jsxs("button",{...r,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:`${jt["drawui-button"]} ${r.className??""}`,style:{position:"relative",width:c,height:h,border:"none",background:"transparent",cursor:"pointer"},children:[M.jsx("svg",{ref:a,width:c,height:h,style:{position:"absolute",inset:0}}),M.jsx("span",{style:{position:"relative",fontSize:f,pointerEvents:"none"},children:t})]})},le={"drawui-card":"_drawui-card_vhoat_1","drawui-card-header":"_drawui-card-header_vhoat_7","drawui-card-body":"_drawui-card-body_vhoat_12","drawui-card-footer":"_drawui-card-footer_vhoat_17"},zt="_vertical_1tdom_6",It="_horizontal_1tdom_11",_e={"drawui-divider":"_drawui-divider_1tdom_1",vertical:zt,horizontal:It},Oe=({strokeWeight:o="medium",width:e="100%",vertical:n=!1,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;r.current.innerHTML="";const i=L.svg(r.current),a=t.stroke[o];if(n){const u=typeof e=="number"?e:100,l=i.line(0,0,0,u,{stroke:a.color,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(l)}else{const u=typeof e=="number"?e:300,l=i.line(0,0,u,0,{stroke:a.color,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(l)}},[t,o,e,n]),M.jsx("div",{className:`${_e["drawui-divider"]} ${n?_e.vertical:_e.horizontal} ${s??""}`,style:{width:n?void 0:e},children:M.jsx("svg",{ref:r,width:n?2:e,height:n?e:2,style:{display:"block"}})})},Nt=({strokeWeight:o="medium",radius:e="md",width:n=300,height:s=200,backgroundColor:t,header:r,footer:i,children:a,...u})=>{const l=O(),c=y.useRef(null),[h,f]=y.useState(!1);return y.useEffect(()=>{if(!c.current)return;const d=L.svg(c.current);c.current.innerHTML="";const g=l.stroke[o],m=d.path(X(0,0,n,s,l.radius[e]),{stroke:g.color,strokeWidth:g.width,fill:t??l.fill.background,roughness:h?l.roughness.roughness+1:l.roughness.roughness,bowing:l.roughness.bowing});c.current.appendChild(m)},[o,e,n,s,t,l]),M.jsxs("div",{...u,className:`${le["drawui-card"]} ${u.className??""}`,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{position:"relative",width:n,height:s,cursor:"default",display:"flex",flexDirection:"column",overflow:"hidden"},children:[M.jsx("svg",{ref:c,width:n,height:s,style:{position:"absolute",inset:0,pointerEvents:"none"}}),r&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:le["drawui-card-header"],style:{position:"relative",zIndex:1},children:r}),M.jsx(Oe,{width:n,strokeWeight:"thick"})]}),M.jsx("div",{className:le["drawui-card-body"],style:{position:"relative",zIndex:1,flex:1},children:a}),i&&M.jsxs(M.Fragment,{children:[M.jsx(Oe,{width:n,strokeWeight:"thick"}),M.jsx("div",{className:le["drawui-card-footer"],style:{position:"relative",zIndex:1},children:i})]})]})},qe={"drawui-collapse":"_drawui-collapse_mgu8u_1","drawui-collapse-content":"_drawui-collapse-content_mgu8u_22"},Wt=({header:o,children:e,strokeWeight:n="medium",radius:s="md",width:t=300,className:r})=>{const i=O(),a=y.useRef(null);return y.useEffect(()=>{if(!a.current)return;const u=L.svg(a.current);a.current.innerHTML="";const l=i.stroke[n],c=u.path(X(0,0,t,40,i.radius[s]),{stroke:l.color,strokeWidth:l.width,fill:"transparent",roughness:i.roughness.roughness,bowing:i.roughness.bowing});a.current.appendChild(c)},[i,n,s,t]),M.jsx("div",{className:`${qe["drawui-collapse"]} ${r??""}`,style:{width:t},children:M.jsxs("details",{children:[M.jsxs("summary",{style:{position:"relative"},children:[M.jsx("svg",{ref:a,width:t,height:40,style:{position:"absolute",inset:0,pointerEvents:"none"}}),M.jsx("span",{style:{position:"relative",zIndex:1},children:o})]}),M.jsx("div",{className:qe["drawui-collapse-content"],children:e})]})})},Ft={},Ht=({strokeWeight:o="medium",radius:e="md",size:n="sm",icon:s,backgroundColor:t,...r})=>{const i=O(),a=y.useRef(null),[u,l]=y.useState(!1),c=i.buttonSize[n].height;return y.useEffect(()=>{if(!a.current)return;const h=L.svg(a.current);a.current.innerHTML="";const f=i.stroke[o],d=h.path(X(0,0,c,c,i.radius[e]),{stroke:f.color,strokeWidth:f.width,fill:t??i.fill.background,roughness:u?i.roughness.roughness+1:i.roughness.roughness,bowing:i.roughness.bowing});a.current.appendChild(d)},[u,o,e,i,c,t]),M.jsxs("button",{...r,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:`${Ft["drawui-button"]} ${r.className??""}`,style:{position:"relative",width:c,height:c,border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},children:[M.jsx("svg",{ref:a,width:c,height:c,style:{position:"absolute",inset:0,pointerEvents:"none"}}),M.jsx("span",{style:{position:"relative",pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:s})]})},Ge={"drawui-input":"_drawui-input_15az9_1","drawui-input-field":"_drawui-input-field_15az9_8"},qt=({strokeWeight:o="medium",backgroundColor:e,radius:n="md",inputSize:s="md",className:t,style:r,...i})=>{const a=O(),u=y.useRef(null),l=y.useRef(null),[c,h]=y.useState(!1),[f,d]=y.useState(!1),g=a.inputSize[s].height,m=a.inputSize[s].fontSize,b=a.inputSize[s].paddingX;return y.useEffect(()=>{if(!u.current||!l.current)return;const v=l.current.offsetWidth,_=L.svg(u.current);u.current.innerHTML="";const D=a.stroke[o],q=_.path(X(0,0,v,g,a.radius[n]),{stroke:D.color,strokeWidth:D.width,fill:e??a.fill.background,roughness:c?a.roughness.roughness+1:a.roughness.roughness,bowing:a.roughness.bowing});u.current.appendChild(q)},[c,f,o,n,s,a,e]),M.jsxs("div",{ref:l,className:`${Ge["drawui-input"]} ${t??""}`,style:{height:g,...r},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[M.jsx("svg",{ref:u,width:"100%",height:g,style:{position:"absolute",inset:0}}),M.jsx("input",{...i,className:Ge["drawui-input-field"],style:{height:g,fontSize:m,paddingLeft:b,paddingRight:b},onFocus:v=>{h(!0),i.onFocus?.(v)},onBlur:v=>{h(!1),i.onBlur?.(v)}})]})},Gt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.path("M6 18 H18 L16 12 A6 6 0 0 0 8 12 Z",{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(l);const c=i.circle(12,18,2,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(c)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Vt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.path("M2 12 L12 2 L22 12 V22 H2 Z",{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(l)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Bt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.line(4,12,20,12,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(l)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Yt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.line(12,4,12,20,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing}),c=i.line(4,12,20,12,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(l),r.current.appendChild(c)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Zt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.circle(10,10,14,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"}),c=i.line(16,16,22,22,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(l),r.current.appendChild(c)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Ut=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.circle(12,12,14,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(l);for(let c=0;c<8;c++){const h=c*Math.PI*2/8,f=12+7*Math.cos(h),d=12+7*Math.sin(h),g=12+10*Math.cos(h),m=12+10*Math.sin(h),b=i.line(f,d,g,m,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing});r.current.appendChild(b)}},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})},Xt=({size:o=24,strokeWeight:e="medium",color:n,className:s})=>{const t=O(),r=y.useRef(null);return y.useEffect(()=>{if(!r.current)return;const i=L.svg(r.current);r.current.innerHTML="";const a=t.stroke[e],u=n??a.color,l=i.circle(12,8,6,{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(l);const c=i.path("M4 20 Q12 16 20 20",{stroke:u,strokeWidth:a.width,roughness:t.roughness.roughness,bowing:t.roughness.bowing,fill:"transparent"});r.current.appendChild(c)},[t,e,n]),M.jsx("svg",{ref:r,width:o,height:o,viewBox:"0 0 24 24",className:s})};exports.DrawuiButton=Dt;exports.DrawuiCard=Nt;exports.DrawuiCollapse=Wt;exports.DrawuiDivider=Oe;exports.DrawuiIconButton=Ht;exports.DrawuiInput=qt;exports.DrawuiThemeProvider=$t;exports.IconBell=Gt;exports.IconHome=Vt;exports.IconMinus=Bt;exports.IconPlus=Yt;exports.IconSearch=Zt;exports.IconSettings=Ut;exports.IconUser=Xt;exports.useDrawuiTheme=O;
|
package/dist/drawui.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._drawui-button_1nx7z_1{display:inline-flex;align-items:center;justify-content:center;position:relative;cursor:pointer;padding:.5rem 1rem;font-weight:600;background:transparent;border:none;outline:none}._drawui-card_vhoat_1{display:flex;flex-direction:column;overflow:hidden}._drawui-card-header_vhoat_7{padding:12px;border-bottom:1px solid transparent}._drawui-card-body_vhoat_12{padding:12px;flex:1}._drawui-card-footer_vhoat_17{padding:12px;border-top:1px solid transparent}._drawui-divider_1tdom_1{position:relative;display:block}._drawui-divider_1tdom_1._vertical_1tdom_6{height:100%;width:auto}._drawui-divider_1tdom_1._horizontal_1tdom_11{width:100%;height:auto}._drawui-collapse_mgu8u_1{position:relative;width:fit-content;display:block;margin-bottom:30px}._drawui-collapse_mgu8u_1 details{position:relative}._drawui-collapse_mgu8u_1 summary{list-style:none;cursor:pointer;-webkit-user-select:none;user-select:none}._drawui-collapse_mgu8u_1 summary::-webkit-details-marker{display:block}._drawui-collapse-content_mgu8u_22{margin-top:10px}._drawui-icon-button_18srz_1{display:inline-flex;align-items:center;justify-content:center;position:relative;cursor:pointer;padding:.5rem 1rem;font-weight:600;background:transparent;border:none;outline:none}._drawui-input_15az9_1{position:relative;display:inline-flex;align-items:center;width:100%}._drawui-input-field_15az9_8{position:relative;width:100%;background:transparent;border:none;outline:none;z-index:1}._drawui-input-icon_15az9_17{position:relative;z-index:1;display:flex;align-items:center;pointer-events:none}
|