fui-studio-mcp 0.1.2 → 0.1.3
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 +4 -1
- package/dist/{chunk-S3AUIOGZ.js → chunk-NYLRWVKF.js} +62 -0
- package/dist/{chunk-U3VXQSCB.js → chunk-ZCNEK4RK.js} +1 -1
- package/dist/{dist-LUAYBAOC.js → dist-3XKU7BN6.js} +1 -1
- package/dist/index.js +95 -4
- package/dist/{node-XJJEAAN7.js → node-VANCEYKL.js} +2 -2
- package/dist/runtime.global.js +908 -908
- package/package.json +3 -3
package/dist/runtime.global.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
"use strict";var FUI=(()=>{var
|
|
2
|
-
t))!
|
|
3
|
-
t())})(ls,(function(){"use strict";function e(W,I){var C={label:0,sent:function(){if(
|
|
1
|
+
"use strict";var FUI=(()=>{var hf=Object.create;var $r=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var mf=Object.getPrototypeOf,Af=Object.prototype.hasOwnProperty;var yf=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zs=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Js=(e,t)=>{for(var n in t)$r(e,n,{get:t[n],enumerable:!0})},Ks=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of df(
|
|
2
|
+
t))!Af.call(e,i)&&i!==n&&$r(e,i,{get:()=>t[i],enumerable:!(r=pf(t,i))||r.enumerable});return e};var Ur=(e,t,n)=>(n=e!=null?hf(mf(e)):{},Ks(t||!e||!e.__esModule?$r(n,"default",{value:e,enumerable:!0}):n,e)),gf=e=>Ks($r({},"__esModule",{value:!0}),e);var mt=(e,t,n)=>yf(e,typeof t!="symbol"?t+"":t,n);var io=Zs((ls,us)=>{"use strict";(function(e,t){typeof ls=="object"&&typeof us<"u"?us.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.polygonClipping=
|
|
3
|
+
t())})(ls,(function(){"use strict";function e(W,I){var C={label:0,sent:function(){if(O[0]&1)throw O[1];return O[1]},trys:[],ops:[]},D,N,O,j;return j={next:H(0),throw:H(1),return:H(2)},typeof Symbol=="\
|
|
4
4
|
function"&&(j[Symbol.iterator]=function(){return this}),j;function H(Z){return function(de){return ee([Z,de])}}function ee(Z){if(D)throw new TypeError("Generator is already executing.");for(;C;)try{if(D=
|
|
5
|
-
1,
|
|
6
|
-
done:!1};case 5:C.label++,
|
|
7
|
-
|
|
8
|
-
Z=[6,de],
|
|
9
|
-
function n(W,I){return W>I?1:W<I?-1:0}function r(W,I,C){for(var D=new t(null,null),
|
|
10
|
-
I,I=H,I.left===null)break}
|
|
11
|
-
break}return
|
|
12
|
-
C.left,
|
|
13
|
-
D=I):(D=I.left,I.left=null,
|
|
14
|
-
|
|
15
|
-
`);var
|
|
5
|
+
1,N&&(O=Z[0]&2?N.return:Z[0]?N.throw||((O=N.return)&&O.call(N),0):N.next)&&!(O=O.call(N,Z[1])).done)return O;switch(N=0,O&&(Z=[Z[0]&2,O.value]),Z[0]){case 0:case 1:O=Z;break;case 4:return C.label++,{value:Z[1],
|
|
6
|
+
done:!1};case 5:C.label++,N=Z[1],Z=[0];continue;case 7:Z=C.ops.pop(),C.trys.pop();continue;default:if(O=C.trys,!(O=O.length>0&&O[O.length-1])&&(Z[0]===6||Z[0]===2)){C=0;continue}if(Z[0]===3&&(!O||Z[1]>
|
|
7
|
+
O[0]&&Z[1]<O[3])){C.label=Z[1];break}if(Z[0]===6&&C.label<O[1]){C.label=O[1],O=Z;break}if(O&&C.label<O[2]){C.label=O[2],C.ops.push(Z);break}O[2]&&C.ops.pop(),C.trys.pop();continue}Z=I.call(W,C)}catch(de){
|
|
8
|
+
Z=[6,de],N=0}finally{D=O=0}if(Z[0]&5)throw Z[1];return{value:Z[0]?Z[1]:void 0,done:!0}}}var t=(function(){function W(I,C){this.next=null,this.key=I,this.data=C,this.left=null,this.right=null}return W})();
|
|
9
|
+
function n(W,I){return W>I?1:W<I?-1:0}function r(W,I,C){for(var D=new t(null,null),N=D,O=D;;){var j=C(W,I.key);if(j<0){if(I.left===null)break;if(C(W,I.left.key)<0){var H=I.left;if(I.left=H.right,H.right=
|
|
10
|
+
I,I=H,I.left===null)break}O.left=I,O=I,I=I.left}else if(j>0){if(I.right===null)break;if(C(W,I.right.key)>0){var H=I.right;if(I.right=H.left,H.left=I,I=H,I.right===null)break}N.right=I,N=I,I=I.right}else
|
|
11
|
+
break}return N.right=I.left,O.left=I.right,I.left=D.right,I.right=D.left,I}function i(W,I,C,D){var N=new t(W,I);if(C===null)return N.left=N.right=null,N;C=r(W,C,D);var O=D(W,C.key);return O<0?(N.left=
|
|
12
|
+
C.left,N.right=C,C.left=null):O>=0&&(N.right=C.right,N.left=C,C.right=null),N}function s(W,I,C){var D=null,N=null;if(I){I=r(W,I,C);var O=C(I.key,W);O===0?(D=I.left,N=I.right):O<0?(N=I.right,I.right=null,
|
|
13
|
+
D=I):(D=I.left,I.left=null,N=I)}return{left:D,right:N}}function a(W,I,C){return I===null?W:(W===null||(I=r(W.key,I,C),I.left=W),I)}function u(W,I,C,D,N){if(W){D(""+I+(C?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+
|
|
14
|
+
N(W)+`
|
|
15
|
+
`);var O=I+(C?" ":"\u2502 ");W.left&&u(W.left,O,!1,D,N),W.right&&u(W.right,O,!0,D,N)}}var f=(function(){function W(I){I===void 0&&(I=n),this._root=null,this._size=0,this._comparator=I}return W.prototype.
|
|
16
16
|
insert=function(I,C){return this._size++,this._root=i(I,C,this._root,this._comparator)},W.prototype.add=function(I,C){var D=new t(I,C);this._root===null&&(D.left=D.right=null,this._size++,this._root=D);
|
|
17
|
-
var
|
|
18
|
-
_root},W.prototype.remove=function(I){this._root=this._remove(I,this._root,this._comparator)},W.prototype._remove=function(I,C,D){var
|
|
19
|
-
(C.left===null?
|
|
20
|
-
this._root=this._remove(I.key,this._root,this._comparator),{key:I.key,data:I.data}}return null},W.prototype.findStatic=function(I){for(var C=this._root,D=this._comparator;C;){var
|
|
21
|
-
return C;
|
|
22
|
-
contains=function(I){for(var C=this._root,D=this._comparator;C;){var
|
|
23
|
-
D!==null?(
|
|
24
|
-
|
|
17
|
+
var N=this._comparator,O=r(I,this._root,N),j=N(I,O.key);return j===0?this._root=O:(j<0?(D.left=O.left,D.right=O,O.left=null):j>0&&(D.right=O.right,D.left=O,O.right=null),this._size++,this._root=D),this.
|
|
18
|
+
_root},W.prototype.remove=function(I){this._root=this._remove(I,this._root,this._comparator)},W.prototype._remove=function(I,C,D){var N;if(C===null)return null;C=r(I,C,D);var O=D(I,C.key);return O===0?
|
|
19
|
+
(C.left===null?N=C.right:(N=r(I,C.left,D),N.right=C.right),this._size--,N):C},W.prototype.pop=function(){var I=this._root;if(I){for(;I.left;)I=I.left;return this._root=r(I.key,this._root,this._comparator),
|
|
20
|
+
this._root=this._remove(I.key,this._root,this._comparator),{key:I.key,data:I.data}}return null},W.prototype.findStatic=function(I){for(var C=this._root,D=this._comparator;C;){var N=D(I,C.key);if(N===0)
|
|
21
|
+
return C;N<0?C=C.left:C=C.right}return null},W.prototype.find=function(I){return this._root&&(this._root=r(I,this._root,this._comparator),this._comparator(I,this._root.key)!==0)?null:this._root},W.prototype.
|
|
22
|
+
contains=function(I){for(var C=this._root,D=this._comparator;C;){var N=D(I,C.key);if(N===0)return!0;N<0?C=C.left:C=C.right}return!1},W.prototype.forEach=function(I,C){for(var D=this._root,N=[],O=!1;!O;)
|
|
23
|
+
D!==null?(N.push(D),D=D.left):N.length!==0?(D=N.pop(),I.call(C,D),D=D.right):O=!0;return this},W.prototype.range=function(I,C,D,N){for(var O=[],j=this._comparator,H=this._root,ee;O.length!==0||H;)if(H)
|
|
24
|
+
O.push(H),H=H.left;else{if(H=O.pop(),ee=j(H.key,C),ee>0)break;if(j(H.key,I)>=0&&D.call(N,H))return this;H=H.right}return this},W.prototype.keys=function(){var I=[];return this.forEach(function(C){var D=C.
|
|
25
25
|
key;return I.push(D)}),I},W.prototype.values=function(){var I=[];return this.forEach(function(C){var D=C.data;return I.push(D)}),I},W.prototype.min=function(){return this._root?this.minNode(this._root).
|
|
26
26
|
key:null},W.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},W.prototype.minNode=function(I){if(I===void 0&&(I=this._root),I)for(;I.left;)I=I.left;return I},W.prototype.maxNode=
|
|
27
|
-
function(I){if(I===void 0&&(I=this._root),I)for(;I.right;)I=I.right;return I},W.prototype.at=function(I){for(var C=this._root,D=!1,
|
|
28
|
-
|
|
29
|
-
C.key);if(
|
|
30
|
-
var N
|
|
31
|
-
prototype.load=function(I,C,D){C===void 0&&(C=[]),D===void 0&&(D=!1);var
|
|
32
|
-
m(I,C),
|
|
27
|
+
function(I){if(I===void 0&&(I=this._root),I)for(;I.right;)I=I.right;return I},W.prototype.at=function(I){for(var C=this._root,D=!1,N=0,O=[];!D;)if(C)O.push(C),C=C.left;else if(O.length>0){if(C=O.pop(),
|
|
28
|
+
N===I)return C;N++,C=C.right}else D=!0;return null},W.prototype.next=function(I){var C=this._root,D=null;if(I.right){for(D=I.right;D.left;)D=D.left;return D}for(var N=this._comparator;C;){var O=N(I.key,
|
|
29
|
+
C.key);if(O===0)break;O<0?(D=C,C=C.left):C=C.right}return D},W.prototype.prev=function(I){var C=this._root,D=null;if(I.left!==null){for(D=I.left;D.right;)D=D.right;return D}for(var N=this._comparator;C;){
|
|
30
|
+
var O=N(I.key,C.key);if(O===0)break;O<0?C=C.left:(D=C,C=C.right)}return D},W.prototype.clear=function(){return this._root=null,this._size=0,this},W.prototype.toList=function(){return d(this._root)},W.
|
|
31
|
+
prototype.load=function(I,C,D){C===void 0&&(C=[]),D===void 0&&(D=!1);var N=I.length,O=this._comparator;if(D&&x(I,C,0,N-1,O),this._root===null)this._root=h(I,C,0,N),this._size=N;else{var j=g(this.toList(),
|
|
32
|
+
m(I,C),O);N=this._size+N,this._root=A({head:j},0,N)}return this},W.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(W.prototype,"size",{get:function(){return this._size},enumerable:!0,
|
|
33
33
|
configurable:!0}),Object.defineProperty(W.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),W.prototype.toString=function(I){I===void 0&&(I=function(D){return String(
|
|
34
|
-
D.key)});var C=[];return u(this._root,"",!0,function(D){return C.push(D)},I),C.join("")},W.prototype.update=function(I,C,D){var
|
|
35
|
-
D,H,
|
|
36
|
-
I=this._root,C=[],D=!1,
|
|
37
|
-
label=5;case 5:return[3,1];case 6:return[2]}})},W})();function
|
|
38
|
-
function m(W,I){for(var C=new t(null,null),D=C,
|
|
39
|
-
C.length>0?(I=
|
|
40
|
-
|
|
41
|
-
next=j),D.next}function x(W,I,C,D,
|
|
42
|
-
ee}x(W,I,C,H,
|
|
43
|
-
I.ll.x:W.ll.x,D=W.ur.x<I.ur.x?W.ur.x:I.ur.x,
|
|
34
|
+
D.key)});var C=[];return u(this._root,"",!0,function(D){return C.push(D)},I),C.join("")},W.prototype.update=function(I,C,D){var N=this._comparator,O=s(I,this._root,N),j=O.left,H=O.right;N(I,C)<0?H=i(C,
|
|
35
|
+
D,H,N):j=i(C,D,j,N),this._root=a(j,H,N)},W.prototype.split=function(I){return s(I,this._root,this._comparator)},W.prototype[Symbol.iterator]=function(){var I,C,D;return e(this,function(N){switch(N.label){case 0:
|
|
36
|
+
I=this._root,C=[],D=!1,N.label=1;case 1:return D?[3,6]:I===null?[3,2]:(C.push(I),I=I.left,[3,5]);case 2:return C.length===0?[3,4]:(I=C.pop(),[4,I]);case 3:return N.sent(),I=I.right,[3,5];case 4:D=!0,N.
|
|
37
|
+
label=5;case 5:return[3,1];case 6:return[2]}})},W})();function h(W,I,C,D){var N=D-C;if(N>0){var O=C+Math.floor(N/2),j=W[O],H=I[O],ee=new t(j,H);return ee.left=h(W,I,C,O),ee.right=h(W,I,O+1,D),ee}return null}
|
|
38
|
+
function m(W,I){for(var C=new t(null,null),D=C,N=0;N<W.length;N++)D=D.next=new t(W[N],I[N]);return D.next=null,C.next}function d(W){for(var I=W,C=[],D=!1,N=new t(null,null),O=N;!D;)I?(C.push(I),I=I.left):
|
|
39
|
+
C.length>0?(I=O=O.next=C.pop(),I=I.right):D=!0;return O.next=null,N.next}function A(W,I,C){var D=C-I;if(D>0){var N=I+Math.floor(D/2),O=A(W,I,N),j=W.head;return j.left=O,W.head=W.head.next,j.right=A(W,
|
|
40
|
+
N+1,C),j}return null}function g(W,I,C){for(var D=new t(null,null),N=D,O=W,j=I;O!==null&&j!==null;)C(O.key,j.key)<0?(N.next=O,O=O.next):(N.next=j,j=j.next),N=N.next;return O!==null?N.next=O:j!==null&&(N.
|
|
41
|
+
next=j),D.next}function x(W,I,C,D,N){if(!(C>=D)){for(var O=W[C+D>>1],j=C-1,H=D+1;;){do j++;while(N(W[j],O)<0);do H--;while(N(W[H],O)>0);if(j>=H)break;var ee=W[j];W[j]=W[H],W[H]=ee,ee=I[j],I[j]=I[H],I[H]=
|
|
42
|
+
ee}x(W,I,C,H,N),x(W,I,H+1,D,N)}}let v=(W,I)=>W.ll.x<=I.x&&I.x<=W.ur.x&&W.ll.y<=I.y&&I.y<=W.ur.y,b=(W,I)=>{if(I.ur.x<W.ll.x||W.ur.x<I.ll.x||I.ur.y<W.ll.y||W.ur.y<I.ll.y)return null;let C=W.ll.x<I.ll.x?
|
|
43
|
+
I.ll.x:W.ll.x,D=W.ur.x<I.ur.x?W.ur.x:I.ur.x,N=W.ll.y<I.ll.y?I.ll.y:W.ll.y,O=W.ur.y<I.ur.y?W.ur.y:I.ur.y;return{ll:{x:C,y:N},ur:{x:D,y:O}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));let P=w*w,E=(W,I)=>{
|
|
44
44
|
if(-w<W&&W<w&&-w<I&&I<w)return 0;let C=W-I;return C*C<P*W*I?0:W<I?-1:1};class T{constructor(){this.reset()}reset(){this.xRounder=new M,this.yRounder=new M}round(I,C){return{x:this.xRounder.round(I),y:this.
|
|
45
|
-
yRounder.round(C)}}}class M{constructor(){this.tree=new
|
|
46
|
-
tree.next(C);return
|
|
47
|
-
Z==de>-Z?(
|
|
48
|
-
|
|
49
|
-
ee)+(de-ee),de=D[++re],
|
|
50
|
-
S)*S,te=(2+12*S)*S,ce=(9+64*S)*S*S,ue=q(4),ie=q(8),
|
|
51
|
-
Lt,le=re-(re-Lt),Se=Lt-le,re=_*Wt,Ie=re-(re-Wt),Fe=Wt-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),
|
|
52
|
-
$=ct-Pe,ue[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-
|
|
53
|
-
($=W-Lt,H=W-(Lt+$)+($-
|
|
54
|
-
ot=H*Wt,re=_*H,le=re-(re-H),Se=H-le,re=_*Wt,Ie=re-(re-Wt),Fe=Wt-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),
|
|
55
|
-
Pe=ct-Pt,$=ct-Pe,ne[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-
|
|
56
|
-
_*Lt,le=re-(re-Lt),Se=Lt-le,re=_*de,Ie=re-(re-de),Fe=de-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),
|
|
57
|
-
ct-Pe,ne[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-
|
|
58
|
-
(re-H),Se=H-le,re=_*de,Ie=re-(re-de),Fe=de-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),
|
|
59
|
-
ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-
|
|
60
|
-
let j=(I-
|
|
61
|
-
C.y);return D>0?-1:D<0?1:0},lt=W=>Math.sqrt(We(W,W)),wt=(W,I,C)=>{let D={x:I.x-W.x,y:I.y-W.y},
|
|
62
|
-
y:C.y-W.y};return We(
|
|
63
|
-
return Bt(W,I,C.x);if(I.y===0)return yt(C,D,W.y);if(D.y===0)return yt(W,I,C.y);let
|
|
45
|
+
yRounder.round(C)}}}class M{constructor(){this.tree=new f,this.round(0)}round(I){let C=this.tree.add(I),D=this.tree.prev(C);if(D!==null&&E(C.key,D.key)===0)return this.tree.remove(I),D.key;let N=this.
|
|
46
|
+
tree.next(C);return N!==null&&E(C.key,N.key)===0?(this.tree.remove(I),N.key):I}}let R=new T,S=11102230246251565e-32,_=134217729,Q=(3+8*S)*S;function Y(W,I,C,D,N){let O,j,H,ee,Z=I[0],de=D[0],$=0,re=0;de>
|
|
47
|
+
Z==de>-Z?(O=Z,Z=I[++$]):(O=de,de=D[++re]);let le=0;if($<W&&re<C)for(de>Z==de>-Z?(j=Z+O,H=O-(j-Z),Z=I[++$]):(j=de+O,H=O-(j-de),de=D[++re]),O=j,H!==0&&(N[le++]=H);$<W&&re<C;)de>Z==de>-Z?(j=O+Z,ee=j-O,H=
|
|
48
|
+
O-(j-ee)+(Z-ee),Z=I[++$]):(j=O+de,ee=j-O,H=O-(j-ee)+(de-ee),de=D[++re]),O=j,H!==0&&(N[le++]=H);for(;$<W;)j=O+Z,ee=j-O,H=O-(j-ee)+(Z-ee),Z=I[++$],O=j,H!==0&&(N[le++]=H);for(;re<C;)j=O+de,ee=j-O,H=O-(j-
|
|
49
|
+
ee)+(de-ee),de=D[++re],O=j,H!==0&&(N[le++]=H);return(O!==0||le===0)&&(N[le++]=O),le}function G(W,I){let C=I[0];for(let D=1;D<W;D++)C+=I[D];return C}function q(W){return new Float64Array(W)}let X=(3+16*
|
|
50
|
+
S)*S,te=(2+12*S)*S,ce=(9+64*S)*S*S,ue=q(4),ie=q(8),fe=q(12),ve=q(16),ne=q(4);function ye(W,I,C,D,N,O,j){let H,ee,Z,de,$,re,le,Se,Ie,Fe,Pe,Ve,ut,ot,ct,ft,Pt,ht,Lt=W-N,Ft=C-N,Yt=I-O,Wt=D-O;ot=Lt*Wt,re=_*
|
|
51
|
+
Lt,le=re-(re-Lt),Se=Lt-le,re=_*Wt,Ie=re-(re-Wt),Fe=Wt-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),ft=Yt*Ft,re=_*Yt,le=re-(re-Yt),Se=Yt-le,re=_*Ft,Ie=re-(re-Ft),Fe=Ft-Ie,Pt=Se*Fe-(ft-le*Ie-Se*Ie-le*Fe),Pe=ct-Pt,
|
|
52
|
+
$=ct-Pe,ue[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-ft,$=ut-Pe,ue[1]=ut-(Pe+$)+($-ft),ht=Ve+Pe,$=ht-Ve,ue[2]=Ve-(ht-$)+(Pe-$),ue[3]=ht;let Zt=G(4,ue),Fn=te*j;if(Zt>=Fn||-Zt>=Fn||
|
|
53
|
+
($=W-Lt,H=W-(Lt+$)+($-N),$=C-Ft,Z=C-(Ft+$)+($-N),$=I-Yt,ee=I-(Yt+$)+($-O),$=D-Wt,de=D-(Wt+$)+($-O),H===0&&ee===0&&Z===0&&de===0)||(Fn=ce*j+Q*Math.abs(Zt),Zt+=Lt*de+Wt*H-(Yt*Z+Ft*ee),Zt>=Fn||-Zt>=Fn))return Zt;
|
|
54
|
+
ot=H*Wt,re=_*H,le=re-(re-H),Se=H-le,re=_*Wt,Ie=re-(re-Wt),Fe=Wt-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),ft=ee*Ft,re=_*ee,le=re-(re-ee),Se=ee-le,re=_*Ft,Ie=re-(re-Ft),Fe=Ft-Ie,Pt=Se*Fe-(ft-le*Ie-Se*Ie-le*Fe),
|
|
55
|
+
Pe=ct-Pt,$=ct-Pe,ne[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-ft,$=ut-Pe,ne[1]=ut-(Pe+$)+($-ft),ht=Ve+Pe,$=ht-Ve,ne[2]=Ve-(ht-$)+(Pe-$),ne[3]=ht;let ki=Y(4,ue,4,ne,ie);ot=Lt*de,re=
|
|
56
|
+
_*Lt,le=re-(re-Lt),Se=Lt-le,re=_*de,Ie=re-(re-de),Fe=de-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),ft=Yt*Z,re=_*Yt,le=re-(re-Yt),Se=Yt-le,re=_*Z,Ie=re-(re-Z),Fe=Z-Ie,Pt=Se*Fe-(ft-le*Ie-Se*Ie-le*Fe),Pe=ct-Pt,$=
|
|
57
|
+
ct-Pe,ne[0]=ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-ft,$=ut-Pe,ne[1]=ut-(Pe+$)+($-ft),ht=Ve+Pe,$=ht-Ve,ne[2]=Ve-(ht-$)+(Pe-$),ne[3]=ht;let Ci=Y(ki,ie,4,ne,fe);ot=H*de,re=_*H,le=re-
|
|
58
|
+
(re-H),Se=H-le,re=_*de,Ie=re-(re-de),Fe=de-Ie,ct=Se*Fe-(ot-le*Ie-Se*Ie-le*Fe),ft=ee*Z,re=_*ee,le=re-(re-ee),Se=ee-le,re=_*Z,Ie=re-(re-Z),Fe=Z-Ie,Pt=Se*Fe-(ft-le*Ie-Se*Ie-le*Fe),Pe=ct-Pt,$=ct-Pe,ne[0]=
|
|
59
|
+
ct-(Pe+$)+($-Pt),Ve=ot+Pe,$=Ve-ot,ut=ot-(Ve-$)+(Pe-$),Pe=ut-ft,$=ut-Pe,ne[1]=ut-(Pe+$)+($-ft),ht=Ve+Pe,$=ht-Ve,ne[2]=Ve-(ht-$)+(Pe-$),ne[3]=ht;let Yn=Y(Ci,fe,4,ne,ve);return ve[Yn-1]}function Be(W,I,C,D,N,O){
|
|
60
|
+
let j=(I-O)*(C-N),H=(W-N)*(D-O),ee=j-H,Z=Math.abs(j+H);return Math.abs(ee)>=X*Z?ee:-ye(W,I,C,D,N,O,Z)}let Ee=(W,I)=>W.x*I.y-W.y*I.x,We=(W,I)=>W.x*I.x+W.y*I.y,at=(W,I,C)=>{let D=Be(W.x,W.y,I.x,I.y,C.x,
|
|
61
|
+
C.y);return D>0?-1:D<0?1:0},lt=W=>Math.sqrt(We(W,W)),wt=(W,I,C)=>{let D={x:I.x-W.x,y:I.y-W.y},N={x:C.x-W.x,y:C.y-W.y};return Ee(N,D)/lt(N)/lt(D)},nn=(W,I,C)=>{let D={x:I.x-W.x,y:I.y-W.y},N={x:C.x-W.x,
|
|
62
|
+
y:C.y-W.y};return We(N,D)/lt(N)/lt(D)},yt=(W,I,C)=>I.y===0?null:{x:W.x+I.x/I.y*(C-W.y),y:C},Bt=(W,I,C)=>I.x===0?null:{x:C,y:W.y+I.y/I.x*(C-W.x)},Ze=(W,I,C,D)=>{if(I.x===0)return Bt(C,D,W.x);if(D.x===0)
|
|
63
|
+
return Bt(W,I,C.x);if(I.y===0)return yt(C,D,W.y);if(D.y===0)return yt(W,I,C.y);let N=Ee(I,D);if(N==0)return null;let O={x:C.x-W.x,y:C.y-W.y},j=Ee(O,I)/N,H=Ee(O,D)/N,ee=W.x+H*I.x,Z=C.x+j*D.x,de=W.y+H*I.
|
|
64
64
|
y,$=C.y+j*D.y,re=(ee+Z)/2,le=(de+$)/2;return{x:re,y:le}};class ae{static compare(I,C){let D=ae.comparePoints(I.point,C.point);return D!==0?D:(I.point!==C.point&&I.link(C),I.isLeft!==C.isLeft?I.isLeft?
|
|
65
65
|
1:-1:Te.compare(I.segment,C.segment))}static comparePoints(I,C){return I.x<C.x?-1:I.x>C.x?1:I.y<C.y?-1:I.y>C.y?1:0}constructor(I,C){I.events===void 0?I.events=[this]:I.events.push(this),this.point=I,this.
|
|
66
|
-
isLeft=C}link(I){if(I.point===this.point)throw new Error("Tried to link already linked events");let C=I.point.events;for(let D=0,
|
|
67
|
-
this.checkForConsuming()}checkForConsuming(){let I=this.point.events.length;for(let C=0;C<I;C++){let D=this.point.events[C];if(D.segment.consumedBy===void 0)for(let
|
|
68
|
-
|
|
69
|
-
events[C];
|
|
70
|
-
point,I.point,
|
|
71
|
-
1:0}}}let xe=0;class Te{static compare(I,C){let D=I.leftSE.point.x,
|
|
72
|
-
Z=I.rightSE.point.y,de=C.rightSE.point.y;if(D<
|
|
73
|
-
return re!==0?re:-1}if(D>
|
|
74
|
-
return-1;if(H>ee)return 1;if(
|
|
75
|
-
ee,Se=j-
|
|
76
|
-
C,C.segment=this,C.otherSE=I,this.rings=D,this.windings=
|
|
77
|
-
enerate segment at [${I.x}, ${I.y}]`);let ee=new ae(
|
|
66
|
+
isLeft=C}link(I){if(I.point===this.point)throw new Error("Tried to link already linked events");let C=I.point.events;for(let D=0,N=C.length;D<N;D++){let O=C[D];this.point.events.push(O),O.point=this.point}
|
|
67
|
+
this.checkForConsuming()}checkForConsuming(){let I=this.point.events.length;for(let C=0;C<I;C++){let D=this.point.events[C];if(D.segment.consumedBy===void 0)for(let N=C+1;N<I;N++){let O=this.point.events[N];
|
|
68
|
+
O.consumedBy===void 0&&D.otherSE.point.events===O.otherSE.point.events&&D.segment.consume(O.segment)}}}getAvailableLinkedEvents(){let I=[];for(let C=0,D=this.point.events.length;C<D;C++){let N=this.point.
|
|
69
|
+
events[C];N!==this&&!N.segment.ringOut&&N.segment.isInResult()&&I.push(N)}return I}getLeftmostComparator(I){let C=new Map,D=N=>{let O=N.otherSE;C.set(N,{sine:wt(this.point,I.point,O.point),cosine:nn(this.
|
|
70
|
+
point,I.point,O.point)})};return(N,O)=>{C.has(N)||D(N),C.has(O)||D(O);let{sine:j,cosine:H}=C.get(N),{sine:ee,cosine:Z}=C.get(O);return j>=0&&ee>=0?H<Z?1:H>Z?-1:0:j<0&&ee<0?H<Z?-1:H>Z?1:0:ee<j?-1:ee>j?
|
|
71
|
+
1:0}}}let xe=0;class Te{static compare(I,C){let D=I.leftSE.point.x,N=C.leftSE.point.x,O=I.rightSE.point.x,j=C.rightSE.point.x;if(j<D)return 1;if(O<N)return-1;let H=I.leftSE.point.y,ee=C.leftSE.point.y,
|
|
72
|
+
Z=I.rightSE.point.y,de=C.rightSE.point.y;if(D<N){if(ee<H&&ee<Z)return 1;if(ee>H&&ee>Z)return-1;let $=I.comparePoint(C.leftSE.point);if($<0)return 1;if($>0)return-1;let re=C.comparePoint(I.rightSE.point);
|
|
73
|
+
return re!==0?re:-1}if(D>N){if(H<ee&&H<de)return-1;if(H>ee&&H>de)return 1;let $=C.comparePoint(I.leftSE.point);if($!==0)return $;let re=I.comparePoint(C.rightSE.point);return re<0?1:re>0?-1:1}if(H<ee)
|
|
74
|
+
return-1;if(H>ee)return 1;if(O<j){let $=C.comparePoint(I.rightSE.point);if($!==0)return $}if(O>j){let $=I.comparePoint(C.rightSE.point);if($<0)return 1;if($>0)return-1}if(O!==j){let $=Z-H,re=O-D,le=de-
|
|
75
|
+
ee,Se=j-N;if($>re&&le<Se)return 1;if($<re&&le>Se)return-1}return O>j?1:O<j||Z<de?-1:Z>de?1:I.id<C.id?-1:I.id>C.id?1:0}constructor(I,C,D,N){this.id=++xe,this.leftSE=I,I.segment=this,I.otherSE=C,this.rightSE=
|
|
76
|
+
C,C.segment=this,C.otherSE=I,this.rings=D,this.windings=N}static fromRing(I,C,D){let N,O,j,H=ae.comparePoints(I,C);if(H<0)N=I,O=C,j=1;else if(H>0)N=C,O=I,j=-1;else throw new Error(`Tried to create deg\
|
|
77
|
+
enerate segment at [${I.x}, ${I.y}]`);let ee=new ae(N,!0),Z=new ae(O,!1);return new Te(ee,Z,[D],[j])}replaceRightSE(I){this.rightSE=I,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.
|
|
78
78
|
otherSE=this.rightSE}bbox(){let I=this.leftSE.point.y,C=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:I<C?I:C},ur:{x:this.rightSE.point.x,y:I>C?I:C}}}vector(){return{x:this.rightSE.point.x-this.
|
|
79
79
|
leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(I){return I.x===this.leftSE.point.x&&I.y===this.leftSE.point.y||I.x===this.rightSE.point.x&&I.y===this.rightSE.point.y}comparePoint(I){
|
|
80
|
-
if(this.isAnEndpoint(I))return 0;let C=this.leftSE.point,D=this.rightSE.point,
|
|
81
|
-
x-C.x)/
|
|
82
|
-
rightSE.point,Z=v(C,H)&&this.comparePoint(H)===0,de=v(D,
|
|
83
|
-
|
|
84
|
-
le.x,le.y)}split(I){let C=[],D=I.events!==void 0,
|
|
85
|
-
comparePoints(H.leftSE.point,H.rightSE.point)>0&&H.swapEvents(),ae.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),D&&(
|
|
80
|
+
if(this.isAnEndpoint(I))return 0;let C=this.leftSE.point,D=this.rightSE.point,N=this.vector();if(C.x===D.x)return I.x===C.x?0:I.x<C.x?1:-1;let O=(I.y-C.y)/N.y,j=C.x+O*N.x;if(I.x===j)return 0;let H=(I.
|
|
81
|
+
x-C.x)/N.x,ee=C.y+H*N.y;return I.y===ee?0:I.y<ee?-1:1}getIntersection(I){let C=this.bbox(),D=I.bbox(),N=b(C,D);if(N===null)return null;let O=this.leftSE.point,j=this.rightSE.point,H=I.leftSE.point,ee=I.
|
|
82
|
+
rightSE.point,Z=v(C,H)&&this.comparePoint(H)===0,de=v(D,O)&&I.comparePoint(O)===0,$=v(C,ee)&&this.comparePoint(ee)===0,re=v(D,j)&&I.comparePoint(j)===0;if(de&&Z)return re&&!$?j:!re&&$?ee:null;if(de)return $&&
|
|
83
|
+
O.x===ee.x&&O.y===ee.y?null:O;if(Z)return re&&j.x===H.x&&j.y===H.y?null:H;if(re&&$)return null;if(re)return j;if($)return ee;let le=Ze(O,this.vector(),H,I.vector());return le===null||!v(N,le)?null:R.round(
|
|
84
|
+
le.x,le.y)}split(I){let C=[],D=I.events!==void 0,N=new ae(I,!0),O=new ae(I,!1),j=this.rightSE;this.replaceRightSE(O),C.push(O),C.push(N);let H=new Te(N,j,this.rings.slice(),this.windings.slice());return ae.
|
|
85
|
+
comparePoints(H.leftSE.point,H.rightSE.point)>0&&H.swapEvents(),ae.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),D&&(N.checkForConsuming(),O.checkForConsuming()),C}swapEvents(){
|
|
86
86
|
let I=this.rightSE;this.rightSE=this.leftSE,this.leftSE=I,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let C=0,D=this.windings.length;C<D;C++)this.windings[C]*=-1}consume(I){let C=this,D=I;for(;C.
|
|
87
|
-
consumedBy;)C=C.consumedBy;for(;D.consumedBy;)D=D.consumedBy;let
|
|
88
|
-
ee=D.windings[
|
|
87
|
+
consumedBy;)C=C.consumedBy;for(;D.consumedBy;)D=D.consumedBy;let N=Te.compare(C,D);if(N!==0){if(N>0){let O=C;C=D,D=O}if(C.prev===D){let O=C;C=D,D=O}for(let O=0,j=D.rings.length;O<j;O++){let H=D.rings[O],
|
|
88
|
+
ee=D.windings[O],Z=C.rings.indexOf(H);Z===-1?(C.rings.push(H),C.windings.push(ee)):C.windings[Z]+=ee}D.rings=null,D.windings=null,D.consumedBy=C,D.leftSE.consumedBy=C.leftSE,D.rightSE.consumedBy=C.rightSE}}prevInResult(){
|
|
89
89
|
return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){
|
|
90
90
|
if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let I=this.prev.consumedBy||this.prev;this._beforeState=I.afterState()}
|
|
91
91
|
return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let I=this.beforeState();this._afterState={rings:I.rings.slice(0),windings:I.windings.slice(0),multiPolys:[]};
|
|
92
|
-
let C=this._afterState.rings,D=this._afterState.windings,
|
|
93
|
-
Z),D.push(de)):D[$]+=de}let
|
|
94
|
-
indexOf(Z.poly);$!==-1&&
|
|
95
|
-
void 0)return this._isInResult;let I=this.beforeState().multiPolys,C=this.afterState().multiPolys;switch(Qt.type){case"union":{let D=I.length===0,
|
|
96
|
-
section":{let D,
|
|
97
|
-
1;break}case"difference":{let D=
|
|
92
|
+
let C=this._afterState.rings,D=this._afterState.windings,N=this._afterState.multiPolys;for(let H=0,ee=this.rings.length;H<ee;H++){let Z=this.rings[H],de=this.windings[H],$=C.indexOf(Z);$===-1?(C.push(
|
|
93
|
+
Z),D.push(de)):D[$]+=de}let O=[],j=[];for(let H=0,ee=C.length;H<ee;H++){if(D[H]===0)continue;let Z=C[H],de=Z.poly;if(j.indexOf(de)===-1)if(Z.isExterior)O.push(de);else{j.indexOf(de)===-1&&j.push(de);let $=O.
|
|
94
|
+
indexOf(Z.poly);$!==-1&&O.splice($,1)}}for(let H=0,ee=O.length;H<ee;H++){let Z=O[H].multiPoly;N.indexOf(Z)===-1&&N.push(Z)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==
|
|
95
|
+
void 0)return this._isInResult;let I=this.beforeState().multiPolys,C=this.afterState().multiPolys;switch(Qt.type){case"union":{let D=I.length===0,N=C.length===0;this._isInResult=D!==N;break}case"inter\
|
|
96
|
+
section":{let D,N;I.length<C.length?(D=I.length,N=C.length):(D=C.length,N=I.length),this._isInResult=N===Qt.numMultiPolys&&D<N;break}case"xor":{let D=Math.abs(I.length-C.length);this._isInResult=D%2===
|
|
97
|
+
1;break}case"difference":{let D=N=>N.length===1&&N[0].isSubject;this._isInResult=D(I)!==D(C);break}default:throw new Error(`Unrecognized operation type found ${Qt.type}`)}return this._isInResult}}class Xe{constructor(I,C,D){
|
|
98
98
|
if(!Array.isArray(I)||I.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=C,this.isExterior=D,this.segments=[],typeof I[0][0]!="number"||typeof I[0][1]!=
|
|
99
|
-
"number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let
|
|
100
|
-
"number"||typeof I[j][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ee=R.round(I[j][0],I[j][1]);ee.x===
|
|
101
|
-
this)),ee.x<this.bbox.ll.x&&(this.bbox.ll.x=ee.x),ee.y<this.bbox.ll.y&&(this.bbox.ll.y=ee.y),ee.x>this.bbox.ur.x&&(this.bbox.ur.x=ee.x),ee.y>this.bbox.ur.y&&(this.bbox.ur.y=ee.y),
|
|
102
|
-
|
|
99
|
+
"number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let N=R.round(I[0][0],I[0][1]);this.bbox={ll:{x:N.x,y:N.y},ur:{x:N.x,y:N.y}};let O=N;for(let j=1,H=I.length;j<H;j++){if(typeof I[j][0]!=
|
|
100
|
+
"number"||typeof I[j][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ee=R.round(I[j][0],I[j][1]);ee.x===O.x&&ee.y===O.y||(this.segments.push(Te.fromRing(O,ee,
|
|
101
|
+
this)),ee.x<this.bbox.ll.x&&(this.bbox.ll.x=ee.x),ee.y<this.bbox.ll.y&&(this.bbox.ll.y=ee.y),ee.x>this.bbox.ur.x&&(this.bbox.ur.x=ee.x),ee.y>this.bbox.ur.y&&(this.bbox.ur.y=ee.y),O=ee)}(N.x!==O.x||N.y!==
|
|
102
|
+
O.y)&&this.segments.push(Te.fromRing(O,N,this))}getSweepEvents(){let I=[];for(let C=0,D=this.segments.length;C<D;C++){let N=this.segments[C];I.push(N.leftSE),I.push(N.rightSE)}return I}}class it{constructor(I,C){
|
|
103
103
|
if(!Array.isArray(I))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Xe(I[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.
|
|
104
|
-
ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let D=1,
|
|
105
|
-
ll.x),
|
|
106
|
-
|
|
107
|
-
I.push(O
|
|
108
|
-
[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let D=0,
|
|
109
|
-
this.bbox.ll.x&&(this.bbox.ll.x=
|
|
110
|
-
y=
|
|
111
|
-
class He{static factory(I){let C=[];for(let D=0,
|
|
104
|
+
ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let D=1,N=I.length;D<N;D++){let O=new Xe(I[D],this,!1);O.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=O.bbox.
|
|
105
|
+
ll.x),O.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=O.bbox.ll.y),O.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=O.bbox.ur.x),O.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=O.bbox.ur.y),this.interiorRings.push(
|
|
106
|
+
O)}this.multiPoly=C}getSweepEvents(){let I=this.exteriorRing.getSweepEvents();for(let C=0,D=this.interiorRings.length;C<D;C++){let N=this.interiorRings[C].getSweepEvents();for(let O=0,j=N.length;O<j;O++)
|
|
107
|
+
I.push(N[O])}return I}}class kt{constructor(I,C){if(!Array.isArray(I))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof I[0][0][0]=="number"&&(I=[I])}catch{}this.polys=
|
|
108
|
+
[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let D=0,N=I.length;D<N;D++){let O=new it(I[D],this);O.bbox.ll.x<
|
|
109
|
+
this.bbox.ll.x&&(this.bbox.ll.x=O.bbox.ll.x),O.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=O.bbox.ll.y),O.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=O.bbox.ur.x),O.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.
|
|
110
|
+
y=O.bbox.ur.y),this.polys.push(O)}this.isSubject=C}getSweepEvents(){let I=[];for(let C=0,D=this.polys.length;C<D;C++){let N=this.polys[C].getSweepEvents();for(let O=0,j=N.length;O<j;O++)I.push(N[O])}return I}}
|
|
111
|
+
class He{static factory(I){let C=[];for(let D=0,N=I.length;D<N;D++){let O=I[D];if(!O.isInResult()||O.ringOut)continue;let j=null,H=O.leftSE,ee=O.rightSE,Z=[H],de=H.point,$=[];for(;j=H,H=ee,Z.push(H),H.
|
|
112
112
|
point!==de;)for(;;){let re=H.getAvailableLinkedEvents();if(re.length===0){let Ie=Z[0].point,Fe=Z[Z.length-1].point;throw new Error(`Unable to complete output ring starting at [${Ie.x}, ${Ie.y}]. Last \
|
|
113
113
|
matching segment found ends at [${Fe.x}, ${Fe.y}].`)}if(re.length===1){ee=re[0].otherSE;break}let le=null;for(let Ie=0,Fe=$.length;Ie<Fe;Ie++)if($[Ie].point===H.point){le=Ie;break}if(le!==null){let Ie=$.
|
|
114
114
|
splice(le)[0],Fe=Z.splice(Ie.index);Fe.unshift(Fe[0].otherSE),C.push(new He(Fe.reverse()));continue}$.push({index:Z.length,point:H.point});let Se=H.getLeftmostComparator(j);ee=re.sort(Se)[0].otherSE;break}
|
|
115
115
|
C.push(new He(Z))}return C}constructor(I){this.events=I;for(let C=0,D=I.length;C<D;C++)I[C].segment.ringOut=this;this.poly=null}getGeom(){let I=this.events[0].point,C=[I];for(let Z=1,de=this.events.length-
|
|
116
|
-
1;Z<de;Z++){let $=this.events[Z].point,re=this.events[Z+1].point;at($,I,re)!==0&&(C.push($),I=$)}if(C.length===1)return null;let D=C[0],
|
|
117
|
-
1:-1,j=this.isExteriorRing()?0:C.length-1,H=this.isExteriorRing()?C.length:-1,ee=[];for(let Z=j;Z!=H;Z+=
|
|
116
|
+
1;Z<de;Z++){let $=this.events[Z].point,re=this.events[Z+1].point;at($,I,re)!==0&&(C.push($),I=$)}if(C.length===1)return null;let D=C[0],N=C[1];at(D,I,N)===0&&C.shift(),C.push(C[0]);let O=this.isExteriorRing()?
|
|
117
|
+
1:-1,j=this.isExteriorRing()?0:C.length-1,H=this.isExteriorRing()?C.length:-1,ee=[];for(let Z=j;Z!=H;Z+=O)ee.push([C[Z].x,C[Z].y]);return ee}isExteriorRing(){if(this._isExteriorRing===void 0){let I=this.
|
|
118
118
|
enclosingRing();this._isExteriorRing=I?!I.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){
|
|
119
|
-
let I=this.events[0];for(let
|
|
119
|
+
let I=this.events[0];for(let N=1,O=this.events.length;N<O;N++){let j=this.events[N];ae.compare(I,j)>0&&(I=j)}let C=I.segment.prevInResult(),D=C?C.prevInResult():null;for(;;){if(!C)return null;if(!D)return C.
|
|
120
120
|
ringOut;if(D.ringOut!==C.ringOut)return D.ringOut.enclosingRing()!==C.ringOut?C.ringOut:C.ringOut.enclosingRing();C=D.prevInResult(),D=C?C.prevInResult():null}}}class Je{constructor(I){this.exteriorRing=
|
|
121
121
|
I,I.poly=this,this.interiorRings=[]}addInterior(I){this.interiorRings.push(I),I.poly=this}getGeom(){let I=[this.exteriorRing.getGeom()];if(I[0]===null)return null;for(let C=0,D=this.interiorRings.length;C<
|
|
122
|
-
D;C++){let
|
|
123
|
-
let
|
|
124
|
-
j.poly||C.push(new Je(j)),j.poly.addInterior(
|
|
125
|
-
[]}process(I){let C=I.segment,D=[];if(I.consumedBy)return I.isLeft?this.queue.remove(I.otherSE):this.tree.remove(C),D;let
|
|
126
|
-
find segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] in SweepLine tree.`);let N
|
|
127
|
-
null:
|
|
122
|
+
D;C++){let N=this.interiorRings[C].getGeom();N!==null&&I.push(N)}return I}}class dt{constructor(I){this.rings=I,this.polys=this._composePolys(I)}getGeom(){let I=[];for(let C=0,D=this.polys.length;C<D;C++){
|
|
123
|
+
let N=this.polys[C].getGeom();N!==null&&I.push(N)}return I}_composePolys(I){let C=[];for(let D=0,N=I.length;D<N;D++){let O=I[D];if(!O.poly)if(O.isExteriorRing())C.push(new Je(O));else{let j=O.enclosingRing();
|
|
124
|
+
j.poly||C.push(new Je(j)),j.poly.addInterior(O)}}return C}}class Ct{constructor(I){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Te.compare;this.queue=I,this.tree=new f(C),this.segments=
|
|
125
|
+
[]}process(I){let C=I.segment,D=[];if(I.consumedBy)return I.isLeft?this.queue.remove(I.otherSE):this.tree.remove(C),D;let N=I.isLeft?this.tree.add(C):this.tree.find(C);if(!N)throw new Error(`Unable to\
|
|
126
|
+
find segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] in SweepLine tree.`);let O=N,j=N,H,ee;for(;H===void 0;)O=this.tree.prev(O),O===null?H=
|
|
127
|
+
null:O.key.consumedBy===void 0&&(H=O.key);for(;ee===void 0;)j=this.tree.next(j),j===null?ee=null:j.key.consumedBy===void 0&&(ee=j.key);if(I.isLeft){let Z=null;if(H){let $=H.getIntersection(C);if($!==null&&
|
|
128
128
|
(C.isAnEndpoint($)||(Z=$),!H.isAnEndpoint($))){let re=this._splitSafely(H,$);for(let le=0,Se=re.length;le<Se;le++)D.push(re[le])}}let de=null;if(ee){let $=ee.getIntersection(C);if($!==null&&(C.isAnEndpoint(
|
|
129
129
|
$)||(de=$),!ee.isAnEndpoint($))){let re=this._splitSafely(ee,$);for(let le=0,Se=re.length;le<Se;le++)D.push(re[le])}}if(Z!==null||de!==null){let $=null;Z===null?$=de:de===null?$=Z:$=ae.comparePoints(Z,
|
|
130
130
|
de)<=0?Z:de,this.queue.remove(C.rightSE),D.push(C.rightSE);let re=C.split($);for(let le=0,Se=re.length;le<Se;le++)D.push(re[le])}D.length>0?(this.tree.remove(C),D.push(I)):(this.segments.push(C),C.prev=
|
|
131
131
|
H)}else{if(H&&ee){let Z=H.getIntersection(ee);if(Z!==null){if(!H.isAnEndpoint(Z)){let de=this._splitSafely(H,Z);for(let $=0,re=de.length;$<re;$++)D.push(de[$])}if(!ee.isAnEndpoint(Z)){let de=this._splitSafely(
|
|
132
|
-
ee,Z);for(let $=0,re=de.length;$<re;$++)D.push(de[$])}}}this.tree.remove(C)}return D}_splitSafely(I,C){this.tree.remove(I);let D=I.rightSE;this.queue.remove(D);let
|
|
133
|
-
void 0&&this.tree.add(I),
|
|
134
|
-
Qt.type=I,R.reset();let
|
|
135
|
-
bbox)!==null?re++:
|
|
136
|
-
compare);for(let $=0,re=
|
|
137
|
-
in a priority queue (queue size too big).")}let j=new Ct(
|
|
138
|
-
pEvent [${$.point.x}, ${$.point.y}] from segment #${le.id} [${le.leftSE.point.x}, ${le.leftSE.point.y}] -> [${le.rightSE.point.x}, ${le.rightSE.point.y}] from queue.`)}if(
|
|
132
|
+
ee,Z);for(let $=0,re=de.length;$<re;$++)D.push(de[$])}}}this.tree.remove(C)}return D}_splitSafely(I,C){this.tree.remove(I);let D=I.rightSE;this.queue.remove(D);let N=I.split(C);return N.push(D),I.consumedBy===
|
|
133
|
+
void 0&&this.tree.add(I),N}}let Ht=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Et=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ii{run(I,C,D){
|
|
134
|
+
Qt.type=I,R.reset();let N=[new kt(C,!0)];for(let $=0,re=D.length;$<re;$++)N.push(new kt(D[$],!1));if(Qt.numMultiPolys=N.length,Qt.type==="difference"){let $=N[0],re=1;for(;re<N.length;)b(N[re].bbox,$.
|
|
135
|
+
bbox)!==null?re++:N.splice(re,1)}if(Qt.type==="intersection")for(let $=0,re=N.length;$<re;$++){let le=N[$];for(let Se=$+1,Ie=N.length;Se<Ie;Se++)if(b(le.bbox,N[Se].bbox)===null)return[]}let O=new f(ae.
|
|
136
|
+
compare);for(let $=0,re=N.length;$<re;$++){let le=N[$].getSweepEvents();for(let Se=0,Ie=le.length;Se<Ie;Se++)if(O.insert(le[Se]),O.size>Ht)throw new Error("Infinite loop when putting segment endpoints\
|
|
137
|
+
in a priority queue (queue size too big).")}let j=new Ct(O),H=O.size,ee=O.pop();for(;ee;){let $=ee.key;if(O.size===H){let le=$.segment;throw new Error(`Unable to pop() ${$.isLeft?"left":"right"} Swee\
|
|
138
|
+
pEvent [${$.point.x}, ${$.point.y}] from segment #${le.id} [${le.leftSE.point.x}, ${le.leftSE.point.y}] -> [${le.rightSE.point.x}, ${le.rightSE.point.y}] from queue.`)}if(O.size>Ht)throw new Error("In\
|
|
139
139
|
finite loop when passing sweep line over endpoints (queue size too big).");if(j.segments.length>Et)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
140
|
-
let re=j.process($);for(let le=0,Se=re.length;le<Se;le++){let Ie=re[le];Ie.consumedBy===void 0&&
|
|
140
|
+
let re=j.process($);for(let le=0,Se=re.length;le<Se;le++){let Ie=re[le];Ie.consumedBy===void 0&&O.insert(Ie)}H=O.size,ee=O.pop()}R.reset();let Z=He.factory(j.segments);return new dt(Z).getGeom()}}let Qt=new Ii;
|
|
141
141
|
var wi={union:function(W){for(var I=arguments.length,C=new Array(I>1?I-1:0),D=1;D<I;D++)C[D-1]=arguments[D];return Qt.run("union",W,C)},intersection:function(W){for(var I=arguments.length,C=new Array(
|
|
142
142
|
I>1?I-1:0),D=1;D<I;D++)C[D-1]=arguments[D];return Qt.run("intersection",W,C)},xor:function(W){for(var I=arguments.length,C=new Array(I>1?I-1:0),D=1;D<I;D++)C[D-1]=arguments[D];return Qt.run("xor",W,C)},
|
|
143
143
|
difference:function(W){for(var I=arguments.length,C=new Array(I>1?I-1:0),D=1;D<I;D++)C[D-1]=arguments[D];return Qt.run("difference",W,C)}};return wi}))});var Gl=Zs((rv,Vo)=>{"use strict";(function(){"use strict";var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;typeof Vo<"u"&&Vo.exports?(Vo.exports=e,t=!0):(typeof define=="function"&&define.
|
|
@@ -145,100 +145,100 @@ amd&&define(e),typeof document<"u"?window.ClipperLib=e:self.ClipperLib=e);var n;
|
|
|
145
145
|
indexOf("chrome")!=-1&&r.indexOf("chromium")==-1?i.chrome=1:i.chrome=0,r.indexOf("chromium")!=-1?i.chromium=1:i.chromium=0,r.indexOf("safari")!=-1&&r.indexOf("chrome")==-1&&r.indexOf("chromium")==-1?i.
|
|
146
146
|
safari=1:i.safari=0,r.indexOf("firefox")!=-1?i.firefox=1:i.firefox=0,r.indexOf("firefox/17")!=-1?i.firefox17=1:i.firefox17=0,r.indexOf("firefox/15")!=-1?i.firefox15=1:i.firefox15=0,r.indexOf("firefox/\
|
|
147
147
|
3")!=-1?i.firefox3=1:i.firefox3=0,r.indexOf("opera")!=-1?i.opera=1:i.opera=0,r.indexOf("msie 10")!=-1?i.msie10=1:i.msie10=0,r.indexOf("msie 9")!=-1?i.msie9=1:i.msie9=0,r.indexOf("msie 8")!=-1?i.msie8=
|
|
148
|
-
1:i.msie8=0,r.indexOf("msie 7")!=-1?i.msie7=1:i.msie7=0,r.indexOf("msie ")!=-1?i.msie=1:i.msie=0,e.biginteger_used=null;var s,a=0xdeadbeefcafe,u=(a&16777215)==15715070;function
|
|
149
|
-
1,o!=null&&(typeof o=="number"&&typeof l>"u"?this.fromInt(o):typeof o=="number"?this.fromNumber(o,l,c):l==null&&typeof o!="string"?this.fromString(o,256):this.fromString(o,l))}function
|
|
148
|
+
1:i.msie8=0,r.indexOf("msie 7")!=-1?i.msie7=1:i.msie7=0,r.indexOf("msie ")!=-1?i.msie=1:i.msie=0,e.biginteger_used=null;var s,a=0xdeadbeefcafe,u=(a&16777215)==15715070;function f(o,l,c){e.biginteger_used=
|
|
149
|
+
1,o!=null&&(typeof o=="number"&&typeof l>"u"?this.fromInt(o):typeof o=="number"?this.fromNumber(o,l,c):l==null&&typeof o!="string"?this.fromString(o,256):this.fromString(o,l))}function h(){return new f(
|
|
150
150
|
null,void 0,void 0)}function m(o,l,c,p,y,k){for(;--k>=0;){var B=l*this[o++]+c[p]+y;y=Math.floor(B/67108864),c[p++]=B&67108863}return y}function d(o,l,c,p,y,k){for(var B=l&32767,L=l>>15;--k>=0;){var F=this[o]&
|
|
151
151
|
32767,U=this[o++]>>15,oe=L*F+U*B;F=B*F+((oe&32767)<<15)+c[p]+(y&1073741823),y=(F>>>30)+(oe>>>15)+L*U+(y>>>30),c[p++]=F&1073741823}return y}function A(o,l,c,p,y,k){for(var B=l&16383,L=l>>14;--k>=0;){var F=this[o]&
|
|
152
|
-
16383,U=this[o++]>>14,oe=L*F+U*B;F=B*F+((oe&16383)<<14)+c[p]+y,y=(F>>28)+(oe>>14)+L*U,c[p++]=F&268435455}return y}u&&n=="Microsoft Internet Explorer"?(
|
|
153
|
-
am=m,s=26):(
|
|
152
|
+
16383,U=this[o++]>>14,oe=L*F+U*B;F=B*F+((oe&16383)<<14)+c[p]+y,y=(F>>28)+(oe>>14)+L*U,c[p++]=F&268435455}return y}u&&n=="Microsoft Internet Explorer"?(f.prototype.am=d,s=30):u&&n!="Netscape"?(f.prototype.
|
|
153
|
+
am=m,s=26):(f.prototype.am=A,s=28),f.prototype.DB=s,f.prototype.DM=(1<<s)-1,f.prototype.DV=1<<s;var g=52;f.prototype.FV=Math.pow(2,g),f.prototype.F1=g-s,f.prototype.F2=2*s-g;var x="0123456789abcdefghi\
|
|
154
154
|
jklmnopqrstuvwxyz",v=new Array,b,w;for(b=48,w=0;w<=9;++w)v[b++]=w;for(b=97,w=10;w<36;++w)v[b++]=w;for(b=65,w=10;w<36;++w)v[b++]=w;function P(o){return x.charAt(o)}function E(o,l){var c=v[o.charCodeAt(
|
|
155
|
-
l)];return c??-1}function T(o){for(var l=this.t-1;l>=0;--l)o[l]=this[l];o.t=this.t,o.s=this.s}function M(o){this.t=1,this.s=o<0?-1:0,o>0?this[0]=o:o<-1?this[0]=o+this.DV:this.t=0}function R(o){var l=
|
|
155
|
+
l)];return c??-1}function T(o){for(var l=this.t-1;l>=0;--l)o[l]=this[l];o.t=this.t,o.s=this.s}function M(o){this.t=1,this.s=o<0?-1:0,o>0?this[0]=o:o<-1?this[0]=o+this.DV:this.t=0}function R(o){var l=h();
|
|
156
156
|
return l.fromInt(o),l}function S(o,l){var c;if(l==16)c=4;else if(l==8)c=3;else if(l==256)c=8;else if(l==2)c=1;else if(l==32)c=5;else if(l==4)c=2;else{this.fromRadix(o,l);return}this.t=0,this.s=0;for(var p=o.
|
|
157
157
|
length,y=!1,k=0;--p>=0;){var B=c==8?o[p]&255:E(o,p);if(B<0){o.charAt(p)=="-"&&(y=!0);continue}y=!1,k==0?this[this.t++]=B:k+c>this.DB?(this[this.t-1]|=(B&(1<<this.DB-k)-1)<<k,this[this.t++]=B>>this.DB-
|
|
158
|
-
k):this[this.t-1]|=B<<k,k+=c,k>=this.DB&&(k-=this.DB)}c==8&&(o[0]&128)!=0&&(this.s=-1,k>0&&(this[this.t-1]|=(1<<this.DB-k)-1<<k)),this.clamp(),y&&
|
|
158
|
+
k):this[this.t-1]|=B<<k,k+=c,k>=this.DB&&(k-=this.DB)}c==8&&(o[0]&128)!=0&&(this.s=-1,k>0&&(this[this.t-1]|=(1<<this.DB-k)-1<<k)),this.clamp(),y&&f.ZERO.subTo(this,this)}function _(){for(var o=this.s&
|
|
159
159
|
this.DM;this.t>0&&this[this.t-1]==o;)--this.t}function Q(o){if(this.s<0)return"-"+this.negate().toString(o);var l;if(o==16)l=4;else if(o==8)l=3;else if(o==2)l=1;else if(o==32)l=5;else if(o==4)l=2;else
|
|
160
160
|
return this.toRadix(o);var c=(1<<l)-1,p,y=!1,k="",B=this.t,L=this.DB-B*this.DB%l;if(B-- >0)for(L<this.DB&&(p=this[B]>>L)>0&&(y=!0,k=P(p));B>=0;)L<l?(p=(this[B]&(1<<L)-1)<<l-L,p|=this[--B]>>(L+=this.DB-
|
|
161
|
-
l)):(p=this[B]>>(L-=l)&c,L<=0&&(L+=this.DB,--B)),p>0&&(y=!0),y&&(k+=P(p));return y?k:"0"}function Y(){var o=
|
|
161
|
+
l)):(p=this[B]>>(L-=l)&c,L<=0&&(L+=this.DB,--B)),p>0&&(y=!0),y&&(k+=P(p));return y?k:"0"}function Y(){var o=h();return f.ZERO.subTo(this,o),o}function G(){return this.s<0?this.negate():this}function q(o){
|
|
162
162
|
var l=this.s-o.s;if(l!=0)return l;var c=this.t;if(l=c-o.t,l!=0)return this.s<0?-l:l;for(;--c>=0;)if((l=this[c]-o[c])!=0)return l;return 0}function X(o){var l=1,c;return(c=o>>>16)!=0&&(o=c,l+=16),(c=o>>
|
|
163
163
|
8)!=0&&(o=c,l+=8),(c=o>>4)!=0&&(o=c,l+=4),(c=o>>2)!=0&&(o=c,l+=2),(c=o>>1)!=0&&(o=c,l+=1),l}function te(){return this.t<=0?0:this.DB*(this.t-1)+X(this[this.t-1]^this.s&this.DM)}function ce(o,l){var c;
|
|
164
164
|
for(c=this.t-1;c>=0;--c)l[c+o]=this[c];for(c=o-1;c>=0;--c)l[c]=0;l.t=this.t+o,l.s=this.s}function ue(o,l){for(var c=o;c<this.t;++c)l[c-o]=this[c];l.t=Math.max(this.t-o,0),l.s=this.s}function ie(o,l){var c=o%
|
|
165
165
|
this.DB,p=this.DB-c,y=(1<<p)-1,k=Math.floor(o/this.DB),B=this.s<<c&this.DM,L;for(L=this.t-1;L>=0;--L)l[L+k+1]=this[L]>>p|B,B=(this[L]&y)<<c;for(L=k-1;L>=0;--L)l[L]=0;l[k]=B,l.t=this.t+k+1,l.s=this.s,l.
|
|
166
|
-
clamp()}function
|
|
166
|
+
clamp()}function fe(o,l){l.s=this.s;var c=Math.floor(o/this.DB);if(c>=this.t){l.t=0;return}var p=o%this.DB,y=this.DB-p,k=(1<<p)-1;l[0]=this[c]>>p;for(var B=c+1;B<this.t;++B)l[B-c-1]|=(this[B]&k)<<y,l[B-
|
|
167
167
|
c]=this[B]>>p;p>0&&(l[this.t-c-1]|=(this.s&k)<<y),l.t=this.t-c,l.clamp()}function ve(o,l){for(var c=0,p=0,y=Math.min(o.t,this.t);c<y;)p+=this[c]-o[c],l[c++]=p&this.DM,p>>=this.DB;if(o.t<this.t){for(p-=
|
|
168
168
|
o.s;c<this.t;)p+=this[c],l[c++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;c<o.t;)p-=o[c],l[c++]=p&this.DM,p>>=this.DB;p-=o.s}l.s=p<0?-1:0,p<-1?l[c++]=this.DV+p:p>0&&(l[c++]=p),l.t=c,l.clamp()}
|
|
169
|
-
function ne(o,l){var c=this.abs(),p=o.abs(),y=c.t;for(l.t=y+p.t;--y>=0;)l[y]=0;for(y=0;y<p.t;++y)l[y+c.t]=c.am(0,p[y],l,y,0,c.t);l.s=0,l.clamp(),this.s!=o.s&&
|
|
169
|
+
function ne(o,l){var c=this.abs(),p=o.abs(),y=c.t;for(l.t=y+p.t;--y>=0;)l[y]=0;for(y=0;y<p.t;++y)l[y+c.t]=c.am(0,p[y],l,y,0,c.t);l.s=0,l.clamp(),this.s!=o.s&&f.ZERO.subTo(l,l)}function ye(o){for(var l=this.
|
|
170
170
|
abs(),c=o.t=2*l.t;--c>=0;)o[c]=0;for(c=0;c<l.t-1;++c){var p=l.am(c,l[c],o,2*c,0,1);(o[c+l.t]+=l.am(c+1,2*l[c],o,2*c+1,p,l.t-c-1))>=l.DV&&(o[c+l.t]-=l.DV,o[c+l.t+1]=1)}o.t>0&&(o[o.t-1]+=l.am(c,l[c],o,2*
|
|
171
|
-
c,0,1)),o.s=0,o.clamp()}function Be(o,l,c){var p=o.abs();if(!(p.t<=0)){var y=this.abs();if(y.t<p.t){l?.fromInt(0),c!=null&&this.copyTo(c);return}c==null&&(c=
|
|
172
|
-
t-1]);F>0?(p.lShiftTo(F,k),y.lShiftTo(F,c)):(p.copyTo(k),y.copyTo(c));var U=k.t,oe=k[U-1];if(oe!=0){var K=oe*(1<<this.F1)+(U>1?k[U-2]>>this.F2:0),
|
|
173
|
-
U,Mt=l??
|
|
174
|
-
1]+
|
|
175
|
-
0&&
|
|
171
|
+
c,0,1)),o.s=0,o.clamp()}function Be(o,l,c){var p=o.abs();if(!(p.t<=0)){var y=this.abs();if(y.t<p.t){l?.fromInt(0),c!=null&&this.copyTo(c);return}c==null&&(c=h());var k=h(),B=this.s,L=o.s,F=this.DB-X(p[p.
|
|
172
|
+
t-1]);F>0?(p.lShiftTo(F,k),y.lShiftTo(F,c)):(p.copyTo(k),y.copyTo(c));var U=k.t,oe=k[U-1];if(oe!=0){var K=oe*(1<<this.F1)+(U>1?k[U-2]>>this.F2:0),he=this.FV/K,ke=(1<<this.F1)/K,Ne=1<<this.F2,Qe=c.t,ze=Qe-
|
|
173
|
+
U,Mt=l??h();for(k.dlShiftTo(ze,Mt),c.compareTo(Mt)>=0&&(c[c.t++]=1,c.subTo(Mt,c)),f.ONE.dlShiftTo(U,Mt),Mt.subTo(k,k);k.t<U;)k[k.t++]=0;for(;--ze>=0;){var rn=c[--Qe]==oe?this.DM:Math.floor(c[Qe]*he+(c[Qe-
|
|
174
|
+
1]+Ne)*ke);if((c[Qe]+=k.am(0,rn,c,ze,0,U))<rn)for(k.dlShiftTo(ze,Mt),c.subTo(Mt,c);c[Qe]<--rn;)c.subTo(Mt,c)}l!=null&&(c.drShiftTo(U,l),B!=L&&f.ZERO.subTo(l,l)),c.t=U,c.clamp(),F>0&&c.rShiftTo(F,c),B<
|
|
175
|
+
0&&f.ZERO.subTo(c,c)}}}function Ee(o){var l=h();return this.abs().divRemTo(o,null,l),this.s<0&&l.compareTo(f.ZERO)>0&&o.subTo(l,l),l}function We(o){this.m=o}function at(o){return o.s<0||o.compareTo(this.
|
|
176
176
|
m)>=0?o.mod(this.m):o}function lt(o){return o}function wt(o){o.divRemTo(this.m,null,o)}function nn(o,l,c){o.multiplyTo(l,c),this.reduce(c)}function yt(o,l){o.squareTo(l),this.reduce(l)}We.prototype.convert=
|
|
177
177
|
at,We.prototype.revert=lt,We.prototype.reduce=wt,We.prototype.mulTo=nn,We.prototype.sqrTo=yt;function Bt(){if(this.t<1)return 0;var o=this[0];if((o&1)==0)return 0;var l=o&3;return l=l*(2-(o&15)*l)&15,
|
|
178
178
|
l=l*(2-(o&255)*l)&255,l=l*(2-((o&65535)*l&65535))&65535,l=l*(2-o*l%this.DV)%this.DV,l>0?this.DV-l:-l}function Ze(o){this.m=o,this.mp=o.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<
|
|
179
|
-
o.DB-15)-1,this.mt2=2*o.t}function ae(o){var l=
|
|
179
|
+
o.DB-15)-1,this.mt2=2*o.t}function ae(o){var l=h();return o.abs().dlShiftTo(this.m.t,l),l.divRemTo(this.m,null,l),o.s<0&&l.compareTo(f.ZERO)>0&&this.m.subTo(l,l),l}function xe(o){var l=h();return o.copyTo(
|
|
180
180
|
l),this.reduce(l),l}function Te(o){for(;o.t<=this.mt2;)o[o.t++]=0;for(var l=0;l<this.m.t;++l){var c=o[l]&32767,p=c*this.mpl+((c*this.mph+(o[l]>>15)*this.mpl&this.um)<<15)&o.DM;for(c=l+this.m.t,o[c]+=this.
|
|
181
181
|
m.am(0,p,o,l,0,this.m.t);o[c]>=o.DV;)o[c]-=o.DV,o[++c]++}o.clamp(),o.drShiftTo(this.m.t,o),o.compareTo(this.m)>=0&&o.subTo(this.m,o)}function Xe(o,l){o.squareTo(l),this.reduce(l)}function it(o,l,c){o.
|
|
182
182
|
multiplyTo(l,c),this.reduce(c)}Ze.prototype.convert=ae,Ze.prototype.revert=xe,Ze.prototype.reduce=Te,Ze.prototype.mulTo=it,Ze.prototype.sqrTo=Xe;function kt(){return(this.t>0?this[0]&1:this.s)==0}function He(o,l){
|
|
183
|
-
if(o>4294967295||o<1)return
|
|
184
|
-
var c;return o<256||l.isEven()?c=new We(l):c=new Ze(l),this.exp(o,c)}
|
|
185
|
-
ue,
|
|
186
|
-
exp=He,
|
|
183
|
+
if(o>4294967295||o<1)return f.ONE;var c=h(),p=h(),y=l.convert(this),k=X(o)-1;for(y.copyTo(c);--k>=0;)if(l.sqrTo(c,p),(o&1<<k)>0)l.mulTo(p,y,c);else{var B=c;c=p,p=B}return l.revert(c)}function Je(o,l){
|
|
184
|
+
var c;return o<256||l.isEven()?c=new We(l):c=new Ze(l),this.exp(o,c)}f.prototype.copyTo=T,f.prototype.fromInt=M,f.prototype.fromString=S,f.prototype.clamp=_,f.prototype.dlShiftTo=ce,f.prototype.drShiftTo=
|
|
185
|
+
ue,f.prototype.lShiftTo=ie,f.prototype.rShiftTo=fe,f.prototype.subTo=ve,f.prototype.multiplyTo=ne,f.prototype.squareTo=ye,f.prototype.divRemTo=Be,f.prototype.invDigit=Bt,f.prototype.isEven=kt,f.prototype.
|
|
186
|
+
exp=He,f.prototype.toString=Q,f.prototype.negate=Y,f.prototype.abs=G,f.prototype.compareTo=q,f.prototype.bitLength=te,f.prototype.mod=Ee,f.prototype.modPowInt=Je,f.ZERO=R(0),f.ONE=R(1);function dt(){var o=h();
|
|
187
187
|
return this.copyTo(o),o}function Ct(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.
|
|
188
188
|
DB|this[0]}function Ht(){return this.t==0?this.s:this[0]<<24>>24}function Et(){return this.t==0?this.s:this[0]<<16>>16}function Ii(o){return Math.floor(Math.LN2*this.DB/Math.log(o))}function Qt(){return this.
|
|
189
|
-
s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Hs(o){if(o==null&&(o=10),this.signum()==0||o<2||o>36)return"0";var l=this.chunkSize(o),c=Math.pow(o,l),p=R(c),y=
|
|
189
|
+
s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Hs(o){if(o==null&&(o=10),this.signum()==0||o<2||o>36)return"0";var l=this.chunkSize(o),c=Math.pow(o,l),p=R(c),y=h(),k=h(),B="";for(this.divRemTo(p,
|
|
190
190
|
y,k);y.signum()>0;)B=(c+k.intValue()).toString(o).substr(1)+B,y.divRemTo(p,y,k);return k.intValue().toString(o)+B}function $s(o,l){this.fromInt(0),l==null&&(l=10);for(var c=this.chunkSize(l),p=Math.pow(
|
|
191
191
|
l,c),y=!1,k=0,B=0,L=0;L<o.length;++L){var F=E(o,L);if(F<0){o.charAt(L)=="-"&&this.signum()==0&&(y=!0);continue}B=l*B+F,++k>=c&&(this.dMultiply(p),this.dAddOffset(B,0),k=0,B=0)}k>0&&(this.dMultiply(Math.
|
|
192
|
-
pow(l,k)),this.dAddOffset(B,0)),y&&
|
|
193
|
-
o-1),
|
|
192
|
+
pow(l,k)),this.dAddOffset(B,0)),y&&f.ZERO.subTo(this,this)}function Us(o,l,c){if(typeof l=="number")if(o<2)this.fromInt(1);else for(this.fromNumber(o,c),this.testBit(o-1)||this.bitwiseTo(f.ONE.shiftLeft(
|
|
193
|
+
o-1),O,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(l);)this.dAddOffset(2,0),this.bitLength()>o&&this.subTo(f.ONE.shiftLeft(o-1),this);else{var p=new Array,y=o&7;p.length=(o>>3)+1,l.
|
|
194
194
|
nextBytes(p),y>0?p[0]&=(1<<y)-1:p[0]=0,this.fromString(p,256)}}function zs(){var o=this.t,l=new Array;l[0]=this.s;var c=this.DB-o*this.DB%8,p,y=0;if(o-- >0)for(c<this.DB&&(p=this[o]>>c)!=(this.s&this.
|
|
195
195
|
DM)>>c&&(l[y++]=p|this.s<<this.DB-c);o>=0;)c<8?(p=(this[o]&(1<<c)-1)<<8-c,p|=this[--o]>>(c+=this.DB-8)):(p=this[o]>>(c-=8)&255,c<=0&&(c+=this.DB,--o)),(p&128)!=0&&(p|=-256),y==0&&(this.s&128)!=(p&128)&&
|
|
196
196
|
++y,(y>0||p!=this.s)&&(l[y++]=p);return l}function wi(o){return this.compareTo(o)==0}function W(o){return this.compareTo(o)<0?this:o}function I(o){return this.compareTo(o)>0?this:o}function C(o,l,c){var p,
|
|
197
197
|
y,k=Math.min(o.t,this.t);for(p=0;p<k;++p)c[p]=l(this[p],o[p]);if(o.t<this.t){for(y=o.s&this.DM,p=k;p<this.t;++p)c[p]=l(this[p],y);c.t=this.t}else{for(y=this.s&this.DM,p=k;p<o.t;++p)c[p]=l(y,o[p]);c.t=
|
|
198
|
-
o.t}c.s=l(this.s,o.s),c.clamp()}function D(o,l){return o&l}function
|
|
199
|
-
return o^l}function ee(o){var l=
|
|
200
|
-
this.DM&~this[l];return o.t=this.t,o.s=~this.s,o}function re(o){var l=
|
|
198
|
+
o.t}c.s=l(this.s,o.s),c.clamp()}function D(o,l){return o&l}function N(o){var l=h();return this.bitwiseTo(o,D,l),l}function O(o,l){return o|l}function j(o){var l=h();return this.bitwiseTo(o,O,l),l}function H(o,l){
|
|
199
|
+
return o^l}function ee(o){var l=h();return this.bitwiseTo(o,H,l),l}function Z(o,l){return o&~l}function de(o){var l=h();return this.bitwiseTo(o,Z,l),l}function $(){for(var o=h(),l=0;l<this.t;++l)o[l]=
|
|
200
|
+
this.DM&~this[l];return o.t=this.t,o.s=~this.s,o}function re(o){var l=h();return o<0?this.rShiftTo(-o,l):this.lShiftTo(o,l),l}function le(o){var l=h();return o<0?this.lShiftTo(-o,l):this.rShiftTo(o,l),
|
|
201
201
|
l}function Se(o){if(o==0)return-1;var l=0;return(o&65535)==0&&(o>>=16,l+=16),(o&255)==0&&(o>>=8,l+=8),(o&15)==0&&(o>>=4,l+=4),(o&3)==0&&(o>>=2,l+=2),(o&1)==0&&++l,l}function Ie(){for(var o=0;o<this.t;++o)
|
|
202
202
|
if(this[o]!=0)return o*this.DB+Se(this[o]);return this.s<0?this.t*this.DB:-1}function Fe(o){for(var l=0;o!=0;)o&=o-1,++l;return l}function Pe(){for(var o=0,l=this.s&this.DM,c=0;c<this.t;++c)o+=Fe(this[c]^
|
|
203
|
-
l);return o}function Ve(o){var l=Math.floor(o/this.DB);return l>=this.t?this.s!=0:(this[l]&1<<o%this.DB)!=0}function ut(o,l){var c=
|
|
204
|
-
changeBit(o,
|
|
203
|
+
l);return o}function Ve(o){var l=Math.floor(o/this.DB);return l>=this.t?this.s!=0:(this[l]&1<<o%this.DB)!=0}function ut(o,l){var c=f.ONE.shiftLeft(o);return this.bitwiseTo(c,l,c),c}function ot(o){return this.
|
|
204
|
+
changeBit(o,O)}function ct(o){return this.changeBit(o,Z)}function ft(o){return this.changeBit(o,H)}function Pt(o,l){for(var c=0,p=0,y=Math.min(o.t,this.t);c<y;)p+=this[c]+o[c],l[c++]=p&this.DM,p>>=this.
|
|
205
205
|
DB;if(o.t<this.t){for(p+=o.s;c<this.t;)p+=this[c],l[c++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;c<o.t;)p+=o[c],l[c++]=p&this.DM,p>>=this.DB;p+=o.s}l.s=p<0?-1:0,p>0?l[c++]=p:p<-1&&(l[c++]=this.
|
|
206
|
-
DV+p),l.t=c,l.clamp()}function
|
|
207
|
-
return this.squareTo(o),o}function Wt(o){var l=
|
|
206
|
+
DV+p),l.t=c,l.clamp()}function ht(o){var l=h();return this.addTo(o,l),l}function Lt(o){var l=h();return this.subTo(o,l),l}function Ft(o){var l=h();return this.multiplyTo(o,l),l}function Yt(){var o=h();
|
|
207
|
+
return this.squareTo(o),o}function Wt(o){var l=h();return this.divRemTo(o,l,null),l}function Zt(o){var l=h();return this.divRemTo(o,null,l),l}function Fn(o){var l=h(),c=h();return this.divRemTo(o,l,c),
|
|
208
208
|
new Array(l,c)}function ki(o){this[this.t]=this.am(0,o-1,this,0,0,this.t),++this.t,this.clamp()}function Ci(o,l){if(o!=0){for(;this.t<=l;)this[this.t++]=0;for(this[l]+=o;this[l]>=this.DV;)this[l]-=this.
|
|
209
209
|
DV,++l>=this.t&&(this[this.t++]=0),++this[l]}}function Yn(){}function js(o){return o}function Xc(o,l,c){o.multiplyTo(l,c)}function Gc(o,l){o.squareTo(l)}Yn.prototype.convert=js,Yn.prototype.revert=js,
|
|
210
210
|
Yn.prototype.mulTo=Xc,Yn.prototype.sqrTo=Gc;function qc(o){return this.exp(o,new Yn)}function Hc(o,l,c){var p=Math.min(this.t+o.t,l);for(c.s=0,c.t=p;p>0;)c[--p]=0;var y;for(y=c.t-this.t;p<y;++p)c[p+this.
|
|
211
211
|
t]=this.am(0,o[p],c,p,0,this.t);for(y=Math.min(o.t,l);p<y;++p)this.am(0,o[p],c,p,0,l-p);c.clamp()}function $c(o,l,c){--l;var p=c.t=this.t+o.t-l;for(c.s=0;--p>=0;)c[p]=0;for(p=Math.max(l-this.t,0);p<o.
|
|
212
|
-
t;++p)c[this.t+p-l]=this.am(l-p,o[p],c,0,0,this.t+p-l);c.clamp(),c.drShiftTo(1,c)}function gr(o){this.r2=
|
|
213
|
-
if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var l=
|
|
212
|
+
t;++p)c[this.t+p-l]=this.am(l-p,o[p],c,0,0,this.t+p-l);c.clamp(),c.drShiftTo(1,c)}function gr(o){this.r2=h(),this.q3=h(),f.ONE.dlShiftTo(2*o.t,this.r2),this.mu=this.r2.divide(o),this.m=o}function Uc(o){
|
|
213
|
+
if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var l=h();return o.copyTo(l),this.reduce(l),l}function zc(o){return o}function jc(o){for(o.drShiftTo(this.m.t-1,this.r2),
|
|
214
214
|
o.t>this.m.t+1&&(o.t=this.m.t+1,o.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);o.compareTo(this.r2)<0;)o.dAddOffset(1,this.m.t+1);for(o.
|
|
215
215
|
subTo(this.r2,o);o.compareTo(this.m)>=0;)o.subTo(this.m,o)}function Vc(o,l){o.squareTo(l),this.reduce(l)}function Zc(o,l,c){o.multiplyTo(l,c),this.reduce(c)}gr.prototype.convert=Uc,gr.prototype.revert=
|
|
216
216
|
zc,gr.prototype.reduce=jc,gr.prototype.mulTo=Zc,gr.prototype.sqrTo=Vc;function Jc(o,l){var c=o.bitLength(),p,y=R(1),k;if(c<=0)return y;c<18?p=1:c<48?p=3:c<144?p=4:c<768?p=5:p=6,c<8?k=new We(l):l.isEven()?
|
|
217
|
-
k=new gr(l):k=new Ze(l);var B=new Array,L=3,F=p-1,U=(1<<p)-1;if(B[1]=k.convert(this),p>1){var oe=
|
|
218
|
-
X(o[K])-1;K>=0;){for(c>=F?
|
|
219
|
-
y,
|
|
217
|
+
k=new gr(l):k=new Ze(l);var B=new Array,L=3,F=p-1,U=(1<<p)-1;if(B[1]=k.convert(this),p>1){var oe=h();for(k.sqrTo(B[1],oe);L<=U;)B[L]=h(),k.mulTo(oe,B[L-2],B[L]),L+=2}var K=o.t-1,he,ke=!0,Ne=h(),Qe;for(c=
|
|
218
|
+
X(o[K])-1;K>=0;){for(c>=F?he=o[K]>>c-F&U:(he=(o[K]&(1<<c+1)-1)<<F-c,K>0&&(he|=o[K-1]>>this.DB+c-F)),L=p;(he&1)==0;)he>>=1,--L;if((c-=L)<0&&(c+=this.DB,--K),ke)B[he].copyTo(y),ke=!1;else{for(;L>1;)k.sqrTo(
|
|
219
|
+
y,Ne),k.sqrTo(Ne,y),L-=2;L>0?k.sqrTo(y,Ne):(Qe=y,y=Ne,Ne=Qe),k.mulTo(Ne,B[he],y)}for(;K>=0&&(o[K]&1<<c)==0;)k.sqrTo(y,Ne),Qe=y,y=Ne,Ne=Qe,--c<0&&(c=this.DB-1,--K)}return k.revert(y)}function Kc(o){var l=this.
|
|
220
220
|
s<0?this.negate():this.clone(),c=o.s<0?o.negate():o.clone();if(l.compareTo(c)<0){var p=l;l=c,c=p}var y=l.getLowestSetBit(),k=c.getLowestSetBit();if(k<0)return l;for(y<k&&(k=y),k>0&&(l.rShiftTo(k,l),c.
|
|
221
221
|
rShiftTo(k,c));l.signum()>0;)(y=l.getLowestSetBit())>0&&l.rShiftTo(y,l),(y=c.getLowestSetBit())>0&&c.rShiftTo(y,c),l.compareTo(c)>=0?(l.subTo(c,l),l.rShiftTo(1,l)):(c.subTo(l,c),c.rShiftTo(1,c));return k>
|
|
222
|
-
0&&c.lShiftTo(k,c),c}function
|
|
223
|
-
isEven();if(this.isEven()&&l||o.signum()==0)return
|
|
222
|
+
0&&c.lShiftTo(k,c),c}function ef(o){if(o<=0)return 0;var l=this.DV%o,c=this.s<0?o-1:0;if(this.t>0)if(l==0)c=this[0]%o;else for(var p=this.t-1;p>=0;--p)c=(l*c+this[p])%o;return c}function tf(o){var l=o.
|
|
223
|
+
isEven();if(this.isEven()&&l||o.signum()==0)return f.ZERO;for(var c=o.clone(),p=this.clone(),y=R(1),k=R(0),B=R(0),L=R(1);c.signum()!=0;){for(;c.isEven();)c.rShiftTo(1,c),l?((!y.isEven()||!k.isEven())&&
|
|
224
224
|
(y.addTo(this,y),k.subTo(o,k)),y.rShiftTo(1,y)):k.isEven()||k.subTo(o,k),k.rShiftTo(1,k);for(;p.isEven();)p.rShiftTo(1,p),l?((!B.isEven()||!L.isEven())&&(B.addTo(this,B),L.subTo(o,L)),B.rShiftTo(1,B)):
|
|
225
|
-
L.isEven()||L.subTo(o,L),L.rShiftTo(1,L);c.compareTo(p)>=0?(c.subTo(p,c),l&&y.subTo(B,y),k.subTo(L,k)):(p.subTo(c,p),l&&B.subTo(y,B),L.subTo(k,L))}if(p.compareTo(
|
|
225
|
+
L.isEven()||L.subTo(o,L),L.rShiftTo(1,L);c.compareTo(p)>=0?(c.subTo(p,c),l&&y.subTo(B,y),k.subTo(L,k)):(p.subTo(c,p),l&&B.subTo(y,B),L.subTo(k,L))}if(p.compareTo(f.ONE)!=0)return f.ZERO;if(L.compareTo(
|
|
226
226
|
o)>=0)return L.subtract(o);if(L.signum()<0)L.addTo(o,L);else return L;return L.signum()<0?L.add(o):L}var St=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,
|
|
227
227
|
127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
|
|
228
228
|
419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,
|
|
229
|
-
739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],
|
|
230
|
-
c=this.abs();if(c.t==1&&c[0]<=St[St.length-1]){for(l=0;l<St.length;++l)if(c[0]==St[l])return!0;return!1}if(c.isEven())return!1;for(l=1;l<St.length;){for(var p=St[l],y=l+1;y<St.length&&p<
|
|
231
|
-
for(p=c.modInt(p);l<y;)if(p%St[l++]==0)return!1}return c.millerRabin(o)}function
|
|
232
|
-
St.length);for(var y=
|
|
233
|
-
2,this),B.compareTo(
|
|
234
|
-
C,
|
|
235
|
-
|
|
236
|
-
max=I,
|
|
237
|
-
Pe,
|
|
238
|
-
Zt,
|
|
239
|
-
function(){return this.compareTo(
|
|
240
|
-
compareTo(l)>0},
|
|
241
|
-
o,void 0,void 0).subtract(new
|
|
229
|
+
739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],nf=(1<<26)/St[St.length-1];function rf(o){var l,
|
|
230
|
+
c=this.abs();if(c.t==1&&c[0]<=St[St.length-1]){for(l=0;l<St.length;++l)if(c[0]==St[l])return!0;return!1}if(c.isEven())return!1;for(l=1;l<St.length;){for(var p=St[l],y=l+1;y<St.length&&p<nf;)p*=St[y++];
|
|
231
|
+
for(p=c.modInt(p);l<y;)if(p%St[l++]==0)return!1}return c.millerRabin(o)}function of(o){var l=this.subtract(f.ONE),c=l.getLowestSetBit();if(c<=0)return!1;var p=l.shiftRight(c);o=o+1>>1,o>St.length&&(o=
|
|
232
|
+
St.length);for(var y=h(),k=0;k<o;++k){y.fromInt(St[Math.floor(.5*St.length)]);var B=y.modPow(p,this);if(B.compareTo(f.ONE)!=0&&B.compareTo(l)!=0){for(var L=1;L++<c&&B.compareTo(l)!=0;)if(B=B.modPowInt(
|
|
233
|
+
2,this),B.compareTo(f.ONE)==0)return!1;if(B.compareTo(l)!=0)return!1}}return!0}f.prototype.chunkSize=Ii,f.prototype.toRadix=Hs,f.prototype.fromRadix=$s,f.prototype.fromNumber=Us,f.prototype.bitwiseTo=
|
|
234
|
+
C,f.prototype.changeBit=ut,f.prototype.addTo=Pt,f.prototype.dMultiply=ki,f.prototype.dAddOffset=Ci,f.prototype.multiplyLowerTo=Hc,f.prototype.multiplyUpperTo=$c,f.prototype.modInt=ef,f.prototype.millerRabin=
|
|
235
|
+
of,f.prototype.clone=dt,f.prototype.intValue=Ct,f.prototype.byteValue=Ht,f.prototype.shortValue=Et,f.prototype.signum=Qt,f.prototype.toByteArray=zs,f.prototype.equals=wi,f.prototype.min=W,f.prototype.
|
|
236
|
+
max=I,f.prototype.and=N,f.prototype.or=j,f.prototype.xor=ee,f.prototype.andNot=de,f.prototype.not=$,f.prototype.shiftLeft=re,f.prototype.shiftRight=le,f.prototype.getLowestSetBit=Ie,f.prototype.bitCount=
|
|
237
|
+
Pe,f.prototype.testBit=Ve,f.prototype.setBit=ot,f.prototype.clearBit=ct,f.prototype.flipBit=ft,f.prototype.add=ht,f.prototype.subtract=Lt,f.prototype.multiply=Ft,f.prototype.divide=Wt,f.prototype.remainder=
|
|
238
|
+
Zt,f.prototype.divideAndRemainder=Fn,f.prototype.modPow=Jc,f.prototype.modInverse=tf,f.prototype.pow=qc,f.prototype.gcd=Kc,f.prototype.isProbablePrime=rf,f.prototype.square=Yt;var Oe=f;Oe.prototype.IsNegative=
|
|
239
|
+
function(){return this.compareTo(Oe.ZERO)==-1},Oe.op_Equality=function(o,l){return o.compareTo(l)==0},Oe.op_Inequality=function(o,l){return o.compareTo(l)!=0},Oe.op_GreaterThan=function(o,l){return o.
|
|
240
|
+
compareTo(l)>0},Oe.op_LessThan=function(o,l){return o.compareTo(l)<0},Oe.op_Addition=function(o,l){return new Oe(o,void 0,void 0).add(new Oe(l,void 0,void 0))},Oe.op_Subtraction=function(o,l){return new Oe(
|
|
241
|
+
o,void 0,void 0).subtract(new Oe(l,void 0,void 0))},Oe.Int128Mul=function(o,l){return new Oe(o,void 0,void 0).multiply(new Oe(l,void 0,void 0))},Oe.op_Division=function(o,l){return o.divide(l)},Oe.prototype.
|
|
242
242
|
ToDouble=function(){return parseFloat(this.toString())};var Vs=function(o,l){var c;if(typeof Object.getOwnPropertyNames>"u"){for(c in l.prototype)(typeof o.prototype[c]>"u"||o.prototype[c]===Object.prototype[c])&&
|
|
243
243
|
(o.prototype[c]=l.prototype[c]);for(c in l)typeof o[c]>"u"&&(o[c]=l[c]);o.$baseCtor=l}else{for(var p=Object.getOwnPropertyNames(l.prototype),y=0;y<p.length;y++)typeof Object.getOwnPropertyDescriptor(o.
|
|
244
244
|
prototype,p[y])>"u"&&Object.defineProperty(o.prototype,p[y],Object.getOwnPropertyDescriptor(l.prototype,p[y]));for(c in l)typeof o[c]>"u"&&(o[c]=l[c]);o.$baseCtor=l}};e.Path=function(){return[]},e.Path.
|
|
@@ -276,15 +276,15 @@ IntPoint0,this.Next=null,this.Prev=null},e.Join=function(){this.OutPt1=null,this
|
|
|
276
276
|
new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},e.ClipperBase.horizontal=-9007199254740992,e.ClipperBase.
|
|
277
277
|
Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.loRange=47453132,e.ClipperBase.hiRange=0xfffffffffffff,e.ClipperBase.near_zero=function(o){return o>-e.ClipperBase.tolerance&&
|
|
278
278
|
o<e.ClipperBase.tolerance},e.ClipperBase.IsHorizontal=function(o){return o.Delta.Y===0},e.ClipperBase.prototype.PointIsVertex=function(o,l){var c=l;do{if(e.IntPoint.op_Equality(c.Pt,o))return!0;c=c.Next}while(c!==
|
|
279
|
-
l);return!1},e.ClipperBase.prototype.PointOnLineSegment=function(o,l,c,p){return p?o.X===l.X&&o.Y===l.Y||o.X===c.X&&o.Y===c.Y||o.X>l.X==o.X<c.X&&o.Y>l.Y==o.Y<c.Y&&
|
|
280
|
-
Y-l.Y),
|
|
279
|
+
l);return!1},e.ClipperBase.prototype.PointOnLineSegment=function(o,l,c,p){return p?o.X===l.X&&o.Y===l.Y||o.X===c.X&&o.Y===c.Y||o.X>l.X==o.X<c.X&&o.Y>l.Y==o.Y<c.Y&&Oe.op_Equality(Oe.Int128Mul(o.X-l.X,c.
|
|
280
|
+
Y-l.Y),Oe.Int128Mul(c.X-l.X,o.Y-l.Y)):o.X===l.X&&o.Y===l.Y||o.X===c.X&&o.Y===c.Y||o.X>l.X==o.X<c.X&&o.Y>l.Y==o.Y<c.Y&&(o.X-l.X)*(c.Y-l.Y)===(c.X-l.X)*(o.Y-l.Y)},e.ClipperBase.prototype.PointOnPolygon=
|
|
281
281
|
function(o,l,c){for(var p=l;;){if(this.PointOnLineSegment(o,p.Pt,p.Next.Pt,c))return!0;if(p=p.Next,p===l)break}return!1},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var o=arguments,
|
|
282
|
-
l=o.length,c,p,y,k,B,L,F;return l===3?(c=o[0],p=o[1],F=o[2],F?
|
|
283
|
-
X*p.Delta.Y)):l===4?(y=o[0],k=o[1],B=o[2],F=o[3],F?
|
|
284
|
-
(y=o[0],k=o[1],B=o[2],L=o[3],F=o[4],F?
|
|
285
|
-
SlopesEqual3=function(o,l,c){return c?
|
|
286
|
-
SlopesEqual4=function(o,l,c,p){return p?
|
|
287
|
-
SlopesEqual5=function(o,l,c,p,y){return y?
|
|
282
|
+
l=o.length,c,p,y,k,B,L,F;return l===3?(c=o[0],p=o[1],F=o[2],F?Oe.op_Equality(Oe.Int128Mul(c.Delta.Y,p.Delta.X),Oe.Int128Mul(c.Delta.X,p.Delta.Y)):e.Cast_Int64(c.Delta.Y*p.Delta.X)===e.Cast_Int64(c.Delta.
|
|
283
|
+
X*p.Delta.Y)):l===4?(y=o[0],k=o[1],B=o[2],F=o[3],F?Oe.op_Equality(Oe.Int128Mul(y.Y-k.Y,k.X-B.X),Oe.Int128Mul(y.X-k.X,k.Y-B.Y)):e.Cast_Int64((y.Y-k.Y)*(k.X-B.X))-e.Cast_Int64((y.X-k.X)*(k.Y-B.Y))===0):
|
|
284
|
+
(y=o[0],k=o[1],B=o[2],L=o[3],F=o[4],F?Oe.op_Equality(Oe.Int128Mul(y.Y-k.Y,B.X-L.X),Oe.Int128Mul(y.X-k.X,B.Y-L.Y)):e.Cast_Int64((y.Y-k.Y)*(B.X-L.X))-e.Cast_Int64((y.X-k.X)*(B.Y-L.Y))===0)},e.ClipperBase.
|
|
285
|
+
SlopesEqual3=function(o,l,c){return c?Oe.op_Equality(Oe.Int128Mul(o.Delta.Y,l.Delta.X),Oe.Int128Mul(o.Delta.X,l.Delta.Y)):e.Cast_Int64(o.Delta.Y*l.Delta.X)===e.Cast_Int64(o.Delta.X*l.Delta.Y)},e.ClipperBase.
|
|
286
|
+
SlopesEqual4=function(o,l,c,p){return p?Oe.op_Equality(Oe.Int128Mul(o.Y-l.Y,l.X-c.X),Oe.Int128Mul(o.X-l.X,l.Y-c.Y)):e.Cast_Int64((o.Y-l.Y)*(l.X-c.X))-e.Cast_Int64((o.X-l.X)*(l.Y-c.Y))===0},e.ClipperBase.
|
|
287
|
+
SlopesEqual5=function(o,l,c,p,y){return y?Oe.op_Equality(Oe.Int128Mul(o.Y-l.Y,c.X-p.X),Oe.Int128Mul(o.X-l.X,c.Y-p.Y)):e.Cast_Int64((o.Y-l.Y)*(c.X-p.X))-e.Cast_Int64((o.X-l.X)*(c.Y-p.Y))===0},e.ClipperBase.
|
|
288
288
|
prototype.Clear=function(){this.DisposeLocalMinimaList();for(var o=0,l=this.m_edges.length;o<l;++o){for(var c=0,p=this.m_edges[o].length;c<p;++c)this.m_edges[o][c]=null;e.Clear(this.m_edges[o])}e.Clear(
|
|
289
289
|
this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var o=this.m_MinimaList.Next;this.m_MinimaList=null,
|
|
290
290
|
this.m_MinimaList=o}this.m_CurrentLM=null},e.ClipperBase.prototype.RangeTest=function(o,l){l.Value?(o.X>e.ClipperBase.hiRange||o.Y>e.ClipperBase.hiRange||-o.X>e.ClipperBase.hiRange||-o.Y>e.ClipperBase.
|
|
@@ -311,11 +311,11 @@ SlopesEqual4(U.Prev.Curr,U.Curr,U.Next.Curr,this.m_UseFullRange)&&(!this.Preserv
|
|
|
311
311
|
oe=U;continue}if(U=U.Next,U===oe||!c&&U.Next===F)break}if(!c&&U===U.Next||c&&U.Prev===U.Next)return!1;c||(this.m_HasOpenPaths=!0,F.Prev.OutIdx=e.ClipperBase.Skip),U=F;do this.InitEdge2(U,l),U=U.Next,B&&
|
|
312
312
|
U.Curr.Y!==F.Curr.Y&&(B=!1);while(U!==F);if(B){if(c)return!1;U.Prev.OutIdx=e.ClipperBase.Skip;var K=new e.LocalMinima;for(K.Next=null,K.Y=U.Bot.Y,K.LeftBound=null,K.RightBound=U,K.RightBound.Side=e.EdgeSide.
|
|
313
313
|
esRight,K.RightBound.WindDelta=0;U.Bot.X!==U.Prev.Top.X&&this.ReverseHorizontal(U),U.Next.OutIdx!==e.ClipperBase.Skip;)U.NextInLML=U.Next,U=U.Next;return this.InsertLocalMinima(K),this.m_edges.push(y),
|
|
314
|
-
!0}this.m_edges.push(y);var
|
|
315
|
-
U.Dx<U.Prev.Dx?(K.LeftBound=U.Prev,K.RightBound=U,
|
|
316
|
-
K.LeftBound.WindDelta=-1:K.LeftBound.WindDelta=1:K.LeftBound.WindDelta=0,K.RightBound.WindDelta=-K.LeftBound.WindDelta,U=this.ProcessBound(K.LeftBound,
|
|
317
|
-
U,
|
|
318
|
-
Skip&&(K.RightBound=null),this.InsertLocalMinima(K),
|
|
314
|
+
!0}this.m_edges.push(y);var he,ke=null;for(e.IntPoint.op_Equality(U.Prev.Bot,U.Prev.Top)&&(U=U.Next);U=this.FindNextLocMin(U),U!==ke;){ke===null&&(ke=U);var K=new e.LocalMinima;K.Next=null,K.Y=U.Bot.Y,
|
|
315
|
+
U.Dx<U.Prev.Dx?(K.LeftBound=U.Prev,K.RightBound=U,he=!1):(K.LeftBound=U,K.RightBound=U.Prev,he=!0),K.LeftBound.Side=e.EdgeSide.esLeft,K.RightBound.Side=e.EdgeSide.esRight,c?K.LeftBound.Next===K.RightBound?
|
|
316
|
+
K.LeftBound.WindDelta=-1:K.LeftBound.WindDelta=1:K.LeftBound.WindDelta=0,K.RightBound.WindDelta=-K.LeftBound.WindDelta,U=this.ProcessBound(K.LeftBound,he),U.OutIdx===e.ClipperBase.Skip&&(U=this.ProcessBound(
|
|
317
|
+
U,he));var Ne=this.ProcessBound(K.RightBound,!he);Ne.OutIdx===e.ClipperBase.Skip&&(Ne=this.ProcessBound(Ne,!he)),K.LeftBound.OutIdx===e.ClipperBase.Skip?K.LeftBound=null:K.RightBound.OutIdx===e.ClipperBase.
|
|
318
|
+
Skip&&(K.RightBound=null),this.InsertLocalMinima(K),he||(U=Ne)}return!0},e.ClipperBase.prototype.AddPaths=function(o,l,c){for(var p=!1,y=0,k=o.length;y<k;++y)this.AddPath(o[y],l,c)&&(p=!0);return p},e.
|
|
319
319
|
ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(o,l,c){return e.IntPoint.op_Equality(o,c)||e.IntPoint.op_Equality(o,l)||e.IntPoint.op_Equality(c,l)?!1:o.X!==c.X?l.X>o.X==l.X<c.X:l.Y>o.Y==l.Y<c.Y},
|
|
320
320
|
e.ClipperBase.prototype.RemoveEdge=function(o){o.Prev.Next=o.Next,o.Next.Prev=o.Prev;var l=o.Next;return o.Prev=null,l},e.ClipperBase.prototype.SetDx=function(o){o.Delta.X=o.Top.X-o.Bot.X,o.Delta.Y=o.
|
|
321
321
|
Top.Y-o.Bot.Y,o.Delta.Y===0?o.Dx=e.ClipperBase.horizontal:o.Dx=o.Delta.X/o.Delta.Y},e.ClipperBase.prototype.InsertLocalMinima=function(o){if(this.m_MinimaList===null)this.m_MinimaList=o;else if(o.Y>=this.
|
|
@@ -427,10 +427,10 @@ k}else o.WindCnt+l.WindDelta===0?o.WindCnt=-o.WindCnt:o.WindCnt+=l.WindDelta,l.W
|
|
|
427
427
|
pftPositive:oe=o.WindCnt;break;case e.PolyFillType.pftNegative:oe=-o.WindCnt;break;default:oe=Math.abs(o.WindCnt);break}switch(L){case e.PolyFillType.pftPositive:K=l.WindCnt;break;case e.PolyFillType.
|
|
428
428
|
pftNegative:K=-l.WindCnt;break;default:K=Math.abs(l.WindCnt);break}if(p&&y)oe!==0&&oe!==1||K!==0&&K!==1||o.PolyTyp!==l.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(o,l,c):(this.AddOutPt(
|
|
429
429
|
o,c),this.AddOutPt(l,c),e.Clipper.SwapSides(o,l),e.Clipper.SwapPolyIndexes(o,l));else if(p)(K===0||K===1)&&(this.AddOutPt(o,c),e.Clipper.SwapSides(o,l),e.Clipper.SwapPolyIndexes(o,l));else if(y)(oe===
|
|
430
|
-
0||oe===1)&&(this.AddOutPt(l,c),e.Clipper.SwapSides(o,l),e.Clipper.SwapPolyIndexes(o,l));else if((oe===0||oe===1)&&(K===0||K===1)){var
|
|
431
|
-
PolyFillType.pftNegative:
|
|
432
|
-
ke=Math.abs(l.WindCnt2);break}if(o.PolyTyp!==l.PolyTyp)this.AddLocalMinPoly(o,l,c);else if(oe===1&&K===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:
|
|
433
|
-
break;case e.ClipType.ctUnion:
|
|
430
|
+
0||oe===1)&&(this.AddOutPt(l,c),e.Clipper.SwapSides(o,l),e.Clipper.SwapPolyIndexes(o,l));else if((oe===0||oe===1)&&(K===0||K===1)){var he,ke;switch(F){case e.PolyFillType.pftPositive:he=o.WindCnt2;break;case e.
|
|
431
|
+
PolyFillType.pftNegative:he=-o.WindCnt2;break;default:he=Math.abs(o.WindCnt2);break}switch(U){case e.PolyFillType.pftPositive:ke=l.WindCnt2;break;case e.PolyFillType.pftNegative:ke=-l.WindCnt2;break;default:
|
|
432
|
+
ke=Math.abs(l.WindCnt2);break}if(o.PolyTyp!==l.PolyTyp)this.AddLocalMinPoly(o,l,c);else if(oe===1&&K===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:he>0&&ke>0&&this.AddLocalMinPoly(o,l,c);
|
|
433
|
+
break;case e.ClipType.ctUnion:he<=0&&ke<=0&&this.AddLocalMinPoly(o,l,c);break;case e.ClipType.ctDifference:(o.PolyTyp===e.PolyType.ptClip&&he>0&&ke>0||o.PolyTyp===e.PolyType.ptSubject&&he<=0&&ke<=0)&&
|
|
434
434
|
this.AddLocalMinPoly(o,l,c);break;case e.ClipType.ctXor:this.AddLocalMinPoly(o,l,c);break}else e.Clipper.SwapSides(o,l)}},e.Clipper.prototype.DeleteFromSEL=function(o){var l=o.PrevInSEL,c=o.NextInSEL;
|
|
435
435
|
l===null&&c===null&&o!==this.m_SortedEdges||(l!==null?l.NextInSEL=c:this.m_SortedEdges=c,c!==null&&(c.PrevInSEL=l),o.NextInSEL=null,o.PrevInSEL=null)},e.Clipper.prototype.ProcessHorizontals=function(){
|
|
436
436
|
for(var o={};this.PopEdgeFromSEL(o);)this.ProcessHorizontal(o.v)},e.Clipper.prototype.GetHorzDirection=function(o,l){o.Bot.X<o.Top.X?(l.Left=o.Bot.X,l.Right=o.Top.X,l.Dir=e.Direction.dLeftToRight):(l.
|
|
@@ -439,12 +439,12 @@ y=l.Right,k=o.WindDelta===0,B=o,L=null;B.NextInLML!==null&&e.ClipperBase.IsHoriz
|
|
|
439
439
|
Direction.dLeftToRight){for(;F!==null&&F.X<=o.Bot.X;)F=F.Next;F!==null&&F.X>=B.Top.X&&(F=null)}else{for(;F.Next!==null&&F.Next.X<o.Bot.X;)F=F.Next;F.X<=B.Top.X&&(F=null)}for(var U=null;;){for(var oe=o===
|
|
440
440
|
B,K=this.GetNextInAEL(o,c);K!==null;){if(F!==null)if(c===e.Direction.dLeftToRight)for(;F!==null&&F.X<K.Curr.X;)o.OutIdx>=0&&!k&&this.AddOutPt(o,new e.IntPoint2(F.X,o.Bot.Y)),F=F.Next;else for(;F!==null&&
|
|
441
441
|
F.X>K.Curr.X;)o.OutIdx>=0&&!k&&this.AddOutPt(o,new e.IntPoint2(F.X,o.Bot.Y)),F=F.Prev;if(c===e.Direction.dLeftToRight&&K.Curr.X>y||c===e.Direction.dRightToLeft&&K.Curr.X<p||K.Curr.X===o.Top.X&&o.NextInLML!==
|
|
442
|
-
null&&K.Dx<o.NextInLML.Dx)break;if(o.OutIdx>=0&&!k){e.use_xyz&&(c===e.Direction.dLeftToRight?this.SetZ(K.Curr,o,K):this.SetZ(K.Curr,K,o)),U=this.AddOutPt(o,K.Curr);for(var
|
|
443
|
-
if(
|
|
444
|
-
0&&this.AddLocalMaxPoly(o,L,o.Top),this.DeleteFromAEL(o),this.DeleteFromAEL(L);return}if(c===e.Direction.dLeftToRight){var
|
|
445
|
-
IntPoint2(K.Curr.X,o.Curr.Y);this.IntersectEdges(K,o,
|
|
446
|
-
o),o.OutIdx>=0&&this.AddOutPt(o,o.Bot),l={Dir:c,Left:p,Right:y},this.GetHorzDirection(o,l),c=l.Dir,p=l.Left,y=l.Right}if(o.OutIdx>=0&&U===null){U=this.GetLastOutPt(o);for(var
|
|
447
|
-
null;){if(
|
|
442
|
+
null&&K.Dx<o.NextInLML.Dx)break;if(o.OutIdx>=0&&!k){e.use_xyz&&(c===e.Direction.dLeftToRight?this.SetZ(K.Curr,o,K):this.SetZ(K.Curr,K,o)),U=this.AddOutPt(o,K.Curr);for(var he=this.m_SortedEdges;he!==null;){
|
|
443
|
+
if(he.OutIdx>=0&&this.HorzSegmentsOverlap(o.Bot.X,o.Top.X,he.Bot.X,he.Top.X)){var ke=this.GetLastOutPt(he);this.AddJoin(ke,U,he.Top)}he=he.NextInSEL}this.AddGhostJoin(U,o.Bot)}if(K===L&&oe){o.OutIdx>=
|
|
444
|
+
0&&this.AddLocalMaxPoly(o,L,o.Top),this.DeleteFromAEL(o),this.DeleteFromAEL(L);return}if(c===e.Direction.dLeftToRight){var Ne=new e.IntPoint2(K.Curr.X,o.Curr.Y);this.IntersectEdges(o,K,Ne)}else{var Ne=new e.
|
|
445
|
+
IntPoint2(K.Curr.X,o.Curr.Y);this.IntersectEdges(K,o,Ne)}var Qe=this.GetNextInAEL(K,c);this.SwapPositionsInAEL(o,K),K=Qe}if(o.NextInLML===null||!e.ClipperBase.IsHorizontal(o.NextInLML))break;o=this.UpdateEdgeIntoAEL(
|
|
446
|
+
o),o.OutIdx>=0&&this.AddOutPt(o,o.Bot),l={Dir:c,Left:p,Right:y},this.GetHorzDirection(o,l),c=l.Dir,p=l.Left,y=l.Right}if(o.OutIdx>=0&&U===null){U=this.GetLastOutPt(o);for(var he=this.m_SortedEdges;he!==
|
|
447
|
+
null;){if(he.OutIdx>=0&&this.HorzSegmentsOverlap(o.Bot.X,o.Top.X,he.Bot.X,he.Top.X)){var ke=this.GetLastOutPt(he);this.AddJoin(ke,U,he.Top)}he=he.NextInSEL}this.AddGhostJoin(U,o.Top)}if(o.NextInLML!==
|
|
448
448
|
null)if(o.OutIdx>=0){if(U=this.AddOutPt(o,o.Top),o=this.UpdateEdgeIntoAEL(o),o.WindDelta===0)return;var ze=o.PrevInAEL,Qe=o.NextInAEL;if(ze!==null&&ze.Curr.X===o.Bot.X&&ze.Curr.Y===o.Bot.Y&&ze.WindDelta===
|
|
449
449
|
0&&ze.OutIdx>=0&&ze.Curr.Y>ze.Top.Y&&e.ClipperBase.SlopesEqual3(o,ze,this.m_UseFullRange)){var ke=this.AddOutPt(ze,o.Bot);this.AddJoin(U,ke,o.Top)}else if(Qe!==null&&Qe.Curr.X===o.Bot.X&&Qe.Curr.Y===o.
|
|
450
450
|
Bot.Y&&Qe.WindDelta!==0&&Qe.OutIdx>=0&&Qe.Curr.Y>Qe.Top.Y&&e.ClipperBase.SlopesEqual3(o,Qe,this.m_UseFullRange)){var ke=this.AddOutPt(Qe,o.Bot);this.AddJoin(U,ke,o.Top)}}else o=this.UpdateEdgeIntoAEL(
|
|
@@ -462,9 +462,9 @@ o.Edge2||o.Edge1.PrevInSEL===o.Edge2},e.Clipper.IntersectNodeSort=function(o,l){
|
|
|
462
462
|
this.CopyAELToSEL();for(var o=this.m_IntersectList.length,l=0;l<o;l++){if(!this.EdgesAdjacent(this.m_IntersectList[l])){for(var c=l+1;c<o&&!this.EdgesAdjacent(this.m_IntersectList[c]);)c++;if(c===o)return!1;
|
|
463
463
|
var p=this.m_IntersectList[l];this.m_IntersectList[l]=this.m_IntersectList[c],this.m_IntersectList[c]=p}this.SwapPositionsInSEL(this.m_IntersectList[l].Edge1,this.m_IntersectList[l].Edge2)}return!0},e.
|
|
464
464
|
Clipper.prototype.ProcessIntersectList=function(){for(var o=0,l=this.m_IntersectList.length;o<l;o++){var c=this.m_IntersectList[o];this.IntersectEdges(c.Edge1,c.Edge2,c.Pt),this.SwapPositionsInAEL(c.Edge1,
|
|
465
|
-
c.Edge2)}this.m_IntersectList.length=0};var
|
|
466
|
-
abs(o)):Math.round(o)},
|
|
467
|
-
Round=
|
|
465
|
+
c.Edge2)}this.m_IntersectList.length=0};var sf=function(o){return o<0?Math.ceil(o-.5):Math.round(o)},af=function(o){return o<0?Math.ceil(o-.5):Math.floor(o+.5)},lf=function(o){return o<0?-Math.round(Math.
|
|
466
|
+
abs(o)):Math.round(o)},uf=function(o){return o<0?(o-=.5,o<-2147483648?Math.ceil(o):o|0):(o+=.5,o>2147483647?Math.floor(o):o|0)};i.msie?e.Clipper.Round=sf:i.chromium?e.Clipper.Round=lf:i.safari?e.Clipper.
|
|
467
|
+
Round=uf:e.Clipper.Round=af,e.Clipper.TopX=function(o,l){return l===o.Top.Y?o.Top.X:o.Bot.X+e.Clipper.Round(o.Dx*(l-o.Bot.Y))},e.Clipper.prototype.IntersectPoint=function(o,l,c){c.X=0,c.Y=0;var p,y;if(o.
|
|
468
468
|
Dx===l.Dx){c.Y=o.Curr.Y,c.X=e.Clipper.TopX(o,c.Y);return}if(o.Delta.X===0)c.X=o.Bot.X,e.ClipperBase.IsHorizontal(l)?c.Y=l.Bot.Y:(y=l.Bot.Y-l.Bot.X/l.Dx,c.Y=e.Clipper.Round(c.X/l.Dx+y));else if(l.Delta.
|
|
469
469
|
X===0)c.X=l.Bot.X,e.ClipperBase.IsHorizontal(o)?c.Y=o.Bot.Y:(p=o.Bot.Y-o.Bot.X/o.Dx,c.Y=e.Clipper.Round(c.X/o.Dx+p));else{p=o.Bot.X-o.Bot.Y*o.Dx,y=l.Bot.X-l.Bot.Y*l.Dx;var k=(y-p)/(o.Dx-l.Dx);c.Y=e.Clipper.
|
|
470
470
|
Round(k),Math.abs(o.Dx)<Math.abs(l.Dx)?c.X=e.Clipper.Round(o.Dx*k+p):c.X=e.Clipper.Round(l.Dx*k+y)}if(c.Y<o.Top.Y||c.Y<l.Top.Y){if(o.Top.Y>l.Top.Y)return c.Y=o.Top.Y,c.X=e.Clipper.TopX(l,o.Top.Y),c.X<
|
|
@@ -504,9 +504,9 @@ o.OutPt1.Next;y!==p&&e.IntPoint.op_Equality(y.Pt,o.OffPt);)y=y.Next;var F=y.Pt.Y
|
|
|
504
504
|
!1:F?(y=this.DupOutPt(p,!1),B=this.DupOutPt(k,!0),p.Prev=k,k.Next=p,y.Next=B,B.Prev=y,o.OutPt1=p,o.OutPt2=y,!0):(y=this.DupOutPt(p,!0),B=this.DupOutPt(k,!1),p.Next=k,k.Prev=p,y.Prev=B,B.Next=y,o.OutPt1=
|
|
505
505
|
p,o.OutPt2=y,!0)}else if(L){for(y=p;p.Prev.Pt.Y===p.Pt.Y&&p.Prev!==y&&p.Prev!==k;)p=p.Prev;for(;y.Next.Pt.Y===y.Pt.Y&&y.Next!==p&&y.Next!==k;)y=y.Next;if(y.Next===p||y.Next===k)return!1;for(B=k;k.Prev.
|
|
506
506
|
Pt.Y===k.Pt.Y&&k.Prev!==B&&k.Prev!==y;)k=k.Prev;for(;B.Next.Pt.Y===B.Pt.Y&&B.Next!==k&&B.Next!==p;)B=B.Next;if(B.Next===k||B.Next===p)return!1;var oe={Left:null,Right:null};if(!this.GetOverlap(p.Pt.X,
|
|
507
|
-
y.Pt.X,k.Pt.X,B.Pt.X,oe))return!1;var K=oe.Left,
|
|
508
|
-
(ke.X=k.Pt.X,ke.Y=k.Pt.Y,e.use_xyz&&(ke.Z=k.Pt.Z),
|
|
509
|
-
B.Pt.Z),
|
|
507
|
+
y.Pt.X,k.Pt.X,B.Pt.X,oe))return!1;var K=oe.Left,he=oe.Right,ke=new e.IntPoint0,Ne;return p.Pt.X>=K&&p.Pt.X<=he?(ke.X=p.Pt.X,ke.Y=p.Pt.Y,e.use_xyz&&(ke.Z=p.Pt.Z),Ne=p.Pt.X>y.Pt.X):k.Pt.X>=K&&k.Pt.X<=he?
|
|
508
|
+
(ke.X=k.Pt.X,ke.Y=k.Pt.Y,e.use_xyz&&(ke.Z=k.Pt.Z),Ne=k.Pt.X>B.Pt.X):y.Pt.X>=K&&y.Pt.X<=he?(ke.X=y.Pt.X,ke.Y=y.Pt.Y,e.use_xyz&&(ke.Z=y.Pt.Z),Ne=y.Pt.X>p.Pt.X):(ke.X=B.Pt.X,ke.Y=B.Pt.Y,e.use_xyz&&(ke.Z=
|
|
509
|
+
B.Pt.Z),Ne=B.Pt.X>k.Pt.X),o.OutPt1=p,o.OutPt2=k,this.JoinHorz(p,y,k,B,ke,Ne)}else{for(y=p.Next;e.IntPoint.op_Equality(y.Pt,p.Pt)&&y!==p;)y=y.Next;var Qe=y.Pt.Y>p.Pt.Y||!e.ClipperBase.SlopesEqual4(p.Pt,
|
|
510
510
|
y.Pt,o.OffPt,this.m_UseFullRange);if(Qe){for(y=p.Prev;e.IntPoint.op_Equality(y.Pt,p.Pt)&&y!==p;)y=y.Prev;if(y.Pt.Y>p.Pt.Y||!e.ClipperBase.SlopesEqual4(p.Pt,y.Pt,o.OffPt,this.m_UseFullRange))return!1}for(B=
|
|
511
511
|
k.Next;e.IntPoint.op_Equality(B.Pt,k.Pt)&&B!==k;)B=B.Next;var ze=B.Pt.Y>k.Pt.Y||!e.ClipperBase.SlopesEqual4(k.Pt,B.Pt,o.OffPt,this.m_UseFullRange);if(ze){for(B=k.Prev;e.IntPoint.op_Equality(B.Pt,k.Pt)&&
|
|
512
512
|
B!==k;)B=B.Prev;if(B.Pt.Y>k.Pt.Y||!e.ClipperBase.SlopesEqual4(k.Pt,B.Pt,o.OffPt,this.m_UseFullRange))return!1}return y===p||B===k||y===B||l===c&&Qe===ze?!1:Qe?(y=this.DupOutPt(p,!1),B=this.DupOutPt(k,
|
|
@@ -546,9 +546,9 @@ for(var p=new Array(c),y=0;y<c;++y)p[y]=new e.OutPt;for(var y=0;y<c;++y)p[y].Pt=
|
|
|
546
546
|
B.Pt,B.Prev.Pt,k)?(B=e.Clipper.ExcludeOp(B),c--):e.Clipper.PointsAreClose(B.Prev.Pt,B.Next.Pt,k)?(e.Clipper.ExcludeOp(B.Next),B=e.Clipper.ExcludeOp(B),c-=2):e.Clipper.SlopesNearCollinear(B.Prev.Pt,B.Pt,
|
|
547
547
|
B.Next.Pt,k)?(B=e.Clipper.ExcludeOp(B),c--):(B.Idx=1,B=B.Next);c<3&&(c=0);for(var L=new Array(c),y=0;y<c;++y)L[y]=new e.IntPoint1(B.Pt),B=B.Next;return p=null,L},e.Clipper.CleanPolygons=function(o,l){
|
|
548
548
|
for(var c=new Array(o.length),p=0,y=o.length;p<y;p++)c[p]=e.Clipper.CleanPolygon(o[p],l);return c},e.Clipper.Minkowski=function(o,l,c,p){var y=p?1:0,k=o.length,B=l.length,L=new Array;if(c)for(var F=0;F<
|
|
549
|
-
B;F++){for(var U=new Array(k),oe=0,K=o.length,
|
|
550
|
-
K;oe++,
|
|
551
|
-
push(L[(F+1)%B][(oe+1)%k]),
|
|
549
|
+
B;F++){for(var U=new Array(k),oe=0,K=o.length,he=o[oe];oe<K;oe++,he=o[oe])U[oe]=new e.IntPoint2(l[F].X+he.X,l[F].Y+he.Y);L.push(U)}else for(var F=0;F<B;F++){for(var U=new Array(k),oe=0,K=o.length,he=o[oe];oe<
|
|
550
|
+
K;oe++,he=o[oe])U[oe]=new e.IntPoint2(l[F].X-he.X,l[F].Y-he.Y);L.push(U)}for(var ke=new Array,F=0;F<B-1+y;F++)for(var oe=0;oe<k;oe++){var Ne=new Array;Ne.push(L[F%B][oe%k]),Ne.push(L[(F+1)%B][oe%k]),Ne.
|
|
551
|
+
push(L[(F+1)%B][(oe+1)%k]),Ne.push(L[F%B][(oe+1)%k]),e.Clipper.Orientation(Ne)||Ne.reverse(),ke.push(Ne)}return ke},e.Clipper.MinkowskiSum=function(o,l,c){if(l[0]instanceof Array){for(var y=l,B=new e.
|
|
552
552
|
Paths,k=new e.Clipper,L=0;L<y.length;++L){var F=e.Clipper.Minkowski(o,y[L],!0,c);if(k.AddPaths(F,e.PolyType.ptSubject,!0),c){var p=e.Clipper.TranslatePath(y[L],o[0]);k.AddPath(p,e.PolyType.ptClip,!0)}}
|
|
553
553
|
return k.Execute(e.ClipType.ctUnion,B,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),B}else{var p=l,y=e.Clipper.Minkowski(o,p,!0,c),k=new e.Clipper;return k.AddPaths(y,e.PolyType.ptSubject,!0),k.
|
|
554
554
|
Execute(e.ClipType.ctUnion,y,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),y}},e.Clipper.TranslatePath=function(o,l){for(var c=new e.Path,p=0;p<o.length;p++)c.push(new e.IntPoint2(o[p].X+l.X,o[p].
|
|
@@ -581,13 +581,13 @@ e.EndType.etClosedLine||c.m_endtype===e.EndType.etClosedPolygon?this.m_normals.p
|
|
|
581
581
|
2])),c.m_endtype===e.EndType.etClosedPolygon){for(var oe=k-1,F=0;F<k;F++)oe=this.OffsetPoint(F,oe,c.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(c.m_endtype===e.EndType.etClosedLine){for(var oe=k-
|
|
582
582
|
1,F=0;F<k;F++)oe=this.OffsetPoint(F,oe,c.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var K=this.m_normals[k-1],F=k-1;F>0;F--)this.m_normals[F]=new e.DoublePoint2(-this.
|
|
583
583
|
m_normals[F-1].X,-this.m_normals[F-1].Y);this.m_normals[0]=new e.DoublePoint2(-K.X,-K.Y),oe=0;for(var F=k-1;F>=0;F--)oe=this.OffsetPoint(F,oe,c.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{
|
|
584
|
-
for(var oe=0,F=1;F<k-1;++F)oe=this.OffsetPoint(F,oe,c.m_jointype);var
|
|
585
|
-
X*o),e.ClipperOffset.Round(this.m_srcPoly[F].Y+this.m_normals[F].Y*o)),this.m_destPoly.push(
|
|
586
|
-
this.m_srcPoly[F].Y-this.m_normals[F].Y*o)),this.m_destPoly.push(
|
|
584
|
+
for(var oe=0,F=1;F<k-1;++F)oe=this.OffsetPoint(F,oe,c.m_jointype);var he;if(c.m_endtype===e.EndType.etOpenButt){var F=k-1;he=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[F].X+this.m_normals[F].
|
|
585
|
+
X*o),e.ClipperOffset.Round(this.m_srcPoly[F].Y+this.m_normals[F].Y*o)),this.m_destPoly.push(he),he=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[F].X-this.m_normals[F].X*o),e.ClipperOffset.Round(
|
|
586
|
+
this.m_srcPoly[F].Y-this.m_normals[F].Y*o)),this.m_destPoly.push(he)}else{var F=k-1;oe=k-2,this.m_sinA=0,this.m_normals[F]=new e.DoublePoint2(-this.m_normals[F].X,-this.m_normals[F].Y),c.m_endtype===e.
|
|
587
587
|
EndType.etOpenSquare?this.DoSquare(F,oe):this.DoRound(F,oe)}for(var F=k-1;F>0;F--)this.m_normals[F]=new e.DoublePoint2(-this.m_normals[F-1].X,-this.m_normals[F-1].Y);this.m_normals[0]=new e.DoublePoint2(
|
|
588
|
-
-this.m_normals[1].X,-this.m_normals[1].Y),oe=k-1;for(var F=oe-1;F>0;--F)oe=this.OffsetPoint(F,oe,c.m_jointype);c.m_endtype===e.EndType.etOpenButt?(
|
|
589
|
-
X-this.m_normals[0].X*o),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*o)),this.m_destPoly.push(
|
|
590
|
-
e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*o)),this.m_destPoly.push(
|
|
588
|
+
-this.m_normals[1].X,-this.m_normals[1].Y),oe=k-1;for(var F=oe-1;F>0;--F)oe=this.OffsetPoint(F,oe,c.m_jointype);c.m_endtype===e.EndType.etOpenButt?(he=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].
|
|
589
|
+
X-this.m_normals[0].X*o),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*o)),this.m_destPoly.push(he),he=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*o),
|
|
590
|
+
e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*o)),this.m_destPoly.push(he)):(oe=1,this.m_sinA=0,c.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.
|
|
591
591
|
push(this.m_destPoly)}}}},e.ClipperOffset.prototype.Execute=function(){var o=arguments,l=o[0]instanceof e.PolyTree;if(l){var c=o[0],p=o[1];c.Clear(),this.FixOrientations(),this.DoOffset(p);var y=new e.
|
|
592
592
|
Clipper(0);if(y.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),p>0)y.Execute(e.ClipType.ctUnion,c,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var k=e.Clipper.GetBounds(this.m_destPolys),
|
|
593
593
|
B=new e.Path;if(B.push(new e.IntPoint2(k.left-10,k.bottom+10)),B.push(new e.IntPoint2(k.right+10,k.bottom+10)),B.push(new e.IntPoint2(k.right+10,k.top-10)),B.push(new e.IntPoint2(k.left-10,k.top-10)),
|
|
@@ -614,15 +614,15 @@ Round(this.m_srcPoly[o].Y+this.m_normals[o].Y*this.m_delta)))},e.Error=function(
|
|
|
614
614
|
Area(o)/(l*l)},e.JS.AreaOfPolygons=function(o,l){l||(l=1);for(var c=0,p=0;p<o.length;p++)c+=e.Clipper.Area(o[p]);return c/(l*l)},e.JS.BoundsOfPath=function(o,l){return e.JS.BoundsOfPaths([o],l)},e.JS.
|
|
615
615
|
BoundsOfPaths=function(o,l){l||(l=1);var c=e.Clipper.GetBounds(o);return c.left/=l,c.bottom/=l,c.right/=l,c.top/=l,c},e.JS.Clean=function(p,l){if(!(p instanceof Array))return[];var c=p[0]instanceof Array,
|
|
616
616
|
p=e.JS.Clone(p);if(typeof l!="number"||l===null)return e.Error("Delta is not a number in Clean()."),p;if(p.length===0||p.length===1&&p[0].length===0||l<0)return p;c||(p=[p]);for(var y=p.length,k,B,L,F,
|
|
617
|
-
U,oe,K,
|
|
618
|
-
oe++);U=B[oe-1],(B[0].X-U.X)*(B[0].X-U.X)+(B[0].Y-U.Y)*(B[0].Y-U.Y)<=F&&oe--,oe<k&&L.splice(oe,k-oe),L.length&&
|
|
619
|
-
|
|
617
|
+
U,oe,K,he=[],ke=0;ke<y;ke++)if(B=p[ke],k=B.length,k!==0){if(k<3){L=B,he.push(L);continue}for(L=B,F=l*l,U=B[0],oe=1,K=1;K<k;K++)(B[K].X-U.X)*(B[K].X-U.X)+(B[K].Y-U.Y)*(B[K].Y-U.Y)<=F||(L[oe]=B[K],U=B[K],
|
|
618
|
+
oe++);U=B[oe-1],(B[0].X-U.X)*(B[0].X-U.X)+(B[0].Y-U.Y)*(B[0].Y-U.Y)<=F&&oe--,oe<k&&L.splice(oe,k-oe),L.length&&he.push(L)}return!c&&he.length?he=he[0]:!c&&he.length===0?he=[]:c&&he.length===0&&(he=[[]]),
|
|
619
|
+
he},e.JS.Clone=function(o){if(!(o instanceof Array))return[];if(o.length===0)return[];if(o.length===1&&o[0].length===0)return[[]];var l=o[0]instanceof Array;l||(o=[o]);var c=o.length,p,y,k,B,L=new Array(
|
|
620
620
|
c);for(y=0;y<c;y++){for(p=o[y].length,B=new Array(p),k=0;k<p;k++)B[k]={X:o[y][k].X,Y:o[y][k].Y};L[y]=B}return l||(L=L[0]),L},e.JS.Lighten=function(o,l){if(!(o instanceof Array))return[];if(typeof l!="\
|
|
621
621
|
number"||l===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(o);if(o.length===0||o.length===1&&o[0].length===0||l<0)return e.JS.Clone(o);var c=o[0]instanceof Array;c||(o=[o]);
|
|
622
|
-
var p,y,k,B,L,F,U,oe,K,
|
|
623
|
-
push({X:k[0].X,Y:k[0].Y}),F=k.length):
|
|
624
|
-
br=oe.Y):Mt>0&&(rn+=Qe*Mt,br+=ze*Mt)),Qe=K.X-rn,ze=K.Y-br,
|
|
625
|
-
Y:k[F-1].Y}),
|
|
622
|
+
var p,y,k,B,L,F,U,oe,K,he,ke,Ne,Qe,ze,Mt,rn,br,cf=o.length,ff=l*l,vr=[];for(p=0;p<cf;p++)if(k=o[p],F=k.length,F!==0){for(B=0;B<1e6;B++){for(L=[],F=k.length,k[F-1].X!==k[0].X||k[F-1].Y!==k[0].Y?(Ne=1,k.
|
|
623
|
+
push({X:k[0].X,Y:k[0].Y}),F=k.length):Ne=0,ke=[],y=0;y<F-2;y++)U=k[y],K=k[y+1],oe=k[y+2],rn=U.X,br=U.Y,Qe=oe.X-rn,ze=oe.Y-br,(Qe!==0||ze!==0)&&(Mt=((K.X-rn)*Qe+(K.Y-br)*ze)/(Qe*Qe+ze*ze),Mt>1?(rn=oe.X,
|
|
624
|
+
br=oe.Y):Mt>0&&(rn+=Qe*Mt,br+=ze*Mt)),Qe=K.X-rn,ze=K.Y-br,he=Qe*Qe+ze*ze,he<=ff&&(ke[y+1]=1,y++);for(L.push({X:k[0].X,Y:k[0].Y}),y=1;y<F-1;y++)ke[y]||L.push({X:k[y].X,Y:k[y].Y});if(L.push({X:k[F-1].X,
|
|
625
|
+
Y:k[F-1].Y}),Ne&&k.pop(),ke.length)k=L;else break}F=L.length,L[F-1].X===L[0].X&&L[F-1].Y===L[0].Y&&L.pop(),L.length>2&&vr.push(L)}return c||(vr=vr[0]),typeof vr>"u"&&(vr=[]),vr},e.JS.PerimeterOfPath=function(o,l,c){
|
|
626
626
|
if(typeof o>"u")return 0;var p=Math.sqrt,y=0,k,B,L=0,F=0,U=0,oe=0,K=o.length;if(K<2)return 0;for(l&&(o[K]=o[0],K++);--K;)k=o[K],L=k.X,F=k.Y,B=o[K-1],U=B.X,oe=B.Y,y+=p((L-U)*(L-U)+(F-oe)*(F-oe));return l&&
|
|
627
627
|
o.pop(),y/c},e.JS.PerimeterOfPaths=function(o,l,c){c||(c=1);for(var p=0,y=0;y<o.length;y++)p+=e.JS.PerimeterOfPath(o[y],l,c);return p},e.JS.ScaleDownPath=function(o,l){var c,p;for(l||(l=1),c=o.length;c--;)
|
|
628
628
|
p=o[c],p.X=p.X/l,p.Y=p.Y/l},e.JS.ScaleDownPaths=function(o,l){var c,p,y;for(l||(l=1),c=o.length;c--;)for(p=o[c].length;p--;)y=o[c][p],y.X=y.X/l,y.Y=y.Y/l},e.JS.ScaleUpPath=function(o,l){var c,p,y=Math.
|
|
@@ -632,15 +632,15 @@ Childs(),y=p.length;c.holes=new Array(y);var k,B,L,F,U,oe;for(L=0;L<y;L++)for(k=
|
|
|
632
632
|
e.JS.ExPolygonsToPaths=function(o){var l,c,p,y,k=new e.Paths;for(l=0,p=o.length;l<p;l++)for(k.push(o[l].outer),c=0,y=o[l].holes.length;c<y;c++)k.push(o[l].holes[c]);return k},e.JS.PolyTreeToExPolygons=
|
|
633
633
|
function(o){var l=new e.ExPolygons,c,p,y,k;for(p=0,y=o.Childs(),k=y.length;p<k;p++)c=y[p],e.JS.AddOuterPolyNodeToExPolygons(c,l);return l}})()});var ab={};Js(ab,{addFonts:()=>ea,frame:()=>Wc,open:()=>Yc});function ea(e){if(e.fonts.length===0||typeof FontFace>"u"||typeof document>"u"||!document.fonts||document.getElementById(e.fontId))return;let t=document.createElement("meta");t.id=e.fontId,document.head.
|
|
634
634
|
append(t);for(let n of e.fonts){if(n.bitmap)continue;let r=atob(n.base64),i=new Uint8Array(r.length);for(let a=0;a<r.length;a++)i[a]=r.charCodeAt(a);let s={style:n.style,weight:n.weight};n.stretch&&(s.
|
|
635
|
-
stretch=n.stretch),document.fonts.add(new FontFace(n.family,i.buffer,s))}}var V={};Js(V,{BRAND:()=>
|
|
635
|
+
stretch=n.stretch),document.fonts.add(new FontFace(n.family,i.buffer,s))}}var V={};Js(V,{BRAND:()=>qf,DIRTY:()=>Wn,EMPTY_PATH:()=>If,INVALID:()=>we,NEVER:()=>Bh,OK:()=>gt,ParseStatus:()=>At,Schema:()=>Re,ZodAny:()=>Cn,ZodArray:()=>An,ZodBigInt:()=>Gn,ZodBoolean:()=>qn,ZodBranded:()=>jr,
|
|
636
636
|
ZodCatch:()=>tr,ZodDate:()=>Hn,ZodDefault:()=>er,ZodDiscriminatedUnion:()=>Po,ZodEffects:()=>zt,ZodEnum:()=>Jn,ZodError:()=>_t,ZodFirstPartyTypeKind:()=>Ce,ZodFunction:()=>_o,ZodIntersection:()=>jn,ZodIssueCode:()=>se,
|
|
637
637
|
ZodLazy:()=>Vn,ZodLiteral:()=>Zn,ZodMap:()=>Er,ZodNaN:()=>Br,ZodNativeEnum:()=>Kn,ZodNever:()=>Jt,ZodNull:()=>Un,ZodNullable:()=>an,ZodNumber:()=>Xn,ZodObject:()=>Tt,ZodOptional:()=>$t,ZodParsedType:()=>me,
|
|
638
638
|
ZodPipeline:()=>Vr,ZodPromise:()=>En,ZodReadonly:()=>nr,ZodRecord:()=>Mo,ZodSchema:()=>Re,ZodSet:()=>Sr,ZodString:()=>kn,ZodSymbol:()=>kr,ZodTransformer:()=>zt,ZodTuple:()=>sn,ZodType:()=>Re,ZodUndefined:()=>$n,
|
|
639
|
-
ZodUnion:()=>zn,ZodUnknown:()=>mn,ZodVoid:()=>Cr,addIssueToContext:()=>pe,any:()=>
|
|
640
|
-
discriminatedUnion:()=>
|
|
641
|
-
late:()=>
|
|
642
|
-
optional:()=>
|
|
643
|
-
tuple:()=>
|
|
639
|
+
ZodUnion:()=>zn,ZodUnknown:()=>mn,ZodVoid:()=>Cr,addIssueToContext:()=>pe,any:()=>Kf,array:()=>rh,bigint:()=>zf,boolean:()=>fa,coerce:()=>Sh,custom:()=>la,date:()=>jf,datetimeRegex:()=>sa,defaultErrorMap:()=>pn,
|
|
640
|
+
discriminatedUnion:()=>ah,effect:()=>bh,enum:()=>Ah,function:()=>ph,getErrorMap:()=>xr,getParsedType:()=>on,instanceof:()=>$f,intersection:()=>lh,isAborted:()=>So,isAsync:()=>Ir,isDirty:()=>Bo,isValid:()=>wn,
|
|
641
|
+
late:()=>Hf,lazy:()=>dh,literal:()=>mh,makeIssue:()=>zr,map:()=>fh,nan:()=>Uf,nativeEnum:()=>yh,never:()=>th,null:()=>Jf,nullable:()=>xh,number:()=>ca,object:()=>oh,objectUtil:()=>Ei,oboolean:()=>Eh,onumber:()=>Ch,
|
|
642
|
+
optional:()=>vh,ostring:()=>kh,pipeline:()=>wh,preprocess:()=>Ih,promise:()=>gh,quotelessJson:()=>bf,record:()=>ch,set:()=>hh,setErrorMap:()=>xf,strictObject:()=>ih,string:()=>ua,symbol:()=>Vf,transformer:()=>bh,
|
|
643
|
+
tuple:()=>uh,undefined:()=>Zf,union:()=>sh,unknown:()=>eh,util:()=>Le,void:()=>nh});var Le;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},e.getValidEnumValues=i=>{let s=e.
|
|
644
644
|
objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(let u of s)a[u]=i[u];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys==
|
|
645
645
|
"function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},e.find=(i,s)=>{for(let a of i)if(s(a))return a},e.isInteger=typeof Number.isInteger==
|
|
646
646
|
"function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=r,e.jsonStringifyReplacer=
|
|
@@ -649,14 +649,14 @@ objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(let u of s)a[u]=i[u];
|
|
|
649
649
|
string;case"number":return Number.isNaN(e)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.
|
|
650
650
|
isArray(e)?me.array:e===null?me.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?me.promise:typeof Map<"u"&&e instanceof Map?me.map:typeof Set<"u"&&e instanceof Set?me.set:typeof Date<
|
|
651
651
|
"u"&&e instanceof Date?me.date:me.object;default:return me.unknown}};var se=Le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","inval\
|
|
652
|
-
id_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),
|
|
652
|
+
id_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),bf=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),_t=class e extends Error{get errors(){
|
|
653
653
|
return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.
|
|
654
654
|
setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(let a of s.issues)if(a.code===
|
|
655
655
|
"invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{
|
|
656
|
-
let u=r,
|
|
656
|
+
let u=r,f=0;for(;f<a.path.length;){let h=a.path[f];f===a.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(n(a))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return i(this),r}static assert(t){if(!(t instanceof
|
|
657
657
|
e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.
|
|
658
658
|
message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};
|
|
659
|
-
_t.create=e=>new _t(e);var
|
|
659
|
+
_t.create=e=>new _t(e);var vf=(e,t)=>{let n;switch(e.code){case se.invalid_type:e.received===me.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case se.invalid_literal:n=`Invalid literal valu\
|
|
660
660
|
e, expected ${JSON.stringify(e.expected,Le.jsonStringifyReplacer)}`;break;case se.unrecognized_keys:n=`Unrecognized key(s) in object: ${Le.joinValues(e.keys,", ")}`;break;case se.invalid_union:n="Inva\
|
|
661
661
|
lid input";break;case se.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Le.joinValues(e.options)}`;break;case se.invalid_enum_value:n=`Invalid enum value. Expected ${Le.joinValues(
|
|
662
662
|
e.options)}, received '${e.received}'`;break;case se.invalid_arguments:n="Invalid function arguments";break;case se.invalid_return_type:n="Invalid function return type";break;case se.invalid_date:n="I\
|
|
@@ -671,8 +671,8 @@ an "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case se.too_big:e.t
|
|
|
671
671
|
"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.
|
|
672
672
|
inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case se.custom:n="Invalid input";break;case se.invalid_intersection_types:n="Intersection r\
|
|
673
673
|
esults could not be merged";break;case se.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case se.not_finite:n="Number must be finite";break;default:n=t.defaultError,Le.assertNever(
|
|
674
|
-
e)}return{message:n}},pn=
|
|
675
|
-
for(let
|
|
674
|
+
e)}return{message:n}},pn=vf;var ta=pn;function xf(e){ta=e}function xr(){return ta}var zr=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let u="",f=r.filter(h=>!!h).slice().reverse();
|
|
675
|
+
for(let h of f)u=h(a,{data:t,defaultError:u}).message;return{...i,path:s,message:u}},If=[];function pe(e,t){let n=xr(),r=zr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,
|
|
676
676
|
e.schemaErrorMap,n,n===pn?void 0:pn].filter(i=>!!i)});e.common.issues.push(r)}var At=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="a\
|
|
677
677
|
borted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let i of n){if(i.status==="aborted")return we;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){
|
|
678
678
|
let r=[];for(let i of n){let s=await i.key,a=await i.value;r.push({key:s,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let i of n){let{key:s,value:a}=i;if(s.status===
|
|
@@ -682,7 +682,7 @@ value:r}}},we=Object.freeze({status:"aborted"}),Wn=e=>({status:"dirty",value:e})
|
|
|
682
682
|
_path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},na=(e,t)=>{if(wn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed\
|
|
683
683
|
but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new _t(e.common.issues);return this._error=n,this._error}}};function Me(e){if(!e)return{};let{errorMap:t,
|
|
684
684
|
invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:
|
|
685
|
-
{errorMap:(a,u)=>{let{message:
|
|
685
|
+
{errorMap:(a,u)=>{let{message:f}=e;return a.code==="invalid_enum_value"?{message:f??u.defaultError}:typeof u.data>"u"?{message:f??r??u.defaultError}:a.code!=="invalid_type"?{message:u.defaultError}:{message:f??
|
|
686
686
|
n??u.defaultError}},description:i}}var Re=class{get description(){return this._def.description}_getType(t){return on(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:on(
|
|
687
687
|
t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:on(t.data),schemaErrorMap:this._def.
|
|
688
688
|
errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Ir(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.
|
|
@@ -692,7 +692,7 @@ _def.errorMap,parent:null,data:t,parsedType:on(t)};if(!this["~standard"].async)t
|
|
|
692
692
|
toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>wn(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){
|
|
693
693
|
let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this.
|
|
694
694
|
_def.errorMap,parent:null,data:t,parsedType:on(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Ir(i)?i:Promise.resolve(i));return na(r,s)}refine(t,n){let r=i=>typeof n=="string"||typeof n>"u"?
|
|
695
|
-
{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{let a=t(i),u=()=>s.addIssue({code:se.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(
|
|
695
|
+
{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{let a=t(i),u=()=>s.addIssue({code:se.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(f=>f?!0:(u(),!1)):a?
|
|
696
696
|
!0:(u(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new zt({schema:this,typeName:Ce.ZodEffects,effect:{type:"refi\
|
|
697
697
|
nement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.
|
|
698
698
|
parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.
|
|
@@ -704,38 +704,38 @@ optional()}array(){return An.create(this)}promise(){return En.create(this,this._
|
|
|
704
704
|
this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new er({...Me(this._def),innerType:this,defaultValue:n,typeName:Ce.
|
|
705
705
|
ZodDefault})}brand(){return new jr({typeName:Ce.ZodBranded,type:this,...Me(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new tr({...Me(this._def),innerType:this,catchValue:n,typeName:Ce.
|
|
706
706
|
ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Vr.create(this,t)}readonly(){return nr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){
|
|
707
|
-
return this.safeParse(null).success}},
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",
|
|
714
|
-
t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function
|
|
715
|
-
let t=`${oa}T${ia(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function
|
|
716
|
-
(t==="v6"||!t)&&
|
|
717
|
-
atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function
|
|
707
|
+
return this.safeParse(null).success}},wf=/^c[^\s-]{8,}$/i,kf=/^[0-9a-z]+$/,Cf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ef=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Sf=/^[a-z0-9_-]{21}$/i,
|
|
708
|
+
Bf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pf=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,
|
|
709
|
+
Mf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_f="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Si,Tf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
710
|
+
Rf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Df=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,
|
|
711
|
+
Of=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
712
|
+
Nf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oa="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468\
|
|
713
|
+
][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Lf=new RegExp(`^${oa}$`);function ia(e){let t="[0-5]\\d";e.precision?
|
|
714
|
+
t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Ff(e){return new RegExp(`^${ia(e)}$`)}function sa(e){
|
|
715
|
+
let t=`${oa}T${ia(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Yf(e,t){return!!((t==="v4"||!t)&&Tf.test(e)||
|
|
716
|
+
(t==="v6"||!t)&&Df.test(e))}function Wf(e,t){if(!Bf.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(
|
|
717
|
+
atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Xf(e,t){return!!((t==="v4"||!t)&&Rf.test(e)||(t==="v6"||!t)&&Of.test(e))}var kn=class e extends Re{_parse(t){
|
|
718
718
|
if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==me.string){let s=this._getOrReturnCtx(t);return pe(s,{code:se.invalid_type,expected:me.string,received:s.parsedType}),we}let r=new At,i;
|
|
719
719
|
for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),pe(i,{code:se.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.
|
|
720
720
|
kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),pe(i,{code:se.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let a=t.
|
|
721
721
|
data.length>s.value,u=t.data.length<s.value;(a||u)&&(i=this._getOrReturnCtx(t,i),a?pe(i,{code:se.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):u&&pe(i,{code:se.too_small,
|
|
722
|
-
minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")
|
|
723
|
-
message:s.message}),r.dirty());else if(s.kind==="emoji")Si||(Si=new RegExp(
|
|
724
|
-
dirty());else if(s.kind==="uuid")
|
|
725
|
-
(i=this._getOrReturnCtx(t,i),pe(i,{validation:"nanoid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")
|
|
726
|
-
d",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")
|
|
727
|
-
kind==="ulid")
|
|
722
|
+
minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Mf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"email",code:se.invalid_string,
|
|
723
|
+
message:s.message}),r.dirty());else if(s.kind==="emoji")Si||(Si=new RegExp(_f,"u")),Si.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"emoji",code:se.invalid_string,message:s.message}),r.
|
|
724
|
+
dirty());else if(s.kind==="uuid")Ef.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"uuid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Sf.test(t.data)||
|
|
725
|
+
(i=this._getOrReturnCtx(t,i),pe(i,{validation:"nanoid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")wf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"cui\
|
|
726
|
+
d",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")kf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"cuid2",code:se.invalid_string,message:s.message}),r.dirty());else if(s.
|
|
727
|
+
kind==="ulid")Cf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"ulid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(
|
|
728
728
|
t,i),pe(i,{validation:"url",code:se.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"regex",
|
|
729
729
|
code:se.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),pe(i,{code:se.invalid_string,
|
|
730
730
|
validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsW\
|
|
731
731
|
ith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),pe(i,{code:se.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||
|
|
732
732
|
(i=this._getOrReturnCtx(t,i),pe(i,{code:se.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?sa(s).test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{code:se.
|
|
733
|
-
invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?
|
|
734
|
-
s.kind==="time"?
|
|
735
|
-
t,i),pe(i,{validation:"duration",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?
|
|
736
|
-
message}),r.dirty()):s.kind==="jwt"?
|
|
737
|
-
this._getOrReturnCtx(t,i),pe(i,{validation:"cidr",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?
|
|
738
|
-
invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?
|
|
733
|
+
invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Lf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{code:se.invalid_string,validation:"date",message:s.message}),r.dirty()):
|
|
734
|
+
s.kind==="time"?Ff(s).test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{code:se.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Pf.test(t.data)||(i=this._getOrReturnCtx(
|
|
735
|
+
t,i),pe(i,{validation:"duration",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Yf(t.data,s.version)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"ip",code:se.invalid_string,message:s.
|
|
736
|
+
message}),r.dirty()):s.kind==="jwt"?Wf(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"jwt",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Xf(t.data,s.version)||(i=
|
|
737
|
+
this._getOrReturnCtx(t,i),pe(i,{validation:"cidr",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Nf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"base64",code:se.
|
|
738
|
+
invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Qf.test(t.data)||(i=this._getOrReturnCtx(t,i),pe(i,{validation:"base64url",code:se.invalid_string,message:s.message}),r.dirty()):Le.assertNever(
|
|
739
739
|
s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:se.invalid_string,...ge.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this.
|
|
740
740
|
_def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(
|
|
741
741
|
t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){
|
|
@@ -754,13 +754,13 @@ _def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(
|
|
|
754
754
|
find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.
|
|
755
755
|
kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base6\
|
|
756
756
|
4")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){
|
|
757
|
-
let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};kn.create=e=>new kn({checks:[],typeName:Ce.ZodString,coerce:e?.coerce??!1,...Me(e)});function
|
|
757
|
+
let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};kn.create=e=>new kn({checks:[],typeName:Ce.ZodString,coerce:e?.coerce??!1,...Me(e)});function Gf(e,t){
|
|
758
758
|
let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%
|
|
759
759
|
a/10**i}var Xn=class e extends Re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==
|
|
760
760
|
me.number){let s=this._getOrReturnCtx(t);return pe(s,{code:se.invalid_type,expected:me.number,received:s.parsedType}),we}let r,i=new At;for(let s of this._def.checks)s.kind==="int"?Le.isInteger(t.data)||
|
|
761
761
|
(r=this._getOrReturnCtx(t,r),pe(r,{code:se.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(
|
|
762
762
|
t,r),pe(r,{code:se.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(
|
|
763
|
-
t,r),pe(r,{code:se.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?
|
|
763
|
+
t,r),pe(r,{code:se.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Gf(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),pe(r,{
|
|
764
764
|
code:se.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),pe(r,{code:se.not_finite,message:s.message}),i.dirty()):
|
|
765
765
|
Le.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("ma\
|
|
766
766
|
x",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ge.toString(
|
|
@@ -809,13 +809,13 @@ _def,exactLength:{value:t,message:ge.toString(n)}})}nonempty(t){return this.min(
|
|
|
809
809
|
if(e instanceof Tt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=$t.create(wr(r))}return new Tt({...e._def,shape:()=>t})}else return e instanceof An?new An({...e._def,type:wr(e.element)}):e instanceof
|
|
810
810
|
$t?$t.create(wr(e.unwrap())):e instanceof an?an.create(wr(e.unwrap())):e instanceof sn?sn.create(e.items.map(t=>wr(t))):e}var Tt=class e extends Re{constructor(){super(...arguments),this._cached=null,
|
|
811
811
|
this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Le.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){
|
|
812
|
-
if(this._getType(t)!==me.object){let
|
|
813
|
-
keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof Jt&&this._def.unknownKeys==="strip"))for(let
|
|
814
|
-
{key:{status:"valid",value:
|
|
815
|
-
key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(
|
|
816
|
-
l ZodObject error: invalid unknownKeys value.")}else{let
|
|
817
|
-
data})}}return i.common.async?Promise.resolve().then(async()=>{let
|
|
818
|
-
r,
|
|
812
|
+
if(this._getType(t)!==me.object){let h=this._getOrReturnCtx(t);return pe(h,{code:se.invalid_type,expected:me.object,received:h.parsedType}),we}let{status:r,ctx:i}=this._processInputParams(t),{shape:s,
|
|
813
|
+
keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof Jt&&this._def.unknownKeys==="strip"))for(let h in i.data)a.includes(h)||u.push(h);let f=[];for(let h of a){let m=s[h],d=i.data[h];f.push(
|
|
814
|
+
{key:{status:"valid",value:h},value:m._parse(new Ut(i,d,i.path,h)),alwaysSet:h in i.data})}if(this._def.catchall instanceof Jt){let h=this._def.unknownKeys;if(h==="passthrough")for(let m of u)f.push({
|
|
815
|
+
key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(h==="strict")u.length>0&&(pe(i,{code:se.unrecognized_keys,keys:u}),r.dirty());else if(h!=="strip")throw new Error("Interna\
|
|
816
|
+
l ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let m of u){let d=i.data[m];f.push({key:{status:"valid",value:m},value:h._parse(new Ut(i,d,i.path,m)),alwaysSet:m in i.
|
|
817
|
+
data})}}return i.common.async?Promise.resolve().then(async()=>{let h=[];for(let m of f){let d=await m.key,A=await m.value;h.push({key:d,value:A,alwaysSet:m.alwaysSet})}return h}).then(h=>At.mergeObjectSync(
|
|
818
|
+
r,h)):At.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).
|
|
819
819
|
message??r.defaultError;return n.code==="unrecognized_keys"?{message:ge.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({
|
|
820
820
|
...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({
|
|
821
821
|
...this._def.shape(),...t._def.shape()}),typeName:Ce.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of Le.objectKeys(
|
|
@@ -826,9 +826,9 @@ this.shape))}};Tt.create=(e,t)=>new Tt({shape:()=>e,unknownKeys:"strip",catchall
|
|
|
826
826
|
create(),typeName:Ce.ZodObject,...Me(t)});Tt.lazycreate=(e,t)=>new Tt({shape:e,unknownKeys:"strip",catchall:Jt.create(),typeName:Ce.ZodObject,...Me(t)});var zn=class extends Re{_parse(t){let{ctx:n}=this.
|
|
827
827
|
_processInputParams(t),r=this._def.options;function i(s){for(let u of s)if(u.result.status==="valid")return u.result;for(let u of s)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.
|
|
828
828
|
issues),u.result;let a=s.map(u=>new _t(u.ctx.common.issues));return pe(n,{code:se.invalid_union,unionErrors:a}),we}if(n.common.async)return Promise.all(r.map(async s=>{let a={...n,common:{...n.common,
|
|
829
|
-
issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let
|
|
830
|
-
_parseSync({data:n.data,path:n.path,parent:
|
|
831
|
-
...s.ctx.common.issues),s.result;let u=a.map(
|
|
829
|
+
issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let f of r){let h={...n,common:{...n.common,issues:[]},parent:null},m=f.
|
|
830
|
+
_parseSync({data:n.data,path:n.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:h}),h.common.issues.length&&a.push(h.common.issues)}if(s)return n.common.issues.push(
|
|
831
|
+
...s.ctx.common.issues),s.result;let u=a.map(f=>new _t(f));return pe(n,{code:se.invalid_union,unionErrors:u}),we}}get options(){return this._def.options}};zn.create=(e,t)=>new zn({options:e,typeName:Ce.
|
|
832
832
|
ZodUnion,...Me(t)});var dn=e=>e instanceof Vn?dn(e.schema):e instanceof zt?dn(e.innerType()):e instanceof Zn?[e.value]:e instanceof Jn?e.options:e instanceof Kn?Le.objectValues(e.enum):e instanceof er?
|
|
833
833
|
dn(e._def.innerType):e instanceof $n?[void 0]:e instanceof Un?[null]:e instanceof $t?[void 0,...dn(e.unwrap())]:e instanceof an?[null,...dn(e.unwrap())]:e instanceof jr||e instanceof nr?dn(e.unwrap()):
|
|
834
834
|
e instanceof tr?dn(e._def.innerType):[],Po=class e extends Re{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==me.object)return pe(n,{code:se.invalid_type,expected:me.object,received:n.
|
|
@@ -837,36 +837,36 @@ parsedType}),we;let r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);re
|
|
|
837
837
|
return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let s of n){let a=dn(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all \
|
|
838
838
|
schema options`);for(let u of a){if(i.has(u))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(u)}`);i.set(u,s)}}return new e({typeName:Ce.ZodDiscriminatedUnion,discriminator:t,
|
|
839
839
|
options:n,optionsMap:i,...Me(r)})}};function Bi(e,t){let n=on(e),r=on(t);if(e===t)return{valid:!0,data:e};if(n===me.object&&r===me.object){let i=Le.objectKeys(t),s=Le.objectKeys(e).filter(u=>i.indexOf(
|
|
840
|
-
u)!==-1),a={...e,...t};for(let u of s){let
|
|
841
|
-
let i=[];for(let s=0;s<e.length;s++){let a=e[s],u=t[s],
|
|
840
|
+
u)!==-1),a={...e,...t};for(let u of s){let f=Bi(e[u],t[u]);if(!f.valid)return{valid:!1};a[u]=f.data}return{valid:!0,data:a}}else if(n===me.array&&r===me.array){if(e.length!==t.length)return{valid:!1};
|
|
841
|
+
let i=[];for(let s=0;s<e.length;s++){let a=e[s],u=t[s],f=Bi(a,u);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===me.date&&r===me.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}
|
|
842
842
|
var jn=class extends Re{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=(s,a)=>{if(So(s)||So(a))return we;let u=Bi(s.value,a.value);return u.valid?((Bo(s)||Bo(a))&&n.dirty(),{status:n.value,
|
|
843
843
|
value:u.data}):(pe(r,{code:se.invalid_intersection_types}),we)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,
|
|
844
844
|
path:r.path,parent:r})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};jn.create=(e,t,n)=>new jn(
|
|
845
845
|
{left:e,right:t,typeName:Ce.ZodIntersection,...Me(n)});var sn=class e extends Re{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==me.array)return pe(r,{code:se.invalid_type,
|
|
846
846
|
expected:me.array,received:r.parsedType}),we;if(r.data.length<this._def.items.length)return pe(r,{code:se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),we;!this._def.rest&&
|
|
847
|
-
r.data.length>this._def.items.length&&(pe(r,{code:se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((a,u)=>{let
|
|
848
|
-
_def.rest;return
|
|
847
|
+
r.data.length>this._def.items.length&&(pe(r,{code:se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((a,u)=>{let f=this._def.items[u]||this.
|
|
848
|
+
_def.rest;return f?f._parse(new Ut(r,a,r.path,u)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>At.mergeArray(n,a)):At.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e(
|
|
849
849
|
{...this._def,rest:t})}};sn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sn({items:e,typeName:Ce.ZodTuple,rest:null,...Me(t)})};
|
|
850
850
|
var Mo=class e extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==me.object)return pe(
|
|
851
851
|
r,{code:se.invalid_type,expected:me.object,received:r.parsedType}),we;let i=[],s=this._def.keyType,a=this._def.valueType;for(let u in r.data)i.push({key:s._parse(new Ut(r,u,r.path,u)),value:a._parse(new Ut(
|
|
852
852
|
r,r.data[u],r.path,u)),alwaysSet:u in r.data});return r.common.async?At.mergeObjectAsync(n,i):At.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Re?
|
|
853
853
|
new e({keyType:t,valueType:n,typeName:Ce.ZodRecord,...Me(r)}):new e({keyType:kn.create(),valueType:t,typeName:Ce.ZodRecord,...Me(n)})}},Er=class extends Re{get keySchema(){return this._def.keyType}get valueSchema(){
|
|
854
854
|
return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==me.map)return pe(r,{code:se.invalid_type,expected:me.map,received:r.parsedType}),we;let i=this._def.
|
|
855
|
-
keyType,s=this._def.valueType,a=[...r.data.entries()].map(([u,
|
|
856
|
-
resolve().then(async()=>{for(let
|
|
857
|
-
return{status:n.value,value:u}})}else{let u=new Map;for(let
|
|
858
|
-
set(
|
|
855
|
+
keyType,s=this._def.valueType,a=[...r.data.entries()].map(([u,f],h)=>({key:i._parse(new Ut(r,u,r.path,[h,"key"])),value:s._parse(new Ut(r,f,r.path,[h,"value"]))}));if(r.common.async){let u=new Map;return Promise.
|
|
856
|
+
resolve().then(async()=>{for(let f of a){let h=await f.key,m=await f.value;if(h.status==="aborted"||m.status==="aborted")return we;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),u.set(h.value,m.value)}
|
|
857
|
+
return{status:n.value,value:u}})}else{let u=new Map;for(let f of a){let h=f.key,m=f.value;if(h.status==="aborted"||m.status==="aborted")return we;(h.status==="dirty"||m.status==="dirty")&&n.dirty(),u.
|
|
858
|
+
set(h.value,m.value)}return{status:n.value,value:u}}}};Er.create=(e,t,n)=>new Er({valueType:t,keyType:e,typeName:Ce.ZodMap,...Me(n)});var Sr=class e extends Re{_parse(t){let{status:n,ctx:r}=this._processInputParams(
|
|
859
859
|
t);if(r.parsedType!==me.set)return pe(r,{code:se.invalid_type,expected:me.set,received:r.parsedType}),we;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(pe(r,{code:se.too_small,minimum:i.
|
|
860
860
|
minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(pe(r,{code:se.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,
|
|
861
|
-
exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function a(
|
|
862
|
-
status:n.value,value:
|
|
861
|
+
exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function a(f){let h=new Set;for(let m of f){if(m.status==="aborted")return we;m.status==="dirty"&&n.dirty(),h.add(m.value)}return{
|
|
862
|
+
status:n.value,value:h}}let u=[...r.data.values()].map((f,h)=>s._parse(new Ut(r,f,r.path,h)));return r.common.async?Promise.all(u).then(f=>a(f)):a(u)}min(t,n){return new e({...this._def,minSize:{value:t,
|
|
863
863
|
message:ge.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ge.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr(
|
|
864
864
|
{valueType:e,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Me(t)});var _o=class e extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(
|
|
865
|
-
t);if(n.parsedType!==me.function)return pe(n,{code:se.invalid_type,expected:me.function,received:n.parsedType}),we;function r(u,
|
|
866
|
-
n.schemaErrorMap,xr(),pn].filter(
|
|
867
|
-
xr(),pn].filter(
|
|
868
|
-
let
|
|
869
|
-
i(d,g)),
|
|
865
|
+
t);if(n.parsedType!==me.function)return pe(n,{code:se.invalid_type,expected:me.function,received:n.parsedType}),we;function r(u,f){return zr({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,
|
|
866
|
+
n.schemaErrorMap,xr(),pn].filter(h=>!!h),issueData:{code:se.invalid_arguments,argumentsError:f}})}function i(u,f){return zr({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,
|
|
867
|
+
xr(),pn].filter(h=>!!h),issueData:{code:se.invalid_return_type,returnTypeError:f}})}let s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof En){let u=this;return gt(async function(...f){
|
|
868
|
+
let h=new _t([]),m=await u._def.args.parseAsync(f,s).catch(g=>{throw h.addIssue(r(f,g)),h}),d=await Reflect.apply(a,this,m);return await u._def.returns._def.type.parseAsync(d,s).catch(g=>{throw h.addIssue(
|
|
869
|
+
i(d,g)),h})})}else{let u=this;return gt(function(...f){let h=u._def.args.safeParse(f,s);if(!h.success)throw new _t([r(f,h.error)]);let m=Reflect.apply(a,this,h.data),d=u._def.returns.safeParse(m,s);if(!d.
|
|
870
870
|
success)throw new _t([i(m,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:sn.create(t).rest(mn.create())})}returns(t){
|
|
871
871
|
return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||sn.create([]).rest(mn.create()),returns:n||mn.
|
|
872
872
|
create(),typeName:Ce.ZodFunction,...Me(r)})}},Vn=class extends Re{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,
|
|
@@ -884,9 +884,9 @@ async===!1)return pe(n,{code:se.invalid_type,expected:me.promise,received:n.pars
|
|
|
884
884
|
i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};En.create=(e,t)=>new En({type:e,typeName:Ce.ZodPromise,...Me(t)});var zt=class extends Re{innerType(){return this._def.schema}sourceType(){return this.
|
|
885
885
|
_def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:a=>{pe(r,a),a.fatal?
|
|
886
886
|
n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async u=>{if(n.value===
|
|
887
|
-
"aborted")return we;let
|
|
887
|
+
"aborted")return we;let f=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return f.status==="aborted"?we:f.status==="dirty"?Wn(f.value):n.value==="dirty"?Wn(f.value):f});{if(n.value===
|
|
888
888
|
"aborted")return we;let u=this._def.schema._parseSync({data:a,path:r.path,parent:r});return u.status==="aborted"?we:u.status==="dirty"?Wn(u.value):n.value==="dirty"?Wn(u.value):u}}if(i.type==="refinem\
|
|
889
|
-
ent"){let a=u=>{let
|
|
889
|
+
ent"){let a=u=>{let f=i.refinement(u,s);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parse\
|
|
890
890
|
Async instead.");return u};if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?we:(u.status==="dirty"&&n.dirty(),a(u.value),{status:n.
|
|
891
891
|
value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?we:(u.status==="dirty"&&n.dirty(),a(u.value).then(()=>({status:n.value,value:u.
|
|
892
892
|
value}))))}if(i.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!wn(a))return we;let u=i.transform(a.value,s);if(u instanceof Promise)
|
|
@@ -900,44 +900,44 @@ default,...Me(t)});var tr=class extends Re{_parse(t){let{ctx:n}=this._processInp
|
|
|
900
900
|
return Ir(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new _t(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.
|
|
901
901
|
value:this._def.catchValue({get error(){return new _t(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tr.create=(e,t)=>new tr({innerType:e,typeName:Ce.ZodCatch,catchValue:typeof t.
|
|
902
902
|
catch=="function"?t.catch:()=>t.catch,...Me(t)});var Br=class extends Re{_parse(t){if(this._getType(t)!==me.nan){let r=this._getOrReturnCtx(t);return pe(r,{code:se.invalid_type,expected:me.nan,received:r.
|
|
903
|
-
parsedType}),we}return{status:"valid",value:t.data}}};Br.create=e=>new Br({typeName:Ce.ZodNaN,...Me(e)});var
|
|
903
|
+
parsedType}),we}return{status:"valid",value:t.data}}};Br.create=e=>new Br({typeName:Ce.ZodNaN,...Me(e)});var qf=Symbol("zod_brand"),jr=class extends Re{_parse(t){let{ctx:n}=this._processInputParams(t),
|
|
904
904
|
r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Vr=class e extends Re{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)
|
|
905
905
|
return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?we:s.status==="dirty"?(n.dirty(),Wn(s.value)):this._def.out._parseAsync({data:s.value,
|
|
906
906
|
path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?we:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out.
|
|
907
907
|
_parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Ce.ZodPipeline})}},nr=class extends Re{_parse(t){let n=this._def.innerType._parse(t),r=i=>(wn(i)&&
|
|
908
908
|
(i.value=Object.freeze(i.value)),i);return Ir(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};nr.create=(e,t)=>new nr({innerType:e,typeName:Ce.ZodReadonly,...Me(t)});function ra(e,t){let n=typeof e==
|
|
909
909
|
"function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function la(e,t={},n){return e?Cn.create().superRefine((r,i)=>{let s=e(r);if(s instanceof Promise)return s.then(
|
|
910
|
-
a=>{if(!a){let u=ra(t,r),
|
|
910
|
+
a=>{if(!a){let u=ra(t,r),f=u.fatal??n??!0;i.addIssue({code:"custom",...u,fatal:f})}});if(!s){let a=ra(t,r),u=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:u})}}):Cn.create()}var Hf={object:Tt.lazycreate},Ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSy\
|
|
911
911
|
mbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="\
|
|
912
912
|
ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFuncti\
|
|
913
913
|
on",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="Zo\
|
|
914
|
-
dDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));var
|
|
915
|
-
create,
|
|
916
|
-
create,
|
|
917
|
-
|
|
918
|
-
number()}),
|
|
919
|
-
-pong"]).default("hold")}),
|
|
920
|
-
"mul"]).default("add"),seed:V.union([V.string(),V.number()]).optional(),noiseFreq:V.number().default(1),snap:V.number().optional()}),
|
|
921
|
-
ase","expo"]).default("linear"),apply:V.enum(["add","mul"]).default("add")});var Pi=(e,t)=>`${e}.jitter.${t}`;function
|
|
922
|
-
exec(e);return t?{key:t[1],field:t[2]}:void 0}function Pr(e){return
|
|
923
|
-
Aa=V.object({x:V.number(),y:V.number()}),
|
|
924
|
-
expr:V.string().optional()}),
|
|
925
|
-
length===0?!1:t.every(n=>n==="wire"||n==="base"||n==="track"||n==="jitter"||n==="stagger"||n==="expr")}function J(e){return e==null?{}:
|
|
926
|
-
ool","color","text","choice"]),
|
|
927
|
-
boolean().optional(),options:V.array(V.object({value:V.string(),label:V.string()})).optional(),description:V.string().optional()}),
|
|
928
|
-
params:V.record(
|
|
929
|
-
default(!1),micro:V.boolean().optional(),rows:V.array(
|
|
930
|
-
default("out"),to:V.string(),toPort:V.string()}),
|
|
914
|
+
dDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));var $f=(e,t={message:`Input not instance of ${e.name}`})=>la(n=>n instanceof e,t),ua=kn.create,ca=Xn.create,Uf=Br.create,zf=Gn.create,fa=qn.create,jf=Hn.create,Vf=kr.create,Zf=$n.create,Jf=Un.create,Kf=Cn.
|
|
915
|
+
create,eh=mn.create,th=Jt.create,nh=Cr.create,rh=An.create,oh=Tt.create,ih=Tt.strictCreate,sh=zn.create,ah=Po.create,lh=jn.create,uh=sn.create,ch=Mo.create,fh=Er.create,hh=Sr.create,ph=_o.create,dh=Vn.
|
|
916
|
+
create,mh=Zn.create,Ah=Jn.create,yh=Kn.create,gh=En.create,bh=zt.create,vh=$t.create,xh=an.create,Ih=zt.createWithPreprocess,wh=Vr.create,kh=()=>ua().optional(),Ch=()=>ca().optional(),Eh=()=>fa().optional(),
|
|
917
|
+
Sh={string:(e=>kn.create({...e,coerce:!0})),number:(e=>Xn.create({...e,coerce:!0})),boolean:(e=>qn.create({...e,coerce:!0})),bigint:(e=>Gn.create({...e,coerce:!0})),date:(e=>Hn.create({...e,coerce:!0}))};var Bh=we;var Ph=V.enum(["linear","step","ease-in","ease-out","ease-in-out","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic"]),ha=V.object({dt:V.number(),dv:V.
|
|
918
|
+
number()}),Mh=V.object({t:V.number(),value:V.number(),easing:Ph.default("ease-in-out"),hIn:ha.optional(),hOut:ha.optional()}),_h=V.object({keyframes:V.array(Mh),extrapolate:V.enum(["hold","loop","ping\
|
|
919
|
+
-pong"]).default("hold")}),Th=V.object({amount:V.number().default(0),distribution:V.enum(["uniform","gauss"]).default("uniform"),mode:V.enum(["frozen","animated"]).default("frozen"),apply:V.enum(["add",
|
|
920
|
+
"mul"]).default("add"),seed:V.union([V.string(),V.number()]).optional(),noiseFreq:V.number().default(1),snap:V.number().optional()}),Rh=V.object({amount:V.number().default(0),curve:V.enum(["linear","e\
|
|
921
|
+
ase","expo"]).default("linear"),apply:V.enum(["add","mul"]).default("add")});var Pi=(e,t)=>`${e}.jitter.${t}`;function Dh(e){let t=/^(.+)\.jitter\.(amount|seed)$/.exec(e);return t?{key:t[1],field:t[2]}:void 0}var da=(e,t="amount")=>`${e}.stagger.${t}`;function Oh(e){let t=/^(.+)\.stagger\.(amount)$/.
|
|
922
|
+
exec(e);return t?{key:t[1],field:t[2]}:void 0}function Pr(e){return Dh(e)?.key??Oh(e)?.key}var Nh=V.object({from:V.string(),port:V.string().default("out")}),ma=V.union([V.number(),V.string(),V.boolean()]),
|
|
923
|
+
Aa=V.object({x:V.number(),y:V.number()}),Qh=V.object({wire:Nh.optional(),base:V.union([ma,Aa,V.array(V.number()),V.array(V.string())]).optional(),track:_h.optional(),jitter:Th.optional(),stagger:Rh.optional(),
|
|
924
|
+
expr:V.string().optional()}),Lh=V.union([ma,Aa,V.array(V.number()),V.array(V.string()),Qh,V.null()]);function Fh(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.keys(e);return t.
|
|
925
|
+
length===0?!1:t.every(n=>n==="wire"||n==="base"||n==="track"||n==="jitter"||n==="stagger"||n==="expr")}function J(e){return e==null?{}:Fh(e)?e:{base:e}}var Zr=33,Yh=V.enum(["number","int","percent","b\
|
|
926
|
+
ool","color","text","choice"]),Wh=V.object({key:V.string(),title:V.string(),kind:Yh,min:V.number().optional(),max:V.number().optional(),step:V.number().optional(),alpha:V.boolean().optional(),multiline:V.
|
|
927
|
+
boolean().optional(),options:V.array(V.object({value:V.string(),label:V.string()})).optional(),description:V.string().optional()}),Xh=V.object({id:V.string(),type:V.string(),name:V.string().optional(),
|
|
928
|
+
params:V.record(Lh).default({}),position:V.object({x:V.number(),y:V.number()}).default({x:0,y:0}),seed:V.union([V.string(),V.number()]).optional(),collapsed:V.boolean().default(!1),disabled:V.boolean().
|
|
929
|
+
default(!1),micro:V.boolean().optional(),rows:V.array(Wh).optional(),units:V.record(V.string()).optional(),layer:V.string().optional()}),Gh=V.object({id:V.string(),from:V.string(),fromPort:V.string().
|
|
930
|
+
default("out"),to:V.string(),toPort:V.string()}),qh=V.object({nodes:V.array(Xh).default([]),edges:V.array(Gh).default([])}),Hh=V.object({w:V.number().int().positive().default(1920),h:V.number().int().
|
|
931
931
|
positive().default(1080),bg:V.string().default("#05070a"),origin:V.enum(["top-left","center"]).default("top-left"),display:V.enum(["vector","pixel","mono"]).default("vector"),ink:V.string().default("#\
|
|
932
|
-
ffffff"),threshold:V.number().min(0).max(1).default(.5)}),$
|
|
933
|
-
string(),name:V.string(),nodeIds:V.array(V.string()).default([]),collapsed:V.boolean().default(!1),exposed:V.array(V.string()).default([])}),
|
|
934
|
-
positive(),duration:V.number().nonnegative(),codec:V.string(),pixfmt:V.string(),range:V.enum(["limited","full"]),matrix:V.enum(["bt709","bt601"])}),
|
|
935
|
-
number().int().positive(),height:V.number().int().positive(),bytes:V.number().int().nonnegative(),video:
|
|
936
|
-
number().positive()}),ya=V.object({version:V.number().int().default(Zr),name:V.string().default("untitled"),seed:V.union([V.string(),V.number()]).default(1),canvas:
|
|
937
|
-
graph:
|
|
938
|
-
s.from):n.set(s.to,[s.from])}let r=new Map;for(let s of e.nodes){if(s.type!=="layer")continue;let a=[...n.get(s.id)??[]];for(;a.length>0;){let u=a.pop();if(To.has(t.get(u)))continue;let
|
|
939
|
-
(
|
|
940
|
-
function ga(e){let t=
|
|
932
|
+
ffffff"),threshold:V.number().min(0).max(1).default(.5)}),$h=V.object({fps:V.number().positive().default(30),duration:V.number().positive().default(4),loop:V.boolean().default(!1)}),Uh=V.object({id:V.
|
|
933
|
+
string(),name:V.string(),nodeIds:V.array(V.string()).default([]),collapsed:V.boolean().default(!1),exposed:V.array(V.string()).default([])}),zh=V.object({fps:V.number().positive(),frames:V.number().int().
|
|
934
|
+
positive(),duration:V.number().nonnegative(),codec:V.string(),pixfmt:V.string(),range:V.enum(["limited","full"]),matrix:V.enum(["bt709","bt601"])}),jh=V.object({name:V.string(),mime:V.string(),width:V.
|
|
935
|
+
number().int().positive(),height:V.number().int().positive(),bytes:V.number().int().nonnegative(),video:zh.optional()}),Vh=V.object({id:V.string(),layer:V.string(),start:V.number().nonnegative(),duration:V.
|
|
936
|
+
number().positive()}),ya=V.object({version:V.number().int().default(Zr),name:V.string().default("untitled"),seed:V.union([V.string(),V.number()]).default(1),canvas:Hh.default({}),timeline:$h.default({}),
|
|
937
|
+
graph:qh.default({}),groups:V.array(Uh).default([]),clips:V.array(Vh).default([]),assets:V.record(jh).default({})});var To=new Set(["canvas","layer","ograf"]);function Zh(e){let t=new Map(e.nodes.map(s=>[s.id,s.type])),n=new Map;for(let s of e.edges){if(!t.has(s.from)||!t.has(s.to))continue;let a=n.get(s.to);a?a.push(
|
|
938
|
+
s.from):n.set(s.to,[s.from])}let r=new Map;for(let s of e.nodes){if(s.type!=="layer")continue;let a=[...n.get(s.id)??[]];for(;a.length>0;){let u=a.pop();if(To.has(t.get(u)))continue;let f=r.get(u);f||
|
|
939
|
+
(f=new Set,r.set(u,f)),!f.has(s.id)&&(f.add(s.id),a.push(...n.get(u)??[]))}}let i=new Map;for(let s of e.nodes){let a=To.has(s.type)?void 0:r.get(s.id);i.set(s.id,a&&a.size===1?[...a][0]:void 0)}return i}
|
|
940
|
+
function ga(e){let t=Zh(e);for(let n of e.nodes){let r=t.get(n.id);r?n.layer=r:delete n.layer}return e}var ba=new Set(["text","random-code","radial-labels"]),pa=new Set([...ba,"row-labels"]),Jh={1:e=>{let t=e.graph,n=new Set((t?.nodes??[]).filter(r=>ba.has(r.type)).map(r=>r.id));for(let r of t?.nodes??
|
|
941
941
|
[]){if(!n.has(r.id))continue;let i={...r.params??{}},s=i.stroke;if(s!==void 0){i.fill=s;let a=typeof s=="object"&&s!==null?s.base:s;typeof a=="string"?i.stroke=a:delete i.stroke}else delete i.fill;i.strokeWidth=
|
|
942
942
|
0,r.params=i}for(let r of t?.edges??[])n.has(r.to)&&r.toPort==="stroke"&&(r.toPort="fill");return{...e,version:2}},2:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="text")continue;let r={...n.
|
|
943
943
|
params??{}};r.fontFamily??(r.fontFamily="IBM Plex Mono"),r.fontSize??(r.fontSize=12),r.anchor??(r.anchor="start"),n.params=r}return{...e,version:3}},3:e=>{let t={left:{angle:180,alignY:!1},"center-x":{
|
|
@@ -948,8 +948,8 @@ delete i.centerY,r.params=i}return{...e,version:4}},4:e=>{let t=e.graph;for(let
|
|
|
948
948
|
nodes??[]){if(n.type!=="boolean")continue;let r={...n.params??{}};r.keepStyle??(r.keepStyle=!1),n.params=r}return{...e,version:7}},7:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="jitter")continue;
|
|
949
949
|
let r={...n.params??{}};typeof r.salt=="string"&&(r.salt===""?delete r.salt:r.salt=[...r.salt].reduce((i,s)=>(i*31+s.charCodeAt(0))%1e5,7)),n.params=r}return{...e,version:8}},8:e=>{let t=e.graph;for(let n of t?.
|
|
950
950
|
nodes??[]){if(n.type!=="transform")continue;let r={...n.params??{}};r.pivot??(r.pivot="custom"),n.params=r}return{...e,version:9}},9:e=>{let t=e.canvas,n=t?.origin==="center",r=e.graph;for(let i of r?.
|
|
951
|
-
nodes??[]){if(i.type!=="transform"&&i.type!=="array-linear")continue;let s={...i.params??{}},a=s.pivot,u=typeof a=="object"&&a!==null?a.base:a,h
|
|
952
|
-
|
|
951
|
+
nodes??[]){if(i.type!=="transform"&&i.type!=="array-linear")continue;let s={...i.params??{}},a=s.pivot,u=typeof a=="object"&&a!==null?a.base:a,f=h=>{s.pivot=typeof a=="object"&&a!==null?{...a,base:h}:
|
|
952
|
+
h};u==="origin"?f("canvas"):u==="canvas"&&!n&&(f("custom"),s.pivotX=(t?.w??1920)/2,s.pivotY=(t?.h??1080)/2),i.params=s}return{...e,version:10}},10:e=>{let t=e.graph;for(let n of t?.nodes??[]){let r={...n.
|
|
953
953
|
params??{}};if(n.type==="jitter")r.uniformScale??(r.uniformScale=!1);else if(n.type==="slice")r.anchor??(r.anchor="canvas");else continue;n.params=r}return{...e,version:11}},11:e=>{let t=e.graph;for(let n of t?.
|
|
954
954
|
nodes??[]){if(!pa.has(n.type))continue;let r={...n.params??{}};r.strokeWidth??(r.strokeWidth=1);let i=r.filled;if((typeof i=="object"&&i!==null?i.base:i)===!1){let a=r.fill;r.fill=typeof a=="object"&&
|
|
955
955
|
a!==null?{...a,base:"none"}:"none"}delete r.filled,n.params=r}return{...e,version:12}},12:e=>{let t={...e.timeline??{}};return t.loop??(t.loop=!0),{...e,timeline:t,version:13}},13:e=>{let t=e.graph;for(let n of t?.
|
|
@@ -958,34 +958,34 @@ y-linear")continue;let r={...n.params??{}};r.origin??(r.origin="start"),n.params
|
|
|
958
958
|
{}};r.setStroke??(r.setStroke=!0),r.stroke??(r.stroke="#e8f4ff"),n.params=r}return{...e,version:16}},16:e=>{let t=e.graph,n=new Set((t?.nodes??[]).filter(r=>r.type==="style-tokens").map(r=>r.id));for(let r of t?.
|
|
959
959
|
edges??[]){let i=r.fromPort;n.has(r.from)&&typeof i=="string"&&i.startsWith("param:")&&(r.fromPort=i.slice(6))}return{...e,version:17}},17:e=>{let t=e.graph,n=["accent","dim","faint","ink","warn","bg"],
|
|
960
960
|
r=["dealAccent","dealDim","dealFaint","dealInk","dealWarn","dealBg"],i=new Set;for(let s of t?.nodes??[]){if(s.type!=="palette")continue;i.add(s.id);let a=s.params??{},u={wear:!1,preset:"custom"};for(let m of[
|
|
961
|
-
"mode","target","skip","salt"])a[m]!==void 0&&(u[m]=a[m]);u.mode??(u.mode="random");let
|
|
962
|
-
let A=a[`color${d+1}`];A!==void 0&&(u[m]=A),u[r[d]]=d<
|
|
961
|
+
"mode","target","skip","salt"])a[m]!==void 0&&(u[m]=a[m]);u.mode??(u.mode="random");let f=a.count,h=typeof f=="number"?f:typeof f=="object"&&f!==null&&typeof f.base=="number"?f.base:3;n.forEach((m,d)=>{
|
|
962
|
+
let A=a[`color${d+1}`];A!==void 0&&(u[m]=A),u[r[d]]=d<h}),s.type="style-tokens",s.params=u}for(let s of t?.edges??[]){if(!i.has(s.to)||typeof s.toPort!="string")continue;let a=/^color([1-6])$/.exec(s.
|
|
963
963
|
toPort);a&&(s.toPort=n[Number(a[1])-1])}return{...e,version:18}},18:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="noise")continue;let r={...n.params??{}};typeof r.salt=="string"&&(r.salt===
|
|
964
964
|
""?delete r.salt:r.salt=[...r.salt].reduce((i,s)=>(i*31+s.charCodeAt(0))%1e5,7)),n.params=r}return{...e,version:19}},19:e=>{let t=e.graph,n=new Set(["lfo","random-value","random-step","switch","switch\
|
|
965
965
|
-value","switch-color"]);for(let r of t?.nodes??[]){if(!n.has(r.type))continue;let i={...r.params??{}};typeof i.salt=="string"&&(i.salt===""?delete i.salt:i.salt=[...i.salt].reduce((s,a)=>(s*31+a.charCodeAt(
|
|
966
966
|
0))%1e5,7)),r.params=i}return{...e,version:20}},20:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="style-tokens")continue;let r={...n.params??{}};r.wear===void 0&&(r.wear=!0),n.params=r}return{
|
|
967
967
|
...e,version:21}},21:e=>{let t=e.graph,n=new Set(["switch","switch-value","switch-color"]),r=i=>typeof i=="object"&&i!==null?i.base:i;for(let i of t?.nodes??[]){if(!n.has(i.type))continue;let s={...i.
|
|
968
|
-
params??{}};if(r(s.range)==="normalized")continue;let a=s.index;if(typeof a=="number")s.index=a-1;else if(typeof a=="object"&&a!==null){let u={...a};typeof u.base=="number"&&(u.base=u.base-1);let
|
|
969
|
-
track;
|
|
968
|
+
params??{}};if(r(s.range)==="normalized")continue;let a=s.index;if(typeof a=="number")s.index=a-1;else if(typeof a=="object"&&a!==null){let u={...a};typeof u.base=="number"&&(u.base=u.base-1);let f=u.
|
|
969
|
+
track;f?.keyframes&&(u.track={...f,keyframes:f.keyframes.map(h=>typeof h.value=="number"?{...h,value:h.value-1}:h)}),s.index=u}i.params=s}return{...e,version:22}},22:e=>{let t=e.graph;for(let n of t?.
|
|
970
970
|
nodes??[]){if(n.type!=="scatter")continue;let r={...n.params??{}};r.anchor??(r.anchor="corner"),n.params=r}return{...e,version:23}},23:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="random-\
|
|
971
971
|
code")continue;let r={...n.params??{}};r.stackAnchor??(r.stackAnchor="corner"),n.params=r}return{...e,version:24}},24:e=>{let t=e.graph,n=r=>typeof r=="object"&&r!==null?r.base:r;for(let r of t?.nodes??
|
|
972
972
|
[]){if(r.type!=="grid"&&r.type!=="array-grid")continue;let i={...r.params??{}};n(i.square)===!0&&(i.squareFit??(i.squareFit="top"),r.params=i)}return{...e,version:25}},25:e=>({...e,version:26}),26:e=>{
|
|
973
973
|
let t=e.graph,n={circle:0,"tick-ring":0,"polar-grid":0,"array-radial":0,"radial-labels":0,sort:0,bend:void 0};for(let r of t?.nodes??[]){let i=r.type;if(!(i in n))continue;let s={...r.params??{}},a=s.
|
|
974
974
|
start;if(a==null){let u=n[i];u!==void 0&&(s.start=u+90)}else if(typeof a=="number")s.start=a+90;else if(typeof a=="object"){let u={...a};typeof u.base=="number"?u.base=u.base+90:u.base===void 0&&u.expr===
|
|
975
|
-
void 0&&n[i]!==void 0&&(u.base=n[i]+90),typeof u.expr=="string"&&u.expr.trim()!==""&&(u.expr=`(${u.expr}) + 90`);let
|
|
976
|
-
"number"?{...
|
|
977
|
-
filter(a=>a.type==="canvas")){let a=0;for(let u=0;u<r.length;u++){let
|
|
978
|
-
a++;continue}let m=
|
|
979
|
-
r.splice(u,1,{id:`${d}:out`,from:d,fromPort:"out",to:s.id,toPort:"in"},{...
|
|
975
|
+
void 0&&n[i]!==void 0&&(u.base=n[i]+90),typeof u.expr=="string"&&u.expr.trim()!==""&&(u.expr=`(${u.expr}) + 90`);let f=u.track;f?.keyframes&&(u.track={...f,keyframes:f.keyframes.map(h=>typeof h.value==
|
|
976
|
+
"number"?{...h,value:h.value+90}:h)}),s.start=u}r.params=s}return{...e,version:27}},27:e=>{let t=e.graph;if(t){let n=t.nodes??(t.nodes=[]),r=t.edges??(t.edges=[]),i=new Map(n.map(s=>[s.id,s]));for(let s of n.
|
|
977
|
+
filter(a=>a.type==="canvas")){let a=0;for(let u=0;u<r.length;u++){let f=r[u];if(f.to!==s.id||f.toPort!=="in")continue;let h=i.get(f.from);if(!h||h.type==="layer"||String(f.fromPort).startsWith("param:")){
|
|
978
|
+
a++;continue}let m=Kh.has(h.type),d=`${s.id}:implicit:${a}`,A=h.position??{x:0,y:0};n.push({id:d,type:"layer",params:{name:m?"Post":"Shapes",order:a},position:{x:A.x+260,y:A.y},collapsed:!1,disabled:!1}),
|
|
979
|
+
r.splice(u,1,{id:`${d}:out`,from:d,fromPort:"out",to:s.id,toPort:"in"},{...f,to:d,toPort:m?"texture":"in"}),u++,a++}}ga(t)}return{...e,clips:Array.isArray(e.clips)?e.clips:[],version:28}},28:e=>{let t=e.
|
|
980
980
|
graph;for(let n of t?.nodes??[]){if(n.type!=="layer")continue;let r={...n.params??{}},i=r.name,s=typeof i=="string"?i:typeof i=="object"&&i!==null&&typeof i.base=="string"?i.base:void 0;s!==void 0&&typeof n.
|
|
981
|
-
name!="string"&&(n.name=s),delete r.name,n.params=r}return{...e,version:29}},29:e=>{let n=(e.graph?.nodes??[]).filter(a=>a.type==="layer"),r=a=>{let u=a.params?.order,
|
|
982
|
-
base:u;return typeof
|
|
981
|
+
name!="string"&&(n.name=s),delete r.name,n.params=r}return{...e,version:29}},29:e=>{let n=(e.graph?.nodes??[]).filter(a=>a.type==="layer"),r=a=>{let u=a.params?.order,f=typeof u=="object"&&u!==null?u.
|
|
982
|
+
base:u;return typeof f=="number"?f:void 0},s=1-Math.min(1,...n.map(a=>r(a)??0));for(let a of n){let u={...a.params??{}},f=u.order,h=r(a)??0;u.order=typeof f=="object"&&f!==null?{...f,base:h+s}:h+s,a.params=
|
|
983
983
|
u}return{...e,version:30}},30:e=>{let t=e.graph,n=new Set((t?.edges??[]).filter(r=>r.toPort==="ref").map(r=>r.to));for(let r of t?.nodes??[]){if(r.type!=="transform"||!n.has(r.id))continue;let i={...r.
|
|
984
984
|
params??{}},s=i.pivot,a=typeof s=="object"&&s!==null?s.base:s;a!==void 0&&a!=="shape"||(i.pivot=typeof s=="object"&&s!==null?{...s,base:"ref"}:"ref",r.params=i)}return{...e,version:31}},31:e=>{let t=e.
|
|
985
985
|
graph,n=new Set((t?.nodes??[]).filter(r=>r.type==="layer").map(r=>r.id));for(let r of t?.edges??[])r.toPort==="texture"&&n.has(r.to)&&(r.toPort="in");return{...e,version:32}},32:e=>{let t=e.graph;for(let n of t?.
|
|
986
|
-
nodes??[]){if(n.type!=="grid"&&n.type!=="polar-grid")continue;let r=n.params??(n.params={});r.subJoin??(r.subJoin=!1)}return{...e,version:33}}},
|
|
986
|
+
nodes??[]){if(n.type!=="grid"&&n.type!=="polar-grid")continue;let r=n.params??(n.params={});r.subJoin??(r.subJoin=!1)}return{...e,version:33}}},Kh=new Set(["rasterize","blur","bloom","glitch","chromat\
|
|
987
987
|
ic","scanlines","fade","blend","switch-texture"]);function va(e){let t=[];if(typeof e!="object"||e===null)throw new Error("Not a FUI project: expected a JSON object");let n=structuredClone(e),r=typeof n.
|
|
988
|
-
version=="number"?n.version:1;for(r>Zr&&t.push(`Project was written by a newer build (v${r} > v${Zr}); loading anyway, unknown fields will be dropped.`);r<Zr;){let s=
|
|
988
|
+
version=="number"?n.version:1;for(r>Zr&&t.push(`Project was written by a newer build (v${r} > v${Zr}); loading anyway, unknown fields will be dropped.`);r<Zr;){let s=Jh[r];if(!s)throw new Error(`No mi\
|
|
989
989
|
gration from document version ${r}`);n=s(n),r=typeof n.version=="number"?n.version:r+1}let i=ya.parse({...n,version:Zr});return t.push(...tp(i)),t.push(...ep(i)),{project:i,warnings:t}}function ep(e){
|
|
990
990
|
let t=[],n=new Set(e.graph.nodes.filter(r=>r.type==="layer").map(r=>r.id));e.clips=e.clips.filter(r=>n.has(r.layer)?!0:(t.push(`Dropped clip ${r.id}: no Layer "${r.layer}"`),!1));for(let r of e.graph.
|
|
991
991
|
nodes)r.layer!==void 0&&(To.has(r.type)?(t.push(`${r.type} "${r.id}" lives in the root, not in Layer "${r.layer}"`),delete r.layer):n.has(r.layer)||(t.push(`Node "${r.id}" names a missing Layer "${r.layer}\
|
|
@@ -997,33 +997,33 @@ return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3
|
|
|
997
997
|
e,0,0,t,0,0]}function jt(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return[n,r,-r,n,0,0]}function Dr(e,t,n){return Ae(Ae(_e(t,n),jt(e)),_e(-t,-n))}function un(e,t){return{x:e[0]*t.x+e[2]*t.y+e[4],
|
|
998
998
|
y:e[1]*t.x+e[3]*t.y+e[5]}}function Yi(e){let t=e[0]*e[3]-e[1]*e[2];if(t===0||!Number.isFinite(t))return;let n=e[3]/t,r=-e[1]/t,i=-e[2]/t,s=e[0]/t;return[n,r,i,s,-(n*e[4]+i*e[5]),-(r*e[4]+s*e[5])]}function eo(e){return e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0}function en(e){let{tx:t=0,ty:n=0,rotation:r=0,sx:i=1,sy:s=1,pivot:a={x:0,y:0}}=e,u=_e(t,n);return u=Ae(u,_e(a.x,a.y)),r!==
|
|
999
999
|
0&&(u=Ae(u,jt(r))),(i!==1||s!==1)&&(u=Ae(u,Kt(i,s))),u=Ae(u,_e(-a.x,-a.y)),u}var Ro=16,rp=64,op=/[A-Za-z]|-?(?:\d+\.?\d*|\.\d+)(?:[eE]-?\d+)?/g;function ip(e){let t=e.match(op)??[],n=[],r=[],i={x:0,y:0},
|
|
1000
|
-
s={x:0,y:0},a,u,
|
|
1001
|
-
"0"&&E[0]!=="1"?(
|
|
1000
|
+
s={x:0,y:0},a,u,f=0,h=!1,m=E=>{r.length>=2&&n.push({points:r,closed:E}),r=[]},d=()=>{let E=t[f];return E===void 0||/[A-Za-z]/.test(E)?(h=!0,0):(f++,Number(E))},A=()=>{let E=t[f];return E===void 0||E[0]!==
|
|
1001
|
+
"0"&&E[0]!=="1"?(h=!0,0):E.length===1?(f++,Number(E)):(t[f]=E.slice(1),Number(E[0]))},g=()=>f<t.length&&!/[A-Za-z]/.test(t[f]),x=E=>{r.push(E),i=E,a=u=void 0},v=()=>{r.length===0&&r.push(i)},b=(E,T,M)=>{
|
|
1002
1002
|
v();for(let R=1;R<=Ro;R++){let S=R/Ro,_=1-S;r.push({x:_*_*_*i.x+3*_*_*S*E.x+3*_*S*S*T.x+S*S*S*M.x,y:_*_*_*i.y+3*_*_*S*E.y+3*_*S*S*T.y+S*S*S*M.y})}i=M,a=T,u=void 0},w=(E,T)=>{v();for(let M=1;M<=Ro;M++){
|
|
1003
1003
|
let R=M/Ro,S=1-R;r.push({x:S*S*i.x+2*S*R*E.x+R*R*T.x,y:S*S*i.y+2*S*R*E.y+R*R*T.y})}i=T,u=E,a=void 0},P=(E,T,M,R,S,_)=>{v();let Q=Math.abs(E),Y=Math.abs(T);if(Q===0||Y===0||i.x===_.x&&i.y===_.y){i.x===
|
|
1004
|
-
_.x&&i.y===_.y||x(_),i=_,a=u=void 0;return}let G=M*Math.PI/180,q=Math.cos(G),X=Math.sin(G),te=(i.x-_.x)/2,ce=(i.y-_.y)/2,ue=q*te+X*ce,ie=-X*te+q*ce,
|
|
1005
|
-
|
|
1004
|
+
_.x&&i.y===_.y||x(_),i=_,a=u=void 0;return}let G=M*Math.PI/180,q=Math.cos(G),X=Math.sin(G),te=(i.x-_.x)/2,ce=(i.y-_.y)/2,ue=q*te+X*ce,ie=-X*te+q*ce,fe=ue*ue/(Q*Q)+ie*ie/(Y*Y);if(fe>1){let Ze=Math.sqrt(
|
|
1005
|
+
fe);Q*=Ze,Y*=Ze}let ve=R!==S?1:-1,ne=Q*Q*ie*ie+Y*Y*ue*ue,ye=Math.max(0,Q*Q*Y*Y-ne),Be=ve*Math.sqrt(ne===0?0:ye/ne),Ee=Be*Q*ie/Y,We=-Be*Y*ue/Q,at=q*Ee-X*We+(i.x+_.x)/2,lt=X*Ee+q*We+(i.y+_.y)/2,wt=(Ze,ae,xe,Te)=>{
|
|
1006
1006
|
let Xe=Ze*xe+ae*Te,it=Math.hypot(Ze,ae)*Math.hypot(xe,Te),kt=Math.acos(Math.max(-1,Math.min(1,Xe/it)));return Ze*Te-ae*xe<0&&(kt=-kt),kt},nn=wt(1,0,(ue-Ee)/Q,(ie-We)/Y),yt=wt((ue-Ee)/Q,(ie-We)/Y,(-ue-
|
|
1007
1007
|
Ee)/Q,(-ie-We)/Y);S===0&&yt>0&&(yt-=2*Math.PI),S===1&&yt<0&&(yt+=2*Math.PI);let Bt=Math.max(2,Math.ceil(Math.abs(yt)/(2*Math.PI)*rp));for(let Ze=1;Ze<=Bt;Ze++){let ae=nn+yt*Ze/Bt,xe=Q*Math.cos(ae),Te=Y*
|
|
1008
|
-
Math.sin(ae);r.push({x:q*xe-X*Te+at,y:X*xe+q*Te+lt})}i=_,a=u=void 0};for(;
|
|
1009
|
-
M":{m(!1);let R=!0;for(;g()&&!
|
|
1010
|
-
x+d(),y:i.y});while(g()&&!
|
|
1011
|
-
!
|
|
1012
|
-
y+d()})}while(g()&&!
|
|
1013
|
-
y+d()})}while(g()&&!
|
|
1008
|
+
Math.sin(ae);r.push({x:q*xe-X*Te+at,y:X*xe+q*Te+lt})}i=_,a=u=void 0};for(;f<t.length&&!h;){let E=t[f];if(!/^[A-Za-z]$/.test(E)){h=!0;break}f++;let T=E===E.toLowerCase(),M=()=>T?i:{x:0,y:0};switch(E.toUpperCase()){case"\
|
|
1009
|
+
M":{m(!1);let R=!0;for(;g()&&!h;){let S={x:M().x+d(),y:M().y+d()};R?(i=S,s=S,r=[S],a=u=void 0,R=!1):x(S)}R&&(h=!0);break}case"L":do x({x:M().x+d(),y:M().y+d()});while(g()&&!h);break;case"H":do x({x:M().
|
|
1010
|
+
x+d(),y:i.y});while(g()&&!h);break;case"V":do x({x:i.x,y:M().y+d()});while(g()&&!h);break;case"C":do{let R={x:M().x+d(),y:M().y+d()},S={x:M().x+d(),y:M().y+d()};b(R,S,{x:M().x+d(),y:M().y+d()})}while(g()&&
|
|
1011
|
+
!h);break;case"S":do{let R=a?{x:2*i.x-a.x,y:2*i.y-a.y}:i,S={x:M().x+d(),y:M().y+d()};b(R,S,{x:M().x+d(),y:M().y+d()})}while(g()&&!h);break;case"Q":do{let R={x:M().x+d(),y:M().y+d()};w(R,{x:M().x+d(),y:M().
|
|
1012
|
+
y+d()})}while(g()&&!h);break;case"T":do{let R=u?{x:2*i.x-u.x,y:2*i.y-u.y}:i;w(R,{x:M().x+d(),y:M().y+d()})}while(g()&&!h);break;case"A":do{let R=d(),S=d(),_=d(),Q=A(),Y=A();P(R,S,_,Q,Y,{x:M().x+d(),y:M().
|
|
1013
|
+
y+d()})}while(g()&&!h);break;case"Z":m(!0),i=s,a=u=void 0;break;default:h=!0}}return h?[]:(m(!1),n)}function Oa(e){let t=r=>String(Math.round(r*1e3)/1e3),n=[];for(let r of e){if(r.points.length<2)continue;
|
|
1014
1014
|
let[i,...s]=r.points;n.push(`M${t(i.x)} ${t(i.y)}`+s.map(a=>`L${t(a.x)} ${t(a.y)}`).join("")+(r.closed?"Z":""))}return n.join("")}var Ti=96;function Mr(e,t,n,r,i){let s=Math.abs(i-r),a=Math.max(2,Math.
|
|
1015
|
-
ceil(s/360*Ti)),u=[];for(let
|
|
1016
|
-
t":case"image":{let{x:r,y:i,w:s,h:a}=e,u=e.kind==="rect"?Math.min(Math.max(0,e.rx),s/2,a/2):0;if(u>0){let
|
|
1017
|
-
u,u,180,270)];n.push({points:
|
|
1015
|
+
ceil(s/360*Ti)),u=[];for(let f=0;f<=a;f++){let h=(r+(i-r)*f/a)*Math.PI/180;u.push({x:e+n*Math.cos(h),y:t+n*Math.sin(h)})}return u}function et(e){let t=r=>un(e.transform,r),n=[];switch(e.kind){case"rec\
|
|
1016
|
+
t":case"image":{let{x:r,y:i,w:s,h:a}=e,u=e.kind==="rect"?Math.min(Math.max(0,e.rx),s/2,a/2):0;if(u>0){let f=[...Mr(r+s-u,i+u,u,270,360),...Mr(r+s-u,i+a-u,u,0,90),...Mr(r+u,i+a-u,u,90,180),...Mr(r+u,i+
|
|
1017
|
+
u,u,180,270)];n.push({points:f.map(t),closed:!0});break}n.push({points:[{x:r,y:i},{x:r+s,y:i},{x:r+s,y:i+a},{x:r,y:i+a}].map(t),closed:!0});break}case"circle":n.push({points:Mr(e.cx,e.cy,e.r,0,360).slice(
|
|
1018
1018
|
0,-1).map(t),closed:!0});break;case"ellipse":{let r=[];for(let i=0;i<Ti;i++){let s=i/Ti*Math.PI*2;r.push(t({x:e.cx+e.rx*Math.cos(s),y:e.cy+e.ry*Math.sin(s)}))}n.push({points:r,closed:!0});break}case"a\
|
|
1019
1019
|
rc":n.push({points:Mr(e.cx,e.cy,e.r,e.a0,e.a1).map(t),closed:!1});break;case"polyline":n.push({points:e.points.map(t),closed:e.closed});break;case"group":for(let r of e.children)n.push(...et(r));break;case"\
|
|
1020
1020
|
path":{for(let r of ip(e.d))n.push({points:r.points.map(t),closed:r.closed});break}case"text":break}return n}function Sn(e,t=!1){let n=0;for(let r=1;r<e.length;r++)n+=Math.hypot(e[r].x-e[r-1].x,e[r].y-
|
|
1021
1021
|
e[r-1].y);if(t&&e.length>1){let r=e[e.length-1],i=e[0];n+=Math.hypot(i.x-r.x,i.y-r.y)}return n}function Wi(e,t){return t&&e.length>1?[...e,e[0]]:e}function ir(e,t,n=!1){let r=Wi(e,n);if(r.length===0)return{
|
|
1022
|
-
x:0,y:0};if(r.length===1)return r[0];let i=Math.max(0,t);for(let s=1;s<r.length;s++){let a=r[s-1],u=r[s],
|
|
1023
|
-
a.y)*
|
|
1024
|
-
0){if(i<=
|
|
1025
|
-
max(0,Math.min(1,n))*s;if(u<=a)return[];let
|
|
1026
|
-
ir(i,u)),
|
|
1022
|
+
x:0,y:0};if(r.length===1)return r[0];let i=Math.max(0,t);for(let s=1;s<r.length;s++){let a=r[s-1],u=r[s],f=Math.hypot(u.x-a.x,u.y-a.y);if(f!==0){if(i<=f){let h=i/f;return{x:a.x+(u.x-a.x)*h,y:a.y+(u.y-
|
|
1023
|
+
a.y)*h}}i-=f}}return r[r.length-1]}function ar(e,t,n=!1){let r=Wi(e,n);if(r.length<2)return{x:1,y:0};let i=Math.max(0,t);for(let s=1;s<r.length;s++){let a=r[s-1],u=r[s],f=Math.hypot(u.x-a.x,u.y-a.y);if(f!==
|
|
1024
|
+
0){if(i<=f||s===r.length-1)return{x:(u.x-a.x)/f,y:(u.y-a.y)/f};i-=f}}return{x:1,y:0}}function Xi(e,t,n,r=!1){let i=Wi(e,r),s=Sn(i);if(s===0||i.length<2)return[];let a=Math.max(0,Math.min(1,t))*s,u=Math.
|
|
1025
|
+
max(0,Math.min(1,n))*s;if(u<=a)return[];let f=[ir(i,a)],h=0;for(let m=1;m<i.length;m++){let d=i[m-1],A=i[m],g=Math.hypot(A.x-d.x,A.y-d.y),x=h,v=h+g;if(v>a&&v<u&&f.push(A),h=v,h>=u)break}return f.push(
|
|
1026
|
+
ir(i,u)),f}function $e(e){if(e.kind==="text"){let r=e.metrics?e.metrics.width:e.text.length*e.fontSize*.6+e.letterSpacing*e.text.length,i=e.metrics?e.metrics.capHeight:e.fontSize,s=e.anchor==="middle"?e.x-r/2:e.
|
|
1027
1027
|
anchor==="end"?e.x-r:e.x,a=[{x:s,y:e.y-i},{x:s+r,y:e.y-i},{x:s+r,y:e.y},{x:s,y:e.y}].map(u=>un(e.transform,u));return Ri(a)}let n=et(e).flatMap(r=>r.points);return n.length>0?Ri(n):void 0}function Ri(e){
|
|
1028
1028
|
if(e.length===0)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let s of e)s.x<t&&(t=s.x),s.x>r&&(r=s.x),s.y<n&&(n=s.y),s.y>i&&(i=s.y);return{x:t,y:n,w:r-t,h:i-n}}function tt(e){let t;for(let n of e){let r=$e(
|
|
1029
1029
|
n);r&&(t=t?Gi(t,r):r)}return t}function Gi(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,w:Math.max(e.x+e.w,t.x+t.w)-n,h:Math.max(e.y+e.h,t.y+t.h)-r}}function Ue(e){return{x:e.x+e.w/
|
|
@@ -1035,31 +1035,31 @@ return e.x===0&&e.y===0&&e.z===0&&e.rx===0&&e.ry===0&&e.rz===0&&e.sx===1&&e.sy==
|
|
|
1035
1035
|
pivot.y-t.y,i=Mi(e.x,e.y,e.z);return i=_r(i,Mi(n,r,0)),e.rz!==0&&(i=_r(i,up(e.rz))),e.ry!==0&&(i=_r(i,lp(e.ry))),e.rx!==0&&(i=_r(i,ap(e.rx))),(e.sx!==1||e.sy!==1)&&(i=_r(i,sp(e.sx,e.sy,1))),i=_r(i,Mi(
|
|
1036
1036
|
-n,-r,0)),i}function cp(e,t){let n=t>0?[e[8]/t,e[9]/t,1+e[11]/t]:[0,0,1];return[e[0],e[1],e[3],e[4],e[5],e[7],...n]}function xa(e,t){let n=new Array(9),r=e,i=t;for(let s=0;s<3;s++)for(let a=0;a<3;a++)
|
|
1037
1037
|
n[s*3+a]=r[s*3]*i[a]+r[s*3+1]*i[3+a]+r[s*3+2]*i[6+a];return n}function Ia(e,t){return[1,0,e,0,1,t,0,0,1]}function no(e,t){let n=lr(t),r=cp(qi(e,n),t.perspective);return xa(Ia(n.x,n.y),xa(r,Ia(-n.x,-n.
|
|
1038
|
-
y)))}function
|
|
1039
|
-
x,-(t*a-r*i)*x,A*x,-(t*
|
|
1040
|
-
abs(r*r+a*a-1)>n||Math.abs(i*i+u*u-1)>n||Math.abs(r*i+a*u)>n))return[r,a,i,u,s,
|
|
1041
|
-
e[7])/s,
|
|
1042
|
-
sqrt((u+Math.sqrt(
|
|
1043
|
-
or;s!==r&&t.push(Ya(n,i,(or-n.w)/(i.w-n.w))),s&&t.push(i),n=i,r=s}return t}function
|
|
1044
|
-
a,i,(or-a.w)/(i.w-a.w));u?(n.push(
|
|
1045
|
-
y:a.v/a.w}));if(n){let s=
|
|
1046
|
-
Ri(r):void 0}function Fo(e,t){return e[8]*t.x+e[9]*t.y+e[11]}function Xa(e,t,n){let r=e[2],i=e[6],s=e[10];if(n<=0)return s>0;let a=e[0]*t.x+e[1]*t.y+e[3],u=e[4]*t.x+e[5]*t.y+e[7],
|
|
1047
|
-
i*u+s*(
|
|
1038
|
+
y)))}function Na(e){let[t,n,r,i,s,a,u,f,h]=e,m=s*h-a*f,d=-(i*h-a*u),A=i*f-s*u,g=t*m+n*d+r*A;if(!Number.isFinite(g)||Math.abs(g)<1e-12)return;let x=1/g;return[m*x,-(n*h-r*f)*x,(n*a-r*s)*x,d*x,(t*h-r*u)*
|
|
1039
|
+
x,-(t*a-r*i)*x,A*x,-(t*f-n*u)*x,(t*s-n*i)*x]}function Qa(e,t){return{u:e[0]*t.x+e[1]*t.y+e[2],v:e[3]*t.x+e[4]*t.y+e[5],w:e[6]*t.x+e[7]*t.y+e[8]}}function La(e){let t=e[8];if(!Number.isFinite(t)||Math.abs(t)<1e-12)return;let n=1e-9;if(Math.abs(e[6]/t)>n||Math.abs(e[7]/t)>n)return;let r=e[0]/t,i=e[1]/t,s=e[2]/t,a=e[3]/t,u=e[4]/t,f=e[5]/t;if(!(Math.
|
|
1040
|
+
abs(r*r+a*a-1)>n||Math.abs(i*i+u*u-1)>n||Math.abs(r*i+a*u)>n))return[r,a,i,u,s,f]}function ro(e,t){let{u:n,v:r,w:i}=Qa(e,t);if(i<or)return;let s=i*i,a=(e[0]*i-n*e[6])/s,u=(e[3]*i-r*e[6])/s,f=(e[1]*i-n*
|
|
1041
|
+
e[7])/s,h=(e[4]*i-r*e[7])/s,m=n/i,d=r/i;return[a,u,f,h,m-(a*t.x+f*t.y),d-(u*t.x+h*t.y)]}function Fa(e,t){let n=ro(e,t);if(!n)return;let[r,i,s,a]=n,u=r*r+i*i+s*s+a*a,f=r*a-i*s,h=Math.max(0,u*u-4*f*f);return Math.
|
|
1042
|
+
sqrt((u+Math.sqrt(h))/2)}var Ya=(e,t,n)=>({u:e.u+(t.u-e.u)*n,v:e.v+(t.v-e.v)*n,w:e.w+(t.w-e.w)*n});function fp(e){if(e.length===0)return[];let t=[],n=e[e.length-1],r=n.w>=or;for(let i of e){let s=i.w>=
|
|
1043
|
+
or;s!==r&&t.push(Ya(n,i,(or-n.w)/(i.w-n.w))),s&&t.push(i),n=i,r=s}return t}function hp(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r],s=i.w>=or;if(r>0){let a=e[r-1],u=a.w>=or;if(s!==u){let f=Ya(
|
|
1044
|
+
a,i,(or-a.w)/(i.w-a.w));u?(n.push(f),t.push(n),n=[]):n.push(f)}}s&&n.push(i)}return n.length>0&&t.push(n),t.filter(r=>r.length>=2)}function Hi(e,t,n){let r=t.map(s=>Qa(e,s)),i=s=>s.map(a=>({x:a.u/a.w,
|
|
1045
|
+
y:a.v/a.w}));if(n){let s=fp(r);return s.length>=3?[i(s)]:[]}return hp(r).map(i)}function Wa(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.w,y:t.y},{x:t.x+t.w,y:t.y+t.h},{x:t.x,y:t.y+t.h}],r=Hi(e,n,!0)[0];return r?
|
|
1046
|
+
Ri(r):void 0}function Fo(e,t){return e[8]*t.x+e[9]*t.y+e[11]}function Xa(e,t,n){let r=e[2],i=e[6],s=e[10];if(n<=0)return s>0;let a=e[0]*t.x+e[1]*t.y+e[3],u=e[4]*t.x+e[5]*t.y+e[7],f=Fo(e,t);return r*a+
|
|
1047
|
+
i*u+s*(f+n)>0}var pp=new Set(["linear","radial","conic"]);function Yo(e){return typeof e=="object"&&e!==null&&pp.has(e.kind)&&Array.isArray(e.stops)}function Ga(e){return typeof e=="object"&&e!==null&&
|
|
1048
1048
|
e.kind==="noise"&&Array.isArray(e.stops)}function Bn(e){return Yo(e)||Ga(e)}function qa(e){return Ga(e)||Yo(e)&&e.kind==="conic"}function ur(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.
|
|
1049
1049
|
exec(e.trim());if(!t)return;let n=t[1].toLowerCase();n.length<=4&&(n=[...n].map(i=>i+i).join(""));let r=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{rgb:`#${n.slice(0,6)}`,a:r}}var dp=e=>Math.round(
|
|
1050
|
-
Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");function
|
|
1050
|
+
Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");function Or(e){if(e===void 0||typeof e=="string")return e;if(!Bn(e))return"none";let t=Pn(e.stops)[0];return t?t.color:"none"}function Pn(e){if(!e)
|
|
1051
1051
|
return[];let t=e.filter(n=>typeof n.at=="number"&&Number.isFinite(n.at)&&typeof n.color=="string"&&ur(n.color)!==void 0).map(n=>({at:Math.min(1,Math.max(0,n.at)),color:n.color})).sort((n,r)=>n.at-r.at);
|
|
1052
1052
|
return t.length<2?[]:t}function Wo(e,t){if(!t||e.length<2)return[...e];let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push({at:i.at,color:i.color});let s=e[r+1];s&&n.push({at:s.at,color:i.color})}return n}
|
|
1053
1053
|
var _i=new WeakMap;function $i(e,t){if(e.space==="canvas")return e.box;if(_i.has(t))return _i.get(t);let n=$e({...t,transform:be});return _i.set(t,n),n}function Ha(e,t){if(!t||e.kind==="conic")return;
|
|
1054
|
-
if(e.kind==="linear"){let
|
|
1054
|
+
if(e.kind==="linear"){let f=e.angle*Math.PI/180,h=Math.cos(f),m=Math.sin(f),d=(Math.abs(t.w*h)+Math.abs(t.h*m))/2;if(!(d>1e-9)||e.end===e.start)return;let A=t.x+t.w/2,g=t.y+t.h/2,x=w=>({x:A+h*d*(2*w-1),
|
|
1055
1055
|
y:g+m*d*(2*w-1)}),v=x(e.start),b=x(e.end);return{kind:"linear",x1:v.x,y1:v.y,x2:b.x,y2:b.y}}let n=Math.max(t.w,t.h)/2,r=e.r*n;if(!(r>0))return;let i=t.x+e.cx*t.w,s=t.y+e.cy*t.h,a=e.fx===void 0?i:t.x+e.
|
|
1056
1056
|
fx*t.w,u=e.fy===void 0?s:t.y+e.fy*t.h;return{kind:"radial",cx:i,cy:s,r,fx:a,fy:u}}function $a(e,t){let n=e.stops.map(r=>{let i=ur(r.color);return i?{at:r.at,color:`${i.rgb}${dp(i.a*t*255)}`}:r});return{...e,stops:n}}function Ui(e){let t=n=>{let r=n>>>0;for(let i=0;i<e.length;i++)r^=e.charCodeAt(i),r=Math.imul(r,16777619)>>>0;return r.toString(36)};return t(2166136261)+t(84696351)}function zi(e){let t=1779033703,n=3144134277,
|
|
1057
1057
|
r=1013904242,i=2773480762;for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);t=n^Math.imul(t^a,597399067),n=r^Math.imul(n^a,2869860233),r=i^Math.imul(r^a,951274213),i=t^Math.imul(i^a,2716044179)}return t=
|
|
1058
1058
|
Math.imul(r^t>>>18,597399067),n=Math.imul(i^n>>>22,2869860233),r=Math.imul(t^r>>>17,951274213),i=Math.imul(n^i>>>19,2716044179),[(t^n^r^i)>>>0,(n^t)>>>0,(r^t)>>>0,(i^t)>>>0]}function Ua(e,t,n,r){return()=>{
|
|
1059
1059
|
e>>>=0,t>>>=0,n>>>=0,r>>>=0;let i=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,r=r+1|0,i=i+r|0,n=n+i|0,(i>>>0)/4294967296}}function mp(...e){let[t,n,r,i]=zi(e.join("|")),s=Ua(t,n,r,i);return{next:s,
|
|
1060
1060
|
range:(a,u)=>a+s()*(u-a),gauss:()=>(s()+s()+s()-1.5)*1.1547,int:(a,u)=>a+Math.floor(s()*(u-a)),pick:a=>a[Math.floor(s()*a.length)],bool:(a=.5)=>s()<a}}function rr(...e){let[t,n,r,i]=zi(e.join("|"));return Ua(
|
|
1061
|
-
t,n,r,i)()}function Ap(e){return e*e*e*(e*(e*6-15)+10)}function za(e,t){let n=Math.floor(t),r=t-n,i=rr(e,n),s=rr(e,n+1);return(i+(s-i)*Ap(r))*2-1}function ja(e,t,n=3,r=2,i=.5){let s=0,a=1,u=0,
|
|
1062
|
-
n;
|
|
1061
|
+
t,n,r,i)()}function Ap(e){return e*e*e*(e*(e*6-15)+10)}function za(e,t){let n=Math.floor(t),r=t-n,i=rr(e,n),s=rr(e,n+1);return(i+(s-i)*Ap(r))*2-1}function ja(e,t,n=3,r=2,i=.5){let s=0,a=1,u=0,f=1;for(let h=0;h<
|
|
1062
|
+
n;h++)s+=za(`${e}#${h}`,t*f)*a,u+=a,a*=i,f*=r;return u===0?0:s/u}var yp=["<=",">=","==","!=","&&","||","**","+","-","*","/","%","<",">","(",")",",","?",":","!"];function gp(e){let t=[],n=0;for(;n<e.length;){
|
|
1063
1063
|
let r=e[n];if(r===" "||r===" "||r===`
|
|
1064
1064
|
`||r==="\r"){n++;continue}if(r>="0"&&r<="9"){let s=n;for(;s<e.length&&/[0-9._eE]/.test(e[s]);)(e[s]==="e"||e[s]==="E")&&(e[s+1]==="-"||e[s+1]==="+")&&s++,s++;let a=e.slice(n,s),u=Number.parseFloat(a);
|
|
1065
1065
|
if(!Number.isFinite(u))throw new Tr(`Bad number "${a}"`);t.push({k:"num",v:u}),n=s;continue}if(/[A-Za-z_]/.test(r)){let s=n;for(;s<e.length&&/[A-Za-z0-9_]/.test(e[s]);)s++;t.push({k:"id",v:e.slice(n,s)}),
|
|
@@ -1073,7 +1073,7 @@ fn:(e,t)=>e!==t?1:0},"<":{prec:4,fn:(e,t)=>e<t?1:0},">":{prec:4,fn:(e,t)=>e>t?1:
|
|
|
1073
1073
|
t},"*":{prec:6,fn:(e,t)=>e*t},"/":{prec:6,fn:(e,t)=>t===0?0:e/t},"%":{prec:6,fn:(e,t)=>t===0?0:e%t},"**":{prec:7,right:!0,fn:(e,t)=>e**t}},xp=class{constructor(e){mt(this,"toks");mt(this,"pos",0);mt(this,
|
|
1074
1074
|
"refs",new Set);this.toks=e}peek(){return this.toks[this.pos]}eat(e){let t=this.peek();return t.k==="op"&&t.v===e?(this.pos++,!0):!1}expect(e){if(!this.eat(e))throw new Tr(`Expected "${e}"`)}parse(){let e=this.
|
|
1075
1075
|
expr(0);if(this.peek().k!=="eof")throw new Tr("Trailing input");return e}expr(e){let t=this.unary();for(;;){let n=this.peek();if(n.k!=="op")break;if(n.v==="?"&&e<=0){this.pos++;let a=this.expr(0);this.
|
|
1076
|
-
expect(":");let u=this.expr(0),
|
|
1076
|
+
expect(":");let u=this.expr(0),f=t;t=h=>f(h)!==0?a(h):u(h);continue}let r=vp[n.v];if(!r||r.prec<e)break;this.pos++;let i=this.expr(r.right?r.prec:r.prec+1),s=t;t=a=>r.fn(s(a),i(a))}return t}unary(){if(this.
|
|
1077
1077
|
eat("-")){let e=this.unary();return t=>-e(t)}if(this.eat("+"))return this.unary();if(this.eat("!")){let e=this.unary();return t=>e(t)===0?1:0}return this.primary()}primary(){let e=this.peek();if(e.k===
|
|
1078
1078
|
"num"){this.pos++;let{v:t}=e;return()=>t}if(e.k==="id"){this.pos++;let t=e.v;if(this.eat("(")){let n=[];if(!this.eat(")")){do n.push(this.expr(0));while(this.eat(","));this.expect(")")}let r=bp[t];if(!r)
|
|
1079
1079
|
throw new Tr(`Unknown function "${t}"`);return i=>r(n.map(s=>s(i)))}if(t in ka){let n=ka[t];return()=>n}return this.refs.add(t),n=>n[t]??0}if(e.k==="op"&&e.v==="("){this.pos++;let t=this.expr(0);return this.
|
|
@@ -1083,34 +1083,34 @@ defineProperty(i,"refs",{value:n.refs}),Object.defineProperty(i,"source",{value:
|
|
|
1083
1083
|
"ease-out":[.5,1,.89,1],"ease-in-out":[.45,0,.55,1],"ease-in-quad":[.11,0,.5,0],"ease-out-quad":[.5,1,.89,1],"ease-in-out-quad":[.45,0,.55,1],"ease-in-cubic":[.32,0,.67,0],"ease-out-cubic":[.33,1,.68,
|
|
1084
1084
|
1],"ease-in-out-cubic":[.65,0,.35,1]};function Ip(e,t){let n=t.t-e.t,r=t.value-e.value,[i,s,a,u]=Sa[t.easing]??Sa.linear;return{out:e.hOut?{t:e.t+e.hOut.dt,v:e.value+e.hOut.dv}:{t:e.t+i*n,v:e.value+s*
|
|
1085
1085
|
r},in:t.hIn?{t:t.t+t.hIn.dt,v:t.value+t.hIn.dv}:{t:e.t+a*n,v:e.value+u*r}}}function wp(e,t,n){let r=t.t-e.t,i=Ip(e,t),s=Math.min(1,Math.max(0,(i.out.t-e.t)/r)),a=Math.min(1,Math.max(0,(i.in.t-e.t)/r)),
|
|
1086
|
-
u=3*s,
|
|
1086
|
+
u=3*s,f=3*(a-s)-u,h=1-u-f,m=x=>((h*x+f)*x+u)*x,d=x=>(3*h*x+2*f)*x+u,A=n;for(let x=0;x<8;x++){let v=m(A)-n;if(Math.abs(v)<1e-6)break;let b=d(A);if(Math.abs(b)<1e-6)break;A-=v/b}if(A<0||A>1||Math.abs(m(
|
|
1087
1087
|
A)-n)>1e-4){let x=0,v=1;for(let b=0;b<26;b++)A=(x+v)/2,m(A)<n?x=A:v=A}let g=1-A;return g*g*g*e.value+3*g*g*A*i.out.v+3*g*A*A*i.in.v+A*A*A*t.value}function Va(e,t){let n=e.keyframes;if(n.length===0)return;
|
|
1088
1088
|
let r=n[0],i=n[n.length-1];if(n.length===1)return r.value;let s=t,a=i.t-r.t;if(a>0){if(e.extrapolate==="loop")s=r.t+((t-r.t)%a+a)%a;else if(e.extrapolate==="ping-pong"){let x=((t-r.t)%(a*2)+a*2)%(a*2);
|
|
1089
|
-
s=r.t+(x<=a?x:a*2-x)}}if(s<=r.t)return r.value;if(s>=i.t)return i.value;let u=1;for(;u<n.length&&n[u].t<s;)u++;let
|
|
1090
|
-
f,
|
|
1091
|
-
let i=e.keyframes;if(i.length===0)return t;let s=i[0],a=i[i.length-1],u=r!==void 0?0:s.t,
|
|
1092
|
-
|
|
1089
|
+
s=r.t+(x<=a?x:a*2-x)}}if(s<=r.t)return r.value;if(s>=i.t)return i.value;let u=1;for(;u<n.length&&n[u].t<s;)u++;let f=n[u],h=n[u-1],m=f.t-h.t;if(m<=0)return f.value;let d=(s-h.t)/m;if(h.hOut||f.hIn)return wp(
|
|
1090
|
+
h,f,d);let g=(Ea[f.easing]??Ea.linear)(d);return h.value+(f.value-h.value)*g}function yn(e,t){return e?Math.max(0,t):-t-1}function tn(e){return e>=0?{playing:!0,local:e}:{playing:!1,local:-(e+1)}}function kp(e,t,n=0,r){
|
|
1091
|
+
let i=e.keyframes;if(i.length===0)return t;let s=i[0],a=i[i.length-1],u=r!==void 0?0:s.t,f=r!==void 0?r:a.t-s.t,h=u+f;if(t<=u||f<=0)return u;if(e.extrapolate==="hold")return Math.min(t,h);let m=(t-u)/
|
|
1092
|
+
f;if(n>0&&m>=n)return e.extrapolate==="ping-pong"&&n%2===0?u:h;if(e.extrapolate==="loop")return u+(m-Math.floor(m))*f;let d=m%2;return u+(d<=1?d:2-d)*f}function Za(e,t,n=0,r){if(e.keyframes.length!==0)
|
|
1093
1093
|
return Va({...e,extrapolate:"hold"},kp(e,t,n,r))}function Cp(e,t){return{t:e.t,i:e.index,n:e.count,v:t,...e.vars}}function Ep(e,t,n){let r=e.seed??"";if(e.mode==="animated"){let i=rr(n.keyPath,t,r,n.index,"phase")*1e3;return za(`${n.keyPath}|${t}|${r}`,
|
|
1094
1094
|
i+n.t*e.noiseFreq)}if(e.distribution==="gauss"){let i=rr(n.keyPath,t,r,n.index,0),s=rr(n.keyPath,t,r,n.index,1),a=rr(n.keyPath,t,r,n.index,2);return(i+s+a-1.5)*1.1547}return rr(n.keyPath,t,r,n.index)*
|
|
1095
|
-
2-1}function
|
|
1096
|
-
wires;if(!r)return e;let i=
|
|
1095
|
+
2-1}function No(e,t=0){if(e){if(e.t==="number")return e.v;if(e.t==="bool")return e.v?1:0;if(e.t==="numbers")return e.v.length>0?e.v[Math.min(Math.max(t,0),e.v.length-1)]:void 0}}function Sp(e,t,n){let r=n.
|
|
1096
|
+
wires;if(!r)return e;let i=No(r[Pi(t,"amount")]),s=No(r[Pi(t,"seed")]);return i===void 0&&s===void 0?e:{...e,amount:i??e.amount,seed:s===void 0?e.seed:Math.floor(s)}}function Di(e,t,n,r,i){if(!t)return e;
|
|
1097
1097
|
let s=Sp(t,r,i);if(s.amount===0)return e;let a=Ep(s,n,i),u=s.apply==="mul"?e*(1+s.amount*a):e+s.amount*a;return s.snap&&s.snap>0?Math.round(u/s.snap)*s.snap:u}function Bp(e,t){if(t.count<=1)return 0;let n=Math.
|
|
1098
|
-
min(1,Math.max(0,t.index/(t.count-1)));return e.curve==="ease"?n*n*(3-2*n):e.curve==="expo"?n*n:n}function
|
|
1099
|
-
"mul"?e*(1+(i-1)*s):e+i*s}function
|
|
1100
|
-
base=="boolean"&&(s=i.base?1:0),s===void 0&&(s=n),i.expr)try{s=Xo(i.expr)(Cp(r,s))}catch{}return Di(
|
|
1101
|
-
v;let s=J(e?.[t]),a=s.base;return a&&typeof a=="object"&&!Array.isArray(a)&&"x"in a&&"y"in a?{x:Di(
|
|
1098
|
+
min(1,Math.max(0,t.index/(t.count-1)));return e.curve==="ease"?n*n*(3-2*n):e.curve==="expo"?n*n:n}function Oi(e,t,n,r){if(!t)return e;let i=No(r.wires?.[da(n)])??t.amount,s=Bp(t,r);return s===0?e:t.apply===
|
|
1099
|
+
"mul"?e*(1+(i-1)*s):e+i*s}function Ni(e,t,n,r){let i=J(e?.[t]),s=No(r.wires?.[t],r.index);if(s===void 0&&i.track&&(s=Va(i.track,r.t)),s===void 0&&typeof i.base=="number"&&(s=i.base),s===void 0&&typeof i.
|
|
1100
|
+
base=="boolean"&&(s=i.base?1:0),s===void 0&&(s=n),i.expr)try{s=Xo(i.expr)(Cp(r,s))}catch{}return Di(Oi(s,i.stagger,t,r),i.jitter,t,t,r)}function Pp(e,t,n,r){let i=r.wires?.[t];if(i?.t==="vec2")return i.
|
|
1101
|
+
v;let s=J(e?.[t]),a=s.base;return a&&typeof a=="object"&&!Array.isArray(a)&&"x"in a&&"y"in a?{x:Di(Oi(a.x,s.stagger,t,r),s.jitter,`${t}.x`,t,r),y:Di(Oi(a.y,s.stagger,t,r),s.jitter,`${t}.y`,t,r)}:n}function Ja(e,t,n,r){
|
|
1102
1102
|
let i=r.wires?.[t];if(i?.t==="string")return i.v;let s=J(e?.[t]);return typeof s.base=="string"?s.base:n}function ji(e,t,n,r){let i=r.wires?.[t];if(i?.t==="paint"||i?.t==="color"||i?.t==="string")return i.
|
|
1103
|
-
v;let s=J(e?.[t]);return typeof s.base=="string"?s.base:n}function Mp(e,t,n,r){return
|
|
1103
|
+
v;let s=J(e?.[t]);return typeof s.base=="string"?s.base:n}function Mp(e,t,n,r){return Or(ji(e,t,n,r))??n}function _p(e,t,n,r){let i=r.wires?.[t];if(i?.t==="bool")return i.v;if(i?.t==="number")return i.
|
|
1104
1104
|
v>=.5;let s=J(e?.[t]);return typeof s.base=="boolean"?s.base:typeof s.base=="number"?s.base!==0:n}function Tp(e,t){if(e.length===0||!Number.isFinite(t))return;let n=Math.floor(t)%e.length;return e[n<0?
|
|
1105
1105
|
n+e.length:n]}function Vi(e,t,n,r,i){let s=i.wires?.[t];if(s?.t==="number"||s?.t==="bool"){let a=Tp(n,typeof s.v=="number"?s.v:s.v?1:0);if(a!==void 0)return a}return Ja(e,t,r,i)}function Rp(e,t,n,r,i,s=n){
|
|
1106
1106
|
let a=Vi(e,t,s,r,i);return n.includes(a)?a:r}function Ka(e,t,n,r){let i=r?.wires?.[t];if(i?.t==="numbers")return i.v;if(i?.t==="number")return[i.v];let s=J(e?.[t]);return Array.isArray(s.base)?s.base.
|
|
1107
1107
|
filter(a=>typeof a=="number"):n}function Dp(e){let t=J(e);if(t.track&&t.track.keyframes.length>1||t.jitter&&t.jitter.mode==="animated"&&t.jitter.amount!==0)return!0;if(t.expr)try{return Xo(t.expr).refs.
|
|
1108
1108
|
has("t")}catch{return!1}return!1}function Qi(e){return e.type==="enum"?e.options.map(t=>t.value):[]}var Ge=[{key:"stroke",label:"Stroke",type:"color",default:"#ffffff",group:"Style"},{key:"strokeWidth",label:"Width",type:"number",default:1,min:0,step:.1,unit:"px",group:"Style"},{key:"fill",label:"Fi\
|
|
1109
1109
|
ll",type:"color",default:"none",group:"Style"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Style"},{key:"dash",label:"Dash",type:"numbers",default:[],group:"Styl\
|
|
1110
|
-
e"}];function el(e){let{nodeId:t,seed:n,t:r,params:i,defs:s,inputs:a,multiInputs:u,wires:
|
|
1111
|
-
g=(b=0,w=1,P)=>({keyPath:m,index:b,count:w,t:r,vars:P?{...A,...P}:A,wires:
|
|
1112
|
-
seed:n,t:r,canvas:
|
|
1113
|
-
inputList:b=>u[b]??(a[b]?[a[b]]:[]),scope:g,num:(b,w,P,E)=>
|
|
1110
|
+
e"}];function el(e){let{nodeId:t,seed:n,t:r,params:i,defs:s,inputs:a,multiInputs:u,wires:f}=e,h=e.canvas??{w:0,h:0},m=`${n}|${t}`,d=new Map(s.map(b=>[b.key,b])),A={W:h.w,H:h.h,aspect:h.h>0?h.w/h.h:0},
|
|
1111
|
+
g=(b=0,w=1,P)=>({keyPath:m,index:b,count:w,t:r,vars:P?{...A,...P}:A,wires:f}),x=b=>{let w=d.get(b);return w&&(w.type==="number"||w.type==="int"||w.type==="stops")?w.default:0},v={nodeId:t,name:e.name,
|
|
1112
|
+
seed:n,t:r,canvas:h,rasterize:e.rasterize,video:e.video,outline:e.outline,provided:e.provided,assets:e.assets??{},asset:e.asset,paramDefs:s,params:i,inputs:a,wires:f,wiredOutputs:e.wiredOutputs??new Set,
|
|
1113
|
+
inputList:b=>u[b]??(a[b]?[a[b]]:[]),scope:g,num:(b,w,P,E)=>Ni(i,b,x(b),g(w,P,E)),int:(b,w,P,E)=>Math.round(Ni(i,b,x(b),g(w,P,E))),vec2:(b,w,P,E)=>{let T=d.get(b),M=T&&T.type==="vec2"?T.default:{x:0,y:0};
|
|
1114
1114
|
return Pp(i,b,M,g(w,P,E))},str:b=>{let w=d.get(b);if(w&&w.type==="enum"){let E=w.rangeFor?.(i??{}),T=g().wires?.[b];return E&&T?.t==="number"?String(Math.round(Math.min(E.max,Math.max(E.min,T.v)))):Vi(
|
|
1115
1115
|
i,b,Qi(w),w.default,g())}let P=w&&w.type==="string"?w.default:"";return Ja(i,b,P,g())},color:(b,w,P)=>{let E=d.get(b),T=E&&E.type==="color"?E.default:"#ffffff";return Mp(i,b,T,g(w,P))},paint:(b,w,P)=>{
|
|
1116
1116
|
let E=d.get(b),T=E&&E.type==="color"?E.default:"#ffffff";return ji(i,b,T,g(w,P))},bool:b=>{let w=d.get(b),P=w&&w.type==="bool"?w.default:!1;return _p(i,b,P,g())},enumOf:(b,w)=>{let P=d.get(b),E=P&&P.type===
|
|
@@ -1121,34 +1121,34 @@ m,...b),track:b=>J(i[b]).track};return v}var tl=class{constructor(){mt(this,"def
|
|
|
1121
1121
|
"${e.type}"`);return this.defs.set(e.type,e),this}registerAll(e){for(let t of e)this.register(t);return this}get(e){return this.defs.get(e)}require(e){let t=this.defs.get(e);if(!t)throw new Error(`Un\
|
|
1122
1122
|
known node type "${e}"`);return t}forNode(e){if(!e)return;let t=this.defs.get(e.type);if(!t?.specialize)return t;let n=this.specialized.get(e);return n||(n={...t,...t.specialize(e)},this.specialized.set(
|
|
1123
1123
|
e,n)),n}requireNode(e){let t=this.forNode(e);if(!t)throw new Error(`Unknown node type "${e.type}"`);return t}list(){return[...this.defs.values()].sort((e,t)=>e.type.localeCompare(t.type))}has(e){return this.
|
|
1124
|
-
defs.has(e)}};function Li(e){return e.type==="layer"?e.id:e.layer}function
|
|
1125
|
-
r.get(s.id),u=
|
|
1126
|
-
d.start||m.id.localeCompare(d.id))[0],!
|
|
1127
|
-
s.id,
|
|
1128
|
-
function Lp(e){let t=new Map(e.nodes.map(n=>[n.id,[]]));for(let n of e.edges)t.get(n.to)?.push(n);return t}function nl(e){return Pr(e)??e}var Do=e=>`n|${e}`,
|
|
1124
|
+
defs.has(e)}};function Li(e){return e.type==="layer"?e.id:e.layer}function Op(e){let t=J(e.params.duration).base;return typeof t=="number"&&t>0?t:0}function Np(e){return J(e.params.loop).base===!0}function Qp(e,t,n){let r=new Map;for(let s of e.clips){let a=r.get(s.layer);a?a.push(s):r.set(s.layer,[s])}let i=new Map;for(let s of e.graph.nodes){if(s.type!=="layer")continue;let a=s.id===n?void 0:
|
|
1125
|
+
r.get(s.id),u=Op(s);if(!a){if(e.clips.length>0&&s.id!==n){i.set(s.id,{on:!1,localT:0});continue}if(u===0)continue}let f=t,h;if(a){if(h=a.filter(m=>m.start<=t&&t<m.start+m.duration).sort((m,d)=>m.start-
|
|
1126
|
+
d.start||m.id.localeCompare(d.id))[0],!h){i.set(s.id,{on:!1,localT:0});continue}f=t-h.start}u===0?i.set(s.id,{on:!0,localT:f,clip:h}):Np(s)?i.set(s.id,{on:!0,localT:f-Math.floor(f/u)*u,clip:h}):i.set(
|
|
1127
|
+
s.id,f<u?{on:!0,localT:f,clip:h}:{on:!1,localT:0,clip:h})}return i}var Zi=class extends Error{constructor(t){super(`Cycle in graph: ${t.join(" \u2192 ")}`);mt(this,"cycle");this.cycle=t,this.name="CycleError"}};function Ji(e){return new Map(e.nodes.map(t=>[t.id,t]))}
|
|
1128
|
+
function Lp(e){let t=new Map(e.nodes.map(n=>[n.id,[]]));for(let n of e.edges)t.get(n.to)?.push(n);return t}function nl(e){return Pr(e)??e}var Do=e=>`n|${e}`,Oo=(e,t)=>`t|${e}|${t}`;function rl(e){let t=Ji(
|
|
1129
1129
|
e),n=new Map;for(let d of e.edges){if(!t.has(d.from)||!d.fromPort.startsWith("param:"))continue;let A=d.fromPort.slice(6),g=n.get(d.from);g?g.includes(A)||g.push(A):n.set(d.from,[A])}let r=[],i=new Map;
|
|
1130
|
-
for(let d of e.nodes){for(let g of n.get(d.id)??[]){let x=
|
|
1131
|
-
a=new Map(r.map(d=>[d,[]])),u=(d,A)=>{a.get(d).push(A),s.set(A,s.get(A)+1)};for(let d of e.nodes)for(let A of n.get(d.id)??[])u(
|
|
1132
|
-
continue;let A=d.fromPort.startsWith("param:")?
|
|
1133
|
-
length>0;){let d=
|
|
1134
|
-
get(A).node.id;d.includes(g)||d.push(g)}throw new Zi(d)}return
|
|
1135
|
-
n=new Map,r=a=>{t.has(a)||t.set(a,0),n.has(a)||n.set(a,[])};for(let a of e){if(a.from!==a.to||!a.fromPort.startsWith("param:"))return null;let u=a.fromPort.slice(6),
|
|
1136
|
-
n.get(u).push(
|
|
1137
|
-
u,
|
|
1138
|
-
timeRoot=="function"?i.has(u.id)||
|
|
1139
|
-
get(u.from);
|
|
1140
|
-
n.map(
|
|
1141
|
-
push({level:"warning",message:`Dangling edge ${
|
|
1142
|
-
d.params.find(v=>v.key===
|
|
1143
|
-
ut "${
|
|
1144
|
-
message:`No input or param "${
|
|
1145
|
-
d;if(g===A)continue;let x=t.forNode(
|
|
1146
|
-
{level:"warning",nodeId:m.id,message:`${
|
|
1130
|
+
for(let d of e.nodes){for(let g of n.get(d.id)??[]){let x=Oo(d.id,g);r.push(x),i.set(x,{kind:"tap",node:d,key:g})}let A=Do(d.id);r.push(A),i.set(A,{kind:"cook",node:d})}let s=new Map(r.map(d=>[d,0])),
|
|
1131
|
+
a=new Map(r.map(d=>[d,[]])),u=(d,A)=>{a.get(d).push(A),s.set(A,s.get(A)+1)};for(let d of e.nodes)for(let A of n.get(d.id)??[])u(Oo(d.id,A),Do(d.id));for(let d of e.edges){if(!t.has(d.from)||!t.has(d.to))
|
|
1132
|
+
continue;let A=d.fromPort.startsWith("param:")?Oo(d.from,d.fromPort.slice(6)):Do(d.from);u(A,Do(d.to));let g=Oo(d.to,nl(d.toPort));s.has(g)&&u(A,g)}let f=r.filter(d=>s.get(d)===0),h=[],m=new Set;for(;f.
|
|
1133
|
+
length>0;){let d=f.shift();m.add(d),h.push(i.get(d));for(let A of a.get(d)){let g=s.get(A)-1;s.set(A,g),g===0&&f.push(A)}}if(h.length!==r.length){let d=[];for(let A of r){if(m.has(A))continue;let g=i.
|
|
1134
|
+
get(A).node.id;d.includes(g)||d.push(g)}throw new Zi(d)}return h}function Fp(e){let t=[];for(let n of rl(e))n.kind==="cook"&&t.push(n.node);return t}function Yp(e){if(e.length===0)return[];let t=new Map,
|
|
1135
|
+
n=new Map,r=a=>{t.has(a)||t.set(a,0),n.has(a)||n.set(a,[])};for(let a of e){if(a.from!==a.to||!a.fromPort.startsWith("param:"))return null;let u=a.fromPort.slice(6),f=Pr(a.toPort)??a.toPort;r(u),r(f),
|
|
1136
|
+
n.get(u).push(f),t.set(f,t.get(f)+1)}let i=new Map,s=[...t.entries()].filter(([,a])=>a===0).map(([a])=>a);for(;s.length>0;){let a=s.shift();i.set(a,i.size);for(let u of n.get(a)){let f=t.get(u)-1;t.set(
|
|
1137
|
+
u,f),f===0&&s.push(u)}}return i.size!==t.size?null:[...e].sort((a,u)=>i.get(a.fromPort.slice(6))-i.get(u.fromPort.slice(6)))}function Wp(e,t){let n=new Set,r=Ji(e),i=new Set;for(let u of e.edges)t.forNode(r.get(u.to))?.params.some(h=>h.key===u.toPort&&h.type==="enum")&&i.add(u.to);for(let u of e.nodes){let f=t.forNode(u);if(typeof f?.
|
|
1138
|
+
timeRoot=="function"?i.has(u.id)||f.timeRoot(u.params):f?.timeRoot){n.add(u.id);continue}for(let m of Object.keys(u.params))if(Dp(u.params[m])){n.add(u.id);break}}let s=new Map;for(let u of e.edges){let f=s.
|
|
1139
|
+
get(u.from);f?f.push(u.to):s.set(u.from,[u.to])}let a=[...n];for(;a.length>0;){let u=a.pop();for(let f of s.get(u)??[])n.has(f)||(n.add(f),a.push(f))}return n}function Xp(e,t,n=[]){let r=[],i=Ji(e),s=new Set(
|
|
1140
|
+
n.map(f=>f.layer));for(let f of e.nodes)t.has(f.type)||r.push({level:"error",nodeId:f.id,message:`Unknown node type "${f.type}"`});for(let f of e.edges){let h=i.get(f.from),m=i.get(f.to);if(!h||!m){r.
|
|
1141
|
+
push({level:"warning",message:`Dangling edge ${f.from} \u2192 ${f.to}`});continue}let d=t.forNode(h),A=t.forNode(m);if(d&&!d.outputs.some(g=>g.name===f.fromPort)){let g=f.fromPort.startsWith("param:")?
|
|
1142
|
+
d.params.find(v=>v.key===f.fromPort.slice(6)):void 0;g&&(g.type==="number"||g.type==="int"||g.type==="color"||g.type==="numbers"||g.type==="enum")||r.push({level:"warning",nodeId:h.id,message:`No outp\
|
|
1143
|
+
ut "${f.fromPort}" on ${h.type}`})}if(A){let g=A.inputs.some(b=>b.name===f.toPort),x=Pr(f.toPort),v=A.params.some(b=>b.key===f.toPort||x!==void 0&&b.key===x);!g&&!v&&r.push({level:"warning",nodeId:m.id,
|
|
1144
|
+
message:`No input or param "${f.toPort}" on ${m.type}`})}}for(let f of e.edges){let h=i.get(f.from),m=i.get(f.to);if(!h||!m)continue;let d=Li(h),A=m.type==="layer"?m.id:Li(m),g=h.type==="layer"?void 0:
|
|
1145
|
+
d;if(g===A)continue;let x=t.forNode(h),v=t.forNode(m),b=x?.outputs.find(P=>P.name===f.fromPort),w=v?.inputs.find(P=>P.name===f.toPort);b&&(b.type==="shapes"||b.type==="texture")&&m.type!=="layer"?r.push(
|
|
1146
|
+
{level:"warning",nodeId:m.id,message:`${h.type} "${h.id}" feeds ${m.type} from another layer; a stream belongs in one layer \u2014 duplicate the node.`}):(b?.clock||w?.clock)&&(s.has(g??"")||s.has(A??
|
|
1147
1147
|
""))&&r.push({level:"warning",nodeId:m.id,message:`A clock crosses into or out of a layer on the layer timeline: ${m.type} will not restart with the clip. Keep the Trigger in the same layer.`})}let a=new Map;
|
|
1148
|
-
for(let
|
|
1149
|
-
nodeId:
|
|
1150
|
-
m=>m.from===
|
|
1151
|
-
output into its own input.`}))}if(!u)try{Fp(e)}catch(
|
|
1148
|
+
for(let f of e.edges){let m=t.forNode(i.get(f.to))?.inputs.find(A=>A.name===f.toPort);if(!m||m.multi)continue;let d=`${f.to}.${f.toPort}`;a.set(d,(a.get(d)??0)+1),a.get(d)===2&&r.push({level:"warning",
|
|
1149
|
+
nodeId:f.to,message:`Several wires into ${i.get(f.to)?.type??f.to}.${f.toPort}, which takes one \u2014 all but one are ignored. Put a Merge in front.`})}let u=!1;for(let f of e.nodes){let h=e.edges.filter(
|
|
1150
|
+
m=>m.from===f.id&&m.to===f.id);h.length>0&&Yp(h)===null&&(u=!0,r.push({level:"error",nodeId:f.id,message:`${f.type}: its own wires loop back into it \u2014 a param tap feeding a param that feeds it, or an \
|
|
1151
|
+
output into its own input.`}))}if(!u)try{Fp(e)}catch(f){if(f instanceof Zi)r.push({level:"error",message:f.message});else throw f}return r}function Gp(e){return e.outputs[0]?.type==="shapes"&&e.inputs.
|
|
1152
1152
|
some(t=>t.type==="texture")}function Kr(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(Kr).join(",")}]`:`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(
|
|
1153
1153
|
r)).map(([n,r])=>`${JSON.stringify(n)}:${Kr(r)}`).join(",")}}`}var Ba=new WeakMap,qp=1;function cr(e){let t=Ba.get(e);return t===void 0&&(t=qp++,Ba.set(e,t)),t}var ol=cr,Pa=e=>ol(e);function Jr(...e){
|
|
1154
1154
|
let[t,n,r,i]=zi(e.join(" "));return`${t.toString(36)}${n.toString(36)}${r.toString(36)}${i.toString(36)}`}function Hp(e){let t=0;for(let n of Object.values(e))n.t==="texture"&&(t+=n.v.width*n.v.height*
|
|
@@ -1157,37 +1157,37 @@ this.frames=Math.max(1,Math.floor(e.frames??1)),this.textureBudget=Math.max(0,e.
|
|
|
1157
1157
|
return;let r=n.findIndex(s=>s.hash===t);if(r<0)return;let i=n[r];return r!==0&&(n.splice(r,1),n.unshift(i)),i.bytes>0&&(this.textured.delete(i),this.textured.add(i)),i.outputs}set(e,t,n){let r={node:e,
|
|
1158
1158
|
hash:t,outputs:n,bytes:Hp(n)};this.onKeep?.(n);let i=this.rings.get(e);i||(i=[],this.rings.set(e,i));let s=i.findIndex(a=>a.hash===t);for(s>=0&&this.drop(i.splice(s,1)[0]),i.unshift(r),r.bytes>0&&(this.
|
|
1159
1159
|
textured.add(r),this.textureBytes+=r.bytes);i.length>this.frames;)this.drop(i.pop());for(let a of this.textured){if(this.textureBytes<=this.textureBudget||a===r)break;let u=this.rings.get(a.node);if(u){
|
|
1160
|
-
let
|
|
1160
|
+
let f=u.indexOf(a);f>=0&&u.splice(f,1),u.length===0&&this.rings.delete(a.node)}this.drop(a)}}drop(e){e.bytes>0&&this.textured.delete(e)&&(this.textureBytes-=e.bytes),this.onDrop?.(e.outputs)}clear(){if(this.
|
|
1161
1161
|
onDrop)for(let e of this.rings.values())for(let t of e)this.onDrop(t.outputs);this.rings.clear(),this.textured.clear(),this.textureBytes=0}get size(){return this.rings.size}get entries(){let e=0;for(let t of this.
|
|
1162
1162
|
rings.values())e+=t.length;return e}get heldTextureBytes(){return this.textureBytes}};function sl(e,t,n={}){let r=n.t??0,i=n.cache,s=Xp(e.graph,t,e.clips),a=new Map,u=[];if(s.some(_=>_.level==="error"))
|
|
1163
|
-
return{outputs:a,scene:Ma(e),issues:s,cooked:u};let
|
|
1163
|
+
return{outputs:a,scene:Ma(e),issues:s,cooked:u};let f;try{f=rl(e.graph)}catch(_){if(_ instanceof Zi)return s.push({level:"error",message:_.message}),{outputs:a,scene:Ma(e),issues:s,cooked:u};throw _}let h=Wp(
|
|
1164
1164
|
e.graph,t),m=Lp(e.graph),d=new Map,A=e.graph.nodes.find(_=>_.type==="canvas"),g=A?J(A.params.perspective).base:void 0,x=typeof g=="number"?Math.max(0,g):A?1500:void 0,v=`${e.canvas.w}x${e.canvas.h}@${e.
|
|
1165
1165
|
canvas.origin}${x===void 0?"":`/${x}`}`,b=Qp(e,r,n.audition),w=new Map,P=new Map,E=_=>_.fromPort.startsWith("param:")?w.get(_.from)?.[_.fromPort]:a.get(_.from)?.[_.fromPort],T=new Set,M=new Set,R=_=>T.
|
|
1166
|
-
has(_.from)||M.has(`${_.from}.${_.fromPort}`),S=(_,Q)=>{let Y=w.get(_);return Y?{...Q,...Y}:Q};for(let _ of
|
|
1166
|
+
has(_.from)||M.has(`${_.from}.${_.fromPort}`),S=(_,Q)=>{let Y=w.get(_);return Y?{...Q,...Y}:Q};for(let _ of f){let Q=_.node,Y=Li(Q),G=Y!==void 0?b.get(Y):void 0,q=G?G.localT:r;if(G&&!G.on){_.kind!=="t\
|
|
1167
1167
|
ap"&&(a.set(Q.id,{}),d.set(Q.id,Jr("off",Q.id)));continue}let X=t.requireNode(Q),te=m.get(Q.id)??[],ce=X.outputs.filter(ae=>ae.claims).map(ae=>ae.name),ue=new Set(ce.length===0?[]:e.graph.edges.filter(
|
|
1168
|
-
ae=>ae.from===Q.id&&ce.includes(ae.fromPort)).map(ae=>ae.fromPort)),ie=Q.seed??e.seed,
|
|
1169
|
-
W:e.canvas.w,H:e.canvas.h,aspect:e.canvas.h>0?e.canvas.w/e.canvas.h:0},Xe={keyPath:`${ie}|${Q.id}`,index:0,count:1,t:q,wires:
|
|
1168
|
+
ae=>ae.from===Q.id&&ce.includes(ae.fromPort)).map(ae=>ae.fromPort)),ie=Q.seed??e.seed,fe=P.get(Q.id);fe||(fe={},P.set(Q.id,fe));let ve=ae=>{let xe=X.params.find(it=>it.key===ae);if(!xe)return;let Te={
|
|
1169
|
+
W:e.canvas.w,H:e.canvas.h,aspect:e.canvas.h>0?e.canvas.w/e.canvas.h:0},Xe={keyPath:`${ie}|${Q.id}`,index:0,count:1,t:q,wires:fe,vars:Te};if(xe.type==="number"||xe.type==="int")return{t:"number",v:Ni(Q.
|
|
1170
1170
|
params,ae,xe.default,Xe)};if(xe.type==="color"){let it=ji(Q.params,ae,xe.default,Xe);return Bn(it)?sr(it):{t:"color",v:it}}if(xe.type==="numbers")return{t:"numbers",v:Ka(Q.params,ae,xe.default,Xe)};if(xe.
|
|
1171
1171
|
type==="enum"){let it=Qi(xe),kt=it.indexOf(Vi(Q.params,ae,it,xe.default,Xe));return kt>=0?{t:"number",v:kt}:void 0}};if(_.kind==="tap"){for(let xe of te){if(nl(xe.toPort)!==_.key)continue;R(xe)&&M.add(
|
|
1172
|
-
`${Q.id}.param:${_.key}`);let Te=E(xe);Te!==void 0&&(
|
|
1172
|
+
`${Q.id}.param:${_.key}`);let Te=E(xe);Te!==void 0&&(fe[xe.toPort]=Te)}let ae=ve(_.key);if(ae!==void 0){let xe=w.get(Q.id);xe?xe[`param:${_.key}`]=ae:w.set(Q.id,{[`param:${_.key}`]:ae})}continue}let ne={},
|
|
1173
1173
|
ye={},Be=new Set(X.params.map(ae=>ae.key));for(let ae of te){let xe=E(ae);if(xe===void 0)continue;let Te=X.inputs.find(Xe=>Xe.name===ae.toPort);if(Te)if(Te.multi){let Xe=ye[ae.toPort];Xe?Xe.push(xe):ye[ae.
|
|
1174
|
-
toPort]=[xe]}else ne[ae.toPort]=xe;else(Be.has(ae.toPort)||Be.has(Pr(ae.toPort)??""))&&(
|
|
1174
|
+
toPort]=[xe]}else ne[ae.toPort]=xe;else(Be.has(ae.toPort)||Be.has(Pr(ae.toPort)??""))&&(fe[ae.toPort]=xe)}for(let[ae,xe]of Object.entries(ye))ne[ae]===void 0&&(ne[ae]=xe[0]);let Ee=new Map,We=te.map(ae=>{
|
|
1175
1175
|
let xe=Ee.get(ae.toPort)??0;Ee.set(ae.toPort,xe+1);let Te=ae.fromPort.startsWith("param:")?`=${Kr(E(ae))}`:`${d.get(ae.from)??""}.${ae.fromPort}`;return`${ae.toPort}#${xe}<${Te}`}).sort().join("|"),at=te.
|
|
1176
1176
|
some(R);if(at&&T.add(Q.id),n.textures&&X.outputs[0]?.type==="texture"){let ae=n.textures(Q.id),xe=X.outputs[0],Te={};ae&&xe&&(Te[xe.name]=Ye(ae)),a.set(Q.id,S(Q.id,Te)),d.set(Q.id,Jr("provided",Q.id,ae?
|
|
1177
1177
|
String(Pa(ae)):"none"));continue}if(n.vectors&&Gp(X)){let ae={},xe=[];for(let Te of X.outputs){if(Te.type!=="shapes")continue;let Xe=n.vectors(Q.id,Te.name);Xe&&(ae[Te.name]=z(Xe)),xe.push(Xe?String(ol(
|
|
1178
1178
|
Xe)):"none")}a.set(Q.id,S(Q.id,ae)),d.set(Q.id,Jr("provided",Q.id,...xe));continue}if(Q.disabled){let ae=X.outputs[0],xe=X.inputs.find(it=>(it.type==="shapes"||it.type==="texture")&&it.type===ae?.type),
|
|
1179
|
-
Te=xe?ne[xe.name]:void 0,Xe={};ae&&Te&&Te.t===ae.type&&(Xe[ae.name]=Te),a.set(Q.id,S(Q.id,Xe)),d.set(Q.id,Jr("disabled",Q.id,Kr(Q.params),We,v,
|
|
1180
|
-
standIns?X.standIns(ne,ye).map(ae=>{let xe=n.textures(ae);return`${ae}=${xe?String(Pa(xe)):"none"}`}).join(","):"",wt=Jr(Q.type,Kr(Q.params),Q.name??"",String(ie),We,v,
|
|
1179
|
+
Te=xe?ne[xe.name]:void 0,Xe={};ae&&Te&&Te.t===ae.type&&(Xe[ae.name]=Te),a.set(Q.id,S(Q.id,Xe)),d.set(Q.id,Jr("disabled",Q.id,Kr(Q.params),We,v,h.has(Q.id)?String(q):""));continue}let lt=n.textures&&X.
|
|
1180
|
+
standIns?X.standIns(ne,ye).map(ae=>{let xe=n.textures(ae);return`${ae}=${xe?String(Pa(xe)):"none"}`}).join(","):"",wt=Jr(Q.type,Kr(Q.params),Q.name??"",String(ie),We,v,h.has(Q.id)?String(q):"",n.outliner?
|
|
1181
1181
|
"o1":"o0",[...ue].sort().join(","),lt);d.set(Q.id,wt);let nn=at?void 0:i?.get(Q.id,wt);if(nn){a.set(Q.id,S(Q.id,nn));continue}let yt=el({wiredOutputs:ue,nodeId:Q.id,name:Q.name,seed:ie,t:q,canvas:{w:e.
|
|
1182
1182
|
canvas.w,h:e.canvas.h,origin:e.canvas.origin,...x===void 0?{}:{perspective:x}},outline:n.outliner,rasterize:n.rasterize,provided:n.textures,video:n.video,assets:e.assets,asset:n.asset,params:Q.params,
|
|
1183
|
-
defs:X.params,inputs:ne,multiInputs:ye,wires:
|
|
1183
|
+
defs:X.params,inputs:ne,multiInputs:ye,wires:fe}),Bt,Ze=!1;try{Bt=$p(X.cook(yt),Q.name)}catch(ae){s.push({level:"error",nodeId:Q.id,message:`${Q.type} failed to cook: ${ae instanceof Error?ae.message:
|
|
1184
1184
|
String(ae)}`}),Bt={},Ze=!0,T.add(Q.id)}a.set(Q.id,S(Q.id,Bt)),u.push(Q.id),!Ze&&!at&&i?.set(Q.id,wt,Bt)}return{outputs:a,scene:Up(e,a),issues:s,cooked:u}}function $p(e,t){let n=t?.trim();if(!n)return e;
|
|
1185
1185
|
let r={};for(let[i,s]of Object.entries(e))r[i]=s.t==="shapes"?{t:"shapes",v:s.v.map(a=>(a.meta.tags??[]).includes(n)?a:{...a,meta:{...a.meta,tags:[...a.meta.tags??[],n]}})}:s;return r}function al(e){if(!(e.
|
|
1186
1186
|
display!=="pixel"&&e.display!=="mono"))return{mode:e.display,ink:e.ink,threshold:e.threshold}}function Ma(e){let t=al(e.canvas);return{width:e.canvas.w,height:e.canvas.h,background:e.canvas.bg,origin:e.
|
|
1187
|
-
canvas.origin,...t?{display:t}:{},layers:[]}}function Up(e,t){for(let a of e.graph.nodes){let u=t.get(a.id);if(u){for(let
|
|
1188
|
-
map(a=>`${a.from}.${a.fromPort}`)),r=[],i=[];for(let a of e.graph.nodes){let u=t.get(a.id);if(u)for(let[h
|
|
1189
|
-
i.push(...
|
|
1190
|
-
h,background:e.canvas.bg,origin:e.canvas.origin,...s?{display:s}:{},layers:i}}var _a=new WeakMap;function
|
|
1187
|
+
canvas.origin,...t?{display:t}:{},layers:[]}}function Up(e,t){for(let a of e.graph.nodes){let u=t.get(a.id);if(u){for(let f of Object.values(u))if(f?.t==="scene")return f.v}}let n=new Set(e.graph.edges.
|
|
1188
|
+
map(a=>`${a.from}.${a.fromPort}`)),r=[],i=[];for(let a of e.graph.nodes){let u=t.get(a.id);if(u)for(let[f,h]of Object.entries(u))n.has(`${a.id}.${f}`)||(h?.t==="shapes"?r.push(...h.v):h?.t==="layers"&&
|
|
1189
|
+
i.push(...h.v))}r.length>0&&i.push({id:"__implicit",name:"Preview",opacity:1,visible:!0,order:i.length,shapes:r}),i.sort((a,u)=>a.order-u.order);let s=al(e.canvas);return{width:e.canvas.w,height:e.canvas.
|
|
1190
|
+
h,background:e.canvas.bg,origin:e.canvas.origin,...s?{display:s}:{},layers:i}}var _a=new WeakMap;function Nr(e,t){if(e.meta.index===t)return e;let n=_a.get(e);n||(n=new Map,_a.set(e,n));let r=n.get(t);
|
|
1191
1191
|
return r||(r={...e,meta:{...e.meta,index:t}},n.set(t,r)),r}var zp=(()=>{let e=new Uint32Array(1024);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}for(let t=0;t<256;t++)for(let n=1;n<4;n++){let r=e[(n-1)*256+t];e[n*
|
|
1192
1192
|
256+t]=(e[r&255]^r>>>8)>>>0}return e})();function jp(e){let t=zp,n=4294967295,r=0,i=e.length-e.length%4;for(;r<i;r+=4)n^=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,n=t[768+(n&255)]^t[512+(n>>>8&255)]^t[256+
|
|
1193
1193
|
(n>>>16&255)]^t[n>>>24];for(;r<e.length;r++)n=t[(n^e[r])&255]^n>>>8;return(n^4294967295)>>>0}function Vp(e){let t=1,n=0,r=0,i=e.length;for(;r<i;){let s=Math.min(i,r+5552);for(;r<s;r++)t+=e[r],n+=t;t%=
|
|
@@ -1195,105 +1195,105 @@ return r||(r={...e,meta:{...e.meta,index:t}},n.set(t,r)),r}var zp=(()=>{let e=ne
|
|
|
1195
1195
|
e,e}function es(e,t){let n=new Uint8Array(12+t.length),r=new DataView(n.buffer);r.setUint32(0,t.length);for(let i=0;i<4;i++)n[4+i]=e.charCodeAt(i);return n.set(t,8),r.setUint32(8+t.length,jp(n.subarray(
|
|
1196
1196
|
4,8+t.length))),n}function Jp(e){let t=Math.max(1,Math.ceil(e.length/65535)),n=new Uint8Array(2+t*5+e.length+4);n[0]=120,n[1]=1;let r=2;for(let i=0;i<t;i++){let s=i*65535,a=e.subarray(s,Math.min(s+65535,
|
|
1197
1197
|
e.length));n[r++]=i===t-1?1:0,n[r++]=a.length&255,n[r++]=a.length>>8,n[r++]=~a.length&255,n[r++]=~a.length>>8&255,n.set(a,r),r+=a.length}return new DataView(n.buffer).setUint32(r,Vp(e)),n}function Kp(e){let{width:t,height:n,data:r}=e;if(r.length!==t*n*4)throw new Error(`texture is ${r.length} bytes; ${t}x${n} RGBA needs ${t*n*4}`);let i=new Uint8Array(13),s=new DataView(i.buffer);s.setUint32(
|
|
1198
|
-
0,t),s.setUint32(4,n),i[8]=8,i[9]=6;let a=new Uint8Array(n*(1+t*4)),u=Zp(),
|
|
1199
|
-
a[
|
|
1198
|
+
0,t),s.setUint32(4,n),i[8]=8,i[9]=6;let a=new Uint8Array(n*(1+t*4)),u=Zp(),f=0,h=0;for(let v=0;v<n;v++){a[f++]=0;for(let b=0;b<t;b++,h+=4){let w=r[h+3];if(w===0)f+=4;else{let P=w*256;a[f++]=u[P+r[h]],
|
|
1199
|
+
a[f++]=u[P+r[h+1]],a[f++]=u[P+r[h+2]],a[f++]=w}}}let d=[new Uint8Array([137,80,78,71,13,10,26,10]),es("IHDR",i),es("IDAT",Jp(a)),es("IEND",new Uint8Array(0))],A=d.reduce((v,b)=>v+b.length,0),g=new Uint8Array(
|
|
1200
1200
|
A),x=0;for(let v of d)g.set(v,x),x+=v.length;return g}var gn=new TextEncoder().encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),ts=61,ed=new TextDecoder("ascii");function td(e){
|
|
1201
|
-
let t=new Uint8Array(Math.ceil(e.length/3)*4),n=0,r=e.length-e.length%3;for(let s=0;s<r;s+=3){let a=e[s],u=e[s+1],
|
|
1201
|
+
let t=new Uint8Array(Math.ceil(e.length/3)*4),n=0,r=e.length-e.length%3;for(let s=0;s<r;s+=3){let a=e[s],u=e[s+1],f=e[s+2];t[n++]=gn[a>>2],t[n++]=gn[(a&3)<<4|u>>4],t[n++]=gn[(u&15)<<2|f>>6],t[n++]=gn[f&
|
|
1202
1202
|
63]}let i=e.length-r;if(i===1){let s=e[r];t[n++]=gn[s>>2],t[n++]=gn[(s&3)<<4],t[n++]=ts,t[n++]=ts}else if(i===2){let s=e[r],a=e[r+1];t[n++]=gn[s>>2],t[n++]=gn[(s&3)<<4|a>>4],t[n++]=gn[(a&15)<<2],t[n++]=
|
|
1203
1203
|
ts}return ed.decode(t)}var ll=new WeakMap;function is(e){let t=ll.get(e);if(t)return t;let n=`data:image/png;base64,${td(Kp(e))}`;return ll.set(e,n),n}function nd(e){let t=Uint8Array.of(0,2,3,1);for(let n=2;n<
|
|
1204
1204
|
e;n*=2){let r=new Uint8Array(n*n*4),i=n*2;for(let s=0;s<n;s++)for(let a=0;a<n;a++){let u=t[s*n+a]*4;r[s*i+a]=u,r[s*i+a+n]=u+2,r[(s+n)*i+a]=u+3,r[(s+n)*i+a+n]=u+1}t=r}return t}var qe,je=0;var Qr="auto",ul;function Ke(){if(!(Qr==="js"||Qr==="wasm")){if(Qr==="gpu"&&!ul)throw new Error("gpu kernels forced but not set \u2014 setGpuKernels() first");return ul}}function Gt(){if(Qr==="js"||Qr==="gpu")return!1;
|
|
1205
1205
|
if(Qr==="wasm"){if(!qe)throw new Error("wasm kernels forced but not loaded \u2014 await loadKernels() first");return!0}return qe!==void 0}var rt=e=>e+15&-16;function qt(e){let t=qe,n=je+e,r=t.memory.buffer.
|
|
1206
1206
|
byteLength;return r<n&&t.memory.grow(Math.ceil((n-r)/65536)),new Uint8Array(t.memory.buffer)}function Vt(e){let t={width:e.width,height:e.height,data:new Uint8ClampedArray(e.width*e.height*4)};return e.
|
|
1207
|
-
at&&(t.at=e.at),t}function bl(e,t){return 8*(2*e*t*4+e*4)}function rd(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,a=je,u=rt(a+s),
|
|
1208
|
-
e);return m.data.set(new Uint8Array(qe.memory.buffer,u,s)),m}function od(e,t,n,r){let{width:i,height:s,data:a}=e,u=i*s*4,
|
|
1209
|
-
s,t,n,r[0],r[1],r[2]);let g=Vt(e);return g.data.set(new Uint8Array(qe.memory.buffer,
|
|
1210
|
-
a),new Int32Array(qe.memory.buffer,
|
|
1211
|
-
data:
|
|
1212
|
-
data:
|
|
1213
|
-
data:u}=e,
|
|
1214
|
-
m,
|
|
1215
|
-
let{width:a,height:u,data:
|
|
1216
|
-
set(new Uint8Array(qe.memory.buffer,g,
|
|
1217
|
-
A=rt(d+a*u*4);qt(A+a*u-je).set(i,
|
|
1218
|
-
set(new Uint8Array(qe.memory.buffer,
|
|
1219
|
-
memory.buffer,a,i)),
|
|
1220
|
-
s)),
|
|
1221
|
-
qe.memory.buffer,
|
|
1222
|
-
e.at),d.data.set(new Uint8Array(qe.memory.buffer,
|
|
1207
|
+
at&&(t.at=e.at),t}function bl(e,t){return 8*(2*e*t*4+e*4)}function rd(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,a=je,u=rt(a+s),f=rt(u+s);qt(f+bl(n,r)-je).set(i,a),qe.blur(a,u,f,n,r,t[0],t[1],t[2]);let m=Vt(
|
|
1208
|
+
e);return m.data.set(new Uint8Array(qe.memory.buffer,u,s)),m}function od(e,t,n,r){let{width:i,height:s,data:a}=e,u=i*s*4,f=je,h=rt(f+u),m=rt(h+u),d=rt(2*u)+bl(i,s);qt(m+d-je).set(a,f),qe.bloom(f,h,m,i,
|
|
1209
|
+
s,t,n,r[0],r[1],r[2]);let g=Vt(e);return g.data.set(new Uint8Array(qe.memory.buffer,h,u)),g}function id(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,a=je,u=rt(a+s),f=rt(u+s);qt(f+t.byteLength-je).set(i,
|
|
1210
|
+
a),new Int32Array(qe.memory.buffer,f,t.length).set(t),qe.glitch(a,u,f,t.length/5,n,r);let m=Vt(e);return m.data.set(new Uint8Array(qe.memory.buffer,u,s)),m}function sd(e,t,n,r,i,s=!1){let{width:a,height:u,
|
|
1211
|
+
data:f}=e,h=a*u*4,m=je,d=rt(m+h);qt(d+h-je).set(f,m),qe.scanlines(m,d,a,u,t,n,r,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(qe.memory.buffer,d,h)),g}function ad(e,t,n,r,i,s){let{width:a,height:u,
|
|
1212
|
+
data:f}=e,h=a*u*4,m=je,d=rt(m+h);qt(d+h-je).set(f,m),qe.grain(m,d,a,u,t,n,r|0,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(qe.memory.buffer,d,h)),g}function ld(e,t,n,r,i){let{width:s,height:a,
|
|
1213
|
+
data:u}=e,f=s*a*4,h=je,m=rt(h+f),d=rt(m+f);qt(d+72-je).set(u,h),new Float64Array(qe.memory.buffer,d,9).set(i),qe.color_correct(h,m,d,s,a,t,n,r);let g=Vt(e);return g.data.set(new Uint8Array(qe.memory.buffer,
|
|
1214
|
+
m,f)),g}function ud(e,t,n){let{width:r,height:i,data:s}=e,a=r*i*4,u=je,f=rt(u+a);qt(f+a-je).set(s,u),qe.threshold(u,f,r,i,t,n);let m=Vt(e);return m.data.set(new Uint8Array(qe.memory.buffer,f,a)),m}function cd(e,t,n,r,i,s){
|
|
1215
|
+
let{width:a,height:u,data:f}=e,h=a*u*4,m=t.width*t.height*4,d=je,A=rt(d+h),g=rt(A+m),x=qt(g+h-je);x.set(f,d),x.set(t.data,A),qe.matte(d,A,g,a,u,t.width,t.height,n,r,i?1:0,s?1:0);let v=Vt(e);return v.data.
|
|
1216
|
+
set(new Uint8Array(qe.memory.buffer,g,h)),v}function fd(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,a=Math.ceil(n/t.s)*Math.ceil(r/t.s),u=(t.mono?1:3)+(t.alpha?1:0),f=je,h=rt(f+s),m=rt(h+s),d=rt(m+a),
|
|
1217
|
+
A=rt(d+a*u*4);qt(A+a*u-je).set(i,f);let x=b=>b[0]|b[1]<<8|b[2]<<16|b[3]<<24|0;qe.dither(f,h,n,r,m,d,A,t.kind,t.order,t.steps,t.s,t.mono?1:0,x(t.dark),x(t.light),t.alpha?1:0);let v=Vt(e);return v.data.
|
|
1218
|
+
set(new Uint8Array(qe.memory.buffer,h,s)),v}function hd(e){let{width:t,height:n,data:r}=e,i=t*n*4,s=je,a=rt(s+i);qt(a+i-je).set(r,s),qe.invert(s,a,t,n);let f=Vt(e);return f.data.set(new Uint8Array(qe.
|
|
1219
|
+
memory.buffer,a,i)),f}function pd(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,a=je,u=rt(a+s);qt(u+s-je).set(i,a),qe.posterize(a,u,n,r,t);let h=Vt(e);return h.data.set(new Uint8Array(qe.memory.buffer,u,
|
|
1220
|
+
s)),h}function dd(e,t,n){let{width:r,height:i,data:s}=e,a=r*i*4,u=je,f=rt(u+a),h=rt(f+a),m=4*Math.max(r,i)*16;qt(h+m-je).set(s,u),qe.chromatic(u,f,h,r,i,t,n);let A=Vt(e);return A.data.set(new Uint8Array(
|
|
1221
|
+
qe.memory.buffer,f,a)),A}function md(e,t,n){let{width:r,height:i,data:s}=e,a=r*i*4,u=t*n*4,f=je,h=rt(f+a);qt(h+u-je).set(s,f),qe.resample(f,h,r,i,t,n);let d={width:t,height:n,data:new Uint8ClampedArray(u)};return e.at&&(d.at=
|
|
1222
|
+
e.at),d.data.set(new Uint8Array(qe.memory.buffer,h,u)),d}function ss(e,t){return{width:e,height:t,data:new Uint8ClampedArray(e*t*4)}}function Dt(e){let t=ss(e.width,e.height);return e.at&&(t.at=e.at),
|
|
1223
1223
|
t}function Xt(e){let t=Ke();if(t?.resident(e))return t.copy(e);let n={width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)};return e.at&&(n.at=e.at),n}function Ad(e){let t=Math.sqrt(12*e*e/
|
|
1224
|
-
3+1),n=Math.floor(t);n%2===0&&n--;let r=n+2,i=(12*e*e-3*n*n-12*n-9)/(-4*n-4),s=Math.round(i),a=u=>u<s?n:r;return[a(0),a(1),a(2)]}function yd(e,t,n,r,i){let s=2*i+1,a=n*4;for(let u=0;u<r;u++){let
|
|
1225
|
-
|
|
1226
|
-
0)*4,b=
|
|
1227
|
-
for(let
|
|
1224
|
+
3+1),n=Math.floor(t);n%2===0&&n--;let r=n+2,i=(12*e*e-3*n*n-12*n-9)/(-4*n-4),s=Math.round(i),a=u=>u<s?n:r;return[a(0),a(1),a(2)]}function yd(e,t,n,r,i){let s=2*i+1,a=n*4;for(let u=0;u<r;u++){let f=u*a,
|
|
1225
|
+
h=0,m=0,d=0,A=0;for(let g=-i;g<=i;g++){let x=f+(g<0?0:g>=n?n-1:g)*4;h+=e[x],m+=e[x+1],d+=e[x+2],A+=e[x+3]}for(let g=0;g<n;g++){let x=f+g*4;t[x]=h/s,t[x+1]=m/s,t[x+2]=d/s,t[x+3]=A/s;let v=f+(g-i>0?g-i:
|
|
1226
|
+
0)*4,b=f+(g+i+1<n-1?g+i+1:n-1)*4;h+=e[b]-e[v],m+=e[b+1]-e[v+1],d+=e[b+2]-e[v+2],A+=e[b+3]-e[v+3]}}}function gd(e,t,n,r,i){let s=2*i+1,a=n*4;rs.length<a&&(rs=new Float64Array(a));let u=rs;u.fill(0,0,a);
|
|
1227
|
+
for(let f=-i;f<=i;f++){let h=(f<0?0:f>=r?r-1:f)*a;for(let m=0;m<a;m++)u[m]=u[m]+e[h+m]}for(let f=0;f<r;f++){let h=f*a,m=(f-i>0?f-i:0)*a,d=(f+i+1<r-1?f+i+1:r-1)*a;for(let A=0;A<a;A++)t[h+A]=u[A]/s,u[A]=
|
|
1228
1228
|
u[A]+(e[d+A]-e[m+A])}}var ns=new Float64Array(0),cl=new Float64Array(0),rs=new Float64Array(0);function bd(e,t,n){let r=t,i=n,s=-1,a=-1;if(e.byteOffset%4===0){let u=new Uint32Array(e.buffer,e.byteOffset,
|
|
1229
|
-
t*n);for(let
|
|
1230
|
-
3])!==0&&(
|
|
1231
|
-
let u=s*4;for(let
|
|
1232
|
-
2)]}function Uo(e,t){if(t<=0)return Xt(e);let n=$o(t),r=Ke();if(r)return r.blur(e,n);if(Gt())return rd(e,n);let{width:i,height:s,data:a}=e,u=Dt(e),
|
|
1233
|
-
max(0,
|
|
1229
|
+
t*n);for(let f=0;f<n;f++){let h=f*t;for(let m=0;m<t;m++)u[h+m]!==0&&(m<r&&(r=m),m>s&&(s=m),f<i&&(i=f),a=f)}}else for(let u=0;u<n;u++){let f=u*t*4;for(let h=0;h<t;h++){let m=f+h*4;(e[m]|e[m+1]|e[m+2]|e[m+
|
|
1230
|
+
3])!==0&&(h<r&&(r=h),h>s&&(s=h),u<i&&(i=u),a=u)}}return s<0?void 0:[r,i,s+1,a+1]}function vd(e,t,n,r,i,s,a){for(let u=0;u<s;u++){let f=((r+u)*t+n)*4;a.set(e.subarray(f,f+i*4),u*i*4)}}function xd(e,t,n,r,i,s,a){
|
|
1231
|
+
let u=s*4;for(let f=0;f<a;f++){let h=f*u,m=((i+f)*n+r)*4;for(let d=0;d<u;d++)t[m+d]=Math.round(e[h+d])}}function $o(e){let[t,n,r]=Ad(e);return[Math.max(0,(t-1)/2),Math.max(0,(n-1)/2),Math.max(0,(r-1)/
|
|
1232
|
+
2)]}function Uo(e,t){if(t<=0)return Xt(e);let n=$o(t),r=Ke();if(r)return r.blur(e,n);if(Gt())return rd(e,n);let{width:i,height:s,data:a}=e,u=Dt(e),f=bd(a,i,s);if(!f)return u;let h=n[0]+n[1]+n[2]+1,m=Math.
|
|
1233
|
+
max(0,f[0]-h),d=Math.max(0,f[1]-h),A=Math.min(i,f[2]+h),g=Math.min(s,f[3]+h),x=A-m,v=g-d;ns.length<a.length&&(ns=new Float64Array(a.length),cl=new Float64Array(a.length));let b=ns,w=cl;vd(a,i,m,d,x,v,
|
|
1234
1234
|
b);for(let P of n)yd(b,w,x,v,P),gd(w,b,x,v,P);return xd(b,u.data,i,m,d,x,v),u}function Go(e,t){let n=new Int32Array(e),r=new Int32Array(e),i=new Float64Array(e);for(let s=0;s<e;s++){let a=Math.min(e-1,
|
|
1235
1235
|
Math.max(0,s+t)),u=Math.floor(a);n[s]=u,r[s]=Math.min(e-1,u+1),i[s]=a-u}return{i0:n,i1:r,f:i}}function vl(e,t,n){if(t===0&&n===0)return Xt(e);let r=Ke();if(r)return r.chromatic(e,t,n);if(Gt())return dd(
|
|
1236
|
-
e,t,n);let{width:i,height:s,data:a}=e,u=Dt(e),
|
|
1237
|
-
if(w===0&&T===0){for(let R=0;R<i;R++){let S=M+R*4,_=
|
|
1238
|
-
Y)+a[v+Q]*Y),
|
|
1239
|
-
4,X=m.f[R],te=a[v+_]*(1-Y)+a[v+Q]*Y,ce=a[b+_]*(1-Y)+a[b+Q]*Y,ue=a[v+_+3]*(1-Y)+a[v+Q+3]*Y,ie=a[b+_+3]*(1-Y)+a[b+Q+3]*Y,
|
|
1240
|
-
3]*X,ye=a[E+G+3]*(1-X)+a[E+q+3]*X,Be=ue*(1-w)+ie*w,Ee=ne*(1-T)+ye*T;
|
|
1241
|
-
let n=Math.max(1,Math.round(t.spacing)),r=Math.min(n,Math.max(1,Math.round(t.thickness))),i=Math.min(1,Math.max(0,t.strength));if(i===0)return Xt(e);let{width:s,height:a}=e,u=Math.round(t.offset),
|
|
1242
|
-
i,
|
|
1243
|
-
round(d.data[x+2]*
|
|
1244
|
-
function Id(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^=e>>>16,e>>>0}function
|
|
1236
|
+
e,t,n);let{width:i,height:s,data:a}=e,u=Dt(e),f=u.data,h=Go(i,-t),m=Go(i,t),d=Go(s,-n),A=Go(s,n),g=i*4;for(let x=0;x<s;x++){let v=d.i0[x]*g,b=d.i1[x]*g,w=d.f[x],P=A.i0[x]*g,E=A.i1[x]*g,T=A.f[x],M=x*g;
|
|
1237
|
+
if(w===0&&T===0){for(let R=0;R<i;R++){let S=M+R*4,_=h.i0[R]*4,Q=h.i1[R]*4,Y=h.f[R],G=m.i0[R]*4,q=m.i1[R]*4,X=m.f[R],te=a[v+_+3]*(1-Y)+a[v+Q+3]*Y,ce=a[P+G+3]*(1-X)+a[P+q+3]*X;f[S]=Math.round(a[v+_]*(1-
|
|
1238
|
+
Y)+a[v+Q]*Y),f[S+1]=a[S+1],f[S+2]=Math.round(a[P+G+2]*(1-X)+a[P+q+2]*X),f[S+3]=Math.round((te+a[S+3]+ce)/3)}continue}for(let R=0;R<i;R++){let S=M+R*4,_=h.i0[R]*4,Q=h.i1[R]*4,Y=h.f[R],G=m.i0[R]*4,q=m.i1[R]*
|
|
1239
|
+
4,X=m.f[R],te=a[v+_]*(1-Y)+a[v+Q]*Y,ce=a[b+_]*(1-Y)+a[b+Q]*Y,ue=a[v+_+3]*(1-Y)+a[v+Q+3]*Y,ie=a[b+_+3]*(1-Y)+a[b+Q+3]*Y,fe=a[P+G+2]*(1-X)+a[P+q+2]*X,ve=a[E+G+2]*(1-X)+a[E+q+2]*X,ne=a[P+G+3]*(1-X)+a[P+q+
|
|
1240
|
+
3]*X,ye=a[E+G+3]*(1-X)+a[E+q+3]*X,Be=ue*(1-w)+ie*w,Ee=ne*(1-T)+ye*T;f[S]=Math.round(te*(1-w)+ce*w),f[S+1]=a[S+1],f[S+2]=Math.round(fe*(1-T)+ve*T),f[S+3]=Math.round((Be+a[S+3]+Ee)/3)}}return u}function xl(e,t){
|
|
1241
|
+
let n=Math.max(1,Math.round(t.spacing)),r=Math.min(n,Math.max(1,Math.round(t.thickness))),i=Math.min(1,Math.max(0,t.strength));if(i===0)return Xt(e);let{width:s,height:a}=e,u=Math.round(t.offset),f=1-
|
|
1242
|
+
i,h=t.vertical===!0,m=Ke();if(m)return m.scanlines(e,n,r,u,f,h);if(Gt())return sd(e,n,r,u,f,h);let d=Xt(e),A=x=>{d.data[x]=Math.round(d.data[x]*f),d.data[x+1]=Math.round(d.data[x+1]*f),d.data[x+2]=Math.
|
|
1243
|
+
round(d.data[x+2]*f)},g=x=>((x+u)%n+n)%n<r;if(h){for(let x=0;x<s;x++)if(g(x))for(let v=0;v<a;v++)A((v*s+x)*4);return d}for(let x=0;x<a;x++){if(!g(x))continue;let v=x*s*4;for(let b=0;b<s;b++)A(v+b*4)}return d}
|
|
1244
|
+
function Id(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^=e>>>16,e>>>0}function fl(e,t,n,r,i){let s=Math.imul(e,2654435761)^Math.imul(t,2246822519)^Math.imul(n,3266489917)^
|
|
1245
1245
|
Math.imul(r,668265263)^Math.imul(i+1,374761393);return Id(s)/4294967296*2-1}function Il(e,t){let n=Math.min(1,Math.max(0,t.amount)),r=Math.max(1,Math.round(t.size)),i=t.seed>>>0,s=Math.round(t.frame)|
|
|
1246
|
-
0,a=t.colour===!0;if(n===0)return Xt(e);let u=Ke();if(u)return u.grain(e,n,r,i,s,a);if(Gt())return ad(e,n,r,i,s,a);let{width:
|
|
1247
|
-
|
|
1246
|
+
0,a=t.colour===!0;if(n===0)return Xt(e);let u=Ke();if(u)return u.grain(e,n,r,i,s,a);if(Gt())return ad(e,n,r,i,s,a);let{width:f,height:h,data:m}=e,d=Dt(e);for(let A=0;A<h;A++){let g=A/r|0;for(let x=0;x<
|
|
1247
|
+
f;x++){let v=(A*f+x)*4,b=m[v+3];if(b===0)continue;let w=x/r|0,P=n*b,E=fl(w,g,i,s,0);for(let T=0;T<3;T++){let M=a&&T>0?fl(w,g,i,s,T):E,R=Math.min(b,Math.max(0,m[v+T]+M*P));d.data[v+T]=Math.round(R)}d.data[v+
|
|
1248
1248
|
3]=b}}return d}function wd(e){return e.brightness===0&&e.contrast===0&&e.saturation===0&&e.hue%360===0}function kd(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return new Float64Array([.213+n*.787-
|
|
1249
1249
|
r*.213,.715-n*.715-r*.715,.072-n*.072+r*.928,.213-n*.213+r*.143,.715+n*.285+r*.14,.072-n*.072-r*.283,.213-n*.213-r*.787,.715-n*.715+r*.715,.072+n*.928+r*.072])}function wl(e,t){if(wd(t))return Xt(e);let n=Math.
|
|
1250
1250
|
min(1,Math.max(-1,t.brightness)),r=1+Math.min(1,Math.max(-1,t.contrast)),i=1+Math.min(1,Math.max(-1,t.saturation)),s=kd(t.hue),a=Ke();if(a)return a.colorCorrect(e,n,r,i,s);if(Gt())return ld(e,n,r,i,s);
|
|
1251
|
-
let{data:u}=e,
|
|
1252
|
-
v+.0722*b;x=w+(x-w)*i,v=w+(v-w)*i,b=w+(b-w)*i,x=(x-.5)*r+.5+n,v=(v-.5)*r+.5+n,b=(b-.5)*r+.5+n,
|
|
1253
|
-
2]=Math.round(Math.min(1,Math.max(0,b))*m),
|
|
1254
|
-
return ud(e,n,r);let{data:s}=e,a=Dt(e),u=n-r/2;for(let
|
|
1255
|
-
max(0,(m-u)/r));d=g*g*(3-2*g)}let A=Math.round(d*
|
|
1251
|
+
let{data:u}=e,f=Dt(e);for(let h=0;h<u.length;h+=4){let m=u[h+3];if(m===0)continue;let d=u[h]/m,A=u[h+1]/m,g=u[h+2]/m,x=s[0]*d+s[1]*A+s[2]*g,v=s[3]*d+s[4]*A+s[5]*g,b=s[6]*d+s[7]*A+s[8]*g,w=.2126*x+.7152*
|
|
1252
|
+
v+.0722*b;x=w+(x-w)*i,v=w+(v-w)*i,b=w+(b-w)*i,x=(x-.5)*r+.5+n,v=(v-.5)*r+.5+n,b=(b-.5)*r+.5+n,f.data[h]=Math.round(Math.min(1,Math.max(0,x))*m),f.data[h+1]=Math.round(Math.min(1,Math.max(0,v))*m),f.data[h+
|
|
1253
|
+
2]=Math.round(Math.min(1,Math.max(0,b))*m),f.data[h+3]=m}return f}function kl(e,t){let n=Math.min(1,Math.max(0,t.level)),r=Math.min(1,Math.max(0,t.soft)),i=Ke();if(i)return i.threshold(e,n,r);if(Gt())
|
|
1254
|
+
return ud(e,n,r);let{data:s}=e,a=Dt(e),u=n-r/2;for(let f=0;f<s.length;f+=4){let h=s[f+3];if(h===0)continue;let m=(.2126*s[f]+.7152*s[f+1]+.0722*s[f+2])/h,d;if(r===0)d=m>=n?1:0;else{let g=Math.min(1,Math.
|
|
1255
|
+
max(0,(m-u)/r));d=g*g*(3-2*g)}let A=Math.round(d*h);a.data[f]=A,a.data[f+1]=A,a.data[f+2]=A,a.data[f+3]=h}return a}function Cl(e){let t=Ke();if(t)return t.invert(e);if(Gt())return hd(e);let{data:n}=e,
|
|
1256
1256
|
r=Dt(e);for(let i=0;i<n.length;i+=4){let s=n[i+3];r.data[i]=s-n[i],r.data[i+1]=s-n[i+1],r.data[i+2]=s-n[i+2],r.data[i+3]=s}return r}function El(e,t){let n=Math.min(256,Math.max(2,Math.round(t.levels)));
|
|
1257
|
-
if(n===256)return Xt(e);let r=n-1,i=Ke();if(i)return i.posterize(e,r);if(Gt())return pd(e,r);let s=new Uint8Array(65536);for(let
|
|
1258
|
-
r*255;s[
|
|
1259
|
-
data[
|
|
1260
|
-
max(2,Math.round(e.levels)||2))-1,s:Math.min(32,Math.max(1,Math.round(e.pixel??1)||1)),mono:e.mono,dark:(e.dark??[0,0,0,255]).map(
|
|
1261
|
-
let n=Cd(t),r=Ke();return r&&n.kind===0?r.dither(e,n):Gt()?
|
|
1262
|
-
3,g=A+(t.alpha?1:0),x=new Uint8Array(d),v=new Int32Array(d*g),b=new Uint8Array(d*g);for(let E=0;E<m;E++){let T=E*a,M=Math.min(r,T+a);for(let R=0;R<
|
|
1263
|
-
M;ve++)for(let ne=S;ne<_;ne++){let ye=(ve*n+ne)*4;Q+=i[ye],Y+=i[ye+1],G+=i[ye+2],q+=i[ye+3]}let X=(M-T)*(_-S),te=E*
|
|
1264
|
-
floor((Q*510+q)/(2*q))),ie=Math.min(255,Math.floor((Y*510+q)/(2*q))),
|
|
1265
|
-
2]=
|
|
1266
|
-
floor((v[_*g+Y]*u*2*T+Q)/(510*T));b[_*g+Y]=Math.min(u,G)}}}else{for(let M=0;M<v.length;M++)v[M]=v[M]<<4;let E=t.kind===2,T=(M,R,S,_)=>{if(M<0||M>=
|
|
1267
|
-
m;M++){let R=M&1?-1:1;for(let S=0;S<
|
|
1257
|
+
if(n===256)return Xt(e);let r=n-1,i=Ke();if(i)return i.posterize(e,r);if(Gt())return pd(e,r);let s=new Uint8Array(65536);for(let f=1;f<256;f++)for(let h=0;h<=f;h++){let m=h*255/f,d=Math.round(m/255*r)/
|
|
1258
|
+
r*255;s[f*256+h]=Math.round(d*f/255)}let{data:a}=e,u=Dt(e);for(let f=0;f<a.length;f+=4){let h=a[f+3];if(h===0)continue;let m=h*256;u.data[f]=s[m+a[f]],u.data[f+1]=s[m+a[f+1]],u.data[f+2]=s[m+a[f+2]],u.
|
|
1259
|
+
data[f+3]=h}return u}var hl=e=>Math.min(255,Math.max(0,Math.round(e)));function Cd(e){let t=e.method;return{kind:t==="floyd"?1:t==="atkinson"?2:0,order:t==="bayer2"?2:t==="bayer4"?4:t==="bayer8"?8:0,steps:Math.min(16,Math.
|
|
1260
|
+
max(2,Math.round(e.levels)||2))-1,s:Math.min(32,Math.max(1,Math.round(e.pixel??1)||1)),mono:e.mono,dark:(e.dark??[0,0,0,255]).map(hl),light:(e.light??[255,255,255,255]).map(hl),alpha:e.alpha??!0}}function Sl(e,t){
|
|
1261
|
+
let n=Cd(t),r=Ke();return r&&n.kind===0?r.dither(e,n):Gt()?fd(e,n):Ed(e,n)}function Ed(e,t){let{width:n,height:r,data:i}=e,s=Dt(e),{s:a,steps:u,mono:f}=t,h=Math.ceil(n/a),m=Math.ceil(r/a),d=h*m,A=f?1:
|
|
1262
|
+
3,g=A+(t.alpha?1:0),x=new Uint8Array(d),v=new Int32Array(d*g),b=new Uint8Array(d*g);for(let E=0;E<m;E++){let T=E*a,M=Math.min(r,T+a);for(let R=0;R<h;R++){let S=R*a,_=Math.min(n,S+a),Q=0,Y=0,G=0,q=0;for(let ve=T;ve<
|
|
1263
|
+
M;ve++)for(let ne=S;ne<_;ne++){let ye=(ve*n+ne)*4;Q+=i[ye],Y+=i[ye+1],G+=i[ye+2],q+=i[ye+3]}let X=(M-T)*(_-S),te=E*h+R,ce=Math.floor((2*q+X)/(2*X));if(x[te]=ce,ce===0)continue;let ue=Math.min(255,Math.
|
|
1264
|
+
floor((Q*510+q)/(2*q))),ie=Math.min(255,Math.floor((Y*510+q)/(2*q))),fe=Math.min(255,Math.floor((G*510+q)/(2*q)));f?v[te*g]=Math.floor((2126*ue+7152*ie+722*fe+5e3)/1e4):(v[te*g]=ue,v[te*g+1]=ie,v[te*g+
|
|
1265
|
+
2]=fe),t.alpha&&(v[te*g+A]=ce)}}if(t.kind===0){let E=t.order,T=E*E,M=nd(E);for(let R=0;R<m;R++)for(let S=0;S<h;S++){let _=R*h+S;if(x[_]===0)continue;let Q=(2*M[R%E*E+S%E]+1)*255;for(let Y=0;Y<g;Y++){let G=Math.
|
|
1266
|
+
floor((v[_*g+Y]*u*2*T+Q)/(510*T));b[_*g+Y]=Math.min(u,G)}}}else{for(let M=0;M<v.length;M++)v[M]=v[M]<<4;let E=t.kind===2,T=(M,R,S,_)=>{if(M<0||M>=h||R>=m)return;let Q=(R*h+M)*g+S;v[Q]=v[Q]+_};for(let M=0;M<
|
|
1267
|
+
m;M++){let R=M&1?-1:1;for(let S=0;S<h;S++){let _=R===1?S:h-1-S,Q=M*h+_;if(x[Q]!==0)for(let Y=0;Y<g;Y++){let G=Math.min(4080,Math.max(0,v[Q*g+Y])),q=Math.floor((G*u*2+4080)/8160);b[Q*g+Y]=q;let X=G-(Math.
|
|
1268
1268
|
floor((q*510+u)/(2*u))<<4);if(X!==0)if(E){let te=X>>3;T(_+R,M,Y,te),T(_+2*R,M,Y,te),T(_-R,M+1,Y,te),T(_,M+1,Y,te),T(_+R,M+1,Y,te),T(_,M+2,Y,te)}else T(_+R,M,Y,X*7>>4),T(_-R,M+1,Y,X*3>>4),T(_,M+1,Y,X*5>>
|
|
1269
|
-
4),T(_+R,M+1,Y,X>>4)}}}}let{dark:w,light:P}=t;for(let E=0;E<m;E++){let T=E*a,M=Math.min(r,T+a);for(let R=0;R<
|
|
1270
|
-
if(Q===0)continue;let Y,G,q,X;if(
|
|
1269
|
+
4),T(_+R,M+1,Y,X>>4)}}}}let{dark:w,light:P}=t;for(let E=0;E<m;E++){let T=E*a,M=Math.min(r,T+a);for(let R=0;R<h;R++){let S=E*h+R,_=ue=>Math.floor((ue*510+u)/(2*u)),Q=x[S]===0?0:t.alpha?_(b[S*g+A]):x[S];
|
|
1270
|
+
if(Q===0)continue;let Y,G,q,X;if(f){let ue=b[S*g],ie=(fe,ve)=>Math.floor(((fe*(u-ue)+ve*ue)*2+u)/(2*u));X=Math.floor((Q*ie(w[3],P[3])+127)/255),Y=Math.floor((ie(w[0],P[0])*X+127)/255),G=Math.floor((ie(
|
|
1271
1271
|
w[1],P[1])*X+127)/255),q=Math.floor((ie(w[2],P[2])*X+127)/255)}else X=Q,Y=Math.floor((_(b[S*g])*Q+127)/255),G=Math.floor((_(b[S*g+1])*Q+127)/255),q=Math.floor((_(b[S*g+2])*Q+127)/255);let te=R*a,ce=Math.
|
|
1272
|
-
min(n,te+a);for(let ue=T;ue<M;ue++)for(let ie=te;ie<ce;ie++){let
|
|
1273
|
-
let
|
|
1274
|
-
glitch(e,Int32Array.from(i.flat()));if(Gt())return id(e,Int32Array.from(i.flat()));let a=Xt(e);for(let[u,h,
|
|
1272
|
+
min(n,te+a);for(let ue=T;ue<M;ue++)for(let ie=te;ie<ce;ie++){let fe=(ue*n+ie)*4;s.data[fe]=Y,s.data[fe+1]=G,s.data[fe+2]=q,s.data[fe+3]=X}}}return s}function Bl(e,t){let{width:n,height:r}=e,i=[];for(let u of t){
|
|
1273
|
+
let f=Math.max(0,Math.round(u.y0)),h=Math.min(r,Math.round(u.y1)),m=Math.round(u.dx),d=Math.round(u.channelDx),A=Math.round(u.dy??0);m===0&&d===0&&A===0||h<=f||i.push([f,h,m,d,A])}let s=Ke();if(s)return s.
|
|
1274
|
+
glitch(e,Int32Array.from(i.flat()));if(Gt())return id(e,Int32Array.from(i.flat()));let a=Xt(e);for(let[u,f,h,m,d]of i){let A=((0-h)%n+n)%n,g=((0-h-m)%n+n)%n,x=e.data,v=a.data;for(let b=u;b<f;b++){let w=b*
|
|
1275
1275
|
n*4,P=((b-d)%r+r)%r*n*4,E=A,T=g;for(let M=0;M<n;M++){let R=w+M*4,S=P+E*4;v[R]=x[P+T*4],v[R+1]=x[S+1],v[R+2]=x[S+2],v[R+3]=x[S+3],++E===n&&(E=0),++T===n&&(T=0)}}}return a}function Sd(e,t,n,r){for(let i=0;i<
|
|
1276
1276
|
e.length;i+=4){let s=Math.max(e[i],e[i+1],e[i+2]);if(s<=n)continue;let a=(s-n)/(255-n||1)*r;t[i]=Math.round(e[i]*a),t[i+1]=Math.round(e[i+1]*a),t[i+2]=Math.round(e[i+2]*a),t[i+3]=Math.round(e[i+3]*a)}}
|
|
1277
1277
|
function Pl(e,t){let n=Math.max(0,t.strength);if(n===0||t.radius<=0)return Xt(e);let{width:r,height:i,data:s}=e,a=Math.min(1,Math.max(0,t.threshold))*255,u=Ke();if(u)return u.bloom(e,a,n,$o(t.radius));
|
|
1278
|
-
if(Gt())return od(e,a,n,$o(t.radius));let
|
|
1279
|
-
return t==="ease"?e*e*(3-2*e):t==="expo"?e*e:e}function Ml(e,t){let n=Ke();if(n)return n.fade(e,t);let{width:r,height:i,data:s}=e,a=Dt(e),u=Math.min(1,Math.max(0,t.start)),
|
|
1280
|
-
u,m=Math.min(1,Math.max(0,t.strength??1)),d=g=>{let x=
|
|
1278
|
+
if(Gt())return od(e,a,n,$o(t.radius));let f=ss(r,i);Sd(s,f.data,a,n);let h=Uo(f,t.radius).data,m=Dt(e);return Bd(s,h,m.data),m}function Bd(e,t,n){for(let r=0;r<n.length;r++)n[r]=e[r]+t[r]}function Pd(e,t){
|
|
1279
|
+
return t==="ease"?e*e*(3-2*e):t==="expo"?e*e:e}function Ml(e,t){let n=Ke();if(n)return n.fade(e,t);let{width:r,height:i,data:s}=e,a=Dt(e),u=Math.min(1,Math.max(0,t.start)),h=Math.max(u,Math.min(1,t.end))-
|
|
1280
|
+
u,m=Math.min(1,Math.max(0,t.strength??1)),d=g=>{let x=h<=0?g<u?0:1:Math.min(1,Math.max(0,(g-u)/h)),v=1-Pd(x,t.curve),b=t.invert?1-v:v;return m===1?b:1-m*(1-b)},A=(g,x)=>{a.data[g]=Math.round(s[g]*x),a.
|
|
1281
1281
|
data[g+1]=Math.round(s[g+1]*x),a.data[g+2]=Math.round(s[g+2]*x),a.data[g+3]=Math.round(s[g+3]*x)};if(t.shape==="radial"){let g=t.cx*r,x=t.cy*i,v=Math.max(Math.hypot(g,x),Math.hypot(r-g,x),Math.hypot(g,
|
|
1282
1282
|
i-x),Math.hypot(r-g,i-x),1e-6);for(let b=0;b<i;b++){let w=b+.5-x;for(let P=0;P<r;P++)A((b*r+P)*4,d(Math.hypot(P+.5-g,w)/v))}}else{let g=t.angle*Math.PI/180,x=Math.cos(g),v=Math.sin(g),b=[0,r*x,i*v,r*x+
|
|
1283
1283
|
i*v],w=Math.min(...b),P=Math.max(...b),E=Math.max(P-w,1e-6),T=new Float64Array(r);for(let M=0;M<r;M++)T[M]=(M+.5)*x;for(let M=0;M<i;M++){let R=(M+.5)*v;for(let S=0;S<r;S++)A((M*r+S)*4,d((T[S]+R-w)/E))}}
|
|
1284
1284
|
return a}var zo=["normal","add","multiply","screen"];function Lr(e,t){return e.at?{x:Math.round(e.at.x),y:Math.round(e.at.y)}:t==="center"?{x:-Math.floor(e.width/2),y:-Math.floor(e.height/2)}:{x:0,y:0}}
|
|
1285
|
-
var pl=new Uint8ClampedArray(4);function Md(e,t,n,r,i,s,a,u){let
|
|
1285
|
+
var pl=new Uint8ClampedArray(4);function Md(e,t,n,r,i,s,a,u){let f=n[r+3]/255*u,h=e[t+3]/255;if(a===0){let d=1-f;i[s]=Math.round(Math.min(1,n[r]/255*u+e[t]/255*d)*255),i[s+1]=Math.round(Math.min(1,n[r+
|
|
1286
1286
|
1]/255*u+e[t+1]/255*d)*255),i[s+2]=Math.round(Math.min(1,n[r+2]/255*u+e[t+2]/255*d)*255)}else if(a===1)i[s]=Math.round(Math.min(1,n[r]/255*u+e[t]/255)*255),i[s+1]=Math.round(Math.min(1,n[r+1]/255*u+e[t+
|
|
1287
|
-
1]/255)*255),i[s+2]=Math.round(Math.min(1,n[r+2]/255*u+e[t+2]/255)*255);else if(a===2)for(let d=0;d<3;d++){let A=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,A*g+A*(1-
|
|
1288
|
-
3;d++){let A=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,A+g-A*g)*255)}let m=a===1?Math.min(1,h
|
|
1287
|
+
1]/255)*255),i[s+2]=Math.round(Math.min(1,n[r+2]/255*u+e[t+2]/255)*255);else if(a===2)for(let d=0;d<3;d++){let A=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,A*g+A*(1-h)+g*(1-f))*255)}else for(let d=0;d<
|
|
1288
|
+
3;d++){let A=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,A+g-A*g)*255)}let m=a===1?Math.min(1,f+h):f+h*(1-f);i[s+3]=Math.round(Math.min(1,m)*255)}function _d(e,t,n,r,i,s,a){let u=1-a;i[s]=Math.
|
|
1289
1289
|
round(e[t]*u+n[r]*a),i[s+1]=Math.round(e[t+1]*u+n[r+1]*a),i[s+2]=Math.round(e[t+2]*u+n[r+2]*a),i[s+3]=Math.round(e[t+3]*u+n[r+3]*a)}function as(e,t,n,r,i="top-left"){let s=Math.min(1,Math.max(0,r)),a=zo.
|
|
1290
|
-
indexOf(n),u=Ke();return u?u.combine(e,t,i,{mode:a,k:s}):Tl(e,t,i,(h,
|
|
1291
|
-
k:i}):Tl(e,t,r,(a,u,h,
|
|
1292
|
-
4)r(e.data,b,t.data,b,v.data,b);return v}let a=Math.min(i.x,s.x),u=Math.min(i.y,s.y),
|
|
1290
|
+
indexOf(n),u=Ke();return u?u.combine(e,t,i,{mode:a,k:s}):Tl(e,t,i,(f,h,m,d,A,g)=>Md(f,h,m,d,A,g,a,s))}function _l(e,t,n,r="top-left"){let i=Math.min(1,Math.max(0,n)),s=Ke();return s?s.combine(e,t,r,{mode:4,
|
|
1291
|
+
k:i}):Tl(e,t,r,(a,u,f,h,m,d)=>_d(a,u,f,h,m,d,i))}function Tl(e,t,n,r){let i=Lr(e,n),s=Lr(t,n);if(e.width===t.width&&e.height===t.height&&i.x===s.x&&i.y===s.y){let v=Dt(e);for(let b=0;b<e.data.length;b+=
|
|
1292
|
+
4)r(e.data,b,t.data,b,v.data,b);return v}let a=Math.min(i.x,s.x),u=Math.min(i.y,s.y),f=Math.max(i.x+e.width,s.x+t.width),h=Math.max(i.y+e.height,s.y+t.height),m=f-a,d=h-u,A=m===e.width&&d===e.height&&
|
|
1293
1293
|
a===i.x&&u===i.y?Dt(e):{...ss(m,d),at:{x:a,y:u}},g=e.data,x=t.data;for(let v=0;v<d;v++){let b=v+u-i.y,w=v+u-s.y,P=b>=0&&b<e.height,E=w>=0&&w<t.height;for(let T=0;T<m;T++){let M=T+a-i.x,R=T+a-s.x,S=P&&
|
|
1294
1294
|
M>=0&&M<e.width,_=E&&R>=0&&R<t.width;!S&&!_||r(S?g:pl,S?(b*e.width+M)*4:0,_?x:pl,_?(w*t.width+R)*4:0,A.data,(v*m+T)*4)}}return A}function Rl(e,t,n,r="top-left"){let i=Lr(e,r),s=Lr(t,r),a=s.x-i.x,u=s.y-
|
|
1295
|
-
i.y,
|
|
1296
|
-
0&&P<t.height;for(let T=0;T<d;T++){let M=T-a,R=0;if(E&&M>=0&&M<t.width){let _=(P*t.width+M)*4;R=
|
|
1295
|
+
i.y,f=n.mode==="luma",h=n.invert===!0,m=Ke();if(m)return m.matte(e,t,a,u,f,h);if(Gt())return cd(e,t,a,u,f,h);let{width:d,height:A,data:g}=e,x=t.data,v=Dt(e),b=v.data;for(let w=0;w<A;w++){let P=w-u,E=P>=
|
|
1296
|
+
0&&P<t.height;for(let T=0;T<d;T++){let M=T-a,R=0;if(E&&M>=0&&M<t.width){let _=(P*t.width+M)*4;R=f?Math.floor((2126*x[_]+7152*x[_+1]+722*x[_+2]+5e3)/1e4):x[_+3]}if(h&&(R=255-R),R===0)continue;let S=(w*
|
|
1297
1297
|
d+T)*4;R===255?(b[S]=g[S],b[S+1]=g[S+1],b[S+2]=g[S+2],b[S+3]=g[S+3]):(b[S]=Math.floor((g[S]*R+127)/255),b[S+1]=Math.floor((g[S+1]*R+127)/255),b[S+2]=Math.floor((g[S+2]*R+127)/255),b[S+3]=Math.floor((g[S+
|
|
1298
1298
|
3]*R+127)/255))}}return v}var nt=`#version 300 es
|
|
1299
1299
|
precision highp float;
|
|
@@ -1591,46 +1591,46 @@ void main() {
|
|
|
1591
1591
|
else { vec3 sc = s.rgb * u_k; c = min(sc + d.rgb - sc * d.rgb, 1.0); }
|
|
1592
1592
|
float a = u_mode == 1 ? min(sa + da, 1.0) : sa + da * (1.0 - sa);
|
|
1593
1593
|
o = vec4(c, min(a, 1.0));
|
|
1594
|
-
}`},ev=64*1024*1024;function dl(e,t){let n=new Int32Array(e),r=new Int32Array(e),i=new Float64Array(e),s=t/e;for(let a=0;a<e;a++){let u=(a+.5)*s-.5;u<0&&(u=0),u>t-1&&(u=t-1);let
|
|
1595
|
-
u-
|
|
1596
|
-
e,r,i);let{width:a,height:u,data:
|
|
1597
|
-
M=(x+P)*4,R=(x+E)*4,S=(v+P)*4,_=(v+E)*4,Q=(g*r+w)*4;for(let Y=0;Y<4;Y++){let G=
|
|
1598
|
-
(A.at=e.at),A}function Dl(e,t,n,r){let i=Math.max(1,Math.round(r.w)),s=Math.max(1,Math.round(r.h)),a=Ke();if(a)return a.warp(e,t,n,{x:r.x,y:r.y,w:i,h:s});let{width:u,height:
|
|
1599
|
-
i*s*4);return Td(
|
|
1600
|
-
t+S)*4+Q];for(let S=0;S<s;S++){let _=
|
|
1601
|
-
let ue=Math.floor(te),ie=Math.floor(ce),
|
|
1602
|
-
Be*(1-ve)+Ee*ve)}}}}var
|
|
1603
|
-
0?0:Math.floor((s[u-1]+a)/2)+1,hi:u===s.length-1?255:Math.floor((a+s[u+1])/2),radius:a*
|
|
1604
|
-
u/n)*n),i=[0],s=[];for(let{level:u,side:
|
|
1605
|
-
let u=Ke();if(u)return u.focusSelect(e,t,n,r,i,s,a);let{width:
|
|
1606
|
-
P>=0&&P<t.width){let R=(v*t.width+P)*4,S=d[R+3];if(S>0){let _=S>>1;E=Math.floor((d[R]*255+_)/S),T=Math.floor((d[R+1]*255+_)/S)>=128?1:0}}if(T!==i||E<s||E>a)continue;let M=(x*
|
|
1607
|
-
1],g[M+2]=m[M+2],g[M+3]=m[M+3]}}return A}function Ll(e,t,n,r="top-left"){if(n.length===0)return Xt(e);let i=Lr(e,r),s=Lr(t,r),a=s.x-i.x,u=s.y-i.y,
|
|
1608
|
-
0?{...m,radii:$o(m.radius)}:m));let
|
|
1594
|
+
}`},ev=64*1024*1024;function dl(e,t){let n=new Int32Array(e),r=new Int32Array(e),i=new Float64Array(e),s=t/e;for(let a=0;a<e;a++){let u=(a+.5)*s-.5;u<0&&(u=0),u>t-1&&(u=t-1);let f=Math.floor(u);n[a]=f,r[a]=f+1<t?f+1:f,i[a]=
|
|
1595
|
+
u-f}return{i0:n,i1:r,f:i}}function jo(e,t,n){let r=Math.max(1,Math.round(t)),i=Math.max(1,Math.round(n));if(r===e.width&&i===e.height)return Xt(e);let s=Ke();if(s)return s.resample(e,r,i);if(Gt())return md(
|
|
1596
|
+
e,r,i);let{width:a,height:u,data:f}=e,h=new Uint8ClampedArray(r*i*4),m=dl(r,a),d=dl(i,u);for(let g=0;g<i;g++){let x=d.i0[g]*a,v=d.i1[g]*a,b=d.f[g];for(let w=0;w<r;w++){let P=m.i0[w],E=m.i1[w],T=m.f[w],
|
|
1597
|
+
M=(x+P)*4,R=(x+E)*4,S=(v+P)*4,_=(v+E)*4,Q=(g*r+w)*4;for(let Y=0;Y<4;Y++){let G=f[M+Y]*(1-T)+f[R+Y]*T,q=f[S+Y]*(1-T)+f[_+Y]*T;h[Q+Y]=Math.round(G*(1-b)+q*b)}}}let A={width:r,height:i,data:h};return e.at&&
|
|
1598
|
+
(A.at=e.at),A}function Dl(e,t,n,r){let i=Math.max(1,Math.round(r.w)),s=Math.max(1,Math.round(r.h)),a=Ke();if(a)return a.warp(e,t,n,{x:r.x,y:r.y,w:i,h:s});let{width:u,height:f,data:h}=e,m=new Uint8ClampedArray(
|
|
1599
|
+
i*s*4);return Td(h,u,f,m,i,s,t,n,r.x,r.y),{width:i,height:s,data:m,at:{x:r.x,y:r.y}}}function Td(e,t,n,r,i,s,a,u,f,h){let[m,d,A,g,x,v,b,w,P]=u,{x:E,y:T,scale:M}=a,R=(S,_,Q)=>S<0||_<0||S>=t||_>=n?0:e[(_*
|
|
1600
|
+
t+S)*4+Q];for(let S=0;S<s;S++){let _=h+S+.5;for(let Q=0;Q<i;Q++){let Y=f+Q+.5,G=m*Y+d*_+A,q=g*Y+x*_+v,X=b*Y+w*_+P;if(X<=1e-9)continue;let te=(G/X-E)*M-.5,ce=(q/X-T)*M-.5;if(te<-1||ce<-1||te>t||ce>n)continue;
|
|
1601
|
+
let ue=Math.floor(te),ie=Math.floor(ce),fe=te-ue,ve=ce-ie,ne=(S*i+Q)*4;for(let ye=0;ye<4;ye++){let Be=R(ue,ie,ye)*(1-fe)+R(ue+1,ie,ye)*fe,Ee=R(ue,ie+1,ye)*(1-fe)+R(ue+1,ie+1,ye)*fe;r[ne+ye]=Math.round(
|
|
1602
|
+
Be*(1-ve)+Ee*ve)}}}}var Ol=.25;function Nl(e){return Math.max(0,Math.min(255,Math.round(e/Ol)))}function Rd(e,t){let n=(r,i)=>{let s=[...new Set(r)].sort((a,u)=>a-u);return s.map((a,u)=>({side:i,lo:u===
|
|
1603
|
+
0?0:Math.floor((s[u-1]+a)/2)+1,hi:u===s.length-1?255:Math.floor((a+s[u+1])/2),radius:a*Ol}))};return[...n(t,1).reverse(),...n(e,0)]}function Ql(e,t=24){let n=1;for(;;){let r=u=>Math.min(255,Math.round(
|
|
1604
|
+
u/n)*n),i=[0],s=[];for(let{level:u,side:f}of e){let h=r(Math.max(0,Math.min(255,Math.round(u))));f===1&&h>0?s.push(h):i.push(h)}let a=Rd(i,s);if(a.length<=t||n>=256)return a;n*=2}}function Dd(e,t,n,r,i,s,a){
|
|
1605
|
+
let u=Ke();if(u)return u.focusSelect(e,t,n,r,i,s,a);let{width:f,height:h,data:m}=e,d=t.data,A=Dt(e),g=A.data;for(let x=0;x<h;x++){let v=x-r,b=v>=0&&v<t.height;for(let w=0;w<f;w++){let P=w-n,E=0,T=0;if(b&&
|
|
1606
|
+
P>=0&&P<t.width){let R=(v*t.width+P)*4,S=d[R+3];if(S>0){let _=S>>1;E=Math.floor((d[R]*255+_)/S),T=Math.floor((d[R+1]*255+_)/S)>=128?1:0}}if(T!==i||E<s||E>a)continue;let M=(x*f+w)*4;g[M]=m[M],g[M+1]=m[M+
|
|
1607
|
+
1],g[M+2]=m[M+2],g[M+3]=m[M+3]}}return A}function Ll(e,t,n,r="top-left"){if(n.length===0)return Xt(e);let i=Lr(e,r),s=Lr(t,r),a=s.x-i.x,u=s.y-i.y,f=Ke();if(f)return f.depthOfField(e,t,a,u,n.map(m=>m.radius>
|
|
1608
|
+
0?{...m,radii:$o(m.radius)}:m));let h;for(let m of n){let d=Dd(e,t,a,u,m.side,m.lo,m.hi),A=m.radius>0?Uo(d,m.radius):d;h=h?as(h,A,"normal",1,r):A}return h}var cn=(e,t)=>Math.floor((2*e+t)/(2*t));function Fl(e,t){
|
|
1609
1609
|
let n=t.sub??1,r=typeof n=="number"?{x:Math.max(1,Math.floor(n)),y:Math.max(1,Math.floor(n))}:{x:Math.max(1,Math.floor(n.x)),y:Math.max(1,Math.floor(n.y))},i=Math.max(0,t.cols)*r.x,s=Math.max(0,t.rows)*
|
|
1610
|
-
r.y,a=new Uint8ClampedArray(i*s),u=new Uint8ClampedArray(i*s*4),{width:
|
|
1611
|
-
Math.min(
|
|
1612
|
-
Q<
|
|
1613
|
-
u[_*4+3]=cn(R,S))}}return{cols:t.cols,rows:t.rows,sub:r,luma:a,rgba:u}}function Yl(e,t,n,r,i){let{width:s,height:a,data:u}=e,
|
|
1614
|
-
r)),d=Math.min(a,Math.ceil(i)),A=0,g=0,x=0,v=0,b=0;for(let w=
|
|
1610
|
+
r.y,a=new Uint8ClampedArray(i*s),u=new Uint8ClampedArray(i*s*4),{width:f,height:h,data:m}=e,d=t.cw/r.x,A=t.ch/r.y;for(let g=0;g<s;g++){let x=Math.max(0,Math.min(h,Math.floor(t.y0+g*A))),v=Math.max(x+1,
|
|
1611
|
+
Math.min(h,Math.floor(t.y0+(g+1)*A)));for(let b=0;b<i;b++){let w=Math.max(0,Math.min(f,Math.floor(t.x0+b*d))),P=Math.max(w+1,Math.min(f,Math.floor(t.x0+(b+1)*d))),E=0,T=0,M=0,R=0,S=0;for(let Q=x;Q<v&&
|
|
1612
|
+
Q<h;Q++){let Y=(Q*f+w)*4;for(let G=w;G<P&&G<f;G++,Y+=4)E+=m[Y],T+=m[Y+1],M+=m[Y+2],R+=m[Y+3],S++}let _=g*i+b;S!==0&&(a[_]=cn(2126*E+7152*T+722*M,1e4*S),u[_*4]=cn(E,S),u[_*4+1]=cn(T,S),u[_*4+2]=cn(M,S),
|
|
1613
|
+
u[_*4+3]=cn(R,S))}}return{cols:t.cols,rows:t.rows,sub:r,luma:a,rgba:u}}function Yl(e,t,n,r,i){let{width:s,height:a,data:u}=e,f=Math.max(0,Math.floor(t)),h=Math.max(0,Math.floor(n)),m=Math.min(s,Math.ceil(
|
|
1614
|
+
r)),d=Math.min(a,Math.ceil(i)),A=0,g=0,x=0,v=0,b=0;for(let w=h;w<d;w++){let P=(w*s+f)*4;for(let E=f;E<m;E++,P+=4)A+=u[P],g+=u[P+1],x+=u[P+2],v+=u[P+3],b++}return b===0?{luma:0,rgba:[0,0,0,0],count:0}:
|
|
1615
1615
|
{luma:cn(2126*A+7152*g+722*x,1e4*b),rgba:[cn(A,b),cn(g,b),cn(x,b),cn(v,b)],count:b}}var ml=2048;function Mn(e,t,n){let r=Math.imul(e|0,668265261)^Math.imul(t|0,374761393)^Math.imul(n|0,2654435761);return r^=
|
|
1616
|
-
r>>>15,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,(r>>>0)/4294967296}var
|
|
1617
|
-
a=0,u=r/s;else{let m=r-s,d=Math.floor(m);a=d+1,u=m-d}let
|
|
1618
|
-
Qd=99;function Wl(e,t,n,r=0){let i=(e+t)*
|
|
1619
|
-
x+(x+v)*os,w=
|
|
1620
|
-
min(1,Math.max(0,.5+.5*Qd*A))}function Ld(e,t,n,r,i=0){let s=0,a=1,u=0,
|
|
1621
|
-
function Fd(e,t,n,r=0){let i=Math.floor(e),s=Math.floor(t),a=1/0;for(let u=-1;u<=1;u++)for(let
|
|
1616
|
+
r>>>15,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,(r>>>0)/4294967296}var Od=e=>e*e*(3-2*e);function Al(e,t,n,r){if(r<=0)return Mn(e,t,n);let s=2-Mn(e,t,n+40503),a,u;if(r<s)
|
|
1617
|
+
a=0,u=r/s;else{let m=r-s,d=Math.floor(m);a=d+1,u=m-d}let f=Mn(e,t,n+a*7),h=Mn(e,t,n+(a+1)*7);return f+(h-f)*Od(u)}var yl=Math.cos(.9),gl=Math.sin(.9),Nd=(Math.sqrt(3)-1)/2,os=(3-Math.sqrt(3))/6,qo=.4,
|
|
1618
|
+
Qd=99;function Wl(e,t,n,r=0){let i=(e+t)*Nd,s=Math.floor(e+i),a=Math.floor(t+i),u=(s+a)*os,f=e-(s-u),h=t-(a-u),m=f>h?1:0,d=1-m,A=0;for(let g=0;g<3;g++){let x=g===0?0:g===1?m:1,v=g===0?0:g===1?d:1,b=f-
|
|
1619
|
+
x+(x+v)*os,w=h-v+(x+v)*os,P=.5-b*b-w*w;if(P<=0)continue;let E=s+x,T=a+v,M=Mn(E,T,n)*Math.PI*2;if(r>0){let R=.5+Mn(E,T,n+911);M+=(Mn(E,T,n+1777)<.5?-R:R)*r}P*=P,A+=P*P*(Math.cos(M)*b+Math.sin(M)*w)}return Math.
|
|
1620
|
+
min(1,Math.max(0,.5+.5*Qd*A))}function Ld(e,t,n,r,i=0){let s=0,a=1,u=0,f=e,h=t;for(let m=0;m<r;m++){s+=Wl(f,h,n+m*131,i)*a,u+=a,a*=.5;let d=2*(f*yl-h*gl)+17.3;h=2*(f*gl+h*yl)+41.9,f=d}return u>0?s/u:0}
|
|
1621
|
+
function Fd(e,t,n,r=0){let i=Math.floor(e),s=Math.floor(t),a=1/0;for(let u=-1;u<=1;u++)for(let f=-1;f<=1;f++){let h=i+f,m=s+u,d=h+Al(h,m,n,r),A=m+Al(h,m,n+7919,r),g=(d-e)*(d-e)+(A-t)*(A-t);g<a&&(a=g)}
|
|
1622
1622
|
return Math.min(1,Math.sqrt(a))}function Yd(e,t,n){let r=Math.max(1e-6,e.scale),i=t/r,s=n/r,a=Math.floor(e.seed),u=Math.max(0,e.time);return e.mode==="blocks"?Mn(Math.floor(i),Math.floor(s),a+Math.floor(
|
|
1623
1623
|
u)*7):e.mode==="cells"?Fd(i,s,a,u):e.mode==="fbm"?Ld(i*qo,s*qo,a,Math.max(1,Math.min(8,Math.round(e.octaves))),u):Wl(i*qo,s*qo,a,u)}var Ho=1024;function Wd(e,t){let n=new Uint8ClampedArray(Ho*4),r=Wo(
|
|
1624
|
-
e,t),i=r.map(s=>{let a=ur(s.color);return[parseInt(a.rgb.slice(1,3),16),parseInt(a.rgb.slice(3,5),16),parseInt(a.rgb.slice(5,7),16),a.a]});for(let s=0;s<Ho;s++){let a=s/(Ho-1),u,h,
|
|
1625
|
-
h,
|
|
1626
|
-
x,
|
|
1624
|
+
e,t),i=r.map(s=>{let a=ur(s.color);return[parseInt(a.rgb.slice(1,3),16),parseInt(a.rgb.slice(3,5),16),parseInt(a.rgb.slice(5,7),16),a.a]});for(let s=0;s<Ho;s++){let a=s/(Ho-1),u,f,h,m;if(a<=r[0].at)[u,
|
|
1625
|
+
f,h,m]=i[0];else if(a>=r[r.length-1].at)[u,f,h,m]=i[i.length-1];else{let d=1;for(;d<r.length-1&&r[d].at<a;)d++;let A=r[d-1],g=r[d],x=g.at===A.at?1:(a-A.at)/(g.at-A.at),v=i[d-1],b=i[d];u=v[0]+(b[0]-v[0])*
|
|
1626
|
+
x,f=v[1]+(b[1]-v[1])*x,h=v[2]+(b[2]-v[2])*x,m=v[3]+(b[3]-v[3])*x}n[s*4]=Math.round(u*m),n[s*4+1]=Math.round(f*m),n[s*4+2]=Math.round(h*m),n[s*4+3]=Math.round(m*255)}return n}function Xd(e,t){if(t==="r\
|
|
1627
1627
|
epeat")return e-Math.floor(e);if(t==="reflect"){let n=e-2*Math.floor(e/2);return n<=1?n:2-n}return Math.min(1,Math.max(0,e))}var oo=new Map,Gd=64;function Xl(e,t){let n=JSON.stringify([e,t.x,t.y,t.w,t.
|
|
1628
1628
|
h]),r=oo.get(n);if(r)return r;let i=Pn(e.stops),s=e.kind==="noise"&&e.mode==="blocks",a=s?Math.max(1e-6,e.scale):1,u=s?a:1/Math.min(1,Math.max(1/64,e.kind==="noise"?e.detail??1:1));u=Math.max(u,Math.ceil(
|
|
1629
|
-
t.w)/ml,Math.ceil(t.h)/ml);let
|
|
1630
|
-
x=s?u:t.h/d;
|
|
1631
|
-
kind==="conic"?e.cx:0)*t.w,R=t.y+(e.kind==="conic"?e.cy:0)*t.h,S=e.kind==="conic"?e.angle:0;for(let _=0;_<b;_++){let Q=
|
|
1629
|
+
t.w)/ml,Math.ceil(t.h)/ml);let f=s?Math.floor(t.x/u)*u:t.x,h=s?Math.floor(t.y/u)*u:t.y,m=Math.max(1,Math.ceil((t.x+t.w-f)/u-1e-9)),d=Math.max(1,Math.ceil((t.y+t.h-h)/u-1e-9)),A=!s&&u>1?1:0,g=s?u:t.w/m,
|
|
1630
|
+
x=s?u:t.h/d;f-=A*g,h-=A*x;let v=m+2*A,b=d+2*A,w=new Uint8ClampedArray(v*b*4),E={texture:{width:v,height:b,data:w},x:f-t.x,y:h-t.y,w:v*g,h:b*x,nearest:s};if(i.length>=2){let T=Wd(i,e.stepped),M=t.x+(e.
|
|
1631
|
+
kind==="conic"?e.cx:0)*t.w,R=t.y+(e.kind==="conic"?e.cy:0)*t.h,S=e.kind==="conic"?e.angle:0;for(let _=0;_<b;_++){let Q=h+(_+.5)*x;for(let Y=0;Y<v;Y++){let G=f+(Y+.5)*g,q;e.kind==="conic"?(q=(Math.atan2(
|
|
1632
1632
|
Q-R,G-M)*180/Math.PI-S)/360,q-=Math.floor(q)):q=Yd(e,G,Q);let X=Math.round(Xd(q,e.spread)*(Ho-1))*4,te=(_*v+Y)*4;w[te]=T[X],w[te+1]=T[X+1],w[te+2]=T[X+2],w[te+3]=T[X+3]}}}return oo.size>=Gd&&oo.delete(
|
|
1633
|
-
oo.keys().next().value),oo.set(n,E),E}var Wu=Ur(io(),1);var In=Ur(io(),1),
|
|
1633
|
+
oo.keys().next().value),oo.set(n,E),E}var Wu=Ur(io(),1);var In=Ur(io(),1),Nt=Ur(Gl(),1);var $u=Ur(io(),1);var so=[{family:"IBM Plex Mono",weight:400,style:"normal",file:"ibm-plex-mono-400"},{family:"IBM Plex Mono",weight:600,style:"normal",file:"ibm-plex-mono-600"},{family:"IBM Plex Mono",weight:700,style:"\
|
|
1634
1634
|
normal",file:"ibm-plex-mono-700"},{family:"JetBrains Mono",weight:400,style:"normal",file:"jetbrains-mono-400"},{family:"JetBrains Mono",weight:700,style:"normal",file:"jetbrains-mono-700"},{family:"R\
|
|
1635
1635
|
ajdhani",weight:400,style:"normal",file:"rajdhani-400"},{family:"Rajdhani",weight:600,style:"normal",file:"rajdhani-600"},{family:"Rajdhani",weight:700,style:"normal",file:"rajdhani-700"},{family:"Int\
|
|
1636
1636
|
er",weight:400,style:"normal",file:"inter-400"},{family:"Inter",weight:600,style:"normal",file:"inter-600"},{family:"Inter",weight:700,style:"normal",file:"inter-700"},{family:"Inter",weight:900,style:"\
|
|
@@ -1640,13 +1640,13 @@ normal",file:"silkscreen-400",pixelSize:8},{family:"Silkscreen",weight:700,style
|
|
|
1640
1640
|
pixelSize:8},{family:"Symbols Nerd Font Mono",weight:400,style:"normal",file:"symbols-nerd-font-mono-400",lazy:!0},{family:"Noto Sans Symbols 2",weight:400,style:"normal",file:"noto-sans-symbols-2-400",
|
|
1641
1641
|
lazy:!0},{family:"Fixed 4x6",weight:400,style:"normal",file:"fixed-4x6",pixelSize:6,bitmap:!0,lazy:!0},{family:"Fixed 5x7",weight:400,style:"normal",file:"fixed-5x7",pixelSize:7,bitmap:!0,lazy:!0},{family:"\
|
|
1642
1642
|
Fixed 5x8",weight:400,style:"normal",file:"fixed-5x8",pixelSize:8,bitmap:!0,lazy:!0},{family:"Fixed 6x10",weight:400,style:"normal",file:"fixed-6x10",pixelSize:10,bitmap:!0,lazy:!0},{family:"Fixed 6x1\
|
|
1643
|
-
3",weight:700,style:"normal",file:"fixed-6x13-bold",pixelSize:13,bitmap:!0,lazy:!0}],_n="IBM Plex Mono",Tn=[...new Set(so.map(e=>e.family))];function ql(e){return Tn.includes(e)}var cs=[];function Hl(){return cs.map(e=>e.face)}function Rn(){return cs.length===0?so:[...so,...Hl()]}function
|
|
1644
|
-
function Ul(e){return ql(e)||$l(e)}function bt(e){return e&&Ul(e)?{family:e,wasSubstituted:!1}:{family:_n,wasSubstituted:!!e}}function ao(e){return e.axes?.find(t=>t.tag==="wght")}function
|
|
1645
|
-
return Rn().find(t=>t.family===e&&(t.axes?.length??0)>0)}function bn(e){let t=lo(e),n=t&&ao(t);return n?{min:n.min,max:n.max}:void 0}function
|
|
1646
|
-
void 0}function vn(e){return Rn().find(t=>t.family===e&&t.pixelSize!==void 0)?.pixelSize}function uo(e){return Rn().some(t=>t.family===e&&t.bitmap)}function
|
|
1643
|
+
3",weight:700,style:"normal",file:"fixed-6x13-bold",pixelSize:13,bitmap:!0,lazy:!0}],_n="IBM Plex Mono",Tn=[...new Set(so.map(e=>e.family))];function ql(e){return Tn.includes(e)}var cs=[];function Hl(){return cs.map(e=>e.face)}function Rn(){return cs.length===0?so:[...so,...Hl()]}function fr(){return[...new Set(Rn().map(e=>e.family))]}function $l(e){return cs.some(t=>t.face.family===e)}
|
|
1644
|
+
function Ul(e){return ql(e)||$l(e)}function bt(e){return e&&Ul(e)?{family:e,wasSubstituted:!1}:{family:_n,wasSubstituted:!!e}}function ao(e){return e.axes?.find(t=>t.tag==="wght")}function fs(e){return e.axes?.find(t=>t.tag==="wdth")}function lo(e){
|
|
1645
|
+
return Rn().find(t=>t.family===e&&(t.axes?.length??0)>0)}function bn(e){let t=lo(e),n=t&&ao(t);return n?{min:n.min,max:n.max}:void 0}function hr(e){let t=lo(e),n=t&&fs(t);return n?{min:n.min,max:n.max}:
|
|
1646
|
+
void 0}function vn(e){return Rn().find(t=>t.family===e&&t.pixelSize!==void 0)?.pixelSize}function uo(e){return Rn().some(t=>t.family===e&&t.bitmap)}function fn(e,t){let n=hr(e);return n?Math.round(Math.min(n.max,Math.max(n.min,t))):100}var zl=[100,200,300,400,500,600,700,800,900];function Ot(e,t){let n=lo(e),r=n&&ao(n);if(r)return Math.round(Math.
|
|
1647
1647
|
min(r.max,Math.max(r.min,t)));let i=Rn().filter(s=>s.family===e).map(s=>s.weight);return i.length===0?400:i.reduce((s,a)=>Math.abs(a-t)<Math.abs(s-t)?a:s)}function Dn(e){let t=lo(e),n=t&&ao(t);return n?
|
|
1648
|
-
zl.filter(r=>r>=n.min&&r<=n.max):[...new Set(Rn().filter(r=>r.family===e).map(r=>r.weight))]}function
|
|
1649
|
-
return ao(s)&&(u.wght=i),
|
|
1648
|
+
zl.filter(r=>r>=n.min&&r<=n.max):[...new Set(Rn().filter(r=>r.family===e).map(r=>r.weight))]}function hs(e,t,n=100){let r=bt(e).family,i=Ot(r,t),s=lo(r);if(s){let u={};for(let f of s.axes)u[f.tag]=f.default;
|
|
1649
|
+
return ao(s)&&(u.wght=i),fs(s)&&(u.wdth=fn(r,n)),{face:s,variation:u}}return{face:Rn().find(u=>u.family===r&&u.weight===i)??so[0]}}var pc=Ur(io(),1);var qd=-90,yr=e=>e+qd,vo="0 = 12 o\u2019clock, 90 = 3 o\u2019clock, clockwise round the dial.",Hd=["auto","corner","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],ps={
|
|
1650
1650
|
corner:{fx:0,fy:0},top:{fx:.5,fy:0},"top-right":{fx:1,fy:0},left:{fx:0,fy:.5},center:{fx:.5,fy:.5},right:{fx:1,fy:.5},"bottom-left":{fx:0,fy:1},bottom:{fx:.5,fy:1},"bottom-right":{fx:1,fy:1}},Qn={key:"\
|
|
1651
1651
|
anchor",label:"Anchor",type:"enum",default:"auto",widget:"anchor",options:[{value:"auto",label:"Auto (canvas)"},{value:"corner",label:"Top Left"},{value:"top",label:"Top"},{value:"top-right",label:"To\
|
|
1652
1652
|
p Right"},{value:"left",label:"Left"},{value:"center",label:"Centre"},{value:"right",label:"Right"},{value:"bottom-left",label:"Bottom Left"},{value:"bottom",label:"Bottom"},{value:"bottom-right",label:"\
|
|
@@ -1662,27 +1662,27 @@ rx",label:"Corner Size",type:"number",default:0,min:0,step:.5,unit:"px"},{key:"c
|
|
|
1662
1662
|
key:"chBR",label:"BR",type:"bool",default:!0,group:"Corners"},{key:"chBL",label:"BL",type:"bool",default:!0,group:"Corners"},{key:"strokeAlign",label:"Stroke Align",type:"enum",default:"center",options:[
|
|
1663
1663
|
{value:"center",label:"Center"},{value:"inside",label:"Inside"},{value:"outside",label:"Outside"}],group:"Style",description:"Where the stroke sits on the outline: inside keeps the drawn size exact, o\
|
|
1664
1664
|
utside grows around it. Geometry-true, so booleans and outlines follow."},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},Qn,...Ge],cook(e){let t=e.enumOf("strokeAlign",["c\
|
|
1665
|
-
enter","inside","outside"]),n=t==="center"?0:(t==="inside"?-1:1)*(e.style().strokeWidth??0),r=e.num("w"),i=e.num("h"),{dx:s,dy:a}=Ln(e,r,i),u=Math.max(0,r+n),
|
|
1666
|
-
"y")+a-n/2,d=e.num("rotation"),A=d===0?be:Dr(d,
|
|
1667
|
-
bool("chBL")},b=v.tl||v.tr||v.br||v.bl,w=v.tl&&v.tr&&v.br&&v.bl;if(g<=0||!b||x==="round"&&w){let M={id:e.shapeId(0),kind:"rect",x:
|
|
1665
|
+
enter","inside","outside"]),n=t==="center"?0:(t==="inside"?-1:1)*(e.style().strokeWidth??0),r=e.num("w"),i=e.num("h"),{dx:s,dy:a}=Ln(e,r,i),u=Math.max(0,r+n),f=Math.max(0,i+n),h=e.num("x")+s-n/2,m=e.num(
|
|
1666
|
+
"y")+a-n/2,d=e.num("rotation"),A=d===0?be:Dr(d,h+u/2,m+f/2),g=Math.min(e.num("rx"),Math.min(u,f)/2),x=e.enumOf("corner",["round","chamfer"]),v={tl:e.bool("chTL"),tr:e.bool("chTR"),br:e.bool("chBR"),bl:e.
|
|
1667
|
+
bool("chBL")},b=v.tl||v.tr||v.br||v.bl,w=v.tl&&v.tr&&v.br&&v.bl;if(g<=0||!b||x==="round"&&w){let M={id:e.shapeId(0),kind:"rect",x:h,y:m,w:u,h:f,rx:g>0&&w?g:0,style:e.style(),transform:A,meta:e.meta(0)};
|
|
1668
1668
|
return{out:z([M])}}let P=24,E=(M,R,S,_,Q,Y)=>{if(!_)return[{x:M,y:R}];let G=M-Q*g,q=R-Y*g;if(x==="chamfer")return[S===180?{x:M,y:q}:S===270?{x:G,y:R}:S===0?{x:M,y:q}:{x:G,y:R},S===180?{x:G,y:R}:S===270?
|
|
1669
1669
|
{x:M,y:q}:S===0?{x:G,y:R}:{x:M,y:q}];let X=[];for(let te=0;te<=P;te++){let ce=(S+te/P*90)*Math.PI/180;X.push({x:G+g*Math.cos(ce),y:q+g*Math.sin(ce)})}return X},T={id:e.shapeId(0),kind:"polyline",points:[
|
|
1670
|
-
...E(
|
|
1670
|
+
...E(h,m,180,v.tl,-1,-1),...E(h+u,m,270,v.tr,1,-1),...E(h+u,m+f,0,v.br,1,1),...E(h,m+f,90,v.bl,-1,1)],closed:!0,style:e.style(),transform:A,meta:e.meta(0)};return{out:z([T])}}},jd={type:"circle",label:"\
|
|
1671
1671
|
Circle",category:"generator",translate:[{x:"cx",y:"cy"}],description:"A circle, or an arc when the sweep is less than a full turn.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"\
|
|
1672
1672
|
Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"r",label:"Radius",type:"number",default:60,min:0,step:.5,unit:"px"},{key:"\
|
|
1673
1673
|
start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:vo},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg"},{key:"ry",label:"Radius Y",type:"\
|
|
1674
1674
|
number",default:0,min:0,step:.5,unit:"px",description:"Stretch into an ellipse: Radius becomes X. 0 = circle. An ellipse ignores Start and Sweep."},{key:"strokeAlign",label:"Stroke Align",type:"enum",
|
|
1675
1675
|
default:"center",options:[{value:"center",label:"Center"},{value:"inside",label:"Inside"},{value:"outside",label:"Outside"}],group:"Style",description:"Where the stroke sits on the outline: inside kee\
|
|
1676
1676
|
ps the drawn size exact, outside grows around it. Geometry-true, so booleans and outlines follow."},...Ge],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.enumOf("strokeAlign",["center","inside","outside"]),
|
|
1677
|
-
i=r==="center"?0:(r==="inside"?-1:1)*(e.style().strokeWidth??0)/2,s=Math.max(0,e.num("r")+i),a=e.num("ry"),u=a>0?Math.max(0,a+i):a,
|
|
1677
|
+
i=r==="center"?0:(r==="inside"?-1:1)*(e.style().strokeWidth??0)/2,s=Math.max(0,e.num("r")+i),a=e.num("ry"),u=a>0?Math.max(0,a+i):a,f=yr(e.num("start")),h=e.num("sweep"),m=Math.abs(h)>=360;if(a>0&&a!==
|
|
1678
1678
|
e.num("r")){let A={id:e.shapeId(0),kind:"ellipse",cx:t,cy:n,rx:s,ry:u,style:e.style(),transform:be,meta:e.meta(0)};return{out:z([A])}}let d=m?{id:e.shapeId(0),kind:"circle",cx:t,cy:n,r:s,style:e.style(),
|
|
1679
|
-
transform:be,meta:e.meta(0)}:{id:e.shapeId(0),kind:"arc",cx:t,cy:n,r:s,a0:
|
|
1679
|
+
transform:be,meta:e.meta(0)}:{id:e.shapeId(0),kind:"arc",cx:t,cy:n,r:s,a0:f,a1:f+h,style:e.style(),transform:be,meta:e.meta(0)};return{out:z([d])}}},Vd={type:"line",label:"Line",category:"generator",description:"\
|
|
1680
1680
|
A straight stroke from (X1, Y1) to (X2, Y2).",translate:[{x:"x1",y:"y1"},{x:"x2",y:"y2"}],inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x1",label:"X1",type:"number",default:0,step:.5,unit:"\
|
|
1681
1681
|
px"},{key:"y1",label:"Y1",type:"number",default:0,step:.5,unit:"px"},{key:"x2",label:"X2",type:"number",default:100,step:.5,unit:"px"},{key:"y2",label:"Y2",type:"number",default:0,step:.5,unit:"px"},...Ge],
|
|
1682
1682
|
cook(e){let t={id:e.shapeId(0),kind:"polyline",points:[{x:e.num("x1"),y:e.num("y1")},{x:e.num("x2"),y:e.num("y2")}],closed:!1,style:e.style(),transform:be,meta:e.meta(0)};return{out:z([t])}}},Zd=[zd,jd,
|
|
1683
1683
|
Vd],Jd=/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*?)\/?>/g,Kd=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,em=/<(defs|clipPath|mask|symbol|style)\b[^>]*>[\s\S]*?<\/\1>/g;
|
|
1684
1684
|
function tm(e){let t=e.replace(em,""),n=[];for(let r of t.matchAll(Jd)){let i={};for(let s of r[2].matchAll(Kd))i[s[1]]=s[2]??s[3]??"";n.push({tag:r[1],attrs:i})}return n}function nm(e){let t=/viewBox\s*=\s*["']\s*([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)/.
|
|
1685
|
-
exec(e);if(t){let[s,a,u,
|
|
1685
|
+
exec(e);if(t){let[s,a,u,f]=[Number(t[1]),Number(t[2]),Number(t[3]),Number(t[4])];if(u>0&&f>0)return{x:s,y:a,w:u,h:f}}let n=s=>{let a=new RegExp(`<svg[^>]*\\b${s}\\s*=\\s*["']([\\d.]+)`).exec(e);return a?
|
|
1686
1686
|
Number(a[1]):0},r=n("width"),i=n("height");return r>0&&i>0?{x:0,y:0,w:r,h:i}:{x:0,y:0,w:24,h:24}}var pt=(e,t=0)=>{let n=Number(e);return Number.isFinite(n)?n:t};function rm(e){let t={fill:e.fill===void 0||
|
|
1687
1687
|
e.fill.startsWith("url(")?"#000000":e.fill,stroke:e.stroke??"none"};e["stroke-width"]!==void 0?t.strokeWidth=pt(e["stroke-width"],1):t.stroke!=="none"&&(t.strokeWidth=1);let n=pt(e.opacity,1);return n!==
|
|
1688
1688
|
1&&(t.opacity=n),t}function om(e){let t=(e.match(/-?(?:\d+\.?\d*|\.\d+)(?:[eE]-?\d+)?/g)??[]).map(Number),n=[];for(let r=0;r+1<t.length;r+=2)n.push({x:t[r],y:t[r+1]});return n}var im={type:"svg",label:"\
|
|
@@ -1690,11 +1690,11 @@ SVG",category:"generator",translate:[{x:"x",y:"y"}],description:"Paste SVG marku
|
|
|
1690
1690
|
out",type:"shapes"}],params:[{key:"svg",label:"Markup",type:"string",default:"",multiline:!0,exposable:!1,description:"The <svg>\u2026</svg> text, pasted whole."},{key:"x",label:"X",type:"number",default:0,
|
|
1691
1691
|
step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"size",label:"Size",type:"number",default:64,min:0,max:4096,step:1,unit:"px",description:"Target height; the icon \
|
|
1692
1692
|
is centred on X/Y. 0 keeps native coordinates."},{key:"keepStyle",label:"Source Style",type:"bool",default:!1,description:"Use the fills and strokes from the pasted markup instead of this node\u2019s style\
|
|
1693
|
-
."},...Ge],cook(e){let t=e.str("svg"),n=tm(t),r=n.length;if(r===0)return{out:z([])};let i=nm(t),s=e.num("size"),a=s>0?s/i.h:1,u=[a,0,0,a,e.num("x")-a*(i.x+i.w/2),e.num("y")-a*(i.y+i.h/2)],
|
|
1694
|
-
epStyle"),
|
|
1695
|
-
break;case"rect":
|
|
1696
|
-
lipse":
|
|
1697
|
-
break;case"polyline":case"polygon":{let x=om(A.points??"");x.length>=2&&
|
|
1693
|
+
."},...Ge],cook(e){let t=e.str("svg"),n=tm(t),r=n.length;if(r===0)return{out:z([])};let i=nm(t),s=e.num("size"),a=s>0?s/i.h:1,u=[a,0,0,a,e.num("x")-a*(i.x+i.w/2),e.num("y")-a*(i.y+i.h/2)],f=e.bool("ke\
|
|
1694
|
+
epStyle"),h=[];for(let[m,d]of n.entries()){let A=d.attrs,g={id:e.shapeId(m),style:f?rm(A):e.style(m,r),transform:u,meta:e.meta(m,["svg"])};switch(d.tag){case"path":A.d&&h.push({...g,kind:"path",d:A.d});
|
|
1695
|
+
break;case"rect":h.push({...g,kind:"rect",x:pt(A.x),y:pt(A.y),w:pt(A.width),h:pt(A.height),rx:pt(A.rx)});break;case"circle":h.push({...g,kind:"circle",cx:pt(A.cx),cy:pt(A.cy),r:pt(A.r)});break;case"el\
|
|
1696
|
+
lipse":h.push({...g,kind:"ellipse",cx:pt(A.cx),cy:pt(A.cy),rx:pt(A.rx),ry:pt(A.ry)});break;case"line":h.push({...g,kind:"polyline",points:[{x:pt(A.x1),y:pt(A.y1)},{x:pt(A.x2),y:pt(A.y2)}],closed:!1});
|
|
1697
|
+
break;case"polyline":case"polygon":{let x=om(A.points??"");x.length>=2&&h.push({...g,kind:"polyline",points:x,closed:d.tag==="polygon"});break}}}return{out:z(h)}}};function Lu(e,t){let n=e.assets[t];if(!n)
|
|
1698
1698
|
throw new Error(`no image \u201C${t.slice(0,8)}\u2026\u201D in this document \u2014 drop the file on the graph again, or choose another`);let r=e.asset?.(t);if(!r)throw new Error(`the bytes of \u201C${n.
|
|
1699
1699
|
name}\u201D are not on this machine \u2014 drop the file on the graph to restore them (the CLI reads them from the project\u2019s .assets folder)`);return{record:n,href:r}}var sm={},Fu=[{value:"stretc\
|
|
1700
1700
|
h",label:"Stretch"},{value:"contain",label:"Contain"},{value:"cover",label:"Cover"}];function Yu(e,t,n,r,i){if(i==="stretch")return[n,r];let s=i==="contain"?Math.min(n/e,r/t):Math.max(n/e,r/t);return[
|
|
@@ -1717,9 +1717,9 @@ cture\u2019s centre."},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"
|
|
|
1717
1717
|
set");if(t==="")return sm;let{record:n,href:r}=Lu(e,t);if(!e.rasterize)throw new Error("no rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let i=e.num("x"),s=e.
|
|
1718
1718
|
num("y"),a=(v,b,w,P)=>({kind:"image",id:e.shapeId(0),x:v,y:b,w,h:P,href:r,style:{...Qo,stroke:"none",fill:"none",opacity:e.num("opacity")},transform:[1,0,0,1,0,0],meta:e.meta(0,["image"])}),u=(v,b,w,P)=>({
|
|
1719
1719
|
width:v,height:b,origin:w,background:"none",layers:[{id:e.nodeId,name:"picture",opacity:1,visible:!0,order:0,shapes:[P]}]});if(e.enumOf("size",["canvas","native"])==="native"){let{width:v,height:b}=n,
|
|
1720
|
-
w={x:Math.round(i-v/2),y:Math.round(s-b/2)},P=e.rasterize(u(v,b,"top-left",a(0,0,v,b)),w);return{out:Ye(P.at?P:{...P,at:w})}}let
|
|
1721
|
-
to fill \u2014 give the project a canvas");let[m,d]=Yu(n.width,n.height,h,
|
|
1722
|
-
m/2,g+s-d/2,m,d);return{out:Ye(e.rasterize(u(h,
|
|
1720
|
+
w={x:Math.round(i-v/2),y:Math.round(s-b/2)},P=e.rasterize(u(v,b,"top-left",a(0,0,v,b)),w);return{out:Ye(P.at?P:{...P,at:w})}}let f=e.canvas.w,h=e.canvas.h;if(f<=0||h<=0)throw new Error("has no canvas \
|
|
1721
|
+
to fill \u2014 give the project a canvas");let[m,d]=Yu(n.width,n.height,f,h,e.enumOf("fit",["stretch","contain","cover"])),A=e.canvas.origin==="center"?0:f/2,g=e.canvas.origin==="center"?0:h/2,x=a(A+i-
|
|
1722
|
+
m/2,g+s-d/2,m,d);return{out:Ye(e.rasterize(u(f,h,e.canvas.origin,x)))}}},jl={};function um(e,t,n,r){if(n<=0)return;let i=Math.floor((e*r.speed+r.inPoint)*t+1e-6);if(r.loop==="repeat")return(i%n+n)%n;if(r.
|
|
1723
1723
|
loop==="pingpong"){let s=Math.max(1,2*n-2),a=(i%s+s)%s;return a<n?a:s-a}return i<0?0:i>=n?r.after==="hold"?n-1:void 0:i}var cm={type:"video",label:"Video",category:"post",description:"A video file\u2019s f\
|
|
1724
1724
|
rame for the current time, as a texture for the post chain \u2014 ProRes, DNxHD, H.264, whatever ffmpeg reads. Drop a video on the graph to make one. The file stays beside the document; only its name and t\
|
|
1725
1725
|
iming are saved. No audio.",inputs:[],outputs:[{name:"out",type:"texture"}],timeRoot:!0,params:[{key:"asset",label:"File",type:"string",default:"",exposable:!1,asset:!0,description:"Which of the docum\
|
|
@@ -1735,29 +1735,29 @@ t \u2014 drop the file on the graph again, or choose another`);if(!n.video)throw
|
|
|
1735
1735
|
"no video decoder available here \u2014 the preview loads one on demand; exports always have one");let r={inPoint:e.num("in"),speed:e.num("speed"),loop:e.enumOf("loop",["off","repeat","pingpong"]),after:e.
|
|
1736
1736
|
enumOf("after",["hold","none"])},i=um(e.t,n.video.fps,n.video.frames,r);if(i===void 0)return jl;let s=e.enumOf("size",["native","canvas"])==="canvas",a=n.width,u=n.height;if(s){let x=e.canvas.w,v=e.canvas.
|
|
1737
1737
|
h;if(x<=0||v<=0)throw new Error("has no canvas to fill \u2014 give the project a canvas");let b=e.enumOf("fit",["stretch","contain","cover"]),w=b==="contain"?Math.min(x/a,v/u):Math.max(x/a,v/u);a=Math.
|
|
1738
|
-
max(1,Math.round(b==="stretch"?x:a*w)),u=Math.max(1,Math.round(b==="stretch"?v:u*w))}let
|
|
1739
|
-
e.num("x")-a/2),y:Math.round(
|
|
1738
|
+
max(1,Math.round(b==="stretch"?x:a*w)),u=Math.max(1,Math.round(b==="stretch"?v:u*w))}let f=s&&e.canvas.origin!=="center"?e.canvas.w/2:0,h=s&&e.canvas.origin!=="center"?e.canvas.h/2:0,m={x:Math.round(f+
|
|
1739
|
+
e.num("x")-a/2),y:Math.round(h+e.num("y")-u/2)},d=e.video(t,i,m),A=d&&d!=="loading"&&(a!==d.width||u!==d.height)?jo(d,a,u):d;if(A==="loading")throw new Error("the video decoder is still loading \u2014 a mo\
|
|
1740
1740
|
ment");if(!A)throw new Error(`the bytes of \u201C${n.name}\u201D are not on this machine \u2014 drop the file on the graph to restore them (the CLI reads them from the project\u2019s .assets folder)`);
|
|
1741
1741
|
let g=A.at&&A.at.x===m.x&&A.at.y===m.y?A:{...A,at:m};return{out:Ye(g)}}},Vl=["union","subtract","intersect","exclude"],Gr=e=>Math.round(e*1e3)/1e3;function mr(e){let t=[];for(let n of e){let r=[],i=n.
|
|
1742
|
-
style.fill!==void 0&&n.style.fill!=="none";for(let
|
|
1743
|
-
1)%m.length];d+=g*b-v*x}r.push({ring:m,pts:
|
|
1744
|
-
for(let
|
|
1745
|
-
s)});return t}function Gu(e){return
|
|
1746
|
-
e);if(i.length===0)return[];let s=new
|
|
1747
|
-
EndType.etClosedPolygon);let u=new
|
|
1748
|
-
stroke!==void 0&&r.style.stroke!=="none")||i.length===0){n.push(...i);continue}let u=r.style.strokeLinejoin,
|
|
1749
|
-
let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],[s,a]=e[(n+1)%e.length];t+=r*a-s*i}return t/2}function yo(e){if(e.length===0)return[];let t=Xu(e);if(t.length===0)return[];let n=new
|
|
1750
|
-
n.AddPaths(t,
|
|
1751
|
-
function
|
|
1742
|
+
style.fill!==void 0&&n.style.fill!=="none";for(let h of et(n)){if(!(h.closed||i)||h.points.length<3)continue;let m=h.points.map(A=>[Gr(A.x),Gr(A.y)]),d=0;for(let A=0;A<m.length;A++){let[g,x]=m[A],[v,b]=m[(A+
|
|
1743
|
+
1)%m.length];d+=g*b-v*x}r.push({ring:m,pts:h.points,area:d/2})}if(r.length===0)continue;let s=r.reduce((h,m)=>h+m.area,0)>=0,a=r.filter(h=>h.area>=0===s),u=r.filter(h=>h.area>=0!==s),f=a.map(h=>[h.ring]);
|
|
1744
|
+
for(let h of u){let m=h.pts[0],d=-1,A=1/0;a.forEach((g,x)=>{Math.abs(g.area)<A&&Lo(m,g.pts)&&(A=Math.abs(g.area),d=x)}),d>=0?f[d].push(h.ring):f.push([h.ring])}t.push(...f)}return t}var qr=1e3;function Xu(e){let t=[];for(let n of e)n.forEach((r,i)=>{if(r.length<3)return;let s=r.map(([u,f])=>({X:Math.round(u*qr),Y:Math.round(f*qr)})),a=hm(r);(i===0&&a<0||i>0&&a>0)&&s.reverse(),t.push(
|
|
1745
|
+
s)});return t}function Gu(e){return Nt.default.JS.PolyTreeToExPolygons(e).map(t=>[t.outer,...t.holes].map(n=>n.map(r=>[r.X/qr,r.Y/qr])))}var fm=["round","miter","square"];function qu(e,t,n,r=4){let i=Xu(
|
|
1746
|
+
e);if(i.length===0)return[];let s=new Nt.default.ClipperOffset(r,.25*qr),a=n==="round"?Nt.default.JoinType.jtRound:n==="miter"?Nt.default.JoinType.jtMiter:Nt.default.JoinType.jtSquare;s.AddPaths(i,a,Nt.default.
|
|
1747
|
+
EndType.etClosedPolygon);let u=new Nt.default.PolyTree;return s.Execute(u,t*qr),Gu(u)}function Zl(e,t){if(!t)return mr(e);let n=[];for(let r of e){let i=mr([r]),s=r.style.strokeWidth??0;if(!(s>0&&r.style.
|
|
1748
|
+
stroke!==void 0&&r.style.stroke!=="none")||i.length===0){n.push(...i);continue}let u=r.style.strokeLinejoin,f=u==="round"?"round":u==="bevel"?"square":"miter";n.push(...qu(i,s/2,f))}return n}function hm(e){
|
|
1749
|
+
let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],[s,a]=e[(n+1)%e.length];t+=r*a-s*i}return t/2}function yo(e){if(e.length===0)return[];let t=Xu(e);if(t.length===0)return[];let n=new Nt.default.Clipper;
|
|
1750
|
+
n.AddPaths(t,Nt.default.PolyType.ptSubject,!0);let r=new Nt.default.PolyTree;return n.Execute(Nt.default.ClipType.ctUnion,r,Nt.default.PolyFillType.pftNonZero,Nt.default.PolyFillType.pftNonZero),Gu(r)}
|
|
1751
|
+
function Nn(e){let t=[];for(let n of e)for(let r of n){if(r.length<3)continue;let i=r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]?r.slice(0,-1):r;t.push(`M ${i.map(([s,a])=>`${Gr(s)} ${Gr(a)}`).
|
|
1752
1752
|
join(" L ")} Z`)}return t.join(" ")}var pm={type:"slice",label:"Slice",category:"modifier",translate:[{x:"x",y:"y"}],description:"Cut every shape along a line, leaving a gap \u2014 the detached-corner move\
|
|
1753
1753
|
. Each shape keeps its own style; both pieces stay one shape.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"anchor",label:"Anchor",type:"enum",default:"shape",
|
|
1754
1754
|
options:[{value:"shape",label:"Shape centre"},{value:"canvas",label:"Canvas origin"}],description:"What X/Y measure from. Shape centre keeps the cut with the shape as it moves; old documents were canv\
|
|
1755
1755
|
as-anchored and stay that way."},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",description:"A point the cut line passes through, measured from the Anchor."},{key:"y",label:"Y",type:"num\
|
|
1756
1756
|
ber",default:0,step:.5,unit:"px"},{key:"angle",label:"Angle",type:"number",default:45,step:1,unit:"deg"},{key:"gap",label:"Gap",type:"number",default:6,min:0,step:.5,unit:"px"}],cook(e){let t=e.shapes(
|
|
1757
1757
|
"in"),n=e.num("gap");if(n<=0)return{out:z(t)};let r=e.enumOf("anchor",["shape","canvas"])==="shape",i=e.num("angle")*Math.PI/180,s={x:Math.cos(i),y:Math.sin(i)},a={x:-Math.sin(i),y:Math.cos(i)},u=t.map(
|
|
1758
|
-
(h
|
|
1758
|
+
(f,h)=>{let m=mr([f]);if(m.length===0)return f;let d=r?$e(f):void 0,A=d?Ue(d):{x:0,y:0},g=A.x+e.num("x",h,t.length),x=A.y+e.num("y",h,t.length),v=1;for(let M of m)for(let[R,S]of M[0])v=Math.max(v,Math.
|
|
1759
1759
|
hypot(R-g,S-x));let b=v+n,w=n/2,P=[[[g+s.x*b+a.x*w,x+s.y*b+a.y*w],[g+s.x*b-a.x*w,x+s.y*b-a.y*w],[g-s.x*b-a.x*w,x-s.y*b-a.y*w],[g-s.x*b+a.x*w,x-s.y*b+a.y*w]].map(M=>[Gr(M[0]),Gr(M[1])])],E=In.default.difference(
|
|
1760
|
-
In.default.union(m[0],...m.slice(1)),P),T=
|
|
1760
|
+
In.default.union(m[0],...m.slice(1)),P),T=Nn(E);return T?{id:e.shapeId(h,"slice"),kind:"path",d:T,style:{...f.style},transform:be,meta:{...f.meta,index:h}}:f});return{out:z(u)}}},dm={type:"boolean",label:"\
|
|
1761
1761
|
Boolean",category:"modifier",description:'Combine closed outlines: union, subtract, intersect or exclude the "with" input. Nothing wired into "with" merges the input with itself. "rest" is the offcut:\
|
|
1762
1762
|
the part of the input the operation removed.',keywords:["union","weld","fuse","subtract","intersect","exclude","clip","offcut","remainder"],inputs:[{name:"in",type:"shapes"},{name:"with",type:"shapes"}],
|
|
1763
1763
|
outputs:[{name:"out",type:"shapes"},{name:"rest",type:"shapes",label:"rest"}],params:[{key:"op",label:"Operation",type:"enum",default:"subtract",options:Vl.map(e=>({value:e,label:e[0].toUpperCase()+e.
|
|
@@ -1766,8 +1766,8 @@ eStroke",label:"Include Stroke",type:"bool",default:!1,description:"Count each i
|
|
|
1766
1766
|
on the edge you see rather than the geometry underneath. Flips on by itself when stroked text is wired in. Open strokes (lines, arcs) need Outline Stroke first."},...Ge],cook(e){let t=e.bool("includeS\
|
|
1767
1767
|
troke"),n=Zl(e.shapes("in"),t);if(n.length===0)return{out:z([]),rest:z([])};let r=Zl(e.shapes("with"),t),i=e.enumOf("op",Vl),s=yo(n),a,u=[];if(r.length===0)a=s;else{let m=yo(r);a=i==="union"?In.default.
|
|
1768
1768
|
union(s,m):i==="subtract"?In.default.difference(s,m):i==="intersect"?In.default.intersection(s,m):In.default.xor(s,m),u=i==="union"?[]:i==="intersect"?In.default.difference(s,m):In.default.intersection(
|
|
1769
|
-
s,m)}let
|
|
1770
|
-
out:z(
|
|
1769
|
+
s,m)}let f=e.bool("keepStyle")?{...e.shapes("in")[0]?.style??e.style()}:e.style(),h=(m,d,A)=>{let g=Nn(m);return g?[{id:e.shapeId(d,A),kind:"path",d:g,style:{...f},transform:be,meta:e.meta(d)}]:[]};return{
|
|
1770
|
+
out:z(h(a,0)),rest:z(h(u,0,"rest"))}}},mm=["hazard","chevron"],hn=e=>Math.round(e*1e3)/1e3;function Hu(e){return J(e.pattern).base==="chevron"}function Am(e){return!Hu(e)}var ym=Ge.map(e=>e.type==="co\
|
|
1771
1771
|
lor"&&e.key==="fill"?{...e,default:"#ffffff"}:e.type==="color"&&e.key==="stroke"?{...e,default:"none"}:e),gm={type:"stripes",label:"Stripes",category:"generator",translate:[{x:"x",y:"y"}],quickKey:"of\
|
|
1772
1772
|
fset",description:"Hazard bands or chevrons filling a frame, one shape per stripe so cascades and ramps work per band. Wire Time into Offset and they march.",inputs:[],outputs:[{name:"out",type:"shape\
|
|
1773
1773
|
s"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"w",label:"Width",type:"number",default:240,min:0,step:.5,
|
|
@@ -1779,21 +1779,21 @@ deg",description:"Chevron: the angle at the arrow\u2019s tip. 90 is the classic.
|
|
|
1779
1779
|
left",label:"Left"}],description:"Which way the chevrons point; for Hazard, which way the bands lean."},{key:"offset",label:"Offset",type:"number",default:0,step:.5,unit:"px",description:"Slides the p\
|
|
1780
1780
|
attern along the frame, wrapping round. Wire Time or an LFO here to make it march."},{key:"clip",label:"Clip",type:"bool",default:!0,description:"Cut the bands at the frame\u2019s edges (the leading and tr\
|
|
1781
1781
|
ailing triangles). Off leaves whole bands hanging past it."},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},Qn,...ym],cook(e){let t=e.num("w"),n=e.num("h");if(t<=0||n<=0)return{
|
|
1782
|
-
out:z([])};let{dx:r,dy:i}=Ln(e,t,n),s=e.num("x")+r,a=e.num("y")+i,u=e.enumOf("pattern",mm),
|
|
1783
|
-
d=e.bool("clip"),A=e.num("rotation"),g=A===0?be:Dr(A,s+t/2,a+n/2),x=(e.num("offset")%
|
|
1784
|
-
R,a],[S+R,a]]}else{let R=e.num("point")/2*Math.PI/180,S=n/2/Math.max(Math.tan(R),.001);v=S,b=_=>[[_,a],[_+
|
|
1785
|
-
t),
|
|
1786
|
-
max(...S.map(X=>X[0]))<=s||_>=s+t)continue;let Y=[S.map(([X,te])=>[
|
|
1782
|
+
out:z([])};let{dx:r,dy:i}=Ln(e,t,n),s=e.num("x")+r,a=e.num("y")+i,u=e.enumOf("pattern",mm),f=Math.max(.5,e.num("stripe")),h=f+Math.max(0,e.num("gap")),m=e.enumOf("direction",["right","left"])==="left",
|
|
1783
|
+
d=e.bool("clip"),A=e.num("rotation"),g=A===0?be:Dr(A,s+t/2,a+n/2),x=(e.num("offset")%h+h)%h,v,b;if(u==="hazard"){let R=n*Math.tan(e.num("lean")*Math.PI/180);v=Math.abs(R),b=S=>[[S,a+n],[S+f,a+n],[S+f+
|
|
1784
|
+
R,a],[S+R,a]]}else{let R=e.num("point")/2*Math.PI/180,S=n/2/Math.max(Math.tan(R),.001);v=S,b=_=>[[_,a],[_+f,a],[_+f+S,a+n/2],[_+f,a+n],[_,a+n],[_+S,a+n/2]]}let w=[[[hn(s),hn(a)],[hn(s+t),hn(a)],[hn(s+
|
|
1785
|
+
t),hn(a+n)],[hn(s),hn(a+n)]]],P=s*2+t,E=Math.floor((-v-x)/h)-1,T=Math.ceil((t+v)/h)+1,M=[];for(let R=E;R<=T;R++){let S=b(s+x+R*h);m&&(S=S.map(([X,te])=>[P-X,te]));let _=Math.min(...S.map(X=>X[0]));if(Math.
|
|
1786
|
+
max(...S.map(X=>X[0]))<=s||_>=s+t)continue;let Y=[S.map(([X,te])=>[hn(X),hn(te)])],G=Nn(d?Wu.default.intersection(Y,w):[Y]);if(!G)continue;let q=M.length;M.push({id:e.shapeId(q),kind:"path",d:G,style:e.
|
|
1787
1787
|
style(q,T-E+1),transform:g,meta:e.meta(q,["stripe",u])})}return{out:z(M)}}},bm=["split","recursive"],vm=["h","v"],xm=["alternate","longest","random"],vt=e=>Math.round(e*1e3)/1e3,po=(e,t,n)=>Math.min(n,
|
|
1788
1788
|
Math.max(t,e));function Uu(e){return J(e.mode).base==="recursive"?"recursive":"split"}var pr=e=>Uu(e)==="split",Jl=e=>Uu(e)==="recursive";function Im(e){let t=e.split(/[\s,;/]+/).map(n=>Number.parseFloat(
|
|
1789
|
-
n)).filter(n=>Number.isFinite(n)&&n>0);return t.length>=2?t:void 0}function zu(e,t,n){let r=n.reduce((h
|
|
1790
|
-
t==="h"?{x:e.x,y:e.y+u,w:e.w,h:m}:{x:e.x+u,y:e.y,w:m,h:e.h}),u+=m,
|
|
1791
|
-
2){let s=po(t+(r.next()*2-1)*n*.5,.05,.95);return[s,1-s]}let i=[];for(let s=0;s<e;s++)i.push(Math.max(.05,1+(r.next()*2-1)*n));return i}function km(e,t,n){let r=[],i=[],s=(a,u,
|
|
1792
|
-
vide",n,
|
|
1793
|
-
|
|
1794
|
-
t.ratio,t.variation,
|
|
1795
|
-
a=Math.abs(r-s)<1e-9,u=a?r:n,
|
|
1796
|
-
T||E<u==T<u)continue;let M=(u-E)/(T-E);m.push(a?v+(w-v)*M:b+(P-b)*M)}m.sort((A,g)=>A-g);let d=[];for(let A=0;A+1<m.length;A+=2){let g=Math.max(
|
|
1789
|
+
n)).filter(n=>Number.isFinite(n)&&n>0);return t.length>=2?t:void 0}function zu(e,t,n){let r=n.reduce((f,h)=>f+h,0),i=t==="h"?e.h:e.w,s=[],a=[],u=0;for(let[f,h]of n.entries()){let m=r>0?h/r*i:0;s.push(
|
|
1790
|
+
t==="h"?{x:e.x,y:e.y+u,w:e.w,h:m}:{x:e.x+u,y:e.y,w:m,h:e.h}),u+=m,f<n.length-1&&a.push(t==="h"?[e.x,e.y+u,e.x+e.w,e.y+u]:[e.x+u,e.y,e.x+u,e.y+e.h])}return{pieces:s,lines:a}}function wm(e,t,n,r){if(e===
|
|
1791
|
+
2){let s=po(t+(r.next()*2-1)*n*.5,.05,.95);return[s,1-s]}let i=[];for(let s=0;s<e;s++)i.push(Math.max(.05,1+(r.next()*2-1)*n));return i}function km(e,t,n){let r=[],i=[],s=(a,u,f)=>{let h=t.rand("subdi\
|
|
1792
|
+
vide",n,f),m=u>=t.depth;!m&&u>0&&t.stop>0&&h.next()<t.stop&&(m=!0);let d=t.axis;if(!m&&(t.rule==="alternate"?d=u%2===0?t.axis:t.axis==="h"?"v":"h":t.rule==="longest"?d=a.w>a.h?"v":a.w<a.h?"h":t.axis:d=
|
|
1793
|
+
h.next()<.5?"h":"v",(d==="h"?a.h:a.w)/t.ways<t.minSize)){let v=d==="h"?"v":"h",b=v==="h"?a.h:a.w;t.rule!=="alternate"&&b/t.ways>=t.minSize?d=v:m=!0}if(m){r.push({cell:a,depth:u});return}let A=wm(t.ways,
|
|
1794
|
+
t.ratio,t.variation,h),g=zu(a,d,A);for(let x of g.lines)i.push({line:x,depth:u});g.pieces.forEach((x,v)=>s(x,u+1,`${f}.${v}`))};return s(e,0,"r"),{leaves:r,dividers:i}}function Cm(e,t){let[n,r,i,s]=e,
|
|
1795
|
+
a=Math.abs(r-s)<1e-9,u=a?r:n,f=Math.min(a?n:r,a?i:s),h=Math.max(a?n:r,a?i:s),m=[];for(let A of t)for(let g of A)for(let x=0;x<g.length;x++){let[v,b]=g[x],[w,P]=g[(x+1)%g.length],E=a?b:v,T=a?P:w;if(E===
|
|
1796
|
+
T||E<u==T<u)continue;let M=(u-E)/(T-E);m.push(a?v+(w-v)*M:b+(P-b)*M)}m.sort((A,g)=>A-g);let d=[];for(let A=0;A+1<m.length;A+=2){let g=Math.max(f,m[A]),x=Math.min(h,m[A+1]);x-g<.01||d.push(a?[g,u,x,u]:
|
|
1797
1797
|
[u,g,u,x])}return d}function Em(e,t){let n=e.cell.y-t.cell.y;return Math.abs(n)>.5?n:e.cell.x-t.cell.x}var Sm={type:"subdivide",label:"Subdivide",category:"modifier",quickKey:"ratio",description:"Carv\
|
|
1798
1798
|
e each shape\u2019s frame into panels. Split makes one cut into Count pieces or the Ratios typed in; Recursive keeps cutting, seeded. Cells are rects; the second output is just the dividers.",inputs:[
|
|
1799
1799
|
{name:"in",type:"shapes"},{name:"reseed",type:"number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes",label:"cells"},{name:"lines",type:"shapes",label:"lines"}],params:[{key:"mode",label:"\
|
|
@@ -1814,15 +1814,15 @@ description:"Cut the cells to the input\u2019s outline, so a circle or polygon i
|
|
|
1814
1814
|
number",default:0,min:0,step:.5,unit:"px",description:"Gutter between cells at every cut. The frame\u2019s outer edges stay put; the dividers sit in the middle of it."},{key:"inset",label:"Inset",type:"\
|
|
1815
1815
|
number",default:0,min:0,step:.5,unit:"px",description:"Shrink every cell inward on all four sides."},{key:"keepStyle",label:"Source Style",type:"bool",default:!0,description:"Cells and lines wear the \
|
|
1816
1816
|
input shape\u2019s style. Off = this node\u2019s own Style params dress them."},...Ge],cook(e){let t=e.shapes("in");if(t.length===0)return{out:z([]),lines:z([])};let n=e.enumOf("mode",bm),r=e.enumOf("\
|
|
1817
|
-
axis",vm),i=Math.max(0,e.num("gap")),s=Math.max(0,e.num("inset")),a=e.bool("keepStyle"),u=e.bool("clip"),
|
|
1818
|
-
1e3):-Math.round(b*1e3)-1}let m=`${e.int("salt")}|${
|
|
1817
|
+
axis",vm),i=Math.max(0,e.num("gap")),s=Math.max(0,e.num("inset")),a=e.bool("keepStyle"),u=e.bool("clip"),f=e.inputs.reseed,h=0;if(f?.t==="number"){let{playing:v,local:b}=tn(f.v);h=v?Math.round((e.t-b)*
|
|
1818
|
+
1e3):-Math.round(b*1e3)-1}let m=`${e.int("salt")}|${h}`,d=n==="split"?Im(e.str("ratios")):void 0,A=[],g=[],x=t.length;return t.forEach((v,b)=>{let w={...v,transform:be},P=$e(w);if(!P||P.w<=0||P.h<=0)return;
|
|
1819
1819
|
let E;if(u&&!(v.kind==="rect"&&v.rx===0)){let Y=mr([w]);Y.length>0&&(E=yo(Y))}let T=po(e.num("ratio",b,x),0,100)/100,M,R;if(n==="split"){let Y=Math.max(1,e.int("count")),G=d??(Y===2?[T,1-T]:new Array(
|
|
1820
1820
|
Y).fill(1)),q=zu(P,r,G);M=q.pieces.map(X=>({cell:X,depth:1})),R=q.lines.map(X=>({line:X,depth:0}))}else{let Y=km(P,{depth:Math.max(1,e.int("depth")),axis:r,rule:e.enumOf("rule",xm),ratio:T,variation:po(
|
|
1821
1821
|
e.num("variation"),0,1),ways:po(e.int("ways"),2,4),stop:po(e.num("stop"),0,1),minSize:Math.max(0,e.num("minSize")),rand:(...G)=>e.rand(m,b,...G)},`${b}`);M=Y.leaves.sort(Em),R=Y.dividers}let S=(Y,G)=>a?
|
|
1822
1822
|
{...v.style}:e.style(Y,G),_=(Y,G)=>{let q=S(Y,G);return{...q,fill:"none",stroke:q.stroke&&q.stroke!=="none"?q.stroke:q.fill&&q.fill!=="none"?q.fill:"#ffffff"}},Q=.001;for(let Y of M){let G=Y.cell,q=Math.
|
|
1823
|
-
abs(G.x-P.x)<Q?0:i/2,X=Math.abs(G.y-P.y)<Q?0:i/2,te=Math.abs(G.x+G.w-(P.x+P.w))<Q?0:i/2,ce=Math.abs(G.y+G.h-(P.y+P.h))<Q?0:i/2,ue=G.x+q+s,ie=G.y+X+s,
|
|
1824
|
-
s*2),ne=A.length,ye=["cell",`depth:${Y.depth}`];if(E){if(
|
|
1825
|
-
if(!Ee)continue;A.push({id:e.shapeId(ne),kind:"path",d:Ee,style:S(ne,M.length),transform:v.transform,meta:e.meta(ne,ye)});continue}A.push({id:e.shapeId(ne),kind:"rect",x:vt(ue),y:vt(ie),w:vt(
|
|
1823
|
+
abs(G.x-P.x)<Q?0:i/2,X=Math.abs(G.y-P.y)<Q?0:i/2,te=Math.abs(G.x+G.w-(P.x+P.w))<Q?0:i/2,ce=Math.abs(G.y+G.h-(P.y+P.h))<Q?0:i/2,ue=G.x+q+s,ie=G.y+X+s,fe=Math.max(0,G.w-q-te-s*2),ve=Math.max(0,G.h-X-ce-
|
|
1824
|
+
s*2),ne=A.length,ye=["cell",`depth:${Y.depth}`];if(E){if(fe<=0||ve<=0)continue;let Be=[[[vt(ue),vt(ie)],[vt(ue+fe),vt(ie)],[vt(ue+fe),vt(ie+ve)],[vt(ue),vt(ie+ve)]]],Ee=Nn($u.default.intersection(Be,E));
|
|
1825
|
+
if(!Ee)continue;A.push({id:e.shapeId(ne),kind:"path",d:Ee,style:S(ne,M.length),transform:v.transform,meta:e.meta(ne,ye)});continue}A.push({id:e.shapeId(ne),kind:"rect",x:vt(ue),y:vt(ie),w:vt(fe),h:vt(
|
|
1826
1826
|
ve),rx:0,style:S(ne,M.length),transform:v.transform,meta:e.meta(ne,ye)})}for(let Y of R){let G=E?Cm(Y.line,E):[Y.line];for(let[q,X,te,ce]of G){let ue=g.length;g.push({id:e.shapeId(ue,"line"),kind:"pol\
|
|
1827
1827
|
yline",points:[{x:vt(q),y:vt(X)},{x:vt(te),y:vt(ce)}],closed:!1,style:_(ue,R.length),transform:v.transform,meta:e.meta(ue,["divider",`depth:${Y.depth}`])})}}}),{out:z(A),lines:z(g)}}},Bm={type:"offset",
|
|
1828
1828
|
label:"Offset",category:"modifier",quickKey:"distance",description:"Grow or shrink outlines by a distance, in one or more bands \u2014 the multi-stroke word. Bands leave outermost first for a Merge to stac\
|
|
@@ -1832,13 +1832,13 @@ max:16,description:"How many bands, each Distance further out. One is a plain of
|
|
|
1832
1832
|
Miter"},{value:"square",label:"Square"}],description:"Round hugs the shape; Miter keeps corners sharp (up to a 4\xD7 limit); Square chamfers them."},{key:"merge",label:"Merge Shapes",type:"bool",default:!0,
|
|
1833
1833
|
description:"Fuse everything wired in into one silhouette before growing it, so letters share their bands. Off grows each shape on its own."},{key:"keepStyle",label:"Source Style",type:"bool",default:!1,
|
|
1834
1834
|
description:"Bands wear the source\u2019s fill (or stroke) colour. Off = the Style block dresses them \u2014 or paint them downstream with Style Tokens in Cycle mode."},...Ge.map(e=>({...e,dimWhen:t=>J(
|
|
1835
|
-
t.keepStyle).base!==!1}))],cook(e){let t=e.shapes("in"),n=z(t);if(t.length===0)return{out:z([]),source:n};let r=e.num("distance"),i=Math.max(1,e.int("count")),s=e.enumOf("join",
|
|
1836
|
-
u=e.bool("merge")?[{polys:mr(t),style:t[0].style}]:t.map(m=>({polys:mr([m]),style:m.style})),
|
|
1837
|
-
m,s));if(!g)return;let x=
|
|
1838
|
-
fill:b,stroke:"none",strokeWidth:0}:e.style(x,
|
|
1835
|
+
t.keepStyle).base!==!1}))],cook(e){let t=e.shapes("in"),n=z(t);if(t.length===0)return{out:z([]),source:n};let r=e.num("distance"),i=Math.max(1,e.int("count")),s=e.enumOf("join",fm),a=e.bool("keepStyle"),
|
|
1836
|
+
u=e.bool("merge")?[{polys:mr(t),style:t[0].style}]:t.map(m=>({polys:mr([m]),style:m.style})),f=[],h=i*u.length;for(let m=i;m>=1;m--)u.forEach((d,A)=>{if(d.polys.length===0)return;let g=Nn(qu(d.polys,r*
|
|
1837
|
+
m,s));if(!g)return;let x=f.length,v=d.style.fill,b=v!==void 0&&v!=="none"?v:d.style.stroke&&d.style.stroke!=="none"?d.style.stroke:"#ffffff";f.push({id:e.shapeId(x),kind:"path",d:g,style:a?{...d.style,
|
|
1838
|
+
fill:b,stroke:"none",strokeWidth:0}:e.style(x,h),transform:be,meta:e.meta(x,["offset",`band:${m}`,...u.length>1?[`group:${A}`]:[]])})});return{out:z(f),source:n}}};function Hr(e,t,n,r,i,s){return{id:e.
|
|
1839
1839
|
shapeId(t),kind:"polyline",points:[n,r],closed:!1,style:i,transform:be,meta:e.meta(t,s)}}var st=e=>Math.round(e*1e3)/1e3;function Is(e,t,n,r,i){let s=n.map(([a,u])=>`M ${st(a.x)} ${st(a.y)} L ${st(u.x)}\
|
|
1840
1840
|
${st(u.y)}`).join(" ");return{id:e.shapeId(t),kind:"path",d:s,style:r,transform:be,meta:e.meta(t,i)}}function Pm(e,t,n,r,i,s){if(r)return`M ${st(e+n)} ${st(t)} A ${st(n)} ${st(n)} 0 1 1 ${st(e-n)} ${st(
|
|
1841
|
-
t)} A ${st(n)} ${st(n)} 0 1 1 ${st(e+n)} ${st(t)}`;let a=Rt(e,t,n,i),u=Rt(e,t,n,i+s),
|
|
1841
|
+
t)} A ${st(n)} ${st(n)} 0 1 1 ${st(e+n)} ${st(t)}`;let a=Rt(e,t,n,i),u=Rt(e,t,n,i+s),f=Math.abs(s)>180?1:0,h=s>=0?1:0;return`M ${st(a.x)} ${st(a.y)} A ${st(n)} ${st(n)} 0 ${f} ${h} ${st(u.x)} ${st(u.y)}`}
|
|
1842
1842
|
var ju={key:"subJoin",label:"One Path",type:"bool",default:!0,group:"Sub grid",description:"Draw the minors as one path per direction: a dense sub grid is then one shape, not hundreds. Off, every mino\
|
|
1843
1843
|
r is its own shape \u2014 for Jitter, Select by index or Sub Out line by line."};function Mm(e){return J(e.useSub).base===!0}var pi={name:"sub",type:"shapes",label:"sub",idleWhen:e=>!Mm(e)},Rs={key:"u\
|
|
1844
1844
|
seSub",label:"Use Sub Out",type:"bool",default:!1,group:"Sub grid",description:"Sends the minor lines out on the sub port alone, the majors leaving on out without them, so each grid can be styled, jit\
|
|
@@ -1852,8 +1852,8 @@ sweep, wrapping: on a full ring they turn, on an arc a tick that leaves one end
|
|
|
1852
1852
|
f."},{key:"length",label:"Length",type:"number",default:8,step:.5,unit:"px"},{key:"majorEvery",label:"Major Every",type:"int",default:5,min:0,max:100},{key:"majorLength",label:"Major Length",type:"num\
|
|
1853
1853
|
ber",default:14,step:.5,unit:"px"},{key:"majorWidth",label:"Major Width",type:"number",default:1.5,min:0,step:.1,unit:"px"},Vu,{key:"align",label:"Align",type:"enum",default:"outward",options:[{value:"\
|
|
1854
1854
|
outward",label:"Outward"},{value:"inward",label:"Inward"},{value:"center",label:"Centered"}]},...Ge],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(0,e.int("count"));if(r===0)return{out:z([]),sub:z(
|
|
1855
|
-
[])};let i=yr(e.num("start")),s=e.num("sweep"),a=e.int("majorEvery"),u=e.enumOf("align",["outward","inward","center"]),
|
|
1856
|
-
s)+Math.abs(d),g=w=>{let P=d*w+m;if(m===0)return P;let E=(P%A+A)%A;if(
|
|
1855
|
+
[])};let i=yr(e.num("start")),s=e.num("sweep"),a=e.int("majorEvery"),u=e.enumOf("align",["outward","inward","center"]),f=Math.abs(s)>=360,h=f?r:Math.max(1,r-1),m=e.num("offset"),d=s/h,A=f?360:Math.abs(
|
|
1856
|
+
s)+Math.abs(d),g=w=>{let P=d*w+m;if(m===0)return P;let E=(P%A+A)%A;if(f)return E;let T=(Math.sign(s)*P%A+A)%A;if(!(T>Math.abs(s)+1e-9))return Math.sign(s)*T},x=e.bool("useSub"),v=[],b=[];for(let w=0;w<
|
|
1857
1857
|
r;w++){let P=g(w);if(P===void 0)continue;let E=i+P,T=a>0&&w%a===0,M=e.num("radius",w,r,{angle:E}),R=T?e.num("majorLength",w,r,{angle:E}):e.num("length",w,r,{angle:E}),S=u==="outward"?M:u==="inward"?M-
|
|
1858
1858
|
R:M-R/2,_=S+R,Q=e.style(w,r);T&&(Q.strokeWidth=e.num("majorWidth",w,r,{angle:E})),(x&&!T?b:v).push(Hr(e,w,Rt(t,n,S,E),Rt(t,n,_,E),Q,T?["major"]:["minor"]))}return{out:z(v),sub:z(b)}}},Tm={type:"tick-r\
|
|
1859
1859
|
ow",label:"Tick Row",category:"generator",translate:[{x:"x",y:"y"}],description:"A straight ruler of ticks, with longer majors every Nth.",inputs:[],outputs:[{name:"out",type:"shapes"},pi],params:[{key:"\
|
|
@@ -1863,49 +1863,49 @@ step:1,unit:"deg"},{key:"offset",label:"Offset",type:"number",default:0,step:.5,
|
|
|
1863
1863
|
r, majors staying major. Wire Time or an LFO here to make the ruler march."},_s,{key:"length",label:"Length",type:"number",default:8,step:.5,unit:"px"},{key:"majorEvery",label:"Major Every",type:"int",
|
|
1864
1864
|
default:5,min:0,max:100},{key:"majorLength",label:"Major Length",type:"number",default:14,step:.5,unit:"px"},{key:"majorWidth",label:"Major Width",type:"number",default:1.5,min:0,step:.1,unit:"px"},Vu,
|
|
1865
1865
|
{key:"align",label:"Align",type:"enum",default:"up",options:[{value:"up",label:"Up"},{value:"down",label:"Down"},{value:"center",label:"Centered"}]},...Ge],cook(e){let t=e.num("span"),n=Math.max(0,e.int(
|
|
1866
|
-
"count"));if(n===0)return{out:z([]),sub:z([])};let r=e.num("angle")*Math.PI/180,i=e.int("majorEvery"),s=e.enumOf("align",["up","down","center"]),a=Math.cos(r),u=Math.sin(r),
|
|
1867
|
-
m=e.num("y")-u*
|
|
1868
|
-
sign(t||1)*R},w=e.bool("useSub"),P=[],E=[];for(let T=0;T<n;T++){let M=b(T);if(M===void 0)continue;let R=i>0&&T%i===0,S=R?e.num("majorLength",T,n):e.num("length",T,n),_={x:
|
|
1866
|
+
"count"));if(n===0)return{out:z([]),sub:z([])};let r=e.num("angle")*Math.PI/180,i=e.int("majorEvery"),s=e.enumOf("align",["up","down","center"]),a=Math.cos(r),u=Math.sin(r),f=Ts(e,t),h=e.num("x")-a*f,
|
|
1867
|
+
m=e.num("y")-u*f,d=-u,A=a,g=e.num("offset"),x=n===1?Math.abs(t):t/(n-1),v=Math.abs(t)+Math.abs(x),b=T=>{let M=x*T+g;if(g===0)return M;let R=(Math.sign(t||1)*M%v+v)%v;if(!(R>Math.abs(t)+1e-9))return Math.
|
|
1868
|
+
sign(t||1)*R},w=e.bool("useSub"),P=[],E=[];for(let T=0;T<n;T++){let M=b(T);if(M===void 0)continue;let R=i>0&&T%i===0,S=R?e.num("majorLength",T,n):e.num("length",T,n),_={x:h+a*M,y:m+u*M},Q=s==="center"?
|
|
1869
1869
|
-S/2:s==="up"?-S:0,Y=Q+S,G=e.style(T,n);R&&(G.strokeWidth=e.num("majorWidth",T,n)),(w&&!R?E:P).push(Hr(e,T,{x:_.x+d*Q,y:_.y+A*Q},{x:_.x+d*Y,y:_.y+A*Y},G,R?["major"]:["minor"]))}return{out:z(P),sub:z(E)}}},
|
|
1870
1870
|
Rm={type:"crosshair",label:"Crosshair",category:"generator",translate:[{x:"cx",y:"cy"}],description:"Four arms around a centre, with an optional gap and centre dot.",inputs:[],outputs:[{name:"out",type:"\
|
|
1871
1871
|
shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"size",label:"Size",type:"number",default:40,
|
|
1872
1872
|
min:0,step:.5,unit:"px"},{key:"gap",label:"Gap",type:"number",default:8,min:0,step:.5,unit:"px"},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},{key:"dot",label:"Center Do\
|
|
1873
1873
|
t",type:"number",default:0,min:0,step:.5,unit:"px"},{key:"horizontal",label:"Horizontal",type:"bool",default:!0},{key:"vertical",label:"Vertical",type:"bool",default:!0},...Ge],cook(e){let t=e.num("cx"),
|
|
1874
|
-
n=e.num("cy"),r=e.num("size"),i=e.num("gap"),s=e.num("rotation"),a=e.num("dot"),u=[];e.bool("horizontal")&&u.push(0,180),e.bool("vertical")&&u.push(90,270);let
|
|
1875
|
-
n,i+r,
|
|
1876
|
-
{out:z(
|
|
1874
|
+
n=e.num("cy"),r=e.num("size"),i=e.num("gap"),s=e.num("rotation"),a=e.num("dot"),u=[];e.bool("horizontal")&&u.push(0,180),e.bool("vertical")&&u.push(90,270);let f=u.map((h,m)=>Hr(e,m,Rt(t,n,i,h+s),Rt(t,
|
|
1875
|
+
n,i+r,h+s),e.style(m,u.length),["arm"]));return a>0&&f.push({id:e.shapeId(f.length),kind:"circle",cx:t,cy:n,r:a,style:{...e.style(),fill:e.color("stroke")},transform:be,meta:e.meta(f.length,["dot"])}),
|
|
1876
|
+
{out:z(f)}}},Dm={type:"corner-brackets",label:"Corner Brackets",category:"generator",translate:[{x:"x",y:"y"}],description:"The four L-shaped corners of a frame, without the frame.",inputs:[],outputs:[
|
|
1877
1877
|
{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"w",label:"Width",type:"number",default:200,
|
|
1878
1878
|
step:.5,unit:"px"},{key:"h",label:"Height",type:"number",default:140,step:.5,unit:"px"},Qn,{key:"armX",label:"Arm X",type:"number",default:24,min:0,step:.5,unit:"px"},{key:"armY",label:"Arm Y",type:"n\
|
|
1879
1879
|
umber",default:24,min:0,step:.5,unit:"px"},{key:"inset",label:"Inset",type:"number",default:0,step:.5,unit:"px"},{key:"topLeft",label:"Top Left",type:"bool",default:!0},{key:"topRight",label:"Top Righ\
|
|
1880
1880
|
t",type:"bool",default:!0},{key:"bottomRight",label:"Bottom Right",type:"bool",default:!0},{key:"bottomLeft",label:"Bottom Left",type:"bool",default:!0},...Ge],cook(e){let t=e.num("inset"),n=Ln(e,e.num(
|
|
1881
|
-
"w"),e.num("h")),r=e.num("x")+n.dx+t,i=e.num("y")+n.dy+t,s=e.num("w")-t*2,a=e.num("h")-t*2,u=e.num("armX"),
|
|
1882
|
-
{on:e.bool("topRight"),tag:"top-right",pts:[{x:r+s-u,y:i},{x:r+s,y:i},{x:r+s,y:i+
|
|
1883
|
-
omLeft"),tag:"bottom-left",pts:[{x:r,y:i+a-
|
|
1884
|
-
meta:e.meta(g,[A.tag])}));return{out:z(d)}}},
|
|
1881
|
+
"w"),e.num("h")),r=e.num("x")+n.dx+t,i=e.num("y")+n.dy+t,s=e.num("w")-t*2,a=e.num("h")-t*2,u=e.num("armX"),f=e.num("armY"),m=[{on:e.bool("topLeft"),tag:"top-left",pts:[{x:r+u,y:i},{x:r,y:i},{x:r,y:i+f}]},
|
|
1882
|
+
{on:e.bool("topRight"),tag:"top-right",pts:[{x:r+s-u,y:i},{x:r+s,y:i},{x:r+s,y:i+f}]},{on:e.bool("bottomRight"),tag:"bottom-right",pts:[{x:r+s,y:i+a-f},{x:r+s,y:i+a},{x:r+s-u,y:i+a}]},{on:e.bool("bott\
|
|
1883
|
+
omLeft"),tag:"bottom-left",pts:[{x:r,y:i+a-f},{x:r,y:i+a},{x:r+u,y:i+a}]}].filter(A=>A.on),d=m.map((A,g)=>({id:e.shapeId(g),kind:"polyline",points:A.pts,closed:!1,style:e.style(g,m.length),transform:be,
|
|
1884
|
+
meta:e.meta(g,[A.tag])}));return{out:z(d)}}},Om={type:"dot-matrix",label:"Dot Matrix",category:"generator",translate:[{x:"x",y:"y"}],description:"A grid of dots, thinnable by density for a scattered r\
|
|
1885
1885
|
eadout field.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"\
|
|
1886
1886
|
cols",label:"Columns",type:"int",default:12,min:0,max:400,description:"0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"rows",label:"Rows",type:"int",default:8,min:0,max:400,description:"\
|
|
1887
1887
|
0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"stepX",label:"Step X",type:"number",default:14,step:.5,unit:"px"},{key:"stepY",label:"Step Y",type:"number",default:14,step:.5,unit:"\
|
|
1888
1888
|
px"},Qn,{key:"dot",label:"Dot Size",type:"number",default:1.4,min:0,step:.1,unit:"px"},{key:"density",label:"Density",type:"number",default:1,min:0,max:1,step:.01},{key:"square",label:"Square Dots",type:"\
|
|
1889
1889
|
bool",default:!1},...Ge],cook(e){let t=Math.max(0,e.int("cols")),n=Math.max(0,e.int("rows"));if(t===0||n===0)return{out:z([])};let r=Ln(e,(t-1)*e.num("stepX"),(n-1)*e.num("stepY")),i=e.num("x")+r.dx,s=e.
|
|
1890
|
-
num("y")+r.dy,a=e.num("density"),u=e.bool("square"),
|
|
1891
|
-
A*e.num("stepX",g,
|
|
1892
|
-
meta:e.meta(g,["dot"])}:{id:e.shapeId(g),kind:"circle",cx:v,cy:b,r:w,style:P,transform:be,meta:e.meta(g,["dot"])})}return{out:z(m)}}},
|
|
1890
|
+
num("y")+r.dy,a=e.num("density"),u=e.bool("square"),f=t*n,h=e.rand("density"),m=[];for(let d=0;d<n;d++)for(let A=0;A<t;A++){let g=d*t+A;if(a<1&&h.next()>=a)continue;let x={col:A,row:d,cols:t,rows:n},v=i+
|
|
1891
|
+
A*e.num("stepX",g,f,x),b=s+d*e.num("stepY",g,f,x),w=e.num("dot",g,f,x),P={...e.style(g,f),fill:e.color("stroke",g,f)};m.push(u?{id:e.shapeId(g),kind:"rect",x:v-w,y:b-w,w:w*2,h:w*2,rx:0,style:P,transform:be,
|
|
1892
|
+
meta:e.meta(g,["dot"])}:{id:e.shapeId(g),kind:"circle",cx:v,cy:b,r:w,style:P,transform:be,meta:e.meta(g,["dot"])})}return{out:z(m)}}},Nm={type:"bar-meter",label:"Bar Meter",category:"generator",translate:[
|
|
1893
1893
|
{x:"x",y:"y"}],description:"A row of segments with a filled portion \u2014 the readout bar.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"\
|
|
1894
1894
|
px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"count",label:"Segments",type:"int",default:20,min:0,max:500,description:"Cells in the bar. 0 = nothing \u2014 wire a Ramp or Seq in \
|
|
1895
1895
|
to grow it from empty."},{key:"value",label:"Value",type:"number",default:.6,min:0,max:1,step:.01},{key:"segW",label:"Segment W",type:"number",default:4,min:0,step:.5,unit:"px"},{key:"segH",label:"Seg\
|
|
1896
1896
|
ment H",type:"number",default:16,min:0,step:.5,unit:"px"},{key:"gap",label:"Gap",type:"number",default:3,min:0,step:.5,unit:"px"},{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"deg"},
|
|
1897
1897
|
_s,{key:"fillColor",label:"Filled",type:"color",default:"#7fe8d0"},{key:"emptyColor",label:"Empty",type:"color",default:"#2a3a44"},...Ge],cook(e){let t=Math.max(0,e.int("count"));if(t===0)return{out:z(
|
|
1898
|
-
[])};let n=e.num("value"),r=e.num("gap"),i=e.num("angle")*Math.PI/180,s=Math.cos(i),a=Math.sin(i),u=t*e.num("segW")+(t-1)*r,
|
|
1899
|
-
"emptyColor"),g=[],x=0;for(let v=0;v<t;v++){let b=e.num("segW",v,t),w=e.num("segH",v,t),P=n>=(v+1)/t||v===0&&n>0,E={...e.style(v,t),fill:P?d:A,stroke:"none"};g.push({id:e.shapeId(v),kind:"rect",x:
|
|
1898
|
+
[])};let n=e.num("value"),r=e.num("gap"),i=e.num("angle")*Math.PI/180,s=Math.cos(i),a=Math.sin(i),u=t*e.num("segW")+(t-1)*r,f=Ts(e,u),h=e.num("x")-s*f,m=e.num("y")-a*f,d=e.color("fillColor"),A=e.color(
|
|
1899
|
+
"emptyColor"),g=[],x=0;for(let v=0;v<t;v++){let b=e.num("segW",v,t),w=e.num("segH",v,t),P=n>=(v+1)/t||v===0&&n>0,E={...e.style(v,t),fill:P?d:A,stroke:"none"};g.push({id:e.shapeId(v),kind:"rect",x:h+s*
|
|
1900
1900
|
x,y:m+a*x-w/2,w:b,h:w,rx:0,style:E,transform:be,meta:e.meta(v,[P?"on":"off"])}),x+=b+r}return{out:z(g)}}},Qm={type:"polygon",label:"Polygon",category:"generator",translate:[{x:"cx",y:"cy"}],description:"\
|
|
1901
1901
|
A regular polygon \u2014 triangle markers, diamonds, hex frames.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",
|
|
1902
1902
|
label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:40,min:0,step:.5,unit:"px"},{key:"sides",label:"Sides",type:"int",default:6,min:3,max:64},
|
|
1903
1903
|
{key:"rotation",label:"Rotation",type:"number",default:-90,step:1,unit:"deg"},{key:"cornerRadius",label:"Corner Radius",type:"number",default:0,min:0,step:.5,unit:"px",description:"Rounds every corner\
|
|
1904
|
-
with a circular fillet, clamped to what the edges can carry."},...Ge],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(3,e.int("sides")),i=e.num("rotation"),s=Array.from({length:r},(u,
|
|
1905
|
-
num("radius",
|
|
1906
|
-
v=Math.hypot(g.x,g.y),b=Math.hypot(x.x,x.y),w=v>0&&b>0?(-g.x*x.x-g.y*x.y)/(v*b):1,P=Math.acos(Math.min(1,Math.max(-1,w))),E=Math.tan(P/2),T=e.num("cornerRadius",
|
|
1907
|
-
2):0;if(v===0||b===0||M<=.001){
|
|
1908
|
-
length===0?"M":"L"}${u(S.x)} ${u(S.y)}`,`A${u(R)} ${u(R)} 0 0 ${Q} ${u(_.x)} ${u(_.y)}`)}return{out:z([{id:e.shapeId(0),kind:"path",d:`${
|
|
1904
|
+
with a circular fillet, clamped to what the edges can carry."},...Ge],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(3,e.int("sides")),i=e.num("rotation"),s=Array.from({length:r},(u,f)=>Rt(t,n,e.
|
|
1905
|
+
num("radius",f,r),i+360*f/r));if(e.num("cornerRadius")>0){let u=h=>Math.round(h*1e3)/1e3,f=[];for(let h=0;h<r;h++){let m=s[(h-1+r)%r],d=s[h],A=s[(h+1)%r],g={x:d.x-m.x,y:d.y-m.y},x={x:A.x-d.x,y:A.y-d.y},
|
|
1906
|
+
v=Math.hypot(g.x,g.y),b=Math.hypot(x.x,x.y),w=v>0&&b>0?(-g.x*x.x-g.y*x.y)/(v*b):1,P=Math.acos(Math.min(1,Math.max(-1,w))),E=Math.tan(P/2),T=e.num("cornerRadius",h,r),M=E>1e-6?Math.min(T/E,Math.min(v,b)/
|
|
1907
|
+
2):0;if(v===0||b===0||M<=.001){f.push(`${f.length===0?"M":"L"}${u(d.x)} ${u(d.y)}`);continue}let R=M*E,S={x:d.x-g.x/v*M,y:d.y-g.y/v*M},_={x:d.x+x.x/b*M,y:d.y+x.y/b*M},Q=g.x*x.y-g.y*x.x>0?1:0;f.push(`${f.
|
|
1908
|
+
length===0?"M":"L"}${u(S.x)} ${u(S.y)}`,`A${u(R)} ${u(R)} 0 0 ${Q} ${u(_.x)} ${u(_.y)}`)}return{out:z([{id:e.shapeId(0),kind:"path",d:`${f.join("")}Z`,style:e.style(),transform:be,meta:e.meta(0)}])}}return{
|
|
1909
1909
|
out:z([{id:e.shapeId(0),kind:"polyline",points:s,closed:!0,style:e.style(),transform:be,meta:e.meta(0)}])}}};function co(e){return J(e.fullscreen).base===!0}function Kl(e){return J(e.square).base===!0}
|
|
1910
1910
|
var Lm={type:"grid",label:"Grid",category:"generator",translate:[{x:"x",y:"y"}],description:"Blueprint grid: major cell lines, optionally subdivided by fainter minors. The main cell size leaves as num\
|
|
1911
1911
|
bers.",inputs:[],outputs:[{name:"out",type:"shapes"},pi,{name:"cellW",type:"number",label:"cell w"},{name:"cellH",type:"number",label:"cell h"}],params:[{key:"fullscreen",label:"Fill Canvas",type:"boo\
|
|
@@ -1921,16 +1921,16 @@ s one short row at the bottom.",dimWhen:e=>!Kl(e)},{...Ge.find(e=>e.key==="strok
|
|
|
1921
1921
|
Sub grid",description:"minor lines per cell; 0 or 1 = off"},{key:"subWidth",label:"Sub Width",type:"number",default:.5,min:0,step:.1,unit:"px",group:"Sub grid"},{key:"subOpacity",label:"Sub Opacity",type:"\
|
|
1922
1922
|
number",default:.35,min:0,max:1,step:.01,group:"Sub grid"},ju,Rs,...Ge.filter(e=>e.key!=="strokeWidth").map(e=>e.key==="fill"?{...e,description:"Paints a panel behind the lines \u2014 the paper the bluepri\
|
|
1923
1923
|
nt is drawn on."}:e)],cook(e){let t=e.bool("fullscreen")&&e.canvas.w>0&&e.canvas.h>0,n=t?e.canvas.w:e.num("w"),r=t?e.canvas.h:e.num("h"),i=Ln(e,n,r),s=t?e.canvas.origin==="center"?-n/2:0:e.num("x")+i.
|
|
1924
|
-
dx,a=t?e.canvas.origin==="center"?-r/2:0:e.num("y")+i.dy,u=Math.max(1,e.int("cols")),
|
|
1925
|
-
b=d&&e.enumOf("squareFit",["center","top"])==="center"?x/2:0,w=d?Math.max(1,Math.ceil(r/m-A)):Math.max(1,e.int("rows")),P=d?m:r/w,E=
|
|
1926
|
-
m;ye>a+A&&ye<a+r-A&&T.push(ye)}T.push(a+r)}else for(let ne=0;ne<=w;ne++)T.push(ne===w?a+r:a+ne*P);let M=[];for(let ne=0;ne<=u;ne++)!
|
|
1927
|
-
S=[],_=[];if(E>0){for(let Be=0;Be<u;Be++)for(let Ee=1;Ee<=E;Ee++)S.push(s+(Be+Ee/
|
|
1924
|
+
dx,a=t?e.canvas.origin==="center"?-r/2:0:e.num("y")+i.dy,u=Math.max(1,e.int("cols")),f=e.int("subdivisions"),h=e.bool("border"),m=n/u,d=e.bool("square")&&m>0,A=1e-6,g=d?Math.floor(r/m+A):0,x=d?r-g*m:0,
|
|
1925
|
+
b=d&&e.enumOf("squareFit",["center","top"])==="center"?x/2:0,w=d?Math.max(1,Math.ceil(r/m-A)):Math.max(1,e.int("rows")),P=d?m:r/w,E=f>1?f-1:0,T=[];if(d){T.push(a);for(let ne=0;ne<=g;ne++){let ye=a+b+ne*
|
|
1926
|
+
m;ye>a+A&&ye<a+r-A&&T.push(ye)}T.push(a+r)}else for(let ne=0;ne<=w;ne++)T.push(ne===w?a+r:a+ne*P);let M=[];for(let ne=0;ne<=u;ne++)!h&&(ne===0||ne===u)||M.push(ne===u?s+n:s+ne*m);let R=h?T:T.slice(1,-1),
|
|
1927
|
+
S=[],_=[];if(E>0){for(let Be=0;Be<u;Be++)for(let Ee=1;Ee<=E;Ee++)S.push(s+(Be+Ee/f)*m);let ne=d?-1:0,ye=d?g:w-1;for(let Be=ne;Be<=ye;Be++)for(let Ee=1;Ee<=E;Ee++){let We=a+b+(Be+Ee/f)*P;We>a+A&&We<a+r-
|
|
1928
1928
|
A&&_.push(We)}}let Q=E>0&&e.bool("subJoin"),Y=Q?(S.length>0?1:0)+(_.length>0?1:0):S.length+_.length,G=M.length+R.length+Y,q=[],X=[],te=0,ce=(ne,ye,Be,Ee)=>Hr(e,ye,{x:ne,y:a},{x:ne,y:a+r},Be,Ee),ue=(ne,ye,Be,Ee)=>Hr(
|
|
1929
1929
|
e,ye,{x:s,y:ne},{x:s+n,y:ne},Be,Ee);for(let ne of M)q.push(ce(ne,te,e.style(te,G),["major","v"])),te++;for(let ne of R)q.push(ue(ne,te,e.style(te,G),["major","h"])),te++;if(E>0){let ne=ye=>{let Be=e.style(
|
|
1930
1930
|
ye,G);return Be.strokeWidth=e.num("subWidth",ye,G),Be.opacity=(Be.opacity??1)*e.num("subOpacity",ye,G),Be};if(Q)S.length>0&&(X.push(Is(e,te,S.map(ye=>[{x:ye,y:a},{x:ye,y:a+r}]),ne(te),["minor","v"])),
|
|
1931
1931
|
te++),_.length>0&&(X.push(Is(e,te,_.map(ye=>[{x:s,y:ye},{x:s+n,y:ye}]),ne(te),["minor","h"])),te++);else{for(let ye of S)X.push(ce(ye,te,ne(te),["minor","v"])),te++;for(let ye of _)X.push(ue(ye,te,ne(
|
|
1932
|
-
te),["minor","h"])),te++}}let ie=e.bool("useSub"),
|
|
1933
|
-
stroke:"none",opacity:e.num("opacity",G,G+1)},transform:be,meta:e.meta(G,["paper"])}),{out:z(
|
|
1932
|
+
te),["minor","h"])),te++}}let ie=e.bool("useSub"),fe=ie?[...q]:[...X,...q],ve=e.color("fill",G,G+1);return ve&&ve!=="none"&&fe.unshift({id:e.shapeId(G),kind:"rect",x:s,y:a,w:n,h:r,rx:0,style:{fill:ve,
|
|
1933
|
+
stroke:"none",opacity:e.num("opacity",G,G+1)},transform:be,meta:e.meta(G,["paper"])}),{out:z(fe),sub:z(ie?X:[]),cellW:De(m),cellH:De(P)}}},Fm={type:"polar-grid",label:"Grid Polar",category:"generator",
|
|
1934
1934
|
translate:[{x:"cx",y:"cy"}],description:"Radar-scope grid: concentric rings and spokes, optionally subdivided by fainter minors.",inputs:[],outputs:[{name:"out",type:"shapes"},pi],params:[{key:"cx",label:"\
|
|
1935
1935
|
Center X",type:"number",default:0,step:.5,unit:"px",group:"Frame"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px",group:"Frame"},{key:"radius",label:"Radius",type:"number",default:180,
|
|
1936
1936
|
min:0,step:.5,unit:"px",group:"Frame"},{key:"innerRadius",label:"Inner Radius",type:"number",default:0,min:0,step:.5,unit:"px",group:"Frame"},{key:"rings",label:"Rings",type:"int",default:4,min:1,max:200,
|
|
@@ -1938,44 +1938,44 @@ group:"Cells"},{key:"spokes",label:"Spokes",type:"int",default:8,min:0,max:500,g
|
|
|
1938
1938
|
Cells",description:vo},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg",group:"Cells"},{key:"subdivisions",label:"Subdivisions",type:"int",default:0,min:0,max:20,
|
|
1939
1939
|
group:"Sub grid",description:"minor rings and spokes per cell; 0 or 1 = off"},{key:"subWidth",label:"Sub Width",type:"number",default:.5,min:0,step:.1,unit:"px",group:"Sub grid"},{key:"subOpacity",label:"\
|
|
1940
1940
|
Sub Opacity",type:"number",default:.35,min:0,max:1,step:.01,group:"Sub grid"},ju,Rs,...Ge],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.num("radius"),i=Math.min(e.num("innerRadius"),r),s=Math.max(1,e.int(
|
|
1941
|
-
"rings")),a=Math.max(0,e.int("spokes")),u=yr(e.num("start")),
|
|
1941
|
+
"rings")),a=Math.max(0,e.int("spokes")),u=yr(e.num("start")),f=e.num("sweep"),h=e.int("subdivisions"),m=h>1?h-1:0,d=Math.abs(f)>=360,A=a===0?0:d?a:a+1,g=(r-i)/s,x=m>0&&e.bool("subJoin"),v=x?(s>0?1:0)+
|
|
1942
1942
|
(a>0?1:0):m*(s+a),b=s+1+A+v,w=[],P=[],E=0,T=(S,_,Q,Y)=>{if(S<=0)return;let G={id:e.shapeId(_),style:Q,transform:be,meta:e.meta(_,Y)};return d?{...G,kind:"circle",cx:t,cy:n,r:S}:{...G,kind:"arc",cx:t,cy:n,
|
|
1943
|
-
r:S,a0:u,a1:u+
|
|
1943
|
+
r:S,a0:u,a1:u+f}},M=(S,_,Q,Y)=>Hr(e,_,Rt(t,n,i,S),Rt(t,n,r,S),Q,Y);for(let S=0;S<=s;S++){let _=T(i+S*g,E,e.style(E,b),["major","ring"]);_&&w.push(_),E++}for(let S=0;S<A;S++)w.push(M(u+f*S/a,E,e.style(
|
|
1944
1944
|
E,b),["major","spoke"])),E++;if(m>0){let S=_=>{let Q=e.style(_,b);return Q.strokeWidth=e.num("subWidth",_,b),Q.opacity=(Q.opacity??1)*e.num("subOpacity",_,b),Q};if(x){let _=[];for(let Y=0;Y<s;Y++)for(let G=1;G<=
|
|
1945
|
-
m;G++)_.push(i+(Y+G/
|
|
1946
|
-
"ring"])})}E++}if(a>0){let Y=[];for(let G=0;G<a;G++)for(let q=1;q<=m;q++){let X=u+
|
|
1947
|
-
m;Q++){let Y=T(i+(_+Q/
|
|
1948
|
-
R?w:[...P,...w]),sub:z(R?P:[])}}},Ym=[Lm,Fm,_m,Tm,Rm,Dm,Nm,
|
|
1949
|
-
function go(e){let t=vn(e);return uo(e)?`bitmap ${t} px`:t?`pixel ${t} px`:bn(e)||
|
|
1945
|
+
m;G++)_.push(i+(Y+G/h)*g);let Q=_.filter(Y=>Y>0);if(s>0){if(Q.length>0){let Y=Q.map(G=>Pm(t,n,G,d,u,f)).join(" ");P.push({id:e.shapeId(E),kind:"path",d:Y,style:S(E),transform:be,meta:e.meta(E,["minor",
|
|
1946
|
+
"ring"])})}E++}if(a>0){let Y=[];for(let G=0;G<a;G++)for(let q=1;q<=m;q++){let X=u+f*(G+q/h)/a;Y.push([Rt(t,n,i,X),Rt(t,n,r,X)])}P.push(Is(e,E,Y,S(E),["minor","spoke"])),E++}}else{for(let _=0;_<s;_++)for(let Q=1;Q<=
|
|
1947
|
+
m;Q++){let Y=T(i+(_+Q/h)*g,E,S(E),["minor","ring"]);Y&&P.push(Y),E++}for(let _=0;_<a;_++)for(let Q=1;Q<=m;Q++)P.push(M(u+f*(_+Q/h)/a,E,S(E),["minor","spoke"])),E++}}let R=e.bool("useSub");return{out:z(
|
|
1948
|
+
R?w:[...P,...w]),sub:z(R?P:[])}}},Ym=[Lm,Fm,_m,Tm,Rm,Dm,Om,Nm,Qm];var Wm=[{value:"start",label:"Start"},{value:"middle",label:"Middle"},{value:"end",label:"End"}],Xm=[{value:"baseline",label:"Baseline"},{value:"middle",label:"Middle"},{value:"top",label:"Top"}],Gm=.7;
|
|
1949
|
+
function go(e){let t=vn(e);return uo(e)?`bitmap ${t} px`:t?`pixel ${t} px`:bn(e)||hr(e)?"variable":"outline"}var eu=e=>({value:e,label:`${e} \xB7 ${go(e)}`});function di(e,t){let n=vn(e);return n?Math.
|
|
1950
1950
|
max(1,Math.round(t/n))*n:t}var ds=[{value:"100",label:"Thin"},{value:"200",label:"ExtraLight"},{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"\
|
|
1951
|
-
SemiBold"},{value:"700",label:"Bold"},{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],mi=[{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Tn.map(eu),optionsFor:()=>
|
|
1951
|
+
SemiBold"},{value:"700",label:"Bold"},{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],mi=[{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Tn.map(eu),optionsFor:()=>fr().map(
|
|
1952
1952
|
eu),description:"Bundled families render everywhere. Add your own under Settings \u203A Fonts; a machine without that font shows IBM Plex Mono instead. A pixel face (Silkscreen, Press Start 2P, the Fixed b\
|
|
1953
1953
|
itmaps) is drawn for small LCD screens: it is held to whole multiples of its grid and sits on whole pixels.",group:"Type"},{key:"fontSize",label:"Size",type:"number",default:12,min:1,step:.5,unit:"px",
|
|
1954
1954
|
group:"Type",description:"In px. A pixel face rounds to the nearest multiple of its grid: 12 px of Silkscreen draws at 16, 11 at 8."},{key:"fontWeight",label:"Weight",type:"enum",default:"400",options:ds,
|
|
1955
1955
|
optionsFor:e=>{let t=bt(String(J(e.fontFamily).base??"")).family,n=new Set(Dn(t).map(String)),r=ds.filter(i=>n.has(i.value));return r.length>0?r:ds},rangeFor:e=>bn(bt(String(J(e.fontFamily).base??"")).
|
|
1956
1956
|
family),description:"Only the weights the chosen family ships. A variable font takes any weight in its range.",group:"Type"},{key:"fontStretch",label:"Stretch",type:"number",default:100,min:50,max:200,
|
|
1957
|
-
step:1,unit:"%",group:"Type",dimWhen:e=>
|
|
1957
|
+
step:1,unit:"%",group:"Type",dimWhen:e=>hr(bt(String(J(e.fontFamily).base??"")).family)===void 0,description:"The width axis of a variable font, in percent of normal \u2014 Tektur goes from 75 to 100. Any \
|
|
1958
1958
|
other family keeps its width. Wire an LFO in and the word squeezes to fit."},{key:"letterSpacing",label:"Tracking",type:"number",default:0,step:.1,unit:"px",group:"Type"},{key:"outlines",label:"Outlin\
|
|
1959
1959
|
e to Path",type:"bool",default:!1,group:"Type",description:"Turn each glyph into a real vector path, so geometry nodes \u2014 Slice, Boolean, Partial Outline, draw-on Reveal \u2014 can cut and trace the letterf\
|
|
1960
1960
|
orms. Flips on by itself when you wire into one. Costs more than native text. Not the Stroke under Style, which is the coloured line around the glyphs. A bitmap face (Fixed) is drawn as a path either \
|
|
1961
1961
|
way, each lit pixel a square; off, it stays text through the graph for Split Glyphs and Text on Path."},{key:"anchor",label:"Anchor",type:"enum",default:"start",options:Wm,group:"Type"},{key:"vAnchor",
|
|
1962
1962
|
label:"Vertical",type:"enum",default:"baseline",options:Xm,group:"Type",description:"Where Y sits on the letters: on the baseline, through the middle of the capitals, or at their top. Measured from th\
|
|
1963
1963
|
e font\u2019s cap height rather than the text, so the line stays put while the words change."}],qm=mi.map(e=>e.key==="fontFamily"?{...e,default:"Rajdhani"}:e.key==="fontSize"?{...e,default:80}:e.key===
|
|
1964
|
-
"anchor"||e.key==="vAnchor"?{...e,default:"middle"}:e);function Hm(e,t,n){let r=e.style(t,n);return r.strokeWidth&&r.strokeWidth>0?r:{...r,stroke:"none"}}var
|
|
1965
|
-
ll"),default:"#ffffff",description:"The text colour \u2014 paints the glyphs. Pick none for stroke-only linework."},{...
|
|
1966
|
-
by default; pick one and raise Width for an outline."},{...
|
|
1964
|
+
"anchor"||e.key==="vAnchor"?{...e,default:"middle"}:e);function Hm(e,t,n){let r=e.style(t,n);return r.strokeWidth&&r.strokeWidth>0?r:{...r,stroke:"none"}}var fo=e=>Ge.find(t=>t.key===e),xo=[{...fo("fi\
|
|
1965
|
+
ll"),default:"#ffffff",description:"The text colour \u2014 paints the glyphs. Pick none for stroke-only linework."},{...fo("stroke"),default:"none",description:"Stroke colour around the glyphs \u2014 none \
|
|
1966
|
+
by default; pick one and raise Width for an outline."},{...fo("strokeWidth"),default:0,description:"Stroke thickness. 0 = no stroke."},fo("opacity"),fo("dash")],Ds=[{value:"scramble",label:"Scramble"},
|
|
1967
1967
|
{value:"typewriter",label:"Typewriter"},{value:"flicker",label:"Flicker"},{value:"cut-word",label:"Cut Word"},{value:"cut-char",label:"Cut Character"}],ws="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&*+<>\
|
|
1968
|
-
/=";function Zu(e,t){let{mode:n,step:r,alphabet:i}=t,s=Math.max(0,t.reveal);if(s>=1)return e;if(n==="cut-word"||n==="cut-char")return Um(e,s,n);let a=[...i],u=e.reduce((m,d)=>m+d.length,0),
|
|
1969
|
-
s*u+1e-9),
|
|
1968
|
+
/=";function Zu(e,t){let{mode:n,step:r,alphabet:i}=t,s=Math.max(0,t.reveal);if(s>=1)return e;if(n==="cut-word"||n==="cut-char")return Um(e,s,n);let a=[...i],u=e.reduce((m,d)=>m+d.length,0),f=Math.floor(
|
|
1969
|
+
s*u+1e-9),h=0;return e.map(m=>[...m].map(d=>{let A=h++;return A<f||d===" "?d:n==="typewriter"?"":n==="flicker"?t.rand(A,r).next()<s?d:" ":a.length>0?a[t.rand(A,r).int(0,a.length)]:d}).join(""))}function $m(e,t){
|
|
1970
1970
|
let n=Math.max(0,Math.min(1,e.num("reveal")));if(n>=1)return t;let r=e.enumOf("revealMode",["scramble","typewriter","flicker","cut-word","cut-char"]);return Zu(t,{reveal:n,mode:r,step:Math.floor(e.t*20),
|
|
1971
|
-
alphabet:ws,rand:(i,s)=>e.rand("decode",i,s)})}function Um(e,t,n){let r=e.map(
|
|
1972
|
-
s.push([
|
|
1971
|
+
alphabet:ws,rand:(i,s)=>e.rand("decode",i,s)})}function Um(e,t,n){let r=e.map(f=>[...f]),i=[],s;if(r.forEach((f,h)=>{f.forEach((m,d)=>{if(m===" "){s=void 0;return}(n==="cut-char"||!s)&&(s=[],i.push(s)),
|
|
1972
|
+
s.push([h,d])}),s=void 0}),i.length===0)return e;let a=Math.min(i.length-1,Math.floor(t*i.length+1e-9)),u=new Set(i[a].map(([f,h])=>`${f}:${h}`));return r.map((f,h)=>f.map((m,d)=>m===" "||u.has(`${h}:${d}`)?
|
|
1973
1973
|
m:" ").join(""))}function zm(e){let t=J(e.reveal).base,n=J(e.revealMode).base??"scramble";return typeof t=="number"&&t<1&&n!=="typewriter"&&n!=="cut-word"&&n!=="cut-char"}function Io(e,t,n,r){let{text:i,
|
|
1974
|
-
x:s,y:a,rotation:u=0,family:
|
|
1975
|
-
cos(w),E=Math.sin(w),T=e.outline?.measure?.({text:i,family:
|
|
1976
|
-
top"?M:0,_=e.bool("outlines")?e.outline:void 0;if(_){let q=_({text:i,family:
|
|
1974
|
+
x:s,y:a,rotation:u=0,family:f,weight:h,anchor:m}=r,d=fn(f,r.stretch??100),A=vn(f),g=di(f,r.fontSize),x=A?Math.round(r.letterSpacing):r.letterSpacing,v=A!==void 0&&u===0,b=Hm(e,t,n),w=u*Math.PI/180,P=Math.
|
|
1975
|
+
cos(w),E=Math.sin(w),T=e.outline?.measure?.({text:i,family:f,weight:h,stretch:d,size:g,letterSpacing:x}),M=T?.capHeight??g*Gm,R=e.enumOf("vAnchor",["baseline","middle","top"]),S=R==="middle"?M/2:R==="\
|
|
1976
|
+
top"?M:0,_=e.bool("outlines")?e.outline:void 0;if(_){let q=_({text:i,family:f,weight:h,stretch:d,size:g,letterSpacing:x});if(q){let X=m==="middle"?-q.width/2:m==="end"?-q.width:0,te=v?Math.round(s+X):
|
|
1977
1977
|
s+X*P-S*E,ce=v?Math.round(a+S):a+X*E+S*P;return{id:e.shapeId(t),kind:"path",d:q.d,style:b,transform:[P,E,-E,P,te,ce],meta:e.meta(t,[...r.tags??[],"glyphs"])}}}let Q=T?m==="middle"?-T.width/2:m==="end"?
|
|
1978
|
-
-T.width:0:0,Y=v?s+(Math.round(s+Q)-(s+Q)):s,G=v?Math.round(a+S):a+S;return{id:e.shapeId(t),kind:"text",x:Y,y:G,text:i,fontSize:g,fontFamily:
|
|
1978
|
+
-T.width:0:0,Y=v?s+(Math.round(s+Q)-(s+Q)):s,G=v?Math.round(a+S):a+S;return{id:e.shapeId(t),kind:"text",x:Y,y:G,text:i,fontSize:g,fontFamily:f,fontWeight:h,...d!==100?{fontStretch:d}:{},anchor:m,letterSpacing:x,
|
|
1979
1979
|
...T?{metrics:{width:T.width,capHeight:M}}:{},style:b,transform:u===0?be:[P,E,-E,P,s-P*s+E*a,a-E*s-P*a],meta:e.meta(t,r.tags)}}var jm={type:"text",label:"Text",category:"generator",translate:[{x:"x",y:"\
|
|
1980
1980
|
y"}],description:"A line of text. Multi-line splits on newlines.",quickKey:"reveal",timeRoot:zm,inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"text",label:"Text",type:"string",default:"R\
|
|
1981
1981
|
EADY",multiline:!0,glyphs:!0},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"lineHeight",label:"Line Height",type:"nu\
|
|
@@ -1983,8 +1983,8 @@ mber",default:1.4,min:0,step:.05},{key:"uppercase",label:"Uppercase",type:"bool"
|
|
|
1983
1983
|
resolve left to right from 0 to 1. Below 0 nothing has resolved yet and the scramble keeps boiling, so a ramp from \u22121 holds the noise twice as long before the first letter lands. Wire from a Seq, or p\
|
|
1984
1984
|
ress i to keyframe."},{key:"revealMode",label:"Decode",type:"enum",default:"scramble",options:[...Ds],group:"Decode",description:"What unresolved characters do while Reveal is below 1. Cut Word / Cut \
|
|
1985
1985
|
Character show one piece at a time instead \u2014 a saw LFO on Reveal flashes through them."},...qm,...xo],cook(e){let t=e.str("text"),n=e.bool("uppercase")?t.toUpperCase():t,r=$m(e,n.split(`
|
|
1986
|
-
`)),i=e.num("x"),s=e.num("y"),a=bt(e.str("fontFamily")).family,u=
|
|
1987
|
-
map((A,g)=>Io(e,g,r.length,{text:A,x:i+e.num("x",g,r.length)-i,y:s+g*h
|
|
1986
|
+
`)),i=e.num("x"),s=e.num("y"),a=bt(e.str("fontFamily")).family,u=Ot(a,Number(e.str("fontWeight"))||400),f=di(a,e.num("fontSize")),h=e.num("lineHeight"),m=e.enumOf("anchor",["start","middle","end"]),d=r.
|
|
1987
|
+
map((A,g)=>Io(e,g,r.length,{text:A,x:i+e.num("x",g,r.length)-i,y:s+g*f*h,family:a,weight:u,stretch:e.num("fontStretch",g,r.length),fontSize:f,letterSpacing:e.num("letterSpacing",g,r.length),anchor:m}));
|
|
1988
1988
|
return{out:z(d)}}},Fr={hex:"0123456789ABCDEF",digits:"0123456789",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alnum:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",binary:"01"},Vm={type:"random-code",label:"Random Code",
|
|
1989
1989
|
category:"generator",translate:[{x:"x",y:"y"}],description:"Seeded serials and readouts \u2014 stable for a seed, rerolled with it.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",
|
|
1990
1990
|
label:"Count",type:"int",default:6,min:1,max:500},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the text on every whole step \u2014 fractions are ignored, so a driver ticks r\
|
|
@@ -1994,19 +1994,19 @@ Step Y",type:"number",default:16,step:.5,unit:"px"},{...Qn,key:"stackAnchor",lab
|
|
|
1994
1994
|
rigin documents centre the stack on X/Y, top-left documents hang it down and right."},{key:"pattern",label:"Pattern",type:"string",default:"AA#-#####",description:"A = letter, # = digit, X = alphabet \
|
|
1995
1995
|
char, anything else is literal.",exposable:!1},{key:"alphabet",label:"Alphabet",type:"enum",default:"hex",options:Object.keys(Fr).map(e=>({value:e,label:e})),description:"What an X in the pattern draw\
|
|
1996
1996
|
s from. A and # always mean letter and digit.",dimWhen:e=>!String(J(e.pattern).base??"").includes("X")},...mi,...xo],cook(e){let t=Math.max(1,e.int("count")),n=Ln(e,(t-1)*e.num("stepX"),(t-1)*e.num("s\
|
|
1997
|
-
tepY"),"stackAnchor"),r=e.num("x")+n.dx,i=e.num("y")+n.dy,s=e.str("pattern"),a=Fr[e.enumOf("alphabet",Object.keys(Fr))]??Fr.hex,u=e.num("fontSize"),
|
|
1998
|
-
str("fontFamily")).family,m=
|
|
1999
|
-
v+=Fr.upper[x.int(0,26)]:b==="#"?v+=Fr.digits[x.int(0,10)]:b==="X"?v+=a[x.int(0,a.length)]:v+=b;d.push(Io(e,A,t,{text:v,x:r+A*e.num("stepX",A,t),y:i+A*e.num("stepY",A,t),family:
|
|
2000
|
-
"fontStretch",A,t),fontSize:u,letterSpacing:e.num("letterSpacing",A,t),anchor:
|
|
1997
|
+
tepY"),"stackAnchor"),r=e.num("x")+n.dx,i=e.num("y")+n.dy,s=e.str("pattern"),a=Fr[e.enumOf("alphabet",Object.keys(Fr))]??Fr.hex,u=e.num("fontSize"),f=e.enumOf("anchor",["start","middle","end"]),h=bt(e.
|
|
1998
|
+
str("fontFamily")).family,m=Ot(h,Number(e.str("fontWeight"))||400),d=[];for(let A=0;A<t;A++){let g=Math.floor(e.num("seed",A,t)),x=g===0?e.rand("code",A):e.rand("code",g,A),v="";for(let b of s)b==="A"?
|
|
1999
|
+
v+=Fr.upper[x.int(0,26)]:b==="#"?v+=Fr.digits[x.int(0,10)]:b==="X"?v+=a[x.int(0,a.length)]:v+=b;d.push(Io(e,A,t,{text:v,x:r+A*e.num("stepX",A,t),y:i+A*e.num("stepY",A,t),family:h,weight:m,stretch:e.num(
|
|
2000
|
+
"fontStretch",A,t),fontSize:u,letterSpacing:e.num("letterSpacing",A,t),anchor:f}))}return{out:z(d)}}},Zm={type:"radial-labels",label:"Radial Labels",category:"generator",translate:[{x:"cx",y:"cy"}],description:"\
|
|
2001
2001
|
Numbers around a ring \u2014 the scale on a dial.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center \
|
|
2002
2002
|
Y",type:"number",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:150,min:0,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:8,min:1,max:200},{key:"start",
|
|
2003
2003
|
label:"Start",type:"number",default:0,step:1,unit:"deg",description:vo},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg"},{key:"from",label:"From",type:"number",
|
|
2004
2004
|
default:0,step:1},{key:"to",label:"To",type:"number",default:100,step:1},{key:"decimals",label:"Decimals",type:"int",default:0,min:0,max:4},{key:"prefix",label:"Prefix",type:"string",default:"",exposable:!1},
|
|
2005
2005
|
{key:"suffix",label:"Suffix",type:"string",default:"",exposable:!1},{key:"orient",label:"Orient",type:"enum",default:"upright",options:[{value:"upright",label:"Upright"},{value:"radial",label:"Radial"},
|
|
2006
|
-
{value:"tangent",label:"Tangential"}]},...mi,...xo],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(1,e.int("count")),i=yr(e.num("start")),s=e.num("sweep"),a=e.num("from"),u=e.num("to"),
|
|
2007
|
-
cimals"),
|
|
2008
|
-
1,r-1),b=[];for(let w=0;w<r;w++){let P=w/v,E=i+s*P,T=e.num("radius",w,r,{angle:E}),M=Rt(t,n,T,E),R=a+(u-a)*(r===1?0:w/Math.max(1,r-1)),S=d==="radial"?E:d==="tangent"?E+90:0;b.push(Io(e,w,r,{text:
|
|
2009
|
-
|
|
2006
|
+
{value:"tangent",label:"Tangential"}]},...mi,...xo],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(1,e.int("count")),i=yr(e.num("start")),s=e.num("sweep"),a=e.num("from"),u=e.num("to"),f=e.int("de\
|
|
2007
|
+
cimals"),h=e.str("prefix"),m=e.str("suffix"),d=e.enumOf("orient",["upright","radial","tangent"]),A=bt(e.str("fontFamily")).family,g=Ot(A,Number(e.str("fontWeight"))||400),v=Math.abs(s)>=360?r:Math.max(
|
|
2008
|
+
1,r-1),b=[];for(let w=0;w<r;w++){let P=w/v,E=i+s*P,T=e.num("radius",w,r,{angle:E}),M=Rt(t,n,T,E),R=a+(u-a)*(r===1?0:w/Math.max(1,r-1)),S=d==="radial"?E:d==="tangent"?E+90:0;b.push(Io(e,w,r,{text:h+R.toFixed(
|
|
2009
|
+
f)+m,x:M.x,y:M.y,rotation:S,family:A,weight:g,stretch:e.num("fontStretch",w,r),fontSize:e.num("fontSize",w,r),letterSpacing:e.num("letterSpacing",w,r),anchor:e.enumOf("anchor",["start","middle","end"]),
|
|
2010
2010
|
tags:["label"]}))}return{out:z(b)}}},Jm={type:"row-labels",label:"Row Labels",category:"generator",translate:[{x:"x",y:"y"}],description:"Numbers along a line \u2014 the scale under a Tick Row. Same X/Y/Sp\
|
|
2011
2011
|
an/Angle and it lines up.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"\
|
|
2012
2012
|
px"},{key:"span",label:"Span",type:"number",default:240,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:5,min:1,max:200},{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"\
|
|
@@ -2014,13 +2014,13 @@ deg"},{..._s,key:"spanAnchor",label:"Span Anchor"},{key:"gap",label:"Gap",type:"
|
|
|
2014
2014
|
l row, negative above."},{key:"from",label:"From",type:"number",default:0,step:1},{key:"to",label:"To",type:"number",default:100,step:1},{key:"decimals",label:"Decimals",type:"int",default:0,min:0,max:4},
|
|
2015
2015
|
{key:"prefix",label:"Prefix",type:"string",default:"",exposable:!1},{key:"suffix",label:"Suffix",type:"string",default:"",exposable:!1},{key:"orient",label:"Orient",type:"enum",default:"upright",options:[
|
|
2016
2016
|
{value:"upright",label:"Upright"},{value:"along",label:"Along the line"}]},...mi.map(e=>e.key==="anchor"?{...e,default:"middle"}:e),...xo],cook(e){let t=e.num("span"),n=Math.max(1,e.int("count")),r=e.
|
|
2017
|
-
num("angle"),i=r*Math.PI/180,s=Math.cos(i),a=Math.sin(i),u=Ts(e,t,"spanAnchor"),
|
|
2018
|
-
str("suffix"),b=e.enumOf("orient",["upright","along"]),w=bt(e.str("fontFamily")).family,P=
|
|
2017
|
+
num("angle"),i=r*Math.PI/180,s=Math.cos(i),a=Math.sin(i),u=Ts(e,t,"spanAnchor"),f=e.num("x")-s*u,h=e.num("y")-a*u,m=e.num("gap"),d=e.num("from"),A=e.num("to"),g=e.int("decimals"),x=e.str("prefix"),v=e.
|
|
2018
|
+
str("suffix"),b=e.enumOf("orient",["upright","along"]),w=bt(e.str("fontFamily")).family,P=Ot(w,Number(e.str("fontWeight"))||400),E=[];for(let T=0;T<n;T++){let M=n===1?0:T/(n-1),R=f+s*t*M-a*m,S=h+a*t*M+
|
|
2019
2019
|
s*m,_=d+(A-d)*M;E.push(Io(e,T,n,{text:x+_.toFixed(g)+v,x:R,y:S,rotation:b==="along"?r:0,family:w,weight:P,stretch:e.num("fontStretch",T,n),fontSize:e.num("fontSize",T,n),letterSpacing:e.num("letterSpa\
|
|
2020
2020
|
cing",T,n),anchor:e.enumOf("anchor",["start","middle","end"]),tags:["label"]}))}return{out:z(E)}}},Km=[jm,Vm,Zm,Jm];function eA(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2}var Ju=.6;function tA(e,t,n,r){if(t){let i=(r%n+n)%n;return{p:ir(e,i,!0),t:ar(e,i,!0)}}if(r<
|
|
2021
2021
|
0){let i=ar(e,0),s=e[0];return{p:{x:s.x+i.x*r,y:s.y+i.y*r},t:i}}if(r>n){let i=ar(e,n),s=e[e.length-1],a=r-n;return{p:{x:s.x+i.x*a,y:s.y+i.y*a},t:i}}return{p:ir(e,r),t:ar(e,r)}}function Ku(e,t){let n=t.
|
|
2022
2022
|
fontFamily,r=t.fontWeight??400,i={text:t.text,family:n,weight:r,stretch:t.fontStretch,size:t.fontSize,letterSpacing:t.letterSpacing},s=e.outline?.glyphs?.(i);if(s)return{run:s,outlined:!0};let a=t.fontSize*
|
|
2023
|
-
Ju,u=[...t.text],
|
|
2023
|
+
Ju,u=[...t.text],f=u.map((m,d)=>({d:"",x:d*(a+t.letterSpacing),advance:a})),h=u.length===0?0:f[f.length-1].x+a;return{run:{glyphs:f,width:h},outlined:!1}}var nA={type:"text-on-path",label:"Text on Pat\
|
|
2024
2024
|
h",category:"modifier",description:"Bend text along a shape \u2014 a word around a ring, a label along an arc. Feed native text and the path to follow.",inputs:[{name:"in",type:"shapes"},{name:"path",
|
|
2025
2025
|
type:"shapes",label:"path"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"position",label:"Position",type:"number",default:0,step:.01,description:"Where along the path the text sits, as a fracti\
|
|
2026
2026
|
on of its length: 0 = the start, 0.5 = halfway. Closed shapes wrap, so wiring an LFO here orbits the word. On a Circle 0 is the right-hand point; 0.75 is the top."},{key:"align",label:"Align",type:"en\
|
|
@@ -2032,56 +2032,56 @@ eline",type:"number",default:0,step:.5,unit:"px",description:"Lifts the letters
|
|
|
2032
2032
|
default:0,step:.5,unit:"px",description:"Extra room between letters, on top of the text\u2019s own Tracking \u2014 curves outside need more, curves inside less."},{key:"wordGap",label:"Word Gap",type:"\
|
|
2033
2033
|
number",default:10,step:.5,unit:"px",description:"Room between words \u2014 between one incoming text shape and the next. Justify words sets this itself.",dimWhen:e=>String(J(e.align).base??"")==="wor\
|
|
2034
2034
|
ds"},{key:"passRef",label:"Show Path",type:"bool",default:!1,description:"Also emit the path shapes, like a Merge \u2014 the ring and the word around it leave in one stream."}],cook(e){let t=e.shapes(
|
|
2035
|
-
"in"),n=e.shapes("path"),r=n.flatMap(et)[0];if(!r||r.points.length<2)return{out:z(t)};let i=r.points,s=r.closed,a=e.enumOf("side",["outside","inside"])==="inside",
|
|
2036
|
-
slice(1).reverse()]:[...i].reverse());let
|
|
2035
|
+
"in"),n=e.shapes("path"),r=n.flatMap(et)[0];if(!r||r.points.length<2)return{out:z(t)};let i=r.points,s=r.closed,a=e.enumOf("side",["outside","inside"])==="inside",f=(s?eA(i)>0:!0)===a;f&&(i=s?[i[0],...i.
|
|
2036
|
+
slice(1).reverse()]:[...i].reverse());let h=Sn(i,s);if(h<=0)return{out:z(t)};let m=e.enumOf("align",["start","middle","end","justify","words"]),d=e.num("position"),A=(f?1-d:d)*h,g=e.num("baseline"),x=e.
|
|
2037
2037
|
num("spacing"),v=e.num("wordGap"),b=[],w=[];for(let q of t)q.kind==="text"?b.push({shape:q,...Ku(e,q)}):w.push(q);let P=q=>q.width+Math.max(0,q.glyphs.length-1)*x,E=v;if(m==="words"){let q=b.reduce((te,ce)=>te+
|
|
2038
|
-
P(ce.run),0),X=s?b.length:b.length-1;E=X>0?(
|
|
2039
|
-
d:
|
|
2040
|
-
(
|
|
2041
|
-
if(X.d==="")continue;Q.push({id:e.shapeId(Y),kind:"path",d:X.d,style:ve,transform:Ae(
|
|
2038
|
+
P(ce.run),0),X=s?b.length:b.length-1;E=X>0?(h-q)/X:0}let T=[],M=0;for(let[q,{shape:X,run:te,outlined:ce}]of b.entries()){q>0&&(M+=E);let ue=[...X.text];for(let[ie,fe]of te.glyphs.entries())T.push({shape:X,
|
|
2039
|
+
d:fe.d,ch:ue[ie]??"",x:M+fe.x+ie*x,advance:fe.advance,outlined:ce});M+=P(te)}let R=M,S=A,_=0;if(m==="middle")S=A-R/2;else if(m==="end")S=A-R;else if(m==="justify"){let q=s?T.length:T.length-1;q>0&&(_=
|
|
2040
|
+
(h-R)/q)}let Q=[],Y=0;for(let[q,X]of T.entries()){let te=X.x+q*_+X.advance/2,{p:ce,t:ue}=tA(i,s,h,S+te),ie=Math.atan2(ue.y,ue.x)*180/Math.PI,fe=Ae(_e(ce.x,ce.y),jt(ie)),ve=X.shape.style;if(X.outlined){
|
|
2041
|
+
if(X.d==="")continue;Q.push({id:e.shapeId(Y),kind:"path",d:X.d,style:ve,transform:Ae(fe,_e(-X.advance/2,-g)),meta:e.meta(Y,["glyphs","text-on-path"])})}else{if(X.ch.trim()==="")continue;Q.push({id:e.shapeId(
|
|
2042
2042
|
Y),kind:"text",x:0,y:0,text:X.ch,fontSize:X.shape.fontSize,fontFamily:X.shape.fontFamily,fontWeight:X.shape.fontWeight,...X.shape.fontStretch!==void 0?{fontStretch:X.shape.fontStretch}:{},anchor:"midd\
|
|
2043
|
-
le",letterSpacing:0,style:ve,transform:Ae(
|
|
2043
|
+
le",letterSpacing:0,style:ve,transform:Ae(fe,_e(0,-g)),meta:e.meta(Y,["text-on-path"])})}Y++}let G=e.bool("passRef")?[...w,...n]:w;for(let q of G)Q.push({...q,id:e.shapeId(Y),meta:{...q.meta,index:Y}}),
|
|
2044
2044
|
Y++;return{out:z(Q)}}},rA=e=>t=>(J(t.by).base??"char")!==e,oA={type:"split-glyphs",label:"Split Glyphs",category:"modifier",keywords:["letters","characters","chars","words","explode","per character","\
|
|
2045
2045
|
split text"],description:"One shape per letter (or word), each where the font put it, so Select, Transform, Jitter, Stagger and the arrays work character by character. Tags each with its text, word an\
|
|
2046
2046
|
d line.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"by",label:"Split",type:"enum",default:"char",options:[{value:"char",label:"Characters"},{value:"word",label:"\
|
|
2047
2047
|
Words"}]},{key:"spaces",label:"Keep Spaces",type:"bool",default:!1,description:"Emit a (blank) shape for every space too, so index i is the position in the string. Off, spaces take no slot.",dimWhen:rA(
|
|
2048
2048
|
"char")},{key:"outlines",label:"Outline to Path",type:"bool",default:!1,description:"Hand out each piece as a real glyph path instead of native text \u2014 for Slice, Boolean and the draw-on Reveal. Needs \
|
|
2049
|
-
the font; until it lands the pieces stay text."}],cook(e){let t=e.shapes("in"),n=e.enumOf("by",["char","word"]),r=e.bool("spaces"),i=e.bool("outlines"),s=[],a=0,u=0,
|
|
2050
|
-
xt"){s.push({...
|
|
2051
|
-
let S=
|
|
2049
|
+
the font; until it lands the pieces stay text."}],cook(e){let t=e.shapes("in"),n=e.enumOf("by",["char","word"]),r=e.bool("spaces"),i=e.bool("outlines"),s=[],a=0,u=0,f=0;for(let h of t){if(h.kind!=="te\
|
|
2050
|
+
xt"){s.push({...h,id:e.shapeId(a),meta:{...h.meta,index:a}}),a++;continue}let m=f++,d=[...h.text];if(d.length===0)continue;let{run:A,outlined:g}=Ku(e,h),x=A.glyphs,v=A.width,b=g;if(x.length!==d.length){
|
|
2051
|
+
let S=h.fontSize*Ju;x=d.map((_,Q)=>({d:"",x:Q*(S+h.letterSpacing),advance:S})),v=x[x.length-1].x+S,b=!1}let w=h.anchor==="middle"?-v/2:h.anchor==="end"?-v:0,P=h.x+w,E=[],T,M=!1;d.forEach((S,_)=>{if(S.
|
|
2052
2052
|
trim()===""){M&&u++,M=!1,T=void 0,n==="char"&&r&&E.push({from:_,to:_+1,word:-1});return}M=!0,n==="char"?E.push({from:_,to:_+1,word:u}):T?T.to=_+1:E.push(T={from:_,to:_+1,word:u})}),M&&u++;let R=(S,_)=>[
|
|
2053
|
-
...
|
|
2054
|
-
tags:R(_,S.word)},te=_e(P+G,
|
|
2055
|
-
d??"";if(ue===""){_.trim()===""&&(s.push({...
|
|
2056
|
-
transform,te),meta:{...X,tags:[...X.tags,"glyphs"]}}),a++;continue}let ce={...
|
|
2057
|
-
capHeight:
|
|
2058
|
-
r",label:"Mirror"}],iA=ec.map(e=>e.value),sA=new Set(Ds.map(e=>e.value)),aA=e=>sA.has(e),
|
|
2053
|
+
...h.meta.tags??[],n==="char"?"glyph":"word",S,..._>=0?[`word:${_}`]:[],`line:${m}`];for(let S of E){let _=d.slice(S.from,S.to).join(""),Q=x[S.from],Y=x[S.to-1],G=Q.x,q=Y.x+Y.advance-G,X={...h.meta,index:a,
|
|
2054
|
+
tags:R(_,S.word)},te=_e(P+G,h.y);if(i&&b){let ue=n==="char"?Q.d:e.outline?.({text:_,family:h.fontFamily,weight:h.fontWeight??400,stretch:h.fontStretch,size:h.fontSize,letterSpacing:h.letterSpacing})?.
|
|
2055
|
+
d??"";if(ue===""){_.trim()===""&&(s.push({...h,id:e.shapeId(a),x:P+G,text:_,anchor:"start",letterSpacing:0,meta:X}),a++);continue}s.push({id:e.shapeId(a),kind:"path",d:ue,style:h.style,transform:Ae(h.
|
|
2056
|
+
transform,te),meta:{...X,tags:[...X.tags,"glyphs"]}}),a++;continue}let ce={...h,id:e.shapeId(a),x:P+G,text:_,anchor:"start",letterSpacing:n==="char"?0:h.letterSpacing,meta:X};h.metrics&&(ce.metrics={width:q,
|
|
2057
|
+
capHeight:h.metrics.capHeight}),s.push(ce),a++}}return{out:z(s)}}},ec=[...Ds,{value:"uppercase",label:"Uppercase"},{value:"lowercase",label:"Lowercase"},{value:"reverse",label:"Reverse"},{value:"mirro\
|
|
2058
|
+
r",label:"Mirror"}],iA=ec.map(e=>e.value),sA=new Set(Ds.map(e=>e.value)),aA=e=>sA.has(e),Os=e=>String(J(e.mode).base??"scramble"),lA=e=>!aA(Os(e)),ks=e=>{let t=Os(e);return t!=="scramble"&&t!=="flicke\
|
|
2059
2059
|
r"};function uA(e){if(ks(e))return!1;let t=J(e.reveal).base,n=J(e.rate).base;return typeof t=="number"&&t<1&&(typeof n!="number"||n>0)}var cA={type:"text-effect",label:"Text Effect",category:"modifier",
|
|
2060
2060
|
keywords:["scramble","decode","flicker","typewriter","uppercase","lowercase","reverse","mirror","flip","glitch text"],description:"Scramble, Flicker, Typewriter or Cut the text flowing through, on a R\
|
|
2061
2061
|
eveal of its own \u2014 or set its case, reverse it, or mirror it, glyphs and all. Counts every letter in the stream as one run, so it sweeps a split word letter by letter.",quickKey:"reveal",timeRoot:uA,
|
|
2062
2062
|
inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Mode",type:"enum",default:"scramble",options:[...ec]},{key:"reveal",label:"Reveal",type:"number",default:1,
|
|
2063
2063
|
max:1,step:.01,description:"Characters resolve first to last from 0 to 1, across every text shape in the stream. Below 0 nothing has resolved and the scramble keeps boiling. Wire a Seq or Ramp, or pre\
|
|
2064
2064
|
ss i to keyframe.",dimWhen:lA},{key:"rate",label:"Rate",type:"number",default:20,min:0,max:120,step:1,unit:"/s",description:"How often the unresolved letters redraw. 0 freezes them.",dimWhen:ks},{key:"\
|
|
2065
|
-
alphabet",label:"Alphabet",type:"string",default:ws,exposable:!1,glyphs:!0,description:"The glyphs Scramble boils through. Digits only for a numeric readout, block characters for a censor bar.",dimWhen:e=>
|
|
2065
|
+
alphabet",label:"Alphabet",type:"string",default:ws,exposable:!1,glyphs:!0,description:"The glyphs Scramble boils through. Digits only for a numeric readout, block characters for a censor bar.",dimWhen:e=>Os(
|
|
2066
2066
|
e)!=="scramble"},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the scramble and flicker pattern. Whole steps only; 0 = the node\u2019s own stream.",dimWhen:ks}],cook(e){
|
|
2067
|
-
let t=e.shapes("in"),n=e.enumOf("mode",iA),r=t.filter(u=>u.kind==="text");if(r.length===0)return{out:z(t)};if(n==="mirror"){let u=tt(r);if(!u)return{out:z(t)};let
|
|
2068
|
-
d=>d.kind==="text"?{...d,transform:Ae(
|
|
2069
|
-
"reverse")i=i.map(u=>[...u].reverse().join("")).reverse();else{let u=Math.max(0,Math.min(1,e.num("reveal"))),
|
|
2070
|
-
i=Zu(i,{reveal:u,mode:n,step:
|
|
2071
|
-
text:
|
|
2072
|
-
capHeight:u.metrics.capHeight})}return
|
|
2073
|
-
e[3]===1}function yi(e,t,n,r){let i=e.transform,[,,,,s,a]=i,u=(h,
|
|
2074
|
-
transform:be}}if(
|
|
2075
|
-
r.y,n)-a;if(t===n)return{...e,cx:
|
|
2076
|
-
cy:
|
|
2077
|
-
function
|
|
2067
|
+
let t=e.shapes("in"),n=e.enumOf("mode",iA),r=t.filter(u=>u.kind==="text");if(r.length===0)return{out:z(t)};if(n==="mirror"){let u=tt(r);if(!u)return{out:z(t)};let h=[-1,0,0,1,2*(u.x+u.w/2),0],m=t.map(
|
|
2068
|
+
d=>d.kind==="text"?{...d,transform:Ae(h,d.transform)}:d);return{out:z(m)}}let i=r.map(u=>u.text);if(n==="uppercase")i=i.map(u=>u.toUpperCase());else if(n==="lowercase")i=i.map(u=>u.toLowerCase());else if(n===
|
|
2069
|
+
"reverse")i=i.map(u=>[...u].reverse().join("")).reverse();else{let u=Math.max(0,Math.min(1,e.num("reveal"))),f=e.num("rate"),h=f>0?Math.floor(e.t*f):0,m=e.str("alphabet")||ws,d=Math.floor(e.num("seed"));
|
|
2070
|
+
i=Zu(i,{reveal:u,mode:n,step:h,alphabet:m,rand:(A,g)=>d===0?e.rand("decode",A,g):e.rand("decode",d,A,g)})}let s=0,a=t.map(u=>{if(u.kind!=="text")return u;let f=i[s++];if(f===u.text)return u;let h={...u,
|
|
2071
|
+
text:f};if(u.metrics){let m=e.outline?.measure?.({text:f,family:u.fontFamily,weight:u.fontWeight??400,stretch:u.fontStretch,size:u.fontSize,letterSpacing:u.letterSpacing});m&&(h.metrics={width:m.width,
|
|
2072
|
+
capHeight:u.metrics.capHeight})}return h});return{out:z(a)}}},Ai=[{value:"both",label:"Both"},{value:"x",label:"X only"},{value:"y",label:"Y only"}];function fA(e){return e[0]===1&&e[1]===0&&e[2]===0&&
|
|
2073
|
+
e[3]===1}function yi(e,t,n,r){let i=e.transform,[,,,,s,a]=i,u=(f,h,m)=>h+(f-h)*m;if(e.kind==="polyline"){let f=e.points.map(h=>{let m=un(i,h);return{x:u(m.x,r.x,t),y:u(m.y,r.y,n)}});return{...e,points:f,
|
|
2074
|
+
transform:be}}if(fA(i))switch(e.kind){case"rect":{let f=u(e.x+s,r.x,t)-s,h=u(e.y+a,r.y,n)-a;return{...e,x:f,y:h,w:e.w*t,h:e.h*n,rx:e.rx*Math.min(t,n)}}case"circle":{let f=u(e.cx+s,r.x,t)-s,h=u(e.cy+a,
|
|
2075
|
+
r.y,n)-a;if(t===n)return{...e,cx:f,cy:h,r:e.r*t};let{r:m,kind:d,...A}=e;return{...A,kind:"ellipse",cx:f,cy:h,rx:e.r*t,ry:e.r*n}}case"ellipse":{let f=u(e.cx+s,r.x,t)-s,h=u(e.cy+a,r.y,n)-a;return{...e,cx:f,
|
|
2076
|
+
cy:h,rx:e.rx*t,ry:e.ry*n}}case"arc":if(t===n){let f=u(e.cx+s,r.x,t)-s,h=u(e.cy+a,r.y,n)-a;return{...e,cx:f,cy:h,r:e.r*t}}break}return{...e,transform:Ae(en({tx:0,ty:0,rotation:0,sx:t,sy:n,pivot:r}),i)}}
|
|
2077
|
+
function Ns(e){if(e.kind==="circle"||e.kind==="arc"||e.kind==="ellipse")return un(e.transform,{x:e.cx,y:e.cy});let t=$e(e);return t?Ue(t):{x:0,y:0}}var gi={key:"deal",label:"Deal",type:"bool",default:!1,
|
|
2078
2078
|
description:"One input shape per copy, cycling \u2014 the first copy gets the first shape, the second the second \u2014 each centred where the whole input would sit. Off repeats the whole input at every copy."};
|
|
2079
2079
|
function bi(e,t){if(!t||e.length===0)return()=>e;let n=tt(e),r=n?Ue(n):void 0,i=e.map(s=>{let a=r?$e(s):void 0;if(!a||!r)return s;let u=Ue(a);return{...s,transform:Ae(_e(r.x-u.x,r.y-u.y),s.transform)}});
|
|
2080
|
-
return s=>[i[s%i.length]]}var tc=[{value:"shape",label:"Shape centre"},{value:"canvas",label:"Canvas origin"},{value:"custom",label:"Custom point"}],
|
|
2080
|
+
return s=>[i[s%i.length]]}var tc=[{value:"shape",label:"Shape centre"},{value:"canvas",label:"Canvas origin"},{value:"custom",label:"Custom point"}],hA=[...tc,{value:"ref",label:"Ref point"}],pA=["sha\
|
|
2081
2081
|
pe","canvas","custom","ref"];function tu(e){return J(e.pivot).base!=="custom"}function ai(e,t,n,r,i){if(t==="canvas")return{x:0,y:0};if(t==="custom")return{x:e.num("pivotX",r,i),y:e.num("pivotY",r,i)};
|
|
2082
2082
|
let s=n?$e(n):void 0;return s?Ue(s):{x:0,y:0}}function nc(e,t,n,r){return e==="shape"||e==="ref"?t:{x:t.x-n,y:t.y-r}}var rc=[{key:"pivot",label:"Pivot",type:"enum",default:"shape",options:tc},{key:"pi\
|
|
2083
2083
|
votX",label:"Pivot X",type:"number",default:0,step:.5,unit:"px",dimWhen:tu},{key:"pivotY",label:"Pivot Y",type:"number",default:0,step:.5,unit:"px",dimWhen:tu},{key:"showPivot",label:"Show Pivot",type:"\
|
|
2084
|
-
bool",default:!1,exposable:!1,description:"Mark the pivot on the artboard \u2014 even when it sits outside the canvas. A custom pivot can be dragged there."}];var dA=rc.map(e=>e.key==="pivot"&&e.type==="enum"?{...e,default:"canvas",options:
|
|
2084
|
+
bool",default:!1,exposable:!1,description:"Mark the pivot on the artboard \u2014 even when it sits outside the canvas. A custom pivot can be dragged there."}];var dA=rc.map(e=>e.key==="pivot"&&e.type==="enum"?{...e,default:"canvas",options:hA,description:"What Rotate and Scale turn about, and the point of the shape a Ref places. Ref point is the shape\u2019s cen\
|
|
2085
2085
|
tre, chosen for you when a wire lands on Ref."}:e),Zo=(e,t)=>t!==void 0&&!t.has("ref"),oc={corner:{fx:0,fy:0},top:{fx:.5,fy:0},"top-right":{fx:1,fy:0},left:{fx:0,fy:.5},center:{fx:.5,fy:.5},right:{fx:1,
|
|
2086
2086
|
fy:.5},"bottom-left":{fx:0,fy:1},bottom:{fx:.5,fy:1},"bottom-right":{fx:1,fy:1}},mA=Object.keys(oc),AA={type:"transform",label:"Transform",category:"modifier",description:"Move, rotate and scale about\
|
|
2087
2087
|
a pivot. Wire a Ref stream and the shapes are placed relative to it instead: the pivot switches to Ref point and lands on a point of the Ref\u2019s bounds, Move X/Y offset from there \u2014 a marker on a selec\
|
|
@@ -2094,49 +2094,49 @@ Ref",options:[{value:"corner",label:"Top Left"},{value:"top",label:"Top"},{value
|
|
|
2094
2094
|
es the shape where it was authored, 1 lands it on the point. Wire a Seq or Mapping in to glide it there; past 0\u20131 it overshoots.",dimWhen:Zo},{key:"refEach",label:"Per Shape",type:"bool",default:!1,
|
|
2095
2095
|
group:"Ref",description:"Off: one frame, the whole Ref stream\u2019s bounds. On: shape i is placed on Ref shape i (wrapping), so an array of markers lands one per selected letter.",dimWhen:Zo},{key:"p\
|
|
2096
2096
|
assRef",label:"Show Ref",type:"bool",default:!1,group:"Ref",description:"Also emit the Ref shapes, like a Merge \u2014 the letter and the mark on it leave in one stream.",dimWhen:Zo}],cook(e){let t=e.
|
|
2097
|
-
shapes("in"),n=t.length,r=e.enumOf("pivot",pA),i=e.shapes("ref");if(i.length>0){let a=e.enumOf("refPoint",mA),u=e.bool("refEach"),
|
|
2097
|
+
shapes("in"),n=t.length,r=e.enumOf("pivot",pA),i=e.shapes("ref");if(i.length>0){let a=e.enumOf("refPoint",mA),u=e.bool("refEach"),f=tt(i),h=t.map((d,A)=>{let g=u?$e(i[A%i.length]):f;if(!g)return d;let{
|
|
2098
2098
|
fx:x,fy:v}=oc[a],b=ai(e,r,d,A,n),w=e.num("refMix",A,n),P={x:b.x+w*(g.x+x*g.w-b.x),y:b.y+w*(g.y+v*g.h-b.y)},E=e.num("tx",A,n),T=e.num("ty",A,n),M=e.num("rotation",A,n),R=e.num("sx",A,n),S=e.num("sy",A,
|
|
2099
2099
|
n),_=_e(P.x+E,P.y+T);return M!==0&&(_=Ae(_,jt(M))),(R!==1||S!==1)&&(_=Ae(_,Kt(R,S))),_=Ae(_,_e(-b.x,-b.y)),{...d,transform:Ae(_,d.transform)}}),m=e.bool("passRef")?i.map((d,A)=>({...d,meta:{...d.meta,
|
|
2100
|
-
index:
|
|
2101
|
-
"sy",u,n),pivot:nc(r,m,h
|
|
2100
|
+
index:h.length+A}})):[];return{out:z([...h,...m])}}let s=t.map((a,u)=>{let f=e.num("tx",u,n),h=e.num("ty",u,n),m=ai(e,r,a,u,n),d=en({tx:f,ty:h,rotation:e.num("rotation",u,n),sx:e.num("sx",u,n),sy:e.num(
|
|
2101
|
+
"sy",u,n),pivot:nc(r,m,f,h)});return{...a,transform:Ae(d,a.transform)}});return{out:z(s)}}},yA={type:"array-linear",label:"Array Linear",category:"modifier",description:"Repeat the input along a strai\
|
|
2102
2102
|
ght line.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:5,min:0,max:2048,description:"Copies along the line. 0 = nothin\
|
|
2103
2103
|
g \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"stepX",label:"Step X",type:"number",default:40,step:.5,unit:"px"},{key:"stepY",label:"Step Y",type:"number",default:0,step:.5,unit:"px"},{
|
|
2104
2104
|
key:"origin",label:"Origin",type:"enum",default:"center",options:[{value:"start",label:"Start (grow along step)"},{value:"center",label:"Center (grow outwards)"}],description:"Center spreads the row b\
|
|
2105
2105
|
oth ways around the input; Start puts the first copy on the input and grows along the step."},{key:"rotationStep",label:"Rotate Step",type:"number",default:0,step:1,unit:"deg"},{key:"scaleStep",label:"\
|
|
2106
2106
|
Scale Step",type:"number",default:1,step:.01,description:"Multiplied per copy."},gi,...rc],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(n===0)return{out:z([])};let r=e.enumOf("pivot",[
|
|
2107
|
-
"shape","canvas","custom"]),i=e.bool("deal"),s=bi(t,i),a=[],u=t.map((d,A)=>ai(e,r,d,A,t.length)),
|
|
2108
|
-
epY"):0;for(let d=0;d<n;d++){let A={k:d,count:n},g=
|
|
2107
|
+
"shape","canvas","custom"]),i=e.bool("deal"),s=bi(t,i),a=[],u=t.map((d,A)=>ai(e,r,d,A,t.length)),f=e.enumOf("origin",["start","center"])==="center",h=f?-(n-1)/2*e.num("stepX"):0,m=f?-(n-1)/2*e.num("st\
|
|
2108
|
+
epY"):0;for(let d=0;d<n;d++){let A={k:d,count:n},g=h+e.num("stepX",d,n,A)*d,x=m+e.num("stepY",d,n,A)*d,v=e.num("rotationStep",d,n,A)*d,b=e.num("scaleStep",d,n,A)**d,w=s(d);for(let[P,E]of w.entries()){
|
|
2109
2109
|
let T=a.length+P,M=i?ai(e,r,E,P,w.length):u[P],R=nc(r,M,g,x),S=b!==1?yi(E,b,b,R):E,_=en({tx:g,ty:x,rotation:v,pivot:R});a.push({...S,id:e.shapeId(T),transform:Ae(_,S.transform),meta:{...E.meta,index:T}})}}
|
|
2110
|
-
return{out:z(a)}}},gA=[AA,yA],ic=e=>uo(e.fontFamily),bA=e=>
|
|
2110
|
+
return{out:z(a)}}},gA=[AA,yA],ic=e=>uo(e.fontFamily),bA=e=>hs(e.fontFamily,e.fontWeight??400,e.fontStretch).variation!==void 0,vA=e=>ic(e)||bA(e),xA=()=>!0;function IA(e,t){let n=r=>r.some(i=>i.kind===
|
|
2111
2111
|
"text"?t(i):i.kind==="group"&&n(i.children));return e.layers.some(r=>n(r.shapes))}function Qs(e,t,n){if(e.kind==="group"){let Q=e.children.map(Y=>Qs(Y,t,n));return Q.some((Y,G)=>Y!==e.children[G])?{...e,children:Q}:e}if(e.kind!=="text"||!n(e))return e;let r=e.fontWeight??400,i=t({text:e.
|
|
2112
|
-
text,family:e.fontFamily,weight:r,stretch:e.fontStretch,size:e.fontSize,letterSpacing:e.letterSpacing});if(!i)return e;let s=e.anchor==="middle"?-i.width/2:e.anchor==="end"?-i.width:0,[a,u,h,
|
|
2113
|
-
transform,A=e.x+s,g=e.y,{x,y:v,text:b,fontSize:w,fontFamily:P,fontWeight:E,fontStretch:T,anchor:M,letterSpacing:R,metrics:S,..._}=e;return{..._,kind:"path",d:i.d,transform:[a,u,h,
|
|
2112
|
+
text,family:e.fontFamily,weight:r,stretch:e.fontStretch,size:e.fontSize,letterSpacing:e.letterSpacing});if(!i)return e;let s=e.anchor==="middle"?-i.width/2:e.anchor==="end"?-i.width:0,[a,u,f,h,m,d]=e.
|
|
2113
|
+
transform,A=e.x+s,g=e.y,{x,y:v,text:b,fontSize:w,fontFamily:P,fontWeight:E,fontStretch:T,anchor:M,letterSpacing:R,metrics:S,..._}=e;return{..._,kind:"path",d:i.d,transform:[a,u,f,h,a*A+f*g+m,u*A+h*g+d],
|
|
2114
2114
|
meta:{...e.meta,tags:[...e.meta.tags??[],"glyphs"]}}}function sc(e,t,n=!1){return Qs(e,t,n?xA:vA)}function wA(e,t,n){return!t||!IA(e,n)?e:{...e,layers:e.layers.map(r=>{let i=r.shapes.map(s=>Qs(s,t,n));
|
|
2115
2115
|
return i.some((s,a)=>s!==r.shapes[a])?{...r,shapes:i}:r})}}function ac(e,t){return wA(e,t,ic)}function lc(e,t){return e.at??(t==="center"?{x:-e.width/2,y:-e.height/2}:{x:0,y:0})}function kA(e){return e.origin==="center"?{x:-e.width/2,y:-e.height/2,w:e.width,h:e.height}:{x:0,y:0,w:e.width,h:e.height}}
|
|
2116
2116
|
function uc(e,t){let n=tt(e.shapes);if(!e.texture)return n;let r=lc(e.texture,t),i={x:r.x,y:r.y,w:e.texture.width,h:e.texture.height};return n?Gi(n,i):i}function CA(e,t,n,r){if(e==="canvas")return{x:0,
|
|
2117
2117
|
y:0};if(e==="custom")return r;if(e==="shape"){let i=uc(t,n.origin);return i?Ue(i):lr(n)}return lr(n)}function cc(e){return e.kind==="image"?!0:e.kind==="group"?e.children.some(cc):typeof e.style.fill==
|
|
2118
|
-
"object"||typeof e.style.stroke=="object"}function
|
|
2119
|
-
e":"vector",
|
|
2118
|
+
"object"||typeof e.style.stroke=="object"}function fc(e){let t=[],n=e.texture?e.textureAt??0:e.shapes.length,r=()=>t.length===0?e.id:`${e.id}/${t.length}`,i=()=>t[t.length-1],s=a=>{let u=cc(a)?"pictur\
|
|
2119
|
+
e":"vector",f=i();f&&f.kind===u?f.shapes.push(a):t.push({kind:u,id:r(),shapes:[a]})};for(let a=0;a<e.shapes.length;a++){if(a===n&&e.texture){let u=i();u&&u.kind==="picture"?(u.texture=e.texture,u.textureAt=
|
|
2120
2120
|
u.shapes.length):t.push({kind:"picture",id:r(),shapes:[],texture:e.texture})}s(e.shapes[a])}if(e.texture&&n>=e.shapes.length){let a=i();a&&a.kind==="picture"?(a.texture=e.texture,a.textureAt=a.shapes.
|
|
2121
2121
|
length):t.push({kind:"picture",id:r(),shapes:[],texture:e.texture})}return t}function EA(e,t){let n=$e(e),r=ro(t,n?Ue(n):{x:0,y:0});return r?{...e,transform:Ae(r,e.transform)}:void 0}function Cs(e,t,n,r){
|
|
2122
2122
|
let i=Ae(t,e.transform);switch(e.kind){case"group":{let s=e.children.map(a=>Cs(a,i,n,r)).filter(a=>a!==void 0);return{...e,transform:be,children:s}}case"text":{if(r){let a=sc(e,r,!0);if(a.kind==="path")
|
|
2123
2123
|
return Cs(a,t,n,r)}let s=ro(n,un(i,{x:e.x,y:e.y}));return s?{...e,transform:Ae(s,i)}:void 0}case"image":{let s=ro(n,un(i,{x:e.x+e.w/2,y:e.y+e.h/2}));return s?{...e,transform:Ae(s,i)}:void 0}default:{let s=et(
|
|
2124
|
-
{...e,transform:i}).flatMap(a=>Hi(n,a.points,a.closed).map(u=>({points:u,closed:a.closed})));return s.length===0?void 0:{id:e.id,kind:"path",d:
|
|
2125
|
-
let r=La(t);return r?e.map(i=>({...i,transform:Ae(r,i.transform)})):e.map(i=>Cs(i,be,t,n)).filter(i=>i!==void 0)}var
|
|
2124
|
+
{...e,transform:i}).flatMap(a=>Hi(n,a.points,a.closed).map(u=>({points:u,closed:a.closed})));return s.length===0?void 0:{id:e.id,kind:"path",d:Oa(s),transform:be,style:e.style,meta:e.meta}}}}function Es(e,t,n){
|
|
2125
|
+
let r=La(t);return r?e.map(i=>({...i,transform:Ae(r,i.transform)})):e.map(i=>Cs(i,be,t,n)).filter(i=>i!==void 0)}var hc=class{constructor(e){mt(this,"limit");mt(this,"map",new Map);this.limit=e}get(e){
|
|
2126
2126
|
let t=this.map.get(e);return t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){for(Ke()?.retain(t.tex),this.map.set(e,t);this.map.size>this.limit;){let n=this.map.entries().next().value;if(!n)break;
|
|
2127
|
-
this.map.delete(n[0]),Ke()?.release(n[1].tex)}return t}},nu=new
|
|
2128
|
-
textureAt??"-"}|${n}|${t.x},${t.y},${t.w},${t.h}`,a=nu.get(s);if(a)return a;let u=n===1?_e(-t.x,-t.y):Ae(Kt(n),_e(-t.x,-t.y)),
|
|
2127
|
+
this.map.delete(n[0]),Ke()?.release(n[1].tex)}return t}},nu=new hc(64),ru=new hc(64),Jo=2,ou=4,SA=2;function BA(e,t,n,r,i){let s=`${e.shapes.map(x=>cr(x)).join(",")}|${e.texture?cr(e.texture):"-"}|${e.
|
|
2128
|
+
textureAt??"-"}|${n}|${t.x},${t.y},${t.w},${t.h}`,a=nu.get(s);if(a)return a;let u=n===1?_e(-t.x,-t.y):Ae(Kt(n),_e(-t.x,-t.y)),f=e.shapes.map(x=>({...x,transform:Ae(u,x.transform)})),h=Math.max(1,Math.
|
|
2129
2129
|
ceil(t.w*n)),m=Math.max(1,Math.ceil(t.h*n)),d;if(e.texture){let x=lc(e.texture,r.origin),v={x:(x.x-t.x)*n,y:(x.y-t.y)*n},b=n===1?e.texture:jo(e.texture,e.texture.width*n,e.texture.height*n);d=PA(b,v)}
|
|
2130
|
-
let A={id:e.id,name:"posed",opacity:1,visible:!0,order:0,shapes:
|
|
2130
|
+
let A={id:e.id,name:"posed",opacity:1,visible:!0,order:0,shapes:f};d&&(A.texture=d,e.textureAt!==void 0&&(A.textureAt=e.textureAt));let g=i.rasterize({width:h,height:m,background:"none",origin:"top-le\
|
|
2131
2131
|
ft",layers:[A]},{x:t.x,y:t.y});return nu.set(s,{tex:g,x:t.x,y:t.y,scale:n})}function PA(e,t){let n=Ke();return n?.resident(e)?n.copy(e,t):{...e,at:t}}function iu(e){let t=Math.floor(e.x),n=Math.floor(
|
|
2132
2132
|
e.y);return{x:t,y:n,w:Math.ceil(e.x+e.w)-t,h:Math.ceil(e.y+e.h)-n}}function su(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.w,t.x+t.w),s=Math.min(e.y+e.h,t.y+t.h);return i>n&&s>r?
|
|
2133
|
-
{x:n,y:r,w:i-n,h:s-r}:void 0}function MA(e,t,n,r,i,s,a){let u={h:n},
|
|
2134
|
-
void 0),Y={...t,id:e.id,shapes:Q,plane:u};return e.texture&&(Y.texture=e.texture,e.textureAt!==void 0&&(Y.textureAt=e.textureAt)),Y}let
|
|
2135
|
-
let d=kA(i),A={x:d.x-d.w,y:d.y-d.h,w:d.w*3,h:d.h*3},g={x:m.x-Jo,y:m.y-Jo,w:m.w+2*Jo,h:m.h+2*Jo},x=su(g,A);if(!x)return
|
|
2133
|
+
{x:n,y:r,w:i-n,h:s-r}:void 0}function MA(e,t,n,r,i,s,a){let u={h:n},f=s.provided?.(e.id);if(f)return{...t,id:e.id,shapes:[],texture:f,plane:u};if(!s.rasterize){let Q=e.shapes.map(G=>EA(G,n)).filter(G=>G!==
|
|
2134
|
+
void 0),Y={...t,id:e.id,shapes:Q,plane:u};return e.texture&&(Y.texture=e.texture,e.textureAt!==void 0&&(Y.textureAt=e.textureAt)),Y}let h={...t,id:e.id,shapes:[],plane:u},m=uc(e,i.origin);if(!m)return h;
|
|
2135
|
+
let d=kA(i),A={x:d.x-d.w,y:d.y-d.h,w:d.w*3,h:d.h*3},g={x:m.x-Jo,y:m.y-Jo,w:m.w+2*Jo,h:m.h+2*Jo},x=su(g,A);if(!x)return h;let v=iu(x),b=Na(n),w=b&&Wa(n,v),P=w&&su(w,d);if(!b||!P)return h;let E=iu(P),T=a?
|
|
2136
2136
|
1:Math.min(SA,Math.max(1,Math.ceil((Fa(n,r.pivot)??1)*ou)/ou)),M=BA(e,v,T,i,s),R=`${cr(M.tex)}|${n.join(",")}|${E.x},${E.y},${E.w},${E.h}`,S=ru.get(R),_=S?S.tex:ru.set(R,{tex:Dl(M.tex,{x:M.x,y:M.y,scale:M.
|
|
2137
|
-
scale},b,E)}).tex;return{...t,id:e.id,shapes:[],texture:_,plane:u}}function _A(e,t,n,r=!1){let i=e.pose;if(!i||!e.visible)return[e];let s=no(i,t),{pose:a,plane:u,shapes:
|
|
2138
|
-
return
|
|
2139
|
-
e.pivot).base??"shape")!=="custom",DA=["shape","center","canvas","custom"],
|
|
2137
|
+
scale},b,E)}).tex;return{...t,id:e.id,shapes:[],texture:_,plane:u}}function _A(e,t,n,r=!1){let i=e.pose;if(!i||!e.visible)return[e];let s=no(i,t),{pose:a,plane:u,shapes:f,texture:h,textureAt:m,id:d,...A}=e;
|
|
2138
|
+
return fc(e).map(g=>g.kind==="vector"?{...A,id:g.id,shapes:Es(g.shapes,s,n.outline),plane:{h:s}}:MA(g,A,s,i,t,n,r))}var TA=e=>J(e.camera).base==="own",RA=e=>(J(e.plane).base??"stream")!=="shape",au=e=>(J(
|
|
2139
|
+
e.pivot).base??"shape")!=="custom",DA=["shape","center","canvas","custom"],OA={type:"transform3d",label:"Transform 3D",category:"modifier",description:"Poses the stream as a plane under the camera: mo\
|
|
2140
2140
|
ve in X, Y and Z, turn about X, Y and Z, scale \u2014 one plane for the stream, or one per shape.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"plane",label:"P\
|
|
2141
2141
|
lane",type:"enum",default:"stream",options:[{value:"stream",label:"One for the stream"},{value:"shape",label:"One per shape"}],description:"One plane carrying every shape, or each shape on a plane of \
|
|
2142
2142
|
its own \u2014 then every value below resolves per shape, so a jitter or a stagger turns them one by one."},{key:"order",label:"Order",type:"enum",default:"stack",options:[{value:"stack",label:"As the\
|
|
@@ -2155,20 +2155,20 @@ Follow the Canvas\u2019s Perspective \u2014 one camera for the document \u2014 o
|
|
|
2155
2155
|
px",dimWhen:e=>!TA(e),description:"Own perspective only: the eye\u2019s distance from the frame; smaller is a wider lens, 0 is orthographic."}],cook(e){let t=e.shapes("in");if(t.length===0)return{out:z(
|
|
2156
2156
|
t)};let r={perspective:e.enumOf("camera",["canvas","own"])==="own"?Math.max(0,e.num("perspective")):e.canvas.perspective??1500,width:e.canvas.w,height:e.canvas.h,origin:e.canvas.origin},i=e.enumOf("pi\
|
|
2157
2157
|
vot",DA),s=t.length,a=(x,v)=>i==="canvas"?{x:0,y:0}:i==="custom"?{x:e.num("pivotX",x,s),y:e.num("pivotY",x,s)}:i==="shape"&&v?Ue(v):lr(r),u=(x,v,b)=>({x:e.num("posX",x,v),y:e.num("posY",x,v),z:e.num("\
|
|
2158
|
-
posZ",x,v),rx:e.num("rotX",x,v),ry:e.num("rotY",x,v),rz:e.num("rotZ",x,v),sx:e.num("scaleX",x,v)/100,sy:e.num("scaleY",x,v)/100,pivot:a(x,b)}),
|
|
2159
|
-
w={x:b.x-
|
|
2160
|
-
void 0?w:{...w,meta:{...w.meta,depth:M}}});if(e.enumOf("plane",["stream","shape"])==="stream"){let x=tt(t),v=u(0,1,x);if(to(v))return{out:z(t)};let{model:b,faces:w}=m(v,x);return
|
|
2161
|
-
d(Es(t,no(v,r),e.outline),t,b))}}let A=e.enumOf("order",["stack","depth"])==="depth",g=[];return t.forEach((x,v)=>{let b=$e(x),w=u(v,s,b),{model:P,depth:E,faces:T}=m(w,b);
|
|
2162
|
-
w)?[x]:d(Es([x],no(w,r),e.outline),[x],P)})}),A&&g.sort((x,v)=>v.depth-x.depth),{out:z(g.flatMap(x=>x.shapes))}}},
|
|
2158
|
+
posZ",x,v),rx:e.num("rotX",x,v),ry:e.num("rotY",x,v),rz:e.num("rotZ",x,v),sx:e.num("scaleX",x,v)/100,sy:e.num("scaleY",x,v)/100,pivot:a(x,b)}),f=e.bool("hideBack"),h=lr(r),m=(x,v)=>{let b=v?Ue(v):x.pivot,
|
|
2159
|
+
w={x:b.x-h.x,y:b.y-h.y},P=qi(x,h);return{model:P,depth:Fo(P,w),faces:Xa(P,w,r.perspective)}},d=(x,v,b)=>x.map((w,P)=>{let E=$e(v[P]??w),T=E?Ue(E):h,M=Fo(b,{x:T.x-h.x,y:T.y-h.y});return M===0&&w.meta.depth===
|
|
2160
|
+
void 0?w:{...w,meta:{...w.meta,depth:M}}});if(e.enumOf("plane",["stream","shape"])==="stream"){let x=tt(t),v=u(0,1,x);if(to(v))return{out:z(t)};let{model:b,faces:w}=m(v,x);return f&&!w?{out:z([])}:{out:z(
|
|
2161
|
+
d(Es(t,no(v,r),e.outline),t,b))}}let A=e.enumOf("order",["stack","depth"])==="depth",g=[];return t.forEach((x,v)=>{let b=$e(x),w=u(v,s,b),{model:P,depth:E,faces:T}=m(w,b);f&&!T||g.push({depth:E,shapes:to(
|
|
2162
|
+
w)?[x]:d(Es([x],no(w,r),e.outline),[x],P)})}),A&&g.sort((x,v)=>v.depth-x.depth),{out:z(g.flatMap(x=>x.shapes))}}},NA=96,QA=[{value:"round",label:"Round"},{value:"chamfer",label:"Chamfer"},{value:"notc\
|
|
2163
2163
|
h",label:"Notch"}],LA=[{value:"all",label:"All"},{value:"convex",label:"Convex"},{value:"concave",label:"Concave"},{value:"every-nth",label:"Every Nth"},{value:"list",label:"By index"}],ms=e=>t=>(J(t.
|
|
2164
2164
|
which).base??"all")!==e;function FA(e,t){let n=[];for(let r of e){let i=n[n.length-1];i&&Math.abs(i.x-r.x)<1e-9&&Math.abs(i.y-r.y)<1e-9||n.push(r)}if(t&&n.length>1){let r=n[0],i=n[n.length-1];Math.abs(
|
|
2165
|
-
r.x-i.x)<1e-9&&Math.abs(r.y-i.y)<1e-9&&n.pop()}return n}function YA(e,t,n){let r=e.length;if(r<3)return[];let i=0,s=
|
|
2166
|
-
m.x)};if(t){let
|
|
2167
|
-
for(let
|
|
2168
|
-
y:(A.y-m.y)/x},w=Math.max(-1,Math.min(1,v.x*b.x+v.y*b.y)),P=Math.acos(w);180-P*180/Math.PI<n||P<1e-6||a.push({at:
|
|
2165
|
+
r.x-i.x)<1e-9&&Math.abs(r.y-i.y)<1e-9&&n.pop()}return n}function YA(e,t,n){let r=e.length;if(r<3)return[];let i=0,s=h=>{let m=e[h],d=e[(h-1+r)%r],A=e[(h+1)%r];return(m.x-d.x)*(A.y-m.y)-(m.y-d.y)*(A.x-
|
|
2166
|
+
m.x)};if(t){let h=0;for(let m=0;m<r;m++){let d=e[m],A=e[(m+1)%r];h+=d.x*A.y-A.x*d.y}i=Math.sign(h)}else{let h=0;for(let m=1;m<r-1;m++)h+=Math.sign(s(m));i=Math.sign(h)||1}let a=[],u=t?0:1,f=t?r-1:r-2;
|
|
2167
|
+
for(let h=u;h<=f;h++){let m=e[h],d=e[(h-1+r)%r],A=e[(h+1)%r],g=Math.hypot(d.x-m.x,d.y-m.y),x=Math.hypot(A.x-m.x,A.y-m.y);if(g<1e-9||x<1e-9)continue;let v={x:(d.x-m.x)/g,y:(d.y-m.y)/g},b={x:(A.x-m.x)/x,
|
|
2168
|
+
y:(A.y-m.y)/x},w=Math.max(-1,Math.min(1,v.x*b.x+v.y*b.y)),P=Math.acos(w);180-P*180/Math.PI<n||P<1e-6||a.push({at:h,u:v,v:b,lenA:g,lenB:x,interior:P,convex:Math.sign(s(h))===i})}return a}function WA(e,t,n,r){
|
|
2169
2169
|
let i=Math.min(r,t.lenA/2,t.lenB/2);if(i<=1e-9)return[e];let s={x:e.x+t.u.x*i,y:e.y+t.u.y*i},a={x:e.x+t.v.x*i,y:e.y+t.v.y*i};if(n==="chamfer")return[s,a];if(n==="notch")return[s,{x:e.x+(t.u.x+t.v.x)*i,
|
|
2170
|
-
y:e.y+(t.u.y+t.v.y)*i},a];let u=t.interior/2,
|
|
2171
|
-
y-A,s.x-d),v=Math.atan2(a.y-A,a.x-d);for(;v-x>Math.PI;)v-=Math.PI*2;for(;x-v>Math.PI;)v+=Math.PI*2;let b=Math.abs(v-x),w=Math.max(2,Math.ceil(b/(Math.PI*2)*
|
|
2170
|
+
y:e.y+(t.u.y+t.v.y)*i},a];let u=t.interior/2,f={x:t.u.x+t.v.x,y:t.u.y+t.v.y},h=Math.hypot(f.x,f.y);if(h<1e-9)return[s,a];let m=i/Math.cos(u),d=e.x+f.x/h*m,A=e.y+f.y/h*m,g=i*Math.tan(u),x=Math.atan2(s.
|
|
2171
|
+
y-A,s.x-d),v=Math.atan2(a.y-A,a.x-d);for(;v-x>Math.PI;)v-=Math.PI*2;for(;x-v>Math.PI;)v+=Math.PI*2;let b=Math.abs(v-x),w=Math.max(2,Math.ceil(b/(Math.PI*2)*NA-1e-6)),P=[];for(let E=0;E<=w;E++){let T=x+
|
|
2172
2172
|
(v-x)*E/w;P.push({x:d+g*Math.cos(T),y:A+g*Math.sin(T)})}return P}var XA={type:"corners",label:"Corners",category:"modifier",description:"Round, chamfer or notch the corners of any outline \u2014 pick which\
|
|
2173
2173
|
, size each.",quickKey:"size",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"style",label:"Style",type:"enum",default:"round",options:QA,description:"Round is a \
|
|
2174
2174
|
tangent fillet, Chamfer a straight cut, Notch a step in and out \u2014 the HUD corner."},{key:"size",label:"Size",type:"number",default:8,min:0,step:.5,unit:"px",description:"Setback along each edge \u2014\
|
|
@@ -2177,13 +2177,13 @@ Which corners to cut. Convex turns with the outline, Concave against it; Every N
|
|
|
2177
2177
|
"every-nth")},{key:"offset",label:"Offset",type:"int",default:0,min:0,max:500,dimWhen:ms("every-nth")},{key:"list",label:"Indices",type:"string",default:"0, 2",exposable:!1,description:"Comma-separate\
|
|
2178
2178
|
d corner indices, per shape.",dimWhen:ms("list")},{key:"invert",label:"Invert",type:"bool",default:!1},{key:"minTurn",label:"Min Turn",type:"number",default:20,min:0,max:179,step:1,unit:"deg",description:"\
|
|
2179
2179
|
Vertices turning less than this are not corners \u2014 flattened arcs stay arcs."}],cook(e){let t=e.shapes("in"),n=e.enumOf("style",["round","chamfer","notch"]),r=e.enumOf("which",["all","convex","con\
|
|
2180
|
-
cave","every-nth","list"]),i=Math.max(1,e.int("n")),s=e.int("offset"),a=e.bool("invert"),u=e.num("minTurn"),
|
|
2181
|
-
m))),
|
|
2180
|
+
cave","every-nth","list"]),i=Math.max(1,e.int("n")),s=e.int("offset"),a=e.bool("invert"),u=e.num("minTurn"),f=new Set(e.str("list").split(/[\s,;]+/).map(m=>Number.parseInt(m,10)).filter(m=>Number.isFinite(
|
|
2181
|
+
m))),h=[];for(let m of t){if(m.kind==="text"||m.kind==="image"){h.push(m);continue}let d=et(m).map(T=>({points:FA(T.points,T.closed),closed:T.closed})),A=d.map(T=>YA(T.points,T.closed,u)),g=A.reduce((T,M)=>T+
|
|
2182
2182
|
M.length,0),x=0,v=A.map(T=>{let M=T.filter((R,S)=>{let _=x+S,Q;switch(r){case"all":Q=!0;break;case"convex":Q=R.convex;break;case"concave":Q=!R.convex;break;case"every-nth":Q=_>=s&&(_-s)%i===0;break;case"\
|
|
2183
|
-
list":Q=
|
|
2184
|
-
_),g),Y=WA(T.points[_.at],_,n,Q);Y.length>1&&(R.set(_.at,Y),P=!0)}if(R.size===0)return T;let S=[];return T.points.forEach((_,Q)=>S.push(...R.get(Q)??[_])),{points:S,closed:T.closed}});if(!P){
|
|
2185
|
-
continue}for(let T of E)T.points.length<2||
|
|
2186
|
-
[],"corners"]}})}return{out:z(
|
|
2183
|
+
list":Q=f.has(_);break}return a?!Q:Q});return x+=T.length,M}),b=new Map,w=0;for(let T of A)for(let M of T)b.set(M,w++);let P=!1,E=d.map((T,M)=>{let R=new Map;for(let _ of v[M]){let Q=e.num("size",b.get(
|
|
2184
|
+
_),g),Y=WA(T.points[_.at],_,n,Q);Y.length>1&&(R.set(_.at,Y),P=!0)}if(R.size===0)return T;let S=[];return T.points.forEach((_,Q)=>S.push(...R.get(Q)??[_])),{points:S,closed:T.closed}});if(!P){h.push(m);
|
|
2185
|
+
continue}for(let T of E)T.points.length<2||h.push({id:e.shapeId(h.length),kind:"polyline",points:T.points,closed:T.closed,style:m.style,transform:be,meta:{...m.meta,index:h.length,tags:[...m.meta.tags??
|
|
2186
|
+
[],"corners"]}})}return{out:z(h)}}},GA=96,qA=360/GA,HA=e=>(J(e.mode).base??"fit")==="fit",$A={type:"bend",label:"Bend",category:"modifier",description:"Wrap a straight stream around an arc: along the \
|
|
2187
2187
|
row becomes angle, across it becomes radius.",quickKey:"sweep",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"axis",label:"Along",type:"enum",default:"x",options:[
|
|
2188
2188
|
{value:"x",label:"X (a row)"},{value:"y",label:"Y (a column)"}],description:"Which direction of the stream runs around the arc. The other becomes radius."},{key:"cx",label:"Center X",type:"number",default:0,
|
|
2189
2189
|
step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:300,min:1,step:.5,unit:"px",description:"Where the Anchor li\
|
|
@@ -2193,27 +2193,27 @@ rees. Keep Length maps pixels to arc length at Radius \u2014 a 100px cell spans
|
|
|
2193
2193
|
nd the dial. 270 = 9 o\u2019clock, so a 180\xB0 sweep goes over the top."},{key:"anchor",label:"Anchor",type:"enum",default:"center",options:[{value:"center",label:"Center"},{value:"near",label:"Near \
|
|
2194
2194
|
edge (top / left)"},{value:"far",label:"Far edge (bottom / right)"}],description:"The line across the stream that sits exactly on Radius."},{key:"flip",label:"Flip Inward",type:"bool",default:!1,description:"\
|
|
2195
2195
|
Off: screen-up is outward, so a row bent over the top reads upright. On: inside out."}],cook(e){let t=e.shapes("in");if(t.length===0)return{out:z([])};let n=tt(t);if(!n)return{out:z(t)};let r=e.enumOf(
|
|
2196
|
-
"axis",["x","y"]),i=e.enumOf("mode",["fit","length"]),s=e.enumOf("anchor",["center","near","far"]),a=e.bool("flip"),u=e.num("cx"),
|
|
2197
|
-
"x"?n.x:n.y,A=r==="x"?n.w:n.h,g=r==="x"?n.y:n.x,x=g+(r==="x"?n.h:n.w),v=s==="near"?g:s==="far"?x:(g+x)/2,b=i==="fit"?e.num("sweep")/Math.max(1e-6,A):180/(Math.PI*
|
|
2198
|
-
y,_=r==="x"?R.y:R.x,Q=(m+(S-d)*b)*Math.PI/180,Y=
|
|
2196
|
+
"axis",["x","y"]),i=e.enumOf("mode",["fit","length"]),s=e.enumOf("anchor",["center","near","far"]),a=e.bool("flip"),u=e.num("cx"),f=e.num("cy"),h=Math.max(1e-6,e.num("radius")),m=yr(e.num("start")),d=r===
|
|
2197
|
+
"x"?n.x:n.y,A=r==="x"?n.w:n.h,g=r==="x"?n.y:n.x,x=g+(r==="x"?n.h:n.w),v=s==="near"?g:s==="far"?x:(g+x)/2,b=i==="fit"?e.num("sweep")/Math.max(1e-6,A):180/(Math.PI*h),w=a?1:-1,P=R=>{let S=r==="x"?R.x:R.
|
|
2198
|
+
y,_=r==="x"?R.y:R.x,Q=(m+(S-d)*b)*Math.PI/180,Y=h+(_-v)*w;return{x:u+Y*Math.cos(Q),y:f+Y*Math.sin(Q)}},E=R=>m+(R-d)*b,T=(R,S)=>{let _=[],Q=R.length,Y=S?Q:Q-1;for(let G=0;G<Y;G++){let q=R[G],X=R[(G+1)%
|
|
2199
2199
|
Q],te=r==="x"?X.x-q.x:X.y-q.y,ce=Math.max(1,Math.ceil(Math.abs(te*b)/qA));for(let ue=0;ue<ce;ue++){let ie=ue/ce;_.push(P({x:q.x+(X.x-q.x)*ie,y:q.y+(X.y-q.y)*ie}))}}return!S&&Q>0&&_.push(P(R[Q-1])),_},
|
|
2200
2200
|
M=[];for(let R of t){if(R.kind==="image"){M.push(R);continue}if(R.kind==="text"){let S=un(R.transform,{x:R.x,y:R.y}),_=P(S),Q=E(r==="x"?S.x:S.y)+90*(r==="x"?1:-1)*(a?-1:1),Y=Ae(Dr(Q,_.x,_.y),Ae(_e(_.x-
|
|
2201
2201
|
S.x,_.y-S.y),R.transform));M.push({...R,transform:Y,meta:{...R.meta,index:M.length}});continue}for(let S of et(R))S.points.length<2||M.push({id:e.shapeId(M.length),kind:"polyline",points:T(S.points,S.
|
|
2202
2202
|
closed),closed:S.closed,style:R.style,transform:be,meta:{...R.meta,index:M.length,tags:[...R.meta.tags??[],"bend"]}})}return{out:z(M)}}},UA=["auto","butt","round","square"],zA=["auto","miter","round",
|
|
2203
2203
|
"bevel"],lu=24,jA=4,xt=e=>[e.x,e.y],VA=.05;function ZA(e,t,n){let r=n.x-t.x,i=n.y-t.y,s=r*r+i*i;if(s===0)return Math.hypot(e.x-t.x,e.y-t.y);let a=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/s));return Math.
|
|
2204
2204
|
hypot(e.x-(t.x+a*r),e.y-(t.y+a*i))}function mo(e,t){if(e.length<=2)return e;let n=e[0],r=e[e.length-1],i=0,s=-1;for(let a=1;a<e.length-1;a++){let u=ZA(e[a],n,r);u>i&&(i=u,s=a)}return i<=t||s<0?[n,r]:[
|
|
2205
|
-
...mo(e.slice(0,s+1),t).slice(0,-1),...mo(e.slice(s),t)]}function JA(e,t,n){if(n<=0||e.length<4)return e;if(!t)return mo(e,n);let r=1,i=-1;for(let u=1;u<e.length;u++){let
|
|
2206
|
-
y-e[0].y);
|
|
2205
|
+
...mo(e.slice(0,s+1),t).slice(0,-1),...mo(e.slice(s),t)]}function JA(e,t,n){if(n<=0||e.length<4)return e;if(!t)return mo(e,n);let r=1,i=-1;for(let u=1;u<e.length;u++){let f=Math.hypot(e[u].x-e[0].x,e[u].
|
|
2206
|
+
y-e[0].y);f>i&&(i=f,r=u)}let s=mo(e.slice(0,r+1),n),a=mo([...e.slice(r),e[0]],n);return[...s.slice(0,-1),...a.slice(0,-1)]}var uu=.001;function cu(e){let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],
|
|
2207
2207
|
[s,a]=e[(n+1)%e.length];t+=r*a-s*i}return Math.abs(t)/2}function KA(e){let t=[];for(let n of e){let r=n.filter((i,s)=>s===0||cu(i)>=uu);r.length>0&&cu(r[0])>=uu&&t.push(r)}return t}function Ko(e,t){let n=[];
|
|
2208
2208
|
for(let r=0;r<lu;r++){let i=r/lu*Math.PI*2;n.push(xt({x:e.x+t*Math.cos(i),y:e.y+t*Math.sin(i)}))}return n}function ey(e,t,n,r,i){let s=[];for(let d of e){let A=s[s.length-1];(!A||Math.hypot(d.x-A.x,d.
|
|
2209
2209
|
y-A.y)>.001)&&s.push(d)}if(t&&s.length>2){let d=s[0],A=s[s.length-1];Math.hypot(d.x-A.x,d.y-A.y)<=.001&&s.pop()}if(s.length===0||n<=0)return[];if(s.length===1){if(r==="round")return[[Ko(s[0],n)]];if(r===
|
|
2210
2210
|
"square"){let{x:d,y:A}=s[0];return[[[xt({x:d-n,y:A-n}),xt({x:d+n,y:A-n}),xt({x:d+n,y:A+n}),xt({x:d-n,y:A+n})]]]}return[]}let a=t?s.length:s.length-1,u=[];for(let d=0;d<a;d++){let A=s[d],g=s[(d+1)%s.length],
|
|
2211
|
-
x=Math.hypot(g.x-A.x,g.y-A.y);u.push({x:(g.x-A.x)/x,y:(g.y-A.y)/x})}let
|
|
2212
|
-
r==="square"?n:0,P={x:A.x-x.x*b,y:A.y-x.y*b},E={x:g.x+x.x*w,y:g.y+x.y*w};
|
|
2213
|
-
m=t?s.length-1:s.length-2;for(let d=
|
|
2211
|
+
x=Math.hypot(g.x-A.x,g.y-A.y);u.push({x:(g.x-A.x)/x,y:(g.y-A.y)/x})}let f=[];for(let d=0;d<a;d++){let A=s[d],g=s[(d+1)%s.length],x=u[d],v={x:-x.y*n,y:x.x*n},b=!t&&d===0&&r==="square"?n:0,w=!t&&d===a-1&&
|
|
2212
|
+
r==="square"?n:0,P={x:A.x-x.x*b,y:A.y-x.y*b},E={x:g.x+x.x*w,y:g.y+x.y*w};f.push([[xt({x:P.x+v.x,y:P.y+v.y}),xt({x:E.x+v.x,y:E.y+v.y}),xt({x:E.x-v.x,y:E.y-v.y}),xt({x:P.x-v.x,y:P.y-v.y})]])}let h=t?0:1,
|
|
2213
|
+
m=t?s.length-1:s.length-2;for(let d=h;d<=m;d++){let A=s[d],g=u[(d-1+a)%a],x=u[d%a],v=g.x*x.y-g.y*x.x,b=g.x*x.x+g.y*x.y;if(Math.abs(v)<.001&&b>0)continue;if(i==="round"){f.push([Ko(A,n)]);continue}let w=v>
|
|
2214
2214
|
0?-1:1,P={x:A.x-g.y*n*w,y:A.y+g.x*n*w},E={x:A.x-x.y*n*w,y:A.y+x.x*n*w},T={x:P.x+E.x-2*A.x,y:P.y+E.y-2*A.y},M=Math.hypot(T.x,T.y),R=M>1e-9?{x:A.x-T.x/M*n*.5,y:A.y-T.y/M*n*.5}:A;if(i==="miter"){let S=Math.
|
|
2215
|
-
acos(Math.max(-1,Math.min(1,-b))),_=1/Math.sin(S/2);if(Number.isFinite(_)&&_<=jA&&M>1e-9){let Q={x:A.x+T.x/M*n*_,y:A.y+T.y/M*n*_};
|
|
2216
|
-
E)]])}return!t&&r==="round"&&
|
|
2215
|
+
acos(Math.max(-1,Math.min(1,-b))),_=1/Math.sin(S/2);if(Number.isFinite(_)&&_<=jA&&M>1e-9){let Q={x:A.x+T.x/M*n*_,y:A.y+T.y/M*n*_};f.push([[xt(R),xt(P),xt(Q),xt(E)]]);continue}}f.push([[xt(R),xt(P),xt(
|
|
2216
|
+
E)]])}return!t&&r==="round"&&f.push([Ko(s[0],n)],[Ko(s[s.length-1],n)]),f}function ty(e,t,n,r){let i=[];for(let s of et(e))i.push(...ey(JA(s.points,s.closed,VA),s.closed,t/2,n,r));return i.length===0?
|
|
2217
2217
|
[]:KA(yo(i))}var ny={type:"outline-stroke",label:"Outline Stroke",category:"modifier",description:"Turn each stroke into the filled shape of its ink \u2014 quads along the segments, joins and caps included\
|
|
2218
2218
|
\u2014 so Boolean, Slice and fills can work on ticks, rings and lines. Width above 0 outlines any shape, stroked or not, in its stroke or fill colour. Text arrives traced (Outline to Path switches on when\
|
|
2219
2219
|
you wire it); a shape with nothing to outline passes through untouched.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"width",label:"Thickness",type:"number",default:0,
|
|
@@ -2223,26 +2223,26 @@ s drawn at this thickness, filled glyphs included. (The Width under Style is the
|
|
|
2223
2223
|
et."},{key:"join",label:"Join",type:"enum",default:"auto",options:[{value:"auto",label:"From style"},{value:"miter",label:"Miter"},{value:"round",label:"Round"},{value:"bevel",label:"Bevel"}],description:"\
|
|
2224
2224
|
Corners. From style reads the shape\u2019s linejoin, miter when unset."},{key:"keepStyle",label:"Source Style",type:"bool",default:!0,description:"Fill each result in the colour its stroke had. Off = \
|
|
2225
2225
|
the Style block below dresses the results instead."},...Ge.map(e=>({...e,dimWhen:t=>J(t.keepStyle).base!==!1}))],cook(e){let t=e.shapes("in"),n=t.length,r=e.num("width"),i=e.enumOf("cap",UA),s=e.enumOf(
|
|
2226
|
-
"join",zA),a=e.bool("keepStyle"),u=[];for(let[h
|
|
2227
|
-
meta,index:u.length}});continue}let d=r>0?r:
|
|
2228
|
-
style.fill,b=m?
|
|
2229
|
-
meta(u.length,["outline-stroke",...
|
|
2226
|
+
"join",zA),a=e.bool("keepStyle"),u=[];for(let[f,h]of t.entries()){let m=h.style.stroke!==void 0&&h.style.stroke!=="none"&&(h.style.strokeWidth??1)>0;if(h.kind==="text"||r<=0&&!m){u.push({...h,meta:{...h.
|
|
2227
|
+
meta,index:u.length}});continue}let d=r>0?r:h.style.strokeWidth??1,A=i==="auto"?h.style.strokeLinecap??"butt":i,g=s==="auto"?h.style.strokeLinejoin??"miter":s,x=Nn(ty(h,d,A,g));if(!x)continue;let v=h.
|
|
2228
|
+
style.fill,b=m?h.style.stroke:v!==void 0&&v!=="none"?v:"#ffffff";u.push({id:e.shapeId(u.length),kind:"path",d:x,style:a?{...h.style,fill:b,stroke:"none",strokeWidth:0}:e.style(f,n),transform:be,meta:e.
|
|
2229
|
+
meta(u.length,["outline-stroke",...h.meta.tags??[]])})}return{out:z(u)}}},ry=["cross","gap"],ei=1e-6,oy=1e-6;function iy(e,t){let n=[];for(let m of t.points){let d=n[n.length-1];(!d||Math.hypot(m.x-d.
|
|
2230
2230
|
x,m.y-d.y)>1e-9)&&n.push(m)}if(t.closed&&n.length>2){let m=n[0],d=n[n.length-1];Math.hypot(m.x-d.x,m.y-d.y)<=1e-9&&n.pop()}let r=t.closed&&n.length>2;if(n.length<2)return;let i=[0],s=r?[...n,n[0]]:n,a=1/0,
|
|
2231
|
-
u=1/0,
|
|
2232
|
-
closed:r,cum:i,total:i[i.length-1],bounds:[a,u,h
|
|
2233
|
-
function
|
|
2234
|
-
a.bounds,1e-6))continue;let u=
|
|
2235
|
-
u;b++){if(n===s&&r.closed&&
|
|
2236
|
-
y:P.y-w.y},T=v.x*E.y-v.y*E.x;if(Math.abs(T)<1e-12)continue;let M=w.x-
|
|
2237
|
-
1]-r.cum[
|
|
2238
|
-
0,
|
|
2231
|
+
u=1/0,f=-1/0,h=-1/0;for(let m=0;m<s.length;m++){let d=s[m];d.x<a&&(a=d.x),d.y<u&&(u=d.y),d.x>f&&(f=d.x),d.y>h&&(h=d.y),m>0&&i.push(i[m-1]+Math.hypot(d.x-s[m-1].x,d.y-s[m-1].y))}return{shape:e,points:n,
|
|
2232
|
+
closed:r,cum:i,total:i[i.length-1],bounds:[a,u,f,h]}}function sy(e,t,n){return e[0]<=t[2]+n&&t[0]<=e[2]+n&&e[1]<=t[3]+n&&t[1]<=e[3]+n}function fu(e,t){return[e.points[t],e.points[(t+1)%e.points.length]]}
|
|
2233
|
+
function hu(e){return e.closed?e.points.length:e.points.length-1}function ay(e){let t=e.map(()=>[]);for(let n=0;n<e.length;n++){let r=e[n],i=hu(r);for(let s=n;s<e.length;s++){let a=e[s];if(!sy(r.bounds,
|
|
2234
|
+
a.bounds,1e-6))continue;let u=hu(a);for(let f=0;f<i;f++){let[h,m]=fu(r,f),d=Math.min(h.x,m.x),A=Math.max(h.x,m.x),g=Math.min(h.y,m.y),x=Math.max(h.y,m.y),v={x:m.x-h.x,y:m.y-h.y};for(let b=n===s?f+2:0;b<
|
|
2235
|
+
u;b++){if(n===s&&r.closed&&f===0&&b===i-1)continue;let[w,P]=fu(a,b);if(Math.min(w.x,P.x)>A+1e-9||Math.max(w.x,P.x)<d-1e-9||Math.min(w.y,P.y)>x+1e-9||Math.max(w.y,P.y)<g-1e-9)continue;let E={x:P.x-w.x,
|
|
2236
|
+
y:P.y-w.y},T=v.x*E.y-v.y*E.x;if(Math.abs(T)<1e-12)continue;let M=w.x-h.x,R=w.y-h.y,S=(M*E.y-R*E.x)/T,_=(M*v.y-R*v.x)/T;S<-ei||S>1+ei||_<-ei||_>1+ei||(t[n].push(r.cum[f]+Math.max(0,Math.min(1,S))*(r.cum[f+
|
|
2237
|
+
1]-r.cum[f])),t[s].push(a.cum[b]+Math.max(0,Math.min(1,_))*(a.cum[b+1]-a.cum[b])))}}}}return t}function ly(e,t,n,r){let i=[],s=n?Math.min(r,t/2):r;for(let u of e){let f=u-s,h=u+s;if(!n){i.push([Math.max(
|
|
2238
|
+
0,f),Math.min(t,h)]);continue}f<0?i.push([f+t,t],[0,h]):h>t?i.push([f,t],[0,h-t]):i.push([f,h])}i.sort((u,f)=>u[0]-f[0]);let a=[];for(let u of i){let f=a[a.length-1];f&&u[0]<=f[1]+1e-9?f[1]=Math.max(f[1],
|
|
2239
2239
|
u[1]):a.push([u[0],u[1]])}return a}function uy(e,t){let n=[],r=0;for(let[i,s]of e)i>r&&n.push([r,i]),r=Math.max(r,s);return r<t&&n.push([r,t]),n}function pu(e,t,n){let r=e.points[n%e.points.length],i=e.
|
|
2240
2240
|
points[(n+1)%e.points.length],s=e.cum[n+1]-e.cum[n],a=s>0?(t-e.cum[n])/s:0;return{x:r.x+(i.x-r.x)*a,y:r.y+(i.y-r.y)*a}}function Ss(e,t,n){if(n>e.total&&e.closed){let a=Ss(e,t,e.total),u=Ss(e,0,n-e.total);
|
|
2241
2241
|
return[...a,...u.slice(1)]}let r=[],i=0;for(;i<e.cum.length-2&&e.cum[i+1]<=t;)i++;r.push(pu(e,t,i));for(let a=i+1;a<e.cum.length-1&&e.cum[a]<n;a++)r.push(e.points[a%e.points.length]);let s=i;for(;s<e.
|
|
2242
2242
|
cum.length-2&&e.cum[s+1]<n;)s++;return r.push(pu(e,n,s)),r}function cy(e,t,n,r){if(t.length===0)return n==="gap"?[{points:e.points,closed:e.closed}]:[];let i=ly(t,e.total,e.closed,r),s=n==="cross"?i:uy(
|
|
2243
2243
|
i,e.total);if(s=s.filter(([a,u])=>u-a>oy),s.length===0)return[];if(e.closed){if(s.length===1&&s[0][0]<=1e-9&&s[0][1]>=e.total-1e-9)return[{points:e.points,closed:!0}];let a=s[0],u=s[s.length-1];s.length>
|
|
2244
|
-
1&&a[0]<=1e-9&&u[1]>=e.total-1e-9&&(s=[...s.slice(1,-1),[u[0],e.total+a[1]]])}return s.map(([a,u])=>({points:Ss(e,a,u),closed:!1}))}var du=e=>Math.round(e*1e3)/1e3;function
|
|
2245
|
-
points.map(n=>`${du(n.x)} ${du(n.y)}`).join("L")}${t.closed?"Z":""}`).join("")}var
|
|
2244
|
+
1&&a[0]<=1e-9&&u[1]>=e.total-1e-9&&(s=[...s.slice(1,-1),[u[0],e.total+a[1]]])}return s.map(([a,u])=>({points:Ss(e,a,u),closed:!1}))}var du=e=>Math.round(e*1e3)/1e3;function fy(e){return e.map(t=>`M${t.
|
|
2245
|
+
points.map(n=>`${du(n.x)} ${du(n.y)}`).join("L")}${t.closed?"Z":""}`).join("")}var hy={type:"stroke-break",label:"Stroke Break",category:"modifier",quickKey:"length",description:"Cut every line where \
|
|
2246
2246
|
it crosses another. Crosses keeps a short arm of ink either side of each crossing \u2014 a grid becomes a field of little plus marks; Gaps cuts the crossings out and keeps the runs between them. Line Ends \
|
|
2247
2247
|
counts a free end as a crossing. Unstroked shapes pass through untouched.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Keep",type:"enum",default:"\
|
|
2248
2248
|
cross",options:[{value:"cross",label:"Crosses"},{value:"gap",label:"Gaps"}],description:"Crosses keeps Length of ink either side of every crossing and drops the rest. Gaps drops that and keeps the res\
|
|
@@ -2250,27 +2250,27 @@ t \u2014 lines that stop short of every crossing."},{key:"length",label:"Length"
|
|
|
2250
2250
|
aps) reaches along the line \u2014 the arm of the plus, or half the gap."},{key:"ends",label:"Line Ends",type:"bool",default:!0,description:"A free end counts as a crossing: Crosses grows a stub at ev\
|
|
2251
2251
|
ery line end, Gaps shrinks every line from its ends. Off leaves the ends alone."},{key:"split",label:"Split Pieces",type:"bool",default:!1,description:"One shape per piece, so Stagger, Reveal and Jitt\
|
|
2252
2252
|
er can work the pieces one at a time. Off keeps one path per input shape."}],cook(e){let t=e.shapes("in"),n=e.enumOf("mode",ry),r=Math.max(0,e.num("length")),i=e.bool("ends"),s=e.bool("split"),a=[],u=t.
|
|
2253
|
-
map(d=>d.style.stroke!==void 0&&d.style.stroke!=="none"&&(d.style.strokeWidth??1)>0);for(let[d,A]of t.entries())if(u[d])for(let g of et(A)){let x=iy(d,g);x&&a.push(x)}let
|
|
2254
|
-
entries())A.closed||
|
|
2255
|
-
meta:{...A.meta,index:m.length}});continue}let g=["stroke-break",...A.meta.tags??[]];if(s){for(let v of
|
|
2256
|
-
style},transform:be,meta:e.meta(m.length,g)});continue}let x=
|
|
2253
|
+
map(d=>d.style.stroke!==void 0&&d.style.stroke!=="none"&&(d.style.strokeWidth??1)>0);for(let[d,A]of t.entries())if(u[d])for(let g of et(A)){let x=iy(d,g);x&&a.push(x)}let f=ay(a);if(i)for(let[d,A]of a.
|
|
2254
|
+
entries())A.closed||f[d].push(0,A.total);let h=t.map(()=>[]);for(let[d,A]of a.entries())h[A.shape].push(...cy(A,f[d],n,r));let m=[];for(let[d,A]of t.entries()){if(!u[d]||A.kind==="text"){m.push({...A,
|
|
2255
|
+
meta:{...A.meta,index:m.length}});continue}let g=["stroke-break",...A.meta.tags??[]];if(s){for(let v of h[d])m.push({id:e.shapeId(m.length),kind:"polyline",points:v.points,closed:v.closed,style:{...A.
|
|
2256
|
+
style},transform:be,meta:e.meta(m.length,g)});continue}let x=fy(h[d]);x&&m.push({id:e.shapeId(m.length),kind:"path",d:x,style:{...A.style},transform:be,meta:e.meta(m.length,g)})}return{out:z(m)}}},py={
|
|
2257
2257
|
type:"array-radial",label:"Array Radial",category:"modifier",translate:[{x:"cx",y:"cy"}],description:"Repeat the input around a circle, orbiting or just placed.",inputs:[{name:"in",type:"shapes"}],outputs:[
|
|
2258
2258
|
{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:8,min:0,max:2e3,description:"Copies around the circle. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},
|
|
2259
2259
|
{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:120,step:.5,
|
|
2260
2260
|
unit:"px",dimWhen:e=>J(e.mode).base==="rotate"},{key:"start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:vo},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,
|
|
2261
2261
|
step:1,unit:"deg"},{key:"mode",label:"Mode",type:"enum",default:"orbit",options:[{value:"orbit",label:"Orbit (rotate with ring)"},{value:"place",label:"Place (keep upright)"},{value:"rotate",label:"Ro\
|
|
2262
2262
|
tate about centre"}]},gi],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(n===0)return{out:z([])};let r=bi(t,e.bool("deal")),i=e.num("cx"),s=e.num("cy"),a=yr(e.num("start")),u=e.num("swee\
|
|
2263
|
-
p"),
|
|
2264
|
-
w=Ae(Ae(_e(i,s),jt(g)),_e(-i,-s));else{let P=i+v*Math.cos(b),E=s+v*Math.sin(b);w=
|
|
2265
|
-
w,E.transform),meta:{...E.meta,index:T}})}}return{out:z(d)}}};function As(e){let t=String(J(e.frame).base??"free");return t==="fill"||t==="fit"||t==="frame"}function
|
|
2263
|
+
p"),f=e.enumOf("mode",["orbit","place","rotate"]),m=Math.abs(u)>=360?n:Math.max(1,n-1),d=[];for(let A=0;A<n;A++){let g=a+u*A/m,x={k:A,angle:g},v=e.num("radius",A,n,x),b=g*Math.PI/180,w;if(f==="rotate")
|
|
2264
|
+
w=Ae(Ae(_e(i,s),jt(g)),_e(-i,-s));else{let P=i+v*Math.cos(b),E=s+v*Math.sin(b);w=f==="orbit"?Ae(_e(P,E),jt(g)):_e(P,E)}for(let[P,E]of r(A).entries()){let T=d.length+P;d.push({...E,id:e.shapeId(T),transform:Ae(
|
|
2265
|
+
w,E.transform),meta:{...E.meta,index:T}})}}return{out:z(d)}}};function As(e){let t=String(J(e.frame).base??"free");return t==="fill"||t==="fit"||t==="frame"}function ho(e){return String(J(e.frame).base??
|
|
2266
2266
|
"free")!=="frame"}function li(e){let t=String(J(e.frame).base??"free");return t!=="frame"&&t!=="fill"}function dy(e){return li(e)||String(J(e.place).base??"cells")!=="crossings"}function mu(e){return!li(
|
|
2267
2267
|
e)&&J(e.square).base===!0}var my={type:"array-grid",label:"Array Grid",category:"modifier",translate:[{x:"x",y:"y"}],description:"Repeat the input across a grid of cells.",inputs:[{name:"in",type:"sha\
|
|
2268
2268
|
pes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"frame",label:"Canvas",type:"enum",default:"free",options:[{value:"free",label:"Free (Step X/Y)"},{value:"frame",label:"Frame (X/Y/Width/Height\
|
|
2269
2269
|
)"},{value:"fill",label:"Fill Canvas (cell centres)"},{value:"fit",label:"Fit to Canvas (edge to edge)"}],description:"Free spaces the copies by Step X/Y from the input. Frame cuts an X/Y/Width/Height\
|
|
2270
2270
|
box into Columns \xD7 Rows cells and centres a copy in each, so it lines up with a Grid of the same frame and counts. Fill Canvas does the same over the whole document. Fit to Canvas spreads the copies \
|
|
2271
|
-
so the outermost ones touch the document edges. Frame and both canvas modes ignore Step, Origin and where the input sits."},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:
|
|
2272
|
-
{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:
|
|
2273
|
-
Height",type:"number",default:300,min:0,step:1,unit:"px",group:"Frame",dimWhen:
|
|
2271
|
+
so the outermost ones touch the document edges. Frame and both canvas modes ignore Step, Origin and where the input sits."},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:ho},
|
|
2272
|
+
{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:ho},{key:"w",label:"Width",type:"number",default:400,min:0,step:1,unit:"px",group:"Frame",dimWhen:ho},{key:"h",label:"\
|
|
2273
|
+
Height",type:"number",default:300,min:0,step:1,unit:"px",group:"Frame",dimWhen:ho},{...Qn,group:"Frame",dimWhen:ho},{key:"place",label:"Place",type:"enum",default:"cells",options:[{value:"cells",label:"\
|
|
2274
2274
|
Cell centres"},{value:"crossings",label:"Line crossings"}],description:"Where in the Frame or Fill Canvas lattice the copies land. Cell centres puts one copy in the middle of each of the Columns \xD7 Row\
|
|
2275
2275
|
s cells. Line crossings puts one on every intersection instead, corners included: (Columns + 1) \xD7 (Rows + 1) copies, on the crossings of a Grid with the same counts.",dimWhen:li},{key:"border",label:"\
|
|
2276
2276
|
Border",type:"bool",default:!0,description:"With Place on Line crossings: include the crossings on the frame edge. Off keeps the interior intersections only, (Columns \u2212 1) \xD7 (Rows \u2212 1) copies, matchin\
|
|
@@ -2283,35 +2283,35 @@ ignored); Square Fit says where the leftover goes. Tick it on both nodes and the
|
|
|
2283
2283
|
step:.5,unit:"px",dimWhen:As},{key:"stepY",label:"Step Y",type:"number",default:60,step:.5,unit:"px",dimWhen:As},{key:"origin",label:"Origin",type:"enum",default:"center",options:[{value:"corner",label:"\
|
|
2284
2284
|
Corner (grow +X +Y)"},{value:"center",label:"Center (grow outwards)"}],description:"Center spreads the grid around the input in all four directions; Corner puts the first copy on the input.",dimWhen:As},
|
|
2285
2285
|
{key:"density",label:"Density",type:"number",default:1,min:0,max:1,step:.01},{key:"stagger",label:"Stagger",type:"number",default:0,step:.5,unit:"px",description:"Row offset."},gi],cook(e){let t=e.shapes(
|
|
2286
|
-
"in"),n=Math.max(0,e.int("cols")),r=Math.max(0,e.int("rows")),i=e.num("density"),s=e.num("stagger"),a=e.rand("density"),u=bi(t,e.bool("deal")),
|
|
2287
|
-
"fill"||
|
|
2288
|
-
b=m==="frame"?(()=>{let ie=Math.max(0,e.num("w")),
|
|
2286
|
+
"in"),n=Math.max(0,e.int("cols")),r=Math.max(0,e.int("rows")),i=e.num("density"),s=e.num("stagger"),a=e.rand("density"),u=bi(t,e.bool("deal")),f=e.enumOf("frame",["free","frame","fill","fit"]),m=(f===
|
|
2287
|
+
"fill"||f==="fit")&&!(e.canvas.w>0&&e.canvas.h>0)?"free":f,d=m==="frame"||m==="fill",A=e.canvas.w,g=e.canvas.h,x={left:e.canvas.origin==="center"?-A/2:0,top:e.canvas.origin==="center"?-g/2:0,w:A,h:g},
|
|
2288
|
+
b=m==="frame"?(()=>{let ie=Math.max(0,e.num("w")),fe=Math.max(0,e.num("h")),ve=Ln(e,ie,fe);return{left:e.num("x")+ve.dx,top:e.num("y")+ve.dy,w:ie,h:fe}})():x,w=d&&e.enumOf("place",["cells","crossings"])===
|
|
2289
2289
|
"crossings",P=w&&!e.bool("border")?1:0,E=d&&n>0?b.w/n:0,T=d&&e.bool("square")&&E>0,M=1e-6,R=[];if(T){let ie=Math.floor(b.h/E+M),ve=e.enumOf("squareFit",["center","top"])==="center"?(b.h-ie*E)/2:0;R.push(
|
|
2290
2290
|
b.top);for(let ne=0;ne<=ie;ne++){let ye=b.top+ve+ne*E;ye>b.top+M&&ye<b.top+b.h-M&&R.push(ye)}R.push(b.top+b.h)}let S=T?R.length-1:r;if(n===0||S===0)return{out:z([])};let _=w?n+1-2*P:n,Q=w?S+1-2*P:S;if(_<=
|
|
2291
2291
|
0||Q<=0)return{out:z([])};let Y=_*Q,G=0,q=0,X=0,te=0,ce;if(m==="free"){let ie=e.enumOf("origin",["corner","center"])==="center";G=ie?-(n-1)/2*e.num("stepX"):0,q=ie?-(S-1)/2*e.num("stepY"):0}else if(d){
|
|
2292
|
-
let ie=Ue(tt(t)??{x:0,y:0,w:0,h:0}),
|
|
2293
|
-
t)??{x:0,y:0,w:0,h:0},
|
|
2294
|
-
_;
|
|
2295
|
-
s:0),ce?ce(ie+P):q+ie*Be);for(let[We,at]of u(ve).entries()){let lt=ue.length+We;ue.push({...at,id:e.shapeId(lt),transform:Ae(Ee,at.transform),meta:{...at.meta,index:lt}})}}return{out:z(ue)}}};function
|
|
2296
|
-
return String(J(e.mode).base??"rect")}function Au(e){let t=
|
|
2292
|
+
let ie=Ue(tt(t)??{x:0,y:0,w:0,h:0}),fe=T?E:b.h/S;X=E,te=fe;let ve=ne=>T?R[Math.min(ne,S)]:ne>=S?b.top+b.h:b.top+ne*fe;ce=w?ne=>ve(ne)-ie.y:ne=>(ve(ne)+ve(ne+1))/2-ie.y,G=b.left+(w?0:E/2)-ie.x}else{let ie=tt(
|
|
2293
|
+
t)??{x:0,y:0,w:0,h:0},fe=Ue(ie);X=n>1?(b.w-ie.w)/(n-1):0,te=S>1?(b.h-ie.h)/(S-1):0,G=(n>1?b.left+ie.w/2:b.left+b.w/2)-fe.x,q=(S>1?b.top+ie.h/2:b.top+b.h/2)-fe.y}let ue=[];for(let ie=0;ie<Q;ie++)for(let fe=0;fe<
|
|
2294
|
+
_;fe++){let ve=ie*_+fe;if(i<1&&a.next()>=i)continue;let ne={col:fe,row:ie,cols:_,rows:Q,k:ve},ye=m==="free"?e.num("stepX",ve,Y,ne):X,Be=m==="free"?e.num("stepY",ve,Y,ne):te,Ee=_e(G+(fe+P)*ye+(ie%2===1?
|
|
2295
|
+
s:0),ce?ce(ie+P):q+ie*Be);for(let[We,at]of u(ve).entries()){let lt=ue.length+We;ue.push({...at,id:e.shapeId(lt),transform:Ae(Ee,at.transform),meta:{...at.meta,index:lt}})}}return{out:z(ue)}}};function On(e){
|
|
2296
|
+
return String(J(e.mode).base??"rect")}function Au(e){let t=On(e);return t==="along"||t==="inside"}var Ay=[{value:"linear",label:"Linear"},{value:"ease",label:"Ease"},{value:"expo",label:"Exponential"}],
|
|
2297
2297
|
yy={type:"scatter",label:"Scatter",category:"modifier",translate:[{x:"x",y:"y"}],description:"Place copies at seeded random positions in a region or along a shape.",inputs:[{name:"in",type:"shapes"},{
|
|
2298
2298
|
name:"region",type:"shapes",label:"region"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:24,min:0,max:5e3,description:"Copies placed. 0 = nothing \u2014 wire \
|
|
2299
2299
|
a Ramp or Seq in to grow it from empty."},{key:"mode",label:"Mode",type:"enum",default:"rect",options:[{value:"rect",label:"Rectangle"},{value:"disc",label:"Disc"},{value:"ring",label:"Ring"},{value:"\
|
|
2300
2300
|
along",label:"Along region shape"},{value:"inside",label:"Inside region shape"}]},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",dimWhen:Au},{key:"y",label:"Y",type:"number",default:0,step:.5,
|
|
2301
|
-
unit:"px",dimWhen:Au},{key:"w",label:"Width",type:"number",default:240,step:.5,unit:"px",dimWhen:e=>
|
|
2302
|
-
"rect"},{...Qn,dimWhen:e=>
|
|
2303
|
-
us",type:"number",default:60,min:0,step:.5,unit:"px",dimWhen:e=>
|
|
2304
|
-
to Path",type:"bool",default:!1,description:"Along mode: rotate each copy to follow the region shape.",dimWhen:e=>
|
|
2301
|
+
unit:"px",dimWhen:Au},{key:"w",label:"Width",type:"number",default:240,step:.5,unit:"px",dimWhen:e=>On(e)!=="rect"},{key:"h",label:"Height",type:"number",default:160,step:.5,unit:"px",dimWhen:e=>On(e)!==
|
|
2302
|
+
"rect"},{...Qn,dimWhen:e=>On(e)!=="rect"},{key:"radius",label:"Radius",type:"number",default:120,min:0,step:.5,unit:"px",dimWhen:e=>On(e)!=="disc"&&On(e)!=="ring"},{key:"innerRadius",label:"Inner Radi\
|
|
2303
|
+
us",type:"number",default:60,min:0,step:.5,unit:"px",dimWhen:e=>On(e)!=="ring"},{key:"rotate",label:"Random Rotation",type:"number",default:0,min:0,max:360,step:1,unit:"deg"},{key:"align",label:"Align\
|
|
2304
|
+
to Path",type:"bool",default:!1,description:"Along mode: rotate each copy to follow the region shape.",dimWhen:e=>On(e)!=="along"},{key:"seed",label:"Seed",type:"number",default:0,step:.1,description:"\
|
|
2305
2305
|
Reroll the layout. Whole numbers are layouts \u2014 0 is the one the node always had \u2014 and the fraction between two glides every copy from its spot in one to its spot in the next, along the Curve. Wire Tim\
|
|
2306
2306
|
e in and the points wander to new places once a second, Time \xD7 0.2 for a slow drift, a Seq for cued moves. Along a region shape the copy slides along the path; inside one it travels straight and may b\
|
|
2307
2307
|
riefly cross outside a concave shape."},{key:"curve",label:"Curve",type:"enum",default:"ease",options:Ay,description:"How a copy travels between two layouts as Seed crosses a whole number: straight, e\
|
|
2308
2308
|
ased at both ends, or accelerating."},gi],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(t.length===0||n===0)return{out:z([])};let r=e.enumOf("mode",["rect","disc","ring","along","inside"]),
|
|
2309
|
-
i=e.num("rotate"),s=e.bool("align"),a=e.enumOf("curve",["linear","ease","expo"]),u=e.num("seed"),
|
|
2310
|
-
po"?
|
|
2309
|
+
i=e.num("rotate"),s=e.bool("align"),a=e.enumOf("curve",["linear","ease","expo"]),u=e.num("seed"),f=Number.isFinite(u)?Math.floor(u):0,h=Number.isFinite(u)?u-f:0,m=h<=0?0:a==="ease"?h*h*(3-2*h):a==="ex\
|
|
2310
|
+
po"?h*h:h,d=e.shapes("region"),A=bi(t,e.bool("deal")),x=d.flatMap(et)[0],v=x?Sn(x.points,x.closed):0,b=r==="inside"?d.map($e).find(Boolean):void 0,w=(E,T)=>{let M=T===0?e.rand("scatter",E):e.rand("sca\
|
|
2311
2311
|
tter",T,E),R={x:0,y:0},S=0;if(r==="along"&&x)S=M.next()*v;else if(r==="inside"&&x){if(R=b?{x:b.x+b.w/2,y:b.y+b.h/2}:R,b)for(let _=0;_<40;_++){let Q={x:b.x+M.next()*b.w,y:b.y+M.next()*b.h};if(Lo(Q,x.points)){
|
|
2312
2312
|
R=Q;break}}}else if(r==="disc"||r==="ring"){let _=e.num("x",E,n),Q=e.num("y",E,n),Y=e.num("radius",E,n),G=r==="ring"?e.num("innerRadius",E,n):0,q=M.next()*Math.PI*2,X=Math.sqrt(M.next()*(Y*Y-G*G)+G*G);
|
|
2313
2313
|
R={x:_+X*Math.cos(q),y:Q+X*Math.sin(q)}}else{let _=e.num("w",E,n),Q=e.num("h",E,n),Y=Ln(e,_,Q);R={x:e.num("x",E,n)+Y.dx+M.next()*_,y:e.num("y",E,n)+Y.dy+M.next()*Q}}return{p:R,d:S,spin:i>0?M.range(-i,
|
|
2314
|
-
i):0}},P=[];for(let E=0;E<n;E++){let T=w(E,
|
|
2314
|
+
i):0}},P=[];for(let E=0;E<n;E++){let T=w(E,f),{p:M,d:R,spin:S}=T;if(m>0){let G=w(E,f+1);M={x:T.p.x+(G.p.x-T.p.x)*m,y:T.p.y+(G.p.y-T.p.y)*m};let q=G.d-T.d;x?.closed&&v>0&&Math.abs(q)>v/2&&(q-=Math.sign(
|
|
2315
2315
|
q)*v),R=T.d+q*m,x?.closed&&v>0&&(R=(R%v+v)%v),S=T.spin+(G.spin-T.spin)*m}let _=0;if(r==="along"&&x&&(M=ir(x.points,R,x.closed),s)){let G=ar(x.points,R,x.closed);_=Math.atan2(G.y,G.x)*180/Math.PI}let Q=(s?
|
|
2316
2316
|
_:0)+S,Y=en({tx:M.x,ty:M.y,rotation:Q});for(let[G,q]of A(E).entries()){let X=P.length+G;P.push({...q,id:e.shapeId(X),transform:Ae(Y,q.transform),meta:{...q.meta,index:X,tags:[...q.meta.tags??[],"scatt\
|
|
2317
2317
|
ered"]}})}}return{out:z(P)}}},gy=[{value:"mirror",label:"Mirror"},{value:"kaleidoscope",label:"Kaleidoscope"}];function Ao(e){return J(e.mode).base==="kaleidoscope"}function yu(e){return!Ao(e)}function by(e){
|
|
@@ -2324,13 +2324,13 @@ Second Axis",type:"bool",default:!1,description:"Mirror mode: reflect the result
|
|
|
2324
2324
|
xis 2",type:"number",default:180,step:1,unit:"deg",description:"The second mirror line\u2019s angle: 180 = horizontal line, top\u2013bottom symmetry.",dimWhen:e=>Ao(e)||J(e.mirror2).base!==!0},{key:"c\
|
|
2325
2325
|
ount",label:"Wedges",type:"int",default:6,min:1,max:64,description:"Kaleidoscope: rotation steps around the centre. 2 with Reflect = four-corner symmetry.",dimWhen:yu},{key:"reflectToo",label:"Reflect",
|
|
2326
2326
|
type:"bool",default:!0,description:"Kaleidoscope: interleave reflected copies \u2014 a true mirror kaleidoscope rather than plain rotation.",dimWhen:yu}],cook(e){let t=e.shapes("in"),n=e.num("cx"),r=e.
|
|
2327
|
-
num("cy"),i=e.num("angle"),s=e.enumOf("mode",["mirror","kaleidoscope"]),a=[];if(s==="mirror"){if(e.bool("keepOriginal")&&a.push(be),a.push(ys(n,r,i)),e.bool("mirror2")){let
|
|
2328
|
-
...a])a.push(Ae(h
|
|
2329
|
-
|
|
2327
|
+
num("cy"),i=e.num("angle"),s=e.enumOf("mode",["mirror","kaleidoscope"]),a=[];if(s==="mirror"){if(e.bool("keepOriginal")&&a.push(be),a.push(ys(n,r,i)),e.bool("mirror2")){let f=ys(n,r,e.num("angle2"));for(let h of[
|
|
2328
|
+
...a])a.push(Ae(f,h))}}else{let f=Math.max(1,e.int("count")),h=e.bool("reflectToo")?ys(n,r,i):void 0,m=d=>Ae(Ae(_e(n,r),jt(d)),_e(-n,-r));for(let d=0;d<f;d++){let A=m(360*d/f);a.push(A),h&&a.push(Ae(A,
|
|
2329
|
+
h))}}let u=[];for(let[f,h]of a.entries())for(let[m,d]of t.entries()){let A=f*t.length+m;u.push({...d,id:e.shapeId(A),transform:Ae(h,d.transform),meta:{...d.meta,index:A}})}return{out:z(u)}}},xy=[py,my,
|
|
2330
2330
|
vy,yy];function ui(e){let t=/^#([0-9a-f]{3,8})$/i.exec(e.trim());if(!t)return;let n=t[1];if(n.length===3||n.length===4){let r=n.split("").map(i=>parseInt(i+i,16));return[r[0],r[1],r[2],n.length===4?r[3]/
|
|
2331
2331
|
255:1]}if(n.length===6||n.length===8){let r=[0,2,4,6].slice(0,n.length/2).map(i=>parseInt(n.slice(i,i+2),16));return[r[0],r[1],r[2],n.length===8?r[3]/255:1]}}var ti=e=>Math.round(Math.max(0,Math.min(255,
|
|
2332
|
-
e))).toString(16).padStart(2,"0");function dc(e,t,n){let r=ui(e),i=ui(t);if(!r||!i)return n<.5?e:t;let s=r[0]+(i[0]-r[0])*n,a=r[1]+(i[1]-r[1])*n,u=r[2]+(i[2]-r[2])*n,
|
|
2333
|
-
s)}${ti(a)}${ti(u)}${
|
|
2332
|
+
e))).toString(16).padStart(2,"0");function dc(e,t,n){let r=ui(e),i=ui(t);if(!r||!i)return n<.5?e:t;let s=r[0]+(i[0]-r[0])*n,a=r[1]+(i[1]-r[1])*n,u=r[2]+(i[2]-r[2])*n,f=r[3]+(i[3]-r[3])*n;return`#${ti(
|
|
2333
|
+
s)}${ti(a)}${ti(u)}${f<1?ti(f*255):""}`}var Iy={type:"jitter",label:"Jitter",category:"modifier",description:"Shake position, rotation and scale per shape, deterministically.",inputs:[{name:"in",type:"\
|
|
2334
2334
|
shapes"},{name:"reseed",type:"number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes"}],params:[{key:"position",label:"Position",type:"number",default:4,min:0,step:.1,unit:"px",description:"\
|
|
2335
2335
|
Scatter amount \u2014 both axes, until Position Y takes over Y."},{key:"positionY",label:"Position Y",type:"number",default:-1,step:.1,unit:"px",description:"Y axis alone, making Position the X amount\
|
|
2336
2336
|
. Negative = follow Position."},{key:"rotation",label:"Rotation",type:"number",default:0,min:0,step:.5,unit:"deg"},{key:"scale",label:"Scale",type:"number",default:0,min:0,max:1,step:.01,description:"\
|
|
@@ -2339,30 +2339,30 @@ Both grows the whole shape; X only or Y only scatters one dimension \u2014 a row
|
|
|
2339
2339
|
Uniform Scale",type:"bool",default:!0,description:"One factor for width and height, so icons resize without squashing. Off = X and Y scatter independently. Both axes only.",dimWhen:e=>J(e.scale).base===
|
|
2340
2340
|
0||J(e.scaleAxis).base!=="both"},{key:"opacity",label:"Opacity",type:"number",default:0,min:0,max:1,step:.01},{key:"strokeWidth",label:"Width",type:"number",default:0,min:0,step:.05,unit:"px"},{key:"s\
|
|
2341
2341
|
alt",label:"Seed",type:"int",default:1,min:0,description:"Reroll this node alone \u2014 the \u2212/+ steppers walk through scatters. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead."}],
|
|
2342
|
-
cook(e){let t=e.shapes("in"),n=t.length,r=e.num("position"),i=e.num("positionY"),s=i<0?r:i,a=e.num("rotation"),u=e.num("scale"),
|
|
2342
|
+
cook(e){let t=e.shapes("in"),n=t.length,r=e.num("position"),i=e.num("positionY"),s=i<0?r:i,a=e.num("rotation"),u=e.num("scale"),f=e.enumOf("scaleAxis",["both","x","y"]),h=e.bool("uniformScale"),m=e.num(
|
|
2343
2343
|
"opacity"),d=e.num("strokeWidth"),A=e.inputs.reseed,g=0;if(A?.t==="number"){let{playing:b,local:w}=tn(A.v);g=b?Math.round((e.t-w)*1e3):-Math.round(w*1e3)-1}let x=`${e.int("salt")}|${g}`,v=t.map((b,w)=>{
|
|
2344
|
-
let P=e.rand("jitter",x,w),E=()=>P.next()*2-1,T=r===0?0:E()*r,M=s===0?0:E()*s,R=a===0?0:E()*a,S=u===0?1:1+E()*u,_=u===0?1:f
|
|
2345
|
-
1?yi(b,Q,Y,
|
|
2344
|
+
let P=e.rand("jitter",x,w),E=()=>P.next()*2-1,T=r===0?0:E()*r,M=s===0?0:E()*s,R=a===0?0:E()*a,S=u===0?1:1+E()*u,_=u===0?1:h||f!=="both"?S:1+E()*u,Q=f==="y"?1:S,Y=f==="x"?1:f==="both"?_:S,G=Q!==1||Y!==
|
|
2345
|
+
1?yi(b,Q,Y,Ns(b)):b,q=en({tx:T,ty:M,rotation:R}),X={...b.style};return m>0&&(X.opacity=Math.max(0,Math.min(1,(X.opacity??1)+E()*m))),d>0&&(X.strokeWidth=Math.max(0,(X.strokeWidth??1)+E()*d)),{...G,transform:Ae(
|
|
2346
2346
|
q,G.transform),style:X,meta:{...b.meta,index:w}}});return{out:z(v)}}},wy={type:"partial-outline",label:"Partial Outline",category:"modifier",description:"Keep only part of each outline, by fraction of\
|
|
2347
2347
|
its length.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"from",label:"From",type:"number",default:0,min:0,max:1,step:.001},{key:"to",label:"To",type:"number",
|
|
2348
2348
|
default:.35,min:0,max:1,step:.001},{key:"segments",label:"Segments",type:"int",default:1,min:1,max:64,description:"Repeat the arc evenly around the outline."},{key:"offset",label:"Offset",type:"number",
|
|
2349
2349
|
default:0,step:.001,description:"Rotate the pattern along the outline."},{key:"stagger",label:"Stagger",type:"number",default:0,step:.001,description:"Extra offset per outline: 0.1 shifts each next ri\
|
|
2350
2350
|
ng a tenth further round. Wire an LFO to cascade."},{key:"scatter",label:"Scatter",type:"number",default:0,min:0,max:1,step:.01,description:"Seeded random phase per outline \u2014 every ring picks its own \
|
|
2351
|
-
spot, frozen until the seed changes."}],cook(e){let t=e.shapes("in"),n=t.length,r=Math.max(1,e.int("segments")),i=[],s=0;for(let[a,u]of t.entries()){let
|
|
2352
|
-
offset",a,n),d=e.num("stagger",a,n),A=e.num("scatter",a,n),g=et(u);for(let x of g){if(Sn(x.points,x.closed)===0)continue;let v=m+d*s+A*e.rand("scatter",s).next();s++;for(let b=0;b<r;b++){let w=(b+
|
|
2353
|
-
v,P=Math.max(0,Math.min(1,(f
|
|
2351
|
+
spot, frozen until the seed changes."}],cook(e){let t=e.shapes("in"),n=t.length,r=Math.max(1,e.int("segments")),i=[],s=0;for(let[a,u]of t.entries()){let f=e.num("from",a,n),h=e.num("to",a,n),m=e.num("\
|
|
2352
|
+
offset",a,n),d=e.num("stagger",a,n),A=e.num("scatter",a,n),g=et(u);for(let x of g){if(Sn(x.points,x.closed)===0)continue;let v=m+d*s+A*e.rand("scatter",s).next();s++;for(let b=0;b<r;b++){let w=(b+f)/r+
|
|
2353
|
+
v,P=Math.max(0,Math.min(1,(h-f)/r));if(P===0)continue;let E=(w%1+1)%1,T=E+P,R=(T<=1?[[E,T]]:[[E,1],[0,T-1]]).map(([S,_])=>Xi(x.points,S,_,x.closed)).filter(S=>S.length>=2);if(x.closed&&R.length===2){let[
|
|
2354
2354
|
S,_]=R;R=[[...S,..._.slice(1)]]}for(let S of R)i.push({id:e.shapeId(i.length),kind:"polyline",points:S,closed:!1,style:u.style,transform:[1,0,0,1,0,0],meta:{...u.meta,index:i.length,tags:[...u.meta.tags??
|
|
2355
2355
|
[],"partial"]}})}}}return{out:z(i)}}},ky=[{value:"cut",label:"Cut"},{value:"fade",label:"Fade"},{value:"scale",label:"Scale"},{value:"draw",label:"Draw on"},{value:"wipe",label:"Wipe"}],Cy=[{value:"fo\
|
|
2356
2356
|
rward",label:"Forward"},{value:"reverse",label:"Reverse"},{value:"random",label:"Random"}];function Ey(e,t,n){let r=Math.max(0,Math.min(.95,n)),i=(e-t*r)/(1-r);return Math.max(0,Math.min(1,i))}function ci(e,t){
|
|
2357
|
-
return{...e,style:{...e.style,opacity:(e.style.opacity??1)*t}}}function mc(e,t,n="both"){return yi(e,n==="y"?1:t,n==="x"?1:t,
|
|
2357
|
+
return{...e,style:{...e.style,opacity:(e.style.opacity??1)*t}}}function mc(e,t,n="both"){return yi(e,n==="y"?1:t,n==="x"?1:t,Ns(e))}function Sy(e,t){if(e===void 0||e==="none")return e;if(Bn(e))return $a(
|
|
2358
2358
|
e,t*t);let n=ui(e);if(!n)return"none";let r=Math.round(n[3]*t*t*255),i=s=>s.toString(16).padStart(2,"0");return`#${i(n[0])}${i(n[1])}${i(n[2])}${i(r)}`}function Ac(e,t,n,r){let i=et(t);if(i.length===0)
|
|
2359
2359
|
return[ci(t,n)];let s=[];for(let a of i){if(Sn(a.points,a.closed)===0)continue;let u=Xi(a.points,0,n,a.closed);u.length<2||s.push({id:e.shapeId(r+s.length),kind:"polyline",points:u,closed:!1,style:{...t.
|
|
2360
2360
|
style,fill:Sy(t.style.fill,n)},transform:[1,0,0,1,0,0],meta:{...t.meta,index:r+s.length,tags:[...t.meta.tags??[],"reveal"]}})}return s.length>0?s:[ci(t,n)]}function Ls(e){let t=e*Math.PI/180;return{x:Math.
|
|
2361
|
-
cos(t),y:Math.sin(t)}}function Fs(e,t){let n=(a,u)=>a*t.x+u*t.y,r=e.map(a=>{let u=mr([a]),
|
|
2362
|
-
polys:u,lo:d,hi:A}}let
|
|
2363
|
-
perShape:r}}function bo(e,t,n,r,i,s,a,u){let
|
|
2364
|
-
if(
|
|
2365
|
-
-1:1,S=[[P+T*w,E+M*w],[P-T*w,E-M*w],[P-T*w+R*r.x*w,E-M*w+R*r.y*w],[P+T*w+R*r.x*w,E+M*w+R*r.y*w]],_=yo(x),Q=pc.default.intersection(_,[[...S,S[0]]]),Y=
|
|
2361
|
+
cos(t),y:Math.sin(t)}}function Fs(e,t){let n=(a,u)=>a*t.x+u*t.y,r=e.map(a=>{let u=mr([a]),f=u.flat().flat();if(f.length>0){let d=1/0,A=-1/0;for(let[g,x]of f){let v=n(g,x);v<d&&(d=v),v>A&&(A=v)}return{
|
|
2362
|
+
polys:u,lo:d,hi:A}}let h=$e(a),m=h?Ue(h):{x:0,y:0};return{polys:u,lo:n(m.x,m.y),hi:n(m.x,m.y)}}),i=r.length>0?Math.min(...r.map(a=>a.lo)):0,s=r.length>0?Math.max(...r.map(a=>a.hi)):0;return{min:i,max:s,
|
|
2363
|
+
perShape:r}}function bo(e,t,n,r,i,s,a,u){let f=Math.max(1e-6,i.max-i.min),h=Math.max(0,Math.min(1,n)),m=i.min+h*f,d=[];for(let[A,g]of t.entries()){let{polys:x,lo:v,hi:b}=i.perShape[A];if(s==="behind"){
|
|
2364
|
+
if(h>=1||m>=b&&m>v){d.push(g);continue}if(m<=v||x.length===0)continue}else{if(h<=0||m<=v&&m<b){d.push(g);continue}if(m>=b||x.length===0)continue}let w=f+10,P=r.x*m,E=r.y*m,T=-r.y,M=r.x,R=s==="behind"?
|
|
2365
|
+
-1:1,S=[[P+T*w,E+M*w],[P-T*w,E-M*w],[P-T*w+R*r.x*w,E-M*w+R*r.y*w],[P+T*w+R*r.x*w,E+M*w+R*r.y*w]],_=yo(x),Q=pc.default.intersection(_,[[...S,S[0]]]),Y=Nn(Q);Y&&d.push({id:e.shapeId(A,u),kind:"path",d:Y,
|
|
2366
2366
|
style:g.style,transform:be,meta:{...g.meta,index:A,tags:[...g.meta.tags??[],a]}})}return d}function gs(e){return J(e.mode).base==="wipe"}var By={type:"reveal",label:"Reveal",category:"modifier",description:"\
|
|
2367
2367
|
Transition a stream in: 0 = nothing, 1 = everything. Stagger cascades the shapes.",quickKey:"progress",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"progress",label:"\
|
|
2368
2368
|
Progress",type:"number",default:1,min:0,max:1,step:.01,description:"Drive this from a Seq for timed transitions; press i to keyframe it."},{key:"mode",label:"Mode",type:"enum",default:"fade",options:ky,
|
|
@@ -2371,14 +2371,14 @@ key:"axis",label:"Scale Axis",type:"enum",default:"both",options:Ai,description:
|
|
|
2371
2371
|
stagger",label:"Stagger",type:"number",default:.35,min:0,max:.95,step:.01,description:"0 = everything moves together; higher = one after another.",dimWhen:gs},{key:"order",label:"Order",type:"enum",default:"\
|
|
2372
2372
|
forward",options:Cy,description:"Which shapes lead the cascade. Wipe orders by position instead.",dimWhen:gs},{key:"angle",label:"Wipe Angle",type:"number",default:0,step:1,unit:"deg",description:"Dir\
|
|
2373
2373
|
ection the wipe front travels. Wipe mode only.",dimWhen:e=>!gs(e)}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("mode",["cut","fade","scale","draw","wipe"]),i=e.enumOf("order",["forward","rever\
|
|
2374
|
-
se","random"]),s=e.enumOf("axis",["both","x","y"]),a=t.length>1?e.num("stagger"):0;if(n===0)return{out:z([])};if(r==="wipe"){let
|
|
2375
|
-
return{out:z(bo(e,t,d,
|
|
2376
|
-
({i:d},A)=>{u[d]=n>1?A/(n-1):0})}else u=t.map((
|
|
2377
|
-
|
|
2374
|
+
se","random"]),s=e.enumOf("axis",["both","x","y"]),a=t.length>1?e.num("stagger"):0;if(n===0)return{out:z([])};if(r==="wipe"){let h=Ls(e.num("angle")),m=Fs(t,h),d=Math.max(0,Math.min(1,e.num("progress")));
|
|
2375
|
+
return{out:z(bo(e,t,d,h,m,"behind","reveal"))}}let u;if(i==="random"){let m=t.map((d,A)=>e.rand("reveal-order",A).next()).map((d,A)=>({k:d,i:A})).sort((d,A)=>d.k-A.k||d.i-A.i);u=new Array(n),m.forEach(
|
|
2376
|
+
({i:d},A)=>{u[d]=n>1?A/(n-1):0})}else u=t.map((h,m)=>{let d=i==="reverse"?n-1-m:m;return n>1?d/(n-1):0});let f=[];for(let[h,m]of t.entries()){let d=Ey(e.num("progress",h,n),u[h],a);if(!(d<=0)){if(d>=1){
|
|
2377
|
+
f.push(m);continue}switch(r){case"cut":d>=.5&&f.push(m);break;case"fade":f.push(ci(m,d));break;case"scale":f.push(mc(m,d,s));break;case"draw":f.push(...Ac(e,m,d,f.length));break}}}return{out:z(f)}}};function Py(e,t,n,r){
|
|
2378
2378
|
let i={...t.style};if(e.bool("setStroke")&&(i.stroke=e.paint("stroke",n,r)),e.bool("setFill")&&(i.fill=e.paint("fill",n,r)),e.bool("setWidth")&&(i.strokeWidth=e.num("strokeWidth",n,r)),e.bool("setOpac\
|
|
2379
2379
|
ity")&&(i.opacity=e.num("opacity",n,r)),e.bool("setDash")){let u=e.numbers("dash");u.length>0?i.strokeDash=u:delete i.strokeDash}let s=t.kind==="text"&&e.bool("setWeight"),a=t.kind==="text"&&e.bool("s\
|
|
2380
|
-
etStretch");if(t.kind==="text"&&(s||a)){let u=s?
|
|
2381
|
-
fontFamily,weight:u,stretch:
|
|
2380
|
+
etStretch");if(t.kind==="text"&&(s||a)){let u=s?Ot(t.fontFamily,e.num("weight",n,r)):t.fontWeight??400,f=a?fn(t.fontFamily,e.num("stretch",n,r)):t.fontStretch,h=e.outline?.measure?.({text:t.text,family:t.
|
|
2381
|
+
fontFamily,weight:u,stretch:f,size:t.fontSize,letterSpacing:t.letterSpacing});return{...t,style:i,fontWeight:u,...f!==void 0?{fontStretch:f}:{},...h?{metrics:{width:h.width,capHeight:h.capHeight}}:{}}}
|
|
2382
2382
|
return{...t,style:i}}var My={type:"style",label:"Style",category:"modifier",description:"Override stroke, fill, width, opacity, dash, font weight or font stretch on a stream.",inputs:[{name:"in",type:"\
|
|
2383
2383
|
shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"setStroke",label:"Set Stroke",type:"bool",default:!1,description:"Recolour the stroke. On a stream with no stroke to colour, Set Width come\
|
|
2384
2384
|
s on too, so the colour shows."},{key:"stroke",label:"Stroke",type:"color",default:"#ff0000"},{key:"setFill",label:"Set Fill",type:"bool",default:!1},{key:"fill",label:"Fill",type:"color",default:"non\
|
|
@@ -2406,13 +2406,13 @@ dth",label:"Peak Width",type:"number",default:.3,min:.01,max:2,step:.01,descript
|
|
|
2406
2406
|
base!=="wave"},{key:"phase",label:"Phase",type:"number",default:0,step:.01,unit:"turn",description:"Wave: slides the wave along the stream, one turn per wave. Wire Time (times a speed) and it rolls.",
|
|
2407
2407
|
dimWhen:e=>J(e.curve).base!=="wave"},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:Ai,description:"Scale only: ramp both axes, or one \u2014 bars that grow taller along the row while ke\
|
|
2408
2408
|
eping their width.",dimWhen:e=>J(e.property).base!=="scale"}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("property",["width","widthPx","opacity","scale","rotation","offsetX","offsetY","weight",
|
|
2409
|
-
"stretch"]),i=e.enumOf("curve",["linear","ease","expo","peak","wave"]),s=e.enumOf("axis",["both","x","y"]),a=e.num("position"),u=e.num("width"),
|
|
2410
|
-
1?0:A/(n-1),x=Ry(i,g,a,u,h
|
|
2411
|
-
400,E=r==="stretch"?
|
|
2409
|
+
"stretch"]),i=e.enumOf("curve",["linear","ease","expo","peak","wave"]),s=e.enumOf("axis",["both","x","y"]),a=e.num("position"),u=e.num("width"),f=e.num("cycles"),h=e.num("phase"),m=t.map((d,A)=>{let g=n<=
|
|
2410
|
+
1?0:A/(n-1),x=Ry(i,g,a,u,f,h),v=e.num("from",A,n)+(e.num("to",A,n)-e.num("from",A,n))*x;if(r==="weight"||r==="stretch"){if(d.kind!=="text")return Nr(d,A);let P=r==="weight"?Ot(d.fontFamily,v):d.fontWeight??
|
|
2411
|
+
400,E=r==="stretch"?fn(d.fontFamily,v):d.fontStretch,T=e.outline?.measure?.({text:d.text,family:d.fontFamily,weight:P,stretch:E,size:d.fontSize,letterSpacing:d.letterSpacing});return{...d,fontWeight:P,
|
|
2412
2412
|
...E!==void 0?{fontStretch:E}:{},...T?{metrics:{width:T.width,capHeight:T.capHeight}}:{},meta:{...d.meta,index:A}}}if(r==="width"||r==="widthPx"||r==="opacity"){let P={...d.style};return r==="width"?P.
|
|
2413
2413
|
strokeWidth=Math.max(0,(P.strokeWidth??1)*v):r==="widthPx"?P.strokeWidth=Math.max(0,v):P.opacity=Math.max(0,Math.min(1,(P.opacity??1)*v)),{...d,style:P,meta:{...d.meta,index:A}}}if(r==="offsetX"||r===
|
|
2414
|
-
"offsetY"){let P=en(r==="offsetX"?{tx:v}:{ty:v});return{...d,transform:Ae(P,d.transform),meta:{...d.meta,index:A}}}let b=
|
|
2415
|
-
index:A}};let w=en({rotation:v,pivot:b});return{...d,transform:Ae(w,d.transform),meta:{...d.meta,index:A}}});return{out:z(m)}}},
|
|
2414
|
+
"offsetY"){let P=en(r==="offsetX"?{tx:v}:{ty:v});return{...d,transform:Ae(P,d.transform),meta:{...d.meta,index:A}}}let b=Ns(d);if(r==="scale")return{...yi(d,s==="y"?1:v,s==="x"?1:v,b),meta:{...d.meta,
|
|
2415
|
+
index:A}};let w=en({rotation:v,pivot:b});return{...d,transform:Ae(w,d.transform),meta:{...d.meta,index:A}}});return{out:z(m)}}},Oy=[Iy,wy,By,My,Dy];function Ny(e){let t=new Set;for(let n of e.split(/[\s,;]+/)){
|
|
2416
2416
|
if(!n)continue;let r=/^(\d+)\s*[-–]\s*(\d+)$/.exec(n);if(r){let s=Number(r[1]),a=Number(r[2]);for(let u=Math.min(s,a);u<=Math.max(s,a);u++)t.add(u);continue}let i=Number(n);Number.isInteger(i)&&i>=0&&
|
|
2417
2417
|
t.add(i)}return[...t].sort((n,r)=>n-r)}var xn=e=>t=>(J(t.mode).base??"every-nth")!==e,Qy={type:"select",label:"Select",category:"layout",description:"Split a stream into a chosen subset and the rest. Select this node and the artboard numbe\
|
|
2418
2418
|
rs its input; By Index mode lets you click shapes to pick them. Count and Index leave as numbers for a Mapping.",inputs:[{name:"in",type:"shapes"},{name:"reseed",type:"number",label:"Reseed",clock:!0}],
|
|
@@ -2428,13 +2428,13 @@ type:"int",default:0,min:0,description:"Reroll the random subset \u2014 the \u22
|
|
|
2428
2428
|
nstead.",dimWhen:xn("random")},{key:"tag",label:"Tag",type:"string",default:"major",exposable:!1,description:'Node names count: name any upstream node and every shape it emits carries that name, throu\
|
|
2429
2429
|
gh Merges and modifiers. Tick Ring tags "major", Scatter "scattered", Switch "switch".',dimWhen:xn("tag")},{key:"test",label:"Test",type:"string",default:"i % 2 == 0",exposable:!1,description:"Express\
|
|
2430
2430
|
ion over i and n; non-zero selects.",dimWhen:xn("expr")},{key:"invert",label:"Invert",type:"bool",default:!1}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("mode",["every-nth","range","list","ra\
|
|
2431
|
-
ndom","tag","expr"]),i=e.bool("invert"),s=Math.max(1,e.int("n")),a=e.int("offset"),u=e.int("from"),
|
|
2432
|
-
v)]:d?.t==="numbers"?d.v.map(M=>Math.floor(M)):
|
|
2431
|
+
ndom","tag","expr"]),i=e.bool("invert"),s=Math.max(1,e.int("n")),a=e.int("offset"),u=e.int("from"),f=e.int("to"),h=e.num("chance"),m=e.str("tag"),d=e.wires.list,A=new Set(d?.t==="number"?[Math.floor(d.
|
|
2432
|
+
v)]:d?.t==="numbers"?d.v.map(M=>Math.floor(M)):Ny(e.str("list"))),g=e.inputs.reseed,x=0;if(g?.t==="number"){let{playing:M,local:R}=tn(g.v);x=M?Math.round((e.t-R)*1e3):-Math.round(R*1e3)-1}let v=e.int(
|
|
2433
2433
|
"salt"),b=M=>v===0&&x===0?e.rand("select",M):e.rand("select",v,x,M),w;if(r==="expr")try{w=Xo(e.str("test"))}catch{w=void 0}let P=[],E=[];for(let[M,R]of t.entries()){let S;switch(r){case"every-nth":S=(M-
|
|
2434
|
-
a)%s===0&&M>=a;break;case"range":S=M>=u&&M<=
|
|
2435
|
-
break}i&&(S=!S);let _=S?P:E;_.push(
|
|
2434
|
+
a)%s===0&&M>=a;break;case"range":S=M>=u&&M<=f;break;case"list":S=A.has(M);break;case"random":S=b(M).next()<h;break;case"tag":S=(R.meta.tags??[]).includes(m);break;case"expr":S=w?w({i:M,n,t:e.t})!==0:!1;
|
|
2435
|
+
break}i&&(S=!S);let _=S?P:E;_.push(Nr(R,_.length))}let T=-1;for(let[M,R]of t.entries())if(P.some(S=>S.id===R.id)){T=M;break}return{out:z(P),rest:z(E),count:De(P.length),index:De(T)}}};function Yr(e){return J(
|
|
2436
2436
|
e.alignX).base===!1&&J(e.alignY).base===!1}function ni(e,t){let n=[];for(let r of e)n.push(...et(t?sc(r,t,!0):r));return n}function yc(e,t,n){let r=-1/0;for(let{points:i,closed:s}of n){let a=i.length,
|
|
2437
|
-
u=s?a:a-1;for(let
|
|
2437
|
+
u=s?a:a-1;for(let f=0;f<u;f++){let h=i[f],m=i[(f+1)%a],d=m.x-h.x,A=m.y-h.y,g=t.x*A-t.y*d;if(Math.abs(g)<1e-12)continue;let x=h.x-e.x,v=h.y-e.y,b=(x*A-v*d)/g,w=(x*t.y-v*t.x)/g;b>0&&w>=0&&w<=1&&b>r&&(r=
|
|
2438
2438
|
b)}}return r>-1/0?{x:e.x+t.x*r,y:e.y+t.y*r}:void 0}function Ly(e,t,n){let r=Ue(e),i=yc(r,t,n);if(i)return Math.hypot(i.x-r.x,i.y-r.y);let s=Math.abs(t.x)>1e-12?e.w/2/Math.abs(t.x):1/0,a=Math.abs(t.y)>
|
|
2439
2439
|
1e-12?e.h/2/Math.abs(t.y):1/0;return Math.min(s,a)}var Fy={type:"align",label:"Align",category:"layout",description:"Pin shapes to a point on the frame \u2014 the stream bounds, or the ref stream when wire\
|
|
2440
2440
|
d. Angle picks the edge point, Reach 0 is the centre. Frame: the box around it, or its actual outline.",inputs:[{name:"in",type:"shapes"},{name:"ref",type:"shapes",label:"Ref"}],outputs:[{name:"out",type:"\
|
|
@@ -2452,23 +2452,23 @@ cross, a bracket pair stays a pair. Off pins every shape separately.",dimWhen:Yr
|
|
|
2452
2452
|
dimWhen:Yr},{key:"influence",label:"Influence",type:"number",default:1,min:0,max:1,step:.01,description:"0 = shapes stay put, 1 = fully aligned. Wire from a Seq to slide things into place.",dimWhen:Yr},
|
|
2453
2453
|
{key:"passRef",label:"Show Ref",type:"bool",default:!1,description:"Also emit the ref shapes, like a Merge \u2014 the panel and the things pinned to it leave in one stream."}],cook(e){let t=e.shapes("\
|
|
2454
2454
|
in"),n=e.shapes("ref"),r=M=>e.bool("passRef")?[...M,...n.map((R,S)=>({...R,meta:{...R.meta,index:M.length+S}}))]:M,i=n.length>0?n:t,s=tt(i);if(!s)return{out:z(r(t))};let a=e.bool("alignX"),u=e.bool("a\
|
|
2455
|
-
lignY");if(!a&&!u)return{out:z(r(t))};let
|
|
2455
|
+
lignY");if(!a&&!u)return{out:z(r(t))};let f=e.int("snap"),h=f>0?90/2**(f-1):0,m=e.enumOf("side",["inside","on-edge","outside"]),d=m==="inside"?0:m==="on-edge"?.5:1,A=e.bool("asOne"),g=A?tt(t):void 0,x=A?
|
|
2456
2456
|
1:t.length,v=e.enumOf("frame",["box","outline"])==="outline",b=v?ni(i,e.outline):[],w=Ue(s),P=M=>v?ni(A?t:[M],e.outline):[],E=v&&A?ni(t,e.outline):void 0,T=t.map((M,R)=>{let S=A?0:R,_=A?g:$e(M);if(!_)
|
|
2457
|
-
return M;let Q=e.num("angle",S,x),G=(
|
|
2458
|
-
2,ie=(1+X/te*ce)/2,
|
|
2459
|
-
x)*ce,lt=w.y+(We.y-w.y)*ce,wt=Ly(_,Ee,E??P(M))*(1-2*d)*ce;ve=at-Ee.x*wt-_.w/2,ne=lt-Ee.y*wt-_.h/2}}let ye=a?(ve-_.x)*
|
|
2457
|
+
return M;let Q=e.num("angle",S,x),G=(h>0?Math.round(Q/h)*h:Q)*Math.PI/180,q=Math.cos(G),X=Math.sin(G),te=Math.max(Math.abs(q),Math.abs(X))||1,ce=Math.max(0,Math.min(1,e.num("reach",S,x))),ue=(1+q/te*ce)/
|
|
2458
|
+
2,ie=(1+X/te*ce)/2,fe=Math.max(0,Math.min(1,e.num("influence",S,x))),ve=s.x-d*_.w+ue*(s.w+(2*d-1)*_.w),ne=s.y-d*_.h+ie*(s.h+(2*d-1)*_.h);if(v){let Ee={x:q,y:X},We=yc(w,Ee,b);if(We){let at=w.x+(We.x-w.
|
|
2459
|
+
x)*ce,lt=w.y+(We.y-w.y)*ce,wt=Ly(_,Ee,E??P(M))*(1-2*d)*ce;ve=at-Ee.x*wt-_.w/2,ne=lt-Ee.y*wt-_.h/2}}let ye=a?(ve-_.x)*fe:0,Be=u?(ne-_.y)*fe:0;return{...M,transform:Ae(_e(ye,Be),M.transform),meta:{...M.
|
|
2460
2460
|
meta,index:R}}});return{out:z(r(T))}}},Yy={type:"distribute",label:"Distribute",category:"layout",description:"Space shapes evenly: equal steps between their leading edges, or equal gaps between them.",
|
|
2461
2461
|
inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"axis",label:"Axis",type:"enum",default:"x",options:[{value:"x",label:"Horizontal"},{value:"y",label:"Vertical"}]},
|
|
2462
2462
|
{key:"mode",label:"Measure",type:"enum",default:"edges",options:[{value:"edges",label:"Edges"},{value:"gaps",label:"Gaps"}],description:"Edges keeps the leading edges an equal step apart. Gaps keeps t\
|
|
2463
2463
|
he SPACE between neighbours equal \u2014 what a row of growing bars needs."},{key:"spacing",label:"Spacing",type:"number",default:-1,step:.5,unit:"px",description:"The step (Edges) or the gap (Gaps). \
|
|
2464
2464
|
Negative spreads across the existing bounds."}],cook(e){let t=e.shapes("in");if(t.length<2)return{out:z(t)};let n=e.enumOf("axis",["x","y"]),r=e.enumOf("mode",["edges","gaps"]),i=e.num("spacing"),s=t.
|
|
2465
|
-
map(w=>({shape:w,b:$e(w)})),a=tt(t);if(!a)return{out:z(t)};let u=[...s].sort((w,P)=>{let E=w.b?n==="x"?w.b.x:w.b.y:0,T=P.b?n==="x"?P.b.x:P.b.y:0;return E-T}),
|
|
2466
|
-
w=>w.b),d=w=>n==="x"?w.w:w.h,A=i>=0?i:
|
|
2467
|
-
set(w.id,w);return}let T=r==="gaps"?b:
|
|
2465
|
+
map(w=>({shape:w,b:$e(w)})),a=tt(t);if(!a)return{out:z(t)};let u=[...s].sort((w,P)=>{let E=w.b?n==="x"?w.b.x:w.b.y:0,T=P.b?n==="x"?P.b.x:P.b.y:0;return E-T}),f=n==="x"?a.x:a.y,h=n==="x"?a.w:a.h,m=u.filter(
|
|
2466
|
+
w=>w.b),d=w=>n==="x"?w.w:w.h,A=i>=0?i:h/Math.max(1,u.length-1),g=m.reduce((w,P)=>w+d(P.b),0),x=i>=0?i:Math.max(0,h-g)/Math.max(1,m.length-1),v=new Map,b=f;return u.forEach(({shape:w,b:P},E)=>{if(!P){v.
|
|
2467
|
+
set(w.id,w);return}let T=r==="gaps"?b:f+A*E;b=T+d(P)+x;let M=n==="x"?P.x:P.y,R=T-M;v.set(w.id,{...w,transform:Ae(_e(n==="x"?R:0,n==="y"?R:0),w.transform)})}),{out:z(t.map((w,P)=>({...v.get(w.id)??w,meta:{
|
|
2468
2468
|
...w.meta,index:P}})))}}},Wy={type:"merge",label:"Merge",category:"layout",description:"Concatenate several streams into one, in connection order. Group hands them on as one shape; name the node to ta\
|
|
2469
2469
|
g what leaves it.",keywords:["join","concat","combine","collect","group","bake","flatten","unit","as one","wrap","compound"],inputs:[{name:"in",type:"shapes",multi:!0}],outputs:[{name:"out",type:"shap\
|
|
2470
2470
|
es"}],params:[{key:"group",label:"Group",type:"bool",default:!1,description:"Leave as one group shape instead of a stream \u2014 Align, Array and Jitter then move the lot as a unit. The same as a Group nod\
|
|
2471
|
-
e after the Merge."}],cook(e){let t=[];for(let n of e.inputList("in"))if(n.t==="shapes")for(let r of n.v)t.push(
|
|
2471
|
+
e after the Merge."}],cook(e){let t=[];for(let n of e.inputList("in"))if(n.t==="shapes")for(let r of n.v)t.push(Nr(r,t.length));return e.bool("group")&&t.length>0?{out:z([{id:e.shapeId(0),kind:"group",
|
|
2472
2472
|
children:t,style:{},transform:[1,0,0,1,0,0],meta:e.meta(0)}])}:{out:z(t)}}},Xy=["source","reading","x","y","angle","shuffle"],bs=e=>t=>(J(t.by).base??"source")!==e;function gu(e){let t=`${e.meta.sourceNodeId}\
|
|
2473
2473
|
:`;if(e.id.startsWith(t)){let n=Number.parseInt(e.id.slice(t.length),10);if(Number.isFinite(n))return n}return e.meta.index}function Gy(e){if(e.length===0)return 0;let t=[...e].sort((r,i)=>r-i),n=Math.
|
|
2474
2474
|
floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}var qy={type:"sort",label:"Sort",category:"layout",description:"Renumber a stream \u2014 back to the order its emitter made it (Source), or by where\
|
|
@@ -2482,13 +2482,13 @@ min:0,max:5,step:.05,description:"How far two centres may sit apart vertically,
|
|
|
2482
2482
|
y.",dimWhen:bs("reading")},{key:"start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:"Where the count begins around the stream's centre: 0 is 12 o'clock, 90 is 3 o'clock, clockw\
|
|
2483
2483
|
ise from there \u2014 the Tick Ring convention. Around centre only.",dimWhen:bs("angle")},{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll the shuffle \u2014 the \u2212/+ steppers walk th\
|
|
2484
2484
|
rough orders. 0 = the project seed alone. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead. Shuffle only.",dimWhen:bs("shuffle")},{key:"reverse",label:"Reverse",type:"bool",default:!1}],
|
|
2485
|
-
cook(e){let t=e.shapes("in"),n=e.enumOf("by",Xy),r;if(n==="shuffle"){let i=e.inputs.reseed,s=0;if(i?.t==="number"){let{playing:
|
|
2486
|
-
int("salt"),u=new Map(t.map(
|
|
2485
|
+
cook(e){let t=e.shapes("in"),n=e.enumOf("by",Xy),r;if(n==="shuffle"){let i=e.inputs.reseed,s=0;if(i?.t==="number"){let{playing:f,local:h}=tn(i.v);s=f?Math.round((e.t-h)*1e3):-Math.round(h*1e3)-1}let a=e.
|
|
2486
|
+
int("salt"),u=new Map(t.map(f=>[f.id,e.rand("shuffle",a,s,f.id).next()]));r=[...t].sort((f,h)=>u.get(f.id)-u.get(h.id)||f.id.localeCompare(h.id))}else if(n==="source"){let i=[];for(let s of t)i.includes(
|
|
2487
2487
|
s.meta.sourceNodeId)||i.push(s.meta.sourceNodeId);r=[...t].sort((s,a)=>{let u=i.indexOf(s.meta.sourceNodeId)-i.indexOf(a.meta.sourceNodeId);return u!==0?u:gu(s)-gu(a)||s.id.localeCompare(a.id)})}else{
|
|
2488
|
-
let i=[],s=[];for(let a of t){let u=$e(a);if(u){let
|
|
2489
|
-
a.cx-u.cx);else if(n==="reading"){let a=e.num("rowTolerance")*Gy(i.map(
|
|
2490
|
-
|
|
2491
|
-
1e-6?0:A};i.sort((m,d)=>
|
|
2488
|
+
let i=[],s=[];for(let a of t){let u=$e(a);if(u){let f=Ue(u);i.push({shape:a,cx:f.x,cy:f.y,h:u.h})}else s.push(a)}if(n==="x")i.sort((a,u)=>a.cx-u.cx||a.cy-u.cy);else if(n==="y")i.sort((a,u)=>a.cy-u.cy||
|
|
2489
|
+
a.cx-u.cx);else if(n==="reading"){let a=e.num("rowTolerance")*Gy(i.map(f=>f.h));i.sort((f,h)=>f.cy-h.cy);let u=[];for(let f of i){let h=u[u.length-1];h&&f.cy-h[0].cy<=a?h.push(f):u.push([f])}for(let f of u)
|
|
2490
|
+
f.sort((h,m)=>h.cx-m.cx);i.splice(0,i.length,...u.flat())}else{let a=tt(t),u=a?Ue(a):{x:0,y:0},f=yr(e.num("start")),h=m=>{let A=((Math.atan2(m.cy-u.y,m.cx-u.x)*180/Math.PI-f)%360+360)%360;return A>360-
|
|
2491
|
+
1e-6?0:A};i.sort((m,d)=>h(m)-h(d)||Math.hypot(m.cx-u.x,m.cy-u.y)-Math.hypot(d.cx-u.x,d.cy-u.y))}r=[...i.map(a=>a.shape),...s]}return e.bool("reverse")&&r.reverse(),{out:z(r.map((i,s)=>Nr(i,s)))}}},Hy={
|
|
2492
2492
|
type:"group",label:"Group",category:"layout",description:"Retired: a Merge with Group ticked does this. Kept so older documents still load. Wraps a stream in one group shape.",hidden:!0,inputs:[{name:"\
|
|
2493
2493
|
in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"name",label:"Tag",type:"string",default:"group",exposable:!1,description:"An extra tag on the group shape. Naming the node itself\
|
|
2494
2494
|
(the field at the top of the inspector) tags it too, and works on every node."}],cook(e){let t=e.shapes("in");return t.length===0?{out:z([])}:{out:z([{id:e.shapeId(0),kind:"group",children:t,style:{},
|
|
@@ -2503,9 +2503,9 @@ t.length);if(e.bool("each")){let s=t.map(u=>$e(u)??{x:0,y:0,w:0,h:0}),a=u=>({t:"
|
|
|
2503
2503
|
count:n}}let r=tt(t)??{x:0,y:0,w:0,h:0},i=Ue(r);return{out:z(t),x:De(r.x),y:De(r.y),w:De(r.w),h:De(r.h),cx:De(i.x),cy:De(i.y),count:n}}},Uy=[Qy,$y,Fy,Yy,Wy,qy,Hy],zy={type:"time",label:"Time",category:"\
|
|
2504
2504
|
driver",timeRoot:!0,description:"Seconds, scaled and offset. The root of most motion.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"speed",label:"Speed",type:"number",default:1,step:.01},
|
|
2505
2505
|
{key:"offset",label:"Offset",type:"number",default:0,step:.01,unit:"s"}],cook(e){return{out:De(e.t*e.num("speed")+e.num("offset"))}}},bu=["sine","triangle","square","saw","sh","random"],jy={sine:"Sine",
|
|
2506
|
-
triangle:"Triangle",square:"Square",saw:"Saw",sh:"S&H",random:"Random"},
|
|
2506
|
+
triangle:"Triangle",square:"Square",saw:"Saw",sh:"S&H",random:"Random"},fi=e=>J(e.shape).base??"sine",Vy=e=>fi(e)==="square"||fi(e)==="triangle",Zy=e=>fi(e)==="sh"||fi(e)==="random";function Jy(e,t,n,r){
|
|
2507
2507
|
let i=Math.floor(t),s=t-i,a=Math.max(0,Math.min(1,n));switch(e){case"sine":return Math.sin(s*Math.PI*2);case"triangle":return s<a?-1+2*s/a:1-2*(s-a)/(1-a);case"square":return s<a?1:-1;case"saw":return s*
|
|
2508
|
-
2-1;case"sh":return r(i);case"random":{let u=r(i),
|
|
2508
|
+
2-1;case"sh":return r(i);case"random":{let u=r(i),f=r(i+1),h=(1-Math.cos(s*Math.PI))/2;return u+(f-u)*h}}}var Ky="lfo-hold",vi=e=>e===0?"":e,e0={type:"lfo",label:"LFO",category:"driver",timeRoot:!0,description:"\
|
|
2509
2509
|
A periodic wave over time. Wire its rate for FM, its width for PWM.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"shape",label:"Shape",type:"enum",default:"sine",options:bu.map(e=>({value:e,
|
|
2510
2510
|
label:jy[e]})),description:"S&H holds one seeded random value per cycle; Random glides between them. Both replay identically."},{key:"rate",label:"Rate",type:"number",default:.5,min:0,step:.01,unit:"h\
|
|
2511
2511
|
z"},{key:"amplitude",label:"Amplitude",type:"number",default:1,step:.1},{key:"unipolar",label:"From 0",type:"bool",default:!1,inline:!0,description:"Swing from Center up to Center + Amplitude instead \
|
|
@@ -2545,12 +2545,12 @@ step:.1},{key:"clamp",label:"Clamp",type:"bool",default:!0},{key:"ease",label:"E
|
|
|
2545
2545
|
n",label:"Ease In"},{value:"out",label:"Ease Out"}]}],cook(e){let t=e.num("inMin"),r=e.num("inMax")-t,i=r===0?0:(e.num("value")-t)/r;switch(e.bool("clamp")&&(i=Math.min(1,Math.max(0,i))),e.enumOf("eas\
|
|
2546
2546
|
e",["linear","smooth","in","out"])){case"smooth":i=i*i*(3-2*i);break;case"in":i=i*i;break;case"out":i=1-(1-i)*(1-i);break;case"linear":break}let s=e.num("outMin");return{out:De(s+(e.num("outMax")-s)*i)}}},
|
|
2547
2547
|
a0=[zy,e0,t0,n0,i0,r0,o0,s0],l0=[{value:"index",label:"Index"},{value:"normalized",label:"Normalized"}],u0=[{value:"forward",label:"Forward"},{value:"reverse",label:"Reverse"},{value:"random",label:"R\
|
|
2548
|
-
andom"},{value:"pingpong",label:"Ping-pong"}],c0=[{value:"cut",label:"Cut"},{value:"fade",label:"Fade"},{value:"scale",label:"Scale"},{value:"draw",label:"Draw"},{value:"wipe",label:"Wipe"}],
|
|
2548
|
+
andom"},{value:"pingpong",label:"Ping-pong"}],c0=[{value:"cut",label:"Cut"},{value:"fade",label:"Fade"},{value:"scale",label:"Scale"},{value:"draw",label:"Draw"},{value:"wipe",label:"Wipe"}],f0=(e,t)=>(e%
|
|
2549
2549
|
t+t)%t;function wo(e,t){if(t<=0)return{from:0,to:0,t:0};let n=e.enumOf("range",["index","normalized"]),r=e.enumOf("order",["forward","reverse","random","pingpong"]),i=e.bool("wrap"),s=Math.max(0,Math.
|
|
2550
|
-
min(1,e.num("blend"))),a=Math.max(1,r==="pingpong"?2*t-2:t),u=e.num("index");if(!Number.isFinite(u))return{from:0,to:0,t:0};let
|
|
2551
|
-
|
|
2552
|
-
let T=g(E);if(T[0]===g(E-1)[t-1]){let M=T[0];T[0]=T[1],T[1]=M}return T},v=E=>{if(E<0)return-1;let T=Math.floor(E/a),M=
|
|
2553
|
-
b=v(
|
|
2550
|
+
min(1,e.num("blend"))),a=Math.max(1,r==="pingpong"?2*t-2:t),u=e.num("index");if(!Number.isFinite(u))return{from:0,to:0,t:0};let f=n==="normalized"?u*a:u;f=Math.max(-1,i?f:Math.min(a-1,f));let h=Math.floor(
|
|
2551
|
+
f),m=f-h,d=vi(e.int("salt")),A=r==="random"&&t>2,g=E=>{let T=Array.from({length:t},(R,S)=>S),M=e.rand("switch-order",d,E);for(let R=t-1;R>0;R--){let S=M.int(0,R+1),_=T[R];T[R]=T[S],T[S]=_}return T},x=E=>{
|
|
2552
|
+
let T=g(E);if(T[0]===g(E-1)[t-1]){let M=T[0];T[0]=T[1],T[1]=M}return T},v=E=>{if(E<0)return-1;let T=Math.floor(E/a),M=f0(E,a);return r==="pingpong"&&M>=t&&(M=a-M),r==="reverse"&&(M=t-1-M),A?x(T)[M]:M},
|
|
2553
|
+
b=v(h);if(!i&&h>=a-1)return{from:b,to:b,t:0};let w=v(h+1),P=s<=0?m<.5?0:1:Math.max(0,Math.min(1,(m-(.5-s/2))/s));return{from:b,to:w,t:P}}var h0=e=>J(e.order).base!=="random",p0={input:{index:"0 = the \
|
|
2554
2554
|
first wire, 1 = the second \u2014 the number on each row; \u22121 is an empty slot, nothing out, so a toggle here switches the wire off. Drive it from an LFO, Seq or Random Value; fractions sit between two inpu\
|
|
2555
2555
|
ts.",range:"Normalized spreads 0..1 over every input, so a stock LFO pages through however many are wired.",wrap:"Past the last input, come round to the first. Off holds at the ends.",order:"The route\
|
|
2556
2556
|
Index takes through the inputs. Random reshuffles every cycle, deterministically."},output:{index:"0 = the first output, 1 = the second \u2014 the number on each row; \u22121 sends the stream nowhere. Drive it\
|
|
@@ -2559,31 +2559,31 @@ ast output in use, come round to the first. Off holds at the ends.",order:"The r
|
|
|
2559
2559
|
return[{key:"index",label:"Index",type:"number",default:0,min:-1,step:1,description:n.index},{key:"range",label:"Range",type:"enum",default:"index",options:l0,description:n.range},{key:"wrap",label:"W\
|
|
2560
2560
|
rap",type:"bool",default:!0,description:n.wrap},{key:"order",label:"Order",type:"enum",default:"forward",options:u0,description:n.order},{key:"blend",label:"Blend",type:"number",default:0,min:0,max:1,
|
|
2561
2561
|
step:.01,description:"Width of the crossing, in steps: 0 = hard cut at the half step, 1 = the whole step is a crossfade."},...e,{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll \
|
|
2562
|
-
the Random route alone \u2014 the \u2212/+ steppers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:
|
|
2562
|
+
the Random route alone \u2014 the \u2212/+ steppers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:h0}]}var d0={name:"in",type:"shapes",multi:!0,indexed:!0};function gc(e,t,n="\
|
|
2563
2563
|
switch"){return e.map((r,i)=>({...r,meta:{...r.meta,index:t+i,tags:[...r.meta.tags??[],n]}}))}function Bs(e,t,n,r,i,s){let a=[];for(let u of t)switch(r){case"fade":a.push(ci(u,n));break;case"scale":a.
|
|
2564
2564
|
push(mc(u,n,i));break;case"draw":a.push(...Ac(e,u,n,s+a.length));break}return a}var bc=[{key:"transition",label:"Transition",type:"enum",default:"fade",options:c0,description:"How the outgoing wire le\
|
|
2565
2565
|
aves and the incoming arrives while Blend is crossing. Cut ignores Blend."},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:Ai,description:"Scale transition only: cross on both axes,\
|
|
2566
2566
|
or squash along one like a blind.",dimWhen:e=>J(e.transition).base!=="scale"},{key:"angle",label:"Wipe Angle",type:"number",default:0,step:1,unit:"deg",description:"Direction the wipe front travels. \
|
|
2567
2567
|
Wipe only.",dimWhen:e=>J(e.transition).base!=="wipe"}],m0={type:"switch",label:"Switch",category:"layout",description:"Show one of several wires; Index picks, fractions cross between two.",quickKey:"i\
|
|
2568
2568
|
ndex",inputs:[d0],outputs:[{name:"out",type:"shapes"}],params:ko(bc),cook(e){let t=e.inputList("in").flatMap(g=>g.t==="shapes"?[g.v]:[]),n=t.length;if(n===0)return{out:z([])};let{from:r,to:i,t:s}=wo(e,
|
|
2569
|
-
n),a=e.enumOf("transition",["cut","fade","scale","draw","wipe"]),u=e.enumOf("axis",["both","x","y"]),
|
|
2570
|
-
out:z(
|
|
2571
|
-
push(...bo(e,
|
|
2569
|
+
n),a=e.enumOf("transition",["cut","fade","scale","draw","wipe"]),u=e.enumOf("axis",["both","x","y"]),f=g=>g<0?[]:t[g];if(r===i||s<=0)return{out:z(f(r))};if(s>=1)return{out:z(f(i))};if(a==="cut")return{
|
|
2570
|
+
out:z(f(s<.5?r:i))};let h=f(r),m=f(i),d=[];if(a==="wipe"){let g=Ls(e.num("angle")),x=Fs([...h,...m],g),v={...x,perShape:x.perShape.slice(0,h.length)},b={...x,perShape:x.perShape.slice(h.length)};return d.
|
|
2571
|
+
push(...bo(e,h,s,g,v,"ahead","switch","a")),d.push(...bo(e,m,s,g,b,"behind","switch","b")),{out:z(d)}}let A=(g,x)=>d.push(...gc(Bs(e,g,x,a,u,d.length),d.length));return A(h,1-s),A(m,s),{out:z(d)}}},Ys=8,
|
|
2572
2572
|
vs=Array.from({length:Ys},(e,t)=>`out${t}`),A0=z([]);function xs(e){let t=J(e.count).base,n=typeof t=="number"&&Number.isFinite(t)?Math.round(t):2;return Math.max(2,Math.min(Ys,n))}var y0={type:"route",
|
|
2573
2573
|
label:"Route",category:"layout",description:"Send one wire to one of several outputs; Index picks, fractions cross between two.",keywords:["demux","demultiplex","output switch","distribute","send","de\
|
|
2574
2574
|
stination"],quickKey:"index",inputs:[{name:"in",type:"shapes"}],outputs:vs.map((e,t)=>({name:e,type:"shapes",label:String(t),hideWhen:n=>t>=xs(n)})),params:[{key:"count",label:"Outputs",type:"int",default:2,
|
|
2575
2575
|
min:2,max:Ys,description:"How many outputs the node has, up to 8. Index walks these; Normalized, Wrap and Order spread over them. An output still wired past the count keeps its row."},...ko(bc,"output").
|
|
2576
2576
|
map(e=>e.key==="index"&&e.type==="number"?{...e,rangeFor:t=>({min:-1,max:xs(t)-1})}:e)],cook(e){let t=e.shapes("in"),n=xs({...e.params,count:e.int("count")}),r={};for(let d of vs)r[d]=A0;if(t.length===
|
|
2577
|
-
0)return r;let i=(d,A)=>{d>=0&&(r[vs[d]]=z(A))},{from:s,to:a,t:u}=wo(e,n),
|
|
2578
|
-
r;if(u>=1)return i(a,t),r;if(
|
|
2579
|
-
let m=(d,A)=>gc(d,0,"route").map(g=>({...g,id:`${g.id}:${A}`}));return i(s,m(Bs(e,t,1-u,h,
|
|
2577
|
+
0)return r;let i=(d,A)=>{d>=0&&(r[vs[d]]=z(A))},{from:s,to:a,t:u}=wo(e,n),f=e.enumOf("transition",["cut","fade","scale","draw","wipe"]),h=e.enumOf("axis",["both","x","y"]);if(s===a||u<=0)return i(s,t),
|
|
2578
|
+
r;if(u>=1)return i(a,t),r;if(f==="cut")return i(u<.5?s:a,t),r;if(f==="wipe"){let d=Ls(e.num("angle")),A=Fs(t,d);return i(s,bo(e,t,u,d,A,"ahead","route","a")),i(a,bo(e,t,u,d,A,"behind","route","b")),r}
|
|
2579
|
+
let m=(d,A)=>gc(d,0,"route").map(g=>({...g,id:`${g.id}:${A}`}));return i(s,m(Bs(e,t,1-u,f,h,0),"a")),i(a,m(Bs(e,t,u,f,h,0),"b")),r}},g0={type:"switch-value",label:"Switch Value",category:"driver",description:"\
|
|
2580
2580
|
Output one of several number wires; Index picks, Blend lerps between two.",quickKey:"index",inputs:[{name:"in",type:"number",multi:!0,indexed:!0}],outputs:[{name:"out",type:"number"}],params:ko([]),cook(e){
|
|
2581
|
-
let t=e.inputList("in").flatMap(
|
|
2581
|
+
let t=e.inputList("in").flatMap(h=>h.t==="number"?[h.v]:[]),n=t.length;if(n===0)return{out:De(0)};let{from:r,to:i,t:s}=wo(e,n),a=r<0?0:t[r],u=t[i],f=a+(u-a)*s;return{out:De(Number.isFinite(f)?f:0)}}},
|
|
2582
2582
|
b0={type:"switch-color",label:"Switch Color",category:"driver",description:"Output one of several colour wires; Index picks, Blend mixes between two.",quickKey:"index",inputs:[{name:"in",type:"color",
|
|
2583
|
-
multi:!0,indexed:!0,accepts:["paint"]}],outputs:[{name:"out",type:"color"}],params:ko([]),cook(e){let t=e.inputList("in").flatMap(
|
|
2584
|
-
"#ffffff")};let{from:r,to:i,t:s}=wo(e,n),a=r<0?"none":t[r],u=t[i],h
|
|
2583
|
+
multi:!0,indexed:!0,accepts:["paint"]}],outputs:[{name:"out",type:"color"}],params:ko([]),cook(e){let t=e.inputList("in").flatMap(h=>h.t==="color"||h.t==="paint"?[h.v]:[]),n=t.length;if(n===0)return{out:ln(
|
|
2584
|
+
"#ffffff")};let{from:r,to:i,t:s}=wo(e,n),a=r<0?"none":t[r],u=t[i],f=h=>Bn(h)?sr(h):ln(h);return s<=0?{out:f(a)}:s>=1?{out:f(u)}:Bn(a)||Bn(u)?{out:f(s<.5?a:u)}:{out:ln(dc(a,u,s))}}},vu={},v0={type:"swi\
|
|
2585
2585
|
tch-texture",label:"Switch Texture",category:"post",description:"Show one of several rasters; Index picks, fractions dissolve between two.",quickKey:"index",inputs:[{name:"in",type:"texture",multi:!0,
|
|
2586
|
-
indexed:!0}],outputs:[{name:"out",type:"texture"}],params:ko([]),cook(e){let t=e.inputList("in").flatMap(
|
|
2586
|
+
indexed:!0}],outputs:[{name:"out",type:"texture"}],params:ko([]),cook(e){let t=e.inputList("in").flatMap(f=>f.t==="texture"?[f.v]:[]),n=t.length;if(n===0)return vu;let{from:r,to:i,t:s}=wo(e,n);if(r===
|
|
2587
2587
|
i||s<=0)return r<0?vu:{out:Ye(t[r])};if(s>=1)return{out:Ye(t[i])};let a=t[i],u=r<0?{...a,data:new Uint8ClampedArray(a.width*a.height*4)}:t[r];return{out:Ye(_l(u,a,s,e.canvas.origin??"top-left"))}}},x0=[
|
|
2588
2588
|
m0,y0,g0,b0,v0],I0={type:"value",label:"Value",category:"driver",description:"A single number, wired anywhere it is needed.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"value",label:"\
|
|
2589
2589
|
Value",type:"number",default:1,step:.1}],cook(e){return{out:De(e.num("value"))}}},w0={type:"color-value",label:"Color",category:"driver",description:"A single colour, wired anywhere it is needed. Seve\
|
|
@@ -2619,19 +2619,19 @@ m one colour to the next \u2014 along an angle, or out from a centre \u2014 wire
|
|
|
2619
2619
|
s the part it covers. Alpha rides in the stops.",keywords:["gradient","ramp","fade","linear","radial","paint","blend","fill","stroke","colour"],inputs:[],outputs:[{name:"out",type:"paint"}],params:Iu(
|
|
2620
2620
|
void 0),specialize(e){return{params:Iu(e)}},cook(e){let t=kc(e),n=e.enumOf("kind",["linear","radial","conic"]),r;if(n==="linear")r={...t,kind:"linear",angle:e.num("angle"),start:e.num("start"),end:e.num(
|
|
2621
2621
|
"end")};else if(n==="conic"){let i=e.vec2("center");r={...t,kind:"conic",cx:i.x,cy:i.y,angle:e.num("angle")}}else{let i=e.vec2("center"),s=e.bool("useFocal")?e.vec2("focal"):void 0;r={...t,kind:"radia\
|
|
2622
|
-
l",cx:i.x,cy:i.y,r:e.num("radius"),...s?{fx:s.x,fy:s.y}:{}}}return{out:sr(r)}}},D0=e=>(J(e.mode).base??"fbm")!=="fbm",
|
|
2622
|
+
l",cx:i.x,cy:i.y,r:e.num("radius"),...s?{fx:s.x,fy:s.y}:{}}}return{out:sr(r)}}},D0=e=>(J(e.mode).base??"fbm")!=="fbm",O0=[{key:"mode",label:"Mode",type:"enum",default:"fbm",options:[{value:"value",label:"\
|
|
2623
2623
|
Value"},{value:"fbm",label:"Turbulence"},{value:"cells",label:"Cells"},{value:"blocks",label:"Blocks"}],description:"Value: one smooth layer of noise \u2014 simplex, so its swells are round blobs with no g\
|
|
2624
2624
|
rid to line up on. Turbulence: octaves of it summed, finer and fainter each, every layer turned \u2014 clouds. Cells: the distance to scattered points \u2014 scales, foam, Voronoi. Blocks: one flat value per ce\
|
|
2625
2625
|
ll, a mosaic; with Speed it cuts to a new field each step, like static."},{key:"stops",label:"Stops",type:"stops",default:Ar,min:Ar,max:xi,description:"The ramp the field reads through, dark to light:\
|
|
2626
|
-
the first stop where the noise is 0, the last where it is 1. Click the bar to add a stop, drag a handle to move one."}],
|
|
2626
|
+
the first stop where the noise is 0, the last where it is 1. Click the bar to add a stop, drag a handle to move one."}],N0=[{key:"scale",label:"Scale",type:"number",default:64,min:1,max:4096,step:1,unit:"\
|
|
2627
2627
|
px",description:"Pixels per cell of the field: small is fine grain, large is slow swells."},{key:"octaves",label:"Octaves",type:"int",default:4,min:1,max:8,description:"Turbulence: how many layers are\
|
|
2628
2628
|
summed, each twice as fine and half as loud.",dimWhen:D0},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Another field entirely. Whole steps only."},{key:"speed",label:"Speed",type:"\
|
|
2629
2629
|
number",default:0,min:0,max:10,step:.05,unit:"/s",description:"How fast the field flows: Value and Turbulence turn the slopes under the swells, Cells glide their points, every one at its own pace, so \
|
|
2630
2630
|
the motion never pauses as a whole; Blocks cut to a new mosaic this many times a second. 0 holds it still."},{key:"rate",label:"Rate",type:"number",default:12,min:0,max:120,step:1,unit:"/s",description:"\
|
|
2631
2631
|
A moving field is repainted this many times a second; between repaints the frame reuses the last picture. 0 repaints every frame."},{key:"detail",label:"Detail",type:"enum",default:"half",options:[{value:"\
|
|
2632
2632
|
full",label:"Full"},{value:"half",label:"Half"},{value:"quarter",label:"Quarter"}],description:"How finely the field is painted: a texel per pixel, per two, or per four, the pattern stretching the res\
|
|
2633
|
-
t. Smooth noise loses nothing at Half and costs a quarter. Blocks paint one texel per cell whatever this says.",dimWhen:e=>J(e.mode).base==="blocks"},...wc];function wu(e){return[...
|
|
2634
|
-
...
|
|
2633
|
+
t. Smooth noise loses nothing at Half and costs a quarter. Blocks paint one texel per cell whatever this says.",dimWhen:e=>J(e.mode).base==="blocks"},...wc];function wu(e){return[...O0,...Ic(xc(e?.params)),
|
|
2634
|
+
...N0]}var Q0={type:"noise-paint",label:"Noise Paint",category:"driver",description:"A noise field as a fill or stroke \u2014 clouds, grain, cells \u2014 read through a ramp of stops, wired into any Fill or Str\
|
|
2635
2635
|
oke. Painted as pixels over each shape\u2019s box (or the frame), since SVG has no noise of its own; exports as a pattern.",keywords:["noise","perlin","turbulence","fbm","cells","voronoi","worley","te\
|
|
2636
2636
|
xture","paint","fill","clouds","grain"],inputs:[],outputs:[{name:"out",type:"paint"}],params:wu(void 0),specialize(e){return{params:wu(e)}},timeRoot:e=>{let t=J(e.speed).base;return typeof t=="number"?
|
|
2637
2637
|
t>0:!1},cook(e){let t=Math.max(0,e.num("speed")),n=Math.max(0,e.num("rate")),r=n>0?Math.floor(e.t*n)/n:e.t,i={full:1,half:.5,quarter:.25}[e.enumOf("detail",["full","half","quarter"])],s={...kc(e),kind:"\
|
|
@@ -2666,21 +2666,21 @@ label:W0[e],type:"bool",default:e==="accent"||e==="dim"||e==="faint",group:"Pain
|
|
|
2666
2666
|
group:"Paint",description:"Share of shapes left as they were, seeded \u2014 most cells hollow, a few lit. 0 paints everything.",dimWhen:oi},{key:"salt",label:"Seed",type:"int",default:1,min:0,group:"P\
|
|
2667
2667
|
aint",description:"Reroll the deal and the skips \u2014 the \u2212/+ steppers walk through them. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead.",dimWhen:e=>oi(e)||J(e.mode).
|
|
2668
2668
|
base==="cycle"}],cook(e){let t={...Object.fromEntries(ri.map(A=>[A,ln(e.color(A))])),...Object.fromEntries(ku.map(A=>[A,De(e.num(A))]))},n=e.shapes("in"),r=e.enumOf("mode",F0);if(r==="off"||n.length===
|
|
2669
|
-
0)return{...t,out:z(n)};let i=n.length,s=e.enumOf("target",Y0),a=Math.max(0,Math.min(1,e.num("skip"))),u=ri.filter(A=>e.bool(Cu[A]));if(u.length===0)return{...t,out:z(n)};let
|
|
2670
|
-
t==="number"){let{playing:A,local:g}=tn(
|
|
2669
|
+
0)return{...t,out:z(n)};let i=n.length,s=e.enumOf("target",Y0),a=Math.max(0,Math.min(1,e.num("skip"))),u=ri.filter(A=>e.bool(Cu[A]));if(u.length===0)return{...t,out:z(n)};let f=e.inputs.reseed,h=0;if(f?.
|
|
2670
|
+
t==="number"){let{playing:A,local:g}=tn(f.v);h=A?Math.round((e.t-g)*1e3):-Math.round(g*1e3)-1}let m=`${e.int("salt")}|${h}`,d=n.map((A,g)=>{let x=u.map(w=>e.color(w,g,i));if(a>0&&e.rand("palette-skip",
|
|
2671
2671
|
m,g).next()<a)return A;let v;if(r==="random")v=x[e.rand("palette",m,g).int(0,x.length)];else if(r==="cycle")v=x[g%x.length];else{let w=i>1&&x.length>1?g/(i-1)*(x.length-1):0,P=Math.min(x.length-2,Math.
|
|
2672
|
-
floor(w));v=x.length>1?dc(x[P],x[P+1],w-P):x[0]}let b={...A.style};return s!=="stroke"&&(b.fill=v),s!=="fill"&&(b.stroke=v),{...A,style:b,meta:{...A.meta,index:g}}});return{...t,out:z(d)}}},It={};function
|
|
2673
|
-
return J(e.size).base==="content"}function G0(e){return!
|
|
2672
|
+
floor(w));v=x.length>1?dc(x[P],x[P+1],w-P):x[0]}let b={...A.style};return s!=="stroke"&&(b.fill=v),s!=="fill"&&(b.stroke=v),{...A,style:b,meta:{...A.meta,index:g}}});return{...t,out:z(d)}}},It={};function hi(e){
|
|
2673
|
+
return J(e.size).base==="content"}function G0(e){return!hi(e)}function q0(e){return hi(e)||!(Number(J(e.width).base)>0||Number(J(e.height).base)>0)}function H0(e,t,n,r){if(e==="none"||t.w<=0||t.h<=0||
|
|
2674
2674
|
n===t.w&&r===t.h)return;let i=e==="stretch"?n/t.w:e==="contain"?Math.min(n/t.w,r/t.h):Math.max(n/t.w,r/t.h),s=e==="stretch"?r/t.h:i;return t.origin==="center"?Kt(i,s):Ae(_e(n/2-i*t.w/2,r/2-s*t.h/2),Kt(
|
|
2675
2675
|
i,s))}var $0={type:"rasterize",label:"Rasterize",category:"post",description:"The vector/raster boundary: draws the incoming shapes to pixels. Everything downstream is post.",inputs:[{name:"in",type:"\
|
|
2676
2676
|
shapes"}],outputs:[{name:"out",type:"texture"}],params:[{key:"size",label:"Size",type:"enum",default:"canvas",options:[{value:"canvas",label:"Canvas"},{value:"content",label:"Content bounds"}],description:"\
|
|
2677
2677
|
Content bounds draws only the pixels the shapes cover (plus Padding) and remembers where they sat \u2014 smaller, faster post."},{key:"width",label:"Width",type:"int",default:0,min:0,unit:"px",description:"\
|
|
2678
|
-
0 = canvas width",dimWhen:
|
|
2678
|
+
0 = canvas width",dimWhen:hi},{key:"height",label:"Height",type:"int",default:0,min:0,unit:"px",description:"0 = canvas height",dimWhen:hi},{key:"padding",label:"Padding",type:"int",default:16,min:0,unit:"\
|
|
2679
2679
|
px",description:"Room around the content for blur and bloom to breathe.",dimWhen:G0},{key:"fit",label:"Fit",type:"enum",default:"none",options:[{value:"none",label:"None"},{value:"stretch",label:"Stre\
|
|
2680
2680
|
tch"},{value:"contain",label:"Contain"},{value:"cover",label:"Cover"}],description:"With a Width or Height of its own: None keeps the document\u2019s coordinates and the box crops; Stretch scales the canva\
|
|
2681
2681
|
s onto the box; Contain keeps the aspect inside it, Cover keeps the aspect over it.",dimWhen:q0},{key:"bg",label:"Background",type:"color",default:"none"}],cook(e){if(!e.rasterize)throw new Error("no \
|
|
2682
|
-
rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let t=e.shapes("in");if(e.enumOf("size",["canvas","content"])==="content"){let u=tt(t);if(!u)return It;let
|
|
2683
|
-
max(0,e.int("padding")),
|
|
2682
|
+
rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let t=e.shapes("in");if(e.enumOf("size",["canvas","content"])==="content"){let u=tt(t);if(!u)return It;let f=Math.
|
|
2683
|
+
max(0,e.int("padding")),h=Math.floor(u.x-f),m=Math.floor(u.y-f),d=Math.max(1,Math.ceil(u.x+u.w+f)-h),A=Math.max(1,Math.ceil(u.y+u.h+f)-m),g=t.map(b=>({...b,transform:Ae(_e(-h,-m),b.transform)})),x={x:h,
|
|
2684
2684
|
y:m},v=e.rasterize({width:d,height:A,background:e.color("bg"),origin:"top-left",layers:[{id:e.nodeId,name:"rasterize",opacity:1,visible:!0,order:0,shapes:g}]},x);return{out:Ye(v.at?v:{...v,at:x})}}let n=e.
|
|
2685
2685
|
int("width")||e.canvas.w,r=e.int("height")||e.canvas.h;if(n<=0||r<=0)throw new Error("has no size to draw at \u2014 set width/height, or give the project a canvas");let i=H0(e.enumOf("fit",["none","st\
|
|
2686
2686
|
retch","contain","cover"]),e.canvas,n,r),s=i?t.map(u=>({...u,transform:Ae(i,u.transform)})):t,a=e.rasterize({width:n,height:r,background:e.color("bg"),origin:e.canvas.origin,layers:[{id:e.nodeId,name:"\
|
|
@@ -2696,8 +2696,8 @@ Off: the edges reroll with every step too."},{key:"probability",label:"Probabili
|
|
|
2696
2696
|
unit:"/s",description:"pattern changes per second; 0 freezes the tear"},{key:"channelShift",label:"RGB Shift",type:"number",default:3,min:0,max:40,step:.5,unit:"px",description:"An extra shift for the\
|
|
2697
2697
|
red plane alone \u2014 the classic colour tear along a band."},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the tear pattern \u2014 a different set of bands for the same pr\
|
|
2698
2698
|
oject seed. Whole steps only, so a driver ticks rather than boils. 0 = the node\u2019s own stream."}],cook(e){let t=e.texture();if(!t)return It;let n=e.num("amount"),r=e.num("vertical"),i=Math.max(1,e.
|
|
2699
|
-
int("bands")),s=e.num("probability"),a=e.num("rate"),u=e.num("channelShift"),
|
|
2700
|
-
v,...b):e.rand(v,d,...b),g=[0];if(
|
|
2699
|
+
int("bands")),s=e.num("probability"),a=e.num("rate"),u=e.num("channelShift"),f=e.num("widthJitter"),h=e.bool("holdEdges"),m=a>0?Math.floor(e.t*a):0,d=Math.floor(e.num("seed")),A=(v,...b)=>d===0?e.rand(
|
|
2700
|
+
v,...b):e.rand(v,d,...b),g=[0];if(f>0){let v=[],b=0;for(let P=0;P<i;P++){let E=h?A("width",P):A("width",P,m),T=1+f*E.range(-.95,.95);v.push(T),b+=T}let w=0;for(let P=0;P<i-1;P++)w+=v[P]/b*t.height,g.push(
|
|
2701
2701
|
w);g.push(t.height)}else{let v=t.height/i;for(let b=1;b<=i;b++)g.push(b*v)}let x=[];for(let v=0;v<i;v++){let b=A("band",v,m);b.next()>=s||x.push({y0:g[v],y1:g[v+1],dx:Math.round(b.range(-n,n)),channelDx:Math.
|
|
2702
2702
|
round(b.range(-u,u)),dy:Math.round(b.range(-r,r))})}return{out:Ye(x.length>0?Bl(t,x):Xt(t))}}},j0={type:"chromatic",label:"Chromatic",category:"post",description:"Splits the red and blue planes apart \
|
|
2703
2703
|
\u2014 lens fringing.",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"offset",label:"Offset",type:"number",default:2,min:0,max:40,step:.25,unit:"px"},{key:"ang\
|
|
@@ -2777,17 +2777,17 @@ Range",type:"number",default:200,min:0,step:10,unit:"px",description:"The depth
|
|
|
2777
2777
|
unit:"px",description:"How much farther out of the Range the blur takes to reach its full Blur; 0 snaps to it at once."},{key:"blur",label:"Blur",type:"number",default:12,min:0,max:64,step:.5,unit:"px",
|
|
2778
2778
|
description:"The blur at the far end of the Falloff, like the Blur node\u2019s Radius."}],cook(e){let t=e.texture("in");if(!t)return It;let n=e.shapes("depth"),r=e.num("blur");if(n.length===0||r<=0||e.
|
|
2779
2779
|
canvas.w<=0||e.canvas.h<=0)return{out:Ye(t)};if(!e.rasterize)throw new Error("no rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let i=e.num("focus"),s=Math.
|
|
2780
|
-
max(0,e.num("range")),a=Math.max(0,e.num("falloff")),u=n.map(m=>{let d=m.meta.depth??0,A=Math.abs(d-i)-s/2,g=A<=0?0:a>0?Math.min(1,A/a):1,x=
|
|
2781
|
-
if(u.every(m=>m.level===0))return{out:Ye(t)};let
|
|
2782
|
-
shapes:Sc(u).map(m=>Ws(m.shape,`#${Ec(m.level)}${m.side?"ff":"00"}00`))}]}),
|
|
2780
|
+
max(0,e.num("range")),a=Math.max(0,e.num("falloff")),u=n.map(m=>{let d=m.meta.depth??0,A=Math.abs(d-i)-s/2,g=A<=0?0:a>0?Math.min(1,A/a):1,x=Nl(r*g);return{shape:m,depth:d,level:x,side:x>0&&d>i?1:0}});
|
|
2781
|
+
if(u.every(m=>m.level===0))return{out:Ye(t)};let f=e.rasterize({width:e.canvas.w,height:e.canvas.h,background:"none",origin:e.canvas.origin,layers:[{id:e.nodeId,name:"focus",opacity:1,visible:!0,order:0,
|
|
2782
|
+
shapes:Sc(u).map(m=>Ws(m.shape,`#${Ec(m.level)}${m.side?"ff":"00"}00`))}]}),h=Ql(u.map(m=>({level:m.level,side:m.side})));return{out:Ye(Ll(t,f,h,e.canvas.origin??"top-left"))}}},ug={type:"depth-map",label:"\
|
|
2783
2783
|
Depth Map",category:"post",description:"The shapes drawn as their depth: a grey per shape from black at Near to white at Far, the nearer shape over the farther. What Depth of Field sees \u2014 and a depth \
|
|
2784
2784
|
fog, through a Blend.",keywords:["depth","z","map","zdepth","fog","3d","grey"],inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"texture"}],params:[{key:"near",label:"Near",type:"number",default:-1e3,
|
|
2785
2785
|
step:10,unit:"px",description:"The depth drawn black, in Pos. Z\u2019s terms; anything nearer is black too."},{key:"far",label:"Far",type:"number",default:1e3,step:10,unit:"px",description:"The depth \
|
|
2786
2786
|
drawn white; anything farther is white too. A shape no 3D node has posed sits at 0."}],cook(e){if(!e.rasterize)throw new Error("no rasteriser available yet \u2014 the preview loads one on demand; exports a\
|
|
2787
2787
|
lways have one");if(e.canvas.w<=0||e.canvas.h<=0)throw new Error("has no size to draw at \u2014 give the project a canvas");let t=e.num("near"),n=e.num("far")-t,r=e.shapes("in").map(a=>({shape:a,depth:a.
|
|
2788
2788
|
meta.depth??0})),i=a=>Ec(n===0?128:Math.max(0,Math.min(1,(a-t)/n))*255),s=e.rasterize({width:e.canvas.w,height:e.canvas.h,background:"none",origin:e.canvas.origin,layers:[{id:e.nodeId,name:"depth",opacity:1,
|
|
2789
|
-
visible:!0,order:0,shapes:Sc(r).map(a=>Ws(a.shape,`#${i(a.depth).repeat(3)}`))}]});return{out:Ye(s)}}},cg=[$0,U0,lg,ug,z0,j0,V0,Z0,J0,eg,ng,rg,tg,og,ig,sg,ag],Pu={},
|
|
2790
|
-
oO@",shades:" \u2591\u2592\u2593\u2588",binary:" #"},
|
|
2789
|
+
visible:!0,order:0,shapes:Sc(r).map(a=>Ws(a.shape,`#${i(a.depth).repeat(3)}`))}]});return{out:Ye(s)}}},cg=[$0,U0,lg,ug,z0,j0,V0,Z0,J0,eg,ng,rg,tg,og,ig,sg,ag],Pu={},fg={standard:" .:-=+*#%@",short:" .\
|
|
2790
|
+
oO@",shades:" \u2591\u2592\u2593\u2588",binary:" #"},hg=[" ","\u2597","\u2596","\u2584","\u259D","\u2590","\u259E","\u259F","\u2598","\u259A","\u258C","\u2599","\u2580","\u259C","\u259B","\u2588"],pg=[
|
|
2791
2791
|
"characters","blocks","braille","weight","width"],dg="\u2800",Bc=e=>e==="braille"?dg:" ";function Xs(e,t,n=" "){return["ascii",`row:${e}`,`col:${t}`,...n===" "?[]:[`blank:${n}`]]}var Xr=(...e)=>t=>!e.
|
|
2792
2792
|
includes(J(t.mode).base??"characters"),mg=e=>Xr("characters")(e)||J(e.ramp).base!=="custom",Mu=e=>bt(String(J(e.fontFamily).base??"")).family,Ag=.7,yg={top:.95,bottom:-.35},_u=e=>Ge.find(t=>t.key===e),
|
|
2793
2793
|
ii=e=>e.toString(16).padStart(2,"0");function Pc(e,t){let n=e[t*4+3];if(n===0)return;let r=s=>Math.min(255,Math.round(s*255/n)),i=`#${ii(r(e[t*4]))}${ii(r(e[t*4+1]))}${ii(r(e[t*4+2]))}`;return n===255?
|
|
@@ -2807,7 +2807,7 @@ yph every cell repeats.",dimWhen:Xr("weight","width")},{key:"levels",label:"Leve
|
|
|
2807
2807
|
r a dot lights.",dimWhen:Xr("blocks","braille")},{key:"measure",label:"Measure",type:"enum",default:"luma",options:[{value:"luma",label:"Brightness"},{value:"coverage",label:"Coverage"}],description:"\
|
|
2808
2808
|
What a cell\u2019s value is: its brightness over black (a red ring reads dark), or how much of it is painted at all (the ring reads full) \u2014 Mono\u2019s rule for a raster with no background."},{key:"\
|
|
2809
2809
|
invert",label:"Invert",type:"bool",default:!1,description:"Light cells take the dark end of the ramp \u2014 for ink on paper."},{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Tn.map(e=>({
|
|
2810
|
-
value:e,label:`${e} \xB7 ${go(e)}`})),optionsFor:()=>
|
|
2810
|
+
value:e,label:`${e} \xB7 ${go(e)}`})),optionsFor:()=>fr().map(e=>({value:e,label:`${e} \xB7 ${go(e)}`})),description:"The cell is this face\u2019s advance by Size \xD7 Line Height. A mono face runs a row as o\
|
|
2811
2811
|
ne shape; a proportional face puts every glyph on its own cell.",group:"Type"},{key:"fontSize",label:"Size",type:"number",default:12,min:2,step:.5,unit:"px",group:"Type",description:"Sets the cell: 12\
|
|
2812
2812
|
px of Plex Mono is a 7.2 \xD7 12 cell. A pixel face rounds to its grid."},{key:"lineHeight",label:"Line Height",type:"number",default:1,min:.25,max:4,step:.05,group:"Type",description:"Cell height in\
|
|
2813
2813
|
em. 1 is the terminal look; Blocks count from the block glyph\u2019s own height so rows touch \u2014 a touch under 1 overlaps them and hides the hairline a renderer\u2019s anti-aliasing leaves between rows."},
|
|
@@ -2818,27 +2818,27 @@ filter(i=>t.has(i.value));return r.length>0?r:n},rangeFor:e=>bn(Mu(e)),descripti
|
|
|
2818
2818
|
with the Fill; Source gives each cell the colour under it (a run per colour \u2014 Posterize upstream to keep the count down).",group:"Colour"},{key:"background",label:"Background",type:"enum",default:"\
|
|
2819
2819
|
none",options:[{value:"none",label:"None"},{value:"source",label:"Source"}],description:"Source puts a block of the cell\u2019s own colour behind each glyph, as a terminal with background colours.",group:"\
|
|
2820
2820
|
Colour"},{..._u("fill"),default:"#ffffff",description:"The ink.",group:"Colour"},{..._u("opacity"),group:"Colour"}],cook(e){let t=e.texture();if(!t||t.width<=0||t.height<=0)return Pu;let n=e.enumOf("m\
|
|
2821
|
-
ode",pg),r=bt(e.str("fontFamily")).family,i=vn(r),s=di(r,e.num("fontSize")),a=Math.max(.25,e.num("lineHeight")),u=e.bool("invert"),
|
|
2822
|
-
"custom"?e.str("custom"):
|
|
2823
|
-
b=
|
|
2824
|
-
measure?.({text:He,family:r,weight:Je,stretch:dt,size:s,letterSpacing:0}),_=S(M,P,
|
|
2821
|
+
ode",pg),r=bt(e.str("fontFamily")).family,i=vn(r),s=di(r,e.num("fontSize")),a=Math.max(.25,e.num("lineHeight")),u=e.bool("invert"),f=e.enumOf("ramp",["standard","short","shades","binary","custom"]),h=f===
|
|
2822
|
+
"custom"?e.str("custom"):fg[f],m=[...h.length>0?h:" "],d=[...e.str("character")][0]??"#",A=e.int("levels"),g=Ot(r,Number(e.str("fontWeight"))||400),x=bn(r),v=n==="weight"?x?Tu(x.min,x.max,A):Dn(r):[g],
|
|
2823
|
+
b=hr(r),w=n==="width"?b?Tu(b.min,b.max,A):[100]:[100],P=v[v.length-1],E=n==="blocks"||n==="braille",T=n==="braille"?"\u28FF":"\u2588",M=n==="weight"||n==="width"?d:E?T:"0",R=Bc(n),S=(He,Je,dt)=>e.outline?.
|
|
2824
|
+
measure?.({text:He,family:r,weight:Je,stretch:dt,size:s,letterSpacing:0}),_=S(M,P,fn(r,w[0])),Q=_&&_.width>0?_.width:s*.6,Y=_?.capHeight??s*Ag,G=S("M",g,100)?.width,q=S("i",g,100)?.width,X=G===void 0||
|
|
2825
2825
|
q===void 0||Math.abs(G-q)<1e-6,te=yg;if(E){let He=e.outline?.glyphs?.({text:T,family:r,weight:g,stretch:100,size:s,letterSpacing:0})?.glyphs[0],Je=He&&gg(He.d);Je&&(te={top:-Je.top/s,bottom:-Je.bottom/
|
|
2826
|
-
s})}let ce=i?Math.max(1,Math.round(Q)):Q,ue=E?(te.top-te.bottom)*s*a:s*a,ie=i?Math.max(1,Math.round(ue)):ue;if(!(ce>0)||!(ie>0))return Pu;let
|
|
2827
|
-
at?.y??(e.canvas.origin==="center"?-t.height/2:0),ne=Math.max(1,Math.floor(t.width/ce)),ye=Math.max(1,Math.floor(t.height/ie)),Be=(t.width-ne*ce)/2,Ee=(t.height-ye*ie)/2,We=i?Math.round(
|
|
2828
|
-
Math.round(ve+Ee):ve+Ee,lt=E?(ie-(te.top-te.bottom)*s)/2+te.top*s:(ie+Y)/2,wt=Fl(t,{x0:We-
|
|
2826
|
+
s})}let ce=i?Math.max(1,Math.round(Q)):Q,ue=E?(te.top-te.bottom)*s*a:s*a,ie=i?Math.max(1,Math.round(ue)):ue;if(!(ce>0)||!(ie>0))return Pu;let fe=t.at?.x??(e.canvas.origin==="center"?-t.width/2:0),ve=t.
|
|
2827
|
+
at?.y??(e.canvas.origin==="center"?-t.height/2:0),ne=Math.max(1,Math.floor(t.width/ce)),ye=Math.max(1,Math.floor(t.height/ie)),Be=(t.width-ne*ce)/2,Ee=(t.height-ye*ie)/2,We=i?Math.round(fe+Be):fe+Be,at=i?
|
|
2828
|
+
Math.round(ve+Ee):ve+Ee,lt=E?(ie-(te.top-te.bottom)*s)/2+te.top*s:(ie+Y)/2,wt=Fl(t,{x0:We-fe,y0:at-ve,cw:ce,ch:ie,cols:ne,rows:ye,sub:n==="blocks"?2:n==="braille"?{x:2,y:4}:1}),nn=e.enumOf("colour",["\
|
|
2829
2829
|
ink","source"]),yt=e.enumOf("background",["none","source"]),Bt=Math.min(1,Math.max(0,e.num("threshold"))),Ze=e.enumOf("measure",["luma","coverage"])==="coverage",ae=vg(wt,{mode:n,invert:u,coverage:Ze,
|
|
2830
2830
|
ramp:m,repeated:d,weights:v,stretches:w,threshold:Bt,colour:nn==="source",background:yt==="source"}),xe=e.num("opacity"),Te={fill:e.color("fill"),stroke:"none",opacity:xe},Xe=[],it=He=>We+He*ce,kt=He=>at+
|
|
2831
2831
|
He*ie;if(yt==="source")for(let He=0;He<ye;He++)for(let Je=0;Je<ne;){let dt=ae[He*ne+Je].bg,Ct=Je+1;for(;Ct<ne&&ae[He*ne+Ct].bg===dt;)Ct++;dt!==void 0&&Xe.push({id:e.shapeId(Xe.length),kind:"rect",x:it(
|
|
2832
2832
|
Je),y:kt(He),w:(Ct-Je)*ce,h:ie,rx:0,style:{fill:dt,stroke:"none",opacity:xe},transform:be,meta:e.meta(Xe.length,["ascii","cell"])}),Je=Ct}for(let He=0;He<ye;He++)for(let Je=0;Je<ne;){let dt=ae[He*ne+Je],
|
|
2833
2833
|
Ct=Je+1;for(;Ct<ne&&X;){let Et=ae[He*ne+Ct];if(Et.ch!==R&&(Et.weight!==dt.weight||Et.stretch!==dt.stretch||Et.fill!==dt.fill))break;Ct++}let Ht="";for(let Et=Je;Et<Ct;Et++)Ht+=ae[He*ne+Et].ch;for(;Ht.
|
|
2834
|
-
endsWith(R);)Ht=Ht.slice(0,-R.length);if(Ht.length>0){let Et=
|
|
2834
|
+
endsWith(R);)Ht=Ht.slice(0,-R.length);if(Ht.length>0){let Et=fn(r,dt.stretch);Xe.push({id:e.shapeId(Xe.length),kind:"text",x:it(Je),y:i?Math.round(kt(He)+lt):kt(He)+lt,text:Ht,fontSize:s,fontFamily:r,
|
|
2835
2835
|
fontWeight:dt.weight,...Et!==100?{fontStretch:Et}:{},anchor:"start",letterSpacing:0,metrics:{width:[...Ht].length*ce,capHeight:Y},style:dt.fill!==void 0?{...Te,fill:dt.fill}:Te,transform:be,meta:e.meta(
|
|
2836
|
-
Xe.length,Xs(He,Je,R))})}Je=Ct}return{out:z(Xe)}}};function vg(e,t){let{cols:n,rows:r,sub:i,luma:s,rgba:a}=e,u=n*i.x,
|
|
2836
|
+
Xe.length,Xs(He,Je,R))})}Je=Ct}return{out:z(Xe)}}};function vg(e,t){let{cols:n,rows:r,sub:i,luma:s,rgba:a}=e,u=n*i.x,f=new Array(n*r),h=d=>{let A=(t.coverage?a[d*4+3]:s[d])/255;return t.invert?1-A:A},
|
|
2837
2837
|
m=(d,A)=>d[Math.min(d.length-1,Math.floor(A*d.length))];for(let d=0;d<r;d++)for(let A=0;A<n;A++){let g={ch:" ",weight:t.weights[0],stretch:t.stretches[0]},x=d*i.y*u+A*i.x;if(t.colour||t.background){let b=new Uint8ClampedArray(
|
|
2838
|
-
4),w=i.x*i.y;for(let E=0;E<4;E++){let T=0;for(let M=0;M<i.y;M++)for(let R=0;R<i.x;R++)T+=a[(x+M*u+R)*4+E];b[E]=Math.floor((2*T+w)/(2*w))}let P=Pc(b,0);t.colour&&(g.fill=P),t.background&&(g.bg=P)}let v=(b,w)=>
|
|
2839
|
-
x+w*u+b)>=t.threshold&&(t.threshold>0||
|
|
2840
|
-
3|v(1,1)<<4|v(1,2)<<5|v(0,3)<<6|v(1,3)<<7;g.ch=String.fromCodePoint(10240+b)}else{let b=
|
|
2841
|
-
m(t.stretches,b))}g.ch===Bc(t.mode)&&(g.fill=void 0),
|
|
2838
|
+
4),w=i.x*i.y;for(let E=0;E<4;E++){let T=0;for(let M=0;M<i.y;M++)for(let R=0;R<i.x;R++)T+=a[(x+M*u+R)*4+E];b[E]=Math.floor((2*T+w)/(2*w))}let P=Pc(b,0);t.colour&&(g.fill=P),t.background&&(g.bg=P)}let v=(b,w)=>h(
|
|
2839
|
+
x+w*u+b)>=t.threshold&&(t.threshold>0||h(x+w*u+b)>0)?1:0;if(t.mode==="blocks"){let b=v(0,0)<<3|v(1,0)<<2|v(0,1)<<1|v(1,1);g.ch=hg[b]}else if(t.mode==="braille"){let b=v(0,0)|v(0,1)<<1|v(0,2)<<2|v(1,0)<<
|
|
2840
|
+
3|v(1,1)<<4|v(1,2)<<5|v(0,3)<<6|v(1,3)<<7;g.ch=String.fromCodePoint(10240+b)}else{let b=h(x);t.mode==="characters"?g.ch=m(t.ramp,b):b>0&&(g.ch=t.repeated,t.mode==="weight"?g.weight=m(t.weights,b):g.stretch=
|
|
2841
|
+
m(t.stretches,b))}g.ch===Bc(t.mode)&&(g.fill=void 0),f[d*n+A]=g}return f}var xg={},Ig=["ramp","size","both"],wg=(...e)=>t=>!e.includes(J(t.mode).base??"ramp");function kg(e,t){let n={sourceNodeId:"halftone",index:0},r={fill:e,stroke:"none"},i={fill:"none",stroke:e,strokeWidth:t},
|
|
2842
2842
|
s=(a,u)=>({id:`builtin:${u}`,transform:be,meta:{...n,index:u},...a});return[s({kind:"circle",cx:0,cy:0,r:.12,style:r},0),s({kind:"path",d:"M -0.5 0 L 0.5 0 M 0 -0.5 L 0 0.5",style:i},1),s({kind:"path",
|
|
2843
2843
|
d:"M -0.4 -0.4 L 0.4 0.4 M 0.4 -0.4 L -0.4 0.4",style:i},2),s({kind:"circle",cx:0,cy:0,r:.5-t/2,style:i},3),s({kind:"rect",x:-.5+t/2,y:-.5+t/2,w:1-t,h:1-t,rx:0,style:i},4),s({kind:"rect",x:-.5,y:-.5,w:1,
|
|
2844
2844
|
h:1,rx:0,style:r},5),s({kind:"circle",cx:0,cy:0,r:.5,style:r},6)]}function Cg(e){let t=$e(e);return!t||!(t.w>0||t.h>0)?{cx:0,cy:0,size:1}:{cx:t.x+t.w/2,cy:t.y+t.h/2,size:Math.max(t.w,t.h)}}function Eg(e,t,n,r,i){
|
|
@@ -2857,25 +2857,25 @@ lue is: its brightness over black, or how much of it is painted at all."},{key:"
|
|
|
2857
2857
|
ze where it is bright."},{key:"colour",label:"Colour",type:"enum",default:"ink",options:[{value:"ink",label:"Ink"},{value:"shapes",label:"Shapes"},{value:"source",label:"Source"}],description:"Ink pai\
|
|
2858
2858
|
nts every copy with the Fill; Shapes keeps each wired shape\u2019s own style; Source gives each cell the colour under it.",group:"Colour"},{key:"fill",label:"Fill",type:"color",default:"#ffffff",description:"\
|
|
2859
2859
|
The ink.",group:"Colour"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Colour"}],cook(e){let t=e.texture("in");if(!t||t.width<=0||t.height<=0)return xg;let n=e.enumOf(
|
|
2860
|
-
"mode",Ig),r=Math.max(2,e.num("cell")),i=e.num("angle"),s=Math.max(0,e.num("size")),a=Math.max(0,e.num("sizeMin")),u=e.num("spin"),
|
|
2860
|
+
"mode",Ig),r=Math.max(2,e.num("cell")),i=e.num("angle"),s=Math.max(0,e.num("size")),a=Math.max(0,e.num("sizeMin")),u=e.num("spin"),f=e.enumOf("measure",["luma","coverage"])==="coverage",h=e.bool("inve\
|
|
2861
2861
|
rt"),m=e.enumOf("colour",["ink","shapes","source"]),d=e.color("fill"),A=e.num("opacity"),g=e.inputList("shapes").flatMap(Y=>Y.t==="shapes"?Y.v:[]),x=kg(d,.12),v=n==="size"?[g[0]??x[x.length-1]]:g.length>
|
|
2862
2862
|
0?g:x,b=v.map(Cg),w=t.at?.x??(e.canvas.origin==="center"?-t.width/2:0),P=t.at?.y??(e.canvas.origin==="center"?-t.height/2:0),E=t.width/2,T=t.height/2,M=i*Math.PI/180,R=Math.cos(M),S=Math.sin(M),_=Math.
|
|
2863
2863
|
ceil(Math.hypot(E,T)/r),Q=[];for(let Y=-_;Y<=_;Y++)for(let G=-_;G<=_;G++){let q=E+R*G*r-S*Y*r,X=T+S*G*r+R*Y*r;if(q<0||X<0||q>=t.width||X>=t.height)continue;let te=Yl(t,q-r/2,X-r/2,q+r/2,X+r/2);if(te.count===
|
|
2864
|
-
0)continue;let ce=(
|
|
2865
|
-
let ne=r*ve/
|
|
2864
|
+
0)continue;let ce=(f?te.rgba[3]:te.luma)/255;if(h&&(ce=1-ce),ce<=0)continue;let ue=n==="size"?0:Math.min(v.length-1,Math.floor(ce*v.length)),ie=v[ue],fe=b[ue],ve=n==="ramp"?s:a+(s-a)*ce;if(!(ve>0))continue;
|
|
2865
|
+
let ne=r*ve/fe.size,ye=Ae(_e(w+q,P+X),Ae(Kt(ne),_e(-fe.cx,-fe.cy)));u!==0&&(ye=Ae(_e(w+q,P+X),Ae(jt(u*ce),Ae(Kt(ne),_e(-fe.cx,-fe.cy)))));let Be=m==="source"?Pc(te.rgba,0):void 0;if(m==="source"&&Be===
|
|
2866
2866
|
void 0)continue;let Ee=Q.length;Q.push({...ie,id:e.shapeId(Ee),transform:Ae(ye,ie.transform),style:Eg(ie.style,m,d,Be,A),meta:e.meta(Ee,[...Xs(Y+_,G+_),"halftone",`step:${ue}`])})}return{out:z(Q)}}},Bg={};
|
|
2867
|
-
function Pg(e,t,n){let{width:r,height:i,data:s}=e,a=Math.max(1,Math.floor(t)),u=Math.ceil(r/a),
|
|
2868
|
-
let g=Math.min(r,(A+1)*a),x=0,v=0;for(let b=m*a;b<d;b++){let w=(b*r+A*a)*4;for(let P=A*a;P<g;P++,w+=4)x+=n?s[w+3]:.2126*s[w]+.7152*s[w+1]+.0722*s[w+2],v++}
|
|
2869
|
-
step:a}}function Mg(e,t){let{gw:n,gh:r,v:i}=e,s=new Map,a=new Map,u=(v,b)=>i[b*n+v],
|
|
2870
|
-
0,(t-E)/(T-E)));s.set(v,v&1?[w,P+M]:[w+M,P])},
|
|
2867
|
+
function Pg(e,t,n){let{width:r,height:i,data:s}=e,a=Math.max(1,Math.floor(t)),u=Math.ceil(r/a),f=Math.ceil(i/a),h=new Float64Array(u*f);for(let m=0;m<f;m++){let d=Math.min(i,(m+1)*a);for(let A=0;A<u;A++){
|
|
2868
|
+
let g=Math.min(r,(A+1)*a),x=0,v=0;for(let b=m*a;b<d;b++){let w=(b*r+A*a)*4;for(let P=A*a;P<g;P++,w+=4)x+=n?s[w+3]:.2126*s[w]+.7152*s[w+1]+.0722*s[w+2],v++}h[m*u+A]=v>0?x/v/255:0}}return{gw:u,gh:f,v:h,
|
|
2869
|
+
step:a}}function Mg(e,t){let{gw:n,gh:r,v:i}=e,s=new Map,a=new Map,u=(v,b)=>i[b*n+v],f=v=>{if(s.has(v))return;let b=v>>1,w=b%n,P=(b-w)/n,E=u(w,P),T=v&1?u(w,P+1):u(w+1,P),M=T===E?.5:Math.min(1,Math.max(
|
|
2870
|
+
0,(t-E)/(T-E)));s.set(v,v&1?[w,P+M]:[w+M,P])},h=[],m=[],d=(v,b)=>{f(v),f(b);let w=h.length;h.push(v),m.push(b);for(let P of[v,b]){let E=a.get(P);E?E.push(w):a.set(P,[w])}};for(let v=0;v+1<r;v++)for(let b=0;b+
|
|
2871
2871
|
1<n;b++){let w=u(b,v)>=t,P=u(b+1,v)>=t,E=u(b+1,v+1)>=t,T=u(b,v+1)>=t;if(w===P&&P===E&&E===T)continue;let M=2*(v*n+b),R=2*((v+1)*n+b),S=2*(v*n+b)+1,_=2*(v*n+b+1)+1,Q=[];w!==P&&Q.push(M),P!==E&&Q.push(_),
|
|
2872
|
-
E!==T&&Q.push(R),T!==w&&Q.push(S),Q.length===2?d(Q[0],Q[1]):(u(b,v)+u(b+1,v)+u(b+1,v+1)+u(b,v+1))/4>=t===w?(d(M,_),d(R,S)):(d(S,M),d(_,R))}let A=new Uint8Array(
|
|
2873
|
-
let E=(a.get(w)??[]).find(T=>!A[T]);if(E===void 0)break;A[E]=1,w=
|
|
2874
|
-
b.length===1&&!A[b[0]]&&g.push(x(v));for(let v=0;v<
|
|
2875
|
-
r.length);i[0]=i[r.length-1]=1;let s=[[0,r.length-1]];for(;s.length>0;){let[u,
|
|
2876
|
-
x*(E-
|
|
2877
|
-
let n=e.points;for(let r=0;r<t&&n.length>2;r++){let i=[],s=n.length;e.closed||i.push(n[0]);let a=e.closed?s:s-1;for(let u=0;u<a;u++){let
|
|
2878
|
-
[.25*
|
|
2872
|
+
E!==T&&Q.push(R),T!==w&&Q.push(S),Q.length===2?d(Q[0],Q[1]):(u(b,v)+u(b+1,v)+u(b+1,v+1)+u(b,v+1))/4>=t===w?(d(M,_),d(R,S)):(d(S,M),d(_,R))}let A=new Uint8Array(h.length),g=[],x=v=>{let b=[v],w=v;for(;;){
|
|
2873
|
+
let E=(a.get(w)??[]).find(T=>!A[T]);if(E===void 0)break;A[E]=1,w=h[E]===w?m[E]:h[E],b.push(w)}let P=b.length>2&&b[b.length-1]===v;return P&&b.pop(),{points:b.map(E=>s.get(E)),closed:P}};for(let[v,b]of a)
|
|
2874
|
+
b.length===1&&!A[b[0]]&&g.push(x(v));for(let v=0;v<h.length;v++)A[v]||g.push(x(h[v]));return g}function _g(e,t){let n=e.points;if(n.length<4||t<=0)return e;let r=e.closed?[...n,n[0]]:n,i=new Uint8Array(
|
|
2875
|
+
r.length);i[0]=i[r.length-1]=1;let s=[[0,r.length-1]];for(;s.length>0;){let[u,f]=s.pop(),[h,m]=r[u],[d,A]=r[f],g=d-h,x=A-m,v=Math.hypot(g,x),b=-1,w=t;for(let P=u+1;P<f;P++){let[E,T]=r[P],M=v>0?Math.abs(
|
|
2876
|
+
x*(E-h)-g*(T-m))/v:Math.hypot(E-h,T-m);M>w&&(w=M,b=P)}b>=0&&(i[b]=1,s.push([u,b],[b,f]))}let a=r.filter((u,f)=>i[f]);return e.closed&&a.pop(),a.length>=(e.closed?3:2)?{points:a,closed:e.closed}:e}function Tg(e,t){
|
|
2877
|
+
let n=e.points;for(let r=0;r<t&&n.length>2;r++){let i=[],s=n.length;e.closed||i.push(n[0]);let a=e.closed?s:s-1;for(let u=0;u<a;u++){let f=n[u],h=n[(u+1)%s];i.push([.75*f[0]+.25*h[0],.75*f[1]+.25*h[1]],
|
|
2878
|
+
[.25*f[0]+.75*h[0],.25*f[1]+.75*h[1]])}e.closed||i.push(n[s-1]),n=i}return{points:n,closed:e.closed}}var Rg=e=>{let t=0,n=e.points.length;for(let r=1;r<n;r++)t+=Math.hypot(e.points[r][0]-e.points[r-1][0],
|
|
2879
2879
|
e.points[r][1]-e.points[r-1][1]);return e.closed&&n>1&&(t+=Math.hypot(e.points[0][0]-e.points[n-1][0],e.points[0][1]-e.points[n-1][1])),t},Ru=e=>String(Math.round(e*100)/100),Dg={type:"contours",label:"\
|
|
2880
2880
|
Contours",category:"post",description:"Pixels back into lines: the picture read as a height map and traced where it crosses evenly spaced levels \u2014 the lines of a topographic map, every Nth one a major\
|
|
2881
2881
|
line (wire the Major output to give the majors a chain of their own). Wire Noise Paint \u2192 Rect \u2192 Rasterize in for terrain; animate Offset to make the lines flow.",keywords:["contours","conto\
|
|
@@ -2891,17 +2891,17 @@ type:"number",default:1,min:0,step:.1,unit:"px",description:"A minor line\u2019s
|
|
|
2891
2891
|
evel is a major line, drawn at Major Width and tagged major. 0: no majors.",group:"Lines"},{key:"majorWidth",label:"Major Width",type:"number",default:3,min:0,step:.1,unit:"px",group:"Lines"},{key:"ma\
|
|
2892
2892
|
jorStroke",label:"Major Stroke",type:"color",default:"none",description:"The major lines\u2019 colour. None: the same as Stroke.",group:"Lines"},{key:"opacity",label:"Opacity",type:"number",default:1,
|
|
2893
2893
|
min:0,max:1,step:.01,group:"Lines"}],cook(e){let t=e.texture("in");if(!t||t.width<=0||t.height<=0)return Bg;let n=Math.max(1,e.int("lines")),r=e.num("offset"),i=Pg(t,e.int("detail"),e.enumOf("measure",
|
|
2894
|
-
["luma","coverage"])==="coverage"),s=Math.max(0,Math.min(4,e.int("smooth"))),a=Math.max(0,e.num("minLength")),u=e.color("stroke"),
|
|
2894
|
+
["luma","coverage"])==="coverage"),s=Math.max(0,Math.min(4,e.int("smooth"))),a=Math.max(0,e.num("minLength")),u=e.color("stroke"),f=Math.max(0,e.num("width")),h=Math.max(0,e.int("majorEvery")),m=Math.
|
|
2895
2895
|
max(0,e.num("majorWidth")),d=e.color("majorStroke"),A=d&&d!=="none"?d:u,g=e.num("opacity"),x=t.at?.x??(e.canvas.origin==="center"?-t.width/2:0),v=t.at?.y??(e.canvas.origin==="center"?-t.height/2:0),b=i.
|
|
2896
2896
|
step,w=_=>x+Math.min(t.width,_*b+b/2),P=_=>v+Math.min(t.height,_*b+b/2),E=Math.floor(r),T=r-E,M=[],R=[],S=e.wiredOutputs.has("major");for(let _=0;_<n;_++){let Q=(_+T)/n;if(Q<=0||Q>=1)continue;let Y=_-
|
|
2897
|
-
E,G=
|
|
2898
|
-
L"} ${Ru(w(
|
|
2899
|
-
m:
|
|
2897
|
+
E,G=h>0&&(Y%h+h)%h===0;for(let q of Mg(i,Q)){if(q.points.length<2||a>0&&Rg(q)*b<a)continue;let X=Tg(_g(q,.1),s),te="";for(let ie=0;ie<X.points.length;ie++){let[fe,ve]=X.points[ie];te+=`${ie===0?"M":" \
|
|
2898
|
+
L"} ${Ru(w(fe))} ${Ru(P(ve))}`}X.closed&&(te+=" Z");let ce=S&&G?R:M,ue=ce.length;ce.push({kind:"path",d:te,id:e.shapeId(ue,ce===R?"major":void 0),transform:be,style:{fill:"none",stroke:G?A:u,strokeWidth:G?
|
|
2899
|
+
m:f,opacity:g},meta:e.meta(ue,["contour",G?"major":"minor",`level:${Y}`])})}}return{out:z(M),major:z(S?R:M.filter(_=>_.meta.tags?.includes("major")))}}},Og={single:["\u250C","\u2500","\u2510","\u2502",
|
|
2900
2900
|
"\u2514","\u2518"],double:["\u2554","\u2550","\u2557","\u2551","\u255A","\u255D"],rounded:["\u256D","\u2500","\u256E","\u2502","\u2570","\u256F"],heavy:["\u250F","\u2501","\u2513","\u2503","\u2517","\u251B"],
|
|
2901
|
-
ascii:["+","-","+","|","+","+"]},Du=e=>bt(String(J(e.fontFamily).base??"")).family,
|
|
2902
|
-
s)+r.join("")+" ".repeat(i-s)}function Lg(e){let{border:t,title:n,padX:r,padY:i,align:s}=e,a=t==="none"?void 0:
|
|
2903
|
-
2*u-2*r):
|
|
2904
|
-
repeat(g);A.push(a[0]+v+a[2])}for(let g=0;g<i;g++)A.push(d);for(let g of e.lines)A.push(m(g));for(let g=0;g<i;g++)A.push(d);return a&&A.push(a[4]+a[1].repeat(
|
|
2901
|
+
ascii:["+","-","+","|","+","+"]},Du=e=>bt(String(J(e.fontFamily).base??"")).family,Ng=.7;function Qg(e,t,n){let r=[...e].slice(0,t),i=t-r.length,s=n==="start"?0:n==="end"?i:Math.floor(i/2);return" ".repeat(
|
|
2902
|
+
s)+r.join("")+" ".repeat(i-s)}function Lg(e){let{border:t,title:n,padX:r,padY:i,align:s}=e,a=t==="none"?void 0:Og[t],u=a?1:0,f=Math.max(0,...e.lines.map(g=>[...g].length)),h=e.width>0?Math.max(0,e.width-
|
|
2903
|
+
2*u-2*r):f,m=g=>(a?a[3]:"")+" ".repeat(r)+Qg(g,h,s)+" ".repeat(r)+(a?a[3]:""),d=m(""),A=[];if(a){let g=h+2*r,x=[...n.trim()],v=x.length>0&&x.length+2<=g?` ${x.join("")} `+a[1].repeat(g-x.length-2):a[1].
|
|
2904
|
+
repeat(g);A.push(a[0]+v+a[2])}for(let g=0;g<i;g++)A.push(d);for(let g of e.lines)A.push(m(g));for(let g=0;g<i;g++)A.push(d);return a&&A.push(a[4]+a[1].repeat(h+2*r)+a[5]),A}var Fg={type:"textbox",label:"\
|
|
2905
2905
|
Text Box",category:"generator",translate:[{x:"x",y:"y"}],description:"Lines of text in a frame of box-drawing characters \u2014 a terminal window, a readout panel. All text, in a mono face; reads back as p\
|
|
2906
2906
|
lain text.",keywords:["box","frame","border","panel","window","terminal","drawbox","ascii"],inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"text",label:"Text",type:"string",default:`SYS /\
|
|
2907
2907
|
/ READY
|
|
@@ -2914,19 +2914,19 @@ s are cut."},{key:"padX",label:"Pad X",type:"int",default:1,min:0,max:32,unit:"c
|
|
|
2914
2914
|
unit:"rows",description:"Blank rows above and below the text."},{key:"align",label:"Align",type:"enum",default:"start",options:[{value:"start",label:"Left"},{value:"middle",label:"Centre"},{value:"end",
|
|
2915
2915
|
label:"Right"}],description:"Where the lines sit inside a box wider than they are."},{key:"anchor",label:"Anchor",type:"enum",default:"start",options:[{value:"start",label:"Start"},{value:"middle",label:"\
|
|
2916
2916
|
Middle"},{value:"end",label:"End"}],description:"Which top corner X names: the left, the middle of the top edge, or the right."},{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Tn.map(e=>({
|
|
2917
|
-
value:e,label:`${e} \xB7 ${go(e)}`})),optionsFor:()=>
|
|
2917
|
+
value:e,label:`${e} \xB7 ${go(e)}`})),optionsFor:()=>fr().map(e=>({value:e,label:`${e} \xB7 ${go(e)}`})),description:"A mono face keeps the frame square; the Fixed bitmaps draw it on a pixel grid. A p\
|
|
2918
2918
|
roportional face leaves it ragged.",group:"Type"},{key:"fontSize",label:"Size",type:"number",default:12,min:1,step:.5,unit:"px",group:"Type",description:"A pixel face rounds to its grid."},{key:"fontW\
|
|
2919
2919
|
eight",label:"Weight",type:"enum",default:"400",options:[{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"SemiBold"},{value:"700",label:"Bold"},
|
|
2920
2920
|
{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],optionsFor:e=>{let t=new Set(Dn(Du(e)).map(String)),n=[300,400,500,600,700,800,900].map(i=>({value:String(i),label:String(i)})),r=n.filter(
|
|
2921
2921
|
i=>t.has(i.value));return r.length>0?r:n},rangeFor:e=>bn(Du(e)),group:"Type"},{key:"lineHeight",label:"Line Height",type:"number",default:1.2,min:.5,max:4,step:.05,group:"Type",description:"Row pitch \
|
|
2922
2922
|
in em. 1 stacks the frame\u2019s verticals without a gap on most faces."},{key:"outlines",label:"Outline to Path",type:"bool",default:!1,group:"Type",description:"Each row as a real vector path, for t\
|
|
2923
|
-
he geometry nodes. A bitmap face is a path either way."},...xo],cook(e){let t=bt(e.str("fontFamily")).family,n=
|
|
2923
|
+
he geometry nodes. A bitmap face is a path either way."},...xo],cook(e){let t=bt(e.str("fontFamily")).family,n=Ot(t,Number(e.str("fontWeight"))||400),r=di(t,e.num("fontSize")),i=vn(t),s=Lg({lines:e.str(
|
|
2924
2924
|
"text").split(`
|
|
2925
2925
|
`),border:e.enumOf("border",["single","double","rounded","heavy","ascii","none"]),title:e.str("title"),width:e.int("width"),padX:e.int("padX"),padY:e.int("padY"),align:e.enumOf("align",["start","middl\
|
|
2926
|
-
e","end"])});if(s.length===0)return{out:{t:"shapes",v:[]}};let a=e.outline?.measure?.({text:"0",family:t,weight:n,stretch:100,size:r,letterSpacing:0}),u=a&&a.width>0?a.width:r*.6,
|
|
2927
|
-
|
|
2928
|
-
g=e.num("x")+A,x=e.num("y");return{out:{t:"shapes",v:s.map((b,w)=>Io(e,w,s.length,{text:b,x:g,y:x+w*
|
|
2929
|
-
|
|
2926
|
+
e","end"])});if(s.length===0)return{out:{t:"shapes",v:[]}};let a=e.outline?.measure?.({text:"0",family:t,weight:n,stretch:100,size:r,letterSpacing:0}),u=a&&a.width>0?a.width:r*.6,f=a?.capHeight??r*Ng,
|
|
2927
|
+
h=i?Math.max(1,Math.round(r*e.num("lineHeight"))):r*e.num("lineHeight"),m=Math.max(0,...s.map(b=>[...b].length)),d=e.enumOf("anchor",["start","middle","end"]),A=d==="middle"?-(m*u)/2:d==="end"?-m*u:0,
|
|
2928
|
+
g=e.num("x")+A,x=e.num("y");return{out:{t:"shapes",v:s.map((b,w)=>Io(e,w,s.length,{text:b,x:g,y:x+w*h+(h+f)/2,family:t,weight:n,fontSize:r,letterSpacing:0,anchor:"start",tags:[...Xs(w,0),"box"]}))}}}},
|
|
2929
|
+
Ou=e=>J(e.display).base!=="mono",Nu=e=>(J(e.pivot).base??"center")!=="custom",Yg=[{key:"posX",label:"Pos. X",type:"number",default:0,step:1,unit:"px",group:"3D",description:"Moves the layer\u2019s plane ac\
|
|
2930
2930
|
ross the frame."},{key:"posY",label:"Pos. Y",type:"number",default:0,step:1,unit:"px",group:"3D",description:"Moves the layer\u2019s plane down the frame."},{key:"posZ",label:"Pos. Z",type:"number",default:0,
|
|
2931
2931
|
step:1,unit:"px",group:"3D",description:"Depth: positive moves the plane away from the camera and it draws smaller; negative brings it nearer."},{key:"rotX",label:"Rot. X",type:"number",default:0,step:1,
|
|
2932
2932
|
unit:"deg",group:"3D",description:"Tilts the plane about a horizontal line through the pivot; positive leans the top away."},{key:"rotY",label:"Rot. Y",type:"number",default:0,step:1,unit:"deg",group:"\
|
|
@@ -2934,14 +2934,14 @@ unit:"deg",group:"3D",description:"Tilts the plane about a horizontal line throu
|
|
|
2934
2934
|
Spins the plane in its own surface, clockwise on screen."},{key:"scaleX",label:"Scale X",type:"number",default:100,step:1,unit:"%",group:"3D"},{key:"scaleY",label:"Scale Y",type:"number",default:100,step:1,
|
|
2935
2935
|
unit:"%",group:"3D"},{key:"pivot",label:"Pivot",type:"enum",default:"center",group:"3D",options:[{value:"center",label:"Frame centre"},{value:"canvas",label:"Canvas origin"},{value:"shape",label:"Cont\
|
|
2936
2936
|
ent centre"},{value:"custom",label:"Custom point"}],description:"What the rotations and scale turn about: where the camera looks, the document\u2019s (0,0), the centre of what the layer holds, or a point o\
|
|
2937
|
-
f your own."},{key:"pivotX",label:"Pivot X",type:"number",default:0,step:.5,unit:"px",group:"3D",dimWhen:
|
|
2937
|
+
f your own."},{key:"pivotX",label:"Pivot X",type:"number",default:0,step:.5,unit:"px",group:"3D",dimWhen:Nu},{key:"pivotY",label:"Pivot Y",type:"number",default:0,step:.5,unit:"px",group:"3D",dimWhen:Nu}],
|
|
2938
2938
|
Qu=new Map,Wg={type:"layer",label:"Layer",category:"output",description:'A composition of its own with its own page and clock: wire shapes (and one post chain) into "in", the Layer into the Canvas. Or\
|
|
2939
2939
|
der stacks layers; the 3D group poses the whole layer as a plane under the camera.',inputs:[{name:"in",type:"shapes",multi:!0,accepts:["texture"]}],outputs:[{name:"out",type:"layers"}],params:[{key:"o\
|
|
2940
2940
|
pacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01},{key:"visible",label:"Visible",type:"bool",default:!0},{key:"order",label:"Order",type:"int",default:1,min:1},{key:"duration",label:"\
|
|
2941
2941
|
Duration",type:"number",default:0,min:0,step:.1,unit:"s",exposable:!1,inspectorOnly:!0,description:"The layer\u2019s own clock length; 0 follows the document."},{key:"loop",label:"Loop",type:"bool",default:!1,
|
|
2942
2942
|
inline:!0,exposable:!1,inspectorOnly:!0,description:"Wrap the layer\u2019s clock at its Duration instead of switching off."},...Yg],cook(e){let t={id:e.nodeId,name:e.name?.trim()||"Layer",opacity:e.num(
|
|
2943
|
-
"opacity"),visible:e.bool("visible"),order:e.int("order"),shapes:[]},n=e.inputList("in"),r=[];for(let
|
|
2944
|
-
r.length));let i=n.map(
|
|
2943
|
+
"opacity"),visible:e.bool("visible"),order:e.int("order"),shapes:[]},n=e.inputList("in"),r=[];for(let f of n)f.t==="shapes"?r.push(...f.v):f.t==="texture"&&!t.texture&&(t.texture=f.v,r.length>0&&(t.textureAt=
|
|
2944
|
+
r.length));let i=n.map(f=>f.t==="shapes"?cr(f.v):"-").join(","),s=Qu.get(e.nodeId);s&&s.key===i?t.shapes=s.shapes:(t.shapes=r,Qu.set(e.nodeId,{key:i,shapes:r}));let a={perspective:0,width:e.canvas.w,height:e.
|
|
2945
2945
|
canvas.h,origin:e.canvas.origin},u={x:e.num("posX"),y:e.num("posY"),z:e.num("posZ"),rx:e.num("rotX"),ry:e.num("rotY"),rz:e.num("rotZ"),sx:e.num("scaleX")/100,sy:e.num("scaleY")/100,pivot:{x:0,y:0}};return to(
|
|
2946
2946
|
u)||(u.pivot=CA(e.enumOf("pivot",["center","canvas","shape","custom"]),t,a,{x:e.num("pivotX"),y:e.num("pivotY")}),t.pose=u),{out:Ra([t])}}},Xg={type:"canvas",label:"Canvas",category:"output",description:"\
|
|
2947
2947
|
The document terminus: gathers layers into the rendered scene.",inputs:[{name:"in",type:"layers",multi:!0,accepts:["shapes","texture"]}],outputs:[{name:"out",type:"scene"}],params:[{key:"width",label:"\
|
|
@@ -2950,13 +2950,13 @@ Origin",type:"enum",default:"center",options:[{value:"top-left",label:"Top left"
|
|
|
2950
2950
|
perspective",label:"Perspective",type:"number",default:1500,min:0,step:10,unit:"px",description:"The camera\u2019s distance from the frame, for layers posed in 3D: smaller is a wider lens and stronger fore\
|
|
2951
2951
|
shortening; 0 is orthographic, no foreshortening at all."},{key:"display",label:"Display",type:"enum",default:"vector",options:[{value:"vector",label:"Vector"},{value:"pixel",label:"Pixel"},{value:"mo\
|
|
2952
2952
|
no",label:"Mono"}],description:"Pixel draws without anti-aliasing; Mono snaps every pixel to the background or the ink."},{key:"ink",label:"Ink",type:"color",default:"#ffffff",description:"Mono only: \
|
|
2953
|
-
the colour beside the background.",dimWhen:
|
|
2954
|
-
1, to turn to ink.",dimWhen:
|
|
2953
|
+
the colour beside the background.",dimWhen:Ou},{key:"threshold",label:"Threshold",type:"number",default:.5,min:0,max:1,step:.01,description:"Mono only: how far from the background a pixel must be, 0..\
|
|
2954
|
+
1, to turn to ink.",dimWhen:Ou}],standIns:(e,t)=>(t.in??[]).flatMap(n=>n.t==="layers"?n.v.filter(r=>r.pose&&r.visible).flatMap(r=>fc(r).filter(i=>i.kind==="picture").map(i=>i.id)):[]),cook(e){let t=[];
|
|
2955
2955
|
for(let m of e.inputList("in"))m.t==="layers"?t.push(...m.v):m.t==="shapes"?t.push({id:`${e.nodeId}:implicit:${t.length}`,name:"Shapes",opacity:1,visible:!0,order:t.length,shapes:m.v}):m.t==="texture"&&
|
|
2956
2956
|
t.push({id:`${e.nodeId}:implicit:${t.length}`,name:"Post",opacity:1,visible:!0,order:t.length,shapes:[],texture:m.v});let n=t.map((m,d)=>({l:m,i:d})).sort((m,d)=>m.l.order-d.l.order||m.i-d.i).map(({l:m})=>m),
|
|
2957
2957
|
r=e.enumOf("display",["vector","pixel","mono"]),i=r==="vector"?void 0:{mode:r,ink:e.color("ink"),threshold:Math.min(1,Math.max(0,e.num("threshold")))},s=e.int("width"),a=e.int("height"),u=e.enumOf("or\
|
|
2958
|
-
igin",["top-left","center"]),
|
|
2959
|
-
"bg"),origin:u,...i?{display:i}:{},layers:
|
|
2958
|
+
igin",["top-left","center"]),f={perspective:Math.max(0,e.num("perspective")),width:s,height:a,origin:u},h=n.flatMap(m=>m.pose?_A(m,f,e,i!==void 0):[m]);return{out:Da({width:s,height:a,background:e.color(
|
|
2959
|
+
"bg"),origin:u,...i?{display:i}:{},layers:h})}}},Gg=[Wg,Xg],qg="ograf",Hg=20,Ps=[{key:"name",label:"Name",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0,description:"The title\
|
|
2960
2960
|
\u2019s name in Resolve. Empty: the project name."},{key:"description",label:"Description",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0},{key:"version",label:"Version",group:"\
|
|
2961
2961
|
Template",type:"string",default:"1.0.0",exposable:!1,inspectorOnly:!0},{key:"author",label:"Author",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0},{key:"hold",label:"Hold",group:"\
|
|
2962
2962
|
Template",type:"number",default:2,min:0,step:.1,unit:"s",exposable:!1,inspectorOnly:!0,description:"Default time on screen after the intro (the timeline). Sets the clip length Resolve starts from."},{
|
|
@@ -2978,49 +2978,49 @@ timeRoot:!0,inputs:[],outputs:[{name:"in",type:"number",label:"Intro clock",cloc
|
|
|
2978
2978
|
map(Ug)],outputs:[{name:"in",type:"number",label:"Intro clock",clock:!0},{name:"out",type:"number",label:"Exit clock",clock:!0},...t.flatMap(n=>[{name:n.key,type:zg[n.kind],label:n.title||n.key},...n.
|
|
2979
2979
|
kind==="choice"?[{name:Ms(n.key),type:"number",label:`${n.title||n.key} #`}]:[]])]}},cook(e){let t=e.t,n=e.num("stopAt"),r={in:De(yn(!0,t)),out:De(n>=0&&t>=n?yn(!0,t-n):yn(!1,0))};for(let i of e.paramDefs)
|
|
2980
2980
|
if(!Mc.has(i.key)){if(i.type==="number")r[i.key]=De(e.num(i.key));else if(i.type==="int")r[i.key]=De(e.int(i.key));else if(i.type==="bool")r[i.key]=Ta(e.bool(i.key));else if(i.type==="color")r[i.key]=
|
|
2981
|
-
ln(e.color(i.key));else if(i.type==="string")r[i.key]=Fi(e.str(i.key));else if(i.type==="enum"){let s=e.str(i.key);r[i.key]=Fi(s),r[Ms(i.key)]=De(Math.max(0,i.options.findIndex(a=>a.value===s)))}}return r}};var Vg=[...Zd,gm,im,am,...Ym,...Km,Fg,nA,oA,cA,...gA,
|
|
2981
|
+
ln(e.color(i.key));else if(i.type==="string")r[i.key]=Fi(e.str(i.key));else if(i.type==="enum"){let s=e.str(i.key);r[i.key]=Fi(s),r[Ms(i.key)]=De(Math.max(0,i.options.findIndex(a=>a.value===s)))}}return r}};var Vg=[...Zd,gm,im,am,...Ym,...Km,Fg,nA,oA,cA,...gA,OA,XA,$A,dm,pm,Sm,Bm,ny,hy,...xy,...Oy,...Uy,...x0,...E0,R0,Q0,...a0,X0,...cg,bg,Sg,Dg,lm,cm,...Gg,jg];function _c(e=[]){return new tl().registerAll(
|
|
2982
2982
|
Vg).registerAll(e)}var Dc=3;function Eo(e){return t=>{if(!Number.isFinite(t))return"0";let n=Number(t.toFixed(e));return Object.is(n,-0)?"0":String(n)}}function Co(e){return e.replace(/&/g,"&").replace(/</g,"<").
|
|
2983
2983
|
replace(/>/g,">").replace(/"/g,""")}function qs(e,t){return`matrix(${[e[0],e[1],e[2],e[3],e[4],e[5]].map(t).join(" ")})`}function Tc(e,t,n,r,i){if(e===void 0||typeof e=="string")return e;if(qa(
|
|
2984
|
-
e))return Zg(e,t,n,r,i);if(!Yo(e))return"none";let s=Wo(Pn(e.stops),e.stepped),a=s.length>0?Ha(e,$i(e,t)):void 0;if(!a)return
|
|
2984
|
+
e))return Zg(e,t,n,r,i);if(!Yo(e))return"none";let s=Wo(Pn(e.stops),e.stepped),a=s.length>0?Ha(e,$i(e,t)):void 0;if(!a)return Or(e);let u=['gradientUnits="userSpaceOnUse"'];if(a.kind==="linear"?u.push(
|
|
2985
2985
|
`x1="${r(a.x1)}"`,`y1="${r(a.y1)}"`,`x2="${r(a.x2)}"`,`y2="${r(a.y2)}"`):(u.push(`cx="${r(a.cx)}"`,`cy="${r(a.cy)}"`,`r="${r(a.r)}"`),(a.fx!==a.cx||a.fy!==a.cy)&&u.push(`fx="${r(a.fx)}"`,`fy="${r(a.fy)}\
|
|
2986
|
-
"`)),e.spread!=="pad"&&u.push(`spreadMethod="${e.spread}"`),e.space==="canvas"&&!eo(n)){let A=Yi(n);if(!A)return
|
|
2987
|
-
<stop offset="${r(A.at)}" stop-color="${g.rgb}"${g.a<1?` stop-opacity="${r(g.a)}"`:""}/>`}).join("")+"",
|
|
2988
|
-
m)}`;return i.push(`<${
|
|
2989
|
-
erSpaceOnUse"',`x="${r(s.x)}"`,`y="${r(s.y)}"`,`width="${r(s.w)}"`,`height="${r(s.h)}"`];if(e.space==="canvas"&&!eo(n)){let g=Yi(n);if(!g)return
|
|
2990
|
-
e,s),
|
|
2991
|
-
ectRatio="none"${
|
|
2992
|
-
let r=t.startsWith("#")?ur(t):void 0;return r?r.a<1?[`${e}="${r.rgb}"`,`${e}-opacity="${n(r.a)}"`]:[`${e}="${t}"`]:[`${e}="${t}"`]}function Jg(e,t,n,r,i=!0){let s=[],a=(u,
|
|
2986
|
+
"`)),e.spread!=="pad"&&u.push(`spreadMethod="${e.spread}"`),e.space==="canvas"&&!eo(n)){let A=Yi(n);if(!A)return Or(e);u.push(`gradientTransform="${qs(A,r)}"`)}let f=s.map(A=>{let g=ur(A.color);return`\
|
|
2987
|
+
<stop offset="${r(A.at)}" stop-color="${g.rgb}"${g.a<1?` stop-opacity="${r(g.a)}"`:""}/>`}).join("")+"",h=a.kind==="linear"?"linearGradient":"radialGradient",m=`<${h} ${u.join(" ")}>${f}</${h}>`,d=`g${Ui(
|
|
2988
|
+
m)}`;return i.push(`<${h} id="${d}" ${u.join(" ")}>${f}</${h}>`),`url(#${d})`}function Zg(e,t,n,r,i){let s=$i(e,t);if(!s||!(s.w>0)||!(s.h>0)||Pn(e.stops).length<2)return Or(e);let a=['patternUnits="us\
|
|
2989
|
+
erSpaceOnUse"',`x="${r(s.x)}"`,`y="${r(s.y)}"`,`width="${r(s.w)}"`,`height="${r(s.h)}"`];if(e.space==="canvas"&&!eo(n)){let g=Yi(n);if(!g)return Or(e);a.push(`patternTransform="${qs(g,r)}"`)}let u=Xl(
|
|
2990
|
+
e,s),f=u.nearest?' image-rendering="optimizeSpeed" style="image-rendering:pixelated"':"",m=`<image${u.x!==0||u.y!==0?` x="${r(u.x)}" y="${r(u.y)}"`:""} width="${r(u.w)}" height="${r(u.h)}" preserveAsp\
|
|
2991
|
+
ectRatio="none"${f} href="${is(u.texture)}"/>`,d=`<pattern ${a.join(" ")}>${m}</pattern>`,A=`p${Ui(d)}`;return i.push(`<pattern id="${A}" ${a.join(" ")}>${m}</pattern>`),`url(#${A})`}function Oc(e,t,n){
|
|
2992
|
+
let r=t.startsWith("#")?ur(t):void 0;return r?r.a<1?[`${e}="${r.rgb}"`,`${e}-opacity="${n(r.a)}"`]:[`${e}="${t}"`]:[`${e}="${t}"`]}function Jg(e,t,n,r,i=!0){let s=[],a=(u,f)=>i?Oc(u,f,r):[`${u}="${f}"`];
|
|
2993
2993
|
return e!==void 0&&s.push(...a("fill",e)),t!==void 0&&t!=="none"&&s.push(...a("stroke",t)),n.strokeWidth!==void 0&&t!=="none"&&s.push(`stroke-width="${r(n.strokeWidth)}"`),n.strokeDash&&n.strokeDash.length>
|
|
2994
2994
|
0&&s.push(`stroke-dasharray="${n.strokeDash.map(r).join(" ")}"`),n.strokeDashOffset&&s.push(`stroke-dashoffset="${r(n.strokeDashOffset)}"`),n.strokeLinecap&&s.push(`stroke-linecap="${n.strokeLinecap}"`),
|
|
2995
2995
|
n.strokeLinejoin&&s.push(`stroke-linejoin="${n.strokeLinejoin}"`),n.opacity!==void 0&&n.opacity!==1&&s.push(`opacity="${r(n.opacity)}"`),s}function Rc(e,t,n,r){let i=r*Math.PI/180;return[e+n*Math.cos(
|
|
2996
|
-
i),t+n*Math.sin(i)]}function Kg(e,t,n,r,i,s){let a=i-r,[u,
|
|
2996
|
+
i),t+n*Math.sin(i)]}function Kg(e,t,n,r,i,s){let a=i-r,[u,f]=Rc(e,t,n,r),[h,m]=Rc(e,t,n,i),d=Math.abs(a)>180?1:0,A=a>=0?1:0;return`M ${s(u)} ${s(f)} A ${s(n)} ${s(n)} 0 ${d} ${A} ${s(h)} ${s(m)}`}function Nc(e,t,n,r,i=be){
|
|
2997
2997
|
let s=Eo(t.precision),a=r?" ".repeat(n):"",u=r?`
|
|
2998
|
-
`:"",
|
|
2999
|
-
join("")}</defs>${u}${A}${a}</g>${u}`}function eb(e,t,n,r,i,s){let a=Eo(t.precision),u=r?" ".repeat(n):"",
|
|
3000
|
-
`:"",
|
|
3001
|
-
rect":{let m=e.rx>0?[`rx="${a(e.rx)}"`]:[];return`${u}<rect x="${a(e.x)}" y="${a(e.y)}" width="${a(e.w)}" height="${a(e.h)}" ${[...m,...s,...
|
|
3002
|
-
e.cx)}" cy="${a(e.cy)}" r="${a(e.r)}" ${[...s,...
|
|
3003
|
-
arc":return`${u}<path d="${Kg(e.cx,e.cy,e.r,e.a0,e.a1,a)}" ${[...s,...
|
|
3004
|
-
<${d} points="${m}" ${[...s,...
|
|
3005
|
-
m!==1?[`opacity="${a(m)}"`]:[]];return`${u}<image x="${a(e.x)}" y="${a(e.y)}" width="${a(e.w)}" height="${a(e.h)}" ${[...d,...
|
|
2998
|
+
`:"",f=eo(e.transform)?i:Ae(i,e.transform),h=[],m=Tc(e.style.fill,e,f,s,h),d=Tc(e.style.stroke,e,f,s,h),A=eb(e,t,n,r,f,Jg(m,d,e.style,s,e.kind!=="group"));return h.length===0?A:`${a}<g>${u}${a}<defs>${h.
|
|
2999
|
+
join("")}</defs>${u}${A}${a}</g>${u}`}function eb(e,t,n,r,i,s){let a=Eo(t.precision),u=r?" ".repeat(n):"",f=r?`
|
|
3000
|
+
`:"",h=[];switch(eo(e.transform)||h.push(`transform="${qs(e.transform,a)}"`),t.interactive&&h.push(`data-node="${Co(e.meta.sourceNodeId)}"`,`data-index="${e.meta.index}"`,`data-id="${Co(e.id)}"`),e.kind){case"\
|
|
3001
|
+
rect":{let m=e.rx>0?[`rx="${a(e.rx)}"`]:[];return`${u}<rect x="${a(e.x)}" y="${a(e.y)}" width="${a(e.w)}" height="${a(e.h)}" ${[...m,...s,...h].join(" ")}/>${f}`}case"circle":return`${u}<circle cx="${a(
|
|
3002
|
+
e.cx)}" cy="${a(e.cy)}" r="${a(e.r)}" ${[...s,...h].join(" ")}/>${f}`;case"ellipse":return`${u}<ellipse cx="${a(e.cx)}" cy="${a(e.cy)}" rx="${a(e.rx)}" ry="${a(e.ry)}" ${[...s,...h].join(" ")}/>${f}`;case"\
|
|
3003
|
+
arc":return`${u}<path d="${Kg(e.cx,e.cy,e.r,e.a0,e.a1,a)}" ${[...s,...h].join(" ")}/>${f}`;case"polyline":{let m=e.points.map(A=>`${a(A.x)},${a(A.y)}`).join(" "),d=e.closed?"polygon":"polyline";return`${u}\
|
|
3004
|
+
<${d} points="${m}" ${[...s,...h].join(" ")}/>${f}`}case"path":return`${u}<path d="${e.d}" ${[...s,...h].join(" ")}/>${f}`;case"image":{let m=e.style.opacity,d=['preserveAspectRatio="none"',...m!==void 0&&
|
|
3005
|
+
m!==1?[`opacity="${a(m)}"`]:[]];return`${u}<image x="${a(e.x)}" y="${a(e.y)}" width="${a(e.w)}" height="${a(e.h)}" ${[...d,...h].join(" ")} href="${e.href}"/>${f}`}case"text":{let m=[`x="${a(e.x)}"`,`\
|
|
3006
3006
|
y="${a(e.y)}"`,`font-family="${Co(e.fontFamily)}"`,`font-size="${a(e.fontSize)}"`,`text-anchor="${e.anchor}"`];return e.fontWeight!==void 0&&e.fontWeight!==400&&m.push(`font-weight="${a(e.fontWeight)}\
|
|
3007
3007
|
"`),e.fontStretch!==void 0&&e.fontStretch!==100&&m.push(`font-stretch="${a(e.fontStretch)}%"`),e.letterSpacing!==0&&m.push(`letter-spacing="${a(e.letterSpacing)}"`),/^ | $| {2}/.test(e.text)&&m.push('\
|
|
3008
|
-
xml:space="preserve"'),`${u}<text ${[...m,...s,...
|
|
3009
|
-
</g>${
|
|
3010
|
-
`:"",u=nb(e,t.precision).map(([x,v])=>`${x}="${Co(v)}"`),
|
|
3011
|
-
`${n?" ":""}<image x="${s(
|
|
3008
|
+
xml:space="preserve"'),`${u}<text ${[...m,...s,...h].join(" ")}>${Co(e.text)}</text>${f}`}case"group":{let m=e.children.map(d=>Nc(d,t,n+1,r,i)).join("");return`${u}<g ${[...s,...h].join(" ")}>${f}${m}${u}\
|
|
3009
|
+
</g>${f}`}}}function tb(e,t,n,r,i){if(!e.visible)return"";let s=Eo(t.precision),a=n?`
|
|
3010
|
+
`:"",u=nb(e,t.precision).map(([x,v])=>`${x}="${Co(v)}"`),f=e.texture?e.texture.at?.x??(r==="center"?-e.texture.width/2:0):0,h=e.texture?e.texture.at?.y??(r==="center"?-e.texture.height/2:0):0,m=e.texture?
|
|
3011
|
+
`${n?" ":""}<image x="${s(f)}" y="${s(h)}" width="${s(e.texture.width)}" height="${s(e.texture.height)}" href="${i(e.texture)}"/>${a}`:"",d=e.texture?e.textureAt??0:0,A=x=>Nc(x,t,2,n),g=e.shapes.slice(
|
|
3012
3012
|
0,d).map(A).join("")+m+e.shapes.slice(d).map(A).join("");return`${n?" ":""}<g ${u.join(" ")}>${a}${g}${n?" ":""}</g>${a}`}function nb(e,t=Dc){let n=Eo(t),r=[["id",e.id],["data-layer",e.name]];return e.
|
|
3013
3013
|
opacity!==1&&r.push(["opacity",n(e.opacity)]),r}function Qc(e,t={}){let n=t.precision??Dc,r=t.interactive??!1,i=t.pretty??!0,s=i?`
|
|
3014
|
-
`:"",a=Eo(n),u=t.textureHref??is,
|
|
3015
|
-
origin==="center"?-e.height/2:0,A=e.background&&e.background!=="none"?`${i?" ":""}<rect x="${a(m)}" y="${a(d)}" width="${a(e.width)}" height="${a(e.height)}" ${
|
|
3016
|
-
"",g=t.crop??{x:m,y:d,w:e.width,h:e.height};return`<svg xmlns="http:/${"/"}www.w3.org/2000/svg" width="${a(g.w)}" height="${a(g.h)}" viewBox="${a(g.x)} ${a(g.y)} ${a(g.w)} ${a(g.h)}">${s}${
|
|
3014
|
+
`:"",a=Eo(n),u=t.textureHref??is,f=e.layers.map(x=>tb(x,{precision:n,interactive:r},i,e.origin,u)).join(""),h=t.defs?`${i?" ":""}<defs>${t.defs}</defs>${s}`:"",m=e.origin==="center"?-e.width/2:0,d=e.
|
|
3015
|
+
origin==="center"?-e.height/2:0,A=e.background&&e.background!=="none"?`${i?" ":""}<rect x="${a(m)}" y="${a(d)}" width="${a(e.width)}" height="${a(e.height)}" ${Oc("fill",e.background,a).join(" ")}/>${s}`:
|
|
3016
|
+
"",g=t.crop??{x:m,y:d,w:e.width,h:e.height};return`<svg xmlns="http:/${"/"}www.w3.org/2000/svg" width="${a(g.w)}" height="${a(g.h)}" viewBox="${a(g.x)} ${a(g.y)} ${a(g.w)} ${a(g.h)}">${s}${h}${A}${f}</svg>${s}`}function rb(e,t){switch(e.kind){case"number":case"percent":{let n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?n:void 0}case"int":{let n=typeof t=="number"?t:Number(t);return Number.isFinite(
|
|
3017
3017
|
n)?Math.round(n):void 0}case"bool":return typeof t=="boolean"?t:t==="true"?!0:t==="false"?!1:void 0;case"color":return typeof t=="string"&&/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(t)?t.toLowerCase():void 0;case"\
|
|
3018
3018
|
text":return typeof t=="string"?t:t==null?void 0:String(t);case"choice":{let n=e.options??[];if(typeof t=="string")return n.some(i=>i.value===t)?t:void 0;let r=typeof t=="number"?t:Number.NaN;return!Number.
|
|
3019
3019
|
isFinite(r)||n.length===0?void 0:n[Math.min(n.length-1,Math.max(0,Math.round(r)))].value}}}function Lc(e,t,n,r){if(!t)return e;let i=e.graph.nodes.findIndex(m=>m.id===t);if(i<0)return e;let s=e.graph.
|
|
3020
|
-
nodes[i],a={...s.params},u=!1,
|
|
3021
|
-
continue;let d=rb(m,n[m.key]);d!==void 0&&
|
|
3022
|
-
(s=u.timestamp/1e3,a=null):
|
|
3020
|
+
nodes[i],a={...s.params},u=!1,f=(m,d)=>{if(J(a[m]).base===d)return;let g=a[m];a[m]=typeof g=="object"&&g!==null&&!Array.isArray(g)&&!("x"in g)?{...g,base:d}:d,u=!0};for(let m of Gs(s)){if(!(m.key in n))
|
|
3021
|
+
continue;let d=rb(m,n[m.key]);d!==void 0&&f(m.key,d)}if(f("stopAt",r),!u)return e;let h=e.graph.nodes.slice();return h[i]={...s,params:a},{...e,graph:{...e.graph,nodes:h}}}function Fc(e,t,n){let r=n*1e3,i=e,s=null,a=null;for(let u of t){if(u.timestamp>r)break;let f=u.action?.type;if(f==="updateAction"){let h=u.action.params?.data;h&&(i={...i,...h})}else f==="playAction"?
|
|
3022
|
+
(s=u.timestamp/1e3,a=null):f==="stopAction"&&s!==null&&a===null&&(a=u.timestamp/1e3)}return{values:i,play:s,stop:a}}var ob=_c();function ib(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n.buffer}function Yc(e,t){let n=e.assets,r;if(e.outline&&t){let i=new Map(e.fonts.
|
|
3023
3023
|
map(s=>[s.file,ib(s.base64)]));r=t.createOutliner(s=>i.get(s.file))}return{embedded:e,project:va(e.project).project,cache:new il,...n?{asset:i=>n[i]}:{},...r?{outliner:r}:{}}}function sb(e,t,n){if(t.play===
|
|
3024
3024
|
null)return null;let r=Math.max(0,n-t.play);if(e.loop&&e.duration>0&&(r%=e.duration),t.stop===null)return{t:r,opacity:1};let i=n-t.stop;return e.exit==="cut"||i>=e.outro?null:{t:r,opacity:e.exit==="fa\
|
|
3025
|
-
de"?1-i/e.outro:1}}function Wc(e,t,n,r){let{embedded:i,project:s,cache:a,asset:u,outliner:
|
|
3026
|
-
|
|
3025
|
+
de"?1-i/e.outro:1}}function Wc(e,t,n,r){let{embedded:i,project:s,cache:a,asset:u,outliner:f}=e,h=Fc(t,n,r),m=sb(i.timing,h,r);if(!m)return null;let d=h.stop!==null&&h.play!==null&&!i.timing.loop?h.stop-
|
|
3026
|
+
h.play:-1,A=sl(Lc(s,i.controlNode,h.values,d),ob,{t:m.t,cache:a,asset:u,outliner:f}),g=ac(A.scene,f);return{svg:Qc(i.transparent?{...g,background:"none"}:g,{precision:i.precision}),opacity:m.opacity}}return gf(ab);})();
|