@kaeawc/auto-mobile 0.0.92 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +12 -12
- package/dist/schemas/test-plan.schema.json +370 -52
- package/dist/src/{chunk-jhnbfj19.js → chunk-00167wan.js} +5 -5
- package/dist/src/chunk-0jrrsnc9.js +6 -0
- package/dist/src/chunk-0n6swkwg.js +5 -0
- package/dist/src/chunk-0qsy1qsx.js +57 -0
- package/dist/src/chunk-11m8wj8j.js +237 -0
- package/dist/src/{chunk-4pfftt07.js → chunk-1p7xf5kb.js} +3 -3
- package/dist/src/chunk-23p5f095.js +4 -0
- package/dist/src/{chunk-a4k9rt7z.js → chunk-26k317v5.js} +3 -3
- package/dist/src/chunk-284ptqa4.js +7 -0
- package/dist/src/chunk-28re4xrg.js +4 -0
- package/dist/src/chunk-2f9rkmhx.js +5 -0
- package/dist/src/chunk-2fxdh48t.js +4 -0
- package/dist/src/chunk-2tbdrbt6.js +4 -0
- package/dist/src/chunk-2tqzq5qh.js +971 -0
- package/dist/src/chunk-32gvv9b4.js +21 -0
- package/dist/src/chunk-3f3t1x97.js +8 -0
- package/dist/src/chunk-3fspkbc7.js +4 -0
- package/dist/src/chunk-3qwrzxh0.js +11 -0
- package/dist/src/chunk-3sy6ahhz.js +26 -0
- package/dist/src/chunk-3vg455e6.js +4 -0
- package/dist/src/chunk-3xkpk44w.js +5 -0
- package/dist/src/chunk-3y6eykz9.js +4 -0
- package/dist/src/chunk-49bsqdx3.js +4 -0
- package/dist/src/chunk-4hw3665t.js +42 -0
- package/dist/src/chunk-58wzr3mt.js +5 -0
- package/dist/src/chunk-5d2hft6c.js +5 -0
- package/dist/src/chunk-5snsn9cf.js +4 -0
- package/dist/src/chunk-5tm9mn47.js +54 -0
- package/dist/src/chunk-5zc77a5t.js +4 -0
- package/dist/src/chunk-64j0majr.js +19 -0
- package/dist/src/chunk-65y8v4td.js +17 -0
- package/dist/src/chunk-6awz7vhq.js +5 -0
- package/dist/src/{chunk-stfzjr9y.js → chunk-6bznss4t.js} +5 -5
- package/dist/src/chunk-6ep7f5ge.js +4 -0
- package/dist/src/{chunk-0dfnyfkh.js → chunk-6wt9rgjf.js} +3 -3
- package/dist/src/chunk-6xmss8er.js +8 -0
- package/dist/src/chunk-710rxz9y.js +5 -0
- package/dist/src/chunk-7cs2da62.js +5 -0
- package/dist/src/chunk-7g103b54.js +4 -0
- package/dist/src/chunk-7j5vj4pa.js +4 -0
- package/dist/src/chunk-7rz9898k.js +5 -0
- package/dist/src/chunk-7tw8x05v.js +4 -0
- package/dist/src/chunk-7zy586cb.js +4 -0
- package/dist/src/{chunk-r0f1q783.js → chunk-8037tzzj.js} +3 -3
- package/dist/src/chunk-84nanf8s.js +5 -0
- package/dist/src/{chunk-950qcq1e.js → chunk-8g1922rp.js} +4 -4
- package/dist/src/chunk-8gvwcv2p.js +4 -0
- package/dist/src/{chunk-sz1a7p43.js → chunk-8ph29g99.js} +1 -1
- package/dist/src/chunk-8thrmfat.js +4 -0
- package/dist/src/chunk-8zgzzs7k.js +78 -0
- package/dist/src/chunk-97b1zmaq.js +4 -0
- package/dist/src/chunk-9fth9ayh.js +4 -0
- package/dist/src/chunk-9j6anhjr.js +4 -0
- package/dist/src/{chunk-w7zsh13a.js → chunk-aabchzxk.js} +4 -4
- package/dist/src/{chunk-wry6skrm.js → chunk-ayp07wbb.js} +1 -1
- package/dist/src/chunk-bfjwqk8q.js +4 -0
- package/dist/src/{chunk-jdqvcq0a.js → chunk-bfw6125s.js} +3 -3
- package/dist/src/chunk-bnhscm2n.js +4 -0
- package/dist/src/chunk-bxmsax22.js +5 -0
- package/dist/src/chunk-c1vs4g1n.js +4 -0
- package/dist/src/chunk-ct3e7yng.js +4 -0
- package/dist/src/{chunk-8en08r7q.js → chunk-cyy71ggq.js} +3 -3
- package/dist/src/chunk-ddzkz92z.js +4 -0
- package/dist/src/chunk-dgrbdpb7.js +9 -0
- package/dist/src/chunk-drdz8hee.js +5 -0
- package/dist/src/chunk-e98dqnc9.js +145 -0
- package/dist/src/chunk-eersndy7.js +5 -0
- package/dist/src/chunk-eggq53ks.js +4 -0
- package/dist/src/chunk-f2dya7cs.js +4 -0
- package/dist/src/chunk-fbakd6cw.js +4 -0
- package/dist/src/chunk-fgb98zjj.js +5 -0
- package/dist/src/chunk-fmpad823.js +5 -0
- package/dist/src/{chunk-v90es00d.js → chunk-g04bwyj3.js} +2 -2
- package/dist/src/chunk-g0xr8zw0.js +4 -0
- package/dist/src/chunk-g3rjs80x.js +4 -0
- package/dist/src/chunk-g78rtrfv.js +4 -0
- package/dist/src/{chunk-r20pe1nv.js → chunk-g7tmjbkt.js} +3 -3
- package/dist/src/chunk-gabgv3y5.js +4 -0
- package/dist/src/chunk-gmr45m8f.js +4 -0
- package/dist/src/chunk-gsyfebqj.js +4 -0
- package/dist/src/chunk-h5rpn9wr.js +247 -0
- package/dist/src/chunk-hb1x7v55.js +4 -0
- package/dist/src/chunk-hrfytkxh.js +168 -0
- package/dist/src/chunk-j4yjzbak.js +4 -0
- package/dist/src/chunk-jd6a5v6p.js +5 -0
- package/dist/src/chunk-jh6vhqzx.js +5 -0
- package/dist/src/chunk-kn5spq15.js +4 -0
- package/dist/src/{chunk-w2mwa0jk.js → chunk-m94qs0f0.js} +2 -2
- package/dist/src/chunk-mjrps0ac.js +7 -0
- package/dist/src/chunk-n03dmn5q.js +5 -0
- package/dist/src/chunk-n72qhwd9.js +4 -0
- package/dist/src/{chunk-km0dy5vc.js → chunk-ndt1ccxm.js} +9 -9
- package/dist/src/chunk-nr6y0n4y.js +5 -0
- package/dist/src/chunk-pcsen2vs.js +4 -0
- package/dist/src/chunk-ppfr0b8h.js +4 -0
- package/dist/src/chunk-q10bdnat.js +4 -0
- package/dist/src/chunk-q9xmq595.js +4 -0
- package/dist/src/{chunk-2v7tw1nj.js → chunk-qcxzr2my.js} +3 -3
- package/dist/src/chunk-qf6nynk6.js +7 -0
- package/dist/src/chunk-qyqypn28.js +5 -0
- package/dist/src/chunk-r2epb56s.js +4 -0
- package/dist/src/chunk-r5bxavdx.js +311 -0
- package/dist/src/{chunk-r14wwk37.js → chunk-r6z1eztj.js} +12 -12
- package/dist/src/{chunk-d57432wq.js → chunk-r7bpkgff.js} +2 -2
- package/dist/src/chunk-r8jf3d92.js +4 -0
- package/dist/src/{chunk-9rkfyt6q.js → chunk-rbpdk7m0.js} +3 -3
- package/dist/src/chunk-rc0dbypm.js +4 -0
- package/dist/src/chunk-rhcty4ms.js +4 -0
- package/dist/src/chunk-rpvckv3p.js +4 -0
- package/dist/src/{chunk-s1zq65ny.js → chunk-rqc9ap3x.js} +2 -2
- package/dist/src/chunk-rvvy1bte.js +7 -0
- package/dist/src/chunk-ry0mz41y.js +4 -0
- package/dist/src/{chunk-34zxqcmq.js → chunk-s3jc6cwp.js} +3 -3
- package/dist/src/chunk-sfv61xjb.js +6 -0
- package/dist/src/chunk-t6bfvfkg.js +4 -0
- package/dist/src/chunk-t6c8akcm.js +5 -0
- package/dist/src/chunk-t7w8rctc.js +4 -0
- package/dist/src/chunk-thbh3jew.js +5 -0
- package/dist/src/chunk-v2wd4n3e.js +5 -0
- package/dist/src/{chunk-zg67wjkh.js → chunk-v6pya0dm.js} +3 -3
- package/dist/src/chunk-vy3bwm1d.js +17 -0
- package/dist/src/chunk-w3vs79ex.js +27 -0
- package/dist/src/chunk-w4zga19f.js +4 -0
- package/dist/src/chunk-w5b2jwk3.js +14 -0
- package/dist/src/chunk-w7hkv422.js +5 -0
- package/dist/src/{chunk-qv2918jt.js → chunk-waqwcjyn.js} +2 -2
- package/dist/src/{chunk-b4cxdzwy.js → chunk-wbh8spm5.js} +7 -7
- package/dist/src/{chunk-ajsrz473.js → chunk-wyrkw6hw.js} +3 -3
- package/dist/src/chunk-xa73x2cx.js +5 -0
- package/dist/src/{chunk-eka89q3k.js → chunk-xgan0qqp.js} +1 -1
- package/dist/src/chunk-y2vs6jwg.js +4 -0
- package/dist/src/chunk-yattm52s.js +4 -0
- package/dist/src/{chunk-9y5bcy28.js → chunk-yb97j25b.js} +4 -4
- package/dist/src/{chunk-c9nk1r78.js → chunk-ybbtagbt.js} +3 -3
- package/dist/src/chunk-ycaj2sgf.js +9 -0
- package/dist/src/chunk-yf7ympyz.js +325 -0
- package/dist/src/chunk-yjawdzk8.js +4 -0
- package/dist/src/chunk-z637nqg8.js +11 -0
- package/dist/src/{chunk-0w1spptt.js → chunk-zgja5f3p.js} +4 -4
- package/dist/src/chunk-zs1sghs9.js +4 -0
- package/dist/src/daemon/processEntry.js +2 -2
- package/dist/src/index.js +4 -4
- package/dist/src/runtime/bunRuntimeGuard.js +2 -2
- package/dist/src/utils/workers/iosBundleExtractWorker.js +2 -2
- package/ios/CameraPosterInjection/Injection/CameraPosterInjection.m +466 -0
- package/package.json +3 -2
- package/schemas/test-plan.schema.json +370 -52
- package/dist/src/chunk-09442h7v.js +0 -4
- package/dist/src/chunk-0e4gm1kj.js +0 -5
- package/dist/src/chunk-0eb8576f.js +0 -4
- package/dist/src/chunk-0rjm4nx7.js +0 -5
- package/dist/src/chunk-1zmh2eak.js +0 -4
- package/dist/src/chunk-28k63ha3.js +0 -5
- package/dist/src/chunk-2d4wmp8b.js +0 -4
- package/dist/src/chunk-2e6s75qv.js +0 -78
- package/dist/src/chunk-32jpxz2y.js +0 -323
- package/dist/src/chunk-3jmvqygr.js +0 -238
- package/dist/src/chunk-3swvfhqt.js +0 -5
- package/dist/src/chunk-44bt78m9.js +0 -5
- package/dist/src/chunk-488vt2bp.js +0 -4
- package/dist/src/chunk-4fgdhcwx.js +0 -5
- package/dist/src/chunk-4jp2se4w.js +0 -4
- package/dist/src/chunk-4vhr9e4t.js +0 -4
- package/dist/src/chunk-4xd6zs3y.js +0 -15
- package/dist/src/chunk-51567pg8.js +0 -4
- package/dist/src/chunk-5agqsfev.js +0 -4
- package/dist/src/chunk-5d706gmr.js +0 -4
- package/dist/src/chunk-5kd4rqk7.js +0 -5
- package/dist/src/chunk-61t538bm.js +0 -4
- package/dist/src/chunk-6d3mmqxt.js +0 -54
- package/dist/src/chunk-6hyt398x.js +0 -5
- package/dist/src/chunk-6mnr8kpm.js +0 -4
- package/dist/src/chunk-79q5xsdc.js +0 -42
- package/dist/src/chunk-7bdgand3.js +0 -4
- package/dist/src/chunk-84cp9dw5.js +0 -4
- package/dist/src/chunk-86f2h5ww.js +0 -5
- package/dist/src/chunk-8cghfzb2.js +0 -19
- package/dist/src/chunk-9tf2p9y9.js +0 -5
- package/dist/src/chunk-a2sc4jm0.js +0 -5
- package/dist/src/chunk-aa5ng3d1.js +0 -4
- package/dist/src/chunk-b3h0a6ca.js +0 -4
- package/dist/src/chunk-b6a737qt.js +0 -4
- package/dist/src/chunk-bn64x5z5.js +0 -5
- package/dist/src/chunk-bvh649za.js +0 -12
- package/dist/src/chunk-c9tyfg4j.js +0 -26
- package/dist/src/chunk-cfsdfqnm.js +0 -4
- package/dist/src/chunk-cxyf04jc.js +0 -7
- package/dist/src/chunk-da08tx5v.js +0 -4
- package/dist/src/chunk-f2tc08m2.js +0 -4
- package/dist/src/chunk-f8tnk179.js +0 -5
- package/dist/src/chunk-f9s1kkhx.js +0 -5
- package/dist/src/chunk-fbp8a4rx.js +0 -4
- package/dist/src/chunk-fd2z0sze.js +0 -4
- package/dist/src/chunk-fk927f4q.js +0 -54
- package/dist/src/chunk-fxmr3a0f.js +0 -4
- package/dist/src/chunk-gaqwhd44.js +0 -4
- package/dist/src/chunk-ggtd5x5a.js +0 -5
- package/dist/src/chunk-gndcfrm7.js +0 -4
- package/dist/src/chunk-h3n4adc6.js +0 -310
- package/dist/src/chunk-h5pjbb83.js +0 -4
- package/dist/src/chunk-hgnnh302.js +0 -4
- package/dist/src/chunk-hmke8nhx.js +0 -5
- package/dist/src/chunk-j2bx12hn.js +0 -4
- package/dist/src/chunk-j70y1a2g.js +0 -4
- package/dist/src/chunk-js1jpyxp.js +0 -6
- package/dist/src/chunk-kbjq0qvb.js +0 -4
- package/dist/src/chunk-kfwx57xd.js +0 -4
- package/dist/src/chunk-kzwctna2.js +0 -4
- package/dist/src/chunk-m9ehyehy.js +0 -4
- package/dist/src/chunk-mct91p1f.js +0 -4
- package/dist/src/chunk-mf9spd4g.js +0 -5
- package/dist/src/chunk-mgrcansb.js +0 -4
- package/dist/src/chunk-mqc1d0eb.js +0 -6
- package/dist/src/chunk-n1zmpk0z.js +0 -4
- package/dist/src/chunk-ncyjf63g.js +0 -4
- package/dist/src/chunk-nr64d21q.js +0 -973
- package/dist/src/chunk-nwm2pq5v.js +0 -168
- package/dist/src/chunk-pm06b05d.js +0 -9
- package/dist/src/chunk-q50s00ry.js +0 -4
- package/dist/src/chunk-qwye1958.js +0 -14
- package/dist/src/chunk-r8z9pfve.js +0 -5
- package/dist/src/chunk-rdpgkjf6.js +0 -4
- package/dist/src/chunk-rkr0dks9.js +0 -5
- package/dist/src/chunk-rn84t3sf.js +0 -11
- package/dist/src/chunk-s123kn7n.js +0 -4
- package/dist/src/chunk-s73qn3fx.js +0 -4
- package/dist/src/chunk-sjn0nj4p.js +0 -5
- package/dist/src/chunk-sns0c35v.js +0 -7
- package/dist/src/chunk-t4dr5c8v.js +0 -8
- package/dist/src/chunk-tc8k9c1j.js +0 -4
- package/dist/src/chunk-teznhase.js +0 -4
- package/dist/src/chunk-ty9xgmz4.js +0 -4
- package/dist/src/chunk-tyazf3sk.js +0 -145
- package/dist/src/chunk-v6npjrjm.js +0 -5
- package/dist/src/chunk-vbvtzkwz.js +0 -5
- package/dist/src/chunk-vefd8qee.js +0 -8
- package/dist/src/chunk-vs9r72ta.js +0 -17
- package/dist/src/chunk-w88k0bgr.js +0 -4
- package/dist/src/chunk-wzdt0enk.js +0 -4
- package/dist/src/chunk-xhhv854c.js +0 -4
- package/dist/src/chunk-y58270hd.js +0 -4
- package/dist/src/chunk-yk0hmbex.js +0 -4
- package/dist/src/chunk-ympy4fdz.js +0 -28
- package/dist/src/chunk-yw436axy.js +0 -4
- package/dist/src/chunk-z04jrpjy.js +0 -5
- package/dist/src/chunk-z2xznczw.js +0 -4
- package/dist/src/chunk-z4xnrgps.js +0 -4
- package/dist/src/chunk-z7csyszv.js +0 -4
- package/dist/src/chunk-z8t0v07j.js +0 -11
- package/dist/src/chunk-z916af47.js +0 -228
- package/dist/src/chunk-zcr8he8q.js +0 -5
- package/dist/src/chunk-zd9vmkzn.js +0 -9
- package/dist/src/chunk-zj939v0h.js +0 -5
- package/dist/src/chunk-zkdjwtc1.js +0 -4
- package/dist/src/chunk-zkv5kzt6.js +0 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Vu,CP,yG}from"./chunk-11m8wj8j.js";import{GF}from"./chunk-vy3bwm1d.js";import{Nt}from"./chunk-qcxzr2my.js";import st from"path";var K=1024,at=/^[0-9a-f]{64}$/;function J(u){if(!URL.canParse(u))return"url must be an absolute https URL";let c=new URL(u);if(c.protocol!=="https:")return"url must use https; ProtoViewer refuses any other scheme";if(c.username!==""||c.password!=="")return"url must not carry credentials; anyone who scans the QR would receive them";if(c.hash!=="")return"url must not have a #fragment; it is never sent to the host";return}function W(u,c){if(!at.test(c))throw Error("sha256 must be 64 lowercase hex characters");return`automobile-proto://import?url=${encodeURIComponent(u)}&sha256=${c}`}var V=function(u,c){let i=u,a=U[c],e=null,t=0,s=null,y=[],b={},p=function(o,h){if(t=i*4+17,e=function(n){let l=Array(n);for(let f=0;f<n;f+=1){l[f]=Array(n);for(let w=0;w<n;w+=1)l[f][w]=null}return l}(t),d(0,0),d(t-7,0),d(0,t-7),T(),R(),L(o,h),i>=7)C(o);if(s==null)s=ft(i,a,y);D(s,h)},d=function(o,h){for(let n=-1;n<=7;n+=1){if(o+n<=-1||t<=o+n)continue;for(let l=-1;l<=7;l+=1){if(h+l<=-1||t<=h+l)continue;if(0<=n&&n<=6&&(l==0||l==6)||0<=l&&l<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=l&&l<=4)e[o+n][h+l]=!0;else e[o+n][h+l]=!1}}},P=function(){let o=0,h=0;for(let n=0;n<8;n+=1){p(!0,n);let l=N.getLostPoint(b);if(n==0||o>l)o=l,h=n}return h},R=function(){for(let o=8;o<t-8;o+=1){if(e[o][6]!=null)continue;e[o][6]=o%2==0}for(let o=8;o<t-8;o+=1){if(e[6][o]!=null)continue;e[6][o]=o%2==0}},T=function(){let o=N.getPatternPosition(i);for(let h=0;h<o.length;h+=1)for(let n=0;n<o.length;n+=1){let l=o[h],f=o[n];if(e[l][f]!=null)continue;for(let w=-2;w<=2;w+=1)for(let x=-2;x<=2;x+=1)if(w==-2||w==2||x==-2||x==2||w==0&&x==0)e[l+w][f+x]=!0;else e[l+w][f+x]=!1}},C=function(o){let h=N.getBCHTypeNumber(i);for(let n=0;n<18;n+=1){let l=!o&&(h>>n&1)==1;e[Math.floor(n/3)][n%3+t-8-3]=l}for(let n=0;n<18;n+=1){let l=!o&&(h>>n&1)==1;e[n%3+t-8-3][Math.floor(n/3)]=l}},L=function(o,h){let n=a<<3|h,l=N.getBCHTypeInfo(n);for(let f=0;f<15;f+=1){let w=!o&&(l>>f&1)==1;if(f<6)e[f][8]=w;else if(f<8)e[f+1][8]=w;else e[t-15+f][8]=w}for(let f=0;f<15;f+=1){let w=!o&&(l>>f&1)==1;if(f<8)e[8][t-f-1]=w;else if(f<9)e[8][15-f-1+1]=w;else e[8][15-f-1]=w}e[t-8][8]=!o},D=function(o,h){let n=-1,l=t-1,f=7,w=0,x=N.getMaskFunction(h);for(let A=t-1;A>0;A-=2){if(A==6)A-=1;while(!0){for(let m=0;m<2;m+=1)if(e[l][A-m]==null){let M=!1;if(w<o.length)M=(o[w]>>>f&1)==1;if(x(l,A-m))M=!M;if(e[l][A-m]=M,f-=1,f==-1)w+=1,f=7}if(l+=n,l<0||t<=l){l-=n,n=-n;break}}}},ut=function(o,h){let n=0,l=0,f=0,w=Array(h.length),x=Array(h.length);for(let _=0;_<h.length;_+=1){let B=h[_].dataCount,E=h[_].totalCount-B;l=Math.max(l,B),f=Math.max(f,E),w[_]=Array(B);for(let I=0;I<w[_].length;I+=1)w[_][I]=255&o.getBuffer()[I+n];n+=B;let G=N.getErrorCorrectPolynomial(E),X=Q(w[_],G.getLength()-1).mod(G);x[_]=Array(G.getLength()-1);for(let I=0;I<x[_].length;I+=1){let q=I+X.getLength()-x[_].length;x[_][I]=q>=0?X.getAt(q):0}}let A=0;for(let _=0;_<h.length;_+=1)A+=h[_].totalCount;let m=Array(A),M=0;for(let _=0;_<l;_+=1)for(let B=0;B<h.length;B+=1)if(_<w[B].length)m[M]=w[B][_],M+=1;for(let _=0;_<f;_+=1)for(let B=0;B<h.length;B+=1)if(_<x[B].length)m[M]=x[B][_],M+=1;return m},ft=function(o,h,n){let l=Z.getRSBlocks(o,h),f=z();for(let x=0;x<n.length;x+=1){let A=n[x];f.put(A.getMode(),4),f.put(A.getLength(),N.getLengthInBits(A.getMode(),o)),A.write(f)}let w=0;for(let x=0;x<l.length;x+=1)w+=l[x].dataCount;if(f.getLengthInBits()>w*8)throw"code length overflow. ("+f.getLengthInBits()+">"+w*8+")";if(f.getLengthInBits()+4<=w*8)f.put(0,4);while(f.getLengthInBits()%8!=0)f.putBit(!1);while(!0){if(f.getLengthInBits()>=w*8)break;if(f.put(236,8),f.getLengthInBits()>=w*8)break;f.put(17,8)}return ut(f,l)};b.addData=function(o,h){h=h||"Byte";let n=null;switch(h){case"Numeric":n=lt(o);break;case"Alphanumeric":n=ht(o);break;case"Byte":n=gt(o);break;case"Kanji":n=dt(o);break;default:throw"mode:"+h}y.push(n),s=null},b.isDark=function(o,h){if(o<0||t<=o||h<0||t<=h)throw o+","+h;return e[o][h]},b.getModuleCount=function(){return t},b.make=function(){if(i<1){let o=1;for(;o<40;o++){let h=Z.getRSBlocks(o,a),n=z();for(let f=0;f<y.length;f++){let w=y[f];n.put(w.getMode(),4),n.put(w.getLength(),N.getLengthInBits(w.getMode(),o)),w.write(n)}let l=0;for(let f=0;f<h.length;f++)l+=h[f].dataCount;if(n.getLengthInBits()<=l*8)break}i=o}p(!1,P())},b.createTableTag=function(o,h){o=o||2,h=typeof h>"u"?o*4:h;let n="";n+='<table style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: "+h+"px;",n+='">',n+="<tbody>";for(let l=0;l<b.getModuleCount();l+=1){n+="<tr>";for(let f=0;f<b.getModuleCount();f+=1)n+='<td style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: 0px;",n+=" width: "+o+"px;",n+=" height: "+o+"px;",n+=" background-color: ",n+=b.isDark(l,f)?"#000000":"#ffffff",n+=";",n+='"/>';n+="</tr>"}return n+="</tbody>",n+="</table>",n},b.createSvgTag=function(o,h,n,l){let f={};if(typeof arguments[0]=="object")f=arguments[0],o=f.cellSize,h=f.margin,n=f.alt,l=f.title;o=o||2,h=typeof h>"u"?o*4:h,n=typeof n==="string"?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,l=typeof l==="string"?{text:l}:l||{},l.text=l.text||null,l.id=l.text?l.id||"qrcode-title":null;let w=b.getModuleCount()*o+h*2,x,A,m,M,_="",B;B="l"+o+",0 0,"+o+" -"+o+",0 0,-"+o+"z ",_+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',_+=!f.scalable?' width="'+w+'px" height="'+w+'px"':"",_+=' viewBox="0 0 '+w+" "+w+'" ',_+=' preserveAspectRatio="xMinYMin meet"',_+=l.text||n.text?' role="img" aria-labelledby="'+v([l.id,n.id].join(" ").trim())+'"':"",_+=">",_+=l.text?'<title id="'+v(l.id)+'">'+v(l.text)+"</title>":"",_+=n.text?'<description id="'+v(n.id)+'">'+v(n.text)+"</description>":"",_+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',_+='<path d="';for(m=0;m<b.getModuleCount();m+=1){M=m*o+h;for(x=0;x<b.getModuleCount();x+=1)if(b.isDark(m,x))A=x*o+h,_+="M"+A+","+M+B}return _+='" stroke="transparent" fill="black"/>',_+="</svg>",_},b.createDataURL=function(o,h){o=o||2,h=typeof h>"u"?o*4:h;let n=b.getModuleCount()*o+h*2,l=h,f=n-h;return bt(n,n,function(w,x){if(l<=w&&w<f&&l<=x&&x<f){let A=Math.floor((w-l)/o),m=Math.floor((x-l)/o);return b.isDark(m,A)?0:1}else return 1})},b.createImgTag=function(o,h,n){o=o||2,h=typeof h>"u"?o*4:h;let l=b.getModuleCount()*o+h*2,f="";if(f+="<img",f+=' src="',f+=b.createDataURL(o,h),f+='"',f+=' width="',f+=l,f+='"',f+=' height="',f+=l,f+='"',n)f+=' alt="',f+=v(n),f+='"';return f+="/>",f};let v=function(o){let h="";for(let n=0;n<o.length;n+=1){let l=o.charAt(n);switch(l){case"<":h+="<";break;case">":h+=">";break;case"&":h+="&";break;case'"':h+=""";break;default:h+=l;break}}return h},ct=function(o){o=typeof o>"u"?2:o;let n=b.getModuleCount()*1+o*2,l=o,f=n-o,w,x,A,m,M,_={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},B={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},E="";for(w=0;w<n;w+=2){A=Math.floor((w-l)/1),m=Math.floor((w+1-l)/1);for(x=0;x<n;x+=1){if(M="\u2588",l<=x&&x<f&&l<=w&&w<f&&b.isDark(A,Math.floor((x-l)/1)))M=" ";if(l<=x&&x<f&&l<=w+1&&w+1<f&&b.isDark(m,Math.floor((x-l)/1)))M+=" ";else M+="\u2588";E+=o<1&&w+1>=f?B[M]:_[M]}E+=`
|
|
3
3
|
`}if(n%2&&o>0)return E.substring(0,E.length-n-1)+Array(n+1).join("\u2580");return E.substring(0,E.length-1)};return b.createASCII=function(o,h){if(o=o||1,o<2)return ct(h);o-=1,h=typeof h>"u"?o*2:h;let n=b.getModuleCount()*o+h*2,l=h,f=n-h,w,x,A,m,M=Array(o+1).join("\u2588\u2588"),_=Array(o+1).join(" "),B="",E="";for(w=0;w<n;w+=1){A=Math.floor((w-l)/o),E="";for(x=0;x<n;x+=1){if(m=1,l<=x&&x<f&&l<=w&&w<f&&b.isDark(A,Math.floor((x-l)/o)))m=0;E+=m?M:_}for(A=0;A<o;A+=1)B+=E+`
|
|
4
|
-
`}return B.substring(0,B.length-1)},b.renderTo2dContext=function(o,h){h=h||2;let n=b.getModuleCount();for(let l=0;l<n;l++)for(let f=0;f<n;f++)o.fillStyle=b.isDark(l,f)?"black":"white",o.fillRect(f*h,l*h,h,h)},b};V.stringToBytes=function(u){let c=[];for(let g=0;g<u.length;g+=1){let r=u.charCodeAt(g);c.push(r&255)}return c};V.createStringToBytes=function(u,c){let g=function(){let i=wt(u),a=function(){let s=i.read();if(s==-1)throw"eof";return s},e=0,t={};while(!0){let s=i.read();if(s==-1)break;let y=a(),b=a(),p=a(),d=String.fromCharCode(s<<8|y),P=b<<8|p;t[d]=P,e+=1}if(e!=c)throw e+" != "+c;return t}(),r=63;return function(i){let a=[];for(let e=0;e<i.length;e+=1){let t=i.charCodeAt(e);if(t<128)a.push(t);else{let s=g[i.charAt(e)];if(typeof s=="number")if((s&255)==s)a.push(s);else a.push(s>>>8),a.push(s&255);else a.push(63)}}return a}};var k={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},U={L:1,M:0,Q:3,H:2},O={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N=function(){let u=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],c=1335,g=7973,r=21522,i={},a=function(e){let t=0;while(e!=0)t+=1,e>>>=1;return t};return i.getBCHTypeInfo=function(e){let t=e<<10;while(a(t)-a(1335)>=0)t^=1335<<a(t)-a(1335);return(e<<10|t)^21522},i.getBCHTypeNumber=function(e){let t=e<<12;while(a(t)-a(7973)>=0)t^=7973<<a(t)-a(7973);return e<<12|t},i.getPatternPosition=function(e){return u[e-1]},i.getMaskFunction=function(e){switch(e){case O.PATTERN000:return function(t,s){return(t+s)%2==0};case O.PATTERN001:return function(t,s){return t%2==0};case O.PATTERN010:return function(t,s){return s%3==0};case O.PATTERN011:return function(t,s){return(t+s)%3==0};case O.PATTERN100:return function(t,s){return(Math.floor(t/2)+Math.floor(s/3))%2==0};case O.PATTERN101:return function(t,s){return t*s%2+t*s%3==0};case O.PATTERN110:return function(t,s){return(t*s%2+t*s%3)%2==0};case O.PATTERN111:return function(t,s){return(t*s%3+(t+s)%2)%2==0};default:throw"bad maskPattern:"+e}},i.getErrorCorrectPolynomial=function(e){let t=Q([1],0);for(let s=0;s<e;s+=1)t=t.multiply(Q([1,S.gexp(s)],0));return t},i.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case k.MODE_NUMBER:return 10;case k.MODE_ALPHA_NUM:return 9;case k.MODE_8BIT_BYTE:return 8;case k.MODE_KANJI:return 8;default:throw"mode:"+e}else if(t<27)switch(e){case k.MODE_NUMBER:return 12;case k.MODE_ALPHA_NUM:return 11;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 10;default:throw"mode:"+e}else if(t<41)switch(e){case k.MODE_NUMBER:return 14;case k.MODE_ALPHA_NUM:return 13;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 12;default:throw"mode:"+e}else throw"type:"+t},i.getLostPoint=function(e){let t=e.getModuleCount(),s=0;for(let p=0;p<t;p+=1)for(let d=0;d<t;d+=1){let P=0,R=e.isDark(p,d);for(let T=-1;T<=1;T+=1){if(p+T<0||t<=p+T)continue;for(let C=-1;C<=1;C+=1){if(d+C<0||t<=d+C)continue;if(T==0&&C==0)continue;if(R==e.isDark(p+T,d+C))P+=1}}if(P>5)s+=3+P-5}for(let p=0;p<t-1;p+=1)for(let d=0;d<t-1;d+=1){let P=0;if(e.isDark(p,d))P+=1;if(e.isDark(p+1,d))P+=1;if(e.isDark(p,d+1))P+=1;if(e.isDark(p+1,d+1))P+=1;if(P==0||P==4)s+=3}for(let p=0;p<t;p+=1)for(let d=0;d<t-6;d+=1)if(e.isDark(p,d)&&!e.isDark(p,d+1)&&e.isDark(p,d+2)&&e.isDark(p,d+3)&&e.isDark(p,d+4)&&!e.isDark(p,d+5)&&e.isDark(p,d+6))s+=40;for(let p=0;p<t;p+=1)for(let d=0;d<t-6;d+=1)if(e.isDark(d,p)&&!e.isDark(d+1,p)&&e.isDark(d+2,p)&&e.isDark(d+3,p)&&e.isDark(d+4,p)&&!e.isDark(d+5,p)&&e.isDark(d+6,p))s+=40;let y=0;for(let p=0;p<t;p+=1)for(let d=0;d<t;d+=1)if(e.isDark(d,p))y+=1;let b=Math.abs(100*y/t/t-50)/5;return s+=b*10,s},i}(),S=function(){let u=Array(256),c=Array(256);for(let r=0;r<8;r+=1)u[r]=1<<r;for(let r=8;r<256;r+=1)u[r]=u[r-4]^u[r-5]^u[r-6]^u[r-8];for(let r=0;r<255;r+=1)c[u[r]]=r;let g={};return g.glog=function(r){if(r<1)throw"glog("+r+")";return c[r]},g.gexp=function(r){while(r<0)r+=255;while(r>=256)r-=255;return u[r]},g}(),Q=function(u,c){if(typeof u.length>"u")throw u.length+"/"+c;let g=function(){let i=0;while(i<u.length&&u[i]==0)i+=1;let a=Array(u.length-i+c);for(let e=0;e<u.length-i;e+=1)a[e]=u[e+i];return a}(),r={};return r.getAt=function(i){return g[i]},r.getLength=function(){return g.length},r.multiply=function(i){let a=Array(r.getLength()+i.getLength()-1);for(let e=0;e<r.getLength();e+=1)for(let t=0;t<i.getLength();t+=1)a[e+t]^=S.gexp(S.glog(r.getAt(e))+S.glog(i.getAt(t)));return Q(a,0)},r.mod=function(i){if(r.getLength()-i.getLength()<0)return r;let a=S.glog(r.getAt(0))-S.glog(i.getAt(0)),e=Array(r.getLength());for(let t=0;t<r.getLength();t+=1)e[t]=r.getAt(t);for(let t=0;t<i.getLength();t+=1)e[t]^=S.gexp(S.glog(i.getAt(t))+a);return Q(e,0).mod(i)},r},Z=function(){let u=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],c=function(i,a){let e={};return e.totalCount=i,e.dataCount=a,e},g={},r=function(i,a){switch(a){case U.L:return u[(i-1)*4+0];case U.M:return u[(i-1)*4+1];case U.Q:return u[(i-1)*4+2];case U.H:return u[(i-1)*4+3];default:return}};return g.getRSBlocks=function(i,a){let e=r(i,a);if(typeof e>"u")throw"bad rs block @ typeNumber:"+i+"/errorCorrectionLevel:"+a;let t=e.length/3,s=[];for(let y=0;y<t;y+=1){let b=e[y*3+0],p=e[y*3+1],d=e[y*3+2];for(let P=0;P<b;P+=1)s.push(c(p,d))}return s},g}(),z=function(){let u=[],c=0,g={};return g.getBuffer=function(){return u},g.getAt=function(r){let i=Math.floor(r/8);return(u[i]>>>7-r%8&1)==1},g.put=function(r,i){for(let a=0;a<i;a+=1)g.putBit((r>>>i-a-1&1)==1)},g.getLengthInBits=function(){return c},g.putBit=function(r){let i=Math.floor(c/8);if(u.length<=i)u.push(0);if(r)u[i]|=128>>>c%8;c+=1},g},lt=function(u){let c=k.MODE_NUMBER,g=u,r={};r.getMode=function(){return c},r.getLength=function(e){return g.length},r.write=function(e){let t=g,s=0;while(s+2<t.length)e.put(i(t.substring(s,s+3)),10),s+=3;if(s<t.length){if(t.length-s==1)e.put(i(t.substring(s,s+1)),4);else if(t.length-s==2)e.put(i(t.substring(s,s+2)),7)}};let i=function(e){let t=0;for(let s=0;s<e.length;s+=1)t=t*10+a(e.charAt(s));return t},a=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-48;throw"illegal char :"+e};return r},ht=function(u){let c=k.MODE_ALPHA_NUM,g=u,r={};r.getMode=function(){return c},r.getLength=function(a){return g.length},r.write=function(a){let e=g,t=0;while(t+1<e.length)a.put(i(e.charAt(t))*45+i(e.charAt(t+1)),11),t+=2;if(t<e.length)a.put(i(e.charAt(t)),6)};let i=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;else if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;else switch(a){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+a}};return r},gt=function(u){let c=k.MODE_8BIT_BYTE,g=u,r=V.stringToBytes(u),i={};return i.getMode=function(){return c},i.getLength=function(a){return r.length},i.write=function(a){for(let e=0;e<r.length;e+=1)a.put(r[e],8)},i},dt=function(u){let c=k.MODE_KANJI,g=u,r=V.stringToBytes;(function(e,t){let s=r(e);if(s.length!=2||(s[0]<<8|s[1])!=t)throw"sjis not supported."})("\u53CB",38726);let i=r(u),a={};return a.getMode=function(){return c},a.getLength=function(e){return~~(i.length/2)},a.write=function(e){let t=i,s=0;while(s+1<t.length){let y=(255&t[s])<<8|255&t[s+1];if(33088<=y&&y<=40956)y-=33088;else if(57408<=y&&y<=60351)y-=49472;else throw"illegal char at "+(s+1)+"/"+y;y=(y>>>8&255)*192+(y&255),e.put(y,13),s+=2}if(s<t.length)throw"illegal char at "+(s+1)},a},tt=function(){let u=[],c={};return c.writeByte=function(g){u.push(g&255)},c.writeShort=function(g){c.writeByte(g),c.writeByte(g>>>8)},c.writeBytes=function(g,r,i){r=r||0,i=i||g.length;for(let a=0;a<i;a+=1)c.writeByte(g[a+r])},c.writeString=function(g){for(let r=0;r<g.length;r+=1)c.writeByte(g.charCodeAt(r))},c.toByteArray=function(){return u},c.toString=function(){let g="";g+="[";for(let r=0;r<u.length;r+=1){if(r>0)g+=",";g+=u[r]}return g+="]",g},c},pt=function(){let u=0,c=0,g=0,r="",i={},a=function(t){r+=String.fromCharCode(e(t&63))},e=function(t){if(t<0)throw"n:"+t;else if(t<26)return 65+t;else if(t<52)return 97+(t-26);else if(t<62)return 48+(t-52);else if(t==62)return 43;else if(t==63)return 47;else throw"n:"+t};return i.writeByte=function(t){u=u<<8|t&255,c+=8,g+=1;while(c>=6)a(u>>>c-6),c-=6},i.flush=function(){if(c>0)a(u<<6-c),u=0,c=0;if(g%3!=0){let t=3-g%3;for(let s=0;s<t;s+=1)r+="="}},i.toString=function(){return r},i},wt=function(u){let c=u,g=0,r=0,i=0,a={};a.read=function(){while(i<8){if(g>=c.length){if(i==0)return-1;throw"unexpected end of file./"+i}let s=c.charAt(g);if(g+=1,s=="=")return i=0,-1;else if(s.match(/^\s$/))continue;r=r<<6|e(s.charCodeAt(0)),i+=6}let t=r>>>i-8&255;return i-=8,t};let e=function(t){if(65<=t&&t<=90)return t-65;else if(97<=t&&t<=122)return t-97+26;else if(48<=t&&t<=57)return t-48+52;else if(t==43)return 62;else if(t==47)return 63;else throw"c:"+t};return a},yt=function(u,c){let g=u,r=c,i=Array(u*c),a={};a.setPixel=function(y,b,p){i[b*g+y]=p},a.write=function(y){y.writeString("GIF87a"),y.writeShort(g),y.writeShort(r),y.writeByte(128),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(255),y.writeByte(255),y.writeByte(255),y.writeString(","),y.writeShort(0),y.writeShort(0),y.writeShort(g),y.writeShort(r),y.writeByte(0);let b=2,p=t(b);y.writeByte(b);let d=0;while(p.length-d>255)y.writeByte(255),y.writeBytes(p,d,255),d+=255;y.writeByte(p.length-d),y.writeBytes(p,d,p.length-d),y.writeByte(0),y.writeString(";")};let e=function(y){let b=y,p=0,d=0,P={};return P.write=function(R,T){if(R>>>T!=0)throw"length over";while(p+T>=8)b.writeByte(255&(R<<p|d)),T-=8-p,R>>>=8-p,d=0,p=0;d=R<<p|d,p=p+T},P.flush=function(){if(p>0)b.writeByte(d)},P},t=function(y){let b=1<<y,p=(1<<y)+1,d=y+1,P=s();for(let D=0;D<b;D+=1)P.add(String.fromCharCode(D));P.add(String.fromCharCode(b)),P.add(String.fromCharCode(p));let R=tt(),T=e(R);T.write(b,d);let C=0,L=String.fromCharCode(i[C]);C+=1;while(C<i.length){let D=String.fromCharCode(i[C]);if(C+=1,P.contains(L+D))L=L+D;else{if(T.write(P.indexOf(L),d),P.size()<4095){if(P.size()==1<<d)d+=1;P.add(L+D)}L=D}}return T.write(P.indexOf(L),d),T.write(p,d),T.flush(),R.toByteArray()},s=function(){let y={},b=0,p={};return p.add=function(d){if(p.contains(d))throw"dup key:"+d;y[d]=b,b+=1},p.size=function(){return b},p.indexOf=function(d){return y[d]},p.contains=function(d){return typeof y[d]<"u"},p};return a},bt=function(u,c,g){let r=yt(u,c);for(let t=0;t<c;t+=1)for(let s=0;s<u;s+=1)r.setPixel(s,t,g(s,t));let i=tt();r.write(i);let a=pt(),e=i.toByteArray();for(let t=0;t<e.length;t+=1)a.writeByte(e[t]);return a.flush(),"data:image/gif;base64,"+a},et=V,mt=V.stringToBytes;var j=Lt(b0());function rt(u){let c=et(0,"M");return c.addData(u,"Byte"),c.make(),{size:c.getModuleCount(),dark:(g,r)=>c.isDark(g,r)}}var H=4;function ot(u,c=8){let r=(u.size+H*2)*c,i=r*4,a=new j.PNG({width:r,height:r});a.data.fill(255);for(let e=0;e<u.size;e++){let t=(e+H)*c*i;for(let s=0;s<u.size;s++)if(u.dark(e,s))xt(a.data,t+(s+H)*c*4,c);for(let s=1;s<c;s++)a.data.copy(a.data,t+s*i,t,t+i)}return j.PNG.sync.write(a,{colorType:0,deflateLevel:6})}function xt(u,c,g){for(let r=c;r<c+g*4;r+=4)u.fill(0,r,r+3)}function it(u){let c=[],g=-H,r=u.size+H;for(let i=g;i<r;i+=2){let a="";for(let e=g;e<r;e++){let t=!nt(u,i,e),s=i+1<r&&!nt(u,i+1,e);a+=t?s?"\u2588":"\u2580":s?"\u2584":" "}c.push(a)}return c.join(`
|
|
5
|
-
`)}function nt(u,c,g){return c>=0&&g>=0&&c<u.size&&g<u.size&&u.dark(c,g)}var _t={render(u){let c=rt(u);return{png:ot(c),terminal:it(c)}}},F="Nothing was written.";async function
|
|
6
|
-
export{
|
|
4
|
+
`}return B.substring(0,B.length-1)},b.renderTo2dContext=function(o,h){h=h||2;let n=b.getModuleCount();for(let l=0;l<n;l++)for(let f=0;f<n;f++)o.fillStyle=b.isDark(l,f)?"black":"white",o.fillRect(f*h,l*h,h,h)},b};V.stringToBytes=function(u){let c=[];for(let g=0;g<u.length;g+=1){let r=u.charCodeAt(g);c.push(r&255)}return c};V.createStringToBytes=function(u,c){let g=function(){let i=wt(u),a=function(){let s=i.read();if(s==-1)throw"eof";return s},e=0,t={};while(!0){let s=i.read();if(s==-1)break;let y=a(),b=a(),p=a(),d=String.fromCharCode(s<<8|y),P=b<<8|p;t[d]=P,e+=1}if(e!=c)throw e+" != "+c;return t}(),r=63;return function(i){let a=[];for(let e=0;e<i.length;e+=1){let t=i.charCodeAt(e);if(t<128)a.push(t);else{let s=g[i.charAt(e)];if(typeof s=="number")if((s&255)==s)a.push(s);else a.push(s>>>8),a.push(s&255);else a.push(63)}}return a}};var k={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},U={L:1,M:0,Q:3,H:2},O={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N=function(){let u=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],c=1335,g=7973,r=21522,i={},a=function(e){let t=0;while(e!=0)t+=1,e>>>=1;return t};return i.getBCHTypeInfo=function(e){let t=e<<10;while(a(t)-a(1335)>=0)t^=1335<<a(t)-a(1335);return(e<<10|t)^21522},i.getBCHTypeNumber=function(e){let t=e<<12;while(a(t)-a(7973)>=0)t^=7973<<a(t)-a(7973);return e<<12|t},i.getPatternPosition=function(e){return u[e-1]},i.getMaskFunction=function(e){switch(e){case O.PATTERN000:return function(t,s){return(t+s)%2==0};case O.PATTERN001:return function(t,s){return t%2==0};case O.PATTERN010:return function(t,s){return s%3==0};case O.PATTERN011:return function(t,s){return(t+s)%3==0};case O.PATTERN100:return function(t,s){return(Math.floor(t/2)+Math.floor(s/3))%2==0};case O.PATTERN101:return function(t,s){return t*s%2+t*s%3==0};case O.PATTERN110:return function(t,s){return(t*s%2+t*s%3)%2==0};case O.PATTERN111:return function(t,s){return(t*s%3+(t+s)%2)%2==0};default:throw"bad maskPattern:"+e}},i.getErrorCorrectPolynomial=function(e){let t=Q([1],0);for(let s=0;s<e;s+=1)t=t.multiply(Q([1,S.gexp(s)],0));return t},i.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case k.MODE_NUMBER:return 10;case k.MODE_ALPHA_NUM:return 9;case k.MODE_8BIT_BYTE:return 8;case k.MODE_KANJI:return 8;default:throw"mode:"+e}else if(t<27)switch(e){case k.MODE_NUMBER:return 12;case k.MODE_ALPHA_NUM:return 11;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 10;default:throw"mode:"+e}else if(t<41)switch(e){case k.MODE_NUMBER:return 14;case k.MODE_ALPHA_NUM:return 13;case k.MODE_8BIT_BYTE:return 16;case k.MODE_KANJI:return 12;default:throw"mode:"+e}else throw"type:"+t},i.getLostPoint=function(e){let t=e.getModuleCount(),s=0;for(let p=0;p<t;p+=1)for(let d=0;d<t;d+=1){let P=0,R=e.isDark(p,d);for(let T=-1;T<=1;T+=1){if(p+T<0||t<=p+T)continue;for(let C=-1;C<=1;C+=1){if(d+C<0||t<=d+C)continue;if(T==0&&C==0)continue;if(R==e.isDark(p+T,d+C))P+=1}}if(P>5)s+=3+P-5}for(let p=0;p<t-1;p+=1)for(let d=0;d<t-1;d+=1){let P=0;if(e.isDark(p,d))P+=1;if(e.isDark(p+1,d))P+=1;if(e.isDark(p,d+1))P+=1;if(e.isDark(p+1,d+1))P+=1;if(P==0||P==4)s+=3}for(let p=0;p<t;p+=1)for(let d=0;d<t-6;d+=1)if(e.isDark(p,d)&&!e.isDark(p,d+1)&&e.isDark(p,d+2)&&e.isDark(p,d+3)&&e.isDark(p,d+4)&&!e.isDark(p,d+5)&&e.isDark(p,d+6))s+=40;for(let p=0;p<t;p+=1)for(let d=0;d<t-6;d+=1)if(e.isDark(d,p)&&!e.isDark(d+1,p)&&e.isDark(d+2,p)&&e.isDark(d+3,p)&&e.isDark(d+4,p)&&!e.isDark(d+5,p)&&e.isDark(d+6,p))s+=40;let y=0;for(let p=0;p<t;p+=1)for(let d=0;d<t;d+=1)if(e.isDark(d,p))y+=1;let b=Math.abs(100*y/t/t-50)/5;return s+=b*10,s},i}(),S=function(){let u=Array(256),c=Array(256);for(let r=0;r<8;r+=1)u[r]=1<<r;for(let r=8;r<256;r+=1)u[r]=u[r-4]^u[r-5]^u[r-6]^u[r-8];for(let r=0;r<255;r+=1)c[u[r]]=r;let g={};return g.glog=function(r){if(r<1)throw"glog("+r+")";return c[r]},g.gexp=function(r){while(r<0)r+=255;while(r>=256)r-=255;return u[r]},g}(),Q=function(u,c){if(typeof u.length>"u")throw u.length+"/"+c;let g=function(){let i=0;while(i<u.length&&u[i]==0)i+=1;let a=Array(u.length-i+c);for(let e=0;e<u.length-i;e+=1)a[e]=u[e+i];return a}(),r={};return r.getAt=function(i){return g[i]},r.getLength=function(){return g.length},r.multiply=function(i){let a=Array(r.getLength()+i.getLength()-1);for(let e=0;e<r.getLength();e+=1)for(let t=0;t<i.getLength();t+=1)a[e+t]^=S.gexp(S.glog(r.getAt(e))+S.glog(i.getAt(t)));return Q(a,0)},r.mod=function(i){if(r.getLength()-i.getLength()<0)return r;let a=S.glog(r.getAt(0))-S.glog(i.getAt(0)),e=Array(r.getLength());for(let t=0;t<r.getLength();t+=1)e[t]=r.getAt(t);for(let t=0;t<i.getLength();t+=1)e[t]^=S.gexp(S.glog(i.getAt(t))+a);return Q(e,0).mod(i)},r},Z=function(){let u=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],c=function(i,a){let e={};return e.totalCount=i,e.dataCount=a,e},g={},r=function(i,a){switch(a){case U.L:return u[(i-1)*4+0];case U.M:return u[(i-1)*4+1];case U.Q:return u[(i-1)*4+2];case U.H:return u[(i-1)*4+3];default:return}};return g.getRSBlocks=function(i,a){let e=r(i,a);if(typeof e>"u")throw"bad rs block @ typeNumber:"+i+"/errorCorrectionLevel:"+a;let t=e.length/3,s=[];for(let y=0;y<t;y+=1){let b=e[y*3+0],p=e[y*3+1],d=e[y*3+2];for(let P=0;P<b;P+=1)s.push(c(p,d))}return s},g}(),z=function(){let u=[],c=0,g={};return g.getBuffer=function(){return u},g.getAt=function(r){let i=Math.floor(r/8);return(u[i]>>>7-r%8&1)==1},g.put=function(r,i){for(let a=0;a<i;a+=1)g.putBit((r>>>i-a-1&1)==1)},g.getLengthInBits=function(){return c},g.putBit=function(r){let i=Math.floor(c/8);if(u.length<=i)u.push(0);if(r)u[i]|=128>>>c%8;c+=1},g},lt=function(u){let c=k.MODE_NUMBER,g=u,r={};r.getMode=function(){return c},r.getLength=function(e){return g.length},r.write=function(e){let t=g,s=0;while(s+2<t.length)e.put(i(t.substring(s,s+3)),10),s+=3;if(s<t.length){if(t.length-s==1)e.put(i(t.substring(s,s+1)),4);else if(t.length-s==2)e.put(i(t.substring(s,s+2)),7)}};let i=function(e){let t=0;for(let s=0;s<e.length;s+=1)t=t*10+a(e.charAt(s));return t},a=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-48;throw"illegal char :"+e};return r},ht=function(u){let c=k.MODE_ALPHA_NUM,g=u,r={};r.getMode=function(){return c},r.getLength=function(a){return g.length},r.write=function(a){let e=g,t=0;while(t+1<e.length)a.put(i(e.charAt(t))*45+i(e.charAt(t+1)),11),t+=2;if(t<e.length)a.put(i(e.charAt(t)),6)};let i=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;else if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;else switch(a){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+a}};return r},gt=function(u){let c=k.MODE_8BIT_BYTE,g=u,r=V.stringToBytes(u),i={};return i.getMode=function(){return c},i.getLength=function(a){return r.length},i.write=function(a){for(let e=0;e<r.length;e+=1)a.put(r[e],8)},i},dt=function(u){let c=k.MODE_KANJI,g=u,r=V.stringToBytes;(function(e,t){let s=r(e);if(s.length!=2||(s[0]<<8|s[1])!=t)throw"sjis not supported."})("\u53CB",38726);let i=r(u),a={};return a.getMode=function(){return c},a.getLength=function(e){return~~(i.length/2)},a.write=function(e){let t=i,s=0;while(s+1<t.length){let y=(255&t[s])<<8|255&t[s+1];if(33088<=y&&y<=40956)y-=33088;else if(57408<=y&&y<=60351)y-=49472;else throw"illegal char at "+(s+1)+"/"+y;y=(y>>>8&255)*192+(y&255),e.put(y,13),s+=2}if(s<t.length)throw"illegal char at "+(s+1)},a},tt=function(){let u=[],c={};return c.writeByte=function(g){u.push(g&255)},c.writeShort=function(g){c.writeByte(g),c.writeByte(g>>>8)},c.writeBytes=function(g,r,i){r=r||0,i=i||g.length;for(let a=0;a<i;a+=1)c.writeByte(g[a+r])},c.writeString=function(g){for(let r=0;r<g.length;r+=1)c.writeByte(g.charCodeAt(r))},c.toByteArray=function(){return u},c.toString=function(){let g="";g+="[";for(let r=0;r<u.length;r+=1){if(r>0)g+=",";g+=u[r]}return g+="]",g},c},pt=function(){let u=0,c=0,g=0,r="",i={},a=function(t){r+=String.fromCharCode(e(t&63))},e=function(t){if(t<0)throw"n:"+t;else if(t<26)return 65+t;else if(t<52)return 97+(t-26);else if(t<62)return 48+(t-52);else if(t==62)return 43;else if(t==63)return 47;else throw"n:"+t};return i.writeByte=function(t){u=u<<8|t&255,c+=8,g+=1;while(c>=6)a(u>>>c-6),c-=6},i.flush=function(){if(c>0)a(u<<6-c),u=0,c=0;if(g%3!=0){let t=3-g%3;for(let s=0;s<t;s+=1)r+="="}},i.toString=function(){return r},i},wt=function(u){let c=u,g=0,r=0,i=0,a={};a.read=function(){while(i<8){if(g>=c.length){if(i==0)return-1;throw"unexpected end of file./"+i}let s=c.charAt(g);if(g+=1,s=="=")return i=0,-1;else if(s.match(/^\s$/))continue;r=r<<6|e(s.charCodeAt(0)),i+=6}let t=r>>>i-8&255;return i-=8,t};let e=function(t){if(65<=t&&t<=90)return t-65;else if(97<=t&&t<=122)return t-97+26;else if(48<=t&&t<=57)return t-48+52;else if(t==43)return 62;else if(t==47)return 63;else throw"c:"+t};return a},yt=function(u,c){let g=u,r=c,i=Array(u*c),a={};a.setPixel=function(y,b,p){i[b*g+y]=p},a.write=function(y){y.writeString("GIF87a"),y.writeShort(g),y.writeShort(r),y.writeByte(128),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(0),y.writeByte(255),y.writeByte(255),y.writeByte(255),y.writeString(","),y.writeShort(0),y.writeShort(0),y.writeShort(g),y.writeShort(r),y.writeByte(0);let b=2,p=t(b);y.writeByte(b);let d=0;while(p.length-d>255)y.writeByte(255),y.writeBytes(p,d,255),d+=255;y.writeByte(p.length-d),y.writeBytes(p,d,p.length-d),y.writeByte(0),y.writeString(";")};let e=function(y){let b=y,p=0,d=0,P={};return P.write=function(R,T){if(R>>>T!=0)throw"length over";while(p+T>=8)b.writeByte(255&(R<<p|d)),T-=8-p,R>>>=8-p,d=0,p=0;d=R<<p|d,p=p+T},P.flush=function(){if(p>0)b.writeByte(d)},P},t=function(y){let b=1<<y,p=(1<<y)+1,d=y+1,P=s();for(let D=0;D<b;D+=1)P.add(String.fromCharCode(D));P.add(String.fromCharCode(b)),P.add(String.fromCharCode(p));let R=tt(),T=e(R);T.write(b,d);let C=0,L=String.fromCharCode(i[C]);C+=1;while(C<i.length){let D=String.fromCharCode(i[C]);if(C+=1,P.contains(L+D))L=L+D;else{if(T.write(P.indexOf(L),d),P.size()<4095){if(P.size()==1<<d)d+=1;P.add(L+D)}L=D}}return T.write(P.indexOf(L),d),T.write(p,d),T.flush(),R.toByteArray()},s=function(){let y={},b=0,p={};return p.add=function(d){if(p.contains(d))throw"dup key:"+d;y[d]=b,b+=1},p.size=function(){return b},p.indexOf=function(d){return y[d]},p.contains=function(d){return typeof y[d]<"u"},p};return a},bt=function(u,c,g){let r=yt(u,c);for(let t=0;t<c;t+=1)for(let s=0;s<u;s+=1)r.setPixel(s,t,g(s,t));let i=tt();r.write(i);let a=pt(),e=i.toByteArray();for(let t=0;t<e.length;t+=1)a.writeByte(e[t]);return a.flush(),"data:image/gif;base64,"+a},et=V,mt=V.stringToBytes;var j=Nt(GF());function rt(u){let c=et(0,"M");return c.addData(u,"Byte"),c.make(),{size:c.getModuleCount(),dark:(g,r)=>c.isDark(g,r)}}var H=4;function ot(u,c=8){let r=(u.size+H*2)*c,i=r*4,a=new j.PNG({width:r,height:r});a.data.fill(255);for(let e=0;e<u.size;e++){let t=(e+H)*c*i;for(let s=0;s<u.size;s++)if(u.dark(e,s))xt(a.data,t+(s+H)*c*4,c);for(let s=1;s<c;s++)a.data.copy(a.data,t+s*i,t,t+i)}return j.PNG.sync.write(a,{colorType:0,deflateLevel:6})}function xt(u,c,g){for(let r=c;r<c+g*4;r+=4)u.fill(0,r,r+3)}function it(u){let c=[],g=-H,r=u.size+H;for(let i=g;i<r;i+=2){let a="";for(let e=g;e<r;e++){let t=!nt(u,i,e),s=i+1<r&&!nt(u,i+1,e);a+=t?s?"\u2588":"\u2580":s?"\u2584":" "}c.push(a)}return c.join(`
|
|
5
|
+
`)}function nt(u,c,g){return c>=0&&g>=0&&c<u.size&&g<u.size&&u.dark(c,g)}var _t={render(u){let c=rt(u);return{png:ot(c),terminal:it(c)}}},F="Nothing was written.";async function $J(u,c){let g=u.url===void 0?void 0:J(u.url);if(g)return Y("invalid_url",`${g}. ${F}`);if(Vu(u.spec))return Y("invalid_spec",`Element anchors are resolved against the live screen and cannot be shared; use {type:"bounds",bounds:{x,y,width,height}} anchors (dp) instead. ${F}`);let r=await yG(u,u.spec,c,F);if("failure"in r)return r.failure;let i=CP(r.bytes),a=u.url===void 0?void 0:W(u.url,i);if(a!==void 0&&Buffer.byteLength(a)>K)return Y("invalid_url",`The import link is ${Buffer.byteLength(a)} bytes, over ${K}, too dense for a phone camera to read as a QR; use a shorter url. ${F}`);let e=c.files.outputDir(),t=`${GK(u.spec.id)}-${i.slice(0,12)}`,s=st.join(e,`${t}.automobile-proto`);await c.files.write(s,r.bytes);let y={bundlePath:s,sha256:i,bytes:r.bytes.length};if(a===void 0||u.url===void 0)return{success:!0,share:y,warning:"No url was given, so there is no link or QR. Upload the bundle to a static https host, then share again with url set to where it is served."};let b=(c.qr??_t).render(a),p=CP(Buffer.from(a)).slice(0,12),d=st.join(e,`${t}-${p}.qr.png`);return await c.files.write(d,b.png),{success:!0,share:{...y,url:u.url,link:a,qrPngPath:d,qr:b.terminal},warning:`Upload ${s} so it is served byte-for-byte at ${u.url}; ProtoViewer refuses any other bytes. The link and QR open in an Android ProtoViewer that supports URL import, which asks before downloading; until then, or on iOS, send the bundle file itself and open it in ProtoViewer.`}}function GK(u){let c=u.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48);return c===""?"prototype":c}function Y(u,c){return{success:!1,errorCode:u,error:c}}
|
|
6
|
+
export{$J,GK};
|
|
7
7
|
|
|
8
|
-
//# debugId=
|
|
8
|
+
//# debugId=FB9A3A6C6B520DB364756E2164756E21
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t}from"./chunk-9rkfyt6q.js";import{O,vt}from"./chunk-2v7tw1nj.js";var ne=O(function(mt,ce){ce.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Y=O(function(ue){var ae={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",MAX_OUTPUT_EXCEEDED:"Decompressed data exceeds the declared uncompressed size",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DUPLICATE_ENTRY:"Duplicate entry name {0}",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",ZIP64_VALUE_TOO_LARGE:"Zip64 value exceeds the maximum safe integer",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function je(n){return function(...f){if(f.length)n=n.replace(/\{(\d)\}/g,(r,s)=>f[s]||"");return Error("ADM-ZIP: "+n)}}for(let n of Object.keys(ae))ue[n]=je(ae[n])});var he=O(function(Lt,de){var qe=vt("fs"),_=vt("path"),Q=ne(),b=Y(),be=typeof process==="object"&&process.platform==="win32",le=(n)=>typeof n==="object"&&n!==null,Ee=new Uint32Array(256).map((n,f)=>{for(let r=0;r<8;r++)if((f&1)!==0)f=3988292384^f>>>1;else f>>>=1;return f>>>0});function P(n){if(this.sep=_.sep,this.fs=qe,le(n)){if(le(n.fs)&&typeof n.fs.statSync==="function")this.fs=n.fs}}de.exports=P;P.prototype.makeDir=function(n){let f=this;function r(s){let c=s.split(f.sep)[0];s.split(f.sep).forEach(function(d){if(!d||d.substr(-1,1)===":")return;c+=f.sep+d;var o;try{o=f.fs.statSync(c)}catch(m){if(m.message&&m.message.startsWith("ENOENT"))f.fs.mkdirSync(c);else throw m}if(o&&o.isFile())throw b.FILE_IN_THE_WAY(`"${c}"`)})}r(n)};P.prototype.writeFileTo=function(n,f,r,s){let c=this;if(c.fs.existsSync(n)){if(!r)return!1;var d=c.fs.statSync(n);if(d.isDirectory())return!1}var o=_.dirname(n);if(!c.fs.existsSync(o))c.makeDir(o);var m;try{m=c.fs.openSync(n,"w",438)}catch(S){c.fs.chmodSync(n,438),m=c.fs.openSync(n,"w",438)}if(m)try{c.fs.writeSync(m,f,0,f.length,0)}finally{c.fs.closeSync(m)}return c.fs.chmodSync(n,s||438),!0};P.prototype.writeFileToAsync=function(n,f,r,s,c){if(typeof s==="function")c=s,s=void 0;let d=this;d.fs.exists(n,function(o){if(o&&!r)return c(!1);d.fs.stat(n,function(m,S){if(o&&S&&S.isDirectory())return c(!1);var A=_.dirname(n);d.fs.exists(A,function(p){if(!p)try{d.makeDir(A)}catch(T){return c(!1)}let C=function(T){d.fs.write(T,f,0,f.length,0,function(R){d.fs.close(T,function(){if(R)return c(!1);d.fs.chmod(n,s||438,function(){c(!0)})})})};d.fs.open(n,"w",438,function(T,R){if(T)d.fs.chmod(n,438,function(){d.fs.open(n,"w",438,function(i,a){if(i||!a)return c(!1);C(a)})});else if(R)C(R);else c(!1)})})})})};P.prototype.assertPathSafe=function(n,f){let r=this;if(typeof r.fs.lstatSync!=="function")return;let s=_.resolve(n),c=_.resolve(f);if(c===s)return;let d=_.relative(s,c);if(!d||d===".."||d.startsWith(".."+_.sep)||_.isAbsolute(d))return;let o=s;for(let m of d.split(_.sep)){if(!m||m===".")continue;o=_.join(o,m);let S;try{S=r.fs.lstatSync(o)}catch(A){break}if(S.isSymbolicLink())throw b.FILE_IN_THE_WAY(`"${o}"`)}};P.prototype.findFiles=function(n){let f=this,r=typeof f.fs.lstatSync==="function",s=f.fs.realpathSync(n);function c(o){if(!r)return!1;if(!f.fs.lstatSync(o).isSymbolicLink())return!1;let m;try{m=f.fs.realpathSync(o)}catch(S){return!0}return!(m===s||m.startsWith(s+_.sep))}function d(o,m,S,A){if(typeof m==="boolean")S=m,m=void 0;let p=[];return f.fs.readdirSync(o).forEach(function(C){let T=_.join(o,C);if(c(T))return;let R=f.fs.statSync(T);if(!m||m.test(T))p.push(_.normalize(T)+(R.isDirectory()?f.sep:""));if(R.isDirectory()&&S){let i=f.fs.realpathSync(T);if(!A.has(i))A.add(i),p=p.concat(d(T,m,S,A))}}),p}return d(n,void 0,!0,new Set([s]))};P.prototype.findFilesAsync=function(n,f){let r=this,s=[],c=!1,d=function(p){if(c)return;c=!0,f(p,p?void 0:s)},o=typeof r.fs.lstat==="function",m=null,S=function(p,C){if(!o)return C(null,!1);r.fs.lstat(p,function(T,R){if(T)return C(T);if(!R||!R.isSymbolicLink())return C(null,!1);r.fs.realpath(p,function(i,a){if(i)return C(null,!0);C(null,!(a===m||a.startsWith(m+_.sep)))})})},A=function(p,C,T){r.fs.readdir(p,function(R,i){if(R)return T(R);let a=i.length;if(!a)return T();i.forEach(function(u){let E=_.join(p,u);S(E,function(h,e){if(h)return T(h);if(e){if(!--a)T();return}r.fs.stat(E,function(l,L){if(l)return T(l);if(!L){if(!--a)T();return}if(s.push(_.normalize(E)+(L.isDirectory()?r.sep:"")),!L.isDirectory()){if(!--a)T();return}r.fs.realpath(E,function(g,D){if(g)return T(g);if(C.has(D)){if(!--a)T();return}C.add(D),A(E,C,function(N){if(N)return T(N);if(!--a)T()})})})})})})};r.fs.realpath(n,function(p,C){if(p)return d(p);m=C,A(n,new Set([C]),d)})};P.prototype.getAttributes=function(){};P.prototype.setAttributes=function(){};P.crc32update=function(n,f){return Ee[(n^f)&255]^n>>>8};P.crc32=function(n){if(typeof n==="string")n=Buffer.from(n,"utf8");let f=n.length,r=-1;for(let s=0;s<f;)r=P.crc32update(r,n[s++]);return~r>>>0};P.methodToString=function(n){switch(n){case Q.STORED:return"STORED ("+n+")";case Q.DEFLATED:return"DEFLATED ("+n+")";default:return"UNSUPPORTED ("+n+")"}};P.canonical=function(n){if(!n)return"";let f=_.posix.normalize("/"+n.split("\\").join("/"));return _.join(".",f)};P.zipnamefix=function(n){if(!n)return"";let f=_.posix.normalize("/"+n.split("\\").join("/"));return _.posix.join(".",f)};P.findLast=function(n,f){if(!Array.isArray(n))throw TypeError("arr is not array");let r=n.length>>>0;for(let s=r-1;s>=0;s--)if(f(n[s],s,n))return n[s];return};P.sanitize=function(n,f){n=_.resolve(_.normalize(n));var r=f.split("/");for(var s=0,c=r.length;s<c;s++){var d=_.normalize(_.join(n,r.slice(s,c).join(_.sep)));if(d===n||d.startsWith(n+_.sep))return d}return _.normalize(_.join(n,_.basename(f)))};P.toBuffer=function(f,r){if(Buffer.isBuffer(f))return f;else if(f instanceof Uint8Array)return Buffer.from(f);else return typeof f==="string"?r(f):Buffer.alloc(0)};P.readBigUInt64LE=function(n,f){let r=n.readUInt32LE(f),c=n.readUInt32LE(f+4)*4294967296+r;if(c>Number.MAX_SAFE_INTEGER)throw b.ZIP64_VALUE_TOO_LARGE();return c};P.writeBigUInt64LE=function(n,f,r){let s=f>>>0,c=Math.floor(f/4294967296)>>>0;n.writeUInt32LE(s,r),n.writeUInt32LE(c,r+4)};P.fromDOS2Date=function(n){return new Date((n>>25&127)+1980,Math.max((n>>21&15)-1,0),Math.max(n>>16&31,1),n>>11&31,n>>5&63,(n&31)<<1)};P.fromDate2DOS=function(n){let f=0,r=0;if(n.getFullYear()>1979)f=(n.getFullYear()-1980&127)<<9|n.getMonth()+1<<5|n.getDate(),r=n.getHours()<<11|n.getMinutes()<<5|n.getSeconds()>>1;return f<<16|r};P.isWin=be;P.crcTable=Ee});var Le=O(function(Dt,Ie){var me=vt("path");Ie.exports=function(n,{fs:f}){var r=n||"",s=d(),c=null;function d(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(r&&f.existsSync(r))c=f.statSync(r),s.directory=c.isDirectory(),s.mtime=c.mtime,s.atime=c.atime,s.executable=(73&c.mode)!==0,s.readonly=(128&c.mode)===0,s.hidden=me.basename(r)[0]===".";else console.warn("Invalid path: "+r);return{get directory(){return s.directory},get readOnly(){return s.readonly},get hidden(){return s.hidden},get mtime(){return s.mtime},get atime(){return s.atime},get executable(){return s.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:s.directory,isReadOnly:s.readonly,isHidden:s.hidden,isExecutable:s.executable,mTime:s.mtime,aTime:s.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var ge=O(function(gt,De){De.exports={efs:!0,encode:(n)=>Buffer.from(n,"utf8"),decode:(n)=>n.toString("utf8")}});var W=O(function(Nt,X){X.exports=he();X.exports.Constants=ne();X.exports.Errors=Y();X.exports.FileAttr=Le();X.exports.decoder=ge()});var _e=O(function(_t,Ne){var V=W(),I=V.Constants;Ne.exports=function(){var n=20,f=10,r=0,s=0,c=0,d=0,o=0,m=0,S=0,A=0,p=0,C=0,T=0,R=0,i=0;n|=V.isWin?2560:768,r|=I.FLG_EFS;let a={extraLen:0},u=(e)=>Math.max(0,e)>>>0,E=(e)=>Math.max(0,e)&65535,h=(e)=>Math.max(0,e)&255;return c=V.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return f},set version(e){f=e},get flags(){return r},set flags(e){r=e},get flags_efs(){return(r&I.FLG_EFS)>0},set flags_efs(e){if(e)r|=I.FLG_EFS;else r&=~I.FLG_EFS},get flags_desc(){return(r&I.FLG_DESC)>0},set flags_desc(e){if(e)r|=I.FLG_DESC;else r&=~I.FLG_DESC},get method(){return s},set method(e){switch(e){case I.STORED:this.version=10;break;case I.DEFLATED:default:this.version=20}s=e},get time(){return V.fromDOS2Date(this.timeval)},set time(e){e=new Date(e),this.timeval=V.fromDate2DOS(e)},get timeval(){return c},set timeval(e){c=u(e)},get timeHighByte(){return h(c>>>8)},get crc(){return d},set crc(e){d=u(e)},get compressedSize(){return o},set compressedSize(e){o=u(e)},get size(){return m},set size(e){m=u(e)},get fileNameLength(){return S},set fileNameLength(e){S=e},get extraLength(){return A},set extraLength(e){A=e},get extraLocalLength(){return a.extraLen},set extraLocalLength(e){a.extraLen=e},get commentLength(){return p},set commentLength(e){p=e},get diskNumStart(){return C},set diskNumStart(e){C=u(e)},get inAttr(){return T},set inAttr(e){T=u(e)},get attr(){return R},set attr(e){R=u(e)},get fileAttr(){return(R||0)>>16&511},get offset(){return i},set offset(e){i=u(e)},get encrypted(){return(r&I.FLG_ENC)===I.FLG_ENC},get centralHeaderSize(){return I.CENHDR+S+A+p},get realDataOffset(){return i+I.LOCHDR+a.fnameLen+a.extraLen},get localHeader(){return a},loadLocalHeaderFromBinary:function(e){if(i<0||i+I.LOCHDR>e.length)throw V.Errors.INVALID_LOC();var l=e.slice(i,i+I.LOCHDR);if(l.readUInt32LE(0)!==I.LOCSIG)throw V.Errors.INVALID_LOC();a.version=l.readUInt16LE(I.LOCVER),a.flags=l.readUInt16LE(I.LOCFLG),a.flags_desc=(a.flags&I.FLG_DESC)>0,a.method=l.readUInt16LE(I.LOCHOW),a.time=l.readUInt32LE(I.LOCTIM),a.crc=l.readUInt32LE(I.LOCCRC),a.compressedSize=l.readUInt32LE(I.LOCSIZ),a.size=l.readUInt32LE(I.LOCLEN),a.fnameLen=l.readUInt16LE(I.LOCNAM),a.extraLen=l.readUInt16LE(I.LOCEXT);let L=i+I.LOCHDR+a.fnameLen,g=L+a.extraLen;return e.slice(L,g)},loadFromBinary:function(e){if(e.length!==I.CENHDR||e.readUInt32LE(0)!==I.CENSIG)throw V.Errors.INVALID_CEN();n=e.readUInt16LE(I.CENVEM),f=e.readUInt16LE(I.CENVER),r=e.readUInt16LE(I.CENFLG),s=e.readUInt16LE(I.CENHOW),c=e.readUInt32LE(I.CENTIM),d=e.readUInt32LE(I.CENCRC),o=e.readUInt32LE(I.CENSIZ),m=e.readUInt32LE(I.CENLEN),S=e.readUInt16LE(I.CENNAM),A=e.readUInt16LE(I.CENEXT),p=e.readUInt16LE(I.CENCOM),C=e.readUInt16LE(I.CENDSK),T=e.readUInt16LE(I.CENATT),R=e.readUInt32LE(I.CENATX),i=e.readUInt32LE(I.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(I.LOCHDR);return e.writeUInt32LE(I.LOCSIG,0),e.writeUInt16LE(f,I.LOCVER),e.writeUInt16LE(r&~I.FLG_DESC,I.LOCFLG),e.writeUInt16LE(s,I.LOCHOW),e.writeUInt32LE(c,I.LOCTIM),e.writeUInt32LE(d,I.LOCCRC),e.writeUInt32LE(o,I.LOCSIZ),e.writeUInt32LE(m,I.LOCLEN),e.writeUInt16LE(S,I.LOCNAM),e.writeUInt16LE(a.extraLen,I.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(I.CENHDR+S+A+p);return e.writeUInt32LE(I.CENSIG,0),e.writeUInt16LE(n,I.CENVEM),e.writeUInt16LE(f,I.CENVER),e.writeUInt16LE(r&~I.FLG_DESC,I.CENFLG),e.writeUInt16LE(s,I.CENHOW),e.writeUInt32LE(c,I.CENTIM),e.writeUInt32LE(d,I.CENCRC),e.writeUInt32LE(o,I.CENSIZ),e.writeUInt32LE(m,I.CENLEN),e.writeUInt16LE(S,I.CENNAM),e.writeUInt16LE(A,I.CENEXT),e.writeUInt16LE(p,I.CENCOM),e.writeUInt16LE(C,I.CENDSK),e.writeUInt16LE(T,I.CENATT),e.writeUInt32LE(R,I.CENATX),e.writeUInt32LE(i,I.CENOFF),e},toJSON:function(){let e=function(l){return l+" bytes"};return{made:n,version:f,flags:r,method:V.methodToString(s),time:this.time,crc:"0x"+d.toString(16).toUpperCase(),compressedSize:e(o),size:e(m),fileNameLength:e(S),extraLength:e(A),commentLength:e(p),diskNumStart:C,inAttr:T,attr:R,offset:i,centralHeaderSize:e(I.CENHDR+S+A+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var pe=O(function(yt,ye){var G=W(),y=G.Constants;ye.exports=function(){var n=0,f=0,r=0,s=0,c=0;let d=()=>n>y.EF_ZIP64_OR_16||f>y.EF_ZIP64_OR_16||r>y.EF_ZIP64_OR_32||s>y.EF_ZIP64_OR_32;return{get diskEntries(){return n},set diskEntries(o){n=f=o},get totalEntries(){return f},set totalEntries(o){f=n=o},get size(){return r},set size(o){r=o},get offset(){return s},set offset(o){s=o},get commentLength(){return c},set commentLength(o){c=o},get mainHeaderSize(){return(d()?y.ZIP64HDR+y.END64HDR:0)+y.ENDHDR+c},loadFromBinary:function(o){if((o.length!==y.ENDHDR||o.readUInt32LE(0)!==y.ENDSIG)&&(o.length<y.ZIP64HDR||o.readUInt32LE(0)!==y.ZIP64SIG))throw G.Errors.INVALID_END();if(o.readUInt32LE(0)===y.ENDSIG)n=o.readUInt16LE(y.ENDSUB),f=o.readUInt16LE(y.ENDTOT),r=o.readUInt32LE(y.ENDSIZ),s=o.readUInt32LE(y.ENDOFF),c=o.readUInt16LE(y.ENDCOM);else n=G.readBigUInt64LE(o,y.ZIP64SUB),f=G.readBigUInt64LE(o,y.ZIP64TOT),r=G.readBigUInt64LE(o,y.ZIP64SIZB),s=G.readBigUInt64LE(o,y.ZIP64OFF),c=0},toBinary:function(){if(!d()){var o=Buffer.alloc(y.ENDHDR+c);return o.writeUInt32LE(y.ENDSIG,0),o.writeUInt32LE(0,4),o.writeUInt16LE(n,y.ENDSUB),o.writeUInt16LE(f,y.ENDTOT),o.writeUInt32LE(r,y.ENDSIZ),o.writeUInt32LE(s,y.ENDOFF),o.writeUInt16LE(c,y.ENDCOM),o.fill(" ",y.ENDHDR),o}var o=Buffer.alloc(this.mainHeaderSize);let m=0;o.writeUInt32LE(y.ZIP64SIG,m),G.writeBigUInt64LE(o,y.ZIP64HDR-y.ZIP64LEAD,m+y.ZIP64SIZE),o.writeUInt16LE(45,m+y.ZIP64VEM),o.writeUInt16LE(45,m+y.ZIP64VER),o.writeUInt32LE(0,m+y.ZIP64DSK),o.writeUInt32LE(0,m+y.ZIP64DSKDIR),G.writeBigUInt64LE(o,n,m+y.ZIP64SUB),G.writeBigUInt64LE(o,f,m+y.ZIP64TOT),G.writeBigUInt64LE(o,r,m+y.ZIP64SIZB),G.writeBigUInt64LE(o,s,m+y.ZIP64OFF);let S=s+r;return m+=y.ZIP64HDR,o.writeUInt32LE(y.END64SIG,m),o.writeUInt32LE(0,m+y.END64START),G.writeBigUInt64LE(o,S,m+y.END64OFF),o.writeUInt32LE(1,m+y.END64NUMDISKS),m+=y.END64HDR,o.writeUInt32LE(y.ENDSIG,m),o.writeUInt32LE(0,m+4),o.writeUInt16LE(Math.min(n,y.EF_ZIP64_OR_16),m+y.ENDSUB),o.writeUInt16LE(Math.min(f,y.EF_ZIP64_OR_16),m+y.ENDTOT),o.writeUInt32LE(Math.min(r,y.EF_ZIP64_OR_32),m+y.ENDSIZ),o.writeUInt32LE(Math.min(s,y.EF_ZIP64_OR_32),m+y.ENDOFF),o.writeUInt16LE(c,m+y.ENDCOM),o.fill(" ",m+y.ENDHDR),o},toJSON:function(){let o=function(m,S){let A=m.toString(16).toUpperCase();while(A.length<S)A="0"+A;return"0x"+A};return{diskEntries:n,totalEntries:f,size:r+" bytes",offset:o(s,4),commentLength:c}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var re=O(function(Xe){Xe.EntryHeader=_e();Xe.MainHeader=pe()});var Se=O(function(Ct,Ce){Ce.exports=function(n){var f=vt("zlib"),r={chunkSize:(parseInt(n.length/1024)+1)*1024};return{deflate:function(){return f.deflateRawSync(n,r)},deflateAsync:function(s){var c=f.createDeflateRaw(r),d=[],o=0;c.on("data",function(m){d.push(m),o+=m.length}),c.on("end",function(){var m=Buffer.alloc(o),S=0;m.fill(0);for(var A=0;A<d.length;A++){var p=d[A];p.copy(m,S),S+=p.length}s&&s(m)}),c.end(n)}}}});var Te=O(function(St,Ae){var Ye=+(process?.versions?.node??"").split(".")[0]||0,Oe=Y();Ae.exports=function(n,f){var r=vt("zlib");let s=f>0?f:1,c=Ye>=15?{maxOutputLength:s}:{};return{inflate:function(){return r.inflateRawSync(n,c)},inflateAsync:function(d){var o=r.createInflateRaw(c),m=[],S=0,A=!1;let p=function(C){if(A)return;A=!0,o.destroy(),d&&d(Buffer.alloc(0),C)};o.on("error",function(C){p(C)}),o.on("data",function(C){if(A)return;if(S+=C.length,S>s)return p(Oe.MAX_OUTPUT_EXCEEDED());m.push(C)}),o.on("end",function(){if(A)return;A=!0;var C=Buffer.alloc(S),T=0;C.fill(0);for(var R=0;R<m.length;R++){var i=m[R];i.copy(C,T),T+=i.length}d&&d(C)}),o.end(n)}}}});var Be=O(function(Ot,Ue){var{randomFillSync:Fe}=vt("crypto"),xe=Y(),Je=new Uint32Array(256).map((n,f)=>{for(let r=0;r<8;r++)if((f&1)!==0)f=f>>>1^3988292384;else f>>>=1;return f>>>0}),we=(n,f)=>Math.imul(n,f)>>>0,Re=(n,f)=>Je[(n^f)&255]^n>>>8,J=()=>{if(typeof Fe==="function")return Fe(Buffer.alloc(12));else return J.node()};J.node=()=>{let n=Buffer.alloc(12),f=n.length;for(let r=0;r<f;r++)n[r]=Math.random()*256&255;return n};var ee={genSalt:J};function te(n){let f=Buffer.isBuffer(n)?n:Buffer.from(n);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<f.length;r++)this.updateKeys(f[r])}te.prototype.updateKeys=function(n){let f=this.keys;return f[0]=Re(f[0],n),f[1]+=f[0]&255,f[1]=we(f[1],134775813)+1,f[2]=Re(f[2],f[1]>>>24),n};te.prototype.next=function(){let n=(this.keys[2]|2)>>>0;return we(n,n^1)>>8&255};function $e(n){let f=new te(n);return function(r){let s=Buffer.alloc(r.length),c=0;for(let d of r)s[c++]=f.updateKeys(d^f.next());return s}}function ke(n){let f=new te(n);return function(r,s,c=0){if(!s)s=Buffer.alloc(r.length);for(let d of r){let o=f.next();s[c++]=d^o,f.updateKeys(d)}return s}}function Qe(n,f,r){if(!n||!Buffer.isBuffer(n)||n.length<12)return Buffer.alloc(0);let s=$e(r),c=s(n.slice(0,12)),d=(f.flags&8)===8?f.timeHighByte:f.crc>>>24;if(c[11]!==d)throw xe.WRONG_PASSWORD();return s(n.slice(12))}function et(n){if(Buffer.isBuffer(n)&&n.length>=12)ee.genSalt=function(){return n.slice(0,12)};else if(n==="node")ee.genSalt=J.node;else ee.genSalt=J}function tt(n,f,r,s=!1){if(n==null)n=Buffer.alloc(0);if(!Buffer.isBuffer(n))n=Buffer.from(n.toString());let c=ke(r),d=ee.genSalt();if(d[11]=f.crc>>>24&255,s)d[10]=f.crc>>>16&255;let o=Buffer.alloc(n.length+12);return c(d,o),c(n,o,12)}Ue.exports={decrypt:Qe,encrypt:tt,_salter:et}});var Ze=O(function(nt){nt.Deflater=Se();nt.Inflater=Te();nt.ZipCrypto=Be()});var ie=O(function(Tt,ve){var v=W(),st=re(),z=v.Constants,oe=Ze();ve.exports=function(n,f){var r=new st.EntryHeader,s=Buffer.alloc(0),c=Buffer.alloc(0),d=!1,o=null,m=Buffer.alloc(0),S=Buffer.alloc(0),A=!0;let p=n,C=typeof p.decoder==="object"?p.decoder:v.decoder;A=C.hasOwnProperty("efs")?C.efs:!1;function T(){if(!f||!(f instanceof Uint8Array))return Buffer.alloc(0);S=r.loadLocalHeaderFromBinary(f);let e=r.realDataOffset,l=e+r.compressedSize;if(e<0||l<e||l>f.length)throw v.Errors.INVALID_LOC();return f.slice(e,l)}function R(e){let l=r.flags_desc||r.localHeader.flags_desc?r.crc:r.localHeader.crc;return v.crc32(e)===l}function i(e,l,L){if(typeof l>"u"&&typeof e==="string")L=e,e=void 0;if(d){if(e&&l)l(Buffer.alloc(0),v.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var g;try{if(g=T(),g.length===0){if(e&&l)l(g);return g}if(r.encrypted){if(typeof L!=="string"&&!Buffer.isBuffer(L))throw v.Errors.INVALID_PASS_PARAM();g=oe.ZipCrypto.decrypt(g,r,L)}}catch(x){if(e&&l)return l(Buffer.alloc(0),x),Buffer.alloc(0);throw x}var D;switch(r.method){case v.Constants.STORED:if(D=Buffer.alloc(g.length),g.copy(D),!R(D)){if(e&&l)l(D,v.Errors.BAD_CRC());throw v.Errors.BAD_CRC()}else{if(e&&l)l(D);return D}case v.Constants.DEFLATED:var N=new oe.Inflater(g,r.size);if(!e){if(D=N.inflate(),!R(D))throw v.Errors.BAD_CRC(`"${C.decode(s)}"`);return D}else N.inflateAsync(function(x,U){if(!l)return;if(U)l(Buffer.alloc(0),U);else if(!R(x))l(x,v.Errors.BAD_CRC());else l(x)});break;default:if(e&&l)l(Buffer.alloc(0),v.Errors.UNKNOWN_METHOD());throw v.Errors.UNKNOWN_METHOD()}}function a(e,l){if((!o||!o.length)&&Buffer.isBuffer(f)){if(e&&l)l(T());return T()}if(o.length&&!d){var L;switch(r.method){case v.Constants.STORED:if(r.compressedSize=r.size,L=Buffer.alloc(o.length),o.copy(L),e&&l)l(L);return L;default:case v.Constants.DEFLATED:var g=new oe.Deflater(o);if(!e){var D=g.deflate();return r.compressedSize=D.length,D}else g.deflateAsync(function(N){L=Buffer.alloc(N.length),r.compressedSize=N.length,N.copy(L),l&&l(L)});g=null;break}}else if(e&&l)l(Buffer.alloc(0));else return Buffer.alloc(0)}function u(e,l){return v.readBigUInt64LE(e,l)}function E(e){try{var l=0,L,g,D;while(l+4<e.length)if(L=e.readUInt16LE(l),l+=2,g=e.readUInt16LE(l),l+=2,D=e.slice(l,l+g),l+=g,z.ID_ZIP64===L)h(D)}catch(N){throw v.Errors.EXTRA_FIELD_PARSE_ERROR()}}function h(e){var l,L,g,D;if(e.length>=z.EF_ZIP64_SCOMP){if(l=u(e,z.EF_ZIP64_SUNCOMP),r.size===z.EF_ZIP64_OR_32)r.size=l}if(e.length>=z.EF_ZIP64_RHO){if(L=u(e,z.EF_ZIP64_SCOMP),r.compressedSize===z.EF_ZIP64_OR_32)r.compressedSize=L}if(e.length>=z.EF_ZIP64_DSN){if(g=u(e,z.EF_ZIP64_RHO),r.offset===z.EF_ZIP64_OR_32)r.offset=g}if(e.length>=z.EF_ZIP64_DSN+4){if(D=e.readUInt32LE(z.EF_ZIP64_DSN),r.diskNumStart===z.EF_ZIP64_OR_16)r.diskNumStart=D}}return{get entryName(){return C.decode(s)},get rawEntryName(){return s},set entryName(e){s=v.toBuffer(e,C.encode);var l=s[s.length-1];d=l===47||l===92,r.fileNameLength=s.length},get efs(){if(typeof A==="function")return A(this.entryName);else return A},get extra(){return m},set extra(e){m=e,r.extraLength=e.length,E(e)},get comment(){return C.decode(c)},set comment(e){if(c=v.toBuffer(e,C.encode),r.commentLength=c.length,c.length>65535)throw v.Errors.COMMENT_TOO_LONG()},get name(){let e=C.decode(s);return d?e.replace(/[/\\]$/,"").split("/").pop():e.split("/").pop()},get isDirectory(){return d},getCompressedData:function(){return a(!1,null)},getCompressedDataAsync:function(e){a(!0,e)},setData:function(e){if(o=v.toBuffer(e,v.decoder.encode),!d&&o.length)r.size=o.length,r.method=v.Constants.DEFLATED,r.crc=v.crc32(e),r.changed=!0;else r.method=v.Constants.STORED},getData:function(e){if(r.changed)return o;else return i(!1,null,e)},getDataAsync:function(e,l){if(r.changed)e(o);else i(!0,e,l)},set attr(e){r.attr=e},get attr(){return r.attr},set header(e){r.loadFromBinary(e)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=m.length;var e=r.centralHeaderToBinary(),l=v.Constants.CENHDR;return s.copy(e,l),l+=s.length,m.copy(e,l),l+=r.extraLength,c.copy(e,l),e},packLocalHeader:function(){let e=0;r.flags_efs=this.efs,r.extraLocalLength=S.length;let l=r.localHeaderToBinary(),L=Buffer.alloc(l.length+s.length+r.extraLocalLength);return l.copy(L,e),e+=l.length,s.copy(L,e),e+=s.length,S.copy(L,e),e+=S.length,L},toJSON:function(){let e=function(l){return"<"+(l&&l.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:e(f),data:e(o)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var ze=O(function(Ft,Me){var Pe=ie(),He=re(),B=W();Me.exports=function(n,f){var r=[],s=Object.create(null),c=Buffer.alloc(0),d=new He.MainHeader,o=!1,m=null;let S=new Set,A=f,{noSort:p,decoder:C}=A;if(n)i(A.readEntries);else o=!0;function T(){let u=new Set;for(let E of Object.keys(s)){let h=E.split("/");if(h.pop(),!h.length)continue;for(let e=0;e<h.length;e++){let l=h.slice(0,e+1).join("/")+"/";u.add(l)}}for(let E of u)if(!(E in s)){let h=new Pe(A);h.entryName=E,h.attr=16,h.temporary=!0,r.push(h),s[h.entryName]=h,S.add(h)}}function R(){if(o=!0,s=Object.create(null),d.diskEntries>(n.length-d.offset)/B.Constants.CENHDR)throw B.Errors.DISK_ENTRY_TOO_LARGE();r=Array(d.diskEntries);var u=d.offset;for(var E=0;E<r.length;E++){var h=u,e=new Pe(A,n);if(e.header=n.slice(h,h+=B.Constants.CENHDR),e.entryName=n.slice(h,h+=e.header.fileNameLength),e.header.extraLength)e.extra=n.slice(h,h+=e.header.extraLength);if(e.header.commentLength)e.comment=n.slice(h,h+e.header.commentLength);if(u+=e.header.centralHeaderSize,e.entryName in s)throw B.Errors.DUPLICATE_ENTRY(`"${e.entryName}"`);r[E]=e,s[e.entryName]=e}S.clear(),T()}function i(u){var E=n.length-B.Constants.ENDHDR,h=Math.max(0,E-65535),e=h,l=n.length,L=-1,g=0;if(typeof A.trailingSpace==="boolean"?A.trailingSpace:!1)h=0;for(E;E>=e;E--){if(n[E]!==80)continue;if(n.readUInt32LE(E)===B.Constants.ENDSIG){L=E,g=E,l=E+B.Constants.ENDHDR,e=E-B.Constants.END64HDR;continue}if(n.readUInt32LE(E)===B.Constants.END64SIG){e=h;continue}if(n.readUInt32LE(E)===B.Constants.ZIP64SIG){L=E,l=E+B.readBigUInt64LE(n,E+B.Constants.ZIP64SIZE)+B.Constants.ZIP64LEAD;break}}if(L==-1)throw B.Errors.INVALID_FORMAT();if(d.loadFromBinary(n.slice(L,l)),d.commentLength)c=n.slice(g+B.Constants.ENDHDR);if(u)R()}function a(){if(r.length>1&&!p)r=r.map((u)=>({entry:u,key:u.entryName.toLowerCase()})).sort((u,E)=>u.key.localeCompare(E.key)).map((u)=>u.entry)}return{get entries(){if(!o)R();return r.filter((u)=>!S.has(u))},get comment(){return C.decode(c)},set comment(u){c=B.toBuffer(u,C.encode),d.commentLength=c.length},getEntryCount:function(){if(!o)return d.diskEntries;return r.length},forEach:function(u){this.entries.forEach(u)},getEntry:function(u){if(!o)R();return s[u]||null},setEntry:function(u){if(!o)R();r.push(u),s[u.entryName]=u,d.totalEntries=r.length},deleteFile:function(u,E=!0){if(!o)R();let h=s[u];this.getEntryChildren(h,E).map((l)=>l.entryName).forEach(this.deleteEntry)},deleteEntry:function(u){if(!o)R();let E=s[u],h=r.indexOf(E);if(h>=0)r.splice(h,1),delete s[u],d.totalEntries=r.length},getEntryChildren:function(u,E=!0){if(!o)R();if(typeof u==="object")if(u.isDirectory&&E){let h=[],e=u.entryName;for(let l of r)if(l.entryName.startsWith(e))h.push(l);return h}else return[u];return[]},getChildCount:function(u){if(u&&u.isDirectory){let E=this.getEntryChildren(u);return E.includes(u)?E.length-1:E.length}return 0},compressToBuffer:function(){if(!o)R();a();let u=[],E=[],h=0,e=0;d.size=0,d.offset=0;let l=0;for(let D of this.entries){let N=D.getCompressedData();D.header.offset=e;let x=D.packLocalHeader(),U=x.length+N.length;e+=U,u.push(x),u.push(N);let Z=D.packCentralHeader();E.push(Z),d.size+=Z.length,h+=U+Z.length,l++}h+=d.mainHeaderSize,d.offset=e,d.totalEntries=l,e=0;let L=Buffer.alloc(h);for(let D of u)D.copy(L,e),e+=D.length;for(let D of E)D.copy(L,e),e+=D.length;let g=d.toBinary();if(c)c.copy(g,g.length-c.length);return g.copy(L,e),n=L,o=!1,L},toAsyncBuffer:function(u,E,h,e){try{if(!o)R();a();let l=[],L=[],g=0,D=0,N=0;d.size=0,d.offset=0;let x=function(U){if(U.length>0){let Z=U.shift(),H=Z.entryName+Z.extra.toString();if(h)h(H);Z.getCompressedDataAsync(function(M){if(e)e(H);Z.header.offset=D;let j=Z.packLocalHeader(),k=j.length+M.length;D+=k,l.push(j),l.push(M);let K=Z.packCentralHeader();L.push(K),d.size+=K.length,g+=k+K.length,N++,x(U)})}else{g+=d.mainHeaderSize,d.offset=D,d.totalEntries=N,D=0;let Z=Buffer.alloc(g);l.forEach(function(M){M.copy(Z,D),D+=M.length}),L.forEach(function(M){M.copy(Z,D),D+=M.length});let H=d.toBinary();if(c)c.copy(H,H.length-c.length);H.copy(Z,D),n=Z,o=!1,u(Z)}};x(Array.from(this.entries))}catch(l){E(l)}}}}});var fd=O(function(Rt,Ve){var w=W(),F=vt("path"),ft=ie(),ct=ze(),q=(...n)=>w.findLast(n,(f)=>typeof f==="boolean"),Ge=(...n)=>w.findLast(n,(f)=>typeof f==="string"),at=(...n)=>w.findLast(n,(f)=>typeof f==="function"),ut={noSort:!1,readEntries:!1,method:w.Constants.NONE,fs:null};Ve.exports=function(n,f){let r=null,s=Object.assign(Object.create(null),ut);if(n&&typeof n==="object"){if(!(n instanceof Uint8Array)){if(Object.assign(s,n),n=s.input?s.input:void 0,s.input)delete s.input}if(Buffer.isBuffer(n))r=n,s.method=w.Constants.BUFFER,n=void 0}Object.assign(s,f);let c=new w(s),d=(i)=>{i.filter((a)=>a.attr).sort((a,u)=>u.path.length-a.path.length).forEach((a)=>c.fs.chmodSync(a.path,a.attr))};if(typeof s.decoder!=="object"||typeof s.decoder.encode!=="function"||typeof s.decoder.decode!=="function")s.decoder=w.decoder;if(n&&typeof n==="string")if(c.fs.existsSync(n))s.method=w.Constants.FILE,s.filename=n,r=c.fs.readFileSync(n);else throw w.Errors.INVALID_FILENAME();let o=new ct(r,s),{canonical:m,sanitize:S,zipnamefix:A}=w;function p(i){if(i&&o){var a;if(typeof i==="string")a=o.getEntry(F.posix.normalize(i));if(typeof i==="object"&&typeof i.entryName<"u"&&typeof i.header<"u")a=o.getEntry(i.entryName);if(a)return a}return null}function C(i){let{join:a,normalize:u,sep:E}=F.posix;return a(F.isAbsolute(i)?"/":".",u(E+i.split("\\").join(E)+E))}function T(i){if(i instanceof RegExp)return function(a){return function(u){return a.test(u)}}(i);else if(typeof i!=="function")return()=>!0;return i}let R=(i,a)=>{let u=a.slice(-1);return u=u===c.sep?c.sep:"",F.relative(i,a)+u};return{readFile:function(i,a){var u=p(i);return u&&u.getData(a)||null},childCount:function(i){let a=p(i);if(a)return o.getChildCount(a)},readFileAsync:function(i,a){var u=p(i);if(u)u.getDataAsync(a);else a(null,"getEntry failed for:"+i)},readAsText:function(i,a){var u=p(i);if(u){var E=u.getData();if(E&&E.length)return E.toString(a||"utf8")}return""},readAsTextAsync:function(i,a,u){var E=p(i);if(E)E.getDataAsync(function(h,e){if(e){a(h,e);return}if(h&&h.length)a(h.toString(u||"utf8"));else a("")});else a("")},deleteFile:function(i,a=!0){var u=p(i);if(u)o.deleteFile(u.entryName,a)},deleteEntry:function(i){var a=p(i);if(a)o.deleteEntry(a.entryName)},addZipComment:function(i){o.comment=i},getZipComment:function(){return o.comment||""},addZipEntryComment:function(i,a){var u=p(i);if(u)u.comment=a},getZipEntryComment:function(i){var a=p(i);if(a)return a.comment||"";return""},updateFile:function(i,a){var u=p(i);if(u)u.setData(a)},addLocalFile:function(i,a,u,E){if(c.fs.existsSync(i)){a=a?C(a):"";let h=F.win32.basename(F.win32.normalize(i));a+=u?u:h;let e=c.fs.statSync(i),l=e.isFile()?c.fs.readFileSync(i):Buffer.alloc(0);if(e.isDirectory())a+=c.sep;this.addFile(a,l,E,e)}else throw w.Errors.FILE_NOT_FOUND(i)},addLocalFileAsync:function(i,a){i=typeof i==="object"?i:{localPath:i};let u=F.resolve(i.localPath),{comment:E}=i,{zipPath:h,zipName:e}=i,l=this;c.fs.stat(u,function(L,g){if(L)return a(L,!1);h=h?C(h):"";let D=F.win32.basename(F.win32.normalize(u));if(h+=e?e:D,g.isFile())c.fs.readFile(u,function(N,x){if(N)return a(N,!1);return l.addFile(h,x,E,g),setImmediate(a,void 0,!0)});else if(g.isDirectory())return h+=c.sep,l.addFile(h,Buffer.alloc(0),E,g),setImmediate(a,void 0,!0)})},addLocalFolder:function(i,a,u){if(u=T(u),a=a?C(a):"",i=F.normalize(i),c.fs.existsSync(i)){let E=c.findFiles(i),h=this;if(E.length)for(let e of E){let l=F.join(a,R(i,e));if(u(l))h.addLocalFile(e,F.dirname(l))}}else throw w.Errors.FILE_NOT_FOUND(i)},addLocalFolderAsync:function(i,a,u,E){E=T(E),u=u?C(u):"",i=F.normalize(i);var h=this;c.fs.open(i,"r",function(e){if(e&&e.code==="ENOENT")a(void 0,w.Errors.FILE_NOT_FOUND(i));else if(e)a(void 0,e);else{var l=c.findFiles(i),L=-1,g=function(){if(L+=1,L<l.length){var D=l[L],N=R(i,D).split("\\").join("/");if(N=N.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),E(N))c.fs.stat(D,function(x,U){if(x)a(void 0,x);if(U.isFile())c.fs.readFile(D,function(Z,H){if(Z)a(void 0,Z);else h.addFile(u+N,H,"",U),g()});else h.addFile(u+N+"/",Buffer.alloc(0),"",U),g()});else process.nextTick(()=>{g()})}else a(!0,void 0)};g()}})},addLocalFolderAsync2:function(i,a){let u=this;i=typeof i==="object"?i:{localPath:i};let E=F.resolve(i.localPath),{zipPath:h,filter:e,namefix:l}=i;if(e instanceof RegExp)e=function(D){return function(N){return D.test(N)}}(e);else if(typeof e!=="function")e=function(){return!0};if(h=h?C(h):"",l==="latin1")l=(D)=>D.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof l!=="function")l=(D)=>D;let L=(D)=>F.join(h,l(R(E,D))),g=(D)=>F.win32.basename(F.win32.normalize(l(D)));c.fs.open(E,"r",function(D){if(D&&D.code==="ENOENT")a(w.Errors.FILE_NOT_FOUND(E),!1);else if(D)a(D,!1);else c.findFilesAsync(E,function(N,x){if(N)return a(N,!1);if(x=x.filter((U)=>e(L(U))),!x.length)return a(void 0,!0);setImmediate(x.reverse().reduce(function(U,Z){return function(H,M){if(H||M===!1)return setImmediate(U,H,!1);u.addLocalFileAsync({localPath:Z,zipPath:F.dirname(L(Z)),zipName:g(Z)},U)}},a))})})},addLocalFolderPromise:function(i,a){return new Promise((u,E)=>{this.addLocalFolderAsync2(Object.assign({localPath:i},a),(h,e)=>{if(h)return E(h);if(e)u(this)})})},addFile:function(i,a,u,E){i=A(i);let h=p(i),e=h!=null;if(!e)h=new ft(s),h.entryName=i;h.comment=u||"";let l=typeof E==="object"&&E instanceof c.fs.Stats;if(l)h.header.time=E.mtime;var L=h.isDirectory?16:0;let g=h.isDirectory?16384:32768;if(l)g|=4095&E.mode;else if(typeof E==="number")g|=4095&E;else g|=h.isDirectory?493:420;if(L=(L|g<<16)>>>0,h.attr=L,h.setData(a),!e)o.setEntry(h);return h},getEntries:function(i){return o.password=i,o?o.entries:[]},getEntry:function(i){return p(i)},getEntryCount:function(){return o.getEntryCount()},forEach:function(i){return o.forEach(i)},extractEntryTo:function(i,a,u,E,h,e){E=q(!1,E),h=q(!1,h),u=q(!0,u),e=Ge(h,e);var l=p(i);if(!l)throw w.Errors.NO_ENTRY();var L=m(l.entryName),g=S(a,e&&!l.isDirectory?m(e):u?L:F.basename(L));if(l.isDirectory){var D=o.getEntryChildren(l);return D.forEach(function(U){if(U.isDirectory)return;var Z=U.getData();if(!Z)throw w.Errors.CANT_EXTRACT_FILE();var H=m(u?U.entryName:U.entryName.substring(l.entryName.length)),M=S(a,H);c.assertPathSafe(a,M);let j=h?U.header.fileAttr:void 0;c.writeFileTo(M,Z,E,j)}),!0}var N=l.getData(o.password);if(!N)throw w.Errors.CANT_EXTRACT_FILE();if(c.assertPathSafe(a,g),c.fs.existsSync(g)&&!E)throw w.Errors.CANT_OVERRIDE();let x=h?i.header.fileAttr:void 0;return c.writeFileTo(g,N,E,x),!0},test:function(i){if(!o)return!1;for(var a of o.entries)try{if(a.isDirectory)continue;var u=a.getData(i);if(!u)return!1}catch(E){return!1}return!0},extractAllTo:function(i,a,u,E){if(u=q(!1,u),E=Ge(u,E),a=q(!1,a),!o)throw w.Errors.NO_ZIP();let h=[];o.entries.forEach(function(e){var l=S(i,m(e.entryName));if(c.assertPathSafe(i,l),e.isDirectory){if(c.makeDir(l),u)h.push({path:l,attr:e.header.fileAttr});return}var L=e.getData(E);if(!L)throw w.Errors.CANT_EXTRACT_FILE();let g=u?e.header.fileAttr:void 0;c.writeFileTo(l,L,a,g);try{c.fs.utimesSync(l,e.header.time,e.header.time)}catch(D){}}),d(h)},extractAllToAsync:function(i,a,u,E){if(E=at(a,u,E),u=q(!1,u),a=q(!1,a),!E)return new Promise((N,x)=>{this.extractAllToAsync(i,a,u,function(U){if(U)x(U);else N(this)})});if(!o){E(w.Errors.NO_ZIP());return}i=F.resolve(i);let h=(N)=>S(i,F.normalize(m(N.entryName))),e=(N,x)=>Error(N+': "'+x+'"'),l=[],L=[];o.entries.forEach((N)=>{if(N.isDirectory)l.push(N);else L.push(N)});let g=[];for(let N of l){let x=h(N),U=u?N.header.fileAttr:void 0;try{c.assertPathSafe(i,x),c.makeDir(x)}catch(Z){E(e("Unable to create folder",x));continue}if(U)g.push({path:x,attr:U});try{c.fs.utimesSync(x,N.header.time,N.header.time)}catch(Z){}}let D=(N)=>{if(!N)try{d(g)}catch(x){return E(e("Unable to set folder permissions",x.path||""))}E(N)};L.reverse().reduce(function(N,x){return function(U){if(U)N(U);else{let Z=F.normalize(m(x.entryName)),H=S(i,Z);try{c.assertPathSafe(i,H)}catch(M){return N(M)}x.getDataAsync(function(M,j){if(j)N(j);else if(!M)N(w.Errors.CANT_EXTRACT_FILE());else{let k=u?x.header.fileAttr:void 0;c.writeFileToAsync(H,M,a,k,function(K){if(!K)return N(e("Unable to write file",H));c.fs.utimes(H,x.header.time,x.header.time,function(){N()})})}})}}},D)()},writeZip:function(i,a){if(arguments.length===1){if(typeof i==="function")a=i,i=""}if(!i&&s.filename)i=s.filename;if(!i)return;var u=o.compressToBuffer();if(u){var E=c.writeFileTo(i,u,!0);if(typeof a==="function")a(!E?Error("failed"):null,"")}},writeZipPromise:function(i,a){let{overwrite:u,perm:E}=Object.assign({overwrite:!0},a);return new Promise((h,e)=>{if(!i&&s.filename)i=s.filename;if(!i)e("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((l)=>{let L=(g)=>g?h(g):e("ADM-ZIP: Wasn't able to write zip file");c.writeFileToAsync(i,l,u,E,L)},e)})},toBufferPromise:function(){return new Promise((i,a)=>{o.toAsyncBuffer(i,a)})},toBuffer:function(i,a,u,E){if(typeof i==="function")return o.toAsyncBuffer(i,a,u,E),null;return o.compressToBuffer()}}}});import*as fe from"path";import*as se from"path";function Pc(n,f,r={}){let s=r.paths??se,c=s.resolve(n),d=s.resolve(c,f),o=s.relative(c,d);if(o==="")return r.allowEqual??!0;return!(o===".."||o.startsWith(`..${s.sep}`)||s.isAbsolute(o))}function Yie(n,f,r,s={}){if(!Pc(n,f,s))throw r();let c=s.paths??se;return c.resolve(c.resolve(n),f)}function f$(n,f,r="CtrlProxy bundle"){let s=fe.resolve(f);for(let c of n.getEntries())if(!Pc(s,c.entryName))throw new t(`Refusing to extract ${r}: entry "${c.entryName}" resolves outside the extraction directory ${s} (zip-slip / path traversal).`)}
|
|
3
|
-
export{
|
|
2
|
+
import{t}from"./chunk-rbpdk7m0.js";import{M,wt}from"./chunk-qcxzr2my.js";var ne=M(function(mt,ce){ce.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Y=M(function(ue){var ae={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",MAX_OUTPUT_EXCEEDED:"Decompressed data exceeds the declared uncompressed size",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DUPLICATE_ENTRY:"Duplicate entry name {0}",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",ZIP64_VALUE_TOO_LARGE:"Zip64 value exceeds the maximum safe integer",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function je(n){return function(...f){if(f.length)n=n.replace(/\{(\d)\}/g,(r,s)=>f[s]||"");return Error("ADM-ZIP: "+n)}}for(let n of Object.keys(ae))ue[n]=je(ae[n])});var he=M(function(Lt,de){var qe=wt("fs"),_=wt("path"),Q=ne(),b=Y(),be=typeof process==="object"&&process.platform==="win32",le=(n)=>typeof n==="object"&&n!==null,Ee=new Uint32Array(256).map((n,f)=>{for(let r=0;r<8;r++)if((f&1)!==0)f=3988292384^f>>>1;else f>>>=1;return f>>>0});function v(n){if(this.sep=_.sep,this.fs=qe,le(n)){if(le(n.fs)&&typeof n.fs.statSync==="function")this.fs=n.fs}}de.exports=v;v.prototype.makeDir=function(n){let f=this;function r(s){let c=s.split(f.sep)[0];s.split(f.sep).forEach(function(d){if(!d||d.substr(-1,1)===":")return;c+=f.sep+d;var o;try{o=f.fs.statSync(c)}catch(m){if(m.message&&m.message.startsWith("ENOENT"))f.fs.mkdirSync(c);else throw m}if(o&&o.isFile())throw b.FILE_IN_THE_WAY(`"${c}"`)})}r(n)};v.prototype.writeFileTo=function(n,f,r,s){let c=this;if(c.fs.existsSync(n)){if(!r)return!1;var d=c.fs.statSync(n);if(d.isDirectory())return!1}var o=_.dirname(n);if(!c.fs.existsSync(o))c.makeDir(o);var m;try{m=c.fs.openSync(n,"w",438)}catch(S){c.fs.chmodSync(n,438),m=c.fs.openSync(n,"w",438)}if(m)try{c.fs.writeSync(m,f,0,f.length,0)}finally{c.fs.closeSync(m)}return c.fs.chmodSync(n,s||438),!0};v.prototype.writeFileToAsync=function(n,f,r,s,c){if(typeof s==="function")c=s,s=void 0;let d=this;d.fs.exists(n,function(o){if(o&&!r)return c(!1);d.fs.stat(n,function(m,S){if(o&&S&&S.isDirectory())return c(!1);var O=_.dirname(n);d.fs.exists(O,function(p){if(!p)try{d.makeDir(O)}catch(A){return c(!1)}let C=function(A){d.fs.write(A,f,0,f.length,0,function(F){d.fs.close(A,function(){if(F)return c(!1);d.fs.chmod(n,s||438,function(){c(!0)})})})};d.fs.open(n,"w",438,function(A,F){if(A)d.fs.chmod(n,438,function(){d.fs.open(n,"w",438,function(i,a){if(i||!a)return c(!1);C(a)})});else if(F)C(F);else c(!1)})})})})};v.prototype.assertPathSafe=function(n,f){let r=this;if(typeof r.fs.lstatSync!=="function")return;let s=_.resolve(n),c=_.resolve(f);if(c===s)return;let d=_.relative(s,c);if(!d||d===".."||d.startsWith(".."+_.sep)||_.isAbsolute(d))return;let o=s;for(let m of d.split(_.sep)){if(!m||m===".")continue;o=_.join(o,m);let S;try{S=r.fs.lstatSync(o)}catch(O){break}if(S.isSymbolicLink())throw b.FILE_IN_THE_WAY(`"${o}"`)}};v.prototype.findFiles=function(n){let f=this,r=typeof f.fs.lstatSync==="function",s=f.fs.realpathSync(n);function c(o){if(!r)return!1;if(!f.fs.lstatSync(o).isSymbolicLink())return!1;let m;try{m=f.fs.realpathSync(o)}catch(S){return!0}return!(m===s||m.startsWith(s+_.sep))}function d(o,m,S,O){if(typeof m==="boolean")S=m,m=void 0;let p=[];return f.fs.readdirSync(o).forEach(function(C){let A=_.join(o,C);if(c(A))return;let F=f.fs.statSync(A);if(!m||m.test(A))p.push(_.normalize(A)+(F.isDirectory()?f.sep:""));if(F.isDirectory()&&S){let i=f.fs.realpathSync(A);if(!O.has(i))O.add(i),p=p.concat(d(A,m,S,O))}}),p}return d(n,void 0,!0,new Set([s]))};v.prototype.findFilesAsync=function(n,f){let r=this,s=[],c=!1,d=function(p){if(c)return;c=!0,f(p,p?void 0:s)},o=typeof r.fs.lstat==="function",m=null,S=function(p,C){if(!o)return C(null,!1);r.fs.lstat(p,function(A,F){if(A)return C(A);if(!F||!F.isSymbolicLink())return C(null,!1);r.fs.realpath(p,function(i,a){if(i)return C(null,!0);C(null,!(a===m||a.startsWith(m+_.sep)))})})},O=function(p,C,A){r.fs.readdir(p,function(F,i){if(F)return A(F);let a=i.length;if(!a)return A();i.forEach(function(u){let E=_.join(p,u);S(E,function(h,e){if(h)return A(h);if(e){if(!--a)A();return}r.fs.stat(E,function(l,L){if(l)return A(l);if(!L){if(!--a)A();return}if(s.push(_.normalize(E)+(L.isDirectory()?r.sep:"")),!L.isDirectory()){if(!--a)A();return}r.fs.realpath(E,function(g,D){if(g)return A(g);if(C.has(D)){if(!--a)A();return}C.add(D),O(E,C,function(N){if(N)return A(N);if(!--a)A()})})})})})})};r.fs.realpath(n,function(p,C){if(p)return d(p);m=C,O(n,new Set([C]),d)})};v.prototype.getAttributes=function(){};v.prototype.setAttributes=function(){};v.crc32update=function(n,f){return Ee[(n^f)&255]^n>>>8};v.crc32=function(n){if(typeof n==="string")n=Buffer.from(n,"utf8");let f=n.length,r=-1;for(let s=0;s<f;)r=v.crc32update(r,n[s++]);return~r>>>0};v.methodToString=function(n){switch(n){case Q.STORED:return"STORED ("+n+")";case Q.DEFLATED:return"DEFLATED ("+n+")";default:return"UNSUPPORTED ("+n+")"}};v.canonical=function(n){if(!n)return"";let f=_.posix.normalize("/"+n.split("\\").join("/"));return _.join(".",f)};v.zipnamefix=function(n){if(!n)return"";let f=_.posix.normalize("/"+n.split("\\").join("/"));return _.posix.join(".",f)};v.findLast=function(n,f){if(!Array.isArray(n))throw TypeError("arr is not array");let r=n.length>>>0;for(let s=r-1;s>=0;s--)if(f(n[s],s,n))return n[s];return};v.sanitize=function(n,f){n=_.resolve(_.normalize(n));var r=f.split("/");for(var s=0,c=r.length;s<c;s++){var d=_.normalize(_.join(n,r.slice(s,c).join(_.sep)));if(d===n||d.startsWith(n+_.sep))return d}return _.normalize(_.join(n,_.basename(f)))};v.toBuffer=function(f,r){if(Buffer.isBuffer(f))return f;else if(f instanceof Uint8Array)return Buffer.from(f);else return typeof f==="string"?r(f):Buffer.alloc(0)};v.readBigUInt64LE=function(n,f){let r=n.readUInt32LE(f),c=n.readUInt32LE(f+4)*4294967296+r;if(c>Number.MAX_SAFE_INTEGER)throw b.ZIP64_VALUE_TOO_LARGE();return c};v.writeBigUInt64LE=function(n,f,r){let s=f>>>0,c=Math.floor(f/4294967296)>>>0;n.writeUInt32LE(s,r),n.writeUInt32LE(c,r+4)};v.fromDOS2Date=function(n){return new Date((n>>25&127)+1980,Math.max((n>>21&15)-1,0),Math.max(n>>16&31,1),n>>11&31,n>>5&63,(n&31)<<1)};v.fromDate2DOS=function(n){let f=0,r=0;if(n.getFullYear()>1979)f=(n.getFullYear()-1980&127)<<9|n.getMonth()+1<<5|n.getDate(),r=n.getHours()<<11|n.getMinutes()<<5|n.getSeconds()>>1;return f<<16|r};v.isWin=be;v.crcTable=Ee});var Le=M(function(Dt,Ie){var me=wt("path");Ie.exports=function(n,{fs:f}){var r=n||"",s=d(),c=null;function d(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(r&&f.existsSync(r))c=f.statSync(r),s.directory=c.isDirectory(),s.mtime=c.mtime,s.atime=c.atime,s.executable=(73&c.mode)!==0,s.readonly=(128&c.mode)===0,s.hidden=me.basename(r)[0]===".";else console.warn("Invalid path: "+r);return{get directory(){return s.directory},get readOnly(){return s.readonly},get hidden(){return s.hidden},get mtime(){return s.mtime},get atime(){return s.atime},get executable(){return s.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:s.directory,isReadOnly:s.readonly,isHidden:s.hidden,isExecutable:s.executable,mTime:s.mtime,aTime:s.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var ge=M(function(gt,De){De.exports={efs:!0,encode:(n)=>Buffer.from(n,"utf8"),decode:(n)=>n.toString("utf8")}});var W=M(function(Nt,X){X.exports=he();X.exports.Constants=ne();X.exports.Errors=Y();X.exports.FileAttr=Le();X.exports.decoder=ge()});var _e=M(function(_t,Ne){var V=W(),I=V.Constants;Ne.exports=function(){var n=20,f=10,r=0,s=0,c=0,d=0,o=0,m=0,S=0,O=0,p=0,C=0,A=0,F=0,i=0;n|=V.isWin?2560:768,r|=I.FLG_EFS;let a={extraLen:0},u=(e)=>Math.max(0,e)>>>0,E=(e)=>Math.max(0,e)&65535,h=(e)=>Math.max(0,e)&255;return c=V.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return f},set version(e){f=e},get flags(){return r},set flags(e){r=e},get flags_efs(){return(r&I.FLG_EFS)>0},set flags_efs(e){if(e)r|=I.FLG_EFS;else r&=~I.FLG_EFS},get flags_desc(){return(r&I.FLG_DESC)>0},set flags_desc(e){if(e)r|=I.FLG_DESC;else r&=~I.FLG_DESC},get method(){return s},set method(e){switch(e){case I.STORED:this.version=10;break;case I.DEFLATED:default:this.version=20}s=e},get time(){return V.fromDOS2Date(this.timeval)},set time(e){e=new Date(e),this.timeval=V.fromDate2DOS(e)},get timeval(){return c},set timeval(e){c=u(e)},get timeHighByte(){return h(c>>>8)},get crc(){return d},set crc(e){d=u(e)},get compressedSize(){return o},set compressedSize(e){o=u(e)},get size(){return m},set size(e){m=u(e)},get fileNameLength(){return S},set fileNameLength(e){S=e},get extraLength(){return O},set extraLength(e){O=e},get extraLocalLength(){return a.extraLen},set extraLocalLength(e){a.extraLen=e},get commentLength(){return p},set commentLength(e){p=e},get diskNumStart(){return C},set diskNumStart(e){C=u(e)},get inAttr(){return A},set inAttr(e){A=u(e)},get attr(){return F},set attr(e){F=u(e)},get fileAttr(){return(F||0)>>16&511},get offset(){return i},set offset(e){i=u(e)},get encrypted(){return(r&I.FLG_ENC)===I.FLG_ENC},get centralHeaderSize(){return I.CENHDR+S+O+p},get realDataOffset(){return i+I.LOCHDR+a.fnameLen+a.extraLen},get localHeader(){return a},loadLocalHeaderFromBinary:function(e){if(i<0||i+I.LOCHDR>e.length)throw V.Errors.INVALID_LOC();var l=e.slice(i,i+I.LOCHDR);if(l.readUInt32LE(0)!==I.LOCSIG)throw V.Errors.INVALID_LOC();a.version=l.readUInt16LE(I.LOCVER),a.flags=l.readUInt16LE(I.LOCFLG),a.flags_desc=(a.flags&I.FLG_DESC)>0,a.method=l.readUInt16LE(I.LOCHOW),a.time=l.readUInt32LE(I.LOCTIM),a.crc=l.readUInt32LE(I.LOCCRC),a.compressedSize=l.readUInt32LE(I.LOCSIZ),a.size=l.readUInt32LE(I.LOCLEN),a.fnameLen=l.readUInt16LE(I.LOCNAM),a.extraLen=l.readUInt16LE(I.LOCEXT);let L=i+I.LOCHDR+a.fnameLen,g=L+a.extraLen;return e.slice(L,g)},loadFromBinary:function(e){if(e.length!==I.CENHDR||e.readUInt32LE(0)!==I.CENSIG)throw V.Errors.INVALID_CEN();n=e.readUInt16LE(I.CENVEM),f=e.readUInt16LE(I.CENVER),r=e.readUInt16LE(I.CENFLG),s=e.readUInt16LE(I.CENHOW),c=e.readUInt32LE(I.CENTIM),d=e.readUInt32LE(I.CENCRC),o=e.readUInt32LE(I.CENSIZ),m=e.readUInt32LE(I.CENLEN),S=e.readUInt16LE(I.CENNAM),O=e.readUInt16LE(I.CENEXT),p=e.readUInt16LE(I.CENCOM),C=e.readUInt16LE(I.CENDSK),A=e.readUInt16LE(I.CENATT),F=e.readUInt32LE(I.CENATX),i=e.readUInt32LE(I.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(I.LOCHDR);return e.writeUInt32LE(I.LOCSIG,0),e.writeUInt16LE(f,I.LOCVER),e.writeUInt16LE(r&~I.FLG_DESC,I.LOCFLG),e.writeUInt16LE(s,I.LOCHOW),e.writeUInt32LE(c,I.LOCTIM),e.writeUInt32LE(d,I.LOCCRC),e.writeUInt32LE(o,I.LOCSIZ),e.writeUInt32LE(m,I.LOCLEN),e.writeUInt16LE(S,I.LOCNAM),e.writeUInt16LE(a.extraLen,I.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(I.CENHDR+S+O+p);return e.writeUInt32LE(I.CENSIG,0),e.writeUInt16LE(n,I.CENVEM),e.writeUInt16LE(f,I.CENVER),e.writeUInt16LE(r&~I.FLG_DESC,I.CENFLG),e.writeUInt16LE(s,I.CENHOW),e.writeUInt32LE(c,I.CENTIM),e.writeUInt32LE(d,I.CENCRC),e.writeUInt32LE(o,I.CENSIZ),e.writeUInt32LE(m,I.CENLEN),e.writeUInt16LE(S,I.CENNAM),e.writeUInt16LE(O,I.CENEXT),e.writeUInt16LE(p,I.CENCOM),e.writeUInt16LE(C,I.CENDSK),e.writeUInt16LE(A,I.CENATT),e.writeUInt32LE(F,I.CENATX),e.writeUInt32LE(i,I.CENOFF),e},toJSON:function(){let e=function(l){return l+" bytes"};return{made:n,version:f,flags:r,method:V.methodToString(s),time:this.time,crc:"0x"+d.toString(16).toUpperCase(),compressedSize:e(o),size:e(m),fileNameLength:e(S),extraLength:e(O),commentLength:e(p),diskNumStart:C,inAttr:A,attr:F,offset:i,centralHeaderSize:e(I.CENHDR+S+O+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var pe=M(function(yt,ye){var G=W(),y=G.Constants;ye.exports=function(){var n=0,f=0,r=0,s=0,c=0;let d=()=>n>y.EF_ZIP64_OR_16||f>y.EF_ZIP64_OR_16||r>y.EF_ZIP64_OR_32||s>y.EF_ZIP64_OR_32;return{get diskEntries(){return n},set diskEntries(o){n=f=o},get totalEntries(){return f},set totalEntries(o){f=n=o},get size(){return r},set size(o){r=o},get offset(){return s},set offset(o){s=o},get commentLength(){return c},set commentLength(o){c=o},get mainHeaderSize(){return(d()?y.ZIP64HDR+y.END64HDR:0)+y.ENDHDR+c},loadFromBinary:function(o){if((o.length!==y.ENDHDR||o.readUInt32LE(0)!==y.ENDSIG)&&(o.length<y.ZIP64HDR||o.readUInt32LE(0)!==y.ZIP64SIG))throw G.Errors.INVALID_END();if(o.readUInt32LE(0)===y.ENDSIG)n=o.readUInt16LE(y.ENDSUB),f=o.readUInt16LE(y.ENDTOT),r=o.readUInt32LE(y.ENDSIZ),s=o.readUInt32LE(y.ENDOFF),c=o.readUInt16LE(y.ENDCOM);else n=G.readBigUInt64LE(o,y.ZIP64SUB),f=G.readBigUInt64LE(o,y.ZIP64TOT),r=G.readBigUInt64LE(o,y.ZIP64SIZB),s=G.readBigUInt64LE(o,y.ZIP64OFF),c=0},toBinary:function(){if(!d()){var o=Buffer.alloc(y.ENDHDR+c);return o.writeUInt32LE(y.ENDSIG,0),o.writeUInt32LE(0,4),o.writeUInt16LE(n,y.ENDSUB),o.writeUInt16LE(f,y.ENDTOT),o.writeUInt32LE(r,y.ENDSIZ),o.writeUInt32LE(s,y.ENDOFF),o.writeUInt16LE(c,y.ENDCOM),o.fill(" ",y.ENDHDR),o}var o=Buffer.alloc(this.mainHeaderSize);let m=0;o.writeUInt32LE(y.ZIP64SIG,m),G.writeBigUInt64LE(o,y.ZIP64HDR-y.ZIP64LEAD,m+y.ZIP64SIZE),o.writeUInt16LE(45,m+y.ZIP64VEM),o.writeUInt16LE(45,m+y.ZIP64VER),o.writeUInt32LE(0,m+y.ZIP64DSK),o.writeUInt32LE(0,m+y.ZIP64DSKDIR),G.writeBigUInt64LE(o,n,m+y.ZIP64SUB),G.writeBigUInt64LE(o,f,m+y.ZIP64TOT),G.writeBigUInt64LE(o,r,m+y.ZIP64SIZB),G.writeBigUInt64LE(o,s,m+y.ZIP64OFF);let S=s+r;return m+=y.ZIP64HDR,o.writeUInt32LE(y.END64SIG,m),o.writeUInt32LE(0,m+y.END64START),G.writeBigUInt64LE(o,S,m+y.END64OFF),o.writeUInt32LE(1,m+y.END64NUMDISKS),m+=y.END64HDR,o.writeUInt32LE(y.ENDSIG,m),o.writeUInt32LE(0,m+4),o.writeUInt16LE(Math.min(n,y.EF_ZIP64_OR_16),m+y.ENDSUB),o.writeUInt16LE(Math.min(f,y.EF_ZIP64_OR_16),m+y.ENDTOT),o.writeUInt32LE(Math.min(r,y.EF_ZIP64_OR_32),m+y.ENDSIZ),o.writeUInt32LE(Math.min(s,y.EF_ZIP64_OR_32),m+y.ENDOFF),o.writeUInt16LE(c,m+y.ENDCOM),o.fill(" ",m+y.ENDHDR),o},toJSON:function(){let o=function(m,S){let O=m.toString(16).toUpperCase();while(O.length<S)O="0"+O;return"0x"+O};return{diskEntries:n,totalEntries:f,size:r+" bytes",offset:o(s,4),commentLength:c}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var re=M(function(Xe){Xe.EntryHeader=_e();Xe.MainHeader=pe()});var Se=M(function(Ct,Ce){Ce.exports=function(n){var f=wt("zlib"),r={chunkSize:(parseInt(n.length/1024)+1)*1024};return{deflate:function(){return f.deflateRawSync(n,r)},deflateAsync:function(s){var c=f.createDeflateRaw(r),d=[],o=0;c.on("data",function(m){d.push(m),o+=m.length}),c.on("end",function(){var m=Buffer.alloc(o),S=0;m.fill(0);for(var O=0;O<d.length;O++){var p=d[O];p.copy(m,S),S+=p.length}s&&s(m)}),c.end(n)}}}});var Te=M(function(St,Ae){var Ye=+(process?.versions?.node??"").split(".")[0]||0,Oe=Y();Ae.exports=function(n,f){var r=wt("zlib");let s=f>0?f:1,c=Ye>=15?{maxOutputLength:s}:{};return{inflate:function(){return r.inflateRawSync(n,c)},inflateAsync:function(d){var o=r.createInflateRaw(c),m=[],S=0,O=!1;let p=function(C){if(O)return;O=!0,o.destroy(),d&&d(Buffer.alloc(0),C)};o.on("error",function(C){p(C)}),o.on("data",function(C){if(O)return;if(S+=C.length,S>s)return p(Oe.MAX_OUTPUT_EXCEEDED());m.push(C)}),o.on("end",function(){if(O)return;O=!0;var C=Buffer.alloc(S),A=0;C.fill(0);for(var F=0;F<m.length;F++){var i=m[F];i.copy(C,A),A+=i.length}d&&d(C)}),o.end(n)}}}});var Be=M(function(Ot,Ue){var{randomFillSync:Fe}=wt("crypto"),xe=Y(),Je=new Uint32Array(256).map((n,f)=>{for(let r=0;r<8;r++)if((f&1)!==0)f=f>>>1^3988292384;else f>>>=1;return f>>>0}),we=(n,f)=>Math.imul(n,f)>>>0,Re=(n,f)=>Je[(n^f)&255]^n>>>8,J=()=>{if(typeof Fe==="function")return Fe(Buffer.alloc(12));else return J.node()};J.node=()=>{let n=Buffer.alloc(12),f=n.length;for(let r=0;r<f;r++)n[r]=Math.random()*256&255;return n};var ee={genSalt:J};function te(n){let f=Buffer.isBuffer(n)?n:Buffer.from(n);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<f.length;r++)this.updateKeys(f[r])}te.prototype.updateKeys=function(n){let f=this.keys;return f[0]=Re(f[0],n),f[1]+=f[0]&255,f[1]=we(f[1],134775813)+1,f[2]=Re(f[2],f[1]>>>24),n};te.prototype.next=function(){let n=(this.keys[2]|2)>>>0;return we(n,n^1)>>8&255};function $e(n){let f=new te(n);return function(r){let s=Buffer.alloc(r.length),c=0;for(let d of r)s[c++]=f.updateKeys(d^f.next());return s}}function ke(n){let f=new te(n);return function(r,s,c=0){if(!s)s=Buffer.alloc(r.length);for(let d of r){let o=f.next();s[c++]=d^o,f.updateKeys(d)}return s}}function Qe(n,f,r){if(!n||!Buffer.isBuffer(n)||n.length<12)return Buffer.alloc(0);let s=$e(r),c=s(n.slice(0,12)),d=(f.flags&8)===8?f.timeHighByte:f.crc>>>24;if(c[11]!==d)throw xe.WRONG_PASSWORD();return s(n.slice(12))}function et(n){if(Buffer.isBuffer(n)&&n.length>=12)ee.genSalt=function(){return n.slice(0,12)};else if(n==="node")ee.genSalt=J.node;else ee.genSalt=J}function tt(n,f,r,s=!1){if(n==null)n=Buffer.alloc(0);if(!Buffer.isBuffer(n))n=Buffer.from(n.toString());let c=ke(r),d=ee.genSalt();if(d[11]=f.crc>>>24&255,s)d[10]=f.crc>>>16&255;let o=Buffer.alloc(n.length+12);return c(d,o),c(n,o,12)}Ue.exports={decrypt:Qe,encrypt:tt,_salter:et}});var Ze=M(function(nt){nt.Deflater=Se();nt.Inflater=Te();nt.ZipCrypto=Be()});var ie=M(function(Tt,ve){var Z=W(),st=re(),z=Z.Constants,oe=Ze();ve.exports=function(n,f){var r=new st.EntryHeader,s=Buffer.alloc(0),c=Buffer.alloc(0),d=!1,o=null,m=Buffer.alloc(0),S=Buffer.alloc(0),O=!0;let p=n,C=typeof p.decoder==="object"?p.decoder:Z.decoder;O=C.hasOwnProperty("efs")?C.efs:!1;function A(){if(!f||!(f instanceof Uint8Array))return Buffer.alloc(0);S=r.loadLocalHeaderFromBinary(f);let e=r.realDataOffset,l=e+r.compressedSize;if(e<0||l<e||l>f.length)throw Z.Errors.INVALID_LOC();return f.slice(e,l)}function F(e){let l=r.flags_desc||r.localHeader.flags_desc?r.crc:r.localHeader.crc;return Z.crc32(e)===l}function i(e,l,L){if(typeof l>"u"&&typeof e==="string")L=e,e=void 0;if(d){if(e&&l)l(Buffer.alloc(0),Z.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var g;try{if(g=A(),g.length===0){if(e&&l)l(g);return g}if(r.encrypted){if(typeof L!=="string"&&!Buffer.isBuffer(L))throw Z.Errors.INVALID_PASS_PARAM();g=oe.ZipCrypto.decrypt(g,r,L)}}catch(R){if(e&&l)return l(Buffer.alloc(0),R),Buffer.alloc(0);throw R}var D;switch(r.method){case Z.Constants.STORED:if(D=Buffer.alloc(g.length),g.copy(D),!F(D)){if(e&&l)l(D,Z.Errors.BAD_CRC());throw Z.Errors.BAD_CRC()}else{if(e&&l)l(D);return D}case Z.Constants.DEFLATED:var N=new oe.Inflater(g,r.size);if(!e){if(D=N.inflate(),!F(D))throw Z.Errors.BAD_CRC(`"${C.decode(s)}"`);return D}else N.inflateAsync(function(R,w){if(!l)return;if(w)l(Buffer.alloc(0),w);else if(!F(R))l(R,Z.Errors.BAD_CRC());else l(R)});break;default:if(e&&l)l(Buffer.alloc(0),Z.Errors.UNKNOWN_METHOD());throw Z.Errors.UNKNOWN_METHOD()}}function a(e,l){if((!o||!o.length)&&Buffer.isBuffer(f)){if(e&&l)l(A());return A()}if(o.length&&!d){var L;switch(r.method){case Z.Constants.STORED:if(r.compressedSize=r.size,L=Buffer.alloc(o.length),o.copy(L),e&&l)l(L);return L;default:case Z.Constants.DEFLATED:var g=new oe.Deflater(o);if(!e){var D=g.deflate();return r.compressedSize=D.length,D}else g.deflateAsync(function(N){L=Buffer.alloc(N.length),r.compressedSize=N.length,N.copy(L),l&&l(L)});g=null;break}}else if(e&&l)l(Buffer.alloc(0));else return Buffer.alloc(0)}function u(e,l){return Z.readBigUInt64LE(e,l)}function E(e){try{var l=0,L,g,D;while(l+4<e.length)if(L=e.readUInt16LE(l),l+=2,g=e.readUInt16LE(l),l+=2,D=e.slice(l,l+g),l+=g,z.ID_ZIP64===L)h(D)}catch(N){throw Z.Errors.EXTRA_FIELD_PARSE_ERROR()}}function h(e){var l,L,g,D;if(e.length>=z.EF_ZIP64_SCOMP){if(l=u(e,z.EF_ZIP64_SUNCOMP),r.size===z.EF_ZIP64_OR_32)r.size=l}if(e.length>=z.EF_ZIP64_RHO){if(L=u(e,z.EF_ZIP64_SCOMP),r.compressedSize===z.EF_ZIP64_OR_32)r.compressedSize=L}if(e.length>=z.EF_ZIP64_DSN){if(g=u(e,z.EF_ZIP64_RHO),r.offset===z.EF_ZIP64_OR_32)r.offset=g}if(e.length>=z.EF_ZIP64_DSN+4){if(D=e.readUInt32LE(z.EF_ZIP64_DSN),r.diskNumStart===z.EF_ZIP64_OR_16)r.diskNumStart=D}}return{get entryName(){return C.decode(s)},get rawEntryName(){return s},set entryName(e){s=Z.toBuffer(e,C.encode);var l=s[s.length-1];d=l===47||l===92,r.fileNameLength=s.length},get efs(){if(typeof O==="function")return O(this.entryName);else return O},get extra(){return m},set extra(e){m=e,r.extraLength=e.length,E(e)},get comment(){return C.decode(c)},set comment(e){if(c=Z.toBuffer(e,C.encode),r.commentLength=c.length,c.length>65535)throw Z.Errors.COMMENT_TOO_LONG()},get name(){let e=C.decode(s);return d?e.replace(/[/\\]$/,"").split("/").pop():e.split("/").pop()},get isDirectory(){return d},getCompressedData:function(){return a(!1,null)},getCompressedDataAsync:function(e){a(!0,e)},setData:function(e){if(o=Z.toBuffer(e,Z.decoder.encode),!d&&o.length)r.size=o.length,r.method=Z.Constants.DEFLATED,r.crc=Z.crc32(e),r.changed=!0;else r.method=Z.Constants.STORED},getData:function(e){if(r.changed)return o;else return i(!1,null,e)},getDataAsync:function(e,l){if(r.changed)e(o);else i(!0,e,l)},set attr(e){r.attr=e},get attr(){return r.attr},set header(e){r.loadFromBinary(e)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=m.length;var e=r.centralHeaderToBinary(),l=Z.Constants.CENHDR;return s.copy(e,l),l+=s.length,m.copy(e,l),l+=r.extraLength,c.copy(e,l),e},packLocalHeader:function(){let e=0;r.flags_efs=this.efs,r.extraLocalLength=S.length;let l=r.localHeaderToBinary(),L=Buffer.alloc(l.length+s.length+r.extraLocalLength);return l.copy(L,e),e+=l.length,s.copy(L,e),e+=s.length,S.copy(L,e),e+=S.length,L},toJSON:function(){let e=function(l){return"<"+(l&&l.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:e(f),data:e(o)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var ze=M(function(Ft,Me){var Pe=ie(),He=re(),U=W();Me.exports=function(n,f){var r=[],s=Object.create(null),c=Buffer.alloc(0),d=new He.MainHeader,o=!1,m=null;let S=new Set,O=f,{noSort:p,decoder:C}=O;if(n)i(O.readEntries);else o=!0;function A(){let u=new Set;for(let E of Object.keys(s)){let h=E.split("/");if(h.pop(),!h.length)continue;for(let e=0;e<h.length;e++){let l=h.slice(0,e+1).join("/")+"/";u.add(l)}}for(let E of u)if(!(E in s)){let h=new Pe(O);h.entryName=E,h.attr=16,h.temporary=!0,r.push(h),s[h.entryName]=h,S.add(h)}}function F(){if(o=!0,s=Object.create(null),d.diskEntries>(n.length-d.offset)/U.Constants.CENHDR)throw U.Errors.DISK_ENTRY_TOO_LARGE();r=Array(d.diskEntries);var u=d.offset;for(var E=0;E<r.length;E++){var h=u,e=new Pe(O,n);if(e.header=n.slice(h,h+=U.Constants.CENHDR),e.entryName=n.slice(h,h+=e.header.fileNameLength),e.header.extraLength)e.extra=n.slice(h,h+=e.header.extraLength);if(e.header.commentLength)e.comment=n.slice(h,h+e.header.commentLength);if(u+=e.header.centralHeaderSize,e.entryName in s)throw U.Errors.DUPLICATE_ENTRY(`"${e.entryName}"`);r[E]=e,s[e.entryName]=e}S.clear(),A()}function i(u){var E=n.length-U.Constants.ENDHDR,h=Math.max(0,E-65535),e=h,l=n.length,L=-1,g=0;if(typeof O.trailingSpace==="boolean"?O.trailingSpace:!1)h=0;for(E;E>=e;E--){if(n[E]!==80)continue;if(n.readUInt32LE(E)===U.Constants.ENDSIG){L=E,g=E,l=E+U.Constants.ENDHDR,e=E-U.Constants.END64HDR;continue}if(n.readUInt32LE(E)===U.Constants.END64SIG){e=h;continue}if(n.readUInt32LE(E)===U.Constants.ZIP64SIG){L=E,l=E+U.readBigUInt64LE(n,E+U.Constants.ZIP64SIZE)+U.Constants.ZIP64LEAD;break}}if(L==-1)throw U.Errors.INVALID_FORMAT();if(d.loadFromBinary(n.slice(L,l)),d.commentLength)c=n.slice(g+U.Constants.ENDHDR);if(u)F()}function a(){if(r.length>1&&!p)r=r.map((u)=>({entry:u,key:u.entryName.toLowerCase()})).sort((u,E)=>u.key.localeCompare(E.key)).map((u)=>u.entry)}return{get entries(){if(!o)F();return r.filter((u)=>!S.has(u))},get comment(){return C.decode(c)},set comment(u){c=U.toBuffer(u,C.encode),d.commentLength=c.length},getEntryCount:function(){if(!o)return d.diskEntries;return r.length},forEach:function(u){this.entries.forEach(u)},getEntry:function(u){if(!o)F();return s[u]||null},setEntry:function(u){if(!o)F();r.push(u),s[u.entryName]=u,d.totalEntries=r.length},deleteFile:function(u,E=!0){if(!o)F();let h=s[u];this.getEntryChildren(h,E).map((l)=>l.entryName).forEach(this.deleteEntry)},deleteEntry:function(u){if(!o)F();let E=s[u],h=r.indexOf(E);if(h>=0)r.splice(h,1),delete s[u],d.totalEntries=r.length},getEntryChildren:function(u,E=!0){if(!o)F();if(typeof u==="object")if(u.isDirectory&&E){let h=[],e=u.entryName;for(let l of r)if(l.entryName.startsWith(e))h.push(l);return h}else return[u];return[]},getChildCount:function(u){if(u&&u.isDirectory){let E=this.getEntryChildren(u);return E.includes(u)?E.length-1:E.length}return 0},compressToBuffer:function(){if(!o)F();a();let u=[],E=[],h=0,e=0;d.size=0,d.offset=0;let l=0;for(let D of this.entries){let N=D.getCompressedData();D.header.offset=e;let R=D.packLocalHeader(),w=R.length+N.length;e+=w,u.push(R),u.push(N);let B=D.packCentralHeader();E.push(B),d.size+=B.length,h+=w+B.length,l++}h+=d.mainHeaderSize,d.offset=e,d.totalEntries=l,e=0;let L=Buffer.alloc(h);for(let D of u)D.copy(L,e),e+=D.length;for(let D of E)D.copy(L,e),e+=D.length;let g=d.toBinary();if(c)c.copy(g,g.length-c.length);return g.copy(L,e),n=L,o=!1,L},toAsyncBuffer:function(u,E,h,e){try{if(!o)F();a();let l=[],L=[],g=0,D=0,N=0;d.size=0,d.offset=0;let R=function(w){if(w.length>0){let B=w.shift(),P=B.entryName+B.extra.toString();if(h)h(P);B.getCompressedDataAsync(function(H){if(e)e(P);B.header.offset=D;let j=B.packLocalHeader(),k=j.length+H.length;D+=k,l.push(j),l.push(H);let K=B.packCentralHeader();L.push(K),d.size+=K.length,g+=k+K.length,N++,R(w)})}else{g+=d.mainHeaderSize,d.offset=D,d.totalEntries=N,D=0;let B=Buffer.alloc(g);l.forEach(function(H){H.copy(B,D),D+=H.length}),L.forEach(function(H){H.copy(B,D),D+=H.length});let P=d.toBinary();if(c)c.copy(P,P.length-c.length);P.copy(B,D),n=B,o=!1,u(B)}};R(Array.from(this.entries))}catch(l){E(l)}}}}});var Id=M(function(Rt,Ve){var x=W(),T=wt("path"),ft=ie(),ct=ze(),q=(...n)=>x.findLast(n,(f)=>typeof f==="boolean"),Ge=(...n)=>x.findLast(n,(f)=>typeof f==="string"),at=(...n)=>x.findLast(n,(f)=>typeof f==="function"),ut={noSort:!1,readEntries:!1,method:x.Constants.NONE,fs:null};Ve.exports=function(n,f){let r=null,s=Object.assign(Object.create(null),ut);if(n&&typeof n==="object"){if(!(n instanceof Uint8Array)){if(Object.assign(s,n),n=s.input?s.input:void 0,s.input)delete s.input}if(Buffer.isBuffer(n))r=n,s.method=x.Constants.BUFFER,n=void 0}Object.assign(s,f);let c=new x(s),d=(i)=>{i.filter((a)=>a.attr).sort((a,u)=>u.path.length-a.path.length).forEach((a)=>c.fs.chmodSync(a.path,a.attr))};if(typeof s.decoder!=="object"||typeof s.decoder.encode!=="function"||typeof s.decoder.decode!=="function")s.decoder=x.decoder;if(n&&typeof n==="string")if(c.fs.existsSync(n))s.method=x.Constants.FILE,s.filename=n,r=c.fs.readFileSync(n);else throw x.Errors.INVALID_FILENAME();let o=new ct(r,s),{canonical:m,sanitize:S,zipnamefix:O}=x;function p(i){if(i&&o){var a;if(typeof i==="string")a=o.getEntry(T.posix.normalize(i));if(typeof i==="object"&&typeof i.entryName<"u"&&typeof i.header<"u")a=o.getEntry(i.entryName);if(a)return a}return null}function C(i){let{join:a,normalize:u,sep:E}=T.posix;return a(T.isAbsolute(i)?"/":".",u(E+i.split("\\").join(E)+E))}function A(i){if(i instanceof RegExp)return function(a){return function(u){return a.test(u)}}(i);else if(typeof i!=="function")return()=>!0;return i}let F=(i,a)=>{let u=a.slice(-1);return u=u===c.sep?c.sep:"",T.relative(i,a)+u};return{readFile:function(i,a){var u=p(i);return u&&u.getData(a)||null},childCount:function(i){let a=p(i);if(a)return o.getChildCount(a)},readFileAsync:function(i,a){var u=p(i);if(u)u.getDataAsync(a);else a(null,"getEntry failed for:"+i)},readAsText:function(i,a){var u=p(i);if(u){var E=u.getData();if(E&&E.length)return E.toString(a||"utf8")}return""},readAsTextAsync:function(i,a,u){var E=p(i);if(E)E.getDataAsync(function(h,e){if(e){a(h,e);return}if(h&&h.length)a(h.toString(u||"utf8"));else a("")});else a("")},deleteFile:function(i,a=!0){var u=p(i);if(u)o.deleteFile(u.entryName,a)},deleteEntry:function(i){var a=p(i);if(a)o.deleteEntry(a.entryName)},addZipComment:function(i){o.comment=i},getZipComment:function(){return o.comment||""},addZipEntryComment:function(i,a){var u=p(i);if(u)u.comment=a},getZipEntryComment:function(i){var a=p(i);if(a)return a.comment||"";return""},updateFile:function(i,a){var u=p(i);if(u)u.setData(a)},addLocalFile:function(i,a,u,E){if(c.fs.existsSync(i)){a=a?C(a):"";let h=T.win32.basename(T.win32.normalize(i));a+=u?u:h;let e=c.fs.statSync(i),l=e.isFile()?c.fs.readFileSync(i):Buffer.alloc(0);if(e.isDirectory())a+=c.sep;this.addFile(a,l,E,e)}else throw x.Errors.FILE_NOT_FOUND(i)},addLocalFileAsync:function(i,a){i=typeof i==="object"?i:{localPath:i};let u=T.resolve(i.localPath),{comment:E}=i,{zipPath:h,zipName:e}=i,l=this;c.fs.stat(u,function(L,g){if(L)return a(L,!1);h=h?C(h):"";let D=T.win32.basename(T.win32.normalize(u));if(h+=e?e:D,g.isFile())c.fs.readFile(u,function(N,R){if(N)return a(N,!1);return l.addFile(h,R,E,g),setImmediate(a,void 0,!0)});else if(g.isDirectory())return h+=c.sep,l.addFile(h,Buffer.alloc(0),E,g),setImmediate(a,void 0,!0)})},addLocalFolder:function(i,a,u){if(u=A(u),a=a?C(a):"",i=T.normalize(i),c.fs.existsSync(i)){let E=c.findFiles(i),h=this;if(E.length)for(let e of E){let l=T.join(a,F(i,e));if(u(l))h.addLocalFile(e,T.dirname(l))}}else throw x.Errors.FILE_NOT_FOUND(i)},addLocalFolderAsync:function(i,a,u,E){E=A(E),u=u?C(u):"",i=T.normalize(i);var h=this;c.fs.open(i,"r",function(e){if(e&&e.code==="ENOENT")a(void 0,x.Errors.FILE_NOT_FOUND(i));else if(e)a(void 0,e);else{var l=c.findFiles(i),L=-1,g=function(){if(L+=1,L<l.length){var D=l[L],N=F(i,D).split("\\").join("/");if(N=N.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),E(N))c.fs.stat(D,function(R,w){if(R)a(void 0,R);if(w.isFile())c.fs.readFile(D,function(B,P){if(B)a(void 0,B);else h.addFile(u+N,P,"",w),g()});else h.addFile(u+N+"/",Buffer.alloc(0),"",w),g()});else process.nextTick(()=>{g()})}else a(!0,void 0)};g()}})},addLocalFolderAsync2:function(i,a){let u=this;i=typeof i==="object"?i:{localPath:i};let E=T.resolve(i.localPath),{zipPath:h,filter:e,namefix:l}=i;if(e instanceof RegExp)e=function(D){return function(N){return D.test(N)}}(e);else if(typeof e!=="function")e=function(){return!0};if(h=h?C(h):"",l==="latin1")l=(D)=>D.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof l!=="function")l=(D)=>D;let L=(D)=>T.join(h,l(F(E,D))),g=(D)=>T.win32.basename(T.win32.normalize(l(D)));c.fs.open(E,"r",function(D){if(D&&D.code==="ENOENT")a(x.Errors.FILE_NOT_FOUND(E),!1);else if(D)a(D,!1);else c.findFilesAsync(E,function(N,R){if(N)return a(N,!1);if(R=R.filter((w)=>e(L(w))),!R.length)return a(void 0,!0);setImmediate(R.reverse().reduce(function(w,B){return function(P,H){if(P||H===!1)return setImmediate(w,P,!1);u.addLocalFileAsync({localPath:B,zipPath:T.dirname(L(B)),zipName:g(B)},w)}},a))})})},addLocalFolderPromise:function(i,a){return new Promise((u,E)=>{this.addLocalFolderAsync2(Object.assign({localPath:i},a),(h,e)=>{if(h)return E(h);if(e)u(this)})})},addFile:function(i,a,u,E){i=O(i);let h=p(i),e=h!=null;if(!e)h=new ft(s),h.entryName=i;h.comment=u||"";let l=typeof E==="object"&&E instanceof c.fs.Stats;if(l)h.header.time=E.mtime;var L=h.isDirectory?16:0;let g=h.isDirectory?16384:32768;if(l)g|=4095&E.mode;else if(typeof E==="number")g|=4095&E;else g|=h.isDirectory?493:420;if(L=(L|g<<16)>>>0,h.attr=L,h.setData(a),!e)o.setEntry(h);return h},getEntries:function(i){return o.password=i,o?o.entries:[]},getEntry:function(i){return p(i)},getEntryCount:function(){return o.getEntryCount()},forEach:function(i){return o.forEach(i)},extractEntryTo:function(i,a,u,E,h,e){E=q(!1,E),h=q(!1,h),u=q(!0,u),e=Ge(h,e);var l=p(i);if(!l)throw x.Errors.NO_ENTRY();var L=m(l.entryName),g=S(a,e&&!l.isDirectory?m(e):u?L:T.basename(L));if(l.isDirectory){var D=o.getEntryChildren(l);return D.forEach(function(w){if(w.isDirectory)return;var B=w.getData();if(!B)throw x.Errors.CANT_EXTRACT_FILE();var P=m(u?w.entryName:w.entryName.substring(l.entryName.length)),H=S(a,P);c.assertPathSafe(a,H);let j=h?w.header.fileAttr:void 0;c.writeFileTo(H,B,E,j)}),!0}var N=l.getData(o.password);if(!N)throw x.Errors.CANT_EXTRACT_FILE();if(c.assertPathSafe(a,g),c.fs.existsSync(g)&&!E)throw x.Errors.CANT_OVERRIDE();let R=h?i.header.fileAttr:void 0;return c.writeFileTo(g,N,E,R),!0},test:function(i){if(!o)return!1;for(var a of o.entries)try{if(a.isDirectory)continue;var u=a.getData(i);if(!u)return!1}catch(E){return!1}return!0},extractAllTo:function(i,a,u,E){if(u=q(!1,u),E=Ge(u,E),a=q(!1,a),!o)throw x.Errors.NO_ZIP();let h=[];o.entries.forEach(function(e){var l=S(i,m(e.entryName));if(c.assertPathSafe(i,l),e.isDirectory){if(c.makeDir(l),u)h.push({path:l,attr:e.header.fileAttr});return}var L=e.getData(E);if(!L)throw x.Errors.CANT_EXTRACT_FILE();let g=u?e.header.fileAttr:void 0;c.writeFileTo(l,L,a,g);try{c.fs.utimesSync(l,e.header.time,e.header.time)}catch(D){}}),d(h)},extractAllToAsync:function(i,a,u,E){if(E=at(a,u,E),u=q(!1,u),a=q(!1,a),!E)return new Promise((N,R)=>{this.extractAllToAsync(i,a,u,function(w){if(w)R(w);else N(this)})});if(!o){E(x.Errors.NO_ZIP());return}i=T.resolve(i);let h=(N)=>S(i,T.normalize(m(N.entryName))),e=(N,R)=>Error(N+': "'+R+'"'),l=[],L=[];o.entries.forEach((N)=>{if(N.isDirectory)l.push(N);else L.push(N)});let g=[];for(let N of l){let R=h(N),w=u?N.header.fileAttr:void 0;try{c.assertPathSafe(i,R),c.makeDir(R)}catch(B){E(e("Unable to create folder",R));continue}if(w)g.push({path:R,attr:w});try{c.fs.utimesSync(R,N.header.time,N.header.time)}catch(B){}}let D=(N)=>{if(!N)try{d(g)}catch(R){return E(e("Unable to set folder permissions",R.path||""))}E(N)};L.reverse().reduce(function(N,R){return function(w){if(w)N(w);else{let B=T.normalize(m(R.entryName)),P=S(i,B);try{c.assertPathSafe(i,P)}catch(H){return N(H)}R.getDataAsync(function(H,j){if(j)N(j);else if(!H)N(x.Errors.CANT_EXTRACT_FILE());else{let k=u?R.header.fileAttr:void 0;c.writeFileToAsync(P,H,a,k,function(K){if(!K)return N(e("Unable to write file",P));c.fs.utimes(P,R.header.time,R.header.time,function(){N()})})}})}}},D)()},writeZip:function(i,a){if(arguments.length===1){if(typeof i==="function")a=i,i=""}if(!i&&s.filename)i=s.filename;if(!i)return;var u=o.compressToBuffer();if(u){var E=c.writeFileTo(i,u,!0);if(typeof a==="function")a(!E?Error("failed"):null,"")}},writeZipPromise:function(i,a){let{overwrite:u,perm:E}=Object.assign({overwrite:!0},a);return new Promise((h,e)=>{if(!i&&s.filename)i=s.filename;if(!i)e("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((l)=>{let L=(g)=>g?h(g):e("ADM-ZIP: Wasn't able to write zip file");c.writeFileToAsync(i,l,u,E,L)},e)})},toBufferPromise:function(){return new Promise((i,a)=>{o.toAsyncBuffer(i,a)})},toBuffer:function(i,a,u,E){if(typeof i==="function")return o.toAsyncBuffer(i,a,u,E),null;return o.compressToBuffer()}}}});import*as fe from"path";import*as se from"path";function Nc(n,f,r={}){let s=r.paths??se,c=s.resolve(n),d=s.resolve(c,f),o=s.relative(c,d);if(o==="")return r.allowEqual??!0;return!(o===".."||o.startsWith(`..${s.sep}`)||s.isAbsolute(o))}function pae(n,f,r,s={}){if(!Nc(n,f,s))throw r();let c=s.paths??se;return c.resolve(c.resolve(n),f)}function fU(n,f,r="CtrlProxy bundle"){let s=fe.resolve(f);for(let c of n.getEntries())if(!Nc(s,c.entryName))throw new t(`Refusing to extract ${r}: entry "${c.entryName}" resolves outside the extraction directory ${s} (zip-slip / path traversal).`)}
|
|
3
|
+
export{Id,Nc,pae,fU};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=BA25EC09B3A1132664756E2164756E21
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,l,e}from"./chunk-z637nqg8.js";import{wte,MC,Rte,al}from"./chunk-0qsy1qsx.js";import{B}from"./chunk-yf7ympyz.js";import{R,v,st,ja,E}from"./chunk-r5bxavdx.js";import{pn,Cn}from"./chunk-5d2hft6c.js";import{Qc}from"./chunk-ycaj2sgf.js";import{jS}from"./chunk-00167wan.js";import{BG}from"./chunk-g7tmjbkt.js";import{Gf,Qp}from"./chunk-w5b2jwk3.js";import{Na,eg}from"./chunk-rvvy1bte.js";import{r,t,u}from"./chunk-rbpdk7m0.js";var M1=2,KE=100,Bf=200,FP=1,GE=5000,LG=3000,$f=20000,qe=50;function cX(n,o,s){let a=[];for(let[d,c]of n.points.entries()){let p=Qc({x:c.x,y:c.y,coordinateSpace:n.coordinateSpace},o,s,"dragPath");if("error"in p)return{error:`points[${d}]: ${p.error}`};a.push({x:p.x,y:p.y})}return{points:a}}function dX(n,o){if(n.length<M1)throw new t(`dragPath needs at least ${M1} points`);let s=o.holdMs??0,a=o.releaseHoldMs??0,d=[],c=0;for(let p=1;p<n.length;p++){let h=n[p-1],m=n[p],f=o.points[p]?.durationMs??Bf,y=Math.max(1,Math.ceil(f/qe));for(let S=1;S<=y;S++){let g=S/y;d.push({atMs:c+Math.round(f*g),x:S===y?m.x:Math.round(h.x+(m.x-h.x)*g),y:S===y?m.y:Math.round(h.y+(m.y-h.y)*g)})}c+=f}return{start:n[0],holdMs:s,moves:d,releaseHoldMs:a,totalMs:s+c+a,vertices:n}}function lX(n){let o=[{x:n.start.x,y:n.start.y,offsetMs:0}];if(n.holdMs>0)o.push({x:n.start.x,y:n.start.y,offsetMs:n.holdMs});for(let a of n.moves)o.push({x:a.x,y:a.y,offsetMs:n.holdMs+a.atMs});let s=o[o.length-1];if(n.releaseHoldMs>0)o.push({x:s.x,y:s.y,offsetMs:s.offsetMs+n.releaseHoldMs});return o}function LM(n,o,s=0){if(n>$f)throw new t(`dragPath total duration ${n} ms exceeds the ${$f} ms limit; shorten the segments or holds. No input was sent.`);if(o===void 0)return;let a=n+s+ja;if(a>o)throw new t(`dragPath duration ${n} ms does not fit the remaining request budget (${o} ms; needs ${a} ms including dispatch headroom); no input was sent. Increase the request timeout or shorten the path.`)}function C(n){if(n.toolType!=="stylus"&&n.toolType!=="eraser")return;let o={toolType:n.toolType};if(n.pressure?.normalized)o.pressure=Math.round(n.pressure.mean*1e4)/1e4;if(n.tilt!==void 0)o.tilt=n.tilt;if(n.buttons?.length)o.buttons=n.buttons.map((s)=>s==="stylusPrimary"?"primary":"secondary");return o}var A={TOUCH_SLOP_DP:8,STROKE_PRESSURE_RANGE:0.05,PEN_MAX_SAMPLES:100,LONG_PRESS_MS:400,TAP_TIMEOUT_MS:100,DOUBLE_TAP_MS:300,DOUBLE_TAP_SLOP_DP:100,FLING_MIN_DP_PER_S:50,PINCH_MIN_SCALE_DELTA:0.1};function b(n){return Boolean(n.unknownAxes?.length)}function Je(n,o){return n.type==="tap"&&n.toolType===o.toolType&&!b(n)&&n.screenX!==void 0&&n.screenY!==void 0}function fe(n,o){if(!Je(n,o))return!1;let s=o.arrivedAt-n.arrivedAt,a=s>=0&&s<=A.DOUBLE_TAP_MS;if(o.firstTapArrivedAt!==void 0)return n.arrivedAt===o.firstTapArrivedAt&&a;let d=(o.screenX??1/0)-(n.screenX??1/0),c=(o.screenY??1/0)-(n.screenY??1/0);return a&&Math.hypot(d,c)<=A.DOUBLE_TAP_SLOP_DP}function ye(n,o){return n.kernelAtMs!==void 0&&o.kernelAtMs!==void 0?n.kernelAtMs-o.kernelAtMs:n.arrivedAt-o.arrivedAt}function X(n){let o=n.type==="stroke"?n.path:n.hover;if(n.type!=="stroke"&&n.type!=="hover"||n.toolType!=="stylus"||b(n)||!o||o.length<2)return!1;return o.reduce((a,d,c)=>a+(c>0?ye(d,o[c-1]):0),0)>$f}function ge(n){let o=n.type==="stroke"?n.path:n.hover;if(n.toolType!=="stylus"||b(n)||!o?.length||n.type==="stroke"&&o.length<2||X(n))return null;let s=et(o);return{tool:n.type==="stroke"?"dragPath":"hoverAt",params:{points:s,...n.type==="hover"?{toolType:"stylus"}:{pointer:C(n)}}}}function Ze(n,o,s){let a=Math.ceil(s/GE);return Array.from({length:a},(d,c)=>{let p=(c+1)/a,h={...o,x:n.x+(o.x-n.x)*p,y:n.y+(o.y-n.y)*p,durationMs:Math.round(s*p)-Math.round(s*c/a)};for(let m of["pressure","distance"])if(n[m]!==void 0&&o[m]!==void 0)h[m]=n[m]+(o[m]-n[m])*p;return c===a-1?{...o,durationMs:h.durationMs}:h})}function Qe(n){while(n.length>KE){let o=(p)=>p.pressure??p.distance??0,s=n.reduce((p,h,m)=>o(h)<o(n[p])?m:p,0),a=n.reduce((p,h,m)=>o(h)>o(n[p])?m:p,0),d=1/0,c=1;for(let p=1;p<n.length-1;p++){let h=n[p].durationMs+n[p+1].durationMs;if(p!==s&&p!==a&&h<d)d=h,c=p}n[c+1].durationMs=d,n.splice(c,1)}}function et(n){let o=[],s=0,a=0;for(let[d,c]of n.entries()){let{arrivedAt:p,kernelAtMs:h,...m}=c;if(d===0){o.push(m);continue}s+=Math.max(0,ye({arrivedAt:p,kernelAtMs:h},n[d-1]));let f=Math.round(s),y=f-a;if(y<FP){if(d!==n.length-1)continue;if(o.length===1)o.push({...m,durationMs:FP});else o[o.length-1]={...m,durationMs:o.at(-1).durationMs};continue}o.push(...Ze(o.at(-1),m,y)),a=f}return Qe(o),o}var tt="a pen gesture made with the eraser end was exported as an eraser step; replay injects an eraser only on a root adb shell with a uinput tool and refuses that step elsewhere",rt="a pen gesture without a known position or path was not exported: replaying it as a finger would be wrong",nt=`a stylus stroke was not exported because its duration exceeds the ${$f/1000} second replay limit; record a shorter stroke`,it=`a stylus hover was not exported because its duration exceeds the ${$f/1000} second replay limit; record a shorter hover`,ot="a pen hovered over the screen without touching it; no known position or hover distance was recorded, so nothing was exported for it",at="a stylus double tap was exported, but replay refuses stylus double taps, so that step will fail when run";function lt(n,o){if(n.toolType===void 0)return;if(n.type==="hover")return o?void 0:X(n)?it:ot;if(!o)return X(n)?nt:rt;if(o.params.pointer!==void 0&&o.params.action==="doubleTap")return at;return n.toolType==="eraser"?tt:void 0}function K(n,o,s){let a=lt(o,s);if(a)n.add(a)}var Te=0,be=1,Ae=24,xe=26,we=27,Pe=53,Ee=54,Re=58;function Z(n){let o=/^(add|remove) device \d+:\s+(\/dev\/input\/event\d+)\s*$/.exec(n);return o?{action:o[1]==="add"?"add":"remove",path:o[2]}:null}async function Me(n){let{stdout:o}=await n.executeCommand("shell getevent -p"),s=Q(o);if(s.touch===null&&s.pen.length===0)e.warn("[InputNodeDiscovery] No multitouch or pen input device found");return s}function Q(n){let o=ut(n);return{touch:o.find((s)=>s.kind==="touch")??null,pen:o.filter((s)=>s.kind==="pen")}}function ut(n){let o=[];for(let s of mt(n)){let a=s.abs.get(Pe),d=s.abs.get(Ee);if(a&&d){o.push(ve(s,a,d,{pressure:s.abs.get(Re),kind:"touch"}));continue}let c=s.abs.get(Te),p=s.abs.get(be);if(c&&p&&s.hasPenTool)o.push(ve(s,c,p,{pressure:s.abs.get(Ae),kind:"pen"}))}return o}function ve(n,o,s,{pressure:a,kind:d}){let c=n.abs.get(d==="pen"?25:59),p=n.abs.get(xe),h=n.abs.get(we);return{path:n.path,name:n.name,axisXMin:o.min,axisXMax:o.max,axisYMin:s.min,axisYMax:s.max,kind:d,...c&&c.max>c.min?{distanceRange:c}:{},...p&&h?{tiltAxes:{x:p,y:h}}:{},...a&&a.max>a.min?{pressureMin:a.min,pressureMax:a.max}:{}}}var Se=/\b(?:BTN_TOOL_PEN|BTN_TOOL_RUBBER|0140|0141)\b/,dt={ABS_X:Te,ABS_Y:be,ABS_PRESSURE:Ae,ABS_DISTANCE:25,ABS_MT_DISTANCE:59,ABS_TILT_X:xe,ABS_TILT_Y:we,ABS_MT_POSITION_X:Pe,ABS_MT_POSITION_Y:Ee,ABS_MT_PRESSURE:Re},ct=/^\s*(?:ABS\s*\(0003\):\s*)?(?:(ABS_\w+)(?:\s+\(([0-9a-f]{4})\))?|([0-9a-f]{4}))\s*:\s+value\s+-?\d+,\s*min\s+(-?\d+),\s*max\s+(-?\d+)/,pt=/^\s+(\w+)\s*\([0-9a-f]{4}\):(.*)$/;function ht(n){let o=n[2]??n[3];return o?parseInt(o,16):dt[n[1]]}function mt(n){let o=[],s=null,a={inKeyBlock:!1};for(let d of n.split(`
|
|
3
|
+
`)){let c=Z(d);if(c?.action==="add"){let{path:p}=c;s={path:p,name:p,abs:new Map,hasPenTool:!1},o.push(s),a.inKeyBlock=!1}else if(s)ft(s,d,a)}return o}function ft(n,o,s){let a=o.match(/^\s+name:\s+"(.+)"/);if(a){n.name=a[1],s.inKeyBlock=!1;return}let d=o.match(ct);if(d){let h=ht(d);if(h!==void 0)n.abs.set(h,yt(d,o));s.inKeyBlock=!1;return}let c=o.match(pt);if(c){if(s.inKeyBlock=c[1]==="KEY"||c[1]==="EV_KEY",s.inKeyBlock&&Se.test(c[2]))n.hasPenTool=!0;return}let p=/^\s+[\w ]+$/.test(o);if(s.inKeyBlock&&p&&Se.test(o))n.hasPenTool=!0;else if(!p)s.inKeyBlock=!1}function yt(n,o){let s=o.match(/,\s*resolution\s+(\d+)/);return{min:parseInt(n[4],10),max:parseInt(n[5],10),...s?{resolution:parseInt(s[1],10)}:{}}}var ee=500,te="display rotation could not be read; touch coordinates and swipe directions may be mapped with the wrong rotation",gt="display size could not be read after a display change; touch coordinates may be scaled with the wrong size";function vt(n,o){return`display size changed from ${n.width}x${n.height} to ${o.width}x${o.height} (fold/unfold?); touches are still read from the touch node chosen when recording started, so coordinates may refer to a different panel`}class W{axes;entries;changeReports=[];baselineDisplay;followers=[];constructor(n,o,s,a=[]){this.axes=n;this.baselineDisplay=o.display,this.entries=[this.entry(o,s,a)]}scalerAt(n){return this.entryAt(n).scaler}geometryAt(n){let{rotation:o,display:s}=this.entryAt(n),a=o%2!==0;return{deviceWidth:a?s.height:s.width,deviceHeight:a?s.width:s.height,orientation:o}}get currentRotation(){return this.entries[this.entries.length-1].rotation}get lastKnownGoodAt(){for(let n=this.entries.length-1;n>=0;n--)if(this.entries[n].caveats.length===0)return this.entries[n].reportedAt;return this.entries[0].reportedAt}noteChangeReported(n){this.changeReports.push(n);for(let o of this.followers)o.noteChangeReported(n)}follow(n){return n.entries.splice(0,n.entries.length,...this.entries.map((o)=>n.entry(o,o.reportedAt,o.caveats))),n.changeReports.splice(0,n.changeReports.length,...this.changeReports),this.followers.push(n),()=>{let o=this.followers.indexOf(n);if(o!==-1)this.followers.splice(o,1)}}apply(n,o){for(let c of this.followers)c.apply(n,o);let s=this.entries[this.entries.length-1],a=[];if(n.rotation===null)a.push(te);if(n.display===null)a.push(gt);let d={rotation:n.rotation??s.rotation,display:n.display??s.display};if(d.display.width!==this.baselineDisplay.width||d.display.height!==this.baselineDisplay.height)a.push(vt(this.baselineDisplay,d.display));this.entries.push(this.entry(d,Math.max(o,s.reportedAt),a))}warningsFor(n,o){let s=new Set(this.entryAt(n).caveats);if(this.changeReports.some((d)=>d>n&&d<=o))s.add("gesture spans a display rotation/size change; its coordinates and direction mix two geometries");else if(this.changeReports.some((d)=>d>=n-ee&&d<=o+ee))s.add(`display rotation/size changed within ${ee} ms of this gesture; its coordinates or direction may use a stale rotation`);return[...s]}entryAt(n){let o=this.entries[0];for(let s of this.entries){if(s.reportedAt>n)break;o=s}return o}entry(n,o,s){return{...n,reportedAt:o,caveats:s,scaler:wte({...this.axes,displayWidth:n.display.width,displayHeight:n.display.height,rotation:n.rotation})}}}function Ie(n,o,s,{startedAt:a,caveats:d}){return o.map((c)=>{let p=new W({xMin:c.axisXMin,xMax:c.axisXMax,yMin:c.axisYMin,yMax:c.axisYMax},s,a,d),h=n.follow(p);return{node:c,scaler:p,stopFollowing:h}})}var St=0,_e=1000;function De(n){return{readRotation:()=>al(n,{timeoutMs:_e}),readPhysicalSize:()=>MC(n,{timeoutMs:_e})}}function Ge(n){return n!==void 0&&Number.isInteger(n)&&n>=0&&n<=3}class re{timeline;probe;timer;refreshChain=Promise.resolve();generation=0;disposed=!1;constructor(n,o,s){this.timeline=n;this.probe=o;this.timer=s}dispose(){this.disposed=!0,this.refreshChain=Promise.resolve()}handleTransition(n){if(this.disposed||n.displayId!==St||n.change==="removed")return;let o=this.timer.now(),s=++this.generation;if(this.timeline.noteChangeReported(o),Ge(n.rotation))this.timeline.apply({rotation:n.rotation},o);let a=Ge(n.rotation);this.refreshChain=this.refreshChain.then(()=>this.refresh(o,a,s))}async settle(){let n;do n=this.refreshChain,await n;while(n!==this.refreshChain)}async verifyAtStop(){if(this.disposed)return;let n=await this.probe.readRotation().then(void 0,(s)=>{if(!this.disposed)throw s;return e.debug("[DisplayGeometryTracker] Cancelled stop-time geometry read failed",s),null});if(this.disposed)return;if(n===null)throw Error("WindowManager did not report a display rotation at stop");let o=this.timeline.currentRotation;if(n!==o)return`display rotation at stop (${n}) differs from the rotation tracked during recording (${o}); a rotation was not reported, so tapAt and swipeOn steps after it may be recorded at the wrong coordinates or direction`;return}async refresh(n,o,s){if(this.disposed||s!==this.generation)return;let a=o?void 0:await this.readRotationOrNull();if(this.disposed)return;let d=await this.readSizeOrNull();if(this.disposed||s!==this.generation)return;this.timeline.apply({rotation:a,display:d},n)}async readRotationOrNull(){try{return await this.probe.readRotation()}catch(n){return e.warn(`[DisplayGeometryTracker] Failed to read rotation after a display change: ${r(n)}`,n),null}}async readSizeOrNull(){try{return await this.probe.readPhysicalSize()}catch(n){return e.warn(`[DisplayGeometryTracker] Failed to read display size after a display change: ${r(n)}`,n),null}}}var Ne=(n,o,s)=>({type:"hover",arrivedAt:o,toolType:n,...s.samples.length?{hover:s.samples}:{}});class ne{nodeEpisode;slotEpisodes=new Map;penEntered(){this.nodeEpisode??={touched:!1,samples:[]}}penTouched(){this.nodeEpisode??={touched:!1,samples:[]},this.nodeEpisode.touched=!0}penLeft(n,o){let s=this.nodeEpisode;return this.nodeEpisode=void 0,s&&!s.touched?Ne(n,o,s):null}slotHovering(n,o,s,a){if(!this.slotEpisodes.has(n))this.slotEpisodes.set(n,{touched:!1,samples:[]});this.sample(this.slotEpisodes.get(n),o,s,a)}penHovering(n,o,s){if(this.nodeEpisode)this.sample(this.nodeEpisode,n,o,s)}sample(n,o,s,a){if(n.touched||!Number.isFinite(o.x)||!Number.isFinite(o.y)||o.distance===void 0||!Number.isFinite(o.distance))return;if(n.samples.length>=A.PEN_MAX_SAMPLES)n.samples=n.samples.filter((d,c)=>c===0||c%2===1);n.samples.push({x:o.x,y:o.y,distance:o.distance,arrivedAt:s,...a===void 0?{}:{kernelAtMs:a}})}slotTouching(n){this.slotEpisodes.set(n,{touched:!0,samples:[]})}slotReleased(n,o,s){let a=this.slotEpisodes.get(n);return this.slotEpisodes.delete(n),a&&!a.touched&&o?Ne(o,s,a):null}}var Tt={KEY_BACK:"back",KEY_HOME:"home",KEY_MENU:"menu",KEY_POWER:"power",KEY_VOLUMEUP:"volume_up",KEY_VOLUMEDOWN:"volume_down",KEY_APPSELECT:"recent"};class ie{options;slots=new Map;currentSlot=0;penPaths=new Map;releasedSlots=new Set;touchingSlots=new Set;lastEmitted=new Map;nodeTool;heldButtons=new Set;hover=new ne;kernelAtMs=0;constructor(n={}){this.options=n}emitHover(n){if(n)this.options.onHover?.(n)}feedLine(n,o){let s=n.match(/^\[\s*(\d+(?:\.\d+)?)\]\s+(\S+)\s+(\S+)\s+(\S+)\s*$/);if(!s)return null;this.kernelAtMs=Number(s[1])*1000;let a=s[2],d=s[3],c=s[4];if(a==="EV_ABS")return this.handleAbsEvent(d,c,o);if(a==="EV_SYN")return this.handleSynEvent(d,c,o);if(a==="EV_KEY"){let p=c==="DOWN"?Tt[d]:void 0;if(p)return{type:"pressButton",arrivedAt:o,button:p};this.handleKeyEvent(d,c==="DOWN"||c==="REPEAT",o)}return null}handleAbsEvent(n,o,s){let a=parseInt(o,16);switch(n){case"ABS_MT_SLOT":this.currentSlot=a;break;case"ABS_MT_TRACKING_ID":if(o==="ffffffff")this.releaseCurrentSlot(s);else{let d=this.getOrCreateSlot();if(d.trackingId>=0&&d.trackingId!==a){let c=this.endedByReplacement(d,s);return this.emitHover(this.hover.slotReleased(d.slotId,this.withPenState({...d}).toolType,s)),d.trackingId=a,c}d.trackingId=a}break;case"ABS_MT_POSITION_X":this.observeAxis("x",a);break;case"ABS_MT_POSITION_Y":this.observeAxis("y",a);break;case"ABS_MT_PRESSURE":this.getOrCreateSlot().pressure=a;break;default:this.handlePenAbsEvent(n,a);break}return null}releaseCurrentSlot(n){let o=this.slots.get(this.currentSlot);if(!o)return;if(o.trackingId>=0)this.releasedSlots.add(o.slotId),o.trackingId=-1;this.emitHover(this.hover.slotReleased(o.slotId,this.withPenState({...o}).toolType,n))}observePenSlot(n,o){if(this.options.singleTouch||n.toolType===void 0||n.trackingId<0)return;if(this.isMtPenHovering(n))this.hover.slotHovering(n.slotId,n,o,this.kernelAtMs);else this.hover.slotTouching(n.slotId)}endedByReplacement(n,o){let s=[];for(let[,a]of this.slots)if(a.slotId!==n.slotId&&a.trackingId>=0&&!this.isMtPenHovering(a)){let d=this.withPenState({...a});if(d.toolType)d.path=this.samplePen(d,o);s.push(d)}return this.releasedSlots.delete(n.slotId),this.touchingSlots.delete(n.slotId),this.lastEmitted.delete(n.slotId),this.penPaths.delete(n.slotId),{arrivedAt:o,activeSlots:s,releasedSlots:[n.slotId]}}handlePenAbsEvent(n,o){switch(n){case"ABS_MT_TOOL_TYPE":if(o===1)this.getOrCreateSlot().toolType="stylus";else delete this.getOrCreateSlot().toolType;break;case"ABS_X":case"ABS_Y":case"ABS_PRESSURE":if(this.options.singleTouch)this.handleSingleTouchAxis(n,o);break;case"ABS_TILT_X":this.getOrCreateSlot().tiltX=o|0;break;case"ABS_TILT_Y":this.getOrCreateSlot().tiltY=o|0;break;case"ABS_DISTANCE":case"ABS_MT_DISTANCE":this.getOrCreateSlot().distance=o;break;default:break}}handleSingleTouchAxis(n,o){if(this.currentSlot=0,n==="ABS_X")this.observeAxis("x",o);else if(n==="ABS_Y")this.observeAxis("y",o);else this.getOrCreateSlot().pressure=o}handleKeyEvent(n,o,s){switch(n){case"BTN_DIGI":case"BTN_TOOL_PEN":this.setNodeTool("stylus",o,s);break;case"BTN_TOOL_RUBBER":this.setNodeTool("eraser",o,s);break;case"BTN_STYLUS":this.setButton("stylusPrimary",o);break;case"BTN_STYLUS2":this.setButton("stylusSecondary",o);break;case"BTN_TOUCH":if(this.options.singleTouch){if(this.handleSingleTouchContact(o),o)this.hover.penTouched()}break;default:break}}setNodeTool(n,o,s){if(o){if(this.nodeTool=n,this.options.singleTouch)this.hover.penEntered();return}if(this.nodeTool!==n&&this.nodeTool!==void 0)return;if(this.nodeTool=void 0,this.options.singleTouch)this.handleSingleTouchContact(!1),this.emitHover(this.hover.penLeft(n,s))}setButton(n,o){if(o)this.heldButtons.add(n);else this.heldButtons.delete(n)}handleSingleTouchContact(n){if(this.currentSlot=0,n){this.getOrCreateSlot().trackingId=0;return}let o=this.slots.get(0);if(o&&o.trackingId>=0)this.releasedSlots.add(0),o.trackingId=-1}handleSynEvent(n,o,s){if(n!=="SYN_REPORT")return null;if(parseInt(o,16)!==0)return null;let d=[],c=[],p=[],h=new Set;for(let[,m]of this.slots)if(this.observePenSample(m,s),m.trackingId>=0&&!this.isMtPenHovering(m)){h.add(m.slotId);let f=this.withPenState({...m});if(f.toolType)f.path=this.samplePen(f,s);d.push(f),this.lastEmitted.set(m.slotId,{x:m.x,y:m.y})}else if(this.releasedSlots.has(m.slotId)||m.trackingId>=0&&this.touchingSlots.has(m.slotId))c.push(m.slotId),p.push(...this.takeFinalMove(m,s));for(let m of c)this.penPaths.delete(m);return this.releasedSlots.clear(),this.touchingSlots=h,p.length>0?{arrivedAt:s,activeSlots:d,releasedSlots:c,releasedFinalSamples:p}:{arrivedAt:s,activeSlots:d,releasedSlots:c}}observePenSample(n,o){if(this.observePenSlot(n,o),this.options.singleTouch&&this.nodeTool&&n.trackingId<0)this.hover.penHovering(n,o,this.kernelAtMs)}takeFinalMove(n,o){let s=this.lastEmitted.get(n.slotId);if(this.lastEmitted.delete(n.slotId),!s||s.x===n.x&&s.y===n.y)return[];let a=this.withPenState({...n}),d=this.penPaths.get(n.slotId)?.at(-1)?.pressure;if(a.toolType&&d!==void 0)a.path=this.samplePen({...a,pressure:d},o);return[a]}withPenState(n){if(!(this.options.singleTouch||n.toolType!==void 0))return delete n.tiltX,delete n.tiltY,n;if(this.options.singleTouch)n.toolType=this.nodeTool??"stylus";else if(this.nodeTool==="eraser")n.toolType=this.nodeTool;if(this.heldButtons.size>0)n.buttons=[...this.heldButtons];return n}isMtPenHovering(n){return!this.options.singleTouch&&n.toolType!==void 0&&(n.distance??0)>0}samplePen(n,o){let s=this.penPaths.get(n.slotId)??[],a={x:n.x,y:n.y,pressure:n.pressure,arrivedAt:o,kernelAtMs:this.kernelAtMs};if(s.length>=A.PEN_MAX_SAMPLES){let d=s.reduce((p,h,m)=>h.pressure<s[p].pressure?m:p,0),c=s.reduce((p,h,m)=>h.pressure>s[p].pressure?m:p,0);s=s.filter((p,h)=>h===0||h===d||h===c||h%2===1)}return s.push(a),this.penPaths.set(n.slotId,s),[...s]}getOrCreateSlot(){if(!this.slots.has(this.currentSlot))this.slots.set(this.currentSlot,{slotId:this.currentSlot,trackingId:-1,x:NaN,y:NaN,pressure:0,unknownAxes:["x","y"]});return this.slots.get(this.currentSlot)}observeAxis(n,o){let s=this.getOrCreateSlot();if(s[n]=o,s.unknownAxes=s.unknownAxes?.filter((a)=>a!==n),!s.unknownAxes?.length)delete s.unknownAxes}}class ae{scaler;densityDp;pressureRange;tiltAxes;contacts=new Map;lastTap=null;pinchState=null;inTwoFingerMode=!1;constructor(n,o,s,a){this.scaler=n;this.densityDp=o;this.pressureRange=s;this.tiltAxes=a}scalerAt(n){return"scalerAt"in this.scaler?this.scaler.scalerAt(n):this.scaler}downStamp(n){return"scalerAt"in this.scaler?{downAt:n.arrivedAt}:{}}feedFrame(n){this.updateContacts(n);let o=n.activeSlots.length;if(this.updatePinchState(n,o),n.releasedSlots.length===0)return null;if(this.inTwoFingerMode&&this.pinchState){for(let s of n.releasedSlots)this.contacts.delete(s);if(o===0){let s=this.maybeEmitPinch(n.arrivedAt);return this.inTwoFingerMode=!1,this.pinchState=null,s}return null}if(!this.inTwoFingerMode&&n.releasedSlots.length===1&&o===0)return this.completeSingleFingerGesture(n);for(let s of n.releasedSlots)this.contacts.delete(s);return null}updateContacts(n){for(let o of n.releasedFinalSamples??[]){let s=this.contacts.get(o.slotId);if(s)s.lastX=o.x,s.lastY=o.y,s.path=o.path??s.path}for(let o of n.activeSlots){let s=this.contacts.get(o.slotId);if(s){if(!Number.isFinite(s.startX))s.startX=o.x;if(!Number.isFinite(s.startY))s.startY=o.y;s.lastX=o.x,s.lastY=o.y,s.path=o.path,s.unknownAxes=oe(s.unknownAxes,o.unknownAxes),Oe(s.pen,o,this.tiltAxes)}else{let a=bt();Oe(a,o,this.tiltAxes),this.contacts.set(o.slotId,{startX:o.x,startY:o.y,arrivedAt:n.arrivedAt,lastX:o.x,lastY:o.y,scaler:this.scalerAt(n.arrivedAt),unknownAxes:o.unknownAxes,pen:a,path:o.path})}}}updatePinchState(n,o){if(o===2){this.inTwoFingerMode=!0;let[s,a]=n.activeSlots,d=oe(this.contacts.get(s.slotId)?.unknownAxes,this.contacts.get(a.slotId)?.unknownAxes),c=this.contacts.get(s.slotId)?.scaler??this.scalerAt(n.arrivedAt),p=d?.length?void 0:ke(c,s.x,s.y,{rawX2:a.x,rawY2:a.y});if(!this.pinchState)this.pinchState={initialDist:p,finalDist:p,unknownAxes:d};else this.pinchState.finalDist=p,this.pinchState.unknownAxes=oe(this.pinchState.unknownAxes,d)}}completeSingleFingerGesture(n){let o=n.releasedSlots[0],s=this.contacts.get(o);if(this.contacts.delete(o),!s)return null;if(s.unknownAxes?.length)return{...this.evaluateUnknownContact(s,n.arrivedAt),...this.penFields(s)};let{x:a,y:d}=s.scaler.toScreenPoint(s.startX,s.startY),{x:c,y:p}=s.scaler.toScreenPoint(s.lastX,s.lastY),h=n.arrivedAt-s.arrivedAt,m=z(a,d,c,p),f=A.TOUCH_SLOP_DP*this.densityDp,y=m<f?this.evaluateTapOrLongPress(a,d,h,{arrivedAt:n.arrivedAt,toolType:s.pen.toolType}):this.evaluateSwipe({x:a,y:d},{x:c,y:p},h,n.arrivedAt);return this.completeContactGesture(s,y,n.arrivedAt,h)}completeContactGesture(n,o,s,a){let d=this.penFields(n);if(o.type==="swipe"&&n.pen.toolType==="stylus"&&d.pressure?.normalized&&this.pressureRange&&(n.pen.pressureMax-n.pen.pressureMin)/(this.pressureRange.max-this.pressureRange.min)>=A.STROKE_PRESSURE_RANGE&&n.path&&n.path.length>=2){this.lastTap=null;let c=this.pressureRange,p=n.path.map((h)=>({...n.scaler.toScreenPoint(h.x,h.y),arrivedAt:h.arrivedAt,...h.kernelAtMs===void 0?{}:{kernelAtMs:h.kernelAtMs},pressure:Math.round(se((h.pressure-c.min)/(c.max-c.min))*1e4)/1e4}));return{type:"stroke",arrivedAt:s,durationMs:a,path:p,...this.downStamp(n),...d}}return{...o,...this.downStamp(n),...d}}penFields(n){let{toolType:o,buttons:s,pressureCount:a,pressureSum:d,pressureMin:c,pressureMax:p}=n.pen,h={};if(o)h.toolType=o;if(a>0){let m=this.pressureRange,f=(y)=>Math.round((m?se((y-m.min)/(m.max-m.min)):y)*1e4)/1e4;h.pressure={min:f(c),max:f(p),mean:f(d/a),normalized:m!==void 0}}if(n.pen.tiltCount>0)h.tilt=Math.min(Math.PI/2,Math.round(n.pen.tiltSum/n.pen.tiltCount*1e4)/1e4);if(s.size>0)h.buttons=[...s];return h}evaluateUnknownContact(n,o){this.lastTap=null;let s=o-n.arrivedAt,a=Number.isFinite(n.startX)?n.startX:0,d=Number.isFinite(n.startY)?n.startY:0,c=Number.isFinite(n.lastX)?n.lastX:a,p=Number.isFinite(n.lastY)?n.lastY:d;return{type:ke(n.scaler,a,d,{rawX2:c,rawY2:p})>=A.TOUCH_SLOP_DP*this.densityDp?"swipe":s>=A.LONG_PRESS_MS?"longPress":"tap",arrivedAt:o,durationMs:s,unknownAxes:n.unknownAxes}}maybeEmitPinch(n){let o=this.pinchState;if(o?.unknownAxes?.length)return this.lastTap=null,null;if(!o||o.initialDist===void 0||o.finalDist===void 0||o.initialDist===0)return null;let s=o.finalDist/o.initialDist;if(Math.abs(s-1)<A.PINCH_MIN_SCALE_DELTA)return null;return{type:"pinch",arrivedAt:n,scale:s,pinchDirection:s<1?"in":"out"}}evaluateTapOrLongPress(n,o,s,{arrivedAt:a,toolType:d}){if(s>=A.LONG_PRESS_MS)return{type:"longPress",arrivedAt:a,screenX:n,screenY:o,durationMs:s};if(this.lastTap&&this.lastTap.toolType===d){let c=a-this.lastTap.arrivedAt,p=z(n,o,this.lastTap.screenX,this.lastTap.screenY),h=A.DOUBLE_TAP_SLOP_DP*this.densityDp;if(c<=A.DOUBLE_TAP_MS&&p<=h){let m=this.lastTap.arrivedAt;return this.lastTap=null,{type:"doubleTap",arrivedAt:a,screenX:n,screenY:o,firstTapArrivedAt:m}}}return this.lastTap={screenX:n,screenY:o,arrivedAt:a,toolType:d},{type:"tap",arrivedAt:a,screenX:n,screenY:o}}evaluateSwipe(n,o,s,a){let{x:d,y:c}=n,{x:p,y:h}=o,m=p-d,f=h-c,y=z(d,c,p,h),S=Math.abs(m)>=Math.abs(f)?m>0?"right":"left":f>0?"down":"up",g=s>0?y/s*1000:0,w=A.FLING_MIN_DP_PER_S*this.densityDp,_=g>=w?"fast":"normal";return{type:"swipe",arrivedAt:a,direction:S,startX:d,startY:c,endX:p,endY:h,speed:_}}}function ke(n,o,s,{rawX2:a,rawY2:d}){let c=n.toScreenPoint(o,s),p=n.toScreenPoint(a,d);return z(c.x,c.y,p.x,p.y)}function z(n,o,s,a){return Math.sqrt((s-n)**2+(a-o)**2)}function oe(n,o){if(!n?.length&&!o?.length)return;return[...new Set([...n??[],...o??[]])]}function bt(){return{buttons:new Set,pressureCount:0,pressureSum:0,pressureMin:1/0,pressureMax:-1/0,tiltCount:0,tiltSum:0}}function Oe(n,o,s){if(o.toolType)n.toolType=o.toolType;for(let a of o.buttons??[])n.buttons.add(a);if(o.toolType==="stylus"||o.toolType==="eraser")At(n,o,s);if(o.pressure>0)n.pressureCount+=1,n.pressureSum+=o.pressure,n.pressureMin=Math.min(n.pressureMin,o.pressure),n.pressureMax=Math.max(n.pressureMax,o.pressure)}function At(n,o,s){if(s&&Be(s.x)&&Be(s.y)&&o.tiltX!==void 0&&o.tiltY!==void 0&&Number.isFinite(o.tiltX)&&Number.isFinite(o.tiltY)){let a=Ce(o.tiltX,s.x),d=Ce(o.tiltY,s.y),c=Math.cos(a)*Math.cos(d);n.tiltCount+=1,n.tiltSum+=Math.acos(se(c))}}function Ce(n,o){let s=o.resolution?1/o.resolution:Math.PI/180;return(n-(o.min+o.max)/2)*s}function Be(n){return Number.isFinite(n.min)&&Number.isFinite(n.max)&&n.max>n.min&&(n.resolution===void 0||Number.isFinite(n.resolution)&&n.resolution>=0)}function se(n){return Math.min(Math.max(n,0),1)}class le{opts;pending=[];maxSeenKernelMs=-1/0;releasePoint=-1/0;flushTimer;flushAt;windowMs;constructor(n){this.opts=n;if(this.windowMs=n.windowMs??50,!Number.isFinite(this.windowMs)||this.windowMs<0)throw RangeError("Kernel reorder window must be finite and non-negative")}push(n,o,s){let a=/^\[\s*(\d+(?:\.\d+)?)\s*\]/.exec(o),d=a?Number(a[1])*1000:NaN;if(!Number.isFinite(d)){this.opts.onLine({nodeKey:n,line:o,arrivedAt:s});return}this.maxSeenKernelMs=Math.max(this.maxSeenKernelMs,d),this.pending.push({nodeKey:n,kernelMs:d,line:o,arrivedAt:s,releaseAt:this.now()+this.windowMs}),this.pending.sort((c,p)=>c.kernelMs-p.kernelMs),this.releaseThrough(Math.max(this.releasePoint,this.maxSeenKernelMs-this.windowMs)),this.scheduleFlush()}drain(){this.cancelFlush(),this.releaseThrough(this.maxSeenKernelMs)}dropNode(n){this.pending=this.pending.filter((o)=>o.nodeKey!==n),this.scheduleFlush()}clear(){this.cancelFlush(),this.pending=[],this.maxSeenKernelMs=-1/0,this.releasePoint=-1/0}releaseThrough(n){this.releasePoint=n;while(this.pending.length>0&&this.pending[0].kernelMs<=n){let o=this.pending.shift(),{nodeKey:s,kernelMs:a,line:d,arrivedAt:c}=o;this.opts.onLine({nodeKey:s,kernelMs:a,line:d,arrivedAt:c})}}scheduleFlush(){if(this.pending.length===0){this.cancelFlush();return}let n=1/0;for(let o of this.pending)n=Math.min(n,o.releaseAt);if(this.flushAt===n)return;this.cancelFlush(),this.flushAt=n,this.flushTimer=this.opts.timer.setTimeout(()=>{this.flushTimer=void 0,this.flushAt=void 0;let o=this.now(),s=this.releasePoint;for(let a of this.pending)if(a.releaseAt<=o)s=Math.max(s,a.kernelMs);this.releaseThrough(s),this.scheduleFlush()},Math.max(0,n-this.now()))}cancelFlush(){if(this.flushTimer!==void 0)this.opts.timer.clearTimeout(this.flushTimer),this.flushTimer=void 0;this.flushAt=void 0}now(){return this.opts.timer.monotonicNow?.()??this.opts.timer.now()}}class L{handlers=new Map;buffer;constructor(n){this.buffer=new le({...n,onLine:({nodeKey:o,line:s,arrivedAt:a})=>this.handlers.get(o)?.(s,a)})}register(n,o){this.buffer.dropNode(n);let s=(a,d)=>o(a,d);return this.handlers.set(n,s),()=>{if(this.handlers.get(n)!==s)return;if(this.handlers.delete(n),this.buffer.dropNode(n),this.handlers.size===0)this.buffer.clear()}}push(n,o,s){if(this.handlers.has(n))this.buffer.push(n,o,s)}}class F{opts;children=new Set;starting=!1;generation=0;cleanups=new Set;timer;constructor(n){this.opts=n;this.timer=n.timer??i}start(n,o){if(this.children.size>0||this.starting)return;this.starting=!0;let s=++this.generation,a=this.opts.lineMerge??new L({timer:this.timer,windowMs:this.opts.kernelReorderWindowMs});this.startProcess(s,this.opts.touchNode,this.opts.scaler,{onGesture:n,onError:o,lineMerge:a});for(let{node:d,scaler:c}of this.opts.penNodes??[])this.startProcess(s,d,c,{onGesture:n,lineMerge:a,onError:(p)=>e.warn(`[GetEventReader] pen node ${d.path} stopped; finger recording continues: ${p.message}`,p)})}async startProcess(n,o,s,{onGesture:a,onError:d,lineMerge:c}){let p=new ie({singleTouch:o.kind==="pen",onHover:(T)=>{let P=T.hover,M=o.distanceRange,D=P?.[0],me=D&&"scalerAt"in s?s.scalerAt(D.arrivedAt):s;a({...T,...D?{downAt:D.arrivedAt}:{},hover:M&&P&&"toScreenPoint"in me?P.map((k)=>({...me.toScreenPoint(k.x,k.y),arrivedAt:k.arrivedAt,...k.kernelAtMs===void 0?{}:{kernelAtMs:k.kernelAtMs},distance:Math.min(1,Math.max(0,(k.distance-M.min)/(M.max-M.min)))})):void 0})}}),h=new ae(s,this.opts.density,xt(o),o.tiltAxes),m=["shell","getevent","-lt",o.path];e.debug(`[GetEventReader] Spawning: ${m.join(" ")}`);let f;try{f=await this.opts.adb.spawn(m)}catch(T){let P=T instanceof Error?T:Error(String(T));if(e.error(`[GetEventReader] spawn error: ${P.message}`),n===this.generation){if(o===this.opts.touchNode)this.starting=!1;d?.(P)}return}if(n!==this.generation){f.on("error",()=>{}),f.kill();return}if(this.children.add(f),o===this.opts.touchNode)this.starting=!1;let y="",S="",g=c.register(o.path,(T,P)=>{if(n!==this.generation)return;let M=p.feedLine(T,P);if(!M)return;if(wt(M)){let D=h.feedFrame(M);if(D)a(D)}else a(M)}),w=(T)=>{y+=T.toString();let P=y.split(`
|
|
4
|
+
`);y=P.pop()??"";for(let M of P){if(!M.trim()||n!==this.generation)continue;let D=this.timer.now();c.push(o.path,M,D)}},_=(T)=>{S=(S+T.toString()).slice(-4096),e.debug(`[GetEventReader] stderr: ${T.toString().trim()}`)},I=()=>{y="",f.stdout.off("data",w),f.stderr.off("data",_),f.on("error",J),f.off("error",O),f.off("exit",U),this.children.delete(f),this.cleanups.delete(I),g()},J=()=>{},O=(T)=>{I();let P=S.trim()?Error(`[GetEventReader] getevent process error: ${T.message}; stderr tail: ${S.trim()}`,{cause:T}):T;e.warn(`[GetEventReader] process error: ${P.message}`),d?.(P)},U=(T,P)=>{I();let M=Error(`[GetEventReader] getevent exited with ${P?`signal ${P}`:`code ${T}`}`+(S.trim()?`; stderr tail: ${S.trim()}`:""));e.warn(M.message),d?.(M)};this.cleanups.add(I),f.stdout.on("data",w),f.stderr.on("data",_),f.on("error",O),f.on("exit",U)}stop(){this.starting=!1,++this.generation;let n=[...this.children];for(let o of[...this.cleanups])o();for(let o of n)if(!o.killed)e.debug("[GetEventReader] Stopping getevent process"),o.kill();this.children.clear()}}function xt(n){return n.pressureMin!==void 0&&n.pressureMax!==void 0?{min:n.pressureMin,max:n.pressureMax}:void 0}function wt(n){return n!==null&&"activeSlots"in n}class ue{opts;running=!1;generation=0;pens=new Map;stopMonitor;constructor(n){this.opts=n}start(n,o){if(this.running)return;this.running=!0;let s=++this.generation,{primary:a}=this.opts;if(a.node.kind==="pen")this.pens.set(a.node.path,{controller:new AbortController,reader:a.reader});a.reader.start(n,o);for(let d of this.opts.penNodes){let c={controller:new AbortController};this.pens.set(d.path,c),this.startPen(d,c,n)}this.monitor(s,n)}startPen(n,o,s){o.reader=this.opts.createPenReader(n),o.reader.start((a)=>{if(this.pens.get(n.path)===o)s(a)},(a)=>{if(this.pens.get(n.path)!==o)return;this.removePen(n.path),e.warn(`[PenHotplugReader] pen node ${n.path} stopped; finger recording continues: ${a.message}`,a)})}async addPen(n,o){if(this.pens.has(n)||n===this.opts.primary.node.path&&this.opts.primary.node.kind!=="pen")return;let s={controller:new AbortController};this.pens.set(n,s);try{let{stdout:a}=await this.opts.adb.execute(["shell","getevent","-lp",n],{signal:s.controller.signal,timeoutMs:1000,noRetry:!0});if(this.pens.get(n)!==s)return;let d=Q(a).pen.find((c)=>c.path===n);if(d)this.startPen(d,s,o);else this.removePen(n)}catch(a){if(this.pens.get(n)!==s){e.debug(`[PenHotplugReader] discarded probe for removed node ${n}`,a);return}this.removePen(n),e.warn(`[PenHotplugReader] cannot read pen node ${n}; finger recording continues: ${r(a)}`,a)}}removePen(n){let o=this.pens.get(n);this.pens.delete(n),o?.controller.abort(),o?.reader?.stop()}async monitor(n,o){let s;try{s=await this.opts.adb.spawn(["shell","getevent","-lt"])}catch(g){if(n===this.generation)e.warn(`[PenHotplugReader] hotplug monitor failed; finger recording continues: ${r(g)}`,g);return}if(n!==this.generation){s.on("error",()=>{}),s.kill();return}let a="",d="",c=(g)=>{a+=g.toString();let w=a.split(`
|
|
5
|
+
`);a=w.pop()??"";for(let _ of w){let I=Z(_);if(I?.action==="add")this.addPen(I.path,o);else if(I?.action==="remove")this.removePen(I.path)}},p=(g)=>{d=(d+g.toString()).slice(-4096)},h=()=>{if(s.stdout.off("data",c),s.stderr.off("data",p),s.on("error",m),s.off("error",y),s.off("exit",S),a="",this.stopMonitor=void 0,!s.killed)s.kill()},m=()=>{},f=(g)=>{h(),e.warn(`[PenHotplugReader] hotplug monitor stopped; finger recording continues: ${g}`+(d.trim()?`; stderr tail: ${d.trim()}`:""))},y=(g)=>f(g.message),S=(g,w)=>f(w?`signal ${w}`:`code ${g}`);this.stopMonitor=h,s.stdout.on("data",c),s.stderr.on("data",p),s.on("error",y),s.on("exit",S)}stop(){this.running=!1,++this.generation,this.stopMonitor?.();for(let n of this.pens.keys())this.removePen(n);this.opts.primary.reader.stop()}}function Le({adb:n,penNode:o,timeline:s,rotation:a,display:d,caveats:c,density:p,timer:h,lineMerge:m}){let[{scaler:f,stopFollowing:y}]=Ie(s,[o],{rotation:a,display:d},{startedAt:h.now(),caveats:c}),S=new F({adb:n,touchNode:o,scaler:f,density:p,timer:h,lineMerge:m});return{start:(g,w)=>S.start(g,w),stop:()=>{S.stop(),y()}}}function Pt(n){return n?{action:"type",text:n,operation:"replace"}:{action:"clear"}}var Y=750,Et=3000,Fe="rotation/size could not be confirmed at stop; tapAt and swipeOn steps recorded after a display change may be at the wrong coordinates or direction";class j{device;gestureEmitter;a11ySource;steps=[];orderedSteps=[];latestEntry=null;pendingGestures=[];exportWarnings=new Set;bufferedInteractions=[];lastInputText=null;activeEmitter=null;unsubscribeA11y=null;activeA11y=null;stopped=!1;firstTouchTrackFailure;geometry;displaySource;unsubscribeDisplay=null;geometrySpans=new Map;finalized;get touchTrackFailure(){return this.firstTouchTrackFailure}get stepCount(){return this.steps.length}get capturedSteps(){return this.steps}get capturedExportWarnings(){return[...this.exportWarnings]}timer;constructor(n,o,s,{timer:a=i,...d}={}){this.device=n;this.gestureEmitter=o;this.a11ySource=s;this.timer=a,this.geometry=d.geometry,this.displaySource=d.displaySource}async start(){let n;if(!this.a11ySource)n=E.getInstance(this.device);let o=this.a11ySource??n;if(!await o.ensureConnected())throw Error("[DualTrackRecorder] Unable to connect to the accessibility service.");if(n)n.notifyRecordingStarted(),this.activeA11y=n;let a=this.gestureEmitter??await this.createGetEventReader();this.activeEmitter=a,a.start((d)=>this.handleGestureEvent(d),(d)=>{if(this.stopped||this.firstTouchTrackFailure)return;this.firstTouchTrackFailure={error:d,failedAt:this.timer.now()},e.warn(`[DualTrackRecorder] Touch track (getevent) failed: ${d.message}`)}),this.unsubscribeA11y=o.onInteraction((d)=>this.handleInteractionEvent(d)),this.subscribeDisplayChanges(n),e.debug("[DualTrackRecorder] Started dual-track recording")}async stop(n={}){if(n.hostOnly)this.geometry?.dispose();if(this.stopped){let s=await this.finalized??[];return this.stopResult(s)}if(this.stopped=!0,!n.hostOnly)this.activeA11y?.notifyRecordingStopped();this.activeA11y=null,this.unsubscribeA11y?.(),this.unsubscribeA11y=null,this.activeEmitter?.stop(),this.activeEmitter=null,this.flushPendingGestures(),this.finalized=(n.hostOnly?Promise.resolve(this.geometry?[Fe]:[]):this.finalizeGeometry()).finally(()=>{this.unsubscribeDisplay?.(),this.unsubscribeDisplay=null});let o=await this.finalized;return e.debug(`[DualTrackRecorder] Stopped with ${this.steps.length} steps`),this.stopResult(o)}flushPendingGestures(){for(let n of this.pendingGestures)if(!n.resolved)this.resolveGesture(n);this.pendingGestures=[]}stopResult(n){return{steps:this.steps,stepCount:this.steps.length,...this.touchTrackFailure?{touchTrackFailure:this.touchTrackFailure}:{},...n.length>0?{geometryWarnings:n}:{},...this.exportWarnings.size>0?{exportWarnings:[...this.exportWarnings]}:{}}}subscribeDisplayChanges(n){let o=this.displaySource??(n?Mt(n):void 0),s=this.geometry;if(o&&s)this.unsubscribeDisplay=o.onDisplayChange((a)=>s.handleTransition(a))}async finalizeGeometry(){let n=this.geometry;if(!n)return[];let{mismatch:o,unconfirmed:s}=await this.confirmGeometryAtStop(n),a=new Set;for(let[d,{downAt:c,upAt:p}]of this.geometrySpans){let h=n.timeline.warningsFor(c,p);if(o&&p>=n.timeline.lastKnownGoodAt)h.push(o);if(h.length>0){d.label=`Warning: ${h.join("; ")}`;for(let m of h)a.add(m)}}if(o)a.add(o);if(s)a.add(Fe);return[...a]}async confirmGeometryAtStop(n){try{return{mismatch:await l(async()=>(await n.settle(),n.verifyAtStop()),{timer:this.timer,timeoutMs:Et,label:"Confirming display geometry at stop"}),unconfirmed:!1}}catch(o){return e.warn(`[DualTrackRecorder] Could not confirm display geometry at stop: ${r(o)}`,o),{unconfirmed:!0}}}handleGestureEvent(n){if(this.stopped)return;if(n.type==="hover"){let s=Xe(n);K(this.exportWarnings,n,s),this.trackGeometrySpan(n,s),this.enqueueStep({resolved:!0,step:s??void 0});return}if(n.type==="pressButton"){this.enqueueStep({resolved:!0,step:kt(n)});return}if(n.type==="pinch"){this.enqueueStep({resolved:!0,step:Ot(n)??void 0});return}if(this.pendingGestures=this.pendingGestures.filter((s)=>!s.resolved||s.step!==void 0&&s.stepIndex===void 0||b(s.gesture)&&this.timer.now()-s.arrivedAt<=Y*2||s.gesture.type==="tap"&&n.arrivedAt-s.gesture.arrivedAt<=A.DOUBLE_TAP_MS),this.upgradeDoubleTap(n))return;let o={gesture:n,arrivedAt:this.timer.now(),resolved:!1};this.pendingGestures.push(o),this.enqueueStep(o),o.timeout=this.timer.setTimeout(()=>this.resolveGesture(o),Y)}upgradeDoubleTap(n){if(n.type!=="doubleTap"||b(n))return!1;let o=[...this.pendingGestures].reverse().find((a)=>fe(a.gesture,n)),s=o?.step;if(s&&["tapOn","tapAt"].includes(s.tool)&&s.params.action==="tap")return s.params.action="doubleTap",K(this.exportWarnings,n,s),!0;if(o&&!o.resolved){if(o.timeout)this.timer.clearTimeout(o.timeout);return o.gesture=n,o.arrivedAt=this.timer.now(),o.timeout=this.timer.setTimeout(()=>this.resolveGesture(o),Y),!0}return!1}enqueueStep(n){this.latestEntry=n,this.orderedSteps.push(n),this.flushResolvedSteps()}flushResolvedSteps(){while(this.orderedSteps[0]?.resolved){let n=this.orderedSteps.shift();if(n.step)n.stepIndex=this.steps.length,this.steps.push(n.step)}}handleInteractionEvent(n){if(this.stopped)return;if(n.type==="windowChange")return;if(n.type==="inputText"){this.handleInputText(n);return}let o={...n,receivedAt:this.timer.now()},s=this.pendingGestures.find((a)=>!a.resolved&&!b(a.gesture)&&this.isPairCandidate(a,o));if(s)this.resolveGesture(s,n);else if(!this.pendingGestures.some((a)=>a.resolved&&!b(a.gesture)&&de(a.gesture.type,n.type)&&Ye(a.gesture,n.element)))this.bufferedInteractions.push(o)}resolveGesture(n,o){if(n.resolved)return;if(n.resolved=!0,n.timeout)this.timer.clearTimeout(n.timeout);let s=this.selectInteraction(n,o),a=Gt(n.gesture,s);if(K(this.exportWarnings,n.gesture,a),n.step=a??void 0,this.trackGeometrySpan(n.gesture,a),this.flushResolvedSteps(),!a&&b(n.gesture)){We(n.gesture);return}if(!s||!V(s.element)||!a){let d=n.gesture,[c,p]=d.type==="swipe"?[d.startX,d.startY]:[d.screenX,d.screenY],h=a?`recorded ${a.tool} fallback`:"no swipe direction or missing coordinates \u2014 step skipped";e.warn(`[DualTrackRecorder] No element match for ${d.type} at (${c}, ${p}) \u2014 ${h}`)}}trackGeometrySpan(n,o){if(o&&n.downAt!==void 0&&["tapAt","swipeOn","swipeAt","dragPath","hoverAt"].includes(o.tool))this.geometrySpans.set(o,{downAt:n.downAt,upAt:n.arrivedAt})}selectInteraction(n,o){let s=this.timer.now(),a=Y*2;this.bufferedInteractions=this.bufferedInteractions.filter((h)=>s-h.receivedAt<=a);let d=this.bufferedInteractions.map((h,m)=>({event:h,index:m}));if(o)d.push({event:{...o,receivedAt:s},index:-1});let c=d.filter(({event:h})=>this.isPairCandidate(n,h));if(b(n.gesture)&&!this.isUnambiguousUnknownPair(n,c.map(({event:h})=>h)))return;let p=c.sort((h,m)=>{let f=h.event.receivedAt-n.arrivedAt,y=m.event.receivedAt-n.arrivedAt;return Number(m.event.type==="tap")-Number(h.event.type==="tap")||Number(f<0)-Number(y<0)||Math.abs(f)-Math.abs(y)})[0];if(p&&p.index>=0)this.bufferedInteractions.splice(p.index,1);return p?.event}isPairCandidate(n,o){let s=n.gesture;if(Math.abs(o.receivedAt-n.arrivedAt)>Y)return!1;if(b(s)){let a=(s.type==="tap"||s.type==="longPress")&&o.type==="scroll"&&ce(o.scrollDeltaX,o.scrollDeltaY)!==null;return Boolean((a||de(s.type,o.type,!1))&&o.element?.bounds&&V(o.element))}return de(s.type,o.type)&&Ye(s,o.element)}isUnambiguousUnknownPair(n,o){if(o.length!==1)return!1;let s=o[0];return!this.pendingGestures.some((a)=>a!==n&&(b(a.gesture)||!a.resolved)&&this.isPairCandidate(a,s))}handleInputText(n){let o=_t(n);if(n.text===void 0)return;let s=Pt(n.text);if(this.coalesceInputText(o,s))return;let a={resolved:!0,step:this.buildRecordedTextStep(s)};if(this.enqueueStep(a),o)this.lastInputText={elementKey:o,entry:a}}buildRecordedTextStep(n){return{tool:"sendKeys",params:{commands:[n]}}}coalesceInputText(n,o){let s=this.lastInputText;if(!s||!n||s.elementKey!==n||s.entry!==this.latestEntry)return!1;return this.updateCoalescedTextStep(s.entry.step,o)}updateCoalescedTextStep(n,o){let s=n?.params.commands?.[0];if(n?.tool!=="sendKeys"||s?.action!=="type"&&s?.action!=="clear")return!1;return n.params.commands=[o],!0}async createGetEventReader(){let n=v.create(this.device),{touch:o,pen:s}=await Me(n),a=o??s[0];if(!a)throw Error("[DualTrackRecorder] No multitouch input device found on this device");let d=await Rte(n),c=De(n),p=await MC(n),{rotation:h,caveats:m}=await Rt(c),f=new W({xMin:a.axisXMin,xMax:a.axisXMax,yMin:a.axisYMin,yMax:a.axisYMax},{rotation:h,display:p},this.timer.now(),m);this.geometry=new re(f,c,this.timer);let y=new L({timer:this.timer}),S=new F({adb:n,touchNode:a,scaler:f,density:d,timer:this.timer,lineMerge:y}),g=new ue({adb:n,primary:{node:a,reader:S},penNodes:o?s:s.slice(1),createPenReader:(w)=>Le({adb:n,penNode:w,timeline:f,rotation:h,display:p,caveats:m,density:d,timer:this.timer,lineMerge:y})});return Ct(g,f,this.timer)}}async function Rt(n){try{let o=await n.readRotation();if(o!==null)return{rotation:o,caveats:[]};e.warn("[DualTrackRecorder] WindowManager reported no display rotation at start")}catch(o){e.warn(`[DualTrackRecorder] Failed to read display rotation at start: ${r(o)}`,o)}return{rotation:0,caveats:[te]}}function Mt(n){return{onDisplayChange(o){let s=n.onDisplayTransition,a=(d)=>{s?.(d),o(d)};return n.onDisplayTransition=a,()=>{if(n.onDisplayTransition===a)n.onDisplayTransition=s}}}}function de(n,o,s=!0){return(n==="tap"||n==="doubleTap")&&(o==="tap"||s&&o==="stateChange")||n==="longPress"&&o==="longPress"||n==="swipe"&&(o==="scroll"||o==="swipe")}function Ye(n,o){let s=o?.bounds;if(!s)return!1;if(b(n))return!1;let a=n.screenX??n.startX,d=n.screenY??n.startY;if(typeof a!=="number"||typeof d!=="number"||!Number.isFinite(a)||!Number.isFinite(d))return!1;return It(a,d,s)}function It(n,o,s){return n>=s.left-20&&n<=s.right+20&&o>=s.top-20&&o<=s.bottom+20}function V(n){if(!n)return null;let o=n["resource-id"];if(o)return{elementId:o};let s=n.text??n["content-desc"];if(s)return{text:s};return null}function _t(n){let o=n.element;if(!o)return null;let s=o["resource-id"]??"",a=o["content-desc"]??"",d=o.class??"";if(!s&&!a&&!d)return null;return`${s}|${a}|${d}`}function ce(n,o){let s=n??0,a=o??0;if(s===0&&a===0)return null;if(Math.abs(s)>=Math.abs(a))return s>0?"left":"right";return a>0?"up":"down"}function Gt(n,o={type:"",timestamp:0}){if(n.toolType!==void 0)return Xe(n);let s=V(o.element);switch(n.type){case"tap":case"doubleTap":case"longPress":{if(n.type!=="doubleTap"&&b(n)&&o.type==="scroll")return He(n,o);if(s)return{tool:"tapOn",params:{action:n.type,...s}};return Ke(n)}case"swipe":return He(n,o);default:return null}}var Dt=0.5;function $e(n){let{startX:o,startY:s,endX:a,endY:d}=n;if(b(n)||o===void 0||s===void 0||a===void 0||d===void 0||o===a&&s===d)return null;return{from:{x:o,y:s},to:{x:a,y:d}}}function Nt({from:n,to:o}){let s=Math.abs(o.x-n.x),a=Math.abs(o.y-n.y);return Math.min(s,a)>=Math.max(s,a)*Dt}function Ue(n,o){let s={from:o.from,to:o.to},a=n.geometry?.deviceWidth,d=n.geometry?.deviceHeight;if(a&&d&&a>0&&d>0)s.from={x:Qp(o.from.x,a),y:Qp(o.from.y,d)},s.to={x:Qp(o.to.x,a),y:Qp(o.to.y,d)},s.coordinateSpace="normalized";if(n.speed==="fast")s.speed="fast";let c=C(n);if(c)s.pointer=c;return{tool:"swipeAt",params:s}}function Xe(n){if(n.toolType!=="stylus"&&n.toolType!=="eraser")return null;if(n.type==="stroke"||n.type==="hover")return ge(n);if(n.type==="swipe"){let o=$e(n);return o?Ue(n,o):null}return Ke(n)}function He(n,o){let s=V(o.element),a=b(n)?s&&ce(o.scrollDeltaX,o.scrollDeltaY):n.direction??ce(o.scrollDeltaX,o.scrollDeltaY),d=$e(n);if(d&&(!a||Nt(d)))return Ue(n,d);if(!a)return null;let c={direction:a};if(s)c.container="elementId"in s?{elementId:s.elementId}:{text:s.text};if(!b(n)&&n.speed==="fast")c.speed="fast";return{tool:"swipeOn",params:c}}function Ke(n){if(b(n)||n.screenX===void 0||n.screenY===void 0)return null;let o={x:n.screenX,y:n.screenY,action:n.type};if(n.type==="longPress"&&n.durationMs!==void 0)o.durationMs=Math.min(eg,Math.max(Na,n.durationMs));let s=C(n);if(s)o.pointer=s;return{tool:"tapAt",params:o,...n.geometry?{geometry:{...n.geometry,x:n.screenX,y:n.screenY}}:{}}}function We(n){e.warn(`[DualTrackRecorder] ${n.type} has unknown axes: ${n.unknownAxes?.join(", ")} \u2014 no resolved element gesture; step skipped`)}function kt(n){return{tool:"pressButton",params:{button:n.button}}}function Ot(n){if(b(n))return We(n),null;return{tool:"pinchOn",params:{direction:n.pinchDirection,scale:n.scale}}}function Ct(n,o,s){return{start:(a,d)=>n.start((c)=>a({...c,geometry:{platform:"android",...o.geometryAt(c.downAt??s.now())}}),d),stop:()=>n.stop()}}var Bt="user-input",Lt="no_user_input_captured",je="Device gesture recordings capture input made on the device itself (touches on its touch screen or emulator window, and text changes in input fields). Taps, swipes and other gestures sent through AutoMobile tools (tapAt, tapOn, swipeOn, etc.) or adb shell input are injected and are not recorded by design; use recordToolCalls to record tool calls.";class LP extends t{reason=Lt;constructor(n){super("No recorded interactions were captured. "+je+(n?` ${n}`:""))}}var ze=1e4,x=null,N=null,G=null,Ft=16,H=new Map;function Yt(n,o){if(!n.ownerSessionUuid)return;if(H.set(n.recordingId,{owner:n.ownerSessionUuid,result:o}),H.size>Ft){let s=H.keys().next();if(!s.done)H.delete(s.value)}}function pe(n){let o=R.sessionManager();if(!o)return n;return st(n,o)??n}function YE(n,o,s=pe){let a=H.get(n);if(!a||o===void 0)return;return he(a.owner,o,s)?a.result:void 0}function he(n,o,s){if(n===void 0||o===void 0)return!1;let a=s(o);return n===o||BG(n,a)||s(n)===a}async function BM(n,o,s=pe){let a=G;if(!a||a.session.recordingId!==n||!he(a.session.ownerSessionUuid,o,s))return;return await a.promise,YE(n,o,s)}function BP(n=i){if(!x)return null;let o=n.now()-x.startedAt,s=x.recorder.stepCount;return{recordingId:x.recordingId,deviceId:x.deviceId,platform:x.platform,startedAt:new Date(x.startedAt).toISOString(),eventCount:s,durationMs:o,captureScope:Bt,...s===0?{notice:je}:{}}}function q(){return x??N?.session??G?.session??null}function uX(n,o){let s=q();if(!s||s.deviceId!==n||s.ownerSessionUuid!==void 0)return!1;return s.ownerSessionUuid=o,!0}function N1(n,o){let s=q();return s!==null&&s.ownerSessionUuid===n&&s.deviceId===o}function $M(n,o){let s=q();return s&&N1(n,o)?s.recordingId:void 0}var Ht=(n,o,s,{stoppedAt:a,omittedInput:d})=>{if(n.length===0)throw new LP(d);let c=new Date(o.startedAt),p=a-o.startedAt,h={name:s,description:`Recorded plan with ${n.length} interaction(s).`,steps:n,mcpVersion:pn(Cn()),metadata:{createdAt:new Date(a).toISOString(),version:"1.0.0",recording:{recordingId:o.recordingId,startedAt:c.toISOString(),stoppedAt:new Date(a).toISOString(),durationMs:p,deviceId:o.deviceId,platform:o.platform,interactionCount:n.length}}};return Gf.validate(h),{plan:h,stepCount:n.length}},$t=(n)=>{if(n&&n.trim().length>0)return n.trim();return`recorded-plan-${new Date().toISOString().replace(/[:.]/g,"-")}`};function Ve(n,o,{ownerSessionUuid:s,baseSessionUuid:a}){if(n.deviceId!==o.deviceId)throw Error(`Recording already active on device ${n.deviceId} (${n.recordingId}). Stop the existing recording before starting a new one on ${o.deviceId}.`);if(!(n.ownerSessionUuid===s||he(n.ownerSessionUuid,s,a??pe)))throw new t(`A recording owned by another session is active on device ${o.deviceId}. Wait for it to stop before starting a recording.`)}async function JE(n,o=i,s=B,{recorderFactory:a=(c)=>new j(c),...d}={}){if(G)return await G.promise.catch(()=>{return}),JE(n,o,s,{recorderFactory:a,...d});let{ownerSessionUuid:c}=d;if(x)return Ve(x,n,d),e.info(`[DeviceGestureRecording] Recording already active (${x.recordingId}), returning existing session`),{recordingId:x.recordingId,startedAt:new Date(x.startedAt).toISOString(),deviceId:x.deviceId,platform:x.platform};if(N)return Ve(N.session,n,d),N.promise;if(n.platform!=="android")throw Error(`Device gesture recording is only supported on Android right now (got ${n.platform}).`);let p=s.next(),h=o.now(),m={recordingId:p,deviceId:n.deviceId,platform:n.platform,startedAt:h,timer:o,recorder:a(n),ownerSessionUuid:c},f=Promise.resolve().then(async()=>{try{return await m.recorder.start(),x=m,e.info(`[DeviceGestureRecording] Started recording ${p} on ${n.deviceId}`),{recordingId:p,startedAt:new Date(h).toISOString(),deviceId:n.deviceId,platform:n.platform}}catch(y){try{await m.recorder.stop()}catch(S){throw u(AggregateError([y,S],"Recorder startup and teardown both failed"),"Failed to start device gesture recording")}throw u(y,"Failed to start device gesture recording")}finally{if(N?.session===m)N=null}});return N={session:m,promise:f},f}function Ut(){return q()?.timer??i}async function fy(n,o,s=Ut(),a={}){if(N)await N.promise;let d=x??G?.session??null;if(!d)throw Error("No active recording. Start a recording before stopping.");if(n&&n!==d.recordingId)throw Error(`Recording ID ${n} does not match active recording ${d.recordingId}.`);if(G?.session===d)return G.promise;x=null;let c=Wt(d,o,s,a).then((p)=>(Yt(d,p),p)).finally(()=>{if(G?.session===d)G=null});return G={session:d,promise:c},c}async function Xt(n,o,s){try{return await l(()=>n.recorder.stop(s),{timer:o,timeoutMs:ze,label:"Stopping device gesture recording",timeoutError:()=>Error(`Device gesture recording stop timed out after ${ze} ms`)})}catch(a){e.warn(`[DeviceGestureRecording] Failed to stop recording ${n.recordingId}`,a);let d=n.recorder.capturedSteps??[];if(d.length===0)throw u(a,"Failed to stop device gesture recording");return{steps:[...d],exportWarnings:[...n.recorder.capturedExportWarnings??[]],salvagedAfter:r(a)}}}function Kt(n){if(!n?.length)return;let o=`Some recorded input was left out of the plan: ${n.join("; ")}.`;return e.warn(`[DeviceGestureRecording] ${o}`),o}async function Wt(n,o,s,a){let{steps:d,touchTrackFailure:c,geometryWarnings:p,exportWarnings:h,salvagedAfter:m}=await Xt(n,s,a),f=c?`Touch track (getevent) stopped ${c.failedAt-n.startedAt} ms after recording start: ${c.error.message}. Later taps may be missing.`:void 0;if(f&&d.length===0)throw u(Error(f,{cause:c?.error}),"Failed to stop device gesture recording");if(f)e.warn(`[DeviceGestureRecording] ${f}`);let y=p?.length?`Display geometry changed or was unreadable during recording: ${p.join("; ")}. Steps labelled "Warning:" may be recorded at the wrong coordinates or direction.`:void 0;if(y)e.warn(`[DeviceGestureRecording] ${y}`);let S=Kt(h),g=m?`Stopping the recorder did not finish (${m}); the steps captured so far are returned without confirming display rotation/size, so tapAt and swipeOn steps recorded after a display change may be at the wrong coordinates or direction.`:void 0;if(g)e.warn(`[DeviceGestureRecording] ${g}`);let w=[f,y,S,g].filter(Boolean).join(" "),_=s.now(),I=$t(o),{plan:J,stepCount:O}=Ht(d,n,I,{stoppedAt:_,omittedInput:S}),U=jS(J,{indent:2,lineWidth:-1,noRefs:!0}),T=_-n.startedAt;return e.info(`[DeviceGestureRecording] Stopped recording ${n.recordingId} with ${O} steps`),{recordingId:n.recordingId,startedAt:new Date(n.startedAt).toISOString(),stoppedAt:new Date(_).toISOString(),durationMs:T,planName:I,planContent:U,stepCount:O,...w?{error:`Warning: ${w}`}:{},deviceId:n.deviceId,platform:n.platform}}
|
|
6
|
+
export{M1,KE,Bf,FP,GE,LG,$f,cX,dX,lX,LM,LP,YE,BM,BP,uX,N1,$M,JE,fy};
|
|
7
|
+
|
|
8
|
+
//# debugId=BCC8B8D14724EC0164756E2164756E21
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,Q,e}from"./chunk-z637nqg8.js";import{rn}from"./chunk-r5bxavdx.js";import{jC}from"./chunk-0qsy1qsx.js";import{E9,Db,AO,p2}from"./chunk-yf7ympyz.js";import{Vp,u}from"./chunk-rbpdk7m0.js";var p=300000;class eM{store;windowMs;constructor(r=new jC,t=p){this.store=r,this.windowMs=t}recordFailure(r,t){let a=this.read().filter((o)=>t-o.at<=this.windowMs);a.push({at:t,kind:r});try{this.store.write(JSON.stringify(a))}catch(o){return e.debug(`Failed to persist startup failure tracker: ${o}`),Math.max(a.length,2)}return a.length}reset(){this.store.clear()}read(){let r=this.store.read();if(r===null)return[];try{let t=JSON.parse(r);if(!Array.isArray(t))return[];return t.filter((a)=>typeof a?.at==="number"&&(a.kind==="transient"||a.kind==="permanent"))}catch(t){return e.debug(`Failed to parse startup failure tracker contents: ${t}`),[]}}}var d=Math.max(1000,rn-2000);async function PU(r,t,a=i){let o=E9(r),n=t.recordFailure(o,a.now()),c=p2(r)?`${o}/${Db}`:o;if(e.error(`Fatal: database initialization failed (${c}; ${n} recent failure(s)); daemon cannot serve queries and will exit for a clean restart: ${Vp(r)}`),o==="permanent"&&n>1){let l=Q({initialDelayMs:1000,multiplier:2,maxDelayMs:d}).delayForAttempt(n-1);e.error(`Database initialization has failed ${n} times; backing off ${l}ms before exit to avoid a restart hot-loop.`),await a.sleep(l)}let s=u(r,"Database initialization failed at daemon startup");if(p2(r))s.code=Db;throw s}function $ae(r){return p2(r)?AO:1}async function Uae(r,t=new eM,a=i){try{await r()}catch(o){await PU(o,t,a)}}
|
|
3
|
+
export{eM,PU,$ae,Uae};
|
|
4
|
+
|
|
5
|
+
//# debugId=B553DAF21686179C64756E2164756E21
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,l,e}from"./chunk-z637nqg8.js";import{ye,cf}from"./chunk-r5bxavdx.js";import{Ete,Dte}from"./chunk-0qsy1qsx.js";import{Q8,Hl,ql,NM,nc,NP}from"./chunk-w3vs79ex.js";import{K8}from"./chunk-6awz7vhq.js";var w=1500,R={shutdownInventoryReads:()=>{cf()},stopAcceptingVideoRecordingStarts:Q8,listActiveVideoRecordings:nc,listOwnedActiveVideoRecordingIds:NP,stopVideoRecording:Hl,forceStopVideoRecording:NM,interruptVideoRecording:ql,shutdownIOSCtrlProxies:()=>ye.shutdownAll(),stopWatchRunners:K8,stopTvosRunners:Dte,stopVisionosRunners:Ete};async function RK(r=R){r.shutdownInventoryReads?.(),r.stopWatchRunners(),r.stopTvosRunners?.(),r.stopVisionosRunners?.();let n=r.timer??i,t=r.timeoutMs??w,c=new Set;try{let o=await a(r.stopAcceptingVideoRecordingStarts(),n,t);if(o.status!=="fulfilled")e.warn(`[Daemon] Failed to quiesce recording starts during shutdown: ${o.error}`);let d=await a(r.listActiveVideoRecordings(),n,t);if(d.status==="fulfilled")for(let m of d.value)c.add(m.recordingId);else e.warn(`[Daemon] Failed to list active recordings during shutdown: ${d.error}`)}catch(o){e.warn(`[Daemon] Failed to list active recordings during shutdown: ${o}`)}h(r,c);let u=a(r.shutdownIOSCtrlProxies(),n,t);await Promise.all(Array.from(c,async(o)=>{try{let d=r.stopVideoRecording(o),m=await a(d,n,t);if(m.status==="fulfilled")return;e.warn(`[Daemon] Failed to stop recording ${o} during shutdown: ${m.error}`);let f=await a(r.forceStopVideoRecording(o),n,t);if(f.status!=="fulfilled")e.warn(`[Daemon] Failed to force-stop recording ${o} during shutdown: ${f.error}`);try{await d;return}catch(g){e.warn(`[Daemon] Recording ${o} did not finish after force-stop: ${g}`)}let p=await a(r.interruptVideoRecording(o),n,t);if(p.status!=="fulfilled")e.warn(`[Daemon] Failed to interrupt recording ${o} during shutdown: ${p.error}`)}catch(d){e.warn(`[Daemon] Unexpected recording cleanup error during shutdown: ${d}`)}}));let s=await u;if(s.status!=="fulfilled")e.warn(`[Daemon] Failed to stop iOS CtrlProxy instances during shutdown: ${s.error}`)}function h(r,n){try{for(let t of r.listOwnedActiveVideoRecordingIds())n.add(t)}catch(t){e.warn(`[Daemon] Failed to list in-memory recordings during shutdown: ${t}`)}}async function a(r,n,t){let c=r.then((o)=>({status:"fulfilled",value:o}),(o)=>({status:"failed",error:o})),u=Error(`timed out after ${t}ms`),s=await l(c,{timer:n,timeoutMs:t,label:"Child process cleanup",timeoutError:()=>u}).then((o)=>({value:o}),(o)=>({error:o}));if("value"in s)return s.value;if(s.error===u)return{status:"failed",error:s.error};throw s.error}
|
|
3
|
+
export{RK};
|
|
4
|
+
|
|
5
|
+
//# debugId=9774530512F502FA64756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qc,EC}from"./chunk-ycaj2sgf.js";import"./chunk-7rz9898k.js";import"./chunk-qyqypn28.js";import"./chunk-fgb98zjj.js";import"./chunk-3xkpk44w.js";import"./chunk-0qsy1qsx.js";import"./chunk-rvvy1bte.js";import"./chunk-r5bxavdx.js";import"./chunk-yf7ympyz.js";import"./chunk-4hw3665t.js";import"./chunk-5d2hft6c.js";import"./chunk-z637nqg8.js";import"./chunk-58wzr3mt.js";export{EC as TapAtCoordinate,Qc as resolveTapAtCoordinates};
|
|
3
|
+
|
|
4
|
+
//# debugId=E16C4C2DAE1D089964756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Sm}from"./chunk-e98dqnc9.js";import{f,I}from"./chunk-58wzr3mt.js";import"./chunk-r5bxavdx.js";import{e}from"./chunk-z637nqg8.js";import{XX,Qi,sH,XM,aH,F,Ks,pi,_H,Pr,Hd,zl,QP,SI}from"./chunk-h5rpn9wr.js";import"./chunk-0qsy1qsx.js";import"./chunk-yf7ympyz.js";import{Cn}from"./chunk-5d2hft6c.js";import{n,Me,aP,Ne}from"./chunk-4hw3665t.js";import{fi,cQ,zq}from"./chunk-hrfytkxh.js";import"./chunk-0n6swkwg.js";import{uS,mN,RI,eA}from"./chunk-w5b2jwk3.js";import{p_,el,uh,Qq,Xs,Cr,Zy,ph,D0,rV,qQ,Qy}from"./chunk-64j0majr.js";import"./chunk-2f9rkmhx.js";import"./chunk-00167wan.js";import"./chunk-3xkpk44w.js";import"./chunk-7rz9898k.js";import"./chunk-65y8v4td.js";import{xr,kI}from"./chunk-dgrbdpb7.js";import"./chunk-0jrrsnc9.js";import"./chunk-84nanf8s.js";import"./chunk-jh6vhqzx.js";import"./chunk-3f3t1x97.js";import"./chunk-vy3bwm1d.js";import"./chunk-ycaj2sgf.js";import"./chunk-3qwrzxh0.js";import"./chunk-thbh3jew.js";import{rM,iM,Vb,Wb,KK}from"./chunk-jd6a5v6p.js";import"./chunk-26k317v5.js";import"./chunk-284ptqa4.js";import"./chunk-w7hkv422.js";import"./chunk-qyqypn28.js";import"./chunk-fgb98zjj.js";import"./chunk-rvvy1bte.js";import"./chunk-v6pya0dm.js";import{r,t,u}from"./chunk-rbpdk7m0.js";function N(){if(I(f.ACCEPTANCE_LIVE)!=="1")return;let o=I(f.ACCEPTANCE_DISCOVERY_ORDER),s=I(f.ACCEPTANCE_DISCOVERY_CAPABILITY);return(o==="forward"||o==="reverse")&&s?{order:o,capability:s}:void 0}function D(o,s,i){if(o.outcome!=="ready"||s!==void 0&&s!==o.sessionUuid)return;return{success:!1,error:{code:"broker_session_ended",message:`Broker session ${o.sessionUuid} for request ${o.requestId} ended (${i}). Device tools cannot acquire a generic replacement on this connection; the launcher must start a new broker request.`,requestId:o.requestId,sessionUuid:o.sessionUuid,reason:i,...fi(i),retryable:!1,nextAction:"relaunch_session_request"}}}function h(o,s){let i=RI(o),d=s&&i&&D(s,i.sessionUuid,i.reason??"unknown");return d?{content:[{type:"text",text:JSON.stringify(d)}],isError:!0}:o}function L(o,s){let i=D(o,s.sessionUuid,s.reason);return i?{content:[{type:"text",text:JSON.stringify(i)}],isError:!0}:void 0}function _(o,s){if(o instanceof Hd&&o.handover.code===pi)return;return o instanceof Pr&&s?L(s,o):void 0}function B(o,s){return s!==void 0&&o.getTerminalSessionRelease()?.sessionUuid===s.sessionUuid}function H(o){return o.sessions.length>0?[_H(o)]:[]}function M(o){if(o instanceof Hd)return o.toPayload();return eA({message:`Session ownership lost for ${o.sessionUuid}: ${o.reason}. `+uS,sessionUuid:o.sessionUuid,reason:o.reason,release:o.release})}function k(o){return JSON.stringify(M(o))}function U(o){return{content:[{type:"text",text:k(o)}],isError:!0}}function E(o){let s=M(o);return new Qi(-32603,k(o),s)}function P(o){return JSON.stringify(mN(o))}function J(o){return{content:[{type:"text",text:P(o)}],isError:!0}}function V(o){return{content:[{type:"text",text:JSON.stringify({error:{code:"ambiguous_session_selector",message:o.message,platform:o.platform,candidates:o.candidates,retryable:!1}})}],isError:!0}}function w(o){return new Qi(-32603,P(o),mN(o))}function j(o,s=!1){let i=p_(s),d={content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i,isError:!0};return Wb(d,Vb(o,!1))}function Y(o){if(o instanceof el){let s=p_(o.requestMayHaveDispatched);return new Qi(-32603,JSON.stringify(s),s)}if(o instanceof xr){let s=kI(o);return new Qi(-32603,JSON.stringify(s),s)}return}function z(o){let s=kI(o);return{content:[{type:"text",text:JSON.stringify(s)}],structuredContent:s,isError:!0}}function O(o){return{error:{code:o.failure.code,message:o.message,retryable:o.failure.retryable,retryAfterMs:o.failure.retryAfterMs,queueWaitMs:o.failure.queueWaitMs,remainingTimeoutMs:o.failure.remainingTimeoutMs}}}function W(o,s=!0){let i=O(o),d={content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i,isError:!0};return Wb(d,Vb(s,!1))}function x(o){let s=O(o);return new Qi(-32603,JSON.stringify(s),s)}var C=-32602;function X(o){if(o===null||typeof o!=="object"||!("code"in o)||o.code!==C)return;let s=r(o).replace(`MCP error ${C}: `,"");return new Qi(C,s)}function b(o){let s=r(o),i=o instanceof Error?o.cause:void 0;if(i instanceof Qy)return`${s} (daemon connection closed before the response arrived while handling ${i.toolName})`;if(i instanceof Cr)return`${s} (request timed out after ${i.timeoutMs}ms while handling ${i.toolName})`;if(i instanceof Error&&(i.name==="AbortError"||i.name==="TimeoutError"))return`${s} (request ${i.name==="TimeoutError"?"timed out":"was aborted"})`;return s}function G(o){let s=Qq(o.failure);return{content:[{type:"text",text:JSON.stringify({error:{message:o.message,...s}})}],isError:!0}}async function K(o,s){try{for(let i of H(s))await o.server.sendLoggingMessage({level:"error",logger:"auto-mobile.liveness",data:i})}catch(i){e.warn("[ProxyServer] Failed to forward liveness handover notification",i)}}async function Q(o,s){try{await o.server.sendLoggingMessage({level:"info",logger:"auto-mobile.liveness",data:{code:"session_device_rebound",sessionUuid:s.sessionId,previousDeviceId:s.previousDeviceId,deviceId:s.deviceId,avdName:s.avdName,stableDeviceId:s.stableDeviceId,generation:s.generation}})}catch(i){e.warn("[ProxyServer] Failed to forward session-device rebound",i)}}async function Z(o,s){try{await o.server.notification({method:"notifications/resources/updated",params:{uri:s}})}catch(i){e.warn("[ProxyServer] Failed to forward resource update notification",i)}}function ee(o,s,i){if(o instanceof Pr)return e.warn(`[ProxyServer] Session ownership lost for ${o.sessionUuid}: ${o.reason}`),U(o);if(o instanceof zl)return e.warn(`[ProxyServer] No active device session (released: ${o.reason})`),J(o);if(o instanceof QP)return e.warn(`[ProxyServer] Ambiguous session selector: ${o.message}`),V(o);if(o instanceof el)return j(i,o.requestMayHaveDispatched);if(o instanceof xr)return z(o);if(o instanceof Xs)return W(o,i);if(o instanceof uh)return e.warn(`[ProxyServer] Device-control transport failure for ${o.failure.toolName} during ${o.failure.phase}`),G(o);return Ks(o,{toolName:s,source:"ProxyServer"})}function re(o){let s={...o?{[cQ]:{...o}}:{}};return Object.keys(s).length>0?{experimental:s}:{}}function oe(o){return{resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},logging:{},prompts:{},...re(o.session)}}function te(o,s){let i={success:!1,error:{code:"session_unavailable",message:`Tool ${s} is unavailable because session request ${o.requestId} is ${o.outcome}. Use the exact bound sessionUuid only after initialize reports ready.`,requestId:o.requestId,outcome:o.outcome,cleanupPending:o.cleanupPending,failure:o.failure??null}};return{isError:!0,content:[{type:"text",text:JSON.stringify(i)}]}}function se(o,s){o.server.setRequestHandler("tools/list",async()=>({tools:[]})),o.server.setRequestHandler("tools/call",async(i)=>te(s,i.params.name))}function ne(o,s){if(s&&s.outcome!=="ready")se(o,s)}async function ie(o,s,i,d){let{name:a,args:c,progressToken:p,extra:y}=s,g=Zy({envelope:y.envelope,meta:y._meta});if(!g){let m=await o.callTool(a,c,p,{onProgress:i,signal:y.signal});return h(m,d.session)}let l=await o.callTool(a,c,p,{onProgress:i,signal:y.signal,declaresTasks:g});return ph(l)?l:h(l,d.session)}var T=aP({taskId:n()}),ae=aP({taskId:n(),inputResponses:Ne(n(),Me()).optional()});function ce(o){let s=o!==null&&typeof o==="object"?Reflect.get(o,"jsonRpcError"):void 0;return rV(s)?qQ(s):o}function ue(o,s){let i=o.server;KK(i);let d=async(a,c,p)=>{if(!Zy({envelope:p.mcpReq.envelope,meta:p.mcpReq._meta}))throw D0();try{return await s.relayTaskMethod(a,c,!0,p.mcpReq.signal)}catch(y){throw p.mcpReq.signal.throwIfAborted(),ce(y)}};i.setRequestHandler("tasks/get",{params:T},async(a,c)=>d("tasks/get",{taskId:a.taskId},c)),i.setRequestHandler("tasks/update",{params:ae},async(a,c)=>{let p=c.mcpReq.inputResponses??a.inputResponses;return d("tasks/update",{taskId:a.taskId,...p!==void 0&&{inputResponses:p}},c)}),i.setRequestHandler("tasks/cancel",{params:T},async(a,c)=>d("tasks/cancel",{taskId:a.taskId},c))}function le(o,s){o.server.setRequestHandler("resources/list",async()=>{try{return{resources:await s.listAdvertisedResources()}}catch(i){if(i instanceof Pr)throw E(i);if(i instanceof zl)throw w(i);if(i instanceof Xs)throw x(i);throw e.error(`[ProxyServer] Failed to list resources: ${i}`),new t(`Failed to list resources from daemon: ${b(i)}`,{cause:i})}}),o.server.setRequestHandler("resources/templates/list",async()=>{try{return{resourceTemplates:await s.listAdvertisedResourceTemplates()}}catch(i){if(i instanceof Pr)throw E(i);if(i instanceof zl)throw w(i);if(i instanceof Xs)throw x(i);throw e.error(`[ProxyServer] Failed to list resource templates: ${i}`),new t(`Failed to list resource templates from daemon: ${b(i)}`,{cause:i})}}),o.server.setRequestHandler("resources/read",async(i,d)=>{let a=i.params.uri;if(!a)throw new t("Resource URI is missing in the request");if(sH(a)){let c=await aH(a);if(c)return c;throw new Sm(a)}e.info(`[ProxyServer] Forwarding resource read: ${a}`);try{let c=XX(o.server.getClientCapabilities());return await s.readResource(a,{signal:d.mcpReq.signal,...c!==void 0&&{_meta:c}})}catch(c){if(d.mcpReq.signal.throwIfAborted(),c instanceof Pr)throw E(c);if(c instanceof zl)throw w(c);if(c instanceof Xs)throw x(c);let p=Y(c);if(p)throw e.warn(`[ProxyServer] Resource read refused, retryable: ${a} - ${c}`),p;let y=X(c);if(y)throw e.warn(`[ProxyServer] Resource read rejected as invalid params: ${a}`),y;throw e.error(`[ProxyServer] Resource read failed: ${a} - ${c}`),new t(`Failed to read resource from daemon: ${b(c)}`,{cause:c})}})}function de(o){let s=N();return new SI({...o,...s?{acceptanceDiscovery:s}:{}})}function fe(o,s,i){return async({name:d,args:a,progressToken:c,progress:p,extra:y})=>{let g=i.get(d)??!1;e.info(`[ProxyServer] Forwarding tool call: ${d}`);let l=p?(m,v,R)=>{p(m,v,R)}:void 0;try{return await ie(o,{name:d,args:a,progressToken:c,extra:y},l,s)}catch(m){y.signal.throwIfAborted();let v=_(m,s.session);if(v)return v;return ee(m,d,g)}}}function Ye(o={}){let s=o.proxy??de(o.proxyConfig),i=new Map,d=0,a=rM({name:"AutoMobile",version:Cn()},oe(o));XM(a),s.onListChanged((l)=>{try{if(l==="tools")d+=1,i.clear(),a.sendToolListChanged();else a.sendResourceListChanged()}catch(m){e.warn(`[ProxyServer] Failed to forward ${l} list_changed notification: ${m}`)}});let c=s.onResourceUpdated((l)=>{Z(a,l)}),p=s.onLivenessHandover((l)=>{K(a,l)}),y=s.onSessionDeviceRebound((l)=>{Q(a,l)}),g=a.server.onclose;return a.server.onclose=()=>{c(),p(),y(),g?.(),s.close().catch((l)=>{e.warn("[ProxyServer] Failed to close daemon proxy",l)})},a.server.setRequestHandler("resources/subscribe",async(l)=>{try{return await s.subscribeResource(l.params.uri),{}}catch(m){throw u(m,"Failed to subscribe to daemon resource")}}),a.server.setRequestHandler("resources/unsubscribe",async(l)=>{try{return await s.unsubscribeResource(l.params.uri),{}}catch(m){throw u(m,"Failed to unsubscribe from daemon resource")}}),a.server.setRequestHandler("ping",async()=>({})),a.server.setRequestHandler("prompts/list",async()=>({prompts:[]})),a.server.setRequestHandler("tools/list",async()=>{try{if(B(s,o.session))return{tools:[]};let l=d,m=await s.listAdvertisedTools(),v=s.isConnected()?m:(()=>{let R=F.getAllTools({includeUnavailable:!0}),q=zq(process.env,new Set(F.getConfigurableToolNames()),o.proxyConfig?.daemonOptions?.enabledTools,o.proxyConfig?.daemonOptions?.disabledTools),A=new Map(R.map((S)=>[S.name,S.defaultEnabled]));return m.filter((S)=>q.get(S.name)??A.get(S.name)??!0)})();if(l===d){i.clear();for(let R of v)i.set(R.name,R.outputSchema!==void 0)}return{tools:v}}catch(l){if(l instanceof Pr)throw E(l);if(l instanceof zl)throw w(l);if(l instanceof Xs)throw x(l);throw e.error(`[ProxyServer] Failed to list tools: ${l}`),new t(`Failed to list tools from daemon: ${b(l)}`,{cause:l})}}),iM(a,{progressFailureMessage:"[ProxyServer] Failed to relay progress notification",execute:fe(s,o,i)},{ambiguousDeviceElicitation:o.ambiguousDeviceElicitation??{}}),le(a,s),ue(a,s),ne(a,o.session),{server:a,proxy:s}}export{de as createDaemonMcpProxy,Ye as createProxyMcpServer};
|
|
3
|
+
|
|
4
|
+
//# debugId=4BE6948B98D2173A64756E2164756E21
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mt,Al,Oie,x,E}from"./chunk-r5bxavdx.js";import{e}from"./chunk-z637nqg8.js";import{vr}from"./chunk-fgb98zjj.js";import{Bm,GC,Sn}from"./chunk-rvvy1bte.js";import{r,t}from"./chunk-rbpdk7m0.js";var T=new vr;function n3(i,o,n){if(n?.aborted||i instanceof mt||i instanceof Error&&i.name==="AbortError")return`Android long press interrupted; press may still be held on the device for up to ${o} ms. Wait ${o} ms before retrying touch input.`;return}function IC(i,o,n){let a=n3(i,o,n);if(a)throw new t(a,{cause:i})}function dL(i,o){let n=i??o.defaultMs;if(!Number.isFinite(n))throw new t("searchUntil.duration must be a number");if(n<o.minMs)throw new t(`searchUntil.duration must be at least ${o.minMs}ms`);if(n>o.maxMs)throw new t(`searchUntil.duration must be at most ${o.maxMs}ms`);return Math.round(n)}function lL(i,o,n){if(!n)return!0;return i.hasContainer?.(o,n)??T.hasContainer(o,n)}function uL(i,o){if(!i)return null;return[i.elementId,i.text].filter(Boolean).length===1?null:`${o} container must specify exactly one of elementId or text`}function pL(i){if(i!==void 0&&i>Bm)throw new t(`longPress duration too large; maximum is ${Bm} ms; requested ${i} ms`)}function mL(i,o){return{success:!1,action:i,error:o,element:{bounds:{left:0,top:0,right:0,bottom:0}}}}function rte(i){return(o=[])=>{for(let n of o)i.add(n)}}function nte(i,o){return i==="doubleTap"&&o===1?" Double tap partially applied: one tap was delivered; the second tap was not confirmed. Do not retry automatically.":""}function ite(i){let o=!1;return()=>{if(!o)o=!0,i()}}class m extends GC{}function D(i){return i instanceof GC&&!(i instanceof m)&&(/timed out|timeout/i.test(i.message)||Al({error:i.message}))}function b(i){return new m(`${i.message} With VoiceOver on, synthetic touches and activation requests can be held or swallowed, so the tap may not have run. Verify with observe; turn VoiceOver off using the accessibility tool ({voiceover:false}), then retry if needed.`,{cause:i})}async function wT(i){try{await i()}catch(o){if(D(o))throw b(o);throw o}}async function ote(i,o){try{await i()}catch(n){if(D(n)&&await C(o))throw b(n);throw n}}async function C(i){try{return await i()}catch(o){return e.warn(`VoiceOver probe after a tap timeout failed: ${r(o)}`,o),!1}}function jV(i,o){if(o.success)x.getExistingInstance(i.deviceId)?.invalidateCache()}async function ste({device:i,action:o,element:n,point:a,durationMs:c,fenceOptions:s,coordinateTap:v}){let{displayFence:y,signal:g}=s,d=n["ios-accessibility-label"]??(typeof n["content-desc"]==="string"&&n["content-desc"]?n["content-desc"]:void 0)??(typeof n.text==="string"&&n.text?n.text:void 0);if(!d){e.info("[TapOnElement] VoiceOver: no label available, falling back to coordinate tap"),await wT(()=>v({displayFence:y,signal:g}));return}let h=o==="longPress"?"long_press":"activate",p=await x.getInstance(i).requestVoiceOverActivate(d,h,Oie(h,c),{bounds:n.bounds,duration:o==="longPress"?c:void 0});if(w(i,p),!p.success)e.warn(`[TapOnElement] VoiceOver action failed for label "${d}": ${p.error??"unknown error"}, falling back to coordinate tap at (${a.x}, ${a.y})`),await wT(()=>v({displayFence:y,signal:g}))}function w(i,o){if(o.dispatched&&o.acknowledged!==!0)throw Sn(o.error);jV(i,o)}class f{accessibilityService;constructor(i){this.accessibilityService=i}async getAccessibilityHierarchy(){return this.accessibilityService.getAccessibilityHierarchy(void 0,{skipWaitForFresh:!1,disableAllFiltering:!0})}async requestTraversalOrder(){return this.accessibilityService.requestTraversalOrder()}async requestCurrentFocus(){return this.accessibilityService.requestCurrentFocus()}async requestTapCoordinates(i){let{x:o,y:n,duration:a=10,onDispatch:c}=i;return this.accessibilityService.requestTapCoordinates({x:o,y:n,duration:a,onDispatch:c})}async requestDoubleTapCoordinates(i,o,n){return this.accessibilityService.requestDoubleTapCoordinates(i,o,n)}async requestAction(i,o,n){return this.accessibilityService.requestAction(i,o,void 0,{signal:n})}async requestNodeAction(i,o,n){return this.accessibilityService.requestNodeAction(i,o,{signal:n})}async supportsNodeActionSelectors(){return this.accessibilityService.supportsNodeActionSelectors()}}class qh{adbFactory;constructor(i){this.adbFactory=i}createDriver(i){return new f(E.getInstance(i,this.adbFactory))}}var l=new Map,u=new Map;function KV(i,o){i3(o.deviceId),l.set(i,{...o}),u.set(i,(u.get(i)??0)+1)}function wo(i){let o=l.get(i);return o?{sessionUuid:i,device:{...o},incarnation:u.get(i)??0}:void 0}function ate(){let i=new Map;for(let o of l.values())i.set(o.deviceId,{...o});return[...i.values()]}function cte(i){l.delete(i),u.delete(i)}function i3(i){for(let[o,n]of l)if(n.deviceId===i)l.delete(o)}function GV(i,o){for(let[n,a]of l)if(a.platform===i&&(i==="android"?a.deviceId.startsWith("emulator-")&&a.name===o:a.deviceId===o))l.delete(n)}var o3=["gesture","threeButton","twoButton"],YV=["corner","double","hole","tall","waterfall"],Vh=200,JV=2,dte=16384;var S={navigationMode:"com.android.internal.systemui.navbar.",displayCutout:"com.android.internal.display.cutout.emulation."},I={gesture:"com.android.internal.systemui.navbar.gestural",threeButton:"com.android.internal.systemui.navbar.threebutton",twoButton:"com.android.internal.systemui.navbar.twobutton"};function XV(i,o){return i.filter((n)=>n.packageName.startsWith(S[o]))}function fL(i,o){return XV(i,o).filter((n)=>n.enabled).map((n)=>n.packageName)}function s3(i,o){if(o==="default"||o==="none")return[];return i==="navigationMode"?[I[o]]:[`com.android.internal.display.cutout.emulation.${o}`]}function hL(i,o){if(o.length===0)return i==="navigationMode"?"default":"none";if(o.length>1)return;let n=o[0].slice(S[i].length);if(i==="displayCutout")return YV.includes(n)?n:void 0;if(n==="gestural"||n.startsWith("gestural_"))return"gesture";return n==="threebutton"?"threeButton":n==="twobutton"?"twoButton":void 0}function ZV(i,o){let n=new Set(XV(i,o).map((s)=>s.packageName)),c=(o==="navigationMode"?o3:YV).filter((s)=>n.has(s3(o,s)[0]));return[o==="navigationMode"?"default":"none",...c]}function QV(i,o){if(i.length===o.length&&o.every((s)=>i.includes(s)))return[];let[a,...c]=o;return[...a===void 0?[]:[`shell cmd overlay enable-exclusive --category ${a}`],...c.map((s)=>`shell cmd overlay enable ${s}`),...i.filter((s)=>!o.includes(s)).map((s)=>`shell cmd overlay disable ${s}`)]}function vw(i){let o={};for(let n of i.matchAll(/^[ \t]*(Physical|Override) size:[ \t]*([^\r\n]*)/gim)){let a=/^(\d+)x(\d+)$/.exec(n[2].trim()),c=n[1].toLowerCase();if(!a||o[c]!==void 0)return;o[c]={width:Number(a[1]),height:Number(a[2])}}return o.physical===void 0?void 0:o}function A(i){return i===void 0||i===0?"":` -d ${i}`}function bw(i){return`shell wm size${A(i)}`}function eW(i,o){return`shell wm size ${i==="default"?"reset":`${i.width}x${i.height}`}${A(o)}`}function _C(i){return i.override??"default"}function bv(i){return i.override??i.physical}function a3(i,o){if(i===void 0||o===void 0||i==="default"||o==="default")return i===o;return i.width===o.width&&i.height===o.height}function gL(i){return i===void 0||i==="default"?String(i):`${i.width}x${i.height}`}
|
|
3
|
+
export{n3,IC,dL,lL,uL,pL,mL,rte,nte,ite,wT,ote,jV,ste,qh,KV,wo,ate,cte,i3,GV,o3,YV,Vh,JV,dte,XV,fL,s3,hL,ZV,QV,vw,bw,eW,_C,bv,a3,gL};
|
|
4
|
+
|
|
5
|
+
//# debugId=BE7514A391C5609864756E2164756E21
|