chatlab-cli 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +2 -1
  2. package/dist/{chat-command-3KUWKS53.mjs → chat-command-IHRNO7J4.mjs} +8 -8
  3. package/dist/{chunk-3J7WTUEE.mjs → chunk-4V6UP7EW.mjs} +2 -2
  4. package/dist/{chunk-YVNZ73O5.mjs → chunk-C3B7RXES.mjs} +3919 -3773
  5. package/dist/chunk-C3B7RXES.mjs.map +1 -0
  6. package/dist/{chunk-27DWKA3L.mjs → chunk-HGV4MUIW.mjs} +4 -4
  7. package/dist/{chunk-LNU4RW5G.mjs → chunk-KWJ5FZ74.mjs} +1182 -1042
  8. package/dist/chunk-KWJ5FZ74.mjs.map +1 -0
  9. package/dist/{chunk-DV4U34MR.mjs → chunk-NHTOSDYI.mjs} +2 -2
  10. package/dist/{chunk-CANPJOIE.mjs → chunk-NSWFHMBZ.mjs} +112 -16
  11. package/dist/chunk-NSWFHMBZ.mjs.map +1 -0
  12. package/dist/{chunk-UVCH2ICD.mjs → chunk-RHA534GU.mjs} +3 -3
  13. package/dist/{chunk-23AIEWCD.mjs → chunk-S7YPBKQ3.mjs} +2 -2
  14. package/dist/{chunk-BLOBEOCG.mjs → chunk-U4F6BNGZ.mjs} +2 -2
  15. package/dist/{chunk-3IGBPOJM.mjs → chunk-ZERQIKI4.mjs} +5 -4
  16. package/dist/chunk-ZERQIKI4.mjs.map +1 -0
  17. package/dist/{chunk-PZM3FHVZ.mjs → chunk-ZTMZ7S7T.mjs} +16 -16
  18. package/dist/chunk-ZTMZ7S7T.mjs.map +1 -0
  19. package/dist/cli.mjs +8 -8
  20. package/dist/contacts-worker.mjs +2 -2
  21. package/dist/global-insight-worker.mjs +1 -1
  22. package/dist/{http-YR26GF7X.mjs → http-Y2WC2UK4.mjs} +11 -11
  23. package/dist/{import-Q3DUACU4.mjs → import-4HF2UNQI.mjs} +7 -7
  24. package/dist/index.mjs +11 -11
  25. package/dist/{mcp-HTVZSGTI.mjs → mcp-DJPDRFTW.mjs} +8 -8
  26. package/dist/people-relationships-worker.mjs +2 -2
  27. package/dist/semantic-index-worker.mjs +1 -1
  28. package/dist/{src-HJL7YZZJ.mjs → src-R7MZLKXQ.mjs} +9 -9
  29. package/dist/{stream-import-MXETSEPW.mjs → stream-import-DX57ANUL.mjs} +7 -7
  30. package/dist/{worker-runtime-DZQDL2E2.mjs → worker-runtime-QMN7OKOZ.mjs} +5 -5
  31. package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-hwRVh048.js +110 -0
  32. package/{dist-web/assets/BufferResource-BXfwfGam.js → dist-cli-web/assets/BufferResource-DwfMBlAa.js} +1 -1
  33. package/dist-cli-web/assets/CanvasRenderer-q312LRsp.js +1 -0
  34. package/dist-cli-web/assets/DataDirCleanupNotice--ee1dY0d.js +1 -0
  35. package/dist-cli-web/assets/EChartWordcloud-BaMgUl0Y.js +1 -0
  36. package/{dist-web/assets/Filter-Irxx0f6j.js → dist-cli-web/assets/Filter-BOb5cLBx.js} +1 -1
  37. package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-DK2z0Jrh.js +1 -0
  38. package/dist-cli-web/assets/MessageExportModal-CFbovWh1.js +1 -0
  39. package/dist-cli-web/assets/PageHeader-B3-W9mvh.js +1 -0
  40. package/{dist-web/assets/RelationshipGalaxyCanvas-ByDU6ZS_.js → dist-cli-web/assets/RelationshipGalaxyCanvas-GEpsKHxV.js} +4 -4
  41. package/{dist-web/assets/RelationshipGalaxyThreeCanvas-DgAlyKjc.js → dist-cli-web/assets/RelationshipGalaxyThreeCanvas-DHOU66Gj.js} +2 -2
  42. package/{dist-web/assets/RenderTargetSystem-Cx5U5HAM.js → dist-cli-web/assets/RenderTargetSystem-PEnnW2yb.js} +1 -1
  43. package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-sNw3hP4c.js +1 -0
  44. package/dist-cli-web/assets/TimeSelect.vue_vue_type_script_setup_true_lang-BtUvMehe.js +1 -0
  45. package/{dist-web/assets/WebGLRenderer-B3Fnp1WX.js → dist-cli-web/assets/WebGLRenderer-BjP_1do7.js} +2 -2
  46. package/{dist-web/assets/WebGPURenderer-DZ0X9N86.js → dist-cli-web/assets/WebGPURenderer-ldVv92u7.js} +2 -2
  47. package/dist-cli-web/assets/annual-summary-time-range-BHClzNvd.js +1 -0
  48. package/dist-cli-web/assets/base-DBJ95yXf.js +1 -0
  49. package/{dist-web/assets/browserAll-BqC9ELNO.js → dist-cli-web/assets/browserAll-CPoMOLKh.js} +1 -1
  50. package/dist-cli-web/assets/cli-web-B5VYO-Dh.js +1 -0
  51. package/{dist-web/assets/dateFormat-CX9atL2g.js → dist-cli-web/assets/dateFormat-Cf2xuaE-.js} +1 -1
  52. package/dist-cli-web/assets/fetch-80O3EH4a.js +1 -0
  53. package/dist-cli-web/assets/fetch-B1km2u3N.js +1 -0
  54. package/dist-cli-web/assets/fetch-BFDKzf1P.js +1 -0
  55. package/dist-cli-web/assets/fetch-BuWxo6oK.js +1 -0
  56. package/{dist-web/assets/fetch-C3KuMfIU.js → dist-cli-web/assets/fetch-C0HHT1Yn.js} +3 -3
  57. package/dist-cli-web/assets/fetch-CXIdj2-_.js +1 -0
  58. package/{dist-web/assets/fetch-CUT9JdXT.js → dist-cli-web/assets/fetch-CtyVktRW.js} +3 -3
  59. package/{dist-web/assets/fetch-th_egarZ.js → dist-cli-web/assets/fetch-DGi_9my2.js} +2 -2
  60. package/dist-cli-web/assets/fetch-Dr41uuXL.js +1 -0
  61. package/dist-cli-web/assets/fetch-J67jyI2k.js +1 -0
  62. package/dist-cli-web/assets/index-5UdyJtVU.js +1 -0
  63. package/dist-cli-web/assets/index-7jm3YI9u.js +53 -0
  64. package/dist-cli-web/assets/index-B7R74Yp7.js +1 -0
  65. package/dist-cli-web/assets/index-BGiTw98l.js +1 -0
  66. package/dist-cli-web/assets/index-Ba21yU86.js +1 -0
  67. package/{dist-web/assets/index-Bm_U0hSr.js → dist-cli-web/assets/index-Bf3gFaid.js} +4 -4
  68. package/dist-cli-web/assets/index-ByQSR8Bj.js +2 -0
  69. package/dist-cli-web/assets/index-CPZYydbc.js +2 -0
  70. package/dist-cli-web/assets/index-D8Q3U-6e.js +1 -0
  71. package/dist-cli-web/assets/index-DGtDxRCd.js +173 -0
  72. package/{dist-web/assets/index-DBb03wVF.css → dist-cli-web/assets/index-DTxnpQiv.css} +1 -1
  73. package/dist-cli-web/assets/index-DmrrdYXH.css +1 -0
  74. package/dist-cli-web/assets/index-DtlTo3nt.js +1 -0
  75. package/dist-cli-web/assets/index-DzQT-qXF.js +1 -0
  76. package/dist-cli-web/assets/index-gpTDI3sq.js +64 -0
  77. package/{dist-web/assets/index-D8Uq3_Dc.css → dist-cli-web/assets/index-lwhCMqhd.css} +1 -1
  78. package/dist-cli-web/assets/index-qsbWn8VP.css +1 -0
  79. package/dist-cli-web/assets/people-page-header-BvQy1GQj.js +1 -0
  80. package/{dist-web/assets/webworkerAll-a_fveCLR.js → dist-cli-web/assets/webworkerAll-DgKQKbNn.js} +1 -1
  81. package/{dist-web → dist-cli-web}/index.html +2 -4
  82. package/package.json +4 -4
  83. package/dist/chunk-3IGBPOJM.mjs.map +0 -1
  84. package/dist/chunk-CANPJOIE.mjs.map +0 -1
  85. package/dist/chunk-LNU4RW5G.mjs.map +0 -1
  86. package/dist/chunk-PZM3FHVZ.mjs.map +0 -1
  87. package/dist/chunk-YVNZ73O5.mjs.map +0 -1
  88. package/dist-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-DfQa9E2W.js +0 -110
  89. package/dist-web/assets/CanvasRenderer-Bvpsbxds.js +0 -1
  90. package/dist-web/assets/DataDirCleanupNotice-C0sCmNL2.js +0 -1
  91. package/dist-web/assets/EChartWordcloud-C5hLT1vS.js +0 -1
  92. package/dist-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-8s6XRB3S.js +0 -1
  93. package/dist-web/assets/MessageExportModal-tTI358HU.js +0 -1
  94. package/dist-web/assets/PageHeader-D5QQI9io.js +0 -1
  95. package/dist-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-CpNjFhpm.js +0 -1
  96. package/dist-web/assets/TimeSelect.vue_vue_type_script_setup_true_lang-DtCKfbaz.js +0 -1
  97. package/dist-web/assets/annual-summary-time-range-CvG74N2l.js +0 -1
  98. package/dist-web/assets/base-DdQRTliS.js +0 -1
  99. package/dist-web/assets/electron-ChQkD5ht.js +0 -1
  100. package/dist-web/assets/electron-DGxVMsvC.js +0 -1
  101. package/dist-web/assets/electron-hcWiB7Gg.js +0 -1
  102. package/dist-web/assets/fetch-3Ifr5YJN.js +0 -1
  103. package/dist-web/assets/fetch-74o_kRZf.js +0 -1
  104. package/dist-web/assets/fetch-BKFznq4l.js +0 -1
  105. package/dist-web/assets/fetch-BPj6IlT-.js +0 -1
  106. package/dist-web/assets/fetch-CoYaXr5K.js +0 -1
  107. package/dist-web/assets/fetch-Dcg6Q6Ei.js +0 -1
  108. package/dist-web/assets/fetch-DxWfYzkB.js +0 -1
  109. package/dist-web/assets/index-B3riRaJA.js +0 -1
  110. package/dist-web/assets/index-BKFGuwJu.css +0 -1
  111. package/dist-web/assets/index-BRDdozcm.js +0 -173
  112. package/dist-web/assets/index-Bg-OiHMa.js +0 -1
  113. package/dist-web/assets/index-BhewGKey.js +0 -2
  114. package/dist-web/assets/index-BpeJ40uK.js +0 -1
  115. package/dist-web/assets/index-C6bwt1H4.js +0 -1
  116. package/dist-web/assets/index-CEJqRkis.js +0 -2
  117. package/dist-web/assets/index-CKLCaqdT.js +0 -1
  118. package/dist-web/assets/index-Ds5PiVyB.js +0 -64
  119. package/dist-web/assets/index-GXMxhYc9.js +0 -1
  120. package/dist-web/assets/index-JyB6Cr8r.js +0 -25
  121. package/dist-web/assets/index-UJl03IYE.css +0 -1
  122. package/dist-web/assets/index-tx-Oal36.js +0 -1
  123. package/dist-web/assets/people-page-header-DGkK0AMO.js +0 -1
  124. package/dist-web/assets/types-CZnACqaB.js +0 -1
  125. package/dist-web/assets/vendor-nuxt-ui-DMdbdSFy.js +0 -15
  126. package/dist-web/assets/vendor-reka-ui-8_x7iKfi.js +0 -15
  127. package/dist-web/assets/web-aZcioccr.js +0 -1
  128. /package/dist/{chat-command-3KUWKS53.mjs.map → chat-command-IHRNO7J4.mjs.map} +0 -0
  129. /package/dist/{chunk-3J7WTUEE.mjs.map → chunk-4V6UP7EW.mjs.map} +0 -0
  130. /package/dist/{chunk-27DWKA3L.mjs.map → chunk-HGV4MUIW.mjs.map} +0 -0
  131. /package/dist/{chunk-DV4U34MR.mjs.map → chunk-NHTOSDYI.mjs.map} +0 -0
  132. /package/dist/{chunk-UVCH2ICD.mjs.map → chunk-RHA534GU.mjs.map} +0 -0
  133. /package/dist/{chunk-23AIEWCD.mjs.map → chunk-S7YPBKQ3.mjs.map} +0 -0
  134. /package/dist/{chunk-BLOBEOCG.mjs.map → chunk-U4F6BNGZ.mjs.map} +0 -0
  135. /package/dist/{http-YR26GF7X.mjs.map → http-Y2WC2UK4.mjs.map} +0 -0
  136. /package/dist/{import-Q3DUACU4.mjs.map → import-4HF2UNQI.mjs.map} +0 -0
  137. /package/dist/{mcp-HTVZSGTI.mjs.map → mcp-DJPDRFTW.mjs.map} +0 -0
  138. /package/dist/{src-HJL7YZZJ.mjs.map → src-R7MZLKXQ.mjs.map} +0 -0
  139. /package/dist/{stream-import-MXETSEPW.mjs.map → stream-import-DX57ANUL.mjs.map} +0 -0
  140. /package/dist/{worker-runtime-DZQDL2E2.mjs.map → worker-runtime-QMN7OKOZ.mjs.map} +0 -0
  141. /package/{dist-web → dist-cli-web}/assets/ActionToolsPanel-Dp-ojXjO.css +0 -0
  142. /package/{dist-web → dist-cli-web}/assets/PageHeader-XIXMTomn.css +0 -0
  143. /package/{dist-web → dist-cli-web}/assets/RelationshipGalaxyThreeCanvas-BluPHjCR.css +0 -0
  144. /package/{dist-web → dist-cli-web}/assets/index-BfO_LpDv.css +0 -0
  145. /package/{dist-web → dist-cli-web}/assets/index-ByUaiVQK.css +0 -0
  146. /package/{dist-web → dist-cli-web}/assets/index-ZsZwPLWy.css +0 -0
  147. /package/{dist-web → dist-cli-web}/assets/logo-DXIuG_WE.svg +0 -0
  148. /package/{dist-web → dist-cli-web}/assets/relationship-galaxy-viewport-Cwfa51ER.js +0 -0
  149. /package/{dist-web → dist-cli-web}/assets/vendor-echarts-B-i_56Av.js +0 -0
  150. /package/{dist-web → dist-cli-web}/assets/vendor-echarts-wordcloud-Ca8n6qS6.js +0 -0
  151. /package/{dist-web → dist-cli-web}/assets/vendor-snapdom--nZvo8Sg.js +0 -0
  152. /package/{dist-web → dist-cli-web}/assets/vendor-zrender-5DcYjSZk.js +0 -0
  153. /package/{dist-web → dist-cli-web}/favicon.ico +0 -0
@@ -1,4 +1,4 @@
1
- import{Y as Ve,N as oe,M as m,G as Ne,b as je,a as $e,Z as le,j as l,r as W,_ as w,$ as qe,a0 as z,a1 as T,R as V,a2 as de,a3 as Ke,T as f,c as g,K as D,a4 as ue,w as ce,a5 as ee,a6 as he,a7 as pe,a8 as fe,a9 as me,x as P,aa as Ye,C as E,D as N,L as y,ab as B,ac as Je,P as Xe,ad as Ze,I as Qe,t as te,ae as re,af as p,e as et,q as O,ag as tt,ah as rt,ai as st,aj as nt}from"./RelationshipGalaxyCanvas-ByDU6ZS_.js";import{F as at}from"./Filter-Irxx0f6j.js";var it=`in vec2 vMaskCoord;
1
+ import{Y as Ve,N as oe,M as m,G as Ne,b as je,a as $e,Z as le,j as l,r as W,_ as w,$ as qe,a0 as z,a1 as T,R as V,a2 as de,a3 as Ke,T as f,c as g,K as D,a4 as ue,w as ce,a5 as ee,a6 as he,a7 as pe,a8 as fe,a9 as me,x as P,aa as Ye,C as E,D as N,L as y,ab as B,ac as Je,P as Xe,ad as Ze,I as Qe,t as te,ae as re,af as p,e as et,q as O,ag as tt,ah as rt,ai as st,aj as nt}from"./RelationshipGalaxyCanvas-GEpsKHxV.js";import{F as at}from"./Filter-BOb5cLBx.js";var it=`in vec2 vMaskCoord;
2
2
  in vec2 vTextureCoord;
3
3
 
4
4
  uniform sampler2D uTexture;
@@ -0,0 +1 @@
1
+ import{d as o,o as r,c as d,n as s,r as n}from"./index-7jm3YI9u.js";const c=o({__name:"ThemeCard",props:{shadow:{type:Boolean,default:!0}},setup(e){return(a,t)=>(r(),d("div",{class:s(["overflow-hidden rounded-2xl bg-card-bg dark:bg-card-dark",{"shadow-elevated":e.shadow}])},[n(a.$slots,"default")],2))}});export{c as _};
@@ -0,0 +1 @@
1
+ import{d as de,A as me,C as fe,w as ge,o as q,c as V,n as C,g as w,K as ye,E as be,T as pe,H as xe,f as E,t as J,L as W,h as X,b as d,a as r,M as Ye,e as h}from"./index-7jm3YI9u.js";import{f as Z}from"./dateFormat-Cf2xuaE-.js";const Q=["recent","quarter","year","custom"],ee=[365,730,1825,0];function De(i){if(!i)return[...Q];const y=new Set(i),l=Q.filter(v=>y.has(v));return l.length>0?l:[...Q]}function Se(i){if(!i)return[...ee];const y=new Set(i),l=ee.filter(v=>y.has(v));return l.length>0?l:[365]}function we(i,y){return[i??"",y?.availableYears.join(",")??"",y?.fullRange?.start??"",y?.fullRange?.end??""].join("|")}const Me={key:1,class:"flex items-center"},he={key:2,class:"flex items-center"},qe={key:3,class:"flex items-center gap-1"},ke=de({__name:"TimeSelect",props:{sessionId:{},modelValue:{},visible:{type:Boolean,default:!0},initialState:{},rangeSource:{},allowedModes:{},allowedRecentDays:{},size:{default:"md"}},emits:["update:modelValue","update:fullRange","update:availableYears"],setup(i,{emit:y}){const l=i,v=y,{t:o}=me(),T=d(!1),m=d([]),s=d(null),z=r(()=>De(l.allowedModes)),I=r(()=>Se(l.allowedRecentDays)),M=r(()=>l.size==="sm"?"xs":"sm"),F=r(()=>l.size==="sm"?"text-xs":"text-sm"),b=d("recent"),p=d(365),f=d(0),c=d(0),g=d(1),x=d(""),Y=d(""),k=d(!1);function R(a){const e=new Date(a*1e3);return{year:e.getFullYear(),quarter:Math.floor(e.getMonth()/3)+1}}function ae(a,e){const t=(e-1)*3,u=new Date(a,t,1,0,0,0),n=new Date(a,t+3,0,23,59,59);return{startTs:Math.floor(u.getTime()/1e3),endTs:Math.floor(n.getTime()/1e3)}}function te(a){const e=new Date(a,0,1,0,0,0),t=new Date(a,11,31,23,59,59);return{startTs:Math.floor(e.getTime()/1e3),endTs:Math.floor(t.getTime()/1e3)}}const le=r(()=>[{label:o("common.timeSelect.mode.recent"),value:"recent"},{label:o("common.timeSelect.mode.quarter"),value:"quarter"},{label:o("common.timeSelect.mode.year"),value:"year"},{label:o("common.timeSelect.mode.custom"),value:"custom"}].filter(a=>z.value.includes(a.value))),ne=r(()=>{const a=new Map([[365,o("common.timeSelect.recent.oneYear")],[730,o("common.timeSelect.recent.twoYears")],[1825,o("common.timeSelect.recent.fiveYears")],[0,o("common.timeSelect.recent.all")]]);return I.value.map(e=>({label:a.get(e)??String(e),value:e}))}),O=r(()=>s.value?R(s.value.start):{year:0,quarter:1}),A=r(()=>s.value?R(s.value.end):{year:0,quarter:1}),se=r(()=>{const a=O.value;return c.value>a.year||c.value===a.year&&g.value>a.quarter}),re=r(()=>{const a=A.value;return c.value<a.year||c.value===a.year&&g.value<a.quarter}),ue=r(()=>m.value.length===0?!1:m.value.indexOf(f.value)<m.value.length-1),oe=r(()=>m.value.length===0?!1:m.value.indexOf(f.value)>0),B=r(()=>o("common.timeSelect.quarter.label",{year:c.value,quarter:g.value})),$=r(()=>o("common.timeSelect.year.label",{year:f.value}));function ie(a){return{365:o("common.timeSelect.display.recent365"),730:o("common.timeSelect.display.recent730"),1825:o("common.timeSelect.display.recent1825")}[a]||""}function N(a){return I.value.includes(a)?a:I.value[0]??365}function ce(){if(!s.value)return null;const a={mode:b.value};switch(b.value){case"recent":{if(a.recentDays=p.value,p.value===0)return{startTs:s.value.start,endTs:s.value.end,displayLabel:Z(s.value.start,s.value.end),isFullRange:!0,state:a};const e=s.value.end;return{startTs:Math.max(e-p.value*86400,s.value.start),endTs:e,displayLabel:ie(p.value),isFullRange:!1,state:a}}case"quarter":return a.quarterYear=c.value,a.quarter=g.value,{...ae(c.value,g.value),displayLabel:B.value,isFullRange:!1,state:a};case"year":return a.year=f.value,{...te(f.value),displayLabel:$.value,isFullRange:!1,state:a};case"custom":{if(a.customStart=x.value,a.customEnd=Y.value,!x.value||!Y.value)return null;let e=h(x.value).startOf("day").unix(),t=h(Y.value).endOf("day").unix();return e>t&&([e,t]=[t,e]),{startTs:e,endTs:t,displayLabel:Z(e,t),isFullRange:!1,state:a}}}}function D(){const a=ce();a&&v("update:modelValue",a)}function U(a){let e=c.value,t=g.value+a;t>4&&(e++,t=1),t<1&&(e--,t=4);const u=O.value,n=A.value;e<u.year||e===u.year&&t<u.quarter||e>n.year||e===n.year&&t>n.quarter||(c.value=e,g.value=t,D())}function P(a){const e=m.value,u=e.indexOf(f.value)-a;u>=0&&u<e.length&&(f.value=e[u],D())}function ve(a){if(s.value)switch(a){case"recent":p.value=N(p.value);break;case"quarter":{const{year:e,quarter:t}=R(s.value.end);c.value=e,g.value=t;break}case"year":{f.value=m.value[0]||new Date(s.value.end*1e3).getFullYear();break}case"custom":{const e=s.value.end,t=Math.max(e-30*86400,s.value.start);x.value=h.unix(t).format("YYYY-MM-DD"),Y.value=h.unix(e).format("YYYY-MM-DD");break}}}const j=r({get:()=>b.value,set:a=>{b.value=a,k.value=!0,ve(a),k.value=!1,D()}}),K=r({get:()=>p.value,set:a=>{p.value=a,D()}}),_=r({get:()=>x.value,set:a=>{x.value=a,Y.value&&D()}}),H=r({get:()=>Y.value,set:a=>{Y.value=a,x.value&&D()}});async function G(){if(!l.rangeSource&&!l.sessionId){m.value=[],s.value=null,v("update:fullRange",null),v("update:availableYears",[]),T.value=!0;return}try{let a,e;if(l.rangeSource)a=l.rangeSource.availableYears,e=l.rangeSource.fullRange;else{const S=Ye();[a,e]=await Promise.all([S.getAvailableYears(l.sessionId),S.getTimeRange(l.sessionId)])}m.value=a,s.value=e,v("update:fullRange",e),v("update:availableYears",a);const t=l.initialState,u=t?.mode??z.value[0]??"recent",n=z.value.includes(u)?u:z.value[0]??"recent";switch(b.value=n,k.value=!0,n){case"recent":p.value=N(t?.recentDays??365);break;case"quarter":{if(t?.quarterYear&&t?.quarter)c.value=t.quarterYear,g.value=t.quarter;else if(e){const{year:S,quarter:L}=R(e.end);c.value=S,g.value=L}break}case"year":{t?.year&&a.includes(t.year)?f.value=t.year:f.value=a[0]||0;break}case"custom":{if(t?.customStart&&t?.customEnd)x.value=t.customStart,Y.value=t.customEnd;else if(e){const S=e.end,L=Math.max(S-30*86400,e.start);x.value=h.unix(L).format("YYYY-MM-DD"),Y.value=h.unix(S).format("YYYY-MM-DD")}break}}k.value=!1,D()}catch(a){console.error("TimeSelect 加载数据失败:",a),m.value=[],s.value=null,v("update:fullRange",null),v("update:availableYears",[])}finally{T.value=!0}}return fe(()=>G()),ge(()=>we(l.sessionId,l.rangeSource),()=>{T.value=!1,G()}),(a,e)=>{const t=ye,u=xe;return T.value?(q(),V("div",{key:0,class:C(["flex items-center gap-2",{invisible:!i.visible}])},[w(t,{modelValue:j.value,"onUpdate:modelValue":e[0]||(e[0]=n=>j.value=n),items:le.value,"value-key":"value",size:M.value,color:"neutral",variant:"soft",ui:{item:"py-1.5"},class:"h-8 w-[88px] shrink-0 rounded-lg bg-elevated focus-visible:ring-1 focus-visible:ring-gray-300/60 dark:focus-visible:ring-white/15"},null,8,["modelValue","items","size"]),b.value==="recent"?(q(),be(pe,{key:0,modelValue:K.value,"onUpdate:modelValue":e[1]||(e[1]=n=>K.value=n),items:ne.value,size:M.value,class:"min-w-0 shrink"},null,8,["modelValue","items","size"])):b.value==="quarter"?(q(),V("div",Me,[w(u,{icon:"i-heroicons-chevron-left",size:M.value,variant:"ghost",color:"neutral",disabled:!se.value,onClick:e[2]||(e[2]=n=>U(-1))},null,8,["size","disabled"]),E("span",{class:C(["whitespace-nowrap px-0.5 font-medium text-gray-700 dark:text-gray-300",F.value])},J(B.value),3),w(u,{icon:"i-heroicons-chevron-right",size:M.value,variant:"ghost",color:"neutral",disabled:!re.value,onClick:e[3]||(e[3]=n=>U(1))},null,8,["size","disabled"])])):b.value==="year"?(q(),V("div",he,[w(u,{icon:"i-heroicons-chevron-left",size:M.value,variant:"ghost",color:"neutral",disabled:!ue.value,onClick:e[4]||(e[4]=n=>P(-1))},null,8,["size","disabled"]),E("span",{class:C(["whitespace-nowrap px-0.5 font-medium text-gray-700 dark:text-gray-300",F.value])},J($.value),3),w(u,{icon:"i-heroicons-chevron-right",size:M.value,variant:"ghost",color:"neutral",disabled:!oe.value,onClick:e[5]||(e[5]=n=>P(1))},null,8,["size","disabled"])])):b.value==="custom"?(q(),V("div",qe,[w(W,{modelValue:_.value,"onUpdate:modelValue":e[6]||(e[6]=n=>_.value=n),"width-class":"w-28",clearable:!1,size:i.size},null,8,["modelValue","size"]),e[8]||(e[8]=E("span",{class:"text-xs text-gray-400"},"-",-1)),w(W,{modelValue:H.value,"onUpdate:modelValue":e[7]||(e[7]=n=>H.value=n),"width-class":"w-28",clearable:!1,size:i.size},null,8,["modelValue","size"])])):X("",!0)],2)):X("",!0)}}});export{ke as _};
@@ -1,4 +1,4 @@
1
- import{D as R,a as F,j as d,z as P,d as B,w as b,g as q,b as Ce,S as O,T as S,ak as Ne,L as Z,al as De,c as T,ab as X,q as y,K as C,N as M,r as g,M as J,am as Q,an as Ie,ao as ee,ap as Ge,aq as Ue,A as Fe,R as Pe}from"./RelationshipGalaxyCanvas-ByDU6ZS_.js";import{e as Oe,G as Me,c as Le,b as we,U as He,B as te,d as N,f as re,g as Ve}from"./BufferResource-BXfwfGam.js";import{R as Xe,S as ke,d as We}from"./RenderTargetSystem-Cx5U5HAM.js";import"./index-JyB6Cr8r.js";import"./vendor-reka-ui-8_x7iKfi.js";import"./vendor-nuxt-ui-DMdbdSFy.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-BhewGKey.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-8s6XRB3S.js";import"./people-page-header-DGkK0AMO.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-Irxx0f6j.js";function je(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class ne{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,i=this._didUploadHash[n.uid];s.shader.bind(n,i),i||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let i=0;i<r.textures.count;i++)n.texture.bind(s[i],i);n.geometry.draw(r.topology,r.size,r.start)}}ne.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var A=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(A||{});class Ke{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class se{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const i=this._boundBufferBases[s];if(i&&i._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:i}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,i=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,i)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,i)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=A.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=A.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=A.UNIFORM_BUFFER);const s=new Ke(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}se.extension={type:[d.WebGLSystem],name:"buffer"};const L=class ie{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...ie.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(b("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&b("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&b("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,i=this.extensions;n.uint32Indices=s||!!i.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!i.vertexArrayObject,n.srgbTextures=s||!!i.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||b("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let $e=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),h=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(h||{});const k={uint8x2:h.UNSIGNED_BYTE,uint8x4:h.UNSIGNED_BYTE,sint8x2:h.BYTE,sint8x4:h.BYTE,unorm8x2:h.UNSIGNED_BYTE,unorm8x4:h.UNSIGNED_BYTE,snorm8x2:h.BYTE,snorm8x4:h.BYTE,uint16x2:h.UNSIGNED_SHORT,uint16x4:h.UNSIGNED_SHORT,sint16x2:h.SHORT,sint16x4:h.SHORT,unorm16x2:h.UNSIGNED_SHORT,unorm16x4:h.UNSIGNED_SHORT,snorm16x2:h.SHORT,snorm16x4:h.SHORT,float16x2:h.HALF_FLOAT,float16x4:h.HALF_FLOAT,float32:h.FLOAT,float32x2:h.FLOAT,float32x3:h.FLOAT,float32x4:h.FLOAT,uint32:h.UNSIGNED_INT,uint32x2:h.UNSIGNED_INT,uint32x3:h.UNSIGNED_INT,uint32x4:h.UNSIGNED_INT,sint32:h.INT,sint32x2:h.INT,sint32x3:h.INT,sint32x4:h.INT};function Ye(t){return k[t]??k.float32}const ze={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class qe{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ae{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,i,a,c)=>{n.drawArraysInstancedANGLE(s,i,a,c)},e.drawElementsInstanced=(s,i,a,c,o)=>{n.drawElementsInstancedANGLE(s,i,a,c,o)},e.vertexAttribDivisor=(s,i)=>n.vertexAttribDivisorANGLE(s,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const i in s)if(!n[i])throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,i=["g",e.uid];for(const a in n)s[a]&&i.push(a,s[a].location);return i.join("-")}getVao(e,r){return e._gpuData[this._renderer.uid]?.vaoCache[r._key]||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const a=this.getSignature(e,r);let c=e._gpuData[this._renderer.uid];c||(c=new qe,e._gpuData[this._renderer.uid]=c,this._managedGeometries.add(e));const o=c.vaoCache;let u=o[a];if(u)return o[r._key]=u,u;Oe(e,r._attributeData);const _=e.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let l=0;l<_.length;l++){const f=_[l];i.bind(f)}return this.activateVao(e,r),o[r._key]=u,o[a]=u,s.bindVertexArray(null),u}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const i in s)this._activeVao!==s[i]&&this.resetState(),this.gl.deleteVertexArray(s[i])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){const n=this._renderer.gl,s=this._renderer.buffer,i=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let a=null;for(const c in i){const o=i[c],u=o.buffer,_=s.getGlBuffer(u),l=r._attributeData[c];if(l){a!==_&&(s.bind(u),a=_);const f=l.location;n.enableVertexAttribArray(f);const m=q(o.format),p=Ye(o.format);if(l.format?.substring(1,4)==="int"?n.vertexAttribIPointer(f,m.size,p,o.stride,o.offset):n.vertexAttribPointer(f,m.size,p,m.normalised,o.stride,o.offset),o.instance)if(this.hasInstance){const E=o.divisor??1;n.vertexAttribDivisor(f,E)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:i}=this._renderer,a=this._activeGeometry,c=ze[e||a.topology];if(s??(s=a.instanceCount),a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,u=o===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;s!==1?i.drawElementsInstanced(c,r||a.indexBuffer.data.length,u,(n||0)*o,s):i.drawElements(c,r||a.indexBuffer.data.length,u,(n||0)*o)}else s!==1?i.drawArraysInstanced(c,n||0,r||a.getSize(),s):i.drawArrays(c,n||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ae.extension={type:[d.WebGLSystem],name:"geometry"};const Ze=new Ne({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class oe{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...oe.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(b("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new Ce({vertex:`
1
+ import{D as R,a as F,j as d,z as P,d as B,w as b,g as q,b as Ce,S as O,T as S,ak as Ne,L as Z,al as De,c as T,ab as X,q as y,K as C,N as M,r as g,M as J,am as Q,an as Ie,ao as ee,ap as Ge,aq as Ue,A as Fe,R as Pe}from"./RelationshipGalaxyCanvas-GEpsKHxV.js";import{e as Oe,G as Me,c as Le,b as we,U as He,B as te,d as N,f as re,g as Ve}from"./BufferResource-DwfMBlAa.js";import{R as Xe,S as ke,d as We}from"./RenderTargetSystem-PEnnW2yb.js";import"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-CPZYydbc.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-DK2z0Jrh.js";import"./people-page-header-BvQy1GQj.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-BOb5cLBx.js";function je(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class ne{constructor(){this._tempState=F.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,i=this._didUploadHash[n.uid];s.shader.bind(n,i),i||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let i=0;i<r.textures.count;i++)n.texture.bind(s[i],i);n.geometry.draw(r.topology,r.size,r.start)}}ne.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var A=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(A||{});class Ke{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class se{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new P({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const i=this._boundBufferBases[s];if(i&&i._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:i}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,i=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,i)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,i)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=A.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=A.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=A.UNIFORM_BUFFER);const s=new Ke(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}se.extension={type:[d.WebGLSystem],name:"buffer"};const L=class ie{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...ie.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(b("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&b("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&b("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,i=this.extensions;n.uint32Indices=s||!!i.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!i.vertexArrayObject,n.srgbTextures=s||!!i.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||b("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let $e=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),h=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(h||{});const k={uint8x2:h.UNSIGNED_BYTE,uint8x4:h.UNSIGNED_BYTE,sint8x2:h.BYTE,sint8x4:h.BYTE,unorm8x2:h.UNSIGNED_BYTE,unorm8x4:h.UNSIGNED_BYTE,snorm8x2:h.BYTE,snorm8x4:h.BYTE,uint16x2:h.UNSIGNED_SHORT,uint16x4:h.UNSIGNED_SHORT,sint16x2:h.SHORT,sint16x4:h.SHORT,unorm16x2:h.UNSIGNED_SHORT,unorm16x4:h.UNSIGNED_SHORT,snorm16x2:h.SHORT,snorm16x4:h.SHORT,float16x2:h.HALF_FLOAT,float16x4:h.HALF_FLOAT,float32:h.FLOAT,float32x2:h.FLOAT,float32x3:h.FLOAT,float32x4:h.FLOAT,uint32:h.UNSIGNED_INT,uint32x2:h.UNSIGNED_INT,uint32x3:h.UNSIGNED_INT,uint32x4:h.UNSIGNED_INT,sint32:h.INT,sint32x2:h.INT,sint32x3:h.INT,sint32x4:h.INT};function Ye(t){return k[t]??k.float32}const ze={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class qe{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ae{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new P({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,i,a,c)=>{n.drawArraysInstancedANGLE(s,i,a,c)},e.drawElementsInstanced=(s,i,a,c,o)=>{n.drawElementsInstancedANGLE(s,i,a,c,o)},e.vertexAttribDivisor=(s,i)=>n.vertexAttribDivisorANGLE(s,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const i in s)if(!n[i])throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,i=["g",e.uid];for(const a in n)s[a]&&i.push(a,s[a].location);return i.join("-")}getVao(e,r){return e._gpuData[this._renderer.uid]?.vaoCache[r._key]||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const a=this.getSignature(e,r);let c=e._gpuData[this._renderer.uid];c||(c=new qe,e._gpuData[this._renderer.uid]=c,this._managedGeometries.add(e));const o=c.vaoCache;let u=o[a];if(u)return o[r._key]=u,u;Oe(e,r._attributeData);const _=e.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let l=0;l<_.length;l++){const f=_[l];i.bind(f)}return this.activateVao(e,r),o[r._key]=u,o[a]=u,s.bindVertexArray(null),u}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const i in s)this._activeVao!==s[i]&&this.resetState(),this.gl.deleteVertexArray(s[i])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){const n=this._renderer.gl,s=this._renderer.buffer,i=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let a=null;for(const c in i){const o=i[c],u=o.buffer,_=s.getGlBuffer(u),l=r._attributeData[c];if(l){a!==_&&(s.bind(u),a=_);const f=l.location;n.enableVertexAttribArray(f);const m=q(o.format),p=Ye(o.format);if(l.format?.substring(1,4)==="int"?n.vertexAttribIPointer(f,m.size,p,o.stride,o.offset):n.vertexAttribPointer(f,m.size,p,m.normalised,o.stride,o.offset),o.instance)if(this.hasInstance){const E=o.divisor??1;n.vertexAttribDivisor(f,E)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:i}=this._renderer,a=this._activeGeometry,c=ze[e||a.topology];if(s??(s=a.instanceCount),a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,u=o===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;s!==1?i.drawElementsInstanced(c,r||a.indexBuffer.data.length,u,(n||0)*o,s):i.drawElements(c,r||a.indexBuffer.data.length,u,(n||0)*o)}else s!==1?i.drawArraysInstanced(c,n||0,r||a.getSize(),s):i.drawArrays(c,n||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ae.extension={type:[d.WebGLSystem],name:"geometry"};const Ze=new Ne({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class oe{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...oe.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(b("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=F.for2d();const s=new Ce({vertex:`
2
2
  attribute vec2 aPosition;
3
3
  out vec2 vUv;
4
4
 
@@ -153,4 +153,4 @@ import{D as R,a as F,j as d,z as P,d as B,w as b,g as q,b as Ce,S as O,T as S,ak
153
153
  cv = cu.value;
154
154
  v = uv["${n}"];
155
155
  ${c};`)}}return new Function("ud","uv","renderer","syncData",r.join(`
156
- `))}class pe{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,r,n){const s=this._renderer.shader._getProgramData(r);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,r)(s.uniformData,e.uniforms,this._renderer,n))}_getUniformSyncFunction(e,r){return this._uniformGroupSyncHash[e._signature]?.[r._key]||this._createUniformSyncFunction(e,r)}_createUniformSyncFunction(e,r){const n=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,r._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,r._uniformData)),n[r._key]=this._cache[s],n[r._key]}_generateUniformsSync(e,r){return mt(e,r)}_getSignature(e,r,n){const s=e.uniforms,i=[`${n}-`];for(const a in s)i.push(a),r[a]&&i.push(r[a].type);return i.join("-")}destroy(){this._renderer=null,this._cache=null}}pe.extension={type:[d.WebGLSystem],name:"uniformGroup"};function Et(t){const e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof R.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{const n=t.getExtension("EXT_blend_minmax");n&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,n.MIN_EXT,n.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,n.MAX_EXT,n.MAX_EXT])}return e}const bt=0,pt=1,St=2,Rt=3,gt=4,Tt=5,Se=class U{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[bt]=this.setBlend,this.map[pt]=this.setOffset,this.map[St]=this.setCullFace,this.map[Rt]=this.setDepthTest,this.map[gt]=this.setFrontFace,this.map[Tt]=this.setDepthMask,this.checks=[],this.defaultState=F.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=Et(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,n=0;for(;r;)r&1&&this.map[n].call(this,!!(e.data&1<<n)),r>>=1,n++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(U._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(U._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;const r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;const r=this.blendModesMap[e],n=this.gl;r.length===2?n.blendFunc(r[0],r[1]):n.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,n.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,r){const n=this.checks.indexOf(e);r&&n===-1?this.checks.push(e):!r&&n!==-1&&this.checks.splice(n,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Se.extension={type:[d.WebGLSystem],name:"state"};let xt=Se;class vt{constructor(e){this.target=w.TEXTURE_2D,this._layerInitMask=0,this.texture=e,this.width=-1,this.height=-1,this.type=h.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.format=G.RGBA,this.samplerType=0}destroy(){}}const At={id:"buffer",upload(t,e,r,n,s,i=!1){const a=s||e.target;!i&&e.width===t.width&&e.height===t.height?r.texSubImage2D(a,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(a,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}},Bt={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},yt={id:"compressed",upload(t,e,r,n,s,i){const a=s??e.target;r.pixelStorei(r.UNPACK_ALIGNMENT,4);let c=t.pixelWidth,o=t.pixelHeight;const u=!!Bt[t.format];for(let _=0;_<t.resource.length;_++){const l=t.resource[_];u?r.compressedTexImage2D(a,_,e.internalFormat,c,o,0,l):r.texImage2D(a,_,e.internalFormat,c,o,0,e.format,e.type,l),c=Math.max(c>>1,1),o=Math.max(o>>1,1)}}},$=["right","left","top","bottom","front","back"];function Ct(t){return{id:"cube",upload(e,r,n,s){const i=e.faces;for(let a=0;a<$.length;a++){const c=$[a],o=i[c];(t[o.uploadMethodId]||t.image).upload(o,r,n,s,w.TEXTURE_CUBE_MAP_POSITIVE_X+a,(r._layerInitMask&1<<a)===0),r._layerInitMask|=1<<a}r.width=e.pixelWidth,r.height=e.pixelHeight}}}const Re={id:"image",upload(t,e,r,n,s,i=!1){const a=s||e.target,c=t.pixelWidth,o=t.pixelHeight,u=t.resourceWidth,_=t.resourceHeight,l=n===2,f=i||e.width!==c||e.height!==o,m=u>=c&&_>=o,p=t.resource;(l?Nt:Dt)(r,a,e,c,o,u,_,p,f,m),e.width=c,e.height=o}};function Nt(t,e,r,n,s,i,a,c,o,u){if(!u){o&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,i,a,r.format,r.type,c);return}if(!o){t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,c)}function Dt(t,e,r,n,s,i,a,c,o,u){if(!u){o&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}if(!o){t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}t.texImage2D(e,0,r.internalFormat,r.format,r.type,c)}const It=je(),Gt={id:"video",upload(t,e,r,n,s,i=It){if(!t.isValid){const a=s??e.target;r.texImage2D(a,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Re.upload(t,e,r,n,s,i)}},Y={linear:9729,nearest:9728},Ut={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},I={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Ft={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function z(t,e,r,n,s,i,a,c){const o=i;if(!c||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){const u=I[a?"clamp-to-edge":t.addressModeU],_=I[a?"clamp-to-edge":t.addressModeV],l=I[a?"clamp-to-edge":t.addressModeW];e[s](o,e.TEXTURE_WRAP_S,u),e[s](o,e.TEXTURE_WRAP_T,_),e.TEXTURE_WRAP_R&&e[s](o,e.TEXTURE_WRAP_R,l)}if((!c||t.magFilter!=="linear")&&e[s](o,e.TEXTURE_MAG_FILTER,Y[t.magFilter]),r){if(!c||t.mipmapFilter!=="linear"){const u=Ut[t.minFilter][t.mipmapFilter];e[s](o,e.TEXTURE_MIN_FILTER,u)}}else e[s](o,e.TEXTURE_MIN_FILTER,Y[t.minFilter]);if(n&&t.maxAnisotropy>1){const u=Math.min(t.maxAnisotropy,e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](o,n.TEXTURE_MAX_ANISOTROPY_EXT,u)}t.compare&&e[s](o,e.TEXTURE_COMPARE_FUNC,Ft[t.compare])}function Pt(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}function Ot(t,e){let r={},n=t.RGBA;return t instanceof R.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},n=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:n,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Mt(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Lt(t){return{"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP,"1d":null,"3d":t?.TEXTURE_3D||null,"2d-array":t?.TEXTURE_2D_ARRAY||null,"cube-array":t?.TEXTURE_CUBE_MAP_ARRAY||null}}const wt=4,V=class ge{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._managedTextures=new P({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const r={image:Re,buffer:At,video:Gt,compressed:yt,...ge.uploadExtensions};this._uploads={...r,cube:Ct(r)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Ot(e,this._renderer.context.extensions),this._mapFormatToType=Mt(e),this._mapFormatToFormat=Pt(e),this._mapViewDimensionToGlTarget=Lt(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(S.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){const n=e.source;e?(this.bindSource(n,r),this._useSeparateSamplers&&this._bindSampler(n.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){const n=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=S.EMPTY.source);const s=this.getGlSource(e);n.bindTexture(s.target,s.texture)}}_bindSampler(e,r=0){const n=this._gl;if(!e){this._boundSamplers[r]=null,n.bindSampler(r,null);return}const s=this._getGlSampler(e);this._boundSamplers[r]!==s&&(this._boundSamplers[r]=s,n.bindSampler(r,s))}unbind(e){const r=e.source,n=this._boundTextures,s=this._gl;for(let i=0;i<n.length;i++)if(n[i]===r){this._activateLocation(i);const a=this.getGlSource(r);s.bindTexture(a.target,null),n[i]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){const r=this._gl,n=new vt(r.createTexture());if(n.type=this._mapFormatToType[e.format],n.internalFormat=this._mapFormatToInternalFormat[e.format],n.format=this._mapFormatToFormat[e.format],n.target=this._mapViewDimensionToGlTarget[e.viewDimension],n.target===null)throw new Error(`Unsupported view dimension: ${e.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(e.uploadMethodId==="cube"&&(n.target=r.TEXTURE_CUBE_MAP),e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){const i=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(i))+1}return e._gpuData[this._renderer.uid]=n,this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),this.updateStyle(e,!1),n}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,r){const n=this._gl,s=this.getGlSource(e);n.bindTexture(s.target,s.texture),this._boundTextures[this._activeTextureLocation]=e,z(e.style,n,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.target,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||(this.unbind(e),this._gl.deleteTexture(n.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const r=this._gl,n=this.getGlSource(e);r.bindTexture(n.target,n.texture),this._boundTextures[this._activeTextureLocation]=e;const s=e.alphaMode==="premultiply-alpha-on-upload";if(this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId])this._uploads[e.uploadMethodId].upload(e,n,r,this._renderer.context.webGLVersion);else if(n.target===r.TEXTURE_2D)this._initEmptyTexture2D(n,e);else if(n.target===r.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(n,e);else if(n.target===r.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(n,e);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(n,e),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);const n=this.getGlSource(e);this._gl.generateMipmap(n.target)}_initEmptyTexture2D(e,r){const n=this._gl;n.texImage2D(n.TEXTURE_2D,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let s=Math.max(r.pixelWidth>>1,1),i=Math.max(r.pixelHeight>>1,1);for(let a=1;a<r.mipLevelCount;a++)n.texImage2D(n.TEXTURE_2D,a,e.internalFormat,s,i,0,e.format,e.type,null),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}_initEmptyTexture2DArray(e,r){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");const n=this._gl,s=Math.max(r.arrayLayerCount|0,1);n.texImage3D(n.TEXTURE_2D_ARRAY,0,e.internalFormat,r.pixelWidth,r.pixelHeight,s,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let c=1;c<r.mipLevelCount;c++)n.texImage3D(n.TEXTURE_2D_ARRAY,c,e.internalFormat,i,a,s,0,e.format,e.type,null),i=Math.max(i>>1,1),a=Math.max(a>>1,1)}_initEmptyTextureCube(e,r){const n=this._gl,s=6;for(let c=0;c<s;c++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let c=1;c<r.mipLevelCount;c++){for(let o=0;o<s;o++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+o,c,e.internalFormat,i,a,0,e.format,e.type,null);i=Math.max(i>>1,1),a=Math.max(a>>1,1)}}_applyMipRange(e,r){if(this._renderer.context.webGLVersion!==2||r.mipLevelCount<=1)return;const n=this._gl,s=Math.max((r.mipLevelCount|0)-1,0);n.texParameteri(e.target,n.TEXTURE_BASE_LEVEL,0),n.texParameteri(e.target,n.TEXTURE_MAX_LEVEL,s)}_initSampler(e){const r=this._gl,n=this._gl.createSampler();return this._glSamplers[e._resourceId]=n,z(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",n,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:r,width:n,height:s}=this.getPixels(e),i=R.get().createCanvas();i.width=n,i.height=s;const a=i.getContext("2d");if(a){const c=a.createImageData(n,s);c.data.set(r),a.putImageData(c,0,0)}return i}getPixels(e){const r=e.source.resolution,n=e.frame,s=Math.max(Math.round(n.width*r),1),i=Math.max(Math.round(n.height*r),1),a=new Uint8Array(wt*s*i),c=this._renderer,o=c.renderTarget.getRenderTarget(e),u=c.renderTarget.getGpuRenderTarget(o),_=c.gl;return _.bindFramebuffer(_.FRAMEBUFFER,u.resolveTargetFramebuffer),_.readPixels(Math.round(n.x*r),Math.round(n.y*r),s,i,_.RGBA,_.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:i}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(S.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};V.extension={type:[d.WebGLSystem],name:"texture"};V.uploadExtensions=Object.create(null);let Te=V;g.handleByMap(d.TextureUploaderWebGL,Te.uploadExtensions);class xe{contextChange(e){const r=new M({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new J,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),n=e.limits.maxBatchableTextures,s=Q({name:"graphics",bits:[Ie,Ge(n),re,ee]});this.shader=new O({glProgram:s,resources:{localUniforms:r,batchSamplers:Ue(n)}})}execute(e,r){const n=r.context,s=n.customShader||this.shader,i=e.renderer,a=i.graphicsContext,{batcher:c,instructions:o}=a.getContextRenderData(n);s.groups[0]=i.globalUniforms.bindGroup,i.state.set(e.state),i.shader.bind(s),i.geometry.bind(c.geometry,s.glProgram);const u=o.instructions;for(let _=0;_<o.instructionSize;_++){const l=u[_];if(l.size){for(let f=0;f<l.textures.count;f++)i.texture.bind(l.textures.textures[f],f);i.geometry.draw(l.topology,l.size,l.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}xe.extension={type:[d.WebGLPipesAdaptor],name:"graphics"};class ve{init(){const e=Q({name:"mesh",bits:[re,Ve,ee]});this._shader=new O({glProgram:e,resources:{uTexture:S.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new J}}}})}execute(e,r){const n=e.renderer;let s=r._shader;if(s){if(!s.glProgram){b("Mesh shader has no glProgram",r.shader);return}}else{s=this._shader;const i=r.texture,a=i.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=i.textureMatrix.mapCoord}s.groups[100]=n.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,n.encoder.draw({geometry:r._geometry,shader:s,state:r.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ve.extension={type:[d.WebGLPipesAdaptor],name:"mesh"};const Ht=[...ke,he,Je,$e,_e,se,Te,de,ae,pe,be,ue,xt,le,ce],Vt=[...We],Xt=[ne,ve,xe],Ae=[],Be=[],ye=[];g.handleByNamedList(d.WebGLSystem,Ae);g.handleByNamedList(d.WebGLPipes,Be);g.handleByNamedList(d.WebGLPipesAdaptor,ye);g.add(...Ht,...Vt,...Xt);class tr extends Fe{constructor(){const e={name:"webgl",type:Pe.WEBGL,systems:Ae,renderPipes:Be,renderPipeAdaptors:ye};super(e)}}export{tr as WebGLRenderer};
156
+ `))}class pe{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,r,n){const s=this._renderer.shader._getProgramData(r);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,r)(s.uniformData,e.uniforms,this._renderer,n))}_getUniformSyncFunction(e,r){return this._uniformGroupSyncHash[e._signature]?.[r._key]||this._createUniformSyncFunction(e,r)}_createUniformSyncFunction(e,r){const n=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,r._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,r._uniformData)),n[r._key]=this._cache[s],n[r._key]}_generateUniformsSync(e,r){return mt(e,r)}_getSignature(e,r,n){const s=e.uniforms,i=[`${n}-`];for(const a in s)i.push(a),r[a]&&i.push(r[a].type);return i.join("-")}destroy(){this._renderer=null,this._cache=null}}pe.extension={type:[d.WebGLSystem],name:"uniformGroup"};function Et(t){const e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof R.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{const n=t.getExtension("EXT_blend_minmax");n&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,n.MIN_EXT,n.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,n.MAX_EXT,n.MAX_EXT])}return e}const bt=0,pt=1,St=2,Rt=3,gt=4,Tt=5,Se=class U{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[bt]=this.setBlend,this.map[pt]=this.setOffset,this.map[St]=this.setCullFace,this.map[Rt]=this.setDepthTest,this.map[gt]=this.setFrontFace,this.map[Tt]=this.setDepthMask,this.checks=[],this.defaultState=F.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=Et(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,n=0;for(;r;)r&1&&this.map[n].call(this,!!(e.data&1<<n)),r>>=1,n++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(U._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(U._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;const r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;const r=this.blendModesMap[e],n=this.gl;r.length===2?n.blendFunc(r[0],r[1]):n.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,n.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,r){const n=this.checks.indexOf(e);r&&n===-1?this.checks.push(e):!r&&n!==-1&&this.checks.splice(n,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Se.extension={type:[d.WebGLSystem],name:"state"};let xt=Se;class vt{constructor(e){this.target=w.TEXTURE_2D,this._layerInitMask=0,this.texture=e,this.width=-1,this.height=-1,this.type=h.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.format=G.RGBA,this.samplerType=0}destroy(){}}const At={id:"buffer",upload(t,e,r,n,s,i=!1){const a=s||e.target;!i&&e.width===t.width&&e.height===t.height?r.texSubImage2D(a,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(a,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}},Bt={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},yt={id:"compressed",upload(t,e,r,n,s,i){const a=s??e.target;r.pixelStorei(r.UNPACK_ALIGNMENT,4);let c=t.pixelWidth,o=t.pixelHeight;const u=!!Bt[t.format];for(let _=0;_<t.resource.length;_++){const l=t.resource[_];u?r.compressedTexImage2D(a,_,e.internalFormat,c,o,0,l):r.texImage2D(a,_,e.internalFormat,c,o,0,e.format,e.type,l),c=Math.max(c>>1,1),o=Math.max(o>>1,1)}}},$=["right","left","top","bottom","front","back"];function Ct(t){return{id:"cube",upload(e,r,n,s){const i=e.faces;for(let a=0;a<$.length;a++){const c=$[a],o=i[c];(t[o.uploadMethodId]||t.image).upload(o,r,n,s,w.TEXTURE_CUBE_MAP_POSITIVE_X+a,(r._layerInitMask&1<<a)===0),r._layerInitMask|=1<<a}r.width=e.pixelWidth,r.height=e.pixelHeight}}}const Re={id:"image",upload(t,e,r,n,s,i=!1){const a=s||e.target,c=t.pixelWidth,o=t.pixelHeight,u=t.resourceWidth,_=t.resourceHeight,l=n===2,f=i||e.width!==c||e.height!==o,m=u>=c&&_>=o,p=t.resource;(l?Nt:Dt)(r,a,e,c,o,u,_,p,f,m),e.width=c,e.height=o}};function Nt(t,e,r,n,s,i,a,c,o,u){if(!u){o&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,i,a,r.format,r.type,c);return}if(!o){t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,c)}function Dt(t,e,r,n,s,i,a,c,o,u){if(!u){o&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}if(!o){t.texSubImage2D(e,0,0,0,r.format,r.type,c);return}t.texImage2D(e,0,r.internalFormat,r.format,r.type,c)}const It=je(),Gt={id:"video",upload(t,e,r,n,s,i=It){if(!t.isValid){const a=s??e.target;r.texImage2D(a,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Re.upload(t,e,r,n,s,i)}},Y={linear:9729,nearest:9728},Ut={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},I={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Ft={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function z(t,e,r,n,s,i,a,c){const o=i;if(!c||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){const u=I[a?"clamp-to-edge":t.addressModeU],_=I[a?"clamp-to-edge":t.addressModeV],l=I[a?"clamp-to-edge":t.addressModeW];e[s](o,e.TEXTURE_WRAP_S,u),e[s](o,e.TEXTURE_WRAP_T,_),e.TEXTURE_WRAP_R&&e[s](o,e.TEXTURE_WRAP_R,l)}if((!c||t.magFilter!=="linear")&&e[s](o,e.TEXTURE_MAG_FILTER,Y[t.magFilter]),r){if(!c||t.mipmapFilter!=="linear"){const u=Ut[t.minFilter][t.mipmapFilter];e[s](o,e.TEXTURE_MIN_FILTER,u)}}else e[s](o,e.TEXTURE_MIN_FILTER,Y[t.minFilter]);if(n&&t.maxAnisotropy>1){const u=Math.min(t.maxAnisotropy,e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](o,n.TEXTURE_MAX_ANISOTROPY_EXT,u)}t.compare&&e[s](o,e.TEXTURE_COMPARE_FUNC,Ft[t.compare])}function Pt(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}function Ot(t,e){let r={},n=t.RGBA;return t instanceof R.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},n=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:n,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Mt(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Lt(t){return{"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP,"1d":null,"3d":t?.TEXTURE_3D||null,"2d-array":t?.TEXTURE_2D_ARRAY||null,"cube-array":t?.TEXTURE_CUBE_MAP_ARRAY||null}}const wt=4,V=class ge{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._managedTextures=new P({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const r={image:Re,buffer:At,video:Gt,compressed:yt,...ge.uploadExtensions};this._uploads={...r,cube:Ct(r)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Ot(e,this._renderer.context.extensions),this._mapFormatToType=Mt(e),this._mapFormatToFormat=Pt(e),this._mapViewDimensionToGlTarget=Lt(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(S.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){const n=e.source;e?(this.bindSource(n,r),this._useSeparateSamplers&&this._bindSampler(n.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){const n=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=S.EMPTY.source);const s=this.getGlSource(e);n.bindTexture(s.target,s.texture)}}_bindSampler(e,r=0){const n=this._gl;if(!e){this._boundSamplers[r]=null,n.bindSampler(r,null);return}const s=this._getGlSampler(e);this._boundSamplers[r]!==s&&(this._boundSamplers[r]=s,n.bindSampler(r,s))}unbind(e){const r=e.source,n=this._boundTextures,s=this._gl;for(let i=0;i<n.length;i++)if(n[i]===r){this._activateLocation(i);const a=this.getGlSource(r);s.bindTexture(a.target,null),n[i]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){const r=this._gl,n=new vt(r.createTexture());if(n.type=this._mapFormatToType[e.format],n.internalFormat=this._mapFormatToInternalFormat[e.format],n.format=this._mapFormatToFormat[e.format],n.target=this._mapViewDimensionToGlTarget[e.viewDimension],n.target===null)throw new Error(`Unsupported view dimension: ${e.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(e.uploadMethodId==="cube"&&(n.target=r.TEXTURE_CUBE_MAP),e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){const i=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(i))+1}return e._gpuData[this._renderer.uid]=n,this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),this.updateStyle(e,!1),n}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,r){const n=this._gl,s=this.getGlSource(e);n.bindTexture(s.target,s.texture),this._boundTextures[this._activeTextureLocation]=e,z(e.style,n,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.target,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||(this.unbind(e),this._gl.deleteTexture(n.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const r=this._gl,n=this.getGlSource(e);r.bindTexture(n.target,n.texture),this._boundTextures[this._activeTextureLocation]=e;const s=e.alphaMode==="premultiply-alpha-on-upload";if(this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId])this._uploads[e.uploadMethodId].upload(e,n,r,this._renderer.context.webGLVersion);else if(n.target===r.TEXTURE_2D)this._initEmptyTexture2D(n,e);else if(n.target===r.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(n,e);else if(n.target===r.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(n,e);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(n,e),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);const n=this.getGlSource(e);this._gl.generateMipmap(n.target)}_initEmptyTexture2D(e,r){const n=this._gl;n.texImage2D(n.TEXTURE_2D,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let s=Math.max(r.pixelWidth>>1,1),i=Math.max(r.pixelHeight>>1,1);for(let a=1;a<r.mipLevelCount;a++)n.texImage2D(n.TEXTURE_2D,a,e.internalFormat,s,i,0,e.format,e.type,null),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}_initEmptyTexture2DArray(e,r){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");const n=this._gl,s=Math.max(r.arrayLayerCount|0,1);n.texImage3D(n.TEXTURE_2D_ARRAY,0,e.internalFormat,r.pixelWidth,r.pixelHeight,s,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let c=1;c<r.mipLevelCount;c++)n.texImage3D(n.TEXTURE_2D_ARRAY,c,e.internalFormat,i,a,s,0,e.format,e.type,null),i=Math.max(i>>1,1),a=Math.max(a>>1,1)}_initEmptyTextureCube(e,r){const n=this._gl,s=6;for(let c=0;c<s;c++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let c=1;c<r.mipLevelCount;c++){for(let o=0;o<s;o++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+o,c,e.internalFormat,i,a,0,e.format,e.type,null);i=Math.max(i>>1,1),a=Math.max(a>>1,1)}}_applyMipRange(e,r){if(this._renderer.context.webGLVersion!==2||r.mipLevelCount<=1)return;const n=this._gl,s=Math.max((r.mipLevelCount|0)-1,0);n.texParameteri(e.target,n.TEXTURE_BASE_LEVEL,0),n.texParameteri(e.target,n.TEXTURE_MAX_LEVEL,s)}_initSampler(e){const r=this._gl,n=this._gl.createSampler();return this._glSamplers[e._resourceId]=n,z(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",n,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:r,width:n,height:s}=this.getPixels(e),i=R.get().createCanvas();i.width=n,i.height=s;const a=i.getContext("2d");if(a){const c=a.createImageData(n,s);c.data.set(r),a.putImageData(c,0,0)}return i}getPixels(e){const r=e.source.resolution,n=e.frame,s=Math.max(Math.round(n.width*r),1),i=Math.max(Math.round(n.height*r),1),a=new Uint8Array(wt*s*i),c=this._renderer,o=c.renderTarget.getRenderTarget(e),u=c.renderTarget.getGpuRenderTarget(o),_=c.gl;return _.bindFramebuffer(_.FRAMEBUFFER,u.resolveTargetFramebuffer),_.readPixels(Math.round(n.x*r),Math.round(n.y*r),s,i,_.RGBA,_.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:i}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(S.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};V.extension={type:[d.WebGLSystem],name:"texture"};V.uploadExtensions=Object.create(null);let Te=V;g.handleByMap(d.TextureUploaderWebGL,Te.uploadExtensions);class xe{contextChange(e){const r=new M({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new J,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),n=e.limits.maxBatchableTextures,s=Q({name:"graphics",bits:[Ie,Ge(n),re,ee]});this.shader=new O({glProgram:s,resources:{localUniforms:r,batchSamplers:Ue(n)}})}execute(e,r){const n=r.context,s=n.customShader||this.shader,i=e.renderer,a=i.graphicsContext,{batcher:c,instructions:o}=a.getContextRenderData(n);s.groups[0]=i.globalUniforms.bindGroup,i.state.set(e.state),i.shader.bind(s),i.geometry.bind(c.geometry,s.glProgram);const u=o.instructions;for(let _=0;_<o.instructionSize;_++){const l=u[_];if(l.size){for(let f=0;f<l.textures.count;f++)i.texture.bind(l.textures.textures[f],f);i.geometry.draw(l.topology,l.size,l.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}xe.extension={type:[d.WebGLPipesAdaptor],name:"graphics"};class ve{init(){const e=Q({name:"mesh",bits:[re,Ve,ee]});this._shader=new O({glProgram:e,resources:{uTexture:S.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new J}}}})}execute(e,r){const n=e.renderer;let s=r._shader;if(s){if(!s.glProgram){b("Mesh shader has no glProgram",r.shader);return}}else{s=this._shader;const i=r.texture,a=i.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=i.textureMatrix.mapCoord}s.groups[100]=n.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,n.encoder.draw({geometry:r._geometry,shader:s,state:r.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ve.extension={type:[d.WebGLPipesAdaptor],name:"mesh"};const Ht=[...ke,he,Je,$e,_e,se,Te,de,ae,pe,be,ue,xt,le,ce],Vt=[...We],Xt=[ne,ve,xe],Ae=[],Be=[],ye=[];g.handleByNamedList(d.WebGLSystem,Ae);g.handleByNamedList(d.WebGLPipes,Be);g.handleByNamedList(d.WebGLPipesAdaptor,ye);g.add(...Ht,...Vt,...Xt);class Qt extends Fe{constructor(){const e={name:"webgl",type:Pe.WEBGL,systems:Ae,renderPipes:Be,renderPipeAdaptors:ye};super(e)}}export{Qt as WebGLRenderer};
@@ -1,4 +1,4 @@
1
- import{y as L,a as D,j as l,z as k,e as pe,H as le,D as T,c as C,d as B,B as fe,I as z,J as w,w as v,K as y,q as ge,L as me,N as O,O as R,r as G,M as F,Q as I,V as _e,W,X as be,S as H,T as E,A as xe,R as ye}from"./RelationshipGalaxyCanvas-ByDU6ZS_.js";import{c as Ge,u as Pe,U as Se,B as Te,G as Be,e as Ce,l as ve,a as Ue,t as Me}from"./BufferResource-BXfwfGam.js";import{R as we,S as Re,d as Ee}from"./RenderTargetSystem-Cx5U5HAM.js";import"./index-JyB6Cr8r.js";import"./vendor-reka-ui-8_x7iKfi.js";import"./vendor-nuxt-ui-DMdbdSFy.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-BhewGKey.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-8s6XRB3S.js";import"./people-page-header-DGkK0AMO.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-Irxx0f6j.js";const P=D.for2d();class N{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),P.blendMode="normal",s.pipeline.getPipeline(t,n,P);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=L(u.textures,u.count,s.limits.maxBatchableTextures)}P.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,P,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}N.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const g in i){const p=e.resources[g]??e.resources[i[g]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const f=d.buffer;h={buffer:o.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d)}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getTextureView(d)}n.push({binding:i[g],resource:h})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Ae{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class j{constructor(e){this._renderer=e,this._managedBuffers=new k({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=pe("resource"),e.data&&(le(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Ae(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}j.extension={type:[l.WebGPUSystem],name:"buffer"};class Le{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class K{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}K.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await T.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class q{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}q.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class Y{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}Y.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const S={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function De(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=S[s.data.type].size;const n=S[s.data.type].align;if(!S[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function ke(a,e){const{size:t,align:r}=S[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
1
+ import{y as L,a as D,j as l,z as k,e as pe,H as le,D as T,c as C,d as B,B as fe,I as z,J as w,w as v,K as y,q as ge,L as me,N as O,O as R,r as G,M as F,Q as I,V as _e,W,X as be,S as H,T as E,A as xe,R as ye}from"./RelationshipGalaxyCanvas-GEpsKHxV.js";import{c as Ge,u as Pe,U as Se,B as Te,G as Be,e as Ce,l as ve,a as Ue,t as Me}from"./BufferResource-DwfMBlAa.js";import{R as we,S as Re,d as Ee}from"./RenderTargetSystem-PEnnW2yb.js";import"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-CPZYydbc.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-DK2z0Jrh.js";import"./people-page-header-BvQy1GQj.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-BOb5cLBx.js";const P=D.for2d();class N{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),P.blendMode="normal",s.pipeline.getPipeline(t,n,P);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=L(u.textures,u.count,s.limits.maxBatchableTextures)}P.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,P,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}N.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const g in i){const p=e.resources[g]??e.resources[i[g]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const f=d.buffer;h={buffer:o.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d)}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getTextureView(d)}n.push({binding:i[g],resource:h})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Ae{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class j{constructor(e){this._renderer=e,this._managedBuffers=new k({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=pe("resource"),e.data&&(le(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Ae(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}j.extension={type:[l.WebGPUSystem],name:"buffer"};class Le{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class K{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}K.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await T.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class q{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}q.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class Y{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}Y.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const S={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function De(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=S[s.data.type].size;const n=S[s.data.type].align;if(!S[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function ke(a,e){const{size:t,align:r}=S[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
2
2
  v = uv.${a.data.name};
3
3
  ${e!==0?`offset += ${e};`:""}
4
4
 
@@ -38,4 +38,4 @@ import{y as L,a as D,j as l,z as k,e as pe,H as le,D as T,c as C,d as B,B as fe,
38
38
  fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
39
39
  return textureSample(img, imgSampler, texCoord);
40
40
  }
41
- `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const u={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(u)}const n=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let u=0;u<s;++u){let c=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),g=i?1:0;for(let p=1;p<e.mipLevelCount;++p){const h=r.createView({baseMipLevel:g++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),d=n.beginRenderPass({colorAttachments:[{view:h,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),f=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});d.setPipeline(t),d.setBindGroup(0,f),d.draw(3,1,0,0),d.end(),c=h}}if(!i){const u={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let c=1;c<e.mipLevelCount;++c)n.copyTextureToTexture({texture:r,mipLevel:c-1},{texture:e,mipLevel:c},u),u.width=Math.ceil(u.width/2),u.height=Math.ceil(u.height/2)}return this.device.queue.submit([n.finish()]),i||r.destroy(),e}}class $e{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}}const M=class ie{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new k({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const t={image:se,buffer:Ne,video:qe,compressed:je,...ie.uploadExtensions};this._uploads={...t,cube:Ke(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){const c=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(c))+1}let t;e.sampleCount>1?(t=GPUTextureUsage.RENDER_ATTACHMENT,e.transient&&this._renderer.device.extensions.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC));const r=re[e.format]||{blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,i=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,n={label:e.label,size:{width:s,height:i,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},o=this._gpu.device.createTexture(n);return e._gpuData[this._renderer.uid]=new $e(o),this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),o}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Ye(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new z({0:t,1:t.style,2:new O({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid];return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),r.textureView||(r.textureView=r.gpuTexture.createView({dimension:t.viewDimension})),r.textureView}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=T.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;const i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:T.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){const t=this.generateCanvas(e),r=R.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);const{width:i,height:n}=t,o=s.getImageData(0,0,i,n),u=new Uint8ClampedArray(o.data.buffer);return R.returnCanvasAndContext(r),{pixels:u,width:i,height:n}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e);this._bindGroupHash[t]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};M.extension={type:[l.WebGPUSystem],name:"texture"};M.uploadExtensions=Object.create(null);let ne=M;G.handleByMap(l.TextureUploaderWebGPU,ne.uploadExtensions);class oe{constructor(){this._maxTextures=0}contextChange(e){const t=new O({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=I({name:"graphics",bits:[_e,be(this._maxTextures),ve,W]});this.shader=new H({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,s=r.customShader||this.shader,i=e.renderer,n=i.graphicsContext,{batcher:o,instructions:u}=n.getContextRenderData(r),c=i.encoder;c.setGeometry(o.geometry,s.gpuProgram);const g=i.globalUniforms.bindGroup;c.setBindGroup(0,g,s.gpuProgram);const p=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,p,s.gpuProgram);const h=u.instructions;let d=null;for(let f=0;f<u.instructionSize;f++){const m=h[f];if(m.topology!==d&&(d=m.topology,c.setPipelineFromGeometryProgramAndState(o.geometry,s.gpuProgram,e.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){const x=m.textures;m.bindGroup=L(x.textures,x.count,this._maxTextures),m.gpuBindGroup=i.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,m.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}oe.extension={type:[l.WebGPUPipesAdaptor],name:"graphics"};class ae{init(){const e=I({name:"mesh",bits:[Ue,Me,W]});this._shader=new H({gpuProgram:e,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(e,t){const r=e.renderer;let s=t._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){v("Mesh shader has no gpuProgram",t.shader);return}const i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const n=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ae.extension={type:[l.WebGPUPipesAdaptor],name:"mesh"};const Xe=[...Re,X,q,U,Y,j,ne,Z,ee,te,Q,K,$,V],Je=[...Ee,J],Qe=[N,ae,oe],ue=[],ce=[],de=[];G.handleByNamedList(l.WebGPUSystem,ue);G.handleByNamedList(l.WebGPUPipes,ce);G.handleByNamedList(l.WebGPUPipesAdaptor,de);G.add(...Xe,...Je,...Qe);class lt extends xe{constructor(){const e={name:"webgpu",type:ye.WEBGPU,systems:ue,renderPipes:ce,renderPipeAdaptors:de};super(e)}}export{lt as WebGPURenderer};
41
+ `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const u={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(u)}const n=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let u=0;u<s;++u){let c=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),g=i?1:0;for(let p=1;p<e.mipLevelCount;++p){const h=r.createView({baseMipLevel:g++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),d=n.beginRenderPass({colorAttachments:[{view:h,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),f=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});d.setPipeline(t),d.setBindGroup(0,f),d.draw(3,1,0,0),d.end(),c=h}}if(!i){const u={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let c=1;c<e.mipLevelCount;++c)n.copyTextureToTexture({texture:r,mipLevel:c-1},{texture:e,mipLevel:c},u),u.width=Math.ceil(u.width/2),u.height=Math.ceil(u.height/2)}return this.device.queue.submit([n.finish()]),i||r.destroy(),e}}class $e{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}}const M=class ie{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new k({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const t={image:se,buffer:Ne,video:qe,compressed:je,...ie.uploadExtensions};this._uploads={...t,cube:Ke(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){const c=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(c))+1}let t;e.sampleCount>1?(t=GPUTextureUsage.RENDER_ATTACHMENT,e.transient&&this._renderer.device.extensions.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC));const r=re[e.format]||{blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,i=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,n={label:e.label,size:{width:s,height:i,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},o=this._gpu.device.createTexture(n);return e._gpuData[this._renderer.uid]=new $e(o),this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),o}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Ye(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new z({0:t,1:t.style,2:new O({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid];return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),r.textureView||(r.textureView=r.gpuTexture.createView({dimension:t.viewDimension})),r.textureView}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=T.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;const i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:T.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){const t=this.generateCanvas(e),r=R.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);const{width:i,height:n}=t,o=s.getImageData(0,0,i,n),u=new Uint8ClampedArray(o.data.buffer);return R.returnCanvasAndContext(r),{pixels:u,width:i,height:n}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e);this._bindGroupHash[t]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};M.extension={type:[l.WebGPUSystem],name:"texture"};M.uploadExtensions=Object.create(null);let ne=M;G.handleByMap(l.TextureUploaderWebGPU,ne.uploadExtensions);class oe{constructor(){this._maxTextures=0}contextChange(e){const t=new O({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=I({name:"graphics",bits:[_e,be(this._maxTextures),ve,W]});this.shader=new H({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,s=r.customShader||this.shader,i=e.renderer,n=i.graphicsContext,{batcher:o,instructions:u}=n.getContextRenderData(r),c=i.encoder;c.setGeometry(o.geometry,s.gpuProgram);const g=i.globalUniforms.bindGroup;c.setBindGroup(0,g,s.gpuProgram);const p=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,p,s.gpuProgram);const h=u.instructions;let d=null;for(let f=0;f<u.instructionSize;f++){const m=h[f];if(m.topology!==d&&(d=m.topology,c.setPipelineFromGeometryProgramAndState(o.geometry,s.gpuProgram,e.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){const x=m.textures;m.bindGroup=L(x.textures,x.count,this._maxTextures),m.gpuBindGroup=i.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,m.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}oe.extension={type:[l.WebGPUPipesAdaptor],name:"graphics"};class ae{init(){const e=I({name:"mesh",bits:[Ue,Me,W]});this._shader=new H({gpuProgram:e,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new F}}}})}execute(e,t){const r=e.renderer;let s=t._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){v("Mesh shader has no gpuProgram",t.shader);return}const i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const n=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ae.extension={type:[l.WebGPUPipesAdaptor],name:"mesh"};const Xe=[...Re,X,q,U,Y,j,ne,Z,ee,te,Q,K,$,V],Je=[...Ee,J],Qe=[N,ae,oe],ue=[],ce=[],de=[];G.handleByNamedList(l.WebGPUSystem,ue);G.handleByNamedList(l.WebGPUPipes,ce);G.handleByNamedList(l.WebGPUPipesAdaptor,de);G.add(...Xe,...Je,...Qe);class ht extends xe{constructor(){const e={name:"webgpu",type:ye.WEBGPU,systems:ue,renderPipes:ce,renderPipeAdaptors:de};super(e)}}export{ht as WebGPURenderer};
@@ -0,0 +1 @@
1
+ import{w as Y,i as y,a as c,b as r,p as d}from"./index-7jm3YI9u.js";const m=Symbol("AnnualSummaryTimeRange");function T(){const e=new Date().getFullYear(),l=Math.floor(Date.now()/1e3),n=r(null),t=r(e),u=r(0),o=r([e]),v=c(()=>({mode:"year",year:t.value})),f=c(()=>{const a=o.value.at(-1)??e;return{availableYears:o.value,fullRange:{start:Math.floor(new Date(a,0,1).getTime()/1e3),end:l}}});function w(a){const i=[...new Set([e,...a])].sort((A,S)=>S-A);i.join(",")!==o.value.join(",")&&(o.value=i)}function g(a){t.value=a,n.value=null,u.value++}const s={modelValue:n,componentKey:u,initialState:v,rangeSource:f,setAvailableYears:w,switchToYear:g};return d(m,s),s}function b(){const e=y(m);if(!e)throw new Error("Annual summary time range context is unavailable");return e}function h(e,l){return Y(e,(n,t)=>{t&&!n&&l()})}export{T as p,b as u,h as w};
@@ -0,0 +1 @@
1
+ import{Y as v,o as f,c as g,f as b,d as x,w as c,C as w,an as k,O as E,P as C,b as _,a as p,E as L,ao as a}from"./index-7jm3YI9u.js";import{u as T,i as S,m as R,n as O,o as z,p as $,q as A,j as M,s as B,t as I,v as P,w as N,k as D}from"./vendor-echarts-B-i_56Av.js";const Y={},F={class:"pointer-events-none absolute inset-0 overflow-hidden"};function K(s,t){return f(),g("div",F,[...t[0]||(t[0]=[b("div",{class:"absolute -left-[20%] -top-[20%] h-[70%] w-[70%] rounded-full bg-blue-400/10 blur-[80px] dark:bg-blue-500/20"},null,-1),b("div",{class:"absolute -right-[20%] top-[10%] h-[70%] w-[70%] rounded-full bg-pink-400/10 blur-[80px] dark:bg-pink-500/20"},null,-1)])])}const q=v(Y,[["render",K]]),H=x({__name:"EChart",props:{option:{},height:{default:300},loading:{type:Boolean,default:!1},theme:{default:"auto"}},setup(s,{expose:t}){T([S,R,O,z,$,A,M,B,I,P,N]);const o=s,n=_();let e=null,r=null;const i=p(()=>typeof o.height=="number"?`${o.height}px`:o.height),h=p(()=>o.theme==="auto"?document.documentElement.classList.contains("dark"):o.theme==="dark");function l(){n.value&&(e&&e.dispose(),e=D(n.value,h.value?"dark":void 0),e.setOption({backgroundColor:"transparent",...o.option}))}function y(){if(!e){l();return}e.setOption({backgroundColor:"transparent",...o.option},{notMerge:!0})}function d(){e?.resize()}c(()=>o.option,y,{deep:!0}),c(()=>o.height,()=>{setTimeout(()=>{e?.resize()},0)}),c(h,()=>{l()}),c(()=>o.loading,m=>{m?e?.showLoading("default",{text:"",spinnerRadius:12,lineWidth:2}):e?.hideLoading()});let u=null;return w(()=>{k(()=>{l()}),window.addEventListener("resize",d),n.value&&(r=new ResizeObserver(()=>d()),r.observe(n.value)),u=new MutationObserver(()=>{o.theme==="auto"&&l()}),u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),E(()=>{window.removeEventListener("resize",d),r?.disconnect(),u?.disconnect(),e?.dispose(),e=null}),t({getInstance:()=>e,resize:d}),(m,W)=>(f(),g("div",{ref_key:"chartRef",ref:n,style:C({height:i.value,width:"100%"})},null,4))}}),J=x({__name:"EChartBar",props:{data:{},height:{default:200},mode:{default:"expanded"},horizontal:{type:Boolean,default:!1},gradient:{type:Boolean,default:!0},borderRadius:{default:4}},setup(s){const t=s,o={type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]},n=p(()=>{const e=t.horizontal,r=t.mode==="compact",i=t.data.labels.length;return{tooltip:{trigger:"axis",confine:!0,extraCssText:"max-width: min(360px, 70vw); white-space: normal; word-break: break-word;",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},grid:{left:e?r?72:96:36,right:16,top:20,bottom:e?20:i>8?48:30,outerBoundsMode:"same"},xAxis:e?{type:"value",axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{type:"dashed",color:"#e5e7eb"}}}:{type:"category",data:t.data.labels,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:11,color:"#6b7280",interval:"auto",rotate:!e&&i>8?28:0,hideOverlap:!0}},yAxis:e?{type:"category",data:t.data.labels,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:11,color:"#6b7280",overflow:"truncate",width:r?70:110}}:{type:"value",axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{type:"dashed",color:"#e5e7eb"}}},series:[{type:"bar",data:t.data.values,itemStyle:{color:t.gradient?o:"#ee4567",borderRadius:t.borderRadius},barMaxWidth:40,emphasis:{itemStyle:{color:t.gradient?{...o,colorStops:[{offset:0,color:"#de335e"},{offset:1,color:"#ee4567"}]}:"#de335e"}}}]}});return(e,r)=>(f(),L(H,{option:n.value,height:s.height},null,8,["option","height"]))}}),V={[a.TEXT]:"text",[a.IMAGE]:"image",[a.VOICE]:"voice",[a.VIDEO]:"video",[a.FILE]:"file",[a.EMOJI]:"emoji",[a.LINK]:"link",[a.LOCATION]:"location",[a.RED_PACKET]:"redPacket",[a.TRANSFER]:"transfer",[a.POKE]:"poke",[a.CALL]:"call",[a.SHARE]:"share",[a.REPLY]:"reply",[a.FORWARD]:"forward",[a.CONTACT]:"contact",[a.SYSTEM]:"system",[a.RECALL]:"recall",[a.OTHER]:"other"};function U(s,t){const o=V[s];return t&&o?t(`common.messageType.${o}`):t?t("common.messageType.unknown"):"未知"}export{q as C,J as _,H as a,U as g};
@@ -1,4 +1,4 @@
1
- import{t as M,U as Z,P as m,v as te,j as y,E as ie,w as g,r as P,x as V}from"./RelationshipGalaxyCanvas-ByDU6ZS_.js";import"./webworkerAll-a_fveCLR.js";import"./index-JyB6Cr8r.js";import"./vendor-reka-ui-8_x7iKfi.js";import"./vendor-nuxt-ui-DMdbdSFy.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-BhewGKey.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-8s6XRB3S.js";import"./people-page-header-DGkK0AMO.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-Irxx0f6j.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,$=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function j(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||$(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||$(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n(N),chrome:n(F),device:n(K)||n(Y)||n(H)||n(N)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=j.default??j,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,W=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
1
+ import{t as M,U as Z,P as m,v as te,j as y,E as ie,w as g,r as P,x as V}from"./RelationshipGalaxyCanvas-GEpsKHxV.js";import"./webworkerAll-DgKQKbNn.js";import"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-CPZYydbc.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-DK2z0Jrh.js";import"./people-page-header-BvQy1GQj.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-BOb5cLBx.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,$=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function j(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||$(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||$(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n(N),chrome:n(F),device:n(K)||n(Y)||n(H)||n(N)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=j.default??j,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,W=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
2
2
  color: transparent;
3
3
  pointer-events: none;
4
4
  padding: 0;
@@ -0,0 +1 @@
1
+ import{x as n,z as s}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";class p{async getVersion(){return"0.33.0"}async fetchRemoteConfig(t){try{const e=await fetch(t);return e.ok?{success:!0,data:(e.headers.get("content-type")||"").includes("application/json")||t.split("?")[0].endsWith(".json")?await e.json():await e.text()}:{success:!1,error:`HTTP ${e.status}`}}catch(e){return{success:!1,error:String(e)}}}setThemeSource(t){}async getOpenAtLogin(){return!1}async setOpenAtLogin(t){return{success:!1,error:"Not available in CLI Web"}}async getAnalyticsEnabled(){try{return(await(await n("/_web/telemetry/enabled")).json()).enabled===!0}catch{return!1}}async setAnalyticsEnabled(t){try{return await(await n("/_web/telemetry/enabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:t})})).json()}catch{return{success:!1}}}async trackDailyActive(t){await n("/_web/telemetry/track",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eventName:"app_active",properties:{platform:"cli-web",locale:t}})}).catch(()=>{})}async showOpenDialog(t){return{canceled:!0,filePaths:[]}}async copyImageToClipboard(t){if(globalThis.isSecureContext===!1)return{success:!1,error:"Image clipboard requires HTTPS or localhost"};if(typeof navigator>"u"||typeof navigator.clipboard?.write!="function"||typeof ClipboardItem>"u")return{success:!1,error:"Image clipboard is not supported by this browser"};try{const e=fetch(t).then(async r=>{if(!r.ok)throw new Error(`Failed to read screenshot data: HTTP ${r.status}`);const a=await r.blob();if(a.type!=="image/png")throw new Error(`Unsupported screenshot MIME type: ${a.type||"unknown"}`);return a});return await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),{success:!0}}catch(e){const r=e instanceof Error?`${e.name}: ${e.message}`:String(e);return s(`Image clipboard write failed: ${r}`,e instanceof Error?e.stack:void 0),{success:!1,error:r}}}async checkUpdate(){try{return await(await n("/_web/system/check-update")).json()}catch(t){return{hasUpdate:!1,currentVersion:"unknown",error:t instanceof Error?t.message:String(t)}}}async performUpdate(){return{success:!1,error:"Web update is unavailable. Run clb update in your terminal."}}async relaunch(){window.location.reload()}}export{p as CliWebPlatformAdapter};
@@ -1 +1 @@
1
- import{d as s}from"./index-JyB6Cr8r.js";function u(r){const t=new Date(r*1e3),n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0");return`${n}-${a}-${e}`}function f(r){const t=new Date(r*1e3),n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${n}-${a}-${e} ${o}:${i}`}function m(r){return s.unix(r).format("YYYY-MM-DD HH:mm:ss")}function d(r,t){const n=u(r);if(t===null)return`${n} ~ 至今`;const a=u(t);return n===a?n:`${n} ~ ${a}`}function g(r,t,n="YYYY/MM/DD",a=" - "){const e=s.unix(r).format(n),o=s.unix(t).format(n);return e===o?e:`${e}${a}${o}`}export{u as a,m as b,d as c,f as d,g as f};
1
+ import{e as s}from"./index-7jm3YI9u.js";function u(r){const t=new Date(r*1e3),n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0");return`${n}-${a}-${e}`}function f(r){const t=new Date(r*1e3),n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${n}-${a}-${e} ${o}:${i}`}function m(r){return s.unix(r).format("YYYY-MM-DD HH:mm:ss")}function g(r,t){const n=u(r);if(t===null)return`${n} ~ 至今`;const a=u(t);return n===a?n:`${n} ~ ${a}`}function d(r,t,n="YYYY/MM/DD",a=" - "){const e=s.unix(r).format(n),o=s.unix(t).format(n);return e===o?e:`${e}${a}${o}`}export{u as a,m as b,g as c,f as d,d as f};
@@ -0,0 +1 @@
1
+ import{j as g,k as u,l as o,m,q as y,u as a,v as $}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";function n(i){if(!i)return"";const e=new URLSearchParams;i.startTs&&e.set("startTs",String(i.startTs)),i.endTs&&e.set("endTs",String(i.endTs)),i.memberId&&e.set("memberId",String(i.memberId));const s=e.toString();return s?`?${s}`:""}function l(i){const e=new URLSearchParams;i?.mode&&e.set("mode",i.mode),i?.year&&e.set("year",String(i.year)),i?.days&&e.set("days",String(i.days)),i?.acceptStale&&e.set("acceptStale","1");const s=e.toString();return s?`?${s}`:""}class p{getSessions(){return g("/sessions")}getSession(e){return g(`/sessions/${e}`)}async deleteSession(e){return(await u(`/sessions/${e}`)).success}async renameSession(e,s){return(await o(`/sessions/${e}/name`,{name:s})).success}async updateSessionOwnerId(e,s){return(await o(`/sessions/${e}/owner`,{ownerId:s})).success}tryApplyOwnerProfile(e){return m(`/sessions/${e}/owner/apply-profile`,{})}setOwnerAndApplyProfile(e,s){return m(`/sessions/${e}/owner/select`,{ownerPlatformId:s})}async dismissOwnerPrompt(e){return(await m(`/sessions/${e}/owner/dismiss-prompt`,{})).success}getContacts(e){const s=new URLSearchParams;e?.acceptStale&&s.set("acceptStale","1"),e?.timeRangePreset&&s.set("timeRange",e.timeRangePreset),e?.pool&&s.set("pool",e.pool),e?.page&&s.set("page",String(e.page)),e?.pageSize&&s.set("pageSize",String(e.pageSize)),e?.query&&s.set("q",e.query);const t=s.toString();return g(`/contacts${t?`?${t}`:""}`)}getContactDetail(e,s){const t=new URLSearchParams;s?.acceptStale&&t.set("acceptStale","1"),s?.timeRangePreset&&t.set("timeRange",s.timeRangePreset);const r=t.toString();return g(`/contacts/${encodeURIComponent(e)}/detail${r?`?${r}`:""}`)}recomputeContacts(e){const s=new URLSearchParams;e?.timeRangePreset&&s.set("timeRange",e.timeRangePreset),e?.pool&&s.set("pool",e.pool),e?.page&&s.set("page",String(e.page)),e?.pageSize&&s.set("pageSize",String(e.pageSize)),e?.query&&s.set("q",e.query);const t=s.toString();return m(`/contacts/recompute${t?`?${t}`:""}`,{})}async markContactAsFriend(e,s){const t=new URLSearchParams;s?.timeRangePreset&&t.set("timeRange",s.timeRangePreset);const r=t.toString();return(await y(`/contacts/${encodeURIComponent(e)}/mark-friend${r?`?${r}`:""}`)).success}async unmarkContactAsFriend(e,s){const t=new URLSearchParams;s?.timeRangePreset&&t.set("timeRange",s.timeRangePreset);const r=t.toString();return(await u(`/contacts/${encodeURIComponent(e)}/mark-friend${r?`?${r}`:""}`)).success}getPeopleRelationships(e){const s=new URLSearchParams;e?.acceptStale&&s.set("acceptStale","1"),e?.timeRangePreset&&s.set("timeRange",e.timeRangePreset),e?.graphScope&&s.set("scope",e.graphScope),e?.query&&s.set("q",e.query);const t=s.toString();return g(`/people/relationships${t?`?${t}`:""}`)}recomputePeopleRelationships(e){const s=new URLSearchParams;e?.timeRangePreset&&s.set("timeRange",e.timeRangePreset),e?.graphScope&&s.set("scope",e.graphScope),e?.query&&s.set("q",e.query);const t=s.toString();return m(`/people/relationships/recompute${t?`?${t}`:""}`,{})}getPeopleRelationshipNeighborhood(e,s){const t=new URLSearchParams;s?.acceptStale&&t.set("acceptStale","1"),s?.timeRangePreset&&t.set("timeRange",s.timeRangePreset);const r=t.toString();return g(`/people/relationships/${encodeURIComponent(e)}/neighborhood${r?`?${r}`:""}`)}getAnnualSummary(e){return g(`/global-insight/annual-summary${l(e)}`)}recomputeAnnualSummary(e){return m(`/global-insight/annual-summary/recompute${l(e)}`,{})}getAvailableYears(e){return g(`/sessions/${e}/years`)}getTimeRange(e){return g(`/sessions/${e}/time-range`)}getMemberActivity(e,s){return a(`/sessions/${e}/stats/member-activity${n(s)}`)}getHourlyActivity(e,s){return a(`/sessions/${e}/stats/hourly${n(s)}`)}getDailyActivity(e,s){return a(`/sessions/${e}/stats/daily${n(s)}`)}getWeekdayActivity(e,s){return a(`/sessions/${e}/stats/weekday${n(s)}`)}getMonthlyActivity(e,s){return a(`/sessions/${e}/analytics/monthly-activity${n(s)}`)}getYearlyActivity(e,s){return a(`/sessions/${e}/analytics/yearly-activity${n(s)}`)}getMessageLengthDistribution(e,s){return a(`/sessions/${e}/analytics/message-length-distribution${n(s)}`)}getMessageTypeDistribution(e,s){return a(`/sessions/${e}/stats/message-types${n(s)}`)}getTextStats(e,s){return a(`/sessions/${e}/analytics/text-stats${n(s)}`)}getLongMessageCount(e,s,t){const r=new URLSearchParams;s?.startTs&&r.set("startTs",String(s.startTs)),s?.endTs&&r.set("endTs",String(s.endTs)),s?.memberId&&r.set("memberId",String(s.memberId)),t!=null&&r.set("minLength",String(t));const c=r.toString();return a(`/sessions/${e}/analytics/long-message-count${c?`?${c}`:""}`)}getMemberMonthlyTrend(e,s){return a(`/sessions/${e}/analytics/member-monthly-trend${n(s)}`)}getTextLengthPercentiles(e,s){return a(`/sessions/${e}/analytics/text-length-percentiles${n(s)}`)}getWordFrequency(e,s){return $("/nlp/word-frequency",{sessionId:e,...s})}getDragonKingAnalysis(e,s){return a(`/sessions/${e}/analytics/dragon-king${n(s)}`)}getDivingAnalysis(e,s){return a(`/sessions/${e}/analytics/diving${n(s)}`)}getCheckInAnalysis(e,s){return a(`/sessions/${e}/analytics/check-in${n(s)}`)}getMemeBattleAnalysis(e,s){return a(`/sessions/${e}/analytics/meme-battle${n(s)}`)}getNightOwlAnalysis(e,s){return a(`/sessions/${e}/analytics/night-owl${n(s)}`)}getRepeatAnalysis(e,s){return a(`/sessions/${e}/analytics/repeat${n(s)}`)}getMembers(e){return g(`/sessions/${e}/members`)}getMembersPaginated(e,s){const t=new URLSearchParams({page:String(s.page),pageSize:String(s.pageSize)});return s.search&&t.set("search",s.search),s.sortOrder&&t.set("sortOrder",s.sortOrder),g(`/sessions/${e}/members/paginated?${t}`)}getMemberNameHistory(e,s){return g(`/sessions/${e}/members/${s}/history`)}async updateMemberAliases(e,s,t){return(await o(`/sessions/${e}/members/${s}/aliases`,{aliases:t})).success}async mergeMembers(e,s,t){return(await m(`/sessions/${e}/members/merge`,{memberId1:s,memberId2:t})).success}async deleteMember(e,s){return(await u(`/sessions/${e}/members/${s}`)).success}async deleteMembers(e,s){return(await m(`/sessions/${e}/members/batch-delete`,{memberIds:s})).success}getCatchphraseAnalysis(e,s){return a(`/sessions/${e}/analytics/catchphrase${n(s)}`)}getLanguagePreferenceAnalysis(e,s,t,r){const c=new URLSearchParams;return c.set("locale",s),t?.startTs&&c.set("startTs",String(t.startTs)),t?.endTs&&c.set("endTs",String(t.endTs)),t?.memberId&&c.set("memberId",String(t.memberId)),a(`/sessions/${e}/analytics/language-preference?${c}`)}getMentionAnalysis(e,s){return a(`/sessions/${e}/analytics/mention${n(s)}`)}getMentionGraph(e,s){return a(`/sessions/${e}/analytics/mention-graph${n(s)}`)}getClusterGraph(e,s,t){const r=new URLSearchParams;s?.startTs&&r.set("startTs",String(s.startTs)),s?.endTs&&r.set("endTs",String(s.endTs)),s?.memberId&&r.set("memberId",String(s.memberId)),t?.topEdges&&r.set("topEdges",String(t.topEdges)),t?.lookAhead&&r.set("lookAhead",String(t.lookAhead)),t?.decaySeconds&&r.set("decaySeconds",String(t.decaySeconds));const c=r.toString();return a(`/sessions/${e}/analytics/cluster${c?`?${c}`:""}`)}getLaughAnalysis(e,s,t){return a(`/sessions/${e}/analytics/laugh${n(s)}`)}getRelationshipStats(e,s,t){return a(`/sessions/${e}/analytics/relationship${n(s)}`)}executeSQL(e,s){return m(`/sessions/${e}/sql`,{sql:s})}getSchema(e){return g(`/sessions/${e}/schema`)}pluginQuery(e,s,t){return m(`/sessions/${e}/query`,{sql:s,params:t??[]})}}export{p as FetchDataAdapter};
@@ -0,0 +1 @@
1
+ import{j as s,q as l,m as o,k as i}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";class g{async hasConfig(){return s("/ai/llm/has-config")}async getConfigStore(){return s("/ai/llm/configs")}async getAllConfigs(){return(await this.getConfigStore()).configs}async getDefaultAssistantSlot(){return s("/ai/llm/default-assistant-slot")}async getFastModelSlot(){return s("/ai/llm/fast-model-slot")}async setDefaultAssistantModel(e,t){return l("/ai/llm/default-assistant-slot",{configId:e,modelId:t})}async setFastModel(e){return l("/ai/llm/fast-model-slot",e)}async getProviders(){return s("/ai/llm/providers")}async getProviderRegistry(){return s("/ai/llm/provider-registry")}async getModelCatalog(){return s("/ai/llm/model-catalog")}async addConfig(e){return o("/ai/llm/configs",e)}async updateConfig(e,t){return l(`/ai/llm/configs/${e}`,t)}async deleteConfig(e){return i(`/ai/llm/configs/${e}`)}async validateApiKey(e,t,a,r,n,m){return o("/ai/llm/validate-key",{provider:e,apiKey:t,baseUrl:a,model:r,apiFormat:n,configId:m})}async fetchRemoteModels(e,t,a,r,n){return o("/ai/llm/remote-models",{provider:e,apiKey:t,baseUrl:a,apiFormat:r,configId:n})}async addCustomProvider(e){return o("/ai/llm/custom-providers",e)}async updateCustomProvider(e,t){return l(`/ai/llm/custom-providers/${e}`,t)}async deleteCustomProvider(e){return i(`/ai/llm/custom-providers/${e}`)}async addCustomModel(e){return o("/ai/llm/custom-models",e)}async updateCustomModel(e,t,a){return l(`/ai/llm/custom-models/${e}/${encodeURIComponent(t)}`,a)}async deleteCustomModel(e,t){return i(`/ai/llm/custom-models/${e}/${encodeURIComponent(t)}`)}}export{g as FetchLLMAdapter};
@@ -0,0 +1 @@
1
+ import{j as i,m as r,q as s,k as l}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";class c{async getAll(){return i("/ai/skills")}async getConfig(t){try{return await i(`/ai/skills/${t}`)}catch{return null}}async create(t){return r("/ai/skills",{rawMd:t})}async update(t,a){return s(`/ai/skills/${t}`,{rawMd:a})}async delete(t){return l(`/ai/skills/${t}`)}async importFromMd(t){return r("/ai/skills/import",{rawMd:t})}async importBuiltin(t){return r("/ai/skills/import-builtin",{builtinId:t})}async reimport(t){return r(`/ai/skills/${t}/reimport`,{})}async getBuiltinCatalog(){try{return await i("/ai/skills/builtin-catalog")}catch{return[]}}}export{c as FetchSkillAdapter};
@@ -0,0 +1 @@
1
+ import{j as a,m as s,q as n,k as i}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";class c{async getAll(){return a("/ai/assistants")}async getConfig(t){try{return await a(`/ai/assistants/${t}`)}catch{return null}}async create(t){return s("/ai/assistants",t)}async update(t,r){return n(`/ai/assistants/${t}`,r)}async delete(t){return i(`/ai/assistants/${t}`)}async reset(t){return s(`/ai/assistants/${t}/reset`,{})}async getUpgradeInfo(t){return a(`/ai/assistants/${t}/upgrade-status`)}async upgradeWithBackup(t,r){return s(`/ai/assistants/${t}/upgrade`,{backupName:r})}async importFromMd(t){return s("/ai/assistants/import",{rawMd:t})}async getBuiltinCatalog(){return[]}async importBuiltin(t){return s("/ai/assistants/import-builtin",{builtinId:t})}async reimport(t){return s(`/ai/assistants/${t}/reimport`,{})}async getBuiltinToolCatalog(){return a("/ai/tools/catalog")}}export{c as FetchAssistantAdapter};
@@ -1,6 +1,6 @@
1
- import{f as r,h as d}from"./index-JyB6Cr8r.js";import"./vendor-reka-ui-8_x7iKfi.js";import"./vendor-nuxt-ui-DMdbdSFy.js";import"./vendor-snapdom--nZvo8Sg.js";function c(){return d("data")}const u=`(SELECT mc.message_id FROM message_context mc
1
+ import{x as r,y as d}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";function c(){return d("data")}const u=`(SELECT mc.message_id FROM message_context mc
2
2
  JOIN message first_msg ON first_msg.id = mc.message_id
3
- WHERE mc.segment_id = segment.id ORDER BY first_msg.ts ASC, first_msg.id ASC LIMIT 1) as firstMessageId`;class S{async generate(s,t=1800){const e=await r(`/_web/sessions/${s}/generate-index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gapThreshold:t})});if(!e.ok)throw new Error(`Failed to generate session index: ${e.status}`);return(await e.json()).sessionCount}async generateIncremental(s,t=1800){const e=await r(`/_web/sessions/${s}/generate-incremental-index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gapThreshold:t})});if(!e.ok)throw new Error(`Failed to generate incremental session index: ${e.status}`);return(await e.json()).sessionCount}async hasIndex(s){return(await this.getStats(s)).hasIndex}async getStats(s){try{const e=(await c().pluginQuery(s,"SELECT COUNT(*) as cnt FROM segment",[]))[0]?.cnt??0;return{hasIndex:e>0,sessionCount:e,gapThreshold:1800}}catch{return{hasIndex:!1,sessionCount:0,gapThreshold:1800}}}async getAllIndexStats(){const s=await r("/_web/sessions/index-stats");return s.ok?await s.json():[]}async clear(s){return await r(`/_web/sessions/${s}/clear-index`,{method:"POST"}),!0}async updateGapThreshold(s,t){return!0}async getSessions(s){return c().pluginQuery(s,`SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary, ${u}
3
+ WHERE mc.segment_id = segment.id ORDER BY first_msg.ts ASC, first_msg.id ASC LIMIT 1) as firstMessageId`;class h{async generate(s,t=1800){const e=await r(`/_web/sessions/${s}/generate-index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gapThreshold:t})});if(!e.ok)throw new Error(`Failed to generate session index: ${e.status}`);return(await e.json()).sessionCount}async generateIncremental(s,t=1800){const e=await r(`/_web/sessions/${s}/generate-incremental-index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gapThreshold:t})});if(!e.ok)throw new Error(`Failed to generate incremental session index: ${e.status}`);return(await e.json()).sessionCount}async hasIndex(s){return(await this.getStats(s)).hasIndex}async getStats(s){try{const e=(await c().pluginQuery(s,"SELECT COUNT(*) as cnt FROM segment",[]))[0]?.cnt??0;return{hasIndex:e>0,sessionCount:e,gapThreshold:1800}}catch{return{hasIndex:!1,sessionCount:0,gapThreshold:1800}}}async getAllIndexStats(){const s=await r("/_web/sessions/index-stats");return s.ok?await s.json():[]}async clear(s){return await r(`/_web/sessions/${s}/clear-index`,{method:"POST"}),!0}async updateGapThreshold(s,t){return!0}async getSessions(s){return c().pluginQuery(s,`SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary, ${u}
4
4
  FROM segment ORDER BY start_ts ASC`,[])}async getByTimeRange(s,t,e){return c().pluginQuery(s,`SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary, ${u}
5
5
  FROM segment WHERE start_ts >= ? AND end_ts <= ? ORDER BY start_ts ASC`,[t,e])}async getRecent(s,t){return c().pluginQuery(s,`SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary, ${u}
6
- FROM segment ORDER BY start_ts DESC LIMIT ?`,[t])}async generateSummary(s,t,e,a,o){try{const n=await r(`/_web/sessions/${s}/summaries/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmentId:t,locale:e,forceRegenerate:a,strategy:o})}),i=await n.json();return n.ok?i:{success:!1,error:i.error||`HTTP ${n.status}`}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async generateSummaries(s,t,e){let a=0,o=0;const n=0;for(const i of t)try{(await this.generateSummary(s,i,e)).success?a++:o++}catch{o++}return{success:a,failed:o,skipped:n}}async checkCanGenerateSummary(s,t){try{const e=await r(`/_web/sessions/${s}/summaries/check-can-generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmentIds:t})});return e.ok?await e.json():{}}catch{return{}}}}export{S as FetchSessionIndexAdapter};
6
+ FROM segment ORDER BY start_ts DESC LIMIT ?`,[t])}async generateSummary(s,t,e,a,o){try{const n=await r(`/_web/sessions/${s}/summaries/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmentId:t,locale:e,forceRegenerate:a,strategy:o})}),i=await n.json();return n.ok?i:{success:!1,error:i.error||`HTTP ${n.status}`}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async generateSummaries(s,t,e){let a=0,o=0;const n=0;for(const i of t)try{(await this.generateSummary(s,i,e)).success?a++:o++}catch{o++}return{success:a,failed:o,skipped:n}}async checkCanGenerateSummary(s,t){try{const e=await r(`/_web/sessions/${s}/summaries/check-can-generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmentIds:t})});return e.ok?await e.json():{}}catch{return{}}}}export{h as FetchSessionIndexAdapter};
@@ -0,0 +1 @@
1
+ import{j as t,m as e}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";class o{async getInfo(){return t("/cache/info")}async clear(a){return e("/cache/clear",{cacheId:a})}async getDataDir(){return t("/cache/data-dir")}async setDataDir(a,r=!0){return e("/cache/data-dir",{path:a,migrate:r})}async openDataDirCleanup(a){return e("/cache/data-dir/cleanup/open",{cleanupId:a})}async dismissDataDirCleanupNotice(a){return e("/cache/data-dir/cleanup/dismiss",{cleanupId:a})}async deleteDataDirCleanup(a){return e("/cache/data-dir/cleanup/delete",{cleanupId:a})}async getLatestImportLog(){return t("/cache/latest-import-log")}async saveToDownloads(a,r){return e("/cache/save-to-downloads",{filename:a,dataUrl:r})}async openDir(a){return e("/cache/open-dir",{cacheId:a})}async showInFolder(a){return e("/cache/show-in-folder",{filePath:a})}}export{o as FetchCacheAdapter};
@@ -1,3 +1,3 @@
1
- import{n as y}from"./types-CZnACqaB.js";import{f as n,i,g}from"./index-JyB6Cr8r.js";import"./vendor-reka-ui-8_x7iKfi.js";import"./vendor-nuxt-ui-DMdbdSFy.js";import"./vendor-snapdom--nZvo8Sg.js";async function l(h,t,s){const r=h.body?.getReader();if(!r)return t;const e=new TextDecoder;let o="",a=t;for(;;){const{done:u,value:w}=await r.read();if(u)break;o+=e.decode(w,{stream:!0});const f=o.split(`
2
- `);o=f.pop()||"";let p="";for(const c of f)if(c.startsWith("event: "))p=c.slice(7).trim();else if(c.startsWith("data: ")){const d=JSON.parse(c.slice(6));p==="progress"?s?.(d):(p==="done"||p==="error")&&(a=d),p=""}}return a}class F{async importFile(t,s,r){if(typeof t=="string")return{success:!1,error:"File path import is not supported in Web mode"};const e=new FormData;e.append("file",t),s?.formatId&&e.append("formatId",s.formatId),s?.chatIndex!==void 0&&e.append("chatIndex",String(s.chatIndex));const o=await n(`${i()}/import`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,error:`HTTP ${o.status}: ${a}`}}return y(await l(o,{success:!1,error:"Unknown error"},r))}async detectFormat(t){if(typeof t=="string")return null;const s=new FormData;s.append("file",t);const r=await n(`${i()}/detect-format`,{method:"POST",body:s});return r.ok?(await r.json()).format:null}async scanMultiChatFile(t){if(typeof t=="string")return[];const s=new FormData;s.append("file",t);const r=await n(`${i()}/scan-multi-chat`,{method:"POST",body:s});return r.ok?(await r.json()).chats:[]}async prepareImportSource(t){if(typeof t=="string")return{success:!1,error:"File path import is not supported in Web mode"};const s=new FormData;s.append("file",t);const r=await n(`${i()}/import-sources`,{method:"POST",body:s}),e=await r.json().catch(()=>null);return r.ok?e??{success:!1,error:"Invalid import source response"}:{success:!1,error:e?.error||`HTTP ${r.status}`}}async importPreparedChat(t,s,r){const e=await n(`${i()}/import-sources/${encodeURIComponent(t)}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatId:s})});if(!e.ok){const o=await e.text();return{success:!1,error:`HTTP ${e.status}: ${o}`}}return y(await l(e,{success:!1,error:"Unknown error"},r))}async releaseImportSource(t){await n(`${i()}/import-sources/${encodeURIComponent(t)}`,{method:"DELETE"})}getSupportedFormats(){return g("/supported-formats")}async importDemo(t,s){return new Promise(r=>{n(`${i()}/demo/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:t})}).then(async e=>{if(!e.ok||!e.body){r({success:!1,error:`HTTP ${e.status}`});return}const o=e.body.getReader(),a=new TextDecoder;let u="";for(;;){const{done:w,value:f}=await o.read();if(w)break;u+=a.decode(f,{stream:!0});const p=u.split(`
3
- `);u=p.pop()||"";let c="";for(const d of p)if(d.startsWith("event: "))c=d.slice(7).trim();else if(d.startsWith("data: ")){const m=JSON.parse(d.slice(6));if(c==="progress")(m.stage==="downloading"||m.stage==="importing")&&s?.({stage:m.stage});else if(c==="result"){r(m);return}c=""}}r({success:!1,error:"Stream ended without result"})}).catch(e=>r({success:!1,error:String(e)}))})}async analyzeIncrementalImport(t,s){if(typeof s=="string")return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:"File path not supported in Web mode"};const r=new FormData;r.append("file",s);const e=await n(`${i()}/sessions/${t}/import/incremental/analyze`,{method:"POST",body:r});if(!e.ok){const o=await e.text();return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:`HTTP ${e.status}: ${o}`}}return await e.json()}async incrementalImport(t,s,r){if(typeof s=="string")return{success:!1,newMessageCount:0,error:"File path not supported in Web mode"};const e=new FormData;e.append("file",s);const o=await n(`${i()}/sessions/${t}/import/incremental`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,newMessageCount:0,error:`HTTP ${o.status}: ${a}`}}return l(o,{success:!1,newMessageCount:0,error:"Unknown error"},r)}async importDirectory(t,s,r){if(typeof t=="string")return{success:!1,error:"Directory path import is not supported in Web mode"};if(t.length===0)return{success:!1,error:"No files in directory"};const e=new FormData;for(const a of t)e.append("files",a),e.append("relativePaths",a.webkitRelativePath||a.name);const o=await n(`${i()}/import-directory`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,error:`HTTP ${o.status}: ${a}`}}return y(await l(o,{success:!1,error:"Unknown error"},r))}}export{F as FetchImportAdapter};
1
+ import{x as i,N as c,j as g}from"./index-7jm3YI9u.js";import"./vendor-snapdom--nZvo8Sg.js";function h(n){return{success:n.success,sessionId:n.sessionId,error:n.error,importMode:n.importMode,matchedBy:n.matchedBy,createReason:n.createReason,newMessageCount:n.newMessageCount,duplicateCount:n.duplicateCount,messageCount:n.messageCount,memberCount:n.memberCount,diagnostics:n.diagnostics}}async function w(n,t,s){const r=n.body?.getReader();if(!r)return t;const e=new TextDecoder;let o="",a=t;for(;;){const{done:m,value:y}=await r.read();if(m)break;o+=e.decode(y,{stream:!0});const f=o.split(`
2
+ `);o=f.pop()||"";let u="";for(const d of f)if(d.startsWith("event: "))u=d.slice(7).trim();else if(d.startsWith("data: ")){const p=JSON.parse(d.slice(6));u==="progress"?s?.(p):(u==="done"||u==="error")&&(a=p),u=""}}return a}class b{async importFile(t,s,r){if(typeof t=="string")return{success:!1,error:"File path import is not supported in Web mode"};const e=new FormData;e.append("file",t),s?.formatId&&e.append("formatId",s.formatId),s?.chatIndex!==void 0&&e.append("chatIndex",String(s.chatIndex));const o=await i(`${c()}/import`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,error:`HTTP ${o.status}: ${a}`}}return h(await w(o,{success:!1,error:"Unknown error"},r))}async detectFormat(t){if(typeof t=="string")return null;const s=new FormData;s.append("file",t);const r=await i(`${c()}/detect-format`,{method:"POST",body:s});return r.ok?(await r.json()).format:null}async scanMultiChatFile(t){if(typeof t=="string")return[];const s=new FormData;s.append("file",t);const r=await i(`${c()}/scan-multi-chat`,{method:"POST",body:s});return r.ok?(await r.json()).chats:[]}async prepareImportSource(t){if(typeof t=="string")return{success:!1,error:"File path import is not supported in Web mode"};const s=new FormData;s.append("file",t);const r=await i(`${c()}/import-sources`,{method:"POST",body:s}),e=await r.json().catch(()=>null);return r.ok?e??{success:!1,error:"Invalid import source response"}:{success:!1,error:e?.error||`HTTP ${r.status}`}}async importPreparedChat(t,s,r){const e=await i(`${c()}/import-sources/${encodeURIComponent(t)}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatId:s})});if(!e.ok){const o=await e.text();return{success:!1,error:`HTTP ${e.status}: ${o}`}}return h(await w(e,{success:!1,error:"Unknown error"},r))}async releaseImportSource(t){await i(`${c()}/import-sources/${encodeURIComponent(t)}`,{method:"DELETE"})}getSupportedFormats(){return g("/supported-formats")}async importDemo(t,s){return new Promise(r=>{i(`${c()}/demo/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:t})}).then(async e=>{if(!e.ok||!e.body){r({success:!1,error:`HTTP ${e.status}`});return}const o=e.body.getReader(),a=new TextDecoder;let m="";for(;;){const{done:y,value:f}=await o.read();if(y)break;m+=a.decode(f,{stream:!0});const u=m.split(`
3
+ `);m=u.pop()||"";let d="";for(const p of u)if(p.startsWith("event: "))d=p.slice(7).trim();else if(p.startsWith("data: ")){const l=JSON.parse(p.slice(6));if(d==="progress")(l.stage==="downloading"||l.stage==="importing")&&s?.({stage:l.stage});else if(d==="result"){r(l);return}d=""}}r({success:!1,error:"Stream ended without result"})}).catch(e=>r({success:!1,error:String(e)}))})}async analyzeIncrementalImport(t,s){if(typeof s=="string")return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:"File path not supported in Web mode"};const r=new FormData;r.append("file",s);const e=await i(`${c()}/sessions/${t}/import/incremental/analyze`,{method:"POST",body:r});if(!e.ok){const o=await e.text();return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:`HTTP ${e.status}: ${o}`}}return await e.json()}async incrementalImport(t,s,r){if(typeof s=="string")return{success:!1,newMessageCount:0,error:"File path not supported in Web mode"};const e=new FormData;e.append("file",s);const o=await i(`${c()}/sessions/${t}/import/incremental`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,newMessageCount:0,error:`HTTP ${o.status}: ${a}`}}return w(o,{success:!1,newMessageCount:0,error:"Unknown error"},r)}async importDirectory(t,s,r){if(typeof t=="string")return{success:!1,error:"Directory path import is not supported in Web mode"};if(t.length===0)return{success:!1,error:"No files in directory"};const e=new FormData;for(const a of t)e.append("files",a),e.append("relativePaths",a.webkitRelativePath||a.name);const o=await i(`${c()}/import-directory`,{method:"POST",body:e});if(!o.ok){const a=await o.text();return{success:!1,error:`HTTP ${o.status}: ${a}`}}return h(await w(o,{success:!1,error:"Unknown error"},r))}}export{b as FetchImportAdapter};