@cuongtran001/kanna 1.112.0 → 1.112.2

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 (42) hide show
  1. package/dist/client/assets/{BoardsPage-BS-X9aov.js → BoardsPage-C4ENzt64.js} +1 -1
  2. package/dist/client/assets/{BoardsRoutePage-DH_FSa9D.js → BoardsRoutePage-C5PTbi6Z.js} +1 -1
  3. package/dist/client/assets/{ChatPage-DXxHoPc9.js → ChatPage-BHMfe4hl.js} +3 -3
  4. package/dist/client/assets/{CronJobsPage-C4VwunK5.js → CronJobsPage-Bh091yEI.js} +1 -1
  5. package/dist/client/assets/{FilePreviewSheet-CG0HpRDD.js → FilePreviewSheet-C2s7k36v.js} +1 -1
  6. package/dist/client/assets/{FlowSurface-DykSXuEq.js → FlowSurface-jNQcFMOA.js} +1 -1
  7. package/dist/client/assets/{GenUIBlock-DH3JfQv6.js → GenUIBlock-hkkM4P_r.js} +2 -2
  8. package/dist/client/assets/{InboundHandlerFields-1HglWhvK.js → InboundHandlerFields-CHcSqbMB.js} +1 -1
  9. package/dist/client/assets/{InboxPage-D0x0vrxJ.js → InboxPage-BpqjwtXn.js} +1 -1
  10. package/dist/client/assets/{LocalProjectsPage-ByzldcFY.js → LocalProjectsPage-lyxhfFS2.js} +1 -1
  11. package/dist/client/assets/{PluginPage-3M8_92nv.js → PluginPage-CEmCB38q.js} +1 -1
  12. package/dist/client/assets/{SettingsPage-D1pWNjOV.js → SettingsPage-BsQiWj_w.js} +1 -1
  13. package/dist/client/assets/{StackBoardsRoutePage-BB4N2PvL.js → StackBoardsRoutePage-Dj88KTce.js} +1 -1
  14. package/dist/client/assets/{ToolCallMessage-BUYUQ7gJ.js → ToolCallMessage-I5nT0rPg.js} +1 -1
  15. package/dist/client/assets/{VChartSurface-CIvQZGUJ.js → VChartSurface-DezqqT8Y.js} +1 -1
  16. package/dist/client/assets/{WebhooksPage-skxsqDwx.js → WebhooksPage-BCMse54G.js} +1 -1
  17. package/dist/client/assets/{WorkflowsPage-CiMSQgt6.js → WorkflowsPage-vWjQy33o.js} +1 -1
  18. package/dist/client/assets/{beacon-alias-DOK96oF3.js → beacon-alias-DU-hx8ux.js} +3 -3
  19. package/dist/client/assets/{contextWindow-DzdFsmAN.js → contextWindow-D6tuokPX.js} +1 -1
  20. package/dist/client/assets/{copyFeedbackStore-C99Dk7dd.js → copyFeedbackStore-DHN0d0wY.js} +1 -1
  21. package/dist/client/assets/{errors-gzkyHtvT.js → errors-W4jQ4RJU.js} +1 -1
  22. package/dist/client/assets/{inboxAutonomy-BbSS39ZI.js → inboxAutonomy-C7kYrLi-.js} +1 -1
  23. package/dist/client/assets/{index-C7sUnaMy.js → index-DBSVTFCP.js} +3 -3
  24. package/dist/client/assets/{keybindings-CcJR7jqv.js → keybindings-CMDgT5Fr.js} +1 -1
  25. package/dist/client/assets/{pendingActionsStore-Bg8DPvPu.js → pendingActionsStore-BgvURrXK.js} +1 -1
  26. package/dist/client/assets/runDetached-BkBQfi5b.js +1 -0
  27. package/dist/client/assets/{searchable-select-BfJAIk39.js → searchable-select-BdWimkUA.js} +1 -1
  28. package/dist/client/assets/{select-BmtMqoF4.js → select-BzVGFhmQ.js} +1 -1
  29. package/dist/client/assets/{settings-header-button-AstqocLX.js → settings-header-button-GQg0n1x9.js} +1 -1
  30. package/dist/client/assets/{textarea-CS61Vz3t.js → textarea-DlZ4tGyx.js} +1 -1
  31. package/dist/client/assets/{timer.adapter-B8nasB3D.js → timer.adapter-DWVGc3wb.js} +1 -1
  32. package/dist/client/assets/{useAppGlobalState-C6kvhjRE.js → useAppGlobalState-BruhC_so.js} +1 -1
  33. package/dist/client/assets/{useProviderCatalog-Dkwrdqi0.js → useProviderCatalog-Bi14KFxt.js} +1 -1
  34. package/dist/client/index.html +14 -14
  35. package/package.json +1 -1
  36. package/src/server/agent-coordinator.ts +3 -3
  37. package/src/server/agent.test.ts +107 -4
  38. package/src/server/claude-tool-respond.test.ts +58 -43
  39. package/src/server/claude-tool-respond.ts +35 -16
  40. package/src/server/proactive-compact.test.ts +8 -0
  41. package/src/server/proactive-compact.ts +1 -1
  42. package/dist/client/assets/runDetached-BriqYoL_.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-BCiCTKAo.js";import{t as a}from"./react-BWPDF9mI.js";import{t as o}from"./jsx-runtime-BB9-612F.js";import{l as s,n as c}from"./useTheme-Cb3XmN93.js";import{t as l}from"./runDetached-BriqYoL_.js";import{t as u}from"./dom.adapter-C26vNdMA.js";import"./index-C7sUnaMy.js";import{o as d}from"./GenUIBlock-DH3JfQv6.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){let n=t.get(e.series);return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:n?.label??e.series,role:n?.role??`series`,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}var E=`seriesLabel`;function D(e,t){let n=e?.[t];return typeof n==`string`?n:``}function O(e){return D(e,`role`)===`compare`}function k(e,t=()=>!0){let n=new Map(e.series.map(e=>[e.id,e]));return e.points.filter(t).map(e=>C(e,n))}function A(e){let t=e?.value;return typeof t==`number`?t:null}function ee(e){let t=t=>s(A(t),e.format);return{mark:{title:{value:e=>D(e,`xLabel`)},content:[{key:e=>D(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>D(e,`xLabel`)},content:[{key:e=>D(e,`seriesLabel`),value:t}]}}}function te(e){return e.kind!==`line`&&e.kind!==`area`}function ne(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>s(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!te(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function re(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function ie(e,t){return{background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:ee(e),legends:re(e,t)}}function ae(e,t){return{data:[{id:`points`,values:k(e)}],...ie(e,t)}}function oe(e,t){switch(e.kind){case`line`:return ce(e,t);case`area`:return le(e,t);case`bar`:case`stacked-bar`:return ue(e,t);case`combo`:return de(e,t);case`waterfall`:return fe(e,t);case`composition`:return pe(e,t)}}function se(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function ce(e,t){return{type:`line`,...ae(e,t),xField:`x`,yField:`value`,seriesField:E,axes:ne(e,t),crosshair:se(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:e=>O(e)?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function le(e,t){return{type:`area`,...ae(e,t),xField:`x`,yField:`value`,seriesField:E,axes:ne(e,t),crosshair:se(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:e=>O(e)?0:b}},point:{visible:!1}}}function ue(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...ae(e,t),xField:r?[`x`,E]:`x`,yField:`value`,seriesField:E,stack:n,barMaxWidth:24,barGapInGroup:2,axes:ne(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function de(e,t){let[n,r]=e.series,i=t=>k(e,e=>e.series===t);return{type:`common`,...ie(e,t),data:[{id:`bars`,values:i(n?.id)},{id:`line`,values:i(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:E,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:E,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:ne(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function fe(e,t){return{type:`rangeColumn`,...ae(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:E,barMaxWidth:24,axes:ne(e,t),bar:{style:{cornerRadius:2}}}}function pe(e,t){return{type:`pie`,...ae(e,t),categoryField:E,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var me=e=>e,he;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(he||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var ge=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||i&&!o.once||n&&o.context!==n||s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),_e,ve=t((()=>{_e=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),ye,be=t((()=>{ve(),ye=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||_e(e,`Boolean`)})),M,xe=t((()=>{M=e=>typeof e==`function`})),N,Se=t((()=>{N=e=>e==null})),P,Ce=t((()=>{P=e=>e!=null})),F,we=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Te,Ee=t((()=>{Te=e=>typeof e==`object`&&!!e})),De,Oe=t((()=>{Ee(),ve(),De=function(e){if(!Te(e)||!_e(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),ke,Ae=t((()=>{ke=e=>e===void 0})),I,je=t((()=>{ve(),I=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||_e(e,`String`)}})),L,Me=t((()=>{ve(),L=e=>Array.isArray?Array.isArray(e):_e(e,`Array`)})),Ne,Pe=t((()=>{Ne=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Fe,Ie=t((()=>{ve(),Fe=e=>_e(e,`Date`)})),R,Le=t((()=>{ve(),R=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||_e(e,`Number`)}})),z,Re=t((()=>{Le(),z=e=>R(e)&&Number.isFinite(e)})),ze,Be=t((()=>{ze=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Ve,He=t((()=>{Ve=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),Ue,We=t((()=>{Ue=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),Ge,Ke,qe=t((()=>{Ge=Object.prototype,Ke=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ge)}}));function B(e){if(N(e))return!0;if(Ne(e))return!e.length;let t=Ue(e);if(t===`Map`||t===`Set`)return!e.size;if(Ke(e))return!Object.keys(e).length;for(let t in e)if(Je.call(e,t))return!1;return!0}var Je,Ye=t((()=>{Se(),Pe(),We(),qe(),Je=Object.prototype.hasOwnProperty})),Xe,Ze=t((()=>{je(),Xe=(e,t,n)=>{let r=I(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Qe,$e,et=t((()=>{Qe=Object.prototype.hasOwnProperty,$e=(e,t)=>e!=null&&Qe.call(e,t)}));function tt(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=L(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:ye(e)||R(e)||I(e)?e:Fe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=tt(a,t,n)}return r}var nt=t((()=>{Me(),be(),Ie(),Le(),je(),Ce()}));function rt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&L(e[o])?at(e,o,i[o]):it(e,t,o,n,r)}}}}function it(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(L(o)){if(r)s=[];else if(L(a))s=a;else if(Ne(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else De(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&rt(s,o,r,i),at(e,n,s)}function at(e,t,n){(n!==void 0&&!ot(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function ot(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function st(e,...t){let n=-1,r=t.length;for(;++n<r;)rt(e,t[n],!0);return e}var ct=t((()=>{Me(),Pe(),Oe(),Ce()}));function lt(e,t){if(!e||!De(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(I(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var ut=t((()=>{Oe(),je()}));function dt(e){return Object.prototype.toString.call(e)}function ft(e){return Object.keys(e)}function pt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(dt(e)!==dt(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(L(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!pt(e[r],t[r],n))return!1;return!0}if(!De(e))return!1;let r=ft(e),i=ft(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!pt(e[a],t[a],n))return!1}return!0}var mt=t((()=>{Me(),xe(),Oe()}));function ht(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function gt(e,t,n){let r=ht(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function _t(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else gt(e,t,n)}var vt=t((()=>{}));function V(e){return P(e)?L(e)?e:[e]:[]}function yt(e){if(Ne(e))return e[e.length-1]}function bt(e,t){if(!L(e)||!L(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xt(e){if(!L(e))return[e];let t=[];for(let n of e)t.push(...xt(n));return t}var St,Ct,wt=t((()=>{Me(),Pe(),Ce(),St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},Ct=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function Tt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Et=t((()=>{Ce()}));function Dt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Ot=t((()=>{}));function kt(e){return Number(e)}var At=t((()=>{})),jt=t((()=>{}));function Mt(e,t,n){let r=[t].concat([].slice.call(n));Nt&&console[e].apply(console,r)}var Nt,Pt,Ft,It=t((()=>{Le(),Nt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Pt||={}),Ft=class e{static getInstance(t,n){return e._instance&&R(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Pt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Pt.Info}canLogDebug(){return this._level>=Pt.Debug}canLogError(){return this._level>=Pt.Error}canLogWarn(){return this._level>=Pt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Pt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):Mt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Pt.Warn&&Mt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Pt.Info&&Mt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Pt.Debug&&Mt(this._method||`log`,`DEBUG`,e),this}},Ft._instance=null}));function Lt(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Dt(e[i],t)>0?r=i:n=i+1}return n}var Rt,zt=t((()=>{Ot(),Se(),Rt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function Bt(e,t,n=Wt,r=Ut){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Vt(e,t,n,r){return e>t&&!Bt(e,t,n,r)}function Ht(e,t,n,r){return e<t&&!Bt(e,t,n,r)}var Ut,Wt,Gt=t((()=>{Ut=1e-10,Wt=1e-10})),Kt,qt=t((()=>{Kt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),Jt,Yt=t((()=>{Jt=function(e,t,n){return e<t?t:e>n?n:e}})),Xt,Zt=t((()=>{Xt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Qt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var $t=t((()=>{}));function en(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&tn;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(z(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var tn,nn=t((()=>{we(),Re(),tn=!1;try{tn=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{tn=!1}tn=!1}));function rn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),en(e,t,{leading:r,trailing:i,maxWait:t})}var an=t((()=>{nn(),we()}));function on(e,t){return n=>e*(1-n)+t*n}function sn(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function cn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var ln,un=t((()=>{ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(ln.source,`g`)})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{})),Cn=t((()=>{})),wn=t((()=>{})),Tn=t((()=>{})),En=t((()=>{be(),xe(),Se(),Ce(),we(),Ee(),Oe(),ve(),Ae(),je(),Me(),Pe(),Ie(),Le(),Re(),Be(),He(),Ye(),Ze(),et(),nt(),ct(),ut(),mt(),vt(),wt(),Et(),jt(),zt(),jt(),Gt(),qt(),Yt(),Zt(),$t(),nn(),an(),un(),At(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),yn(),xn(),Sn(),Cn(),bn(),wn(),Tn()})),Dn=t((()=>{}));function On(e){return e>1?0:e<-1?In:Math.acos(e)}function kn(e){return e>=1?Ln:e<=-1?-Ln:Math.asin(e)}function An(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function jn(e,t){return e[0]*t[1]-e[1]*t[0]}function Mn(e,t){return zn(e[0]-t[0])+zn(e[1]-t[1])<1e-12}function Nn(e,t=10){return Math.round(e*t)/t}function Pn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function Fn(e,t){return Nn(e-t,10**Math.max(Pn(e),Pn(t)))}var In,Ln,Rn,H,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn=t((()=>{In=Math.PI,Ln=In/2,Rn=2*In,H=2*Math.PI,zn=Math.abs,Bn=Math.atan2,Vn=Math.cos,Hn=Math.max,Un=Math.min,Wn=Math.sin,Gn=Math.sqrt,Kn=Math.pow})),Jn,Yn,Xn=t((()=>{Le(),qn(),Jn=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return R(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return R(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Yn=class{static distancePP(e,t){return Gn(Kn(e.x-t.x,2)+Kn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Gn(Kn(e-n,2)+Kn(t-r,2))}static distancePN(e,t,n){return Gn(Kn(t-e.x,2)+Kn(n-e.y,2))}static pointAtPP(e,t,n){return new Jn((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Zn=t((()=>{}));function Qn(e){return Math.PI/180*e}function $n(e){return 180*e/Math.PI}function er(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function tr(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function nr(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=tr(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function rr(e,t,n,r){let{x:i,y:a}=t,o=nr(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function ir(e){return(e=tr(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var ar,or,sr=t((()=>{qn(),ar=(e=0)=>{if(e<0)for(;e<-Rn;)e+=Rn;else if(e>0)for(;e>Rn;)e-=Rn;return e},or=ar}));function cr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function lr(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function ur(e,t,n,r){if(!lr(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(cr(i,t,e),cr(a,r,n),Mn(i,a))return!0;cr(o,n,e);let s=jn(o,a)/jn(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function dr(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=br(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function fr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=br(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function pr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function mr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function hr({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function gr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function _r(e,t){let n=t?Qn(e.angle):e.angle,r=gr(e);return[hr({x:e.x1,y:e.y1},n,r),hr({x:e.x2,y:e.y1},n,r),hr({x:e.x2,y:e.y2},n,r),hr({x:e.x1,y:e.y2},n,r)]}function vr(e,t,n=!1){let r=_r(e,n),i=_r(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(gr(e),gr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?Qn(e.angle):e.angle,f=n?Qn(90-e.angle):e.angle+Ln,p=n?Qn(t.angle):t.angle,m=n?Qn(90-t.angle):t.angle+Ln;f>H&&(f-=H),m>H&&(m-=H);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(mr(i,n)+mr(i,r))/2>mr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var yr,br,xr=t((()=>{sr(),qn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(yr||={}),br=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),Sr=t((()=>{})),Cr=t((()=>{})),wr=t((()=>{xr(),Sr(),Cr()})),Tr=t((()=>{}));function Er(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Dr=t((()=>{})),Or=t((()=>{})),kr,Ar=t((()=>{kr=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function jr(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var Mr=t((()=>{})),Nr,Pr=t((()=>{En(),Ar(),Mr(),Nr=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=jr(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return I(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(kr(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(kr(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(L(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Nr.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Nr.NUMBERS_CHAR_SET=`0123456789`,Nr.FULL_SIZE_CHAR=`字`})),Fr=t((()=>{})),Ir=t((()=>{Pr(),Fr(),Mr()})),Lr=t((()=>{Ar(),Ir()})),Rr,zr,Br,Vr=t((()=>{Rr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},zr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),Br=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Hr=t((()=>{Zn(),wr(),Tr(),Dr(),Or(),Lr(),Vr()}));function Ur(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var Wr,Gr,Kr,qr=t((()=>{En(),Hr(),Wr=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return L(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Ur(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Gr=class extends Wr{},Kr=class e extends Wr{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return vr(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[hr({x:this.x1,y:this.y1},this.angle,e),hr({x:this.x2,y:this.y1},this.angle,e),hr({x:this.x1,y:this.y2},this.angle,e),hr({x:this.x2,y:this.y2},this.angle,e)]}}}));function Jr(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=Vn(o),h=Wn(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Yr,Xr=t((()=>{sr(),qn(),Yr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=$n(a.rotateDeg),a}}})),Zr=t((()=>{Dn(),Xn(),qr(),Xr()})),Qr,$r=t((()=>{Qr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function ei(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var ti=t((()=>{}));function ni(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var ri=t((()=>{}));function ii(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ai(e){return R(e)?new mi(e>>16,e>>8&255,255&e,1):L(e)?new mi(e[0],e[1],e[2]):new mi(255,255,255)}function oi(e){return R(e)?new mi(e>>>24,e>>>16&255,e>>>8&255,255&e):L(e)?new mi(e[0],e[1],e[2],e[3]):new mi(255,255,255,1)}function si(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function ci(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var li,ui,di,fi,pi,mi,hi=t((()=>{En(),ti(),ri(),li=/^#([0-9a-f]{3,8})$/,ui={transparent:4294967040},di={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fi=(e,t)=>{let n=li.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new mi((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ai(e):t===8?new mi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},pi=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(ui[e]))return oi(ui[e]);if(P(di[e]))return ai(di[e]);let t=`${e}`.trim().toLowerCase(),n=fi(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new mi(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=ei(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new mi(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new mi(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=ni(this.color.r,this.color.g,this.color.b),a=ei(N(e)?i.h:Jt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new mi(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return fi(t,!0)??this}setColorName(e){let t=di[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=si(e.color.r),this.color.g=si(e.color.g),this.color.b=si(e.color.b),this}copyLinearToSRGB(e){return this.color.r=ci(e.color.r),this.color.g=ci(e.color.g),this.color.b=ci(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},mi=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${ii(this.r)+ii(this.g)+ii(this.b)+(this.opacity===1?``:ii(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=ni(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function gi(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var _i=t((()=>{}));function vi(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var yi=t((()=>{}));function bi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new mi(t,u,d,c*(1-e)+l*e)}}var xi=t((()=>{hi()})),Si=r({Color:()=>pi,DEFAULT_COLORS:()=>di,RGB:()=>mi,hexToRgb:()=>gi,hslToRgb:()=>ei,interpolateRgb:()=>bi,rgbToHex:()=>vi,rgbToHsl:()=>ni}),Ci=t((()=>{hi(),_i(),ti(),yi(),ri(),xi()})),wi=t((()=>{}));function Ti(e){if(z(e))return[e,e,e,e];if(L(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var Ei=t((()=>{Re(),Me(),we()})),Di=t((()=>{})),Oi=t((()=>{})),ki=t((()=>{Di(),Oi()}));function Ai(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function ji(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var Mi,Ni,Pi=t((()=>{Mi=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Ni=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Fi=t((()=>{})),Ii=t((()=>{})),Li=t((()=>{})),Ri=t((()=>{})),zi=t((()=>{Fi(),Ii(),Ri(),Li()})),Bi,Vi=t((()=>{Bi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Hi=t((()=>{})),Ui=t((()=>{})),Wi=t((()=>{Ui(),Hi()})),Gi=t((()=>{})),Ki=t((()=>{})),qi=t((()=>{})),Ji=t((()=>{Gi(),Ki(),qi()})),Yi,U=t((()=>{Yi=n(ge()),En(),Zr(),$r(),qn(),sr(),Ci(),Hr(),wi(),It(),Ei(),ki(),Pi(),zi(),Ci(),Vi(),Wi(),Ji()})),Xi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};U();var Zi=function(e,...t){return ea(tt(e),...t)};function Qi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)Qi(e[n],r,t)}else e[n]=r}function $i(e,t){if(F(t)&&e!==t)for(let n in t)Qi(e,t,n)}function ea(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)$i(e,t[n]);return e}var ta;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(ta||={});var na=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};U();var ra=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(z(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>ia(e,t,a))),e};function ia(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var aa={},oa={},sa=34,ca=10,la=13;function ua(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function da(e,t){var n=ua(e);return function(r,i){return t(n(r),i,e)}}function fa(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function pa(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function ma(e){return e<0?`-`+pa(-e,6):e>9999?`+`+pa(e,6):pa(e,4)}function ha(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:ma(e.getUTCFullYear(),4)+`-`+pa(e.getUTCMonth()+1,2)+`-`+pa(e.getUTCDate(),2)+(i?`T`+pa(t,2)+`:`+pa(n,2)+`:`+pa(r,2)+`.`+pa(i,3)+`Z`:r?`T`+pa(t,2)+`:`+pa(n,2)+`:`+pa(r,2)+`Z`:n||t?`T`+pa(t,2)+`:`+pa(n,2)+`Z`:``)}function ga(e){var t=RegExp(`["`+e+`
1
+ import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-BCiCTKAo.js";import{t as a}from"./react-BWPDF9mI.js";import{t as o}from"./jsx-runtime-BB9-612F.js";import{l as s,n as c}from"./useTheme-Cb3XmN93.js";import{t as l}from"./runDetached-BkBQfi5b.js";import{t as u}from"./dom.adapter-C26vNdMA.js";import"./index-DBSVTFCP.js";import{o as d}from"./GenUIBlock-hkkM4P_r.js";var f=n(a(),1);function p(e){let t=e.h*Math.PI/180,n=e.c*Math.cos(t),r=e.c*Math.sin(t),i=e.l+.3963377774*n+.2158037573*r,a=e.l-.1055613458*n-.0638541728*r,o=e.l-.0894841775*n-1.291485548*r,s=i**3,c=a**3,l=o**3;return[4.0767416621*s-3.3077115913*c+.2309699292*l,-1.2684380046*s+2.6097574011*c-.3413193965*l,-.0041960863*s-.7034186147*c+1.707614701*l]}var m=/^oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)\s*(?:\/\s*([0-9.]+)(%?)\s*)?\)$/i;function h(e){let t=m.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=t[5]===void 0?1:Number(t[5])/(t[6]?100:1);return{l:t[2]?n/100:n,c:Number(t[3]),h:Number(t[4]),alpha:r}}function g(e){let t=Math.max(0,Math.min(1,e)),n=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function _(e,t=1){let[n,r,i]=p(e).map(g);return t>=1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${t})`}function v(e,t){let n=h(e);return n?_(n,n.alpha):e.trim()||t}function y(e){let t=(t,n)=>v(e(t,``),n),n=Array.from({length:8},(e,n)=>t(`--chart-${n+1}`,`rgb(42, 120, 214)`)),r=t(`--muted-foreground`,`rgb(115, 107, 108)`);return{series:n,compare:r,increase:n[0]??r,decrease:n[7]??r,total:r,grid:t(`--chart-grid`,`rgb(236, 232, 232)`),axis:t(`--chart-axis`,`rgb(204, 198, 198)`),text:t(`--foreground`,`rgb(30, 24, 25)`),mutedText:r,surface:t(`--card`,`rgb(255, 253, 253)`),fontFamily:e(`--kanna-font-body`,`ui-sans-serif, system-ui, sans-serif`)}}var b=.1,x=[4,3],S=11;function C(e,t){let n=t.get(e.series);return{x:e.x,xLabel:e.xLabel,series:e.series,seriesLabel:n?.label??e.series,role:n?.role??`series`,value:e.value,start:e.start??0,end:e.end??e.value}}function w(e,t){switch(e.role){case`compare`:return t.compare;case`increase`:return t.increase;case`decrease`:return t.decrease;case`total`:return t.total;default:return t.series[e.slot??0]??t.series[0]??t.text}}function T(e,t){return{type:`ordinal`,domain:e.series.map(e=>e.label),range:e.series.map(e=>w(e,t))}}var E=`seriesLabel`;function D(e,t){let n=e?.[t];return typeof n==`string`?n:``}function O(e){return D(e,`role`)===`compare`}function k(e,t=()=>!0){let n=new Map(e.series.map(e=>[e.id,e]));return e.points.filter(t).map(e=>C(e,n))}function A(e){let t=e?.value;return typeof t==`number`?t:null}function ee(e){let t=t=>s(A(t),e.format);return{mark:{title:{value:e=>D(e,`xLabel`)},content:[{key:e=>D(e,`seriesLabel`),value:t}]},dimension:{title:{value:e=>D(e,`xLabel`)},content:[{key:e=>D(e,`seriesLabel`),value:t}]}}}function te(e){return e.kind!==`line`&&e.kind!==`area`}function ne(e,t){let n={fill:t.mutedText,fontSize:S,fontFamily:t.fontFamily};return[{orient:`left`,type:`linear`,label:{style:n,formatMethod:t=>s(Number(t),e.format,{compact:!0})},grid:{visible:!0,style:{stroke:t.grid,lineWidth:1,lineDash:[]}},domainLine:{visible:!1},tick:{visible:!1}},{orient:`bottom`,type:`band`,sampling:!te(e),label:{style:n,autoLimit:!0,formatMethod:t=>e.xLabels[String(t)]??String(t)},domainLine:{visible:!0,style:{stroke:t.axis,lineWidth:1}},tick:{visible:!1},grid:{visible:!1}}]}function re(e,t){return{visible:e.series.length>=2,orient:`top`,position:`start`,item:{label:{style:{fill:t.text,fontSize:S,fontFamily:t.fontFamily}}}}}function ie(e,t){return{background:`transparent`,padding:{top:8,right:12,bottom:4,left:4},color:T(e,t),tooltip:ee(e),legends:re(e,t)}}function ae(e,t){return{data:[{id:`points`,values:k(e)}],...ie(e,t)}}function oe(e,t){switch(e.kind){case`line`:return ce(e,t);case`area`:return le(e,t);case`bar`:case`stacked-bar`:return ue(e,t);case`combo`:return de(e,t);case`waterfall`:return fe(e,t);case`composition`:return pe(e,t)}}function se(e){return{xField:{visible:!0,line:{type:`line`,style:{stroke:e.axis,lineWidth:1}}}}}function ce(e,t){return{type:`line`,...ae(e,t),xField:`x`,yField:`value`,seriesField:E,axes:ne(e,t),crosshair:se(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`,lineDash:e=>O(e)?x:[]}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}}function le(e,t){return{type:`area`,...ae(e,t),xField:`x`,yField:`value`,seriesField:E,axes:ne(e,t),crosshair:se(t),line:{style:{lineWidth:2,lineCap:`round`,lineJoin:`round`}},area:{style:{fillOpacity:e=>O(e)?0:b}},point:{visible:!1}}}function ue(e,t){let n=e.kind===`stacked-bar`,r=!n&&e.series.length>1;return{type:`bar`,...ae(e,t),xField:r?[`x`,E]:`x`,yField:`value`,seriesField:E,stack:n,barMaxWidth:24,barGapInGroup:2,axes:ne(e,t),bar:{style:{cornerRadius:n?0:[4,4,0,0],stroke:t.surface,lineWidth:n?2:0}}}}function de(e,t){let[n,r]=e.series,i=t=>k(e,e=>e.series===t);return{type:`common`,...ie(e,t),data:[{id:`bars`,values:i(n?.id)},{id:`line`,values:i(r?.id)}],series:[{type:`bar`,dataIndex:0,xField:`x`,yField:`value`,seriesField:E,barMaxWidth:24,bar:{style:{cornerRadius:[4,4,0,0]}}},{type:`line`,dataIndex:1,xField:`x`,yField:`value`,seriesField:E,line:{style:{lineWidth:2}},point:{style:{size:8,stroke:t.surface,lineWidth:2}}}],axes:ne(e,t).map(e=>e.orient===`left`?{...e,seriesIndex:[0,1]}:e)}}function fe(e,t){return{type:`rangeColumn`,...ae(e,t),xField:`x`,minField:`start`,maxField:`end`,seriesField:E,barMaxWidth:24,axes:ne(e,t),bar:{style:{cornerRadius:2}}}}function pe(e,t){return{type:`pie`,...ae(e,t),categoryField:E,valueField:`value`,innerRadius:.62,outerRadius:.9,pie:{style:{stroke:t.surface,lineWidth:2}}}}var me=e=>e,he;(function(e){e[`desktop-browser`]=`desktop-browser`,e[`mobile-browser`]=`mobile-browser`,e.node=`node`,e.worker=`worker`,e.miniApp=`miniApp`,e.wx=`wx`,e.tt=`tt`,e.harmony=`harmony`,e[`desktop-miniApp`]=`desktop-miniApp`,e.lynx=`lynx`})(he||={});var j;(function(e){e.cartesianAxis=`cartesianAxis`,e.cartesianBandAxis=`cartesianAxis-band`,e.cartesianLinearAxis=`cartesianAxis-linear`,e.cartesianTimeAxis=`cartesianAxis-time`,e.cartesianLogAxis=`cartesianAxis-log`,e.cartesianSymlogAxis=`cartesianAxis-symlog`,e.polarAxis=`polarAxis`,e.polarBandAxis=`polarAxis-band`,e.polarLinearAxis=`polarAxis-linear`,e.crosshair=`crosshair`,e.cartesianCrosshair=`cartesianCrosshair`,e.polarCrosshair=`polarCrosshair`,e.dataZoom=`dataZoom`,e.geoCoordinate=`geoCoordinate`,e.indicator=`indicator`,e.discreteLegend=`discreteLegend`,e.continuousLegend=`continuousLegend`,e.colorLegend=`colorLegend`,e.sizeLegend=`sizeLegend`,e.markLine=`markLine`,e.markArea=`markArea`,e.markPoint=`markPoint`,e.polarMarkLine=`polarMarkLine`,e.polarMarkArea=`polarMarkArea`,e.polarMarkPoint=`polarMarkPoint`,e.geoMarkPoint=`geoMarkPoint`,e.tooltip=`tooltip`,e.title=`title`,e.player=`player`,e.scrollBar=`scrollBar`,e.label=`label`,e.totalLabel=`totalLabel`,e.brush=`brush`,e.poptip=`poptip`,e.customMark=`customMark`})(j||={});var ge=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||i&&!o.once||n&&o.context!==n||s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),_e,ve=t((()=>{_e=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`})),ye,be=t((()=>{ve(),ye=(e,t=!1)=>t?typeof e==`boolean`:!0===e||!1===e||_e(e,`Boolean`)})),M,xe=t((()=>{M=e=>typeof e==`function`})),N,Se=t((()=>{N=e=>e==null})),P,Ce=t((()=>{P=e=>e!=null})),F,we=t((()=>{F=e=>{let t=typeof e;return e!==null&&t===`object`||t===`function`}})),Te,Ee=t((()=>{Te=e=>typeof e==`object`&&!!e})),De,Oe=t((()=>{Ee(),ve(),De=function(e){if(!Te(e)||!_e(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}})),ke,Ae=t((()=>{ke=e=>e===void 0})),I,je=t((()=>{ve(),I=(e,t=!1)=>{let n=typeof e;return t?n===`string`:n===`string`||_e(e,`String`)}})),L,Me=t((()=>{ve(),L=e=>Array.isArray?Array.isArray(e):_e(e,`Array`)})),Ne,Pe=t((()=>{Ne=function(e){return e!==null&&typeof e!=`function`&&Number.isFinite(e.length)}})),Fe,Ie=t((()=>{ve(),Fe=e=>_e(e,`Date`)})),R,Le=t((()=>{ve(),R=(e,t=!1)=>{let n=typeof e;return t?n===`number`:n===`number`||_e(e,`Number`)}})),z,Re=t((()=>{Le(),z=e=>R(e)&&Number.isFinite(e)})),ze,Be=t((()=>{ze=e=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(e)})),Ve,He=t((()=>{Ve=e=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(e)})),Ue,We=t((()=>{Ue=e=>({}).toString.call(e).replace(/^\[object /,``).replace(/]$/,``)})),Ge,Ke,qe=t((()=>{Ge=Object.prototype,Ke=function(e){let t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ge)}}));function B(e){if(N(e))return!0;if(Ne(e))return!e.length;let t=Ue(e);if(t===`Map`||t===`Set`)return!e.size;if(Ke(e))return!Object.keys(e).length;for(let t in e)if(Je.call(e,t))return!1;return!0}var Je,Ye=t((()=>{Se(),Pe(),We(),qe(),Je=Object.prototype.hasOwnProperty})),Xe,Ze=t((()=>{je(),Xe=(e,t,n)=>{let r=I(t)?t.split(`.`):t;for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e===void 0?n:e}})),Qe,$e,et=t((()=>{Qe=Object.prototype.hasOwnProperty,$e=(e,t)=>e!=null&&Qe.call(e,t)}));function tt(e,t,n){let r;if(!P(e)||typeof e!=`object`||t&&t(e))return e;let i=L(e),a=e.length;r=i?Array(a):typeof e==`object`?{}:ye(e)||R(e)||I(e)?e:Fe(e)?new Date(+e):void 0;let o=i?void 0:Object.keys(Object(e)),s=-1;if(r)for(;++s<(o||e).length;){let i=o?o[s]:s,a=e[i];n&&n.includes(i.toString())?r[i]=a:r[i]=tt(a,t,n)}return r}var nt=t((()=>{Me(),be(),Ie(),Le(),je(),Ce()}));function rt(e,t,n=!1,r=!1){if(t){if(e===t)return;if(P(t)&&typeof t==`object`){let i=Object(t),a=[];for(let e in i)a.push(e);let{length:o}=a,s=-1;for(;o--;){let o=a[++s];!P(i[o])||typeof i[o]!=`object`||r&&L(e[o])?at(e,o,i[o]):it(e,t,o,n,r)}}}}function it(e,t,n,r=!1,i=!1){let a=e[n],o=t[n],s=t[n],c=!0;if(L(o)){if(r)s=[];else if(L(a))s=a;else if(Ne(a)){s=Array(a.length);let e=-1,t=a.length;for(;++e<t;)s[e]=a[e]}}else De(o)?(s=a??{},typeof a!=`function`&&typeof a==`object`||(s={})):c=!1;c&&rt(s,o,r,i),at(e,n,s)}function at(e,t,n){(n!==void 0&&!ot(e[t],n)||n===void 0&&!(t in e))&&(e[t]=n)}function ot(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function st(e,...t){let n=-1,r=t.length;for(;++n<r;)rt(e,t[n],!0);return e}var ct=t((()=>{Me(),Pe(),Oe(),Ce()}));function lt(e,t){if(!e||!De(e))return e;let n={};return Object.keys(e).forEach((r=>{let i=e[r],a=!1;t.forEach((e=>{(I(e)&&e===r||e instanceof RegExp&&r.match(e))&&(a=!0)})),a||(n[r]=i)})),n}var ut=t((()=>{Oe(),je()}));function dt(e){return Object.prototype.toString.call(e)}function ft(e){return Object.keys(e)}function pt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t||e==null||t==null)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(dt(e)!==dt(t))return!1;if(M(e))return!!n?.skipFunction;if(typeof e!=`object`)return!1;if(L(e)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!pt(e[r],t[r],n))return!1;return!0}if(!De(e))return!1;let r=ft(e),i=ft(t);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let e=r.length-1;e>=0;e--)if(r[e]!=i[e])return!1;for(let i=r.length-1;i>=0;i--){let a=r[i];if(!pt(e[a],t[a],n))return!1}return!0}var mt=t((()=>{Me(),xe(),Oe()}));function ht(e){if(!e)return[];if(Object.keys)return Object.keys(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);return t}function gt(e,t,n){let r=ht(t);for(let i=0;i<r.length;i++){let a=r[i];(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}return e}function _t(e,t,n=!0){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames){let r=Object.getOwnPropertyNames(t);for(let i=0;i<r.length;i++){let a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}}else gt(e,t,n)}var vt=t((()=>{}));function V(e){return P(e)?L(e)?e:[e]:[]}function yt(e){if(Ne(e))return e[e.length-1]}function bt(e,t){if(!L(e)||!L(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xt(e){if(!L(e))return[e];let t=[];for(let n of e)t.push(...xt(n));return t}var St,Ct,wt=t((()=>{Me(),Pe(),Ce(),St=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)>0&&(n=i)}return n},Ct=(e,t)=>{if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(t?.(i,n)??i-n)<0&&(n=i)}return n}}));function Tt(e,t,n){P(t)||(t=e,e=0),P(n)||(n=1);let r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);for(;++r<i;)a[r]=e+r*n;return a}var Et=t((()=>{Ce()}));function Dt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}var Ot=t((()=>{}));function kt(e){return Number(e)}var At=t((()=>{})),jt=t((()=>{}));function Mt(e,t,n){let r=[t].concat([].slice.call(n));Nt&&console[e].apply(console,r)}var Nt,Pt,Ft,It=t((()=>{Le(),Nt=typeof console<`u`,(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Info=3]=`Info`,e[e.Debug=4]=`Debug`})(Pt||={}),Ft=class e{static getInstance(t,n){return e._instance&&R(t)?e._instance.level(t):e._instance||=new e(t,n),e._instance}static setInstance(t){return e._instance=t}static setInstanceLevel(t){e._instance?e._instance.level(t):e._instance=new e(t)}static clearInstance(){e._instance=null}constructor(e=Pt.None,t){this._onErrorHandler=[],this._level=e,this._method=t}addErrorHandler(e){this._onErrorHandler.find((t=>t===e))||this._onErrorHandler.push(e)}removeErrorHandler(e){let t=this._onErrorHandler.findIndex((t=>t===e));t<0||this._onErrorHandler.splice(t,1)}callErrorHandler(...e){this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Pt.Info}canLogDebug(){return this._level>=Pt.Debug}canLogError(){return this._level>=Pt.Error}canLogWarn(){return this._level>=Pt.Warn}level(e){return arguments.length?(this._level=+e,this):this._level}error(...e){return this._level>=Pt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):Mt(this._method??`error`,`ERROR`,e)),this}warn(...e){return this._level>=Pt.Warn&&Mt(this._method||`warn`,`WARN`,e),this}info(...e){return this._level>=Pt.Info&&Mt(this._method||`log`,`INFO`,e),this}debug(...e){return this._level>=Pt.Debug&&Mt(this._method||`log`,`DEBUG`,e),this}},Ft._instance=null}));function Lt(e,t,n=0,r){for(N(r)&&(r=e.length);n<r;){let i=n+r>>>1;Dt(e[i],t)>0?r=i:n=i+1}return n}var Rt,zt=t((()=>{Ot(),Se(),Rt=(e,t,n)=>{let r=e,i=t;for(;r<i;){let e=Math.floor((r+i)/2);n(e)>=0?i=e:r=e+1}return r}}));function Bt(e,t,n=Wt,r=Ut){let i=r,a=n*Math.max(e,t);return Math.abs(e-t)<=Math.max(i,a)}function Vt(e,t,n,r){return e>t&&!Bt(e,t,n,r)}function Ht(e,t,n,r){return e<t&&!Bt(e,t,n,r)}var Ut,Wt,Gt=t((()=>{Ut=1e-10,Wt=1e-10})),Kt,qt=t((()=>{Kt=e=>{let t=null,n=null;return(...r)=>(t&&r.every(((e,n)=>e===t[n]))||(t=r,n=e(...r)),n)}})),Jt,Yt=t((()=>{Jt=function(e,t,n){return e<t?t:e>n?n:e}})),Xt,Zt=t((()=>{Xt=(e,t,n)=>{let[r,i]=e;i<r&&(r=e[1],i=e[0]);let a=i-r;return a>=n-t?[t,n]:(r=Math.min(Math.max(r,t),n-a),[r,r+a])}}));function Qt(e,t){let n;return e>t&&(n=e,e=t,t=n),n=>Math.max(e,Math.min(t,n))}var $t=t((()=>{}));function en(e,t,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&tn;if(typeof e!=`function`)throw TypeError(`Expected a function`);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(cancelAnimationFrame(s),requestAnimationFrame(e)):setTimeout(e,t)}function g(e){let n=e-c;return c===void 0||n>=t||n<0||d&&e-l>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,function(e){let n=e-l,r=t-(e-c);return d?Math.min(r,a-n):r}(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function y(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return function(e){return l=e,s=h(_,t),u?m(e):o}(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return t=+t||0,F(n)&&(u=!!n.leading,d=`maxWait`in n,d&&(a=Math.max(z(n.maxWait)?n.maxWait:0,t)),f=`trailing`in n?!!n.trailing:f),y.cancel=function(){s!==void 0&&function(e){if(p)return cancelAnimationFrame(e);clearTimeout(e)}(s),l=0,r=c=i=s=void 0},y.flush=function(){return s===void 0?o:v(Date.now())},y.pending=function(){return s!==void 0},y}var tn,nn=t((()=>{we(),Re(),tn=!1;try{tn=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`}catch{tn=!1}tn=!1}));function rn(e,t,n){let r=!0,i=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);return F(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),en(e,t,{leading:r,trailing:i,maxWait:t})}var an=t((()=>{nn(),we()}));function on(e,t){return n=>e*(1-n)+t*n}function sn(e,t){return function(n){return Math.round(e*(1-n)+t*n)}}function cn(e,t){let n=e.valueOf(),r=t.valueOf(),i=new Date;return e=>(i.setTime(n*(1-e)+r*e),i)}var ln,un=t((()=>{ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,new RegExp(ln.source,`g`)})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{})),Cn=t((()=>{})),wn=t((()=>{})),Tn=t((()=>{})),En=t((()=>{be(),xe(),Se(),Ce(),we(),Ee(),Oe(),ve(),Ae(),je(),Me(),Pe(),Ie(),Le(),Re(),Be(),He(),Ye(),Ze(),et(),nt(),ct(),ut(),mt(),vt(),wt(),Et(),jt(),zt(),jt(),Gt(),qt(),Yt(),Zt(),$t(),nn(),an(),un(),At(),dn(),fn(),pn(),mn(),hn(),gn(),_n(),vn(),yn(),xn(),Sn(),Cn(),bn(),wn(),Tn()})),Dn=t((()=>{}));function On(e){return e>1?0:e<-1?In:Math.acos(e)}function kn(e){return e>=1?Ln:e<=-1?-Ln:Math.asin(e)}function An(e,t,n,r,i){let a=n,o=r;return typeof e==`number`&&typeof n==`number`&&(a=(1-i)*e+i*n),typeof t==`number`&&typeof r==`number`&&(o=(1-i)*t+i*r),{x:a,y:o}}function jn(e,t){return e[0]*t[1]-e[1]*t[0]}function Mn(e,t){return zn(e[0]-t[0])+zn(e[1]-t[1])<1e-12}function Nn(e,t=10){return Math.round(e*t)/t}function Pn(e){let t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-(+t[1]||0);return n>0?n:0}function Fn(e,t){return Nn(e-t,10**Math.max(Pn(e),Pn(t)))}var In,Ln,Rn,H,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn=t((()=>{In=Math.PI,Ln=In/2,Rn=2*In,H=2*Math.PI,zn=Math.abs,Bn=Math.atan2,Vn=Math.cos,Hn=Math.max,Un=Math.min,Wn=Math.sin,Gn=Math.sqrt,Kn=Math.pow})),Jn,Yn,Xn=t((()=>{Le(),qn(),Jn=class e{constructor(e=0,t=0,n,r){this.x=0,this.y=0,this.x=e,this.y=t,this.x1=n,this.y1=r}clone(){return new e(this.x,this.y)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x1=e.x1,this.y1=e.y1,this.defined=e.defined,this.context=e.context,this}set(e,t){return this.x=e,this.y=t,this}add(e){return R(e)?(this.x+=e,void(this.y+=e)):(this.x+=e.x,this.y+=e.y,this)}sub(e){return R(e)?(this.x-=e,void(this.y-=e)):(this.x-=e.x,this.y-=e.y,this)}multi(e){throw Error(`暂不支持`)}div(e){throw Error(`暂不支持`)}},Yn=class{static distancePP(e,t){return Gn(Kn(e.x-t.x,2)+Kn(e.y-t.y,2))}static distanceNN(e,t,n,r){return Gn(Kn(e-n,2)+Kn(t-r,2))}static distancePN(e,t,n){return Gn(Kn(t-e.x,2)+Kn(n-e.y,2))}static pointAtPP(e,t,n){return new Jn((t.x-e.x)*n+e.x,(t.y-e.y)*n+e.y)}}})),Zn=t((()=>{}));function Qn(e){return Math.PI/180*e}function $n(e){return 180*e/Math.PI}function er(e,t,n){return t?{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}:{x:e.x,y:e.y}}function tr(e){for(;e<0;)e+=2*Math.PI;for(;e>=2*Math.PI;)e-=2*Math.PI;return e}function nr(e,t){let n=Math.abs(t-e);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];let r=tr(Math.min(e,t)),i=r+n,a=[r,i],o=Math.floor(r/Math.PI)*Math.PI/2;for(;o<i;)o>r&&a.push(o),o+=Math.PI/2;return a}function rr(e,t,n,r){let{x:i,y:a}=t,o=nr(n,r),{width:s,height:c}=e,l=[];return o.forEach((e=>{let t=Math.sin(e),n=Math.cos(e);t===1?l.push(c-a):t===-1?l.push(a):n===1?l.push(s-i):n===-1?l.push(i):(t>0?l.push(Math.abs((c-a)/t)):l.push(Math.abs(a/t)),n>0?l.push(Math.abs((s-i)/n)):l.push(Math.abs(i/n)))})),Math.min.apply(null,l)}function ir(e){return(e=tr(e))>0&&e<=Math.PI/2?2:e>Math.PI/2&&e<=Math.PI?3:e>Math.PI&&e<=3*Math.PI/2?4:1}var ar,or,sr=t((()=>{qn(),ar=(e=0)=>{if(e<0)for(;e<-Rn;)e+=Rn;else if(e>0)for(;e>Rn;)e-=Rn;return e},or=ar}));function cr(e,t,n){e[0]=t[0]-n[0],e[1]=t[1]-n[1]}function lr(e,t,n,r){let i=e[0],a=t[0],o=n[0],s=r[0];return a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i)&&(i=e[1],a=t[1],o=n[1],s=r[1],a<i&&([i,a]=[a,i]),s<o&&([s,o]=[o,s]),!(a<o||s<i))}function ur(e,t,n,r){if(!lr(e,t,n,r))return!1;let i=[0,0],a=[0,0],o=[0,0];if(cr(i,t,e),cr(a,r,n),Mn(i,a))return!0;cr(o,n,e);let s=jn(o,a)/jn(i,a);return s>=0&&s<=1&&[e[0]+i[0]*s,e[1]+i[1]*s]}function dr(e,t,n){if(e===null)return t;if(t===null)return e;let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=br(e,t,n);return r>=c||i<=s||a>=u||o<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,s),y1:Math.max(a,l),x2:Math.min(i,c),y2:Math.min(o,u)}}function fr(e,t,n){if(e&&t){if(!n)return!(e.x1>t.x2||e.x2<t.x1||e.y1>t.y2||e.y2<t.y1);let{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}=br(e,t,!0);return!(r>c||i<s||a>u||o<l)}return!0}function pr(e,t,n){if(!t)return!0;if(!n)return e.x>=t.x1&&e.x<=t.x2&&e.y>=t.y1&&e.y<=t.y2;let r=t.x1,i=t.x2,a=t.y1,o=t.y2;return r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),e.x>=r&&e.x<=i&&e.y>=a&&e.y<=o}function mr(e,t){return Math.abs(t[0]*e[0]+t[1]*e[1])}function hr({x:e,y:t},n,r={x:0,y:0}){return{x:(e-r.x)*Math.cos(n)-(t-r.y)*Math.sin(n)+r.x,y:(e-r.x)*Math.sin(n)+(t-r.y)*Math.cos(n)+r.y}}function gr(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}}function _r(e,t){let n=t?Qn(e.angle):e.angle,r=gr(e);return[hr({x:e.x1,y:e.y1},n,r),hr({x:e.x2,y:e.y1},n,r),hr({x:e.x2,y:e.y2},n,r),hr({x:e.x1,y:e.y2},n,r)]}function vr(e,t,n=!1){let r=_r(e,n),i=_r(t,n),a=(e,t)=>[t.x-e.x,t.y-e.y],o=a(gr(e),gr(t)),s=a(r[0],r[1]),c=a(r[1],r[2]),l=a(i[0],i[1]),u=a(i[1],i[2]),d=n?Qn(e.angle):e.angle,f=n?Qn(90-e.angle):e.angle+Ln,p=n?Qn(t.angle):t.angle,m=n?Qn(90-t.angle):t.angle+Ln;f>H&&(f-=H),m>H&&(m-=H);let h=(e,t,n,r)=>{let i=[Math.cos(t),Math.sin(t)];return e+(mr(i,n)+mr(i,r))/2>mr(i,o)};return h((e.x2-e.x1)/2,d,l,u)&&h((e.y2-e.y1)/2,f,l,u)&&h((t.x2-t.x1)/2,p,s,c)&&h((t.y2-t.y1)/2,m,s,c)}var yr,br,xr=t((()=>{sr(),qn(),(function(e){e[e.NONE=0]=`NONE`,e[e.BBOX1=1]=`BBOX1`,e[e.BBOX2=2]=`BBOX2`})(yr||={}),br=(e,t,n)=>{let r=e.x1,i=e.x2,a=e.y1,o=e.y2,s=t.x1,c=t.x2,l=t.y1,u=t.y2;return n&&(r>i&&([r,i]=[i,r]),a>o&&([a,o]=[o,a]),s>c&&([s,c]=[c,s]),l>u&&([l,u]=[u,l])),{x11:r,x12:i,y11:a,y12:o,x21:s,x22:c,y21:l,y22:u}}})),Sr=t((()=>{})),Cr=t((()=>{})),wr=t((()=>{xr(),Sr(),Cr()})),Tr=t((()=>{}));function Er(e,t,n,r,i,a){if(a>t&&a>r||a<t&&a<r||r===t)return 0;let o=(a-t)/(r-t),s=r<t?1:-1;o!==1&&o!==0||(s=r<t?.5:-.5);let c=o*(n-e)+e;return c===i?1/0:c>i?s:0}var Dr=t((()=>{})),Or=t((()=>{})),kr,Ar=t((()=>{kr=e=>{let t=e.charCodeAt(0),n=e.length===2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r===12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r===8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r===172||r===175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r===161||r===164||167<=r&&r<=168||r===170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r===198||r===208||215<=r&&r<=216||222<=r&&r<=225||r===230||232<=r&&r<=234||236<=r&&r<=237||r===240||242<=r&&r<=243||247<=r&&r<=250||r===252||r===254||r===257||r===273||r===275||r===283||294<=r&&r<=295||r===299||305<=r&&r<=307||r===312||319<=r&&r<=322||r===324||328<=r&&r<=331||r===333||338<=r&&r<=339||358<=r&&r<=359||r===363||r===462||r===464||r===466||r===468||r===470||r===472||r===474||r===476||r===593||r===609||r===708||r===711||713<=r&&r<=715||r===717||r===720||728<=r&&r<=731||r===733||r===735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r===1025||1040<=r&&r<=1103||r===1105||r===8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r===8240||8242<=r&&r<=8243||r===8245||r===8251||r===8254||r===8308||r===8319||8321<=r&&r<=8324||r===8364||r===8451||r===8453||r===8457||r===8467||r===8470||8481<=r&&r<=8482||r===8486||r===8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r===8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r===8658||r===8660||r===8679||r===8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r===8715||r===8719||r===8721||r===8725||r===8730||8733<=r&&r<=8736||r===8739||r===8741||8743<=r&&r<=8748||r===8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r===8776||r===8780||r===8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r===8853||r===8857||r===8869||r===8895||r===8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r===9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r===9711||9733<=r&&r<=9734||r===9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r===9756||r===9758||r===9792||r===9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r===9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r===9955||9960<=r&&r<=9983||r===10045||r===10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r===65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`}}));function jr(e,t={},n){n||=1;let{fontStyle:r=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:a=t.fontWeight,fontSize:o=t.fontSize,fontFamily:s=t.fontFamily}=e;return(r?r+` `:``)+(i?i+` `:``)+(a?a+` `:``)+o*n+`px `+(s||`sans-serif`)}var Mr=t((()=>{})),Nr,Pr=t((()=>{En(),Ar(),Mr(),Nr=class e{constructor(e,t){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=e,this._userSpec=t??{},this.textSpec=this._initSpec(),P(e.specialCharSet)&&(this.specialCharSet=e.specialCharSet),this._standardMethod=P(e.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(N(this._canvas)&&(P(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),N(this._canvas)&&typeof window<`u`&&window.document!==void 0&&globalThis&&P(globalThis.document)&&(this._canvas=globalThis.document.createElement(`canvas`))),N(this._context)&&P(this._canvas)){let e=this._canvas.getContext(`2d`);P(e)&&(e.save(),e.font=jr(this.textSpec),this._contextSaved=!0,this._context=e)}return!N(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){let{defaultFontParams:e={}}=this._option,{fontStyle:t=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight??`normal`,fontSize:i=e.fontSize??12,fontFamily:a=e.fontFamily??`sans-serif`,align:o,textAlign:s=o??`center`,baseline:c,textBaseline:l=c??`middle`,ellipsis:u,limit:d}=this._userSpec,{lineHeight:f=i}=this._userSpec;return I(f)&&f[f.length-1]===`%`&&(f=i*(Number.parseFloat(f.substring(0,f.length-1))/100)),{fontStyle:t,fontVariant:n,fontFamily:a,fontSize:i,fontWeight:r,textAlign:s,textBaseline:l,ellipsis:u,limit:d,lineHeight:f}}measure(e,t){switch(t){case`vrender`:case`canopus`:return this.fullMeasure(e);case`canvas`:return this.measureWithNaiveCanvas(e);case`simple`:return this.quickMeasureWithoutCanvas(e);default:return this.quickMeasure(e)}}fullMeasure(e){if(N(e))return{width:0,height:0};if(N(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(e);let{fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:o,limit:s,lineHeight:c}=this.textSpec,l;try{let u=this._option.getTextBounds({text:e,fontFamily:t,fontSize:n,fontWeight:r,textAlign:i,textBaseline:a,ellipsis:!!o,maxLineWidth:s||1/0,lineHeight:c});l={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(e)}return l}measureWithNaiveCanvas(e){return this._measureReduce(e,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(e){if(!this.initContext())return this._quickMeasureWithoutCanvas(e);let t=this._context.measureText(e),{fontSize:n,lineHeight:r}=this.textSpec;return{width:t.width,height:r??n,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}quickMeasure(e){return this._measureReduce(e,this._quickMeasure.bind(this))}_quickMeasure(t){let n={width:0,height:0};for(let r=0;r<t.length;r++){let i=t[r],a=this._measureSpecialChar(i);N(a)&&e.NUMBERS_CHAR_SET.includes(i)&&(a=this._measureNumberChar()),N(a)&&[`F`,`W`].includes(kr(i))&&(a=this._measureFullSizeChar()),N(a)&&(a=this._measureLetterChar()),n.width+=a.width,n.height=Math.max(n.height,a.height),!N(a.fontBoundingBoxAscent)&&(n.fontBoundingBoxAscent=a.fontBoundingBoxAscent),!N(a.fontBoundingBoxDescent)&&(n.fontBoundingBoxDescent=a.fontBoundingBoxDescent)}return n}quickMeasureWithoutCanvas(e){return this._measureReduce(e,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(e){let t={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let r=0;r<e.length;r++){let i=e[r],a=[`F`,`W`].includes(kr(i))?1:.53;t.width+=a*n}return t.height=r??n,t}_measureReduce(e,t){let{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(N(e))return i;if(L(e)){let a=e.filter(P).map((e=>e.toString()));return a.length===0?i:a.length===1?t(a[0]):{width:a.reduce(((e,n)=>Math.max(e,t(n).width)),0),height:a.length*((r??n)+1)+1}}return t(e.toString())}_measureNumberChar(){if(N(this._numberCharSize)){let t=this._standardMethod(e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/e.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return N(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(N(this._letterCharSize)){let t=this._standardMethod(e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(e){return P(this._specialCharSizeMap[e])?this._specialCharSizeMap[e]:this.specialCharSet.includes(e)?(this._specialCharSizeMap[e]=this._standardMethod(e),this._specialCharSizeMap[e]):null}release(){P(this._canvas)&&(this._canvas=null),P(this._context)&&(this._contextSaved&&=(this._context.restore(),!1),this._context=null)}},Nr.ALPHABET_CHAR_SET=`abcdefghijklmnopqrstuvwxyz`,Nr.NUMBERS_CHAR_SET=`0123456789`,Nr.FULL_SIZE_CHAR=`字`})),Fr=t((()=>{})),Ir=t((()=>{Pr(),Fr(),Mr()})),Lr=t((()=>{Ar(),Ir()})),Rr,zr,Br,Vr=t((()=>{Rr=(e,t)=>{let{x1:n,x2:r,y1:i,y2:a}=e,o=Math.abs(r-n),s=Math.abs(a-i),c=(n+r)/2,l=(i+a)/2,u=0,d=0;switch(t){case`top`:case`inside-top`:d=-.5;break;case`bottom`:case`inside-bottom`:d=.5;break;case`left`:case`inside-left`:u=-.5;break;case`right`:case`inside-right`:u=.5;break;case`top-right`:u=.5,d=-.5;break;case`top-left`:u=-.5,d=-.5;break;case`bottom-right`:u=.5,d=.5;break;case`bottom-left`:u=-.5,d=.5}return c+=u*o,l+=d*s,{x:c,y:l}},zr=(e,t)=>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),Br=(e,t)=>{let n=[{x:Math.cos(e.angle),y:Math.sin(e.angle)},{x:-Math.sin(e.angle),y:Math.cos(e.angle)},{x:Math.cos(t.angle),y:Math.sin(e.angle)},{x:-Math.sin(t.angle),y:Math.cos(e.angle)}];function r(e,t,n){let r=e.getRotatedCorners().map((e=>e.x*t+e.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let i=0;for(let a of n){let n=r(e,a.x,a.y),o=r(t,a.x,a.y),s;s=n.max<o.min?o.min-n.max:o.max<n.min?n.min-o.max:0,i=Math.max(i,s)}return i}})),Hr=t((()=>{Zn(),wr(),Tr(),Dr(),Or(),Lr(),Vr()}));function Ur(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=t;return n.onlyTranslate()?(e!==t&&e.setValue(t.x1,t.y1,t.x2,t.y2),e.translate(n.e,n.f),t):(e.clear(),e.add(n.a*r+n.c*i+n.e,n.b*r+n.d*i+n.f),e.add(n.a*a+n.c*i+n.e,n.b*a+n.d*i+n.f),e.add(n.a*a+n.c*o+n.e,n.b*a+n.d*o+n.f),e.add(n.a*r+n.c*o+n.e,n.b*r+n.d*o+n.f),t)}var Wr,Gr,Kr,qr=t((()=>{En(),Hr(),Wr=class e{constructor(e){e?this.setValue(e.x1,e.y1,e.x2,e.y2):this.clear()}clone(){return new e(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}setValue(e=0,t=0,n=0,r=0){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this}set(e=0,t=0,n=0,r=0){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this}add(e=0,t=0){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this}expand(e=0){return L(e)?(this.y1-=e[0],this.x2+=e[1],this.y2+=e[2],this.x1-=e[3]):(this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(e=0,t=0){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}rotate(e=0,t=0,n=0){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(e=0,t=0,n=0,r=0){let i=this.scalePoints(e,t,n,r);return this.clear().add(i[0],i[1]).add(i[2],i[3])}union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this}intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this}encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2}alignsWith(e){return e&&(this.x1===e.x1||this.x2===e.x2||this.y1===e.y1||this.y2===e.y2)}intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)}contains(e=0,t=0){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)}containsPoint(e){return!(e.x<this.x1||e.x>this.x2||e.y<this.y1||e.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(e=0){return this.x1*=e,this.x2*=e,this}scaleY(e=0){return this.y1*=e,this.y2*=e,this}transformWithMatrix(e){return Ur(this,this,e),this}copy(e){return this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this}rotatedPoints(e,t,n){let{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]}scalePoints(e,t,n,r){let{x1:i,y1:a,x2:o,y2:s}=this;return[e*i+(1-e)*n,t*a+(1-t)*r,e*o+(1-e)*n,t*s+(1-t)*r]}},Gr=class extends Wr{},Kr=class e extends Wr{constructor(e,t=0){super(e),e&&(this.angle=e.angle??t)}intersects(e){return vr(this,e)}setValue(e=0,t=0,n=0,r=0,i=0){return super.setValue(e,t,n,r),this.angle=i,this}clone(){return new e(this)}getRotatedCorners(){let e={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[hr({x:this.x1,y:this.y1},this.angle,e),hr({x:this.x2,y:this.y1},this.angle,e),hr({x:this.x1,y:this.y2},this.angle,e),hr({x:this.x2,y:this.y2},this.angle,e)]}}}));function Jr(e,t,n,r,i,a,o,s){let c=t.a,l=t.b,u=t.c,d=t.d,f=t.e,p=t.f,m=Vn(o),h=Wn(o),g,_;s?(g=s[0],_=s[1]):(g=n,_=r);let v=g-n,y=_-r,b=c*m+u*h,x=l*m+d*h,S=u*m-c*h,C=d*m-l*h;e.a=i*b,e.b=i*x,e.c=a*S,e.d=a*C,e.e=f+c*g+u*_-b*v-S*y,e.f=p+l*g+d*_-x*v-C*y}var Yr,Xr=t((()=>{sr(),qn(),Yr=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a}equalToMatrix(e){return this.e===e.e&&this.f===e.f&&this.a===e.a&&this.d===e.d&&this.b===e.b&&this.c===e.c}equalTo(e,t,n,r,i,a){return this.e===i&&this.f===a&&this.a===e&&this.d===r&&this.b===t&&this.c===n}setValue(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.e=i,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){let t=this.a,n=this.b,r=this.c,i=this.d,a=this.e,o=this.f,s=new e,c=t*i-n*r;return s.a=i/c,s.b=-n/c,s.c=-r/c,s.d=t/c,s.e=(r*o-i*a)/c,s.f=-(t*o-n*a)/c,s}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a*t+this.c*n,i=this.b*t+this.d*n,a=this.a*-n+this.c*t,o=this.b*-n+this.d*t;return this.a=r,this.b=i,this.c=a,this.d=o,this}rotateByCenter(e,t,n){let r=Math.cos(e),i=Math.sin(e),a=(1-r)*t+i*n,o=(1-r)*n-i*t,s=r*this.a-i*this.b,c=i*this.a+r*this.b,l=r*this.c-i*this.d,u=i*this.c+r*this.d,d=r*this.e-i*this.f+a,f=i*this.e+r*this.f+o;return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}scale(e,t){return this.a*=e,this.b*=e,this.c*=t,this.d*=t,this}setScale(e,t){return this.b=this.b/this.a*e,this.c=this.c/this.d*t,this.a=e,this.d=t,this}transform(e,t,n,r,i,a){return this.multiply(e,t,n,r,i,a),this}translate(e,t){return this.e+=this.a*e+this.c*t,this.f+=this.b*e+this.d*t,this}transpose(){let{a:e,b:t,c:n,d:r,e:i,f:a}=this;return this.a=t,this.b=e,this.c=r,this.d=n,this.e=a,this.f=i,this}multiply(e,t,n,r,i,a){let o=this.a,s=this.b,c=this.c,l=this.d,u=o*e+c*t,d=s*e+l*t,f=o*n+c*r,p=s*n+l*r,m=o*i+c*a+this.e,h=s*i+l*a+this.f;return this.a=u,this.b=d,this.c=f,this.d=p,this.e=m,this.f=h,this}interpolate(t,n){let r=new e;return r.a=this.a+(t.a-this.a)*n,r.b=this.b+(t.b-this.b)*n,r.c=this.c+(t.c-this.c)*n,r.d=this.d+(t.d-this.d)*n,r.e=this.e+(t.e-this.e)*n,r.f=this.f+(t.f-this.f)*n,r}transformPoint(e,t){let{a:n,b:r,c:i,d:a,e:o,f:s}=this,c=n*a-r*i,l=a/c,u=-r/c,d=-i/c,f=n/c,p=(i*s-a*o)/c,m=-(n*s-r*o)/c,{x:h,y:g}=e;t.x=h*l+g*d+p,t.y=h*u+g*f+m}onlyTranslate(e=1){return this.a===e&&this.b===0&&this.c===0&&this.d===e}clone(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){let e=this.a,t=this.b,n=this.c,r=this.d,i=e*r-t*n,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!==0||t!==0){let o=Math.sqrt(e*e+t*t);a.rotateDeg=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(n!==0||r!==0){let o=Math.sqrt(n*n+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=i/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotateDeg=$n(a.rotateDeg),a}}})),Zr=t((()=>{Dn(),Xn(),qr(),Xr()})),Qr,$r=t((()=>{Qr=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(e,t){let{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:i=this.R_COUNT}=t;if(e.size<n)return 0;let a=0,o=t=>{a++,e.delete(t)},s=Date.now();return e.forEach(((e,t)=>{if(e.timestamp.length<i)return o(t);let n=0;for(;s-e.timestamp[e.timestamp.length-1-n]<r&&(n++,!(n>=i)););if(n<i)return o(t);for(;s-e.timestamp[0]>r;)e.timestamp.shift()})),a}addLimitedTimestamp(e,t,n){let{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;e.timestamp.length>r&&e.timestamp.shift(),e.timestamp.push(t)}clearTimeStamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();e.forEach((e=>{for(;r-e.timestamp[0]>n;)e.timestamp.shift()}))}clearItemTimestamp(e,t){let{L_TIME:n=this.L_TIME}=t,r=Date.now();for(;r-e.timestamp[0]>n;)e.timestamp.shift()}}}));function ei(e,t,n){t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<60?(o=r,s=i,c=0):60<=e&&e<120?(o=i,s=r,c=0):120<=e&&e<180?(o=0,s=r,c=i):180<=e&&e<240?(o=0,s=i,c=r):240<=e&&e<300?(o=i,s=0,c=r):300<=e&&e<360&&(o=r,s=0,c=i),o=Math.round(255*(o+a)),s=Math.round(255*(s+a)),c=Math.round(255*(c+a)),{r:o,g:s,b:c}}var ti=t((()=>{}));function ni(e,t,n){e/=255,t/=255,n/=255;let r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=0,s=0,c=0;return o=a===0?0:i===e?(t-n)/a%6:i===t?(n-e)/a+2:(e-t)/a+4,o=Math.round(60*o),o<0&&(o+=360),c=(i+r)/2,s=a===0?0:a/(1-Math.abs(2*c-1)),s=+(100*s).toFixed(1),c=+(100*c).toFixed(1),{h:o,s,l:c}}var ri=t((()=>{}));function ii(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?`0`:``)+e.toString(16)}function ai(e){return R(e)?new mi(e>>16,e>>8&255,255&e,1):L(e)?new mi(e[0],e[1],e[2]):new mi(255,255,255)}function oi(e){return R(e)?new mi(e>>>24,e>>>16&255,e>>>8&255,255&e):L(e)?new mi(e[0],e[1],e[2],e[3]):new mi(255,255,255,1)}function si(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function ci(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}var li,ui,di,fi,pi,mi,hi=t((()=>{En(),ti(),ri(),li=/^#([0-9a-f]{3,8})$/,ui={transparent:4294967040},di={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fi=(e,t)=>{let n=li.exec(e);if(t||n){let e=parseInt(n[1],16),t=n[1].length;return t===3?new mi((e>>8&15)+((e>>8&15)<<4),(e>>4&15)+((e>>4&15)<<4),(15&e)+((15&e)<<4),1):t===6?ai(e):t===8?new mi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):null}},pi=class e{static Brighter(t,n=1){return n===1?t:new e(t).brighter(n).toRGBA()}static SetOpacity(t,n=1){return n===1?t:new e(t).setOpacity(n).toRGBA()}static getColorBrightness(t,n=`hsl`){let r=t instanceof e?t:new e(t);switch(n){case`hsv`:default:return r.getHSVBrightness();case`hsl`:return r.getHSLBrightness();case`lum`:return r.getLuminance();case`lum2`:return r.getLuminance2();case`lum3`:return r.getLuminance3();case`wcag`:return r.getLuminanceWCAG()}}static parseColorString(e){if(P(ui[e]))return oi(ui[e]);if(P(di[e]))return ai(di[e]);let t=`${e}`.trim().toLowerCase(),n=fi(t);if(n!==void 0)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(t)){let e=t.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,``).split(`,`);return new mi(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(t)){let e=t.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,``).split(`,`),n=ei(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10));return new mi(n.r,n.g,n.b,parseFloat(e[3]))}}constructor(t){let n=e.parseColorString(t);n?this.color=n:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new mi(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e))),this}add(e){let{r:t,g:n,b:r}=this.color;return this.color.r+=Math.min(255,t+e.color.r),this.color.g+=Math.min(255,n+e.color.g),this.color.b+=Math.min(255,r+e.color.b),this}sub(e){return this.color.r=Math.max(0,this.color.r-e.color.r),this.color.g=Math.max(0,this.color.g-e.color.g),this.color.b=Math.max(0,this.color.b-e.color.b),this}multiply(e){let{r:t,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(t*e.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*e.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*e.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(e,t,n){let r=this.color.opacity,i=ni(this.color.r,this.color.g,this.color.b),a=ei(N(e)?i.h:Jt(e,0,360),N(t)?i.s:t>=0&&t<=1?100*t:t,N(n)?i.l:n<=1&&n>=0?100*n:n);return this.color=new mi(a.r,a.g,a.b,r),this}setRGB(e,t,n){return!N(e)&&(this.color.r=e),!N(t)&&(this.color.g=t),!N(n)&&(this.color.b=n),this}setHex(e){let t=`${e}`.trim().toLowerCase();return fi(t,!0)??this}setColorName(e){let t=di[e.toLowerCase()];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this}setScalar(e){return this.color.r=e,this.color.g=e,this.color.b=e,this}setOpacity(e=1){return this.color.opacity=e,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){let e=this.color.r/255,t=this.color.g/255,n=this.color.b/255,r,i,a;return r=e<=.03928?e/12.92:((e+.055)/1.055)**2.4,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,.2126*r+.7152*i+.0722*a}clone(){return new e(this.color.toString())}copyGammaToLinear(e,t=2){return this.color.r=e.color.r**+t,this.color.g=e.color.g**+t,this.color.b=e.color.b**+t,this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.color.r=e.color.r**+n,this.color.g=e.color.g**+n,this.color.b=e.color.b**+n,this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.color.r=si(e.color.r),this.color.g=si(e.color.g),this.color.b=si(e.color.b),this}copyLinearToSRGB(e){return this.color.r=ci(e.color.r),this.color.g=ci(e.color.g),this.color.b=ci(e.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},mi=class{constructor(e,t,n,r){this.r=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.g=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),this.opacity=P(r)?isNaN(+r)?1:Math.max(0,Math.min(1,+r)):1}formatHex(){return`#${ii(this.r)+ii(this.g)+ii(this.b)+(this.opacity===1?``:ii(255*this.opacity))}`}formatRgb(){let e=this.opacity;return`${e===1?`rgb(`:`rgba(`}${this.r},${this.g},${this.b}${e===1?`)`:`,${e})`}`}formatHsl(){let e=this.opacity,{h:t,s:n,l:r}=ni(this.r,this.g,this.b);return`${e===1?`hsl(`:`hsla(`}${t},${n}%,${r}%${e===1?`)`:`,${e})`}`}toString(){return this.formatHex()}}}));function gi(e){let t=``,n=``,r=``,i=+(e[0]===`#`);for(let a=i;a<e.length;a++)e[a]!==`#`&&(a<i+2?t+=e[a]:a<i+4?n+=e[a]:a<i+6&&(r+=e[a]));return[parseInt(t,16),parseInt(n,16),parseInt(r,16)]}var _i=t((()=>{}));function vi(e,t,n){return Number((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}var yi=t((()=>{}));function bi(e,t){let n=e.r,r=t.r,i=e.g,a=t.g,o=e.b,s=t.b,c=e.opacity,l=t.opacity;return e=>{let t=Math.round(n*(1-e)+r*e),u=Math.round(i*(1-e)+a*e),d=Math.round(o*(1-e)+s*e);return new mi(t,u,d,c*(1-e)+l*e)}}var xi=t((()=>{hi()})),Si=r({Color:()=>pi,DEFAULT_COLORS:()=>di,RGB:()=>mi,hexToRgb:()=>gi,hslToRgb:()=>ei,interpolateRgb:()=>bi,rgbToHex:()=>vi,rgbToHsl:()=>ni}),Ci=t((()=>{hi(),_i(),ti(),yi(),ri(),xi()})),wi=t((()=>{}));function Ti(e){if(z(e))return[e,e,e,e];if(L(e)){let t=e.length;if(t===1){let t=e[0];return[t,t,t,t]}if(t===2){let[t,n]=e;return[t,n,t,n]}if(t===3){let[t,n,r]=e;return[t,n,r,n]}if(t===4)return e}if(F(e)){let{top:t=0,right:n=0,bottom:r=0,left:i=0}=e;return[t,n,r,i]}return[0,0,0,0]}var Ei=t((()=>{Re(),Me(),we()})),Di=t((()=>{})),Oi=t((()=>{})),ki=t((()=>{Di(),Oi()}));function Ai(e,t=0,n=0){if(!e)return{width:t,height:n};let r;try{r=window==null?void 0:window.getComputedStyle}catch{r=()=>({})}let i=r(e);if(/^(\d*\.?\d+)(px)$/.exec(i.width)){let r=parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)||e.clientWidth-1,a=parseFloat(i.height)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)||e.clientHeight-1;return{width:r<=0?t:r,height:a<=0?n:a}}return{width:t,height:n}}function ji(e){let{x:t,y:n}=e.getBoundingClientRect();return{x:t,y:n}}var Mi,Ni,Pi=t((()=>{Mi=(e=``)=>{let t={};return e.split(`;`).forEach((e=>{if(e){let n=e.split(`:`);if(n.length===2){let e=n[0].trim(),r=n[1].trim();e&&r&&(t[e]=r)}}})),t},Ni=e=>e.replace(/([A-Z])/g,`-$1`).toLowerCase()})),Fi=t((()=>{})),Ii=t((()=>{})),Li=t((()=>{})),Ri=t((()=>{})),zi=t((()=>{Fi(),Ii(),Ri(),Li()})),Bi,Vi=t((()=>{Bi=class e{static getInstance(){return e.instance||=new e,e.instance}constructor(){this.locale_shortWeekdays=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],this.locale_periods=[`AM`,`PM`],this.locale_weekdays=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],this.locale_shortMonths=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],this.numberRe=/^\s*\d+/,this.pads={"-":``,_:` `,0:`0`},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],this.formatShortWeekday=e=>this.locale_shortWeekdays[e.getDay()],this.formatWeekday=e=>this.locale_weekdays[e.getDay()],this.formatShortMonth=e=>this.locale_shortMonths[e.getMonth()],this.formatMonth=e=>this.locale_months[e.getMonth()],this.formatDayOfMonth=(e,t)=>this.pad(e.getDate(),t,2),this.formatHour24=(e,t)=>this.pad(e.getHours(),t,2),this.formatHour12=(e,t)=>this.pad(e.getHours()%12||12,t,2),this.formatMilliseconds=(e,t)=>this.pad(e.getMilliseconds(),t,3),this.formatMonthNumber=(e,t)=>this.pad(e.getMonth()+1,t,2),this.formatMinutes=(e,t)=>this.pad(e.getMinutes(),t,2),this.formatPeriod=e=>this.locale_periods[+(e.getHours()>=12)],this.formatSeconds=(e,t)=>this.pad(e.getSeconds(),t,2),this.formatFullYear=(e,t)=>this.pad(e.getFullYear()%1e4,t,4),this.formatUTCShortWeekday=e=>this.locale_shortWeekdays[e.getUTCDay()],this.formatUTCWeekday=e=>this.locale_weekdays[e.getUTCDay()],this.formatUTCShortMonth=e=>this.locale_shortMonths[e.getUTCMonth()],this.formatUTCMonth=e=>this.locale_months[e.getUTCMonth()],this.formatUTCDayOfMonth=(e,t)=>this.pad(e.getUTCDate(),t,2),this.formatUTCHour24=(e,t)=>this.pad(e.getUTCHours(),t,2),this.formatUTCHour12=(e,t)=>this.pad(e.getUTCHours()%12||12,t,2),this.formatUTCMilliseconds=(e,t)=>this.pad(e.getUTCMilliseconds(),t,3),this.formatUTCMonthNumber=(e,t)=>this.pad(e.getUTCMonth()+1,t,2),this.formatUTCMinutes=(e,t)=>this.pad(e.getUTCMinutes(),t,2),this.formatUTCPeriod=e=>this.locale_periods[+(e.getUTCHours()>=12)],this.formatUTCSeconds=(e,t)=>this.pad(e.getUTCSeconds(),t,2),this.formatUTCFullYear=(e,t)=>this.pad(e.getUTCFullYear()%1e4,t,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(e,t,n)=>{let r=this.shortWeekdayRe.exec(t.slice(n));return r?(e.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(e,t,n)=>{let r=this.weekdayRe.exec(t.slice(n));return r?(e.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(e,t,n)=>{let r=this.shortMonthRe.exec(t.slice(n));return r?(e.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(e,t,n)=>{let r=this.monthRe.exec(t.slice(n));return r?(e.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1},this.parseHour24=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.m=r-1,n+r[0].length):-1},this.parseMinutes=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1},this.parsePeriod=(e,t,n)=>{let r=this.periodRe.exec(t.slice(n));return r?(e.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1},this.parseFullYear=(e,t,n)=>{let r=this.numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(e,t)=>this.newFormat(e,this.formats)(new Date(this.getFullTimeStamp(t))),this.timeUTCFormat=(e,t)=>this.newFormat(e,this.utcFormats)(new Date(this.getFullTimeStamp(t))),this.timeParse=(e,t)=>this.newParse(e,!1)(t+``),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(e){return e.replace(this.requoteRe,`\\$&`)}localDate(e){if(0<=e.y&&e.y<100){let t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}utcDate(e){if(0<=e.y&&e.y<100){let t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}formatRe(e){return RegExp(`^(?:`+e.map(this.requoteF).join(`|`)+`)`,`i`)}formatLookup(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}pad(e,t,n){let r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}parseSpecifier(e,t,n,r){let i=0,a=t.length,o=n.length,s,c;for(;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=this.parses[s in this.pads?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!==n.charCodeAt(r++))return-1}return r}newParse(e,t){let n=this;return function(r){let i=n.newDate(1900,void 0,1);return n.parseSpecifier(i,e,r+=``,0)===r.length?`Q`in i?new Date(i.Q):`s`in i?new Date(1e3*i.s+(`L`in i?i.L:0)):(t&&!(`Z`in i)&&(i.Z=0),`p`in i&&(i.H=i.H%12+12*i.p),i.m===void 0&&(i.m=`q`in i?i.q:0),`Z`in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,n.utcDate(i)):n.localDate(i)):null}}newFormat(e,t){let n=this;return function(r){let i=[],a=-1,o=0,s=e.length,c,l,u;for(r instanceof Date||(r=new Date(+r));++a<s;)e.charCodeAt(a)===37&&(i.push(e.slice(o,a)),(l=n.pads[c=e.charAt(++a)])?c=e.charAt(++a):l=c===`e`?` `:`0`,u=t[c],c=u(r,l),i.push(c),o=a+1);return i.push(e.slice(o,a)),i.join(``)}}getFullTimeStamp(e){let t=parseInt(e+``,10);return String(t).length===10?1e3*t:t}}})),Hi=t((()=>{})),Ui=t((()=>{})),Wi=t((()=>{Ui(),Hi()})),Gi=t((()=>{})),Ki=t((()=>{})),qi=t((()=>{})),Ji=t((()=>{Gi(),Ki(),qi()})),Yi,U=t((()=>{Yi=n(ge()),En(),Zr(),$r(),qn(),sr(),Ci(),Hr(),wi(),It(),Ei(),ki(),Pi(),zi(),Ci(),Vi(),Wi(),Ji()})),Xi=(e,t)=>{let{callback:n}=t;return n&&(e=e.filter(n)),e};U();var Zi=function(e,...t){return ea(tt(e),...t)};function Qi(e,t,n){let r=t[n];if(r===void 0)e[n]=null;else if(F(r)){F(e[n])||(e[n]={});for(let t in r)Qi(e[n],r,t)}else e[n]=r}function $i(e,t){if(F(t)&&e!==t)for(let n in t)Qi(e,t,n)}function ea(e,...t){e||={};let n=-1,r=t.length;for(;++n<r;)$i(e,t[n]);return e}var ta;(function(e){e.DSV=`dsv`,e.TREE=`tree`,e.GEO=`geo`,e.BYTE=`bytejson`,e.HEX=`hex`,e.GRAPH=`graph`,e.TABLE=`table`,e.GEO_GRATICULE=`geo-graticule`})(ta||={});var na=(e,t)=>{let{fields:n,key:r,value:i,retains:a}=t,o=[];for(let t=0;t<e.length;t++)n.forEach((s=>{let c={};if(c[r]=s,c[i]=e[t][s],a)a.forEach((n=>{c[n]=e[t][n]}));else for(let r in e[t])n.indexOf(r)===-1&&(c[r]=e[t][r]);o.push(c)}));return o};U();var ra=(e,t)=>{if(!t?.fields||e.length===0)return e;let n=t.fields,r=e[0],i={},a=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(o.sort&&(z(o.sortIndex)||(o.sortIndex=0),P(o.sortReverse)||(o.sortReverse=o.sort===`desc`)),!o.type){let n=r;t in r||(n=e.find((e=>t in e))??r),o.type=typeof n[t]==`number`?`linear`:`ordinal`}let s;if(typeof o.sortIndex==`number`&&(s={key:t,type:o.type,index:o.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===o.sortReverse},a.push(s)),o.domain?.length>0){if(o.type===`ordinal`){o._domainCache={},i[t]=o;let e={};o.domain.forEach(((t,n)=>{e[t]=n,o._domainCache[t]=n})),s&&(s.sortIndex=e,s.sortIndexCount=o.domain.length)}else o.domain.length>=2&&(i[t]=o)}}return Object.keys(i).length>0&&(e=e.filter((e=>{for(let t in i){let n=i[t];if(n.type===`ordinal`){if(!(e[t]in n._domainCache))return!1}else if(n.domain[0]>e[t]||n.domain[1]<e[t])return!1}return!0}))),a.sort(((e,t)=>e.index-t.index)),e.sort(((e,t)=>ia(e,t,a))),e};function ia(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=0;if(i.type===`ordinal`?(i.sortIndex[t[i.key]]===void 0&&(i.sortIndex[t[i.key]]=i.sortIndexCount++),i.sortIndex[e[i.key]]===void 0&&(i.sortIndex[e[i.key]]=i.sortIndexCount++),a=i.sortIndex[e[i.key]]-i.sortIndex[t[i.key]]):i.type===`linear`&&(a=e[i.key]-t[i.key]),i.sortReverse&&(a=-a),a!==0)return a}return 0}var aa={},oa={},sa=34,ca=10,la=13;function ua(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function da(e,t){var n=ua(e);return function(r,i){return t(n(r),i,e)}}function fa(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function pa(e,t){var n=e+``,r=n.length;return r<t?Array(t-r+1).join(0)+n:n}function ma(e){return e<0?`-`+pa(-e,6):e>9999?`+`+pa(e,6):pa(e,4)}function ha(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:ma(e.getUTCFullYear(),4)+`-`+pa(e.getUTCMonth()+1,2)+`-`+pa(e.getUTCDate(),2)+(i?`T`+pa(t,2)+`:`+pa(n,2)+`:`+pa(r,2)+`.`+pa(i,3)+`Z`:r?`T`+pa(t,2)+`:`+pa(n,2)+`:`+pa(r,2)+`Z`:n||t?`T`+pa(t,2)+`:`+pa(n,2)+`Z`:``)}function ga(e){var t=RegExp(`["`+e+`
2
2
  \r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?da(e,t):ua(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===ca&&--i,e.charCodeAt(i-1)===la&&--i;function u(){if(c)return oa;if(l)return l=!1,aa;var t,r=a,o;if(e.charCodeAt(r)===sa){for(;a++<i&&e.charCodeAt(a)!==sa||e.charCodeAt(++a)===sa;);return(t=a)>=i?c=!0:(o=e.charCodeAt(a++))===ca?l=!0:o===la&&(l=!0,e.charCodeAt(a)===ca&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a<i;){if((o=e.charCodeAt(t=a++))===ca)l=!0;else if(o===la)l=!0,e.charCodeAt(a)===ca&&++a;else if(o!==n)continue;return e.slice(r,t)}return c=!0,e.slice(r,i)}for(;(s=u())!==oa;){for(var d=[];s!==aa&&s!==oa;)d.push(s),s=u();t&&(d=t(d,o++))==null||r.push(d)}return r}function a(t,n){return t.map(function(t){return n.map(function(e){return u(t[e])}).join(e)})}function o(t,n){return n??=fa(t),[n.map(u).join(e)].concat(a(t,n)).join(`
3
3
  `)}function s(e,t){return t??=fa(e),a(e,t).join(`
4
4
  `)}function c(e){return e.map(l).join(`
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{t as r}from"./utils-gw0dpHSZ.js";import{a as i,i as a,n as o,o as s,t as c}from"./copyFeedbackStore-C99Dk7dd.js";import{l,n as u,r as d,t as f}from"./pendingActionsStore-Bg8DPvPu.js";import{t as p}from"./pencil-BnnPP0sI.js";import{t as m}from"./plus-k8ypzgh4.js";import{t as h}from"./refresh-cw-BnSFXoQI.js";import{S as g,_,d as v,f as y,g as b,h as x,l as S,t as C,u as w,v as T,x as E,y as D}from"./useProviderCatalog-Dkwrdqi0.js";import{a as O,i as k,n as A,o as j,r as M,u as N}from"./timer.adapter-B8nasB3D.js";import{t as ee}from"./segmented-control-CthWIFFX.js";import{t as P}from"./createScopedStore-BZ7oYp5V.js";import{t as F}from"./input-Bkp2JE9C.js";import{g as I,n as L,o as R,p as z,t as B,u as V}from"./textarea-CS61Vz3t.js";import{t as te}from"./dom.adapter-C26vNdMA.js";import{en as ne,pn as re}from"./index-C7sUnaMy.js";import{a as H,c as ie,d as ae,f as oe,i as se,l as U,n as W,o as G,p as ce,r as K,s as le,u as ue}from"./searchable-select-BfJAIk39.js";import{t as de}from"./InboundHandlerFields-1HglWhvK.js";var q=e(t(),1);function fe(e){let t=[];return t.push(...U(e.name)),t.push(...ce(e)),t.push(...oe(e.template)),t.push(...ue([e.threadKeyPath,e.senderPath])),t.push(...ae(e.replyHint)),(e.filter?.length??0)>4e3&&t.push(`Filter must be at most ${D} characters`),t}function pe(e,t){let n=e.provider??void 0,r=e.model?.trim()||void 0;if(n===void 0&&r===void 0)return[];if(n===void 0||r===void 0)return[`Provider and model must be set together`];let i=t.find(e=>e.id===n);return i?n===`openrouter`?r.length>200?[`Model must be at most 200 characters`]:[]:i.models.some(e=>e.id===r)?[]:[`Model ${r} is not available for ${n}`]:[`Provider ${n} is not available`]}function J(e){return e.mode!==`notify`}function me(e){let t=J(e)?G(e.modelValue):null;return{name:e.name,mode:e.mode,template:e.template,...ie(e.mode,e.chatId,e.projectId),...t?{provider:t.provider,model:t.model}:{},...J(e)&&e.handling===`task`?{handling:e.handling}:{},...e.filter.trim()?{filter:e.filter}:{},...e.threadKeyPath.trim()?{threadKeyPath:e.threadKeyPath.trim()}:{},...e.senderPath.trim()?{senderPath:e.senderPath.trim()}:{},...e.replyHint.trim()?{replyHint:e.replyHint}:{}}}function he(e){return{name:e.name,mode:e.mode,template:e.template,chatId:e.chatId??null,projectId:e.projectId??null,provider:e.provider??null,model:e.model??null,filter:e.filter??null,threadKeyPath:e.threadKeyPath??null,senderPath:e.senderPath??null,replyHint:e.replyHint??null,handling:e.handling??null}}function ge(e,t){return[...fe(e),...pe(e,t)]}var Y=P(`WebhookCreateDialog`,e=>t=>({draft:{name:e?.name??``,mode:e?.mode??`notify`,handling:e?.handling??`triage`,chatId:e?.chatId??``,projectId:e?.projectId??``,modelValue:e?.provider&&e.model?le(e.provider,e.model):``,template:e?.template??`A webhook was received. Summarize what happened and say whether it needs attention.`,filter:e?.filter??``,threadKeyPath:e?.threadKeyPath??``,senderPath:e?.senderPath??``,replyHint:e?.replyHint??``},patchDraft:e=>t(t=>({draft:{...t.draft,...e}}))})),X=e(n(),1),_e=`on:
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{t as r}from"./utils-gw0dpHSZ.js";import{a as i,i as a,n as o,o as s,t as c}from"./copyFeedbackStore-DHN0d0wY.js";import{l,n as u,r as d,t as f}from"./pendingActionsStore-BgvURrXK.js";import{t as p}from"./pencil-BnnPP0sI.js";import{t as m}from"./plus-k8ypzgh4.js";import{t as h}from"./refresh-cw-BnSFXoQI.js";import{S as g,_,d as v,f as y,g as b,h as x,l as S,t as C,u as w,v as T,x as E,y as D}from"./useProviderCatalog-Bi14KFxt.js";import{a as O,i as k,n as A,o as j,r as M,u as N}from"./timer.adapter-DWVGc3wb.js";import{t as ee}from"./segmented-control-CthWIFFX.js";import{t as P}from"./createScopedStore-BZ7oYp5V.js";import{t as F}from"./input-Bkp2JE9C.js";import{g as I,n as L,o as R,p as z,t as B,u as V}from"./textarea-DlZ4tGyx.js";import{t as te}from"./dom.adapter-C26vNdMA.js";import{en as ne,pn as re}from"./index-DBSVTFCP.js";import{a as H,c as ie,d as ae,f as oe,i as se,l as U,n as W,o as G,p as ce,r as K,s as le,u as ue}from"./searchable-select-BdWimkUA.js";import{t as de}from"./InboundHandlerFields-CHcSqbMB.js";var q=e(t(),1);function fe(e){let t=[];return t.push(...U(e.name)),t.push(...ce(e)),t.push(...oe(e.template)),t.push(...ue([e.threadKeyPath,e.senderPath])),t.push(...ae(e.replyHint)),(e.filter?.length??0)>4e3&&t.push(`Filter must be at most ${D} characters`),t}function pe(e,t){let n=e.provider??void 0,r=e.model?.trim()||void 0;if(n===void 0&&r===void 0)return[];if(n===void 0||r===void 0)return[`Provider and model must be set together`];let i=t.find(e=>e.id===n);return i?n===`openrouter`?r.length>200?[`Model must be at most 200 characters`]:[]:i.models.some(e=>e.id===r)?[]:[`Model ${r} is not available for ${n}`]:[`Provider ${n} is not available`]}function J(e){return e.mode!==`notify`}function me(e){let t=J(e)?G(e.modelValue):null;return{name:e.name,mode:e.mode,template:e.template,...ie(e.mode,e.chatId,e.projectId),...t?{provider:t.provider,model:t.model}:{},...J(e)&&e.handling===`task`?{handling:e.handling}:{},...e.filter.trim()?{filter:e.filter}:{},...e.threadKeyPath.trim()?{threadKeyPath:e.threadKeyPath.trim()}:{},...e.senderPath.trim()?{senderPath:e.senderPath.trim()}:{},...e.replyHint.trim()?{replyHint:e.replyHint}:{}}}function he(e){return{name:e.name,mode:e.mode,template:e.template,chatId:e.chatId??null,projectId:e.projectId??null,provider:e.provider??null,model:e.model??null,filter:e.filter??null,threadKeyPath:e.threadKeyPath??null,senderPath:e.senderPath??null,replyHint:e.replyHint??null,handling:e.handling??null}}function ge(e,t){return[...fe(e),...pe(e,t)]}var Y=P(`WebhookCreateDialog`,e=>t=>({draft:{name:e?.name??``,mode:e?.mode??`notify`,handling:e?.handling??`triage`,chatId:e?.chatId??``,projectId:e?.projectId??``,modelValue:e?.provider&&e.model?le(e.provider,e.model):``,template:e?.template??`A webhook was received. Summarize what happened and say whether it needs attention.`,filter:e?.filter??``,threadKeyPath:e?.threadKeyPath??``,senderPath:e?.senderPath??``,replyHint:e?.replyHint??``},patchDraft:e=>t(t=>({draft:{...t.draft,...e}}))})),X=e(n(),1),_e=`on:
2
2
  issues:
3
3
  types: [assigned]
4
4
  if: body.assignee.login == "octocat"`;function ve(){let e=Y.useScopedStore(e=>e.draft.filter),t=Y.useScopedStore(e=>e.draft.threadKeyPath),n=Y.useScopedStore(e=>e.draft.senderPath),r=Y.useScopedStore(e=>e.draft.replyHint),i=Y.useScopedStore(e=>e.patchDraft);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-filter`,className:`text-sm font-medium text-foreground`,children:`Filter (optional)`}),(0,X.jsx)(B,{id:`webhook-filter`,className:`font-mono`,rows:5,value:e,onChange:e=>i({filter:e.target.value}),placeholder:_e}),(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`YAML with `,(0,X.jsx)(`code`,{className:`font-mono`,children:`on`}),` (event name from`,` `,(0,X.jsx)(`code`,{className:`font-mono`,children:`X-GitHub-Event`}),`, optional `,(0,X.jsx)(`code`,{className:`font-mono`,children:`types`}),` matched against `,(0,X.jsx)(`code`,{className:`font-mono`,children:`body.action`}),`) and `,(0,X.jsx)(`code`,{className:`font-mono`,children:`if`}),` (a CEL condition over `,(0,X.jsx)(`code`,{className:`font-mono`,children:`body`}),`, `,(0,X.jsx)(`code`,{className:`font-mono`,children:`event`}),` and`,` `,(0,X.jsx)(`code`,{className:`font-mono`,children:`headers`}),`). Deliveries that do not match are acknowledged and ignored.`]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-thread-key`,className:`text-sm font-medium text-foreground`,children:`Thread key path`}),(0,X.jsx)(F,{id:`webhook-thread-key`,className:`font-mono`,value:t,onChange:e=>i({threadKeyPath:e.target.value})}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Deliveries with the same value share one Inbox thread, and in spawn mode one chat.`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-sender`,className:`text-sm font-medium text-foreground`,children:`Sender path`}),(0,X.jsx)(F,{id:`webhook-sender`,className:`font-mono`,value:n,onChange:e=>i({senderPath:e.target.value})}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shown as the sender of the thread.`})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-reply-hint`,className:`text-sm font-medium text-foreground`,children:`Reply hint`}),(0,X.jsx)(B,{id:`webhook-reply-hint`,rows:3,value:r,onChange:e=>i({replyHint:e.target.value})}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tells the agent how to send a reply through the server's tools when you answer from the Inbox.`})]})]})}var ye=f(`webhooks.create`),be=`An outside system POSTs to the webhook url and Kanna reacts.`,xe=[`triage`,`task`].map(e=>({value:e,label:_(e)}));function Se({sidebarData:e,onCreate:t,editing:n}){let r=R(),i=C(),a=n?f(`webhooks.update`,n.id):ye,o=d(a),s=S(e=>e.closeEditor),c=Y.useScopedStore(e=>e.draft),p=Y.useScopedStore(e=>e.patchDraft),m=(0,q.useMemo)(()=>H(e),[e]),h=(0,q.useMemo)(()=>se(i),[i]),g=J(c),_=(0,q.useMemo)(()=>me(c),[c]),v=(0,q.useMemo)(()=>ge(_,i),[i,_]),y=(0,q.useCallback)(e=>{e||s()},[s]),x=(0,q.useCallback)(()=>s(),[s]),w=(0,q.useCallback)(e=>p({name:e.target.value}),[p]),T=(0,q.useCallback)(e=>p({template:e.target.value}),[p]),E=(0,q.useCallback)(e=>p({mode:e}),[p]),D=(0,q.useCallback)(e=>p({handling:e}),[p]),P=(0,q.useCallback)(e=>p({chatId:e}),[p]),I=(0,q.useCallback)(e=>p({projectId:e}),[p]),L=(0,q.useCallback)(e=>p({modelValue:e}),[p]),z=(0,q.useCallback)(()=>{v.length>0||u(a,async()=>{n?await V(r,{type:`webhooks.update`,id:n.id,patch:he(_)}):await t(_),s()})},[s,n,v.length,_,t,r,a]);return(0,X.jsx)(A,{open:!0,onOpenChange:y,children:(0,X.jsxs)(k,{size:`lg`,children:[(0,X.jsxs)(M,{className:`space-y-4`,children:[(0,X.jsx)(N,{children:n?`Edit webhook`:`New webhook`}),(0,X.jsx)(O,{children:be}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-name`,className:`text-sm font-medium text-foreground`,children:`Name`}),(0,X.jsx)(F,{id:`webhook-name`,value:c.name,onChange:w,placeholder:`GitHub CI failures`})]}),(0,X.jsx)(de,{idPrefix:`webhook`,mode:c.mode,chatId:c.chatId,projectId:c.projectId,modelValue:c.modelValue,targets:m,modelOptions:h,modelHint:`The model the turn started by this webhook runs with.`,startsTurn:g,beforeModel:g?(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Handling`}),(0,X.jsx)(ee,{value:c.handling,onValueChange:D,options:xe,size:`sm`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(c.handling)})]}):null,onModeChange:E,onChatChange:P,onProjectChange:I,onModelChange:L}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:`webhook-template`,className:`text-sm font-medium text-foreground`,children:`Instruction template`}),(0,X.jsx)(B,{id:`webhook-template`,rows:4,value:c.template,onChange:T}),(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Insert fields from the JSON body with `,(0,X.jsx)(`code`,{className:`font-mono`,children:`{{repo.name}}`}),`. The body is appended to the prompt as untrusted data.`]})]}),(0,X.jsx)(ve,{}),v.length>0&&c.name.length>0?(0,X.jsx)(`p`,{className:`text-xs text-destructive`,children:v[0]}):null]}),(0,X.jsxs)(j,{children:[(0,X.jsx)(l,{variant:`ghost`,size:`sm`,onClick:x,children:`Cancel`}),(0,X.jsx)(l,{size:`sm`,onClick:z,disabled:v.length>0,pending:o,children:n?`Save`:`Create`})]})]})})}function Z(e){let t=S(e=>e.editor),n=S(e=>e.hooks);if(!t)return null;let r=t.mode===`edit`?n.find(e=>e.id===t.hookId):void 0;return t.mode===`edit`&&!r?null:(0,X.jsx)(Y.Provider,{init:r,children:(0,X.jsx)(Se,{...e,editing:r})})}function Q({copyId:e,text:t,label:n}){let r=f(`webhooks.copy`,e),p=d(r),m=o(r),h=(0,q.useCallback)(()=>{u(r,()=>z(()=>c(r,()=>a.writeText(t))))},[r,t]);return(0,X.jsx)(L,{label:n,side:`top`,children:(0,X.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":n,pending:p,onClick:h,children:m?(0,X.jsx)(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):(0,X.jsx)(i,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})})}function Ce({hook:e,targets:t,catalog:n,origin:i,divider:a}){let o=R(),s=E(),c=T(i,e.id),m=f(`webhooks.update`,e.id),_=f(`webhooks.rotateSecret`,e.id),y=f(`webhooks.delete`,e.id),b=d(m),C=d(_),w=d(y),D=S(e=>e.openEdit),O=(0,q.useCallback)(()=>D(e.id),[e.id,D]),k=W(e,n),A=k?`${K(e,t)} · ${k}`:K(e,t),j=(0,q.useCallback)(()=>{u(m,async()=>{await V(o,{type:`webhooks.update`,id:e.id,patch:{enabled:!e.enabled}})})},[e.enabled,e.id,o,m]),M=(0,q.useCallback)(()=>{u(_,async()=>{if(!await s.confirm({title:`Rotate the secret for ${e.name}?`,description:`The current secret stops working immediately. Update every system that calls this webhook.`,confirmLabel:`Rotate`}))return;let t=await V(o,{type:`webhooks.rotateSecret`,id:e.id});S.getState().revealSecret({hookId:e.id,hookName:e.name,secret:t.secret})})},[s,e.id,e.name,_,o]),N=(0,q.useCallback)(()=>{u(y,async()=>{await s.confirm({title:`Delete ${e.name}?`,description:`Callers will receive 404. This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`})&&await V(o,{type:`webhooks.delete`,id:e.id})})},[y,s,e.id,e.name,o]);return(0,X.jsxs)(`div`,{className:r(`flex items-start gap-3 bg-background px-4 py-3`,a&&`border-b border-border`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x(e.mode,e.handling)}),e.enabled?null:(0,X.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Disabled`})]}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:A}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:c}),(0,X.jsx)(Q,{copyId:e.id,text:c,label:`Copy webhook url`})]}),(0,X.jsxs)(`div`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`secret ending `,(0,X.jsx)(`span`,{className:`font-mono`,children:e.secretHint}),` · `,v(e.lastDelivery)]})]}),(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(l,{variant:`secondary`,size:`sm`,pending:b,onClick:j,children:e.enabled?`Disable`:`Enable`}),(0,X.jsx)(L,{label:`Edit webhook`,side:`top`,children:(0,X.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit ${e.name}`,onClick:O,children:(0,X.jsx)(p,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(L,{label:`Rotate secret`,side:`top`,children:(0,X.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":`Rotate secret for ${e.name}`,pending:C,onClick:M,children:(0,X.jsx)(h,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(L,{label:`Delete webhook`,side:`top`,children:(0,X.jsx)(l,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,pending:w,onClick:N,children:(0,X.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})})]})]})}function $({copyId:e,title:t,text:n}){return(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:t}),(0,X.jsx)(Q,{copyId:e,text:n,label:`Copy ${t} command`})]}),(0,X.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-border bg-background p-3 font-mono text-xs text-foreground`,children:n})]})}function we({origin:e}){let t=S(e=>e.secretReveal),n=S(e=>e.dismissSecret),r=(0,q.useCallback)(e=>{e||n()},[n]);if(!t)return null;let i=T(e,t.hookId);return(0,X.jsx)(A,{open:!0,onOpenChange:r,children:(0,X.jsxs)(k,{size:`lg`,children:[(0,X.jsxs)(M,{className:`space-y-4`,children:[(0,X.jsxs)(N,{children:[`Secret for `,t.hookName]}),(0,X.jsx)(O,{children:`This is the only time the secret is shown. Copy it now. Rotating it later issues a new one.`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-background p-3`,children:[(0,X.jsx)(`code`,{className:`min-w-0 flex-1 break-all font-mono text-xs text-foreground`,children:t.secret}),(0,X.jsx)(Q,{copyId:`${t.hookId}-secret`,text:t.secret,label:`Copy secret`})]}),(0,X.jsx)($,{copyId:`${t.hookId}-bearer`,title:`Bearer token`,text:w(i,t.secret)}),(0,X.jsx)($,{copyId:`${t.hookId}-hmac`,title:`HMAC signature`,text:y(i,t.secret)})]}),(0,X.jsx)(j,{children:(0,X.jsx)(l,{size:`sm`,onClick:n,children:`I have copied it`})})]})})}function Te(e){let{hook:t,secret:n}=e;if(n!==null)return{hookId:t.id,hookName:t.name,secret:n};throw Error(`The server did not return a secret`)}function Ee(){let e=R(),t=S(e=>e.hooks),n=S(e=>e.openCreate),r=I(e=>e.sidebarData),i=(0,q.useMemo)(()=>H(r),[r]),a=C(),o=te.getOrigin(),s=(0,q.useCallback)(async t=>{let n=await V(e,{type:`webhooks.create`,input:t});S.getState().revealSecret(Te(n))},[e]);return(0,X.jsxs)(`div`,{className:ne,children:[(0,X.jsxs)(`div`,{className:`mx-auto w-full max-w-[900px] px-4 py-8`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`h1`,{className:`flex items-center gap-2.5 text-lg font-semibold text-foreground`,children:[(0,X.jsx)(re,{className:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),`Webhooks`,(0,X.jsx)(`span`,{className:`text-sm font-normal text-muted-foreground tabular-nums`,children:t.length})]}),(0,X.jsxs)(l,{size:`sm`,onClick:n,children:[(0,X.jsx)(m,{className:`mr-1 h-4 w-4`,"aria-hidden":`true`}),`New webhook`]})]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`An outside system POSTs to a webhook url with its secret. Kanna leaves a card in a chat, queues a prompt in a chat, or starts a new chat. Webhook urls are reachable wherever Kanna is reachable.`}),t.length===0?(0,X.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:`No webhooks yet. Create one to get a url.`}):(0,X.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-2xl border border-border`,children:t.map((e,n)=>(0,X.jsx)(Ce,{hook:e,targets:i,catalog:a,origin:o,divider:n<t.length-1},e.id))})]}),(0,X.jsx)(Z,{sidebarData:r,onCreate:s}),(0,X.jsx)(we,{origin:o})]})}export{Ee as WebhooksPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{l as n,u as r}from"./chunk-6KYCQHYJ-C0N1h4Su.js";import{t as i}from"./jsx-runtime-BB9-612F.js";import{t as a}from"./utils-gw0dpHSZ.js";import{_ as o,a as s,i as c,n as l,r as u,v as d}from"./ToolCallMessage-BUYUQ7gJ.js";import{t as f}from"./arrow-left-Bhl_I1HL.js";import{s as p}from"./contextWindow-DzdFsmAN.js";import{f as m}from"./pendingActionsStore-Bg8DPvPu.js";import{t as h}from"./refresh-cw-BnSFXoQI.js";import{t as g}from"./createScopedStore-BZ7oYp5V.js";import{r as _}from"./errors-gzkyHtvT.js";import{v}from"./state-mark-p6veyUZZ.js";import{a as y,i as b,o as x,r as S,s as C}from"./ChatPage-DXxHoPc9.js";import{t as w}from"./settings-header-button-AstqocLX.js";var T=e(t(),1),E=g(`WorkflowsPageView`,()=>e=>({selectedAgentId:null,setSelectedAgentId:t=>e({selectedAgentId:t})})),D=[],O=g(`WorkflowAgentTranscript`,()=>e=>({loadState:`loading`,messages:D,error:null,reloadNonce:0,setLoaded:t=>e({loadState:`loaded`,messages:t}),setError:t=>e({loadState:`error`,error:t}),refresh:()=>e(e=>({loadState:`loading`,error:null,reloadNonce:e.reloadNonce+1}))})),k=e(i(),1);function A({runId:e,agentId:t,agentLabel:n,promptPreview:r,agentIsRunning:i=!1,onClose:a,getTranscript:l}){let u=O.useScopedStore(e=>e.loadState),d=O.useScopedStore(e=>e.messages),p=O.useScopedStore(e=>e.error),g=O.useScopedStore(e=>e.reloadNonce),v=O.useScopedStore(e=>e.setLoaded),y=O.useScopedStore(e=>e.setError),b=O.useScopedStore(e=>e.refresh);(0,T.useEffect)(()=>{let n=!1;return l(e,t).then(e=>{n||v(o(e))}).catch(_(e=>{n||y(e.message)})),()=>{n=!0}},[e,t,l,g,v,y]);let x=(0,T.useCallback)(()=>{b()},[b]);return(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,"data-testid":`workflow-agent-transcript-panel`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border pb-2.5`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Back to run`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,k.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),(0,k.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:n}),(0,k.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`Transcript`}),i?(0,k.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide`,children:[(0,k.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-1.5 animate-pulse rounded-full bg-emerald-500 dark:bg-emerald-400`}),(0,k.jsx)(`span`,{className:`text-emerald-500 dark:text-emerald-400`,children:`Running`})]}):null,(0,k.jsx)(`button`,{type:`button`,onClick:x,"aria-label":`Refresh transcript`,className:`ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,k.jsx)(h,{className:u===`loading`?`size-3.5 animate-spin`:`size-3.5`,"aria-hidden":!0})})]}),i?(0,k.jsx)(`p`,{className:`rounded-md border border-amber-500/20 bg-amber-500/5 px-2.5 py-1.5 text-xs text-amber-600 dark:text-amber-400`,children:`This agent is still running — the transcript may be incomplete. Refresh to update.`}):null,r?(0,k.jsxs)(`div`,{className:`rounded-md border border-border/50 bg-muted/40 px-2.5 py-1.5`,children:[(0,k.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:`Prompt (preview)`}),(0,k.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-muted-foreground/90`,children:r})]}):null,(0,k.jsx)(c,{value:null,children:(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,children:[u===`loading`?(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,k.jsx)(m,{className:`size-3 animate-spin`,"aria-label":`Loading`}),`Loading transcript…`]}):null,u===`error`?(0,k.jsx)(`div`,{className:`text-xs text-destructive`,children:p}):null,u===`loaded`&&d.length===0?(0,k.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No transcript recorded yet.`}):null,d.map(e=>(0,k.jsx)(s,{message:e,localPath:``},e.id))]})})]})}function j(e){return(0,k.jsx)(O.Provider,{init:void 0,children:(0,k.jsx)(A,{...e})})}function M({runs:e,getRunDetail:t,getAgentTranscript:n,onBackToChat:r}){let i=E.useScopedStore(e=>e.selectedAgentId),o=E.useScopedStore(e=>e.setSelectedAgentId),{selection:s,selectedRunId:c,selectRun:l,clearSelection:u}=x(e,t,i),p=(0,T.useCallback)(e=>{o(null),l(e)},[l,o]),h=(0,T.useCallback)(()=>{u(),o(null)},[u,o]),g=s.kind===`loaded`?s.run:null,_=i!==null&&g?g.agents.find(e=>e.agentId===i):void 0,v=c!==null,C;return C=s.kind===`loading`?(0,k.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,k.jsx)(m,{className:`size-4 animate-spin`,"aria-label":`Loading`}),`Loading run…`]}):s.kind===`failed`?(0,k.jsx)(P,{text:`Couldn't load this run. Select it again to retry.`}):s.kind===`not-found`?(0,k.jsx)(P,{text:`Run not found or no longer available.`}):_&&g?(0,k.jsx)(j,{runId:g.runId,agentId:_.agentId,agentLabel:_.label,promptPreview:_.promptPreview,agentIsRunning:y(_.state),onClose:()=>o(null),getTranscript:n},i??``):g?(0,k.jsx)(S,{run:g,title:g.workflowName??g.runId,onSelectAgent:e=>o(e)}):(0,k.jsx)(P,{text:`Select a run to view its phases and agents.`}),(0,k.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-3 md:px-6`,children:[(0,k.jsx)(d,{className:`size-5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,k.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Workflows`}),e.length>0?(0,k.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tracking-wide text-muted-foreground tabular-nums`,style:{fontVariantNumeric:`tabular-nums`},children:[e.length,` `,e.length===1?`run`:`runs`]}):null,r?(0,k.jsx)(w,{"aria-label":`Back to chat`,className:`ml-auto`,icon:(0,k.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),onClick:r,children:`Back to chat`}):null]}),(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,k.jsx)(`div`,{className:a(`w-full shrink-0 overflow-auto p-3 md:w-80 md:border-r md:border-border`,v&&`hidden md:block`),children:(0,k.jsx)(b,{runs:e,selectedRunId:c,onSelectRun:p})}),(0,k.jsxs)(`div`,{className:a(`min-w-0 flex-1 overflow-auto px-4 py-4 md:px-6`,!v&&`hidden md:block`),children:[v?(0,k.jsxs)(`button`,{type:`button`,onClick:h,"aria-label":`Back to runs`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground md:hidden`,children:[(0,k.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),`All runs`]}):null,C]})]})]})}function N(e){return(0,k.jsx)(C.Provider,{init:void 0,children:(0,k.jsx)(E.Provider,{init:void 0,children:(0,k.jsx)(M,{...e})})})}function P({text:e}){return(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-lg border border-dashed border-border px-8 py-10 text-center`,children:[(0,k.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:(0,k.jsx)(d,{className:`size-5`,"aria-hidden":!0})}),(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})]})})}function F({chatId:e}){let t=r(),i=n(),a=u(p(l(e??``))),o=(0,T.useCallback)(async n=>e?t.socket.command({type:`workflows.getRun`,chatId:e,runId:n}):null,[e,t.socket]),s=(0,T.useCallback)(async(n,r)=>e?t.socket.command({type:`workflows.getAgentTranscript`,chatId:e,runId:n,agentId:r}):[],[e,t.socket]),c=(0,T.useCallback)(()=>{e&&i(v(e))},[e,i]);return e?(0,k.jsx)(N,{runs:a,getRunDetail:o,getAgentTranscript:s,onBackToChat:c}):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Open a chat to view its workflows.`})}export{F as WorkflowsPage};
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{l as n,u as r}from"./chunk-6KYCQHYJ-C0N1h4Su.js";import{t as i}from"./jsx-runtime-BB9-612F.js";import{t as a}from"./utils-gw0dpHSZ.js";import{_ as o,a as s,i as c,n as l,r as u,v as d}from"./ToolCallMessage-I5nT0rPg.js";import{t as f}from"./arrow-left-Bhl_I1HL.js";import{s as p}from"./contextWindow-D6tuokPX.js";import{f as m}from"./pendingActionsStore-BgvURrXK.js";import{t as h}from"./refresh-cw-BnSFXoQI.js";import{t as g}from"./createScopedStore-BZ7oYp5V.js";import{r as _}from"./errors-W4jQ4RJU.js";import{v}from"./state-mark-p6veyUZZ.js";import{a as y,i as b,o as x,r as S,s as C}from"./ChatPage-BHMfe4hl.js";import{t as w}from"./settings-header-button-GQg0n1x9.js";var T=e(t(),1),E=g(`WorkflowsPageView`,()=>e=>({selectedAgentId:null,setSelectedAgentId:t=>e({selectedAgentId:t})})),D=[],O=g(`WorkflowAgentTranscript`,()=>e=>({loadState:`loading`,messages:D,error:null,reloadNonce:0,setLoaded:t=>e({loadState:`loaded`,messages:t}),setError:t=>e({loadState:`error`,error:t}),refresh:()=>e(e=>({loadState:`loading`,error:null,reloadNonce:e.reloadNonce+1}))})),k=e(i(),1);function A({runId:e,agentId:t,agentLabel:n,promptPreview:r,agentIsRunning:i=!1,onClose:a,getTranscript:l}){let u=O.useScopedStore(e=>e.loadState),d=O.useScopedStore(e=>e.messages),p=O.useScopedStore(e=>e.error),g=O.useScopedStore(e=>e.reloadNonce),v=O.useScopedStore(e=>e.setLoaded),y=O.useScopedStore(e=>e.setError),b=O.useScopedStore(e=>e.refresh);(0,T.useEffect)(()=>{let n=!1;return l(e,t).then(e=>{n||v(o(e))}).catch(_(e=>{n||y(e.message)})),()=>{n=!0}},[e,t,l,g,v,y]);let x=(0,T.useCallback)(()=>{b()},[b]);return(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,"data-testid":`workflow-agent-transcript-panel`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border pb-2.5`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Back to run`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,k.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),(0,k.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:n}),(0,k.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground`,children:`Transcript`}),i?(0,k.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide`,children:[(0,k.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-1.5 animate-pulse rounded-full bg-emerald-500 dark:bg-emerald-400`}),(0,k.jsx)(`span`,{className:`text-emerald-500 dark:text-emerald-400`,children:`Running`})]}):null,(0,k.jsx)(`button`,{type:`button`,onClick:x,"aria-label":`Refresh transcript`,className:`ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,k.jsx)(h,{className:u===`loading`?`size-3.5 animate-spin`:`size-3.5`,"aria-hidden":!0})})]}),i?(0,k.jsx)(`p`,{className:`rounded-md border border-amber-500/20 bg-amber-500/5 px-2.5 py-1.5 text-xs text-amber-600 dark:text-amber-400`,children:`This agent is still running — the transcript may be incomplete. Refresh to update.`}):null,r?(0,k.jsxs)(`div`,{className:`rounded-md border border-border/50 bg-muted/40 px-2.5 py-1.5`,children:[(0,k.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:`Prompt (preview)`}),(0,k.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-muted-foreground/90`,children:r})]}):null,(0,k.jsx)(c,{value:null,children:(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,children:[u===`loading`?(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,k.jsx)(m,{className:`size-3 animate-spin`,"aria-label":`Loading`}),`Loading transcript…`]}):null,u===`error`?(0,k.jsx)(`div`,{className:`text-xs text-destructive`,children:p}):null,u===`loaded`&&d.length===0?(0,k.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No transcript recorded yet.`}):null,d.map(e=>(0,k.jsx)(s,{message:e,localPath:``},e.id))]})})]})}function j(e){return(0,k.jsx)(O.Provider,{init:void 0,children:(0,k.jsx)(A,{...e})})}function M({runs:e,getRunDetail:t,getAgentTranscript:n,onBackToChat:r}){let i=E.useScopedStore(e=>e.selectedAgentId),o=E.useScopedStore(e=>e.setSelectedAgentId),{selection:s,selectedRunId:c,selectRun:l,clearSelection:u}=x(e,t,i),p=(0,T.useCallback)(e=>{o(null),l(e)},[l,o]),h=(0,T.useCallback)(()=>{u(),o(null)},[u,o]),g=s.kind===`loaded`?s.run:null,_=i!==null&&g?g.agents.find(e=>e.agentId===i):void 0,v=c!==null,C;return C=s.kind===`loading`?(0,k.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,k.jsx)(m,{className:`size-4 animate-spin`,"aria-label":`Loading`}),`Loading run…`]}):s.kind===`failed`?(0,k.jsx)(P,{text:`Couldn't load this run. Select it again to retry.`}):s.kind===`not-found`?(0,k.jsx)(P,{text:`Run not found or no longer available.`}):_&&g?(0,k.jsx)(j,{runId:g.runId,agentId:_.agentId,agentLabel:_.label,promptPreview:_.promptPreview,agentIsRunning:y(_.state),onClose:()=>o(null),getTranscript:n},i??``):g?(0,k.jsx)(S,{run:g,title:g.workflowName??g.runId,onSelectAgent:e=>o(e)}):(0,k.jsx)(P,{text:`Select a run to view its phases and agents.`}),(0,k.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-3 md:px-6`,children:[(0,k.jsx)(d,{className:`size-5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,k.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Workflows`}),e.length>0?(0,k.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tracking-wide text-muted-foreground tabular-nums`,style:{fontVariantNumeric:`tabular-nums`},children:[e.length,` `,e.length===1?`run`:`runs`]}):null,r?(0,k.jsx)(w,{"aria-label":`Back to chat`,className:`ml-auto`,icon:(0,k.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),onClick:r,children:`Back to chat`}):null]}),(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,k.jsx)(`div`,{className:a(`w-full shrink-0 overflow-auto p-3 md:w-80 md:border-r md:border-border`,v&&`hidden md:block`),children:(0,k.jsx)(b,{runs:e,selectedRunId:c,onSelectRun:p})}),(0,k.jsxs)(`div`,{className:a(`min-w-0 flex-1 overflow-auto px-4 py-4 md:px-6`,!v&&`hidden md:block`),children:[v?(0,k.jsxs)(`button`,{type:`button`,onClick:h,"aria-label":`Back to runs`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground md:hidden`,children:[(0,k.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),`All runs`]}):null,C]})]})]})}function N(e){return(0,k.jsx)(C.Provider,{init:void 0,children:(0,k.jsx)(E.Provider,{init:void 0,children:(0,k.jsx)(M,{...e})})})}function P({text:e}){return(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-lg border border-dashed border-border px-8 py-10 text-center`,children:[(0,k.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:(0,k.jsx)(d,{className:`size-5`,"aria-hidden":!0})}),(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})]})})}function F({chatId:e}){let t=r(),i=n(),a=u(p(l(e??``))),o=(0,T.useCallback)(async n=>e?t.socket.command({type:`workflows.getRun`,chatId:e,runId:n}):null,[e,t.socket]),s=(0,T.useCallback)(async(n,r)=>e?t.socket.command({type:`workflows.getAgentTranscript`,chatId:e,runId:n,agentId:r}):[],[e,t.socket]),c=(0,T.useCallback)(()=>{e&&i(v(e))},[e,i]);return e?(0,k.jsx)(N,{runs:a,getRunDetail:o,getAgentTranscript:s,onBackToChat:c}):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Open a chat to view its workflows.`})}export{F as WorkflowsPage};