00000000: 64 67 65 3a 69 2e 6c 65 66 74 7d 2c 7b 73 74 61 dge:i.left},{sta
00000010: 72 74 45 64 67 65 3a 69 2e 72 69 67 68 74 2c 65 rtEdge:i.right,e
00000020: 6e 64 45 64 67 65 3a 75 7d 2c 2e 2e 2e 63 6d 28 ndEdge:u},...cm(
00000030: 6f 2c 6c 2e 69 64 2c 6e 2c 22 66 6f 72 77 61 72 o,l.id,n,"forwar
00000040: 64 22 2c 64 29 5d 7d 29 3b 62 72 65 61 6b 7d 63 d",d)]});break}c
00000050: 61 73 65 22 67 61 70 5f 64 75 70 6c 69 63 61 74 ase"gap_duplicat
00000060: 65 22 3a 7b 63 6f 6e 73 74 20 64 3d 49 75 28 74 e":{const d=Iu(t
00000070: 5b 30 5d 2c 74 5b 31 5d 2c 65 2e 6d 69 6e 59 2c [0],t[1],e.minY,
00000080: 65 2e 6d 61 78 59 29 3b 61 2e 70 75 73 68 28 7b e.maxY);a.push({
00000090: 74 79 70 65 3a 22 67 61 70 73 22 2c 64 69 72 65 type:"gaps",dire
000000a0: 63 74 69 6f 6e 3a 22 68 6f 72 69 7a 6f 6e 74 61 ction:"horizonta
000000b0: 6c 22 2c 69 64 3a 46 66 28 29 2c 67 61 70 73 3a l",id:Ff(),gaps:
000000c0: 22 6c 65 66 74 22 3d 3d 3d 6e 2e 70 72 6f 74 72 "left"===n.protr
000000d0: 75 73 69 6f 6e 44 69 72 65 63 74 69 6f 6e 3f 5b usionDirection?[
000000e0: 7b 73 74 61 72 74 45 64 67 65 3a 69 2e 72 69 67 {startEdge:i.rig
000000f0: 68 74 2c 65 6e 64 45 64 67 65 3a 72 2e 6d 61 70 ht,endEdge:r.map
00000100: 28 28 65 3d 3e 65 2e 63 6c 6f 6e 65 28 29 2e 61 ((e=>e.clone().a
00000110: 64 64 58 59 28 2d 73 2e 70 61 67 65 42 6f 75 6e ddXY(-s.pageBoun
00000120: 64 73 2e 77 69 64 74 68 2c 30 29 29 29 7d 2c 7b ds.width,0)))},{
00000130: 73 74 61 72 74 45 64 67 65 3a 72 2c 65 6e 64 45 startEdge:r,endE
00000140: 64 67 65 3a 75 7d 2c 2e 2e 2e 63 6d 28 6f 2c 6c dge:u},...cm(o,l
00000150: 2e 69 64 2c 63 2c 22 66 6f 72 77 61 72 64 22 2c .id,c,"forward",
00000160: 64 29 5d 3a 5b 2e 2e 2e 63 6d 28 6f 2c 73 2e 69 d)]:[...cm(o,s.i
00000170: 64 2c 63 2c 22 62 61 63 6b 77 61 72 64 22 2c 64 d,c,"backward",d
00000180: 29 2c 7b 73 74 61 72 74 45 64 67 65 3a 72 2c 65 ),{startEdge:r,e
00000190: 6e 64 45 64 67 65 3a 75 7d 2c 7b 73 74 61 72 74 ndEdge:u},{start
000001a0: 45 64 67 65 3a 75 2e 6d 61 70 28 28 65 3d 3e 65 Edge:u.map((e=>e
000001b0: 2e 63 6c 6f 6e 65 28 29 2e 61 64 64 58 59 28 6e .clone().addXY(n
000001c0: 2e 67 61 70 2e 65 6e 64 4e 6f 64 65 2e 70 61 67 .gap.endNode.pag
000001d0: 65 42 6f 75 6e 64 73 2e 77 69 64 74 68 2c 30 29 eBounds.width,0)
000001e0: 29 29 2c 65 6e 64 45 64 67 65 3a 69 2e 6c 65 66 )),endEdge:i.lef
000001f0: 74 7d 5d 7d 29 3b 62 72 65 61 6b 7d 7d 7d 69 66 t}]});break}}}if
00000200: 28 6e 2e 6c 65 6e 67 74 68 3e 30 29 66 6f 72 28 (n.length>0)for(
00000210: 63 6f 6e 73 74 20 74 20 6f 66 20 6e 29 7b 69 66 const t of n){if
00000220: 28 22 70 6f 69 6e 74 73 22 3d 3d 3d 74 2e 74 79 ("points"===t.ty
00000230: 70 65 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 pe)continue;cons
00000240: 74 7b 67 61 70 3a 7b 62 72 65 61 64 74 68 49 6e t{gap:{breadthIn
00000250: 74 65 72 73 65 63 74 69 6f 6e 3a 6e 2c 73 74 61 tersection:n,sta
00000260: 72 74 45 64 67 65 3a 6f 2c 73 74 61 72 74 4e 6f rtEdge:o,startNo
00000270: 64 65 3a 73 2c 65 6e 64 4e 6f 64 65 3a 6c 2c 6c de:s,endNode:l,l
00000280: 65 6e 67 74 68 3a 63 2c 65 6e 64 45 64 67 65 3a ength:c,endEdge:
00000290: 75 7d 7d 3d 74 3b 73 77 69 74 63 68 28 74 2e 74 u}}=t;switch(t.t
000002a0: 79 70 65 29 7b 63 61 73 65 22 67 61 70 5f 63 65 ype){case"gap_ce
000002b0: 6e 74 65 72 22 3a 7b 63 6f 6e 73 74 20 6c 3d 28 nter":{const l=(
000002c0: 63 2d 65 2e 68 65 69 67 68 74 29 2f 32 2c 64 3d c-e.height)/2,d=
000002d0: 49 75 28 6e 5b 30 5d 2c 6e 5b 31 5d 2c 65 2e 6d Iu(n[0],n[1],e.m
000002e0: 69 6e 58 2c 65 2e 6d 61 78 58 29 3b 61 2e 70 75 inX,e.maxX);a.pu
000002f0: 73 68 28 7b 74 79 70 65 3a 22 67 61 70 73 22 2c sh({type:"gaps",
00000300: 64 69 72 65 63 74 69 6f 6e 3a 22 76 65 72 74 69 direction:"verti
00000310: 63 61 6c 22 2c 69 64 3a 46 66 28 29 2c 67 61 70 cal",id:Ff(),gap
00000320: 73 3a 5b 2e 2e 2e 63 6d 28 72 2c 73 2e 69 64 2c s:[...cm(r,s.id,
00000330: 6c 2c 22 62 61 63 6b 77 61 72 64 22 2c 64 29 2c l,"backward",d),
00000340: 7b 73 74 61 72 74 45 64 67 65 3a 6f 2c 65 6e 64 {startEdge:o,end
00000350: 45 64 67 65 3a 69 2e 74 6f 70 7d 2c 7b 73 74 61 Edge:i.top},{sta
00000360: 72 74 45 64 67 65 3a 69 2e 62 6f 74 74 6f 6d 2c rtEdge:i.bottom,
00000370: 65 6e 64 45 64 67 65 3a 75 7d 2c 2e 2e 2e 63 6d endEdge:u},...cm
00000380: 28 72 2c 74 2e 67 61 70 2e 65 6e 64 4e 6f 64 65 (r,t.gap.endNode
00000390: 2e 69 64 2c 6c 2c 22 66 6f 72 77 61 72 64 22 2c .id,l,"forward",
000003a0: 64 29 5d 7d 29 3b 62 72 65 61 6b 7d 63 61 73 65 d)]});break}case
000003b0: 22 67 61 70 5f 64 75 70 6c 69 63 61 74 65 22 3a "gap_duplicate":
000003c0: 7b 63 6f 6e 73 74 20 64 3d 49 75 28 6e 5b 30 5d {const d=Iu(n[0]
000003d0: 2c 6e 5b 31 5d 2c 65 2e 6d 69 6e 58 2c 65 2e 6d ,n[1],e.minX,e.m
000003e0: 61 78 58 29 3b 61 2e 70 75 73 68 28 7b 74 79 70 axX);a.push({typ
000003f0: 65 3a 22 67 61 70 73 22 2c 64 69 72 65 63 74 69 e:"gaps",directi
00000400: 6f 6e 3a 22 76 65 72 74 69 63 61 6c 22 2c 69 64 on:"vertical",id
00000410: 3a 46 66 28 29 2c 67 61 70 73 3a 22 74 6f 70 22 :Ff(),gaps:"top"
00000420: 3d 3d 3d 74 2e 70 72 6f 74 72 75 73 69 6f 6e 44 ===t.protrusionD
00000430: 69 72 65 63 74 69 6f 6e 3f 5b 7b 73 74 61 72 74 irection?[{start
00000440: 45 64 67 65 3a 69 2e 62 6f 74 74 6f 6d 2c 65 6e Edge:i.bottom,en
00000450: 64 45 64 67 65 3a 6f 2e 6d 61 70 28 28 65 3d 3e dEdge:o.map((e=>
00000460: 65 2e 63 6c 6f 6e 65 28 29 2e 61 64 64 58 59 28 e.clone().addXY(
00000470: 30 2c 2d 73 2e 70 61 67 65 42 6f 75 6e 64 73 2e 0,-s.pageBounds.
00000480: 68 65 69 67 68 74 29 29 29 7d 2c 7b 73 74 61 72 height)))},{star
00000490: 74 45 64 67 65 3a 6f 2c 65 6e 64 45 64 67 65 3a tEdge:o,endEdge:
000004a0: 75 7d 2c 2e 2e 2e 63 6d 28 72 2c 6c 2e 69 64 2c u},...cm(r,l.id,
000004b0: 63 2c 22 66 6f 72 77 61 72 64 22 2c 64 29 5d 3a c,"forward",d)]:
000004c0: 5b 2e 2e 2e 63 6d 28 72 2c 73 2e 69 64 2c 63 2c [...cm(r,s.id,c,
000004d0: 22 62 61 63 6b 77 61 72 64 22 2c 64 29 2c 7b 73 "backward",d),{s
000004e0: 74 61 72 74 45 64 67 65 3a 6f 2c 65 6e 64 45 64 tartEdge:o,endEd
000004f0: 67 65 3a 75 7d 2c 7b 73 74 61 72 74 45 64 67 65 ge:u},{startEdge
00000500: 3a 75 2e 6d 61 70 28 28 65 3d 3e 65 2e 63 6c 6f :u.map((e=>e.clo
00000510: 6e 65 28 29 2e 61 64 64 58 59 28 30 2c 6c 2e 70 ne().addXY(0,l.p
00000520: 61 67 65 42 6f 75 6e 64 73 2e 68 65 69 67 68 74 ageBounds.height
00000530: 29 29 29 2c 65 6e 64 45 64 67 65 3a 69 2e 74 6f ))),endEdge:i.to
00000540: 70 7d 5d 7d 29 7d 7d 7d 72 65 74 75 72 6e 20 66 p}]})}}}return f
00000550: 75 6e 63 74 69 6f 6e 28 65 29 7b 65 2e 73 6f 72 unction(e){e.sor
00000560: 74 28 28 28 65 2c 74 29 3d 3e 74 2e 67 61 70 73 t(((e,t)=>t.gaps
00000570: 2e 6c 65 6e 67 74 68 2d 65 2e 67 61 70 73 2e 6c .length-e.gaps.l
00000580: 65 6e 67 74 68 29 29 3b 66 6f 72 28 6c 65 74 20 ength));for(let
00000590: 74 3d 65 2e 6c 65 6e 67 74 68 2d 31 3b 74 3e 30 t=e.length-1;t>0
000005a0: 3b 74 2d 2d 29 7b 63 6f 6e 73 74 20 6e 3d 65 5b ;t--){const n=e[
000005b0: 74 5d 3b 66 6f 72 28 6c 65 74 20 72 3d 74 2d 31 t];for(let r=t-1
000005c0: 3b 72 3e 3d 30 3b 72 2d 2d 29 7b 63 6f 6e 73 74 ;r>=0;r--){const
000005d0: 20 6f 3d 65 5b 72 5d 3b 69 66 28 6f 2e 64 69 72 o=e[r];if(o.dir
000005e0: 65 63 74 69 6f 6e 3d 3d 3d 6e 2e 64 69 72 65 63 ection===n.direc
000005f0: 74 69 6f 6e 26 26 6e 2e 67 61 70 73 2e 65 76 65 tion&&n.gaps.eve
00000600: 72 79 28 28 65 3d 3e 6f 2e 67 61 70 73 2e 73 6f ry((e=>o.gaps.so
00000610: 6d 65 28 28 74 3d 3e 6c 6d 28 65 2e 73 74 61 72 me((t=>lm(e.star
00000620: 74 45 64 67 65 5b 30 5d 2e 78 29 3d 3d 3d 6c 6d tEdge[0].x)===lm
00000630: 28 74 2e 73 74 61 72 74 45 64 67 65 5b 30 5d 2e (t.startEdge[0].
00000640: 78 29 26 26 6c 6d 28 65 2e 73 74 61 72 74 45 64 x)&&lm(e.startEd
00000650: 67 65 5b 30 5d 2e 79 29 3d 3d 3d 6c 6d 28 74 2e ge[0].y)===lm(t.
00000660: 73 74 61 72 74 45 64 67 65 5b 30 5d 2e 79 29 26 startEdge[0].y)&
00000670: 26 6c 6d 28 65 2e 73 74 61 72 74 45 64 67 65 5b &lm(e.startEdge[
00000680: 31 5d 2e 78 29 3d 3d 3d 6c 6d 28 74 2e 73 74 61 1].x)===lm(t.sta
00000690: 72 74 45 64 67 65 5b 31 5d 2e 78 29 26 26 6c 6d rtEdge[1].x)&&lm
000006a0: 28 65 2e 73 74 61 72 74 45 64 67 65 5b 31 5d 2e (e.startEdge[1].
000006b0: 79 29 3d 3d 3d 6c 6d 28 74 2e 73 74 61 72 74 45 y)===lm(t.startE
000006c0: 64 67 65 5b 31 5d 2e 79 29 29 29 26 26 6f 2e 67 dge[1].y)))&&o.g
000006d0: 61 70 73 2e 73 6f 6d 65 28 28 74 3d 3e 6c 6d 28 aps.some((t=>lm(
000006e0: 65 2e 65 6e 64 45 64 67 65 5b 30 5d 2e 78 29 3d e.endEdge[0].x)=
000006f0: 3d 3d 6c 6d 28 74 2e 65 6e 64 45 64 67 65 5b 30 ==lm(t.endEdge[0
00000700: 5d 2e 78 29 26 26 6c 6d 28 65 2e 65 6e 64 45 64 ].x)&&lm(e.endEd
00000710: 67 65 5b 30 5d 2e 79 29 3d 3d 3d 6c 6d 28 74 2e ge[0].y)===lm(t.
00000720: 65 6e 64 45 64 67 65 5b 30 5d 2e 79 29 26 26 6c endEdge[0].y)&&l
00000730: 6d 28 65 2e 65 6e 64 45 64 67 65 5b 31 5d 2e 78 m(e.endEdge[1].x
00000740: 29 3d 3d 3d 6c 6d 28 74 2e 65 6e 64 45 64 67 65 )===lm(t.endEdge
00000750: 5b 31 5d 2e 78 29 26 26 6c 6d 28 65 2e 65 6e 64 [1].x)&&lm(e.end
00000760: 45 64 67 65 5b 31 5d 2e 79 29 3d 3d 3d 6c 6d 28 Edge[1].y)===lm(
00000770: 74 2e 65 6e 64 45 64 67 65 5b 31 5d 2e 79 29 29 t.endEdge[1].y))
00000780: 29 29 29 29 7b 65 2e 73 70 6c 69 63 65 28 74 2c )))){e.splice(t,
00000790: 31 29 3b 62 72 65 61 6b 7d 7d 7d 7d 28 61 29 2c 1);break}}}}(a),
000007a0: 61 7d 7d 66 75 6e 63 74 69 6f 6e 20 64 6d 28 65 a}}function dm(e
000007b0: 2c 74 29 7b 63 6f 6e 73 74 7b 6d 69 6e 58 3a 6e ,t){const{minX:n
000007c0: 2c 6d 61 78 58 3a 72 2c 6d 69 6e 59 3a 6f 2c 6d ,maxX:r,minY:o,m
000007d0: 61 78 59 3a 69 7d 3d 74 2c 61 3d 5b 5d 3b 73 77 axY:i}=t,a=[];sw
000007e0: 69 74 63 68 28 65 29 7b 63 61 73 65 22 74 6f 70 itch(e){case"top
000007f0: 22 3a 63 61 73 65 22 6c 65 66 74 22 3a 63 61 73 ":case"left":cas
00000800: 65 22 74 6f 70 5f 6c 65 66 74 22 3a 63 61 73 65 e"top_left":case
00000810: 22 61 6e 79 22 3a 61 2e 70 75 73 68 28 7b 69 64 "any":a.push({id
00000820: 3a 22 74 6f 70 5f 6c 65 66 74 22 2c 68 61 6e 64 :"top_left",hand
00000830: 6c 65 3a 22 74 6f 70 5f 6c 65 66 74 22 2c 78 3a le:"top_left",x:
00000840: 6e 2c 79 3a 6f 7d 29 7d 73 77 69 74 63 68 28 65 n,y:o})}switch(e
00000850: 29 7b 63 61 73 65 22 74 6f 70 22 3a 63 61 73 65 ){case"top":case
00000860: 22 72 69 67 68 74 22 3a 63 61 73 65 22 74 6f 70 "right":case"top
00000870: 5f 72 69 67 68 74 22 3a 63 61 73 65 22 61 6e 79 _right":case"any
00000880: 22 3a 61 2e 70 75 73 68 28 7b 69 64 3a 22 74 6f ":a.push({id:"to
00000890: 70 5f 72 69 67 68 74 22 2c 68 61 6e 64 6c 65 3a p_right",handle:
000008a0: 22 74 6f 70 5f 72 69 67 68 74 22 2c 78 3a 72 2c "top_right",x:r,
000008b0: 79 3a 6f 7d 29 7d 73 77 69 74 63 68 28 65 29 7b y:o})}switch(e){
000008c0: 63 61 73 65 22 62 6f 74 74 6f 6d 22 3a 63 61 73 case"bottom":cas
000008d0: 65 22 72 69 67 68 74 22 3a 63 61 73 65 22 62 6f e"right":case"bo
000008e0: 74 74 6f 6d 5f 72 69 67 68 74 22 3a 63 61 73 65 ttom_right":case
000008f0: 22 61 6e 79 22 3a 61 2e 70 75 73 68 28 7b 69 64 "any":a.push({id
00000900: 3a 22 62 6f 74 74 6f 6d 5f 72 69 67 68 74 22 2c :"bottom_right",
00000910: 68 61 6e 64 6c 65 3a 22 62 6f 74 74 6f 6d 5f 72 handle:"bottom_r
00000920: 69 67 68 74 22 2c 78 3a 72 2c 79 3a 69 7d 29 7d ight",x:r,y:i})}
00000930: 73 77 69 74 63 68 28 65 29 7b 63 61 73 65 22 62 switch(e){case"b
00000940: 6f 74 74 6f 6d 22 3a 63 61 73 65 22 6c 65 66 74 ottom":case"left
00000950: 22 3a 63 61 73 65 22 62 6f 74 74 6f 6d 5f 6c 65 ":case"bottom_le
00000960: 66 74 22 3a 63 61 73 65 22 61 6e 79 22 3a 61 2e ft":case"any":a.
00000970: 70 75 73 68 28 7b 69 64 3a 22 62 6f 74 74 6f 6d push({id:"bottom
00000980: 5f 6c 65 66 74 22 2c 68 61 6e 64 6c 65 3a 22 62 _left",handle:"b
00000990: 6f 74 74 6f 6d 5f 6c 65 66 74 22 2c 78 3a 6e 2c ottom_left",x:n,
000009a0: 79 3a 69 7d 29 7d 72 65 74 75 72 6e 20 61 7d 73 y:i})}return a}s
000009b0: 6d 28 5b 6f 61 5d 2c 75 6d 2e 70 72 6f 74 6f 74 m([oa],um.protot
000009c0: 79 70 65 2c 22 67 65 74 53 6e 61 70 50 6f 69 6e ype,"getSnapPoin
000009d0: 74 73 43 61 63 68 65 22 2c 31 29 2c 73 6d 28 5b tsCache",1),sm([
000009e0: 6f 61 5d 2c 75 6d 2e 70 72 6f 74 6f 74 79 70 65 oa],um.prototype
000009f0: 2c 22 67 65 74 53 6e 61 70 70 61 62 6c 65 50 6f ,"getSnappablePo
00000a00: 69 6e 74 73 22 2c 31 29 2c 73 6d 28 5b 6f 61 5d ints",1),sm([oa]
00000a10: 2c 75 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,um.prototype,"g
00000a20: 65 74 53 6e 61 70 70 61 62 6c 65 47 61 70 4e 6f etSnappableGapNo
00000a30: 64 65 73 22 2c 31 29 2c 73 6d 28 5b 6f 61 5d 2c des",1),sm([oa],
00000a40: 75 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 um.prototype,"ge
00000a50: 74 56 69 73 69 62 6c 65 47 61 70 73 22 2c 31 29 tVisibleGaps",1)
00000a60: 3b 76 61 72 20 70 6d 3d 4f 62 6a 65 63 74 2e 64 ;var pm=Object.d
00000a70: 65 66 69 6e 65 50 72 6f 70 65 72 74 79 2c 66 6d efineProperty,fm
00000a80: 3d 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 =Object.getOwnPr
00000a90: 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 opertyDescriptor
00000aa0: 3b 63 6f 6e 73 74 20 68 6d 3d 28 29 3d 3e 6e 75 ;const hm=()=>nu
00000ab0: 6c 6c 2c 6d 6d 3d 28 29 3d 3e 5b 5d 3b 63 6c 61 ll,mm=()=>[];cla
00000ac0: 73 73 20 67 6d 7b 63 6f 6e 73 74 72 75 63 74 6f ss gm{constructo
00000ad0: 72 28 65 29 7b 74 68 69 73 2e 6d 61 6e 61 67 65 r(e){this.manage
00000ae0: 72 3d 65 2c 74 68 69 73 2e 65 64 69 74 6f 72 3d r=e,this.editor=
00000af0: 65 2e 65 64 69 74 6f 72 7d 65 64 69 74 6f 72 3b e.editor}editor;
00000b00: 67 65 74 53 6e 61 70 47 65 6f 6d 65 74 72 79 43 getSnapGeometryC
00000b10: 61 63 68 65 28 29 7b 63 6f 6e 73 74 7b 65 64 69 ache(){const{edi
00000b20: 74 6f 72 3a 65 7d 3d 74 68 69 73 3b 72 65 74 75 tor:e}=this;retu
00000b30: 72 6e 20 65 2e 73 74 6f 72 65 2e 63 72 65 61 74 rn e.store.creat
00000b40: 65 43 6f 6d 70 75 74 65 64 43 61 63 68 65 28 22 eComputedCache("
00000b50: 68 61 6e 64 6c 65 20 73 6e 61 70 20 67 65 6f 6d handle snap geom
00000b60: 65 74 72 79 22 2c 28 74 3d 3e 7b 63 6f 6e 73 74 etry",(t=>{const
00000b70: 20 6e 3d 65 2e 67 65 74 53 68 61 70 65 55 74 69 n=e.getShapeUti
00000b80: 6c 28 74 29 2e 67 65 74 48 61 6e 64 6c 65 53 6e l(t).getHandleSn
00000b90: 61 70 47 65 6f 6d 65 74 72 79 28 74 29 3b 72 65 apGeometry(t);re
00000ba0: 74 75 72 6e 7b 6f 75 74 6c 69 6e 65 3a 76 6f 69 turn{outline:voi
00000bb0: 64 20 30 3d 3d 3d 6e 2e 6f 75 74 6c 69 6e 65 3f d 0===n.outline?
00000bc0: 65 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 e.getShapeGeomet
00000bd0: 72 79 28 74 29 3a 6e 2e 6f 75 74 6c 69 6e 65 2c ry(t):n.outline,
00000be0: 70 6f 69 6e 74 73 3a 6e 2e 70 6f 69 6e 74 73 3f points:n.points?
00000bf0: 3f 5b 5d 2c 67 65 74 53 65 6c 66 53 6e 61 70 4f ?[],getSelfSnapO
00000c00: 75 74 6c 69 6e 65 3a 6e 2e 67 65 74 53 65 6c 66 utline:n.getSelf
00000c10: 53 6e 61 70 4f 75 74 6c 69 6e 65 3f 3f 68 6d 2c SnapOutline??hm,
00000c20: 67 65 74 53 65 6c 66 53 6e 61 70 50 6f 69 6e 74 getSelfSnapPoint
00000c30: 73 3a 6e 2e 67 65 74 53 65 6c 66 53 6e 61 70 50 s:n.getSelfSnapP
00000c40: 6f 69 6e 74 73 3f 3f 6d 6d 7d 7d 29 29 7d 2a 69 oints??mm}}))}*i
00000c50: 74 65 72 61 74 65 53 6e 61 70 50 6f 69 6e 74 73 terateSnapPoints
00000c60: 49 6e 50 61 67 65 53 70 61 63 65 28 65 2c 74 29 InPageSpace(e,t)
00000c70: 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 {const n=this.ge
00000c80: 74 53 6e 61 70 47 65 6f 6d 65 74 72 79 43 61 63 tSnapGeometryCac
00000c90: 68 65 28 29 2e 67 65 74 28 65 29 3f 2e 67 65 74 he().get(e)?.get
00000ca0: 53 65 6c 66 53 6e 61 70 50 6f 69 6e 74 73 28 74 SelfSnapPoints(t
00000cb0: 29 3b 69 66 28 6e 26 26 6e 2e 6c 65 6e 67 74 68 );if(n&&n.length
00000cc0: 29 7b 63 6f 6e 73 74 20 74 3d 4b 72 28 74 68 69 ){const t=Kr(thi
00000cd0: 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 61 70 s.editor.getShap
00000ce0: 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 65 ePageTransform(e
00000cf0: 29 29 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f ));for(const e o
00000d00: 66 20 6e 29 79 69 65 6c 64 20 74 2e 61 70 70 6c f n)yield t.appl
00000d10: 79 54 6f 50 6f 69 6e 74 28 65 29 7d 66 6f 72 28 yToPoint(e)}for(
00000d20: 63 6f 6e 73 74 20 74 20 6f 66 20 74 68 69 73 2e const t of this.
00000d30: 6d 61 6e 61 67 65 72 2e 67 65 74 53 6e 61 70 70 manager.getSnapp
00000d40: 61 62 6c 65 53 68 61 70 65 73 28 29 29 7b 69 66 ableShapes()){if
00000d50: 28 74 3d 3d 3d 65 29 63 6f 6e 74 69 6e 75 65 3b (t===e)continue;
00000d60: 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 const n=this.get
00000d70: 53 6e 61 70 47 65 6f 6d 65 74 72 79 43 61 63 68 SnapGeometryCach
00000d80: 65 28 29 2e 67 65 74 28 74 29 3f 2e 70 6f 69 6e e().get(t)?.poin
00000d90: 74 73 3b 69 66 28 21 6e 7c 7c 21 6e 2e 6c 65 6e ts;if(!n||!n.len
00000da0: 67 74 68 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e gth)continue;con
00000db0: 73 74 20 72 3d 4b 72 28 74 68 69 73 2e 65 64 69 st r=Kr(this.edi
00000dc0: 74 6f 72 2e 67 65 74 53 68 61 70 65 50 61 67 65 tor.getShapePage
00000dd0: 54 72 61 6e 73 66 6f 72 6d 28 74 29 29 3b 66 6f Transform(t));fo
00000de0: 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 6e 29 79 r(const e of n)y
00000df0: 69 65 6c 64 20 72 2e 61 70 70 6c 79 54 6f 50 6f ield r.applyToPo
00000e00: 69 6e 74 28 65 29 7d 7d 2a 69 74 65 72 61 74 65 int(e)}}*iterate
00000e10: 53 6e 61 70 4f 75 74 6c 69 6e 65 73 28 65 2c 74 SnapOutlines(e,t
00000e20: 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 ){const n=this.g
00000e30: 65 74 53 6e 61 70 47 65 6f 6d 65 74 72 79 43 61 etSnapGeometryCa
00000e40: 63 68 65 28 29 2e 67 65 74 28 65 29 3f 2e 67 65 che().get(e)?.ge
00000e50: 74 53 65 6c 66 53 6e 61 70 4f 75 74 6c 69 6e 65 tSelfSnapOutline
00000e60: 28 74 29 3b 6e 26 26 28 79 69 65 6c 64 7b 73 68 (t);n&&(yield{sh
00000e70: 61 70 65 49 64 3a 65 2c 6f 75 74 6c 69 6e 65 3a apeId:e,outline:
00000e80: 6e 7d 29 3b 66 6f 72 28 63 6f 6e 73 74 20 74 20 n});for(const t
00000e90: 6f 66 20 74 68 69 73 2e 6d 61 6e 61 67 65 72 2e of this.manager.
00000ea0: 67 65 74 53 6e 61 70 70 61 62 6c 65 53 68 61 70 getSnappableShap
00000eb0: 65 73 28 29 29 7b 69 66 28 74 3d 3d 3d 65 29 63 es()){if(t===e)c
00000ec0: 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 6e 3d ontinue;const n=
00000ed0: 74 68 69 73 2e 67 65 74 53 6e 61 70 47 65 6f 6d this.getSnapGeom
00000ee0: 65 74 72 79 43 61 63 68 65 28 29 2e 67 65 74 28 etryCache().get(
00000ef0: 74 29 3f 2e 6f 75 74 6c 69 6e 65 3b 6e 26 26 28 t)?.outline;n&&(
00000f00: 79 69 65 6c 64 7b 73 68 61 70 65 49 64 3a 74 2c yield{shapeId:t,
00000f10: 6f 75 74 6c 69 6e 65 3a 6e 7d 29 7d 7d 67 65 74 outline:n})}}get
00000f20: 48 61 6e 64 6c 65 53 6e 61 70 50 6f 73 69 74 69 HandleSnapPositi
00000f30: 6f 6e 28 7b 63 75 72 72 65 6e 74 53 68 61 70 65 on({currentShape
00000f40: 49 64 3a 65 2c 68 61 6e 64 6c 65 3a 74 2c 68 61 Id:e,handle:t,ha
00000f50: 6e 64 6c 65 49 6e 50 61 67 65 53 70 61 63 65 3a ndleInPageSpace:
00000f60: 6e 7d 29 7b 63 6f 6e 73 74 20 72 3d 74 68 69 73 n}){const r=this
00000f70: 2e 6d 61 6e 61 67 65 72 2e 67 65 74 53 6e 61 70 .manager.getSnap
00000f80: 54 68 72 65 73 68 6f 6c 64 28 29 3b 6c 65 74 20 Threshold();let
00000f90: 6f 3d 72 2c 69 3d 6e 75 6c 6c 3b 66 6f 72 28 63 o=r,i=null;for(c
00000fa0: 6f 6e 73 74 20 72 20 6f 66 20 74 68 69 73 2e 69 onst r of this.i
00000fb0: 74 65 72 61 74 65 53 6e 61 70 50 6f 69 6e 74 73 terateSnapPoints
00000fc0: 49 6e 50 61 67 65 53 70 61 63 65 28 65 2c 74 29 InPageSpace(e,t)
00000fd0: 29 73 75 2e 44 69 73 74 4d 69 6e 28 6e 2c 72 2c )su.DistMin(n,r,
00000fe0: 6f 29 26 26 28 6f 3d 73 75 2e 44 69 73 74 28 6e o)&&(o=su.Dist(n
00000ff0: 2c 72 29 2c 69 3d 72 29 3b 69 66 28 69 29 72 65 ,r),i=r);if(i)re
00001000: 74 75 72 6e 20 69 3b 6c 65 74 20 61 3d 72 2c 73 turn i;let a=r,s
00001010: 3d 6e 75 6c 6c 3b 66 6f 72 28 63 6f 6e 73 74 7b =null;for(const{
00001020: 73 68 61 70 65 49 64 3a 72 2c 6f 75 74 6c 69 6e shapeId:r,outlin
00001030: 65 3a 6f 7d 6f 66 20 74 68 69 73 2e 69 74 65 72 e:o}of this.iter
00001040: 61 74 65 53 6e 61 70 4f 75 74 6c 69 6e 65 73 28 ateSnapOutlines(
00001050: 65 2c 74 29 29 7b 63 6f 6e 73 74 20 65 3d 4b 72 e,t)){const e=Kr
00001060: 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 (this.editor.get
00001070: 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f ShapePageTransfo
00001080: 72 6d 28 72 29 29 2c 74 3d 74 68 69 73 2e 65 64 rm(r)),t=this.ed
00001090: 69 74 6f 72 2e 67 65 74 50 6f 69 6e 74 49 6e 53 itor.getPointInS
000010a0: 68 61 70 65 53 70 61 63 65 28 72 2c 6e 29 2c 69 hapeSpace(r,n),i
000010b0: 3d 6f 2e 6e 65 61 72 65 73 74 50 6f 69 6e 74 28 =o.nearestPoint(
000010c0: 74 29 2c 6c 3d 65 2e 61 70 70 6c 79 54 6f 50 6f t),l=e.applyToPo
000010d0: 69 6e 74 28 69 29 3b 73 75 2e 44 69 73 74 4d 69 int(i);su.DistMi
000010e0: 6e 28 6e 2c 6c 2c 61 29 26 26 28 61 3d 73 75 2e n(n,l,a)&&(a=su.
000010f0: 44 69 73 74 28 6e 2c 6c 29 2c 73 3d 6c 29 7d 72 Dist(n,l),s=l)}r
00001100: 65 74 75 72 6e 20 73 7c 7c 6e 75 6c 6c 7d 73 6e eturn s||null}sn
00001110: 61 70 48 61 6e 64 6c 65 28 7b 63 75 72 72 65 6e apHandle({curren
00001120: 74 53 68 61 70 65 49 64 3a 65 2c 68 61 6e 64 6c tShapeId:e,handl
00001130: 65 3a 74 7d 29 7b 63 6f 6e 73 74 20 6e 3d 4b 72 e:t}){const n=Kr
00001140: 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 (this.editor.get
00001150: 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f ShapePageTransfo
00001160: 72 6d 28 65 29 29 2e 61 70 70 6c 79 54 6f 50 6f rm(e)).applyToPo
00001170: 69 6e 74 28 74 29 2c 72 3d 74 68 69 73 2e 67 65 int(t),r=this.ge
00001180: 74 48 61 6e 64 6c 65 53 6e 61 70 50 6f 73 69 74 tHandleSnapPosit
00001190: 69 6f 6e 28 7b 63 75 72 72 65 6e 74 53 68 61 70 ion({currentShap
000011a0: 65 49 64 3a 65 2c 68 61 6e 64 6c 65 3a 74 2c 68 eId:e,handle:t,h
000011b0: 61 6e 64 6c 65 49 6e 50 61 67 65 53 70 61 63 65 andleInPageSpace
000011c0: 3a 6e 7d 29 3b 72 65 74 75 72 6e 20 72 3f 28 74 :n});return r?(t
000011d0: 68 69 73 2e 6d 61 6e 61 67 65 72 2e 73 65 74 49 his.manager.setI
000011e0: 6e 64 69 63 61 74 6f 72 73 28 5b 7b 69 64 3a 46 ndicators([{id:F
000011f0: 66 28 29 2c 74 79 70 65 3a 22 70 6f 69 6e 74 73 f(),type:"points
00001200: 22 2c 70 6f 69 6e 74 73 3a 5b 72 5d 7d 5d 29 2c ",points:[r]}]),
00001210: 7b 6e 75 64 67 65 3a 73 75 2e 53 75 62 28 72 2c {nudge:su.Sub(r,
00001220: 6e 29 7d 29 3a 6e 75 6c 6c 7d 7d 28 28 65 2c 74 n)}):null}}((e,t
00001230: 2c 6e 2c 72 29 3d 3e 7b 66 6f 72 28 76 61 72 20 ,n,r)=>{for(var
00001240: 6f 2c 69 3d 72 3e 31 3f 76 6f 69 64 20 30 3a 72 o,i=r>1?void 0:r
00001250: 3f 66 6d 28 74 2c 6e 29 3a 74 2c 61 3d 65 2e 6c ?fm(t,n):t,a=e.l
00001260: 65 6e 67 74 68 2d 31 3b 61 3e 3d 30 3b 61 2d 2d ength-1;a>=0;a--
00001270: 29 28 6f 3d 65 5b 61 5d 29 26 26 28 69 3d 28 72 )(o=e[a])&&(i=(r
00001280: 3f 6f 28 74 2c 6e 2c 69 29 3a 6f 28 69 29 29 7c ?o(t,n,i):o(i))|
00001290: 7c 69 29 3b 72 26 26 69 26 26 70 6d 28 74 2c 6e |i);r&&i&&pm(t,n
000012a0: 2c 69 29 7d 29 28 5b 6f 61 5d 2c 67 6d 2e 70 72 ,i)})([oa],gm.pr
000012b0: 6f 74 6f 74 79 70 65 2c 22 67 65 74 53 6e 61 70 ototype,"getSnap
000012c0: 47 65 6f 6d 65 74 72 79 43 61 63 68 65 22 2c 31 GeometryCache",1
000012d0: 29 3b 76 61 72 20 62 6d 3d 4f 62 6a 65 63 74 2e );var bm=Object.
000012e0: 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 2c 79 defineProperty,y
000012f0: 6d 3d 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 m=Object.getOwnP
00001300: 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f ropertyDescripto
00001310: 72 2c 76 6d 3d 28 65 2c 74 2c 6e 2c 72 29 3d 3e r,vm=(e,t,n,r)=>
00001320: 7b 66 6f 72 28 76 61 72 20 6f 2c 69 3d 72 3e 31 {for(var o,i=r>1
00001330: 3f 76 6f 69 64 20 30 3a 72 3f 79 6d 28 74 2c 6e ?void 0:r?ym(t,n
00001340: 29 3a 74 2c 61 3d 65 2e 6c 65 6e 67 74 68 2d 31 ):t,a=e.length-1
00001350: 3b 61 3e 3d 30 3b 61 2d 2d 29 28 6f 3d 65 5b 61 ;a>=0;a--)(o=e[a
00001360: 5d 29 26 26 28 69 3d 28 72 3f 6f 28 74 2c 6e 2c ])&&(i=(r?o(t,n,
00001370: 69 29 3a 6f 28 69 29 29 7c 7c 69 29 3b 72 65 74 i):o(i))||i);ret
00001380: 75 72 6e 20 72 26 26 69 26 26 62 6d 28 74 2c 6e urn r&&i&&bm(t,n
00001390: 2c 69 29 2c 69 7d 3b 63 6c 61 73 73 20 53 6d 7b ,i),i};class Sm{
000013a0: 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 29 7b 74 constructor(e){t
000013b0: 68 69 73 2e 65 64 69 74 6f 72 3d 65 2c 74 68 69 his.editor=e,thi
000013c0: 73 2e 73 68 61 70 65 42 6f 75 6e 64 73 3d 6e 65 s.shapeBounds=ne
000013d0: 77 20 75 6d 28 74 68 69 73 29 2c 74 68 69 73 2e w um(this),this.
000013e0: 68 61 6e 64 6c 65 73 3d 6e 65 77 20 67 6d 28 74 handles=new gm(t
000013f0: 68 69 73 29 7d 73 68 61 70 65 42 6f 75 6e 64 73 his)}shapeBounds
00001400: 3b 68 61 6e 64 6c 65 73 3b 5f 73 6e 61 70 49 6e ;handles;_snapIn
00001410: 64 69 63 61 74 6f 72 73 3d 59 69 28 22 73 6e 61 dicators=Yi("sna
00001420: 70 4c 69 6e 65 73 22 2c 76 6f 69 64 20 30 29 3b pLines",void 0);
00001430: 67 65 74 49 6e 64 69 63 61 74 6f 72 73 28 29 7b getIndicators(){
00001440: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 6e 61 return this._sna
00001450: 70 49 6e 64 69 63 61 74 6f 72 73 2e 67 65 74 28 pIndicators.get(
00001460: 29 3f 3f 43 69 7d 63 6c 65 61 72 49 6e 64 69 63 )??Ci}clearIndic
00001470: 61 74 6f 72 73 28 29 7b 74 68 69 73 2e 67 65 74 ators(){this.get
00001480: 49 6e 64 69 63 61 74 6f 72 73 28 29 2e 6c 65 6e Indicators().len
00001490: 67 74 68 26 26 74 68 69 73 2e 5f 73 6e 61 70 49 gth&&this._snapI
000014a0: 6e 64 69 63 61 74 6f 72 73 2e 73 65 74 28 76 6f ndicators.set(vo
000014b0: 69 64 20 30 29 7d 73 65 74 49 6e 64 69 63 61 74 id 0)}setIndicat
000014c0: 6f 72 73 28 65 29 7b 74 68 69 73 2e 5f 73 6e 61 ors(e){this._sna
000014d0: 70 49 6e 64 69 63 61 74 6f 72 73 2e 73 65 74 28 pIndicators.set(
000014e0: 65 29 7d 67 65 74 53 6e 61 70 54 68 72 65 73 68 e)}getSnapThresh
000014f0: 6f 6c 64 28 29 7b 72 65 74 75 72 6e 20 38 2f 74 old(){return 8/t
00001500: 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f his.editor.getZo
00001510: 6f 6d 4c 65 76 65 6c 28 29 7d 67 65 74 53 6e 61 omLevel()}getSna
00001520: 70 70 61 62 6c 65 53 68 61 70 65 73 28 29 7b 63 ppableShapes(){c
00001530: 6f 6e 73 74 7b 65 64 69 74 6f 72 3a 65 7d 3d 74 onst{editor:e}=t
00001540: 68 69 73 2c 74 3d 65 2e 67 65 74 56 69 65 77 70 his,t=e.getViewp
00001550: 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 28 29 2c ortPageBounds(),
00001560: 6e 3d 65 2e 67 65 74 53 65 6c 65 63 74 65 64 53 n=e.getSelectedS
00001570: 68 61 70 65 49 64 73 28 29 2c 72 3d 6e 65 77 20 hapeIds(),r=new
00001580: 53 65 74 2c 6f 3d 69 3d 3e 7b 69 66 28 41 73 28 Set,o=i=>{if(As(
00001590: 69 29 29 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 65 i)){const t=e.ge
000015a0: 74 53 68 61 70 65 28 69 29 3b 74 26 26 65 2e 69 tShape(i);t&&e.i
000015b0: 73 53 68 61 70 65 4f 66 54 79 70 65 28 74 2c 22 sShapeOfType(t,"
000015c0: 66 72 61 6d 65 22 29 26 26 72 2e 61 64 64 28 69 frame")&&r.add(i
000015d0: 29 7d 63 6f 6e 73 74 20 61 3d 65 2e 67 65 74 53 )}const a=e.getS
000015e0: 6f 72 74 65 64 43 68 69 6c 64 49 64 73 46 6f 72 ortedChildIdsFor
000015f0: 50 61 72 65 6e 74 28 69 29 3b 66 6f 72 28 63 6f Parent(i);for(co
00001600: 6e 73 74 20 69 20 6f 66 20 61 29 7b 69 66 28 6e nst i of a){if(n
00001610: 2e 69 6e 63 6c 75 64 65 73 28 69 29 29 63 6f 6e .includes(i))con
00001620: 74 69 6e 75 65 3b 63 6f 6e 73 74 20 61 3d 65 2e tinue;const a=e.
00001630: 67 65 74 53 68 61 70 65 28 69 29 3b 69 66 28 21 getShape(i);if(!
00001640: 61 29 63 6f 6e 74 69 6e 75 65 3b 69 66 28 21 65 a)continue;if(!e
00001650: 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 61 29 .getShapeUtil(a)
00001660: 2e 63 61 6e 53 6e 61 70 28 61 29 29 63 6f 6e 74 .canSnap(a))cont
00001670: 69 6e 75 65 3b 63 6f 6e 73 74 20 73 3d 65 2e 67 inue;const s=e.g
00001680: 65 74 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 etShapePageBound
00001690: 73 28 69 29 3b 73 26 26 74 2e 69 6e 63 6c 75 64 s(i);s&&t.includ
000016a0: 65 73 28 73 29 26 26 28 65 2e 69 73 53 68 61 70 es(s)&&(e.isShap
000016b0: 65 4f 66 54 79 70 65 28 61 2c 22 67 72 6f 75 70 eOfType(a,"group
000016c0: 22 29 3f 6f 28 69 29 3a 72 2e 61 64 64 28 69 29 ")?o(i):r.add(i)
000016d0: 29 7d 7d 3b 72 65 74 75 72 6e 20 6f 28 74 68 69 )}};return o(thi
000016e0: 73 2e 67 65 74 43 75 72 72 65 6e 74 43 6f 6d 6d s.getCurrentComm
000016f0: 6f 6e 41 6e 63 65 73 74 6f 72 28 29 3f 3f 65 2e onAncestor()??e.
00001700: 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 49 64 getCurrentPageId
00001710: 28 29 29 2c 72 7d 67 65 74 43 75 72 72 65 6e 74 ()),r}getCurrent
00001720: 43 6f 6d 6d 6f 6e 41 6e 63 65 73 74 6f 72 28 29 CommonAncestor()
00001730: 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 65 64 69 {return this.edi
00001740: 74 6f 72 2e 66 69 6e 64 43 6f 6d 6d 6f 6e 41 6e tor.findCommonAn
00001750: 63 65 73 74 6f 72 28 74 68 69 73 2e 65 64 69 74 cestor(this.edit
00001760: 6f 72 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 or.getSelectedSh
00001770: 61 70 65 73 28 29 29 7d 7d 76 6d 28 5b 6f 61 5d apes())}}vm([oa]
00001780: 2c 53 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Sm.prototype,"g
00001790: 65 74 53 6e 61 70 54 68 72 65 73 68 6f 6c 64 22 etSnapThreshold"
000017a0: 2c 31 29 2c 76 6d 28 5b 6f 61 5d 2c 53 6d 2e 70 ,1),vm([oa],Sm.p
000017b0: 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 53 6e 61 rototype,"getSna
000017c0: 70 70 61 62 6c 65 53 68 61 70 65 73 22 2c 31 29 ppableShapes",1)
000017d0: 2c 76 6d 28 5b 6f 61 5d 2c 53 6d 2e 70 72 6f 74 ,vm([oa],Sm.prot
000017e0: 6f 74 79 70 65 2c 22 67 65 74 43 75 72 72 65 6e otype,"getCurren
000017f0: 74 43 6f 6d 6d 6f 6e 41 6e 63 65 73 74 6f 72 22 tCommonAncestor"
00001800: 2c 31 29 3b 63 6f 6e 73 74 20 5f 6d 3d 2f 5c 72 ,1);const _m=/\r
00001810: 3f 5c 6e 7c 5c 72 2f 67 3b 66 75 6e 63 74 69 6f ?\n|\r/g;functio
00001820: 6e 20 45 6d 28 65 29 7b 72 65 74 75 72 6e 20 65 n Em(e){return e
00001830: 2e 72 65 70 6c 61 63 65 28 5f 6d 2c 22 5c 6e 22 .replace(_m,"\n"
00001840: 29 2e 73 70 6c 69 74 28 22 5c 6e 22 29 2e 6d 61 ).split("\n").ma
00001850: 70 28 28 65 3d 3e 65 7c 7c 22 20 22 29 29 2e 6a p((e=>e||" ")).j
00001860: 6f 69 6e 28 22 5c 6e 22 29 7d 63 6f 6e 73 74 20 oin("\n")}const
00001870: 77 6d 3d 7b 73 74 61 72 74 3a 22 6c 65 66 74 22 wm={start:"left"
00001880: 2c 22 73 74 61 72 74 2d 6c 65 67 61 63 79 22 3a ,"start-legacy":
00001890: 22 6c 65 66 74 22 2c 6d 69 64 64 6c 65 3a 22 63 "left",middle:"c
000018a0: 65 6e 74 65 72 22 2c 22 6d 69 64 64 6c 65 2d 6c enter","middle-l
000018b0: 65 67 61 63 79 22 3a 22 63 65 6e 74 65 72 22 2c egacy":"center",
000018c0: 65 6e 64 3a 22 72 69 67 68 74 22 2c 22 65 6e 64 end:"right","end
000018d0: 2d 6c 65 67 61 63 79 22 3a 22 72 69 67 68 74 22 -legacy":"right"
000018e0: 7d 2c 78 6d 3d 2f 5c 73 2f 3b 63 6c 61 73 73 20 },xm=/\s/;class
000018f0: 54 6d 7b 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 Tm{constructor(e
00001900: 29 7b 74 68 69 73 2e 65 64 69 74 6f 72 3d 65 3b ){this.editor=e;
00001910: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 64 69 const t=this.edi
00001920: 74 6f 72 2e 67 65 74 43 6f 6e 74 61 69 6e 65 72 tor.getContainer
00001930: 28 29 2c 6e 3d 64 6f 63 75 6d 65 6e 74 2e 63 72 (),n=document.cr
00001940: 65 61 74 65 45 6c 65 6d 65 6e 74 28 22 64 69 76 eateElement("div
00001950: 22 29 3b 6e 2e 63 6c 61 73 73 4c 69 73 74 2e 61 ");n.classList.a
00001960: 64 64 28 22 74 6c 2d 74 65 78 74 22 29 2c 6e 2e dd("tl-text"),n.
00001970: 63 6c 61 73 73 4c 69 73 74 2e 61 64 64 28 22 74 classList.add("t
00001980: 6c 2d 74 65 78 74 2d 6d 65 61 73 75 72 65 22 29 l-text-measure")
00001990: 2c 6e 2e 74 61 62 49 6e 64 65 78 3d 2d 31 2c 74 ,n.tabIndex=-1,t
000019a0: 2e 61 70 70 65 6e 64 43 68 69 6c 64 28 6e 29 2c .appendChild(n),
000019b0: 74 68 69 73 2e 62 61 73 65 45 6c 6d 3d 6e 2c 65 this.baseElm=n,e
000019c0: 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e 61 64 64 .disposables.add
000019d0: 28 28 28 29 3d 3e 7b 6e 2e 72 65 6d 6f 76 65 28 ((()=>{n.remove(
000019e0: 29 7d 29 29 7d 62 61 73 65 45 6c 6d 3b 6d 65 61 )}))}baseElm;mea
000019f0: 73 75 72 65 54 65 78 74 3d 28 65 2c 74 29 3d 3e sureText=(e,t)=>
00001a00: 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 62 61 {const n=this.ba
00001a10: 73 65 45 6c 6d 3f 2e 63 6c 6f 6e 65 4e 6f 64 65 seElm?.cloneNode
00001a20: 28 29 3b 74 68 69 73 2e 62 61 73 65 45 6c 6d 2e ();this.baseElm.
00001a30: 69 6e 73 65 72 74 41 64 6a 61 63 65 6e 74 45 6c insertAdjacentEl
00001a40: 65 6d 65 6e 74 28 22 61 66 74 65 72 65 6e 64 22 ement("afterend"
00001a50: 2c 6e 29 2c 6e 2e 73 65 74 41 74 74 72 69 62 75 ,n),n.setAttribu
00001a60: 74 65 28 22 64 69 72 22 2c 22 61 75 74 6f 22 29 te("dir","auto")
00001a70: 2c 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 ,n.style.setProp
00001a80: 65 72 74 79 28 22 75 6e 69 63 6f 64 65 2d 62 69 erty("unicode-bi
00001a90: 64 69 22 2c 22 70 6c 61 69 6e 74 65 78 74 22 29 di","plaintext")
00001aa0: 2c 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 ,n.style.setProp
00001ab0: 65 72 74 79 28 22 66 6f 6e 74 2d 66 61 6d 69 6c erty("font-famil
00001ac0: 79 22 2c 74 2e 66 6f 6e 74 46 61 6d 69 6c 79 29 y",t.fontFamily)
00001ad0: 2c 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 ,n.style.setProp
00001ae0: 65 72 74 79 28 22 66 6f 6e 74 2d 73 74 79 6c 65 erty("font-style
00001af0: 22 2c 74 2e 66 6f 6e 74 53 74 79 6c 65 29 2c 6e ",t.fontStyle),n
00001b00: 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 .style.setProper
00001b10: 74 79 28 22 66 6f 6e 74 2d 77 65 69 67 68 74 22 ty("font-weight"
00001b20: 2c 74 2e 66 6f 6e 74 57 65 69 67 68 74 29 2c 6e ,t.fontWeight),n
00001b30: 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 .style.setProper
00001b40: 74 79 28 22 66 6f 6e 74 2d 73 69 7a 65 22 2c 74 ty("font-size",t
00001b50: 2e 66 6f 6e 74 53 69 7a 65 2b 22 70 78 22 29 2c .fontSize+"px"),
00001b60: 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 n.style.setPrope
00001b70: 72 74 79 28 22 6c 69 6e 65 2d 68 65 69 67 68 74 rty("line-height
00001b80: 22 2c 74 2e 6c 69 6e 65 48 65 69 67 68 74 2a 74 ",t.lineHeight*t
00001b90: 2e 66 6f 6e 74 53 69 7a 65 2b 22 70 78 22 29 2c .fontSize+"px"),
00001ba0: 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 n.style.setPrope
00001bb0: 72 74 79 28 22 6d 61 78 2d 77 69 64 74 68 22 2c rty("max-width",
00001bc0: 6e 75 6c 6c 3d 3d 3d 74 2e 6d 61 78 57 69 64 74 null===t.maxWidt
00001bd0: 68 3f 6e 75 6c 6c 3a 74 2e 6d 61 78 57 69 64 74 h?null:t.maxWidt
00001be0: 68 2b 22 70 78 22 29 2c 6e 2e 73 74 79 6c 65 2e h+"px"),n.style.
00001bf0: 73 65 74 50 72 6f 70 65 72 74 79 28 22 6d 69 6e setProperty("min
00001c00: 2d 77 69 64 74 68 22 2c 6e 75 6c 6c 3d 3d 3d 74 -width",null===t
00001c10: 2e 6d 69 6e 57 69 64 74 68 3f 6e 75 6c 6c 3a 74 .minWidth?null:t
00001c20: 2e 6d 69 6e 57 69 64 74 68 2b 22 70 78 22 29 2c .minWidth+"px"),
00001c30: 6e 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 n.style.setPrope
00001c40: 72 74 79 28 22 70 61 64 64 69 6e 67 22 2c 74 2e rty("padding",t.
00001c50: 70 61 64 64 69 6e 67 29 2c 6e 2e 73 74 79 6c 65 padding),n.style
00001c60: 2e 73 65 74 50 72 6f 70 65 72 74 79 28 22 6f 76 .setProperty("ov
00001c70: 65 72 66 6c 6f 77 2d 77 72 61 70 22 2c 74 2e 64 erflow-wrap",t.d
00001c80: 69 73 61 62 6c 65 4f 76 65 72 66 6c 6f 77 57 72 isableOverflowWr
00001c90: 61 70 42 72 65 61 6b 69 6e 67 3f 22 6e 6f 72 6d apBreaking?"norm
00001ca0: 61 6c 22 3a 22 62 72 65 61 6b 2d 77 6f 72 64 22 al":"break-word"
00001cb0: 29 2c 6e 2e 74 65 78 74 43 6f 6e 74 65 6e 74 3d ),n.textContent=
00001cc0: 45 6d 28 65 29 3b 63 6f 6e 73 74 20 72 3d 6e 2e Em(e);const r=n.
00001cd0: 73 63 72 6f 6c 6c 57 69 64 74 68 2c 6f 3d 6e 2e scrollWidth,o=n.
00001ce0: 67 65 74 42 6f 75 6e 64 69 6e 67 43 6c 69 65 6e getBoundingClien
00001cf0: 74 52 65 63 74 28 29 3b 72 65 74 75 72 6e 20 6e tRect();return n
00001d00: 2e 72 65 6d 6f 76 65 28 29 2c 7b 78 3a 30 2c 79 .remove(),{x:0,y
00001d10: 3a 30 2c 77 3a 6f 2e 77 69 64 74 68 2c 68 3a 6f :0,w:o.width,h:o
00001d20: 2e 68 65 69 67 68 74 2c 73 63 72 6f 6c 6c 57 69 .height,scrollWi
00001d30: 64 74 68 3a 72 7d 7d 3b 6d 65 61 73 75 72 65 45 dth:r}};measureE
00001d40: 6c 65 6d 65 6e 74 54 65 78 74 4e 6f 64 65 53 70 lementTextNodeSp
00001d50: 61 6e 73 28 65 2c 7b 73 68 6f 75 6c 64 54 72 75 ans(e,{shouldTru
00001d60: 6e 63 61 74 65 54 6f 46 69 72 73 74 4c 69 6e 65 ncateToFirstLine
00001d70: 3a 74 3d 21 31 7d 3d 7b 7d 29 7b 63 6f 6e 73 74 :t=!1}={}){const
00001d80: 20 6e 3d 5b 5d 2c 72 3d 65 2e 67 65 74 42 6f 75 n=[],r=e.getBou
00001d90: 6e 64 69 6e 67 43 6c 69 65 6e 74 52 65 63 74 28 ndingClientRect(
00001da0: 29 2c 6f 3d 2d 72 2e 6c 65 66 74 2c 69 3d 2d 72 ),o=-r.left,i=-r
00001db0: 2e 74 6f 70 2c 61 3d 6e 65 77 20 52 61 6e 67 65 .top,a=new Range
00001dc0: 2c 73 3d 65 2e 63 68 69 6c 64 4e 6f 64 65 73 5b ,s=e.childNodes[
00001dd0: 30 5d 3b 6c 65 74 20 6c 3d 30 2c 63 3d 6e 75 6c 0];let l=0,c=nul
00001de0: 6c 2c 75 3d 6e 75 6c 6c 2c 64 3d 30 2c 70 3d 30 l,u=null,d=0,p=0
00001df0: 2c 66 3d 21 31 3b 66 6f 72 28 63 6f 6e 73 74 20 ,f=!1;for(const
00001e00: 72 20 6f 66 20 65 2e 63 68 69 6c 64 4e 6f 64 65 r of e.childNode
00001e10: 73 29 69 66 28 72 2e 6e 6f 64 65 54 79 70 65 3d s)if(r.nodeType=
00001e20: 3d 3d 4e 6f 64 65 2e 54 45 58 54 5f 4e 4f 44 45 ==Node.TEXT_NODE
00001e30: 29 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 )for(const e of
00001e40: 72 2e 74 65 78 74 43 6f 6e 74 65 6e 74 3f 3f 22 r.textContent??"
00001e50: 22 29 7b 61 2e 73 65 74 53 74 61 72 74 28 73 2c "){a.setStart(s,
00001e60: 6c 29 2c 61 2e 73 65 74 45 6e 64 28 73 2c 6c 2b l),a.setEnd(s,l+
00001e70: 65 2e 6c 65 6e 67 74 68 29 3b 63 6f 6e 73 74 20 e.length);const
00001e80: 72 3d 61 2e 67 65 74 43 6c 69 65 6e 74 52 65 63 r=a.getClientRec
00001e90: 74 73 28 29 2c 68 3d 72 5b 72 2e 6c 65 6e 67 74 ts(),h=r[r.lengt
00001ea0: 68 2d 31 5d 2c 6d 3d 68 2e 74 6f 70 2b 69 2c 67 h-1],m=h.top+i,g
00001eb0: 3d 68 2e 6c 65 66 74 2b 6f 2c 62 3d 68 2e 72 69 =h.left+o,b=h.ri
00001ec0: 67 68 74 2b 6f 2c 79 3d 67 3c 70 2c 76 3d 78 6d ght+o,y=g<p,v=xm
00001ed0: 2e 74 65 73 74 28 65 29 3b 69 66 28 76 3d 3d 3d .test(e);if(v===
00001ee0: 75 26 26 6d 3d 3d 3d 64 26 26 63 29 79 26 26 28 u&&m===d&&c)y&&(
00001ef0: 63 2e 62 6f 78 2e 78 3d 67 29 2c 63 2e 62 6f 78 c.box.x=g),c.box
00001f00: 2e 77 3d 79 3f 63 2e 62 6f 78 2e 77 2b 68 2e 77 .w=y?c.box.w+h.w
00001f10: 69 64 74 68 3a 62 2d 63 2e 62 6f 78 2e 78 2c 63 idth:b-c.box.x,c
00001f20: 2e 74 65 78 74 2b 3d 65 3b 65 6c 73 65 7b 69 66 .text+=e;else{if
00001f30: 28 63 29 7b 69 66 28 74 26 26 6d 21 3d 3d 64 29 (c){if(t&&m!==d)
00001f40: 7b 66 3d 21 30 3b 62 72 65 61 6b 7d 6e 2e 70 75 {f=!0;break}n.pu
00001f50: 73 68 28 63 29 7d 63 3d 7b 62 6f 78 3a 7b 78 3a sh(c)}c={box:{x:
00001f60: 67 2c 79 3a 6d 2c 77 3a 68 2e 77 69 64 74 68 2c g,y:m,w:h.width,
00001f70: 68 3a 68 2e 68 65 69 67 68 74 7d 2c 74 65 78 74 h:h.height},text
00001f80: 3a 65 7d 2c 70 3d 67 7d 22 5c 6e 22 3d 3d 3d 65 :e},p=g}"\n"===e
00001f90: 26 26 28 70 3d 30 29 2c 75 3d 76 2c 64 3d 6d 2c &&(p=0),u=v,d=m,
00001fa0: 6c 2b 3d 65 2e 6c 65 6e 67 74 68 7d 72 65 74 75 l+=e.length}retu
00001fb0: 72 6e 20 63 26 26 6e 2e 70 75 73 68 28 63 29 2c rn c&&n.push(c),
00001fc0: 7b 73 70 61 6e 73 3a 6e 2c 64 69 64 54 72 75 6e {spans:n,didTrun
00001fd0: 63 61 74 65 3a 66 7d 7d 6d 65 61 73 75 72 65 54 cate:f}}measureT
00001fe0: 65 78 74 53 70 61 6e 73 28 65 2c 74 29 7b 69 66 extSpans(e,t){if
00001ff0: 28 22 22 3d 3d 3d 65 29 72 65 74 75 72 6e 5b 5d (""===e)return[]
00002000: 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 62 61 ;const n=this.ba
00002010: 73 65 45 6c 6d 3f 2e 63 6c 6f 6e 65 4e 6f 64 65 seElm?.cloneNode
00002020: 28 29 3b 74 68 69 73 2e 62 61 73 65 45 6c 6d 2e ();this.baseElm.
00002030: 69 6e 73 65 72 74 41 64 6a 61 63 65 6e 74 45 6c insertAdjacentEl
00002040: 65 6d 65 6e 74 28 22 61 66 74 65 72 65 6e 64 22 ement("afterend"
00002050: 2c 6e 29 3b 63 6f 6e 73 74 20 72 3d 4d 61 74 68 ,n);const r=Math
00002060: 2e 63 65 69 6c 28 74 2e 77 69 64 74 68 2d 32 2a .ceil(t.width-2*
00002070: 74 2e 70 61 64 64 69 6e 67 29 3b 6e 2e 73 65 74 t.padding);n.set
00002080: 41 74 74 72 69 62 75 74 65 28 22 64 69 72 22 2c Attribute("dir",
00002090: 22 61 75 74 6f 22 29 2c 6e 2e 73 74 79 6c 65 2e "auto"),n.style.
000020a0: 73 65 74 50 72 6f 70 65 72 74 79 28 22 75 6e 69 setProperty("uni
000020b0: 63 6f 64 65 2d 62 69 64 69 22 2c 22 70 6c 61 69 code-bidi","plai
000020c0: 6e 74 65 78 74 22 29 2c 6e 2e 73 74 79 6c 65 2e ntext"),n.style.
000020d0: 73 65 74 50 72 6f 70 65 72 74 79 28 22 77 69 64 setProperty("wid
000020e0: 74 68 22 2c 60 24 7b 72 7d 70 78 60 29 2c 6e 2e th",`${r}px`),n.
000020f0: 73 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 style.setPropert
00002100: 79 28 22 68 65 69 67 68 74 22 2c 22 6d 69 6e 2d y("height","min-
00002110: 63 6f 6e 74 65 6e 74 22 29 2c 6e 2e 73 74 79 6c content"),n.styl
00002120: 65 2e 73 65 74 50 72 6f 70 65 72 74 79 28 22 66 e.setProperty("f
00002130: 6f 6e 74 2d 73 69 7a 65 22 2c 60 24 7b 74 2e 66 ont-size",`${t.f
00002140: 6f 6e 74 53 69 7a 65 7d 70 78 60 29 2c 6e 2e 73 ontSize}px`),n.s
00002150: 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 79 tyle.setProperty
00002160: 28 22 66 6f 6e 74 2d 66 61 6d 69 6c 79 22 2c 74 ("font-family",t
00002170: 2e 66 6f 6e 74 46 61 6d 69 6c 79 29 2c 6e 2e 73 .fontFamily),n.s
00002180: 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 79 tyle.setProperty
00002190: 28 22 66 6f 6e 74 2d 77 65 69 67 68 74 22 2c 74 ("font-weight",t
000021a0: 2e 66 6f 6e 74 57 65 69 67 68 74 29 2c 6e 2e 73 .fontWeight),n.s
000021b0: 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 79 tyle.setProperty
000021c0: 28 22 6c 69 6e 65 2d 68 65 69 67 68 74 22 2c 74 ("line-height",t
000021d0: 2e 6c 69 6e 65 48 65 69 67 68 74 2a 74 2e 66 6f .lineHeight*t.fo
000021e0: 6e 74 53 69 7a 65 2b 22 70 78 22 29 2c 6e 2e 73 ntSize+"px"),n.s
000021f0: 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 79 tyle.setProperty
00002200: 28 22 74 65 78 74 2d 61 6c 69 67 6e 22 2c 77 6d ("text-align",wm
00002210: 5b 74 2e 74 65 78 74 41 6c 69 67 6e 5d 29 3b 63 [t.textAlign]);c
00002220: 6f 6e 73 74 20 6f 3d 22 74 72 75 6e 63 61 74 65 onst o="truncate
00002230: 2d 65 6c 6c 69 70 73 69 73 22 3d 3d 3d 74 2e 6f -ellipsis"===t.o
00002240: 76 65 72 66 6c 6f 77 7c 7c 22 74 72 75 6e 63 61 verflow||"trunca
00002250: 74 65 2d 63 6c 69 70 22 3d 3d 3d 74 2e 6f 76 65 te-clip"===t.ove
00002260: 72 66 6c 6f 77 3b 6f 26 26 28 6e 2e 73 74 79 6c rflow;o&&(n.styl
00002270: 65 2e 73 65 74 50 72 6f 70 65 72 74 79 28 22 6f e.setProperty("o
00002280: 76 65 72 66 6c 6f 77 2d 77 72 61 70 22 2c 22 61 verflow-wrap","a
00002290: 6e 79 77 68 65 72 65 22 29 2c 6e 2e 73 74 79 6c nywhere"),n.styl
000022a0: 65 2e 73 65 74 50 72 6f 70 65 72 74 79 28 22 77 e.setProperty("w
000022b0: 6f 72 64 2d 62 72 65 61 6b 22 2c 22 62 72 65 61 ord-break","brea
000022c0: 6b 2d 61 6c 6c 22 29 29 3b 63 6f 6e 73 74 20 69 k-all"));const i
000022d0: 3d 45 6d 28 65 29 3b 6e 2e 74 65 78 74 43 6f 6e =Em(e);n.textCon
000022e0: 74 65 6e 74 3d 69 3b 63 6f 6e 73 74 7b 73 70 61 tent=i;const{spa
000022f0: 6e 73 3a 61 2c 64 69 64 54 72 75 6e 63 61 74 65 ns:a,didTruncate
00002300: 3a 73 7d 3d 74 68 69 73 2e 6d 65 61 73 75 72 65 :s}=this.measure
00002310: 45 6c 65 6d 65 6e 74 54 65 78 74 4e 6f 64 65 53 ElementTextNodeS
00002320: 70 61 6e 73 28 6e 2c 7b 73 68 6f 75 6c 64 54 72 pans(n,{shouldTr
00002330: 75 6e 63 61 74 65 54 6f 46 69 72 73 74 4c 69 6e uncateToFirstLin
00002340: 65 3a 6f 7d 29 3b 69 66 28 22 74 72 75 6e 63 61 e:o});if("trunca
00002350: 74 65 2d 65 6c 6c 69 70 73 69 73 22 3d 3d 3d 74 te-ellipsis"===t
00002360: 2e 6f 76 65 72 66 6c 6f 77 26 26 73 29 7b 6e 2e .overflow&&s){n.
00002370: 74 65 78 74 43 6f 6e 74 65 6e 74 3d 22 e2 80 a6 textContent="...
00002380: 22 3b 63 6f 6e 73 74 20 65 3d 4d 61 74 68 2e 63 ";const e=Math.c
00002390: 65 69 6c 28 74 68 69 73 2e 6d 65 61 73 75 72 65 eil(this.measure
000023a0: 45 6c 65 6d 65 6e 74 54 65 78 74 4e 6f 64 65 53 ElementTextNodeS
000023b0: 70 61 6e 73 28 6e 29 2e 73 70 61 6e 73 5b 30 5d pans(n).spans[0]
000023c0: 2e 62 6f 78 2e 77 29 3b 6e 2e 73 74 79 6c 65 2e .box.w);n.style.
000023d0: 73 65 74 50 72 6f 70 65 72 74 79 28 22 77 69 64 setProperty("wid
000023e0: 74 68 22 2c 72 2d 65 2b 22 70 78 22 29 2c 6e 2e th",r-e+"px"),n.
000023f0: 74 65 78 74 43 6f 6e 74 65 6e 74 3d 69 3b 63 6f textContent=i;co
00002400: 6e 73 74 20 6f 3d 74 68 69 73 2e 6d 65 61 73 75 nst o=this.measu
00002410: 72 65 45 6c 65 6d 65 6e 74 54 65 78 74 4e 6f 64 reElementTextNod
00002420: 65 53 70 61 6e 73 28 6e 2c 7b 73 68 6f 75 6c 64 eSpans(n,{should
00002430: 54 72 75 6e 63 61 74 65 54 6f 46 69 72 73 74 4c TruncateToFirstL
00002440: 69 6e 65 3a 21 30 7d 29 2e 73 70 61 6e 73 2c 61 ine:!0}).spans,a
00002450: 3d 6f 5b 6f 2e 6c 65 6e 67 74 68 2d 31 5d 3b 72 =o[o.length-1];r
00002460: 65 74 75 72 6e 20 6f 2e 70 75 73 68 28 7b 74 65 eturn o.push({te
00002470: 78 74 3a 22 e2 80 a6 22 2c 62 6f 78 3a 7b 78 3a xt:"...",box:{x:
00002480: 4d 61 74 68 2e 6d 69 6e 28 61 2e 62 6f 78 2e 78 Math.min(a.box.x
00002490: 2b 61 2e 62 6f 78 2e 77 2c 74 2e 77 69 64 74 68 +a.box.w,t.width
000024a0: 2d 74 2e 70 61 64 64 69 6e 67 2d 65 29 2c 79 3a -t.padding-e),y:
000024b0: 61 2e 62 6f 78 2e 79 2c 77 3a 65 2c 68 3a 61 2e a.box.y,w:e,h:a.
000024c0: 62 6f 78 2e 68 7d 7d 29 2c 6f 7d 72 65 74 75 72 box.h}}),o}retur
000024d0: 6e 20 6e 2e 72 65 6d 6f 76 65 28 29 2c 61 7d 7d n n.remove(),a}}
000024e0: 6e 28 33 34 31 35 35 29 3b 63 6f 6e 73 74 20 43 n(34155);const C
000024f0: 6d 3d 73 69 3b 63 6c 61 73 73 20 6b 6d 7b 63 6f m=si;class km{co
00002500: 6e 73 74 72 75 63 74 6f 72 28 65 29 7b 74 68 69 nstructor(e){thi
00002510: 73 2e 65 64 69 74 6f 72 3d 65 2c 74 68 69 73 2e s.editor=e,this.
00002520: 65 64 69 74 6f 72 2e 64 69 73 70 6f 73 61 62 6c editor.disposabl
00002530: 65 73 2e 61 64 64 28 74 68 69 73 2e 64 69 73 70 es.add(this.disp
00002540: 6f 73 65 29 2c 74 68 69 73 2e 73 74 61 72 74 28 ose),this.start(
00002550: 29 7d 63 61 6e 63 65 6c 52 61 66 3b 69 73 50 61 )}cancelRaf;isPa
00002560: 75 73 65 64 3d 21 30 3b 6e 6f 77 3d 30 3b 73 74 used=!0;now=0;st
00002570: 61 72 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 69 73 art=()=>{this.is
00002580: 50 61 75 73 65 64 3d 21 31 2c 74 68 69 73 2e 63 Paused=!1,this.c
00002590: 61 6e 63 65 6c 52 61 66 3f 2e 28 29 2c 74 68 69 ancelRaf?.(),thi
000025a0: 73 2e 63 61 6e 63 65 6c 52 61 66 3d 43 6d 28 74 s.cancelRaf=Cm(t
000025b0: 68 69 73 2e 74 69 63 6b 29 2c 74 68 69 73 2e 6e his.tick),this.n
000025c0: 6f 77 3d 44 61 74 65 2e 6e 6f 77 28 29 7d 3b 74 ow=Date.now()};t
000025d0: 69 63 6b 3d 28 29 3d 3e 7b 69 66 28 74 68 69 73 ick=()=>{if(this
000025e0: 2e 69 73 50 61 75 73 65 64 29 72 65 74 75 72 6e .isPaused)return
000025f0: 3b 63 6f 6e 73 74 20 65 3d 44 61 74 65 2e 6e 6f ;const e=Date.no
00002600: 77 28 29 2c 74 3d 65 2d 74 68 69 73 2e 6e 6f 77 w(),t=e-this.now
00002610: 3b 74 68 69 73 2e 6e 6f 77 3d 65 2c 74 68 69 73 ;this.now=e,this
00002620: 2e 75 70 64 61 74 65 50 6f 69 6e 74 65 72 56 65 .updatePointerVe
00002630: 6c 6f 63 69 74 79 28 74 29 2c 74 68 69 73 2e 65 locity(t),this.e
00002640: 64 69 74 6f 72 2e 65 6d 69 74 28 22 66 72 61 6d ditor.emit("fram
00002650: 65 22 2c 74 29 2c 74 68 69 73 2e 65 64 69 74 6f e",t),this.edito
00002660: 72 2e 65 6d 69 74 28 22 74 69 63 6b 22 2c 74 29 r.emit("tick",t)
00002670: 2c 74 68 69 73 2e 63 61 6e 63 65 6c 52 61 66 3d ,this.cancelRaf=
00002680: 43 6d 28 74 68 69 73 2e 74 69 63 6b 29 7d 3b 64 Cm(this.tick)};d
00002690: 69 73 70 6f 73 65 3d 28 29 3d 3e 7b 74 68 69 73 ispose=()=>{this
000026a0: 2e 69 73 50 61 75 73 65 64 3d 21 30 2c 74 68 69 .isPaused=!0,thi
000026b0: 73 2e 63 61 6e 63 65 6c 52 61 66 3f 2e 28 29 7d s.cancelRaf?.()}
000026c0: 3b 70 72 65 76 50 6f 69 6e 74 3d 6e 65 77 20 73 ;prevPoint=new s
000026d0: 75 3b 75 70 64 61 74 65 50 6f 69 6e 74 65 72 56 u;updatePointerV
000026e0: 65 6c 6f 63 69 74 79 3d 65 3d 3e 7b 63 6f 6e 73 elocity=e=>{cons
000026f0: 74 7b 70 72 65 76 50 6f 69 6e 74 3a 74 2c 65 64 t{prevPoint:t,ed
00002700: 69 74 6f 72 3a 7b 69 6e 70 75 74 73 3a 7b 63 75 itor:{inputs:{cu
00002710: 72 72 65 6e 74 53 63 72 65 65 6e 50 6f 69 6e 74 rrentScreenPoint
00002720: 3a 6e 2c 70 6f 69 6e 74 65 72 56 65 6c 6f 63 69 :n,pointerVeloci
00002730: 74 79 3a 72 7d 7d 7d 3d 74 68 69 73 3b 69 66 28 ty:r}}}=this;if(
00002740: 30 3d 3d 3d 65 29 72 65 74 75 72 6e 3b 63 6f 6e 0===e)return;con
00002750: 73 74 20 6f 3d 73 75 2e 53 75 62 28 6e 2c 74 29 st o=su.Sub(n,t)
00002760: 3b 74 68 69 73 2e 70 72 65 76 50 6f 69 6e 74 3d ;this.prevPoint=
00002770: 6e 2e 63 6c 6f 6e 65 28 29 3b 63 6f 6e 73 74 20 n.clone();const
00002780: 69 3d 6f 2e 6c 65 6e 28 29 2c 61 3d 69 3f 6f 2e i=o.len(),a=i?o.
00002790: 64 69 76 28 69 29 3a 6e 65 77 20 73 75 28 30 2c div(i):new su(0,
000027a0: 30 29 2c 73 3d 72 2e 63 6c 6f 6e 65 28 29 2e 6c 0),s=r.clone().l
000027b0: 72 70 28 61 2e 6d 75 6c 28 69 2f 65 29 2c 2e 35 rp(a.mul(i/e),.5
000027c0: 29 3b 4d 61 74 68 2e 61 62 73 28 73 2e 78 29 3c );Math.abs(s.x)<
000027d0: 2e 30 31 26 26 28 73 2e 78 3d 30 29 2c 4d 61 74 .01&&(s.x=0),Mat
000027e0: 68 2e 61 62 73 28 73 2e 79 29 3c 2e 30 31 26 26 h.abs(s.y)<.01&&
000027f0: 28 73 2e 79 3d 30 29 2c 72 2e 65 71 75 61 6c 73 (s.y=0),r.equals
00002800: 28 73 29 7c 7c 28 74 68 69 73 2e 65 64 69 74 6f (s)||(this.edito
00002810: 72 2e 69 6e 70 75 74 73 2e 70 6f 69 6e 74 65 72 r.inputs.pointer
00002820: 56 65 6c 6f 63 69 74 79 3d 73 29 7d 7d 76 61 72 Velocity=s)}}var
00002830: 20 41 6d 3d 4f 62 6a 65 63 74 2e 64 65 66 69 6e Am=Object.defin
00002840: 65 50 72 6f 70 65 72 74 79 2c 49 6d 3d 4f 62 6a eProperty,Im=Obj
00002850: 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 ect.getOwnProper
00002860: 74 79 44 65 73 63 72 69 70 74 6f 72 2c 52 6d 3d tyDescriptor,Rm=
00002870: 28 65 2c 74 2c 6e 2c 72 29 3d 3e 7b 66 6f 72 28 (e,t,n,r)=>{for(
00002880: 76 61 72 20 6f 2c 69 3d 72 3e 31 3f 76 6f 69 64 var o,i=r>1?void
00002890: 20 30 3a 72 3f 49 6d 28 74 2c 6e 29 3a 74 2c 61 0:r?Im(t,n):t,a
000028a0: 3d 65 2e 6c 65 6e 67 74 68 2d 31 3b 61 3e 3d 30 =e.length-1;a>=0
000028b0: 3b 61 2d 2d 29 28 6f 3d 65 5b 61 5d 29 26 26 28 ;a--)(o=e[a])&&(
000028c0: 69 3d 28 72 3f 6f 28 74 2c 6e 2c 69 29 3a 6f 28 i=(r?o(t,n,i):o(
000028d0: 69 29 29 7c 7c 69 29 3b 72 65 74 75 72 6e 20 72 i))||i);return r
000028e0: 26 26 69 26 26 41 6d 28 74 2c 6e 2c 69 29 2c 69 &&i&&Am(t,n,i),i
000028f0: 7d 3b 63 6c 61 73 73 20 4f 6d 7b 63 6f 6e 73 74 };class Om{const
00002900: 72 75 63 74 6f 72 28 65 2c 74 29 7b 69 66 28 74 ructor(e,t){if(t
00002910: 68 69 73 2e 75 73 65 72 3d 65 2c 74 68 69 73 2e his.user=e,this.
00002920: 69 6e 66 65 72 44 61 72 6b 4d 6f 64 65 3d 74 2c inferDarkMode=t,
00002930: 77 69 6e 64 6f 77 29 7b 63 6f 6e 73 74 20 65 3d window){const e=
00002940: 77 69 6e 64 6f 77 2e 6d 61 74 63 68 4d 65 64 69 window.matchMedi
00002950: 61 3f 2e 28 22 28 70 72 65 66 65 72 73 2d 63 6f a?.("(prefers-co
00002960: 6c 6f 72 2d 73 63 68 65 6d 65 3a 20 64 61 72 6b lor-scheme: dark
00002970: 29 22 29 3b 65 3f 2e 6d 61 74 63 68 65 73 26 26 )");e?.matches&&
00002980: 74 68 69 73 2e 73 79 73 74 65 6d 43 6f 6c 6f 72 this.systemColor
00002990: 53 63 68 65 6d 65 2e 73 65 74 28 22 64 61 72 6b Scheme.set("dark
000029a0: 22 29 2c 65 3f 2e 61 64 64 45 76 65 6e 74 4c 69 "),e?.addEventLi
000029b0: 73 74 65 6e 65 72 28 22 63 68 61 6e 67 65 22 2c stener("change",
000029c0: 28 65 3d 3e 7b 65 2e 6d 61 74 63 68 65 73 3f 74 (e=>{e.matches?t
000029d0: 68 69 73 2e 73 79 73 74 65 6d 43 6f 6c 6f 72 53 his.systemColorS
000029e0: 63 68 65 6d 65 2e 73 65 74 28 22 64 61 72 6b 22 cheme.set("dark"
000029f0: 29 3a 74 68 69 73 2e 73 79 73 74 65 6d 43 6f 6c ):this.systemCol
00002a00: 6f 72 53 63 68 65 6d 65 2e 73 65 74 28 22 6c 69 orScheme.set("li
00002a10: 67 68 74 22 29 7d 29 29 7d 7d 73 79 73 74 65 6d ght")}))}}system
00002a20: 43 6f 6c 6f 72 53 63 68 65 6d 65 3d 59 69 28 22 ColorScheme=Yi("
00002a30: 73 79 73 74 65 6d 43 6f 6c 6f 72 53 63 68 65 6d systemColorSchem
00002a40: 65 22 2c 22 6c 69 67 68 74 22 29 3b 75 70 64 61 e","light");upda
00002a50: 74 65 55 73 65 72 50 72 65 66 65 72 65 6e 63 65 teUserPreference
00002a60: 73 3d 65 3d 3e 7b 74 68 69 73 2e 75 73 65 72 2e s=e=>{this.user.
00002a70: 73 65 74 55 73 65 72 50 72 65 66 65 72 65 6e 63 setUserPreferenc
00002a80: 65 73 28 7b 2e 2e 2e 74 68 69 73 2e 75 73 65 72 es({...this.user
00002a90: 2e 75 73 65 72 50 72 65 66 65 72 65 6e 63 65 73 .userPreferences
00002aa0: 2e 67 65 74 28 29 2c 2e 2e 2e 65 7d 29 7d 3b 67 .get(),...e})};g
00002ab0: 65 74 55 73 65 72 50 72 65 66 65 72 65 6e 63 65 etUserPreference
00002ac0: 73 28 29 7b 72 65 74 75 72 6e 7b 69 64 3a 74 68 s(){return{id:th
00002ad0: 69 73 2e 67 65 74 49 64 28 29 2c 6e 61 6d 65 3a is.getId(),name:
00002ae0: 74 68 69 73 2e 67 65 74 4e 61 6d 65 28 29 2c 6c this.getName(),l
00002af0: 6f 63 61 6c 65 3a 74 68 69 73 2e 67 65 74 4c 6f ocale:this.getLo
00002b00: 63 61 6c 65 28 29 2c 63 6f 6c 6f 72 3a 74 68 69 cale(),color:thi
00002b10: 73 2e 67 65 74 43 6f 6c 6f 72 28 29 2c 61 6e 69 s.getColor(),ani
00002b20: 6d 61 74 69 6f 6e 53 70 65 65 64 3a 74 68 69 73 mationSpeed:this
00002b30: 2e 67 65 74 41 6e 69 6d 61 74 69 6f 6e 53 70 65 .getAnimationSpe
00002b40: 65 64 28 29 2c 69 73 53 6e 61 70 4d 6f 64 65 3a ed(),isSnapMode:
00002b50: 74 68 69 73 2e 67 65 74 49 73 53 6e 61 70 4d 6f this.getIsSnapMo
00002b60: 64 65 28 29 2c 63 6f 6c 6f 72 53 63 68 65 6d 65 de(),colorScheme
00002b70: 3a 74 68 69 73 2e 75 73 65 72 2e 75 73 65 72 50 :this.user.userP
00002b80: 72 65 66 65 72 65 6e 63 65 73 2e 67 65 74 28 29 references.get()
00002b90: 2e 63 6f 6c 6f 72 53 63 68 65 6d 65 2c 69 73 44 .colorScheme,isD
00002ba0: 61 72 6b 4d 6f 64 65 3a 74 68 69 73 2e 67 65 74 arkMode:this.get
00002bb0: 49 73 44 61 72 6b 4d 6f 64 65 28 29 2c 69 73 57 IsDarkMode(),isW
00002bc0: 72 61 70 4d 6f 64 65 3a 74 68 69 73 2e 67 65 74 rapMode:this.get
00002bd0: 49 73 57 72 61 70 4d 6f 64 65 28 29 2c 69 73 44 IsWrapMode(),isD
00002be0: 79 6e 61 6d 69 63 52 65 73 69 7a 65 4d 6f 64 65 ynamicResizeMode
00002bf0: 3a 74 68 69 73 2e 67 65 74 49 73 44 79 6e 61 6d :this.getIsDynam
00002c00: 69 63 52 65 73 69 7a 65 4d 6f 64 65 28 29 7d 7d icResizeMode()}}
00002c10: 67 65 74 49 73 44 61 72 6b 4d 6f 64 65 28 29 7b getIsDarkMode(){
00002c20: 73 77 69 74 63 68 28 74 68 69 73 2e 75 73 65 72 switch(this.user
00002c30: 2e 75 73 65 72 50 72 65 66 65 72 65 6e 63 65 73 .userPreferences
00002c40: 2e 67 65 74 28 29 2e 63 6f 6c 6f 72 53 63 68 65 .get().colorSche
00002c50: 6d 65 29 7b 63 61 73 65 22 64 61 72 6b 22 3a 72 me){case"dark":r
00002c60: 65 74 75 72 6e 21 30 3b 63 61 73 65 22 6c 69 67 eturn!0;case"lig
00002c70: 68 74 22 3a 72 65 74 75 72 6e 21 31 3b 63 61 73 ht":return!1;cas
00002c80: 65 22 73 79 73 74 65 6d 22 3a 72 65 74 75 72 6e e"system":return
00002c90: 22 64 61 72 6b 22 3d 3d 3d 74 68 69 73 2e 73 79 "dark"===this.sy
00002ca0: 73 74 65 6d 43 6f 6c 6f 72 53 63 68 65 6d 65 2e stemColorScheme.
00002cb0: 67 65 74 28 29 3b 64 65 66 61 75 6c 74 3a 72 65 get();default:re
00002cc0: 74 75 72 6e 21 21 74 68 69 73 2e 69 6e 66 65 72 turn!!this.infer
00002cd0: 44 61 72 6b 4d 6f 64 65 26 26 22 64 61 72 6b 22 DarkMode&&"dark"
00002ce0: 3d 3d 3d 74 68 69 73 2e 73 79 73 74 65 6d 43 6f ===this.systemCo
00002cf0: 6c 6f 72 53 63 68 65 6d 65 2e 67 65 74 28 29 7d lorScheme.get()}
00002d00: 7d 67 65 74 45 64 67 65 53 63 72 6f 6c 6c 53 70 }getEdgeScrollSp
00002d10: 65 65 64 28 29 7b 72 65 74 75 72 6e 20 74 68 69 eed(){return thi
00002d20: 73 2e 75 73 65 72 2e 75 73 65 72 50 72 65 66 65 s.user.userPrefe
00002d30: 72 65 6e 63 65 73 2e 67 65 74 28 29 2e 65 64 67 rences.get().edg
00002d40: 65 53 63 72 6f 6c 6c 53 70 65 65 64 3f 3f 56 66 eScrollSpeed??Vf
00002d50: 2e 65 64 67 65 53 63 72 6f 6c 6c 53 70 65 65 64 .edgeScrollSpeed
00002d60: 7d 67 65 74 41 6e 69 6d 61 74 69 6f 6e 53 70 65 }getAnimationSpe
00002d70: 65 64 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 ed(){return this
00002d80: 2e 75 73 65 72 2e 75 73 65 72 50 72 65 66 65 72 .user.userPrefer
00002d90: 65 6e 63 65 73 2e 67 65 74 28 29 2e 61 6e 69 6d ences.get().anim
00002da0: 61 74 69 6f 6e 53 70 65 65 64 3f 3f 56 66 2e 61 ationSpeed??Vf.a
00002db0: 6e 69 6d 61 74 69 6f 6e 53 70 65 65 64 7d 67 65 nimationSpeed}ge
00002dc0: 74 49 64 28 29 7b 72 65 74 75 72 6e 20 74 68 69 tId(){return thi
00002dd0: 73 2e 75 73 65 72 2e 75 73 65 72 50 72 65 66 65 s.user.userPrefe
00002de0: 72 65 6e 63 65 73 2e 67 65 74 28 29 2e 69 64 7d rences.get().id}
00002df0: 67 65 74 4e 61 6d 65 28 29 7b 72 65 74 75 72 6e getName(){return
00002e00: 20 74 68 69 73 2e 75 73 65 72 2e 75 73 65 72 50 this.user.userP
00002e10: 72 65 66 65 72 65 6e 63 65 73 2e 67 65 74 28 29 references.get()
00002e20: 2e 6e 61 6d 65 3f 3f 56 66 2e 6e 61 6d 65 7d 67 .name??Vf.name}g
00002e30: 65 74 4c 6f 63 61 6c 65 28 29 7b 72 65 74 75 72 etLocale(){retur
00002e40: 6e 20 74 68 69 73 2e 75 73 65 72 2e 75 73 65 72 n this.user.user
00002e50: 50 72 65 66 65 72 65 6e 63 65 73 2e 67 65 74 28 Preferences.get(
00002e60: 29 2e 6c 6f 63 61 6c 65 3f 3f 56 66 2e 6c 6f 63 ).locale??Vf.loc
00002e70: 61 6c 65 7d 67 65 74 43 6f 6c 6f 72 28 29 7b 72 ale}getColor(){r
00002e80: 65 74 75 72 6e 20 74 68 69 73 2e 75 73 65 72 2e eturn this.user.
00002e90: 75 73 65 72 50 72 65 66 65 72 65 6e 63 65 73 2e userPreferences.
00002ea0: 67 65 74 28 29 2e 63 6f 6c 6f 72 3f 3f 56 66 2e get().color??Vf.
00002eb0: 63 6f 6c 6f 72 7d 67 65 74 49 73 53 6e 61 70 4d color}getIsSnapM
00002ec0: 6f 64 65 28 29 7b 72 65 74 75 72 6e 20 74 68 69 ode(){return thi
00002ed0: 73 2e 75 73 65 72 2e 75 73 65 72 50 72 65 66 65 s.user.userPrefe
00002ee0: 72 65 6e 63 65 73 2e 67 65 74 28 29 2e 69 73 53 rences.get().isS
00002ef0: 6e 61 70 4d 6f 64 65 3f 3f 56 66 2e 69 73 53 6e napMode??Vf.isSn
00002f00: 61 70 4d 6f 64 65 7d 67 65 74 49 73 57 72 61 70 apMode}getIsWrap
00002f10: 4d 6f 64 65 28 29 7b 72 65 74 75 72 6e 20 74 68 Mode(){return th
00002f20: 69 73 2e 75 73 65 72 2e 75 73 65 72 50 72 65 66 is.user.userPref
00002f30: 65 72 65 6e 63 65 73 2e 67 65 74 28 29 2e 69 73 erences.get().is
00002f40: 57 72 61 70 4d 6f 64 65 3f 3f 56 66 2e 69 73 57 WrapMode??Vf.isW
00002f50: 72 61 70 4d 6f 64 65 7d 67 65 74 49 73 44 79 6e rapMode}getIsDyn
00002f60: 61 6d 69 63 52 65 73 69 7a 65 4d 6f 64 65 28 29 amicResizeMode()
00002f70: 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 75 73 65 {return this.use
00002f80: 72 2e 75 73 65 72 50 72 65 66 65 72 65 6e 63 65 r.userPreference
00002f90: 73 2e 67 65 74 28 29 2e 69 73 44 79 6e 61 6d 69 s.get().isDynami
00002fa0: 63 53 69 7a 65 4d 6f 64 65 3f 3f 56 66 2e 69 73 cSizeMode??Vf.is
00002fb0: 44 79 6e 61 6d 69 63 53 69 7a 65 4d 6f 64 65 7d DynamicSizeMode}
00002fc0: 7d 52 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 }Rm([oa],Om.prot
00002fd0: 6f 74 79 70 65 2c 22 67 65 74 55 73 65 72 50 72 otype,"getUserPr
00002fe0: 65 66 65 72 65 6e 63 65 73 22 2c 31 29 2c 52 6d eferences",1),Rm
00002ff0: 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 6f 74 79 ([oa],Om.prototy
00003000: 70 65 2c 22 67 65 74 49 73 44 61 72 6b 4d 6f 64 pe,"getIsDarkMod
00003010: 65 22 2c 31 29 2c 52 6d 28 5b 6f 61 5d 2c 4f 6d e",1),Rm([oa],Om
00003020: 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 45 .prototype,"getE
00003030: 64 67 65 53 63 72 6f 6c 6c 53 70 65 65 64 22 2c dgeScrollSpeed",
00003040: 31 29 2c 52 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 1),Rm([oa],Om.pr
00003050: 6f 74 6f 74 79 70 65 2c 22 67 65 74 41 6e 69 6d ototype,"getAnim
00003060: 61 74 69 6f 6e 53 70 65 65 64 22 2c 31 29 2c 52 ationSpeed",1),R
00003070: 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 6f 74 m([oa],Om.protot
00003080: 79 70 65 2c 22 67 65 74 49 64 22 2c 31 29 2c 52 ype,"getId",1),R
00003090: 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 6f 74 m([oa],Om.protot
000030a0: 79 70 65 2c 22 67 65 74 4e 61 6d 65 22 2c 31 29 ype,"getName",1)
000030b0: 2c 52 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 ,Rm([oa],Om.prot
000030c0: 6f 74 79 70 65 2c 22 67 65 74 4c 6f 63 61 6c 65 otype,"getLocale
000030d0: 22 2c 31 29 2c 52 6d 28 5b 6f 61 5d 2c 4f 6d 2e ",1),Rm([oa],Om.
000030e0: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 43 6f prototype,"getCo
000030f0: 6c 6f 72 22 2c 31 29 2c 52 6d 28 5b 6f 61 5d 2c lor",1),Rm([oa],
00003100: 4f 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 Om.prototype,"ge
00003110: 74 49 73 53 6e 61 70 4d 6f 64 65 22 2c 31 29 2c tIsSnapMode",1),
00003120: 52 6d 28 5b 6f 61 5d 2c 4f 6d 2e 70 72 6f 74 6f Rm([oa],Om.proto
00003130: 74 79 70 65 2c 22 67 65 74 49 73 57 72 61 70 4d type,"getIsWrapM
00003140: 6f 64 65 22 2c 31 29 2c 52 6d 28 5b 6f 61 5d 2c ode",1),Rm([oa],
00003150: 4f 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 Om.prototype,"ge
00003160: 74 49 73 44 79 6e 61 6d 69 63 52 65 73 69 7a 65 tIsDynamicResize
00003170: 4d 6f 64 65 22 2c 31 29 3b 63 6f 6e 73 74 20 4e Mode",1);const N
00003180: 6d 3d 7b 77 68 65 65 6c 3a 22 6f 6e 57 68 65 65 m={wheel:"onWhee
00003190: 6c 22 2c 70 6f 69 6e 74 65 72 5f 64 6f 77 6e 3a l",pointer_down:
000031a0: 22 6f 6e 50 6f 69 6e 74 65 72 44 6f 77 6e 22 2c "onPointerDown",
000031b0: 70 6f 69 6e 74 65 72 5f 6d 6f 76 65 3a 22 6f 6e pointer_move:"on
000031c0: 50 6f 69 6e 74 65 72 4d 6f 76 65 22 2c 6c 6f 6e PointerMove",lon
000031d0: 67 5f 70 72 65 73 73 3a 22 6f 6e 4c 6f 6e 67 50 g_press:"onLongP
000031e0: 72 65 73 73 22 2c 70 6f 69 6e 74 65 72 5f 75 70 ress",pointer_up
000031f0: 3a 22 6f 6e 50 6f 69 6e 74 65 72 55 70 22 2c 72 :"onPointerUp",r
00003200: 69 67 68 74 5f 63 6c 69 63 6b 3a 22 6f 6e 52 69 ight_click:"onRi
00003210: 67 68 74 43 6c 69 63 6b 22 2c 6d 69 64 64 6c 65 ghtClick",middle
00003220: 5f 63 6c 69 63 6b 3a 22 6f 6e 4d 69 64 64 6c 65 _click:"onMiddle
00003230: 43 6c 69 63 6b 22 2c 6b 65 79 5f 64 6f 77 6e 3a Click",key_down:
00003240: 22 6f 6e 4b 65 79 44 6f 77 6e 22 2c 6b 65 79 5f "onKeyDown",key_
00003250: 75 70 3a 22 6f 6e 4b 65 79 55 70 22 2c 6b 65 79 up:"onKeyUp",key
00003260: 5f 72 65 70 65 61 74 3a 22 6f 6e 4b 65 79 52 65 _repeat:"onKeyRe
00003270: 70 65 61 74 22 2c 63 61 6e 63 65 6c 3a 22 6f 6e peat",cancel:"on
00003280: 43 61 6e 63 65 6c 22 2c 63 6f 6d 70 6c 65 74 65 Cancel",complete
00003290: 3a 22 6f 6e 43 6f 6d 70 6c 65 74 65 22 2c 69 6e :"onComplete",in
000032a0: 74 65 72 72 75 70 74 3a 22 6f 6e 49 6e 74 65 72 terrupt:"onInter
000032b0: 72 75 70 74 22 2c 64 6f 75 62 6c 65 5f 63 6c 69 rupt",double_cli
000032c0: 63 6b 3a 22 6f 6e 44 6f 75 62 6c 65 43 6c 69 63 ck:"onDoubleClic
000032d0: 6b 22 2c 74 72 69 70 6c 65 5f 63 6c 69 63 6b 3a k",triple_click:
000032e0: 22 6f 6e 54 72 69 70 6c 65 43 6c 69 63 6b 22 2c "onTripleClick",
000032f0: 71 75 61 64 72 75 70 6c 65 5f 63 6c 69 63 6b 3a quadruple_click:
00003300: 22 6f 6e 51 75 61 64 72 75 70 6c 65 43 6c 69 63 "onQuadrupleClic
00003310: 6b 22 2c 74 69 63 6b 3a 22 6f 6e 54 69 63 6b 22 k",tick:"onTick"
00003320: 7d 2c 50 6d 3d 5b 22 62 72 75 73 68 69 6e 67 22 },Pm=["brushing"
00003330: 2c 22 63 72 6f 70 70 69 6e 67 22 2c 22 64 72 61 ,"cropping","dra
00003340: 67 67 69 6e 67 22 2c 22 64 72 61 67 67 69 6e 67 gging","dragging
00003350: 5f 68 61 6e 64 6c 65 22 2c 22 64 72 61 77 69 6e _handle","drawin
00003360: 67 22 2c 22 65 72 61 73 69 6e 67 22 2c 22 6c 61 g","erasing","la
00003370: 73 65 72 69 6e 67 22 2c 22 72 65 73 69 7a 69 6e sering","resizin
00003380: 67 22 2c 22 72 6f 74 61 74 69 6e 67 22 2c 22 73 g","rotating","s
00003390: 63 72 69 62 62 6c 65 5f 62 72 75 73 68 69 6e 67 cribble_brushing
000033a0: 22 2c 22 74 72 61 6e 73 6c 61 74 69 6e 67 22 5d ","translating"]
000033b0: 3b 63 6c 61 73 73 20 4d 6d 7b 63 6f 6e 73 74 72 ;class Mm{constr
000033c0: 75 63 74 6f 72 28 65 2c 74 29 7b 74 68 69 73 2e uctor(e,t){this.
000033d0: 65 64 69 74 6f 72 3d 65 3b 63 6f 6e 73 74 7b 69 editor=e;const{i
000033e0: 64 3a 6e 2c 63 68 69 6c 64 72 65 6e 3a 72 2c 69 d:n,children:r,i
000033f0: 6e 69 74 69 61 6c 3a 6f 7d 3d 74 68 69 73 2e 63 nitial:o}=this.c
00003400: 6f 6e 73 74 72 75 63 74 6f 72 3b 74 68 69 73 2e onstructor;this.
00003410: 69 64 3d 6e 2c 74 68 69 73 2e 5f 69 73 41 63 74 id=n,this._isAct
00003420: 69 76 65 3d 59 69 28 22 74 6f 6f 6c 49 73 41 63 ive=Yi("toolIsAc
00003430: 74 69 76 65 22 2b 74 68 69 73 2e 69 64 2c 21 31 tive"+this.id,!1
00003440: 29 2c 74 68 69 73 2e 5f 63 75 72 72 65 6e 74 3d ),this._current=
00003450: 59 69 28 22 74 6f 6f 6c 53 74 61 74 65 22 2b 74 Yi("toolState"+t
00003460: 68 69 73 2e 69 64 2c 76 6f 69 64 20 30 29 2c 74 his.id,void 0),t
00003470: 68 69 73 2e 5f 70 61 74 68 3d 6f 61 28 22 74 6f his._path=oa("to
00003480: 6f 6c 50 61 74 68 22 2b 74 68 69 73 2e 69 64 2c olPath"+this.id,
00003490: 28 28 29 3d 3e 7b 63 6f 6e 73 74 20 65 3d 74 68 (()=>{const e=th
000034a0: 69 73 2e 67 65 74 43 75 72 72 65 6e 74 28 29 3b is.getCurrent();
000034b0: 72 65 74 75 72 6e 20 74 68 69 73 2e 69 64 2b 28 return this.id+(
000034c0: 65 3f 60 2e 24 7b 65 2e 67 65 74 50 61 74 68 28 e?`.${e.getPath(
000034d0: 29 7d 60 3a 22 22 29 7d 29 29 2c 74 68 69 73 2e )}`:"")})),this.
000034e0: 70 61 72 65 6e 74 3d 74 3f 3f 7b 7d 2c 74 68 69 parent=t??{},thi
000034f0: 73 2e 70 61 72 65 6e 74 3f 72 26 26 6f 3f 28 74 s.parent?r&&o?(t
00003500: 68 69 73 2e 74 79 70 65 3d 22 62 72 61 6e 63 68 his.type="branch
00003510: 22 2c 74 68 69 73 2e 69 6e 69 74 69 61 6c 3d 6f ",this.initial=o
00003520: 2c 74 68 69 73 2e 63 68 69 6c 64 72 65 6e 3d 4f ,this.children=O
00003530: 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 72 69 65 bject.fromEntrie
00003540: 73 28 72 28 29 2e 6d 61 70 28 28 65 3d 3e 5b 65 s(r().map((e=>[e
00003550: 2e 69 64 2c 6e 65 77 20 65 28 74 68 69 73 2e 65 .id,new e(this.e
00003560: 64 69 74 6f 72 2c 74 68 69 73 29 5d 29 29 29 2c ditor,this)]))),
00003570: 74 68 69 73 2e 5f 63 75 72 72 65 6e 74 2e 73 65 this._current.se
00003580: 74 28 74 68 69 73 2e 63 68 69 6c 64 72 65 6e 5b t(this.children[
00003590: 74 68 69 73 2e 69 6e 69 74 69 61 6c 5d 29 29 3a this.initial])):
000035a0: 74 68 69 73 2e 74 79 70 65 3d 22 6c 65 61 66 22 this.type="leaf"
000035b0: 3a 28 74 68 69 73 2e 74 79 70 65 3d 22 72 6f 6f :(this.type="roo
000035c0: 74 22 2c 72 26 26 6f 26 26 28 74 68 69 73 2e 69 t",r&&o&&(this.i
000035d0: 6e 69 74 69 61 6c 3d 6f 2c 74 68 69 73 2e 63 68 nitial=o,this.ch
000035e0: 69 6c 64 72 65 6e 3d 4f 62 6a 65 63 74 2e 66 72 ildren=Object.fr
000035f0: 6f 6d 45 6e 74 72 69 65 73 28 72 28 29 2e 6d 61 omEntries(r().ma
00003600: 70 28 28 65 3d 3e 5b 65 2e 69 64 2c 6e 65 77 20 p((e=>[e.id,new
00003610: 65 28 74 68 69 73 2e 65 64 69 74 6f 72 2c 74 68 e(this.editor,th
00003620: 69 73 29 5d 29 29 29 2c 74 68 69 73 2e 5f 63 75 is)]))),this._cu
00003630: 72 72 65 6e 74 2e 73 65 74 28 74 68 69 73 2e 63 rrent.set(this.c
00003640: 68 69 6c 64 72 65 6e 5b 74 68 69 73 2e 69 6e 69 hildren[this.ini
00003650: 74 69 61 6c 5d 29 29 29 2c 74 68 69 73 2e 70 65 tial]))),this.pe
00003660: 72 66 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 rformanceTracker
00003670: 3d 6e 65 77 20 4c 72 7d 70 65 72 66 6f 72 6d 61 =new Lr}performa
00003680: 6e 63 65 54 72 61 63 6b 65 72 3b 73 74 61 74 69 nceTracker;stati
00003690: 63 20 69 64 3b 73 74 61 74 69 63 20 69 6e 69 74 c id;static init
000036a0: 69 61 6c 3b 73 74 61 74 69 63 20 63 68 69 6c 64 ial;static child
000036b0: 72 65 6e 3b 69 64 3b 74 79 70 65 3b 73 68 61 70 ren;id;type;shap
000036c0: 65 54 79 70 65 3b 69 6e 69 74 69 61 6c 3b 63 68 eType;initial;ch
000036d0: 69 6c 64 72 65 6e 3b 70 61 72 65 6e 74 3b 67 65 ildren;parent;ge
000036e0: 74 50 61 74 68 28 29 7b 72 65 74 75 72 6e 20 74 tPath(){return t
000036f0: 68 69 73 2e 5f 70 61 74 68 2e 67 65 74 28 29 7d his._path.get()}
00003700: 5f 70 61 74 68 3b 67 65 74 43 75 72 72 65 6e 74 _path;getCurrent
00003710: 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 5f (){return this._
00003720: 63 75 72 72 65 6e 74 2e 67 65 74 28 29 7d 5f 63 current.get()}_c
00003730: 75 72 72 65 6e 74 3b 67 65 74 49 73 41 63 74 69 urrent;getIsActi
00003740: 76 65 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 ve(){return this
00003750: 2e 5f 69 73 41 63 74 69 76 65 2e 67 65 74 28 29 ._isActive.get()
00003760: 7d 5f 69 73 41 63 74 69 76 65 3b 74 72 61 6e 73 }_isActive;trans
00003770: 69 74 69 6f 6e 3d 28 65 2c 74 3d 7b 7d 29 3d 3e ition=(e,t={})=>
00003780: 7b 63 6f 6e 73 74 20 6e 3d 65 2e 73 70 6c 69 74 {const n=e.split
00003790: 28 22 2e 22 29 3b 6c 65 74 20 72 3d 74 68 69 73 (".");let r=this
000037a0: 3b 66 6f 72 28 6c 65 74 20 65 3d 30 3b 65 3c 6e ;for(let e=0;e<n
000037b0: 2e 6c 65 6e 67 74 68 3b 65 2b 2b 29 7b 63 6f 6e .length;e++){con
000037c0: 73 74 20 6f 3d 6e 5b 65 5d 2c 69 3d 72 2e 67 65 st o=n[e],i=r.ge
000037d0: 74 43 75 72 72 65 6e 74 28 29 2c 61 3d 72 2e 63 tCurrent(),a=r.c
000037e0: 68 69 6c 64 72 65 6e 3f 2e 5b 6f 5d 3b 69 66 28 hildren?.[o];if(
000037f0: 21 61 29 74 68 72 6f 77 20 45 72 72 6f 72 28 60 !a)throw Error(`
00003800: 24 7b 72 2e 69 64 7d 20 2d 20 6e 6f 20 63 68 69 ${r.id} - no chi
00003810: 6c 64 20 73 74 61 74 65 20 65 78 69 73 74 73 20 ld state exists
00003820: 77 69 74 68 20 74 68 65 20 69 64 20 24 7b 6f 7d with the id ${o}
00003830: 2e 60 29 3b 69 66 28 69 3f 2e 69 64 21 3d 3d 61 .`);if(i?.id!==a
00003840: 2e 69 64 26 26 28 69 3f 2e 65 78 69 74 28 74 2c .id&&(i?.exit(t,
00003850: 6f 29 2c 72 2e 5f 63 75 72 72 65 6e 74 2e 73 65 o),r._current.se
00003860: 74 28 61 29 2c 61 2e 65 6e 74 65 72 28 74 2c 69 t(a),a.enter(t,i
00003870: 3f 2e 69 64 7c 7c 22 69 6e 69 74 69 61 6c 22 29 ?.id||"initial")
00003880: 2c 21 61 2e 67 65 74 49 73 41 63 74 69 76 65 28 ,!a.getIsActive(
00003890: 29 29 29 62 72 65 61 6b 3b 72 3d 61 7d 72 65 74 )))break;r=a}ret
000038a0: 75 72 6e 20 74 68 69 73 7d 3b 68 61 6e 64 6c 65 urn this};handle
000038b0: 45 76 65 6e 74 3d 65 3d 3e 7b 63 6f 6e 73 74 20 Event=e=>{const
000038c0: 74 3d 4e 6d 5b 65 2e 6e 61 6d 65 5d 2c 6e 3d 74 t=Nm[e.name],n=t
000038d0: 68 69 73 2e 5f 63 75 72 72 65 6e 74 2e 5f 5f 75 his._current.__u
000038e0: 6e 73 61 66 65 5f 5f 67 65 74 57 69 74 68 6f 75 nsafe__getWithou
000038f0: 74 43 61 70 74 75 72 65 28 29 3b 74 68 69 73 5b tCapture();this[
00003900: 74 5d 3f 2e 28 65 29 2c 74 68 69 73 2e 5f 69 73 t]?.(e),this._is
00003910: 41 63 74 69 76 65 2e 5f 5f 75 6e 73 61 66 65 5f Active.__unsafe_
00003920: 5f 67 65 74 57 69 74 68 6f 75 74 43 61 70 74 75 _getWithoutCaptu
00003930: 72 65 28 29 26 26 6e 26 26 6e 3d 3d 3d 74 68 69 re()&&n&&n===thi
00003940: 73 2e 5f 63 75 72 72 65 6e 74 2e 5f 5f 75 6e 73 s._current.__uns
00003950: 61 66 65 5f 5f 67 65 74 57 69 74 68 6f 75 74 43 afe__getWithoutC
00003960: 61 70 74 75 72 65 28 29 26 26 6e 2e 68 61 6e 64 apture()&&n.hand
00003970: 6c 65 45 76 65 6e 74 28 65 29 7d 3b 65 6e 74 65 leEvent(e)};ente
00003980: 72 3d 28 65 2c 74 29 3d 3e 7b 69 66 28 58 75 2e r=(e,t)=>{if(Xu.
00003990: 6d 65 61 73 75 72 65 50 65 72 66 6f 72 6d 61 6e measurePerforman
000039a0: 63 65 2e 67 65 74 28 29 26 26 50 6d 2e 69 6e 63 ce.get()&&Pm.inc
000039b0: 6c 75 64 65 73 28 74 68 69 73 2e 69 64 29 26 26 ludes(this.id)&&
000039c0: 74 68 69 73 2e 70 65 72 66 6f 72 6d 61 6e 63 65 this.performance
000039d0: 54 72 61 63 6b 65 72 2e 73 74 61 72 74 28 74 68 Tracker.start(th
000039e0: 69 73 2e 69 64 29 2c 74 68 69 73 2e 5f 69 73 41 is.id),this._isA
000039f0: 63 74 69 76 65 2e 73 65 74 28 21 30 29 2c 74 68 ctive.set(!0),th
00003a00: 69 73 2e 6f 6e 45 6e 74 65 72 3f 2e 28 65 2c 74 is.onEnter?.(e,t
00003a10: 29 2c 74 68 69 73 2e 63 68 69 6c 64 72 65 6e 26 ),this.children&
00003a20: 26 74 68 69 73 2e 69 6e 69 74 69 61 6c 26 26 74 &this.initial&&t
00003a30: 68 69 73 2e 67 65 74 49 73 41 63 74 69 76 65 28 his.getIsActive(
00003a40: 29 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e )){const n=this.
00003a50: 63 68 69 6c 64 72 65 6e 5b 74 68 69 73 2e 69 6e children[this.in
00003a60: 69 74 69 61 6c 5d 3b 74 68 69 73 2e 5f 63 75 72 itial];this._cur
00003a70: 72 65 6e 74 2e 73 65 74 28 6e 29 2c 6e 2e 65 6e rent.set(n),n.en
00003a80: 74 65 72 28 65 2c 74 29 7d 7d 3b 65 78 69 74 3d ter(e,t)}};exit=
00003a90: 28 65 2c 74 29 3d 3e 7b 58 75 2e 6d 65 61 73 75 (e,t)=>{Xu.measu
00003aa0: 72 65 50 65 72 66 6f 72 6d 61 6e 63 65 2e 67 65 rePerformance.ge
00003ab0: 74 28 29 26 26 74 68 69 73 2e 70 65 72 66 6f 72 t()&&this.perfor
00003ac0: 6d 61 6e 63 65 54 72 61 63 6b 65 72 2e 69 73 53 manceTracker.isS
00003ad0: 74 61 72 74 65 64 28 29 26 26 74 68 69 73 2e 70 tarted()&&this.p
00003ae0: 65 72 66 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 erformanceTracke
00003af0: 72 2e 73 74 6f 70 28 29 2c 74 68 69 73 2e 5f 69 r.stop(),this._i
00003b00: 73 41 63 74 69 76 65 2e 73 65 74 28 21 31 29 2c sActive.set(!1),
00003b10: 74 68 69 73 2e 6f 6e 45 78 69 74 3f 2e 28 65 2c this.onExit?.(e,
00003b20: 74 29 2c 74 68 69 73 2e 67 65 74 49 73 41 63 74 t),this.getIsAct
00003b30: 69 76 65 28 29 7c 7c 74 68 69 73 2e 67 65 74 43 ive()||this.getC
00003b40: 75 72 72 65 6e 74 28 29 3f 2e 65 78 69 74 28 65 urrent()?.exit(e
00003b50: 2c 74 29 7d 3b 5f 63 75 72 72 65 6e 74 54 6f 6f ,t)};_currentToo
00003b60: 6c 49 64 4d 61 73 6b 3d 59 69 28 22 63 75 72 65 lIdMask=Yi("cure
00003b70: 6e 74 20 74 6f 6f 6c 20 69 64 20 6d 61 73 6b 22 nt tool id mask"
00003b80: 2c 76 6f 69 64 20 30 29 3b 67 65 74 43 75 72 72 ,void 0);getCurr
00003b90: 65 6e 74 54 6f 6f 6c 49 64 4d 61 73 6b 28 29 7b entToolIdMask(){
00003ba0: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 63 75 72 return this._cur
00003bb0: 72 65 6e 74 54 6f 6f 6c 49 64 4d 61 73 6b 2e 67 rentToolIdMask.g
00003bc0: 65 74 28 29 7d 73 65 74 43 75 72 72 65 6e 74 54 et()}setCurrentT
00003bd0: 6f 6f 6c 49 64 4d 61 73 6b 28 65 29 7b 74 68 69 oolIdMask(e){thi
00003be0: 73 2e 5f 63 75 72 72 65 6e 74 54 6f 6f 6c 49 64 s._currentToolId
00003bf0: 4d 61 73 6b 2e 73 65 74 28 65 29 7d 6f 6e 57 68 Mask.set(e)}onWh
00003c00: 65 65 6c 3b 6f 6e 50 6f 69 6e 74 65 72 44 6f 77 eel;onPointerDow
00003c10: 6e 3b 6f 6e 50 6f 69 6e 74 65 72 4d 6f 76 65 3b n;onPointerMove;
00003c20: 6f 6e 4c 6f 6e 67 50 72 65 73 73 3b 6f 6e 50 6f onLongPress;onPo
00003c30: 69 6e 74 65 72 55 70 3b 6f 6e 44 6f 75 62 6c 65 interUp;onDouble
00003c40: 43 6c 69 63 6b 3b 6f 6e 54 72 69 70 6c 65 43 6c Click;onTripleCl
00003c50: 69 63 6b 3b 6f 6e 51 75 61 64 72 75 70 6c 65 43 ick;onQuadrupleC
00003c60: 6c 69 63 6b 3b 6f 6e 52 69 67 68 74 43 6c 69 63 lick;onRightClic
00003c70: 6b 3b 6f 6e 4d 69 64 64 6c 65 43 6c 69 63 6b 3b k;onMiddleClick;
00003c80: 6f 6e 4b 65 79 44 6f 77 6e 3b 6f 6e 4b 65 79 55 onKeyDown;onKeyU
00003c90: 70 3b 6f 6e 4b 65 79 52 65 70 65 61 74 3b 6f 6e p;onKeyRepeat;on
00003ca0: 43 61 6e 63 65 6c 3b 6f 6e 43 6f 6d 70 6c 65 74 Cancel;onComplet
00003cb0: 65 3b 6f 6e 49 6e 74 65 72 72 75 70 74 3b 6f 6e e;onInterrupt;on
00003cc0: 54 69 63 6b 3b 6f 6e 45 6e 74 65 72 3b 6f 6e 45 Tick;onEnter;onE
00003cd0: 78 69 74 7d 63 6c 61 73 73 20 44 6d 20 65 78 74 xit}class Dm ext
00003ce0: 65 6e 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 ends Mm{static i
00003cf0: 64 3d 22 72 6f 6f 74 22 3b 73 74 61 74 69 63 20 d="root";static
00003d00: 69 6e 69 74 69 61 6c 3d 22 22 3b 73 74 61 74 69 initial="";stati
00003d10: 63 20 63 68 69 6c 64 72 65 6e 3d 28 29 3d 3e 5b c children=()=>[
00003d20: 5d 3b 6f 6e 4b 65 79 44 6f 77 6e 3d 65 3d 3e 7b ];onKeyDown=e=>{
00003d30: 69 66 28 22 4b 65 79 5a 22 3d 3d 3d 65 2e 63 6f if("KeyZ"===e.co
00003d40: 64 65 29 69 66 28 21 65 2e 73 68 69 66 74 4b 65 de)if(!e.shiftKe
00003d50: 79 26 26 21 65 2e 63 74 72 6c 4b 65 79 29 7b 63 y&&!e.ctrlKey){c
00003d60: 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 43 onst t=this.getC
00003d70: 75 72 72 65 6e 74 28 29 3b 74 26 26 22 69 64 6c urrent();t&&"idl
00003d80: 65 22 3d 3d 3d 74 2e 67 65 74 43 75 72 72 65 6e e"===t.getCurren
00003d90: 74 28 29 3f 2e 69 64 26 26 74 68 69 73 2e 63 68 t()?.id&&this.ch
00003da0: 69 6c 64 72 65 6e 2e 7a 6f 6f 6d 26 26 74 68 69 ildren.zoom&&thi
00003db0: 73 2e 65 64 69 74 6f 72 2e 73 65 74 43 75 72 72 s.editor.setCurr
00003dc0: 65 6e 74 54 6f 6f 6c 28 22 7a 6f 6f 6d 22 2c 7b entTool("zoom",{
00003dd0: 2e 2e 2e 65 2c 6f 6e 49 6e 74 65 72 61 63 74 69 ...e,onInteracti
00003de0: 6f 6e 45 6e 64 3a 74 2e 69 64 7d 29 7d 7d 7d 76 onEnd:t.id})}}}v
00003df0: 61 72 20 4c 6d 3d 4f 62 6a 65 63 74 2e 64 65 66 ar Lm=Object.def
00003e00: 69 6e 65 50 72 6f 70 65 72 74 79 2c 46 6d 3d 4f ineProperty,Fm=O
00003e10: 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 bject.getOwnProp
00003e20: 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 2c 6a ertyDescriptor,j
00003e30: 6d 3d 28 65 2c 74 2c 6e 2c 72 29 3d 3e 7b 66 6f m=(e,t,n,r)=>{fo
00003e40: 72 28 76 61 72 20 6f 2c 69 3d 72 3e 31 3f 76 6f r(var o,i=r>1?vo
00003e50: 69 64 20 30 3a 72 3f 46 6d 28 74 2c 6e 29 3a 74 id 0:r?Fm(t,n):t
00003e60: 2c 61 3d 65 2e 6c 65 6e 67 74 68 2d 31 3b 61 3e ,a=e.length-1;a>
00003e70: 3d 30 3b 61 2d 2d 29 28 6f 3d 65 5b 61 5d 29 26 =0;a--)(o=e[a])&
00003e80: 26 28 69 3d 28 72 3f 6f 28 74 2c 6e 2c 69 29 3a &(i=(r?o(t,n,i):
00003e90: 6f 28 69 29 29 7c 7c 69 29 3b 72 65 74 75 72 6e o(i))||i);return
00003ea0: 20 72 26 26 69 26 26 4c 6d 28 74 2c 6e 2c 69 29 r&&i&&Lm(t,n,i)
00003eb0: 2c 69 7d 3b 63 6c 61 73 73 20 42 6d 20 65 78 74 ,i};class Bm ext
00003ec0: 65 6e 64 73 20 74 68 7b 63 6f 6e 73 74 72 75 63 ends th{construc
00003ed0: 74 6f 72 28 7b 73 74 6f 72 65 3a 65 2c 75 73 65 tor({store:e,use
00003ee0: 72 3a 74 2c 73 68 61 70 65 55 74 69 6c 73 3a 6e r:t,shapeUtils:n
00003ef0: 2c 62 69 6e 64 69 6e 67 55 74 69 6c 73 3a 72 2c ,bindingUtils:r,
00003f00: 74 6f 6f 6c 73 3a 6f 2c 67 65 74 43 6f 6e 74 61 tools:o,getConta
00003f10: 69 6e 65 72 3a 69 2c 63 61 6d 65 72 61 4f 70 74 iner:i,cameraOpt
00003f20: 69 6f 6e 73 3a 61 2c 61 73 73 65 74 4f 70 74 69 ions:a,assetOpti
00003f30: 6f 6e 73 3a 73 2c 69 6e 69 74 69 61 6c 53 74 61 ons:s,initialSta
00003f40: 74 65 3a 6c 2c 61 75 74 6f 46 6f 63 75 73 3a 63 te:l,autoFocus:c
00003f50: 2c 69 6e 66 65 72 44 61 72 6b 4d 6f 64 65 3a 75 ,inferDarkMode:u
00003f60: 2c 6f 70 74 69 6f 6e 73 3a 64 7d 29 7b 73 75 70 ,options:d}){sup
00003f70: 65 72 28 29 2c 74 68 69 73 2e 6f 70 74 69 6f 6e er(),this.option
00003f80: 73 3d 7b 2e 2e 2e 4c 68 2c 2e 2e 2e 64 7d 2c 74 s={...Lh,...d},t
00003f90: 68 69 73 2e 73 74 6f 72 65 3d 65 2c 74 68 69 73 his.store=e,this
00003fa0: 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e 61 64 64 .disposables.add
00003fb0: 28 74 68 69 73 2e 73 74 6f 72 65 2e 64 69 73 70 (this.store.disp
00003fc0: 6f 73 65 2e 62 69 6e 64 28 74 68 69 73 2e 73 74 ose.bind(this.st
00003fd0: 6f 72 65 29 29 2c 74 68 69 73 2e 68 69 73 74 6f ore)),this.histo
00003fe0: 72 79 3d 6e 65 77 20 74 6d 28 7b 73 74 6f 72 65 ry=new tm({store
00003ff0: 3a 65 2c 61 6e 6e 6f 74 61 74 65 45 72 72 6f 72 :e,annotateError
00004000: 3a 65 3d 3e 7b 74 68 69 73 2e 61 6e 6e 6f 74 61 :e=>{this.annota
00004010: 74 65 45 72 72 6f 72 28 65 2c 7b 6f 72 69 67 69 teError(e,{origi
00004020: 6e 3a 22 68 69 73 74 6f 72 79 2e 62 61 74 63 68 n:"history.batch
00004030: 22 2c 77 69 6c 6c 43 72 61 73 68 41 70 70 3a 21 ",willCrashApp:!
00004040: 30 7d 29 2c 74 68 69 73 2e 63 72 61 73 68 28 65 0}),this.crash(e
00004050: 29 7d 7d 29 2c 74 68 69 73 2e 73 6e 61 70 73 3d )}}),this.snaps=
00004060: 6e 65 77 20 53 6d 28 74 68 69 73 29 2c 74 68 69 new Sm(this),thi
00004070: 73 2e 74 69 6d 65 72 73 3d 6e 65 77 20 6c 69 2c s.timers=new li,
00004080: 74 68 69 73 2e 64 69 73 70 6f 73 61 62 6c 65 73 this.disposables
00004090: 2e 61 64 64 28 74 68 69 73 2e 74 69 6d 65 72 73 .add(this.timers
000040a0: 2e 64 69 73 70 6f 73 65 2e 62 69 6e 64 28 74 68 .dispose.bind(th
000040b0: 69 73 2e 74 69 6d 65 72 73 29 29 2c 74 68 69 73 is.timers)),this
000040c0: 2e 5f 63 61 6d 65 72 61 4f 70 74 69 6f 6e 73 2e ._cameraOptions.
000040d0: 73 65 74 28 7b 2e 2e 2e 55 75 2c 2e 2e 2e 61 7d set({...Uu,...a}
000040e0: 29 2c 74 68 69 73 2e 5f 61 73 73 65 74 4f 70 74 ),this._assetOpt
000040f0: 69 6f 6e 73 2e 73 65 74 28 7b 2e 2e 2e 7a 75 2c ions.set({...zu,
00004100: 2e 2e 2e 73 7d 29 2c 74 68 69 73 2e 75 73 65 72 ...s}),this.user
00004110: 3d 6e 65 77 20 4f 6d 28 74 3f 3f 65 68 28 29 2c =new Om(t??eh(),
00004120: 75 3f 3f 21 31 29 2c 74 68 69 73 2e 67 65 74 43 u??!1),this.getC
00004130: 6f 6e 74 61 69 6e 65 72 3d 69 3f 3f 28 28 29 3d ontainer=i??(()=
00004140: 3e 64 6f 63 75 6d 65 6e 74 2e 62 6f 64 79 29 2c >document.body),
00004150: 74 68 69 73 2e 74 65 78 74 4d 65 61 73 75 72 65 this.textMeasure
00004160: 3d 6e 65 77 20 54 6d 28 74 68 69 73 29 2c 74 68 =new Tm(this),th
00004170: 69 73 2e 5f 74 69 63 6b 4d 61 6e 61 67 65 72 3d is._tickManager=
00004180: 6e 65 77 20 6b 6d 28 74 68 69 73 29 3b 74 68 69 new km(this);thi
00004190: 73 2e 72 6f 6f 74 3d 6e 65 77 20 63 6c 61 73 73 s.root=new class
000041a0: 20 65 78 74 65 6e 64 73 20 44 6d 7b 73 74 61 74 extends Dm{stat
000041b0: 69 63 20 69 6e 69 74 69 61 6c 3d 6c 3f 3f 22 22 ic initial=l??""
000041c0: 7d 28 74 68 69 73 29 2c 74 68 69 73 2e 72 6f 6f }(this),this.roo
000041d0: 74 2e 63 68 69 6c 64 72 65 6e 3d 7b 7d 3b 63 6f t.children={};co
000041e0: 6e 73 74 20 70 3d 44 68 28 6e 29 2c 66 3d 7b 7d nst p=Dh(n),f={}
000041f0: 2c 68 3d 7b 7d 2c 6d 3d 6e 65 77 20 4d 61 70 3b ,h={},m=new Map;
00004200: 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 70 for(const e of p
00004210: 29 7b 63 6f 6e 73 74 20 74 3d 6e 65 77 20 65 28 ){const t=new e(
00004220: 74 68 69 73 29 3b 66 5b 65 2e 74 79 70 65 5d 3d this);f[e.type]=
00004230: 74 3b 63 6f 6e 73 74 20 6e 3d 52 73 28 65 2e 70 t;const n=Rs(e.p
00004240: 72 6f 70 73 3f 3f 7b 7d 29 3b 68 5b 65 2e 74 79 rops??{});h[e.ty
00004250: 70 65 5d 3d 6e 3b 66 6f 72 28 63 6f 6e 73 74 20 pe]=n;for(const
00004260: 65 20 6f 66 20 6e 2e 6b 65 79 73 28 29 29 69 66 e of n.keys())if
00004270: 28 6d 2e 68 61 73 28 65 2e 69 64 29 29 7b 69 66 (m.has(e.id)){if
00004280: 28 6d 2e 67 65 74 28 65 2e 69 64 29 21 3d 3d 65 (m.get(e.id)!==e
00004290: 29 74 68 72 6f 77 20 45 72 72 6f 72 28 60 4d 75 )throw Error(`Mu
000042a0: 6c 74 69 70 6c 65 20 73 74 79 6c 65 20 70 72 6f ltiple style pro
000042b0: 70 73 20 77 69 74 68 20 69 64 20 22 24 7b 65 2e ps with id "${e.
000042c0: 69 64 7d 22 20 69 6e 20 75 73 65 2e 20 53 74 79 id}" in use. Sty
000042d0: 6c 65 20 70 72 6f 70 20 49 44 73 20 6d 75 73 74 le prop IDs must
000042e0: 20 62 65 20 75 6e 69 71 75 65 2e 60 29 7d 65 6c be unique.`)}el
000042f0: 73 65 20 6d 2e 73 65 74 28 65 2e 69 64 2c 65 29 se m.set(e.id,e)
00004300: 7d 74 68 69 73 2e 73 68 61 70 65 55 74 69 6c 73 }this.shapeUtils
00004310: 3d 66 2c 74 68 69 73 2e 73 74 79 6c 65 50 72 6f =f,this.stylePro
00004320: 70 73 3d 68 3b 63 6f 6e 73 74 20 67 3d 66 68 28 ps=h;const g=fh(
00004330: 72 29 2c 62 3d 7b 7d 3b 66 6f 72 28 63 6f 6e 73 r),b={};for(cons
00004340: 74 20 65 20 6f 66 20 67 29 7b 63 6f 6e 73 74 20 t e of g){const
00004350: 74 3d 6e 65 77 20 65 28 74 68 69 73 29 3b 62 5b t=new e(this);b[
00004360: 65 2e 74 79 70 65 5d 3d 74 7d 74 68 69 73 2e 62 e.type]=t}this.b
00004370: 69 6e 64 69 6e 67 55 74 69 6c 73 3d 62 3b 66 6f indingUtils=b;fo
00004380: 72 28 63 6f 6e 73 74 20 65 20 6f 66 5b 2e 2e 2e r(const e of[...
00004390: 6f 5d 29 7b 69 66 28 62 6f 28 74 68 69 73 2e 72 o]){if(bo(this.r
000043a0: 6f 6f 74 2e 63 68 69 6c 64 72 65 6e 2c 65 2e 69 oot.children,e.i
000043b0: 64 29 29 74 68 72 6f 77 20 45 72 72 6f 72 28 60 d))throw Error(`
000043c0: 43 61 6e 27 74 20 6f 76 65 72 72 69 64 65 20 74 Can't override t
000043d0: 6f 6f 6c 20 77 69 74 68 20 69 64 20 22 24 7b 65 ool with id "${e
000043e0: 2e 69 64 7d 22 60 29 3b 74 68 69 73 2e 72 6f 6f .id}"`);this.roo
000043f0: 74 2e 63 68 69 6c 64 72 65 6e 5b 65 2e 69 64 5d t.children[e.id]
00004400: 3d 6e 65 77 20 65 28 74 68 69 73 2c 74 68 69 73 =new e(this,this
00004410: 2e 72 6f 6f 74 29 7d 74 68 69 73 2e 65 6e 76 69 .root)}this.envi
00004420: 72 6f 6e 6d 65 6e 74 3d 6e 65 77 20 58 68 28 74 ronment=new Xh(t
00004430: 68 69 73 29 2c 74 68 69 73 2e 73 63 72 69 62 62 his),this.scribb
00004440: 6c 65 73 3d 6e 65 77 20 6f 6d 28 74 68 69 73 29 les=new om(this)
00004450: 3b 63 6f 6e 73 74 20 79 3d 28 65 2c 74 29 3d 3e ;const y=(e,t)=>
00004460: 7b 6c 65 74 20 6e 3d 6e 75 6c 6c 3b 63 6f 6e 73 {let n=null;cons
00004470: 74 20 72 3d 65 2e 73 65 6c 65 63 74 65 64 53 68 t r=e.selectedSh
00004480: 61 70 65 49 64 73 2e 66 69 6c 74 65 72 28 28 65 apeIds.filter((e
00004490: 3d 3e 21 74 2e 68 61 73 28 65 29 29 29 3b 72 2e =>!t.has(e)));r.
000044a0: 6c 65 6e 67 74 68 21 3d 3d 65 2e 73 65 6c 65 63 length!==e.selec
000044b0: 74 65 64 53 68 61 70 65 49 64 73 2e 6c 65 6e 67 tedShapeIds.leng
000044c0: 74 68 26 26 28 6e 7c 7c 28 6e 3d 7b 2e 2e 2e 65 th&&(n||(n={...e
000044d0: 7d 29 2c 6e 2e 73 65 6c 65 63 74 65 64 53 68 61 }),n.selectedSha
000044e0: 70 65 49 64 73 3d 72 29 3b 63 6f 6e 73 74 20 6f peIds=r);const o
000044f0: 3d 65 2e 65 72 61 73 69 6e 67 53 68 61 70 65 49 =e.erasingShapeI
00004500: 64 73 2e 66 69 6c 74 65 72 28 28 65 3d 3e 21 74 ds.filter((e=>!t
00004510: 2e 68 61 73 28 65 29 29 29 3b 6f 2e 6c 65 6e 67 .has(e)));o.leng
00004520: 74 68 21 3d 3d 65 2e 65 72 61 73 69 6e 67 53 68 th!==e.erasingSh
00004530: 61 70 65 49 64 73 2e 6c 65 6e 67 74 68 26 26 28 apeIds.length&&(
00004540: 6e 7c 7c 28 6e 3d 7b 2e 2e 2e 65 7d 29 2c 6e 2e n||(n={...e}),n.
00004550: 65 72 61 73 69 6e 67 53 68 61 70 65 49 64 73 3d erasingShapeIds=
00004560: 6f 29 2c 65 2e 68 6f 76 65 72 65 64 53 68 61 70 o),e.hoveredShap
00004570: 65 49 64 26 26 74 2e 68 61 73 28 65 2e 68 6f 76 eId&&t.has(e.hov
00004580: 65 72 65 64 53 68 61 70 65 49 64 29 26 26 28 6e eredShapeId)&&(n
00004590: 7c 7c 28 6e 3d 7b 2e 2e 2e 65 7d 29 2c 6e 2e 68 ||(n={...e}),n.h
000045a0: 6f 76 65 72 65 64 53 68 61 70 65 49 64 3d 6e 75 overedShapeId=nu
000045b0: 6c 6c 29 2c 65 2e 65 64 69 74 69 6e 67 53 68 61 ll),e.editingSha
000045c0: 70 65 49 64 26 26 74 2e 68 61 73 28 65 2e 65 64 peId&&t.has(e.ed
000045d0: 69 74 69 6e 67 53 68 61 70 65 49 64 29 26 26 28 itingShapeId)&&(
000045e0: 6e 7c 7c 28 6e 3d 7b 2e 2e 2e 65 7d 29 2c 6e 2e n||(n={...e}),n.
000045f0: 65 64 69 74 69 6e 67 53 68 61 70 65 49 64 3d 6e editingShapeId=n
00004600: 75 6c 6c 29 3b 63 6f 6e 73 74 20 69 3d 65 2e 68 ull);const i=e.h
00004610: 69 6e 74 69 6e 67 53 68 61 70 65 49 64 73 2e 66 intingShapeIds.f
00004620: 69 6c 74 65 72 28 28 65 3d 3e 21 74 2e 68 61 73 ilter((e=>!t.has
00004630: 28 65 29 29 29 3b 72 65 74 75 72 6e 20 69 2e 6c (e)));return i.l
00004640: 65 6e 67 74 68 21 3d 3d 65 2e 68 69 6e 74 69 6e ength!==e.hintin
00004650: 67 53 68 61 70 65 49 64 73 2e 6c 65 6e 67 74 68 gShapeIds.length
00004660: 26 26 28 6e 7c 7c 28 6e 3d 7b 2e 2e 2e 65 7d 29 &&(n||(n={...e})
00004670: 2c 6e 2e 68 69 6e 74 69 6e 67 53 68 61 70 65 49 ,n.hintingShapeI
00004680: 64 73 3d 69 29 2c 65 2e 66 6f 63 75 73 65 64 47 ds=i),e.focusedG
00004690: 72 6f 75 70 49 64 26 26 74 2e 68 61 73 28 65 2e roupId&&t.has(e.
000046a0: 66 6f 63 75 73 65 64 47 72 6f 75 70 49 64 29 26 focusedGroupId)&
000046b0: 26 28 6e 7c 7c 28 6e 3d 7b 2e 2e 2e 65 7d 29 2c &(n||(n={...e}),
000046c0: 6e 2e 66 6f 63 75 73 65 64 47 72 6f 75 70 49 64 n.focusedGroupId
000046d0: 3d 6e 75 6c 6c 29 2c 6e 7d 3b 74 68 69 73 2e 73 =null),n};this.s
000046e0: 69 64 65 45 66 66 65 63 74 73 3d 74 68 69 73 2e ideEffects=this.
000046f0: 73 74 6f 72 65 2e 73 69 64 65 45 66 66 65 63 74 store.sideEffect
00004700: 73 3b 6c 65 74 20 76 3d 6e 65 77 20 4d 61 70 3b s;let v=new Map;
00004710: 63 6f 6e 73 74 20 53 3d 6e 65 77 20 53 65 74 2c const S=new Set,
00004720: 5f 3d 6e 65 77 20 53 65 74 3b 6c 65 74 20 45 3d _=new Set;let E=
00004730: 6e 65 77 20 53 65 74 3b 69 66 28 74 68 69 73 2e new Set;if(this.
00004740: 64 69 73 70 6f 73 61 62 6c 65 73 2e 61 64 64 28 disposables.add(
00004750: 74 68 69 73 2e 73 69 64 65 45 66 66 65 63 74 73 this.sideEffects
00004760: 2e 72 65 67 69 73 74 65 72 4f 70 65 72 61 74 69 .registerOperati
00004770: 6f 6e 43 6f 6d 70 6c 65 74 65 48 61 6e 64 6c 65 onCompleteHandle
00004780: 72 28 28 28 29 3d 3e 7b 53 2e 63 6c 65 61 72 28 r((()=>{S.clear(
00004790: 29 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 );for(const e of
000047a0: 20 5f 29 7b 5f 2e 64 65 6c 65 74 65 28 65 29 3b _){_.delete(e);
000047b0: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 const t=this.get
000047c0: 53 68 61 70 65 28 65 29 3b 69 66 28 21 74 29 63 Shape(e);if(!t)c
000047d0: 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 6e 3d ontinue;const n=
000047e0: 74 68 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 this.getShapeUti
000047f0: 6c 28 74 29 2e 6f 6e 43 68 69 6c 64 72 65 6e 43 l(t).onChildrenC
00004800: 68 61 6e 67 65 3f 2e 28 74 29 3b 6e 3f 2e 6c 65 hange?.(t);n?.le
00004810: 6e 67 74 68 26 26 74 68 69 73 2e 75 70 64 61 74 ngth&&this.updat
00004820: 65 53 68 61 70 65 73 28 6e 29 7d 69 66 28 45 2e eShapes(n)}if(E.
00004830: 73 69 7a 65 29 7b 63 6f 6e 73 74 20 65 3d 45 3b size){const e=E;
00004840: 45 3d 6e 65 77 20 53 65 74 3b 66 6f 72 28 63 6f E=new Set;for(co
00004850: 6e 73 74 20 74 20 6f 66 20 65 29 7b 74 68 69 73 nst t of e){this
00004860: 2e 67 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 .getBindingUtil(
00004870: 74 29 2e 6f 6e 4f 70 65 72 61 74 69 6f 6e 43 6f t).onOperationCo
00004880: 6d 70 6c 65 74 65 3f 2e 28 29 7d 7d 69 66 28 76 mplete?.()}}if(v
00004890: 2e 73 69 7a 65 29 7b 63 6f 6e 73 74 20 65 3d 76 .size){const e=v
000048a0: 3b 76 3d 6e 65 77 20 4d 61 70 3b 66 6f 72 28 63 ;v=new Map;for(c
000048b0: 6f 6e 73 74 20 74 20 6f 66 20 65 2e 76 61 6c 75 onst t of e.valu
000048c0: 65 73 28 29 29 74 68 69 73 2e 67 65 74 42 69 6e es())this.getBin
000048d0: 64 69 6e 67 55 74 69 6c 28 74 2e 62 69 6e 64 69 dingUtil(t.bindi
000048e0: 6e 67 29 2e 6f 6e 41 66 74 65 72 44 65 6c 65 74 ng).onAfterDelet
000048f0: 65 3f 2e 28 74 29 7d 74 68 69 73 2e 65 6d 69 74 e?.(t)}this.emit
00004900: 28 22 75 70 64 61 74 65 22 29 7d 29 29 29 2c 74 ("update")}))),t
00004910: 68 69 73 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e his.disposables.
00004920: 61 64 64 28 74 68 69 73 2e 73 69 64 65 45 66 66 add(this.sideEff
00004930: 65 63 74 73 2e 72 65 67 69 73 74 65 72 28 7b 73 ects.register({s
00004940: 68 61 70 65 3a 7b 61 66 74 65 72 43 68 61 6e 67 hape:{afterChang
00004950: 65 3a 28 65 2c 74 29 3d 3e 7b 66 6f 72 28 63 6f e:(e,t)=>{for(co
00004960: 6e 73 74 20 6e 20 6f 66 20 74 68 69 73 2e 67 65 nst n of this.ge
00004970: 74 42 69 6e 64 69 6e 67 73 49 6e 76 6f 6c 76 69 tBindingsInvolvi
00004980: 6e 67 53 68 61 70 65 28 74 29 29 45 2e 61 64 64 ngShape(t))E.add
00004990: 28 6e 2e 74 79 70 65 29 2c 6e 2e 66 72 6f 6d 49 (n.type),n.fromI
000049a0: 64 3d 3d 3d 74 2e 69 64 26 26 74 68 69 73 2e 67 d===t.id&&this.g
000049b0: 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 6e 29 etBindingUtil(n)
000049c0: 2e 6f 6e 41 66 74 65 72 43 68 61 6e 67 65 46 72 .onAfterChangeFr
000049d0: 6f 6d 53 68 61 70 65 3f 2e 28 7b 62 69 6e 64 69 omShape?.({bindi
000049e0: 6e 67 3a 6e 2c 73 68 61 70 65 42 65 66 6f 72 65 ng:n,shapeBefore
000049f0: 3a 65 2c 73 68 61 70 65 41 66 74 65 72 3a 74 7d :e,shapeAfter:t}
00004a00: 29 2c 6e 2e 74 6f 49 64 3d 3d 3d 74 2e 69 64 26 ),n.toId===t.id&
00004a10: 26 74 68 69 73 2e 67 65 74 42 69 6e 64 69 6e 67 &this.getBinding
00004a20: 55 74 69 6c 28 6e 29 2e 6f 6e 41 66 74 65 72 43 Util(n).onAfterC
00004a30: 68 61 6e 67 65 54 6f 53 68 61 70 65 3f 2e 28 7b hangeToShape?.({
00004a40: 62 69 6e 64 69 6e 67 3a 6e 2c 73 68 61 70 65 42 binding:n,shapeB
00004a50: 65 66 6f 72 65 3a 65 2c 73 68 61 70 65 41 66 74 efore:e,shapeAft
00004a60: 65 72 3a 74 7d 29 3b 69 66 28 65 2e 70 61 72 65 er:t});if(e.pare
00004a70: 6e 74 49 64 21 3d 3d 74 2e 70 61 72 65 6e 74 49 ntId!==t.parentI
00004a80: 64 29 7b 63 6f 6e 73 74 20 65 3d 65 3d 3e 7b 63 d){const e=e=>{c
00004a90: 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 53 onst t=this.getS
00004aa0: 68 61 70 65 28 65 29 3b 69 66 28 74 29 66 6f 72 hape(e);if(t)for
00004ab0: 28 63 6f 6e 73 74 20 65 20 6f 66 20 74 68 69 73 (const e of this
00004ac0: 2e 67 65 74 42 69 6e 64 69 6e 67 73 49 6e 76 6f .getBindingsInvo
00004ad0: 6c 76 69 6e 67 53 68 61 70 65 28 74 29 29 45 2e lvingShape(t))E.
00004ae0: 61 64 64 28 65 2e 74 79 70 65 29 2c 65 2e 66 72 add(e.type),e.fr
00004af0: 6f 6d 49 64 3d 3d 3d 74 2e 69 64 26 26 74 68 69 omId===t.id&&thi
00004b00: 73 2e 67 65 74 42 69 6e 64 69 6e 67 55 74 69 6c s.getBindingUtil
00004b10: 28 65 29 2e 6f 6e 41 66 74 65 72 43 68 61 6e 67 (e).onAfterChang
00004b20: 65 46 72 6f 6d 53 68 61 70 65 3f 2e 28 7b 62 69 eFromShape?.({bi
00004b30: 6e 64 69 6e 67 3a 65 2c 73 68 61 70 65 42 65 66 nding:e,shapeBef
00004b40: 6f 72 65 3a 74 2c 73 68 61 70 65 41 66 74 65 72 ore:t,shapeAfter
00004b50: 3a 74 7d 29 2c 65 2e 74 6f 49 64 3d 3d 3d 74 2e :t}),e.toId===t.
00004b60: 69 64 26 26 74 68 69 73 2e 67 65 74 42 69 6e 64 id&&this.getBind
00004b70: 69 6e 67 55 74 69 6c 28 65 29 2e 6f 6e 41 66 74 ingUtil(e).onAft
00004b80: 65 72 43 68 61 6e 67 65 54 6f 53 68 61 70 65 3f erChangeToShape?
00004b90: 2e 28 7b 62 69 6e 64 69 6e 67 3a 65 2c 73 68 61 .({binding:e,sha
00004ba0: 70 65 42 65 66 6f 72 65 3a 74 2c 73 68 61 70 65 peBefore:t,shape
00004bb0: 41 66 74 65 72 3a 74 7d 29 7d 3b 65 28 74 2e 69 After:t})};e(t.i
00004bc0: 64 29 2c 74 68 69 73 2e 76 69 73 69 74 44 65 73 d),this.visitDes
00004bd0: 63 65 6e 64 61 6e 74 73 28 74 2e 69 64 2c 65 29 cendants(t.id,e)
00004be0: 7d 69 66 28 65 2e 70 61 72 65 6e 74 49 64 21 3d }if(e.parentId!=
00004bf0: 3d 74 2e 70 61 72 65 6e 74 49 64 26 26 70 6c 28 =t.parentId&&pl(
00004c00: 74 2e 70 61 72 65 6e 74 49 64 29 29 7b 63 6f 6e t.parentId)){con
00004c10: 73 74 20 6e 3d 6e 65 77 20 53 65 74 28 5b 65 2e st n=new Set([e.
00004c20: 69 64 5d 29 3b 74 68 69 73 2e 76 69 73 69 74 44 id]);this.visitD
00004c30: 65 73 63 65 6e 64 61 6e 74 73 28 65 2e 69 64 2c escendants(e.id,
00004c40: 28 65 3d 3e 7b 6e 2e 61 64 64 28 65 29 7d 29 29 (e=>{n.add(e)}))
00004c50: 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 ;for(const e of
00004c60: 74 68 69 73 2e 67 65 74 50 61 67 65 53 74 61 74 this.getPageStat
00004c70: 65 73 28 29 29 7b 69 66 28 65 2e 70 61 67 65 49 es()){if(e.pageI
00004c80: 64 3d 3d 3d 74 2e 70 61 72 65 6e 74 49 64 29 63 d===t.parentId)c
00004c90: 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 72 3d ontinue;const r=
00004ca0: 79 28 65 2c 6e 29 3b 72 26 26 74 68 69 73 2e 73 y(e,n);r&&this.s
00004cb0: 74 6f 72 65 2e 70 75 74 28 5b 72 5d 29 7d 7d 65 tore.put([r])}}e
00004cc0: 2e 70 61 72 65 6e 74 49 64 26 26 41 73 28 65 2e .parentId&&As(e.
00004cd0: 70 61 72 65 6e 74 49 64 29 26 26 5f 2e 61 64 64 parentId)&&_.add
00004ce0: 28 65 2e 70 61 72 65 6e 74 49 64 29 2c 74 2e 70 (e.parentId),t.p
00004cf0: 61 72 65 6e 74 49 64 21 3d 3d 65 2e 70 61 72 65 arentId!==e.pare
00004d00: 6e 74 49 64 26 26 41 73 28 74 2e 70 61 72 65 6e ntId&&As(t.paren
00004d10: 74 49 64 29 26 26 5f 2e 61 64 64 28 74 2e 70 61 tId)&&_.add(t.pa
00004d20: 72 65 6e 74 49 64 29 7d 2c 62 65 66 6f 72 65 44 rentId)},beforeD
00004d30: 65 6c 65 74 65 3a 65 3d 3e 7b 69 66 28 53 2e 68 elete:e=>{if(S.h
00004d40: 61 73 28 65 2e 69 64 29 29 72 65 74 75 72 6e 3b as(e.id))return;
00004d50: 65 2e 70 61 72 65 6e 74 49 64 26 26 41 73 28 65 e.parentId&&As(e
00004d60: 2e 70 61 72 65 6e 74 49 64 29 26 26 5f 2e 61 64 .parentId)&&_.ad
00004d70: 64 28 65 2e 70 61 72 65 6e 74 49 64 29 2c 53 2e d(e.parentId),S.
00004d80: 61 64 64 28 65 2e 69 64 29 3b 63 6f 6e 73 74 20 add(e.id);const
00004d90: 74 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 74 20 6e t=[];for(const n
00004da0: 20 6f 66 20 74 68 69 73 2e 67 65 74 42 69 6e 64 of this.getBind
00004db0: 69 6e 67 73 49 6e 76 6f 6c 76 69 6e 67 53 68 61 ingsInvolvingSha
00004dc0: 70 65 28 65 29 29 7b 45 2e 61 64 64 28 6e 2e 74 pe(e)){E.add(n.t
00004dd0: 79 70 65 29 2c 74 2e 70 75 73 68 28 6e 2e 69 64 ype),t.push(n.id
00004de0: 29 3b 63 6f 6e 73 74 20 72 3d 74 68 69 73 2e 67 );const r=this.g
00004df0: 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 6e 29 etBindingUtil(n)
00004e00: 3b 6e 2e 66 72 6f 6d 49 64 3d 3d 3d 65 2e 69 64 ;n.fromId===e.id
00004e10: 3f 28 72 2e 6f 6e 42 65 66 6f 72 65 49 73 6f 6c ?(r.onBeforeIsol
00004e20: 61 74 65 54 6f 53 68 61 70 65 3f 2e 28 7b 62 69 ateToShape?.({bi
00004e30: 6e 64 69 6e 67 3a 6e 2c 72 65 6d 6f 76 65 64 53 nding:n,removedS
00004e40: 68 61 70 65 3a 65 7d 29 2c 72 2e 6f 6e 42 65 66 hape:e}),r.onBef
00004e50: 6f 72 65 44 65 6c 65 74 65 46 72 6f 6d 53 68 61 oreDeleteFromSha
00004e60: 70 65 3f 2e 28 7b 62 69 6e 64 69 6e 67 3a 6e 2c pe?.({binding:n,
00004e70: 73 68 61 70 65 3a 65 7d 29 29 3a 28 72 2e 6f 6e shape:e})):(r.on
00004e80: 42 65 66 6f 72 65 49 73 6f 6c 61 74 65 46 72 6f BeforeIsolateFro
00004e90: 6d 53 68 61 70 65 3f 2e 28 7b 62 69 6e 64 69 6e mShape?.({bindin
00004ea0: 67 3a 6e 2c 72 65 6d 6f 76 65 64 53 68 61 70 65 g:n,removedShape
00004eb0: 3a 65 7d 29 2c 72 2e 6f 6e 42 65 66 6f 72 65 44 :e}),r.onBeforeD
00004ec0: 65 6c 65 74 65 54 6f 53 68 61 70 65 3f 2e 28 7b eleteToShape?.({
00004ed0: 62 69 6e 64 69 6e 67 3a 6e 2c 73 68 61 70 65 3a binding:n,shape:
00004ee0: 65 7d 29 29 7d 74 2e 6c 65 6e 67 74 68 26 26 74 e}))}t.length&&t
00004ef0: 68 69 73 2e 64 65 6c 65 74 65 42 69 6e 64 69 6e his.deleteBindin
00004f00: 67 73 28 74 29 3b 63 6f 6e 73 74 20 6e 3d 6e 65 gs(t);const n=ne
00004f10: 77 20 53 65 74 28 5b 65 2e 69 64 5d 29 2c 72 3d w Set([e.id]),r=
00004f20: 6a 72 28 74 68 69 73 2e 67 65 74 50 61 67 65 53 jr(this.getPageS
00004f30: 74 61 74 65 73 28 29 2e 6d 61 70 28 28 65 3d 3e tates().map((e=>
00004f40: 79 28 65 2c 6e 29 29 29 29 3b 72 2e 6c 65 6e 67 y(e,n))));r.leng
00004f50: 74 68 26 26 74 68 69 73 2e 73 74 6f 72 65 2e 70 th&&this.store.p
00004f60: 75 74 28 72 29 7d 7d 2c 62 69 6e 64 69 6e 67 3a ut(r)}},binding:
00004f70: 7b 62 65 66 6f 72 65 43 72 65 61 74 65 3a 65 3d {beforeCreate:e=
00004f80: 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 >{const t=this.g
00004f90: 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 65 29 etBindingUtil(e)
00004fa0: 2e 6f 6e 42 65 66 6f 72 65 43 72 65 61 74 65 3f .onBeforeCreate?
00004fb0: 2e 28 7b 62 69 6e 64 69 6e 67 3a 65 7d 29 3b 72 .({binding:e});r
00004fc0: 65 74 75 72 6e 20 74 7c 7c 65 7d 2c 61 66 74 65 eturn t||e},afte
00004fd0: 72 43 72 65 61 74 65 3a 65 3d 3e 7b 45 2e 61 64 rCreate:e=>{E.ad
00004fe0: 64 28 65 2e 74 79 70 65 29 2c 74 68 69 73 2e 67 d(e.type),this.g
00004ff0: 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 65 29 etBindingUtil(e)
00005000: 2e 6f 6e 41 66 74 65 72 43 72 65 61 74 65 3f 2e .onAfterCreate?.
00005010: 28 7b 62 69 6e 64 69 6e 67 3a 65 7d 29 7d 2c 62 ({binding:e})},b
00005020: 65 66 6f 72 65 43 68 61 6e 67 65 3a 28 65 2c 74 eforeChange:(e,t
00005030: 29 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 )=>{const n=this
00005040: 2e 67 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 .getBindingUtil(
00005050: 74 29 2e 6f 6e 42 65 66 6f 72 65 43 68 61 6e 67 t).onBeforeChang
00005060: 65 3f 2e 28 7b 62 69 6e 64 69 6e 67 42 65 66 6f e?.({bindingBefo
00005070: 72 65 3a 65 2c 62 69 6e 64 69 6e 67 41 66 74 65 re:e,bindingAfte
00005080: 72 3a 74 7d 29 3b 72 65 74 75 72 6e 20 6e 7c 7c r:t});return n||
00005090: 74 7d 2c 61 66 74 65 72 43 68 61 6e 67 65 3a 28 t},afterChange:(
000050a0: 65 2c 74 29 3d 3e 7b 45 2e 61 64 64 28 74 2e 74 e,t)=>{E.add(t.t
000050b0: 79 70 65 29 2c 74 68 69 73 2e 67 65 74 42 69 6e ype),this.getBin
000050c0: 64 69 6e 67 55 74 69 6c 28 74 29 2e 6f 6e 41 66 dingUtil(t).onAf
000050d0: 74 65 72 43 68 61 6e 67 65 3f 2e 28 7b 62 69 6e terChange?.({bin
000050e0: 64 69 6e 67 42 65 66 6f 72 65 3a 65 2c 62 69 6e dingBefore:e,bin
000050f0: 64 69 6e 67 41 66 74 65 72 3a 74 7d 29 7d 2c 62 dingAfter:t})},b
00005100: 65 66 6f 72 65 44 65 6c 65 74 65 3a 65 3d 3e 7b eforeDelete:e=>{
00005110: 74 68 69 73 2e 67 65 74 42 69 6e 64 69 6e 67 55 this.getBindingU
00005120: 74 69 6c 28 65 29 2e 6f 6e 42 65 66 6f 72 65 44 til(e).onBeforeD
00005130: 65 6c 65 74 65 3f 2e 28 7b 62 69 6e 64 69 6e 67 elete?.({binding
00005140: 3a 65 7d 29 7d 2c 61 66 74 65 72 44 65 6c 65 74 :e})},afterDelet
00005150: 65 3a 65 3d 3e 7b 74 68 69 73 2e 67 65 74 42 69 e:e=>{this.getBi
00005160: 6e 64 69 6e 67 55 74 69 6c 28 65 29 2e 6f 6e 41 ndingUtil(e).onA
00005170: 66 74 65 72 44 65 6c 65 74 65 3f 2e 28 7b 62 69 fterDelete?.({bi
00005180: 6e 64 69 6e 67 3a 65 7d 29 2c 45 2e 61 64 64 28 nding:e}),E.add(
00005190: 65 2e 74 79 70 65 29 7d 7d 2c 70 61 67 65 3a 7b e.type)}},page:{
000051a0: 61 66 74 65 72 43 72 65 61 74 65 3a 65 3d 3e 7b afterCreate:e=>{
000051b0: 63 6f 6e 73 74 20 74 3d 6e 6c 2e 63 72 65 61 74 const t=nl.creat
000051c0: 65 49 64 28 65 2e 69 64 29 2c 6e 3d 5f 6c 2e 63 eId(e.id),n=_l.c
000051d0: 72 65 61 74 65 49 64 28 65 2e 69 64 29 3b 74 68 reateId(e.id);th
000051e0: 69 73 2e 73 74 6f 72 65 2e 68 61 73 28 74 29 7c is.store.has(t)|
000051f0: 7c 74 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 |this.store.put(
00005200: 5b 6e 6c 2e 63 72 65 61 74 65 28 7b 69 64 3a 74 [nl.create({id:t
00005210: 7d 29 5d 29 2c 74 68 69 73 2e 73 74 6f 72 65 2e })]),this.store.
00005220: 68 61 73 28 6e 29 7c 7c 74 68 69 73 2e 73 74 6f has(n)||this.sto
00005230: 72 65 2e 70 75 74 28 5b 5f 6c 2e 63 72 65 61 74 re.put([_l.creat
00005240: 65 28 7b 69 64 3a 6e 2c 70 61 67 65 49 64 3a 65 e({id:n,pageId:e
00005250: 2e 69 64 7d 29 5d 29 7d 2c 61 66 74 65 72 44 65 .id})])},afterDe
00005260: 6c 65 74 65 3a 28 65 2c 74 29 3d 3e 7b 69 66 28 lete:(e,t)=>{if(
00005270: 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 this.getInstance
00005280: 53 74 61 74 65 28 29 3f 2e 63 75 72 72 65 6e 74 State()?.current
00005290: 50 61 67 65 49 64 3d 3d 3d 65 2e 69 64 29 7b 63 PageId===e.id){c
000052a0: 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 50 onst n=this.getP
000052b0: 61 67 65 73 28 29 2e 66 69 6e 64 28 28 74 3d 3e ages().find((t=>
000052c0: 74 2e 69 64 21 3d 3d 65 2e 69 64 29 29 3f 2e 69 t.id!==e.id))?.i
000052d0: 64 3b 6e 3f 74 68 69 73 2e 73 74 6f 72 65 2e 70 d;n?this.store.p
000052e0: 75 74 28 5b 7b 2e 2e 2e 74 68 69 73 2e 67 65 74 ut([{...this.get
000052f0: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2c InstanceState(),
00005300: 63 75 72 72 65 6e 74 50 61 67 65 49 64 3a 6e 7d currentPageId:n}
00005310: 5d 29 3a 22 75 73 65 72 22 3d 3d 3d 74 26 26 74 ]):"user"===t&&t
00005320: 68 69 73 2e 73 74 6f 72 65 2e 65 6e 73 75 72 65 his.store.ensure
00005330: 53 74 6f 72 65 49 73 55 73 61 62 6c 65 28 29 7d StoreIsUsable()}
00005340: 63 6f 6e 73 74 20 6e 3d 6e 6c 2e 63 72 65 61 74 const n=nl.creat
00005350: 65 49 64 28 65 2e 69 64 29 2c 72 3d 5f 6c 2e 63 eId(e.id),r=_l.c
00005360: 72 65 61 74 65 49 64 28 65 2e 69 64 29 3b 74 68 reateId(e.id);th
00005370: 69 73 2e 73 74 6f 72 65 2e 72 65 6d 6f 76 65 28 is.store.remove(
00005380: 5b 6e 2c 72 5d 29 7d 7d 2c 69 6e 73 74 61 6e 63 [n,r])}},instanc
00005390: 65 3a 7b 61 66 74 65 72 43 68 61 6e 67 65 3a 28 e:{afterChange:(
000053a0: 65 2c 74 2c 6e 29 3d 3e 7b 69 66 28 21 74 68 69 e,t,n)=>{if(!thi
000053b0: 73 2e 73 74 6f 72 65 2e 68 61 73 28 74 2e 63 75 s.store.has(t.cu
000053c0: 72 72 65 6e 74 50 61 67 65 49 64 29 29 7b 63 6f rrentPageId)){co
000053d0: 6e 73 74 20 72 3d 74 68 69 73 2e 73 74 6f 72 65 nst r=this.store
000053e0: 2e 68 61 73 28 65 2e 63 75 72 72 65 6e 74 50 61 .has(e.currentPa
000053f0: 67 65 49 64 29 3f 65 2e 63 75 72 72 65 6e 74 50 geId)?e.currentP
00005400: 61 67 65 49 64 3a 74 68 69 73 2e 67 65 74 50 61 ageId:this.getPa
00005410: 67 65 73 28 29 5b 30 5d 3f 2e 69 64 3b 72 3f 74 ges()[0]?.id;r?t
00005420: 68 69 73 2e 73 74 6f 72 65 2e 75 70 64 61 74 65 his.store.update
00005430: 28 74 2e 69 64 2c 28 65 3d 3e 28 7b 2e 2e 2e 65 (t.id,(e=>({...e
00005440: 2c 63 75 72 72 65 6e 74 50 61 67 65 49 64 3a 72 ,currentPageId:r
00005450: 7d 29 29 29 3a 22 75 73 65 72 22 3d 3d 3d 6e 26 }))):"user"===n&
00005460: 26 74 68 69 73 2e 73 74 6f 72 65 2e 65 6e 73 75 &this.store.ensu
00005470: 72 65 53 74 6f 72 65 49 73 55 73 61 62 6c 65 28 reStoreIsUsable(
00005480: 29 7d 7d 7d 2c 69 6e 73 74 61 6e 63 65 5f 70 61 )}}},instance_pa
00005490: 67 65 5f 73 74 61 74 65 3a 7b 61 66 74 65 72 43 ge_state:{afterC
000054a0: 68 61 6e 67 65 3a 28 65 2c 74 29 3d 3e 7b 69 66 hange:(e,t)=>{if
000054b0: 28 65 3f 2e 73 65 6c 65 63 74 65 64 53 68 61 70 (e?.selectedShap
000054c0: 65 49 64 73 21 3d 3d 74 3f 2e 73 65 6c 65 63 74 eIds!==t?.select
000054d0: 65 64 53 68 61 70 65 49 64 73 29 7b 63 6f 6e 73 edShapeIds){cons
000054e0: 74 20 65 3d 74 2e 73 65 6c 65 63 74 65 64 53 68 t e=t.selectedSh
000054f0: 61 70 65 49 64 73 2e 66 69 6c 74 65 72 28 28 65 apeIds.filter((e
00005500: 3d 3e 7b 6c 65 74 20 6e 3d 74 68 69 73 2e 67 65 =>{let n=this.ge
00005510: 74 53 68 61 70 65 28 65 29 3f 2e 70 61 72 65 6e tShape(e)?.paren
00005520: 74 49 64 3b 66 6f 72 28 3b 41 73 28 6e 29 3b 29 tId;for(;As(n);)
00005530: 7b 69 66 28 74 2e 73 65 6c 65 63 74 65 64 53 68 {if(t.selectedSh
00005540: 61 70 65 49 64 73 2e 69 6e 63 6c 75 64 65 73 28 apeIds.includes(
00005550: 6e 29 29 72 65 74 75 72 6e 21 31 3b 6e 3d 74 68 n))return!1;n=th
00005560: 69 73 2e 67 65 74 53 68 61 70 65 28 6e 29 3f 2e is.getShape(n)?.
00005570: 70 61 72 65 6e 74 49 64 7d 72 65 74 75 72 6e 21 parentId}return!
00005580: 30 7d 29 29 3b 6c 65 74 20 6e 3d 6e 75 6c 6c 3b 0}));let n=null;
00005590: 69 66 28 65 2e 6c 65 6e 67 74 68 3e 30 29 7b 63 if(e.length>0){c
000055a0: 6f 6e 73 74 20 74 3d 74 68 69 73 2e 66 69 6e 64 onst t=this.find
000055b0: 43 6f 6d 6d 6f 6e 41 6e 63 65 73 74 6f 72 28 6a CommonAncestor(j
000055c0: 72 28 65 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 r(e.map((e=>this
000055d0: 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 29 2c .getShape(e)))),
000055e0: 28 65 3d 3e 74 68 69 73 2e 69 73 53 68 61 70 65 (e=>this.isShape
000055f0: 4f 66 54 79 70 65 28 65 2c 22 67 72 6f 75 70 22 OfType(e,"group"
00005600: 29 29 29 3b 74 26 26 28 6e 3d 74 29 7d 65 6c 73 )));t&&(n=t)}els
00005610: 65 20 74 3f 2e 66 6f 63 75 73 65 64 47 72 6f 75 e t?.focusedGrou
00005620: 70 49 64 26 26 28 6e 3d 74 2e 66 6f 63 75 73 65 pId&&(n=t.focuse
00005630: 64 47 72 6f 75 70 49 64 29 3b 65 2e 6c 65 6e 67 dGroupId);e.leng
00005640: 74 68 3d 3d 3d 74 2e 73 65 6c 65 63 74 65 64 53 th===t.selectedS
00005650: 68 61 70 65 49 64 73 2e 6c 65 6e 67 74 68 26 26 hapeIds.length&&
00005660: 6e 3d 3d 3d 74 2e 66 6f 63 75 73 65 64 47 72 6f n===t.focusedGro
00005670: 75 70 49 64 7c 7c 74 68 69 73 2e 73 74 6f 72 65 upId||this.store
00005680: 2e 70 75 74 28 5b 7b 2e 2e 2e 74 2c 73 65 6c 65 .put([{...t,sele
00005690: 63 74 65 64 53 68 61 70 65 49 64 73 3a 65 2c 66 ctedShapeIds:e,f
000056a0: 6f 63 75 73 65 64 47 72 6f 75 70 49 64 3a 6e 3f ocusedGroupId:n?
000056b0: 3f 6e 75 6c 6c 7d 5d 29 7d 7d 7d 7d 29 29 2c 74 ?null}])}}}})),t
000056c0: 68 69 73 2e 5f 63 75 72 72 65 6e 74 50 61 67 65 his._currentPage
000056d0: 53 68 61 70 65 49 64 73 3d 28 28 65 2c 74 29 3d ShapeIds=((e,t)=
000056e0: 3e 7b 63 6f 6e 73 74 20 6e 3d 65 2e 71 75 65 72 >{const n=e.quer
000056f0: 79 2e 69 64 73 28 22 73 68 61 70 65 22 29 3b 6c y.ids("shape");l
00005700: 65 74 20 72 3d 6e 75 6c 6c 3b 66 75 6e 63 74 69 et r=null;functi
00005710: 6f 6e 20 6f 28 29 7b 63 6f 6e 73 74 20 6f 3d 74 on o(){const o=t
00005720: 28 29 3b 72 65 74 75 72 6e 20 72 3d 6f 2c 6e 65 ();return r=o,ne
00005730: 77 20 53 65 74 28 5b 2e 2e 2e 6e 2e 67 65 74 28 w Set([...n.get(
00005740: 29 5d 2e 66 69 6c 74 65 72 28 28 74 3d 3e 48 68 )].filter((t=>Hh
00005750: 28 65 2c 6f 2c 65 2e 67 65 74 28 74 29 29 29 29 (e,o,e.get(t))))
00005760: 29 7d 72 65 74 75 72 6e 20 6f 61 28 22 5f 73 68 )}return oa("_sh
00005770: 61 70 65 49 64 73 49 6e 43 75 72 72 65 6e 74 50 apeIdsInCurrentP
00005780: 61 67 65 22 2c 28 28 6e 2c 69 29 3d 3e 7b 69 66 age",((n,i)=>{if
00005790: 28 51 69 28 6e 29 29 72 65 74 75 72 6e 20 6f 28 (Qi(n))return o(
000057a0: 29 3b 63 6f 6e 73 74 20 61 3d 74 28 29 3b 69 66 );const a=t();if
000057b0: 28 61 21 3d 3d 72 29 72 65 74 75 72 6e 20 6f 28 (a!==r)return o(
000057c0: 29 3b 63 6f 6e 73 74 20 73 3d 65 2e 68 69 73 74 );const s=e.hist
000057d0: 6f 72 79 2e 67 65 74 44 69 66 66 53 69 6e 63 65 ory.getDiffSince
000057e0: 28 69 29 3b 69 66 28 73 3d 3d 3d 41 69 29 72 65 (i);if(s===Ai)re
000057f0: 74 75 72 6e 20 6f 28 29 3b 63 6f 6e 73 74 20 6c turn o();const l
00005800: 3d 6e 65 77 20 49 72 28 6e 29 3b 66 6f 72 28 63 =new Ir(n);for(c
00005810: 6f 6e 73 74 20 74 20 6f 66 20 73 29 7b 66 6f 72 onst t of s){for
00005820: 28 63 6f 6e 73 74 20 6e 20 6f 66 20 4f 62 6a 65 (const n of Obje
00005830: 63 74 2e 76 61 6c 75 65 73 28 74 2e 61 64 64 65 ct.values(t.adde
00005840: 64 29 29 6b 73 28 6e 29 26 26 48 68 28 65 2c 61 d))ks(n)&&Hh(e,a
00005850: 2c 6e 29 26 26 6c 2e 61 64 64 28 6e 2e 69 64 29 ,n)&&l.add(n.id)
00005860: 3b 66 6f 72 28 63 6f 6e 73 74 5b 6e 2c 72 5d 6f ;for(const[n,r]o
00005870: 66 20 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 f Object.values(
00005880: 74 2e 75 70 64 61 74 65 64 29 29 6b 73 28 72 29 t.updated))ks(r)
00005890: 26 26 28 48 68 28 65 2c 61 2c 72 29 3f 6c 2e 61 &&(Hh(e,a,r)?l.a
000058a0: 64 64 28 72 2e 69 64 29 3a 6c 2e 72 65 6d 6f 76 dd(r.id):l.remov
000058b0: 65 28 72 2e 69 64 29 29 3b 66 6f 72 28 63 6f 6e e(r.id));for(con
000058c0: 73 74 20 65 20 6f 66 20 4f 62 6a 65 63 74 2e 6b st e of Object.k
000058d0: 65 79 73 28 74 2e 72 65 6d 6f 76 65 64 29 29 41 eys(t.removed))A
000058e0: 73 28 65 29 26 26 6c 2e 72 65 6d 6f 76 65 28 65 s(e)&&l.remove(e
000058f0: 29 7d 63 6f 6e 73 74 20 63 3d 6c 2e 67 65 74 28 )}const c=l.get(
00005900: 29 3b 72 65 74 75 72 6e 20 63 3f 24 69 28 63 2e );return c?$i(c.
00005910: 76 61 6c 75 65 2c 63 2e 64 69 66 66 29 3a 6e 7d value,c.diff):n}
00005920: 29 29 7d 29 28 74 68 69 73 2e 73 74 6f 72 65 2c ))})(this.store,
00005930: 28 28 29 3d 3e 74 68 69 73 2e 67 65 74 43 75 72 (()=>this.getCur
00005940: 72 65 6e 74 50 61 67 65 49 64 28 29 29 29 2c 74 rentPageId())),t
00005950: 68 69 73 2e 5f 70 61 72 65 6e 74 49 64 73 54 6f his._parentIdsTo
00005960: 43 68 69 6c 64 49 64 73 3d 28 65 3d 3e 7b 63 6f ChildIds=(e=>{co
00005970: 6e 73 74 20 74 3d 65 2e 71 75 65 72 79 2e 69 64 nst t=e.query.id
00005980: 73 28 22 73 68 61 70 65 22 29 2c 6e 3d 65 2e 71 s("shape"),n=e.q
00005990: 75 65 72 79 2e 66 69 6c 74 65 72 48 69 73 74 6f uery.filterHisto
000059a0: 72 79 28 22 73 68 61 70 65 22 29 3b 66 75 6e 63 ry("shape");func
000059b0: 74 69 6f 6e 20 72 28 29 7b 63 6f 6e 73 74 20 6e tion r(){const n
000059c0: 3d 7b 7d 2c 72 3d 74 2e 67 65 74 28 29 2c 6f 3d ={},r=t.get(),o=
000059d0: 41 72 72 61 79 28 72 2e 73 69 7a 65 29 3b 72 65 Array(r.size);re
000059e0: 74 75 72 6e 20 72 2e 66 6f 72 45 61 63 68 28 28 turn r.forEach((
000059f0: 74 3d 3e 6f 2e 70 75 73 68 28 65 2e 67 65 74 28 t=>o.push(e.get(
00005a00: 74 29 29 29 29 2c 6f 2e 73 6f 72 74 28 56 6f 29 t)))),o.sort(Vo)
00005a10: 2c 6f 2e 66 6f 72 45 61 63 68 28 28 65 3d 3e 7b ,o.forEach((e=>{
00005a20: 6e 5b 65 2e 70 61 72 65 6e 74 49 64 5d 7c 7c 28 n[e.parentId]||(
00005a30: 6e 5b 65 2e 70 61 72 65 6e 74 49 64 5d 3d 5b 5d n[e.parentId]=[]
00005a40: 29 2c 6e 5b 65 2e 70 61 72 65 6e 74 49 64 5d 2e ),n[e.parentId].
00005a50: 70 75 73 68 28 65 2e 69 64 29 7d 29 29 2c 6e 7d push(e.id)})),n}
00005a60: 72 65 74 75 72 6e 20 6f 61 28 22 70 61 72 65 6e return oa("paren
00005a70: 74 73 54 6f 43 68 69 6c 64 72 65 6e 57 69 74 68 tsToChildrenWith
00005a80: 49 6e 64 65 78 65 73 22 2c 28 28 74 2c 6f 29 3d Indexes",((t,o)=
00005a90: 3e 7b 69 66 28 51 69 28 74 29 29 72 65 74 75 72 >{if(Qi(t))retur
00005aa0: 6e 20 72 28 29 3b 63 6f 6e 73 74 20 69 3d 6e 2e n r();const i=n.
00005ab0: 67 65 74 44 69 66 66 53 69 6e 63 65 28 6f 29 3b getDiffSince(o);
00005ac0: 69 66 28 69 3d 3d 3d 41 69 29 72 65 74 75 72 6e if(i===Ai)return
00005ad0: 20 72 28 29 3b 69 66 28 30 3d 3d 3d 69 2e 6c 65 r();if(0===i.le
00005ae0: 6e 67 74 68 29 72 65 74 75 72 6e 20 74 3b 6c 65 ngth)return t;le
00005af0: 74 20 61 3d 6e 75 6c 6c 3b 63 6f 6e 73 74 20 73 t a=null;const s
00005b00: 3d 65 3d 3e 7b 61 7c 7c 28 61 3d 7b 2e 2e 2e 74 =e=>{a||(a={...t
00005b10: 7d 29 2c 61 5b 65 5d 3f 61 5b 65 5d 3d 3d 3d 74 }),a[e]?a[e]===t
00005b20: 5b 65 5d 26 26 28 61 5b 65 5d 3d 5b 2e 2e 2e 61 [e]&&(a[e]=[...a
00005b30: 5b 65 5d 5d 29 3a 61 5b 65 5d 3d 5b 5d 7d 2c 6c [e]]):a[e]=[]},l
00005b40: 3d 6e 65 77 20 53 65 74 3b 6c 65 74 20 63 3b 66 =new Set;let c;f
00005b50: 6f 72 28 6c 65 74 20 65 3d 30 2c 74 3d 69 2e 6c or(let e=0,t=i.l
00005b60: 65 6e 67 74 68 3b 65 3c 74 3b 65 2b 2b 29 7b 63 ength;e<t;e++){c
00005b70: 3d 69 5b 65 5d 3b 66 6f 72 28 63 6f 6e 73 74 20 =i[e];for(const
00005b80: 65 20 6f 66 20 4f 62 6a 65 63 74 2e 76 61 6c 75 e of Object.valu
00005b90: 65 73 28 63 2e 61 64 64 65 64 29 29 6b 73 28 65 es(c.added))ks(e
00005ba0: 29 26 26 28 73 28 65 2e 70 61 72 65 6e 74 49 64 )&&(s(e.parentId
00005bb0: 29 2c 61 5b 65 2e 70 61 72 65 6e 74 49 64 5d 2e ),a[e.parentId].
00005bc0: 70 75 73 68 28 65 2e 69 64 29 2c 6c 2e 61 64 64 push(e.id),l.add
00005bd0: 28 61 5b 65 2e 70 61 72 65 6e 74 49 64 5d 29 29 (a[e.parentId]))
00005be0: 3b 66 6f 72 28 63 6f 6e 73 74 5b 65 2c 74 5d 6f ;for(const[e,t]o
00005bf0: 66 20 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 f Object.values(
00005c00: 63 2e 75 70 64 61 74 65 64 29 29 69 66 28 6b 73 c.updated))if(ks
00005c10: 28 74 29 26 26 6b 73 28 65 29 29 69 66 28 65 2e (t)&&ks(e))if(e.
00005c20: 70 61 72 65 6e 74 49 64 21 3d 3d 74 2e 70 61 72 parentId!==t.par
00005c30: 65 6e 74 49 64 29 73 28 65 2e 70 61 72 65 6e 74 entId)s(e.parent
00005c40: 49 64 29 2c 73 28 74 2e 70 61 72 65 6e 74 49 64 Id),s(t.parentId
00005c50: 29 2c 61 5b 65 2e 70 61 72 65 6e 74 49 64 5d 2e ),a[e.parentId].
00005c60: 73 70 6c 69 63 65 28 61 5b 65 2e 70 61 72 65 6e splice(a[e.paren
00005c70: 74 49 64 5d 2e 69 6e 64 65 78 4f 66 28 74 2e 69 tId].indexOf(t.i
00005c80: 64 29 2c 31 29 2c 61 5b 74 2e 70 61 72 65 6e 74 d),1),a[t.parent
00005c90: 49 64 5d 2e 70 75 73 68 28 74 2e 69 64 29 2c 6c Id].push(t.id),l
00005ca0: 2e 61 64 64 28 61 5b 74 2e 70 61 72 65 6e 74 49 .add(a[t.parentI
00005cb0: 64 5d 29 3b 65 6c 73 65 20 69 66 28 65 2e 69 6e d]);else if(e.in
00005cc0: 64 65 78 21 3d 3d 74 2e 69 6e 64 65 78 29 7b 73 dex!==t.index){s
00005cd0: 28 74 2e 70 61 72 65 6e 74 49 64 29 3b 63 6f 6e (t.parentId);con
00005ce0: 73 74 20 65 3d 61 5b 74 2e 70 61 72 65 6e 74 49 st e=a[t.parentI
00005cf0: 64 5d 2e 69 6e 64 65 78 4f 66 28 74 2e 69 64 29 d].indexOf(t.id)
00005d00: 3b 61 5b 74 2e 70 61 72 65 6e 74 49 64 5d 5b 65 ;a[t.parentId][e
00005d10: 5d 3d 74 2e 69 64 2c 6c 2e 61 64 64 28 61 5b 74 ]=t.id,l.add(a[t
00005d20: 2e 70 61 72 65 6e 74 49 64 5d 29 7d 66 6f 72 28 .parentId])}for(
00005d30: 63 6f 6e 73 74 20 65 20 6f 66 20 4f 62 6a 65 63 const e of Objec
00005d40: 74 2e 76 61 6c 75 65 73 28 63 2e 72 65 6d 6f 76 t.values(c.remov
00005d50: 65 64 29 29 6b 73 28 65 29 26 26 28 73 28 65 2e ed))ks(e)&&(s(e.
00005d60: 70 61 72 65 6e 74 49 64 29 2c 61 5b 65 2e 70 61 parentId),a[e.pa
00005d70: 72 65 6e 74 49 64 5d 2e 73 70 6c 69 63 65 28 61 rentId].splice(a
00005d80: 5b 65 2e 70 61 72 65 6e 74 49 64 5d 2e 69 6e 64 [e.parentId].ind
00005d90: 65 78 4f 66 28 65 2e 69 64 29 2c 31 29 29 7d 66 exOf(e.id),1))}f
00005da0: 6f 72 28 63 6f 6e 73 74 20 74 20 6f 66 20 6c 29 or(const t of l)
00005db0: 7b 63 6f 6e 73 74 20 6e 3d 6a 72 28 74 2e 6d 61 {const n=jr(t.ma
00005dc0: 70 28 28 74 3d 3e 65 2e 67 65 74 28 74 29 29 29 p((t=>e.get(t)))
00005dd0: 29 3b 6e 2e 73 6f 72 74 28 56 6f 29 2c 74 2e 73 );n.sort(Vo),t.s
00005de0: 70 6c 69 63 65 28 30 2c 74 2e 6c 65 6e 67 74 68 plice(0,t.length
00005df0: 2c 2e 2e 2e 6e 2e 6d 61 70 28 28 65 3d 3e 65 2e ,...n.map((e=>e.
00005e00: 69 64 29 29 29 7d 72 65 74 75 72 6e 20 61 3f 3f id)))}return a??
00005e10: 74 7d 29 29 7d 29 28 74 68 69 73 2e 73 74 6f 72 t}))})(this.stor
00005e20: 65 29 2c 74 68 69 73 2e 64 69 73 70 6f 73 61 62 e),this.disposab
00005e30: 6c 65 73 2e 61 64 64 28 74 68 69 73 2e 73 74 6f les.add(this.sto
00005e40: 72 65 2e 6c 69 73 74 65 6e 28 28 65 3d 3e 7b 74 re.listen((e=>{t
00005e50: 68 69 73 2e 65 6d 69 74 28 22 63 68 61 6e 67 65 his.emit("change
00005e60: 22 2c 65 29 7d 29 29 29 2c 74 68 69 73 2e 64 69 ",e)}))),this.di
00005e70: 73 70 6f 73 61 62 6c 65 73 2e 61 64 64 28 74 68 sposables.add(th
00005e80: 69 73 2e 68 69 73 74 6f 72 79 2e 64 69 73 70 6f is.history.dispo
00005e90: 73 65 29 2c 74 68 69 73 2e 68 69 73 74 6f 72 79 se),this.history
00005ea0: 2e 69 67 6e 6f 72 65 28 28 28 29 3d 3e 7b 74 68 .ignore((()=>{th
00005eb0: 69 73 2e 73 74 6f 72 65 2e 65 6e 73 75 72 65 53 is.store.ensureS
00005ec0: 74 6f 72 65 49 73 55 73 61 62 6c 65 28 29 2c 74 toreIsUsable(),t
00005ed0: 68 69 73 2e 5f 75 70 64 61 74 65 43 75 72 72 65 his._updateCurre
00005ee0: 6e 74 50 61 67 65 53 74 61 74 65 28 7b 65 64 69 ntPageState({edi
00005ef0: 74 69 6e 67 53 68 61 70 65 49 64 3a 6e 75 6c 6c tingShapeId:null
00005f00: 2c 68 6f 76 65 72 65 64 53 68 61 70 65 49 64 3a ,hoveredShapeId:
00005f10: 6e 75 6c 6c 2c 65 72 61 73 69 6e 67 53 68 61 70 null,erasingShap
00005f20: 65 49 64 73 3a 5b 5d 7d 29 7d 29 29 2c 6c 26 26 eIds:[]})})),l&&
00005f30: 76 6f 69 64 20 30 3d 3d 3d 74 68 69 73 2e 72 6f void 0===this.ro
00005f40: 6f 74 2e 63 68 69 6c 64 72 65 6e 5b 6c 5d 29 74 ot.children[l])t
00005f50: 68 72 6f 77 20 45 72 72 6f 72 28 60 4e 6f 20 73 hrow Error(`No s
00005f60: 74 61 74 65 20 66 6f 75 6e 64 20 66 6f 72 20 69 tate found for i
00005f70: 6e 69 74 69 61 6c 53 74 61 74 65 20 22 24 7b 6c nitialState "${l
00005f80: 7d 22 2e 60 29 3b 74 68 69 73 2e 72 6f 6f 74 2e }".`);this.root.
00005f90: 65 6e 74 65 72 28 76 6f 69 64 20 30 2c 22 69 6e enter(void 0,"in
00005fa0: 69 74 69 61 6c 22 29 2c 74 68 69 73 2e 65 64 67 itial"),this.edg
00005fb0: 65 53 63 72 6f 6c 6c 4d 61 6e 61 67 65 72 3d 6e eScrollManager=n
00005fc0: 65 77 20 59 68 28 74 68 69 73 29 2c 74 68 69 73 ew Yh(this),this
00005fd0: 2e 66 6f 63 75 73 4d 61 6e 61 67 65 72 3d 6e 65 .focusManager=ne
00005fe0: 77 20 5a 68 28 74 68 69 73 2c 63 29 2c 74 68 69 w Zh(this,c),thi
00005ff0: 73 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e 61 64 s.disposables.ad
00006000: 64 28 74 68 69 73 2e 66 6f 63 75 73 4d 61 6e 61 d(this.focusMana
00006010: 67 65 72 2e 64 69 73 70 6f 73 65 2e 62 69 6e 64 ger.dispose.bind
00006020: 28 74 68 69 73 2e 66 6f 63 75 73 4d 61 6e 61 67 (this.focusManag
00006030: 65 72 29 29 2c 74 68 69 73 2e 67 65 74 49 6e 73 er)),this.getIns
00006040: 74 61 6e 63 65 53 74 61 74 65 28 29 2e 66 6f 6c tanceState().fol
00006050: 6c 6f 77 69 6e 67 55 73 65 72 49 64 26 26 74 68 lowingUserId&&th
00006060: 69 73 2e 73 74 6f 70 46 6f 6c 6c 6f 77 69 6e 67 is.stopFollowing
00006070: 55 73 65 72 28 29 2c 74 68 69 73 2e 6f 6e 28 22 User(),this.on("
00006080: 74 69 63 6b 22 2c 74 68 69 73 2e 5f 66 6c 75 73 tick",this._flus
00006090: 68 45 76 65 6e 74 73 46 6f 72 54 69 63 6b 29 2c hEventsForTick),
000060a0: 74 68 69 73 2e 74 69 6d 65 72 73 2e 72 65 71 75 this.timers.requ
000060b0: 65 73 74 41 6e 69 6d 61 74 69 6f 6e 46 72 61 6d estAnimationFram
000060c0: 65 28 28 28 29 3d 3e 7b 74 68 69 73 2e 5f 74 69 e((()=>{this._ti
000060d0: 63 6b 4d 61 6e 61 67 65 72 2e 73 74 61 72 74 28 ckManager.start(
000060e0: 29 7d 29 29 2c 74 68 69 73 2e 70 65 72 66 6f 72 )})),this.perfor
000060f0: 6d 61 6e 63 65 54 72 61 63 6b 65 72 3d 6e 65 77 manceTracker=new
00006100: 20 4c 72 7d 6f 70 74 69 6f 6e 73 3b 73 74 6f 72 Lr}options;stor
00006110: 65 3b 72 6f 6f 74 3b 64 69 73 70 6f 73 61 62 6c e;root;disposabl
00006120: 65 73 3d 6e 65 77 20 53 65 74 3b 69 73 44 69 73 es=new Set;isDis
00006130: 70 6f 73 65 64 3d 21 31 3b 5f 74 69 63 6b 4d 61 posed=!1;_tickMa
00006140: 6e 61 67 65 72 3b 73 6e 61 70 73 3b 74 69 6d 65 nager;snaps;time
00006150: 72 73 3b 75 73 65 72 3b 74 65 78 74 4d 65 61 73 rs;user;textMeas
00006160: 75 72 65 3b 65 6e 76 69 72 6f 6e 6d 65 6e 74 3b ure;environment;
00006170: 73 63 72 69 62 62 6c 65 73 3b 73 69 64 65 45 66 scribbles;sideEf
00006180: 66 65 63 74 73 3b 65 64 67 65 53 63 72 6f 6c 6c fects;edgeScroll
00006190: 4d 61 6e 61 67 65 72 3b 66 6f 63 75 73 4d 61 6e Manager;focusMan
000061a0: 61 67 65 72 3b 67 65 74 43 6f 6e 74 61 69 6e 65 ager;getContaine
000061b0: 72 3b 64 69 73 70 6f 73 65 28 29 7b 74 68 69 73 r;dispose(){this
000061c0: 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e 66 6f 72 .disposables.for
000061d0: 45 61 63 68 28 28 65 3d 3e 65 28 29 29 29 2c 74 Each((e=>e())),t
000061e0: 68 69 73 2e 64 69 73 70 6f 73 61 62 6c 65 73 2e his.disposables.
000061f0: 63 6c 65 61 72 28 29 2c 74 68 69 73 2e 69 73 44 clear(),this.isD
00006200: 69 73 70 6f 73 65 64 3d 21 30 7d 73 68 61 70 65 isposed=!0}shape
00006210: 55 74 69 6c 73 3b 73 74 79 6c 65 50 72 6f 70 73 Utils;styleProps
00006220: 3b 67 65 74 53 68 61 70 65 55 74 69 6c 28 65 29 ;getShapeUtil(e)
00006230: 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 {const t="string
00006240: 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e "==typeof e?e:e.
00006250: 74 79 70 65 2c 6e 3d 79 6f 28 74 68 69 73 2e 73 type,n=yo(this.s
00006260: 68 61 70 65 55 74 69 6c 73 2c 74 29 3b 72 65 74 hapeUtils,t);ret
00006270: 75 72 6e 20 57 72 28 6e 2c 60 4e 6f 20 73 68 61 urn Wr(n,`No sha
00006280: 70 65 20 75 74 69 6c 20 66 6f 75 6e 64 20 66 6f pe util found fo
00006290: 72 20 74 79 70 65 20 22 24 7b 74 7d 22 60 29 2c r type "${t}"`),
000062a0: 6e 7d 62 69 6e 64 69 6e 67 55 74 69 6c 73 3b 67 n}bindingUtils;g
000062b0: 65 74 42 69 6e 64 69 6e 67 55 74 69 6c 28 65 29 etBindingUtil(e)
000062c0: 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 {const t="string
000062d0: 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e "==typeof e?e:e.
000062e0: 74 79 70 65 2c 6e 3d 79 6f 28 74 68 69 73 2e 62 type,n=yo(this.b
000062f0: 69 6e 64 69 6e 67 55 74 69 6c 73 2c 74 29 3b 72 indingUtils,t);r
00006300: 65 74 75 72 6e 20 57 72 28 6e 2c 60 4e 6f 20 62 eturn Wr(n,`No b
00006310: 69 6e 64 69 6e 67 20 75 74 69 6c 20 66 6f 75 6e inding util foun
00006320: 64 20 66 6f 72 20 74 79 70 65 20 22 24 7b 74 7d d for type "${t}
00006330: 22 60 29 2c 6e 7d 68 69 73 74 6f 72 79 3b 75 6e "`),n}history;un
00006340: 64 6f 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 do(){return this
00006350: 2e 5f 66 6c 75 73 68 45 76 65 6e 74 73 46 6f 72 ._flushEventsFor
00006360: 54 69 63 6b 28 30 29 2c 74 68 69 73 2e 63 6f 6d Tick(0),this.com
00006370: 70 6c 65 74 65 28 29 2c 74 68 69 73 2e 68 69 73 plete(),this.his
00006380: 74 6f 72 79 2e 75 6e 64 6f 28 29 2c 74 68 69 73 tory.undo(),this
00006390: 7d 67 65 74 43 61 6e 55 6e 64 6f 28 29 7b 72 65 }getCanUndo(){re
000063a0: 74 75 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 turn this.histor
000063b0: 79 2e 67 65 74 4e 75 6d 55 6e 64 6f 73 28 29 3e y.getNumUndos()>
000063c0: 30 7d 72 65 64 6f 28 29 7b 72 65 74 75 72 6e 20 0}redo(){return
000063d0: 74 68 69 73 2e 5f 66 6c 75 73 68 45 76 65 6e 74 this._flushEvent
000063e0: 73 46 6f 72 54 69 63 6b 28 30 29 2c 74 68 69 73 sForTick(0),this
000063f0: 2e 63 6f 6d 70 6c 65 74 65 28 29 2c 74 68 69 73 .complete(),this
00006400: 2e 68 69 73 74 6f 72 79 2e 72 65 64 6f 28 29 2c .history.redo(),
00006410: 74 68 69 73 7d 67 65 74 43 61 6e 52 65 64 6f 28 this}getCanRedo(
00006420: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 ){return this.hi
00006430: 73 74 6f 72 79 2e 67 65 74 4e 75 6d 52 65 64 6f story.getNumRedo
00006440: 73 28 29 3e 30 7d 6d 61 72 6b 28 65 29 7b 72 65 s()>0}mark(e){re
00006450: 74 75 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 turn this.histor
00006460: 79 2e 6d 61 72 6b 28 65 29 2c 74 68 69 73 7d 62 y.mark(e),this}b
00006470: 61 69 6c 28 29 7b 72 65 74 75 72 6e 20 74 68 69 ail(){return thi
00006480: 73 2e 68 69 73 74 6f 72 79 2e 62 61 69 6c 28 29 s.history.bail()
00006490: 2c 74 68 69 73 7d 62 61 69 6c 54 6f 4d 61 72 6b ,this}bailToMark
000064a0: 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e (e){return this.
000064b0: 68 69 73 74 6f 72 79 2e 62 61 69 6c 54 6f 4d 61 history.bailToMa
000064c0: 72 6b 28 65 29 2c 74 68 69 73 7d 62 61 74 63 68 rk(e),this}batch
000064d0: 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 74 68 69 (e,t){return thi
000064e0: 73 2e 68 69 73 74 6f 72 79 2e 62 61 74 63 68 28 s.history.batch(
000064f0: 65 2c 74 29 2c 74 68 69 73 7d 61 6e 6e 6f 74 61 e,t),this}annota
00006500: 74 65 45 72 72 6f 72 28 65 2c 7b 6f 72 69 67 69 teError(e,{origi
00006510: 6e 3a 74 2c 77 69 6c 6c 43 72 61 73 68 41 70 70 n:t,willCrashApp
00006520: 3a 6e 2c 74 61 67 73 3a 72 2c 65 78 74 72 61 73 :n,tags:r,extras
00006530: 3a 6f 7d 29 7b 63 6f 6e 73 74 20 69 3d 74 68 69 :o}){const i=thi
00006540: 73 2e 63 72 65 61 74 65 45 72 72 6f 72 41 6e 6e s.createErrorAnn
00006550: 6f 74 61 74 69 6f 6e 73 28 74 2c 6e 29 3b 72 65 otations(t,n);re
00006560: 74 75 72 6e 20 5a 72 28 65 2c 7b 74 61 67 73 3a turn Zr(e,{tags:
00006570: 7b 2e 2e 2e 69 2e 74 61 67 73 2c 2e 2e 2e 72 7d {...i.tags,...r}
00006580: 2c 65 78 74 72 61 73 3a 7b 2e 2e 2e 69 2e 65 78 ,extras:{...i.ex
00006590: 74 72 61 73 2c 2e 2e 2e 6f 7d 7d 29 2c 6e 26 26 tras,...o}}),n&&
000065a0: 74 68 69 73 2e 73 74 6f 72 65 2e 6d 61 72 6b 41 this.store.markA
000065b0: 73 50 6f 73 73 69 62 6c 79 43 6f 72 72 75 70 74 sPossiblyCorrupt
000065c0: 65 64 28 29 2c 74 68 69 73 7d 63 72 65 61 74 65 ed(),this}create
000065d0: 45 72 72 6f 72 41 6e 6e 6f 74 61 74 69 6f 6e 73 ErrorAnnotations
000065e0: 28 65 2c 74 29 7b 74 72 79 7b 63 6f 6e 73 74 20 (e,t){try{const
000065f0: 6e 3d 74 68 69 73 2e 67 65 74 45 64 69 74 69 6e n=this.getEditin
00006600: 67 53 68 61 70 65 49 64 28 29 3b 72 65 74 75 72 gShapeId();retur
00006610: 6e 7b 74 61 67 73 3a 7b 6f 72 69 67 69 6e 3a 65 n{tags:{origin:e
00006620: 2c 77 69 6c 6c 43 72 61 73 68 41 70 70 3a 74 7d ,willCrashApp:t}
00006630: 2c 65 78 74 72 61 73 3a 7b 61 63 74 69 76 65 53 ,extras:{activeS
00006640: 74 61 74 65 4e 6f 64 65 3a 74 68 69 73 2e 72 6f tateNode:this.ro
00006650: 6f 74 2e 67 65 74 50 61 74 68 28 29 2c 73 65 6c ot.getPath(),sel
00006660: 65 63 74 65 64 53 68 61 70 65 73 3a 74 68 69 73 ectedShapes:this
00006670: 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 .getSelectedShap
00006680: 65 73 28 29 2c 65 64 69 74 69 6e 67 53 68 61 70 es(),editingShap
00006690: 65 3a 6e 3f 74 68 69 73 2e 67 65 74 53 68 61 70 e:n?this.getShap
000066a0: 65 28 6e 29 3a 76 6f 69 64 20 30 2c 69 6e 70 75 e(n):void 0,inpu
000066b0: 74 73 3a 74 68 69 73 2e 69 6e 70 75 74 73 7d 7d ts:this.inputs}}
000066c0: 7d 63 61 74 63 68 7b 72 65 74 75 72 6e 7b 74 61 }catch{return{ta
000066d0: 67 73 3a 7b 6f 72 69 67 69 6e 3a 65 2c 77 69 6c gs:{origin:e,wil
000066e0: 6c 43 72 61 73 68 41 70 70 3a 74 7d 2c 65 78 74 lCrashApp:t},ext
000066f0: 72 61 73 3a 7b 7d 7d 7d 7d 5f 63 72 61 73 68 69 ras:{}}}}_crashi
00006700: 6e 67 45 72 72 6f 72 3d 6e 75 6c 6c 3b 67 65 74 ngError=null;get
00006710: 43 72 61 73 68 69 6e 67 45 72 72 6f 72 28 29 7b CrashingError(){
00006720: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 63 72 61 return this._cra
00006730: 73 68 69 6e 67 45 72 72 6f 72 7d 63 72 61 73 68 shingError}crash
00006740: 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e (e){return this.
00006750: 5f 63 72 61 73 68 69 6e 67 45 72 72 6f 72 3d 65 _crashingError=e
00006760: 2c 74 68 69 73 2e 73 74 6f 72 65 2e 6d 61 72 6b ,this.store.mark
00006770: 41 73 50 6f 73 73 69 62 6c 79 43 6f 72 72 75 70 AsPossiblyCorrup
00006780: 74 65 64 28 29 2c 74 68 69 73 2e 65 6d 69 74 28 ted(),this.emit(
00006790: 22 63 72 61 73 68 22 2c 7b 65 72 72 6f 72 3a 65 "crash",{error:e
000067a0: 7d 29 2c 74 68 69 73 7d 67 65 74 50 61 74 68 28 }),this}getPath(
000067b0: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 72 6f ){return this.ro
000067c0: 6f 74 2e 67 65 74 50 61 74 68 28 29 2e 73 70 6c ot.getPath().spl
000067d0: 69 74 28 22 72 6f 6f 74 2e 22 29 5b 31 5d 7d 69 it("root.")[1]}i
000067e0: 73 49 6e 28 65 29 7b 63 6f 6e 73 74 20 74 3d 65 sIn(e){const t=e
000067f0: 2e 73 70 6c 69 74 28 22 2e 22 29 2e 72 65 76 65 .split(".").reve
00006800: 72 73 65 28 29 3b 6c 65 74 20 6e 3d 74 68 69 73 rse();let n=this
00006810: 2e 72 6f 6f 74 3b 66 6f 72 28 3b 74 2e 6c 65 6e .root;for(;t.len
00006820: 67 74 68 3e 30 3b 29 7b 63 6f 6e 73 74 20 65 3d gth>0;){const e=
00006830: 74 2e 70 6f 70 28 29 3b 69 66 28 21 65 29 72 65 t.pop();if(!e)re
00006840: 74 75 72 6e 21 30 3b 63 6f 6e 73 74 20 72 3d 6e turn!0;const r=n
00006850: 2e 67 65 74 43 75 72 72 65 6e 74 28 29 3b 69 66 .getCurrent();if
00006860: 28 72 3f 2e 69 64 21 3d 3d 65 29 72 65 74 75 72 (r?.id!==e)retur
00006870: 6e 21 31 3b 69 66 28 30 3d 3d 3d 74 2e 6c 65 6e n!1;if(0===t.len
00006880: 67 74 68 29 72 65 74 75 72 6e 21 30 3b 6e 3d 72 gth)return!0;n=r
00006890: 7d 72 65 74 75 72 6e 21 31 7d 69 73 49 6e 41 6e }return!1}isInAn
000068a0: 79 28 2e 2e 2e 65 29 7b 72 65 74 75 72 6e 20 65 y(...e){return e
000068b0: 2e 73 6f 6d 65 28 28 65 3d 3e 74 68 69 73 2e 69 .some((e=>this.i
000068c0: 73 49 6e 28 65 29 29 29 7d 73 65 74 43 75 72 72 sIn(e)))}setCurr
000068d0: 65 6e 74 54 6f 6f 6c 28 65 2c 74 3d 7b 7d 29 7b entTool(e,t={}){
000068e0: 72 65 74 75 72 6e 20 74 68 69 73 2e 72 6f 6f 74 return this.root
000068f0: 2e 74 72 61 6e 73 69 74 69 6f 6e 28 65 2c 74 29 .transition(e,t)
00006900: 2c 74 68 69 73 7d 67 65 74 43 75 72 72 65 6e 74 ,this}getCurrent
00006910: 54 6f 6f 6c 28 29 7b 72 65 74 75 72 6e 20 74 68 Tool(){return th
00006920: 69 73 2e 72 6f 6f 74 2e 67 65 74 43 75 72 72 65 is.root.getCurre
00006930: 6e 74 28 29 7d 67 65 74 43 75 72 72 65 6e 74 54 nt()}getCurrentT
00006940: 6f 6f 6c 49 64 28 29 7b 63 6f 6e 73 74 20 65 3d oolId(){const e=
00006950: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 54 this.getCurrentT
00006960: 6f 6f 6c 28 29 3b 72 65 74 75 72 6e 20 65 3f 65 ool();return e?e
00006970: 2e 67 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 49 .getCurrentToolI
00006980: 64 4d 61 73 6b 28 29 3f 3f 65 2e 69 64 3a 22 22 dMask()??e.id:""
00006990: 7d 67 65 74 53 74 61 74 65 44 65 73 63 65 6e 64 }getStateDescend
000069a0: 61 6e 74 28 65 29 7b 63 6f 6e 73 74 20 74 3d 65 ant(e){const t=e
000069b0: 2e 73 70 6c 69 74 28 22 2e 22 29 2e 72 65 76 65 .split(".").reve
000069c0: 72 73 65 28 29 3b 6c 65 74 20 6e 3d 74 68 69 73 rse();let n=this
000069d0: 2e 72 6f 6f 74 3b 66 6f 72 28 3b 74 2e 6c 65 6e .root;for(;t.len
000069e0: 67 74 68 3e 30 3b 29 7b 63 6f 6e 73 74 20 65 3d gth>0;){const e=
000069f0: 74 2e 70 6f 70 28 29 3b 69 66 28 21 65 29 72 65 t.pop();if(!e)re
00006a00: 74 75 72 6e 20 6e 3b 63 6f 6e 73 74 20 72 3d 6e turn n;const r=n
00006a10: 2e 63 68 69 6c 64 72 65 6e 3f 2e 5b 65 5d 3b 69 .children?.[e];i
00006a20: 66 28 21 72 29 72 65 74 75 72 6e 3b 6e 3d 72 7d f(!r)return;n=r}
00006a30: 72 65 74 75 72 6e 20 6e 7d 67 65 74 44 6f 63 75 return n}getDocu
00006a40: 6d 65 6e 74 53 65 74 74 69 6e 67 73 28 29 7b 72 mentSettings(){r
00006a50: 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 eturn this.store
00006a60: 2e 67 65 74 28 4d 6c 29 7d 75 70 64 61 74 65 44 .get(Ml)}updateD
00006a70: 6f 63 75 6d 65 6e 74 53 65 74 74 69 6e 67 73 28 ocumentSettings(
00006a80: 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 68 e){return this.h
00006a90: 69 73 74 6f 72 79 2e 69 67 6e 6f 72 65 28 28 28 istory.ignore(((
00006aa0: 29 3d 3e 7b 74 68 69 73 2e 73 74 6f 72 65 2e 70 )=>{this.store.p
00006ab0: 75 74 28 5b 7b 2e 2e 2e 74 68 69 73 2e 67 65 74 ut([{...this.get
00006ac0: 44 6f 63 75 6d 65 6e 74 53 65 74 74 69 6e 67 73 DocumentSettings
00006ad0: 28 29 2c 2e 2e 2e 65 7d 5d 29 7d 29 29 2c 74 68 (),...e}])})),th
00006ae0: 69 73 7d 67 65 74 49 6e 73 74 61 6e 63 65 53 74 is}getInstanceSt
00006af0: 61 74 65 28 29 7b 72 65 74 75 72 6e 20 74 68 69 ate(){return thi
00006b00: 73 2e 73 74 6f 72 65 2e 67 65 74 28 62 6c 29 7d s.store.get(bl)}
00006b10: 75 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 updateInstanceSt
00006b20: 61 74 65 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 ate(e,t){return
00006b30: 74 68 69 73 2e 5f 75 70 64 61 74 65 49 6e 73 74 this._updateInst
00006b40: 61 6e 63 65 53 74 61 74 65 28 65 2c 7b 68 69 73 anceState(e,{his
00006b50: 74 6f 72 79 3a 22 69 67 6e 6f 72 65 22 2c 2e 2e tory:"ignore",..
00006b60: 2e 74 7d 29 2c 76 6f 69 64 20 30 21 3d 3d 65 2e .t}),void 0!==e.
00006b70: 69 73 43 68 61 6e 67 69 6e 67 53 74 79 6c 65 26 isChangingStyle&
00006b80: 26 28 63 6c 65 61 72 54 69 6d 65 6f 75 74 28 74 &(clearTimeout(t
00006b90: 68 69 73 2e 5f 69 73 43 68 61 6e 67 69 6e 67 53 his._isChangingS
00006ba0: 74 79 6c 65 54 69 6d 65 6f 75 74 29 2c 21 30 3d tyleTimeout),!0=
00006bb0: 3d 3d 65 2e 69 73 43 68 61 6e 67 69 6e 67 53 74 ==e.isChangingSt
00006bc0: 79 6c 65 26 26 28 74 68 69 73 2e 5f 69 73 43 68 yle&&(this._isCh
00006bd0: 61 6e 67 69 6e 67 53 74 79 6c 65 54 69 6d 65 6f angingStyleTimeo
00006be0: 75 74 3d 74 68 69 73 2e 74 69 6d 65 72 73 2e 73 ut=this.timers.s
00006bf0: 65 74 54 69 6d 65 6f 75 74 28 28 28 29 3d 3e 7b etTimeout((()=>{
00006c00: 74 68 69 73 2e 5f 75 70 64 61 74 65 49 6e 73 74 this._updateInst
00006c10: 61 6e 63 65 53 74 61 74 65 28 7b 69 73 43 68 61 anceState({isCha
00006c20: 6e 67 69 6e 67 53 74 79 6c 65 3a 21 31 7d 2c 7b ngingStyle:!1},{
00006c30: 68 69 73 74 6f 72 79 3a 22 69 67 6e 6f 72 65 22 history:"ignore"
00006c40: 7d 29 7d 29 2c 32 65 33 29 29 29 2c 74 68 69 73 })}),2e3))),this
00006c50: 7d 5f 75 70 64 61 74 65 49 6e 73 74 61 6e 63 65 }_updateInstance
00006c60: 53 74 61 74 65 3d 28 65 2c 74 29 3d 3e 7b 74 68 State=(e,t)=>{th
00006c70: 69 73 2e 62 61 74 63 68 28 28 28 29 3d 3e 7b 74 is.batch((()=>{t
00006c80: 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 5b 7b his.store.put([{
00006c90: 2e 2e 2e 74 68 69 73 2e 67 65 74 49 6e 73 74 61 ...this.getInsta
00006ca0: 6e 63 65 53 74 61 74 65 28 29 2c 2e 2e 2e 65 7d nceState(),...e}
00006cb0: 5d 29 7d 29 2c 74 29 7d 3b 5f 69 73 43 68 61 6e ])}),t)};_isChan
00006cc0: 67 69 6e 67 53 74 79 6c 65 54 69 6d 65 6f 75 74 gingStyleTimeout
00006cd0: 3d 2d 31 3b 67 65 74 4f 70 65 6e 4d 65 6e 75 73 =-1;getOpenMenus
00006ce0: 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 67 (){return this.g
00006cf0: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00006d00: 29 2e 6f 70 65 6e 4d 65 6e 75 73 7d 61 64 64 4f ).openMenus}addO
00006d10: 70 65 6e 4d 65 6e 75 28 65 29 7b 63 6f 6e 73 74 penMenu(e){const
00006d20: 20 74 3d 6e 65 77 20 53 65 74 28 74 68 69 73 2e t=new Set(this.
00006d30: 67 65 74 4f 70 65 6e 4d 65 6e 75 73 28 29 29 3b getOpenMenus());
00006d40: 72 65 74 75 72 6e 20 74 2e 68 61 73 28 65 29 7c return t.has(e)|
00006d50: 7c 28 74 2e 61 64 64 28 65 29 2c 74 68 69 73 2e |(t.add(e),this.
00006d60: 75 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 updateInstanceSt
00006d70: 61 74 65 28 7b 6f 70 65 6e 4d 65 6e 75 73 3a 5b ate({openMenus:[
00006d80: 2e 2e 2e 74 5d 7d 29 29 2c 74 68 69 73 7d 64 65 ...t]})),this}de
00006d90: 6c 65 74 65 4f 70 65 6e 4d 65 6e 75 28 65 29 7b leteOpenMenu(e){
00006da0: 63 6f 6e 73 74 20 74 3d 6e 65 77 20 53 65 74 28 const t=new Set(
00006db0: 74 68 69 73 2e 67 65 74 4f 70 65 6e 4d 65 6e 75 this.getOpenMenu
00006dc0: 73 28 29 29 3b 72 65 74 75 72 6e 20 74 2e 68 61 s());return t.ha
00006dd0: 73 28 65 29 26 26 28 74 2e 64 65 6c 65 74 65 28 s(e)&&(t.delete(
00006de0: 65 29 2c 74 68 69 73 2e 75 70 64 61 74 65 49 6e e),this.updateIn
00006df0: 73 74 61 6e 63 65 53 74 61 74 65 28 7b 6f 70 65 stanceState({ope
00006e00: 6e 4d 65 6e 75 73 3a 5b 2e 2e 2e 74 5d 7d 29 29 nMenus:[...t]}))
00006e10: 2c 74 68 69 73 7d 63 6c 65 61 72 4f 70 65 6e 4d ,this}clearOpenM
00006e20: 65 6e 75 73 28 29 7b 72 65 74 75 72 6e 20 74 68 enus(){return th
00006e30: 69 73 2e 67 65 74 4f 70 65 6e 4d 65 6e 75 73 28 is.getOpenMenus(
00006e40: 29 2e 6c 65 6e 67 74 68 26 26 74 68 69 73 2e 75 ).length&&this.u
00006e50: 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 61 pdateInstanceSta
00006e60: 74 65 28 7b 6f 70 65 6e 4d 65 6e 75 73 3a 5b 5d te({openMenus:[]
00006e70: 7d 29 2c 74 68 69 73 7d 67 65 74 49 73 4d 65 6e }),this}getIsMen
00006e80: 75 4f 70 65 6e 28 29 7b 72 65 74 75 72 6e 20 74 uOpen(){return t
00006e90: 68 69 73 2e 67 65 74 4f 70 65 6e 4d 65 6e 75 73 his.getOpenMenus
00006ea0: 28 29 2e 6c 65 6e 67 74 68 3e 30 7d 73 65 74 43 ().length>0}setC
00006eb0: 75 72 73 6f 72 3d 65 3d 3e 28 74 68 69 73 2e 75 ursor=e=>(this.u
00006ec0: 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 61 pdateInstanceSta
00006ed0: 74 65 28 7b 63 75 72 73 6f 72 3a 7b 2e 2e 2e 74 te({cursor:{...t
00006ee0: 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 his.getInstanceS
00006ef0: 74 61 74 65 28 29 2e 63 75 72 73 6f 72 2c 2e 2e tate().cursor,..
00006f00: 2e 65 7d 7d 29 2c 74 68 69 73 29 3b 67 65 74 50 .e}}),this);getP
00006f10: 61 67 65 53 74 61 74 65 73 28 29 7b 72 65 74 75 ageStates(){retu
00006f20: 72 6e 20 74 68 69 73 2e 5f 67 65 74 50 61 67 65 rn this._getPage
00006f30: 53 74 61 74 65 73 51 75 65 72 79 28 29 2e 67 65 StatesQuery().ge
00006f40: 74 28 29 7d 5f 67 65 74 50 61 67 65 53 74 61 74 t()}_getPageStat
00006f50: 65 73 51 75 65 72 79 28 29 7b 72 65 74 75 72 6e esQuery(){return
00006f60: 20 74 68 69 73 2e 73 74 6f 72 65 2e 71 75 65 72 this.store.quer
00006f70: 79 2e 72 65 63 6f 72 64 73 28 22 69 6e 73 74 61 y.records("insta
00006f80: 6e 63 65 5f 70 61 67 65 5f 73 74 61 74 65 22 29 nce_page_state")
00006f90: 7d 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 }getCurrentPageS
00006fa0: 74 61 74 65 28 29 7b 72 65 74 75 72 6e 20 74 68 tate(){return th
00006fb0: 69 73 2e 73 74 6f 72 65 2e 67 65 74 28 74 68 69 is.store.get(thi
00006fc0: 73 2e 5f 67 65 74 43 75 72 72 65 6e 74 50 61 67 s._getCurrentPag
00006fd0: 65 53 74 61 74 65 49 64 28 29 29 7d 5f 67 65 74 eStateId())}_get
00006fe0: 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 CurrentPageState
00006ff0: 49 64 28 29 7b 72 65 74 75 72 6e 20 5f 6c 2e 63 Id(){return _l.c
00007000: 72 65 61 74 65 49 64 28 74 68 69 73 2e 67 65 74 reateId(this.get
00007010: 43 75 72 72 65 6e 74 50 61 67 65 49 64 28 29 29 CurrentPageId())
00007020: 7d 75 70 64 61 74 65 43 75 72 72 65 6e 74 50 61 }updateCurrentPa
00007030: 67 65 53 74 61 74 65 28 65 2c 74 29 7b 72 65 74 geState(e,t){ret
00007040: 75 72 6e 20 74 68 69 73 2e 5f 75 70 64 61 74 65 urn this._update
00007050: 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 CurrentPageState
00007060: 28 65 2c 74 29 2c 74 68 69 73 7d 5f 75 70 64 61 (e,t),this}_upda
00007070: 74 65 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 teCurrentPageSta
00007080: 74 65 3d 28 65 2c 74 29 3d 3e 7b 74 68 69 73 2e te=(e,t)=>{this.
00007090: 62 61 74 63 68 28 28 28 29 3d 3e 7b 74 68 69 73 batch((()=>{this
000070a0: 2e 73 74 6f 72 65 2e 75 70 64 61 74 65 28 65 2e .store.update(e.
000070b0: 69 64 3f 3f 74 68 69 73 2e 67 65 74 43 75 72 72 id??this.getCurr
000070c0: 65 6e 74 50 61 67 65 53 74 61 74 65 28 29 2e 69 entPageState().i
000070d0: 64 2c 28 74 3d 3e 28 7b 2e 2e 2e 74 2c 2e 2e 2e d,(t=>({...t,...
000070e0: 65 7d 29 29 29 7d 29 2c 7b 68 69 73 74 6f 72 79 e})))}),{history
000070f0: 3a 22 69 67 6e 6f 72 65 22 2c 2e 2e 2e 74 7d 29 :"ignore",...t})
00007100: 7d 3b 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 };getSelectedSha
00007110: 70 65 49 64 73 28 29 7b 72 65 74 75 72 6e 20 74 peIds(){return t
00007120: 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 his.getCurrentPa
00007130: 67 65 53 74 61 74 65 28 29 2e 73 65 6c 65 63 74 geState().select
00007140: 65 64 53 68 61 70 65 49 64 73 7d 67 65 74 53 65 edShapeIds}getSe
00007150: 6c 65 63 74 65 64 53 68 61 70 65 73 28 29 7b 63 lectedShapes(){c
00007160: 6f 6e 73 74 7b 73 65 6c 65 63 74 65 64 53 68 61 onst{selectedSha
00007170: 70 65 49 64 73 3a 65 7d 3d 74 68 69 73 2e 67 65 peIds:e}=this.ge
00007180: 74 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 tCurrentPageStat
00007190: 65 28 29 3b 72 65 74 75 72 6e 20 6a 72 28 65 2e e();return jr(e.
000071a0: 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 73 74 6f map((e=>this.sto
000071b0: 72 65 2e 67 65 74 28 65 29 29 29 29 7d 73 65 74 re.get(e))))}set
000071c0: 53 65 6c 65 63 74 65 64 53 68 61 70 65 73 28 65 SelectedShapes(e
000071d0: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 62 61 ){return this.ba
000071e0: 74 63 68 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 20 tch((()=>{const
000071f0: 74 3d 65 2e 6d 61 70 28 28 65 3d 3e 22 73 74 72 t=e.map((e=>"str
00007200: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 ing"==typeof e?e
00007210: 3a 65 2e 69 64 29 29 2c 7b 73 65 6c 65 63 74 65 :e.id)),{selecte
00007220: 64 53 68 61 70 65 49 64 73 3a 6e 7d 3d 74 68 69 dShapeIds:n}=thi
00007230: 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 s.getCurrentPage
00007240: 53 74 61 74 65 28 29 2c 72 3d 6e 65 77 20 53 65 State(),r=new Se
00007250: 74 28 6e 29 3b 69 66 28 74 2e 6c 65 6e 67 74 68 t(n);if(t.length
00007260: 3d 3d 3d 72 2e 73 69 7a 65 26 26 74 2e 65 76 65 ===r.size&&t.eve
00007270: 72 79 28 28 65 3d 3e 72 2e 68 61 73 28 65 29 29 ry((e=>r.has(e))
00007280: 29 29 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 74 68 ))return null;th
00007290: 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 5b 7b 2e is.store.put([{.
000072a0: 2e 2e 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e ..this.getCurren
000072b0: 74 50 61 67 65 53 74 61 74 65 28 29 2c 73 65 6c tPageState(),sel
000072c0: 65 63 74 65 64 53 68 61 70 65 49 64 73 3a 74 7d ectedShapeIds:t}
000072d0: 5d 29 7d 29 2c 7b 68 69 73 74 6f 72 79 3a 22 72 ])}),{history:"r
000072e0: 65 63 6f 72 64 2d 70 72 65 73 65 72 76 65 52 65 ecord-preserveRe
000072f0: 64 6f 53 74 61 63 6b 22 7d 29 7d 69 73 41 6e 63 doStack"})}isAnc
00007300: 65 73 74 6f 72 53 65 6c 65 63 74 65 64 28 65 29 estorSelected(e)
00007310: 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 {const t="string
00007320: 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 3f "==typeof e?e:e?
00007330: 2e 69 64 3f 3f 6e 75 6c 6c 2c 6e 3d 74 68 69 73 .id??null,n=this
00007340: 2e 67 65 74 53 68 61 70 65 28 74 29 3b 69 66 28 .getShape(t);if(
00007350: 21 6e 29 72 65 74 75 72 6e 21 31 3b 63 6f 6e 73 !n)return!1;cons
00007360: 74 20 72 3d 74 68 69 73 2e 67 65 74 53 65 6c 65 t r=this.getSele
00007370: 63 74 65 64 53 68 61 70 65 49 64 73 28 29 3b 72 ctedShapeIds();r
00007380: 65 74 75 72 6e 21 21 74 68 69 73 2e 66 69 6e 64 eturn!!this.find
00007390: 53 68 61 70 65 41 6e 63 65 73 74 6f 72 28 6e 2c ShapeAncestor(n,
000073a0: 28 65 3d 3e 72 2e 69 6e 63 6c 75 64 65 73 28 65 (e=>r.includes(e
000073b0: 2e 69 64 29 29 29 7d 73 65 6c 65 63 74 28 2e 2e .id)))}select(..
000073c0: 2e 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 .e){const t="str
000073d0: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 ing"==typeof e[0
000073e0: 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e ]?e:e.map((e=>e.
000073f0: 69 64 29 29 3b 72 65 74 75 72 6e 20 74 68 69 73 id));return this
00007400: 2e 73 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 .setSelectedShap
00007410: 65 73 28 74 29 2c 74 68 69 73 7d 64 65 73 65 6c es(t),this}desel
00007420: 65 63 74 28 2e 2e 2e 65 29 7b 63 6f 6e 73 74 20 ect(...e){const
00007430: 74 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 t="string"==type
00007440: 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 of e[0]?e:e.map(
00007450: 28 65 3d 3e 65 2e 69 64 29 29 2c 6e 3d 74 68 69 (e=>e.id)),n=thi
00007460: 73 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 s.getSelectedSha
00007470: 70 65 49 64 73 28 29 3b 72 65 74 75 72 6e 20 6e peIds();return n
00007480: 2e 6c 65 6e 67 74 68 3e 30 26 26 74 2e 6c 65 6e .length>0&&t.len
00007490: 67 74 68 3e 30 26 26 74 68 69 73 2e 73 65 74 53 gth>0&&this.setS
000074a0: 65 6c 65 63 74 65 64 53 68 61 70 65 73 28 6e 2e electedShapes(n.
000074b0: 66 69 6c 74 65 72 28 28 65 3d 3e 21 74 2e 69 6e filter((e=>!t.in
000074c0: 63 6c 75 64 65 73 28 65 29 29 29 29 2c 74 68 69 cludes(e)))),thi
000074d0: 73 7d 73 65 6c 65 63 74 41 6c 6c 28 29 7b 63 6f s}selectAll(){co
000074e0: 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 53 6f nst e=this.getSo
000074f0: 72 74 65 64 43 68 69 6c 64 49 64 73 46 6f 72 50 rtedChildIdsForP
00007500: 61 72 65 6e 74 28 74 68 69 73 2e 67 65 74 43 75 arent(this.getCu
00007510: 72 72 65 6e 74 50 61 67 65 49 64 28 29 29 3b 72 rrentPageId());r
00007520: 65 74 75 72 6e 20 65 2e 6c 65 6e 67 74 68 3c 3d eturn e.length<=
00007530: 30 7c 7c 74 68 69 73 2e 73 65 74 53 65 6c 65 63 0||this.setSelec
00007540: 74 65 64 53 68 61 70 65 73 28 74 68 69 73 2e 5f tedShapes(this._
00007550: 67 65 74 55 6e 6c 6f 63 6b 65 64 53 68 61 70 65 getUnlockedShape
00007560: 49 64 73 28 65 29 29 2c 74 68 69 73 7d 73 65 6c Ids(e)),this}sel
00007570: 65 63 74 4e 6f 6e 65 28 29 7b 72 65 74 75 72 6e ectNone(){return
00007580: 20 74 68 69 73 2e 67 65 74 53 65 6c 65 63 74 65 this.getSelecte
00007590: 64 53 68 61 70 65 49 64 73 28 29 2e 6c 65 6e 67 dShapeIds().leng
000075a0: 74 68 3e 30 26 26 74 68 69 73 2e 73 65 74 53 65 th>0&&this.setSe
000075b0: 6c 65 63 74 65 64 53 68 61 70 65 73 28 5b 5d 29 lectedShapes([])
000075c0: 2c 74 68 69 73 7d 67 65 74 4f 6e 6c 79 53 65 6c ,this}getOnlySel
000075d0: 65 63 74 65 64 53 68 61 70 65 49 64 28 29 7b 72 ectedShapeId(){r
000075e0: 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 4f 6e eturn this.getOn
000075f0: 6c 79 53 65 6c 65 63 74 65 64 53 68 61 70 65 28 lySelectedShape(
00007600: 29 3f 2e 69 64 3f 3f 6e 75 6c 6c 7d 67 65 74 4f )?.id??null}getO
00007610: 6e 6c 79 53 65 6c 65 63 74 65 64 53 68 61 70 65 nlySelectedShape
00007620: 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e (){const e=this.
00007630: 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 65 getSelectedShape
00007640: 73 28 29 3b 72 65 74 75 72 6e 20 31 3d 3d 3d 65 s();return 1===e
00007650: 2e 6c 65 6e 67 74 68 3f 65 5b 30 5d 3a 6e 75 6c .length?e[0]:nul
00007660: 6c 7d 67 65 74 53 65 6c 65 63 74 69 6f 6e 50 61 l}getSelectionPa
00007670: 67 65 42 6f 75 6e 64 73 28 29 7b 63 6f 6e 73 74 geBounds(){const
00007680: 20 65 3d 74 68 69 73 2e 67 65 74 43 75 72 72 65 e=this.getCurre
00007690: 6e 74 50 61 67 65 53 74 61 74 65 28 29 2e 73 65 ntPageState().se
000076a0: 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 3b 72 lectedShapeIds;r
000076b0: 65 74 75 72 6e 20 30 3d 3d 3d 65 2e 6c 65 6e 67 eturn 0===e.leng
000076c0: 74 68 3f 6e 75 6c 6c 3a 5f 70 2e 43 6f 6d 6d 6f th?null:_p.Commo
000076d0: 6e 28 6a 72 28 65 2e 6d 61 70 28 28 65 3d 3e 74 n(jr(e.map((e=>t
000076e0: 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 his.getShapePage
000076f0: 42 6f 75 6e 64 73 28 65 29 29 29 29 29 7d 67 65 Bounds(e)))))}ge
00007700: 74 53 65 6c 65 63 74 69 6f 6e 52 6f 74 61 74 69 tSelectionRotati
00007710: 6f 6e 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 on(){const e=thi
00007720: 73 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 s.getSelectedSha
00007730: 70 65 49 64 73 28 29 3b 6c 65 74 20 74 3d 21 31 peIds();let t=!1
00007740: 2c 6e 3d 30 3b 66 6f 72 28 6c 65 74 20 72 3d 30 ,n=0;for(let r=0
00007750: 2c 6f 3d 65 2e 6c 65 6e 67 74 68 3b 72 3c 6f 3b ,o=e.length;r<o;
00007760: 72 2b 2b 29 7b 63 6f 6e 73 74 20 6f 3d 74 68 69 r++){const o=thi
00007770: 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 72 s.getShapePageTr
00007780: 61 6e 73 66 6f 72 6d 28 65 5b 72 5d 29 3b 69 66 ansform(e[r]);if
00007790: 28 6f 29 69 66 28 74 29 7b 69 66 28 6f 2e 72 6f (o)if(t){if(o.ro
000077a0: 74 61 74 69 6f 6e 28 29 21 3d 3d 6e 29 72 65 74 tation()!==n)ret
000077b0: 75 72 6e 20 30 7d 65 6c 73 65 20 74 3d 21 30 2c urn 0}else t=!0,
000077c0: 6e 3d 6f 2e 72 6f 74 61 74 69 6f 6e 28 29 7d 72 n=o.rotation()}r
000077d0: 65 74 75 72 6e 20 6e 7d 67 65 74 53 65 6c 65 63 eturn n}getSelec
000077e0: 74 69 6f 6e 52 6f 74 61 74 65 64 50 61 67 65 42 tionRotatedPageB
000077f0: 6f 75 6e 64 73 28 29 7b 63 6f 6e 73 74 20 65 3d ounds(){const e=
00007800: 74 68 69 73 2e 67 65 74 53 65 6c 65 63 74 65 64 this.getSelected
00007810: 53 68 61 70 65 49 64 73 28 29 3b 69 66 28 30 3d ShapeIds();if(0=
00007820: 3d 3d 65 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 ==e.length)retur
00007830: 6e 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 n;const t=this.g
00007840: 65 74 53 65 6c 65 63 74 69 6f 6e 52 6f 74 61 74 etSelectionRotat
00007850: 69 6f 6e 28 29 3b 69 66 28 30 3d 3d 3d 74 29 72 ion();if(0===t)r
00007860: 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 53 65 eturn this.getSe
00007870: 6c 65 63 74 69 6f 6e 50 61 67 65 42 6f 75 6e 64 lectionPageBound
00007880: 73 28 29 3b 69 66 28 31 3d 3d 3d 65 2e 6c 65 6e s();if(1===e.len
00007890: 67 74 68 29 7b 63 6f 6e 73 74 20 74 3d 74 68 69 gth){const t=thi
000078a0: 73 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 s.getShapeGeomet
000078b0: 72 79 28 65 5b 30 5d 29 2e 62 6f 75 6e 64 73 2e ry(e[0]).bounds.
000078c0: 63 6c 6f 6e 65 28 29 2c 6e 3d 74 68 69 73 2e 67 clone(),n=this.g
000078d0: 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 etShapePageTrans
000078e0: 66 6f 72 6d 28 65 5b 30 5d 29 3b 72 65 74 75 72 form(e[0]);retur
000078f0: 6e 20 74 2e 70 6f 69 6e 74 3d 6e 2e 61 70 70 6c n t.point=n.appl
00007900: 79 54 6f 50 6f 69 6e 74 28 74 2e 70 6f 69 6e 74 yToPoint(t.point
00007910: 29 2c 74 7d 63 6f 6e 73 74 20 6e 3d 5f 70 2e 46 ),t}const n=_p.F
00007920: 72 6f 6d 50 6f 69 6e 74 73 28 74 68 69 73 2e 67 romPoints(this.g
00007930: 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 65 49 etSelectedShapeI
00007940: 64 73 28 29 2e 66 6c 61 74 4d 61 70 28 28 65 3d ds().flatMap((e=
00007950: 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 >{const t=this.g
00007960: 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 etShapePageTrans
00007970: 66 6f 72 6d 28 65 29 3b 72 65 74 75 72 6e 20 74 form(e);return t
00007980: 3f 74 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 73 ?t.applyToPoints
00007990: 28 74 68 69 73 2e 67 65 74 53 68 61 70 65 47 65 (this.getShapeGe
000079a0: 6f 6d 65 74 72 79 28 65 29 2e 62 6f 75 6e 64 73 ometry(e).bounds
000079b0: 2e 63 6f 72 6e 65 72 73 29 3a 5b 5d 7d 29 29 2e .corners):[]})).
000079c0: 6d 61 70 28 28 65 3d 3e 65 2e 72 6f 74 28 2d 74 map((e=>e.rot(-t
000079d0: 29 29 29 29 3b 72 65 74 75 72 6e 20 6e 2e 70 6f ))));return n.po
000079e0: 69 6e 74 3d 6e 2e 70 6f 69 6e 74 2e 72 6f 74 28 int=n.point.rot(
000079f0: 74 29 2c 6e 7d 67 65 74 53 65 6c 65 63 74 69 6f t),n}getSelectio
00007a00: 6e 52 6f 74 61 74 65 64 53 63 72 65 65 6e 42 6f nRotatedScreenBo
00007a10: 75 6e 64 73 28 29 7b 63 6f 6e 73 74 20 65 3d 74 unds(){const e=t
00007a20: 68 69 73 2e 67 65 74 53 65 6c 65 63 74 69 6f 6e his.getSelection
00007a30: 52 6f 74 61 74 65 64 50 61 67 65 42 6f 75 6e 64 RotatedPageBound
00007a40: 73 28 29 3b 69 66 28 21 65 29 72 65 74 75 72 6e s();if(!e)return
00007a50: 3b 63 6f 6e 73 74 7b 78 3a 74 2c 79 3a 6e 7d 3d ;const{x:t,y:n}=
00007a60: 74 68 69 73 2e 70 61 67 65 54 6f 53 63 72 65 65 this.pageToScree
00007a70: 6e 28 65 2e 70 6f 69 6e 74 29 2c 72 3d 74 68 69 n(e.point),r=thi
00007a80: 73 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 s.getZoomLevel()
00007a90: 3b 72 65 74 75 72 6e 20 6e 65 77 20 5f 70 28 74 ;return new _p(t
00007aa0: 2c 6e 2c 65 2e 77 69 64 74 68 2a 72 2c 65 2e 68 ,n,e.width*r,e.h
00007ab0: 65 69 67 68 74 2a 72 29 7d 67 65 74 46 6f 63 75 eight*r)}getFocu
00007ac0: 73 65 64 47 72 6f 75 70 49 64 28 29 7b 72 65 74 sedGroupId(){ret
00007ad0: 75 72 6e 20 74 68 69 73 2e 67 65 74 43 75 72 72 urn this.getCurr
00007ae0: 65 6e 74 50 61 67 65 53 74 61 74 65 28 29 2e 66 entPageState().f
00007af0: 6f 63 75 73 65 64 47 72 6f 75 70 49 64 3f 3f 74 ocusedGroupId??t
00007b00: 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 his.getCurrentPa
00007b10: 67 65 49 64 28 29 7d 67 65 74 46 6f 63 75 73 65 geId()}getFocuse
00007b20: 64 47 72 6f 75 70 28 29 7b 63 6f 6e 73 74 20 65 dGroup(){const e
00007b30: 3d 74 68 69 73 2e 67 65 74 46 6f 63 75 73 65 64 =this.getFocused
00007b40: 47 72 6f 75 70 49 64 28 29 3b 72 65 74 75 72 6e GroupId();return
00007b50: 20 65 3f 74 68 69 73 2e 67 65 74 53 68 61 70 65 e?this.getShape
00007b60: 28 65 29 3a 76 6f 69 64 20 30 7d 73 65 74 46 6f (e):void 0}setFo
00007b70: 63 75 73 65 64 47 72 6f 75 70 28 65 29 7b 63 6f cusedGroup(e){co
00007b80: 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 22 3d 3d nst t="string"==
00007b90: 74 79 70 65 6f 66 20 65 3f 65 3a 65 3f 2e 69 64 typeof e?e:e?.id
00007ba0: 3f 3f 6e 75 6c 6c 3b 69 66 28 6e 75 6c 6c 21 3d ??null;if(null!=
00007bb0: 3d 74 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 =t){const e=this
00007bc0: 2e 67 65 74 53 68 61 70 65 28 74 29 3b 69 66 28 .getShape(t);if(
00007bd0: 21 65 29 74 68 72 6f 77 20 45 72 72 6f 72 28 60 !e)throw Error(`
00007be0: 45 64 69 74 6f 72 2e 73 65 74 46 6f 63 75 73 65 Editor.setFocuse
00007bf0: 64 47 72 6f 75 70 3a 20 53 68 61 70 65 20 77 69 dGroup: Shape wi
00007c00: 74 68 20 69 64 20 24 7b 74 7d 20 64 6f 65 73 20 th id ${t} does
00007c10: 6e 6f 74 20 65 78 69 73 74 60 29 3b 69 66 28 21 not exist`);if(!
00007c20: 74 68 69 73 2e 69 73 53 68 61 70 65 4f 66 54 79 this.isShapeOfTy
00007c30: 70 65 28 65 2c 22 67 72 6f 75 70 22 29 29 74 68 pe(e,"group"))th
00007c40: 72 6f 77 20 45 72 72 6f 72 28 60 45 64 69 74 6f row Error(`Edito
00007c50: 72 2e 73 65 74 46 6f 63 75 73 65 64 47 72 6f 75 r.setFocusedGrou
00007c60: 70 3a 20 43 61 6e 6e 6f 74 20 73 65 74 20 66 6f p: Cannot set fo
00007c70: 63 75 73 65 64 20 67 72 6f 75 70 20 74 6f 20 73 cused group to s
00007c80: 68 61 70 65 20 6f 66 20 74 79 70 65 20 24 7b 65 hape of type ${e
00007c90: 2e 74 79 70 65 7d 60 29 7d 72 65 74 75 72 6e 20 .type}`)}return
00007ca0: 74 3d 3d 3d 74 68 69 73 2e 67 65 74 46 6f 63 75 t===this.getFocu
00007cb0: 73 65 64 47 72 6f 75 70 49 64 28 29 3f 74 68 69 sedGroupId()?thi
00007cc0: 73 3a 74 68 69 73 2e 62 61 74 63 68 28 28 28 29 s:this.batch((()
00007cd0: 3d 3e 7b 74 68 69 73 2e 73 74 6f 72 65 2e 75 70 =>{this.store.up
00007ce0: 64 61 74 65 28 74 68 69 73 2e 67 65 74 43 75 72 date(this.getCur
00007cf0: 72 65 6e 74 50 61 67 65 53 74 61 74 65 28 29 2e rentPageState().
00007d00: 69 64 2c 28 65 3d 3e 28 7b 2e 2e 2e 65 2c 66 6f id,(e=>({...e,fo
00007d10: 63 75 73 65 64 47 72 6f 75 70 49 64 3a 74 7d 29 cusedGroupId:t})
00007d20: 29 29 7d 29 2c 7b 68 69 73 74 6f 72 79 3a 22 72 ))}),{history:"r
00007d30: 65 63 6f 72 64 2d 70 72 65 73 65 72 76 65 52 65 ecord-preserveRe
00007d40: 64 6f 53 74 61 63 6b 22 7d 29 7d 70 6f 70 46 6f doStack"})}popFo
00007d50: 63 75 73 65 64 47 72 6f 75 70 49 64 28 29 7b 63 cusedGroupId(){c
00007d60: 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 46 onst e=this.getF
00007d70: 6f 63 75 73 65 64 47 72 6f 75 70 28 29 3b 69 66 ocusedGroup();if
00007d80: 28 65 29 7b 63 6f 6e 73 74 20 74 3d 74 68 69 73 (e){const t=this
00007d90: 2e 66 69 6e 64 53 68 61 70 65 41 6e 63 65 73 74 .findShapeAncest
00007da0: 6f 72 28 65 2c 28 65 3d 3e 74 68 69 73 2e 69 73 or(e,(e=>this.is
00007db0: 53 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 67 ShapeOfType(e,"g
00007dc0: 72 6f 75 70 22 29 29 29 3b 74 68 69 73 2e 73 65 roup")));this.se
00007dd0: 74 46 6f 63 75 73 65 64 47 72 6f 75 70 28 74 3f tFocusedGroup(t?
00007de0: 2e 69 64 3f 3f 6e 75 6c 6c 29 2c 74 68 69 73 2e .id??null),this.
00007df0: 73 65 6c 65 63 74 28 65 2e 69 64 29 7d 65 6c 73 select(e.id)}els
00007e00: 65 20 74 68 69 73 2e 73 65 74 46 6f 63 75 73 65 e this.setFocuse
00007e10: 64 47 72 6f 75 70 28 6e 75 6c 6c 29 2c 74 68 69 dGroup(null),thi
00007e20: 73 2e 73 65 6c 65 63 74 4e 6f 6e 65 28 29 3b 72 s.selectNone();r
00007e30: 65 74 75 72 6e 20 74 68 69 73 7d 67 65 74 45 64 eturn this}getEd
00007e40: 69 74 69 6e 67 53 68 61 70 65 49 64 28 29 7b 72 itingShapeId(){r
00007e50: 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 43 75 eturn this.getCu
00007e60: 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 28 29 rrentPageState()
00007e70: 2e 65 64 69 74 69 6e 67 53 68 61 70 65 49 64 7d .editingShapeId}
00007e80: 67 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 28 getEditingShape(
00007e90: 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 ){const e=this.g
00007ea0: 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 49 64 etEditingShapeId
00007eb0: 28 29 3b 72 65 74 75 72 6e 20 65 3f 74 68 69 73 ();return e?this
00007ec0: 2e 67 65 74 53 68 61 70 65 28 65 29 3a 76 6f 69 .getShape(e):voi
00007ed0: 64 20 30 7d 73 65 74 45 64 69 74 69 6e 67 53 68 d 0}setEditingSh
00007ee0: 61 70 65 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 ape(e){const t="
00007ef0: 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 string"==typeof
00007f00: 65 3f 65 3a 65 3f 2e 69 64 3f 3f 6e 75 6c 6c 3b e?e:e?.id??null;
00007f10: 69 66 28 74 21 3d 3d 74 68 69 73 2e 67 65 74 45 if(t!==this.getE
00007f20: 64 69 74 69 6e 67 53 68 61 70 65 49 64 28 29 29 ditingShapeId())
00007f30: 7b 69 66 28 74 29 7b 63 6f 6e 73 74 20 65 3d 74 {if(t){const e=t
00007f40: 68 69 73 2e 67 65 74 53 68 61 70 65 28 74 29 3b his.getShape(t);
00007f50: 69 66 28 65 26 26 74 68 69 73 2e 67 65 74 53 68 if(e&&this.getSh
00007f60: 61 70 65 55 74 69 6c 28 65 29 2e 63 61 6e 45 64 apeUtil(e).canEd
00007f70: 69 74 28 65 29 29 72 65 74 75 72 6e 20 74 68 69 it(e))return thi
00007f80: 73 2e 5f 75 70 64 61 74 65 43 75 72 72 65 6e 74 s._updateCurrent
00007f90: 50 61 67 65 53 74 61 74 65 28 7b 65 64 69 74 69 PageState({editi
00007fa0: 6e 67 53 68 61 70 65 49 64 3a 74 7d 29 2c 74 68 ngShapeId:t}),th
00007fb0: 69 73 7d 74 68 69 73 2e 5f 75 70 64 61 74 65 43 is}this._updateC
00007fc0: 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 28 urrentPageState(
00007fd0: 7b 65 64 69 74 69 6e 67 53 68 61 70 65 49 64 3a {editingShapeId:
00007fe0: 6e 75 6c 6c 7d 29 7d 72 65 74 75 72 6e 20 74 68 null})}return th
00007ff0: 69 73 7d 67 65 74 48 6f 76 65 72 65 64 53 68 61 is}getHoveredSha
00008000: 70 65 49 64 28 29 7b 72 65 74 75 72 6e 20 74 68 peId(){return th
00008010: 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 is.getCurrentPag
00008020: 65 53 74 61 74 65 28 29 2e 68 6f 76 65 72 65 64 eState().hovered
00008030: 53 68 61 70 65 49 64 7d 67 65 74 48 6f 76 65 72 ShapeId}getHover
00008040: 65 64 53 68 61 70 65 28 29 7b 63 6f 6e 73 74 20 edShape(){const
00008050: 65 3d 74 68 69 73 2e 67 65 74 48 6f 76 65 72 65 e=this.getHovere
00008060: 64 53 68 61 70 65 49 64 28 29 3b 72 65 74 75 72 dShapeId();retur
00008070: 6e 20 65 3f 74 68 69 73 2e 67 65 74 53 68 61 70 n e?this.getShap
00008080: 65 28 65 29 3a 76 6f 69 64 20 30 7d 73 65 74 48 e(e):void 0}setH
00008090: 6f 76 65 72 65 64 53 68 61 70 65 28 65 29 7b 63 overedShape(e){c
000080a0: 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 22 3d onst t="string"=
000080b0: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 3f 2e 69 =typeof e?e:e?.i
000080c0: 64 3f 3f 6e 75 6c 6c 3b 72 65 74 75 72 6e 20 74 d??null;return t
000080d0: 3d 3d 3d 74 68 69 73 2e 67 65 74 48 6f 76 65 72 ===this.getHover
000080e0: 65 64 53 68 61 70 65 49 64 28 29 7c 7c 74 68 69 edShapeId()||thi
000080f0: 73 2e 75 70 64 61 74 65 43 75 72 72 65 6e 74 50 s.updateCurrentP
00008100: 61 67 65 53 74 61 74 65 28 7b 68 6f 76 65 72 65 ageState({hovere
00008110: 64 53 68 61 70 65 49 64 3a 74 7d 2c 7b 68 69 73 dShapeId:t},{his
00008120: 74 6f 72 79 3a 22 69 67 6e 6f 72 65 22 7d 29 2c tory:"ignore"}),
00008130: 74 68 69 73 7d 67 65 74 48 69 6e 74 69 6e 67 53 this}getHintingS
00008140: 68 61 70 65 49 64 73 28 29 7b 72 65 74 75 72 6e hapeIds(){return
00008150: 20 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 this.getCurrent
00008160: 50 61 67 65 53 74 61 74 65 28 29 2e 68 69 6e 74 PageState().hint
00008170: 69 6e 67 53 68 61 70 65 49 64 73 7d 67 65 74 48 ingShapeIds}getH
00008180: 69 6e 74 69 6e 67 53 68 61 70 65 28 29 7b 72 65 intingShape(){re
00008190: 74 75 72 6e 20 6a 72 28 74 68 69 73 2e 67 65 74 turn jr(this.get
000081a0: 48 69 6e 74 69 6e 67 53 68 61 70 65 49 64 73 28 HintingShapeIds(
000081b0: 29 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 67 ).map((e=>this.g
000081c0: 65 74 53 68 61 70 65 28 65 29 29 29 29 7d 73 65 etShape(e))))}se
000081d0: 74 48 69 6e 74 69 6e 67 53 68 61 70 65 73 28 65 tHintingShapes(e
000081e0: 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e ){const t="strin
000081f0: 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f g"==typeof e[0]?
00008200: 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 e:e.map((e=>e.id
00008210: 29 29 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 75 ));return this.u
00008220: 70 64 61 74 65 43 75 72 72 65 6e 74 50 61 67 65 pdateCurrentPage
00008230: 53 74 61 74 65 28 7b 68 69 6e 74 69 6e 67 53 68 State({hintingSh
00008240: 61 70 65 49 64 73 3a 46 72 28 74 29 7d 2c 7b 68 apeIds:Fr(t)},{h
00008250: 69 73 74 6f 72 79 3a 22 69 67 6e 6f 72 65 22 7d istory:"ignore"}
00008260: 29 2c 74 68 69 73 7d 67 65 74 45 72 61 73 69 6e ),this}getErasin
00008270: 67 53 68 61 70 65 49 64 73 28 29 7b 72 65 74 75 gShapeIds(){retu
00008280: 72 6e 20 74 68 69 73 2e 67 65 74 43 75 72 72 65 rn this.getCurre
00008290: 6e 74 50 61 67 65 53 74 61 74 65 28 29 2e 65 72 ntPageState().er
000082a0: 61 73 69 6e 67 53 68 61 70 65 49 64 73 7d 67 65 asingShapeIds}ge
000082b0: 74 45 72 61 73 69 6e 67 53 68 61 70 65 73 28 29 tErasingShapes()
000082c0: 7b 72 65 74 75 72 6e 20 6a 72 28 74 68 69 73 2e {return jr(this.
000082d0: 67 65 74 45 72 61 73 69 6e 67 53 68 61 70 65 49 getErasingShapeI
000082e0: 64 73 28 29 2e 6d 61 70 28 28 65 3d 3e 74 68 69 ds().map((e=>thi
000082f0: 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 29 s.getShape(e))))
00008300: 7d 73 65 74 45 72 61 73 69 6e 67 53 68 61 70 65 }setErasingShape
00008310: 73 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 s(e){const t="st
00008320: 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b ring"==typeof e[
00008330: 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 0]?e:e.map((e=>e
00008340: 2e 69 64 29 29 3b 74 2e 73 6f 72 74 28 29 3b 63 .id));t.sort();c
00008350: 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 45 onst n=this.getE
00008360: 72 61 73 69 6e 67 53 68 61 70 65 49 64 73 28 29 rasingShapeIds()
00008370: 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 73 ;return this.his
00008380: 74 6f 72 79 2e 69 67 6e 6f 72 65 28 28 28 29 3d tory.ignore((()=
00008390: 3e 7b 69 66 28 74 2e 6c 65 6e 67 74 68 3d 3d 3d >{if(t.length===
000083a0: 6e 2e 6c 65 6e 67 74 68 29 7b 66 6f 72 28 6c 65 n.length){for(le
000083b0: 74 20 65 3d 30 3b 65 3c 74 2e 6c 65 6e 67 74 68 t e=0;e<t.length
000083c0: 3b 65 2b 2b 29 69 66 28 74 5b 65 5d 21 3d 3d 6e ;e++)if(t[e]!==n
000083d0: 5b 65 5d 29 7b 74 68 69 73 2e 5f 75 70 64 61 74 [e]){this._updat
000083e0: 65 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 eCurrentPageStat
000083f0: 65 28 7b 65 72 61 73 69 6e 67 53 68 61 70 65 49 e({erasingShapeI
00008400: 64 73 3a 74 7d 29 3b 62 72 65 61 6b 7d 7d 65 6c ds:t});break}}el
00008410: 73 65 20 74 68 69 73 2e 5f 75 70 64 61 74 65 43 se this._updateC
00008420: 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 28 urrentPageState(
00008430: 7b 65 72 61 73 69 6e 67 53 68 61 70 65 49 64 73 {erasingShapeIds
00008440: 3a 74 7d 29 7d 29 29 2c 74 68 69 73 7d 67 65 74 :t})})),this}get
00008450: 43 72 6f 70 70 69 6e 67 53 68 61 70 65 49 64 28 CroppingShapeId(
00008460: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 ){return this.ge
00008470: 74 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 tCurrentPageStat
00008480: 65 28 29 2e 63 72 6f 70 70 69 6e 67 53 68 61 70 e().croppingShap
00008490: 65 49 64 7d 73 65 74 43 72 6f 70 70 69 6e 67 53 eId}setCroppingS
000084a0: 68 61 70 65 28 65 29 7b 63 6f 6e 73 74 20 74 3d hape(e){const t=
000084b0: 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 "string"==typeof
000084c0: 20 65 3f 65 3a 65 3f 2e 69 64 3f 3f 6e 75 6c 6c e?e:e?.id??null
000084d0: 3b 69 66 28 74 21 3d 3d 74 68 69 73 2e 67 65 74 ;if(t!==this.get
000084e0: 43 72 6f 70 70 69 6e 67 53 68 61 70 65 49 64 28 CroppingShapeId(
000084f0: 29 29 69 66 28 74 29 7b 63 6f 6e 73 74 20 65 3d ))if(t){const e=
00008500: 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 74 29 this.getShape(t)
00008510: 2c 6e 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 ,n=this.getShape
00008520: 55 74 69 6c 28 65 29 3b 65 26 26 6e 2e 63 61 6e Util(e);e&&n.can
00008530: 43 72 6f 70 28 65 29 26 26 74 68 69 73 2e 75 70 Crop(e)&&this.up
00008540: 64 61 74 65 43 75 72 72 65 6e 74 50 61 67 65 53 dateCurrentPageS
00008550: 74 61 74 65 28 7b 63 72 6f 70 70 69 6e 67 53 68 tate({croppingSh
00008560: 61 70 65 49 64 3a 74 7d 29 7d 65 6c 73 65 20 74 apeId:t})}else t
00008570: 68 69 73 2e 75 70 64 61 74 65 43 75 72 72 65 6e his.updateCurren
00008580: 74 50 61 67 65 53 74 61 74 65 28 7b 63 72 6f 70 tPageState({crop
00008590: 70 69 6e 67 53 68 61 70 65 49 64 3a 6e 75 6c 6c pingShapeId:null
000085a0: 7d 29 3b 72 65 74 75 72 6e 20 74 68 69 73 7d 67 });return this}g
000085b0: 65 74 43 61 6d 65 72 61 49 64 28 29 7b 72 65 74 etCameraId(){ret
000085c0: 75 72 6e 20 6e 6c 2e 63 72 65 61 74 65 49 64 28 urn nl.createId(
000085d0: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
000085e0: 61 67 65 49 64 28 29 29 7d 67 65 74 43 61 6d 65 ageId())}getCame
000085f0: 72 61 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 ra(){const e=thi
00008600: 73 2e 73 74 6f 72 65 2e 67 65 74 28 74 68 69 73 s.store.get(this
00008610: 2e 67 65 74 43 61 6d 65 72 61 49 64 28 29 29 3b .getCameraId());
00008620: 69 66 28 74 68 69 73 2e 5f 69 73 4c 6f 63 6b 65 if(this._isLocke
00008630: 64 4f 6e 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 dOnFollowingUser
00008640: 2e 67 65 74 28 29 29 7b 63 6f 6e 73 74 20 74 3d .get()){const t=
00008650: 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 46 6f this.getCameraFo
00008660: 72 46 6f 6c 6c 6f 77 69 6e 67 28 29 3b 69 66 28 rFollowing();if(
00008670: 74 29 72 65 74 75 72 6e 7b 2e 2e 2e 65 2c 2e 2e t)return{...e,..
00008680: 2e 74 7d 7d 72 65 74 75 72 6e 20 65 7d 67 65 74 .t}}return e}get
00008690: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
000086a0: 64 73 46 6f 72 46 6f 6c 6c 6f 77 69 6e 67 28 29 dsForFollowing()
000086b0: 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 {const e=this.ge
000086c0: 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 tInstanceState()
000086d0: 2e 66 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 49 64 .followingUserId
000086e0: 3b 69 66 28 21 65 29 72 65 74 75 72 6e 20 6e 75 ;if(!e)return nu
000086f0: 6c 6c 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e ll;const t=this.
00008700: 67 65 74 43 6f 6c 6c 61 62 6f 72 61 74 6f 72 73 getCollaborators
00008710: 28 29 2e 66 69 6e 64 28 28 74 3d 3e 74 2e 75 73 ().find((t=>t.us
00008720: 65 72 49 64 3d 3d 3d 65 29 29 3b 69 66 28 21 74 erId===e));if(!t
00008730: 29 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 63 6f 6e )return null;con
00008740: 73 74 7b 77 3a 6e 2c 68 3a 72 7d 3d 74 2e 73 63 st{w:n,h:r}=t.sc
00008750: 72 65 65 6e 42 6f 75 6e 64 73 2c 7b 78 3a 6f 2c reenBounds,{x:o,
00008760: 79 3a 69 2c 7a 3a 61 7d 3d 74 2e 63 61 6d 65 72 y:i,z:a}=t.camer
00008770: 61 2c 73 3d 6e 65 77 20 5f 70 28 2d 6f 2c 2d 69 a,s=new _p(-o,-i
00008780: 2c 6e 2f 61 2c 72 2f 61 29 2c 6c 3d 74 68 69 73 ,n/a,r/a),l=this
00008790: 2e 67 65 74 56 69 65 77 70 6f 72 74 53 63 72 65 .getViewportScre
000087a0: 65 6e 42 6f 75 6e 64 73 28 29 2e 63 6c 6f 6e 65 enBounds().clone
000087b0: 28 29 2c 63 3d 6c 2e 77 69 64 74 68 2f 6c 2e 68 (),c=l.width/l.h
000087c0: 65 69 67 68 74 3b 72 65 74 75 72 6e 20 6c 2e 77 eight;return l.w
000087d0: 69 64 74 68 3d 73 2e 77 69 64 74 68 2c 6c 2e 68 idth=s.width,l.h
000087e0: 65 69 67 68 74 3d 6c 2e 77 69 64 74 68 2f 63 2c eight=l.width/c,
000087f0: 6c 2e 68 65 69 67 68 74 3c 73 2e 68 65 69 67 68 l.height<s.heigh
00008800: 74 26 26 28 6c 2e 68 65 69 67 68 74 3d 73 2e 68 t&&(l.height=s.h
00008810: 65 69 67 68 74 2c 6c 2e 77 69 64 74 68 3d 6c 2e eight,l.width=l.
00008820: 68 65 69 67 68 74 2a 63 29 2c 6c 2e 63 65 6e 74 height*c),l.cent
00008830: 65 72 3d 73 2e 63 65 6e 74 65 72 2c 6c 7d 67 65 er=s.center,l}ge
00008840: 74 43 61 6d 65 72 61 46 6f 72 46 6f 6c 6c 6f 77 tCameraForFollow
00008850: 69 6e 67 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 ing(){const e=th
00008860: 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 50 61 is.getViewportPa
00008870: 67 65 42 6f 75 6e 64 73 46 6f 72 46 6f 6c 6c 6f geBoundsForFollo
00008880: 77 69 6e 67 28 29 3b 72 65 74 75 72 6e 20 65 3f wing();return e?
00008890: 7b 78 3a 2d 65 2e 78 2c 79 3a 2d 65 2e 79 2c 7a {x:-e.x,y:-e.y,z
000088a0: 3a 74 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 :this.getViewpor
000088b0: 74 53 63 72 65 65 6e 42 6f 75 6e 64 73 28 29 2e tScreenBounds().
000088c0: 77 2f 65 2e 77 69 64 74 68 7d 3a 6e 75 6c 6c 7d w/e.width}:null}
000088d0: 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 7b 72 getZoomLevel(){r
000088e0: 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 43 61 eturn this.getCa
000088f0: 6d 65 72 61 28 29 2e 7a 7d 67 65 74 49 6e 69 74 mera().z}getInit
00008900: 69 61 6c 5a 6f 6f 6d 28 29 7b 63 6f 6e 73 74 20 ialZoom(){const
00008910: 65 3d 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 e=this.getCamera
00008920: 4f 70 74 69 6f 6e 73 28 29 3b 69 66 28 21 65 2e Options();if(!e.
00008930: 63 6f 6e 73 74 72 61 69 6e 74 73 29 72 65 74 75 constraints)retu
00008940: 72 6e 20 31 3b 69 66 28 22 64 65 66 61 75 6c 74 rn 1;if("default
00008950: 22 3d 3d 3d 65 2e 63 6f 6e 73 74 72 61 69 6e 74 "===e.constraint
00008960: 73 2e 69 6e 69 74 69 61 6c 5a 6f 6f 6d 29 72 65 s.initialZoom)re
00008970: 74 75 72 6e 20 31 3b 63 6f 6e 73 74 7b 7a 78 3a turn 1;const{zx:
00008980: 74 2c 7a 79 3a 6e 7d 3d 56 6d 28 74 68 69 73 2c t,zy:n}=Vm(this,
00008990: 65 29 3b 73 77 69 74 63 68 28 65 2e 63 6f 6e 73 e);switch(e.cons
000089a0: 74 72 61 69 6e 74 73 2e 69 6e 69 74 69 61 6c 5a traints.initialZ
000089b0: 6f 6f 6d 29 7b 63 61 73 65 22 66 69 74 2d 6d 69 oom){case"fit-mi
000089c0: 6e 22 3a 72 65 74 75 72 6e 20 4d 61 74 68 2e 6d n":return Math.m
000089d0: 61 78 28 74 2c 6e 29 3b 63 61 73 65 22 66 69 74 ax(t,n);case"fit
000089e0: 2d 6d 61 78 22 3a 72 65 74 75 72 6e 20 4d 61 74 -max":return Mat
000089f0: 68 2e 6d 69 6e 28 74 2c 6e 29 3b 63 61 73 65 22 h.min(t,n);case"
00008a00: 66 69 74 2d 78 22 3a 72 65 74 75 72 6e 20 74 3b fit-x":return t;
00008a10: 63 61 73 65 22 66 69 74 2d 79 22 3a 72 65 74 75 case"fit-y":retu
00008a20: 72 6e 20 6e 3b 63 61 73 65 22 66 69 74 2d 6d 69 rn n;case"fit-mi
00008a30: 6e 2d 31 30 30 22 3a 72 65 74 75 72 6e 20 4d 61 n-100":return Ma
00008a40: 74 68 2e 6d 69 6e 28 31 2c 4d 61 74 68 2e 6d 61 th.min(1,Math.ma
00008a50: 78 28 74 2c 6e 29 29 3b 63 61 73 65 22 66 69 74 x(t,n));case"fit
00008a60: 2d 6d 61 78 2d 31 30 30 22 3a 72 65 74 75 72 6e -max-100":return
00008a70: 20 4d 61 74 68 2e 6d 69 6e 28 31 2c 4d 61 74 68 Math.min(1,Math
00008a80: 2e 6d 69 6e 28 74 2c 6e 29 29 3b 63 61 73 65 22 .min(t,n));case"
00008a90: 66 69 74 2d 78 2d 31 30 30 22 3a 72 65 74 75 72 fit-x-100":retur
00008aa0: 6e 20 4d 61 74 68 2e 6d 69 6e 28 31 2c 74 29 3b n Math.min(1,t);
00008ab0: 63 61 73 65 22 66 69 74 2d 79 2d 31 30 30 22 3a case"fit-y-100":
00008ac0: 72 65 74 75 72 6e 20 4d 61 74 68 2e 6d 69 6e 28 return Math.min(
00008ad0: 31 2c 6e 29 3b 64 65 66 61 75 6c 74 3a 74 68 72 1,n);default:thr
00008ae0: 6f 77 20 71 72 28 65 2e 63 6f 6e 73 74 72 61 69 ow qr(e.constrai
00008af0: 6e 74 73 2e 69 6e 69 74 69 61 6c 5a 6f 6f 6d 29 nts.initialZoom)
00008b00: 7d 7d 67 65 74 42 61 73 65 5a 6f 6f 6d 28 29 7b }}getBaseZoom(){
00008b10: 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 const e=this.get
00008b20: 43 61 6d 65 72 61 4f 70 74 69 6f 6e 73 28 29 3b CameraOptions();
00008b30: 69 66 28 21 65 2e 63 6f 6e 73 74 72 61 69 6e 74 if(!e.constraint
00008b40: 73 29 72 65 74 75 72 6e 20 31 3b 69 66 28 22 64 s)return 1;if("d
00008b50: 65 66 61 75 6c 74 22 3d 3d 3d 65 2e 63 6f 6e 73 efault"===e.cons
00008b60: 74 72 61 69 6e 74 73 2e 62 61 73 65 5a 6f 6f 6d traints.baseZoom
00008b70: 29 72 65 74 75 72 6e 20 31 3b 63 6f 6e 73 74 7b )return 1;const{
00008b80: 7a 78 3a 74 2c 7a 79 3a 6e 7d 3d 56 6d 28 74 68 zx:t,zy:n}=Vm(th
00008b90: 69 73 2c 65 29 3b 73 77 69 74 63 68 28 65 2e 63 is,e);switch(e.c
00008ba0: 6f 6e 73 74 72 61 69 6e 74 73 2e 62 61 73 65 5a onstraints.baseZ
00008bb0: 6f 6f 6d 29 7b 63 61 73 65 22 66 69 74 2d 6d 69 oom){case"fit-mi
00008bc0: 6e 22 3a 72 65 74 75 72 6e 20 4d 61 74 68 2e 6d n":return Math.m
00008bd0: 61 78 28 74 2c 6e 29 3b 63 61 73 65 22 66 69 74 ax(t,n);case"fit
00008be0: 2d 6d 61 78 22 3a 72 65 74 75 72 6e 20 4d 61 74 -max":return Mat
00008bf0: 68 2e 6d 69 6e 28 74 2c 6e 29 3b 63 61 73 65 22 h.min(t,n);case"
00008c00: 66 69 74 2d 78 22 3a 72 65 74 75 72 6e 20 74 3b fit-x":return t;
00008c10: 63 61 73 65 22 66 69 74 2d 79 22 3a 72 65 74 75 case"fit-y":retu
00008c20: 72 6e 20 6e 3b 63 61 73 65 22 66 69 74 2d 6d 69 rn n;case"fit-mi
00008c30: 6e 2d 31 30 30 22 3a 72 65 74 75 72 6e 20 4d 61 n-100":return Ma
00008c40: 74 68 2e 6d 69 6e 28 31 2c 4d 61 74 68 2e 6d 61 th.min(1,Math.ma
00008c50: 78 28 74 2c 6e 29 29 3b 63 61 73 65 22 66 69 74 x(t,n));case"fit
00008c60: 2d 6d 61 78 2d 31 30 30 22 3a 72 65 74 75 72 6e -max-100":return
00008c70: 20 4d 61 74 68 2e 6d 69 6e 28 31 2c 4d 61 74 68 Math.min(1,Math
00008c80: 2e 6d 69 6e 28 74 2c 6e 29 29 3b 63 61 73 65 22 .min(t,n));case"
00008c90: 66 69 74 2d 78 2d 31 30 30 22 3a 72 65 74 75 72 fit-x-100":retur
00008ca0: 6e 20 4d 61 74 68 2e 6d 69 6e 28 31 2c 74 29 3b n Math.min(1,t);
00008cb0: 63 61 73 65 22 66 69 74 2d 79 2d 31 30 30 22 3a case"fit-y-100":
00008cc0: 72 65 74 75 72 6e 20 4d 61 74 68 2e 6d 69 6e 28 return Math.min(
00008cd0: 31 2c 6e 29 3b 64 65 66 61 75 6c 74 3a 74 68 72 1,n);default:thr
00008ce0: 6f 77 20 71 72 28 65 2e 63 6f 6e 73 74 72 61 69 ow qr(e.constrai
00008cf0: 6e 74 73 2e 62 61 73 65 5a 6f 6f 6d 29 7d 7d 5f nts.baseZoom)}}_
00008d00: 63 61 6d 65 72 61 4f 70 74 69 6f 6e 73 3d 59 69 cameraOptions=Yi
00008d10: 28 22 63 61 6d 65 72 61 20 6f 70 74 69 6f 6e 73 ("camera options
00008d20: 22 2c 55 75 29 3b 67 65 74 43 61 6d 65 72 61 4f ",Uu);getCameraO
00008d30: 70 74 69 6f 6e 73 28 29 7b 72 65 74 75 72 6e 20 ptions(){return
00008d40: 74 68 69 73 2e 5f 63 61 6d 65 72 61 4f 70 74 69 this._cameraOpti
00008d50: 6f 6e 73 2e 67 65 74 28 29 7d 73 65 74 43 61 6d ons.get()}setCam
00008d60: 65 72 61 4f 70 74 69 6f 6e 73 28 65 29 7b 63 6f eraOptions(e){co
00008d70: 6e 73 74 20 74 3d 64 69 28 7b 2e 2e 2e 74 68 69 nst t=di({...thi
00008d80: 73 2e 5f 63 61 6d 65 72 61 4f 70 74 69 6f 6e 73 s._cameraOptions
00008d90: 2e 5f 5f 75 6e 73 61 66 65 5f 5f 67 65 74 57 69 .__unsafe__getWi
00008da0: 74 68 6f 75 74 43 61 70 74 75 72 65 28 29 2c 2e thoutCapture(),.
00008db0: 2e 2e 65 7d 29 3b 72 65 74 75 72 6e 20 74 2e 7a ..e});return t.z
00008dc0: 6f 6f 6d 53 74 65 70 73 3f 2e 6c 65 6e 67 74 68 oomSteps?.length
00008dd0: 3c 31 26 26 28 74 2e 7a 6f 6f 6d 53 74 65 70 73 <1&&(t.zoomSteps
00008de0: 3d 5b 31 5d 29 2c 74 68 69 73 2e 5f 63 61 6d 65 =[1]),this._came
00008df0: 72 61 4f 70 74 69 6f 6e 73 2e 73 65 74 28 74 29 raOptions.set(t)
00008e00: 2c 74 68 69 73 7d 67 65 74 43 6f 6e 73 74 72 61 ,this}getConstra
00008e10: 69 6e 65 64 43 61 6d 65 72 61 28 65 2c 74 29 7b inedCamera(e,t){
00008e20: 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 const n=this.get
00008e30: 43 61 6d 65 72 61 28 29 3b 6c 65 74 7b 78 3a 72 Camera();let{x:r
00008e40: 2c 79 3a 6f 2c 7a 3a 69 3d 6e 2e 7a 7d 3d 65 3b ,y:o,z:i=n.z}=e;
00008e50: 69 66 28 21 74 3f 2e 66 6f 72 63 65 29 7b 63 6f if(!t?.force){co
00008e60: 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 43 61 nst e=this.getCa
00008e70: 6d 65 72 61 4f 70 74 69 6f 6e 73 28 29 2c 61 3d meraOptions(),a=
00008e80: 65 2e 7a 6f 6f 6d 53 74 65 70 73 5b 30 5d 2c 73 e.zoomSteps[0],s
00008e90: 3d 42 72 28 65 2e 7a 6f 6f 6d 53 74 65 70 73 29 =Br(e.zoomSteps)
00008ea0: 2c 6c 3d 74 68 69 73 2e 67 65 74 56 69 65 77 70 ,l=this.getViewp
00008eb0: 6f 72 74 53 63 72 65 65 6e 42 6f 75 6e 64 73 28 ortScreenBounds(
00008ec0: 29 3b 69 66 28 65 2e 63 6f 6e 73 74 72 61 69 6e );if(e.constrain
00008ed0: 74 73 29 7b 63 6f 6e 73 74 7b 63 6f 6e 73 74 72 ts){const{constr
00008ee0: 61 69 6e 74 73 3a 63 7d 3d 65 2c 75 3d 4d 61 74 aints:c}=e,u=Mat
00008ef0: 68 2e 6d 69 6e 28 63 2e 70 61 64 64 69 6e 67 2e h.min(c.padding.
00008f00: 79 2c 6c 2e 77 2f 32 29 2c 64 3d 4d 61 74 68 2e y,l.w/2),d=Math.
00008f10: 6d 69 6e 28 63 2e 70 61 64 64 69 6e 67 2e 78 2c min(c.padding.x,
00008f20: 6c 2e 68 2f 32 29 2c 70 3d 5f 70 2e 46 72 6f 6d l.h/2),p=_p.From
00008f30: 28 65 2e 63 6f 6e 73 74 72 61 69 6e 74 73 2e 62 (e.constraints.b
00008f40: 6f 75 6e 64 73 29 2c 66 3d 28 6c 2e 77 2d 32 2a ounds),f=(l.w-2*
00008f50: 64 29 2f 70 2e 77 2c 68 3d 28 6c 2e 68 2d 32 2a d)/p.w,h=(l.h-2*
00008f60: 75 29 2f 70 2e 68 2c 6d 3d 74 68 69 73 2e 67 65 u)/p.h,m=this.ge
00008f70: 74 42 61 73 65 5a 6f 6f 6d 28 29 2c 67 3d 73 2a tBaseZoom(),g=s*
00008f80: 6d 2c 62 3d 61 2a 6d 3b 69 66 28 74 3f 2e 72 65 m,b=a*m;if(t?.re
00008f90: 73 65 74 26 26 28 69 3d 74 68 69 73 2e 67 65 74 set&&(i=this.get
00008fa0: 49 6e 69 74 69 61 6c 5a 6f 6f 6d 28 29 29 2c 69 InitialZoom()),i
00008fb0: 3c 62 7c 7c 69 3e 67 29 7b 63 6f 6e 73 74 7b 78 <b||i>g){const{x
00008fc0: 3a 65 2c 79 3a 74 2c 7a 3a 61 7d 3d 6e 2c 73 3d :e,y:t,z:a}=n,s=
00008fd0: 2d 65 2b 6c 2e 77 2f 61 2f 32 2c 63 3d 2d 74 2b -e+l.w/a/2,c=-t+
00008fe0: 6c 2e 68 2f 61 2f 32 3b 69 3d 6d 75 28 69 2c 62 l.h/a/2;i=mu(i,b
00008ff0: 2c 67 29 3b 72 3d 65 2b 28 2d 65 2b 6c 2e 77 2f ,g);r=e+(-e+l.w/
00009000: 69 2f 32 29 2d 73 2c 6f 3d 74 2b 28 2d 74 2b 6c i/2)-s,o=t+(-t+l
00009010: 2e 68 2f 69 2f 32 29 2d 63 7d 63 6f 6e 73 74 20 .h/i/2)-c}const
00009020: 79 3d 64 2f 69 2d 70 2e 78 2c 76 3d 75 2f 69 2d y=d/i-p.x,v=u/i-
00009030: 70 2e 79 2c 53 3d 28 6c 2e 77 2d 32 2a 64 29 2f p.y,S=(l.w-2*d)/
00009040: 69 2d 70 2e 77 2c 5f 3d 28 6c 2e 68 2d 32 2a 75 i-p.w,_=(l.h-2*u
00009050: 29 2f 69 2d 70 2e 68 2c 45 3d 79 2b 53 2a 63 2e )/i-p.h,E=y+S*c.
00009060: 6f 72 69 67 69 6e 2e 78 2c 77 3d 76 2b 5f 2a 63 origin.x,w=v+_*c
00009070: 2e 6f 72 69 67 69 6e 2e 79 2c 78 3d 22 73 74 72 .origin.y,x="str
00009080: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 63 2e 62 ing"==typeof c.b
00009090: 65 68 61 76 69 6f 72 3f 63 2e 62 65 68 61 76 69 ehavior?c.behavi
000090a0: 6f 72 3a 63 2e 62 65 68 61 76 69 6f 72 2e 78 2c or:c.behavior.x,
000090b0: 54 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 T="string"==type
000090c0: 6f 66 20 63 2e 62 65 68 61 76 69 6f 72 3f 63 2e of c.behavior?c.
000090d0: 62 65 68 61 76 69 6f 72 3a 63 2e 62 65 68 61 76 behavior:c.behav
000090e0: 69 6f 72 2e 79 3b 69 66 28 74 3f 2e 72 65 73 65 ior.y;if(t?.rese
000090f0: 74 29 72 3d 45 2c 6f 3d 77 3b 65 6c 73 65 7b 73 t)r=E,o=w;else{s
00009100: 77 69 74 63 68 28 78 29 7b 63 61 73 65 22 66 69 witch(x){case"fi
00009110: 78 65 64 22 3a 72 3d 45 3b 62 72 65 61 6b 3b 63 xed":r=E;break;c
00009120: 61 73 65 22 63 6f 6e 74 61 69 6e 22 3a 72 3d 69 ase"contain":r=i
00009130: 3c 66 3f 45 3a 6d 75 28 72 2c 79 2b 53 2c 79 29 <f?E:mu(r,y+S,y)
00009140: 3b 62 72 65 61 6b 3b 63 61 73 65 22 69 6e 73 69 ;break;case"insi
00009150: 64 65 22 3a 72 3d 69 3c 66 3f 6d 75 28 72 2c 79 de":r=i<f?mu(r,y
00009160: 2c 28 6c 2e 77 2d 64 29 2f 69 2d 70 2e 77 29 3a ,(l.w-d)/i-p.w):
00009170: 6d 75 28 72 2c 79 2b 53 2c 79 29 3b 62 72 65 61 mu(r,y+S,y);brea
00009180: 6b 3b 63 61 73 65 22 6f 75 74 73 69 64 65 22 3a k;case"outside":
00009190: 72 3d 6d 75 28 72 2c 64 2f 69 2d 70 2e 77 2c 28 r=mu(r,d/i-p.w,(
000091a0: 6c 2e 77 2d 64 29 2f 69 29 3b 62 72 65 61 6b 3b l.w-d)/i);break;
000091b0: 63 61 73 65 22 66 72 65 65 22 3a 62 72 65 61 6b case"free":break
000091c0: 3b 64 65 66 61 75 6c 74 3a 74 68 72 6f 77 20 71 ;default:throw q
000091d0: 72 28 78 29 7d 73 77 69 74 63 68 28 54 29 7b 63 r(x)}switch(T){c
000091e0: 61 73 65 22 66 69 78 65 64 22 3a 6f 3d 77 3b 62 ase"fixed":o=w;b
000091f0: 72 65 61 6b 3b 63 61 73 65 22 63 6f 6e 74 61 69 reak;case"contai
00009200: 6e 22 3a 6f 3d 69 3c 68 3f 77 3a 6d 75 28 6f 2c n":o=i<h?w:mu(o,
00009210: 76 2b 5f 2c 76 29 3b 62 72 65 61 6b 3b 63 61 73 v+_,v);break;cas
00009220: 65 22 69 6e 73 69 64 65 22 3a 6f 3d 69 3c 68 3f e"inside":o=i<h?
00009230: 6d 75 28 6f 2c 76 2c 28 6c 2e 68 2d 75 29 2f 69 mu(o,v,(l.h-u)/i
00009240: 2d 70 2e 68 29 3a 6d 75 28 6f 2c 76 2b 5f 2c 76 -p.h):mu(o,v+_,v
00009250: 29 3b 62 72 65 61 6b 3b 63 61 73 65 22 6f 75 74 );break;case"out
00009260: 73 69 64 65 22 3a 6f 3d 6d 75 28 6f 2c 75 2f 69 side":o=mu(o,u/i
00009270: 2d 70 2e 68 2c 28 6c 2e 68 2d 75 29 2f 69 29 3b -p.h,(l.h-u)/i);
00009280: 62 72 65 61 6b 3b 63 61 73 65 22 66 72 65 65 22 break;case"free"
00009290: 3a 62 72 65 61 6b 3b 64 65 66 61 75 6c 74 3a 74 :break;default:t
000092a0: 68 72 6f 77 20 71 72 28 54 29 7d 7d 7d 65 6c 73 hrow qr(T)}}}els
000092b0: 65 20 69 66 28 69 3e 73 7c 7c 69 3c 61 29 7b 63 e if(i>s||i<a){c
000092c0: 6f 6e 73 74 7b 78 3a 65 2c 79 3a 74 2c 7a 3a 63 onst{x:e,y:t,z:c
000092d0: 7d 3d 6e 3b 69 3d 6d 75 28 69 2c 61 2c 73 29 2c }=n;i=mu(i,a,s),
000092e0: 72 3d 65 2b 28 2d 65 2b 6c 2e 77 2f 69 2f 32 29 r=e+(-e+l.w/i/2)
000092f0: 2d 28 2d 65 2b 6c 2e 77 2f 63 2f 32 29 2c 6f 3d -(-e+l.w/c/2),o=
00009300: 74 2b 28 2d 74 2b 6c 2e 68 2f 69 2f 32 29 2d 28 t+(-t+l.h/i/2)-(
00009310: 2d 74 2b 6c 2e 68 2f 63 2f 32 29 7d 7d 72 65 74 -t+l.h/c/2)}}ret
00009320: 75 72 6e 7b 78 3a 72 2c 79 3a 6f 2c 7a 3a 69 7d urn{x:r,y:o,z:i}
00009330: 7d 5f 73 65 74 43 61 6d 65 72 61 28 65 2c 74 29 }_setCamera(e,t)
00009340: 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 {const n=this.ge
00009350: 74 43 61 6d 65 72 61 28 29 2c 7b 78 3a 72 2c 79 tCamera(),{x:r,y
00009360: 3a 6f 2c 7a 3a 69 7d 3d 74 68 69 73 2e 67 65 74 :o,z:i}=this.get
00009370: 43 6f 6e 73 74 72 61 69 6e 65 64 43 61 6d 65 72 ConstrainedCamer
00009380: 61 28 65 2c 74 29 3b 72 65 74 75 72 6e 20 6e 2e a(e,t);return n.
00009390: 78 3d 3d 3d 72 26 26 6e 2e 79 3d 3d 3d 6f 26 26 x===r&&n.y===o&&
000093a0: 6e 2e 7a 3d 3d 3d 69 7c 7c 74 68 69 73 2e 62 61 n.z===i||this.ba
000093b0: 74 63 68 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 20 tch((()=>{const
000093c0: 65 3d 7b 2e 2e 2e 6e 2c 78 3a 72 2c 79 3a 6f 2c e={...n,x:r,y:o,
000093d0: 7a 3a 69 7d 3b 74 68 69 73 2e 68 69 73 74 6f 72 z:i};this.histor
000093e0: 79 2e 69 67 6e 6f 72 65 28 28 28 29 3d 3e 7b 74 y.ignore((()=>{t
000093f0: 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 5b 65 his.store.put([e
00009400: 5d 29 7d 29 29 3b 63 6f 6e 73 74 7b 63 75 72 72 ])}));const{curr
00009410: 65 6e 74 53 63 72 65 65 6e 50 6f 69 6e 74 3a 61 entScreenPoint:a
00009420: 2c 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e ,currentPagePoin
00009430: 74 3a 73 7d 3d 74 68 69 73 2e 69 6e 70 75 74 73 t:s}=this.inputs
00009440: 2c 7b 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 6c ,{screenBounds:l
00009450: 7d 3d 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 }=this.store.uns
00009460: 61 66 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 afeGetWithoutCap
00009470: 74 75 72 65 28 62 6c 29 3b 69 66 28 61 2e 78 2f ture(bl);if(a.x/
00009480: 69 2d 72 21 3d 3d 73 2e 78 7c 7c 61 2e 79 2f 69 i-r!==s.x||a.y/i
00009490: 2d 6f 21 3d 3d 73 2e 79 29 7b 63 6f 6e 73 74 20 -o!==s.y){const
000094a0: 65 3d 7b 74 79 70 65 3a 22 70 6f 69 6e 74 65 72 e={type:"pointer
000094b0: 22 2c 74 61 72 67 65 74 3a 22 63 61 6e 76 61 73 ",target:"canvas
000094c0: 22 2c 6e 61 6d 65 3a 22 70 6f 69 6e 74 65 72 5f ",name:"pointer_
000094d0: 6d 6f 76 65 22 2c 70 6f 69 6e 74 3a 73 75 2e 41 move",point:su.A
000094e0: 64 64 58 59 28 61 2c 6c 2e 78 2c 6c 2e 79 29 2c ddXY(a,l.x,l.y),
000094f0: 70 6f 69 6e 74 65 72 49 64 3a 48 75 2c 63 74 72 pointerId:Hu,ctr
00009500: 6c 4b 65 79 3a 74 68 69 73 2e 69 6e 70 75 74 73 lKey:this.inputs
00009510: 2e 63 74 72 6c 4b 65 79 2c 61 6c 74 4b 65 79 3a .ctrlKey,altKey:
00009520: 74 68 69 73 2e 69 6e 70 75 74 73 2e 61 6c 74 4b this.inputs.altK
00009530: 65 79 2c 73 68 69 66 74 4b 65 79 3a 74 68 69 73 ey,shiftKey:this
00009540: 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b 65 79 .inputs.shiftKey
00009550: 2c 62 75 74 74 6f 6e 3a 30 2c 69 73 50 65 6e 3a ,button:0,isPen:
00009560: 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 this.getInstance
00009570: 53 74 61 74 65 28 29 2e 69 73 50 65 6e 4d 6f 64 State().isPenMod
00009580: 65 3f 3f 21 31 7d 3b 74 3f 2e 69 6d 6d 65 64 69 e??!1};t?.immedi
00009590: 61 74 65 3f 74 68 69 73 2e 5f 66 6c 75 73 68 45 ate?this._flushE
000095a0: 76 65 6e 74 46 6f 72 54 69 63 6b 28 65 29 3a 74 ventForTick(e):t
000095b0: 68 69 73 2e 64 69 73 70 61 74 63 68 28 65 29 7d his.dispatch(e)}
000095c0: 74 68 69 73 2e 5f 74 69 63 6b 43 61 6d 65 72 61 this._tickCamera
000095d0: 53 74 61 74 65 28 29 7d 29 29 2c 74 68 69 73 7d State()})),this}
000095e0: 73 65 74 43 61 6d 65 72 61 28 65 2c 74 29 7b 63 setCamera(e,t){c
000095f0: 6f 6e 73 74 7b 69 73 4c 6f 63 6b 65 64 3a 6e 7d onst{isLocked:n}
00009600: 3d 74 68 69 73 2e 5f 63 61 6d 65 72 61 4f 70 74 =this._cameraOpt
00009610: 69 6f 6e 73 2e 5f 5f 75 6e 73 61 66 65 5f 5f 67 ions.__unsafe__g
00009620: 65 74 57 69 74 68 6f 75 74 43 61 70 74 75 72 65 etWithoutCapture
00009630: 28 29 3b 69 66 28 6e 26 26 21 74 3f 2e 66 6f 72 ();if(n&&!t?.for
00009640: 63 65 29 72 65 74 75 72 6e 20 74 68 69 73 3b 74 ce)return this;t
00009650: 68 69 73 2e 73 74 6f 70 43 61 6d 65 72 61 41 6e his.stopCameraAn
00009660: 69 6d 61 74 69 6f 6e 28 29 2c 74 68 69 73 2e 67 imation(),this.g
00009670: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00009680: 29 2e 66 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 49 ).followingUserI
00009690: 64 26 26 74 68 69 73 2e 73 74 6f 70 46 6f 6c 6c d&&this.stopFoll
000096a0: 6f 77 69 6e 67 55 73 65 72 28 29 3b 63 6f 6e 73 owingUser();cons
000096b0: 74 20 72 3d 73 75 2e 43 61 73 74 28 65 29 3b 4e t r=su.Cast(e);N
000096c0: 75 6d 62 65 72 2e 69 73 46 69 6e 69 74 65 28 72 umber.isFinite(r
000096d0: 2e 78 29 7c 7c 28 72 2e 78 3d 30 29 2c 4e 75 6d .x)||(r.x=0),Num
000096e0: 62 65 72 2e 69 73 46 69 6e 69 74 65 28 72 2e 79 ber.isFinite(r.y
000096f0: 29 7c 7c 28 72 2e 79 3d 30 29 2c 76 6f 69 64 20 )||(r.y=0),void
00009700: 30 21 3d 3d 72 2e 7a 26 26 4e 75 6d 62 65 72 2e 0!==r.z&&Number.
00009710: 69 73 46 69 6e 69 74 65 28 72 2e 7a 29 7c 7c 28 isFinite(r.z)||(
00009720: 65 2e 7a 3d 74 68 69 73 2e 67 65 74 5a 6f 6f 6d e.z=this.getZoom
00009730: 4c 65 76 65 6c 28 29 29 3b 63 6f 6e 73 74 20 6f Level());const o
00009740: 3d 74 68 69 73 2e 67 65 74 43 6f 6e 73 74 72 61 =this.getConstra
00009750: 69 6e 65 64 43 61 6d 65 72 61 28 72 2c 74 29 3b inedCamera(r,t);
00009760: 69 66 28 74 3f 2e 61 6e 69 6d 61 74 69 6f 6e 29 if(t?.animation)
00009770: 7b 63 6f 6e 73 74 7b 77 69 64 74 68 3a 65 2c 68 {const{width:e,h
00009780: 65 69 67 68 74 3a 6e 7d 3d 74 68 69 73 2e 67 65 eight:n}=this.ge
00009790: 74 56 69 65 77 70 6f 72 74 53 63 72 65 65 6e 42 tViewportScreenB
000097a0: 6f 75 6e 64 73 28 29 3b 74 68 69 73 2e 5f 61 6e ounds();this._an
000097b0: 69 6d 61 74 65 54 6f 56 69 65 77 70 6f 72 74 28 imateToViewport(
000097c0: 6e 65 77 20 5f 70 28 2d 6f 2e 78 2c 2d 6f 2e 79 new _p(-o.x,-o.y
000097d0: 2c 65 2f 6f 2e 7a 2c 6e 2f 6f 2e 7a 29 2c 74 29 ,e/o.z,n/o.z),t)
000097e0: 7d 65 6c 73 65 20 74 68 69 73 2e 5f 73 65 74 43 }else this._setC
000097f0: 61 6d 65 72 61 28 6f 2c 7b 2e 2e 2e 74 2c 66 6f amera(o,{...t,fo
00009800: 72 63 65 3a 21 30 7d 29 3b 72 65 74 75 72 6e 20 rce:!0});return
00009810: 74 68 69 73 7d 63 65 6e 74 65 72 4f 6e 50 6f 69 this}centerOnPoi
00009820: 6e 74 28 65 2c 74 29 7b 69 66 28 74 68 69 73 2e nt(e,t){if(this.
00009830: 67 65 74 43 61 6d 65 72 61 4f 70 74 69 6f 6e 73 getCameraOptions
00009840: 28 29 2e 69 73 4c 6f 63 6b 65 64 29 72 65 74 75 ().isLocked)retu
00009850: 72 6e 20 74 68 69 73 3b 63 6f 6e 73 74 7b 77 69 rn this;const{wi
00009860: 64 74 68 3a 6e 2c 68 65 69 67 68 74 3a 72 7d 3d dth:n,height:r}=
00009870: 74 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 this.getViewport
00009880: 50 61 67 65 42 6f 75 6e 64 73 28 29 3b 72 65 74 PageBounds();ret
00009890: 75 72 6e 20 74 68 69 73 2e 73 65 74 43 61 6d 65 urn this.setCame
000098a0: 72 61 28 6e 65 77 20 73 75 28 2d 28 65 2e 78 2d ra(new su(-(e.x-
000098b0: 6e 2f 32 29 2c 2d 28 65 2e 79 2d 72 2f 32 29 2c n/2),-(e.y-r/2),
000098c0: 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 29 this.getCamera()
000098d0: 2e 7a 29 2c 74 29 2c 74 68 69 73 7d 7a 6f 6f 6d .z),t),this}zoom
000098e0: 54 6f 46 69 74 28 65 29 7b 63 6f 6e 73 74 20 74 ToFit(e){const t
000098f0: 3d 5b 2e 2e 2e 74 68 69 73 2e 67 65 74 43 75 72 =[...this.getCur
00009900: 72 65 6e 74 50 61 67 65 53 68 61 70 65 49 64 73 rentPageShapeIds
00009910: 28 29 5d 3b 69 66 28 74 2e 6c 65 6e 67 74 68 3c ()];if(t.length<
00009920: 3d 30 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 =0)return this;c
00009930: 6f 6e 73 74 20 6e 3d 5f 70 2e 43 6f 6d 6d 6f 6e onst n=_p.Common
00009940: 28 6a 72 28 74 2e 6d 61 70 28 28 65 3d 3e 74 68 (jr(t.map((e=>th
00009950: 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 is.getShapePageB
00009960: 6f 75 6e 64 73 28 65 29 29 29 29 29 3b 72 65 74 ounds(e)))));ret
00009970: 75 72 6e 20 74 68 69 73 2e 7a 6f 6f 6d 54 6f 42 urn this.zoomToB
00009980: 6f 75 6e 64 73 28 6e 2c 65 29 2c 74 68 69 73 7d ounds(n,e),this}
00009990: 72 65 73 65 74 5a 6f 6f 6d 28 65 3d 74 68 69 73 resetZoom(e=this
000099a0: 2e 67 65 74 56 69 65 77 70 6f 72 74 53 63 72 65 .getViewportScre
000099b0: 65 6e 43 65 6e 74 65 72 28 29 2c 74 29 7b 63 6f enCenter(),t){co
000099c0: 6e 73 74 7b 69 73 4c 6f 63 6b 65 64 3a 6e 2c 63 nst{isLocked:n,c
000099d0: 6f 6e 73 74 72 61 69 6e 74 73 3a 72 7d 3d 74 68 onstraints:r}=th
000099e0: 69 73 2e 67 65 74 43 61 6d 65 72 61 4f 70 74 69 is.getCameraOpti
000099f0: 6f 6e 73 28 29 3b 69 66 28 6e 29 72 65 74 75 72 ons();if(n)retur
00009a00: 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 6f 3d 74 n this;const o=t
00009a10: 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 29 2c his.getCamera(),
00009a20: 7b 78 3a 69 2c 79 3a 61 2c 7a 3a 73 7d 3d 6f 2c {x:i,y:a,z:s}=o,
00009a30: 7b 78 3a 6c 2c 79 3a 63 7d 3d 65 3b 6c 65 74 20 {x:l,y:c}=e;let
00009a40: 75 3d 31 3b 69 66 28 72 29 7b 63 6f 6e 73 74 20 u=1;if(r){const
00009a50: 65 3d 74 68 69 73 2e 67 65 74 49 6e 69 74 69 61 e=this.getInitia
00009a60: 6c 5a 6f 6f 6d 28 29 3b 73 21 3d 3d 65 26 26 28 lZoom();s!==e&&(
00009a70: 75 3d 65 29 7d 72 65 74 75 72 6e 20 74 68 69 73 u=e)}return this
00009a80: 2e 73 65 74 43 61 6d 65 72 61 28 6e 65 77 20 73 .setCamera(new s
00009a90: 75 28 69 2b 28 6c 2f 75 2d 6c 29 2d 28 6c 2f 73 u(i+(l/u-l)-(l/s
00009aa0: 2d 6c 29 2c 61 2b 28 63 2f 75 2d 63 29 2d 28 63 -l),a+(c/u-c)-(c
00009ab0: 2f 73 2d 63 29 2c 75 29 2c 74 29 2c 74 68 69 73 /s-c),u),t),this
00009ac0: 7d 7a 6f 6f 6d 49 6e 28 65 3d 74 68 69 73 2e 67 }zoomIn(e=this.g
00009ad0: 65 74 56 69 65 77 70 6f 72 74 53 63 72 65 65 6e etViewportScreen
00009ae0: 43 65 6e 74 65 72 28 29 2c 74 29 7b 69 66 28 74 Center(),t){if(t
00009af0: 68 69 73 2e 67 65 74 43 61 6d 65 72 61 4f 70 74 his.getCameraOpt
00009b00: 69 6f 6e 73 28 29 2e 69 73 4c 6f 63 6b 65 64 29 ions().isLocked)
00009b10: 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 return this;cons
00009b20: 74 7b 78 3a 6e 2c 79 3a 72 2c 7a 3a 6f 7d 3d 74 t{x:n,y:r,z:o}=t
00009b30: 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 29 2c his.getCamera(),
00009b40: 7b 7a 6f 6f 6d 53 74 65 70 73 3a 69 7d 3d 74 68 {zoomSteps:i}=th
00009b50: 69 73 2e 67 65 74 43 61 6d 65 72 61 4f 70 74 69 is.getCameraOpti
00009b60: 6f 6e 73 28 29 3b 69 66 28 6e 75 6c 6c 21 3d 3d ons();if(null!==
00009b70: 69 26 26 69 2e 6c 65 6e 67 74 68 3e 31 29 7b 63 i&&i.length>1){c
00009b80: 6f 6e 73 74 20 61 3d 74 68 69 73 2e 67 65 74 42 onst a=this.getB
00009b90: 61 73 65 5a 6f 6f 6d 28 29 3b 6c 65 74 20 73 3d aseZoom();let s=
00009ba0: 42 72 28 69 29 2a 61 3b 66 6f 72 28 6c 65 74 20 Br(i)*a;for(let
00009bb0: 65 3d 31 3b 65 3c 69 2e 6c 65 6e 67 74 68 3b 65 e=1;e<i.length;e
00009bc0: 2b 2b 29 7b 63 6f 6e 73 74 20 74 3d 69 5b 65 2d ++){const t=i[e-
00009bd0: 31 5d 2a 61 2c 6e 3d 69 5b 65 5d 2a 61 3b 69 66 1]*a,n=i[e]*a;if
00009be0: 28 21 28 6e 2d 6f 3c 3d 28 6e 2d 74 29 2f 32 29 (!(n-o<=(n-t)/2)
00009bf0: 29 7b 73 3d 6e 3b 62 72 65 61 6b 7d 7d 74 68 69 ){s=n;break}}thi
00009c00: 73 2e 73 65 74 43 61 6d 65 72 61 28 6e 65 77 20 s.setCamera(new
00009c10: 73 75 28 6e 2b 28 65 2e 78 2f 73 2d 65 2e 78 29 su(n+(e.x/s-e.x)
00009c20: 2d 28 65 2e 78 2f 6f 2d 65 2e 78 29 2c 72 2b 28 -(e.x/o-e.x),r+(
00009c30: 65 2e 79 2f 73 2d 65 2e 79 29 2d 28 65 2e 79 2f e.y/s-e.y)-(e.y/
00009c40: 6f 2d 65 2e 79 29 2c 73 29 2c 74 29 7d 72 65 74 o-e.y),s),t)}ret
00009c50: 75 72 6e 20 74 68 69 73 7d 7a 6f 6f 6d 4f 75 74 urn this}zoomOut
00009c60: 28 65 3d 74 68 69 73 2e 67 65 74 56 69 65 77 70 (e=this.getViewp
00009c70: 6f 72 74 53 63 72 65 65 6e 43 65 6e 74 65 72 28 ortScreenCenter(
00009c80: 29 2c 74 29 7b 69 66 28 74 68 69 73 2e 67 65 74 ),t){if(this.get
00009c90: 43 61 6d 65 72 61 4f 70 74 69 6f 6e 73 28 29 2e CameraOptions().
00009ca0: 69 73 4c 6f 63 6b 65 64 29 72 65 74 75 72 6e 20 isLocked)return
00009cb0: 74 68 69 73 3b 63 6f 6e 73 74 7b 7a 6f 6f 6d 53 this;const{zoomS
00009cc0: 74 65 70 73 3a 6e 7d 3d 74 68 69 73 2e 67 65 74 teps:n}=this.get
00009cd0: 43 61 6d 65 72 61 4f 70 74 69 6f 6e 73 28 29 3b CameraOptions();
00009ce0: 69 66 28 6e 75 6c 6c 21 3d 3d 6e 26 26 6e 2e 6c if(null!==n&&n.l
00009cf0: 65 6e 67 74 68 3e 31 29 7b 63 6f 6e 73 74 20 72 ength>1){const r
00009d00: 3d 74 68 69 73 2e 67 65 74 42 61 73 65 5a 6f 6f =this.getBaseZoo
00009d10: 6d 28 29 2c 7b 78 3a 6f 2c 79 3a 69 2c 7a 3a 61 m(),{x:o,y:i,z:a
00009d20: 7d 3d 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 }=this.getCamera
00009d30: 28 29 3b 6c 65 74 20 73 3d 6e 5b 30 5d 2a 72 3b ();let s=n[0]*r;
00009d40: 66 6f 72 28 6c 65 74 20 65 3d 6e 2e 6c 65 6e 67 for(let e=n.leng
00009d50: 74 68 2d 31 3b 65 3e 30 3b 65 2d 2d 29 7b 63 6f th-1;e>0;e--){co
00009d60: 6e 73 74 20 74 3d 6e 5b 65 2d 31 5d 2a 72 2c 6f nst t=n[e-1]*r,o
00009d70: 3d 6e 5b 65 5d 2a 72 3b 69 66 28 21 28 6f 2d 61 =n[e]*r;if(!(o-a
00009d80: 3e 3d 28 6f 2d 74 29 2f 32 29 29 7b 73 3d 74 3b >=(o-t)/2)){s=t;
00009d90: 62 72 65 61 6b 7d 7d 74 68 69 73 2e 73 65 74 43 break}}this.setC
00009da0: 61 6d 65 72 61 28 6e 65 77 20 73 75 28 6f 2b 28 amera(new su(o+(
00009db0: 65 2e 78 2f 73 2d 65 2e 78 29 2d 28 65 2e 78 2f e.x/s-e.x)-(e.x/
00009dc0: 61 2d 65 2e 78 29 2c 69 2b 28 65 2e 79 2f 73 2d a-e.x),i+(e.y/s-
00009dd0: 65 2e 79 29 2d 28 65 2e 79 2f 61 2d 65 2e 79 29 e.y)-(e.y/a-e.y)
00009de0: 2c 73 29 2c 74 29 7d 72 65 74 75 72 6e 20 74 68 ,s),t)}return th
00009df0: 69 73 7d 7a 6f 6f 6d 54 6f 53 65 6c 65 63 74 69 is}zoomToSelecti
00009e00: 6f 6e 28 65 29 7b 69 66 28 74 68 69 73 2e 67 65 on(e){if(this.ge
00009e10: 74 43 61 6d 65 72 61 4f 70 74 69 6f 6e 73 28 29 tCameraOptions()
00009e20: 2e 69 73 4c 6f 63 6b 65 64 29 72 65 74 75 72 6e .isLocked)return
00009e30: 20 74 68 69 73 3b 63 6f 6e 73 74 20 74 3d 74 68 this;const t=th
00009e40: 69 73 2e 67 65 74 53 65 6c 65 63 74 69 6f 6e 50 is.getSelectionP
00009e50: 61 67 65 42 6f 75 6e 64 73 28 29 3b 72 65 74 75 ageBounds();retu
00009e60: 72 6e 20 74 26 26 74 68 69 73 2e 7a 6f 6f 6d 54 rn t&&this.zoomT
00009e70: 6f 42 6f 75 6e 64 73 28 74 2c 7b 74 61 72 67 65 oBounds(t,{targe
00009e80: 74 5a 6f 6f 6d 3a 4d 61 74 68 2e 6d 61 78 28 31 tZoom:Math.max(1
00009e90: 2c 74 68 69 73 2e 67 65 74 5a 6f 6f 6d 4c 65 76 ,this.getZoomLev
00009ea0: 65 6c 28 29 29 2c 2e 2e 2e 65 7d 29 2c 74 68 69 el()),...e}),thi
00009eb0: 73 7d 7a 6f 6f 6d 54 6f 42 6f 75 6e 64 73 28 65 s}zoomToBounds(e
00009ec0: 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 ,t){const n=this
00009ed0: 2e 5f 63 61 6d 65 72 61 4f 70 74 69 6f 6e 73 2e ._cameraOptions.
00009ee0: 5f 5f 75 6e 73 61 66 65 5f 5f 67 65 74 57 69 74 __unsafe__getWit
00009ef0: 68 6f 75 74 43 61 70 74 75 72 65 28 29 3b 69 66 houtCapture();if
00009f00: 28 6e 2e 69 73 4c 6f 63 6b 65 64 29 72 65 74 75 (n.isLocked)retu
00009f10: 72 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 72 3d rn this;const r=
00009f20: 74 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 this.getViewport
00009f30: 53 63 72 65 65 6e 42 6f 75 6e 64 73 28 29 2c 6f ScreenBounds(),o
00009f40: 3d 74 3f 2e 69 6e 73 65 74 3f 3f 4d 61 74 68 2e =t?.inset??Math.
00009f50: 6d 69 6e 28 31 32 38 2c 2e 32 38 2a 72 2e 77 69 min(128,.28*r.wi
00009f60: 64 74 68 29 2c 69 3d 74 68 69 73 2e 67 65 74 42 dth),i=this.getB
00009f70: 61 73 65 5a 6f 6f 6d 28 29 2c 61 3d 6e 2e 7a 6f aseZoom(),a=n.zo
00009f80: 6f 6d 53 74 65 70 73 5b 30 5d 2c 73 3d 42 72 28 omSteps[0],s=Br(
00009f90: 6e 2e 7a 6f 6f 6d 53 74 65 70 73 29 3b 6c 65 74 n.zoomSteps);let
00009fa0: 20 6c 3d 6d 75 28 4d 61 74 68 2e 6d 69 6e 28 28 l=mu(Math.min((
00009fb0: 72 2e 77 69 64 74 68 2d 6f 29 2f 65 2e 77 2c 28 r.width-o)/e.w,(
00009fc0: 72 2e 68 65 69 67 68 74 2d 6f 29 2f 65 2e 68 29 r.height-o)/e.h)
00009fd0: 2c 61 2a 69 2c 73 2a 69 29 3b 72 65 74 75 72 6e ,a*i,s*i);return
00009fe0: 20 76 6f 69 64 20 30 21 3d 3d 74 3f 2e 74 61 72 void 0!==t?.tar
00009ff0: 67 65 74 5a 6f 6f 6d 26 26 28 6c 3d 4d 61 74 68 getZoom&&(l=Math
0000a000: 2e 6d 69 6e 28 74 2e 74 61 72 67 65 74 5a 6f 6f .min(t.targetZoo
0000a010: 6d 2c 6c 29 29 2c 74 68 69 73 2e 73 65 74 43 61 m,l)),this.setCa
0000a020: 6d 65 72 61 28 6e 65 77 20 73 75 28 2d 65 2e 78 mera(new su(-e.x
0000a030: 2b 28 72 2e 77 69 64 74 68 2d 65 2e 77 2a 6c 29 +(r.width-e.w*l)
0000a040: 2f 32 2f 6c 2c 2d 65 2e 79 2b 28 72 2e 68 65 69 /2/l,-e.y+(r.hei
0000a050: 67 68 74 2d 65 2e 68 2a 6c 29 2f 32 2f 6c 2c 6c ght-e.h*l)/2/l,l
0000a060: 29 2c 74 29 2c 74 68 69 73 7d 73 74 6f 70 43 61 ),t),this}stopCa
0000a070: 6d 65 72 61 41 6e 69 6d 61 74 69 6f 6e 28 29 7b meraAnimation(){
0000a080: 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 return this.emit
0000a090: 28 22 73 74 6f 70 2d 63 61 6d 65 72 61 2d 61 6e ("stop-camera-an
0000a0a0: 69 6d 61 74 69 6f 6e 22 29 2c 74 68 69 73 7d 5f imation"),this}_
0000a0b0: 76 69 65 77 70 6f 72 74 41 6e 69 6d 61 74 69 6f viewportAnimatio
0000a0c0: 6e 3d 6e 75 6c 6c 3b 5f 61 6e 69 6d 61 74 65 56 n=null;_animateV
0000a0d0: 69 65 77 70 6f 72 74 28 65 29 7b 69 66 28 21 74 iewport(e){if(!t
0000a0e0: 68 69 73 2e 5f 76 69 65 77 70 6f 72 74 41 6e 69 his._viewportAni
0000a0f0: 6d 61 74 69 6f 6e 29 72 65 74 75 72 6e 3b 74 68 mation)return;th
0000a100: 69 73 2e 5f 76 69 65 77 70 6f 72 74 41 6e 69 6d is._viewportAnim
0000a110: 61 74 69 6f 6e 2e 65 6c 61 70 73 65 64 2b 3d 65 ation.elapsed+=e
0000a120: 3b 63 6f 6e 73 74 7b 65 6c 61 70 73 65 64 3a 74 ;const{elapsed:t
0000a130: 2c 65 61 73 69 6e 67 3a 6e 2c 64 75 72 61 74 69 ,easing:n,durati
0000a140: 6f 6e 3a 72 2c 73 74 61 72 74 3a 6f 2c 65 6e 64 on:r,start:o,end
0000a150: 3a 69 7d 3d 74 68 69 73 2e 5f 76 69 65 77 70 6f :i}=this._viewpo
0000a160: 72 74 41 6e 69 6d 61 74 69 6f 6e 3b 69 66 28 74 rtAnimation;if(t
0000a170: 3e 72 29 72 65 74 75 72 6e 20 74 68 69 73 2e 6f >r)return this.o
0000a180: 66 66 28 22 74 69 63 6b 22 2c 74 68 69 73 2e 5f ff("tick",this._
0000a190: 61 6e 69 6d 61 74 65 56 69 65 77 70 6f 72 74 29 animateViewport)
0000a1a0: 2c 74 68 69 73 2e 5f 76 69 65 77 70 6f 72 74 41 ,this._viewportA
0000a1b0: 6e 69 6d 61 74 69 6f 6e 3d 6e 75 6c 6c 2c 76 6f nimation=null,vo
0000a1c0: 69 64 20 74 68 69 73 2e 5f 73 65 74 43 61 6d 65 id this._setCame
0000a1d0: 72 61 28 6e 65 77 20 73 75 28 2d 69 2e 78 2c 2d ra(new su(-i.x,-
0000a1e0: 69 2e 79 2c 74 68 69 73 2e 67 65 74 56 69 65 77 i.y,this.getView
0000a1f0: 70 6f 72 74 53 63 72 65 65 6e 42 6f 75 6e 64 73 portScreenBounds
0000a200: 28 29 2e 77 69 64 74 68 2f 69 2e 77 69 64 74 68 ().width/i.width
0000a210: 29 29 3b 63 6f 6e 73 74 20 61 3d 6e 28 31 2d 28 ));const a=n(1-(
0000a220: 72 2d 74 29 2f 72 29 2c 73 3d 6f 2e 6d 69 6e 58 r-t)/r),s=o.minX
0000a230: 2b 28 69 2e 6d 69 6e 58 2d 6f 2e 6d 69 6e 58 29 +(i.minX-o.minX)
0000a240: 2a 61 2c 6c 3d 6f 2e 6d 69 6e 59 2b 28 69 2e 6d *a,l=o.minY+(i.m
0000a250: 69 6e 59 2d 6f 2e 6d 69 6e 59 29 2a 61 2c 63 3d inY-o.minY)*a,c=
0000a260: 6f 2e 6d 61 78 58 2b 28 69 2e 6d 61 78 58 2d 6f o.maxX+(i.maxX-o
0000a270: 2e 6d 61 78 58 29 2a 61 3b 74 68 69 73 2e 5f 73 .maxX)*a;this._s
0000a280: 65 74 43 61 6d 65 72 61 28 6e 65 77 20 73 75 28 etCamera(new su(
0000a290: 2d 73 2c 2d 6c 2c 74 68 69 73 2e 67 65 74 56 69 -s,-l,this.getVi
0000a2a0: 65 77 70 6f 72 74 53 63 72 65 65 6e 42 6f 75 6e ewportScreenBoun
0000a2b0: 64 73 28 29 2e 77 69 64 74 68 2f 28 63 2d 73 29 ds().width/(c-s)
0000a2c0: 29 2c 7b 66 6f 72 63 65 3a 21 30 7d 29 7d 5f 61 ),{force:!0})}_a
0000a2d0: 6e 69 6d 61 74 65 54 6f 56 69 65 77 70 6f 72 74 nimateToViewport
0000a2e0: 28 65 2c 74 3d 7b 61 6e 69 6d 61 74 69 6f 6e 3a (e,t={animation:
0000a2f0: 47 75 7d 29 7b 63 6f 6e 73 74 7b 61 6e 69 6d 61 Gu}){const{anima
0000a300: 74 69 6f 6e 3a 6e 2c 2e 2e 2e 72 7d 3d 74 3b 69 tion:n,...r}=t;i
0000a310: 66 28 21 6e 29 72 65 74 75 72 6e 3b 63 6f 6e 73 f(!n)return;cons
0000a320: 74 7b 64 75 72 61 74 69 6f 6e 3a 6f 3d 30 2c 65 t{duration:o=0,e
0000a330: 61 73 69 6e 67 3a 69 3d 61 75 2e 65 61 73 65 49 asing:i=au.easeI
0000a340: 6e 4f 75 74 43 75 62 69 63 7d 3d 6e 2c 61 3d 74 nOutCubic}=n,a=t
0000a350: 68 69 73 2e 75 73 65 72 2e 67 65 74 41 6e 69 6d his.user.getAnim
0000a360: 61 74 69 6f 6e 53 70 65 65 64 28 29 2c 73 3d 74 ationSpeed(),s=t
0000a370: 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 50 his.getViewportP
0000a380: 61 67 65 42 6f 75 6e 64 73 28 29 3b 72 65 74 75 ageBounds();retu
0000a390: 72 6e 20 74 68 69 73 2e 73 74 6f 70 43 61 6d 65 rn this.stopCame
0000a3a0: 72 61 41 6e 69 6d 61 74 69 6f 6e 28 29 2c 74 68 raAnimation(),th
0000a3b0: 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 is.getInstanceSt
0000a3c0: 61 74 65 28 29 2e 66 6f 6c 6c 6f 77 69 6e 67 55 ate().followingU
0000a3d0: 73 65 72 49 64 26 26 74 68 69 73 2e 73 74 6f 70 serId&&this.stop
0000a3e0: 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 28 29 2c FollowingUser(),
0000a3f0: 30 3d 3d 3d 6f 7c 7c 30 3d 3d 3d 61 3f 74 68 69 0===o||0===a?thi
0000a400: 73 2e 5f 73 65 74 43 61 6d 65 72 61 28 6e 65 77 s._setCamera(new
0000a410: 20 73 75 28 2d 65 2e 78 2c 2d 65 2e 79 2c 74 68 su(-e.x,-e.y,th
0000a420: 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 53 63 is.getViewportSc
0000a430: 72 65 65 6e 42 6f 75 6e 64 73 28 29 2e 77 69 64 reenBounds().wid
0000a440: 74 68 2f 65 2e 77 69 64 74 68 29 2c 7b 2e 2e 2e th/e.width),{...
0000a450: 72 7d 29 3a 28 74 68 69 73 2e 5f 76 69 65 77 70 r}):(this._viewp
0000a460: 6f 72 74 41 6e 69 6d 61 74 69 6f 6e 3d 7b 65 6c ortAnimation={el
0000a470: 61 70 73 65 64 3a 30 2c 64 75 72 61 74 69 6f 6e apsed:0,duration
0000a480: 3a 6f 2f 61 2c 65 61 73 69 6e 67 3a 69 2c 73 74 :o/a,easing:i,st
0000a490: 61 72 74 3a 73 2e 63 6c 6f 6e 65 28 29 2c 65 6e art:s.clone(),en
0000a4a0: 64 3a 65 2e 63 6c 6f 6e 65 28 29 7d 2c 74 68 69 d:e.clone()},thi
0000a4b0: 73 2e 6f 6e 63 65 28 22 73 74 6f 70 2d 63 61 6d s.once("stop-cam
0000a4c0: 65 72 61 2d 61 6e 69 6d 61 74 69 6f 6e 22 2c 28 era-animation",(
0000a4d0: 28 29 3d 3e 7b 74 68 69 73 2e 6f 66 66 28 22 74 ()=>{this.off("t
0000a4e0: 69 63 6b 22 2c 74 68 69 73 2e 5f 61 6e 69 6d 61 ick",this._anima
0000a4f0: 74 65 56 69 65 77 70 6f 72 74 29 2c 74 68 69 73 teViewport),this
0000a500: 2e 5f 76 69 65 77 70 6f 72 74 41 6e 69 6d 61 74 ._viewportAnimat
0000a510: 69 6f 6e 3d 6e 75 6c 6c 7d 29 29 2c 74 68 69 73 ion=null})),this
0000a520: 2e 6f 6e 28 22 74 69 63 6b 22 2c 74 68 69 73 2e .on("tick",this.
0000a530: 5f 61 6e 69 6d 61 74 65 56 69 65 77 70 6f 72 74 _animateViewport
0000a540: 29 2c 74 68 69 73 29 7d 73 6c 69 64 65 43 61 6d ),this)}slideCam
0000a550: 65 72 61 28 65 3d 7b 7d 29 7b 69 66 28 74 68 69 era(e={}){if(thi
0000a560: 73 2e 67 65 74 43 61 6d 65 72 61 4f 70 74 69 6f s.getCameraOptio
0000a570: 6e 73 28 29 2e 69 73 4c 6f 63 6b 65 64 29 72 65 ns().isLocked)re
0000a580: 74 75 72 6e 20 74 68 69 73 3b 69 66 28 30 3d 3d turn this;if(0==
0000a590: 3d 74 68 69 73 2e 75 73 65 72 2e 67 65 74 41 6e =this.user.getAn
0000a5a0: 69 6d 61 74 69 6f 6e 53 70 65 65 64 28 29 29 72 imationSpeed())r
0000a5b0: 65 74 75 72 6e 20 74 68 69 73 3b 74 68 69 73 2e eturn this;this.
0000a5c0: 73 74 6f 70 43 61 6d 65 72 61 41 6e 69 6d 61 74 stopCameraAnimat
0000a5d0: 69 6f 6e 28 29 3b 63 6f 6e 73 74 7b 73 70 65 65 ion();const{spee
0000a5e0: 64 3a 74 2c 66 72 69 63 74 69 6f 6e 3a 6e 3d 74 d:t,friction:n=t
0000a5f0: 68 69 73 2e 6f 70 74 69 6f 6e 73 2e 63 61 6d 65 his.options.came
0000a600: 72 61 53 6c 69 64 65 46 72 69 63 74 69 6f 6e 2c raSlideFriction,
0000a610: 64 69 72 65 63 74 69 6f 6e 3a 72 2c 73 70 65 65 direction:r,spee
0000a620: 64 54 68 72 65 73 68 6f 6c 64 3a 6f 3d 2e 30 31 dThreshold:o=.01
0000a630: 7d 3d 65 3b 6c 65 74 20 69 3d 4d 61 74 68 2e 6d }=e;let i=Math.m
0000a640: 69 6e 28 74 2c 31 29 3b 63 6f 6e 73 74 20 61 3d in(t,1);const a=
0000a650: 28 29 3d 3e 7b 74 68 69 73 2e 6f 66 66 28 22 74 ()=>{this.off("t
0000a660: 69 63 6b 22 2c 73 29 2c 74 68 69 73 2e 6f 66 66 ick",s),this.off
0000a670: 28 22 73 74 6f 70 2d 63 61 6d 65 72 61 2d 61 6e ("stop-camera-an
0000a680: 69 6d 61 74 69 6f 6e 22 2c 61 29 7d 3b 74 68 69 imation",a)};thi
0000a690: 73 2e 6f 6e 63 65 28 22 73 74 6f 70 2d 63 61 6d s.once("stop-cam
0000a6a0: 65 72 61 2d 61 6e 69 6d 61 74 69 6f 6e 22 2c 61 era-animation",a
0000a6b0: 29 3b 63 6f 6e 73 74 20 73 3d 65 3d 3e 7b 63 6f );const s=e=>{co
0000a6c0: 6e 73 74 7b 78 3a 74 2c 79 3a 73 2c 7a 3a 6c 7d nst{x:t,y:s,z:l}
0000a6d0: 3d 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 =this.getCamera(
0000a6e0: 29 2c 63 3d 73 75 2e 4d 75 6c 28 72 2c 69 2a 65 ),c=su.Mul(r,i*e
0000a6f0: 2f 6c 29 3b 69 2a 3d 31 2d 6e 2c 69 3c 6f 3f 61 /l);i*=1-n,i<o?a
0000a700: 28 29 3a 74 68 69 73 2e 5f 73 65 74 43 61 6d 65 ():this._setCame
0000a710: 72 61 28 6e 65 77 20 73 75 28 74 2b 63 2e 78 2c ra(new su(t+c.x,
0000a720: 73 2b 63 2e 79 2c 6c 29 29 7d 3b 72 65 74 75 72 s+c.y,l))};retur
0000a730: 6e 20 74 68 69 73 2e 6f 6e 28 22 74 69 63 6b 22 n this.on("tick"
0000a740: 2c 73 29 2c 74 68 69 73 7d 7a 6f 6f 6d 54 6f 55 ,s),this}zoomToU
0000a750: 73 65 72 28 65 2c 74 3d 7b 61 6e 69 6d 61 74 69 ser(e,t={animati
0000a760: 6f 6e 3a 7b 64 75 72 61 74 69 6f 6e 3a 35 30 30 on:{duration:500
0000a770: 7d 7d 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 }}){const n=this
0000a780: 2e 67 65 74 43 6f 6c 6c 61 62 6f 72 61 74 6f 72 .getCollaborator
0000a790: 73 28 29 2e 66 69 6e 64 28 28 74 3d 3e 74 2e 75 s().find((t=>t.u
0000a7a0: 73 65 72 49 64 3d 3d 3d 65 29 29 3b 72 65 74 75 serId===e));retu
0000a7b0: 72 6e 20 6e 3f 28 74 68 69 73 2e 62 61 74 63 68 rn n?(this.batch
0000a7c0: 28 28 28 29 3d 3e 7b 6e 75 6c 6c 21 3d 3d 74 68 ((()=>{null!==th
0000a7d0: 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 is.getInstanceSt
0000a7e0: 61 74 65 28 29 2e 66 6f 6c 6c 6f 77 69 6e 67 55 ate().followingU
0000a7f0: 73 65 72 49 64 26 26 74 68 69 73 2e 73 74 6f 70 serId&&this.stop
0000a800: 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 28 29 3b FollowingUser();
0000a810: 63 6f 6e 73 74 20 72 3d 6e 2e 63 75 72 72 65 6e const r=n.curren
0000a820: 74 50 61 67 65 49 64 3d 3d 3d 74 68 69 73 2e 67 tPageId===this.g
0000a830: 65 74 43 75 72 72 65 6e 74 50 61 67 65 49 64 28 etCurrentPageId(
0000a840: 29 3b 72 7c 7c 74 68 69 73 2e 73 65 74 43 75 72 );r||this.setCur
0000a850: 72 65 6e 74 50 61 67 65 28 6e 2e 63 75 72 72 65 rentPage(n.curre
0000a860: 6e 74 50 61 67 65 49 64 29 2c 74 26 26 74 2e 61 ntPageId),t&&t.a
0000a870: 6e 69 6d 61 74 69 6f 6e 26 26 21 72 26 26 28 74 nimation&&!r&&(t
0000a880: 2e 61 6e 69 6d 61 74 69 6f 6e 3d 76 6f 69 64 20 .animation=void
0000a890: 30 29 2c 74 68 69 73 2e 63 65 6e 74 65 72 4f 6e 0),this.centerOn
0000a8a0: 50 6f 69 6e 74 28 6e 2e 63 75 72 73 6f 72 2c 74 Point(n.cursor,t
0000a8b0: 29 3b 63 6f 6e 73 74 7b 68 69 67 68 6c 69 67 68 );const{highligh
0000a8c0: 74 65 64 55 73 65 72 49 64 73 3a 6f 7d 3d 74 68 tedUserIds:o}=th
0000a8d0: 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 is.getInstanceSt
0000a8e0: 61 74 65 28 29 3b 74 68 69 73 2e 75 70 64 61 74 ate();this.updat
0000a8f0: 65 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 7b eInstanceState({
0000a900: 68 69 67 68 6c 69 67 68 74 65 64 55 73 65 72 49 highlightedUserI
0000a910: 64 73 3a 5b 2e 2e 2e 6f 2c 65 5d 7d 29 2c 74 68 ds:[...o,e]}),th
0000a920: 69 73 2e 74 69 6d 65 72 73 2e 73 65 74 54 69 6d is.timers.setTim
0000a930: 65 6f 75 74 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 eout((()=>{const
0000a940: 20 74 3d 5b 2e 2e 2e 74 68 69 73 2e 67 65 74 49 t=[...this.getI
0000a950: 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e 68 nstanceState().h
0000a960: 69 67 68 6c 69 67 68 74 65 64 55 73 65 72 49 64 ighlightedUserId
0000a970: 73 5d 2c 6e 3d 74 2e 69 6e 64 65 78 4f 66 28 65 s],n=t.indexOf(e
0000a980: 29 3b 6e 3c 30 7c 7c 28 74 2e 73 70 6c 69 63 65 );n<0||(t.splice
0000a990: 28 6e 2c 31 29 2c 74 68 69 73 2e 75 70 64 61 74 (n,1),this.updat
0000a9a0: 65 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 7b eInstanceState({
0000a9b0: 68 69 67 68 6c 69 67 68 74 65 64 55 73 65 72 49 highlightedUserI
0000a9c0: 64 73 3a 74 7d 29 29 7d 29 2c 74 68 69 73 2e 6f ds:t}))}),this.o
0000a9d0: 70 74 69 6f 6e 73 2e 63 6f 6c 6c 61 62 6f 72 61 ptions.collabora
0000a9e0: 74 6f 72 49 64 6c 65 54 69 6d 65 6f 75 74 4d 73 torIdleTimeoutMs
0000a9f0: 29 7d 29 29 2c 74 68 69 73 29 3a 74 68 69 73 7d )})),this):this}
0000aa00: 5f 77 69 6c 6c 53 65 74 49 6e 69 74 69 61 6c 42 _willSetInitialB
0000aa10: 6f 75 6e 64 73 3d 21 30 3b 75 70 64 61 74 65 56 ounds=!0;updateV
0000aa20: 69 65 77 70 6f 72 74 53 63 72 65 65 6e 42 6f 75 iewportScreenBou
0000aa30: 6e 64 73 28 65 2c 74 3d 21 31 29 7b 65 2e 77 69 nds(e,t=!1){e.wi
0000aa40: 64 74 68 3d 4d 61 74 68 2e 6d 61 78 28 65 2e 77 dth=Math.max(e.w
0000aa50: 69 64 74 68 2c 31 29 2c 65 2e 68 65 69 67 68 74 idth,1),e.height
0000aa60: 3d 4d 61 74 68 2e 6d 61 78 28 65 2e 68 65 69 67 =Math.max(e.heig
0000aa70: 68 74 2c 31 29 3b 63 6f 6e 73 74 20 6e 3d 5b 30 ht,1);const n=[0
0000aa80: 21 3d 3d 65 2e 6d 69 6e 59 2c 21 62 75 28 64 6f !==e.minY,!bu(do
0000aa90: 63 75 6d 65 6e 74 2e 62 6f 64 79 2e 73 63 72 6f cument.body.scro
0000aaa0: 6c 6c 57 69 64 74 68 2c 65 2e 6d 61 78 58 2c 31 llWidth,e.maxX,1
0000aab0: 29 2c 21 62 75 28 64 6f 63 75 6d 65 6e 74 2e 62 ),!bu(document.b
0000aac0: 6f 64 79 2e 73 63 72 6f 6c 6c 48 65 69 67 68 74 ody.scrollHeight
0000aad0: 2c 65 2e 6d 61 78 59 2c 31 29 2c 30 21 3d 3d 65 ,e.maxY,1),0!==e
0000aae0: 2e 6d 69 6e 58 5d 2c 7b 73 63 72 65 65 6e 42 6f .minX],{screenBo
0000aaf0: 75 6e 64 73 3a 72 2c 69 6e 73 65 74 73 3a 6f 7d unds:r,insets:o}
0000ab00: 3d 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 =this.getInstanc
0000ab10: 65 53 74 61 74 65 28 29 3b 69 66 28 65 2e 65 71 eState();if(e.eq
0000ab20: 75 61 6c 73 28 72 29 26 26 6e 2e 65 76 65 72 79 uals(r)&&n.every
0000ab30: 28 28 28 65 2c 74 29 3d 3e 65 3d 3d 3d 6f 5b 74 (((e,t)=>e===o[t
0000ab40: 5d 29 29 29 72 65 74 75 72 6e 20 74 68 69 73 3b ])))return this;
0000ab50: 63 6f 6e 73 74 7b 5f 77 69 6c 6c 53 65 74 49 6e const{_willSetIn
0000ab60: 69 74 69 61 6c 42 6f 75 6e 64 73 3a 69 7d 3d 74 itialBounds:i}=t
0000ab70: 68 69 73 3b 69 66 28 74 68 69 73 2e 5f 77 69 6c his;if(this._wil
0000ab80: 6c 53 65 74 49 6e 69 74 69 61 6c 42 6f 75 6e 64 lSetInitialBound
0000ab90: 73 3d 21 31 2c 69 29 74 68 69 73 2e 75 70 64 61 s=!1,i)this.upda
0000aba0: 74 65 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 teInstanceState(
0000abb0: 7b 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 65 2e {screenBounds:e.
0000abc0: 74 6f 4a 73 6f 6e 28 29 2c 69 6e 73 65 74 73 3a toJson(),insets:
0000abd0: 6e 7d 29 2c 74 68 69 73 2e 73 65 74 43 61 6d 65 n}),this.setCame
0000abe0: 72 61 28 74 68 69 73 2e 67 65 74 43 61 6d 65 72 ra(this.getCamer
0000abf0: 61 28 29 29 3b 65 6c 73 65 20 69 66 28 74 26 26 a());else if(t&&
0000ac00: 21 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 !this.getInstanc
0000ac10: 65 53 74 61 74 65 28 29 2e 66 6f 6c 6c 6f 77 69 eState().followi
0000ac20: 6e 67 55 73 65 72 49 64 29 7b 63 6f 6e 73 74 20 ngUserId){const
0000ac30: 74 3d 74 68 69 73 2e 67 65 74 56 69 65 77 70 6f t=this.getViewpo
0000ac40: 72 74 50 61 67 65 42 6f 75 6e 64 73 28 29 2e 63 rtPageBounds().c
0000ac50: 65 6e 74 65 72 3b 74 68 69 73 2e 75 70 64 61 74 enter;this.updat
0000ac60: 65 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 7b eInstanceState({
0000ac70: 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 65 2e 74 screenBounds:e.t
0000ac80: 6f 4a 73 6f 6e 28 29 2c 69 6e 73 65 74 73 3a 6e oJson(),insets:n
0000ac90: 7d 29 2c 74 68 69 73 2e 63 65 6e 74 65 72 4f 6e }),this.centerOn
0000aca0: 50 6f 69 6e 74 28 74 29 7d 65 6c 73 65 20 74 68 Point(t)}else th
0000acb0: 69 73 2e 75 70 64 61 74 65 49 6e 73 74 61 6e 63 is.updateInstanc
0000acc0: 65 53 74 61 74 65 28 7b 73 63 72 65 65 6e 42 6f eState({screenBo
0000acd0: 75 6e 64 73 3a 65 2e 74 6f 4a 73 6f 6e 28 29 2c unds:e.toJson(),
0000ace0: 69 6e 73 65 74 73 3a 6e 7d 29 2c 74 68 69 73 2e insets:n}),this.
0000acf0: 5f 73 65 74 43 61 6d 65 72 61 28 73 75 2e 46 72 _setCamera(su.Fr
0000ad00: 6f 6d 28 7b 2e 2e 2e 74 68 69 73 2e 67 65 74 43 om({...this.getC
0000ad10: 61 6d 65 72 61 28 29 7d 29 29 3b 72 65 74 75 72 amera()}));retur
0000ad20: 6e 20 74 68 69 73 2e 5f 74 69 63 6b 43 61 6d 65 n this._tickCame
0000ad30: 72 61 53 74 61 74 65 28 29 2c 74 68 69 73 7d 67 raState(),this}g
0000ad40: 65 74 56 69 65 77 70 6f 72 74 53 63 72 65 65 6e etViewportScreen
0000ad50: 42 6f 75 6e 64 73 28 29 7b 63 6f 6e 73 74 7b 78 Bounds(){const{x
0000ad60: 3a 65 2c 79 3a 74 2c 77 3a 6e 2c 68 3a 72 7d 3d :e,y:t,w:n,h:r}=
0000ad70: 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 this.getInstance
0000ad80: 53 74 61 74 65 28 29 2e 73 63 72 65 65 6e 42 6f State().screenBo
0000ad90: 75 6e 64 73 3b 72 65 74 75 72 6e 20 6e 65 77 20 unds;return new
0000ada0: 5f 70 28 65 2c 74 2c 6e 2c 72 29 7d 67 65 74 56 _p(e,t,n,r)}getV
0000adb0: 69 65 77 70 6f 72 74 53 63 72 65 65 6e 43 65 6e iewportScreenCen
0000adc0: 74 65 72 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 ter(){const e=th
0000add0: 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 53 63 is.getViewportSc
0000ade0: 72 65 65 6e 42 6f 75 6e 64 73 28 29 3b 72 65 74 reenBounds();ret
0000adf0: 75 72 6e 20 6e 65 77 20 73 75 28 65 2e 6d 69 64 urn new su(e.mid
0000ae00: 58 2d 65 2e 6d 69 6e 58 2c 65 2e 6d 69 64 59 2d X-e.minX,e.midY-
0000ae10: 65 2e 6d 69 6e 59 29 7d 67 65 74 56 69 65 77 70 e.minY)}getViewp
0000ae20: 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 28 29 7b ortPageBounds(){
0000ae30: 63 6f 6e 73 74 7b 77 3a 65 2c 68 3a 74 7d 3d 74 const{w:e,h:t}=t
0000ae40: 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 53 his.getViewportS
0000ae50: 63 72 65 65 6e 42 6f 75 6e 64 73 28 29 2c 7b 78 creenBounds(),{x
0000ae60: 3a 6e 2c 79 3a 72 2c 7a 3a 6f 7d 3d 74 68 69 73 :n,y:r,z:o}=this
0000ae70: 2e 67 65 74 43 61 6d 65 72 61 28 29 3b 72 65 74 .getCamera();ret
0000ae80: 75 72 6e 20 6e 65 77 20 5f 70 28 2d 6e 2c 2d 72 urn new _p(-n,-r
0000ae90: 2c 65 2f 6f 2c 74 2f 6f 29 7d 73 63 72 65 65 6e ,e/o,t/o)}screen
0000aea0: 54 6f 50 61 67 65 28 65 29 7b 63 6f 6e 73 74 7b ToPage(e){const{
0000aeb0: 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 74 7d 3d screenBounds:t}=
0000aec0: 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 61 66 this.store.unsaf
0000aed0: 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 74 75 eGetWithoutCaptu
0000aee0: 72 65 28 62 6c 29 2c 7b 78 3a 6e 2c 79 3a 72 2c re(bl),{x:n,y:r,
0000aef0: 7a 3a 6f 3d 31 7d 3d 74 68 69 73 2e 67 65 74 43 z:o=1}=this.getC
0000af00: 61 6d 65 72 61 28 29 3b 72 65 74 75 72 6e 20 6e amera();return n
0000af10: 65 77 20 73 75 28 28 65 2e 78 2d 74 2e 78 29 2f ew su((e.x-t.x)/
0000af20: 6f 2d 6e 2c 28 65 2e 79 2d 74 2e 79 29 2f 6f 2d o-n,(e.y-t.y)/o-
0000af30: 72 2c 65 2e 7a 3f 3f 2e 35 29 7d 70 61 67 65 54 r,e.z??.5)}pageT
0000af40: 6f 53 63 72 65 65 6e 28 65 29 7b 63 6f 6e 73 74 oScreen(e){const
0000af50: 7b 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 74 7d {screenBounds:t}
0000af60: 3d 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 61 =this.store.unsa
0000af70: 66 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 74 feGetWithoutCapt
0000af80: 75 72 65 28 62 6c 29 2c 7b 78 3a 6e 2c 79 3a 72 ure(bl),{x:n,y:r
0000af90: 2c 7a 3a 6f 3d 31 7d 3d 74 68 69 73 2e 67 65 74 ,z:o=1}=this.get
0000afa0: 43 61 6d 65 72 61 28 29 3b 72 65 74 75 72 6e 20 Camera();return
0000afb0: 6e 65 77 20 73 75 28 28 65 2e 78 2b 6e 29 2a 6f new su((e.x+n)*o
0000afc0: 2b 74 2e 78 2c 28 65 2e 79 2b 72 29 2a 6f 2b 74 +t.x,(e.y+r)*o+t
0000afd0: 2e 79 2c 65 2e 7a 3f 3f 2e 35 29 7d 70 61 67 65 .y,e.z??.5)}page
0000afe0: 54 6f 56 69 65 77 70 6f 72 74 28 65 29 7b 63 6f ToViewport(e){co
0000aff0: 6e 73 74 7b 78 3a 74 2c 79 3a 6e 2c 7a 3a 72 3d nst{x:t,y:n,z:r=
0000b000: 31 7d 3d 74 68 69 73 2e 67 65 74 43 61 6d 65 72 1}=this.getCamer
0000b010: 61 28 29 3b 72 65 74 75 72 6e 20 6e 65 77 20 73 a();return new s
0000b020: 75 28 28 65 2e 78 2b 74 29 2a 72 2c 28 65 2e 79 u((e.x+t)*r,(e.y
0000b030: 2b 6e 29 2a 72 2c 65 2e 7a 3f 3f 2e 35 29 7d 5f +n)*r,e.z??.5)}_
0000b040: 67 65 74 43 6f 6c 6c 61 62 6f 72 61 74 6f 72 73 getCollaborators
0000b050: 51 75 65 72 79 28 29 7b 72 65 74 75 72 6e 20 74 Query(){return t
0000b060: 68 69 73 2e 73 74 6f 72 65 2e 71 75 65 72 79 2e his.store.query.
0000b070: 72 65 63 6f 72 64 73 28 22 69 6e 73 74 61 6e 63 records("instanc
0000b080: 65 5f 70 72 65 73 65 6e 63 65 22 2c 28 28 29 3d e_presence",(()=
0000b090: 3e 28 7b 75 73 65 72 49 64 3a 7b 6e 65 71 3a 74 >({userId:{neq:t
0000b0a0: 68 69 73 2e 75 73 65 72 2e 67 65 74 49 64 28 29 his.user.getId()
0000b0b0: 7d 7d 29 29 29 7d 67 65 74 43 6f 6c 6c 61 62 6f }})))}getCollabo
0000b0c0: 72 61 74 6f 72 73 28 29 7b 63 6f 6e 73 74 20 65 rators(){const e
0000b0d0: 3d 74 68 69 73 2e 5f 67 65 74 43 6f 6c 6c 61 62 =this._getCollab
0000b0e0: 6f 72 61 74 6f 72 73 51 75 65 72 79 28 29 2e 67 oratorsQuery().g
0000b0f0: 65 74 28 29 3b 69 66 28 21 65 2e 6c 65 6e 67 74 et();if(!e.lengt
0000b100: 68 29 72 65 74 75 72 6e 20 43 69 3b 72 65 74 75 h)return Ci;retu
0000b110: 72 6e 5b 2e 2e 2e 6e 65 77 20 53 65 74 28 65 2e rn[...new Set(e.
0000b120: 6d 61 70 28 28 65 3d 3e 65 2e 75 73 65 72 49 64 map((e=>e.userId
0000b130: 29 29 29 5d 2e 73 6f 72 74 28 29 2e 6d 61 70 28 )))].sort().map(
0000b140: 28 74 3d 3e 65 2e 66 69 6c 74 65 72 28 28 65 3d (t=>e.filter((e=
0000b150: 3e 65 2e 75 73 65 72 49 64 3d 3d 3d 74 29 29 2e >e.userId===t)).
0000b160: 73 6f 72 74 28 28 28 65 2c 74 29 3d 3e 74 2e 6c sort(((e,t)=>t.l
0000b170: 61 73 74 41 63 74 69 76 69 74 79 54 69 6d 65 73 astActivityTimes
0000b180: 74 61 6d 70 2d 65 2e 6c 61 73 74 41 63 74 69 76 tamp-e.lastActiv
0000b190: 69 74 79 54 69 6d 65 73 74 61 6d 70 29 29 5b 30 ityTimestamp))[0
0000b1a0: 5d 29 29 7d 67 65 74 43 6f 6c 6c 61 62 6f 72 61 ]))}getCollabora
0000b1b0: 74 6f 72 73 4f 6e 43 75 72 72 65 6e 74 50 61 67 torsOnCurrentPag
0000b1c0: 65 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 e(){const e=this
0000b1d0: 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 49 .getCurrentPageI
0000b1e0: 64 28 29 3b 72 65 74 75 72 6e 20 74 68 69 73 2e d();return this.
0000b1f0: 67 65 74 43 6f 6c 6c 61 62 6f 72 61 74 6f 72 73 getCollaborators
0000b200: 28 29 2e 66 69 6c 74 65 72 28 28 74 3d 3e 74 2e ().filter((t=>t.
0000b210: 63 75 72 72 65 6e 74 50 61 67 65 49 64 3d 3d 3d currentPageId===
0000b220: 65 29 29 7d 5f 69 73 4c 6f 63 6b 65 64 4f 6e 46 e))}_isLockedOnF
0000b230: 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 3d 59 69 28 ollowingUser=Yi(
0000b240: 22 69 73 4c 6f 63 6b 65 64 4f 6e 46 6f 6c 6c 6f "isLockedOnFollo
0000b250: 77 69 6e 67 55 73 65 72 22 2c 21 31 29 3b 73 74 wingUser",!1);st
0000b260: 61 72 74 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 artFollowingUser
0000b270: 28 65 29 7b 74 68 69 73 2e 73 74 6f 70 46 6f 6c (e){this.stopFol
0000b280: 6c 6f 77 69 6e 67 55 73 65 72 28 29 3b 63 6f 6e lowingUser();con
0000b290: 73 74 20 74 3d 74 68 69 73 2e 5f 67 65 74 43 6f st t=this._getCo
0000b2a0: 6c 6c 61 62 6f 72 61 74 6f 72 73 51 75 65 72 79 llaboratorsQuery
0000b2b0: 28 29 2e 67 65 74 28 29 2e 66 69 6c 74 65 72 28 ().get().filter(
0000b2c0: 28 74 3d 3e 74 2e 75 73 65 72 49 64 3d 3d 3d 65 (t=>t.userId===e
0000b2d0: 29 29 3b 69 66 28 21 74 2e 6c 65 6e 67 74 68 29 ));if(!t.length)
0000b2e0: 72 65 74 75 72 6e 20 63 6f 6e 73 6f 6c 65 2e 77 return console.w
0000b2f0: 61 72 6e 28 22 55 73 65 72 20 6e 6f 74 20 66 6f arn("User not fo
0000b300: 75 6e 64 22 29 2c 74 68 69 73 3b 63 6f 6e 73 74 und"),this;const
0000b310: 20 6e 3d 74 68 69 73 2e 75 73 65 72 2e 67 65 74 n=this.user.get
0000b320: 49 64 28 29 3b 69 66 28 6e 7c 7c 63 6f 6e 73 6f Id();if(n||conso
0000b330: 6c 65 2e 77 61 72 6e 28 22 59 6f 75 20 73 68 6f le.warn("You sho
0000b340: 75 6c 64 20 73 65 74 20 74 68 65 20 75 73 65 72 uld set the user
0000b350: 49 64 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 Id for the curre
0000b360: 6e 74 20 69 6e 73 74 61 6e 63 65 20 62 65 66 6f nt instance befo
0000b370: 72 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 20 75 re following a u
0000b380: 73 65 72 22 29 2c 74 2e 73 6f 6d 65 28 28 65 3d ser"),t.some((e=
0000b390: 3e 65 2e 66 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 >e.followingUser
0000b3a0: 49 64 3d 3d 3d 6e 29 29 29 72 65 74 75 72 6e 20 Id===n)))return
0000b3b0: 74 68 69 73 3b 63 6f 6e 73 74 20 72 3d 6f 61 28 this;const r=oa(
0000b3c0: 22 6c 61 74 65 73 74 4c 65 61 64 65 72 50 72 65 "latestLeaderPre
0000b3d0: 73 65 6e 63 65 22 2c 28 28 29 3d 3e 74 68 69 73 sence",(()=>this
0000b3e0: 2e 67 65 74 43 6f 6c 6c 61 62 6f 72 61 74 6f 72 .getCollaborator
0000b3f0: 73 28 29 2e 66 69 6e 64 28 28 74 3d 3e 74 2e 75 s().find((t=>t.u
0000b400: 73 65 72 49 64 3d 3d 3d 65 29 29 29 29 3b 72 65 serId===e))));re
0000b410: 74 75 72 6e 20 71 69 28 28 28 29 3d 3e 7b 74 68 turn qi((()=>{th
0000b420: 69 73 2e 75 70 64 61 74 65 49 6e 73 74 61 6e 63 is.updateInstanc
0000b430: 65 53 74 61 74 65 28 7b 66 6f 6c 6c 6f 77 69 6e eState({followin
0000b440: 67 55 73 65 72 49 64 3a 65 7d 2c 7b 68 69 73 74 gUserId:e},{hist
0000b450: 6f 72 79 3a 22 69 67 6e 6f 72 65 22 7d 29 3b 63 ory:"ignore"});c
0000b460: 6f 6e 73 74 20 74 3d 42 69 28 22 75 70 64 61 74 onst t=Bi("updat
0000b470: 65 20 63 75 72 72 65 6e 74 20 70 61 67 65 22 2c e current page",
0000b480: 28 28 29 3d 3e 7b 63 6f 6e 73 74 20 65 3d 72 2e (()=>{const e=r.
0000b490: 67 65 74 28 29 3b 65 3f 65 2e 63 75 72 72 65 6e get();e?e.curren
0000b4a0: 74 50 61 67 65 49 64 21 3d 3d 74 68 69 73 2e 67 tPageId!==this.g
0000b4b0: 65 74 43 75 72 72 65 6e 74 50 61 67 65 49 64 28 etCurrentPageId(
0000b4c0: 29 26 26 74 68 69 73 2e 67 65 74 50 61 67 65 28 )&&this.getPage(
0000b4d0: 65 2e 63 75 72 72 65 6e 74 50 61 67 65 49 64 29 e.currentPageId)
0000b4e0: 26 26 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 69 &&this.history.i
0000b4f0: 67 6e 6f 72 65 28 28 28 29 3d 3e 7b 74 68 69 73 gnore((()=>{this
0000b500: 2e 73 74 6f 72 65 2e 70 75 74 28 5b 7b 2e 2e 2e .store.put([{...
0000b510: 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 this.getInstance
0000b520: 53 74 61 74 65 28 29 2c 63 75 72 72 65 6e 74 50 State(),currentP
0000b530: 61 67 65 49 64 3a 65 2e 63 75 72 72 65 6e 74 50 ageId:e.currentP
0000b540: 61 67 65 49 64 7d 5d 29 2c 74 68 69 73 2e 5f 69 ageId}]),this._i
0000b550: 73 4c 6f 63 6b 65 64 4f 6e 46 6f 6c 6c 6f 77 69 sLockedOnFollowi
0000b560: 6e 67 55 73 65 72 2e 73 65 74 28 21 30 29 7d 29 ngUser.set(!0)})
0000b570: 29 3a 74 68 69 73 2e 73 74 6f 70 46 6f 6c 6c 6f ):this.stopFollo
0000b580: 77 69 6e 67 55 73 65 72 28 29 7d 29 29 2c 6e 3d wingUser()})),n=
0000b590: 28 29 3d 3e 7b 74 28 29 2c 74 68 69 73 2e 5f 69 ()=>{t(),this._i
0000b5a0: 73 4c 6f 63 6b 65 64 4f 6e 46 6f 6c 6c 6f 77 69 sLockedOnFollowi
0000b5b0: 6e 67 55 73 65 72 2e 73 65 74 28 21 31 29 2c 74 ngUser.set(!1),t
0000b5c0: 68 69 73 2e 6f 66 66 28 22 66 72 61 6d 65 22 2c his.off("frame",
0000b5d0: 6f 29 2c 74 68 69 73 2e 6f 66 66 28 22 73 74 6f o),this.off("sto
0000b5e0: 70 2d 66 6f 6c 6c 6f 77 69 6e 67 22 2c 6e 29 7d p-following",n)}
0000b5f0: 2c 6f 3d 28 29 3d 3e 7b 69 66 28 21 72 2e 67 65 ,o=()=>{if(!r.ge
0000b600: 74 28 29 29 72 65 74 75 72 6e 20 76 6f 69 64 20 t())return void
0000b610: 74 68 69 73 2e 73 74 6f 70 46 6f 6c 6c 6f 77 69 this.stopFollowi
0000b620: 6e 67 55 73 65 72 28 29 3b 69 66 28 74 68 69 73 ngUser();if(this
0000b630: 2e 5f 69 73 4c 6f 63 6b 65 64 4f 6e 46 6f 6c 6c ._isLockedOnFoll
0000b640: 6f 77 69 6e 67 55 73 65 72 2e 67 65 74 28 29 29 owingUser.get())
0000b650: 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 65 3d 74 return;const e=t
0000b660: 68 69 73 2e 75 73 65 72 2e 67 65 74 41 6e 69 6d his.user.getAnim
0000b670: 61 74 69 6f 6e 53 70 65 65 64 28 29 3b 69 66 28 ationSpeed();if(
0000b680: 30 3d 3d 3d 65 29 72 65 74 75 72 6e 20 76 6f 69 0===e)return voi
0000b690: 64 20 74 68 69 73 2e 5f 69 73 4c 6f 63 6b 65 64 d this._isLocked
0000b6a0: 4f 6e 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 2e OnFollowingUser.
0000b6b0: 73 65 74 28 21 30 29 3b 63 6f 6e 73 74 20 74 3d set(!0);const t=
0000b6c0: 74 68 69 73 2e 67 65 74 56 69 65 77 70 6f 72 74 this.getViewport
0000b6d0: 50 61 67 65 42 6f 75 6e 64 73 46 6f 72 46 6f 6c PageBoundsForFol
0000b6e0: 6c 6f 77 69 6e 67 28 29 3b 69 66 28 21 74 29 72 lowing();if(!t)r
0000b6f0: 65 74 75 72 6e 20 76 6f 69 64 20 74 68 69 73 2e eturn void this.
0000b700: 73 74 6f 70 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 stopFollowingUse
0000b710: 72 28 29 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 r();const n=this
0000b720: 2e 67 65 74 56 69 65 77 70 6f 72 74 50 61 67 65 .getViewportPage
0000b730: 42 6f 75 6e 64 73 28 29 2c 6f 3d 4d 61 74 68 2e Bounds(),o=Math.
0000b740: 61 62 73 28 74 2e 6d 69 6e 58 2d 6e 2e 6d 69 6e abs(t.minX-n.min
0000b750: 58 29 2b 4d 61 74 68 2e 61 62 73 28 74 2e 6d 61 X)+Math.abs(t.ma
0000b760: 78 58 2d 6e 2e 6d 61 78 58 29 2c 69 3d 4d 61 74 xX-n.maxX),i=Mat
0000b770: 68 2e 61 62 73 28 74 2e 6d 69 6e 59 2d 6e 2e 6d h.abs(t.minY-n.m
0000b780: 69 6e 59 29 2b 4d 61 74 68 2e 61 62 73 28 74 2e inY)+Math.abs(t.
0000b790: 6d 61 78 59 2d 6e 2e 6d 61 78 59 29 3b 69 66 28 maxY-n.maxY);if(
0000b7a0: 6f 3c 74 68 69 73 2e 6f 70 74 69 6f 6e 73 2e 66 o<this.options.f
0000b7b0: 6f 6c 6c 6f 77 43 68 61 73 65 56 69 65 77 70 6f ollowChaseViewpo
0000b7c0: 72 74 53 6e 61 70 26 26 69 3c 74 68 69 73 2e 6f rtSnap&&i<this.o
0000b7d0: 70 74 69 6f 6e 73 2e 66 6f 6c 6c 6f 77 43 68 61 ptions.followCha
0000b7e0: 73 65 56 69 65 77 70 6f 72 74 53 6e 61 70 29 72 seViewportSnap)r
0000b7f0: 65 74 75 72 6e 20 76 6f 69 64 20 74 68 69 73 2e eturn void this.
0000b800: 5f 69 73 4c 6f 63 6b 65 64 4f 6e 46 6f 6c 6c 6f _isLockedOnFollo
0000b810: 77 69 6e 67 55 73 65 72 2e 73 65 74 28 21 30 29 wingUser.set(!0)
0000b820: 3b 63 6f 6e 73 74 20 61 3d 6d 75 28 2e 35 2a 65 ;const a=mu(.5*e
0000b830: 2c 2e 31 2c 2e 38 29 2c 73 3d 6e 65 77 20 5f 70 ,.1,.8),s=new _p
0000b840: 28 68 6f 28 6e 2e 6d 69 6e 58 2c 74 2e 6d 69 6e (ho(n.minX,t.min
0000b850: 58 2c 61 29 2c 68 6f 28 6e 2e 6d 69 6e 59 2c 74 X,a),ho(n.minY,t
0000b860: 2e 6d 69 6e 59 2c 61 29 2c 68 6f 28 6e 2e 77 69 .minY,a),ho(n.wi
0000b870: 64 74 68 2c 74 2e 77 69 64 74 68 2c 61 29 2c 68 dth,t.width,a),h
0000b880: 6f 28 6e 2e 68 65 69 67 68 74 2c 74 2e 68 65 69 o(n.height,t.hei
0000b890: 67 68 74 2c 61 29 29 2c 6c 3d 6e 65 77 20 73 75 ght,a)),l=new su
0000b8a0: 28 2d 73 2e 78 2c 2d 73 2e 79 2c 74 68 69 73 2e (-s.x,-s.y,this.
0000b8b0: 67 65 74 56 69 65 77 70 6f 72 74 53 63 72 65 65 getViewportScree
0000b8c0: 6e 42 6f 75 6e 64 73 28 29 2e 77 69 64 74 68 2f nBounds().width/
0000b8d0: 73 2e 77 69 64 74 68 29 3b 74 68 69 73 2e 73 74 s.width);this.st
0000b8e0: 6f 70 43 61 6d 65 72 61 41 6e 69 6d 61 74 69 6f opCameraAnimatio
0000b8f0: 6e 28 29 2c 74 68 69 73 2e 5f 73 65 74 43 61 6d n(),this._setCam
0000b900: 65 72 61 28 6c 29 7d 3b 74 68 69 73 2e 6f 6e 63 era(l)};this.onc
0000b910: 65 28 22 73 74 6f 70 2d 66 6f 6c 6c 6f 77 69 6e e("stop-followin
0000b920: 67 22 2c 6e 29 2c 74 68 69 73 2e 61 64 64 4c 69 g",n),this.addLi
0000b930: 73 74 65 6e 65 72 28 22 66 72 61 6d 65 22 2c 6f stener("frame",o
0000b940: 29 2c 6f 28 29 7d 29 29 2c 74 68 69 73 7d 73 74 ),o()})),this}st
0000b950: 6f 70 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 72 28 opFollowingUser(
0000b960: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 ){return this.hi
0000b970: 73 74 6f 72 79 2e 69 67 6e 6f 72 65 28 28 28 29 story.ignore((()
0000b980: 3d 3e 7b 74 68 69 73 2e 73 74 6f 72 65 2e 70 75 =>{this.store.pu
0000b990: 74 28 5b 74 68 69 73 2e 67 65 74 43 61 6d 65 72 t([this.getCamer
0000b9a0: 61 28 29 5d 29 2c 74 68 69 73 2e 5f 69 73 4c 6f a()]),this._isLo
0000b9b0: 63 6b 65 64 4f 6e 46 6f 6c 6c 6f 77 69 6e 67 55 ckedOnFollowingU
0000b9c0: 73 65 72 2e 73 65 74 28 21 31 29 2c 74 68 69 73 ser.set(!1),this
0000b9d0: 2e 75 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 .updateInstanceS
0000b9e0: 74 61 74 65 28 7b 66 6f 6c 6c 6f 77 69 6e 67 55 tate({followingU
0000b9f0: 73 65 72 49 64 3a 6e 75 6c 6c 7d 29 2c 74 68 69 serId:null}),thi
0000ba00: 73 2e 65 6d 69 74 28 22 73 74 6f 70 2d 66 6f 6c s.emit("stop-fol
0000ba10: 6c 6f 77 69 6e 67 22 29 7d 29 29 2c 74 68 69 73 lowing")})),this
0000ba20: 7d 67 65 74 55 6e 6f 72 64 65 72 65 64 52 65 6e }getUnorderedRen
0000ba30: 64 65 72 69 6e 67 53 68 61 70 65 73 28 65 29 7b deringShapes(e){
0000ba40: 63 6f 6e 73 74 20 74 3d 5b 5d 3b 6c 65 74 20 6e const t=[];let n
0000ba50: 3d 32 2a 74 68 69 73 2e 6f 70 74 69 6f 6e 73 2e =2*this.options.
0000ba60: 6d 61 78 53 68 61 70 65 73 50 65 72 50 61 67 65 maxShapesPerPage
0000ba70: 2c 72 3d 74 68 69 73 2e 6f 70 74 69 6f 6e 73 2e ,r=this.options.
0000ba80: 6d 61 78 53 68 61 70 65 73 50 65 72 50 61 67 65 maxShapesPerPage
0000ba90: 3b 63 6f 6e 73 74 20 6f 3d 74 68 69 73 2e 67 65 ;const o=this.ge
0000baa0: 74 45 72 61 73 69 6e 67 53 68 61 70 65 49 64 73 tErasingShapeIds
0000bab0: 28 29 2c 69 3d 28 61 2c 73 2c 6c 29 3d 3e 7b 63 (),i=(a,s,l)=>{c
0000bac0: 6f 6e 73 74 20 63 3d 74 68 69 73 2e 67 65 74 53 onst c=this.getS
0000bad0: 68 61 70 65 28 61 29 3b 69 66 28 21 63 29 72 65 hape(a);if(!c)re
0000bae0: 74 75 72 6e 3b 73 2a 3d 63 2e 6f 70 61 63 69 74 turn;s*=c.opacit
0000baf0: 79 3b 6c 65 74 20 75 3d 21 31 3b 63 6f 6e 73 74 y;let u=!1;const
0000bb00: 20 64 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 d=this.getShape
0000bb10: 55 74 69 6c 28 63 29 3b 65 26 26 28 75 3d 21 6c Util(c);e&&(u=!l
0000bb20: 26 26 6f 2e 69 6e 63 6c 75 64 65 73 28 61 29 2c &&o.includes(a),
0000bb30: 75 26 26 28 73 2a 3d 2e 33 32 29 29 2c 74 2e 70 u&&(s*=.32)),t.p
0000bb40: 75 73 68 28 7b 69 64 3a 61 2c 73 68 61 70 65 3a ush({id:a,shape:
0000bb50: 63 2c 75 74 69 6c 3a 64 2c 69 6e 64 65 78 3a 6e c,util:d,index:n
0000bb60: 2c 62 61 63 6b 67 72 6f 75 6e 64 49 6e 64 65 78 ,backgroundIndex
0000bb70: 3a 72 2c 6f 70 61 63 69 74 79 3a 73 7d 29 2c 6e :r,opacity:s}),n
0000bb80: 2b 3d 31 2c 72 2b 3d 31 3b 63 6f 6e 73 74 20 70 +=1,r+=1;const p
0000bb90: 3d 74 68 69 73 2e 67 65 74 53 6f 72 74 65 64 43 =this.getSortedC
0000bba0: 68 69 6c 64 49 64 73 46 6f 72 50 61 72 65 6e 74 hildIdsForParent
0000bbb0: 28 61 29 3b 69 66 28 21 70 2e 6c 65 6e 67 74 68 (a);if(!p.length
0000bbc0: 29 72 65 74 75 72 6e 3b 6c 65 74 20 66 3d 6e 75 )return;let f=nu
0000bbd0: 6c 6c 3b 64 2e 70 72 6f 76 69 64 65 73 42 61 63 ll;d.providesBac
0000bbe0: 6b 67 72 6f 75 6e 64 46 6f 72 43 68 69 6c 64 72 kgroundForChildr
0000bbf0: 65 6e 28 63 29 26 26 28 66 3d 72 2c 72 3d 6e 2c en(c)&&(f=r,r=n,
0000bc00: 6e 2b 3d 74 68 69 73 2e 6f 70 74 69 6f 6e 73 2e n+=this.options.
0000bc10: 6d 61 78 53 68 61 70 65 73 50 65 72 50 61 67 65 maxShapesPerPage
0000bc20: 29 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 );for(const e of
0000bc30: 20 70 29 69 28 65 2c 73 2c 6c 7c 7c 75 29 3b 6e p)i(e,s,l||u);n
0000bc40: 75 6c 6c 21 3d 3d 66 26 26 28 72 3d 66 29 7d 2c ull!==f&&(r=f)},
0000bc50: 61 3d 65 3f 5b 74 68 69 73 2e 67 65 74 43 75 72 a=e?[this.getCur
0000bc60: 72 65 6e 74 50 61 67 65 28 29 5d 3a 74 68 69 73 rentPage()]:this
0000bc70: 2e 67 65 74 50 61 67 65 73 28 29 3b 66 6f 72 28 .getPages();for(
0000bc80: 63 6f 6e 73 74 20 65 20 6f 66 20 61 29 66 6f 72 const e of a)for
0000bc90: 28 63 6f 6e 73 74 20 74 20 6f 66 20 74 68 69 73 (const t of this
0000bca0: 2e 67 65 74 53 6f 72 74 65 64 43 68 69 6c 64 49 .getSortedChildI
0000bcb0: 64 73 46 6f 72 50 61 72 65 6e 74 28 65 2e 69 64 dsForParent(e.id
0000bcc0: 29 29 69 28 74 2c 31 2c 21 31 29 3b 72 65 74 75 ))i(t,1,!1);retu
0000bcd0: 72 6e 20 74 7d 5f 63 61 6d 65 72 61 53 74 61 74 rn t}_cameraStat
0000bce0: 65 3d 59 69 28 22 63 61 6d 65 72 61 20 73 74 61 e=Yi("camera sta
0000bcf0: 74 65 22 2c 22 69 64 6c 65 22 29 3b 5f 63 61 6d te","idle");_cam
0000bd00: 65 72 61 53 74 61 74 65 54 69 6d 65 6f 75 74 52 eraStateTimeoutR
0000bd10: 65 6d 61 69 6e 69 6e 67 3d 30 3b 5f 64 65 63 61 emaining=0;_deca
0000bd20: 79 43 61 6d 65 72 61 53 74 61 74 65 54 69 6d 65 yCameraStateTime
0000bd30: 6f 75 74 3d 65 3d 3e 7b 74 68 69 73 2e 5f 63 61 out=e=>{this._ca
0000bd40: 6d 65 72 61 53 74 61 74 65 54 69 6d 65 6f 75 74 meraStateTimeout
0000bd50: 52 65 6d 61 69 6e 69 6e 67 2d 3d 65 2c 74 68 69 Remaining-=e,thi
0000bd60: 73 2e 5f 63 61 6d 65 72 61 53 74 61 74 65 54 69 s._cameraStateTi
0000bd70: 6d 65 6f 75 74 52 65 6d 61 69 6e 69 6e 67 3e 30 meoutRemaining>0
0000bd80: 7c 7c 28 74 68 69 73 2e 6f 66 66 28 22 74 69 63 ||(this.off("tic
0000bd90: 6b 22 2c 74 68 69 73 2e 5f 64 65 63 61 79 43 61 k",this._decayCa
0000bda0: 6d 65 72 61 53 74 61 74 65 54 69 6d 65 6f 75 74 meraStateTimeout
0000bdb0: 29 2c 74 68 69 73 2e 5f 63 61 6d 65 72 61 53 74 ),this._cameraSt
0000bdc0: 61 74 65 2e 73 65 74 28 22 69 64 6c 65 22 29 29 ate.set("idle"))
0000bdd0: 7d 3b 5f 74 69 63 6b 43 61 6d 65 72 61 53 74 61 };_tickCameraSta
0000bde0: 74 65 3d 28 29 3d 3e 7b 74 68 69 73 2e 5f 63 61 te=()=>{this._ca
0000bdf0: 6d 65 72 61 53 74 61 74 65 54 69 6d 65 6f 75 74 meraStateTimeout
0000be00: 52 65 6d 61 69 6e 69 6e 67 3d 74 68 69 73 2e 6f Remaining=this.o
0000be10: 70 74 69 6f 6e 73 2e 63 61 6d 65 72 61 4d 6f 76 ptions.cameraMov
0000be20: 69 6e 67 54 69 6d 65 6f 75 74 4d 73 2c 22 69 64 ingTimeoutMs,"id
0000be30: 6c 65 22 3d 3d 3d 74 68 69 73 2e 5f 63 61 6d 65 le"===this._came
0000be40: 72 61 53 74 61 74 65 2e 5f 5f 75 6e 73 61 66 65 raState.__unsafe
0000be50: 5f 5f 67 65 74 57 69 74 68 6f 75 74 43 61 70 74 __getWithoutCapt
0000be60: 75 72 65 28 29 26 26 28 74 68 69 73 2e 5f 63 61 ure()&&(this._ca
0000be70: 6d 65 72 61 53 74 61 74 65 2e 73 65 74 28 22 6d meraState.set("m
0000be80: 6f 76 69 6e 67 22 29 2c 74 68 69 73 2e 6f 6e 28 oving"),this.on(
0000be90: 22 74 69 63 6b 22 2c 74 68 69 73 2e 5f 64 65 63 "tick",this._dec
0000bea0: 61 79 43 61 6d 65 72 61 53 74 61 74 65 54 69 6d ayCameraStateTim
0000beb0: 65 6f 75 74 29 29 7d 3b 67 65 74 43 61 6d 65 72 eout))};getCamer
0000bec0: 61 53 74 61 74 65 28 29 7b 72 65 74 75 72 6e 20 aState(){return
0000bed0: 74 68 69 73 2e 5f 63 61 6d 65 72 61 53 74 61 74 this._cameraStat
0000bee0: 65 2e 67 65 74 28 29 7d 67 65 74 52 65 6e 64 65 e.get()}getRende
0000bef0: 72 69 6e 67 53 68 61 70 65 73 28 29 7b 72 65 74 ringShapes(){ret
0000bf00: 75 72 6e 20 74 68 69 73 2e 67 65 74 55 6e 6f 72 urn this.getUnor
0000bf10: 64 65 72 65 64 52 65 6e 64 65 72 69 6e 67 53 68 deredRenderingSh
0000bf20: 61 70 65 73 28 21 30 29 2e 73 6f 72 74 28 71 6f apes(!0).sort(qo
0000bf30: 29 7d 5f 67 65 74 41 6c 6c 50 61 67 65 73 51 75 )}_getAllPagesQu
0000bf40: 65 72 79 28 29 7b 72 65 74 75 72 6e 20 74 68 69 ery(){return thi
0000bf50: 73 2e 73 74 6f 72 65 2e 71 75 65 72 79 2e 72 65 s.store.query.re
0000bf60: 63 6f 72 64 73 28 22 70 61 67 65 22 29 7d 67 65 cords("page")}ge
0000bf70: 74 50 61 67 65 73 28 29 7b 72 65 74 75 72 6e 20 tPages(){return
0000bf80: 74 68 69 73 2e 5f 67 65 74 41 6c 6c 50 61 67 65 this._getAllPage
0000bf90: 73 51 75 65 72 79 28 29 2e 67 65 74 28 29 2e 73 sQuery().get().s
0000bfa0: 6f 72 74 28 56 6f 29 7d 67 65 74 43 75 72 72 65 ort(Vo)}getCurre
0000bfb0: 6e 74 50 61 67 65 28 29 7b 72 65 74 75 72 6e 20 ntPage(){return
0000bfc0: 74 68 69 73 2e 67 65 74 50 61 67 65 28 74 68 69 this.getPage(thi
0000bfd0: 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 s.getCurrentPage
0000bfe0: 49 64 28 29 29 7d 67 65 74 43 75 72 72 65 6e 74 Id())}getCurrent
0000bff0: 50 61 67 65 49 64 28 29 7b 72 65 74 75 72 6e 20 PageId(){return
0000c000: 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 this.getInstance
0000c010: 53 74 61 74 65 28 29 2e 63 75 72 72 65 6e 74 50 State().currentP
0000c020: 61 67 65 49 64 7d 67 65 74 50 61 67 65 28 65 29 ageId}getPage(e)
0000c030: 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f {return this.sto
0000c040: 72 65 2e 67 65 74 28 22 73 74 72 69 6e 67 22 3d re.get("string"=
0000c050: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
0000c060: 29 7d 5f 63 75 72 72 65 6e 74 50 61 67 65 53 68 )}_currentPageSh
0000c070: 61 70 65 49 64 73 3b 67 65 74 43 75 72 72 65 6e apeIds;getCurren
0000c080: 74 50 61 67 65 53 68 61 70 65 49 64 73 28 29 7b tPageShapeIds(){
0000c090: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 63 75 72 return this._cur
0000c0a0: 72 65 6e 74 50 61 67 65 53 68 61 70 65 49 64 73 rentPageShapeIds
0000c0b0: 2e 67 65 74 28 29 7d 67 65 74 43 75 72 72 65 6e .get()}getCurren
0000c0c0: 74 50 61 67 65 53 68 61 70 65 49 64 73 53 6f 72 tPageShapeIdsSor
0000c0d0: 74 65 64 28 29 7b 72 65 74 75 72 6e 20 41 72 72 ted(){return Arr
0000c0e0: 61 79 2e 66 72 6f 6d 28 74 68 69 73 2e 67 65 74 ay.from(this.get
0000c0f0: 43 75 72 72 65 6e 74 50 61 67 65 53 68 61 70 65 CurrentPageShape
0000c100: 49 64 73 28 29 29 2e 73 6f 72 74 28 29 7d 67 65 Ids()).sort()}ge
0000c110: 74 50 61 67 65 53 68 61 70 65 49 64 73 28 65 29 tPageShapeIds(e)
0000c120: 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 {const t="string
0000c130: 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e "==typeof e?e:e.
0000c140: 69 64 2c 6e 3d 74 68 69 73 2e 73 74 6f 72 65 2e id,n=this.store.
0000c150: 71 75 65 72 79 2e 65 78 65 63 28 22 73 68 61 70 query.exec("shap
0000c160: 65 22 2c 7b 70 61 72 65 6e 74 49 64 3a 7b 65 71 e",{parentId:{eq
0000c170: 3a 74 7d 7d 29 3b 72 65 74 75 72 6e 20 74 68 69 :t}});return thi
0000c180: 73 2e 67 65 74 53 68 61 70 65 41 6e 64 44 65 73 s.getShapeAndDes
0000c190: 63 65 6e 64 61 6e 74 49 64 73 28 6e 2e 6d 61 70 cendantIds(n.map
0000c1a0: 28 28 65 3d 3e 65 2e 69 64 29 29 29 7d 73 65 74 ((e=>e.id)))}set
0000c1b0: 43 75 72 72 65 6e 74 50 61 67 65 28 65 29 7b 63 CurrentPage(e){c
0000c1c0: 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 22 3d onst t="string"=
0000c1d0: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
0000c1e0: 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f ;return this.sto
0000c1f0: 72 65 2e 68 61 73 28 74 29 3f 28 74 68 69 73 2e re.has(t)?(this.
0000c200: 73 74 6f 70 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 stopFollowingUse
0000c210: 72 28 29 2c 74 68 69 73 2e 63 6f 6d 70 6c 65 74 r(),this.complet
0000c220: 65 28 29 2c 74 68 69 73 2e 62 61 74 63 68 28 28 e(),this.batch((
0000c230: 28 29 3d 3e 74 68 69 73 2e 73 74 6f 72 65 2e 70 ()=>this.store.p
0000c240: 75 74 28 5b 7b 2e 2e 2e 74 68 69 73 2e 67 65 74 ut([{...this.get
0000c250: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2c InstanceState(),
0000c260: 63 75 72 72 65 6e 74 50 61 67 65 49 64 3a 74 7d currentPageId:t}
0000c270: 5d 29 29 2c 7b 68 69 73 74 6f 72 79 3a 22 72 65 ])),{history:"re
0000c280: 63 6f 72 64 2d 70 72 65 73 65 72 76 65 52 65 64 cord-preserveRed
0000c290: 6f 53 74 61 63 6b 22 7d 29 29 3a 28 63 6f 6e 73 oStack"})):(cons
0000c2a0: 6f 6c 65 2e 65 72 72 6f 72 28 22 54 72 69 65 64 ole.error("Tried
0000c2b0: 20 74 6f 20 73 65 74 20 74 68 65 20 63 75 72 72 to set the curr
0000c2c0: 65 6e 74 20 70 61 67 65 20 69 64 20 74 6f 20 61 ent page id to a
0000c2d0: 20 70 61 67 65 20 74 68 61 74 20 64 6f 65 73 6e page that doesn
0000c2e0: 27 74 20 65 78 69 73 74 2e 22 29 2c 74 68 69 73 't exist."),this
0000c2f0: 29 7d 75 70 64 61 74 65 50 61 67 65 28 65 29 7b )}updatePage(e){
0000c300: 69 66 28 74 68 69 73 2e 67 65 74 49 6e 73 74 61 if(this.getInsta
0000c310: 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 nceState().isRea
0000c320: 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 74 68 69 donly)return thi
0000c330: 73 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 s;return this.ge
0000c340: 74 50 61 67 65 28 65 2e 69 64 29 3f 74 68 69 73 tPage(e.id)?this
0000c350: 2e 62 61 74 63 68 28 28 28 29 3d 3e 74 68 69 73 .batch((()=>this
0000c360: 2e 73 74 6f 72 65 2e 75 70 64 61 74 65 28 65 2e .store.update(e.
0000c370: 69 64 2c 28 74 3d 3e 28 7b 2e 2e 2e 74 2c 2e 2e id,(t=>({...t,..
0000c380: 2e 65 7d 29 29 29 29 29 3a 74 68 69 73 7d 63 72 .e}))))):this}cr
0000c390: 65 61 74 65 50 61 67 65 28 65 29 7b 72 65 74 75 eatePage(e){retu
0000c3a0: 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e rn this.history.
0000c3b0: 62 61 74 63 68 28 28 28 29 3d 3e 7b 69 66 28 74 batch((()=>{if(t
0000c3c0: 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 his.getInstanceS
0000c3d0: 74 61 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c tate().isReadonl
0000c3e0: 79 29 72 65 74 75 72 6e 3b 69 66 28 74 68 69 73 y)return;if(this
0000c3f0: 2e 67 65 74 50 61 67 65 73 28 29 2e 6c 65 6e 67 .getPages().leng
0000c400: 74 68 3e 3d 74 68 69 73 2e 6f 70 74 69 6f 6e 73 th>=this.options
0000c410: 2e 6d 61 78 50 61 67 65 73 29 72 65 74 75 72 6e .maxPages)return
0000c420: 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 ;const t=this.ge
0000c430: 74 50 61 67 65 73 28 29 2c 6e 3d 66 75 6e 63 74 tPages(),n=funct
0000c440: 69 6f 6e 28 65 2c 74 29 7b 6c 65 74 20 6e 3d 65 ion(e,t){let n=e
0000c450: 3b 63 6f 6e 73 74 20 72 3d 6e 65 77 20 53 65 74 ;const r=new Set
0000c460: 28 74 29 3b 66 6f 72 28 3b 72 2e 68 61 73 28 6e (t);for(;r.has(n
0000c470: 29 3b 29 6e 3d 2f 5e 2e 2a 28 5c 64 2b 29 24 2f );)n=/^.*(\d+)$/
0000c480: 2e 65 78 65 63 28 6e 29 3f 2e 5b 31 5d 3f 6e 2e .exec(n)?.[1]?n.
0000c490: 72 65 70 6c 61 63 65 28 2f 28 5c 64 2b 29 28 3f replace(/(\d+)(?
0000c4a0: 3d 5c 44 3f 29 24 2f 2c 28 65 3d 3e 28 2b 65 2b =\D?)$/,(e=>(+e+
0000c4b0: 31 29 2e 74 6f 53 74 72 69 6e 67 28 29 29 29 3a 1).toString())):
0000c4c0: 60 24 7b 6e 7d 20 31 60 3b 72 65 74 75 72 6e 20 `${n} 1`;return
0000c4d0: 6e 7d 28 65 2e 6e 61 6d 65 3f 3f 22 50 61 67 65 n}(e.name??"Page
0000c4e0: 20 31 22 2c 74 2e 6d 61 70 28 28 65 3d 3e 65 2e 1",t.map((e=>e.
0000c4f0: 6e 61 6d 65 29 29 29 3b 6c 65 74 20 72 3d 65 2e name)));let r=e.
0000c500: 69 6e 64 65 78 3b 72 26 26 21 74 2e 73 6f 6d 65 index;r&&!t.some
0000c510: 28 28 65 3d 3e 65 2e 69 6e 64 65 78 3d 3d 3d 72 ((e=>e.index===r
0000c520: 29 29 7c 7c 28 72 3d 47 6f 28 74 5b 74 2e 6c 65 ))||(r=Go(t[t.le
0000c530: 6e 67 74 68 2d 31 5d 2e 69 6e 64 65 78 29 29 3b ngth-1].index));
0000c540: 63 6f 6e 73 74 20 6f 3d 64 6c 2e 63 72 65 61 74 const o=dl.creat
0000c550: 65 28 7b 6d 65 74 61 3a 7b 7d 2c 2e 2e 2e 65 2c e({meta:{},...e,
0000c560: 6e 61 6d 65 3a 6e 2c 69 6e 64 65 78 3a 72 7d 29 name:n,index:r})
0000c570: 3b 74 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 ;this.store.put(
0000c580: 5b 6f 5d 29 7d 29 29 2c 74 68 69 73 7d 64 65 6c [o])})),this}del
0000c590: 65 74 65 50 61 67 65 28 65 29 7b 63 6f 6e 73 74 etePage(e){const
0000c5a0: 20 74 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 t="string"==typ
0000c5b0: 65 6f 66 20 65 3f 65 3a 65 2e 69 64 3b 72 65 74 eof e?e:e.id;ret
0000c5c0: 75 72 6e 20 74 68 69 73 2e 62 61 74 63 68 28 28 urn this.batch((
0000c5d0: 28 29 3d 3e 7b 69 66 28 74 68 69 73 2e 67 65 74 ()=>{if(this.get
0000c5e0: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e InstanceState().
0000c5f0: 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 74 75 72 isReadonly)retur
0000c600: 6e 3b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 n;const e=this.g
0000c610: 65 74 50 61 67 65 73 28 29 3b 69 66 28 31 3d 3d etPages();if(1==
0000c620: 3d 65 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 6e =e.length)return
0000c630: 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 ;const n=this.ge
0000c640: 74 50 61 67 65 28 74 29 3b 69 66 28 6e 29 7b 69 tPage(t);if(n){i
0000c650: 66 28 74 3d 3d 3d 74 68 69 73 2e 67 65 74 43 75 f(t===this.getCu
0000c660: 72 72 65 6e 74 50 61 67 65 49 64 28 29 29 7b 63 rrentPageId()){c
0000c670: 6f 6e 73 74 20 6e 3d 65 2e 66 69 6e 64 49 6e 64 onst n=e.findInd
0000c680: 65 78 28 28 65 3d 3e 65 2e 69 64 3d 3d 3d 74 29 ex((e=>e.id===t)
0000c690: 29 2c 72 3d 65 5b 6e 2d 31 5d 3f 3f 65 5b 6e 2b ),r=e[n-1]??e[n+
0000c6a0: 31 5d 3b 74 68 69 73 2e 73 65 74 43 75 72 72 65 1];this.setCurre
0000c6b0: 6e 74 50 61 67 65 28 72 2e 69 64 29 7d 74 68 69 ntPage(r.id)}thi
0000c6c0: 73 2e 73 74 6f 72 65 2e 72 65 6d 6f 76 65 28 5b s.store.remove([
0000c6d0: 6e 2e 69 64 5d 29 7d 7d 29 29 2c 74 68 69 73 7d n.id])}})),this}
0000c6e0: 64 75 70 6c 69 63 61 74 65 50 61 67 65 28 65 2c duplicatePage(e,
0000c6f0: 74 3d 64 6c 2e 63 72 65 61 74 65 49 64 28 29 29 t=dl.createId())
0000c700: 7b 69 66 28 74 68 69 73 2e 67 65 74 50 61 67 65 {if(this.getPage
0000c710: 73 28 29 2e 6c 65 6e 67 74 68 3e 3d 74 68 69 73 s().length>=this
0000c720: 2e 6f 70 74 69 6f 6e 73 2e 6d 61 78 50 61 67 65 .options.maxPage
0000c730: 73 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f s)return this;co
0000c740: 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 3d 3d nst n="string"==
0000c750: 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 2c typeof e?e:e.id,
0000c760: 72 3d 74 68 69 73 2e 67 65 74 50 61 67 65 28 6e r=this.getPage(n
0000c770: 29 3b 69 66 28 21 72 29 72 65 74 75 72 6e 20 74 );if(!r)return t
0000c780: 68 69 73 3b 63 6f 6e 73 74 20 6f 3d 7b 2e 2e 2e his;const o={...
0000c790: 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 29 this.getCamera()
0000c7a0: 7d 2c 69 3d 74 68 69 73 2e 67 65 74 43 6f 6e 74 },i=this.getCont
0000c7b0: 65 6e 74 46 72 6f 6d 43 75 72 72 65 6e 74 50 61 entFromCurrentPa
0000c7c0: 67 65 28 74 68 69 73 2e 67 65 74 53 6f 72 74 65 ge(this.getSorte
0000c7d0: 64 43 68 69 6c 64 49 64 73 46 6f 72 50 61 72 65 dChildIdsForPare
0000c7e0: 6e 74 28 72 2e 69 64 29 29 3b 72 65 74 75 72 6e nt(r.id));return
0000c7f0: 20 74 68 69 73 2e 62 61 74 63 68 28 28 28 29 3d this.batch((()=
0000c800: 3e 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 >{const e=this.g
0000c810: 65 74 50 61 67 65 73 28 29 2c 6e 3d 7a 6f 28 72 etPages(),n=zo(r
0000c820: 2e 69 6e 64 65 78 2c 65 5b 65 2e 69 6e 64 65 78 .index,e[e.index
0000c830: 4f 66 28 72 29 2b 31 5d 3f 2e 69 6e 64 65 78 29 Of(r)+1]?.index)
0000c840: 3b 69 66 28 74 68 69 73 2e 63 72 65 61 74 65 50 ;if(this.createP
0000c850: 61 67 65 28 7b 6e 61 6d 65 3a 72 2e 6e 61 6d 65 age({name:r.name
0000c860: 2b 22 20 43 6f 70 79 22 2c 69 64 3a 74 2c 69 6e +" Copy",id:t,in
0000c870: 64 65 78 3a 6e 7d 29 2c 74 68 69 73 2e 73 65 74 dex:n}),this.set
0000c880: 43 75 72 72 65 6e 74 50 61 67 65 28 74 29 2c 74 CurrentPage(t),t
0000c890: 68 69 73 2e 73 65 74 43 61 6d 65 72 61 28 6f 29 his.setCamera(o)
0000c8a0: 2c 69 29 72 65 74 75 72 6e 20 74 68 69 73 2e 70 ,i)return this.p
0000c8b0: 75 74 43 6f 6e 74 65 6e 74 4f 6e 74 6f 43 75 72 utContentOntoCur
0000c8c0: 72 65 6e 74 50 61 67 65 28 69 29 7d 29 29 2c 74 rentPage(i)})),t
0000c8d0: 68 69 73 7d 72 65 6e 61 6d 65 50 61 67 65 28 65 his}renamePage(e
0000c8e0: 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 22 73 74 72 ,t){const n="str
0000c8f0: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 ing"==typeof e?e
0000c900: 3a 65 2e 69 64 3b 72 65 74 75 72 6e 20 74 68 69 :e.id;return thi
0000c910: 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 s.getInstanceSta
0000c920: 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 7c te().isReadonly|
0000c930: 7c 74 68 69 73 2e 75 70 64 61 74 65 50 61 67 65 |this.updatePage
0000c940: 28 7b 69 64 3a 6e 2c 6e 61 6d 65 3a 74 7d 29 2c ({id:n,name:t}),
0000c950: 74 68 69 73 7d 5f 61 73 73 65 74 4f 70 74 69 6f this}_assetOptio
0000c960: 6e 73 3d 59 69 28 22 61 73 73 65 74 20 6f 70 74 ns=Yi("asset opt
0000c970: 69 6f 6e 73 22 2c 7a 75 29 3b 5f 67 65 74 41 6c ions",zu);_getAl
0000c980: 6c 41 73 73 65 74 73 51 75 65 72 79 28 29 7b 72 lAssetsQuery(){r
0000c990: 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 eturn this.store
0000c9a0: 2e 71 75 65 72 79 2e 72 65 63 6f 72 64 73 28 22 .query.records("
0000c9b0: 61 73 73 65 74 22 29 7d 67 65 74 41 73 73 65 74 asset")}getAsset
0000c9c0: 73 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e s(){return this.
0000c9d0: 5f 67 65 74 41 6c 6c 41 73 73 65 74 73 51 75 65 _getAllAssetsQue
0000c9e0: 72 79 28 29 2e 67 65 74 28 29 7d 63 72 65 61 74 ry().get()}creat
0000c9f0: 65 41 73 73 65 74 73 28 65 29 7b 72 65 74 75 72 eAssets(e){retur
0000ca00: 6e 20 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e n this.getInstan
0000ca10: 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 64 ceState().isRead
0000ca20: 6f 6e 6c 79 7c 7c 65 2e 6c 65 6e 67 74 68 3c 3d only||e.length<=
0000ca30: 30 7c 7c 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 0||this.history.
0000ca40: 69 67 6e 6f 72 65 28 28 28 29 3d 3e 74 68 69 73 ignore((()=>this
0000ca50: 2e 73 74 6f 72 65 2e 70 75 74 28 65 29 29 29 2c .store.put(e))),
0000ca60: 74 68 69 73 7d 75 70 64 61 74 65 41 73 73 65 74 this}updateAsset
0000ca70: 73 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 s(e){return this
0000ca80: 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 .getInstanceStat
0000ca90: 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 7c 7c e().isReadonly||
0000caa0: 65 2e 6c 65 6e 67 74 68 3c 3d 30 7c 7c 74 68 69 e.length<=0||thi
0000cab0: 73 2e 68 69 73 74 6f 72 79 2e 69 67 6e 6f 72 65 s.history.ignore
0000cac0: 28 28 28 29 3d 3e 7b 74 68 69 73 2e 73 74 6f 72 ((()=>{this.stor
0000cad0: 65 2e 70 75 74 28 65 2e 6d 61 70 28 28 65 3d 3e e.put(e.map((e=>
0000cae0: 28 7b 2e 2e 2e 74 68 69 73 2e 73 74 6f 72 65 2e ({...this.store.
0000caf0: 67 65 74 28 65 2e 69 64 29 2c 2e 2e 2e 65 7d 29 get(e.id),...e})
0000cb00: 29 29 29 7d 29 29 2c 74 68 69 73 7d 64 65 6c 65 )))})),this}dele
0000cb10: 74 65 41 73 73 65 74 73 28 65 29 7b 69 66 28 74 teAssets(e){if(t
0000cb20: 68 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 his.getInstanceS
0000cb30: 74 61 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c tate().isReadonl
0000cb40: 79 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f y)return this;co
0000cb50: 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 22 3d 3d nst t="string"==
0000cb60: 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e typeof e[0]?e:e.
0000cb70: 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 29 3b 72 map((e=>e.id));r
0000cb80: 65 74 75 72 6e 20 74 2e 6c 65 6e 67 74 68 3c 3d eturn t.length<=
0000cb90: 30 7c 7c 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 0||this.history.
0000cba0: 69 67 6e 6f 72 65 28 28 28 29 3d 3e 74 68 69 73 ignore((()=>this
0000cbb0: 2e 73 74 6f 72 65 2e 72 65 6d 6f 76 65 28 74 29 .store.remove(t)
0000cbc0: 29 29 2c 74 68 69 73 7d 67 65 74 41 73 73 65 74 )),this}getAsset
0000cbd0: 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e (e){return this.
0000cbe0: 73 74 6f 72 65 2e 67 65 74 28 22 73 74 72 69 6e store.get("strin
0000cbf0: 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 g"==typeof e?e:e
0000cc00: 2e 69 64 29 7d 61 73 79 6e 63 20 72 65 73 6f 6c .id)}async resol
0000cc10: 76 65 41 73 73 65 74 55 72 6c 28 65 2c 74 29 7b veAssetUrl(e,t){
0000cc20: 69 66 28 21 65 29 72 65 74 75 72 6e 22 22 3b 63 if(!e)return"";c
0000cc30: 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 41 onst n=this.getA
0000cc40: 73 73 65 74 28 65 29 3b 69 66 28 21 6e 29 72 65 sset(e);if(!n)re
0000cc50: 74 75 72 6e 22 22 3b 63 6f 6e 73 74 7b 73 63 72 turn"";const{scr
0000cc60: 65 65 6e 53 63 61 6c 65 3a 72 2c 73 68 6f 75 6c eenScale:r,shoul
0000cc70: 64 52 65 73 6f 6c 76 65 54 6f 4f 72 69 67 69 6e dResolveToOrigin
0000cc80: 61 6c 49 6d 61 67 65 3a 6f 7d 3d 74 2c 69 3d 4d alImage:o}=t,i=M
0000cc90: 61 74 68 2e 6d 61 78 28 2e 31 32 35 2c 28 61 3d ath.max(.125,(a=
0000cca0: 72 7c 7c 31 2c 4d 61 74 68 2e 70 6f 77 28 32 2c r||1,Math.pow(2,
0000ccb0: 4d 61 74 68 2e 63 65 69 6c 28 4d 61 74 68 2e 6c Math.ceil(Math.l
0000ccc0: 6f 67 32 28 61 29 29 29 29 29 3b 76 61 72 20 61 og2(a)))));var a
0000ccd0: 3b 63 6f 6e 73 74 20 73 3d 22 63 6f 6e 6e 65 63 ;const s="connec
0000cce0: 74 69 6f 6e 22 69 6e 20 6e 61 76 69 67 61 74 6f tion"in navigato
0000ccf0: 72 3f 6e 61 76 69 67 61 74 6f 72 2e 63 6f 6e 6e r?navigator.conn
0000cd00: 65 63 74 69 6f 6e 2e 65 66 66 65 63 74 69 76 65 ection.effective
0000cd10: 54 79 70 65 3a 6e 75 6c 6c 2c 6c 3d 74 68 69 73 Type:null,l=this
0000cd20: 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 .getInstanceStat
0000cd30: 65 28 29 2e 64 65 76 69 63 65 50 69 78 65 6c 52 e().devicePixelR
0000cd40: 61 74 69 6f 3b 72 65 74 75 72 6e 20 61 77 61 69 atio;return awai
0000cd50: 74 20 74 68 69 73 2e 5f 61 73 73 65 74 4f 70 74 t this._assetOpt
0000cd60: 69 6f 6e 73 2e 67 65 74 28 29 2e 6f 6e 52 65 73 ions.get().onRes
0000cd70: 6f 6c 76 65 41 73 73 65 74 28 6e 2c 7b 73 63 72 olveAsset(n,{scr
0000cd80: 65 65 6e 53 63 61 6c 65 3a 72 7c 7c 31 2c 73 74 eenScale:r||1,st
0000cd90: 65 70 70 65 64 53 63 72 65 65 6e 53 63 61 6c 65 eppedScreenScale
0000cda0: 3a 69 2c 64 70 72 3a 6c 2c 6e 65 74 77 6f 72 6b :i,dpr:l,network
0000cdb0: 45 66 66 65 63 74 69 76 65 54 79 70 65 3a 73 2c EffectiveType:s,
0000cdc0: 73 68 6f 75 6c 64 52 65 73 6f 6c 76 65 54 6f 4f shouldResolveToO
0000cdd0: 72 69 67 69 6e 61 6c 49 6d 61 67 65 3a 6f 7d 29 riginalImage:o})
0000cde0: 7d 5f 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 }_getShapeGeomet
0000cdf0: 72 79 43 61 63 68 65 28 29 7b 72 65 74 75 72 6e ryCache(){return
0000ce00: 20 74 68 69 73 2e 73 74 6f 72 65 2e 63 72 65 61 this.store.crea
0000ce10: 74 65 43 6f 6d 70 75 74 65 64 43 61 63 68 65 28 teComputedCache(
0000ce20: 22 62 6f 75 6e 64 73 22 2c 28 65 3d 3e 74 68 69 "bounds",(e=>thi
0000ce30: 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 65 s.getShapeUtil(e
0000ce40: 29 2e 67 65 74 47 65 6f 6d 65 74 72 79 28 65 29 ).getGeometry(e)
0000ce50: 29 2c 28 28 65 2c 74 29 3d 3e 65 2e 70 72 6f 70 ),((e,t)=>e.prop
0000ce60: 73 3d 3d 3d 74 2e 70 72 6f 70 73 29 29 7d 67 65 s===t.props))}ge
0000ce70: 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 28 65 tShapeGeometry(e
0000ce80: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 67 ){return this._g
0000ce90: 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 43 etShapeGeometryC
0000cea0: 61 63 68 65 28 29 2e 67 65 74 28 22 73 74 72 69 ache().get("stri
0000ceb0: 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a ng"==typeof e?e:
0000cec0: 65 2e 69 64 29 7d 5f 67 65 74 53 68 61 70 65 48 e.id)}_getShapeH
0000ced0: 61 6e 64 6c 65 73 43 61 63 68 65 28 29 7b 72 65 andlesCache(){re
0000cee0: 74 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 2e turn this.store.
0000cef0: 63 72 65 61 74 65 43 6f 6d 70 75 74 65 64 43 61 createComputedCa
0000cf00: 63 68 65 28 22 68 61 6e 64 6c 65 73 22 2c 28 65 che("handles",(e
0000cf10: 3d 3e 74 68 69 73 2e 67 65 74 53 68 61 70 65 55 =>this.getShapeU
0000cf20: 74 69 6c 28 65 29 2e 67 65 74 48 61 6e 64 6c 65 til(e).getHandle
0000cf30: 73 3f 2e 28 65 29 29 29 7d 67 65 74 53 68 61 70 s?.(e)))}getShap
0000cf40: 65 48 61 6e 64 6c 65 73 28 65 29 7b 72 65 74 75 eHandles(e){retu
0000cf50: 72 6e 20 74 68 69 73 2e 5f 67 65 74 53 68 61 70 rn this._getShap
0000cf60: 65 48 61 6e 64 6c 65 73 43 61 63 68 65 28 29 2e eHandlesCache().
0000cf70: 67 65 74 28 22 73 74 72 69 6e 67 22 3d 3d 74 79 get("string"==ty
0000cf80: 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 29 7d 67 peof e?e:e.id)}g
0000cf90: 65 74 53 68 61 70 65 4c 6f 63 61 6c 54 72 61 6e etShapeLocalTran
0000cfa0: 73 66 6f 72 6d 28 65 29 7b 63 6f 6e 73 74 20 74 sform(e){const t
0000cfb0: 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ="string"==typeo
0000cfc0: 66 20 65 3f 65 3a 65 2e 69 64 2c 6e 3d 74 68 69 f e?e:e.id,n=thi
0000cfd0: 73 2e 67 65 74 53 68 61 70 65 28 74 29 3b 69 66 s.getShape(t);if
0000cfe0: 28 21 6e 29 74 68 72 6f 77 20 45 72 72 6f 72 28 (!n)throw Error(
0000cff0: 22 45 64 69 74 6f 72 2e 67 65 74 54 72 61 6e 73 "Editor.getTrans
0000d000: 66 6f 72 6d 3a 20 73 68 61 70 65 20 6e 6f 74 20 form: shape not
0000d010: 66 6f 75 6e 64 22 29 3b 72 65 74 75 72 6e 20 77 found");return w
0000d020: 70 2e 49 64 65 6e 74 69 74 79 28 29 2e 74 72 61 p.Identity().tra
0000d030: 6e 73 6c 61 74 65 28 6e 2e 78 2c 6e 2e 79 29 2e nslate(n.x,n.y).
0000d040: 72 6f 74 61 74 65 28 6e 2e 72 6f 74 61 74 69 6f rotate(n.rotatio
0000d050: 6e 29 7d 5f 67 65 74 53 68 61 70 65 50 61 67 65 n)}_getShapePage
0000d060: 54 72 61 6e 73 66 6f 72 6d 43 61 63 68 65 28 29 TransformCache()
0000d070: 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f {return this.sto
0000d080: 72 65 2e 63 72 65 61 74 65 43 6f 6d 70 75 74 65 re.createCompute
0000d090: 64 43 61 63 68 65 28 22 70 61 67 65 54 72 61 6e dCache("pageTran
0000d0a0: 73 66 6f 72 6d 43 61 63 68 65 22 2c 28 65 3d 3e sformCache",(e=>
0000d0b0: 7b 69 66 28 70 6c 28 65 2e 70 61 72 65 6e 74 49 {if(pl(e.parentI
0000d0c0: 64 29 29 72 65 74 75 72 6e 20 74 68 69 73 2e 67 d))return this.g
0000d0d0: 65 74 53 68 61 70 65 4c 6f 63 61 6c 54 72 61 6e etShapeLocalTran
0000d0e0: 73 66 6f 72 6d 28 65 29 3b 63 6f 6e 73 74 20 74 sform(e);const t
0000d0f0: 3d 74 68 69 73 2e 5f 67 65 74 53 68 61 70 65 50 =this._getShapeP
0000d100: 61 67 65 54 72 61 6e 73 66 6f 72 6d 43 61 63 68 ageTransformCach
0000d110: 65 28 29 2e 67 65 74 28 65 2e 70 61 72 65 6e 74 e().get(e.parent
0000d120: 49 64 29 3f 3f 77 70 2e 49 64 65 6e 74 69 74 79 Id)??wp.Identity
0000d130: 28 29 3b 72 65 74 75 72 6e 20 77 70 2e 43 6f 6d ();return wp.Com
0000d140: 70 6f 73 65 28 74 2c 74 68 69 73 2e 67 65 74 53 pose(t,this.getS
0000d150: 68 61 70 65 4c 6f 63 61 6c 54 72 61 6e 73 66 6f hapeLocalTransfo
0000d160: 72 6d 28 65 29 29 7d 29 29 7d 67 65 74 53 68 61 rm(e))}))}getSha
0000d170: 70 65 50 61 72 65 6e 74 54 72 61 6e 73 66 6f 72 peParentTransfor
0000d180: 6d 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 m(e){const t="st
0000d190: 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f ring"==typeof e?
0000d1a0: 65 3a 65 2e 69 64 2c 6e 3d 74 68 69 73 2e 67 65 e:e.id,n=this.ge
0000d1b0: 74 53 68 61 70 65 28 74 29 3b 72 65 74 75 72 6e tShape(t);return
0000d1c0: 21 6e 7c 7c 70 6c 28 6e 2e 70 61 72 65 6e 74 49 !n||pl(n.parentI
0000d1d0: 64 29 3f 77 70 2e 49 64 65 6e 74 69 74 79 28 29 d)?wp.Identity()
0000d1e0: 3a 74 68 69 73 2e 5f 67 65 74 53 68 61 70 65 50 :this._getShapeP
0000d1f0: 61 67 65 54 72 61 6e 73 66 6f 72 6d 43 61 63 68 ageTransformCach
0000d200: 65 28 29 2e 67 65 74 28 6e 2e 70 61 72 65 6e 74 e().get(n.parent
0000d210: 49 64 29 3f 3f 77 70 2e 49 64 65 6e 74 69 74 79 Id)??wp.Identity
0000d220: 28 29 7d 67 65 74 53 68 61 70 65 50 61 67 65 54 ()}getShapePageT
0000d230: 72 61 6e 73 66 6f 72 6d 28 65 29 7b 63 6f 6e 73 ransform(e){cons
0000d240: 74 20 74 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 t t="string"==ty
0000d250: 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 3b 72 65 peof e?e:e.id;re
0000d260: 74 75 72 6e 20 74 68 69 73 2e 5f 67 65 74 53 68 turn this._getSh
0000d270: 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d apePageTransform
0000d280: 43 61 63 68 65 28 29 2e 67 65 74 28 74 29 3f 3f Cache().get(t)??
0000d290: 77 70 2e 49 64 65 6e 74 69 74 79 28 29 7d 5f 67 wp.Identity()}_g
0000d2a0: 65 74 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 etShapePageBound
0000d2b0: 73 43 61 63 68 65 28 29 7b 72 65 74 75 72 6e 20 sCache(){return
0000d2c0: 74 68 69 73 2e 73 74 6f 72 65 2e 63 72 65 61 74 this.store.creat
0000d2d0: 65 43 6f 6d 70 75 74 65 64 43 61 63 68 65 28 22 eComputedCache("
0000d2e0: 70 61 67 65 42 6f 75 6e 64 73 43 61 63 68 65 22 pageBoundsCache"
0000d2f0: 2c 28 65 3d 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 ,(e=>{const t=th
0000d300: 69 73 2e 5f 67 65 74 53 68 61 70 65 50 61 67 65 is._getShapePage
0000d310: 54 72 61 6e 73 66 6f 72 6d 43 61 63 68 65 28 29 TransformCache()
0000d320: 2e 67 65 74 28 65 2e 69 64 29 3b 69 66 28 21 74 .get(e.id);if(!t
0000d330: 29 72 65 74 75 72 6e 20 6e 65 77 20 5f 70 3b 72 )return new _p;r
0000d340: 65 74 75 72 6e 20 5f 70 2e 46 72 6f 6d 50 6f 69 eturn _p.FromPoi
0000d350: 6e 74 73 28 77 70 2e 61 70 70 6c 79 54 6f 50 6f nts(wp.applyToPo
0000d360: 69 6e 74 73 28 74 2c 74 68 69 73 2e 67 65 74 53 ints(t,this.getS
0000d370: 68 61 70 65 47 65 6f 6d 65 74 72 79 28 65 29 2e hapeGeometry(e).
0000d380: 76 65 72 74 69 63 65 73 29 29 7d 29 29 7d 67 65 vertices))}))}ge
0000d390: 74 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 tShapePageBounds
0000d3a0: 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e (e){return this.
0000d3b0: 5f 67 65 74 53 68 61 70 65 50 61 67 65 42 6f 75 _getShapePageBou
0000d3c0: 6e 64 73 43 61 63 68 65 28 29 2e 67 65 74 28 22 ndsCache().get("
0000d3d0: 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 string"==typeof
0000d3e0: 65 3f 65 3a 65 2e 69 64 29 7d 5f 67 65 74 53 68 e?e:e.id)}_getSh
0000d3f0: 61 70 65 43 6c 69 70 50 61 74 68 43 61 63 68 65 apeClipPathCache
0000d400: 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 (){return this.s
0000d410: 74 6f 72 65 2e 63 72 65 61 74 65 43 6f 6d 70 75 tore.createCompu
0000d420: 74 65 64 43 61 63 68 65 28 22 63 6c 69 70 50 61 tedCache("clipPa
0000d430: 74 68 43 61 63 68 65 22 2c 28 65 3d 3e 7b 63 6f thCache",(e=>{co
0000d440: 6e 73 74 20 74 3d 74 68 69 73 2e 5f 67 65 74 53 nst t=this._getS
0000d450: 68 61 70 65 4d 61 73 6b 43 61 63 68 65 28 29 2e hapeMaskCache().
0000d460: 67 65 74 28 65 2e 69 64 29 3b 69 66 28 21 74 29 get(e.id);if(!t)
0000d470: 72 65 74 75 72 6e 3b 69 66 28 30 3d 3d 3d 74 2e return;if(0===t.
0000d480: 6c 65 6e 67 74 68 29 72 65 74 75 72 6e 22 70 6f length)return"po
0000d490: 6c 79 67 6f 6e 28 30 70 78 20 30 70 78 2c 20 30 lygon(0px 0px, 0
0000d4a0: 70 78 20 30 70 78 2c 20 30 70 78 20 30 70 78 29 px 0px, 0px 0px)
0000d4b0: 22 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 5f ";const n=this._
0000d4c0: 67 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e getShapePageTran
0000d4d0: 73 66 6f 72 6d 43 61 63 68 65 28 29 2e 67 65 74 sformCache().get
0000d4e0: 28 65 2e 69 64 29 3b 69 66 28 21 6e 29 72 65 74 (e.id);if(!n)ret
0000d4f0: 75 72 6e 3b 72 65 74 75 72 6e 60 70 6f 6c 79 67 urn;return`polyg
0000d500: 6f 6e 28 24 7b 77 70 2e 61 70 70 6c 79 54 6f 50 on(${wp.applyToP
0000d510: 6f 69 6e 74 73 28 77 70 2e 49 6e 76 65 72 73 65 oints(wp.Inverse
0000d520: 28 6e 29 2c 74 29 2e 6d 61 70 28 28 65 3d 3e 60 (n),t).map((e=>`
0000d530: 24 7b 65 2e 78 7d 70 78 20 24 7b 65 2e 79 7d 70 ${e.x}px ${e.y}p
0000d540: 78 60 29 29 2e 6a 6f 69 6e 28 22 2c 22 29 7d 29 x`)).join(",")})
0000d550: 60 7d 29 29 7d 67 65 74 53 68 61 70 65 43 6c 69 `}))}getShapeCli
0000d560: 70 50 61 74 68 28 65 29 7b 72 65 74 75 72 6e 20 pPath(e){return
0000d570: 74 68 69 73 2e 5f 67 65 74 53 68 61 70 65 43 6c this._getShapeCl
0000d580: 69 70 50 61 74 68 43 61 63 68 65 28 29 2e 67 65 ipPathCache().ge
0000d590: 74 28 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 t("string"==type
0000d5a0: 6f 66 20 65 3f 65 3a 65 2e 69 64 29 7d 5f 67 65 of e?e:e.id)}_ge
0000d5b0: 74 53 68 61 70 65 4d 61 73 6b 43 61 63 68 65 28 tShapeMaskCache(
0000d5c0: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 74 ){return this.st
0000d5d0: 6f 72 65 2e 63 72 65 61 74 65 43 6f 6d 70 75 74 ore.createComput
0000d5e0: 65 64 43 61 63 68 65 28 22 70 61 67 65 4d 61 73 edCache("pageMas
0000d5f0: 6b 43 61 63 68 65 22 2c 28 65 3d 3e 7b 69 66 28 kCache",(e=>{if(
0000d600: 70 6c 28 65 2e 70 61 72 65 6e 74 49 64 29 29 72 pl(e.parentId))r
0000d610: 65 74 75 72 6e 3b 63 6f 6e 73 74 20 74 3d 74 68 eturn;const t=th
0000d620: 69 73 2e 67 65 74 53 68 61 70 65 41 6e 63 65 73 is.getShapeAnces
0000d630: 74 6f 72 73 28 65 2e 69 64 29 2e 66 69 6c 74 65 tors(e.id).filte
0000d640: 72 28 28 65 3d 3e 74 68 69 73 2e 69 73 53 68 61 r((e=>this.isSha
0000d650: 70 65 4f 66 54 79 70 65 28 65 2c 22 66 72 61 6d peOfType(e,"fram
0000d660: 65 22 29 29 29 3b 69 66 28 30 3d 3d 3d 74 2e 6c e")));if(0===t.l
0000d670: 65 6e 67 74 68 29 72 65 74 75 72 6e 3b 72 65 74 ength)return;ret
0000d680: 75 72 6e 20 74 2e 6d 61 70 28 28 65 3d 3e 74 68 urn t.map((e=>th
0000d690: 69 73 2e 5f 67 65 74 53 68 61 70 65 50 61 67 65 is._getShapePage
0000d6a0: 54 72 61 6e 73 66 6f 72 6d 43 61 63 68 65 28 29 TransformCache()
0000d6b0: 2e 67 65 74 28 65 2e 69 64 29 2e 61 70 70 6c 79 .get(e.id).apply
0000d6c0: 54 6f 50 6f 69 6e 74 73 28 74 68 69 73 2e 67 65 ToPoints(this.ge
0000d6d0: 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 28 65 tShapeGeometry(e
0000d6e0: 29 2e 76 65 72 74 69 63 65 73 29 29 29 2e 72 65 ).vertices))).re
0000d6f0: 64 75 63 65 28 28 28 65 2c 74 29 3d 3e 7b 69 66 duce(((e,t)=>{if
0000d700: 28 21 74 7c 7c 21 65 29 72 65 74 75 72 6e 3b 63 (!t||!e)return;c
0000d710: 6f 6e 73 74 20 6e 3d 77 68 28 65 2c 74 29 3b 72 onst n=wh(e,t);r
0000d720: 65 74 75 72 6e 20 6e 3f 6e 2e 6d 61 70 28 73 75 eturn n?n.map(su
0000d730: 2e 43 61 73 74 29 3a 5b 5d 7d 29 29 7d 29 29 7d .Cast):[]}))}))}
0000d740: 67 65 74 53 68 61 70 65 4d 61 73 6b 28 65 29 7b getShapeMask(e){
0000d750: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 67 65 74 return this._get
0000d760: 53 68 61 70 65 4d 61 73 6b 43 61 63 68 65 28 29 ShapeMaskCache()
0000d770: 2e 67 65 74 28 22 73 74 72 69 6e 67 22 3d 3d 74 .get("string"==t
0000d780: 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 29 7d ypeof e?e:e.id)}
0000d790: 67 65 74 53 68 61 70 65 4d 61 73 6b 65 64 50 61 getShapeMaskedPa
0000d7a0: 67 65 42 6f 75 6e 64 73 28 65 29 7b 72 65 74 75 geBounds(e){retu
0000d7b0: 72 6e 22 73 74 72 69 6e 67 22 21 3d 74 79 70 65 rn"string"!=type
0000d7c0: 6f 66 20 65 26 26 28 65 3d 65 2e 69 64 29 2c 74 of e&&(e=e.id),t
0000d7d0: 68 69 73 2e 5f 67 65 74 53 68 61 70 65 4d 61 73 his._getShapeMas
0000d7e0: 6b 65 64 50 61 67 65 42 6f 75 6e 64 73 43 61 63 kedPageBoundsCac
0000d7f0: 68 65 28 29 2e 67 65 74 28 65 29 7d 5f 67 65 74 he().get(e)}_get
0000d800: 53 68 61 70 65 4d 61 73 6b 65 64 50 61 67 65 42 ShapeMaskedPageB
0000d810: 6f 75 6e 64 73 43 61 63 68 65 28 29 7b 72 65 74 oundsCache(){ret
0000d820: 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 2e 63 urn this.store.c
0000d830: 72 65 61 74 65 43 6f 6d 70 75 74 65 64 43 61 63 reateComputedCac
0000d840: 68 65 28 22 73 68 61 70 65 4d 61 73 6b 65 64 50 he("shapeMaskedP
0000d850: 61 67 65 42 6f 75 6e 64 73 43 61 63 68 65 22 2c ageBoundsCache",
0000d860: 28 65 3d 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 69 (e=>{const t=thi
0000d870: 73 2e 5f 67 65 74 53 68 61 70 65 50 61 67 65 42 s._getShapePageB
0000d880: 6f 75 6e 64 73 43 61 63 68 65 28 29 2e 67 65 74 oundsCache().get
0000d890: 28 65 2e 69 64 29 3b 69 66 28 21 74 29 72 65 74 (e.id);if(!t)ret
0000d8a0: 75 72 6e 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 urn;const n=this
0000d8b0: 2e 5f 67 65 74 53 68 61 70 65 4d 61 73 6b 43 61 ._getShapeMaskCa
0000d8c0: 63 68 65 28 29 2e 67 65 74 28 65 2e 69 64 29 3b che().get(e.id);
0000d8d0: 69 66 28 6e 29 7b 69 66 28 30 3d 3d 3d 6e 2e 6c if(n){if(0===n.l
0000d8e0: 65 6e 67 74 68 29 72 65 74 75 72 6e 3b 63 6f 6e ength)return;con
0000d8f0: 73 74 7b 63 6f 72 6e 65 72 73 3a 65 7d 3d 74 3b st{corners:e}=t;
0000d900: 69 66 28 65 2e 65 76 65 72 79 28 28 28 65 2c 74 if(e.every(((e,t
0000d910: 29 3d 3e 65 26 26 73 75 2e 45 71 75 61 6c 73 28 )=>e&&su.Equals(
0000d920: 65 2c 6e 5b 74 5d 29 29 29 29 72 65 74 75 72 6e e,n[t]))))return
0000d930: 20 74 2e 63 6c 6f 6e 65 28 29 3b 63 6f 6e 73 74 t.clone();const
0000d940: 20 72 3d 77 68 28 6e 2c 65 29 3b 69 66 28 21 72 r=wh(n,e);if(!r
0000d950: 29 72 65 74 75 72 6e 3b 72 65 74 75 72 6e 20 5f )return;return _
0000d960: 70 2e 46 72 6f 6d 50 6f 69 6e 74 73 28 72 29 7d p.FromPoints(r)}
0000d970: 72 65 74 75 72 6e 20 74 7d 29 29 7d 67 65 74 53 return t}))}getS
0000d980: 68 61 70 65 41 6e 63 65 73 74 6f 72 73 28 65 2c hapeAncestors(e,
0000d990: 74 3d 5b 5d 29 7b 63 6f 6e 73 74 20 6e 3d 22 73 t=[]){const n="s
0000d9a0: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
0000d9b0: 3f 65 3a 65 2e 69 64 2c 72 3d 74 68 69 73 2e 67 ?e:e.id,r=this.g
0000d9c0: 65 74 53 68 61 70 65 28 6e 29 3b 69 66 28 21 72 etShape(n);if(!r
0000d9d0: 29 72 65 74 75 72 6e 20 74 3b 63 6f 6e 73 74 20 )return t;const
0000d9e0: 6f 3d 72 2e 70 61 72 65 6e 74 49 64 3b 69 66 28 o=r.parentId;if(
0000d9f0: 70 6c 28 6f 29 29 72 65 74 75 72 6e 20 74 2e 72 pl(o))return t.r
0000da00: 65 76 65 72 73 65 28 29 2c 74 3b 63 6f 6e 73 74 everse(),t;const
0000da10: 20 69 3d 74 68 69 73 2e 73 74 6f 72 65 2e 67 65 i=this.store.ge
0000da20: 74 28 6f 29 3b 72 65 74 75 72 6e 20 69 3f 28 74 t(o);return i?(t
0000da30: 2e 70 75 73 68 28 69 29 2c 74 68 69 73 2e 67 65 .push(i),this.ge
0000da40: 74 53 68 61 70 65 41 6e 63 65 73 74 6f 72 73 28 tShapeAncestors(
0000da50: 69 2c 74 29 29 3a 74 7d 66 69 6e 64 53 68 61 70 i,t)):t}findShap
0000da60: 65 41 6e 63 65 73 74 6f 72 28 65 2c 74 29 7b 63 eAncestor(e,t){c
0000da70: 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 3d onst n="string"=
0000da80: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
0000da90: 2c 72 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 ,r=this.getShape
0000daa0: 28 6e 29 3b 69 66 28 21 72 29 72 65 74 75 72 6e (n);if(!r)return
0000dab0: 3b 63 6f 6e 73 74 20 6f 3d 72 2e 70 61 72 65 6e ;const o=r.paren
0000dac0: 74 49 64 3b 69 66 28 70 6c 28 6f 29 29 72 65 74 tId;if(pl(o))ret
0000dad0: 75 72 6e 3b 63 6f 6e 73 74 20 69 3d 74 68 69 73 urn;const i=this
0000dae0: 2e 67 65 74 53 68 61 70 65 28 6f 29 3b 72 65 74 .getShape(o);ret
0000daf0: 75 72 6e 20 69 3f 74 28 69 29 3f 69 3a 74 68 69 urn i?t(i)?i:thi
0000db00: 73 2e 66 69 6e 64 53 68 61 70 65 41 6e 63 65 73 s.findShapeAnces
0000db10: 74 6f 72 28 69 2c 74 29 3a 76 6f 69 64 20 30 7d tor(i,t):void 0}
0000db20: 68 61 73 41 6e 63 65 73 74 6f 72 28 65 2c 74 29 hasAncestor(e,t)
0000db30: 7b 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 {const n="string
0000db40: 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 3f "==typeof e?e:e?
0000db50: 2e 69 64 2c 72 3d 6e 26 26 74 68 69 73 2e 67 65 .id,r=n&&this.ge
0000db60: 74 53 68 61 70 65 28 6e 29 3b 72 65 74 75 72 6e tShape(n);return
0000db70: 21 21 72 26 26 28 72 2e 70 61 72 65 6e 74 49 64 !!r&&(r.parentId
0000db80: 3d 3d 3d 74 7c 7c 74 68 69 73 2e 68 61 73 41 6e ===t||this.hasAn
0000db90: 63 65 73 74 6f 72 28 74 68 69 73 2e 67 65 74 53 cestor(this.getS
0000dba0: 68 61 70 65 50 61 72 65 6e 74 28 72 29 2c 74 29 hapeParent(r),t)
0000dbb0: 29 7d 66 69 6e 64 43 6f 6d 6d 6f 6e 41 6e 63 65 )}findCommonAnce
0000dbc0: 73 74 6f 72 28 65 2c 74 29 7b 69 66 28 30 3d 3d stor(e,t){if(0==
0000dbd0: 3d 65 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 6e =e.length)return
0000dbe0: 3b 63 6f 6e 73 74 20 6e 3d 6a 72 28 28 22 73 74 ;const n=jr(("st
0000dbf0: 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b ring"==typeof e[
0000dc00: 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 0]?e:e.map((e=>e
0000dc10: 2e 69 64 29 29 29 2e 6d 61 70 28 28 65 3d 3e 74 .id))).map((e=>t
0000dc20: 68 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 his.getShape(e))
0000dc30: 29 29 3b 69 66 28 31 3d 3d 3d 6e 2e 6c 65 6e 67 ));if(1===n.leng
0000dc40: 74 68 29 7b 63 6f 6e 73 74 20 65 3d 6e 5b 30 5d th){const e=n[0]
0000dc50: 2e 70 61 72 65 6e 74 49 64 3b 69 66 28 70 6c 28 .parentId;if(pl(
0000dc60: 65 29 29 72 65 74 75 72 6e 3b 72 65 74 75 72 6e e))return;return
0000dc70: 20 74 3f 74 68 69 73 2e 66 69 6e 64 53 68 61 70 t?this.findShap
0000dc80: 65 41 6e 63 65 73 74 6f 72 28 6e 5b 30 5d 2c 74 eAncestor(n[0],t
0000dc90: 29 3f 2e 69 64 3a 65 7d 63 6f 6e 73 74 5b 72 2c )?.id:e}const[r,
0000dca0: 2e 2e 2e 6f 5d 3d 6e 3b 6c 65 74 20 69 3d 74 68 ...o]=n;let i=th
0000dcb0: 69 73 2e 67 65 74 53 68 61 70 65 50 61 72 65 6e is.getShapeParen
0000dcc0: 74 28 72 29 3b 66 6f 72 28 3b 69 3b 29 69 66 28 t(r);for(;i;)if(
0000dcd0: 21 74 7c 7c 74 28 69 29 29 7b 69 66 28 6f 2e 65 !t||t(i)){if(o.e
0000dce0: 76 65 72 79 28 28 65 3d 3e 74 68 69 73 2e 68 61 very((e=>this.ha
0000dcf0: 73 41 6e 63 65 73 74 6f 72 28 65 2c 69 2e 69 64 sAncestor(e,i.id
0000dd00: 29 29 29 29 72 65 74 75 72 6e 20 69 2e 69 64 3b ))))return i.id;
0000dd10: 69 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 i=this.getShapeP
0000dd20: 61 72 65 6e 74 28 69 29 7d 65 6c 73 65 20 69 3d arent(i)}else i=
0000dd30: 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 72 this.getShapePar
0000dd40: 65 6e 74 28 69 29 7d 69 73 53 68 61 70 65 4f 72 ent(i)}isShapeOr
0000dd50: 41 6e 63 65 73 74 6f 72 4c 6f 63 6b 65 64 28 65 AncestorLocked(e
0000dd60: 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e ){const t="strin
0000dd70: 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 74 68 69 g"==typeof e?thi
0000dd80: 73 2e 67 65 74 53 68 61 70 65 28 65 29 3a 65 3b s.getShape(e):e;
0000dd90: 72 65 74 75 72 6e 20 76 6f 69 64 20 30 21 3d 3d return void 0!==
0000dda0: 74 26 26 28 21 21 74 2e 69 73 4c 6f 63 6b 65 64 t&&(!!t.isLocked
0000ddb0: 7c 7c 74 68 69 73 2e 69 73 53 68 61 70 65 4f 72 ||this.isShapeOr
0000ddc0: 41 6e 63 65 73 74 6f 72 4c 6f 63 6b 65 64 28 74 AncestorLocked(t
0000ddd0: 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 72 65 his.getShapePare
0000dde0: 6e 74 28 74 29 29 29 7d 5f 6e 6f 74 56 69 73 69 nt(t)))}_notVisi
0000ddf0: 62 6c 65 53 68 61 70 65 73 28 29 7b 72 65 74 75 bleShapes(){retu
0000de00: 72 6e 28 65 3d 3e 7b 66 75 6e 63 74 69 6f 6e 20 rn(e=>{function
0000de10: 74 28 65 29 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 t(e){const t=e.g
0000de20: 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 68 61 etCurrentPageSha
0000de30: 70 65 49 64 73 28 29 2c 6e 3d 65 2e 67 65 74 56 peIds(),n=e.getV
0000de40: 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e 64 iewportPageBound
0000de50: 73 28 29 2c 72 3d 6e 65 77 20 53 65 74 3b 72 65 s(),r=new Set;re
0000de60: 74 75 72 6e 20 74 2e 66 6f 72 45 61 63 68 28 28 turn t.forEach((
0000de70: 74 3d 3e 7b 28 66 75 6e 63 74 69 6f 6e 28 65 2c t=>{(function(e,
0000de80: 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 65 2e 67 t,n){const r=e.g
0000de90: 65 74 53 68 61 70 65 4d 61 73 6b 65 64 50 61 67 etShapeMaskedPag
0000dea0: 65 42 6f 75 6e 64 73 28 74 29 3b 72 65 74 75 72 eBounds(t);retur
0000deb0: 6e 20 76 6f 69 64 20 30 3d 3d 3d 72 7c 7c 21 6e n void 0===r||!n
0000dec0: 2e 69 6e 63 6c 75 64 65 73 28 72 29 7d 29 28 65 .includes(r)})(e
0000ded0: 2c 74 2c 6e 29 26 26 72 2e 61 64 64 28 74 29 7d ,t,n)&&r.add(t)}
0000dee0: 29 29 2c 72 7d 72 65 74 75 72 6e 20 6f 61 28 22 )),r}return oa("
0000def0: 67 65 74 43 75 6c 6c 65 64 53 68 61 70 65 73 22 getCulledShapes"
0000df00: 2c 28 6e 3d 3e 7b 69 66 28 51 69 28 6e 29 29 72 ,(n=>{if(Qi(n))r
0000df10: 65 74 75 72 6e 20 74 28 65 29 3b 63 6f 6e 73 74 eturn t(e);const
0000df20: 20 72 3d 74 28 65 29 3b 69 66 28 6e 2e 73 69 7a r=t(e);if(n.siz
0000df30: 65 21 3d 3d 72 2e 73 69 7a 65 29 72 65 74 75 72 e!==r.size)retur
0000df40: 6e 20 72 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 n r;for(const e
0000df50: 6f 66 20 6e 29 69 66 28 21 72 2e 68 61 73 28 65 of n)if(!r.has(e
0000df60: 29 29 72 65 74 75 72 6e 20 72 3b 72 65 74 75 72 ))return r;retur
0000df70: 6e 20 6e 7d 29 29 7d 29 28 74 68 69 73 29 7d 67 n n}))})(this)}g
0000df80: 65 74 43 75 6c 6c 65 64 53 68 61 70 65 73 28 29 etCulledShapes()
0000df90: 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 5f 6e {const e=this._n
0000dfa0: 6f 74 56 69 73 69 62 6c 65 53 68 61 70 65 73 28 otVisibleShapes(
0000dfb0: 29 2e 67 65 74 28 29 2c 74 3d 74 68 69 73 2e 67 ).get(),t=this.g
0000dfc0: 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 65 49 etSelectedShapeI
0000dfd0: 64 73 28 29 2c 6e 3d 74 68 69 73 2e 67 65 74 45 ds(),n=this.getE
0000dfe0: 64 69 74 69 6e 67 53 68 61 70 65 49 64 28 29 2c ditingShapeId(),
0000dff0: 72 3d 6e 65 77 20 53 65 74 28 65 29 3b 72 65 74 r=new Set(e);ret
0000e000: 75 72 6e 20 6e 26 26 72 2e 64 65 6c 65 74 65 28 urn n&&r.delete(
0000e010: 6e 29 2c 74 2e 66 6f 72 45 61 63 68 28 28 65 3d n),t.forEach((e=
0000e020: 3e 7b 72 2e 64 65 6c 65 74 65 28 65 29 7d 29 29 >{r.delete(e)}))
0000e030: 2c 72 7d 67 65 74 43 75 72 72 65 6e 74 50 61 67 ,r}getCurrentPag
0000e040: 65 42 6f 75 6e 64 73 28 29 7b 6c 65 74 20 65 3b eBounds(){let e;
0000e050: 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 43 return this.getC
0000e060: 75 72 72 65 6e 74 50 61 67 65 53 68 61 70 65 49 urrentPageShapeI
0000e070: 64 73 53 6f 72 74 65 64 28 29 2e 66 6f 72 45 61 dsSorted().forEa
0000e080: 63 68 28 28 74 3d 3e 7b 63 6f 6e 73 74 20 6e 3d ch((t=>{const n=
0000e090: 74 68 69 73 2e 67 65 74 53 68 61 70 65 4d 61 73 this.getShapeMas
0000e0a0: 6b 65 64 50 61 67 65 42 6f 75 6e 64 73 28 74 29 kedPageBounds(t)
0000e0b0: 3b 6e 26 26 28 65 3d 65 3f 65 2e 65 78 70 61 6e ;n&&(e=e?e.expan
0000e0c0: 64 28 6e 29 3a 6e 2e 63 6c 6f 6e 65 28 29 29 7d d(n):n.clone())}
0000e0d0: 29 29 2c 65 7d 67 65 74 53 65 6c 65 63 74 65 64 )),e}getSelected
0000e0e0: 53 68 61 70 65 41 74 50 6f 69 6e 74 28 65 29 7b ShapeAtPoint(e){
0000e0f0: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 const t=this.get
0000e100: 53 65 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 SelectedShapeIds
0000e110: 28 29 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 67 ();return this.g
0000e120: 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 68 61 etCurrentPageSha
0000e130: 70 65 73 53 6f 72 74 65 64 28 29 2e 66 69 6c 74 pesSorted().filt
0000e140: 65 72 28 28 65 3d 3e 22 67 72 6f 75 70 22 21 3d er((e=>"group"!=
0000e150: 3d 65 2e 74 79 70 65 26 26 74 2e 69 6e 63 6c 75 =e.type&&t.inclu
0000e160: 64 65 73 28 65 2e 69 64 29 29 29 2e 72 65 76 65 des(e.id))).reve
0000e170: 72 73 65 28 29 2e 66 69 6e 64 28 28 74 3d 3e 74 rse().find((t=>t
0000e180: 68 69 73 2e 69 73 50 6f 69 6e 74 49 6e 53 68 61 his.isPointInSha
0000e190: 70 65 28 74 2c 65 2c 7b 68 69 74 49 6e 73 69 64 pe(t,e,{hitInsid
0000e1a0: 65 3a 21 30 2c 6d 61 72 67 69 6e 3a 30 7d 29 29 e:!0,margin:0}))
0000e1b0: 29 7d 67 65 74 53 68 61 70 65 41 74 50 6f 69 6e )}getShapeAtPoin
0000e1c0: 74 28 65 2c 74 3d 7b 7d 29 7b 63 6f 6e 73 74 20 t(e,t={}){const
0000e1d0: 6e 3d 74 68 69 73 2e 67 65 74 5a 6f 6f 6d 4c 65 n=this.getZoomLe
0000e1e0: 76 65 6c 28 29 2c 72 3d 74 68 69 73 2e 67 65 74 vel(),r=this.get
0000e1f0: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
0000e200: 64 73 28 29 2c 7b 66 69 6c 74 65 72 3a 6f 2c 6d ds(),{filter:o,m
0000e210: 61 72 67 69 6e 3a 69 3d 30 2c 68 69 74 4c 6f 63 argin:i=0,hitLoc
0000e220: 6b 65 64 3a 61 3d 21 31 2c 68 69 74 4c 61 62 65 ked:a=!1,hitLabe
0000e230: 6c 73 3a 73 3d 21 31 2c 68 69 74 49 6e 73 69 64 ls:s=!1,hitInsid
0000e240: 65 3a 6c 3d 21 31 2c 68 69 74 46 72 61 6d 65 49 e:l=!1,hitFrameI
0000e250: 6e 73 69 64 65 3a 63 3d 21 31 7d 3d 74 3b 6c 65 nside:c=!1}=t;le
0000e260: 74 20 75 3d 31 2f 30 2c 64 3d 6e 75 6c 6c 2c 70 t u=1/0,d=null,p
0000e270: 3d 31 2f 30 2c 66 3d 6e 75 6c 6c 3b 63 6f 6e 73 =1/0,f=null;cons
0000e280: 74 20 68 3d 28 74 2e 72 65 6e 64 65 72 69 6e 67 t h=(t.rendering
0000e290: 4f 6e 6c 79 3f 74 68 69 73 2e 67 65 74 43 75 72 Only?this.getCur
0000e2a0: 72 65 6e 74 50 61 67 65 52 65 6e 64 65 72 69 6e rentPageRenderin
0000e2b0: 67 53 68 61 70 65 73 53 6f 72 74 65 64 28 29 3a gShapesSorted():
0000e2c0: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
0000e2d0: 61 67 65 53 68 61 70 65 73 53 6f 72 74 65 64 28 ageShapesSorted(
0000e2e0: 29 29 2e 66 69 6c 74 65 72 28 28 74 3d 3e 7b 69 )).filter((t=>{i
0000e2f0: 66 28 74 2e 69 73 4c 6f 63 6b 65 64 26 26 21 61 f(t.isLocked&&!a
0000e300: 7c 7c 74 68 69 73 2e 69 73 53 68 61 70 65 4f 66 ||this.isShapeOf
0000e310: 54 79 70 65 28 74 2c 22 67 72 6f 75 70 22 29 29 Type(t,"group"))
0000e320: 72 65 74 75 72 6e 21 31 3b 63 6f 6e 73 74 20 6e return!1;const n
0000e330: 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 4d 61 =this.getShapeMa
0000e340: 73 6b 28 74 29 3b 72 65 74 75 72 6e 21 28 6e 26 sk(t);return!(n&
0000e350: 26 21 4f 75 28 65 2c 6e 29 29 26 26 28 21 6f 7c &!Ou(e,n))&&(!o|
0000e360: 7c 6f 28 74 29 29 7d 29 29 3b 66 6f 72 28 6c 65 |o(t))}));for(le
0000e370: 74 20 74 3d 68 2e 6c 65 6e 67 74 68 2d 31 3b 74 t t=h.length-1;t
0000e380: 3e 3d 30 3b 74 2d 2d 29 7b 63 6f 6e 73 74 20 6f >=0;t--){const o
0000e390: 3d 68 5b 74 5d 2c 61 3d 74 68 69 73 2e 67 65 74 =h[t],a=this.get
0000e3a0: 53 68 61 70 65 47 65 6f 6d 65 74 72 79 28 6f 29 ShapeGeometry(o)
0000e3b0: 2c 6d 3d 61 20 69 6e 73 74 61 6e 63 65 6f 66 20 ,m=a instanceof
0000e3c0: 6b 70 2c 67 3d 74 68 69 73 2e 67 65 74 50 6f 69 kp,g=this.getPoi
0000e3d0: 6e 74 49 6e 53 68 61 70 65 53 70 61 63 65 28 6f ntInShapeSpace(o
0000e3e0: 2c 65 29 3b 69 66 28 28 74 68 69 73 2e 69 73 53 ,e);if((this.isS
0000e3f0: 68 61 70 65 4f 66 54 79 70 65 28 6f 2c 22 61 72 hapeOfType(o,"ar
0000e400: 72 6f 77 22 29 7c 7c 74 68 69 73 2e 69 73 53 68 row")||this.isSh
0000e410: 61 70 65 4f 66 54 79 70 65 28 6f 2c 22 67 65 6f apeOfType(o,"geo
0000e420: 22 29 26 26 22 6e 6f 6e 65 22 3d 3d 3d 6f 2e 70 ")&&"none"===o.p
0000e430: 72 6f 70 73 2e 66 69 6c 6c 29 26 26 6f 2e 70 72 rops.fill)&&o.pr
0000e440: 6f 70 73 2e 74 65 78 74 2e 74 72 69 6d 28 29 29 ops.text.trim())
0000e450: 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 61 for(const e of a
0000e460: 2e 63 68 69 6c 64 72 65 6e 29 69 66 28 65 2e 69 .children)if(e.i
0000e470: 73 4c 61 62 65 6c 26 26 65 2e 69 73 50 6f 69 6e sLabel&&e.isPoin
0000e480: 74 49 6e 42 6f 75 6e 64 73 28 67 29 29 72 65 74 tInBounds(g))ret
0000e490: 75 72 6e 20 6f 3b 69 66 28 74 68 69 73 2e 69 73 urn o;if(this.is
0000e4a0: 53 68 61 70 65 4f 66 54 79 70 65 28 6f 2c 22 66 ShapeOfType(o,"f
0000e4b0: 72 61 6d 65 22 29 29 7b 63 6f 6e 73 74 20 65 3d rame")){const e=
0000e4c0: 61 2e 64 69 73 74 61 6e 63 65 54 6f 50 6f 69 6e a.distanceToPoin
0000e4d0: 74 28 67 2c 6c 29 3b 69 66 28 4d 61 74 68 2e 61 t(g,l);if(Math.a
0000e4e0: 62 73 28 65 29 3c 3d 69 29 72 65 74 75 72 6e 20 bs(e)<=i)return
0000e4f0: 66 7c 7c 6f 3b 69 66 28 61 2e 68 69 74 54 65 73 f||o;if(a.hitTes
0000e500: 74 50 6f 69 6e 74 28 67 2c 30 2c 21 30 29 29 72 tPoint(g,0,!0))r
0000e510: 65 74 75 72 6e 20 66 7c 7c 64 7c 7c 28 63 3f 6f eturn f||d||(c?o
0000e520: 3a 76 6f 69 64 20 30 29 3b 63 6f 6e 74 69 6e 75 :void 0);continu
0000e530: 65 7d 6c 65 74 20 62 3b 69 66 28 6d 29 7b 6c 65 e}let b;if(m){le
0000e540: 74 20 65 3d 31 2f 30 3b 66 6f 72 28 63 6f 6e 73 t e=1/0;for(cons
0000e550: 74 20 74 20 6f 66 20 61 2e 63 68 69 6c 64 72 65 t t of a.childre
0000e560: 6e 29 7b 69 66 28 74 2e 69 73 4c 61 62 65 6c 26 n){if(t.isLabel&
0000e570: 26 21 73 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e &!s)continue;con
0000e580: 73 74 20 6e 3d 74 2e 64 69 73 74 61 6e 63 65 54 st n=t.distanceT
0000e590: 6f 50 6f 69 6e 74 28 67 2c 6c 29 3b 6e 3c 65 26 oPoint(g,l);n<e&
0000e5a0: 26 28 65 3d 6e 29 7d 62 3d 65 7d 65 6c 73 65 20 &(e=n)}b=e}else
0000e5b0: 62 3d 30 3d 3d 3d 69 26 26 28 61 2e 62 6f 75 6e b=0===i&&(a.boun
0000e5c0: 64 73 2e 77 3c 31 7c 7c 61 2e 62 6f 75 6e 64 73 ds.w<1||a.bounds
0000e5d0: 2e 68 3c 31 29 7c 7c 61 2e 62 6f 75 6e 64 73 2e .h<1)||a.bounds.
0000e5e0: 63 6f 6e 74 61 69 6e 73 50 6f 69 6e 74 28 67 2c containsPoint(g,
0000e5f0: 69 29 3f 61 2e 64 69 73 74 61 6e 63 65 54 6f 50 i)?a.distanceToP
0000e600: 6f 69 6e 74 28 67 2c 6c 29 3a 31 2f 30 3b 69 66 oint(g,l):1/0;if
0000e610: 28 61 2e 69 73 43 6c 6f 73 65 64 29 7b 69 66 28 (a.isClosed){if(
0000e620: 62 3c 3d 69 29 7b 69 66 28 61 2e 69 73 46 69 6c b<=i){if(a.isFil
0000e630: 6c 65 64 7c 7c 6d 26 26 61 2e 63 68 69 6c 64 72 led||m&&a.childr
0000e640: 65 6e 5b 30 5d 2e 69 73 46 69 6c 6c 65 64 29 72 en[0].isFilled)r
0000e650: 65 74 75 72 6e 20 66 7c 7c 6f 3b 69 66 28 74 68 eturn f||o;if(th
0000e660: 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 is.getShapePageB
0000e670: 6f 75 6e 64 73 28 6f 29 2e 63 6f 6e 74 61 69 6e ounds(o).contain
0000e680: 73 28 72 29 29 63 6f 6e 74 69 6e 75 65 3b 69 66 s(r))continue;if
0000e690: 28 4d 61 74 68 2e 61 62 73 28 62 29 3c 69 29 4d (Math.abs(b)<i)M
0000e6a0: 61 74 68 2e 61 62 73 28 62 29 3c 70 26 26 28 70 ath.abs(b)<p&&(p
0000e6b0: 3d 4d 61 74 68 2e 61 62 73 28 62 29 2c 66 3d 6f =Math.abs(b),f=o
0000e6c0: 29 3b 65 6c 73 65 20 69 66 28 21 66 29 7b 63 6f );else if(!f){co
0000e6d0: 6e 73 74 7b 61 72 65 61 3a 65 7d 3d 61 3b 65 3c nst{area:e}=a;e<
0000e6e0: 75 26 26 28 75 3d 65 2c 64 3d 6f 29 7d 7d 7d 65 u&&(u=e,d=o)}}}e
0000e6f0: 6c 73 65 20 69 66 28 62 3c 74 68 69 73 2e 6f 70 lse if(b<this.op
0000e700: 74 69 6f 6e 73 2e 68 69 74 54 65 73 74 4d 61 72 tions.hitTestMar
0000e710: 67 69 6e 2f 6e 29 72 65 74 75 72 6e 20 6f 7d 72 gin/n)return o}r
0000e720: 65 74 75 72 6e 20 66 7c 7c 64 7c 7c 76 6f 69 64 eturn f||d||void
0000e730: 20 30 7d 67 65 74 53 68 61 70 65 73 41 74 50 6f 0}getShapesAtPo
0000e740: 69 6e 74 28 65 2c 74 3d 7b 7d 29 7b 72 65 74 75 int(e,t={}){retu
0000e750: 72 6e 20 74 68 69 73 2e 67 65 74 43 75 72 72 65 rn this.getCurre
0000e760: 6e 74 50 61 67 65 53 68 61 70 65 73 28 29 2e 66 ntPageShapes().f
0000e770: 69 6c 74 65 72 28 28 6e 3d 3e 74 68 69 73 2e 69 ilter((n=>this.i
0000e780: 73 50 6f 69 6e 74 49 6e 53 68 61 70 65 28 6e 2c sPointInShape(n,
0000e790: 65 2c 74 29 29 29 7d 69 73 50 6f 69 6e 74 49 6e e,t)))}isPointIn
0000e7a0: 53 68 61 70 65 28 65 2c 74 2c 6e 3d 7b 7d 29 7b Shape(e,t,n={}){
0000e7b0: 63 6f 6e 73 74 7b 68 69 74 49 6e 73 69 64 65 3a const{hitInside:
0000e7c0: 72 3d 21 31 2c 6d 61 72 67 69 6e 3a 6f 3d 30 7d r=!1,margin:o=0}
0000e7d0: 3d 6e 2c 69 3d 22 73 74 72 69 6e 67 22 3d 3d 74 =n,i="string"==t
0000e7e0: 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 2c 61 ypeof e?e:e.id,a
0000e7f0: 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 4d 61 =this.getShapeMa
0000e800: 73 6b 28 69 29 3b 72 65 74 75 72 6e 21 28 61 26 sk(i);return!(a&
0000e810: 26 21 4f 75 28 74 2c 61 29 29 26 26 74 68 69 73 &!Ou(t,a))&&this
0000e820: 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 .getShapeGeometr
0000e830: 79 28 69 29 2e 68 69 74 54 65 73 74 50 6f 69 6e y(i).hitTestPoin
0000e840: 74 28 74 68 69 73 2e 67 65 74 50 6f 69 6e 74 49 t(this.getPointI
0000e850: 6e 53 68 61 70 65 53 70 61 63 65 28 65 2c 74 29 nShapeSpace(e,t)
0000e860: 2c 6f 2c 72 29 7d 67 65 74 50 6f 69 6e 74 49 6e ,o,r)}getPointIn
0000e870: 53 68 61 70 65 53 70 61 63 65 28 65 2c 74 29 7b ShapeSpace(e,t){
0000e880: 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 const n="string"
0000e890: 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 ==typeof e?e:e.i
0000e8a0: 64 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 67 d;return this._g
0000e8b0: 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 etShapePageTrans
0000e8c0: 66 6f 72 6d 43 61 63 68 65 28 29 2e 67 65 74 28 formCache().get(
0000e8d0: 6e 29 2e 63 6c 6f 6e 65 28 29 2e 69 6e 76 65 72 n).clone().inver
0000e8e0: 74 28 29 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 t().applyToPoint
0000e8f0: 28 74 29 7d 67 65 74 50 6f 69 6e 74 49 6e 50 61 (t)}getPointInPa
0000e900: 72 65 6e 74 53 70 61 63 65 28 65 2c 74 29 7b 63 rentSpace(e,t){c
0000e910: 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 3d onst n="string"=
0000e920: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
0000e930: 2c 72 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 ,r=this.getShape
0000e940: 28 6e 29 3b 69 66 28 21 72 29 72 65 74 75 72 6e (n);if(!r)return
0000e950: 20 6e 65 77 20 73 75 28 30 2c 30 29 3b 69 66 28 new su(0,0);if(
0000e960: 70 6c 28 72 2e 70 61 72 65 6e 74 49 64 29 29 72 pl(r.parentId))r
0000e970: 65 74 75 72 6e 20 73 75 2e 46 72 6f 6d 28 74 29 eturn su.From(t)
0000e980: 3b 63 6f 6e 73 74 20 6f 3d 74 68 69 73 2e 67 65 ;const o=this.ge
0000e990: 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 tShapePageTransf
0000e9a0: 6f 72 6d 28 72 2e 70 61 72 65 6e 74 49 64 29 3b orm(r.parentId);
0000e9b0: 72 65 74 75 72 6e 20 6f 3f 6f 2e 63 6c 6f 6e 65 return o?o.clone
0000e9c0: 28 29 2e 69 6e 76 65 72 74 28 29 2e 61 70 70 6c ().invert().appl
0000e9d0: 79 54 6f 50 6f 69 6e 74 28 74 29 3a 73 75 2e 46 yToPoint(t):su.F
0000e9e0: 72 6f 6d 28 74 29 7d 67 65 74 43 75 72 72 65 6e rom(t)}getCurren
0000e9f0: 74 50 61 67 65 53 68 61 70 65 73 28 29 7b 72 65 tPageShapes(){re
0000ea00: 74 75 72 6e 20 41 72 72 61 79 2e 66 72 6f 6d 28 turn Array.from(
0000ea10: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
0000ea20: 61 67 65 53 68 61 70 65 49 64 73 28 29 2c 28 65 ageShapeIds(),(e
0000ea30: 3d 3e 74 68 69 73 2e 73 74 6f 72 65 2e 67 65 74 =>this.store.get
0000ea40: 28 65 29 29 29 7d 67 65 74 43 75 72 72 65 6e 74 (e)))}getCurrent
0000ea50: 50 61 67 65 53 68 61 70 65 73 53 6f 72 74 65 64 PageShapesSorted
0000ea60: 28 29 7b 63 6f 6e 73 74 20 65 3d 5b 5d 2c 74 3d (){const e=[],t=
0000ea70: 74 68 69 73 2e 67 65 74 53 6f 72 74 65 64 43 68 this.getSortedCh
0000ea80: 69 6c 64 49 64 73 46 6f 72 50 61 72 65 6e 74 28 ildIdsForParent(
0000ea90: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
0000eaa0: 61 67 65 49 64 28 29 29 3b 66 6f 72 28 6c 65 74 ageId());for(let
0000eab0: 20 6e 3d 30 2c 72 3d 74 2e 6c 65 6e 67 74 68 3b n=0,r=t.length;
0000eac0: 6e 3c 72 3b 6e 2b 2b 29 47 6d 28 74 68 69 73 2c n<r;n++)Gm(this,
0000ead0: 74 5b 6e 5d 2c 65 29 3b 72 65 74 75 72 6e 20 65 t[n],e);return e
0000eae0: 7d 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 52 }getCurrentPageR
0000eaf0: 65 6e 64 65 72 69 6e 67 53 68 61 70 65 73 53 6f enderingShapesSo
0000eb00: 72 74 65 64 28 29 7b 63 6f 6e 73 74 20 65 3d 74 rted(){const e=t
0000eb10: 68 69 73 2e 67 65 74 43 75 6c 6c 65 64 53 68 61 his.getCulledSha
0000eb20: 70 65 73 28 29 3b 72 65 74 75 72 6e 20 74 68 69 pes();return thi
0000eb30: 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 s.getCurrentPage
0000eb40: 53 68 61 70 65 73 53 6f 72 74 65 64 28 29 2e 66 ShapesSorted().f
0000eb50: 69 6c 74 65 72 28 28 28 7b 69 64 3a 74 7d 29 3d ilter((({id:t})=
0000eb60: 3e 21 65 2e 68 61 73 28 74 29 29 29 7d 69 73 53 >!e.has(t)))}isS
0000eb70: 68 61 70 65 4f 66 54 79 70 65 28 65 2c 74 29 7b hapeOfType(e,t){
0000eb80: 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 const n="string"
0000eb90: 3d 3d 74 79 70 65 6f 66 20 65 3f 74 68 69 73 2e ==typeof e?this.
0000eba0: 67 65 74 53 68 61 70 65 28 65 29 3a 65 3b 72 65 getShape(e):e;re
0000ebb0: 74 75 72 6e 21 21 6e 26 26 6e 2e 74 79 70 65 3d turn!!n&&n.type=
0000ebc0: 3d 3d 74 7d 67 65 74 53 68 61 70 65 28 65 29 7b ==t}getShape(e){
0000ebd0: 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e 67 22 const t="string"
0000ebe0: 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 ==typeof e?e:e.i
0000ebf0: 64 3b 69 66 28 41 73 28 74 29 29 72 65 74 75 72 d;if(As(t))retur
0000ec00: 6e 20 74 68 69 73 2e 73 74 6f 72 65 2e 67 65 74 n this.store.get
0000ec10: 28 74 29 7d 67 65 74 53 68 61 70 65 50 61 72 65 (t)}getShapePare
0000ec20: 6e 74 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 nt(e){const t="s
0000ec30: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
0000ec40: 3f 65 3a 65 3f 2e 69 64 3b 69 66 28 21 74 29 72 ?e:e?.id;if(!t)r
0000ec50: 65 74 75 72 6e 3b 63 6f 6e 73 74 20 6e 3d 74 68 eturn;const n=th
0000ec60: 69 73 2e 67 65 74 53 68 61 70 65 28 74 29 3b 72 is.getShape(t);r
0000ec70: 65 74 75 72 6e 20 76 6f 69 64 20 30 21 3d 3d 6e eturn void 0!==n
0000ec80: 26 26 41 73 28 6e 2e 70 61 72 65 6e 74 49 64 29 &&As(n.parentId)
0000ec90: 3f 74 68 69 73 2e 73 74 6f 72 65 2e 67 65 74 28 ?this.store.get(
0000eca0: 6e 2e 70 61 72 65 6e 74 49 64 29 3a 76 6f 69 64 n.parentId):void
0000ecb0: 20 30 7d 67 65 74 53 68 61 70 65 4e 65 61 72 65 0}getShapeNeare
0000ecc0: 73 74 53 69 62 6c 69 6e 67 28 65 2c 74 29 7b 69 stSibling(e,t){i
0000ecd0: 66 28 21 74 29 72 65 74 75 72 6e 3b 69 66 28 74 f(!t)return;if(t
0000ece0: 2e 70 61 72 65 6e 74 49 64 3d 3d 3d 65 2e 70 61 .parentId===e.pa
0000ecf0: 72 65 6e 74 49 64 29 72 65 74 75 72 6e 20 74 3b rentId)return t;
0000ed00: 72 65 74 75 72 6e 20 74 68 69 73 2e 66 69 6e 64 return this.find
0000ed10: 53 68 61 70 65 41 6e 63 65 73 74 6f 72 28 74 2c ShapeAncestor(t,
0000ed20: 28 74 3d 3e 74 2e 70 61 72 65 6e 74 49 64 3d 3d (t=>t.parentId==
0000ed30: 3d 65 2e 70 61 72 65 6e 74 49 64 29 29 7d 69 73 =e.parentId))}is
0000ed40: 53 68 61 70 65 49 6e 50 61 67 65 28 65 2c 74 3d ShapeInPage(e,t=
0000ed50: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
0000ed60: 61 67 65 49 64 28 29 29 7b 63 6f 6e 73 74 20 6e ageId()){const n
0000ed70: 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ="string"==typeo
0000ed80: 66 20 65 3f 65 3a 65 2e 69 64 2c 72 3d 74 68 69 f e?e:e.id,r=thi
0000ed90: 73 2e 67 65 74 53 68 61 70 65 28 6e 29 3b 69 66 s.getShape(n);if
0000eda0: 28 21 72 29 72 65 74 75 72 6e 21 31 3b 6c 65 74 (!r)return!1;let
0000edb0: 20 6f 3d 21 31 3b 69 66 28 72 2e 70 61 72 65 6e o=!1;if(r.paren
0000edc0: 74 49 64 3d 3d 3d 74 29 6f 3d 21 30 3b 65 6c 73 tId===t)o=!0;els
0000edd0: 65 7b 6c 65 74 20 65 3d 74 68 69 73 2e 67 65 74 e{let e=this.get
0000ede0: 53 68 61 70 65 28 72 2e 70 61 72 65 6e 74 49 64 Shape(r.parentId
0000edf0: 29 3b 65 3a 66 6f 72 28 3b 65 3b 29 7b 69 66 28 );e:for(;e;){if(
0000ee00: 65 2e 70 61 72 65 6e 74 49 64 3d 3d 3d 74 29 7b e.parentId===t){
0000ee10: 6f 3d 21 30 3b 62 72 65 61 6b 20 65 7d 65 3d 74 o=!0;break e}e=t
0000ee20: 68 69 73 2e 67 65 74 53 68 61 70 65 28 65 2e 70 his.getShape(e.p
0000ee30: 61 72 65 6e 74 49 64 29 7d 7d 72 65 74 75 72 6e arentId)}}return
0000ee40: 20 6f 7d 67 65 74 41 6e 63 65 73 74 6f 72 50 61 o}getAncestorPa
0000ee50: 67 65 49 64 28 65 29 7b 63 6f 6e 73 74 20 74 3d geId(e){const t=
0000ee60: 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 "string"==typeof
0000ee70: 20 65 3f 65 3a 65 3f 2e 69 64 2c 6e 3d 74 26 26 e?e:e?.id,n=t&&
0000ee80: 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 74 29 this.getShape(t)
0000ee90: 3b 69 66 28 6e 29 72 65 74 75 72 6e 20 70 6c 28 ;if(n)return pl(
0000eea0: 6e 2e 70 61 72 65 6e 74 49 64 29 3f 6e 2e 70 61 n.parentId)?n.pa
0000eeb0: 72 65 6e 74 49 64 3a 74 68 69 73 2e 67 65 74 41 rentId:this.getA
0000eec0: 6e 63 65 73 74 6f 72 50 61 67 65 49 64 28 74 68 ncestorPageId(th
0000eed0: 69 73 2e 67 65 74 53 68 61 70 65 28 6e 2e 70 61 is.getShape(n.pa
0000eee0: 72 65 6e 74 49 64 29 29 7d 5f 70 61 72 65 6e 74 rentId))}_parent
0000eef0: 49 64 73 54 6f 43 68 69 6c 64 49 64 73 3b 72 65 IdsToChildIds;re
0000ef00: 70 61 72 65 6e 74 53 68 61 70 65 73 28 65 2c 74 parentShapes(e,t
0000ef10: 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 22 73 74 72 ,n){const r="str
0000ef20: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 ing"==typeof e[0
0000ef30: 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e ]?e:e.map((e=>e.
0000ef40: 69 64 29 29 3b 69 66 28 30 3d 3d 3d 72 2e 6c 65 id));if(0===r.le
0000ef50: 6e 67 74 68 29 72 65 74 75 72 6e 20 74 68 69 73 ngth)return this
0000ef60: 3b 63 6f 6e 73 74 20 6f 3d 5b 5d 2c 69 3d 70 6c ;const o=[],i=pl
0000ef70: 28 74 29 3f 77 70 2e 49 64 65 6e 74 69 74 79 28 (t)?wp.Identity(
0000ef80: 29 3a 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 ):this.getShapeP
0000ef90: 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 74 29 2c ageTransform(t),
0000efa0: 61 3d 69 2e 72 6f 74 61 74 69 6f 6e 28 29 3b 6c a=i.rotation();l
0000efb0: 65 74 20 73 3d 5b 5d 3b 63 6f 6e 73 74 20 6c 3d et s=[];const l=
0000efc0: 6a 72 28 74 68 69 73 2e 67 65 74 53 6f 72 74 65 jr(this.getSorte
0000efd0: 64 43 68 69 6c 64 49 64 73 46 6f 72 50 61 72 65 dChildIdsForPare
0000efe0: 6e 74 28 74 29 2e 6d 61 70 28 28 65 3d 3e 74 68 nt(t).map((e=>th
0000eff0: 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 is.getShape(e)))
0000f000: 29 3b 69 66 28 6e 29 7b 63 6f 6e 73 74 20 65 3d );if(n){const e=
0000f010: 6c 2e 66 69 6e 64 28 28 65 3d 3e 65 2e 69 6e 64 l.find((e=>e.ind
0000f020: 65 78 3d 3d 3d 6e 29 29 3b 69 66 28 65 29 7b 63 ex===n));if(e){c
0000f030: 6f 6e 73 74 20 74 3d 6c 5b 6c 2e 69 6e 64 65 78 onst t=l[l.index
0000f040: 4f 66 28 65 29 2b 31 5d 3b 73 3d 74 3f 42 6f 28 Of(e)+1];s=t?Bo(
0000f050: 6e 2c 74 2e 69 6e 64 65 78 2c 72 2e 6c 65 6e 67 n,t.index,r.leng
0000f060: 74 68 29 3a 55 6f 28 6e 2c 72 2e 6c 65 6e 67 74 th):Uo(n,r.lengt
0000f070: 68 29 7d 65 6c 73 65 7b 63 6f 6e 73 74 20 65 3d h)}else{const e=
0000f080: 6c 2e 73 6f 72 74 28 56 6f 29 2e 66 69 6e 64 28 l.sort(Vo).find(
0000f090: 28 65 3d 3e 65 2e 69 6e 64 65 78 3e 6e 29 29 3b (e=>e.index>n));
0000f0a0: 73 3d 65 3f 42 6f 28 6e 2c 65 2e 69 6e 64 65 78 s=e?Bo(n,e.index
0000f0b0: 2c 72 2e 6c 65 6e 67 74 68 29 3a 55 6f 28 6e 2c ,r.length):Uo(n,
0000f0c0: 72 2e 6c 65 6e 67 74 68 29 7d 7d 65 6c 73 65 7b r.length)}}else{
0000f0d0: 63 6f 6e 73 74 20 65 3d 6c 2e 6c 65 6e 67 74 68 const e=l.length
0000f0e0: 26 26 6c 5b 6c 2e 6c 65 6e 67 74 68 2d 31 5d 3b &&l[l.length-1];
0000f0f0: 73 3d 65 3f 55 6f 28 65 2e 69 6e 64 65 78 2c 72 s=e?Uo(e.index,r
0000f100: 2e 6c 65 6e 67 74 68 29 3a 48 6f 28 72 2e 6c 65 .length):Ho(r.le
0000f110: 6e 67 74 68 29 7d 63 6f 6e 73 74 20 63 3d 69 2e ngth)}const c=i.
0000f120: 63 6c 6f 6e 65 28 29 2e 69 6e 76 65 72 74 28 29 clone().invert()
0000f130: 2c 75 3d 6a 72 28 72 2e 6d 61 70 28 28 65 3d 3e ,u=jr(r.map((e=>
0000f140: 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 this.getShape(e)
0000f150: 29 29 29 2c 64 3d 75 2e 66 69 6c 74 65 72 28 28 ))),d=u.filter((
0000f160: 65 3d 3e 65 2e 69 73 4c 6f 63 6b 65 64 29 29 3b e=>e.isLocked));
0000f170: 64 2e 6c 65 6e 67 74 68 26 26 74 68 69 73 2e 75 d.length&&this.u
0000f180: 70 64 61 74 65 53 68 61 70 65 73 28 64 2e 6d 61 pdateShapes(d.ma
0000f190: 70 28 28 28 7b 69 64 3a 65 2c 74 79 70 65 3a 74 p((({id:e,type:t
0000f1a0: 7d 29 3d 3e 28 7b 69 64 3a 65 2c 74 79 70 65 3a })=>({id:e,type:
0000f1b0: 74 2c 69 73 4c 6f 63 6b 65 64 3a 21 31 7d 29 29 t,isLocked:!1}))
0000f1c0: 29 29 3b 66 6f 72 28 6c 65 74 20 65 3d 30 3b 65 ));for(let e=0;e
0000f1d0: 3c 75 2e 6c 65 6e 67 74 68 3b 65 2b 2b 29 7b 63 <u.length;e++){c
0000f1e0: 6f 6e 73 74 20 6e 3d 75 5b 65 5d 2c 72 3d 74 68 onst n=u[e],r=th
0000f1f0: 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 is.getShapePageT
0000f200: 72 61 6e 73 66 6f 72 6d 28 6e 29 3b 69 66 28 21 ransform(n);if(!
0000f210: 72 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 r)continue;const
0000f220: 20 69 3d 72 2e 70 6f 69 6e 74 28 29 3b 69 66 28 i=r.point();if(
0000f230: 21 69 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 !i)continue;cons
0000f240: 74 20 6c 3d 63 2e 61 70 70 6c 79 54 6f 50 6f 69 t l=c.applyToPoi
0000f250: 6e 74 28 69 29 2c 64 3d 72 2e 72 6f 74 61 74 69 nt(i),d=r.rotati
0000f260: 6f 6e 28 29 2d 61 3b 6f 2e 70 75 73 68 28 7b 69 on()-a;o.push({i
0000f270: 64 3a 6e 2e 69 64 2c 74 79 70 65 3a 6e 2e 74 79 d:n.id,type:n.ty
0000f280: 70 65 2c 70 61 72 65 6e 74 49 64 3a 74 2c 78 3a pe,parentId:t,x:
0000f290: 6c 2e 78 2c 79 3a 6c 2e 79 2c 72 6f 74 61 74 69 l.x,y:l.y,rotati
0000f2a0: 6f 6e 3a 64 2c 69 6e 64 65 78 3a 73 5b 65 5d 2c on:d,index:s[e],
0000f2b0: 69 73 4c 6f 63 6b 65 64 3a 6e 2e 69 73 4c 6f 63 isLocked:n.isLoc
0000f2c0: 6b 65 64 7d 29 7d 72 65 74 75 72 6e 20 74 68 69 ked})}return thi
0000f2d0: 73 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 6f s.updateShapes(o
0000f2e0: 29 2c 74 68 69 73 7d 67 65 74 48 69 67 68 65 73 ),this}getHighes
0000f2f0: 74 49 6e 64 65 78 46 6f 72 50 61 72 65 6e 74 28 tIndexForParent(
0000f300: 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 e){const t="stri
0000f310: 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a ng"==typeof e?e:
0000f320: 65 2e 69 64 2c 6e 3d 74 68 69 73 2e 5f 70 61 72 e.id,n=this._par
0000f330: 65 6e 74 49 64 73 54 6f 43 68 69 6c 64 49 64 73 entIdsToChildIds
0000f340: 2e 67 65 74 28 29 5b 74 5d 3b 69 66 28 21 6e 7c .get()[t];if(!n|
0000f350: 7c 30 3d 3d 3d 6e 2e 6c 65 6e 67 74 68 29 72 65 |0===n.length)re
0000f360: 74 75 72 6e 22 61 31 22 3b 72 65 74 75 72 6e 20 turn"a1";return
0000f370: 47 6f 28 74 68 69 73 2e 67 65 74 53 68 61 70 65 Go(this.getShape
0000f380: 28 6e 5b 6e 2e 6c 65 6e 67 74 68 2d 31 5d 29 2e (n[n.length-1]).
0000f390: 69 6e 64 65 78 29 7d 67 65 74 53 6f 72 74 65 64 index)}getSorted
0000f3a0: 43 68 69 6c 64 49 64 73 46 6f 72 50 61 72 65 6e ChildIdsForParen
0000f3b0: 74 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 t(e){const t="st
0000f3c0: 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f ring"==typeof e?
0000f3d0: 65 3a 65 2e 69 64 2c 6e 3d 74 68 69 73 2e 5f 70 e:e.id,n=this._p
0000f3e0: 61 72 65 6e 74 49 64 73 54 6f 43 68 69 6c 64 49 arentIdsToChildI
0000f3f0: 64 73 2e 67 65 74 28 29 5b 74 5d 3b 72 65 74 75 ds.get()[t];retu
0000f400: 72 6e 20 6e 7c 7c 43 69 7d 76 69 73 69 74 44 65 rn n||Ci}visitDe
0000f410: 73 63 65 6e 64 61 6e 74 73 28 65 2c 74 29 7b 63 scendants(e,t){c
0000f420: 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 3d onst n="string"=
0000f430: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
0000f440: 2c 72 3d 74 68 69 73 2e 67 65 74 53 6f 72 74 65 ,r=this.getSorte
0000f450: 64 43 68 69 6c 64 49 64 73 46 6f 72 50 61 72 65 dChildIdsForPare
0000f460: 6e 74 28 6e 29 3b 66 6f 72 28 63 6f 6e 73 74 20 nt(n);for(const
0000f470: 65 20 6f 66 20 72 29 21 31 21 3d 3d 74 28 65 29 e of r)!1!==t(e)
0000f480: 26 26 74 68 69 73 2e 76 69 73 69 74 44 65 73 63 &&this.visitDesc
0000f490: 65 6e 64 61 6e 74 73 28 65 2c 74 29 3b 72 65 74 endants(e,t);ret
0000f4a0: 75 72 6e 20 74 68 69 73 7d 67 65 74 53 68 61 70 urn this}getShap
0000f4b0: 65 41 6e 64 44 65 73 63 65 6e 64 61 6e 74 49 64 eAndDescendantId
0000f4c0: 73 28 65 29 7b 63 6f 6e 73 74 20 74 3d 6e 65 77 s(e){const t=new
0000f4d0: 20 53 65 74 3b 66 6f 72 28 63 6f 6e 73 74 20 6e Set;for(const n
0000f4e0: 20 6f 66 20 65 2e 6d 61 70 28 28 65 3d 3e 74 68 of e.map((e=>th
0000f4f0: 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 is.getShape(e)))
0000f500: 2e 73 6f 72 74 28 56 6f 29 29 74 2e 61 64 64 28 .sort(Vo))t.add(
0000f510: 6e 2e 69 64 29 2c 74 68 69 73 2e 76 69 73 69 74 n.id),this.visit
0000f520: 44 65 73 63 65 6e 64 61 6e 74 73 28 6e 2c 28 65 Descendants(n,(e
0000f530: 3d 3e 7b 74 2e 61 64 64 28 65 29 7d 29 29 3b 72 =>{t.add(e)}));r
0000f540: 65 74 75 72 6e 20 74 7d 67 65 74 44 72 6f 70 70 eturn t}getDropp
0000f550: 69 6e 67 4f 76 65 72 53 68 61 70 65 28 65 2c 74 ingOverShape(e,t
0000f560: 3d 5b 5d 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 =[]){const n=thi
0000f570: 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 s.getCurrentPage
0000f580: 53 68 61 70 65 73 53 6f 72 74 65 64 28 29 3b 66 ShapesSorted();f
0000f590: 6f 72 28 6c 65 74 20 72 3d 6e 2e 6c 65 6e 67 74 or(let r=n.lengt
0000f5a0: 68 2d 31 3b 72 3e 3d 30 3b 72 2d 2d 29 7b 63 6f h-1;r>=0;r--){co
0000f5b0: 6e 73 74 20 6f 3d 6e 5b 72 5d 3b 69 66 28 74 68 nst o=n[r];if(th
0000f5c0: 69 73 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 is.getSelectedSh
0000f5d0: 61 70 65 49 64 73 28 29 2e 69 6e 63 6c 75 64 65 apeIds().include
0000f5e0: 73 28 6f 2e 69 64 29 7c 7c 21 74 68 69 73 2e 67 s(o.id)||!this.g
0000f5f0: 65 74 53 68 61 70 65 55 74 69 6c 28 6f 29 2e 63 etShapeUtil(o).c
0000f600: 61 6e 44 72 6f 70 53 68 61 70 65 73 28 6f 2c 74 anDropShapes(o,t
0000f610: 29 7c 7c 74 2e 66 69 6e 64 28 28 65 3d 3e 65 2e )||t.find((e=>e.
0000f620: 69 64 3d 3d 3d 6f 2e 69 64 7c 7c 74 68 69 73 2e id===o.id||this.
0000f630: 68 61 73 41 6e 63 65 73 74 6f 72 28 6f 2c 65 2e hasAncestor(o,e.
0000f640: 69 64 29 29 29 29 63 6f 6e 74 69 6e 75 65 3b 63 id))))continue;c
0000f650: 6f 6e 73 74 20 69 3d 74 68 69 73 2e 67 65 74 53 onst i=this.getS
0000f660: 68 61 70 65 4d 61 73 6b 65 64 50 61 67 65 42 6f hapeMaskedPageBo
0000f670: 75 6e 64 73 28 6f 2e 69 64 29 3b 69 66 28 69 26 unds(o.id);if(i&
0000f680: 26 69 2e 63 6f 6e 74 61 69 6e 73 50 6f 69 6e 74 &i.containsPoint
0000f690: 28 65 29 26 26 74 68 69 73 2e 67 65 74 53 68 61 (e)&&this.getSha
0000f6a0: 70 65 47 65 6f 6d 65 74 72 79 28 6f 29 2e 68 69 peGeometry(o).hi
0000f6b0: 74 54 65 73 74 50 6f 69 6e 74 28 74 68 69 73 2e tTestPoint(this.
0000f6c0: 67 65 74 50 6f 69 6e 74 49 6e 53 68 61 70 65 53 getPointInShapeS
0000f6d0: 70 61 63 65 28 6f 2c 65 29 2c 30 2c 21 30 29 29 pace(o,e),0,!0))
0000f6e0: 72 65 74 75 72 6e 20 6f 7d 7d 67 65 74 4f 75 74 return o}}getOut
0000f6f0: 65 72 6d 6f 73 74 53 65 6c 65 63 74 61 62 6c 65 ermostSelectable
0000f700: 53 68 61 70 65 28 65 2c 74 29 7b 63 6f 6e 73 74 Shape(e,t){const
0000f710: 20 6e 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 n="string"==typ
0000f720: 65 6f 66 20 65 3f 65 3a 65 2e 69 64 2c 72 3d 74 eof e?e:e.id,r=t
0000f730: 68 69 73 2e 67 65 74 53 68 61 70 65 28 6e 29 3b his.getShape(n);
0000f740: 6c 65 74 20 6f 3d 72 2c 69 3d 72 3b 63 6f 6e 73 let o=r,i=r;cons
0000f750: 74 20 61 3d 74 68 69 73 2e 67 65 74 46 6f 63 75 t a=this.getFocu
0000f760: 73 65 64 47 72 6f 75 70 28 29 3b 66 6f 72 28 3b sedGroup();for(;
0000f770: 69 3b 29 7b 69 66 28 74 68 69 73 2e 69 73 53 68 i;){if(this.isSh
0000f780: 61 70 65 4f 66 54 79 70 65 28 69 2c 22 67 72 6f apeOfType(i,"gro
0000f790: 75 70 22 29 26 26 61 3f 2e 69 64 21 3d 3d 69 2e up")&&a?.id!==i.
0000f7a0: 69 64 26 26 21 74 68 69 73 2e 68 61 73 41 6e 63 id&&!this.hasAnc
0000f7b0: 65 73 74 6f 72 28 61 2c 69 2e 69 64 29 26 26 28 estor(a,i.id)&&(
0000f7c0: 74 3f 2e 28 69 29 3f 3f 31 29 29 6f 3d 69 3b 65 t?.(i)??1))o=i;e
0000f7d0: 6c 73 65 20 69 66 28 61 3f 2e 69 64 3d 3d 3d 69 lse if(a?.id===i
0000f7e0: 2e 69 64 29 62 72 65 61 6b 3b 69 3d 74 68 69 73 .id)break;i=this
0000f7f0: 2e 67 65 74 53 68 61 70 65 50 61 72 65 6e 74 28 .getShapeParent(
0000f800: 69 29 7d 72 65 74 75 72 6e 20 6f 7d 5f 67 65 74 i)}return o}_get
0000f810: 42 69 6e 64 69 6e 67 73 49 6e 64 65 78 43 61 63 BindingsIndexCac
0000f820: 68 65 28 29 7b 63 6f 6e 73 74 20 65 3d 28 65 3d he(){const e=(e=
0000f830: 3e 7b 63 6f 6e 73 74 7b 73 74 6f 72 65 3a 74 7d >{const{store:t}
0000f840: 3d 65 2c 6e 3d 74 2e 71 75 65 72 79 2e 66 69 6c =e,n=t.query.fil
0000f850: 74 65 72 48 69 73 74 6f 72 79 28 22 62 69 6e 64 terHistory("bind
0000f860: 69 6e 67 22 29 2c 72 3d 74 2e 71 75 65 72 79 2e ing"),r=t.query.
0000f870: 72 65 63 6f 72 64 73 28 22 62 69 6e 64 69 6e 67 records("binding
0000f880: 22 29 3b 66 75 6e 63 74 69 6f 6e 20 6f 28 29 7b ");function o(){
0000f890: 63 6f 6e 73 74 20 65 3d 72 2e 67 65 74 28 29 2c const e=r.get(),
0000f8a0: 74 3d 6e 65 77 20 4d 61 70 3b 66 6f 72 28 63 6f t=new Map;for(co
0000f8b0: 6e 73 74 20 6e 20 6f 66 20 65 29 7b 63 6f 6e 73 nst n of e){cons
0000f8c0: 74 7b 66 72 6f 6d 49 64 3a 65 2c 74 6f 49 64 3a t{fromId:e,toId:
0000f8d0: 72 7d 3d 6e 2c 6f 3d 74 2e 67 65 74 28 65 29 3b r}=n,o=t.get(e);
0000f8e0: 6f 3f 6f 2e 70 75 73 68 28 6e 29 3a 74 2e 73 65 o?o.push(n):t.se
0000f8f0: 74 28 65 2c 5b 6e 5d 29 3b 63 6f 6e 73 74 20 69 t(e,[n]);const i
0000f900: 3d 74 2e 67 65 74 28 72 29 3b 69 3f 69 2e 70 75 =t.get(r);i?i.pu
0000f910: 73 68 28 6e 29 3a 74 2e 73 65 74 28 72 2c 5b 6e sh(n):t.set(r,[n
0000f920: 5d 29 7d 72 65 74 75 72 6e 20 74 7d 72 65 74 75 ])}return t}retu
0000f930: 72 6e 20 6f 61 28 22 61 72 72 6f 77 42 69 6e 64 rn oa("arrowBind
0000f940: 69 6e 67 73 49 6e 64 65 78 22 2c 28 28 65 2c 74 ingsIndex",((e,t
0000f950: 29 3d 3e 7b 69 66 28 51 69 28 65 29 29 72 65 74 )=>{if(Qi(e))ret
0000f960: 75 72 6e 20 6f 28 29 3b 63 6f 6e 73 74 20 72 3d urn o();const r=
0000f970: 65 2c 69 3d 6e 2e 67 65 74 44 69 66 66 53 69 6e e,i=n.getDiffSin
0000f980: 63 65 28 74 29 3b 69 66 28 69 3d 3d 3d 41 69 29 ce(t);if(i===Ai)
0000f990: 72 65 74 75 72 6e 20 6f 28 29 3b 6c 65 74 20 61 return o();let a
0000f9a0: 3b 66 75 6e 63 74 69 6f 6e 20 73 28 65 29 7b 61 ;function s(e){a
0000f9b0: 3f 3f 3d 6e 65 77 20 4d 61 70 28 72 29 3b 63 6f ??=new Map(r);co
0000f9c0: 6e 73 74 20 74 3d 61 2e 67 65 74 28 65 2e 66 72 nst t=a.get(e.fr
0000f9d0: 6f 6d 49 64 29 3f 2e 66 69 6c 74 65 72 28 28 74 omId)?.filter((t
0000f9e0: 3d 3e 74 2e 69 64 21 3d 3d 65 2e 69 64 29 29 3b =>t.id!==e.id));
0000f9f0: 74 3f 2e 6c 65 6e 67 74 68 3f 61 2e 73 65 74 28 t?.length?a.set(
0000fa00: 65 2e 66 72 6f 6d 49 64 2c 74 29 3a 61 2e 64 65 e.fromId,t):a.de
0000fa10: 6c 65 74 65 28 65 2e 66 72 6f 6d 49 64 29 3b 63 lete(e.fromId);c
0000fa20: 6f 6e 73 74 20 6e 3d 61 2e 67 65 74 28 65 2e 74 onst n=a.get(e.t
0000fa30: 6f 49 64 29 3f 2e 66 69 6c 74 65 72 28 28 74 3d oId)?.filter((t=
0000fa40: 3e 74 2e 69 64 21 3d 3d 65 2e 69 64 29 29 3b 6e >t.id!==e.id));n
0000fa50: 3f 2e 6c 65 6e 67 74 68 3f 61 2e 73 65 74 28 65 ?.length?a.set(e
0000fa60: 2e 74 6f 49 64 2c 6e 29 3a 61 2e 64 65 6c 65 74 .toId,n):a.delet
0000fa70: 65 28 65 2e 74 6f 49 64 29 7d 66 75 6e 63 74 69 e(e.toId)}functi
0000fa80: 6f 6e 20 6c 28 65 29 7b 61 3f 3f 3d 6e 65 77 20 on l(e){a??=new
0000fa90: 4d 61 70 28 72 29 3b 6c 65 74 20 74 3d 61 2e 67 Map(r);let t=a.g
0000faa0: 65 74 28 65 29 3b 72 65 74 75 72 6e 20 74 3f 74 et(e);return t?t
0000fab0: 3d 3d 3d 72 2e 67 65 74 28 65 29 26 26 28 74 3d ===r.get(e)&&(t=
0000fac0: 74 2e 73 6c 69 63 65 28 30 29 2c 61 2e 73 65 74 t.slice(0),a.set
0000fad0: 28 65 2c 74 29 29 3a 28 74 3d 5b 5d 2c 61 2e 73 (e,t)):(t=[],a.s
0000fae0: 65 74 28 65 2c 74 29 29 2c 74 7d 66 75 6e 63 74 et(e,t)),t}funct
0000faf0: 69 6f 6e 20 63 28 65 29 7b 6c 28 65 2e 66 72 6f ion c(e){l(e.fro
0000fb00: 6d 49 64 29 2e 70 75 73 68 28 65 29 2c 6c 28 65 mId).push(e),l(e
0000fb10: 2e 74 6f 49 64 29 2e 70 75 73 68 28 65 29 7d 66 .toId).push(e)}f
0000fb20: 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 69 29 or(const e of i)
0000fb30: 7b 66 6f 72 28 63 6f 6e 73 74 20 74 20 6f 66 20 {for(const t of
0000fb40: 53 6f 28 65 2e 61 64 64 65 64 29 29 63 28 74 29 So(e.added))c(t)
0000fb50: 3b 66 6f 72 28 63 6f 6e 73 74 5b 74 2c 6e 5d 6f ;for(const[t,n]o
0000fb60: 66 20 53 6f 28 65 2e 75 70 64 61 74 65 64 29 29 f So(e.updated))
0000fb70: 73 28 74 29 2c 63 28 6e 29 3b 66 6f 72 28 63 6f s(t),c(n);for(co
0000fb80: 6e 73 74 20 74 20 6f 66 20 53 6f 28 65 2e 72 65 nst t of So(e.re
0000fb90: 6d 6f 76 65 64 29 29 73 28 74 29 7d 72 65 74 75 moved))s(t)}retu
0000fba0: 72 6e 20 61 3f 3f 72 7d 29 29 7d 29 28 74 68 69 rn a??r}))})(thi
0000fbb0: 73 29 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 s);return this.s
0000fbc0: 74 6f 72 65 2e 63 72 65 61 74 65 43 6f 6d 70 75 tore.createCompu
0000fbd0: 74 65 64 43 61 63 68 65 28 22 62 69 6e 64 69 6e tedCache("bindin
0000fbe0: 67 73 49 6e 64 65 78 22 2c 28 74 3d 3e 65 2e 67 gsIndex",(t=>e.g
0000fbf0: 65 74 28 29 2e 67 65 74 28 74 2e 69 64 29 29 29 et().get(t.id)))
0000fc00: 7d 67 65 74 42 69 6e 64 69 6e 67 28 65 29 7b 72 }getBinding(e){r
0000fc10: 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 eturn this.store
0000fc20: 2e 67 65 74 28 65 29 7d 67 65 74 42 69 6e 64 69 .get(e)}getBindi
0000fc30: 6e 67 73 46 72 6f 6d 53 68 61 70 65 28 65 2c 74 ngsFromShape(e,t
0000fc40: 29 7b 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e ){const n="strin
0000fc50: 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 g"==typeof e?e:e
0000fc60: 2e 69 64 3b 72 65 74 75 72 6e 20 74 68 69 73 2e .id;return this.
0000fc70: 67 65 74 42 69 6e 64 69 6e 67 73 49 6e 76 6f 6c getBindingsInvol
0000fc80: 76 69 6e 67 53 68 61 70 65 28 6e 29 2e 66 69 6c vingShape(n).fil
0000fc90: 74 65 72 28 28 65 3d 3e 65 2e 66 72 6f 6d 49 64 ter((e=>e.fromId
0000fca0: 3d 3d 3d 6e 26 26 65 2e 74 79 70 65 3d 3d 3d 74 ===n&&e.type===t
0000fcb0: 29 29 7d 67 65 74 42 69 6e 64 69 6e 67 73 54 6f ))}getBindingsTo
0000fcc0: 53 68 61 70 65 28 65 2c 74 29 7b 63 6f 6e 73 74 Shape(e,t){const
0000fcd0: 20 6e 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 n="string"==typ
0000fce0: 65 6f 66 20 65 3f 65 3a 65 2e 69 64 3b 72 65 74 eof e?e:e.id;ret
0000fcf0: 75 72 6e 20 74 68 69 73 2e 67 65 74 42 69 6e 64 urn this.getBind
0000fd00: 69 6e 67 73 49 6e 76 6f 6c 76 69 6e 67 53 68 61 ingsInvolvingSha
0000fd10: 70 65 28 6e 29 2e 66 69 6c 74 65 72 28 28 65 3d pe(n).filter((e=
0000fd20: 3e 65 2e 74 6f 49 64 3d 3d 3d 6e 26 26 65 2e 74 >e.toId===n&&e.t
0000fd30: 79 70 65 3d 3d 3d 74 29 29 7d 67 65 74 42 69 6e ype===t))}getBin
0000fd40: 64 69 6e 67 73 49 6e 76 6f 6c 76 69 6e 67 53 68 dingsInvolvingSh
0000fd50: 61 70 65 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e ape(e,t){const n
0000fd60: 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ="string"==typeo
0000fd70: 66 20 65 3f 65 3a 65 2e 69 64 2c 72 3d 74 68 69 f e?e:e.id,r=thi
0000fd80: 73 2e 5f 67 65 74 42 69 6e 64 69 6e 67 73 49 6e s._getBindingsIn
0000fd90: 64 65 78 43 61 63 68 65 28 29 2e 67 65 74 28 6e dexCache().get(n
0000fda0: 29 3f 3f 43 69 3b 72 65 74 75 72 6e 20 74 3f 72 )??Ci;return t?r
0000fdb0: 2e 66 69 6c 74 65 72 28 28 65 3d 3e 65 2e 74 79 .filter((e=>e.ty
0000fdc0: 70 65 3d 3d 3d 74 29 29 3a 72 7d 63 72 65 61 74 pe===t)):r}creat
0000fdd0: 65 42 69 6e 64 69 6e 67 73 28 65 29 7b 63 6f 6e eBindings(e){con
0000fde0: 73 74 20 74 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 st t=[];for(cons
0000fdf0: 74 20 6e 20 6f 66 20 65 29 7b 63 6f 6e 73 74 20 t n of e){const
0000fe00: 65 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 e=this.getShape(
0000fe10: 6e 2e 66 72 6f 6d 49 64 29 2c 72 3d 74 68 69 73 n.fromId),r=this
0000fe20: 2e 67 65 74 53 68 61 70 65 28 6e 2e 74 6f 49 64 .getShape(n.toId
0000fe30: 29 3b 69 66 28 21 65 7c 7c 21 72 29 63 6f 6e 74 );if(!e||!r)cont
0000fe40: 69 6e 75 65 3b 69 66 28 21 74 68 69 73 2e 63 61 inue;if(!this.ca
0000fe50: 6e 42 69 6e 64 53 68 61 70 65 73 28 7b 66 72 6f nBindShapes({fro
0000fe60: 6d 53 68 61 70 65 3a 65 2c 74 6f 53 68 61 70 65 mShape:e,toShape
0000fe70: 3a 72 2c 62 69 6e 64 69 6e 67 3a 6e 7d 29 29 63 :r,binding:n}))c
0000fe80: 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 6f 3d ontinue;const o=
0000fe90: 74 68 69 73 2e 67 65 74 42 69 6e 64 69 6e 67 55 this.getBindingU
0000fea0: 74 69 6c 28 6e 2e 74 79 70 65 29 2e 67 65 74 44 til(n.type).getD
0000feb0: 65 66 61 75 6c 74 50 72 6f 70 73 28 29 2c 69 3d efaultProps(),i=
0000fec0: 74 68 69 73 2e 73 74 6f 72 65 2e 73 63 68 65 6d this.store.schem
0000fed0: 61 2e 74 79 70 65 73 2e 62 69 6e 64 69 6e 67 2e a.types.binding.
0000fee0: 63 72 65 61 74 65 28 7b 2e 2e 2e 6e 2c 69 64 3a create({...n,id:
0000fef0: 6e 2e 69 64 3f 3f 5f 73 28 29 2c 70 72 6f 70 73 n.id??_s(),props
0000ff00: 3a 7b 2e 2e 2e 6f 2c 2e 2e 2e 6e 2e 70 72 6f 70 :{...o,...n.prop
0000ff10: 73 7d 7d 29 3b 74 2e 70 75 73 68 28 69 29 7d 72 s}});t.push(i)}r
0000ff20: 65 74 75 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 eturn this.store
0000ff30: 2e 70 75 74 28 74 29 2c 74 68 69 73 7d 63 72 65 .put(t),this}cre
0000ff40: 61 74 65 42 69 6e 64 69 6e 67 28 65 29 7b 72 65 ateBinding(e){re
0000ff50: 74 75 72 6e 20 74 68 69 73 2e 63 72 65 61 74 65 turn this.create
0000ff60: 42 69 6e 64 69 6e 67 73 28 5b 65 5d 29 7d 75 70 Bindings([e])}up
0000ff70: 64 61 74 65 42 69 6e 64 69 6e 67 73 28 65 29 7b dateBindings(e){
0000ff80: 63 6f 6e 73 74 20 74 3d 5b 5d 3b 66 6f 72 28 63 const t=[];for(c
0000ff90: 6f 6e 73 74 20 6e 20 6f 66 20 65 29 7b 69 66 28 onst n of e){if(
0000ffa0: 21 6e 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 !n)continue;cons
0000ffb0: 74 20 65 3d 74 68 69 73 2e 67 65 74 42 69 6e 64 t e=this.getBind
0000ffc0: 69 6e 67 28 6e 2e 69 64 29 3b 69 66 28 21 65 29 ing(n.id);if(!e)
0000ffd0: 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 72 continue;const r
0000ffe0: 3d 7a 6d 28 65 2c 6e 29 3b 69 66 28 72 3d 3d 3d =zm(e,n);if(r===
0000fff0: 65 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 e)continue;const
00010000: 20 6f 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 o=this.getShape
00010010: 28 72 2e 66 72 6f 6d 49 64 29 2c 69 3d 74 68 69 (r.fromId),i=thi
00010020: 73 2e 67 65 74 53 68 61 70 65 28 72 2e 74 6f 49 s.getShape(r.toI
00010030: 64 29 3b 6f 26 26 69 26 26 28 74 68 69 73 2e 63 d);o&&i&&(this.c
00010040: 61 6e 42 69 6e 64 53 68 61 70 65 73 28 7b 66 72 anBindShapes({fr
00010050: 6f 6d 53 68 61 70 65 3a 6f 2c 74 6f 53 68 61 70 omShape:o,toShap
00010060: 65 3a 69 2c 62 69 6e 64 69 6e 67 3a 72 7d 29 26 e:i,binding:r})&
00010070: 26 74 2e 70 75 73 68 28 72 29 29 7d 72 65 74 75 &t.push(r))}retu
00010080: 72 6e 20 74 68 69 73 2e 73 74 6f 72 65 2e 70 75 rn this.store.pu
00010090: 74 28 74 29 2c 74 68 69 73 7d 75 70 64 61 74 65 t(t),this}update
000100a0: 42 69 6e 64 69 6e 67 28 65 29 7b 72 65 74 75 72 Binding(e){retur
000100b0: 6e 20 74 68 69 73 2e 75 70 64 61 74 65 42 69 6e n this.updateBin
000100c0: 64 69 6e 67 73 28 5b 65 5d 29 7d 64 65 6c 65 74 dings([e])}delet
000100d0: 65 42 69 6e 64 69 6e 67 73 28 65 2c 7b 69 73 6f eBindings(e,{iso
000100e0: 6c 61 74 65 53 68 61 70 65 73 3a 74 3d 21 31 7d lateShapes:t=!1}
000100f0: 3d 7b 7d 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e 6d ={}){const n=e.m
00010100: 61 70 28 28 65 3d 3e 22 73 74 72 69 6e 67 22 3d ap((e=>"string"=
00010110: 3d 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 =typeof e?e:e.id
00010120: 29 29 3b 72 65 74 75 72 6e 20 74 3f 74 68 69 73 ));return t?this
00010130: 2e 73 74 6f 72 65 2e 61 74 6f 6d 69 63 28 28 28 .store.atomic(((
00010140: 29 3d 3e 7b 66 6f 72 28 63 6f 6e 73 74 20 65 20 )=>{for(const e
00010150: 6f 66 20 6e 29 7b 63 6f 6e 73 74 20 74 3d 74 68 of n){const t=th
00010160: 69 73 2e 67 65 74 42 69 6e 64 69 6e 67 28 65 29 is.getBinding(e)
00010170: 3b 69 66 28 21 74 29 63 6f 6e 74 69 6e 75 65 3b ;if(!t)continue;
00010180: 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 const n=this.get
00010190: 42 69 6e 64 69 6e 67 55 74 69 6c 28 74 29 3b 6e BindingUtil(t);n
000101a0: 2e 6f 6e 42 65 66 6f 72 65 49 73 6f 6c 61 74 65 .onBeforeIsolate
000101b0: 46 72 6f 6d 53 68 61 70 65 3f 2e 28 7b 62 69 6e FromShape?.({bin
000101c0: 64 69 6e 67 3a 74 2c 72 65 6d 6f 76 65 64 53 68 ding:t,removedSh
000101d0: 61 70 65 3a 74 68 69 73 2e 67 65 74 53 68 61 70 ape:this.getShap
000101e0: 65 28 74 2e 74 6f 49 64 29 7d 29 2c 6e 2e 6f 6e e(t.toId)}),n.on
000101f0: 42 65 66 6f 72 65 49 73 6f 6c 61 74 65 54 6f 53 BeforeIsolateToS
00010200: 68 61 70 65 3f 2e 28 7b 62 69 6e 64 69 6e 67 3a hape?.({binding:
00010210: 74 2c 72 65 6d 6f 76 65 64 53 68 61 70 65 3a 74 t,removedShape:t
00010220: 68 69 73 2e 67 65 74 53 68 61 70 65 28 74 2e 66 his.getShape(t.f
00010230: 72 6f 6d 49 64 29 7d 29 2c 74 68 69 73 2e 73 74 romId)}),this.st
00010240: 6f 72 65 2e 72 65 6d 6f 76 65 28 5b 65 5d 29 7d ore.remove([e])}
00010250: 7d 29 29 3a 74 68 69 73 2e 73 74 6f 72 65 2e 72 })):this.store.r
00010260: 65 6d 6f 76 65 28 6e 29 2c 74 68 69 73 7d 64 65 emove(n),this}de
00010270: 6c 65 74 65 42 69 6e 64 69 6e 67 28 65 2c 74 29 leteBinding(e,t)
00010280: 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 64 65 6c {return this.del
00010290: 65 74 65 42 69 6e 64 69 6e 67 73 28 5b 65 5d 2c eteBindings([e],
000102a0: 74 29 7d 63 61 6e 42 69 6e 64 53 68 61 70 65 73 t)}canBindShapes
000102b0: 28 7b 66 72 6f 6d 53 68 61 70 65 3a 65 2c 74 6f ({fromShape:e,to
000102c0: 53 68 61 70 65 3a 74 2c 62 69 6e 64 69 6e 67 3a Shape:t,binding:
000102d0: 6e 7d 29 7b 63 6f 6e 73 74 20 72 3d 22 73 74 72 n}){const r="str
000102e0: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 3f 65 ing"==typeof e?e
000102f0: 3a 65 2e 74 79 70 65 2c 6f 3d 22 73 74 72 69 6e :e.type,o="strin
00010300: 67 22 3d 3d 74 79 70 65 6f 66 20 74 3f 74 3a 74 g"==typeof t?t:t
00010310: 2e 74 79 70 65 2c 69 3d 7b 66 72 6f 6d 53 68 61 .type,i={fromSha
00010320: 70 65 54 79 70 65 3a 72 2c 74 6f 53 68 61 70 65 peType:r,toShape
00010330: 54 79 70 65 3a 6f 2c 62 69 6e 64 69 6e 67 54 79 Type:o,bindingTy
00010340: 70 65 3a 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 pe:"string"==typ
00010350: 65 6f 66 20 6e 3f 6e 3a 6e 2e 74 79 70 65 7d 3b eof n?n:n.type};
00010360: 72 65 74 75 72 6e 20 72 3d 3d 3d 6f 3f 74 68 69 return r===o?thi
00010370: 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 72 s.getShapeUtil(r
00010380: 29 2e 63 61 6e 42 69 6e 64 28 69 29 3a 74 68 69 ).canBind(i):thi
00010390: 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 72 s.getShapeUtil(r
000103a0: 29 2e 63 61 6e 42 69 6e 64 28 69 29 26 26 74 68 ).canBind(i)&&th
000103b0: 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 is.getShapeUtil(
000103c0: 6f 29 2e 63 61 6e 42 69 6e 64 28 69 29 7d 72 6f o).canBind(i)}ro
000103d0: 74 61 74 65 53 68 61 70 65 73 42 79 28 65 2c 74 tateShapesBy(e,t
000103e0: 29 7b 69 66 28 28 22 73 74 72 69 6e 67 22 3d 3d ){if(("string"==
000103f0: 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e typeof e[0]?e:e.
00010400: 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 29 29 2e map((e=>e.id))).
00010410: 6c 65 6e 67 74 68 3c 3d 30 29 72 65 74 75 72 6e length<=0)return
00010420: 20 74 68 69 73 3b 63 6f 6e 73 74 20 6e 3d 7a 68 this;const n=zh
00010430: 28 7b 65 64 69 74 6f 72 3a 74 68 69 73 7d 29 3b ({editor:this});
00010440: 72 65 74 75 72 6e 20 6e 3f 28 47 68 28 7b 64 65 return n?(Gh({de
00010450: 6c 74 61 3a 74 2c 73 6e 61 70 73 68 6f 74 3a 6e lta:t,snapshot:n
00010460: 2c 65 64 69 74 6f 72 3a 74 68 69 73 2c 73 74 61 ,editor:this,sta
00010470: 67 65 3a 22 6f 6e 65 2d 6f 66 66 22 7d 29 2c 74 ge:"one-off"}),t
00010480: 68 69 73 29 3a 74 68 69 73 7d 67 65 74 43 68 61 his):this}getCha
00010490: 6e 67 65 73 54 6f 54 72 61 6e 73 6c 61 74 65 53 ngesToTranslateS
000104a0: 68 61 70 65 28 65 2c 74 29 7b 6c 65 74 20 6e 3d hape(e,t){let n=
000104b0: 65 3b 63 6f 6e 73 74 20 72 3d 74 68 69 73 2e 67 e;const r=this.g
000104c0: 65 74 53 68 61 70 65 55 74 69 6c 28 65 29 3b 72 etShapeUtil(e);r
000104d0: 65 74 75 72 6e 20 6e 3d 7a 6d 28 6e 2c 72 2e 6f eturn n=zm(n,r.o
000104e0: 6e 54 72 61 6e 73 6c 61 74 65 53 74 61 72 74 3f nTranslateStart?
000104f0: 2e 28 6e 29 3f 3f 76 6f 69 64 20 30 29 2c 6e 3d .(n)??void 0),n=
00010500: 7a 6d 28 6e 2c 7b 69 64 3a 65 2e 69 64 2c 74 79 zm(n,{id:e.id,ty
00010510: 70 65 3a 65 2e 74 79 70 65 2c 78 3a 74 2e 78 2c pe:e.type,x:t.x,
00010520: 79 3a 74 2e 79 7d 29 2c 6e 3d 7a 6d 28 6e 2c 72 y:t.y}),n=zm(n,r
00010530: 2e 6f 6e 54 72 61 6e 73 6c 61 74 65 3f 2e 28 65 .onTranslate?.(e
00010540: 2c 6e 29 3f 3f 76 6f 69 64 20 30 29 2c 6e 3d 7a ,n)??void 0),n=z
00010550: 6d 28 6e 2c 72 2e 6f 6e 54 72 61 6e 73 6c 61 74 m(n,r.onTranslat
00010560: 65 45 6e 64 3f 2e 28 65 2c 6e 29 3f 3f 76 6f 69 eEnd?.(e,n)??voi
00010570: 64 20 30 29 2c 6e 7d 6e 75 64 67 65 53 68 61 70 d 0),n}nudgeShap
00010580: 65 73 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d es(e,t){const n=
00010590: 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 "string"==typeof
000105a0: 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 e[0]?e:e.map((e
000105b0: 3d 3e 65 2e 69 64 29 29 3b 69 66 28 6e 2e 6c 65 =>e.id));if(n.le
000105c0: 6e 67 74 68 3c 3d 30 29 72 65 74 75 72 6e 20 74 ngth<=0)return t
000105d0: 68 69 73 3b 63 6f 6e 73 74 20 72 3d 5b 5d 3b 66 his;const r=[];f
000105e0: 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 6e 29 or(const e of n)
000105f0: 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 {const n=this.ge
00010600: 74 53 68 61 70 65 28 65 29 2c 6f 3d 73 75 2e 46 tShape(e),o=su.F
00010610: 72 6f 6d 28 74 29 2c 69 3d 74 68 69 73 2e 67 65 rom(t),i=this.ge
00010620: 74 53 68 61 70 65 50 61 72 65 6e 74 54 72 61 6e tShapeParentTran
00010630: 73 66 6f 72 6d 28 6e 29 3b 69 26 26 6f 2e 72 6f sform(n);i&&o.ro
00010640: 74 28 2d 69 2e 72 6f 74 61 74 69 6f 6e 28 29 29 t(-i.rotation())
00010650: 2c 72 2e 70 75 73 68 28 74 68 69 73 2e 67 65 74 ,r.push(this.get
00010660: 43 68 61 6e 67 65 73 54 6f 54 72 61 6e 73 6c 61 ChangesToTransla
00010670: 74 65 53 68 61 70 65 28 6e 2c 6f 2e 61 64 64 28 teShape(n,o.add(
00010680: 6e 29 29 29 7d 72 65 74 75 72 6e 20 74 68 69 73 n)))}return this
00010690: 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 72 29 .updateShapes(r)
000106a0: 2c 74 68 69 73 7d 64 75 70 6c 69 63 61 74 65 53 ,this}duplicateS
000106b0: 68 61 70 65 73 28 65 2c 74 29 7b 72 65 74 75 72 hapes(e,t){retur
000106c0: 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 62 n this.history.b
000106d0: 61 74 63 68 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 atch((()=>{const
000106e0: 20 6e 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 n="string"==typ
000106f0: 65 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 eof e[0]?e:e.map
00010700: 28 28 65 3d 3e 65 2e 69 64 29 29 3b 69 66 28 6e ((e=>e.id));if(n
00010710: 2e 6c 65 6e 67 74 68 3c 3d 30 29 72 65 74 75 72 .length<=0)retur
00010720: 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 72 3d 6e n this;const r=n
00010730: 65 77 20 53 65 74 28 6e 29 2c 6f 3d 74 68 69 73 ew Set(n),o=this
00010740: 2e 67 65 74 53 68 61 70 65 41 6e 64 44 65 73 63 .getShapeAndDesc
00010750: 65 6e 64 61 6e 74 49 64 73 28 6e 29 2c 69 3d 5b endantIds(n),i=[
00010760: 2e 2e 2e 6f 5d 2e 72 65 76 65 72 73 65 28 29 2c ...o].reverse(),
00010770: 61 3d 6e 65 77 20 4d 61 70 3b 66 6f 72 28 63 6f a=new Map;for(co
00010780: 6e 73 74 20 65 20 6f 66 20 6f 29 61 2e 73 65 74 nst e of o)a.set
00010790: 28 65 2c 49 73 28 29 29 3b 63 6f 6e 73 74 7b 73 (e,Is());const{s
000107a0: 68 61 70 65 73 54 6f 43 72 65 61 74 65 3a 73 2c hapesToCreate:s,
000107b0: 62 69 6e 64 69 6e 67 73 54 6f 43 72 65 61 74 65 bindingsToCreate
000107c0: 3a 6c 7d 3d 48 6d 28 74 68 69 73 2c 6f 2c 28 65 :l}=Hm(this,o,(e
000107d0: 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 5b 5d 3b 66 6f =>{const n=[];fo
000107e0: 72 28 63 6f 6e 73 74 20 74 20 6f 66 20 65 29 7b r(const t of e){
000107f0: 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 const e=this.get
00010800: 42 69 6e 64 69 6e 67 28 74 29 3b 69 66 28 21 65 Binding(t);if(!e
00010810: 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 )continue;const
00010820: 72 3d 5f 73 28 29 3b 6e 2e 70 75 73 68 28 7b 2e r=_s();n.push({.
00010830: 2e 2e 65 2c 69 64 3a 72 2c 66 72 6f 6d 49 64 3a ..e,id:r,fromId:
00010840: 4b 72 28 61 2e 67 65 74 28 65 2e 66 72 6f 6d 49 Kr(a.get(e.fromI
00010850: 64 29 29 2c 74 6f 49 64 3a 4b 72 28 61 2e 67 65 d)),toId:Kr(a.ge
00010860: 74 28 65 2e 74 6f 49 64 29 29 7d 29 7d 63 6f 6e t(e.toId))})}con
00010870: 73 74 20 6f 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 st o=[];for(cons
00010880: 74 20 65 20 6f 66 20 69 29 7b 63 6f 6e 73 74 20 t e of i){const
00010890: 6e 3d 4b 72 28 61 2e 67 65 74 28 65 29 29 2c 69 n=Kr(a.get(e)),i
000108a0: 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 65 =this.getShape(e
000108b0: 29 3b 69 66 28 21 69 29 63 6f 6e 74 69 6e 75 65 );if(!i)continue
000108c0: 3b 6c 65 74 20 73 3d 30 2c 6c 3d 30 3b 69 66 28 ;let s=0,l=0;if(
000108d0: 74 26 26 72 2e 68 61 73 28 65 29 29 7b 63 6f 6e t&&r.has(e)){con
000108e0: 73 74 20 65 3d 74 68 69 73 2e 67 65 74 53 68 61 st e=this.getSha
000108f0: 70 65 50 61 72 65 6e 74 54 72 61 6e 73 66 6f 72 peParentTransfor
00010900: 6d 28 69 29 2c 6e 3d 6e 65 77 20 73 75 28 74 2e m(i),n=new su(t.
00010910: 78 2c 74 2e 79 29 2e 72 6f 74 28 2d 65 2e 72 6f x,t.y).rot(-e.ro
00010920: 74 61 74 69 6f 6e 28 29 29 3b 73 3d 6e 2e 78 2c tation());s=n.x,
00010930: 6c 3d 6e 2e 79 7d 63 6f 6e 73 74 20 63 3d 69 2e l=n.y}const c=i.
00010940: 70 61 72 65 6e 74 49 64 2c 75 3d 74 68 69 73 2e parentId,u=this.
00010950: 67 65 74 53 6f 72 74 65 64 43 68 69 6c 64 49 64 getSortedChildId
00010960: 73 46 6f 72 50 61 72 65 6e 74 28 63 29 2c 64 3d sForParent(c),d=
00010970: 75 2e 69 6e 64 65 78 4f 66 28 69 2e 69 64 29 2c u.indexOf(i.id),
00010980: 70 3d 75 5b 64 2b 31 5d 2c 66 3d 70 3f 74 68 69 p=u[d+1],f=p?thi
00010990: 73 2e 67 65 74 53 68 61 70 65 28 70 29 3a 6e 75 s.getShape(p):nu
000109a0: 6c 6c 2c 68 3d 66 3f 7a 6f 28 69 2e 69 6e 64 65 ll,h=f?zo(i.inde
000109b0: 78 2c 66 2e 69 6e 64 65 78 29 3a 47 6f 28 69 2e x,f.index):Go(i.
000109c0: 69 6e 64 65 78 29 3b 6f 2e 70 75 73 68 28 7b 2e index);o.push({.
000109d0: 2e 2e 69 2c 69 64 3a 6e 2c 78 3a 69 2e 78 2b 73 ..i,id:n,x:i.x+s
000109e0: 2c 79 3a 69 2e 79 2b 6c 2c 69 6e 64 65 78 3a 68 ,y:i.y+l,index:h
000109f0: 2c 70 61 72 65 6e 74 49 64 3a 61 2e 67 65 74 28 ,parentId:a.get(
00010a00: 69 2e 70 61 72 65 6e 74 49 64 29 3f 3f 69 2e 70 i.parentId)??i.p
00010a10: 61 72 65 6e 74 49 64 7d 29 7d 72 65 74 75 72 6e arentId})}return
00010a20: 7b 73 68 61 70 65 73 54 6f 43 72 65 61 74 65 3a {shapesToCreate:
00010a30: 6f 2c 62 69 6e 64 69 6e 67 73 54 6f 43 72 65 61 o,bindingsToCrea
00010a40: 74 65 3a 6e 7d 7d 29 29 3b 69 66 28 73 2e 6c 65 te:n}}));if(s.le
00010a50: 6e 67 74 68 2b 74 68 69 73 2e 67 65 74 43 75 72 ngth+this.getCur
00010a60: 72 65 6e 74 50 61 67 65 53 68 61 70 65 49 64 73 rentPageShapeIds
00010a70: 28 29 2e 73 69 7a 65 3e 74 68 69 73 2e 6f 70 74 ().size>this.opt
00010a80: 69 6f 6e 73 2e 6d 61 78 53 68 61 70 65 73 50 65 ions.maxShapesPe
00010a90: 72 50 61 67 65 29 55 6d 28 74 68 69 73 29 3b 65 rPage)Um(this);e
00010aa0: 6c 73 65 20 69 66 28 74 68 69 73 2e 63 72 65 61 lse if(this.crea
00010ab0: 74 65 53 68 61 70 65 73 28 73 29 2c 74 68 69 73 teShapes(s),this
00010ac0: 2e 63 72 65 61 74 65 42 69 6e 64 69 6e 67 73 28 .createBindings(
00010ad0: 6c 29 2c 74 68 69 73 2e 73 65 74 53 65 6c 65 63 l),this.setSelec
00010ae0: 74 65 64 53 68 61 70 65 73 28 6a 72 28 6e 2e 6d tedShapes(jr(n.m
00010af0: 61 70 28 28 65 3d 3e 61 2e 67 65 74 28 65 29 29 ap((e=>a.get(e))
00010b00: 29 29 29 2c 76 6f 69 64 20 30 21 3d 3d 74 29 7b ))),void 0!==t){
00010b10: 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 const e=this.get
00010b20: 53 65 6c 65 63 74 69 6f 6e 50 61 67 65 42 6f 75 SelectionPageBou
00010b30: 6e 64 73 28 29 2c 74 3d 74 68 69 73 2e 67 65 74 nds(),t=this.get
00010b40: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
00010b50: 64 73 28 29 3b 65 26 26 21 74 2e 63 6f 6e 74 61 ds();e&&!t.conta
00010b60: 69 6e 73 28 65 29 26 26 74 68 69 73 2e 63 65 6e ins(e)&&this.cen
00010b70: 74 65 72 4f 6e 50 6f 69 6e 74 28 65 2e 63 65 6e terOnPoint(e.cen
00010b80: 74 65 72 2c 7b 61 6e 69 6d 61 74 69 6f 6e 3a 7b ter,{animation:{
00010b90: 64 75 72 61 74 69 6f 6e 3a 74 68 69 73 2e 6f 70 duration:this.op
00010ba0: 74 69 6f 6e 73 2e 61 6e 69 6d 61 74 69 6f 6e 4d tions.animationM
00010bb0: 65 64 69 75 6d 4d 73 7d 7d 29 7d 7d 29 29 2c 74 ediumMs}})}})),t
00010bc0: 68 69 73 7d 6d 6f 76 65 53 68 61 70 65 73 54 6f his}moveShapesTo
00010bd0: 50 61 67 65 28 65 2c 74 29 7b 63 6f 6e 73 74 20 Page(e,t){const
00010be0: 6e 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 n="string"==type
00010bf0: 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 of e[0]?e:e.map(
00010c00: 28 65 3d 3e 65 2e 69 64 29 29 3b 69 66 28 30 3d (e=>e.id));if(0=
00010c10: 3d 3d 6e 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 ==n.length)retur
00010c20: 6e 20 74 68 69 73 3b 69 66 28 74 68 69 73 2e 67 n this;if(this.g
00010c30: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00010c40: 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 74 ).isReadonly)ret
00010c50: 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 72 urn this;const r
00010c60: 3d 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 =this.getCurrent
00010c70: 50 61 67 65 49 64 28 29 3b 69 66 28 74 3d 3d 3d PageId();if(t===
00010c80: 72 29 72 65 74 75 72 6e 20 74 68 69 73 3b 69 66 r)return this;if
00010c90: 28 21 74 68 69 73 2e 73 74 6f 72 65 2e 68 61 73 (!this.store.has
00010ca0: 28 74 29 29 72 65 74 75 72 6e 20 74 68 69 73 3b (t))return this;
00010cb0: 63 6f 6e 73 74 20 6f 3d 74 68 69 73 2e 67 65 74 const o=this.get
00010cc0: 43 6f 6e 74 65 6e 74 46 72 6f 6d 43 75 72 72 65 ContentFromCurre
00010cd0: 6e 74 50 61 67 65 28 6e 29 3b 69 66 28 21 6f 29 ntPage(n);if(!o)
00010ce0: 72 65 74 75 72 6e 20 74 68 69 73 3b 69 66 28 74 return this;if(t
00010cf0: 68 69 73 2e 67 65 74 50 61 67 65 53 68 61 70 65 his.getPageShape
00010d00: 49 64 73 28 74 29 2e 73 69 7a 65 2b 6f 2e 73 68 Ids(t).size+o.sh
00010d10: 61 70 65 73 2e 6c 65 6e 67 74 68 3e 74 68 69 73 apes.length>this
00010d20: 2e 6f 70 74 69 6f 6e 73 2e 6d 61 78 53 68 61 70 .options.maxShap
00010d30: 65 73 50 65 72 50 61 67 65 29 72 65 74 75 72 6e esPerPage)return
00010d40: 20 55 6d 28 74 68 69 73 2c 74 29 2c 74 68 69 73 Um(this,t),this
00010d50: 3b 63 6f 6e 73 74 20 69 3d 74 68 69 73 2e 67 65 ;const i=this.ge
00010d60: 74 43 61 6d 65 72 61 28 29 2e 7a 3b 72 65 74 75 tCamera().z;retu
00010d70: 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e rn this.history.
00010d80: 62 61 74 63 68 28 28 28 29 3d 3e 7b 74 68 69 73 batch((()=>{this
00010d90: 2e 64 65 6c 65 74 65 53 68 61 70 65 73 28 6e 29 .deleteShapes(n)
00010da0: 2c 74 68 69 73 2e 73 65 74 43 75 72 72 65 6e 74 ,this.setCurrent
00010db0: 50 61 67 65 28 74 29 2c 74 68 69 73 2e 73 65 74 Page(t),this.set
00010dc0: 46 6f 63 75 73 65 64 47 72 6f 75 70 28 6e 75 6c FocusedGroup(nul
00010dd0: 6c 29 2c 74 68 69 73 2e 73 65 6c 65 63 74 4e 6f l),this.selectNo
00010de0: 6e 65 28 29 2c 74 68 69 73 2e 70 75 74 43 6f 6e ne(),this.putCon
00010df0: 74 65 6e 74 4f 6e 74 6f 43 75 72 72 65 6e 74 50 tentOntoCurrentP
00010e00: 61 67 65 28 6f 2c 7b 73 65 6c 65 63 74 3a 21 30 age(o,{select:!0
00010e10: 2c 70 72 65 73 65 72 76 65 49 64 73 3a 21 30 2c ,preserveIds:!0,
00010e20: 70 72 65 73 65 72 76 65 50 6f 73 69 74 69 6f 6e preservePosition
00010e30: 3a 21 30 7d 29 2c 74 68 69 73 2e 73 65 74 43 61 :!0}),this.setCa
00010e40: 6d 65 72 61 28 7b 2e 2e 2e 74 68 69 73 2e 67 65 mera({...this.ge
00010e50: 74 43 61 6d 65 72 61 28 29 2c 7a 3a 69 7d 29 2c tCamera(),z:i}),
00010e60: 74 68 69 73 2e 63 65 6e 74 65 72 4f 6e 50 6f 69 this.centerOnPoi
00010e70: 6e 74 28 74 68 69 73 2e 67 65 74 53 65 6c 65 63 nt(this.getSelec
00010e80: 74 69 6f 6e 52 6f 74 61 74 65 64 50 61 67 65 42 tionRotatedPageB
00010e90: 6f 75 6e 64 73 28 29 2e 63 65 6e 74 65 72 29 7d ounds().center)}
00010ea0: 29 29 2c 74 68 69 73 7d 74 6f 67 67 6c 65 4c 6f )),this}toggleLo
00010eb0: 63 6b 28 65 29 7b 63 6f 6e 73 74 20 74 3d 22 73 ck(e){const t="s
00010ec0: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
00010ed0: 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e [0]?e:e.map((e=>
00010ee0: 65 2e 69 64 29 29 3b 69 66 28 74 68 69 73 2e 67 e.id));if(this.g
00010ef0: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00010f00: 29 2e 69 73 52 65 61 64 6f 6e 6c 79 7c 7c 30 3d ).isReadonly||0=
00010f10: 3d 3d 74 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 ==t.length)retur
00010f20: 6e 20 74 68 69 73 3b 6c 65 74 20 6e 3d 21 30 2c n this;let n=!0,
00010f30: 72 3d 21 30 3b 63 6f 6e 73 74 20 6f 3d 5b 5d 3b r=!0;const o=[];
00010f40: 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 74 for(const e of t
00010f50: 29 7b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 ){const t=this.g
00010f60: 65 74 53 68 61 70 65 28 65 29 3b 74 26 26 28 6f etShape(e);t&&(o
00010f70: 2e 70 75 73 68 28 74 29 2c 74 2e 69 73 4c 6f 63 .push(t),t.isLoc
00010f80: 6b 65 64 3f 72 3d 21 31 3a 6e 3d 21 31 29 7d 72 ked?r=!1:n=!1)}r
00010f90: 65 74 75 72 6e 20 74 68 69 73 2e 62 61 74 63 68 eturn this.batch
00010fa0: 28 28 28 29 3d 3e 7b 72 3f 28 74 68 69 73 2e 75 ((()=>{r?(this.u
00010fb0: 70 64 61 74 65 53 68 61 70 65 73 28 6f 2e 6d 61 pdateShapes(o.ma
00010fc0: 70 28 28 65 3d 3e 28 7b 69 64 3a 65 2e 69 64 2c p((e=>({id:e.id,
00010fd0: 74 79 70 65 3a 65 2e 74 79 70 65 2c 69 73 4c 6f type:e.type,isLo
00010fe0: 63 6b 65 64 3a 21 30 7d 29 29 29 29 2c 74 68 69 cked:!0})))),thi
00010ff0: 73 2e 73 65 74 53 65 6c 65 63 74 65 64 53 68 61 s.setSelectedSha
00011000: 70 65 73 28 5b 5d 29 29 3a 6e 3f 74 68 69 73 2e pes([])):n?this.
00011010: 75 70 64 61 74 65 53 68 61 70 65 73 28 6f 2e 6d updateShapes(o.m
00011020: 61 70 28 28 65 3d 3e 28 7b 69 64 3a 65 2e 69 64 ap((e=>({id:e.id
00011030: 2c 74 79 70 65 3a 65 2e 74 79 70 65 2c 69 73 4c ,type:e.type,isL
00011040: 6f 63 6b 65 64 3a 21 31 7d 29 29 29 29 3a 74 68 ocked:!1})))):th
00011050: 69 73 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 is.updateShapes(
00011060: 6f 2e 6d 61 70 28 28 65 3d 3e 28 7b 69 64 3a 65 o.map((e=>({id:e
00011070: 2e 69 64 2c 74 79 70 65 3a 65 2e 74 79 70 65 2c .id,type:e.type,
00011080: 69 73 4c 6f 63 6b 65 64 3a 21 30 7d 29 29 29 29 isLocked:!0}))))
00011090: 7d 29 29 2c 74 68 69 73 7d 73 65 6e 64 54 6f 42 })),this}sendToB
000110a0: 61 63 6b 28 65 29 7b 63 6f 6e 73 74 20 74 3d 55 ack(e){const t=U
000110b0: 68 28 74 68 69 73 2c 22 74 6f 42 61 63 6b 22 2c h(this,"toBack",
000110c0: 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 "string"==typeof
000110d0: 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 e[0]?e:e.map((e
000110e0: 3d 3e 65 2e 69 64 29 29 29 3b 72 65 74 75 72 6e =>e.id)));return
000110f0: 20 74 26 26 74 68 69 73 2e 75 70 64 61 74 65 53 t&&this.updateS
00011100: 68 61 70 65 73 28 74 29 2c 74 68 69 73 7d 73 65 hapes(t),this}se
00011110: 6e 64 42 61 63 6b 77 61 72 64 28 65 29 7b 63 6f ndBackward(e){co
00011120: 6e 73 74 20 74 3d 55 68 28 74 68 69 73 2c 22 62 nst t=Uh(this,"b
00011130: 61 63 6b 77 61 72 64 22 2c 22 73 74 72 69 6e 67 ackward","string
00011140: 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 "==typeof e[0]?e
00011150: 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 :e.map((e=>e.id)
00011160: 29 29 3b 72 65 74 75 72 6e 20 74 26 26 74 68 69 ));return t&&thi
00011170: 73 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 74 s.updateShapes(t
00011180: 29 2c 74 68 69 73 7d 62 72 69 6e 67 46 6f 72 77 ),this}bringForw
00011190: 61 72 64 28 65 29 7b 63 6f 6e 73 74 20 74 3d 55 ard(e){const t=U
000111a0: 68 28 74 68 69 73 2c 22 66 6f 72 77 61 72 64 22 h(this,"forward"
000111b0: 2c 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ,"string"==typeo
000111c0: 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 f e[0]?e:e.map((
000111d0: 65 3d 3e 65 2e 69 64 29 29 29 3b 72 65 74 75 72 e=>e.id)));retur
000111e0: 6e 20 74 26 26 74 68 69 73 2e 75 70 64 61 74 65 n t&&this.update
000111f0: 53 68 61 70 65 73 28 74 29 2c 74 68 69 73 7d 62 Shapes(t),this}b
00011200: 72 69 6e 67 54 6f 46 72 6f 6e 74 28 65 29 7b 63 ringToFront(e){c
00011210: 6f 6e 73 74 20 74 3d 55 68 28 74 68 69 73 2c 22 onst t=Uh(this,"
00011220: 74 6f 46 72 6f 6e 74 22 2c 22 73 74 72 69 6e 67 toFront","string
00011230: 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 "==typeof e[0]?e
00011240: 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 :e.map((e=>e.id)
00011250: 29 29 3b 72 65 74 75 72 6e 20 74 26 26 74 68 69 ));return t&&thi
00011260: 73 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 74 s.updateShapes(t
00011270: 29 2c 74 68 69 73 7d 66 6c 69 70 53 68 61 70 65 ),this}flipShape
00011280: 73 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 22 s(e,t){const n="
00011290: 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 string"==typeof
000112a0: 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d e[0]?e:e.map((e=
000112b0: 3e 65 2e 69 64 29 29 3b 69 66 28 74 68 69 73 2e >e.id));if(this.
000112c0: 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 getInstanceState
000112d0: 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 ().isReadonly)re
000112e0: 74 75 72 6e 20 74 68 69 73 3b 6c 65 74 20 72 3d turn this;let r=
000112f0: 6a 72 28 6e 2e 6d 61 70 28 28 65 3d 3e 74 68 69 jr(n.map((e=>thi
00011300: 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 29 s.getShape(e))))
00011310: 3b 69 66 28 21 72 2e 6c 65 6e 67 74 68 29 72 65 ;if(!r.length)re
00011320: 74 75 72 6e 20 74 68 69 73 3b 72 3d 6a 72 28 72 turn this;r=jr(r
00011330: 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 69 73 .map((e=>this.is
00011340: 53 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 67 ShapeOfType(e,"g
00011350: 72 6f 75 70 22 29 3f 74 68 69 73 2e 67 65 74 53 roup")?this.getS
00011360: 6f 72 74 65 64 43 68 69 6c 64 49 64 73 46 6f 72 ortedChildIdsFor
00011370: 50 61 72 65 6e 74 28 65 2e 69 64 29 2e 6d 61 70 Parent(e.id).map
00011380: 28 28 65 3d 3e 74 68 69 73 2e 67 65 74 53 68 61 ((e=>this.getSha
00011390: 70 65 28 65 29 29 29 3a 65 29 29 2e 66 6c 61 74 pe(e))):e)).flat
000113a0: 28 29 29 3b 63 6f 6e 73 74 20 6f 3d 5f 70 2e 43 ());const o=_p.C
000113b0: 6f 6d 6d 6f 6e 28 6a 72 28 72 2e 6d 61 70 28 28 ommon(jr(r.map((
000113c0: 65 3d 3e 74 68 69 73 2e 67 65 74 53 68 61 70 65 e=>this.getShape
000113d0: 50 61 67 65 42 6f 75 6e 64 73 28 65 29 29 29 29 PageBounds(e))))
000113e0: 29 2e 63 65 6e 74 65 72 3b 72 65 74 75 72 6e 20 ).center;return
000113f0: 74 68 69 73 2e 62 61 74 63 68 28 28 28 29 3d 3e this.batch((()=>
00011400: 7b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 {for(const e of
00011410: 72 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e r){const n=this.
00011420: 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 getShapeGeometry
00011430: 28 65 29 2e 62 6f 75 6e 64 73 2c 72 3d 74 68 69 (e).bounds,r=thi
00011440: 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 72 s.getShapePageTr
00011450: 61 6e 73 66 6f 72 6d 28 65 2e 69 64 29 3b 72 26 ansform(e.id);r&
00011460: 26 74 68 69 73 2e 72 65 73 69 7a 65 53 68 61 70 &this.resizeShap
00011470: 65 28 65 2e 69 64 2c 7b 78 3a 22 68 6f 72 69 7a e(e.id,{x:"horiz
00011480: 6f 6e 74 61 6c 22 3d 3d 3d 74 3f 2d 31 3a 31 2c ontal"===t?-1:1,
00011490: 79 3a 22 76 65 72 74 69 63 61 6c 22 3d 3d 3d 74 y:"vertical"===t
000114a0: 3f 2d 31 3a 31 7d 2c 7b 69 6e 69 74 69 61 6c 42 ?-1:1},{initialB
000114b0: 6f 75 6e 64 73 3a 6e 2c 69 6e 69 74 69 61 6c 50 ounds:n,initialP
000114c0: 61 67 65 54 72 61 6e 73 66 6f 72 6d 3a 72 2c 69 ageTransform:r,i
000114d0: 6e 69 74 69 61 6c 53 68 61 70 65 3a 65 2c 6d 6f nitialShape:e,mo
000114e0: 64 65 3a 22 73 63 61 6c 65 5f 73 68 61 70 65 22 de:"scale_shape"
000114f0: 2c 69 73 41 73 70 65 63 74 52 61 74 69 6f 4c 6f ,isAspectRatioLo
00011500: 63 6b 65 64 3a 74 68 69 73 2e 67 65 74 53 68 61 cked:this.getSha
00011510: 70 65 55 74 69 6c 28 65 29 2e 69 73 41 73 70 65 peUtil(e).isAspe
00011520: 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 28 65 29 ctRatioLocked(e)
00011530: 2c 73 63 61 6c 65 4f 72 69 67 69 6e 3a 6f 2c 73 ,scaleOrigin:o,s
00011540: 63 61 6c 65 41 78 69 73 52 6f 74 61 74 69 6f 6e caleAxisRotation
00011550: 3a 30 7d 29 7d 7d 29 29 2c 74 68 69 73 7d 73 74 :0})}})),this}st
00011560: 61 63 6b 53 68 61 70 65 73 28 65 2c 74 2c 6e 29 ackShapes(e,t,n)
00011570: 7b 63 6f 6e 73 74 20 72 3d 22 73 74 72 69 6e 67 {const r="string
00011580: 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 "==typeof e[0]?e
00011590: 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 :e.map((e=>e.id)
000115a0: 29 3b 69 66 28 74 68 69 73 2e 67 65 74 49 6e 73 );if(this.getIns
000115b0: 74 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 tanceState().isR
000115c0: 65 61 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 74 eadonly)return t
000115d0: 68 69 73 3b 63 6f 6e 73 74 20 6f 3d 72 2e 6d 61 his;const o=r.ma
000115e0: 70 28 28 65 3d 3e 74 68 69 73 2e 67 65 74 53 68 p((e=>this.getSh
000115f0: 61 70 65 28 65 29 29 29 2e 66 69 6c 74 65 72 28 ape(e))).filter(
00011600: 28 65 3d 3e 21 21 65 26 26 74 68 69 73 2e 67 65 (e=>!!e&&this.ge
00011610: 74 53 68 61 70 65 55 74 69 6c 28 65 29 2e 63 61 tShapeUtil(e).ca
00011620: 6e 42 65 4c 61 69 64 4f 75 74 28 65 29 29 29 2c nBeLaidOut(e))),
00011630: 69 3d 6f 2e 6c 65 6e 67 74 68 3b 69 66 28 30 3d i=o.length;if(0=
00011640: 3d 3d 6e 26 26 69 3c 33 7c 7c 69 3c 32 29 72 65 ==n&&i<3||i<2)re
00011650: 74 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 turn this;const
00011660: 61 3d 4f 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 a=Object.fromEnt
00011670: 72 69 65 73 28 6f 2e 6d 61 70 28 28 65 3d 3e 5b ries(o.map((e=>[
00011680: 65 2e 69 64 2c 74 68 69 73 2e 67 65 74 53 68 61 e.id,this.getSha
00011690: 70 65 50 61 67 65 42 6f 75 6e 64 73 28 65 29 5d pePageBounds(e)]
000116a0: 29 29 29 3b 6c 65 74 20 73 2c 6c 2c 63 2c 75 2c )));let s,l,c,u,
000116b0: 64 3b 69 66 28 22 68 6f 72 69 7a 6f 6e 74 61 6c d;if("horizontal
000116c0: 22 3d 3d 3d 74 3f 28 73 3d 22 78 22 2c 6c 3d 22 "===t?(s="x",l="
000116d0: 6d 69 6e 58 22 2c 63 3d 22 6d 61 78 58 22 2c 75 minX",c="maxX",u
000116e0: 3d 22 77 69 64 74 68 22 29 3a 28 73 3d 22 79 22 ="width"):(s="y"
000116f0: 2c 6c 3d 22 6d 69 6e 59 22 2c 63 3d 22 6d 61 78 ,l="minY",c="max
00011700: 59 22 2c 75 3d 22 68 65 69 67 68 74 22 29 2c 30 Y",u="height"),0
00011710: 3d 3d 3d 6e 29 7b 63 6f 6e 73 74 20 65 3d 5b 5d ===n){const e=[]
00011720: 3b 6f 2e 73 6f 72 74 28 28 28 65 2c 74 29 3d 3e ;o.sort(((e,t)=>
00011730: 61 5b 65 2e 69 64 5d 5b 6c 5d 2d 61 5b 74 2e 69 a[e.id][l]-a[t.i
00011740: 64 5d 5b 6c 5d 29 29 3b 66 6f 72 28 6c 65 74 20 d][l]));for(let
00011750: 74 3d 30 3b 74 3c 69 2d 31 3b 74 2b 2b 29 7b 63 t=0;t<i-1;t++){c
00011760: 6f 6e 73 74 20 6e 3d 6f 5b 74 5d 2c 72 3d 6f 5b onst n=o[t],r=o[
00011770: 74 2b 31 5d 2c 69 3d 61 5b 6e 2e 69 64 5d 2c 73 t+1],i=a[n.id],s
00011780: 3d 61 5b 72 2e 69 64 5d 5b 6c 5d 2d 69 5b 63 5d =a[r.id][l]-i[c]
00011790: 2c 75 3d 65 2e 66 69 6e 64 28 28 65 3d 3e 65 2e ,u=e.find((e=>e.
000117a0: 67 61 70 3d 3d 3d 73 29 29 3b 75 3f 75 2e 63 6f gap===s));u?u.co
000117b0: 75 6e 74 2b 2b 3a 65 2e 70 75 73 68 28 7b 67 61 unt++:e.push({ga
000117c0: 70 3a 73 2c 63 6f 75 6e 74 3a 31 7d 29 7d 6c 65 p:s,count:1})}le
000117d0: 74 20 74 3d 30 3b 65 2e 66 6f 72 45 61 63 68 28 t t=0;e.forEach(
000117e0: 28 65 3d 3e 7b 65 2e 63 6f 75 6e 74 3e 74 26 26 (e=>{e.count>t&&
000117f0: 28 74 3d 65 2e 63 6f 75 6e 74 2c 64 3d 65 2e 67 (t=e.count,d=e.g
00011800: 61 70 29 7d 29 29 2c 31 3d 3d 3d 74 26 26 28 64 ap)})),1===t&&(d
00011810: 3d 4d 61 74 68 2e 6d 61 78 28 30 2c 65 2e 72 65 =Math.max(0,e.re
00011820: 64 75 63 65 28 28 28 65 2c 74 29 3d 3e 65 2b 74 duce(((e,t)=>e+t
00011830: 2e 67 61 70 2a 74 2e 63 6f 75 6e 74 29 2c 30 29 .gap*t.count),0)
00011840: 2f 28 69 2d 31 29 29 29 7d 65 6c 73 65 20 64 3d /(i-1)))}else d=
00011850: 6e 3b 63 6f 6e 73 74 20 70 3d 5b 5d 3b 6c 65 74 n;const p=[];let
00011860: 20 66 3d 61 5b 6f 5b 30 5d 2e 69 64 5d 5b 63 5d f=a[o[0].id][c]
00011870: 3b 72 65 74 75 72 6e 20 6f 2e 66 6f 72 45 61 63 ;return o.forEac
00011880: 68 28 28 28 65 2c 74 29 3d 3e 7b 69 66 28 30 3d h(((e,t)=>{if(0=
00011890: 3d 3d 74 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 ==t)return;const
000118a0: 20 6e 3d 7b 78 3a 30 2c 79 3a 30 7d 3b 6e 5b 73 n={x:0,y:0};n[s
000118b0: 5d 3d 66 2b 64 2d 61 5b 65 2e 69 64 5d 5b 73 5d ]=f+d-a[e.id][s]
000118c0: 3b 63 6f 6e 73 74 20 72 3d 74 68 69 73 2e 67 65 ;const r=this.ge
000118d0: 74 53 68 61 70 65 50 61 72 65 6e 74 28 65 29 2c tShapeParent(e),
000118e0: 6f 3d 72 3f 73 75 2e 52 6f 74 28 6e 2c 2d 74 68 o=r?su.Rot(n,-th
000118f0: 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 is.getShapePageT
00011900: 72 61 6e 73 66 6f 72 6d 28 72 29 2e 64 65 63 6f ransform(r).deco
00011910: 6d 70 6f 73 65 28 29 2e 72 6f 74 61 74 69 6f 6e mpose().rotation
00011920: 29 3a 6e 2c 69 3d 74 68 69 73 2e 67 65 74 53 68 ):n,i=this.getSh
00011930: 61 70 65 55 74 69 6c 28 65 29 2e 6f 6e 54 72 61 apeUtil(e).onTra
00011940: 6e 73 6c 61 74 65 53 74 61 72 74 3f 2e 28 65 29 nslateStart?.(e)
00011950: 3b 70 2e 70 75 73 68 28 69 3f 7b 2e 2e 2e 69 2c ;p.push(i?{...i,
00011960: 5b 73 5d 3a 65 5b 73 5d 2b 6f 5b 73 5d 7d 3a 7b [s]:e[s]+o[s]}:{
00011970: 69 64 3a 65 2e 69 64 2c 74 79 70 65 3a 65 2e 74 id:e.id,type:e.t
00011980: 79 70 65 2c 5b 73 5d 3a 65 5b 73 5d 2b 6f 5b 73 ype,[s]:e[s]+o[s
00011990: 5d 7d 29 2c 66 2b 3d 61 5b 65 2e 69 64 5d 5b 75 ]}),f+=a[e.id][u
000119a0: 5d 2b 64 7d 29 29 2c 74 68 69 73 2e 75 70 64 61 ]+d})),this.upda
000119b0: 74 65 53 68 61 70 65 73 28 70 29 2c 74 68 69 73 teShapes(p),this
000119c0: 7d 70 61 63 6b 53 68 61 70 65 73 28 65 2c 74 29 }packShapes(e,t)
000119d0: 7b 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 {const n="string
000119e0: 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 "==typeof e[0]?e
000119f0: 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 :e.map((e=>e.id)
00011a00: 29 3b 69 66 28 74 68 69 73 2e 67 65 74 49 6e 73 );if(this.getIns
00011a10: 74 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 tanceState().isR
00011a20: 65 61 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 74 eadonly)return t
00011a30: 68 69 73 3b 69 66 28 6e 2e 6c 65 6e 67 74 68 3c his;if(n.length<
00011a40: 32 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f 2)return this;co
00011a50: 6e 73 74 20 72 3d 6e 2e 6d 61 70 28 28 65 3d 3e nst r=n.map((e=>
00011a60: 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 this.getShape(e)
00011a70: 29 29 2e 66 69 6c 74 65 72 28 28 65 3d 3e 21 21 )).filter((e=>!!
00011a80: 65 26 26 74 68 69 73 2e 67 65 74 53 68 61 70 65 e&&this.getShape
00011a90: 55 74 69 6c 28 65 29 2e 63 61 6e 42 65 4c 61 69 Util(e).canBeLai
00011aa0: 64 4f 75 74 28 65 29 29 29 2c 6f 3d 7b 7d 2c 69 dOut(e))),o={},i
00011ab0: 3d 7b 7d 3b 6c 65 74 20 61 2c 73 2c 6c 3d 30 3b ={};let a,s,l=0;
00011ac0: 66 6f 72 28 6c 65 74 20 65 3d 30 3b 65 3c 72 2e for(let e=0;e<r.
00011ad0: 6c 65 6e 67 74 68 3b 65 2b 2b 29 61 3d 72 5b 65 length;e++)a=r[e
00011ae0: 5d 2c 73 3d 74 68 69 73 2e 67 65 74 53 68 61 70 ],s=this.getShap
00011af0: 65 50 61 67 65 42 6f 75 6e 64 73 28 61 29 2c 6f ePageBounds(a),o
00011b00: 5b 61 2e 69 64 5d 3d 73 2c 69 5b 61 2e 69 64 5d [a.id]=s,i[a.id]
00011b10: 3d 73 2e 63 6c 6f 6e 65 28 29 2c 6c 2b 3d 73 2e =s.clone(),l+=s.
00011b20: 77 69 64 74 68 2a 73 2e 68 65 69 67 68 74 3b 63 width*s.height;c
00011b30: 6f 6e 73 74 20 63 3d 5f 70 2e 43 6f 6d 6d 6f 6e onst c=_p.Common
00011b40: 28 6a 72 28 4f 62 6a 65 63 74 2e 76 61 6c 75 65 (jr(Object.value
00011b50: 73 28 6f 29 29 29 2c 75 3d 63 2e 77 69 64 74 68 s(o))),u=c.width
00011b60: 3b 72 2e 73 6f 72 74 28 28 28 65 2c 74 29 3d 3e ;r.sort(((e,t)=>
00011b70: 6f 5b 74 2e 69 64 5d 2e 68 65 69 67 68 74 2d 6f o[t.id].height-o
00011b80: 5b 65 2e 69 64 5d 2e 68 65 69 67 68 74 29 29 3b [e.id].height));
00011b90: 63 6f 6e 73 74 20 64 3d 4d 61 74 68 2e 6d 61 78 const d=Math.max
00011ba0: 28 4d 61 74 68 2e 63 65 69 6c 28 4d 61 74 68 2e (Math.ceil(Math.
00011bb0: 73 71 72 74 28 6c 2f 2e 39 35 29 29 2c 75 29 2c sqrt(l/.95)),u),
00011bc0: 70 3d 5b 6e 65 77 20 5f 70 28 63 2e 78 2c 63 2e p=[new _p(c.x,c.
00011bd0: 79 2c 64 2c 31 2f 30 29 5d 3b 6c 65 74 20 66 2c y,d,1/0)];let f,
00011be0: 68 2c 6d 3d 30 2c 67 3d 30 3b 66 6f 72 28 6c 65 h,m=0,g=0;for(le
00011bf0: 74 20 65 3d 30 3b 65 3c 72 2e 6c 65 6e 67 74 68 t e=0;e<r.length
00011c00: 3b 65 2b 2b 29 7b 61 3d 72 5b 65 5d 2c 73 3d 69 ;e++){a=r[e],s=i
00011c10: 5b 61 2e 69 64 5d 3b 66 6f 72 28 6c 65 74 20 65 [a.id];for(let e
00011c20: 3d 70 2e 6c 65 6e 67 74 68 2d 31 3b 65 3e 3d 30 =p.length-1;e>=0
00011c30: 3b 65 2d 2d 29 69 66 28 66 3d 70 5b 65 5d 2c 21 ;e--)if(f=p[e],!
00011c40: 28 73 2e 77 69 64 74 68 3e 66 2e 77 69 64 74 68 (s.width>f.width
00011c50: 7c 7c 73 2e 68 65 69 67 68 74 3e 66 2e 68 65 69 ||s.height>f.hei
00011c60: 67 68 74 29 29 7b 73 2e 78 3d 66 2e 78 2c 73 2e ght)){s.x=f.x,s.
00011c70: 79 3d 66 2e 79 2c 67 3d 4d 61 74 68 2e 6d 61 78 y=f.y,g=Math.max
00011c80: 28 67 2c 73 2e 6d 61 78 59 29 2c 6d 3d 4d 61 74 (g,s.maxY),m=Mat
00011c90: 68 2e 6d 61 78 28 6d 2c 73 2e 6d 61 78 58 29 2c h.max(m,s.maxX),
00011ca0: 73 2e 77 69 64 74 68 3d 3d 3d 66 2e 77 69 64 74 s.width===f.widt
00011cb0: 68 26 26 73 2e 68 65 69 67 68 74 3d 3d 3d 66 2e h&&s.height===f.
00011cc0: 68 65 69 67 68 74 3f 28 68 3d 70 2e 70 6f 70 28 height?(h=p.pop(
00011cd0: 29 2c 65 3c 70 2e 6c 65 6e 67 74 68 26 26 28 70 ),e<p.length&&(p
00011ce0: 5b 65 5d 3d 68 29 29 3a 73 2e 68 65 69 67 68 74 [e]=h)):s.height
00011cf0: 3d 3d 3d 66 2e 68 65 69 67 68 74 3f 28 66 2e 78 ===f.height?(f.x
00011d00: 2b 3d 73 2e 77 69 64 74 68 2b 74 2c 66 2e 77 69 +=s.width+t,f.wi
00011d10: 64 74 68 2d 3d 73 2e 77 69 64 74 68 2b 74 29 3a dth-=s.width+t):
00011d20: 73 2e 77 69 64 74 68 3d 3d 3d 66 2e 77 69 64 74 s.width===f.widt
00011d30: 68 3f 28 66 2e 79 2b 3d 73 2e 68 65 69 67 68 74 h?(f.y+=s.height
00011d40: 2b 74 2c 66 2e 68 65 69 67 68 74 2d 3d 73 2e 68 +t,f.height-=s.h
00011d50: 65 69 67 68 74 2b 74 29 3a 28 70 2e 70 75 73 68 eight+t):(p.push
00011d60: 28 6e 65 77 20 5f 70 28 66 2e 78 2b 28 73 2e 77 (new _p(f.x+(s.w
00011d70: 69 64 74 68 2b 74 29 2c 66 2e 79 2c 66 2e 77 69 idth+t),f.y,f.wi
00011d80: 64 74 68 2d 28 73 2e 77 69 64 74 68 2b 74 29 2c dth-(s.width+t),
00011d90: 73 2e 68 65 69 67 68 74 29 29 2c 66 2e 79 2b 3d s.height)),f.y+=
00011da0: 73 2e 68 65 69 67 68 74 2b 74 2c 66 2e 68 65 69 s.height+t,f.hei
00011db0: 67 68 74 2d 3d 73 2e 68 65 69 67 68 74 2b 74 29 ght-=s.height+t)
00011dc0: 3b 62 72 65 61 6b 7d 7d 63 6f 6e 73 74 20 62 3d ;break}}const b=
00011dd0: 5f 70 2e 43 6f 6d 6d 6f 6e 28 4f 62 6a 65 63 74 _p.Common(Object
00011de0: 2e 76 61 6c 75 65 73 28 69 29 29 2c 79 3d 73 75 .values(i)),y=su
00011df0: 2e 53 75 62 28 63 2e 63 65 6e 74 65 72 2c 62 2e .Sub(c.center,b.
00011e00: 63 65 6e 74 65 72 29 3b 6c 65 74 20 76 3b 63 6f center);let v;co
00011e10: 6e 73 74 20 53 3d 5b 5d 3b 66 6f 72 28 6c 65 74 nst S=[];for(let
00011e20: 20 65 3d 30 3b 65 3c 72 2e 6c 65 6e 67 74 68 3b e=0;e<r.length;
00011e30: 65 2b 2b 29 7b 61 3d 72 5b 65 5d 2c 73 3d 6f 5b e++){a=r[e],s=o[
00011e40: 61 2e 69 64 5d 2c 76 3d 69 5b 61 2e 69 64 5d 3b a.id],v=i[a.id];
00011e50: 63 6f 6e 73 74 20 74 3d 73 75 2e 53 75 62 28 76 const t=su.Sub(v
00011e60: 2e 70 6f 69 6e 74 2c 73 2e 70 6f 69 6e 74 29 2e .point,s.point).
00011e70: 61 64 64 28 79 29 2c 6e 3d 74 68 69 73 2e 67 65 add(y),n=this.ge
00011e80: 74 53 68 61 70 65 50 61 72 65 6e 74 54 72 61 6e tShapeParentTran
00011e90: 73 66 6f 72 6d 28 61 29 3b 6e 26 26 74 2e 72 6f sform(a);n&&t.ro
00011ea0: 74 28 2d 6e 2e 72 6f 74 61 74 69 6f 6e 28 29 29 t(-n.rotation())
00011eb0: 3b 63 6f 6e 73 74 20 6c 3d 7b 69 64 3a 61 2e 69 ;const l={id:a.i
00011ec0: 64 2c 74 79 70 65 3a 61 2e 74 79 70 65 2c 78 3a d,type:a.type,x:
00011ed0: 61 2e 78 2b 74 2e 78 2c 79 3a 61 2e 79 2b 74 2e a.x+t.x,y:a.y+t.
00011ee0: 79 7d 2c 63 3d 74 68 69 73 2e 67 65 74 53 68 61 y},c=this.getSha
00011ef0: 70 65 55 74 69 6c 28 61 29 2e 6f 6e 54 72 61 6e peUtil(a).onTran
00011f00: 73 6c 61 74 65 53 74 61 72 74 3f 2e 28 7b 2e 2e slateStart?.({..
00011f10: 2e 61 2c 2e 2e 2e 6c 7d 29 3b 63 3f 53 2e 70 75 .a,...l});c?S.pu
00011f20: 73 68 28 7b 2e 2e 2e 6c 2c 2e 2e 2e 63 7d 29 3a sh({...l,...c}):
00011f30: 53 2e 70 75 73 68 28 6c 29 7d 72 65 74 75 72 6e S.push(l)}return
00011f40: 20 53 2e 6c 65 6e 67 74 68 26 26 74 68 69 73 2e S.length&&this.
00011f50: 75 70 64 61 74 65 53 68 61 70 65 73 28 53 29 2c updateShapes(S),
00011f60: 74 68 69 73 7d 61 6c 69 67 6e 53 68 61 70 65 73 this}alignShapes
00011f70: 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 22 73 (e,t){const n="s
00011f80: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
00011f90: 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e [0]?e:e.map((e=>
00011fa0: 65 2e 69 64 29 29 3b 69 66 28 74 68 69 73 2e 67 e.id));if(this.g
00011fb0: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00011fc0: 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 74 ).isReadonly)ret
00011fd0: 75 72 6e 20 74 68 69 73 3b 69 66 28 6e 2e 6c 65 urn this;if(n.le
00011fe0: 6e 67 74 68 3c 32 29 72 65 74 75 72 6e 20 74 68 ngth<2)return th
00011ff0: 69 73 3b 63 6f 6e 73 74 20 72 3d 6a 72 28 6e 2e is;const r=jr(n.
00012000: 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 67 65 74 map((e=>this.get
00012010: 53 68 61 70 65 28 65 29 29 29 29 2c 6f 3d 4f 62 Shape(e)))),o=Ob
00012020: 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 72 69 65 73 ject.fromEntries
00012030: 28 72 2e 6d 61 70 28 28 65 3d 3e 5b 65 2e 69 64 (r.map((e=>[e.id
00012040: 2c 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 ,this.getShapePa
00012050: 67 65 42 6f 75 6e 64 73 28 65 29 5d 29 29 29 2c geBounds(e)]))),
00012060: 69 3d 5f 70 2e 43 6f 6d 6d 6f 6e 28 6a 72 28 4f i=_p.Common(jr(O
00012070: 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 6f 29 29 bject.values(o))
00012080: 29 2c 61 3d 5b 5d 3b 72 65 74 75 72 6e 20 72 2e ),a=[];return r.
00012090: 66 6f 72 45 61 63 68 28 28 65 3d 3e 7b 63 6f 6e forEach((e=>{con
000120a0: 73 74 20 6e 3d 6f 5b 65 2e 69 64 5d 3b 69 66 28 st n=o[e.id];if(
000120b0: 21 6e 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 !n)return;const
000120c0: 72 3d 7b 78 3a 30 2c 79 3a 30 7d 3b 73 77 69 74 r={x:0,y:0};swit
000120d0: 63 68 28 74 29 7b 63 61 73 65 22 74 6f 70 22 3a ch(t){case"top":
000120e0: 72 2e 79 3d 69 2e 6d 69 6e 59 2d 6e 2e 6d 69 6e r.y=i.minY-n.min
000120f0: 59 3b 62 72 65 61 6b 3b 63 61 73 65 22 63 65 6e Y;break;case"cen
00012100: 74 65 72 2d 76 65 72 74 69 63 61 6c 22 3a 72 2e ter-vertical":r.
00012110: 79 3d 69 2e 6d 69 64 59 2d 6e 2e 6d 69 6e 59 2d y=i.midY-n.minY-
00012120: 6e 2e 68 65 69 67 68 74 2f 32 3b 62 72 65 61 6b n.height/2;break
00012130: 3b 63 61 73 65 22 62 6f 74 74 6f 6d 22 3a 72 2e ;case"bottom":r.
00012140: 79 3d 69 2e 6d 61 78 59 2d 6e 2e 6d 69 6e 59 2d y=i.maxY-n.minY-
00012150: 6e 2e 68 65 69 67 68 74 3b 62 72 65 61 6b 3b 63 n.height;break;c
00012160: 61 73 65 22 6c 65 66 74 22 3a 72 2e 78 3d 69 2e ase"left":r.x=i.
00012170: 6d 69 6e 58 2d 6e 2e 6d 69 6e 58 3b 62 72 65 61 minX-n.minX;brea
00012180: 6b 3b 63 61 73 65 22 63 65 6e 74 65 72 2d 68 6f k;case"center-ho
00012190: 72 69 7a 6f 6e 74 61 6c 22 3a 72 2e 78 3d 69 2e rizontal":r.x=i.
000121a0: 6d 69 64 58 2d 6e 2e 6d 69 6e 58 2d 6e 2e 77 69 midX-n.minX-n.wi
000121b0: 64 74 68 2f 32 3b 62 72 65 61 6b 3b 63 61 73 65 dth/2;break;case
000121c0: 22 72 69 67 68 74 22 3a 72 2e 78 3d 69 2e 6d 61 "right":r.x=i.ma
000121d0: 78 58 2d 6e 2e 6d 69 6e 58 2d 6e 2e 77 69 64 74 xX-n.minX-n.widt
000121e0: 68 7d 63 6f 6e 73 74 20 73 3d 74 68 69 73 2e 67 h}const s=this.g
000121f0: 65 74 53 68 61 70 65 50 61 72 65 6e 74 28 65 29 etShapeParent(e)
00012200: 2c 6c 3d 73 3f 73 75 2e 52 6f 74 28 72 2c 2d 74 ,l=s?su.Rot(r,-t
00012210: 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 his.getShapePage
00012220: 54 72 61 6e 73 66 6f 72 6d 28 73 29 2e 64 65 63 Transform(s).dec
00012230: 6f 6d 70 6f 73 65 28 29 2e 72 6f 74 61 74 69 6f ompose().rotatio
00012240: 6e 29 3a 72 3b 61 2e 70 75 73 68 28 74 68 69 73 n):r;a.push(this
00012250: 2e 67 65 74 43 68 61 6e 67 65 73 54 6f 54 72 61 .getChangesToTra
00012260: 6e 73 6c 61 74 65 53 68 61 70 65 28 65 2c 73 75 nslateShape(e,su
00012270: 2e 41 64 64 28 65 2c 6c 29 29 29 7d 29 29 2c 74 .Add(e,l)))})),t
00012280: 68 69 73 2e 75 70 64 61 74 65 53 68 61 70 65 73 his.updateShapes
00012290: 28 61 29 2c 74 68 69 73 7d 64 69 73 74 72 69 62 (a),this}distrib
000122a0: 75 74 65 53 68 61 70 65 73 28 65 2c 74 29 7b 63 uteShapes(e,t){c
000122b0: 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 22 3d onst n="string"=
000122c0: 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 3a 65 =typeof e[0]?e:e
000122d0: 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 29 3b .map((e=>e.id));
000122e0: 69 66 28 74 68 69 73 2e 67 65 74 49 6e 73 74 61 if(this.getInsta
000122f0: 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 nceState().isRea
00012300: 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 74 68 69 donly)return thi
00012310: 73 3b 69 66 28 6e 2e 6c 65 6e 67 74 68 3c 33 29 s;if(n.length<3)
00012320: 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 return this;cons
00012330: 74 20 72 3d 6e 2e 6c 65 6e 67 74 68 2c 6f 3d 6a t r=n.length,o=j
00012340: 72 28 6e 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 r(n.map((e=>this
00012350: 2e 67 65 74 53 68 61 70 65 28 65 29 29 29 29 2c .getShape(e)))),
00012360: 69 3d 4f 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 i=Object.fromEnt
00012370: 72 69 65 73 28 6f 2e 6d 61 70 28 28 65 3d 3e 5b ries(o.map((e=>[
00012380: 65 2e 69 64 2c 74 68 69 73 2e 67 65 74 53 68 61 e.id,this.getSha
00012390: 70 65 50 61 67 65 42 6f 75 6e 64 73 28 65 29 5d pePageBounds(e)]
000123a0: 29 29 29 3b 6c 65 74 20 61 2c 73 2c 6c 2c 63 2c )));let a,s,l,c,
000123b0: 75 3b 22 68 6f 72 69 7a 6f 6e 74 61 6c 22 3d 3d u;"horizontal"==
000123c0: 3d 74 3f 28 61 3d 22 78 22 2c 73 3d 22 6d 69 6e =t?(a="x",s="min
000123d0: 58 22 2c 6c 3d 22 6d 61 78 58 22 2c 63 3d 22 6d X",l="maxX",c="m
000123e0: 69 64 58 22 2c 75 3d 22 77 69 64 74 68 22 29 3a idX",u="width"):
000123f0: 28 61 3d 22 79 22 2c 73 3d 22 6d 69 6e 59 22 2c (a="y",s="minY",
00012400: 6c 3d 22 6d 61 78 59 22 2c 63 3d 22 6d 69 64 59 l="maxY",c="midY
00012410: 22 2c 75 3d 22 68 65 69 67 68 74 22 29 3b 63 6f ",u="height");co
00012420: 6e 73 74 20 64 3d 5b 5d 2c 70 3d 6f 2e 73 6f 72 nst d=[],p=o.sor
00012430: 74 28 28 28 65 2c 74 29 3d 3e 69 5b 65 2e 69 64 t(((e,t)=>i[e.id
00012440: 5d 5b 73 5d 2d 69 5b 74 2e 69 64 5d 5b 73 5d 29 ][s]-i[t.id][s])
00012450: 29 5b 30 5d 2c 66 3d 6f 2e 73 6f 72 74 28 28 28 )[0],f=o.sort(((
00012460: 65 2c 74 29 3d 3e 69 5b 74 2e 69 64 5d 5b 6c 5d e,t)=>i[t.id][l]
00012470: 2d 69 5b 65 2e 69 64 5d 5b 6c 5d 29 29 5b 30 5d -i[e.id][l]))[0]
00012480: 2c 68 3d 69 5b 70 2e 69 64 5d 5b 63 5d 2c 6d 3d ,h=i[p.id][c],m=
00012490: 28 69 5b 66 2e 69 64 5d 5b 63 5d 2d 68 29 2f 28 (i[f.id][c]-h)/(
000124a0: 72 2d 31 29 2c 67 3d 68 2b 6d 3b 72 65 74 75 72 r-1),g=h+m;retur
000124b0: 6e 20 6f 2e 66 69 6c 74 65 72 28 28 65 3d 3e 65 n o.filter((e=>e
000124c0: 21 3d 3d 70 26 26 65 21 3d 3d 66 29 29 2e 73 6f !==p&&e!==f)).so
000124d0: 72 74 28 28 28 65 2c 74 29 3d 3e 69 5b 65 2e 69 rt(((e,t)=>i[e.i
000124e0: 64 5d 5b 63 5d 2d 69 5b 74 2e 69 64 5d 5b 63 5d d][c]-i[t.id][c]
000124f0: 29 29 2e 66 6f 72 45 61 63 68 28 28 28 65 2c 74 )).forEach(((e,t
00012500: 29 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 7b 78 3a 30 )=>{const n={x:0
00012510: 2c 79 3a 30 7d 3b 6e 5b 61 5d 3d 67 2b 6d 2a 74 ,y:0};n[a]=g+m*t
00012520: 2d 69 5b 65 2e 69 64 5d 5b 75 5d 2f 32 2d 69 5b -i[e.id][u]/2-i[
00012530: 65 2e 69 64 5d 5b 61 5d 3b 63 6f 6e 73 74 20 72 e.id][a];const r
00012540: 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 =this.getShapePa
00012550: 72 65 6e 74 28 65 29 2c 6f 3d 72 3f 73 75 2e 52 rent(e),o=r?su.R
00012560: 6f 74 28 6e 2c 2d 74 68 69 73 2e 67 65 74 53 68 ot(n,-this.getSh
00012570: 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d apePageTransform
00012580: 28 72 29 2e 72 6f 74 61 74 69 6f 6e 28 29 29 3a (r).rotation()):
00012590: 6e 3b 64 2e 70 75 73 68 28 74 68 69 73 2e 67 65 n;d.push(this.ge
000125a0: 74 43 68 61 6e 67 65 73 54 6f 54 72 61 6e 73 6c tChangesToTransl
000125b0: 61 74 65 53 68 61 70 65 28 65 2c 73 75 2e 41 64 ateShape(e,su.Ad
000125c0: 64 28 65 2c 6f 29 29 29 7d 29 29 2c 74 68 69 73 d(e,o)))})),this
000125d0: 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 64 29 .updateShapes(d)
000125e0: 2c 74 68 69 73 7d 73 74 72 65 74 63 68 53 68 61 ,this}stretchSha
000125f0: 70 65 73 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e pes(e,t){const n
00012600: 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ="string"==typeo
00012610: 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d 61 70 28 28 f e[0]?e:e.map((
00012620: 65 3d 3e 65 2e 69 64 29 29 3b 69 66 28 74 68 69 e=>e.id));if(thi
00012630: 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 s.getInstanceSta
00012640: 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 te().isReadonly)
00012650: 72 65 74 75 72 6e 20 74 68 69 73 3b 69 66 28 6e return this;if(n
00012660: 2e 6c 65 6e 67 74 68 3c 32 29 72 65 74 75 72 6e .length<2)return
00012670: 20 74 68 69 73 3b 63 6f 6e 73 74 20 72 3d 6a 72 this;const r=jr
00012680: 28 6e 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e (n.map((e=>this.
00012690: 67 65 74 53 68 61 70 65 28 65 29 29 29 29 2c 6f getShape(e)))),o
000126a0: 3d 4f 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 72 =Object.fromEntr
000126b0: 69 65 73 28 6e 2e 6d 61 70 28 28 65 3d 3e 5b 65 ies(n.map((e=>[e
000126c0: 2c 74 68 69 73 2e 67 65 74 53 68 61 70 65 47 65 ,this.getShapeGe
000126d0: 6f 6d 65 74 72 79 28 65 29 2e 62 6f 75 6e 64 73 ometry(e).bounds
000126e0: 5d 29 29 29 2c 69 3d 4f 62 6a 65 63 74 2e 66 72 ]))),i=Object.fr
000126f0: 6f 6d 45 6e 74 72 69 65 73 28 6e 2e 6d 61 70 28 omEntries(n.map(
00012700: 28 65 3d 3e 5b 65 2c 74 68 69 73 2e 67 65 74 53 (e=>[e,this.getS
00012710: 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 65 hapePageBounds(e
00012720: 29 5d 29 29 29 2c 61 3d 5f 70 2e 43 6f 6d 6d 6f )]))),a=_p.Commo
00012730: 6e 28 6a 72 28 4f 62 6a 65 63 74 2e 76 61 6c 75 n(jr(Object.valu
00012740: 65 73 28 69 29 29 29 3b 73 77 69 74 63 68 28 74 es(i)));switch(t
00012750: 29 7b 63 61 73 65 22 76 65 72 74 69 63 61 6c 22 ){case"vertical"
00012760: 3a 74 68 69 73 2e 62 61 74 63 68 28 28 28 29 3d :this.batch((()=
00012770: 3e 7b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 >{for(const e of
00012780: 20 72 29 7b 69 66 28 74 68 69 73 2e 67 65 74 53 r){if(this.getS
00012790: 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 hapePageTransfor
000127a0: 6d 28 65 29 2e 72 6f 74 61 74 69 6f 6e 28 29 25 m(e).rotation()%
000127b0: 66 75 29 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 fu)continue;cons
000127c0: 74 20 74 3d 6f 5b 65 2e 69 64 5d 2c 6e 3d 69 5b t t=o[e.id],n=i[
000127d0: 65 2e 69 64 5d 2c 72 3d 6e 65 77 20 73 75 28 30 e.id],r=new su(0
000127e0: 2c 61 2e 6d 69 6e 59 2d 6e 2e 6d 69 6e 59 29 2c ,a.minY-n.minY),
000127f0: 73 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 s=this.getShapeP
00012800: 61 72 65 6e 74 54 72 61 6e 73 66 6f 72 6d 28 65 arentTransform(e
00012810: 29 3b 73 26 26 72 2e 72 6f 74 28 2d 73 2e 72 6f );s&&r.rot(-s.ro
00012820: 74 61 74 69 6f 6e 28 29 29 3b 63 6f 6e 73 74 7b tation());const{
00012830: 78 3a 6c 2c 79 3a 63 7d 3d 73 75 2e 41 64 64 28 x:l,y:c}=su.Add(
00012840: 72 2c 65 29 3b 74 68 69 73 2e 75 70 64 61 74 65 r,e);this.update
00012850: 53 68 61 70 65 73 28 5b 7b 69 64 3a 65 2e 69 64 Shapes([{id:e.id
00012860: 2c 74 79 70 65 3a 65 2e 74 79 70 65 2c 78 3a 6c ,type:e.type,x:l
00012870: 2c 79 3a 63 7d 5d 29 3b 63 6f 6e 73 74 20 75 3d ,y:c}]);const u=
00012880: 6e 65 77 20 73 75 28 31 2c 61 2e 68 65 69 67 68 new su(1,a.heigh
00012890: 74 2f 6e 2e 68 65 69 67 68 74 29 3b 74 68 69 73 t/n.height);this
000128a0: 2e 72 65 73 69 7a 65 53 68 61 70 65 28 65 2e 69 .resizeShape(e.i
000128b0: 64 2c 75 2c 7b 69 6e 69 74 69 61 6c 42 6f 75 6e d,u,{initialBoun
000128c0: 64 73 3a 74 2c 73 63 61 6c 65 4f 72 69 67 69 6e ds:t,scaleOrigin
000128d0: 3a 6e 65 77 20 73 75 28 6e 2e 63 65 6e 74 65 72 :new su(n.center
000128e0: 2e 78 2c 61 2e 6d 69 6e 59 29 2c 69 73 41 73 70 .x,a.minY),isAsp
000128f0: 65 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 3a 74 ectRatioLocked:t
00012900: 68 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c his.getShapeUtil
00012910: 28 65 29 2e 69 73 41 73 70 65 63 74 52 61 74 69 (e).isAspectRati
00012920: 6f 4c 6f 63 6b 65 64 28 65 29 2c 73 63 61 6c 65 oLocked(e),scale
00012930: 41 78 69 73 52 6f 74 61 74 69 6f 6e 3a 30 7d 29 AxisRotation:0})
00012940: 7d 7d 29 29 3b 62 72 65 61 6b 3b 63 61 73 65 22 }}));break;case"
00012950: 68 6f 72 69 7a 6f 6e 74 61 6c 22 3a 74 68 69 73 horizontal":this
00012960: 2e 62 61 74 63 68 28 28 28 29 3d 3e 7b 66 6f 72 .batch((()=>{for
00012970: 28 63 6f 6e 73 74 20 65 20 6f 66 20 72 29 7b 63 (const e of r){c
00012980: 6f 6e 73 74 20 74 3d 6f 5b 65 2e 69 64 5d 2c 6e onst t=o[e.id],n
00012990: 3d 69 5b 65 2e 69 64 5d 3b 69 66 28 74 68 69 73 =i[e.id];if(this
000129a0: 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 72 61 .getShapePageTra
000129b0: 6e 73 66 6f 72 6d 28 65 29 2e 72 6f 74 61 74 69 nsform(e).rotati
000129c0: 6f 6e 28 29 25 66 75 29 63 6f 6e 74 69 6e 75 65 on()%fu)continue
000129d0: 3b 63 6f 6e 73 74 20 72 3d 6e 65 77 20 73 75 28 ;const r=new su(
000129e0: 61 2e 6d 69 6e 58 2d 6e 2e 6d 69 6e 58 2c 30 29 a.minX-n.minX,0)
000129f0: 2c 73 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 ,s=this.getShape
00012a00: 50 61 72 65 6e 74 54 72 61 6e 73 66 6f 72 6d 28 ParentTransform(
00012a10: 65 29 3b 73 26 26 72 2e 72 6f 74 28 2d 73 2e 72 e);s&&r.rot(-s.r
00012a20: 6f 74 61 74 69 6f 6e 28 29 29 3b 63 6f 6e 73 74 otation());const
00012a30: 7b 78 3a 6c 2c 79 3a 63 7d 3d 73 75 2e 41 64 64 {x:l,y:c}=su.Add
00012a40: 28 72 2c 65 29 3b 74 68 69 73 2e 75 70 64 61 74 (r,e);this.updat
00012a50: 65 53 68 61 70 65 73 28 5b 7b 69 64 3a 65 2e 69 eShapes([{id:e.i
00012a60: 64 2c 74 79 70 65 3a 65 2e 74 79 70 65 2c 78 3a d,type:e.type,x:
00012a70: 6c 2c 79 3a 63 7d 5d 29 3b 63 6f 6e 73 74 20 75 l,y:c}]);const u
00012a80: 3d 6e 65 77 20 73 75 28 61 2e 77 69 64 74 68 2f =new su(a.width/
00012a90: 6e 2e 77 69 64 74 68 2c 31 29 3b 74 68 69 73 2e n.width,1);this.
00012aa0: 72 65 73 69 7a 65 53 68 61 70 65 28 65 2e 69 64 resizeShape(e.id
00012ab0: 2c 75 2c 7b 69 6e 69 74 69 61 6c 42 6f 75 6e 64 ,u,{initialBound
00012ac0: 73 3a 74 2c 73 63 61 6c 65 4f 72 69 67 69 6e 3a s:t,scaleOrigin:
00012ad0: 6e 65 77 20 73 75 28 61 2e 6d 69 6e 58 2c 6e 2e new su(a.minX,n.
00012ae0: 63 65 6e 74 65 72 2e 79 29 2c 69 73 41 73 70 65 center.y),isAspe
00012af0: 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 3a 74 68 ctRatioLocked:th
00012b00: 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 is.getShapeUtil(
00012b10: 65 29 2e 69 73 41 73 70 65 63 74 52 61 74 69 6f e).isAspectRatio
00012b20: 4c 6f 63 6b 65 64 28 65 29 2c 73 63 61 6c 65 41 Locked(e),scaleA
00012b30: 78 69 73 52 6f 74 61 74 69 6f 6e 3a 30 7d 29 7d xisRotation:0})}
00012b40: 7d 29 29 7d 72 65 74 75 72 6e 20 74 68 69 73 7d }))}return this}
00012b50: 72 65 73 69 7a 65 53 68 61 70 65 28 65 2c 74 2c resizeShape(e,t,
00012b60: 6e 3d 7b 7d 29 7b 63 6f 6e 73 74 20 72 3d 22 73 n={}){const r="s
00012b70: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
00012b80: 3f 65 3a 65 2e 69 64 3b 69 66 28 74 68 69 73 2e ?e:e.id;if(this.
00012b90: 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 getInstanceState
00012ba0: 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 ().isReadonly)re
00012bb0: 74 75 72 6e 20 74 68 69 73 3b 4e 75 6d 62 65 72 turn this;Number
00012bc0: 2e 69 73 46 69 6e 69 74 65 28 74 2e 78 29 7c 7c .isFinite(t.x)||
00012bd0: 28 74 3d 6e 65 77 20 73 75 28 31 2c 74 2e 79 29 (t=new su(1,t.y)
00012be0: 29 2c 4e 75 6d 62 65 72 2e 69 73 46 69 6e 69 74 ),Number.isFinit
00012bf0: 65 28 74 2e 79 29 7c 7c 28 74 3d 6e 65 77 20 73 e(t.y)||(t=new s
00012c00: 75 28 74 2e 78 2c 31 29 29 3b 63 6f 6e 73 74 20 u(t.x,1));const
00012c10: 6f 3d 6e 2e 69 6e 69 74 69 61 6c 53 68 61 70 65 o=n.initialShape
00012c20: 3f 3f 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 ??this.getShape(
00012c30: 72 29 3b 69 66 28 21 6f 29 72 65 74 75 72 6e 20 r);if(!o)return
00012c40: 74 68 69 73 3b 63 6f 6e 73 74 20 69 3d 6e 2e 73 this;const i=n.s
00012c50: 63 61 6c 65 4f 72 69 67 69 6e 3f 3f 74 68 69 73 caleOrigin??this
00012c60: 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 6f 75 .getShapePageBou
00012c70: 6e 64 73 28 72 29 3f 2e 63 65 6e 74 65 72 3b 69 nds(r)?.center;i
00012c80: 66 28 21 69 29 72 65 74 75 72 6e 20 74 68 69 73 f(!i)return this
00012c90: 3b 63 6f 6e 73 74 20 61 3d 6e 2e 69 6e 69 74 69 ;const a=n.initi
00012ca0: 61 6c 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 3f alPageTransform?
00012cb0: 77 70 2e 43 61 73 74 28 6e 2e 69 6e 69 74 69 61 wp.Cast(n.initia
00012cc0: 6c 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 29 3a lPageTransform):
00012cd0: 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 this.getShapePag
00012ce0: 65 54 72 61 6e 73 66 6f 72 6d 28 72 29 3b 69 66 eTransform(r);if
00012cf0: 28 21 61 29 72 65 74 75 72 6e 20 74 68 69 73 3b (!a)return this;
00012d00: 63 6f 6e 73 74 20 73 3d 61 2e 72 6f 74 61 74 69 const s=a.rotati
00012d10: 6f 6e 28 29 3b 69 66 28 6e 75 6c 6c 3d 3d 73 29 on();if(null==s)
00012d20: 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 return this;cons
00012d30: 74 20 6c 3d 6e 2e 73 63 61 6c 65 41 78 69 73 52 t l=n.scaleAxisR
00012d40: 6f 74 61 74 69 6f 6e 3f 3f 73 2c 63 3d 6e 2e 69 otation??s,c=n.i
00012d50: 6e 69 74 69 61 6c 42 6f 75 6e 64 73 3f 3f 74 68 nitialBounds??th
00012d60: 69 73 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 is.getShapeGeome
00012d70: 74 72 79 28 72 29 2e 62 6f 75 6e 64 73 3b 69 66 try(r).bounds;if
00012d80: 28 21 63 29 72 65 74 75 72 6e 20 74 68 69 73 3b (!c)return this;
00012d90: 63 6f 6e 73 74 20 75 3d 6e 2e 69 73 41 73 70 65 const u=n.isAspe
00012da0: 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 3f 3f 74 ctRatioLocked??t
00012db0: 68 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c his.getShapeUtil
00012dc0: 28 6f 29 2e 69 73 41 73 70 65 63 74 52 61 74 69 (o).isAspectRati
00012dd0: 6f 4c 6f 63 6b 65 64 28 6f 29 3b 69 66 28 21 54 oLocked(o);if(!T
00012de0: 75 28 73 2c 6c 29 29 72 65 74 75 72 6e 20 74 68 u(s,l))return th
00012df0: 69 73 2e 5f 72 65 73 69 7a 65 55 6e 61 6c 69 67 is._resizeUnalig
00012e00: 6e 65 64 53 68 61 70 65 28 72 2c 74 2c 7b 2e 2e nedShape(r,t,{..
00012e10: 2e 6e 2c 69 6e 69 74 69 61 6c 42 6f 75 6e 64 73 .n,initialBounds
00012e20: 3a 63 2c 73 63 61 6c 65 4f 72 69 67 69 6e 3a 69 :c,scaleOrigin:i
00012e30: 2c 73 63 61 6c 65 41 78 69 73 52 6f 74 61 74 69 ,scaleAxisRotati
00012e40: 6f 6e 3a 6c 2c 69 6e 69 74 69 61 6c 50 61 67 65 on:l,initialPage
00012e50: 54 72 61 6e 73 66 6f 72 6d 3a 61 2c 69 73 41 73 Transform:a,isAs
00012e60: 70 65 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 3a pectRatioLocked:
00012e70: 75 2c 69 6e 69 74 69 61 6c 53 68 61 70 65 3a 6f u,initialShape:o
00012e80: 7d 29 3b 63 6f 6e 73 74 20 64 3d 74 68 69 73 2e });const d=this.
00012e90: 67 65 74 53 68 61 70 65 55 74 69 6c 28 6f 29 3b getShapeUtil(o);
00012ea0: 69 66 28 75 26 26 28 74 3d 4d 61 74 68 2e 61 62 if(u&&(t=Math.ab
00012eb0: 73 28 74 2e 78 29 3e 4d 61 74 68 2e 61 62 73 28 s(t.x)>Math.abs(
00012ec0: 74 2e 79 29 3f 6e 65 77 20 73 75 28 74 2e 78 2c t.y)?new su(t.x,
00012ed0: 4d 61 74 68 2e 73 69 67 6e 28 74 2e 79 29 2a 4d Math.sign(t.y)*M
00012ee0: 61 74 68 2e 61 62 73 28 74 2e 78 29 29 3a 6e 65 ath.abs(t.x)):ne
00012ef0: 77 20 73 75 28 4d 61 74 68 2e 73 69 67 6e 28 74 w su(Math.sign(t
00012f00: 2e 78 29 2a 4d 61 74 68 2e 61 62 73 28 74 2e 79 .x)*Math.abs(t.y
00012f10: 29 2c 74 2e 79 29 29 2c 64 2e 6f 6e 52 65 73 69 ),t.y)),d.onResi
00012f20: 7a 65 26 26 64 2e 63 61 6e 52 65 73 69 7a 65 28 ze&&d.canResize(
00012f30: 6f 29 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 o)){const e=this
00012f40: 2e 5f 73 63 61 6c 65 50 61 67 65 50 6f 69 6e 74 ._scalePagePoint
00012f50: 28 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 (wp.applyToPoint
00012f60: 28 61 2c 6e 65 77 20 73 75 28 30 2c 30 29 29 2c (a,new su(0,0)),
00012f70: 69 2c 74 2c 6c 29 2c 75 3d 74 68 69 73 2e 67 65 i,t,l),u=this.ge
00012f80: 74 50 6f 69 6e 74 49 6e 50 61 72 65 6e 74 53 70 tPointInParentSp
00012f90: 61 63 65 28 6f 2e 69 64 2c 65 29 2c 70 3d 6e 65 ace(o.id,e),p=ne
00012fa0: 77 20 73 75 28 74 2e 78 2c 74 2e 79 29 2c 66 3d w su(t.x,t.y),f=
00012fb0: 62 75 28 28 73 2d 6c 29 25 4d 61 74 68 2e 50 49 bu((s-l)%Math.PI
00012fc0: 2c 30 29 3b 70 2e 78 3d 66 3f 74 2e 78 3a 74 2e ,0);p.x=f?t.x:t.
00012fd0: 79 2c 70 2e 79 3d 66 3f 74 2e 79 3a 74 2e 78 3b y,p.y=f?t.y:t.x;
00012fe0: 63 6f 6e 73 74 20 68 3d 77 70 2e 61 70 70 6c 79 const h=wp.apply
00012ff0: 54 6f 50 6f 69 6e 74 28 61 2c 6e 65 77 20 73 75 ToPoint(a,new su
00013000: 29 2c 7b 78 3a 6d 2c 79 3a 67 7d 3d 74 68 69 73 ),{x:m,y:g}=this
00013010: 2e 67 65 74 50 6f 69 6e 74 49 6e 50 61 72 65 6e .getPointInParen
00013020: 74 53 70 61 63 65 28 6f 2e 69 64 2c 68 29 3b 6c tSpace(o.id,h);l
00013030: 65 74 20 62 3d 6f 3b 6e 2e 73 6b 69 70 53 74 61 et b=o;n.skipSta
00013040: 72 74 41 6e 64 45 6e 64 43 61 6c 6c 62 61 63 6b rtAndEndCallback
00013050: 73 7c 7c 28 62 3d 7a 6d 28 6f 2c 64 2e 6f 6e 52 s||(b=zm(o,d.onR
00013060: 65 73 69 7a 65 53 74 61 72 74 3f 2e 28 6f 29 3f esizeStart?.(o)?
00013070: 3f 76 6f 69 64 20 30 29 29 2c 62 3d 7a 6d 28 62 ?void 0)),b=zm(b
00013080: 2c 7b 69 64 3a 72 2c 74 79 70 65 3a 6f 2e 74 79 ,{id:r,type:o.ty
00013090: 70 65 2c 78 3a 75 2e 78 2c 79 3a 75 2e 79 2c 2e pe,x:u.x,y:u.y,.
000130a0: 2e 2e 64 2e 6f 6e 52 65 73 69 7a 65 28 7b 2e 2e ..d.onResize({..
000130b0: 2e 6f 2c 78 3a 6d 2c 79 3a 67 7d 2c 7b 6e 65 77 .o,x:m,y:g},{new
000130c0: 50 6f 69 6e 74 3a 75 2c 68 61 6e 64 6c 65 3a 6e Point:u,handle:n
000130d0: 2e 64 72 61 67 48 61 6e 64 6c 65 3f 3f 22 62 6f .dragHandle??"bo
000130e0: 74 74 6f 6d 5f 72 69 67 68 74 22 2c 6d 6f 64 65 ttom_right",mode
000130f0: 3a 6e 2e 6d 6f 64 65 3f 3f 22 73 63 61 6c 65 5f :n.mode??"scale_
00013100: 73 68 61 70 65 22 2c 73 63 61 6c 65 58 3a 70 2e shape",scaleX:p.
00013110: 78 2c 73 63 61 6c 65 59 3a 70 2e 79 2c 69 6e 69 x,scaleY:p.y,ini
00013120: 74 69 61 6c 42 6f 75 6e 64 73 3a 63 2c 69 6e 69 tialBounds:c,ini
00013130: 74 69 61 6c 53 68 61 70 65 3a 6f 7d 29 7d 29 2c tialShape:o})}),
00013140: 6e 2e 73 6b 69 70 53 74 61 72 74 41 6e 64 45 6e n.skipStartAndEn
00013150: 64 43 61 6c 6c 62 61 63 6b 73 7c 7c 28 62 3d 7a dCallbacks||(b=z
00013160: 6d 28 62 2c 64 2e 6f 6e 52 65 73 69 7a 65 45 6e m(b,d.onResizeEn
00013170: 64 3f 2e 28 6f 2c 62 29 3f 3f 76 6f 69 64 20 30 d?.(o,b)??void 0
00013180: 29 29 2c 74 68 69 73 2e 75 70 64 61 74 65 53 68 )),this.updateSh
00013190: 61 70 65 73 28 5b 62 5d 29 7d 65 6c 73 65 7b 63 apes([b])}else{c
000131a0: 6f 6e 73 74 20 65 3d 77 70 2e 61 70 70 6c 79 54 onst e=wp.applyT
000131b0: 6f 50 6f 69 6e 74 28 61 2c 63 2e 63 65 6e 74 65 oPoint(a,c.cente
000131c0: 72 29 2c 6e 3d 74 68 69 73 2e 5f 73 63 61 6c 65 r),n=this._scale
000131d0: 50 61 67 65 50 6f 69 6e 74 28 65 2c 69 2c 74 2c PagePoint(e,i,t,
000131e0: 6c 29 2c 73 3d 74 68 69 73 2e 67 65 74 50 6f 69 l),s=this.getPoi
000131f0: 6e 74 49 6e 50 61 72 65 6e 74 53 70 61 63 65 28 ntInParentSpace(
00013200: 6f 2e 69 64 2c 65 29 2c 75 3d 74 68 69 73 2e 67 o.id,e),u=this.g
00013210: 65 74 50 6f 69 6e 74 49 6e 50 61 72 65 6e 74 53 etPointInParentS
00013220: 70 61 63 65 28 6f 2e 69 64 2c 6e 29 2c 64 3d 73 pace(o.id,n),d=s
00013230: 75 2e 53 75 62 28 75 2c 73 29 3b 74 68 69 73 2e u.Sub(u,s);this.
00013240: 75 70 64 61 74 65 53 68 61 70 65 73 28 5b 7b 69 updateShapes([{i
00013250: 64 3a 72 2c 74 79 70 65 3a 6f 2e 74 79 70 65 2c d:r,type:o.type,
00013260: 78 3a 6f 2e 78 2b 64 2e 78 2c 79 3a 6f 2e 79 2b x:o.x+d.x,y:o.y+
00013270: 64 2e 79 7d 5d 29 7d 72 65 74 75 72 6e 20 74 68 d.y}])}return th
00013280: 69 73 7d 5f 73 63 61 6c 65 50 61 67 65 50 6f 69 is}_scalePagePoi
00013290: 6e 74 28 65 2c 74 2c 6e 2c 72 29 7b 63 6f 6e 73 nt(e,t,n,r){cons
000132a0: 74 20 6f 3d 73 75 2e 52 6f 74 57 69 74 68 28 65 t o=su.RotWith(e
000132b0: 2c 74 2c 2d 72 29 2e 73 75 62 28 74 29 2c 69 3d ,t,-r).sub(t),i=
000132c0: 73 75 2e 4d 75 6c 56 28 6f 2c 6e 29 3b 72 65 74 su.MulV(o,n);ret
000132d0: 75 72 6e 20 73 75 2e 41 64 64 28 69 2c 74 29 2e urn su.Add(i,t).
000132e0: 72 6f 74 57 69 74 68 28 74 2c 72 29 7d 5f 72 65 rotWith(t,r)}_re
000132f0: 73 69 7a 65 55 6e 61 6c 69 67 6e 65 64 53 68 61 sizeUnalignedSha
00013300: 70 65 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 7b pe(e,t,n){const{
00013310: 74 79 70 65 3a 72 7d 3d 6e 2e 69 6e 69 74 69 61 type:r}=n.initia
00013320: 6c 53 68 61 70 65 2c 6f 3d 6e 65 77 20 73 75 28 lShape,o=new su(
00013330: 74 2e 78 2c 74 2e 79 29 3b 69 66 28 4d 61 74 68 t.x,t.y);if(Math
00013340: 2e 61 62 73 28 74 2e 78 29 3e 4d 61 74 68 2e 61 .abs(t.x)>Math.a
00013350: 62 73 28 74 2e 79 29 3f 6f 2e 78 3d 4d 61 74 68 bs(t.y)?o.x=Math
00013360: 2e 73 69 67 6e 28 74 2e 78 29 2a 4d 61 74 68 2e .sign(t.x)*Math.
00013370: 61 62 73 28 74 2e 79 29 3a 6f 2e 79 3d 4d 61 74 abs(t.y):o.y=Mat
00013380: 68 2e 73 69 67 6e 28 74 2e 79 29 2a 4d 61 74 68 h.sign(t.y)*Math
00013390: 2e 61 62 73 28 74 2e 78 29 2c 74 68 69 73 2e 72 .abs(t.x),this.r
000133a0: 65 73 69 7a 65 53 68 61 70 65 28 65 2c 6f 2c 7b esizeShape(e,o,{
000133b0: 69 6e 69 74 69 61 6c 53 68 61 70 65 3a 6e 2e 69 initialShape:n.i
000133c0: 6e 69 74 69 61 6c 53 68 61 70 65 2c 69 6e 69 74 nitialShape,init
000133d0: 69 61 6c 42 6f 75 6e 64 73 3a 6e 2e 69 6e 69 74 ialBounds:n.init
000133e0: 69 61 6c 42 6f 75 6e 64 73 2c 69 73 41 73 70 65 ialBounds,isAspe
000133f0: 63 74 52 61 74 69 6f 4c 6f 63 6b 65 64 3a 6e 2e ctRatioLocked:n.
00013400: 69 73 41 73 70 65 63 74 52 61 74 69 6f 4c 6f 63 isAspectRatioLoc
00013410: 6b 65 64 7d 29 2c 4d 61 74 68 2e 73 69 67 6e 28 ked}),Math.sign(
00013420: 74 2e 78 29 2a 4d 61 74 68 2e 73 69 67 6e 28 74 t.x)*Math.sign(t
00013430: 2e 79 29 3c 30 29 7b 6c 65 74 7b 72 6f 74 61 74 .y)<0){let{rotat
00013440: 69 6f 6e 3a 74 7d 3d 77 70 2e 44 65 63 6f 6d 70 ion:t}=wp.Decomp
00013450: 6f 73 65 28 6e 2e 69 6e 69 74 69 61 6c 50 61 67 ose(n.initialPag
00013460: 65 54 72 61 6e 73 66 6f 72 6d 29 3b 74 2d 3d 32 eTransform);t-=2
00013470: 2a 74 2c 74 68 69 73 2e 75 70 64 61 74 65 53 68 *t,this.updateSh
00013480: 61 70 65 73 28 5b 7b 69 64 3a 65 2c 74 79 70 65 apes([{id:e,type
00013490: 3a 72 2c 72 6f 74 61 74 69 6f 6e 3a 74 7d 5d 29 :r,rotation:t}])
000134a0: 7d 63 6f 6e 73 74 20 69 3d 77 70 2e 61 70 70 6c }const i=wp.appl
000134b0: 79 54 6f 50 6f 69 6e 74 28 6e 2e 69 6e 69 74 69 yToPoint(n.initi
000134c0: 61 6c 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 2c alPageTransform,
000134d0: 6e 2e 69 6e 69 74 69 61 6c 42 6f 75 6e 64 73 2e n.initialBounds.
000134e0: 63 65 6e 74 65 72 29 2c 61 3d 74 68 69 73 2e 5f center),a=this._
000134f0: 73 63 61 6c 65 50 61 67 65 50 6f 69 6e 74 28 69 scalePagePoint(i
00013500: 2c 6e 2e 73 63 61 6c 65 4f 72 69 67 69 6e 2c 74 ,n.scaleOrigin,t
00013510: 2c 6e 2e 73 63 61 6c 65 41 78 69 73 52 6f 74 61 ,n.scaleAxisRota
00013520: 74 69 6f 6e 29 2c 73 3d 74 68 69 73 2e 67 65 74 tion),s=this.get
00013530: 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 ShapePageBounds(
00013540: 65 29 2c 6c 3d 74 68 69 73 2e 67 65 74 53 68 61 e),l=this.getSha
00013550: 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 pePageTransform(
00013560: 65 29 2c 63 3d 73 2e 63 65 6e 74 65 72 2c 75 3d e),c=s.center,u=
00013570: 6c 2e 70 6f 69 6e 74 28 29 3b 69 66 28 21 63 7c l.point();if(!c|
00013580: 7c 21 75 29 72 65 74 75 72 6e 20 74 68 69 73 3b |!u)return this;
00013590: 63 6f 6e 73 74 20 64 3d 73 75 2e 53 75 62 28 61 const d=su.Sub(a
000135a0: 2c 63 29 2c 70 3d 73 75 2e 41 64 64 28 75 2c 64 ,c),p=su.Add(u,d
000135b0: 29 2c 7b 78 3a 66 2c 79 3a 68 7d 3d 74 68 69 73 ),{x:f,y:h}=this
000135c0: 2e 67 65 74 50 6f 69 6e 74 49 6e 50 61 72 65 6e .getPointInParen
000135d0: 74 53 70 61 63 65 28 65 2c 70 29 3b 72 65 74 75 tSpace(e,p);retu
000135e0: 72 6e 20 74 68 69 73 2e 75 70 64 61 74 65 53 68 rn this.updateSh
000135f0: 61 70 65 73 28 5b 7b 69 64 3a 65 2c 74 79 70 65 apes([{id:e,type
00013600: 3a 72 2c 78 3a 66 2c 79 3a 68 7d 5d 29 2c 74 68 :r,x:f,y:h}]),th
00013610: 69 73 7d 67 65 74 49 6e 69 74 69 61 6c 4d 65 74 is}getInitialMet
00013620: 61 46 6f 72 53 68 61 70 65 28 65 29 7b 72 65 74 aForShape(e){ret
00013630: 75 72 6e 7b 7d 7d 63 72 65 61 74 65 53 68 61 70 urn{}}createShap
00013640: 65 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 e(e){return this
00013650: 2e 63 72 65 61 74 65 53 68 61 70 65 73 28 5b 65 .createShapes([e
00013660: 5d 29 2c 74 68 69 73 7d 63 72 65 61 74 65 53 68 ]),this}createSh
00013670: 61 70 65 73 28 65 29 7b 69 66 28 21 41 72 72 61 apes(e){if(!Arra
00013680: 79 2e 69 73 41 72 72 61 79 28 65 29 29 74 68 72 y.isArray(e))thr
00013690: 6f 77 20 45 72 72 6f 72 28 22 45 64 69 74 6f 72 ow Error("Editor
000136a0: 2e 63 72 65 61 74 65 53 68 61 70 65 73 3a 20 6d .createShapes: m
000136b0: 75 73 74 20 70 72 6f 76 69 64 65 20 61 6e 20 61 ust provide an a
000136c0: 72 72 61 79 20 6f 66 20 73 68 61 70 65 73 20 6f rray of shapes o
000136d0: 72 20 73 68 61 70 65 20 70 61 72 74 69 61 6c 73 r shape partials
000136e0: 22 29 3b 69 66 28 74 68 69 73 2e 67 65 74 49 6e ");if(this.getIn
000136f0: 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 stanceState().is
00013700: 52 65 61 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 Readonly)return
00013710: 74 68 69 73 3b 69 66 28 65 2e 6c 65 6e 67 74 68 this;if(e.length
00013720: 3c 3d 30 29 72 65 74 75 72 6e 20 74 68 69 73 3b <=0)return this;
00013730: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 const t=this.get
00013740: 43 75 72 72 65 6e 74 50 61 67 65 53 68 61 70 65 CurrentPageShape
00013750: 49 64 73 28 29 3b 69 66 28 65 2e 6c 65 6e 67 74 Ids();if(e.lengt
00013760: 68 2b 74 2e 73 69 7a 65 3e 74 68 69 73 2e 6f 70 h+t.size>this.op
00013770: 74 69 6f 6e 73 2e 6d 61 78 53 68 61 70 65 73 50 tions.maxShapesP
00013780: 65 72 50 61 67 65 29 72 65 74 75 72 6e 20 55 6d erPage)return Um
00013790: 28 74 68 69 73 29 2c 74 68 69 73 3b 63 6f 6e 73 (this),this;cons
000137a0: 74 20 6e 3d 74 68 69 73 2e 67 65 74 46 6f 63 75 t n=this.getFocu
000137b0: 73 65 64 47 72 6f 75 70 49 64 28 29 3b 72 65 74 sedGroupId();ret
000137c0: 75 72 6e 20 74 68 69 73 2e 62 61 74 63 68 28 28 urn this.batch((
000137d0: 28 29 3d 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 69 ()=>{const t=thi
000137e0: 73 2e 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 s.getCurrentPage
000137f0: 53 68 61 70 65 73 53 6f 72 74 65 64 28 29 2c 72 ShapesSorted(),r
00013800: 3d 65 2e 6d 61 70 28 28 72 3d 3e 7b 69 66 28 72 =e.map((r=>{if(r
00013810: 2e 69 64 7c 7c 28 72 3d 7b 69 64 3a 49 73 28 29 .id||(r={id:Is()
00013820: 2c 2e 2e 2e 72 7d 29 2c 21 72 2e 70 61 72 65 6e ,...r}),!r.paren
00013830: 74 49 64 7c 7c 21 74 68 69 73 2e 73 74 6f 72 65 tId||!this.store
00013840: 2e 68 61 73 28 72 2e 70 61 72 65 6e 74 49 64 29 .has(r.parentId)
00013850: 26 26 21 65 2e 73 6f 6d 65 28 28 65 3d 3e 65 2e &&!e.some((e=>e.
00013860: 69 64 3d 3d 3d 72 2e 70 61 72 65 6e 74 49 64 29 id===r.parentId)
00013870: 29 29 7b 6c 65 74 20 65 3d 74 68 69 73 2e 67 65 )){let e=this.ge
00013880: 74 46 6f 63 75 73 65 64 47 72 6f 75 70 49 64 28 tFocusedGroupId(
00013890: 29 3b 66 6f 72 28 6c 65 74 20 6e 3d 74 2e 6c 65 );for(let n=t.le
000138a0: 6e 67 74 68 2d 31 3b 6e 3e 3d 30 3b 6e 2d 2d 29 ngth-1;n>=0;n--)
000138b0: 7b 63 6f 6e 73 74 20 6f 3d 74 5b 6e 5d 3b 69 66 {const o=t[n];if
000138c0: 28 74 68 69 73 2e 67 65 74 53 68 61 70 65 55 74 (this.getShapeUt
000138d0: 69 6c 28 6f 29 2e 63 61 6e 52 65 63 65 69 76 65 il(o).canReceive
000138e0: 4e 65 77 43 68 69 6c 64 72 65 6e 4f 66 54 79 70 NewChildrenOfTyp
000138f0: 65 28 6f 2c 72 2e 74 79 70 65 29 26 26 74 68 69 e(o,r.type)&&thi
00013900: 73 2e 69 73 50 6f 69 6e 74 49 6e 53 68 61 70 65 s.isPointInShape
00013910: 28 6f 2c 7b 78 3a 72 2e 78 3f 3f 30 2c 79 3a 72 (o,{x:r.x??0,y:r
00013920: 2e 79 3f 3f 30 7d 2c 7b 6d 61 72 67 69 6e 3a 30 .y??0},{margin:0
00013930: 2c 68 69 74 49 6e 73 69 64 65 3a 21 30 7d 29 29 ,hitInside:!0}))
00013940: 7b 65 3d 6f 2e 69 64 3b 62 72 65 61 6b 7d 7d 63 {e=o.id;break}}c
00013950: 6f 6e 73 74 20 6f 3d 72 2e 70 61 72 65 6e 74 49 onst o=r.parentI
00013960: 64 3b 69 66 28 65 3d 3d 3d 72 2e 69 64 26 26 28 d;if(e===r.id&&(
00013970: 65 3d 6e 29 2c 65 21 3d 3d 6f 26 26 28 28 72 3d e=n),e!==o&&((r=
00013980: 7b 2e 2e 2e 72 7d 29 2e 70 61 72 65 6e 74 49 64 {...r}).parentId
00013990: 3d 65 2c 41 73 28 65 29 29 29 7b 63 6f 6e 73 74 =e,As(e))){const
000139a0: 20 74 3d 74 68 69 73 2e 67 65 74 50 6f 69 6e 74 t=this.getPoint
000139b0: 49 6e 53 68 61 70 65 53 70 61 63 65 28 74 68 69 InShapeSpace(thi
000139c0: 73 2e 67 65 74 53 68 61 70 65 28 65 29 2c 7b 78 s.getShape(e),{x
000139d0: 3a 72 2e 78 3f 3f 30 2c 79 3a 72 2e 79 3f 3f 30 :r.x??0,y:r.y??0
000139e0: 7d 29 3b 72 2e 78 3d 74 2e 78 2c 72 2e 79 3d 74 });r.x=t.x,r.y=t
000139f0: 2e 79 2c 72 2e 72 6f 74 61 74 69 6f 6e 3d 2d 74 .y,r.rotation=-t
00013a00: 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 his.getShapePage
00013a10: 54 72 61 6e 73 66 6f 72 6d 28 65 29 2e 72 6f 74 Transform(e).rot
00013a20: 61 74 69 6f 6e 28 29 2b 28 72 2e 72 6f 74 61 74 ation()+(r.rotat
00013a30: 69 6f 6e 3f 3f 30 29 7d 7d 72 65 74 75 72 6e 20 ion??0)}}return
00013a40: 72 7d 29 29 2c 6f 3d 6e 65 77 20 4d 61 70 2c 69 r})),o=new Map,i
00013a50: 3d 5b 5d 2c 7b 6f 70 61 63 69 74 79 46 6f 72 4e =[],{opacityForN
00013a60: 65 78 74 53 68 61 70 65 3a 61 7d 3d 74 68 69 73 extShape:a}=this
00013a70: 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 .getInstanceStat
00013a80: 65 28 29 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 e();for(const e
00013a90: 6f 66 20 72 29 7b 63 6f 6e 73 74 20 74 3d 74 68 of r){const t=th
00013aa0: 69 73 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 is.getShapeUtil(
00013ab0: 65 29 3b 6c 65 74 20 72 3d 65 2e 69 6e 64 65 78 e);let r=e.index
00013ac0: 3b 69 66 28 21 72 29 7b 63 6f 6e 73 74 20 74 3d ;if(!r){const t=
00013ad0: 65 2e 70 61 72 65 6e 74 49 64 3f 3f 6e 3b 6f 2e e.parentId??n;o.
00013ae0: 68 61 73 28 74 29 7c 7c 6f 2e 73 65 74 28 74 2c has(t)||o.set(t,
00013af0: 74 68 69 73 2e 67 65 74 48 69 67 68 65 73 74 49 this.getHighestI
00013b00: 6e 64 65 78 46 6f 72 50 61 72 65 6e 74 28 74 29 ndexForParent(t)
00013b10: 29 2c 72 3d 6f 2e 67 65 74 28 74 29 2c 6f 2e 73 ),r=o.get(t),o.s
00013b20: 65 74 28 74 2c 47 6f 28 72 29 29 7d 63 6f 6e 73 et(t,Go(r))}cons
00013b30: 74 20 73 3d 74 2e 67 65 74 44 65 66 61 75 6c 74 t s=t.getDefault
00013b40: 50 72 6f 70 73 28 29 3b 66 6f 72 28 63 6f 6e 73 Props();for(cons
00013b50: 74 5b 74 2c 6e 5d 6f 66 20 74 68 69 73 2e 73 74 t[t,n]of this.st
00013b60: 79 6c 65 50 72 6f 70 73 5b 65 2e 74 79 70 65 5d yleProps[e.type]
00013b70: 29 73 5b 6e 5d 3d 74 68 69 73 2e 67 65 74 53 74 )s[n]=this.getSt
00013b80: 79 6c 65 46 6f 72 4e 65 78 74 53 68 61 70 65 28 yleForNextShape(
00013b90: 74 29 3b 6c 65 74 20 6c 3d 74 68 69 73 2e 73 74 t);let l=this.st
00013ba0: 6f 72 65 2e 73 63 68 65 6d 61 2e 74 79 70 65 73 ore.schema.types
00013bb0: 2e 73 68 61 70 65 2e 63 72 65 61 74 65 28 7b 2e .shape.create({.
00013bc0: 2e 2e 65 2c 69 6e 64 65 78 3a 72 2c 6f 70 61 63 ..e,index:r,opac
00013bd0: 69 74 79 3a 65 2e 6f 70 61 63 69 74 79 3f 3f 61 ity:e.opacity??a
00013be0: 2c 70 61 72 65 6e 74 49 64 3a 65 2e 70 61 72 65 ,parentId:e.pare
00013bf0: 6e 74 49 64 3f 3f 6e 2c 70 72 6f 70 73 3a 22 70 ntId??n,props:"p
00013c00: 72 6f 70 73 22 69 6e 20 65 3f 7b 2e 2e 2e 73 2c rops"in e?{...s,
00013c10: 2e 2e 2e 65 2e 70 72 6f 70 73 7d 3a 73 7d 29 3b ...e.props}:s});
00013c20: 69 66 28 76 6f 69 64 20 30 3d 3d 3d 6c 2e 69 6e if(void 0===l.in
00013c30: 64 65 78 29 74 68 72 6f 77 20 45 72 72 6f 72 28 dex)throw Error(
00013c40: 22 6e 6f 20 69 6e 64 65 78 21 22 29 3b 63 6f 6e "no index!");con
00013c50: 73 74 20 63 3d 74 68 69 73 2e 67 65 74 53 68 61 st c=this.getSha
00013c60: 70 65 55 74 69 6c 28 6c 29 2e 6f 6e 42 65 66 6f peUtil(l).onBefo
00013c70: 72 65 43 72 65 61 74 65 3f 2e 28 6c 29 3b 63 26 reCreate?.(l);c&
00013c80: 26 28 6c 3d 63 29 2c 69 2e 70 75 73 68 28 6c 29 &(l=c),i.push(l)
00013c90: 7d 69 2e 66 6f 72 45 61 63 68 28 28 65 3d 3e 7b }i.forEach((e=>{
00013ca0: 65 2e 6d 65 74 61 3d 7b 2e 2e 2e 74 68 69 73 2e e.meta={...this.
00013cb0: 67 65 74 49 6e 69 74 69 61 6c 4d 65 74 61 46 6f getInitialMetaFo
00013cc0: 72 53 68 61 70 65 28 65 29 2c 2e 2e 2e 65 2e 6d rShape(e),...e.m
00013cd0: 65 74 61 7d 7d 29 29 2c 74 68 69 73 2e 73 74 6f eta}})),this.sto
00013ce0: 72 65 2e 70 75 74 28 69 29 7d 29 29 7d 61 6e 69 re.put(i)}))}ani
00013cf0: 6d 61 74 69 6e 67 53 68 61 70 65 73 3d 6e 65 77 matingShapes=new
00013d00: 20 4d 61 70 3b 61 6e 69 6d 61 74 65 53 68 61 70 Map;animateShap
00013d10: 65 28 65 2c 74 3d 7b 61 6e 69 6d 61 74 69 6f 6e e(e,t={animation
00013d20: 3a 47 75 7d 29 7b 72 65 74 75 72 6e 20 74 68 69 :Gu}){return thi
00013d30: 73 2e 61 6e 69 6d 61 74 65 53 68 61 70 65 73 28 s.animateShapes(
00013d40: 5b 65 5d 2c 74 29 7d 61 6e 69 6d 61 74 65 53 68 [e],t)}animateSh
00013d50: 61 70 65 73 28 65 2c 74 3d 7b 61 6e 69 6d 61 74 apes(e,t={animat
00013d60: 69 6f 6e 3a 47 75 7d 29 7b 69 66 28 21 74 2e 61 ion:Gu}){if(!t.a
00013d70: 6e 69 6d 61 74 69 6f 6e 29 72 65 74 75 72 6e 20 nimation)return
00013d80: 74 68 69 73 3b 63 6f 6e 73 74 7b 64 75 72 61 74 this;const{durat
00013d90: 69 6f 6e 3a 6e 3d 35 30 30 2c 65 61 73 69 6e 67 ion:n=500,easing
00013da0: 3a 72 3d 61 75 2e 6c 69 6e 65 61 72 7d 3d 74 2e :r=au.linear}=t.
00013db0: 61 6e 69 6d 61 74 69 6f 6e 2c 6f 3d 46 66 28 29 animation,o=Ff()
00013dc0: 3b 6c 65 74 20 69 2c 61 3d 6e 3b 63 6f 6e 73 74 ;let i,a=n;const
00013dd0: 20 73 3d 5b 5d 3b 6c 65 74 20 6c 2c 63 2c 75 3b s=[];let l,c,u;
00013de0: 66 6f 72 28 6c 65 74 20 74 3d 30 2c 6e 3d 65 2e for(let t=0,n=e.
00013df0: 6c 65 6e 67 74 68 3b 74 3c 6e 3b 74 2b 2b 29 7b length;t<n;t++){
00013e00: 69 66 28 6c 3d 65 5b 74 5d 2c 21 6c 29 63 6f 6e if(l=e[t],!l)con
00013e10: 74 69 6e 75 65 3b 63 3d 7b 70 61 72 74 69 61 6c tinue;c={partial
00013e20: 3a 6c 2c 76 61 6c 75 65 73 3a 5b 5d 7d 3b 63 6f :l,values:[]};co
00013e30: 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 53 68 nst n=this.getSh
00013e40: 61 70 65 28 6c 2e 69 64 29 3b 69 66 28 6e 29 7b ape(l.id);if(n){
00013e50: 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 5b 22 for(const e of["
00013e60: 78 22 2c 22 79 22 2c 22 72 6f 74 61 74 69 6f 6e x","y","rotation
00013e70: 22 5d 29 76 6f 69 64 20 30 21 3d 3d 6c 5b 65 5d "])void 0!==l[e]
00013e80: 26 26 6e 5b 65 5d 21 3d 3d 6c 5b 65 5d 26 26 63 &&n[e]!==l[e]&&c
00013e90: 2e 76 61 6c 75 65 73 2e 70 75 73 68 28 7b 70 72 .values.push({pr
00013ea0: 6f 70 3a 65 2c 66 72 6f 6d 3a 6e 5b 65 5d 2c 74 op:e,from:n[e],t
00013eb0: 6f 3a 6c 5b 65 5d 7d 29 3b 73 2e 70 75 73 68 28 o:l[e]});s.push(
00013ec0: 63 29 2c 74 68 69 73 2e 61 6e 69 6d 61 74 69 6e c),this.animatin
00013ed0: 67 53 68 61 70 65 73 2e 73 65 74 28 6e 2e 69 64 gShapes.set(n.id
00013ee0: 2c 6f 29 7d 7d 63 6f 6e 73 74 20 64 3d 74 3d 3e ,o)}}const d=t=>
00013ef0: 7b 69 66 28 61 2d 3d 74 2c 61 3c 30 29 7b 63 6f {if(a-=t,a<0){co
00013f00: 6e 73 74 7b 61 6e 69 6d 61 74 69 6e 67 53 68 61 nst{animatingSha
00013f10: 70 65 73 3a 74 7d 3d 74 68 69 73 2c 6e 3d 65 2e pes:t}=this,n=e.
00013f20: 66 69 6c 74 65 72 28 28 65 3d 3e 65 26 26 74 2e filter((e=>e&&t.
00013f30: 67 65 74 28 65 2e 69 64 29 3d 3d 3d 6f 29 29 3b get(e.id)===o));
00013f40: 72 65 74 75 72 6e 20 6e 2e 6c 65 6e 67 74 68 26 return n.length&
00013f50: 26 74 68 69 73 2e 75 70 64 61 74 65 53 68 61 70 &this.updateShap
00013f60: 65 73 28 6e 29 2c 76 6f 69 64 20 74 68 69 73 2e es(n),void this.
00013f70: 6f 66 66 28 22 74 69 63 6b 22 2c 64 29 7d 69 3d off("tick",d)}i=
00013f80: 72 28 31 2d 61 2f 6e 29 3b 63 6f 6e 73 74 7b 61 r(1-a/n);const{a
00013f90: 6e 69 6d 61 74 69 6e 67 53 68 61 70 65 73 3a 6c nimatingShapes:l
00013fa0: 7d 3d 74 68 69 73 2c 63 3d 5b 5d 3b 6c 65 74 20 }=this,c=[];let
00013fb0: 70 3b 66 6f 72 28 6c 65 74 20 65 3d 30 2c 74 3d p;for(let e=0,t=
00013fc0: 73 2e 6c 65 6e 67 74 68 3b 65 3c 74 3b 65 2b 2b s.length;e<t;e++
00013fd0: 29 75 3d 73 5b 65 5d 2c 70 3d 6c 2e 67 65 74 28 )u=s[e],p=l.get(
00013fe0: 75 2e 70 61 72 74 69 61 6c 2e 69 64 29 2c 70 3d u.partial.id),p=
00013ff0: 3d 3d 6f 26 26 63 2e 70 75 73 68 28 7b 69 64 3a ==o&&c.push({id:
00014000: 75 2e 70 61 72 74 69 61 6c 2e 69 64 2c 74 79 70 u.partial.id,typ
00014010: 65 3a 75 2e 70 61 72 74 69 61 6c 2e 74 79 70 65 e:u.partial.type
00014020: 2c 2e 2e 2e 75 2e 76 61 6c 75 65 73 2e 72 65 64 ,...u.values.red
00014030: 75 63 65 28 28 28 65 2c 7b 70 72 6f 70 3a 74 2c uce(((e,{prop:t,
00014040: 66 72 6f 6d 3a 6e 2c 74 6f 3a 72 7d 29 3d 3e 28 from:n,to:r})=>(
00014050: 65 5b 74 5d 3d 6e 2b 28 72 2d 6e 29 2a 69 2c 65 e[t]=n+(r-n)*i,e
00014060: 29 29 2c 7b 7d 29 7d 29 3b 74 68 69 73 2e 5f 75 )),{})});this._u
00014070: 70 64 61 74 65 53 68 61 70 65 73 28 63 29 7d 3b pdateShapes(c)};
00014080: 72 65 74 75 72 6e 20 74 68 69 73 2e 6f 6e 28 22 return this.on("
00014090: 74 69 63 6b 22 2c 64 29 2c 74 68 69 73 7d 67 72 tick",d),this}gr
000140a0: 6f 75 70 53 68 61 70 65 73 28 65 2c 74 3d 7b 7d oupShapes(e,t={}
000140b0: 29 7b 63 6f 6e 73 74 7b 67 72 6f 75 70 49 64 3a ){const{groupId:
000140c0: 6e 3d 49 73 28 29 2c 73 65 6c 65 63 74 3a 72 3d n=Is(),select:r=
000140d0: 21 30 7d 3d 74 3b 69 66 28 21 41 72 72 61 79 2e !0}=t;if(!Array.
000140e0: 69 73 41 72 72 61 79 28 65 29 29 74 68 72 6f 77 isArray(e))throw
000140f0: 20 45 72 72 6f 72 28 22 45 64 69 74 6f 72 2e 67 Error("Editor.g
00014100: 72 6f 75 70 53 68 61 70 65 73 3a 20 6d 75 73 74 roupShapes: must
00014110: 20 70 72 6f 76 69 64 65 20 61 6e 20 61 72 72 61 provide an arra
00014120: 79 20 6f 66 20 73 68 61 70 65 73 20 6f 72 20 73 y of shapes or s
00014130: 68 61 70 65 20 69 64 73 22 29 3b 69 66 28 74 68 hape ids");if(th
00014140: 69 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 is.getInstanceSt
00014150: 61 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 ate().isReadonly
00014160: 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f 6e )return this;con
00014170: 73 74 20 6f 3d 22 73 74 72 69 6e 67 22 3d 3d 74 st o="string"==t
00014180: 79 70 65 6f 66 20 65 5b 30 5d 3f 65 3a 65 2e 6d ypeof e[0]?e:e.m
00014190: 61 70 28 28 65 3d 3e 65 2e 69 64 29 29 3b 69 66 ap((e=>e.id));if
000141a0: 28 6f 2e 6c 65 6e 67 74 68 3c 3d 31 29 72 65 74 (o.length<=1)ret
000141b0: 75 72 6e 20 74 68 69 73 3b 63 6f 6e 73 74 20 69 urn this;const i
000141c0: 3d 6a 72 28 74 68 69 73 2e 5f 67 65 74 55 6e 6c =jr(this._getUnl
000141d0: 6f 63 6b 65 64 53 68 61 70 65 49 64 73 28 6f 29 ockedShapeIds(o)
000141e0: 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 67 65 .map((e=>this.ge
000141f0: 74 53 68 61 70 65 28 65 29 29 29 29 2c 61 3d 69 tShape(e)))),a=i
00014200: 2e 73 6f 72 74 28 56 6f 29 2e 6d 61 70 28 28 65 .sort(Vo).map((e
00014210: 3d 3e 65 2e 69 64 29 29 2c 73 3d 5f 70 2e 43 6f =>e.id)),s=_p.Co
00014220: 6d 6d 6f 6e 28 6a 72 28 69 2e 6d 61 70 28 28 65 mmon(jr(i.map((e
00014230: 3d 3e 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 =>this.getShapeP
00014240: 61 67 65 42 6f 75 6e 64 73 28 65 29 29 29 29 29 ageBounds(e)))))
00014250: 2c 7b 78 3a 6c 2c 79 3a 63 7d 3d 73 2e 70 6f 69 ,{x:l,y:c}=s.poi
00014260: 6e 74 2c 75 3d 74 68 69 73 2e 66 69 6e 64 43 6f nt,u=this.findCo
00014270: 6d 6d 6f 6e 41 6e 63 65 73 74 6f 72 28 69 29 3f mmonAncestor(i)?
00014280: 3f 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 ?this.getCurrent
00014290: 50 61 67 65 49 64 28 29 3b 69 66 28 22 73 65 6c PageId();if("sel
000142a0: 65 63 74 22 21 3d 3d 74 68 69 73 2e 67 65 74 43 ect"!==this.getC
000142b0: 75 72 72 65 6e 74 54 6f 6f 6c 49 64 28 29 29 72 urrentToolId())r
000142c0: 65 74 75 72 6e 20 74 68 69 73 3b 74 68 69 73 2e eturn this;this.
000142d0: 69 73 49 6e 28 22 73 65 6c 65 63 74 2e 69 64 6c isIn("select.idl
000142e0: 65 22 29 7c 7c 74 68 69 73 2e 63 61 6e 63 65 6c e")||this.cancel
000142f0: 28 29 3b 63 6f 6e 73 74 20 64 3d 69 2e 66 69 6c ();const d=i.fil
00014300: 74 65 72 28 28 65 3d 3e 65 2e 70 61 72 65 6e 74 ter((e=>e.parent
00014310: 49 64 3d 3d 3d 75 29 29 2e 73 6f 72 74 28 56 6f Id===u)).sort(Vo
00014320: 29 2c 70 3d 64 5b 64 2e 6c 65 6e 67 74 68 2d 31 ),p=d[d.length-1
00014330: 5d 3f 2e 69 6e 64 65 78 3b 72 65 74 75 72 6e 20 ]?.index;return
00014340: 74 68 69 73 2e 62 61 74 63 68 28 28 28 29 3d 3e this.batch((()=>
00014350: 7b 74 68 69 73 2e 63 72 65 61 74 65 53 68 61 70 {this.createShap
00014360: 65 73 28 5b 7b 69 64 3a 6e 2c 74 79 70 65 3a 22 es([{id:n,type:"
00014370: 67 72 6f 75 70 22 2c 70 61 72 65 6e 74 49 64 3a group",parentId:
00014380: 75 2c 69 6e 64 65 78 3a 70 2c 78 3a 6c 2c 79 3a u,index:p,x:l,y:
00014390: 63 2c 6f 70 61 63 69 74 79 3a 31 2c 70 72 6f 70 c,opacity:1,prop
000143a0: 73 3a 7b 7d 7d 5d 29 2c 74 68 69 73 2e 72 65 70 s:{}}]),this.rep
000143b0: 61 72 65 6e 74 53 68 61 70 65 73 28 61 2c 6e 29 arentShapes(a,n)
000143c0: 2c 72 26 26 74 68 69 73 2e 73 65 6c 65 63 74 28 ,r&&this.select(
000143d0: 6e 29 7d 29 29 2c 74 68 69 73 7d 75 6e 67 72 6f n)})),this}ungro
000143e0: 75 70 53 68 61 70 65 73 28 65 2c 74 3d 7b 7d 29 upShapes(e,t={})
000143f0: 7b 63 6f 6e 73 74 7b 73 65 6c 65 63 74 3a 6e 3d {const{select:n=
00014400: 21 30 7d 3d 74 2c 72 3d 22 73 74 72 69 6e 67 22 !0}=t,r="string"
00014410: 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f 65 3a ==typeof e[0]?e:
00014420: 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 29 e.map((e=>e.id))
00014430: 3b 69 66 28 74 68 69 73 2e 67 65 74 49 6e 73 74 ;if(this.getInst
00014440: 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 anceState().isRe
00014450: 61 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 74 68 adonly)return th
00014460: 69 73 3b 69 66 28 30 3d 3d 3d 72 2e 6c 65 6e 67 is;if(0===r.leng
00014470: 74 68 29 72 65 74 75 72 6e 20 74 68 69 73 3b 69 th)return this;i
00014480: 66 28 22 73 65 6c 65 63 74 22 21 3d 3d 74 68 69 f("select"!==thi
00014490: 73 2e 67 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c s.getCurrentTool
000144a0: 49 64 28 29 29 72 65 74 75 72 6e 20 74 68 69 73 Id())return this
000144b0: 3b 74 68 69 73 2e 69 73 49 6e 28 22 73 65 6c 65 ;this.isIn("sele
000144c0: 63 74 2e 69 64 6c 65 22 29 7c 7c 74 68 69 73 2e ct.idle")||this.
000144d0: 63 61 6e 63 65 6c 28 29 3b 63 6f 6e 73 74 20 6f cancel();const o
000144e0: 3d 6e 65 77 20 53 65 74 2c 69 3d 5b 5d 3b 72 65 =new Set,i=[];re
000144f0: 74 75 72 6e 20 6a 72 28 72 2e 6d 61 70 28 28 65 turn jr(r.map((e
00014500: 3d 3e 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 =>this.getShape(
00014510: 65 29 29 29 29 2e 66 6f 72 45 61 63 68 28 28 65 e)))).forEach((e
00014520: 3d 3e 7b 74 68 69 73 2e 69 73 53 68 61 70 65 4f =>{this.isShapeO
00014530: 66 54 79 70 65 28 65 2c 22 67 72 6f 75 70 22 29 fType(e,"group")
00014540: 3f 69 2e 70 75 73 68 28 65 29 3a 6f 2e 61 64 64 ?i.push(e):o.add
00014550: 28 65 2e 69 64 29 7d 29 29 2c 30 3d 3d 3d 69 2e (e.id)})),0===i.
00014560: 6c 65 6e 67 74 68 7c 7c 74 68 69 73 2e 62 61 74 length||this.bat
00014570: 63 68 28 28 28 29 3d 3e 7b 6c 65 74 20 65 3b 66 ch((()=>{let e;f
00014580: 6f 72 28 6c 65 74 20 74 3d 30 2c 6e 3d 69 2e 6c or(let t=0,n=i.l
00014590: 65 6e 67 74 68 3b 74 3c 6e 3b 74 2b 2b 29 7b 65 ength;t<n;t++){e
000145a0: 3d 69 5b 74 5d 3b 63 6f 6e 73 74 20 6e 3d 74 68 =i[t];const n=th
000145b0: 69 73 2e 67 65 74 53 6f 72 74 65 64 43 68 69 6c is.getSortedChil
000145c0: 64 49 64 73 46 6f 72 50 61 72 65 6e 74 28 65 2e dIdsForParent(e.
000145d0: 69 64 29 3b 66 6f 72 28 6c 65 74 20 65 3d 30 2c id);for(let e=0,
000145e0: 74 3d 6e 2e 6c 65 6e 67 74 68 3b 65 3c 74 3b 65 t=n.length;e<t;e
000145f0: 2b 2b 29 6f 2e 61 64 64 28 6e 5b 65 5d 29 3b 74 ++)o.add(n[e]);t
00014600: 68 69 73 2e 72 65 70 61 72 65 6e 74 53 68 61 70 his.reparentShap
00014610: 65 73 28 6e 2c 65 2e 70 61 72 65 6e 74 49 64 2c es(n,e.parentId,
00014620: 65 2e 69 6e 64 65 78 29 7d 74 68 69 73 2e 64 65 e.index)}this.de
00014630: 6c 65 74 65 53 68 61 70 65 73 28 69 2e 6d 61 70 leteShapes(i.map
00014640: 28 28 65 3d 3e 65 2e 69 64 29 29 29 2c 6e 26 26 ((e=>e.id))),n&&
00014650: 74 68 69 73 2e 73 65 6c 65 63 74 28 2e 2e 2e 6f this.select(...o
00014660: 29 7d 29 29 2c 74 68 69 73 7d 75 70 64 61 74 65 )})),this}update
00014670: 53 68 61 70 65 28 65 29 7b 72 65 74 75 72 6e 20 Shape(e){return
00014680: 74 68 69 73 2e 75 70 64 61 74 65 53 68 61 70 65 this.updateShape
00014690: 73 28 5b 65 5d 29 2c 74 68 69 73 7d 75 70 64 61 s([e]),this}upda
000146a0: 74 65 53 68 61 70 65 73 28 65 29 7b 63 6f 6e 73 teShapes(e){cons
000146b0: 74 20 74 3d 41 72 72 61 79 28 65 2e 6c 65 6e 67 t t=Array(e.leng
000146c0: 74 68 29 3b 66 6f 72 28 6c 65 74 20 6e 3d 30 2c th);for(let n=0,
000146d0: 72 3d 65 2e 6c 65 6e 67 74 68 3b 6e 3c 72 3b 6e r=e.length;n<r;n
000146e0: 2b 2b 29 7b 63 6f 6e 73 74 20 72 3d 65 5b 6e 5d ++){const r=e[n]
000146f0: 3b 69 66 28 21 72 29 63 6f 6e 74 69 6e 75 65 3b ;if(!r)continue;
00014700: 63 6f 6e 73 74 20 6f 3d 74 68 69 73 2e 67 65 74 const o=this.get
00014710: 53 68 61 70 65 28 72 2e 69 64 29 3b 6f 26 26 28 Shape(r.id);o&&(
00014720: 74 68 69 73 2e 69 73 53 68 61 70 65 4f 72 41 6e this.isShapeOrAn
00014730: 63 65 73 74 6f 72 4c 6f 63 6b 65 64 28 6f 29 26 cestorLocked(o)&
00014740: 26 21 4f 62 6a 65 63 74 2e 68 61 73 4f 77 6e 28 &!Object.hasOwn(
00014750: 72 2c 22 69 73 4c 6f 63 6b 65 64 22 29 7c 7c 28 r,"isLocked")||(
00014760: 74 68 69 73 2e 61 6e 69 6d 61 74 69 6e 67 53 68 this.animatingSh
00014770: 61 70 65 73 2e 64 65 6c 65 74 65 28 72 2e 69 64 apes.delete(r.id
00014780: 29 2c 74 2e 70 75 73 68 28 72 29 29 29 7d 72 65 ),t.push(r)))}re
00014790: 74 75 72 6e 20 74 68 69 73 2e 5f 75 70 64 61 74 turn this._updat
000147a0: 65 53 68 61 70 65 73 28 74 29 2c 74 68 69 73 7d eShapes(t),this}
000147b0: 5f 75 70 64 61 74 65 53 68 61 70 65 73 3d 65 3d _updateShapes=e=
000147c0: 3e 7b 74 68 69 73 2e 67 65 74 49 6e 73 74 61 6e >{this.getInstan
000147d0: 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 64 ceState().isRead
000147e0: 6f 6e 6c 79 7c 7c 74 68 69 73 2e 62 61 74 63 68 only||this.batch
000147f0: 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 20 74 3d 5b ((()=>{const t=[
00014800: 5d 3b 6c 65 74 20 6e 2c 72 3b 66 6f 72 28 6c 65 ];let n,r;for(le
00014810: 74 20 6f 3d 30 2c 69 3d 65 2e 6c 65 6e 67 74 68 t o=0,i=e.length
00014820: 3b 6f 3c 69 3b 6f 2b 2b 29 7b 63 6f 6e 73 74 20 ;o<i;o++){const
00014830: 69 3d 65 5b 6f 5d 3b 69 26 26 28 6e 3d 74 68 69 i=e[o];i&&(n=thi
00014840: 73 2e 67 65 74 53 68 61 70 65 28 69 2e 69 64 29 s.getShape(i.id)
00014850: 2c 6e 26 26 28 72 3d 7a 6d 28 6e 2c 69 29 2c 72 ,n&&(r=zm(n,i),r
00014860: 21 3d 3d 6e 26 26 28 72 3d 74 68 69 73 2e 67 65 !==n&&(r=this.ge
00014870: 74 53 68 61 70 65 55 74 69 6c 28 6e 29 2e 6f 6e tShapeUtil(n).on
00014880: 42 65 66 6f 72 65 55 70 64 61 74 65 3f 2e 28 6e BeforeUpdate?.(n
00014890: 2c 72 29 3f 3f 72 2c 74 2e 70 75 73 68 28 72 29 ,r)??r,t.push(r)
000148a0: 29 29 29 7d 74 68 69 73 2e 73 74 6f 72 65 2e 70 )))}this.store.p
000148b0: 75 74 28 74 29 7d 29 29 7d 3b 5f 67 65 74 55 6e ut(t)}))};_getUn
000148c0: 6c 6f 63 6b 65 64 53 68 61 70 65 49 64 73 28 65 lockedShapeIds(e
000148d0: 29 7b 72 65 74 75 72 6e 20 65 2e 66 69 6c 74 65 ){return e.filte
000148e0: 72 28 28 65 3d 3e 21 74 68 69 73 2e 67 65 74 53 r((e=>!this.getS
000148f0: 68 61 70 65 28 65 29 3f 2e 69 73 4c 6f 63 6b 65 hape(e)?.isLocke
00014900: 64 29 29 7d 64 65 6c 65 74 65 53 68 61 70 65 73 d))}deleteShapes
00014910: 28 65 29 7b 69 66 28 21 41 72 72 61 79 2e 69 73 (e){if(!Array.is
00014920: 41 72 72 61 79 28 65 29 29 74 68 72 6f 77 20 45 Array(e))throw E
00014930: 72 72 6f 72 28 22 45 64 69 74 6f 72 2e 64 65 6c rror("Editor.del
00014940: 65 74 65 53 68 61 70 65 73 3a 20 6d 75 73 74 20 eteShapes: must
00014950: 70 72 6f 76 69 64 65 20 61 6e 20 61 72 72 61 79 provide an array
00014960: 20 6f 66 20 73 68 61 70 65 73 20 6f 72 20 73 68 of shapes or sh
00014970: 61 70 65 49 64 73 22 29 3b 63 6f 6e 73 74 20 74 apeIds");const t
00014980: 3d 74 68 69 73 2e 5f 67 65 74 55 6e 6c 6f 63 6b =this._getUnlock
00014990: 65 64 53 68 61 70 65 49 64 73 28 22 73 74 72 69 edShapeIds("stri
000149a0: 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d ng"==typeof e[0]
000149b0: 3f 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 ?e:e.map((e=>e.i
000149c0: 64 29 29 29 3b 69 66 28 74 68 69 73 2e 67 65 74 d)));if(this.get
000149d0: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e InstanceState().
000149e0: 69 73 52 65 61 64 6f 6e 6c 79 29 72 65 74 75 72 isReadonly)retur
000149f0: 6e 20 74 68 69 73 3b 69 66 28 30 3d 3d 3d 74 2e n this;if(0===t.
00014a00: 6c 65 6e 67 74 68 29 72 65 74 75 72 6e 20 74 68 length)return th
00014a10: 69 73 3b 63 6f 6e 73 74 20 6e 3d 6e 65 77 20 53 is;const n=new S
00014a20: 65 74 28 74 29 3b 66 6f 72 28 63 6f 6e 73 74 20 et(t);for(const
00014a30: 65 20 6f 66 20 74 29 74 68 69 73 2e 76 69 73 69 e of t)this.visi
00014a40: 74 44 65 73 63 65 6e 64 61 6e 74 73 28 65 2c 28 tDescendants(e,(
00014a50: 65 3d 3e 7b 6e 2e 61 64 64 28 65 29 7d 29 29 3b e=>{n.add(e)}));
00014a60: 63 6f 6e 73 74 20 72 3d 5b 2e 2e 2e 6e 5d 3b 72 const r=[...n];r
00014a70: 65 74 75 72 6e 20 74 68 69 73 2e 62 61 74 63 68 eturn this.batch
00014a80: 28 28 28 29 3d 3e 74 68 69 73 2e 73 74 6f 72 65 ((()=>this.store
00014a90: 2e 72 65 6d 6f 76 65 28 72 29 29 29 7d 64 65 6c .remove(r)))}del
00014aa0: 65 74 65 53 68 61 70 65 28 65 29 7b 72 65 74 75 eteShape(e){retu
00014ab0: 72 6e 20 74 68 69 73 2e 64 65 6c 65 74 65 53 68 rn this.deleteSh
00014ac0: 61 70 65 73 28 5b 22 73 74 72 69 6e 67 22 3d 3d apes(["string"==
00014ad0: 74 79 70 65 6f 66 20 65 3f 65 3a 65 2e 69 64 5d typeof e?e:e.id]
00014ae0: 29 2c 74 68 69 73 7d 5f 65 78 74 72 61 63 74 53 ),this}_extractS
00014af0: 68 61 72 65 64 53 74 79 6c 65 73 28 65 2c 74 29 haredStyles(e,t)
00014b00: 7b 69 66 28 74 68 69 73 2e 69 73 53 68 61 70 65 {if(this.isShape
00014b10: 4f 66 54 79 70 65 28 65 2c 22 67 72 6f 75 70 22 OfType(e,"group"
00014b20: 29 29 7b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e )){const n=this.
00014b30: 5f 70 61 72 65 6e 74 49 64 73 54 6f 43 68 69 6c _parentIdsToChil
00014b40: 64 49 64 73 2e 67 65 74 28 29 5b 65 2e 69 64 5d dIds.get()[e.id]
00014b50: 3b 69 66 28 21 6e 29 72 65 74 75 72 6e 3b 66 6f ;if(!n)return;fo
00014b60: 72 28 6c 65 74 20 65 3d 30 2c 72 3d 6e 2e 6c 65 r(let e=0,r=n.le
00014b70: 6e 67 74 68 3b 65 3c 72 3b 65 2b 2b 29 74 68 69 ngth;e<r;e++)thi
00014b80: 73 2e 5f 65 78 74 72 61 63 74 53 68 61 72 65 64 s._extractShared
00014b90: 53 74 79 6c 65 73 28 74 68 69 73 2e 67 65 74 53 Styles(this.getS
00014ba0: 68 61 70 65 28 6e 5b 65 5d 29 2c 74 29 7d 65 6c hape(n[e]),t)}el
00014bb0: 73 65 20 66 6f 72 28 63 6f 6e 73 74 5b 6e 2c 72 se for(const[n,r
00014bc0: 5d 6f 66 20 74 68 69 73 2e 73 74 79 6c 65 50 72 ]of this.stylePr
00014bd0: 6f 70 73 5b 65 2e 74 79 70 65 5d 29 74 2e 61 70 ops[e.type])t.ap
00014be0: 70 6c 79 56 61 6c 75 65 28 6e 2c 79 6f 28 65 2e plyValue(n,yo(e.
00014bf0: 70 72 6f 70 73 2c 72 29 29 7d 5f 67 65 74 53 65 props,r))}_getSe
00014c00: 6c 65 63 74 69 6f 6e 53 68 61 72 65 64 53 74 79 lectionSharedSty
00014c10: 6c 65 73 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 les(){const e=th
00014c20: 69 73 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 is.getSelectedSh
00014c30: 61 70 65 73 28 29 2c 74 3d 6e 65 77 20 42 68 3b apes(),t=new Bh;
00014c40: 66 6f 72 28 63 6f 6e 73 74 20 6e 20 6f 66 20 65 for(const n of e
00014c50: 29 74 68 69 73 2e 5f 65 78 74 72 61 63 74 53 68 )this._extractSh
00014c60: 61 72 65 64 53 74 79 6c 65 73 28 6e 2c 74 29 3b aredStyles(n,t);
00014c70: 72 65 74 75 72 6e 20 74 7d 67 65 74 53 74 79 6c return t}getStyl
00014c80: 65 46 6f 72 4e 65 78 74 53 68 61 70 65 28 65 29 eForNextShape(e)
00014c90: 7b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 {const t=this.ge
00014ca0: 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 tInstanceState()
00014cb0: 2e 73 74 79 6c 65 73 46 6f 72 4e 65 78 74 53 68 .stylesForNextSh
00014cc0: 61 70 65 5b 65 2e 69 64 5d 3b 72 65 74 75 72 6e ape[e.id];return
00014cd0: 20 76 6f 69 64 20 30 3d 3d 3d 74 3f 65 2e 64 65 void 0===t?e.de
00014ce0: 66 61 75 6c 74 56 61 6c 75 65 3a 74 7d 67 65 74 faultValue:t}get
00014cf0: 53 68 61 70 65 53 74 79 6c 65 49 66 45 78 69 73 ShapeStyleIfExis
00014d00: 74 73 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d ts(e,t){const n=
00014d10: 74 68 69 73 2e 73 74 79 6c 65 50 72 6f 70 73 5b this.styleProps[
00014d20: 65 2e 74 79 70 65 5d 2e 67 65 74 28 74 29 3b 69 e.type].get(t);i
00014d30: 66 28 76 6f 69 64 20 30 21 3d 3d 6e 29 72 65 74 f(void 0!==n)ret
00014d40: 75 72 6e 20 79 6f 28 65 2e 70 72 6f 70 73 2c 6e urn yo(e.props,n
00014d50: 29 7d 67 65 74 53 68 61 72 65 64 53 74 79 6c 65 )}getSharedStyle
00014d60: 73 28 29 7b 69 66 28 74 68 69 73 2e 69 73 49 6e s(){if(this.isIn
00014d70: 28 22 73 65 6c 65 63 74 22 29 26 26 74 68 69 73 ("select")&&this
00014d80: 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 .getSelectedShap
00014d90: 65 49 64 73 28 29 2e 6c 65 6e 67 74 68 3e 30 29 eIds().length>0)
00014da0: 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 67 65 74 return this._get
00014db0: 53 65 6c 65 63 74 69 6f 6e 53 68 61 72 65 64 53 SelectionSharedS
00014dc0: 74 79 6c 65 73 28 29 3b 63 6f 6e 73 74 20 65 3d tyles();const e=
00014dd0: 74 68 69 73 2e 72 6f 6f 74 2e 67 65 74 43 75 72 this.root.getCur
00014de0: 72 65 6e 74 28 29 2c 74 3d 6e 65 77 20 42 68 3b rent(),t=new Bh;
00014df0: 69 66 28 21 65 29 72 65 74 75 72 6e 20 74 3b 69 if(!e)return t;i
00014e00: 66 28 65 2e 73 68 61 70 65 54 79 70 65 29 66 6f f(e.shapeType)fo
00014e10: 72 28 63 6f 6e 73 74 20 6e 20 6f 66 20 74 68 69 r(const n of thi
00014e20: 73 2e 73 74 79 6c 65 50 72 6f 70 73 5b 65 2e 73 s.styleProps[e.s
00014e30: 68 61 70 65 54 79 70 65 5d 2e 6b 65 79 73 28 29 hapeType].keys()
00014e40: 29 74 2e 61 70 70 6c 79 56 61 6c 75 65 28 6e 2c )t.applyValue(n,
00014e50: 74 68 69 73 2e 67 65 74 53 74 79 6c 65 46 6f 72 this.getStyleFor
00014e60: 4e 65 78 74 53 68 61 70 65 28 6e 29 29 3b 72 65 NextShape(n));re
00014e70: 74 75 72 6e 20 74 7d 67 65 74 53 68 61 72 65 64 turn t}getShared
00014e80: 4f 70 61 63 69 74 79 28 29 7b 69 66 28 74 68 69 Opacity(){if(thi
00014e90: 73 2e 69 73 49 6e 28 22 73 65 6c 65 63 74 22 29 s.isIn("select")
00014ea0: 26 26 74 68 69 73 2e 67 65 74 53 65 6c 65 63 74 &&this.getSelect
00014eb0: 65 64 53 68 61 70 65 49 64 73 28 29 2e 6c 65 6e edShapeIds().len
00014ec0: 67 74 68 3e 30 29 7b 63 6f 6e 73 74 20 65 3d 5b gth>0){const e=[
00014ed0: 5d 2c 74 3d 6e 3d 3e 7b 63 6f 6e 73 74 20 72 3d ],t=n=>{const r=
00014ee0: 74 68 69 73 2e 67 65 74 53 68 61 70 65 28 6e 29 this.getShape(n)
00014ef0: 3b 69 66 28 72 29 69 66 28 74 68 69 73 2e 69 73 ;if(r)if(this.is
00014f00: 53 68 61 70 65 4f 66 54 79 70 65 28 72 2c 22 67 ShapeOfType(r,"g
00014f10: 72 6f 75 70 22 29 29 66 6f 72 28 63 6f 6e 73 74 roup"))for(const
00014f20: 20 65 20 6f 66 20 74 68 69 73 2e 67 65 74 53 6f e of this.getSo
00014f30: 72 74 65 64 43 68 69 6c 64 49 64 73 46 6f 72 50 rtedChildIdsForP
00014f40: 61 72 65 6e 74 28 72 2e 69 64 29 29 74 28 65 29 arent(r.id))t(e)
00014f50: 3b 65 6c 73 65 20 65 2e 70 75 73 68 28 72 29 7d ;else e.push(r)}
00014f60: 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 ;for(const e of
00014f70: 74 68 69 73 2e 67 65 74 53 65 6c 65 63 74 65 64 this.getSelected
00014f80: 53 68 61 70 65 49 64 73 28 29 29 74 28 65 29 3b ShapeIds())t(e);
00014f90: 6c 65 74 20 6e 3d 6e 75 6c 6c 3b 66 6f 72 28 63 let n=null;for(c
00014fa0: 6f 6e 73 74 20 74 20 6f 66 20 65 29 69 66 28 6e onst t of e)if(n
00014fb0: 75 6c 6c 3d 3d 3d 6e 29 6e 3d 74 2e 6f 70 61 63 ull===n)n=t.opac
00014fc0: 69 74 79 3b 65 6c 73 65 20 69 66 28 6e 21 3d 3d ity;else if(n!==
00014fd0: 74 2e 6f 70 61 63 69 74 79 29 72 65 74 75 72 6e t.opacity)return
00014fe0: 7b 74 79 70 65 3a 22 6d 69 78 65 64 22 7d 3b 69 {type:"mixed"};i
00014ff0: 66 28 6e 75 6c 6c 21 3d 3d 6e 29 72 65 74 75 72 f(null!==n)retur
00015000: 6e 7b 74 79 70 65 3a 22 73 68 61 72 65 64 22 2c n{type:"shared",
00015010: 76 61 6c 75 65 3a 6e 7d 7d 72 65 74 75 72 6e 7b value:n}}return{
00015020: 74 79 70 65 3a 22 73 68 61 72 65 64 22 2c 76 61 type:"shared",va
00015030: 6c 75 65 3a 74 68 69 73 2e 67 65 74 49 6e 73 74 lue:this.getInst
00015040: 61 6e 63 65 53 74 61 74 65 28 29 2e 6f 70 61 63 anceState().opac
00015050: 69 74 79 46 6f 72 4e 65 78 74 53 68 61 70 65 7d ityForNextShape}
00015060: 7d 73 65 74 4f 70 61 63 69 74 79 46 6f 72 4e 65 }setOpacityForNe
00015070: 78 74 53 68 61 70 65 73 28 65 2c 74 29 7b 72 65 xtShapes(e,t){re
00015080: 74 75 72 6e 20 74 68 69 73 2e 75 70 64 61 74 65 turn this.update
00015090: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 7b 6f InstanceState({o
000150a0: 70 61 63 69 74 79 46 6f 72 4e 65 78 74 53 68 61 pacityForNextSha
000150b0: 70 65 3a 65 7d 2c 74 29 2c 74 68 69 73 7d 73 65 pe:e},t),this}se
000150c0: 74 4f 70 61 63 69 74 79 46 6f 72 53 65 6c 65 63 tOpacityForSelec
000150d0: 74 65 64 53 68 61 70 65 73 28 65 29 7b 63 6f 6e tedShapes(e){con
000150e0: 73 74 20 74 3d 74 68 69 73 2e 67 65 74 53 65 6c st t=this.getSel
000150f0: 65 63 74 65 64 53 68 61 70 65 73 28 29 3b 69 66 ectedShapes();if
00015100: 28 74 2e 6c 65 6e 67 74 68 3e 30 29 7b 63 6f 6e (t.length>0){con
00015110: 73 74 20 6e 3d 5b 5d 2c 72 3d 65 3d 3e 7b 69 66 st n=[],r=e=>{if
00015120: 28 74 68 69 73 2e 69 73 53 68 61 70 65 4f 66 54 (this.isShapeOfT
00015130: 79 70 65 28 65 2c 22 67 72 6f 75 70 22 29 29 7b ype(e,"group")){
00015140: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 67 65 74 const t=this.get
00015150: 53 6f 72 74 65 64 43 68 69 6c 64 49 64 73 46 6f SortedChildIdsFo
00015160: 72 50 61 72 65 6e 74 28 65 29 3b 66 6f 72 28 63 rParent(e);for(c
00015170: 6f 6e 73 74 20 65 20 6f 66 20 74 29 72 28 74 68 onst e of t)r(th
00015180: 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 29 7d is.getShape(e))}
00015190: 65 6c 73 65 20 6e 2e 70 75 73 68 28 65 29 7d 3b else n.push(e)};
000151a0: 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 74 for(const e of t
000151b0: 29 72 28 65 29 3b 74 68 69 73 2e 75 70 64 61 74 )r(e);this.updat
000151c0: 65 53 68 61 70 65 73 28 6e 2e 6d 61 70 28 28 74 eShapes(n.map((t
000151d0: 3d 3e 28 7b 69 64 3a 74 2e 69 64 2c 74 79 70 65 =>({id:t.id,type
000151e0: 3a 74 2e 74 79 70 65 2c 6f 70 61 63 69 74 79 3a :t.type,opacity:
000151f0: 65 7d 29 29 29 29 7d 72 65 74 75 72 6e 20 74 68 e}))))}return th
00015200: 69 73 7d 73 65 74 53 74 79 6c 65 46 6f 72 4e 65 is}setStyleForNe
00015210: 78 74 53 68 61 70 65 73 28 65 2c 74 2c 6e 29 7b xtShapes(e,t,n){
00015220: 63 6f 6e 73 74 20 72 3d 74 68 69 73 2e 67 65 74 const r=this.get
00015230: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e InstanceState().
00015240: 73 74 79 6c 65 73 46 6f 72 4e 65 78 74 53 68 61 stylesForNextSha
00015250: 70 65 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 75 pe;return this.u
00015260: 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 61 pdateInstanceSta
00015270: 74 65 28 7b 73 74 79 6c 65 73 46 6f 72 4e 65 78 te({stylesForNex
00015280: 74 53 68 61 70 65 3a 7b 2e 2e 2e 72 2c 5b 65 2e tShape:{...r,[e.
00015290: 69 64 5d 3a 74 7d 7d 2c 6e 29 2c 74 68 69 73 7d id]:t}},n),this}
000152a0: 73 65 74 53 74 79 6c 65 46 6f 72 53 65 6c 65 63 setStyleForSelec
000152b0: 74 65 64 53 68 61 70 65 73 28 65 2c 74 29 7b 63 tedShapes(e,t){c
000152c0: 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 67 65 74 53 onst n=this.getS
000152d0: 65 6c 65 63 74 65 64 53 68 61 70 65 73 28 29 3b electedShapes();
000152e0: 69 66 28 6e 2e 6c 65 6e 67 74 68 3e 30 29 7b 63 if(n.length>0){c
000152f0: 6f 6e 73 74 20 72 3d 5b 5d 2c 6f 3d 6e 3d 3e 7b onst r=[],o=n=>{
00015300: 69 66 28 74 68 69 73 2e 69 73 53 68 61 70 65 4f if(this.isShapeO
00015310: 66 54 79 70 65 28 6e 2c 22 67 72 6f 75 70 22 29 fType(n,"group")
00015320: 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 ){const e=this.g
00015330: 65 74 53 6f 72 74 65 64 43 68 69 6c 64 49 64 73 etSortedChildIds
00015340: 46 6f 72 50 61 72 65 6e 74 28 6e 2e 69 64 29 3b ForParent(n.id);
00015350: 66 6f 72 28 63 6f 6e 73 74 20 74 20 6f 66 20 65 for(const t of e
00015360: 29 6f 28 74 68 69 73 2e 67 65 74 53 68 61 70 65 )o(this.getShape
00015370: 28 74 29 29 7d 65 6c 73 65 7b 63 6f 6e 73 74 20 (t))}else{const
00015380: 6f 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 55 o=this.getShapeU
00015390: 74 69 6c 28 6e 29 2c 69 3d 74 68 69 73 2e 73 74 til(n),i=this.st
000153a0: 79 6c 65 50 72 6f 70 73 5b 6e 2e 74 79 70 65 5d yleProps[n.type]
000153b0: 2e 67 65 74 28 65 29 3b 69 66 28 69 29 7b 63 6f .get(e);if(i){co
000153c0: 6e 73 74 20 65 3d 7b 69 64 3a 6e 2e 69 64 2c 74 nst e={id:n.id,t
000153d0: 79 70 65 3a 6e 2e 74 79 70 65 2c 70 72 6f 70 73 ype:n.type,props
000153e0: 3a 7b 5b 69 5d 3a 74 7d 7d 3b 72 2e 70 75 73 68 :{[i]:t}};r.push
000153f0: 28 7b 75 74 69 6c 3a 6f 2c 6f 72 69 67 69 6e 61 ({util:o,origina
00015400: 6c 53 68 61 70 65 3a 6e 2c 75 70 64 61 74 65 50 lShape:n,updateP
00015410: 61 72 74 69 61 6c 3a 65 7d 29 7d 7d 7d 3b 66 6f artial:e})}}};fo
00015420: 72 28 63 6f 6e 73 74 20 65 20 6f 66 20 6e 29 6f r(const e of n)o
00015430: 28 65 29 3b 74 68 69 73 2e 75 70 64 61 74 65 53 (e);this.updateS
00015440: 68 61 70 65 73 28 72 2e 6d 61 70 28 28 28 7b 75 hapes(r.map((({u
00015450: 70 64 61 74 65 50 61 72 74 69 61 6c 3a 65 7d 29 pdatePartial:e})
00015460: 3d 3e 65 29 29 29 7d 72 65 74 75 72 6e 20 74 68 =>e)))}return th
00015470: 69 73 7d 65 78 74 65 72 6e 61 6c 41 73 73 65 74 is}externalAsset
00015480: 43 6f 6e 74 65 6e 74 48 61 6e 64 6c 65 72 73 3d ContentHandlers=
00015490: 7b 66 69 6c 65 3a 6e 75 6c 6c 2c 75 72 6c 3a 6e {file:null,url:n
000154a0: 75 6c 6c 7d 3b 72 65 67 69 73 74 65 72 45 78 74 ull};registerExt
000154b0: 65 72 6e 61 6c 41 73 73 65 74 48 61 6e 64 6c 65 ernalAssetHandle
000154c0: 72 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 74 68 r(e,t){return th
000154d0: 69 73 2e 65 78 74 65 72 6e 61 6c 41 73 73 65 74 is.externalAsset
000154e0: 43 6f 6e 74 65 6e 74 48 61 6e 64 6c 65 72 73 5b ContentHandlers[
000154f0: 65 5d 3d 74 2c 74 68 69 73 7d 61 73 79 6e 63 20 e]=t,this}async
00015500: 67 65 74 41 73 73 65 74 46 6f 72 45 78 74 65 72 getAssetForExter
00015510: 6e 61 6c 43 6f 6e 74 65 6e 74 28 65 29 7b 72 65 nalContent(e){re
00015520: 74 75 72 6e 20 61 77 61 69 74 28 74 68 69 73 2e turn await(this.
00015530: 65 78 74 65 72 6e 61 6c 41 73 73 65 74 43 6f 6e externalAssetCon
00015540: 74 65 6e 74 48 61 6e 64 6c 65 72 73 5b 65 2e 74 tentHandlers[e.t
00015550: 79 70 65 5d 3f 2e 28 65 29 29 7d 68 61 73 45 78 ype]?.(e))}hasEx
00015560: 74 65 72 6e 61 6c 41 73 73 65 74 48 61 6e 64 6c ternalAssetHandl
00015570: 65 72 28 65 29 7b 72 65 74 75 72 6e 21 21 74 68 er(e){return!!th
00015580: 69 73 2e 65 78 74 65 72 6e 61 6c 41 73 73 65 74 is.externalAsset
00015590: 43 6f 6e 74 65 6e 74 48 61 6e 64 6c 65 72 73 5b ContentHandlers[
000155a0: 65 5d 7d 65 78 74 65 72 6e 61 6c 43 6f 6e 74 65 e]}externalConte
000155b0: 6e 74 48 61 6e 64 6c 65 72 73 3d 7b 74 65 78 74 ntHandlers={text
000155c0: 3a 6e 75 6c 6c 2c 66 69 6c 65 73 3a 6e 75 6c 6c :null,files:null
000155d0: 2c 65 6d 62 65 64 3a 6e 75 6c 6c 2c 22 73 76 67 ,embed:null,"svg
000155e0: 2d 74 65 78 74 22 3a 6e 75 6c 6c 2c 75 72 6c 3a -text":null,url:
000155f0: 6e 75 6c 6c 7d 3b 72 65 67 69 73 74 65 72 45 78 null};registerEx
00015600: 74 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 48 61 6e ternalContentHan
00015610: 64 6c 65 72 28 65 2c 74 29 7b 72 65 74 75 72 6e dler(e,t){return
00015620: 20 74 68 69 73 2e 65 78 74 65 72 6e 61 6c 43 6f this.externalCo
00015630: 6e 74 65 6e 74 48 61 6e 64 6c 65 72 73 5b 65 5d ntentHandlers[e]
00015640: 3d 74 2c 74 68 69 73 7d 61 73 79 6e 63 20 70 75 =t,this}async pu
00015650: 74 45 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 tExternalContent
00015660: 28 65 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e (e){return this.
00015670: 65 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 48 externalContentH
00015680: 61 6e 64 6c 65 72 73 5b 65 2e 74 79 70 65 5d 3f andlers[e.type]?
00015690: 2e 28 65 29 7d 67 65 74 43 6f 6e 74 65 6e 74 46 .(e)}getContentF
000156a0: 72 6f 6d 43 75 72 72 65 6e 74 50 61 67 65 28 65 romCurrentPage(e
000156b0: 29 7b 63 6f 6e 73 74 20 74 3d 22 73 74 72 69 6e ){const t="strin
000156c0: 67 22 3d 3d 74 79 70 65 6f 66 20 65 5b 30 5d 3f g"==typeof e[0]?
000156d0: 65 3a 65 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 e:e.map((e=>e.id
000156e0: 29 29 3b 69 66 28 21 74 29 72 65 74 75 72 6e 3b ));if(!t)return;
000156f0: 69 66 28 30 3d 3d 3d 74 2e 6c 65 6e 67 74 68 29 if(0===t.length)
00015700: 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 6e 3d 74 return;const n=t
00015710: 68 69 73 2e 67 65 74 53 68 61 70 65 41 6e 64 44 his.getShapeAndD
00015720: 65 73 63 65 6e 64 61 6e 74 49 64 73 28 74 29 3b escendantIds(t);
00015730: 72 65 74 75 72 6e 20 48 6d 28 74 68 69 73 2c 6e return Hm(this,n
00015740: 2c 28 65 3d 3e 7b 63 6f 6e 73 74 20 74 3d 5b 5d ,(e=>{const t=[]
00015750: 3b 66 6f 72 28 63 6f 6e 73 74 20 6e 20 6f 66 20 ;for(const n of
00015760: 65 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e e){const e=this.
00015770: 67 65 74 42 69 6e 64 69 6e 67 28 6e 29 3b 65 26 getBinding(n);e&
00015780: 26 74 2e 70 75 73 68 28 65 29 7d 63 6f 6e 73 74 &t.push(e)}const
00015790: 20 72 3d 5b 5d 2c 6f 3d 5b 5d 3b 66 6f 72 28 63 r=[],o=[];for(c
000157a0: 6f 6e 73 74 20 65 20 6f 66 20 6e 29 7b 63 6f 6e onst e of n){con
000157b0: 73 74 20 74 3d 74 68 69 73 2e 67 65 74 53 68 61 st t=this.getSha
000157c0: 70 65 28 65 29 3b 69 66 28 21 74 29 63 6f 6e 74 pe(e);if(!t)cont
000157d0: 69 6e 75 65 3b 69 66 28 21 6e 2e 68 61 73 28 74 inue;if(!n.has(t
000157e0: 2e 70 61 72 65 6e 74 49 64 29 29 7b 63 6f 6e 73 .parentId)){cons
000157f0: 74 20 65 3d 74 68 69 73 2e 67 65 74 53 68 61 70 t e=this.getShap
00015800: 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 74 ePageTransform(t
00015810: 2e 69 64 29 2c 6e 3d 65 2e 70 6f 69 6e 74 28 29 .id),n=e.point()
00015820: 3b 6f 2e 70 75 73 68 28 7b 2e 2e 2e 74 2c 78 3a ;o.push({...t,x:
00015830: 6e 2e 78 2c 79 3a 6e 2e 79 2c 72 6f 74 61 74 69 n.x,y:n.y,rotati
00015840: 6f 6e 3a 65 2e 72 6f 74 61 74 69 6f 6e 28 29 2c on:e.rotation(),
00015850: 70 61 72 65 6e 74 49 64 3a 74 68 69 73 2e 67 65 parentId:this.ge
00015860: 74 43 75 72 72 65 6e 74 50 61 67 65 49 64 28 29 tCurrentPageId()
00015870: 7d 29 2c 72 2e 70 75 73 68 28 74 2e 69 64 29 7d }),r.push(t.id)}
00015880: 65 6c 73 65 20 6f 2e 70 75 73 68 28 74 29 7d 63 else o.push(t)}c
00015890: 6f 6e 73 74 20 69 3d 5b 5d 2c 61 3d 6e 65 77 20 onst i=[],a=new
000158a0: 53 65 74 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 Set;for(const e
000158b0: 6f 66 20 6f 29 7b 69 66 28 21 28 22 61 73 73 65 of o){if(!("asse
000158c0: 74 49 64 22 69 6e 20 65 2e 70 72 6f 70 73 29 29 tId"in e.props))
000158d0: 63 6f 6e 74 69 6e 75 65 3b 63 6f 6e 73 74 20 74 continue;const t
000158e0: 3d 65 2e 70 72 6f 70 73 2e 61 73 73 65 74 49 64 =e.props.assetId
000158f0: 3b 69 66 28 21 74 7c 7c 61 2e 68 61 73 28 74 29 ;if(!t||a.has(t)
00015900: 29 63 6f 6e 74 69 6e 75 65 3b 61 2e 61 64 64 28 )continue;a.add(
00015910: 74 29 3b 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e t);const n=this.
00015920: 67 65 74 41 73 73 65 74 28 74 29 3b 6e 26 26 69 getAsset(t);n&&i
00015930: 2e 70 75 73 68 28 6e 29 7d 72 65 74 75 72 6e 7b .push(n)}return{
00015940: 73 63 68 65 6d 61 3a 74 68 69 73 2e 73 74 6f 72 schema:this.stor
00015950: 65 2e 73 63 68 65 6d 61 2e 73 65 72 69 61 6c 69 e.schema.seriali
00015960: 7a 65 28 29 2c 73 68 61 70 65 73 3a 6f 2c 72 6f ze(),shapes:o,ro
00015970: 6f 74 53 68 61 70 65 49 64 73 3a 72 2c 62 69 6e otShapeIds:r,bin
00015980: 64 69 6e 67 73 3a 74 2c 61 73 73 65 74 73 3a 69 dings:t,assets:i
00015990: 7d 7d 29 29 7d 61 73 79 6e 63 20 72 65 73 6f 6c }}))}async resol
000159a0: 76 65 41 73 73 65 74 73 49 6e 43 6f 6e 74 65 6e veAssetsInConten
000159b0: 74 28 65 29 7b 69 66 28 21 65 29 72 65 74 75 72 t(e){if(!e)retur
000159c0: 6e 3b 63 6f 6e 73 74 20 74 3d 5b 5d 3b 72 65 74 n;const t=[];ret
000159d0: 75 72 6e 20 61 77 61 69 74 20 50 72 6f 6d 69 73 urn await Promis
000159e0: 65 2e 61 6c 6c 53 65 74 74 6c 65 64 28 65 2e 61 e.allSettled(e.a
000159f0: 73 73 65 74 73 2e 6d 61 70 28 28 61 73 79 6e 63 ssets.map((async
00015a00: 20 65 3d 3e 7b 69 66 28 22 69 6d 61 67 65 22 21 e=>{if("image"!
00015a10: 3d 3d 65 2e 74 79 70 65 26 26 22 76 69 64 65 6f ==e.type&&"video
00015a20: 22 21 3d 3d 65 2e 74 79 70 65 7c 7c 65 2e 70 72 "!==e.type||e.pr
00015a30: 6f 70 73 2e 73 72 63 3f 2e 73 74 61 72 74 73 57 ops.src?.startsW
00015a40: 69 74 68 28 22 64 61 74 61 3a 69 6d 61 67 65 22 ith("data:image"
00015a50: 29 7c 7c 65 2e 70 72 6f 70 73 2e 73 72 63 3f 2e )||e.props.src?.
00015a60: 73 74 61 72 74 73 57 69 74 68 28 22 68 74 74 70 startsWith("http
00015a70: 22 29 29 74 2e 70 75 73 68 28 65 29 3b 65 6c 73 "))t.push(e);els
00015a80: 65 7b 63 6f 6e 73 74 20 6e 3d 64 69 28 65 29 2c e{const n=di(e),
00015a90: 72 3d 61 77 61 69 74 20 74 68 69 73 2e 5f 61 73 r=await this._as
00015aa0: 73 65 74 4f 70 74 69 6f 6e 73 2e 67 65 74 28 29 setOptions.get()
00015ab0: 2e 6f 6e 52 65 73 6f 6c 76 65 41 73 73 65 74 28 .onResolveAsset(
00015ac0: 65 2c 7b 73 63 72 65 65 6e 53 63 61 6c 65 3a 31 e,{screenScale:1
00015ad0: 2c 73 74 65 70 70 65 64 53 63 72 65 65 6e 53 63 ,steppedScreenSc
00015ae0: 61 6c 65 3a 31 2c 64 70 72 3a 31 2c 6e 65 74 77 ale:1,dpr:1,netw
00015af0: 6f 72 6b 45 66 66 65 63 74 69 76 65 54 79 70 65 orkEffectiveType
00015b00: 3a 6e 75 6c 6c 2c 73 68 6f 75 6c 64 52 65 73 6f :null,shouldReso
00015b10: 6c 76 65 54 6f 4f 72 69 67 69 6e 61 6c 49 6d 61 lveToOriginalIma
00015b20: 67 65 3a 21 30 7d 29 3b 6e 2e 70 72 6f 70 73 2e ge:!0});n.props.
00015b30: 73 72 63 3d 61 77 61 69 74 20 24 72 2e 62 6c 6f src=await $r.blo
00015b40: 62 54 6f 44 61 74 61 55 72 6c 28 61 77 61 69 74 bToDataUrl(await
00015b50: 20 51 72 28 72 29 2e 74 68 65 6e 28 28 65 3d 3e Qr(r).then((e=>
00015b60: 65 2e 62 6c 6f 62 28 29 29 29 29 2c 74 2e 70 75 e.blob()))),t.pu
00015b70: 73 68 28 6e 29 7d 7d 29 29 29 2c 65 2e 61 73 73 sh(n)}}))),e.ass
00015b80: 65 74 73 3d 74 2c 65 7d 70 75 74 43 6f 6e 74 65 ets=t,e}putConte
00015b90: 6e 74 4f 6e 74 6f 43 75 72 72 65 6e 74 50 61 67 ntOntoCurrentPag
00015ba0: 65 28 65 2c 74 3d 7b 7d 29 7b 69 66 28 74 68 69 e(e,t={}){if(thi
00015bb0: 73 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 s.getInstanceSta
00015bc0: 74 65 28 29 2e 69 73 52 65 61 64 6f 6e 6c 79 29 te().isReadonly)
00015bd0: 72 65 74 75 72 6e 20 74 68 69 73 3b 69 66 28 21 return this;if(!
00015be0: 65 2e 73 63 68 65 6d 61 29 74 68 72 6f 77 20 45 e.schema)throw E
00015bf0: 72 72 6f 72 28 22 43 6f 75 6c 64 20 6e 6f 74 20 rror("Could not
00015c00: 70 75 74 20 63 6f 6e 74 65 6e 74 3a 5c 6e 63 6f put content:\nco
00015c10: 6e 74 65 6e 74 20 69 73 20 6d 69 73 73 69 6e 67 ntent is missing
00015c20: 20 61 20 73 63 68 65 6d 61 2e 22 29 3b 63 6f 6e a schema.");con
00015c30: 73 74 7b 73 65 6c 65 63 74 3a 6e 3d 21 31 2c 70 st{select:n=!1,p
00015c40: 72 65 73 65 72 76 65 49 64 73 3a 72 3d 21 31 2c reserveIds:r=!1,
00015c50: 70 72 65 73 65 72 76 65 50 6f 73 69 74 69 6f 6e preservePosition
00015c60: 3a 6f 3d 21 31 7d 3d 74 3b 6c 65 74 7b 70 6f 69 :o=!1}=t;let{poi
00015c70: 6e 74 3a 69 7d 3d 74 3b 63 6f 6e 73 74 20 61 3d nt:i}=t;const a=
00015c80: 74 68 69 73 2e 67 65 74 43 75 72 72 65 6e 74 50 this.getCurrentP
00015c90: 61 67 65 49 64 28 29 2c 7b 72 6f 6f 74 53 68 61 ageId(),{rootSha
00015ca0: 70 65 49 64 73 3a 73 7d 3d 65 2c 6c 3d 5b 5d 2c peIds:s}=e,l=[],
00015cb0: 63 3d 5b 5d 2c 75 3d 5b 5d 2c 64 3d 7b 73 74 6f c=[],u=[],d={sto
00015cc0: 72 65 3a 7b 2e 2e 2e 4f 62 6a 65 63 74 2e 66 72 re:{...Object.fr
00015cd0: 6f 6d 45 6e 74 72 69 65 73 28 65 2e 61 73 73 65 omEntries(e.asse
00015ce0: 74 73 2e 6d 61 70 28 28 65 3d 3e 5b 65 2e 69 64 ts.map((e=>[e.id
00015cf0: 2c 65 5d 29 29 29 2c 2e 2e 2e 4f 62 6a 65 63 74 ,e]))),...Object
00015d00: 2e 66 72 6f 6d 45 6e 74 72 69 65 73 28 65 2e 73 .fromEntries(e.s
00015d10: 68 61 70 65 73 2e 6d 61 70 28 28 65 3d 3e 5b 65 hapes.map((e=>[e
00015d20: 2e 69 64 2c 65 5d 29 29 29 2c 2e 2e 2e 4f 62 6a .id,e]))),...Obj
00015d30: 65 63 74 2e 66 72 6f 6d 45 6e 74 72 69 65 73 28 ect.fromEntries(
00015d40: 65 2e 62 69 6e 64 69 6e 67 73 3f 2e 6d 61 70 28 e.bindings?.map(
00015d50: 28 65 3d 3e 5b 65 2e 69 64 2c 65 5d 29 29 3f 3f (e=>[e.id,e]))??
00015d60: 5b 5d 29 7d 2c 73 63 68 65 6d 61 3a 65 2e 73 63 [])},schema:e.sc
00015d70: 68 65 6d 61 7d 2c 70 3d 74 68 69 73 2e 73 74 6f hema},p=this.sto
00015d80: 72 65 2e 73 63 68 65 6d 61 2e 6d 69 67 72 61 74 re.schema.migrat
00015d90: 65 53 74 6f 72 65 53 6e 61 70 73 68 6f 74 28 64 eStoreSnapshot(d
00015da0: 29 3b 69 66 28 22 65 72 72 6f 72 22 3d 3d 3d 70 );if("error"===p
00015db0: 2e 74 79 70 65 29 74 68 72 6f 77 20 45 72 72 6f .type)throw Erro
00015dc0: 72 28 22 43 6f 75 6c 64 20 6e 6f 74 20 70 75 74 r("Could not put
00015dd0: 20 63 6f 6e 74 65 6e 74 3a 20 63 6f 75 6c 64 20 content: could
00015de0: 6e 6f 74 20 6d 69 67 72 61 74 65 20 63 6f 6e 74 not migrate cont
00015df0: 65 6e 74 22 29 3b 66 6f 72 28 63 6f 6e 73 74 20 ent");for(const
00015e00: 65 20 6f 66 20 4f 62 6a 65 63 74 2e 76 61 6c 75 e of Object.valu
00015e10: 65 73 28 70 2e 76 61 6c 75 65 29 29 73 77 69 74 es(p.value))swit
00015e20: 63 68 28 65 2e 74 79 70 65 4e 61 6d 65 29 7b 63 ch(e.typeName){c
00015e30: 61 73 65 22 61 73 73 65 74 22 3a 6c 2e 70 75 73 ase"asset":l.pus
00015e40: 68 28 65 29 3b 62 72 65 61 6b 3b 63 61 73 65 22 h(e);break;case"
00015e50: 73 68 61 70 65 22 3a 63 2e 70 75 73 68 28 65 29 shape":c.push(e)
00015e60: 3b 62 72 65 61 6b 3b 63 61 73 65 22 62 69 6e 64 ;break;case"bind
00015e70: 69 6e 67 22 3a 75 2e 70 75 73 68 28 65 29 7d 63 ing":u.push(e)}c
00015e80: 6f 6e 73 74 20 66 3d 6e 65 77 20 4d 61 70 28 72 onst f=new Map(r
00015e90: 3f 63 2e 6d 61 70 28 28 65 3d 3e 5b 65 2e 69 64 ?c.map((e=>[e.id
00015ea0: 2c 65 2e 69 64 5d 29 29 3a 63 2e 6d 61 70 28 28 ,e.id])):c.map((
00015eb0: 65 3d 3e 5b 65 2e 69 64 2c 49 73 28 29 5d 29 29 e=>[e.id,Is()]))
00015ec0: 29 2c 68 3d 6e 65 77 20 4d 61 70 28 72 3f 75 2e ),h=new Map(r?u.
00015ed0: 6d 61 70 28 28 65 3d 3e 5b 65 2e 69 64 2c 65 2e map((e=>[e.id,e.
00015ee0: 69 64 5d 29 29 3a 75 2e 6d 61 70 28 28 65 3d 3e id])):u.map((e=>
00015ef0: 5b 65 2e 69 64 2c 5f 73 28 29 5d 29 29 29 3b 6c [e.id,_s()])));l
00015f00: 65 74 20 6d 3d 74 68 69 73 2e 67 65 74 43 75 72 et m=this.getCur
00015f10: 72 65 6e 74 50 61 67 65 49 64 28 29 2c 67 3d 31 rentPageId(),g=1
00015f20: 2f 30 2c 62 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 /0,b=[];for(cons
00015f30: 74 20 65 20 6f 66 20 74 68 69 73 2e 67 65 74 53 t e of this.getS
00015f40: 65 6c 65 63 74 65 64 53 68 61 70 65 73 28 29 29 electedShapes())
00015f50: 7b 69 66 28 30 3d 3d 3d 67 29 62 72 65 61 6b 3b {if(0===g)break;
00015f60: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 69 73 53 const t=this.isS
00015f70: 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 66 72 hapeOfType(e,"fr
00015f80: 61 6d 65 22 29 2c 6e 3d 74 68 69 73 2e 67 65 74 ame"),n=this.get
00015f90: 53 68 61 70 65 41 6e 63 65 73 74 6f 72 73 28 65 ShapeAncestors(e
00015fa0: 29 3b 74 26 26 6e 2e 70 75 73 68 28 65 29 3b 63 );t&&n.push(e);c
00015fb0: 6f 6e 73 74 20 72 3d 74 3f 6e 2e 6c 65 6e 67 74 onst r=t?n.lengt
00015fc0: 68 2b 31 3a 6e 2e 6c 65 6e 67 74 68 3b 69 66 28 h+1:n.length;if(
00015fd0: 72 3c 67 29 67 3d 72 2c 62 3d 6e 2c 6d 3d 74 3f r<g)g=r,b=n,m=t?
00015fe0: 65 2e 69 64 3a 65 2e 70 61 72 65 6e 74 49 64 3b e.id:e.parentId;
00015ff0: 65 6c 73 65 20 69 66 28 72 3d 3d 3d 67 29 7b 69 else if(r===g){i
00016000: 66 28 62 2e 6c 65 6e 67 74 68 21 3d 3d 6e 2e 6c f(b.length!==n.l
00016010: 65 6e 67 74 68 29 74 68 72 6f 77 20 45 72 72 6f ength)throw Erro
00016020: 72 28 60 41 6e 63 65 73 74 6f 72 73 3a 20 24 7b r(`Ancestors: ${
00016030: 62 2e 6c 65 6e 67 74 68 7d 20 21 3d 3d 20 24 7b b.length} !== ${
00016040: 6e 2e 6c 65 6e 67 74 68 7d 60 29 3b 69 66 28 30 n.length}`);if(0
00016050: 3d 3d 3d 62 2e 6c 65 6e 67 74 68 29 7b 6d 3d 61 ===b.length){m=a
00016060: 3b 62 72 65 61 6b 7d 6d 3d 61 3b 66 6f 72 28 6c ;break}m=a;for(l
00016070: 65 74 20 65 3d 30 3b 65 3c 62 2e 6c 65 6e 67 74 et e=0;e<b.lengt
00016080: 68 26 26 6e 5b 65 5d 3d 3d 3d 62 5b 65 5d 3b 65 h&&n[e]===b[e];e
00016090: 2b 2b 29 6d 3d 6e 5b 65 5d 2e 69 64 7d 7d 6c 65 ++)m=n[e].id}}le
000160a0: 74 20 79 3d 21 31 3b 69 66 28 21 70 6c 28 6d 29 t y=!1;if(!pl(m)
000160b0: 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 67 ){const e=this.g
000160c0: 65 74 53 68 61 70 65 28 6d 29 3b 69 66 28 65 29 etShape(m);if(e)
000160d0: 69 66 28 74 68 69 73 2e 67 65 74 56 69 65 77 70 if(this.getViewp
000160e0: 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 28 29 2e ortPageBounds().
000160f0: 69 6e 63 6c 75 64 65 73 28 74 68 69 73 2e 67 65 includes(this.ge
00016100: 74 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 tShapePageBounds
00016110: 28 65 29 29 29 7b 69 66 28 31 3d 3d 3d 73 2e 6c (e))){if(1===s.l
00016120: 65 6e 67 74 68 29 7b 63 6f 6e 73 74 20 74 3d 63 ength){const t=c
00016130: 2e 66 69 6e 64 28 28 65 3d 3e 65 2e 69 64 3d 3d .find((e=>e.id==
00016140: 3d 73 5b 30 5d 29 29 3b 74 68 69 73 2e 69 73 53 =s[0]));this.isS
00016150: 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 66 72 hapeOfType(e,"fr
00016160: 61 6d 65 22 29 26 26 74 68 69 73 2e 69 73 53 68 ame")&&this.isSh
00016170: 61 70 65 4f 66 54 79 70 65 28 74 2c 22 66 72 61 apeOfType(t,"fra
00016180: 6d 65 22 29 26 26 74 2e 70 72 6f 70 73 2e 77 3d me")&&t.props.w=
00016190: 3d 3d 65 3f 2e 70 72 6f 70 73 2e 77 26 26 74 2e ==e?.props.w&&t.
000161a0: 70 72 6f 70 73 2e 68 3d 3d 3d 65 3f 2e 70 72 6f props.h===e?.pro
000161b0: 70 73 2e 68 26 26 28 79 3d 21 30 29 7d 7d 65 6c ps.h&&(y=!0)}}el
000161c0: 73 65 20 6d 3d 61 3b 65 6c 73 65 20 6d 3d 61 7d se m=a;else m=a}
000161d0: 79 7c 7c 28 79 3d 66 2e 68 61 73 28 6d 29 29 2c y||(y=f.has(m)),
000161e0: 79 26 26 28 6d 3d 74 68 69 73 2e 67 65 74 53 68 y&&(m=this.getSh
000161f0: 61 70 65 28 6d 29 2e 70 61 72 65 6e 74 49 64 29 ape(m).parentId)
00016200: 3b 6c 65 74 20 76 3d 74 68 69 73 2e 67 65 74 48 ;let v=this.getH
00016210: 69 67 68 65 73 74 49 6e 64 65 78 46 6f 72 50 61 ighestIndexForPa
00016220: 72 65 6e 74 28 6d 29 3b 63 6f 6e 73 74 20 53 3d rent(m);const S=
00016230: 5b 5d 2c 5f 3d 63 2e 6d 61 70 28 28 65 3d 3e 7b [],_=c.map((e=>{
00016240: 63 6f 6e 73 74 20 74 3d 66 2e 67 65 74 28 65 2e const t=f.get(e.
00016250: 69 64 29 2c 6e 3d 7b 2e 2e 2e 65 2c 69 64 3a 74 id),n={...e,id:t
00016260: 7d 3b 72 65 74 75 72 6e 20 73 2e 69 6e 63 6c 75 };return s.inclu
00016270: 64 65 73 28 65 2e 69 64 29 26 26 28 6e 2e 70 61 des(e.id)&&(n.pa
00016280: 72 65 6e 74 49 64 3d 61 2c 53 2e 70 75 73 68 28 rentId=a,S.push(
00016290: 6e 29 29 2c 66 2e 68 61 73 28 6e 2e 70 61 72 65 n)),f.has(n.pare
000162a0: 6e 74 49 64 29 3f 6e 2e 70 61 72 65 6e 74 49 64 ntId)?n.parentId
000162b0: 3d 66 2e 67 65 74 28 65 2e 70 61 72 65 6e 74 49 =f.get(e.parentI
000162c0: 64 29 3a 28 73 2e 70 75 73 68 28 6e 2e 69 64 29 d):(s.push(n.id)
000162d0: 2c 6e 2e 69 6e 64 65 78 3d 76 2c 76 3d 47 6f 28 ,n.index=v,v=Go(
000162e0: 76 29 29 2c 6e 7d 29 29 3b 69 66 28 5f 2e 6c 65 v)),n}));if(_.le
000162f0: 6e 67 74 68 2b 74 68 69 73 2e 67 65 74 43 75 72 ngth+this.getCur
00016300: 72 65 6e 74 50 61 67 65 53 68 61 70 65 49 64 73 rentPageShapeIds
00016310: 28 29 2e 73 69 7a 65 3e 74 68 69 73 2e 6f 70 74 ().size>this.opt
00016320: 69 6f 6e 73 2e 6d 61 78 53 68 61 70 65 73 50 65 ions.maxShapesPe
00016330: 72 50 61 67 65 29 72 65 74 75 72 6e 20 55 6d 28 rPage)return Um(
00016340: 74 68 69 73 29 2c 74 68 69 73 3b 63 6f 6e 73 74 this),this;const
00016350: 20 45 3d 75 2e 6d 61 70 28 28 65 3d 3e 28 7b 2e E=u.map((e=>({.
00016360: 2e 2e 65 2c 69 64 3a 4b 72 28 68 2e 67 65 74 28 ..e,id:Kr(h.get(
00016370: 65 2e 69 64 29 29 2c 66 72 6f 6d 49 64 3a 4b 72 e.id)),fromId:Kr
00016380: 28 66 2e 67 65 74 28 65 2e 66 72 6f 6d 49 64 29 (f.get(e.fromId)
00016390: 29 2c 74 6f 49 64 3a 4b 72 28 66 2e 67 65 74 28 ),toId:Kr(f.get(
000163a0: 65 2e 74 6f 49 64 29 29 7d 29 29 29 2c 77 3d 5b e.toId))}))),w=[
000163b0: 5d 2c 78 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 74 ],x=[];for(const
000163c0: 20 65 20 6f 66 20 6c 29 74 68 69 73 2e 73 74 6f e of l)this.sto
000163d0: 72 65 2e 68 61 73 28 65 2e 69 64 29 7c 7c 28 22 re.has(e.id)||("
000163e0: 69 6d 61 67 65 22 21 3d 3d 65 2e 74 79 70 65 26 image"!==e.type&
000163f0: 26 22 76 69 64 65 6f 22 21 3d 3d 65 2e 74 79 70 &"video"!==e.typ
00016400: 65 7c 7c 21 65 2e 70 72 6f 70 73 2e 73 72 63 3f e||!e.props.src?
00016410: 2e 73 74 61 72 74 73 57 69 74 68 28 22 64 61 74 .startsWith("dat
00016420: 61 3a 69 6d 61 67 65 22 29 7c 7c 28 78 2e 70 75 a:image")||(x.pu
00016430: 73 68 28 64 69 28 65 29 29 2c 65 2e 70 72 6f 70 sh(di(e)),e.prop
00016440: 73 2e 73 72 63 3d 6e 75 6c 6c 29 2c 77 2e 70 75 s.src=null),w.pu
00016450: 73 68 28 65 29 29 3b 72 65 74 75 72 6e 20 50 72 sh(e));return Pr
00016460: 6f 6d 69 73 65 2e 61 6c 6c 53 65 74 74 6c 65 64 omise.allSettled
00016470: 28 78 2e 6d 61 70 28 28 61 73 79 6e 63 20 65 3d (x.map((async e=
00016480: 3e 7b 63 6f 6e 73 74 20 74 3d 61 77 61 69 74 20 >{const t=await
00016490: 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 29 7b function(e,t,n){
000164a0: 72 65 74 75 72 6e 20 51 72 28 65 29 2e 74 68 65 return Qr(e).the
000164b0: 6e 28 28 66 75 6e 63 74 69 6f 6e 28 65 29 7b 72 n((function(e){r
000164c0: 65 74 75 72 6e 20 65 2e 61 72 72 61 79 42 75 66 eturn e.arrayBuf
000164d0: 66 65 72 28 29 7d 29 29 2e 74 68 65 6e 28 28 66 fer()})).then((f
000164e0: 75 6e 63 74 69 6f 6e 28 65 29 7b 72 65 74 75 72 unction(e){retur
000164f0: 6e 20 6e 65 77 20 46 69 6c 65 28 5b 65 5d 2c 74 n new File([e],t
00016500: 2c 7b 74 79 70 65 3a 6e 7d 29 7d 29 29 7d 28 65 ,{type:n})}))}(e
00016510: 2e 70 72 6f 70 73 2e 73 72 63 2c 65 2e 70 72 6f .props.src,e.pro
00016520: 70 73 2e 6e 61 6d 65 2c 65 2e 70 72 6f 70 73 2e ps.name,e.props.
00016530: 6d 69 6d 65 54 79 70 65 3f 3f 22 69 6d 61 67 65 mimeType??"image
00016540: 2f 70 6e 67 22 29 2c 6e 3d 61 77 61 69 74 20 74 /png"),n=await t
00016550: 68 69 73 2e 67 65 74 41 73 73 65 74 46 6f 72 45 his.getAssetForE
00016560: 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 28 7b xternalContent({
00016570: 74 79 70 65 3a 22 66 69 6c 65 22 2c 66 69 6c 65 type:"file",file
00016580: 3a 74 7d 29 3b 6e 3f 74 68 69 73 2e 75 70 64 61 :t});n?this.upda
00016590: 74 65 41 73 73 65 74 73 28 5b 7b 2e 2e 2e 6e 2c teAssets([{...n,
000165a0: 69 64 3a 65 2e 69 64 7d 5d 29 3a 74 68 69 73 2e id:e.id}]):this.
000165b0: 64 65 6c 65 74 65 41 73 73 65 74 73 28 5b 65 2e deleteAssets([e.
000165c0: 69 64 5d 29 7d 29 29 29 2c 74 68 69 73 2e 62 61 id])}))),this.ba
000165d0: 74 63 68 28 28 28 29 3d 3e 7b 77 2e 6c 65 6e 67 tch((()=>{w.leng
000165e0: 74 68 3e 30 26 26 74 68 69 73 2e 63 72 65 61 74 th>0&&this.creat
000165f0: 65 41 73 73 65 74 73 28 77 29 2c 74 68 69 73 2e eAssets(w),this.
00016600: 63 72 65 61 74 65 53 68 61 70 65 73 28 5f 29 2c createShapes(_),
00016610: 74 68 69 73 2e 63 72 65 61 74 65 42 69 6e 64 69 this.createBindi
00016620: 6e 67 73 28 45 29 2c 6e 26 26 74 68 69 73 2e 73 ngs(E),n&&this.s
00016630: 65 6c 65 63 74 28 2e 2e 2e 53 2e 6d 61 70 28 28 elect(...S.map((
00016640: 65 3d 3e 65 2e 69 64 29 29 29 2c 6d 21 3d 3d 61 e=>e.id))),m!==a
00016650: 26 26 74 68 69 73 2e 72 65 70 61 72 65 6e 74 53 &&this.reparentS
00016660: 68 61 70 65 73 28 53 2e 6d 61 70 28 28 65 3d 3e hapes(S.map((e=>
00016670: 65 2e 69 64 29 29 2c 6d 29 3b 63 6f 6e 73 74 20 e.id)),m);const
00016680: 65 3d 5f 2e 6d 61 70 28 28 65 3d 3e 74 68 69 73 e=_.map((e=>this
00016690: 2e 67 65 74 53 68 61 70 65 28 65 2e 69 64 29 29 .getShape(e.id))
000166a0: 29 2c 74 3d 5f 70 2e 43 6f 6d 6d 6f 6e 28 65 2e ),t=_p.Common(e.
000166b0: 6d 61 70 28 28 65 3d 3e 74 68 69 73 2e 67 65 74 map((e=>this.get
000166c0: 53 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 ShapePageBounds(
000166d0: 65 29 29 29 29 3b 69 66 28 76 6f 69 64 20 30 3d e))));if(void 0=
000166e0: 3d 3d 69 29 69 66 28 70 6c 28 6d 29 29 7b 63 6f ==i)if(pl(m)){co
000166f0: 6e 73 74 20 65 3d 74 68 69 73 2e 67 65 74 56 69 nst e=this.getVi
00016700: 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 ewportPageBounds
00016710: 28 29 3b 69 3d 6f 7c 7c 65 2e 69 6e 63 6c 75 64 ();i=o||e.includ
00016720: 65 73 28 5f 70 2e 46 72 6f 6d 28 74 29 29 3f 74 es(_p.From(t))?t
00016730: 2e 63 65 6e 74 65 72 3a 65 2e 63 65 6e 74 65 72 .center:e.center
00016740: 7d 65 6c 73 65 7b 63 6f 6e 73 74 20 65 3d 74 68 }else{const e=th
00016750: 69 73 2e 67 65 74 53 68 61 70 65 28 6d 29 3b 69 is.getShape(m);i
00016760: 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 =wp.applyToPoint
00016770: 28 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 (this.getShapePa
00016780: 67 65 54 72 61 6e 73 66 6f 72 6d 28 65 29 2c 74 geTransform(e),t
00016790: 68 69 73 2e 67 65 74 53 68 61 70 65 47 65 6f 6d his.getShapeGeom
000167a0: 65 74 72 79 28 65 29 2e 62 6f 75 6e 64 73 2e 63 etry(e).bounds.c
000167b0: 65 6e 74 65 72 29 7d 69 66 28 31 3d 3d 3d 53 2e enter)}if(1===S.
000167c0: 6c 65 6e 67 74 68 29 7b 63 6f 6e 73 74 20 65 3d length){const e=
000167d0: 53 5b 30 5d 3b 69 66 28 74 68 69 73 2e 69 73 53 S[0];if(this.isS
000167e0: 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 66 72 hapeOfType(e,"fr
000167f0: 61 6d 65 22 29 29 66 6f 72 28 3b 74 68 69 73 2e ame"))for(;this.
00016800: 67 65 74 53 68 61 70 65 73 41 74 50 6f 69 6e 74 getShapesAtPoint
00016810: 28 69 29 2e 73 6f 6d 65 28 28 74 3d 3e 74 68 69 (i).some((t=>thi
00016820: 73 2e 69 73 53 68 61 70 65 4f 66 54 79 70 65 28 s.isShapeOfType(
00016830: 74 2c 22 66 72 61 6d 65 22 29 26 26 74 2e 70 72 t,"frame")&&t.pr
00016840: 6f 70 73 2e 77 3d 3d 3d 65 2e 70 72 6f 70 73 2e ops.w===e.props.
00016850: 77 26 26 74 2e 70 72 6f 70 73 2e 68 3d 3d 3d 65 w&&t.props.h===e
00016860: 2e 70 72 6f 70 73 2e 68 29 29 3b 29 69 2e 78 2b .props.h));)i.x+
00016870: 3d 74 2e 77 2b 31 36 7d 63 6f 6e 73 74 20 72 3d =t.w+16}const r=
00016880: 5f 70 2e 43 6f 6d 6d 6f 6e 28 6a 72 28 53 2e 6d _p.Common(jr(S.m
00016890: 61 70 28 28 28 7b 69 64 3a 65 7d 29 3d 3e 74 68 ap((({id:e})=>th
000168a0: 69 73 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 is.getShapePageB
000168b0: 6f 75 6e 64 73 28 65 29 29 29 29 29 2e 63 65 6e ounds(e))))).cen
000168c0: 74 65 72 2c 73 3d 73 75 2e 53 75 62 28 69 2c 72 ter,s=su.Sub(i,r
000168d0: 29 3b 74 68 69 73 2e 75 70 64 61 74 65 53 68 61 );this.updateSha
000168e0: 70 65 73 28 53 2e 6d 61 70 28 28 28 7b 69 64 3a pes(S.map((({id:
000168f0: 65 7d 29 3d 3e 7b 63 6f 6e 73 74 20 74 3d 74 68 e})=>{const t=th
00016900: 69 73 2e 67 65 74 53 68 61 70 65 28 65 29 2c 6e is.getShape(e),n
00016910: 3d 74 68 69 73 2e 67 65 74 53 68 61 70 65 50 61 =this.getShapePa
00016920: 72 65 6e 74 54 72 61 6e 73 66 6f 72 6d 28 65 29 rentTransform(e)
00016930: 2e 64 65 63 6f 6d 70 6f 73 65 28 29 2e 72 6f 74 .decompose().rot
00016940: 61 74 69 6f 6e 2c 72 3d 73 75 2e 52 6f 74 28 73 ation,r=su.Rot(s
00016950: 2c 2d 6e 29 3b 72 65 74 75 72 6e 7b 69 64 3a 74 ,-n);return{id:t
00016960: 2e 69 64 2c 74 79 70 65 3a 74 2e 74 79 70 65 2c .id,type:t.type,
00016970: 78 3a 74 2e 78 2b 72 2e 78 2c 79 3a 74 2e 79 2b x:t.x+r.x,y:t.y+
00016980: 72 2e 79 7d 7d 29 29 29 7d 29 29 2c 74 68 69 73 r.y}})))})),this
00016990: 7d 61 73 79 6e 63 20 67 65 74 53 76 67 45 6c 65 }async getSvgEle
000169a0: 6d 65 6e 74 28 65 2c 74 3d 7b 7d 29 7b 63 6f 6e ment(e,t={}){con
000169b0: 73 74 20 6e 3d 61 77 61 69 74 20 61 73 79 6e 63 st n=await async
000169c0: 20 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 3d function(e,t,n=
000169d0: 7b 7d 29 7b 63 6f 6e 73 74 20 72 3d 22 73 74 72 {}){const r="str
000169e0: 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 74 5b 30 ing"==typeof t[0
000169f0: 5d 3f 74 3a 74 2e 6d 61 70 28 28 65 3d 3e 65 2e ]?t:t.map((e=>e.
00016a00: 69 64 29 29 3b 69 66 28 30 3d 3d 3d 72 2e 6c 65 id));if(0===r.le
00016a10: 6e 67 74 68 29 72 65 74 75 72 6e 3b 69 66 28 21 ngth)return;if(!
00016a20: 77 69 6e 64 6f 77 2e 64 6f 63 75 6d 65 6e 74 29 window.document)
00016a30: 74 68 72 6f 77 20 45 72 72 6f 72 28 22 4e 6f 20 throw Error("No
00016a40: 64 6f 63 75 6d 65 6e 74 22 29 3b 63 6f 6e 73 74 document");const
00016a50: 7b 73 63 61 6c 65 3a 69 3d 31 2c 62 61 63 6b 67 {scale:i=1,backg
00016a60: 72 6f 75 6e 64 3a 61 3d 21 31 2c 70 61 64 64 69 round:a=!1,paddi
00016a70: 6e 67 3a 73 3d 65 2e 6f 70 74 69 6f 6e 73 2e 64 ng:s=e.options.d
00016a80: 65 66 61 75 6c 74 53 76 67 50 61 64 64 69 6e 67 efaultSvgPadding
00016a90: 2c 70 72 65 73 65 72 76 65 41 73 70 65 63 74 52 ,preserveAspectR
00016aa0: 61 74 69 6f 3a 6c 3d 21 31 7d 3d 6e 2c 63 3d 6e atio:l=!1}=n,c=n
00016ab0: 2e 64 61 72 6b 4d 6f 64 65 3f 3f 65 2e 75 73 65 .darkMode??e.use
00016ac0: 72 2e 67 65 74 49 73 44 61 72 6b 4d 6f 64 65 28 r.getIsDarkMode(
00016ad0: 29 2c 75 3d 46 73 28 7b 69 73 44 61 72 6b 4d 6f ),u=Fs({isDarkMo
00016ae0: 64 65 3a 63 7d 29 2c 64 3d 65 2e 67 65 74 53 68 de:c}),d=e.getSh
00016af0: 61 70 65 41 6e 64 44 65 73 63 65 6e 64 61 6e 74 apeAndDescendant
00016b00: 49 64 73 28 72 29 2c 70 3d 65 2e 67 65 74 55 6e Ids(r),p=e.getUn
00016b10: 6f 72 64 65 72 65 64 52 65 6e 64 65 72 69 6e 67 orderedRendering
00016b20: 53 68 61 70 65 73 28 21 31 29 2e 66 69 6c 74 65 Shapes(!1).filte
00016b30: 72 28 28 28 7b 69 64 3a 65 7d 29 3d 3e 64 2e 68 r((({id:e})=>d.h
00016b40: 61 73 28 65 29 29 29 3b 6c 65 74 20 66 3d 6e 75 as(e)));let f=nu
00016b50: 6c 6c 3b 69 66 28 6e 2e 62 6f 75 6e 64 73 29 66 ll;if(n.bounds)f
00016b60: 3d 6e 2e 62 6f 75 6e 64 73 3b 65 6c 73 65 20 66 =n.bounds;else f
00016b70: 6f 72 28 63 6f 6e 73 74 7b 69 64 3a 74 7d 6f 66 or(const{id:t}of
00016b80: 20 70 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 p){const n=e.ge
00016b90: 74 53 68 61 70 65 4d 61 73 6b 65 64 50 61 67 65 tShapeMaskedPage
00016ba0: 42 6f 75 6e 64 73 28 74 29 3b 6e 26 26 28 66 3f Bounds(t);n&&(f?
00016bb0: 66 2e 75 6e 69 6f 6e 28 6e 29 3a 66 3d 6e 2e 63 f.union(n):f=n.c
00016bc0: 6c 6f 6e 65 28 29 29 7d 69 66 28 21 66 29 72 65 lone())}if(!f)re
00016bd0: 74 75 72 6e 3b 63 6f 6e 73 74 20 68 3d 31 3d 3d turn;const h=1==
00016be0: 3d 72 2e 6c 65 6e 67 74 68 26 26 65 2e 69 73 53 =r.length&&e.isS
00016bf0: 68 61 70 65 4f 66 54 79 70 65 28 65 2e 67 65 74 hapeOfType(e.get
00016c00: 53 68 61 70 65 28 72 5b 30 5d 29 2c 22 66 72 61 Shape(r[0]),"fra
00016c10: 6d 65 22 29 3f 72 5b 30 5d 3a 6e 75 6c 6c 3b 68 me")?r[0]:null;h
00016c20: 7c 7c 66 2e 65 78 70 61 6e 64 42 79 28 73 29 3b ||f.expandBy(s);
00016c30: 63 6f 6e 73 74 20 6d 3d 66 2e 77 69 64 74 68 2a const m=f.width*
00016c40: 69 2c 67 3d 66 2e 68 65 69 67 68 74 2a 69 3b 74 i,g=f.height*i;t
00016c50: 72 79 7b 64 6f 63 75 6d 65 6e 74 2e 62 6f 64 79 ry{document.body
00016c60: 2e 66 6f 63 75 73 3f 2e 28 29 7d 63 61 74 63 68 .focus?.()}catch
00016c70: 28 65 29 7b 7d 63 6f 6e 73 74 20 62 3d 5b 5d 2c (e){}const b=[],
00016c80: 79 3d 6e 65 77 20 4d 61 70 2c 76 3d 7b 69 73 44 y=new Map,v={isD
00016c90: 61 72 6b 4d 6f 64 65 3a 63 2c 61 64 64 45 78 70 arkMode:c,addExp
00016ca0: 6f 72 74 44 65 66 3a 65 3d 3e 7b 69 66 28 79 2e ortDef:e=>{if(y.
00016cb0: 68 61 73 28 65 2e 6b 65 79 29 29 72 65 74 75 72 has(e.key))retur
00016cc0: 6e 3b 63 6f 6e 73 74 20 74 3d 28 61 73 79 6e 63 n;const t=(async
00016cd0: 28 29 3d 3e 7b 63 6f 6e 73 74 20 74 3d 61 77 61 ()=>{const t=awa
00016ce0: 69 74 20 65 2e 67 65 74 45 6c 65 6d 65 6e 74 28 it e.getElement(
00016cf0: 29 3b 74 26 26 62 2e 70 75 73 68 28 28 30 2c 51 );t&&b.push((0,Q
00016d00: 63 2e 6a 73 78 29 28 6f 2e 46 72 61 67 6d 65 6e c.jsx)(o.Fragmen
00016d10: 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 74 7d 2c 62 t,{children:t},b
00016d20: 2e 6c 65 6e 67 74 68 29 29 7d 29 28 29 3b 79 2e .length))})();y.
00016d30: 73 65 74 28 65 2e 6b 65 79 2c 74 29 7d 7d 2c 53 set(e.key,t)}},S
00016d40: 3d 28 61 77 61 69 74 20 50 72 6f 6d 69 73 65 2e =(await Promise.
00016d50: 61 6c 6c 28 70 2e 6d 61 70 28 28 61 73 79 6e 63 all(p.map((async
00016d60: 28 7b 69 64 3a 74 2c 6f 70 61 63 69 74 79 3a 6e ({id:t,opacity:n
00016d70: 2c 69 6e 64 65 78 3a 72 2c 62 61 63 6b 67 72 6f ,index:r,backgro
00016d80: 75 6e 64 49 6e 64 65 78 3a 6f 7d 29 3d 3e 7b 69 undIndex:o})=>{i
00016d90: 66 28 74 3d 3d 3d 68 29 72 65 74 75 72 6e 5b 5d f(t===h)return[]
00016da0: 3b 63 6f 6e 73 74 20 69 3d 65 2e 67 65 74 53 68 ;const i=e.getSh
00016db0: 61 70 65 28 74 29 3b 69 66 28 65 2e 69 73 53 68 ape(t);if(e.isSh
00016dc0: 61 70 65 4f 66 54 79 70 65 28 69 2c 22 67 72 6f apeOfType(i,"gro
00016dd0: 75 70 22 29 29 72 65 74 75 72 6e 5b 5d 3b 63 6f up"))return[];co
00016de0: 6e 73 74 20 61 3d 65 2e 67 65 74 53 68 61 70 65 nst a=e.getShape
00016df0: 55 74 69 6c 28 69 29 3b 6c 65 74 20 73 3d 61 77 Util(i);let s=aw
00016e00: 61 69 74 28 61 2e 74 6f 53 76 67 3f 2e 28 69 2c ait(a.toSvg?.(i,
00016e10: 76 29 29 2c 6c 3d 61 77 61 69 74 28 61 2e 74 6f v)),l=await(a.to
00016e20: 42 61 63 6b 67 72 6f 75 6e 64 53 76 67 3f 2e 28 BackgroundSvg?.(
00016e30: 69 2c 76 29 29 3b 69 66 28 21 73 26 26 21 6c 29 i,v));if(!s&&!l)
00016e40: 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 65 74 53 68 {const t=e.getSh
00016e50: 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 69 29 apePageBounds(i)
00016e60: 3b 73 3d 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 ;s=(0,Qc.jsx)("r
00016e70: 65 63 74 22 2c 7b 77 69 64 74 68 3a 74 2e 77 2c ect",{width:t.w,
00016e80: 68 65 69 67 68 74 3a 74 2e 68 2c 66 69 6c 6c 3a height:t.h,fill:
00016e90: 75 2e 73 6f 6c 69 64 2c 73 74 72 6f 6b 65 3a 75 u.solid,stroke:u
00016ea0: 2e 67 72 65 79 2e 70 61 74 74 65 72 6e 2c 73 74 .grey.pattern,st
00016eb0: 72 6f 6b 65 57 69 64 74 68 3a 31 7d 29 7d 6c 65 rokeWidth:1})}le
00016ec0: 74 20 63 3d 65 2e 67 65 74 53 68 61 70 65 50 61 t c=e.getShapePa
00016ed0: 67 65 54 72 61 6e 73 66 6f 72 6d 28 69 29 2e 74 geTransform(i).t
00016ee0: 6f 43 73 73 53 74 72 69 6e 67 28 29 3b 22 73 63 oCssString();"sc
00016ef0: 61 6c 65 22 69 6e 20 69 2e 70 72 6f 70 73 26 26 ale"in i.props&&
00016f00: 31 21 3d 3d 69 2e 70 72 6f 70 73 2e 73 63 61 6c 1!==i.props.scal
00016f10: 65 26 26 28 63 3d 60 24 7b 63 7d 20 73 63 61 6c e&&(c=`${c} scal
00016f20: 65 28 24 7b 69 2e 70 72 6f 70 73 2e 73 63 61 6c e(${i.props.scal
00016f30: 65 7d 2c 20 24 7b 69 2e 70 72 6f 70 73 2e 73 63 e}, ${i.props.sc
00016f40: 61 6c 65 7d 29 60 29 2c 73 26 26 28 73 3d 28 30 ale})`),s&&(s=(0
00016f50: 2c 51 63 2e 6a 73 78 29 28 22 67 22 2c 7b 74 72 ,Qc.jsx)("g",{tr
00016f60: 61 6e 73 66 6f 72 6d 3a 63 2c 6f 70 61 63 69 74 ansform:c,opacit
00016f70: 79 3a 6e 2c 63 68 69 6c 64 72 65 6e 3a 73 7d 2c y:n,children:s},
00016f80: 69 2e 69 64 29 29 2c 6c 26 26 28 6c 3d 28 30 2c i.id)),l&&(l=(0,
00016f90: 51 63 2e 6a 73 78 29 28 22 67 22 2c 7b 74 72 61 Qc.jsx)("g",{tra
00016fa0: 6e 73 66 6f 72 6d 3a 63 2c 6f 70 61 63 69 74 79 nsform:c,opacity
00016fb0: 3a 6e 2c 63 68 69 6c 64 72 65 6e 3a 6c 7d 2c 60 :n,children:l},`
00016fc0: 62 67 5f 24 7b 69 2e 69 64 7d 60 29 29 3b 63 6f bg_${i.id}`));co
00016fd0: 6e 73 74 20 64 3d 65 2e 67 65 74 53 68 61 70 65 nst d=e.getShape
00016fe0: 4d 61 73 6b 28 69 2e 69 64 29 3b 69 66 28 64 29 Mask(i.id);if(d)
00016ff0: 7b 63 6f 6e 73 74 20 65 3d 60 6d 61 73 6b 5f 24 {const e=`mask_$
00017000: 7b 69 2e 69 64 2e 72 65 70 6c 61 63 65 28 22 3a {i.id.replace(":
00017010: 22 2c 22 5f 22 29 7d 60 3b 62 2e 70 75 73 68 28 ","_")}`;b.push(
00017020: 28 30 2c 51 63 2e 6a 73 78 29 28 22 63 6c 69 70 (0,Qc.jsx)("clip
00017030: 50 61 74 68 22 2c 7b 69 64 3a 65 2c 63 68 69 6c Path",{id:e,chil
00017040: 64 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 29 28 dren:(0,Qc.jsx)(
00017050: 22 70 61 74 68 22 2c 7b 64 3a 60 4d 24 7b 64 2e "path",{d:`M${d.
00017060: 6d 61 70 28 28 28 7b 78 3a 65 2c 79 3a 74 7d 29 map((({x:e,y:t})
00017070: 3d 3e 60 24 7b 65 7d 2c 24 7b 74 7d 60 29 29 2e =>`${e},${t}`)).
00017080: 6a 6f 69 6e 28 22 4c 22 29 7d 5a 60 7d 29 7d 2c join("L")}Z`})},
00017090: 62 2e 6c 65 6e 67 74 68 29 29 2c 73 26 26 28 73 b.length)),s&&(s
000170a0: 3d 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 22 2c =(0,Qc.jsx)("g",
000170b0: 7b 63 6c 69 70 50 61 74 68 3a 60 75 72 6c 28 23 {clipPath:`url(#
000170c0: 24 7b 65 7d 29 60 2c 63 68 69 6c 64 72 65 6e 3a ${e})`,children:
000170d0: 73 7d 2c 69 2e 69 64 29 29 2c 6c 26 26 28 6c 3d s},i.id)),l&&(l=
000170e0: 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 22 2c 7b (0,Qc.jsx)("g",{
000170f0: 63 6c 69 70 50 61 74 68 3a 60 75 72 6c 28 23 24 clipPath:`url(#$
00017100: 7b 65 7d 29 60 2c 63 68 69 6c 64 72 65 6e 3a 6c {e})`,children:l
00017110: 7d 2c 60 62 67 5f 24 7b 69 2e 69 64 7d 60 29 29 },`bg_${i.id}`))
00017120: 7d 63 6f 6e 73 74 20 70 3d 5b 5d 3b 72 65 74 75 }const p=[];retu
00017130: 72 6e 20 73 26 26 70 2e 70 75 73 68 28 7b 7a 49 rn s&&p.push({zI
00017140: 6e 64 65 78 3a 72 2c 65 6c 65 6d 65 6e 74 3a 73 ndex:r,element:s
00017150: 7d 29 2c 6c 26 26 70 2e 70 75 73 68 28 7b 7a 49 }),l&&p.push({zI
00017160: 6e 64 65 78 3a 6f 2c 65 6c 65 6d 65 6e 74 3a 6c ndex:o,element:l
00017170: 7d 29 2c 70 7d 29 29 29 29 2e 66 6c 61 74 28 29 }),p})))).flat()
00017180: 3b 72 65 74 75 72 6e 20 61 77 61 69 74 20 50 72 ;return await Pr
00017190: 6f 6d 69 73 65 2e 61 6c 6c 28 79 2e 76 61 6c 75 omise.all(y.valu
000171a0: 65 73 28 29 29 2c 7b 6a 73 78 3a 28 30 2c 51 63 es()),{jsx:(0,Qc
000171b0: 2e 6a 73 78 29 28 71 68 2c 7b 65 64 69 74 6f 72 .jsx)(qh,{editor
000171c0: 3a 65 2c 63 6f 6e 74 65 78 74 3a 76 2c 63 68 69 :e,context:v,chi
000171d0: 6c 64 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 73 ldren:(0,Qc.jsxs
000171e0: 29 28 22 73 76 67 22 2c 7b 70 72 65 73 65 72 76 )("svg",{preserv
000171f0: 65 41 73 70 65 63 74 52 61 74 69 6f 3a 6c 7c 7c eAspectRatio:l||
00017200: 76 6f 69 64 20 30 2c 64 69 72 65 63 74 69 6f 6e void 0,direction
00017210: 3a 22 6c 74 72 22 2c 77 69 64 74 68 3a 6d 2c 68 :"ltr",width:m,h
00017220: 65 69 67 68 74 3a 67 2c 76 69 65 77 42 6f 78 3a eight:g,viewBox:
00017230: 60 24 7b 66 2e 6d 69 6e 58 7d 20 24 7b 66 2e 6d `${f.minX} ${f.m
00017240: 69 6e 59 7d 20 24 7b 66 2e 77 69 64 74 68 7d 20 inY} ${f.width}
00017250: 24 7b 66 2e 68 65 69 67 68 74 7d 60 2c 73 74 72 ${f.height}`,str
00017260: 6f 6b 65 4c 69 6e 65 63 61 70 3a 22 72 6f 75 6e okeLinecap:"roun
00017270: 64 22 2c 73 74 72 6f 6b 65 4c 69 6e 65 6a 6f 69 d",strokeLinejoi
00017280: 6e 3a 22 72 6f 75 6e 64 22 2c 73 74 79 6c 65 3a n:"round",style:
00017290: 7b 62 61 63 6b 67 72 6f 75 6e 64 43 6f 6c 6f 72 {backgroundColor
000172a0: 3a 61 3f 68 3f 75 2e 73 6f 6c 69 64 3a 75 2e 62 :a?h?u.solid:u.b
000172b0: 61 63 6b 67 72 6f 75 6e 64 3a 22 74 72 61 6e 73 ackground:"trans
000172c0: 70 61 72 65 6e 74 22 7d 2c 63 68 69 6c 64 72 65 parent"},childre
000172d0: 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 28 22 64 n:[(0,Qc.jsx)("d
000172e0: 65 66 73 22 2c 7b 63 68 69 6c 64 72 65 6e 3a 62 efs",{children:b
000172f0: 7d 29 2c 53 2e 73 6f 72 74 28 28 28 65 2c 74 29 }),S.sort(((e,t)
00017300: 3d 3e 65 2e 7a 49 6e 64 65 78 2d 74 2e 7a 49 6e =>e.zIndex-t.zIn
00017310: 64 65 78 29 29 2e 6d 61 70 28 28 28 7b 65 6c 65 dex)).map((({ele
00017320: 6d 65 6e 74 3a 65 7d 29 3d 3e 65 29 29 5d 7d 29 ment:e})=>e))]})
00017330: 7d 29 2c 77 69 64 74 68 3a 6d 2c 68 65 69 67 68 }),width:m,heigh
00017340: 74 3a 67 7d 7d 28 74 68 69 73 2c 65 2c 74 29 3b t:g}}(this,e,t);
00017350: 69 66 28 21 6e 29 72 65 74 75 72 6e 3b 63 6f 6e if(!n)return;con
00017360: 73 74 20 72 3d 64 6f 63 75 6d 65 6e 74 2e 63 72 st r=document.cr
00017370: 65 61 74 65 44 6f 63 75 6d 65 6e 74 46 72 61 67 eateDocumentFrag
00017380: 6d 65 6e 74 28 29 2c 69 3d 28 30 2c 61 2e 73 29 ment(),i=(0,a.s)
00017390: 28 72 29 3b 28 30 2c 4d 74 2e 66 6c 75 73 68 53 (r);(0,Mt.flushS
000173a0: 79 6e 63 29 28 28 28 29 3d 3e 7b 69 2e 72 65 6e ync)((()=>{i.ren
000173b0: 64 65 72 28 6e 2e 6a 73 78 29 7d 29 29 3b 63 6f der(n.jsx)}));co
000173c0: 6e 73 74 20 73 3d 72 2e 66 69 72 73 74 45 6c 65 nst s=r.firstEle
000173d0: 6d 65 6e 74 43 68 69 6c 64 3b 72 65 74 75 72 6e mentChild;return
000173e0: 20 57 72 28 73 20 69 6e 73 74 61 6e 63 65 6f 66 Wr(s instanceof
000173f0: 20 53 56 47 53 56 47 45 6c 65 6d 65 6e 74 2c 22 SVGSVGElement,"
00017400: 45 78 70 65 63 74 65 64 20 61 6e 20 53 56 47 20 Expected an SVG
00017410: 65 6c 65 6d 65 6e 74 22 29 2c 69 2e 75 6e 6d 6f element"),i.unmo
00017420: 75 6e 74 28 29 2c 7b 73 76 67 3a 73 2c 77 69 64 unt(),{svg:s,wid
00017430: 74 68 3a 6e 2e 77 69 64 74 68 2c 68 65 69 67 68 th:n.width,heigh
00017440: 74 3a 6e 2e 68 65 69 67 68 74 7d 7d 61 73 79 6e t:n.height}}asyn
00017450: 63 20 67 65 74 53 76 67 53 74 72 69 6e 67 28 65 c getSvgString(e
00017460: 2c 74 3d 7b 7d 29 7b 63 6f 6e 73 74 20 6e 3d 61 ,t={}){const n=a
00017470: 77 61 69 74 20 74 68 69 73 2e 67 65 74 53 76 67 wait this.getSvg
00017480: 45 6c 65 6d 65 6e 74 28 65 2c 74 29 3b 69 66 28 Element(e,t);if(
00017490: 21 6e 29 72 65 74 75 72 6e 3b 72 65 74 75 72 6e !n)return;return
000174a0: 7b 73 76 67 3a 28 6e 65 77 20 58 4d 4c 53 65 72 {svg:(new XMLSer
000174b0: 69 61 6c 69 7a 65 72 29 2e 73 65 72 69 61 6c 69 ializer).seriali
000174c0: 7a 65 54 6f 53 74 72 69 6e 67 28 6e 2e 73 76 67 zeToString(n.svg
000174d0: 29 2c 77 69 64 74 68 3a 6e 2e 77 69 64 74 68 2c ),width:n.width,
000174e0: 68 65 69 67 68 74 3a 6e 2e 68 65 69 67 68 74 7d height:n.height}
000174f0: 7d 61 73 79 6e 63 20 67 65 74 53 76 67 28 65 2c }async getSvg(e,
00017500: 74 3d 7b 7d 29 7b 63 6f 6e 73 74 20 6e 3d 61 77 t={}){const n=aw
00017510: 61 69 74 20 74 68 69 73 2e 67 65 74 53 76 67 45 ait this.getSvgE
00017520: 6c 65 6d 65 6e 74 28 65 2c 74 29 3b 69 66 28 6e lement(e,t);if(n
00017530: 29 72 65 74 75 72 6e 20 6e 2e 73 76 67 7d 69 6e )return n.svg}in
00017540: 70 75 74 73 3d 7b 6f 72 69 67 69 6e 50 61 67 65 puts={originPage
00017550: 50 6f 69 6e 74 3a 6e 65 77 20 73 75 2c 6f 72 69 Point:new su,ori
00017560: 67 69 6e 53 63 72 65 65 6e 50 6f 69 6e 74 3a 6e ginScreenPoint:n
00017570: 65 77 20 73 75 2c 70 72 65 76 69 6f 75 73 50 61 ew su,previousPa
00017580: 67 65 50 6f 69 6e 74 3a 6e 65 77 20 73 75 2c 70 gePoint:new su,p
00017590: 72 65 76 69 6f 75 73 53 63 72 65 65 6e 50 6f 69 reviousScreenPoi
000175a0: 6e 74 3a 6e 65 77 20 73 75 2c 63 75 72 72 65 6e nt:new su,curren
000175b0: 74 50 61 67 65 50 6f 69 6e 74 3a 6e 65 77 20 73 tPagePoint:new s
000175c0: 75 2c 63 75 72 72 65 6e 74 53 63 72 65 65 6e 50 u,currentScreenP
000175d0: 6f 69 6e 74 3a 6e 65 77 20 73 75 2c 6b 65 79 73 oint:new su,keys
000175e0: 3a 6e 65 77 20 53 65 74 2c 62 75 74 74 6f 6e 73 :new Set,buttons
000175f0: 3a 6e 65 77 20 53 65 74 2c 69 73 50 65 6e 3a 21 :new Set,isPen:!
00017600: 31 2c 73 68 69 66 74 4b 65 79 3a 21 31 2c 63 74 1,shiftKey:!1,ct
00017610: 72 6c 4b 65 79 3a 21 31 2c 61 6c 74 4b 65 79 3a rlKey:!1,altKey:
00017620: 21 31 2c 69 73 44 72 61 67 67 69 6e 67 3a 21 31 !1,isDragging:!1
00017630: 2c 69 73 50 6f 69 6e 74 69 6e 67 3a 21 31 2c 69 ,isPointing:!1,i
00017640: 73 50 69 6e 63 68 69 6e 67 3a 21 31 2c 69 73 45 sPinching:!1,isE
00017650: 64 69 74 69 6e 67 3a 21 31 2c 69 73 50 61 6e 6e diting:!1,isPann
00017660: 69 6e 67 3a 21 31 2c 70 6f 69 6e 74 65 72 56 65 ing:!1,pointerVe
00017670: 6c 6f 63 69 74 79 3a 6e 65 77 20 73 75 7d 3b 5f locity:new su};_
00017680: 75 70 64 61 74 65 49 6e 70 75 74 73 46 72 6f 6d updateInputsFrom
00017690: 45 76 65 6e 74 28 65 29 7b 63 6f 6e 73 74 7b 70 Event(e){const{p
000176a0: 6f 69 6e 74 65 72 56 65 6c 6f 63 69 74 79 3a 74 ointerVelocity:t
000176b0: 2c 70 72 65 76 69 6f 75 73 53 63 72 65 65 6e 50 ,previousScreenP
000176c0: 6f 69 6e 74 3a 6e 2c 70 72 65 76 69 6f 75 73 50 oint:n,previousP
000176d0: 61 67 65 50 6f 69 6e 74 3a 72 2c 63 75 72 72 65 agePoint:r,curre
000176e0: 6e 74 53 63 72 65 65 6e 50 6f 69 6e 74 3a 6f 2c ntScreenPoint:o,
000176f0: 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 currentPagePoint
00017700: 3a 69 7d 3d 74 68 69 73 2e 69 6e 70 75 74 73 2c :i}=this.inputs,
00017710: 7b 73 63 72 65 65 6e 42 6f 75 6e 64 73 3a 61 7d {screenBounds:a}
00017720: 3d 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 61 =this.store.unsa
00017730: 66 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 74 feGetWithoutCapt
00017740: 75 72 65 28 62 6c 29 2c 7b 78 3a 73 2c 79 3a 6c ure(bl),{x:s,y:l
00017750: 2c 7a 3a 63 7d 3d 74 68 69 73 2e 73 74 6f 72 65 ,z:c}=this.store
00017760: 2e 75 6e 73 61 66 65 47 65 74 57 69 74 68 6f 75 .unsafeGetWithou
00017770: 74 43 61 70 74 75 72 65 28 74 68 69 73 2e 67 65 tCapture(this.ge
00017780: 74 43 61 6d 65 72 61 49 64 28 29 29 2c 75 3d 65 tCameraId()),u=e
00017790: 2e 70 6f 69 6e 74 2e 78 2d 61 2e 78 2c 64 3d 65 .point.x-a.x,d=e
000177a0: 2e 70 6f 69 6e 74 2e 79 2d 61 2e 79 2c 70 3d 65 .point.y-a.y,p=e
000177b0: 2e 70 6f 69 6e 74 2e 7a 3f 3f 2e 35 3b 6e 2e 73 .point.z??.5;n.s
000177c0: 65 74 54 6f 28 6f 29 2c 72 2e 73 65 74 54 6f 28 etTo(o),r.setTo(
000177d0: 69 29 2c 6f 2e 73 65 74 28 75 2c 64 29 3b 63 6f i),o.set(u,d);co
000177e0: 6e 73 74 20 66 3d 75 2f 63 2d 73 2c 68 3d 64 2f nst f=u/c-s,h=d/
000177f0: 63 2d 6c 3b 69 73 46 69 6e 69 74 65 28 66 29 26 c-l;isFinite(f)&
00017800: 26 69 73 46 69 6e 69 74 65 28 68 29 26 26 69 2e &isFinite(h)&&i.
00017810: 73 65 74 28 66 2c 68 2c 70 29 2c 74 68 69 73 2e set(f,h,p),this.
00017820: 69 6e 70 75 74 73 2e 69 73 50 65 6e 3d 22 70 6f inputs.isPen="po
00017830: 69 6e 74 65 72 22 3d 3d 3d 65 2e 74 79 70 65 26 inter"===e.type&
00017840: 26 65 2e 69 73 50 65 6e 2c 28 22 70 6f 69 6e 74 &e.isPen,("point
00017850: 65 72 5f 64 6f 77 6e 22 3d 3d 3d 65 2e 6e 61 6d er_down"===e.nam
00017860: 65 7c 7c 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 e||this.inputs.i
00017870: 73 50 69 6e 63 68 69 6e 67 29 26 26 28 74 2e 73 sPinching)&&(t.s
00017880: 65 74 28 30 2c 30 29 2c 74 68 69 73 2e 69 6e 70 et(0,0),this.inp
00017890: 75 74 73 2e 6f 72 69 67 69 6e 53 63 72 65 65 6e uts.originScreen
000178a0: 50 6f 69 6e 74 2e 73 65 74 54 6f 28 6f 29 2c 74 Point.setTo(o),t
000178b0: 68 69 73 2e 69 6e 70 75 74 73 2e 6f 72 69 67 69 his.inputs.origi
000178c0: 6e 50 61 67 65 50 6f 69 6e 74 2e 73 65 74 54 6f nPagePoint.setTo
000178d0: 28 69 29 29 2c 74 68 69 73 2e 68 69 73 74 6f 72 (i)),this.histor
000178e0: 79 2e 69 67 6e 6f 72 65 28 28 28 29 3d 3e 7b 74 y.ignore((()=>{t
000178f0: 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 28 5b 7b his.store.put([{
00017900: 69 64 3a 54 6c 2c 74 79 70 65 4e 61 6d 65 3a 22 id:Tl,typeName:"
00017910: 70 6f 69 6e 74 65 72 22 2c 78 3a 69 2e 78 2c 79 pointer",x:i.x,y
00017920: 3a 69 2e 79 2c 6c 61 73 74 41 63 74 69 76 69 74 :i.y,lastActivit
00017930: 79 54 69 6d 65 73 74 61 6d 70 3a 22 70 6f 69 6e yTimestamp:"poin
00017940: 74 65 72 22 3d 3d 3d 65 2e 74 79 70 65 26 26 65 ter"===e.type&&e
00017950: 2e 70 6f 69 6e 74 65 72 49 64 3d 3d 3d 48 75 3f .pointerId===Hu?
00017960: 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 61 66 this.store.unsaf
00017970: 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 74 75 eGetWithoutCaptu
00017980: 72 65 28 54 6c 29 3f 2e 6c 61 73 74 41 63 74 69 re(Tl)?.lastActi
00017990: 76 69 74 79 54 69 6d 65 73 74 61 6d 70 3f 3f 74 vityTimestamp??t
000179a0: 68 69 73 2e 5f 74 69 63 6b 4d 61 6e 61 67 65 72 his._tickManager
000179b0: 2e 6e 6f 77 3a 74 68 69 73 2e 5f 74 69 63 6b 4d .now:this._tickM
000179c0: 61 6e 61 67 65 72 2e 6e 6f 77 2c 6d 65 74 61 3a anager.now,meta:
000179d0: 7b 7d 7d 5d 29 7d 29 29 7d 63 61 6e 63 65 6c 28 {}}])}))}cancel(
000179e0: 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 64 69 ){return this.di
000179f0: 73 70 61 74 63 68 28 7b 74 79 70 65 3a 22 6d 69 spatch({type:"mi
00017a00: 73 63 22 2c 6e 61 6d 65 3a 22 63 61 6e 63 65 6c sc",name:"cancel
00017a10: 22 7d 29 2c 74 68 69 73 7d 69 6e 74 65 72 72 75 "}),this}interru
00017a20: 70 74 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 pt(){return this
00017a30: 2e 64 69 73 70 61 74 63 68 28 7b 74 79 70 65 3a .dispatch({type:
00017a40: 22 6d 69 73 63 22 2c 6e 61 6d 65 3a 22 69 6e 74 "misc",name:"int
00017a50: 65 72 72 75 70 74 22 7d 29 2c 74 68 69 73 7d 63 errupt"}),this}c
00017a60: 6f 6d 70 6c 65 74 65 28 29 7b 72 65 74 75 72 6e omplete(){return
00017a70: 20 74 68 69 73 2e 64 69 73 70 61 74 63 68 28 7b this.dispatch({
00017a80: 74 79 70 65 3a 22 6d 69 73 63 22 2c 6e 61 6d 65 type:"misc",name
00017a90: 3a 22 63 6f 6d 70 6c 65 74 65 22 7d 29 2c 74 68 :"complete"}),th
00017aa0: 69 73 7d 66 6f 63 75 73 28 7b 66 6f 63 75 73 43 is}focus({focusC
00017ab0: 6f 6e 74 61 69 6e 65 72 3a 65 3d 21 30 7d 3d 7b ontainer:e=!0}={
00017ac0: 7d 29 7b 72 65 74 75 72 6e 20 65 26 26 74 68 69 }){return e&&thi
00017ad0: 73 2e 66 6f 63 75 73 4d 61 6e 61 67 65 72 2e 66 s.focusManager.f
00017ae0: 6f 63 75 73 28 29 2c 74 68 69 73 2e 75 70 64 61 ocus(),this.upda
00017af0: 74 65 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 teInstanceState(
00017b00: 7b 69 73 46 6f 63 75 73 65 64 3a 21 30 7d 29 2c {isFocused:!0}),
00017b10: 74 68 69 73 7d 62 6c 75 72 28 7b 62 6c 75 72 43 this}blur({blurC
00017b20: 6f 6e 74 61 69 6e 65 72 3a 65 3d 21 30 7d 3d 7b ontainer:e=!0}={
00017b30: 7d 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 67 }){return this.g
00017b40: 65 74 49 73 46 6f 63 75 73 65 64 28 29 3f 28 65 etIsFocused()?(e
00017b50: 3f 74 68 69 73 2e 66 6f 63 75 73 4d 61 6e 61 67 ?this.focusManag
00017b60: 65 72 2e 62 6c 75 72 28 29 3a 74 68 69 73 2e 63 er.blur():this.c
00017b70: 6f 6d 70 6c 65 74 65 28 29 2c 74 68 69 73 2e 75 omplete(),this.u
00017b80: 70 64 61 74 65 49 6e 73 74 61 6e 63 65 53 74 61 pdateInstanceSta
00017b90: 74 65 28 7b 69 73 46 6f 63 75 73 65 64 3a 21 31 te({isFocused:!1
00017ba0: 7d 29 2c 74 68 69 73 29 3a 74 68 69 73 7d 67 65 }),this):this}ge
00017bb0: 74 49 73 46 6f 63 75 73 65 64 28 29 7b 72 65 74 tIsFocused(){ret
00017bc0: 75 72 6e 20 74 68 69 73 2e 67 65 74 49 6e 73 74 urn this.getInst
00017bd0: 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 46 6f anceState().isFo
00017be0: 63 75 73 65 64 7d 67 65 74 53 6e 61 70 73 68 6f cused}getSnapsho
00017bf0: 74 28 29 7b 72 65 74 75 72 6e 20 66 75 6e 63 74 t(){return funct
00017c00: 69 6f 6e 28 65 29 7b 63 6f 6e 73 74 20 74 3d 70 ion(e){const t=p
00017c10: 68 2e 67 65 74 28 65 2c 63 68 29 2e 67 65 74 28 h.get(e,ch).get(
00017c20: 29 3b 69 66 28 21 74 29 74 68 72 6f 77 20 6e 65 );if(!t)throw ne
00017c30: 77 20 45 72 72 6f 72 28 22 53 65 73 73 69 6f 6e w Error("Session
00017c40: 20 73 74 61 74 65 20 69 73 20 6e 6f 74 20 72 65 state is not re
00017c50: 61 64 79 20 79 65 74 22 29 3b 72 65 74 75 72 6e ady yet");return
00017c60: 7b 64 6f 63 75 6d 65 6e 74 3a 65 2e 67 65 74 53 {document:e.getS
00017c70: 74 6f 72 65 53 6e 61 70 73 68 6f 74 28 29 2c 73 toreSnapshot(),s
00017c80: 65 73 73 69 6f 6e 3a 74 7d 7d 28 74 68 69 73 2e ession:t}}(this.
00017c90: 73 74 6f 72 65 29 7d 6c 6f 61 64 53 6e 61 70 73 store)}loadSnaps
00017ca0: 68 6f 74 28 65 29 7b 72 65 74 75 72 6e 20 64 68 hot(e){return dh
00017cb0: 28 74 68 69 73 2e 73 74 6f 72 65 2c 65 29 2c 74 (this.store,e),t
00017cc0: 68 69 73 7d 5f 63 6c 69 63 6b 4d 61 6e 61 67 65 his}_clickManage
00017cd0: 72 3d 6e 65 77 20 4b 68 28 74 68 69 73 29 3b 63 r=new Kh(this);c
00017ce0: 61 6e 63 65 6c 44 6f 75 62 6c 65 43 6c 69 63 6b ancelDoubleClick
00017cf0: 28 29 7b 74 68 69 73 2e 5f 63 6c 69 63 6b 4d 61 (){this._clickMa
00017d00: 6e 61 67 65 72 2e 63 61 6e 63 65 6c 44 6f 75 62 nager.cancelDoub
00017d10: 6c 65 43 6c 69 63 6b 54 69 6d 65 6f 75 74 28 29 leClickTimeout()
00017d20: 7d 5f 70 72 65 76 43 75 72 73 6f 72 3d 22 64 65 }_prevCursor="de
00017d30: 66 61 75 6c 74 22 3b 5f 73 68 69 66 74 4b 65 79 fault";_shiftKey
00017d40: 54 69 6d 65 6f 75 74 3d 2d 31 3b 5f 73 65 74 53 Timeout=-1;_setS
00017d50: 68 69 66 74 4b 65 79 54 69 6d 65 6f 75 74 3d 28 hiftKeyTimeout=(
00017d60: 29 3d 3e 7b 74 68 69 73 2e 69 6e 70 75 74 73 2e )=>{this.inputs.
00017d70: 73 68 69 66 74 4b 65 79 3d 21 31 2c 74 68 69 73 shiftKey=!1,this
00017d80: 2e 64 69 73 70 61 74 63 68 28 7b 74 79 70 65 3a .dispatch({type:
00017d90: 22 6b 65 79 62 6f 61 72 64 22 2c 6e 61 6d 65 3a "keyboard",name:
00017da0: 22 6b 65 79 5f 75 70 22 2c 6b 65 79 3a 22 53 68 "key_up",key:"Sh
00017db0: 69 66 74 22 2c 73 68 69 66 74 4b 65 79 3a 74 68 ift",shiftKey:th
00017dc0: 69 73 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b is.inputs.shiftK
00017dd0: 65 79 2c 63 74 72 6c 4b 65 79 3a 74 68 69 73 2e ey,ctrlKey:this.
00017de0: 69 6e 70 75 74 73 2e 63 74 72 6c 4b 65 79 2c 61 inputs.ctrlKey,a
00017df0: 6c 74 4b 65 79 3a 74 68 69 73 2e 69 6e 70 75 74 ltKey:this.input
00017e00: 73 2e 61 6c 74 4b 65 79 2c 63 6f 64 65 3a 22 53 s.altKey,code:"S
00017e10: 68 69 66 74 4c 65 66 74 22 7d 29 7d 3b 5f 61 6c hiftLeft"})};_al
00017e20: 74 4b 65 79 54 69 6d 65 6f 75 74 3d 2d 31 3b 5f tKeyTimeout=-1;_
00017e30: 73 65 74 41 6c 74 4b 65 79 54 69 6d 65 6f 75 74 setAltKeyTimeout
00017e40: 3d 28 29 3d 3e 7b 74 68 69 73 2e 69 6e 70 75 74 =()=>{this.input
00017e50: 73 2e 61 6c 74 4b 65 79 3d 21 31 2c 74 68 69 73 s.altKey=!1,this
00017e60: 2e 64 69 73 70 61 74 63 68 28 7b 74 79 70 65 3a .dispatch({type:
00017e70: 22 6b 65 79 62 6f 61 72 64 22 2c 6e 61 6d 65 3a "keyboard",name:
00017e80: 22 6b 65 79 5f 75 70 22 2c 6b 65 79 3a 22 41 6c "key_up",key:"Al
00017e90: 74 22 2c 73 68 69 66 74 4b 65 79 3a 74 68 69 73 t",shiftKey:this
00017ea0: 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b 65 79 .inputs.shiftKey
00017eb0: 2c 63 74 72 6c 4b 65 79 3a 74 68 69 73 2e 69 6e ,ctrlKey:this.in
00017ec0: 70 75 74 73 2e 63 74 72 6c 4b 65 79 2c 61 6c 74 puts.ctrlKey,alt
00017ed0: 4b 65 79 3a 74 68 69 73 2e 69 6e 70 75 74 73 2e Key:this.inputs.
00017ee0: 61 6c 74 4b 65 79 2c 63 6f 64 65 3a 22 41 6c 74 altKey,code:"Alt
00017ef0: 4c 65 66 74 22 7d 29 7d 3b 5f 63 74 72 6c 4b 65 Left"})};_ctrlKe
00017f00: 79 54 69 6d 65 6f 75 74 3d 2d 31 3b 5f 73 65 74 yTimeout=-1;_set
00017f10: 43 74 72 6c 4b 65 79 54 69 6d 65 6f 75 74 3d 28 CtrlKeyTimeout=(
00017f20: 29 3d 3e 7b 74 68 69 73 2e 69 6e 70 75 74 73 2e )=>{this.inputs.
00017f30: 63 74 72 6c 4b 65 79 3d 21 31 2c 74 68 69 73 2e ctrlKey=!1,this.
00017f40: 64 69 73 70 61 74 63 68 28 7b 74 79 70 65 3a 22 dispatch({type:"
00017f50: 6b 65 79 62 6f 61 72 64 22 2c 6e 61 6d 65 3a 22 keyboard",name:"
00017f60: 6b 65 79 5f 75 70 22 2c 6b 65 79 3a 22 43 74 72 key_up",key:"Ctr
00017f70: 6c 22 2c 73 68 69 66 74 4b 65 79 3a 74 68 69 73 l",shiftKey:this
00017f80: 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b 65 79 .inputs.shiftKey
00017f90: 2c 63 74 72 6c 4b 65 79 3a 74 68 69 73 2e 69 6e ,ctrlKey:this.in
00017fa0: 70 75 74 73 2e 63 74 72 6c 4b 65 79 2c 61 6c 74 puts.ctrlKey,alt
00017fb0: 4b 65 79 3a 74 68 69 73 2e 69 6e 70 75 74 73 2e Key:this.inputs.
00017fc0: 61 6c 74 4b 65 79 2c 63 6f 64 65 3a 22 43 6f 6e altKey,code:"Con
00017fd0: 74 72 6f 6c 4c 65 66 74 22 7d 29 7d 3b 5f 72 65 trolLeft"})};_re
00017fe0: 73 74 6f 72 65 54 6f 6f 6c 49 64 3d 22 73 65 6c storeToolId="sel
00017ff0: 65 63 74 22 3b 5f 70 69 6e 63 68 53 74 61 72 74 ect";_pinchStart
00018000: 3d 31 3b 5f 64 69 64 50 69 6e 63 68 3d 21 31 3b =1;_didPinch=!1;
00018010: 5f 73 65 6c 65 63 74 65 64 53 68 61 70 65 49 64 _selectedShapeId
00018020: 73 41 74 50 6f 69 6e 74 65 72 44 6f 77 6e 3d 5b sAtPointerDown=[
00018030: 5d 3b 5f 6c 6f 6e 67 50 72 65 73 73 54 69 6d 65 ];_longPressTime
00018040: 6f 75 74 3d 2d 31 3b 63 61 70 74 75 72 65 64 50 out=-1;capturedP
00018050: 6f 69 6e 74 65 72 49 64 3d 6e 75 6c 6c 3b 70 65 ointerId=null;pe
00018060: 72 66 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 rformanceTracker
00018070: 3b 70 65 72 66 6f 72 6d 61 6e 63 65 54 72 61 63 ;performanceTrac
00018080: 6b 65 72 54 69 6d 65 6f 75 74 3d 2d 31 3b 64 69 kerTimeout=-1;di
00018090: 73 70 61 74 63 68 3d 65 3d 3e 28 74 68 69 73 2e spatch=e=>(this.
000180a0: 5f 70 65 6e 64 69 6e 67 45 76 65 6e 74 73 46 6f _pendingEventsFo
000180b0: 72 4e 65 78 74 54 69 63 6b 2e 70 75 73 68 28 65 rNextTick.push(e
000180c0: 29 2c 22 70 6f 69 6e 74 65 72 22 3d 3d 3d 65 2e ),"pointer"===e.
000180d0: 74 79 70 65 26 26 22 70 6f 69 6e 74 65 72 5f 6d type&&"pointer_m
000180e0: 6f 76 65 22 3d 3d 3d 65 2e 6e 61 6d 65 7c 7c 22 ove"===e.name||"
000180f0: 77 68 65 65 6c 22 3d 3d 3d 65 2e 74 79 70 65 7c wheel"===e.type|
00018100: 7c 22 70 69 6e 63 68 22 3d 3d 3d 65 2e 74 79 70 |"pinch"===e.typ
00018110: 65 7c 7c 74 68 69 73 2e 5f 66 6c 75 73 68 45 76 e||this._flushEv
00018120: 65 6e 74 73 46 6f 72 54 69 63 6b 28 30 29 2c 74 entsForTick(0),t
00018130: 68 69 73 29 3b 5f 70 65 6e 64 69 6e 67 45 76 65 his);_pendingEve
00018140: 6e 74 73 46 6f 72 4e 65 78 74 54 69 63 6b 3d 5b ntsForNextTick=[
00018150: 5d 3b 5f 66 6c 75 73 68 45 76 65 6e 74 73 46 6f ];_flushEventsFo
00018160: 72 54 69 63 6b 28 65 29 7b 74 68 69 73 2e 62 61 rTick(e){this.ba
00018170: 74 63 68 28 28 28 29 3d 3e 7b 69 66 28 74 68 69 tch((()=>{if(thi
00018180: 73 2e 5f 70 65 6e 64 69 6e 67 45 76 65 6e 74 73 s._pendingEvents
00018190: 46 6f 72 4e 65 78 74 54 69 63 6b 2e 6c 65 6e 67 ForNextTick.leng
000181a0: 74 68 3e 30 29 7b 63 6f 6e 73 74 20 65 3d 5b 2e th>0){const e=[.
000181b0: 2e 2e 74 68 69 73 2e 5f 70 65 6e 64 69 6e 67 45 ..this._pendingE
000181c0: 76 65 6e 74 73 46 6f 72 4e 65 78 74 54 69 63 6b ventsForNextTick
000181d0: 5d 3b 74 68 69 73 2e 5f 70 65 6e 64 69 6e 67 45 ];this._pendingE
000181e0: 76 65 6e 74 73 46 6f 72 4e 65 78 74 54 69 63 6b ventsForNextTick
000181f0: 2e 6c 65 6e 67 74 68 3d 30 3b 66 6f 72 28 63 6f .length=0;for(co
00018200: 6e 73 74 20 74 20 6f 66 20 65 29 74 68 69 73 2e nst t of e)this.
00018210: 5f 66 6c 75 73 68 45 76 65 6e 74 46 6f 72 54 69 _flushEventForTi
00018220: 63 6b 28 74 29 7d 65 3e 30 26 26 74 68 69 73 2e ck(t)}e>0&&this.
00018230: 72 6f 6f 74 2e 68 61 6e 64 6c 65 45 76 65 6e 74 root.handleEvent
00018240: 28 7b 74 79 70 65 3a 22 6d 69 73 63 22 2c 6e 61 ({type:"misc",na
00018250: 6d 65 3a 22 74 69 63 6b 22 2c 65 6c 61 70 73 65 me:"tick",elapse
00018260: 64 3a 65 7d 29 2c 74 68 69 73 2e 73 63 72 69 62 d:e}),this.scrib
00018270: 62 6c 65 73 2e 74 69 63 6b 28 65 29 7d 29 29 7d bles.tick(e)}))}
00018280: 5f 66 6c 75 73 68 45 76 65 6e 74 46 6f 72 54 69 _flushEventForTi
00018290: 63 6b 3d 65 3d 3e 7b 69 66 28 74 68 69 73 2e 67 ck=e=>{if(this.g
000182a0: 65 74 43 72 61 73 68 69 6e 67 45 72 72 6f 72 28 etCrashingError(
000182b0: 29 29 72 65 74 75 72 6e 20 74 68 69 73 3b 63 6f ))return this;co
000182c0: 6e 73 74 7b 69 6e 70 75 74 73 3a 74 7d 3d 74 68 nst{inputs:t}=th
000182d0: 69 73 2c 7b 74 79 70 65 3a 6e 7d 3d 65 3b 69 66 is,{type:n}=e;if
000182e0: 28 22 6d 69 73 63 22 3d 3d 3d 65 2e 74 79 70 65 ("misc"===e.type
000182f0: 29 72 65 74 75 72 6e 22 63 61 6e 63 65 6c 22 21 )return"cancel"!
00018300: 3d 3d 65 2e 6e 61 6d 65 26 26 22 63 6f 6d 70 6c ==e.name&&"compl
00018310: 65 74 65 22 21 3d 3d 65 2e 6e 61 6d 65 7c 7c 28 ete"!==e.name||(
00018320: 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 73 44 72 this.inputs.isDr
00018330: 61 67 67 69 6e 67 3d 21 31 2c 74 68 69 73 2e 69 agging=!1,this.i
00018340: 6e 70 75 74 73 2e 69 73 50 61 6e 6e 69 6e 67 26 nputs.isPanning&
00018350: 26 28 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 73 &(this.inputs.is
00018360: 50 61 6e 6e 69 6e 67 3d 21 31 2c 74 68 69 73 2e Panning=!1,this.
00018370: 73 65 74 43 75 72 73 6f 72 28 7b 74 79 70 65 3a setCursor({type:
00018380: 74 68 69 73 2e 5f 70 72 65 76 43 75 72 73 6f 72 this._prevCursor
00018390: 2c 72 6f 74 61 74 69 6f 6e 3a 30 7d 29 29 29 2c ,rotation:0}))),
000183a0: 76 6f 69 64 20 74 68 69 73 2e 72 6f 6f 74 2e 68 void this.root.h
000183b0: 61 6e 64 6c 65 45 76 65 6e 74 28 65 29 3b 65 2e andleEvent(e);e.
000183c0: 73 68 69 66 74 4b 65 79 3f 28 63 6c 65 61 72 54 shiftKey?(clearT
000183d0: 69 6d 65 6f 75 74 28 74 68 69 73 2e 5f 73 68 69 imeout(this._shi
000183e0: 66 74 4b 65 79 54 69 6d 65 6f 75 74 29 2c 74 68 ftKeyTimeout),th
000183f0: 69 73 2e 5f 73 68 69 66 74 4b 65 79 54 69 6d 65 is._shiftKeyTime
00018400: 6f 75 74 3d 2d 31 2c 74 2e 73 68 69 66 74 4b 65 out=-1,t.shiftKe
00018410: 79 3d 21 30 29 3a 21 65 2e 73 68 69 66 74 4b 65 y=!0):!e.shiftKe
00018420: 79 26 26 74 2e 73 68 69 66 74 4b 65 79 26 26 2d y&&t.shiftKey&&-
00018430: 31 3d 3d 3d 74 68 69 73 2e 5f 73 68 69 66 74 4b 1===this._shiftK
00018440: 65 79 54 69 6d 65 6f 75 74 26 26 28 74 68 69 73 eyTimeout&&(this
00018450: 2e 5f 73 68 69 66 74 4b 65 79 54 69 6d 65 6f 75 ._shiftKeyTimeou
00018460: 74 3d 74 68 69 73 2e 74 69 6d 65 72 73 2e 73 65 t=this.timers.se
00018470: 74 54 69 6d 65 6f 75 74 28 74 68 69 73 2e 5f 73 tTimeout(this._s
00018480: 65 74 53 68 69 66 74 4b 65 79 54 69 6d 65 6f 75 etShiftKeyTimeou
00018490: 74 2c 31 35 30 29 29 2c 65 2e 61 6c 74 4b 65 79 t,150)),e.altKey
000184a0: 3f 28 63 6c 65 61 72 54 69 6d 65 6f 75 74 28 74 ?(clearTimeout(t
000184b0: 68 69 73 2e 5f 61 6c 74 4b 65 79 54 69 6d 65 6f his._altKeyTimeo
000184c0: 75 74 29 2c 74 68 69 73 2e 5f 61 6c 74 4b 65 79 ut),this._altKey
000184d0: 54 69 6d 65 6f 75 74 3d 2d 31 2c 74 2e 61 6c 74 Timeout=-1,t.alt
000184e0: 4b 65 79 3d 21 30 29 3a 21 65 2e 61 6c 74 4b 65 Key=!0):!e.altKe
000184f0: 79 26 26 74 2e 61 6c 74 4b 65 79 26 26 2d 31 3d y&&t.altKey&&-1=
00018500: 3d 3d 74 68 69 73 2e 5f 61 6c 74 4b 65 79 54 69 ==this._altKeyTi
00018510: 6d 65 6f 75 74 26 26 28 74 68 69 73 2e 5f 61 6c meout&&(this._al
00018520: 74 4b 65 79 54 69 6d 65 6f 75 74 3d 74 68 69 73 tKeyTimeout=this
00018530: 2e 74 69 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f .timers.setTimeo
00018540: 75 74 28 74 68 69 73 2e 5f 73 65 74 41 6c 74 4b ut(this._setAltK
00018550: 65 79 54 69 6d 65 6f 75 74 2c 31 35 30 29 29 2c eyTimeout,150)),
00018560: 65 2e 63 74 72 6c 4b 65 79 3f 28 63 6c 65 61 72 e.ctrlKey?(clear
00018570: 54 69 6d 65 6f 75 74 28 74 68 69 73 2e 5f 63 74 Timeout(this._ct
00018580: 72 6c 4b 65 79 54 69 6d 65 6f 75 74 29 2c 74 68 rlKeyTimeout),th
00018590: 69 73 2e 5f 63 74 72 6c 4b 65 79 54 69 6d 65 6f is._ctrlKeyTimeo
000185a0: 75 74 3d 2d 31 2c 74 2e 63 74 72 6c 4b 65 79 3d ut=-1,t.ctrlKey=
000185b0: 21 30 29 3a 21 65 2e 63 74 72 6c 4b 65 79 26 26 !0):!e.ctrlKey&&
000185c0: 74 2e 63 74 72 6c 4b 65 79 26 26 2d 31 3d 3d 3d t.ctrlKey&&-1===
000185d0: 74 68 69 73 2e 5f 63 74 72 6c 4b 65 79 54 69 6d this._ctrlKeyTim
000185e0: 65 6f 75 74 26 26 28 74 68 69 73 2e 5f 63 74 72 eout&&(this._ctr
000185f0: 6c 4b 65 79 54 69 6d 65 6f 75 74 3d 74 68 69 73 lKeyTimeout=this
00018600: 2e 74 69 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f .timers.setTimeo
00018610: 75 74 28 74 68 69 73 2e 5f 73 65 74 43 74 72 6c ut(this._setCtrl
00018620: 4b 65 79 54 69 6d 65 6f 75 74 2c 31 35 30 29 29 KeyTimeout,150))
00018630: 3b 63 6f 6e 73 74 7b 6f 72 69 67 69 6e 50 61 67 ;const{originPag
00018640: 65 50 6f 69 6e 74 3a 72 2c 63 75 72 72 65 6e 74 ePoint:r,current
00018650: 50 61 67 65 50 6f 69 6e 74 3a 6f 7d 3d 74 3b 74 PagePoint:o}=t;t
00018660: 2e 69 73 50 6f 69 6e 74 69 6e 67 7c 7c 28 74 2e .isPointing||(t.
00018670: 69 73 44 72 61 67 67 69 6e 67 3d 21 31 29 3b 63 isDragging=!1);c
00018680: 6f 6e 73 74 20 69 3d 74 68 69 73 2e 73 74 6f 72 onst i=this.stor
00018690: 65 2e 75 6e 73 61 66 65 47 65 74 57 69 74 68 6f e.unsafeGetWitho
000186a0: 75 74 43 61 70 74 75 72 65 28 62 6c 29 2c 61 3d utCapture(bl),a=
000186b0: 74 68 69 73 2e 73 74 6f 72 65 2e 67 65 74 28 74 this.store.get(t
000186c0: 68 69 73 2e 5f 67 65 74 43 75 72 72 65 6e 74 50 his._getCurrentP
000186d0: 61 67 65 53 74 61 74 65 49 64 28 29 29 2c 73 3d ageStateId()),s=
000186e0: 74 68 69 73 2e 5f 63 61 6d 65 72 61 4f 70 74 69 this._cameraOpti
000186f0: 6f 6e 73 2e 5f 5f 75 6e 73 61 66 65 5f 5f 67 65 ons.__unsafe__ge
00018700: 74 57 69 74 68 6f 75 74 43 61 70 74 75 72 65 28 tWithoutCapture(
00018710: 29 3b 73 77 69 74 63 68 28 6e 29 7b 63 61 73 65 );switch(n){case
00018720: 22 70 69 6e 63 68 22 3a 69 66 28 73 2e 69 73 4c "pinch":if(s.isL
00018730: 6f 63 6b 65 64 29 72 65 74 75 72 6e 3b 73 77 69 ocked)return;swi
00018740: 74 63 68 28 63 6c 65 61 72 54 69 6d 65 6f 75 74 tch(clearTimeout
00018750: 28 74 68 69 73 2e 5f 6c 6f 6e 67 50 72 65 73 73 (this._longPress
00018760: 54 69 6d 65 6f 75 74 29 2c 74 68 69 73 2e 5f 75 Timeout),this._u
00018770: 70 64 61 74 65 49 6e 70 75 74 73 46 72 6f 6d 45 pdateInputsFromE
00018780: 76 65 6e 74 28 65 29 2c 65 2e 6e 61 6d 65 29 7b vent(e),e.name){
00018790: 63 61 73 65 22 70 69 6e 63 68 5f 73 74 61 72 74 case"pinch_start
000187a0: 22 3a 69 66 28 74 2e 69 73 50 69 6e 63 68 69 6e ":if(t.isPinchin
000187b0: 67 29 72 65 74 75 72 6e 3b 72 65 74 75 72 6e 20 g)return;return
000187c0: 76 6f 69 64 28 74 2e 69 73 45 64 69 74 69 6e 67 void(t.isEditing
000187d0: 7c 7c 28 74 68 69 73 2e 5f 70 69 6e 63 68 53 74 ||(this._pinchSt
000187e0: 61 72 74 3d 74 68 69 73 2e 67 65 74 43 61 6d 65 art=this.getCame
000187f0: 72 61 28 29 2e 7a 2c 74 68 69 73 2e 5f 73 65 6c ra().z,this._sel
00018800: 65 63 74 65 64 53 68 61 70 65 49 64 73 41 74 50 ectedShapeIdsAtP
00018810: 6f 69 6e 74 65 72 44 6f 77 6e 2e 6c 65 6e 67 74 ointerDown.lengt
00018820: 68 7c 7c 28 74 68 69 73 2e 5f 73 65 6c 65 63 74 h||(this._select
00018830: 65 64 53 68 61 70 65 49 64 73 41 74 50 6f 69 6e edShapeIdsAtPoin
00018840: 74 65 72 44 6f 77 6e 3d 5b 2e 2e 2e 61 2e 73 65 terDown=[...a.se
00018850: 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 5d 29 lectedShapeIds])
00018860: 2c 74 68 69 73 2e 5f 64 69 64 50 69 6e 63 68 3d ,this._didPinch=
00018870: 21 30 2c 74 2e 69 73 50 69 6e 63 68 69 6e 67 3d !0,t.isPinching=
00018880: 21 30 2c 74 68 69 73 2e 69 6e 74 65 72 72 75 70 !0,this.interrup
00018890: 74 28 29 29 29 3b 63 61 73 65 22 70 69 6e 63 68 t()));case"pinch
000188a0: 22 3a 7b 69 66 28 21 74 2e 69 73 50 69 6e 63 68 ":{if(!t.isPinch
000188b0: 69 6e 67 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 ing)return;const
000188c0: 7b 70 6f 69 6e 74 3a 7b 7a 3a 6e 3d 31 7d 2c 64 {point:{z:n=1},d
000188d0: 65 6c 74 61 3a 7b 78 3a 72 2c 79 3a 6f 7d 7d 3d elta:{x:r,y:o}}=
000188e0: 65 2c 7b 78 3a 61 2c 79 3a 6c 7d 3d 73 75 2e 53 e,{x:a,y:l}=su.S
000188f0: 75 62 58 59 28 65 2e 70 6f 69 6e 74 2c 69 2e 73 ubXY(e.point,i.s
00018900: 63 72 65 65 6e 42 6f 75 6e 64 73 2e 78 2c 69 2e creenBounds.x,i.
00018910: 73 63 72 65 65 6e 42 6f 75 6e 64 73 2e 79 29 3b screenBounds.y);
00018920: 74 68 69 73 2e 73 74 6f 70 43 61 6d 65 72 61 41 this.stopCameraA
00018930: 6e 69 6d 61 74 69 6f 6e 28 29 2c 69 2e 66 6f 6c nimation(),i.fol
00018940: 6c 6f 77 69 6e 67 55 73 65 72 49 64 26 26 74 68 lowingUserId&&th
00018950: 69 73 2e 73 74 6f 70 46 6f 6c 6c 6f 77 69 6e 67 is.stopFollowing
00018960: 55 73 65 72 28 29 3b 63 6f 6e 73 74 7b 78 3a 63 User();const{x:c
00018970: 2c 79 3a 75 2c 7a 3a 64 7d 3d 4e 69 28 28 28 29 ,y:u,z:d}=Ni((()
00018980: 3d 3e 74 68 69 73 2e 67 65 74 43 61 6d 65 72 61 =>this.getCamera
00018990: 28 29 29 29 2c 7b 70 61 6e 53 70 65 65 64 3a 70 ())),{panSpeed:p
000189a0: 2c 7a 6f 6f 6d 53 70 65 65 64 3a 66 7d 3d 73 3b ,zoomSpeed:f}=s;
000189b0: 72 65 74 75 72 6e 20 76 6f 69 64 20 74 68 69 73 return void this
000189c0: 2e 5f 73 65 74 43 61 6d 65 72 61 28 6e 65 77 20 ._setCamera(new
000189d0: 73 75 28 63 2b 72 2a 70 2f 64 2d 61 2f 64 2b 61 su(c+r*p/d-a/d+a
000189e0: 2f 28 6e 2a 66 29 2c 75 2b 6f 2a 70 2f 64 2d 6c /(n*f),u+o*p/d-l
000189f0: 2f 64 2b 6c 2f 28 6e 2a 66 29 2c 6e 2a 66 29 2c /d+l/(n*f),n*f),
00018a00: 7b 69 6d 6d 65 64 69 61 74 65 3a 21 30 7d 29 7d {immediate:!0})}
00018a10: 63 61 73 65 22 70 69 6e 63 68 5f 65 6e 64 22 3a case"pinch_end":
00018a20: 7b 69 66 28 21 74 2e 69 73 50 69 6e 63 68 69 6e {if(!t.isPinchin
00018a30: 67 29 72 65 74 75 72 6e 20 74 68 69 73 3b 74 2e g)return this;t.
00018a40: 69 73 50 69 6e 63 68 69 6e 67 3d 21 31 3b 63 6f isPinching=!1;co
00018a50: 6e 73 74 7b 5f 73 65 6c 65 63 74 65 64 53 68 61 nst{_selectedSha
00018a60: 70 65 49 64 73 41 74 50 6f 69 6e 74 65 72 44 6f peIdsAtPointerDo
00018a70: 77 6e 3a 65 7d 3d 74 68 69 73 3b 72 65 74 75 72 wn:e}=this;retur
00018a80: 6e 20 74 68 69 73 2e 73 65 74 53 65 6c 65 63 74 n this.setSelect
00018a90: 65 64 53 68 61 70 65 73 28 74 68 69 73 2e 5f 73 edShapes(this._s
00018aa0: 65 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 41 electedShapeIdsA
00018ab0: 74 50 6f 69 6e 74 65 72 44 6f 77 6e 29 2c 74 68 tPointerDown),th
00018ac0: 69 73 2e 5f 73 65 6c 65 63 74 65 64 53 68 61 70 is._selectedShap
00018ad0: 65 49 64 73 41 74 50 6f 69 6e 74 65 72 44 6f 77 eIdsAtPointerDow
00018ae0: 6e 3d 5b 5d 2c 76 6f 69 64 28 74 68 69 73 2e 5f n=[],void(this._
00018af0: 64 69 64 50 69 6e 63 68 26 26 28 74 68 69 73 2e didPinch&&(this.
00018b00: 5f 64 69 64 50 69 6e 63 68 3d 21 31 2c 65 2e 6c _didPinch=!1,e.l
00018b10: 65 6e 67 74 68 3e 30 26 26 74 68 69 73 2e 6f 6e ength>0&&this.on
00018b20: 63 65 28 22 74 69 63 6b 22 2c 28 28 29 3d 3e 7b ce("tick",(()=>{
00018b30: 74 68 69 73 2e 5f 64 69 64 50 69 6e 63 68 7c 7c this._didPinch||
00018b40: 74 68 69 73 2e 73 65 74 53 65 6c 65 63 74 65 64 this.setSelected
00018b50: 53 68 61 70 65 73 28 65 29 7d 29 29 29 29 7d 7d Shapes(e)}))))}}
00018b60: 63 61 73 65 22 77 68 65 65 6c 22 3a 69 66 28 73 case"wheel":if(s
00018b70: 2e 69 73 4c 6f 63 6b 65 64 29 72 65 74 75 72 6e .isLocked)return
00018b80: 3b 69 66 28 74 68 69 73 2e 5f 75 70 64 61 74 65 ;if(this._update
00018b90: 49 6e 70 75 74 73 46 72 6f 6d 45 76 65 6e 74 28 InputsFromEvent(
00018ba0: 65 29 2c 74 68 69 73 2e 67 65 74 49 73 4d 65 6e e),this.getIsMen
00018bb0: 75 4f 70 65 6e 28 29 29 3b 65 6c 73 65 7b 63 6f uOpen());else{co
00018bc0: 6e 73 74 7b 70 61 6e 53 70 65 65 64 3a 6e 2c 7a nst{panSpeed:n,z
00018bd0: 6f 6f 6d 53 70 65 65 64 3a 72 2c 77 68 65 65 6c oomSpeed:r,wheel
00018be0: 42 65 68 61 76 69 6f 72 3a 6f 7d 3d 73 3b 69 66 Behavior:o}=s;if
00018bf0: 28 22 6e 6f 6e 65 22 21 3d 3d 6f 29 7b 74 68 69 ("none"!==o){thi
00018c00: 73 2e 73 74 6f 70 43 61 6d 65 72 61 41 6e 69 6d s.stopCameraAnim
00018c10: 61 74 69 6f 6e 28 29 2c 69 2e 66 6f 6c 6c 6f 77 ation(),i.follow
00018c20: 69 6e 67 55 73 65 72 49 64 26 26 74 68 69 73 2e ingUserId&&this.
00018c30: 73 74 6f 70 46 6f 6c 6c 6f 77 69 6e 67 55 73 65 stopFollowingUse
00018c40: 72 28 29 3b 63 6f 6e 73 74 7b 78 3a 61 2c 79 3a r();const{x:a,y:
00018c50: 73 2c 7a 3a 6c 7d 3d 4e 69 28 28 28 29 3d 3e 74 s,z:l}=Ni((()=>t
00018c60: 68 69 73 2e 67 65 74 43 61 6d 65 72 61 28 29 29 his.getCamera())
00018c70: 29 2c 7b 78 3a 63 2c 79 3a 75 2c 7a 3a 64 3d 30 ),{x:c,y:u,z:d=0
00018c80: 7d 3d 65 2e 64 65 6c 74 61 3b 6c 65 74 20 70 3d }=e.delta;let p=
00018c90: 6f 3b 73 77 69 74 63 68 28 74 2e 63 74 72 6c 4b o;switch(t.ctrlK
00018ca0: 65 79 26 26 28 70 3d 22 70 61 6e 22 3d 3d 3d 6f ey&&(p="pan"===o
00018cb0: 3f 22 7a 6f 6f 6d 22 3a 22 70 61 6e 22 29 2c 70 ?"zoom":"pan"),p
00018cc0: 29 7b 63 61 73 65 22 7a 6f 6f 6d 22 3a 7b 63 6f ){case"zoom":{co
00018cd0: 6e 73 74 7b 78 3a 65 2c 79 3a 74 7d 3d 74 68 69 nst{x:e,y:t}=thi
00018ce0: 73 2e 69 6e 70 75 74 73 2e 63 75 72 72 65 6e 74 s.inputs.current
00018cf0: 53 63 72 65 65 6e 50 6f 69 6e 74 3b 6c 65 74 20 ScreenPoint;let
00018d00: 6e 3d 64 3b 22 7a 6f 6f 6d 22 3d 3d 3d 6f 26 26 n=d;"zoom"===o&&
00018d10: 28 6e 3d 4d 61 74 68 2e 61 62 73 28 75 29 3e 31 (n=Math.abs(u)>1
00018d20: 30 3f 31 30 2a 4d 61 74 68 2e 73 69 67 6e 28 75 0?10*Math.sign(u
00018d30: 29 2f 31 30 30 3a 75 2f 31 30 30 29 3b 63 6f 6e )/100:u/100);con
00018d40: 73 74 20 69 3d 6c 2b 28 6e 3f 3f 30 29 2a 72 2a st i=l+(n??0)*r*
00018d50: 6c 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 l;return this._s
00018d60: 65 74 43 61 6d 65 72 61 28 6e 65 77 20 73 75 28 etCamera(new su(
00018d70: 61 2b 28 65 2f 69 2d 65 29 2d 28 65 2f 6c 2d 65 a+(e/i-e)-(e/l-e
00018d80: 29 2c 73 2b 28 74 2f 69 2d 74 29 2d 28 74 2f 6c ),s+(t/i-t)-(t/l
00018d90: 2d 74 29 2c 69 29 2c 7b 69 6d 6d 65 64 69 61 74 -t),i),{immediat
00018da0: 65 3a 21 30 7d 29 2c 76 6f 69 64 20 74 68 69 73 e:!0}),void this
00018db0: 2e 6d 61 79 62 65 54 72 61 63 6b 50 65 72 66 6f .maybeTrackPerfo
00018dc0: 72 6d 61 6e 63 65 28 22 5a 6f 6f 6d 69 6e 67 22 rmance("Zooming"
00018dd0: 29 7d 63 61 73 65 22 70 61 6e 22 3a 72 65 74 75 )}case"pan":retu
00018de0: 72 6e 20 74 68 69 73 2e 5f 73 65 74 43 61 6d 65 rn this._setCame
00018df0: 72 61 28 6e 65 77 20 73 75 28 61 2b 63 2a 6e 2f ra(new su(a+c*n/
00018e00: 6c 2c 73 2b 75 2a 6e 2f 6c 2c 6c 29 2c 7b 69 6d l,s+u*n/l,l),{im
00018e10: 6d 65 64 69 61 74 65 3a 21 30 7d 29 2c 76 6f 69 mediate:!0}),voi
00018e20: 64 20 74 68 69 73 2e 6d 61 79 62 65 54 72 61 63 d this.maybeTrac
00018e30: 6b 50 65 72 66 6f 72 6d 61 6e 63 65 28 22 50 61 kPerformance("Pa
00018e40: 6e 6e 69 6e 67 22 29 7d 7d 7d 62 72 65 61 6b 3b nning")}}}break;
00018e50: 63 61 73 65 22 70 6f 69 6e 74 65 72 22 3a 7b 69 case"pointer":{i
00018e60: 66 28 74 2e 69 73 50 69 6e 63 68 69 6e 67 29 72 f(t.isPinching)r
00018e70: 65 74 75 72 6e 3b 74 68 69 73 2e 5f 75 70 64 61 eturn;this._upda
00018e80: 74 65 49 6e 70 75 74 73 46 72 6f 6d 45 76 65 6e teInputsFromEven
00018e90: 74 28 65 29 3b 63 6f 6e 73 74 7b 69 73 50 65 6e t(e);const{isPen
00018ea0: 3a 6e 7d 3d 65 2c 7b 69 73 50 65 6e 4d 6f 64 65 :n}=e,{isPenMode
00018eb0: 3a 61 7d 3d 69 3b 73 77 69 74 63 68 28 65 2e 6e :a}=i;switch(e.n
00018ec0: 61 6d 65 29 7b 63 61 73 65 22 70 6f 69 6e 74 65 ame){case"pointe
00018ed0: 72 5f 64 6f 77 6e 22 3a 69 66 28 61 26 26 21 6e r_down":if(a&&!n
00018ee0: 29 72 65 74 75 72 6e 3b 69 66 28 74 68 69 73 2e )return;if(this.
00018ef0: 63 6c 65 61 72 4f 70 65 6e 4d 65 6e 75 73 28 29 clearOpenMenus()
00018f00: 2c 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 ,this.inputs.isP
00018f10: 61 6e 6e 69 6e 67 7c 7c 28 74 68 69 73 2e 5f 6c anning||(this._l
00018f20: 6f 6e 67 50 72 65 73 73 54 69 6d 65 6f 75 74 3d ongPressTimeout=
00018f30: 74 68 69 73 2e 74 69 6d 65 72 73 2e 73 65 74 54 this.timers.setT
00018f40: 69 6d 65 6f 75 74 28 28 28 29 3d 3e 7b 74 68 69 imeout((()=>{thi
00018f50: 73 2e 64 69 73 70 61 74 63 68 28 7b 2e 2e 2e 65 s.dispatch({...e
00018f60: 2c 70 6f 69 6e 74 3a 74 68 69 73 2e 69 6e 70 75 ,point:this.inpu
00018f70: 74 73 2e 63 75 72 72 65 6e 74 53 63 72 65 65 6e ts.currentScreen
00018f80: 50 6f 69 6e 74 2c 6e 61 6d 65 3a 22 6c 6f 6e 67 Point,name:"long
00018f90: 5f 70 72 65 73 73 22 7d 29 7d 29 2c 74 68 69 73 _press"})}),this
00018fa0: 2e 6f 70 74 69 6f 6e 73 2e 6c 6f 6e 67 50 72 65 .options.longPre
00018fb0: 73 73 44 75 72 61 74 69 6f 6e 4d 73 29 29 2c 74 ssDurationMs)),t
00018fc0: 68 69 73 2e 5f 73 65 6c 65 63 74 65 64 53 68 61 his._selectedSha
00018fd0: 70 65 49 64 73 41 74 50 6f 69 6e 74 65 72 44 6f peIdsAtPointerDo
00018fe0: 77 6e 3d 74 68 69 73 2e 67 65 74 53 65 6c 65 63 wn=this.getSelec
00018ff0: 74 65 64 53 68 61 70 65 49 64 73 28 29 2c 30 3d tedShapeIds(),0=
00019000: 3d 3d 65 2e 62 75 74 74 6f 6e 26 26 28 74 68 69 ==e.button&&(thi
00019010: 73 2e 63 61 70 74 75 72 65 64 50 6f 69 6e 74 65 s.capturedPointe
00019020: 72 49 64 3d 65 2e 70 6f 69 6e 74 65 72 49 64 29 rId=e.pointerId)
00019030: 2c 74 2e 62 75 74 74 6f 6e 73 2e 61 64 64 28 65 ,t.buttons.add(e
00019040: 2e 62 75 74 74 6f 6e 29 2c 74 2e 69 73 50 6f 69 .button),t.isPoi
00019050: 6e 74 69 6e 67 3d 21 30 2c 74 2e 69 73 44 72 61 nting=!0,t.isDra
00019060: 67 67 69 6e 67 3d 21 31 2c 21 61 26 26 6e 26 26 gging=!1,!a&&n&&
00019070: 74 68 69 73 2e 75 70 64 61 74 65 49 6e 73 74 61 this.updateInsta
00019080: 6e 63 65 53 74 61 74 65 28 7b 69 73 50 65 6e 4d nceState({isPenM
00019090: 6f 64 65 3a 21 30 7d 29 2c 35 3d 3d 3d 65 2e 62 ode:!0}),5===e.b
000190a0: 75 74 74 6f 6e 3f 28 74 68 69 73 2e 5f 72 65 73 utton?(this._res
000190b0: 74 6f 72 65 54 6f 6f 6c 49 64 3d 74 68 69 73 2e toreToolId=this.
000190c0: 67 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 49 64 getCurrentToolId
000190d0: 28 29 2c 74 68 69 73 2e 63 6f 6d 70 6c 65 74 65 (),this.complete
000190e0: 28 29 2c 74 68 69 73 2e 73 65 74 43 75 72 72 65 (),this.setCurre
000190f0: 6e 74 54 6f 6f 6c 28 22 65 72 61 73 65 72 22 29 ntTool("eraser")
00019100: 29 3a 31 3d 3d 3d 65 2e 62 75 74 74 6f 6e 26 26 ):1===e.button&&
00019110: 28 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 (this.inputs.isP
00019120: 61 6e 6e 69 6e 67 7c 7c 28 74 68 69 73 2e 5f 70 anning||(this._p
00019130: 72 65 76 43 75 72 73 6f 72 3d 74 68 69 73 2e 67 revCursor=this.g
00019140: 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 etInstanceState(
00019150: 29 2e 63 75 72 73 6f 72 2e 74 79 70 65 29 2c 74 ).cursor.type),t
00019160: 68 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 61 6e his.inputs.isPan
00019170: 6e 69 6e 67 3d 21 30 2c 63 6c 65 61 72 54 69 6d ning=!0,clearTim
00019180: 65 6f 75 74 28 74 68 69 73 2e 5f 6c 6f 6e 67 50 eout(this._longP
00019190: 72 65 73 73 54 69 6d 65 6f 75 74 29 29 2c 74 68 ressTimeout)),th
000191a0: 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 61 6e 6e is.inputs.isPann
000191b0: 69 6e 67 29 72 65 74 75 72 6e 20 74 68 69 73 2e ing)return this.
000191c0: 73 74 6f 70 43 61 6d 65 72 61 41 6e 69 6d 61 74 stopCameraAnimat
000191d0: 69 6f 6e 28 29 2c 74 68 69 73 2e 73 65 74 43 75 ion(),this.setCu
000191e0: 72 73 6f 72 28 7b 74 79 70 65 3a 22 67 72 61 62 rsor({type:"grab
000191f0: 62 69 6e 67 22 2c 72 6f 74 61 74 69 6f 6e 3a 30 bing",rotation:0
00019200: 7d 29 2c 74 68 69 73 3b 62 72 65 61 6b 3b 63 61 }),this;break;ca
00019210: 73 65 22 70 6f 69 6e 74 65 72 5f 6d 6f 76 65 22 se"pointer_move"
00019220: 3a 7b 69 66 28 21 6e 26 26 61 29 72 65 74 75 72 :{if(!n&&a)retur
00019230: 6e 3b 63 6f 6e 73 74 7b 78 3a 65 2c 79 3a 6c 2c n;const{x:e,y:l,
00019240: 7a 3a 63 7d 3d 4e 69 28 28 28 29 3d 3e 74 68 69 z:c}=Ni((()=>thi
00019250: 73 2e 67 65 74 43 61 6d 65 72 61 28 29 29 29 3b s.getCamera()));
00019260: 69 66 28 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 if(this.inputs.i
00019270: 73 50 61 6e 6e 69 6e 67 26 26 74 68 69 73 2e 69 sPanning&&this.i
00019280: 6e 70 75 74 73 2e 69 73 50 6f 69 6e 74 69 6e 67 nputs.isPointing
00019290: 29 7b 63 6f 6e 73 74 7b 63 75 72 72 65 6e 74 53 ){const{currentS
000192a0: 63 72 65 65 6e 50 6f 69 6e 74 3a 74 2c 70 72 65 creenPoint:t,pre
000192b0: 76 69 6f 75 73 53 63 72 65 65 6e 50 6f 69 6e 74 viousScreenPoint
000192c0: 3a 6e 7d 3d 74 68 69 73 2e 69 6e 70 75 74 73 2c :n}=this.inputs,
000192d0: 7b 70 61 6e 53 70 65 65 64 3a 72 7d 3d 73 2c 6f {panSpeed:r}=s,o
000192e0: 3d 73 75 2e 53 75 62 28 74 2c 6e 29 3b 72 65 74 =su.Sub(t,n);ret
000192f0: 75 72 6e 20 74 68 69 73 2e 73 65 74 43 61 6d 65 urn this.setCame
00019300: 72 61 28 6e 65 77 20 73 75 28 65 2b 6f 2e 78 2a ra(new su(e+o.x*
00019310: 72 2f 63 2c 6c 2b 6f 2e 79 2a 72 2f 63 2c 63 29 r/c,l+o.y*r/c,c)
00019320: 2c 7b 69 6d 6d 65 64 69 61 74 65 3a 21 30 7d 29 ,{immediate:!0})
00019330: 2c 76 6f 69 64 20 74 68 69 73 2e 6d 61 79 62 65 ,void this.maybe
00019340: 54 72 61 63 6b 50 65 72 66 6f 72 6d 61 6e 63 65 TrackPerformance
00019350: 28 22 50 61 6e 6e 69 6e 67 22 29 7d 74 2e 69 73 ("Panning")}t.is
00019360: 50 6f 69 6e 74 69 6e 67 26 26 21 74 2e 69 73 44 Pointing&&!t.isD
00019370: 72 61 67 67 69 6e 67 26 26 73 75 2e 44 69 73 74 ragging&&su.Dist
00019380: 32 28 72 2c 6f 29 2a 74 68 69 73 2e 67 65 74 5a 2(r,o)*this.getZ
00019390: 6f 6f 6d 4c 65 76 65 6c 28 29 3e 28 69 2e 69 73 oomLevel()>(i.is
000193a0: 43 6f 61 72 73 65 50 6f 69 6e 74 65 72 3f 74 68 CoarsePointer?th
000193b0: 69 73 2e 6f 70 74 69 6f 6e 73 2e 63 6f 61 72 73 is.options.coars
000193c0: 65 44 72 61 67 44 69 73 74 61 6e 63 65 53 71 75 eDragDistanceSqu
000193d0: 61 72 65 64 3a 74 68 69 73 2e 6f 70 74 69 6f 6e ared:this.option
000193e0: 73 2e 64 72 61 67 44 69 73 74 61 6e 63 65 53 71 s.dragDistanceSq
000193f0: 75 61 72 65 64 29 2f 63 26 26 28 74 2e 69 73 44 uared)/c&&(t.isD
00019400: 72 61 67 67 69 6e 67 3d 21 30 2c 63 6c 65 61 72 ragging=!0,clear
00019410: 54 69 6d 65 6f 75 74 28 74 68 69 73 2e 5f 6c 6f Timeout(this._lo
00019420: 6e 67 50 72 65 73 73 54 69 6d 65 6f 75 74 29 29 ngPressTimeout))
00019430: 3b 62 72 65 61 6b 7d 63 61 73 65 22 70 6f 69 6e ;break}case"poin
00019440: 74 65 72 5f 75 70 22 3a 69 66 28 74 2e 69 73 44 ter_up":if(t.isD
00019450: 72 61 67 67 69 6e 67 3d 21 31 2c 74 2e 69 73 50 ragging=!1,t.isP
00019460: 6f 69 6e 74 69 6e 67 3d 21 31 2c 63 6c 65 61 72 ointing=!1,clear
00019470: 54 69 6d 65 6f 75 74 28 74 68 69 73 2e 5f 6c 6f Timeout(this._lo
00019480: 6e 67 50 72 65 73 73 54 69 6d 65 6f 75 74 29 2c ngPressTimeout),
00019490: 74 2e 62 75 74 74 6f 6e 73 2e 64 65 6c 65 74 65 t.buttons.delete
000194a0: 28 65 2e 62 75 74 74 6f 6e 29 2c 74 68 69 73 2e (e.button),this.
000194b0: 67 65 74 49 73 4d 65 6e 75 4f 70 65 6e 28 29 29 getIsMenuOpen())
000194c0: 72 65 74 75 72 6e 3b 69 66 28 69 2e 69 73 50 65 return;if(i.isPe
000194d0: 6e 4d 6f 64 65 26 26 21 6e 29 72 65 74 75 72 6e nMode&&!n)return
000194e0: 3b 69 66 28 74 68 69 73 2e 63 61 70 74 75 72 65 ;if(this.capture
000194f0: 64 50 6f 69 6e 74 65 72 49 64 3d 3d 3d 65 2e 70 dPointerId===e.p
00019500: 6f 69 6e 74 65 72 49 64 26 26 28 74 68 69 73 2e ointerId&&(this.
00019510: 63 61 70 74 75 72 65 64 50 6f 69 6e 74 65 72 49 capturedPointerI
00019520: 64 3d 6e 75 6c 6c 2c 65 2e 62 75 74 74 6f 6e 3d d=null,e.button=
00019530: 30 29 2c 74 2e 69 73 50 61 6e 6e 69 6e 67 29 7b 0),t.isPanning){
00019540: 74 2e 6b 65 79 73 2e 68 61 73 28 22 53 70 61 63 t.keys.has("Spac
00019550: 65 22 29 7c 7c 28 74 2e 69 73 50 61 6e 6e 69 6e e")||(t.isPannin
00019560: 67 3d 21 31 29 3b 63 6f 6e 73 74 20 6e 3d 74 68 g=!1);const n=th
00019570: 69 73 2e 69 6e 70 75 74 73 2e 70 6f 69 6e 74 65 is.inputs.pointe
00019580: 72 56 65 6c 6f 63 69 74 79 2c 72 3d 4d 61 74 68 rVelocity,r=Math
00019590: 2e 6d 69 6e 28 32 2c 6e 2e 6c 65 6e 28 29 29 3b .min(2,n.len());
000195a0: 73 77 69 74 63 68 28 65 2e 62 75 74 74 6f 6e 29 switch(e.button)
000195b0: 7b 63 61 73 65 20 30 3a 74 68 69 73 2e 73 65 74 {case 0:this.set
000195c0: 43 75 72 73 6f 72 28 7b 74 79 70 65 3a 22 67 72 Cursor({type:"gr
000195d0: 61 62 22 2c 72 6f 74 61 74 69 6f 6e 3a 30 7d 29 ab",rotation:0})
000195e0: 3b 62 72 65 61 6b 3b 63 61 73 65 20 31 3a 74 68 ;break;case 1:th
000195f0: 69 73 2e 69 6e 70 75 74 73 2e 6b 65 79 73 2e 68 is.inputs.keys.h
00019600: 61 73 28 22 20 22 29 3f 74 68 69 73 2e 73 65 74 as(" ")?this.set
00019610: 43 75 72 73 6f 72 28 7b 74 79 70 65 3a 22 67 72 Cursor({type:"gr
00019620: 61 62 22 2c 72 6f 74 61 74 69 6f 6e 3a 30 7d 29 ab",rotation:0})
00019630: 3a 74 68 69 73 2e 73 65 74 43 75 72 73 6f 72 28 :this.setCursor(
00019640: 7b 74 79 70 65 3a 74 68 69 73 2e 5f 70 72 65 76 {type:this._prev
00019650: 43 75 72 73 6f 72 2c 72 6f 74 61 74 69 6f 6e 3a Cursor,rotation:
00019660: 30 7d 29 7d 72 3e 30 26 26 74 68 69 73 2e 73 6c 0})}r>0&&this.sl
00019670: 69 64 65 43 61 6d 65 72 61 28 7b 73 70 65 65 64 ideCamera({speed
00019680: 3a 72 2c 64 69 72 65 63 74 69 6f 6e 3a 6e 7d 29 :r,direction:n})
00019690: 7d 65 6c 73 65 20 35 3d 3d 3d 65 2e 62 75 74 74 }else 5===e.butt
000196a0: 6f 6e 26 26 28 74 68 69 73 2e 63 6f 6d 70 6c 65 on&&(this.comple
000196b0: 74 65 28 29 2c 74 68 69 73 2e 73 65 74 43 75 72 te(),this.setCur
000196c0: 72 65 6e 74 54 6f 6f 6c 28 74 68 69 73 2e 5f 72 rentTool(this._r
000196d0: 65 73 74 6f 72 65 54 6f 6f 6c 49 64 29 29 7d 62 estoreToolId))}b
000196e0: 72 65 61 6b 7d 63 61 73 65 22 6b 65 79 62 6f 61 reak}case"keyboa
000196f0: 72 64 22 3a 73 77 69 74 63 68 28 22 53 68 69 66 rd":switch("Shif
00019700: 74 52 69 67 68 74 22 3d 3d 3d 65 2e 6b 65 79 26 tRight"===e.key&
00019710: 26 28 65 2e 6b 65 79 3d 22 53 68 69 66 74 4c 65 &(e.key="ShiftLe
00019720: 66 74 22 29 2c 22 41 6c 74 52 69 67 68 74 22 3d ft"),"AltRight"=
00019730: 3d 3d 65 2e 6b 65 79 26 26 28 65 2e 6b 65 79 3d ==e.key&&(e.key=
00019740: 22 41 6c 74 4c 65 66 74 22 29 2c 22 43 6f 6e 74 "AltLeft"),"Cont
00019750: 72 6f 6c 52 69 67 68 74 22 3d 3d 3d 65 2e 63 6f rolRight"===e.co
00019760: 64 65 26 26 28 65 2e 63 6f 64 65 3d 22 43 6f 6e de&&(e.code="Con
00019770: 74 72 6f 6c 4c 65 66 74 22 29 2c 65 2e 6e 61 6d trolLeft"),e.nam
00019780: 65 29 7b 63 61 73 65 22 6b 65 79 5f 64 6f 77 6e e){case"key_down
00019790: 22 3a 74 2e 6b 65 79 73 2e 61 64 64 28 65 2e 63 ":t.keys.add(e.c
000197a0: 6f 64 65 29 2c 22 53 70 61 63 65 22 21 3d 3d 65 ode),"Space"!==e
000197b0: 2e 63 6f 64 65 7c 7c 65 2e 63 74 72 6c 4b 65 79 .code||e.ctrlKey
000197c0: 7c 7c 28 74 68 69 73 2e 69 6e 70 75 74 73 2e 69 ||(this.inputs.i
000197d0: 73 50 61 6e 6e 69 6e 67 7c 7c 28 74 68 69 73 2e sPanning||(this.
000197e0: 5f 70 72 65 76 43 75 72 73 6f 72 3d 69 2e 63 75 _prevCursor=i.cu
000197f0: 72 73 6f 72 2e 74 79 70 65 29 2c 74 68 69 73 2e rsor.type),this.
00019800: 69 6e 70 75 74 73 2e 69 73 50 61 6e 6e 69 6e 67 inputs.isPanning
00019810: 3d 21 30 2c 63 6c 65 61 72 54 69 6d 65 6f 75 74 =!0,clearTimeout
00019820: 28 74 68 69 73 2e 5f 6c 6f 6e 67 50 72 65 73 73 (this._longPress
00019830: 54 69 6d 65 6f 75 74 29 2c 74 68 69 73 2e 73 65 Timeout),this.se
00019840: 74 43 75 72 73 6f 72 28 7b 74 79 70 65 3a 74 68 tCursor({type:th
00019850: 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 6f 69 6e is.inputs.isPoin
00019860: 74 69 6e 67 3f 22 67 72 61 62 62 69 6e 67 22 3a ting?"grabbing":
00019870: 22 67 72 61 62 22 2c 72 6f 74 61 74 69 6f 6e 3a "grab",rotation:
00019880: 30 7d 29 29 3b 62 72 65 61 6b 3b 63 61 73 65 22 0}));break;case"
00019890: 6b 65 79 5f 75 70 22 3a 74 2e 6b 65 79 73 2e 64 key_up":t.keys.d
000198a0: 65 6c 65 74 65 28 65 2e 63 6f 64 65 29 2c 22 53 elete(e.code),"S
000198b0: 70 61 63 65 22 3d 3d 3d 65 2e 63 6f 64 65 26 26 pace"===e.code&&
000198c0: 28 74 68 69 73 2e 69 6e 70 75 74 73 2e 62 75 74 (this.inputs.but
000198d0: 74 6f 6e 73 2e 68 61 73 28 31 29 7c 7c 28 74 68 tons.has(1)||(th
000198e0: 69 73 2e 69 6e 70 75 74 73 2e 69 73 50 61 6e 6e is.inputs.isPann
000198f0: 69 6e 67 3d 21 31 2c 74 68 69 73 2e 73 65 74 43 ing=!1,this.setC
00019900: 75 72 73 6f 72 28 7b 74 79 70 65 3a 74 68 69 73 ursor({type:this
00019910: 2e 5f 70 72 65 76 43 75 72 73 6f 72 2c 72 6f 74 ._prevCursor,rot
00019920: 61 74 69 6f 6e 3a 30 7d 29 29 29 7d 7d 69 66 28 ation:0})))}}if(
00019930: 22 70 6f 69 6e 74 65 72 22 3d 3d 3d 65 2e 74 79 "pointer"===e.ty
00019940: 70 65 29 7b 31 3d 3d 3d 65 2e 62 75 74 74 6f 6e pe){1===e.button
00019950: 3f 65 2e 6e 61 6d 65 3d 22 6d 69 64 64 6c 65 5f ?e.name="middle_
00019960: 63 6c 69 63 6b 22 3a 65 2e 62 75 74 74 6f 6e 3d click":e.button=
00019970: 3d 3d 71 75 26 26 28 65 2e 6e 61 6d 65 3d 22 72 ==qu&&(e.name="r
00019980: 69 67 68 74 5f 63 6c 69 63 6b 22 29 3b 63 6f 6e ight_click");con
00019990: 73 74 7b 69 73 50 65 6e 4d 6f 64 65 3a 74 7d 3d st{isPenMode:t}=
000199a0: 74 68 69 73 2e 73 74 6f 72 65 2e 75 6e 73 61 66 this.store.unsaf
000199b0: 65 47 65 74 57 69 74 68 6f 75 74 43 61 70 74 75 eGetWithoutCaptu
000199c0: 72 65 28 62 6c 29 3b 69 66 28 65 2e 69 73 50 65 re(bl);if(e.isPe
000199d0: 6e 3d 3d 3d 74 29 7b 63 6f 6e 73 74 20 74 3d 74 n===t){const t=t
000199e0: 68 69 73 2e 5f 63 6c 69 63 6b 4d 61 6e 61 67 65 his._clickManage
000199f0: 72 2e 68 61 6e 64 6c 65 50 6f 69 6e 74 65 72 45 r.handlePointerE
00019a00: 76 65 6e 74 28 65 29 3b 69 66 28 65 2e 6e 61 6d vent(e);if(e.nam
00019a10: 65 21 3d 3d 74 2e 6e 61 6d 65 29 72 65 74 75 72 e!==t.name)retur
00019a20: 6e 20 74 68 69 73 2e 72 6f 6f 74 2e 68 61 6e 64 n this.root.hand
00019a30: 6c 65 45 76 65 6e 74 28 65 29 2c 74 68 69 73 2e leEvent(e),this.
00019a40: 65 6d 69 74 28 22 65 76 65 6e 74 22 2c 65 29 2c emit("event",e),
00019a50: 74 68 69 73 2e 72 6f 6f 74 2e 68 61 6e 64 6c 65 this.root.handle
00019a60: 45 76 65 6e 74 28 74 29 2c 76 6f 69 64 20 74 68 Event(t),void th
00019a70: 69 73 2e 65 6d 69 74 28 22 65 76 65 6e 74 22 2c is.emit("event",
00019a80: 74 29 7d 7d 72 65 74 75 72 6e 20 74 68 69 73 2e t)}}return this.
00019a90: 72 6f 6f 74 2e 68 61 6e 64 6c 65 45 76 65 6e 74 root.handleEvent
00019aa0: 28 65 29 2c 74 68 69 73 2e 65 6d 69 74 28 22 65 (e),this.emit("e
00019ab0: 76 65 6e 74 22 2c 65 29 2c 74 68 69 73 7d 3b 6d vent",e),this};m
00019ac0: 61 79 62 65 54 72 61 63 6b 50 65 72 66 6f 72 6d aybeTrackPerform
00019ad0: 61 6e 63 65 28 65 29 7b 58 75 2e 6d 65 61 73 75 ance(e){Xu.measu
00019ae0: 72 65 50 65 72 66 6f 72 6d 61 6e 63 65 2e 67 65 rePerformance.ge
00019af0: 74 28 29 26 26 28 74 68 69 73 2e 70 65 72 66 6f t()&&(this.perfo
00019b00: 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 2e 69 73 rmanceTracker.is
00019b10: 53 74 61 72 74 65 64 28 29 3f 63 6c 65 61 72 54 Started()?clearT
00019b20: 69 6d 65 6f 75 74 28 74 68 69 73 2e 70 65 72 66 imeout(this.perf
00019b30: 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 54 69 ormanceTrackerTi
00019b40: 6d 65 6f 75 74 29 3a 74 68 69 73 2e 70 65 72 66 meout):this.perf
00019b50: 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 2e 73 ormanceTracker.s
00019b60: 74 61 72 74 28 65 29 2c 74 68 69 73 2e 70 65 72 tart(e),this.per
00019b70: 66 6f 72 6d 61 6e 63 65 54 72 61 63 6b 65 72 54 formanceTrackerT
00019b80: 69 6d 65 6f 75 74 3d 74 68 69 73 2e 74 69 6d 65 imeout=this.time
00019b90: 72 73 2e 73 65 74 54 69 6d 65 6f 75 74 28 28 28 rs.setTimeout(((
00019ba0: 29 3d 3e 7b 74 68 69 73 2e 70 65 72 66 6f 72 6d )=>{this.perform
00019bb0: 61 6e 63 65 54 72 61 63 6b 65 72 2e 73 74 6f 70 anceTracker.stop
00019bc0: 28 29 7d 29 2c 35 30 29 29 7d 7d 66 75 6e 63 74 ()}),50))}}funct
00019bd0: 69 6f 6e 20 55 6d 28 65 2c 74 3d 65 2e 67 65 74 ion Um(e,t=e.get
00019be0: 43 75 72 72 65 6e 74 50 61 67 65 49 64 28 29 29 CurrentPageId())
00019bf0: 7b 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 74 50 61 {const n=e.getPa
00019c00: 67 65 28 74 29 2e 6e 61 6d 65 3b 65 2e 65 6d 69 ge(t).name;e.emi
00019c10: 74 28 22 6d 61 78 2d 73 68 61 70 65 73 22 2c 7b t("max-shapes",{
00019c20: 6e 61 6d 65 3a 6e 2c 70 61 67 65 49 64 3a 74 2c name:n,pageId:t,
00019c30: 63 6f 75 6e 74 3a 65 2e 6f 70 74 69 6f 6e 73 2e count:e.options.
00019c40: 6d 61 78 53 68 61 70 65 73 50 65 72 50 61 67 65 maxShapesPerPage
00019c50: 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 7a 6d 28 65 })}function zm(e
00019c60: 2c 74 29 7b 69 66 28 21 74 29 72 65 74 75 72 6e ,t){if(!t)return
00019c70: 20 65 3b 6c 65 74 20 6e 3d 6e 75 6c 6c 3b 63 6f e;let n=null;co
00019c80: 6e 73 74 20 72 3d 4f 62 6a 65 63 74 2e 65 6e 74 nst r=Object.ent
00019c90: 72 69 65 73 28 74 29 3b 66 6f 72 28 6c 65 74 20 ries(t);for(let
00019ca0: 74 3d 30 2c 6f 3d 72 2e 6c 65 6e 67 74 68 3b 74 t=0,o=r.length;t
00019cb0: 3c 6f 3b 74 2b 2b 29 7b 63 6f 6e 73 74 5b 6f 2c <o;t++){const[o,
00019cc0: 69 5d 3d 72 5b 74 5d 3b 69 66 28 76 6f 69 64 20 i]=r[t];if(void
00019cd0: 30 21 3d 3d 69 26 26 28 22 69 64 22 21 3d 3d 6f 0!==i&&("id"!==o
00019ce0: 26 26 22 74 79 70 65 22 21 3d 3d 6f 26 26 22 74 &&"type"!==o&&"t
00019cf0: 79 70 65 4e 61 6d 65 22 21 3d 3d 6f 26 26 69 21 ypeName"!==o&&i!
00019d00: 3d 3d 65 5b 6f 5d 29 29 69 66 28 6e 7c 7c 28 6e ==e[o]))if(n||(n
00019d10: 3d 7b 2e 2e 2e 65 7d 29 2c 22 70 72 6f 70 73 22 ={...e}),"props"
00019d20: 21 3d 3d 6f 26 26 22 6d 65 74 61 22 21 3d 3d 6f !==o&&"meta"!==o
00019d30: 29 6e 5b 6f 5d 3d 69 3b 65 6c 73 65 7b 6e 5b 6f )n[o]=i;else{n[o
00019d40: 5d 3d 7b 2e 2e 2e 65 5b 6f 5d 7d 3b 66 6f 72 28 ]={...e[o]};for(
00019d50: 63 6f 6e 73 74 5b 65 2c 74 5d 6f 66 20 4f 62 6a const[e,t]of Obj
00019d60: 65 63 74 2e 65 6e 74 72 69 65 73 28 69 29 29 76 ect.entries(i))v
00019d70: 6f 69 64 20 30 21 3d 3d 74 26 26 28 6e 5b 6f 5d oid 0!==t&&(n[o]
00019d80: 5b 65 5d 3d 74 29 7d 7d 72 65 74 75 72 6e 20 6e [e]=t)}}return n
00019d90: 7c 7c 65 7d 66 75 6e 63 74 69 6f 6e 20 47 6d 28 ||e}function Gm(
00019da0: 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 65 e,t,n){const r=e
00019db0: 2e 67 65 74 53 68 61 70 65 28 74 29 3b 69 66 28 .getShape(t);if(
00019dc0: 21 72 29 72 65 74 75 72 6e 3b 6e 2e 70 75 73 68 !r)return;n.push
00019dd0: 28 72 29 3b 63 6f 6e 73 74 20 6f 3d 65 2e 67 65 (r);const o=e.ge
00019de0: 74 53 6f 72 74 65 64 43 68 69 6c 64 49 64 73 46 tSortedChildIdsF
00019df0: 6f 72 50 61 72 65 6e 74 28 74 29 3b 66 6f 72 28 orParent(t);for(
00019e00: 6c 65 74 20 74 3d 30 2c 72 3d 6f 2e 6c 65 6e 67 let t=0,r=o.leng
00019e10: 74 68 3b 74 3c 72 3b 74 2b 2b 29 47 6d 28 65 2c th;t<r;t++)Gm(e,
00019e20: 6f 5b 74 5d 2c 6e 29 7d 66 75 6e 63 74 69 6f 6e o[t],n)}function
00019e30: 20 48 6d 28 65 2c 74 2c 6e 29 7b 6c 65 74 20 72 Hm(e,t,n){let r
00019e40: 3b 69 66 28 65 2e 68 69 73 74 6f 72 79 2e 69 67 ;if(e.history.ig
00019e50: 6e 6f 72 65 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 nore((()=>{const
00019e60: 20 6f 3d 65 2e 73 74 6f 72 65 2e 65 78 74 72 61 o=e.store.extra
00019e70: 63 74 69 6e 67 43 68 61 6e 67 65 73 28 28 28 29 ctingChanges((()
00019e80: 3d 3e 7b 63 6f 6e 73 74 20 6f 3d 6e 65 77 20 53 =>{const o=new S
00019e90: 65 74 2c 69 3d 6e 65 77 20 53 65 74 3b 66 6f 72 et,i=new Set;for
00019ea0: 28 63 6f 6e 73 74 20 6e 20 6f 66 20 74 29 7b 69 (const n of t){i
00019eb0: 66 28 65 2e 67 65 74 53 68 61 70 65 28 6e 29 29 f(e.getShape(n))
00019ec0: 66 6f 72 28 63 6f 6e 73 74 20 72 20 6f 66 20 65 for(const r of e
00019ed0: 2e 67 65 74 42 69 6e 64 69 6e 67 73 49 6e 76 6f .getBindingsInvo
00019ee0: 6c 76 69 6e 67 53 68 61 70 65 28 6e 29 29 7b 63 lvingShape(n)){c
00019ef0: 6f 6e 73 74 20 65 3d 74 2e 68 61 73 28 72 2e 66 onst e=t.has(r.f
00019f00: 72 6f 6d 49 64 29 2c 6e 3d 74 2e 68 61 73 28 72 romId),n=t.has(r
00019f10: 2e 74 6f 49 64 29 3b 65 26 26 6e 3f 6f 2e 61 64 .toId);e&&n?o.ad
00019f20: 64 28 72 2e 69 64 29 3a 65 26 26 6e 7c 7c 69 2e d(r.id):e&&n||i.
00019f30: 61 64 64 28 72 2e 69 64 29 7d 7d 65 2e 64 65 6c add(r.id)}}e.del
00019f40: 65 74 65 42 69 6e 64 69 6e 67 73 28 5b 2e 2e 2e eteBindings([...
00019f50: 69 5d 2c 7b 69 73 6f 6c 61 74 65 53 68 61 70 65 i],{isolateShape
00019f60: 73 3a 21 30 7d 29 3b 74 72 79 7b 72 3d 56 72 2e s:!0});try{r=Vr.
00019f70: 6f 6b 28 6e 28 6f 29 29 7d 63 61 74 63 68 28 65 ok(n(o))}catch(e
00019f80: 29 7b 72 3d 56 72 2e 65 72 72 28 65 29 7d 7d 29 ){r=Vr.err(e)}})
00019f90: 29 3b 65 2e 73 74 6f 72 65 2e 61 70 70 6c 79 44 );e.store.applyD
00019fa0: 69 66 66 28 67 69 28 6f 29 29 7d 29 29 2c 72 2e iff(gi(o))})),r.
00019fb0: 6f 6b 29 72 65 74 75 72 6e 20 72 2e 76 61 6c 75 ok)return r.valu
00019fc0: 65 3b 74 68 72 6f 77 20 72 2e 65 72 72 6f 72 7d e;throw r.error}
00019fd0: 66 75 6e 63 74 69 6f 6e 20 56 6d 28 65 2c 74 29 function Vm(e,t)
00019fe0: 7b 69 66 28 21 74 2e 63 6f 6e 73 74 72 61 69 6e {if(!t.constrain
00019ff0: 74 73 29 74 68 72 6f 77 20 45 72 72 6f 72 28 22 ts)throw Error("
0001a000: 53 68 6f 75 6c 64 20 68 61 76 65 20 63 6f 6e 73 Should have cons
0001a010: 74 72 61 69 6e 74 73 20 68 65 72 65 22 29 3b 63 traints here");c
0001a020: 6f 6e 73 74 7b 70 61 64 64 69 6e 67 3a 7b 78 3a onst{padding:{x:
0001a030: 6e 2c 79 3a 72 7d 7d 3d 74 2e 63 6f 6e 73 74 72 n,y:r}}=t.constr
0001a040: 61 69 6e 74 73 2c 6f 3d 65 2e 67 65 74 56 69 65 aints,o=e.getVie
0001a050: 77 70 6f 72 74 53 63 72 65 65 6e 42 6f 75 6e 64 wportScreenBound
0001a060: 73 28 29 2c 69 3d 5f 70 2e 46 72 6f 6d 28 74 2e s(),i=_p.From(t.
0001a070: 63 6f 6e 73 74 72 61 69 6e 74 73 2e 62 6f 75 6e constraints.boun
0001a080: 64 73 29 3b 72 65 74 75 72 6e 7b 7a 78 3a 28 6f ds);return{zx:(o
0001a090: 2e 77 2d 32 2a 6e 29 2f 69 2e 77 2c 7a 79 3a 28 .w-2*n)/i.w,zy:(
0001a0a0: 6f 2e 68 2d 32 2a 72 29 2f 69 2e 68 7d 7d 66 75 o.h-2*r)/i.h}}fu
0001a0b0: 6e 63 74 69 6f 6e 20 71 6d 28 29 7b 63 6f 6e 73 nction qm(){cons
0001a0c0: 74 20 65 3d 72 75 28 29 2c 74 3d 57 68 28 29 3b t e=ru(),t=Wh();
0001a0d0: 72 65 74 75 72 6e 20 64 61 28 22 69 73 44 61 72 return da("isDar
0001a0e0: 6b 4d 6f 64 65 22 2c 28 28 29 3d 3e 74 3f 2e 69 kMode",(()=>t?.i
0001a0f0: 73 44 61 72 6b 4d 6f 64 65 3f 3f 65 2e 75 73 65 sDarkMode??e.use
0001a100: 72 2e 67 65 74 49 73 44 61 72 6b 4d 6f 64 65 28 r.getIsDarkMode(
0001a110: 29 29 2c 5b 74 2c 65 5d 29 7d 6a 6d 28 5b 6f 61 )),[t,e])}jm([oa
0001a120: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a130: 67 65 74 43 61 6e 55 6e 64 6f 22 2c 31 29 2c 6a getCanUndo",1),j
0001a140: 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 m([oa],Bm.protot
0001a150: 79 70 65 2c 22 67 65 74 43 61 6e 52 65 64 6f 22 ype,"getCanRedo"
0001a160: 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 ,1),jm([oa],Bm.p
0001a170: 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 50 61 74 rototype,"getPat
0001a180: 68 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d h",1),jm([oa],Bm
0001a190: 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 43 .prototype,"getC
0001a1a0: 75 72 72 65 6e 74 54 6f 6f 6c 22 2c 31 29 2c 6a urrentTool",1),j
0001a1b0: 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 m([oa],Bm.protot
0001a1c0: 79 70 65 2c 22 67 65 74 43 75 72 72 65 6e 74 54 ype,"getCurrentT
0001a1d0: 6f 6f 6c 49 64 22 2c 31 29 2c 6a 6d 28 5b 6f 61 oolId",1),jm([oa
0001a1e0: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a1f0: 67 65 74 44 6f 63 75 6d 65 6e 74 53 65 74 74 69 getDocumentSetti
0001a200: 6e 67 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c ngs",1),jm([oa],
0001a210: 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 Bm.prototype,"ge
0001a220: 74 49 6e 73 74 61 6e 63 65 53 74 61 74 65 22 2c tInstanceState",
0001a230: 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 1),jm([oa],Bm.pr
0001a240: 6f 74 6f 74 79 70 65 2c 22 67 65 74 4f 70 65 6e ototype,"getOpen
0001a250: 4d 65 6e 75 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 Menus",1),jm([oa
0001a260: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a270: 67 65 74 49 73 4d 65 6e 75 4f 70 65 6e 22 2c 31 getIsMenuOpen",1
0001a280: 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f ),jm([oa],Bm.pro
0001a290: 74 6f 74 79 70 65 2c 22 67 65 74 50 61 67 65 53 totype,"getPageS
0001a2a0: 74 61 74 65 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 tates",1),jm([oa
0001a2b0: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a2c0: 5f 67 65 74 50 61 67 65 53 74 61 74 65 73 51 75 _getPageStatesQu
0001a2d0: 65 72 79 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c ery",1),jm([oa],
0001a2e0: 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 Bm.prototype,"ge
0001a2f0: 74 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 tCurrentPageStat
0001a300: 65 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d e",1),jm([oa],Bm
0001a310: 2e 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 .prototype,"_get
0001a320: 43 75 72 72 65 6e 74 50 61 67 65 53 74 61 74 65 CurrentPageState
0001a330: 49 64 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 Id",1),jm([oa],B
0001a340: 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 m.prototype,"get
0001a350: 53 65 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 SelectedShapeIds
0001a360: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a370: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 53 65 prototype,"getSe
0001a380: 6c 65 63 74 65 64 53 68 61 70 65 73 22 2c 31 29 lectedShapes",1)
0001a390: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001a3a0: 6f 74 79 70 65 2c 22 67 65 74 4f 6e 6c 79 53 65 otype,"getOnlySe
0001a3b0: 6c 65 63 74 65 64 53 68 61 70 65 49 64 22 2c 31 lectedShapeId",1
0001a3c0: 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f ),jm([oa],Bm.pro
0001a3d0: 74 6f 74 79 70 65 2c 22 67 65 74 4f 6e 6c 79 53 totype,"getOnlyS
0001a3e0: 65 6c 65 63 74 65 64 53 68 61 70 65 22 2c 31 29 electedShape",1)
0001a3f0: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001a400: 6f 74 79 70 65 2c 22 67 65 74 53 65 6c 65 63 74 otype,"getSelect
0001a410: 69 6f 6e 50 61 67 65 42 6f 75 6e 64 73 22 2c 31 ionPageBounds",1
0001a420: 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f ),jm([oa],Bm.pro
0001a430: 74 6f 74 79 70 65 2c 22 67 65 74 53 65 6c 65 63 totype,"getSelec
0001a440: 74 69 6f 6e 52 6f 74 61 74 69 6f 6e 22 2c 31 29 tionRotation",1)
0001a450: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001a460: 6f 74 79 70 65 2c 22 67 65 74 53 65 6c 65 63 74 otype,"getSelect
0001a470: 69 6f 6e 52 6f 74 61 74 65 64 50 61 67 65 42 6f ionRotatedPageBo
0001a480: 75 6e 64 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d unds",1),jm([oa]
0001a490: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001a4a0: 65 74 53 65 6c 65 63 74 69 6f 6e 52 6f 74 61 74 etSelectionRotat
0001a4b0: 65 64 53 63 72 65 65 6e 42 6f 75 6e 64 73 22 2c edScreenBounds",
0001a4c0: 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 1),jm([oa],Bm.pr
0001a4d0: 6f 74 6f 74 79 70 65 2c 22 67 65 74 46 6f 63 75 ototype,"getFocu
0001a4e0: 73 65 64 47 72 6f 75 70 49 64 22 2c 31 29 2c 6a sedGroupId",1),j
0001a4f0: 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 m([oa],Bm.protot
0001a500: 79 70 65 2c 22 67 65 74 46 6f 63 75 73 65 64 47 ype,"getFocusedG
0001a510: 72 6f 75 70 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d roup",1),jm([oa]
0001a520: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001a530: 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 49 64 etEditingShapeId
0001a540: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a550: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 45 64 prototype,"getEd
0001a560: 69 74 69 6e 67 53 68 61 70 65 22 2c 31 29 2c 6a itingShape",1),j
0001a570: 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 m([oa],Bm.protot
0001a580: 79 70 65 2c 22 67 65 74 48 6f 76 65 72 65 64 53 ype,"getHoveredS
0001a590: 68 61 70 65 49 64 22 2c 31 29 2c 6a 6d 28 5b 6f hapeId",1),jm([o
0001a5a0: 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c a],Bm.prototype,
0001a5b0: 22 67 65 74 48 6f 76 65 72 65 64 53 68 61 70 65 "getHoveredShape
0001a5c0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a5d0: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 48 69 prototype,"getHi
0001a5e0: 6e 74 69 6e 67 53 68 61 70 65 49 64 73 22 2c 31 ntingShapeIds",1
0001a5f0: 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f ),jm([oa],Bm.pro
0001a600: 74 6f 74 79 70 65 2c 22 67 65 74 48 69 6e 74 69 totype,"getHinti
0001a610: 6e 67 53 68 61 70 65 22 2c 31 29 2c 6a 6d 28 5b ngShape",1),jm([
0001a620: 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 oa],Bm.prototype
0001a630: 2c 22 67 65 74 45 72 61 73 69 6e 67 53 68 61 70 ,"getErasingShap
0001a640: 65 49 64 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d eIds",1),jm([oa]
0001a650: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001a660: 65 74 45 72 61 73 69 6e 67 53 68 61 70 65 73 22 etErasingShapes"
0001a670: 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 ,1),jm([oa],Bm.p
0001a680: 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 43 61 6d rototype,"getCam
0001a690: 65 72 61 49 64 22 2c 31 29 2c 6a 6d 28 5b 6f 61 eraId",1),jm([oa
0001a6a0: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a6b0: 67 65 74 43 61 6d 65 72 61 22 2c 31 29 2c 6a 6d getCamera",1),jm
0001a6c0: 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 ([oa],Bm.prototy
0001a6d0: 70 65 2c 22 67 65 74 56 69 65 77 70 6f 72 74 50 pe,"getViewportP
0001a6e0: 61 67 65 42 6f 75 6e 64 73 46 6f 72 46 6f 6c 6c ageBoundsForFoll
0001a6f0: 6f 77 69 6e 67 22 2c 31 29 2c 6a 6d 28 5b 6f 61 owing",1),jm([oa
0001a700: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a710: 67 65 74 43 61 6d 65 72 61 46 6f 72 46 6f 6c 6c getCameraForFoll
0001a720: 6f 77 69 6e 67 22 2c 31 29 2c 6a 6d 28 5b 6f 61 owing",1),jm([oa
0001a730: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001a740: 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 22 2c 31 29 getZoomLevel",1)
0001a750: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001a760: 6f 74 79 70 65 2c 22 67 65 74 56 69 65 77 70 6f otype,"getViewpo
0001a770: 72 74 53 63 72 65 65 6e 42 6f 75 6e 64 73 22 2c rtScreenBounds",
0001a780: 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 1),jm([oa],Bm.pr
0001a790: 6f 74 6f 74 79 70 65 2c 22 67 65 74 56 69 65 77 ototype,"getView
0001a7a0: 70 6f 72 74 53 63 72 65 65 6e 43 65 6e 74 65 72 portScreenCenter
0001a7b0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a7c0: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 56 69 prototype,"getVi
0001a7d0: 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 ewportPageBounds
0001a7e0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a7f0: 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 43 prototype,"_getC
0001a800: 6f 6c 6c 61 62 6f 72 61 74 6f 72 73 51 75 65 72 ollaboratorsQuer
0001a810: 79 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d y",1),jm([oa],Bm
0001a820: 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 43 .prototype,"getC
0001a830: 6f 6c 6c 61 62 6f 72 61 74 6f 72 73 22 2c 31 29 ollaborators",1)
0001a840: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001a850: 6f 74 79 70 65 2c 22 67 65 74 43 6f 6c 6c 61 62 otype,"getCollab
0001a860: 6f 72 61 74 6f 72 73 4f 6e 43 75 72 72 65 6e 74 oratorsOnCurrent
0001a870: 50 61 67 65 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d Page",1),jm([oa]
0001a880: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001a890: 65 74 52 65 6e 64 65 72 69 6e 67 53 68 61 70 65 etRenderingShape
0001a8a0: 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d s",1),jm([oa],Bm
0001a8b0: 2e 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 .prototype,"_get
0001a8c0: 41 6c 6c 50 61 67 65 73 51 75 65 72 79 22 2c 31 AllPagesQuery",1
0001a8d0: 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f ),jm([oa],Bm.pro
0001a8e0: 74 6f 74 79 70 65 2c 22 67 65 74 50 61 67 65 73 totype,"getPages
0001a8f0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a900: 70 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 43 75 prototype,"getCu
0001a910: 72 72 65 6e 74 50 61 67 65 49 64 22 2c 31 29 2c rrentPageId",1),
0001a920: 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f jm([oa],Bm.proto
0001a930: 74 79 70 65 2c 22 67 65 74 43 75 72 72 65 6e 74 type,"getCurrent
0001a940: 50 61 67 65 53 68 61 70 65 49 64 73 53 6f 72 74 PageShapeIdsSort
0001a950: 65 64 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 ed",1),jm([oa],B
0001a960: 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 m.prototype,"_ge
0001a970: 74 41 6c 6c 41 73 73 65 74 73 51 75 65 72 79 22 tAllAssetsQuery"
0001a980: 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 ,1),jm([oa],Bm.p
0001a990: 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 53 68 rototype,"_getSh
0001a9a0: 61 70 65 47 65 6f 6d 65 74 72 79 43 61 63 68 65 apeGeometryCache
0001a9b0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a9c0: 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 53 prototype,"_getS
0001a9d0: 68 61 70 65 48 61 6e 64 6c 65 73 43 61 63 68 65 hapeHandlesCache
0001a9e0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001a9f0: 70 72 6f 74 6f 74 79 70 65 2c 22 5f 67 65 74 53 prototype,"_getS
0001aa00: 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 hapePageTransfor
0001aa10: 6d 43 61 63 68 65 22 2c 31 29 2c 6a 6d 28 5b 6f mCache",1),jm([o
0001aa20: 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c a],Bm.prototype,
0001aa30: 22 5f 67 65 74 53 68 61 70 65 50 61 67 65 42 6f "_getShapePageBo
0001aa40: 75 6e 64 73 43 61 63 68 65 22 2c 31 29 2c 6a 6d undsCache",1),jm
0001aa50: 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 ([oa],Bm.prototy
0001aa60: 70 65 2c 22 5f 67 65 74 53 68 61 70 65 43 6c 69 pe,"_getShapeCli
0001aa70: 70 50 61 74 68 43 61 63 68 65 22 2c 31 29 2c 6a pPathCache",1),j
0001aa80: 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 m([oa],Bm.protot
0001aa90: 79 70 65 2c 22 5f 67 65 74 53 68 61 70 65 4d 61 ype,"_getShapeMa
0001aaa0: 73 6b 43 61 63 68 65 22 2c 31 29 2c 6a 6d 28 5b skCache",1),jm([
0001aab0: 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 oa],Bm.prototype
0001aac0: 2c 22 5f 67 65 74 53 68 61 70 65 4d 61 73 6b 65 ,"_getShapeMaske
0001aad0: 64 50 61 67 65 42 6f 75 6e 64 73 43 61 63 68 65 dPageBoundsCache
0001aae0: 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e ",1),jm([oa],Bm.
0001aaf0: 70 72 6f 74 6f 74 79 70 65 2c 22 5f 6e 6f 74 56 prototype,"_notV
0001ab00: 69 73 69 62 6c 65 53 68 61 70 65 73 22 2c 31 29 isibleShapes",1)
0001ab10: 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 ,jm([oa],Bm.prot
0001ab20: 6f 74 79 70 65 2c 22 67 65 74 43 75 6c 6c 65 64 otype,"getCulled
0001ab30: 53 68 61 70 65 73 22 2c 31 29 2c 6a 6d 28 5b 6f Shapes",1),jm([o
0001ab40: 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c a],Bm.prototype,
0001ab50: 22 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 42 "getCurrentPageB
0001ab60: 6f 75 6e 64 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 ounds",1),jm([oa
0001ab70: 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 ],Bm.prototype,"
0001ab80: 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 68 getCurrentPageSh
0001ab90: 61 70 65 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d apes",1),jm([oa]
0001aba0: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001abb0: 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 68 61 etCurrentPageSha
0001abc0: 70 65 73 53 6f 72 74 65 64 22 2c 31 29 2c 6a 6d pesSorted",1),jm
0001abd0: 28 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 ([oa],Bm.prototy
0001abe0: 70 65 2c 22 67 65 74 43 75 72 72 65 6e 74 50 61 pe,"getCurrentPa
0001abf0: 67 65 52 65 6e 64 65 72 69 6e 67 53 68 61 70 65 geRenderingShape
0001ac00: 73 53 6f 72 74 65 64 22 2c 31 29 2c 6a 6d 28 5b sSorted",1),jm([
0001ac10: 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 oa],Bm.prototype
0001ac20: 2c 22 5f 67 65 74 42 69 6e 64 69 6e 67 73 49 6e ,"_getBindingsIn
0001ac30: 64 65 78 43 61 63 68 65 22 2c 31 29 2c 6a 6d 28 dexCache",1),jm(
0001ac40: 5b 6f 61 5d 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 [oa],Bm.prototyp
0001ac50: 65 2c 22 5f 67 65 74 53 65 6c 65 63 74 69 6f 6e e,"_getSelection
0001ac60: 53 68 61 72 65 64 53 74 79 6c 65 73 22 2c 31 29 SharedStyles",1)
0001ac70: 2c 6a 6d 28 5b 6f 61 28 7b 69 73 45 71 75 61 6c ,jm([oa({isEqual
0001ac80: 3a 28 65 2c 74 29 3d 3e 65 2e 65 71 75 61 6c 73 :(e,t)=>e.equals
0001ac90: 28 74 29 7d 29 5d 2c 42 6d 2e 70 72 6f 74 6f 74 (t)})],Bm.protot
0001aca0: 79 70 65 2c 22 67 65 74 53 68 61 72 65 64 53 74 ype,"getSharedSt
0001acb0: 79 6c 65 73 22 2c 31 29 2c 6a 6d 28 5b 6f 61 5d yles",1),jm([oa]
0001acc0: 2c 42 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 22 67 ,Bm.prototype,"g
0001acd0: 65 74 53 68 61 72 65 64 4f 70 61 63 69 74 79 22 etSharedOpacity"
0001ace0: 2c 31 29 2c 6a 6d 28 5b 6f 61 5d 2c 42 6d 2e 70 ,1),jm([oa],Bm.p
0001acf0: 72 6f 74 6f 74 79 70 65 2c 22 67 65 74 49 73 46 rototype,"getIsF
0001ad00: 6f 63 75 73 65 64 22 2c 31 29 3b 63 6f 6e 73 74 ocused",1);const
0001ad10: 20 57 6d 3d 22 3c 70 61 74 68 20 64 3d 27 6d 31 Wm="<path d='m1
0001ad20: 39 2e 37 34 33 32 20 31 37 2e 30 38 36 39 2d 34 9.7432 17.0869-4
0001ad30: 2e 30 37 32 20 34 2e 30 36 38 20 32 2e 38 32 39 .072 4.068 2.829
0001ad40: 20 32 2e 38 32 38 2d 38 2e 34 37 33 2d 2e 30 31 2.828-8.473-.01
0001ad50: 33 2d 2e 30 31 33 2d 38 2e 34 37 20 32 2e 38 34 3-.013-8.47 2.84
0001ad60: 31 20 32 2e 38 34 32 20 34 2e 30 37 35 2d 34 2e 1 2.842 4.075-4.
0001ad70: 30 36 38 20 31 2e 34 31 34 2d 31 2e 34 31 35 2d 068 1.414-1.415-
0001ad80: 32 2e 38 34 34 2d 32 2e 38 34 32 68 38 2e 34 38 2.844-2.842h8.48
0001ad90: 36 76 38 2e 34 38 34 6c 2d 32 2e 38 33 2d 32 2e 6v8.484l-2.83-2.
0001ada0: 38 32 37 7a 27 20 66 69 6c 6c 3d 27 25 32 33 66 827z' fill='%23f
0001adb0: 66 66 27 2f 3e 3c 70 61 74 68 20 64 3d 27 6d 31 ff'/><path d='m1
0001adc0: 38 2e 36 38 32 36 20 31 36 2e 37 33 33 34 2d 34 8.6826 16.7334-4
0001add0: 2e 34 32 37 20 34 2e 34 32 34 20 31 2e 38 32 38 .427 4.424 1.828
0001ade0: 20 31 2e 38 32 38 2d 35 2e 30 35 36 2d 2e 30 31 1.828-5.056-.01
0001adf0: 36 2d 2e 30 31 34 2d 35 2e 30 35 34 20 31 2e 38 6-.014-5.054 1.8
0001ae00: 34 32 20 31 2e 38 34 31 20 34 2e 34 32 38 2d 34 42 1.841 4.428-4
0001ae10: 2e 34 32 32 20 32 2e 34 37 34 2d 32 2e 34 37 35 .422 2.474-2.475
0001ae20: 2d 31 2e 38 34 34 2d 31 2e 38 34 33 68 35 2e 30 -1.844-1.843h5.0
0001ae30: 37 33 76 35 2e 30 37 31 6c 2d 31 2e 38 33 2d 31 73v5.071l-1.83-1
0001ae40: 2e 38 32 38 7a 27 20 66 69 6c 6c 3d 27 25 32 33 .828z' fill='%23
0001ae50: 30 30 30 27 2f 3e 22 2c 4b 6d 3d 22 3c 70 61 74 000'/>",Km="<pat
0001ae60: 68 20 64 3d 27 6d 39 20 31 37 2e 39 39 30 37 76 h d='m9 17.9907v
0001ae70: 2e 30 30 35 6c 35 2e 39 39 37 20 35 2e 39 39 36 .005l5.997 5.996
0001ae80: 2e 30 30 31 2d 33 2e 39 39 39 68 31 2e 39 39 39 .001-3.999h1.999
0001ae90: 20 32 2e 30 32 76 34 6c 35 2e 39 38 2d 36 2e 30 2.02v4l5.98-6.0
0001aea0: 30 31 2d 35 2e 39 38 2d 35 2e 39 39 39 2e 30 30 01-5.98-5.999.00
0001aeb0: 31 20 34 2e 30 31 39 2d 32 2e 30 32 31 2e 30 30 1 4.019-2.021.00
0001aec0: 32 68 2d 32 6c 2e 30 30 31 2d 34 2e 30 32 32 7a 2h-2l.001-4.022z
0001aed0: 6d 31 2e 34 31 31 2e 30 30 33 20 33 2e 35 38 37 m1.411.003 3.587
0001aee0: 2d 33 2e 35 38 38 2d 2e 30 30 31 20 32 2e 35 38 -3.588-.001 2.58
0001aef0: 37 68 33 2e 35 20 32 2e 35 32 31 76 2d 32 2e 35 7h3.5 2.521v-2.5
0001af00: 38 35 6c 33 2e 35 36 35 20 33 2e 35 38 36 2d 33 85l3.565 3.586-3
0001af10: 2e 35 36 34 20 33 2e 35 38 35 2d 2e 30 30 31 2d .564 3.585-.001-
0001af20: 32 2e 35 38 35 68 2d 32 2e 35 32 31 6c 2d 33 2e 2.585h-2.521l-3.
0001af30: 34 39 39 2d 2e 30 30 31 2d 2e 30 30 31 20 32 2e 499-.001-.001 2.
0001af40: 35 38 36 7a 27 20 66 69 6c 6c 3d 27 25 32 33 66 586z' fill='%23f
0001af50: 66 66 27 2f 3e 3c 70 61 74 68 20 64 3d 27 6d 31 ff'/><path d='m1
0001af60: 37 2e 34 39 37 31 20 31 38 2e 39 39 33 32 68 32 7.4971 18.9932h2
0001af70: 2e 35 32 31 76 32 2e 35 38 36 6c 33 2e 35 36 35 .521v2.586l3.565
0001af80: 2d 33 2e 35 38 36 2d 33 2e 35 36 35 2d 33 2e 35 -3.586-3.565-3.5
0001af90: 38 35 76 32 2e 36 30 35 68 2d 32 2e 35 32 31 2d 85v2.605h-2.521-
0001afa0: 33 2e 35 76 2d 32 2e 36 30 37 6c 2d 33 2e 35 38 3.5v-2.607l-3.58
0001afb0: 36 20 33 2e 35 38 37 20 33 2e 35 38 36 20 33 2e 6 3.587 3.586 3.
0001afc0: 35 38 36 76 2d 32 2e 35 38 37 7a 27 20 66 69 6c 586v-2.587z' fil
0001afd0: 6c 3d 27 25 32 33 30 30 30 27 2f 3e 22 2c 59 6d l='%23000'/>",Ym
0001afe0: 3d 27 3c 70 61 74 68 20 64 3d 22 4d 32 32 2e 34 ='<path d="M22.4
0001aff0: 37 38 39 20 39 2e 34 35 37 32 38 4c 32 35 2e 39 789 9.45728L25.9
0001b000: 39 33 35 20 31 32 2e 39 39 34 32 4c 32 32 2e 34 935 12.9942L22.4
0001b010: 37 38 39 20 31 36 2e 35 32 38 33 56 31 34 2e 31 789 16.5283V14.1
0001b020: 30 33 32 43 31 38 2e 31 32 36 20 31 34 2e 31 35 032C18.126 14.15
0001b030: 30 32 20 31 34 2e 36 30 37 31 20 31 37 2e 36 37 02 14.6071 17.67
0001b040: 33 37 20 31 34 2e 35 36 37 35 20 32 32 2e 30 32 37 14.5675 22.02
0001b050: 38 33 48 31 37 2e 30 35 4c 31 33 2e 35 31 33 20 83H17.05L13.513
0001b060: 32 35 2e 35 34 33 4c 39 2e 39 37 38 38 39 20 32 25.543L9.97889 2
0001b070: 32 2e 30 32 38 33 48 31 32 2e 35 36 37 34 43 31 2.0283H12.5674C1
0001b080: 32 2e 36 30 37 31 20 31 36 2e 35 36 39 31 20 31 2.6071 16.5691 1
0001b090: 37 2e 30 32 31 34 20 31 32 2e 31 35 30 33 20 32 7.0214 12.1503 2
0001b0a0: 32 2e 34 37 38 39 20 31 32 2e 31 30 33 31 4c 32 2.4789 12.1031L2
0001b0b0: 32 2e 34 37 38 39 20 39 2e 34 35 37 32 38 5a 22 2.4789 9.45728Z"
0001b0c0: 20 66 69 6c 6c 3d 22 62 6c 61 63 6b 22 2f 3e 3c fill="black"/><
0001b0d0: 70 61 74 68 20 66 69 6c 6c 2d 72 75 6c 65 3d 22 path fill-rule="
0001b0e0: 65 76 65 6e 6f 64 64 22 20 63 6c 69 70 2d 72 75 evenodd" clip-ru
0001b0f0: 6c 65 3d 22 65 76 65 6e 6f 64 64 22 20 64 3d 22 le="evenodd" d="
0001b100: 4d 32 31 2e 34 37 38 39 20 37 2e 30 33 32 32 33 M21.4789 7.03223
0001b110: 4c 32 37 2e 34 30 33 35 20 31 32 2e 39 39 34 35 L27.4035 12.9945
0001b120: 4c 32 31 2e 34 37 38 39 20 31 38 2e 39 35 32 31 L21.4789 18.9521
0001b130: 56 31 35 2e 31 38 36 38 43 31 38 2e 34 37 39 38 V15.1868C18.4798
0001b140: 20 31 35 2e 36 35 34 39 20 31 36 2e 31 31 31 33 15.6549 16.1113
0001b150: 20 31 38 2e 30 32 37 33 20 31 35 2e 36 34 39 20 18.0273 15.649
0001b160: 32 31 2e 30 32 38 34 48 31 39 2e 34 37 35 4c 31 21.0284H19.475L1
0001b170: 33 2e 35 31 32 38 20 32 36 2e 39 35 33 4c 37 2e 3.5128 26.953L7.
0001b180: 35 35 35 31 39 20 32 31 2e 30 32 38 34 48 31 31 55519 21.0284H11
0001b190: 2e 36 31 38 39 43 31 32 2e 31 32 34 33 20 31 35 .6189C12.1243 15
0001b1a0: 2e 38 31 35 35 20 31 36 2e 32 36 37 39 20 31 31 .8155 16.2679 11
0001b1b0: 2e 36 36 37 37 20 32 31 2e 34 37 38 39 20 31 31 .6677 21.4789 11
0001b1c0: 2e 31 35 35 39 4c 32 31 2e 34 37 38 39 20 37 2e .1559L21.4789 7.
0001b1d0: 30 33 32 32 33 5a 4d 32 32 2e 34 37 38 39 20 31 03223ZM22.4789 1
0001b1e0: 32 2e 31 30 33 31 43 31 37 2e 30 32 31 34 20 31 2.1031C17.0214 1
0001b1f0: 32 2e 31 35 30 33 20 31 32 2e 36 30 37 31 20 31 2.1503 12.6071 1
0001b200: 36 2e 35 36 39 31 20 31 32 2e 35 36 37 34 20 32 6.5691 12.5674 2
0001b210: 32 2e 30 32 38 34 48 39 2e 39 37 38 38 39 4c 31 2.0284H9.97889L1
0001b220: 33 2e 35 31 33 20 32 35 2e 35 34 33 4c 31 37 2e 3.513 25.543L17.
0001b230: 30 35 20 32 32 2e 30 32 38 34 48 31 34 2e 35 36 05 22.0284H14.56
0001b240: 37 35 43 31 34 2e 35 37 30 35 20 32 31 2e 36 38 75C14.5705 21.68
0001b250: 39 36 20 31 34 2e 35 39 34 37 20 32 31 2e 33 35 96 14.5947 21.35
0001b260: 35 38 20 31 34 2e 36 33 38 36 20 32 31 2e 30 32 58 14.6386 21.02
0001b270: 38 34 43 31 35 2e 31 31 35 37 20 31 37 2e 34 37 84C15.1157 17.47
0001b280: 34 31 20 31 37 2e 39 32 36 36 20 31 34 2e 36 35 41 17.9266 14.65
0001b290: 39 32 20 32 31 2e 34 37 38 39 20 31 34 2e 31 37 92 21.4789 14.17
0001b2a0: 36 31 43 32 31 2e 38 30 36 33 20 31 34 2e 31 33 61C21.8063 14.13
0001b2b0: 31 36 20 32 32 2e 31 34 30 31 20 31 34 2e 31 30 16 22.1401 14.10
0001b2c0: 36 39 20 32 32 2e 34 37 38 39 20 31 34 2e 31 30 69 22.4789 14.10
0001b2d0: 33 32 56 31 36 2e 35 32 38 34 4c 32 35 2e 39 39 32V16.5284L25.99
0001b2e0: 33 35 20 31 32 2e 39 39 34 32 4c 32 32 2e 34 37 35 12.9942L22.47
0001b2f0: 38 39 20 39 2e 34 35 37 32 39 4c 32 32 2e 34 37 89 9.45729L22.47
0001b300: 38 39 20 31 32 2e 31 30 33 31 5a 22 20 66 69 6c 89 12.1031Z" fil
0001b310: 6c 3d 22 77 68 69 74 65 22 2f 3e 27 3b 66 75 6e l="white"/>';fun
0001b320: 63 74 69 6f 6e 20 58 6d 28 65 2c 74 2c 6e 2c 72 ction Xm(e,t,n,r
0001b330: 2c 6f 2c 69 3d 31 36 2c 61 3d 31 36 29 7b 63 6f ,o,i=16,a=16){co
0001b340: 6e 73 74 20 73 3d 64 75 2f 31 38 30 2a 28 2d 6e nst s=du/180*(-n
0001b350: 2d 74 29 2c 6c 3d 4d 61 74 68 2e 73 69 6e 28 73 -t),l=Math.sin(s
0001b360: 29 2c 63 3d 4d 61 74 68 2e 63 6f 73 28 73 29 3b ),c=Math.cos(s);
0001b370: 72 65 74 75 72 6e 60 75 72 6c 28 22 64 61 74 61 return`url("data
0001b380: 3a 69 6d 61 67 65 2f 73 76 67 2b 78 6d 6c 2c 3c :image/svg+xml,<
0001b390: 73 76 67 20 68 65 69 67 68 74 3d 27 33 32 27 20 svg height='32'
0001b3a0: 77 69 64 74 68 3d 27 33 32 27 20 76 69 65 77 42 width='32' viewB
0001b3b0: 6f 78 3d 27 30 20 30 20 33 32 20 33 32 27 20 78 ox='0 0 32 32' x
0001b3c0: 6d 6c 6e 73 3d 27 68 74 74 70 3a 2f 2f 77 77 77 mlns='http://www
0001b3d0: 2e 77 33 2e 6f 72 67 2f 32 30 30 30 2f 73 76 67 .w3.org/2000/svg
0001b3e0: 27 20 73 74 79 6c 65 3d 27 63 6f 6c 6f 72 3a 20 ' style='color:
0001b3f0: 24 7b 6f 7d 3b 27 3e 3c 64 65 66 73 3e 3c 66 69 ${o};'><defs><fi
0001b400: 6c 74 65 72 20 69 64 3d 27 73 68 61 64 6f 77 27 lter id='shadow'
0001b410: 20 79 3d 27 2d 34 30 25 27 20 78 3d 27 2d 34 30 y='-40%' x='-40
0001b420: 25 27 20 77 69 64 74 68 3d 27 31 38 30 70 78 27 %' width='180px'
0001b430: 20 68 65 69 67 68 74 3d 27 31 38 30 25 27 20 63 height='180%' c
0001b440: 6f 6c 6f 72 2d 69 6e 74 65 72 70 6f 6c 61 74 69 olor-interpolati
0001b450: 6f 6e 2d 66 69 6c 74 65 72 73 3d 27 73 52 47 42 on-filters='sRGB
0001b460: 27 3e 3c 66 65 44 72 6f 70 53 68 61 64 6f 77 20 '><feDropShadow
0001b470: 64 78 3d 27 24 7b 31 2a 63 2d 31 2a 6c 7d 27 20 dx='${1*c-1*l}'
0001b480: 64 79 3d 27 24 7b 31 2a 6c 2b 31 2a 63 7d 27 20 dy='${1*l+1*c}'
0001b490: 73 74 64 44 65 76 69 61 74 69 6f 6e 3d 27 31 2e stdDeviation='1.
0001b4a0: 32 27 20 66 6c 6f 6f 64 2d 6f 70 61 63 69 74 79 2' flood-opacity
0001b4b0: 3d 27 2e 35 27 2f 3e 3c 2f 66 69 6c 74 65 72 3e ='.5'/></filter>
0001b4c0: 3c 2f 64 65 66 73 3e 3c 67 20 66 69 6c 6c 3d 27 </defs><g fill='
0001b4d0: 6e 6f 6e 65 27 20 74 72 61 6e 73 66 6f 72 6d 3d none' transform=
0001b4e0: 27 72 6f 74 61 74 65 28 24 7b 74 2b 6e 7d 20 31 'rotate(${t+n} 1
0001b4f0: 36 20 31 36 29 24 7b 72 3f 22 20 73 63 61 6c 65 6 16)${r?" scale
0001b500: 28 2d 31 2c 2d 31 29 20 74 72 61 6e 73 6c 61 74 (-1,-1) translat
0001b510: 65 28 30 2c 20 2d 33 32 29 22 3a 22 22 7d 27 20 e(0, -32)":""}'
0001b520: 66 69 6c 74 65 72 3d 27 75 72 6c 28 25 32 33 73 filter='url(%23s
0001b530: 68 61 64 6f 77 29 27 3e 60 2b 65 2e 72 65 70 6c hadow)'>`+e.repl
0001b540: 61 63 65 41 6c 6c 28 27 22 27 2c 22 27 22 29 2b aceAll('"',"'")+
0001b550: 60 3c 2f 67 3e 3c 2f 73 76 67 3e 22 29 20 24 7b `</g></svg>") ${
0001b560: 69 7d 20 24 7b 61 7d 2c 20 70 6f 69 6e 74 65 72 i} ${a}, pointer
0001b570: 60 7d 63 6f 6e 73 74 20 5a 6d 3d 5b 22 64 65 66 `}const Zm=["def
0001b580: 61 75 6c 74 22 2c 22 70 6f 69 6e 74 65 72 22 2c ault","pointer",
0001b590: 22 63 72 6f 73 73 22 2c 22 6d 6f 76 65 22 2c 22 "cross","move","
0001b5a0: 67 72 61 62 22 2c 22 67 72 61 62 62 69 6e 67 22 grab","grabbing"
0001b5b0: 2c 22 74 65 78 74 22 2c 22 7a 6f 6f 6d 2d 69 6e ,"text","zoom-in
0001b5c0: 22 2c 22 7a 6f 6f 6d 2d 6f 75 74 22 5d 2c 51 6d ","zoom-out"],Qm
0001b5d0: 3d 7b 6e 6f 6e 65 3a 28 29 3d 3e 22 6e 6f 6e 65 ={none:()=>"none
0001b5e0: 22 2c 22 65 77 2d 72 65 73 69 7a 65 22 3a 28 65 ","ew-resize":(e
0001b5f0: 2c 74 2c 6e 29 3d 3e 58 6d 28 4b 6d 2c 65 2c 30 ,t,n)=>Xm(Km,e,0
0001b600: 2c 74 2c 6e 29 2c 22 6e 73 2d 72 65 73 69 7a 65 ,t,n),"ns-resize
0001b610: 22 3a 28 65 2c 74 2c 6e 29 3d 3e 58 6d 28 4b 6d ":(e,t,n)=>Xm(Km
0001b620: 2c 65 2c 39 30 2c 74 2c 6e 29 2c 22 6e 65 73 77 ,e,90,t,n),"nesw
0001b630: 2d 72 65 73 69 7a 65 22 3a 28 65 2c 74 2c 6e 29 -resize":(e,t,n)
0001b640: 3d 3e 58 6d 28 57 6d 2c 65 2c 30 2c 74 2c 6e 29 =>Xm(Wm,e,0,t,n)
0001b650: 2c 22 6e 77 73 65 2d 72 65 73 69 7a 65 22 3a 28 ,"nwse-resize":(
0001b660: 65 2c 74 2c 6e 29 3d 3e 58 6d 28 57 6d 2c 65 2c e,t,n)=>Xm(Wm,e,
0001b670: 39 30 2c 74 2c 6e 29 2c 22 6e 77 73 65 2d 72 6f 90,t,n),"nwse-ro
0001b680: 74 61 74 65 22 3a 28 65 2c 74 2c 6e 29 3d 3e 58 tate":(e,t,n)=>X
0001b690: 6d 28 59 6d 2c 65 2c 30 2c 74 2c 6e 29 2c 22 6e m(Ym,e,0,t,n),"n
0001b6a0: 65 73 77 2d 72 6f 74 61 74 65 22 3a 28 65 2c 74 esw-rotate":(e,t
0001b6b0: 2c 6e 29 3d 3e 58 6d 28 59 6d 2c 65 2c 39 30 2c ,n)=>Xm(Ym,e,90,
0001b6c0: 74 2c 6e 29 2c 22 73 65 6e 77 2d 72 6f 74 61 74 t,n),"senw-rotat
0001b6d0: 65 22 3a 28 65 2c 74 2c 6e 29 3d 3e 58 6d 28 59 e":(e,t,n)=>Xm(Y
0001b6e0: 6d 2c 65 2c 31 38 30 2c 74 2c 6e 29 2c 22 73 77 m,e,180,t,n),"sw
0001b6f0: 6e 65 2d 72 6f 74 61 74 65 22 3a 28 65 2c 74 2c ne-rotate":(e,t,
0001b700: 6e 29 3d 3e 58 6d 28 59 6d 2c 65 2c 32 37 30 2c n)=>Xm(Ym,e,270,
0001b710: 74 2c 6e 29 7d 3b 66 75 6e 63 74 69 6f 6e 20 4a t,n)};function J
0001b720: 6d 28 65 2c 74 3d 30 2c 6e 3d 22 62 6c 61 63 6b m(e,t=0,n="black
0001b730: 22 29 7b 72 65 74 75 72 6e 20 51 6d 5b 65 5d 28 "){return Qm[e](
0001b740: 31 38 30 2a 74 2f 64 75 2c 21 31 2c 6e 29 7d 66 180*t/du,!1,n)}f
0001b750: 75 6e 63 74 69 6f 6e 20 24 6d 28 65 29 7b 63 6f unction $m(e){co
0001b760: 6e 73 74 20 74 3d 28 30 2c 6f 2e 75 73 65 52 65 nst t=(0,o.useRe
0001b770: 66 29 28 29 3b 72 65 74 75 72 6e 28 30 2c 6f 2e f)();return(0,o.
0001b780: 75 73 65 4c 61 79 6f 75 74 45 66 66 65 63 74 29 useLayoutEffect)
0001b790: 28 28 28 29 3d 3e 7b 74 2e 63 75 72 72 65 6e 74 ((()=>{t.current
0001b7a0: 3d 65 7d 29 29 2c 28 30 2c 6f 2e 75 73 65 44 65 =e})),(0,o.useDe
0001b7b0: 62 75 67 56 61 6c 75 65 29 28 65 29 2c 28 30 2c bugValue)(e),(0,
0001b7c0: 6f 2e 75 73 65 43 61 6c 6c 62 61 63 6b 29 28 28 o.useCallback)((
0001b7d0: 28 2e 2e 2e 65 29 3d 3e 7b 63 6f 6e 73 74 20 6e (...e)=>{const n
0001b7e0: 3d 74 2e 63 75 72 72 65 6e 74 3b 72 65 74 75 72 =t.current;retur
0001b7f0: 6e 20 57 72 28 6e 2c 22 66 6e 20 64 6f 65 73 20 n Wr(n,"fn does
0001b800: 6e 6f 74 20 65 78 69 73 74 22 29 2c 6e 28 2e 2e not exist"),n(..
0001b810: 2e 65 29 7d 29 2c 5b 5d 29 7d 76 61 72 20 65 67 .e)}),[])}var eg
0001b820: 3d 6e 28 34 34 32 34 29 3b 63 6f 6e 73 74 20 74 =n(4424);const t
0001b830: 67 3d 22 54 4c 44 52 41 57 5f 44 4f 43 55 4d 45 g="TLDRAW_DOCUME
0001b840: 4e 54 5f 76 32 22 2c 6e 67 3d 22 54 4c 44 52 41 NT_v2",ng="TLDRA
0001b850: 57 5f 44 42 5f 4e 41 4d 45 5f 49 4e 44 45 58 5f W_DB_NAME_INDEX_
0001b860: 76 32 22 2c 72 67 3d 7b 52 65 63 6f 72 64 73 3a v2",rg={Records:
0001b870: 22 72 65 63 6f 72 64 73 22 2c 53 63 68 65 6d 61 "records",Schema
0001b880: 3a 22 73 63 68 65 6d 61 22 2c 53 65 73 73 69 6f :"schema",Sessio
0001b890: 6e 53 74 61 74 65 3a 22 73 65 73 73 69 6f 6e 5f nState:"session_
0001b8a0: 73 74 61 74 65 22 7d 3b 61 73 79 6e 63 20 66 75 state"};async fu
0001b8b0: 6e 63 74 69 6f 6e 20 6f 67 28 65 2c 74 29 7b 21 nction og(e,t){!
0001b8c0: 66 75 6e 63 74 69 6f 6e 28 65 29 7b 63 6f 6e 73 function(e){cons
0001b8d0: 74 20 74 3d 6e 65 77 20 53 65 74 28 61 67 28 29 t t=new Set(ag()
0001b8e0: 29 3b 74 2e 61 64 64 28 65 29 2c 4b 6f 28 6e 67 );t.add(e),Ko(ng
0001b8f0: 2c 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 ,JSON.stringify(
0001b900: 5b 2e 2e 2e 74 5d 29 29 7d 28 65 29 3b 63 6f 6e [...t]))}(e);con
0001b910: 73 74 20 6e 3d 61 77 61 69 74 28 30 2c 65 67 2e st n=await(0,eg.
0001b920: 6f 70 65 6e 44 42 29 28 65 2c 33 2c 7b 75 70 67 openDB)(e,3,{upg
0001b930: 72 61 64 65 28 65 29 7b 65 2e 6f 62 6a 65 63 74 rade(e){e.object
0001b940: 53 74 6f 72 65 4e 61 6d 65 73 2e 63 6f 6e 74 61 StoreNames.conta
0001b950: 69 6e 73 28 72 67 2e 52 65 63 6f 72 64 73 29 7c ins(rg.Records)|
0001b960: 7c 65 2e 63 72 65 61 74 65 4f 62 6a 65 63 74 53 |e.createObjectS
0001b970: 74 6f 72 65 28 72 67 2e 52 65 63 6f 72 64 73 29 tore(rg.Records)
0001b980: 2c 65 2e 6f 62 6a 65 63 74 53 74 6f 72 65 4e 61 ,e.objectStoreNa
0001b990: 6d 65 73 2e 63 6f 6e 74 61 69 6e 73 28 72 67 2e mes.contains(rg.
0001b9a0: 53 63 68 65 6d 61 29 7c 7c 65 2e 63 72 65 61 74 Schema)||e.creat
0001b9b0: 65 4f 62 6a 65 63 74 53 74 6f 72 65 28 72 67 2e eObjectStore(rg.
0001b9c0: 53 63 68 65 6d 61 29 2c 65 2e 6f 62 6a 65 63 74 Schema),e.object
0001b9d0: 53 74 6f 72 65 4e 61 6d 65 73 2e 63 6f 6e 74 61 StoreNames.conta
0001b9e0: 69 6e 73 28 72 67 2e 53 65 73 73 69 6f 6e 53 74 ins(rg.SessionSt
0001b9f0: 61 74 65 29 7c 7c 65 2e 63 72 65 61 74 65 4f 62 ate)||e.createOb
0001ba00: 6a 65 63 74 53 74 6f 72 65 28 72 67 2e 53 65 73 jectStore(rg.Ses
0001ba10: 73 69 6f 6e 53 74 61 74 65 29 7d 7d 29 3b 74 72 sionState)}});tr
0001ba20: 79 7b 72 65 74 75 72 6e 20 61 77 61 69 74 20 74 y{return await t
0001ba30: 28 6e 29 7d 66 69 6e 61 6c 6c 79 7b 6e 2e 63 6c (n)}finally{n.cl
0001ba40: 6f 73 65 28 29 7d 7d 61 73 79 6e 63 20 66 75 6e ose()}}async fun
0001ba50: 63 74 69 6f 6e 20 69 67 28 7b 70 65 72 73 69 73 ction ig({persis
0001ba60: 74 65 6e 63 65 4b 65 79 3a 65 2c 73 65 73 73 69 tenceKey:e,sessi
0001ba70: 6f 6e 49 64 3a 74 2c 64 69 64 43 61 6e 63 65 6c onId:t,didCancel
0001ba80: 3a 6e 7d 29 7b 63 6f 6e 73 74 20 72 3d 74 67 2b :n}){const r=tg+
0001ba90: 65 3b 69 66 28 61 67 28 29 2e 69 6e 63 6c 75 64 e;if(ag().includ
0001baa0: 65 73 28 72 29 29 72 65 74 75 72 6e 20 61 77 61 es(r))return awa
0001bab0: 69 74 20 61 73 79 6e 63 20 66 75 6e 63 74 69 6f it async functio
0001bac0: 6e 28 7b 70 65 72 73 69 73 74 65 6e 63 65 4b 65 n({persistenceKe
0001bad0: 79 3a 65 2c 64 69 64 43 61 6e 63 65 6c 3a 74 7d y:e,didCancel:t}
0001bae0: 29 7b 61 77 61 69 74 20 6f 67 28 74 67 2b 65 2c ){await og(tg+e,
0001baf0: 28 61 73 79 6e 63 20 65 3d 3e 7b 63 6f 6e 73 74 (async e=>{const
0001bb00: 20 6e 3d 65 2e 74 72 61 6e 73 61 63 74 69 6f 6e n=e.transaction
0001bb10: 28 5b 72 67 2e 53 65 73 73 69 6f 6e 53 74 61 74 ([rg.SessionStat
0001bb20: 65 5d 2c 22 72 65 61 64 77 72 69 74 65 22 29 2c e],"readwrite"),
0001bb30: 72 3d 6e 2e 6f 62 6a 65 63 74 53 74 6f 72 65 28 r=n.objectStore(
0001bb40: 72 67 2e 53 65 73 73 69 6f 6e 53 74 61 74 65 29 rg.SessionState)
0001bb50: 2c 6f 3d 28 61 77 61 69 74 20 72 2e 67 65 74 41 ,o=(await r.getA
0001bb60: 6c 6c 28 29 29 2e 73 6f 72 74 28 28 28 65 2c 74 ll()).sort(((e,t
0001bb70: 29 3d 3e 65 2e 75 70 64 61 74 65 64 41 74 2d 74 )=>e.updatedAt-t
0001bb80: 2e 75 70 64 61 74 65 64 41 74 29 29 3b 69 66 28 .updatedAt));if(
0001bb90: 6f 2e 6c 65 6e 67 74 68 3c 31 30 29 72 65 74 75 o.length<10)retu
0001bba0: 72 6e 20 76 6f 69 64 20 61 77 61 69 74 20 6e 2e rn void await n.
0001bbb0: 64 6f 6e 65 3b 63 6f 6e 73 74 20 69 3d 6f 2e 73 done;const i=o.s
0001bbc0: 6c 69 63 65 28 30 2c 6f 2e 6c 65 6e 67 74 68 2d lice(0,o.length-
0001bbd0: 31 30 29 3b 66 6f 72 28 63 6f 6e 73 74 7b 69 64 10);for(const{id
0001bbe0: 3a 65 7d 6f 66 20 69 29 61 77 61 69 74 20 72 2e :e}of i)await r.
0001bbf0: 64 65 6c 65 74 65 28 65 29 3b 69 66 28 74 3f 2e delete(e);if(t?.
0001bc00: 28 29 29 72 65 74 75 72 6e 20 6e 2e 61 62 6f 72 ())return n.abor
0001bc10: 74 28 29 3b 61 77 61 69 74 20 6e 2e 64 6f 6e 65 t();await n.done
0001bc20: 7d 29 29 7d 28 7b 70 65 72 73 69 73 74 65 6e 63 }))}({persistenc
0001bc30: 65 4b 65 79 3a 65 2c 64 69 64 43 61 6e 63 65 6c eKey:e,didCancel
0001bc40: 3a 6e 7d 29 2c 61 77 61 69 74 20 6f 67 28 72 2c :n}),await og(r,
0001bc50: 28 61 73 79 6e 63 20 65 3d 3e 7b 69 66 28 6e 3f (async e=>{if(n?
0001bc60: 2e 28 29 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 .())return;const
0001bc70: 20 72 3d 65 2e 74 72 61 6e 73 61 63 74 69 6f 6e r=e.transaction
0001bc80: 28 5b 72 67 2e 52 65 63 6f 72 64 73 2c 72 67 2e ([rg.Records,rg.
0001bc90: 53 63 68 65 6d 61 2c 72 67 2e 53 65 73 73 69 6f Schema,rg.Sessio
0001bca0: 6e 53 74 61 74 65 5d 2c 22 72 65 61 64 6f 6e 6c nState],"readonl
0001bcb0: 79 22 29 2c 6f 3d 72 2e 6f 62 6a 65 63 74 53 74 y"),o=r.objectSt
0001bcc0: 6f 72 65 28 72 67 2e 52 65 63 6f 72 64 73 29 2c ore(rg.Records),
0001bcd0: 69 3d 72 2e 6f 62 6a 65 63 74 53 74 6f 72 65 28 i=r.objectStore(
0001bce0: 72 67 2e 53 63 68 65 6d 61 29 2c 61 3d 72 2e 6f rg.Schema),a=r.o
0001bcf0: 62 6a 65 63 74 53 74 6f 72 65 28 72 67 2e 53 65 bjectStore(rg.Se
0001bd00: 73 73 69 6f 6e 53 74 61 74 65 29 3b 6c 65 74 20 ssionState);let
0001bd10: 73 3d 74 3f 28 61 77 61 69 74 20 61 2e 67 65 74 s=t?(await a.get
0001bd20: 28 74 29 29 3f 2e 73 6e 61 70 73 68 6f 74 3a 6e (t))?.snapshot:n
0001bd30: 75 6c 6c 3b 69 66 28 21 73 29 7b 73 3d 28 61 77 ull;if(!s){s=(aw
0001bd40: 61 69 74 20 61 2e 67 65 74 41 6c 6c 28 29 29 2e ait a.getAll()).
0001bd50: 73 6f 72 74 28 28 28 65 2c 74 29 3d 3e 65 2e 75 sort(((e,t)=>e.u
0001bd60: 70 64 61 74 65 64 41 74 2d 74 2e 75 70 64 61 74 pdatedAt-t.updat
0001bd70: 65 64 41 74 29 29 2e 70 6f 70 28 29 3f 2e 73 6e edAt)).pop()?.sn
0001bd80: 61 70 73 68 6f 74 7d 63 6f 6e 73 74 20 6c 3d 7b apshot}const l={
0001bd90: 72 65 63 6f 72 64 73 3a 61 77 61 69 74 20 6f 2e records:await o.
0001bda0: 67 65 74 41 6c 6c 28 29 2c 73 63 68 65 6d 61 3a getAll(),schema:
0001bdb0: 61 77 61 69 74 20 69 2e 67 65 74 28 72 67 2e 53 await i.get(rg.S
0001bdc0: 63 68 65 6d 61 29 2c 73 65 73 73 69 6f 6e 53 74 chema),sessionSt
0001bdd0: 61 74 65 53 6e 61 70 73 68 6f 74 3a 73 7d 3b 69 ateSnapshot:s};i
0001bde0: 66 28 21 6e 3f 2e 28 29 29 72 65 74 75 72 6e 20 f(!n?.())return
0001bdf0: 61 77 61 69 74 20 72 2e 64 6f 6e 65 2c 6c 3b 72 await r.done,l;r
0001be00: 2e 61 62 6f 72 74 28 29 7d 29 29 7d 66 75 6e 63 .abort()}))}func
0001be10: 74 69 6f 6e 20 61 67 28 29 7b 63 6f 6e 73 74 20 tion ag(){const
0001be20: 65 3d 4a 53 4f 4e 2e 70 61 72 73 65 28 57 6f 28 e=JSON.parse(Wo(
0001be30: 6e 67 29 7c 7c 22 5b 5d 22 29 3f 3f 5b 5d 3b 72 ng)||"[]")??[];r
0001be40: 65 74 75 72 6e 20 41 72 72 61 79 2e 69 73 41 72 eturn Array.isAr
0001be50: 72 61 79 28 65 29 3f 65 3a 5b 5d 7d 63 6f 6e 73 ray(e)?e:[]}cons
0001be60: 74 20 73 67 3d 53 79 6d 62 6f 6c 28 22 55 50 44 t sg=Symbol("UPD
0001be70: 41 54 45 5f 49 4e 53 54 41 4e 43 45 5f 53 54 41 ATE_INSTANCE_STA
0001be80: 54 45 22 29 3b 63 6f 6e 73 74 20 6c 67 3d 22 75 TE");const lg="u
0001be90: 6e 64 65 66 69 6e 65 64 22 3d 3d 74 79 70 65 6f ndefined"==typeo
0001bea0: 66 20 42 72 6f 61 64 63 61 73 74 43 68 61 6e 6e f BroadcastChann
0001beb0: 65 6c 3f 63 6c 61 73 73 7b 6f 6e 6d 65 73 73 61 el?class{onmessa
0001bec0: 67 65 3b 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 ge;constructor(e
0001bed0: 29 7b 7d 70 6f 73 74 4d 65 73 73 61 67 65 28 65 ){}postMessage(e
0001bee0: 29 7b 7d 63 6c 6f 73 65 28 29 7b 7d 7d 3a 42 72 ){}close(){}}:Br
0001bef0: 6f 61 64 63 61 73 74 43 68 61 6e 6e 65 6c 3b 63 oadcastChannel;c
0001bf00: 6c 61 73 73 20 63 67 7b 63 6f 6e 73 74 72 75 63 lass cg{construc
0001bf10: 74 6f 72 28 65 2c 7b 70 65 72 73 69 73 74 65 6e tor(e,{persisten
0001bf20: 63 65 4b 65 79 3a 74 2c 73 65 73 73 69 6f 6e 49 ceKey:t,sessionI
0001bf30: 64 3a 6e 3d 6f 68 2c 6f 6e 4c 6f 61 64 3a 72 2c d:n=oh,onLoad:r,
0001bf40: 6f 6e 4c 6f 61 64 45 72 72 6f 72 3a 6f 7d 2c 69 onLoadError:o},i
0001bf50: 3d 6e 65 77 20 6c 67 28 60 74 6c 64 72 61 77 2d =new lg(`tldraw-
0001bf60: 74 61 62 2d 73 79 6e 63 2d 24 7b 74 7d 60 29 29 tab-sync-${t}`))
0001bf70: 7b 74 68 69 73 2e 73 74 6f 72 65 3d 65 2c 74 68 {this.store=e,th
0001bf80: 69 73 2e 63 68 61 6e 6e 65 6c 3d 69 2c 22 75 6e is.channel=i,"un
0001bf90: 64 65 66 69 6e 65 64 22 21 3d 74 79 70 65 6f 66 defined"!=typeof
0001bfa0: 20 77 69 6e 64 6f 77 26 26 28 77 69 6e 64 6f 77 window&&(window
0001bfb0: 2e 74 6c 73 79 6e 63 3d 74 68 69 73 29 2c 74 68 .tlsync=this),th
0001bfc0: 69 73 2e 70 65 72 73 69 73 74 65 6e 63 65 4b 65 is.persistenceKe
0001bfd0: 79 3d 74 2c 74 68 69 73 2e 73 65 73 73 69 6f 6e y=t,this.session
0001bfe0: 49 64 3d 6e 2c 74 68 69 73 2e 73 65 72 69 61 6c Id=n,this.serial
0001bff0: 69 7a 65 64 53 63 68 65 6d 61 3d 74 68 69 73 2e izedSchema=this.
0001c000: 73 74 6f 72 65 2e 73 63 68 65 6d 61 2e 73 65 72 store.schema.ser
0001c010: 69 61 6c 69 7a 65 28 29 2c 74 68 69 73 2e 24 73 ialize(),this.$s
0001c020: 65 73 73 69 6f 6e 53 74 61 74 65 53 6e 61 70 73 essionStateSnaps
0001c030: 68 6f 74 3d 63 68 28 74 68 69 73 2e 73 74 6f 72 hot=ch(this.stor
0001c040: 65 29 2c 74 68 69 73 2e 64 69 73 70 6f 73 61 62 e),this.disposab
0001c050: 6c 65 73 2e 61 64 64 28 65 2e 6c 69 73 74 65 6e les.add(e.listen
0001c060: 28 28 28 7b 63 68 61 6e 67 65 73 3a 65 7d 29 3d ((({changes:e})=
0001c070: 3e 7b 74 68 69 73 2e 64 69 66 66 51 75 65 75 65 >{this.diffQueue
0001c080: 2e 70 75 73 68 28 65 29 2c 74 68 69 73 2e 63 68 .push(e),this.ch
0001c090: 61 6e 6e 65 6c 2e 70 6f 73 74 4d 65 73 73 61 67 annel.postMessag
0001c0a0: 65 28 7b 74 79 70 65 3a 22 64 69 66 66 22 2c 73 e({type:"diff",s
0001c0b0: 74 6f 72 65 49 64 3a 74 68 69 73 2e 73 74 6f 72 toreId:this.stor
0001c0c0: 65 2e 69 64 2c 63 68 61 6e 67 65 73 3a 65 2c 73 e.id,changes:e,s
0001c0d0: 63 68 65 6d 61 3a 74 68 69 73 2e 73 65 72 69 61 chema:this.seria
0001c0e0: 6c 69 7a 65 64 53 63 68 65 6d 61 7d 29 2c 74 68 lizedSchema}),th
0001c0f0: 69 73 2e 73 63 68 65 64 75 6c 65 50 65 72 73 69 is.schedulePersi
0001c100: 73 74 28 29 7d 29 2c 7b 73 6f 75 72 63 65 3a 22 st()}),{source:"
0001c110: 75 73 65 72 22 2c 73 63 6f 70 65 3a 22 64 6f 63 user",scope:"doc
0001c120: 75 6d 65 6e 74 22 7d 29 29 2c 74 68 69 73 2e 64 ument"})),this.d
0001c130: 69 73 70 6f 73 61 62 6c 65 73 2e 61 64 64 28 65 isposables.add(e
0001c140: 2e 6c 69 73 74 65 6e 28 28 28 29 3d 3e 7b 74 68 .listen((()=>{th
0001c150: 69 73 2e 64 69 66 66 51 75 65 75 65 2e 70 75 73 is.diffQueue.pus
0001c160: 68 28 73 67 29 2c 74 68 69 73 2e 73 63 68 65 64 h(sg),this.sched
0001c170: 75 6c 65 50 65 72 73 69 73 74 28 29 7d 29 2c 7b ulePersist()}),{
0001c180: 73 63 6f 70 65 3a 22 73 65 73 73 69 6f 6e 22 7d scope:"session"}
0001c190: 29 29 2c 74 68 69 73 2e 63 6f 6e 6e 65 63 74 28 )),this.connect(
0001c1a0: 72 2c 6f 29 2c 74 68 69 73 2e 64 6f 63 75 6d 65 r,o),this.docume
0001c1b0: 6e 74 54 79 70 65 73 3d 6e 65 77 20 53 65 74 28 ntTypes=new Set(
0001c1c0: 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 74 68 Object.values(th
0001c1d0: 69 73 2e 73 74 6f 72 65 2e 73 63 68 65 6d 61 2e is.store.schema.
0001c1e0: 74 79 70 65 73 29 2e 66 69 6c 74 65 72 28 28 65 types).filter((e
0001c1f0: 3d 3e 22 64 6f 63 75 6d 65 6e 74 22 3d 3d 3d 65 =>"document"===e
0001c200: 2e 73 63 6f 70 65 29 29 2e 6d 61 70 28 28 65 3d .scope)).map((e=
0001c210: 3e 65 2e 74 79 70 65 4e 61 6d 65 29 29 29 7d 64 >e.typeName)))}d
0001c220: 69 73 70 6f 73 61 62 6c 65 73 3d 6e 65 77 20 53 isposables=new S
0001c230: 65 74 3b 64 69 66 66 51 75 65 75 65 3d 5b 5d 3b et;diffQueue=[];
0001c240: 64 69 64 44 69 73 70 6f 73 65 3d 21 31 3b 73 68 didDispose=!1;sh
0001c250: 6f 75 6c 64 44 6f 46 75 6c 6c 44 42 57 72 69 74 ouldDoFullDBWrit
0001c260: 65 3d 21 30 3b 69 73 52 65 6c 6f 61 64 69 6e 67 e=!0;isReloading
0001c270: 3d 21 31 3b 70 65 72 73 69 73 74 65 6e 63 65 4b =!1;persistenceK
0001c280: 65 79 3b 73 65 73 73 69 6f 6e 49 64 3b 73 65 72 ey;sessionId;ser
0001c290: 69 61 6c 69 7a 65 64 53 63 68 65 6d 61 3b 69 73 ializedSchema;is
0001c2a0: 44 65 62 75 67 67 69 6e 67 3d 21 31 3b 64 6f 63 Debugging=!1;doc
0001c2b0: 75 6d 65 6e 74 54 79 70 65 73 3b 24 73 65 73 73 umentTypes;$sess
0001c2c0: 69 6f 6e 53 74 61 74 65 53 6e 61 70 73 68 6f 74 ionStateSnapshot
0001c2d0: 3b 69 6e 69 74 54 69 6d 65 3d 44 61 74 65 2e 6e ;initTime=Date.n
0001c2e0: 6f 77 28 29 3b 64 65 62 75 67 28 2e 2e 2e 65 29 ow();debug(...e)
0001c2f0: 7b 74 68 69 73 2e 69 73 44 65 62 75 67 67 69 6e {this.isDebuggin
0001c300: 67 26 26 63 6f 6e 73 6f 6c 65 2e 64 65 62 75 67 g&&console.debug
0001c310: 28 2e 2e 2e 65 29 7d 61 73 79 6e 63 20 63 6f 6e (...e)}async con
0001c320: 6e 65 63 74 28 65 2c 74 29 7b 6c 65 74 20 6e 3b nect(e,t){let n;
0001c330: 74 68 69 73 2e 64 65 62 75 67 28 22 63 6f 6e 6e this.debug("conn
0001c340: 65 63 74 69 6e 67 22 29 3b 74 72 79 7b 6e 3d 61 ecting");try{n=a
0001c350: 77 61 69 74 20 69 67 28 7b 70 65 72 73 69 73 74 wait ig({persist
0001c360: 65 6e 63 65 4b 65 79 3a 74 68 69 73 2e 70 65 72 enceKey:this.per
0001c370: 73 69 73 74 65 6e 63 65 4b 65 79 2c 73 65 73 73 sistenceKey,sess
0001c380: 69 6f 6e 49 64 3a 74 68 69 73 2e 73 65 73 73 69 ionId:this.sessi
0001c390: 6f 6e 49 64 2c 64 69 64 43 61 6e 63 65 6c 3a 28 onId,didCancel:(
0001c3a0: 29 3d 3e 74 68 69 73 2e 64 69 64 44 69 73 70 6f )=>this.didDispo
0001c3b0: 73 65 7d 29 7d 63 61 74 63 68 28 65 29 7b 72 65 se})}catch(e){re
0001c3c0: 74 75 72 6e 20 74 28 65 29 2c 77 69 6e 64 6f 77 turn t(e),window
0001c3d0: 2e 61 6c 65 72 74 28 22 4f 6f 70 73 21 20 57 65 .alert("Oops! We
0001c3e0: 20 63 6f 75 6c 64 20 6e 6f 74 20 61 63 63 65 73 could not acces
0001c3f0: 73 20 79 6f 75 72 20 62 72 6f 77 73 65 72 27 73 s your browser's
0001c400: 20 73 74 6f 72 61 67 65 e2 80 94 61 6e 64 20 74 storage...and t
0001c410: 68 65 20 61 70 70 20 77 6f 6e 27 74 20 77 6f 72 he app won't wor
0001c420: 6b 20 63 6f 72 72 65 63 74 6c 79 20 77 69 74 68 k correctly with
0001c430: 6f 75 74 20 74 68 61 74 2e 20 57 65 20 6e 6f 77 out that. We now
0001c440: 20 6e 65 65 64 20 74 6f 20 72 65 6c 6f 61 64 20 need to reload
0001c450: 74 68 65 20 70 61 67 65 20 61 6e 64 20 74 72 79 the page and try
0001c460: 20 61 67 61 69 6e 2e 5c 6e 5c 6e 4b 65 65 70 20 again.\n\nKeep
0001c470: 73 65 65 69 6e 67 20 74 68 69 73 20 6d 65 73 73 seeing this mess
0001c480: 61 67 65 3f 5c 6e e2 80 a2 20 49 66 20 79 6f 75 age?\n... If you
0001c490: 27 72 65 20 75 73 69 6e 67 20 74 6c 64 72 61 77 're using tldraw
0001c4a0: 20 69 6e 20 61 20 70 72 69 76 61 74 65 20 6f 72 in a private or
0001c4b0: 20 5c 22 69 6e 63 6f 67 6e 69 74 6f 5c 22 20 77 \"incognito\" w
0001c4c0: 69 6e 64 6f 77 2c 20 74 72 79 20 6c 6f 61 64 69 indow, try loadi
0001c4d0: 6e 67 20 74 6c 64 72 61 77 20 69 6e 20 61 20 72 ng tldraw in a r
0001c4e0: 65 67 75 6c 61 72 20 77 69 6e 64 6f 77 20 6f 72 egular window or
0001c4f0: 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e 74 20 in a different
0001c500: 62 72 6f 77 73 65 72 2e 22 29 2c 76 6f 69 64 28 browser."),void(
0001c510: 22 75 6e 64 65 66 69 6e 65 64 22 21 3d 74 79 70 "undefined"!=typ
0001c520: 65 6f 66 20 77 69 6e 64 6f 77 26 26 77 69 6e 64 eof window&&wind
0001c530: 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 72 65 6c 6f ow.location.relo
0001c540: 61 64 28 29 29 7d 69 66 28 74 68 69 73 2e 64 65 ad())}if(this.de
0001c550: 62 75 67 28 22 6c 6f 61 64 65 64 20 64 61 74 61 bug("loaded data
0001c560: 20 66 72 6f 6d 20 73 74 6f 72 65 22 2c 6e 2c 22 from store",n,"
0001c570: 64 69 64 44 69 73 70 6f 73 65 22 2c 74 68 69 73 didDispose",this
0001c580: 2e 64 69 64 44 69 73 70 6f 73 65 29 2c 21 74 68 .didDispose),!th
0001c590: 69 73 2e 64 69 64 44 69 73 70 6f 73 65 29 74 72 is.didDispose)tr
0001c5a0: 79 7b 69 66 28 6e 29 7b 63 6f 6e 73 74 20 65 3d y{if(n){const e=
0001c5b0: 4f 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 72 69 Object.fromEntri
0001c5c0: 65 73 28 6e 2e 72 65 63 6f 72 64 73 2e 6d 61 70 es(n.records.map
0001c5d0: 28 28 65 3d 3e 5b 65 2e 69 64 2c 65 5d 29 29 29 ((e=>[e.id,e])))
0001c5e0: 2c 72 3d 6e 2e 73 65 73 73 69 6f 6e 53 74 61 74 ,r=n.sessionStat
0001c5f0: 65 53 6e 61 70 73 68 6f 74 3f 3f 66 75 6e 63 74 eSnapshot??funct
0001c600: 69 6f 6e 28 65 29 7b 63 6f 6e 73 74 20 74 3d 5b ion(e){const t=[
0001c610: 5d 3b 66 6f 72 28 63 6f 6e 73 74 20 6e 20 6f 66 ];for(const n of
0001c620: 20 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 65 Object.values(e
0001c630: 29 29 6e 2e 74 79 70 65 4e 61 6d 65 3f 2e 6d 61 ))n.typeName?.ma
0001c640: 74 63 68 28 2f 5e 28 69 6e 73 74 61 6e 63 65 2e tch(/^(instance.
0001c650: 2a 7c 70 6f 69 6e 74 65 72 7c 63 61 6d 65 72 61 *|pointer|camera
0001c660: 29 24 2f 29 26 26 74 2e 70 75 73 68 28 6e 29 3b )$/)&&t.push(n);
0001c670: 63 6f 6e 73 74 20 6e 3d 74 2e 66 69 6c 74 65 72 const n=t.filter
0001c680: 28 28 65 3d 3e 22 69 6e 73 74 61 6e 63 65 22 3d ((e=>"instance"=
0001c690: 3d 3d 65 2e 74 79 70 65 4e 61 6d 65 26 26 65 2e ==e.typeName&&e.
0001c6a0: 69 64 21 3d 3d 62 6c 29 29 5b 30 5d 3b 69 66 28 id!==bl))[0];if(
0001c6b0: 21 6e 29 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 63 !n)return null;c
0001c6c0: 6f 6e 73 74 20 72 3d 7b 76 65 72 73 69 6f 6e 3a onst r={version:
0001c6d0: 61 68 2c 63 75 72 72 65 6e 74 50 61 67 65 49 64 ah,currentPageId
0001c6e0: 3a 6e 2e 63 75 72 72 65 6e 74 50 61 67 65 49 64 :n.currentPageId
0001c6f0: 2c 65 78 70 6f 72 74 42 61 63 6b 67 72 6f 75 6e ,exportBackgroun
0001c700: 64 3a 21 21 6e 2e 65 78 70 6f 72 74 42 61 63 6b d:!!n.exportBack
0001c710: 67 72 6f 75 6e 64 2c 69 73 46 6f 63 75 73 4d 6f ground,isFocusMo
0001c720: 64 65 3a 21 21 6e 2e 69 73 46 6f 63 75 73 4d 6f de:!!n.isFocusMo
0001c730: 64 65 2c 69 73 44 65 62 75 67 4d 6f 64 65 3a 21 de,isDebugMode:!
0001c740: 21 6e 2e 69 73 44 65 62 75 67 4d 6f 64 65 2c 69 !n.isDebugMode,i
0001c750: 73 54 6f 6f 6c 4c 6f 63 6b 65 64 3a 21 21 6e 2e sToolLocked:!!n.
0001c760: 69 73 54 6f 6f 6c 4c 6f 63 6b 65 64 2c 69 73 47 isToolLocked,isG
0001c770: 72 69 64 4d 6f 64 65 3a 21 31 2c 70 61 67 65 53 ridMode:!1,pageS
0001c780: 74 61 74 65 73 3a 74 2e 66 69 6c 74 65 72 28 28 tates:t.filter((
0001c790: 65 3d 3e 22 69 6e 73 74 61 6e 63 65 5f 70 61 67 e=>"instance_pag
0001c7a0: 65 5f 73 74 61 74 65 22 3d 3d 3d 65 2e 74 79 70 e_state"===e.typ
0001c7b0: 65 4e 61 6d 65 26 26 65 2e 69 6e 73 74 61 6e 63 eName&&e.instanc
0001c7c0: 65 49 64 3d 3d 3d 6e 2e 69 64 29 29 2e 6d 61 70 eId===n.id)).map
0001c7d0: 28 28 74 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 65 5b ((t=>{const n=e[
0001c7e0: 74 2e 63 61 6d 65 72 61 49 64 5d 3f 3f 7b 78 3a t.cameraId]??{x:
0001c7f0: 30 2c 79 3a 30 2c 7a 3a 31 7d 3b 72 65 74 75 72 0,y:0,z:1};retur
0001c800: 6e 7b 70 61 67 65 49 64 3a 74 2e 70 61 67 65 49 n{pageId:t.pageI
0001c810: 64 2c 63 61 6d 65 72 61 3a 7b 78 3a 6e 2e 78 2c d,camera:{x:n.x,
0001c820: 79 3a 6e 2e 79 2c 7a 3a 6e 2e 7a 7d 2c 73 65 6c y:n.y,z:n.z},sel
0001c830: 65 63 74 65 64 53 68 61 70 65 49 64 73 3a 74 2e ectedShapeIds:t.
0001c840: 73 65 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 selectedShapeIds
0001c850: 2c 66 6f 63 75 73 65 64 47 72 6f 75 70 49 64 3a ,focusedGroupId:
0001c860: 74 2e 66 6f 63 75 73 65 64 47 72 6f 75 70 49 64 t.focusedGroupId
0001c870: 7d 7d 29 29 7d 3b 74 72 79 7b 72 65 74 75 72 6e }}))};try{return
0001c880: 20 73 68 2e 76 61 6c 69 64 61 74 65 28 72 29 2c sh.validate(r),
0001c890: 72 7d 63 61 74 63 68 28 65 29 7b 72 65 74 75 72 r}catch(e){retur
0001c8a0: 6e 20 6e 75 6c 6c 7d 7d 28 65 29 2c 6f 3d 74 68 n null}}(e),o=th
0001c8b0: 69 73 2e 73 74 6f 72 65 2e 73 63 68 65 6d 61 2e is.store.schema.
0001c8c0: 6d 69 67 72 61 74 65 53 74 6f 72 65 53 6e 61 70 migrateStoreSnap
0001c8d0: 73 68 6f 74 28 7b 73 74 6f 72 65 3a 65 2c 73 63 shot({store:e,sc
0001c8e0: 68 65 6d 61 3a 6e 2e 73 63 68 65 6d 61 3f 3f 74 hema:n.schema??t
0001c8f0: 68 69 73 2e 73 74 6f 72 65 2e 73 63 68 65 6d 61 his.store.schema
0001c900: 2e 73 65 72 69 61 6c 69 7a 65 45 61 72 6c 69 65 .serializeEarlie
0001c910: 73 74 56 65 72 73 69 6f 6e 28 29 7d 29 3b 69 66 stVersion()});if
0001c920: 28 22 65 72 72 6f 72 22 3d 3d 3d 6f 2e 74 79 70 ("error"===o.typ
0001c930: 65 29 72 65 74 75 72 6e 20 63 6f 6e 73 6f 6c 65 e)return console
0001c940: 2e 65 72 72 6f 72 28 22 66 61 69 6c 65 64 20 74 .error("failed t
0001c950: 6f 20 6d 69 67 72 61 74 65 20 73 74 6f 72 65 22 o migrate store"
0001c960: 2c 6f 29 2c 76 6f 69 64 20 74 28 6e 65 77 20 45 ,o),void t(new E
0001c970: 72 72 6f 72 28 60 46 61 69 6c 65 64 20 74 6f 20 rror(`Failed to
0001c980: 6d 69 67 72 61 74 65 20 73 74 6f 72 65 3a 20 24 migrate store: $
0001c990: 7b 6f 2e 72 65 61 73 6f 6e 7d 60 29 29 3b 74 68 {o.reason}`));th
0001c9a0: 69 73 2e 73 74 6f 72 65 2e 6d 65 72 67 65 52 65 is.store.mergeRe
0001c9b0: 6d 6f 74 65 43 68 61 6e 67 65 73 28 28 28 29 3d moteChanges((()=
0001c9c0: 3e 7b 74 68 69 73 2e 73 74 6f 72 65 2e 70 75 74 >{this.store.put
0001c9d0: 28 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 6f (Object.values(o
0001c9e0: 2e 76 61 6c 75 65 29 2e 66 69 6c 74 65 72 28 28 .value).filter((
0001c9f0: 65 3d 3e 74 68 69 73 2e 64 6f 63 75 6d 65 6e 74 e=>this.document
0001ca00: 54 79 70 65 73 2e 68 61 73 28 65 2e 74 79 70 65 Types.has(e.type
0001ca10: 4e 61 6d 65 29 29 29 2c 22 69 6e 69 74 69 61 6c Name))),"initial
0001ca20: 69 7a 65 22 29 7d 29 29 2c 72 26 26 75 68 28 74 ize")})),r&&uh(t
0001ca30: 68 69 73 2e 73 74 6f 72 65 2c 72 29 7d 74 68 69 his.store,r)}thi
0001ca40: 73 2e 63 68 61 6e 6e 65 6c 2e 6f 6e 6d 65 73 73 s.channel.onmess
0001ca50: 61 67 65 3d 28 7b 64 61 74 61 3a 65 7d 29 3d 3e age=({data:e})=>
0001ca60: 7b 74 68 69 73 2e 64 65 62 75 67 28 22 67 6f 74 {this.debug("got
0001ca70: 20 6d 65 73 73 61 67 65 22 2c 65 29 3b 63 6f 6e message",e);con
0001ca80: 73 74 20 6e 3d 65 2c 72 3d 74 68 69 73 2e 73 74 st n=e,r=this.st
0001ca90: 6f 72 65 2e 73 63 68 65 6d 61 2e 67 65 74 4d 69 ore.schema.getMi
0001caa0: 67 72 61 74 69 6f 6e 73 53 69 6e 63 65 28 6e 2e grationsSince(n.
0001cab0: 73 63 68 65 6d 61 29 3b 69 66 28 21 72 2e 6f 6b schema);if(!r.ok
0001cac0: 29 7b 72 65 74 75 72 6e 20 44 61 74 65 2e 6e 6f ){return Date.no
0001cad0: 77 28 29 2d 74 68 69 73 2e 69 6e 69 74 54 69 6d w()-this.initTim
0001cae0: 65 3c 35 65 33 3f 76 6f 69 64 20 74 28 6e 65 77 e<5e3?void t(new
0001caf0: 20 45 72 72 6f 72 28 22 53 63 68 65 6d 61 20 6d Error("Schema m
0001cb00: 69 73 6d 61 74 63 68 2c 20 70 6c 65 61 73 65 20 ismatch, please
0001cb10: 63 6c 6f 73 65 20 6f 74 68 65 72 20 74 61 62 73 close other tabs
0001cb20: 20 61 6e 64 20 72 65 6c 6f 61 64 20 74 68 65 20 and reload the
0001cb30: 70 61 67 65 22 29 29 3a 28 74 68 69 73 2e 64 65 page")):(this.de
0001cb40: 62 75 67 28 22 72 65 6c 6f 61 64 69 6e 67 22 29 bug("reloading")
0001cb50: 2c 74 68 69 73 2e 69 73 52 65 6c 6f 61 64 69 6e ,this.isReloadin
0001cb60: 67 3d 21 30 2c 76 6f 69 64 20 77 69 6e 64 6f 77 g=!0,void window
0001cb70: 3f 2e 6c 6f 63 61 74 69 6f 6e 3f 2e 72 65 6c 6f ?.location?.relo
0001cb80: 61 64 3f 2e 28 29 29 7d 69 66 28 72 2e 76 61 6c ad?.())}if(r.val
0001cb90: 75 65 2e 6c 65 6e 67 74 68 3e 30 29 72 65 74 75 ue.length>0)retu
0001cba0: 72 6e 20 74 68 69 73 2e 64 65 62 75 67 28 22 74 rn this.debug("t
0001cbb0: 65 6c 6c 69 6e 67 20 74 68 65 6d 20 74 6f 20 72 elling them to r
0001cbc0: 65 6c 6f 61 64 22 29 2c 74 68 69 73 2e 63 68 61 eload"),this.cha
0001cbd0: 6e 6e 65 6c 2e 70 6f 73 74 4d 65 73 73 61 67 65 nnel.postMessage
0001cbe0: 28 7b 74 79 70 65 3a 22 61 6e 6e 6f 75 6e 63 65 ({type:"announce
0001cbf0: 22 2c 73 63 68 65 6d 61 3a 74 68 69 73 2e 73 65 ",schema:this.se
0001cc00: 72 69 61 6c 69 7a 65 64 53 63 68 65 6d 61 7d 29 rializedSchema})
0001cc10: 2c 74 68 69 73 2e 73 68 6f 75 6c 64 44 6f 46 75 ,this.shouldDoFu
0001cc20: 6c 6c 44 42 57 72 69 74 65 3d 21 30 2c 76 6f 69 llDBWrite=!0,voi
0001cc30: 64 20 74 68 69 73 2e 70 65 72 73 69 73 74 49 66 d this.persistIf
0001cc40: 4e 65 65 64 65 64 28 29 3b 22 64 69 66 66 22 3d Needed();"diff"=
0001cc50: 3d 3d 6e 2e 74 79 70 65 26 26 28 74 68 69 73 2e ==n.type&&(this.
0001cc60: 64 65 62 75 67 28 22 61 70 70 6c 79 69 6e 67 20 debug("applying
0001cc70: 64 69 66 66 22 29 2c 71 69 28 28 28 29 3d 3e 7b diff"),qi((()=>{
0001cc80: 74 68 69 73 2e 73 74 6f 72 65 2e 6d 65 72 67 65 this.store.merge
0001cc90: 52 65 6d 6f 74 65 43 68 61 6e 67 65 73 28 28 28 RemoteChanges(((
0001cca0: 29 3d 3e 7b 74 68 69 73 2e 73 74 6f 72 65 2e 61 )=>{this.store.a
0001ccb0: 70 70 6c 79 44 69 66 66 28 6e 2e 63 68 61 6e 67 pplyDiff(n.chang
0001ccc0: 65 73 29 2c 74 68 69 73 2e 73 74 6f 72 65 2e 65 es),this.store.e
0001ccd0: 6e 73 75 72 65 53 74 6f 72 65 49 73 55 73 61 62 nsureStoreIsUsab
0001cce0: 6c 65 28 29 7d 29 29 7d 29 29 29 7d 2c 74 68 69 le()}))})))},thi
0001ccf0: 73 2e 63 68 61 6e 6e 65 6c 2e 70 6f 73 74 4d 65 s.channel.postMe
0001cd00: 73 73 61 67 65 28 7b 74 79 70 65 3a 22 61 6e 6e ssage({type:"ann
0001cd10: 6f 75 6e 63 65 22 2c 73 63 68 65 6d 61 3a 74 68 ounce",schema:th
0001cd20: 69 73 2e 73 65 72 69 61 6c 69 7a 65 64 53 63 68 is.serializedSch
0001cd30: 65 6d 61 7d 29 2c 74 68 69 73 2e 64 69 73 70 6f ema}),this.dispo
0001cd40: 73 61 62 6c 65 73 2e 61 64 64 28 28 28 29 3d 3e sables.add((()=>
0001cd50: 7b 74 68 69 73 2e 63 68 61 6e 6e 65 6c 2e 63 6c {this.channel.cl
0001cd60: 6f 73 65 28 29 7d 29 29 2c 65 28 74 68 69 73 29 ose()})),e(this)
0001cd70: 7d 63 61 74 63 68 28 65 29 7b 69 66 28 74 68 69 }catch(e){if(thi
0001cd80: 73 2e 64 65 62 75 67 28 22 65 72 72 6f 72 20 6c s.debug("error l
0001cd90: 6f 61 64 69 6e 67 20 64 61 74 61 20 66 72 6f 6d oading data from
0001cda0: 20 73 74 6f 72 65 22 2c 65 29 2c 74 68 69 73 2e store",e),this.
0001cdb0: 64 69 64 44 69 73 70 6f 73 65 29 72 65 74 75 72 didDispose)retur
0001cdc0: 6e 3b 72 65 74 75 72 6e 20 76 6f 69 64 20 74 28 n;return void t(
0001cdd0: 65 29 7d 7d 63 6c 6f 73 65 28 29 7b 74 68 69 73 e)}}close(){this
0001cde0: 2e 64 65 62 75 67 28 22 63 6c 6f 73 69 6e 67 22 .debug("closing"
0001cdf0: 29 2c 74 68 69 73 2e 64 69 64 44 69 73 70 6f 73 ),this.didDispos
0001ce00: 65 3d 21 30 2c 74 68 69 73 2e 64 69 73 70 6f 73 e=!0,this.dispos
0001ce10: 61 62 6c 65 73 2e 66 6f 72 45 61 63 68 28 28 65 ables.forEach((e
0001ce20: 3d 3e 65 28 29 29 29 7d 69 73 50 65 72 73 69 73 =>e()))}isPersis
0001ce30: 74 69 6e 67 3d 21 31 3b 64 69 64 4c 61 73 74 57 ting=!1;didLastW
0001ce40: 72 69 74 65 45 72 72 6f 72 3d 21 31 3b 73 63 68 riteError=!1;sch
0001ce50: 65 64 75 6c 65 64 50 65 72 73 69 73 74 54 69 6d eduledPersistTim
0001ce60: 65 6f 75 74 3d 6e 75 6c 6c 3b 73 63 68 65 64 75 eout=null;schedu
0001ce70: 6c 65 50 65 72 73 69 73 74 28 29 7b 74 68 69 73 lePersist(){this
0001ce80: 2e 64 65 62 75 67 28 22 73 63 68 65 64 75 6c 65 .debug("schedule
0001ce90: 50 65 72 73 69 73 74 22 2c 74 68 69 73 2e 73 63 Persist",this.sc
0001cea0: 68 65 64 75 6c 65 64 50 65 72 73 69 73 74 54 69 heduledPersistTi
0001ceb0: 6d 65 6f 75 74 29 2c 74 68 69 73 2e 73 63 68 65 meout),this.sche
0001cec0: 64 75 6c 65 64 50 65 72 73 69 73 74 54 69 6d 65 duledPersistTime
0001ced0: 6f 75 74 7c 7c 28 74 68 69 73 2e 73 63 68 65 64 out||(this.sched
0001cee0: 75 6c 65 64 50 65 72 73 69 73 74 54 69 6d 65 6f uledPersistTimeo
0001cef0: 75 74 3d 73 65 74 54 69 6d 65 6f 75 74 28 28 28 ut=setTimeout(((
0001cf00: 29 3d 3e 7b 74 68 69 73 2e 73 63 68 65 64 75 6c )=>{this.schedul
0001cf10: 65 64 50 65 72 73 69 73 74 54 69 6d 65 6f 75 74 edPersistTimeout
0001cf20: 3d 6e 75 6c 6c 2c 74 68 69 73 2e 70 65 72 73 69 =null,this.persi
0001cf30: 73 74 49 66 4e 65 65 64 65 64 28 29 7d 29 2c 74 stIfNeeded()}),t
0001cf40: 68 69 73 2e 64 69 64 4c 61 73 74 57 72 69 74 65 his.didLastWrite
0001cf50: 45 72 72 6f 72 3f 31 65 34 3a 33 35 30 29 29 7d Error?1e4:350))}
0001cf60: 70 65 72 73 69 73 74 49 66 4e 65 65 64 65 64 28 persistIfNeeded(
0001cf70: 29 7b 74 68 69 73 2e 64 65 62 75 67 28 22 70 65 ){this.debug("pe
0001cf80: 72 73 69 73 74 49 66 4e 65 65 64 65 64 22 2c 7b rsistIfNeeded",{
0001cf90: 69 73 50 65 72 73 69 73 74 69 6e 67 3a 74 68 69 isPersisting:thi
0001cfa0: 73 2e 69 73 50 65 72 73 69 73 74 69 6e 67 2c 69 s.isPersisting,i
0001cfb0: 73 52 65 6c 6f 61 64 69 6e 67 3a 74 68 69 73 2e sReloading:this.
0001cfc0: 69 73 52 65 6c 6f 61 64 69 6e 67 2c 73 68 6f 75 isReloading,shou
0001cfd0: 6c 64 44 6f 46 75 6c 6c 44 42 57 72 69 74 65 3a ldDoFullDBWrite:
0001cfe0: 74 68 69 73 2e 73 68 6f 75 6c 64 44 6f 46 75 6c this.shouldDoFul
0001cff0: 6c 44 42 57 72 69 74 65 2c 64 69 66 66 51 75 65 lDBWrite,diffQue
0001d000: 75 65 4c 65 6e 67 74 68 3a 74 68 69 73 2e 64 69 ueLength:this.di
0001d010: 66 66 51 75 65 75 65 2e 6c 65 6e 67 74 68 2c 73 ffQueue.length,s
0001d020: 74 6f 72 65 49 73 50 6f 73 73 69 62 6c 79 43 6f toreIsPossiblyCo
0001d030: 72 72 75 70 74 3a 74 68 69 73 2e 73 74 6f 72 65 rrupt:this.store
0001d040: 2e 69 73 50 6f 73 73 69 62 6c 79 43 6f 72 72 75 .isPossiblyCorru
0001d050: 70 74 65 64 28 29 7d 29 2c 74 68 69 73 2e 73 63 pted()}),this.sc
0001d060: 68 65 64 75 6c 65 64 50 65 72 73 69 73 74 54 69 heduledPersistTi
0001d070: 6d 65 6f 75 74 26 26 28 63 6c 65 61 72 54 69 6d meout&&(clearTim
0001d080: 65 6f 75 74 28 74 68 69 73 2e 73 63 68 65 64 75 eout(this.schedu
0001d090: 6c 65 64 50 65 72 73 69 73 74 54 69 6d 65 6f 75 ledPersistTimeou
0001d0a0: 74 29 2c 74 68 69 73 2e 73 63 68 65 64 75 6c 65 t),this.schedule
0001d0b0: 64 50 65 72 73 69 73 74 54 69 6d 65 6f 75 74 3d dPersistTimeout=
0001d0c0: 6e 75 6c 6c 29 2c 74 68 69 73 2e 69 73 50 65 72 null),this.isPer
0001d0d0: 73 69 73 74 69 6e 67 7c 7c 74 68 69 73 2e 69 73 sisting||this.is
0001d0e0: 52 65 6c 6f 61 64 69 6e 67 7c 7c 74 68 69 73 2e Reloading||this.
0001d0f0: 73 74 6f 72 65 2e 69 73 50 6f 73 73 69 62 6c 79 store.isPossibly
0001d100: 43 6f 72 72 75 70 74 65 64 28 29 7c 7c 28 74 68 Corrupted()||(th
0001d110: 69 73 2e 73 68 6f 75 6c 64 44 6f 46 75 6c 6c 44 is.shouldDoFullD
0001d120: 42 57 72 69 74 65 7c 7c 74 68 69 73 2e 64 69 66 BWrite||this.dif
0001d130: 66 51 75 65 75 65 2e 6c 65 6e 67 74 68 3e 30 29 fQueue.length>0)
0001d140: 26 26 74 68 69 73 2e 64 6f 50 65 72 73 69 73 74 &&this.doPersist
0001d150: 28 29 7d 61 73 79 6e 63 20 64 6f 50 65 72 73 69 ()}async doPersi
0001d160: 73 74 28 29 7b 57 72 28 21 74 68 69 73 2e 69 73 st(){Wr(!this.is
0001d170: 50 65 72 73 69 73 74 69 6e 67 2c 22 70 65 72 73 Persisting,"pers
0001d180: 69 73 74 20 61 6c 72 65 61 64 79 20 69 6e 20 70 ist already in p
0001d190: 72 6f 67 72 65 73 73 22 29 2c 74 68 69 73 2e 69 rogress"),this.i
0001d1a0: 73 50 65 72 73 69 73 74 69 6e 67 3d 21 30 2c 74 sPersisting=!0,t
0001d1b0: 68 69 73 2e 64 65 62 75 67 28 22 64 6f 50 65 72 his.debug("doPer
0001d1c0: 73 69 73 74 20 73 74 61 72 74 22 29 3b 63 6f 6e sist start");con
0001d1d0: 73 74 20 65 3d 74 68 69 73 2e 64 69 66 66 51 75 st e=this.diffQu
0001d1e0: 65 75 65 3b 74 68 69 73 2e 64 69 66 66 51 75 65 eue;this.diffQue
0001d1f0: 75 65 3d 5b 5d 3b 74 72 79 7b 69 66 28 74 68 69 ue=[];try{if(thi
0001d200: 73 2e 73 68 6f 75 6c 64 44 6f 46 75 6c 6c 44 42 s.shouldDoFullDB
0001d210: 57 72 69 74 65 29 74 68 69 73 2e 73 68 6f 75 6c Write)this.shoul
0001d220: 64 44 6f 46 75 6c 6c 44 42 57 72 69 74 65 3d 21 dDoFullDBWrite=!
0001d230: 31 2c 61 77 61 69 74 20 61 73 79 6e 63 20 66 75 1,await async fu
0001d240: 6e 63 74 69 6f 6e 28 7b 70 65 72 73 69 73 74 65 nction({persiste
0001d250: 6e 63 65 4b 65 79 3a 65 2c 73 63 68 65 6d 61 3a nceKey:e,schema:
0001d260: 74 2c 73 6e 61 70 73 68 6f 74 3a 6e 2c 73 65 73 t,snapshot:n,ses
0001d270: 73 69 6f 6e 49 64 3a 72 2c 73 65 73 73 69 6f 6e sionId:r,session
0001d280: 53 74 61 74 65 53 6e 61 70 73 68 6f 74 3a 6f 2c StateSnapshot:o,
0001d290: 64 69 64 43 61 6e 63 65 6c 3a 69 7d 29 7b 63 6f didCancel:i}){co
0001d2a0: 6e 73 74 20 61 3d 74 67 2b 65 3b 61 77 61 69 74 nst a=tg+e;await
0001d2b0: 20 6f 67 28 61 2c 28 61 73 79 6e 63 20 65 3d 3e og(a,(async e=>
0001d2c0: 7b 63 6f 6e 73 74 20 61 3d 65 2e 74 72 61 6e 73 {const a=e.trans
0001d2d0: 61 63 74 69 6f 6e 28 5b 72 67 2e 52 65 63 6f 72 action([rg.Recor
0001d2e0: 64 73 2c 72 67 2e 53 63 68 65 6d 61 2c 72 67 2e ds,rg.Schema,rg.
0001d2f0: 53 65 73 73 69 6f 6e 53 74 61 74 65 5d 2c 22 72 SessionState],"r
0001d300: 65 61 64 77 72 69 74 65 22 29 2c 73 3d 61 2e 6f eadwrite"),s=a.o
0001d310: 62 6a 65 63 74 53 74 6f 72 65 28 72 67 2e 52 65 bjectStore(rg.Re
0001d320: 63 6f 72 64 73 29 2c 6c 3d 61 2e 6f 62 6a 65 63 cords),l=a.objec
0001d330: 74 53 74 6f 72 65 28 72 67 2e 53 63 68 65 6d 61 tStore(rg.Schema
0001d340: 29 2c 63 3d 61 2e 6f 62 6a 65 63 74 53 74 6f 72 ),c=a.objectStor
0001d350: 65 28 72 67 2e 53 65 73 73 69 6f 6e 53 74 61 74 e(rg.SessionStat
0001d360: 65 29 3b 61 77 61 69 74 20 73 2e 63 6c 65 61 72 e);await s.clear
0001d370: 28 29 3b 66 6f 72 28 63 6f 6e 73 74 5b 65 2c 74 ();for(const[e,t
0001d380: 5d 6f 66 20 4f 62 6a 65 63 74 2e 65 6e 74 72 69 ]of Object.entri
0001d390: 65 73 28 6e 29 29 61 77 61 69 74 20 73 2e 70 75 es(n))await s.pu
0001d3a0: 74 28 74 2c 65 29 3b 69 66 28 6c 2e 70 75 74 28 t(t,e);if(l.put(
0001d3b0: 74 2e 73 65 72 69 61 6c 69 7a 65 28 29 2c 72 67 t.serialize(),rg
0001d3c0: 2e 53 63 68 65 6d 61 29 2c 6f 26 26 72 3f 63 2e .Schema),o&&r?c.
0001d3d0: 70 75 74 28 7b 73 6e 61 70 73 68 6f 74 3a 6f 2c put({snapshot:o,
0001d3e0: 75 70 64 61 74 65 64 41 74 3a 44 61 74 65 2e 6e updatedAt:Date.n
0001d3f0: 6f 77 28 29 2c 69 64 3a 72 7d 2c 72 29 3a 28 6f ow(),id:r},r):(o
0001d400: 7c 7c 72 29 26 26 63 6f 6e 73 6f 6c 65 2e 65 72 ||r)&&console.er
0001d410: 72 6f 72 28 22 73 65 73 73 69 6f 6e 53 74 61 74 ror("sessionStat
0001d420: 65 53 6e 61 70 73 68 6f 74 20 61 6e 64 20 69 6e eSnapshot and in
0001d430: 73 74 61 6e 63 65 49 64 20 6d 75 73 74 20 62 65 stanceId must be
0001d440: 20 70 72 6f 76 69 64 65 64 20 74 6f 67 65 74 68 provided togeth
0001d450: 65 72 22 29 2c 69 3f 2e 28 29 29 72 65 74 75 72 er"),i?.())retur
0001d460: 6e 20 61 2e 61 62 6f 72 74 28 29 3b 61 77 61 69 n a.abort();awai
0001d470: 74 20 61 2e 64 6f 6e 65 7d 29 29 7d 28 7b 70 65 t a.done}))}({pe
0001d480: 72 73 69 73 74 65 6e 63 65 4b 65 79 3a 74 68 69 rsistenceKey:thi
0001d490: 73 2e 70 65 72 73 69 73 74 65 6e 63 65 4b 65 79 s.persistenceKey
0001d4a0: 2c 73 63 68 65 6d 61 3a 74 68 69 73 2e 73 74 6f ,schema:this.sto
0001d4b0: 72 65 2e 73 63 68 65 6d 61 2c 73 6e 61 70 73 68 re.schema,snapsh
0001d4c0: 6f 74 3a 74 68 69 73 2e 73 74 6f 72 65 2e 73 65 ot:this.store.se
0001d4d0: 72 69 61 6c 69 7a 65 28 29 2c 64 69 64 43 61 6e rialize(),didCan
0001d4e0: 63 65 6c 3a 28 29 3d 3e 74 68 69 73 2e 64 69 64 cel:()=>this.did
0001d4f0: 44 69 73 70 6f 73 65 2c 73 65 73 73 69 6f 6e 49 Dispose,sessionI
0001d500: 64 3a 74 68 69 73 2e 73 65 73 73 69 6f 6e 49 64 d:this.sessionId
0001d510: 2c 73 65 73 73 69 6f 6e 53 74 61 74 65 53 6e 61 ,sessionStateSna
0001d520: 70 73 68 6f 74 3a 74 68 69 73 2e 24 73 65 73 73 pshot:this.$sess
0001d530: 69 6f 6e 53 74 61 74 65 53 6e 61 70 73 68 6f 74 ionStateSnapshot
0001d540: 2e 67 65 74 28 29 7d 29 3b 65 6c 73 65 7b 63 6f .get()});else{co
0001d550: 6e 73 74 20 74 3d 79 69 28 65 2e 66 69 6c 74 65 nst t=yi(e.filte
0001d560: 72 28 28 65 3d 3e 65 21 3d 3d 73 67 29 29 29 3b r((e=>e!==sg)));
0001d570: 61 77 61 69 74 20 61 73 79 6e 63 20 66 75 6e 63 await async func
0001d580: 74 69 6f 6e 28 7b 70 65 72 73 69 73 74 65 6e 63 tion({persistenc
0001d590: 65 4b 65 79 3a 65 2c 73 63 68 65 6d 61 3a 74 2c eKey:e,schema:t,
0001d5a0: 63 68 61 6e 67 65 73 3a 6e 2c 73 65 73 73 69 6f changes:n,sessio
0001d5b0: 6e 49 64 3a 72 2c 73 65 73 73 69 6f 6e 53 74 61 nId:r,sessionSta
0001d5c0: 74 65 53 6e 61 70 73 68 6f 74 3a 6f 2c 64 69 64 teSnapshot:o,did
0001d5d0: 43 61 6e 63 65 6c 3a 69 7d 29 7b 63 6f 6e 73 74 Cancel:i}){const
0001d5e0: 20 61 3d 74 67 2b 65 3b 61 77 61 69 74 20 6f 67 a=tg+e;await og
0001d5f0: 28 61 2c 28 61 73 79 6e 63 20 65 3d 3e 7b 63 6f (a,(async e=>{co
0001d600: 6e 73 74 20 61 3d 65 2e 74 72 61 6e 73 61 63 74 nst a=e.transact
0001d610: 69 6f 6e 28 5b 72 67 2e 52 65 63 6f 72 64 73 2c ion([rg.Records,
0001d620: 72 67 2e 53 63 68 65 6d 61 2c 72 67 2e 53 65 73 rg.Schema,rg.Ses
0001d630: 73 69 6f 6e 53 74 61 74 65 5d 2c 22 72 65 61 64 sionState],"read
0001d640: 77 72 69 74 65 22 29 2c 73 3d 61 2e 6f 62 6a 65 write"),s=a.obje
0001d650: 63 74 53 74 6f 72 65 28 72 67 2e 52 65 63 6f 72 ctStore(rg.Recor
0001d660: 64 73 29 2c 6c 3d 61 2e 6f 62 6a 65 63 74 53 74 ds),l=a.objectSt
0001d670: 6f 72 65 28 72 67 2e 53 63 68 65 6d 61 29 2c 63 ore(rg.Schema),c
0001d680: 3d 61 2e 6f 62 6a 65 63 74 53 74 6f 72 65 28 72 =a.objectStore(r
0001d690: 67 2e 53 65 73 73 69 6f 6e 53 74 61 74 65 29 3b g.SessionState);
0001d6a0: 66 6f 72 28 63 6f 6e 73 74 5b 65 2c 74 5d 6f 66 for(const[e,t]of
0001d6b0: 20 4f 62 6a 65 63 74 2e 65 6e 74 72 69 65 73 28 Object.entries(
0001d6c0: 6e 2e 61 64 64 65 64 29 29 61 77 61 69 74 20 73 n.added))await s
0001d6d0: 2e 70 75 74 28 74 2c 65 29 3b 66 6f 72 28 63 6f .put(t,e);for(co
0001d6e0: 6e 73 74 5b 65 2c 74 5d 6f 66 20 4f 62 6a 65 63 nst[e,t]of Objec
0001d6f0: 74 2e 76 61 6c 75 65 73 28 6e 2e 75 70 64 61 74 t.values(n.updat
0001d700: 65 64 29 29 61 77 61 69 74 20 73 2e 70 75 74 28 ed))await s.put(
0001d710: 74 2c 74 2e 69 64 29 3b 66 6f 72 28 63 6f 6e 73 t,t.id);for(cons
0001d720: 74 20 65 20 6f 66 20 4f 62 6a 65 63 74 2e 6b 65 t e of Object.ke
0001d730: 79 73 28 6e 2e 72 65 6d 6f 76 65 64 29 29 61 77 ys(n.removed))aw
0001d740: 61 69 74 20 73 2e 64 65 6c 65 74 65 28 65 29 3b ait s.delete(e);
0001d750: 69 66 28 6c 2e 70 75 74 28 74 2e 73 65 72 69 61 if(l.put(t.seria
0001d760: 6c 69 7a 65 28 29 2c 72 67 2e 53 63 68 65 6d 61 lize(),rg.Schema
0001d770: 29 2c 6f 26 26 72 3f 63 2e 70 75 74 28 7b 73 6e ),o&&r?c.put({sn
0001d780: 61 70 73 68 6f 74 3a 6f 2c 75 70 64 61 74 65 64 apshot:o,updated
0001d790: 41 74 3a 44 61 74 65 2e 6e 6f 77 28 29 2c 69 64 At:Date.now(),id
0001d7a0: 3a 72 7d 2c 72 29 3a 28 6f 7c 7c 72 29 26 26 63 :r},r):(o||r)&&c
0001d7b0: 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 22 73 65 onsole.error("se
0001d7c0: 73 73 69 6f 6e 53 74 61 74 65 53 6e 61 70 73 68 ssionStateSnapsh
0001d7d0: 6f 74 20 61 6e 64 20 69 6e 73 74 61 6e 63 65 49 ot and instanceI
0001d7e0: 64 20 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 d must be provid
0001d7f0: 65 64 20 74 6f 67 65 74 68 65 72 22 29 2c 69 3f ed together"),i?
0001d800: 2e 28 29 29 72 65 74 75 72 6e 20 61 2e 61 62 6f .())return a.abo
0001d810: 72 74 28 29 3b 61 77 61 69 74 20 61 2e 64 6f 6e rt();await a.don
0001d820: 65 7d 29 29 7d 28 7b 70 65 72 73 69 73 74 65 6e e}))}({persisten
0001d830: 63 65 4b 65 79 3a 74 68 69 73 2e 70 65 72 73 69 ceKey:this.persi
0001d840: 73 74 65 6e 63 65 4b 65 79 2c 63 68 61 6e 67 65 stenceKey,change
0001d850: 73 3a 74 2c 73 63 68 65 6d 61 3a 74 68 69 73 2e s:t,schema:this.
0001d860: 73 74 6f 72 65 2e 73 63 68 65 6d 61 2c 64 69 64 store.schema,did
0001d870: 43 61 6e 63 65 6c 3a 28 29 3d 3e 74 68 69 73 2e Cancel:()=>this.
0001d880: 64 69 64 44 69 73 70 6f 73 65 2c 73 65 73 73 69 didDispose,sessi
0001d890: 6f 6e 49 64 3a 74 68 69 73 2e 73 65 73 73 69 6f onId:this.sessio
0001d8a0: 6e 49 64 2c 73 65 73 73 69 6f 6e 53 74 61 74 65 nId,sessionState
0001d8b0: 53 6e 61 70 73 68 6f 74 3a 74 68 69 73 2e 24 73 Snapshot:this.$s
0001d8c0: 65 73 73 69 6f 6e 53 74 61 74 65 53 6e 61 70 73 essionStateSnaps
0001d8d0: 68 6f 74 2e 67 65 74 28 29 7d 29 7d 74 68 69 73 hot.get()})}this
0001d8e0: 2e 64 69 64 4c 61 73 74 57 72 69 74 65 45 72 72 .didLastWriteErr
0001d8f0: 6f 72 3d 21 31 7d 63 61 74 63 68 28 65 29 7b 74 or=!1}catch(e){t
0001d900: 68 69 73 2e 73 68 6f 75 6c 64 44 6f 46 75 6c 6c his.shouldDoFull
0001d910: 44 42 57 72 69 74 65 3d 21 30 2c 74 68 69 73 2e DBWrite=!0,this.
0001d920: 64 69 64 4c 61 73 74 57 72 69 74 65 45 72 72 6f didLastWriteErro
0001d930: 72 3d 21 30 2c 63 6f 6e 73 6f 6c 65 2e 65 72 72 r=!0,console.err
0001d940: 6f 72 28 22 66 61 69 6c 65 64 20 74 6f 20 73 74 or("failed to st
0001d950: 6f 72 65 20 63 68 61 6e 67 65 73 20 69 6e 20 69 ore changes in i
0001d960: 6e 64 65 78 65 64 20 64 62 22 2c 65 29 2c 77 69 ndexed db",e),wi
0001d970: 6e 64 6f 77 2e 61 6c 65 72 74 28 22 4f 6f 70 73 ndow.alert("Oops
0001d980: 21 20 57 65 20 63 6f 75 6c 64 20 6e 6f 74 20 73 ! We could not s
0001d990: 61 76 65 20 63 68 61 6e 67 65 73 20 74 6f 20 79 ave changes to y
0001d9a0: 6f 75 72 20 62 72 6f 77 73 65 72 27 73 20 73 74 our browser's st
0001d9b0: 6f 72 61 67 65 2e 20 57 65 20 6e 6f 77 20 6e 65 orage. We now ne
0001d9c0: 65 64 20 74 6f 20 72 65 6c 6f 61 64 20 74 68 65 ed to reload the
0001d9d0: 20 70 61 67 65 20 61 6e 64 20 74 72 79 20 61 67 page and try ag
0001d9e0: 61 69 6e 2e 5c 6e 5c 6e 4b 65 65 70 20 73 65 65 ain.\n\nKeep see
0001d9f0: 69 6e 67 20 74 68 69 73 20 6d 65 73 73 61 67 65 ing this message
0001da00: 3f 5c 6e e2 80 a2 20 49 66 20 79 6f 75 27 72 65 ?\n... If you're
0001da10: 20 75 73 69 6e 67 20 74 6c 64 72 61 77 20 69 6e using tldraw in
0001da20: 20 61 20 70 72 69 76 61 74 65 20 6f 72 20 5c 22 a private or \"
0001da30: 69 6e 63 6f 67 6e 69 74 6f 5c 22 20 77 69 6e 64 incognito\" wind
0001da40: 6f 77 2c 20 74 72 79 20 6c 6f 61 64 69 6e 67 20 ow, try loading
0001da50: 74 6c 64 72 61 77 20 69 6e 20 61 20 72 65 67 75 tldraw in a regu
0001da60: 6c 61 72 20 77 69 6e 64 6f 77 20 6f 72 20 69 6e lar window or in
0001da70: 20 61 20 64 69 66 66 65 72 65 6e 74 20 62 72 6f a different bro
0001da80: 77 73 65 72 2e 5c 6e e2 80 a2 20 49 66 20 79 6f wser.\n... If yo
0001da90: 75 72 20 68 61 72 64 20 64 69 73 6b 20 69 73 20 ur hard disk is
0001daa0: 66 75 6c 6c 2c 20 74 72 79 20 63 6c 65 61 72 69 full, try cleari
0001dab0: 6e 67 20 75 70 20 73 6f 6d 65 20 73 70 61 63 65 ng up some space
0001dac0: 20 61 6e 64 20 74 68 65 6e 20 72 65 6c 6f 61 64 and then reload
0001dad0: 20 74 68 65 20 70 61 67 65 2e 22 29 2c 22 75 6e the page."),"un
0001dae0: 64 65 66 69 6e 65 64 22 21 3d 74 79 70 65 6f 66 defined"!=typeof
0001daf0: 20 77 69 6e 64 6f 77 26 26 77 69 6e 64 6f 77 2e window&&window.
0001db00: 6c 6f 63 61 74 69 6f 6e 2e 72 65 6c 6f 61 64 28 location.reload(
0001db10: 29 7d 74 68 69 73 2e 69 73 50 65 72 73 69 73 74 )}this.isPersist
0001db20: 69 6e 67 3d 21 31 2c 74 68 69 73 2e 64 65 62 75 ing=!1,this.debu
0001db30: 67 28 22 64 6f 50 65 72 73 69 73 74 20 65 6e 64 g("doPersist end
0001db40: 22 29 2c 74 68 69 73 2e 73 63 68 65 64 75 6c 65 "),this.schedule
0001db50: 50 65 72 73 69 73 74 28 29 7d 7d 66 75 6e 63 74 Persist()}}funct
0001db60: 69 6f 6e 20 75 67 28 65 29 7b 72 65 74 75 72 6e ion ug(e){return
0001db70: 20 4f 62 6a 65 63 74 2e 66 72 6f 6d 45 6e 74 72 Object.fromEntr
0001db80: 69 65 73 28 65 2e 6d 61 70 28 28 65 3d 3e 5b 65 ies(e.map((e=>[e
0001db90: 2e 74 79 70 65 2c 7b 70 72 6f 70 73 3a 65 2e 70 .type,{props:e.p
0001dba0: 72 6f 70 73 2c 6d 69 67 72 61 74 69 6f 6e 73 3a rops,migrations:
0001dbb0: 65 2e 6d 69 67 72 61 74 69 6f 6e 73 7d 5d 29 29 e.migrations}]))
0001dbc0: 29 7d 66 75 6e 63 74 69 6f 6e 20 64 67 28 65 29 )}function dg(e)
0001dbd0: 7b 63 6f 6e 73 74 20 74 3d 66 75 6e 63 74 69 6f {const t=functio
0001dbe0: 6e 28 7b 69 6e 69 74 69 61 6c 44 61 74 61 3a 65 n({initialData:e
0001dbf0: 2c 64 65 66 61 75 6c 74 4e 61 6d 65 3a 74 3d 22 ,defaultName:t="
0001dc00: 22 2c 69 64 3a 6e 2c 2e 2e 2e 72 7d 3d 7b 7d 29 ",id:n,...r}={})
0001dc10: 7b 63 6f 6e 73 74 20 6f 3d 22 73 63 68 65 6d 61 {const o="schema
0001dc20: 22 69 6e 20 72 26 26 72 2e 73 63 68 65 6d 61 3f "in r&&r.schema?
0001dc30: 72 2e 73 63 68 65 6d 61 3a 4b 63 28 7b 73 68 61 r.schema:Kc({sha
0001dc40: 70 65 73 3a 22 73 68 61 70 65 55 74 69 6c 73 22 pes:"shapeUtils"
0001dc50: 69 6e 20 72 26 26 72 2e 73 68 61 70 65 55 74 69 in r&&r.shapeUti
0001dc60: 6c 73 3f 75 67 28 44 68 28 72 2e 73 68 61 70 65 ls?ug(Dh(r.shape
0001dc70: 55 74 69 6c 73 29 29 3a 76 6f 69 64 20 30 2c 62 Utils)):void 0,b
0001dc80: 69 6e 64 69 6e 67 73 3a 22 62 69 6e 64 69 6e 67 indings:"binding
0001dc90: 55 74 69 6c 73 22 69 6e 20 72 26 26 72 2e 62 69 Utils"in r&&r.bi
0001dca0: 6e 64 69 6e 67 55 74 69 6c 73 3f 75 67 28 66 68 ndingUtils?ug(fh
0001dcb0: 28 72 2e 62 69 6e 64 69 6e 67 55 74 69 6c 73 29 (r.bindingUtils)
0001dcc0: 29 3a 76 6f 69 64 20 30 2c 6d 69 67 72 61 74 69 ):void 0,migrati
0001dcd0: 6f 6e 73 3a 22 6d 69 67 72 61 74 69 6f 6e 73 22 ons:"migrations"
0001dce0: 69 6e 20 72 3f 72 2e 6d 69 67 72 61 74 69 6f 6e in r?r.migration
0001dcf0: 73 3a 76 6f 69 64 20 30 7d 29 3b 72 65 74 75 72 s:void 0});retur
0001dd00: 6e 20 6e 65 77 20 79 61 28 7b 69 64 3a 6e 2c 73 n new ya({id:n,s
0001dd10: 63 68 65 6d 61 3a 6f 2c 69 6e 69 74 69 61 6c 44 chema:o,initialD
0001dd20: 61 74 61 3a 65 2c 70 72 6f 70 73 3a 7b 64 65 66 ata:e,props:{def
0001dd30: 61 75 6c 74 4e 61 6d 65 3a 74 7d 7d 29 7d 28 65 aultName:t}})}(e
0001dd40: 29 3b 72 65 74 75 72 6e 20 65 2e 73 6e 61 70 73 );return e.snaps
0001dd50: 68 6f 74 26 26 64 68 28 74 2c 65 2e 73 6e 61 70 hot&&dh(t,e.snap
0001dd60: 73 68 6f 74 29 2c 7b 73 74 6f 72 65 3a 74 2c 6f shot),{store:t,o
0001dd70: 70 74 73 3a 65 7d 7d 66 75 6e 63 74 69 6f 6e 20 pts:e}}function
0001dd80: 70 67 28 65 29 7b 63 6f 6e 73 74 5b 74 2c 6e 5d pg(e){const[t,n]
0001dd90: 3d 28 30 2c 6f 2e 75 73 65 53 74 61 74 65 29 28 =(0,o.useState)(
0001dda0: 28 28 29 3d 3e 64 67 28 65 29 29 29 3b 69 66 28 (()=>dg(e)));if(
0001ddb0: 21 54 6f 28 74 2e 6f 70 74 73 2c 65 29 29 7b 63 !To(t.opts,e)){c
0001ddc0: 6f 6e 73 74 20 74 3d 64 67 28 65 29 3b 72 65 74 onst t=dg(e);ret
0001ddd0: 75 72 6e 20 6e 28 74 29 2c 74 2e 73 74 6f 72 65 urn n(t),t.store
0001dde0: 7d 72 65 74 75 72 6e 20 74 2e 73 74 6f 72 65 7d }return t.store}
0001ddf0: 63 6f 6e 73 74 20 66 67 3d 5b 5d 2c 68 67 3d 5b const fg=[],hg=[
0001de00: 5d 2c 6d 67 3d 5b 5d 2c 67 67 3d 28 30 2c 6f 2e ],mg=[],gg=(0,o.
0001de10: 6d 65 6d 6f 29 28 28 66 75 6e 63 74 69 6f 6e 28 memo)((function(
0001de20: 7b 73 74 6f 72 65 3a 65 2c 63 6f 6d 70 6f 6e 65 {store:e,compone
0001de30: 6e 74 73 3a 74 2c 63 6c 61 73 73 4e 61 6d 65 3a nts:t,className:
0001de40: 6e 2c 75 73 65 72 3a 72 2c 2e 2e 2e 69 7d 29 7b n,user:r,...i}){
0001de50: 63 6f 6e 73 74 5b 61 2c 73 5d 3d 6f 2e 75 73 65 const[a,s]=o.use
0001de60: 53 74 61 74 65 28 6e 75 6c 6c 29 2c 6c 3d 28 30 State(null),l=(0
0001de70: 2c 6f 2e 75 73 65 4d 65 6d 6f 29 28 28 28 29 3d ,o.useMemo)((()=
0001de80: 3e 72 3f 3f 65 68 28 29 29 2c 5b 72 5d 29 2c 63 >r??eh()),[r]),c
0001de90: 3d 76 6f 69 64 20 30 3d 3d 3d 74 3f 2e 45 72 72 =void 0===t?.Err
0001dea0: 6f 72 46 61 6c 6c 62 61 63 6b 3f 4c 66 3a 74 3f orFallback?Lf:t?
0001deb0: 2e 45 72 72 6f 72 46 61 6c 6c 62 61 63 6b 2c 75 .ErrorFallback,u
0001dec0: 3d 7b 2e 2e 2e 69 2c 73 68 61 70 65 55 74 69 6c ={...i,shapeUtil
0001ded0: 73 3a 69 2e 73 68 61 70 65 55 74 69 6c 73 3f 3f s:i.shapeUtils??
0001dee0: 66 67 2c 62 69 6e 64 69 6e 67 55 74 69 6c 73 3a fg,bindingUtils:
0001def0: 69 2e 62 69 6e 64 69 6e 67 55 74 69 6c 73 3f 3f i.bindingUtils??
0001df00: 68 67 2c 74 6f 6f 6c 73 3a 69 2e 74 6f 6f 6c 73 hg,tools:i.tools
0001df10: 3f 3f 6d 67 2c 63 6f 6d 70 6f 6e 65 6e 74 73 3a ??mg,components:
0001df20: 74 7d 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a t};return(0,Qc.j
0001df30: 73 78 29 28 22 64 69 76 22 2c 7b 72 65 66 3a 73 sx)("div",{ref:s
0001df40: 2c 64 72 61 67 67 61 62 6c 65 3a 21 31 2c 63 6c ,draggable:!1,cl
0001df50: 61 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 63 assName:Jc("tl-c
0001df60: 6f 6e 74 61 69 6e 65 72 20 74 6c 2d 74 68 65 6d ontainer tl-them
0001df70: 65 5f 5f 6c 69 67 68 74 22 2c 6e 29 2c 6f 6e 50 e__light",n),onP
0001df80: 6f 69 6e 74 65 72 44 6f 77 6e 3a 6e 64 2c 74 61 ointerDown:nd,ta
0001df90: 62 49 6e 64 65 78 3a 2d 31 2c 63 68 69 6c 64 72 bIndex:-1,childr
0001dfa0: 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 29 28 74 75 en:(0,Qc.jsx)(tu
0001dfb0: 2c 7b 66 61 6c 6c 62 61 63 6b 3a 63 2c 6f 6e 45 ,{fallback:c,onE
0001dfc0: 72 72 6f 72 3a 65 3d 3e 5a 72 28 65 2c 7b 74 61 rror:e=>Zr(e,{ta
0001dfd0: 67 73 3a 7b 6f 72 69 67 69 6e 3a 22 72 65 61 63 gs:{origin:"reac
0001dfe0: 74 2e 74 6c 64 72 61 77 2d 62 65 66 6f 72 65 2d t.tldraw-before-
0001dff0: 61 70 70 22 7d 7d 29 2c 63 68 69 6c 64 72 65 6e app"}}),children
0001e000: 3a 61 26 26 28 30 2c 51 63 2e 6a 73 78 29 28 61 :a&&(0,Qc.jsx)(a
0001e010: 64 2c 7b 63 6f 6e 74 61 69 6e 65 72 3a 61 2c 63 d,{container:a,c
0001e020: 68 69 6c 64 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 hildren:(0,Qc.js
0001e030: 78 29 28 4e 66 2c 7b 6f 76 65 72 72 69 64 65 73 x)(Nf,{overrides
0001e040: 3a 74 2c 63 68 69 6c 64 72 65 6e 3a 65 3f 65 20 :t,children:e?e
0001e050: 69 6e 73 74 61 6e 63 65 6f 66 20 79 61 3f 28 30 instanceof ya?(0
0001e060: 2c 51 63 2e 6a 73 78 29 28 76 67 2c 7b 2e 2e 2e ,Qc.jsx)(vg,{...
0001e070: 75 2c 73 74 6f 72 65 3a 65 2c 75 73 65 72 3a 6c u,store:e,user:l
0001e080: 7d 29 3a 28 30 2c 51 63 2e 6a 73 78 29 28 79 67 }):(0,Qc.jsx)(yg
0001e090: 2c 7b 2e 2e 2e 75 2c 73 74 6f 72 65 3a 65 2c 75 ,{...u,store:e,u
0001e0a0: 73 65 72 3a 6c 7d 29 3a 28 30 2c 51 63 2e 6a 73 ser:l}):(0,Qc.js
0001e0b0: 78 29 28 62 67 2c 7b 2e 2e 2e 75 2c 73 74 6f 72 x)(bg,{...u,stor
0001e0c0: 65 3a 65 2c 75 73 65 72 3a 6c 7d 29 7d 29 7d 29 e:e,user:l})})})
0001e0d0: 7d 29 7d 29 7d 29 29 3b 66 75 6e 63 74 69 6f 6e })})}));function
0001e0e0: 20 62 67 28 65 29 7b 63 6f 6e 73 74 7b 64 65 66 bg(e){const{def
0001e0f0: 61 75 6c 74 4e 61 6d 65 3a 74 2c 73 6e 61 70 73 aultName:t,snaps
0001e100: 68 6f 74 3a 6e 2c 69 6e 69 74 69 61 6c 44 61 74 hot:n,initialDat
0001e110: 61 3a 72 2c 73 68 61 70 65 55 74 69 6c 73 3a 69 a:r,shapeUtils:i
0001e120: 2c 62 69 6e 64 69 6e 67 55 74 69 6c 73 3a 61 2c ,bindingUtils:a,
0001e130: 70 65 72 73 69 73 74 65 6e 63 65 4b 65 79 3a 73 persistenceKey:s
0001e140: 2c 73 65 73 73 69 6f 6e 49 64 3a 6c 2c 75 73 65 ,sessionId:l,use
0001e150: 72 3a 63 7d 3d 65 2c 75 3d 66 75 6e 63 74 69 6f r:c}=e,u=functio
0001e160: 6e 28 7b 70 65 72 73 69 73 74 65 6e 63 65 4b 65 n({persistenceKe
0001e170: 79 3a 65 2c 73 65 73 73 69 6f 6e 49 64 3a 74 2c y:e,sessionId:t,
0001e180: 2e 2e 2e 6e 7d 29 7b 63 6f 6e 73 74 5b 72 2c 69 ...n}){const[r,i
0001e190: 5d 3d 28 30 2c 6f 2e 75 73 65 53 74 61 74 65 29 ]=(0,o.useState)
0001e1a0: 28 6e 75 6c 6c 29 2c 61 3d 70 67 28 6e 29 3b 72 (null),a=pg(n);r
0001e1b0: 65 74 75 72 6e 28 30 2c 6f 2e 75 73 65 45 66 66 eturn(0,o.useEff
0001e1c0: 65 63 74 29 28 28 28 29 3d 3e 7b 63 6f 6e 73 74 ect)((()=>{const
0001e1d0: 20 6e 3d 46 66 28 29 3b 69 66 28 21 65 29 72 65 n=Ff();if(!e)re
0001e1e0: 74 75 72 6e 20 76 6f 69 64 20 69 28 7b 69 64 3a turn void i({id:
0001e1f0: 6e 2c 73 74 6f 72 65 57 69 74 68 53 74 61 74 75 n,storeWithStatu
0001e200: 73 3a 7b 73 74 61 74 75 73 3a 22 6e 6f 74 2d 73 s:{status:"not-s
0001e210: 79 6e 63 65 64 22 2c 73 74 6f 72 65 3a 61 7d 7d ynced",store:a}}
0001e220: 29 3b 69 28 7b 69 64 3a 6e 2c 73 74 6f 72 65 57 );i({id:n,storeW
0001e230: 69 74 68 53 74 61 74 75 73 3a 7b 73 74 61 74 75 ithStatus:{statu
0001e240: 73 3a 22 6c 6f 61 64 69 6e 67 22 7d 7d 29 3b 63 s:"loading"}});c
0001e250: 6f 6e 73 74 20 72 3d 65 3d 3e 7b 69 28 28 74 3d onst r=e=>{i((t=
0001e260: 3e 74 3f 2e 69 64 3d 3d 3d 6e 3f 7b 69 64 3a 6e >t?.id===n?{id:n
0001e270: 2c 73 74 6f 72 65 57 69 74 68 53 74 61 74 75 73 ,storeWithStatus
0001e280: 3a 65 7d 3a 74 29 29 7d 2c 6f 3d 6e 65 77 20 63 :e}:t))},o=new c
0001e290: 67 28 61 2c 7b 73 65 73 73 69 6f 6e 49 64 3a 74 g(a,{sessionId:t
0001e2a0: 2c 70 65 72 73 69 73 74 65 6e 63 65 4b 65 79 3a ,persistenceKey:
0001e2b0: 65 2c 6f 6e 4c 6f 61 64 28 29 7b 72 28 7b 73 74 e,onLoad(){r({st
0001e2c0: 6f 72 65 3a 61 2c 73 74 61 74 75 73 3a 22 73 79 ore:a,status:"sy
0001e2d0: 6e 63 65 64 2d 6c 6f 63 61 6c 22 7d 29 7d 2c 6f nced-local"})},o
0001e2e0: 6e 4c 6f 61 64 45 72 72 6f 72 28 65 29 7b 72 28 nLoadError(e){r(
0001e2f0: 7b 73 74 61 74 75 73 3a 22 65 72 72 6f 72 22 2c {status:"error",
0001e300: 65 72 72 6f 72 3a 65 7d 29 7d 7d 29 3b 72 65 74 error:e})}});ret
0001e310: 75 72 6e 28 29 3d 3e 7b 69 28 28 65 3d 3e 65 3f urn()=>{i((e=>e?
0001e320: 2e 69 64 3d 3d 3d 6e 3f 6e 75 6c 6c 3a 65 29 29 .id===n?null:e))
0001e330: 2c 6f 2e 63 6c 6f 73 65 28 29 7d 7d 29 2c 5b 65 ,o.close()}}),[e
0001e340: 2c 61 2c 74 5d 29 2c 72 3f 2e 73 74 6f 72 65 57 ,a,t]),r?.storeW
0001e350: 69 74 68 53 74 61 74 75 73 3f 3f 7b 73 74 61 74 ithStatus??{stat
0001e360: 75 73 3a 22 6c 6f 61 64 69 6e 67 22 7d 7d 28 7b us:"loading"}}({
0001e370: 73 68 61 70 65 55 74 69 6c 73 3a 69 2c 62 69 6e shapeUtils:i,bin
0001e380: 64 69 6e 67 55 74 69 6c 73 3a 61 2c 69 6e 69 74 dingUtils:a,init
0001e390: 69 61 6c 44 61 74 61 3a 72 2c 70 65 72 73 69 73 ialData:r,persis
0001e3a0: 74 65 6e 63 65 4b 65 79 3a 73 2c 73 65 73 73 69 tenceKey:s,sessi
0001e3b0: 6f 6e 49 64 3a 6c 2c 64 65 66 61 75 6c 74 4e 61 onId:l,defaultNa
0001e3c0: 6d 65 3a 74 2c 73 6e 61 70 73 68 6f 74 3a 6e 7d me:t,snapshot:n}
0001e3d0: 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 );return(0,Qc.js
0001e3e0: 78 29 28 79 67 2c 7b 2e 2e 2e 65 2c 73 74 6f 72 x)(yg,{...e,stor
0001e3f0: 65 3a 75 2c 75 73 65 72 3a 63 7d 29 7d 63 6f 6e e:u,user:c})}con
0001e400: 73 74 20 79 67 3d 28 30 2c 6f 2e 6d 65 6d 6f 29 st yg=(0,o.memo)
0001e410: 28 28 66 75 6e 63 74 69 6f 6e 28 7b 73 74 6f 72 ((function({stor
0001e420: 65 3a 65 2c 75 73 65 72 3a 74 2c 2e 2e 2e 6e 7d e:e,user:t,...n}
0001e430: 29 7b 63 6f 6e 73 74 20 72 3d 73 64 28 29 3b 28 ){const r=sd();(
0001e440: 30 2c 6f 2e 75 73 65 4c 61 79 6f 75 74 45 66 66 0,o.useLayoutEff
0001e450: 65 63 74 29 28 28 28 29 3d 3e 7b 22 64 61 72 6b ect)((()=>{"dark
0001e460: 22 3d 3d 3d 74 2e 75 73 65 72 50 72 65 66 65 72 "===t.userPrefer
0001e470: 65 6e 63 65 73 2e 67 65 74 28 29 2e 63 6f 6c 6f ences.get().colo
0001e480: 72 53 63 68 65 6d 65 26 26 28 72 2e 63 6c 61 73 rScheme&&(r.clas
0001e490: 73 4c 69 73 74 2e 72 65 6d 6f 76 65 28 22 74 6c sList.remove("tl
0001e4a0: 2d 74 68 65 6d 65 5f 5f 6c 69 67 68 74 22 29 2c -theme__light"),
0001e4b0: 72 2e 63 6c 61 73 73 4c 69 73 74 2e 61 64 64 28 r.classList.add(
0001e4c0: 22 74 6c 2d 74 68 65 6d 65 5f 5f 64 61 72 6b 22 "tl-theme__dark"
0001e4d0: 29 29 7d 29 2c 5b 72 2c 74 5d 29 3b 63 6f 6e 73 ))}),[r,t]);cons
0001e4e0: 74 7b 4c 6f 61 64 69 6e 67 53 63 72 65 65 6e 3a t{LoadingScreen:
0001e4f0: 69 7d 3d 50 66 28 29 3b 73 77 69 74 63 68 28 65 i}=Pf();switch(e
0001e500: 2e 73 74 61 74 75 73 29 7b 63 61 73 65 22 65 72 .status){case"er
0001e510: 72 6f 72 22 3a 74 68 72 6f 77 20 65 2e 65 72 72 ror":throw e.err
0001e520: 6f 72 3b 63 61 73 65 22 6c 6f 61 64 69 6e 67 22 or;case"loading"
0001e530: 3a 72 65 74 75 72 6e 20 69 3f 28 30 2c 51 63 2e :return i?(0,Qc.
0001e540: 6a 73 78 29 28 69 2c 7b 7d 29 3a 6e 75 6c 6c 7d jsx)(i,{}):null}
0001e550: 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 return(0,Qc.jsx)
0001e560: 28 76 67 2c 7b 2e 2e 2e 6e 2c 73 74 6f 72 65 3a (vg,{...n,store:
0001e570: 65 2e 73 74 6f 72 65 2c 75 73 65 72 3a 74 7d 29 e.store,user:t})
0001e580: 7d 29 29 3b 66 75 6e 63 74 69 6f 6e 20 76 67 28 }));function vg(
0001e590: 7b 6f 6e 4d 6f 75 6e 74 3a 65 2c 63 68 69 6c 64 {onMount:e,child
0001e5a0: 72 65 6e 3a 74 2c 73 74 6f 72 65 3a 6e 2c 74 6f ren:t,store:n,to
0001e5b0: 6f 6c 73 3a 72 2c 73 68 61 70 65 55 74 69 6c 73 ols:r,shapeUtils
0001e5c0: 3a 69 2c 62 69 6e 64 69 6e 67 55 74 69 6c 73 3a :i,bindingUtils:
0001e5d0: 61 2c 75 73 65 72 3a 73 2c 69 6e 69 74 69 61 6c a,user:s,initial
0001e5e0: 53 74 61 74 65 3a 6c 2c 61 75 74 6f 46 6f 63 75 State:l,autoFocu
0001e5f0: 73 3a 63 3d 21 30 2c 69 6e 66 65 72 44 61 72 6b s:c=!0,inferDark
0001e600: 4d 6f 64 65 3a 75 2c 63 61 6d 65 72 61 4f 70 74 Mode:u,cameraOpt
0001e610: 69 6f 6e 73 3a 64 2c 61 73 73 65 74 4f 70 74 69 ions:d,assetOpti
0001e620: 6f 6e 73 3a 70 2c 6f 70 74 69 6f 6e 73 3a 66 7d ons:p,options:f}
0001e630: 29 7b 63 6f 6e 73 74 7b 45 72 72 6f 72 46 61 6c ){const{ErrorFal
0001e640: 6c 62 61 63 6b 3a 68 7d 3d 50 66 28 29 2c 6d 3d lback:h}=Pf(),m=
0001e650: 73 64 28 29 2c 67 3d 28 30 2c 6f 2e 75 73 65 52 sd(),g=(0,o.useR
0001e660: 65 66 29 28 6e 75 6c 6c 29 2c 5b 62 2c 79 5d 3d ef)(null),[b,y]=
0001e670: 28 30 2c 6f 2e 75 73 65 53 74 61 74 65 29 28 6e (0,o.useState)(n
0001e680: 75 6c 6c 29 2c 76 3d 67 2e 63 75 72 72 65 6e 74 ull),v=g.current
0001e690: 3b 62 21 3d 3d 76 26 26 79 28 76 29 3b 63 6f 6e ;b!==v&&y(v);con
0001e6a0: 73 74 5b 53 5d 3d 28 30 2c 6f 2e 75 73 65 53 74 st[S]=(0,o.useSt
0001e6b0: 61 74 65 29 28 63 29 3b 28 30 2c 6f 2e 75 73 65 ate)(c);(0,o.use
0001e6c0: 4c 61 79 6f 75 74 45 66 66 65 63 74 29 28 28 28 LayoutEffect)(((
0001e6d0: 29 3d 3e 7b 63 6f 6e 73 74 20 65 3d 6e 65 77 20 )=>{const e=new
0001e6e0: 42 6d 28 7b 73 74 6f 72 65 3a 6e 2c 73 68 61 70 Bm({store:n,shap
0001e6f0: 65 55 74 69 6c 73 3a 69 2c 62 69 6e 64 69 6e 67 eUtils:i,binding
0001e700: 55 74 69 6c 73 3a 61 2c 74 6f 6f 6c 73 3a 72 2c Utils:a,tools:r,
0001e710: 67 65 74 43 6f 6e 74 61 69 6e 65 72 3a 28 29 3d getContainer:()=
0001e720: 3e 6d 2c 75 73 65 72 3a 73 2c 69 6e 69 74 69 61 >m,user:s,initia
0001e730: 6c 53 74 61 74 65 3a 6c 2c 61 75 74 6f 46 6f 63 lState:l,autoFoc
0001e740: 75 73 3a 53 2c 69 6e 66 65 72 44 61 72 6b 4d 6f us:S,inferDarkMo
0001e750: 64 65 3a 75 2c 63 61 6d 65 72 61 4f 70 74 69 6f de:u,cameraOptio
0001e760: 6e 73 3a 64 2c 61 73 73 65 74 4f 70 74 69 6f 6e ns:d,assetOption
0001e770: 73 3a 70 2c 6f 70 74 69 6f 6e 73 3a 66 7d 29 3b s:p,options:f});
0001e780: 72 65 74 75 72 6e 20 67 2e 63 75 72 72 65 6e 74 return g.current
0001e790: 3d 65 2c 79 28 65 29 2c 28 29 3d 3e 7b 65 2e 64 =e,y(e),()=>{e.d
0001e7a0: 69 73 70 6f 73 65 28 29 7d 7d 29 2c 5b 6d 2c 69 ispose()}}),[m,i
0001e7b0: 2c 61 2c 72 2c 6e 2c 73 2c 6c 2c 53 2c 75 2c 64 ,a,r,n,s,l,S,u,d
0001e7c0: 2c 70 2c 66 5d 29 3b 63 6f 6e 73 74 20 5f 3d 28 ,p,f]);const _=(
0001e7d0: 30 2c 6f 2e 75 73 65 53 79 6e 63 45 78 74 65 72 0,o.useSyncExter
0001e7e0: 6e 61 6c 53 74 6f 72 65 29 28 28 30 2c 6f 2e 75 nalStore)((0,o.u
0001e7f0: 73 65 43 61 6c 6c 62 61 63 6b 29 28 28 65 3d 3e seCallback)((e=>
0001e800: 76 3f 28 76 2e 6f 6e 28 22 63 72 61 73 68 22 2c v?(v.on("crash",
0001e810: 65 29 2c 28 29 3d 3e 76 2e 6f 66 66 28 22 63 72 e),()=>v.off("cr
0001e820: 61 73 68 22 2c 65 29 29 3a 28 29 3d 3e 7b 7d 29 ash",e)):()=>{})
0001e830: 2c 5b 76 5d 29 2c 28 28 29 3d 3e 76 3f 2e 67 65 ,[v]),(()=>v?.ge
0001e840: 74 43 72 61 73 68 69 6e 67 45 72 72 6f 72 28 29 tCrashingError()
0001e850: 3f 3f 6e 75 6c 6c 29 29 2c 7b 43 61 6e 76 61 73 ??null)),{Canvas
0001e860: 3a 45 7d 3d 50 66 28 29 3b 72 65 74 75 72 6e 20 :E}=Pf();return
0001e870: 76 3f 28 30 2c 51 63 2e 6a 73 78 29 28 74 75 2c v?(0,Qc.jsx)(tu,
0001e880: 7b 66 61 6c 6c 62 61 63 6b 3a 68 2c 6f 6e 45 72 {fallback:h,onEr
0001e890: 72 6f 72 3a 65 3d 3e 76 2e 61 6e 6e 6f 74 61 74 ror:e=>v.annotat
0001e8a0: 65 45 72 72 6f 72 28 65 2c 7b 6f 72 69 67 69 6e eError(e,{origin
0001e8b0: 3a 22 72 65 61 63 74 2e 74 6c 64 72 61 77 22 2c :"react.tldraw",
0001e8c0: 77 69 6c 6c 43 72 61 73 68 41 70 70 3a 21 30 7d willCrashApp:!0}
0001e8d0: 29 2c 63 68 69 6c 64 72 65 6e 3a 5f 3f 28 30 2c ),children:_?(0,
0001e8e0: 51 63 2e 6a 73 78 29 28 5f 67 2c 7b 63 72 61 73 Qc.jsx)(_g,{cras
0001e8f0: 68 69 6e 67 45 72 72 6f 72 3a 5f 7d 29 3a 28 30 hingError:_}):(0
0001e900: 2c 51 63 2e 6a 73 78 29 28 6e 75 2e 50 72 6f 76 ,Qc.jsx)(nu.Prov
0001e910: 69 64 65 72 2c 7b 76 61 6c 75 65 3a 76 2c 63 68 ider,{value:v,ch
0001e920: 69 6c 64 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 ildren:(0,Qc.jsx
0001e930: 29 28 53 67 2c 7b 6f 6e 4d 6f 75 6e 74 3a 65 2c )(Sg,{onMount:e,
0001e940: 63 68 69 6c 64 72 65 6e 3a 74 3f 3f 28 45 3f 28 children:t??(E?(
0001e950: 30 2c 51 63 2e 6a 73 78 29 28 45 2c 7b 7d 29 3a 0,Qc.jsx)(E,{}):
0001e960: 6e 75 6c 6c 29 7d 29 7d 29 7d 29 3a 6e 75 6c 6c null)})})}):null
0001e970: 7d 66 75 6e 63 74 69 6f 6e 20 53 67 28 7b 63 68 }function Sg({ch
0001e980: 69 6c 64 72 65 6e 3a 65 2c 6f 6e 4d 6f 75 6e 74 ildren:e,onMount
0001e990: 3a 74 7d 29 7b 72 65 74 75 72 6e 20 66 75 6e 63 :t}){return func
0001e9a0: 74 69 6f 6e 28 29 7b 63 6f 6e 73 74 20 65 3d 72 tion(){const e=r
0001e9b0: 75 28 29 2c 74 3d 73 64 28 29 3b 6f 2e 75 73 65 u(),t=sd();o.use
0001e9c0: 45 66 66 65 63 74 28 28 28 29 3d 3e 7b 63 6f 6e Effect((()=>{con
0001e9d0: 73 74 20 6e 3d 65 3d 3e 74 2e 73 74 79 6c 65 2e st n=e=>t.style.
0001e9e0: 73 65 74 50 72 6f 70 65 72 74 79 28 22 2d 2d 74 setProperty("--t
0001e9f0: 6c 2d 7a 6f 6f 6d 22 2c 65 2e 74 6f 53 74 72 69 l-zoom",e.toStri
0001ea00: 6e 67 28 29 29 2c 72 3d 59 72 28 6e 2c 31 30 30 ng()),r=Yr(n,100
0001ea10: 29 2c 6f 3d 6e 65 77 20 6a 69 28 22 75 73 65 5a ),o=new ji("useZ
0001ea20: 6f 6f 6d 43 73 73 22 2c 28 28 29 3d 3e 7b 65 2e oomCss",(()=>{e.
0001ea30: 67 65 74 43 75 72 72 65 6e 74 50 61 67 65 53 68 getCurrentPageSh
0001ea40: 61 70 65 49 64 73 28 29 2e 73 69 7a 65 3c 33 30 apeIds().size<30
0001ea50: 30 3f 6e 28 65 2e 67 65 74 5a 6f 6f 6d 4c 65 76 0?n(e.getZoomLev
0001ea60: 65 6c 28 29 29 3a 72 28 65 2e 67 65 74 5a 6f 6f el()):r(e.getZoo
0001ea70: 6d 4c 65 76 65 6c 28 29 29 7d 29 29 3b 72 65 74 mLevel())}));ret
0001ea80: 75 72 6e 20 6f 2e 61 74 74 61 63 68 28 29 2c 6f urn o.attach(),o
0001ea90: 2e 65 78 65 63 75 74 65 28 29 2c 28 29 3d 3e 7b .execute(),()=>{
0001eaa0: 6f 2e 64 65 74 61 63 68 28 29 2c 72 2e 63 61 6e o.detach(),r.can
0001eab0: 63 65 6c 28 29 7d 7d 29 2c 5b 65 2c 74 5d 29 7d cel()}}),[e,t])}
0001eac0: 28 29 2c 66 75 6e 63 74 69 6f 6e 28 29 7b 63 6f (),function(){co
0001ead0: 6e 73 74 20 65 3d 72 75 28 29 2c 74 3d 73 64 28 nst e=ru(),t=sd(
0001eae0: 29 2c 6e 3d 71 6d 28 29 3b 75 61 28 22 75 73 65 ),n=qm();ua("use
0001eaf0: 43 75 72 73 6f 72 22 2c 28 28 29 3d 3e 7b 63 6f Cursor",(()=>{co
0001eb00: 6e 73 74 7b 74 79 70 65 3a 72 2c 72 6f 74 61 74 nst{type:r,rotat
0001eb10: 69 6f 6e 3a 6f 7d 3d 65 2e 67 65 74 49 6e 73 74 ion:o}=e.getInst
0001eb20: 61 6e 63 65 53 74 61 74 65 28 29 2e 63 75 72 73 anceState().curs
0001eb30: 6f 72 3b 5a 6d 2e 69 6e 63 6c 75 64 65 73 28 72 or;Zm.includes(r
0001eb40: 29 3f 74 2e 73 74 79 6c 65 2e 73 65 74 50 72 6f )?t.style.setPro
0001eb50: 70 65 72 74 79 28 22 2d 2d 74 6c 2d 63 75 72 73 perty("--tl-curs
0001eb60: 6f 72 22 2c 60 76 61 72 28 2d 2d 74 6c 2d 63 75 or",`var(--tl-cu
0001eb70: 72 73 6f 72 2d 24 7b 72 7d 29 60 29 3a 74 2e 73 rsor-${r})`):t.s
0001eb80: 74 79 6c 65 2e 73 65 74 50 72 6f 70 65 72 74 79 tyle.setProperty
0001eb90: 28 22 2d 2d 74 6c 2d 63 75 72 73 6f 72 22 2c 4a ("--tl-cursor",J
0001eba0: 6d 28 72 2c 6f 2c 6e 3f 22 77 68 69 74 65 22 3a m(r,o,n?"white":
0001ebb0: 22 62 6c 61 63 6b 22 29 29 7d 29 2c 5b 65 2c 74 "black"))}),[e,t
0001ebc0: 2c 6e 5d 29 7d 28 29 2c 66 75 6e 63 74 69 6f 6e ,n])}(),function
0001ebd0: 28 29 7b 63 6f 6e 73 74 20 65 3d 72 75 28 29 2c (){const e=ru(),
0001ebe0: 74 3d 73 64 28 29 2c 6e 3d 71 6d 28 29 2c 72 3d t=sd(),n=qm(),r=
0001ebf0: 64 61 28 58 75 2e 66 6f 72 63 65 53 72 67 62 29 da(Xu.forceSrgb)
0001ec00: 3b 6f 2e 75 73 65 45 66 66 65 63 74 28 28 28 29 ;o.useEffect((()
0001ec10: 3d 3e 7b 6e 3f 28 74 2e 73 65 74 41 74 74 72 69 =>{n?(t.setAttri
0001ec20: 62 75 74 65 28 22 64 61 74 61 2d 63 6f 6c 6f 72 bute("data-color
0001ec30: 2d 6d 6f 64 65 22 2c 22 64 61 72 6b 22 29 2c 74 -mode","dark"),t
0001ec40: 2e 63 6c 61 73 73 4c 69 73 74 2e 72 65 6d 6f 76 .classList.remov
0001ec50: 65 28 22 74 6c 2d 74 68 65 6d 65 5f 5f 6c 69 67 e("tl-theme__lig
0001ec60: 68 74 22 29 2c 74 2e 63 6c 61 73 73 4c 69 73 74 ht"),t.classList
0001ec70: 2e 61 64 64 28 22 74 6c 2d 74 68 65 6d 65 5f 5f .add("tl-theme__
0001ec80: 64 61 72 6b 22 29 29 3a 28 74 2e 73 65 74 41 74 dark")):(t.setAt
0001ec90: 74 72 69 62 75 74 65 28 22 64 61 74 61 2d 63 6f tribute("data-co
0001eca0: 6c 6f 72 2d 6d 6f 64 65 22 2c 22 6c 69 67 68 74 lor-mode","light
0001ecb0: 22 29 2c 74 2e 63 6c 61 73 73 4c 69 73 74 2e 72 "),t.classList.r
0001ecc0: 65 6d 6f 76 65 28 22 74 6c 2d 74 68 65 6d 65 5f emove("tl-theme_
0001ecd0: 5f 64 61 72 6b 22 29 2c 74 2e 63 6c 61 73 73 4c _dark"),t.classL
0001ece0: 69 73 74 2e 61 64 64 28 22 74 6c 2d 74 68 65 6d ist.add("tl-them
0001ecf0: 65 5f 5f 6c 69 67 68 74 22 29 29 2c 72 3f 74 2e e__light")),r?t.
0001ed00: 63 6c 61 73 73 4c 69 73 74 2e 61 64 64 28 22 74 classList.add("t
0001ed10: 6c 2d 74 68 65 6d 65 5f 5f 66 6f 72 63 65 2d 73 l-theme__force-s
0001ed20: 52 47 42 22 29 3a 74 2e 63 6c 61 73 73 4c 69 73 RGB"):t.classLis
0001ed30: 74 2e 72 65 6d 6f 76 65 28 22 74 6c 2d 74 68 65 t.remove("tl-the
0001ed40: 6d 65 5f 5f 66 6f 72 63 65 2d 73 52 47 42 22 29 me__force-sRGB")
0001ed50: 7d 29 2c 5b 65 2c 74 2c 72 2c 6e 5d 29 7d 28 29 }),[e,t,r,n])}()
0001ed60: 2c 66 75 6e 63 74 69 6f 6e 28 29 7b 63 6f 6e 73 ,function(){cons
0001ed70: 74 5b 65 2c 74 5d 3d 28 30 2c 6f 2e 75 73 65 53 t[e,t]=(0,o.useS
0001ed80: 74 61 74 65 29 28 30 29 3b 28 30 2c 6f 2e 75 73 tate)(0);(0,o.us
0001ed90: 65 45 66 66 65 63 74 29 28 28 28 29 3d 3e 74 28 eEffect)((()=>t(
0001eda0: 28 65 3d 3e 65 2b 31 29 29 29 2c 5b 5d 29 7d 28 (e=>e+1))),[])}(
0001edb0: 29 2c 66 75 6e 63 74 69 6f 6e 28 65 29 7b 63 6f ),function(e){co
0001edc0: 6e 73 74 20 74 3d 72 75 28 29 2c 6e 3d 24 6d 28 nst t=ru(),n=$m(
0001edd0: 28 74 3d 3e 7b 6c 65 74 20 6e 3b 72 65 74 75 72 (t=>{let n;retur
0001ede0: 6e 20 74 2e 68 69 73 74 6f 72 79 2e 69 67 6e 6f n t.history.igno
0001edf0: 72 65 28 28 28 29 3d 3e 7b 6e 3d 65 3f 2e 28 74 re((()=>{n=e?.(t
0001ee00: 29 2c 74 2e 65 6d 69 74 28 22 6d 6f 75 6e 74 22 ),t.emit("mount"
0001ee10: 29 7d 29 29 2c 77 69 6e 64 6f 77 2e 74 6c 64 72 )})),window.tldr
0001ee20: 61 77 52 65 61 64 79 3d 21 30 2c 6e 7d 29 29 3b awReady=!0,n}));
0001ee30: 6f 2e 75 73 65 4c 61 79 6f 75 74 45 66 66 65 63 o.useLayoutEffec
0001ee40: 74 28 28 28 29 3d 3e 7b 69 66 28 74 29 72 65 74 t((()=>{if(t)ret
0001ee50: 75 72 6e 20 6e 3f 2e 28 74 29 7d 29 2c 5b 74 2c urn n?.(t)}),[t,
0001ee60: 6e 5d 29 7d 28 74 29 2c 28 30 2c 51 63 2e 6a 73 n])}(t),(0,Qc.js
0001ee70: 78 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b x)(Qc.Fragment,{
0001ee80: 63 68 69 6c 64 72 65 6e 3a 65 7d 29 7d 66 75 6e children:e})}fun
0001ee90: 63 74 69 6f 6e 20 5f 67 28 7b 63 72 61 73 68 69 ction _g({crashi
0001eea0: 6e 67 45 72 72 6f 72 3a 65 7d 29 7b 74 68 72 6f ngError:e}){thro
0001eeb0: 77 20 65 7d 66 75 6e 63 74 69 6f 6e 20 45 67 28 w e}function Eg(
0001eec0: 7b 63 68 69 6c 64 72 65 6e 3a 65 7d 29 7b 72 65 {children:e}){re
0001eed0: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 turn(0,Qc.jsx)("
0001eee0: 64 69 76 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a div",{className:
0001eef0: 22 74 6c 2d 6c 6f 61 64 69 6e 67 22 2c 63 68 69 "tl-loading",chi
0001ef00: 6c 64 72 65 6e 3a 65 7d 29 7d 66 75 6e 63 74 69 ldren:e})}functi
0001ef10: 6f 6e 20 77 67 28 7b 63 68 69 6c 64 72 65 6e 3a on wg({children:
0001ef20: 65 7d 29 7b 72 65 74 75 72 6e 28 30 2c 51 63 2e e}){return(0,Qc.
0001ef30: 6a 73 78 29 28 22 64 69 76 22 2c 7b 63 6c 61 73 jsx)("div",{clas
0001ef40: 73 4e 61 6d 65 3a 22 74 6c 2d 6c 6f 61 64 69 6e sName:"tl-loadin
0001ef50: 67 22 2c 63 68 69 6c 64 72 65 6e 3a 65 7d 29 7d g",children:e})}
0001ef60: 66 75 6e 63 74 69 6f 6e 20 78 67 28 7b 63 68 69 function xg({chi
0001ef70: 6c 64 72 65 6e 3a 65 2c 63 6c 61 73 73 4e 61 6d ldren:e,classNam
0001ef80: 65 3a 74 3d 22 22 2c 2e 2e 2e 6e 7d 29 7b 72 65 e:t="",...n}){re
0001ef90: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 turn(0,Qc.jsx)("
0001efa0: 64 69 76 22 2c 7b 2e 2e 2e 6e 2c 63 6c 61 73 73 div",{...n,class
0001efb0: 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 68 74 6d 6c Name:Jc("tl-html
0001efc0: 2d 63 6f 6e 74 61 69 6e 65 72 22 2c 74 29 2c 63 -container",t),c
0001efd0: 68 69 6c 64 72 65 6e 3a 65 7d 29 7d 63 6c 61 73 hildren:e})}clas
0001efe0: 73 20 54 67 7b 63 6f 6e 73 74 72 75 63 74 6f 72 s Tg{constructor
0001eff0: 28 65 29 7b 74 68 69 73 2e 65 64 69 74 6f 72 3d (e){this.editor=
0001f000: 65 7d 73 74 61 74 69 63 20 70 72 6f 70 73 3b 73 e}static props;s
0001f010: 74 61 74 69 63 20 6d 69 67 72 61 74 69 6f 6e 73 tatic migrations
0001f020: 3b 73 74 61 74 69 63 20 74 79 70 65 7d 66 75 6e ;static type}fun
0001f030: 63 74 69 6f 6e 20 43 67 28 65 2c 74 2c 6e 3d 7b ction Cg(e,t,n={
0001f040: 7d 29 7b 63 6f 6e 73 74 7b 6e 65 77 50 6f 69 6e }){const{newPoin
0001f050: 74 3a 72 2c 68 61 6e 64 6c 65 3a 6f 2c 73 63 61 t:r,handle:o,sca
0001f060: 6c 65 58 3a 69 2c 73 63 61 6c 65 59 3a 61 7d 3d leX:i,scaleY:a}=
0001f070: 74 2c 7b 6d 69 6e 57 69 64 74 68 3a 73 3d 31 2c t,{minWidth:s=1,
0001f080: 6d 61 78 57 69 64 74 68 3a 6c 3d 31 2f 30 2c 6d maxWidth:l=1/0,m
0001f090: 69 6e 48 65 69 67 68 74 3a 63 3d 31 2c 6d 61 78 inHeight:c=1,max
0001f0a0: 48 65 69 67 68 74 3a 75 3d 31 2f 30 7d 3d 6e 3b Height:u=1/0}=n;
0001f0b0: 6c 65 74 20 64 3d 65 2e 70 72 6f 70 73 2e 77 2a let d=e.props.w*
0001f0c0: 69 2c 70 3d 65 2e 70 72 6f 70 73 2e 68 2a 61 3b i,p=e.props.h*a;
0001f0d0: 63 6f 6e 73 74 20 66 3d 6e 65 77 20 73 75 28 30 const f=new su(0
0001f0e0: 2c 30 29 3b 69 66 28 64 3e 30 29 7b 69 66 28 64 ,0);if(d>0){if(d
0001f0f0: 3c 73 29 7b 73 77 69 74 63 68 28 6f 29 7b 63 61 <s){switch(o){ca
0001f100: 73 65 22 74 6f 70 5f 6c 65 66 74 22 3a 63 61 73 se"top_left":cas
0001f110: 65 22 6c 65 66 74 22 3a 63 61 73 65 22 62 6f 74 e"left":case"bot
0001f120: 74 6f 6d 5f 6c 65 66 74 22 3a 66 2e 78 3d 64 2d tom_left":f.x=d-
0001f130: 73 3b 62 72 65 61 6b 3b 63 61 73 65 22 74 6f 70 s;break;case"top
0001f140: 22 3a 63 61 73 65 22 62 6f 74 74 6f 6d 22 3a 66 ":case"bottom":f
0001f150: 2e 78 3d 28 64 2d 73 29 2f 32 3b 62 72 65 61 6b .x=(d-s)/2;break
0001f160: 3b 64 65 66 61 75 6c 74 3a 66 2e 78 3d 30 7d 64 ;default:f.x=0}d
0001f170: 3d 73 7d 7d 65 6c 73 65 20 69 66 28 66 2e 78 3d =s}}else if(f.x=
0001f180: 64 2c 64 3d 2d 64 2c 64 3c 73 29 7b 73 77 69 74 d,d=-d,d<s){swit
0001f190: 63 68 28 6f 29 7b 63 61 73 65 22 74 6f 70 5f 6c ch(o){case"top_l
0001f1a0: 65 66 74 22 3a 63 61 73 65 22 6c 65 66 74 22 3a eft":case"left":
0001f1b0: 63 61 73 65 22 62 6f 74 74 6f 6d 5f 6c 65 66 74 case"bottom_left
0001f1c0: 22 3a 66 2e 78 3d 2d 64 3b 62 72 65 61 6b 3b 64 ":f.x=-d;break;d
0001f1d0: 65 66 61 75 6c 74 3a 66 2e 78 3d 2d 73 7d 64 3d efault:f.x=-s}d=
0001f1e0: 73 7d 69 66 28 70 3e 30 29 7b 69 66 28 70 3c 63 s}if(p>0){if(p<c
0001f1f0: 29 7b 73 77 69 74 63 68 28 6f 29 7b 63 61 73 65 ){switch(o){case
0001f200: 22 74 6f 70 5f 6c 65 66 74 22 3a 63 61 73 65 22 "top_left":case"
0001f210: 74 6f 70 22 3a 63 61 73 65 22 74 6f 70 5f 72 69 top":case"top_ri
0001f220: 67 68 74 22 3a 66 2e 79 3d 70 2d 63 3b 62 72 65 ght":f.y=p-c;bre
0001f230: 61 6b 3b 63 61 73 65 22 72 69 67 68 74 22 3a 63 ak;case"right":c
0001f240: 61 73 65 22 6c 65 66 74 22 3a 66 2e 79 3d 28 70 ase"left":f.y=(p
0001f250: 2d 63 29 2f 32 3b 62 72 65 61 6b 3b 64 65 66 61 -c)/2;break;defa
0001f260: 75 6c 74 3a 66 2e 79 3d 30 7d 70 3d 63 7d 7d 65 ult:f.y=0}p=c}}e
0001f270: 6c 73 65 20 69 66 28 66 2e 79 3d 70 2c 70 3d 2d lse if(f.y=p,p=-
0001f280: 70 2c 70 3c 63 29 7b 73 77 69 74 63 68 28 6f 29 p,p<c){switch(o)
0001f290: 7b 63 61 73 65 22 74 6f 70 5f 6c 65 66 74 22 3a {case"top_left":
0001f2a0: 63 61 73 65 22 74 6f 70 22 3a 63 61 73 65 22 74 case"top":case"t
0001f2b0: 6f 70 5f 72 69 67 68 74 22 3a 66 2e 79 3d 2d 70 op_right":f.y=-p
0001f2c0: 3b 62 72 65 61 6b 3b 64 65 66 61 75 6c 74 3a 66 ;break;default:f
0001f2d0: 2e 79 3d 2d 63 7d 70 3d 63 7d 63 6f 6e 73 74 7b .y=-c}p=c}const{
0001f2e0: 78 3a 68 2c 79 3a 6d 7d 3d 66 2e 72 6f 74 28 65 x:h,y:m}=f.rot(e
0001f2f0: 2e 72 6f 74 61 74 69 6f 6e 29 2e 61 64 64 28 72 .rotation).add(r
0001f300: 29 3b 72 65 74 75 72 6e 7b 78 3a 68 2c 79 3a 6d );return{x:h,y:m
0001f310: 2c 70 72 6f 70 73 3a 7b 77 3a 4d 61 74 68 2e 6d ,props:{w:Math.m
0001f320: 69 6e 28 6c 2c 64 29 2c 68 3a 4d 61 74 68 2e 6d in(l,d),h:Math.m
0001f330: 69 6e 28 75 2c 70 29 7d 7d 7d 63 6c 61 73 73 20 in(u,p)}}}class
0001f340: 6b 67 20 65 78 74 65 6e 64 73 20 4f 68 7b 67 65 kg extends Oh{ge
0001f350: 74 47 65 6f 6d 65 74 72 79 28 65 29 7b 72 65 74 tGeometry(e){ret
0001f360: 75 72 6e 20 6e 65 77 20 52 68 28 7b 77 69 64 74 urn new Rh({widt
0001f370: 68 3a 65 2e 70 72 6f 70 73 2e 77 2c 68 65 69 67 h:e.props.w,heig
0001f380: 68 74 3a 65 2e 70 72 6f 70 73 2e 68 2c 69 73 46 ht:e.props.h,isF
0001f390: 69 6c 6c 65 64 3a 21 30 7d 29 7d 6f 6e 52 65 73 illed:!0})}onRes
0001f3a0: 69 7a 65 3d 28 65 2c 74 29 3d 3e 43 67 28 65 2c ize=(e,t)=>Cg(e,
0001f3b0: 74 29 3b 67 65 74 48 61 6e 64 6c 65 53 6e 61 70 t);getHandleSnap
0001f3c0: 47 65 6f 6d 65 74 72 79 28 65 29 7b 72 65 74 75 Geometry(e){retu
0001f3d0: 72 6e 7b 70 6f 69 6e 74 73 3a 74 68 69 73 2e 67 rn{points:this.g
0001f3e0: 65 74 47 65 6f 6d 65 74 72 79 28 65 29 2e 62 6f etGeometry(e).bo
0001f3f0: 75 6e 64 73 2e 63 6f 72 6e 65 72 73 41 6e 64 43 unds.cornersAndC
0001f400: 65 6e 74 65 72 7d 7d 7d 63 6c 61 73 73 20 41 67 enter}}}class Ag
0001f410: 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 61 74 extends Mm{stat
0001f420: 69 63 20 69 64 3d 22 69 64 6c 65 22 3b 6f 6e 50 ic id="idle";onP
0001f430: 6f 69 6e 74 65 72 44 6f 77 6e 3d 65 3d 3e 7b 74 ointerDown=e=>{t
0001f440: 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 6e 73 his.parent.trans
0001f450: 69 74 69 6f 6e 28 22 70 6f 69 6e 74 69 6e 67 22 ition("pointing"
0001f460: 2c 65 29 7d 3b 6f 6e 45 6e 74 65 72 3d 28 29 3d ,e)};onEnter=()=
0001f470: 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 >{this.editor.se
0001f480: 74 43 75 72 73 6f 72 28 7b 74 79 70 65 3a 22 63 tCursor({type:"c
0001f490: 72 6f 73 73 22 2c 72 6f 74 61 74 69 6f 6e 3a 30 ross",rotation:0
0001f4a0: 7d 29 7d 3b 6f 6e 43 61 6e 63 65 6c 3d 28 29 3d })};onCancel=()=
0001f4b0: 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 >{this.editor.se
0001f4c0: 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 tCurrentTool("se
0001f4d0: 6c 65 63 74 22 29 7d 7d 63 6c 61 73 73 20 49 67 lect")}}class Ig
0001f4e0: 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 61 74 extends Mm{stat
0001f4f0: 69 63 20 69 64 3d 22 70 6f 69 6e 74 69 6e 67 22 ic id="pointing"
0001f500: 3b 6d 61 72 6b 49 64 3d 22 22 3b 77 61 73 46 6f ;markId="";wasFo
0001f510: 63 75 73 65 64 4f 6e 45 6e 74 65 72 3d 21 31 3b cusedOnEnter=!1;
0001f520: 6f 6e 45 6e 74 65 72 3d 28 29 3d 3e 7b 74 68 69 onEnter=()=>{thi
0001f530: 73 2e 77 61 73 46 6f 63 75 73 65 64 4f 6e 45 6e s.wasFocusedOnEn
0001f540: 74 65 72 3d 21 74 68 69 73 2e 65 64 69 74 6f 72 ter=!this.editor
0001f550: 2e 67 65 74 49 73 4d 65 6e 75 4f 70 65 6e 28 29 .getIsMenuOpen()
0001f560: 7d 3b 6f 6e 50 6f 69 6e 74 65 72 4d 6f 76 65 3d };onPointerMove=
0001f570: 65 3d 3e 7b 69 66 28 74 68 69 73 2e 65 64 69 74 e=>{if(this.edit
0001f580: 6f 72 2e 69 6e 70 75 74 73 2e 69 73 44 72 61 67 or.inputs.isDrag
0001f590: 67 69 6e 67 29 7b 63 6f 6e 73 74 7b 6f 72 69 67 ging){const{orig
0001f5a0: 69 6e 50 61 67 65 50 6f 69 6e 74 3a 74 7d 3d 74 inPagePoint:t}=t
0001f5b0: 68 69 73 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 his.editor.input
0001f5c0: 73 2c 6e 3d 74 68 69 73 2e 70 61 72 65 6e 74 2e s,n=this.parent.
0001f5d0: 73 68 61 70 65 54 79 70 65 2c 72 3d 49 73 28 29 shapeType,r=Is()
0001f5e0: 3b 74 68 69 73 2e 6d 61 72 6b 49 64 3d 60 63 72 ;this.markId=`cr
0001f5f0: 65 61 74 69 6e 67 3a 24 7b 72 7d 60 2c 74 68 69 eating:${r}`,thi
0001f600: 73 2e 65 64 69 74 6f 72 2e 6d 61 72 6b 28 74 68 s.editor.mark(th
0001f610: 69 73 2e 6d 61 72 6b 49 64 29 2c 74 68 69 73 2e is.markId),this.
0001f620: 65 64 69 74 6f 72 2e 63 72 65 61 74 65 53 68 61 editor.createSha
0001f630: 70 65 73 28 5b 7b 69 64 3a 72 2c 74 79 70 65 3a pes([{id:r,type:
0001f640: 6e 2c 78 3a 74 2e 78 2c 79 3a 74 2e 79 2c 70 72 n,x:t.x,y:t.y,pr
0001f650: 6f 70 73 3a 7b 77 3a 31 2c 68 3a 31 7d 7d 5d 29 ops:{w:1,h:1}}])
0001f660: 2e 73 65 6c 65 63 74 28 72 29 2c 74 68 69 73 2e .select(r),this.
0001f670: 65 64 69 74 6f 72 2e 73 65 74 43 75 72 72 65 6e editor.setCurren
0001f680: 74 54 6f 6f 6c 28 22 73 65 6c 65 63 74 2e 72 65 tTool("select.re
0001f690: 73 69 7a 69 6e 67 22 2c 7b 2e 2e 2e 65 2c 74 61 sizing",{...e,ta
0001f6a0: 72 67 65 74 3a 22 73 65 6c 65 63 74 69 6f 6e 22 rget:"selection"
0001f6b0: 2c 68 61 6e 64 6c 65 3a 22 62 6f 74 74 6f 6d 5f ,handle:"bottom_
0001f6c0: 72 69 67 68 74 22 2c 69 73 43 72 65 61 74 69 6e right",isCreatin
0001f6d0: 67 3a 21 30 2c 63 72 65 61 74 69 6f 6e 43 75 72 g:!0,creationCur
0001f6e0: 73 6f 72 4f 66 66 73 65 74 3a 7b 78 3a 31 2c 79 sorOffset:{x:1,y
0001f6f0: 3a 31 7d 2c 6f 6e 49 6e 74 65 72 61 63 74 69 6f :1},onInteractio
0001f700: 6e 45 6e 64 3a 74 68 69 73 2e 70 61 72 65 6e 74 nEnd:this.parent
0001f710: 2e 69 64 2c 6f 6e 43 72 65 61 74 65 3a 74 68 69 .id,onCreate:thi
0001f720: 73 2e 70 61 72 65 6e 74 2e 6f 6e 43 72 65 61 74 s.parent.onCreat
0001f730: 65 7d 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 65 72 55 e})}};onPointerU
0001f740: 70 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 6f 6d 70 p=()=>{this.comp
0001f750: 6c 65 74 65 28 29 7d 3b 6f 6e 43 61 6e 63 65 6c lete()};onCancel
0001f760: 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 65 =()=>{this.cance
0001f770: 6c 28 29 7d 3b 6f 6e 43 6f 6d 70 6c 65 74 65 3d l()};onComplete=
0001f780: 28 29 3d 3e 7b 74 68 69 73 2e 63 6f 6d 70 6c 65 ()=>{this.comple
0001f790: 74 65 28 29 7d 3b 6f 6e 49 6e 74 65 72 72 75 70 te()};onInterrup
0001f7a0: 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 t=()=>{this.canc
0001f7b0: 65 6c 28 29 7d 3b 63 6f 6d 70 6c 65 74 65 28 29 el()};complete()
0001f7c0: 7b 63 6f 6e 73 74 7b 6f 72 69 67 69 6e 50 61 67 {const{originPag
0001f7d0: 65 50 6f 69 6e 74 3a 65 7d 3d 74 68 69 73 2e 65 ePoint:e}=this.e
0001f7e0: 64 69 74 6f 72 2e 69 6e 70 75 74 73 3b 69 66 28 ditor.inputs;if(
0001f7f0: 21 74 68 69 73 2e 77 61 73 46 6f 63 75 73 65 64 !this.wasFocused
0001f800: 4f 6e 45 6e 74 65 72 29 72 65 74 75 72 6e 3b 74 OnEnter)return;t
0001f810: 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 72 6b 28 his.editor.mark(
0001f820: 74 68 69 73 2e 6d 61 72 6b 49 64 29 3b 63 6f 6e this.markId);con
0001f830: 73 74 20 74 3d 74 68 69 73 2e 70 61 72 65 6e 74 st t=this.parent
0001f840: 2e 73 68 61 70 65 54 79 70 65 2c 6e 3d 49 73 28 .shapeType,n=Is(
0001f850: 29 3b 74 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 );this.editor.ma
0001f860: 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 64 29 2c rk(this.markId),
0001f870: 74 68 69 73 2e 65 64 69 74 6f 72 2e 63 72 65 61 this.editor.crea
0001f880: 74 65 53 68 61 70 65 73 28 5b 7b 69 64 3a 6e 2c teShapes([{id:n,
0001f890: 74 79 70 65 3a 74 2c 78 3a 65 2e 78 2c 79 3a 65 type:t,x:e.x,y:e
0001f8a0: 2e 79 7d 5d 29 3b 63 6f 6e 73 74 20 72 3d 74 68 .y}]);const r=th
0001f8b0: 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 61 is.editor.getSha
0001f8c0: 70 65 28 6e 29 3b 69 66 28 21 72 29 72 65 74 75 pe(n);if(!r)retu
0001f8d0: 72 6e 20 76 6f 69 64 20 74 68 69 73 2e 63 61 6e rn void this.can
0001f8e0: 63 65 6c 28 29 3b 6c 65 74 7b 77 3a 6f 2c 68 3a cel();let{w:o,h:
0001f8f0: 69 7d 3d 72 2e 70 72 6f 70 73 3b 63 6f 6e 73 74 i}=r.props;const
0001f900: 20 61 3d 6e 65 77 20 73 75 28 6f 2f 32 2c 69 2f a=new su(o/2,i/
0001f910: 32 29 2c 73 3d 74 68 69 73 2e 65 64 69 74 6f 72 2),s=this.editor
0001f920: 2e 67 65 74 53 68 61 70 65 50 61 72 65 6e 74 54 .getShapeParentT
0001f930: 72 61 6e 73 66 6f 72 6d 28 72 29 3b 73 26 26 61 ransform(r);s&&a
0001f940: 2e 72 6f 74 28 2d 73 2e 72 6f 74 61 74 69 6f 6e .rot(-s.rotation
0001f950: 28 29 29 3b 6c 65 74 20 6c 3d 31 3b 74 68 69 73 ());let l=1;this
0001f960: 2e 65 64 69 74 6f 72 2e 75 73 65 72 2e 67 65 74 .editor.user.get
0001f970: 49 73 44 79 6e 61 6d 69 63 52 65 73 69 7a 65 4d IsDynamicResizeM
0001f980: 6f 64 65 28 29 26 26 28 6c 3d 31 2f 74 68 69 73 ode()&&(l=1/this
0001f990: 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f 6d 4c .editor.getZoomL
0001f9a0: 65 76 65 6c 28 29 2c 6f 2a 3d 6c 2c 69 2a 3d 6c evel(),o*=l,i*=l
0001f9b0: 2c 61 2e 6d 75 6c 28 6c 29 29 3b 63 6f 6e 73 74 ,a.mul(l));const
0001f9c0: 20 63 3d 64 69 28 72 29 3b 63 2e 78 3d 72 2e 78 c=di(r);c.x=r.x
0001f9d0: 2d 61 2e 78 2c 63 2e 79 3d 72 2e 79 2d 61 2e 79 -a.x,c.y=r.y-a.y
0001f9e0: 2c 63 2e 70 72 6f 70 73 2e 77 3d 6f 2c 63 2e 70 ,c.props.w=o,c.p
0001f9f0: 72 6f 70 73 2e 68 3d 69 2c 22 73 63 61 6c 65 22 rops.h=i,"scale"
0001fa00: 69 6e 20 72 2e 70 72 6f 70 73 26 26 28 63 2e 70 in r.props&&(c.p
0001fa10: 72 6f 70 73 2e 73 63 61 6c 65 3d 6c 29 2c 74 68 rops.scale=l),th
0001fa20: 69 73 2e 65 64 69 74 6f 72 2e 75 70 64 61 74 65 is.editor.update
0001fa30: 53 68 61 70 65 28 63 29 2c 74 68 69 73 2e 65 64 Shape(c),this.ed
0001fa40: 69 74 6f 72 2e 73 65 74 53 65 6c 65 63 74 65 64 itor.setSelected
0001fa50: 53 68 61 70 65 73 28 5b 6e 5d 29 2c 74 68 69 73 Shapes([n]),this
0001fa60: 2e 65 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 .editor.getInsta
0001fa70: 6e 63 65 53 74 61 74 65 28 29 2e 69 73 54 6f 6f nceState().isToo
0001fa80: 6c 4c 6f 63 6b 65 64 3f 74 68 69 73 2e 70 61 72 lLocked?this.par
0001fa90: 65 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 22 ent.transition("
0001faa0: 69 64 6c 65 22 29 3a 74 68 69 73 2e 65 64 69 74 idle"):this.edit
0001fab0: 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f or.setCurrentToo
0001fac0: 6c 28 22 73 65 6c 65 63 74 2e 69 64 6c 65 22 29 l("select.idle")
0001fad0: 7d 63 61 6e 63 65 6c 28 29 7b 74 68 69 73 2e 70 }cancel(){this.p
0001fae0: 61 72 65 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e arent.transition
0001faf0: 28 22 69 64 6c 65 22 29 7d 7d 63 6c 61 73 73 20 ("idle")}}class
0001fb00: 52 67 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 Rg extends Mm{st
0001fb10: 61 74 69 63 20 69 64 3d 22 62 6f 78 22 3b 73 74 atic id="box";st
0001fb20: 61 74 69 63 20 69 6e 69 74 69 61 6c 3d 22 69 64 atic initial="id
0001fb30: 6c 65 22 3b 73 74 61 74 69 63 20 63 68 69 6c 64 le";static child
0001fb40: 72 65 6e 3d 28 29 3d 3e 5b 41 67 2c 49 67 5d 3b ren=()=>[Ag,Ig];
0001fb50: 6f 6e 43 72 65 61 74 65 7d 66 75 6e 63 74 69 6f onCreate}functio
0001fb60: 6e 20 4f 67 28 65 29 7b 63 6f 6e 73 74 20 74 3d n Og(e){const t=
0001fb70: 72 75 28 29 3b 72 65 74 75 72 6e 20 64 61 28 22 ru();return da("
0001fb80: 69 73 45 64 69 74 69 6e 67 22 2c 28 28 29 3d 3e isEditing",(()=>
0001fb90: 74 2e 67 65 74 45 64 69 74 69 6e 67 53 68 61 70 t.getEditingShap
0001fba0: 65 49 64 28 29 3d 3d 3d 65 29 2c 5b 74 2c 65 5d eId()===e),[t,e]
0001fbb0: 29 7d 66 75 6e 63 74 69 6f 6e 20 4e 67 28 65 29 )}function Ng(e)
0001fbc0: 7b 63 6f 6e 73 74 20 74 3d 72 75 28 29 3b 72 65 {const t=ru();re
0001fbd0: 74 75 72 6e 28 30 2c 6f 2e 75 73 65 4d 65 6d 6f turn(0,o.useMemo
0001fbe0: 29 28 28 66 75 6e 63 74 69 6f 6e 28 29 7b 6c 65 )((function(){le
0001fbf0: 74 20 6e 2c 72 3b 72 65 74 75 72 6e 7b 6f 6e 50 t n,r;return{onP
0001fc00: 6f 69 6e 74 65 72 44 6f 77 6e 3a 6e 3d 3e 7b 69 ointerDown:n=>{i
0001fc10: 66 28 6e 2e 69 73 4b 69 6c 6c 65 64 29 72 65 74 f(n.isKilled)ret
0001fc20: 75 72 6e 3b 69 66 28 6e 2e 62 75 74 74 6f 6e 3d urn;if(n.button=
0001fc30: 3d 3d 71 75 29 72 65 74 75 72 6e 20 76 6f 69 64 ==qu)return void
0001fc40: 20 74 2e 64 69 73 70 61 74 63 68 28 7b 74 79 70 t.dispatch({typ
0001fc50: 65 3a 22 70 6f 69 6e 74 65 72 22 2c 74 61 72 67 e:"pointer",targ
0001fc60: 65 74 3a 22 73 65 6c 65 63 74 69 6f 6e 22 2c 68 et:"selection",h
0001fc70: 61 6e 64 6c 65 3a 65 2c 6e 61 6d 65 3a 22 72 69 andle:e,name:"ri
0001fc80: 67 68 74 5f 63 6c 69 63 6b 22 2c 2e 2e 2e 6f 64 ght_click",...od
0001fc90: 28 6e 29 7d 29 3b 69 66 28 30 21 3d 3d 6e 2e 62 (n)});if(0!==n.b
0001fca0: 75 74 74 6f 6e 29 72 65 74 75 72 6e 3b 63 6f 6e utton)return;con
0001fcb0: 73 74 20 72 3d 4a 75 28 6e 2e 63 75 72 72 65 6e st r=Ju(n.curren
0001fcc0: 74 54 61 72 67 65 74 29 3b 65 64 28 72 2c 6e 29 tTarget);ed(r,n)
0001fcd0: 2c 72 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 ,r.addEventListe
0001fce0: 6e 65 72 28 22 70 6f 69 6e 74 65 72 75 70 22 2c ner("pointerup",
0001fcf0: 28 66 75 6e 63 74 69 6f 6e 20 65 28 29 7b 72 2e (function e(){r.
0001fd00: 72 65 6d 6f 76 65 45 76 65 6e 74 4c 69 73 74 65 removeEventListe
0001fd10: 6e 65 72 28 22 70 6f 69 6e 74 65 72 75 70 22 2c ner("pointerup",
0001fd20: 65 29 2c 74 64 28 72 2c 6e 29 7d 29 29 2c 74 2e e),td(r,n)})),t.
0001fd30: 64 69 73 70 61 74 63 68 28 7b 6e 61 6d 65 3a 22 dispatch({name:"
0001fd40: 70 6f 69 6e 74 65 72 5f 64 6f 77 6e 22 2c 74 79 pointer_down",ty
0001fd50: 70 65 3a 22 70 6f 69 6e 74 65 72 22 2c 74 61 72 pe:"pointer",tar
0001fd60: 67 65 74 3a 22 73 65 6c 65 63 74 69 6f 6e 22 2c get:"selection",
0001fd70: 68 61 6e 64 6c 65 3a 65 2c 2e 2e 2e 6f 64 28 6e handle:e,...od(n
0001fd80: 29 7d 29 2c 6e 64 28 6e 29 7d 2c 6f 6e 50 6f 69 )}),nd(n)},onPoi
0001fd90: 6e 74 65 72 4d 6f 76 65 3a 66 75 6e 63 74 69 6f nterMove:functio
0001fda0: 6e 28 6f 29 7b 6f 2e 69 73 4b 69 6c 6c 65 64 7c n(o){o.isKilled|
0001fdb0: 7c 30 3d 3d 3d 6f 2e 62 75 74 74 6f 6e 26 26 28 |0===o.button&&(
0001fdc0: 6f 2e 63 6c 69 65 6e 74 58 3d 3d 3d 6e 26 26 6f o.clientX===n&&o
0001fdd0: 2e 63 6c 69 65 6e 74 59 3d 3d 3d 72 7c 7c 28 6e .clientY===r||(n
0001fde0: 3d 6f 2e 63 6c 69 65 6e 74 58 2c 72 3d 6f 2e 63 =o.clientX,r=o.c
0001fdf0: 6c 69 65 6e 74 59 2c 74 2e 64 69 73 70 61 74 63 lientY,t.dispatc
0001fe00: 68 28 7b 6e 61 6d 65 3a 22 70 6f 69 6e 74 65 72 h({name:"pointer
0001fe10: 5f 6d 6f 76 65 22 2c 74 79 70 65 3a 22 70 6f 69 _move",type:"poi
0001fe20: 6e 74 65 72 22 2c 74 61 72 67 65 74 3a 22 73 65 nter",target:"se
0001fe30: 6c 65 63 74 69 6f 6e 22 2c 68 61 6e 64 6c 65 3a lection",handle:
0001fe40: 65 2c 2e 2e 2e 6f 64 28 6f 29 7d 29 29 29 7d 2c e,...od(o)})))},
0001fe50: 6f 6e 50 6f 69 6e 74 65 72 55 70 3a 6e 3d 3e 7b onPointerUp:n=>{
0001fe60: 6e 2e 69 73 4b 69 6c 6c 65 64 7c 7c 30 3d 3d 3d n.isKilled||0===
0001fe70: 6e 2e 62 75 74 74 6f 6e 26 26 74 2e 64 69 73 70 n.button&&t.disp
0001fe80: 61 74 63 68 28 7b 6e 61 6d 65 3a 22 70 6f 69 6e atch({name:"poin
0001fe90: 74 65 72 5f 75 70 22 2c 74 79 70 65 3a 22 70 6f ter_up",type:"po
0001fea0: 69 6e 74 65 72 22 2c 74 61 72 67 65 74 3a 22 73 inter",target:"s
0001feb0: 65 6c 65 63 74 69 6f 6e 22 2c 68 61 6e 64 6c 65 election",handle
0001fec0: 3a 65 2c 2e 2e 2e 6f 64 28 6e 29 7d 29 7d 7d 7d :e,...od(n)})}}}
0001fed0: 29 2c 5b 74 2c 65 5d 29 7d 63 6f 6e 73 74 20 50 ),[t,e])}const P
0001fee0: 67 3d 32 30 2c 4d 67 3d 38 3b 66 75 6e 63 74 69 g=20,Mg=8;functi
0001fef0: 6f 6e 20 44 67 28 65 2c 74 3d 50 67 29 7b 72 65 on Dg(e,t=Pg){re
0001ff00: 74 75 72 6e 20 4d 61 74 68 2e 6d 61 78 28 4d 67 turn Math.max(Mg
0001ff10: 2c 4d 61 74 68 2e 63 65 69 6c 28 65 2f 74 29 29 ,Math.ceil(e/t))
0001ff20: 7d 63 6c 61 73 73 20 4c 67 20 65 78 74 65 6e 64 }class Lg extend
0001ff30: 73 20 43 70 7b 5f 63 65 6e 74 65 72 3b 72 61 64 s Cp{_center;rad
0001ff40: 69 75 73 3b 73 74 61 72 74 3b 65 6e 64 3b 6c 61 ius;start;end;la
0001ff50: 72 67 65 41 72 63 46 6c 61 67 3b 73 77 65 65 70 rgeArcFlag;sweep
0001ff60: 46 6c 61 67 3b 6d 65 61 73 75 72 65 3b 61 6e 67 Flag;measure;ang
0001ff70: 6c 65 53 74 61 72 74 3b 61 6e 67 6c 65 45 6e 64 leStart;angleEnd
0001ff80: 3b 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 29 7b ;constructor(e){
0001ff90: 73 75 70 65 72 28 7b 2e 2e 2e 65 2c 69 73 46 69 super({...e,isFi
0001ffa0: 6c 6c 65 64 3a 21 31 2c 69 73 43 6c 6f 73 65 64 lled:!1,isClosed
0001ffb0: 3a 21 31 7d 29 3b 63 6f 6e 73 74 7b 63 65 6e 74 :!1});const{cent
0001ffc0: 65 72 3a 74 2c 73 77 65 65 70 46 6c 61 67 3a 6e er:t,sweepFlag:n
0001ffd0: 2c 6c 61 72 67 65 41 72 63 46 6c 61 67 3a 72 2c ,largeArcFlag:r,
0001ffe0: 73 74 61 72 74 3a 6f 2c 65 6e 64 3a 69 7d 3d 65 start:o,end:i}=e
0001fff0: 3b 69 66 28 6f 2e 65 71 75 61 6c 73 28 69 29 29 ;if(o.equals(i))
00020000: 74 68 72 6f 77 20 45 72 72 6f 72 28 22 41 72 63 throw Error("Arc
00020010: 20 6d 75 73 74 20 68 61 76 65 20 64 69 66 66 65 must have diffe
00020020: 72 65 6e 74 20 73 74 61 72 74 20 61 6e 64 20 65 rent start and e
00020030: 6e 64 20 70 6f 69 6e 74 73 2e 22 29 3b 74 68 69 nd points.");thi
00020040: 73 2e 61 6e 67 6c 65 53 74 61 72 74 3d 73 75 2e s.angleStart=su.
00020050: 41 6e 67 6c 65 28 74 2c 6f 29 2c 74 68 69 73 2e Angle(t,o),this.
00020060: 61 6e 67 6c 65 45 6e 64 3d 73 75 2e 41 6e 67 6c angleEnd=su.Angl
00020070: 65 28 74 2c 69 29 2c 74 68 69 73 2e 72 61 64 69 e(t,i),this.radi
00020080: 75 73 3d 73 75 2e 44 69 73 74 28 74 2c 6f 29 2c us=su.Dist(t,o),
00020090: 74 68 69 73 2e 6d 65 61 73 75 72 65 3d 66 75 6e this.measure=fun
000200a0: 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c 72 29 7b 63 ction(e,t,n,r){c
000200b0: 6f 6e 73 74 20 6f 3d 28 74 2d 65 29 25 66 75 2a onst o=(t-e)%fu*
000200c0: 32 25 66 75 2d 28 74 2d 65 29 25 66 75 3b 72 65 2%fu-(t-e)%fu;re
000200d0: 74 75 72 6e 20 72 3f 28 66 75 2d 4d 61 74 68 2e turn r?(fu-Math.
000200e0: 61 62 73 28 6f 29 29 2a 28 6e 3f 31 3a 2d 31 29 abs(o))*(n?1:-1)
000200f0: 3a 6f 7d 28 74 68 69 73 2e 61 6e 67 6c 65 53 74 :o}(this.angleSt
00020100: 61 72 74 2c 74 68 69 73 2e 61 6e 67 6c 65 45 6e art,this.angleEn
00020110: 64 2c 6e 2c 72 29 2c 74 68 69 73 2e 73 74 61 72 d,n,r),this.star
00020120: 74 3d 6f 2c 74 68 69 73 2e 65 6e 64 3d 69 2c 74 t=o,this.end=i,t
00020130: 68 69 73 2e 73 77 65 65 70 46 6c 61 67 3d 6e 2c his.sweepFlag=n,
00020140: 74 68 69 73 2e 6c 61 72 67 65 41 72 63 46 6c 61 this.largeArcFla
00020150: 67 3d 72 2c 74 68 69 73 2e 5f 63 65 6e 74 65 72 g=r,this._center
00020160: 3d 74 7d 6e 65 61 72 65 73 74 50 6f 69 6e 74 28 =t}nearestPoint(
00020170: 65 29 7b 63 6f 6e 73 74 7b 5f 63 65 6e 74 65 72 e){const{_center
00020180: 3a 74 2c 6d 65 61 73 75 72 65 3a 6e 2c 72 61 64 :t,measure:n,rad
00020190: 69 75 73 3a 72 2c 61 6e 67 6c 65 45 6e 64 3a 6f ius:r,angleEnd:o
000201a0: 2c 61 6e 67 6c 65 53 74 61 72 74 3a 69 2c 73 74 ,angleStart:i,st
000201b0: 61 72 74 3a 61 2c 65 6e 64 3a 73 7d 3d 74 68 69 art:a,end:s}=thi
000201c0: 73 2c 6c 3d 4c 75 28 6e 2c 69 2c 6f 2c 74 2e 61 s,l=Lu(n,i,o,t.a
000201d0: 6e 67 6c 65 28 65 29 29 3b 69 66 28 6c 3c 3d 30 ngle(e));if(l<=0
000201e0: 29 72 65 74 75 72 6e 20 61 3b 69 66 28 6c 3e 3d )return a;if(l>=
000201f0: 31 29 72 65 74 75 72 6e 20 73 3b 63 6f 6e 73 74 1)return s;const
00020200: 20 63 3d 74 2e 63 6c 6f 6e 65 28 29 2e 61 64 64 c=t.clone().add
00020210: 28 65 2e 63 6c 6f 6e 65 28 29 2e 73 75 62 28 74 (e.clone().sub(t
00020220: 29 2e 75 6e 69 28 29 2e 6d 75 6c 28 72 29 29 3b ).uni().mul(r));
00020230: 6c 65 74 20 75 2c 64 2c 70 3d 31 2f 30 3b 66 6f let u,d,p=1/0;fo
00020240: 72 28 63 6f 6e 73 74 20 74 20 6f 66 5b 61 2c 73 r(const t of[a,s
00020250: 2c 63 5d 29 64 3d 73 75 2e 44 69 73 74 32 28 65 ,c])d=su.Dist2(e
00020260: 2c 74 29 2c 64 3c 70 26 26 28 75 3d 74 2c 70 3d ,t),d<p&&(u=t,p=
00020270: 64 29 3b 69 66 28 21 75 29 74 68 72 6f 77 20 45 d);if(!u)throw E
00020280: 72 72 6f 72 28 22 6e 65 61 72 65 73 74 20 70 6f rror("nearest po
00020290: 69 6e 74 20 6e 6f 74 20 66 6f 75 6e 64 22 29 3b int not found");
000202a0: 72 65 74 75 72 6e 20 75 7d 68 69 74 54 65 73 74 return u}hitTest
000202b0: 4c 69 6e 65 53 65 67 6d 65 6e 74 28 65 2c 74 29 LineSegment(e,t)
000202c0: 7b 63 6f 6e 73 74 7b 5f 63 65 6e 74 65 72 3a 6e {const{_center:n
000202d0: 2c 72 61 64 69 75 73 3a 72 2c 6d 65 61 73 75 72 ,radius:r,measur
000202e0: 65 3a 6f 2c 61 6e 67 6c 65 53 74 61 72 74 3a 69 e:o,angleStart:i
000202f0: 2c 61 6e 67 6c 65 45 6e 64 3a 61 7d 3d 74 68 69 ,angleEnd:a}=thi
00020300: 73 2c 73 3d 67 68 28 65 2c 74 2c 6e 2c 72 29 3b s,s=gh(e,t,n,r);
00020310: 72 65 74 75 72 6e 20 6e 75 6c 6c 21 3d 3d 73 26 return null!==s&
00020320: 26 73 2e 73 6f 6d 65 28 28 65 3d 3e 7b 63 6f 6e &s.some((e=>{con
00020330: 73 74 20 74 3d 4c 75 28 6f 2c 69 2c 61 2c 6e 2e st t=Lu(o,i,a,n.
00020340: 61 6e 67 6c 65 28 65 29 29 3b 72 65 74 75 72 6e angle(e));return
00020350: 20 74 3e 3d 30 26 26 74 3c 3d 31 7d 29 29 7d 67 t>=0&&t<=1}))}g
00020360: 65 74 56 65 72 74 69 63 65 73 28 29 7b 63 6f 6e etVertices(){con
00020370: 73 74 7b 5f 63 65 6e 74 65 72 3a 65 2c 6d 65 61 st{_center:e,mea
00020380: 73 75 72 65 3a 74 2c 6c 65 6e 67 74 68 3a 6e 2c sure:t,length:n,
00020390: 72 61 64 69 75 73 3a 72 2c 61 6e 67 6c 65 53 74 radius:r,angleSt
000203a0: 61 72 74 3a 6f 7d 3d 74 68 69 73 2c 69 3d 5b 5d art:o}=this,i=[]
000203b0: 3b 66 6f 72 28 6c 65 74 20 61 3d 30 2c 73 3d 44 ;for(let a=0,s=D
000203c0: 67 28 4d 61 74 68 2e 61 62 73 28 6e 29 29 3b 61 g(Math.abs(n));a
000203d0: 3c 73 2b 31 3b 61 2b 2b 29 7b 63 6f 6e 73 74 20 <s+1;a++){const
000203e0: 6e 3d 6f 2b 61 2f 73 2a 74 3b 69 2e 70 75 73 68 n=o+a/s*t;i.push
000203f0: 28 43 75 28 65 2c 72 2c 6e 29 29 7d 72 65 74 75 (Cu(e,r,n))}retu
00020400: 72 6e 20 69 7d 67 65 74 53 76 67 50 61 74 68 44 rn i}getSvgPathD
00020410: 61 74 61 28 65 3d 21 30 29 7b 63 6f 6e 73 74 7b ata(e=!0){const{
00020420: 73 74 61 72 74 3a 74 2c 65 6e 64 3a 6e 2c 72 61 start:t,end:n,ra
00020430: 64 69 75 73 3a 72 2c 6c 61 72 67 65 41 72 63 46 dius:r,largeArcF
00020440: 6c 61 67 3a 6f 2c 73 77 65 65 70 46 6c 61 67 3a lag:o,sweepFlag:
00020450: 69 7d 3d 74 68 69 73 3b 72 65 74 75 72 6e 60 24 i}=this;return`$
00020460: 7b 65 3f 60 4d 24 7b 74 2e 74 6f 46 69 78 65 64 {e?`M${t.toFixed
00020470: 28 29 7d 60 3a 22 22 7d 20 41 24 7b 72 7d 20 24 ()}`:""} A${r} $
00020480: 7b 72 7d 20 30 20 24 7b 6f 7d 20 24 7b 69 7d 20 {r} 0 ${o} ${i}
00020490: 24 7b 6e 2e 74 6f 46 69 78 65 64 28 29 7d 60 7d ${n.toFixed()}`}
000204a0: 67 65 74 4c 65 6e 67 74 68 28 29 7b 72 65 74 75 getLength(){retu
000204b0: 72 6e 20 74 68 69 73 2e 6d 65 61 73 75 72 65 2a rn this.measure*
000204c0: 74 68 69 73 2e 72 61 64 69 75 73 7d 7d 63 6c 61 this.radius}}cla
000204d0: 73 73 20 46 67 20 65 78 74 65 6e 64 73 20 43 70 ss Fg extends Cp
000204e0: 7b 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 29 7b {constructor(e){
000204f0: 73 75 70 65 72 28 7b 69 73 43 6c 6f 73 65 64 3a super({isClosed:
00020500: 21 30 2c 2e 2e 2e 65 7d 29 2c 74 68 69 73 2e 63 !0,...e}),this.c
00020510: 6f 6e 66 69 67 3d 65 3b 63 6f 6e 73 74 7b 78 3a onfig=e;const{x:
00020520: 74 3d 30 2c 79 3a 6e 3d 30 2c 72 61 64 69 75 73 t=0,y:n=0,radius
00020530: 3a 72 7d 3d 65 3b 74 68 69 73 2e 78 3d 74 2c 74 :r}=e;this.x=t,t
00020540: 68 69 73 2e 79 3d 6e 2c 74 68 69 73 2e 5f 63 65 his.y=n,this._ce
00020550: 6e 74 65 72 3d 6e 65 77 20 73 75 28 72 2b 74 2c nter=new su(r+t,
00020560: 72 2b 6e 29 2c 74 68 69 73 2e 72 61 64 69 75 73 r+n),this.radius
00020570: 3d 72 7d 5f 63 65 6e 74 65 72 3b 72 61 64 69 75 =r}_center;radiu
00020580: 73 3b 78 3b 79 3b 67 65 74 42 6f 75 6e 64 73 28 s;x;y;getBounds(
00020590: 29 7b 72 65 74 75 72 6e 20 6e 65 77 20 5f 70 28 ){return new _p(
000205a0: 74 68 69 73 2e 78 2c 74 68 69 73 2e 79 2c 32 2a this.x,this.y,2*
000205b0: 74 68 69 73 2e 72 61 64 69 75 73 2c 32 2a 74 68 this.radius,2*th
000205c0: 69 73 2e 72 61 64 69 75 73 29 7d 67 65 74 56 65 is.radius)}getVe
000205d0: 72 74 69 63 65 73 28 29 7b 63 6f 6e 73 74 7b 5f rtices(){const{_
000205e0: 63 65 6e 74 65 72 3a 65 2c 72 61 64 69 75 73 3a center:e,radius:
000205f0: 74 7d 3d 74 68 69 73 2c 6e 3d 5b 5d 3b 66 6f 72 t}=this,n=[];for
00020600: 28 6c 65 74 20 72 3d 30 2c 6f 3d 44 67 28 66 75 (let r=0,o=Dg(fu
00020610: 2a 74 29 3b 72 3c 6f 3b 72 2b 2b 29 7b 63 6f 6e *t);r<o;r++){con
00020620: 73 74 20 69 3d 72 2f 6f 2a 66 75 3b 6e 2e 70 75 st i=r/o*fu;n.pu
00020630: 73 68 28 43 75 28 65 2c 74 2c 69 29 29 7d 72 65 sh(Cu(e,t,i))}re
00020640: 74 75 72 6e 20 6e 7d 6e 65 61 72 65 73 74 50 6f turn n}nearestPo
00020650: 69 6e 74 28 65 29 7b 63 6f 6e 73 74 7b 5f 63 65 int(e){const{_ce
00020660: 6e 74 65 72 3a 74 2c 72 61 64 69 75 73 3a 6e 7d nter:t,radius:n}
00020670: 3d 74 68 69 73 3b 72 65 74 75 72 6e 20 74 2e 65 =this;return t.e
00020680: 71 75 61 6c 73 28 65 29 3f 73 75 2e 41 64 64 58 quals(e)?su.AddX
00020690: 59 28 74 2c 6e 2c 30 29 3a 74 2e 63 6c 6f 6e 65 Y(t,n,0):t.clone
000206a0: 28 29 2e 61 64 64 28 65 2e 63 6c 6f 6e 65 28 29 ().add(e.clone()
000206b0: 2e 73 75 62 28 74 29 2e 75 6e 69 28 29 2e 6d 75 .sub(t).uni().mu
000206c0: 6c 28 6e 29 29 7d 68 69 74 54 65 73 74 4c 69 6e l(n))}hitTestLin
000206d0: 65 53 65 67 6d 65 6e 74 28 65 2c 74 2c 6e 3d 30 eSegment(e,t,n=0
000206e0: 29 7b 63 6f 6e 73 74 7b 5f 63 65 6e 74 65 72 3a ){const{_center:
000206f0: 72 2c 72 61 64 69 75 73 3a 6f 7d 3d 74 68 69 73 r,radius:o}=this
00020700: 3b 72 65 74 75 72 6e 20 6e 75 6c 6c 21 3d 3d 67 ;return null!==g
00020710: 68 28 65 2c 74 2c 72 2c 6f 2b 6e 29 7d 67 65 74 h(e,t,r,o+n)}get
00020720: 53 76 67 50 61 74 68 44 61 74 61 28 29 7b 63 6f SvgPathData(){co
00020730: 6e 73 74 7b 5f 63 65 6e 74 65 72 3a 65 2c 72 61 nst{_center:e,ra
00020740: 64 69 75 73 3a 74 7d 3d 74 68 69 73 3b 72 65 74 dius:t}=this;ret
00020750: 75 72 6e 60 4d 24 7b 65 2e 78 2b 74 7d 2c 24 7b urn`M${e.x+t},${
00020760: 65 2e 79 7d 20 61 24 7b 74 7d 2c 24 7b 74 7d 20 e.y} a${t},${t}
00020770: 30 20 31 2c 30 20 24 7b 32 2a 74 7d 2c 30 61 24 0 1,0 ${2*t},0a$
00020780: 7b 74 7d 2c 24 7b 74 7d 20 30 20 31 2c 30 20 2d {t},${t} 0 1,0 -
00020790: 24 7b 32 2a 74 7d 2c 30 60 7d 7d 63 6c 61 73 73 ${2*t},0`}}class
000207a0: 20 6a 67 20 65 78 74 65 6e 64 73 20 41 68 7b 61 jg extends Ah{a
000207b0: 3b 62 3b 63 3b 64 3b 63 6f 6e 73 74 72 75 63 74 ;b;c;d;construct
000207c0: 6f 72 28 65 29 7b 63 6f 6e 73 74 7b 73 74 61 72 or(e){const{star
000207d0: 74 3a 74 2c 63 70 31 3a 6e 2c 63 70 32 3a 72 2c t:t,cp1:n,cp2:r,
000207e0: 65 6e 64 3a 6f 7d 3d 65 3b 73 75 70 65 72 28 7b end:o}=e;super({
000207f0: 2e 2e 2e 65 2c 70 6f 69 6e 74 73 3a 5b 74 2c 6f ...e,points:[t,o
00020800: 5d 7d 29 2c 74 68 69 73 2e 61 3d 74 2c 74 68 69 ]}),this.a=t,thi
00020810: 73 2e 62 3d 6e 2c 74 68 69 73 2e 63 3d 72 2c 74 s.b=n,this.c=r,t
00020820: 68 69 73 2e 64 3d 6f 7d 67 65 74 56 65 72 74 69 his.d=o}getVerti
00020830: 63 65 73 28 29 7b 63 6f 6e 73 74 20 65 3d 5b 5d ces(){const e=[]
00020840: 2c 7b 61 3a 74 2c 62 3a 6e 2c 63 3a 72 2c 64 3a ,{a:t,b:n,c:r,d:
00020850: 6f 7d 3d 74 68 69 73 3b 66 6f 72 28 6c 65 74 20 o}=this;for(let
00020860: 69 3d 30 2c 61 3d 31 30 3b 69 3c 3d 61 3b 69 2b i=0,a=10;i<=a;i+
00020870: 2b 29 7b 63 6f 6e 73 74 20 73 3d 69 2f 61 3b 65 +){const s=i/a;e
00020880: 2e 70 75 73 68 28 6e 65 77 20 73 75 28 28 31 2d .push(new su((1-
00020890: 73 29 2a 28 31 2d 73 29 2a 28 31 2d 73 29 2a 74 s)*(1-s)*(1-s)*t
000208a0: 2e 78 2b 28 31 2d 73 29 2a 28 31 2d 73 29 2a 33 .x+(1-s)*(1-s)*3
000208b0: 2a 73 2a 6e 2e 78 2b 33 2a 28 31 2d 73 29 2a 28 *s*n.x+3*(1-s)*(
000208c0: 73 2a 73 29 2a 72 2e 78 2b 73 2a 73 2a 73 2a 6f s*s)*r.x+s*s*s*o
000208d0: 2e 78 2c 28 31 2d 73 29 2a 28 31 2d 73 29 2a 28 .x,(1-s)*(1-s)*(
000208e0: 31 2d 73 29 2a 74 2e 79 2b 28 31 2d 73 29 2a 28 1-s)*t.y+(1-s)*(
000208f0: 31 2d 73 29 2a 33 2a 73 2a 6e 2e 79 2b 33 2a 28 1-s)*3*s*n.y+3*(
00020900: 31 2d 73 29 2a 28 73 2a 73 29 2a 72 2e 79 2b 73 1-s)*(s*s)*r.y+s
00020910: 2a 73 2a 73 2a 6f 2e 79 29 29 7d 72 65 74 75 72 *s*s*o.y))}retur
00020920: 6e 20 65 7d 6d 69 64 50 6f 69 6e 74 28 29 7b 72 n e}midPoint(){r
00020930: 65 74 75 72 6e 20 6a 67 2e 47 65 74 41 74 54 28 eturn jg.GetAtT(
00020940: 74 68 69 73 2c 2e 35 29 7d 6e 65 61 72 65 73 74 this,.5)}nearest
00020950: 50 6f 69 6e 74 28 65 29 7b 6c 65 74 20 74 2c 6e Point(e){let t,n
00020960: 2c 72 2c 6f 3d 31 2f 30 3b 66 6f 72 28 63 6f 6e ,r,o=1/0;for(con
00020970: 73 74 20 69 20 6f 66 20 74 68 69 73 2e 73 65 67 st i of this.seg
00020980: 6d 65 6e 74 73 29 72 3d 69 2e 6e 65 61 72 65 73 ments)r=i.neares
00020990: 74 50 6f 69 6e 74 28 65 29 2c 6e 3d 73 75 2e 44 tPoint(e),n=su.D
000209a0: 69 73 74 32 28 72 2c 65 29 2c 6e 3c 6f 26 26 28 ist2(r,e),n<o&&(
000209b0: 74 3d 72 2c 6f 3d 6e 29 3b 69 66 28 21 74 29 74 t=r,o=n);if(!t)t
000209c0: 68 72 6f 77 20 45 72 72 6f 72 28 22 6e 65 61 72 hrow Error("near
000209d0: 65 73 74 20 70 6f 69 6e 74 20 6e 6f 74 20 66 6f est point not fo
000209e0: 75 6e 64 22 29 3b 72 65 74 75 72 6e 20 74 7d 67 und");return t}g
000209f0: 65 74 53 76 67 50 61 74 68 44 61 74 61 28 65 3d etSvgPathData(e=
00020a00: 21 30 29 7b 63 6f 6e 73 74 7b 61 3a 74 2c 62 3a !0){const{a:t,b:
00020a10: 6e 2c 63 3a 72 2c 64 3a 6f 7d 3d 74 68 69 73 3b n,c:r,d:o}=this;
00020a20: 72 65 74 75 72 6e 60 24 7b 65 3f 60 4d 20 24 7b return`${e?`M ${
00020a30: 74 2e 74 6f 46 69 78 65 64 28 29 7d 20 60 3a 22 t.toFixed()} `:"
00020a40: 22 7d 20 43 24 7b 6e 2e 74 6f 46 69 78 65 64 28 "} C${n.toFixed(
00020a50: 29 7d 20 24 7b 72 2e 74 6f 46 69 78 65 64 28 29 )} ${r.toFixed()
00020a60: 7d 20 24 7b 6f 2e 74 6f 46 69 78 65 64 28 29 7d } ${o.toFixed()}
00020a70: 60 7d 73 74 61 74 69 63 20 47 65 74 41 74 54 28 `}static GetAtT(
00020a80: 65 2c 74 29 7b 63 6f 6e 73 74 7b 61 3a 6e 2c 62 e,t){const{a:n,b
00020a90: 3a 72 2c 63 3a 6f 2c 64 3a 69 7d 3d 65 3b 72 65 :r,c:o,d:i}=e;re
00020aa0: 74 75 72 6e 20 6e 65 77 20 73 75 28 28 31 2d 74 turn new su((1-t
00020ab0: 29 2a 28 31 2d 74 29 2a 28 31 2d 74 29 2a 6e 2e )*(1-t)*(1-t)*n.
00020ac0: 78 2b 28 31 2d 74 29 2a 28 31 2d 74 29 2a 33 2a x+(1-t)*(1-t)*3*
00020ad0: 74 2a 72 2e 78 2b 33 2a 28 31 2d 74 29 2a 28 74 t*r.x+3*(1-t)*(t
00020ae0: 2a 74 29 2a 6f 2e 78 2b 74 2a 74 2a 74 2a 69 2e *t)*o.x+t*t*t*i.
00020af0: 78 2c 28 31 2d 74 29 2a 28 31 2d 74 29 2a 28 31 x,(1-t)*(1-t)*(1
00020b00: 2d 74 29 2a 6e 2e 79 2b 28 31 2d 74 29 2a 28 31 -t)*n.y+(1-t)*(1
00020b10: 2d 74 29 2a 33 2a 74 2a 72 2e 79 2b 33 2a 28 31 -t)*3*t*r.y+3*(1
00020b20: 2d 74 29 2a 28 74 2a 74 29 2a 6f 2e 79 2b 74 2a -t)*(t*t)*o.y+t*
00020b30: 74 2a 74 2a 69 2e 79 29 7d 67 65 74 4c 65 6e 67 t*t*i.y)}getLeng
00020b40: 74 68 28 65 3d 33 32 29 7b 6c 65 74 20 74 2c 6e th(e=32){let t,n
00020b50: 3d 74 68 69 73 2e 61 2c 72 3d 30 3b 66 6f 72 28 =this.a,r=0;for(
00020b60: 6c 65 74 20 6f 3d 31 3b 6f 3c 3d 65 3b 6f 2b 2b let o=1;o<=e;o++
00020b70: 29 74 3d 6a 67 2e 47 65 74 41 74 54 28 74 68 69 )t=jg.GetAtT(thi
00020b80: 73 2c 6f 2f 65 29 2c 72 2b 3d 73 75 2e 44 69 73 s,o/e),r+=su.Dis
00020b90: 74 28 6e 2c 74 29 2c 6e 3d 74 3b 72 65 74 75 72 t(n,t),n=t;retur
00020ba0: 6e 20 72 7d 7d 63 6c 61 73 73 20 42 67 20 65 78 n r}}class Bg ex
00020bb0: 74 65 6e 64 73 20 43 70 7b 70 6f 69 6e 74 73 3b tends Cp{points;
00020bc0: 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 29 7b 73 constructor(e){s
00020bd0: 75 70 65 72 28 7b 2e 2e 2e 65 2c 69 73 43 6c 6f uper({...e,isClo
00020be0: 73 65 64 3a 21 31 2c 69 73 46 69 6c 6c 65 64 3a sed:!1,isFilled:
00020bf0: 21 31 7d 29 3b 63 6f 6e 73 74 7b 70 6f 69 6e 74 !1});const{point
00020c00: 73 3a 74 7d 3d 65 3b 74 68 69 73 2e 70 6f 69 6e s:t}=e;this.poin
00020c10: 74 73 3d 74 7d 5f 73 65 67 6d 65 6e 74 73 3b 67 ts=t}_segments;g
00020c20: 65 74 20 73 65 67 6d 65 6e 74 73 28 29 7b 69 66 et segments(){if
00020c30: 28 21 74 68 69 73 2e 5f 73 65 67 6d 65 6e 74 73 (!this._segments
00020c40: 29 7b 74 68 69 73 2e 5f 73 65 67 6d 65 6e 74 73 ){this._segments
00020c50: 3d 5b 5d 3b 63 6f 6e 73 74 7b 70 6f 69 6e 74 73 =[];const{points
00020c60: 3a 65 7d 3d 74 68 69 73 2c 74 3d 65 2e 6c 65 6e :e}=this,t=e.len
00020c70: 67 74 68 2c 6e 3d 74 2d 32 2c 72 3d 31 2e 32 35 gth,n=t-2,r=1.25
00020c80: 3b 66 6f 72 28 6c 65 74 20 6f 3d 30 3b 6f 3c 74 ;for(let o=0;o<t
00020c90: 2d 31 3b 6f 2b 2b 29 7b 63 6f 6e 73 74 20 74 3d -1;o++){const t=
00020ca0: 30 3d 3d 3d 6f 3f 65 5b 30 5d 3a 65 5b 6f 2d 31 0===o?e[0]:e[o-1
00020cb0: 5d 2c 69 3d 65 5b 6f 5d 2c 61 3d 65 5b 6f 2b 31 ],i=e[o],a=e[o+1
00020cc0: 5d 2c 73 3d 6f 3d 3d 3d 6e 3f 61 3a 65 5b 6f 2b ],s=o===n?a:e[o+
00020cd0: 32 5d 2c 6c 3d 69 2c 63 3d 30 3d 3d 3d 6f 3f 74 2],l=i,c=0===o?t
00020ce0: 3a 6e 65 77 20 73 75 28 69 2e 78 2b 28 61 2e 78 :new su(i.x+(a.x
00020cf0: 2d 74 2e 78 29 2f 36 2a 72 2c 69 2e 79 2b 28 61 -t.x)/6*r,i.y+(a
00020d00: 2e 79 2d 74 2e 79 29 2f 36 2a 72 29 2c 75 3d 6f .y-t.y)/6*r),u=o
00020d10: 3d 3d 3d 6e 3f 61 3a 6e 65 77 20 73 75 28 61 2e ===n?a:new su(a.
00020d20: 78 2d 28 73 2e 78 2d 69 2e 78 29 2f 36 2a 72 2c x-(s.x-i.x)/6*r,
00020d30: 61 2e 79 2d 28 73 2e 79 2d 69 2e 79 29 2f 36 2a a.y-(s.y-i.y)/6*
00020d40: 72 29 2c 64 3d 61 3b 74 68 69 73 2e 5f 73 65 67 r),d=a;this._seg
00020d50: 6d 65 6e 74 73 2e 70 75 73 68 28 6e 65 77 20 6a ments.push(new j
00020d60: 67 28 7b 73 74 61 72 74 3a 6c 2c 63 70 31 3a 63 g({start:l,cp1:c
00020d70: 2c 63 70 32 3a 75 2c 65 6e 64 3a 64 7d 29 29 7d ,cp2:u,end:d}))}
00020d80: 7d 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 65 }return this._se
00020d90: 67 6d 65 6e 74 73 7d 67 65 74 4c 65 6e 67 74 68 gments}getLength
00020da0: 28 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e 73 (){return this.s
00020db0: 65 67 6d 65 6e 74 73 2e 72 65 64 75 63 65 28 28 egments.reduce((
00020dc0: 28 65 2c 74 29 3d 3e 65 2b 74 2e 6c 65 6e 67 74 (e,t)=>e+t.lengt
00020dd0: 68 29 2c 30 29 7d 67 65 74 56 65 72 74 69 63 65 h),0)}getVertice
00020de0: 73 28 29 7b 63 6f 6e 73 74 20 65 3d 74 68 69 73 s(){const e=this
00020df0: 2e 73 65 67 6d 65 6e 74 73 2e 72 65 64 75 63 65 .segments.reduce
00020e00: 28 28 28 65 2c 74 29 3d 3e 65 2e 63 6f 6e 63 61 (((e,t)=>e.conca
00020e10: 74 28 74 2e 76 65 72 74 69 63 65 73 29 29 2c 5b t(t.vertices)),[
00020e20: 5d 29 3b 72 65 74 75 72 6e 20 65 2e 70 75 73 68 ]);return e.push
00020e30: 28 74 68 69 73 2e 70 6f 69 6e 74 73 5b 74 68 69 (this.points[thi
00020e40: 73 2e 70 6f 69 6e 74 73 2e 6c 65 6e 67 74 68 2d s.points.length-
00020e50: 31 5d 29 2c 65 7d 6e 65 61 72 65 73 74 50 6f 69 1]),e}nearestPoi
00020e60: 6e 74 28 65 29 7b 6c 65 74 20 74 2c 6e 2c 72 2c nt(e){let t,n,r,
00020e70: 6f 3d 31 2f 30 3b 66 6f 72 28 63 6f 6e 73 74 20 o=1/0;for(const
00020e80: 69 20 6f 66 20 74 68 69 73 2e 73 65 67 6d 65 6e i of this.segmen
00020e90: 74 73 29 72 3d 69 2e 6e 65 61 72 65 73 74 50 6f ts)r=i.nearestPo
00020ea0: 69 6e 74 28 65 29 2c 6e 3d 73 75 2e 44 69 73 74 int(e),n=su.Dist
00020eb0: 32 28 72 2c 65 29 2c 6e 3c 6f 26 26 28 74 3d 72 2(r,e),n<o&&(t=r
00020ec0: 2c 6f 3d 6e 29 3b 69 66 28 21 74 29 74 68 72 6f ,o=n);if(!t)thro
00020ed0: 77 20 45 72 72 6f 72 28 22 6e 65 61 72 65 73 74 w Error("nearest
00020ee0: 20 70 6f 69 6e 74 20 6e 6f 74 20 66 6f 75 6e 64 point not found
00020ef0: 22 29 3b 72 65 74 75 72 6e 20 74 7d 68 69 74 54 ");return t}hitT
00020f00: 65 73 74 4c 69 6e 65 53 65 67 6d 65 6e 74 28 65 estLineSegment(e
00020f10: 2c 74 29 7b 72 65 74 75 72 6e 20 74 68 69 73 2e ,t){return this.
00020f20: 73 65 67 6d 65 6e 74 73 2e 73 6f 6d 65 28 28 6e segments.some((n
00020f30: 3d 3e 6e 2e 68 69 74 54 65 73 74 4c 69 6e 65 53 =>n.hitTestLineS
00020f40: 65 67 6d 65 6e 74 28 65 2c 74 29 29 29 7d 67 65 egment(e,t)))}ge
00020f50: 74 53 76 67 50 61 74 68 44 61 74 61 28 29 7b 6c tSvgPathData(){l
00020f60: 65 74 20 65 3d 74 68 69 73 2e 73 65 67 6d 65 6e et e=this.segmen
00020f70: 74 73 2e 72 65 64 75 63 65 28 28 28 65 2c 74 2c ts.reduce(((e,t,
00020f80: 6e 29 3d 3e 65 2b 74 2e 67 65 74 53 76 67 50 61 n)=>e+t.getSvgPa
00020f90: 74 68 44 61 74 61 28 30 3d 3d 3d 6e 29 29 2c 22 thData(0===n)),"
00020fa0: 22 29 3b 72 65 74 75 72 6e 20 74 68 69 73 2e 69 ");return this.i
00020fb0: 73 43 6c 6f 73 65 64 26 26 28 65 2b 3d 22 5a 22 sClosed&&(e+="Z"
00020fc0: 29 2c 65 7d 7d 63 6c 61 73 73 20 55 67 20 65 78 ),e}}class Ug ex
00020fd0: 74 65 6e 64 73 20 43 70 7b 63 6f 6e 73 74 72 75 tends Cp{constru
00020fe0: 63 74 6f 72 28 65 29 7b 73 75 70 65 72 28 7b 2e ctor(e){super({.
00020ff0: 2e 2e 65 2c 69 73 43 6c 6f 73 65 64 3a 21 30 7d ..e,isClosed:!0}
00021000: 29 2c 74 68 69 73 2e 63 6f 6e 66 69 67 3d 65 3b ),this.config=e;
00021010: 63 6f 6e 73 74 7b 77 69 64 74 68 3a 74 2c 68 65 const{width:t,he
00021020: 69 67 68 74 3a 6e 7d 3d 65 3b 74 68 69 73 2e 77 ight:n}=e;this.w
00021030: 3d 74 2c 74 68 69 73 2e 68 3d 6e 7d 77 3b 68 3b =t,this.h=n}w;h;
00021040: 5f 65 64 67 65 73 3b 67 65 74 20 65 64 67 65 73 _edges;get edges
00021050: 28 29 7b 69 66 28 21 74 68 69 73 2e 5f 65 64 67 (){if(!this._edg
00021060: 65 73 29 7b 63 6f 6e 73 74 7b 76 65 72 74 69 63 es){const{vertic
00021070: 65 73 3a 65 7d 3d 74 68 69 73 3b 74 68 69 73 2e es:e}=this;this.
00021080: 5f 65 64 67 65 73 3d 5b 5d 3b 66 6f 72 28 6c 65 _edges=[];for(le
00021090: 74 20 74 3d 30 2c 6e 3d 65 2e 6c 65 6e 67 74 68 t t=0,n=e.length
000210a0: 3b 74 3c 6e 3b 74 2b 2b 29 7b 63 6f 6e 73 74 20 ;t<n;t++){const
000210b0: 72 3d 65 5b 74 5d 2c 6f 3d 65 5b 28 74 2b 31 29 r=e[t],o=e[(t+1)
000210c0: 25 6e 5d 3b 74 68 69 73 2e 5f 65 64 67 65 73 2e %n];this._edges.
000210d0: 70 75 73 68 28 6e 65 77 20 6b 68 28 7b 73 74 61 push(new kh({sta
000210e0: 72 74 3a 72 2c 65 6e 64 3a 6f 7d 29 29 7d 7d 72 rt:r,end:o}))}}r
000210f0: 65 74 75 72 6e 20 74 68 69 73 2e 5f 65 64 67 65 eturn this._edge
00021100: 73 7d 67 65 74 56 65 72 74 69 63 65 73 28 29 7b s}getVertices(){
00021110: 63 6f 6e 73 74 20 65 3d 4d 61 74 68 2e 6d 61 78 const e=Math.max
00021120: 28 31 2c 74 68 69 73 2e 77 29 2f 32 2c 74 3d 4d (1,this.w)/2,t=M
00021130: 61 74 68 2e 6d 61 78 28 31 2c 74 68 69 73 2e 68 ath.max(1,this.h
00021140: 29 2f 32 2c 6e 3d 4d 61 74 68 2e 70 6f 77 28 65 )/2,n=Math.pow(e
00021150: 2d 74 2c 32 29 2f 4d 61 74 68 2e 70 6f 77 28 65 -t,2)/Math.pow(e
00021160: 2b 74 2c 32 29 2c 72 3d 44 67 28 64 75 2a 28 65 +t,2),r=Dg(du*(e
00021170: 2b 74 29 2a 28 31 2b 33 2a 6e 2f 28 31 30 2b 4d +t)*(1+3*n/(10+M
00021180: 61 74 68 2e 73 71 72 74 28 34 2d 33 2a 6e 29 29 ath.sqrt(4-3*n))
00021190: 29 29 2c 6f 3d 66 75 2f 72 2c 69 3d 4d 61 74 68 )),o=fu/r,i=Math
000211a0: 2e 63 6f 73 28 6f 29 2c 61 3d 4d 61 74 68 2e 73 .cos(o),a=Math.s
000211b0: 69 6e 28 6f 29 3b 6c 65 74 20 73 3d 30 2c 6c 3d in(o);let s=0,l=
000211c0: 31 2c 63 3d 30 2c 75 3d 31 3b 63 6f 6e 73 74 20 1,c=0,u=1;const
000211d0: 64 3d 41 72 72 61 79 28 72 29 3b 66 6f 72 28 6c d=Array(r);for(l
000211e0: 65 74 20 6e 3d 30 3b 6e 3c 72 3b 6e 2b 2b 29 64 et n=0;n<r;n++)d
000211f0: 5b 6e 5d 3d 6e 65 77 20 73 75 28 65 2b 65 2a 6c [n]=new su(e+e*l
00021200: 2c 74 2b 74 2a 73 29 2c 63 3d 61 2a 6c 2b 69 2a ,t+t*s),c=a*l+i*
00021210: 73 2c 75 3d 69 2a 6c 2d 61 2a 73 2c 73 3d 63 2c s,u=i*l-a*s,s=c,
00021220: 6c 3d 75 3b 72 65 74 75 72 6e 20 64 7d 6e 65 61 l=u;return d}nea
00021230: 72 65 73 74 50 6f 69 6e 74 28 65 29 7b 6c 65 74 restPoint(e){let
00021240: 20 74 2c 6e 2c 72 2c 6f 3d 31 2f 30 3b 66 6f 72 t,n,r,o=1/0;for
00021250: 28 63 6f 6e 73 74 20 69 20 6f 66 20 74 68 69 73 (const i of this
00021260: 2e 65 64 67 65 73 29 72 3d 69 2e 6e 65 61 72 65 .edges)r=i.neare
00021270: 73 74 50 6f 69 6e 74 28 65 29 2c 6e 3d 73 75 2e stPoint(e),n=su.
00021280: 44 69 73 74 32 28 72 2c 65 29 2c 6e 3c 6f 26 26 Dist2(r,e),n<o&&
00021290: 28 74 3d 72 2c 6f 3d 6e 29 3b 69 66 28 21 74 29 (t=r,o=n);if(!t)
000212a0: 74 68 72 6f 77 20 45 72 72 6f 72 28 22 6e 65 61 throw Error("nea
000212b0: 72 65 73 74 20 70 6f 69 6e 74 20 6e 6f 74 20 66 rest point not f
000212c0: 6f 75 6e 64 22 29 3b 72 65 74 75 72 6e 20 74 7d ound");return t}
000212d0: 68 69 74 54 65 73 74 4c 69 6e 65 53 65 67 6d 65 hitTestLineSegme
000212e0: 6e 74 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 74 nt(e,t){return t
000212f0: 68 69 73 2e 65 64 67 65 73 2e 73 6f 6d 65 28 28 his.edges.some((
00021300: 6e 3d 3e 6e 2e 68 69 74 54 65 73 74 4c 69 6e 65 n=>n.hitTestLine
00021310: 53 65 67 6d 65 6e 74 28 65 2c 74 29 29 29 7d 67 Segment(e,t)))}g
00021320: 65 74 42 6f 75 6e 64 73 28 29 7b 72 65 74 75 72 etBounds(){retur
00021330: 6e 20 6e 65 77 20 5f 70 28 30 2c 30 2c 74 68 69 n new _p(0,0,thi
00021340: 73 2e 77 2c 74 68 69 73 2e 68 29 7d 67 65 74 4c s.w,this.h)}getL
00021350: 65 6e 67 74 68 28 29 7b 63 6f 6e 73 74 7b 77 3a ength(){const{w:
00021360: 65 2c 68 3a 74 7d 3d 74 68 69 73 2c 6e 3d 65 2f e,h:t}=this,n=e/
00021370: 32 2c 72 3d 74 2f 32 3b 72 65 74 75 72 6e 20 79 2,r=t/2;return y
00021380: 75 28 4d 61 74 68 2e 6d 61 78 28 30 2c 6e 29 2c u(Math.max(0,n),
00021390: 4d 61 74 68 2e 6d 61 78 28 30 2c 72 29 29 7d 67 Math.max(0,r))}g
000213a0: 65 74 53 76 67 50 61 74 68 44 61 74 61 28 65 3d etSvgPathData(e=
000213b0: 21 31 29 7b 63 6f 6e 73 74 7b 77 3a 74 2c 68 3a !1){const{w:t,h:
000213c0: 6e 7d 3d 74 68 69 73 2c 72 3d 74 2f 32 2c 6f 3d n}=this,r=t/2,o=
000213d0: 6e 2f 32 2c 69 3d 4d 61 74 68 2e 6d 61 78 28 30 n/2,i=Math.max(0
000213e0: 2c 72 29 2c 61 3d 4d 61 74 68 2e 6d 61 78 28 30 ,r),a=Math.max(0
000213f0: 2c 6f 29 3b 72 65 74 75 72 6e 60 24 7b 65 3f 60 ,o);return`${e?`
00021400: 4d 24 7b 72 2d 69 7d 2c 24 7b 6f 7d 60 3a 22 22 M${r-i},${o}`:""
00021410: 7d 20 61 24 7b 69 7d 2c 24 7b 61 7d 2c 30 2c 31 } a${i},${a},0,1
00021420: 2c 31 2c 24 7b 32 2a 69 7d 2c 30 61 24 7b 69 7d ,1,${2*i},0a${i}
00021430: 2c 24 7b 61 7d 2c 30 2c 31 2c 31 2c 2d 24 7b 32 ,${a},0,1,1,-${2
00021440: 2a 69 7d 2c 30 60 7d 7d 63 6c 61 73 73 20 7a 67 *i},0`}}class zg
00021450: 20 65 78 74 65 6e 64 73 20 43 70 7b 63 6f 6e 73 extends Cp{cons
00021460: 74 72 75 63 74 6f 72 28 65 29 7b 73 75 70 65 72 tructor(e){super
00021470: 28 7b 2e 2e 2e 65 2c 69 73 43 6c 6f 73 65 64 3a ({...e,isClosed:
00021480: 21 30 7d 29 2c 74 68 69 73 2e 63 6f 6e 66 69 67 !0}),this.config
00021490: 3d 65 3b 63 6f 6e 73 74 7b 77 69 64 74 68 3a 74 =e;const{width:t
000214a0: 2c 68 65 69 67 68 74 3a 6e 7d 3d 65 3b 69 66 28 ,height:n}=e;if(
000214b0: 74 68 69 73 2e 77 3d 74 2c 74 68 69 73 2e 68 3d this.w=t,this.h=
000214c0: 6e 2c 6e 3e 74 29 7b 63 6f 6e 73 74 20 65 3d 74 n,n>t){const e=t
000214d0: 2f 32 3b 74 68 69 73 2e 61 3d 6e 65 77 20 4c 67 /2;this.a=new Lg
000214e0: 28 7b 73 74 61 72 74 3a 6e 65 77 20 73 75 28 30 ({start:new su(0
000214f0: 2c 65 29 2c 65 6e 64 3a 6e 65 77 20 73 75 28 74 ,e),end:new su(t
00021500: 2c 65 29 2c 63 65 6e 74 65 72 3a 6e 65 77 20 73 ,e),center:new s
00021510: 75 28 74 2f 32 2c 65 29 2c 73 77 65 65 70 46 6c u(t/2,e),sweepFl
00021520: 61 67 3a 31 2c 6c 61 72 67 65 41 72 63 46 6c 61 ag:1,largeArcFla
00021530: 67 3a 31 7d 29 2c 74 68 69 73 2e 62 3d 6e 65 77 g:1}),this.b=new
00021540: 20 6b 68 28 7b 73 74 61 72 74 3a 6e 65 77 20 73 kh({start:new s
00021550: 75 28 74 2c 65 29 2c 65 6e 64 3a 6e 65 77 20 73 u(t,e),end:new s
00021560: 75 28 74 2c 6e 2d 65 29 7d 29 2c 74 68 69 73 2e u(t,n-e)}),this.
00021570: 63 3d 6e 65 77 20 4c 67 28 7b 73 74 61 72 74 3a c=new Lg({start:
00021580: 6e 65 77 20 73 75 28 74 2c 6e 2d 65 29 2c 65 6e new su(t,n-e),en
00021590: 64 3a 6e 65 77 20 73 75 28 30 2c 6e 2d 65 29 2c d:new su(0,n-e),
000215a0: 63 65 6e 74 65 72 3a 6e 65 77 20 73 75 28 74 2f center:new su(t/
000215b0: 32 2c 6e 2d 65 29 2c 73 77 65 65 70 46 6c 61 67 2,n-e),sweepFlag
000215c0: 3a 31 2c 6c 61 72 67 65 41 72 63 46 6c 61 67 3a :1,largeArcFlag:
000215d0: 31 7d 29 2c 74 68 69 73 2e 64 3d 6e 65 77 20 6b 1}),this.d=new k
000215e0: 68 28 7b 73 74 61 72 74 3a 6e 65 77 20 73 75 28 h({start:new su(
000215f0: 30 2c 6e 2d 65 29 2c 65 6e 64 3a 6e 65 77 20 73 0,n-e),end:new s
00021600: 75 28 30 2c 65 29 7d 29 7d 65 6c 73 65 7b 63 6f u(0,e)})}else{co
00021610: 6e 73 74 20 65 3d 6e 2f 32 3b 74 68 69 73 2e 61 nst e=n/2;this.a
00021620: 3d 6e 65 77 20 4c 67 28 7b 73 74 61 72 74 3a 6e =new Lg({start:n
00021630: 65 77 20 73 75 28 65 2c 6e 29 2c 65 6e 64 3a 6e ew su(e,n),end:n
00021640: 65 77 20 73 75 28 65 2c 30 29 2c 63 65 6e 74 65 ew su(e,0),cente
00021650: 72 3a 6e 65 77 20 73 75 28 65 2c 65 29 2c 73 77 r:new su(e,e),sw
00021660: 65 65 70 46 6c 61 67 3a 31 2c 6c 61 72 67 65 41 eepFlag:1,largeA
00021670: 72 63 46 6c 61 67 3a 31 7d 29 2c 74 68 69 73 2e rcFlag:1}),this.
00021680: 62 3d 6e 65 77 20 6b 68 28 7b 73 74 61 72 74 3a b=new kh({start:
00021690: 6e 65 77 20 73 75 28 65 2c 30 29 2c 65 6e 64 3a new su(e,0),end:
000216a0: 6e 65 77 20 73 75 28 74 2d 65 2c 30 29 7d 29 2c new su(t-e,0)}),
000216b0: 74 68 69 73 2e 63 3d 6e 65 77 20 4c 67 28 7b 73 this.c=new Lg({s
000216c0: 74 61 72 74 3a 6e 65 77 20 73 75 28 74 2d 65 2c tart:new su(t-e,
000216d0: 30 29 2c 65 6e 64 3a 6e 65 77 20 73 75 28 74 2d 0),end:new su(t-
000216e0: 65 2c 6e 29 2c 63 65 6e 74 65 72 3a 6e 65 77 20 e,n),center:new
000216f0: 73 75 28 74 2d 65 2c 65 29 2c 73 77 65 65 70 46 su(t-e,e),sweepF
00021700: 6c 61 67 3a 31 2c 6c 61 72 67 65 41 72 63 46 6c lag:1,largeArcFl
00021710: 61 67 3a 31 7d 29 2c 74 68 69 73 2e 64 3d 6e 65 ag:1}),this.d=ne
00021720: 77 20 6b 68 28 7b 73 74 61 72 74 3a 6e 65 77 20 w kh({start:new
00021730: 73 75 28 74 2d 65 2c 6e 29 2c 65 6e 64 3a 6e 65 su(t-e,n),end:ne
00021740: 77 20 73 75 28 65 2c 6e 29 7d 29 7d 7d 77 3b 68 w su(e,n)})}}w;h
00021750: 3b 61 3b 62 3b 63 3b 64 3b 6e 65 61 72 65 73 74 ;a;b;c;d;nearest
00021760: 50 6f 69 6e 74 28 65 29 7b 6c 65 74 20 74 2c 6e Point(e){let t,n
00021770: 2c 72 2c 6f 3d 31 2f 30 3b 63 6f 6e 73 74 7b 61 ,r,o=1/0;const{a
00021780: 3a 69 2c 62 3a 61 2c 63 3a 73 2c 64 3a 6c 7d 3d :i,b:a,c:s,d:l}=
00021790: 74 68 69 73 3b 66 6f 72 28 63 6f 6e 73 74 20 63 this;for(const c
000217a0: 20 6f 66 5b 69 2c 61 2c 73 2c 6c 5d 29 72 3d 63 of[i,a,s,l])r=c
000217b0: 2e 6e 65 61 72 65 73 74 50 6f 69 6e 74 28 65 29 .nearestPoint(e)
000217c0: 2c 6e 3d 73 75 2e 44 69 73 74 32 28 72 2c 65 29 ,n=su.Dist2(r,e)
000217d0: 2c 6e 3c 6f 26 26 28 74 3d 72 2c 6f 3d 6e 29 3b ,n<o&&(t=r,o=n);
000217e0: 69 66 28 21 74 29 74 68 72 6f 77 20 45 72 72 6f if(!t)throw Erro
000217f0: 72 28 22 6e 65 61 72 65 73 74 20 70 6f 69 6e 74 r("nearest point
00021800: 20 6e 6f 74 20 66 6f 75 6e 64 22 29 3b 72 65 74 not found");ret
00021810: 75 72 6e 20 74 7d 68 69 74 54 65 73 74 4c 69 6e urn t}hitTestLin
00021820: 65 53 65 67 6d 65 6e 74 28 65 2c 74 29 7b 63 6f eSegment(e,t){co
00021830: 6e 73 74 7b 61 3a 6e 2c 62 3a 72 2c 63 3a 6f 2c nst{a:n,b:r,c:o,
00021840: 64 3a 69 7d 3d 74 68 69 73 3b 72 65 74 75 72 6e d:i}=this;return
00021850: 5b 6e 2c 72 2c 6f 2c 69 5d 2e 73 6f 6d 65 28 28 [n,r,o,i].some((
00021860: 6e 3d 3e 6e 2e 68 69 74 54 65 73 74 4c 69 6e 65 n=>n.hitTestLine
00021870: 53 65 67 6d 65 6e 74 28 65 2c 74 29 29 29 7d 67 Segment(e,t)))}g
00021880: 65 74 56 65 72 74 69 63 65 73 28 29 7b 63 6f 6e etVertices(){con
00021890: 73 74 7b 61 3a 65 2c 62 3a 74 2c 63 3a 6e 2c 64 st{a:e,b:t,c:n,d
000218a0: 3a 72 7d 3d 74 68 69 73 3b 72 65 74 75 72 6e 5b :r}=this;return[
000218b0: 65 2c 74 2c 6e 2c 72 5d 2e 72 65 64 75 63 65 28 e,t,n,r].reduce(
000218c0: 28 28 65 2c 74 29 3d 3e 28 65 2e 70 75 73 68 28 ((e,t)=>(e.push(
000218d0: 2e 2e 2e 74 2e 76 65 72 74 69 63 65 73 29 2c 65 ...t.vertices),e
000218e0: 29 29 2c 5b 5d 29 7d 67 65 74 42 6f 75 6e 64 73 )),[])}getBounds
000218f0: 28 29 7b 72 65 74 75 72 6e 20 6e 65 77 20 5f 70 (){return new _p
00021900: 28 30 2c 30 2c 74 68 69 73 2e 77 2c 74 68 69 73 (0,0,this.w,this
00021910: 2e 68 29 7d 67 65 74 4c 65 6e 67 74 68 28 29 7b .h)}getLength(){
00021920: 63 6f 6e 73 74 7b 68 3a 65 2c 77 3a 74 7d 3d 74 const{h:e,w:t}=t
00021930: 68 69 73 3b 72 65 74 75 72 6e 20 65 3e 74 3f 32 his;return e>t?2
00021940: 2a 28 64 75 2a 28 74 2f 32 29 2b 28 65 2d 74 29 *(du*(t/2)+(e-t)
00021950: 29 3a 32 2a 28 64 75 2a 28 65 2f 32 29 2b 28 74 ):2*(du*(e/2)+(t
00021960: 2d 65 29 29 7d 67 65 74 53 76 67 50 61 74 68 44 -e))}getSvgPathD
00021970: 61 74 61 28 29 7b 63 6f 6e 73 74 7b 61 3a 65 2c ata(){const{a:e,
00021980: 62 3a 74 2c 63 3a 6e 2c 64 3a 72 7d 3d 74 68 69 b:t,c:n,d:r}=thi
00021990: 73 3b 72 65 74 75 72 6e 5b 65 2c 74 2c 6e 2c 72 s;return[e,t,n,r
000219a0: 5d 2e 6d 61 70 28 28 28 65 2c 74 29 3d 3e 65 2e ].map(((e,t)=>e.
000219b0: 67 65 74 53 76 67 50 61 74 68 44 61 74 61 28 30 getSvgPathData(0
000219c0: 3d 3d 3d 74 29 29 29 2e 6a 6f 69 6e 28 22 20 22 ===t))).join(" "
000219d0: 29 2b 22 20 5a 22 7d 7d 22 75 6e 64 65 66 69 6e )+" Z"}}"undefin
000219e0: 65 64 22 21 3d 74 79 70 65 6f 66 20 77 69 6e 64 ed"!=typeof wind
000219f0: 6f 77 26 26 28 77 69 6e 64 6f 77 2e 5f 5f 74 6c ow&&(window.__tl
00021a00: 64 72 61 77 5f 5f 68 61 72 64 52 65 73 65 74 3d draw__hardReset=
00021a10: 61 73 79 6e 63 20 66 75 6e 63 74 69 6f 6e 28 7b async function({
00021a20: 73 68 6f 75 6c 64 52 65 6c 6f 61 64 3a 65 3d 21 shouldReload:e=!
00021a30: 30 7d 3d 7b 7d 29 7b 21 66 75 6e 63 74 69 6f 6e 0}={}){!function
00021a40: 28 29 7b 74 72 79 7b 73 65 73 73 69 6f 6e 53 74 (){try{sessionSt
00021a50: 6f 72 61 67 65 2e 63 6c 65 61 72 28 29 7d 63 61 orage.clear()}ca
00021a60: 74 63 68 7b 7d 7d 28 29 2c 61 77 61 69 74 20 50 tch{}}(),await P
00021a70: 72 6f 6d 69 73 65 2e 61 6c 6c 28 61 67 28 29 2e romise.all(ag().
00021a80: 6d 61 70 28 28 65 3d 3e 28 30 2c 65 67 2e 64 65 map((e=>(0,eg.de
00021a90: 6c 65 74 65 44 42 29 28 65 29 29 29 29 2c 66 75 leteDB)(e)))),fu
00021aa0: 6e 63 74 69 6f 6e 28 29 7b 74 72 79 7b 6c 6f 63 nction(){try{loc
00021ab0: 61 6c 53 74 6f 72 61 67 65 2e 63 6c 65 61 72 28 alStorage.clear(
00021ac0: 29 7d 63 61 74 63 68 7b 7d 7d 28 29 2c 65 26 26 )}catch{}}(),e&&
00021ad0: 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e window.location.
00021ae0: 72 65 6c 6f 61 64 28 29 7d 29 3b 63 6f 6e 73 74 reload()});const
00021af0: 20 47 67 3d 22 54 4c 44 52 41 57 5f 41 53 53 45 Gg="TLDRAW_ASSE
00021b00: 54 5f 53 54 4f 52 45 5f 76 31 22 2c 48 67 3d 7b T_STORE_v1",Hg={
00021b10: 41 73 73 65 74 73 3a 22 61 73 73 65 74 73 22 7d Assets:"assets"}
00021b20: 3b 61 73 79 6e 63 20 66 75 6e 63 74 69 6f 6e 20 ;async function
00021b30: 56 67 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d Vg(e,t){const n=
00021b40: 61 77 61 69 74 28 30 2c 65 67 2e 6f 70 65 6e 44 await(0,eg.openD
00021b50: 42 29 28 65 2c 31 2c 7b 75 70 67 72 61 64 65 28 B)(e,1,{upgrade(
00021b60: 65 29 7b 65 2e 6f 62 6a 65 63 74 53 74 6f 72 65 e){e.objectStore
00021b70: 4e 61 6d 65 73 2e 63 6f 6e 74 61 69 6e 73 28 48 Names.contains(H
00021b80: 67 2e 41 73 73 65 74 73 29 7c 7c 65 2e 63 72 65 g.Assets)||e.cre
00021b90: 61 74 65 4f 62 6a 65 63 74 53 74 6f 72 65 28 48 ateObjectStore(H
00021ba0: 67 2e 41 73 73 65 74 73 29 7d 7d 29 3b 74 72 79 g.Assets)}});try
00021bb0: 7b 72 65 74 75 72 6e 20 61 77 61 69 74 20 74 28 {return await t(
00021bc0: 6e 29 7d 66 69 6e 61 6c 6c 79 7b 6e 2e 63 6c 6f n)}finally{n.clo
00021bd0: 73 65 28 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 71 se()}}function q
00021be0: 67 28 7b 63 68 69 6c 64 72 65 6e 3a 65 7d 29 7b g({children:e}){
00021bf0: 63 6f 6e 73 74 20 74 3d 72 75 28 29 3b 72 65 74 const t=ru();ret
00021c00: 75 72 6e 20 64 61 28 22 73 68 6f 75 6c 64 44 69 urn da("shouldDi
00021c10: 73 70 6c 61 79 48 61 6e 64 6c 65 73 22 2c 28 28 splayHandles",((
00021c20: 29 3d 3e 7b 69 66 28 74 2e 69 73 49 6e 41 6e 79 )=>{if(t.isInAny
00021c30: 28 22 73 65 6c 65 63 74 2e 69 64 6c 65 22 2c 22 ("select.idle","
00021c40: 73 65 6c 65 63 74 2e 70 6f 69 6e 74 69 6e 67 5f select.pointing_
00021c50: 68 61 6e 64 6c 65 22 2c 22 73 65 6c 65 63 74 2e handle","select.
00021c60: 70 6f 69 6e 74 69 6e 67 5f 73 68 61 70 65 22 29 pointing_shape")
00021c70: 29 72 65 74 75 72 6e 21 30 3b 69 66 28 74 2e 69 )return!0;if(t.i
00021c80: 73 49 6e 41 6e 79 28 22 73 65 6c 65 63 74 2e 65 sInAny("select.e
00021c90: 64 69 74 69 6e 67 5f 73 68 61 70 65 22 29 29 7b diting_shape")){
00021ca0: 63 6f 6e 73 74 20 65 3d 74 2e 67 65 74 4f 6e 6c const e=t.getOnl
00021cb0: 79 53 65 6c 65 63 74 65 64 53 68 61 70 65 28 29 ySelectedShape()
00021cc0: 3b 72 65 74 75 72 6e 20 65 26 26 74 2e 69 73 53 ;return e&&t.isS
00021cd0: 68 61 70 65 4f 66 54 79 70 65 28 65 2c 22 6e 6f hapeOfType(e,"no
00021ce0: 74 65 22 29 7d 72 65 74 75 72 6e 21 31 7d 29 2c te")}return!1}),
00021cf0: 5b 74 5d 29 3f 28 30 2c 51 63 2e 6a 73 78 29 28 [t])?(0,Qc.jsx)(
00021d00: 22 73 76 67 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 "svg",{className
00021d10: 3a 22 74 6c 2d 75 73 65 72 2d 68 61 6e 64 6c 65 :"tl-user-handle
00021d20: 73 20 74 6c 2d 6f 76 65 72 6c 61 79 73 5f 5f 69 s tl-overlays__i
00021d30: 74 65 6d 22 2c 63 68 69 6c 64 72 65 6e 3a 65 7d tem",children:e}
00021d40: 29 3a 6e 75 6c 6c 7d 63 6f 6e 73 74 7b 50 49 3a ):null}const{PI:
00021d50: 57 67 7d 3d 4d 61 74 68 2c 4b 67 3d 57 67 2b 31 Wg}=Math,Kg=Wg+1
00021d60: 65 2d 34 3b 66 75 6e 63 74 69 6f 6e 20 59 67 28 e-4;function Yg(
00021d70: 65 2c 74 3d 7b 7d 29 7b 63 6f 6e 73 74 7b 73 69 e,t={}){const{si
00021d80: 7a 65 3a 6e 3d 31 36 2c 73 6d 6f 6f 74 68 69 6e ze:n=16,smoothin
00021d90: 67 3a 72 3d 2e 35 7d 3d 74 3b 69 66 28 30 3d 3d g:r=.5}=t;if(0==
00021da0: 3d 65 2e 6c 65 6e 67 74 68 7c 7c 6e 3c 3d 30 29 =e.length||n<=0)
00021db0: 72 65 74 75 72 6e 7b 6c 65 66 74 3a 5b 5d 2c 72 return{left:[],r
00021dc0: 69 67 68 74 3a 5b 5d 7d 3b 63 6f 6e 73 74 20 6f ight:[]};const o
00021dd0: 3d 65 5b 30 5d 2c 69 3d 65 5b 65 2e 6c 65 6e 67 =e[0],i=e[e.leng
00021de0: 74 68 2d 31 5d 2c 61 3d 69 2e 72 75 6e 6e 69 6e th-1],a=i.runnin
00021df0: 67 4c 65 6e 67 74 68 2c 73 3d 4d 61 74 68 2e 70 gLength,s=Math.p
00021e00: 6f 77 28 6e 2a 72 2c 32 29 2c 6c 3d 5b 5d 2c 63 ow(n*r,2),l=[],c
00021e10: 3d 5b 5d 3b 6c 65 74 20 75 2c 64 3d 65 5b 30 5d =[];let u,d=e[0]
00021e20: 2e 76 65 63 74 6f 72 2c 70 3d 65 5b 30 5d 2e 70 .vector,p=e[0].p
00021e30: 6f 69 6e 74 2c 66 3d 70 2c 68 3d 70 2c 6d 3d 66 oint,f=p,h=p,m=f
00021e40: 2c 67 3d 21 31 3b 66 6f 72 28 6c 65 74 20 74 3d ,g=!1;for(let t=
00021e50: 30 3b 74 3c 65 2e 6c 65 6e 67 74 68 3b 74 2b 2b 0;t<e.length;t++
00021e60: 29 7b 75 3d 65 5b 74 5d 3b 63 6f 6e 73 74 7b 70 ){u=e[t];const{p
00021e70: 6f 69 6e 74 3a 6e 2c 76 65 63 74 6f 72 3a 72 7d oint:n,vector:r}
00021e80: 3d 65 5b 74 5d 2c 62 3d 75 2e 76 65 63 74 6f 72 =e[t],b=u.vector
00021e90: 2e 64 70 72 28 64 29 2c 79 3d 28 74 3c 65 2e 6c .dpr(d),y=(t<e.l
00021ea0: 65 6e 67 74 68 2d 31 3f 65 5b 74 2b 31 5d 3a 65 ength-1?e[t+1]:e
00021eb0: 5b 74 5d 29 2e 76 65 63 74 6f 72 2c 76 3d 74 3c [t]).vector,v=t<
00021ec0: 65 2e 6c 65 6e 67 74 68 2d 31 3f 79 2e 64 70 72 e.length-1?y.dpr
00021ed0: 28 75 2e 76 65 63 74 6f 72 29 3a 31 2c 53 3d 6e (u.vector):1,S=n
00021ee0: 75 6c 6c 21 3d 3d 76 26 26 76 3c 2e 32 3b 69 66 ull!==v&&v<.2;if
00021ef0: 28 62 3c 30 26 26 21 67 7c 7c 53 29 7b 69 66 28 (b<0&&!g||S){if(
00021f00: 76 3e 2d 2e 36 32 26 26 61 2d 75 2e 72 75 6e 6e v>-.62&&a-u.runn
00021f10: 69 6e 67 4c 65 6e 67 74 68 3e 75 2e 72 61 64 69 ingLength>u.radi
00021f20: 75 73 29 7b 63 6f 6e 73 74 20 65 3d 64 2e 63 6c us){const e=d.cl
00021f30: 6f 6e 65 28 29 2e 6d 75 6c 28 75 2e 72 61 64 69 one().mul(u.radi
00021f40: 75 73 29 3b 64 2e 63 6c 6f 6e 65 28 29 2e 63 70 us);d.clone().cp
00021f50: 72 28 79 29 3c 30 3f 28 68 3d 73 75 2e 41 64 64 r(y)<0?(h=su.Add
00021f60: 28 6e 2c 65 29 2c 6d 3d 73 75 2e 53 75 62 28 6e (n,e),m=su.Sub(n
00021f70: 2c 65 29 29 3a 28 68 3d 73 75 2e 53 75 62 28 6e ,e)):(h=su.Sub(n
00021f80: 2c 65 29 2c 6d 3d 73 75 2e 41 64 64 28 6e 2c 65 ,e),m=su.Add(n,e
00021f90: 29 29 2c 6c 2e 70 75 73 68 28 68 29 2c 63 2e 70 )),l.push(h),c.p
00021fa0: 75 73 68 28 6d 29 7d 65 6c 73 65 7b 63 6f 6e 73 ush(m)}else{cons
00021fb0: 74 20 65 3d 64 2e 63 6c 6f 6e 65 28 29 2e 6d 75 t e=d.clone().mu
00021fc0: 6c 28 75 2e 72 61 64 69 75 73 29 2e 70 65 72 28 l(u.radius).per(
00021fd0: 29 2c 74 3d 73 75 2e 53 75 62 28 75 2e 69 6e 70 ),t=su.Sub(u.inp
00021fe0: 75 74 2c 65 29 3b 66 6f 72 28 6c 65 74 20 65 3d ut,e);for(let e=
00021ff0: 31 2f 31 33 2c 6e 3d 30 3b 6e 3c 31 3b 6e 2b 3d 1/13,n=0;n<1;n+=
00022000: 65 29 68 3d 73 75 2e 52 6f 74 57 69 74 68 28 74 e)h=su.RotWith(t
00022010: 2c 75 2e 69 6e 70 75 74 2c 4b 67 2a 6e 29 2c 6c ,u.input,Kg*n),l
00022020: 2e 70 75 73 68 28 68 29 2c 6d 3d 73 75 2e 52 6f .push(h),m=su.Ro
00022030: 74 57 69 74 68 28 74 2c 75 2e 69 6e 70 75 74 2c tWith(t,u.input,
00022040: 4b 67 2b 4b 67 2a 2d 6e 29 2c 63 2e 70 75 73 68 Kg+Kg*-n),c.push
00022050: 28 6d 29 7d 70 3d 68 2c 66 3d 6d 2c 53 26 26 28 (m)}p=h,f=m,S&&(
00022060: 67 3d 21 30 29 3b 63 6f 6e 74 69 6e 75 65 7d 69 g=!0);continue}i
00022070: 66 28 67 3d 21 31 2c 75 3d 3d 3d 6f 7c 7c 75 3d f(g=!1,u===o||u=
00022080: 3d 3d 69 29 7b 63 6f 6e 73 74 20 65 3d 73 75 2e ==i){const e=su.
00022090: 50 65 72 28 72 29 2e 6d 75 6c 28 75 2e 72 61 64 Per(r).mul(u.rad
000220a0: 69 75 73 29 3b 6c 2e 70 75 73 68 28 73 75 2e 53 ius);l.push(su.S
000220b0: 75 62 28 6e 2c 65 29 29 2c 63 2e 70 75 73 68 28 ub(n,e)),c.push(
000220c0: 73 75 2e 41 64 64 28 6e 2c 65 29 29 3b 63 6f 6e su.Add(n,e));con
000220d0: 74 69 6e 75 65 7d 63 6f 6e 73 74 20 5f 3d 73 75 tinue}const _=su
000220e0: 2e 4c 72 70 28 79 2c 72 2c 76 29 2e 70 65 72 28 .Lrp(y,r,v).per(
000220f0: 29 2e 6d 75 6c 28 75 2e 72 61 64 69 75 73 29 3b ).mul(u.radius);
00022100: 68 3d 73 75 2e 53 75 62 28 6e 2c 5f 29 2c 28 74 h=su.Sub(n,_),(t
00022110: 3c 3d 31 7c 7c 73 75 2e 44 69 73 74 32 28 70 2c <=1||su.Dist2(p,
00022120: 68 29 3e 73 29 26 26 28 6c 2e 70 75 73 68 28 68 h)>s)&&(l.push(h
00022130: 29 2c 70 3d 68 29 2c 6d 3d 73 75 2e 41 64 64 28 ),p=h),m=su.Add(
00022140: 6e 2c 5f 29 2c 28 74 3c 3d 31 7c 7c 73 75 2e 44 n,_),(t<=1||su.D
00022150: 69 73 74 32 28 66 2c 6d 29 3e 73 29 26 26 28 63 ist2(f,m)>s)&&(c
00022160: 2e 70 75 73 68 28 6d 29 2c 66 3d 6d 29 2c 64 3d .push(m),f=m),d=
00022170: 72 7d 72 65 74 75 72 6e 7b 6c 65 66 74 3a 6c 2c r}return{left:l,
00022180: 72 69 67 68 74 3a 63 7d 7d 66 75 6e 63 74 69 6f right:c}}functio
00022190: 6e 20 58 67 28 65 2c 74 3d 7b 7d 29 7b 63 6f 6e n Xg(e,t={}){con
000221a0: 73 74 7b 73 69 7a 65 3a 6e 3d 31 36 2c 73 74 61 st{size:n=16,sta
000221b0: 72 74 3a 72 3d 7b 7d 2c 65 6e 64 3a 6f 3d 7b 7d rt:r={},end:o={}
000221c0: 2c 6c 61 73 74 3a 69 3d 21 31 7d 3d 74 2c 7b 63 ,last:i=!1}=t,{c
000221d0: 61 70 3a 61 3d 21 30 7d 3d 72 2c 7b 63 61 70 3a ap:a=!0}=r,{cap:
000221e0: 73 3d 21 30 7d 3d 6f 3b 69 66 28 30 3d 3d 3d 65 s=!0}=o;if(0===e
000221f0: 2e 6c 65 6e 67 74 68 7c 7c 6e 3c 3d 30 29 72 65 .length||n<=0)re
00022200: 74 75 72 6e 5b 5d 3b 63 6f 6e 73 74 20 6c 3d 65 turn[];const l=e
00022210: 5b 30 5d 2c 63 3d 65 5b 65 2e 6c 65 6e 67 74 68 [0],c=e[e.length
00022220: 2d 31 5d 2c 75 3d 63 2e 72 75 6e 6e 69 6e 67 4c -1],u=c.runningL
00022230: 65 6e 67 74 68 2c 64 3d 21 31 3d 3d 3d 72 2e 74 ength,d=!1===r.t
00022240: 61 70 65 72 3f 30 3a 21 30 3d 3d 3d 72 2e 74 61 aper?0:!0===r.ta
00022250: 70 65 72 3f 4d 61 74 68 2e 6d 61 78 28 6e 2c 75 per?Math.max(n,u
00022260: 29 3a 72 2e 74 61 70 65 72 2c 70 3d 21 31 3d 3d ):r.taper,p=!1==
00022270: 3d 6f 2e 74 61 70 65 72 3f 30 3a 21 30 3d 3d 3d =o.taper?0:!0===
00022280: 6f 2e 74 61 70 65 72 3f 4d 61 74 68 2e 6d 61 78 o.taper?Math.max
00022290: 28 6e 2c 75 29 3a 6f 2e 74 61 70 65 72 2c 7b 6c (n,u):o.taper,{l
000222a0: 65 66 74 3a 66 2c 72 69 67 68 74 3a 68 7d 3d 59 eft:f,right:h}=Y
000222b0: 67 28 65 2c 74 29 2c 6d 3d 6c 2e 70 6f 69 6e 74 g(e,t),m=l.point
000222c0: 2c 67 3d 65 2e 6c 65 6e 67 74 68 3e 31 3f 65 5b ,g=e.length>1?e[
000222d0: 65 2e 6c 65 6e 67 74 68 2d 31 5d 2e 70 6f 69 6e e.length-1].poin
000222e0: 74 3a 73 75 2e 41 64 64 58 59 28 6c 2e 70 6f 69 t:su.AddXY(l.poi
000222f0: 6e 74 2c 31 2c 31 29 3b 69 66 28 31 3d 3d 3d 65 nt,1,1);if(1===e
00022300: 2e 6c 65 6e 67 74 68 26 26 28 21 64 26 26 21 70 .length&&(!d&&!p
00022310: 7c 7c 69 29 29 7b 63 6f 6e 73 74 20 65 3d 73 75 ||i)){const e=su
00022320: 2e 41 64 64 28 6d 2c 73 75 2e 53 75 62 28 6d 2c .Add(m,su.Sub(m,
00022330: 67 29 2e 75 6e 69 28 29 2e 70 65 72 28 29 2e 6d g).uni().per().m
00022340: 75 6c 28 2d 6c 2e 72 61 64 69 75 73 29 29 2c 74 ul(-l.radius)),t
00022350: 3d 5b 5d 3b 66 6f 72 28 6c 65 74 20 6e 3d 31 2f =[];for(let n=1/
00022360: 31 33 2c 72 3d 6e 3b 72 3c 3d 31 3b 72 2b 3d 6e 13,r=n;r<=1;r+=n
00022370: 29 74 2e 70 75 73 68 28 73 75 2e 52 6f 74 57 69 )t.push(su.RotWi
00022380: 74 68 28 65 2c 6d 2c 32 2a 4b 67 2a 72 29 29 3b th(e,m,2*Kg*r));
00022390: 72 65 74 75 72 6e 20 74 7d 63 6f 6e 73 74 20 62 return t}const b
000223a0: 3d 5b 5d 3b 69 66 28 64 7c 7c 70 26 26 31 3d 3d =[];if(d||p&&1==
000223b0: 3d 65 2e 6c 65 6e 67 74 68 29 3b 65 6c 73 65 20 =e.length);else
000223c0: 69 66 28 61 29 66 6f 72 28 6c 65 74 20 65 3d 31 if(a)for(let e=1
000223d0: 2f 38 2c 74 3d 65 3b 74 3c 3d 31 3b 74 2b 3d 65 /8,t=e;t<=1;t+=e
000223e0: 29 7b 63 6f 6e 73 74 20 65 3d 73 75 2e 52 6f 74 ){const e=su.Rot
000223f0: 57 69 74 68 28 68 5b 30 5d 2c 6d 2c 4b 67 2a 74 With(h[0],m,Kg*t
00022400: 29 3b 62 2e 70 75 73 68 28 65 29 7d 65 6c 73 65 );b.push(e)}else
00022410: 7b 63 6f 6e 73 74 20 65 3d 73 75 2e 53 75 62 28 {const e=su.Sub(
00022420: 66 5b 30 5d 2c 68 5b 30 5d 29 2c 74 3d 73 75 2e f[0],h[0]),t=su.
00022430: 4d 75 6c 28 65 2c 2e 35 29 2c 6e 3d 73 75 2e 4d Mul(e,.5),n=su.M
00022440: 75 6c 28 65 2c 2e 35 31 29 3b 62 2e 70 75 73 68 ul(e,.51);b.push
00022450: 28 73 75 2e 53 75 62 28 6d 2c 74 29 2c 73 75 2e (su.Sub(m,t),su.
00022460: 53 75 62 28 6d 2c 6e 29 2c 73 75 2e 41 64 64 28 Sub(m,n),su.Add(
00022470: 6d 2c 6e 29 2c 73 75 2e 41 64 64 28 6d 2c 74 29 m,n),su.Add(m,t)
00022480: 29 7d 63 6f 6e 73 74 20 79 3d 5b 5d 2c 76 3d 63 )}const y=[],v=c
00022490: 2e 76 65 63 74 6f 72 2e 63 6c 6f 6e 65 28 29 2e .vector.clone().
000224a0: 70 65 72 28 29 2e 6e 65 67 28 29 3b 69 66 28 70 per().neg();if(p
000224b0: 7c 7c 64 26 26 31 3d 3d 3d 65 2e 6c 65 6e 67 74 ||d&&1===e.lengt
000224c0: 68 29 79 2e 70 75 73 68 28 67 29 3b 65 6c 73 65 h)y.push(g);else
000224d0: 20 69 66 28 73 29 7b 63 6f 6e 73 74 20 65 3d 73 if(s){const e=s
000224e0: 75 2e 41 64 64 28 67 2c 73 75 2e 4d 75 6c 28 76 u.Add(g,su.Mul(v
000224f0: 2c 63 2e 72 61 64 69 75 73 29 29 3b 66 6f 72 28 ,c.radius));for(
00022500: 6c 65 74 20 74 3d 31 2f 32 39 2c 6e 3d 74 3b 6e let t=1/29,n=t;n
00022510: 3c 31 3b 6e 2b 3d 74 29 79 2e 70 75 73 68 28 73 <1;n+=t)y.push(s
00022520: 75 2e 52 6f 74 57 69 74 68 28 65 2c 67 2c 33 2a u.RotWith(e,g,3*
00022530: 4b 67 2a 6e 29 29 7d 65 6c 73 65 20 79 2e 70 75 Kg*n))}else y.pu
00022540: 73 68 28 73 75 2e 41 64 64 28 67 2c 73 75 2e 4d sh(su.Add(g,su.M
00022550: 75 6c 28 76 2c 63 2e 72 61 64 69 75 73 29 29 2c ul(v,c.radius)),
00022560: 73 75 2e 41 64 64 28 67 2c 73 75 2e 4d 75 6c 28 su.Add(g,su.Mul(
00022570: 76 2c 2e 39 39 2a 63 2e 72 61 64 69 75 73 29 29 v,.99*c.radius))
00022580: 2c 73 75 2e 53 75 62 28 67 2c 73 75 2e 4d 75 6c ,su.Sub(g,su.Mul
00022590: 28 76 2c 2e 39 39 2a 63 2e 72 61 64 69 75 73 29 (v,.99*c.radius)
000225a0: 29 2c 73 75 2e 53 75 62 28 67 2c 73 75 2e 4d 75 ),su.Sub(g,su.Mu
000225b0: 6c 28 76 2c 63 2e 72 61 64 69 75 73 29 29 29 3b l(v,c.radius)));
000225c0: 72 65 74 75 72 6e 20 66 2e 63 6f 6e 63 61 74 28 return f.concat(
000225d0: 79 2c 68 2e 72 65 76 65 72 73 65 28 29 2c 62 29 y,h.reverse(),b)
000225e0: 7d 63 6f 6e 73 74 20 5a 67 3d 2e 30 32 35 2c 51 }const Zg=.025,Q
000225f0: 67 3d 2e 30 31 3b 66 75 6e 63 74 69 6f 6e 20 4a g=.01;function J
00022600: 67 28 65 2c 74 3d 7b 7d 29 7b 63 6f 6e 73 74 7b g(e,t={}){const{
00022610: 73 74 72 65 61 6d 6c 69 6e 65 3a 6e 3d 2e 35 2c streamline:n=.5,
00022620: 73 69 7a 65 3a 72 3d 31 36 2c 73 69 6d 75 6c 61 size:r=16,simula
00022630: 74 65 50 72 65 73 73 75 72 65 3a 6f 3d 21 31 7d tePressure:o=!1}
00022640: 3d 74 3b 69 66 28 30 3d 3d 3d 65 2e 6c 65 6e 67 =t;if(0===e.leng
00022650: 74 68 29 72 65 74 75 72 6e 5b 5d 3b 63 6f 6e 73 th)return[];cons
00022660: 74 20 69 3d 2e 31 35 2b 2e 38 35 2a 28 31 2d 6e t i=.15+.85*(1-n
00022670: 29 3b 6c 65 74 20 61 3d 65 2e 6d 61 70 28 73 75 );let a=e.map(su
00022680: 2e 46 72 6f 6d 29 2c 73 3d 30 3b 69 66 28 21 6f .From),s=0;if(!o
00022690: 29 7b 6c 65 74 20 65 3d 61 5b 30 5d 3b 66 6f 72 ){let e=a[0];for
000226a0: 28 3b 65 26 26 21 28 65 2e 7a 3e 3d 5a 67 29 3b (;e&&!(e.z>=Zg);
000226b0: 29 61 2e 73 68 69 66 74 28 29 2c 65 3d 61 5b 30 )a.shift(),e=a[0
000226c0: 5d 7d 69 66 28 21 6f 29 7b 6c 65 74 20 65 3d 61 ]}if(!o){let e=a
000226d0: 5b 61 2e 6c 65 6e 67 74 68 2d 31 5d 3b 66 6f 72 [a.length-1];for
000226e0: 28 3b 65 26 26 21 28 65 2e 7a 3e 3d 51 67 29 3b (;e&&!(e.z>=Qg);
000226f0: 29 61 2e 70 6f 70 28 29 2c 65 3d 61 5b 61 2e 6c )a.pop(),e=a[a.l
00022700: 65 6e 67 74 68 2d 31 5d 7d 69 66 28 30 3d 3d 3d ength-1]}if(0===
00022710: 61 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 6e 5b a.length)return[
00022720: 7b 70 6f 69 6e 74 3a 73 75 2e 46 72 6f 6d 28 65 {point:su.From(e
00022730: 5b 30 5d 29 2c 69 6e 70 75 74 3a 73 75 2e 46 72 [0]),input:su.Fr
00022740: 6f 6d 28 65 5b 30 5d 29 2c 70 72 65 73 73 75 72 om(e[0]),pressur
00022750: 65 3a 6f 3f 2e 35 3a 2e 31 35 2c 76 65 63 74 6f e:o?.5:.15,vecto
00022760: 72 3a 6e 65 77 20 73 75 28 31 2c 31 29 2c 64 69 r:new su(1,1),di
00022770: 73 74 61 6e 63 65 3a 30 2c 72 75 6e 6e 69 6e 67 stance:0,running
00022780: 4c 65 6e 67 74 68 3a 30 2c 72 61 64 69 75 73 3a Length:0,radius:
00022790: 31 7d 5d 3b 6c 65 74 20 6c 3d 61 5b 31 5d 3b 66 1}];let l=a[1];f
000227a0: 6f 72 28 3b 6c 26 26 21 28 73 75 2e 44 69 73 74 or(;l&&!(su.Dist
000227b0: 32 28 6c 2c 61 5b 30 5d 29 3e 28 72 2f 33 29 2a 2(l,a[0])>(r/3)*
000227c0: 2a 32 29 3b 29 61 5b 30 5d 2e 7a 3d 4d 61 74 68 *2);)a[0].z=Math
000227d0: 2e 6d 61 78 28 61 5b 30 5d 2e 7a 2c 6c 2e 7a 29 .max(a[0].z,l.z)
000227e0: 2c 61 2e 73 70 6c 69 63 65 28 31 2c 31 29 2c 6c ,a.splice(1,1),l
000227f0: 3d 61 5b 31 5d 3b 63 6f 6e 73 74 20 63 3d 61 2e =a[1];const c=a.
00022800: 70 6f 70 28 29 3b 66 6f 72 28 6c 3d 61 5b 61 2e pop();for(l=a[a.
00022810: 6c 65 6e 67 74 68 2d 31 5d 3b 6c 26 26 21 28 73 length-1];l&&!(s
00022820: 75 2e 44 69 73 74 32 28 6c 2c 63 29 3e 28 72 2f u.Dist2(l,c)>(r/
00022830: 33 29 2a 2a 32 29 3b 29 61 2e 70 6f 70 28 29 2c 3)**2);)a.pop(),
00022840: 6c 3d 61 5b 61 2e 6c 65 6e 67 74 68 2d 31 5d 2c l=a[a.length-1],
00022850: 73 2b 2b 3b 61 2e 70 75 73 68 28 63 29 3b 63 6f s++;a.push(c);co
00022860: 6e 73 74 20 75 3d 74 2e 6c 61 73 74 7c 7c 21 74 nst u=t.last||!t
00022870: 2e 73 69 6d 75 6c 61 74 65 50 72 65 73 73 75 72 .simulatePressur
00022880: 65 7c 7c 61 2e 6c 65 6e 67 74 68 3e 31 26 26 73 e||a.length>1&&s
00022890: 75 2e 44 69 73 74 32 28 61 5b 61 2e 6c 65 6e 67 u.Dist2(a[a.leng
000228a0: 74 68 2d 31 5d 2c 61 5b 61 2e 6c 65 6e 67 74 68 th-1],a[a.length
000228b0: 2d 32 5d 29 3c 72 2a 2a 32 7c 7c 73 3e 30 3b 69 -2])<r**2||s>0;i
000228c0: 66 28 32 3d 3d 3d 61 2e 6c 65 6e 67 74 68 26 26 f(2===a.length&&
000228d0: 74 2e 73 69 6d 75 6c 61 74 65 50 72 65 73 73 75 t.simulatePressu
000228e0: 72 65 29 7b 63 6f 6e 73 74 20 65 3d 61 5b 31 5d re){const e=a[1]
000228f0: 3b 61 3d 61 2e 73 6c 69 63 65 28 30 2c 2d 31 29 ;a=a.slice(0,-1)
00022900: 3b 66 6f 72 28 6c 65 74 20 74 3d 31 3b 74 3c 35 ;for(let t=1;t<5
00022910: 3b 74 2b 2b 29 7b 63 6f 6e 73 74 20 6e 3d 73 75 ;t++){const n=su
00022920: 2e 4c 72 70 28 61 5b 30 5d 2c 65 2c 74 2f 34 29 .Lrp(a[0],e,t/4)
00022930: 3b 6e 2e 7a 3d 28 61 5b 30 5d 2e 7a 2b 28 65 2e ;n.z=(a[0].z+(e.
00022940: 7a 2d 61 5b 30 5d 2e 7a 29 29 2a 74 2f 34 2c 61 z-a[0].z))*t/4,a
00022950: 2e 70 75 73 68 28 6e 29 7d 7d 63 6f 6e 73 74 20 .push(n)}}const
00022960: 64 3d 5b 7b 70 6f 69 6e 74 3a 61 5b 30 5d 2c 69 d=[{point:a[0],i
00022970: 6e 70 75 74 3a 61 5b 30 5d 2c 70 72 65 73 73 75 nput:a[0],pressu
00022980: 72 65 3a 6f 3f 2e 35 3a 61 5b 30 5d 2e 7a 2c 76 re:o?.5:a[0].z,v
00022990: 65 63 74 6f 72 3a 6e 65 77 20 73 75 28 31 2c 31 ector:new su(1,1
000229a0: 29 2c 64 69 73 74 61 6e 63 65 3a 30 2c 72 75 6e ),distance:0,run
000229b0: 6e 69 6e 67 4c 65 6e 67 74 68 3a 30 2c 72 61 64 ningLength:0,rad
000229c0: 69 75 73 3a 31 7d 5d 3b 6c 65 74 20 70 2c 66 2c ius:1}];let p,f,
000229d0: 68 3d 30 2c 6d 3d 64 5b 30 5d 3b 75 26 26 6e 3e h=0,m=d[0];u&&n>
000229e0: 30 26 26 61 2e 70 75 73 68 28 61 5b 61 2e 6c 65 0&&a.push(a[a.le
000229f0: 6e 67 74 68 2d 31 5d 2e 63 6c 6f 6e 65 28 29 29 ngth-1].clone())
00022a00: 3b 66 6f 72 28 6c 65 74 20 65 3d 31 2c 6e 3d 61 ;for(let e=1,n=a
00022a10: 2e 6c 65 6e 67 74 68 3b 65 3c 6e 3b 65 2b 2b 29 .length;e<n;e++)
00022a20: 70 3d 21 69 7c 7c 74 2e 6c 61 73 74 26 26 65 3d p=!i||t.last&&e=
00022a30: 3d 3d 6e 2d 31 3f 61 5b 65 5d 2e 63 6c 6f 6e 65 ==n-1?a[e].clone
00022a40: 28 29 3a 61 5b 65 5d 2e 63 6c 6f 6e 65 28 29 2e ():a[e].clone().
00022a50: 6c 72 70 28 6d 2e 70 6f 69 6e 74 2c 31 2d 69 29 lrp(m.point,1-i)
00022a60: 2c 6d 2e 70 6f 69 6e 74 2e 65 71 75 61 6c 73 28 ,m.point.equals(
00022a70: 70 29 7c 7c 28 66 3d 73 75 2e 44 69 73 74 28 70 p)||(f=su.Dist(p
00022a80: 2c 6d 2e 70 6f 69 6e 74 29 2c 68 2b 3d 66 2c 65 ,m.point),h+=f,e
00022a90: 3c 34 26 26 68 3c 72 7c 7c 28 6d 3d 7b 69 6e 70 <4&&h<r||(m={inp
00022aa0: 75 74 3a 61 5b 65 5d 2c 70 6f 69 6e 74 3a 70 2c ut:a[e],point:p,
00022ab0: 70 72 65 73 73 75 72 65 3a 6f 3f 2e 35 3a 61 5b pressure:o?.5:a[
00022ac0: 65 5d 2e 7a 2c 76 65 63 74 6f 72 3a 73 75 2e 53 e].z,vector:su.S
00022ad0: 75 62 28 6d 2e 70 6f 69 6e 74 2c 70 29 2e 75 6e ub(m.point,p).un
00022ae0: 69 28 29 2c 64 69 73 74 61 6e 63 65 3a 66 2c 72 i(),distance:f,r
00022af0: 75 6e 6e 69 6e 67 4c 65 6e 67 74 68 3a 68 2c 72 unningLength:h,r
00022b00: 61 64 69 75 73 3a 31 7d 2c 64 2e 70 75 73 68 28 adius:1},d.push(
00022b10: 6d 29 29 29 3b 69 66 28 64 5b 31 5d 3f 2e 76 65 m)));if(d[1]?.ve
00022b20: 63 74 6f 72 26 26 28 64 5b 30 5d 2e 76 65 63 74 ctor&&(d[0].vect
00022b30: 6f 72 3d 64 5b 31 5d 2e 76 65 63 74 6f 72 2e 63 or=d[1].vector.c
00022b40: 6c 6f 6e 65 28 29 29 2c 68 3c 31 29 7b 63 6f 6e lone()),h<1){con
00022b50: 73 74 20 65 3d 4d 61 74 68 2e 6d 61 78 28 2e 35 st e=Math.max(.5
00022b60: 2c 2e 2e 2e 64 2e 6d 61 70 28 28 65 3d 3e 65 2e ,...d.map((e=>e.
00022b70: 70 72 65 73 73 75 72 65 29 29 29 3b 64 2e 66 6f pressure)));d.fo
00022b80: 72 45 61 63 68 28 28 74 3d 3e 74 2e 70 72 65 73 rEach((t=>t.pres
00022b90: 73 75 72 65 3d 65 29 29 7d 72 65 74 75 72 6e 20 sure=e))}return
00022ba0: 64 7d 63 6f 6e 73 74 7b 6d 69 6e 3a 24 67 7d 3d d}const{min:$g}=
00022bb0: 4d 61 74 68 2c 65 62 3d 2e 32 37 35 3b 66 75 6e Math,eb=.275;fun
00022bc0: 63 74 69 6f 6e 20 74 62 28 65 2c 74 29 7b 63 6f ction tb(e,t){co
00022bd0: 6e 73 74 7b 73 69 7a 65 3a 6e 3d 31 36 2c 74 68 nst{size:n=16,th
00022be0: 69 6e 6e 69 6e 67 3a 72 3d 2e 35 2c 73 69 6d 75 inning:r=.5,simu
00022bf0: 6c 61 74 65 50 72 65 73 73 75 72 65 3a 6f 3d 21 latePressure:o=!
00022c00: 30 2c 65 61 73 69 6e 67 3a 69 3d 28 65 3d 3e 65 0,easing:i=(e=>e
00022c10: 29 2c 73 74 61 72 74 3a 61 3d 7b 7d 2c 65 6e 64 ),start:a={},end
00022c20: 3a 73 3d 7b 7d 7d 3d 74 2c 7b 65 61 73 69 6e 67 :s={}}=t,{easing
00022c30: 3a 6c 3d 61 75 2e 65 61 73 65 4f 75 74 51 75 61 :l=au.easeOutQua
00022c40: 64 7d 3d 61 2c 7b 65 61 73 69 6e 67 3a 63 3d 61 d}=a,{easing:c=a
00022c50: 75 2e 65 61 73 65 4f 75 74 43 75 62 69 63 7d 3d u.easeOutCubic}=
00022c60: 73 2c 75 3d 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 s,u=e[e.length-1
00022c70: 5d 2e 72 75 6e 6e 69 6e 67 4c 65 6e 67 74 68 3b ].runningLength;
00022c80: 6c 65 74 20 64 2c 70 2c 66 3d 65 5b 30 5d 2e 70 let d,p,f=e[0].p
00022c90: 72 65 73 73 75 72 65 3b 69 66 28 21 6f 26 26 75 ressure;if(!o&&u
00022ca0: 3c 6e 29 7b 63 6f 6e 73 74 20 74 3d 65 2e 72 65 <n){const t=e.re
00022cb0: 64 75 63 65 28 28 28 65 2c 74 29 3d 3e 4d 61 74 duce(((e,t)=>Mat
00022cc0: 68 2e 6d 61 78 28 65 2c 74 2e 70 72 65 73 73 75 h.max(e,t.pressu
00022cd0: 72 65 29 29 2c 2e 35 29 3b 72 65 74 75 72 6e 20 re)),.5);return
00022ce0: 65 2e 66 6f 72 45 61 63 68 28 28 65 3d 3e 7b 65 e.forEach((e=>{e
00022cf0: 2e 70 72 65 73 73 75 72 65 3d 74 2c 65 2e 72 61 .pressure=t,e.ra
00022d00: 64 69 75 73 3d 6e 2a 69 28 2e 35 2d 72 2a 28 2e dius=n*i(.5-r*(.
00022d10: 35 2d 65 2e 70 72 65 73 73 75 72 65 29 29 7d 29 5-e.pressure))})
00022d20: 29 2c 65 7d 7b 6c 65 74 20 74 3b 66 6f 72 28 6c ),e}{let t;for(l
00022d30: 65 74 20 72 3d 30 2c 69 3d 65 2e 6c 65 6e 67 74 et r=0,i=e.lengt
00022d40: 68 3b 72 3c 69 26 26 28 70 3d 65 5b 72 5d 2c 21 h;r<i&&(p=e[r],!
00022d50: 28 70 2e 72 75 6e 6e 69 6e 67 4c 65 6e 67 74 68 (p.runningLength
00022d60: 3e 35 2a 6e 29 29 3b 72 2b 2b 29 7b 63 6f 6e 73 >5*n));r++){cons
00022d70: 74 20 65 3d 24 67 28 31 2c 70 2e 64 69 73 74 61 t e=$g(1,p.dista
00022d80: 6e 63 65 2f 6e 29 3b 69 66 28 6f 29 7b 63 6f 6e nce/n);if(o){con
00022d90: 73 74 20 6e 3d 24 67 28 31 2c 31 2d 65 29 3b 74 st n=$g(1,1-e);t
00022da0: 3d 24 67 28 31 2c 66 2b 65 2a 65 62 2a 28 6e 2d =$g(1,f+e*eb*(n-
00022db0: 66 29 29 7d 65 6c 73 65 20 74 3d 24 67 28 31 2c f))}else t=$g(1,
00022dc0: 66 2b 2e 35 2a 28 70 2e 70 72 65 73 73 75 72 65 f+.5*(p.pressure
00022dd0: 2d 66 29 29 3b 66 2b 3d 2e 35 2a 28 74 2d 66 29 -f));f+=.5*(t-f)
00022de0: 7d 66 6f 72 28 6c 65 74 20 74 3d 30 3b 74 3c 65 }for(let t=0;t<e
00022df0: 2e 6c 65 6e 67 74 68 3b 74 2b 2b 29 7b 69 66 28 .length;t++){if(
00022e00: 70 3d 65 5b 74 5d 2c 72 29 7b 6c 65 74 7b 70 72 p=e[t],r){let{pr
00022e10: 65 73 73 75 72 65 3a 65 7d 3d 70 3b 63 6f 6e 73 essure:e}=p;cons
00022e20: 74 20 74 3d 24 67 28 31 2c 70 2e 64 69 73 74 61 t t=$g(1,p.dista
00022e30: 6e 63 65 2f 6e 29 3b 69 66 28 6f 29 7b 63 6f 6e nce/n);if(o){con
00022e40: 73 74 20 6e 3d 24 67 28 31 2c 31 2d 74 29 3b 65 st n=$g(1,1-t);e
00022e50: 3d 24 67 28 31 2c 66 2b 74 2a 65 62 2a 28 6e 2d =$g(1,f+t*eb*(n-
00022e60: 66 29 29 7d 65 6c 73 65 20 65 3d 24 67 28 31 2c f))}else e=$g(1,
00022e70: 66 2b 74 2a 65 62 2a 28 65 2d 66 29 29 3b 70 2e f+t*eb*(e-f));p.
00022e80: 72 61 64 69 75 73 3d 6e 2a 69 28 2e 35 2d 72 2a radius=n*i(.5-r*
00022e90: 28 2e 35 2d 65 29 29 2c 66 3d 65 7d 65 6c 73 65 (.5-e)),f=e}else
00022ea0: 20 70 2e 72 61 64 69 75 73 3d 6e 2f 32 3b 76 6f p.radius=n/2;vo
00022eb0: 69 64 20 30 3d 3d 3d 64 26 26 28 64 3d 70 2e 72 id 0===d&&(d=p.r
00022ec0: 61 64 69 75 73 29 7d 7d 63 6f 6e 73 74 20 68 3d adius)}}const h=
00022ed0: 21 31 3d 3d 3d 61 2e 74 61 70 65 72 3f 30 3a 21 !1===a.taper?0:!
00022ee0: 30 3d 3d 3d 61 2e 74 61 70 65 72 3f 4d 61 74 68 0===a.taper?Math
00022ef0: 2e 6d 61 78 28 6e 2c 75 29 3a 61 2e 74 61 70 65 .max(n,u):a.tape
00022f00: 72 2c 6d 3d 21 31 3d 3d 3d 73 2e 74 61 70 65 72 r,m=!1===s.taper
00022f10: 3f 30 3a 21 30 3d 3d 3d 73 2e 74 61 70 65 72 3f ?0:!0===s.taper?
00022f20: 4d 61 74 68 2e 6d 61 78 28 6e 2c 75 29 3a 73 2e Math.max(n,u):s.
00022f30: 74 61 70 65 72 3b 69 66 28 68 7c 7c 6d 29 66 6f taper;if(h||m)fo
00022f40: 72 28 6c 65 74 20 74 3d 30 3b 74 3c 65 2e 6c 65 r(let t=0;t<e.le
00022f50: 6e 67 74 68 3b 74 2b 2b 29 7b 70 3d 65 5b 74 5d ngth;t++){p=e[t]
00022f60: 3b 63 6f 6e 73 74 7b 72 75 6e 6e 69 6e 67 4c 65 ;const{runningLe
00022f70: 6e 67 74 68 3a 6e 7d 3d 70 2c 72 3d 6e 3c 68 3f ngth:n}=p,r=n<h?
00022f80: 6c 28 6e 2f 68 29 3a 31 2c 6f 3d 75 2d 6e 3c 6d l(n/h):1,o=u-n<m
00022f90: 3f 63 28 28 75 2d 6e 29 2f 6d 29 3a 31 3b 70 2e ?c((u-n)/m):1;p.
00022fa0: 72 61 64 69 75 73 3d 4d 61 74 68 2e 6d 61 78 28 radius=Math.max(
00022fb0: 2e 30 31 2c 70 2e 72 61 64 69 75 73 2a 4d 61 74 .01,p.radius*Mat
00022fc0: 68 2e 6d 69 6e 28 72 2c 6f 29 29 7d 72 65 74 75 h.min(r,o))}retu
00022fd0: 72 6e 20 65 7d 66 75 6e 63 74 69 6f 6e 20 6e 62 rn e}function nb
00022fe0: 28 7b 73 63 72 69 62 62 6c 65 3a 65 2c 7a 6f 6f ({scribble:e,zoo
00022ff0: 6d 3a 74 2c 63 6f 6c 6f 72 3a 6e 2c 6f 70 61 63 m:t,color:n,opac
00023000: 69 74 79 3a 72 2c 63 6c 61 73 73 4e 61 6d 65 3a ity:r,className:
00023010: 6f 7d 29 7b 69 66 28 21 65 2e 70 6f 69 6e 74 73 o}){if(!e.points
00023020: 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 6e 20 6e .length)return n
00023030: 75 6c 6c 3b 63 6f 6e 73 74 20 69 3d 66 75 6e 63 ull;const i=func
00023040: 74 69 6f 6e 28 65 2c 74 3d 7b 7d 29 7b 72 65 74 tion(e,t={}){ret
00023050: 75 72 6e 20 58 67 28 74 62 28 4a 67 28 65 2c 74 urn Xg(tb(Jg(e,t
00023060: 29 2c 74 29 2c 74 29 7d 28 65 2e 70 6f 69 6e 74 ),t),t)}(e.point
00023070: 73 2c 7b 73 69 7a 65 3a 65 2e 73 69 7a 65 2f 74 s,{size:e.size/t
00023080: 2c 73 74 61 72 74 3a 7b 74 61 70 65 72 3a 65 2e ,start:{taper:e.
00023090: 74 61 70 65 72 2c 65 61 73 69 6e 67 3a 61 75 2e taper,easing:au.
000230a0: 6c 69 6e 65 61 72 7d 2c 6c 61 73 74 3a 22 73 74 linear},last:"st
000230b0: 6f 70 70 69 6e 67 22 3d 3d 3d 65 2e 73 74 61 74 opping"===e.stat
000230c0: 65 2c 73 69 6d 75 6c 61 74 65 50 72 65 73 73 75 e,simulatePressu
000230d0: 72 65 3a 21 31 2c 73 74 72 65 61 6d 6c 69 6e 65 re:!1,streamline
000230e0: 3a 2e 33 32 7d 29 3b 6c 65 74 20 61 3b 69 66 28 :.32});let a;if(
000230f0: 69 2e 6c 65 6e 67 74 68 3c 34 29 7b 63 6f 6e 73 i.length<4){cons
00023100: 74 20 6e 3d 65 2e 73 69 7a 65 2f 74 2f 32 2c 7b t n=e.size/t/2,{
00023110: 78 3a 72 2c 79 3a 6f 7d 3d 65 2e 70 6f 69 6e 74 x:r,y:o}=e.point
00023120: 73 5b 65 2e 70 6f 69 6e 74 73 2e 6c 65 6e 67 74 s[e.points.lengt
00023130: 68 2d 31 5d 3b 61 3d 60 4d 20 24 7b 72 2d 6e 7d h-1];a=`M ${r-n}
00023140: 2c 24 7b 6f 7d 20 61 20 24 7b 6e 7d 2c 24 7b 6e ,${o} a ${n},${n
00023150: 7d 20 30 20 31 2c 30 20 24 7b 32 2a 6e 7d 2c 30 } 0 1,0 ${2*n},0
00023160: 20 61 20 24 7b 6e 7d 2c 24 7b 6e 7d 20 30 20 31 a ${n},${n} 0 1
00023170: 2c 30 20 24 7b 32 2a 2d 6e 7d 2c 30 60 7d 65 6c ,0 ${2*-n},0`}el
00023180: 73 65 20 61 3d 68 66 28 69 29 3b 72 65 74 75 72 se a=hf(i);retur
00023190: 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 73 76 67 n(0,Qc.jsx)("svg
000231a0: 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 6f 3f 4a ",{className:o?J
000231b0: 63 28 22 74 6c 2d 6f 76 65 72 6c 61 79 73 5f 5f c("tl-overlays__
000231c0: 69 74 65 6d 22 2c 6f 29 3a 6f 2c 63 68 69 6c 64 item",o):o,child
000231d0: 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 29 28 22 ren:(0,Qc.jsx)("
000231e0: 70 61 74 68 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 path",{className
000231f0: 3a 22 74 6c 2d 73 63 72 69 62 62 6c 65 22 2c 64 :"tl-scribble",d
00023200: 3a 61 2c 66 69 6c 6c 3a 6e 3f 3f 60 76 61 72 28 :a,fill:n??`var(
00023210: 2d 2d 63 6f 6c 6f 72 2d 24 7b 65 2e 63 6f 6c 6f --color-${e.colo
00023220: 72 7d 29 60 2c 6f 70 61 63 69 74 79 3a 72 3f 3f r})`,opacity:r??
00023230: 65 2e 6f 70 61 63 69 74 79 7d 29 7d 29 7d 63 6f e.opacity})})}co
00023240: 6e 73 74 20 72 62 3d 28 7b 62 6f 75 6e 64 73 3a nst rb=({bounds:
00023250: 65 2c 72 6f 74 61 74 69 6f 6e 3a 74 7d 29 3d 3e e,rotation:t})=>
00023260: 7b 63 6f 6e 73 74 20 6e 3d 72 75 28 29 3b 72 65 {const n=ru();re
00023270: 74 75 72 6e 20 64 61 28 22 73 68 6f 75 6c 64 20 turn da("should
00023280: 64 69 73 70 6c 61 79 22 2c 28 28 29 3d 3e 6e 2e display",(()=>n.
00023290: 69 73 49 6e 41 6e 79 28 22 73 65 6c 65 63 74 2e isInAny("select.
000232a0: 69 64 6c 65 22 2c 22 73 65 6c 65 63 74 2e 62 72 idle","select.br
000232b0: 75 73 68 69 6e 67 22 2c 22 73 65 6c 65 63 74 2e ushing","select.
000232c0: 73 63 72 69 62 62 6c 65 5f 62 72 75 73 68 69 6e scribble_brushin
000232d0: 67 22 2c 22 73 65 6c 65 63 74 2e 70 6f 69 6e 74 g","select.point
000232e0: 69 6e 67 5f 73 68 61 70 65 22 2c 22 73 65 6c 65 ing_shape","sele
000232f0: 63 74 2e 70 6f 69 6e 74 69 6e 67 5f 73 65 6c 65 ct.pointing_sele
00023300: 63 74 69 6f 6e 22 2c 22 74 65 78 74 2e 72 65 73 ction","text.res
00023310: 69 7a 69 6e 67 22 29 29 2c 5b 6e 5d 29 3f 28 30 izing")),[n])?(0
00023320: 2c 51 63 2e 6a 73 78 29 28 67 66 2c 7b 62 6f 75 ,Qc.jsx)(gf,{bou
00023330: 6e 64 73 3a 65 2c 72 6f 74 61 74 69 6f 6e 3a 74 nds:e,rotation:t
00023340: 7d 29 3a 6e 75 6c 6c 7d 3b 66 75 6e 63 74 69 6f }):null};functio
00023350: 6e 20 6f 62 28 29 7b 63 6f 6e 73 74 20 65 3d 72 n ob(){const e=r
00023360: 75 28 29 3b 72 65 74 75 72 6e 20 64 61 28 22 69 u();return da("i
00023370: 73 52 65 61 64 6f 6e 6c 79 4d 6f 64 65 22 2c 28 sReadonlyMode",(
00023380: 28 29 3d 3e 65 2e 67 65 74 49 6e 73 74 61 6e 63 ()=>e.getInstanc
00023390: 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 64 6f eState().isReado
000233a0: 6e 6c 79 29 2c 5b 65 5d 29 7d 66 75 6e 63 74 69 nly),[e])}functi
000233b0: 6f 6e 20 69 62 28 7b 73 69 7a 65 3a 65 2c 77 69 on ib({size:e,wi
000233c0: 64 74 68 3a 74 2c 68 65 69 67 68 74 3a 6e 2c 68 dth:t,height:n,h
000233d0: 69 64 65 41 6c 74 65 72 6e 61 74 65 48 61 6e 64 ideAlternateHand
000233e0: 6c 65 73 3a 72 7d 29 7b 63 6f 6e 73 74 20 6f 3d les:r}){const o=
000233f0: 4e 75 28 65 2f 33 29 2c 69 3d 6f 2f 32 3b 72 65 Nu(e/3),i=o/2;re
00023400: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 turn(0,Qc.jsxs)(
00023410: 22 73 76 67 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 "svg",{className
00023420: 3a 22 74 6c 2d 6f 76 65 72 6c 61 79 73 5f 5f 69 :"tl-overlays__i
00023430: 74 65 6d 22 2c 63 68 69 6c 64 72 65 6e 3a 5b 28 tem",children:[(
00023440: 30 2c 51 63 2e 6a 73 78 29 28 22 70 6f 6c 79 6c 0,Qc.jsx)("polyl
00023450: 69 6e 65 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a ine",{className:
00023460: 22 74 6c 2d 63 6f 72 6e 65 72 2d 63 72 6f 70 2d "tl-corner-crop-
00023470: 68 61 6e 64 6c 65 22 2c 70 6f 69 6e 74 73 3a 60 handle",points:`
00023480: 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 5c 74 24 7b \n\t\t\t\t\t\t${
00023490: 4e 75 28 30 2d 69 29 7d 2c 24 7b 4e 75 28 65 29 Nu(0-i)},${Nu(e)
000234a0: 7d 20 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 5c 74 } \n\t\t\t\t\t\t
000234b0: 24 7b 4e 75 28 30 2d 69 29 7d 2c 24 7b 4e 75 28 ${Nu(0-i)},${Nu(
000234c0: 30 2d 69 29 7d 20 5c 6e 5c 74 5c 74 5c 74 5c 74 0-i)} \n\t\t\t\t
000234d0: 5c 74 5c 74 24 7b 4e 75 28 65 29 7d 2c 24 7b 4e \t\t${Nu(e)},${N
000234e0: 75 28 30 2d 69 29 7d 60 2c 73 74 72 6f 6b 65 57 u(0-i)}`,strokeW
000234f0: 69 64 74 68 3a 6f 2c 22 64 61 74 61 2d 74 65 73 idth:o,"data-tes
00023500: 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e 2e tid":"selection.
00023510: 63 72 6f 70 2e 74 6f 70 5f 6c 65 66 74 22 2c 22 crop.top_left","
00023520: 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 74 6f 70 aria-label":"top
00023530: 5f 6c 65 66 74 20 68 61 6e 64 6c 65 22 7d 29 2c _left handle"}),
00023540: 28 30 2c 51 63 2e 6a 73 78 29 28 22 6c 69 6e 65 (0,Qc.jsx)("line
00023550: 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 ",{className:Jc(
00023560: 22 74 6c 2d 63 6f 72 6e 65 72 2d 63 72 6f 70 2d "tl-corner-crop-
00023570: 65 64 67 65 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 edge-handle",{"t
00023580: 6c 2d 68 69 64 64 65 6e 22 3a 72 7d 29 2c 78 31 l-hidden":r}),x1
00023590: 3a 4e 75 28 74 2f 32 2d 65 29 2c 79 31 3a 4e 75 :Nu(t/2-e),y1:Nu
000235a0: 28 30 2d 69 29 2c 78 32 3a 4e 75 28 74 2f 32 2b (0-i),x2:Nu(t/2+
000235b0: 65 29 2c 79 32 3a 4e 75 28 30 2d 69 29 2c 73 74 e),y2:Nu(0-i),st
000235c0: 72 6f 6b 65 57 69 64 74 68 3a 6f 2c 22 64 61 74 rokeWidth:o,"dat
000235d0: 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 63 a-testid":"selec
000235e0: 74 69 6f 6e 2e 63 72 6f 70 2e 74 6f 70 22 2c 22 tion.crop.top","
000235f0: 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 74 6f 70 aria-label":"top
00023600: 20 68 61 6e 64 6c 65 22 7d 29 2c 28 30 2c 51 63 handle"}),(0,Qc
00023610: 2e 6a 73 78 29 28 22 70 6f 6c 79 6c 69 6e 65 22 .jsx)("polyline"
00023620: 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 ,{className:Jc("
00023630: 74 6c 2d 63 6f 72 6e 65 72 2d 63 72 6f 70 2d 68 tl-corner-crop-h
00023640: 61 6e 64 6c 65 22 2c 7b 22 74 6c 2d 68 69 64 64 andle",{"tl-hidd
00023650: 65 6e 22 3a 72 7d 29 2c 70 6f 69 6e 74 73 3a 60 en":r}),points:`
00023660: 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 5c 74 24 7b \n\t\t\t\t\t\t${
00023670: 4e 75 28 74 2d 65 29 7d 2c 24 7b 4e 75 28 30 2d Nu(t-e)},${Nu(0-
00023680: 69 29 7d 20 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 i)} \n\t\t\t\t\t
00023690: 5c 74 24 7b 4e 75 28 74 2b 69 29 7d 2c 24 7b 4e \t${Nu(t+i)},${N
000236a0: 75 28 30 2d 69 29 7d 20 5c 6e 5c 74 5c 74 5c 74 u(0-i)} \n\t\t\t
000236b0: 5c 74 5c 74 5c 74 24 7b 4e 75 28 74 2b 69 29 7d \t\t\t${Nu(t+i)}
000236c0: 2c 24 7b 4e 75 28 65 29 7d 60 2c 73 74 72 6f 6b ,${Nu(e)}`,strok
000236d0: 65 57 69 64 74 68 3a 6f 2c 22 64 61 74 61 2d 74 eWidth:o,"data-t
000236e0: 65 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f estid":"selectio
000236f0: 6e 2e 63 72 6f 70 2e 74 6f 70 5f 72 69 67 68 74 n.crop.top_right
00023700: 22 2c 22 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 ","aria-label":"
00023710: 74 6f 70 5f 72 69 67 68 74 20 68 61 6e 64 6c 65 top_right handle
00023720: 22 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 "}),(0,Qc.jsx)("
00023730: 6c 69 6e 65 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 line",{className
00023740: 3a 4a 63 28 22 74 6c 2d 63 6f 72 6e 65 72 2d 63 :Jc("tl-corner-c
00023750: 72 6f 70 2d 65 64 67 65 2d 68 61 6e 64 6c 65 22 rop-edge-handle"
00023760: 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 3a 72 7d ,{"tl-hidden":r}
00023770: 29 2c 78 31 3a 4e 75 28 74 2b 69 29 2c 79 31 3a ),x1:Nu(t+i),y1:
00023780: 4e 75 28 6e 2f 32 2d 65 29 2c 78 32 3a 4e 75 28 Nu(n/2-e),x2:Nu(
00023790: 74 2b 69 29 2c 79 32 3a 4e 75 28 6e 2f 32 2b 65 t+i),y2:Nu(n/2+e
000237a0: 29 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 6f 2c ),strokeWidth:o,
000237b0: 22 64 61 74 61 2d 74 65 73 74 69 64 22 3a 22 73 "data-testid":"s
000237c0: 65 6c 65 63 74 69 6f 6e 2e 63 72 6f 70 2e 72 69 election.crop.ri
000237d0: 67 68 74 22 2c 22 61 72 69 61 2d 6c 61 62 65 6c ght","aria-label
000237e0: 22 3a 22 72 69 67 68 74 20 68 61 6e 64 6c 65 22 ":"right handle"
000237f0: 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 }),(0,Qc.jsx)("p
00023800: 6f 6c 79 6c 69 6e 65 22 2c 7b 63 6c 61 73 73 4e olyline",{classN
00023810: 61 6d 65 3a 22 74 6c 2d 63 6f 72 6e 65 72 2d 63 ame:"tl-corner-c
00023820: 72 6f 70 2d 68 61 6e 64 6c 65 22 2c 70 6f 69 6e rop-handle",poin
00023830: 74 73 3a 60 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 ts:`\n\t\t\t\t\t
00023840: 5c 74 24 7b 4e 75 28 74 2b 69 29 7d 2c 24 7b 4e \t${Nu(t+i)},${N
00023850: 75 28 6e 2d 65 29 7d 20 5c 6e 5c 74 5c 74 5c 74 u(n-e)} \n\t\t\t
00023860: 5c 74 5c 74 5c 74 24 7b 4e 75 28 74 2b 69 29 7d \t\t\t${Nu(t+i)}
00023870: 2c 24 7b 4e 75 28 6e 2b 69 29 7d 5c 6e 5c 74 5c ,${Nu(n+i)}\n\t\
00023880: 74 5c 74 5c 74 5c 74 5c 74 24 7b 4e 75 28 74 2d t\t\t\t\t${Nu(t-
00023890: 65 29 7d 2c 24 7b 4e 75 28 6e 2b 69 29 7d 60 2c e)},${Nu(n+i)}`,
000238a0: 73 74 72 6f 6b 65 57 69 64 74 68 3a 6f 2c 22 64 strokeWidth:o,"d
000238b0: 61 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c ata-testid":"sel
000238c0: 65 63 74 69 6f 6e 2e 63 72 6f 70 2e 62 6f 74 74 ection.crop.bott
000238d0: 6f 6d 5f 72 69 67 68 74 22 2c 22 61 72 69 61 2d om_right","aria-
000238e0: 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 5f 72 label":"bottom_r
000238f0: 69 67 68 74 20 68 61 6e 64 6c 65 22 7d 29 2c 28 ight handle"}),(
00023900: 30 2c 51 63 2e 6a 73 78 29 28 22 6c 69 6e 65 22 0,Qc.jsx)("line"
00023910: 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 ,{className:Jc("
00023920: 74 6c 2d 63 6f 72 6e 65 72 2d 63 72 6f 70 2d 65 tl-corner-crop-e
00023930: 64 67 65 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 6c dge-handle",{"tl
00023940: 2d 68 69 64 64 65 6e 22 3a 72 7d 29 2c 78 31 3a -hidden":r}),x1:
00023950: 4e 75 28 74 2f 32 2d 65 29 2c 79 31 3a 4e 75 28 Nu(t/2-e),y1:Nu(
00023960: 6e 2b 69 29 2c 78 32 3a 4e 75 28 74 2f 32 2b 65 n+i),x2:Nu(t/2+e
00023970: 29 2c 79 32 3a 4e 75 28 6e 2b 69 29 2c 73 74 72 ),y2:Nu(n+i),str
00023980: 6f 6b 65 57 69 64 74 68 3a 6f 2c 22 64 61 74 61 okeWidth:o,"data
00023990: 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 63 74 -testid":"select
000239a0: 69 6f 6e 2e 63 72 6f 70 2e 62 6f 74 74 6f 6d 22 ion.crop.bottom"
000239b0: 2c 22 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 62 ,"aria-label":"b
000239c0: 6f 74 74 6f 6d 20 68 61 6e 64 6c 65 22 7d 29 2c ottom handle"}),
000239d0: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 6f 6c 79 (0,Qc.jsx)("poly
000239e0: 6c 69 6e 65 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 line",{className
000239f0: 3a 4a 63 28 22 74 6c 2d 63 6f 72 6e 65 72 2d 63 :Jc("tl-corner-c
00023a00: 72 6f 70 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 6c rop-handle",{"tl
00023a10: 2d 68 69 64 64 65 6e 22 3a 72 7d 29 2c 70 6f 69 -hidden":r}),poi
00023a20: 6e 74 73 3a 60 5c 6e 5c 74 5c 74 5c 74 5c 74 5c nts:`\n\t\t\t\t\
00023a30: 74 5c 74 24 7b 4e 75 28 30 2b 65 29 7d 2c 24 7b t\t${Nu(0+e)},${
00023a40: 4e 75 28 6e 2b 69 29 7d 20 5c 6e 5c 74 5c 74 5c Nu(n+i)} \n\t\t\
00023a50: 74 5c 74 5c 74 5c 74 24 7b 4e 75 28 30 2d 69 29 t\t\t\t${Nu(0-i)
00023a60: 7d 2c 24 7b 4e 75 28 6e 2b 69 29 7d 5c 6e 5c 74 },${Nu(n+i)}\n\t
00023a70: 5c 74 5c 74 5c 74 5c 74 5c 74 24 7b 4e 75 28 30 \t\t\t\t\t${Nu(0
00023a80: 2d 69 29 7d 2c 24 7b 4e 75 28 6e 2d 65 29 7d 60 -i)},${Nu(n-e)}`
00023a90: 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 6f 2c 22 ,strokeWidth:o,"
00023aa0: 64 61 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 data-testid":"se
00023ab0: 6c 65 63 74 69 6f 6e 2e 63 72 6f 70 2e 62 6f 74 lection.crop.bot
00023ac0: 74 6f 6d 5f 6c 65 66 74 22 2c 22 61 72 69 61 2d tom_left","aria-
00023ad0: 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 5f 6c label":"bottom_l
00023ae0: 65 66 74 20 68 61 6e 64 6c 65 22 7d 29 2c 28 30 eft handle"}),(0
00023af0: 2c 51 63 2e 6a 73 78 29 28 22 6c 69 6e 65 22 2c ,Qc.jsx)("line",
00023b00: 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 74 {className:Jc("t
00023b10: 6c 2d 63 6f 72 6e 65 72 2d 63 72 6f 70 2d 65 64 l-corner-crop-ed
00023b20: 67 65 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 6c 2d ge-handle",{"tl-
00023b30: 68 69 64 64 65 6e 22 3a 72 7d 29 2c 78 31 3a 4e hidden":r}),x1:N
00023b40: 75 28 30 2d 69 29 2c 79 31 3a 4e 75 28 6e 2f 32 u(0-i),y1:Nu(n/2
00023b50: 2d 65 29 2c 78 32 3a 4e 75 28 30 2d 69 29 2c 79 -e),x2:Nu(0-i),y
00023b60: 32 3a 4e 75 28 6e 2f 32 2b 65 29 2c 73 74 72 6f 2:Nu(n/2+e),stro
00023b70: 6b 65 57 69 64 74 68 3a 6f 2c 22 64 61 74 61 2d keWidth:o,"data-
00023b80: 74 65 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 testid":"selecti
00023b90: 6f 6e 2e 63 72 6f 70 2e 6c 65 66 74 22 2c 22 61 on.crop.left","a
00023ba0: 72 69 61 2d 6c 61 62 65 6c 22 3a 22 6c 65 66 74 ria-label":"left
00023bb0: 20 68 61 6e 64 6c 65 22 7d 29 5d 7d 29 7d 63 6f handle"})]})}co
00023bc0: 6e 73 74 20 61 62 3d 63 61 28 28 66 75 6e 63 74 nst ab=ca((funct
00023bd0: 69 6f 6e 28 7b 62 6f 75 6e 64 73 3a 65 2c 72 6f ion({bounds:e,ro
00023be0: 74 61 74 69 6f 6e 3a 74 7d 29 7b 63 6f 6e 73 74 tation:t}){const
00023bf0: 20 6e 3d 72 75 28 29 2c 72 3d 28 30 2c 6f 2e 75 n=ru(),r=(0,o.u
00023c00: 73 65 52 65 66 29 28 6e 75 6c 6c 29 2c 69 3d 6f seRef)(null),i=o
00023c10: 62 28 29 2c 61 3d 4e 67 28 22 74 6f 70 22 29 2c b(),a=Ng("top"),
00023c20: 73 3d 4e 67 28 22 72 69 67 68 74 22 29 2c 6c 3d s=Ng("right"),l=
00023c30: 4e 67 28 22 62 6f 74 74 6f 6d 22 29 2c 63 3d 4e Ng("bottom"),c=N
00023c40: 67 28 22 6c 65 66 74 22 29 2c 75 3d 4e 67 28 22 g("left"),u=Ng("
00023c50: 74 6f 70 5f 6c 65 66 74 22 29 2c 64 3d 4e 67 28 top_left"),d=Ng(
00023c60: 22 74 6f 70 5f 72 69 67 68 74 22 29 2c 70 3d 4e "top_right"),p=N
00023c70: 67 28 22 62 6f 74 74 6f 6d 5f 72 69 67 68 74 22 g("bottom_right"
00023c80: 29 2c 66 3d 4e 67 28 22 62 6f 74 74 6f 6d 5f 6c ),f=Ng("bottom_l
00023c90: 65 66 74 22 29 2c 68 3d 21 6e 2e 67 65 74 49 73 eft"),h=!n.getIs
00023ca0: 4d 65 6e 75 4f 70 65 6e 28 29 26 26 22 64 65 66 MenuOpen()&&"def
00023cb0: 61 75 6c 74 22 3d 3d 3d 6e 2e 67 65 74 49 6e 73 ault"===n.getIns
00023cc0: 74 61 6e 63 65 53 74 61 74 65 28 29 2e 63 75 72 tanceState().cur
00023cd0: 73 6f 72 2e 74 79 70 65 2c 6d 3d 6e 2e 67 65 74 sor.type,m=n.get
00023ce0: 49 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e InstanceState().
00023cf0: 69 73 43 6f 61 72 73 65 50 6f 69 6e 74 65 72 2c isCoarsePointer,
00023d00: 67 3d 6e 2e 67 65 74 4f 6e 6c 79 53 65 6c 65 63 g=n.getOnlySelec
00023d10: 74 65 64 53 68 61 70 65 28 29 2c 62 3d 67 26 26 tedShape(),b=g&&
00023d20: 6e 2e 69 73 53 68 61 70 65 4f 72 41 6e 63 65 73 n.isShapeOrAnces
00023d30: 74 6f 72 4c 6f 63 6b 65 64 28 67 29 2c 79 3d 67 torLocked(g),y=g
00023d40: 3f 6e 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 ?n.getShapeUtil(
00023d50: 67 29 2e 65 78 70 61 6e 64 53 65 6c 65 63 74 69 g).expandSelecti
00023d60: 6f 6e 4f 75 74 6c 69 6e 65 50 78 28 67 29 3a 30 onOutlinePx(g):0
00023d70: 3b 69 66 28 69 75 28 72 2c 65 3f 2e 78 2c 65 3f ;if(iu(r,e?.x,e?
00023d80: 2e 79 2c 31 2c 6e 2e 67 65 74 53 65 6c 65 63 74 .y,1,n.getSelect
00023d90: 69 6f 6e 52 6f 74 61 74 69 6f 6e 28 29 2c 7b 78 ionRotation(),{x
00023da0: 3a 2d 79 2c 79 3a 2d 79 7d 29 2c 21 65 29 72 65 :-y,y:-y}),!e)re
00023db0: 74 75 72 6e 20 6e 75 6c 6c 3b 65 3d 65 2e 63 6c turn null;e=e.cl
00023dc0: 6f 6e 65 28 29 2e 65 78 70 61 6e 64 42 79 28 79 one().expandBy(y
00023dd0: 29 2e 7a 65 72 6f 46 69 78 28 29 3b 63 6f 6e 73 ).zeroFix();cons
00023de0: 74 20 76 3d 6e 2e 67 65 74 5a 6f 6f 6d 4c 65 76 t v=n.getZoomLev
00023df0: 65 6c 28 29 2c 53 3d 6e 2e 67 65 74 49 6e 73 74 el(),S=n.getInst
00023e00: 61 6e 63 65 53 74 61 74 65 28 29 2e 69 73 43 68 anceState().isCh
00023e10: 61 6e 67 69 6e 67 53 74 79 6c 65 2c 5f 3d 65 2e angingStyle,_=e.
00023e20: 77 69 64 74 68 2c 45 3d 65 2e 68 65 69 67 68 74 width,E=e.height
00023e30: 2c 77 3d 38 2f 76 2c 78 3d 5f 3c 32 2a 77 2c 54 ,w=8/v,x=_<2*w,T
00023e40: 3d 45 3c 32 2a 77 2c 43 3d 5f 3c 34 2a 77 2c 6b =E<2*w,C=_<4*w,k
00023e50: 3d 45 3c 34 2a 77 2c 41 3d 5f 3c 35 2a 77 2c 49 =E<4*w,A=_<5*w,I
00023e60: 3d 45 3c 35 2a 77 2c 52 3d 6d 3f 31 2e 37 35 3a =E<5*w,R=m?1.75:
00023e70: 31 2c 4f 3d 36 2f 76 2a 52 2c 4e 3d 28 43 3f 4f 1,O=6/v*R,N=(C?O
00023e80: 2f 32 3a 4f 29 2a 28 2e 37 35 2a 52 29 2c 50 3d /2:O)*(.75*R),P=
00023e90: 28 6b 3f 4f 2f 32 3a 4f 29 2a 28 2e 37 35 2a 52 (k?O/2:O)*(.75*R
00023ea0: 29 2c 4d 3d 21 28 67 26 26 6e 2e 67 65 74 53 68 ),M=!(g&&n.getSh
00023eb0: 61 70 65 55 74 69 6c 28 67 29 2e 68 69 64 65 53 apeUtil(g).hideS
00023ec0: 65 6c 65 63 74 69 6f 6e 42 6f 75 6e 64 73 46 67 electionBoundsFg
00023ed0: 28 67 29 7c 7c 53 29 3b 6c 65 74 20 44 3d 4d 26 (g)||S);let D=M&
00023ee0: 26 6e 2e 69 73 49 6e 41 6e 79 28 22 73 65 6c 65 &n.isInAny("sele
00023ef0: 63 74 2e 69 64 6c 65 22 2c 22 73 65 6c 65 63 74 ct.idle","select
00023f00: 2e 62 72 75 73 68 69 6e 67 22 2c 22 73 65 6c 65 .brushing","sele
00023f10: 63 74 2e 73 63 72 69 62 62 6c 65 5f 62 72 75 73 ct.scribble_brus
00023f20: 68 69 6e 67 22 2c 22 73 65 6c 65 63 74 2e 70 6f hing","select.po
00023f30: 69 6e 74 69 6e 67 5f 63 61 6e 76 61 73 22 2c 22 inting_canvas","
00023f40: 73 65 6c 65 63 74 2e 70 6f 69 6e 74 69 6e 67 5f select.pointing_
00023f50: 73 65 6c 65 63 74 69 6f 6e 22 2c 22 73 65 6c 65 selection","sele
00023f60: 63 74 2e 70 6f 69 6e 74 69 6e 67 5f 73 68 61 70 ct.pointing_shap
00023f70: 65 22 2c 22 73 65 6c 65 63 74 2e 63 72 6f 70 2e e","select.crop.
00023f80: 69 64 6c 65 22 2c 22 73 65 6c 65 63 74 2e 63 72 idle","select.cr
00023f90: 6f 70 2e 70 6f 69 6e 74 69 6e 67 5f 63 72 6f 70 op.pointing_crop
00023fa0: 22 2c 22 73 65 6c 65 63 74 2e 63 72 6f 70 2e 70 ","select.crop.p
00023fb0: 6f 69 6e 74 69 6e 67 5f 63 72 6f 70 5f 68 61 6e ointing_crop_han
00023fc0: 64 6c 65 22 2c 22 73 65 6c 65 63 74 2e 70 6f 69 dle","select.poi
00023fd0: 6e 74 69 6e 67 5f 72 65 73 69 7a 65 5f 68 61 6e nting_resize_han
00023fe0: 64 6c 65 22 29 7c 7c 4d 26 26 6e 2e 69 73 49 6e dle")||M&&n.isIn
00023ff0: 28 22 73 65 6c 65 63 74 2e 72 65 73 69 7a 69 6e ("select.resizin
00024000: 67 22 29 26 26 67 26 26 6e 2e 69 73 53 68 61 70 g")&&g&&n.isShap
00024010: 65 4f 66 54 79 70 65 28 67 2c 22 74 65 78 74 22 eOfType(g,"text"
00024020: 29 3b 67 26 26 44 26 26 6e 2e 65 6e 76 69 72 6f );g&&D&&n.enviro
00024030: 6e 6d 65 6e 74 2e 69 73 46 69 72 65 66 6f 78 26 nment.isFirefox&
00024040: 26 6e 2e 69 73 53 68 61 70 65 4f 66 54 79 70 65 &n.isShapeOfType
00024050: 28 67 2c 22 65 6d 62 65 64 22 29 26 26 28 44 3d (g,"embed")&&(D=
00024060: 21 31 29 3b 63 6f 6e 73 74 20 4c 3d 6e 2e 69 73 !1);const L=n.is
00024070: 49 6e 41 6e 79 28 22 73 65 6c 65 63 74 2e 63 72 InAny("select.cr
00024080: 6f 70 2e 69 64 6c 65 22 2c 22 73 65 6c 65 63 74 op.idle","select
00024090: 2e 63 72 6f 70 2e 70 6f 69 6e 74 69 6e 67 5f 63 .crop.pointing_c
000240a0: 72 6f 70 22 2c 22 73 65 6c 65 63 74 2e 63 72 6f rop","select.cro
000240b0: 70 2e 70 6f 69 6e 74 69 6e 67 5f 63 72 6f 70 5f p.pointing_crop_
000240c0: 68 61 6e 64 6c 65 22 29 26 26 21 53 26 26 21 69 handle")&&!S&&!i
000240d0: 2c 46 3d 6e 2e 69 73 49 6e 41 6e 79 28 22 73 65 ,F=n.isInAny("se
000240e0: 6c 65 63 74 2e 69 64 6c 65 22 2c 22 73 65 6c 65 lect.idle","sele
000240f0: 63 74 2e 70 6f 69 6e 74 69 6e 67 5f 73 65 6c 65 ct.pointing_sele
00024100: 63 74 69 6f 6e 22 2c 22 73 65 6c 65 63 74 2e 70 ction","select.p
00024110: 6f 69 6e 74 69 6e 67 5f 73 68 61 70 65 22 2c 22 ointing_shape","
00024120: 73 65 6c 65 63 74 2e 63 72 6f 70 2e 69 64 6c 65 select.crop.idle
00024130: 22 29 26 26 21 53 26 26 21 69 2c 6a 3d 21 6d 26 ")&&!S&&!i,j=!m&
00024140: 26 21 28 78 7c 7c 54 29 26 26 28 46 7c 7c 4c 29 &!(x||T)&&(F||L)
00024150: 26 26 28 21 67 7c 7c 21 6e 2e 67 65 74 53 68 61 &&(!g||!n.getSha
00024160: 70 65 55 74 69 6c 28 67 29 2e 68 69 64 65 52 6f peUtil(g).hideRo
00024170: 74 61 74 65 48 61 6e 64 6c 65 28 67 29 29 26 26 tateHandle(g))&&
00024180: 21 62 2c 42 3d 6d 26 26 28 21 43 7c 7c 21 6b 29 !b,B=m&&(!C||!k)
00024190: 26 26 28 46 7c 7c 4c 29 26 26 28 21 67 7c 7c 21 &&(F||L)&&(!g||!
000241a0: 6e 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 67 n.getShapeUtil(g
000241b0: 29 2e 68 69 64 65 52 6f 74 61 74 65 48 61 6e 64 ).hideRotateHand
000241c0: 6c 65 28 67 29 29 26 26 21 62 2c 55 3d 46 26 26 le(g))&&!b,U=F&&
000241d0: 28 21 67 7c 7c 6e 2e 67 65 74 53 68 61 70 65 55 (!g||n.getShapeU
000241e0: 74 69 6c 28 67 29 2e 63 61 6e 52 65 73 69 7a 65 til(g).canResize
000241f0: 28 67 29 26 26 21 6e 2e 67 65 74 53 68 61 70 65 (g)&&!n.getShape
00024200: 55 74 69 6c 28 67 29 2e 68 69 64 65 52 65 73 69 Util(g).hideResi
00024210: 7a 65 48 61 6e 64 6c 65 73 28 67 29 29 26 26 21 zeHandles(g))&&!
00024220: 4c 26 26 21 62 2c 7a 3d 78 7c 7c 54 2c 47 3d 78 L&&!b,z=x||T,G=x
00024230: 26 26 54 2c 48 3d 41 7c 7c 49 2c 56 3d 55 7c 7c &&T,H=A||I,V=U||
00024240: 4c 2c 71 3d 21 6a 2c 57 3d 21 46 7c 7c 21 42 2c L,q=!j,W=!F||!B,
00024250: 4b 3d 21 46 7c 7c 21 56 2c 59 3d 21 46 7c 7c 21 K=!F||!V,Y=!F||!
00024260: 56 7c 7c 7a 2c 58 3d 21 46 7c 7c 21 56 7c 7c 7a V||z,X=!F||!V||z
00024270: 2c 5a 3d 21 46 7c 7c 21 56 7c 7c 47 26 26 21 4c ,Z=!F||!V||G&&!L
00024280: 3b 6c 65 74 20 51 3d 21 30 2c 4a 3d 21 30 3b 69 ;let Q=!0,J=!0;i
00024290: 66 28 4c 29 51 3d 48 2c 4a 3d 48 3b 65 6c 73 65 f(L)Q=H,J=H;else
000242a0: 20 69 66 28 55 29 7b 51 3d 7a 7c 7c 47 7c 7c 6d if(U){Q=z||G||m
000242b0: 3b 63 6f 6e 73 74 20 65 3d 6d 26 26 67 26 26 22 ;const e=m&&g&&"
000242c0: 74 65 78 74 22 3d 3d 3d 67 2e 74 79 70 65 3b 4a text"===g.type;J
000242d0: 3d 51 26 26 21 65 7d 63 6f 6e 73 74 20 24 3d 4d =Q&&!e}const $=M
000242e0: 61 74 68 2e 6d 69 6e 28 32 34 2f 76 2c 45 2d 33 ath.min(24/v,E-3
000242f0: 2a 50 29 2c 65 65 3d 46 26 26 6d 26 26 67 26 26 *P),ee=F&&m&&g&&
00024300: 6e 2e 69 73 53 68 61 70 65 4f 66 54 79 70 65 28 n.isShapeOfType(
00024310: 67 2c 22 74 65 78 74 22 29 26 26 24 2a 76 3e 3d g,"text")&&$*v>=
00024320: 34 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 4;return(0,Qc.js
00024330: 78 29 28 22 73 76 67 22 2c 7b 63 6c 61 73 73 4e x)("svg",{classN
00024340: 61 6d 65 3a 22 74 6c 2d 6f 76 65 72 6c 61 79 73 ame:"tl-overlays
00024350: 5f 5f 69 74 65 6d 20 74 6c 2d 73 65 6c 65 63 74 __item tl-select
00024360: 69 6f 6e 5f 5f 66 67 22 2c 22 64 61 74 61 2d 74 ion__fg","data-t
00024370: 65 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f estid":"selectio
00024380: 6e 2d 66 6f 72 65 67 72 6f 75 6e 64 22 2c 63 68 n-foreground",ch
00024390: 69 6c 64 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 ildren:(0,Qc.jsx
000243a0: 73 29 28 22 67 22 2c 7b 72 65 66 3a 72 2c 63 68 s)("g",{ref:r,ch
000243b0: 69 6c 64 72 65 6e 3a 5b 44 26 26 28 30 2c 51 63 ildren:[D&&(0,Qc
000243c0: 2e 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 63 6c .jsx)("rect",{cl
000243d0: 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 73 65 6c 65 assName:"tl-sele
000243e0: 63 74 69 6f 6e 5f 5f 66 67 5f 5f 6f 75 74 6c 69 ction__fg__outli
000243f0: 6e 65 22 2c 77 69 64 74 68 3a 4e 75 28 5f 29 2c ne",width:Nu(_),
00024400: 68 65 69 67 68 74 3a 4e 75 28 45 29 7d 29 2c 28 height:Nu(E)}),(
00024410: 30 2c 51 63 2e 6a 73 78 29 28 73 62 2c 7b 22 64 0,Qc.jsx)(sb,{"d
00024420: 61 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c ata-testid":"sel
00024430: 65 63 74 69 6f 6e 2e 72 6f 74 61 74 65 2e 74 6f ection.rotate.to
00024440: 70 2d 6c 65 66 74 22 2c 63 78 3a 30 2c 63 79 3a p-left",cx:0,cy:
00024450: 30 2c 74 61 72 67 65 74 53 69 7a 65 3a 4f 2c 63 0,targetSize:O,c
00024460: 6f 72 6e 65 72 3a 22 74 6f 70 5f 6c 65 66 74 5f orner:"top_left_
00024470: 72 6f 74 61 74 65 22 2c 63 75 72 73 6f 72 3a 68 rotate",cursor:h
00024480: 3f 4a 6d 28 22 6e 77 73 65 2d 72 6f 74 61 74 65 ?Jm("nwse-rotate
00024490: 22 2c 74 29 3a 76 6f 69 64 20 30 2c 69 73 48 69 ",t):void 0,isHi
000244a0: 64 64 65 6e 3a 71 7d 29 2c 28 30 2c 51 63 2e 6a dden:q}),(0,Qc.j
000244b0: 73 78 29 28 73 62 2c 7b 22 64 61 74 61 2d 74 65 sx)(sb,{"data-te
000244c0: 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e stid":"selection
000244d0: 2e 72 6f 74 61 74 65 2e 74 6f 70 2d 72 69 67 68 .rotate.top-righ
000244e0: 74 22 2c 63 78 3a 5f 2b 33 2a 4f 2c 63 79 3a 30 t",cx:_+3*O,cy:0
000244f0: 2c 74 61 72 67 65 74 53 69 7a 65 3a 4f 2c 63 6f ,targetSize:O,co
00024500: 72 6e 65 72 3a 22 74 6f 70 5f 72 69 67 68 74 5f rner:"top_right_
00024510: 72 6f 74 61 74 65 22 2c 63 75 72 73 6f 72 3a 68 rotate",cursor:h
00024520: 3f 4a 6d 28 22 6e 65 73 77 2d 72 6f 74 61 74 65 ?Jm("nesw-rotate
00024530: 22 2c 74 29 3a 76 6f 69 64 20 30 2c 69 73 48 69 ",t):void 0,isHi
00024540: 64 64 65 6e 3a 71 7d 29 2c 28 30 2c 51 63 2e 6a dden:q}),(0,Qc.j
00024550: 73 78 29 28 73 62 2c 7b 22 64 61 74 61 2d 74 65 sx)(sb,{"data-te
00024560: 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e stid":"selection
00024570: 2e 72 6f 74 61 74 65 2e 62 6f 74 74 6f 6d 2d 6c .rotate.bottom-l
00024580: 65 66 74 22 2c 63 78 3a 30 2c 63 79 3a 45 2b 33 eft",cx:0,cy:E+3
00024590: 2a 4f 2c 74 61 72 67 65 74 53 69 7a 65 3a 4f 2c *O,targetSize:O,
000245a0: 63 6f 72 6e 65 72 3a 22 62 6f 74 74 6f 6d 5f 6c corner:"bottom_l
000245b0: 65 66 74 5f 72 6f 74 61 74 65 22 2c 63 75 72 73 eft_rotate",curs
000245c0: 6f 72 3a 68 3f 4a 6d 28 22 73 77 6e 65 2d 72 6f or:h?Jm("swne-ro
000245d0: 74 61 74 65 22 2c 74 29 3a 76 6f 69 64 20 30 2c tate",t):void 0,
000245e0: 69 73 48 69 64 64 65 6e 3a 71 7d 29 2c 28 30 2c isHidden:q}),(0,
000245f0: 51 63 2e 6a 73 78 29 28 73 62 2c 7b 22 64 61 74 Qc.jsx)(sb,{"dat
00024600: 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 63 a-testid":"selec
00024610: 74 69 6f 6e 2e 72 6f 74 61 74 65 2e 62 6f 74 74 tion.rotate.bott
00024620: 6f 6d 2d 72 69 67 68 74 22 2c 63 78 3a 5f 2b 33 om-right",cx:_+3
00024630: 2a 4f 2c 63 79 3a 45 2b 33 2a 4f 2c 74 61 72 67 *O,cy:E+3*O,targ
00024640: 65 74 53 69 7a 65 3a 4f 2c 63 6f 72 6e 65 72 3a etSize:O,corner:
00024650: 22 62 6f 74 74 6f 6d 5f 72 69 67 68 74 5f 72 6f "bottom_right_ro
00024660: 74 61 74 65 22 2c 63 75 72 73 6f 72 3a 68 3f 4a tate",cursor:h?J
00024670: 6d 28 22 73 65 6e 77 2d 72 6f 74 61 74 65 22 2c m("senw-rotate",
00024680: 74 29 3a 76 6f 69 64 20 30 2c 69 73 48 69 64 64 t):void 0,isHidd
00024690: 65 6e 3a 71 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 en:q}),(0,Qc.jsx
000246a0: 29 28 63 62 2c 7b 22 64 61 74 61 2d 74 65 73 74 )(cb,{"data-test
000246b0: 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 id":"selection.r
000246c0: 6f 74 61 74 65 2e 6d 6f 62 69 6c 65 22 2c 63 78 otate.mobile",cx
000246d0: 3a 43 3f 31 2e 35 2a 2d 4f 3a 5f 2f 32 2c 63 79 :C?1.5*-O:_/2,cy
000246e0: 3a 43 3f 45 2f 32 3a 31 2e 35 2a 2d 4f 2c 73 69 :C?E/2:1.5*-O,si
000246f0: 7a 65 3a 77 2c 69 73 48 69 64 64 65 6e 3a 57 7d ze:w,isHidden:W}
00024700: 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 ),(0,Qc.jsx)("re
00024710: 63 74 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a ct",{className:J
00024720: 63 28 22 74 6c 2d 74 72 61 6e 73 70 61 72 65 6e c("tl-transparen
00024730: 74 22 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 3a t",{"tl-hidden":
00024740: 51 7d 29 2c 22 64 61 74 61 2d 74 65 73 74 69 64 Q}),"data-testid
00024750: 22 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 65 73 ":"selection.res
00024760: 69 7a 65 2e 74 6f 70 22 2c 22 61 72 69 61 2d 6c ize.top","aria-l
00024770: 61 62 65 6c 22 3a 22 74 6f 70 20 74 61 72 67 65 abel":"top targe
00024780: 74 22 2c 70 6f 69 6e 74 65 72 45 76 65 6e 74 73 t",pointerEvents
00024790: 3a 22 61 6c 6c 22 2c 78 3a 30 2c 79 3a 4e 75 28 :"all",x:0,y:Nu(
000247a0: 30 2d 28 6b 3f 32 2a 50 3a 50 29 29 2c 77 69 64 0-(k?2*P:P)),wid
000247b0: 74 68 3a 4e 75 28 5f 29 2c 68 65 69 67 68 74 3a th:Nu(_),height:
000247c0: 4e 75 28 4d 61 74 68 2e 6d 61 78 28 31 2c 32 2a Nu(Math.max(1,2*
000247d0: 50 29 29 2c 73 74 79 6c 65 3a 68 3f 7b 63 75 72 P)),style:h?{cur
000247e0: 73 6f 72 3a 4a 6d 28 22 6e 73 2d 72 65 73 69 7a sor:Jm("ns-resiz
000247f0: 65 22 2c 74 29 7d 3a 76 6f 69 64 20 30 2c 2e 2e e",t)}:void 0,..
00024800: 2e 61 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 .a}),(0,Qc.jsx)(
00024810: 22 72 65 63 74 22 2c 7b 63 6c 61 73 73 4e 61 6d "rect",{classNam
00024820: 65 3a 4a 63 28 22 74 6c 2d 74 72 61 6e 73 70 61 e:Jc("tl-transpa
00024830: 72 65 6e 74 22 2c 7b 22 74 6c 2d 68 69 64 64 65 rent",{"tl-hidde
00024840: 6e 22 3a 4a 7d 29 2c 22 64 61 74 61 2d 74 65 73 n":J}),"data-tes
00024850: 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e 2e tid":"selection.
00024860: 72 65 73 69 7a 65 2e 72 69 67 68 74 22 2c 22 61 resize.right","a
00024870: 72 69 61 2d 6c 61 62 65 6c 22 3a 22 72 69 67 68 ria-label":"righ
00024880: 74 20 74 61 72 67 65 74 22 2c 70 6f 69 6e 74 65 t target",pointe
00024890: 72 45 76 65 6e 74 73 3a 22 61 6c 6c 22 2c 78 3a rEvents:"all",x:
000248a0: 4e 75 28 5f 2d 28 43 3f 30 3a 4e 29 29 2c 79 3a Nu(_-(C?0:N)),y:
000248b0: 30 2c 68 65 69 67 68 74 3a 4e 75 28 45 29 2c 77 0,height:Nu(E),w
000248c0: 69 64 74 68 3a 4e 75 28 4d 61 74 68 2e 6d 61 78 idth:Nu(Math.max
000248d0: 28 31 2c 32 2a 4e 29 29 2c 73 74 79 6c 65 3a 68 (1,2*N)),style:h
000248e0: 3f 7b 63 75 72 73 6f 72 3a 4a 6d 28 22 65 77 2d ?{cursor:Jm("ew-
000248f0: 72 65 73 69 7a 65 22 2c 74 29 7d 3a 76 6f 69 64 resize",t)}:void
00024900: 20 30 2c 2e 2e 2e 73 7d 29 2c 28 30 2c 51 63 2e 0,...s}),(0,Qc.
00024910: 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 63 6c 61 jsx)("rect",{cla
00024920: 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 74 72 ssName:Jc("tl-tr
00024930: 61 6e 73 70 61 72 65 6e 74 22 2c 7b 22 74 6c 2d ansparent",{"tl-
00024940: 68 69 64 64 65 6e 22 3a 51 7d 29 2c 22 64 61 74 hidden":Q}),"dat
00024950: 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 63 a-testid":"selec
00024960: 74 69 6f 6e 2e 72 65 73 69 7a 65 2e 62 6f 74 74 tion.resize.bott
00024970: 6f 6d 22 2c 22 61 72 69 61 2d 6c 61 62 65 6c 22 om","aria-label"
00024980: 3a 22 62 6f 74 74 6f 6d 20 74 61 72 67 65 74 22 :"bottom target"
00024990: 2c 70 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 ,pointerEvents:"
000249a0: 61 6c 6c 22 2c 78 3a 30 2c 79 3a 4e 75 28 45 2d all",x:0,y:Nu(E-
000249b0: 28 6b 3f 30 3a 50 29 29 2c 77 69 64 74 68 3a 4e (k?0:P)),width:N
000249c0: 75 28 5f 29 2c 68 65 69 67 68 74 3a 4e 75 28 4d u(_),height:Nu(M
000249d0: 61 74 68 2e 6d 61 78 28 31 2c 32 2a 50 29 29 2c ath.max(1,2*P)),
000249e0: 73 74 79 6c 65 3a 68 3f 7b 63 75 72 73 6f 72 3a style:h?{cursor:
000249f0: 4a 6d 28 22 6e 73 2d 72 65 73 69 7a 65 22 2c 74 Jm("ns-resize",t
00024a00: 29 7d 3a 76 6f 69 64 20 30 2c 2e 2e 2e 6c 7d 29 )}:void 0,...l})
00024a10: 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 63 ,(0,Qc.jsx)("rec
00024a20: 74 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 t",{className:Jc
00024a30: 28 22 74 6c 2d 74 72 61 6e 73 70 61 72 65 6e 74 ("tl-transparent
00024a40: 22 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 3a 4a ",{"tl-hidden":J
00024a50: 7d 29 2c 22 64 61 74 61 2d 74 65 73 74 69 64 22 }),"data-testid"
00024a60: 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 65 73 69 :"selection.resi
00024a70: 7a 65 2e 6c 65 66 74 22 2c 22 61 72 69 61 2d 6c ze.left","aria-l
00024a80: 61 62 65 6c 22 3a 22 6c 65 66 74 20 74 61 72 67 abel":"left targ
00024a90: 65 74 22 2c 70 6f 69 6e 74 65 72 45 76 65 6e 74 et",pointerEvent
00024aa0: 73 3a 22 61 6c 6c 22 2c 78 3a 4e 75 28 30 2d 28 s:"all",x:Nu(0-(
00024ab0: 43 3f 32 2a 4e 3a 4e 29 29 2c 79 3a 30 2c 68 65 C?2*N:N)),y:0,he
00024ac0: 69 67 68 74 3a 4e 75 28 45 29 2c 77 69 64 74 68 ight:Nu(E),width
00024ad0: 3a 4e 75 28 4d 61 74 68 2e 6d 61 78 28 31 2c 32 :Nu(Math.max(1,2
00024ae0: 2a 4e 29 29 2c 73 74 79 6c 65 3a 68 3f 7b 63 75 *N)),style:h?{cu
00024af0: 72 73 6f 72 3a 4a 6d 28 22 65 77 2d 72 65 73 69 rsor:Jm("ew-resi
00024b00: 7a 65 22 2c 74 29 7d 3a 76 6f 69 64 20 30 2c 2e ze",t)}:void 0,.
00024b10: 2e 2e 63 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 ..c}),(0,Qc.jsx)
00024b20: 28 22 72 65 63 74 22 2c 7b 63 6c 61 73 73 4e 61 ("rect",{classNa
00024b30: 6d 65 3a 4a 63 28 22 74 6c 2d 74 72 61 6e 73 70 me:Jc("tl-transp
00024b40: 61 72 65 6e 74 22 2c 7b 22 74 6c 2d 68 69 64 64 arent",{"tl-hidd
00024b50: 65 6e 22 3a 4b 7d 29 2c 22 64 61 74 61 2d 74 65 en":K}),"data-te
00024b60: 73 74 69 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e stid":"selection
00024b70: 2e 74 61 72 67 65 74 2e 74 6f 70 2d 6c 65 66 74 .target.top-left
00024b80: 22 2c 22 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 ","aria-label":"
00024b90: 74 6f 70 2d 6c 65 66 74 20 74 61 72 67 65 74 22 top-left target"
00024ba0: 2c 70 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 ,pointerEvents:"
00024bb0: 61 6c 6c 22 2c 78 3a 4e 75 28 30 2d 28 43 3f 32 all",x:Nu(0-(C?2
00024bc0: 2a 4e 3a 31 2e 35 2a 4e 29 29 2c 79 3a 4e 75 28 *N:1.5*N)),y:Nu(
00024bd0: 30 2d 28 6b 3f 32 2a 50 3a 31 2e 35 2a 50 29 29 0-(k?2*P:1.5*P))
00024be0: 2c 77 69 64 74 68 3a 4e 75 28 33 2a 4e 29 2c 68 ,width:Nu(3*N),h
00024bf0: 65 69 67 68 74 3a 4e 75 28 33 2a 50 29 2c 73 74 eight:Nu(3*P),st
00024c00: 79 6c 65 3a 68 3f 7b 63 75 72 73 6f 72 3a 4a 6d yle:h?{cursor:Jm
00024c10: 28 22 6e 77 73 65 2d 72 65 73 69 7a 65 22 2c 74 ("nwse-resize",t
00024c20: 29 7d 3a 76 6f 69 64 20 30 2c 2e 2e 2e 75 7d 29 )}:void 0,...u})
00024c30: 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 63 ,(0,Qc.jsx)("rec
00024c40: 74 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 t",{className:Jc
00024c50: 28 22 74 6c 2d 74 72 61 6e 73 70 61 72 65 6e 74 ("tl-transparent
00024c60: 22 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 3a 59 ",{"tl-hidden":Y
00024c70: 7d 29 2c 22 64 61 74 61 2d 74 65 73 74 69 64 22 }),"data-testid"
00024c80: 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 74 61 72 67 :"selection.targ
00024c90: 65 74 2e 74 6f 70 2d 72 69 67 68 74 22 2c 22 61 et.top-right","a
00024ca0: 72 69 61 2d 6c 61 62 65 6c 22 3a 22 74 6f 70 2d ria-label":"top-
00024cb0: 72 69 67 68 74 20 74 61 72 67 65 74 22 2c 70 6f right target",po
00024cc0: 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c 6c interEvents:"all
00024cd0: 22 2c 78 3a 4e 75 28 5f 2d 28 43 3f 30 3a 31 2e ",x:Nu(_-(C?0:1.
00024ce0: 35 2a 4e 29 29 2c 79 3a 4e 75 28 30 2d 28 6b 3f 5*N)),y:Nu(0-(k?
00024cf0: 32 2a 50 3a 31 2e 35 2a 50 29 29 2c 77 69 64 74 2*P:1.5*P)),widt
00024d00: 68 3a 4e 75 28 33 2a 4e 29 2c 68 65 69 67 68 74 h:Nu(3*N),height
00024d10: 3a 4e 75 28 33 2a 50 29 2c 73 74 79 6c 65 3a 68 :Nu(3*P),style:h
00024d20: 3f 7b 63 75 72 73 6f 72 3a 4a 6d 28 22 6e 65 73 ?{cursor:Jm("nes
00024d30: 77 2d 72 65 73 69 7a 65 22 2c 74 29 7d 3a 76 6f w-resize",t)}:vo
00024d40: 69 64 20 30 2c 2e 2e 2e 64 7d 29 2c 28 30 2c 51 id 0,...d}),(0,Q
00024d50: 63 2e 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 63 c.jsx)("rect",{c
00024d60: 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d lassName:Jc("tl-
00024d70: 74 72 61 6e 73 70 61 72 65 6e 74 22 2c 7b 22 74 transparent",{"t
00024d80: 6c 2d 68 69 64 64 65 6e 22 3a 5a 7d 29 2c 22 64 l-hidden":Z}),"d
00024d90: 61 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c ata-testid":"sel
00024da0: 65 63 74 69 6f 6e 2e 74 61 72 67 65 74 2e 62 6f ection.target.bo
00024db0: 74 74 6f 6d 2d 72 69 67 68 74 22 2c 22 61 72 69 ttom-right","ari
00024dc0: 61 2d 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d a-label":"bottom
00024dd0: 2d 72 69 67 68 74 20 74 61 72 67 65 74 22 2c 70 -right target",p
00024de0: 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c ointerEvents:"al
00024df0: 6c 22 2c 78 3a 4e 75 28 5f 2d 28 43 3f 4e 3a 31 l",x:Nu(_-(C?N:1
00024e00: 2e 35 2a 4e 29 29 2c 79 3a 4e 75 28 45 2d 28 6b .5*N)),y:Nu(E-(k
00024e10: 3f 50 3a 31 2e 35 2a 50 29 29 2c 77 69 64 74 68 ?P:1.5*P)),width
00024e20: 3a 4e 75 28 33 2a 4e 29 2c 68 65 69 67 68 74 3a :Nu(3*N),height:
00024e30: 4e 75 28 33 2a 50 29 2c 73 74 79 6c 65 3a 68 3f Nu(3*P),style:h?
00024e40: 7b 63 75 72 73 6f 72 3a 4a 6d 28 22 6e 77 73 65 {cursor:Jm("nwse
00024e50: 2d 72 65 73 69 7a 65 22 2c 74 29 7d 3a 76 6f 69 -resize",t)}:voi
00024e60: 64 20 30 2c 2e 2e 2e 70 7d 29 2c 28 30 2c 51 63 d 0,...p}),(0,Qc
00024e70: 2e 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 63 6c .jsx)("rect",{cl
00024e80: 61 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 74 assName:Jc("tl-t
00024e90: 72 61 6e 73 70 61 72 65 6e 74 22 2c 7b 22 74 6c ransparent",{"tl
00024ea0: 2d 68 69 64 64 65 6e 22 3a 58 7d 29 2c 22 64 61 -hidden":X}),"da
00024eb0: 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 ta-testid":"sele
00024ec0: 63 74 69 6f 6e 2e 74 61 72 67 65 74 2e 62 6f 74 ction.target.bot
00024ed0: 74 6f 6d 2d 6c 65 66 74 22 2c 22 61 72 69 61 2d tom-left","aria-
00024ee0: 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 2d 6c label":"bottom-l
00024ef0: 65 66 74 20 74 61 72 67 65 74 22 2c 70 6f 69 6e eft target",poin
00024f00: 74 65 72 45 76 65 6e 74 73 3a 22 61 6c 6c 22 2c terEvents:"all",
00024f10: 78 3a 4e 75 28 30 2d 28 43 3f 33 2a 4e 3a 31 2e x:Nu(0-(C?3*N:1.
00024f20: 35 2a 4e 29 29 2c 79 3a 4e 75 28 45 2d 28 6b 3f 5*N)),y:Nu(E-(k?
00024f30: 30 3a 31 2e 35 2a 50 29 29 2c 77 69 64 74 68 3a 0:1.5*P)),width:
00024f40: 4e 75 28 33 2a 4e 29 2c 68 65 69 67 68 74 3a 4e Nu(3*N),height:N
00024f50: 75 28 33 2a 50 29 2c 73 74 79 6c 65 3a 68 3f 7b u(3*P),style:h?{
00024f60: 63 75 72 73 6f 72 3a 4a 6d 28 22 6e 65 73 77 2d cursor:Jm("nesw-
00024f70: 72 65 73 69 7a 65 22 2c 74 29 7d 3a 76 6f 69 64 resize",t)}:void
00024f80: 20 30 2c 2e 2e 2e 66 7d 29 2c 55 26 26 28 30 2c 0,...f}),U&&(0,
00024f90: 51 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 67 Qc.jsxs)(Qc.Frag
00024fa0: 6d 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b ment,{children:[
00024fb0: 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 63 74 (0,Qc.jsx)("rect
00024fc0: 22 2c 7b 22 64 61 74 61 2d 74 65 73 74 69 64 22 ",{"data-testid"
00024fd0: 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 65 73 69 :"selection.resi
00024fe0: 7a 65 2e 74 6f 70 2d 6c 65 66 74 22 2c 63 6c 61 ze.top-left",cla
00024ff0: 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 63 6f ssName:Jc("tl-co
00025000: 72 6e 65 72 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 rner-handle",{"t
00025010: 6c 2d 68 69 64 64 65 6e 22 3a 4b 7d 29 2c 22 61 l-hidden":K}),"a
00025020: 72 69 61 2d 6c 61 62 65 6c 22 3a 22 74 6f 70 5f ria-label":"top_
00025030: 6c 65 66 74 20 68 61 6e 64 6c 65 22 2c 78 3a 4e left handle",x:N
00025040: 75 28 30 2d 77 2f 32 29 2c 79 3a 4e 75 28 30 2d u(0-w/2),y:Nu(0-
00025050: 77 2f 32 29 2c 77 69 64 74 68 3a 4e 75 28 77 29 w/2),width:Nu(w)
00025060: 2c 68 65 69 67 68 74 3a 4e 75 28 77 29 7d 29 2c ,height:Nu(w)}),
00025070: 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 63 74 (0,Qc.jsx)("rect
00025080: 22 2c 7b 22 64 61 74 61 2d 74 65 73 74 69 64 22 ",{"data-testid"
00025090: 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 65 73 69 :"selection.resi
000250a0: 7a 65 2e 74 6f 70 2d 72 69 67 68 74 22 2c 63 6c ze.top-right",cl
000250b0: 61 73 73 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 63 assName:Jc("tl-c
000250c0: 6f 72 6e 65 72 2d 68 61 6e 64 6c 65 22 2c 7b 22 orner-handle",{"
000250d0: 74 6c 2d 68 69 64 64 65 6e 22 3a 59 7d 29 2c 22 tl-hidden":Y}),"
000250e0: 61 72 69 61 2d 6c 61 62 65 6c 22 3a 22 74 6f 70 aria-label":"top
000250f0: 5f 72 69 67 68 74 20 68 61 6e 64 6c 65 22 2c 78 _right handle",x
00025100: 3a 4e 75 28 5f 2d 77 2f 32 29 2c 79 3a 4e 75 28 :Nu(_-w/2),y:Nu(
00025110: 30 2d 77 2f 32 29 2c 77 69 64 74 68 3a 4e 75 28 0-w/2),width:Nu(
00025120: 77 29 2c 68 65 69 67 68 74 3a 4e 75 28 77 29 7d w),height:Nu(w)}
00025130: 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 ),(0,Qc.jsx)("re
00025140: 63 74 22 2c 7b 22 64 61 74 61 2d 74 65 73 74 69 ct",{"data-testi
00025150: 64 22 3a 22 73 65 6c 65 63 74 69 6f 6e 2e 72 65 d":"selection.re
00025160: 73 69 7a 65 2e 62 6f 74 74 6f 6d 2d 72 69 67 68 size.bottom-righ
00025170: 74 22 2c 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 t",className:Jc(
00025180: 22 74 6c 2d 63 6f 72 6e 65 72 2d 68 61 6e 64 6c "tl-corner-handl
00025190: 65 22 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 3a e",{"tl-hidden":
000251a0: 5a 7d 29 2c 22 61 72 69 61 2d 6c 61 62 65 6c 22 Z}),"aria-label"
000251b0: 3a 22 62 6f 74 74 6f 6d 5f 72 69 67 68 74 20 68 :"bottom_right h
000251c0: 61 6e 64 6c 65 22 2c 78 3a 4e 75 28 5f 2d 77 2f andle",x:Nu(_-w/
000251d0: 32 29 2c 79 3a 4e 75 28 45 2d 77 2f 32 29 2c 77 2),y:Nu(E-w/2),w
000251e0: 69 64 74 68 3a 4e 75 28 77 29 2c 68 65 69 67 68 idth:Nu(w),heigh
000251f0: 74 3a 4e 75 28 77 29 7d 29 2c 28 30 2c 51 63 2e t:Nu(w)}),(0,Qc.
00025200: 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 22 64 61 jsx)("rect",{"da
00025210: 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 ta-testid":"sele
00025220: 63 74 69 6f 6e 2e 72 65 73 69 7a 65 2e 62 6f 74 ction.resize.bot
00025230: 74 6f 6d 2d 6c 65 66 74 22 2c 63 6c 61 73 73 4e tom-left",classN
00025240: 61 6d 65 3a 4a 63 28 22 74 6c 2d 63 6f 72 6e 65 ame:Jc("tl-corne
00025250: 72 2d 68 61 6e 64 6c 65 22 2c 7b 22 74 6c 2d 68 r-handle",{"tl-h
00025260: 69 64 64 65 6e 22 3a 58 7d 29 2c 22 61 72 69 61 idden":X}),"aria
00025270: 2d 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 5f -label":"bottom_
00025280: 6c 65 66 74 20 68 61 6e 64 6c 65 22 2c 78 3a 4e left handle",x:N
00025290: 75 28 30 2d 77 2f 32 29 2c 79 3a 4e 75 28 45 2d u(0-w/2),y:Nu(E-
000252a0: 77 2f 32 29 2c 77 69 64 74 68 3a 4e 75 28 77 29 w/2),width:Nu(w)
000252b0: 2c 68 65 69 67 68 74 3a 4e 75 28 77 29 7d 29 5d ,height:Nu(w)})]
000252c0: 7d 29 2c 65 65 26 26 28 30 2c 51 63 2e 6a 73 78 }),ee&&(0,Qc.jsx
000252d0: 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b s)(Qc.Fragment,{
000252e0: 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e children:[(0,Qc.
000252f0: 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 22 64 61 jsx)("rect",{"da
00025300: 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 ta-testid":"sele
00025310: 63 74 69 6f 6e 2e 74 65 78 74 2d 72 65 73 69 7a ction.text-resiz
00025320: 65 2e 6c 65 66 74 2e 68 61 6e 64 6c 65 22 2c 63 e.left.handle",c
00025330: 6c 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 74 65 78 lassName:"tl-tex
00025340: 74 2d 68 61 6e 64 6c 65 22 2c 22 61 72 69 61 2d t-handle","aria-
00025350: 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 5f 6c label":"bottom_l
00025360: 65 66 74 20 68 61 6e 64 6c 65 22 2c 78 3a 4e 75 eft handle",x:Nu
00025370: 28 30 2d 77 2f 34 29 2c 79 3a 4e 75 28 45 2f 32 (0-w/4),y:Nu(E/2
00025380: 2d 24 2f 32 29 2c 72 78 3a 77 2f 34 2c 77 69 64 -$/2),rx:w/4,wid
00025390: 74 68 3a 4e 75 28 77 2f 32 29 2c 68 65 69 67 68 th:Nu(w/2),heigh
000253a0: 74 3a 4e 75 28 24 29 7d 29 2c 28 30 2c 51 63 2e t:Nu($)}),(0,Qc.
000253b0: 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 22 64 61 jsx)("rect",{"da
000253c0: 74 61 2d 74 65 73 74 69 64 22 3a 22 73 65 6c 65 ta-testid":"sele
000253d0: 63 74 69 6f 6e 2e 74 65 78 74 2d 72 65 73 69 7a ction.text-resiz
000253e0: 65 2e 72 69 67 68 74 2e 68 61 6e 64 6c 65 22 2c e.right.handle",
000253f0: 63 6c 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 74 65 className:"tl-te
00025400: 78 74 2d 68 61 6e 64 6c 65 22 2c 22 61 72 69 61 xt-handle","aria
00025410: 2d 6c 61 62 65 6c 22 3a 22 62 6f 74 74 6f 6d 5f -label":"bottom_
00025420: 6c 65 66 74 20 68 61 6e 64 6c 65 22 2c 72 78 3a left handle",rx:
00025430: 77 2f 34 2c 78 3a 4e 75 28 5f 2d 77 2f 34 29 2c w/4,x:Nu(_-w/4),
00025440: 79 3a 4e 75 28 45 2f 32 2d 24 2f 32 29 2c 77 69 y:Nu(E/2-$/2),wi
00025450: 64 74 68 3a 4e 75 28 77 2f 32 29 2c 68 65 69 67 dth:Nu(w/2),heig
00025460: 68 74 3a 4e 75 28 24 29 7d 29 5d 7d 29 2c 4c 26 ht:Nu($)})]}),L&
00025470: 26 28 30 2c 51 63 2e 6a 73 78 29 28 69 62 2c 7b &(0,Qc.jsx)(ib,{
00025480: 73 69 7a 65 3a 77 2c 77 69 64 74 68 3a 5f 2c 68 size:w,width:_,h
00025490: 65 69 67 68 74 3a 45 2c 68 69 64 65 41 6c 74 65 eight:E,hideAlte
000254a0: 72 6e 61 74 65 48 61 6e 64 6c 65 73 3a 48 7d 29 rnateHandles:H})
000254b0: 5d 7d 29 7d 29 7d 29 29 2c 73 62 3d 66 75 6e 63 ]})})})),sb=func
000254c0: 74 69 6f 6e 28 7b 63 78 3a 65 2c 63 79 3a 74 2c tion({cx:e,cy:t,
000254d0: 74 61 72 67 65 74 53 69 7a 65 3a 6e 2c 63 6f 72 targetSize:n,cor
000254e0: 6e 65 72 3a 72 2c 63 75 72 73 6f 72 3a 6f 2c 69 ner:r,cursor:o,i
000254f0: 73 48 69 64 64 65 6e 3a 69 2c 22 64 61 74 61 2d sHidden:i,"data-
00025500: 74 65 73 74 69 64 22 3a 61 7d 29 7b 63 6f 6e 73 testid":a}){cons
00025510: 74 20 73 3d 4e 67 28 72 29 3b 72 65 74 75 72 6e t s=Ng(r);return
00025520: 28 30 2c 51 63 2e 6a 73 78 29 28 22 72 65 63 74 (0,Qc.jsx)("rect
00025530: 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 ",{className:Jc(
00025540: 22 74 6c 2d 74 72 61 6e 73 70 61 72 65 6e 74 22 "tl-transparent"
00025550: 2c 22 74 6c 2d 72 6f 74 61 74 65 2d 63 6f 72 6e ,"tl-rotate-corn
00025560: 65 72 22 2c 7b 22 74 6c 2d 68 69 64 64 65 6e 22 er",{"tl-hidden"
00025570: 3a 69 7d 29 2c 22 64 61 74 61 2d 74 65 73 74 69 :i}),"data-testi
00025580: 64 22 3a 61 2c 22 61 72 69 61 2d 6c 61 62 65 6c d":a,"aria-label
00025590: 22 3a 60 24 7b 72 7d 20 74 61 72 67 65 74 60 2c ":`${r} target`,
000255a0: 70 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 pointerEvents:"a
000255b0: 6c 6c 22 2c 78 3a 4e 75 28 65 2d 33 2a 6e 29 2c ll",x:Nu(e-3*n),
000255c0: 79 3a 4e 75 28 74 2d 33 2a 6e 29 2c 77 69 64 74 y:Nu(t-3*n),widt
000255d0: 68 3a 4e 75 28 4d 61 74 68 2e 6d 61 78 28 31 2c h:Nu(Math.max(1,
000255e0: 33 2a 6e 29 29 2c 68 65 69 67 68 74 3a 4e 75 28 3*n)),height:Nu(
000255f0: 4d 61 74 68 2e 6d 61 78 28 31 2c 33 2a 6e 29 29 Math.max(1,3*n))
00025600: 2c 63 75 72 73 6f 72 3a 6f 2c 2e 2e 2e 73 7d 29 ,cursor:o,...s})
00025610: 7d 2c 6c 62 3d 4d 61 74 68 2e 73 71 72 74 28 4d },lb=Math.sqrt(M
00025620: 61 74 68 2e 50 49 29 2c 63 62 3d 66 75 6e 63 74 ath.PI),cb=funct
00025630: 69 6f 6e 28 7b 63 78 3a 65 2c 63 79 3a 74 2c 73 ion({cx:e,cy:t,s
00025640: 69 7a 65 3a 6e 2c 69 73 48 69 64 64 65 6e 3a 72 ize:n,isHidden:r
00025650: 2c 22 64 61 74 61 2d 74 65 73 74 69 64 22 3a 6f ,"data-testid":o
00025660: 7d 29 7b 63 6f 6e 73 74 20 69 3d 4e 67 28 22 6d }){const i=Ng("m
00025670: 6f 62 69 6c 65 5f 72 6f 74 61 74 65 22 29 2c 61 obile_rotate"),a
00025680: 3d 72 75 28 29 2c 73 3d 64 61 28 22 7a 6f 6f 6d =ru(),s=da("zoom
00025690: 20 6c 65 76 65 6c 22 2c 28 28 29 3d 3e 61 2e 67 level",(()=>a.g
000256a0: 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 29 2c 5b etZoomLevel()),[
000256b0: 61 5d 29 2c 6c 3d 4d 61 74 68 2e 6d 61 78 28 31 a]),l=Math.max(1
000256c0: 2f 73 2a 31 34 2c 32 30 2f 4d 61 74 68 2e 6d 61 /s*14,20/Math.ma
000256d0: 78 28 31 2c 73 29 29 3b 72 65 74 75 72 6e 28 30 x(1,s));return(0
000256e0: 2c 51 63 2e 6a 73 78 73 29 28 22 67 22 2c 7b 63 ,Qc.jsxs)("g",{c
000256f0: 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a hildren:[(0,Qc.j
00025700: 73 78 29 28 22 63 69 72 63 6c 65 22 2c 7b 22 64 sx)("circle",{"d
00025710: 61 74 61 2d 74 65 73 74 69 64 22 3a 6f 2c 70 6f ata-testid":o,po
00025720: 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c 6c interEvents:"all
00025730: 22 2c 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 ",className:Jc("
00025740: 74 6c 2d 74 72 61 6e 73 70 61 72 65 6e 74 22 2c tl-transparent",
00025750: 22 74 6c 2d 6d 6f 62 69 6c 65 2d 72 6f 74 61 74 "tl-mobile-rotat
00025760: 65 5f 5f 62 67 22 2c 7b 22 74 6c 2d 68 69 64 64 e__bg",{"tl-hidd
00025770: 65 6e 22 3a 72 7d 29 2c 63 78 3a 65 2c 63 79 3a en":r}),cx:e,cy:
00025780: 74 2c 72 3a 6c 2c 2e 2e 2e 69 7d 29 2c 28 30 2c t,r:l,...i}),(0,
00025790: 51 63 2e 6a 73 78 29 28 22 63 69 72 63 6c 65 22 Qc.jsx)("circle"
000257a0: 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 4a 63 28 22 ,{className:Jc("
000257b0: 74 6c 2d 6d 6f 62 69 6c 65 2d 72 6f 74 61 74 65 tl-mobile-rotate
000257c0: 5f 5f 66 67 22 2c 7b 22 74 6c 2d 68 69 64 64 65 __fg",{"tl-hidde
000257d0: 6e 22 3a 72 7d 29 2c 63 78 3a 65 2c 63 79 3a 74 n":r}),cx:e,cy:t
000257e0: 2c 72 3a 6e 2f 6c 62 7d 29 5d 7d 29 7d 3b 66 75 ,r:n/lb})]})};fu
000257f0: 6e 63 74 69 6f 6e 20 75 62 28 65 2c 74 2c 6e 29 nction ub(e,t,n)
00025800: 7b 63 6f 6e 73 74 7b 61 72 72 6f 77 68 65 61 64 {const{arrowhead
00025810: 53 74 61 72 74 3a 72 2c 61 72 72 6f 77 68 65 61 Start:r,arrowhea
00025820: 64 45 6e 64 3a 6f 7d 3d 74 2e 70 72 6f 70 73 2c dEnd:o}=t.props,
00025830: 69 3d 53 62 28 65 2c 74 2c 6e 29 2c 61 3d 69 2e i=Sb(e,t,n),a=i.
00025840: 73 74 61 72 74 2e 63 6c 6f 6e 65 28 29 2c 73 3d start.clone(),s=
00025850: 69 2e 65 6e 64 2e 63 6c 6f 6e 65 28 29 2c 6c 3d i.end.clone(),l=
00025860: 73 75 2e 4d 65 64 28 61 2c 73 29 3b 69 66 28 73 su.Med(a,s);if(s
00025870: 75 2e 45 71 75 61 6c 73 28 61 2c 73 29 29 72 65 u.Equals(a,s))re
00025880: 74 75 72 6e 7b 62 69 6e 64 69 6e 67 73 3a 6e 2c turn{bindings:n,
00025890: 69 73 53 74 72 61 69 67 68 74 3a 21 30 2c 73 74 isStraight:!0,st
000258a0: 61 72 74 3a 7b 68 61 6e 64 6c 65 3a 61 2c 70 6f art:{handle:a,po
000258b0: 69 6e 74 3a 61 2c 61 72 72 6f 77 68 65 61 64 3a int:a,arrowhead:
000258c0: 74 2e 70 72 6f 70 73 2e 61 72 72 6f 77 68 65 61 t.props.arrowhea
000258d0: 64 53 74 61 72 74 7d 2c 65 6e 64 3a 7b 68 61 6e dStart},end:{han
000258e0: 64 6c 65 3a 73 2c 70 6f 69 6e 74 3a 73 2c 61 72 dle:s,point:s,ar
000258f0: 72 6f 77 68 65 61 64 3a 74 2e 70 72 6f 70 73 2e rowhead:t.props.
00025900: 61 72 72 6f 77 68 65 61 64 45 6e 64 7d 2c 6d 69 arrowheadEnd},mi
00025910: 64 64 6c 65 3a 6c 2c 69 73 56 61 6c 69 64 3a 21 ddle:l,isValid:!
00025920: 31 2c 6c 65 6e 67 74 68 3a 30 7d 3b 63 6f 6e 73 1,length:0};cons
00025930: 74 20 63 3d 73 75 2e 53 75 62 28 73 2c 61 29 2e t c=su.Sub(s,a).
00025940: 75 6e 69 28 29 2c 75 3d 6d 62 28 65 2c 74 2c 22 uni(),u=mb(e,t,"
00025950: 73 74 61 72 74 22 29 2c 64 3d 6d 62 28 65 2c 74 start"),d=mb(e,t
00025960: 2c 22 65 6e 64 22 29 2c 70 3d 65 2e 67 65 74 53 ,"end"),p=e.getS
00025970: 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 6f 72 hapePageTransfor
00025980: 6d 28 74 29 3b 64 62 28 73 2c 69 2e 73 74 61 72 m(t);db(s,i.star
00025990: 74 2c 70 2c 64 29 2c 64 62 28 61 2c 69 2e 65 6e t,p,d),db(a,i.en
000259a0: 64 2c 70 2c 75 29 3b 6c 65 74 20 66 3d 30 2c 68 d,p,u);let f=0,h
000259b0: 3d 30 2c 6d 3d 30 2c 67 3d 30 2c 62 3d 77 62 2a =0,m=0,g=0,b=wb*
000259c0: 74 2e 70 72 6f 70 73 2e 73 63 61 6c 65 3b 63 6f t.props.scale;co
000259d0: 6e 73 74 20 79 3d 75 26 26 64 26 26 75 2e 73 68 nst y=u&&d&&u.sh
000259e0: 61 70 65 3d 3d 3d 64 2e 73 68 61 70 65 2c 76 3d ape===d.shape,v=
000259f0: 75 26 26 64 3f 6b 62 28 65 2c 75 2e 73 68 61 70 u&&d?kb(e,u.shap
00025a00: 65 2e 69 64 2c 64 2e 73 68 61 70 65 2e 69 64 29 e.id,d.shape.id)
00025a10: 3a 22 73 61 66 65 22 3b 22 73 61 66 65 22 21 3d :"safe";"safe"!=
00025a20: 3d 76 7c 7c 21 75 7c 7c 21 64 7c 7c 79 7c 7c 75 =v||!u||!d||y||u
00025a30: 2e 69 73 45 78 61 63 74 7c 7c 64 2e 69 73 45 78 .isExact||d.isEx
00025a40: 61 63 74 7c 7c 28 64 2e 64 69 64 49 6e 74 65 72 act||(d.didInter
00025a50: 73 65 63 74 26 26 21 75 2e 64 69 64 49 6e 74 65 sect&&!u.didInte
00025a60: 72 73 65 63 74 3f 75 2e 69 73 43 6c 6f 73 65 64 rsect?u.isClosed
00025a70: 26 26 61 2e 73 65 74 54 6f 28 73 2e 63 6c 6f 6e &&a.setTo(s.clon
00025a80: 65 28 29 2e 61 64 64 28 63 2e 63 6c 6f 6e 65 28 e().add(c.clone(
00025a90: 29 2e 6d 75 6c 28 77 62 2a 74 2e 70 72 6f 70 73 ).mul(wb*t.props
00025aa0: 2e 73 63 61 6c 65 29 29 29 3a 64 2e 64 69 64 49 .scale))):d.didI
00025ab0: 6e 74 65 72 73 65 63 74 7c 7c 64 2e 69 73 43 6c ntersect||d.isCl
00025ac0: 6f 73 65 64 26 26 73 2e 73 65 74 54 6f 28 61 2e osed&&s.setTo(a.
00025ad0: 63 6c 6f 6e 65 28 29 2e 73 75 62 28 63 2e 63 6c clone().sub(c.cl
00025ae0: 6f 6e 65 28 29 2e 6d 75 6c 28 77 62 2a 74 2e 70 one().mul(wb*t.p
00025af0: 72 6f 70 73 2e 73 63 61 6c 65 29 29 29 29 3b 63 rops.scale))));c
00025b00: 6f 6e 73 74 20 53 3d 73 75 2e 53 75 62 28 73 2c onst S=su.Sub(s,
00025b10: 61 29 2c 5f 3d 73 75 2e 4c 65 6e 28 53 29 3f 53 a),_=su.Len(S)?S
00025b20: 2e 75 6e 69 28 29 3a 73 75 2e 46 72 6f 6d 28 53 .uni():su.From(S
00025b30: 29 2c 45 3d 21 73 75 2e 45 71 75 61 6c 73 28 5f ),E=!su.Equals(_
00025b40: 2c 63 29 3b 79 7c 7c 28 22 73 74 61 72 74 2d 63 ,c);y||("start-c
00025b50: 6f 6e 74 61 69 6e 73 2d 65 6e 64 22 21 3d 3d 76 ontains-end"!==v
00025b60: 26 26 75 26 26 22 6e 6f 6e 65 22 21 3d 3d 72 26 &&u&&"none"!==r&
00025b70: 26 21 75 2e 69 73 45 78 61 63 74 26 26 28 6d 3d &!u.isExact&&(m=
00025b80: 43 62 5b 74 2e 70 72 6f 70 73 2e 73 69 7a 65 5d Cb[t.props.size]
00025b90: 2f 32 2b 28 22 73 69 7a 65 22 69 6e 20 75 2e 73 /2+("size"in u.s
00025ba0: 68 61 70 65 2e 70 72 6f 70 73 3f 43 62 5b 75 2e hape.props?Cb[u.
00025bb0: 73 68 61 70 65 2e 70 72 6f 70 73 2e 73 69 7a 65 shape.props.size
00025bc0: 5d 2f 32 3a 30 29 2c 66 3d 28 78 62 2b 6d 29 2a ]/2:0),f=(xb+m)*
00025bd0: 74 2e 70 72 6f 70 73 2e 73 63 61 6c 65 2c 62 2b t.props.scale,b+
00025be0: 3d 6d 2a 74 2e 70 72 6f 70 73 2e 73 63 61 6c 65 =m*t.props.scale
00025bf0: 29 2c 22 65 6e 64 2d 63 6f 6e 74 61 69 6e 73 2d ),"end-contains-
00025c00: 73 74 61 72 74 22 21 3d 3d 76 26 26 64 26 26 22 start"!==v&&d&&"
00025c10: 6e 6f 6e 65 22 21 3d 3d 6f 26 26 21 64 2e 69 73 none"!==o&&!d.is
00025c20: 45 78 61 63 74 26 26 28 67 3d 43 62 5b 74 2e 70 Exact&&(g=Cb[t.p
00025c30: 72 6f 70 73 2e 73 69 7a 65 5d 2f 32 2b 28 22 73 rops.size]/2+("s
00025c40: 69 7a 65 22 69 6e 20 64 2e 73 68 61 70 65 2e 70 ize"in d.shape.p
00025c50: 72 6f 70 73 3f 43 62 5b 64 2e 73 68 61 70 65 2e rops?Cb[d.shape.
00025c60: 70 72 6f 70 73 2e 73 69 7a 65 5d 2f 32 3a 30 29 props.size]/2:0)
00025c70: 2c 68 3d 28 78 62 2b 67 29 2a 74 2e 70 72 6f 70 ,h=(xb+g)*t.prop
00025c80: 73 2e 73 63 61 6c 65 2c 62 2b 3d 67 2a 74 2e 70 s.scale,b+=g*t.p
00025c90: 72 6f 70 73 2e 73 63 61 6c 65 29 29 3b 63 6f 6e rops.scale));con
00025ca0: 73 74 20 77 3d 61 2e 63 6c 6f 6e 65 28 29 2e 61 st w=a.clone().a
00025cb0: 64 64 28 5f 2e 63 6c 6f 6e 65 28 29 2e 6d 75 6c dd(_.clone().mul
00025cc0: 28 66 2a 28 45 3f 2d 31 3a 31 29 29 29 2c 78 3d (f*(E?-1:1))),x=
00025cd0: 73 2e 63 6c 6f 6e 65 28 29 2e 73 75 62 28 5f 2e s.clone().sub(_.
00025ce0: 63 6c 6f 6e 65 28 29 2e 6d 75 6c 28 68 2a 28 45 clone().mul(h*(E
00025cf0: 3f 2d 31 3a 31 29 29 29 3b 73 75 2e 44 69 73 74 ?-1:1)));su.Dist
00025d00: 4d 69 6e 28 77 2c 78 2c 62 29 26 26 28 30 21 3d Min(w,x,b)&&(0!=
00025d10: 3d 66 26 26 30 21 3d 3d 68 3f 28 66 2a 3d 2d 31 =f&&0!==h?(f*=-1
00025d20: 2e 35 2c 68 2a 3d 2d 31 2e 35 29 3a 30 21 3d 3d .5,h*=-1.5):0!==
00025d30: 66 3f 66 2a 3d 2d 31 3a 30 21 3d 3d 68 26 26 28 f?f*=-1:0!==h&&(
00025d40: 68 2a 3d 2d 31 29 29 2c 61 2e 61 64 64 28 5f 2e h*=-1)),a.add(_.
00025d50: 63 6c 6f 6e 65 28 29 2e 6d 75 6c 28 66 2a 28 45 clone().mul(f*(E
00025d60: 3f 2d 31 3a 31 29 29 29 2c 73 2e 73 75 62 28 5f ?-1:1))),s.sub(_
00025d70: 2e 63 6c 6f 6e 65 28 29 2e 6d 75 6c 28 68 2a 28 .clone().mul(h*(
00025d80: 45 3f 2d 31 3a 31 29 29 29 2c 45 3f 28 75 26 26 E?-1:1))),E?(u&&
00025d90: 64 26 26 73 2e 73 65 74 54 6f 28 73 75 2e 41 64 d&&s.setTo(su.Ad
00025da0: 64 28 61 2c 5f 2e 63 6c 6f 6e 65 28 29 2e 6d 75 d(a,_.clone().mu
00025db0: 6c 28 2d 77 62 2a 74 2e 70 72 6f 70 73 2e 73 63 l(-wb*t.props.sc
00025dc0: 61 6c 65 29 29 29 2c 6c 2e 73 65 74 54 6f 28 73 ale))),l.setTo(s
00025dd0: 75 2e 4d 65 64 28 69 2e 73 74 61 72 74 2c 69 2e u.Med(i.start,i.
00025de0: 65 6e 64 29 29 29 3a 6c 2e 73 65 74 54 6f 28 73 end))):l.setTo(s
00025df0: 75 2e 4d 65 64 28 61 2c 73 29 29 3b 63 6f 6e 73 u.Med(a,s));cons
00025e00: 74 20 54 3d 73 75 2e 44 69 73 74 28 61 2c 73 29 t T=su.Dist(a,s)
00025e10: 3b 72 65 74 75 72 6e 7b 62 69 6e 64 69 6e 67 73 ;return{bindings
00025e20: 3a 6e 2c 69 73 53 74 72 61 69 67 68 74 3a 21 30 :n,isStraight:!0
00025e30: 2c 73 74 61 72 74 3a 7b 68 61 6e 64 6c 65 3a 69 ,start:{handle:i
00025e40: 2e 73 74 61 72 74 2c 70 6f 69 6e 74 3a 61 2c 61 .start,point:a,a
00025e50: 72 72 6f 77 68 65 61 64 3a 74 2e 70 72 6f 70 73 rrowhead:t.props
00025e60: 2e 61 72 72 6f 77 68 65 61 64 53 74 61 72 74 7d .arrowheadStart}
00025e70: 2c 65 6e 64 3a 7b 68 61 6e 64 6c 65 3a 69 2e 65 ,end:{handle:i.e
00025e80: 6e 64 2c 70 6f 69 6e 74 3a 73 2c 61 72 72 6f 77 nd,point:s,arrow
00025e90: 68 65 61 64 3a 74 2e 70 72 6f 70 73 2e 61 72 72 head:t.props.arr
00025ea0: 6f 77 68 65 61 64 45 6e 64 7d 2c 6d 69 64 64 6c owheadEnd},middl
00025eb0: 65 3a 6c 2c 69 73 56 61 6c 69 64 3a 54 3e 30 2c e:l,isValid:T>0,
00025ec0: 6c 65 6e 67 74 68 3a 54 7d 7d 66 75 6e 63 74 69 length:T}}functi
00025ed0: 6f 6e 20 64 62 28 65 2c 74 2c 6e 2c 72 29 7b 69 on db(e,t,n,r){i
00025ee0: 66 28 76 6f 69 64 20 30 3d 3d 3d 72 29 72 65 74 f(void 0===r)ret
00025ef0: 75 72 6e 3b 69 66 28 72 2e 69 73 45 78 61 63 74 urn;if(r.isExact
00025f00: 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 6f 3d )return;const o=
00025f10: 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 wp.applyToPoint(
00025f20: 6e 2c 74 29 2c 69 3d 77 70 2e 61 70 70 6c 79 54 n,t),i=wp.applyT
00025f30: 6f 50 6f 69 6e 74 28 6e 2c 65 29 2c 61 3d 77 70 oPoint(n,e),a=wp
00025f40: 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 77 70 .applyToPoint(wp
00025f50: 2e 49 6e 76 65 72 73 65 28 72 2e 74 72 61 6e 73 .Inverse(r.trans
00025f60: 66 6f 72 6d 29 2c 6f 29 2c 73 3d 77 70 2e 61 70 form),o),s=wp.ap
00025f70: 70 6c 79 54 6f 50 6f 69 6e 74 28 77 70 2e 49 6e plyToPoint(wp.In
00025f80: 76 65 72 73 65 28 72 2e 74 72 61 6e 73 66 6f 72 verse(r.transfor
00025f90: 6d 29 2c 69 29 2c 6c 3d 72 2e 69 73 43 6c 6f 73 m),i),l=r.isClos
00025fa0: 65 64 2c 63 3d 28 6c 3f 79 68 3a 62 68 29 28 61 ed,c=(l?yh:bh)(a
00025fb0: 2c 73 2c 72 2e 6f 75 74 6c 69 6e 65 29 3b 6c 65 ,s,r.outline);le
00025fc0: 74 20 75 3b 69 66 28 6e 75 6c 6c 21 3d 3d 63 26 t u;if(null!==c&
00025fd0: 26 28 75 3d 63 2e 73 6f 72 74 28 28 28 65 2c 74 &(u=c.sort(((e,t
00025fe0: 29 3d 3e 73 75 2e 44 69 73 74 32 28 65 2c 61 29 )=>su.Dist2(e,a)
00025ff0: 2d 73 75 2e 44 69 73 74 32 28 74 2c 61 29 29 29 -su.Dist2(t,a)))
00026000: 5b 30 5d 3f 3f 28 6c 3f 76 6f 69 64 20 30 3a 73 [0]??(l?void 0:s
00026010: 29 29 2c 76 6f 69 64 20 30 3d 3d 3d 75 29 72 65 )),void 0===u)re
00026020: 74 75 72 6e 3b 63 6f 6e 73 74 20 64 3d 77 70 2e turn;const d=wp.
00026030: 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 72 2e 74 applyToPoint(r.t
00026040: 72 61 6e 73 66 6f 72 6d 2c 75 29 2c 70 3d 77 70 ransform,u),p=wp
00026050: 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 77 70 .applyToPoint(wp
00026060: 2e 49 6e 76 65 72 73 65 28 6e 29 2c 64 29 3b 65 .Inverse(n),d);e
00026070: 2e 73 65 74 54 6f 28 70 29 2c 72 2e 64 69 64 49 .setTo(p),r.didI
00026080: 6e 74 65 72 73 65 63 74 3d 21 30 7d 66 75 6e 63 ntersect=!0}func
00026090: 74 69 6f 6e 20 70 62 28 65 2c 74 2c 6e 29 7b 63 tion pb(e,t,n){c
000260a0: 6f 6e 73 74 7b 61 72 72 6f 77 68 65 61 64 45 6e onst{arrowheadEn
000260b0: 64 3a 72 2c 61 72 72 6f 77 68 65 61 64 53 74 61 d:r,arrowheadSta
000260c0: 72 74 3a 6f 7d 3d 74 2e 70 72 6f 70 73 2c 69 3d rt:o}=t.props,i=
000260d0: 74 2e 70 72 6f 70 73 2e 62 65 6e 64 3b 69 66 28 t.props.bend;if(
000260e0: 4d 61 74 68 2e 61 62 73 28 69 29 3e 4d 61 74 68 Math.abs(i)>Math
000260f0: 2e 61 62 73 28 74 2e 70 72 6f 70 73 2e 62 65 6e .abs(t.props.ben
00026100: 64 2a 28 54 62 2a 74 2e 70 72 6f 70 73 2e 73 63 d*(Tb*t.props.sc
00026110: 61 6c 65 29 29 29 72 65 74 75 72 6e 20 75 62 28 ale)))return ub(
00026120: 65 2c 74 2c 6e 29 3b 63 6f 6e 73 74 20 61 3d 53 e,t,n);const a=S
00026130: 62 28 65 2c 74 2c 6e 29 2c 73 3d 73 75 2e 4d 65 b(e,t,n),s=su.Me
00026140: 64 28 61 2e 73 74 61 72 74 2c 61 2e 65 6e 64 29 d(a.start,a.end)
00026150: 2c 6c 3d 73 75 2e 53 75 62 28 61 2e 65 6e 64 2c ,l=su.Sub(a.end,
00026160: 61 2e 73 74 61 72 74 29 2c 63 3d 73 75 2e 4c 65 a.start),c=su.Le
00026170: 6e 28 6c 29 3f 6c 2e 75 6e 69 28 29 3a 73 75 2e n(l)?l.uni():su.
00026180: 46 72 6f 6d 28 6c 29 2c 75 3d 73 75 2e 41 64 64 From(l),u=su.Add
00026190: 28 73 2c 63 2e 70 65 72 28 29 2e 6d 75 6c 28 2d (s,c.per().mul(-
000261a0: 69 29 29 2c 64 3d 6d 62 28 65 2c 74 2c 22 73 74 i)),d=mb(e,t,"st
000261b0: 61 72 74 22 29 2c 70 3d 6d 62 28 65 2c 74 2c 22 art"),p=mb(e,t,"
000261c0: 65 6e 64 22 29 2c 66 3d 61 2e 73 74 61 72 74 2e end"),f=a.start.
000261d0: 63 6c 6f 6e 65 28 29 2c 68 3d 61 2e 65 6e 64 2e clone(),h=a.end.
000261e0: 63 6c 6f 6e 65 28 29 2c 6d 3d 75 2e 63 6c 6f 6e clone(),m=u.clon
000261f0: 65 28 29 3b 69 66 28 73 75 2e 45 71 75 61 6c 73 e();if(su.Equals
00026200: 28 66 2c 68 29 29 72 65 74 75 72 6e 7b 62 69 6e (f,h))return{bin
00026210: 64 69 6e 67 73 3a 6e 2c 69 73 53 74 72 61 69 67 dings:n,isStraig
00026220: 68 74 3a 21 30 2c 73 74 61 72 74 3a 7b 68 61 6e ht:!0,start:{han
00026230: 64 6c 65 3a 66 2c 70 6f 69 6e 74 3a 66 2c 61 72 dle:f,point:f,ar
00026240: 72 6f 77 68 65 61 64 3a 74 2e 70 72 6f 70 73 2e rowhead:t.props.
00026250: 61 72 72 6f 77 68 65 61 64 53 74 61 72 74 7d 2c arrowheadStart},
00026260: 65 6e 64 3a 7b 68 61 6e 64 6c 65 3a 68 2c 70 6f end:{handle:h,po
00026270: 69 6e 74 3a 68 2c 61 72 72 6f 77 68 65 61 64 3a int:h,arrowhead:
00026280: 74 2e 70 72 6f 70 73 2e 61 72 72 6f 77 68 65 61 t.props.arrowhea
00026290: 64 45 6e 64 7d 2c 6d 69 64 64 6c 65 3a 6d 2c 69 dEnd},middle:m,i
000262a0: 73 56 61 6c 69 64 3a 21 31 2c 6c 65 6e 67 74 68 sValid:!1,length
000262b0: 3a 30 7d 3b 63 6f 6e 73 74 20 67 3d 74 2e 70 72 :0};const g=t.pr
000262c0: 6f 70 73 2e 62 65 6e 64 3c 30 2c 62 3d 67 3f 53 ops.bend<0,b=g?S
000262d0: 75 3a 5f 75 2c 79 3d 66 62 28 66 2c 68 2c 6d 29 u:_u,y=fb(f,h,m)
000262e0: 2c 76 3d 73 75 2e 41 6e 67 6c 65 28 79 2e 63 65 ,v=su.Angle(y.ce
000262f0: 6e 74 65 72 2c 66 29 2c 53 3d 73 75 2e 41 6e 67 nter,f),S=su.Ang
00026300: 6c 65 28 79 2e 63 65 6e 74 65 72 2c 68 29 2c 5f le(y.center,h),_
00026310: 3d 62 28 76 2c 53 29 3b 69 66 28 30 3d 3d 3d 79 =b(v,S);if(0===y
00026320: 2e 6c 65 6e 67 74 68 7c 7c 30 3d 3d 3d 79 2e 73 .length||0===y.s
00026330: 69 7a 65 7c 7c 21 4d 75 28 79 2e 6c 65 6e 67 74 ize||!Mu(y.lengt
00026340: 68 29 7c 7c 21 4d 75 28 79 2e 73 69 7a 65 29 29 h)||!Mu(y.size))
00026350: 72 65 74 75 72 6e 20 75 62 28 65 2c 74 2c 6e 29 return ub(e,t,n)
00026360: 3b 63 6f 6e 73 74 20 45 3d 66 2e 63 6c 6f 6e 65 ;const E=f.clone
00026370: 28 29 2c 77 3d 68 2e 63 6c 6f 6e 65 28 29 2c 78 (),w=h.clone(),x
00026380: 3d 6d 2e 63 6c 6f 6e 65 28 29 2c 54 3d 65 2e 67 =m.clone(),T=e.g
00026390: 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 etShapePageTrans
000263a0: 66 6f 72 6d 28 74 29 3b 6c 65 74 20 43 3d 30 2c form(t);let C=0,
000263b0: 6b 3d 30 2c 41 3d 77 62 2a 74 2e 70 72 6f 70 73 k=0,A=wb*t.props
000263c0: 2e 73 63 61 6c 65 3b 69 66 28 64 26 26 21 64 2e .scale;if(d&&!d.
000263d0: 69 73 45 78 61 63 74 29 7b 63 6f 6e 73 74 20 6e isExact){const n
000263e0: 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 =wp.applyToPoint
000263f0: 28 54 2c 45 29 2c 72 3d 77 70 2e 61 70 70 6c 79 (T,E),r=wp.apply
00026400: 54 6f 50 6f 69 6e 74 28 54 2c 79 2e 63 65 6e 74 ToPoint(T,y.cent
00026410: 65 72 29 2c 69 3d 77 70 2e 61 70 70 6c 79 54 6f er),i=wp.applyTo
00026420: 50 6f 69 6e 74 28 54 2c 77 29 2c 61 3d 77 70 2e Point(T,w),a=wp.
00026430: 49 6e 76 65 72 73 65 28 64 2e 74 72 61 6e 73 66 Inverse(d.transf
00026440: 6f 72 6d 29 2c 73 3d 77 70 2e 61 70 70 6c 79 54 orm),s=wp.applyT
00026450: 6f 50 6f 69 6e 74 28 61 2c 6e 29 2c 6c 3d 77 70 oPoint(a,n),l=wp
00026460: 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 61 2c .applyToPoint(a,
00026470: 72 29 2c 63 3d 77 70 2e 61 70 70 6c 79 54 6f 50 r),c=wp.applyToP
00026480: 6f 69 6e 74 28 61 2c 69 29 2c 7b 69 73 43 6c 6f oint(a,i),{isClo
00026490: 73 65 64 3a 75 7d 3d 64 3b 6c 65 74 20 70 2c 66 sed:u}=d;let p,f
000264a0: 3d 28 75 3f 76 68 3a 53 68 29 28 6c 2c 79 2e 72 =(u?vh:Sh)(l,y.r
000264b0: 61 64 69 75 73 2c 64 2e 6f 75 74 6c 69 6e 65 29 adius,d.outline)
000264c0: 3b 69 66 28 66 29 7b 63 6f 6e 73 74 20 65 3d 6c ;if(f){const e=l
000264d0: 2e 61 6e 67 6c 65 28 73 29 2c 74 3d 6c 2e 61 6e .angle(s),t=l.an
000264e0: 67 6c 65 28 63 29 2c 6e 3d 62 28 65 2c 74 29 3b gle(c),n=b(e,t);
000264f0: 66 3d 66 2e 66 69 6c 74 65 72 28 28 74 3d 3e 62 f=f.filter((t=>b
00026500: 28 65 2c 6c 2e 61 6e 67 6c 65 28 74 29 29 3c 3d (e,l.angle(t))<=
00026510: 6e 29 29 3b 63 6f 6e 73 74 20 72 3d 2e 32 35 2a n));const r=.25*
00026520: 6e 3b 66 2e 73 6f 72 74 28 75 3f 28 74 2c 6e 29 n;f.sort(u?(t,n)
00026530: 3d 3e 4d 61 74 68 2e 61 62 73 28 62 28 65 2c 6c =>Math.abs(b(e,l
00026540: 2e 61 6e 67 6c 65 28 74 29 29 2d 72 29 3c 4d 61 .angle(t))-r)<Ma
00026550: 74 68 2e 61 62 73 28 62 28 65 2c 6c 2e 61 6e 67 th.abs(b(e,l.ang
00026560: 6c 65 28 6e 29 29 2d 72 29 3f 2d 31 3a 31 3a 28 le(n))-r)?-1:1:(
00026570: 74 2c 6e 29 3d 3e 62 28 65 2c 6c 2e 61 6e 67 6c t,n)=>b(e,l.angl
00026580: 65 28 74 29 29 3c 62 28 65 2c 6c 2e 61 6e 67 6c e(t))<b(e,l.angl
00026590: 65 28 6e 29 29 3f 2d 31 3a 31 29 2c 70 3d 66 5b e(n))?-1:1),p=f[
000265a0: 30 5d 3f 3f 28 75 3f 76 6f 69 64 20 30 3a 73 29 0]??(u?void 0:s)
000265b0: 7d 65 6c 73 65 20 70 3d 75 3f 76 6f 69 64 20 30 }else p=u?void 0
000265c0: 3a 73 3b 69 66 28 70 26 26 28 45 2e 73 65 74 54 :s;if(p&&(E.setT
000265d0: 6f 28 65 2e 67 65 74 50 6f 69 6e 74 49 6e 53 68 o(e.getPointInSh
000265e0: 61 70 65 53 70 61 63 65 28 74 2c 77 70 2e 61 70 apeSpace(t,wp.ap
000265f0: 70 6c 79 54 6f 50 6f 69 6e 74 28 64 2e 74 72 61 plyToPoint(d.tra
00026600: 6e 73 66 6f 72 6d 2c 70 29 29 29 2c 64 2e 64 69 nsform,p))),d.di
00026610: 64 49 6e 74 65 72 73 65 63 74 3d 21 30 2c 22 6e dIntersect=!0,"n
00026620: 6f 6e 65 22 21 3d 3d 6f 29 29 7b 63 6f 6e 73 74 one"!==o)){const
00026630: 20 65 3d 43 62 5b 74 2e 70 72 6f 70 73 2e 73 69 e=Cb[t.props.si
00026640: 7a 65 5d 2f 32 2b 28 22 73 69 7a 65 22 69 6e 20 ze]/2+("size"in
00026650: 64 2e 73 68 61 70 65 2e 70 72 6f 70 73 3f 43 62 d.shape.props?Cb
00026660: 5b 64 2e 73 68 61 70 65 2e 70 72 6f 70 73 2e 73 [d.shape.props.s
00026670: 69 7a 65 5d 2f 32 3a 30 29 3b 43 3d 28 78 62 2b ize]/2:0);C=(xb+
00026680: 65 29 2a 74 2e 70 72 6f 70 73 2e 73 63 61 6c 65 e)*t.props.scale
00026690: 2c 41 2b 3d 65 2a 74 2e 70 72 6f 70 73 2e 73 63 ,A+=e*t.props.sc
000266a0: 61 6c 65 7d 7d 69 66 28 70 26 26 21 70 2e 69 73 ale}}if(p&&!p.is
000266b0: 45 78 61 63 74 29 7b 63 6f 6e 73 74 20 6e 3d 77 Exact){const n=w
000266c0: 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 54 p.applyToPoint(T
000266d0: 2c 45 29 2c 6f 3d 77 70 2e 61 70 70 6c 79 54 6f ,E),o=wp.applyTo
000266e0: 50 6f 69 6e 74 28 54 2c 77 29 2c 69 3d 77 70 2e Point(T,w),i=wp.
000266f0: 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 54 2c 79 applyToPoint(T,y
00026700: 2e 63 65 6e 74 65 72 29 2c 61 3d 77 70 2e 49 6e .center),a=wp.In
00026710: 76 65 72 73 65 28 70 2e 74 72 61 6e 73 66 6f 72 verse(p.transfor
00026720: 6d 29 2c 73 3d 77 70 2e 61 70 70 6c 79 54 6f 50 m),s=wp.applyToP
00026730: 6f 69 6e 74 28 61 2c 6e 29 2c 6c 3d 77 70 2e 61 oint(a,n),l=wp.a
00026740: 70 70 6c 79 54 6f 50 6f 69 6e 74 28 61 2c 69 29 pplyToPoint(a,i)
00026750: 2c 63 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 ,c=wp.applyToPoi
00026760: 6e 74 28 61 2c 6f 29 2c 75 3d 70 2e 69 73 43 6c nt(a,o),u=p.isCl
00026770: 6f 73 65 64 3b 6c 65 74 20 64 2c 66 3d 28 75 3f osed;let d,f=(u?
00026780: 76 68 3a 53 68 29 28 6c 2c 79 2e 72 61 64 69 75 vh:Sh)(l,y.radiu
00026790: 73 2c 70 2e 6f 75 74 6c 69 6e 65 29 3b 69 66 28 s,p.outline);if(
000267a0: 66 29 7b 63 6f 6e 73 74 20 65 3d 6c 2e 61 6e 67 f){const e=l.ang
000267b0: 6c 65 28 73 29 2c 74 3d 6c 2e 61 6e 67 6c 65 28 le(s),t=l.angle(
000267c0: 63 29 2c 6e 3d 62 28 65 2c 74 29 2c 72 3d 2e 37 c),n=b(e,t),r=.7
000267d0: 35 2a 6e 3b 66 3d 66 2e 66 69 6c 74 65 72 28 28 5*n;f=f.filter((
000267e0: 74 3d 3e 62 28 65 2c 6c 2e 61 6e 67 6c 65 28 74 t=>b(e,l.angle(t
000267f0: 29 29 3c 3d 6e 29 29 2c 66 2e 73 6f 72 74 28 75 ))<=n)),f.sort(u
00026800: 3f 28 74 2c 6e 29 3d 3e 4d 61 74 68 2e 61 62 73 ?(t,n)=>Math.abs
00026810: 28 62 28 65 2c 6c 2e 61 6e 67 6c 65 28 74 29 29 (b(e,l.angle(t))
00026820: 2d 72 29 3c 4d 61 74 68 2e 61 62 73 28 62 28 65 -r)<Math.abs(b(e
00026830: 2c 6c 2e 61 6e 67 6c 65 28 6e 29 29 2d 72 29 3f ,l.angle(n))-r)?
00026840: 2d 31 3a 31 3a 28 74 2c 6e 29 3d 3e 62 28 65 2c -1:1:(t,n)=>b(e,
00026850: 6c 2e 61 6e 67 6c 65 28 74 29 29 3c 62 28 65 2c l.angle(t))<b(e,
00026860: 6c 2e 61 6e 67 6c 65 28 6e 29 29 3f 2d 31 3a 31 l.angle(n))?-1:1
00026870: 29 2c 64 3d 66 5b 30 5d 3f 66 5b 30 5d 3a 75 3f ),d=f[0]?f[0]:u?
00026880: 76 6f 69 64 20 30 3a 63 7d 65 6c 73 65 20 64 3d void 0:c}else d=
00026890: 75 3f 76 6f 69 64 20 30 3a 63 3b 69 66 28 64 26 u?void 0:c;if(d&
000268a0: 26 28 77 2e 73 65 74 54 6f 28 65 2e 67 65 74 50 &(w.setTo(e.getP
000268b0: 6f 69 6e 74 49 6e 53 68 61 70 65 53 70 61 63 65 ointInShapeSpace
000268c0: 28 74 2c 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 (t,wp.applyToPoi
000268d0: 6e 74 28 70 2e 74 72 61 6e 73 66 6f 72 6d 2c 64 nt(p.transform,d
000268e0: 29 29 29 2c 70 2e 64 69 64 49 6e 74 65 72 73 65 ))),p.didInterse
000268f0: 63 74 3d 21 30 2c 22 6e 6f 6e 65 22 21 3d 3d 72 ct=!0,"none"!==r
00026900: 29 29 7b 63 6f 6e 73 74 20 65 3d 43 62 5b 74 2e )){const e=Cb[t.
00026910: 70 72 6f 70 73 2e 73 69 7a 65 5d 2f 32 2b 28 22 props.size]/2+("
00026920: 73 69 7a 65 22 69 6e 20 70 2e 73 68 61 70 65 2e size"in p.shape.
00026930: 70 72 6f 70 73 3f 43 62 5b 70 2e 73 68 61 70 65 props?Cb[p.shape
00026940: 2e 70 72 6f 70 73 2e 73 69 7a 65 5d 2f 32 3a 30 .props.size]/2:0
00026950: 29 3b 6b 3d 28 78 62 2b 65 29 2a 74 2e 70 72 6f );k=(xb+e)*t.pro
00026960: 70 73 2e 73 63 61 6c 65 2c 41 2b 3d 65 2a 74 2e ps.scale,A+=e*t.
00026970: 70 72 6f 70 73 2e 73 63 61 6c 65 7d 7d 6c 65 74 props.scale}}let
00026980: 20 49 3d 73 75 2e 41 6e 67 6c 65 28 79 2e 63 65 I=su.Angle(y.ce
00026990: 6e 74 65 72 2c 45 29 2c 52 3d 73 75 2e 41 6e 67 nter,E),R=su.Ang
000269a0: 6c 65 28 79 2e 63 65 6e 74 65 72 2c 77 29 2c 4f le(y.center,w),O
000269b0: 3d 62 28 49 2c 52 29 2c 4e 3d 4f 2a 79 2e 72 61 =b(I,R),N=O*y.ra
000269c0: 64 69 75 73 3b 63 6f 6e 73 74 20 50 3d 45 2e 63 dius;const P=E.c
000269d0: 6c 6f 6e 65 28 29 2c 4d 3d 77 2e 63 6c 6f 6e 65 lone(),M=w.clone
000269e0: 28 29 3b 69 66 28 30 21 3d 3d 43 26 26 50 2e 73 ();if(0!==C&&P.s
000269f0: 65 74 54 6f 28 79 2e 63 65 6e 74 65 72 29 2e 61 etTo(y.center).a
00026a00: 64 64 28 73 75 2e 46 72 6f 6d 41 6e 67 6c 65 28 dd(su.FromAngle(
00026a10: 49 2b 4f 2a 28 43 2f 4e 2a 28 67 3f 31 3a 2d 31 I+O*(C/N*(g?1:-1
00026a20: 29 29 29 2e 6d 75 6c 28 79 2e 72 61 64 69 75 73 ))).mul(y.radius
00026a30: 29 29 2c 30 21 3d 3d 6b 26 26 4d 2e 73 65 74 54 )),0!==k&&M.setT
00026a40: 6f 28 79 2e 63 65 6e 74 65 72 29 2e 61 64 64 28 o(y.center).add(
00026a50: 73 75 2e 46 72 6f 6d 41 6e 67 6c 65 28 52 2b 4f su.FromAngle(R+O
00026a60: 2a 28 6b 2f 4e 2a 28 67 3f 2d 31 3a 31 29 29 29 *(k/N*(g?-1:1)))
00026a70: 2e 6d 75 6c 28 79 2e 72 61 64 69 75 73 29 29 2c .mul(y.radius)),
00026a80: 73 75 2e 44 69 73 74 4d 69 6e 28 50 2c 4d 2c 41 su.DistMin(P,M,A
00026a90: 29 26 26 28 30 21 3d 3d 43 26 26 30 21 3d 3d 6b )&&(0!==C&&0!==k
00026aa0: 3f 28 43 2a 3d 2d 31 2e 35 2c 6b 2a 3d 2d 31 2e ?(C*=-1.5,k*=-1.
00026ab0: 35 29 3a 30 21 3d 3d 43 3f 43 2a 3d 2d 32 3a 30 5):0!==C?C*=-2:0
00026ac0: 21 3d 3d 6b 26 26 28 6b 2a 3d 2d 32 29 29 2c 30 !==k&&(k*=-2)),0
00026ad0: 21 3d 3d 43 26 26 45 2e 73 65 74 54 6f 28 79 2e !==C&&E.setTo(y.
00026ae0: 63 65 6e 74 65 72 29 2e 61 64 64 28 73 75 2e 46 center).add(su.F
00026af0: 72 6f 6d 41 6e 67 6c 65 28 49 2b 4f 2a 28 43 2f romAngle(I+O*(C/
00026b00: 4e 2a 28 67 3f 31 3a 2d 31 29 29 29 2e 6d 75 6c N*(g?1:-1))).mul
00026b10: 28 79 2e 72 61 64 69 75 73 29 29 2c 30 21 3d 3d (y.radius)),0!==
00026b20: 6b 26 26 77 2e 73 65 74 54 6f 28 79 2e 63 65 6e k&&w.setTo(y.cen
00026b30: 74 65 72 29 2e 61 64 64 28 73 75 2e 46 72 6f 6d ter).add(su.From
00026b40: 41 6e 67 6c 65 28 52 2b 4f 2a 28 6b 2f 4e 2a 28 Angle(R+O*(k/N*(
00026b50: 67 3f 2d 31 3a 31 29 29 29 2e 6d 75 6c 28 79 2e g?-1:1))).mul(y.
00026b60: 72 61 64 69 75 73 29 29 2c 64 26 26 70 26 26 21 radius)),d&&p&&!
00026b70: 64 2e 69 73 45 78 61 63 74 26 26 21 70 2e 69 73 d.isExact&&!p.is
00026b80: 45 78 61 63 74 29 7b 49 3d 73 75 2e 41 6e 67 6c Exact){I=su.Angl
00026b90: 65 28 79 2e 63 65 6e 74 65 72 2c 45 29 2c 52 3d e(y.center,E),R=
00026ba0: 73 75 2e 41 6e 67 6c 65 28 79 2e 63 65 6e 74 65 su.Angle(y.cente
00026bb0: 72 2c 77 29 2c 4f 3d 62 28 49 2c 52 29 2c 4e 3d r,w),O=b(I,R),N=
00026bc0: 4f 2a 79 2e 72 61 64 69 75 73 3b 63 6f 6e 73 74 O*y.radius;const
00026bd0: 20 6e 3d 6b 62 28 65 2c 64 2e 73 68 61 70 65 2e n=kb(e,d.shape.
00026be0: 69 64 2c 70 2e 73 68 61 70 65 2e 69 64 29 3b 22 id,p.shape.id);"
00026bf0: 64 6f 75 62 6c 65 2d 62 6f 75 6e 64 22 3d 3d 3d double-bound"===
00026c00: 6e 26 26 4e 3c 33 30 3f 28 45 2e 73 65 74 54 6f n&&N<30?(E.setTo
00026c10: 28 66 29 2c 77 2e 73 65 74 54 6f 28 68 29 2c 78 (f),w.setTo(h),x
00026c20: 2e 73 65 74 54 6f 28 6d 29 29 3a 22 73 61 66 65 .setTo(m)):"safe
00026c30: 22 3d 3d 3d 6e 26 26 28 64 26 26 21 64 2e 64 69 "===n&&(d&&!d.di
00026c40: 64 49 6e 74 65 72 73 65 63 74 26 26 45 2e 73 65 dIntersect&&E.se
00026c50: 74 54 6f 28 66 29 2c 28 70 26 26 21 70 2e 64 69 tTo(f),(p&&!p.di
00026c60: 64 49 6e 74 65 72 73 65 63 74 7c 7c 62 28 76 2c dIntersect||b(v,
00026c70: 49 29 3e 62 28 76 2c 52 29 29 26 26 77 2e 73 65 I)>b(v,R))&&w.se
00026c80: 74 54 6f 28 79 2e 63 65 6e 74 65 72 29 2e 61 64 tTo(y.center).ad
00026c90: 64 28 73 75 2e 46 72 6f 6d 41 6e 67 6c 65 28 49 d(su.FromAngle(I
00026ca0: 2b 4f 2a 28 4d 61 74 68 2e 6d 69 6e 28 2e 39 2c +O*(Math.min(.9,
00026cb0: 77 62 2a 74 2e 70 72 6f 70 73 2e 73 63 61 6c 65 wb*t.props.scale
00026cc0: 2f 4e 29 2a 28 67 3f 31 3a 2d 31 29 29 29 2e 6d /N)*(g?1:-1))).m
00026cd0: 75 6c 28 79 2e 72 61 64 69 75 73 29 29 29 7d 21 ul(y.radius)))}!
00026ce0: 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c 72 function(e,t,n,r
00026cf0: 2c 6f 2c 69 2c 61 29 7b 63 6f 6e 73 74 20 73 3d ,o,i,a){const s=
00026d00: 73 75 2e 41 6e 67 6c 65 28 65 2c 6e 29 2c 6c 3d su.Angle(e,n),l=
00026d10: 73 75 2e 41 6e 67 6c 65 28 65 2c 72 29 3b 6c 65 su.Angle(e,r);le
00026d20: 74 20 63 3d 53 75 28 73 2c 6c 29 3b 61 7c 7c 28 t c=Su(s,l);a||(
00026d30: 63 3d 66 75 2d 63 29 3b 69 66 28 6f 2e 73 65 74 c=fu-c);if(o.set
00026d40: 54 6f 28 65 29 2e 61 64 64 28 73 75 2e 46 72 6f To(e).add(su.Fro
00026d50: 6d 41 6e 67 6c 65 28 73 2b 63 2a 28 2e 35 2a 28 mAngle(s+c*(.5*(
00026d60: 61 3f 31 3a 2d 31 29 29 29 2e 6d 75 6c 28 74 29 a?1:-1))).mul(t)
00026d70: 29 2c 63 3e 69 29 7b 6f 2e 72 6f 74 57 69 74 68 ),c>i){o.rotWith
00026d80: 28 65 2c 64 75 29 3b 63 6f 6e 73 74 20 74 3d 72 (e,du);const t=r
00026d90: 2e 63 6c 6f 6e 65 28 29 3b 72 2e 73 65 74 54 6f .clone();r.setTo
00026da0: 28 6e 29 2c 6e 2e 73 65 74 54 6f 28 74 29 7d 7d (n),n.setTo(t)}}
00026db0: 28 79 2e 63 65 6e 74 65 72 2c 79 2e 72 61 64 69 (y.center,y.radi
00026dc0: 75 73 2c 45 2c 77 2c 78 2c 5f 2c 67 29 2c 45 2e us,E,w,x,_,g),E.
00026dd0: 65 71 75 61 6c 73 28 77 29 26 26 28 45 2e 73 65 equals(w)&&(E.se
00026de0: 74 54 6f 28 78 2e 63 6c 6f 6e 65 28 29 2e 61 64 tTo(x.clone().ad
00026df0: 64 58 59 28 31 2c 31 29 29 2c 77 2e 73 65 74 54 dXY(1,1)),w.setT
00026e00: 6f 28 78 2e 63 6c 6f 6e 65 28 29 2e 73 75 62 58 o(x.clone().subX
00026e10: 59 28 31 2c 31 29 29 29 2c 66 2e 73 65 74 54 6f Y(1,1))),f.setTo
00026e20: 28 45 29 2c 68 2e 73 65 74 54 6f 28 77 29 2c 6d (E),h.setTo(w),m
00026e30: 2e 73 65 74 54 6f 28 78 29 3b 63 6f 6e 73 74 20 .setTo(x);const
00026e40: 44 3d 66 62 28 66 2c 68 2c 6d 29 3b 72 65 74 75 D=fb(f,h,m);retu
00026e50: 72 6e 7b 62 69 6e 64 69 6e 67 73 3a 6e 2c 69 73 rn{bindings:n,is
00026e60: 53 74 72 61 69 67 68 74 3a 21 31 2c 73 74 61 72 Straight:!1,star
00026e70: 74 3a 7b 70 6f 69 6e 74 3a 66 2c 68 61 6e 64 6c t:{point:f,handl
00026e80: 65 3a 61 2e 73 74 61 72 74 2c 61 72 72 6f 77 68 e:a.start,arrowh
00026e90: 65 61 64 3a 74 2e 70 72 6f 70 73 2e 61 72 72 6f ead:t.props.arro
00026ea0: 77 68 65 61 64 53 74 61 72 74 7d 2c 65 6e 64 3a wheadStart},end:
00026eb0: 7b 70 6f 69 6e 74 3a 68 2c 68 61 6e 64 6c 65 3a {point:h,handle:
00026ec0: 61 2e 65 6e 64 2c 61 72 72 6f 77 68 65 61 64 3a a.end,arrowhead:
00026ed0: 74 2e 70 72 6f 70 73 2e 61 72 72 6f 77 68 65 61 t.props.arrowhea
00026ee0: 64 45 6e 64 7d 2c 6d 69 64 64 6c 65 3a 6d 2c 68 dEnd},middle:m,h
00026ef0: 61 6e 64 6c 65 41 72 63 3a 79 2c 62 6f 64 79 41 andleArc:y,bodyA
00026f00: 72 63 3a 44 2c 69 73 56 61 6c 69 64 3a 30 21 3d rc:D,isValid:0!=
00026f10: 3d 44 2e 6c 65 6e 67 74 68 26 26 69 73 46 69 6e =D.length&&isFin
00026f20: 69 74 65 28 44 2e 63 65 6e 74 65 72 2e 78 29 26 ite(D.center.x)&
00026f30: 26 69 73 46 69 6e 69 74 65 28 44 2e 63 65 6e 74 &isFinite(D.cent
00026f40: 65 72 2e 79 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 er.y)}}function
00026f50: 66 62 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 fb(e,t,n){const
00026f60: 72 3d 46 75 28 65 2c 74 2c 6e 29 2c 6f 3d 73 75 r=Fu(e,t,n),o=su
00026f70: 2e 44 69 73 74 28 72 2c 65 29 2c 69 3d 2b 73 75 .Dist(r,e),i=+su
00026f80: 2e 43 6c 6f 63 6b 77 69 73 65 28 65 2c 6e 2c 74 .Clockwise(e,n,t
00026f90: 29 2c 61 3d 28 28 65 2e 79 2d 74 2e 79 29 2a 2a ),a=((e.y-t.y)**
00026fa0: 32 2b 28 65 2e 78 2d 74 2e 78 29 2a 2a 32 29 2a 2+(e.x-t.x)**2)*
00026fb0: 2a 2e 35 2c 73 3d 28 28 74 2e 79 2d 6e 2e 79 29 *.5,s=((t.y-n.y)
00026fc0: 2a 2a 32 2b 28 74 2e 78 2d 6e 2e 78 29 2a 2a 32 **2+(t.x-n.x)**2
00026fd0: 29 2a 2a 2e 35 2c 6c 3d 28 28 6e 2e 79 2d 65 2e )**.5,l=((n.y-e.
00026fe0: 79 29 2a 2a 32 2b 28 6e 2e 78 2d 65 2e 78 29 2a y)**2+(n.x-e.x)*
00026ff0: 2a 32 29 2a 2a 2e 35 2c 63 3d 32 2a 4d 61 74 68 *2)**.5,c=2*Math
00027000: 2e 61 63 6f 73 28 28 73 2a 73 2b 6c 2a 6c 2d 61 .acos((s*s+l*l-a
00027010: 2a 61 29 2f 28 32 2a 73 2a 6c 29 29 2c 75 3d 28 *a)/(2*s*l)),u=(
00027020: 66 75 2d 63 29 2a 28 69 3f 31 3a 2d 31 29 3b 72 fu-c)*(i?1:-1);r
00027030: 65 74 75 72 6e 7b 63 65 6e 74 65 72 3a 72 2c 72 eturn{center:r,r
00027040: 61 64 69 75 73 3a 6f 2c 73 69 7a 65 3a 75 2c 6c adius:o,size:u,l
00027050: 65 6e 67 74 68 3a 75 2a 6f 2c 6c 61 72 67 65 41 ength:u*o,largeA
00027060: 72 63 46 6c 61 67 3a 2b 28 64 75 3e 63 29 2c 73 rcFlag:+(du>c),s
00027070: 77 65 65 70 46 6c 61 67 3a 69 7d 7d 63 6f 6e 73 weepFlag:i}}cons
00027080: 74 20 68 62 3d 38 3b 66 75 6e 63 74 69 6f 6e 20 t hb=8;function
00027090: 6d 62 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 mb(e,t,n){const
000270a0: 72 3d 65 2e 67 65 74 42 69 6e 64 69 6e 67 73 46 r=e.getBindingsF
000270b0: 72 6f 6d 53 68 61 70 65 28 74 2c 22 61 72 72 6f romShape(t,"arro
000270c0: 77 22 29 2e 66 69 6e 64 28 28 65 3d 3e 65 2e 70 w").find((e=>e.p
000270d0: 72 6f 70 73 2e 74 65 72 6d 69 6e 61 6c 3d 3d 3d rops.terminal===
000270e0: 6e 29 29 3b 69 66 28 21 72 29 72 65 74 75 72 6e n));if(!r)return
000270f0: 3b 63 6f 6e 73 74 20 6f 3d 65 2e 67 65 74 53 68 ;const o=e.getSh
00027100: 61 70 65 28 72 2e 74 6f 49 64 29 3b 69 66 28 21 ape(r.toId);if(!
00027110: 6f 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 69 o)return;const i
00027120: 3d 65 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 =e.getShapePageT
00027130: 72 61 6e 73 66 6f 72 6d 28 6f 29 2c 61 3d 65 2e ransform(o),a=e.
00027140: 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 getShapeGeometry
00027150: 28 6f 29 2c 73 3d 61 20 69 6e 73 74 61 6e 63 65 (o),s=a instance
00027160: 6f 66 20 6b 70 3f 61 2e 63 68 69 6c 64 72 65 6e of kp?a.children
00027170: 5b 30 5d 2e 76 65 72 74 69 63 65 73 3a 61 2e 76 [0].vertices:a.v
00027180: 65 72 74 69 63 65 73 3b 72 65 74 75 72 6e 7b 73 ertices;return{s
00027190: 68 61 70 65 3a 6f 2c 74 72 61 6e 73 66 6f 72 6d hape:o,transform
000271a0: 3a 69 2c 69 73 43 6c 6f 73 65 64 3a 61 2e 69 73 :i,isClosed:a.is
000271b0: 43 6c 6f 73 65 64 2c 69 73 45 78 61 63 74 3a 72 Closed,isExact:r
000271c0: 2e 70 72 6f 70 73 2e 69 73 45 78 61 63 74 2c 64 .props.isExact,d
000271d0: 69 64 49 6e 74 65 72 73 65 63 74 3a 21 31 2c 6f idIntersect:!1,o
000271e0: 75 74 6c 69 6e 65 3a 73 7d 7d 66 75 6e 63 74 69 utline:s}}functi
000271f0: 6f 6e 20 67 62 28 65 2c 74 2c 6e 2c 72 29 7b 63 on gb(e,t,n,r){c
00027200: 6f 6e 73 74 20 6f 3d 65 2e 67 65 74 53 68 61 70 onst o=e.getShap
00027210: 65 28 6e 2e 74 6f 49 64 29 3b 69 66 28 6f 29 7b e(n.toId);if(o){
00027220: 63 6f 6e 73 74 7b 70 6f 69 6e 74 3a 69 2c 73 69 const{point:i,si
00027230: 7a 65 3a 61 7d 3d 65 2e 67 65 74 53 68 61 70 65 ze:a}=e.getShape
00027240: 47 65 6f 6d 65 74 72 79 28 6f 29 2e 62 6f 75 6e Geometry(o).boun
00027250: 64 73 2c 73 3d 73 75 2e 41 64 64 28 69 2c 73 75 ds,s=su.Add(i,su
00027260: 2e 4d 75 6c 56 28 6e 2e 70 72 6f 70 73 2e 69 73 .MulV(n.props.is
00027270: 50 72 65 63 69 73 65 7c 7c 72 3f 6e 2e 70 72 6f Precise||r?n.pro
00027280: 70 73 2e 6e 6f 72 6d 61 6c 69 7a 65 64 41 6e 63 ps.normalizedAnc
00027290: 68 6f 72 3a 7b 78 3a 2e 35 2c 79 3a 2e 35 7d 2c hor:{x:.5,y:.5},
000272a0: 61 29 29 2c 6c 3d 77 70 2e 61 70 70 6c 79 54 6f a)),l=wp.applyTo
000272b0: 50 6f 69 6e 74 28 65 2e 67 65 74 53 68 61 70 65 Point(e.getShape
000272c0: 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 6f 29 PageTransform(o)
000272d0: 2c 73 29 3b 72 65 74 75 72 6e 20 77 70 2e 61 70 ,s);return wp.ap
000272e0: 70 6c 79 54 6f 50 6f 69 6e 74 28 77 70 2e 49 6e plyToPoint(wp.In
000272f0: 76 65 72 73 65 28 74 29 2c 6c 29 7d 72 65 74 75 verse(t),l)}retu
00027300: 72 6e 20 6e 65 77 20 73 75 28 30 2c 30 29 7d 66 rn new su(0,0)}f
00027310: 75 6e 63 74 69 6f 6e 20 62 62 28 65 2c 74 29 7b unction bb(e,t){
00027320: 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 74 42 69 6e const n=e.getBin
00027330: 64 69 6e 67 73 46 72 6f 6d 53 68 61 70 65 28 74 dingsFromShape(t
00027340: 2c 22 61 72 72 6f 77 22 29 3b 72 65 74 75 72 6e ,"arrow");return
00027350: 7b 73 74 61 72 74 3a 6e 2e 66 69 6e 64 28 28 65 {start:n.find((e
00027360: 3d 3e 22 73 74 61 72 74 22 3d 3d 3d 65 2e 70 72 =>"start"===e.pr
00027370: 6f 70 73 2e 74 65 72 6d 69 6e 61 6c 29 29 2c 65 ops.terminal)),e
00027380: 6e 64 3a 6e 2e 66 69 6e 64 28 28 65 3d 3e 22 65 nd:n.find((e=>"e
00027390: 6e 64 22 3d 3d 3d 65 2e 70 72 6f 70 73 2e 74 65 nd"===e.props.te
000273a0: 72 6d 69 6e 61 6c 29 29 7d 7d 63 6f 6e 73 74 20 rminal))}}const
000273b0: 79 62 3d 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c yb=function(e,t,
000273c0: 6e 29 7b 63 6f 6e 73 74 20 72 3d 6e 65 77 20 7a n){const r=new z
000273d0: 72 3b 72 65 74 75 72 6e 7b 67 65 74 3a 28 6f 2c r;return{get:(o,
000273e0: 69 29 3d 3e 72 2e 67 65 74 28 6f 2c 28 28 29 3d i)=>r.get(o,(()=
000273f0: 3e 28 6f 20 69 6e 73 74 61 6e 63 65 6f 66 20 79 >(o instanceof y
00027400: 61 3f 6f 3a 6f 2e 73 74 6f 72 65 29 2e 63 72 65 a?o:o.store).cre
00027410: 61 74 65 43 6f 6d 70 75 74 65 64 43 61 63 68 65 ateComputedCache
00027420: 28 65 2c 28 65 3d 3e 74 28 6f 2c 65 29 29 2c 6e (e,(e=>t(o,e)),n
00027430: 29 29 29 2e 67 65 74 28 69 29 7d 7d 28 22 61 72 ))).get(i)}}("ar
00027440: 72 6f 77 20 69 6e 66 6f 22 2c 28 28 65 2c 74 29 row info",((e,t)
00027450: 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 62 62 28 65 2c =>{const n=bb(e,
00027460: 74 29 3b 72 65 74 75 72 6e 20 66 75 6e 63 74 69 t);return functi
00027470: 6f 6e 28 65 29 7b 72 65 74 75 72 6e 20 4d 61 74 on(e){return Mat
00027480: 68 2e 61 62 73 28 65 2e 70 72 6f 70 73 2e 62 65 h.abs(e.props.be
00027490: 6e 64 29 3c 68 62 2a 65 2e 70 72 6f 70 73 2e 73 nd)<hb*e.props.s
000274a0: 63 61 6c 65 7d 28 74 29 3f 75 62 28 65 2c 74 2c cale}(t)?ub(e,t,
000274b0: 6e 29 3a 70 62 28 65 2c 74 2c 6e 29 7d 29 29 3b n):pb(e,t,n)}));
000274c0: 66 75 6e 63 74 69 6f 6e 20 76 62 28 65 2c 74 29 function vb(e,t)
000274d0: 7b 63 6f 6e 73 74 20 6e 3d 22 73 74 72 69 6e 67 {const n="string
000274e0: 22 3d 3d 74 79 70 65 6f 66 20 74 3f 74 3a 74 2e "==typeof t?t:t.
000274f0: 69 64 3b 72 65 74 75 72 6e 20 79 62 2e 67 65 74 id;return yb.get
00027500: 28 65 2c 6e 29 7d 66 75 6e 63 74 69 6f 6e 20 53 (e,n)}function S
00027510: 62 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 b(e,t,n){const r
00027520: 3d 65 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 =e.getShapePageT
00027530: 72 61 6e 73 66 6f 72 6d 28 74 29 2c 6f 3d 6b 62 ransform(t),o=kb
00027540: 28 65 2c 6e 2e 73 74 61 72 74 3f 2e 74 6f 49 64 (e,n.start?.toId
00027550: 2c 6e 2e 65 6e 64 3f 2e 74 6f 49 64 29 3b 72 65 ,n.end?.toId);re
00027560: 74 75 72 6e 7b 73 74 61 72 74 3a 6e 2e 73 74 61 turn{start:n.sta
00027570: 72 74 3f 67 62 28 65 2c 72 2c 6e 2e 73 74 61 72 rt?gb(e,r,n.star
00027580: 74 2c 22 64 6f 75 62 6c 65 2d 62 6f 75 6e 64 22 t,"double-bound"
00027590: 3d 3d 3d 6f 7c 7c 22 73 74 61 72 74 2d 63 6f 6e ===o||"start-con
000275a0: 74 61 69 6e 73 2d 65 6e 64 22 3d 3d 3d 6f 29 3a tains-end"===o):
000275b0: 73 75 2e 46 72 6f 6d 28 74 2e 70 72 6f 70 73 2e su.From(t.props.
000275c0: 73 74 61 72 74 29 2c 65 6e 64 3a 6e 2e 65 6e 64 start),end:n.end
000275d0: 3f 67 62 28 65 2c 72 2c 6e 2e 65 6e 64 2c 22 64 ?gb(e,r,n.end,"d
000275e0: 6f 75 62 6c 65 2d 62 6f 75 6e 64 22 3d 3d 3d 6f ouble-bound"===o
000275f0: 7c 7c 22 65 6e 64 2d 63 6f 6e 74 61 69 6e 73 2d ||"end-contains-
00027600: 73 74 61 72 74 22 3d 3d 3d 6f 29 3a 73 75 2e 46 start"===o):su.F
00027610: 72 6f 6d 28 74 2e 70 72 6f 70 73 2e 65 6e 64 29 rom(t.props.end)
00027620: 7d 7d 66 75 6e 63 74 69 6f 6e 20 5f 62 28 65 2c }}function _b(e,
00027630: 74 2c 6e 2c 72 29 7b 63 6f 6e 73 74 20 6f 3d 22 t,n,r){const o="
00027640: 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 string"==typeof
00027650: 74 3f 74 3a 74 2e 69 64 2c 69 3d 22 73 74 72 69 t?t:t.id,i="stri
00027660: 6e 67 22 3d 3d 74 79 70 65 6f 66 20 6e 3f 6e 3a ng"==typeof n?n:
00027670: 6e 2e 69 64 2c 61 3d 65 2e 67 65 74 42 69 6e 64 n.id,a=e.getBind
00027680: 69 6e 67 73 46 72 6f 6d 53 68 61 70 65 28 6f 2c ingsFromShape(o,
00027690: 22 61 72 72 6f 77 22 29 2e 66 69 6c 74 65 72 28 "arrow").filter(
000276a0: 28 65 3d 3e 65 2e 70 72 6f 70 73 2e 74 65 72 6d (e=>e.props.term
000276b0: 69 6e 61 6c 3d 3d 3d 72 2e 74 65 72 6d 69 6e 61 inal===r.termina
000276c0: 6c 29 29 3b 61 2e 6c 65 6e 67 74 68 3e 31 26 26 l));a.length>1&&
000276d0: 65 2e 64 65 6c 65 74 65 42 69 6e 64 69 6e 67 73 e.deleteBindings
000276e0: 28 61 2e 73 6c 69 63 65 28 31 29 29 3b 63 6f 6e (a.slice(1));con
000276f0: 73 74 20 73 3d 61 5b 30 5d 3b 73 3f 65 2e 75 70 st s=a[0];s?e.up
00027700: 64 61 74 65 42 69 6e 64 69 6e 67 28 7b 2e 2e 2e dateBinding({...
00027710: 73 2c 74 6f 49 64 3a 69 2c 70 72 6f 70 73 3a 72 s,toId:i,props:r
00027720: 7d 29 3a 65 2e 63 72 65 61 74 65 42 69 6e 64 69 }):e.createBindi
00027730: 6e 67 28 7b 74 79 70 65 3a 22 61 72 72 6f 77 22 ng({type:"arrow"
00027740: 2c 66 72 6f 6d 49 64 3a 6f 2c 74 6f 49 64 3a 69 ,fromId:o,toId:i
00027750: 2c 70 72 6f 70 73 3a 72 7d 29 7d 66 75 6e 63 74 ,props:r})}funct
00027760: 69 6f 6e 20 45 62 28 65 2c 74 2c 6e 29 7b 63 6f ion Eb(e,t,n){co
00027770: 6e 73 74 20 72 3d 65 2e 67 65 74 42 69 6e 64 69 nst r=e.getBindi
00027780: 6e 67 73 46 72 6f 6d 53 68 61 70 65 28 74 2c 22 ngsFromShape(t,"
00027790: 61 72 72 6f 77 22 29 2e 66 69 6c 74 65 72 28 28 arrow").filter((
000277a0: 65 3d 3e 65 2e 70 72 6f 70 73 2e 74 65 72 6d 69 e=>e.props.termi
000277b0: 6e 61 6c 3d 3d 3d 6e 29 29 3b 65 2e 64 65 6c 65 nal===n));e.dele
000277c0: 74 65 42 69 6e 64 69 6e 67 73 28 72 29 7d 63 6f teBindings(r)}co
000277d0: 6e 73 74 20 77 62 3d 31 30 2c 78 62 3d 31 30 2c nst wb=10,xb=10,
000277e0: 54 62 3d 31 30 2c 43 62 3d 7b 73 3a 32 2c 6d 3a Tb=10,Cb={s:2,m:
000277f0: 33 2e 35 2c 6c 3a 35 2c 78 6c 3a 31 30 7d 3b 66 3.5,l:5,xl:10};f
00027800: 75 6e 63 74 69 6f 6e 20 6b 62 28 65 2c 74 2c 6e unction kb(e,t,n
00027810: 29 7b 69 66 28 21 74 7c 7c 21 6e 29 72 65 74 75 ){if(!t||!n)retu
00027820: 72 6e 22 73 61 66 65 22 3b 69 66 28 74 3d 3d 3d rn"safe";if(t===
00027830: 6e 29 72 65 74 75 72 6e 22 64 6f 75 62 6c 65 2d n)return"double-
00027840: 62 6f 75 6e 64 22 3b 63 6f 6e 73 74 20 72 3d 65 bound";const r=e
00027850: 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 6f 75 .getShapePageBou
00027860: 6e 64 73 28 74 29 2c 6f 3d 65 2e 67 65 74 53 68 nds(t),o=e.getSh
00027870: 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 6e 29 apePageBounds(n)
00027880: 3b 69 66 28 72 26 26 6f 29 7b 69 66 28 72 2e 63 ;if(r&&o){if(r.c
00027890: 6f 6e 74 61 69 6e 73 28 6f 29 29 72 65 74 75 72 ontains(o))retur
000278a0: 6e 22 73 74 61 72 74 2d 63 6f 6e 74 61 69 6e 73 n"start-contains
000278b0: 2d 65 6e 64 22 3b 69 66 28 6f 2e 63 6f 6e 74 61 -end";if(o.conta
000278c0: 69 6e 73 28 72 29 29 72 65 74 75 72 6e 22 65 6e ins(r))return"en
000278d0: 64 2d 63 6f 6e 74 61 69 6e 73 2d 73 74 61 72 74 d-contains-start
000278e0: 22 7d 72 65 74 75 72 6e 22 73 61 66 65 22 7d 66 "}return"safe"}f
000278f0: 75 6e 63 74 69 6f 6e 20 41 62 28 65 2c 74 29 7b unction Ab(e,t){
00027900: 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 74 53 68 61 const n=e.getSha
00027910: 70 65 28 74 29 3b 69 66 28 21 6e 29 72 65 74 75 pe(t);if(!n)retu
00027920: 72 6e 3b 63 6f 6e 73 74 20 72 3d 62 62 28 65 2c rn;const r=bb(e,
00027930: 6e 29 2c 7b 73 74 61 72 74 3a 6f 2c 65 6e 64 3a n),{start:o,end:
00027940: 69 7d 3d 72 2c 61 3d 6f 3f 65 2e 67 65 74 53 68 i}=r,a=o?e.getSh
00027950: 61 70 65 28 6f 2e 74 6f 49 64 29 3a 76 6f 69 64 ape(o.toId):void
00027960: 20 30 2c 73 3d 69 3f 65 2e 67 65 74 53 68 61 70 0,s=i?e.getShap
00027970: 65 28 69 2e 74 6f 49 64 29 3a 76 6f 69 64 20 30 e(i.toId):void 0
00027980: 2c 6c 3d 65 2e 67 65 74 41 6e 63 65 73 74 6f 72 ,l=e.getAncestor
00027990: 50 61 67 65 49 64 28 6e 29 3b 69 66 28 21 6c 29 PageId(n);if(!l)
000279a0: 72 65 74 75 72 6e 3b 6c 65 74 20 63 3b 69 66 28 return;let c;if(
000279b0: 61 26 26 73 29 63 3d 65 2e 66 69 6e 64 43 6f 6d a&&s)c=e.findCom
000279c0: 6d 6f 6e 41 6e 63 65 73 74 6f 72 28 5b 61 2c 73 monAncestor([a,s
000279d0: 5d 29 3f 3f 6c 3b 65 6c 73 65 7b 69 66 28 21 61 ])??l;else{if(!a
000279e0: 26 26 21 73 29 72 65 74 75 72 6e 3b 7b 63 6f 6e &&!s)return;{con
000279f0: 73 74 20 65 3d 28 61 7c 7c 73 29 3f 2e 70 61 72 st e=(a||s)?.par
00027a00: 65 6e 74 49 64 3b 63 3d 65 26 26 65 3d 3d 3d 6e entId;c=e&&e===n
00027a10: 2e 70 61 72 65 6e 74 49 64 3f 6e 2e 70 61 72 65 .parentId?n.pare
00027a20: 6e 74 49 64 3a 6c 7d 7d 63 26 26 63 21 3d 3d 6e ntId:l}}c&&c!==n
00027a30: 2e 70 61 72 65 6e 74 49 64 26 26 65 2e 72 65 70 .parentId&&e.rep
00027a40: 61 72 65 6e 74 53 68 61 70 65 73 28 5b 74 5d 2c arentShapes([t],
00027a50: 63 29 3b 63 6f 6e 73 74 20 75 3d 65 2e 67 65 74 c);const u=e.get
00027a60: 53 68 61 70 65 28 74 29 3b 69 66 28 21 75 29 74 Shape(t);if(!u)t
00027a70: 68 72 6f 77 20 45 72 72 6f 72 28 22 6e 6f 20 72 hrow Error("no r
00027a80: 65 70 61 72 65 6e 74 65 64 20 61 72 72 6f 77 22 eparented arrow"
00027a90: 29 3b 63 6f 6e 73 74 20 64 3d 65 2e 67 65 74 53 );const d=e.getS
00027aa0: 68 61 70 65 4e 65 61 72 65 73 74 53 69 62 6c 69 hapeNearestSibli
00027ab0: 6e 67 28 75 2c 61 29 2c 70 3d 65 2e 67 65 74 53 ng(u,a),p=e.getS
00027ac0: 68 61 70 65 4e 65 61 72 65 73 74 53 69 62 6c 69 hapeNearestSibli
00027ad0: 6e 67 28 75 2c 73 29 3b 6c 65 74 20 66 2c 68 3b ng(u,s);let f,h;
00027ae0: 69 66 28 64 26 26 70 29 66 3d 64 2e 69 6e 64 65 if(d&&p)f=d.inde
00027af0: 78 3e 70 2e 69 6e 64 65 78 3f 64 3a 70 3b 65 6c x>p.index?d:p;el
00027b00: 73 65 20 69 66 28 64 26 26 21 70 29 66 3d 64 3b se if(d&&!p)f=d;
00027b10: 65 6c 73 65 7b 69 66 28 21 70 7c 7c 64 29 72 65 else{if(!p||d)re
00027b20: 74 75 72 6e 3b 66 3d 70 7d 63 6f 6e 73 74 20 6d turn;f=p}const m
00027b30: 3d 65 2e 67 65 74 53 6f 72 74 65 64 43 68 69 6c =e.getSortedChil
00027b40: 64 49 64 73 46 6f 72 50 61 72 65 6e 74 28 66 2e dIdsForParent(f.
00027b50: 70 61 72 65 6e 74 49 64 29 2e 6d 61 70 28 28 74 parentId).map((t
00027b60: 3d 3e 65 2e 67 65 74 53 68 61 70 65 28 74 29 29 =>e.getShape(t))
00027b70: 29 2e 66 69 6c 74 65 72 28 28 65 3d 3e 65 2e 69 ).filter((e=>e.i
00027b80: 6e 64 65 78 3e 66 2e 69 6e 64 65 78 29 29 3b 69 ndex>f.index));i
00027b90: 66 28 6d 2e 6c 65 6e 67 74 68 29 7b 63 6f 6e 73 f(m.length){cons
00027ba0: 74 20 65 3d 6d 2e 66 69 6e 64 28 28 65 3d 3e 22 t e=m.find((e=>"
00027bb0: 61 72 72 6f 77 22 21 3d 3d 65 2e 74 79 70 65 29 arrow"!==e.type)
00027bc0: 29 3b 69 66 28 75 2e 69 6e 64 65 78 3e 66 2e 69 );if(u.index>f.i
00027bd0: 6e 64 65 78 26 26 28 21 65 7c 7c 75 2e 69 6e 64 ndex&&(!e||u.ind
00027be0: 65 78 3c 65 2e 69 6e 64 65 78 29 29 72 65 74 75 ex<e.index))retu
00027bf0: 72 6e 3b 68 3d 7a 6f 28 66 2e 69 6e 64 65 78 2c rn;h=zo(f.index,
00027c00: 6d 5b 30 5d 2e 69 6e 64 65 78 29 7d 65 6c 73 65 m[0].index)}else
00027c10: 20 68 3d 47 6f 28 66 2e 69 6e 64 65 78 29 3b 68 h=Go(f.index);h
00027c20: 21 3d 3d 75 2e 69 6e 64 65 78 26 26 65 2e 75 70 !==u.index&&e.up
00027c30: 64 61 74 65 53 68 61 70 65 73 28 5b 7b 69 64 3a dateShapes([{id:
00027c40: 74 2c 74 79 70 65 3a 22 61 72 72 6f 77 22 2c 69 t,type:"arrow",i
00027c50: 6e 64 65 78 3a 68 7d 5d 29 7d 66 75 6e 63 74 69 ndex:h}])}functi
00027c60: 6f 6e 20 49 62 28 65 2c 74 29 7b 63 6f 6e 73 74 on Ib(e,t){const
00027c70: 20 6e 3d 62 62 28 65 2c 74 29 3b 66 6f 72 28 63 n=bb(e,t);for(c
00027c80: 6f 6e 73 74 20 72 20 6f 66 5b 22 73 74 61 72 74 onst r of["start
00027c90: 22 2c 22 65 6e 64 22 5d 29 7b 63 6f 6e 73 74 20 ","end"]){const
00027ca0: 6f 3d 6e 5b 72 5d 3b 69 66 28 21 6f 29 63 6f 6e o=n[r];if(!o)con
00027cb0: 74 69 6e 75 65 3b 63 6f 6e 73 74 20 69 3d 65 2e tinue;const i=e.
00027cc0: 67 65 74 53 68 61 70 65 28 6f 2e 74 6f 49 64 29 getShape(o.toId)
00027cd0: 2c 61 3d 65 2e 67 65 74 41 6e 63 65 73 74 6f 72 ,a=e.getAncestor
00027ce0: 50 61 67 65 49 64 28 74 29 3d 3d 3d 65 2e 67 65 PageId(t)===e.ge
00027cf0: 74 41 6e 63 65 73 74 6f 72 50 61 67 65 49 64 28 tAncestorPageId(
00027d00: 69 29 3b 69 26 26 61 7c 7c 52 62 28 7b 65 64 69 i);i&&a||Rb({edi
00027d10: 74 6f 72 3a 65 2c 61 72 72 6f 77 3a 74 2c 74 65 tor:e,arrow:t,te
00027d20: 72 6d 69 6e 61 6c 3a 72 2c 75 6e 62 69 6e 64 3a rminal:r,unbind:
00027d30: 21 30 7d 29 7d 41 62 28 65 2c 74 2e 69 64 29 7d !0})}Ab(e,t.id)}
00027d40: 66 75 6e 63 74 69 6f 6e 20 52 62 28 7b 65 64 69 function Rb({edi
00027d50: 74 6f 72 3a 65 2c 61 72 72 6f 77 3a 74 2c 74 65 tor:e,arrow:t,te
00027d60: 72 6d 69 6e 61 6c 3a 6e 2c 75 6e 62 69 6e 64 3a rminal:n,unbind:
00027d70: 72 3d 21 31 2c 75 73 65 48 61 6e 64 6c 65 3a 6f r=!1,useHandle:o
00027d80: 3d 21 31 7d 29 7b 63 6f 6e 73 74 20 69 3d 76 62 =!1}){const i=vb
00027d90: 28 65 2c 74 29 3b 69 66 28 21 69 29 74 68 72 6f (e,t);if(!i)thro
00027da0: 77 20 6e 65 77 20 45 72 72 6f 72 28 22 65 78 70 w new Error("exp
00027db0: 65 63 74 65 64 20 61 72 72 6f 77 20 69 6e 66 6f ected arrow info
00027dc0: 22 29 3b 63 6f 6e 73 74 20 61 3d 6f 3f 69 2e 73 ");const a=o?i.s
00027dd0: 74 61 72 74 2e 68 61 6e 64 6c 65 3a 69 2e 73 74 tart.handle:i.st
00027de0: 61 72 74 2e 70 6f 69 6e 74 2c 73 3d 6f 3f 69 2e art.point,s=o?i.
00027df0: 65 6e 64 2e 68 61 6e 64 6c 65 3a 69 2e 65 6e 64 end.handle:i.end
00027e00: 2e 70 6f 69 6e 74 2c 6c 3d 22 73 74 61 72 74 22 .point,l="start"
00027e10: 3d 3d 3d 6e 3f 61 3a 73 2c 63 3d 7b 69 64 3a 74 ===n?a:s,c={id:t
00027e20: 2e 69 64 2c 74 79 70 65 3a 22 61 72 72 6f 77 22 .id,type:"arrow"
00027e30: 2c 70 72 6f 70 73 3a 7b 5b 6e 5d 3a 7b 78 3a 6c ,props:{[n]:{x:l
00027e40: 2e 78 2c 79 3a 6c 2e 79 7d 2c 62 65 6e 64 3a 74 .x,y:l.y},bend:t
00027e50: 2e 70 72 6f 70 73 2e 62 65 6e 64 7d 7d 3b 69 66 .props.bend}};if
00027e60: 28 21 69 2e 69 73 53 74 72 61 69 67 68 74 29 7b (!i.isStraight){
00027e70: 63 6f 6e 73 74 20 65 3d 22 73 74 61 72 74 22 3d const e="start"=
00027e80: 3d 3d 6e 3f 61 3a 69 2e 73 74 61 72 74 2e 68 61 ==n?a:i.start.ha
00027e90: 6e 64 6c 65 2c 72 3d 22 65 6e 64 22 3d 3d 3d 6e ndle,r="end"===n
00027ea0: 3f 73 3a 69 2e 65 6e 64 2e 68 61 6e 64 6c 65 2c ?s:i.end.handle,
00027eb0: 6f 3d 73 75 2e 4d 65 64 28 65 2c 72 29 2c 6c 3d o=su.Med(e,r),l=
00027ec0: 73 75 2e 53 75 62 28 65 2c 72 29 2e 70 65 72 28 su.Sub(e,r).per(
00027ed0: 29 2e 75 6e 69 28 29 2e 6d 75 6c 28 32 2a 69 2e ).uni().mul(2*i.
00027ee0: 68 61 6e 64 6c 65 41 72 63 2e 72 61 64 69 75 73 handleArc.radius
00027ef0: 2a 4d 61 74 68 2e 73 69 67 6e 28 74 2e 70 72 6f *Math.sign(t.pro
00027f00: 70 73 2e 62 65 6e 64 29 29 2c 75 3d 67 68 28 69 ps.bend)),u=gh(i
00027f10: 2e 68 61 6e 64 6c 65 41 72 63 2e 63 65 6e 74 65 .handleArc.cente
00027f20: 72 2c 73 75 2e 41 64 64 28 6f 2c 6c 29 2c 69 2e r,su.Add(o,l),i.
00027f30: 68 61 6e 64 6c 65 41 72 63 2e 63 65 6e 74 65 72 handleArc.center
00027f40: 2c 69 2e 68 61 6e 64 6c 65 41 72 63 2e 72 61 64 ,i.handleArc.rad
00027f50: 69 75 73 29 3b 57 72 28 31 3d 3d 3d 75 3f 2e 6c ius);Wr(1===u?.l
00027f60: 65 6e 67 74 68 29 3b 63 6f 6e 73 74 20 64 3d 73 ength);const d=s
00027f70: 75 2e 44 69 73 74 28 6f 2c 75 5b 30 5d 29 2a 4d u.Dist(o,u[0])*M
00027f80: 61 74 68 2e 73 69 67 6e 28 74 2e 70 72 6f 70 73 ath.sign(t.props
00027f90: 2e 62 65 6e 64 29 3b 62 75 28 64 2c 63 2e 70 72 .bend);bu(d,c.pr
00027fa0: 6f 70 73 2e 62 65 6e 64 29 7c 7c 28 63 2e 70 72 ops.bend)||(c.pr
00027fb0: 6f 70 73 2e 62 65 6e 64 3d 64 29 7d 65 2e 75 70 ops.bend=d)}e.up
00027fc0: 64 61 74 65 53 68 61 70 65 28 63 29 2c 72 26 26 dateShape(c),r&&
00027fd0: 45 62 28 65 2c 74 2c 6e 29 7d 63 6f 6e 73 74 20 Eb(e,t,n)}const
00027fe0: 4f 62 3d 5b 63 6c 61 73 73 20 65 78 74 65 6e 64 Ob=[class extend
00027ff0: 73 20 54 67 7b 73 74 61 74 69 63 20 74 79 70 65 s Tg{static type
00028000: 3d 22 61 72 72 6f 77 22 3b 73 74 61 74 69 63 20 ="arrow";static
00028010: 70 72 6f 70 73 3d 4a 73 3b 73 74 61 74 69 63 20 props=Js;static
00028020: 6d 69 67 72 61 74 69 6f 6e 73 3d 24 73 3b 67 65 migrations=$s;ge
00028030: 74 44 65 66 61 75 6c 74 50 72 6f 70 73 28 29 7b tDefaultProps(){
00028040: 72 65 74 75 72 6e 7b 69 73 50 72 65 63 69 73 65 return{isPrecise
00028050: 3a 21 31 2c 69 73 45 78 61 63 74 3a 21 31 2c 6e :!1,isExact:!1,n
00028060: 6f 72 6d 61 6c 69 7a 65 64 41 6e 63 68 6f 72 3a ormalizedAnchor:
00028070: 7b 78 3a 2e 35 2c 79 3a 2e 35 7d 7d 7d 6f 6e 41 {x:.5,y:.5}}}onA
00028080: 66 74 65 72 43 72 65 61 74 65 28 7b 62 69 6e 64 fterCreate({bind
00028090: 69 6e 67 3a 65 7d 29 7b 49 62 28 74 68 69 73 2e ing:e}){Ib(this.
000280a0: 65 64 69 74 6f 72 2c 74 68 69 73 2e 65 64 69 74 editor,this.edit
000280b0: 6f 72 2e 67 65 74 53 68 61 70 65 28 65 2e 66 72 or.getShape(e.fr
000280c0: 6f 6d 49 64 29 29 7d 6f 6e 41 66 74 65 72 43 68 omId))}onAfterCh
000280d0: 61 6e 67 65 28 7b 62 69 6e 64 69 6e 67 41 66 74 ange({bindingAft
000280e0: 65 72 3a 65 7d 29 7b 49 62 28 74 68 69 73 2e 65 er:e}){Ib(this.e
000280f0: 64 69 74 6f 72 2c 74 68 69 73 2e 65 64 69 74 6f ditor,this.edito
00028100: 72 2e 67 65 74 53 68 61 70 65 28 65 2e 66 72 6f r.getShape(e.fro
00028110: 6d 49 64 29 29 7d 6f 6e 41 66 74 65 72 43 68 61 mId))}onAfterCha
00028120: 6e 67 65 46 72 6f 6d 53 68 61 70 65 28 7b 73 68 ngeFromShape({sh
00028130: 61 70 65 41 66 74 65 72 3a 65 7d 29 7b 49 62 28 apeAfter:e}){Ib(
00028140: 74 68 69 73 2e 65 64 69 74 6f 72 2c 65 29 7d 6f this.editor,e)}o
00028150: 6e 41 66 74 65 72 43 68 61 6e 67 65 54 6f 53 68 nAfterChangeToSh
00028160: 61 70 65 28 7b 62 69 6e 64 69 6e 67 3a 65 7d 29 ape({binding:e})
00028170: 7b 41 62 28 74 68 69 73 2e 65 64 69 74 6f 72 2c {Ab(this.editor,
00028180: 65 2e 66 72 6f 6d 49 64 29 7d 6f 6e 42 65 66 6f e.fromId)}onBefo
00028190: 72 65 49 73 6f 6c 61 74 65 46 72 6f 6d 53 68 61 reIsolateFromSha
000281a0: 70 65 28 7b 62 69 6e 64 69 6e 67 3a 65 7d 29 7b pe({binding:e}){
000281b0: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 64 69 const t=this.edi
000281c0: 74 6f 72 2e 67 65 74 53 68 61 70 65 28 65 2e 66 tor.getShape(e.f
000281d0: 72 6f 6d 49 64 29 3b 74 26 26 52 62 28 7b 65 64 romId);t&&Rb({ed
000281e0: 69 74 6f 72 3a 74 68 69 73 2e 65 64 69 74 6f 72 itor:this.editor
000281f0: 2c 61 72 72 6f 77 3a 74 2c 74 65 72 6d 69 6e 61 ,arrow:t,termina
00028200: 6c 3a 65 2e 70 72 6f 70 73 2e 74 65 72 6d 69 6e l:e.props.termin
00028210: 61 6c 7d 29 7d 7d 5d 2c 4e 62 3d 7b 6c 69 6e 65 al})}}],Nb={line
00028220: 48 65 69 67 68 74 3a 31 2e 33 35 2c 66 6f 6e 74 Height:1.35,font
00028230: 57 65 69 67 68 74 3a 22 6e 6f 72 6d 61 6c 22 2c Weight:"normal",
00028240: 66 6f 6e 74 56 61 72 69 61 6e 74 3a 22 6e 6f 72 fontVariant:"nor
00028250: 6d 61 6c 22 2c 66 6f 6e 74 53 74 79 6c 65 3a 22 mal",fontStyle:"
00028260: 6e 6f 72 6d 61 6c 22 2c 70 61 64 64 69 6e 67 3a normal",padding:
00028270: 22 30 70 78 22 7d 2c 50 62 3d 7b 73 3a 32 2c 6d "0px"},Pb={s:2,m
00028280: 3a 33 2e 35 2c 6c 3a 35 2c 78 6c 3a 31 30 7d 2c :3.5,l:5,xl:10},
00028290: 4d 62 3d 7b 73 3a 31 38 2c 6d 3a 32 34 2c 6c 3a Mb={s:18,m:24,l:
000282a0: 33 36 2c 78 6c 3a 34 34 7d 2c 44 62 3d 7b 73 3a 36,xl:44},Db={s:
000282b0: 31 38 2c 6d 3a 32 32 2c 6c 3a 32 36 2c 78 6c 3a 18,m:22,l:26,xl:
000282c0: 33 32 7d 2c 4c 62 3d 7b 73 3a 31 38 2c 6d 3a 32 32},Lb={s:18,m:2
000282d0: 30 2c 6c 3a 32 34 2c 78 6c 3a 32 38 7d 2c 46 62 0,l:24,xl:28},Fb
000282e0: 3d 7b 64 72 61 77 3a 22 76 61 72 28 2d 2d 74 6c ={draw:"var(--tl
000282f0: 2d 66 6f 6e 74 2d 64 72 61 77 29 22 2c 73 61 6e -font-draw)",san
00028300: 73 3a 22 76 61 72 28 2d 2d 74 6c 2d 66 6f 6e 74 s:"var(--tl-font
00028310: 2d 73 61 6e 73 29 22 2c 73 65 72 69 66 3a 22 76 -sans)",serif:"v
00028320: 61 72 28 2d 2d 74 6c 2d 66 6f 6e 74 2d 73 65 72 ar(--tl-font-ser
00028330: 69 66 29 22 2c 6d 6f 6e 6f 3a 22 76 61 72 28 2d if)",mono:"var(-
00028340: 2d 74 6c 2d 66 6f 6e 74 2d 6d 6f 6e 6f 29 22 7d -tl-font-mono)"}
00028350: 2c 6a 62 3d 32 30 2c 42 62 3d 34 2e 32 35 2c 55 ,jb=20,Bb=4.25,U
00028360: 62 3d 31 36 3b 66 75 6e 63 74 69 6f 6e 20 7a 62 b=16;function zb
00028370: 28 65 2c 74 29 7b 76 61 72 20 6e 3d 4f 62 6a 65 (e,t){var n=Obje
00028380: 63 74 2e 6b 65 79 73 28 65 29 3b 69 66 28 4f 62 ct.keys(e);if(Ob
00028390: 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 ject.getOwnPrope
000283a0: 72 74 79 53 79 6d 62 6f 6c 73 29 7b 76 61 72 20 rtySymbols){var
000283b0: 72 3d 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 r=Object.getOwnP
000283c0: 72 6f 70 65 72 74 79 53 79 6d 62 6f 6c 73 28 65 ropertySymbols(e
000283d0: 29 3b 74 26 26 28 72 3d 72 2e 66 69 6c 74 65 72 );t&&(r=r.filter
000283e0: 28 28 66 75 6e 63 74 69 6f 6e 28 74 29 7b 72 65 ((function(t){re
000283f0: 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f turn Object.getO
00028400: 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 wnPropertyDescri
00028410: 70 74 6f 72 28 65 2c 74 29 2e 65 6e 75 6d 65 72 ptor(e,t).enumer
00028420: 61 62 6c 65 7d 29 29 29 2c 6e 2e 70 75 73 68 2e able}))),n.push.
00028430: 61 70 70 6c 79 28 6e 2c 72 29 7d 72 65 74 75 72 apply(n,r)}retur
00028440: 6e 20 6e 7d 66 75 6e 63 74 69 6f 6e 20 47 62 28 n n}function Gb(
00028450: 65 29 7b 66 6f 72 28 76 61 72 20 74 3d 31 3b 74 e){for(var t=1;t
00028460: 3c 61 72 67 75 6d 65 6e 74 73 2e 6c 65 6e 67 74 <arguments.lengt
00028470: 68 3b 74 2b 2b 29 7b 76 61 72 20 6e 3d 6e 75 6c h;t++){var n=nul
00028480: 6c 21 3d 61 72 67 75 6d 65 6e 74 73 5b 74 5d 3f l!=arguments[t]?
00028490: 61 72 67 75 6d 65 6e 74 73 5b 74 5d 3a 7b 7d 3b arguments[t]:{};
000284a0: 74 25 32 3f 7a 62 28 4f 62 6a 65 63 74 28 6e 29 t%2?zb(Object(n)
000284b0: 2c 21 30 29 2e 66 6f 72 45 61 63 68 28 28 66 75 ,!0).forEach((fu
000284c0: 6e 63 74 69 6f 6e 28 74 29 7b 48 62 28 65 2c 74 nction(t){Hb(e,t
000284d0: 2c 6e 5b 74 5d 29 7d 29 29 3a 4f 62 6a 65 63 74 ,n[t])})):Object
000284e0: 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 .getOwnPropertyD
000284f0: 65 73 63 72 69 70 74 6f 72 73 3f 4f 62 6a 65 63 escriptors?Objec
00028500: 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 t.defineProperti
00028510: 65 73 28 65 2c 4f 62 6a 65 63 74 2e 67 65 74 4f es(e,Object.getO
00028520: 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 wnPropertyDescri
00028530: 70 74 6f 72 73 28 6e 29 29 3a 7a 62 28 4f 62 6a ptors(n)):zb(Obj
00028540: 65 63 74 28 6e 29 29 2e 66 6f 72 45 61 63 68 28 ect(n)).forEach(
00028550: 28 66 75 6e 63 74 69 6f 6e 28 74 29 7b 4f 62 6a (function(t){Obj
00028560: 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 ect.defineProper
00028570: 74 79 28 65 2c 74 2c 4f 62 6a 65 63 74 2e 67 65 ty(e,t,Object.ge
00028580: 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 tOwnPropertyDesc
00028590: 72 69 70 74 6f 72 28 6e 2c 74 29 29 7d 29 29 7d riptor(n,t))}))}
000285a0: 72 65 74 75 72 6e 20 65 7d 66 75 6e 63 74 69 6f return e}functio
000285b0: 6e 20 48 62 28 65 2c 74 2c 6e 29 7b 72 65 74 75 n Hb(e,t,n){retu
000285c0: 72 6e 28 74 3d 66 75 6e 63 74 69 6f 6e 28 65 29 rn(t=function(e)
000285d0: 7b 76 61 72 20 74 3d 66 75 6e 63 74 69 6f 6e 28 {var t=function(
000285e0: 65 2c 74 29 7b 69 66 28 22 6f 62 6a 65 63 74 22 e,t){if("object"
000285f0: 21 3d 74 79 70 65 6f 66 20 65 7c 7c 6e 75 6c 6c !=typeof e||null
00028600: 3d 3d 3d 65 29 72 65 74 75 72 6e 20 65 3b 76 61 ===e)return e;va
00028610: 72 20 6e 3d 65 5b 53 79 6d 62 6f 6c 2e 74 6f 50 r n=e[Symbol.toP
00028620: 72 69 6d 69 74 69 76 65 5d 3b 69 66 28 76 6f 69 rimitive];if(voi
00028630: 64 20 30 21 3d 3d 6e 29 7b 76 61 72 20 72 3d 6e d 0!==n){var r=n
00028640: 2e 63 61 6c 6c 28 65 2c 74 7c 7c 22 64 65 66 61 .call(e,t||"defa
00028650: 75 6c 74 22 29 3b 69 66 28 22 6f 62 6a 65 63 74 ult");if("object
00028660: 22 21 3d 74 79 70 65 6f 66 20 72 29 72 65 74 75 "!=typeof r)retu
00028670: 72 6e 20 72 3b 74 68 72 6f 77 20 6e 65 77 20 54 rn r;throw new T
00028680: 79 70 65 45 72 72 6f 72 28 22 40 40 74 6f 50 72 ypeError("@@toPr
00028690: 69 6d 69 74 69 76 65 20 6d 75 73 74 20 72 65 74 imitive must ret
000286a0: 75 72 6e 20 61 20 70 72 69 6d 69 74 69 76 65 20 urn a primitive
000286b0: 76 61 6c 75 65 2e 22 29 7d 72 65 74 75 72 6e 28 value.")}return(
000286c0: 22 73 74 72 69 6e 67 22 3d 3d 3d 74 3f 53 74 72 "string"===t?Str
000286d0: 69 6e 67 3a 4e 75 6d 62 65 72 29 28 65 29 7d 28 ing:Number)(e)}(
000286e0: 65 2c 22 73 74 72 69 6e 67 22 29 3b 72 65 74 75 e,"string");retu
000286f0: 72 6e 22 73 79 6d 62 6f 6c 22 3d 3d 74 79 70 65 rn"symbol"==type
00028700: 6f 66 20 74 3f 74 3a 53 74 72 69 6e 67 28 74 29 of t?t:String(t)
00028710: 7d 28 74 29 29 69 6e 20 65 3f 4f 62 6a 65 63 74 }(t))in e?Object
00028720: 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 .defineProperty(
00028730: 65 2c 74 2c 7b 76 61 6c 75 65 3a 6e 2c 65 6e 75 e,t,{value:n,enu
00028740: 6d 65 72 61 62 6c 65 3a 21 30 2c 63 6f 6e 66 69 merable:!0,confi
00028750: 67 75 72 61 62 6c 65 3a 21 30 2c 77 72 69 74 61 gurable:!0,writa
00028760: 62 6c 65 3a 21 30 7d 29 3a 65 5b 74 5d 3d 6e 2c ble:!0}):e[t]=n,
00028770: 65 7d 66 75 6e 63 74 69 6f 6e 20 56 62 28 65 2c e}function Vb(e,
00028780: 74 29 7b 69 66 28 6e 75 6c 6c 3d 3d 65 29 72 65 t){if(null==e)re
00028790: 74 75 72 6e 7b 7d 3b 76 61 72 20 6e 2c 72 2c 6f turn{};var n,r,o
000287a0: 3d 66 75 6e 63 74 69 6f 6e 28 65 2c 74 29 7b 69 =function(e,t){i
000287b0: 66 28 6e 75 6c 6c 3d 3d 65 29 72 65 74 75 72 6e f(null==e)return
000287c0: 7b 7d 3b 76 61 72 20 6e 2c 72 2c 6f 3d 7b 7d 2c {};var n,r,o={},
000287d0: 69 3d 4f 62 6a 65 63 74 2e 6b 65 79 73 28 65 29 i=Object.keys(e)
000287e0: 3b 66 6f 72 28 72 3d 30 3b 72 3c 69 2e 6c 65 6e ;for(r=0;r<i.len
000287f0: 67 74 68 3b 72 2b 2b 29 6e 3d 69 5b 72 5d 2c 74 gth;r++)n=i[r],t
00028800: 2e 69 6e 64 65 78 4f 66 28 6e 29 3e 3d 30 7c 7c .indexOf(n)>=0||
00028810: 28 6f 5b 6e 5d 3d 65 5b 6e 5d 29 3b 72 65 74 75 (o[n]=e[n]);retu
00028820: 72 6e 20 6f 7d 28 65 2c 74 29 3b 69 66 28 4f 62 rn o}(e,t);if(Ob
00028830: 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 ject.getOwnPrope
00028840: 72 74 79 53 79 6d 62 6f 6c 73 29 7b 76 61 72 20 rtySymbols){var
00028850: 69 3d 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 i=Object.getOwnP
00028860: 72 6f 70 65 72 74 79 53 79 6d 62 6f 6c 73 28 65 ropertySymbols(e
00028870: 29 3b 66 6f 72 28 72 3d 30 3b 72 3c 69 2e 6c 65 );for(r=0;r<i.le
00028880: 6e 67 74 68 3b 72 2b 2b 29 6e 3d 69 5b 72 5d 2c ngth;r++)n=i[r],
00028890: 74 2e 69 6e 64 65 78 4f 66 28 6e 29 3e 3d 30 7c t.indexOf(n)>=0|
000288a0: 7c 4f 62 6a 65 63 74 2e 70 72 6f 74 6f 74 79 70 |Object.prototyp
000288b0: 65 2e 70 72 6f 70 65 72 74 79 49 73 45 6e 75 6d e.propertyIsEnum
000288c0: 65 72 61 62 6c 65 2e 63 61 6c 6c 28 65 2c 6e 29 erable.call(e,n)
000288d0: 26 26 28 6f 5b 6e 5d 3d 65 5b 6e 5d 29 7d 72 65 &&(o[n]=e[n])}re
000288e0: 74 75 72 6e 20 6f 7d 66 75 6e 63 74 69 6f 6e 20 turn o}function
000288f0: 71 62 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 66 qb(e,t){return f
00028900: 75 6e 63 74 69 6f 6e 28 65 29 7b 69 66 28 41 72 unction(e){if(Ar
00028910: 72 61 79 2e 69 73 41 72 72 61 79 28 65 29 29 72 ray.isArray(e))r
00028920: 65 74 75 72 6e 20 65 7d 28 65 29 7c 7c 66 75 6e eturn e}(e)||fun
00028930: 63 74 69 6f 6e 28 65 2c 74 29 7b 76 61 72 20 6e ction(e,t){var n
00028940: 3d 6e 75 6c 6c 3d 3d 65 3f 6e 75 6c 6c 3a 22 75 =null==e?null:"u
00028950: 6e 64 65 66 69 6e 65 64 22 21 3d 74 79 70 65 6f ndefined"!=typeo
00028960: 66 20 53 79 6d 62 6f 6c 26 26 65 5b 53 79 6d 62 f Symbol&&e[Symb
00028970: 6f 6c 2e 69 74 65 72 61 74 6f 72 5d 7c 7c 65 5b ol.iterator]||e[
00028980: 22 40 40 69 74 65 72 61 74 6f 72 22 5d 3b 69 66 "@@iterator"];if
00028990: 28 6e 75 6c 6c 21 3d 6e 29 7b 76 61 72 20 72 2c (null!=n){var r,
000289a0: 6f 2c 69 2c 61 2c 73 3d 5b 5d 2c 6c 3d 21 30 2c o,i,a,s=[],l=!0,
000289b0: 63 3d 21 31 3b 74 72 79 7b 69 66 28 69 3d 28 6e c=!1;try{if(i=(n
000289c0: 3d 6e 2e 63 61 6c 6c 28 65 29 29 2e 6e 65 78 74 =n.call(e)).next
000289d0: 2c 30 3d 3d 3d 74 29 7b 69 66 28 4f 62 6a 65 63 ,0===t){if(Objec
000289e0: 74 28 6e 29 21 3d 3d 6e 29 72 65 74 75 72 6e 3b t(n)!==n)return;
000289f0: 6c 3d 21 31 7d 65 6c 73 65 20 66 6f 72 28 3b 21 l=!1}else for(;!
00028a00: 28 6c 3d 28 72 3d 69 2e 63 61 6c 6c 28 6e 29 29 (l=(r=i.call(n))
00028a10: 2e 64 6f 6e 65 29 26 26 28 73 2e 70 75 73 68 28 .done)&&(s.push(
00028a20: 72 2e 76 61 6c 75 65 29 2c 73 2e 6c 65 6e 67 74 r.value),s.lengt
00028a30: 68 21 3d 3d 74 29 3b 6c 3d 21 30 29 3b 7d 63 61 h!==t);l=!0);}ca
00028a40: 74 63 68 28 65 29 7b 63 3d 21 30 2c 6f 3d 65 7d tch(e){c=!0,o=e}
00028a50: 66 69 6e 61 6c 6c 79 7b 74 72 79 7b 69 66 28 21 finally{try{if(!
00028a60: 6c 26 26 6e 75 6c 6c 21 3d 6e 2e 72 65 74 75 72 l&&null!=n.retur
00028a70: 6e 26 26 28 61 3d 6e 2e 72 65 74 75 72 6e 28 29 n&&(a=n.return()
00028a80: 2c 4f 62 6a 65 63 74 28 61 29 21 3d 3d 61 29 29 ,Object(a)!==a))
00028a90: 72 65 74 75 72 6e 7d 66 69 6e 61 6c 6c 79 7b 69 return}finally{i
00028aa0: 66 28 63 29 74 68 72 6f 77 20 6f 7d 7d 72 65 74 f(c)throw o}}ret
00028ab0: 75 72 6e 20 73 7d 7d 28 65 2c 74 29 7c 7c 4b 62 urn s}}(e,t)||Kb
00028ac0: 28 65 2c 74 29 7c 7c 66 75 6e 63 74 69 6f 6e 28 (e,t)||function(
00028ad0: 29 7b 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 ){throw new Type
00028ae0: 45 72 72 6f 72 28 22 49 6e 76 61 6c 69 64 20 61 Error("Invalid a
00028af0: 74 74 65 6d 70 74 20 74 6f 20 64 65 73 74 72 75 ttempt to destru
00028b00: 63 74 75 72 65 20 6e 6f 6e 2d 69 74 65 72 61 62 cture non-iterab
00028b10: 6c 65 20 69 6e 73 74 61 6e 63 65 2e 5c 6e 49 6e le instance.\nIn
00028b20: 20 6f 72 64 65 72 20 74 6f 20 62 65 20 69 74 65 order to be ite
00028b30: 72 61 62 6c 65 2c 20 6e 6f 6e 2d 61 72 72 61 79 rable, non-array
00028b40: 20 6f 62 6a 65 63 74 73 20 6d 75 73 74 20 68 61 objects must ha
00028b50: 76 65 20 61 20 5b 53 79 6d 62 6f 6c 2e 69 74 65 ve a [Symbol.ite
00028b60: 72 61 74 6f 72 5d 28 29 20 6d 65 74 68 6f 64 2e rator]() method.
00028b70: 22 29 7d 28 29 7d 66 75 6e 63 74 69 6f 6e 20 57 ")}()}function W
00028b80: 62 28 65 29 7b 72 65 74 75 72 6e 20 66 75 6e 63 b(e){return func
00028b90: 74 69 6f 6e 28 65 29 7b 69 66 28 41 72 72 61 79 tion(e){if(Array
00028ba0: 2e 69 73 41 72 72 61 79 28 65 29 29 72 65 74 75 .isArray(e))retu
00028bb0: 72 6e 20 59 62 28 65 29 7d 28 65 29 7c 7c 66 75 rn Yb(e)}(e)||fu
00028bc0: 6e 63 74 69 6f 6e 28 65 29 7b 69 66 28 22 75 6e nction(e){if("un
00028bd0: 64 65 66 69 6e 65 64 22 21 3d 74 79 70 65 6f 66 defined"!=typeof
00028be0: 20 53 79 6d 62 6f 6c 26 26 6e 75 6c 6c 21 3d 65 Symbol&&null!=e
00028bf0: 5b 53 79 6d 62 6f 6c 2e 69 74 65 72 61 74 6f 72 [Symbol.iterator
00028c00: 5d 7c 7c 6e 75 6c 6c 21 3d 65 5b 22 40 40 69 74 ]||null!=e["@@it
00028c10: 65 72 61 74 6f 72 22 5d 29 72 65 74 75 72 6e 20 erator"])return
00028c20: 41 72 72 61 79 2e 66 72 6f 6d 28 65 29 7d 28 65 Array.from(e)}(e
00028c30: 29 7c 7c 4b 62 28 65 29 7c 7c 66 75 6e 63 74 69 )||Kb(e)||functi
00028c40: 6f 6e 28 29 7b 74 68 72 6f 77 20 6e 65 77 20 54 on(){throw new T
00028c50: 79 70 65 45 72 72 6f 72 28 22 49 6e 76 61 6c 69 ypeError("Invali
00028c60: 64 20 61 74 74 65 6d 70 74 20 74 6f 20 73 70 72 d attempt to spr
00028c70: 65 61 64 20 6e 6f 6e 2d 69 74 65 72 61 62 6c 65 ead non-iterable
00028c80: 20 69 6e 73 74 61 6e 63 65 2e 5c 6e 49 6e 20 6f instance.\nIn o
00028c90: 72 64 65 72 20 74 6f 20 62 65 20 69 74 65 72 61 rder to be itera
00028ca0: 62 6c 65 2c 20 6e 6f 6e 2d 61 72 72 61 79 20 6f ble, non-array o
00028cb0: 62 6a 65 63 74 73 20 6d 75 73 74 20 68 61 76 65 bjects must have
00028cc0: 20 61 20 5b 53 79 6d 62 6f 6c 2e 69 74 65 72 61 a [Symbol.itera
00028cd0: 74 6f 72 5d 28 29 20 6d 65 74 68 6f 64 2e 22 29 tor]() method.")
00028ce0: 7d 28 29 7d 66 75 6e 63 74 69 6f 6e 20 4b 62 28 }()}function Kb(
00028cf0: 65 2c 74 29 7b 69 66 28 65 29 7b 69 66 28 22 73 e,t){if(e){if("s
00028d00: 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f 66 20 65 tring"==typeof e
00028d10: 29 72 65 74 75 72 6e 20 59 62 28 65 2c 74 29 3b )return Yb(e,t);
00028d20: 76 61 72 20 6e 3d 4f 62 6a 65 63 74 2e 70 72 6f var n=Object.pro
00028d30: 74 6f 74 79 70 65 2e 74 6f 53 74 72 69 6e 67 2e totype.toString.
00028d40: 63 61 6c 6c 28 65 29 2e 73 6c 69 63 65 28 38 2c call(e).slice(8,
00028d50: 2d 31 29 3b 72 65 74 75 72 6e 22 4f 62 6a 65 63 -1);return"Objec
00028d60: 74 22 3d 3d 3d 6e 26 26 65 2e 63 6f 6e 73 74 72 t"===n&&e.constr
00028d70: 75 63 74 6f 72 26 26 28 6e 3d 65 2e 63 6f 6e 73 uctor&&(n=e.cons
00028d80: 74 72 75 63 74 6f 72 2e 6e 61 6d 65 29 2c 22 4d tructor.name),"M
00028d90: 61 70 22 3d 3d 3d 6e 7c 7c 22 53 65 74 22 3d 3d ap"===n||"Set"==
00028da0: 3d 6e 3f 41 72 72 61 79 2e 66 72 6f 6d 28 65 29 =n?Array.from(e)
00028db0: 3a 22 41 72 67 75 6d 65 6e 74 73 22 3d 3d 3d 6e :"Arguments"===n
00028dc0: 7c 7c 2f 5e 28 3f 3a 55 69 7c 49 29 6e 74 28 3f ||/^(?:Ui|I)nt(?
00028dd0: 3a 38 7c 31 36 7c 33 32 29 28 3f 3a 43 6c 61 6d :8|16|32)(?:Clam
00028de0: 70 65 64 29 3f 41 72 72 61 79 24 2f 2e 74 65 73 ped)?Array$/.tes
00028df0: 74 28 6e 29 3f 59 62 28 65 2c 74 29 3a 76 6f 69 t(n)?Yb(e,t):voi
00028e00: 64 20 30 7d 7d 66 75 6e 63 74 69 6f 6e 20 59 62 d 0}}function Yb
00028e10: 28 65 2c 74 29 7b 28 6e 75 6c 6c 3d 3d 74 7c 7c (e,t){(null==t||
00028e20: 74 3e 65 2e 6c 65 6e 67 74 68 29 26 26 28 74 3d t>e.length)&&(t=
00028e30: 65 2e 6c 65 6e 67 74 68 29 3b 66 6f 72 28 76 61 e.length);for(va
00028e40: 72 20 6e 3d 30 2c 72 3d 6e 65 77 20 41 72 72 61 r n=0,r=new Arra
00028e50: 79 28 74 29 3b 6e 3c 74 3b 6e 2b 2b 29 72 5b 6e y(t);n<t;n++)r[n
00028e60: 5d 3d 65 5b 6e 5d 3b 72 65 74 75 72 6e 20 72 7d ]=e[n];return r}
00028e70: 66 75 6e 63 74 69 6f 6e 20 58 62 28 65 29 7b 76 function Xb(e){v
00028e80: 61 72 20 74 2c 6e 2c 72 3d 65 2e 73 69 7a 65 73 ar t,n,r=e.sizes
00028e90: 2e 73 68 69 66 74 28 29 2c 6f 3d 4d 61 74 68 2e .shift(),o=Math.
00028ea0: 6d 61 78 28 4d 61 74 68 2e 63 65 69 6c 28 72 5b max(Math.ceil(r[
00028eb0: 30 5d 29 2c 31 29 2c 69 3d 4d 61 74 68 2e 6d 61 0]),1),i=Math.ma
00028ec0: 78 28 4d 61 74 68 2e 63 65 69 6c 28 72 5b 31 5d x(Math.ceil(r[1]
00028ed0: 29 2c 31 29 2c 61 3d 5b 6f 2d 31 2c 69 2d 31 2c ),1),a=[o-1,i-1,
00028ee0: 31 2c 31 5d 2c 73 3d 44 61 74 65 2e 6e 6f 77 28 1,1],s=Date.now(
00028ef0: 29 2c 6c 3d 22 75 6e 64 65 66 69 6e 65 64 22 21 ),l="undefined"!
00028f00: 3d 74 79 70 65 6f 66 20 57 6f 72 6b 65 72 47 6c =typeof WorkerGl
00028f10: 6f 62 61 6c 53 63 6f 70 65 26 26 73 65 6c 66 20 obalScope&&self
00028f20: 69 6e 73 74 61 6e 63 65 6f 66 20 57 6f 72 6b 65 instanceof Worke
00028f30: 72 47 6c 6f 62 61 6c 53 63 6f 70 65 3b 6c 3f 28 rGlobalScope;l?(
00028f40: 74 3d 6e 65 77 20 4f 66 66 73 63 72 65 65 6e 43 t=new OffscreenC
00028f50: 61 6e 76 61 73 28 31 2c 31 29 2c 6e 3d 6e 65 77 anvas(1,1),n=new
00028f60: 20 4f 66 66 73 63 72 65 65 6e 43 61 6e 76 61 73 OffscreenCanvas
00028f70: 28 6f 2c 69 29 29 3a 28 28 74 3d 64 6f 63 75 6d (o,i)):((t=docum
00028f80: 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e ent.createElemen
00028f90: 74 28 22 63 61 6e 76 61 73 22 29 29 2e 77 69 64 t("canvas")).wid
00028fa0: 74 68 3d 31 2c 74 2e 68 65 69 67 68 74 3d 31 2c th=1,t.height=1,
00028fb0: 28 6e 3d 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 (n=document.crea
00028fc0: 74 65 45 6c 65 6d 65 6e 74 28 22 63 61 6e 76 61 teElement("canva
00028fd0: 73 22 29 29 2e 77 69 64 74 68 3d 6f 2c 6e 2e 68 s")).width=o,n.h
00028fe0: 65 69 67 68 74 3d 69 29 3b 76 61 72 20 63 3d 74 eight=i);var c=t
00028ff0: 2e 67 65 74 43 6f 6e 74 65 78 74 28 22 32 64 22 .getContext("2d"
00029000: 29 2c 75 3d 6e 2e 67 65 74 43 6f 6e 74 65 78 74 ),u=n.getContext
00029010: 28 22 32 64 22 29 3b 75 26 26 28 75 2e 66 69 6c ("2d");u&&(u.fil
00029020: 6c 52 65 63 74 2e 61 70 70 6c 79 28 75 2c 61 29 lRect.apply(u,a)
00029030: 2c 63 2e 64 72 61 77 49 6d 61 67 65 28 6e 2c 6f ,c.drawImage(n,o
00029040: 2d 31 2c 69 2d 31 2c 31 2c 31 2c 30 2c 30 2c 31 -1,i-1,1,1,0,0,1
00029050: 2c 31 29 29 3b 76 61 72 20 64 3d 63 26 26 30 21 ,1));var d=c&&0!
00029060: 3d 3d 63 2e 67 65 74 49 6d 61 67 65 44 61 74 61 ==c.getImageData
00029070: 28 30 2c 30 2c 31 2c 31 29 2e 64 61 74 61 5b 33 (0,0,1,1).data[3
00029080: 5d 2c 70 3d 44 61 74 65 2e 6e 6f 77 28 29 2d 73 ],p=Date.now()-s
00029090: 3b 72 65 74 75 72 6e 5b 74 2c 6e 5d 2e 66 6f 72 ;return[t,n].for
000290a0: 45 61 63 68 28 28 66 75 6e 63 74 69 6f 6e 28 65 Each((function(e
000290b0: 29 7b 65 2e 68 65 69 67 68 74 3d 30 2c 65 2e 77 ){e.height=0,e.w
000290c0: 69 64 74 68 3d 30 7d 29 29 2c 6c 3f 28 70 6f 73 idth=0})),l?(pos
000290d0: 74 4d 65 73 73 61 67 65 28 7b 77 69 64 74 68 3a tMessage({width:
000290e0: 6f 2c 68 65 69 67 68 74 3a 69 2c 62 65 6e 63 68 o,height:i,bench
000290f0: 6d 61 72 6b 3a 70 2c 69 73 54 65 73 74 50 61 73 mark:p,isTestPas
00029100: 73 3a 64 7d 29 2c 21 64 26 26 65 2e 73 69 7a 65 s:d}),!d&&e.size
00029110: 73 2e 6c 65 6e 67 74 68 26 26 58 62 28 65 29 29 s.length&&Xb(e))
00029120: 3a 64 3f 65 2e 6f 6e 53 75 63 63 65 73 73 28 6f :d?e.onSuccess(o
00029130: 2c 69 2c 70 29 3a 28 65 2e 6f 6e 45 72 72 6f 72 ,i,p):(e.onError
00029140: 28 6f 2c 69 2c 70 29 2c 65 2e 73 69 7a 65 73 2e (o,i,p),e.sizes.
00029150: 6c 65 6e 67 74 68 26 26 58 62 28 65 29 29 2c 64 length&&Xb(e)),d
00029160: 7d 76 61 72 20 5a 62 3d 7b 61 72 65 61 3a 5b 31 }var Zb={area:[1
00029170: 36 33 38 34 2c 31 34 31 38 38 2c 31 31 34 30 32 6384,14188,11402
00029180: 2c 31 31 31 38 30 2c 31 30 38 33 36 2c 38 31 39 ,11180,10836,819
00029190: 32 2c 34 30 39 36 2c 31 5d 2c 68 65 69 67 68 74 2,4096,1],height
000291a0: 3a 5b 38 33 38 38 36 30 37 2c 36 35 35 33 35 2c :[8388607,65535,
000291b0: 33 32 37 36 37 2c 31 36 33 38 34 2c 38 31 39 32 32767,16384,8192
000291c0: 2c 34 30 39 36 2c 31 5d 2c 77 69 64 74 68 3a 5b ,4096,1],width:[
000291d0: 34 31 39 34 33 30 33 2c 36 35 35 33 35 2c 33 32 4194303,65535,32
000291e0: 37 36 37 2c 31 36 33 38 34 2c 38 31 39 32 2c 34 767,16384,8192,4
000291f0: 30 39 36 2c 31 5d 7d 2c 51 62 3d 5b 22 6f 6e 45 096,1]},Qb=["onE
00029200: 72 72 6f 72 22 2c 22 6f 6e 53 75 63 63 65 73 73 rror","onSuccess
00029210: 22 5d 2c 4a 62 3d 7b 6d 61 78 3a 6e 75 6c 6c 2c "],Jb={max:null,
00029220: 6d 69 6e 3a 31 2c 73 69 7a 65 73 3a 5b 5d 2c 73 min:1,sizes:[],s
00029230: 74 65 70 3a 31 30 32 34 2c 75 73 65 50 72 6f 6d tep:1024,useProm
00029240: 69 73 65 3a 21 31 2c 75 73 65 57 6f 72 6b 65 72 ise:!1,useWorker
00029250: 3a 21 31 2c 6f 6e 45 72 72 6f 72 3a 46 75 6e 63 :!1,onError:Func
00029260: 74 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2c 6f tion.prototype,o
00029270: 6e 53 75 63 63 65 73 73 3a 46 75 6e 63 74 69 6f nSuccess:Functio
00029280: 6e 2e 70 72 6f 74 6f 74 79 70 65 7d 2c 24 62 3d n.prototype},$b=
00029290: 7b 7d 3b 66 75 6e 63 74 69 6f 6e 20 65 79 28 65 {};function ey(e
000292a0: 29 7b 76 61 72 20 74 3d 65 2e 77 69 64 74 68 3d ){var t=e.width=
000292b0: 3d 3d 65 2e 68 65 69 67 68 74 2c 6e 3d 31 3d 3d ==e.height,n=1==
000292c0: 3d 65 2e 68 65 69 67 68 74 2c 72 3d 31 3d 3d 3d =e.height,r=1===
000292d0: 65 2e 77 69 64 74 68 2c 6f 3d 5b 5d 3b 69 66 28 e.width,o=[];if(
000292e0: 65 2e 77 69 64 74 68 26 26 65 2e 68 65 69 67 68 e.width&&e.heigh
000292f0: 74 29 66 6f 72 28 76 61 72 20 69 3d 65 2e 6d 69 t)for(var i=e.mi
00029300: 6e 7c 7c 4a 62 2e 6d 69 6e 2c 61 3d 65 2e 73 74 n||Jb.min,a=e.st
00029310: 65 70 7c 7c 4a 62 2e 73 74 65 70 2c 73 3d 4d 61 ep||Jb.step,s=Ma
00029320: 74 68 2e 6d 61 78 28 65 2e 77 69 64 74 68 2c 65 th.max(e.width,e
00029330: 2e 68 65 69 67 68 74 29 3b 73 3e 3d 69 3b 29 7b .height);s>=i;){
00029340: 76 61 72 20 6c 3d 74 7c 7c 6e 3f 73 3a 31 2c 63 var l=t||n?s:1,c
00029350: 3d 74 7c 7c 72 3f 73 3a 31 3b 6f 2e 70 75 73 68 =t||r?s:1;o.push
00029360: 28 5b 6c 2c 63 5d 29 2c 73 2d 3d 61 7d 65 6c 73 ([l,c]),s-=a}els
00029370: 65 20 65 2e 73 69 7a 65 73 2e 66 6f 72 45 61 63 e e.sizes.forEac
00029380: 68 28 28 66 75 6e 63 74 69 6f 6e 28 65 29 7b 76 h((function(e){v
00029390: 61 72 20 69 3d 74 7c 7c 6e 3f 65 3a 31 2c 61 3d ar i=t||n?e:1,a=
000293a0: 74 7c 7c 72 3f 65 3a 31 3b 6f 2e 70 75 73 68 28 t||r?e:1;o.push(
000293b0: 5b 69 2c 61 5d 29 7d 29 29 3b 72 65 74 75 72 6e [i,a])}));return
000293c0: 20 6f 7d 66 75 6e 63 74 69 6f 6e 20 74 79 28 65 o}function ty(e
000293d0: 29 7b 76 61 72 20 74 3d 77 69 6e 64 6f 77 26 26 ){var t=window&&
000293e0: 22 48 54 4d 4c 43 61 6e 76 61 73 45 6c 65 6d 65 "HTMLCanvasEleme
000293f0: 6e 74 22 69 6e 20 77 69 6e 64 6f 77 2c 6e 3d 77 nt"in window,n=w
00029400: 69 6e 64 6f 77 26 26 22 4f 66 66 73 63 72 65 65 indow&&"Offscree
00029410: 6e 43 61 6e 76 61 73 22 69 6e 20 77 69 6e 64 6f nCanvas"in windo
00029420: 77 2c 72 3d 44 61 74 65 2e 6e 6f 77 28 29 2c 6f w,r=Date.now(),o
00029430: 3d 65 2e 6f 6e 45 72 72 6f 72 2c 69 3d 65 2e 6f =e.onError,i=e.o
00029440: 6e 53 75 63 63 65 73 73 2c 61 3d 56 62 28 65 2c nSuccess,a=Vb(e,
00029450: 51 62 29 2c 73 3d 6e 75 6c 6c 3b 69 66 28 21 74 Qb),s=null;if(!t
00029460: 29 72 65 74 75 72 6e 21 31 3b 69 66 28 65 2e 75 )return!1;if(e.u
00029470: 73 65 57 6f 72 6b 65 72 26 26 6e 29 7b 76 61 72 seWorker&&n){var
00029480: 20 6c 3d 22 5c 6e 20 20 20 20 20 20 20 20 20 20 l="\n
00029490: 20 20 76 61 72 20 63 61 6e 76 61 73 54 65 73 74 var canvasTest
000294a0: 20 3d 20 22 2e 63 6f 6e 63 61 74 28 58 62 2e 74 = ".concat(Xb.t
000294b0: 6f 53 74 72 69 6e 67 28 29 2c 22 3b 5c 6e 20 20 oString(),";\n
000294c0: 20 20 20 20 20 20 20 20 20 20 6f 6e 6d 65 73 73 onmess
000294d0: 61 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e 28 65 age = function(e
000294e0: 29 20 7b 5c 6e 20 20 20 20 20 20 20 20 20 20 20 ) {\n
000294f0: 20 20 20 20 20 63 61 6e 76 61 73 54 65 73 74 28 canvasTest(
00029500: 65 2e 64 61 74 61 29 3b 5c 6e 20 20 20 20 20 20 e.data);\n
00029510: 20 20 20 20 20 20 7d 3b 5c 6e 20 20 20 20 20 20 };\n
00029520: 20 20 22 29 2c 63 3d 6e 65 77 20 42 6c 6f 62 28 "),c=new Blob(
00029530: 5b 6c 5d 2c 7b 74 79 70 65 3a 22 61 70 70 6c 69 [l],{type:"appli
00029540: 63 61 74 69 6f 6e 2f 6a 61 76 61 73 63 72 69 70 cation/javascrip
00029550: 74 22 7d 29 2c 75 3d 55 52 4c 2e 63 72 65 61 74 t"}),u=URL.creat
00029560: 65 4f 62 6a 65 63 74 55 52 4c 28 63 29 3b 73 3d eObjectURL(c);s=
00029570: 6e 65 77 20 57 6f 72 6b 65 72 28 75 29 2c 55 52 new Worker(u),UR
00029580: 4c 2e 72 65 76 6f 6b 65 4f 62 6a 65 63 74 55 52 L.revokeObjectUR
00029590: 4c 28 75 29 2c 73 2e 6f 6e 6d 65 73 73 61 67 65 L(u),s.onmessage
000295a0: 3d 66 75 6e 63 74 69 6f 6e 28 65 29 7b 76 61 72 =function(e){var
000295b0: 20 74 3d 65 2e 64 61 74 61 2c 6e 3d 74 2e 77 69 t=e.data,n=t.wi
000295c0: 64 74 68 2c 6f 3d 74 2e 68 65 69 67 68 74 2c 69 dth,o=t.height,i
000295d0: 3d 74 2e 62 65 6e 63 68 6d 61 72 6b 3b 74 2e 69 =t.benchmark;t.i
000295e0: 73 54 65 73 74 50 61 73 73 3f 28 24 62 5b 72 5d sTestPass?($b[r]
000295f0: 2e 6f 6e 53 75 63 63 65 73 73 28 6e 2c 6f 2c 69 .onSuccess(n,o,i
00029600: 29 2c 64 65 6c 65 74 65 20 24 62 5b 72 5d 29 3a ),delete $b[r]):
00029610: 24 62 5b 72 5d 2e 6f 6e 45 72 72 6f 72 28 6e 2c $b[r].onError(n,
00029620: 6f 2c 69 29 7d 7d 72 65 74 75 72 6e 20 65 2e 75 o,i)}}return e.u
00029630: 73 65 50 72 6f 6d 69 73 65 3f 6e 65 77 20 50 72 sePromise?new Pr
00029640: 6f 6d 69 73 65 28 28 66 75 6e 63 74 69 6f 6e 28 omise((function(
00029650: 74 2c 6e 29 7b 76 61 72 20 6c 3d 47 62 28 47 62 t,n){var l=Gb(Gb
00029660: 28 7b 7d 2c 65 29 2c 7b 7d 2c 7b 6f 6e 45 72 72 ({},e),{},{onErr
00029670: 6f 72 3a 66 75 6e 63 74 69 6f 6e 28 74 2c 72 2c or:function(t,r,
00029680: 69 29 7b 76 61 72 20 61 3b 69 66 28 30 3d 3d 3d i){var a;if(0===
00029690: 65 2e 73 69 7a 65 73 2e 6c 65 6e 67 74 68 29 61 e.sizes.length)a
000296a0: 3d 21 30 3b 65 6c 73 65 7b 76 61 72 20 73 3d 71 =!0;else{var s=q
000296b0: 62 28 65 2e 73 69 7a 65 73 2e 73 6c 69 63 65 28 b(e.sizes.slice(
000296c0: 2d 31 29 2c 31 29 2c 6c 3d 71 62 28 73 5b 30 5d -1),1),l=qb(s[0]
000296d0: 2c 32 29 2c 63 3d 6c 5b 30 5d 2c 75 3d 6c 5b 31 ,2),c=l[0],u=l[1
000296e0: 5d 3b 61 3d 74 3d 3d 3d 63 26 26 72 3d 3d 3d 75 ];a=t===c&&r===u
000296f0: 7d 6f 28 74 2c 72 2c 69 29 2c 61 26 26 6e 28 7b }o(t,r,i),a&&n({
00029700: 77 69 64 74 68 3a 74 2c 68 65 69 67 68 74 3a 72 width:t,height:r
00029710: 2c 62 65 6e 63 68 6d 61 72 6b 3a 69 7d 29 7d 2c ,benchmark:i})},
00029720: 6f 6e 53 75 63 63 65 73 73 3a 66 75 6e 63 74 69 onSuccess:functi
00029730: 6f 6e 28 65 2c 6e 2c 72 29 7b 69 28 65 2c 6e 2c on(e,n,r){i(e,n,
00029740: 72 29 2c 74 28 7b 77 69 64 74 68 3a 65 2c 68 65 r),t({width:e,he
00029750: 69 67 68 74 3a 6e 2c 62 65 6e 63 68 6d 61 72 6b ight:n,benchmark
00029760: 3a 72 7d 29 7d 7d 29 3b 69 66 28 73 29 7b 76 61 :r})}});if(s){va
00029770: 72 20 63 3d 6c 2e 6f 6e 45 72 72 6f 72 2c 75 3d r c=l.onError,u=
00029780: 6c 2e 6f 6e 53 75 63 63 65 73 73 3b 24 62 5b 72 l.onSuccess;$b[r
00029790: 5d 3d 7b 6f 6e 45 72 72 6f 72 3a 63 2c 6f 6e 53 ]={onError:c,onS
000297a0: 75 63 63 65 73 73 3a 75 7d 2c 73 2e 70 6f 73 74 uccess:u},s.post
000297b0: 4d 65 73 73 61 67 65 28 61 29 7d 65 6c 73 65 20 Message(a)}else
000297c0: 58 62 28 6c 29 7d 29 29 3a 73 3f 28 24 62 5b 72 Xb(l)})):s?($b[r
000297d0: 5d 3d 7b 6f 6e 45 72 72 6f 72 3a 6f 2c 6f 6e 53 ]={onError:o,onS
000297e0: 75 63 63 65 73 73 3a 69 7d 2c 76 6f 69 64 20 73 uccess:i},void s
000297f0: 2e 70 6f 73 74 4d 65 73 73 61 67 65 28 61 29 29 .postMessage(a))
00029800: 3a 58 62 28 65 29 7d 76 61 72 20 6e 79 3d 7b 6d :Xb(e)}var ny={m
00029810: 61 78 41 72 65 61 3a 66 75 6e 63 74 69 6f 6e 28 axArea:function(
00029820: 29 7b 76 61 72 20 65 3d 61 72 67 75 6d 65 6e 74 ){var e=argument
00029830: 73 2e 6c 65 6e 67 74 68 3e 30 26 26 76 6f 69 64 s.length>0&&void
00029840: 20 30 21 3d 3d 61 72 67 75 6d 65 6e 74 73 5b 30 0!==arguments[0
00029850: 5d 3f 61 72 67 75 6d 65 6e 74 73 5b 30 5d 3a 7b ]?arguments[0]:{
00029860: 7d 2c 74 3d 65 79 28 7b 77 69 64 74 68 3a 65 2e },t=ey({width:e.
00029870: 6d 61 78 2c 68 65 69 67 68 74 3a 65 2e 6d 61 78 max,height:e.max
00029880: 2c 6d 69 6e 3a 65 2e 6d 69 6e 2c 73 74 65 70 3a ,min:e.min,step:
00029890: 65 2e 73 74 65 70 2c 73 69 7a 65 73 3a 57 62 28 e.step,sizes:Wb(
000298a0: 5a 62 2e 61 72 65 61 29 7d 29 3b 72 65 74 75 72 Zb.area)});retur
000298b0: 6e 20 74 79 28 47 62 28 47 62 28 47 62 28 7b 7d n ty(Gb(Gb(Gb({}
000298c0: 2c 4a 62 29 2c 65 29 2c 7b 7d 2c 7b 73 69 7a 65 ,Jb),e),{},{size
000298d0: 73 3a 74 7d 29 29 7d 2c 6d 61 78 48 65 69 67 68 s:t}))},maxHeigh
000298e0: 74 3a 66 75 6e 63 74 69 6f 6e 28 29 7b 76 61 72 t:function(){var
000298f0: 20 65 3d 61 72 67 75 6d 65 6e 74 73 2e 6c 65 6e e=arguments.len
00029900: 67 74 68 3e 30 26 26 76 6f 69 64 20 30 21 3d 3d gth>0&&void 0!==
00029910: 61 72 67 75 6d 65 6e 74 73 5b 30 5d 3f 61 72 67 arguments[0]?arg
00029920: 75 6d 65 6e 74 73 5b 30 5d 3a 7b 7d 2c 74 3d 65 uments[0]:{},t=e
00029930: 79 28 7b 77 69 64 74 68 3a 31 2c 68 65 69 67 68 y({width:1,heigh
00029940: 74 3a 65 2e 6d 61 78 2c 6d 69 6e 3a 65 2e 6d 69 t:e.max,min:e.mi
00029950: 6e 2c 73 74 65 70 3a 65 2e 73 74 65 70 2c 73 69 n,step:e.step,si
00029960: 7a 65 73 3a 57 62 28 5a 62 2e 68 65 69 67 68 74 zes:Wb(Zb.height
00029970: 29 7d 29 3b 72 65 74 75 72 6e 20 74 79 28 47 62 )});return ty(Gb
00029980: 28 47 62 28 47 62 28 7b 7d 2c 4a 62 29 2c 65 29 (Gb(Gb({},Jb),e)
00029990: 2c 7b 7d 2c 7b 73 69 7a 65 73 3a 74 7d 29 29 7d ,{},{sizes:t}))}
000299a0: 2c 6d 61 78 57 69 64 74 68 3a 66 75 6e 63 74 69 ,maxWidth:functi
000299b0: 6f 6e 28 29 7b 76 61 72 20 65 3d 61 72 67 75 6d on(){var e=argum
000299c0: 65 6e 74 73 2e 6c 65 6e 67 74 68 3e 30 26 26 76 ents.length>0&&v
000299d0: 6f 69 64 20 30 21 3d 3d 61 72 67 75 6d 65 6e 74 oid 0!==argument
000299e0: 73 5b 30 5d 3f 61 72 67 75 6d 65 6e 74 73 5b 30 s[0]?arguments[0
000299f0: 5d 3a 7b 7d 2c 74 3d 65 79 28 7b 77 69 64 74 68 ]:{},t=ey({width
00029a00: 3a 65 2e 6d 61 78 2c 68 65 69 67 68 74 3a 31 2c :e.max,height:1,
00029a10: 6d 69 6e 3a 65 2e 6d 69 6e 2c 73 74 65 70 3a 65 min:e.min,step:e
00029a20: 2e 73 74 65 70 2c 73 69 7a 65 73 3a 57 62 28 5a .step,sizes:Wb(Z
00029a30: 62 2e 77 69 64 74 68 29 7d 29 3b 72 65 74 75 72 b.width)});retur
00029a40: 6e 20 74 79 28 47 62 28 47 62 28 47 62 28 7b 7d n ty(Gb(Gb(Gb({}
00029a50: 2c 4a 62 29 2c 65 29 2c 7b 7d 2c 7b 73 69 7a 65 ,Jb),e),{},{size
00029a60: 73 3a 74 7d 29 29 7d 2c 74 65 73 74 3a 66 75 6e s:t}))},test:fun
00029a70: 63 74 69 6f 6e 28 29 7b 76 61 72 20 65 3d 61 72 ction(){var e=ar
00029a80: 67 75 6d 65 6e 74 73 2e 6c 65 6e 67 74 68 3e 30 guments.length>0
00029a90: 26 26 76 6f 69 64 20 30 21 3d 3d 61 72 67 75 6d &&void 0!==argum
00029aa0: 65 6e 74 73 5b 30 5d 3f 61 72 67 75 6d 65 6e 74 ents[0]?argument
00029ab0: 73 5b 30 5d 3a 7b 7d 2c 74 3d 47 62 28 47 62 28 s[0]:{},t=Gb(Gb(
00029ac0: 7b 7d 2c 4a 62 29 2c 65 29 3b 72 65 74 75 72 6e {},Jb),e);return
00029ad0: 20 74 2e 73 69 7a 65 73 3d 57 62 28 74 2e 73 69 t.sizes=Wb(t.si
00029ae0: 7a 65 73 29 2c 74 2e 77 69 64 74 68 26 26 74 2e zes),t.width&&t.
00029af0: 68 65 69 67 68 74 26 26 28 74 2e 73 69 7a 65 73 height&&(t.sizes
00029b00: 3d 5b 5b 74 2e 77 69 64 74 68 2c 74 2e 68 65 69 =[[t.width,t.hei
00029b10: 67 68 74 5d 5d 29 2c 74 79 28 74 29 7d 7d 3b 6c ght]]),ty(t)}};l
00029b20: 65 74 20 72 79 3d 6e 75 6c 6c 3b 66 75 6e 63 74 et ry=null;funct
00029b30: 69 6f 6e 20 6f 79 28 29 7b 72 65 74 75 72 6e 20 ion oy(){return
00029b40: 72 79 7c 7c 28 72 79 3d 61 73 79 6e 63 20 66 75 ry||(ry=async fu
00029b50: 6e 63 74 69 6f 6e 28 29 7b 63 6f 6e 73 74 20 65 nction(){const e
00029b60: 3d 61 77 61 69 74 20 6e 79 2e 6d 61 78 57 69 64 =await ny.maxWid
00029b70: 74 68 28 7b 75 73 65 50 72 6f 6d 69 73 65 3a 21 th({usePromise:!
00029b80: 30 7d 29 2c 74 3d 61 77 61 69 74 20 6e 79 2e 6d 0}),t=await ny.m
00029b90: 61 78 48 65 69 67 68 74 28 7b 75 73 65 50 72 6f axHeight({usePro
00029ba0: 6d 69 73 65 3a 21 30 7d 29 2c 6e 3d 61 77 61 69 mise:!0}),n=awai
00029bb0: 74 20 6e 79 2e 6d 61 78 41 72 65 61 28 7b 75 73 t ny.maxArea({us
00029bc0: 65 50 72 6f 6d 69 73 65 3a 21 30 7d 29 3b 72 65 ePromise:!0});re
00029bd0: 74 75 72 6e 7b 6d 61 78 57 69 64 74 68 3a 65 2e turn{maxWidth:e.
00029be0: 77 69 64 74 68 2c 6d 61 78 48 65 69 67 68 74 3a width,maxHeight:
00029bf0: 74 2e 68 65 69 67 68 74 2c 6d 61 78 41 72 65 61 t.height,maxArea
00029c00: 3a 6e 2e 77 69 64 74 68 2a 6e 2e 68 65 69 67 68 :n.width*n.heigh
00029c10: 74 7d 7d 28 29 29 2c 72 79 7d 63 6f 6e 73 74 20 t}}()),ry}const
00029c20: 69 79 3d 38 31 39 32 2c 61 79 3d 31 36 37 37 37 iy=8192,ay=16777
00029c30: 32 31 36 3b 63 6f 6e 73 74 20 73 79 3d 65 3d 3e 216;const sy=e=>
00029c40: 65 2e 73 70 6c 69 74 28 22 2a 22 29 2e 6d 61 70 e.split("*").map
00029c50: 28 28 65 3d 3e 66 75 6e 63 74 69 6f 6e 28 65 29 ((e=>function(e)
00029c60: 7b 69 66 28 22 73 74 72 69 6e 67 22 21 3d 74 79 {if("string"!=ty
00029c70: 70 65 6f 66 20 65 29 74 68 72 6f 77 20 6e 65 77 peof e)throw new
00029c80: 20 54 79 70 65 45 72 72 6f 72 28 22 45 78 70 65 TypeError("Expe
00029c90: 63 74 65 64 20 61 20 73 74 72 69 6e 67 22 29 3b cted a string");
00029ca0: 72 65 74 75 72 6e 20 65 2e 72 65 70 6c 61 63 65 return e.replace
00029cb0: 28 2f 5b 7c 5c 5c 7b 7d 28 29 5b 5c 5d 5e 24 2b (/[|\\{}()[\]^$+
00029cc0: 2a 3f 2e 5d 2f 67 2c 22 5c 5c 24 26 22 29 2e 72 *?.]/g,"\\$&").r
00029cd0: 65 70 6c 61 63 65 28 2f 2d 2f 67 2c 22 5c 5c 78 eplace(/-/g,"\\x
00029ce0: 32 64 22 29 7d 28 65 29 29 29 2e 6a 6f 69 6e 28 2d")}(e))).join(
00029cf0: 22 2e 2b 22 29 2c 6c 79 3d 28 65 2c 74 29 3d 3e ".+"),ly=(e,t)=>
00029d00: 21 21 65 2e 66 69 6e 64 28 28 65 3d 3e 7b 63 6f !!e.find((e=>{co
00029d10: 6e 73 74 20 6e 3d 6e 65 77 20 52 65 67 45 78 70 nst n=new RegExp
00029d20: 28 73 79 28 65 29 29 3b 72 65 74 75 72 6e 20 74 (sy(e));return t
00029d30: 2e 6d 61 74 63 68 28 6e 29 7d 29 29 3b 66 75 6e .match(n)}));fun
00029d40: 63 74 69 6f 6e 20 63 79 28 65 29 7b 63 6f 6e 73 ction cy(e){cons
00029d50: 74 20 74 3d 66 75 6e 63 74 69 6f 6e 28 65 29 7b t t=function(e){
00029d60: 63 6f 6e 73 74 20 74 3d 6e 65 77 20 55 52 4c 28 const t=new URL(
00029d70: 65 29 2e 68 6f 73 74 2e 72 65 70 6c 61 63 65 28 e).host.replace(
00029d80: 22 77 77 77 2e 22 2c 22 22 29 3b 66 6f 72 28 63 "www.","");for(c
00029d90: 6f 6e 73 74 20 6e 20 6f 66 20 73 63 29 69 66 28 onst n of sc)if(
00029da0: 6c 79 28 6e 2e 68 6f 73 74 6e 61 6d 65 73 2c 74 ly(n.hostnames,t
00029db0: 29 29 7b 63 6f 6e 73 74 20 74 3d 6e 2e 74 6f 45 )){const t=n.toE
00029dc0: 6d 62 65 64 55 72 6c 28 65 29 3b 69 66 28 74 29 mbedUrl(e);if(t)
00029dd0: 72 65 74 75 72 6e 7b 64 65 66 69 6e 69 74 69 6f return{definitio
00029de0: 6e 3a 6e 2c 65 6d 62 65 64 55 72 6c 3a 74 2c 75 n:n,embedUrl:t,u
00029df0: 72 6c 3a 65 7d 7d 7d 28 65 29 3f 3f 66 75 6e 63 rl:e}}}(e)??func
00029e00: 74 69 6f 6e 28 65 29 7b 63 6f 6e 73 74 20 74 3d tion(e){const t=
00029e10: 6e 65 77 20 55 52 4c 28 65 29 2e 68 6f 73 74 2e new URL(e).host.
00029e20: 72 65 70 6c 61 63 65 28 22 77 77 77 2e 22 2c 22 replace("www.","
00029e30: 22 29 3b 66 6f 72 28 63 6f 6e 73 74 20 6e 20 6f ");for(const n o
00029e40: 66 20 73 63 29 69 66 28 6c 79 28 6e 2e 68 6f 73 f sc)if(ly(n.hos
00029e50: 74 6e 61 6d 65 73 2c 74 29 29 7b 63 6f 6e 73 74 tnames,t)){const
00029e60: 20 74 3d 6e 2e 66 72 6f 6d 45 6d 62 65 64 55 72 t=n.fromEmbedUr
00029e70: 6c 28 65 29 3b 69 66 28 74 29 72 65 74 75 72 6e l(e);if(t)return
00029e80: 7b 64 65 66 69 6e 69 74 69 6f 6e 3a 6e 2c 75 72 {definition:n,ur
00029e90: 6c 3a 74 2c 65 6d 62 65 64 55 72 6c 3a 65 7d 7d l:t,embedUrl:e}}
00029ea0: 7d 28 65 29 3b 72 65 74 75 72 6e 20 74 7d 66 75 }(e);return t}fu
00029eb0: 6e 63 74 69 6f 6e 20 75 79 28 65 29 7b 74 72 79 nction uy(e){try
00029ec0: 7b 72 65 74 75 72 6e 20 63 79 28 65 29 7d 63 61 {return cy(e)}ca
00029ed0: 74 63 68 28 65 29 7b 63 6f 6e 73 6f 6c 65 2e 65 tch(e){console.e
00029ee0: 72 72 6f 72 28 65 29 7d 7d 63 6f 6e 73 74 20 64 rror(e)}}const d
00029ef0: 79 3d 22 20 20 22 3b 63 6c 61 73 73 20 70 79 7b y=" ";class py{
00029f00: 73 74 61 74 69 63 20 69 6e 73 65 72 74 54 65 78 static insertTex
00029f10: 74 46 69 72 65 66 6f 78 28 65 2c 74 29 7b 65 2e tFirefox(e,t){e.
00029f20: 73 65 74 52 61 6e 67 65 54 65 78 74 28 74 2c 65 setRangeText(t,e
00029f30: 2e 73 65 6c 65 63 74 69 6f 6e 53 74 61 72 74 7c .selectionStart|
00029f40: 7c 30 2c 65 2e 73 65 6c 65 63 74 69 6f 6e 45 6e |0,e.selectionEn
00029f50: 64 7c 7c 30 2c 22 65 6e 64 22 29 2c 65 2e 64 69 d||0,"end"),e.di
00029f60: 73 70 61 74 63 68 45 76 65 6e 74 28 6e 65 77 20 spatchEvent(new
00029f70: 49 6e 70 75 74 45 76 65 6e 74 28 22 69 6e 70 75 InputEvent("inpu
00029f80: 74 22 2c 7b 64 61 74 61 3a 74 2c 69 6e 70 75 74 t",{data:t,input
00029f90: 54 79 70 65 3a 22 69 6e 73 65 72 74 54 65 78 74 Type:"insertText
00029fa0: 22 2c 69 73 43 6f 6d 70 6f 73 69 6e 67 3a 21 31 ",isComposing:!1
00029fb0: 7d 29 29 7d 73 74 61 74 69 63 20 69 6e 73 65 72 }))}static inser
00029fc0: 74 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 65 t(e,t){const n=e
00029fd0: 2e 6f 77 6e 65 72 44 6f 63 75 6d 65 6e 74 2c 72 .ownerDocument,r
00029fe0: 3d 6e 2e 61 63 74 69 76 65 45 6c 65 6d 65 6e 74 =n.activeElement
00029ff0: 3b 72 21 3d 3d 65 26 26 65 2e 66 6f 63 75 73 28 ;r!==e&&e.focus(
0002a000: 29 2c 6e 2e 65 78 65 63 43 6f 6d 6d 61 6e 64 28 ),n.execCommand(
0002a010: 22 69 6e 73 65 72 74 54 65 78 74 22 2c 21 31 2c "insertText",!1,
0002a020: 74 29 7c 7c 70 79 2e 69 6e 73 65 72 74 54 65 78 t)||py.insertTex
0002a030: 74 46 69 72 65 66 6f 78 28 65 2c 74 29 2c 72 3d tFirefox(e,t),r=
0002a040: 3d 3d 6e 2e 62 6f 64 79 3f 65 2e 62 6c 75 72 28 ==n.body?e.blur(
0002a050: 29 3a 72 20 69 6e 73 74 61 6e 63 65 6f 66 20 48 ):r instanceof H
0002a060: 54 4d 4c 45 6c 65 6d 65 6e 74 26 26 72 21 3d 3d TMLElement&&r!==
0002a070: 65 26 26 72 2e 66 6f 63 75 73 28 29 7d 73 74 61 e&&r.focus()}sta
0002a080: 74 69 63 20 73 65 74 28 65 2c 74 29 7b 65 2e 73 tic set(e,t){e.s
0002a090: 65 6c 65 63 74 28 29 2c 70 79 2e 69 6e 73 65 72 elect(),py.inser
0002a0a0: 74 28 65 2c 74 29 7d 73 74 61 74 69 63 20 67 65 t(e,t)}static ge
0002a0b0: 74 53 65 6c 65 63 74 69 6f 6e 28 65 29 7b 63 6f tSelection(e){co
0002a0c0: 6e 73 74 7b 73 65 6c 65 63 74 69 6f 6e 53 74 61 nst{selectionSta
0002a0d0: 72 74 3a 74 2c 73 65 6c 65 63 74 69 6f 6e 45 6e rt:t,selectionEn
0002a0e0: 64 3a 6e 7d 3d 65 3b 72 65 74 75 72 6e 20 65 2e d:n}=e;return e.
0002a0f0: 76 61 6c 75 65 2e 73 6c 69 63 65 28 74 7c 7c 76 value.slice(t||v
0002a100: 6f 69 64 20 30 2c 6e 7c 7c 76 6f 69 64 20 30 29 oid 0,n||void 0)
0002a110: 7d 73 74 61 74 69 63 20 77 72 61 70 53 65 6c 65 }static wrapSele
0002a120: 63 74 69 6f 6e 28 65 2c 74 2c 6e 29 7b 63 6f 6e ction(e,t,n){con
0002a130: 73 74 7b 73 65 6c 65 63 74 69 6f 6e 53 74 61 72 st{selectionStar
0002a140: 74 3a 72 2c 73 65 6c 65 63 74 69 6f 6e 45 6e 64 t:r,selectionEnd
0002a150: 3a 6f 7d 3d 65 2c 69 3d 70 79 2e 67 65 74 53 65 :o}=e,i=py.getSe
0002a160: 6c 65 63 74 69 6f 6e 28 65 29 3b 70 79 2e 69 6e lection(e);py.in
0002a170: 73 65 72 74 28 65 2c 74 2b 69 2b 28 6e 3f 3f 74 sert(e,t+i+(n??t
0002a180: 29 29 2c 65 2e 73 65 6c 65 63 74 69 6f 6e 53 74 )),e.selectionSt
0002a190: 61 72 74 3d 28 72 7c 7c 30 29 2b 74 2e 6c 65 6e art=(r||0)+t.len
0002a1a0: 67 74 68 2c 65 2e 73 65 6c 65 63 74 69 6f 6e 45 gth,e.selectionE
0002a1b0: 6e 64 3d 28 6f 7c 7c 30 29 2b 74 2e 6c 65 6e 67 nd=(o||0)+t.leng
0002a1c0: 74 68 7d 73 74 61 74 69 63 20 72 65 70 6c 61 63 th}static replac
0002a1d0: 65 28 65 2c 74 2c 6e 29 7b 6c 65 74 20 72 3d 30 e(e,t,n){let r=0
0002a1e0: 3b 65 2e 76 61 6c 75 65 2e 72 65 70 6c 61 63 65 ;e.value.replace
0002a1f0: 28 74 2c 28 28 2e 2e 2e 74 29 3d 3e 7b 63 6f 6e (t,((...t)=>{con
0002a200: 73 74 20 6f 3d 72 2b 74 5b 74 2e 6c 65 6e 67 74 st o=r+t[t.lengt
0002a210: 68 2d 32 5d 2c 69 3d 74 5b 30 5d 2e 6c 65 6e 67 h-2],i=t[0].leng
0002a220: 74 68 3b 65 2e 73 65 6c 65 63 74 69 6f 6e 53 74 th;e.selectionSt
0002a230: 61 72 74 3d 6f 2c 65 2e 73 65 6c 65 63 74 69 6f art=o,e.selectio
0002a240: 6e 45 6e 64 3d 6f 2b 69 3b 63 6f 6e 73 74 20 61 nEnd=o+i;const a
0002a250: 3d 22 73 74 72 69 6e 67 22 3d 3d 74 79 70 65 6f ="string"==typeo
0002a260: 66 20 6e 3f 6e 3a 6e 28 2e 2e 2e 74 29 3b 72 65 f n?n:n(...t);re
0002a270: 74 75 72 6e 20 70 79 2e 69 6e 73 65 72 74 28 65 turn py.insert(e
0002a280: 2c 61 29 2c 65 2e 73 65 6c 65 63 74 69 6f 6e 53 ,a),e.selectionS
0002a290: 74 61 72 74 3d 6f 2c 72 2b 3d 61 2e 6c 65 6e 67 tart=o,r+=a.leng
0002a2a0: 74 68 2d 69 2c 61 7d 29 29 7d 73 74 61 74 69 63 th-i,a}))}static
0002a2b0: 20 66 69 6e 64 4c 69 6e 65 45 6e 64 28 65 2c 74 findLineEnd(e,t
0002a2c0: 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e 6c 61 73 74 ){const n=e.last
0002a2d0: 49 6e 64 65 78 4f 66 28 22 5c 6e 22 2c 74 2d 31 IndexOf("\n",t-1
0002a2e0: 29 2b 31 3b 72 65 74 75 72 6e 22 5c 74 22 21 3d )+1;return"\t"!=
0002a2f0: 3d 65 2e 63 68 61 72 41 74 28 6e 29 3f 74 3a 6e =e.charAt(n)?t:n
0002a300: 2b 31 7d 73 74 61 74 69 63 20 69 6e 64 65 6e 74 +1}static indent
0002a310: 28 65 29 7b 63 6f 6e 73 74 7b 73 65 6c 65 63 74 (e){const{select
0002a320: 69 6f 6e 53 74 61 72 74 3a 74 2c 73 65 6c 65 63 ionStart:t,selec
0002a330: 74 69 6f 6e 45 6e 64 3a 6e 2c 76 61 6c 75 65 3a tionEnd:n,value:
0002a340: 72 7d 3d 65 2c 6f 3d 72 2e 73 6c 69 63 65 28 74 r}=e,o=r.slice(t
0002a350: 2c 6e 29 2c 69 3d 2f 5c 6e 2f 67 2e 65 78 65 63 ,n),i=/\n/g.exec
0002a360: 28 6f 29 3f 2e 6c 65 6e 67 74 68 3b 69 66 28 69 (o)?.length;if(i
0002a370: 26 26 69 3e 30 29 7b 63 6f 6e 73 74 20 6f 3d 72 &&i>0){const o=r
0002a380: 2e 6c 61 73 74 49 6e 64 65 78 4f 66 28 22 5c 6e .lastIndexOf("\n
0002a390: 22 2c 74 2d 31 29 2b 31 2c 69 3d 65 2e 76 61 6c ",t-1)+1,i=e.val
0002a3a0: 75 65 2e 73 6c 69 63 65 28 6f 2c 6e 2d 31 29 2c ue.slice(o,n-1),
0002a3b0: 61 3d 69 2e 72 65 70 6c 61 63 65 28 2f 5e 7c 5c a=i.replace(/^|\
0002a3c0: 6e 2f 67 2c 60 24 26 24 7b 64 79 7d 60 29 2c 73 n/g,`$&${dy}`),s
0002a3d0: 3d 61 2e 6c 65 6e 67 74 68 2d 69 2e 6c 65 6e 67 =a.length-i.leng
0002a3e0: 74 68 3b 65 2e 73 65 74 53 65 6c 65 63 74 69 6f th;e.setSelectio
0002a3f0: 6e 52 61 6e 67 65 28 6f 2c 6e 2d 31 29 2c 70 79 nRange(o,n-1),py
0002a400: 2e 69 6e 73 65 72 74 28 65 2c 61 29 2c 65 2e 73 .insert(e,a),e.s
0002a410: 65 74 53 65 6c 65 63 74 69 6f 6e 52 61 6e 67 65 etSelectionRange
0002a420: 28 74 2b 31 2c 6e 2b 73 29 7d 65 6c 73 65 20 70 (t+1,n+s)}else p
0002a430: 79 2e 69 6e 73 65 72 74 28 65 2c 64 79 29 7d 73 y.insert(e,dy)}s
0002a440: 74 61 74 69 63 20 75 6e 69 6e 64 65 6e 74 28 65 tatic unindent(e
0002a450: 29 7b 63 6f 6e 73 74 7b 73 65 6c 65 63 74 69 6f ){const{selectio
0002a460: 6e 53 74 61 72 74 3a 74 2c 73 65 6c 65 63 74 69 nStart:t,selecti
0002a470: 6f 6e 45 6e 64 3a 6e 2c 76 61 6c 75 65 3a 72 7d onEnd:n,value:r}
0002a480: 3d 65 2c 6f 3d 72 2e 6c 61 73 74 49 6e 64 65 78 =e,o=r.lastIndex
0002a490: 4f 66 28 22 5c 6e 22 2c 74 2d 31 29 2b 31 2c 69 Of("\n",t-1)+1,i
0002a4a0: 3d 70 79 2e 66 69 6e 64 4c 69 6e 65 45 6e 64 28 =py.findLineEnd(
0002a4b0: 72 2c 6e 29 2c 61 3d 65 2e 76 61 6c 75 65 2e 73 r,n),a=e.value.s
0002a4c0: 6c 69 63 65 28 6f 2c 69 29 2c 73 3d 61 2e 72 65 lice(o,i),s=a.re
0002a4d0: 70 6c 61 63 65 28 2f 28 5e 7c 5c 6e 29 28 5c 74 place(/(^|\n)(\t
0002a4e0: 7c 20 7b 31 2c 32 7d 29 2f 67 2c 22 24 31 22 29 | {1,2})/g,"$1")
0002a4f0: 2c 6c 3d 61 2e 6c 65 6e 67 74 68 2d 73 2e 6c 65 ,l=a.length-s.le
0002a500: 6e 67 74 68 3b 65 2e 73 65 74 53 65 6c 65 63 74 ngth;e.setSelect
0002a510: 69 6f 6e 52 61 6e 67 65 28 6f 2c 69 29 2c 70 79 ionRange(o,i),py
0002a520: 2e 69 6e 73 65 72 74 28 65 2c 73 29 3b 63 6f 6e .insert(e,s);con
0002a530: 73 74 20 63 3d 2f 5c 74 7c 20 7b 31 2c 32 7d 2f st c=/\t| {1,2}/
0002a540: 2e 65 78 65 63 28 72 2e 73 6c 69 63 65 28 6f 2c .exec(r.slice(o,
0002a550: 74 29 29 2c 75 3d 63 3f 63 5b 30 5d 2e 6c 65 6e t)),u=c?c[0].len
0002a560: 67 74 68 3a 30 2c 64 3d 74 2d 75 3b 65 2e 73 65 gth:0,d=t-u;e.se
0002a570: 74 53 65 6c 65 63 74 69 6f 6e 52 61 6e 67 65 28 tSelectionRange(
0002a580: 74 2d 75 2c 4d 61 74 68 2e 6d 61 78 28 64 2c 6e t-u,Math.max(d,n
0002a590: 2d 6c 29 29 7d 73 74 61 74 69 63 20 69 6e 64 65 -l))}static inde
0002a5a0: 6e 74 43 45 28 65 29 7b 63 6f 6e 73 74 20 74 3d ntCE(e){const t=
0002a5b0: 77 69 6e 64 6f 77 2e 67 65 74 53 65 6c 65 63 74 window.getSelect
0002a5c0: 69 6f 6e 28 29 2c 6e 3d 65 2e 69 6e 6e 65 72 54 ion(),n=e.innerT
0002a5d0: 65 78 74 2c 72 3d 66 79 28 65 29 3f 3f 30 2c 6f ext,r=fy(e)??0,o
0002a5e0: 3d 66 79 28 65 29 3f 3f 30 2c 69 3d 6e 2e 73 6c =fy(e)??0,i=n.sl
0002a5f0: 69 63 65 28 72 2c 6f 29 2c 61 3d 2f 5c 6e 2f 67 ice(r,o),a=/\n/g
0002a600: 2e 65 78 65 63 28 69 29 3f 2e 6c 65 6e 67 74 68 .exec(i)?.length
0002a610: 3b 69 66 28 61 26 26 61 3e 30 29 7b 63 6f 6e 73 ;if(a&&a>0){cons
0002a620: 74 20 69 3d 6e 2e 6c 61 73 74 49 6e 64 65 78 4f t i=n.lastIndexO
0002a630: 66 28 22 5c 6e 22 2c 72 2d 31 29 2b 31 2c 61 3d f("\n",r-1)+1,a=
0002a640: 6e 2e 73 6c 69 63 65 28 69 2c 6f 2d 31 29 2c 73 n.slice(i,o-1),s
0002a650: 3d 61 2e 72 65 70 6c 61 63 65 28 2f 5e 7c 5c 6e =a.replace(/^|\n
0002a660: 2f 67 2c 60 24 26 24 7b 64 79 7d 60 29 2e 6c 65 /g,`$&${dy}`).le
0002a670: 6e 67 74 68 2d 61 2e 6c 65 6e 67 74 68 3b 74 26 ngth-a.length;t&
0002a680: 26 74 2e 73 65 74 42 61 73 65 41 6e 64 45 78 74 &t.setBaseAndExt
0002a690: 65 6e 74 28 65 2c 72 2b 31 2c 65 2c 6f 2b 73 29 ent(e,r+1,e,o+s)
0002a6a0: 7d 65 6c 73 65 7b 63 6f 6e 73 74 20 74 3d 77 69 }else{const t=wi
0002a6b0: 6e 64 6f 77 2e 67 65 74 53 65 6c 65 63 74 69 6f ndow.getSelectio
0002a6c0: 6e 28 29 3b 65 2e 69 6e 6e 65 72 54 65 78 74 3d n();e.innerText=
0002a6d0: 6e 2e 73 6c 69 63 65 28 30 2c 72 29 2b 64 79 2b n.slice(0,r)+dy+
0002a6e0: 6e 2e 73 6c 69 63 65 28 72 29 2c 74 3f 2e 73 65 n.slice(r),t?.se
0002a6f0: 74 42 61 73 65 41 6e 64 45 78 74 65 6e 74 28 65 tBaseAndExtent(e
0002a700: 2c 72 2b 31 2c 65 2c 72 2b 32 29 7d 7d 73 74 61 ,r+1,e,r+2)}}sta
0002a710: 74 69 63 20 75 6e 69 6e 64 65 6e 74 43 45 28 65 tic unindentCE(e
0002a720: 29 7b 63 6f 6e 73 74 20 74 3d 77 69 6e 64 6f 77 ){const t=window
0002a730: 2e 67 65 74 53 65 6c 65 63 74 69 6f 6e 28 29 2c .getSelection(),
0002a740: 6e 3d 65 2e 69 6e 6e 65 72 54 65 78 74 2c 72 3d n=e.innerText,r=
0002a750: 66 79 28 65 29 3f 3f 30 2c 6f 3d 66 79 28 65 29 fy(e)??0,o=fy(e)
0002a760: 3f 3f 30 2c 69 3d 6e 2e 6c 61 73 74 49 6e 64 65 ??0,i=n.lastInde
0002a770: 78 4f 66 28 22 5c 6e 22 2c 72 2d 31 29 2b 31 2c xOf("\n",r-1)+1,
0002a780: 61 3d 70 79 2e 66 69 6e 64 4c 69 6e 65 45 6e 64 a=py.findLineEnd
0002a790: 28 6e 2c 6f 29 2c 73 3d 6e 2e 73 6c 69 63 65 28 (n,o),s=n.slice(
0002a7a0: 69 2c 61 29 2c 6c 3d 73 2e 72 65 70 6c 61 63 65 i,a),l=s.replace
0002a7b0: 28 2f 28 5e 7c 5c 6e 29 28 5c 74 7c 20 7b 31 2c (/(^|\n)(\t| {1,
0002a7c0: 32 7d 29 2f 67 2c 22 24 31 22 29 2c 63 3d 73 2e 2})/g,"$1"),c=s.
0002a7d0: 6c 65 6e 67 74 68 2d 6c 2e 6c 65 6e 67 74 68 3b length-l.length;
0002a7e0: 69 66 28 74 29 7b 74 2e 73 65 74 42 61 73 65 41 if(t){t.setBaseA
0002a7f0: 6e 64 45 78 74 65 6e 74 28 65 2c 69 2c 65 2c 61 ndExtent(e,i,e,a
0002a800: 29 3b 63 6f 6e 73 74 20 73 3d 2f 5c 74 7c 20 7b );const s=/\t| {
0002a810: 31 2c 32 7d 2f 2e 65 78 65 63 28 6e 2e 73 6c 69 1,2}/.exec(n.sli
0002a820: 63 65 28 69 2c 72 29 29 2c 6c 3d 73 3f 73 5b 30 ce(i,r)),l=s?s[0
0002a830: 5d 2e 6c 65 6e 67 74 68 3a 30 2c 75 3d 72 2d 6c ].length:0,u=r-l
0002a840: 3b 74 2e 73 65 74 42 61 73 65 41 6e 64 45 78 74 ;t.setBaseAndExt
0002a850: 65 6e 74 28 65 2c 72 2d 6c 2c 65 2c 4d 61 74 68 ent(e,r-l,e,Math
0002a860: 2e 6d 61 78 28 75 2c 6f 2d 63 29 29 7d 7d 73 74 .max(u,o-c))}}st
0002a870: 61 74 69 63 20 66 69 78 4e 65 77 4c 69 6e 65 73 atic fixNewLines
0002a880: 3d 2f 5c 72 3f 5c 6e 7c 5c 72 2f 67 3b 73 74 61 =/\r?\n|\r/g;sta
0002a890: 74 69 63 20 6e 6f 72 6d 61 6c 69 7a 65 54 65 78 tic normalizeTex
0002a8a0: 74 28 65 29 7b 72 65 74 75 72 6e 20 65 2e 72 65 t(e){return e.re
0002a8b0: 70 6c 61 63 65 28 70 79 2e 66 69 78 4e 65 77 4c place(py.fixNewL
0002a8c0: 69 6e 65 73 2c 22 5c 6e 22 29 7d 73 74 61 74 69 ines,"\n")}stati
0002a8d0: 63 20 6e 6f 72 6d 61 6c 69 7a 65 54 65 78 74 46 c normalizeTextF
0002a8e0: 6f 72 44 6f 6d 28 65 29 7b 72 65 74 75 72 6e 20 orDom(e){return
0002a8f0: 65 2e 72 65 70 6c 61 63 65 28 70 79 2e 66 69 78 e.replace(py.fix
0002a900: 4e 65 77 4c 69 6e 65 73 2c 22 5c 6e 22 29 2e 73 NewLines,"\n").s
0002a910: 70 6c 69 74 28 22 5c 6e 22 29 2e 6d 61 70 28 28 plit("\n").map((
0002a920: 65 3d 3e 65 7c 7c 22 20 22 29 29 2e 6a 6f 69 6e e=>e||" ")).join
0002a930: 28 22 5c 6e 22 29 7d 7d 66 75 6e 63 74 69 6f 6e ("\n")}}function
0002a940: 20 66 79 28 65 29 7b 69 66 28 76 6f 69 64 20 30 fy(e){if(void 0
0002a950: 3d 3d 3d 77 69 6e 64 6f 77 2e 67 65 74 53 65 6c ===window.getSel
0002a960: 65 63 74 69 6f 6e 29 72 65 74 75 72 6e 3b 63 6f ection)return;co
0002a970: 6e 73 74 20 74 3d 77 69 6e 64 6f 77 2e 67 65 74 nst t=window.get
0002a980: 53 65 6c 65 63 74 69 6f 6e 28 29 3b 69 66 28 21 Selection();if(!
0002a990: 74 29 72 65 74 75 72 6e 3b 6c 65 74 20 6e 3d 30 t)return;let n=0
0002a9a0: 3b 69 66 28 30 21 3d 3d 74 2e 72 61 6e 67 65 43 ;if(0!==t.rangeC
0002a9b0: 6f 75 6e 74 29 7b 63 6f 6e 73 74 20 72 3d 74 2e ount){const r=t.
0002a9c0: 67 65 74 52 61 6e 67 65 41 74 28 30 29 2c 6f 3d getRangeAt(0),o=
0002a9d0: 72 2e 63 6c 6f 6e 65 52 61 6e 67 65 28 29 3b 6f r.cloneRange();o
0002a9e0: 2e 73 65 6c 65 63 74 4e 6f 64 65 43 6f 6e 74 65 .selectNodeConte
0002a9f0: 6e 74 73 28 65 29 2c 6f 2e 73 65 74 45 6e 64 28 nts(e),o.setEnd(
0002aa00: 72 2e 65 6e 64 43 6f 6e 74 61 69 6e 65 72 2c 72 r.endContainer,r
0002aa10: 2e 65 6e 64 4f 66 66 73 65 74 29 2c 6e 3d 6f 2e .endOffset),n=o.
0002aa20: 74 6f 53 74 72 69 6e 67 28 29 2e 6c 65 6e 67 74 toString().lengt
0002aa30: 68 7d 72 65 74 75 72 6e 20 6e 7d 63 6f 6e 73 74 h}return n}const
0002aa40: 20 68 79 3d 2f 5b 5c 75 30 35 39 30 2d 5c 75 30 hy=/[\u0590-\u0
0002aa50: 35 46 46 5c 75 30 36 30 30 2d 5c 75 30 36 46 46 5FF\u0600-\u06FF
0002aa60: 5c 75 30 37 35 30 2d 5c 75 30 37 37 46 5c 75 30 \u0750-\u077F\u0
0002aa70: 38 41 30 2d 5c 75 30 38 46 46 5c 75 46 42 35 30 8A0-\u08FF\uFB50
0002aa80: 2d 5c 75 46 44 46 46 5c 75 46 45 37 30 2d 5c 75 -\uFDFF\uFE70-\u
0002aa90: 46 45 46 46 5d 2f 3b 66 75 6e 63 74 69 6f 6e 20 FEFF]/;function
0002aaa0: 6d 79 28 65 29 7b 72 65 74 75 72 6e 20 68 79 2e my(e){return hy.
0002aab0: 74 65 73 74 28 65 29 7d 66 75 6e 63 74 69 6f 6e test(e)}function
0002aac0: 20 67 79 28 65 29 7b 72 65 74 75 72 6e 20 66 75 gy(e){return fu
0002aad0: 6e 63 74 69 6f 6e 28 65 29 7b 72 65 74 75 72 6e nction(e){return
0002aae0: 20 65 2e 72 65 70 6c 61 63 65 28 2f 5b 20 5c 74 e.replace(/[ \t
0002aaf0: 5d 2b 24 2f 67 6d 2c 22 22 29 2e 72 65 70 6c 61 ]+$/gm,"").repla
0002ab00: 63 65 28 2f 5c 6e 2b 24 2f 2c 22 22 29 7d 28 66 ce(/\n+$/,"")}(f
0002ab10: 75 6e 63 74 69 6f 6e 28 65 29 7b 63 6f 6e 73 74 unction(e){const
0002ab20: 20 74 3d 65 2e 73 70 6c 69 74 28 22 5c 6e 22 29 t=e.split("\n")
0002ab30: 3b 66 6f 72 28 3b 74 5b 30 5d 26 26 30 3d 3d 3d ;for(;t[0]&&0===
0002ab40: 74 5b 30 5d 2e 74 72 69 6d 28 29 2e 6c 65 6e 67 t[0].trim().leng
0002ab50: 74 68 3b 29 74 2e 73 68 69 66 74 28 29 3b 6c 65 th;)t.shift();le
0002ab60: 74 20 6e 3d 31 2f 30 3b 66 6f 72 28 63 6f 6e 73 t n=1/0;for(cons
0002ab70: 74 20 65 20 6f 66 20 74 29 69 66 28 65 2e 74 72 t e of t)if(e.tr
0002ab80: 69 6d 28 29 2e 6c 65 6e 67 74 68 3e 30 29 7b 63 im().length>0){c
0002ab90: 6f 6e 73 74 20 74 3d 65 2e 6c 65 6e 67 74 68 2d onst t=e.length-
0002aba0: 65 2e 74 72 69 6d 53 74 61 72 74 28 29 2e 6c 65 e.trimStart().le
0002abb0: 6e 67 74 68 3b 6e 3d 4d 61 74 68 2e 6d 69 6e 28 ngth;n=Math.min(
0002abc0: 6e 2c 74 29 7d 72 65 74 75 72 6e 20 74 2e 6d 61 n,t)}return t.ma
0002abd0: 70 28 28 65 3d 3e 65 2e 73 6c 69 63 65 28 6e 29 p((e=>e.slice(n)
0002abe0: 29 29 2e 6a 6f 69 6e 28 22 5c 6e 22 29 7d 28 66 )).join("\n")}(f
0002abf0: 75 6e 63 74 69 6f 6e 28 65 29 7b 72 65 74 75 72 unction(e){retur
0002ac00: 6e 20 65 2e 72 65 70 6c 61 63 65 28 2f 5c 74 2f n e.replace(/\t/
0002ac10: 67 2c 64 79 29 7d 28 65 29 29 29 7d 66 75 6e 63 g,dy)}(e)))}func
0002ac20: 74 69 6f 6e 20 62 79 28 65 2c 7b 6d 61 78 49 6d tion by(e,{maxIm
0002ac30: 61 67 65 44 69 6d 65 6e 73 69 6f 6e 3a 74 2c 6d ageDimension:t,m
0002ac40: 61 78 41 73 73 65 74 53 69 7a 65 3a 6e 2c 61 63 axAssetSize:n,ac
0002ac50: 63 65 70 74 65 64 49 6d 61 67 65 4d 69 6d 65 54 ceptedImageMimeT
0002ac60: 79 70 65 73 3a 72 2c 61 63 63 65 70 74 65 64 56 ypes:r,acceptedV
0002ac70: 69 64 65 6f 4d 69 6d 65 54 79 70 65 73 3a 6f 7d ideoMimeTypes:o}
0002ac80: 2c 7b 74 6f 61 73 74 73 3a 69 2c 6d 73 67 3a 61 ,{toasts:i,msg:a
0002ac90: 7d 2c 73 29 7b 65 2e 72 65 67 69 73 74 65 72 45 },s){e.registerE
0002aca0: 78 74 65 72 6e 61 6c 41 73 73 65 74 48 61 6e 64 xternalAssetHand
0002acb0: 6c 65 72 28 22 66 69 6c 65 22 2c 28 61 73 79 6e ler("file",(asyn
0002acc0: 63 28 7b 66 69 6c 65 3a 65 7d 29 3d 3e 7b 63 6f c({file:e})=>{co
0002acd0: 6e 73 74 20 69 3d 65 2e 6e 61 6d 65 3b 6c 65 74 nst i=e.name;let
0002ace0: 20 61 3d 65 3b 63 6f 6e 73 74 20 6c 3d 72 2e 69 a=e;const l=r.i
0002acf0: 6e 63 6c 75 64 65 73 28 61 2e 74 79 70 65 29 2c ncludes(a.type),
0002ad00: 63 3d 6f 2e 69 6e 63 6c 75 64 65 73 28 61 2e 74 c=o.includes(a.t
0002ad10: 79 70 65 29 3b 57 72 28 6c 7c 7c 63 2c 60 46 69 ype);Wr(l||c,`Fi
0002ad20: 6c 65 20 74 79 70 65 20 6e 6f 74 20 61 6c 6c 6f le type not allo
0002ad30: 77 65 64 3a 20 24 7b 61 2e 74 79 70 65 7d 60 29 wed: ${a.type}`)
0002ad40: 2c 57 72 28 61 2e 73 69 7a 65 3c 3d 6e 2c 60 46 ,Wr(a.size<=n,`F
0002ad50: 69 6c 65 20 73 69 7a 65 20 74 6f 6f 20 62 69 67 ile size too big
0002ad60: 3a 20 24 7b 28 61 2e 73 69 7a 65 2f 31 30 32 34 : ${(a.size/1024
0002ad70: 29 2e 74 6f 46 69 78 65 64 28 29 7d 6b 62 20 3e ).toFixed()}kb >
0002ad80: 20 24 7b 28 6e 2f 31 30 32 34 29 2e 74 6f 46 69 ${(n/1024).toFi
0002ad90: 78 65 64 28 29 7d 6b 62 60 29 2c 22 76 69 64 65 xed()}kb`),"vide
0002ada0: 6f 2f 71 75 69 63 6b 74 69 6d 65 22 3d 3d 3d 61 o/quicktime"===a
0002adb0: 2e 74 79 70 65 26 26 28 61 3d 6e 65 77 20 42 6c .type&&(a=new Bl
0002adc0: 6f 62 28 5b 61 5d 2c 7b 74 79 70 65 3a 22 76 69 ob([a],{type:"vi
0002add0: 64 65 6f 2f 6d 70 34 22 7d 29 29 3b 6c 65 74 20 deo/mp4"}));let
0002ade0: 75 3d 6c 3f 61 77 61 69 74 20 66 6f 2e 67 65 74 u=l?await fo.get
0002adf0: 49 6d 61 67 65 53 69 7a 65 28 61 29 3a 61 77 61 ImageSize(a):awa
0002ae00: 69 74 20 66 6f 2e 67 65 74 56 69 64 65 6f 53 69 it fo.getVideoSi
0002ae10: 7a 65 28 61 29 3b 63 6f 6e 73 74 20 64 3d 61 77 ze(a);const d=aw
0002ae20: 61 69 74 20 66 6f 2e 69 73 41 6e 69 6d 61 74 65 ait fo.isAnimate
0002ae30: 64 28 61 29 7c 7c 63 2c 70 3d 61 77 61 69 74 20 d(a)||c,p=await
0002ae40: 66 75 6e 63 74 69 6f 6e 28 65 29 7b 63 6f 6e 73 function(e){cons
0002ae50: 74 20 74 3d 6e 65 77 20 44 61 74 61 56 69 65 77 t t=new DataView
0002ae60: 28 65 29 3b 6c 65 74 20 6e 3d 30 3b 66 6f 72 28 (e);let n=0;for(
0002ae70: 6c 65 74 20 65 3d 30 3b 65 3c 74 2e 62 79 74 65 let e=0;e<t.byte
0002ae80: 4c 65 6e 67 74 68 3b 65 2b 2b 29 6e 3d 28 6e 3c Length;e++)n=(n<
0002ae90: 3c 35 29 2d 6e 2b 74 2e 67 65 74 55 69 6e 74 38 <5)-n+t.getUint8
0002aea0: 28 65 29 2c 6e 7c 3d 30 3b 72 65 74 75 72 6e 20 (e),n|=0;return
0002aeb0: 6e 2b 22 22 7d 28 61 77 61 69 74 20 61 2e 61 72 n+""}(await a.ar
0002aec0: 72 61 79 42 75 66 66 65 72 28 29 29 3b 69 66 28 rayBuffer());if(
0002aed0: 69 73 46 69 6e 69 74 65 28 74 29 29 7b 63 6f 6e isFinite(t)){con
0002aee0: 73 74 20 65 3d 66 75 6e 63 74 69 6f 6e 28 65 2c st e=function(e,
0002aef0: 74 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e 77 2f 74 t){const n=e.w/t
0002af00: 2e 77 2c 72 3d 65 2e 68 2f 74 2e 68 3b 72 65 74 .w,r=e.h/t.h;ret
0002af10: 75 72 6e 20 6e 3c 3d 31 26 26 72 3c 3d 31 3f 65 urn n<=1&&r<=1?e
0002af20: 3a 6e 3e 72 3f 7b 77 3a 65 2e 77 2f 6e 2c 68 3a :n>r?{w:e.w/n,h:
0002af30: 65 2e 68 2f 6e 7d 3a 7b 77 3a 65 2e 77 2f 72 2c e.h/n}:{w:e.w/r,
0002af40: 68 3a 65 2e 68 2f 72 7d 7d 28 75 2c 7b 77 3a 74 h:e.h/r}}(u,{w:t
0002af50: 2c 68 3a 74 7d 29 3b 75 21 3d 3d 65 26 26 66 6f ,h:t});u!==e&&fo
0002af60: 2e 69 73 53 74 61 74 69 63 49 6d 61 67 65 54 79 .isStaticImageTy
0002af70: 70 65 28 61 2e 74 79 70 65 29 26 26 28 75 3d 65 pe(a.type)&&(u=e
0002af80: 29 7d 63 6f 6e 73 74 20 66 3d 5a 6c 2e 63 72 65 )}const f=Zl.cre
0002af90: 61 74 65 49 64 28 70 29 2c 68 3d 7b 69 64 3a 66 ateId(p),h={id:f
0002afa0: 2c 74 79 70 65 3a 6c 3f 22 69 6d 61 67 65 22 3a ,type:l?"image":
0002afb0: 22 76 69 64 65 6f 22 2c 74 79 70 65 4e 61 6d 65 "video",typeName
0002afc0: 3a 22 61 73 73 65 74 22 2c 70 72 6f 70 73 3a 7b :"asset",props:{
0002afd0: 6e 61 6d 65 3a 69 2c 73 72 63 3a 22 22 2c 77 3a name:i,src:"",w:
0002afe0: 75 2e 77 2c 68 3a 75 2e 68 2c 66 69 6c 65 53 69 u.w,h:u.h,fileSi
0002aff0: 7a 65 3a 61 2e 73 69 7a 65 2c 6d 69 6d 65 54 79 ze:a.size,mimeTy
0002b000: 70 65 3a 61 2e 74 79 70 65 2c 69 73 41 6e 69 6d pe:a.type,isAnim
0002b010: 61 74 65 64 3a 64 7d 7d 3b 72 65 74 75 72 6e 20 ated:d}};return
0002b020: 73 3f 28 68 2e 70 72 6f 70 73 2e 73 72 63 3d 66 s?(h.props.src=f
0002b030: 2c 61 77 61 69 74 20 61 73 79 6e 63 20 66 75 6e ,await async fun
0002b040: 63 74 69 6f 6e 28 7b 70 65 72 73 69 73 74 65 6e ction({persisten
0002b050: 63 65 4b 65 79 3a 65 2c 61 73 73 65 74 49 64 3a ceKey:e,assetId:
0002b060: 74 2c 62 6c 6f 62 3a 6e 7d 29 7b 63 6f 6e 73 74 t,blob:n}){const
0002b070: 20 72 3d 47 67 2b 65 3b 61 77 61 69 74 20 56 67 r=Gg+e;await Vg
0002b080: 28 72 2c 28 61 73 79 6e 63 20 65 3d 3e 7b 63 6f (r,(async e=>{co
0002b090: 6e 73 74 20 72 3d 65 2e 74 72 61 6e 73 61 63 74 nst r=e.transact
0002b0a0: 69 6f 6e 28 5b 48 67 2e 41 73 73 65 74 73 5d 2c ion([Hg.Assets],
0002b0b0: 22 72 65 61 64 77 72 69 74 65 22 29 2c 6f 3d 72 "readwrite"),o=r
0002b0c0: 2e 6f 62 6a 65 63 74 53 74 6f 72 65 28 48 67 2e .objectStore(Hg.
0002b0d0: 41 73 73 65 74 73 29 3b 61 77 61 69 74 20 6f 2e Assets);await o.
0002b0e0: 70 75 74 28 6e 2c 74 29 2c 61 77 61 69 74 20 72 put(n,t),await r
0002b0f0: 2e 64 6f 6e 65 7d 29 29 7d 28 7b 70 65 72 73 69 .done}))}({persi
0002b100: 73 74 65 6e 63 65 4b 65 79 3a 73 2c 61 73 73 65 stenceKey:s,asse
0002b110: 74 49 64 3a 66 2c 62 6c 6f 62 3a 61 7d 29 29 3a tId:f,blob:a})):
0002b120: 68 2e 70 72 6f 70 73 2e 73 72 63 3d 61 77 61 69 h.props.src=awai
0002b130: 74 20 24 72 2e 62 6c 6f 62 54 6f 44 61 74 61 55 t $r.blobToDataU
0002b140: 72 6c 28 61 29 2c 5a 6c 2e 63 72 65 61 74 65 28 rl(a),Zl.create(
0002b150: 68 29 7d 29 29 2c 65 2e 72 65 67 69 73 74 65 72 h)})),e.register
0002b160: 45 78 74 65 72 6e 61 6c 41 73 73 65 74 48 61 6e ExternalAssetHan
0002b170: 64 6c 65 72 28 22 75 72 6c 22 2c 28 61 73 79 6e dler("url",(asyn
0002b180: 63 28 7b 75 72 6c 3a 65 7d 29 3d 3e 7b 6c 65 74 c({url:e})=>{let
0002b190: 20 74 3b 74 72 79 7b 63 6f 6e 73 74 20 6e 3d 61 t;try{const n=a
0002b1a0: 77 61 69 74 20 51 72 28 65 2c 7b 6d 65 74 68 6f wait Qr(e,{metho
0002b1b0: 64 3a 22 47 45 54 22 2c 6d 6f 64 65 3a 22 6e 6f d:"GET",mode:"no
0002b1c0: 2d 63 6f 72 73 22 7d 29 2c 72 3d 61 77 61 69 74 -cors"}),r=await
0002b1d0: 20 6e 2e 74 65 78 74 28 29 2c 6f 3d 28 6e 65 77 n.text(),o=(new
0002b1e0: 20 44 4f 4d 50 61 72 73 65 72 29 2e 70 61 72 73 DOMParser).pars
0002b1f0: 65 46 72 6f 6d 53 74 72 69 6e 67 28 72 2c 22 74 eFromString(r,"t
0002b200: 65 78 74 2f 68 74 6d 6c 22 29 3b 74 3d 7b 69 6d ext/html");t={im
0002b210: 61 67 65 3a 6f 2e 68 65 61 64 2e 71 75 65 72 79 age:o.head.query
0002b220: 53 65 6c 65 63 74 6f 72 28 27 6d 65 74 61 5b 70 Selector('meta[p
0002b230: 72 6f 70 65 72 74 79 3d 22 6f 67 3a 69 6d 61 67 roperty="og:imag
0002b240: 65 22 5d 27 29 3f 2e 67 65 74 41 74 74 72 69 62 e"]')?.getAttrib
0002b250: 75 74 65 28 22 63 6f 6e 74 65 6e 74 22 29 3f 3f ute("content")??
0002b260: 22 22 2c 66 61 76 69 63 6f 6e 3a 6f 2e 68 65 61 "",favicon:o.hea
0002b270: 64 2e 71 75 65 72 79 53 65 6c 65 63 74 6f 72 28 d.querySelector(
0002b280: 27 6c 69 6e 6b 5b 72 65 6c 3d 22 61 70 70 6c 65 'link[rel="apple
0002b290: 2d 74 6f 75 63 68 2d 69 63 6f 6e 22 5d 27 29 3f -touch-icon"]')?
0002b2a0: 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 22 68 .getAttribute("h
0002b2b0: 72 65 66 22 29 3f 3f 6f 2e 68 65 61 64 2e 71 75 ref")??o.head.qu
0002b2c0: 65 72 79 53 65 6c 65 63 74 6f 72 28 27 6c 69 6e erySelector('lin
0002b2d0: 6b 5b 72 65 6c 3d 22 69 63 6f 6e 22 5d 27 29 3f k[rel="icon"]')?
0002b2e0: 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 22 68 .getAttribute("h
0002b2f0: 72 65 66 22 29 3f 3f 22 22 2c 74 69 74 6c 65 3a ref")??"",title:
0002b300: 6f 2e 68 65 61 64 2e 71 75 65 72 79 53 65 6c 65 o.head.querySele
0002b310: 63 74 6f 72 28 27 6d 65 74 61 5b 70 72 6f 70 65 ctor('meta[prope
0002b320: 72 74 79 3d 22 6f 67 3a 74 69 74 6c 65 22 5d 27 rty="og:title"]'
0002b330: 29 3f 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 )?.getAttribute(
0002b340: 22 63 6f 6e 74 65 6e 74 22 29 3f 3f 65 2c 64 65 "content")??e,de
0002b350: 73 63 72 69 70 74 69 6f 6e 3a 6f 2e 68 65 61 64 scription:o.head
0002b360: 2e 71 75 65 72 79 53 65 6c 65 63 74 6f 72 28 27 .querySelector('
0002b370: 6d 65 74 61 5b 70 72 6f 70 65 72 74 79 3d 22 6f meta[property="o
0002b380: 67 3a 64 65 73 63 72 69 70 74 69 6f 6e 22 5d 27 g:description"]'
0002b390: 29 3f 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 )?.getAttribute(
0002b3a0: 22 63 6f 6e 74 65 6e 74 22 29 3f 3f 22 22 7d 2c "content")??""},
0002b3b0: 74 2e 69 6d 61 67 65 2e 73 74 61 72 74 73 57 69 t.image.startsWi
0002b3c0: 74 68 28 22 2f 22 29 26 26 28 74 2e 69 6d 61 67 th("/")&&(t.imag
0002b3d0: 65 3d 6e 65 77 20 55 52 4c 28 74 2e 69 6d 61 67 e=new URL(t.imag
0002b3e0: 65 2c 65 29 2e 68 72 65 66 29 2c 74 2e 66 61 76 e,e).href),t.fav
0002b3f0: 69 63 6f 6e 2e 73 74 61 72 74 73 57 69 74 68 28 icon.startsWith(
0002b400: 22 2f 22 29 26 26 28 74 2e 66 61 76 69 63 6f 6e "/")&&(t.favicon
0002b410: 3d 6e 65 77 20 55 52 4c 28 74 2e 66 61 76 69 63 =new URL(t.favic
0002b420: 6f 6e 2c 65 29 2e 68 72 65 66 29 7d 63 61 74 63 on,e).href)}catc
0002b430: 68 28 65 29 7b 63 6f 6e 73 6f 6c 65 2e 65 72 72 h(e){console.err
0002b440: 6f 72 28 65 29 2c 69 2e 61 64 64 54 6f 61 73 74 or(e),i.addToast
0002b450: 28 7b 74 69 74 6c 65 3a 61 28 22 61 73 73 65 74 ({title:a("asset
0002b460: 73 2e 75 72 6c 2e 66 61 69 6c 65 64 22 29 2c 73 s.url.failed"),s
0002b470: 65 76 65 72 69 74 79 3a 22 65 72 72 6f 72 22 7d everity:"error"}
0002b480: 29 2c 74 3d 7b 69 6d 61 67 65 3a 22 22 2c 66 61 ),t={image:"",fa
0002b490: 76 69 63 6f 6e 3a 22 22 2c 74 69 74 6c 65 3a 22 vicon:"",title:"
0002b4a0: 22 2c 64 65 73 63 72 69 70 74 69 6f 6e 3a 22 22 ",description:""
0002b4b0: 7d 7d 72 65 74 75 72 6e 7b 69 64 3a 5a 6c 2e 63 }}return{id:Zl.c
0002b4c0: 72 65 61 74 65 49 64 28 65 6f 28 65 29 29 2c 74 reateId(eo(e)),t
0002b4d0: 79 70 65 4e 61 6d 65 3a 22 61 73 73 65 74 22 2c ypeName:"asset",
0002b4e0: 74 79 70 65 3a 22 62 6f 6f 6b 6d 61 72 6b 22 2c type:"bookmark",
0002b4f0: 70 72 6f 70 73 3a 7b 73 72 63 3a 65 2c 64 65 73 props:{src:e,des
0002b500: 63 72 69 70 74 69 6f 6e 3a 74 2e 64 65 73 63 72 cription:t.descr
0002b510: 69 70 74 69 6f 6e 2c 69 6d 61 67 65 3a 74 2e 69 iption,image:t.i
0002b520: 6d 61 67 65 2c 66 61 76 69 63 6f 6e 3a 74 2e 66 mage,favicon:t.f
0002b530: 61 76 69 63 6f 6e 2c 74 69 74 6c 65 3a 74 2e 74 avicon,title:t.t
0002b540: 69 74 6c 65 7d 2c 6d 65 74 61 3a 7b 7d 7d 7d 29 itle},meta:{}}})
0002b550: 29 2c 65 2e 72 65 67 69 73 74 65 72 45 78 74 65 ),e.registerExte
0002b560: 72 6e 61 6c 43 6f 6e 74 65 6e 74 48 61 6e 64 6c rnalContentHandl
0002b570: 65 72 28 22 73 76 67 2d 74 65 78 74 22 2c 28 61 er("svg-text",(a
0002b580: 73 79 6e 63 28 7b 70 6f 69 6e 74 3a 74 2c 74 65 sync({point:t,te
0002b590: 78 74 3a 6e 7d 29 3d 3e 7b 63 6f 6e 73 74 20 72 xt:n})=>{const r
0002b5a0: 3d 74 3f 3f 28 65 2e 69 6e 70 75 74 73 2e 73 68 =t??(e.inputs.sh
0002b5b0: 69 66 74 4b 65 79 3f 65 2e 69 6e 70 75 74 73 2e iftKey?e.inputs.
0002b5c0: 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 currentPagePoint
0002b5d0: 3a 65 2e 67 65 74 56 69 65 77 70 6f 72 74 50 61 :e.getViewportPa
0002b5e0: 67 65 42 6f 75 6e 64 73 28 29 2e 63 65 6e 74 65 geBounds().cente
0002b5f0: 72 29 2c 6f 3d 28 6e 65 77 20 44 4f 4d 50 61 72 r),o=(new DOMPar
0002b600: 73 65 72 29 2e 70 61 72 73 65 46 72 6f 6d 53 74 ser).parseFromSt
0002b610: 72 69 6e 67 28 6e 2c 22 69 6d 61 67 65 2f 73 76 ring(n,"image/sv
0002b620: 67 2b 78 6d 6c 22 29 2e 71 75 65 72 79 53 65 6c g+xml").querySel
0002b630: 65 63 74 6f 72 28 22 73 76 67 22 29 3b 69 66 28 ector("svg");if(
0002b640: 21 6f 29 74 68 72 6f 77 20 6e 65 77 20 45 72 72 !o)throw new Err
0002b650: 6f 72 28 22 4e 6f 20 3c 73 76 67 2f 3e 20 65 6c or("No <svg/> el
0002b660: 65 6d 65 6e 74 20 70 72 65 73 65 6e 74 22 29 3b ement present");
0002b670: 6c 65 74 20 69 3d 70 61 72 73 65 46 6c 6f 61 74 let i=parseFloat
0002b680: 28 6f 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 (o.getAttribute(
0002b690: 22 77 69 64 74 68 22 29 7c 7c 22 30 22 29 2c 61 "width")||"0"),a
0002b6a0: 3d 70 61 72 73 65 46 6c 6f 61 74 28 6f 2e 67 65 =parseFloat(o.ge
0002b6b0: 74 41 74 74 72 69 62 75 74 65 28 22 68 65 69 67 tAttribute("heig
0002b6c0: 68 74 22 29 7c 7c 22 30 22 29 3b 69 66 28 21 69 ht")||"0");if(!i
0002b6d0: 7c 7c 21 61 29 7b 64 6f 63 75 6d 65 6e 74 2e 62 ||!a){document.b
0002b6e0: 6f 64 79 2e 61 70 70 65 6e 64 43 68 69 6c 64 28 ody.appendChild(
0002b6f0: 6f 29 3b 63 6f 6e 73 74 20 65 3d 6f 2e 67 65 74 o);const e=o.get
0002b700: 42 6f 75 6e 64 69 6e 67 43 6c 69 65 6e 74 52 65 BoundingClientRe
0002b710: 63 74 28 29 3b 64 6f 63 75 6d 65 6e 74 2e 62 6f ct();document.bo
0002b720: 64 79 2e 72 65 6d 6f 76 65 43 68 69 6c 64 28 6f dy.removeChild(o
0002b730: 29 2c 69 3d 65 2e 77 69 64 74 68 2c 61 3d 65 2e ),i=e.width,a=e.
0002b740: 68 65 69 67 68 74 7d 63 6f 6e 73 74 20 73 3d 61 height}const s=a
0002b750: 77 61 69 74 20 65 2e 67 65 74 41 73 73 65 74 46 wait e.getAssetF
0002b760: 6f 72 45 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e orExternalConten
0002b770: 74 28 7b 74 79 70 65 3a 22 66 69 6c 65 22 2c 66 t({type:"file",f
0002b780: 69 6c 65 3a 6e 65 77 20 46 69 6c 65 28 5b 6e 5d ile:new File([n]
0002b790: 2c 22 61 73 73 65 74 2e 73 76 67 22 2c 7b 74 79 ,"asset.svg",{ty
0002b7a0: 70 65 3a 22 69 6d 61 67 65 2f 73 76 67 2b 78 6d pe:"image/svg+xm
0002b7b0: 6c 22 7d 29 7d 29 3b 69 66 28 21 73 29 74 68 72 l"})});if(!s)thr
0002b7c0: 6f 77 20 45 72 72 6f 72 28 22 43 6f 75 6c 64 20 ow Error("Could
0002b7d0: 6e 6f 74 20 63 72 65 61 74 65 20 61 6e 20 61 73 not create an as
0002b7e0: 73 65 74 22 29 3b 79 79 28 65 2c 5b 73 5d 2c 72 set");yy(e,[s],r
0002b7f0: 29 7d 29 29 2c 65 2e 72 65 67 69 73 74 65 72 45 )})),e.registerE
0002b800: 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 48 61 xternalContentHa
0002b810: 6e 64 6c 65 72 28 22 65 6d 62 65 64 22 2c 28 28 ndler("embed",((
0002b820: 7b 70 6f 69 6e 74 3a 74 2c 75 72 6c 3a 6e 2c 65 {point:t,url:n,e
0002b830: 6d 62 65 64 3a 72 7d 29 3d 3e 7b 63 6f 6e 73 74 mbed:r})=>{const
0002b840: 20 6f 3d 74 3f 3f 28 65 2e 69 6e 70 75 74 73 2e o=t??(e.inputs.
0002b850: 73 68 69 66 74 4b 65 79 3f 65 2e 69 6e 70 75 74 shiftKey?e.input
0002b860: 73 2e 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 s.currentPagePoi
0002b870: 6e 74 3a 65 2e 67 65 74 56 69 65 77 70 6f 72 74 nt:e.getViewport
0002b880: 50 61 67 65 42 6f 75 6e 64 73 28 29 2e 63 65 6e PageBounds().cen
0002b890: 74 65 72 29 2c 7b 77 69 64 74 68 3a 69 2c 68 65 ter),{width:i,he
0002b8a0: 69 67 68 74 3a 61 7d 3d 72 2c 73 3d 49 73 28 29 ight:a}=r,s=Is()
0002b8b0: 2c 6c 3d 7b 69 64 3a 73 2c 74 79 70 65 3a 22 65 ,l={id:s,type:"e
0002b8c0: 6d 62 65 64 22 2c 78 3a 6f 2e 78 2d 28 69 7c 7c mbed",x:o.x-(i||
0002b8d0: 34 35 30 29 2f 32 2c 79 3a 6f 2e 79 2d 28 61 7c 450)/2,y:o.y-(a|
0002b8e0: 7c 34 35 30 29 2f 32 2c 70 72 6f 70 73 3a 7b 77 |450)/2,props:{w
0002b8f0: 3a 69 2c 68 3a 61 2c 75 72 6c 3a 6e 7d 7d 3b 65 :i,h:a,url:n}};e
0002b900: 2e 63 72 65 61 74 65 53 68 61 70 65 73 28 5b 6c .createShapes([l
0002b910: 5d 29 2e 73 65 6c 65 63 74 28 73 29 7d 29 29 2c ]).select(s)})),
0002b920: 65 2e 72 65 67 69 73 74 65 72 45 78 74 65 72 6e e.registerExtern
0002b930: 61 6c 43 6f 6e 74 65 6e 74 48 61 6e 64 6c 65 72 alContentHandler
0002b940: 28 22 66 69 6c 65 73 22 2c 28 61 73 79 6e 63 28 ("files",(async(
0002b950: 7b 70 6f 69 6e 74 3a 74 2c 66 69 6c 65 73 3a 73 {point:t,files:s
0002b960: 7d 29 3d 3e 7b 63 6f 6e 73 74 20 6c 3d 74 3f 3f })=>{const l=t??
0002b970: 28 65 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b (e.inputs.shiftK
0002b980: 65 79 3f 65 2e 69 6e 70 75 74 73 2e 63 75 72 72 ey?e.inputs.curr
0002b990: 65 6e 74 50 61 67 65 50 6f 69 6e 74 3a 65 2e 67 entPagePoint:e.g
0002b9a0: 65 74 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f etViewportPageBo
0002b9b0: 75 6e 64 73 28 29 2e 63 65 6e 74 65 72 29 2c 63 unds().center),c
0002b9c0: 3d 6e 65 77 20 73 75 28 6c 2e 78 2c 6c 2e 79 29 =new su(l.x,l.y)
0002b9d0: 2c 75 3d 5b 5d 3b 61 77 61 69 74 20 50 72 6f 6d ,u=[];await Prom
0002b9e0: 69 73 65 2e 61 6c 6c 28 73 2e 6d 61 70 28 28 61 ise.all(s.map((a
0002b9f0: 73 79 6e 63 28 74 2c 73 29 3d 3e 7b 69 66 28 74 sync(t,s)=>{if(t
0002ba00: 2e 73 69 7a 65 3e 6e 29 72 65 74 75 72 6e 20 63 .size>n)return c
0002ba10: 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 46 69 6c onsole.warn(`Fil
0002ba20: 65 20 73 69 7a 65 20 74 6f 6f 20 62 69 67 3a 20 e size too big:
0002ba30: 24 7b 28 74 2e 73 69 7a 65 2f 31 30 32 34 29 2e ${(t.size/1024).
0002ba40: 74 6f 46 69 78 65 64 28 29 7d 6b 62 20 3e 20 24 toFixed()}kb > $
0002ba50: 7b 28 6e 2f 31 30 32 34 29 2e 74 6f 46 69 78 65 {(n/1024).toFixe
0002ba60: 64 28 29 7d 6b 62 60 29 2c 6e 75 6c 6c 3b 69 66 d()}kb`),null;if
0002ba70: 28 21 74 2e 74 79 70 65 29 74 68 72 6f 77 20 6e (!t.type)throw n
0002ba80: 65 77 20 45 72 72 6f 72 28 22 4e 6f 20 6d 69 6d ew Error("No mim
0002ba90: 65 20 74 79 70 65 22 29 3b 69 66 28 21 72 2e 63 e type");if(!r.c
0002baa0: 6f 6e 63 61 74 28 6f 29 2e 69 6e 63 6c 75 64 65 oncat(o).include
0002bab0: 73 28 74 2e 74 79 70 65 29 29 72 65 74 75 72 6e s(t.type))return
0002bac0: 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 24 console.warn(`$
0002bad0: 7b 74 2e 6e 61 6d 65 7d 20 6e 6f 74 20 6c 6f 61 {t.name} not loa
0002bae0: 64 65 64 20 2d 20 45 78 74 65 6e 73 69 6f 6e 20 ded - Extension
0002baf0: 6e 6f 74 20 61 6c 6c 6f 77 65 64 2e 60 29 2c 6e not allowed.`),n
0002bb00: 75 6c 6c 3b 74 72 79 7b 63 6f 6e 73 74 20 6e 3d ull;try{const n=
0002bb10: 61 77 61 69 74 20 65 2e 67 65 74 41 73 73 65 74 await e.getAsset
0002bb20: 46 6f 72 45 78 74 65 72 6e 61 6c 43 6f 6e 74 65 ForExternalConte
0002bb30: 6e 74 28 7b 74 79 70 65 3a 22 66 69 6c 65 22 2c nt({type:"file",
0002bb40: 66 69 6c 65 3a 74 7d 29 3b 69 66 28 21 6e 29 74 file:t});if(!n)t
0002bb50: 68 72 6f 77 20 45 72 72 6f 72 28 22 43 6f 75 6c hrow Error("Coul
0002bb60: 64 20 6e 6f 74 20 63 72 65 61 74 65 20 61 6e 20 d not create an
0002bb70: 61 73 73 65 74 22 29 3b 75 5b 73 5d 3d 6e 7d 63 asset");u[s]=n}c
0002bb80: 61 74 63 68 28 65 29 7b 72 65 74 75 72 6e 20 69 atch(e){return i
0002bb90: 2e 61 64 64 54 6f 61 73 74 28 7b 74 69 74 6c 65 .addToast({title
0002bba0: 3a 61 28 22 61 73 73 65 74 73 2e 66 69 6c 65 73 :a("assets.files
0002bbb0: 2e 75 70 6c 6f 61 64 2d 66 61 69 6c 65 64 22 29 .upload-failed")
0002bbc0: 2c 73 65 76 65 72 69 74 79 3a 22 65 72 72 6f 72 ,severity:"error
0002bbd0: 22 7d 29 2c 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f "}),console.erro
0002bbe0: 72 28 65 29 2c 6e 75 6c 6c 7d 7d 29 29 29 2c 79 r(e),null}}))),y
0002bbf0: 79 28 65 2c 6a 72 28 75 29 2c 63 29 7d 29 29 2c y(e,jr(u),c)})),
0002bc00: 65 2e 72 65 67 69 73 74 65 72 45 78 74 65 72 6e e.registerExtern
0002bc10: 61 6c 43 6f 6e 74 65 6e 74 48 61 6e 64 6c 65 72 alContentHandler
0002bc20: 28 22 74 65 78 74 22 2c 28 61 73 79 6e 63 28 7b ("text",(async({
0002bc30: 70 6f 69 6e 74 3a 74 2c 74 65 78 74 3a 6e 7d 29 point:t,text:n})
0002bc40: 3d 3e 7b 63 6f 6e 73 74 20 72 3d 74 3f 3f 28 65 =>{const r=t??(e
0002bc50: 2e 69 6e 70 75 74 73 2e 73 68 69 66 74 4b 65 79 .inputs.shiftKey
0002bc60: 3f 65 2e 69 6e 70 75 74 73 2e 63 75 72 72 65 6e ?e.inputs.curren
0002bc70: 74 50 61 67 65 50 6f 69 6e 74 3a 65 2e 67 65 74 tPagePoint:e.get
0002bc80: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
0002bc90: 64 73 28 29 2e 63 65 6e 74 65 72 29 2c 6f 3d 65 ds().center),o=e
0002bca0: 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 22 74 .getShapeUtil("t
0002bcb0: 65 78 74 22 29 2e 67 65 74 44 65 66 61 75 6c 74 ext").getDefault
0002bcc0: 50 72 6f 70 73 28 29 2c 69 3d 67 79 28 6e 29 2c Props(),i=gy(n),
0002bcd0: 61 3d 65 2e 67 65 74 4f 6e 6c 79 53 65 6c 65 63 a=e.getOnlySelec
0002bce0: 74 65 64 53 68 61 70 65 28 29 3b 69 66 28 61 26 tedShape();if(a&
0002bcf0: 26 22 74 65 78 74 22 69 6e 20 61 2e 70 72 6f 70 &"text"in a.prop
0002bd00: 73 29 72 65 74 75 72 6e 20 76 6f 69 64 20 65 2e s)return void e.
0002bd10: 75 70 64 61 74 65 53 68 61 70 65 73 28 5b 7b 69 updateShapes([{i
0002bd20: 64 3a 61 2e 69 64 2c 74 79 70 65 3a 61 2e 74 79 d:a.id,type:a.ty
0002bd30: 70 65 2c 70 72 6f 70 73 3a 7b 74 65 78 74 3a 69 pe,props:{text:i
0002bd40: 7d 7d 5d 29 3b 6c 65 74 20 73 2c 6c 2c 63 2c 75 }}]);let s,l,c,u
0002bd50: 3d 22 6d 69 64 64 6c 65 22 3b 63 6f 6e 73 74 20 ="middle";const
0002bd60: 64 3d 69 2e 73 70 6c 69 74 28 22 5c 6e 22 29 2e d=i.split("\n").
0002bd70: 6c 65 6e 67 74 68 3e 31 2c 70 3d 6d 79 28 69 29 length>1,p=my(i)
0002bd80: 3b 64 26 26 28 75 3d 64 3f 70 3f 22 65 6e 64 22 ;d&&(u=d?p?"end"
0002bd90: 3a 22 73 74 61 72 74 22 3a 22 6d 69 64 64 6c 65 :"start":"middle
0002bda0: 22 29 3b 63 6f 6e 73 74 20 66 3d 65 2e 74 65 78 ");const f=e.tex
0002bdb0: 74 4d 65 61 73 75 72 65 2e 6d 65 61 73 75 72 65 tMeasure.measure
0002bdc0: 54 65 78 74 28 69 2c 7b 2e 2e 2e 4e 62 2c 66 6f Text(i,{...Nb,fo
0002bdd0: 6e 74 46 61 6d 69 6c 79 3a 46 62 5b 6f 2e 66 6f ntFamily:Fb[o.fo
0002bde0: 6e 74 5d 2c 66 6f 6e 74 53 69 7a 65 3a 4d 62 5b nt],fontSize:Mb[
0002bdf0: 6f 2e 73 69 7a 65 5d 2c 6d 61 78 57 69 64 74 68 o.size],maxWidth
0002be00: 3a 6e 75 6c 6c 7d 29 2c 68 3d 4d 61 74 68 2e 6d :null}),h=Math.m
0002be10: 69 6e 28 64 3f 2e 39 2a 65 2e 67 65 74 56 69 65 in(d?.9*e.getVie
0002be20: 77 70 6f 72 74 50 61 67 65 42 6f 75 6e 64 73 28 wportPageBounds(
0002be30: 29 2e 77 69 64 74 68 3a 39 32 30 2c 4d 61 74 68 ).width:920,Math
0002be40: 2e 6d 61 78 28 32 30 30 2c 2e 39 2a 65 2e 67 65 .max(200,.9*e.ge
0002be50: 74 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 tViewportPageBou
0002be60: 6e 64 73 28 29 2e 77 69 64 74 68 29 29 3b 69 66 nds().width));if
0002be70: 28 66 2e 77 3e 68 29 7b 63 6f 6e 73 74 20 74 3d (f.w>h){const t=
0002be80: 65 2e 74 65 78 74 4d 65 61 73 75 72 65 2e 6d 65 e.textMeasure.me
0002be90: 61 73 75 72 65 54 65 78 74 28 69 2c 7b 2e 2e 2e asureText(i,{...
0002bea0: 4e 62 2c 66 6f 6e 74 46 61 6d 69 6c 79 3a 46 62 Nb,fontFamily:Fb
0002beb0: 5b 6f 2e 66 6f 6e 74 5d 2c 66 6f 6e 74 53 69 7a [o.font],fontSiz
0002bec0: 65 3a 4d 62 5b 6f 2e 73 69 7a 65 5d 2c 6d 61 78 e:Mb[o.size],max
0002bed0: 57 69 64 74 68 3a 68 7d 29 3b 73 3d 74 2e 77 2c Width:h});s=t.w,
0002bee0: 6c 3d 74 2e 68 2c 63 3d 21 31 2c 75 3d 70 3f 22 l=t.h,c=!1,u=p?"
0002bef0: 65 6e 64 22 3a 22 73 74 61 72 74 22 7d 65 6c 73 end":"start"}els
0002bf00: 65 20 73 3d 66 2e 77 2c 6c 3d 66 2e 68 2c 63 3d e s=f.w,l=f.h,c=
0002bf10: 21 30 3b 72 2e 79 2d 6c 2f 32 3c 65 2e 67 65 74 !0;r.y-l/2<e.get
0002bf20: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
0002bf30: 64 73 28 29 2e 6d 69 6e 59 2b 34 30 26 26 28 72 ds().minY+40&&(r
0002bf40: 2e 79 3d 65 2e 67 65 74 56 69 65 77 70 6f 72 74 .y=e.getViewport
0002bf50: 50 61 67 65 42 6f 75 6e 64 73 28 29 2e 6d 69 6e PageBounds().min
0002bf60: 59 2b 34 30 2b 6c 2f 32 29 2c 65 2e 63 72 65 61 Y+40+l/2),e.crea
0002bf70: 74 65 53 68 61 70 65 73 28 5b 7b 69 64 3a 49 73 teShapes([{id:Is
0002bf80: 28 29 2c 74 79 70 65 3a 22 74 65 78 74 22 2c 78 (),type:"text",x
0002bf90: 3a 72 2e 78 2d 73 2f 32 2c 79 3a 72 2e 79 2d 6c :r.x-s/2,y:r.y-l
0002bfa0: 2f 32 2c 70 72 6f 70 73 3a 7b 74 65 78 74 3a 69 /2,props:{text:i
0002bfb0: 2c 74 65 78 74 41 6c 69 67 6e 3a 75 2c 61 75 74 ,textAlign:u,aut
0002bfc0: 6f 53 69 7a 65 3a 63 2c 77 3a 73 7d 7d 5d 29 7d oSize:c,w:s}}])}
0002bfd0: 29 29 2c 65 2e 72 65 67 69 73 74 65 72 45 78 74 )),e.registerExt
0002bfe0: 65 72 6e 61 6c 43 6f 6e 74 65 6e 74 48 61 6e 64 ernalContentHand
0002bff0: 6c 65 72 28 22 75 72 6c 22 2c 28 61 73 79 6e 63 ler("url",(async
0002c000: 28 7b 70 6f 69 6e 74 3a 74 2c 75 72 6c 3a 6e 7d ({point:t,url:n}
0002c010: 29 3d 3e 7b 63 6f 6e 73 74 20 72 3d 75 79 28 6e )=>{const r=uy(n
0002c020: 29 3b 69 66 28 72 29 72 65 74 75 72 6e 20 65 2e );if(r)return e.
0002c030: 70 75 74 45 78 74 65 72 6e 61 6c 43 6f 6e 74 65 putExternalConte
0002c040: 6e 74 28 7b 74 79 70 65 3a 22 65 6d 62 65 64 22 nt({type:"embed"
0002c050: 2c 75 72 6c 3a 72 2e 75 72 6c 2c 70 6f 69 6e 74 ,url:r.url,point
0002c060: 3a 74 2c 65 6d 62 65 64 3a 72 2e 64 65 66 69 6e :t,embed:r.defin
0002c070: 69 74 69 6f 6e 7d 29 3b 63 6f 6e 73 74 20 6f 3d ition});const o=
0002c080: 74 3f 3f 28 65 2e 69 6e 70 75 74 73 2e 73 68 69 t??(e.inputs.shi
0002c090: 66 74 4b 65 79 3f 65 2e 69 6e 70 75 74 73 2e 63 ftKey?e.inputs.c
0002c0a0: 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 3a urrentPagePoint:
0002c0b0: 65 2e 67 65 74 56 69 65 77 70 6f 72 74 50 61 67 e.getViewportPag
0002c0c0: 65 42 6f 75 6e 64 73 28 29 2e 63 65 6e 74 65 72 eBounds().center
0002c0d0: 29 2c 73 3d 5a 6c 2e 63 72 65 61 74 65 49 64 28 ),s=Zl.createId(
0002c0e0: 65 6f 28 6e 29 29 2c 6c 3d 66 75 6e 63 74 69 6f eo(n)),l=functio
0002c0f0: 6e 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 n(e,t,n){const r
0002c100: 3d 7b 69 64 3a 49 73 28 29 2c 74 79 70 65 3a 22 ={id:Is(),type:"
0002c110: 62 6f 6f 6b 6d 61 72 6b 22 2c 78 3a 6e 2e 78 2d bookmark",x:n.x-
0002c120: 31 35 30 2c 79 3a 6e 2e 79 2d 31 36 30 2c 6f 70 150,y:n.y-160,op
0002c130: 61 63 69 74 79 3a 31 2c 70 72 6f 70 73 3a 7b 61 acity:1,props:{a
0002c140: 73 73 65 74 49 64 3a 6e 75 6c 6c 2c 75 72 6c 3a ssetId:null,url:
0002c150: 74 7d 7d 3b 72 65 74 75 72 6e 20 65 2e 62 61 74 t}};return e.bat
0002c160: 63 68 28 28 28 29 3d 3e 7b 65 2e 63 72 65 61 74 ch((()=>{e.creat
0002c170: 65 53 68 61 70 65 73 28 5b 72 5d 29 2e 73 65 6c eShapes([r]).sel
0002c180: 65 63 74 28 72 2e 69 64 29 2c 76 79 28 65 2c 6e ect(r.id),vy(e,n
0002c190: 29 7d 29 29 2c 65 2e 67 65 74 53 68 61 70 65 28 )})),e.getShape(
0002c1a0: 72 2e 69 64 29 7d 28 65 2c 6e 2c 6f 29 3b 6c 65 r.id)}(e,n,o);le
0002c1b0: 74 20 63 3d 65 2e 67 65 74 41 73 73 65 74 28 73 t c=e.getAsset(s
0002c1c0: 29 2c 75 3d 21 31 3b 69 66 28 21 63 29 7b 75 3d ),u=!1;if(!c){u=
0002c1d0: 21 30 3b 74 72 79 7b 63 6f 6e 73 74 20 74 3d 61 !0;try{const t=a
0002c1e0: 77 61 69 74 20 65 2e 67 65 74 41 73 73 65 74 46 wait e.getAssetF
0002c1f0: 6f 72 45 78 74 65 72 6e 61 6c 43 6f 6e 74 65 6e orExternalConten
0002c200: 74 28 7b 74 79 70 65 3a 22 75 72 6c 22 2c 75 72 t({type:"url",ur
0002c210: 6c 3a 6e 7d 29 3b 69 66 28 21 74 29 74 68 72 6f l:n});if(!t)thro
0002c220: 77 20 45 72 72 6f 72 28 22 43 6f 75 6c 64 20 6e w Error("Could n
0002c230: 6f 74 20 63 72 65 61 74 65 20 61 6e 20 61 73 73 ot create an ass
0002c240: 65 74 22 29 3b 63 3d 74 7d 63 61 74 63 68 28 65 et");c=t}catch(e
0002c250: 29 7b 72 65 74 75 72 6e 20 76 6f 69 64 20 69 2e ){return void i.
0002c260: 61 64 64 54 6f 61 73 74 28 7b 74 69 74 6c 65 3a addToast({title:
0002c270: 61 28 22 61 73 73 65 74 73 2e 75 72 6c 2e 66 61 a("assets.url.fa
0002c280: 69 6c 65 64 22 29 2c 73 65 76 65 72 69 74 79 3a iled"),severity:
0002c290: 22 65 72 72 6f 72 22 7d 29 7d 7d 65 2e 62 61 74 "error"})}}e.bat
0002c2a0: 63 68 28 28 28 29 3d 3e 7b 75 26 26 65 2e 63 72 ch((()=>{u&&e.cr
0002c2b0: 65 61 74 65 41 73 73 65 74 73 28 5b 63 5d 29 2c eateAssets([c]),
0002c2c0: 65 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 5b e.updateShapes([
0002c2d0: 7b 69 64 3a 6c 2e 69 64 2c 74 79 70 65 3a 6c 2e {id:l.id,type:l.
0002c2e0: 74 79 70 65 2c 70 72 6f 70 73 3a 7b 61 73 73 65 type,props:{asse
0002c2f0: 74 49 64 3a 63 2e 69 64 7d 7d 5d 29 7d 29 29 7d tId:c.id}}])}))}
0002c300: 29 29 7d 61 73 79 6e 63 20 66 75 6e 63 74 69 6f ))}async functio
0002c310: 6e 20 79 79 28 65 2c 74 2c 6e 29 7b 69 66 28 21 n yy(e,t,n){if(!
0002c320: 74 2e 6c 65 6e 67 74 68 29 72 65 74 75 72 6e 5b t.length)return[
0002c330: 5d 3b 63 6f 6e 73 74 20 72 3d 73 75 2e 46 72 6f ];const r=su.Fro
0002c340: 6d 28 6e 29 2c 6f 3d 5b 5d 3b 66 6f 72 28 6c 65 m(n),o=[];for(le
0002c350: 74 20 65 3d 30 3b 65 3c 74 2e 6c 65 6e 67 74 68 t e=0;e<t.length
0002c360: 3b 65 2b 2b 29 7b 63 6f 6e 73 74 20 6e 3d 74 5b ;e++){const n=t[
0002c370: 65 5d 3b 73 77 69 74 63 68 28 6e 2e 74 79 70 65 e];switch(n.type
0002c380: 29 7b 63 61 73 65 22 62 6f 6f 6b 6d 61 72 6b 22 ){case"bookmark"
0002c390: 3a 6f 2e 70 75 73 68 28 7b 69 64 3a 49 73 28 29 :o.push({id:Is()
0002c3a0: 2c 74 79 70 65 3a 22 62 6f 6f 6b 6d 61 72 6b 22 ,type:"bookmark"
0002c3b0: 2c 78 3a 72 2e 78 2c 79 3a 72 2e 79 2c 6f 70 61 ,x:r.x,y:r.y,opa
0002c3c0: 63 69 74 79 3a 31 2c 70 72 6f 70 73 3a 7b 61 73 city:1,props:{as
0002c3d0: 73 65 74 49 64 3a 6e 2e 69 64 2c 75 72 6c 3a 6e setId:n.id,url:n
0002c3e0: 2e 70 72 6f 70 73 2e 73 72 63 7d 7d 29 2c 72 2e .props.src}}),r.
0002c3f0: 78 2b 3d 33 30 30 3b 62 72 65 61 6b 3b 63 61 73 x+=300;break;cas
0002c400: 65 22 69 6d 61 67 65 22 3a 6f 2e 70 75 73 68 28 e"image":o.push(
0002c410: 7b 69 64 3a 49 73 28 29 2c 74 79 70 65 3a 22 69 {id:Is(),type:"i
0002c420: 6d 61 67 65 22 2c 78 3a 72 2e 78 2c 79 3a 72 2e mage",x:r.x,y:r.
0002c430: 79 2c 6f 70 61 63 69 74 79 3a 31 2c 70 72 6f 70 y,opacity:1,prop
0002c440: 73 3a 7b 61 73 73 65 74 49 64 3a 6e 2e 69 64 2c s:{assetId:n.id,
0002c450: 77 3a 6e 2e 70 72 6f 70 73 2e 77 2c 68 3a 6e 2e w:n.props.w,h:n.
0002c460: 70 72 6f 70 73 2e 68 7d 7d 29 2c 72 2e 78 2b 3d props.h}}),r.x+=
0002c470: 6e 2e 70 72 6f 70 73 2e 77 3b 62 72 65 61 6b 3b n.props.w;break;
0002c480: 63 61 73 65 22 76 69 64 65 6f 22 3a 6f 2e 70 75 case"video":o.pu
0002c490: 73 68 28 7b 69 64 3a 49 73 28 29 2c 74 79 70 65 sh({id:Is(),type
0002c4a0: 3a 22 76 69 64 65 6f 22 2c 78 3a 72 2e 78 2c 79 :"video",x:r.x,y
0002c4b0: 3a 72 2e 79 2c 6f 70 61 63 69 74 79 3a 31 2c 70 :r.y,opacity:1,p
0002c4c0: 72 6f 70 73 3a 7b 61 73 73 65 74 49 64 3a 6e 2e rops:{assetId:n.
0002c4d0: 69 64 2c 77 3a 6e 2e 70 72 6f 70 73 2e 77 2c 68 id,w:n.props.w,h
0002c4e0: 3a 6e 2e 70 72 6f 70 73 2e 68 7d 7d 29 2c 72 2e :n.props.h}}),r.
0002c4f0: 78 2b 3d 6e 2e 70 72 6f 70 73 2e 77 7d 7d 72 65 x+=n.props.w}}re
0002c500: 74 75 72 6e 20 65 2e 62 61 74 63 68 28 28 28 29 turn e.batch((()
0002c510: 3d 3e 7b 63 6f 6e 73 74 20 72 3d 74 2e 66 69 6c =>{const r=t.fil
0002c520: 74 65 72 28 28 74 3d 3e 21 65 2e 67 65 74 41 73 ter((t=>!e.getAs
0002c530: 73 65 74 28 74 2e 69 64 29 29 29 3b 72 2e 6c 65 set(t.id)));r.le
0002c540: 6e 67 74 68 26 26 65 2e 63 72 65 61 74 65 41 73 ngth&&e.createAs
0002c550: 73 65 74 73 28 72 29 2c 65 2e 63 72 65 61 74 65 sets(r),e.create
0002c560: 53 68 61 70 65 73 28 6f 29 2e 73 65 6c 65 63 74 Shapes(o).select
0002c570: 28 2e 2e 2e 6f 2e 6d 61 70 28 28 65 3d 3e 65 2e (...o.map((e=>e.
0002c580: 69 64 29 29 29 2c 76 79 28 65 2c 6e 29 7d 29 29 id))),vy(e,n)}))
0002c590: 2c 6f 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 64 29 ,o.map((e=>e.id)
0002c5a0: 29 7d 66 75 6e 63 74 69 6f 6e 20 76 79 28 65 2c )}function vy(e,
0002c5b0: 74 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 74 t){const n=e.get
0002c5c0: 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f 75 6e ViewportPageBoun
0002c5d0: 64 73 28 29 3b 6c 65 74 20 72 3d 65 2e 67 65 74 ds();let r=e.get
0002c5e0: 53 65 6c 65 63 74 69 6f 6e 50 61 67 65 42 6f 75 SelectionPageBou
0002c5f0: 6e 64 73 28 29 3b 69 66 28 72 29 7b 63 6f 6e 73 nds();if(r){cons
0002c600: 74 20 6e 3d 72 2e 63 65 6e 74 65 72 2e 73 75 62 t n=r.center.sub
0002c610: 28 74 29 3b 65 2e 75 70 64 61 74 65 53 68 61 70 (t);e.updateShap
0002c620: 65 73 28 65 2e 67 65 74 53 65 6c 65 63 74 65 64 es(e.getSelected
0002c630: 53 68 61 70 65 73 28 29 2e 6d 61 70 28 28 74 3d Shapes().map((t=
0002c640: 3e 7b 63 6f 6e 73 74 20 72 3d 65 2e 67 65 74 53 >{const r=e.getS
0002c650: 68 61 70 65 50 61 72 65 6e 74 54 72 61 6e 73 66 hapeParentTransf
0002c660: 6f 72 6d 28 74 29 2e 64 65 63 6f 6d 70 6f 73 65 orm(t).decompose
0002c670: 28 29 2e 72 6f 74 61 74 69 6f 6e 2c 6f 3d 73 75 ().rotation,o=su
0002c680: 2e 52 6f 74 28 6e 2c 2d 72 29 3b 72 65 74 75 72 .Rot(n,-r);retur
0002c690: 6e 7b 69 64 3a 74 2e 69 64 2c 74 79 70 65 3a 74 n{id:t.id,type:t
0002c6a0: 2e 74 79 70 65 2c 78 3a 74 2e 78 2d 6f 2e 78 2c .type,x:t.x-o.x,
0002c6b0: 79 3a 74 2e 79 2d 6f 2e 79 7d 7d 29 29 29 7d 72 y:t.y-o.y}})))}r
0002c6c0: 3d 65 2e 67 65 74 53 65 6c 65 63 74 69 6f 6e 50 =e.getSelectionP
0002c6d0: 61 67 65 42 6f 75 6e 64 73 28 29 2c 72 26 26 21 ageBounds(),r&&!
0002c6e0: 6e 2e 63 6f 6e 74 61 69 6e 73 28 72 29 26 26 65 n.contains(r)&&e
0002c6f0: 2e 7a 6f 6f 6d 54 6f 53 65 6c 65 63 74 69 6f 6e .zoomToSelection
0002c700: 28 29 7d 63 6f 6e 73 74 20 53 79 3d 6e 65 77 20 ()}const Sy=new
0002c710: 7a 72 2c 5f 79 3d 65 3d 3e 61 73 79 6e 63 20 74 zr,_y=e=>async t
0002c720: 3d 3e 74 26 26 74 2e 70 72 6f 70 73 2e 73 72 63 =>t&&t.props.src
0002c730: 3f 65 26 26 74 2e 70 72 6f 70 73 2e 73 72 63 2e ?e&&t.props.src.
0002c740: 73 74 61 72 74 73 57 69 74 68 28 22 61 73 73 65 startsWith("asse
0002c750: 74 3a 22 29 3f 61 77 61 69 74 20 53 79 2e 67 65 t:")?await Sy.ge
0002c760: 74 28 74 2c 28 61 73 79 6e 63 28 29 3d 3e 61 77 t(t,(async()=>aw
0002c770: 61 69 74 20 61 73 79 6e 63 20 66 75 6e 63 74 69 ait async functi
0002c780: 6f 6e 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d on(e,t){const n=
0002c790: 61 77 61 69 74 20 61 73 79 6e 63 20 66 75 6e 63 await async func
0002c7a0: 74 69 6f 6e 28 7b 70 65 72 73 69 73 74 65 6e 63 tion({persistenc
0002c7b0: 65 4b 65 79 3a 65 2c 61 73 73 65 74 49 64 3a 74 eKey:e,assetId:t
0002c7c0: 7d 29 7b 63 6f 6e 73 74 20 6e 3d 47 67 2b 65 3b }){const n=Gg+e;
0002c7d0: 72 65 74 75 72 6e 20 61 77 61 69 74 20 56 67 28 return await Vg(
0002c7e0: 6e 2c 28 61 73 79 6e 63 20 65 3d 3e 7b 63 6f 6e n,(async e=>{con
0002c7f0: 73 74 20 6e 3d 65 2e 74 72 61 6e 73 61 63 74 69 st n=e.transacti
0002c800: 6f 6e 28 5b 48 67 2e 41 73 73 65 74 73 5d 2c 22 on([Hg.Assets],"
0002c810: 72 65 61 64 77 72 69 74 65 22 29 2e 6f 62 6a 65 readwrite").obje
0002c820: 63 74 53 74 6f 72 65 28 48 67 2e 41 73 73 65 74 ctStore(Hg.Asset
0002c830: 73 29 3b 72 65 74 75 72 6e 20 61 77 61 69 74 20 s);return await
0002c840: 6e 2e 67 65 74 28 74 29 7d 29 29 7d 28 7b 61 73 n.get(t)}))}({as
0002c850: 73 65 74 49 64 3a 74 2c 70 65 72 73 69 73 74 65 setId:t,persiste
0002c860: 6e 63 65 4b 65 79 3a 65 7d 29 3b 69 66 28 6e 29 nceKey:e});if(n)
0002c870: 72 65 74 75 72 6e 20 55 52 4c 2e 63 72 65 61 74 return URL.creat
0002c880: 65 4f 62 6a 65 63 74 55 52 4c 28 6e 29 3b 72 65 eObjectURL(n);re
0002c890: 74 75 72 6e 20 6e 75 6c 6c 7d 28 65 2c 74 2e 69 turn null}(e,t.i
0002c8a0: 64 29 29 29 3a 22 76 69 64 65 6f 22 3d 3d 3d 74 d))):"video"===t
0002c8b0: 2e 74 79 70 65 3f 74 2e 70 72 6f 70 73 2e 73 72 .type?t.props.sr
0002c8c0: 63 3a 22 69 6d 61 67 65 22 21 3d 3d 74 2e 74 79 c:"image"!==t.ty
0002c8d0: 70 65 3f 6e 75 6c 6c 3a 74 2e 70 72 6f 70 73 2e pe?null:t.props.
0002c8e0: 73 72 63 3a 6e 75 6c 6c 3b 63 6c 61 73 73 20 45 src:null;class E
0002c8f0: 79 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 61 y extends Mm{sta
0002c900: 74 69 63 20 69 64 3d 22 69 64 6c 65 22 3b 6f 6e tic id="idle";on
0002c910: 50 6f 69 6e 74 65 72 44 6f 77 6e 3d 65 3d 3e 7b PointerDown=e=>{
0002c920: 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 6e this.parent.tran
0002c930: 73 69 74 69 6f 6e 28 22 70 6f 69 6e 74 69 6e 67 sition("pointing
0002c940: 22 2c 65 29 7d 3b 6f 6e 45 6e 74 65 72 3d 28 29 ",e)};onEnter=()
0002c950: 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 =>{this.editor.s
0002c960: 65 74 43 75 72 73 6f 72 28 7b 74 79 70 65 3a 22 etCursor({type:"
0002c970: 63 72 6f 73 73 22 2c 72 6f 74 61 74 69 6f 6e 3a cross",rotation:
0002c980: 30 7d 29 7d 3b 6f 6e 43 61 6e 63 65 6c 3d 28 29 0})};onCancel=()
0002c990: 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 =>{this.editor.s
0002c9a0: 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 etCurrentTool("s
0002c9b0: 65 6c 65 63 74 22 29 7d 3b 6f 6e 4b 65 79 55 70 elect")};onKeyUp
0002c9c0: 3d 65 3d 3e 7b 69 66 28 22 45 6e 74 65 72 22 3d =e=>{if("Enter"=
0002c9d0: 3d 3d 65 2e 6b 65 79 29 7b 69 66 28 74 68 69 73 ==e.key){if(this
0002c9e0: 2e 65 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 .editor.getInsta
0002c9f0: 6e 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 nceState().isRea
0002ca00: 64 6f 6e 6c 79 29 72 65 74 75 72 6e 20 6e 75 6c donly)return nul
0002ca10: 6c 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 l;const t=this.e
0002ca20: 64 69 74 6f 72 2e 67 65 74 4f 6e 6c 79 53 65 6c ditor.getOnlySel
0002ca30: 65 63 74 65 64 53 68 61 70 65 28 29 3b 74 26 26 ectedShape();t&&
0002ca40: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
0002ca50: 68 61 70 65 55 74 69 6c 28 74 29 2e 63 61 6e 45 hapeUtil(t).canE
0002ca60: 64 69 74 28 74 29 26 26 28 74 68 69 73 2e 65 64 dit(t)&&(this.ed
0002ca70: 69 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 itor.setCurrentT
0002ca80: 6f 6f 6c 28 22 73 65 6c 65 63 74 22 29 2c 74 68 ool("select"),th
0002ca90: 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 45 64 69 is.editor.setEdi
0002caa0: 74 69 6e 67 53 68 61 70 65 28 74 2e 69 64 29 2c tingShape(t.id),
0002cab0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 72 6f 6f 74 this.editor.root
0002cac0: 2e 67 65 74 43 75 72 72 65 6e 74 28 29 3f 2e 74 .getCurrent()?.t
0002cad0: 72 61 6e 73 69 74 69 6f 6e 28 22 65 64 69 74 69 ransition("editi
0002cae0: 6e 67 5f 73 68 61 70 65 22 2c 7b 2e 2e 2e 65 2c ng_shape",{...e,
0002caf0: 74 61 72 67 65 74 3a 22 73 68 61 70 65 22 2c 73 target:"shape",s
0002cb00: 68 61 70 65 3a 74 7d 29 29 7d 7d 7d 63 6c 61 73 hape:t}))}}}clas
0002cb10: 73 20 77 79 20 65 78 74 65 6e 64 73 20 4d 6d 7b s wy extends Mm{
0002cb20: 73 74 61 74 69 63 20 69 64 3d 22 70 6f 69 6e 74 static id="point
0002cb30: 69 6e 67 22 3b 73 68 61 70 65 3b 6d 61 72 6b 49 ing";shape;markI
0002cb40: 64 3d 22 22 3b 6f 6e 45 6e 74 65 72 3d 28 29 3d d="";onEnter=()=
0002cb50: 3e 7b 74 68 69 73 2e 64 69 64 54 69 6d 65 6f 75 >{this.didTimeou
0002cb60: 74 3d 21 31 3b 63 6f 6e 73 74 20 65 3d 74 68 69 t=!1;const e=thi
0002cb70: 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 61 70 s.editor.getShap
0002cb80: 65 41 74 50 6f 69 6e 74 28 74 68 69 73 2e 65 64 eAtPoint(this.ed
0002cb90: 69 74 6f 72 2e 69 6e 70 75 74 73 2e 63 75 72 72 itor.inputs.curr
0002cba0: 65 6e 74 50 61 67 65 50 6f 69 6e 74 2c 7b 66 69 entPagePoint,{fi
0002cbb0: 6c 74 65 72 3a 65 3d 3e 21 65 2e 69 73 4c 6f 63 lter:e=>!e.isLoc
0002cbc0: 6b 65 64 26 26 74 68 69 73 2e 65 64 69 74 6f 72 ked&&this.editor
0002cbd0: 2e 63 61 6e 42 69 6e 64 53 68 61 70 65 73 28 7b .canBindShapes({
0002cbe0: 66 72 6f 6d 53 68 61 70 65 3a 22 61 72 72 6f 77 fromShape:"arrow
0002cbf0: 22 2c 74 6f 53 68 61 70 65 3a 65 2c 62 69 6e 64 ",toShape:e,bind
0002cc00: 69 6e 67 3a 22 61 72 72 6f 77 22 7d 29 2c 6d 61 ing:"arrow"}),ma
0002cc10: 72 67 69 6e 3a 30 2c 68 69 74 49 6e 73 69 64 65 rgin:0,hitInside
0002cc20: 3a 21 30 2c 72 65 6e 64 65 72 69 6e 67 4f 6e 6c :!0,renderingOnl
0002cc30: 79 3a 21 30 7d 29 3b 65 3f 74 68 69 73 2e 65 64 y:!0});e?this.ed
0002cc40: 69 74 6f 72 2e 73 65 74 48 69 6e 74 69 6e 67 53 itor.setHintingS
0002cc50: 68 61 70 65 73 28 5b 65 2e 69 64 5d 29 3a 74 68 hapes([e.id]):th
0002cc60: 69 73 2e 63 72 65 61 74 65 41 72 72 6f 77 53 68 is.createArrowSh
0002cc70: 61 70 65 28 29 2c 74 68 69 73 2e 73 74 61 72 74 ape(),this.start
0002cc80: 50 72 65 63 69 73 65 54 69 6d 65 6f 75 74 28 29 PreciseTimeout()
0002cc90: 7d 3b 6f 6e 45 78 69 74 3d 28 29 3d 3e 7b 74 68 };onExit=()=>{th
0002cca0: 69 73 2e 73 68 61 70 65 3d 76 6f 69 64 20 30 2c is.shape=void 0,
0002ccb0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 48 this.editor.setH
0002ccc0: 69 6e 74 69 6e 67 53 68 61 70 65 73 28 5b 5d 29 intingShapes([])
0002ccd0: 2c 74 68 69 73 2e 63 6c 65 61 72 50 72 65 63 69 ,this.clearPreci
0002cce0: 73 65 54 69 6d 65 6f 75 74 28 29 7d 3b 6f 6e 50 seTimeout()};onP
0002ccf0: 6f 69 6e 74 65 72 4d 6f 76 65 3d 28 29 3d 3e 7b ointerMove=()=>{
0002cd00: 69 66 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 if(this.editor.i
0002cd10: 6e 70 75 74 73 2e 69 73 44 72 61 67 67 69 6e 67 nputs.isDragging
0002cd20: 29 7b 69 66 28 74 68 69 73 2e 73 68 61 70 65 7c ){if(this.shape|
0002cd30: 7c 74 68 69 73 2e 63 72 65 61 74 65 41 72 72 6f |this.createArro
0002cd40: 77 53 68 61 70 65 28 29 2c 21 74 68 69 73 2e 73 wShape(),!this.s
0002cd50: 68 61 70 65 29 74 68 72 6f 77 20 45 72 72 6f 72 hape)throw Error
0002cd60: 28 22 65 78 70 65 63 74 65 64 20 73 68 61 70 65 ("expected shape
0002cd70: 22 29 3b 74 68 69 73 2e 75 70 64 61 74 65 41 72 ");this.updateAr
0002cd80: 72 6f 77 53 68 61 70 65 45 6e 64 48 61 6e 64 6c rowShapeEndHandl
0002cd90: 65 28 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e e(),this.editor.
0002cda0: 73 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 setCurrentTool("
0002cdb0: 73 65 6c 65 63 74 2e 64 72 61 67 67 69 6e 67 5f select.dragging_
0002cdc0: 68 61 6e 64 6c 65 22 2c 7b 73 68 61 70 65 3a 74 handle",{shape:t
0002cdd0: 68 69 73 2e 73 68 61 70 65 2c 68 61 6e 64 6c 65 his.shape,handle
0002cde0: 3a 7b 69 64 3a 22 65 6e 64 22 2c 74 79 70 65 3a :{id:"end",type:
0002cdf0: 22 76 65 72 74 65 78 22 2c 69 6e 64 65 78 3a 22 "vertex",index:"
0002ce00: 61 33 22 2c 78 3a 30 2c 79 3a 30 7d 2c 69 73 43 a3",x:0,y:0},isC
0002ce10: 72 65 61 74 69 6e 67 3a 21 30 2c 6f 6e 49 6e 74 reating:!0,onInt
0002ce20: 65 72 61 63 74 69 6f 6e 45 6e 64 3a 22 61 72 72 eractionEnd:"arr
0002ce30: 6f 77 22 7d 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 65 ow"})}};onPointe
0002ce40: 72 55 70 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 rUp=()=>{this.ca
0002ce50: 6e 63 65 6c 28 29 7d 3b 6f 6e 43 61 6e 63 65 6c ncel()};onCancel
0002ce60: 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 65 =()=>{this.cance
0002ce70: 6c 28 29 7d 3b 6f 6e 43 6f 6d 70 6c 65 74 65 3d l()};onComplete=
0002ce80: 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 65 6c ()=>{this.cancel
0002ce90: 28 29 7d 3b 6f 6e 49 6e 74 65 72 72 75 70 74 3d ()};onInterrupt=
0002cea0: 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 65 6c ()=>{this.cancel
0002ceb0: 28 29 7d 3b 63 61 6e 63 65 6c 28 29 7b 74 68 69 ()};cancel(){thi
0002cec0: 73 2e 73 68 61 70 65 26 26 74 68 69 73 2e 65 64 s.shape&&this.ed
0002ced0: 69 74 6f 72 2e 62 61 69 6c 54 6f 4d 61 72 6b 28 itor.bailToMark(
0002cee0: 74 68 69 73 2e 6d 61 72 6b 49 64 29 2c 74 68 69 this.markId),thi
0002cef0: 73 2e 65 64 69 74 6f 72 2e 73 65 74 48 69 6e 74 s.editor.setHint
0002cf00: 69 6e 67 53 68 61 70 65 73 28 5b 5d 29 2c 74 68 ingShapes([]),th
0002cf10: 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 6e 73 69 is.parent.transi
0002cf20: 74 69 6f 6e 28 22 69 64 6c 65 22 29 7d 63 72 65 tion("idle")}cre
0002cf30: 61 74 65 41 72 72 6f 77 53 68 61 70 65 28 29 7b ateArrowShape(){
0002cf40: 63 6f 6e 73 74 7b 6f 72 69 67 69 6e 50 61 67 65 const{originPage
0002cf50: 50 6f 69 6e 74 3a 65 7d 3d 74 68 69 73 2e 65 64 Point:e}=this.ed
0002cf60: 69 74 6f 72 2e 69 6e 70 75 74 73 2c 74 3d 49 73 itor.inputs,t=Is
0002cf70: 28 29 3b 74 68 69 73 2e 6d 61 72 6b 49 64 3d 60 ();this.markId=`
0002cf80: 63 72 65 61 74 69 6e 67 3a 24 7b 74 7d 60 2c 74 creating:${t}`,t
0002cf90: 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 72 6b 28 his.editor.mark(
0002cfa0: 74 68 69 73 2e 6d 61 72 6b 49 64 29 2c 74 68 69 this.markId),thi
0002cfb0: 73 2e 65 64 69 74 6f 72 2e 63 72 65 61 74 65 53 s.editor.createS
0002cfc0: 68 61 70 65 28 7b 69 64 3a 74 2c 74 79 70 65 3a hape({id:t,type:
0002cfd0: 22 61 72 72 6f 77 22 2c 78 3a 65 2e 78 2c 79 3a "arrow",x:e.x,y:
0002cfe0: 65 2e 79 2c 70 72 6f 70 73 3a 7b 73 63 61 6c 65 e.y,props:{scale
0002cff0: 3a 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 73 65 :this.editor.use
0002d000: 72 2e 67 65 74 49 73 44 79 6e 61 6d 69 63 52 65 r.getIsDynamicRe
0002d010: 73 69 7a 65 4d 6f 64 65 28 29 3f 31 2f 74 68 69 sizeMode()?1/thi
0002d020: 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f 6d s.editor.getZoom
0002d030: 4c 65 76 65 6c 28 29 3a 31 7d 7d 29 3b 63 6f 6e Level():1}});con
0002d040: 73 74 20 6e 3d 74 68 69 73 2e 65 64 69 74 6f 72 st n=this.editor
0002d050: 2e 67 65 74 53 68 61 70 65 28 74 29 3b 69 66 28 .getShape(t);if(
0002d060: 21 6e 29 74 68 72 6f 77 20 45 72 72 6f 72 28 22 !n)throw Error("
0002d070: 65 78 70 65 63 74 65 64 20 73 68 61 70 65 22 29 expected shape")
0002d080: 3b 63 6f 6e 73 74 20 72 3d 74 68 69 73 2e 65 64 ;const r=this.ed
0002d090: 69 74 6f 72 2e 67 65 74 53 68 61 70 65 48 61 6e itor.getShapeHan
0002d0a0: 64 6c 65 73 28 6e 29 3b 69 66 28 21 72 29 74 68 dles(n);if(!r)th
0002d0b0: 72 6f 77 20 45 72 72 6f 72 28 22 65 78 70 65 63 row Error("expec
0002d0c0: 74 65 64 20 68 61 6e 64 6c 65 73 20 66 6f 72 20 ted handles for
0002d0d0: 61 72 72 6f 77 22 29 3b 63 6f 6e 73 74 20 6f 3d arrow");const o=
0002d0e0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
0002d0f0: 68 61 70 65 55 74 69 6c 28 22 61 72 72 6f 77 22 hapeUtil("arrow"
0002d100: 29 2c 69 3d 74 68 69 73 2e 73 68 61 70 65 2c 61 ),i=this.shape,a
0002d110: 3d 72 2e 66 69 6e 64 28 28 65 3d 3e 22 73 74 61 =r.find((e=>"sta
0002d120: 72 74 22 3d 3d 3d 65 2e 69 64 29 29 2c 73 3d 6f rt"===e.id)),s=o
0002d130: 2e 6f 6e 48 61 6e 64 6c 65 44 72 61 67 3f 2e 28 .onHandleDrag?.(
0002d140: 6e 2c 7b 68 61 6e 64 6c 65 3a 7b 2e 2e 2e 61 2c n,{handle:{...a,
0002d150: 78 3a 30 2c 79 3a 30 7d 2c 69 73 50 72 65 63 69 x:0,y:0},isPreci
0002d160: 73 65 3a 21 30 2c 69 6e 69 74 69 61 6c 3a 69 7d se:!0,initial:i}
0002d170: 29 3b 73 26 26 74 68 69 73 2e 65 64 69 74 6f 72 );s&&this.editor
0002d180: 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 5b 73 .updateShapes([s
0002d190: 5d 29 2c 74 68 69 73 2e 73 68 61 70 65 3d 74 68 ]),this.shape=th
0002d1a0: 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 61 is.editor.getSha
0002d1b0: 70 65 28 74 29 2c 74 68 69 73 2e 65 64 69 74 6f pe(t),this.edito
0002d1c0: 72 2e 73 65 6c 65 63 74 28 74 29 7d 75 70 64 61 r.select(t)}upda
0002d1d0: 74 65 41 72 72 6f 77 53 68 61 70 65 45 6e 64 48 teArrowShapeEndH
0002d1e0: 61 6e 64 6c 65 28 29 7b 63 6f 6e 73 74 20 65 3d andle(){const e=
0002d1f0: 74 68 69 73 2e 73 68 61 70 65 3b 69 66 28 21 65 this.shape;if(!e
0002d200: 29 74 68 72 6f 77 20 45 72 72 6f 72 28 22 65 78 )throw Error("ex
0002d210: 70 65 63 74 65 64 20 73 68 61 70 65 22 29 3b 63 pected shape");c
0002d220: 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 64 69 74 onst t=this.edit
0002d230: 6f 72 2e 67 65 74 53 68 61 70 65 48 61 6e 64 6c or.getShapeHandl
0002d240: 65 73 28 65 29 3b 69 66 28 21 74 29 74 68 72 6f es(e);if(!t)thro
0002d250: 77 20 45 72 72 6f 72 28 22 65 78 70 65 63 74 65 w Error("expecte
0002d260: 64 20 68 61 6e 64 6c 65 73 20 66 6f 72 20 61 72 d handles for ar
0002d270: 72 6f 77 22 29 3b 7b 63 6f 6e 73 74 20 6e 3d 74 row");{const n=t
0002d280: 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 his.editor.getSh
0002d290: 61 70 65 55 74 69 6c 28 22 61 72 72 6f 77 22 29 apeUtil("arrow")
0002d2a0: 2c 72 3d 74 68 69 73 2e 73 68 61 70 65 2c 6f 3d ,r=this.shape,o=
0002d2b0: 74 2e 66 69 6e 64 28 28 65 3d 3e 22 73 74 61 72 t.find((e=>"star
0002d2c0: 74 22 3d 3d 3d 65 2e 69 64 29 29 2c 69 3d 6e 2e t"===e.id)),i=n.
0002d2d0: 6f 6e 48 61 6e 64 6c 65 44 72 61 67 3f 2e 28 65 onHandleDrag?.(e
0002d2e0: 2c 7b 68 61 6e 64 6c 65 3a 7b 2e 2e 2e 6f 2c 78 ,{handle:{...o,x
0002d2f0: 3a 30 2c 79 3a 30 7d 2c 69 73 50 72 65 63 69 73 :0,y:0},isPrecis
0002d300: 65 3a 74 68 69 73 2e 64 69 64 54 69 6d 65 6f 75 e:this.didTimeou
0002d310: 74 2c 69 6e 69 74 69 61 6c 3a 72 7d 29 3b 69 26 t,initial:r});i&
0002d320: 26 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 70 64 &this.editor.upd
0002d330: 61 74 65 53 68 61 70 65 73 28 5b 69 5d 29 7d 7b ateShapes([i])}{
0002d340: 63 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 65 64 69 const n=this.edi
0002d350: 74 6f 72 2e 67 65 74 53 68 61 70 65 55 74 69 6c tor.getShapeUtil
0002d360: 28 22 61 72 72 6f 77 22 29 2c 72 3d 74 68 69 73 ("arrow"),r=this
0002d370: 2e 73 68 61 70 65 2c 6f 3d 74 68 69 73 2e 65 64 .shape,o=this.ed
0002d380: 69 74 6f 72 2e 67 65 74 50 6f 69 6e 74 49 6e 53 itor.getPointInS
0002d390: 68 61 70 65 53 70 61 63 65 28 65 2c 74 68 69 73 hapeSpace(e,this
0002d3a0: 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 2e 63 .editor.inputs.c
0002d3b0: 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 29 urrentPagePoint)
0002d3c0: 2c 69 3d 74 2e 66 69 6e 64 28 28 65 3d 3e 22 65 ,i=t.find((e=>"e
0002d3d0: 6e 64 22 3d 3d 3d 65 2e 69 64 29 29 2c 61 3d 6e nd"===e.id)),a=n
0002d3e0: 2e 6f 6e 48 61 6e 64 6c 65 44 72 61 67 3f 2e 28 .onHandleDrag?.(
0002d3f0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
0002d400: 68 61 70 65 28 65 29 2c 7b 68 61 6e 64 6c 65 3a hape(e),{handle:
0002d410: 7b 2e 2e 2e 69 2c 78 3a 6f 2e 78 2c 79 3a 6f 2e {...i,x:o.x,y:o.
0002d420: 79 7d 2c 69 73 50 72 65 63 69 73 65 3a 21 31 2c y},isPrecise:!1,
0002d430: 69 6e 69 74 69 61 6c 3a 72 7d 29 3b 61 26 26 74 initial:r});a&&t
0002d440: 68 69 73 2e 65 64 69 74 6f 72 2e 75 70 64 61 74 his.editor.updat
0002d450: 65 53 68 61 70 65 73 28 5b 61 5d 29 7d 74 68 69 eShapes([a])}thi
0002d460: 73 2e 73 68 61 70 65 3d 74 68 69 73 2e 65 64 69 s.shape=this.edi
0002d470: 74 6f 72 2e 67 65 74 53 68 61 70 65 28 65 2e 69 tor.getShape(e.i
0002d480: 64 29 7d 70 72 65 63 69 73 65 54 69 6d 65 6f 75 d)}preciseTimeou
0002d490: 74 3d 2d 31 3b 64 69 64 54 69 6d 65 6f 75 74 3d t=-1;didTimeout=
0002d4a0: 21 31 3b 73 74 61 72 74 50 72 65 63 69 73 65 54 !1;startPreciseT
0002d4b0: 69 6d 65 6f 75 74 28 29 7b 74 68 69 73 2e 70 72 imeout(){this.pr
0002d4c0: 65 63 69 73 65 54 69 6d 65 6f 75 74 3d 74 68 69 eciseTimeout=thi
0002d4d0: 73 2e 65 64 69 74 6f 72 2e 74 69 6d 65 72 73 2e s.editor.timers.
0002d4e0: 73 65 74 54 69 6d 65 6f 75 74 28 28 28 29 3d 3e setTimeout((()=>
0002d4f0: 7b 74 68 69 73 2e 67 65 74 49 73 41 63 74 69 76 {this.getIsActiv
0002d500: 65 28 29 26 26 28 74 68 69 73 2e 64 69 64 54 69 e()&&(this.didTi
0002d510: 6d 65 6f 75 74 3d 21 30 29 7d 29 2c 33 32 30 29 meout=!0)}),320)
0002d520: 7d 63 6c 65 61 72 50 72 65 63 69 73 65 54 69 6d }clearPreciseTim
0002d530: 65 6f 75 74 28 29 7b 63 6c 65 61 72 54 69 6d 65 eout(){clearTime
0002d540: 6f 75 74 28 74 68 69 73 2e 70 72 65 63 69 73 65 out(this.precise
0002d550: 54 69 6d 65 6f 75 74 29 7d 7d 63 6c 61 73 73 20 Timeout)}}class
0002d560: 78 79 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 xy extends Mm{st
0002d570: 61 74 69 63 20 69 64 3d 22 64 72 61 77 69 6e 67 atic id="drawing
0002d580: 22 3b 69 6e 66 6f 3d 7b 7d 3b 69 6e 69 74 69 61 ";info={};initia
0002d590: 6c 53 68 61 70 65 3b 73 68 61 70 65 54 79 70 65 lShape;shapeType
0002d5a0: 3d 22 68 69 67 68 6c 69 67 68 74 22 3d 3d 3d 74 ="highlight"===t
0002d5b0: 68 69 73 2e 70 61 72 65 6e 74 2e 69 64 3f 22 68 his.parent.id?"h
0002d5c0: 69 67 68 6c 69 67 68 74 22 3a 22 64 72 61 77 22 ighlight":"draw"
0002d5d0: 3b 75 74 69 6c 3d 74 68 69 73 2e 65 64 69 74 6f ;util=this.edito
0002d5e0: 72 2e 67 65 74 53 68 61 70 65 55 74 69 6c 28 74 r.getShapeUtil(t
0002d5f0: 68 69 73 2e 73 68 61 70 65 54 79 70 65 29 3b 69 his.shapeType);i
0002d600: 73 50 65 6e 3d 21 31 3b 69 73 50 65 6e 4f 72 53 sPen=!1;isPenOrS
0002d610: 74 79 6c 75 73 3d 21 31 3b 73 65 67 6d 65 6e 74 tylus=!1;segment
0002d620: 4d 6f 64 65 3d 22 66 72 65 65 22 3b 64 69 64 4a Mode="free";didJ
0002d630: 75 73 74 53 68 69 66 74 43 6c 69 63 6b 54 6f 45 ustShiftClickToE
0002d640: 78 74 65 6e 64 50 72 65 76 69 6f 75 73 53 68 61 xtendPreviousSha
0002d650: 70 65 4c 69 6e 65 3d 21 31 3b 70 61 67 65 50 6f peLine=!1;pagePo
0002d660: 69 6e 74 57 68 65 72 65 43 75 72 72 65 6e 74 53 intWhereCurrentS
0002d670: 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 7b 7d egmentChanged={}
0002d680: 3b 70 61 67 65 50 6f 69 6e 74 57 68 65 72 65 4e ;pagePointWhereN
0002d690: 65 78 74 53 65 67 6d 65 6e 74 43 68 61 6e 67 65 extSegmentChange
0002d6a0: 64 3d 6e 75 6c 6c 3b 6c 61 73 74 52 65 63 6f 72 d=null;lastRecor
0002d6b0: 64 65 64 50 6f 69 6e 74 3d 7b 7d 3b 6d 65 72 67 dedPoint={};merg
0002d6c0: 65 4e 65 78 74 50 6f 69 6e 74 3d 21 31 3b 63 75 eNextPoint=!1;cu
0002d6d0: 72 72 65 6e 74 4c 69 6e 65 4c 65 6e 67 74 68 3d rrentLineLength=
0002d6e0: 30 3b 63 61 6e 44 72 61 77 3d 21 31 3b 6d 61 72 0;canDraw=!1;mar
0002d6f0: 6b 49 64 3d 6e 75 6c 6c 3b 6f 6e 45 6e 74 65 72 kId=null;onEnter
0002d700: 3d 65 3d 3e 7b 74 68 69 73 2e 6d 61 72 6b 49 64 =e=>{this.markId
0002d710: 3d 6e 75 6c 6c 2c 74 68 69 73 2e 69 6e 66 6f 3d =null,this.info=
0002d720: 65 2c 74 68 69 73 2e 63 61 6e 44 72 61 77 3d 21 e,this.canDraw=!
0002d730: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 49 this.editor.getI
0002d740: 73 4d 65 6e 75 4f 70 65 6e 28 29 2c 74 68 69 73 sMenuOpen(),this
0002d750: 2e 6c 61 73 74 52 65 63 6f 72 64 65 64 50 6f 69 .lastRecordedPoi
0002d760: 6e 74 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 nt=this.editor.i
0002d770: 6e 70 75 74 73 2e 63 75 72 72 65 6e 74 50 61 67 nputs.currentPag
0002d780: 65 50 6f 69 6e 74 2e 63 6c 6f 6e 65 28 29 2c 74 ePoint.clone(),t
0002d790: 68 69 73 2e 63 61 6e 44 72 61 77 26 26 74 68 69 his.canDraw&&thi
0002d7a0: 73 2e 73 74 61 72 74 53 68 61 70 65 28 29 7d 3b s.startShape()};
0002d7b0: 6f 6e 50 6f 69 6e 74 65 72 4d 6f 76 65 3d 28 29 onPointerMove=()
0002d7c0: 3d 3e 7b 63 6f 6e 73 74 7b 69 6e 70 75 74 73 3a =>{const{inputs:
0002d7d0: 65 7d 3d 74 68 69 73 2e 65 64 69 74 6f 72 3b 69 e}=this.editor;i
0002d7e0: 66 28 74 68 69 73 2e 69 73 50 65 6e 26 26 21 65 f(this.isPen&&!e
0002d7f0: 2e 69 73 50 65 6e 29 7b 69 66 28 74 68 69 73 2e .isPen){if(this.
0002d800: 6d 61 72 6b 49 64 29 72 65 74 75 72 6e 20 74 68 markId)return th
0002d810: 69 73 2e 65 64 69 74 6f 72 2e 62 61 69 6c 54 6f is.editor.bailTo
0002d820: 4d 61 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 64 Mark(this.markId
0002d830: 29 2c 76 6f 69 64 20 74 68 69 73 2e 73 74 61 72 ),void this.star
0002d840: 74 53 68 61 70 65 28 29 7d 65 6c 73 65 21 74 68 tShape()}else!th
0002d850: 69 73 2e 63 61 6e 44 72 61 77 26 26 65 2e 69 73 is.canDraw&&e.is
0002d860: 44 72 61 67 67 69 6e 67 26 26 28 74 68 69 73 2e Dragging&&(this.
0002d870: 73 74 61 72 74 53 68 61 70 65 28 29 2c 74 68 69 startShape(),thi
0002d880: 73 2e 63 61 6e 44 72 61 77 3d 21 30 29 3b 74 68 s.canDraw=!0);th
0002d890: 69 73 2e 63 61 6e 44 72 61 77 26 26 28 74 68 69 is.canDraw&&(thi
0002d8a0: 73 2e 69 73 50 65 6e 4f 72 53 74 79 6c 75 73 3f s.isPenOrStylus?
0002d8b0: 73 75 2e 44 69 73 74 28 65 2e 63 75 72 72 65 6e su.Dist(e.curren
0002d8c0: 74 50 61 67 65 50 6f 69 6e 74 2c 74 68 69 73 2e tPagePoint,this.
0002d8d0: 6c 61 73 74 52 65 63 6f 72 64 65 64 50 6f 69 6e lastRecordedPoin
0002d8e0: 74 29 3e 3d 31 2f 74 68 69 73 2e 65 64 69 74 6f t)>=1/this.edito
0002d8f0: 72 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 r.getZoomLevel()
0002d900: 3f 28 74 68 69 73 2e 6c 61 73 74 52 65 63 6f 72 ?(this.lastRecor
0002d910: 64 65 64 50 6f 69 6e 74 3d 65 2e 63 75 72 72 65 dedPoint=e.curre
0002d920: 6e 74 50 61 67 65 50 6f 69 6e 74 2e 63 6c 6f 6e ntPagePoint.clon
0002d930: 65 28 29 2c 74 68 69 73 2e 6d 65 72 67 65 4e 65 e(),this.mergeNe
0002d940: 78 74 50 6f 69 6e 74 3d 21 31 29 3a 74 68 69 73 xtPoint=!1):this
0002d950: 2e 6d 65 72 67 65 4e 65 78 74 50 6f 69 6e 74 3d .mergeNextPoint=
0002d960: 21 30 3a 74 68 69 73 2e 6d 65 72 67 65 4e 65 78 !0:this.mergeNex
0002d970: 74 50 6f 69 6e 74 3d 21 31 2c 74 68 69 73 2e 75 tPoint=!1,this.u
0002d980: 70 64 61 74 65 44 72 61 77 69 6e 67 53 68 61 70 pdateDrawingShap
0002d990: 65 28 29 29 7d 3b 6f 6e 4b 65 79 44 6f 77 6e 3d e())};onKeyDown=
0002d9a0: 65 3d 3e 7b 69 66 28 22 53 68 69 66 74 22 3d 3d e=>{if("Shift"==
0002d9b0: 3d 65 2e 6b 65 79 29 73 77 69 74 63 68 28 74 68 =e.key)switch(th
0002d9c0: 69 73 2e 73 65 67 6d 65 6e 74 4d 6f 64 65 29 7b is.segmentMode){
0002d9d0: 63 61 73 65 22 66 72 65 65 22 3a 74 68 69 73 2e case"free":this.
0002d9e0: 73 65 67 6d 65 6e 74 4d 6f 64 65 3d 22 73 74 61 segmentMode="sta
0002d9f0: 72 74 69 6e 67 5f 73 74 72 61 69 67 68 74 22 2c rting_straight",
0002da00: 74 68 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 this.pagePointWh
0002da10: 65 72 65 4e 65 78 74 53 65 67 6d 65 6e 74 43 68 ereNextSegmentCh
0002da20: 61 6e 67 65 64 3d 74 68 69 73 2e 65 64 69 74 6f anged=this.edito
0002da30: 72 2e 69 6e 70 75 74 73 2e 63 75 72 72 65 6e 74 r.inputs.current
0002da40: 50 61 67 65 50 6f 69 6e 74 2e 63 6c 6f 6e 65 28 PagePoint.clone(
0002da50: 29 3b 62 72 65 61 6b 3b 63 61 73 65 22 73 74 61 );break;case"sta
0002da60: 72 74 69 6e 67 5f 66 72 65 65 22 3a 74 68 69 73 rting_free":this
0002da70: 2e 73 65 67 6d 65 6e 74 4d 6f 64 65 3d 22 73 74 .segmentMode="st
0002da80: 61 72 74 69 6e 67 5f 73 74 72 61 69 67 68 74 22 arting_straight"
0002da90: 7d 74 68 69 73 2e 75 70 64 61 74 65 44 72 61 77 }this.updateDraw
0002daa0: 69 6e 67 53 68 61 70 65 28 29 7d 3b 6f 6e 4b 65 ingShape()};onKe
0002dab0: 79 55 70 3d 65 3d 3e 7b 69 66 28 22 53 68 69 66 yUp=e=>{if("Shif
0002dac0: 74 22 3d 3d 3d 65 2e 6b 65 79 29 73 77 69 74 63 t"===e.key)switc
0002dad0: 68 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 6e h(this.editor.sn
0002dae0: 61 70 73 2e 63 6c 65 61 72 49 6e 64 69 63 61 74 aps.clearIndicat
0002daf0: 6f 72 73 28 29 2c 74 68 69 73 2e 73 65 67 6d 65 ors(),this.segme
0002db00: 6e 74 4d 6f 64 65 29 7b 63 61 73 65 22 73 74 72 ntMode){case"str
0002db10: 61 69 67 68 74 22 3a 74 68 69 73 2e 73 65 67 6d aight":this.segm
0002db20: 65 6e 74 4d 6f 64 65 3d 22 73 74 61 72 74 69 6e entMode="startin
0002db30: 67 5f 66 72 65 65 22 2c 74 68 69 73 2e 70 61 67 g_free",this.pag
0002db40: 65 50 6f 69 6e 74 57 68 65 72 65 4e 65 78 74 53 ePointWhereNextS
0002db50: 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 74 68 egmentChanged=th
0002db60: 69 73 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 is.editor.inputs
0002db70: 2e 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e .currentPagePoin
0002db80: 74 2e 63 6c 6f 6e 65 28 29 3b 62 72 65 61 6b 3b t.clone();break;
0002db90: 63 61 73 65 22 73 74 61 72 74 69 6e 67 5f 73 74 case"starting_st
0002dba0: 72 61 69 67 68 74 22 3a 74 68 69 73 2e 70 61 67 raight":this.pag
0002dbb0: 65 50 6f 69 6e 74 57 68 65 72 65 4e 65 78 74 53 ePointWhereNextS
0002dbc0: 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 6e 75 egmentChanged=nu
0002dbd0: 6c 6c 2c 74 68 69 73 2e 73 65 67 6d 65 6e 74 4d ll,this.segmentM
0002dbe0: 6f 64 65 3d 22 66 72 65 65 22 7d 74 68 69 73 2e ode="free"}this.
0002dbf0: 75 70 64 61 74 65 44 72 61 77 69 6e 67 53 68 61 updateDrawingSha
0002dc00: 70 65 28 29 7d 3b 6f 6e 45 78 69 74 3d 28 29 3d pe()};onExit=()=
0002dc10: 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 6e >{this.editor.sn
0002dc20: 61 70 73 2e 63 6c 65 61 72 49 6e 64 69 63 61 74 aps.clearIndicat
0002dc30: 6f 72 73 28 29 2c 74 68 69 73 2e 70 61 67 65 50 ors(),this.pageP
0002dc40: 6f 69 6e 74 57 68 65 72 65 43 75 72 72 65 6e 74 ointWhereCurrent
0002dc50: 53 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 74 SegmentChanged=t
0002dc60: 68 69 73 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 his.editor.input
0002dc70: 73 2e 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 s.currentPagePoi
0002dc80: 6e 74 2e 63 6c 6f 6e 65 28 29 7d 3b 63 61 6e 43 nt.clone()};canC
0002dc90: 6c 6f 73 65 28 29 7b 72 65 74 75 72 6e 22 68 69 lose(){return"hi
0002dca0: 67 68 6c 69 67 68 74 22 21 3d 3d 74 68 69 73 2e ghlight"!==this.
0002dcb0: 73 68 61 70 65 54 79 70 65 7d 67 65 74 49 73 43 shapeType}getIsC
0002dcc0: 6c 6f 73 65 64 28 65 2c 74 29 7b 69 66 28 21 74 losed(e,t){if(!t
0002dcd0: 68 69 73 2e 63 61 6e 43 6c 6f 73 65 28 29 29 72 his.canClose())r
0002dce0: 65 74 75 72 6e 21 31 3b 63 6f 6e 73 74 20 6e 3d eturn!1;const n=
0002dcf0: 50 62 5b 74 5d 2c 72 3d 65 5b 30 5d 2e 70 6f 69 Pb[t],r=e[0].poi
0002dd00: 6e 74 73 5b 30 5d 2c 6f 3d 65 5b 65 2e 6c 65 6e nts[0],o=e[e.len
0002dd10: 67 74 68 2d 31 5d 2c 69 3d 6f 2e 70 6f 69 6e 74 gth-1],i=o.point
0002dd20: 73 5b 6f 2e 70 6f 69 6e 74 73 2e 6c 65 6e 67 74 s[o.points.lengt
0002dd30: 68 2d 31 5d 3b 72 65 74 75 72 6e 20 72 21 3d 3d h-1];return r!==
0002dd40: 69 26 26 74 68 69 73 2e 63 75 72 72 65 6e 74 4c i&&this.currentL
0002dd50: 69 6e 65 4c 65 6e 67 74 68 3e 34 2a 6e 26 26 73 ineLength>4*n&&s
0002dd60: 75 2e 44 69 73 74 4d 69 6e 28 72 2c 69 2c 32 2a u.DistMin(r,i,2*
0002dd70: 6e 29 7d 73 74 61 72 74 53 68 61 70 65 28 29 7b n)}startShape(){
0002dd80: 63 6f 6e 73 74 7b 69 6e 70 75 74 73 3a 7b 6f 72 const{inputs:{or
0002dd90: 69 67 69 6e 50 61 67 65 50 6f 69 6e 74 3a 65 2c iginPagePoint:e,
0002dda0: 69 73 50 65 6e 3a 74 7d 7d 3d 74 68 69 73 2e 65 isPen:t}}=this.e
0002ddb0: 64 69 74 6f 72 3b 74 68 69 73 2e 6d 61 72 6b 49 ditor;this.markI
0002ddc0: 64 3d 22 64 72 61 77 20 73 74 61 72 74 20 22 2b d="draw start "+
0002ddd0: 46 66 28 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 Ff(),this.editor
0002dde0: 2e 6d 61 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 .mark(this.markI
0002ddf0: 64 29 3b 63 6f 6e 73 74 7b 7a 3a 6e 3d 2e 35 7d d);const{z:n=.5}
0002de00: 3d 74 68 69 73 2e 69 6e 66 6f 2e 70 6f 69 6e 74 =this.info.point
0002de10: 3b 74 68 69 73 2e 69 73 50 65 6e 3d 74 2c 74 68 ;this.isPen=t,th
0002de20: 69 73 2e 69 73 50 65 6e 4f 72 53 74 79 6c 75 73 is.isPenOrStylus
0002de30: 3d 74 7c 7c 6e 3e 30 26 26 6e 3c 2e 35 7c 7c 6e =t||n>0&&n<.5||n
0002de40: 3e 2e 35 26 26 6e 3c 31 3b 63 6f 6e 73 74 20 72 >.5&&n<1;const r
0002de50: 3d 74 68 69 73 2e 69 73 50 65 6e 4f 72 53 74 79 =this.isPenOrSty
0002de60: 6c 75 73 3f 31 2e 32 35 2a 6e 3a 2e 35 3b 69 66 lus?1.25*n:.5;if
0002de70: 28 74 68 69 73 2e 73 65 67 6d 65 6e 74 4d 6f 64 (this.segmentMod
0002de80: 65 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 6e e=this.editor.in
0002de90: 70 75 74 73 2e 73 68 69 66 74 4b 65 79 3f 22 73 puts.shiftKey?"s
0002dea0: 74 72 61 69 67 68 74 22 3a 22 66 72 65 65 22 2c traight":"free",
0002deb0: 74 68 69 73 2e 64 69 64 4a 75 73 74 53 68 69 66 this.didJustShif
0002dec0: 74 43 6c 69 63 6b 54 6f 45 78 74 65 6e 64 50 72 tClickToExtendPr
0002ded0: 65 76 69 6f 75 73 53 68 61 70 65 4c 69 6e 65 3d eviousShapeLine=
0002dee0: 21 31 2c 74 68 69 73 2e 6c 61 73 74 52 65 63 6f !1,this.lastReco
0002def0: 72 64 65 64 50 6f 69 6e 74 3d 65 2e 63 6c 6f 6e rdedPoint=e.clon
0002df00: 65 28 29 2c 74 68 69 73 2e 69 6e 69 74 69 61 6c e(),this.initial
0002df10: 53 68 61 70 65 29 7b 63 6f 6e 73 74 20 74 3d 74 Shape){const t=t
0002df20: 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 his.editor.getSh
0002df30: 61 70 65 28 74 68 69 73 2e 69 6e 69 74 69 61 6c ape(this.initial
0002df40: 53 68 61 70 65 2e 69 64 29 3b 69 66 28 74 26 26 Shape.id);if(t&&
0002df50: 22 73 74 72 61 69 67 68 74 22 3d 3d 3d 74 68 69 "straight"===thi
0002df60: 73 2e 73 65 67 6d 65 6e 74 4d 6f 64 65 29 7b 74 s.segmentMode){t
0002df70: 68 69 73 2e 64 69 64 4a 75 73 74 53 68 69 66 74 his.didJustShift
0002df80: 43 6c 69 63 6b 54 6f 45 78 74 65 6e 64 50 72 65 ClickToExtendPre
0002df90: 76 69 6f 75 73 53 68 61 70 65 4c 69 6e 65 3d 21 viousShapeLine=!
0002dfa0: 30 3b 63 6f 6e 73 74 20 6e 3d 42 72 28 74 2e 70 0;const n=Br(t.p
0002dfb0: 72 6f 70 73 2e 73 65 67 6d 65 6e 74 73 29 3b 69 rops.segments);i
0002dfc0: 66 28 21 6e 29 74 68 72 6f 77 20 45 72 72 6f 72 f(!n)throw Error
0002dfd0: 28 22 45 78 70 65 63 74 65 64 20 61 20 70 72 65 ("Expected a pre
0002dfe0: 76 69 6f 75 73 20 73 65 67 6d 65 6e 74 21 22 29 vious segment!")
0002dff0: 3b 63 6f 6e 73 74 20 6f 3d 42 72 28 6e 2e 70 6f ;const o=Br(n.po
0002e000: 69 6e 74 73 29 3b 69 66 28 21 6f 29 74 68 72 6f ints);if(!o)thro
0002e010: 77 20 45 72 72 6f 72 28 22 45 78 70 65 63 74 65 w Error("Expecte
0002e020: 64 20 61 20 70 72 65 76 69 6f 75 73 20 70 6f 69 d a previous poi
0002e030: 6e 74 21 22 29 3b 63 6f 6e 73 74 7b 78 3a 69 2c nt!");const{x:i,
0002e040: 79 3a 61 7d 3d 74 68 69 73 2e 65 64 69 74 6f 72 y:a}=this.editor
0002e050: 2e 67 65 74 50 6f 69 6e 74 49 6e 53 68 61 70 65 .getPointInShape
0002e060: 53 70 61 63 65 28 74 2c 65 29 2e 74 6f 46 69 78 Space(t,e).toFix
0002e070: 65 64 28 29 2c 73 3d 7b 74 79 70 65 3a 74 68 69 ed(),s={type:thi
0002e080: 73 2e 73 65 67 6d 65 6e 74 4d 6f 64 65 2c 70 6f s.segmentMode,po
0002e090: 69 6e 74 73 3a 5b 7b 78 3a 6f 2e 78 2c 79 3a 6f ints:[{x:o.x,y:o
0002e0a0: 2e 79 2c 7a 3a 2b 72 2e 74 6f 46 69 78 65 64 28 .y,z:+r.toFixed(
0002e0b0: 32 29 7d 2c 7b 78 3a 69 2c 79 3a 61 2c 7a 3a 2b 2)},{x:i,y:a,z:+
0002e0c0: 72 2e 74 6f 46 69 78 65 64 28 32 29 7d 5d 7d 2c r.toFixed(2)}]},
0002e0d0: 6c 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 6e l=wp.applyToPoin
0002e0e0: 74 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 t(this.editor.ge
0002e0f0: 74 53 68 61 70 65 50 61 67 65 54 72 61 6e 73 66 tShapePageTransf
0002e100: 6f 72 6d 28 74 2e 69 64 29 2c 6f 29 3b 74 68 69 orm(t.id),o);thi
0002e110: 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 65 72 65 s.pagePointWhere
0002e120: 43 75 72 72 65 6e 74 53 65 67 6d 65 6e 74 43 68 CurrentSegmentCh
0002e130: 61 6e 67 65 64 3d 6c 2c 74 68 69 73 2e 70 61 67 anged=l,this.pag
0002e140: 65 50 6f 69 6e 74 57 68 65 72 65 4e 65 78 74 53 ePointWhereNextS
0002e150: 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 6e 75 egmentChanged=nu
0002e160: 6c 6c 3b 63 6f 6e 73 74 20 63 3d 5b 2e 2e 2e 74 ll;const c=[...t
0002e170: 2e 70 72 6f 70 73 2e 73 65 67 6d 65 6e 74 73 2c .props.segments,
0002e180: 73 5d 3b 74 68 69 73 2e 63 75 72 72 65 6e 74 4c s];this.currentL
0002e190: 69 6e 65 4c 65 6e 67 74 68 3c 34 2a 50 62 5b 74 ineLength<4*Pb[t
0002e1a0: 2e 70 72 6f 70 73 2e 73 69 7a 65 5d 26 26 28 74 .props.size]&&(t
0002e1b0: 68 69 73 2e 63 75 72 72 65 6e 74 4c 69 6e 65 4c his.currentLineL
0002e1c0: 65 6e 67 74 68 3d 74 68 69 73 2e 67 65 74 4c 69 ength=this.getLi
0002e1d0: 6e 65 4c 65 6e 67 74 68 28 63 29 29 3b 63 6f 6e neLength(c));con
0002e1e0: 73 74 20 75 3d 7b 69 64 3a 74 2e 69 64 2c 74 79 st u={id:t.id,ty
0002e1f0: 70 65 3a 74 68 69 73 2e 73 68 61 70 65 54 79 70 pe:this.shapeTyp
0002e200: 65 2c 70 72 6f 70 73 3a 7b 73 65 67 6d 65 6e 74 e,props:{segment
0002e210: 73 3a 63 7d 7d 3b 72 65 74 75 72 6e 20 74 68 69 s:c}};return thi
0002e220: 73 2e 63 61 6e 43 6c 6f 73 65 28 29 26 26 28 75 s.canClose()&&(u
0002e230: 2e 70 72 6f 70 73 2e 69 73 43 6c 6f 73 65 64 3d .props.isClosed=
0002e240: 74 68 69 73 2e 67 65 74 49 73 43 6c 6f 73 65 64 this.getIsClosed
0002e250: 28 63 2c 74 2e 70 72 6f 70 73 2e 73 69 7a 65 29 (c,t.props.size)
0002e260: 29 2c 76 6f 69 64 20 74 68 69 73 2e 65 64 69 74 ),void this.edit
0002e270: 6f 72 2e 75 70 64 61 74 65 53 68 61 70 65 73 28 or.updateShapes(
0002e280: 5b 75 5d 29 7d 7d 74 68 69 73 2e 70 61 67 65 50 [u])}}this.pageP
0002e290: 6f 69 6e 74 57 68 65 72 65 43 75 72 72 65 6e 74 ointWhereCurrent
0002e2a0: 53 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d 65 SegmentChanged=e
0002e2b0: 2e 63 6c 6f 6e 65 28 29 3b 63 6f 6e 73 74 20 6f .clone();const o
0002e2c0: 3d 49 73 28 29 3b 74 68 69 73 2e 65 64 69 74 6f =Is();this.edito
0002e2d0: 72 2e 63 72 65 61 74 65 53 68 61 70 65 73 28 5b r.createShapes([
0002e2e0: 7b 69 64 3a 6f 2c 74 79 70 65 3a 74 68 69 73 2e {id:o,type:this.
0002e2f0: 73 68 61 70 65 54 79 70 65 2c 78 3a 65 2e 78 2c shapeType,x:e.x,
0002e300: 79 3a 65 2e 79 2c 70 72 6f 70 73 3a 7b 69 73 50 y:e.y,props:{isP
0002e310: 65 6e 3a 74 68 69 73 2e 69 73 50 65 6e 4f 72 53 en:this.isPenOrS
0002e320: 74 79 6c 75 73 2c 73 63 61 6c 65 3a 74 68 69 73 tylus,scale:this
0002e330: 2e 65 64 69 74 6f 72 2e 75 73 65 72 2e 67 65 74 .editor.user.get
0002e340: 49 73 44 79 6e 61 6d 69 63 52 65 73 69 7a 65 4d IsDynamicResizeM
0002e350: 6f 64 65 28 29 3f 31 2f 74 68 69 73 2e 65 64 69 ode()?1/this.edi
0002e360: 74 6f 72 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c tor.getZoomLevel
0002e370: 28 29 3a 31 2c 73 65 67 6d 65 6e 74 73 3a 5b 7b ():1,segments:[{
0002e380: 74 79 70 65 3a 74 68 69 73 2e 73 65 67 6d 65 6e type:this.segmen
0002e390: 74 4d 6f 64 65 2c 70 6f 69 6e 74 73 3a 5b 7b 78 tMode,points:[{x
0002e3a0: 3a 30 2c 79 3a 30 2c 7a 3a 2b 72 2e 74 6f 46 69 :0,y:0,z:+r.toFi
0002e3b0: 78 65 64 28 32 29 7d 5d 7d 5d 7d 7d 5d 29 2c 74 xed(2)}]}]}}]),t
0002e3c0: 68 69 73 2e 63 75 72 72 65 6e 74 4c 69 6e 65 4c his.currentLineL
0002e3d0: 65 6e 67 74 68 3d 30 2c 74 68 69 73 2e 69 6e 69 ength=0,this.ini
0002e3e0: 74 69 61 6c 53 68 61 70 65 3d 74 68 69 73 2e 65 tialShape=this.e
0002e3f0: 64 69 74 6f 72 2e 67 65 74 53 68 61 70 65 28 6f ditor.getShape(o
0002e400: 29 7d 75 70 64 61 74 65 44 72 61 77 69 6e 67 53 )}updateDrawingS
0002e410: 68 61 70 65 28 29 7b 63 6f 6e 73 74 7b 69 6e 69 hape(){const{ini
0002e420: 74 69 61 6c 53 68 61 70 65 3a 65 7d 3d 74 68 69 tialShape:e}=thi
0002e430: 73 2c 7b 69 6e 70 75 74 73 3a 74 7d 3d 74 68 69 s,{inputs:t}=thi
0002e440: 73 2e 65 64 69 74 6f 72 3b 69 66 28 21 65 29 72 s.editor;if(!e)r
0002e450: 65 74 75 72 6e 3b 63 6f 6e 73 74 7b 69 64 3a 6e eturn;const{id:n
0002e460: 2c 70 72 6f 70 73 3a 7b 73 69 7a 65 3a 72 7d 7d ,props:{size:r}}
0002e470: 3d 65 2c 6f 3d 74 68 69 73 2e 65 64 69 74 6f 72 =e,o=this.editor
0002e480: 2e 67 65 74 53 68 61 70 65 28 6e 29 3b 69 66 28 .getShape(n);if(
0002e490: 21 6f 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 7b !o)return;const{
0002e4a0: 73 65 67 6d 65 6e 74 73 3a 69 7d 3d 6f 2e 70 72 segments:i}=o.pr
0002e4b0: 6f 70 73 2c 7b 78 3a 61 2c 79 3a 73 2c 7a 3a 6c ops,{x:a,y:s,z:l
0002e4c0: 7d 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 }=this.editor.ge
0002e4d0: 74 50 6f 69 6e 74 49 6e 53 68 61 70 65 53 70 61 tPointInShapeSpa
0002e4e0: 63 65 28 6f 2c 74 2e 63 75 72 72 65 6e 74 50 61 ce(o,t.currentPa
0002e4f0: 67 65 50 6f 69 6e 74 29 2e 74 6f 46 69 78 65 64 gePoint).toFixed
0002e500: 28 29 2c 63 3d 7b 78 3a 61 2c 79 3a 73 2c 7a 3a (),c={x:a,y:s,z:
0002e510: 74 68 69 73 2e 69 73 50 65 6e 4f 72 53 74 79 6c this.isPenOrStyl
0002e520: 75 73 3f 2b 28 31 2e 32 35 2a 74 2e 63 75 72 72 us?+(1.25*t.curr
0002e530: 65 6e 74 50 61 67 65 50 6f 69 6e 74 2e 7a 29 2e entPagePoint.z).
0002e540: 74 6f 46 69 78 65 64 28 32 29 3a 2e 35 7d 3b 73 toFixed(2):.5};s
0002e550: 77 69 74 63 68 28 74 68 69 73 2e 73 65 67 6d 65 witch(this.segme
0002e560: 6e 74 4d 6f 64 65 29 7b 63 61 73 65 22 73 74 61 ntMode){case"sta
0002e570: 72 74 69 6e 67 5f 73 74 72 61 69 67 68 74 22 3a rting_straight":
0002e580: 7b 63 6f 6e 73 74 7b 70 61 67 65 50 6f 69 6e 74 {const{pagePoint
0002e590: 57 68 65 72 65 4e 65 78 74 53 65 67 6d 65 6e 74 WhereNextSegment
0002e5a0: 43 68 61 6e 67 65 64 3a 65 7d 3d 74 68 69 73 3b Changed:e}=this;
0002e5b0: 69 66 28 6e 75 6c 6c 3d 3d 3d 65 29 74 68 72 6f if(null===e)thro
0002e5c0: 77 20 45 72 72 6f 72 28 22 57 65 20 73 68 6f 75 w Error("We shou
0002e5d0: 6c 64 20 68 61 76 65 20 61 20 70 6f 69 6e 74 20 ld have a point
0002e5e0: 77 68 65 72 65 20 74 68 65 20 73 65 67 6d 65 6e where the segmen
0002e5f0: 74 20 63 68 61 6e 67 65 64 22 29 3b 69 66 28 73 t changed");if(s
0002e600: 75 2e 44 69 73 74 32 28 65 2c 74 2e 63 75 72 72 u.Dist2(e,t.curr
0002e610: 65 6e 74 50 61 67 65 50 6f 69 6e 74 29 3e 74 68 entPagePoint)>th
0002e620: 69 73 2e 65 64 69 74 6f 72 2e 6f 70 74 69 6f 6e is.editor.option
0002e630: 73 2e 64 72 61 67 44 69 73 74 61 6e 63 65 53 71 s.dragDistanceSq
0002e640: 75 61 72 65 64 29 7b 74 68 69 73 2e 70 61 67 65 uared){this.page
0002e650: 50 6f 69 6e 74 57 68 65 72 65 43 75 72 72 65 6e PointWhereCurren
0002e660: 74 53 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d tSegmentChanged=
0002e670: 74 68 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 this.pagePointWh
0002e680: 65 72 65 4e 65 78 74 53 65 67 6d 65 6e 74 43 68 ereNextSegmentCh
0002e690: 61 6e 67 65 64 2e 63 6c 6f 6e 65 28 29 2c 74 68 anged.clone(),th
0002e6a0: 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 65 72 is.pagePointWher
0002e6b0: 65 4e 65 78 74 53 65 67 6d 65 6e 74 43 68 61 6e eNextSegmentChan
0002e6c0: 67 65 64 3d 6e 75 6c 6c 2c 74 68 69 73 2e 73 65 ged=null,this.se
0002e6d0: 67 6d 65 6e 74 4d 6f 64 65 3d 22 73 74 72 61 69 gmentMode="strai
0002e6e0: 67 68 74 22 3b 63 6f 6e 73 74 20 65 3d 42 72 28 ght";const e=Br(
0002e6f0: 69 29 3b 69 66 28 21 65 29 74 68 72 6f 77 20 45 i);if(!e)throw E
0002e700: 72 72 6f 72 28 22 45 78 70 65 63 74 65 64 20 61 rror("Expected a
0002e710: 20 70 72 65 76 69 6f 75 73 20 73 65 67 6d 65 6e previous segmen
0002e720: 74 21 22 29 3b 63 6f 6e 73 74 20 74 3d 42 72 28 t!");const t=Br(
0002e730: 65 2e 70 6f 69 6e 74 73 29 3b 69 66 28 21 74 29 e.points);if(!t)
0002e740: 74 68 72 6f 77 20 45 72 72 6f 72 28 22 45 78 70 throw Error("Exp
0002e750: 65 63 74 65 64 20 61 20 70 72 65 76 69 6f 75 73 ected a previous
0002e760: 20 6c 61 73 74 20 70 6f 69 6e 74 21 22 29 3b 6c last point!");l
0002e770: 65 74 20 61 3b 63 6f 6e 73 74 20 73 3d 74 68 69 et a;const s=thi
0002e780: 73 2e 65 64 69 74 6f 72 2e 67 65 74 50 6f 69 6e s.editor.getPoin
0002e790: 74 49 6e 53 68 61 70 65 53 70 61 63 65 28 6f 2c tInShapeSpace(o,
0002e7a0: 74 68 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 this.pagePointWh
0002e7b0: 65 72 65 43 75 72 72 65 6e 74 53 65 67 6d 65 6e ereCurrentSegmen
0002e7c0: 74 43 68 61 6e 67 65 64 29 2e 74 6f 46 69 78 65 tChanged).toFixe
0002e7d0: 64 28 29 2e 74 6f 4a 73 6f 6e 28 29 3b 69 66 28 d().toJson();if(
0002e7e0: 22 73 74 72 61 69 67 68 74 22 3d 3d 3d 65 2e 74 "straight"===e.t
0002e7f0: 79 70 65 29 7b 74 68 69 73 2e 63 75 72 72 65 6e ype){this.curren
0002e800: 74 4c 69 6e 65 4c 65 6e 67 74 68 2b 3d 73 75 2e tLineLength+=su.
0002e810: 44 69 73 74 28 74 2c 73 29 2c 61 3d 7b 74 79 70 Dist(t,s),a={typ
0002e820: 65 3a 22 73 74 72 61 69 67 68 74 22 2c 70 6f 69 e:"straight",poi
0002e830: 6e 74 73 3a 5b 7b 2e 2e 2e 74 7d 2c 73 5d 7d 3b nts:[{...t},s]};
0002e840: 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 65 64 69 const e=this.edi
0002e850: 74 6f 72 2e 67 65 74 53 68 61 70 65 50 61 67 65 tor.getShapePage
0002e860: 54 72 61 6e 73 66 6f 72 6d 28 6f 29 3b 74 68 69 Transform(o);thi
0002e870: 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 65 72 65 s.pagePointWhere
0002e880: 43 75 72 72 65 6e 74 53 65 67 6d 65 6e 74 43 68 CurrentSegmentCh
0002e890: 61 6e 67 65 64 3d 77 70 2e 61 70 70 6c 79 54 6f anged=wp.applyTo
0002e8a0: 50 6f 69 6e 74 28 65 2c 74 29 7d 65 6c 73 65 20 Point(e,t)}else
0002e8b0: 61 3d 7b 74 79 70 65 3a 22 73 74 72 61 69 67 68 a={type:"straigh
0002e8c0: 74 22 2c 70 6f 69 6e 74 73 3a 5b 73 2c 63 5d 7d t",points:[s,c]}
0002e8d0: 3b 63 6f 6e 73 74 20 6c 3d 7b 69 64 3a 6e 2c 74 ;const l={id:n,t
0002e8e0: 79 70 65 3a 74 68 69 73 2e 73 68 61 70 65 54 79 ype:this.shapeTy
0002e8f0: 70 65 2c 70 72 6f 70 73 3a 7b 73 65 67 6d 65 6e pe,props:{segmen
0002e900: 74 73 3a 5b 2e 2e 2e 69 2c 61 5d 7d 7d 3b 74 68 ts:[...i,a]}};th
0002e910: 69 73 2e 63 61 6e 43 6c 6f 73 65 28 29 26 26 28 is.canClose()&&(
0002e920: 6c 2e 70 72 6f 70 73 2e 69 73 43 6c 6f 73 65 64 l.props.isClosed
0002e930: 3d 74 68 69 73 2e 67 65 74 49 73 43 6c 6f 73 65 =this.getIsClose
0002e940: 64 28 69 2c 72 29 29 2c 74 68 69 73 2e 65 64 69 d(i,r)),this.edi
0002e950: 74 6f 72 2e 75 70 64 61 74 65 53 68 61 70 65 73 tor.updateShapes
0002e960: 28 5b 6c 5d 29 7d 62 72 65 61 6b 7d 63 61 73 65 ([l])}break}case
0002e970: 22 73 74 61 72 74 69 6e 67 5f 66 72 65 65 22 3a "starting_free":
0002e980: 7b 63 6f 6e 73 74 7b 70 61 67 65 50 6f 69 6e 74 {const{pagePoint
0002e990: 57 68 65 72 65 4e 65 78 74 53 65 67 6d 65 6e 74 WhereNextSegment
0002e9a0: 43 68 61 6e 67 65 64 3a 65 7d 3d 74 68 69 73 3b Changed:e}=this;
0002e9b0: 69 66 28 6e 75 6c 6c 3d 3d 3d 65 29 74 68 72 6f if(null===e)thro
0002e9c0: 77 20 45 72 72 6f 72 28 22 57 65 20 73 68 6f 75 w Error("We shou
0002e9d0: 6c 64 20 68 61 76 65 20 61 20 70 6f 69 6e 74 20 ld have a point
0002e9e0: 77 68 65 72 65 20 74 68 65 20 73 65 67 6d 65 6e where the segmen
0002e9f0: 74 20 63 68 61 6e 67 65 64 22 29 3b 69 66 28 73 t changed");if(s
0002ea00: 75 2e 44 69 73 74 32 28 65 2c 74 2e 63 75 72 72 u.Dist2(e,t.curr
0002ea10: 65 6e 74 50 61 67 65 50 6f 69 6e 74 29 3e 74 68 entPagePoint)>th
0002ea20: 69 73 2e 65 64 69 74 6f 72 2e 6f 70 74 69 6f 6e is.editor.option
0002ea30: 73 2e 64 72 61 67 44 69 73 74 61 6e 63 65 53 71 s.dragDistanceSq
0002ea40: 75 61 72 65 64 29 7b 74 68 69 73 2e 70 61 67 65 uared){this.page
0002ea50: 50 6f 69 6e 74 57 68 65 72 65 43 75 72 72 65 6e PointWhereCurren
0002ea60: 74 53 65 67 6d 65 6e 74 43 68 61 6e 67 65 64 3d tSegmentChanged=
0002ea70: 74 68 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 this.pagePointWh
0002ea80: 65 72 65 4e 65 78 74 53 65 67 6d 65 6e 74 43 68 ereNextSegmentCh
0002ea90: 61 6e 67 65 64 2e 63 6c 6f 6e 65 28 29 2c 74 68 anged.clone(),th
0002eaa0: 69 73 2e 70 61 67 65 50 6f 69 6e 74 57 68 65 72 is.pagePointWher
0002eab0: 65 4e 65 78 74 53 65 67 6d 65 6e 74 43 68 61 6e eNextSegmentChan
0002eac0: 67 65 64 3d 6e 75 6c 6c 2c 74 68 69 73 2e 73 65 ged=null,this.se
0002ead0: 67 6d 65 6e 74 4d 6f 64 65 3d 22 66 72 65 65 22 gmentMode="free"
0002eae0: 3b 63 6f 6e 73 74 20 65 3d 69 2e 73 6c 69 63 65 ;const e=i.slice
0002eaf0: 28 29 2c 74 3d 42 72 28 65 5b 65 2e 6c 65 6e 67 (),t=Br(e[e.leng
0002eb00: 74 68 2d 31 5d 2e 70 6f 69 6e 74 73 29 3b 69 66 th-1].points);if
0002eb10: 28 21 74 29 74 68 72 6f 77 20 45 72 72 6f 72 28 (!t)throw Error(
0002eb20: 22 4e 6f 20 70 72 65 76 69 6f 75 73 20 70 6f 69 "No previous poi
0002eb30: 6e 74 21 22 29 3b 63 6f 6e 73 74 20 61 3d 7b 74 nt!");const a={t
0002eb40: 79 70 65 3a 22 66 72 65 65 22 2c 70 6f 69 6e 74 ype:"free",point
0002eb50: 73 3a 5b 2e 2e 2e 73 75 2e 50 6f 69 6e 74 73 42 s:[...su.PointsB
0002eb60: 65 74 77 65 65 6e 28 74 2c 63 2c 36 29 2e 6d 61 etween(t,c,6).ma
0002eb70: 70 28 28 65 3d 3e 28 7b 78 3a 50 75 28 65 2e 78 p((e=>({x:Pu(e.x
0002eb80: 29 2c 79 3a 50 75 28 65 2e 79 29 2c 7a 3a 50 75 ),y:Pu(e.y),z:Pu
0002eb90: 28 65 2e 7a 29 7d 29 29 29 5d 7d 2c 73 3d 5b 2e (e.z)})))]},s=[.
0002eba0: 2e 2e 65 2c 61 5d 3b 74 68 69 73 2e 63 75 72 72 ..e,a];this.curr
0002ebb0: 65 6e 74 4c 69 6e 65 4c 65 6e 67 74 68 3c 34 2a entLineLength<4*
0002ebc0: 50 62 5b 6f 2e 70 72 6f 70 73 2e 73 69 7a 65 5d Pb[o.props.size]
0002ebd0: 26 26 28 74 68 69 73 2e 63 75 72 72 65 6e 74 4c &&(this.currentL
0002ebe0: 69 6e 65 4c 65 6e 67 74 68 3d 74 68 69 73 2e 67 ineLength=this.g
0002ebf0: 65 74 4c 69 6e 65 4c 65 6e 67 74 68 28 73 29 29 etLineLength(s))
0002ec00: 3b 63 6f 6e 73 74 20 6c 3d 7b 69 64 3a 6e 2c 74 ;const l={id:n,t
0002ec10: 79 70 65 3a 74 68 69 73 2e 73 68 61 70 65 54 79 ype:this.shapeTy
0002ec20: 70 65 2c 70 72 6f 70 73 3a 7b 73 65 67 6d 65 6e pe,props:{segmen
0002ec30: 74 73 3a 73 7d 7d 3b 74 68 69 73 2e 63 61 6e 43 ts:s}};this.canC
0002ec40: 6c 6f 73 65 28 29 26 26 28 6c 2e 70 72 6f 70 73 lose()&&(l.props
0002ec50: 2e 69 73 43 6c 6f 73 65 64 3d 74 68 69 73 2e 67 .isClosed=this.g
0002ec60: 65 74 49 73 43 6c 6f 73 65 64 28 73 2c 72 29 29 etIsClosed(s,r))
0002ec70: 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 70 64 ,this.editor.upd
0002ec80: 61 74 65 53 68 61 70 65 73 28 5b 6c 5d 29 7d 62 ateShapes([l])}b
0002ec90: 72 65 61 6b 7d 63 61 73 65 22 73 74 72 61 69 67 reak}case"straig
0002eca0: 68 74 22 3a 7b 63 6f 6e 73 74 20 65 3d 69 2e 73 ht":{const e=i.s
0002ecb0: 6c 69 63 65 28 29 2c 74 3d 65 5b 65 2e 6c 65 6e lice(),t=e[e.len
0002ecc0: 67 74 68 2d 31 5d 2c 7b 70 61 67 65 50 6f 69 6e gth-1],{pagePoin
0002ecd0: 74 57 68 65 72 65 43 75 72 72 65 6e 74 53 65 67 tWhereCurrentSeg
0002ece0: 6d 65 6e 74 43 68 61 6e 67 65 64 3a 61 7d 3d 74 mentChanged:a}=t
0002ecf0: 68 69 73 2c 7b 63 74 72 6c 4b 65 79 3a 73 2c 63 his,{ctrlKey:s,c
0002ed00: 75 72 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 3a urrentPagePoint:
0002ed10: 6c 7d 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 l}=this.editor.i
0002ed20: 6e 70 75 74 73 3b 69 66 28 21 61 29 74 68 72 6f nputs;if(!a)thro
0002ed30: 77 20 45 72 72 6f 72 28 22 57 65 20 73 68 6f 75 w Error("We shou
0002ed40: 6c 64 20 68 61 76 65 20 61 20 70 6f 69 6e 74 20 ld have a point
0002ed50: 77 68 65 72 65 20 74 68 65 20 73 65 67 6d 65 6e where the segmen
0002ed60: 74 20 63 68 61 6e 67 65 64 22 29 3b 6c 65 74 20 t changed");let
0002ed70: 63 2c 75 3d 21 31 3b 74 68 69 73 2e 64 69 64 4a c,u=!1;this.didJ
0002ed80: 75 73 74 53 68 69 66 74 43 6c 69 63 6b 54 6f 45 ustShiftClickToE
0002ed90: 78 74 65 6e 64 50 72 65 76 69 6f 75 73 53 68 61 xtendPreviousSha
0002eda0: 70 65 4c 69 6e 65 3f 74 68 69 73 2e 65 64 69 74 peLine?this.edit
0002edb0: 6f 72 2e 69 6e 70 75 74 73 2e 69 73 44 72 61 67 or.inputs.isDrag
0002edc0: 67 69 6e 67 26 26 28 75 3d 21 73 2c 74 68 69 73 ging&&(u=!s,this
0002edd0: 2e 64 69 64 4a 75 73 74 53 68 69 66 74 43 6c 69 .didJustShiftCli
0002ede0: 63 6b 54 6f 45 78 74 65 6e 64 50 72 65 76 69 6f ckToExtendPrevio
0002edf0: 75 73 53 68 61 70 65 4c 69 6e 65 3d 21 31 29 3a usShapeLine=!1):
0002ee00: 75 3d 21 73 3b 6c 65 74 20 64 2c 70 3d 74 68 69 u=!s;let d,p=thi
0002ee10: 73 2e 65 64 69 74 6f 72 2e 67 65 74 50 6f 69 6e s.editor.getPoin
0002ee20: 74 49 6e 53 68 61 70 65 53 70 61 63 65 28 6f 2c tInShapeSpace(o,
0002ee30: 6c 29 2e 74 6f 46 69 78 65 64 28 29 2e 74 6f 4a l).toFixed().toJ
0002ee40: 73 6f 6e 28 29 2c 66 3d 21 31 3b 69 66 28 28 74 son(),f=!1;if((t
0002ee50: 68 69 73 2e 65 64 69 74 6f 72 2e 75 73 65 72 2e his.editor.user.
0002ee60: 67 65 74 49 73 53 6e 61 70 4d 6f 64 65 28 29 3f getIsSnapMode()?
0002ee70: 21 73 3a 73 29 26 26 65 2e 6c 65 6e 67 74 68 3e !s:s)&&e.length>
0002ee80: 32 29 7b 6c 65 74 20 65 2c 74 3d 38 2f 74 68 69 2){let e,t=8/thi
0002ee90: 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f 6d s.editor.getZoom
0002eea0: 4c 65 76 65 6c 28 29 3b 66 6f 72 28 6c 65 74 20 Level();for(let
0002eeb0: 6e 3d 30 2c 72 3d 69 2e 6c 65 6e 67 74 68 2d 32 n=0,r=i.length-2
0002eec0: 3b 6e 3c 72 3b 6e 2b 2b 29 7b 63 6f 6e 73 74 20 ;n<r;n++){const
0002eed0: 72 3d 69 5b 6e 5d 3b 69 66 28 21 72 29 62 72 65 r=i[n];if(!r)bre
0002eee0: 61 6b 3b 69 66 28 22 66 72 65 65 22 3d 3d 3d 72 ak;if("free"===r
0002eef0: 2e 74 79 70 65 29 63 6f 6e 74 69 6e 75 65 3b 63 .type)continue;c
0002ef00: 6f 6e 73 74 20 6f 3d 72 2e 70 6f 69 6e 74 73 5b onst o=r.points[
0002ef10: 30 5d 2c 61 3d 42 72 28 72 2e 70 6f 69 6e 74 73 0],a=Br(r.points
0002ef20: 29 3b 69 66 28 21 6f 7c 7c 21 61 29 63 6f 6e 74 );if(!o||!a)cont
0002ef30: 69 6e 75 65 3b 63 6f 6e 73 74 20 73 3d 73 75 2e inue;const s=su.
0002ef40: 4e 65 61 72 65 73 74 50 6f 69 6e 74 4f 6e 4c 69 NearestPointOnLi
0002ef50: 6e 65 53 65 67 6d 65 6e 74 28 6f 2c 61 2c 70 29 neSegment(o,a,p)
0002ef60: 3b 69 66 28 73 75 2e 44 69 73 74 4d 69 6e 28 73 ;if(su.DistMin(s
0002ef70: 2c 70 2c 74 29 29 7b 65 3d 73 2e 74 6f 46 69 78 ,p,t)){e=s.toFix
0002ef80: 65 64 28 29 2e 74 6f 4a 73 6f 6e 28 29 2c 74 3d ed().toJson(),t=
0002ef90: 73 75 2e 44 69 73 74 28 73 2c 70 29 2c 64 3d 72 su.Dist(s,p),d=r
0002efa0: 3b 62 72 65 61 6b 7d 7d 65 26 26 28 66 3d 21 30 ;break}}e&&(f=!0
0002efb0: 2c 70 3d 65 29 7d 69 66 28 66 26 26 64 29 7b 63 ,p=e)}if(f&&d){c
0002efc0: 6f 6e 73 74 20 65 3d 74 68 69 73 2e 65 64 69 74 onst e=this.edit
0002efd0: 6f 72 2e 67 65 74 53 68 61 70 65 50 61 67 65 54 or.getShapePageT
0002efe0: 72 61 6e 73 66 6f 72 6d 28 6f 29 2c 74 3d 64 2e ransform(o),t=d.
0002eff0: 70 6f 69 6e 74 73 5b 30 5d 2c 6e 3d 42 72 28 64 points[0],n=Br(d
0002f000: 2e 70 6f 69 6e 74 73 29 3b 69 66 28 21 6e 29 74 .points);if(!n)t
0002f010: 68 72 6f 77 20 45 72 72 6f 72 28 22 45 78 70 65 hrow Error("Expe
0002f020: 63 74 65 64 20 61 20 6c 61 73 74 20 70 6f 69 6e cted a last poin
0002f030: 74 21 22 29 3b 63 6f 6e 73 74 20 72 3d 77 70 2e t!");const r=wp.
0002f040: 61 70 70 6c 79 54 6f 50 6f 69 6e 74 28 65 2c 74 applyToPoint(e,t
0002f050: 29 2c 69 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f ),i=wp.applyToPo
0002f060: 69 6e 74 28 65 2c 6e 29 2c 61 3d 77 70 2e 61 70 int(e,n),a=wp.ap
0002f070: 70 6c 79 54 6f 50 6f 69 6e 74 28 65 2c 70 29 3b plyToPoint(e,p);
0002f080: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 6e 61 70 this.editor.snap
0002f090: 73 2e 73 65 74 49 6e 64 69 63 61 74 6f 72 73 28 s.setIndicators(
0002f0a0: 5b 7b 69 64 3a 46 66 28 29 2c 74 79 70 65 3a 22 [{id:Ff(),type:"
0002f0b0: 70 6f 69 6e 74 73 22 2c 70 6f 69 6e 74 73 3a 5b points",points:[
0002f0c0: 72 2c 61 2c 69 5d 7d 5d 29 7d 65 6c 73 65 7b 69 r,a,i]}])}else{i
0002f0d0: 66 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 6e f(this.editor.sn
0002f0e0: 61 70 73 2e 63 6c 65 61 72 49 6e 64 69 63 61 74 aps.clearIndicat
0002f0f0: 6f 72 73 28 29 2c 75 29 7b 63 6f 6e 73 74 20 65 ors(),u){const e
0002f100: 3d 73 75 2e 41 6e 67 6c 65 28 61 2c 6c 29 2c 74 =su.Angle(a,l),t
0002f110: 3d 78 75 28 65 2c 32 34 29 2d 65 3b 63 3d 73 75 =xu(e,24)-e;c=su
0002f120: 2e 52 6f 74 57 69 74 68 28 6c 2c 61 2c 74 29 7d .RotWith(l,a,t)}
0002f130: 65 6c 73 65 20 63 3d 6c 3b 70 3d 74 68 69 73 2e else c=l;p=this.
0002f140: 65 64 69 74 6f 72 2e 67 65 74 50 6f 69 6e 74 49 editor.getPointI
0002f150: 6e 53 68 61 70 65 53 70 61 63 65 28 6f 2c 63 29 nShapeSpace(o,c)
0002f160: 2e 74 6f 46 69 78 65 64 28 29 2e 74 6f 4a 73 6f .toFixed().toJso
0002f170: 6e 28 29 7d 74 68 69 73 2e 63 75 72 72 65 6e 74 n()}this.current
0002f180: 4c 69 6e 65 4c 65 6e 67 74 68 2b 3d 73 75 2e 44 LineLength+=su.D
0002f190: 69 73 74 28 74 2e 70 6f 69 6e 74 73 5b 30 5d 2c ist(t.points[0],
0002f1a0: 70 29 2c 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 5d p),e[e.length-1]
0002f1b0: 3d 7b 2e 2e 2e 74 2c 74 79 70 65 3a 22 73 74 72 ={...t,type:"str
0002f1c0: 61 69 67 68 74 22 2c 70 6f 69 6e 74 73 3a 5b 74 aight",points:[t
0002f1d0: 2e 70 6f 69 6e 74 73 5b 30 5d 2c 70 5d 7d 3b 63 .points[0],p]};c
0002f1e0: 6f 6e 73 74 20 68 3d 7b 69 64 3a 6e 2c 74 79 70 onst h={id:n,typ
0002f1f0: 65 3a 74 68 69 73 2e 73 68 61 70 65 54 79 70 65 e:this.shapeType
0002f200: 2c 70 72 6f 70 73 3a 7b 73 65 67 6d 65 6e 74 73 ,props:{segments
0002f210: 3a 65 7d 7d 3b 74 68 69 73 2e 63 61 6e 43 6c 6f :e}};this.canClo
0002f220: 73 65 28 29 26 26 28 68 2e 70 72 6f 70 73 2e 69 se()&&(h.props.i
0002f230: 73 43 6c 6f 73 65 64 3d 74 68 69 73 2e 67 65 74 sClosed=this.get
0002f240: 49 73 43 6c 6f 73 65 64 28 69 2c 72 29 29 2c 74 IsClosed(i,r)),t
0002f250: 68 69 73 2e 65 64 69 74 6f 72 2e 75 70 64 61 74 his.editor.updat
0002f260: 65 53 68 61 70 65 73 28 5b 68 5d 29 3b 62 72 65 eShapes([h]);bre
0002f270: 61 6b 7d 63 61 73 65 22 66 72 65 65 22 3a 7b 63 ak}case"free":{c
0002f280: 6f 6e 73 74 20 65 3d 69 2e 73 6c 69 63 65 28 29 onst e=i.slice()
0002f290: 2c 61 3d 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 5d ,a=e[e.length-1]
0002f2a0: 2c 73 3d 5b 2e 2e 2e 61 2e 70 6f 69 6e 74 73 5d ,s=[...a.points]
0002f2b0: 3b 69 66 28 73 2e 6c 65 6e 67 74 68 26 26 74 68 ;if(s.length&&th
0002f2c0: 69 73 2e 6d 65 72 67 65 4e 65 78 74 50 6f 69 6e is.mergeNextPoin
0002f2d0: 74 29 7b 63 6f 6e 73 74 7b 7a 3a 65 7d 3d 73 5b t){const{z:e}=s[
0002f2e0: 73 2e 6c 65 6e 67 74 68 2d 31 5d 3b 73 5b 73 2e s.length-1];s[s.
0002f2f0: 6c 65 6e 67 74 68 2d 31 5d 3d 7b 78 3a 63 2e 78 length-1]={x:c.x
0002f300: 2c 79 3a 63 2e 79 2c 7a 3a 65 3f 4d 61 74 68 2e ,y:c.y,z:e?Math.
0002f310: 6d 61 78 28 65 2c 63 2e 7a 29 3a 63 2e 7a 7d 7d max(e,c.z):c.z}}
0002f320: 65 6c 73 65 20 74 68 69 73 2e 63 75 72 72 65 6e else this.curren
0002f330: 74 4c 69 6e 65 4c 65 6e 67 74 68 2b 3d 73 75 2e tLineLength+=su.
0002f340: 44 69 73 74 28 73 5b 73 2e 6c 65 6e 67 74 68 2d Dist(s[s.length-
0002f350: 31 5d 2c 63 29 2c 73 2e 70 75 73 68 28 63 29 3b 1],c),s.push(c);
0002f360: 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 5d 3d 7b 2e e[e.length-1]={.
0002f370: 2e 2e 61 2c 70 6f 69 6e 74 73 3a 73 7d 2c 74 68 ..a,points:s},th
0002f380: 69 73 2e 63 75 72 72 65 6e 74 4c 69 6e 65 4c 65 is.currentLineLe
0002f390: 6e 67 74 68 3c 34 2a 50 62 5b 6f 2e 70 72 6f 70 ngth<4*Pb[o.prop
0002f3a0: 73 2e 73 69 7a 65 5d 26 26 28 74 68 69 73 2e 63 s.size]&&(this.c
0002f3b0: 75 72 72 65 6e 74 4c 69 6e 65 4c 65 6e 67 74 68 urrentLineLength
0002f3c0: 3d 74 68 69 73 2e 67 65 74 4c 69 6e 65 4c 65 6e =this.getLineLen
0002f3d0: 67 74 68 28 65 29 29 3b 63 6f 6e 73 74 20 75 3d gth(e));const u=
0002f3e0: 7b 69 64 3a 6e 2c 74 79 70 65 3a 74 68 69 73 2e {id:n,type:this.
0002f3f0: 73 68 61 70 65 54 79 70 65 2c 70 72 6f 70 73 3a shapeType,props:
0002f400: 7b 73 65 67 6d 65 6e 74 73 3a 65 7d 7d 3b 69 66 {segments:e}};if
0002f410: 28 74 68 69 73 2e 63 61 6e 43 6c 6f 73 65 28 29 (this.canClose()
0002f420: 26 26 28 75 2e 70 72 6f 70 73 2e 69 73 43 6c 6f &&(u.props.isClo
0002f430: 73 65 64 3d 74 68 69 73 2e 67 65 74 49 73 43 6c sed=this.getIsCl
0002f440: 6f 73 65 64 28 65 2c 72 29 29 2c 74 68 69 73 2e osed(e,r)),this.
0002f450: 65 64 69 74 6f 72 2e 75 70 64 61 74 65 53 68 61 editor.updateSha
0002f460: 70 65 73 28 5b 75 5d 29 2c 73 2e 6c 65 6e 67 74 pes([u]),s.lengt
0002f470: 68 3e 74 68 69 73 2e 65 64 69 74 6f 72 2e 6f 70 h>this.editor.op
0002f480: 74 69 6f 6e 73 2e 6d 61 78 50 6f 69 6e 74 73 50 tions.maxPointsP
0002f490: 65 72 44 72 61 77 53 68 61 70 65 29 7b 74 68 69 erDrawShape){thi
0002f4a0: 73 2e 65 64 69 74 6f 72 2e 75 70 64 61 74 65 53 s.editor.updateS
0002f4b0: 68 61 70 65 73 28 5b 7b 69 64 3a 6e 2c 74 79 70 hapes([{id:n,typ
0002f4c0: 65 3a 74 68 69 73 2e 73 68 61 70 65 54 79 70 65 e:this.shapeType
0002f4d0: 2c 70 72 6f 70 73 3a 7b 69 73 43 6f 6d 70 6c 65 ,props:{isComple
0002f4e0: 74 65 3a 21 30 7d 7d 5d 29 3b 63 6f 6e 73 74 20 te:!0}}]);const
0002f4f0: 65 3d 49 73 28 29 2c 72 3d 74 68 69 73 2e 65 64 e=Is(),r=this.ed
0002f500: 69 74 6f 72 2e 67 65 74 53 68 61 70 65 28 6e 29 itor.getShape(n)
0002f510: 2e 70 72 6f 70 73 3b 74 68 69 73 2e 65 64 69 74 .props;this.edit
0002f520: 6f 72 2e 63 72 65 61 74 65 53 68 61 70 65 73 28 or.createShapes(
0002f530: 5b 7b 69 64 3a 65 2c 74 79 70 65 3a 74 68 69 73 [{id:e,type:this
0002f540: 2e 73 68 61 70 65 54 79 70 65 2c 78 3a 50 75 28 .shapeType,x:Pu(
0002f550: 74 2e 63 75 72 72 65 6e 74 50 61 67 65 50 6f 69 t.currentPagePoi
0002f560: 6e 74 2e 78 29 2c 79 3a 50 75 28 74 2e 63 75 72 nt.x),y:Pu(t.cur
0002f570: 72 65 6e 74 50 61 67 65 50 6f 69 6e 74 2e 79 29 rentPagePoint.y)
0002f580: 2c 70 72 6f 70 73 3a 7b 69 73 50 65 6e 3a 74 68 ,props:{isPen:th
0002f590: 69 73 2e 69 73 50 65 6e 4f 72 53 74 79 6c 75 73 is.isPenOrStylus
0002f5a0: 2c 73 63 61 6c 65 3a 72 2e 73 63 61 6c 65 2c 73 ,scale:r.scale,s
0002f5b0: 65 67 6d 65 6e 74 73 3a 5b 7b 74 79 70 65 3a 22 egments:[{type:"
0002f5c0: 66 72 65 65 22 2c 70 6f 69 6e 74 73 3a 5b 7b 78 free",points:[{x
0002f5d0: 3a 30 2c 79 3a 30 2c 7a 3a 74 68 69 73 2e 69 73 :0,y:0,z:this.is
0002f5e0: 50 65 6e 4f 72 53 74 79 6c 75 73 3f 2b 28 31 2e PenOrStylus?+(1.
0002f5f0: 32 35 2a 6c 29 2e 74 6f 46 69 78 65 64 28 29 3a 25*l).toFixed():
0002f600: 2e 35 7d 5d 7d 5d 7d 7d 5d 29 2c 74 68 69 73 2e .5}]}]}}]),this.
0002f610: 69 6e 69 74 69 61 6c 53 68 61 70 65 3d 64 69 28 initialShape=di(
0002f620: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
0002f630: 68 61 70 65 28 65 29 29 2c 74 68 69 73 2e 6d 65 hape(e)),this.me
0002f640: 72 67 65 4e 65 78 74 50 6f 69 6e 74 3d 21 31 2c rgeNextPoint=!1,
0002f650: 74 68 69 73 2e 6c 61 73 74 52 65 63 6f 72 64 65 this.lastRecorde
0002f660: 64 50 6f 69 6e 74 3d 74 2e 63 75 72 72 65 6e 74 dPoint=t.current
0002f670: 50 61 67 65 50 6f 69 6e 74 2e 63 6c 6f 6e 65 28 PagePoint.clone(
0002f680: 29 2c 74 68 69 73 2e 63 75 72 72 65 6e 74 4c 69 ),this.currentLi
0002f690: 6e 65 4c 65 6e 67 74 68 3d 30 7d 62 72 65 61 6b neLength=0}break
0002f6a0: 7d 7d 7d 67 65 74 4c 69 6e 65 4c 65 6e 67 74 68 }}}getLineLength
0002f6b0: 28 65 29 7b 6c 65 74 20 74 3d 30 3b 66 6f 72 28 (e){let t=0;for(
0002f6c0: 63 6f 6e 73 74 20 6e 20 6f 66 20 65 29 66 6f 72 const n of e)for
0002f6d0: 28 6c 65 74 20 65 3d 30 3b 65 3c 6e 2e 70 6f 69 (let e=0;e<n.poi
0002f6e0: 6e 74 73 2e 6c 65 6e 67 74 68 2d 31 3b 65 2b 2b nts.length-1;e++
0002f6f0: 29 7b 63 6f 6e 73 74 20 72 3d 6e 2e 70 6f 69 6e ){const r=n.poin
0002f700: 74 73 5b 65 5d 2c 6f 3d 6e 2e 70 6f 69 6e 74 73 ts[e],o=n.points
0002f710: 5b 65 2b 31 5d 3b 74 2b 3d 73 75 2e 44 69 73 74 [e+1];t+=su.Dist
0002f720: 32 28 6f 2c 72 29 7d 72 65 74 75 72 6e 20 4d 61 2(o,r)}return Ma
0002f730: 74 68 2e 73 71 72 74 28 74 29 7d 6f 6e 50 6f 69 th.sqrt(t)}onPoi
0002f740: 6e 74 65 72 55 70 3d 28 29 3d 3e 7b 74 68 69 73 nterUp=()=>{this
0002f750: 2e 63 6f 6d 70 6c 65 74 65 28 29 7d 3b 6f 6e 43 .complete()};onC
0002f760: 61 6e 63 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e ancel=()=>{this.
0002f770: 63 61 6e 63 65 6c 28 29 7d 3b 6f 6e 43 6f 6d 70 cancel()};onComp
0002f780: 6c 65 74 65 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 lete=()=>{this.c
0002f790: 6f 6d 70 6c 65 74 65 28 29 7d 3b 6f 6e 49 6e 74 omplete()};onInt
0002f7a0: 65 72 72 75 70 74 3d 28 29 3d 3e 7b 74 68 69 73 errupt=()=>{this
0002f7b0: 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 2e 69 .editor.inputs.i
0002f7c0: 73 44 72 61 67 67 69 6e 67 7c 7c 28 74 68 69 73 sDragging||(this
0002f7d0: 2e 6d 61 72 6b 49 64 26 26 74 68 69 73 2e 65 64 .markId&&this.ed
0002f7e0: 69 74 6f 72 2e 62 61 69 6c 54 6f 4d 61 72 6b 28 itor.bailToMark(
0002f7f0: 74 68 69 73 2e 6d 61 72 6b 49 64 29 2c 74 68 69 this.markId),thi
0002f800: 73 2e 63 61 6e 63 65 6c 28 29 29 7d 3b 63 6f 6d s.cancel())};com
0002f810: 70 6c 65 74 65 28 29 7b 69 66 28 21 74 68 69 73 plete(){if(!this
0002f820: 2e 63 61 6e 44 72 61 77 29 72 65 74 75 72 6e 20 .canDraw)return
0002f830: 76 6f 69 64 20 74 68 69 73 2e 63 61 6e 63 65 6c void this.cancel
0002f840: 28 29 3b 63 6f 6e 73 74 7b 69 6e 69 74 69 61 6c ();const{initial
0002f850: 53 68 61 70 65 3a 65 7d 3d 74 68 69 73 3b 65 26 Shape:e}=this;e&
0002f860: 26 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 70 &(this.editor.up
0002f870: 64 61 74 65 53 68 61 70 65 73 28 5b 7b 69 64 3a dateShapes([{id:
0002f880: 65 2e 69 64 2c 74 79 70 65 3a 65 2e 74 79 70 65 e.id,type:e.type
0002f890: 2c 70 72 6f 70 73 3a 7b 69 73 43 6f 6d 70 6c 65 ,props:{isComple
0002f8a0: 74 65 3a 21 30 7d 7d 5d 29 2c 74 68 69 73 2e 70 te:!0}}]),this.p
0002f8b0: 61 72 65 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e arent.transition
0002f8c0: 28 22 69 64 6c 65 22 29 29 7d 63 61 6e 63 65 6c ("idle"))}cancel
0002f8d0: 28 29 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 (){this.parent.t
0002f8e0: 72 61 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 ransition("idle"
0002f8f0: 2c 74 68 69 73 2e 69 6e 66 6f 29 7d 7d 63 6c 61 ,this.info)}}cla
0002f900: 73 73 20 54 79 20 65 78 74 65 6e 64 73 20 4d 6d ss Ty extends Mm
0002f910: 7b 73 74 61 74 69 63 20 69 64 3d 22 69 64 6c 65 {static id="idle
0002f920: 22 3b 6f 6e 50 6f 69 6e 74 65 72 44 6f 77 6e 3d ";onPointerDown=
0002f930: 65 3d 3e 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e e=>{this.parent.
0002f940: 74 72 61 6e 73 69 74 69 6f 6e 28 22 64 72 61 77 transition("draw
0002f950: 69 6e 67 22 2c 65 29 7d 3b 6f 6e 45 6e 74 65 72 ing",e)};onEnter
0002f960: 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f =()=>{this.edito
0002f970: 72 2e 73 65 74 43 75 72 73 6f 72 28 7b 74 79 70 r.setCursor({typ
0002f980: 65 3a 22 63 72 6f 73 73 22 2c 72 6f 74 61 74 69 e:"cross",rotati
0002f990: 6f 6e 3a 30 7d 29 7d 3b 6f 6e 43 61 6e 63 65 6c on:0})};onCancel
0002f9a0: 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f =()=>{this.edito
0002f9b0: 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c r.setCurrentTool
0002f9c0: 28 22 73 65 6c 65 63 74 22 29 7d 7d 63 6c 61 73 ("select")}}clas
0002f9d0: 73 20 43 79 20 65 78 74 65 6e 64 73 20 4d 6d 7b s Cy extends Mm{
0002f9e0: 73 74 61 74 69 63 20 69 64 3d 22 69 64 6c 65 22 static id="idle"
0002f9f0: 3b 6f 6e 50 6f 69 6e 74 65 72 44 6f 77 6e 3d 65 ;onPointerDown=e
0002fa00: 3d 3e 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 =>{this.parent.t
0002fa10: 72 61 6e 73 69 74 69 6f 6e 28 22 70 6f 69 6e 74 ransition("point
0002fa20: 69 6e 67 22 2c 65 29 7d 3b 6f 6e 45 6e 74 65 72 ing",e)};onEnter
0002fa30: 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f =()=>{this.edito
0002fa40: 72 2e 73 65 74 43 75 72 73 6f 72 28 7b 74 79 70 r.setCursor({typ
0002fa50: 65 3a 22 63 72 6f 73 73 22 2c 72 6f 74 61 74 69 e:"cross",rotati
0002fa60: 6f 6e 3a 30 7d 29 7d 3b 6f 6e 4b 65 79 55 70 3d on:0})};onKeyUp=
0002fa70: 65 3d 3e 7b 69 66 28 22 45 6e 74 65 72 22 3d 3d e=>{if("Enter"==
0002fa80: 3d 65 2e 6b 65 79 29 7b 69 66 28 74 68 69 73 2e =e.key){if(this.
0002fa90: 65 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 6e editor.getInstan
0002faa0: 63 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 64 ceState().isRead
0002fab0: 6f 6e 6c 79 29 72 65 74 75 72 6e 20 6e 75 6c 6c only)return null
0002fac0: 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 64 ;const t=this.ed
0002fad0: 69 74 6f 72 2e 67 65 74 4f 6e 6c 79 53 65 6c 65 itor.getOnlySele
0002fae0: 63 74 65 64 53 68 61 70 65 28 29 3b 74 26 26 74 ctedShape();t&&t
0002faf0: 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 his.editor.getSh
0002fb00: 61 70 65 55 74 69 6c 28 74 29 2e 63 61 6e 45 64 apeUtil(t).canEd
0002fb10: 69 74 28 74 29 26 26 28 74 68 69 73 2e 65 64 69 it(t)&&(this.edi
0002fb20: 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f tor.setCurrentTo
0002fb30: 6f 6c 28 22 73 65 6c 65 63 74 22 29 2c 74 68 69 ol("select"),thi
0002fb40: 73 2e 65 64 69 74 6f 72 2e 73 65 74 45 64 69 74 s.editor.setEdit
0002fb50: 69 6e 67 53 68 61 70 65 28 74 2e 69 64 29 2c 74 ingShape(t.id),t
0002fb60: 68 69 73 2e 65 64 69 74 6f 72 2e 72 6f 6f 74 2e his.editor.root.
0002fb70: 67 65 74 43 75 72 72 65 6e 74 28 29 3f 2e 74 72 getCurrent()?.tr
0002fb80: 61 6e 73 69 74 69 6f 6e 28 22 65 64 69 74 69 6e ansition("editin
0002fb90: 67 5f 73 68 61 70 65 22 2c 7b 2e 2e 2e 65 2c 74 g_shape",{...e,t
0002fba0: 61 72 67 65 74 3a 22 73 68 61 70 65 22 2c 73 68 arget:"shape",sh
0002fbb0: 61 70 65 3a 74 7d 29 29 7d 7d 3b 6f 6e 43 61 6e ape:t}))}};onCan
0002fbc0: 63 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 64 cel=()=>{this.ed
0002fbd0: 69 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 itor.setCurrentT
0002fbe0: 6f 6f 6c 28 22 73 65 6c 65 63 74 22 29 7d 7d 63 ool("select")}}c
0002fbf0: 6c 61 73 73 20 6b 79 20 65 78 74 65 6e 64 73 20 lass ky extends
0002fc00: 4d 6d 7b 73 74 61 74 69 63 20 69 64 3d 22 70 6f Mm{static id="po
0002fc10: 69 6e 74 69 6e 67 22 3b 6d 61 72 6b 49 64 3d 22 inting";markId="
0002fc20: 22 3b 6f 6e 50 6f 69 6e 74 65 72 55 70 3d 28 29 ";onPointerUp=()
0002fc30: 3d 3e 7b 74 68 69 73 2e 63 6f 6d 70 6c 65 74 65 =>{this.complete
0002fc40: 28 29 7d 3b 6f 6e 50 6f 69 6e 74 65 72 4d 6f 76 ()};onPointerMov
0002fc50: 65 3d 65 3d 3e 7b 69 66 28 74 68 69 73 2e 65 64 e=e=>{if(this.ed
0002fc60: 69 74 6f 72 2e 69 6e 70 75 74 73 2e 69 73 44 72 itor.inputs.isDr
0002fc70: 61 67 67 69 6e 67 29 7b 63 6f 6e 73 74 7b 6f 72 agging){const{or
0002fc80: 69 67 69 6e 50 61 67 65 50 6f 69 6e 74 3a 74 7d iginPagePoint:t}
0002fc90: 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 6e 70 =this.editor.inp
0002fca0: 75 74 73 2c 6e 3d 49 73 28 29 3b 74 68 69 73 2e uts,n=Is();this.
0002fcb0: 6d 61 72 6b 49 64 3d 60 63 72 65 61 74 69 6e 67 markId=`creating
0002fcc0: 3a 24 7b 6e 7d 60 2c 74 68 69 73 2e 65 64 69 74 :${n}`,this.edit
0002fcd0: 6f 72 2e 6d 61 72 6b 28 74 68 69 73 2e 6d 61 72 or.mark(this.mar
0002fce0: 6b 49 64 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 kId),this.editor
0002fcf0: 2e 63 72 65 61 74 65 53 68 61 70 65 73 28 5b 7b .createShapes([{
0002fd00: 69 64 3a 6e 2c 74 79 70 65 3a 22 67 65 6f 22 2c id:n,type:"geo",
0002fd10: 78 3a 74 2e 78 2c 79 3a 74 2e 79 2c 70 72 6f 70 x:t.x,y:t.y,prop
0002fd20: 73 3a 7b 77 3a 31 2c 68 3a 31 2c 67 65 6f 3a 74 s:{w:1,h:1,geo:t
0002fd30: 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 74 his.editor.getSt
0002fd40: 79 6c 65 46 6f 72 4e 65 78 74 53 68 61 70 65 28 yleForNextShape(
0002fd50: 67 63 29 2c 73 63 61 6c 65 3a 74 68 69 73 2e 65 gc),scale:this.e
0002fd60: 64 69 74 6f 72 2e 75 73 65 72 2e 67 65 74 49 73 ditor.user.getIs
0002fd70: 44 79 6e 61 6d 69 63 52 65 73 69 7a 65 4d 6f 64 DynamicResizeMod
0002fd80: 65 28 29 3f 31 2f 74 68 69 73 2e 65 64 69 74 6f e()?1/this.edito
0002fd90: 72 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 r.getZoomLevel()
0002fda0: 3a 31 7d 7d 5d 29 2e 73 65 6c 65 63 74 28 6e 29 :1}}]).select(n)
0002fdb0: 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 .setCurrentTool(
0002fdc0: 22 73 65 6c 65 63 74 2e 72 65 73 69 7a 69 6e 67 "select.resizing
0002fdd0: 22 2c 7b 2e 2e 2e 65 2c 74 61 72 67 65 74 3a 22 ",{...e,target:"
0002fde0: 73 65 6c 65 63 74 69 6f 6e 22 2c 68 61 6e 64 6c selection",handl
0002fdf0: 65 3a 22 62 6f 74 74 6f 6d 5f 72 69 67 68 74 22 e:"bottom_right"
0002fe00: 2c 69 73 43 72 65 61 74 69 6e 67 3a 21 30 2c 63 ,isCreating:!0,c
0002fe10: 72 65 61 74 69 6f 6e 43 75 72 73 6f 72 4f 66 66 reationCursorOff
0002fe20: 73 65 74 3a 7b 78 3a 31 2c 79 3a 31 7d 2c 6f 6e set:{x:1,y:1},on
0002fe30: 49 6e 74 65 72 61 63 74 69 6f 6e 45 6e 64 3a 22 InteractionEnd:"
0002fe40: 67 65 6f 22 7d 29 7d 7d 3b 6f 6e 43 61 6e 63 65 geo"})}};onCance
0002fe50: 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e 63 l=()=>{this.canc
0002fe60: 65 6c 28 29 7d 3b 6f 6e 43 6f 6d 70 6c 65 74 65 el()};onComplete
0002fe70: 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 6f 6d 70 6c =()=>{this.compl
0002fe80: 65 74 65 28 29 7d 3b 6f 6e 49 6e 74 65 72 72 75 ete()};onInterru
0002fe90: 70 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e pt=()=>{this.can
0002fea0: 63 65 6c 28 29 7d 3b 63 6f 6d 70 6c 65 74 65 28 cel()};complete(
0002feb0: 29 7b 63 6f 6e 73 74 7b 6f 72 69 67 69 6e 50 61 ){const{originPa
0002fec0: 67 65 50 6f 69 6e 74 3a 65 7d 3d 74 68 69 73 2e gePoint:e}=this.
0002fed0: 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 2c 74 3d editor.inputs,t=
0002fee0: 49 73 28 29 3b 74 68 69 73 2e 6d 61 72 6b 49 64 Is();this.markId
0002fef0: 3d 60 63 72 65 61 74 69 6e 67 3a 24 7b 74 7d 60 =`creating:${t}`
0002ff00: 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 72 ,this.editor.mar
0002ff10: 6b 28 74 68 69 73 2e 6d 61 72 6b 49 64 29 3b 63 k(this.markId);c
0002ff20: 6f 6e 73 74 20 6e 3d 74 68 69 73 2e 65 64 69 74 onst n=this.edit
0002ff30: 6f 72 2e 75 73 65 72 2e 67 65 74 49 73 44 79 6e or.user.getIsDyn
0002ff40: 61 6d 69 63 52 65 73 69 7a 65 4d 6f 64 65 28 29 amicResizeMode()
0002ff50: 3f 31 2f 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 ?1/this.editor.g
0002ff60: 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 3a 31 2c etZoomLevel():1,
0002ff70: 72 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 r=this.editor.ge
0002ff80: 74 53 74 79 6c 65 46 6f 72 4e 65 78 74 53 68 61 tStyleForNextSha
0002ff90: 70 65 28 67 63 29 2c 6f 3d 22 73 74 61 72 22 3d pe(gc),o="star"=
0002ffa0: 3d 3d 72 3f 7b 77 3a 32 30 30 2c 68 3a 31 39 30 ==r?{w:200,h:190
0002ffb0: 7d 3a 22 63 6c 6f 75 64 22 3d 3d 3d 72 3f 7b 77 }:"cloud"===r?{w
0002ffc0: 3a 33 30 30 2c 68 3a 31 38 30 7d 3a 7b 77 3a 32 :300,h:180}:{w:2
0002ffd0: 30 30 2c 68 3a 32 30 30 7d 3b 74 68 69 73 2e 65 00,h:200};this.e
0002ffe0: 64 69 74 6f 72 2e 63 72 65 61 74 65 53 68 61 70 ditor.createShap
0002fff0: 65 73 28 5b 7b 69 64 3a 74 2c 74 79 70 65 3a 22 es([{id:t,type:"
00030000: 67 65 6f 22 2c 78 3a 65 2e 78 2c 79 3a 65 2e 79 geo",x:e.x,y:e.y
00030010: 2c 70 72 6f 70 73 3a 7b 67 65 6f 3a 74 68 69 73 ,props:{geo:this
00030020: 2e 65 64 69 74 6f 72 2e 67 65 74 53 74 79 6c 65 .editor.getStyle
00030030: 46 6f 72 4e 65 78 74 53 68 61 70 65 28 67 63 29 ForNextShape(gc)
00030040: 2c 73 63 61 6c 65 3a 6e 2c 2e 2e 2e 6f 7d 7d 5d ,scale:n,...o}}]
00030050: 29 3b 63 6f 6e 73 74 20 69 3d 74 68 69 73 2e 65 );const i=this.e
00030060: 64 69 74 6f 72 2e 67 65 74 53 68 61 70 65 28 74 ditor.getShape(t
00030070: 29 3b 69 66 28 21 69 29 72 65 74 75 72 6e 3b 63 );if(!i)return;c
00030080: 6f 6e 73 74 7b 77 3a 61 2c 68 3a 73 7d 3d 69 2e onst{w:a,h:s}=i.
00030090: 70 72 6f 70 73 2c 6c 3d 6e 65 77 20 73 75 28 61 props,l=new su(a
000300a0: 2f 32 2c 73 2f 32 29 2e 6d 75 6c 28 6e 29 2c 63 /2,s/2).mul(n),c
000300b0: 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 =this.editor.get
000300c0: 53 68 61 70 65 50 61 72 65 6e 74 54 72 61 6e 73 ShapeParentTrans
000300d0: 66 6f 72 6d 28 69 29 3b 63 26 26 6c 2e 72 6f 74 form(i);c&&l.rot
000300e0: 28 2d 63 2e 72 6f 74 61 74 69 6f 6e 28 29 29 2c (-c.rotation()),
000300f0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 6c 65 this.editor.sele
00030100: 63 74 28 74 29 2c 74 68 69 73 2e 65 64 69 74 6f ct(t),this.edito
00030110: 72 2e 75 70 64 61 74 65 53 68 61 70 65 28 7b 69 r.updateShape({i
00030120: 64 3a 69 2e 69 64 2c 74 79 70 65 3a 22 67 65 6f d:i.id,type:"geo
00030130: 22 2c 78 3a 69 2e 78 2d 6c 2e 78 2c 79 3a 69 2e ",x:i.x-l.x,y:i.
00030140: 79 2d 6c 2e 79 2c 70 72 6f 70 73 3a 7b 67 65 6f y-l.y,props:{geo
00030150: 3a 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 :this.editor.get
00030160: 53 74 79 6c 65 46 6f 72 4e 65 78 74 53 68 61 70 StyleForNextShap
00030170: 65 28 67 63 29 2c 77 3a 61 2a 6e 2c 68 3a 73 2a e(gc),w:a*n,h:s*
00030180: 6e 7d 7d 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 n}}),this.editor
00030190: 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 61 74 .getInstanceStat
000301a0: 65 28 29 2e 69 73 54 6f 6f 6c 4c 6f 63 6b 65 64 e().isToolLocked
000301b0: 3f 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 ?this.parent.tra
000301c0: 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 29 3a nsition("idle"):
000301d0: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 43 this.editor.setC
000301e0: 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 6c 65 urrentTool("sele
000301f0: 63 74 22 2c 7b 7d 29 7d 63 61 6e 63 65 6c 28 29 ct",{})}cancel()
00030200: 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 {this.parent.tra
00030210: 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 29 7d nsition("idle")}
00030220: 7d 63 6c 61 73 73 20 41 79 20 65 78 74 65 6e 64 }class Ay extend
00030230: 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 64 3d 22 s Mm{static id="
00030240: 69 64 6c 65 22 3b 73 68 61 70 65 49 64 3d 22 22 idle";shapeId=""
00030250: 3b 6f 6e 45 6e 74 65 72 3d 65 3d 3e 7b 74 68 69 ;onEnter=e=>{thi
00030260: 73 2e 73 68 61 70 65 49 64 3d 65 2e 73 68 61 70 s.shapeId=e.shap
00030270: 65 49 64 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e eId,this.editor.
00030280: 73 65 74 43 75 72 73 6f 72 28 7b 74 79 70 65 3a setCursor({type:
00030290: 22 63 72 6f 73 73 22 2c 72 6f 74 61 74 69 6f 6e "cross",rotation
000302a0: 3a 30 7d 29 7d 3b 6f 6e 50 6f 69 6e 74 65 72 44 :0})};onPointerD
000302b0: 6f 77 6e 3d 28 29 3d 3e 7b 74 68 69 73 2e 70 61 own=()=>{this.pa
000302c0: 72 65 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 rent.transition(
000302d0: 22 70 6f 69 6e 74 69 6e 67 22 2c 7b 73 68 61 70 "pointing",{shap
000302e0: 65 49 64 3a 74 68 69 73 2e 73 68 61 70 65 49 64 eId:this.shapeId
000302f0: 7d 29 7d 3b 6f 6e 43 61 6e 63 65 6c 3d 28 29 3d })};onCancel=()=
00030300: 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 >{this.editor.se
00030310: 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 tCurrentTool("se
00030320: 6c 65 63 74 22 29 7d 7d 63 6c 61 73 73 20 49 79 lect")}}class Iy
00030330: 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 61 74 extends Mm{stat
00030340: 69 63 20 69 64 3d 22 70 6f 69 6e 74 69 6e 67 22 ic id="pointing"
00030350: 3b 73 68 61 70 65 3d 7b 7d 3b 6d 61 72 6b 49 64 ;shape={};markId
00030360: 3b 6f 6e 45 6e 74 65 72 3d 65 3d 3e 7b 63 6f 6e ;onEnter=e=>{con
00030370: 73 74 7b 69 6e 70 75 74 73 3a 74 7d 3d 74 68 69 st{inputs:t}=thi
00030380: 73 2e 65 64 69 74 6f 72 2c 7b 63 75 72 72 65 6e s.editor,{curren
00030390: 74 50 61 67 65 50 6f 69 6e 74 3a 6e 7d 3d 74 3b tPagePoint:n}=t;
000303a0: 74 68 69 73 2e 6d 61 72 6b 49 64 3d 76 6f 69 64 this.markId=void
000303b0: 20 30 3b 63 6f 6e 73 74 20 72 3d 65 2e 73 68 61 0;const r=e.sha
000303c0: 70 65 49 64 26 26 74 68 69 73 2e 65 64 69 74 6f peId&&this.edito
000303d0: 72 2e 67 65 74 53 68 61 70 65 28 65 2e 73 68 61 r.getShape(e.sha
000303e0: 70 65 49 64 29 3b 69 66 28 72 26 26 74 2e 73 68 peId);if(r&&t.sh
000303f0: 69 66 74 4b 65 79 29 7b 74 68 69 73 2e 6d 61 72 iftKey){this.mar
00030400: 6b 49 64 3d 60 63 72 65 61 74 69 6e 67 3a 24 7b kId=`creating:${
00030410: 72 2e 69 64 7d 60 2c 74 68 69 73 2e 65 64 69 74 r.id}`,this.edit
00030420: 6f 72 2e 6d 61 72 6b 28 74 68 69 73 2e 6d 61 72 or.mark(this.mar
00030430: 6b 49 64 29 2c 74 68 69 73 2e 73 68 61 70 65 3d kId),this.shape=
00030440: 72 3b 63 6f 6e 73 74 20 65 3d 74 68 69 73 2e 65 r;const e=this.e
00030450: 64 69 74 6f 72 2e 67 65 74 53 68 61 70 65 48 61 ditor.getShapeHa
00030460: 6e 64 6c 65 73 28 74 68 69 73 2e 73 68 61 70 65 ndles(this.shape
00030470: 29 3b 69 66 28 21 65 29 72 65 74 75 72 6e 3b 63 );if(!e)return;c
00030480: 6f 6e 73 74 20 74 3d 65 2e 66 69 6c 74 65 72 28 onst t=e.filter(
00030490: 28 65 3d 3e 22 76 65 72 74 65 78 22 3d 3d 3d 65 (e=>"vertex"===e
000304a0: 2e 74 79 70 65 29 29 2e 73 6f 72 74 28 56 6f 29 .type)).sort(Vo)
000304b0: 2c 6f 3d 74 5b 74 2e 6c 65 6e 67 74 68 2d 31 5d ,o=t[t.length-1]
000304c0: 2c 69 3d 74 5b 74 2e 6c 65 6e 67 74 68 2d 32 5d ,i=t[t.length-2]
000304d0: 2c 61 3d 77 70 2e 61 70 70 6c 79 54 6f 50 6f 69 ,a=wp.applyToPoi
000304e0: 6e 74 28 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 nt(this.editor.g
000304f0: 65 74 53 68 61 70 65 50 61 72 65 6e 74 54 72 61 etShapeParentTra
00030500: 6e 73 66 6f 72 6d 28 74 68 69 73 2e 73 68 61 70 nsform(this.shap
00030510: 65 29 2c 6e 65 77 20 73 75 28 74 68 69 73 2e 73 e),new su(this.s
00030520: 68 61 70 65 2e 78 2c 74 68 69 73 2e 73 68 61 70 hape.x,this.shap
00030530: 65 2e 79 29 29 2c 73 3d 73 75 2e 53 75 62 28 6e e.y)),s=su.Sub(n
00030540: 2c 61 29 2e 61 64 64 58 59 28 2e 31 2c 2e 31 29 ,a).addXY(.1,.1)
00030550: 2c 6c 3d 64 69 28 74 68 69 73 2e 73 68 61 70 65 ,l=di(this.shape
00030560: 2e 70 72 6f 70 73 2e 70 6f 69 6e 74 73 29 3b 69 .props.points);i
00030570: 66 28 73 75 2e 44 69 73 74 4d 69 6e 28 6f 2c 69 f(su.DistMin(o,i
00030580: 2c 32 29 7c 7c 73 75 2e 44 69 73 74 4d 69 6e 28 ,2)||su.DistMin(
00030590: 73 2c 6f 2c 32 29 29 6c 5b 6f 2e 69 64 5d 3d 7b s,o,2))l[o.id]={
000305a0: 69 64 3a 6f 2e 69 64 2c 69 6e 64 65 78 3a 6f 2e id:o.id,index:o.
000305b0: 69 6e 64 65 78 2c 78 3a 73 2e 78 2c 79 3a 73 2e index,x:s.x,y:s.
000305c0: 79 7d 3b 65 6c 73 65 7b 63 6f 6e 73 74 20 65 3d y};else{const e=
000305d0: 47 6f 28 6f 2e 69 6e 64 65 78 29 3b 6c 5b 65 5d Go(o.index);l[e]
000305e0: 3d 7b 69 64 3a 65 2c 69 6e 64 65 78 3a 65 2c 78 ={id:e,index:e,x
000305f0: 3a 73 2e 78 2c 79 3a 73 2e 79 7d 7d 74 68 69 73 :s.x,y:s.y}}this
00030600: 2e 65 64 69 74 6f 72 2e 75 70 64 61 74 65 53 68 .editor.updateSh
00030610: 61 70 65 73 28 5b 7b 69 64 3a 74 68 69 73 2e 73 apes([{id:this.s
00030620: 68 61 70 65 2e 69 64 2c 74 79 70 65 3a 74 68 69 hape.id,type:thi
00030630: 73 2e 73 68 61 70 65 2e 74 79 70 65 2c 70 72 6f s.shape.type,pro
00030640: 70 73 3a 7b 70 6f 69 6e 74 73 3a 6c 7d 7d 5d 29 ps:{points:l}}])
00030650: 7d 65 6c 73 65 7b 63 6f 6e 73 74 20 65 3d 49 73 }else{const e=Is
00030660: 28 29 3b 74 68 69 73 2e 6d 61 72 6b 49 64 3d 60 ();this.markId=`
00030670: 63 72 65 61 74 69 6e 67 3a 24 7b 65 7d 60 2c 74 creating:${e}`,t
00030680: 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 72 6b 28 his.editor.mark(
00030690: 74 68 69 73 2e 6d 61 72 6b 49 64 29 2c 74 68 69 this.markId),thi
000306a0: 73 2e 65 64 69 74 6f 72 2e 63 72 65 61 74 65 53 s.editor.createS
000306b0: 68 61 70 65 73 28 5b 7b 69 64 3a 65 2c 74 79 70 hapes([{id:e,typ
000306c0: 65 3a 22 6c 69 6e 65 22 2c 78 3a 6e 2e 78 2c 79 e:"line",x:n.x,y
000306d0: 3a 6e 2e 79 2c 70 72 6f 70 73 3a 7b 73 63 61 6c :n.y,props:{scal
000306e0: 65 3a 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 73 e:this.editor.us
000306f0: 65 72 2e 67 65 74 49 73 44 79 6e 61 6d 69 63 52 er.getIsDynamicR
00030700: 65 73 69 7a 65 4d 6f 64 65 28 29 3f 31 2f 74 68 esizeMode()?1/th
00030710: 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f is.editor.getZoo
00030720: 6d 4c 65 76 65 6c 28 29 3a 31 7d 7d 5d 29 2c 74 mLevel():1}}]),t
00030730: 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 6c 65 63 his.editor.selec
00030740: 74 28 65 29 2c 74 68 69 73 2e 73 68 61 70 65 3d t(e),this.shape=
00030750: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
00030760: 68 61 70 65 28 65 29 7d 7d 3b 6f 6e 50 6f 69 6e hape(e)}};onPoin
00030770: 74 65 72 4d 6f 76 65 3d 28 29 3d 3e 7b 69 66 28 terMove=()=>{if(
00030780: 74 68 69 73 2e 73 68 61 70 65 26 26 74 68 69 73 this.shape&&this
00030790: 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 2e 69 .editor.inputs.i
000307a0: 73 44 72 61 67 67 69 6e 67 29 7b 63 6f 6e 73 74 sDragging){const
000307b0: 20 65 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 e=this.editor.g
000307c0: 65 74 53 68 61 70 65 48 61 6e 64 6c 65 73 28 74 etShapeHandles(t
000307d0: 68 69 73 2e 73 68 61 70 65 29 3b 69 66 28 21 65 his.shape);if(!e
000307e0: 29 74 68 72 6f 77 20 74 68 69 73 2e 6d 61 72 6b )throw this.mark
000307f0: 49 64 26 26 74 68 69 73 2e 65 64 69 74 6f 72 2e Id&&this.editor.
00030800: 62 61 69 6c 54 6f 4d 61 72 6b 28 74 68 69 73 2e bailToMark(this.
00030810: 6d 61 72 6b 49 64 29 2c 45 72 72 6f 72 28 22 4e markId),Error("N
00030820: 6f 20 68 61 6e 64 6c 65 73 20 66 6f 75 6e 64 22 o handles found"
00030830: 29 3b 63 6f 6e 73 74 20 74 3d 42 72 28 65 29 3b );const t=Br(e);
00030840: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 43 this.editor.setC
00030850: 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 6c 65 urrentTool("sele
00030860: 63 74 2e 64 72 61 67 67 69 6e 67 5f 68 61 6e 64 ct.dragging_hand
00030870: 6c 65 22 2c 7b 73 68 61 70 65 3a 74 68 69 73 2e le",{shape:this.
00030880: 73 68 61 70 65 2c 69 73 43 72 65 61 74 69 6e 67 shape,isCreating
00030890: 3a 21 30 2c 68 61 6e 64 6c 65 3a 7b 2e 2e 2e 74 :!0,handle:{...t
000308a0: 2c 78 3a 74 2e 78 2d 2e 31 2c 79 3a 74 2e 79 2d ,x:t.x-.1,y:t.y-
000308b0: 2e 31 7d 2c 6f 6e 49 6e 74 65 72 61 63 74 69 6f .1},onInteractio
000308c0: 6e 45 6e 64 3a 22 6c 69 6e 65 22 7d 29 7d 7d 3b nEnd:"line"})}};
000308d0: 6f 6e 50 6f 69 6e 74 65 72 55 70 3d 28 29 3d 3e onPointerUp=()=>
000308e0: 7b 74 68 69 73 2e 63 6f 6d 70 6c 65 74 65 28 29 {this.complete()
000308f0: 7d 3b 6f 6e 43 61 6e 63 65 6c 3d 28 29 3d 3e 7b };onCancel=()=>{
00030900: 74 68 69 73 2e 63 61 6e 63 65 6c 28 29 7d 3b 6f this.cancel()};o
00030910: 6e 43 6f 6d 70 6c 65 74 65 3d 28 29 3d 3e 7b 74 nComplete=()=>{t
00030920: 68 69 73 2e 63 6f 6d 70 6c 65 74 65 28 29 7d 3b his.complete()};
00030930: 6f 6e 49 6e 74 65 72 72 75 70 74 3d 28 29 3d 3e onInterrupt=()=>
00030940: 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 {this.parent.tra
00030950: 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 29 2c nsition("idle"),
00030960: 74 68 69 73 2e 6d 61 72 6b 49 64 26 26 74 68 69 this.markId&&thi
00030970: 73 2e 65 64 69 74 6f 72 2e 62 61 69 6c 54 6f 4d s.editor.bailToM
00030980: 61 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 64 29 ark(this.markId)
00030990: 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 6e 61 ,this.editor.sna
000309a0: 70 73 2e 63 6c 65 61 72 49 6e 64 69 63 61 74 6f ps.clearIndicato
000309b0: 72 73 28 29 7d 3b 63 6f 6d 70 6c 65 74 65 28 29 rs()};complete()
000309c0: 7b 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 72 61 {this.parent.tra
000309d0: 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 2c 7b nsition("idle",{
000309e0: 73 68 61 70 65 49 64 3a 74 68 69 73 2e 73 68 61 shapeId:this.sha
000309f0: 70 65 2e 69 64 7d 29 2c 74 68 69 73 2e 65 64 69 pe.id}),this.edi
00030a00: 74 6f 72 2e 73 6e 61 70 73 2e 63 6c 65 61 72 49 tor.snaps.clearI
00030a10: 6e 64 69 63 61 74 6f 72 73 28 29 7d 63 61 6e 63 ndicators()}canc
00030a20: 65 6c 28 29 7b 74 68 69 73 2e 6d 61 72 6b 49 64 el(){this.markId
00030a30: 26 26 74 68 69 73 2e 65 64 69 74 6f 72 2e 62 61 &&this.editor.ba
00030a40: 69 6c 54 6f 4d 61 72 6b 28 74 68 69 73 2e 6d 61 ilToMark(this.ma
00030a50: 72 6b 49 64 29 2c 74 68 69 73 2e 70 61 72 65 6e rkId),this.paren
00030a60: 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 22 69 64 t.transition("id
00030a70: 6c 65 22 2c 7b 73 68 61 70 65 49 64 3a 74 68 69 le",{shapeId:thi
00030a80: 73 2e 73 68 61 70 65 2e 69 64 7d 29 2c 74 68 69 s.shape.id}),thi
00030a90: 73 2e 65 64 69 74 6f 72 2e 73 6e 61 70 73 2e 63 s.editor.snaps.c
00030aa0: 6c 65 61 72 49 6e 64 69 63 61 74 6f 72 73 28 29 learIndicators()
00030ab0: 7d 7d 63 6c 61 73 73 20 52 79 20 65 78 74 65 6e }}class Ry exten
00030ac0: 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 64 3d ds Mm{static id=
00030ad0: 22 69 64 6c 65 22 3b 6f 6e 50 6f 69 6e 74 65 72 "idle";onPointer
00030ae0: 44 6f 77 6e 3d 65 3d 3e 7b 74 68 69 73 2e 70 61 Down=e=>{this.pa
00030af0: 72 65 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 rent.transition(
00030b00: 22 70 6f 69 6e 74 69 6e 67 22 2c 65 29 7d 3b 6f "pointing",e)};o
00030b10: 6e 45 6e 74 65 72 3d 28 29 3d 3e 7b 74 68 69 73 nEnter=()=>{this
00030b20: 2e 65 64 69 74 6f 72 2e 73 65 74 43 75 72 73 6f .editor.setCurso
00030b30: 72 28 7b 74 79 70 65 3a 22 63 72 6f 73 73 22 2c r({type:"cross",
00030b40: 72 6f 74 61 74 69 6f 6e 3a 30 7d 29 7d 3b 6f 6e rotation:0})};on
00030b50: 43 61 6e 63 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 Cancel=()=>{this
00030b60: 2e 65 64 69 74 6f 72 2e 73 65 74 43 75 72 72 65 .editor.setCurre
00030b70: 6e 74 54 6f 6f 6c 28 22 73 65 6c 65 63 74 22 29 ntTool("select")
00030b80: 7d 7d 66 75 6e 63 74 69 6f 6e 20 4f 79 28 65 2c }}function Oy(e,
00030b90: 74 29 7b 63 6f 6e 73 74 20 6e 3d 6e 65 77 20 53 t){const n=new S
00030ba0: 65 74 3b 66 6f 72 28 63 6f 6e 73 74 20 72 20 6f et;for(const r o
00030bb0: 66 20 74 29 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 f t){const t=e.g
00030bc0: 65 74 53 68 61 70 65 28 72 29 3b 69 66 28 21 74 etShape(r);if(!t
00030bd0: 29 63 6f 6e 74 69 6e 75 65 3b 65 2e 67 65 74 53 )continue;e.getS
00030be0: 68 61 70 65 55 74 69 6c 28 74 29 2e 6f 6e 44 72 hapeUtil(t).onDr
00030bf0: 61 67 53 68 61 70 65 73 4f 75 74 26 26 6e 2e 61 agShapesOut&&n.a
00030c00: 64 64 28 74 29 3b 63 6f 6e 73 74 20 6f 3d 65 2e dd(t);const o=e.
00030c10: 67 65 74 53 68 61 70 65 28 74 2e 70 61 72 65 6e getShape(t.paren
00030c20: 74 49 64 29 3b 6f 26 26 28 65 2e 67 65 74 53 68 tId);o&&(e.getSh
00030c30: 61 70 65 55 74 69 6c 28 6f 29 2e 6f 6e 44 72 61 apeUtil(o).onDra
00030c40: 67 53 68 61 70 65 73 4f 75 74 26 26 6e 2e 61 64 gShapesOut&&n.ad
00030c50: 64 28 6f 29 29 7d 63 6f 6e 73 74 20 72 3d 6e 65 d(o))}const r=ne
00030c60: 77 20 4d 61 70 3b 66 6f 72 28 63 6f 6e 73 74 20 w Map;for(const
00030c70: 74 20 6f 66 20 6e 29 7b 63 6f 6e 73 74 20 6e 3d t of n){const n=
00030c80: 4e 79 28 65 2c 74 29 3b 6e 2e 6c 65 6e 67 74 68 Ny(e,t);n.length
00030c90: 26 26 72 2e 73 65 74 28 74 2c 6e 29 7d 66 6f 72 &&r.set(t,n)}for
00030ca0: 28 63 6f 6e 73 74 5b 74 2c 6e 5d 6f 66 20 72 29 (const[t,n]of r)
00030cb0: 7b 63 6f 6e 73 74 20 72 3d 65 2e 67 65 74 53 68 {const r=e.getSh
00030cc0: 61 70 65 55 74 69 6c 28 74 29 2c 6f 3d 6a 72 28 apeUtil(t),o=jr(
00030cd0: 6e 2e 6d 61 70 28 28 74 3d 3e 65 2e 67 65 74 53 n.map((t=>e.getS
00030ce0: 68 61 70 65 28 74 29 29 29 29 3b 72 2e 6f 6e 44 hape(t))));r.onD
00030cf0: 72 61 67 53 68 61 70 65 73 4f 75 74 3f 2e 28 74 ragShapesOut?.(t
00030d00: 2c 6f 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 4e 79 ,o)}}function Ny
00030d10: 28 65 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 65 2e (e,t){const n=e.
00030d20: 67 65 74 53 6f 72 74 65 64 43 68 69 6c 64 49 64 getSortedChildId
00030d30: 73 46 6f 72 50 61 72 65 6e 74 28 74 2e 69 64 29 sForParent(t.id)
00030d40: 3b 69 66 28 30 3d 3d 3d 6e 2e 6c 65 6e 67 74 68 ;if(0===n.length
00030d50: 29 72 65 74 75 72 6e 5b 5d 3b 63 6f 6e 73 74 20 )return[];const
00030d60: 72 3d 65 2e 67 65 74 53 68 61 70 65 50 61 67 65 r=e.getShapePage
00030d70: 42 6f 75 6e 64 73 28 74 29 3b 69 66 28 21 72 29 Bounds(t);if(!r)
00030d80: 72 65 74 75 72 6e 5b 5d 3b 6c 65 74 20 6f 2c 69 return[];let o,i
00030d90: 2c 61 3b 63 6f 6e 73 74 20 73 3d 5b 5d 3b 66 6f ,a;const s=[];fo
00030da0: 72 28 63 6f 6e 73 74 20 6c 20 6f 66 20 6e 29 7b r(const l of n){
00030db0: 63 6f 6e 73 74 20 6e 3d 65 2e 67 65 74 53 68 61 const n=e.getSha
00030dc0: 70 65 50 61 67 65 42 6f 75 6e 64 73 28 6c 29 3b pePageBounds(l);
00030dd0: 69 66 28 21 6e 29 63 6f 6e 74 69 6e 75 65 3b 69 if(!n)continue;i
00030de0: 66 28 21 72 2e 69 6e 63 6c 75 64 65 73 28 6e 29 f(!r.includes(n)
00030df0: 29 7b 73 2e 70 75 73 68 28 6c 29 3b 63 6f 6e 74 ){s.push(l);cont
00030e00: 69 6e 75 65 7d 6f 3f 3f 3d 65 2e 67 65 74 53 68 inue}o??=e.getSh
00030e10: 61 70 65 47 65 6f 6d 65 74 72 79 28 74 29 2c 69 apeGeometry(t),i
00030e20: 3f 3f 3d 65 2e 67 65 74 53 68 61 70 65 50 61 67 ??=e.getShapePag
00030e30: 65 54 72 61 6e 73 66 6f 72 6d 28 74 29 2c 61 3f eTransform(t),a?
00030e40: 3f 3d 69 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 ?=i.applyToPoint
00030e50: 73 28 6f 2e 76 65 72 74 69 63 65 73 29 3b 63 6f s(o.vertices);co
00030e60: 6e 73 74 20 63 3d 65 2e 67 65 74 53 68 61 70 65 nst c=e.getShape
00030e70: 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 6c 29 PageTransform(l)
00030e80: 2e 63 6c 6f 6e 65 28 29 2e 69 6e 76 65 72 74 28 .clone().invert(
00030e90: 29 2e 61 70 70 6c 79 54 6f 50 6f 69 6e 74 73 28 ).applyToPoints(
00030ea0: 61 29 2c 7b 76 65 72 74 69 63 65 73 3a 75 2c 69 a),{vertices:u,i
00030eb0: 73 43 6c 6f 73 65 64 3a 64 7d 3d 65 2e 67 65 74 sClosed:d}=e.get
00030ec0: 53 68 61 70 65 47 65 6f 6d 65 74 72 79 28 6c 29 ShapeGeometry(l)
00030ed0: 3b 69 66 28 21 75 2e 73 6f 6d 65 28 28 65 3d 3e ;if(!u.some((e=>
00030ee0: 4f 75 28 65 2c 63 29 29 29 29 7b 69 66 28 64 29 Ou(e,c)))){if(d)
00030ef0: 7b 69 66 28 54 68 28 63 2c 75 29 29 63 6f 6e 74 {if(Th(c,u))cont
00030f00: 69 6e 75 65 7d 65 6c 73 65 20 69 66 28 43 68 28 inue}else if(Ch(
00030f10: 63 2c 75 29 29 63 6f 6e 74 69 6e 75 65 3b 73 2e c,u))continue;s.
00030f20: 70 75 73 68 28 6c 29 7d 7d 72 65 74 75 72 6e 20 push(l)}}return
00030f30: 73 7d 66 75 6e 63 74 69 6f 6e 20 50 79 28 65 2c s}function Py(e,
00030f40: 74 2c 6e 3d 21 31 29 7b 65 2e 73 65 6c 65 63 74 t,n=!1){e.select
00030f50: 28 74 29 2c 65 2e 73 65 74 45 64 69 74 69 6e 67 (t),e.setEditing
00030f60: 53 68 61 70 65 28 74 29 2c 65 2e 73 65 74 43 75 Shape(t),e.setCu
00030f70: 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 6c 65 63 rrentTool("selec
00030f80: 74 2e 65 64 69 74 69 6e 67 5f 73 68 61 70 65 22 t.editing_shape"
00030f90: 2c 7b 74 61 72 67 65 74 3a 22 73 68 61 70 65 22 ,{target:"shape"
00030fa0: 2c 73 68 61 70 65 3a 74 7d 29 2c 6e 26 26 65 2e ,shape:t}),n&&e.
00030fb0: 65 6d 69 74 28 22 73 65 6c 65 63 74 2d 61 6c 6c emit("select-all
00030fc0: 2d 74 65 78 74 22 2c 7b 73 68 61 70 65 49 64 3a -text",{shapeId:
00030fd0: 74 2e 69 64 7d 29 2c 44 79 28 65 29 7d 63 6f 6e t.id}),Dy(e)}con
00030fe0: 73 74 20 4d 79 3d 31 36 3b 66 75 6e 63 74 69 6f st My=16;functio
00030ff0: 6e 20 44 79 28 65 29 7b 63 6f 6e 73 74 20 74 3d n Dy(e){const t=
00031000: 65 2e 67 65 74 53 65 6c 65 63 74 69 6f 6e 50 61 e.getSelectionPa
00031010: 67 65 42 6f 75 6e 64 73 28 29 2c 6e 3d 65 2e 67 geBounds(),n=e.g
00031020: 65 74 56 69 65 77 70 6f 72 74 50 61 67 65 42 6f etViewportPageBo
00031030: 75 6e 64 73 28 29 3b 69 66 28 74 26 26 21 6e 2e unds();if(t&&!n.
00031040: 63 6f 6e 74 61 69 6e 73 28 74 29 29 7b 63 6f 6e contains(t)){con
00031050: 73 74 20 72 3d 74 2e 63 6c 6f 6e 65 28 29 2e 65 st r=t.clone().e
00031060: 78 70 61 6e 64 42 79 28 4d 79 2f 65 2e 67 65 74 xpandBy(My/e.get
00031070: 5a 6f 6f 6d 4c 65 76 65 6c 28 29 29 2e 65 78 70 ZoomLevel()).exp
00031080: 61 6e 64 28 6e 29 2c 6f 3d 6e 2e 63 6c 6f 6e 65 and(n),o=n.clone
00031090: 28 29 2e 74 72 61 6e 73 6c 61 74 65 28 7b 78 3a ().translate({x:
000310a0: 32 2a 28 72 2e 63 65 6e 74 65 72 2e 78 2d 6e 2e 2*(r.center.x-n.
000310b0: 63 65 6e 74 65 72 2e 78 29 2c 79 3a 32 2a 28 72 center.x),y:2*(r
000310c0: 2e 63 65 6e 74 65 72 2e 79 2d 6e 2e 63 65 6e 74 .center.y-n.cent
000310d0: 65 72 2e 79 29 7d 29 3b 65 2e 7a 6f 6f 6d 54 6f er.y)});e.zoomTo
000310e0: 42 6f 75 6e 64 73 28 6f 2c 7b 61 6e 69 6d 61 74 Bounds(o,{animat
000310f0: 69 6f 6e 3a 7b 64 75 72 61 74 69 6f 6e 3a 65 2e ion:{duration:e.
00031100: 6f 70 74 69 6f 6e 73 2e 61 6e 69 6d 61 74 69 6f options.animatio
00031110: 6e 4d 65 64 69 75 6d 4d 73 7d 2c 69 6e 73 65 74 nMediumMs},inset
00031120: 3a 30 7d 29 7d 7d 63 6f 6e 73 74 20 4c 79 3d 32 :0})}}const Ly=2
00031130: 30 2c 46 79 3d 32 30 30 2c 6a 79 3d 6e 65 77 20 0,Fy=200,jy=new
00031140: 73 75 28 46 79 2f 32 2c 46 79 2f 32 29 2c 42 79 su(Fy/2,Fy/2),By
00031150: 3d 31 30 2c 55 79 3d 5b 5b 5b 22 61 31 22 5d 2c =10,Uy=[[["a1"],
00031160: 6e 65 77 20 73 75 28 2e 35 2a 46 79 2c 2d 2e 35 new su(.5*Fy,-.5
00031170: 2a 46 79 2d 4c 79 29 5d 2c 5b 5b 22 61 32 22 5d *Fy-Ly)],[["a2"]
00031180: 2c 6e 65 77 20 73 75 28 31 2e 35 2a 46 79 2b 4c ,new su(1.5*Fy+L
00031190: 79 2c 2e 35 2a 46 79 29 5d 2c 5b 5b 22 61 33 22 y,.5*Fy)],[["a3"
000311a0: 5d 2c 6e 65 77 20 73 75 28 2e 35 2a 46 79 2c 31 ],new su(.5*Fy,1
000311b0: 2e 35 2a 46 79 2b 4c 79 29 5d 2c 5b 5b 22 61 34 .5*Fy+Ly)],[["a4
000311c0: 22 5d 2c 6e 65 77 20 73 75 28 2d 2e 35 2a 46 79 "],new su(-.5*Fy
000311d0: 2d 4c 79 2c 2e 35 2a 46 79 29 5d 5d 3b 66 75 6e -Ly,.5*Fy)]];fun
000311e0: 63 74 69 6f 6e 20 7a 79 28 65 2c 74 2c 6e 2c 72 ction zy(e,t,n,r
000311f0: 2c 6f 29 7b 72 65 74 75 72 6e 20 4f 62 6a 65 63 ,o){return Objec
00031200: 74 2e 66 72 6f 6d 45 6e 74 72 69 65 73 28 66 75 t.fromEntries(fu
00031210: 6e 63 74 69 6f 6e 28 65 29 7b 69 66 28 31 3d 3d nction(e){if(1==
00031220: 3d 65 29 72 65 74 75 72 6e 20 55 79 3b 63 6f 6e =e)return Uy;con
00031230: 73 74 20 74 3d 46 79 2a 65 2c 6e 3d 4c 79 2a 65 st t=Fy*e,n=Ly*e
00031240: 3b 72 65 74 75 72 6e 5b 5b 5b 22 61 31 22 5d 2c ;return[[["a1"],
00031250: 6e 65 77 20 73 75 28 2e 35 2a 74 2c 2d 2e 35 2a new su(.5*t,-.5*
00031260: 74 2d 6e 29 5d 2c 5b 5b 22 61 32 22 5d 2c 6e 65 t-n)],[["a2"],ne
00031270: 77 20 73 75 28 31 2e 35 2a 74 2b 6e 2c 2e 35 2a w su(1.5*t+n,.5*
00031280: 74 29 5d 2c 5b 5b 22 61 33 22 5d 2c 6e 65 77 20 t)],[["a3"],new
00031290: 73 75 28 2e 35 2a 74 2c 31 2e 35 2a 74 2b 6e 29 su(.5*t,1.5*t+n)
000312a0: 5d 2c 5b 5b 22 61 34 22 5d 2c 6e 65 77 20 73 75 ],[["a4"],new su
000312b0: 28 2d 2e 35 2a 74 2d 6e 2c 2e 35 2a 74 29 5d 5d (-.5*t-n,.5*t)]]
000312c0: 7d 28 6f 29 2e 6d 61 70 28 28 28 5b 6f 2c 69 5d }(o).map((([o,i]
000312d0: 2c 61 29 3d 3e 7b 63 6f 6e 73 74 20 73 3d 69 2e ,a)=>{const s=i.
000312e0: 63 6c 6f 6e 65 28 29 3b 72 65 74 75 72 6e 20 30 clone();return 0
000312f0: 3d 3d 3d 61 26 26 72 3f 73 2e 79 2d 3d 72 3a 32 ===a&&r?s.y-=r:2
00031300: 3d 3d 3d 61 26 26 6e 26 26 28 73 2e 79 2b 3d 6e ===a&&n&&(s.y+=n
00031310: 29 2c 5b 6f 2c 73 2e 72 6f 74 28 74 29 2e 61 64 ),[o,s.rot(t).ad
00031320: 64 28 65 29 5d 7d 29 29 29 7d 66 75 6e 63 74 69 d(e)]})))}functi
00031330: 6f 6e 20 47 79 28 65 2c 74 2c 6e 2c 72 29 7b 63 on Gy(e,t,n,r){c
00031340: 6f 6e 73 74 20 6f 3d 6e 65 77 20 53 65 74 28 65 onst o=new Set(e
00031350: 2e 67 65 74 53 65 6c 65 63 74 65 64 53 68 61 70 .getSelectedShap
00031360: 65 49 64 73 28 29 29 2c 69 3d 28 46 79 2b 4c 79 eIds()),i=(Fy+Ly
00031370: 2b 72 29 2a 2a 32 2c 61 3d 6e 65 77 20 4d 61 70 +r)**2,a=new Map
00031380: 2c 73 3d 5b 5d 3b 66 6f 72 28 63 6f 6e 73 74 20 ,s=[];for(const
00031390: 69 20 6f 66 20 65 2e 67 65 74 43 75 72 72 65 6e i of e.getCurren
000313a0: 74 50 61 67 65 53 68 61 70 65 73 28 29 29 7b 69 tPageShapes()){i
000313b0: 66 28 21 65 2e 69 73 53 68 61 70 65 4f 66 54 79 f(!e.isShapeOfTy
000313c0: 70 65 28 69 2c 22 6e 6f 74 65 22 29 7c 7c 6e 21 pe(i,"note")||n!
000313d0: 3d 3d 69 2e 70 72 6f 70 73 2e 73 63 61 6c 65 7c ==i.props.scale|
000313e0: 7c 6f 2e 68 61 73 28 69 2e 69 64 29 29 63 6f 6e |o.has(i.id))con
000313f0: 74 69 6e 75 65 3b 63 6f 6e 73 74 20 6c 3d 65 2e tinue;const l=e.
00031400: 67 65 74 53 68 61 70 65 50 61 67 65 54 72 61 6e getShapePageTran
00031410: 73 66 6f 72 6d 28 69 2e 69 64 29 3b 74 3d 3d 3d sform(i.id);t===
00031420: 6c 2e 72 6f 74 61 74 69 6f 6e 28 29 26 26 28 61 l.rotation()&&(a
00031430: 2e 73 65 74 28 69 2c 65 2e 67 65 74 53 68 61 70 .set(i,e.getShap
00031440: 65 50 61 67 65 42 6f 75 6e 64 73 28 69 29 2e 63 ePageBounds(i).c
00031450: 65 6e 74 65 72 29 2c 73 2e 70 75 73 68 28 2e 2e enter),s.push(..
00031460: 2e 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 7a .Object.values(z
00031470: 79 28 6c 2e 70 6f 69 6e 74 28 29 2c 74 2c 69 2e y(l.point(),t,i.
00031480: 70 72 6f 70 73 2e 67 72 6f 77 59 2c 72 2c 6e 29 props.growY,r,n)
00031490: 29 29 29 7d 63 6f 6e 73 74 20 6c 3d 73 2e 6c 65 )))}const l=s.le
000314a0: 6e 67 74 68 3b 6c 65 74 20 63 3b 66 6f 72 28 63 ngth;let c;for(c
000314b0: 6f 6e 73 74 5b 74 2c 6e 5d 6f 66 20 61 29 66 6f onst[t,n]of a)fo
000314c0: 72 28 6c 65 74 20 72 3d 30 3b 72 3c 6c 3b 72 2b r(let r=0;r<l;r+
000314d0: 2b 29 63 3d 73 5b 72 5d 2c 63 26 26 28 73 75 2e +)c=s[r],c&&(su.
000314e0: 44 69 73 74 32 28 6e 2c 63 29 3e 69 7c 7c 65 2e Dist2(n,c)>i||e.
000314f0: 69 73 50 6f 69 6e 74 49 6e 53 68 61 70 65 28 74 isPointInShape(t
00031500: 2c 63 29 26 26 28 73 5b 72 5d 3d 76 6f 69 64 20 ,c)&&(s[r]=void
00031510: 30 29 29 3b 72 65 74 75 72 6e 20 6a 72 28 73 29 0));return jr(s)
00031520: 7d 66 75 6e 63 74 69 6f 6e 20 48 79 28 65 2c 74 }function Hy(e,t
00031530: 2c 6e 2c 72 2c 6f 3d 21 31 29 7b 6c 65 74 20 69 ,n,r,o=!1){let i
00031540: 3b 63 6f 6e 73 74 20 61 3d 65 2e 67 65 74 43 75 ;const a=e.getCu
00031550: 72 72 65 6e 74 50 61 67 65 53 68 61 70 65 73 53 rrentPageShapesS
00031560: 6f 72 74 65 64 28 29 2c 73 3d 28 46 79 2b 4c 79 orted(),s=(Fy+Ly
00031570: 2a 2a 32 29 2a 2a 74 2e 70 72 6f 70 73 2e 73 63 **2)**t.props.sc
00031580: 61 6c 65 3b 66 6f 72 28 6c 65 74 20 72 3d 61 2e ale;for(let r=a.
00031590: 6c 65 6e 67 74 68 2d 31 3b 72 3e 3d 30 3b 72 2d length-1;r>=0;r-
000315a0: 2d 29 7b 63 6f 6e 73 74 20 6f 3d 61 5b 72 5d 3b -){const o=a[r];
000315b0: 69 66 28 22 6e 6f 74 65 22 3d 3d 3d 6f 2e 74 79 if("note"===o.ty
000315c0: 70 65 26 26 6f 2e 69 64 21 3d 3d 74 2e 69 64 29 pe&&o.id!==t.id)
000315d0: 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 65 74 53 68 {const t=e.getSh
000315e0: 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 6f 29 apePageBounds(o)
000315f0: 3b 69 66 28 74 26 26 73 75 2e 44 69 73 74 32 28 ;if(t&&su.Dist2(
00031600: 74 2e 63 65 6e 74 65 72 2c 6e 29 3c 73 26 26 65 t.center,n)<s&&e
00031610: 2e 69 73 50 6f 69 6e 74 49 6e 53 68 61 70 65 28 .isPointInShape(
00031620: 6f 2c 6e 29 29 7b 69 3d 6f 3b 62 72 65 61 6b 7d o,n)){i=o;break}
00031630: 7d 7d 69 66 28 65 2e 63 6f 6d 70 6c 65 74 65 28 }}if(e.complete(
00031640: 29 2c 21 69 7c 7c 6f 29 7b 65 2e 6d 61 72 6b 28 ),!i||o){e.mark(
00031650: 22 63 72 65 61 74 69 6e 67 20 6e 6f 74 65 20 73 "creating note s
00031660: 68 61 70 65 22 29 3b 63 6f 6e 73 74 20 6f 3d 49 hape");const o=I
00031670: 73 28 29 3b 65 2e 63 72 65 61 74 65 53 68 61 70 s();e.createShap
00031680: 65 28 7b 69 64 3a 6f 2c 74 79 70 65 3a 22 6e 6f e({id:o,type:"no
00031690: 74 65 22 2c 78 3a 6e 2e 78 2c 79 3a 6e 2e 79 2c te",x:n.x,y:n.y,
000316a0: 72 6f 74 61 74 69 6f 6e 3a 72 2c 6f 70 61 63 69 rotation:r,opaci
000316b0: 74 79 3a 74 2e 6f 70 61 63 69 74 79 2c 70 72 6f ty:t.opacity,pro
000316c0: 70 73 3a 7b 2e 2e 2e 74 2e 70 72 6f 70 73 2c 74 ps:{...t.props,t
000316d0: 65 78 74 3a 22 22 2c 67 72 6f 77 59 3a 30 2c 66 ext:"",growY:0,f
000316e0: 6f 6e 74 53 69 7a 65 41 64 6a 75 73 74 6d 65 6e ontSizeAdjustmen
000316f0: 74 3a 30 2c 75 72 6c 3a 22 22 7d 7d 29 3b 63 6f t:0,url:""}});co
00031700: 6e 73 74 20 61 3d 65 2e 67 65 74 53 68 61 70 65 nst a=e.getShape
00031710: 28 6f 29 3b 69 66 28 21 61 29 72 65 74 75 72 6e (o);if(!a)return
00031720: 3b 63 6f 6e 73 74 20 73 3d 65 2e 67 65 74 50 6f ;const s=e.getPo
00031730: 69 6e 74 49 6e 50 61 72 65 6e 74 53 70 61 63 65 intInParentSpace
00031740: 28 61 2c 73 75 2e 53 75 62 28 6e 2c 73 75 2e 52 (a,su.Sub(n,su.R
00031750: 6f 74 28 6a 79 2e 63 6c 6f 6e 65 28 29 2e 6d 75 ot(jy.clone().mu
00031760: 6c 28 61 2e 70 72 6f 70 73 2e 73 63 61 6c 65 29 l(a.props.scale)
00031770: 2c 72 29 29 29 3b 65 2e 75 70 64 61 74 65 53 68 ,r)));e.updateSh
00031780: 61 70 65 28 7b 69 64 3a 6f 2c 74 79 70 65 3a 22 ape({id:o,type:"
00031790: 6e 6f 74 65 22 2c 78 3a 73 2e 78 2c 79 3a 73 2e note",x:s.x,y:s.
000317a0: 79 7d 29 2c 69 3d 65 2e 67 65 74 53 68 61 70 65 y}),i=e.getShape
000317b0: 28 6f 29 7d 72 65 74 75 72 6e 20 44 79 28 65 29 (o)}return Dy(e)
000317c0: 2c 69 7d 63 6c 61 73 73 20 56 79 20 65 78 74 65 ,i}class Vy exte
000317d0: 6e 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 64 nds Mm{static id
000317e0: 3d 22 70 6f 69 6e 74 69 6e 67 22 3b 64 72 61 67 ="pointing";drag
000317f0: 67 65 64 3d 21 31 3b 69 6e 66 6f 3d 7b 7d 3b 77 ged=!1;info={};w
00031800: 61 73 46 6f 63 75 73 65 64 4f 6e 45 6e 74 65 72 asFocusedOnEnter
00031810: 3d 21 31 3b 6d 61 72 6b 49 64 3d 22 22 3b 73 68 =!1;markId="";sh
00031820: 61 70 65 3d 7b 7d 3b 6f 6e 45 6e 74 65 72 3d 28 ape={};onEnter=(
00031830: 29 3d 3e 7b 63 6f 6e 73 74 7b 65 64 69 74 6f 72 )=>{const{editor
00031840: 3a 65 7d 3d 74 68 69 73 3b 69 66 28 74 68 69 73 :e}=this;if(this
00031850: 2e 77 61 73 46 6f 63 75 73 65 64 4f 6e 45 6e 74 .wasFocusedOnEnt
00031860: 65 72 3d 21 65 2e 67 65 74 49 73 4d 65 6e 75 4f er=!e.getIsMenuO
00031870: 70 65 6e 28 29 2c 74 68 69 73 2e 77 61 73 46 6f pen(),this.wasFo
00031880: 63 75 73 65 64 4f 6e 45 6e 74 65 72 29 7b 63 6f cusedOnEnter){co
00031890: 6e 73 74 20 74 3d 49 73 28 29 3b 74 68 69 73 2e nst t=Is();this.
000318a0: 6d 61 72 6b 49 64 3d 60 63 72 65 61 74 69 6e 67 markId=`creating
000318b0: 3a 24 7b 74 7d 60 2c 65 2e 6d 61 72 6b 28 74 68 :${t}`,e.mark(th
000318c0: 69 73 2e 6d 61 72 6b 49 64 29 3b 63 6f 6e 73 74 is.markId);const
000318d0: 20 6e 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e 69 n=this.editor.i
000318e0: 6e 70 75 74 73 2e 6f 72 69 67 69 6e 50 61 67 65 nputs.originPage
000318f0: 50 6f 69 6e 74 2e 63 6c 6f 6e 65 28 29 2c 72 3d Point.clone(),r=
00031900: 71 79 28 74 68 69 73 2e 65 64 69 74 6f 72 2c 6e qy(this.editor,n
00031910: 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 73 65 ,this.editor.use
00031920: 72 2e 67 65 74 49 73 44 79 6e 61 6d 69 63 52 65 r.getIsDynamicRe
00031930: 73 69 7a 65 4d 6f 64 65 28 29 3f 31 2f 74 68 69 sizeMode()?1/thi
00031940: 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f 6d s.editor.getZoom
00031950: 4c 65 76 65 6c 28 29 3a 31 29 3b 72 26 26 6e 2e Level():1);r&&n.
00031960: 73 75 62 28 72 29 2c 74 68 69 73 2e 73 68 61 70 sub(r),this.shap
00031970: 65 3d 57 79 28 74 68 69 73 2e 65 64 69 74 6f 72 e=Wy(this.editor
00031980: 2c 74 2c 6e 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 65 ,t,n)}};onPointe
00031990: 72 4d 6f 76 65 3d 65 3d 3e 7b 69 66 28 74 68 69 rMove=e=>{if(thi
000319a0: 73 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 2e s.editor.inputs.
000319b0: 69 73 44 72 61 67 67 69 6e 67 29 7b 69 66 28 21 isDragging){if(!
000319c0: 74 68 69 73 2e 77 61 73 46 6f 63 75 73 65 64 4f this.wasFocusedO
000319d0: 6e 45 6e 74 65 72 29 7b 63 6f 6e 73 74 20 65 3d nEnter){const e=
000319e0: 49 73 28 29 2c 74 3d 74 68 69 73 2e 65 64 69 74 Is(),t=this.edit
000319f0: 6f 72 2e 69 6e 70 75 74 73 2e 6f 72 69 67 69 6e or.inputs.origin
00031a00: 50 61 67 65 50 6f 69 6e 74 2e 63 6c 6f 6e 65 28 PagePoint.clone(
00031a10: 29 2c 6e 3d 71 79 28 74 68 69 73 2e 65 64 69 74 ),n=qy(this.edit
00031a20: 6f 72 2c 74 2c 74 68 69 73 2e 65 64 69 74 6f 72 or,t,this.editor
00031a30: 2e 75 73 65 72 2e 67 65 74 49 73 44 79 6e 61 6d .user.getIsDynam
00031a40: 69 63 52 65 73 69 7a 65 4d 6f 64 65 28 29 3f 31 icResizeMode()?1
00031a50: 2f 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 /this.editor.get
00031a60: 5a 6f 6f 6d 4c 65 76 65 6c 28 29 3a 31 29 3b 6e ZoomLevel():1);n
00031a70: 26 26 74 2e 73 75 62 28 6e 29 2c 74 68 69 73 2e &&t.sub(n),this.
00031a80: 73 68 61 70 65 3d 57 79 28 74 68 69 73 2e 65 64 shape=Wy(this.ed
00031a90: 69 74 6f 72 2c 65 2c 74 29 7d 74 68 69 73 2e 65 itor,e,t)}this.e
00031aa0: 64 69 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 ditor.setCurrent
00031ab0: 54 6f 6f 6c 28 22 73 65 6c 65 63 74 2e 74 72 61 Tool("select.tra
00031ac0: 6e 73 6c 61 74 69 6e 67 22 2c 7b 2e 2e 2e 65 2c nslating",{...e,
00031ad0: 74 61 72 67 65 74 3a 22 73 68 61 70 65 22 2c 73 target:"shape",s
00031ae0: 68 61 70 65 3a 74 68 69 73 2e 73 68 61 70 65 2c hape:this.shape,
00031af0: 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 45 6e 64 onInteractionEnd
00031b00: 3a 22 6e 6f 74 65 22 2c 69 73 43 72 65 61 74 69 :"note",isCreati
00031b10: 6e 67 3a 21 30 2c 6f 6e 43 72 65 61 74 65 3a 28 ng:!0,onCreate:(
00031b20: 29 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e )=>{this.editor.
00031b30: 73 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 28 setEditingShape(
00031b40: 74 68 69 73 2e 73 68 61 70 65 2e 69 64 29 2c 74 this.shape.id),t
00031b50: 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 43 75 his.editor.setCu
00031b60: 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 6c 65 63 rrentTool("selec
00031b70: 74 2e 65 64 69 74 69 6e 67 5f 73 68 61 70 65 22 t.editing_shape"
00031b80: 29 7d 7d 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 65 72 )}})}};onPointer
00031b90: 55 70 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 6f 6d Up=()=>{this.com
00031ba0: 70 6c 65 74 65 28 29 7d 3b 6f 6e 49 6e 74 65 72 plete()};onInter
00031bb0: 72 75 70 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 rupt=()=>{this.c
00031bc0: 61 6e 63 65 6c 28 29 7d 3b 6f 6e 43 6f 6d 70 6c ancel()};onCompl
00031bd0: 65 74 65 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 6f ete=()=>{this.co
00031be0: 6d 70 6c 65 74 65 28 29 7d 3b 6f 6e 43 61 6e 63 mplete()};onCanc
00031bf0: 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e el=()=>{this.can
00031c00: 63 65 6c 28 29 7d 3b 63 6f 6d 70 6c 65 74 65 28 cel()};complete(
00031c10: 29 7b 74 68 69 73 2e 77 61 73 46 6f 63 75 73 65 ){this.wasFocuse
00031c20: 64 4f 6e 45 6e 74 65 72 26 26 28 74 68 69 73 2e dOnEnter&&(this.
00031c30: 65 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 6e editor.getInstan
00031c40: 63 65 53 74 61 74 65 28 29 2e 69 73 54 6f 6f 6c ceState().isTool
00031c50: 4c 6f 63 6b 65 64 3f 74 68 69 73 2e 70 61 72 65 Locked?this.pare
00031c60: 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 22 69 nt.transition("i
00031c70: 64 6c 65 22 29 3a 28 74 68 69 73 2e 65 64 69 74 dle"):(this.edit
00031c80: 6f 72 2e 73 65 74 45 64 69 74 69 6e 67 53 68 61 or.setEditingSha
00031c90: 70 65 28 74 68 69 73 2e 73 68 61 70 65 2e 69 64 pe(this.shape.id
00031ca0: 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 ),this.editor.se
00031cb0: 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 tCurrentTool("se
00031cc0: 6c 65 63 74 2e 65 64 69 74 69 6e 67 5f 73 68 61 lect.editing_sha
00031cd0: 70 65 22 2c 7b 2e 2e 2e 74 68 69 73 2e 69 6e 66 pe",{...this.inf
00031ce0: 6f 2c 74 61 72 67 65 74 3a 22 73 68 61 70 65 22 o,target:"shape"
00031cf0: 2c 73 68 61 70 65 3a 74 68 69 73 2e 73 68 61 70 ,shape:this.shap
00031d00: 65 7d 29 29 29 7d 63 61 6e 63 65 6c 28 29 7b 74 e})))}cancel(){t
00031d10: 68 69 73 2e 65 64 69 74 6f 72 2e 62 61 69 6c 54 his.editor.bailT
00031d20: 6f 4d 61 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 oMark(this.markI
00031d30: 64 29 2c 74 68 69 73 2e 70 61 72 65 6e 74 2e 74 d),this.parent.t
00031d40: 72 61 6e 73 69 74 69 6f 6e 28 22 69 64 6c 65 22 ransition("idle"
00031d50: 2c 74 68 69 73 2e 69 6e 66 6f 29 7d 7d 66 75 6e ,this.info)}}fun
00031d60: 63 74 69 6f 6e 20 71 79 28 65 2c 74 2c 6e 29 7b ction qy(e,t,n){
00031d70: 6c 65 74 20 72 2c 6f 3d 42 79 2f 65 2e 67 65 74 let r,o=By/e.get
00031d80: 5a 6f 6f 6d 4c 65 76 65 6c 28 29 3b 66 6f 72 28 ZoomLevel();for(
00031d90: 63 6f 6e 73 74 20 69 20 6f 66 20 47 79 28 65 2c const i of Gy(e,
00031da0: 30 2c 6e 2c 30 29 29 7b 63 6f 6e 73 74 20 65 3d 0,n,0)){const e=
00031db0: 73 75 2e 53 75 62 28 74 2c 69 29 2c 6e 3d 65 2e su.Sub(t,i),n=e.
00031dc0: 6c 65 6e 28 29 3b 6e 3c 6f 26 26 28 6f 3d 6e 2c len();n<o&&(o=n,
00031dd0: 72 3d 65 29 7d 72 65 74 75 72 6e 20 72 7d 66 75 r=e)}return r}fu
00031de0: 6e 63 74 69 6f 6e 20 57 79 28 65 2c 74 2c 6e 29 nction Wy(e,t,n)
00031df0: 7b 65 2e 63 72 65 61 74 65 53 68 61 70 65 28 7b {e.createShape({
00031e00: 69 64 3a 74 2c 74 79 70 65 3a 22 6e 6f 74 65 22 id:t,type:"note"
00031e10: 2c 78 3a 6e 2e 78 2c 79 3a 6e 2e 79 2c 70 72 6f ,x:n.x,y:n.y,pro
00031e20: 70 73 3a 7b 73 63 61 6c 65 3a 65 2e 75 73 65 72 ps:{scale:e.user
00031e30: 2e 67 65 74 49 73 44 79 6e 61 6d 69 63 52 65 73 .getIsDynamicRes
00031e40: 69 7a 65 4d 6f 64 65 28 29 3f 31 2f 65 2e 67 65 izeMode()?1/e.ge
00031e50: 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 3a 31 7d 7d tZoomLevel():1}}
00031e60: 29 2e 73 65 6c 65 63 74 28 74 29 3b 63 6f 6e 73 ).select(t);cons
00031e70: 74 20 72 3d 65 2e 67 65 74 53 68 61 70 65 28 74 t r=e.getShape(t
00031e80: 29 2c 6f 3d 65 2e 67 65 74 53 68 61 70 65 47 65 ),o=e.getShapeGe
00031e90: 6f 6d 65 74 72 79 28 72 29 2e 62 6f 75 6e 64 73 ometry(r).bounds
00031ea0: 3b 72 65 74 75 72 6e 20 65 2e 75 70 64 61 74 65 ;return e.update
00031eb0: 53 68 61 70 65 73 28 5b 7b 69 64 3a 74 2c 74 79 Shapes([{id:t,ty
00031ec0: 70 65 3a 22 6e 6f 74 65 22 2c 78 3a 72 2e 78 2d pe:"note",x:r.x-
00031ed0: 6f 2e 77 69 64 74 68 2f 32 2c 79 3a 72 2e 79 2d o.width/2,y:r.y-
00031ee0: 6f 2e 68 65 69 67 68 74 2f 32 7d 5d 29 2c 65 2e o.height/2}]),e.
00031ef0: 67 65 74 53 68 61 70 65 28 74 29 7d 63 6f 6e 73 getShape(t)}cons
00031f00: 74 20 4b 79 3d 52 72 28 28 66 75 6e 63 74 69 6f t Ky=Rr((functio
00031f10: 6e 28 65 29 7b 63 6f 6e 73 74 20 74 3d 65 2e 67 n(e){const t=e.g
00031f20: 65 74 53 68 61 70 65 41 74 50 6f 69 6e 74 28 65 etShapeAtPoint(e
00031f30: 2e 69 6e 70 75 74 73 2e 63 75 72 72 65 6e 74 50 .inputs.currentP
00031f40: 61 67 65 50 6f 69 6e 74 2c 7b 68 69 74 49 6e 73 agePoint,{hitIns
00031f50: 69 64 65 3a 21 31 2c 68 69 74 4c 61 62 65 6c 73 ide:!1,hitLabels
00031f60: 3a 21 31 2c 6d 61 72 67 69 6e 3a 65 2e 6f 70 74 :!1,margin:e.opt
00031f70: 69 6f 6e 73 2e 68 69 74 54 65 73 74 4d 61 72 67 ions.hitTestMarg
00031f80: 69 6e 2f 65 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 in/e.getZoomLeve
00031f90: 6c 28 29 2c 72 65 6e 64 65 72 69 6e 67 4f 6e 6c l(),renderingOnl
00031fa0: 79 3a 21 30 7d 29 3b 69 66 28 21 74 29 72 65 74 y:!0});if(!t)ret
00031fb0: 75 72 6e 20 65 2e 73 65 74 48 6f 76 65 72 65 64 urn e.setHovered
00031fc0: 53 68 61 70 65 28 6e 75 6c 6c 29 3b 6c 65 74 20 Shape(null);let
00031fd0: 6e 3b 63 6f 6e 73 74 20 72 3d 65 2e 67 65 74 4f n;const r=e.getO
00031fe0: 75 74 65 72 6d 6f 73 74 53 65 6c 65 63 74 61 62 utermostSelectab
00031ff0: 6c 65 53 68 61 70 65 28 74 29 3b 72 65 74 75 72 leShape(t);retur
00032000: 6e 20 6e 3d 72 3d 3d 3d 74 7c 7c 72 2e 69 64 3d n n=r===t||r.id=
00032010: 3d 3d 65 2e 67 65 74 46 6f 63 75 73 65 64 47 72 ==e.getFocusedGr
00032020: 6f 75 70 49 64 28 29 7c 7c 65 2e 67 65 74 53 65 oupId()||e.getSe
00032030: 6c 65 63 74 65 64 53 68 61 70 65 49 64 73 28 29 lectedShapeIds()
00032040: 2e 69 6e 63 6c 75 64 65 73 28 72 2e 69 64 29 3f .includes(r.id)?
00032050: 74 3a 72 2c 65 2e 73 65 74 48 6f 76 65 72 65 64 t:r,e.setHovered
00032060: 53 68 61 70 65 28 6e 2e 69 64 29 7d 29 2c 33 32 Shape(n.id)}),32
00032070: 29 3b 63 6c 61 73 73 20 59 79 20 65 78 74 65 6e );class Yy exten
00032080: 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 64 3d ds Mm{static id=
00032090: 22 69 64 6c 65 22 3b 6f 6e 50 6f 69 6e 74 65 72 "idle";onPointer
000320a0: 4d 6f 76 65 3d 65 3d 3e 7b 73 77 69 74 63 68 28 Move=e=>{switch(
000320b0: 65 2e 74 61 72 67 65 74 29 7b 63 61 73 65 22 73 e.target){case"s
000320c0: 68 61 70 65 22 3a 63 61 73 65 22 63 61 6e 76 61 hape":case"canva
000320d0: 73 22 3a 4b 79 28 74 68 69 73 2e 65 64 69 74 6f s":Ky(this.edito
000320e0: 72 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 65 72 44 6f r)}};onPointerDo
000320f0: 77 6e 3d 65 3d 3e 7b 74 68 69 73 2e 70 61 72 65 wn=e=>{this.pare
00032100: 6e 74 2e 74 72 61 6e 73 69 74 69 6f 6e 28 22 70 nt.transition("p
00032110: 6f 69 6e 74 69 6e 67 22 2c 65 29 7d 3b 6f 6e 45 ointing",e)};onE
00032120: 6e 74 65 72 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 nter=()=>{this.e
00032130: 64 69 74 6f 72 2e 73 65 74 43 75 72 73 6f 72 28 ditor.setCursor(
00032140: 7b 74 79 70 65 3a 22 63 72 6f 73 73 22 2c 72 6f {type:"cross",ro
00032150: 74 61 74 69 6f 6e 3a 30 7d 29 7d 3b 6f 6e 45 78 tation:0})};onEx
00032160: 69 74 3d 28 29 3d 3e 7b 4b 79 2e 63 61 6e 63 65 it=()=>{Ky.cance
00032170: 6c 28 29 7d 3b 6f 6e 4b 65 79 44 6f 77 6e 3d 65 l()};onKeyDown=e
00032180: 3d 3e 7b 69 66 28 22 45 6e 74 65 72 22 3d 3d 3d =>{if("Enter"===
00032190: 65 2e 6b 65 79 29 7b 69 66 28 74 68 69 73 2e 65 e.key){if(this.e
000321a0: 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 6e 63 ditor.getInstanc
000321b0: 65 53 74 61 74 65 28 29 2e 69 73 52 65 61 64 6f eState().isReado
000321c0: 6e 6c 79 29 72 65 74 75 72 6e 20 6e 75 6c 6c 3b nly)return null;
000321d0: 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e 65 64 69 const t=this.edi
000321e0: 74 6f 72 2e 67 65 74 4f 6e 6c 79 53 65 6c 65 63 tor.getOnlySelec
000321f0: 74 65 64 53 68 61 70 65 28 29 3b 74 26 26 74 68 tedShape();t&&th
00032200: 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 68 61 is.editor.getSha
00032210: 70 65 55 74 69 6c 28 74 29 2e 63 61 6e 45 64 69 peUtil(t).canEdi
00032220: 74 28 74 29 26 26 28 74 68 69 73 2e 65 64 69 74 t(t)&&(this.edit
00032230: 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f or.setCurrentToo
00032240: 6c 28 22 73 65 6c 65 63 74 22 29 2c 74 68 69 73 l("select"),this
00032250: 2e 65 64 69 74 6f 72 2e 73 65 74 45 64 69 74 69 .editor.setEditi
00032260: 6e 67 53 68 61 70 65 28 74 2e 69 64 29 2c 74 68 ngShape(t.id),th
00032270: 69 73 2e 65 64 69 74 6f 72 2e 72 6f 6f 74 2e 67 is.editor.root.g
00032280: 65 74 43 75 72 72 65 6e 74 28 29 3f 2e 74 72 61 etCurrent()?.tra
00032290: 6e 73 69 74 69 6f 6e 28 22 65 64 69 74 69 6e 67 nsition("editing
000322a0: 5f 73 68 61 70 65 22 2c 7b 2e 2e 2e 65 2c 74 61 _shape",{...e,ta
000322b0: 72 67 65 74 3a 22 73 68 61 70 65 22 2c 73 68 61 rget:"shape",sha
000322c0: 70 65 3a 74 7d 29 29 7d 7d 3b 6f 6e 43 61 6e 63 pe:t}))}};onCanc
000322d0: 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e 65 64 69 el=()=>{this.edi
000322e0: 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f tor.setCurrentTo
000322f0: 6f 6c 28 22 73 65 6c 65 63 74 22 29 7d 7d 63 6c ol("select")}}cl
00032300: 61 73 73 20 58 79 20 65 78 74 65 6e 64 73 20 4d ass Xy extends M
00032310: 6d 7b 73 74 61 74 69 63 20 69 64 3d 22 70 6f 69 m{static id="poi
00032320: 6e 74 69 6e 67 22 3b 73 68 61 70 65 3b 6d 61 72 nting";shape;mar
00032330: 6b 49 64 3d 22 22 3b 6f 6e 45 78 69 74 3d 28 29 kId="";onExit=()
00032340: 3d 3e 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 =>{this.editor.s
00032350: 65 74 48 69 6e 74 69 6e 67 53 68 61 70 65 73 28 etHintingShapes(
00032360: 5b 5d 29 7d 3b 6f 6e 50 6f 69 6e 74 65 72 4d 6f [])};onPointerMo
00032370: 76 65 3d 65 3d 3e 7b 69 66 28 74 68 69 73 2e 65 ve=e=>{if(this.e
00032380: 64 69 74 6f 72 2e 69 6e 70 75 74 73 2e 69 73 44 ditor.inputs.isD
00032390: 72 61 67 67 69 6e 67 29 7b 63 6f 6e 73 74 7b 69 ragging){const{i
000323a0: 6e 70 75 74 73 3a 7b 6f 72 69 67 69 6e 50 61 67 nputs:{originPag
000323b0: 65 50 6f 69 6e 74 3a 74 7d 7d 3d 74 68 69 73 2e ePoint:t}}=this.
000323c0: 65 64 69 74 6f 72 2c 6e 3d 49 73 28 29 3b 74 68 editor,n=Is();th
000323d0: 69 73 2e 6d 61 72 6b 49 64 3d 60 63 72 65 61 74 is.markId=`creat
000323e0: 69 6e 67 3a 24 7b 6e 7d 60 2c 74 68 69 73 2e 65 ing:${n}`,this.e
000323f0: 64 69 74 6f 72 2e 6d 61 72 6b 28 74 68 69 73 2e ditor.mark(this.
00032400: 6d 61 72 6b 49 64 29 3b 63 6f 6e 73 74 20 72 3d markId);const r=
00032410: 74 68 69 73 2e 63 72 65 61 74 65 54 65 78 74 53 this.createTextS
00032420: 68 61 70 65 28 6e 2c 74 2c 21 31 29 3b 69 66 28 hape(n,t,!1);if(
00032430: 21 72 29 72 65 74 75 72 6e 20 76 6f 69 64 20 74 !r)return void t
00032440: 68 69 73 2e 63 61 6e 63 65 6c 28 29 3b 74 68 69 his.cancel();thi
00032450: 73 2e 73 68 61 70 65 3d 74 68 69 73 2e 65 64 69 s.shape=this.edi
00032460: 74 6f 72 2e 67 65 74 53 68 61 70 65 28 72 29 2c tor.getShape(r),
00032470: 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 6c 65 this.editor.sele
00032480: 63 74 28 6e 29 2c 74 68 69 73 2e 65 64 69 74 6f ct(n),this.edito
00032490: 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c r.setCurrentTool
000324a0: 28 22 73 65 6c 65 63 74 2e 72 65 73 69 7a 69 6e ("select.resizin
000324b0: 67 22 2c 7b 2e 2e 2e 65 2c 74 61 72 67 65 74 3a g",{...e,target:
000324c0: 22 73 65 6c 65 63 74 69 6f 6e 22 2c 68 61 6e 64 "selection",hand
000324d0: 6c 65 3a 22 72 69 67 68 74 22 2c 69 73 43 72 65 le:"right",isCre
000324e0: 61 74 69 6e 67 3a 21 30 2c 63 72 65 61 74 69 6f ating:!0,creatio
000324f0: 6e 43 75 72 73 6f 72 4f 66 66 73 65 74 3a 7b 78 nCursorOffset:{x
00032500: 3a 31 38 2c 79 3a 31 7d 2c 6f 6e 49 6e 74 65 72 :18,y:1},onInter
00032510: 61 63 74 69 6f 6e 45 6e 64 3a 22 74 65 78 74 22 actionEnd:"text"
00032520: 2c 6f 6e 43 72 65 61 74 65 3a 28 29 3d 3e 7b 74 ,onCreate:()=>{t
00032530: 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 45 64 his.editor.setEd
00032540: 69 74 69 6e 67 53 68 61 70 65 28 72 2e 69 64 29 itingShape(r.id)
00032550: 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 65 74 ,this.editor.set
00032560: 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 65 6c CurrentTool("sel
00032570: 65 63 74 2e 65 64 69 74 69 6e 67 5f 73 68 61 70 ect.editing_shap
00032580: 65 22 29 7d 7d 29 7d 7d 3b 6f 6e 50 6f 69 6e 74 e")}})}};onPoint
00032590: 65 72 55 70 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 erUp=()=>{this.c
000325a0: 6f 6d 70 6c 65 74 65 28 29 7d 3b 6f 6e 43 6f 6d omplete()};onCom
000325b0: 70 6c 65 74 65 3d 28 29 3d 3e 7b 74 68 69 73 2e plete=()=>{this.
000325c0: 63 61 6e 63 65 6c 28 29 7d 3b 6f 6e 43 61 6e 63 cancel()};onCanc
000325d0: 65 6c 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e el=()=>{this.can
000325e0: 63 65 6c 28 29 7d 3b 6f 6e 49 6e 74 65 72 72 75 cel()};onInterru
000325f0: 70 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 61 6e pt=()=>{this.can
00032600: 63 65 6c 28 29 7d 3b 63 6f 6d 70 6c 65 74 65 28 cel()};complete(
00032610: 29 7b 74 68 69 73 2e 65 64 69 74 6f 72 2e 6d 61 ){this.editor.ma
00032620: 72 6b 28 22 63 72 65 61 74 69 6e 67 20 74 65 78 rk("creating tex
00032630: 74 20 73 68 61 70 65 22 29 3b 63 6f 6e 73 74 20 t shape");const
00032640: 65 3d 49 73 28 29 2c 7b 63 75 72 72 65 6e 74 50 e=Is(),{currentP
00032650: 61 67 65 50 6f 69 6e 74 3a 74 7d 3d 74 68 69 73 agePoint:t}=this
00032660: 2e 65 64 69 74 6f 72 2e 69 6e 70 75 74 73 3b 74 .editor.inputs;t
00032670: 68 69 73 2e 63 72 65 61 74 65 54 65 78 74 53 68 his.createTextSh
00032680: 61 70 65 28 65 2c 74 2c 21 30 29 26 26 28 74 68 ape(e,t,!0)&&(th
00032690: 69 73 2e 65 64 69 74 6f 72 2e 73 65 6c 65 63 74 is.editor.select
000326a0: 28 65 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e (e),this.editor.
000326b0: 73 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 28 setEditingShape(
000326c0: 65 29 2c 74 68 69 73 2e 65 64 69 74 6f 72 2e 73 e),this.editor.s
000326d0: 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c 28 22 73 etCurrentTool("s
000326e0: 65 6c 65 63 74 22 29 2c 74 68 69 73 2e 65 64 69 elect"),this.edi
000326f0: 74 6f 72 2e 72 6f 6f 74 2e 67 65 74 43 75 72 72 tor.root.getCurr
00032700: 65 6e 74 28 29 3f 2e 74 72 61 6e 73 69 74 69 6f ent()?.transitio
00032710: 6e 28 22 65 64 69 74 69 6e 67 5f 73 68 61 70 65 n("editing_shape
00032720: 22 29 29 7d 63 61 6e 63 65 6c 28 29 7b 74 68 69 "))}cancel(){thi
00032730: 73 2e 70 61 72 65 6e 74 2e 74 72 61 6e 73 69 74 s.parent.transit
00032740: 69 6f 6e 28 22 69 64 6c 65 22 29 2c 74 68 69 73 ion("idle"),this
00032750: 2e 65 64 69 74 6f 72 2e 62 61 69 6c 54 6f 4d 61 .editor.bailToMa
00032760: 72 6b 28 74 68 69 73 2e 6d 61 72 6b 49 64 29 7d rk(this.markId)}
00032770: 63 72 65 61 74 65 54 65 78 74 53 68 61 70 65 28 createTextShape(
00032780: 65 2c 74 2c 6e 29 7b 74 68 69 73 2e 65 64 69 74 e,t,n){this.edit
00032790: 6f 72 2e 63 72 65 61 74 65 53 68 61 70 65 28 7b or.createShape({
000327a0: 69 64 3a 65 2c 74 79 70 65 3a 22 74 65 78 74 22 id:e,type:"text"
000327b0: 2c 78 3a 74 2e 78 2c 79 3a 74 2e 79 2c 70 72 6f ,x:t.x,y:t.y,pro
000327c0: 70 73 3a 7b 74 65 78 74 3a 22 22 2c 61 75 74 6f ps:{text:"",auto
000327d0: 53 69 7a 65 3a 6e 2c 77 3a 32 30 2c 73 63 61 6c Size:n,w:20,scal
000327e0: 65 3a 74 68 69 73 2e 65 64 69 74 6f 72 2e 75 73 e:this.editor.us
000327f0: 65 72 2e 67 65 74 49 73 44 79 6e 61 6d 69 63 52 er.getIsDynamicR
00032800: 65 73 69 7a 65 4d 6f 64 65 28 29 3f 31 2f 74 68 esizeMode()?1/th
00032810: 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 5a 6f 6f is.editor.getZoo
00032820: 6d 4c 65 76 65 6c 28 29 3a 31 7d 7d 29 3b 63 6f mLevel():1}});co
00032830: 6e 73 74 20 72 3d 74 68 69 73 2e 65 64 69 74 6f nst r=this.edito
00032840: 72 2e 67 65 74 53 68 61 70 65 28 65 29 3b 69 66 r.getShape(e);if
00032850: 28 21 72 29 72 65 74 75 72 6e 20 76 6f 69 64 20 (!r)return void
00032860: 74 68 69 73 2e 63 61 6e 63 65 6c 28 29 3b 63 6f this.cancel();co
00032870: 6e 73 74 20 6f 3d 74 68 69 73 2e 65 64 69 74 6f nst o=this.edito
00032880: 72 2e 67 65 74 53 68 61 70 65 50 61 67 65 42 6f r.getShapePageBo
00032890: 75 6e 64 73 28 72 29 2c 69 3d 6e 65 77 20 73 75 unds(r),i=new su
000328a0: 3b 69 66 28 6e 29 73 77 69 74 63 68 28 72 2e 70 ;if(n)switch(r.p
000328b0: 72 6f 70 73 2e 74 65 78 74 41 6c 69 67 6e 29 7b rops.textAlign){
000328c0: 63 61 73 65 22 73 74 61 72 74 22 3a 69 2e 78 3d case"start":i.x=
000328d0: 30 3b 62 72 65 61 6b 3b 63 61 73 65 22 6d 69 64 0;break;case"mid
000328e0: 64 6c 65 22 3a 69 2e 78 3d 2d 6f 2e 77 69 64 74 dle":i.x=-o.widt
000328f0: 68 2f 32 3b 62 72 65 61 6b 3b 63 61 73 65 22 65 h/2;break;case"e
00032900: 6e 64 22 3a 69 2e 78 3d 2d 6f 2e 77 69 64 74 68 nd":i.x=-o.width
00032910: 7d 65 6c 73 65 20 69 2e 78 3d 30 3b 69 66 28 69 }else i.x=0;if(i
00032920: 2e 79 3d 2d 6f 2e 68 65 69 67 68 74 2f 32 2c 41 .y=-o.height/2,A
00032930: 73 28 72 2e 70 61 72 65 6e 74 49 64 29 29 7b 63 s(r.parentId)){c
00032940: 6f 6e 73 74 20 65 3d 74 68 69 73 2e 65 64 69 74 onst e=this.edit
00032950: 6f 72 2e 67 65 74 53 68 61 70 65 50 61 72 65 6e or.getShapeParen
00032960: 74 54 72 61 6e 73 66 6f 72 6d 28 72 29 3b 69 2e tTransform(r);i.
00032970: 72 6f 74 28 2d 65 2e 72 6f 74 61 74 69 6f 6e 28 rot(-e.rotation(
00032980: 29 29 7d 72 65 74 75 72 6e 20 74 68 69 73 2e 65 ))}return this.e
00032990: 64 69 74 6f 72 2e 75 70 64 61 74 65 53 68 61 70 ditor.updateShap
000329a0: 65 28 7b 2e 2e 2e 72 2c 78 3a 72 2e 78 2b 69 2e e({...r,x:r.x+i.
000329b0: 78 2c 79 3a 72 2e 79 2b 69 2e 79 7d 29 2c 72 7d x,y:r.y+i.y}),r}
000329c0: 7d 63 6f 6e 73 74 20 5a 79 3d 5b 63 6c 61 73 73 }const Zy=[class
000329d0: 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 74 61 74 extends Mm{stat
000329e0: 69 63 20 69 64 3d 22 74 65 78 74 22 3b 73 74 61 ic id="text";sta
000329f0: 74 69 63 20 69 6e 69 74 69 61 6c 3d 22 69 64 6c tic initial="idl
00032a00: 65 22 3b 73 74 61 74 69 63 20 63 68 69 6c 64 72 e";static childr
00032a10: 65 6e 3d 28 29 3d 3e 5b 59 79 2c 58 79 5d 3b 73 en=()=>[Yy,Xy];s
00032a20: 68 61 70 65 54 79 70 65 3d 22 74 65 78 74 22 7d hapeType="text"}
00032a30: 2c 63 6c 61 73 73 20 65 78 74 65 6e 64 73 20 4d ,class extends M
00032a40: 6d 7b 73 74 61 74 69 63 20 69 64 3d 22 64 72 61 m{static id="dra
00032a50: 77 22 3b 73 74 61 74 69 63 20 69 6e 69 74 69 61 w";static initia
00032a60: 6c 3d 22 69 64 6c 65 22 3b 73 74 61 74 69 63 20 l="idle";static
00032a70: 63 68 69 6c 64 72 65 6e 3d 28 29 3d 3e 5b 54 79 children=()=>[Ty
00032a80: 2c 78 79 5d 3b 73 68 61 70 65 54 79 70 65 3d 22 ,xy];shapeType="
00032a90: 64 72 61 77 22 3b 6f 6e 45 78 69 74 3d 28 29 3d draw";onExit=()=
00032aa0: 3e 7b 74 68 69 73 2e 63 68 69 6c 64 72 65 6e 2e >{this.children.
00032ab0: 64 72 61 77 69 6e 67 2e 69 6e 69 74 69 61 6c 53 drawing.initialS
00032ac0: 68 61 70 65 3d 76 6f 69 64 20 30 7d 7d 2c 63 6c hape=void 0}},cl
00032ad0: 61 73 73 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 ass extends Mm{s
00032ae0: 74 61 74 69 63 20 69 64 3d 22 67 65 6f 22 3b 73 tatic id="geo";s
00032af0: 74 61 74 69 63 20 69 6e 69 74 69 61 6c 3d 22 69 tatic initial="i
00032b00: 64 6c 65 22 3b 73 74 61 74 69 63 20 63 68 69 6c dle";static chil
00032b10: 64 72 65 6e 3d 28 29 3d 3e 5b 43 79 2c 6b 79 5d dren=()=>[Cy,ky]
00032b20: 3b 73 68 61 70 65 54 79 70 65 3d 22 67 65 6f 22 ;shapeType="geo"
00032b30: 7d 2c 63 6c 61 73 73 20 65 78 74 65 6e 64 73 20 },class extends
00032b40: 4d 6d 7b 73 74 61 74 69 63 20 69 64 3d 22 6e 6f Mm{static id="no
00032b50: 74 65 22 3b 73 74 61 74 69 63 20 69 6e 69 74 69 te";static initi
00032b60: 61 6c 3d 22 69 64 6c 65 22 3b 73 74 61 74 69 63 al="idle";static
00032b70: 20 63 68 69 6c 64 72 65 6e 3d 28 29 3d 3e 5b 52 children=()=>[R
00032b80: 79 2c 56 79 5d 3b 73 68 61 70 65 54 79 70 65 3d y,Vy];shapeType=
00032b90: 22 6e 6f 74 65 22 7d 2c 63 6c 61 73 73 20 65 78 "note"},class ex
00032ba0: 74 65 6e 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 tends Mm{static
00032bb0: 69 64 3d 22 6c 69 6e 65 22 3b 73 74 61 74 69 63 id="line";static
00032bc0: 20 69 6e 69 74 69 61 6c 3d 22 69 64 6c 65 22 3b initial="idle";
00032bd0: 73 74 61 74 69 63 20 63 68 69 6c 64 72 65 6e 3d static children=
00032be0: 28 29 3d 3e 5b 41 79 2c 49 79 5d 3b 73 68 61 70 ()=>[Ay,Iy];shap
00032bf0: 65 54 79 70 65 3d 22 6c 69 6e 65 22 7d 2c 63 6c eType="line"},cl
00032c00: 61 73 73 20 65 78 74 65 6e 64 73 20 52 67 7b 73 ass extends Rg{s
00032c10: 74 61 74 69 63 20 69 64 3d 22 66 72 61 6d 65 22 tatic id="frame"
00032c20: 3b 73 74 61 74 69 63 20 69 6e 69 74 69 61 6c 3d ;static initial=
00032c30: 22 69 64 6c 65 22 3b 73 68 61 70 65 54 79 70 65 "idle";shapeType
00032c40: 3d 22 66 72 61 6d 65 22 3b 6f 6e 43 72 65 61 74 ="frame";onCreat
00032c50: 65 3d 65 3d 3e 7b 69 66 28 21 65 29 72 65 74 75 e=e=>{if(!e)retu
00032c60: 72 6e 3b 63 6f 6e 73 74 20 74 3d 74 68 69 73 2e rn;const t=this.
00032c70: 65 64 69 74 6f 72 2e 67 65 74 53 68 61 70 65 50 editor.getShapeP
00032c80: 61 67 65 42 6f 75 6e 64 73 28 65 29 2c 6e 3d 5b ageBounds(e),n=[
00032c90: 5d 2c 72 3d 74 68 69 73 2e 65 64 69 74 6f 72 2e ],r=this.editor.
00032ca0: 67 65 74 53 68 61 70 65 41 6e 63 65 73 74 6f 72 getShapeAncestor
00032cb0: 73 28 65 29 2e 6d 61 70 28 28 65 3d 3e 65 2e 69 s(e).map((e=>e.i
00032cc0: 64 29 29 3b 74 68 69 73 2e 65 64 69 74 6f 72 2e d));this.editor.
00032cd0: 67 65 74 53 6f 72 74 65 64 43 68 69 6c 64 49 64 getSortedChildId
00032ce0: 73 46 6f 72 50 61 72 65 6e 74 28 65 2e 70 61 72 sForParent(e.par
00032cf0: 65 6e 74 49 64 29 2e 6d 61 70 28 28 6f 3d 3e 7b entId).map((o=>{
00032d00: 63 6f 6e 73 74 20 69 3d 74 68 69 73 2e 65 64 69 const i=this.edi
00032d10: 74 6f 72 2e 67 65 74 53 68 61 70 65 28 6f 29 3b tor.getShape(o);
00032d20: 69 66 28 21 69 29 72 65 74 75 72 6e 3b 69 66 28 if(!i)return;if(
00032d30: 69 2e 69 64 3d 3d 3d 65 2e 69 64 29 72 65 74 75 i.id===e.id)retu
00032d40: 72 6e 3b 69 66 28 69 2e 69 73 4c 6f 63 6b 65 64 rn;if(i.isLocked
00032d50: 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 61 3d )return;const a=
00032d60: 74 68 69 73 2e 65 64 69 74 6f 72 2e 67 65 74 53 this.editor.getS
00032d70: 68 61 70 65 50 61 67 65 42 6f 75 6e 64 73 28 69 hapePageBounds(i
00032d80: 29 3b 61 26 26 74 2e 63 6f 6e 74 61 69 6e 73 28 );a&&t.contains(
00032d90: 61 29 26 26 66 75 6e 63 74 69 6f 6e 28 65 2c 74 a)&&function(e,t
00032da0: 2c 6e 29 7b 69 66 28 74 2e 69 6e 63 6c 75 64 65 ,n){if(t.include
00032db0: 73 28 65 2e 69 64 29 29 72 65 74 75 72 6e 21 31 s(e.id))return!1
00032dc0: 3b 69 66 28 65 2e 70 61 72 65 6e 74 49 64 3d 3d ;if(e.parentId==
00032dd0: 3d 6e 2e 70 61 72 65 6e 74 49 64 29 72 65 74 75 =n.parentId)retu
00032de0: 72 6e 21 30 3b 72 65 74 75 72 6e 21 31 7d 28 69 rn!0;return!1}(i
00032df0: 2c 72 2c 65 29 26 26 6e 2e 70 75 73 68 28 69 2e ,r,e)&&n.push(i.
00032e00: 69 64 29 7d 29 29 2c 74 68 69 73 2e 65 64 69 74 id)})),this.edit
00032e10: 6f 72 2e 72 65 70 61 72 65 6e 74 53 68 61 70 65 or.reparentShape
00032e20: 73 28 6e 2c 65 2e 69 64 29 2c 74 68 69 73 2e 65 s(n,e.id),this.e
00032e30: 64 69 74 6f 72 2e 67 65 74 49 6e 73 74 61 6e 63 ditor.getInstanc
00032e40: 65 53 74 61 74 65 28 29 2e 69 73 54 6f 6f 6c 4c eState().isToolL
00032e50: 6f 63 6b 65 64 3f 74 68 69 73 2e 65 64 69 74 6f ocked?this.edito
00032e60: 72 2e 73 65 74 43 75 72 72 65 6e 74 54 6f 6f 6c r.setCurrentTool
00032e70: 28 22 66 72 61 6d 65 22 29 3a 74 68 69 73 2e 65 ("frame"):this.e
00032e80: 64 69 74 6f 72 2e 73 65 74 43 75 72 72 65 6e 74 ditor.setCurrent
00032e90: 54 6f 6f 6c 28 22 73 65 6c 65 63 74 2e 69 64 6c Tool("select.idl
00032ea0: 65 22 29 7d 7d 2c 63 6c 61 73 73 20 65 78 74 65 e")}},class exte
00032eb0: 6e 64 73 20 4d 6d 7b 73 74 61 74 69 63 20 69 64 nds Mm{static id
00032ec0: 3d 22 61 72 72 6f 77 22 3b 73 74 61 74 69 63 20 ="arrow";static
00032ed0: 69 6e 69 74 69 61 6c 3d 22 69 64 6c 65 22 3b 73 initial="idle";s
00032ee0: 74 61 74 69 63 20 63 68 69 6c 64 72 65 6e 3d 28 tatic children=(
00032ef0: 29 3d 3e 5b 45 79 2c 77 79 5d 3b 73 68 61 70 65 )=>[Ey,wy];shape
00032f00: 54 79 70 65 3d 22 61 72 72 6f 77 22 7d 2c 63 6c Type="arrow"},cl
00032f10: 61 73 73 20 65 78 74 65 6e 64 73 20 4d 6d 7b 73 ass extends Mm{s
00032f20: 74 61 74 69 63 20 69 64 3d 22 68 69 67 68 6c 69 tatic id="highli
00032f30: 67 68 74 22 3b 73 74 61 74 69 63 20 69 6e 69 74 ght";static init
00032f40: 69 61 6c 3d 22 69 64 6c 65 22 3b 73 74 61 74 69 ial="idle";stati
00032f50: 63 20 63 68 69 6c 64 72 65 6e 3d 28 29 3d 3e 5b c children=()=>[
00032f60: 54 79 2c 78 79 5d 3b 73 68 61 70 65 54 79 70 65 Ty,xy];shapeType
00032f70: 3d 22 68 69 67 68 6c 69 67 68 74 22 3b 6f 6e 45 ="highlight";onE
00032f80: 78 69 74 3d 28 29 3d 3e 7b 74 68 69 73 2e 63 68 xit=()=>{this.ch
00032f90: 69 6c 64 72 65 6e 2e 64 72 61 77 69 6e 67 2e 69 ildren.drawing.i
00032fa0: 6e 69 74 69 61 6c 53 68 61 70 65 3d 76 6f 69 64 nitialShape=void
00032fb0: 20 30 7d 7d 5d 3b 66 75 6e 63 74 69 6f 6e 20 51 0}}];function Q
00032fc0: 79 28 29 7b 72 65 74 75 72 6e 20 46 73 28 7b 69 y(){return Fs({i
00032fd0: 73 44 61 72 6b 4d 6f 64 65 3a 71 6d 28 29 7d 29 sDarkMode:qm()})
00032fe0: 7d 66 75 6e 63 74 69 6f 6e 20 4a 79 28 65 29 7b }function Jy(e){
00032ff0: 72 65 74 75 72 6e 7b 6b 65 79 3a 60 24 7b 47 73 return{key:`${Gs
00033000: 2e 69 64 7d 3a 24 7b 65 7d 60 2c 67 65 74 45 6c .id}:${e}`,getEl
00033010: 65 6d 65 6e 74 3a 61 73 79 6e 63 28 29 3d 3e 7b ement:async()=>{
00033020: 63 6f 6e 73 74 20 74 3d 66 75 6e 63 74 69 6f 6e const t=function
00033030: 28 65 29 7b 63 6f 6e 73 74 20 74 3d 48 73 5b 65 (e){const t=Hs[e
00033040: 5d 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 ];for(const e of
00033050: 20 64 6f 63 75 6d 65 6e 74 2e 66 6f 6e 74 73 29 document.fonts)
00033060: 69 66 28 74 2e 69 6e 63 6c 75 64 65 73 28 65 2e if(t.includes(e.
00033070: 66 61 6d 69 6c 79 29 29 72 65 74 75 72 6e 20 65 family))return e
00033080: 3b 72 65 74 75 72 6e 20 6e 75 6c 6c 7d 28 65 29 ;return null}(e)
00033090: 3b 69 66 28 21 74 29 72 65 74 75 72 6e 20 6e 75 ;if(!t)return nu
000330a0: 6c 6c 3b 63 6f 6e 73 74 20 6e 3d 74 2e 24 24 5f ll;const n=t.$$_
000330b0: 75 72 6c 2c 72 3d 74 2e 24 24 5f 66 6f 6e 74 66 url,r=t.$$_fontf
000330c0: 61 63 65 3b 69 66 28 21 6e 7c 7c 21 72 29 72 65 ace;if(!n||!r)re
000330d0: 74 75 72 6e 20 6e 75 6c 6c 3b 63 6f 6e 73 74 20 turn null;const
000330e0: 6f 3d 61 77 61 69 74 28 61 77 61 69 74 20 51 72 o=await(await Qr
000330f0: 28 6e 29 29 2e 62 6c 6f 62 28 29 2c 69 3d 61 77 (n)).blob(),i=aw
00033100: 61 69 74 20 24 72 2e 62 6c 6f 62 54 6f 44 61 74 ait $r.blobToDat
00033110: 61 55 72 6c 28 6f 29 2c 61 3d 72 2e 72 65 70 6c aUrl(o),a=r.repl
00033120: 61 63 65 28 6e 2c 69 29 3b 72 65 74 75 72 6e 28 ace(n,i);return(
00033130: 30 2c 51 63 2e 6a 73 78 29 28 22 73 74 79 6c 65 0,Qc.jsx)("style
00033140: 22 2c 7b 63 68 69 6c 64 72 65 6e 3a 61 7d 29 7d ",{children:a})}
00033150: 7d 7d 66 75 6e 63 74 69 6f 6e 20 24 79 28 65 29 }}function $y(e)
00033160: 7b 72 65 74 75 72 6e 7b 6b 65 79 3a 60 24 7b 47 {return{key:`${G
00033170: 73 2e 69 64 7d 3a 24 7b 65 7d 60 2c 67 65 74 45 s.id}:${e}`,getE
00033180: 6c 65 6d 65 6e 74 3a 61 73 79 6e 63 28 29 3d 3e lement:async()=>
00033190: 22 70 61 74 74 65 72 6e 22 21 3d 3d 65 3f 6e 75 "pattern"!==e?nu
000331a0: 6c 6c 3a 28 30 2c 51 63 2e 6a 73 78 29 28 65 76 ll:(0,Qc.jsx)(ev
000331b0: 2c 7b 7d 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 65 ,{})}}function e
000331c0: 76 28 29 7b 63 6f 6e 73 74 20 65 3d 51 79 28 29 v(){const e=Qy()
000331d0: 2c 74 3d 38 2f 31 32 3b 72 65 74 75 72 6e 28 30 ,t=8/12;return(0
000331e0: 2c 51 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 ,Qc.jsxs)(Qc.Fra
000331f0: 67 6d 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a gment,{children:
00033200: 5b 28 30 2c 51 63 2e 6a 73 78 73 29 28 22 6d 61 [(0,Qc.jsxs)("ma
00033210: 73 6b 22 2c 7b 69 64 3a 22 68 61 73 68 5f 70 61 sk",{id:"hash_pa
00033220: 74 74 65 72 6e 5f 6d 61 73 6b 22 2c 63 68 69 6c ttern_mask",chil
00033230: 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 dren:[(0,Qc.jsx)
00033240: 28 22 72 65 63 74 22 2c 7b 78 3a 22 30 22 2c 79 ("rect",{x:"0",y
00033250: 3a 22 30 22 2c 77 69 64 74 68 3a 22 38 22 2c 68 :"0",width:"8",h
00033260: 65 69 67 68 74 3a 22 38 22 2c 66 69 6c 6c 3a 22 eight:"8",fill:"
00033270: 77 68 69 74 65 22 7d 29 2c 28 30 2c 51 63 2e 6a white"}),(0,Qc.j
00033280: 73 78 73 29 28 22 67 22 2c 7b 73 74 72 6f 6b 65 sxs)("g",{stroke
00033290: 4c 69 6e 65 63 61 70 3a 22 72 6f 75 6e 64 22 2c Linecap:"round",
000332a0: 73 74 72 6f 6b 65 3a 22 62 6c 61 63 6b 22 2c 63 stroke:"black",c
000332b0: 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a hildren:[(0,Qc.j
000332c0: 73 78 29 28 22 6c 69 6e 65 22 2c 7b 78 31 3a 31 sx)("line",{x1:1
000332d0: 2a 74 2c 79 31 3a 32 2c 78 32 3a 32 2c 79 32 3a *t,y1:2,x2:2,y2:
000332e0: 31 2a 74 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 1*t}),(0,Qc.jsx)
000332f0: 28 22 6c 69 6e 65 22 2c 7b 78 31 3a 35 2a 74 2c ("line",{x1:5*t,
00033300: 79 31 3a 37 2a 74 2c 78 32 3a 37 2a 74 2c 79 32 y1:7*t,x2:7*t,y2
00033310: 3a 35 2a 74 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 :5*t}),(0,Qc.jsx
00033320: 29 28 22 6c 69 6e 65 22 2c 7b 78 31 3a 36 2c 79 )("line",{x1:6,y
00033330: 31 3a 31 31 2a 74 2c 78 32 3a 31 31 2a 74 2c 79 1:11*t,x2:11*t,y
00033340: 32 3a 36 7d 29 5d 7d 29 5d 7d 29 2c 28 30 2c 51 2:6})]})]}),(0,Q
00033350: 63 2e 6a 73 78 29 28 22 70 61 74 74 65 72 6e 22 c.jsx)("pattern"
00033360: 2c 7b 69 64 3a 73 76 28 31 2c 65 2e 69 64 29 2c ,{id:sv(1,e.id),
00033370: 77 69 64 74 68 3a 22 38 22 2c 68 65 69 67 68 74 width:"8",height
00033380: 3a 22 38 22 2c 70 61 74 74 65 72 6e 55 6e 69 74 :"8",patternUnit
00033390: 73 3a 22 75 73 65 72 53 70 61 63 65 4f 6e 55 73 s:"userSpaceOnUs
000333a0: 65 22 2c 63 68 69 6c 64 72 65 6e 3a 28 30 2c 51 e",children:(0,Q
000333b0: 63 2e 6a 73 78 29 28 22 72 65 63 74 22 2c 7b 78 c.jsx)("rect",{x
000333c0: 3a 22 30 22 2c 79 3a 22 30 22 2c 77 69 64 74 68 :"0",y:"0",width
000333d0: 3a 22 38 22 2c 68 65 69 67 68 74 3a 22 38 22 2c :"8",height:"8",
000333e0: 66 69 6c 6c 3a 65 2e 73 6f 6c 69 64 2c 6d 61 73 fill:e.solid,mas
000333f0: 6b 3a 22 75 72 6c 28 23 68 61 73 68 5f 70 61 74 k:"url(#hash_pat
00033400: 74 65 72 6e 5f 6d 61 73 6b 29 22 7d 29 7d 29 5d tern_mask)"})})]
00033410: 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 74 76 28 29 })}function tv()
00033420: 7b 72 65 74 75 72 6e 7b 6b 65 79 3a 60 24 7b 47 {return{key:`${G
00033430: 73 2e 69 64 7d 3a 70 61 74 74 65 72 6e 60 2c 63 s.id}:pattern`,c
00033440: 6f 6d 70 6f 6e 65 6e 74 3a 75 76 7d 7d 63 6f 6e omponent:uv}}con
00033450: 73 74 20 6e 76 3d 38 2c 72 76 3d 28 65 2c 74 2c st nv=8,rv=(e,t,
00033460: 6e 29 3d 3e 6e 65 77 20 50 72 6f 6d 69 73 65 28 n)=>new Promise(
00033470: 28 28 72 2c 6f 29 3d 3e 7b 63 6f 6e 73 74 20 69 ((r,o)=>{const i
00033480: 3d 6e 76 2a 74 2a 65 2c 61 3d 64 6f 63 75 6d 65 =nv*t*e,a=docume
00033490: 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 nt.createElement
000334a0: 28 22 63 61 6e 76 61 73 22 29 3b 61 2e 77 69 64 ("canvas");a.wid
000334b0: 74 68 3d 69 2c 61 2e 68 65 69 67 68 74 3d 69 3b th=i,a.height=i;
000334c0: 63 6f 6e 73 74 20 73 3d 61 2e 67 65 74 43 6f 6e const s=a.getCon
000334d0: 74 65 78 74 28 22 32 64 22 29 3b 69 66 28 21 73 text("2d");if(!s
000334e0: 29 72 65 74 75 72 6e 3b 73 2e 66 69 6c 6c 53 74 )return;s.fillSt
000334f0: 79 6c 65 3d 6e 3f 4c 73 2e 64 61 72 6b 4d 6f 64 yle=n?Ls.darkMod
00033500: 65 2e 73 6f 6c 69 64 3a 4c 73 2e 6c 69 67 68 74 e.solid:Ls.light
00033510: 4d 6f 64 65 2e 73 6f 6c 69 64 2c 73 2e 66 69 6c Mode.solid,s.fil
00033520: 6c 52 65 63 74 28 30 2c 30 2c 69 2c 69 29 2c 73 lRect(0,0,i,i),s
00033530: 2e 67 6c 6f 62 61 6c 43 6f 6d 70 6f 73 69 74 65 .globalComposite
00033540: 4f 70 65 72 61 74 69 6f 6e 3d 22 64 65 73 74 69 Operation="desti
00033550: 6e 61 74 69 6f 6e 2d 6f 75 74 22 2c 73 2e 6c 69 nation-out",s.li
00033560: 6e 65 43 61 70 3d 22 72 6f 75 6e 64 22 2c 73 2e neCap="round",s.
00033570: 6c 69 6e 65 57 69 64 74 68 3d 31 2e 32 35 2a 74 lineWidth=1.25*t
00033580: 2a 65 3b 63 6f 6e 73 74 20 6c 3d 38 2f 31 32 2c *e;const l=8/12,
00033590: 63 3d 6e 3d 3e 6e 2a 74 2a 65 3b 73 2e 62 65 67 c=n=>n*t*e;s.beg
000335a0: 69 6e 50 61 74 68 28 29 2c 73 2e 6d 6f 76 65 54 inPath(),s.moveT
000335b0: 6f 28 63 28 31 2a 6c 29 2c 63 28 32 29 29 2c 73 o(c(1*l),c(2)),s
000335c0: 2e 6c 69 6e 65 54 6f 28 63 28 32 29 2c 63 28 31 .lineTo(c(2),c(1
000335d0: 2a 6c 29 29 2c 73 2e 6d 6f 76 65 54 6f 28 63 28 *l)),s.moveTo(c(
000335e0: 35 2a 6c 29 2c 63 28 37 2a 6c 29 29 2c 73 2e 6c 5*l),c(7*l)),s.l
000335f0: 69 6e 65 54 6f 28 63 28 37 2a 6c 29 2c 63 28 35 ineTo(c(7*l),c(5
00033600: 2a 6c 29 29 2c 73 2e 6d 6f 76 65 54 6f 28 63 28 *l)),s.moveTo(c(
00033610: 36 29 2c 63 28 31 31 2a 6c 29 29 2c 73 2e 6c 69 6),c(11*l)),s.li
00033620: 6e 65 54 6f 28 63 28 31 31 2a 6c 29 2c 63 28 36 neTo(c(11*l),c(6
00033630: 29 29 2c 73 2e 73 74 72 6f 6b 65 28 29 2c 61 2e )),s.stroke(),a.
00033640: 74 6f 42 6c 6f 62 28 28 65 3d 3e 7b 21 65 7c 7c toBlob((e=>{!e||
00033650: 58 75 2e 74 68 72 6f 77 54 6f 42 6c 6f 62 2e 67 Xu.throwToBlob.g
00033660: 65 74 28 29 3f 6f 28 29 3a 72 28 65 29 7d 29 29 et()?o():r(e)}))
00033670: 7d 29 29 2c 6f 76 3d 28 65 2c 74 29 3d 3e 7b 63 })),ov=(e,t)=>{c
00033680: 6f 6e 73 74 20 6e 3d 64 6f 63 75 6d 65 6e 74 2e onst n=document.
00033690: 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 22 63 createElement("c
000336a0: 61 6e 76 61 73 22 29 3b 6e 2e 77 69 64 74 68 3d anvas");n.width=
000336b0: 65 5b 30 5d 2c 6e 2e 68 65 69 67 68 74 3d 65 5b e[0],n.height=e[
000336c0: 31 5d 3b 63 6f 6e 73 74 20 72 3d 6e 2e 67 65 74 1];const r=n.get
000336d0: 43 6f 6e 74 65 78 74 28 22 32 64 22 29 3b 72 65 Context("2d");re
000336e0: 74 75 72 6e 20 72 3f 28 74 28 72 29 2c 6e 2e 74 turn r?(t(r),n.t
000336f0: 6f 44 61 74 61 55 52 4c 28 29 29 3a 22 22 7d 3b oDataURL()):""};
00033700: 6c 65 74 20 69 76 3d 6e 75 6c 6c 3b 66 75 6e 63 let iv=null;func
00033710: 74 69 6f 6e 20 61 76 28 65 29 7b 72 65 74 75 72 tion av(e){retur
00033720: 6e 20 4d 61 74 68 2e 63 65 69 6c 28 4d 61 74 68 n Math.ceil(Math
00033730: 2e 6c 6f 67 32 28 4d 61 74 68 2e 6d 61 78 28 31 .log2(Math.max(1
00033740: 2c 65 29 29 29 7d 66 75 6e 63 74 69 6f 6e 20 73 ,e)))}function s
00033750: 76 28 65 2c 74 29 7b 72 65 74 75 72 6e 60 74 6c v(e,t){return`tl
00033760: 64 72 61 77 5f 68 61 73 68 5f 70 61 74 74 65 72 draw_hash_patter
00033770: 6e 5f 24 7b 74 7d 5f 24 7b 61 76 28 65 29 7d 60 n_${t}_${av(e)}`
00033780: 7d 66 75 6e 63 74 69 6f 6e 20 6c 76 28 65 29 7b }function lv(e){
00033790: 63 6f 6e 73 74 20 74 3d 5b 5d 2c 6e 3d 61 76 28 const t=[],n=av(
000337a0: 65 29 3b 66 6f 72 28 6c 65 74 20 65 3d 30 3b 65 e);for(let e=0;e
000337b0: 3c 3d 6e 3b 65 2b 2b 29 74 2e 70 75 73 68 28 4d <=n;e++)t.push(M
000337c0: 61 74 68 2e 70 6f 77 28 32 2c 65 29 29 3b 72 65 ath.pow(2,e));re
000337d0: 74 75 72 6e 20 74 7d 66 75 6e 63 74 69 6f 6e 20 turn t}function
000337e0: 63 76 28 65 29 7b 63 6f 6e 73 74 20 74 3d 28 69 cv(e){const t=(i
000337f0: 76 7c 7c 28 69 76 3d 7b 77 68 69 74 65 3a 6f 76 v||(iv={white:ov
00033800: 28 5b 31 2c 31 5d 2c 28 65 3d 3e 7b 65 2e 66 69 ([1,1],(e=>{e.fi
00033810: 6c 6c 53 74 79 6c 65 3d 22 23 66 38 66 39 66 61 llStyle="#f8f9fa
00033820: 22 2c 65 2e 66 69 6c 6c 52 65 63 74 28 30 2c 30 ",e.fillRect(0,0
00033830: 2c 31 2c 31 29 7d 29 29 2c 62 6c 61 63 6b 3a 6f ,1,1)})),black:o
00033840: 76 28 5b 31 2c 31 5d 2c 28 65 3d 3e 7b 65 2e 66 v([1,1],(e=>{e.f
00033850: 69 6c 6c 53 74 79 6c 65 3d 22 23 32 31 32 35 32 illStyle="#21252
00033860: 39 22 2c 65 2e 66 69 6c 6c 52 65 63 74 28 30 2c 9",e.fillRect(0,
00033870: 30 2c 31 2c 31 29 7d 29 29 7d 29 2c 69 76 29 3b 0,1,1)}))}),iv);
00033880: 72 65 74 75 72 6e 20 6c 76 28 65 29 2e 66 6c 61 return lv(e).fla
00033890: 74 4d 61 70 28 28 65 3d 3e 5b 7b 7a 6f 6f 6d 3a tMap((e=>[{zoom:
000338a0: 65 2c 75 72 6c 3a 74 2e 77 68 69 74 65 2c 74 68 e,url:t.white,th
000338b0: 65 6d 65 3a 22 6c 69 67 68 74 22 7d 2c 7b 7a 6f eme:"light"},{zo
000338c0: 6f 6d 3a 65 2c 75 72 6c 3a 74 2e 62 6c 61 63 6b om:e,url:t.black
000338d0: 2c 74 68 65 6d 65 3a 22 64 61 72 6b 22 7d 5d 29 ,theme:"dark"}])
000338e0: 29 7d 66 75 6e 63 74 69 6f 6e 20 75 76 28 29 7b )}function uv(){
000338f0: 63 6f 6e 73 74 20 65 3d 72 75 28 29 2c 74 3d 28 const e=ru(),t=(
00033900: 30 2c 6f 2e 75 73 65 52 65 66 29 28 6e 75 6c 6c 0,o.useRef)(null
00033910: 29 2c 7b 64 65 66 73 3a 6e 2c 69 73 52 65 61 64 ),{defs:n,isRead
00033920: 79 3a 72 7d 3d 66 75 6e 63 74 69 6f 6e 28 29 7b y:r}=function(){
00033930: 63 6f 6e 73 74 20 65 3d 72 75 28 29 2c 74 3d 64 const e=ru(),t=d
00033940: 61 28 22 64 65 76 69 63 65 50 69 78 65 6c 52 61 a("devicePixelRa
00033950: 74 69 6f 22 2c 28 28 29 3d 3e 65 2e 67 65 74 49 tio",(()=>e.getI
00033960: 6e 73 74 61 6e 63 65 53 74 61 74 65 28 29 2e 64 nstanceState().d
00033970: 65 76 69 63 65 50 69 78 65 6c 52 61 74 69 6f 29 evicePixelRatio)
00033980: 2c 5b 65 5d 29 2c 6e 3d 64 61 28 22 6d 61 78 5a ,[e]),n=da("maxZ
00033990: 6f 6f 6d 22 2c 28 28 29 3d 3e 4d 61 74 68 2e 63 oom",(()=>Math.c
000339a0: 65 69 6c 28 42 72 28 65 2e 67 65 74 43 61 6d 65 eil(Br(e.getCame
000339b0: 72 61 4f 70 74 69 6f 6e 73 28 29 2e 7a 6f 6f 6d raOptions().zoom
000339c0: 53 74 65 70 73 29 29 29 2c 5b 65 5d 29 2c 5b 72 Steps))),[e]),[r
000339d0: 2c 69 5d 3d 28 30 2c 6f 2e 75 73 65 53 74 61 74 ,i]=(0,o.useStat
000339e0: 65 29 28 21 31 29 2c 5b 61 2c 73 5d 3d 28 30 2c e)(!1),[a,s]=(0,
000339f0: 6f 2e 75 73 65 53 74 61 74 65 29 28 28 28 29 3d o.useState)((()=
00033a00: 3e 63 76 28 6e 29 29 29 3b 72 65 74 75 72 6e 28 >cv(n)));return(
00033a10: 30 2c 6f 2e 75 73 65 45 66 66 65 63 74 29 28 28 0,o.useEffect)((
00033a20: 28 29 3d 3e 7b 63 6f 6e 73 74 20 65 3d 50 72 6f ()=>{const e=Pro
00033a30: 6d 69 73 65 2e 61 6c 6c 28 6c 76 28 6e 29 2e 66 mise.all(lv(n).f
00033a40: 6c 61 74 4d 61 70 28 28 65 3d 3e 5b 72 76 28 74 latMap((e=>[rv(t
00033a50: 2c 65 2c 21 31 29 2e 74 68 65 6e 28 28 74 3d 3e ,e,!1).then((t=>
00033a60: 28 7b 7a 6f 6f 6d 3a 65 2c 74 68 65 6d 65 3a 22 ({zoom:e,theme:"
00033a70: 6c 69 67 68 74 22 2c 75 72 6c 3a 55 52 4c 2e 63 light",url:URL.c
00033a80: 72 65 61 74 65 4f 62 6a 65 63 74 55 52 4c 28 74 reateObjectURL(t
00033a90: 29 7d 29 29 29 2c 72 76 28 74 2c 65 2c 21 30 29 )}))),rv(t,e,!0)
00033aa0: 2e 74 68 65 6e 28 28 74 3d 3e 28 7b 7a 6f 6f 6d .then((t=>({zoom
00033ab0: 3a 65 2c 74 68 65 6d 65 3a 22 64 61 72 6b 22 2c :e,theme:"dark",
00033ac0: 75 72 6c 3a 55 52 4c 2e 63 72 65 61 74 65 4f 62 url:URL.createOb
00033ad0: 6a 65 63 74 55 52 4c 28 74 29 7d 29 29 29 5d 29 jectURL(t)})))])
00033ae0: 29 29 3b 6c 65 74 20 72 3d 21 31 3b 72 65 74 75 ));let r=!1;retu
00033af0: 72 6e 20 65 2e 74 68 65 6e 28 28 65 3d 3e 7b 72 rn e.then((e=>{r
00033b00: 7c 7c 28 73 28 65 29 2c 69 28 21 30 29 29 7d 29 ||(s(e),i(!0))})
00033b10: 29 2c 28 29 3d 3e 7b 72 3d 21 30 2c 69 28 21 31 ),()=>{r=!0,i(!1
00033b20: 29 2c 65 2e 74 68 65 6e 28 28 65 3d 3e 7b 66 6f ),e.then((e=>{fo
00033b30: 72 28 63 6f 6e 73 74 7b 75 72 6c 3a 74 7d 6f 66 r(const{url:t}of
00033b40: 20 65 29 55 52 4c 2e 72 65 76 6f 6b 65 4f 62 6a e)URL.revokeObj
00033b50: 65 63 74 55 52 4c 28 74 29 7d 29 29 7d 7d 29 2c ectURL(t)}))}}),
00033b60: 5b 74 2c 6e 5d 29 2c 7b 64 65 66 73 3a 28 30 2c [t,n]),{defs:(0,
00033b70: 51 63 2e 6a 73 78 29 28 51 63 2e 46 72 61 67 6d Qc.jsx)(Qc.Fragm
00033b80: 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 61 2e ent,{children:a.
00033b90: 6d 61 70 28 28 65 3d 3e 7b 63 6f 6e 73 74 20 74 map((e=>{const t
00033ba0: 3d 73 76 28 65 2e 7a 6f 6f 6d 2c 65 2e 74 68 65 =sv(e.zoom,e.the
00033bb0: 6d 65 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e me);return(0,Qc.
00033bc0: 6a 73 78 29 28 22 70 61 74 74 65 72 6e 22 2c 7b jsx)("pattern",{
00033bd0: 69 64 3a 74 2c 77 69 64 74 68 3a 6e 76 2c 68 65 id:t,width:nv,he
00033be0: 69 67 68 74 3a 6e 76 2c 70 61 74 74 65 72 6e 55 ight:nv,patternU
00033bf0: 6e 69 74 73 3a 22 75 73 65 72 53 70 61 63 65 4f nits:"userSpaceO
00033c00: 6e 55 73 65 22 2c 63 68 69 6c 64 72 65 6e 3a 28 nUse",children:(
00033c10: 30 2c 51 63 2e 6a 73 78 29 28 22 69 6d 61 67 65 0,Qc.jsx)("image
00033c20: 22 2c 7b 68 72 65 66 3a 65 2e 75 72 6c 2c 77 69 ",{href:e.url,wi
00033c30: 64 74 68 3a 6e 76 2c 68 65 69 67 68 74 3a 6e 76 dth:nv,height:nv
00033c40: 7d 29 7d 2c 74 29 7d 29 29 7d 29 2c 69 73 52 65 })},t)}))}),isRe
00033c50: 61 64 79 3a 72 7d 7d 28 29 3b 72 65 74 75 72 6e ady:r}}();return
00033c60: 28 30 2c 6f 2e 75 73 65 45 66 66 65 63 74 29 28 (0,o.useEffect)(
00033c70: 28 28 29 3d 3e 7b 69 66 28 72 26 26 65 2e 65 6e (()=>{if(r&&e.en
00033c80: 76 69 72 6f 6e 6d 65 6e 74 2e 69 73 53 61 66 61 vironment.isSafa
00033c90: 72 69 29 7b 63 6f 6e 73 74 20 6e 3d 64 76 28 74 ri){const n=dv(t
00033ca0: 2e 63 75 72 72 65 6e 74 29 3b 6e 26 26 65 2e 74 .current);n&&e.t
00033cb0: 69 6d 65 72 73 2e 72 65 71 75 65 73 74 41 6e 69 imers.requestAni
00033cc0: 6d 61 74 69 6f 6e 46 72 61 6d 65 28 28 28 29 3d mationFrame((()=
00033cd0: 3e 7b 6e 2e 73 74 79 6c 65 2e 64 69 73 70 6c 61 >{n.style.displa
00033ce0: 79 3d 22 6e 6f 6e 65 22 2c 65 2e 74 69 6d 65 72 y="none",e.timer
00033cf0: 73 2e 72 65 71 75 65 73 74 41 6e 69 6d 61 74 69 s.requestAnimati
00033d00: 6f 6e 46 72 61 6d 65 28 28 28 29 3d 3e 7b 6e 2e onFrame((()=>{n.
00033d10: 73 74 79 6c 65 2e 64 69 73 70 6c 61 79 3d 22 22 style.display=""
00033d20: 7d 29 29 7d 29 29 7d 7d 29 2c 5b 65 2c 72 5d 29 }))}))}}),[e,r])
00033d30: 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 22 2c ,(0,Qc.jsx)("g",
00033d40: 7b 72 65 66 3a 74 2c 22 64 61 74 61 2d 74 65 73 {ref:t,"data-tes
00033d50: 74 69 64 22 3a 72 3f 22 72 65 61 64 79 2d 70 61 tid":r?"ready-pa
00033d60: 74 74 65 72 6e 2d 66 69 6c 6c 2d 64 65 66 73 22 ttern-fill-defs"
00033d70: 3a 76 6f 69 64 20 30 2c 63 68 69 6c 64 72 65 6e :void 0,children
00033d80: 3a 6e 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 64 76 :n})}function dv
00033d90: 28 65 29 7b 72 65 74 75 72 6e 20 65 2e 63 6c 61 (e){return e.cla
00033da0: 73 73 4c 69 73 74 2e 63 6f 6e 74 61 69 6e 73 28 ssList.contains(
00033db0: 22 74 6c 2d 68 74 6d 6c 2d 6c 61 79 65 72 22 29 "tl-html-layer")
00033dc0: 3f 65 3a 65 2e 70 61 72 65 6e 74 45 6c 65 6d 65 ?e:e.parentEleme
00033dd0: 6e 74 3f 64 76 28 65 2e 70 61 72 65 6e 74 45 6c nt?dv(e.parentEl
00033de0: 65 6d 65 6e 74 29 3a 6e 75 6c 6c 7d 63 6f 6e 73 ement):null}cons
00033df0: 74 20 70 76 3d 6f 2e 6d 65 6d 6f 28 28 66 75 6e t pv=o.memo((fun
00033e00: 63 74 69 6f 6e 28 7b 74 68 65 6d 65 3a 65 2c 64 ction({theme:e,d
00033e10: 3a 74 2c 63 6f 6c 6f 72 3a 6e 2c 66 69 6c 6c 3a :t,color:n,fill:
00033e20: 72 2c 73 63 61 6c 65 3a 6f 7d 29 7b 73 77 69 74 r,scale:o}){swit
00033e30: 63 68 28 72 29 7b 63 61 73 65 22 6e 6f 6e 65 22 ch(r){case"none"
00033e40: 3a 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 63 61 73 :return null;cas
00033e50: 65 22 73 6f 6c 69 64 22 3a 72 65 74 75 72 6e 28 e"solid":return(
00033e60: 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 0,Qc.jsx)("path"
00033e70: 2c 7b 66 69 6c 6c 3a 65 5b 6e 5d 2e 73 65 6d 69 ,{fill:e[n].semi
00033e80: 2c 64 3a 74 7d 29 3b 63 61 73 65 22 73 65 6d 69 ,d:t});case"semi
00033e90: 22 3a 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 ":return(0,Qc.js
00033ea0: 78 29 28 22 70 61 74 68 22 2c 7b 66 69 6c 6c 3a x)("path",{fill:
00033eb0: 65 2e 73 6f 6c 69 64 2c 64 3a 74 7d 29 3b 63 61 e.solid,d:t});ca
00033ec0: 73 65 22 66 69 6c 6c 22 3a 72 65 74 75 72 6e 28 se"fill":return(
00033ed0: 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 0,Qc.jsx)("path"
00033ee0: 2c 7b 66 69 6c 6c 3a 65 5b 6e 5d 2e 66 69 6c 6c ,{fill:e[n].fill
00033ef0: 2c 64 3a 74 7d 29 3b 63 61 73 65 22 70 61 74 74 ,d:t});case"patt
00033f00: 65 72 6e 22 3a 72 65 74 75 72 6e 28 30 2c 51 63 ern":return(0,Qc
00033f10: 2e 6a 73 78 29 28 66 76 2c 7b 74 68 65 6d 65 3a .jsx)(fv,{theme:
00033f20: 65 2c 63 6f 6c 6f 72 3a 6e 2c 66 69 6c 6c 3a 72 e,color:n,fill:r
00033f30: 2c 64 3a 74 2c 73 63 61 6c 65 3a 6f 7d 29 7d 7d ,d:t,scale:o})}}
00033f40: 29 29 3b 66 75 6e 63 74 69 6f 6e 20 66 76 28 7b ));function fv({
00033f50: 64 3a 65 2c 63 6f 6c 6f 72 3a 74 2c 74 68 65 6d d:e,color:t,them
00033f60: 65 3a 6e 7d 29 7b 63 6f 6e 73 74 20 72 3d 72 75 e:n}){const r=ru
00033f70: 28 29 2c 6f 3d 57 68 28 29 2c 69 3d 64 61 28 22 (),o=Wh(),i=da("
00033f80: 7a 6f 6f 6d 4c 65 76 65 6c 22 2c 28 28 29 3d 3e zoomLevel",(()=>
00033f90: 72 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 29 r.getZoomLevel()
00033fa0: 29 2c 5b 72 5d 29 2c 61 3d 72 2e 67 65 74 5a 6f ),[r]),a=r.getZo
00033fb0: 6f 6d 4c 65 76 65 6c 28 29 3c 3d 2e 31 38 3b 72 omLevel()<=.18;r
00033fc0: 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 eturn(0,Qc.jsxs)
00033fd0: 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 (Qc.Fragment,{ch
00033fe0: 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 ildren:[(0,Qc.js
00033ff0: 78 29 28 22 70 61 74 68 22 2c 7b 66 69 6c 6c 3a x)("path",{fill:
00034000: 6e 5b 74 5d 2e 70 61 74 74 65 72 6e 2c 64 3a 65 n[t].pattern,d:e
00034010: 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 }),(0,Qc.jsx)("p
00034020: 61 74 68 22 2c 7b 66 69 6c 6c 3a 6f 3f 60 75 72 ath",{fill:o?`ur
00034030: 6c 28 23 24 7b 73 76 28 31 2c 6e 2e 69 64 29 7d l(#${sv(1,n.id)}
00034040: 29 60 3a 61 3f 6e 5b 74 5d 2e 73 65 6d 69 3a 60 )`:a?n[t].semi:`
00034050: 75 72 6c 28 23 24 7b 73 76 28 69 2c 6e 2e 69 64 url(#${sv(i,n.id
00034060: 29 7d 29 60 2c 64 3a 65 7d 29 5d 7d 29 7d 66 75 )})`,d:e})]})}fu
00034070: 6e 63 74 69 6f 6e 20 68 76 28 65 2c 74 2c 6e 29 nction hv(e,t,n)
00034080: 7b 63 6f 6e 73 74 7b 70 61 64 64 69 6e 67 3a 72 {const{padding:r
00034090: 3d 30 7d 3d 6e 3b 69 66 28 30 3d 3d 3d 74 2e 6c =0}=n;if(0===t.l
000340a0: 65 6e 67 74 68 29 72 65 74 75 72 6e 20 6e 75 6c ength)return nul
000340b0: 6c 3b 63 6f 6e 73 74 20 6f 3d 5f 70 2e 46 72 6f l;const o=_p.Fro
000340c0: 6d 28 74 5b 30 5d 2e 62 6f 78 29 3b 66 6f 72 28 m(t[0].box);for(
000340d0: 63 6f 6e 73 74 7b 62 6f 78 3a 65 7d 6f 66 20 74 const{box:e}of t
000340e0: 29 6f 2e 75 6e 69 6f 6e 28 65 29 3b 63 6f 6e 73 )o.union(e);cons
000340f0: 74 20 69 3d 72 2b 28 6e 2e 6f 66 66 73 65 74 58 t i=r+(n.offsetX
00034100: 3f 3f 30 29 2c 61 3d 28 6e 2e 6f 66 66 73 65 74 ??0),a=(n.offset
00034110: 59 3f 3f 30 29 2b 6e 2e 66 6f 6e 74 53 69 7a 65 Y??0)+n.fontSize
00034120: 2f 32 2b 28 22 73 74 61 72 74 22 3d 3d 3d 6e 2e /2+("start"===n.
00034130: 76 65 72 74 69 63 61 6c 54 65 78 74 41 6c 69 67 verticalTextAlig
00034140: 6e 3f 72 3a 22 65 6e 64 22 3d 3d 3d 6e 2e 76 65 n?r:"end"===n.ve
00034150: 72 74 69 63 61 6c 54 65 78 74 41 6c 69 67 6e 3f rticalTextAlign?
00034160: 6e 2e 68 65 69 67 68 74 2d 72 2d 6f 2e 68 65 69 n.height-r-o.hei
00034170: 67 68 74 3a 28 4d 61 74 68 2e 63 65 69 6c 28 6e ght:(Math.ceil(n
00034180: 2e 68 65 69 67 68 74 29 2d 6f 2e 68 65 69 67 68 .height)-o.heigh
00034190: 74 29 2f 32 29 3b 6c 65 74 20 73 3d 6e 75 6c 6c t)/2);let s=null
000341a0: 3b 63 6f 6e 73 74 20 6c 3d 5b 5d 3b 66 6f 72 28 ;const l=[];for(
000341b0: 63 6f 6e 73 74 7b 74 65 78 74 3a 65 2c 62 6f 78 const{text:e,box
000341c0: 3a 6e 7d 6f 66 20 74 29 7b 6e 75 6c 6c 21 3d 3d :n}of t){null!==
000341d0: 73 26 26 6e 2e 79 3e 73 26 26 6c 2e 70 75 73 68 s&&n.y>s&&l.push
000341e0: 28 28 30 2c 51 63 2e 6a 73 78 29 28 22 74 73 70 ((0,Qc.jsx)("tsp
000341f0: 61 6e 22 2c 7b 61 6c 69 67 6e 6d 65 6e 74 42 61 an",{alignmentBa
00034200: 73 65 6c 69 6e 65 3a 22 6d 61 74 68 65 6d 61 74 seline:"mathemat
00034210: 69 63 61 6c 22 2c 78 3a 69 2c 79 3a 6e 2e 79 2b ical",x:i,y:n.y+
00034220: 61 2c 63 68 69 6c 64 72 65 6e 3a 22 5c 6e 22 7d a,children:"\n"}
00034230: 2c 6c 2e 6c 65 6e 67 74 68 29 29 2c 6c 2e 70 75 ,l.length)),l.pu
00034240: 73 68 28 28 30 2c 51 63 2e 6a 73 78 29 28 22 74 sh((0,Qc.jsx)("t
00034250: 73 70 61 6e 22 2c 7b 61 6c 69 67 6e 6d 65 6e 74 span",{alignment
00034260: 42 61 73 65 6c 69 6e 65 3a 22 6d 61 74 68 65 6d Baseline:"mathem
00034270: 61 74 69 63 61 6c 22 2c 78 3a 6e 2e 78 2b 69 2c atical",x:n.x+i,
00034280: 79 3a 6e 2e 79 2b 61 2c 75 6e 69 63 6f 64 65 42 y:n.y+a,unicodeB
00034290: 69 64 69 3a 22 70 6c 61 69 6e 74 65 78 74 22 2c idi:"plaintext",
000342a0: 63 68 69 6c 64 72 65 6e 3a 28 63 3d 65 2c 63 2e children:(c=e,c.
000342b0: 72 65 70 6c 61 63 65 28 2f 5c 73 2f 67 2c 22 c2 replace(/\s/g,".
000342c0: a0 22 29 29 7d 2c 6c 2e 6c 65 6e 67 74 68 29 29 ."))},l.length))
000342d0: 2c 73 3d 6e 2e 79 7d 76 61 72 20 63 3b 72 65 74 ,s=n.y}var c;ret
000342e0: 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 74 urn(0,Qc.jsx)("t
000342f0: 65 78 74 22 2c 7b 66 6f 6e 74 53 69 7a 65 3a 6e ext",{fontSize:n
00034300: 2e 66 6f 6e 74 53 69 7a 65 2c 66 6f 6e 74 46 61 .fontSize,fontFa
00034310: 6d 69 6c 79 3a 6e 2e 66 6f 6e 74 46 61 6d 69 6c mily:n.fontFamil
00034320: 79 2c 66 6f 6e 74 53 74 79 6c 65 3a 6e 2e 66 6f y,fontStyle:n.fo
00034330: 6e 74 46 61 6d 69 6c 79 2c 66 6f 6e 74 57 65 69 ntFamily,fontWei
00034340: 67 68 74 3a 6e 2e 66 6f 6e 74 57 65 69 67 68 74 ght:n.fontWeight
00034350: 2c 64 6f 6d 69 6e 61 6e 74 42 61 73 65 6c 69 6e ,dominantBaselin
00034360: 65 3a 22 6d 61 74 68 65 6d 61 74 69 63 61 6c 22 e:"mathematical"
00034370: 2c 61 6c 69 67 6e 6d 65 6e 74 42 61 73 65 6c 69 ,alignmentBaseli
00034380: 6e 65 3a 22 6d 61 74 68 65 6d 61 74 69 63 61 6c ne:"mathematical
00034390: 22 2c 73 74 72 6f 6b 65 3a 6e 2e 73 74 72 6f 6b ",stroke:n.strok
000343a0: 65 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 6e 2e e,strokeWidth:n.
000343b0: 73 74 72 6f 6b 65 57 69 64 74 68 2c 66 69 6c 6c strokeWidth,fill
000343c0: 3a 6e 2e 66 69 6c 6c 2c 63 68 69 6c 64 72 65 6e :n.fill,children
000343d0: 3a 6c 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 6d 76 :l})}function mv
000343e0: 28 7b 66 6f 6e 74 53 69 7a 65 3a 65 2c 66 6f 6e ({fontSize:e,fon
000343f0: 74 3a 74 2c 61 6c 69 67 6e 3a 6e 2c 76 65 72 74 t:t,align:n,vert
00034400: 69 63 61 6c 41 6c 69 67 6e 3a 72 2c 74 65 78 74 icalAlign:r,text
00034410: 3a 6f 2c 6c 61 62 65 6c 43 6f 6c 6f 72 3a 69 2c :o,labelColor:i,
00034420: 62 6f 75 6e 64 73 3a 61 2c 70 61 64 64 69 6e 67 bounds:a,padding
00034430: 3a 73 3d 31 36 2c 73 74 72 6f 6b 65 3a 6c 3d 21 :s=16,stroke:l=!
00034440: 30 7d 29 7b 63 6f 6e 73 74 20 63 3d 72 75 28 29 0}){const c=ru()
00034450: 2c 75 3d 51 79 28 29 2c 64 3d 7b 66 6f 6e 74 53 ,u=Qy(),d={fontS
00034460: 69 7a 65 3a 65 2c 66 6f 6e 74 46 61 6d 69 6c 79 ize:e,fontFamily
00034470: 3a 48 73 5b 74 5d 2c 74 65 78 74 41 6c 69 67 6e :Hs[t],textAlign
00034480: 3a 6e 2c 76 65 72 74 69 63 61 6c 54 65 78 74 41 :n,verticalTextA
00034490: 6c 69 67 6e 3a 72 2c 77 69 64 74 68 3a 4d 61 74 lign:r,width:Mat
000344a0: 68 2e 63 65 69 6c 28 61 2e 77 69 64 74 68 29 2c h.ceil(a.width),
000344b0: 68 65 69 67 68 74 3a 4d 61 74 68 2e 63 65 69 6c height:Math.ceil
000344c0: 28 61 2e 68 65 69 67 68 74 29 2c 70 61 64 64 69 (a.height),paddi
000344d0: 6e 67 3a 73 2c 6c 69 6e 65 48 65 69 67 68 74 3a ng:s,lineHeight:
000344e0: 4e 62 2e 6c 69 6e 65 48 65 69 67 68 74 2c 66 6f Nb.lineHeight,fo
000344f0: 6e 74 53 74 79 6c 65 3a 22 6e 6f 72 6d 61 6c 22 ntStyle:"normal"
00034500: 2c 66 6f 6e 74 57 65 69 67 68 74 3a 22 6e 6f 72 ,fontWeight:"nor
00034510: 6d 61 6c 22 2c 6f 76 65 72 66 6c 6f 77 3a 22 77 mal",overflow:"w
00034520: 72 61 70 22 2c 6f 66 66 73 65 74 58 3a 30 2c 6f rap",offsetX:0,o
00034530: 66 66 73 65 74 59 3a 30 2c 66 69 6c 6c 3a 69 2c ffsetY:0,fill:i,
00034540: 73 74 72 6f 6b 65 3a 76 6f 69 64 20 30 2c 73 74 stroke:void 0,st
00034550: 72 6f 6b 65 57 69 64 74 68 3a 76 6f 69 64 20 30 rokeWidth:void 0
00034560: 7d 2c 70 3d 63 2e 74 65 78 74 4d 65 61 73 75 72 },p=c.textMeasur
00034570: 65 2e 6d 65 61 73 75 72 65 54 65 78 74 53 70 61 e.measureTextSpa
00034580: 6e 73 28 6f 2c 64 29 2c 66 3d 66 75 6e 63 74 69 ns(o,d),f=functi
00034590: 6f 6e 28 65 2c 74 2c 6e 2c 72 29 7b 69 66 28 28 on(e,t,n,r){if((
000345a0: 22 73 74 61 72 74 2d 6c 65 67 61 63 79 22 3d 3d "start-legacy"==
000345b0: 3d 65 7c 7c 22 65 6e 64 2d 6c 65 67 61 63 79 22 =e||"end-legacy"
000345c0: 3d 3d 3d 65 29 26 26 30 21 3d 3d 6e 2e 6c 65 6e ===e)&&0!==n.len
000345d0: 67 74 68 29 7b 63 6f 6e 73 74 20 6f 3d 5f 70 2e gth){const o=_p.
000345e0: 46 72 6f 6d 28 6e 5b 30 5d 2e 62 6f 78 29 3b 66 From(n[0].box);f
000345f0: 6f 72 28 63 6f 6e 73 74 7b 62 6f 78 3a 65 7d 6f or(const{box:e}o
00034600: 66 20 6e 29 6f 2e 75 6e 69 6f 6e 28 65 29 3b 69 f n)o.union(e);i
00034610: 66 28 22 73 74 61 72 74 2d 6c 65 67 61 63 79 22 f("start-legacy"
00034620: 3d 3d 3d 65 29 72 65 74 75 72 6e 28 72 2d 32 2a ===e)return(r-2*
00034630: 74 2d 6f 2e 77 69 64 74 68 29 2f 32 3b 69 66 28 t-o.width)/2;if(
00034640: 22 65 6e 64 2d 6c 65 67 61 63 79 22 3d 3d 3d 65 "end-legacy"===e
00034650: 29 72 65 74 75 72 6e 2d 28 72 2d 32 2a 74 2d 6f )return-(r-2*t-o
00034660: 2e 77 69 64 74 68 29 2f 32 7d 7d 28 6e 2c 73 2c .width)/2}}(n,s,
00034670: 70 2c 61 2e 77 69 64 74 68 29 3b 66 26 26 28 64 p,a.width);f&&(d
00034680: 2e 6f 66 66 73 65 74 58 3d 66 29 2c 64 2e 6f 66 .offsetX=f),d.of
00034690: 66 73 65 74 58 2b 3d 61 2e 78 2c 64 2e 6f 66 66 fsetX+=a.x,d.off
000346a0: 73 65 74 59 2b 3d 61 2e 79 3b 63 6f 6e 73 74 20 setY+=a.y;const
000346b0: 68 3d 68 76 28 30 2c 70 2c 64 29 3b 6c 65 74 20 h=hv(0,p,d);let
000346c0: 6d 3d 6e 75 6c 6c 3b 72 65 74 75 72 6e 20 6c 26 m=null;return l&
000346d0: 26 28 64 2e 66 69 6c 6c 3d 75 2e 62 61 63 6b 67 &(d.fill=u.backg
000346e0: 72 6f 75 6e 64 2c 64 2e 73 74 72 6f 6b 65 3d 75 round,d.stroke=u
000346f0: 2e 62 61 63 6b 67 72 6f 75 6e 64 2c 64 2e 73 74 .background,d.st
00034700: 72 6f 6b 65 57 69 64 74 68 3d 32 2c 6d 3d 68 76 rokeWidth=2,m=hv
00034710: 28 30 2c 70 2c 64 29 29 2c 28 30 2c 51 63 2e 6a (0,p,d)),(0,Qc.j
00034720: 73 78 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 sxs)(Qc.Fragment
00034730: 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b 6d 2c 68 5d ,{children:[m,h]
00034740: 7d 29 7d 63 6f 6e 73 74 20 67 76 3d 28 30 2c 6f })}const gv=(0,o
00034750: 2e 66 6f 72 77 61 72 64 52 65 66 29 28 28 66 75 .forwardRef)((fu
00034760: 6e 63 74 69 6f 6e 28 7b 69 73 45 64 69 74 69 6e nction({isEditin
00034770: 67 3a 65 2c 74 65 78 74 3a 74 2c 68 61 6e 64 6c g:e,text:t,handl
00034780: 65 46 6f 63 75 73 3a 6e 2c 68 61 6e 64 6c 65 43 eFocus:n,handleC
00034790: 68 61 6e 67 65 3a 72 2c 68 61 6e 64 6c 65 4b 65 hange:r,handleKe
000347a0: 79 44 6f 77 6e 3a 6f 2c 68 61 6e 64 6c 65 42 6c yDown:o,handleBl
000347b0: 75 72 3a 69 2c 68 61 6e 64 6c 65 49 6e 70 75 74 ur:i,handleInput
000347c0: 50 6f 69 6e 74 65 72 44 6f 77 6e 3a 61 2c 68 61 PointerDown:a,ha
000347d0: 6e 64 6c 65 44 6f 75 62 6c 65 43 6c 69 63 6b 3a ndleDoubleClick:
000347e0: 73 7d 2c 6c 29 7b 72 65 74 75 72 6e 28 30 2c 51 s},l){return(0,Q
000347f0: 63 2e 6a 73 78 29 28 22 74 65 78 74 61 72 65 61 c.jsx)("textarea
00034800: 22 2c 7b 72 65 66 3a 6c 2c 63 6c 61 73 73 4e 61 ",{ref:l,classNa
00034810: 6d 65 3a 22 74 6c 2d 74 65 78 74 20 74 6c 2d 74 me:"tl-text tl-t
00034820: 65 78 74 2d 69 6e 70 75 74 22 2c 6e 61 6d 65 3a ext-input",name:
00034830: 22 74 65 78 74 22 2c 74 61 62 49 6e 64 65 78 3a "text",tabIndex:
00034840: 2d 31 2c 72 65 61 64 4f 6e 6c 79 3a 21 65 2c 61 -1,readOnly:!e,a
00034850: 75 74 6f 43 6f 6d 70 6c 65 74 65 3a 22 6f 66 66 utoComplete:"off
00034860: 22 2c 61 75 74 6f 43 61 70 69 74 61 6c 69 7a 65 ",autoCapitalize
00034870: 3a 22 6f 66 66 22 2c 61 75 74 6f 43 6f 72 72 65 :"off",autoCorre
00034880: 63 74 3a 22 6f 66 66 22 2c 61 75 74 6f 53 61 76 ct:"off",autoSav
00034890: 65 3a 22 6f 66 66 22 2c 70 6c 61 63 65 68 6f 6c e:"off",placehol
000348a0: 64 65 72 3a 22 22 2c 73 70 65 6c 6c 43 68 65 63 der:"",spellChec
000348b0: 6b 3a 22 74 72 75 65 22 2c 77 72 61 70 3a 22 6f k:"true",wrap:"o
000348c0: 66 66 22 2c 64 69 72 3a 22 61 75 74 6f 22 2c 64 ff",dir:"auto",d
000348d0: 65 66 61 75 6c 74 56 61 6c 75 65 3a 74 2c 6f 6e efaultValue:t,on
000348e0: 46 6f 63 75 73 3a 6e 2c 6f 6e 43 68 61 6e 67 65 Focus:n,onChange
000348f0: 3a 72 2c 6f 6e 4b 65 79 44 6f 77 6e 3a 6f 2c 6f :r,onKeyDown:o,o
00034900: 6e 42 6c 75 72 3a 69 2c 6f 6e 54 6f 75 63 68 45 nBlur:i,onTouchE
00034910: 6e 64 3a 6e 64 2c 6f 6e 43 6f 6e 74 65 78 74 4d nd:nd,onContextM
00034920: 65 6e 75 3a 65 3f 6e 64 3a 76 6f 69 64 20 30 2c enu:e?nd:void 0,
00034930: 6f 6e 50 6f 69 6e 74 65 72 44 6f 77 6e 3a 61 2c onPointerDown:a,
00034940: 6f 6e 44 6f 75 62 6c 65 43 6c 69 63 6b 3a 73 2c onDoubleClick:s,
00034950: 6f 6e 44 72 61 67 53 74 61 72 74 3a 24 75 7d 29 onDragStart:$u})
00034960: 7d 29 29 3b 63 6f 6e 73 74 20 62 76 3d 6f 2e 6d }));const bv=o.m
00034970: 65 6d 6f 28 28 66 75 6e 63 74 69 6f 6e 28 7b 69 emo((function({i
00034980: 64 3a 65 2c 74 79 70 65 3a 74 2c 74 65 78 74 3a d:e,type:t,text:
00034990: 6e 2c 6c 61 62 65 6c 43 6f 6c 6f 72 3a 72 2c 66 n,labelColor:r,f
000349a0: 6f 6e 74 3a 69 2c 66 6f 6e 74 53 69 7a 65 3a 61 ont:i,fontSize:a
000349b0: 2c 6c 69 6e 65 48 65 69 67 68 74 3a 73 2c 61 6c ,lineHeight:s,al
000349c0: 69 67 6e 3a 6c 2c 76 65 72 74 69 63 61 6c 41 6c ign:l,verticalAl
000349d0: 69 67 6e 3a 63 2c 77 72 61 70 3a 75 2c 69 73 53 ign:c,wrap:u,isS
000349e0: 65 6c 65 63 74 65 64 3a 64 2c 70 61 64 64 69 6e elected:d,paddin
000349f0: 67 3a 70 3d 30 2c 6f 6e 4b 65 79 44 6f 77 6e 3a g:p=0,onKeyDown:
00034a00: 66 2c 63 6c 61 73 73 4e 61 6d 65 50 72 65 66 69 f,classNamePrefi
00034a10: 78 3a 68 2c 73 74 79 6c 65 3a 6d 2c 74 65 78 74 x:h,style:m,text
00034a20: 57 69 64 74 68 3a 67 2c 74 65 78 74 48 65 69 67 Width:g,textHeig
00034a30: 68 74 3a 62 7d 29 7b 63 6f 6e 73 74 7b 72 49 6e ht:b}){const{rIn
00034a40: 70 75 74 3a 79 2c 69 73 45 6d 70 74 79 3a 76 2c put:y,isEmpty:v,
00034a50: 69 73 45 64 69 74 69 6e 67 3a 53 2c 69 73 45 64 isEditing:S,isEd
00034a60: 69 74 69 6e 67 41 6e 79 74 68 69 6e 67 3a 5f 2c itingAnything:_,
00034a70: 2e 2e 2e 45 7d 3d 66 75 6e 63 74 69 6f 6e 28 65 ...E}=function(e
00034a80: 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 72 75 ,t,n){const r=ru
00034a90: 28 29 2c 69 3d 28 30 2c 6f 2e 75 73 65 52 65 66 (),i=(0,o.useRef
00034aa0: 29 28 6e 75 6c 6c 29 2c 61 3d 64 61 28 22 69 73 )(null),a=da("is
00034ab0: 45 64 69 74 69 6e 67 22 2c 28 28 29 3d 3e 72 2e Editing",(()=>r.
00034ac0: 67 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 49 getEditingShapeI
00034ad0: 64 28 29 3d 3d 3d 65 29 2c 5b 72 5d 29 2c 73 3d d()===e),[r]),s=
00034ae0: 64 61 28 22 69 73 45 64 69 74 69 6e 67 41 6e 79 da("isEditingAny
00034af0: 74 68 69 6e 67 22 2c 28 28 29 3d 3e 21 21 72 2e thing",(()=>!!r.
00034b00: 67 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 49 getEditingShapeI
00034b10: 64 28 29 29 2c 5b 72 5d 29 3b 28 30 2c 6f 2e 75 d()),[r]);(0,o.u
00034b20: 73 65 45 66 66 65 63 74 29 28 28 28 29 3d 3e 7b seEffect)((()=>{
00034b30: 66 75 6e 63 74 69 6f 6e 20 74 28 7b 73 68 61 70 function t({shap
00034b40: 65 49 64 3a 74 7d 29 7b 74 3d 3d 3d 65 26 26 69 eId:t}){t===e&&i
00034b50: 2e 63 75 72 72 65 6e 74 3f 2e 73 65 6c 65 63 74 .current?.select
00034b60: 28 29 7d 72 65 74 75 72 6e 20 72 2e 6f 6e 28 22 ()}return r.on("
00034b70: 73 65 6c 65 63 74 2d 61 6c 6c 2d 74 65 78 74 22 select-all-text"
00034b80: 2c 74 29 2c 28 29 3d 3e 7b 72 2e 6f 66 66 28 22 ,t),()=>{r.off("
00034b90: 73 65 6c 65 63 74 2d 61 6c 6c 2d 74 65 78 74 22 select-all-text"
00034ba0: 2c 74 29 7d 7d 29 2c 5b 72 2c 65 2c 61 5d 29 2c ,t)}}),[r,e,a]),
00034bb0: 28 30 2c 6f 2e 75 73 65 45 66 66 65 63 74 29 28 (0,o.useEffect)(
00034bc0: 28 28 29 3d 3e 7b 61 26 26 28 64 6f 63 75 6d 65 (()=>{a&&(docume
00034bd0: 6e 74 2e 61 63 74 69 76 65 45 6c 65 6d 65 6e 74 nt.activeElement
00034be0: 21 3d 3d 69 2e 63 75 72 72 65 6e 74 26 26 69 2e !==i.current&&i.
00034bf0: 63 75 72 72 65 6e 74 3f 2e 66 6f 63 75 73 28 29 current?.focus()
00034c00: 2c 72 2e 67 65 74 49 6e 73 74 61 6e 63 65 53 74 ,r.getInstanceSt
00034c10: 61 74 65 28 29 2e 69 73 43 6f 61 72 73 65 50 6f ate().isCoarsePo
00034c20: 69 6e 74 65 72 26 26 69 2e 63 75 72 72 65 6e 74 inter&&i.current
00034c30: 3f 2e 73 65 6c 65 63 74 28 29 2c 72 2e 65 6e 76 ?.select(),r.env
00034c40: 69 72 6f 6e 6d 65 6e 74 2e 69 73 53 61 66 61 72 ironment.isSafar
00034c50: 69 26 26 28 69 2e 63 75 72 72 65 6e 74 3f 2e 62 i&&(i.current?.b
00034c60: 6c 75 72 28 29 2c 69 2e 63 75 72 72 65 6e 74 3f lur(),i.current?
00034c70: 2e 66 6f 63 75 73 28 29 29 29 7d 29 2c 5b 72 2c .focus()))}),[r,
00034c80: 61 5d 29 3b 63 6f 6e 73 74 20 6c 3d 28 30 2c 6f a]);const l=(0,o
00034c90: 2e 75 73 65 43 61 6c 6c 62 61 63 6b 29 28 28 74 .useCallback)((t
00034ca0: 3d 3e 7b 72 2e 67 65 74 45 64 69 74 69 6e 67 53 =>{r.getEditingS
00034cb0: 68 61 70 65 49 64 28 29 3d 3d 3d 65 26 26 22 45 hapeId()===e&&"E
00034cc0: 6e 74 65 72 22 3d 3d 3d 74 2e 6b 65 79 26 26 28 nter"===t.key&&(
00034cd0: 74 2e 63 74 72 6c 4b 65 79 7c 7c 74 2e 6d 65 74 t.ctrlKey||t.met
00034ce0: 61 4b 65 79 29 26 26 72 2e 63 6f 6d 70 6c 65 74 aKey)&&r.complet
00034cf0: 65 28 29 7d 29 2c 5b 72 2c 65 5d 29 2c 63 3d 28 e()}),[r,e]),c=(
00034d00: 30 2c 6f 2e 75 73 65 43 61 6c 6c 62 61 63 6b 29 0,o.useCallback)
00034d10: 28 28 6e 3d 3e 7b 69 66 28 72 2e 67 65 74 45 64 ((n=>{if(r.getEd
00034d20: 69 74 69 6e 67 53 68 61 70 65 49 64 28 29 21 3d itingShapeId()!=
00034d30: 3d 65 29 72 65 74 75 72 6e 3b 6c 65 74 20 6f 3d =e)return;let o=
00034d40: 70 79 2e 6e 6f 72 6d 61 6c 69 7a 65 54 65 78 74 py.normalizeText
00034d50: 28 6e 2e 63 75 72 72 65 6e 74 54 61 72 67 65 74 (n.currentTarget
00034d60: 2e 76 61 6c 75 65 29 3b 63 6f 6e 73 74 20 69 3d .value);const i=
00034d70: 6f 2e 72 65 70 6c 61 63 65 28 2f 5c 74 2f 67 2c o.replace(/\t/g,
00034d80: 64 79 29 3b 69 66 28 69 21 3d 3d 6f 29 7b 63 6f dy);if(i!==o){co
00034d90: 6e 73 74 20 65 3d 6e 2e 63 75 72 72 65 6e 74 54 nst e=n.currentT
00034da0: 61 72 67 65 74 2e 73 65 6c 65 63 74 69 6f 6e 53 arget.selectionS
00034db0: 74 61 72 74 3b 6e 2e 63 75 72 72 65 6e 74 54 61 tart;n.currentTa
00034dc0: 72 67 65 74 2e 76 61 6c 75 65 3d 69 2c 6e 2e 63 rget.value=i,n.c
00034dd0: 75 72 72 65 6e 74 54 61 72 67 65 74 2e 73 65 6c urrentTarget.sel
00034de0: 65 63 74 69 6f 6e 53 74 61 72 74 3d 65 2b 28 69 ectionStart=e+(i
00034df0: 2e 6c 65 6e 67 74 68 2d 6f 2e 6c 65 6e 67 74 68 .length-o.length
00034e00: 29 2c 6e 2e 63 75 72 72 65 6e 74 54 61 72 67 65 ),n.currentTarge
00034e10: 74 2e 73 65 6c 65 63 74 69 6f 6e 45 6e 64 3d 65 t.selectionEnd=e
00034e20: 2b 28 69 2e 6c 65 6e 67 74 68 2d 6f 2e 6c 65 6e +(i.length-o.len
00034e30: 67 74 68 29 2c 6f 3d 69 7d 72 2e 75 70 64 61 74 gth),o=i}r.updat
00034e40: 65 53 68 61 70 65 28 7b 69 64 3a 65 2c 74 79 70 eShape({id:e,typ
00034e50: 65 3a 74 2c 70 72 6f 70 73 3a 7b 74 65 78 74 3a e:t,props:{text:
00034e60: 6f 7d 7d 29 7d 29 2c 5b 72 2c 65 2c 74 5d 29 2c o}})}),[r,e,t]),
00034e70: 75 3d 28 30 2c 6f 2e 75 73 65 43 61 6c 6c 62 61 u=(0,o.useCallba
00034e80: 63 6b 29 28 28 74 3d 3e 7b 72 2e 64 69 73 70 61 ck)((t=>{r.dispa
00034e90: 74 63 68 28 7b 2e 2e 2e 6f 64 28 74 29 2c 74 79 tch({...od(t),ty
00034ea0: 70 65 3a 22 70 6f 69 6e 74 65 72 22 2c 6e 61 6d pe:"pointer",nam
00034eb0: 65 3a 22 70 6f 69 6e 74 65 72 5f 64 6f 77 6e 22 e:"pointer_down"
00034ec0: 2c 74 61 72 67 65 74 3a 22 73 68 61 70 65 22 2c ,target:"shape",
00034ed0: 73 68 61 70 65 3a 72 2e 67 65 74 53 68 61 70 65 shape:r.getShape
00034ee0: 28 65 29 7d 29 2c 6e 64 28 74 29 7d 29 2c 5b 72 (e)}),nd(t)}),[r
00034ef0: 2c 65 5d 29 3b 72 65 74 75 72 6e 7b 72 49 6e 70 ,e]);return{rInp
00034f00: 75 74 3a 69 2c 68 61 6e 64 6c 65 46 6f 63 75 73 ut:i,handleFocus
00034f10: 3a 48 72 2c 68 61 6e 64 6c 65 42 6c 75 72 3a 48 :Hr,handleBlur:H
00034f20: 72 2c 68 61 6e 64 6c 65 4b 65 79 44 6f 77 6e 3a r,handleKeyDown:
00034f30: 6c 2c 68 61 6e 64 6c 65 43 68 61 6e 67 65 3a 63 l,handleChange:c
00034f40: 2c 68 61 6e 64 6c 65 49 6e 70 75 74 50 6f 69 6e ,handleInputPoin
00034f50: 74 65 72 44 6f 77 6e 3a 75 2c 68 61 6e 64 6c 65 terDown:u,handle
00034f60: 44 6f 75 62 6c 65 43 6c 69 63 6b 3a 6e 64 2c 69 DoubleClick:nd,i
00034f70: 73 45 6d 70 74 79 3a 30 3d 3d 3d 6e 2e 74 72 69 sEmpty:0===n.tri
00034f80: 6d 28 29 2e 6c 65 6e 67 74 68 2c 69 73 45 64 69 m().length,isEdi
00034f90: 74 69 6e 67 3a 61 2c 69 73 45 64 69 74 69 6e 67 ting:a,isEditing
00034fa0: 41 6e 79 74 68 69 6e 67 3a 73 7d 7d 28 65 2c 74 Anything:s}}(e,t
00034fb0: 2c 6e 29 2c 5b 77 2c 78 5d 3d 28 30 2c 6f 2e 75 ,n),[w,x]=(0,o.u
00034fc0: 73 65 53 74 61 74 65 29 28 6e 29 3b 28 30 2c 6f seState)(n);(0,o
00034fd0: 2e 75 73 65 45 66 66 65 63 74 29 28 28 28 29 3d .useEffect)((()=
00034fe0: 3e 7b 53 7c 7c 78 28 6e 29 7d 29 2c 5b 53 2c 6e >{S||x(n)}),[S,n
00034ff0: 5d 29 3b 63 6f 6e 73 74 20 54 3d 70 79 2e 6e 6f ]);const T=py.no
00035000: 72 6d 61 6c 69 7a 65 54 65 78 74 46 6f 72 44 6f rmalizeTextForDo
00035010: 6d 28 6e 29 2c 43 3d 54 2e 6c 65 6e 67 74 68 3e m(n),C=T.length>
00035020: 30 2c 6b 3d 66 75 6e 63 74 69 6f 6e 28 65 29 7b 0,k=function(e){
00035030: 72 65 74 75 72 6e 22 73 74 61 72 74 2d 6c 65 67 return"start-leg
00035040: 61 63 79 22 3d 3d 3d 65 7c 7c 22 6d 69 64 64 6c acy"===e||"middl
00035050: 65 2d 6c 65 67 61 63 79 22 3d 3d 3d 65 7c 7c 22 e-legacy"===e||"
00035060: 65 6e 64 2d 6c 65 67 61 63 79 22 3d 3d 3d 65 7d end-legacy"===e}
00035070: 28 6c 29 3b 69 66 28 21 53 26 26 21 43 29 72 65 (l);if(!S&&!C)re
00035080: 74 75 72 6e 20 6e 75 6c 6c 3b 63 6f 6e 73 74 20 turn null;const
00035090: 41 3d 68 7c 7c 22 74 6c 2d 74 65 78 74 22 3b 72 A=h||"tl-text";r
000350a0: 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 eturn(0,Qc.jsx)(
000350b0: 22 64 69 76 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 "div",{className
000350c0: 3a 60 24 7b 41 7d 2d 6c 61 62 65 6c 20 74 6c 2d :`${A}-label tl-
000350d0: 74 65 78 74 2d 77 72 61 70 70 65 72 60 2c 22 64 text-wrapper`,"d
000350e0: 61 74 61 2d 66 6f 6e 74 22 3a 69 2c 22 64 61 74 ata-font":i,"dat
000350f0: 61 2d 61 6c 69 67 6e 22 3a 6c 2c 22 64 61 74 61 a-align":l,"data
00035100: 2d 68 61 73 74 65 78 74 22 3a 21 76 2c 22 64 61 -hastext":!v,"da
00035110: 74 61 2d 69 73 65 64 69 74 69 6e 67 22 3a 53 2c ta-isediting":S,
00035120: 22 64 61 74 61 2d 69 73 65 64 69 74 69 6e 67 61 "data-iseditinga
00035130: 6e 79 74 68 69 6e 67 22 3a 5f 2c 22 64 61 74 61 nything":_,"data
00035140: 2d 74 65 78 74 77 72 61 70 22 3a 21 21 75 2c 22 -textwrap":!!u,"
00035150: 64 61 74 61 2d 69 73 73 65 6c 65 63 74 65 64 22 data-isselected"
00035160: 3a 64 2c 73 74 79 6c 65 3a 7b 6a 75 73 74 69 66 :d,style:{justif
00035170: 79 43 6f 6e 74 65 6e 74 3a 22 6d 69 64 64 6c 65 yContent:"middle
00035180: 22 3d 3d 3d 6c 7c 7c 6b 3f 22 63 65 6e 74 65 72 "===l||k?"center
00035190: 22 3a 6c 2c 61 6c 69 67 6e 49 74 65 6d 73 3a 22 ":l,alignItems:"
000351a0: 6d 69 64 64 6c 65 22 3d 3d 3d 63 3f 22 63 65 6e middle"===c?"cen
000351b0: 74 65 72 22 3a 63 2c 70 61 64 64 69 6e 67 3a 70 ter":c,padding:p
000351c0: 2c 2e 2e 2e 6d 7d 2c 63 68 69 6c 64 72 65 6e 3a ,...m},children:
000351d0: 28 30 2c 51 63 2e 6a 73 78 73 29 28 22 64 69 76 (0,Qc.jsxs)("div
000351e0: 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 60 24 7b ",{className:`${
000351f0: 41 7d 2d 6c 61 62 65 6c 5f 5f 69 6e 6e 65 72 20 A}-label__inner
00035200: 74 6c 2d 74 65 78 74 2d 63 6f 6e 74 65 6e 74 5f tl-text-content_
00035210: 5f 77 72 61 70 70 65 72 60 2c 73 74 79 6c 65 3a _wrapper`,style:
00035220: 7b 66 6f 6e 74 53 69 7a 65 3a 61 2c 6c 69 6e 65 {fontSize:a,line
00035230: 48 65 69 67 68 74 3a 4d 61 74 68 2e 66 6c 6f 6f Height:Math.floo
00035240: 72 28 61 2a 73 29 2b 22 70 78 22 2c 6d 69 6e 48 r(a*s)+"px",minH
00035250: 65 69 67 68 74 3a 4d 61 74 68 2e 66 6c 6f 6f 72 eight:Math.floor
00035260: 28 61 2a 73 29 2b 22 70 78 22 2c 6d 69 6e 57 69 (a*s)+"px",minWi
00035270: 64 74 68 3a 4d 61 74 68 2e 63 65 69 6c 28 67 7c dth:Math.ceil(g|
00035280: 7c 30 29 2c 63 6f 6c 6f 72 3a 72 2c 77 69 64 74 |0),color:r,widt
00035290: 68 3a 67 3f 4d 61 74 68 2e 63 65 69 6c 28 67 29 h:g?Math.ceil(g)
000352a0: 3a 76 6f 69 64 20 30 2c 68 65 69 67 68 74 3a 62 :void 0,height:b
000352b0: 3f 4d 61 74 68 2e 63 65 69 6c 28 62 29 3a 76 6f ?Math.ceil(b):vo
000352c0: 69 64 20 30 7d 2c 63 68 69 6c 64 72 65 6e 3a 5b id 0},children:[
000352d0: 28 30 2c 51 63 2e 6a 73 78 29 28 22 64 69 76 22 (0,Qc.jsx)("div"
000352e0: 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 60 24 7b 41 ,{className:`${A
000352f0: 7d 20 74 6c 2d 74 65 78 74 20 74 6c 2d 74 65 78 } tl-text tl-tex
00035300: 74 2d 63 6f 6e 74 65 6e 74 60 2c 64 69 72 3a 22 t-content`,dir:"
00035310: 61 75 74 6f 22 2c 63 68 69 6c 64 72 65 6e 3a 54 auto",children:T
00035320: 2e 73 70 6c 69 74 28 22 5c 6e 22 29 2e 6d 61 70 .split("\n").map
00035330: 28 28 28 65 2c 74 29 3d 3e 28 30 2c 51 63 2e 6a (((e,t)=>(0,Qc.j
00035340: 73 78 29 28 22 64 69 76 22 2c 7b 64 69 72 3a 22 sx)("div",{dir:"
00035350: 61 75 74 6f 22 2c 63 68 69 6c 64 72 65 6e 3a 65 auto",children:e
00035360: 7d 2c 74 29 29 29 7d 29 2c 28 5f 7c 7c 64 29 26 },t)))}),(_||d)&
00035370: 26 28 30 2c 51 63 2e 6a 73 78 29 28 67 76 2c 7b &(0,Qc.jsx)(gv,{
00035380: 72 65 66 3a 79 2c 74 65 78 74 3a 6e 2c 69 73 45 ref:y,text:n,isE
00035390: 64 69 74 69 6e 67 3a 53 2c 2e 2e 2e 45 2c 68 61 diting:S,...E,ha
000353a0: 6e 64 6c 65 4b 65 79 44 6f 77 6e 3a 66 3f 3f 45 ndleKeyDown:f??E
000353b0: 2e 68 61 6e 64 6c 65 4b 65 79 44 6f 77 6e 7d 2c .handleKeyDown},
000353c0: 77 29 5d 7d 29 7d 29 7d 29 29 3b 66 75 6e 63 74 w)]})})}));funct
000353d0: 69 6f 6e 20 79 76 28 65 2c 74 2c 6e 3d 7b 7d 29 ion yv(e,t,n={})
000353e0: 7b 63 6f 6e 73 74 7b 63 6c 6f 73 65 64 3a 72 3d {const{closed:r=
000353f0: 21 31 2c 73 6e 61 70 3a 6f 3d 31 2c 73 74 61 72 !1,snap:o=1,star
00035400: 74 3a 69 3d 22 6f 75 74 73 65 74 22 2c 65 6e 64 t:i="outset",end
00035410: 3a 61 3d 22 6f 75 74 73 65 74 22 2c 6c 65 6e 67 :a="outset",leng
00035420: 74 68 52 61 74 69 6f 3a 73 3d 32 2c 73 74 79 6c thRatio:s=2,styl
00035430: 65 3a 6c 3d 22 64 61 73 68 65 64 22 7d 3d 6e 3b e:l="dashed"}=n;
00035440: 6c 65 74 20 63 3d 30 2c 75 3d 30 2c 64 3d 31 2c let c=0,u=0,d=1,
00035450: 70 3d 30 2c 66 3d 30 3b 73 77 69 74 63 68 28 6c p=0,f=0;switch(l
00035460: 29 7b 63 61 73 65 22 64 61 73 68 65 64 22 3a 64 ){case"dashed":d
00035470: 3d 31 2c 63 3d 4d 61 74 68 2e 6d 69 6e 28 74 2a =1,c=Math.min(t*
00035480: 73 2c 65 2f 34 29 3b 62 72 65 61 6b 3b 63 61 73 s,e/4);break;cas
00035490: 65 22 64 6f 74 74 65 64 22 3a 64 3d 31 30 30 2c e"dotted":d=100,
000354a0: 63 3d 74 2f 64 3b 62 72 65 61 6b 3b 64 65 66 61 c=t/d;break;defa
000354b0: 75 6c 74 3a 72 65 74 75 72 6e 7b 73 74 72 6f 6b ult:return{strok
000354c0: 65 44 61 73 68 61 72 72 61 79 3a 22 6e 6f 6e 65 eDasharray:"none
000354d0: 22 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 ",strokeDashoffs
000354e0: 65 74 3a 22 6e 6f 6e 65 22 7d 7d 72 65 74 75 72 et:"none"}}retur
000354f0: 6e 20 72 7c 7c 28 22 6f 75 74 73 65 74 22 3d 3d n r||("outset"==
00035500: 3d 69 3f 28 65 2b 3d 63 2f 32 2c 66 2b 3d 63 2f =i?(e+=c/2,f+=c/
00035510: 32 29 3a 22 73 6b 69 70 22 3d 3d 3d 69 26 26 28 2):"skip"===i&&(
00035520: 65 2d 3d 63 2c 66 2d 3d 63 29 2c 22 6f 75 74 73 e-=c,f-=c),"outs
00035530: 65 74 22 3d 3d 3d 61 3f 65 2b 3d 63 2f 32 3a 22 et"===a?e+=c/2:"
00035540: 73 6b 69 70 22 3d 3d 3d 61 26 26 28 65 2d 3d 63 skip"===a&&(e-=c
00035550: 29 29 2c 75 3d 4d 61 74 68 2e 66 6c 6f 6f 72 28 )),u=Math.floor(
00035560: 65 2f 63 2f 28 32 2a 64 29 29 2c 75 2d 3d 75 25 e/c/(2*d)),u-=u%
00035570: 6f 2c 75 3c 33 26 26 22 64 61 73 68 65 64 22 3d o,u<3&&"dashed"=
00035580: 3d 3d 6c 3f 65 2f 74 3c 34 3f 28 63 3d 65 2c 75 ==l?e/t<4?(c=e,u
00035590: 3d 31 2c 70 3d 30 29 3a 28 63 3d 65 2a 28 31 2f =1,p=0):(c=e*(1/
000355a0: 33 29 2c 70 3d 65 2a 28 31 2f 33 29 29 3a 28 63 3),p=e*(1/3)):(c
000355b0: 3d 65 2f 75 2f 28 32 2a 64 29 2c 72 3f 28 66 3d =e/u/(2*d),r?(f=
000355c0: 63 2f 32 2c 70 3d 28 65 2d 75 2a 63 29 2f 75 29 c/2,p=(e-u*c)/u)
000355d0: 3a 70 3d 28 65 2d 75 2a 63 29 2f 4d 61 74 68 2e :p=(e-u*c)/Math.
000355e0: 6d 61 78 28 31 2c 75 2d 31 29 29 2c 7b 73 74 72 max(1,u-1)),{str
000355f0: 6f 6b 65 44 61 73 68 61 72 72 61 79 3a 5b 63 2c okeDasharray:[c,
00035600: 70 5d 2e 6a 6f 69 6e 28 22 20 22 29 2c 73 74 72 p].join(" "),str
00035610: 6f 6b 65 44 61 73 68 6f 66 66 73 65 74 3a 66 2e okeDashoffset:f.
00035620: 74 6f 53 74 72 69 6e 67 28 29 7d 7d 63 6f 6e 73 toString()}}cons
00035630: 74 20 76 76 3d 6e 65 77 20 57 65 61 6b 4d 61 70 t vv=new WeakMap
00035640: 3b 66 75 6e 63 74 69 6f 6e 20 53 76 28 65 2c 74 ;function Sv(e,t
00035650: 29 7b 63 6f 6e 73 74 20 6e 3d 76 76 2e 67 65 74 ){const n=vv.get
00035660: 28 74 29 3b 69 66 28 6e 29 72 65 74 75 72 6e 20 (t);if(n)return
00035670: 6e 3b 63 6f 6e 73 74 20 72 3d 76 62 28 65 2c 74 n;const r=vb(e,t
00035680: 29 3b 6c 65 74 20 6f 3d 30 2c 69 3d 30 3b 63 6f );let o=0,i=0;co
00035690: 6e 73 74 20 61 3d 72 2e 69 73 53 74 72 61 69 67 nst a=r.isStraig
000356a0: 68 74 3f 6e 65 77 20 6b 68 28 7b 73 74 61 72 74 ht?new kh({start
000356b0: 3a 73 75 2e 46 72 6f 6d 28 72 2e 73 74 61 72 74 :su.From(r.start
000356c0: 2e 70 6f 69 6e 74 29 2c 65 6e 64 3a 73 75 2e 46 .point),end:su.F
000356d0: 72 6f 6d 28 72 2e 65 6e 64 2e 70 6f 69 6e 74 29 rom(r.end.point)
000356e0: 7d 29 3a 6e 65 77 20 4c 67 28 7b 63 65 6e 74 65 }):new Lg({cente
000356f0: 72 3a 73 75 2e 43 61 73 74 28 72 2e 68 61 6e 64 r:su.Cast(r.hand
00035700: 6c 65 41 72 63 2e 63 65 6e 74 65 72 29 2c 73 74 leArc.center),st
00035710: 61 72 74 3a 73 75 2e 43 61 73 74 28 72 2e 73 74 art:su.Cast(r.st
00035720: 61 72 74 2e 70 6f 69 6e 74 29 2c 65 6e 64 3a 73 art.point),end:s
00035730: 75 2e 43 61 73 74 28 72 2e 65 6e 64 2e 70 6f 69 u.Cast(r.end.poi
00035740: 6e 74 29 2c 73 77 65 65 70 46 6c 61 67 3a 72 2e nt),sweepFlag:r.
00035750: 62 6f 64 79 41 72 63 2e 73 77 65 65 70 46 6c 61 bodyArc.sweepFla
00035760: 67 2c 6c 61 72 67 65 41 72 63 46 6c 61 67 3a 72 g,largeArcFlag:r
00035770: 2e 62 6f 64 79 41 72 63 2e 6c 61 72 67 65 41 72 .bodyArc.largeAr
00035780: 63 46 6c 61 67 7d 29 3b 69 66 28 74 2e 70 72 6f cFlag});if(t.pro
00035790: 70 73 2e 74 65 78 74 2e 74 72 69 6d 28 29 29 7b ps.text.trim()){
000357a0: 63 6f 6e 73 74 20 6e 3d 61 2e 62 6f 75 6e 64 73 const n=a.bounds
000357b0: 2c 72 3d 54 76 28 74 29 2c 7b 77 3a 73 2c 68 3a ,r=Tv(t),{w:s,h:
000357c0: 6c 7d 3d 65 2e 74 65 78 74 4d 65 61 73 75 72 65 l}=e.textMeasure
000357d0: 2e 6d 65 61 73 75 72 65 54 65 78 74 28 74 2e 70 .measureText(t.p
000357e0: 72 6f 70 73 2e 74 65 78 74 2c 7b 2e 2e 2e 4e 62 rops.text,{...Nb
000357f0: 2c 66 6f 6e 74 46 61 6d 69 6c 79 3a 46 62 5b 74 ,fontFamily:Fb[t
00035800: 2e 70 72 6f 70 73 2e 66 6f 6e 74 5d 2c 66 6f 6e .props.font],fon
00035810: 74 53 69 7a 65 3a 72 2c 6d 61 78 57 69 64 74 68 tSize:r,maxWidth
00035820: 3a 6e 75 6c 6c 7d 29 3b 69 66 28 6f 3d 73 2c 69 :null});if(o=s,i
00035830: 3d 6c 2c 6e 2e 77 69 64 74 68 3e 6e 2e 68 65 69 =l,n.width>n.hei
00035840: 67 68 74 29 7b 6f 3d 4d 61 74 68 2e 6d 61 78 28 ght){o=Math.max(
00035850: 4d 61 74 68 2e 6d 69 6e 28 73 2c 36 34 29 2c 4d Math.min(s,64),M
00035860: 61 74 68 2e 6d 69 6e 28 6e 2e 77 69 64 74 68 2d ath.min(n.width-
00035870: 36 34 2c 73 29 29 3b 63 6f 6e 73 74 7b 77 3a 61 64,s));const{w:a
00035880: 2c 68 3a 6c 7d 3d 65 2e 74 65 78 74 4d 65 61 73 ,h:l}=e.textMeas
00035890: 75 72 65 2e 6d 65 61 73 75 72 65 54 65 78 74 28 ure.measureText(
000358a0: 74 2e 70 72 6f 70 73 2e 74 65 78 74 2c 7b 2e 2e t.props.text,{..
000358b0: 2e 4e 62 2c 66 6f 6e 74 46 61 6d 69 6c 79 3a 46 .Nb,fontFamily:F
000358c0: 62 5b 74 2e 70 72 6f 70 73 2e 66 6f 6e 74 5d 2c b[t.props.font],
000358d0: 66 6f 6e 74 53 69 7a 65 3a 72 2c 6d 61 78 57 69 fontSize:r,maxWi
000358e0: 64 74 68 3a 6f 7d 29 3b 6f 3d 61 2c 69 3d 6c 7d dth:o});o=a,i=l}
000358f0: 69 66 28 6f 3e 31 36 2a 72 29 7b 6f 3d 31 36 2a if(o>16*r){o=16*
00035900: 72 3b 63 6f 6e 73 74 7b 77 3a 6e 2c 68 3a 61 7d r;const{w:n,h:a}
00035910: 3d 65 2e 74 65 78 74 4d 65 61 73 75 72 65 2e 6d =e.textMeasure.m
00035920: 65 61 73 75 72 65 54 65 78 74 28 74 2e 70 72 6f easureText(t.pro
00035930: 70 73 2e 74 65 78 74 2c 7b 2e 2e 2e 4e 62 2c 66 ps.text,{...Nb,f
00035940: 6f 6e 74 46 61 6d 69 6c 79 3a 46 62 5b 74 2e 70 ontFamily:Fb[t.p
00035950: 72 6f 70 73 2e 66 6f 6e 74 5d 2c 66 6f 6e 74 53 rops.font],fontS
00035960: 69 7a 65 3a 72 2c 6d 61 78 57 69 64 74 68 3a 6f ize:r,maxWidth:o
00035970: 7d 29 3b 6f 3d 6e 2c 69 3d 61 7d 7d 63 6f 6e 73 });o=n,i=a}}cons
00035980: 74 20 73 3d 6e 65 77 20 73 75 28 6f 2c 69 29 2e t s=new su(o,i).
00035990: 61 64 64 53 63 61 6c 61 72 28 32 2a 42 62 2a 74 addScalar(2*Bb*t
000359a0: 2e 70 72 6f 70 73 2e 73 63 61 6c 65 29 3b 72 65 .props.scale);re
000359b0: 74 75 72 6e 20 76 76 2e 73 65 74 28 74 2c 73 29 turn vv.set(t,s)
000359c0: 2c 73 7d 66 75 6e 63 74 69 6f 6e 20 5f 76 28 65 ,s}function _v(e
000359d0: 29 7b 63 6f 6e 73 74 20 74 3d 50 62 5b 65 2e 70 ){const t=Pb[e.p
000359e0: 72 6f 70 73 2e 73 69 7a 65 5d 3b 72 65 74 75 72 rops.size];retur
000359f0: 6e 28 6a 62 2b 32 2a 28 74 2d 50 62 2e 73 29 2b n(jb+2*(t-Pb.s)+
00035a00: 28 74 3d 3d 3d 50 62 2e 78 6c 3f 32 30 3a 30 29 (t===Pb.xl?20:0)
00035a10: 29 2a 65 2e 70 72 6f 70 73 2e 73 63 61 6c 65 7d )*e.props.scale}
00035a20: 66 75 6e 63 74 69 6f 6e 20 45 76 28 65 2c 74 29 function Ev(e,t)
00035a30: 7b 6c 65 74 20 6e 3b 63 6f 6e 73 74 20 72 3d 5b {let n;const r=[
00035a40: 5d 2c 6f 3d 76 62 28 65 2c 74 29 2c 69 3d 21 21 ],o=vb(e,t),i=!!
00035a50: 6f 2e 62 69 6e 64 69 6e 67 73 2e 73 74 61 72 74 o.bindings.start
00035a60: 2c 61 3d 21 21 6f 2e 62 69 6e 64 69 6e 67 73 2e ,a=!!o.bindings.
00035a70: 65 6e 64 2c 73 3d 22 6e 6f 6e 65 22 21 3d 3d 6f end,s="none"!==o
00035a80: 2e 73 74 61 72 74 2e 61 72 72 6f 77 68 65 61 64 .start.arrowhead
00035a90: 2c 6c 3d 22 6e 6f 6e 65 22 21 3d 3d 6f 2e 65 6e ,l="none"!==o.en
00035aa0: 64 2e 61 72 72 6f 77 68 65 61 64 3b 69 66 28 6f d.arrowhead;if(o
00035ab0: 2e 69 73 53 74 72 61 69 67 68 74 29 7b 63 6f 6e .isStraight){con
00035ac0: 73 74 20 72 3d 66 75 6e 63 74 69 6f 6e 28 65 2c st r=function(e,
00035ad0: 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 53 76 28 t,n){const r=Sv(
00035ae0: 65 2c 74 29 2c 6f 3d 5f 76 28 74 29 2c 69 3d 73 e,t),o=_v(t),i=s
00035af0: 75 2e 4e 75 64 67 65 28 6e 2e 73 74 61 72 74 2e u.Nudge(n.start.
00035b00: 70 6f 69 6e 74 2c 6e 2e 65 6e 64 2e 70 6f 69 6e point,n.end.poin
00035b10: 74 2c 6f 29 2c 61 3d 73 75 2e 4e 75 64 67 65 28 t,o),a=su.Nudge(
00035b20: 6e 2e 65 6e 64 2e 70 6f 69 6e 74 2c 6e 2e 73 74 n.end.point,n.st
00035b30: 61 72 74 2e 70 6f 69 6e 74 2c 6f 29 2c 73 3d 79 art.point,o),s=y
00035b40: 68 28 69 2c 61 2c 5f 70 2e 46 72 6f 6d 43 65 6e h(i,a,_p.FromCen
00035b50: 74 65 72 28 6e 2e 6d 69 64 64 6c 65 2c 72 29 2e ter(n.middle,r).
00035b60: 63 6f 72 6e 65 72 73 29 3b 69 66 28 21 73 7c 7c corners);if(!s||
00035b70: 32 21 3d 3d 73 2e 6c 65 6e 67 74 68 29 72 65 74 2!==s.length)ret
00035b80: 75 72 6e 7b 73 74 61 72 74 3a 2e 35 2c 65 6e 64 urn{start:.5,end
00035b90: 3a 2e 35 7d 3b 6c 65 74 5b 6c 2c 63 5d 3d 73 3b :.5};let[l,c]=s;
00035ba0: 73 75 2e 44 69 73 74 32 28 6c 2c 69 29 3e 73 75 su.Dist2(l,i)>su
00035bb0: 2e 44 69 73 74 32 28 63 2c 69 29 26 26 28 5b 63 .Dist2(c,i)&&([c
00035bc0: 2c 6c 5d 3d 73 29 3b 63 6f 6e 73 74 20 75 3d 69 ,l]=s);const u=i
00035bd0: 2e 61 64 64 28 73 75 2e 53 75 62 28 6e 2e 6d 69 .add(su.Sub(n.mi
00035be0: 64 64 6c 65 2c 6c 29 29 2c 64 3d 61 2e 61 64 64 ddle,l)),d=a.add
00035bf0: 28 73 75 2e 53 75 62 28 6e 2e 6d 69 64 64 6c 65 (su.Sub(n.middle
00035c00: 2c 63 29 29 3b 72 65 74 75 72 6e 7b 73 74 61 72 ,c));return{star
00035c10: 74 3a 73 75 2e 44 69 73 74 28 6e 2e 73 74 61 72 t:su.Dist(n.star
00035c20: 74 2e 70 6f 69 6e 74 2c 75 29 2f 6e 2e 6c 65 6e t.point,u)/n.len
00035c30: 67 74 68 2c 65 6e 64 3a 73 75 2e 44 69 73 74 28 gth,end:su.Dist(
00035c40: 6e 2e 73 74 61 72 74 2e 70 6f 69 6e 74 2c 64 29 n.start.point,d)
00035c50: 2f 6e 2e 6c 65 6e 67 74 68 7d 7d 28 65 2c 74 2c /n.length}}(e,t,
00035c60: 6f 29 3b 6c 65 74 20 63 3d 6d 75 28 74 2e 70 72 o);let c=mu(t.pr
00035c70: 6f 70 73 2e 6c 61 62 65 6c 50 6f 73 69 74 69 6f ops.labelPositio
00035c80: 6e 2c 73 7c 7c 69 3f 72 2e 73 74 61 72 74 3a 30 n,s||i?r.start:0
00035c90: 2c 6c 7c 7c 61 3f 72 2e 65 6e 64 3a 31 29 3b 63 ,l||a?r.end:1);c
00035ca0: 3d 63 3e 3d 2e 34 38 26 26 63 3c 3d 2e 35 32 3f =c>=.48&&c<=.52?
00035cb0: 2e 35 3a 63 2c 6e 3d 73 75 2e 4c 72 70 28 6f 2e .5:c,n=su.Lrp(o.
00035cc0: 73 74 61 72 74 2e 70 6f 69 6e 74 2c 6f 2e 65 6e start.point,o.en
00035cd0: 64 2e 70 6f 69 6e 74 2c 63 29 7d 65 6c 73 65 7b d.point,c)}else{
00035ce0: 63 6f 6e 73 74 20 63 3d 66 75 6e 63 74 69 6f 6e const c=function
00035cf0: 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d (e,t,n){const r=
00035d00: 53 76 28 65 2c 74 29 2c 6f 3d 5f 76 28 74 29 2c Sv(e,t),o=_v(t),
00035d10: 69 3d 4d 61 74 68 2e 73 69 67 6e 28 74 2e 70 72 i=Math.sign(t.pr
00035d20: 6f 70 73 2e 62 65 6e 64 29 2c 61 3d 6f 2f 6e 2e ops.bend),a=o/n.
00035d30: 68 61 6e 64 6c 65 41 72 63 2e 72 61 64 69 75 73 handleArc.radius
00035d40: 2a 69 2c 73 3d 73 75 2e 41 6e 67 6c 65 28 6e 2e *i,s=su.Angle(n.
00035d50: 62 6f 64 79 41 72 63 2e 63 65 6e 74 65 72 2c 6e bodyArc.center,n
00035d60: 2e 73 74 61 72 74 2e 70 6f 69 6e 74 29 2d 61 2c .start.point)-a,
00035d70: 6c 3d 73 75 2e 41 6e 67 6c 65 28 6e 2e 62 6f 64 l=su.Angle(n.bod
00035d80: 79 41 72 63 2e 63 65 6e 74 65 72 2c 6e 2e 65 6e yArc.center,n.en
00035d90: 64 2e 70 6f 69 6e 74 29 2b 61 2c 63 3d 43 75 28 d.point)+a,c=Cu(
00035da0: 6e 2e 62 6f 64 79 41 72 63 2e 63 65 6e 74 65 72 n.bodyArc.center
00035db0: 2c 6e 2e 62 6f 64 79 41 72 63 2e 72 61 64 69 75 ,n.bodyArc.radiu
00035dc0: 73 2c 73 29 2c 75 3d 43 75 28 6e 2e 62 6f 64 79 s,s),u=Cu(n.body
00035dd0: 41 72 63 2e 63 65 6e 74 65 72 2c 6e 2e 62 6f 64 Arc.center,n.bod
00035de0: 79 41 72 63 2e 72 61 64 69 75 73 2c 6c 29 2c 64 yArc.radius,l),d
00035df0: 3d 5b 5d 2c 70 3d 77 76 28 6e 2e 62 6f 64 79 41 =[],p=wv(n.bodyA
00035e00: 72 63 2e 63 65 6e 74 65 72 2c 6e 2e 62 6f 64 79 rc.center,n.body
00035e10: 41 72 63 2e 72 61 64 69 75 73 2c 73 2c 6c 2c 69 Arc.radius,s,l,i
00035e20: 2c 5f 70 2e 46 72 6f 6d 43 65 6e 74 65 72 28 63 ,_p.FromCenter(c
00035e30: 2c 72 29 2e 63 6f 72 6e 65 72 73 29 3b 64 2e 70 ,r).corners);d.p
00035e40: 75 73 68 28 6e 65 77 20 49 68 28 7b 70 6f 69 6e ush(new Ih({poin
00035e50: 74 73 3a 5f 70 2e 46 72 6f 6d 43 65 6e 74 65 72 ts:_p.FromCenter
00035e60: 28 63 2c 72 29 2e 63 6f 72 6e 65 72 73 2c 64 65 (c,r).corners,de
00035e70: 62 75 67 43 6f 6c 6f 72 3a 22 6c 69 6d 65 22 2c bugColor:"lime",
00035e80: 69 73 46 69 6c 6c 65 64 3a 21 31 2c 69 67 6e 6f isFilled:!1,igno
00035e90: 72 65 3a 21 30 7d 29 29 3b 63 6f 6e 73 74 20 66 re:!0}));const f
00035ea0: 3d 77 76 28 6e 2e 62 6f 64 79 41 72 63 2e 63 65 =wv(n.bodyArc.ce
00035eb0: 6e 74 65 72 2c 6e 2e 62 6f 64 79 41 72 63 2e 72 nter,n.bodyArc.r
00035ec0: 61 64 69 75 73 2c 73 2c 6c 2c 69 2c 5f 70 2e 46 adius,s,l,i,_p.F
00035ed0: 72 6f 6d 43 65 6e 74 65 72 28 75 2c 72 29 2e 63 romCenter(u,r).c
00035ee0: 6f 72 6e 65 72 73 29 3b 64 2e 70 75 73 68 28 6e orners);d.push(n
00035ef0: 65 77 20 49 68 28 7b 70 6f 69 6e 74 73 3a 5f 70 ew Ih({points:_p
00035f00: 2e 46 72 6f 6d 43 65 6e 74 65 72 28 75 2c 72 29 .FromCenter(u,r)
00035f10: 2e 63 6f 72 6e 65 72 73 2c 64 65 62 75 67 43 6f .corners,debugCo
00035f20: 6c 6f 72 3a 22 6c 69 6d 65 22 2c 69 73 46 69 6c lor:"lime",isFil
00035f30: 6c 65 64 3a 21 31 2c 69 67 6e 6f 72 65 3a 21 30 led:!1,ignore:!0
00035f40: 7d 29 29 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 }));for(const e
00035f50: 6f 66 5b 2e 2e 2e 70 3f 3f 5b 5d 2c 2e 2e 2e 66 of[...p??[],...f
00035f60: 3f 3f 5b 5d 2c 63 2c 75 5d 29 64 2e 70 75 73 68 ??[],c,u])d.push
00035f70: 28 6e 65 77 20 46 67 28 7b 78 3a 65 2e 78 2d 33 (new Fg({x:e.x-3
00035f80: 2c 79 3a 65 2e 79 2d 33 2c 72 61 64 69 75 73 3a ,y:e.y-3,radius:
00035f90: 33 2c 69 73 46 69 6c 6c 65 64 3a 21 31 2c 64 65 3,isFilled:!1,de
00035fa0: 62 75 67 43 6f 6c 6f 72 3a 22 6d 61 67 65 6e 74 bugColor:"magent
00035fb0: 61 22 2c 69 67 6e 6f 72 65 3a 21 30 7d 29 29 3b a",ignore:!0}));
00035fc0: 63 6f 6e 73 74 20 68 3d 28 70 26 26 78 76 28 6e const h=(p&&xv(n
00035fd0: 2e 73 74 61 72 74 2e 70 6f 69 6e 74 2c 70 29 29 .start.point,p))
00035fe0: 3f 3f 6e 2e 6d 69 64 64 6c 65 2c 6d 3d 28 66 26 ??n.middle,m=(f&
00035ff0: 26 78 76 28 6e 2e 65 6e 64 2e 70 6f 69 6e 74 2c &xv(n.end.point,
00036000: 66 29 29 3f 3f 6e 2e 6d 69 64 64 6c 65 2c 67 3d f))??n.middle,g=
00036010: 73 75 2e 41 6e 67 6c 65 28 6e 2e 62 6f 64 79 41 su.Angle(n.bodyA
00036020: 72 63 2e 63 65 6e 74 65 72 2c 6e 2e 73 74 61 72 rc.center,n.star
00036030: 74 2e 70 6f 69 6e 74 29 2c 62 3d 73 75 2e 41 6e t.point),b=su.An
00036040: 67 6c 65 28 6e 2e 62 6f 64 79 41 72 63 2e 63 65 gle(n.bodyArc.ce
00036050: 6e 74 65 72 2c 6e 2e 65 6e 64 2e 70 6f 69 6e 74 nter,n.end.point
00036060: 29 2c 79 3d 73 75 2e 41 6e 67 6c 65 28 6e 2e 62 ),y=su.Angle(n.b
00036070: 6f 64 79 41 72 63 2e 63 65 6e 74 65 72 2c 68 29 odyArc.center,h)
00036080: 2c 76 3d 73 75 2e 41 6e 67 6c 65 28 6e 2e 62 6f ,v=su.Angle(n.bo
00036090: 64 79 41 72 63 2e 63 65 6e 74 65 72 2c 6d 29 3b dyArc.center,m);
000360a0: 69 66 28 44 75 28 67 2c 79 2c 69 29 3e 44 75 28 if(Du(g,y,i)>Du(
000360b0: 67 2c 76 2c 69 29 29 72 65 74 75 72 6e 7b 73 74 g,v,i))return{st
000360c0: 61 72 74 3a 2e 35 2c 65 6e 64 3a 2e 35 2c 64 62 art:.5,end:.5,db
000360d0: 67 3a 64 7d 3b 63 6f 6e 73 74 20 53 3d 44 75 28 g:d};const S=Du(
000360e0: 67 2c 62 2c 69 29 3b 72 65 74 75 72 6e 7b 73 74 g,b,i);return{st
000360f0: 61 72 74 3a 44 75 28 67 2c 79 2c 69 29 2f 53 2c art:Du(g,y,i)/S,
00036100: 65 6e 64 3a 44 75 28 67 2c 76 2c 69 29 2f 53 2c end:Du(g,v,i)/S,
00036110: 64 62 67 3a 64 7d 7d 28 65 2c 74 2c 6f 29 3b 63 dbg:d}}(e,t,o);c
00036120: 2e 64 62 67 26 26 72 2e 70 75 73 68 28 2e 2e 2e .dbg&&r.push(...
00036130: 63 2e 64 62 67 29 3b 6c 65 74 20 75 3d 6d 75 28 c.dbg);let u=mu(
00036140: 74 2e 70 72 6f 70 73 2e 6c 61 62 65 6c 50 6f 73 t.props.labelPos
00036150: 69 74 69 6f 6e 2c 73 7c 7c 69 3f 63 2e 73 74 61 ition,s||i?c.sta
00036160: 72 74 3a 30 2c 6c 7c 7c 61 3f 63 2e 65 6e 64 3a rt:0,l||a?c.end:
00036170: 31 29 3b 75 3d 75 3e 3d 2e 34 38 26 26 75 3c 3d 1);u=u>=.48&&u<=
00036180: 2e 35 32 3f 2e 35 3a 75 3b 63 6f 6e 73 74 20 64 .52?.5:u;const d
00036190: 3d 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c =function(e,t,n,
000361a0: 72 29 7b 63 6f 6e 73 74 20 6f 3d 44 75 28 65 2c r){const o=Du(e,
000361b0: 74 2c 6e 29 3b 72 65 74 75 72 6e 20 65 2b 6f 2a t,n);return e+o*
000361c0: 72 2a 6e 2a 2d 31 7d 28 73 75 2e 41 6e 67 6c 65 r*n*-1}(su.Angle
000361d0: 28 6f 2e 62 6f 64 79 41 72 63 2e 63 65 6e 74 65 (o.bodyArc.cente
000361e0: 72 2c 6f 2e 73 74 61 72 74 2e 70 6f 69 6e 74 29 r,o.start.point)
000361f0: 2c 73 75 2e 41 6e 67 6c 65 28 6f 2e 62 6f 64 79 ,su.Angle(o.body
00036200: 41 72 63 2e 63 65 6e 74 65 72 2c 6f 2e 65 6e 64 Arc.center,o.end
00036210: 2e 70 6f 69 6e 74 29 2c 4d 61 74 68 2e 73 69 67 .point),Math.sig
00036220: 6e 28 74 2e 70 72 6f 70 73 2e 62 65 6e 64 29 2c n(t.props.bend),
00036230: 75 29 3b 6e 3d 43 75 28 6f 2e 62 6f 64 79 41 72 u);n=Cu(o.bodyAr
00036240: 63 2e 63 65 6e 74 65 72 2c 6f 2e 62 6f 64 79 41 c.center,o.bodyA
00036250: 72 63 2e 72 61 64 69 75 73 2c 64 29 7d 63 6f 6e rc.radius,d)}con
00036260: 73 74 20 63 3d 53 76 28 65 2c 74 29 3b 72 65 74 st c=Sv(e,t);ret
00036270: 75 72 6e 7b 62 6f 78 3a 5f 70 2e 46 72 6f 6d 43 urn{box:_p.FromC
00036280: 65 6e 74 65 72 28 6e 2c 63 29 2c 64 65 62 75 67 enter(n,c),debug
00036290: 47 65 6f 6d 3a 72 7d 7d 66 75 6e 63 74 69 6f 6e Geom:r}}function
000362a0: 20 77 76 28 65 2c 74 2c 6e 2c 72 2c 6f 2c 69 29 wv(e,t,n,r,o,i)
000362b0: 7b 63 6f 6e 73 74 20 61 3d 76 68 28 65 2c 74 2c {const a=vh(e,t,
000362c0: 69 29 2c 73 3d 44 75 28 6e 2c 72 2c 6f 29 3b 72 i),s=Du(n,r,o);r
000362d0: 65 74 75 72 6e 20 61 3f 2e 66 69 6c 74 65 72 28 eturn a?.filter(
000362e0: 28 74 3d 3e 7b 63 6f 6e 73 74 20 72 3d 44 75 28 (t=>{const r=Du(
000362f0: 6e 2c 73 75 2e 41 6e 67 6c 65 28 65 2c 74 29 2c n,su.Angle(e,t),
00036300: 6f 29 3b 72 65 74 75 72 6e 20 72 3e 3d 30 26 26 o);return r>=0&&
00036310: 72 3c 3d 73 7d 29 29 7d 66 75 6e 63 74 69 6f 6e r<=s}))}function
00036320: 20 78 76 28 65 2c 74 29 7b 6c 65 74 20 6e 3d 6e xv(e,t){let n=n
00036330: 75 6c 6c 2c 72 3d 2d 31 2f 30 3b 66 6f 72 28 63 ull,r=-1/0;for(c
00036340: 6f 6e 73 74 20 6f 20 6f 66 20 74 29 7b 63 6f 6e onst o of t){con
00036350: 73 74 20 74 3d 73 75 2e 44 69 73 74 32 28 65 2c st t=su.Dist2(e,
00036360: 6f 29 3b 74 3e 72 26 26 28 6e 3d 6f 2c 72 3d 74 o);t>r&&(n=o,r=t
00036370: 29 7d 72 65 74 75 72 6e 20 6e 7d 66 75 6e 63 74 )}return n}funct
00036380: 69 6f 6e 20 54 76 28 65 29 7b 72 65 74 75 72 6e ion Tv(e){return
00036390: 20 4c 62 5b 65 2e 70 72 6f 70 73 2e 73 69 7a 65 Lb[e.props.size
000363a0: 5d 2a 65 2e 70 72 6f 70 73 2e 73 63 61 6c 65 7d ]*e.props.scale}
000363b0: 66 75 6e 63 74 69 6f 6e 20 43 76 28 65 2c 74 2c function Cv(e,t,
000363c0: 6e 29 7b 63 6f 6e 73 74 20 72 3d 22 65 6e 64 22 n){const r="end"
000363d0: 3d 3d 3d 74 3f 65 2e 65 6e 64 2e 70 6f 69 6e 74 ===t?e.end.point
000363e0: 3a 65 2e 73 74 61 72 74 2e 70 6f 69 6e 74 2c 6f :e.start.point,o
000363f0: 3d 22 65 6e 64 22 3d 3d 3d 74 3f 65 2e 73 74 61 ="end"===t?e.sta
00036400: 72 74 2e 70 6f 69 6e 74 3a 65 2e 65 6e 64 2e 70 rt.point:e.end.p
00036410: 6f 69 6e 74 2c 69 3d 65 2e 69 73 53 74 72 61 69 oint,i=e.isStrai
00036420: 67 68 74 3f 73 75 2e 44 69 73 74 28 6f 2c 72 29 ght?su.Dist(o,r)
00036430: 3a 4d 61 74 68 2e 61 62 73 28 65 2e 62 6f 64 79 :Math.abs(e.body
00036440: 41 72 63 2e 6c 65 6e 67 74 68 29 2c 61 3d 4d 61 Arc.length),a=Ma
00036450: 74 68 2e 6d 61 78 28 4d 61 74 68 2e 6d 69 6e 28 th.max(Math.min(
00036460: 69 2f 35 2c 33 2a 6e 29 2c 6e 29 3b 6c 65 74 20 i/5,3*n),n);let
00036470: 73 3b 69 66 28 65 2e 69 73 53 74 72 61 69 67 68 s;if(e.isStraigh
00036480: 74 29 73 3d 73 75 2e 4e 75 64 67 65 28 72 2c 6f t)s=su.Nudge(r,o
00036490: 2c 61 29 3b 65 6c 73 65 7b 63 6f 6e 73 74 20 6e ,a);else{const n
000364a0: 3d 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c =function(e,t,n,
000364b0: 72 29 7b 6c 65 74 20 6f 3d 6e 2e 78 2d 65 2e 78 r){let o=n.x-e.x
000364c0: 2c 69 3d 6e 2e 79 2d 65 2e 79 3b 63 6f 6e 73 74 ,i=n.y-e.y;const
000364d0: 20 61 3d 4d 61 74 68 2e 73 71 72 74 28 6f 2a 6f a=Math.sqrt(o*o
000364e0: 2b 69 2a 69 29 2c 73 3d 28 61 2a 61 2d 72 2a 72 +i*i),s=(a*a-r*r
000364f0: 2b 74 2a 74 29 2f 28 32 2a 61 29 2c 6c 3d 4d 61 +t*t)/(2*a),l=Ma
00036500: 74 68 2e 73 71 72 74 28 74 2a 74 2d 73 2a 73 29 th.sqrt(t*t-s*s)
00036510: 3b 72 65 74 75 72 6e 20 6f 2f 3d 61 2c 69 2f 3d ;return o/=a,i/=
00036520: 61 2c 5b 6e 65 77 20 73 75 28 65 2e 78 2b 6f 2a a,[new su(e.x+o*
00036530: 73 2d 69 2a 6c 2c 65 2e 79 2b 69 2a 73 2b 6f 2a s-i*l,e.y+i*s+o*
00036540: 6c 29 2c 6e 65 77 20 73 75 28 65 2e 78 2b 6f 2a l),new su(e.x+o*
00036550: 73 2b 69 2a 6c 2c 65 2e 79 2b 69 2a 73 2d 6f 2a s+i*l,e.y+i*s-o*
00036560: 6c 29 5d 7d 28 72 2c 61 2c 65 2e 68 61 6e 64 6c l)]}(r,a,e.handl
00036570: 65 41 72 63 2e 63 65 6e 74 65 72 2c 65 2e 68 61 eArc.center,e.ha
00036580: 6e 64 6c 65 41 72 63 2e 72 61 64 69 75 73 29 3b ndleArc.radius);
00036590: 73 3d 22 65 6e 64 22 3d 3d 3d 74 3f 65 2e 68 61 s="end"===t?e.ha
000365a0: 6e 64 6c 65 41 72 63 2e 73 77 65 65 70 46 6c 61 ndleArc.sweepFla
000365b0: 67 3f 6e 5b 30 5d 3a 6e 5b 31 5d 3a 65 2e 68 61 g?n[0]:n[1]:e.ha
000365c0: 6e 64 6c 65 41 72 63 2e 73 77 65 65 70 46 6c 61 ndleArc.sweepFla
000365d0: 67 3f 6e 5b 31 5d 3a 6e 5b 30 5d 7d 72 65 74 75 g?n[1]:n[0]}retu
000365e0: 72 6e 20 73 75 2e 49 73 4e 61 4e 28 73 29 26 26 rn su.IsNaN(s)&&
000365f0: 28 73 3d 65 2e 73 74 61 72 74 2e 70 6f 69 6e 74 (s=e.start.point
00036600: 29 2c 7b 70 6f 69 6e 74 3a 72 2c 69 6e 74 3a 73 ),{point:r,int:s
00036610: 7d 7d 66 75 6e 63 74 69 6f 6e 20 6b 76 28 65 2c }}function kv(e,
00036620: 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 22 65 6e t,n){const r="en
00036630: 64 22 3d 3d 3d 74 3f 65 2e 65 6e 64 2e 61 72 72 d"===t?e.end.arr
00036640: 6f 77 68 65 61 64 3a 65 2e 73 74 61 72 74 2e 61 owhead:e.start.a
00036650: 72 72 6f 77 68 65 61 64 3b 69 66 28 22 6e 6f 6e rrowhead;if("non
00036660: 65 22 3d 3d 3d 72 29 72 65 74 75 72 6e 3b 63 6f e"===r)return;co
00036670: 6e 73 74 20 6f 3d 43 76 28 65 2c 74 2c 6e 29 3b nst o=Cv(e,t,n);
00036680: 69 66 28 6f 29 7b 73 77 69 74 63 68 28 72 29 7b if(o){switch(r){
00036690: 63 61 73 65 22 62 61 72 22 3a 72 65 74 75 72 6e case"bar":return
000366a0: 20 66 75 6e 63 74 69 6f 6e 28 7b 69 6e 74 3a 65 function({int:e
000366b0: 2c 70 6f 69 6e 74 3a 74 7d 29 7b 63 6f 6e 73 74 ,point:t}){const
000366c0: 20 6e 3d 73 75 2e 53 75 62 28 65 2c 74 29 2e 64 n=su.Sub(e,t).d
000366d0: 69 76 28 32 29 2c 72 3d 73 75 2e 41 64 64 28 74 iv(2),r=su.Add(t
000366e0: 2c 73 75 2e 52 6f 74 28 6e 2c 70 75 29 29 2c 6f ,su.Rot(n,pu)),o
000366f0: 3d 73 75 2e 53 75 62 28 74 2c 73 75 2e 52 6f 74 =su.Sub(t,su.Rot
00036700: 28 6e 2c 70 75 29 29 3b 72 65 74 75 72 6e 60 4d (n,pu));return`M
00036710: 20 24 7b 72 2e 78 7d 20 24 7b 72 2e 79 7d 20 4c ${r.x} ${r.y} L
00036720: 20 24 7b 6f 2e 78 7d 20 24 7b 6f 2e 79 7d 60 7d ${o.x} ${o.y}`}
00036730: 28 6f 29 3b 63 61 73 65 22 73 71 75 61 72 65 22 (o);case"square"
00036740: 3a 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e :return function
00036750: 28 7b 69 6e 74 3a 65 2c 70 6f 69 6e 74 3a 74 7d ({int:e,point:t}
00036760: 29 7b 63 6f 6e 73 74 20 6e 3d 73 75 2e 4c 72 70 ){const n=su.Lrp
00036770: 28 74 2c 65 2c 2e 38 35 29 2c 72 3d 73 75 2e 53 (t,e,.85),r=su.S
00036780: 75 62 28 6e 2c 74 29 2e 64 69 76 28 32 29 2c 6f ub(n,t).div(2),o
00036790: 3d 73 75 2e 41 64 64 28 74 2c 73 75 2e 52 6f 74 =su.Add(t,su.Rot
000367a0: 28 72 2c 70 75 29 29 2c 69 3d 73 75 2e 53 75 62 (r,pu)),i=su.Sub
000367b0: 28 74 2c 73 75 2e 52 6f 74 28 72 2c 70 75 29 29 (t,su.Rot(r,pu))
000367c0: 2c 61 3d 73 75 2e 41 64 64 28 6e 2c 73 75 2e 52 ,a=su.Add(n,su.R
000367d0: 6f 74 28 72 2c 70 75 29 29 2c 73 3d 73 75 2e 53 ot(r,pu)),s=su.S
000367e0: 75 62 28 6e 2c 73 75 2e 52 6f 74 28 72 2c 70 75 ub(n,su.Rot(r,pu
000367f0: 29 29 3b 72 65 74 75 72 6e 60 4d 20 24 7b 6f 2e ));return`M ${o.
00036800: 78 7d 20 24 7b 6f 2e 79 7d 20 4c 20 24 7b 61 2e x} ${o.y} L ${a.
00036810: 78 7d 20 24 7b 61 2e 79 7d 20 4c 20 24 7b 73 2e x} ${a.y} L ${s.
00036820: 78 7d 20 24 7b 73 2e 79 7d 20 4c 20 24 7b 69 2e x} ${s.y} L ${i.
00036830: 78 7d 20 24 7b 69 2e 79 7d 20 5a 60 7d 28 6f 29 x} ${i.y} Z`}(o)
00036840: 3b 63 61 73 65 22 64 69 61 6d 6f 6e 64 22 3a 72 ;case"diamond":r
00036850: 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 28 7b eturn function({
00036860: 70 6f 69 6e 74 3a 65 2c 69 6e 74 3a 74 7d 29 7b point:e,int:t}){
00036870: 63 6f 6e 73 74 20 6e 3d 73 75 2e 4c 72 70 28 65 const n=su.Lrp(e
00036880: 2c 74 2c 2e 37 35 29 2c 72 3d 73 75 2e 52 6f 74 ,t,.75),r=su.Rot
00036890: 57 69 74 68 28 6e 2c 65 2c 64 75 2f 34 29 2c 6f With(n,e,du/4),o
000368a0: 3d 73 75 2e 52 6f 74 57 69 74 68 28 6e 2c 65 2c =su.RotWith(n,e,
000368b0: 2d 64 75 2f 34 29 2c 69 3d 73 75 2e 4c 72 70 28 -du/4),i=su.Lrp(
000368c0: 72 2c 6f 2c 2e 35 29 3b 72 65 74 75 72 6e 20 69 r,o,.5);return i
000368d0: 2e 61 64 64 28 73 75 2e 53 75 62 28 69 2c 65 29 .add(su.Sub(i,e)
000368e0: 29 2c 60 4d 20 24 7b 69 2e 78 7d 20 24 7b 69 2e ),`M ${i.x} ${i.
000368f0: 79 7d 20 4c 20 24 7b 72 2e 78 7d 20 24 7b 72 2e y} L ${r.x} ${r.
00036900: 79 7d 20 24 7b 65 2e 78 7d 20 24 7b 65 2e 79 7d y} ${e.x} ${e.y}
00036910: 20 4c 20 24 7b 6f 2e 78 7d 20 24 7b 6f 2e 79 7d L ${o.x} ${o.y}
00036920: 20 5a 60 7d 28 6f 29 3b 63 61 73 65 22 64 6f 74 Z`}(o);case"dot
00036930: 22 3a 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f ":return functio
00036940: 6e 28 7b 70 6f 69 6e 74 3a 65 2c 69 6e 74 3a 74 n({point:e,int:t
00036950: 7d 29 7b 63 6f 6e 73 74 20 6e 3d 73 75 2e 4c 72 }){const n=su.Lr
00036960: 70 28 65 2c 74 2c 2e 34 35 29 2c 72 3d 73 75 2e p(e,t,.45),r=su.
00036970: 44 69 73 74 28 6e 2c 65 29 3b 72 65 74 75 72 6e Dist(n,e);return
00036980: 60 4d 20 24 7b 6e 2e 78 2d 72 7d 2c 24 7b 6e 2e `M ${n.x-r},${n.
00036990: 79 7d 5c 6e 20 20 61 20 24 7b 72 7d 2c 24 7b 72 y}\n a ${r},${r
000369a0: 7d 20 30 20 31 2c 30 20 24 7b 32 2a 72 7d 2c 30 } 0 1,0 ${2*r},0
000369b0: 5c 6e 20 20 61 20 24 7b 72 7d 2c 24 7b 72 7d 20 \n a ${r},${r}
000369c0: 30 20 31 2c 30 20 2d 24 7b 32 2a 72 7d 2c 30 20 0 1,0 -${2*r},0
000369d0: 60 7d 28 6f 29 3b 63 61 73 65 22 69 6e 76 65 72 `}(o);case"inver
000369e0: 74 65 64 22 3a 72 65 74 75 72 6e 20 66 75 6e 63 ted":return func
000369f0: 74 69 6f 6e 28 7b 70 6f 69 6e 74 3a 65 2c 69 6e tion({point:e,in
00036a00: 74 3a 74 7d 29 7b 63 6f 6e 73 74 20 6e 3d 73 75 t:t}){const n=su
00036a10: 2e 53 75 62 28 74 2c 65 29 2e 64 69 76 28 32 29 .Sub(t,e).div(2)
00036a20: 2c 72 3d 73 75 2e 41 64 64 28 65 2c 73 75 2e 52 ,r=su.Add(e,su.R
00036a30: 6f 74 28 6e 2c 70 75 29 29 2c 6f 3d 73 75 2e 53 ot(n,pu)),o=su.S
00036a40: 75 62 28 65 2c 73 75 2e 52 6f 74 28 6e 2c 70 75 ub(e,su.Rot(n,pu
00036a50: 29 29 3b 72 65 74 75 72 6e 60 4d 20 24 7b 72 2e ));return`M ${r.
00036a60: 78 7d 20 24 7b 72 2e 79 7d 20 4c 20 24 7b 74 2e x} ${r.y} L ${t.
00036a70: 78 7d 20 24 7b 74 2e 79 7d 20 4c 20 24 7b 6f 2e x} ${t.y} L ${o.
00036a80: 78 7d 20 24 7b 6f 2e 79 7d 20 5a 60 7d 28 6f 29 x} ${o.y} Z`}(o)
00036a90: 3b 63 61 73 65 22 61 72 72 6f 77 22 3a 72 65 74 ;case"arrow":ret
00036aa0: 75 72 6e 20 66 75 6e 63 74 69 6f 6e 28 7b 70 6f urn function({po
00036ab0: 69 6e 74 3a 65 2c 69 6e 74 3a 74 7d 29 7b 63 6f int:e,int:t}){co
00036ac0: 6e 73 74 20 6e 3d 73 75 2e 52 6f 74 57 69 74 68 nst n=su.RotWith
00036ad0: 28 74 2c 65 2c 64 75 2f 36 29 2c 72 3d 73 75 2e (t,e,du/6),r=su.
00036ae0: 52 6f 74 57 69 74 68 28 74 2c 65 2c 2d 64 75 2f RotWith(t,e,-du/
00036af0: 36 29 3b 72 65 74 75 72 6e 60 4d 20 24 7b 6e 2e 6);return`M ${n.
00036b00: 78 7d 20 24 7b 6e 2e 79 7d 20 4c 20 24 7b 65 2e x} ${n.y} L ${e.
00036b10: 78 7d 20 24 7b 65 2e 79 7d 20 4c 20 24 7b 72 2e x} ${e.y} L ${r.
00036b20: 78 7d 20 24 7b 72 2e 79 7d 60 7d 28 6f 29 3b 63 x} ${r.y}`}(o);c
00036b30: 61 73 65 22 74 72 69 61 6e 67 6c 65 22 3a 72 65 ase"triangle":re
00036b40: 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 28 7b 70 turn function({p
00036b50: 6f 69 6e 74 3a 65 2c 69 6e 74 3a 74 7d 29 7b 63 oint:e,int:t}){c
00036b60: 6f 6e 73 74 20 6e 3d 73 75 2e 52 6f 74 57 69 74 onst n=su.RotWit
00036b70: 68 28 74 2c 65 2c 64 75 2f 36 29 2c 72 3d 73 75 h(t,e,du/6),r=su
00036b80: 2e 52 6f 74 57 69 74 68 28 74 2c 65 2c 2d 64 75 .RotWith(t,e,-du
00036b90: 2f 36 29 3b 72 65 74 75 72 6e 60 4d 20 24 7b 6e /6);return`M ${n
00036ba0: 2e 78 7d 20 24 7b 6e 2e 79 7d 20 4c 20 24 7b 65 .x} ${n.y} L ${e
00036bb0: 2e 78 7d 20 24 7b 65 2e 79 7d 20 4c 20 24 7b 72 .x} ${e.y} L ${r
00036bc0: 2e 78 7d 20 24 7b 72 2e 79 7d 20 5a 60 7d 28 6f .x} ${r.y} Z`}(o
00036bd0: 29 7d 72 65 74 75 72 6e 22 22 7d 7d 66 75 6e 63 )}return""}}func
00036be0: 74 69 6f 6e 20 41 76 28 65 29 7b 63 6f 6e 73 74 tion Av(e){const
00036bf0: 7b 73 74 61 72 74 3a 74 2c 65 6e 64 3a 6e 2c 68 {start:t,end:n,h
00036c00: 61 6e 64 6c 65 41 72 63 3a 7b 72 61 64 69 75 73 andleArc:{radius
00036c10: 3a 72 2c 6c 61 72 67 65 41 72 63 46 6c 61 67 3a :r,largeArcFlag:
00036c20: 6f 2c 73 77 65 65 70 46 6c 61 67 3a 69 7d 7d 3d o,sweepFlag:i}}=
00036c30: 65 3b 72 65 74 75 72 6e 60 4d 24 7b 74 2e 68 61 e;return`M${t.ha
00036c40: 6e 64 6c 65 2e 78 7d 2c 24 7b 74 2e 68 61 6e 64 ndle.x},${t.hand
00036c50: 6c 65 2e 79 7d 20 41 24 7b 72 7d 20 24 7b 72 7d le.y} A${r} ${r}
00036c60: 20 30 20 24 7b 6f 7d 20 24 7b 69 7d 20 24 7b 6e 0 ${o} ${i} ${n
00036c70: 2e 68 61 6e 64 6c 65 2e 78 7d 2c 24 7b 6e 2e 68 .handle.x},${n.h
00036c80: 61 6e 64 6c 65 2e 79 7d 60 7d 66 75 6e 63 74 69 andle.y}`}functi
00036c90: 6f 6e 20 49 76 28 65 29 7b 63 6f 6e 73 74 7b 73 on Iv(e){const{s
00036ca0: 74 61 72 74 3a 74 2c 65 6e 64 3a 6e 2c 62 6f 64 tart:t,end:n,bod
00036cb0: 79 41 72 63 3a 7b 72 61 64 69 75 73 3a 72 2c 6c yArc:{radius:r,l
00036cc0: 61 72 67 65 41 72 63 46 6c 61 67 3a 6f 2c 73 77 argeArcFlag:o,sw
00036cd0: 65 65 70 46 6c 61 67 3a 69 7d 7d 3d 65 3b 72 65 eepFlag:i}}=e;re
00036ce0: 74 75 72 6e 60 4d 24 7b 74 2e 70 6f 69 6e 74 2e turn`M${t.point.
00036cf0: 78 7d 2c 24 7b 74 2e 70 6f 69 6e 74 2e 79 7d 20 x},${t.point.y}
00036d00: 41 24 7b 72 7d 20 24 7b 72 7d 20 30 20 24 7b 6f A${r} ${r} 0 ${o
00036d10: 7d 20 24 7b 69 7d 20 24 7b 6e 2e 70 6f 69 6e 74 } ${i} ${n.point
00036d20: 2e 78 7d 2c 24 7b 6e 2e 70 6f 69 6e 74 2e 79 7d .x},${n.point.y}
00036d30: 60 7d 66 75 6e 63 74 69 6f 6e 20 52 76 28 65 2c `}function Rv(e,
00036d40: 74 29 7b 72 65 74 75 72 6e 60 4d 24 7b 65 2e 78 t){return`M${e.x
00036d50: 7d 2c 24 7b 65 2e 79 7d 4c 24 7b 74 2e 78 7d 2c },${e.y}L${t.x},
00036d60: 24 7b 74 2e 79 7d 60 7d 66 75 6e 63 74 69 6f 6e ${t.y}`}function
00036d70: 20 4f 76 28 65 29 7b 72 65 74 75 72 6e 20 52 76 Ov(e){return Rv
00036d80: 28 65 2e 73 74 61 72 74 2e 68 61 6e 64 6c 65 2c (e.start.handle,
00036d90: 65 2e 65 6e 64 2e 68 61 6e 64 6c 65 29 7d 66 75 e.end.handle)}fu
00036da0: 6e 63 74 69 6f 6e 20 4e 76 28 65 29 7b 72 65 74 nction Nv(e){ret
00036db0: 75 72 6e 20 52 76 28 65 2e 73 74 61 72 74 2e 70 urn Rv(e.start.p
00036dc0: 6f 69 6e 74 2c 65 2e 65 6e 64 2e 70 6f 69 6e 74 oint,e.end.point
00036dd0: 29 7d 6c 65 74 20 50 76 3d 30 3b 63 6f 6e 73 74 )}let Pv=0;const
00036de0: 20 4d 76 3d 63 61 28 28 66 75 6e 63 74 69 6f 6e Mv=ca((function
00036df0: 28 7b 73 68 61 70 65 3a 65 2c 73 68 6f 75 6c 64 ({shape:e,should
00036e00: 44 69 73 70 6c 61 79 48 61 6e 64 6c 65 73 3a 74 DisplayHandles:t
00036e10: 7d 29 7b 63 6f 6e 73 74 20 6e 3d 72 75 28 29 2c }){const n=ru(),
00036e20: 72 3d 51 79 28 29 2c 69 3d 76 62 28 6e 2c 65 29 r=Qy(),i=vb(n,e)
00036e30: 2c 61 3d 5f 70 2e 5a 65 72 6f 46 69 78 28 6e 2e ,a=_p.ZeroFix(n.
00036e40: 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 79 getShapeGeometry
00036e50: 28 65 29 2e 62 6f 75 6e 64 73 29 2c 73 3d 62 62 (e).bounds),s=bb
00036e60: 28 6e 2c 65 29 2c 6c 3d 6f 2e 75 73 65 4d 65 6d (n,e),l=o.useMem
00036e70: 6f 28 28 28 29 3d 3e 6e 2e 65 6e 76 69 72 6f 6e o((()=>n.environ
00036e80: 6d 65 6e 74 2e 69 73 53 61 66 61 72 69 3f 50 76 ment.isSafari?Pv
00036e90: 2b 3d 31 3a 30 29 2c 5b 65 5d 29 3b 69 66 28 21 +=1:0),[e]);if(!
00036ea0: 69 3f 2e 69 73 56 61 6c 69 64 29 72 65 74 75 72 i?.isValid)retur
00036eb0: 6e 20 6e 75 6c 6c 3b 63 6f 6e 73 74 20 63 3d 50 n null;const c=P
00036ec0: 62 5b 65 2e 70 72 6f 70 73 2e 73 69 7a 65 5d 2a b[e.props.size]*
00036ed0: 65 2e 70 72 6f 70 73 2e 73 63 61 6c 65 2c 75 3d e.props.scale,u=
00036ee0: 69 2e 73 74 61 72 74 2e 61 72 72 6f 77 68 65 61 i.start.arrowhea
00036ef0: 64 26 26 6b 76 28 69 2c 22 73 74 61 72 74 22 2c d&&kv(i,"start",
00036f00: 63 29 2c 64 3d 69 2e 65 6e 64 2e 61 72 72 6f 77 c),d=i.end.arrow
00036f10: 68 65 61 64 26 26 6b 76 28 69 2c 22 65 6e 64 22 head&&kv(i,"end"
00036f20: 2c 63 29 2c 70 3d 69 2e 69 73 53 74 72 61 69 67 ,c),p=i.isStraig
00036f30: 68 74 3f 4e 76 28 69 29 3a 49 76 28 69 29 3b 6c ht?Nv(i):Iv(i);l
00036f40: 65 74 20 66 3d 6e 75 6c 6c 3b 69 66 28 74 29 7b et f=null;if(t){
00036f50: 63 6f 6e 73 74 20 74 3d 32 2f 6e 2e 67 65 74 5a const t=2/n.getZ
00036f60: 6f 6f 6d 4c 65 76 65 6c 28 29 2c 7b 73 74 72 6f oomLevel(),{stro
00036f70: 6b 65 44 61 73 68 61 72 72 61 79 3a 72 2c 73 74 keDasharray:r,st
00036f80: 72 6f 6b 65 44 61 73 68 6f 66 66 73 65 74 3a 6f rokeDashoffset:o
00036f90: 7d 3d 79 76 28 66 75 6e 63 74 69 6f 6e 28 65 2c }=yv(function(e,
00036fa0: 74 29 7b 63 6f 6e 73 74 20 6e 3d 76 62 28 65 2c t){const n=vb(e,
00036fb0: 74 29 3b 72 65 74 75 72 6e 20 6e 2e 69 73 53 74 t);return n.isSt
00036fc0: 72 61 69 67 68 74 3f 73 75 2e 44 69 73 74 28 6e raight?su.Dist(n
00036fd0: 2e 73 74 61 72 74 2e 68 61 6e 64 6c 65 2c 6e 2e .start.handle,n.
00036fe0: 65 6e 64 2e 68 61 6e 64 6c 65 29 3a 4d 61 74 68 end.handle):Math
00036ff0: 2e 61 62 73 28 6e 2e 68 61 6e 64 6c 65 41 72 63 .abs(n.handleArc
00037000: 2e 6c 65 6e 67 74 68 29 7d 28 6e 2c 65 29 2c 74 .length)}(n,e),t
00037010: 2c 7b 65 6e 64 3a 22 73 6b 69 70 22 2c 73 74 61 ,{end:"skip",sta
00037020: 72 74 3a 22 73 6b 69 70 22 2c 6c 65 6e 67 74 68 rt:"skip",length
00037030: 52 61 74 69 6f 3a 32 2e 35 7d 29 3b 66 3d 73 2e Ratio:2.5});f=s.
00037040: 73 74 61 72 74 7c 7c 73 2e 65 6e 64 3f 28 30 2c start||s.end?(0,
00037050: 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 2c 7b Qc.jsx)("path",{
00037060: 63 6c 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 61 72 className:"tl-ar
00037070: 72 6f 77 2d 68 69 6e 74 22 2c 64 3a 69 2e 69 73 row-hint",d:i.is
00037080: 53 74 72 61 69 67 68 74 3f 4f 76 28 69 29 3a 41 Straight?Ov(i):A
00037090: 76 28 69 29 2c 73 74 72 6f 6b 65 44 61 73 68 61 v(i),strokeDasha
000370a0: 72 72 61 79 3a 72 2c 73 74 72 6f 6b 65 44 61 73 rray:r,strokeDas
000370b0: 68 6f 66 66 73 65 74 3a 6f 2c 73 74 72 6f 6b 65 hoffset:o,stroke
000370c0: 57 69 64 74 68 3a 74 2c 6d 61 72 6b 65 72 53 74 Width:t,markerSt
000370d0: 61 72 74 3a 73 2e 73 74 61 72 74 3f 73 2e 73 74 art:s.start?s.st
000370e0: 61 72 74 2e 70 72 6f 70 73 2e 69 73 45 78 61 63 art.props.isExac
000370f0: 74 3f 22 22 3a 73 2e 73 74 61 72 74 2e 70 72 6f t?"":s.start.pro
00037100: 70 73 2e 69 73 50 72 65 63 69 73 65 3f 22 75 72 ps.isPrecise?"ur
00037110: 6c 28 23 61 72 72 6f 77 68 65 61 64 2d 63 72 6f l(#arrowhead-cro
00037120: 73 73 29 22 3a 22 75 72 6c 28 23 61 72 72 6f 77 ss)":"url(#arrow
00037130: 68 65 61 64 2d 64 6f 74 29 22 3a 22 22 2c 6d 61 head-dot)":"",ma
00037140: 72 6b 65 72 45 6e 64 3a 73 2e 65 6e 64 3f 73 2e rkerEnd:s.end?s.
00037150: 65 6e 64 2e 70 72 6f 70 73 2e 69 73 45 78 61 63 end.props.isExac
00037160: 74 3f 22 22 3a 73 2e 65 6e 64 2e 70 72 6f 70 73 t?"":s.end.props
00037170: 2e 69 73 50 72 65 63 69 73 65 3f 22 75 72 6c 28 .isPrecise?"url(
00037180: 23 61 72 72 6f 77 68 65 61 64 2d 63 72 6f 73 73 #arrowhead-cross
00037190: 29 22 3a 22 75 72 6c 28 23 61 72 72 6f 77 68 65 )":"url(#arrowhe
000371a0: 61 64 2d 64 6f 74 29 22 3a 22 22 2c 6f 70 61 63 ad-dot)":"",opac
000371b0: 69 74 79 3a 2e 31 36 7d 29 3a 6e 75 6c 6c 7d 63 ity:.16}):null}c
000371c0: 6f 6e 73 74 7b 73 74 72 6f 6b 65 44 61 73 68 61 onst{strokeDasha
000371d0: 72 72 61 79 3a 68 2c 73 74 72 6f 6b 65 44 61 73 rray:h,strokeDas
000371e0: 68 6f 66 66 73 65 74 3a 6d 7d 3d 79 76 28 69 2e hoffset:m}=yv(i.
000371f0: 69 73 53 74 72 61 69 67 68 74 3f 69 2e 6c 65 6e isStraight?i.len
00037200: 67 74 68 3a 4d 61 74 68 2e 61 62 73 28 69 2e 62 gth:Math.abs(i.b
00037210: 6f 64 79 41 72 63 2e 6c 65 6e 67 74 68 29 2c 63 odyArc.length),c
00037220: 2c 7b 73 74 79 6c 65 3a 65 2e 70 72 6f 70 73 2e ,{style:e.props.
00037230: 64 61 73 68 7d 29 2c 67 3d 45 76 28 6e 2c 65 29 dash}),g=Ev(n,e)
00037240: 2c 62 3d 21 28 22 6e 6f 6e 65 22 3d 3d 3d 69 2e ,b=!("none"===i.
00037250: 73 74 61 72 74 2e 61 72 72 6f 77 68 65 61 64 7c start.arrowhead|
00037260: 7c 22 61 72 72 6f 77 22 3d 3d 3d 69 2e 73 74 61 |"arrow"===i.sta
00037270: 72 74 2e 61 72 72 6f 77 68 65 61 64 29 2c 79 3d rt.arrowhead),y=
00037280: 21 28 22 6e 6f 6e 65 22 3d 3d 3d 69 2e 65 6e 64 !("none"===i.end
00037290: 2e 61 72 72 6f 77 68 65 61 64 7c 7c 22 61 72 72 .arrowhead||"arr
000372a0: 6f 77 22 3d 3d 3d 69 2e 65 6e 64 2e 61 72 72 6f ow"===i.end.arro
000372b0: 77 68 65 61 64 29 2c 76 3d 28 65 2e 69 64 2b 22 whead),v=(e.id+"
000372c0: 5f 63 6c 69 70 5f 22 2b 6c 29 2e 72 65 70 6c 61 _clip_"+l).repla
000372d0: 63 65 28 22 3a 22 2c 22 5f 22 29 3b 72 65 74 75 ce(":","_");retu
000372e0: 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 51 63 rn(0,Qc.jsxs)(Qc
000372f0: 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 6c 64 .Fragment,{child
00037300: 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 28 ren:[(0,Qc.jsx)(
00037310: 22 64 65 66 73 22 2c 7b 63 68 69 6c 64 72 65 6e "defs",{children
00037320: 3a 28 30 2c 51 63 2e 6a 73 78 73 29 28 22 6d 61 :(0,Qc.jsxs)("ma
00037330: 73 6b 22 2c 7b 69 64 3a 76 2c 63 68 69 6c 64 72 sk",{id:v,childr
00037340: 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 28 22 en:[(0,Qc.jsx)("
00037350: 72 65 63 74 22 2c 7b 78 3a 4e 75 28 2d 31 30 30 rect",{x:Nu(-100
00037360: 2b 61 2e 6d 69 6e 58 29 2c 79 3a 4e 75 28 2d 31 +a.minX),y:Nu(-1
00037370: 30 30 2b 61 2e 6d 69 6e 59 29 2c 77 69 64 74 68 00+a.minY),width
00037380: 3a 4e 75 28 61 2e 77 69 64 74 68 2b 32 30 30 29 :Nu(a.width+200)
00037390: 2c 68 65 69 67 68 74 3a 4e 75 28 61 2e 68 65 69 ,height:Nu(a.hei
000373a0: 67 68 74 2b 32 30 30 29 2c 66 69 6c 6c 3a 22 77 ght+200),fill:"w
000373b0: 68 69 74 65 22 7d 29 2c 65 2e 70 72 6f 70 73 2e hite"}),e.props.
000373c0: 74 65 78 74 2e 74 72 69 6d 28 29 26 26 28 30 2c text.trim()&&(0,
000373d0: 51 63 2e 6a 73 78 29 28 22 72 65 63 74 22 2c 7b Qc.jsx)("rect",{
000373e0: 78 3a 67 2e 62 6f 78 2e 78 2c 79 3a 67 2e 62 6f x:g.box.x,y:g.bo
000373f0: 78 2e 79 2c 77 69 64 74 68 3a 67 2e 62 6f 78 2e x.y,width:g.box.
00037400: 77 2c 68 65 69 67 68 74 3a 67 2e 62 6f 78 2e 68 w,height:g.box.h
00037410: 2c 66 69 6c 6c 3a 22 62 6c 61 63 6b 22 2c 72 78 ,fill:"black",rx
00037420: 3a 34 2c 72 79 3a 34 7d 29 2c 75 26 26 62 26 26 :4,ry:4}),u&&b&&
00037430: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 (0,Qc.jsx)("path
00037440: 22 2c 7b 64 3a 75 2c 66 69 6c 6c 3a 22 61 72 72 ",{d:u,fill:"arr
00037450: 6f 77 22 3d 3d 3d 69 2e 73 74 61 72 74 2e 61 72 ow"===i.start.ar
00037460: 72 6f 77 68 65 61 64 3f 22 6e 6f 6e 65 22 3a 22 rowhead?"none":"
00037470: 62 6c 61 63 6b 22 2c 73 74 72 6f 6b 65 3a 22 6e black",stroke:"n
00037480: 6f 6e 65 22 7d 29 2c 64 26 26 79 26 26 28 30 2c one"}),d&&y&&(0,
00037490: 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 2c 7b Qc.jsx)("path",{
000374a0: 64 2c 66 69 6c 6c 3a 22 61 72 72 6f 77 22 3d 3d d,fill:"arrow"==
000374b0: 3d 69 2e 65 6e 64 2e 61 72 72 6f 77 68 65 61 64 =i.end.arrowhead
000374c0: 3f 22 6e 6f 6e 65 22 3a 22 62 6c 61 63 6b 22 2c ?"none":"black",
000374d0: 73 74 72 6f 6b 65 3a 22 6e 6f 6e 65 22 7d 29 5d stroke:"none"})]
000374e0: 7d 29 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 73 29 })}),(0,Qc.jsxs)
000374f0: 28 22 67 22 2c 7b 66 69 6c 6c 3a 22 6e 6f 6e 65 ("g",{fill:"none
00037500: 22 2c 73 74 72 6f 6b 65 3a 72 5b 65 2e 70 72 6f ",stroke:r[e.pro
00037510: 70 73 2e 63 6f 6c 6f 72 5d 2e 73 6f 6c 69 64 2c ps.color].solid,
00037520: 73 74 72 6f 6b 65 57 69 64 74 68 3a 63 2c 73 74 strokeWidth:c,st
00037530: 72 6f 6b 65 4c 69 6e 65 6a 6f 69 6e 3a 22 72 6f rokeLinejoin:"ro
00037540: 75 6e 64 22 2c 73 74 72 6f 6b 65 4c 69 6e 65 63 und",strokeLinec
00037550: 61 70 3a 22 72 6f 75 6e 64 22 2c 70 6f 69 6e 74 ap:"round",point
00037560: 65 72 45 76 65 6e 74 73 3a 22 6e 6f 6e 65 22 2c erEvents:"none",
00037570: 63 68 69 6c 64 72 65 6e 3a 5b 66 2c 28 30 2c 51 children:[f,(0,Q
00037580: 63 2e 6a 73 78 73 29 28 22 67 22 2c 7b 6d 61 73 c.jsxs)("g",{mas
00037590: 6b 3a 60 75 72 6c 28 23 24 7b 76 7d 29 60 2c 63 k:`url(#${v})`,c
000375a0: 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a hildren:[(0,Qc.j
000375b0: 73 78 29 28 22 72 65 63 74 22 2c 7b 78 3a 4e 75 sx)("rect",{x:Nu
000375c0: 28 61 2e 6d 69 6e 58 2d 31 30 30 29 2c 79 3a 4e (a.minX-100),y:N
000375d0: 75 28 61 2e 6d 69 6e 59 2d 31 30 30 29 2c 77 69 u(a.minY-100),wi
000375e0: 64 74 68 3a 4e 75 28 61 2e 77 69 64 74 68 2b 32 dth:Nu(a.width+2
000375f0: 30 30 29 2c 68 65 69 67 68 74 3a 4e 75 28 61 2e 00),height:Nu(a.
00037600: 68 65 69 67 68 74 2b 32 30 30 29 2c 6f 70 61 63 height+200),opac
00037610: 69 74 79 3a 30 7d 29 2c 28 30 2c 51 63 2e 6a 73 ity:0}),(0,Qc.js
00037620: 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 70 2c 73 x)("path",{d:p,s
00037630: 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 3a 68 trokeDasharray:h
00037640: 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 65 ,strokeDashoffse
00037650: 74 3a 6d 7d 29 5d 7d 29 2c 75 26 26 62 26 26 22 t:m})]}),u&&b&&"
00037660: 6e 6f 6e 65 22 21 3d 3d 65 2e 70 72 6f 70 73 2e none"!==e.props.
00037670: 66 69 6c 6c 26 26 28 30 2c 51 63 2e 6a 73 78 29 fill&&(0,Qc.jsx)
00037680: 28 70 76 2c 7b 74 68 65 6d 65 3a 72 2c 64 3a 75 (pv,{theme:r,d:u
00037690: 2c 63 6f 6c 6f 72 3a 65 2e 70 72 6f 70 73 2e 63 ,color:e.props.c
000376a0: 6f 6c 6f 72 2c 66 69 6c 6c 3a 65 2e 70 72 6f 70 olor,fill:e.prop
000376b0: 73 2e 66 69 6c 6c 2c 73 63 61 6c 65 3a 65 2e 70 s.fill,scale:e.p
000376c0: 72 6f 70 73 2e 73 63 61 6c 65 7d 29 2c 64 26 26 rops.scale}),d&&
000376d0: 79 26 26 22 6e 6f 6e 65 22 21 3d 3d 65 2e 70 72 y&&"none"!==e.pr
000376e0: 6f 70 73 2e 66 69 6c 6c 26 26 28 30 2c 51 63 2e ops.fill&&(0,Qc.
000376f0: 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 3a 72 jsx)(pv,{theme:r
00037700: 2c 64 2c 63 6f 6c 6f 72 3a 65 2e 70 72 6f 70 73 ,d,color:e.props
00037710: 2e 63 6f 6c 6f 72 2c 66 69 6c 6c 3a 65 2e 70 72 .color,fill:e.pr
00037720: 6f 70 73 2e 66 69 6c 6c 2c 73 63 61 6c 65 3a 65 ops.fill,scale:e
00037730: 2e 70 72 6f 70 73 2e 73 63 61 6c 65 7d 29 2c 75 .props.scale}),u
00037740: 26 26 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 &&(0,Qc.jsx)("pa
00037750: 74 68 22 2c 7b 64 3a 75 7d 29 2c 64 26 26 28 30 th",{d:u}),d&&(0
00037760: 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 2c ,Qc.jsx)("path",
00037770: 7b 64 7d 29 5d 7d 29 5d 7d 29 7d 29 29 2c 44 76 {d})]})]})})),Dv
00037780: 3d 6e 65 77 20 57 65 61 6b 4d 61 70 3b 66 75 6e =new WeakMap;fun
00037790: 63 74 69 6f 6e 20 4c 76 28 29 7b 72 65 74 75 72 ction Lv(){retur
000377a0: 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 6d 61 72 n(0,Qc.jsx)("mar
000377b0: 6b 65 72 22 2c 7b 69 64 3a 22 61 72 72 6f 77 68 ker",{id:"arrowh
000377c0: 65 61 64 2d 64 6f 74 22 2c 63 6c 61 73 73 4e 61 ead-dot",classNa
000377d0: 6d 65 3a 22 74 6c 2d 61 72 72 6f 77 2d 68 69 6e me:"tl-arrow-hin
000377e0: 74 22 2c 72 65 66 58 3a 22 33 2e 30 22 2c 72 65 t",refX:"3.0",re
000377f0: 66 59 3a 22 33 2e 30 22 2c 6f 72 69 65 6e 74 3a fY:"3.0",orient:
00037800: 22 30 22 2c 63 68 69 6c 64 72 65 6e 3a 28 30 2c "0",children:(0,
00037810: 51 63 2e 6a 73 78 29 28 22 63 69 72 63 6c 65 22 Qc.jsx)("circle"
00037820: 2c 7b 63 78 3a 22 33 22 2c 63 79 3a 22 33 22 2c ,{cx:"3",cy:"3",
00037830: 72 3a 22 32 22 2c 73 74 72 6f 6b 65 44 61 73 68 r:"2",strokeDash
00037840: 61 72 72 61 79 3a 22 31 30 30 25 22 7d 29 7d 29 array:"100%"})})
00037850: 7d 66 75 6e 63 74 69 6f 6e 20 46 76 28 29 7b 72 }function Fv(){r
00037860: 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 eturn(0,Qc.jsxs)
00037870: 28 22 6d 61 72 6b 65 72 22 2c 7b 69 64 3a 22 61 ("marker",{id:"a
00037880: 72 72 6f 77 68 65 61 64 2d 63 72 6f 73 73 22 2c rrowhead-cross",
00037890: 63 6c 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 61 72 className:"tl-ar
000378a0: 72 6f 77 2d 68 69 6e 74 22 2c 72 65 66 58 3a 22 row-hint",refX:"
000378b0: 33 2e 30 22 2c 72 65 66 59 3a 22 33 2e 30 22 2c 3.0",refY:"3.0",
000378c0: 6f 72 69 65 6e 74 3a 22 61 75 74 6f 22 2c 63 68 orient:"auto",ch
000378d0: 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 ildren:[(0,Qc.js
000378e0: 78 29 28 22 6c 69 6e 65 22 2c 7b 78 31 3a 22 31 x)("line",{x1:"1
000378f0: 2e 35 22 2c 79 31 3a 22 31 2e 35 22 2c 78 32 3a .5",y1:"1.5",x2:
00037900: 22 34 2e 35 22 2c 79 32 3a 22 34 2e 35 22 2c 73 "4.5",y2:"4.5",s
00037910: 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 3a 22 trokeDasharray:"
00037920: 31 30 30 25 22 7d 29 2c 28 30 2c 51 63 2e 6a 73 100%"}),(0,Qc.js
00037930: 78 29 28 22 6c 69 6e 65 22 2c 7b 78 31 3a 22 31 x)("line",{x1:"1
00037940: 2e 35 22 2c 79 31 3a 22 34 2e 35 22 2c 78 32 3a .5",y1:"4.5",x2:
00037950: 22 34 2e 35 22 2c 79 32 3a 22 31 2e 35 22 2c 73 "4.5",y2:"1.5",s
00037960: 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 3a 22 trokeDasharray:"
00037970: 31 30 30 25 22 7d 29 5d 7d 29 7d 63 6f 6e 73 74 100%"})]})}const
00037980: 20 6a 76 3d 22 64 61 74 61 3a 69 6d 61 67 65 2f jv="data:image/
00037990: 73 76 67 2b 78 6d 6c 2c 25 33 43 73 76 67 20 78 svg+xml,%3Csvg x
000379a0: 6d 6c 6e 73 3d 27 68 74 74 70 3a 2f 2f 77 77 77 mlns='http://www
000379b0: 2e 77 33 2e 6f 72 67 2f 32 30 30 30 2f 73 76 67 .w3.org/2000/svg
000379c0: 27 20 77 69 64 74 68 3d 27 33 30 27 20 68 65 69 ' width='30' hei
000379d0: 67 68 74 3d 27 33 30 27 20 66 69 6c 6c 3d 27 6e ght='30' fill='n
000379e0: 6f 6e 65 27 25 33 45 25 33 43 70 61 74 68 20 73 one'%3E%3Cpath s
000379f0: 74 72 6f 6b 65 3d 27 25 32 33 30 30 30 27 20 73 troke='%23000' s
00037a00: 74 72 6f 6b 65 2d 6c 69 6e 65 63 61 70 3d 27 72 troke-linecap='r
00037a10: 6f 75 6e 64 27 20 73 74 72 6f 6b 65 2d 6c 69 6e ound' stroke-lin
00037a20: 65 6a 6f 69 6e 3d 27 72 6f 75 6e 64 27 20 73 74 ejoin='round' st
00037a30: 72 6f 6b 65 2d 77 69 64 74 68 3d 27 32 27 20 64 roke-width='2' d
00037a40: 3d 27 4d 31 33 20 35 48 37 61 32 20 32 20 30 20 ='M13 5H7a2 2 0
00037a50: 30 20 30 2d 32 20 32 76 31 36 61 32 20 32 20 30 0 0-2 2v16a2 2 0
00037a60: 20 30 20 30 20 32 20 32 68 31 36 61 32 20 32 20 0 0 2 2h16a2 2
00037a70: 30 20 30 20 30 20 32 2d 32 76 2d 36 4d 31 39 20 0 0 0 2-2v-6M19
00037a80: 35 68 36 6d 30 20 30 76 36 6d 30 2d 36 4c 31 33 5h6m0 0v6m0-6L13
00037a90: 20 31 37 27 2f 25 33 45 25 33 43 2f 73 76 67 25 17'/%3E%3C/svg%
00037aa0: 33 45 22 3b 66 75 6e 63 74 69 6f 6e 20 42 76 28 3E";function Bv(
00037ab0: 7b 75 72 6c 3a 65 2c 7a 6f 6f 6d 4c 65 76 65 6c {url:e,zoomLevel
00037ac0: 3a 74 7d 29 7b 72 65 74 75 72 6e 28 30 2c 51 63 :t}){return(0,Qc
00037ad0: 2e 6a 73 78 29 28 22 61 22 2c 7b 63 6c 61 73 73 .jsx)("a",{class
00037ae0: 4e 61 6d 65 3a 4a 63 28 22 74 6c 2d 68 79 70 65 Name:Jc("tl-hype
00037af0: 72 6c 69 6e 6b 2d 62 75 74 74 6f 6e 22 2c 7b 22 rlink-button",{"
00037b00: 74 6c 2d 68 79 70 65 72 6c 69 6e 6b 2d 62 75 74 tl-hyperlink-but
00037b10: 74 6f 6e 5f 5f 68 69 64 64 65 6e 22 3a 74 3c 2e ton__hidden":t<.
00037b20: 33 32 7d 29 2c 68 72 65 66 3a 65 2c 74 61 72 67 32}),href:e,targ
00037b30: 65 74 3a 22 5f 62 6c 61 6e 6b 22 2c 72 65 6c 3a et:"_blank",rel:
00037b40: 22 6e 6f 6f 70 65 6e 65 72 20 6e 6f 72 65 66 65 "noopener norefe
00037b50: 72 72 65 72 22 2c 6f 6e 50 6f 69 6e 74 65 72 44 rrer",onPointerD
00037b60: 6f 77 6e 3a 6e 64 2c 6f 6e 50 6f 69 6e 74 65 72 own:nd,onPointer
00037b70: 55 70 3a 6e 64 2c 74 69 74 6c 65 3a 65 2c 64 72 Up:nd,title:e,dr
00037b80: 61 67 67 61 62 6c 65 3a 21 31 2c 63 68 69 6c 64 aggable:!1,child
00037b90: 72 65 6e 3a 28 30 2c 51 63 2e 6a 73 78 29 28 22 ren:(0,Qc.jsx)("
00037ba0: 64 69 76 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a div",{className:
00037bb0: 22 74 6c 2d 68 79 70 65 72 6c 69 6e 6b 5f 5f 69 "tl-hyperlink__i
00037bc0: 63 6f 6e 22 2c 73 74 79 6c 65 3a 7b 6d 61 73 6b con",style:{mask
00037bd0: 3a 60 75 72 6c 28 22 24 7b 6a 76 7d 22 29 20 63 :`url("${jv}") c
00037be0: 65 6e 74 65 72 20 31 30 30 25 20 2f 20 31 30 30 enter 100% / 100
00037bf0: 25 20 6e 6f 2d 72 65 70 65 61 74 60 2c 57 65 62 % no-repeat`,Web
00037c00: 6b 69 74 4d 61 73 6b 3a 60 75 72 6c 28 22 24 7b kitMask:`url("${
00037c10: 6a 76 7d 22 29 20 63 65 6e 74 65 72 20 31 30 30 jv}") center 100
00037c20: 25 20 2f 20 31 30 30 25 20 6e 6f 2d 72 65 70 65 % / 100% no-repe
00037c30: 61 74 60 7d 7d 29 7d 29 7d 63 6f 6e 73 74 20 55 at`}})})}const U
00037c40: 76 3d 22 64 61 74 61 3a 69 6d 61 67 65 2f 73 76 v="data:image/sv
00037c50: 67 2b 78 6d 6c 2c 25 33 43 73 76 67 20 78 6d 6c g+xml,%3Csvg xml
00037c60: 6e 73 3d 27 68 74 74 70 3a 2f 2f 77 77 77 2e 77 ns='http://www.w
00037c70: 33 2e 6f 72 67 2f 32 30 30 30 2f 73 76 67 27 20 3.org/2000/svg'
00037c80: 77 69 64 74 68 3d 27 33 30 27 20 68 65 69 67 68 width='30' heigh
00037c90: 74 3d 27 33 30 27 20 66 69 6c 6c 3d 27 6e 6f 6e t='30' fill='non
00037ca0: 65 27 25 33 45 25 33 43 70 61 74 68 20 73 74 72 e'%3E%3Cpath str
00037cb0: 6f 6b 65 3d 27 25 32 33 30 30 30 27 20 73 74 72 oke='%23000' str
00037cc0: 6f 6b 65 2d 6c 69 6e 65 63 61 70 3d 27 72 6f 75 oke-linecap='rou
00037cd0: 6e 64 27 20 73 74 72 6f 6b 65 2d 6c 69 6e 65 6a nd' stroke-linej
00037ce0: 6f 69 6e 3d 27 72 6f 75 6e 64 27 20 73 74 72 6f oin='round' stro
00037cf0: 6b 65 2d 77 69 64 74 68 3d 27 32 27 20 64 3d 27 ke-width='2' d='
00037d00: 4d 31 33 20 35 48 37 61 32 20 32 20 30 20 30 20 M13 5H7a2 2 0 0
00037d10: 30 2d 32 20 32 76 31 36 61 32 20 32 20 30 20 30 0-2 2v16a2 2 0 0
00037d20: 20 30 20 32 20 32 68 31 36 61 32 20 32 20 30 20 0 2 2h16a2 2 0
00037d30: 30 20 30 20 32 2d 32 76 2d 36 4d 31 39 20 35 68 0 0 2-2v-6M19 5h
00037d40: 36 6d 30 20 30 76 36 6d 30 2d 36 4c 31 33 20 31 6m0 0v6m0-6L13 1
00037d50: 37 27 2f 25 33 45 25 33 43 2f 73 76 67 25 33 45 7'/%3E%3C/svg%3E
00037d60: 22 2c 7a 76 3d 5b 7b 6f 66 66 73 65 74 58 3a 30 ",zv=[{offsetX:0
00037d70: 2c 6f 66 66 73 65 74 59 3a 32 2c 62 6c 75 72 3a ,offsetY:2,blur:
00037d80: 34 2c 73 70 72 65 61 64 3a 30 2c 63 6f 6c 6f 72 4,spread:0,color
00037d90: 3a 22 23 30 30 30 30 30 30 32 39 22 7d 2c 7b 6f :"#00000029"},{o
00037da0: 66 66 73 65 74 58 3a 30 2c 6f 66 66 73 65 74 59 ffsetX:0,offsetY
00037db0: 3a 33 2c 62 6c 75 72 3a 36 2c 73 70 72 65 61 64 :3,blur:6,spread
00037dc0: 3a 30 2c 63 6f 6c 6f 72 3a 22 23 30 30 30 30 30 :0,color:"#00000
00037dd0: 30 31 66 22 7d 5d 3b 66 75 6e 63 74 69 6f 6e 20 01f"}];function
00037de0: 47 76 28 65 29 7b 72 65 74 75 72 6e 20 7a 76 2e Gv(e){return zv.
00037df0: 6d 61 70 28 28 74 3d 3e 7b 63 6f 6e 73 74 7b 6f map((t=>{const{o
00037e00: 66 66 73 65 74 58 3a 6e 2c 6f 66 66 73 65 74 59 ffsetX:n,offsetY
00037e10: 3a 72 2c 62 6c 75 72 3a 6f 2c 73 70 72 65 61 64 :r,blur:o,spread
00037e20: 3a 69 2c 63 6f 6c 6f 72 3a 61 7d 3d 74 2c 73 3d :i,color:a}=t,s=
00037e30: 6e 65 77 20 73 75 28 6e 2c 72 29 2c 7b 78 3a 6c new su(n,r),{x:l
00037e40: 2c 79 3a 63 7d 3d 73 2e 72 6f 74 28 2d 65 29 3b ,y:c}=s.rot(-e);
00037e50: 72 65 74 75 72 6e 60 24 7b 6c 7d 70 78 20 24 7b return`${l}px ${
00037e60: 63 7d 70 78 20 24 7b 6f 7d 70 78 20 24 7b 69 7d c}px ${o}px ${i}
00037e70: 70 78 20 24 7b 61 7d 60 7d 29 29 2e 6a 6f 69 6e px ${a}`})).join
00037e80: 28 22 2c 20 22 29 7d 63 6f 6e 73 74 20 48 76 3d (", ")}const Hv=
00037e90: 33 32 30 2c 56 76 3d 34 36 2c 71 76 3d 31 30 31 320,Vv=46,qv=101
00037ea0: 3b 66 75 6e 63 74 69 6f 6e 20 57 76 28 65 2c 74 ;function Wv(e,t
00037eb0: 29 7b 63 6f 6e 73 74 20 6e 3d 74 2e 70 72 6f 70 ){const n=t.prop
00037ec0: 73 2e 61 73 73 65 74 49 64 3f 65 2e 67 65 74 41 s.assetId?e.getA
00037ed0: 73 73 65 74 28 74 2e 70 72 6f 70 73 2e 61 73 73 sset(t.props.ass
00037ee0: 65 74 49 64 29 3a 6e 75 6c 6c 3b 6c 65 74 20 72 etId):null;let r
00037ef0: 3d 48 76 3b 72 65 74 75 72 6e 20 6e 26 26 28 6e =Hv;return n&&(n
00037f00: 2e 70 72 6f 70 73 2e 69 6d 61 67 65 7c 7c 28 72 .props.image||(r
00037f10: 3d 6e 2e 70 72 6f 70 73 2e 74 69 74 6c 65 3f 71 =n.props.title?q
00037f20: 76 3a 56 76 29 29 2c 7b 2e 2e 2e 74 2c 70 72 6f v:Vv)),{...t,pro
00037f30: 70 73 3a 7b 2e 2e 2e 74 2e 70 72 6f 70 73 2c 68 ps:{...t.props,h
00037f40: 3a 72 7d 7d 7d 63 6f 6e 73 74 20 4b 76 3d 65 3d :r}}}const Kv=e=
00037f50: 3e 7b 74 72 79 7b 72 65 74 75 72 6e 20 6e 65 77 >{try{return new
00037f60: 20 55 52 4c 28 65 2e 70 72 6f 70 73 2e 75 72 6c URL(e.props.url
00037f70: 29 2e 68 6f 73 74 6e 61 6d 65 2e 72 65 70 6c 61 ).hostname.repla
00037f80: 63 65 28 2f 5e 77 77 77 5c 2e 2f 2c 22 22 29 7d ce(/^www\./,"")}
00037f90: 63 61 74 63 68 28 74 29 7b 72 65 74 75 72 6e 20 catch(t){return
00037fa0: 65 2e 70 72 6f 70 73 2e 75 72 6c 7d 7d 3b 63 6f e.props.url}};co
00037fb0: 6e 73 74 20 59 76 3d 59 72 28 28 61 73 79 6e 63 nst Yv=Yr((async
00037fc0: 28 65 2c 74 29 3d 3e 7b 69 66 28 65 2e 69 73 44 (e,t)=>{if(e.isD
00037fd0: 69 73 70 6f 73 65 64 29 72 65 74 75 72 6e 3b 63 isposed)return;c
00037fe0: 6f 6e 73 74 7b 75 72 6c 3a 6e 7d 3d 74 2e 70 72 onst{url:n}=t.pr
00037ff0: 6f 70 73 2c 72 3d 61 77 61 69 74 20 65 2e 67 65 ops,r=await e.ge
00038000: 74 41 73 73 65 74 46 6f 72 45 78 74 65 72 6e 61 tAssetForExterna
00038010: 6c 43 6f 6e 74 65 6e 74 28 7b 74 79 70 65 3a 22 lContent({type:"
00038020: 75 72 6c 22 2c 75 72 6c 3a 6e 7d 29 3b 72 26 26 url",url:n});r&&
00038030: 65 2e 62 61 74 63 68 28 28 28 29 3d 3e 7b 65 2e e.batch((()=>{e.
00038040: 63 72 65 61 74 65 41 73 73 65 74 73 28 5b 72 5d createAssets([r]
00038050: 29 2c 65 2e 75 70 64 61 74 65 53 68 61 70 65 73 ),e.updateShapes
00038060: 28 5b 7b 69 64 3a 74 2e 69 64 2c 74 79 70 65 3a ([{id:t.id,type:
00038070: 74 2e 74 79 70 65 2c 70 72 6f 70 73 3a 7b 61 73 t.type,props:{as
00038080: 73 65 74 49 64 3a 72 2e 69 64 7d 7d 5d 29 7d 29 setId:r.id}}])})
00038090: 29 7d 29 2c 35 30 30 29 3b 66 75 6e 63 74 69 6f )}),500);functio
000380a0: 6e 20 58 76 28 65 2c 74 3d 21 31 29 7b 63 6f 6e n Xv(e,t=!1){con
000380b0: 73 74 20 6e 3d 65 2e 6c 65 6e 67 74 68 3b 69 66 st n=e.length;if
000380c0: 28 6e 3c 32 29 72 65 74 75 72 6e 22 22 3b 6c 65 (n<2)return"";le
000380d0: 74 20 72 3d 65 5b 30 5d 2e 70 6f 69 6e 74 2c 6f t r=e[0].point,o
000380e0: 3d 65 5b 31 5d 2e 70 6f 69 6e 74 3b 69 66 28 32 =e[1].point;if(2
000380f0: 3d 3d 3d 6e 29 72 65 74 75 72 6e 60 4d 24 7b 63 ===n)return`M${c
00038100: 75 28 72 29 7d 4c 24 7b 63 75 28 6f 29 7d 60 3b u(r)}L${cu(o)}`;
00038110: 6c 65 74 20 69 3d 22 22 3b 66 6f 72 28 6c 65 74 let i="";for(let
00038120: 20 74 3d 32 2c 61 3d 6e 2d 31 3b 74 3c 61 3b 74 t=2,a=n-1;t<a;t
00038130: 2b 2b 29 72 3d 65 5b 74 5d 2e 70 6f 69 6e 74 2c ++)r=e[t].point,
00038140: 6f 3d 65 5b 74 2b 31 5d 2e 70 6f 69 6e 74 2c 69 o=e[t+1].point,i
00038150: 2b 3d 75 75 28 72 2c 6f 29 3b 72 65 74 75 72 6e +=uu(r,o);return
00038160: 20 74 3f 60 4d 24 7b 75 75 28 65 5b 30 5d 2e 70 t?`M${uu(e[0].p
00038170: 6f 69 6e 74 2c 65 5b 31 5d 2e 70 6f 69 6e 74 29 oint,e[1].point)
00038180: 7d 51 24 7b 63 75 28 65 5b 31 5d 2e 70 6f 69 6e }Q${cu(e[1].poin
00038190: 74 29 7d 24 7b 75 75 28 65 5b 31 5d 2e 70 6f 69 t)}${uu(e[1].poi
000381a0: 6e 74 2c 65 5b 32 5d 2e 70 6f 69 6e 74 29 7d 54 nt,e[2].point)}T
000381b0: 24 7b 69 7d 24 7b 75 75 28 65 5b 6e 2d 31 5d 2e ${i}${uu(e[n-1].
000381c0: 70 6f 69 6e 74 2c 65 5b 30 5d 2e 70 6f 69 6e 74 point,e[0].point
000381d0: 29 7d 24 7b 75 75 28 65 5b 30 5d 2e 70 6f 69 6e )}${uu(e[0].poin
000381e0: 74 2c 65 5b 31 5d 2e 70 6f 69 6e 74 29 7d 5a 60 t,e[1].point)}Z`
000381f0: 3a 60 4d 24 7b 63 75 28 65 5b 30 5d 2e 70 6f 69 :`M${cu(e[0].poi
00038200: 6e 74 29 7d 51 24 7b 63 75 28 65 5b 31 5d 2e 70 nt)}Q${cu(e[1].p
00038210: 6f 69 6e 74 29 7d 24 7b 75 75 28 65 5b 31 5d 2e oint)}${uu(e[1].
00038220: 70 6f 69 6e 74 2c 65 5b 32 5d 2e 70 6f 69 6e 74 point,e[2].point
00038230: 29 7d 24 7b 65 2e 6c 65 6e 67 74 68 3e 33 3f 22 )}${e.length>3?"
00038240: 54 22 3a 22 22 7d 24 7b 69 7d 4c 24 7b 63 75 28 T":""}${i}L${cu(
00038250: 65 5b 6e 2d 31 5d 2e 70 6f 69 6e 74 29 7d 60 7d e[n-1].point)}`}
00038260: 66 75 6e 63 74 69 6f 6e 20 5a 76 28 65 2c 74 3d function Zv(e,t=
00038270: 7b 7d 29 7b 63 6f 6e 73 74 7b 73 74 61 72 74 3a {}){const{start:
00038280: 6e 3d 7b 7d 2c 65 6e 64 3a 72 3d 7b 7d 7d 3d 74 n={},end:r={}}=t
00038290: 2c 7b 63 61 70 3a 6f 3d 21 30 7d 3d 6e 2c 7b 63 ,{cap:o=!0}=n,{c
000382a0: 61 70 3a 69 3d 21 30 7d 3d 72 3b 57 72 28 21 6e ap:i=!0}=r;Wr(!n
000382b0: 2e 74 61 70 65 72 26 26 21 72 2e 74 61 70 65 72 .taper&&!r.taper
000382c0: 2c 22 63 61 70 20 74 61 70 65 72 20 6e 6f 74 20 ,"cap taper not
000382d0: 73 75 70 70 6f 72 74 65 64 20 68 65 72 65 22 29 supported here")
000382e0: 2c 57 72 28 21 6e 2e 65 61 73 69 6e 67 26 26 21 ,Wr(!n.easing&&!
000382f0: 72 2e 65 61 73 69 6e 67 2c 22 63 61 70 20 65 61 r.easing,"cap ea
00038300: 73 69 6e 67 20 6e 6f 74 20 73 75 70 70 6f 72 74 sing not support
00038310: 65 64 20 68 65 72 65 22 29 2c 57 72 28 6f 26 26 ed here"),Wr(o&&
00038320: 69 2c 22 63 61 70 20 6d 75 73 74 20 62 65 20 74 i,"cap must be t
00038330: 72 75 65 22 29 3b 63 6f 6e 73 74 20 61 3d 4a 67 rue");const a=Jg
00038340: 28 65 2c 74 29 3b 74 62 28 61 2c 74 29 3b 63 6f (e,t);tb(a,t);co
00038350: 6e 73 74 20 73 3d 66 75 6e 63 74 69 6f 6e 28 65 nst s=function(e
00038360: 29 7b 69 66 28 65 2e 6c 65 6e 67 74 68 3c 3d 32 ){if(e.length<=2
00038370: 29 72 65 74 75 72 6e 5b 65 5d 3b 63 6f 6e 73 74 )return[e];const
00038380: 20 74 3d 5b 5d 3b 6c 65 74 20 6e 2c 72 2c 6f 2c t=[];let n,r,o,
00038390: 69 2c 61 2c 73 3d 5b 65 5b 30 5d 5d 2c 6c 3d 73 i,a,s=[e[0]],l=s
000383a0: 75 2e 53 75 62 28 65 5b 31 5d 2e 70 6f 69 6e 74 u.Sub(e[1].point
000383b0: 2c 65 5b 30 5d 2e 70 6f 69 6e 74 29 2e 75 6e 69 ,e[0].point).uni
000383c0: 28 29 3b 66 6f 72 28 6c 65 74 20 63 3d 31 2c 75 ();for(let c=1,u
000383d0: 3d 65 2e 6c 65 6e 67 74 68 3b 63 3c 75 2d 31 3b =e.length;c<u-1;
000383e0: 63 2b 2b 29 69 66 28 6f 3d 65 5b 63 2d 31 5d 2c c++)if(o=e[c-1],
000383f0: 69 3d 65 5b 63 5d 2c 61 3d 65 5b 63 2b 31 5d 2c i=e[c],a=e[c+1],
00038400: 6e 3d 73 75 2e 53 75 62 28 61 2e 70 6f 69 6e 74 n=su.Sub(a.point
00038410: 2c 69 2e 70 6f 69 6e 74 29 2e 75 6e 69 28 29 2c ,i.point).uni(),
00038420: 72 3d 73 75 2e 44 70 72 28 6c 2c 6e 29 2c 6c 3d r=su.Dpr(l,n),l=
00038430: 6e 2c 72 3c 2d 2e 38 29 7b 63 6f 6e 73 74 20 65 n,r<-.8){const e
00038440: 3d 7b 2e 2e 2e 69 2c 70 6f 69 6e 74 3a 69 2e 69 ={...i,point:i.i
00038450: 6e 70 75 74 7d 3b 73 2e 70 75 73 68 28 65 29 2c nput};s.push(e),
00038460: 74 2e 70 75 73 68 28 51 76 28 73 29 29 2c 73 3d t.push(Qv(s)),s=
00038470: 5b 65 5d 7d 65 6c 73 65 20 73 2e 70 75 73 68 28 [e]}else s.push(
00038480: 69 29 2c 72 3e 2e 37 7c 7c 28 73 75 2e 44 69 73 i),r>.7||(su.Dis
00038490: 74 32 28 6f 2e 70 6f 69 6e 74 2c 69 2e 70 6f 69 t2(o.point,i.poi
000384a0: 6e 74 29 2b 73 75 2e 44 69 73 74 32 28 69 2e 70 nt)+su.Dist2(i.p
000384b0: 6f 69 6e 74 2c 61 2e 70 6f 69 6e 74 29 29 2f 28 oint,a.point))/(
000384c0: 28 6f 2e 72 61 64 69 75 73 2b 69 2e 72 61 64 69 (o.radius+i.radi
000384d0: 75 73 2b 61 2e 72 61 64 69 75 73 29 2f 33 29 2a us+a.radius)/3)*
000384e0: 2a 32 3c 31 2e 35 26 26 28 73 2e 70 75 73 68 28 *2<1.5&&(s.push(
000384f0: 69 29 2c 74 2e 70 75 73 68 28 51 76 28 73 29 29 i),t.push(Qv(s))
00038500: 2c 73 3d 5b 69 5d 29 3b 72 65 74 75 72 6e 20 73 ,s=[i]);return s
00038510: 2e 70 75 73 68 28 65 5b 65 2e 6c 65 6e 67 74 68 .push(e[e.length
00038520: 2d 31 5d 29 2c 74 2e 70 75 73 68 28 51 76 28 73 -1]),t.push(Qv(s
00038530: 29 29 2c 74 7d 28 61 29 3b 6c 65 74 20 6c 3d 22 )),t}(a);let l="
00038540: 22 3b 66 6f 72 28 63 6f 6e 73 74 20 65 20 6f 66 ";for(const e of
00038550: 20 73 29 6c 2b 3d 4a 76 28 65 2c 74 29 3b 72 65 s)l+=Jv(e,t);re
00038560: 74 75 72 6e 20 6c 7d 66 75 6e 63 74 69 6f 6e 20 turn l}function
00038570: 51 76 28 65 29 7b 63 6f 6e 73 74 20 74 3d 65 5b Qv(e){const t=e[
00038580: 30 5d 3b 6c 65 74 20 6e 3b 66 6f 72 28 3b 65 2e 0];let n;for(;e.
00038590: 6c 65 6e 67 74 68 3e 32 26 26 28 6e 3d 65 5b 31 length>2&&(n=e[1
000385a0: 5d 2c 73 75 2e 44 69 73 74 32 28 74 2e 70 6f 69 ],su.Dist2(t.poi
000385b0: 6e 74 2c 6e 2e 70 6f 69 6e 74 29 3c 28 28 74 2e nt,n.point)<((t.
000385c0: 72 61 64 69 75 73 2b 6e 2e 72 61 64 69 75 73 29 radius+n.radius)
000385d0: 2f 32 2a 2e 35 29 2a 2a 32 29 3b 29 65 2e 73 70 /2*.5)**2);)e.sp
000385e0: 6c 69 63 65 28 31 2c 31 29 3b 63 6f 6e 73 74 20 lice(1,1);const
000385f0: 72 3d 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 5d 3b r=e[e.length-1];
00038600: 6c 65 74 20 6f 3b 66 6f 72 28 3b 65 2e 6c 65 6e let o;for(;e.len
00038610: 67 74 68 3e 32 26 26 28 6f 3d 65 5b 65 2e 6c 65 gth>2&&(o=e[e.le
00038620: 6e 67 74 68 2d 32 5d 2c 73 75 2e 44 69 73 74 32 ngth-2],su.Dist2
00038630: 28 72 2e 70 6f 69 6e 74 2c 6f 2e 70 6f 69 6e 74 (r.point,o.point
00038640: 29 3c 28 28 72 2e 72 61 64 69 75 73 2b 6f 2e 72 )<((r.radius+o.r
00038650: 61 64 69 75 73 29 2f 32 2a 2e 35 29 2a 2a 32 29 adius)/2*.5)**2)
00038660: 3b 29 65 2e 73 70 6c 69 63 65 28 65 2e 6c 65 6e ;)e.splice(e.len
00038670: 67 74 68 2d 32 2c 31 29 3b 72 65 74 75 72 6e 20 gth-2,1);return
00038680: 65 2e 6c 65 6e 67 74 68 3e 31 26 26 28 65 5b 30 e.length>1&&(e[0
00038690: 5d 3d 7b 2e 2e 2e 65 5b 30 5d 2c 76 65 63 74 6f ]={...e[0],vecto
000386a0: 72 3a 73 75 2e 53 75 62 28 65 5b 30 5d 2e 70 6f r:su.Sub(e[0].po
000386b0: 69 6e 74 2c 65 5b 31 5d 2e 70 6f 69 6e 74 29 2e int,e[1].point).
000386c0: 75 6e 69 28 29 7d 2c 65 5b 65 2e 6c 65 6e 67 74 uni()},e[e.lengt
000386d0: 68 2d 31 5d 3d 7b 2e 2e 2e 65 5b 65 2e 6c 65 6e h-1]={...e[e.len
000386e0: 67 74 68 2d 31 5d 2c 76 65 63 74 6f 72 3a 73 75 gth-1],vector:su
000386f0: 2e 53 75 62 28 65 5b 65 2e 6c 65 6e 67 74 68 2d .Sub(e[e.length-
00038700: 32 5d 2e 70 6f 69 6e 74 2c 65 5b 65 2e 6c 65 6e 2].point,e[e.len
00038710: 67 74 68 2d 31 5d 2e 70 6f 69 6e 74 29 2e 75 6e gth-1].point).un
00038720: 69 28 29 7d 29 2c 65 7d 66 75 6e 63 74 69 6f 6e i()}),e}function
00038730: 20 4a 76 28 65 2c 74 3d 7b 7d 29 7b 69 66 28 30 Jv(e,t={}){if(0
00038740: 3d 3d 3d 65 2e 6c 65 6e 67 74 68 29 72 65 74 75 ===e.length)retu
00038750: 72 6e 22 22 3b 69 66 28 31 3d 3d 3d 65 2e 6c 65 rn"";if(1===e.le
00038760: 6e 67 74 68 29 72 65 74 75 72 6e 20 6e 3d 65 5b ngth)return n=e[
00038770: 30 5d 2e 70 6f 69 6e 74 2e 78 2c 72 3d 65 5b 30 0].point.x,r=e[0
00038780: 5d 2e 70 6f 69 6e 74 2e 79 2c 6f 3d 65 5b 30 5d ].point.y,o=e[0]
00038790: 2e 72 61 64 69 75 73 2c 22 4d 20 22 2b 6e 2b 22 .radius,"M "+n+"
000387a0: 20 22 2b 72 2b 22 20 6d 20 2d 22 2b 6f 2b 22 2c "+r+" m -"+o+",
000387b0: 20 30 20 61 20 22 2b 6f 2b 22 2c 22 2b 6f 2b 22 0 a "+o+","+o+"
000387c0: 20 30 20 31 2c 31 20 22 2b 32 2a 6f 2b 22 2c 30 0 1,1 "+2*o+",0
000387d0: 20 61 20 22 2b 6f 2b 22 2c 22 2b 6f 2b 22 20 30 a "+o+","+o+" 0
000387e0: 20 31 2c 31 20 2d 22 2b 32 2a 6f 2b 22 2c 30 22 1,1 -"+2*o+",0"
000387f0: 3b 76 61 72 20 6e 2c 72 2c 6f 3b 63 6f 6e 73 74 ;var n,r,o;const
00038800: 7b 6c 65 66 74 3a 69 2c 72 69 67 68 74 3a 61 7d {left:i,right:a}
00038810: 3d 59 67 28 65 2c 74 29 3b 61 2e 72 65 76 65 72 =Yg(e,t);a.rever
00038820: 73 65 28 29 3b 6c 65 74 20 73 3d 60 4d 24 7b 63 se();let s=`M${c
00038830: 75 28 69 5b 30 5d 29 7d 54 60 3b 66 6f 72 28 6c u(i[0])}T`;for(l
00038840: 65 74 20 65 3d 31 3b 65 3c 69 2e 6c 65 6e 67 74 et e=1;e<i.lengt
00038850: 68 3b 65 2b 2b 29 73 2b 3d 75 75 28 69 5b 65 2d h;e++)s+=uu(i[e-
00038860: 31 5d 2c 69 5b 65 5d 29 3b 7b 63 6f 6e 73 74 20 1],i[e]);{const
00038870: 74 3d 65 5b 65 2e 6c 65 6e 67 74 68 2d 31 5d 2c t=e[e.length-1],
00038880: 6e 3d 74 2e 72 61 64 69 75 73 2c 72 3d 74 2e 76 n=t.radius,r=t.v
00038890: 65 63 74 6f 72 2e 63 6c 6f 6e 65 28 29 2e 70 65 ector.clone().pe
000388a0: 72 28 29 2e 6e 65 67 28 29 2c 6f 3d 73 75 2e 41 r().neg(),o=su.A
000388b0: 64 64 28 74 2e 70 6f 69 6e 74 2c 73 75 2e 4d 75 dd(t.point,su.Mu
000388c0: 6c 28 72 2c 6e 29 29 2c 69 3d 73 75 2e 41 64 64 l(r,n)),i=su.Add
000388d0: 28 74 2e 70 6f 69 6e 74 2c 73 75 2e 4d 75 6c 28 (t.point,su.Mul(
000388e0: 72 2c 2d 6e 29 29 3b 73 2b 3d 60 24 7b 63 75 28 r,-n));s+=`${cu(
000388f0: 6f 29 7d 41 24 7b 4e 75 28 6e 29 7d 2c 24 7b 4e o)}A${Nu(n)},${N
00038900: 75 28 6e 29 7d 20 30 20 30 20 31 20 24 7b 63 75 u(n)} 0 0 1 ${cu
00038910: 28 69 29 7d 54 60 7d 66 6f 72 28 6c 65 74 20 65 (i)}T`}for(let e
00038920: 3d 31 3b 65 3c 61 2e 6c 65 6e 67 74 68 3b 65 2b =1;e<a.length;e+
00038930: 2b 29 73 2b 3d 75 75 28 61 5b 65 2d 31 5d 2c 61 +)s+=uu(a[e-1],a
00038940: 5b 65 5d 29 3b 7b 63 6f 6e 73 74 20 74 3d 65 5b [e]);{const t=e[
00038950: 30 5d 2c 6e 3d 74 2e 72 61 64 69 75 73 2c 72 3d 0],n=t.radius,r=
00038960: 74 2e 76 65 63 74 6f 72 2e 63 6c 6f 6e 65 28 29 t.vector.clone()
00038970: 2e 70 65 72 28 29 2c 6f 3d 73 75 2e 41 64 64 28 .per(),o=su.Add(
00038980: 74 2e 70 6f 69 6e 74 2c 73 75 2e 4d 75 6c 28 72 t.point,su.Mul(r
00038990: 2c 6e 29 29 2c 69 3d 73 75 2e 41 64 64 28 74 2e ,n)),i=su.Add(t.
000389a0: 70 6f 69 6e 74 2c 73 75 2e 4d 75 6c 28 72 2c 2d point,su.Mul(r,-
000389b0: 6e 29 29 3b 73 2b 3d 60 24 7b 63 75 28 6f 29 7d n));s+=`${cu(o)}
000389c0: 41 24 7b 4e 75 28 6e 29 7d 2c 24 7b 4e 75 28 6e A${Nu(n)},${Nu(n
000389d0: 29 7d 20 30 20 30 20 31 20 24 7b 63 75 28 69 29 )} 0 0 1 ${cu(i)
000389e0: 7d 5a 60 7d 72 65 74 75 72 6e 20 73 7d 63 6f 6e }Z`}return s}con
000389f0: 73 74 20 24 76 3d 65 3d 3e 2e 36 35 2a 65 2b 2e st $v=e=>.65*e+.
00038a00: 33 35 2a 68 75 28 65 2a 64 75 2f 32 29 2c 65 53 35*hu(e*du/2),eS
00038a10: 3d 65 3d 3e 28 7b 73 69 7a 65 3a 65 2c 74 68 69 =e=>({size:e,thi
00038a20: 6e 6e 69 6e 67 3a 2e 35 2c 73 74 72 65 61 6d 6c nning:.5,streaml
00038a30: 69 6e 65 3a 67 6f 28 65 2c 5b 39 2c 31 36 5d 2c ine:go(e,[9,16],
00038a40: 5b 2e 36 34 2c 2e 37 34 5d 2c 21 30 29 2c 73 6d [.64,.74],!0),sm
00038a50: 6f 6f 74 68 69 6e 67 3a 2e 36 32 2c 65 61 73 69 oothing:.62,easi
00038a60: 6e 67 3a 61 75 2e 65 61 73 65 4f 75 74 53 69 6e ng:au.easeOutSin
00038a70: 65 2c 73 69 6d 75 6c 61 74 65 50 72 65 73 73 75 e,simulatePressu
00038a80: 72 65 3a 21 30 7d 29 2c 74 53 3d 65 3d 3e 28 7b re:!0}),tS=e=>({
00038a90: 73 69 7a 65 3a 31 2b 31 2e 32 2a 65 2c 74 68 69 size:1+1.2*e,thi
00038aa0: 6e 6e 69 6e 67 3a 2e 36 32 2c 73 74 72 65 61 6d nning:.62,stream
00038ab0: 6c 69 6e 65 3a 2e 36 32 2c 73 6d 6f 6f 74 68 69 line:.62,smoothi
00038ac0: 6e 67 3a 2e 36 32 2c 73 69 6d 75 6c 61 74 65 50 ng:.62,simulateP
00038ad0: 72 65 73 73 75 72 65 3a 21 31 2c 65 61 73 69 6e ressure:!1,easin
00038ae0: 67 3a 24 76 7d 29 2c 6e 53 3d 65 3d 3e 28 7b 73 g:$v}),nS=e=>({s
00038af0: 69 7a 65 3a 65 2c 74 68 69 6e 6e 69 6e 67 3a 30 ize:e,thinning:0
00038b00: 2c 73 74 72 65 61 6d 6c 69 6e 65 3a 67 6f 28 65 ,streamline:go(e
00038b10: 2c 5b 39 2c 31 36 5d 2c 5b 2e 36 38 2c 2e 37 34 ,[9,16],[.68,.74
00038b20: 5d 2c 21 30 29 2c 73 6d 6f 6f 74 68 69 6e 67 3a ],!0),smoothing:
00038b30: 2e 36 32 2c 73 69 6d 75 6c 61 74 65 50 72 65 73 .62,simulatePres
00038b40: 73 75 72 65 3a 21 31 2c 65 61 73 69 6e 67 3a 61 sure:!1,easing:a
00038b50: 75 2e 6c 69 6e 65 61 72 7d 29 2c 72 53 3d 65 3d u.linear}),rS=e=
00038b60: 3e 28 7b 73 69 7a 65 3a 65 2c 74 68 69 6e 6e 69 >({size:e,thinni
00038b70: 6e 67 3a 30 2c 73 74 72 65 61 6d 6c 69 6e 65 3a ng:0,streamline:
00038b80: 2e 36 32 2c 73 6d 6f 6f 74 68 69 6e 67 3a 2e 36 .62,smoothing:.6
00038b90: 32 2c 73 69 6d 75 6c 61 74 65 50 72 65 73 73 75 2,simulatePressu
00038ba0: 72 65 3a 21 31 2c 65 61 73 69 6e 67 3a 61 75 2e re:!1,easing:au.
00038bb0: 6c 69 6e 65 61 72 7d 29 3b 66 75 6e 63 74 69 6f linear});functio
00038bc0: 6e 20 6f 53 28 7b 73 74 72 6f 6b 65 57 69 64 74 n oS({strokeWidt
00038bd0: 68 3a 65 2c 73 68 6f 77 41 73 43 6f 6d 70 6c 65 h:e,showAsComple
00038be0: 74 65 3a 74 7d 29 7b 72 65 74 75 72 6e 7b 73 69 te:t}){return{si
00038bf0: 7a 65 3a 31 2b 65 2c 74 68 69 6e 6e 69 6e 67 3a ze:1+e,thinning:
00038c00: 30 2c 73 74 72 65 61 6d 6c 69 6e 65 3a 2e 35 2c 0,streamline:.5,
00038c10: 73 6d 6f 6f 74 68 69 6e 67 3a 2e 35 2c 73 69 6d smoothing:.5,sim
00038c20: 75 6c 61 74 65 50 72 65 73 73 75 72 65 3a 21 31 ulatePressure:!1
00038c30: 2c 65 61 73 69 6e 67 3a 61 75 2e 65 61 73 65 4f ,easing:au.easeO
00038c40: 75 74 53 69 6e 65 2c 6c 61 73 74 3a 74 7d 7d 66 utSine,last:t}}f
00038c50: 75 6e 63 74 69 6f 6e 20 69 53 28 65 2c 74 2c 6e unction iS(e,t,n
00038c60: 2c 72 29 7b 63 6f 6e 73 74 20 6f 3d 65 2e 69 73 ,r){const o=e.is
00038c70: 43 6f 6d 70 6c 65 74 65 7c 7c 6e 3b 72 65 74 75 Complete||n;retu
00038c80: 72 6e 20 72 3f 65 2e 69 73 50 65 6e 3f 7b 2e 2e rn r?e.isPen?{..
00038c90: 2e 72 53 28 74 29 2c 6c 61 73 74 3a 6f 7d 3a 7b .rS(t),last:o}:{
00038ca0: 2e 2e 2e 6e 53 28 74 29 2c 6c 61 73 74 3a 6f 7d ...nS(t),last:o}
00038cb0: 3a 22 64 72 61 77 22 3d 3d 3d 65 2e 64 61 73 68 :"draw"===e.dash
00038cc0: 3f 65 2e 69 73 50 65 6e 3f 7b 2e 2e 2e 74 53 28 ?e.isPen?{...tS(
00038cd0: 74 29 2c 6c 61 73 74 3a 6f 7d 3a 7b 2e 2e 2e 65 t),last:o}:{...e
00038ce0: 53 28 74 29 2c 6c 61 73 74 3a 6f 7d 3a 7b 2e 2e S(t),last:o}:{..
00038cf0: 2e 6e 53 28 74 29 2c 6c 61 73 74 3a 6f 7d 7d 66 .nS(t),last:o}}f
00038d00: 75 6e 63 74 69 6f 6e 20 61 53 28 65 29 7b 63 6f unction aS(e){co
00038d10: 6e 73 74 20 74 3d 5b 5d 3b 66 6f 72 28 63 6f 6e nst t=[];for(con
00038d20: 73 74 20 6e 20 6f 66 20 65 29 69 66 28 22 66 72 st n of e)if("fr
00038d30: 65 65 22 3d 3d 3d 6e 2e 74 79 70 65 7c 7c 6e 2e ee"===n.type||n.
00038d40: 70 6f 69 6e 74 73 2e 6c 65 6e 67 74 68 3c 32 29 points.length<2)
00038d50: 74 2e 70 75 73 68 28 2e 2e 2e 6e 2e 70 6f 69 6e t.push(...n.poin
00038d60: 74 73 2e 6d 61 70 28 73 75 2e 43 61 73 74 29 29 ts.map(su.Cast))
00038d70: 3b 65 6c 73 65 7b 63 6f 6e 73 74 20 65 3d 4d 61 ;else{const e=Ma
00038d80: 74 68 2e 6d 61 78 28 34 2c 4d 61 74 68 2e 66 6c th.max(4,Math.fl
00038d90: 6f 6f 72 28 73 75 2e 44 69 73 74 28 6e 2e 70 6f oor(su.Dist(n.po
00038da0: 69 6e 74 73 5b 30 5d 2c 6e 2e 70 6f 69 6e 74 73 ints[0],n.points
00038db0: 5b 31 5d 29 2f 31 36 29 29 3b 74 2e 70 75 73 68 [1])/16));t.push
00038dc0: 28 2e 2e 2e 73 75 2e 50 6f 69 6e 74 73 42 65 74 (...su.PointsBet
00038dd0: 77 65 65 6e 28 6e 2e 70 6f 69 6e 74 73 5b 30 5d ween(n.points[0]
00038de0: 2c 6e 2e 70 6f 69 6e 74 73 5b 31 5d 2c 65 29 29 ,n.points[1],e))
00038df0: 7d 72 65 74 75 72 6e 20 74 7d 66 75 6e 63 74 69 }return t}functi
00038e00: 6f 6e 20 73 53 28 65 2c 74 29 7b 72 65 74 75 72 on sS(e,t){retur
00038e10: 6e 7b 64 72 61 77 3a 22 6e 6f 6e 65 22 2c 73 6f n{draw:"none",so
00038e20: 6c 69 64 3a 22 6e 6f 6e 65 22 2c 64 6f 74 74 65 lid:"none",dotte
00038e30: 64 3a 22 30 2e 31 20 22 2b 32 2a 74 2c 64 61 73 d:"0.1 "+2*t,das
00038e40: 68 65 64 3a 60 24 7b 32 2a 74 7d 20 24 7b 32 2a hed:`${2*t} ${2*
00038e50: 74 7d 60 7d 5b 65 2e 70 72 6f 70 73 2e 64 61 73 t}`}[e.props.das
00038e60: 68 5d 7d 66 75 6e 63 74 69 6f 6e 20 6c 53 28 65 h]}function lS(e
00038e70: 2c 74 29 7b 63 6f 6e 73 74 20 6e 3d 2e 35 2a 28 ,t){const n=.5*(
00038e80: 74 2b 31 29 3b 72 65 74 75 72 6e 60 4d 20 24 7b t+1);return`M ${
00038e90: 65 2e 78 7d 20 24 7b 65 2e 79 7d 20 6d 20 2d 24 e.x} ${e.y} m -$
00038ea0: 7b 6e 7d 2c 20 30 20 61 20 24 7b 6e 7d 2c 24 7b {n}, 0 a ${n},${
00038eb0: 6e 7d 20 30 20 31 2c 30 20 24 7b 32 2a 6e 7d 2c n} 0 1,0 ${2*n},
00038ec0: 30 20 61 20 24 7b 6e 7d 2c 24 7b 6e 7d 20 30 20 0 a ${n},${n} 0
00038ed0: 31 2c 30 20 2d 24 7b 32 2a 6e 7d 2c 30 60 7d 66 1,0 -${2*n},0`}f
00038ee0: 75 6e 63 74 69 6f 6e 20 63 53 28 65 29 7b 72 65 unction cS(e){re
00038ef0: 74 75 72 6e 20 31 3d 3d 3d 65 2e 70 72 6f 70 73 turn 1===e.props
00038f00: 2e 73 65 67 6d 65 6e 74 73 2e 6c 65 6e 67 74 68 .segments.length
00038f10: 26 26 65 2e 70 72 6f 70 73 2e 73 65 67 6d 65 6e &&e.props.segmen
00038f20: 74 73 5b 30 5d 2e 70 6f 69 6e 74 73 2e 6c 65 6e ts[0].points.len
00038f30: 67 74 68 3c 32 7d 66 75 6e 63 74 69 6f 6e 20 75 gth<2}function u
00038f40: 53 28 7b 73 68 61 70 65 3a 65 2c 7a 6f 6f 6d 4c S({shape:e,zoomL
00038f50: 65 76 65 6c 3a 74 7d 29 7b 63 6f 6e 73 74 20 6e evel:t}){const n
00038f60: 3d 51 79 28 29 2c 72 3d 61 53 28 65 2e 70 72 6f =Qy(),r=aS(e.pro
00038f70: 70 73 2e 73 65 67 6d 65 6e 74 73 29 2c 6f 3d 65 ps.segments),o=e
00038f80: 2e 70 72 6f 70 73 2e 69 73 43 6f 6d 70 6c 65 74 .props.isComplet
00038f90: 65 7c 7c 22 73 74 72 61 69 67 68 74 22 3d 3d 3d e||"straight"===
00038fa0: 42 72 28 65 2e 70 72 6f 70 73 2e 73 65 67 6d 65 Br(e.props.segme
00038fb0: 6e 74 73 29 3f 2e 74 79 70 65 3b 6c 65 74 20 69 nts)?.type;let i
00038fc0: 3d 28 50 62 5b 65 2e 70 72 6f 70 73 2e 73 69 7a =(Pb[e.props.siz
00038fd0: 65 5d 2b 31 29 2a 65 2e 70 72 6f 70 73 2e 73 63 e]+1)*e.props.sc
00038fe0: 61 6c 65 3b 63 6f 6e 73 74 20 61 3d 74 3c 2e 35 ale;const a=t<.5
00038ff0: 26 26 74 3c 31 2e 35 2f 69 3b 61 7c 7c 65 2e 70 &&t<1.5/i;a||e.p
00039000: 72 6f 70 73 2e 69 73 50 65 6e 7c 7c 22 64 72 61 rops.isPen||"dra
00039010: 77 22 21 3d 3d 65 2e 70 72 6f 70 73 2e 64 61 73 w"!==e.props.das
00039020: 68 7c 7c 31 21 3d 3d 72 2e 6c 65 6e 67 74 68 7c h||1!==r.length|
00039030: 7c 28 69 2b 3d 6d 6f 28 65 2e 69 64 29 28 29 2a |(i+=mo(e.id)()*
00039040: 28 69 2f 36 29 29 3b 63 6f 6e 73 74 20 73 3d 69 (i/6));const s=i
00039050: 53 28 65 2e 70 72 6f 70 73 2c 69 2c 6f 2c 61 29 S(e.props,i,o,a)
00039060: 3b 69 66 28 21 61 26 26 22 64 72 61 77 22 3d 3d ;if(!a&&"draw"==
00039070: 3d 65 2e 70 72 6f 70 73 2e 64 61 73 68 29 72 65 =e.props.dash)re
00039080: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 turn(0,Qc.jsxs)(
00039090: 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 Qc.Fragment,{chi
000390a0: 6c 64 72 65 6e 3a 5b 65 2e 70 72 6f 70 73 2e 69 ldren:[e.props.i
000390b0: 73 43 6c 6f 73 65 64 26 26 65 2e 70 72 6f 70 73 sClosed&&e.props
000390c0: 2e 66 69 6c 6c 26 26 72 2e 6c 65 6e 67 74 68 3e .fill&&r.length>
000390d0: 31 3f 28 30 2c 51 63 2e 6a 73 78 29 28 70 76 2c 1?(0,Qc.jsx)(pv,
000390e0: 7b 64 3a 58 76 28 4a 67 28 72 2c 73 29 2c 65 2e {d:Xv(Jg(r,s),e.
000390f0: 70 72 6f 70 73 2e 69 73 43 6c 6f 73 65 64 29 2c props.isClosed),
00039100: 74 68 65 6d 65 3a 6e 2c 63 6f 6c 6f 72 3a 65 2e theme:n,color:e.
00039110: 70 72 6f 70 73 2e 63 6f 6c 6f 72 2c 66 69 6c 6c props.color,fill
00039120: 3a 65 2e 70 72 6f 70 73 2e 69 73 43 6c 6f 73 65 :e.props.isClose
00039130: 64 3f 65 2e 70 72 6f 70 73 2e 66 69 6c 6c 3a 22 d?e.props.fill:"
00039140: 6e 6f 6e 65 22 2c 73 63 61 6c 65 3a 65 2e 70 72 none",scale:e.pr
00039150: 6f 70 73 2e 73 63 61 6c 65 7d 29 3a 6e 75 6c 6c ops.scale}):null
00039160: 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 ,(0,Qc.jsx)("pat
00039170: 68 22 2c 7b 64 3a 5a 76 28 72 2c 73 29 2c 73 74 h",{d:Zv(r,s),st
00039180: 72 6f 6b 65 4c 69 6e 65 63 61 70 3a 22 72 6f 75 rokeLinecap:"rou
00039190: 6e 64 22 2c 66 69 6c 6c 3a 6e 5b 65 2e 70 72 6f nd",fill:n[e.pro
000391a0: 70 73 2e 63 6f 6c 6f 72 5d 2e 73 6f 6c 69 64 7d ps.color].solid}
000391b0: 29 5d 7d 29 3b 63 6f 6e 73 74 20 6c 3d 4a 67 28 )]});const l=Jg(
000391c0: 72 2c 73 29 2c 63 3d 6c 2e 6c 65 6e 67 74 68 3c r,s),c=l.length<
000391d0: 32 2c 75 3d 63 3f 6c 53 28 72 5b 30 5d 2c 30 29 2,u=c?lS(r[0],0)
000391e0: 3a 58 76 28 6c 2c 65 2e 70 72 6f 70 73 2e 69 73 :Xv(l,e.props.is
000391f0: 43 6c 6f 73 65 64 29 3b 72 65 74 75 72 6e 28 30 Closed);return(0
00039200: 2c 51 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 ,Qc.jsxs)(Qc.Fra
00039210: 67 6d 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a gment,{children:
00039220: 5b 28 30 2c 51 63 2e 6a 73 78 29 28 70 76 2c 7b [(0,Qc.jsx)(pv,{
00039230: 64 3a 75 2c 74 68 65 6d 65 3a 6e 2c 63 6f 6c 6f d:u,theme:n,colo
00039240: 72 3a 65 2e 70 72 6f 70 73 2e 63 6f 6c 6f 72 2c r:e.props.color,
00039250: 66 69 6c 6c 3a 63 7c 7c 65 2e 70 72 6f 70 73 2e fill:c||e.props.
00039260: 69 73 43 6c 6f 73 65 64 3f 65 2e 70 72 6f 70 73 isClosed?e.props
00039270: 2e 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c 73 63 61 .fill:"none",sca
00039280: 6c 65 3a 65 2e 70 72 6f 70 73 2e 73 63 61 6c 65 le:e.props.scale
00039290: 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 }),(0,Qc.jsx)("p
000392a0: 61 74 68 22 2c 7b 64 3a 75 2c 73 74 72 6f 6b 65 ath",{d:u,stroke
000392b0: 4c 69 6e 65 63 61 70 3a 22 72 6f 75 6e 64 22 2c Linecap:"round",
000392c0: 66 69 6c 6c 3a 63 3f 6e 5b 65 2e 70 72 6f 70 73 fill:c?n[e.props
000392d0: 2e 63 6f 6c 6f 72 5d 2e 73 6f 6c 69 64 3a 22 6e .color].solid:"n
000392e0: 6f 6e 65 22 2c 73 74 72 6f 6b 65 3a 6e 5b 65 2e one",stroke:n[e.
000392f0: 70 72 6f 70 73 2e 63 6f 6c 6f 72 5d 2e 73 6f 6c props.color].sol
00039300: 69 64 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 69 id,strokeWidth:i
00039310: 2c 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 ,strokeDasharray
00039320: 3a 63 3f 22 6e 6f 6e 65 22 3a 73 53 28 65 2c 69 :c?"none":sS(e,i
00039330: 29 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 ),strokeDashoffs
00039340: 65 74 3a 22 30 22 7d 29 5d 7d 29 7d 66 75 6e 63 et:"0"})]})}func
00039350: 74 69 6f 6e 20 64 53 28 7b 69 64 3a 65 2c 66 69 tion dS({id:e,fi
00039360: 6c 65 3a 74 2c 69 73 49 6e 74 65 72 61 63 74 69 le:t,isInteracti
00039370: 76 65 3a 6e 2c 77 69 64 74 68 3a 72 2c 68 65 69 ve:n,width:r,hei
00039380: 67 68 74 3a 6f 2c 73 74 79 6c 65 3a 69 2c 70 61 ght:o,style:i,pa
00039390: 67 65 52 6f 74 61 74 69 6f 6e 3a 61 7d 29 7b 72 geRotation:a}){r
000393a0: 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 eturn(0,Qc.jsx)(
000393b0: 22 69 66 72 61 6d 65 22 2c 7b 63 6c 61 73 73 4e "iframe",{classN
000393c0: 61 6d 65 3a 22 74 6c 2d 65 6d 62 65 64 22 2c 64 ame:"tl-embed",d
000393d0: 72 61 67 67 61 62 6c 65 3a 21 31 2c 77 69 64 74 raggable:!1,widt
000393e0: 68 3a 4e 75 28 72 29 2c 68 65 69 67 68 74 3a 4e h:Nu(r),height:N
000393f0: 75 28 6f 29 2c 66 72 61 6d 65 42 6f 72 64 65 72 u(o),frameBorder
00039400: 3a 22 30 22 2c 73 63 72 6f 6c 6c 69 6e 67 3a 22 :"0",scrolling:"
00039410: 6e 6f 22 2c 73 65 61 6d 6c 65 73 73 3a 21 30 2c no",seamless:!0,
00039420: 72 65 66 65 72 72 65 72 50 6f 6c 69 63 79 3a 22 referrerPolicy:"
00039430: 6e 6f 2d 72 65 66 65 72 72 65 72 2d 77 68 65 6e no-referrer-when
00039440: 2d 64 6f 77 6e 67 72 61 64 65 22 2c 73 74 79 6c -downgrade",styl
00039450: 65 3a 7b 2e 2e 2e 69 2c 70 6f 69 6e 74 65 72 45 e:{...i,pointerE
00039460: 76 65 6e 74 73 3a 6e 3f 22 61 6c 6c 22 3a 22 6e vents:n?"all":"n
00039470: 6f 6e 65 22 2c 7a 49 6e 64 65 78 3a 6e 3f 22 22 one",zIndex:n?""
00039480: 3a 22 2d 31 22 2c 62 6f 78 53 68 61 64 6f 77 3a :"-1",boxShadow:
00039490: 47 76 28 61 29 7d 2c 73 72 63 44 6f 63 3a 60 5c Gv(a)},srcDoc:`\
000394a0: 6e 5c 74 5c 74 5c 74 3c 68 74 6d 6c 3e 5c 6e 5c n\t\t\t<html>\n\
000394b0: 74 5c 74 5c 74 5c 74 3c 68 65 61 64 3e 5c 6e 5c t\t\t\t<head>\n\
000394c0: 74 5c 74 5c 74 5c 74 5c 74 3c 62 61 73 65 20 74 t\t\t\t\t<base t
000394d0: 61 72 67 65 74 3d 22 5f 62 6c 61 6e 6b 22 3e 5c arget="_blank">\
000394e0: 6e 5c 74 5c 74 5c 74 5c 74 3c 2f 68 65 61 64 3e n\t\t\t\t</head>
000394f0: 5c 6e 5c 74 5c 74 5c 74 5c 74 3c 62 6f 64 79 3e \n\t\t\t\t<body>
00039500: 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 3c 73 63 72 \n\t\t\t\t\t<scr
00039510: 69 70 74 20 73 72 63 3d 68 74 74 70 73 3a 2f 2f ipt src=https://
00039520: 67 69 73 74 2e 67 69 74 68 75 62 2e 63 6f 6d 2f gist.github.com/
00039530: 24 7b 65 7d 2e 6a 73 24 7b 74 3f 60 3f 66 69 6c ${e}.js${t?`?fil
00039540: 65 3d 24 7b 74 7d 60 3a 22 22 7d 3e 3c 5c 2f 73 e=${t}`:""}><\/s
00039550: 63 72 69 70 74 3e 5c 6e 5c 74 5c 74 5c 74 5c 74 cript>\n\t\t\t\t
00039560: 5c 74 3c 73 74 79 6c 65 20 74 79 70 65 3d 22 74 \t<style type="t
00039570: 65 78 74 2f 63 73 73 22 3e 5c 6e 5c 74 5c 74 5c ext/css">\n\t\t\
00039580: 74 5c 74 5c 74 5c 74 2a 20 7b 20 6d 61 72 67 69 t\t\t\t* { margi
00039590: 6e 3a 20 30 70 78 3b 20 7d 5c 6e 5c 74 5c 74 5c n: 0px; }\n\t\t\
000395a0: 74 5c 74 5c 74 5c 74 74 61 62 6c 65 20 7b 20 68 t\t\t\ttable { h
000395b0: 65 69 67 68 74 3a 20 31 30 30 25 3b 20 62 61 63 eight: 100%; bac
000395c0: 6b 67 72 6f 75 6e 64 2d 63 6f 6c 6f 72 3a 20 72 kground-color: r
000395d0: 65 64 3b 20 7d 5c 6e 5c 74 5c 74 5c 74 5c 74 5c ed; }\n\t\t\t\t\
000395e0: 74 5c 74 2e 67 69 73 74 20 7b 20 62 61 63 6b 67 t\t.gist { backg
000395f0: 72 6f 75 6e 64 2d 63 6f 6c 6f 72 3a 20 6e 6f 6e round-color: non
00039600: 65 3b 20 68 65 69 67 68 74 3a 20 31 30 30 25 3b e; height: 100%;
00039610: 20 20 7d 5c 6e 5c 74 5c 74 5c 74 5c 74 5c 74 5c }\n\t\t\t\t\t\
00039620: 74 2e 67 69 73 74 20 2e 67 69 73 74 2d 66 69 6c t.gist .gist-fil
00039630: 65 20 7b 20 68 65 69 67 68 74 3a 20 63 61 6c 63 e { height: calc
00039640: 28 31 30 30 76 68 20 2d 20 32 70 78 29 3b 20 70 (100vh - 2px); p
00039650: 61 64 64 69 6e 67 3a 20 30 70 78 3b 20 64 69 73 adding: 0px; dis
00039660: 70 6c 61 79 3a 20 67 72 69 64 3b 20 67 72 69 64 play: grid; grid
00039670: 2d 74 65 6d 70 6c 61 74 65 2d 72 6f 77 73 3a 20 -template-rows:
00039680: 31 66 72 20 61 75 74 6f 3b 20 7d 5c 6e 5c 74 5c 1fr auto; }\n\t\
00039690: 74 5c 74 5c 74 5c 74 3c 2f 73 74 79 6c 65 3e 5c t\t\t\t</style>\
000396a0: 6e 5c 74 5c 74 5c 74 5c 74 3c 2f 62 6f 64 79 3e n\t\t\t\t</body>
000396b0: 5c 6e 5c 74 5c 74 5c 74 3c 2f 68 74 6d 6c 3e 60 \n\t\t\t</html>`
000396c0: 7d 29 7d 63 6f 6e 73 74 20 70 53 3d 28 30 2c 6f })}const pS=(0,o
000396d0: 2e 66 6f 72 77 61 72 64 52 65 66 29 28 28 28 7b .forwardRef)((({
000396e0: 69 64 3a 65 2c 6e 61 6d 65 3a 74 2c 69 73 45 64 id:e,name:t,isEd
000396f0: 69 74 69 6e 67 3a 6e 7d 2c 72 29 3d 3e 7b 63 6f iting:n},r)=>{co
00039700: 6e 73 74 20 69 3d 72 75 28 29 2c 61 3d 28 30 2c nst i=ru(),a=(0,
00039710: 6f 2e 75 73 65 43 61 6c 6c 62 61 63 6b 29 28 28 o.useCallback)((
00039720: 65 3d 3e 7b 22 45 6e 74 65 72 22 21 3d 3d 65 2e e=>{"Enter"!==e.
00039730: 6b 65 79 7c 7c 65 2e 6e 61 74 69 76 65 45 76 65 key||e.nativeEve
00039740: 6e 74 2e 69 73 43 6f 6d 70 6f 73 69 6e 67 7c 7c nt.isComposing||
00039750: 28 6e 64 28 65 29 2c 65 2e 63 75 72 72 65 6e 74 (nd(e),e.current
00039760: 54 61 72 67 65 74 2e 62 6c 75 72 28 29 2c 69 2e Target.blur(),i.
00039770: 73 65 74 45 64 69 74 69 6e 67 53 68 61 70 65 28 setEditingShape(
00039780: 6e 75 6c 6c 29 29 7d 29 2c 5b 69 5d 29 2c 73 3d null))}),[i]),s=
00039790: 28 30 2c 6f 2e 75 73 65 43 61 6c 6c 62 61 63 6b (0,o.useCallback
000397a0: 29 28 28 74 3d 3e 7b 63 6f 6e 73 74 20 6e 3d 69 )((t=>{const n=i
000397b0: 2e 67 65 74 53 68 61 70 65 28 65 29 3b 69 66 28 .getShape(e);if(
000397c0: 21 6e 29 72 65 74 75 72 6e 3b 63 6f 6e 73 74 20 !n)return;const
000397d0: 72 3d 6e 2e 70 72 6f 70 73 2e 6e 61 6d 65 2c 6f r=n.props.name,o
000397e0: 3d 74 2e 63 75 72 72 65 6e 74 54 61 72 67 65 74 =t.currentTarget
000397f0: 2e 76 61 6c 75 65 2e 74 72 69 6d 28 29 3b 72 21 .value.trim();r!
00039800: 3d 3d 6f 26 26 69 2e 75 70 64 61 74 65 53 68 61 ==o&&i.updateSha
00039810: 70 65 73 28 5b 7b 69 64 3a 65 2c 74 79 70 65 3a pes([{id:e,type:
00039820: 22 66 72 61 6d 65 22 2c 70 72 6f 70 73 3a 7b 6e "frame",props:{n
00039830: 61 6d 65 3a 6f 7d 7d 5d 29 7d 29 2c 5b 65 2c 69 ame:o}}])}),[e,i
00039840: 5d 29 2c 6c 3d 28 30 2c 6f 2e 75 73 65 43 61 6c ]),l=(0,o.useCal
00039850: 6c 62 61 63 6b 29 28 28 74 3d 3e 7b 63 6f 6e 73 lback)((t=>{cons
00039860: 74 20 6e 3d 69 2e 67 65 74 53 68 61 70 65 28 65 t n=i.getShape(e
00039870: 29 3b 69 66 28 21 6e 29 72 65 74 75 72 6e 3b 63 );if(!n)return;c
00039880: 6f 6e 73 74 20 72 3d 6e 2e 70 72 6f 70 73 2e 6e onst r=n.props.n
00039890: 61 6d 65 2c 6f 3d 74 2e 63 75 72 72 65 6e 74 54 ame,o=t.currentT
000398a0: 61 72 67 65 74 2e 76 61 6c 75 65 3b 72 21 3d 3d arget.value;r!==
000398b0: 6f 26 26 69 2e 75 70 64 61 74 65 53 68 61 70 65 o&&i.updateShape
000398c0: 73 28 5b 7b 69 64 3a 65 2c 74 79 70 65 3a 22 66 s([{id:e,type:"f
000398d0: 72 61 6d 65 22 2c 70 72 6f 70 73 3a 7b 6e 61 6d rame",props:{nam
000398e0: 65 3a 6f 7d 7d 5d 29 7d 29 2c 5b 65 2c 69 5d 29 e:o}}])}),[e,i])
000398f0: 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 ;return(0,Qc.jsx
00039900: 73 29 28 22 64 69 76 22 2c 7b 63 6c 61 73 73 4e s)("div",{classN
00039910: 61 6d 65 3a 22 74 6c 2d 66 72 61 6d 65 2d 6c 61 ame:"tl-frame-la
00039920: 62 65 6c 20 22 2b 28 6e 3f 22 74 6c 2d 66 72 61 bel "+(n?"tl-fra
00039930: 6d 65 2d 6c 61 62 65 6c 5f 5f 65 64 69 74 69 6e me-label__editin
00039940: 67 22 3a 22 22 29 2c 63 68 69 6c 64 72 65 6e 3a g":""),children:
00039950: 5b 28 30 2c 51 63 2e 6a 73 78 29 28 22 69 6e 70 [(0,Qc.jsx)("inp
00039960: 75 74 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 22 ut",{className:"
00039970: 74 6c 2d 66 72 61 6d 65 2d 6e 61 6d 65 2d 69 6e tl-frame-name-in
00039980: 70 75 74 22 2c 72 65 66 3a 72 2c 73 74 79 6c 65 put",ref:r,style
00039990: 3a 7b 64 69 73 70 6c 61 79 3a 6e 3f 76 6f 69 64 :{display:n?void
000399a0: 20 30 3a 22 6e 6f 6e 65 22 7d 2c 76 61 6c 75 65 0:"none"},value
000399b0: 3a 74 2c 61 75 74 6f 46 6f 63 75 73 3a 21 30 2c :t,autoFocus:!0,
000399c0: 6f 6e 4b 65 79 44 6f 77 6e 3a 61 2c 6f 6e 42 6c onKeyDown:a,onBl
000399d0: 75 72 3a 73 2c 6f 6e 43 68 61 6e 67 65 3a 6c 7d ur:s,onChange:l}
000399e0: 29 2c 68 53 28 74 2c 22 46 72 61 6d 65 22 29 2b ),hS(t,"Frame")+
000399f0: 53 74 72 69 6e 67 2e 66 72 6f 6d 43 68 61 72 43 String.fromCharC
00039a00: 6f 64 65 28 38 32 30 33 29 5d 7d 29 7d 29 29 2c ode(8203)]})})),
00039a10: 66 53 3d 66 75 6e 63 74 69 6f 6e 28 7b 69 64 3a fS=function({id:
00039a20: 65 2c 6e 61 6d 65 3a 74 2c 77 69 64 74 68 3a 6e e,name:t,width:n
00039a30: 2c 68 65 69 67 68 74 3a 72 7d 29 7b 63 6f 6e 73 ,height:r}){cons
00039a40: 74 20 69 3d 72 75 28 29 2c 61 3d 64 61 28 22 73 t i=ru(),a=da("s
00039a50: 68 61 70 65 20 72 6f 74 61 74 69 6f 6e 22 2c 28 hape rotation",(
00039a60: 28 29 3d 3e 76 75 28 69 2e 67 65 74 53 68 61 70 ()=>vu(i.getShap
00039a70: 65 50 61 67 65 54 72 61 6e 73 66 6f 72 6d 28 65 ePageTransform(e
00039a80: 29 2e 72 6f 74 61 74 69 6f 6e 28 29 29 29 2c 5b ).rotation())),[
00039a90: 69 2c 65 5d 29 2c 73 3d 4f 67 28 65 29 2c 6c 3d i,e]),s=Og(e),l=
00039aa0: 28 30 2c 6f 2e 75 73 65 52 65 66 29 28 6e 75 6c (0,o.useRef)(nul
00039ab0: 6c 29 2c 63 3d 28 30 2c 6f 2e 75 73 65 43 61 6c l),c=(0,o.useCal
00039ac0: 6c 62 61 63 6b 29 28 28 74 3d 3e 7b 63 6f 6e 73 lback)((t=>{cons
00039ad0: 74 20 6e 3d 6f 64 28 74 29 3b 69 2e 67 65 74 45 t n=od(t);i.getE
00039ae0: 64 69 74 69 6e 67 53 68 61 70 65 49 64 28 29 21 ditingShapeId()!
00039af0: 3d 3d 65 26 26 28 69 2e 64 69 73 70 61 74 63 68 ==e&&(i.dispatch
00039b00: 28 7b 74 79 70 65 3a 22 70 6f 69 6e 74 65 72 22 ({type:"pointer"
00039b10: 2c 6e 61 6d 65 3a 22 70 6f 69 6e 74 65 72 5f 64 ,name:"pointer_d
00039b20: 6f 77 6e 22 2c 74 61 72 67 65 74 3a 22 73 68 61 own",target:"sha
00039b30: 70 65 22 2c 73 68 61 70 65 3a 69 2e 67 65 74 53 pe",shape:i.getS
00039b40: 68 61 70 65 28 65 29 2c 2e 2e 2e 6e 7d 29 2c 74 hape(e),...n}),t
00039b50: 2e 70 72 65 76 65 6e 74 44 65 66 61 75 6c 74 28 .preventDefault(
00039b60: 29 29 7d 29 2c 5b 69 2c 65 5d 29 3b 28 30 2c 6f ))}),[i,e]);(0,o
00039b70: 2e 75 73 65 45 66 66 65 63 74 29 28 28 28 29 3d .useEffect)((()=
00039b80: 3e 7b 63 6f 6e 73 74 20 65 3d 6c 2e 63 75 72 72 >{const e=l.curr
00039b90: 65 6e 74 3b 65 26 26 73 26 26 28 65 2e 66 6f 63 ent;e&&s&&(e.foc
00039ba0: 75 73 28 29 2c 65 2e 73 65 6c 65 63 74 28 29 29 us(),e.select())
00039bb0: 7d 29 2c 5b 6c 2c 73 5d 29 3b 63 6f 6e 73 74 20 }),[l,s]);const
00039bc0: 75 3d 28 28 61 2b 4d 61 74 68 2e 50 49 2f 34 29 u=((a+Math.PI/4)
00039bd0: 2a 28 32 2f 4d 61 74 68 2e 50 49 29 2b 34 29 25 *(2/Math.PI)+4)%
00039be0: 34 2c 64 3d 5b 22 74 6f 70 22 2c 22 6c 65 66 74 4,d=["top","left
00039bf0: 22 2c 22 62 6f 74 74 6f 6d 22 2c 22 72 69 67 68 ","bottom","righ
00039c00: 74 22 5d 5b 4d 61 74 68 2e 66 6c 6f 6f 72 28 75 t"][Math.floor(u
00039c10: 29 5d 3b 6c 65 74 20 70 3b 73 77 69 74 63 68 28 )];let p;switch(
00039c20: 64 29 7b 63 61 73 65 22 74 6f 70 22 3a 70 3d 22 d){case"top":p="
00039c30: 22 3b 62 72 65 61 6b 3b 63 61 73 65 22 72 69 67 ";break;case"rig
00039c40: 68 74 22 3a 70 3d 60 74 72 61 6e 73 6c 61 74 65 ht":p=`translate
00039c50: 28 24 7b 4e 75 28 6e 29 7d 70 78 2c 20 30 70 78 (${Nu(n)}px, 0px
00039c60: 29 20 72 6f 74 61 74 65 28 39 30 64 65 67 29 60 ) rotate(90deg)`
00039c70: 3b 62 72 65 61 6b 3b 63 61 73 65 22 62 6f 74 74 ;break;case"bott
00039c80: 6f 6d 22 3a 70 3d 60 74 72 61 6e 73 6c 61 74 65 om":p=`translate
00039c90: 28 24 7b 4e 75 28 6e 29 7d 70 78 2c 20 24 7b 4e (${Nu(n)}px, ${N
00039ca0: 75 28 72 29 7d 70 78 29 20 72 6f 74 61 74 65 28 u(r)}px) rotate(
00039cb0: 31 38 30 64 65 67 29 60 3b 62 72 65 61 6b 3b 63 180deg)`;break;c
00039cc0: 61 73 65 22 6c 65 66 74 22 3a 70 3d 60 74 72 61 ase"left":p=`tra
00039cd0: 6e 73 6c 61 74 65 28 30 70 78 2c 20 24 7b 4e 75 nslate(0px, ${Nu
00039ce0: 28 72 29 7d 70 78 29 20 72 6f 74 61 74 65 28 32 (r)}px) rotate(2
00039cf0: 37 30 64 65 67 29 60 7d 72 65 74 75 72 6e 28 30 70deg)`}return(0
00039d00: 2c 51 63 2e 6a 73 78 29 28 22 64 69 76 22 2c 7b ,Qc.jsx)("div",{
00039d10: 63 6c 61 73 73 4e 61 6d 65 3a 22 74 6c 2d 66 72 className:"tl-fr
00039d20: 61 6d 65 2d 68 65 61 64 69 6e 67 22 2c 73 74 79 ame-heading",sty
00039d30: 6c 65 3a 7b 6f 76 65 72 66 6c 6f 77 3a 73 3f 22 le:{overflow:s?"
00039d40: 76 69 73 69 62 6c 65 22 3a 22 68 69 64 64 65 6e visible":"hidden
00039d50: 22 2c 6d 61 78 57 69 64 74 68 3a 60 63 61 6c 63 ",maxWidth:`calc
00039d60: 28 76 61 72 28 2d 2d 74 6c 2d 7a 6f 6f 6d 29 20 (var(--tl-zoom)
00039d70: 2a 20 24 7b 22 74 6f 70 22 3d 3d 3d 64 7c 7c 22 * ${"top"===d||"
00039d80: 62 6f 74 74 6f 6d 22 3d 3d 3d 64 3f 4d 61 74 68 bottom"===d?Math
00039d90: 2e 63 65 69 6c 28 6e 29 3a 4d 61 74 68 2e 63 65 .ceil(n):Math.ce
00039da0: 69 6c 28 72 29 7d 70 78 20 2b 20 76 61 72 28 2d il(r)}px + var(-
00039db0: 2d 73 70 61 63 65 2d 35 29 29 60 2c 62 6f 74 74 -space-5))`,bott
00039dc0: 6f 6d 3a 22 31 30 30 25 22 2c 74 72 61 6e 73 66 om:"100%",transf
00039dd0: 6f 72 6d 3a 60 24 7b 70 7d 20 73 63 61 6c 65 28 orm:`${p} scale(
00039de0: 76 61 72 28 2d 2d 74 6c 2d 73 63 61 6c 65 29 29 var(--tl-scale))
00039df0: 20 74 72 61 6e 73 6c 61 74 65 58 28 63 61 6c 63 translateX(calc
00039e00: 28 2d 31 20 2a 20 76 61 72 28 2d 2d 73 70 61 63 (-1 * var(--spac
00039e10: 65 2d 33 29 29 60 7d 2c 6f 6e 50 6f 69 6e 74 65 e-3))`},onPointe
00039e20: 72 44 6f 77 6e 3a 63 2c 63 68 69 6c 64 72 65 6e rDown:c,children
00039e30: 3a 28 30 2c 51 63 2e 6a 73 78 29 28 22 64 69 76 :(0,Qc.jsx)("div
00039e40: 22 2c 7b 63 6c 61 73 73 4e 61 6d 65 3a 22 74 6c ",{className:"tl
00039e50: 2d 66 72 61 6d 65 2d 68 65 61 64 69 6e 67 2d 68 -frame-heading-h
00039e60: 69 74 2d 61 72 65 61 22 2c 63 68 69 6c 64 72 65 it-area",childre
00039e70: 6e 3a 28 30 2c 51 63 2e 6a 73 78 29 28 70 53 2c n:(0,Qc.jsx)(pS,
00039e80: 7b 72 65 66 3a 6c 2c 69 64 3a 65 2c 6e 61 6d 65 {ref:l,id:e,name
00039e90: 3a 74 2c 69 73 45 64 69 74 69 6e 67 3a 73 7d 29 :t,isEditing:s})
00039ea0: 7d 29 7d 29 7d 3b 66 75 6e 63 74 69 6f 6e 20 68 })})};function h
00039eb0: 53 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 65 2e S(e,t){return e.
00039ec0: 6d 61 74 63 68 28 2f 5e 5c 73 2a 24 2f 29 3f 74 match(/^\s*$/)?t
00039ed0: 3a 65 7d 66 75 6e 63 74 69 6f 6e 20 6d 53 28 65 :e}function mS(e
00039ee0: 2c 74 29 7b 72 65 74 75 72 6e 20 65 3e 74 3f 32 ,t){return e>t?2
00039ef0: 2a 28 64 75 2a 28 74 2f 32 29 2b 28 65 2d 74 29 *(du*(t/2)+(e-t)
00039f00: 29 3a 32 2a 28 64 75 2a 28 65 2f 32 29 2b 28 74 ):2*(du*(e/2)+(t
00039f10: 2d 65 29 29 7d 66 75 6e 63 74 69 6f 6e 20 67 53 -e))}function gS
00039f20: 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 62 53 28 (e,t){return bS(
00039f30: 65 2c 74 29 2e 6d 61 70 28 28 28 65 2c 74 29 3d e,t).map(((e,t)=
00039f40: 3e 65 2e 67 65 74 53 76 67 50 61 74 68 44 61 74 >e.getSvgPathDat
00039f50: 61 28 30 3d 3d 3d 74 29 29 29 2e 6a 6f 69 6e 28 a(0===t))).join(
00039f60: 22 20 22 29 2b 22 20 5a 22 7d 66 75 6e 63 74 69 " ")+" Z"}functi
00039f70: 6f 6e 20 62 53 28 65 2c 74 29 7b 63 6f 6e 73 74 on bS(e,t){const
00039f80: 20 6e 3d 65 2f 34 2c 72 3d 74 2f 34 3b 72 65 74 n=e/4,r=t/4;ret
00039f90: 75 72 6e 5b 6e 65 77 20 6a 67 28 7b 73 74 61 72 urn[new jg({star
00039fa0: 74 3a 6e 65 77 20 73 75 28 65 2f 32 2c 74 29 2c t:new su(e/2,t),
00039fb0: 63 70 31 3a 6e 65 77 20 73 75 28 31 2e 35 2a 6e cp1:new su(1.5*n
00039fc0: 2c 33 2a 72 29 2c 63 70 32 3a 6e 65 77 20 73 75 ,3*r),cp2:new su
00039fd0: 28 30 2c 32 2e 35 2a 72 29 2c 65 6e 64 3a 6e 65 (0,2.5*r),end:ne
00039fe0: 77 20 73 75 28 30 2c 31 2e 32 2a 72 29 7d 29 2c w su(0,1.2*r)}),
00039ff0: 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a 6e 65 new jg({start:ne
0003a000: 77 20 73 75 28 30 2c 31 2e 32 2a 72 29 2c 63 70 w su(0,1.2*r),cp
0003a010: 31 3a 6e 65 77 20 73 75 28 30 2c 2e 33 32 2a 2d 1:new su(0,.32*-
0003a020: 72 29 2c 63 70 32 3a 6e 65 77 20 73 75 28 31 2e r),cp2:new su(1.
0003a030: 38 35 2a 6e 2c 2e 33 32 2a 2d 72 29 2c 65 6e 64 85*n,.32*-r),end
0003a040: 3a 6e 65 77 20 73 75 28 65 2f 32 2c 2e 39 2a 72 :new su(e/2,.9*r
0003a050: 29 7d 29 2c 6e 65 77 20 6a 67 28 7b 73 74 61 72 )}),new jg({star
0003a060: 74 3a 6e 65 77 20 73 75 28 65 2f 32 2c 2e 39 2a t:new su(e/2,.9*
0003a070: 72 29 2c 63 70 31 3a 6e 65 77 20 73 75 28 32 2e r),cp1:new su(2.
0003a080: 31 35 2a 6e 2c 2e 33 32 2a 2d 72 29 2c 63 70 32 15*n,.32*-r),cp2
0003a090: 3a 6e 65 77 20 73 75 28 65 2c 2e 33 32 2a 2d 72 :new su(e,.32*-r
0003a0a0: 29 2c 65 6e 64 3a 6e 65 77 20 73 75 28 65 2c 31 ),end:new su(e,1
0003a0b0: 2e 32 2a 72 29 7d 29 2c 6e 65 77 20 6a 67 28 7b .2*r)}),new jg({
0003a0c0: 73 74 61 72 74 3a 6e 65 77 20 73 75 28 65 2c 31 start:new su(e,1
0003a0d0: 2e 32 2a 72 29 2c 63 70 31 3a 6e 65 77 20 73 75 .2*r),cp1:new su
0003a0e0: 28 65 2c 32 2e 35 2a 72 29 2c 63 70 32 3a 6e 65 (e,2.5*r),cp2:ne
0003a0f0: 77 20 73 75 28 32 2e 35 2a 6e 2c 33 2a 72 29 2c w su(2.5*n,3*r),
0003a100: 65 6e 64 3a 6e 65 77 20 73 75 28 65 2f 32 2c 74 end:new su(e/2,t
0003a110: 29 7d 29 5d 7d 66 75 6e 63 74 69 6f 6e 20 79 53 )})]}function yS
0003a120: 28 65 2c 74 2c 6e 2c 72 29 7b 72 65 74 75 72 6e (e,t,n,r){return
0003a130: 20 58 76 28 66 75 6e 63 74 69 6f 6e 28 65 2c 74 Xv(function(e,t
0003a140: 2c 6e 2c 72 29 7b 63 6f 6e 73 74 20 6f 3d 6d 6f ,n,r){const o=mo
0003a150: 28 65 29 2c 69 3d 74 2f 32 2c 61 3d 6e 2f 32 2c (e),i=t/2,a=n/2,
0003a160: 73 3d 79 75 28 69 2c 61 29 2c 6c 3d 5b 5d 2c 63 s=yu(i,a),l=[],c
0003a170: 3d 66 75 2a 6f 28 29 2c 75 3d 66 75 2b 70 75 2f =fu*o(),u=fu+pu/
0003a180: 32 2b 4d 61 74 68 2e 61 62 73 28 6f 28 29 29 2a 2+Math.abs(o())*
0003a190: 70 75 2c 64 3d 4d 61 74 68 2e 6d 61 78 28 31 36 pu,d=Math.max(16
0003a1a0: 2c 73 2f 31 30 29 3b 66 6f 72 28 6c 65 74 20 65 ,s/10);for(let e
0003a1b0: 3d 30 3b 65 3c 64 3b 65 2b 2b 29 7b 63 6f 6e 73 =0;e<d;e++){cons
0003a1c0: 74 20 72 3d 65 2f 28 64 2d 31 29 2c 73 3d 63 2b t r=e/(d-1),s=c+
0003a1d0: 72 2a 75 2c 70 3d 4d 61 74 68 2e 63 6f 73 28 73 r*u,p=Math.cos(s
0003a1e0: 29 2c 66 3d 4d 61 74 68 2e 73 69 6e 28 73 29 3b ),f=Math.sin(s);
0003a1f0: 6c 2e 70 75 73 68 28 6e 65 77 20 73 75 28 69 2a l.push(new su(i*
0003a200: 70 2b 2e 35 2a 74 2b 2e 30 35 2a 6f 28 29 2c 61 p+.5*t+.05*o(),a
0003a210: 2a 66 2b 6e 2f 32 2b 2e 30 35 2a 6f 28 29 2c 4d *f+n/2+.05*o(),M
0003a220: 61 74 68 2e 6d 69 6e 28 31 2c 2e 35 2b 4d 61 74 ath.min(1,.5+Mat
0003a230: 68 2e 61 62 73 28 2e 35 2d 28 6f 28 29 3e 30 3f h.abs(.5-(o()>0?
0003a240: 61 75 2e 65 61 73 65 49 6e 4f 75 74 53 69 6e 65 au.easeInOutSine
0003a250: 28 72 29 3a 61 75 2e 65 61 73 65 49 6e 45 78 70 (r):au.easeInExp
0003a260: 6f 28 72 29 29 29 2f 32 29 29 29 7d 72 65 74 75 o(r)))/2)))}retu
0003a270: 72 6e 20 4a 67 28 6c 2c 66 75 6e 63 74 69 6f 6e rn Jg(l,function
0003a280: 28 65 29 7b 72 65 74 75 72 6e 7b 73 69 7a 65 3a (e){return{size:
0003a290: 31 2b 65 2c 74 68 69 6e 6e 69 6e 67 3a 2e 32 35 1+e,thinning:.25
0003a2a0: 2c 65 6e 64 3a 7b 74 61 70 65 72 3a 65 7d 2c 73 ,end:{taper:e},s
0003a2b0: 74 61 72 74 3a 7b 74 61 70 65 72 3a 65 7d 2c 73 tart:{taper:e},s
0003a2c0: 74 72 65 61 6d 6c 69 6e 65 3a 30 2c 73 6d 6f 6f treamline:0,smoo
0003a2d0: 74 68 69 6e 67 3a 31 2c 73 69 6d 75 6c 61 74 65 thing:1,simulate
0003a2e0: 50 72 65 73 73 75 72 65 3a 21 31 7d 7d 28 72 29 Pressure:!1}}(r)
0003a2f0: 29 7d 28 65 2c 74 2c 6e 2c 72 29 29 7d 66 75 6e )}(e,t,n,r))}fun
0003a300: 63 74 69 6f 6e 20 76 53 28 65 29 7b 6c 65 74 20 ction vS(e){let
0003a310: 74 3d 22 4d 22 3b 6c 65 74 20 6e 2c 72 2c 6f 3b t="M";let n,r,o;
0003a320: 66 6f 72 28 6c 65 74 20 69 3d 30 2c 61 3d 65 2e for(let i=0,a=e.
0003a330: 6c 65 6e 67 74 68 3b 69 3c 61 3b 69 2b 3d 33 29 length;i<a;i+=3)
0003a340: 6e 3d 65 5b 69 5d 2c 72 3d 65 5b 69 2b 31 5d 2c n=e[i],r=e[i+1],
0003a350: 6f 3d 65 5b 69 2b 32 5d 2c 74 2b 3d 60 24 7b 63 o=e[i+2],t+=`${c
0003a360: 75 28 6e 29 7d 4c 24 7b 63 75 28 72 29 7d 51 24 u(n)}L${cu(r)}Q$
0003a370: 7b 63 75 28 6f 29 7d 60 3b 72 65 74 75 72 6e 20 {cu(o)}`;return
0003a380: 74 2b 3d 60 24 7b 63 75 28 65 5b 30 5d 29 7d 60 t+=`${cu(e[0])}`
0003a390: 2c 74 7d 66 75 6e 63 74 69 6f 6e 20 53 53 28 65 ,t}function SS(e
0003a3a0: 2c 74 2c 6e 2c 72 2c 6f 29 7b 63 6f 6e 73 74 20 ,t,n,r,o){const
0003a3b0: 69 3d 5b 5d 2c 61 3d 6d 6f 28 65 29 3b 6c 65 74 i=[],a=mo(e);let
0003a3c0: 20 73 2c 6c 3d 74 5b 30 5d 3b 63 6f 6e 73 74 20 s,l=t[0];const
0003a3d0: 63 3d 74 2e 6c 65 6e 67 74 68 3b 66 6f 72 28 6c c=t.length;for(l
0003a3e0: 65 74 20 65 3d 30 2c 75 3d 63 2a 6f 3b 65 3c 75 et e=0,u=c*o;e<u
0003a3f0: 3b 65 2b 2b 29 7b 73 3d 73 75 2e 41 64 64 58 59 ;e++){s=su.AddXY
0003a400: 28 74 5b 28 65 2b 31 29 25 63 5d 2c 61 28 29 2a (t[(e+1)%c],a()*
0003a410: 6e 2c 61 28 29 2a 6e 29 3b 63 6f 6e 73 74 20 6f n,a()*n);const o
0003a420: 3d 73 75 2e 53 75 62 28 73 2c 6c 29 2c 75 3d 73 =su.Sub(s,l),u=s
0003a430: 75 2e 4c 65 6e 28 6f 29 2c 64 3d 73 75 2e 44 69 u.Len(o),d=su.Di
0003a440: 76 28 6f 2c 75 29 2e 6d 75 6c 28 4d 61 74 68 2e v(o,u).mul(Math.
0003a450: 6d 69 6e 28 75 2f 34 2c 72 29 29 3b 69 2e 70 75 min(u/4,r));i.pu
0003a460: 73 68 28 73 75 2e 41 64 64 28 6c 2c 64 29 2c 73 sh(su.Add(l,d),s
0003a470: 75 2e 41 64 64 28 73 2c 64 2e 6e 65 67 28 29 29 u.Add(s,d.neg())
0003a480: 2c 73 29 2c 6c 3d 73 7d 72 65 74 75 72 6e 20 69 ,s),l=s}return i
0003a490: 7d 63 6f 6e 73 74 20 5f 53 3d 7b 73 3a 35 30 2c }const _S={s:50,
0003a4a0: 6d 3a 37 30 2c 6c 3a 31 30 30 2c 78 6c 3a 31 33 m:70,l:100,xl:13
0003a4b0: 30 7d 2c 45 53 3d 2e 32 3b 66 75 6e 63 74 69 6f 0},ES=.2;functio
0003a4c0: 6e 20 77 53 28 65 2c 74 2c 6e 2c 72 29 7b 63 6f n wS(e,t,n,r){co
0003a4d0: 6e 73 74 20 6f 3d 6d 6f 28 6e 29 2c 69 3d 6d 53 nst o=mo(n),i=mS
0003a4e0: 28 65 2c 74 29 2c 61 3d 4d 61 74 68 2e 6d 61 78 (e,t),a=Math.max
0003a4f0: 28 4d 61 74 68 2e 63 65 69 6c 28 69 2f 5f 53 5b (Math.ceil(i/_S[
0003a500: 72 5d 29 2c 36 2c 4d 61 74 68 2e 63 65 69 6c 28 r]),6,Math.ceil(
0003a510: 69 2f 4d 61 74 68 2e 6d 69 6e 28 65 2c 74 29 29 i/Math.min(e,t))
0003a520: 29 2c 73 3d 69 2f 61 2a 45 53 2c 6c 3d 4d 61 74 ),s=i/a*ES,l=Mat
0003a530: 68 2e 6d 61 78 28 65 2d 32 2a 73 2c 31 29 2c 63 h.max(e-2*s,1),c
0003a540: 3d 4d 61 74 68 2e 6d 61 78 28 74 2d 32 2a 73 2c =Math.max(t-2*s,
0003a550: 31 29 2c 75 3d 6d 53 28 6c 2c 63 29 2f 61 2c 64 1),u=mS(l,c)/a,d
0003a560: 3d 28 65 2d 6c 29 2f 32 2c 70 3d 28 74 2d 63 29 =(e-l)/2,p=(t-c)
0003a570: 2f 32 2c 66 3d 66 75 6e 63 74 69 6f 6e 28 65 2c /2,f=function(e,
0003a580: 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 4d 61 74 t,n){const r=Mat
0003a590: 68 2e 6d 69 6e 28 65 2c 74 29 2f 32 2c 6f 3d 4d h.min(e,t)/2,o=M
0003a5a0: 61 74 68 2e 6d 61 78 28 65 2c 74 29 2d 32 2a 72 ath.max(e,t)-2*r
0003a5b0: 2c 69 3d 28 4d 61 74 68 2e 50 49 2a 28 32 2a 72 ,i=(Math.PI*(2*r
0003a5c0: 29 2b 32 2a 6f 29 2f 6e 2c 61 3d 65 3e 74 3f 5b )+2*o)/n,a=e>t?[
0003a5d0: 7b 74 79 70 65 3a 22 73 74 72 61 69 67 68 74 22 {type:"straight"
0003a5e0: 2c 73 74 61 72 74 3a 6e 65 77 20 73 75 28 72 2c ,start:new su(r,
0003a5f0: 30 29 2c 64 65 6c 74 61 3a 6e 65 77 20 73 75 28 0),delta:new su(
0003a600: 31 2c 30 29 7d 2c 7b 74 79 70 65 3a 22 61 72 63 1,0)},{type:"arc
0003a610: 22 2c 63 65 6e 74 65 72 3a 6e 65 77 20 73 75 28 ",center:new su(
0003a620: 65 2d 72 2c 72 29 2c 73 74 61 72 74 41 6e 67 6c e-r,r),startAngl
0003a630: 65 3a 2d 64 75 2f 32 7d 2c 7b 74 79 70 65 3a 22 e:-du/2},{type:"
0003a640: 73 74 72 61 69 67 68 74 22 2c 73 74 61 72 74 3a straight",start:
0003a650: 6e 65 77 20 73 75 28 65 2d 72 2c 74 29 2c 64 65 new su(e-r,t),de
0003a660: 6c 74 61 3a 6e 65 77 20 73 75 28 2d 31 2c 30 29 lta:new su(-1,0)
0003a670: 7d 2c 7b 74 79 70 65 3a 22 61 72 63 22 2c 63 65 },{type:"arc",ce
0003a680: 6e 74 65 72 3a 6e 65 77 20 73 75 28 72 2c 72 29 nter:new su(r,r)
0003a690: 2c 73 74 61 72 74 41 6e 67 6c 65 3a 64 75 2f 32 ,startAngle:du/2
0003a6a0: 7d 5d 3a 5b 7b 74 79 70 65 3a 22 73 74 72 61 69 }]:[{type:"strai
0003a6b0: 67 68 74 22 2c 73 74 61 72 74 3a 6e 65 77 20 73 ght",start:new s
0003a6c0: 75 28 65 2c 72 29 2c 64 65 6c 74 61 3a 6e 65 77 u(e,r),delta:new
0003a6d0: 20 73 75 28 30 2c 31 29 7d 2c 7b 74 79 70 65 3a su(0,1)},{type:
0003a6e0: 22 61 72 63 22 2c 63 65 6e 74 65 72 3a 6e 65 77 "arc",center:new
0003a6f0: 20 73 75 28 72 2c 74 2d 72 29 2c 73 74 61 72 74 su(r,t-r),start
0003a700: 41 6e 67 6c 65 3a 30 7d 2c 7b 74 79 70 65 3a 22 Angle:0},{type:"
0003a710: 73 74 72 61 69 67 68 74 22 2c 73 74 61 72 74 3a straight",start:
0003a720: 6e 65 77 20 73 75 28 30 2c 74 2d 72 29 2c 64 65 new su(0,t-r),de
0003a730: 6c 74 61 3a 6e 65 77 20 73 75 28 30 2c 2d 31 29 lta:new su(0,-1)
0003a740: 7d 2c 7b 74 79 70 65 3a 22 61 72 63 22 2c 63 65 },{type:"arc",ce
0003a750: 6e 74 65 72 3a 6e 65 77 20 73 75 28 72 2c 72 29 nter:new su(r,r)
0003a760: 2c 73 74 61 72 74 41 6e 67 6c 65 3a 64 75 7d 5d ,startAngle:du}]
0003a770: 3b 6c 65 74 20 73 3d 30 3b 63 6f 6e 73 74 20 6c ;let s=0;const l
0003a780: 3d 5b 5d 3b 66 6f 72 28 6c 65 74 20 65 3d 30 3b =[];for(let e=0;
0003a790: 65 3c 6e 3b 65 2b 2b 29 7b 63 6f 6e 73 74 20 65 e<n;e++){const e
0003a7a0: 3d 61 5b 30 5d 3b 22 73 74 72 61 69 67 68 74 22 =a[0];"straight"
0003a7b0: 3d 3d 3d 65 2e 74 79 70 65 3f 6c 2e 70 75 73 68 ===e.type?l.push
0003a7c0: 28 73 75 2e 41 64 64 28 65 2e 73 74 61 72 74 2c (su.Add(e.start,
0003a7d0: 73 75 2e 4d 75 6c 28 65 2e 64 65 6c 74 61 2c 73 su.Mul(e.delta,s
0003a7e0: 29 29 29 3a 6c 2e 70 75 73 68 28 43 75 28 65 2e ))):l.push(Cu(e.
0003a7f0: 63 65 6e 74 65 72 2c 72 2c 65 2e 73 74 61 72 74 center,r,e.start
0003a800: 41 6e 67 6c 65 2b 73 2f 72 29 29 2c 73 2b 3d 69 Angle+s/r)),s+=i
0003a810: 3b 6c 65 74 20 74 3d 22 73 74 72 61 69 67 68 74 ;let t="straight
0003a820: 22 3d 3d 3d 65 2e 74 79 70 65 3f 6f 3a 64 75 2a "===e.type?o:du*
0003a830: 72 3b 66 6f 72 28 3b 73 3e 74 3b 29 73 2d 3d 74 r;for(;s>t;)s-=t
0003a840: 2c 61 2e 70 75 73 68 28 61 2e 73 68 69 66 74 28 ,a.push(a.shift(
0003a850: 29 29 2c 74 3d 22 73 74 72 61 69 67 68 74 22 3d )),t="straight"=
0003a860: 3d 3d 61 5b 30 5d 2e 74 79 70 65 3f 6f 3a 64 75 ==a[0].type?o:du
0003a870: 2a 72 7d 72 65 74 75 72 6e 20 6c 7d 28 6c 2c 63 *r}return l}(l,c
0003a880: 2c 61 29 2e 6d 61 70 28 28 65 3d 3e 65 2e 61 64 ,a).map((e=>e.ad
0003a890: 64 58 59 28 64 2c 70 29 29 29 2c 68 3d 65 3c 32 dXY(d,p))),h=e<2
0003a8a0: 30 3f 30 3a 2e 33 2a 73 2c 6d 3d 74 3c 32 30 3f 0?0:.3*s,m=t<20?
0003a8b0: 30 3a 2e 33 2a 73 2c 67 3d 66 2e 73 6c 69 63 65 0:.3*s,g=f.slice
0003a8c0: 28 30 29 3b 66 6f 72 28 6c 65 74 20 65 3d 30 3b (0);for(let e=0;
0003a8d0: 65 3c 4d 61 74 68 2e 66 6c 6f 6f 72 28 61 2f 32 e<Math.floor(a/2
0003a8e0: 29 3b 65 2b 2b 29 67 5b 65 5d 3d 73 75 2e 41 64 );e++)g[e]=su.Ad
0003a8f0: 64 58 59 28 67 5b 65 5d 2c 6f 28 29 2a 68 2c 6f dXY(g[e],o()*h,o
0003a900: 28 29 2a 6d 29 2c 67 5b 61 2d 65 2d 31 5d 3d 73 ()*m),g[a-e-1]=s
0003a910: 75 2e 41 64 64 58 59 28 67 5b 61 2d 65 2d 31 5d u.AddXY(g[a-e-1]
0003a920: 2c 6f 28 29 2a 68 2c 6f 28 29 2a 6d 29 3b 63 6f ,o()*h,o()*m);co
0003a930: 6e 73 74 20 62 3d 5b 5d 3b 66 6f 72 28 6c 65 74 nst b=[];for(let
0003a940: 20 6e 3d 30 3b 6e 3c 67 2e 6c 65 6e 67 74 68 3b n=0;n<g.length;
0003a950: 6e 2b 2b 29 7b 63 6f 6e 73 74 20 72 3d 6e 3d 3d n++){const r=n==
0003a960: 3d 67 2e 6c 65 6e 67 74 68 2d 31 3f 30 3a 6e 2b =g.length-1?0:n+
0003a970: 31 2c 6f 3d 67 5b 6e 5d 2c 69 3d 67 5b 72 5d 2c 1,o=g[n],i=g[r],
0003a980: 61 3d 66 5b 6e 5d 2c 73 3d 66 5b 72 5d 2c 6c 3d a=f[n],s=f[r],l=
0003a990: 73 75 2e 44 69 73 74 28 61 2c 73 29 2c 63 3d 75 su.Dist(a,s),c=u
0003a9a0: 2d 6c 2c 68 3d 73 75 2e 44 69 73 74 28 6f 2c 69 -l,h=su.Dist(o,i
0003a9b0: 29 2f 6c 2c 6d 3d 28 4d 61 74 68 2e 6d 61 78 28 )/l,m=(Math.max(
0003a9c0: 64 2c 70 29 2b 63 29 2a 68 2c 79 3d 73 75 2e 4c d,p)+c)*h,y=su.L
0003a9d0: 72 70 28 61 2c 73 2c 2e 35 29 2e 61 64 64 28 73 rp(a,s,.5).add(s
0003a9e0: 75 2e 53 75 62 28 73 2c 61 29 2e 75 6e 69 28 29 u.Sub(s,a).uni()
0003a9f0: 2e 70 65 72 28 29 2e 6d 75 6c 28 6d 29 29 3b 79 .per().mul(m));y
0003aa00: 2e 78 3c 30 3f 79 2e 78 3d 30 3a 79 2e 78 3e 65 .x<0?y.x=0:y.x>e
0003aa10: 26 26 28 79 2e 78 3d 65 29 2c 79 2e 79 3c 30 3f &&(y.x=e),y.y<0?
0003aa20: 79 2e 79 3d 30 3a 79 2e 79 3e 74 26 26 28 79 2e y.y=0:y.y>t&&(y.
0003aa30: 79 3d 74 29 3b 63 6f 6e 73 74 20 76 3d 46 75 28 y=t);const v=Fu(
0003aa40: 6f 2c 69 2c 79 29 2c 53 3d 73 75 2e 44 69 73 74 o,i,y),S=su.Dist
0003aa50: 28 76 7c 7c 73 75 2e 41 76 65 72 61 67 65 28 5b (v||su.Average([
0003aa60: 6f 2c 69 5d 29 2c 6f 29 3b 62 2e 70 75 73 68 28 o,i]),o);b.push(
0003aa70: 7b 6c 65 66 74 50 6f 69 6e 74 3a 6f 2c 72 69 67 {leftPoint:o,rig
0003aa80: 68 74 50 6f 69 6e 74 3a 69 2c 61 72 63 50 6f 69 htPoint:i,arcPoi
0003aa90: 6e 74 3a 79 2c 63 65 6e 74 65 72 3a 76 2c 72 61 nt:y,center:v,ra
0003aaa0: 64 69 75 73 3a 53 7d 29 7d 72 65 74 75 72 6e 20 dius:S})}return
0003aab0: 62 7d 66 75 6e 63 74 69 6f 6e 20 78 53 28 65 2c b}function xS(e,
0003aac0: 74 2c 6e 2c 72 29 7b 63 6f 6e 73 74 20 6f 3d 5b t,n,r){const o=[
0003aad0: 5d 2c 69 3d 77 53 28 65 2c 74 2c 6e 2c 72 29 3b ],i=wS(e,t,n,r);
0003aae0: 66 6f 72 28 63 6f 6e 73 74 7b 63 65 6e 74 65 72 for(const{center
0003aaf0: 3a 65 2c 72 61 64 69 75 73 3a 74 2c 6c 65 66 74 :e,radius:t,left
0003ab00: 50 6f 69 6e 74 3a 6e 2c 72 69 67 68 74 50 6f 69 Point:n,rightPoi
0003ab10: 6e 74 3a 72 7d 6f 66 20 69 29 6f 2e 70 75 73 68 nt:r}of i)o.push
0003ab20: 28 2e 2e 2e 6a 75 28 6e 2c 72 2c 65 2c 74 2c 31 (...ju(n,r,e,t,1
0003ab30: 30 29 29 3b 72 65 74 75 72 6e 20 6f 7d 66 75 6e 0));return o}fun
0003ab40: 63 74 69 6f 6e 20 54 53 28 65 2c 74 2c 6e 2c 72 ction TS(e,t,n,r
0003ab50: 29 7b 63 6f 6e 73 74 20 6f 3d 77 53 28 65 2c 74 ){const o=wS(e,t
0003ab60: 2c 6e 2c 72 29 3b 6c 65 74 20 69 3d 60 4d 24 7b ,n,r);let i=`M${
0003ab70: 6f 5b 30 5d 2e 6c 65 66 74 50 6f 69 6e 74 2e 74 o[0].leftPoint.t
0003ab80: 6f 46 69 78 65 64 28 29 7d 60 3b 66 6f 72 28 63 oFixed()}`;for(c
0003ab90: 6f 6e 73 74 7b 6c 65 66 74 50 6f 69 6e 74 3a 65 onst{leftPoint:e
0003aba0: 2c 72 69 67 68 74 50 6f 69 6e 74 3a 74 2c 72 61 ,rightPoint:t,ra
0003abb0: 64 69 75 73 3a 6e 2c 63 65 6e 74 65 72 3a 72 7d dius:n,center:r}
0003abc0: 6f 66 20 6f 29 7b 69 66 28 6e 75 6c 6c 3d 3d 3d of o){if(null===
0003abd0: 72 29 7b 69 2b 3d 60 20 4c 24 7b 74 2e 74 6f 46 r){i+=` L${t.toF
0003abe0: 69 78 65 64 28 29 7d 60 3b 63 6f 6e 74 69 6e 75 ixed()}`;continu
0003abf0: 65 7d 63 6f 6e 73 74 20 6f 3d 73 75 2e 43 6c 6f e}const o=su.Clo
0003ac00: 63 6b 77 69 73 65 28 65 2c 74 2c 72 29 3f 22 30 ckwise(e,t,r)?"0
0003ac10: 22 3a 22 31 22 3b 69 2b 3d 60 20 41 24 7b 4e 75 ":"1";i+=` A${Nu
0003ac20: 28 6e 29 7d 2c 24 7b 4e 75 28 6e 29 7d 20 30 20 (n)},${Nu(n)} 0
0003ac30: 24 7b 6f 7d 2c 31 20 24 7b 74 2e 74 6f 46 69 78 ${o},1 ${t.toFix
0003ac40: 65 64 28 29 7d 60 7d 72 65 74 75 72 6e 20 69 2b ed()}`}return i+
0003ac50: 3d 22 20 5a 22 2c 69 7d 63 6f 6e 73 74 20 43 53 =" Z",i}const CS
0003ac60: 3d 7b 73 3a 2e 35 2c 6d 3a 2e 37 2c 6c 3a 2e 39 ={s:.5,m:.7,l:.9
0003ac70: 2c 78 6c 3a 31 2e 36 7d 3b 66 75 6e 63 74 69 6f ,xl:1.6};functio
0003ac80: 6e 20 6b 53 28 65 2c 74 29 7b 73 77 69 74 63 68 n kS(e,t){switch
0003ac90: 28 65 2e 67 65 6f 29 7b 63 61 73 65 22 78 2d 62 (e.geo){case"x-b
0003aca0: 6f 78 22 3a 72 65 74 75 72 6e 20 66 75 6e 63 74 ox":return funct
0003acb0: 69 6f 6e 28 65 2c 74 2c 6e 2c 72 29 7b 63 6f 6e ion(e,t,n,r){con
0003acc0: 73 74 20 6f 3d 22 64 72 61 77 22 3d 3d 3d 72 3f st o="draw"===r?
0003acd0: 2e 36 32 3a 30 3b 69 66 28 22 64 61 73 68 65 64 .62:0;if("dashed
0003ace0: 22 3d 3d 3d 72 29 72 65 74 75 72 6e 5b 5b 6e 65 "===r)return[[ne
0003acf0: 77 20 73 75 28 30 2c 30 29 2c 6e 65 77 20 73 75 w su(0,0),new su
0003ad00: 28 65 2f 32 2c 74 2f 32 29 5d 2c 5b 6e 65 77 20 (e/2,t/2)],[new
0003ad10: 73 75 28 65 2c 74 29 2c 6e 65 77 20 73 75 28 65 su(e,t),new su(e
0003ad20: 2f 32 2c 74 2f 32 29 5d 2c 5b 6e 65 77 20 73 75 /2,t/2)],[new su
0003ad30: 28 30 2c 74 29 2c 6e 65 77 20 73 75 28 65 2f 32 (0,t),new su(e/2
0003ad40: 2c 74 2f 32 29 5d 2c 5b 6e 65 77 20 73 75 28 65 ,t/2)],[new su(e
0003ad50: 2c 30 29 2c 6e 65 77 20 73 75 28 65 2f 32 2c 74 ,0),new su(e/2,t
0003ad60: 2f 32 29 5d 5d 3b 63 6f 6e 73 74 20 69 3d 74 3d /2)]];const i=t=
0003ad70: 3e 4d 61 74 68 2e 6d 61 78 28 30 2c 4d 61 74 68 >Math.max(0,Math
0003ad80: 2e 6d 69 6e 28 65 2c 74 29 29 2c 61 3d 65 3d 3e .min(e,t)),a=e=>
0003ad90: 4d 61 74 68 2e 6d 61 78 28 30 2c 4d 61 74 68 2e Math.max(0,Math.
0003ada0: 6d 69 6e 28 74 2c 65 29 29 3b 72 65 74 75 72 6e min(t,e));return
0003adb0: 5b 5b 6e 65 77 20 73 75 28 69 28 6e 2a 6f 29 2c [[new su(i(n*o),
0003adc0: 61 28 6e 2a 6f 29 29 2c 6e 65 77 20 73 75 28 69 a(n*o)),new su(i
0003add0: 28 65 2d 6e 2a 6f 29 2c 61 28 74 2d 6e 2a 6f 29 (e-n*o),a(t-n*o)
0003ade0: 29 5d 2c 5b 6e 65 77 20 73 75 28 69 28 6e 2a 6f )],[new su(i(n*o
0003adf0: 29 2c 61 28 74 2d 6e 2a 6f 29 29 2c 6e 65 77 20 ),a(t-n*o)),new
0003ae00: 73 75 28 69 28 65 2d 6e 2a 6f 29 2c 61 28 6e 2a su(i(e-n*o),a(n*
0003ae10: 6f 29 29 5d 5d 7d 28 65 2e 77 2c 65 2e 68 2c 74 o))]]}(e.w,e.h,t
0003ae20: 2c 65 2e 64 61 73 68 29 3b 63 61 73 65 22 63 68 ,e.dash);case"ch
0003ae30: 65 63 6b 2d 62 6f 78 22 3a 72 65 74 75 72 6e 20 eck-box":return
0003ae40: 66 75 6e 63 74 69 6f 6e 28 65 2c 74 29 7b 63 6f function(e,t){co
0003ae50: 6e 73 74 20 6e 3d 2e 38 32 2a 4d 61 74 68 2e 6d nst n=.82*Math.m
0003ae60: 69 6e 28 65 2c 74 29 2c 72 3d 28 65 2d 6e 29 2f in(e,t),r=(e-n)/
0003ae70: 32 2c 6f 3d 28 74 2d 6e 29 2f 32 2c 69 3d 74 3d 2,o=(t-n)/2,i=t=
0003ae80: 3e 4d 61 74 68 2e 6d 61 78 28 30 2c 4d 61 74 68 >Math.max(0,Math
0003ae90: 2e 6d 69 6e 28 65 2c 74 29 29 2c 61 3d 65 3d 3e .min(e,t)),a=e=>
0003aea0: 4d 61 74 68 2e 6d 61 78 28 30 2c 4d 61 74 68 2e Math.max(0,Math.
0003aeb0: 6d 69 6e 28 74 2c 65 29 29 3b 72 65 74 75 72 6e min(t,e));return
0003aec0: 5b 5b 6e 65 77 20 73 75 28 69 28 72 2b 2e 32 35 [[new su(i(r+.25
0003aed0: 2a 6e 29 2c 61 28 6f 2b 2e 35 32 2a 6e 29 29 2c *n),a(o+.52*n)),
0003aee0: 6e 65 77 20 73 75 28 69 28 72 2b 2e 34 35 2a 6e new su(i(r+.45*n
0003aef0: 29 2c 61 28 6f 2b 2e 38 32 2a 6e 29 29 5d 2c 5b ),a(o+.82*n))],[
0003af00: 6e 65 77 20 73 75 28 69 28 72 2b 2e 34 35 2a 6e new su(i(r+.45*n
0003af10: 29 2c 61 28 6f 2b 2e 38 32 2a 6e 29 29 2c 6e 65 ),a(o+.82*n)),ne
0003af20: 77 20 73 75 28 69 28 72 2b 2e 38 32 2a 6e 29 2c w su(i(r+.82*n),
0003af30: 61 28 6f 2b 2e 32 32 2a 6e 29 29 5d 5d 7d 28 65 a(o+.22*n))]]}(e
0003af40: 2e 77 2c 65 2e 68 29 3b 64 65 66 61 75 6c 74 3a .w,e.h);default:
0003af50: 72 65 74 75 72 6e 7d 7d 66 75 6e 63 74 69 6f 6e return}}function
0003af60: 20 41 53 28 7b 73 68 61 70 65 3a 65 2c 73 68 6f AS({shape:e,sho
0003af70: 75 6c 64 53 63 61 6c 65 3a 74 7d 29 7b 63 6f 6e uldScale:t}){con
0003af80: 73 74 20 6e 3d 74 3f 65 2e 70 72 6f 70 73 2e 73 st n=t?e.props.s
0003af90: 63 61 6c 65 3a 31 2c 72 3d 72 75 28 29 2c 6f 3d cale:1,r=ru(),o=
0003afa0: 51 79 28 29 2c 7b 69 64 3a 69 2c 70 72 6f 70 73 Qy(),{id:i,props
0003afb0: 3a 61 7d 3d 65 2c 7b 77 3a 73 2c 63 6f 6c 6f 72 :a}=e,{w:s,color
0003afc0: 3a 6c 2c 66 69 6c 6c 3a 63 2c 64 61 73 68 3a 75 :l,fill:c,dash:u
0003afd0: 2c 67 72 6f 77 59 3a 64 2c 73 69 7a 65 3a 70 7d ,growY:d,size:p}
0003afe0: 3d 61 2c 66 3d 50 62 5b 70 5d 2a 6e 2c 68 3d 61 =a,f=Pb[p]*n,h=a
0003aff0: 2e 68 2b 64 3b 73 77 69 74 63 68 28 61 2e 67 65 .h+d;switch(a.ge
0003b000: 6f 29 7b 63 61 73 65 22 63 6c 6f 75 64 22 3a 69 o){case"cloud":i
0003b010: 66 28 22 73 6f 6c 69 64 22 3d 3d 3d 75 29 7b 63 f("solid"===u){c
0003b020: 6f 6e 73 74 20 65 3d 54 53 28 73 2c 68 2c 69 2c onst e=TS(s,h,i,
0003b030: 70 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a p);return(0,Qc.j
0003b040: 73 78 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 sxs)(Qc.Fragment
0003b050: 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 ,{children:[(0,Q
0003b060: 63 2e 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 c.jsx)(pv,{theme
0003b070: 3a 6f 2c 64 3a 65 2c 63 6f 6c 6f 72 3a 6c 2c 66 :o,d:e,color:l,f
0003b080: 69 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e 7d 29 2c ill:c,scale:n}),
0003b090: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 (0,Qc.jsx)("path
0003b0a0: 22 2c 7b 64 3a 65 2c 73 74 72 6f 6b 65 3a 6f 5b ",{d:e,stroke:o[
0003b0b0: 6c 5d 2e 73 6f 6c 69 64 2c 73 74 72 6f 6b 65 57 l].solid,strokeW
0003b0c0: 69 64 74 68 3a 66 2c 66 69 6c 6c 3a 22 6e 6f 6e idth:f,fill:"non
0003b0d0: 65 22 7d 29 5d 7d 29 7d 69 66 28 22 64 72 61 77 e"})]})}if("draw
0003b0e0: 22 3d 3d 3d 75 29 7b 63 6f 6e 73 74 20 65 3d 66 "===u){const e=f
0003b0f0: 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c 72 29 unction(e,t,n,r)
0003b100: 7b 63 6f 6e 73 74 20 6f 3d 6d 6f 28 6e 29 2c 69 {const o=mo(n),i
0003b110: 3d 43 53 5b 72 5d 2c 61 3d 77 53 28 65 2c 74 2c =CS[r],a=wS(e,t,
0003b120: 6e 2c 72 29 2c 73 3d 61 2e 72 65 64 75 63 65 28 n,r),s=a.reduce(
0003b130: 28 28 65 2c 74 29 3d 3e 65 2b 73 75 2e 44 69 73 ((e,t)=>e+su.Dis
0003b140: 74 32 28 74 2e 6c 65 66 74 50 6f 69 6e 74 2c 74 t2(t.leftPoint,t
0003b150: 2e 72 69 67 68 74 50 6f 69 6e 74 29 29 2c 30 29 .rightPoint)),0)
0003b160: 2f 61 2e 6c 65 6e 67 74 68 3e 28 31 35 2a 69 29 /a.length>(15*i)
0003b170: 2a 2a 32 3f 65 3d 3e 65 2e 61 64 64 58 59 28 6f **2?e=>e.addXY(o
0003b180: 28 29 2a 69 2a 32 2c 6f 28 29 2a 69 2a 32 29 3a ()*i*2,o()*i*2):
0003b190: 65 3d 3e 65 3b 6c 65 74 20 6c 3d 60 4d 24 7b 61 e=>e;let l=`M${a
0003b1a0: 5b 30 5d 2e 6c 65 66 74 50 6f 69 6e 74 2e 74 6f [0].leftPoint.to
0003b1b0: 46 69 78 65 64 28 29 7d 60 2c 63 3d 73 28 61 5b Fixed()}`,c=s(a[
0003b1c0: 30 5d 2e 6c 65 66 74 50 6f 69 6e 74 29 2c 75 3d 0].leftPoint),u=
0003b1d0: 60 4d 24 7b 63 2e 74 6f 46 69 78 65 64 28 29 7d `M${c.toFixed()}
0003b1e0: 60 3b 66 6f 72 28 63 6f 6e 73 74 7b 6c 65 66 74 `;for(const{left
0003b1f0: 50 6f 69 6e 74 3a 65 2c 63 65 6e 74 65 72 3a 74 Point:e,center:t
0003b200: 2c 72 69 67 68 74 50 6f 69 6e 74 3a 6e 2c 72 61 ,rightPoint:n,ra
0003b210: 64 69 75 73 3a 72 2c 61 72 63 50 6f 69 6e 74 3a dius:r,arcPoint:
0003b220: 6f 7d 6f 66 20 61 29 7b 69 66 28 6e 75 6c 6c 3d o}of a){if(null=
0003b230: 3d 3d 74 29 7b 6c 2b 3d 60 20 4c 24 7b 6e 2e 74 ==t){l+=` L${n.t
0003b240: 6f 46 69 78 65 64 28 29 7d 60 3b 63 6f 6e 73 74 oFixed()}`;const
0003b250: 20 65 3d 73 28 6e 29 3b 75 2b 3d 60 20 4c 24 7b e=s(n);u+=` L${
0003b260: 65 2e 74 6f 46 69 78 65 64 28 29 7d 60 2c 63 3d e.toFixed()}`,c=
0003b270: 65 3b 63 6f 6e 74 69 6e 75 65 7d 63 6f 6e 73 74 e;continue}const
0003b280: 20 69 3d 73 75 2e 43 6c 6f 63 6b 77 69 73 65 28 i=su.Clockwise(
0003b290: 65 2c 6e 2c 74 29 3f 22 30 22 3a 22 31 22 3b 6c e,n,t)?"0":"1";l
0003b2a0: 2b 3d 60 20 41 24 7b 4e 75 28 72 29 7d 2c 24 7b +=` A${Nu(r)},${
0003b2b0: 4e 75 28 72 29 7d 20 30 20 24 7b 69 7d 2c 31 20 Nu(r)} 0 ${i},1
0003b2c0: 24 7b 6e 2e 74 6f 46 69 78 65 64 28 29 7d 60 3b ${n.toFixed()}`;
0003b2d0: 63 6f 6e 73 74 20 61 3d 73 28 6e 29 2c 64 3d 46 const a=s(n),d=F
0003b2e0: 75 28 63 2c 61 2c 73 28 6f 29 29 3b 69 66 28 21 u(c,a,s(o));if(!
0003b2f0: 4e 75 6d 62 65 72 2e 69 73 46 69 6e 69 74 65 28 Number.isFinite(
0003b300: 64 2e 78 29 7c 7c 21 4e 75 6d 62 65 72 2e 69 73 d.x)||!Number.is
0003b310: 46 69 6e 69 74 65 28 64 2e 79 29 29 7b 75 2b 3d Finite(d.y)){u+=
0003b320: 60 20 4c 24 7b 61 2e 74 6f 46 69 78 65 64 28 29 ` L${a.toFixed()
0003b330: 7d 60 2c 63 3d 61 3b 63 6f 6e 74 69 6e 75 65 7d }`,c=a;continue}
0003b340: 63 6f 6e 73 74 20 70 3d 4d 61 74 68 2e 61 62 73 const p=Math.abs
0003b350: 28 73 75 2e 44 69 73 74 28 64 2c 63 29 29 3b 75 (su.Dist(d,c));u
0003b360: 2b 3d 60 20 41 24 7b 4e 75 28 70 29 7d 2c 24 7b +=` A${Nu(p)},${
0003b370: 4e 75 28 70 29 7d 20 30 20 24 7b 69 7d 2c 31 20 Nu(p)} 0 ${i},1
0003b380: 24 7b 61 2e 74 6f 46 69 78 65 64 28 29 7d 60 2c ${a.toFixed()}`,
0003b390: 63 3d 61 7d 72 65 74 75 72 6e 20 6c 2b 75 2b 22 c=a}return l+u+"
0003b3a0: 20 5a 22 7d 28 73 2c 68 2c 69 2c 70 29 3b 72 65 Z"}(s,h,i,p);re
0003b3b0: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 turn(0,Qc.jsxs)(
0003b3c0: 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 Qc.Fragment,{chi
0003b3d0: 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 ldren:[(0,Qc.jsx
0003b3e0: 29 28 70 76 2c 7b 74 68 65 6d 65 3a 6f 2c 64 3a )(pv,{theme:o,d:
0003b3f0: 65 2c 63 6f 6c 6f 72 3a 6c 2c 66 69 6c 6c 3a 63 e,color:l,fill:c
0003b400: 2c 73 63 61 6c 65 3a 6e 7d 29 2c 28 30 2c 51 63 ,scale:n}),(0,Qc
0003b410: 2e 6a 73 78 29 28 22 70 61 74 68 22 2c 7b 64 3a .jsx)("path",{d:
0003b420: 65 2c 73 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f e,stroke:o[l].so
0003b430: 6c 69 64 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a lid,strokeWidth:
0003b440: 66 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 7d 29 5d f,fill:"none"})]
0003b450: 7d 29 7d 7b 63 6f 6e 73 74 20 65 3d 54 53 28 73 })}{const e=TS(s
0003b460: 2c 68 2c 69 2c 70 29 2c 74 3d 77 53 28 73 2c 68 ,h,i,p),t=wS(s,h
0003b470: 2c 69 2c 70 29 3b 72 65 74 75 72 6e 28 30 2c 51 ,i,p);return(0,Q
0003b480: 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 67 6d c.jsxs)(Qc.Fragm
0003b490: 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 ent,{children:[(
0003b4a0: 30 2c 51 63 2e 6a 73 78 29 28 70 76 2c 7b 74 68 0,Qc.jsx)(pv,{th
0003b4b0: 65 6d 65 3a 6f 2c 64 3a 65 2c 63 6f 6c 6f 72 3a eme:o,d:e,color:
0003b4c0: 6c 2c 66 69 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e l,fill:c,scale:n
0003b4d0: 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 }),(0,Qc.jsx)("g
0003b4e0: 22 2c 7b 73 74 72 6f 6b 65 57 69 64 74 68 3a 66 ",{strokeWidth:f
0003b4f0: 2c 73 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c ,stroke:o[l].sol
0003b500: 69 64 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c 70 id,fill:"none",p
0003b510: 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c ointerEvents:"al
0003b520: 6c 22 2c 63 68 69 6c 64 72 65 6e 3a 74 2e 6d 61 l",children:t.ma
0003b530: 70 28 28 28 7b 6c 65 66 74 50 6f 69 6e 74 3a 65 p((({leftPoint:e
0003b540: 2c 72 69 67 68 74 50 6f 69 6e 74 3a 74 2c 63 65 ,rightPoint:t,ce
0003b550: 6e 74 65 72 3a 6e 2c 72 61 64 69 75 73 3a 72 7d nter:n,radius:r}
0003b560: 2c 6f 29 3d 3e 7b 63 6f 6e 73 74 20 69 3d 6e 3f ,o)=>{const i=n?
0003b570: 72 2a 76 75 28 76 75 28 73 75 2e 41 6e 67 6c 65 r*vu(vu(su.Angle
0003b580: 28 6e 2c 74 29 29 2d 76 75 28 73 75 2e 41 6e 67 (n,t))-vu(su.Ang
0003b590: 6c 65 28 6e 2c 65 29 29 29 3a 73 75 2e 44 69 73 le(n,e))):su.Dis
0003b5a0: 74 28 65 2c 74 29 2c 7b 73 74 72 6f 6b 65 44 61 t(e,t),{strokeDa
0003b5b0: 73 68 61 72 72 61 79 3a 61 2c 73 74 72 6f 6b 65 sharray:a,stroke
0003b5c0: 44 61 73 68 6f 66 66 73 65 74 3a 73 7d 3d 79 76 Dashoffset:s}=yv
0003b5d0: 28 69 2c 66 2c 7b 73 74 79 6c 65 3a 75 2c 73 74 (i,f,{style:u,st
0003b5e0: 61 72 74 3a 22 6f 75 74 73 65 74 22 2c 65 6e 64 art:"outset",end
0003b5f0: 3a 22 6f 75 74 73 65 74 22 7d 29 3b 72 65 74 75 :"outset"});retu
0003b600: 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 rn(0,Qc.jsx)("pa
0003b610: 74 68 22 2c 7b 64 3a 6e 3f 60 4d 24 7b 65 2e 78 th",{d:n?`M${e.x
0003b620: 7d 2c 24 7b 65 2e 79 7d 41 24 7b 72 7d 2c 24 7b },${e.y}A${r},${
0003b630: 72 7d 2c 30 2c 30 2c 31 2c 24 7b 74 2e 78 7d 2c r},0,0,1,${t.x},
0003b640: 24 7b 74 2e 79 7d 60 3a 60 4d 24 7b 65 2e 78 7d ${t.y}`:`M${e.x}
0003b650: 2c 24 7b 65 2e 79 7d 4c 24 7b 74 2e 78 7d 2c 24 ,${e.y}L${t.x},$
0003b660: 7b 74 2e 79 7d 60 2c 73 74 72 6f 6b 65 44 61 73 {t.y}`,strokeDas
0003b670: 68 61 72 72 61 79 3a 61 2c 73 74 72 6f 6b 65 44 harray:a,strokeD
0003b680: 61 73 68 6f 66 66 73 65 74 3a 73 7d 2c 6f 29 7d ashoffset:s},o)}
0003b690: 29 29 7d 29 5d 7d 29 7d 63 61 73 65 22 65 6c 6c ))})]})}case"ell
0003b6a0: 69 70 73 65 22 3a 7b 63 6f 6e 73 74 20 69 3d 74 ipse":{const i=t
0003b6b0: 3f 72 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 ?r.getShapeGeome
0003b6c0: 74 72 79 28 65 29 3a 72 2e 67 65 74 53 68 61 70 try(e):r.getShap
0003b6d0: 65 55 74 69 6c 28 65 29 2e 67 65 74 47 65 6f 6d eUtil(e).getGeom
0003b6e0: 65 74 72 79 28 65 29 2c 61 3d 69 2e 67 65 74 53 etry(e),a=i.getS
0003b6f0: 76 67 50 61 74 68 44 61 74 61 28 21 30 29 3b 69 vgPathData(!0);i
0003b700: 66 28 22 64 61 73 68 65 64 22 3d 3d 3d 75 7c 7c f("dashed"===u||
0003b710: 22 64 6f 74 74 65 64 22 3d 3d 3d 75 29 7b 63 6f "dotted"===u){co
0003b720: 6e 73 74 20 65 3d 69 2e 6c 65 6e 67 74 68 2c 7b nst e=i.length,{
0003b730: 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 3a strokeDasharray:
0003b740: 74 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 t,strokeDashoffs
0003b750: 65 74 3a 72 7d 3d 79 76 28 65 3c 36 34 3f 32 2a et:r}=yv(e<64?2*
0003b760: 65 3a 65 2c 66 2c 7b 73 74 79 6c 65 3a 75 2c 73 e:e,f,{style:u,s
0003b770: 6e 61 70 3a 34 2c 63 6c 6f 73 65 64 3a 21 30 7d nap:4,closed:!0}
0003b780: 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 );return(0,Qc.js
0003b790: 78 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c xs)(Qc.Fragment,
0003b7a0: 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 {children:[(0,Qc
0003b7b0: 2e 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 3a .jsx)(pv,{theme:
0003b7c0: 6f 2c 64 3a 61 2c 63 6f 6c 6f 72 3a 6c 2c 66 69 o,d:a,color:l,fi
0003b7d0: 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e 7d 29 2c 28 ll:c,scale:n}),(
0003b7e0: 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 0,Qc.jsx)("path"
0003b7f0: 2c 7b 64 3a 61 2c 73 74 72 6f 6b 65 57 69 64 74 ,{d:a,strokeWidt
0003b800: 68 3a 66 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c h:f,fill:"none",
0003b810: 73 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 stroke:o[l].soli
0003b820: 64 2c 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 d,strokeDasharra
0003b830: 79 3a 74 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 y:t,strokeDashof
0003b840: 66 73 65 74 3a 72 7d 29 5d 7d 29 7d 7b 63 6f 6e fset:r})]})}{con
0003b850: 73 74 20 69 3d 28 74 3f 72 2e 67 65 74 53 68 61 st i=(t?r.getSha
0003b860: 70 65 47 65 6f 6d 65 74 72 79 28 65 29 3a 72 2e peGeometry(e):r.
0003b870: 67 65 74 53 68 61 70 65 55 74 69 6c 28 65 29 2e getShapeUtil(e).
0003b880: 67 65 74 47 65 6f 6d 65 74 72 79 28 65 29 29 2e getGeometry(e)).
0003b890: 67 65 74 53 76 67 50 61 74 68 44 61 74 61 28 21 getSvgPathData(!
0003b8a0: 30 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 0);return(0,Qc.j
0003b8b0: 73 78 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 sxs)(Qc.Fragment
0003b8c0: 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 ,{children:[(0,Q
0003b8d0: 63 2e 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 c.jsx)(pv,{theme
0003b8e0: 3a 6f 2c 64 3a 69 2c 63 6f 6c 6f 72 3a 6c 2c 66 :o,d:i,color:l,f
0003b8f0: 69 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e 7d 29 2c ill:c,scale:n}),
0003b900: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 (0,Qc.jsx)("path
0003b910: 22 2c 7b 64 3a 69 2c 73 74 72 6f 6b 65 3a 6f 5b ",{d:i,stroke:o[
0003b920: 6c 5d 2e 73 6f 6c 69 64 2c 73 74 72 6f 6b 65 57 l].solid,strokeW
0003b930: 69 64 74 68 3a 66 2c 66 69 6c 6c 3a 22 6e 6f 6e idth:f,fill:"non
0003b940: 65 22 7d 29 5d 7d 29 7d 7d 63 61 73 65 22 6f 76 e"})]})}}case"ov
0003b950: 61 6c 22 3a 7b 63 6f 6e 73 74 20 69 3d 74 3f 72 al":{const i=t?r
0003b960: 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 .getShapeGeometr
0003b970: 79 28 65 29 3a 72 2e 67 65 74 53 68 61 70 65 55 y(e):r.getShapeU
0003b980: 74 69 6c 28 65 29 2e 67 65 74 47 65 6f 6d 65 74 til(e).getGeomet
0003b990: 72 79 28 65 29 2c 61 3d 69 2e 67 65 74 53 76 67 ry(e),a=i.getSvg
0003b9a0: 50 61 74 68 44 61 74 61 28 21 30 29 3b 69 66 28 PathData(!0);if(
0003b9b0: 22 64 61 73 68 65 64 22 3d 3d 3d 75 7c 7c 22 64 "dashed"===u||"d
0003b9c0: 6f 74 74 65 64 22 3d 3d 3d 75 29 7b 63 6f 6e 73 otted"===u){cons
0003b9d0: 74 20 65 3d 69 2e 67 65 74 4c 65 6e 67 74 68 28 t e=i.getLength(
0003b9e0: 29 2c 7b 73 74 72 6f 6b 65 44 61 73 68 61 72 72 ),{strokeDasharr
0003b9f0: 61 79 3a 74 2c 73 74 72 6f 6b 65 44 61 73 68 6f ay:t,strokeDasho
0003ba00: 66 66 73 65 74 3a 72 7d 3d 79 76 28 65 3c 36 34 ffset:r}=yv(e<64
0003ba10: 3f 32 2a 65 3a 65 2c 66 2c 7b 73 74 79 6c 65 3a ?2*e:e,f,{style:
0003ba20: 75 2c 73 6e 61 70 3a 34 2c 73 74 61 72 74 3a 22 u,snap:4,start:"
0003ba30: 6f 75 74 73 65 74 22 2c 65 6e 64 3a 22 6f 75 74 outset",end:"out
0003ba40: 73 65 74 22 2c 63 6c 6f 73 65 64 3a 21 30 7d 29 set",closed:!0})
0003ba50: 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 ;return(0,Qc.jsx
0003ba60: 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b s)(Qc.Fragment,{
0003ba70: 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e children:[(0,Qc.
0003ba80: 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 3a 6f jsx)(pv,{theme:o
0003ba90: 2c 64 3a 61 2c 63 6f 6c 6f 72 3a 6c 2c 66 69 6c ,d:a,color:l,fil
0003baa0: 6c 3a 63 2c 73 63 61 6c 65 3a 6e 7d 29 2c 28 30 l:c,scale:n}),(0
0003bab0: 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 22 2c ,Qc.jsx)("path",
0003bac0: 7b 64 3a 61 2c 73 74 72 6f 6b 65 57 69 64 74 68 {d:a,strokeWidth
0003bad0: 3a 66 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c 73 :f,fill:"none",s
0003bae0: 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 troke:o[l].solid
0003baf0: 2c 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 ,strokeDasharray
0003bb00: 3a 74 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 :t,strokeDashoff
0003bb10: 73 65 74 3a 72 7d 29 5d 7d 29 7d 72 65 74 75 72 set:r})]})}retur
0003bb20: 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 51 63 2e n(0,Qc.jsxs)(Qc.
0003bb30: 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 6c 64 72 Fragment,{childr
0003bb40: 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 28 70 en:[(0,Qc.jsx)(p
0003bb50: 76 2c 7b 74 68 65 6d 65 3a 6f 2c 64 3a 61 2c 63 v,{theme:o,d:a,c
0003bb60: 6f 6c 6f 72 3a 6c 2c 66 69 6c 6c 3a 63 2c 73 63 olor:l,fill:c,sc
0003bb70: 61 6c 65 3a 6e 7d 29 2c 28 30 2c 51 63 2e 6a 73 ale:n}),(0,Qc.js
0003bb80: 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 61 2c 73 x)("path",{d:a,s
0003bb90: 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 troke:o[l].solid
0003bba0: 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 66 2c 66 ,strokeWidth:f,f
0003bbb0: 69 6c 6c 3a 22 6e 6f 6e 65 22 7d 29 5d 7d 29 7d ill:"none"})]})}
0003bbc0: 63 61 73 65 22 68 65 61 72 74 22 3a 69 66 28 22 case"heart":if("
0003bbd0: 64 61 73 68 65 64 22 3d 3d 3d 75 7c 7c 22 64 6f dashed"===u||"do
0003bbe0: 74 74 65 64 22 3d 3d 3d 75 7c 7c 22 73 6f 6c 69 tted"===u||"soli
0003bbf0: 64 22 3d 3d 3d 75 29 7b 63 6f 6e 73 74 20 65 3d d"===u){const e=
0003bc00: 67 53 28 73 2c 68 29 2c 74 3d 62 53 28 73 2c 68 gS(s,h),t=bS(s,h
0003bc10: 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 );return(0,Qc.js
0003bc20: 78 73 29 28 51 63 2e 46 72 61 67 6d 65 6e 74 2c xs)(Qc.Fragment,
0003bc30: 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 {children:[(0,Qc
0003bc40: 2e 6a 73 78 29 28 70 76 2c 7b 74 68 65 6d 65 3a .jsx)(pv,{theme:
0003bc50: 6f 2c 64 3a 65 2c 63 6f 6c 6f 72 3a 6c 2c 66 69 o,d:e,color:l,fi
0003bc60: 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e 7d 29 2c 74 ll:c,scale:n}),t
0003bc70: 2e 6d 61 70 28 28 28 65 2c 74 29 3d 3e 7b 63 6f .map(((e,t)=>{co
0003bc80: 6e 73 74 7b 73 74 72 6f 6b 65 44 61 73 68 61 72 nst{strokeDashar
0003bc90: 72 61 79 3a 6e 2c 73 74 72 6f 6b 65 44 61 73 68 ray:n,strokeDash
0003bca0: 6f 66 66 73 65 74 3a 72 7d 3d 79 76 28 65 2e 6c offset:r}=yv(e.l
0003bcb0: 65 6e 67 74 68 2c 66 2c 7b 73 74 79 6c 65 3a 75 ength,f,{style:u
0003bcc0: 2c 73 6e 61 70 3a 31 2c 73 74 61 72 74 3a 22 6f ,snap:1,start:"o
0003bcd0: 75 74 73 65 74 22 2c 65 6e 64 3a 22 6f 75 74 73 utset",end:"outs
0003bce0: 65 74 22 2c 63 6c 6f 73 65 64 3a 21 30 7d 29 3b et",closed:!0});
0003bcf0: 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 return(0,Qc.jsx)
0003bd00: 28 22 70 61 74 68 22 2c 7b 64 3a 65 2e 67 65 74 ("path",{d:e.get
0003bd10: 53 76 67 50 61 74 68 44 61 74 61 28 29 2c 73 74 SvgPathData(),st
0003bd20: 72 6f 6b 65 57 69 64 74 68 3a 66 2c 66 69 6c 6c rokeWidth:f,fill
0003bd30: 3a 22 6e 6f 6e 65 22 2c 73 74 72 6f 6b 65 3a 6f :"none",stroke:o
0003bd40: 5b 6c 5d 2e 73 6f 6c 69 64 2c 73 74 72 6f 6b 65 [l].solid,stroke
0003bd50: 44 61 73 68 61 72 72 61 79 3a 6e 2c 73 74 72 6f Dasharray:n,stro
0003bd60: 6b 65 44 61 73 68 6f 66 66 73 65 74 3a 72 2c 70 keDashoffset:r,p
0003bd70: 6f 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c ointerEvents:"al
0003bd80: 6c 22 7d 2c 60 63 75 72 76 65 5f 24 7b 74 7d 60 l"},`curve_${t}`
0003bd90: 29 7d 29 29 5d 7d 29 7d 7b 63 6f 6e 73 74 20 74 )}))]})}{const t
0003bda0: 3d 66 75 6e 63 74 69 6f 6e 28 65 2c 74 2c 6e 2c =function(e,t,n,
0003bdb0: 72 29 7b 63 6f 6e 73 74 20 6f 3d 65 2f 34 2c 69 r){const o=e/4,i
0003bdc0: 3d 74 2f 34 2c 61 3d 6d 6f 28 72 29 2c 73 3d 2e =t/4,a=mo(r),s=.
0003bdd0: 37 35 2a 6e 2c 6c 3d 65 3d 3e 65 2e 61 64 64 58 75*n,l=e=>e.addX
0003bde0: 59 28 61 28 29 2a 73 2c 61 28 29 2a 73 29 2c 63 Y(a()*s,a()*s),c
0003bdf0: 3d 6e 65 77 20 73 75 28 65 2f 32 2c 74 29 2c 75 =new su(e/2,t),u
0003be00: 3d 6e 65 77 20 73 75 28 30 2c 31 2e 32 2a 69 29 =new su(0,1.2*i)
0003be10: 2c 64 3d 6e 65 77 20 73 75 28 65 2f 32 2c 2e 39 ,d=new su(e/2,.9
0003be20: 2a 69 29 2c 70 3d 6e 65 77 20 73 75 28 65 2c 31 *i),p=new su(e,1
0003be30: 2e 32 2a 69 29 2c 66 3d 6c 28 6e 65 77 20 73 75 .2*i),f=l(new su
0003be40: 28 65 2f 32 2c 74 29 29 2c 68 3d 6c 28 6e 65 77 (e/2,t)),h=l(new
0003be50: 20 73 75 28 30 2c 31 2e 32 2a 69 29 29 2c 6d 3d su(0,1.2*i)),m=
0003be60: 6c 28 6e 65 77 20 73 75 28 65 2f 32 2c 2e 39 2a l(new su(e/2,.9*
0003be70: 69 29 29 2c 67 3d 6c 28 6e 65 77 20 73 75 28 65 i)),g=l(new su(e
0003be80: 2c 31 2e 32 2a 69 29 29 3b 72 65 74 75 72 6e 5b ,1.2*i));return[
0003be90: 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a 63 2c new jg({start:c,
0003bea0: 63 70 31 3a 6e 65 77 20 73 75 28 31 2e 35 2a 6f cp1:new su(1.5*o
0003beb0: 2c 33 2a 69 29 2c 63 70 32 3a 6e 65 77 20 73 75 ,3*i),cp2:new su
0003bec0: 28 30 2c 32 2e 35 2a 69 29 2c 65 6e 64 3a 75 7d (0,2.5*i),end:u}
0003bed0: 29 2c 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a ),new jg({start:
0003bee0: 75 2c 63 70 31 3a 6e 65 77 20 73 75 28 30 2c 2e u,cp1:new su(0,.
0003bef0: 33 32 2a 2d 69 29 2c 63 70 32 3a 6e 65 77 20 73 32*-i),cp2:new s
0003bf00: 75 28 31 2e 38 35 2a 6f 2c 2e 33 32 2a 2d 69 29 u(1.85*o,.32*-i)
0003bf10: 2c 65 6e 64 3a 64 7d 29 2c 6e 65 77 20 6a 67 28 ,end:d}),new jg(
0003bf20: 7b 73 74 61 72 74 3a 64 2c 63 70 31 3a 6e 65 77 {start:d,cp1:new
0003bf30: 20 73 75 28 32 2e 31 35 2a 6f 2c 2e 33 32 2a 2d su(2.15*o,.32*-
0003bf40: 69 29 2c 63 70 32 3a 6e 65 77 20 73 75 28 65 2c i),cp2:new su(e,
0003bf50: 2e 33 32 2a 2d 69 29 2c 65 6e 64 3a 70 7d 29 2c .32*-i),end:p}),
0003bf60: 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a 70 2c new jg({start:p,
0003bf70: 63 70 31 3a 6e 65 77 20 73 75 28 65 2c 32 2e 35 cp1:new su(e,2.5
0003bf80: 2a 69 29 2c 63 70 32 3a 6e 65 77 20 73 75 28 32 *i),cp2:new su(2
0003bf90: 2e 35 2a 6f 2c 33 2a 69 29 2c 65 6e 64 3a 66 7d .5*o,3*i),end:f}
0003bfa0: 29 2c 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a ),new jg({start:
0003bfb0: 66 2c 63 70 31 3a 6e 65 77 20 73 75 28 31 2e 35 f,cp1:new su(1.5
0003bfc0: 2a 6f 2c 33 2a 69 29 2c 63 70 32 3a 6e 65 77 20 *o,3*i),cp2:new
0003bfd0: 73 75 28 30 2c 32 2e 35 2a 69 29 2c 65 6e 64 3a su(0,2.5*i),end:
0003bfe0: 68 7d 29 2c 6e 65 77 20 6a 67 28 7b 73 74 61 72 h}),new jg({star
0003bff0: 74 3a 68 2c 63 70 31 3a 6e 65 77 20 73 75 28 30 t:h,cp1:new su(0
0003c000: 2c 2e 33 32 2a 2d 69 29 2c 63 70 32 3a 6e 65 77 ,.32*-i),cp2:new
0003c010: 20 73 75 28 31 2e 38 35 2a 6f 2c 2e 33 32 2a 2d su(1.85*o,.32*-
0003c020: 69 29 2c 65 6e 64 3a 6d 7d 29 2c 6e 65 77 20 6a i),end:m}),new j
0003c030: 67 28 7b 73 74 61 72 74 3a 6d 2c 63 70 31 3a 6e g({start:m,cp1:n
0003c040: 65 77 20 73 75 28 32 2e 31 35 2a 6f 2c 2e 33 32 ew su(2.15*o,.32
0003c050: 2a 2d 69 29 2c 63 70 32 3a 6e 65 77 20 73 75 28 *-i),cp2:new su(
0003c060: 65 2c 2e 33 32 2a 2d 69 29 2c 65 6e 64 3a 67 7d e,.32*-i),end:g}
0003c070: 29 2c 6e 65 77 20 6a 67 28 7b 73 74 61 72 74 3a ),new jg({start:
0003c080: 67 2c 63 70 31 3a 6e 65 77 20 73 75 28 65 2c 32 g,cp1:new su(e,2
0003c090: 2e 35 2a 69 29 2c 63 70 32 3a 6e 65 77 20 73 75 .5*i),cp2:new su
0003c0a0: 28 32 2e 35 2a 6f 2c 33 2a 69 29 2c 65 6e 64 3a (2.5*o,3*i),end:
0003c0b0: 63 7d 29 5d 2e 6d 61 70 28 28 28 65 2c 74 29 3d c})].map(((e,t)=
0003c0c0: 3e 65 2e 67 65 74 53 76 67 50 61 74 68 44 61 74 >e.getSvgPathDat
0003c0d0: 61 28 30 3d 3d 3d 74 29 29 29 2e 6a 6f 69 6e 28 a(0===t))).join(
0003c0e0: 22 20 22 29 2b 22 20 5a 22 7d 28 73 2c 68 2c 66 " ")+" Z"}(s,h,f
0003c0f0: 2c 65 2e 69 64 29 3b 72 65 74 75 72 6e 28 30 2c ,e.id);return(0,
0003c100: 51 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 67 Qc.jsxs)(Qc.Frag
0003c110: 6d 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b ment,{children:[
0003c120: 28 30 2c 51 63 2e 6a 73 78 29 28 70 76 2c 7b 74 (0,Qc.jsx)(pv,{t
0003c130: 68 65 6d 65 3a 6f 2c 64 3a 74 2c 63 6f 6c 6f 72 heme:o,d:t,color
0003c140: 3a 6c 2c 66 69 6c 6c 3a 63 2c 73 63 61 6c 65 3a :l,fill:c,scale:
0003c150: 6e 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 n}),(0,Qc.jsx)("
0003c160: 70 61 74 68 22 2c 7b 64 3a 74 2c 73 74 72 6f 6b path",{d:t,strok
0003c170: 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 2c 73 74 72 e:o[l].solid,str
0003c180: 6f 6b 65 57 69 64 74 68 3a 66 2c 66 69 6c 6c 3a okeWidth:f,fill:
0003c190: 22 6e 6f 6e 65 22 7d 29 5d 7d 29 7d 64 65 66 61 "none"})]})}defa
0003c1a0: 75 6c 74 3a 7b 63 6f 6e 73 74 20 61 3d 74 3f 72 ult:{const a=t?r
0003c1b0: 2e 67 65 74 53 68 61 70 65 47 65 6f 6d 65 74 72 .getShapeGeometr
0003c1c0: 79 28 65 29 3a 72 2e 67 65 74 53 68 61 70 65 55 y(e):r.getShapeU
0003c1d0: 74 69 6c 28 65 29 2e 67 65 74 47 65 6f 6d 65 74 til(e).getGeomet
0003c1e0: 72 79 28 65 29 2c 73 3d 61 20 69 6e 73 74 61 6e ry(e),s=a instan
0003c1f0: 63 65 6f 66 20 6b 70 3f 61 2e 63 68 69 6c 64 72 ceof kp?a.childr
0003c200: 65 6e 5b 30 5d 2e 76 65 72 74 69 63 65 73 3a 61 en[0].vertices:a
0003c210: 2e 76 65 72 74 69 63 65 73 2c 64 3d 6b 53 28 65 .vertices,d=kS(e
0003c220: 2e 70 72 6f 70 73 2c 66 29 3b 69 66 28 22 73 6f .props,f);if("so
0003c230: 6c 69 64 22 3d 3d 3d 75 29 7b 6c 65 74 20 65 3d lid"===u){let e=
0003c240: 22 4d 22 2b 73 5b 30 5d 2b 22 4c 22 2b 73 2e 73 "M"+s[0]+"L"+s.s
0003c250: 6c 69 63 65 28 31 29 2b 22 5a 22 3b 69 66 28 64 lice(1)+"Z";if(d
0003c260: 29 66 6f 72 28 63 6f 6e 73 74 5b 74 2c 6e 5d 6f )for(const[t,n]o
0003c270: 66 20 64 29 65 2b 3d 60 4d 24 7b 74 2e 78 7d 2c f d)e+=`M${t.x},
0003c280: 24 7b 74 2e 79 7d 4c 24 7b 6e 2e 78 7d 2c 24 7b ${t.y}L${n.x},${
0003c290: 6e 2e 79 7d 60 3b 72 65 74 75 72 6e 28 30 2c 51 n.y}`;return(0,Q
0003c2a0: 63 2e 6a 73 78 73 29 28 51 63 2e 46 72 61 67 6d c.jsxs)(Qc.Fragm
0003c2b0: 65 6e 74 2c 7b 63 68 69 6c 64 72 65 6e 3a 5b 28 ent,{children:[(
0003c2c0: 30 2c 51 63 2e 6a 73 78 29 28 70 76 2c 7b 74 68 0,Qc.jsx)(pv,{th
0003c2d0: 65 6d 65 3a 6f 2c 64 3a 65 2c 63 6f 6c 6f 72 3a eme:o,d:e,color:
0003c2e0: 6c 2c 66 69 6c 6c 3a 63 2c 73 63 61 6c 65 3a 6e l,fill:c,scale:n
0003c2f0: 7d 29 2c 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 }),(0,Qc.jsx)("p
0003c300: 61 74 68 22 2c 7b 64 3a 65 2c 73 74 72 6f 6b 65 ath",{d:e,stroke
0003c310: 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 2c 73 74 72 6f :o[l].solid,stro
0003c320: 6b 65 57 69 64 74 68 3a 66 2c 66 69 6c 6c 3a 22 keWidth:f,fill:"
0003c330: 6e 6f 6e 65 22 7d 29 5d 7d 29 7d 69 66 28 22 64 none"})]})}if("d
0003c340: 61 73 68 65 64 22 3d 3d 3d 75 7c 7c 22 64 6f 74 ashed"===u||"dot
0003c350: 74 65 64 22 3d 3d 3d 75 29 7b 63 6f 6e 73 74 20 ted"===u){const
0003c360: 65 3d 22 4d 22 2b 73 5b 30 5d 2b 22 4c 22 2b 73 e="M"+s[0]+"L"+s
0003c370: 2e 73 6c 69 63 65 28 31 29 2b 22 5a 22 3b 72 65 .slice(1)+"Z";re
0003c380: 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 turn(0,Qc.jsxs)(
0003c390: 51 63 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 Qc.Fragment,{chi
0003c3a0: 6c 64 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 ldren:[(0,Qc.jsx
0003c3b0: 29 28 70 76 2c 7b 74 68 65 6d 65 3a 6f 2c 64 3a )(pv,{theme:o,d:
0003c3c0: 65 2c 63 6f 6c 6f 72 3a 6c 2c 66 69 6c 6c 3a 63 e,color:l,fill:c
0003c3d0: 2c 73 63 61 6c 65 3a 6e 7d 29 2c 28 30 2c 51 63 ,scale:n}),(0,Qc
0003c3e0: 2e 6a 73 78 73 29 28 22 67 22 2c 7b 73 74 72 6f .jsxs)("g",{stro
0003c3f0: 6b 65 57 69 64 74 68 3a 66 2c 73 74 72 6f 6b 65 keWidth:f,stroke
0003c400: 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 2c 66 69 6c 6c :o[l].solid,fill
0003c410: 3a 22 6e 6f 6e 65 22 2c 70 6f 69 6e 74 65 72 45 :"none",pointerE
0003c420: 76 65 6e 74 73 3a 22 61 6c 6c 22 2c 63 68 69 6c vents:"all",chil
0003c430: 64 72 65 6e 3a 5b 41 72 72 61 79 2e 66 72 6f 6d dren:[Array.from
0003c440: 28 41 72 72 61 79 28 73 2e 6c 65 6e 67 74 68 29 (Array(s.length)
0003c450: 29 2e 6d 61 70 28 28 28 65 2c 74 29 3d 3e 7b 63 ).map(((e,t)=>{c
0003c460: 6f 6e 73 74 20 6e 3d 73 75 2e 54 6f 46 69 78 65 onst n=su.ToFixe
0003c470: 64 28 73 5b 74 5d 29 2c 72 3d 73 75 2e 54 6f 46 d(s[t]),r=su.ToF
0003c480: 69 78 65 64 28 73 5b 28 74 2b 31 29 25 73 2e 6c ixed(s[(t+1)%s.l
0003c490: 65 6e 67 74 68 5d 29 2c 6f 3d 73 75 2e 44 69 73 ength]),o=su.Dis
0003c4a0: 74 28 6e 2c 72 29 2c 7b 73 74 72 6f 6b 65 44 61 t(n,r),{strokeDa
0003c4b0: 73 68 61 72 72 61 79 3a 69 2c 73 74 72 6f 6b 65 sharray:i,stroke
0003c4c0: 44 61 73 68 6f 66 66 73 65 74 3a 61 7d 3d 79 76 Dashoffset:a}=yv
0003c4d0: 28 6f 2c 66 2c 7b 73 74 79 6c 65 3a 75 2c 73 74 (o,f,{style:u,st
0003c4e0: 61 72 74 3a 22 6f 75 74 73 65 74 22 2c 65 6e 64 art:"outset",end
0003c4f0: 3a 22 6f 75 74 73 65 74 22 7d 29 3b 72 65 74 75 :"outset"});retu
0003c500: 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 6c 69 rn(0,Qc.jsx)("li
0003c510: 6e 65 22 2c 7b 78 31 3a 6e 2e 78 2c 79 31 3a 6e ne",{x1:n.x,y1:n
0003c520: 2e 79 2c 78 32 3a 72 2e 78 2c 79 32 3a 72 2e 79 .y,x2:r.x,y2:r.y
0003c530: 2c 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 ,strokeDasharray
0003c540: 3a 69 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 :i,strokeDashoff
0003c550: 73 65 74 3a 61 7d 2c 74 29 7d 29 29 2c 64 26 26 set:a},t)})),d&&
0003c560: 64 2e 6d 61 70 28 28 28 5b 65 2c 74 5d 2c 6e 29 d.map((([e,t],n)
0003c570: 3d 3e 7b 63 6f 6e 73 74 20 72 3d 73 75 2e 44 69 =>{const r=su.Di
0003c580: 73 74 28 65 2c 74 29 2c 7b 73 74 72 6f 6b 65 44 st(e,t),{strokeD
0003c590: 61 73 68 61 72 72 61 79 3a 69 2c 73 74 72 6f 6b asharray:i,strok
0003c5a0: 65 44 61 73 68 6f 66 66 73 65 74 3a 61 7d 3d 79 eDashoffset:a}=y
0003c5b0: 76 28 72 2c 66 2c 7b 73 74 79 6c 65 3a 75 2c 73 v(r,f,{style:u,s
0003c5c0: 74 61 72 74 3a 22 73 6b 69 70 22 2c 65 6e 64 3a tart:"skip",end:
0003c5d0: 22 73 6b 69 70 22 2c 73 6e 61 70 3a 22 64 6f 74 "skip",snap:"dot
0003c5e0: 74 65 64 22 3d 3d 3d 75 3f 34 3a 76 6f 69 64 20 ted"===u?4:void
0003c5f0: 30 7d 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 0});return(0,Qc.
0003c600: 6a 73 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 60 jsx)("path",{d:`
0003c610: 4d 24 7b 65 2e 78 7d 2c 24 7b 65 2e 79 7d 4c 24 M${e.x},${e.y}L$
0003c620: 7b 74 2e 78 7d 2c 24 7b 74 2e 79 7d 60 2c 73 74 {t.x},${t.y}`,st
0003c630: 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 64 2c roke:o[l].solid,
0003c640: 73 74 72 6f 6b 65 57 69 64 74 68 3a 66 2c 66 69 strokeWidth:f,fi
0003c650: 6c 6c 3a 22 6e 6f 6e 65 22 2c 73 74 72 6f 6b 65 ll:"none",stroke
0003c660: 44 61 73 68 61 72 72 61 79 3a 69 2c 73 74 72 6f Dasharray:i,stro
0003c670: 6b 65 44 61 73 68 6f 66 66 73 65 74 3a 61 7d 2c keDashoffset:a},
0003c680: 60 6c 69 6e 65 5f 66 67 5f 24 7b 6e 7d 60 29 7d `line_fg_${n}`)}
0003c690: 29 29 5d 7d 29 5d 7d 29 7d 69 66 28 22 64 72 61 ))]})]})}if("dra
0003c6a0: 77 22 3d 3d 3d 75 29 7b 6c 65 74 20 65 3d 76 53 w"===u){let e=vS
0003c6b0: 28 53 53 28 69 2c 73 2c 66 2f 33 2c 32 2a 66 2c (SS(i,s,f/3,2*f,
0003c6c0: 32 29 29 3b 69 66 28 64 29 66 6f 72 28 63 6f 6e 2));if(d)for(con
0003c6d0: 73 74 5b 74 2c 6e 5d 6f 66 20 64 29 65 2b 3d 60 st[t,n]of d)e+=`
0003c6e0: 4d 24 7b 74 2e 74 6f 46 69 78 65 64 28 29 7d 4c M${t.toFixed()}L
0003c6f0: 24 7b 6e 2e 74 6f 46 69 78 65 64 28 29 7d 60 3b ${n.toFixed()}`;
0003c700: 63 6f 6e 73 74 20 74 3d 76 53 28 53 53 28 69 2c const t=vS(SS(i,
0003c710: 73 2c 30 2c 32 2a 66 2c 31 29 29 3b 72 65 74 75 s,0,2*f,1));retu
0003c720: 72 6e 28 30 2c 51 63 2e 6a 73 78 73 29 28 51 63 rn(0,Qc.jsxs)(Qc
0003c730: 2e 46 72 61 67 6d 65 6e 74 2c 7b 63 68 69 6c 64 .Fragment,{child
0003c740: 72 65 6e 3a 5b 28 30 2c 51 63 2e 6a 73 78 29 28 ren:[(0,Qc.jsx)(
0003c750: 70 76 2c 7b 74 68 65 6d 65 3a 6f 2c 64 3a 74 2c pv,{theme:o,d:t,
0003c760: 63 6f 6c 6f 72 3a 6c 2c 66 69 6c 6c 3a 63 2c 73 color:l,fill:c,s
0003c770: 63 61 6c 65 3a 6e 7d 29 2c 28 30 2c 51 63 2e 6a cale:n}),(0,Qc.j
0003c780: 73 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 65 2c sx)("path",{d:e,
0003c790: 73 74 72 6f 6b 65 3a 6f 5b 6c 5d 2e 73 6f 6c 69 stroke:o[l].soli
0003c7a0: 64 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 66 2c d,strokeWidth:f,
0003c7b0: 66 69 6c 6c 3a 22 6e 6f 6e 65 22 7d 29 5d 7d 29 fill:"none"})]})
0003c7c0: 7d 7d 7d 7d 63 6f 6e 73 74 20 49 53 3d 35 31 3b }}}}const IS=51;
0003c7d0: 66 75 6e 63 74 69 6f 6e 20 52 53 28 65 2c 74 29 function RS(e,t)
0003c7e0: 7b 63 6f 6e 73 74 20 6e 3d 74 2e 70 72 6f 70 73 {const n=t.props
0003c7f0: 2e 74 65 78 74 3b 69 66 28 21 6e 29 72 65 74 75 .text;if(!n)retu
0003c800: 72 6e 7b 77 3a 30 2c 68 3a 30 7d 3b 63 6f 6e 73 rn{w:0,h:0};cons
0003c810: 74 20 72 3d 65 2e 74 65 78 74 4d 65 61 73 75 72 t r=e.textMeasur
0003c820: 65 2e 6d 65 61 73 75 72 65 54 65 78 74 28 22 77 e.measureText("w
0003c830: 22 2c 7b 2e 2e 2e 4e 62 2c 66 6f 6e 74 46 61 6d ",{...Nb,fontFam
0003c840: 69 6c 79 3a 46 62 5b 74 2e 70 72 6f 70 73 2e 66 ily:Fb[t.props.f
0003c850: 6f 6e 74 5d 2c 66 6f 6e 74 53 69 7a 65 3a 44 62 ont],fontSize:Db
0003c860: 5b 74 2e 70 72 6f 70 73 2e 73 69 7a 65 5d 2a 74 [t.props.size]*t
0003c870: 2e 70 72 6f 70 73 2e 73 63 61 6c 65 2c 6d 61 78 .props.scale,max
0003c880: 57 69 64 74 68 3a 31 30 30 7d 29 2c 6f 3d 65 2e Width:100}),o=e.
0003c890: 74 65 78 74 4d 65 61 73 75 72 65 2e 6d 65 61 73 textMeasure.meas
0003c8a0: 75 72 65 54 65 78 74 28 6e 2c 7b 2e 2e 2e 4e 62 ureText(n,{...Nb
0003c8b0: 2c 66 6f 6e 74 46 61 6d 69 6c 79 3a 46 62 5b 74 ,fontFamily:Fb[t
0003c8c0: 2e 70 72 6f 70 73 2e 66 6f 6e 74 5d 2c 66 6f 6e .props.font],fon
0003c8d0: 74 53 69 7a 65 3a 44 62 5b 74 2e 70 72 6f 70 73 tSize:Db[t.props
0003c8e0: 2e 73 69 7a 65 5d 2a 74 2e 70 72 6f 70 73 2e 73 .size]*t.props.s
0003c8f0: 63 61 6c 65 2c 6d 69 6e 57 69 64 74 68 3a 72 2e cale,minWidth:r.
0003c900: 77 2c 6d 61 78 57 69 64 74 68 3a 4d 61 74 68 2e w,maxWidth:Math.
0003c910: 6d 61 78 28 30 2c 4d 61 74 68 2e 63 65 69 6c 28 max(0,Math.ceil(
0003c920: 72 2e 77 2b 7b 73 3a 32 2c 6d 3a 33 2e 35 2c 6c r.w+{s:2,m:3.5,l
0003c930: 3a 35 2c 78 6c 3a 31 30 7d 5b 74 2e 70 72 6f 70 :5,xl:10}[t.prop
0003c940: 73 2e 73 69 7a 65 5d 29 2c 4d 61 74 68 2e 63 65 s.size]),Math.ce
0003c950: 69 6c 28 74 2e 70 72 6f 70 73 2e 77 2d 32 2a 55 il(t.props.w-2*U
0003c960: 62 29 29 7d 29 3b 72 65 74 75 72 6e 7b 77 3a 6f b))});return{w:o
0003c970: 2e 77 2b 32 2a 55 62 2c 68 3a 6f 2e 68 2b 32 2a .w+2*Ub,h:o.h+2*
0003c980: 55 62 7d 7d 66 75 6e 63 74 69 6f 6e 20 4f 53 28 Ub}}function OS(
0003c990: 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 20 72 3d 61 e,t,n){const r=a
0003c9a0: 53 28 65 2e 70 72 6f 70 73 2e 73 65 67 6d 65 6e S(e.props.segmen
0003c9b0: 74 73 29 2c 6f 3d 65 2e 70 72 6f 70 73 2e 69 73 ts),o=e.props.is
0003c9c0: 43 6f 6d 70 6c 65 74 65 7c 7c 22 73 74 72 61 69 Complete||"strai
0003c9d0: 67 68 74 22 3d 3d 3d 42 72 28 65 2e 70 72 6f 70 ght"===Br(e.prop
0003c9e0: 73 2e 73 65 67 6d 65 6e 74 73 29 3f 2e 74 79 70 s.segments)?.typ
0003c9f0: 65 3b 6c 65 74 20 69 3d 74 3b 6e 7c 7c 65 2e 70 e;let i=t;n||e.p
0003ca00: 72 6f 70 73 2e 69 73 50 65 6e 7c 7c 31 21 3d 3d rops.isPen||1!==
0003ca10: 72 2e 6c 65 6e 67 74 68 7c 7c 28 69 2b 3d 6d 6f r.length||(i+=mo
0003ca20: 28 65 2e 69 64 29 28 29 2a 28 74 2f 36 29 29 3b (e.id)()*(t/6));
0003ca30: 72 65 74 75 72 6e 7b 73 74 72 6f 6b 65 50 6f 69 return{strokePoi
0003ca40: 6e 74 73 3a 4a 67 28 72 2c 6f 53 28 7b 73 74 72 nts:Jg(r,oS({str
0003ca50: 6f 6b 65 57 69 64 74 68 3a 69 2c 73 68 6f 77 41 okeWidth:i,showA
0003ca60: 73 43 6f 6d 70 6c 65 74 65 3a 6f 7d 29 29 2c 73 sComplete:o})),s
0003ca70: 77 3a 69 7d 7d 66 75 6e 63 74 69 6f 6e 20 4e 53 w:i}}function NS
0003ca80: 28 65 29 7b 72 65 74 75 72 6e 20 31 2e 31 32 2a (e){return 1.12*
0003ca90: 4d 62 5b 65 2e 70 72 6f 70 73 2e 73 69 7a 65 5d Mb[e.props.size]
0003caa0: 2a 65 2e 70 72 6f 70 73 2e 73 63 61 6c 65 7d 66 *e.props.scale}f
0003cab0: 75 6e 63 74 69 6f 6e 20 50 53 28 65 29 7b 72 65 unction PS(e){re
0003cac0: 74 75 72 6e 20 31 3d 3d 3d 65 2e 70 72 6f 70 73 turn 1===e.props
0003cad0: 2e 73 65 67 6d 65 6e 74 73 2e 6c 65 6e 67 74 68 .segments.length
0003cae0: 26 26 65 2e 70 72 6f 70 73 2e 73 65 67 6d 65 6e &&e.props.segmen
0003caf0: 74 73 5b 30 5d 2e 70 6f 69 6e 74 73 2e 6c 65 6e ts[0].points.len
0003cb00: 67 74 68 3c 32 7d 66 75 6e 63 74 69 6f 6e 20 4d gth<2}function M
0003cb10: 53 28 7b 73 74 72 6f 6b 65 57 69 64 74 68 3a 65 S({strokeWidth:e
0003cb20: 2c 66 6f 72 63 65 53 6f 6c 69 64 3a 74 2c 73 68 ,forceSolid:t,sh
0003cb30: 61 70 65 3a 6e 2c 6f 70 61 63 69 74 79 3a 72 7d ape:n,opacity:r}
0003cb40: 29 7b 63 6f 6e 73 74 20 69 3d 51 79 28 29 2c 61 ){const i=Qy(),a
0003cb50: 3d 61 53 28 6e 2e 70 72 6f 70 73 2e 73 65 67 6d =aS(n.props.segm
0003cb60: 65 6e 74 73 29 3b 6c 65 74 20 73 3d 65 3b 74 7c ents);let s=e;t|
0003cb70: 7c 6e 2e 70 72 6f 70 73 2e 69 73 50 65 6e 7c 7c |n.props.isPen||
0003cb80: 31 21 3d 3d 61 2e 6c 65 6e 67 74 68 7c 7c 28 73 1!==a.length||(s
0003cb90: 2b 3d 6d 6f 28 6e 2e 69 64 29 28 29 2a 28 73 2f +=mo(n.id)()*(s/
0003cba0: 36 29 29 3b 63 6f 6e 73 74 20 6c 3d 4a 67 28 61 6));const l=Jg(a
0003cbb0: 2c 6f 53 28 7b 73 74 72 6f 6b 65 57 69 64 74 68 ,oS({strokeWidth
0003cbc0: 3a 73 2c 73 68 6f 77 41 73 43 6f 6d 70 6c 65 74 :s,showAsComplet
0003cbd0: 65 3a 6e 2e 70 72 6f 70 73 2e 69 73 43 6f 6d 70 e:n.props.isComp
0003cbe0: 6c 65 74 65 7c 7c 22 73 74 72 61 69 67 68 74 22 lete||"straight"
0003cbf0: 3d 3d 3d 42 72 28 6e 2e 70 72 6f 70 73 2e 73 65 ===Br(n.props.se
0003cc00: 67 6d 65 6e 74 73 29 3f 2e 74 79 70 65 7d 29 29 gments)?.type}))
0003cc10: 2c 63 3d 6c 2e 6c 65 6e 67 74 68 3e 31 3f 58 76 ,c=l.length>1?Xv
0003cc20: 28 6c 2c 21 31 29 3a 60 4d 20 24 7b 28 75 3d 6e (l,!1):`M ${(u=n
0003cc30: 2e 70 72 6f 70 73 2e 73 65 67 6d 65 6e 74 73 5b .props.segments[
0003cc40: 30 5d 2e 70 6f 69 6e 74 73 5b 30 5d 29 2e 78 7d 0].points[0]).x}
0003cc50: 20 24 7b 75 2e 79 7d 20 6d 20 2d 30 2e 31 2c 20 ${u.y} m -0.1,
0003cc60: 30 20 61 20 30 2e 31 2c 30 2e 31 20 30 20 31 2c 0 a 0.1,0.1 0 1,
0003cc70: 30 20 30 2e 32 2c 30 20 61 20 30 2e 31 2c 30 2e 0 0.2,0 a 0.1,0.
0003cc80: 31 20 30 20 31 2c 30 20 2d 30 2e 32 2c 30 60 3b 1 0 1,0 -0.2,0`;
0003cc90: 76 61 72 20 75 3b 63 6f 6e 73 74 20 64 3d 66 75 var u;const d=fu
0003cca0: 6e 63 74 69 6f 6e 28 29 7b 63 6f 6e 73 74 5b 65 nction(){const[e
0003ccb0: 2c 74 5d 3d 28 30 2c 6f 2e 75 73 65 53 74 61 74 ,t]=(0,o.useStat
0003ccc0: 65 29 28 21 31 29 3b 72 65 74 75 72 6e 28 30 2c e)(!1);return(0,
0003ccd0: 6f 2e 75 73 65 45 66 66 65 63 74 29 28 28 28 29 o.useEffect)((()
0003cce0: 3d 3e 7b 63 6f 6e 73 74 20 65 3d 43 53 53 2e 73 =>{const e=CSS.s
0003ccf0: 75 70 70 6f 72 74 73 28 22 63 6f 6c 6f 72 22 2c upports("color",
0003cd00: 22 63 6f 6c 6f 72 28 64 69 73 70 6c 61 79 2d 70 "color(display-p
0003cd10: 33 20 31 20 31 20 31 29 22 29 2c 6e 3d 6d 61 74 3 1 1 1)"),n=mat
0003cd20: 63 68 4d 65 64 69 61 28 22 28 63 6f 6c 6f 72 2d chMedia("(color-
0003cd30: 67 61 6d 75 74 3a 20 70 33 29 22 29 3b 74 28 65 gamut: p3)");t(e
0003cd40: 26 26 6e 2e 6d 61 74 63 68 65 73 29 3b 63 6f 6e &&n.matches);con
0003cd50: 73 74 20 72 3d 28 29 3d 3e 74 28 65 26 26 6e 2e st r=()=>t(e&&n.
0003cd60: 6d 61 74 63 68 65 73 29 3b 72 65 74 75 72 6e 20 matches);return
0003cd70: 6e 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e n.addEventListen
0003cd80: 65 72 28 22 63 68 61 6e 67 65 22 2c 72 29 2c 28 er("change",r),(
0003cd90: 29 3d 3e 6e 2e 72 65 6d 6f 76 65 45 76 65 6e 74 )=>n.removeEvent
0003cda0: 4c 69 73 74 65 6e 65 72 28 22 63 68 61 6e 67 65 Listener("change
0003cdb0: 22 2c 72 29 7d 29 2c 5b 5d 29 2c 64 61 28 58 75 ",r)}),[]),da(Xu
0003cdc0: 2e 66 6f 72 63 65 53 72 67 62 29 7c 7c 21 65 3f .forceSrgb)||!e?
0003cdd0: 22 73 72 67 62 22 3a 22 70 33 22 7d 28 29 2c 70 "srgb":"p3"}(),p
0003cde0: 3d 69 5b 6e 2e 70 72 6f 70 73 2e 63 6f 6c 6f 72 =i[n.props.color
0003cdf0: 5d 2e 68 69 67 68 6c 69 67 68 74 5b 64 5d 3b 72 ].highlight[d];r
0003ce00: 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 eturn(0,Qc.jsx)(
0003ce10: 22 70 61 74 68 22 2c 7b 64 3a 63 2c 73 74 72 6f "path",{d:c,stro
0003ce20: 6b 65 4c 69 6e 65 63 61 70 3a 22 72 6f 75 6e 64 keLinecap:"round
0003ce30: 22 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c 70 6f ",fill:"none",po
0003ce40: 69 6e 74 65 72 45 76 65 6e 74 73 3a 22 61 6c 6c interEvents:"all
0003ce50: 22 2c 73 74 72 6f 6b 65 3a 70 2c 73 74 72 6f 6b ",stroke:p,strok
0003ce60: 65 57 69 64 74 68 3a 73 2c 6f 70 61 63 69 74 79 eWidth:s,opacity
0003ce70: 3a 72 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 44 53 :r})}function DS
0003ce80: 28 65 2c 74 29 7b 72 65 74 75 72 6e 20 64 61 28 (e,t){return da(
0003ce90: 22 66 6f 72 63 65 53 6f 6c 69 64 22 2c 28 28 29 "forceSolid",(()
0003cea0: 3d 3e 4e 53 28 74 29 2f 65 2e 67 65 74 5a 6f 6f =>NS(t)/e.getZoo
0003ceb0: 6d 4c 65 76 65 6c 28 29 3c 31 2e 35 29 2c 5b 65 mLevel()<1.5),[e
0003cec0: 5d 29 7d 66 75 6e 63 74 69 6f 6e 20 4c 53 28 29 ])}function LS()
0003ced0: 7b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 {return(0,Qc.jsx
0003cee0: 73 29 28 22 73 76 67 22 2c 7b 77 69 64 74 68 3a s)("svg",{width:
0003cef0: 22 31 35 22 2c 68 65 69 67 68 74 3a 22 31 35 22 "15",height:"15"
0003cf00: 2c 76 69 65 77 42 6f 78 3a 22 30 20 30 20 33 30 ,viewBox:"0 0 30
0003cf10: 20 33 30 22 2c 78 6d 6c 6e 73 3a 22 68 74 74 70 30",xmlns:"http
0003cf20: 3a 2f 2f 77 77 77 2e 77 33 2e 6f 72 67 2f 32 30 ://www.w3.org/20
0003cf30: 30 30 2f 73 76 67 22 2c 66 69 6c 6c 3a 22 6e 6f 00/svg",fill:"no
0003cf40: 6e 65 22 2c 73 74 72 6f 6b 65 3a 22 63 75 72 72 ne",stroke:"curr
0003cf50: 65 6e 74 43 6f 6c 6f 72 22 2c 73 74 72 6f 6b 65 entColor",stroke
0003cf60: 4c 69 6e 65 63 61 70 3a 22 72 6f 75 6e 64 22 2c Linecap:"round",
0003cf70: 73 74 72 6f 6b 65 4c 69 6e 65 6a 6f 69 6e 3a 22 strokeLinejoin:"
0003cf80: 72 6f 75 6e 64 22 2c 63 68 69 6c 64 72 65 6e 3a round",children:
0003cf90: 5b 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 [(0,Qc.jsx)("pat
0003cfa0: 68 22 2c 7b 64 3a 22 4d 33 2c 31 31 20 4c 33 2c h",{d:"M3,11 L3,
0003cfb0: 33 20 31 31 2c 33 22 2c 73 74 72 6f 6b 65 57 69 3 11,3",strokeWi
0003cfc0: 64 74 68 3a 22 32 22 7d 29 2c 28 30 2c 51 63 2e dth:"2"}),(0,Qc.
0003cfd0: 6a 73 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 22 jsx)("path",{d:"
0003cfe0: 4d 31 39 2c 32 37 20 4c 32 37 2c 32 37 20 4c 32 M19,27 L27,27 L2
0003cff0: 37 2c 31 39 22 2c 73 74 72 6f 6b 65 57 69 64 74 7,19",strokeWidt
0003d000: 68 3a 22 32 22 7d 29 2c 28 30 2c 51 63 2e 6a 73 h:"2"}),(0,Qc.js
0003d010: 78 29 28 22 70 61 74 68 22 2c 7b 64 3a 22 4d 32 x)("path",{d:"M2
0003d020: 37 2c 33 20 4c 33 2c 32 37 22 2c 73 74 72 6f 6b 7,3 L3,27",strok
0003d030: 65 57 69 64 74 68 3a 22 32 22 7d 29 5d 7d 29 7d eWidth:"2"})]})}
0003d040: 66 75 6e 63 74 69 6f 6e 20 46 53 28 65 2c 74 2c function FS(e,t,
0003d050: 6e 29 7b 63 6f 6e 73 74 20 72 3d 72 75 28 29 2c n){const r=ru(),
0003d060: 5b 69 2c 61 5d 3d 28 30 2c 6f 2e 75 73 65 53 74 [i,a]=(0,o.useSt
0003d070: 61 74 65 29 28 6e 75 6c 6c 29 2c 73 3d 74 3f 72 ate)(null),s=t?r
0003d080: 2e 67 65 74 41 73 73 65 74 28 74 29 3a 6e 75 6c .getAsset(t):nul
0003d090: 6c 2c 6c 3d 72 2e 67 65 74 43 75 6c 6c 65 64 53 l,l=r.getCulledS
0003d0a0: 68 61 70 65 73 28 29 2e 68 61 73 28 65 29 2c 63 hapes().has(e),c
0003d0b0: 3d 73 26 26 22 77 22 69 6e 20 73 2e 70 72 6f 70 =s&&"w"in s.prop
0003d0c0: 73 3f 6e 2f 73 2e 70 72 6f 70 73 2e 77 3a 31 2c s?n/s.props.w:1,
0003d0d0: 75 3d 64 61 28 22 7a 6f 6f 6d 20 6c 65 76 65 6c u=da("zoom level
0003d0e0: 22 2c 28 28 29 3d 3e 72 2e 67 65 74 5a 6f 6f 6d ",(()=>r.getZoom
0003d0f0: 4c 65 76 65 6c 28 29 2a 63 29 2c 5b 72 2c 63 5d Level()*c),[r,c]
0003d100: 29 3b 72 65 74 75 72 6e 28 30 2c 6f 2e 75 73 65 );return(0,o.use
0003d110: 45 66 66 65 63 74 29 28 28 28 29 3d 3e 7b 69 66 Effect)((()=>{if
0003d120: 28 6c 29 72 65 74 75 72 6e 3b 6c 65 74 20 65 3d (l)return;let e=
0003d130: 21 31 3b 63 6f 6e 73 74 20 6e 3d 72 2e 74 69 6d !1;const n=r.tim
0003d140: 65 72 73 2e 73 65 74 54 69 6d 65 6f 75 74 28 28 ers.setTimeout((
0003d150: 61 73 79 6e 63 28 29 3d 3e 7b 63 6f 6e 73 74 20 async()=>{const
0003d160: 6e 3d 61 77 61 69 74 20 72 2e 72 65 73 6f 6c 76 n=await r.resolv
0003d170: 65 41 73 73 65 74 55 72 6c 28 74 2c 7b 73 63 72 eAssetUrl(t,{scr
0003d180: 65 65 6e 53 63 61 6c 65 3a 75 7d 29 3b 65 7c 7c eenScale:u});e||
0003d190: 61 28 6e 29 7d 29 2c 35 30 30 29 3b 72 65 74 75 a(n)}),500);retu
0003d1a0: 72 6e 28 29 3d 3e 7b 63 6c 65 61 72 54 69 6d 65 rn()=>{clearTime
0003d1b0: 6f 75 74 28 6e 29 2c 65 3d 21 30 7d 7d 29 2c 5b out(n),e=!0}}),[
0003d1c0: 74 2c 73 3f 2e 70 72 6f 70 73 2e 73 72 63 2c 6c t,s?.props.src,l
0003d1d0: 2c 75 2c 72 5d 29 2c 7b 61 73 73 65 74 3a 73 2c ,u,r]),{asset:s,
0003d1e0: 75 72 6c 3a 69 7d 7d 66 75 6e 63 74 69 6f 6e 20 url:i}}function
0003d1f0: 6a 53 28 29 7b 63 6f 6e 73 74 5b 65 2c 74 5d 3d jS(){const[e,t]=
0003d200: 28 30 2c 6f 2e 75 73 65 53 74 61 74 65 29 28 21 (0,o.useState)(!
0003d210: 31 29 3b 72 65 74 75 72 6e 28 30 2c 6f 2e 75 73 1);return(0,o.us
0003d220: 65 45 66 66 65 63 74 29 28 28 28 29 3d 3e 7b 63 eEffect)((()=>{c
0003d230: 6f 6e 73 74 20 65 3d 77 69 6e 64 6f 77 2e 6d 61 onst e=window.ma
0003d240: 74 63 68 4d 65 64 69 61 28 22 28 70 72 65 66 65 tchMedia("(prefe
0003d250: 72 73 2d 72 65 64 75 63 65 64 2d 6d 6f 74 69 6f rs-reduced-motio
0003d260: 6e 3a 20 72 65 64 75 63 65 29 22 29 2c 6e 3d 28 n: reduce)"),n=(
0003d270: 29 3d 3e 7b 74 28 65 2e 6d 61 74 63 68 65 73 29 )=>{t(e.matches)
0003d280: 7d 3b 72 65 74 75 72 6e 20 6e 28 29 2c 65 2e 61 };return n(),e.a
0003d290: 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 ddEventListener(
0003d2a0: 22 63 68 61 6e 67 65 22 2c 6e 29 2c 28 29 3d 3e "change",n),()=>
0003d2b0: 65 2e 72 65 6d 6f 76 65 45 76 65 6e 74 4c 69 73 e.removeEventLis
0003d2c0: 74 65 6e 65 72 28 22 63 68 61 6e 67 65 22 2c 6e tener("change",n
0003d2d0: 29 7d 29 2c 5b 5d 29 2c 65 7d 66 75 6e 63 74 69 )}),[]),e}functi
0003d2e0: 6f 6e 20 42 53 28 65 29 7b 63 6f 6e 73 74 20 74 on BS(e){const t
0003d2f0: 3d 65 2e 70 72 6f 70 73 2e 63 72 6f 70 2c 6e 3d =e.props.crop,n=
0003d300: 74 3f 2e 74 6f 70 4c 65 66 74 3b 69 66 28 21 6e t?.topLeft;if(!n
0003d310: 29 72 65 74 75 72 6e 7b 77 69 64 74 68 3a 65 2e )return{width:e.
0003d320: 70 72 6f 70 73 2e 77 2c 68 65 69 67 68 74 3a 65 props.w,height:e
0003d330: 2e 70 72 6f 70 73 2e 68 7d 3b 63 6f 6e 73 74 20 .props.h};const
0003d340: 72 3d 31 2f 28 74 2e 62 6f 74 74 6f 6d 52 69 67 r=1/(t.bottomRig
0003d350: 68 74 2e 78 2d 74 2e 74 6f 70 4c 65 66 74 2e 78 ht.x-t.topLeft.x
0003d360: 29 2a 65 2e 70 72 6f 70 73 2e 77 2c 6f 3d 31 2f )*e.props.w,o=1/
0003d370: 28 74 2e 62 6f 74 74 6f 6d 52 69 67 68 74 2e 79 (t.bottomRight.y
0003d380: 2d 74 2e 74 6f 70 4c 65 66 74 2e 79 29 2a 65 2e -t.topLeft.y)*e.
0003d390: 70 72 6f 70 73 2e 68 3b 72 65 74 75 72 6e 7b 74 props.h;return{t
0003d3a0: 72 61 6e 73 66 6f 72 6d 3a 60 74 72 61 6e 73 6c ransform:`transl
0003d3b0: 61 74 65 28 24 7b 2d 6e 2e 78 2a 72 7d 70 78 2c ate(${-n.x*r}px,
0003d3c0: 20 24 7b 2d 6e 2e 79 2a 6f 7d 70 78 29 60 2c 77 ${-n.y*o}px)`,w
0003d3d0: 69 64 74 68 3a 72 2c 68 65 69 67 68 74 3a 6f 7d idth:r,height:o}
0003d3e0: 7d 66 75 6e 63 74 69 6f 6e 20 55 53 28 65 29 7b }function US(e){
0003d3f0: 72 65 74 75 72 6e 7b 73 69 7a 65 3a 65 2c 74 68 return{size:e,th
0003d400: 69 6e 6e 69 6e 67 3a 2e 34 2c 73 74 72 65 61 6d inning:.4,stream
0003d410: 6c 69 6e 65 3a 30 2c 73 6d 6f 6f 74 68 69 6e 67 line:0,smoothing
0003d420: 3a 2e 35 2c 73 69 6d 75 6c 61 74 65 50 72 65 73 :.5,simulatePres
0003d430: 73 75 72 65 3a 21 30 2c 6c 61 73 74 3a 21 30 7d sure:!0,last:!0}
0003d440: 7d 66 75 6e 63 74 69 6f 6e 20 7a 53 28 65 2c 74 }function zS(e,t
0003d450: 2c 6e 29 7b 72 65 74 75 72 6e 20 4a 67 28 74 2e ,n){return Jg(t.
0003d460: 76 65 72 74 69 63 65 73 2c 55 53 28 6e 29 29 7d vertices,US(n))}
0003d470: 66 75 6e 63 74 69 6f 6e 20 47 53 28 65 2c 74 2c function GS(e,t,
0003d480: 6e 29 7b 63 6f 6e 73 74 20 72 3d 66 75 6e 63 74 n){const r=funct
0003d490: 69 6f 6e 28 65 2c 74 2c 6e 29 7b 63 6f 6e 73 74 ion(e,t,n){const
0003d4a0: 20 72 3d 55 53 28 6e 29 3b 72 65 74 75 72 6e 20 r=US(n);return
0003d4b0: 58 67 28 74 62 28 7a 53 28 30 2c 74 2c 6e 29 2c Xg(tb(zS(0,t,n),
0003d4c0: 72 29 2c 72 29 7d 28 30 2c 74 2c 6e 29 3b 72 65 r),r)}(0,t,n);re
0003d4d0: 74 75 72 6e 20 68 66 28 72 29 7d 66 75 6e 63 74 turn hf(r)}funct
0003d4e0: 69 6f 6e 20 48 53 28 65 2c 74 2c 6e 29 7b 6c 65 ion HS(e,t,n){le
0003d4f0: 74 20 72 3d 60 4d 20 24 7b 63 75 28 74 5b 30 5d t r=`M ${cu(t[0]
0003d500: 29 7d 4c 60 2c 6f 3d 60 4d 20 24 7b 63 75 28 74 )}L`,o=`M ${cu(t
0003d510: 5b 30 5d 29 7d 4c 60 3b 63 6f 6e 73 74 20 69 3d [0])}L`;const i=
0003d520: 6e 2f 33 2c 61 3d 32 2a 6e 2c 73 3d 6d 6f 28 65 n/3,a=2*n,s=mo(e
0003d530: 29 3b 6c 65 74 20 6c 2c 63 2c 75 3d 74 5b 30 5d );let l,c,u=t[0]
0003d540: 2c 64 3d 74 5b 30 5d 3b 66 6f 72 28 6c 65 74 20 ,d=t[0];for(let
0003d550: 65 3d 30 2c 6e 3d 74 2e 6c 65 6e 67 74 68 2d 31 e=0,n=t.length-1
0003d560: 3b 65 3c 6e 3b 65 2b 2b 29 7b 6c 3d 74 5b 65 2b ;e<n;e++){l=t[e+
0003d570: 31 5d 2c 63 3d 73 75 2e 41 64 64 58 59 28 74 5b 1],c=su.AddXY(t[
0003d580: 65 2b 31 5d 2c 73 28 29 2a 69 2c 73 28 29 2a 69 e+1],s()*i,s()*i
0003d590: 29 3b 63 6f 6e 73 74 20 70 3d 73 75 2e 53 75 62 );const p=su.Sub
0003d5a0: 28 6c 2c 75 29 2c 66 3d 73 75 2e 4c 65 6e 28 70 (l,u),f=su.Len(p
0003d5b0: 29 2c 68 3d 73 75 2e 44 69 76 28 70 2c 66 29 2e ),h=su.Div(p,f).
0003d5c0: 6d 75 6c 28 4d 61 74 68 2e 6d 69 6e 28 66 2f 34 mul(Math.min(f/4
0003d5d0: 2c 61 29 29 2c 6d 3d 73 75 2e 41 64 64 28 75 2c ,a)),m=su.Add(u,
0003d5e0: 68 29 2c 67 3d 73 75 2e 41 64 64 28 6c 2c 68 2e h),g=su.Add(l,h.
0003d5f0: 6e 65 67 28 29 29 2c 62 3d 73 75 2e 53 75 62 28 neg()),b=su.Sub(
0003d600: 63 2c 64 29 2c 79 3d 73 75 2e 4c 65 6e 28 62 29 c,d),y=su.Len(b)
0003d610: 2c 76 3d 73 75 2e 44 69 76 28 62 2c 79 29 2e 6d ,v=su.Div(b,y).m
0003d620: 75 6c 28 4d 61 74 68 2e 6d 69 6e 28 79 2f 34 2c ul(Math.min(y/4,
0003d630: 61 29 29 2c 53 3d 73 75 2e 41 64 64 28 64 2c 76 a)),S=su.Add(d,v
0003d640: 29 2c 5f 3d 73 75 2e 41 64 64 28 63 2c 76 2e 6e ),_=su.Add(c,v.n
0003d650: 65 67 28 29 29 3b 65 3d 3d 3d 6e 2d 31 3f 28 72 eg());e===n-1?(r
0003d660: 2b 3d 60 24 7b 63 75 28 6d 29 7d 4c 20 24 7b 63 +=`${cu(m)}L ${c
0003d670: 75 28 6c 29 7d 60 2c 6f 2b 3d 60 24 7b 63 75 28 u(l)}`,o+=`${cu(
0003d680: 53 29 7d 4c 20 24 7b 63 75 28 63 29 7d 60 29 3a S)}L ${cu(c)}`):
0003d690: 28 72 2b 3d 60 24 7b 63 75 28 6d 29 7d 4c 20 24 (r+=`${cu(m)}L $
0003d6a0: 7b 63 75 28 67 29 7d 51 20 24 7b 63 75 28 6c 29 {cu(g)}Q ${cu(l)
0003d6b0: 7d 60 2c 6f 2b 3d 60 24 7b 63 75 28 53 29 7d 4c }`,o+=`${cu(S)}L
0003d6c0: 20 24 7b 63 75 28 5f 29 7d 51 20 24 7b 63 75 28 ${cu(_)}Q ${cu(
0003d6d0: 63 29 7d 60 2c 75 3d 6c 2c 64 3d 63 29 7d 72 65 c)}`,u=l,d=c)}re
0003d6e0: 74 75 72 6e 5b 72 2c 72 2b 6f 5d 7d 63 6f 6e 73 turn[r,r+o]}cons
0003d6f0: 74 20 56 53 3d 6e 65 77 20 7a 72 3b 66 75 6e 63 t VS=new zr;func
0003d700: 74 69 6f 6e 20 71 53 28 65 29 7b 72 65 74 75 72 tion qS(e){retur
0003d710: 6e 20 4f 62 6a 65 63 74 2e 76 61 6c 75 65 73 28 n Object.values(
0003d720: 65 2e 70 72 6f 70 73 2e 70 6f 69 6e 74 73 29 2e e.props.points).
0003d730: 73 6f 72 74 28 56 6f 29 7d 66 75 6e 63 74 69 6f sort(Vo)}functio
0003d740: 6e 20 57 53 28 65 29 7b 63 6f 6e 73 74 20 74 3d n WS(e){const t=
0003d750: 71 53 28 65 29 2e 6d 61 70 28 73 75 2e 46 72 6f qS(e).map(su.Fro
0003d760: 6d 29 3b 73 77 69 74 63 68 28 65 2e 70 72 6f 70 m);switch(e.prop
0003d770: 73 2e 73 70 6c 69 6e 65 29 7b 63 61 73 65 22 63 s.spline){case"c
0003d780: 75 62 69 63 22 3a 72 65 74 75 72 6e 20 6e 65 77 ubic":return new
0003d790: 20 42 67 28 7b 70 6f 69 6e 74 73 3a 74 7d 29 3b Bg({points:t});
0003d7a0: 63 61 73 65 22 6c 69 6e 65 22 3a 72 65 74 75 72 case"line":retur
0003d7b0: 6e 20 6e 65 77 20 41 68 28 7b 70 6f 69 6e 74 73 n new Ah({points
0003d7c0: 3a 74 7d 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 4b :t})}}function K
0003d7d0: 53 28 7b 73 68 61 70 65 3a 65 2c 73 68 6f 75 6c S({shape:e,shoul
0003d7e0: 64 53 63 61 6c 65 3a 74 3d 21 31 7d 29 7b 63 6f dScale:t=!1}){co
0003d7f0: 6e 73 74 20 6e 3d 51 79 28 29 2c 72 3d 57 53 28 nst n=Qy(),r=WS(
0003d800: 65 29 2c 7b 64 61 73 68 3a 6f 2c 63 6f 6c 6f 72 e),{dash:o,color
0003d810: 3a 69 2c 73 69 7a 65 3a 61 7d 3d 65 2e 70 72 6f :i,size:a}=e.pro
0003d820: 70 73 2c 73 3d 31 2f 65 2e 70 72 6f 70 73 2e 73 ps,s=1/e.props.s
0003d830: 63 61 6c 65 2c 6c 3d 74 3f 73 3a 31 2c 63 3d 50 cale,l=t?s:1,c=P
0003d840: 62 5b 61 5d 2a 65 2e 70 72 6f 70 73 2e 73 63 61 b[a]*e.props.sca
0003d850: 6c 65 3b 69 66 28 22 6c 69 6e 65 22 3d 3d 3d 65 le;if("line"===e
0003d860: 2e 70 72 6f 70 73 2e 73 70 6c 69 6e 65 29 7b 69 .props.spline){i
0003d870: 66 28 22 73 6f 6c 69 64 22 3d 3d 3d 6f 29 7b 63 f("solid"===o){c
0003d880: 6f 6e 73 74 20 65 3d 72 2e 70 6f 69 6e 74 73 2c onst e=r.points,
0003d890: 74 3d 22 4d 22 2b 65 5b 30 5d 2b 22 4c 22 2b 65 t="M"+e[0]+"L"+e
0003d8a0: 2e 73 6c 69 63 65 28 31 29 3b 72 65 74 75 72 6e .slice(1);return
0003d8b0: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 (0,Qc.jsx)("path
0003d8c0: 22 2c 7b 64 3a 74 2c 73 74 72 6f 6b 65 3a 6e 5b ",{d:t,stroke:n[
0003d8d0: 69 5d 2e 73 6f 6c 69 64 2c 73 74 72 6f 6b 65 57 i].solid,strokeW
0003d8e0: 69 64 74 68 3a 63 2c 66 69 6c 6c 3a 22 6e 6f 6e idth:c,fill:"non
0003d8f0: 65 22 2c 74 72 61 6e 73 66 6f 72 6d 3a 60 73 63 e",transform:`sc
0003d900: 61 6c 65 28 24 7b 6c 7d 29 60 7d 29 7d 69 66 28 ale(${l})`})}if(
0003d910: 22 64 61 73 68 65 64 22 3d 3d 3d 6f 7c 7c 22 64 "dashed"===o||"d
0003d920: 6f 74 74 65 64 22 3d 3d 3d 6f 29 72 65 74 75 72 otted"===o)retur
0003d930: 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 22 2c n(0,Qc.jsx)("g",
0003d940: 7b 73 74 72 6f 6b 65 3a 6e 5b 69 5d 2e 73 6f 6c {stroke:n[i].sol
0003d950: 69 64 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a 63 id,strokeWidth:c
0003d960: 2c 74 72 61 6e 73 66 6f 72 6d 3a 60 73 63 61 6c ,transform:`scal
0003d970: 65 28 24 7b 6c 7d 29 60 2c 63 68 69 6c 64 72 65 e(${l})`,childre
0003d980: 6e 3a 72 2e 73 65 67 6d 65 6e 74 73 2e 6d 61 70 n:r.segments.map
0003d990: 28 28 28 65 2c 74 29 3d 3e 7b 63 6f 6e 73 74 7b (((e,t)=>{const{
0003d9a0: 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 3a strokeDasharray:
0003d9b0: 6e 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 n,strokeDashoffs
0003d9c0: 65 74 3a 69 7d 3d 79 76 28 65 2e 6c 65 6e 67 74 et:i}=yv(e.lengt
0003d9d0: 68 2c 63 2c 7b 73 74 79 6c 65 3a 6f 2c 73 74 61 h,c,{style:o,sta
0003d9e0: 72 74 3a 74 3e 30 3f 22 6f 75 74 73 65 74 22 3a rt:t>0?"outset":
0003d9f0: 22 6e 6f 6e 65 22 2c 65 6e 64 3a 74 3c 72 2e 73 "none",end:t<r.s
0003da00: 65 67 6d 65 6e 74 73 2e 6c 65 6e 67 74 68 2d 31 egments.length-1
0003da10: 3f 22 6f 75 74 73 65 74 22 3a 22 6e 6f 6e 65 22 ?"outset":"none"
0003da20: 7d 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a });return(0,Qc.j
0003da30: 73 78 29 28 22 70 61 74 68 22 2c 7b 73 74 72 6f sx)("path",{stro
0003da40: 6b 65 44 61 73 68 61 72 72 61 79 3a 6e 2c 73 74 keDasharray:n,st
0003da50: 72 6f 6b 65 44 61 73 68 6f 66 66 73 65 74 3a 69 rokeDashoffset:i
0003da60: 2c 64 3a 65 2e 67 65 74 53 76 67 50 61 74 68 44 ,d:e.getSvgPathD
0003da70: 61 74 61 28 21 30 29 2c 66 69 6c 6c 3a 22 6e 6f ata(!0),fill:"no
0003da80: 6e 65 22 7d 2c 74 29 7d 29 29 7d 29 3b 69 66 28 ne"},t)}))});if(
0003da90: 22 64 72 61 77 22 3d 3d 3d 6f 29 7b 63 6f 6e 73 "draw"===o){cons
0003daa0: 74 20 74 3d 72 2e 70 6f 69 6e 74 73 2c 5b 6f 2c t t=r.points,[o,
0003dab0: 61 5d 3d 48 53 28 65 2e 69 64 2c 74 2c 63 29 3b a]=HS(e.id,t,c);
0003dac0: 72 65 74 75 72 6e 28 30 2c 51 63 2e 6a 73 78 29 return(0,Qc.jsx)
0003dad0: 28 22 70 61 74 68 22 2c 7b 64 3a 61 2c 73 74 72 ("path",{d:a,str
0003dae0: 6f 6b 65 3a 6e 5b 69 5d 2e 73 6f 6c 69 64 2c 73 oke:n[i].solid,s
0003daf0: 74 72 6f 6b 65 57 69 64 74 68 3a 63 2c 66 69 6c trokeWidth:c,fil
0003db00: 6c 3a 22 6e 6f 6e 65 22 2c 74 72 61 6e 73 66 6f l:"none",transfo
0003db10: 72 6d 3a 60 73 63 61 6c 65 28 24 7b 6c 7d 29 60 rm:`scale(${l})`
0003db20: 7d 29 7d 7d 69 66 28 22 63 75 62 69 63 22 3d 3d })}}if("cubic"==
0003db30: 3d 65 2e 70 72 6f 70 73 2e 73 70 6c 69 6e 65 29 =e.props.spline)
0003db40: 7b 63 6f 6e 73 74 20 65 3d 72 2e 67 65 74 53 76 {const e=r.getSv
0003db50: 67 50 61 74 68 44 61 74 61 28 29 3b 69 66 28 22 gPathData();if("
0003db60: 73 6f 6c 69 64 22 3d 3d 3d 6f 29 72 65 74 75 72 solid"===o)retur
0003db70: 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 n(0,Qc.jsx)("pat
0003db80: 68 22 2c 7b 73 74 72 6f 6b 65 57 69 64 74 68 3a h",{strokeWidth:
0003db90: 63 2c 73 74 72 6f 6b 65 3a 6e 5b 69 5d 2e 73 6f c,stroke:n[i].so
0003dba0: 6c 69 64 2c 66 69 6c 6c 3a 22 6e 6f 6e 65 22 2c lid,fill:"none",
0003dbb0: 64 3a 65 2c 74 72 61 6e 73 66 6f 72 6d 3a 60 73 d:e,transform:`s
0003dbc0: 63 61 6c 65 28 24 7b 6c 7d 29 60 7d 29 3b 69 66 cale(${l})`});if
0003dbd0: 28 22 64 61 73 68 65 64 22 3d 3d 3d 6f 7c 7c 22 ("dashed"===o||"
0003dbe0: 64 6f 74 74 65 64 22 3d 3d 3d 6f 29 72 65 74 75 dotted"===o)retu
0003dbf0: 72 6e 28 30 2c 51 63 2e 6a 73 78 29 28 22 67 22 rn(0,Qc.jsx)("g"
0003dc00: 2c 7b 73 74 72 6f 6b 65 3a 6e 5b 69 5d 2e 73 6f ,{stroke:n[i].so
0003dc10: 6c 69 64 2c 73 74 72 6f 6b 65 57 69 64 74 68 3a lid,strokeWidth:
0003dc20: 63 2c 74 72 61 6e 73 66 6f 72 6d 3a 60 73 63 61 c,transform:`sca
0003dc30: 6c 65 28 24 7b 6c 7d 29 60 2c 63 68 69 6c 64 72 le(${l})`,childr
0003dc40: 65 6e 3a 72 2e 73 65 67 6d 65 6e 74 73 2e 6d 61 en:r.segments.ma
0003dc50: 70 28 28 28 65 2c 74 29 3d 3e 7b 63 6f 6e 73 74 p(((e,t)=>{const
0003dc60: 7b 73 74 72 6f 6b 65 44 61 73 68 61 72 72 61 79 {strokeDasharray
0003dc70: 3a 6e 2c 73 74 72 6f 6b 65 44 61 73 68 6f 66 66 :n,strokeDashoff
0003dc80: 73 65 74 3a 69 7d 3d 79 76 28 65 2e 6c 65 6e 67 set:i}=yv(e.leng
0003dc90: 74 68 2c 63 2c 7b 73 74 79 6c 65 3a 6f 2c 73 74 th,c,{style:o,st
0003dca0: 61 72 74 3a 74 3e 30 3f 22 6f 75 74 73 65 74 22 art:t>0?"outset"
0003dcb0: 3a 22 6e 6f 6e 65 22 2c 65 6e 64 3a 74 3c 72 2e :"none",end:t<r.
0003dcc0: 73 65 67 6d 65 6e 74 73 2e 6c 65 6e 67 74 68 2d segments.length-
0003dcd0: 31 3f 22 6f 75 74 73 65 74 22 3a 22 6e 6f 6e 65 1?"outset":"none
0003dce0: 22 7d 29 3b 72 65 74 75 72 6e 28 30 2c 51 63 2e "});return(0,Qc.
0003dcf0: 6a 73 78 29 28 22 70 61 74 68 22 2c 7b 73 74 72 jsx)("path",{str
0003dd00: 6f 6b 65 44 61 73 68 61 72 72 61 79 3a 6e 2c 73 okeDasharray:n,s
0003dd10: 74 72 6f 6b 65 44 61 73 68 6f 66 66 73 65 74 3a trokeDashoffset:
0003dd20: 69 2c 64 3a 65 2e 67 65 74 53 76 67 50 61 74 68 i,d:e.getSvgPath
0003dd30: 44 61 74 61 28 29 2c 66 69 6c 6c 3a 22 6e 6f 6e Data(),fill:"non
0003dd40: 65 22 7d 2c 74 29 7d 29 29 7d 29 3b 69 66 28 22 e"},t)}))});if("
0003dd50: 64 72 61 77 22 3d 3d 3d 6f 29 72 65 74 75 72 6e draw"===o)return
0003dd60: 28 30 2c 51 63 2e 6a 73 78 29 28 22 70 61 74 68 (0,Qc.jsx)("path
0003dd70: 22 2c 7b 64 3a 47 53 28 30 2c 72 2c 63 29 2c 73 ",{d:GS(0,r,c),s
0003dd80: 74 72 6f 6b 65 57 69 64 74 68 3a 31 2c 73 74 72 trokeWidth:1,str
0003dd90: 6f 6b 65 3a 6e 5b 69 5d 2e 73 6f 6c 69 64 2c 66 oke:n[i].solid,f
0003dda0: 69 6c 6c 3a 6e 5b 69 5d 2e 73 6f 6c 69 64 2c 74 ill:n[i].solid,t
0003ddb0: 72 61 6e 73 66 6f 72 6d 3a 60 73 63 61 6c 65 28 ransform:`scale(
0003ddc0: 24 7b 6c 7d 29 60 7d 29 7d 7d 63 6f 6e 73 74 20 ${l})`})}}const
0003ddd0: 59 53 3d 28 30 2c 6f 2e 63 72 65 61 74 65 43 6f YS=(0,o.createCo
0003dde0: 6e 74 65 78 74 29 28 6e 75 6c 6c 29 3b 66 75 6e ntext)(null);fun
0003ddf0: 63 74 69 6f 6e 20 58 53 28 7b 61 73 73 65 74 55 ction XS({assetU
0003de00: 72 6c 73 3a 65 2c 63 68 69 6c 64 72 65 6e 3a 74 rls:e,children:t
0003de10: 7d 29 7b 72 65 74 75 72 6e 28 30 2c 6f 2e 75 73 }){return(0,o.us
0003de20: 65 45 66 66 65 63 74 29 28 28 28 29 3d 3e 7b 66 eEffect)((()=>{f
0003de30: 6f 72 28 63 6f 6e 73 74 20 74 20 6f 66 20 4f 62 or(const t of Ob
0003de40: 6a 65 63 74 2e 76 61 6c 75 65 73 28 65 2e 69 63 ject.values(e.ic
0003de50: 6f 6e 73 29 29 7b 63 6f 6e 73 74 20 65 3d 4a 72 ons)){const e=Jr
0003de60: 28 29 3b 65 2e 73 72 63 3d 74 2c 65 2e 64 65 63 ();e.src=t,e.dec
0003de70: 6f 64 65 28 29 7d 66 6f 72 28 63 6f 6e 73 74 20 ode()}for(const
0003de80: 74 20 6f 66 20 4f 62 6a 65 63 74 2e 76 61 6c 75 t of Object.valu
0003de90: 65 73 28 65 2e 65 6d 62 65 64 49 63 6f 6e 73 29 es(e.embedIcons)
0003dea0: 29 7b 63 6f 6e 73 74 20 65 3d 4a 72 28 29 3b 65 ){const e=Jr();e
0003deb0: 2e 73 72 63 3d 74 2c 65 2e 64 65 63 6f 64 65 28 .src=t,e.decode(
0003dec0: 29 7d 7d 29 2c 5b 65 5d 29 2c 28 30 2c 51 63 2e )}}),[e]),(0,Qc.
0003ded0: 6a 73 78 29 28 59 53 2e 50 72 6f 76 69 64 65 72 jsx)(YS.Provider
0003dee0: 2c 7b 76 61 6c 75 65 3a 65 2c 63 68 69 6c 64 72 ,{value:e,childr
0003def0: 65 6e 3a 74 7d 29 7d 66 75 6e 63 74 69 6f 6e 20 en:t})}function
0003df00: 5a 53 28 29 7b 63 6f 6e 73 74 20 65 3d 28 30 2c ZS(){const e=(0,
0003df10: 6f 2e 75 73 65 43 6f 6e 74 65 78 74 29 28 59 53 o.useContext)(YS
0003df20: 29 3b 69 66 28 21 65 29 74 68 72 6f 77 20 6e 65 );if(!e)throw ne
0003df30: 77 20 45 72 72 6f 72 28 22 75 73 65 41 73 73 65 w Error("useAsse
0003df40: 74 55 72 6c 73 20 6d 75 73 74 20 62 65 20 75 73 tUrls must be us
0003df50: 65 64 20 77 69 74 68 69 6e 20 61 6e 20 41 73 73 ed within an Ass
0003df60: 65 74 55 72 6c 73 50 72 6f 76 69 64 65 72 22 29 etUrlsProvider")
0003df70: 3b 72 65 74 75 72 6e 20 65 7d 63 6f 6e 73 74 20 ;return e}const
0003df80: 51 53 3d 7b 22 61 63 74 69 6f 6e 2e 63 6f 6e 76 QS={"action.conv
0003df90: 65 72 74 2d 74 6f 2d 62 6f 6f 6b 6d 61 72 6b 22 ert-to-bookmark"
0003dfa0: 3a 22 43 6f 6e 76 65 72 74 20 74 6f 20 42 6f 6f :"Convert to Boo
0003dfb0: 6b 6d 61 72 6b 22 2c 22 61 63 74 69 6f 6e 2e 63 kmark","action.c
0003dfc0: 6f 6e 76 65 72 74 2d 74 6f 2d 65 6d 62 65 64 22 onvert-to-embed"
0003dfd0: 3a 22 43 6f 6e 76 65 72 74 20 74 6f 20 45 6d 62 :"Convert to Emb
0003dfe0: 65 64 22 2c 22 61 63 74 69 6f 6e 2e 6f 70 65 6e ed","action.open
0003dff0: 2d 65 6d 62 65 64 2d 6c 69 6e 6b 22 3a 22 4f 70 -embed-link":"Op
0003e000: 65 6e 20 6c 69 6e 6b 22 2c 22 61 63 74 69 6f 6e en link","action
0003e010: 2e 61 6c 69 67 6e 2d 62 6f 74 74 6f 6d 22 3a 22 .align-bottom":"
0003e020: 41 6c 69 67 6e 20 62 6f 74 74 6f 6d 22 2c 22 61 Align bottom","a
0003e030: 63 74 69 6f 6e 2e 61 6c 69 67 6e 2d 63 65 6e 74 ction.align-cent
0003e040: 65 72 2d 68 6f 72 69 7a 6f 6e 74 61 6c 22 3a 22 er-horizontal":"
0003e050: 41 6c 69 67 6e 20 68 6f 72 69 7a 6f 6e 74 61 6c Align horizontal
0003e060: 6c 79 22 2c 22 61 63 74 69 6f 6e 2e 61 6c 69 67 ly","action.alig
0003e070: 6e 2d 63 65 6e 74 65 72 2d 76 65 72 74 69 63 61 n-center-vertica
0003e080: 6c 22 3a 22 41 6c 69 67 6e 20 76 65 72 74 69 63 l":"Align vertic
0003e090: 61 6c 6c 79 22 2c 22 61 63 74 69 6f 6e 2e 61 6c ally","action.al
0003e0a0: 69 67 6e 2d 63 65 6e 74 65 72 2d 68 6f 72 69 7a ign-center-horiz
0003e0b0: 6f 6e 74 61 6c 2e 73 68 6f 72 74 22 3a 22 41 6c ontal.short":"Al
0003e0c0: 69 67 6e 20 48 22 2c 22 61 63 74 69 6f 6e 2e 61 ign H","action.a
0003e0d0: 6c 69 67 6e 2d 63 65 6e 74 65 72 2d 76 65 72 74 lign-center-vert
0003e0e0: 69 63 61 6c 2e 73 68 6f 72 74 22 3a 22 41 6c 69 ical.short":"Ali
0003e0f0: 67 6e 20 56 22 2c 22 61 63 74 69 6f 6e 2e 61 6c gn V","action.al
0003e100: 69 67 6e 2d 6c 65 66 74 22 3a 22 41 6c 69 67 6e ign-left":"Align
0003e110: 20 6c 65 66 74 22 2c 22 61 63 74 69 6f 6e 2e 61 left","action.a
0003e120: 6c 69 67 6e 2d 72 69 67 68 74 22 3a 22 41 6c 69 lign-right":"Ali
0003e130: 67 6e 20 72 69 67 68 74 22 2c 22 61 63 74 69 6f gn right","actio
0003e140: 6e 2e 61 6c 69 67 6e 2d 74 6f 70 22 3a 22 41 6c n.align-top":"Al
0003e150: 69 67 6e 20 74 6f 70 22 2c 22 61 63 74 69 6f 6e ign top","action
0003e160: 2e 62 61 63 6b 2d 74 6f 2d 63 6f 6e 74 65 6e 74 .back-to-content
0003e170: 22 3a 22 42 61 63 6b 20 74 6f 20 63 6f 6e 74 65 ":"Back to conte
0003e180: 6e 74 22 2c 22 61 63 74 69 6f 6e 2e 62 72 69 6e nt","action.brin
0003e190: 67 2d 66 6f 72 77 61 72 64 22 3a 22 42 72 69 6e g-forward":"Brin
0003e1a0: 67 20 66 6f 72 77 61 72 64 22 2c 22 61 63 74 69 g forward","acti
0003e1b0: 6f 6e 2e 62 72 69 6e 67 2d 74 6f 2d 66 72 6f 6e on.bring-to-fron
0003e1c0: 74 22 3a 22 42 72 69 6e 67 20 74 6f 20 66 72 6f t":"Bring to fro
0003e1d0: 6e 74 22 2c 22 61 63 74 69 6f 6e 2e 63 6f 70 79 nt","action.copy
0003e1e0: 2d 61 73 2d 6a 73 6f 6e 2e 73 68 6f 72 74 22 3a -as-json.short":
0003e1f0: 22 4a 53 4f 4e 22 2c 22 61 63 74 69 6f 6e 2e 63 "JSON","action.c
0003e200: 6f 70 79 2d 61 73 2d 6a 73 6f 6e 22 3a 22 43 6f opy-as-json":"Co
0003e210: 70 79 20 61 73 20 4a 53 4f 4e 22 2c 22 61 63 74 py as JSON","act
0003e220: 69 6f 6e 2e 63 6f 70 79 2d 61 73 2d 70 6e 67 2e ion.copy-as-png.
0003e230: 73 68 6f 72 74 22 3a 22 50 4e 47 22 2c 22 61 63 short":"PNG","ac
0003e240: 74 69 6f 6e 2e 63 6f 70 79 2d 61 73 2d 70 6e 67 tion.copy-as-png
0003e250: 22 3a 22 43 6f 70 79 20 61 73 20 50 4e 47 22 2c ":"Copy as PNG",
0003e260: 22 61 63 74 69 6f 6e 2e 63 6f 70 79 2d 61 73 2d "action.copy-as-
0003e270: 73 76 67 2e 73 68 6f 72 74 22 3a 22 53 56 47 22 svg.short":"SVG"
0003e280: 2c 22 61 63 74 69 6f 6e 2e 63 6f 70 79 2d 61 73 ,"action.copy-as
0003e290: 2d 73 76 67 22 3a 22 43 6f 70 79 20 61 73 20 53 -svg":"Copy as S
0003e2a0: 56 47 22 2c 22 61 63 74 69 6f 6e 2e 63 6f 70 79 VG","action.copy
0003e2b0: 22 3a 22 43 6f 70 79 22 2c 22 61 63 74 69 6f 6e ":"Copy","action
0003e2c0: 2e 63 75 74 22 3a 22 43 75 74 22 2c 22 61 63 74 .cut":"Cut","act
0003e2d0: 69 6f 6e 2e 64 65 6c 65 74 65 22 3a 22 44 65 6c ion.delete":"Del
0003e2e0: 65 74 65 22 2c 22 61 63 74 69 6f 6e 2e 75 6e 6c ete","action.unl
0003e2f0: 6f 63 6b 2d 61 6c 6c 22 3a 22 55 6e 6c 6f 63 6b ock-all":"Unlock
0003e300: 20 61 6c 6c 22 2c 22 61 63 74 69 6f 6e 2e 64 69 all","action.di
0003e310: 73 74 72 69 62 75 74 65 2d 68 6f 72 69 7a 6f 6e stribute-horizon
0003e320: 74 61 6c 22 3a 22 44 69 73 74 72 69 62 75 74 65 tal":"Distribute
0003e330: 20 68 6f 72 69 7a 6f 6e 74 61 6c 6c 79 22 2c 22 horizontally","
0003e340: 61 63 74 69 6f 6e 2e 64 69 73 74 72 69 62 75 74 action.distribut
0003e350: 65 2d 76 65 72 74 69 63 61 6c 22 3a 22 44 69 73 e-vertical":"Dis
0003e360: 74 72 69 62 75 74 65 20 76 65 72 74 69 63 61 6c tribute vertical
0003e370: 6c 79 22 2c 22 61 63 74 69 6f 6e 2e 64 69 73 74 ly","action.dist
0003e380: 72 69 62 75 74 65 2d 68 6f 72 69 7a 6f 6e 74 61 ribute-horizonta
0003e390: 6c 2e 73 68 6f 72 74 22 3a 22 44 69 73 74 72 69 l.short":"Distri
0003e3a0: 62 75 74 65 20 48 22 2c 22 61 63 74 69 6f 6e 2e bute H","action.
0003e3b0: 64 69 73 74 72 69 62 75 74 65 2d 76 65 72 74 69 distribute-verti
0003e3c0: 63 61 6c 2e 73 68 6f 72 74 22 3a 22 44 69 73 74 cal.short":"Dist
0003e3d0: 72 69 62 75 74 65 20 56 22 2c 22 61 63 74 69 6f ribute V","actio
0003e3e0: 6e 2e 64 75 70 6c 69 63 61 74 65 22 3a 22 44 75 n.duplicate":"Du
0003e3f0: 70 6c 69 63 61 74 65 22 2c 22 61 63 74 69 6f 6e plicate","action
0003e400: 2e 65 64 69 74 2d 6c 69 6e 6b 22 3a 22 45 64 69 .edit-link":"Edi
0003e410: 74 20 6c 69 6e 6b 22 2c 22 61 63 74 69 6f 6e 2e t link","action.
0003e420: 65 78 69 74 2d 70 65 6e 2d 6d 6f 64 65 22 3a 22 exit-pen-mode":"
0003e430: 45 78 69 74 20 70 65 6e 20 6d 6f 64 65 22 2c 22 Exit pen mode","
0003e440: 61 63 74 69 6f 6e 2e 65 78 70 6f 72 74 2d 61 73 action.export-as
0003e450: 2d 6a 73 6f 6e 2e 73 68 6f 72 74 22 3a 22 4a 53 -json.short":"JS
0003e460: 4f 4e 22 2c 22 61 63 74 69 6f 6e 2e 65 78 70 6f ON","action.expo
0003e470: 72 74 2d 61 73 2d 6a 73 6f 6e 22 3a 22 45 78 70 rt-as-json":"Exp
0003e480: 6f 72 74 20 61 73 20 4a 53 4f 4e 22 2c 22 61 63 ort as JSON","ac
0003e490: 74 69 6f 6e 2e 65 78 70 6f 72 74 2d 61 73 2d 70 tion.export-as-p
0003e4a0: 6e 67 2e 73 68 6f 72 74 22 3a 22 50 4e 47 22 2c ng.short":"PNG",
0003e4b0: 22 61 63 74 69 6f 6e 2e 65 78 70 6f 72 74 2d 61 "action.export-a
0003e4c0: 73 2d 70 6e 67 22 3a 22 45 78 70 6f 72 74 20 61 s-png":"Export a
0003e4d0: 73 20 50 4e 47 22 2c 22 61 63 74 69 6f 6e 2e 65 s PNG","action.e
0003e4e0: 78 70 6f 72 74 2d 61 73 2d 73 76 67 2e 73 68 6f xport-as-svg.sho
0003e4f0: 72 74 22 3a 22 53 56 47 22 2c 22 61 63 74 69 6f rt":"SVG","actio
0003e500: 6e 2e 65 78 70 6f 72 74 2d 61 73 2d 73 76 67 22 n.export-as-svg"
0003e510: 3a 22 45 78 70 6f 72 74 20 61 73 20 53 56 47 22 :"Export as SVG"
0003e520: 2c 22 61 63 74 69 6f 6e 2e 65 78 70 6f 72 74 2d ,"action.export-
0003e530: 61 6c 6c 2d 61 73 2d 6a 73 6f 6e 2e 73 68 6f 72 all-as-json.shor
0003e540: 74 22 3a 22 4a 53 4f 4e 22 2c 22 61 63 74 69 6f t":"JSON","actio
0003e550: 6e 2e 65 78 70 6f 72 74 2d 61 6c 6c 2d 61 73 2d n.export-all-as-
0003e560: 6a 73 6f 6e 22 3a 22 45 78 70 6f 72 74 20 61 73 json":"Export as
0003e570: 20 4a 53 4f 4e 22 2c 22 61 63 74 69 6f 6e 2e 65 JSON","action.e
0003e580: 78 70 6f 72 74 2d 61 6c 6c 2d 61 73 2d 70 6e 67 xport-all-as-png
0003e590: 2e 73 68 6f 72 74 22 3a 22 50 4e 47 22 2c 22 61 .short":"PNG","a
0003e5a0: 63 74 69 6f 6e 2e 65 78 70 6f 72 74 2d 61 6c 6c ction.export-all
0003e5b0: 2d 61 73 2d 70 6e 67 22 3a 22 45 78 70 6f 72 74 -as-png":"Export
0003e5c0: 20 61 73 20 50 4e 47 22 2c 22 61 63 74 69 6f 6e as PNG","action
0003e5d0: 2e 65 78 70 6f 72 74 2d 61 6c 6c 2d 61 73 2d 73 .export-all-as-s
0003e5e0: 76 67 2e 73 68 6f 72 74 22 3a 22 53 56 47 22 2c vg.short":"SVG",
0003e5f0: 22 61 63 74 69 6f 6e 2e 65 78 70 6f 72 74 2d 61 "action.export-a
0003e600: 6c 6c 2d 61 73 2d 73 76 67 22 3a 22 45 78 70 6f ll-as-svg":"Expo
0003e610: 72 74 20 61 73 20 53 56 47 22 2c 22 61 63 74 69 rt as SVG","acti
0003e620: 6f 6e 2e 66 69 74 2d 66 72 61 6d 65 2d 74 6f 2d on.fit-frame-to-
0003e630: 63 6f 6e 74 65 6e 74 22 3a 22 46 69 74 20 74 6f content":"Fit to
0003e640: 20 63 6f 6e 74 65 6e 74 22 2c 22 61 63 74 69 6f content","actio
0003e650: 6e 2e 66 6c 69 70 2d 68 6f 72 69 7a 6f 6e 74 61 n.flip-horizonta
0003e660: 6c 22 3a 22 46 6c 69 70 20 68 6f 72 69 7a 6f 6e l":"Flip horizon
0003e670: 74 61 6c 6c 79 22 2c 22 61 63 74 69 6f 6e 2e 66 tally","action.f
0003e680: 6c 69 70 2d 76 65 72 74 69 63 61 6c 22 3a 22 46 lip-vertical":"F
0003e690: 6c 69 70 20 76 65 72 74 69 63 61 6c 6c 79 22 2c lip vertically",
0003e6a0: 22 61 63 74 69 6f 6e 2e 66 6c 69 70 2d 68 6f 72 "action.flip-hor
0003e6b0: 69 7a 6f 6e 74 61 6c 2e 73 68 6f 72 74 22 3a 22 izontal.short":"
0003e6c0: 46 6c 69 70 20 48 22 2c 22 61 63 74 69 6f 6e 2e Flip H","action.
0003e6d0: 66 6c 69 70 2d 76 65 72 74 69 63 61 6c 2e 73 68 flip-vertical.sh
0003e6e0: 6f 72 74 22 3a 22 46 6c 69 70 20 56 22 2c 22 61 ort":"Flip V","a
0003e6f0: 63 74 69 6f 6e 2e 66 6f 72 6b 2d 70 72 6f 6a 65 ction.fork-proje
0003e700: 63 74 22 3a 22 46 6f 72 6b 20 74 68 69 73 20 70 ct":"Fork this p
0003e710: 72 6f 6a 65 63 74 22 2c 22 61 63 74 69 6f 6e 2e roject","action.
0003e720: 66 6f 72 6b 2d 70 72 6f 6a 65 63 74 2d 6f 6e 2d fork-project-on-
0003e730: 74 6c 64 72 61 77 22 3a 22 46 6f 72 6b 20 70 72 tldraw":"Fork pr
0003e740: 6f 6a 65 63 74 20 6f 6e 20 74 6c 64 72 61 77 22 oject on tldraw"
0003e750: 2c 22 61 63 74 69 6f 6e 2e 67 72 6f 75 70 22 3a ,"action.group":
0003e760: 22 47 72 6f 75 70 22 2c 22 61 63 74 69 6f 6e 2e "Group","action.
0003e770: 69 6e 73 65 72 74 2d 65 6d 62 65 64 22 3a 22 49 insert-embed":"I
0003e780: 6e 73 65 72 74 20 65 6d 62 65 64 22 2c 22 61 63 nsert embed","ac
0003e790: 74 69 6f 6e 2e 69 6e 73 65 72 74 2d 6d 65 64 69 tion.insert-medi
0003e7a0: 61 22 3a 22 55 70 6c 6f 61 64 20 6d 65 64 69 61 a":"Upload media
0003e7b0: 22 2c 22 61 63 74 69 6f 6e 2e 6c 65 61 76 65 2d ","action.leave-
0003e7c0: 73 68 61 72 65 64 2d 70 72 6f 6a 65 63 74 22 3a shared-project":
0003e7d0: 22 4c 65 61 76 65 20 73 68 61 72 65 64 20 70 72 "Leave shared pr
0003e7e0: 6f 6a 65 63 74 22 2c 22 61 63 74 69 6f 6e 2e 6e oject","action.n
0003e7f0: 65 77 2d 70 72 6f 6a 65 63 74 22 3a 22 4e 65 77 ew-project":"New
0003e800: 20 70 72 6f 6a 65 63 74 22 2c 22 61 63 74 69 6f project","actio
0003e810: 6e 2e 6e 65 77 2d 73 68 61 72 65 64 2d 70 72 6f n.new-shared-pro
0003e820: 6a 65 63 74 22 3a 22 4e 65 77 20 73 68 61 72 65 ject":"New share
0003e830: 64 20 70 72 6f 6a 65 63 74 22 2c 22 61 63 74 69 d project","acti
0003e840: 6f 6e 2e 6f 70 65 6e 2d 63 75 72 73 6f 72 2d 63 on.open-cursor-c
0003e850: 68 61 74 22 3a 22 43 75 72 73 6f 72 20 63 68 61 hat":"Cursor cha
0003e860: 74 22 2c 22 61 63 74 69 6f 6e 2e 6f 70 65 6e 2d t","action.open-
0003e870: 66 69 6c 65 22 3a 22 4f 70 65 6e 20 66 69 6c 65 file":"Open file
0003e880: 22 2c 22 61 63 74 69 6f 6e 2e 70 61 63 6b 22 3a ","action.pack":
0003e890: 22 50 61 63 6b 22 2c 22 61 63 74 69 6f 6e 2e 70 "Pack","action.p
0003e8a0: 61 73 74 65 22 3a 22 50 61 73 74 65 22 2c 22 61 aste":"Paste","a
0003e8b0: 63 74 69 6f 6e 2e 70 72 69 6e 74 22 3a 22 50 72 ction.print":"Pr
0003e8c0: 69 6e 74 22 2c 22 61 63 74 69 6f 6e 2e 72 65 64 int","action.red
0003e8d0: 6f 22 3a 22 52 65 64 6f 22 2c 22 61 63 74 69 6f o":"Redo","actio
0003e8e0: 6e 2e 72 65 6d 6f 76 65 2d 66 72 61 6d 65 22 3a n.remove-frame":
0003e8f0: 22 52 65 6d 6f 76 65 20 66 72 61 6d 65 22 2c 22 "Remove frame","
0003e900: 61 63 74 69 6f 6e 2e 72 65 6e 61 6d 65 22 3a 22 action.rename":"
0003e910: 52 65 6e 61 6d 65 22 2c 22 61 63 74 69 6f 6e 2e Rename","action.
0003e920: 72 6f 74 61 74 65 2d 63 63 77 22 3a 22 52 6f 74 rotate-ccw":"Rot
0003e930: 61 74 65 20 63 6f 75 6e 74 65 72 63 6c 6f 63 6b ate counterclock
0003e940: 77 69 73 65 22 2c 22 61 63 74 69 6f 6e 2e 72 6f wise","action.ro
0003e950: 74 61 74 65 2d 63 77 22 3a 22 52 6f 74 61 74 65 tate-cw":"Rotate
0003e960: 20 63 6c 6f 63 6b 77 69 73 65 22 2c 22 61 63 74 clockwise","act
0003e970: 69 6f 6e 2e 73 61 76 65 2d 63 6f 70 79 22 3a 22 ion.save-copy":"
0003e980: 53 61 76 65 20 61 20 63 6f 70 79 22 2c 22 61 63 Save a copy","ac
0003e990: 74 69 6f 6e 2e 73 65 6c 65 63 74 2d 61 6c 6c 22 tion.select-all"
0003e9a0: 3a 22 53 65 6c 65 63 74 20 61 6c 6c 22 2c 22 61 :"Select all","a
0003e9b0: 63 74 69 6f 6e 2e 73 65 6c 65 63 74 2d 6e 6f 6e ction.select-non
0003e9c0: 65 22 3a 22 53 65 6c 65 63 74 20 6e 6f 6e 65 22 e":"Select none"
0003e9d0: 2c 22 61 63 74 69 6f 6e 2e 73 65 6e 64 2d 62 61 ,"action.send-ba
0003e9e0: 63 6b 77 61 72 64 22 3a 22 53 65 6e 64 20 62 61 ckward":"Send ba
0003e9f0: 63 6b 77 61 72 64 22 2c 22 61 63 74 69 6f 6e 2e ckward","action.
0003ea00: 73 65 6e 64 2d 74 6f 2d 62 61 63 6b 22 3a 22 53 send-to-back":"S
0003ea10: 65 6e 64 20 74 6f 20 62 61 63 6b 22 2c 22 61 63 end to back","ac
0003ea20: 74 69 6f 6e 2e 73 68 61 72 65 2d 70 72 6f 6a 65 tion.share-proje
0003ea30: 63 74 22 3a 22 53 68 61 72 65 20 74 68 69 73 20 ct":"Share this
0003ea40: 70 72 6f 6a 65 63 74 22 2c 22 61 63 74 69 6f 6e project","action
0003ea50: 2e 73 74 61 63 6b 2d 68 6f 72 69 7a 6f 6e 74 61 .stack-horizonta
0003ea60: 6c 22 3a 22 53 74 61 63 6b 20 68 6f 72 69 7a 6f l":"Stack horizo
0003ea70: 6e 74 61 6c 6c 79 22 2c 22 61 63 74 69 6f 6e 2e ntally","action.
0003ea80: 73 74 61 63 6b 2d 76 65 72 74 69 63 61 6c 22 3a stack-vertical":
0003ea90: 22 53 74 61 63 6b 20 76 65 72 74 69 63 61 6c 6c "Stack verticall
0003eaa0: 79 22 2c 22 61 63 74 69 6f 6e 2e 73 74 61 63 6b y","action.stack
0003eab0: 2d 68 6f 72 69 7a 6f 6e 74 61 6c 2e 73 68 6f 72 -horizontal.shor
0003eac0: 74 22 3a 22 53 74 61 63 6b 20 48 22 2c 22 61 63 t":"Stack H","ac
0003ead0: 74 69 6f 6e 2e 73 74 61 63 6b 2d 76 65 72 74 69 tion.stack-verti
0003eae0: 63 61 6c 2e 73 68 6f 72 74 22 3a 22 53 74 61 63 cal.short":"Stac
0003eaf0: 6b 20 56 22 2c 22 61 63 74 69 6f 6e 2e 73 74 6f k V","action.sto
0003eb00: 70 2d 66 6f 6c 6c 6f 77 69 6e 67 22 3a 22 53 74 p-following":"St
0003eb10: 6f 70 20 66 6f 6c 6c 6f 77 69 6e 67 22 2c 22 61 op following","a
0003eb20: 63 74 69 6f 6e 2e 73 74 72 65 74 63 68 2d 68 6f ction.stretch-ho
0003eb30: 72 69 7a 6f 6e 74 61 6c 22 3a 22 53 74 72 65 74 rizontal":"Stret
0003eb40: 63 68 20 68 6f 72 69 7a 6f 6e 74 61 6c 6c 79 22 ch horizontally"
0003eb50: 2c 22 61 63 74 69 6f 6e 2e 73 74 72 65 74 63 68 ,"action.stretch
0003eb60: 2d 76 65 72 74 69 63 61 6c 22 3a 22 53 74 72 65 -vertical":"Stre
0003eb70: 74 63 68 20 76 65 72 74 69 63 61 6c 6c 79 22 2c tch vertically",
0003eb80: 22 61 63 74 69 6f 6e 2e 73 74 72 65 74 63 68 2d "action.stretch-
0003eb90: 68 6f 72 69 7a 6f 6e 74 61 6c 2e 73 68 6f 72 74 horizontal.short
0003eba0: 22 3a 22 53 74 72 65 74 63 68 20 48 22 2c 22 61 ":"Stretch H","a
0003ebb0: 63 74 69 6f 6e 2e 73 74 72 65 74 63 68 2d 76 65 ction.stretch-ve
0003ebc0: 72 74 69 63 61 6c 2e 73 68 6f 72 74 22 3a 22 53 rtical.short":"S
0003ebd0: 74 72 65 74 63 68 20 56 22 2c 22 61 63 74 69 6f tretch V","actio
0003ebe0: 6e 2e 74 6f 67 67 6c 65 2d 61 75 74 6f 2d 73 69 n.toggle-auto-si
0003ebf0: 7a 65 22 3a 22 54 6f 67 67 6c 65 20 61 75 74 6f ze":"Toggle auto
0003ec00: 20 73 69 7a 65 22 2c 22 61 63 74 69 6f 6e 2e 74 size","action.t
0003ec10: 6f 67 67 6c 65 2d 64 61 72 6b 2d 6d 6f 64 65 2e oggle-dark-mode.
0003ec20: 6d 65 6e 75 22 3a 22 44 61 72 6b 20 6d 6f 64 65 menu":"Dark mode
0003ec30: 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 ","action.toggle
0003ec40: 2d 64 61 72 6b 2d 6d 6f 64 65 22 3a 22 54 6f 67 -dark-mode":"Tog
0003ec50: 67 6c 65 20 64 61 72 6b 20 6d 6f 64 65 22 2c 22 gle dark mode","
0003ec60: 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 77 72 action.toggle-wr
0003ec70: 61 70 2d 6d 6f 64 65 2e 6d 65 6e 75 22 3a 22 53 ap-mode.menu":"S
0003ec80: 65 6c 65 63 74 20 6f 6e 20 77 72 61 70 22 2c 22 elect on wrap","
0003ec90: 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 77 72 action.toggle-wr
0003eca0: 61 70 2d 6d 6f 64 65 22 3a 22 54 6f 67 67 6c 65 ap-mode":"Toggle
0003ecb0: 20 53 65 6c 65 63 74 20 6f 6e 20 77 72 61 70 22 Select on wrap"
0003ecc0: 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d ,"action.toggle-
0003ecd0: 72 65 64 75 63 65 2d 6d 6f 74 69 6f 6e 2e 6d 65 reduce-motion.me
0003ece0: 6e 75 22 3a 22 52 65 64 75 63 65 20 6d 6f 74 69 nu":"Reduce moti
0003ecf0: 6f 6e 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 on","action.togg
0003ed00: 6c 65 2d 72 65 64 75 63 65 2d 6d 6f 74 69 6f 6e le-reduce-motion
0003ed10: 22 3a 22 54 6f 67 67 6c 65 20 72 65 64 75 63 65 ":"Toggle reduce
0003ed20: 20 6d 6f 74 69 6f 6e 22 2c 22 61 63 74 69 6f 6e motion","action
0003ed30: 2e 74 6f 67 67 6c 65 2d 65 64 67 65 2d 73 63 72 .toggle-edge-scr
0003ed40: 6f 6c 6c 69 6e 67 2e 6d 65 6e 75 22 3a 22 45 64 olling.menu":"Ed
0003ed50: 67 65 20 73 63 72 6f 6c 6c 69 6e 67 22 2c 22 61 ge scrolling","a
0003ed60: 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 65 64 67 ction.toggle-edg
0003ed70: 65 2d 73 63 72 6f 6c 6c 69 6e 67 22 3a 22 54 6f e-scrolling":"To
0003ed80: 67 67 6c 65 20 65 64 67 65 20 73 63 72 6f 6c 6c ggle edge scroll
0003ed90: 69 6e 67 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 ing","action.tog
0003eda0: 67 6c 65 2d 64 65 62 75 67 2d 6d 6f 64 65 2e 6d gle-debug-mode.m
0003edb0: 65 6e 75 22 3a 22 44 65 62 75 67 20 6d 6f 64 65 enu":"Debug mode
0003edc0: 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 ","action.toggle
0003edd0: 2d 64 65 62 75 67 2d 6d 6f 64 65 22 3a 22 54 6f -debug-mode":"To
0003ede0: 67 67 6c 65 20 64 65 62 75 67 20 6d 6f 64 65 22 ggle debug mode"
0003edf0: 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d ,"action.toggle-
0003ee00: 66 6f 63 75 73 2d 6d 6f 64 65 2e 6d 65 6e 75 22 focus-mode.menu"
0003ee10: 3a 22 46 6f 63 75 73 20 6d 6f 64 65 22 2c 22 61 :"Focus mode","a
0003ee20: 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 66 6f 63 ction.toggle-foc
0003ee30: 75 73 2d 6d 6f 64 65 22 3a 22 54 6f 67 67 6c 65 us-mode":"Toggle
0003ee40: 20 66 6f 63 75 73 20 6d 6f 64 65 22 2c 22 61 63 focus mode","ac
0003ee50: 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 64 79 6e 61 tion.toggle-dyna
0003ee60: 6d 69 63 2d 73 69 7a 65 2d 6d 6f 64 65 2e 6d 65 mic-size-mode.me
0003ee70: 6e 75 22 3a 22 44 79 6e 61 6d 69 63 20 73 69 7a nu":"Dynamic siz
0003ee80: 65 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c e","action.toggl
0003ee90: 65 2d 64 79 6e 61 6d 69 63 2d 73 69 7a 65 2d 6d e-dynamic-size-m
0003eea0: 6f 64 65 22 3a 22 54 6f 67 67 6c 65 20 64 79 6e ode":"Toggle dyn
0003eeb0: 61 6d 69 63 20 73 69 7a 65 22 2c 22 61 63 74 69 amic size","acti
0003eec0: 6f 6e 2e 74 6f 67 67 6c 65 2d 67 72 69 64 2e 6d on.toggle-grid.m
0003eed0: 65 6e 75 22 3a 22 53 68 6f 77 20 67 72 69 64 22 enu":"Show grid"
0003eee0: 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d ,"action.toggle-
0003eef0: 67 72 69 64 22 3a 22 54 6f 67 67 6c 65 20 67 72 grid":"Toggle gr
0003ef00: 69 64 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 id","action.togg
0003ef10: 6c 65 2d 6c 6f 63 6b 22 3a 22 54 6f 67 67 6c 65 le-lock":"Toggle
0003ef20: 20 6c 6f 63 6b 65 64 22 2c 22 61 63 74 69 6f 6e locked","action
0003ef30: 2e 66 6c 61 74 74 65 6e 2d 74 6f 2d 69 6d 61 67 .flatten-to-imag
0003ef40: 65 22 3a 22 46 6c 61 74 74 65 6e 22 2c 22 61 63 e":"Flatten","ac
0003ef50: 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d 73 6e 61 70 tion.toggle-snap
0003ef60: 2d 6d 6f 64 65 2e 6d 65 6e 75 22 3a 22 41 6c 77 -mode.menu":"Alw
0003ef70: 61 79 73 20 73 6e 61 70 22 2c 22 61 63 74 69 6f ays snap","actio
0003ef80: 6e 2e 74 6f 67 67 6c 65 2d 73 6e 61 70 2d 6d 6f n.toggle-snap-mo
0003ef90: 64 65 22 3a 22 54 6f 67 67 6c 65 20 61 6c 77 61 de":"Toggle alwa
0003efa0: 79 73 20 73 6e 61 70 22 2c 22 61 63 74 69 6f 6e ys snap","action
0003efb0: 2e 74 6f 67 67 6c 65 2d 74 6f 6f 6c 2d 6c 6f 63 .toggle-tool-loc
0003efc0: 6b 2e 6d 65 6e 75 22 3a 22 54 6f 6f 6c 20 6c 6f k.menu":"Tool lo
0003efd0: 63 6b 22 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 ck","action.togg
0003efe0: 6c 65 2d 74 6f 6f 6c 2d 6c 6f 63 6b 22 3a 22 54 le-tool-lock":"T
0003eff0: 6f 67 67 6c 65 20 74 6f 6f 6c 20 6c 6f 63 6b 22 oggle tool lock"
0003f000: 2c 22 61 63 74 69 6f 6e 2e 74 6f 67 67 6c 65 2d ,"action.toggle-
0003f010: 74 72 61 6e 73 70 61 72 65 6e 74 2e 63 6f 6e 74 transparent.cont
0003f020: 65 78 74 2d 6d 65 6e 75 22 3a 22 54 72 61 6e 73 ext-menu":"Trans
0003f030: 70 61 72 65 6e 74 22 2c 22 61 63 74 69 6f 6e 2e parent","action.
0003f040: 74 6f 67 67 6c 65 2d 74 72 61 6e 73 70 61 72 65 toggle-transpare
0003f050: 6e 74 2e 6d 65 6e 75 22 3a 22 54 72 61 6e 73 70 nt.menu":"Transp
0003f060: 61 72 65 6e 74 22 2c 22 61 63 74 69 6f 6e 2e 74 arent","action.t
0003f070: 6f 67 67 6c 65 2d 74 72 61 6e 73 70 61 72 65 6e oggle-transparen
0003f080: 74 22 3a 22 54 6f 67 67 6c 65 20 74 72 61 6e 73 t":"Toggle trans
0003f090: 70 61 72 65 6e 74 20 62 61 63 6b 67 72 6f 75 6e parent backgroun
0003f0a0: 64 22 2c 22 61 63 74 69 6f 6e 2e 75 6e 64 6f 22 d","action.undo"
0003f0b0: 3a 22 55 6e 64 6f 22 2c 22 61 63 74 69 6f 6e 2e :"Undo","action.
0003f0c0: 75 6e 67 72 6f 75 70 22 3a 22 55 6e 67 72 6f 75 ungroup":"Ungrou
0003f0d0: 70 22 2c 22 61 63 74 69 6f 6e 2e 7a 6f 6f 6d 2d p","action.zoom-
0003f0e0: 69 6e 22 3a 22 5a 6f 6f 6d 20 69 6e 22 2c 22 61 in":"Zoom in","a
0003f0f0: 63 74 69 6f 6e 2e 7a 6f 6f 6d 2d 6f 75 74 22 3a ction.zoom-out":
0003f100: 22 5a 6f 6f 6d 20 6f 75 74 22 2c 22 61 63 74 69 "Zoom out","acti
0003f110: 6f 6e 2e 7a 6f 6f 6d 2d 74 6f 2d 31 30 30 22 3a on.zoom-to-100":
0003f120: 22 5a 6f 6f 6d 20 74 6f 20 31 30 30 25 22 2c 22 "Zoom to 100%","
0003f130: 61 63 74 69 6f 6e 2e 7a 6f 6f 6d 2d 74 6f 2d 66 action.zoom-to-f
0003f140: 69 74 22 3a 22 5a 6f 6f 6d 20 74 6f 20 66 69 74 it":"Zoom to fit
0003f150: 22 2c 22 61 63 74 69 6f 6e 2e 7a 6f 6f 6d 2d 74 ","action.zoom-t
0003f160: 6f 2d 73 65 6c 65 63 74 69 6f 6e 22 3a 22 5a 6f o-selection":"Zo
0003f170: 6f 6d 20 74 6f 20 73 65 6c 65 63 74 69 6f 6e 22 om to selection"
0003f180: 2c 22 61 73 73 65 74 73 2e 66 69 6c 65 73 2e 75 ,"assets.files.u
0003f190: 70 6c 6f 61 64 2d 66 61 69 6c 65 64 22 3a 22 55 pload-failed":"U
0003f1a0: 70 6c 6f 61 64 20 66 61 69 6c 65 64 22 2c 22 61 pload failed","a
0003f1b0: 73 73 65 74 73 2e 75 72 6c 2e 66 61 69 6c 65 64 ssets.url.failed
0003f1c0: 22 3a 22 43 6f 75 6c 64 6e 27 74 20 6c 6f 61 64 ":"Couldn't load
0003f1d0: 20 55 52 4c 20 70 72 65 76 69 65 77 22 2c 22 74 URL preview","t
0003f1e0: 68 65 6d 65 2e 64 61 72 6b 22 3a 22 44 61 72 6b heme.dark":"Dark
0003f1f0: 22 2c 22 74 68 65 6d 65 2e 6c 69 67 68 74 22 3a ","theme.light":
0003f200: 22 4c 69 67 68 74 22 2c 22 74 68 65 6d 65 2e 73 "Light","theme.s
0003f210: 79 73 74 65 6d 22 3a 22 53 79 73 74 65 6d 22 2c ystem":"System",
0003f220: 22 63 6f 6c 6f 72 2d 73 74 79 6c 65 2e 77 68 69 "color-style.whi
0003f230: 74 65 22 3a 22 57 68 69 74 65 22 2c 22 63 6f 6c te":"White","col
0003f240: 6f 72 2d 73 74 79 6c 65 2e 62 6c 61 63 6b 22 3a or-style.black":
0003f250: 22 42 6c 61 63 6b 22 2c 22 63 6f 6c 6f 72 2d 73 "Black","color-s
0003f260: 74 79 6c 65 2e 62 6c 75 65 22 3a 22 42 6c 75 65 tyle.blue":"Blue
0003f270: 22 2c 22 63 6f 6c 6f 72 2d 73 74 79 6c 65 2e 67 ","color-style.g
0003f280: 72 65 65 6e 22 3a 22 47 72 65 65 6e 22 2c 22 63 reen":"Green","c
0003f290: 6f 6c 6f 72 2d 73 74 79 6c 65 2e 67 72 65 79 22 olor-style.grey"
0003f2a0: 3a 22 47 72 65 79 22 2c 22 63 6f 6c 6f 72 2d 73 :"Grey","color-s
0003f2b0: 74 79 6c 65 2e 6c 69 67 68 74 2d 62 6c 75 65 22 tyle.light-blue"
0003f2c0: 3a 22 4c 69 67 68 74 20 62 6c 75 65 22 2c 22 63 :"Light blue","c
0003f2d0: 6f 6c 6f 72 2d 73 74 79 6c 65 2e 6c 69 67 68 74 olor-style.light
0003f2e0: 2d 67 72 65 65 6e 22 3a 22 4c 69 67 68 74 20 67 -green":"Light g
0003f2f0: 72 65 65 6e 22 2c 22 63 6f 6c 6f 72 2d 73 74 79 reen","color-sty
0003f300: 6c 65 2e 6c 69 67 68 74 2d 72 65 64 22 3a 22 4c le.light-red":"L
0003f310: 69 67 68 74 20 72 65 64 22 2c 22 63 6f 6c 6f 72 ight red","color
0003f320: 2d 73 74 79 6c 65 2e 6c 69 67 68 74 2d 76 69 6f -style.light-vio
0003f330: 6c 65 74 22 3a 22 4c 69 67 68 74 20 76 69 6f 6c let":"Light viol
0003f340: 65 74 22 2c 22 63 6f 6c 6f 72 2d 73 74 79 6c 65 et","color-style
0003f350: 2e 6f 72 61 6e 67 65 22 3a 22 4f 72 61 6e 67 65 .orange":"Orange
0003f360: 22 2c 22 63 6f 6c 6f 72 2d 73 74 79 6c 65 2e 72 ","color-style.r
0003f370: 65 64 22 3a 22 52 65 64 22 2c 22 63 6f 6c 6f 72 ed":"Red","color
0003f380: 2d 73 74 79 6c 65 2e 76 69 6f 6c 65 74 22 3a 22 -style.violet":"
0003f390: 56 69 6f 6c 65 74 22 2c 22 63 6f 6c 6f 72 2d 73 Violet","color-s
0003f3a0: 74 79 6c 65 2e 79 65 6c 6c 6f 77 22 3a 22 59 65 tyle.yellow":"Ye
0003f3b0: 6c 6c 6f 77 22 2c 22 66 69 6c 6c 2d 73 74 79 6c llow","fill-styl
0003f3c0: 65 2e 6e 6f 6e 65 22 3a 22 4e 6f 6e 65 22 2c 22 e.none":"None","
0003f3d0: 64 6f 63 75 6d 65 6e 74 2e 64 65 66 61 75 6c 74 document.default
0003f3e0: 2d 6e 61 6d 65 22 3a 22 55 6e 74 69 74 6c 65 64 -name":"Untitled
0003f3f0: 22 2c 22 66 69 6c 6c 2d 73 74 79 6c 65 2e 73 65 ","fill-style.se
0003f400: 6d 69 22 3a 22 53 65 6d 69 22 2c 22 66 69 6c 6c mi":"Semi","fill
0003f410: 2d 73 74 79 6c 65 2e 73 6f 6c 69 64 22 3a 22 53 -style.solid":"S
0003f420: 6f 6c 69 64 22 2c 22 66 69 6c 6c 2d 73 74 79 6c olid","fill-styl
0003f430: 65 2e 70 61 74 74 65 72 6e 22 3a 22 50 61 74 74 e.pattern":"Patt
0003f440: 65 72 6e 22 2c 22 66 69 6c 6c 2d 73 74 79 6c 65 ern","fill-style
0003f450: 2e 66 69 6c 6c 22 3a 22 46 69 6c 6c 22 2c 22 64 .fill":"Fill","d
0003f460: 61 73 68 2d 73 74 79 6c 65 2e 64 61 73 68 65 64 ash-style.dashed
0003f470: 22 3a 22 44 61 73 68 65 64 22 2c 22 64 61 73 68 ":"Dashed","dash
0003f480: 2d 73 74 79 6c 65 2e 64 6f 74 74 65 64 22 3a 22 -style.dotted":"
0003f490: 44 6f 74 74 65 64 22 2c 22 64 61 73 68 2d 73 74 Dotted","dash-st
0003f4a0: 79 6c 65 2e 64 72 61 77 22 3a 22 44 72 61 77 22 yle.draw":"Draw"
0003f4b0: 2c 22 64 61 73 68 2d 73 74 79 6c 65 2e 73 6f 6c ,"dash-style.sol
0003f4c0: 69 64 22 3a 22 53 6f 6c 69 64 22 2c 22 73 69 7a id":"Solid","siz
0003f4d0: 65 2d 73 74 79 6c 65 2e 73 22 3a 22 53 6d 61 6c e-style.s":"Smal
0003f4e0: 6c 22 2c 22 73 69 7a 65 2d 73 74 79 6c 65 2e 6d l","size-style.m
0003f4f0: 22 3a 22 4d 65 64 69 75 6d 22 2c 22 73 69 7a 65 ":"Medium","size
0003f500: 2d 73 74 79 6c 65 2e 6c 22 3a 22 4c 61 72 67 65 -style.l":"Large
0003f510: 22 2c 22 73 69 7a 65 2d 73 74 79 6c 65 2e 78 6c ","size-style.xl
0003f520: 22 3a 22 45 78 74 72 61 20 6c 61 72 67 65 22 2c ":"Extra large",
0003f530: 22 6f 70 61 63 69 74 79 2d 73 74 79 6c 65 2e 30 "opacity-style.0
0003f540: 2e 31 22 3a 22 31 30 25 22 2c 22 6f 70 61 63 69 .1":"10%","opaci
0003f550: 74 79 2d 73 74 79 6c 65 2e 30 2e 32 35 22 3a 22 ty-style.0.25":"
0003f560: 32 35 25 22 2c 22 6f 70 61 63 69 74 79 2d 73 74 25%","opacity-st
0003f570: 79 6c 65 2e 30 2e 35 22 3a 22 35 30 25 22 2c 22 yle.0.5":"50%","
0003f580: 6f 70 61 63 69 74 79 2d 73 74 79 6c 65 2e 30 2e opacity-style.0.
0003f590: 37 35 22 3a 22 37 35 25 22 2c 22 6f 70 61 63 69 75":"75%","opaci
0003f5a0: 74 79 2d 73 74 79 6c 65 2e 31 22 3a 22 31 30 30 ty-style.1":"100
0003f5b0: 25 22 2c 22 66 6f 6e 74 2d 73 74 79 6c 65 2e 64 %","font-style.d
0003f5c0: 72 61 77 22 3a 22 44 72 61 77 22 2c 22 66 6f 6e raw":"Draw","fon
0003f5d0: 74 2d 73 74 79 6c 65 2e 73 61 6e 73 22 3a 22 53 t-style.sans":"S
0003f5e0: 61 6e 73 22 2c 22 66 6f 6e 74 2d 73 74 79 6c 65 ans","font-style
0003f5f0: 2e 73 65 72 69 66 22 3a 22 53 65 72 69 66 22 2c .serif":"Serif",
0003f600: 22 66 6f 6e 74 2d 73 74 79 6c 65 2e 6d 6f 6e 6f "font-style.mono
0003f610: 22 3a 22 4d 6f 6e 6f 22 2c 22 61 6c 69 67 6e 2d ":"Mono","align-
0003f620: 73 74 79 6c 65 2e 73 74 61 72 74 22 3a 22 53 74 style.start":"St
0003f630: 61 72 74 22 2c 22 61 6c 69 67 6e 2d 73 74 79 6c art","align-styl
0003f640: 65 2e 6d 69 64 64 6c 65 22 3a 22 4d 69 64 64 6c e.middle":"Middl
0003f650: 65 22 2c 22 61 6c 69 67 6e 2d 73 74 79 6c 65 2e e","align-style.
0003f660: 65 6e 64 22 3a 22 45 6e 64 22 2c 22 61 6c 69 67 end":"End","alig
0003f670: 6e 2d 73 74 79 6c 65 2e 6a 75 73 74 69 66 79 22 n-style.justify"
0003f680: 3a 22 4a 75 73 74 69 66 79 22 2c 22 76 65 72 74 :"Justify","vert
0003f690: 69 63 61 6c 41 6c 69 67 6e 2d 73 74 79 6c 65 2e icalAlign-style.
0003f6a0: 73 74 61 72 74 22 3a 22 54 6f 70 22 2c 22 76 65 start":"Top","ve
0003f6b0: 72 74 69 63 61 6c 41 6c 69 67 6e 2d 73 74 79 6c rticalAlign-styl
0003f6c0: 65 2e 6d 69 64 64 6c 65 22 3a 22 4d 69 64 64 6c e.middle":"Middl
0003f6d0: 65 22 2c 22 76 65 72 74 69 63 61 6c 41 6c 69 67 e","verticalAlig
0003f6e0: 6e 2d 73 74 79 6c 65 2e 65 6e 64 22 3a 22 42 6f n-style.end":"Bo
0003f6f0: 74 74 6f 6d 22 2c 22 67 65 6f 2d 73 74 79 6c 65 ttom","geo-style
0003f700: 2e 61 72 72 6f 77 2d 64 6f 77 6e 22 3a 22 41 72 .arrow-down":"Ar
0003f710: 72 6f 77 20 64 6f 77 6e 22 2c 22 67 65 6f 2d 73 row down","geo-s
0003f720: 74 79 6c 65 2e 61 72 72 6f 77 2d 6c 65 66 74 22 tyle.arrow-left"
0003f730: 3a 22 41 72 72 6f 77 20 6c 65 66 74 22 2c 22 67 :"Arrow left","g
0003f740: 65 6f 2d 73 74 79 6c 65 2e 61 72 72 6f 77 2d 72 eo-style.arrow-r
0003f750: 69 67 68 74 22 3a 22 41 72 72 6f 77 20 72 69 67 ight":"Arrow rig
0003f760: 68 74 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 61 ht","geo-style.a
0003f770: 72 72 6f 77 2d 75 70 22 3a 22 41 72 72 6f 77 20 rrow-up":"Arrow
0003f780: 75 70 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 64 up","geo-style.d
0003f790: 69 61 6d 6f 6e 64 22 3a 22 44 69 61 6d 6f 6e 64 iamond":"Diamond
0003f7a0: 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 65 6c 6c ","geo-style.ell
0003f7b0: 69 70 73 65 22 3a 22 45 6c 6c 69 70 73 65 22 2c ipse":"Ellipse",
0003f7c0: 22 67 65 6f 2d 73 74 79 6c 65 2e 68 65 78 61 67 "geo-style.hexag
0003f7d0: 6f 6e 22 3a 22 48 65 78 61 67 6f 6e 22 2c 22 67 on":"Hexagon","g
0003f7e0: 65 6f 2d 73 74 79 6c 65 2e 6f 63 74 61 67 6f 6e eo-style.octagon
0003f7f0: 22 3a 22 4f 63 74 61 67 6f 6e 22 2c 22 67 65 6f ":"Octagon","geo
0003f800: 2d 73 74 79 6c 65 2e 6f 76 61 6c 22 3a 22 4f 76 -style.oval":"Ov
0003f810: 61 6c 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 63 al","geo-style.c
0003f820: 6c 6f 75 64 22 3a 22 43 6c 6f 75 64 22 2c 22 67 loud":"Cloud","g
0003f830: 65 6f 2d 73 74 79 6c 65 2e 70 65 6e 74 61 67 6f eo-style.pentago
0003f840: 6e 22 3a 22 50 65 6e 74 61 67 6f 6e 22 2c 22 67 n":"Pentagon","g
0003f850: 65 6f 2d 73 74 79 6c 65 2e 72 65 63 74 61 6e 67 eo-style.rectang
0003f860: 6c 65 22 3a 22 52 65 63 74 61 6e 67 6c 65 22 2c le":"Rectangle",
0003f870: 22 67 65 6f 2d 73 74 79 6c 65 2e 72 68 6f 6d 62 "geo-style.rhomb
0003f880: 75 73 2d 32 22 3a 22 52 68 6f 6d 62 75 73 20 32 us-2":"Rhombus 2
0003f890: 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 72 68 6f ","geo-style.rho
0003f8a0: 6d 62 75 73 22 3a 22 52 68 6f 6d 62 75 73 22 2c mbus":"Rhombus",
0003f8b0: 22 67 65 6f 2d 73 74 79 6c 65 2e 73 74 61 72 22 "geo-style.star"
0003f8c0: 3a 22 53 74 61 72 22 2c 22 67 65 6f 2d 73 74 79 :"Star","geo-sty
0003f8d0: 6c 65 2e 74 72 61 70 65 7a 6f 69 64 22 3a 22 54 le.trapezoid":"T
0003f8e0: 72 61 70 65 7a 6f 69 64 22 2c 22 67 65 6f 2d 73 rapezoid","geo-s
0003f8f0: 74 79 6c 65 2e 74 72 69 61 6e 67 6c 65 22 3a 22 tyle.triangle":"
0003f900: 54 72 69 61 6e 67 6c 65 22 2c 22 67 65 6f 2d 73 Triangle","geo-s
0003f910: 74 79 6c 65 2e 78 2d 62 6f 78 22 3a 22 58 20 62 tyle.x-box":"X b
0003f920: 6f 78 22 2c 22 67 65 6f 2d 73 74 79 6c 65 2e 63 ox","geo-style.c
0003f930: 68 65 63 6b 2d 62 6f 78 22 3a 22 43 68 65 63 6b heck-box":"Check
0003f940: 20 62 6f 78 22 2c 22 61 72 72 6f 77 68 65 61 64 box","arrowhead
0003f950: 53 74 61 72 74 2d 73 74 79 6c 65 2e 6e 6f 6e 65 Start-style.none
0003f960: 22 3a 22 4e 6f 6e 65 22 2c 22 61 72 72 6f 77 68 ":"None","arrowh
0003f970: 65 61 64 53 74 61 72 74 2d 73 74 79 6c 65 2e 61 eadStart-style.a
0003f980: 72 72 6f 77 22 3a 22 41 72 72 6f 77 22 2c 22 61 rrow":"Arrow","a
0003f990: 72 72 6f 77 68 65 61 64 53 74 61 72 74 2d 73 74 rrowheadStart-st
0003f9a0: 79 6c 65 2e 62 61 72 22 3a 22 42 61 72 22 2c 22 yle.bar":"Bar","
0003f9b0: 61 72 72 6f 77 68 65 61 64 53 74 61 72 74 2d 73 arrowheadStart-s
0003f9c0: 74 79 6c 65 2e 64 69 61 6d 6f 6e 64 22 3a 22 44 tyle.diamond":"D
0003f9d0: 69 61 6d 6f 6e 64 22 2c 22 61 72 72 6f 77 68 65 iamond","arrowhe
0003f9e0: 61 64 53 74 61 72 74 2d 73 74 79 6c 65 2e 64 6f adStart-style.do
0003f9f0: 74 22 3a 22 44 6f 74 22 2c 22 61 72 72 6f 77 68 t":"Dot","arrowh
0003fa00: 65 61 64 53 74 61 72 74 2d 73 74 79 6c 65 2e 69 eadStart-style.i
0003fa10: 6e 76 65 72 74 65 64 22 3a 22 49 6e 76 65 72 74 nverted":"Invert
0003fa20: 65 64 22 2c 22 61 72 72 6f 77 68 65 61 64 53 74 ed","arrowheadSt
0003fa30: 61 72 74 2d 73 74 79 6c 65 2e 70 69 70 65 22 3a art-style.pipe":
0003fa40: 22 50 69 70 65 22 2c 22 61 72 72 6f 77 68 65 61 "Pipe","arrowhea
0003fa50: 64 53 74 61 72 74 2d 73 74 79 6c 65 2e 73 71 75 dStart-style.squ
0003fa60: 61 72 65 22 3a 22 53 71 75 61 72 65 22 2c 22 61 are":"Square","a
0003fa70: 72 72 6f 77 68 65 61 64 53 74 61 72 74 2d 73 74 rrowheadStart-st
0003fa80: 79 6c 65 2e 74 72 69 61 6e 67 6c 65 22 3a 22 54 yle.triangle":"T
0003fa90: 72 69 61 6e 67 6c 65 22 2c 22 61 72 72 6f 77 68 riangle","arrowh
0003faa0: 65 61 64 45 6e 64 2d 73 74 79 6c 65 2e 6e 6f 6e eadEnd-style.non
0003fab0: 65 22 3a 22 4e 6f 6e 65 22 2c 22 61 72 72 6f 77 e":"None","arrow
0003fac0: 68 65 61 64 45 6e 64 2d 73 74 79 6c 65 2e 61 72 headEnd-style.ar
0003fad0: 72 6f 77 22 3a 22 41 72 72 6f 77 22 2c 22 61 72 row":"Arrow","ar
0003fae0: 72 6f 77 68 65 61 64 45 6e 64 2d 73 74 79 6c 65 rowheadEnd-style
0003faf0: 2e 62 61 72 22 3a 22 42 61 72 22 2c 22 61 72 72 .bar":"Bar","arr
0003fb00: 6f 77 68 65 61 64 45 6e 64 2d 73 74 79 6c 65 2e owheadEnd-style.
0003fb10: 64 69 61 6d 6f 6e 64 22 3a 22 44 69 61 6d 6f 6e diamond":"Diamon
0003fb20: 64 22 2c 22 61 72 72 6f 77 68 65 61 64 45 6e 64 d","arrowheadEnd
0003fb30: 2d 73 74 79 6c 65 2e 64 6f 74 22 3a 22 44 6f 74 -style.dot":"Dot
0003fb40: 22 2c 22 61 72 72 6f 77 68 65 61 64 45 6e 64 2d ","arrowheadEnd-
0003fb50: 73 74 79 6c 65 2e 69 6e 76 65 72 74 65 64 22 3a style.inverted":
0003fb60: 22 49 6e 76 65 72 74 65 64 22 2c 22 61 72 72 6f "Inverted","arro
0003fb70: 77 68 65 61 64 45 6e 64 2d 73 74 79 6c 65 2e 70 wheadEnd-style.p
0003fb80: 69 70 65 22 3a 22 50 69 70 65 22 2c 22 61 72 72 ipe":"Pipe","arr
0003fb90: 6f 77 68 65 61 64 45 6e 64 2d 73 74 79 6c 65 2e owheadEnd-style.
0003fba0: 73 71 75 61 72 65 22 3a 22 53 71 75 61 72 65 22 square":"Square"
0003fbb0: 2c 22 61 72 72 6f 77 68 65 61 64 45 6e 64 2d 73 ,"arrowheadEnd-s
0003fbc0: 74 79 6c 65 2e 74 72 69 61 6e 67 6c 65 22 3a 22 tyle.triangle":"
0003fbd0: 54 72 69 61 6e 67 6c 65 22 2c 22 73 70 6c 69 6e Triangle","splin
0003fbe0: 65 2d 73 74 79 6c 65 2e 6c 69 6e 65 22 3a 22 4c e-style.line":"L
0003fbf0: 69 6e 65 22 2c 22 73 70 6c 69 6e 65 2d 73 74 79 ine","spline-sty
0003fc00: 6c 65 2e 63 75 62 69 63 22 3a 22 43 75 62 69 63 le.cubic":"Cubic
0003fc10: 22 2c 22 74 6f 6f 6c 2e 73 65 6c 65 63 74 22 3a ","tool.select":
0003fc20: 22 53 65 6c 65 63 74 22 2c 22 74 6f 6f 6c 2e 68 "Select","tool.h
0003fc30: 61 6e 64 22 3a 22 48 61 6e 64 22 2c 22 74 6f 6f and":"Hand","too
0003fc40: 6c 2e 64 72 61 77 22 3a 22 44 72 61 77 22 2c 22 l.draw":"Draw","
0003fc50: 74 6f 6f 6c 2e 65 72 61 73 65 72 22 3a 22 45 72 tool.eraser":"Er
0003fc60: 61 73 65 72 22 2c 22 74 6f 6f 6c 2e 61 72 72 6f aser","tool.arro
0003fc70: 77 2d 64 6f 77 6e 22 3a 22 41 72 72 6f 77 20 64 w-down":"Arrow d
0003fc80: 6f 77 6e 22 2c 22 74 6f 6f 6c 2e 61 72 72 6f 77 own","tool.arrow
0003fc90: 2d 6c 65 66 74 22 3a 22 41 72 72 6f 77 20 6c 65 -left":"Arrow le
0003fca0: 66 74 22 2c 22 74 6f 6f 6c 2e 61 72 72 6f 77 2d ft","tool.arrow-
0003fcb0: 72 69 67 68 74 22 3a 22 41 72 72 6f 77 20 72 69 right":"Arrow ri
0003fcc0: 67 68 74 22 2c 22 74 6f 6f 6c 2e 61 72 72 6f 77 ght","tool.arrow
0003fcd0: 2d 75 70 22 3a 22 41 72 72 6f 77 20 75 70 22 2c -up":"Arrow up",
0003fce0: 22 74 6f 6f 6c 2e 61 72 72 6f 77 22 3a 22 41 72 "tool.arrow":"Ar
0003fcf0: 72 6f 77 22 2c 22 74 6f 6f 6c 2e 63 6c 6f 75 64 row","tool.cloud
0003fd00: 22 3a 22 43 6c 6f 75 64 22 2c 22 74 6f 6f 6c 2e ":"Cloud","tool.
0003fd10: 64 69 61 6d 6f 6e 64 22 3a 22 44 69 61 6d 6f 6e diamond":"Diamon
0003fd20: 64 22 2c 22 74 6f 6f 6c 2e 65 6c 6c 69 70 73 65 d","tool.ellipse
0003fd30: 22 3a 22 45 6c 6c 69 70 73 65 22 2c 22 74 6f 6f ":"Ellipse","too
0003fd40: 6c 2e 68 65 78 61 67 6f 6e 22 3a 22 48 65 78 61 l.hexagon":"Hexa
0003fd50: 67 6f 6e 22 2c 22 74 6f 6f 6c 2e 68 69 67 68 6c gon","tool.highl
0003fd60: 69 67 68 74 22 3a 22 48 69 67 68 6c 69 67 68 74 ight":"Highlight
0003fd70: 22 2c 22 74 6f 6f 6c 2e 6c 69 6e 65 22 3a 22 4c ","tool.line":"L
0003fd80: 69 6e 65 22 2c 22 74 6f 6f 6c 2e 6f 63 74 61 67 ine","tool.octag
0003fd90: 6f 6e 22 3a 22 4f 63 74 61 67 6f 6e 22 2c 22 74 on":"Octagon","t
0003fda0: 6f 6f 6c 2e 6f 76 61 6c 22 3a 22 4f 76 61 6c 22 ool.oval":"Oval"
0003fdb0: 2c 22 74 6f 6f 6c 2e 70 65 6e 74 61 67 6f 6e 22 ,"tool.pentagon"
0003fdc0: 3a 22 50 65 6e 74 61 67 6f 6e 22 2c 22 74 6f 6f :"Pentagon","too
0003fdd0: 6c 2e 72 65 63 74 61 6e 67 6c 65 22 3a 22 52 65 l.rectangle":"Re
0003fde0: 63 74 61 6e 67 6c 65 22 2c 22 74 6f 6f 6c 2e 72 ctangle","tool.r
0003fdf0: 68 6f 6d 62 75 73 22 3a 22 52 68 6f 6d 62 75 73 hombus":"Rhombus
0003fe00: 22 2c 22 74 6f 6f 6c 2e 73 74 61 72 22 3a 22 53 ","tool.star":"S
0003fe10: 74 61 72 22 2c 22 74 6f 6f 6c 2e 74 72 61 70 65 tar","tool.trape
0003fe20: 7a 6f 69 64 22 3a 22 54 72 61 70 65 7a 6f 69 64 zoid":"Trapezoid
0003fe30: 22 2c 22 74 6f 6f 6c 2e 74 72 69 61 6e 67 6c 65 ","tool.triangle
0003fe40: 22 3a 22 54 72 69 61 6e 67 6c 65 22 2c 22 74 6f ":"Triangle","to
0003fe50: 6f 6c 2e 78 2d 62 6f 78 22 3a 22 58 20 62 6f 78 ol.x-box":"X box
0003fe60: 22 2c 22 74 6f 6f 6c 2e 63 68 65 63 6b 2d 62 6f ","tool.check-bo
0003fe70: 78 22 3a 22 43 68 65 63 6b 20 62 6f 78 22 2c 22 x":"Check box","
0003fe80: 74 6f 6f 6c 2e 61 73 73 65 74 22 3a 22 41 73 73 tool.asset":"Ass
0003fe90: 65 74 22 2c 22 74 6f 6f 6c 2e 66 72 61 6d 65 22 et","tool.frame"
0003fea0: 3a 22 46 72 61 6d 65 22 2c 22 74 6f 6f 6c 2e 6e :"Frame","tool.n
0003feb0: 6f 74 65 22 3a 22 4e 6f 74 65 22 2c 22 74 6f 6f ote":"Note","too
0003fec0: 6c 2e 6c 61 73 65 72 22 3a 22 4c 61 73 65 72 22 l.laser":"Laser"
0003fed0: 2c 22 74 6f 6f 6c 2e 65 6d 62 65 64 22 3a 22 45 ,"tool.embed":"E
0003fee0: 6d 62 65 64 22 2c 22 74 6f 6f 6c 2e 74 65 78 74 mbed","tool.text
0003fef0: 22 3a 22 54 65 78 74 22 2c 22 6d 65 6e 75 2e 74 ":"Text","menu.t
0003ff00: 69 74 6c 65 22 3a 22 4d 65 6e 75 22 2c 22 6d 65 itle":"Menu","me
0003ff10: 6e 75 2e 74 68 65 6d 65 22 3a 22 54 68 65 6d 65 nu.theme":"Theme
0003ff20: 22 2c 22 6d 65 6e 75 2e 63 6f 70 79 2d 61 73 22 ","menu.copy-as"
0003ff30: 3a 22 43 6f 70 79 20 61 73 22 2c 22 6d 65 6e 75 :"Copy as","menu
0003ff40: 2e 65 64 69 74 22 3a 22 45 64 69 74 22 2c 22 6d .edit":"Edit","m
0003ff50: 65 6e 75 2e 65 78 70 6f 72 74 2d 61 73 22 3a 22 enu.export-as":"
0003ff60: 45 78 70 6f 72 74 20 61 73 22 2c 22 6d 65 6e 75 Export as","menu
0003ff70: 2e 66 69 6c 65 22 3a 22 46 69 6c 65 22 2c 22 6d .file":"File","m
0003ff80: 65 6e 75 2e 6c 61 6e 67 75 61 67 65 22 3a 22 4c enu.language":"L
0003ff90: 61 6e 67 75 61 67 65 22 2c 22 6d 65 6e 75 2e 70 anguage","menu.p
0003ffa0: 72 65 66 65 72 65 6e 63 65 73 22 3a 22 50 72 65 references":"Pre
0003ffb0: 66 65 72 65 6e 63 65 73 22 2c 22 6d 65 6e 75 2e ferences","menu.
0003ffc0: 76 69 65 77 22 3a 22 56 69 65 77 22 2c 22 63 6f view":"View","co
0003ffd0: 6e 74 65 78 74 2d 6d 65 6e 75 2e 65 64 69 74 22 ntext-menu.edit"
0003ffe0: 3a 22 45 64 69 74 22 2c 22 63 6f 6e 74 65 78 74 :"Edit","context
0003fff0: 2d 6d 65 6e 75 2e 61 72 72 61 6e 67 65 22 3a 22 -menu.arrange":"