denchclaw 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/web/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/apps/web/.next/standalone/apps/web/.next/app-build-manifest.json +143 -143
- package/apps/web/.next/standalone/apps/web/.next/app-path-routes-manifest.json +39 -39
- package/apps/web/.next/standalone/apps/web/.next/build-manifest.json +2 -2
- package/apps/web/.next/standalone/apps/web/.next/cache/config.json +3 -3
- package/apps/web/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/apps/web/.next/standalone/apps/web/.next/required-server-files.json +1 -1
- package/apps/web/.next/standalone/apps/web/.next/routes-manifest.json +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/cron/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/proxy/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/serve/[...path]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/store/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/webhooks/[...path]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/active/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/runs/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stream/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/subagents/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/callback/route.js +8 -8
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/callback/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/connect/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/connect/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/connections/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/disconnect/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/status/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/toolkits/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/calendar/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/calendar/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/companies/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/enrich/[type]/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/inbox/[threadId]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/inbox/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/[id]/activity/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/photos/proxy/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/photos/sync/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/[jobId]/runs/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/[sessionId]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/search-transcript/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/feedback/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/feedback/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/channels/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/chat/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/chat/stream/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/sessions/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/sessions/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/[id]/toggle/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/repair/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/memories/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/connections/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/connections/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/dench-cloud/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/dench-cloud/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/identity/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/identity/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/state/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/state/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/progress/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/start/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/start/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/switch/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/[sessionId]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/cloud/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/cloud/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/[slug]/content/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/[slug]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/browse/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/poll-tick/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/refresh/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/status/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/terminal/port/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/speech/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/transcribe/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/voices/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/messages/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/assets/[...path]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse-file/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/context/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/copy/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/introspect/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/query/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/execute/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/link-preview/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/list/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/mkdir/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/move/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/actions/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/actions/runs/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/display-field/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/content/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/bulk-delete/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/options/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/enum-rename/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/reorder/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/icon/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/views/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/open-file/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/path-info/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/query/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/raw-file/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/rename/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/search-index/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/suggest-files/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/thumbnail/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/tree/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/virtual-file/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/watch/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/write-binary/route_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/page.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/app-paths-manifest.json +39 -39
- package/apps/web/.next/standalone/apps/web/.next/server/chunks/27488.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/chunks/63780.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/chunks/6787.js +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/functions-config-manifest.json +22 -22
- package/apps/web/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/apps/web/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/{layout-8beeb8ad12058c3c.js → layout-660f18c3bb2cdcb3.js} +1 -1
- package/apps/web/.next/{static/chunks/app/page-d71d1a3421cb80e9.js → standalone/apps/web/.next/static/chunks/app/page-348b80df5b4c7586.js} +1 -1
- package/apps/web/.next/standalone/apps/web/server.js +1 -1
- package/apps/web/.next/standalone/extensions/dench-ai-gateway/models.ts +25 -39
- package/apps/web/.next/standalone/extensions/posthog-analytics/lib/build-env.js +1 -1
- package/apps/web/.next/standalone/package.json +1 -1
- package/apps/web/.next/static/chunks/app/{layout-8beeb8ad12058c3c.js → layout-660f18c3bb2cdcb3.js} +1 -1
- package/apps/web/.next/{standalone/apps/web/.next/static/chunks/app/page-d71d1a3421cb80e9.js → static/chunks/app/page-348b80df5b4c7586.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/{program-D39-8KbQ.js → program-DJ--v24B.js} +26 -39
- package/dist/{run-main-Ca4XgjVM.js → run-main-Bx_uvxUj.js} +1 -1
- package/extensions/dench-ai-gateway/models.ts +25 -39
- package/extensions/posthog-analytics/lib/build-env.js +1 -1
- package/package.json +1 -1
- /package/apps/web/.next/standalone/apps/web/.next/static/{TgoqmuhRel_KXOJpjC2fj → sKX9nLBRkTqA5tC4fKclW}/_buildManifest.js +0 -0
- /package/apps/web/.next/standalone/apps/web/.next/static/{TgoqmuhRel_KXOJpjC2fj → sKX9nLBRkTqA5tC4fKclW}/_ssgManifest.js +0 -0
- /package/apps/web/.next/static/{TgoqmuhRel_KXOJpjC2fj → sKX9nLBRkTqA5tC4fKclW}/_buildManifest.js +0 -0
- /package/apps/web/.next/static/{TgoqmuhRel_KXOJpjC2fj → sKX9nLBRkTqA5tC4fKclW}/_ssgManifest.js +0 -0
|
@@ -261,7 +261,7 @@ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__
|
|
|
261
261
|
${p}px !important;
|
|
262
262
|
${q}px !important;
|
|
263
263
|
}
|
|
264
|
-
`),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,d.jsx)(m,{isPresent:b,childRef:j,sizeRef:n,pop:h,children:!1===h?a:e.cloneElement(a,{ref:p})})}let o=({children:a,initial:b,isPresent:c,onExitComplete:f,custom:h,presenceAffectsLayout:j,mode:k,anchorX:l,anchorY:m,root:o})=>{let q=(0,g.M)(p),r=(0,e.useId)(),s=!0,t=(0,e.useMemo)(()=>(s=!1,{id:r,initial:b,isPresent:c,custom:h,onExitComplete:a=>{for(let b of(q.set(a,!0),q.values()))if(!b)return;f&&f()},register:a=>(q.set(a,!1),()=>q.delete(a))}),[c,q,f]);return j&&s&&(t={...t}),(0,e.useMemo)(()=>{q.forEach((a,b)=>q.set(b,!1))},[c]),e.useEffect(()=>{c||q.size||!f||f()},[c]),a=(0,d.jsx)(n,{pop:"popLayout"===k,isPresent:c,anchorX:l,anchorY:m,root:o,children:a}),(0,d.jsx)(i.t.Provider,{value:t,children:a})};function p(){return new Map}var q=c(15086);let r=a=>a.key||"";function s(a){let b=[];return e.Children.forEach(a,a=>{(0,e.isValidElement)(a)&&b.push(a)}),b}let t=({children:a,custom:b,initial:c=!0,onExitComplete:i,presenceAffectsLayout:j=!0,mode:k="sync",propagate:l=!1,anchorX:m="left",anchorY:n="top",root:p})=>{let[t,u]=(0,q.xQ)(l),v=(0,e.useMemo)(()=>s(a),[a]),w=l&&!t?[]:v.map(r),x=(0,e.useRef)(!0),y=(0,e.useRef)(v),z=(0,g.M)(()=>new Map),A=(0,e.useRef)(new Set),[B,C]=(0,e.useState)(v),[D,E]=(0,e.useState)(v);(0,h.E)(()=>{x.current=!1,y.current=v;for(let a=0;a<D.length;a++){let b=r(D[a]);w.includes(b)?(z.delete(b),A.current.delete(b)):!0!==z.get(b)&&z.set(b,!1)}},[D,w.length,w.join("-")]);let F=[];if(v!==B){let a=[...v];for(let b=0;b<D.length;b++){let c=D[b],d=r(c);w.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===k&&F.length&&(a=F),E(s(a)),C(v),null}let{forceRender:G}=(0,e.useContext)(f.L);return(0,d.jsx)(d.Fragment,{children:D.map(a=>{let e=r(a),f=(!l||!!t)&&(v===D||w.includes(e));return(0,d.jsx)(o,{isPresent:f,initial:(!x.current||!!c)&&void 0,custom:b,presenceAffectsLayout:j,mode:k,root:p,onExitComplete:f?void 0:()=>{if(A.current.has(e)||(A.current.add(e),!z.has(e)))return;z.set(e,!0);let a=!0;z.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(y.current),l&&u?.(),i&&i())},anchorX:m,anchorY:n,children:a},e)})})}},656159:(a,b)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b.isDeepKey=function(a){switch(typeof a){case"number":case"symbol":return!1;case"string":return a.includes(".")||a.includes("[")||a.includes("]")}}},658422:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(452171),e=c(266196),f=c(606461);b.cloneDeepWith=function(a,b){return d.cloneDeepWith(a,(c,g,h,i)=>{let j=b?.(c,g,h,i);if(void 0!==j)return j;if("object"==typeof a){if(e.getTag(a)===f.objectTag&&"function"!=typeof a.constructor){let b={};return i.set(a,b),d.copyProperties(b,a,h,i),b}switch(Object.prototype.toString.call(a)){case f.numberTag:case f.stringTag:case f.booleanTag:{let b=new a.constructor(a?.valueOf());return d.copyProperties(b,a),b}case f.argumentsTag:{let b={};return d.copyProperties(b,a),b.length=a.length,b[Symbol.iterator]=a[Symbol.iterator],b}default:return}}})}},658556:(a,b,c)=>{"use strict";function d(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}c.d(b,{A:()=>aI});var e=c(972421),f=c(145214),g=c(423721),h=c(348445);let i="phrasing",j=["autolink","link","image","label"];function k(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function l(a){this.config.enter.autolinkProtocol.call(this,a)}function m(a){this.config.exit.autolinkProtocol.call(this,a)}function n(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];(0,e.ok)("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function o(a){this.config.exit.autolinkEmail.call(this,a)}function p(a){this.exit(a)}function q(a){!function(a,b,c){let d=(0,h.C)((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)(0,g.VG)(a,"text",i);function i(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,r],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,s]],{ignore:["link","linkReference"]})}function r(a,b,c,e,f){let g="";if(!t(f)||(/^w/i.test(b)&&(c=b+c,b="",g="http://"),!function(a){let b=a.split(".");return!(b.length<2||b[b.length-1]&&(/_/.test(b[b.length-1])||!/[a-zA-Z\d]/.test(b[b.length-1]))||b[b.length-2]&&(/_/.test(b[b.length-2])||!/[a-zA-Z\d]/.test(b[b.length-2])))}(c)))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],e=c.indexOf(")"),f=d(a,"("),g=d(a,")");for(;-1!==e&&f>g;)a+=c.slice(0,e+1),e=(c=c.slice(e+1)).indexOf(")"),g++;return[a,c]}(c+e);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function s(a,b,c,d){return!(!t(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function t(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||(0,f.Ny)(c)||(0,f.es)(c))&&(!b||47!==c)}var u=c(732347);function v(){this.buffer()}function w(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function x(){this.buffer()}function y(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function z(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteReference"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function A(a){this.exit(a)}function B(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteDefinition"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function C(a){this.exit(a)}function D(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function E(a,b,c){return 0===b?a:F(a,b,c)}function F(a,b,c){return(c?"":" ")+a}D.peek=function(){return"["};let G=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function H(a){this.enter({type:"delete",children:[]},a)}function I(a){this.exit(a)}function J(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function K(a){return a.length}function L(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}J.peek=function(){return"~"};var M=c(294401);c(320608);c(210164);function N(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}N.peek=function(){return"`"};(0,h.C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let O={inlineCode:N,listItem:function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j}};function P(a){let b=a._align;(0,e.ok)(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Q(a){this.exit(a),this.data.inTable=void 0}function R(a){this.enter({type:"tableRow",children:[]},a)}function S(a){this.exit(a)}function T(a){this.enter({type:"tableCell",children:[]},a)}function U(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,V));let c=this.stack[this.stack.length-1];(0,e.ok)("inlineCode"===c.type),c.value=b,this.exit(a)}function V(a,b){return"|"===b?b:a}function W(a){let b=this.stack[this.stack.length-2];(0,e.ok)("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function X(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];(0,e.ok)("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function Y(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=O.listItem(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}var Z=c(161693);let _={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},aa={tokenize:function(a,b,c){let d,e,g;return h;function h(b){return 46===b||95===b?a.check(ac,j,i)(b):null===b||(0,f.Ee)(b)||(0,f.Ny)(b)||45!==b&&(0,f.es)(b)?j(b):(g=!0,a.consume(b),h)}function i(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),h}function j(a){return e||d||!g?c(a):b(a)}},partial:!0},ab={tokenize:function(a,b){let c=0,d=0;return e;function e(h){return 40===h?(c++,a.consume(h),e):41===h&&d<c?g(h):33===h||34===h||38===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||60===h||63===h||93===h||95===h||126===h?a.check(ac,b,g)(h):null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):(a.consume(h),e)}function g(b){return 41===b&&d++,a.consume(b),e}},partial:!0},ac={tokenize:function(a,b,c){return d;function d(h){return 33===h||34===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||63===h||95===h||126===h?(a.consume(h),d):38===h?(a.consume(h),g):93===h?(a.consume(h),e):60===h||null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):c(h)}function e(a){return null===a||40===a||91===a||(0,f.Ee)(a)||(0,f.Ny)(a)?b(a):d(a)}function g(b){return(0,f.CW)(b)?function b(e){return 59===e?(a.consume(e),d):(0,f.CW)(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},ad={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return(0,f.lV)(a)?c(a):b(a)}},partial:!0},ae={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!aj.call(d,d.previous)||an(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(_,a.attempt(aa,a.attempt(ab,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:aj},af={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",g=!1;return function(b){return(72===b||104===b)&&ak.call(d,d.previous)&&!an(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),h):c(b)};function h(b){if((0,f.CW)(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),h;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),i}return c(b)}function i(b){return 47===b?(a.consume(b),g)?j:(g=!0,i):c(b)}function j(b){return null===b||(0,f.JQ)(b)||(0,f.Ee)(b)||(0,f.Ny)(b)||(0,f.es)(b)?c(b):a.attempt(aa,a.attempt(ab,k),c)(b)}function k(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:ak},ag={name:"emailAutolink",tokenize:function(a,b,c){let d,e,g=this;return function(b){return!am(b)||!al.call(g,g.previous)||an(g.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return am(d)?(a.consume(d),b):64===d?(a.consume(d),h):c(d)}(b))};function h(b){return 46===b?a.check(ad,j,i)(b):45===b||95===b||(0,f.lV)(b)?(e=!0,a.consume(b),h):j(b)}function i(b){return a.consume(b),d=!0,h}function j(h){return e&&d&&(0,f.CW)(g.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(h)):c(h)}},previous:al},ah={},ai=48;for(;ai<123;)ah[ai]=ag,58==++ai?ai=65:91===ai&&(ai=97);function aj(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||(0,f.Ee)(a)}function ak(a){return!(0,f.CW)(a)}function al(a){return!(47===a||am(a))}function am(a){return 43===a||45===a||46===a||95===a||(0,f.lV)(a)}function an(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}ah[43]=ag,ah[45]=ag,ah[46]=ag,ah[95]=ag,ah[72]=[ag,af],ah[104]=[ag,af],ah[87]=[ag,ae],ah[119]=[ag,ae];var ao=c(360478),ap=c(621405);let aq={tokenize:function(a,b,c){let d=this;return(0,ap.N)(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ar(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=(0,u.B)(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function as(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function at(a,b,c){let d,e=this,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),i};function i(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",j)}function j(i){if(h>999||93===i&&!d||null===i||91===i||(0,f.Ee)(i))return c(i);if(93===i){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return g.includes((0,u.B)(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(i),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(i)}return(0,f.Ee)(i)||(d=!0),h++,a.consume(i),92===i?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}}function au(a,b,c){let d,e,g=this,h=g.parser.gfmFootnotes||(g.parser.gfmFootnotes=[]),i=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),j};function j(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",k):c(b)}function k(b){if(i>999||93===b&&!e||null===b||91===b||(0,f.Ee)(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=(0,u.B)(g.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),m}return(0,f.Ee)(b)||(e=!0),i++,a.consume(b),92===b?l:k}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}function m(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),h.includes(d)||h.push(d),(0,ap.N)(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function av(a,b,c){return a.check(ao.B,b,a.attempt(aq,b,c))}function aw(a){a.exit("gfmFootnoteDefinition")}var ax=c(962349),ay=c(598525);class az{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function aA(a,b,c){let d,e=this,g=0,h=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:i;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function i(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,h+=1),j(c)}function j(b){return null===b?c(b):(0,f.HP)(b)?h>1?(h=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),m):c(b):(0,f.On)(b)?(0,ap.N)(a,j,"whitespace")(b):(h+=1,d&&(d=!1,g+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,j):(a.enter("data"),k(b))}function k(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),j(b)):(a.consume(b),92===b?l:k)}function l(b){return 92===b||124===b?(a.consume(b),k):k(b)}function m(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,(0,f.On)(b))?(0,ap.N)(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return(0,f.On)(b)?(0,ap.N)(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(h+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(h+=1,q(b)):null===b||(0,f.HP)(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return(0,f.On)(b)?(0,ap.N)(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||(0,f.HP)(e))return d&&g===h?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||(0,f.HP)(c)?(a.exit("tableRow"),b(c)):(0,f.On)(c)?(0,ap.N)(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function aB(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,m=new az;for(;++f<a.length;){let n=a[f],o=n[1];"enter"===n[0]?"tableHead"===o.type?(k=!1,0!==l&&(aD(m,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",c,b]])):"tableRow"===o.type||"tableDelimiterRow"===o.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===o.type?2:d?3:1):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===o.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===o.type?(k=!0,l=f):"tableRow"===o.type||"tableDelimiterRow"===o.type?(l=f,0!==i[1]?(j[0]=j[1],e=aC(m,b,i,h,f,e)):0!==j[1]&&(e=aC(m,b,j,h,f,e)),h=0):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)&&(j[3]=f)}for(0!==l&&aD(m,b,l,c,d),m.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function aC(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},aE(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=aE(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=aE(b.events,c[2]),f=aE(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},aE(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function aD(a,b,c,d,e){let f=[],g=aE(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function aE(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}let aF={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return(0,f.Ee)(b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),g):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),g):c(b)}function g(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),h):c(b)}function h(d){return(0,f.HP)(d)?b(d):(0,f.On)(d)?a.check({tokenize:aG},b,c)(d):c(d)}}};function aG(a,b,c){return(0,ap.N)(a,function(a){return null===a?c(a):b(a)},"whitespace")}let aH={};function aI(a){let b,c=a||aH,d=this.data(),e=d.micromarkExtensions||(d.micromarkExtensions=[]),f=d.fromMarkdownExtensions||(d.fromMarkdownExtensions=[]),g=d.toMarkdownExtensions||(d.toMarkdownExtensions=[]);e.push((0,Z.y)([{text:ah},{document:{91:{name:"gfmFootnoteDefinition",tokenize:au,continuation:{tokenize:av},exit:aw}},text:{91:{name:"gfmFootnoteCall",tokenize:at},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ar,resolveTo:as}}},function(a){let b=(a||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=(0,M.S)(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=(0,M.S)(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&(0,ax.m)(g,g.length,0,(0,ay.W)(h,a.slice(d+1,c),b)),(0,ax.m)(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),(0,ax.m)(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}};return null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}}(c),{flow:{null:{name:"table",tokenize:aA,resolveAll:aB}}},{text:{91:aF}}])),f.push([{transforms:[q],enter:{literalAutolink:k,literalAutolinkEmail:l,literalAutolinkHttp:l,literalAutolinkWww:l},exit:{literalAutolink:p,literalAutolinkEmail:o,literalAutolinkHttp:m,literalAutolinkWww:n}},{enter:{gfmFootnoteCallString:v,gfmFootnoteCall:w,gfmFootnoteDefinitionLabelString:x,gfmFootnoteDefinition:y},exit:{gfmFootnoteCallString:z,gfmFootnoteCall:A,gfmFootnoteDefinitionLabelString:B,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:H},exit:{strikethrough:I}},{enter:{table:P,tableData:T,tableHeader:T,tableRow:R},exit:{codeText:U,table:Q,tableData:S,tableHeader:S,tableRow:S}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:X}}]),g.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:":",before:"[ps]",after:"\\/",inConstruct:i,notInConstruct:j}]},(b=!1,c&&c.firstLineBlank&&(b=!0),{handlers:{footnoteDefinition:function(a,c,d,e){let f=d.createTracker(e),g=f.move("[^"),h=d.enter("footnoteDefinition"),i=d.enter("label");return g+=f.move(d.safe(d.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((b?"\n":" ")+d.indentLines(d.containerFlow(a,f.current()),b?F:E))),h(),g},footnoteReference:D},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G}],handlers:{delete:J}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=O.inlineCode(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||K,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let m=-1;if("object"==typeof d&&"length"in d)for(;++m<j;)f[m]=L(d[m]);else{let a=L(d);for(;++m<j;)f[m]=a}m=-1;let n=[],o=[];for(;++m<j;){let a=f[m],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[m]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[m]&&(i[m]=e),o[m]=e),n[m]=g}g.splice(1,0,n),h.splice(1,0,o),k=-1;let p=[];for(;++k<g.length;){let a=g[k],b=h[k];m=-1;let d=[];for(;++m<j;){let e=a[m]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[m]-(b[m]||0),c=f[m];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||m||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||m)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||m!==j-1)&&d.push("|")}p.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return p.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(c),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y}}]})}},663033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},665466:(a,b,c)=>{"use strict";c.d(b,{E:()=>i,I:()=>j});var d=c(736927),e=c(115962),f=c(437503),g=c(930439),h=c(535798);function i({event:a,expanded:b,onToggle:c,onOpenPerson:e,onOpenCompany:g}){let i=a.start_at?new Date(a.start_at):null,k=a.end_at?new Date(a.end_at):null,l=i?k?`${o(i)} – ${o(k)}`:o(i):"",m=(a.attendees??[]).slice(0,5),p=(a.attendees?.length??0)-m.length;return(0,d.jsxs)("li",{className:"overflow-hidden",style:{background:b?"var(--color-surface-hover)":"transparent",transition:"background 120ms ease"},children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,"aria-expanded":b,onClick:c,onKeyDown:a=>{a.target===a.currentTarget&&("Enter"===a.key||" "===a.key)&&(a.preventDefault(),c())},className:"group/event w-full flex items-center gap-3 px-3 py-2 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] transition-colors",onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("div",{className:"text-[12px] tabular-nums shrink-0 whitespace-nowrap",style:{color:"var(--color-text-muted)",width:"11rem"},children:l||(a.start_at?(0,h.wI)(a.start_at):"")}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[13.5px]",style:{color:"var(--color-text)",fontWeight:500},children:a.title?.trim()||"(no title)"}),a.meeting_type&&(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0 text-[10px] uppercase tracking-[0.06em]",style:{background:"var(--color-surface-hover)",color:"var(--color-text-muted)",fontWeight:600},children:a.meeting_type})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[m.length>0&&(0,d.jsxs)("div",{className:"flex items-center -space-x-1.5",children:[m.slice(0,4).map(a=>(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),e?.(a.id)},disabled:!e,title:a.name??a.email??void 0,className:"disabled:cursor-default rounded-full",style:{boxShadow:"0 0 0 2px var(--color-background)"},children:(0,d.jsx)(f.X,{src:a.avatar_url,name:a.name,seed:a.email??a.id,size:"sm"})},a.id)),p>0&&(0,d.jsxs)("span",{className:"ml-1 text-[11px] tabular-nums",style:{color:"var(--color-text-muted)"},children:["+",p]})]}),(0,d.jsx)(n,{expanded:b})]})]}),(0,d.jsx)("div",{className:"grid transition-[grid-template-rows] duration-[220ms] ease-out motion-reduce:transition-none",style:{gridTemplateRows:b?"1fr":"0fr"},children:(0,d.jsx)("div",{className:"overflow-hidden",children:b&&(0,d.jsx)(j,{eventId:a.id,fallbackEvent:a,onOpenPerson:e,onOpenCompany:g})})})]})}function j({eventId:a,fallbackEvent:b,onOpenPerson:c,onOpenCompany:f}){var g;let[h,i]=(0,e.useState)(null),[j,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(null),r=h?.event.start_at??b.start_at?new Date(h?.event.start_at??b.start_at):null,s=h?.event.end_at??b.end_at?new Date(h?.event.end_at??b.end_at):null,t=r?(g=r,new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(g)):null,u=r?s?`${o(r)} – ${o(s)}`:o(r):null,v=r&&s?function(a,b){let c=b.getTime()-a.getTime();if(c<=0)return"";let d=Math.round(c/6e4);if(d>=1440){let a=Math.round(d/1440);return`${a} day${1===a?"":"s"}`}let e=Math.floor(d/60),f=d%60;return 0===e?`${f} min`:0===f?`${e}h`:`${e}h ${f}m`}(r,s):null,w=h?.organizer??null,x=h?.attendees??b.attendees??[],y=h?.companies??[];return(0,d.jsxs)("div",{className:"border-t px-4 py-4",style:{borderColor:"var(--color-border)",background:"var(--color-background)"},children:[(t||u||v)&&(0,d.jsx)(k,{label:"When",children:(0,d.jsxs)("div",{className:"text-[13px]",style:{color:"var(--color-text)"},children:[t&&(0,d.jsx)("div",{className:"font-medium",children:t}),(u||v)&&(0,d.jsxs)("div",{className:"mt-0.5",style:{color:"var(--color-text-muted)"},children:[u,u&&v&&" \xb7 ",v]})]})}),w&&(0,d.jsx)(k,{label:"Organizer",children:(0,d.jsx)(l,{person:w,onOpenPerson:c})}),x.length>0&&(0,d.jsx)(k,{label:`Attendees \xb7 ${x.length}`,children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:x.map(a=>(0,d.jsx)(l,{person:a,onOpenPerson:c},a.id))})}),y.length>0&&(0,d.jsx)(k,{label:1===y.length?"Company":"Companies",children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:y.map(a=>(0,d.jsx)(m,{company:a,onOpenCompany:f},a.id))})}),j&&!h&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"Loading meeting details…"}),p&&(0,d.jsxs)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:["Couldn’t load meeting details (",p,"). Showing what we have."]}),!j&&!p&&h&&0===x.length&&!w&&0===y.length&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"No additional details for this meeting."})]})}function k({label:a,children:b}){return(0,d.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,d.jsx)("h4",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-[0.16em]",style:{color:"var(--color-text-muted)"},children:a}),b]})}function l({person:a,onOpenPerson:b}){let c=a.name?.trim()||a.email||"Unknown",e=a.name?.trim()&&a.email?a.email:null;return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",style:{color:"var(--color-text)"},onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(f.X,{src:a.avatar_url,name:c,seed:a.email??a.id,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:e})]})]})}function m({company:a,onOpenCompany:b}){let c=a.name?.trim()||a.domain||"Unknown company";return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(g.g,{domain:a.domain,name:a.name,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),a.domain&&a.name&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:a.domain})]})]})}function n({expanded:a}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"motion-reduce:transition-none",style:{color:"var(--color-text-muted)",transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})}function o(a){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}},669661:(a,b,c)=>{"use strict";c.d(b,{Lz:()=>bR,NZ:()=>br,zF:()=>bu});var d=c(381802),e=c(331480),f=c(731626);let g=function(a){for(var b=0;;b++)if(!(a=a.previousSibling))return b},h=function(a){let b=a.assignedSlot||a.parentNode;return b&&11==b.nodeType?b.host:b},i=null,j=function(a,b,c){let d=i||(i=document.createRange());return d.setEnd(a,null==c?a.nodeValue.length:c),d.setStart(a,b||0),d},k=function(){i=null},l=function(a,b,c,d){return c&&(n(a,b,c,d,-1)||n(a,b,c,d,1))},m=/^(img|br|input|textarea|hr)$/i;function n(a,b,c,d,e){for(var f;;){if(a==c&&b==d)return!0;if(b==(e<0?0:o(a))){let c=a.parentNode;if(!c||1!=c.nodeType||p(a)||m.test(a.nodeName)||"false"==a.contentEditable)return!1;b=g(a)+(e<0?0:1),a=c}else{if(1!=a.nodeType)return!1;let c=a.childNodes[b+(e<0?-1:0)];if(1==c.nodeType&&"false"==c.contentEditable)if(null==(f=c.pmViewDesc)||!f.ignoreForSelection)return!1;else b+=e;else a=c,b=e<0?o(a):0}}}function o(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function p(a){let b;for(let c=a;c&&!(b=c.pmViewDesc);c=c.parentNode);return b&&b.node&&b.node.isBlock&&(b.dom==a||b.contentDOM==a)}let q=function(a){return a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset)};function r(a,b){let c=document.createEvent("Event");return c.initEvent("keydown",!0,!0),c.keyCode=a,c.key=c.code=b,c}let s="undefined"!=typeof navigator?navigator:null,t="undefined"!=typeof document?document:null,u=s&&s.userAgent||"",v=/Edge\/(\d+)/.exec(u),w=/MSIE \d/.exec(u),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),y=!!(w||x||v),z=w?document.documentMode:x?+x[1]:v?+v[1]:0,A=!y&&/gecko\/(\d+)/i.test(u);A&&(/Firefox\/(\d+)/.exec(u)||[0,0])[1];let B=!y&&/Chrome\/(\d+)/.exec(u),C=!!B,D=B?+B[1]:0,E=!y&&!!s&&/Apple Computer/.test(s.vendor),F=E&&(/Mobile\/\w+/.test(u)||!!s&&s.maxTouchPoints>2),G=F||!!s&&/Mac/.test(s.platform),H=!!s&&/Win/.test(s.platform),I=/Android \d/.test(u),J=!!t&&"webkitFontSmoothing"in t.documentElement.style,K=J?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L(a,b){return"number"==typeof a?a:a[b]}function M(a,b,c){let d=a.someProp("scrollThreshold")||0,e=a.someProp("scrollMargin")||5,f=a.dom.ownerDocument;for(let g=c||a.dom;g;){if(1!=g.nodeType){g=h(g);continue}let a=g,c=a==f.body,i=c?function(a){let b=a.defaultView&&a.defaultView.visualViewport;return b?{left:0,right:b.width,top:0,bottom:b.height}:{left:0,right:a.documentElement.clientWidth,top:0,bottom:a.documentElement.clientHeight}}(f):function(a){let b=a.getBoundingClientRect(),c=b.width/a.offsetWidth||1,d=b.height/a.offsetHeight||1;return{left:b.left,right:b.left+a.clientWidth*c,top:b.top,bottom:b.top+a.clientHeight*d}}(a),j=0,k=0;if(b.top<i.top+L(d,"top")?k=-(i.top-b.top+L(e,"top")):b.bottom>i.bottom-L(d,"bottom")&&(k=b.bottom-b.top>i.bottom-i.top?b.top+L(e,"top")-i.top:b.bottom-i.bottom+L(e,"bottom")),b.left<i.left+L(d,"left")?j=-(i.left-b.left+L(e,"left")):b.right>i.right-L(d,"right")&&(j=b.right-i.right+L(e,"right")),j||k)if(c)f.defaultView.scrollBy(j,k);else{let c=a.scrollLeft,d=a.scrollTop;k&&(a.scrollTop+=k),j&&(a.scrollLeft+=j);let e=a.scrollLeft-c,f=a.scrollTop-d;b={left:b.left-e,top:b.top-f,right:b.right-e,bottom:b.bottom-f}}let l=c?"fixed":getComputedStyle(g).position;if(/^(fixed|sticky)$/.test(l))break;g="absolute"==l?g.offsetParent:h(g)}}function N(a){let b=[],c=a.ownerDocument;for(let d=a;d&&(b.push({dom:d,top:d.scrollTop,left:d.scrollLeft}),a!=c);d=h(d));return b}function O(a,b){for(let c=0;c<a.length;c++){let{dom:d,top:e,left:f}=a[c];d.scrollTop!=e+b&&(d.scrollTop=e+b),d.scrollLeft!=f&&(d.scrollLeft=f)}}let P=null;function Q(a,b){return a.left>=b.left-1&&a.left<=b.right+1&&a.top>=b.top-1&&a.top<=b.bottom+1}function R(a){return a.top<a.bottom||a.left<a.right}function S(a,b){let c=a.getClientRects();if(c.length){let a=c[b<0?0:c.length-1];if(R(a))return a}return Array.prototype.find.call(c,R)||a.getBoundingClientRect()}let T=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function U(a,b,c){let{node:d,offset:e,atom:f}=a.docView.domFromPos(b,c<0?-1:1),g=J||A;if(3==d.nodeType)if(g&&(T.test(d.nodeValue)||(c<0?!e:e==d.nodeValue.length))){let a=S(j(d,e,e),c);if(A&&e&&/\s/.test(d.nodeValue[e-1])&&e<d.nodeValue.length){let b=S(j(d,e-1,e-1),-1);if(b.top==a.top){let c=S(j(d,e,e+1),-1);if(c.top!=a.top)return V(c,c.left<b.left)}}return a}else{let a=e,b=e,f=c<0?1:-1;return c<0&&!e?(b++,f=-1):c>=0&&e==d.nodeValue.length?(a--,f=1):c<0?a--:b++,V(S(j(d,a,b),f),f<0)}if(!a.state.doc.resolve(b-(f||0)).parent.inlineContent){if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1];if(1==a.nodeType)return W(a.getBoundingClientRect(),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];if(1==a.nodeType)return W(a.getBoundingClientRect(),!0)}return W(d.getBoundingClientRect(),c>=0)}if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1],b=3==a.nodeType?j(a,o(a)-!g):1!=a.nodeType||"BR"==a.nodeName&&a.nextSibling?null:a;if(b)return V(S(b,1),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let b=a?3==a.nodeType?j(a,0,+!g):1==a.nodeType?a:null:null;if(b)return V(S(b,-1),!0)}return V(S(3==d.nodeType?j(d):d,-c),c>=0)}function V(a,b){if(0==a.width)return a;let c=b?a.left:a.right;return{top:a.top,bottom:a.bottom,left:c,right:c}}function W(a,b){if(0==a.height)return a;let c=b?a.top:a.bottom;return{top:c,bottom:c,left:a.left,right:a.right}}function X(a,b,c){let d=a.state,e=a.root.activeElement;d!=b&&a.updateState(b),e!=a.dom&&a.focus();try{return c()}finally{d!=b&&a.updateState(d),e!=a.dom&&e&&e.focus()}}let Y=/[\u0590-\u08ac]/,Z=null,_=null,aa=!1;class ab{constructor(a,b,c,d){this.parent=a,this.children=b,this.dom=c,this.contentDOM=d,this.dirty=0,c.pmViewDesc=this}matchesWidget(a){return!1}matchesMark(a){return!1}matchesNode(a,b,c){return!1}matchesHack(a){return!1}parseRule(){return null}stopEvent(a){return!1}get size(){let a=0;for(let b=0;b<this.children.length;b++)a+=this.children[b].size;return a}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let a=0;a<this.children.length;a++)this.children[a].destroy()}posBeforeChild(a){for(let b=0,c=this.posAtStart;;b++){let d=this.children[b];if(d==a)return c;c+=d.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(a,b,c){let d;if(this.contentDOM&&this.contentDOM.contains(1==a.nodeType?a:a.parentNode))if(c<0){let c,d;if(a==this.contentDOM)c=a.childNodes[b-1];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.previousSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.previousSibling;return c?this.posBeforeChild(d)+d.size:this.posAtStart}else{let c,d;if(a==this.contentDOM)c=a.childNodes[b];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.nextSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.nextSibling;return c?this.posBeforeChild(d):this.posAtEnd}if(a==this.dom&&this.contentDOM)d=b>g(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))d=2&a.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==b)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!1;break}if(b.previousSibling)break}if(null==d&&b==a.childNodes.length)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!0;break}if(b.nextSibling)break}}return(null==d?c>0:d)?this.posAtEnd:this.posAtStart}nearestDesc(a,b=!1){for(let c=!0,d=a;d;d=d.parentNode){let e=this.getDesc(d),f;if(e&&(!b||e.node))if(!c||!(f=e.nodeDOM)||(1==f.nodeType?f.contains(1==a.nodeType?a:a.parentNode):f==a))return e;else c=!1}}getDesc(a){let b=a.pmViewDesc;for(let a=b;a;a=a.parent)if(a==this)return b}posFromDOM(a,b,c){for(let d=a;d;d=d.parentNode){let e=this.getDesc(d);if(e)return e.localPosFromDOM(a,b,c)}return -1}descAt(a){for(let b=0,c=0;b<this.children.length;b++){let d=this.children[b],e=c+d.size;if(c==a&&e!=c){for(;!d.border&&d.children.length;)for(let a=0;a<d.children.length;a++){let b=d.children[a];if(b.size){d=b;break}}return d}if(a<e)return d.descAt(a-c-d.border);c=e}}domFromPos(a,b){if(!this.contentDOM)return{node:this.dom,offset:0,atom:a+1};let c=0,d=0;for(let b=0;c<this.children.length;c++){let e=this.children[c],f=b+e.size;if(f>a||e instanceof ai){d=a-b;break}b=f}if(d)return this.children[c].domFromPos(d-this.children[c].border,b);for(let a;c&&!(a=this.children[c-1]).size&&a instanceof ac&&a.side>=0;c--);if(b<=0){let a,d=!0;for(;(a=c?this.children[c-1]:null)&&a.dom.parentNode!=this.contentDOM;c--,d=!1);return a&&b&&d&&!a.border&&!a.domAtom?a.domFromPos(a.size,b):{node:this.contentDOM,offset:a?g(a.dom)+1:0}}{let a,d=!0;for(;(a=c<this.children.length?this.children[c]:null)&&a.dom.parentNode!=this.contentDOM;c++,d=!1);return a&&d&&!a.border&&!a.domAtom?a.domFromPos(0,b):{node:this.contentDOM,offset:a?g(a.dom):this.contentDOM.childNodes.length}}}parseRange(a,b,c=0){if(0==this.children.length)return{node:this.contentDOM,from:a,to:b,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let d=-1,e=-1;for(let f=c,h=0;;h++){let c=this.children[h],i=f+c.size;if(-1==d&&a<=i){let e=f+c.border;if(a>=e&&b<=i-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(a,b,e);a=f;for(let b=h;b>0;b--){let c=this.children[b-1];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(1)){d=g(c.dom)+1;break}a-=c.size}-1==d&&(d=0)}if(d>-1&&(i>b||h==this.children.length-1)){b=i;for(let a=h+1;a<this.children.length;a++){let c=this.children[a];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(-1)){e=g(c.dom);break}b+=c.size}-1==e&&(e=this.contentDOM.childNodes.length);break}f=i}return{node:this.contentDOM,from:a,to:b,fromOffset:d,toOffset:e}}emptyChildAt(a){if(this.border||!this.contentDOM||!this.children.length)return!1;let b=this.children[a<0?0:this.children.length-1];return 0==b.size||b.emptyChildAt(a)}domAfterPos(a){let{node:b,offset:c}=this.domFromPos(a,0);if(1!=b.nodeType||c==b.childNodes.length)throw RangeError("No node after pos "+a);return b.childNodes[c]}setSelection(a,b,c,d=!1){let e=Math.min(a,b),f=Math.max(a,b);for(let g=0,h=0;g<this.children.length;g++){let i=this.children[g],j=h+i.size;if(e>h&&f<j)return i.setSelection(a-h-i.border,b-h-i.border,c,d);h=j}let h=this.domFromPos(a,a?-1:1),i=b==a?h:this.domFromPos(b,b?-1:1),j=c.root.getSelection(),k=c.domSelectionRange(),m=!1;if((A||E)&&a==b){let{node:a,offset:b}=h;if(3==a.nodeType){if((m=!!(b&&"\n"==a.nodeValue[b-1]))&&b==a.nodeValue.length)for(let b=a,c;b;b=b.parentNode){if(c=b.nextSibling){"BR"==c.nodeName&&(h=i={node:c.parentNode,offset:g(c)+1});break}let a=b.pmViewDesc;if(a&&a.node&&a.node.isBlock)break}}else{let c=a.childNodes[b-1];m=c&&("BR"==c.nodeName||"false"==c.contentEditable)}}if(A&&k.focusNode&&k.focusNode!=i.node&&1==k.focusNode.nodeType){let a=k.focusNode.childNodes[k.focusOffset];a&&"false"==a.contentEditable&&(d=!0)}if(!(d||m&&E)&&l(h.node,h.offset,k.anchorNode,k.anchorOffset)&&l(i.node,i.offset,k.focusNode,k.focusOffset))return;let n=!1;if((j.extend||a==b)&&!(m&&A)){j.collapse(h.node,h.offset);try{a!=b&&j.extend(i.node,i.offset),n=!0}catch(a){}}if(!n){if(a>b){let a=h;h=i,i=a}let c=document.createRange();c.setEnd(i.node,i.offset),c.setStart(h.node,h.offset),j.removeAllRanges(),j.addRange(c)}}ignoreMutation(a){return!this.contentDOM&&"selection"!=a.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(a,b){for(let c=0,d=0;d<this.children.length;d++){let e=this.children[d],f=c+e.size;if(c==f?a<=f&&b>=c:a<f&&b>c){let d=c+e.border,g=f-e.border;if(a>=d&&b<=g){this.dirty=a==c||b==f?2:1,a==d&&b==g&&(e.contentLost||e.dom.parentNode!=this.contentDOM)?e.dirty=3:e.markDirty(a-d,b-d);return}e.dirty=e.dom!=e.contentDOM||e.dom.parentNode!=this.contentDOM||e.children.length?3:2}c=f}this.dirty=2}markParentsDirty(){let a=1;for(let b=this.parent;b;b=b.parent,a++){let c=1==a?2:1;b.dirty<c&&(b.dirty=c)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(a){return!1}}class ac extends ab{constructor(a,b,c,d){let e,f=b.type.toDOM;if("function"==typeof f&&(f=f(c,()=>e?e.parent?e.parent.posBeforeChild(e):void 0:d)),!b.type.spec.raw){if(1!=f.nodeType){let a=document.createElement("span");a.appendChild(f),f=a}f.contentEditable="false",f.classList.add("ProseMirror-widget")}super(a,[],f,null),this.widget=b,this.widget=b,e=this}matchesWidget(a){return 0==this.dirty&&a.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(a){let b=this.widget.spec.stopEvent;return!!b&&b(a)}ignoreMutation(a){return"selection"!=a.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ad extends ab{constructor(a,b,c,d){super(a,[],b,null),this.textDOM=c,this.text=d}get size(){return this.text.length}localPosFromDOM(a,b){return a!=this.textDOM?this.posAtStart+(b?this.size:0):this.posAtStart+b}domFromPos(a){return{node:this.textDOM,offset:a}}ignoreMutation(a){return"characterData"===a.type&&a.target.nodeValue==a.oldValue}}class ae extends ab{constructor(a,b,c,d,e){super(a,[],c,d),this.mark=b,this.spec=e}static create(a,b,c,d){let f=d.nodeViews[b.type.name],g=f&&f(b,d,c);return g&&g.dom||(g=e.ZF.renderSpec(document,b.type.spec.toDOM(b,c),null,b.attrs)),new ae(a,b,g.dom,g.contentDOM||g.dom,g)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(a){return 3!=this.dirty&&this.mark.eq(a)}markDirty(a,b){if(super.markDirty(a,b),0!=this.dirty){let a=this.parent;for(;!a.node;)a=a.parent;a.dirty<this.dirty&&(a.dirty=this.dirty),this.dirty=0}}slice(a,b,c){let d=ae.create(this.parent,this.mark,!0,c),e=this.children,f=this.size;b<f&&(e=at(e,b,f,c)),a>0&&(e=at(e,0,a,c));for(let a=0;a<e.length;a++)e[a].parent=d;return d.children=e,d}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class af extends ab{constructor(a,b,c,d,e,f,g,h,i){super(a,[],e,f),this.node=b,this.outerDeco=c,this.innerDeco=d,this.nodeDOM=g}static create(a,b,c,d,f,g){let h=f.nodeViews[b.type.name],i,j=h&&h(b,f,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:g,c,d),k=j&&j.dom,l=j&&j.contentDOM;if(b.isText)if(k){if(3!=k.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else k=document.createTextNode(b.text);else if(!k){let a=e.ZF.renderSpec(document,b.type.spec.toDOM(b),null,b.attrs);({dom:k,contentDOM:l}=a)}l||b.isText||"BR"==k.nodeName||(k.hasAttribute("contenteditable")||(k.contentEditable="false"),b.type.spec.draggable&&(k.draggable=!0));let m=k;return(k=ao(k,c,b),j)?i=new aj(a,b,c,d,k,l||null,m,j,f,g+1):b.isText?new ah(a,b,c,d,k,m,f):new af(a,b,c,d,k,l||null,m,f,g+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let a={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(a.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let b=this.children.length-1;b>=0;b--){let c=this.children[b];if(this.dom.contains(c.dom.parentNode)){a.contentElement=c.dom.parentNode;break}}a.contentElement||(a.getContent=()=>e.FK.empty)}else a.contentElement=this.contentDOM;else a.getContent=()=>this.node.content;return a}matchesNode(a,b,c){return 0==this.dirty&&a.eq(this.node)&&ap(b,this.outerDeco)&&c.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(a,b){let c=this.node.inlineContent,d=b,f=a.composing?this.localCompositionInfo(a,b):null,g=f&&f.pos>-1?f:null,h=f&&f.pos<0,i=new ar(this,g&&g.node,a);(function(a,b,c,d){let e=b.locals(a),f=0;if(0==e.length){for(let c=0;c<a.childCount;c++){let g=a.child(c);d(g,e,b.forChild(f,g),c),f+=g.nodeSize}return}let g=0,h=[],i=null;for(let j=0;;){let k,l,m,n;for(;g<e.length&&e[g].to==f;){let a=e[g++];a.widget&&(k?(l||(l=[k])).push(a):k=a)}if(k)if(l){l.sort(as);for(let a=0;a<l.length;a++)c(l[a],j,!!i)}else c(k,j,!!i);if(i)n=-1,m=i,i=null;else if(j<a.childCount)n=j,m=a.child(j++);else break;for(let a=0;a<h.length;a++)h[a].to<=f&&h.splice(a--,1);for(;g<e.length&&e[g].from<=f&&e[g].to>f;)h.push(e[g++]);let o=f+m.nodeSize;if(m.isText){let a=o;g<e.length&&e[g].from<a&&(a=e[g].from);for(let b=0;b<h.length;b++)h[b].to<a&&(a=h[b].to);a<o&&(i=m.cut(a-f),m=m.cut(0,a-f),o=a,n=-1)}else for(;g<e.length&&e[g].to<o;)g++;let p=m.isInline&&!m.isLeaf?h.filter(a=>!a.inline):h.slice();d(m,p,b.forChild(f,m),n),f=o}})(this.node,this.innerDeco,(b,f,g)=>{b.spec.marks?i.syncToMarks(b.spec.marks,c,a,f):b.type.side>=0&&!g&&i.syncToMarks(f==this.node.childCount?e.CU.none:this.node.child(f).marks,c,a,f),i.placeWidget(b,a,d)},(b,e,g,j)=>{let k;i.syncToMarks(b.marks,c,a,j),i.findNodeMatch(b,e,g,j)||h&&a.state.selection.from>d&&a.state.selection.to<d+b.nodeSize&&(k=i.findIndexWithChild(f.node))>-1&&i.updateNodeAt(b,e,g,k,a)||i.updateNextNode(b,e,g,a,j,d)||i.addNode(b,e,g,a,d),d+=b.nodeSize}),i.syncToMarks([],c,a,0),this.node.isTextblock&&i.addTextblockHacks(),i.destroyRest(),(i.changed||2==this.dirty)&&(g&&this.protectLocalComposition(a,g),function a(b,c,d){let e=b.firstChild,f=!1;for(let g=0;g<c.length;g++){let h=c[g],i=h.dom;if(i.parentNode==b){for(;i!=e;)e=aq(e),f=!0;e=e.nextSibling}else f=!0,b.insertBefore(i,e);if(h instanceof ae){let c=e?e.previousSibling:b.lastChild;a(h.contentDOM,h.children,d),e=c?c.nextSibling:b.firstChild}}for(;e;)e=aq(e),f=!0;f&&d.trackWrites==b&&(d.trackWrites=null)}(this.contentDOM,this.children,a),F&&function(a){if("UL"==a.nodeName||"OL"==a.nodeName){let b=a.style.cssText;a.style.cssText=b+"; list-style: square !important",window.getComputedStyle(a).listStyle,a.style.cssText=b}}(this.dom))}localCompositionInfo(a,b){let{from:c,to:e}=a.state.selection;if(!(a.state.selection instanceof d.U3)||c<b||e>b+this.node.content.size)return null;let f=a.input.compositionNode;if(!f||!this.dom.contains(f.parentNode))return null;if(!this.node.inlineContent)return{node:f,pos:-1,text:""};{let a=f.nodeValue,d=function(a,b,c,d){for(let e=0,f=0;e<a.childCount&&f<=d;){let g=a.child(e++),h=f;if(f+=g.nodeSize,!g.isText)continue;let i=g.text;for(;e<a.childCount;){let b=a.child(e++);if(f+=b.nodeSize,!b.isText)break;i+=b.text}if(f>=c){if(f>=d&&i.slice(d-b.length-h,d-h)==b)return d-b.length;let a=h<d?i.lastIndexOf(b,d-h-1):-1;if(a>=0&&a+b.length+h>=c)return h+a;if(c==d&&i.length>=d+b.length-h&&i.slice(d-h,d-h+b.length)==b)return d}}return -1}(this.node.content,a,c-b,e-b);return d<0?null:{node:f,pos:d,text:a}}}protectLocalComposition(a,{node:b,pos:c,text:d}){if(this.getDesc(b))return;let e=b;for(;e.parentNode!=this.contentDOM;e=e.parentNode){for(;e.previousSibling;)e.parentNode.removeChild(e.previousSibling);for(;e.nextSibling;)e.parentNode.removeChild(e.nextSibling);e.pmViewDesc&&(e.pmViewDesc=void 0)}let f=new ad(this,e,b,d);a.input.compositionNodes.push(f),this.children=at(this.children,c,c+d.length,a,f)}update(a,b,c,d){return 3!=this.dirty&&!!a.sameMarkup(this.node)&&(this.updateInner(a,b,c,d),!0)}updateInner(a,b,c,d){this.updateOuterDeco(b),this.node=a,this.innerDeco=c,this.contentDOM&&this.updateChildren(d,this.posAtStart),this.dirty=0}updateOuterDeco(a){if(ap(a,this.outerDeco))return;let b=1!=this.nodeDOM.nodeType,c=this.dom;this.dom=an(this.dom,this.nodeDOM,am(this.outerDeco,this.node,b),am(a,this.node,b)),this.dom!=c&&(c.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=a}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ag(a,b,c,d,e){ao(d,b,a);let f=new af(void 0,a,b,c,d,d,d,e,0);return f.contentDOM&&f.updateChildren(e,0),f}class ah extends af{constructor(a,b,c,d,e,f,g){super(a,b,c,d,e,null,f,g,0)}parseRule(){let a=this.nodeDOM.parentNode;for(;a&&a!=this.dom&&!a.pmIsDeco;)a=a.parentNode;return{skip:a||!0}}update(a,b,c,d){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!a.sameMarkup(this.node)&&(this.updateOuterDeco(b),(0!=this.dirty||a.text!=this.node.text)&&a.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=a.text,d.trackWrites==this.nodeDOM&&(d.trackWrites=null)),this.node=a,this.dirty=0,!0)}inParent(){let a=this.parent.contentDOM;for(let b=this.nodeDOM;b;b=b.parentNode)if(b==a)return!0;return!1}domFromPos(a){return{node:this.nodeDOM,offset:a}}localPosFromDOM(a,b,c){return a==this.nodeDOM?this.posAtStart+Math.min(b,this.node.text.length):super.localPosFromDOM(a,b,c)}ignoreMutation(a){return"characterData"!=a.type&&"selection"!=a.type}slice(a,b,c){let d=this.node.cut(a,b),e=document.createTextNode(d.text);return new ah(this.parent,d,this.outerDeco,this.innerDeco,e,e,c)}markDirty(a,b){super.markDirty(a,b),this.dom!=this.nodeDOM&&(0==a||b==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(a){return this.node.text==a}}class ai extends ab{parseRule(){return{ignore:!0}}matchesHack(a){return 0==this.dirty&&this.dom.nodeName==a}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class aj extends af{constructor(a,b,c,d,e,f,g,h,i,j){super(a,b,c,d,e,f,g,i,j),this.spec=h}update(a,b,c,d){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==a.type||this.spec.multiType)){let e=this.spec.update(a,b,c);return e&&this.updateInner(a,b,c,d),e}return(!!this.contentDOM||!!a.isLeaf)&&super.update(a,b,c,d)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(a,b,c,d){this.spec.setSelection?this.spec.setSelection(a,b,c.root):super.setSelection(a,b,c,d)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(a){return!!this.spec.stopEvent&&this.spec.stopEvent(a)}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}}let ak=function(a){a&&(this.nodeName=a)};ak.prototype=Object.create(null);let al=[new ak];function am(a,b,c){if(0==a.length)return al;let d=c?al[0]:new ak,e=[d];for(let f=0;f<a.length;f++){let g=a[f].type.attrs;if(g)for(let a in g.nodeName&&e.push(d=new ak(g.nodeName)),g){let f=g[a];null!=f&&(c&&1==e.length&&e.push(d=new ak(b.isInline?"span":"div")),"class"==a?d.class=(d.class?d.class+" ":"")+f:"style"==a?d.style=(d.style?d.style+";":"")+f:"nodeName"!=a&&(d[a]=f))}}return e}function an(a,b,c,d){if(c==al&&d==al)return b;let e=b;for(let b=0;b<d.length;b++){let f=d[b],g=c[b];if(b){let b;g&&g.nodeName==f.nodeName&&e!=a&&(b=e.parentNode)&&b.nodeName.toLowerCase()==f.nodeName||((b=document.createElement(f.nodeName)).pmIsDeco=!0,b.appendChild(e),g=al[0]),e=b}!function(a,b,c){for(let d in b)"class"==d||"style"==d||"nodeName"==d||d in c||a.removeAttribute(d);for(let d in c)"class"!=d&&"style"!=d&&"nodeName"!=d&&c[d]!=b[d]&&a.setAttribute(d,c[d]);if(b.class!=c.class){let d=b.class?b.class.split(" ").filter(Boolean):[],e=c.class?c.class.split(" ").filter(Boolean):[];for(let b=0;b<d.length;b++)-1==e.indexOf(d[b])&&a.classList.remove(d[b]);for(let b=0;b<e.length;b++)-1==d.indexOf(e[b])&&a.classList.add(e[b]);0==a.classList.length&&a.removeAttribute("class")}if(b.style!=c.style){if(b.style){let c=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,d;for(;d=c.exec(b.style);)a.style.removeProperty(d[1])}c.style&&(a.style.cssText+=c.style)}}(e,g||al[0],f)}return e}function ao(a,b,c){return an(a,a,al,am(b,c,1!=a.nodeType))}function ap(a,b){if(a.length!=b.length)return!1;for(let c=0;c<a.length;c++)if(!a[c].type.eq(b[c].type))return!1;return!0}function aq(a){let b=a.nextSibling;return a.parentNode.removeChild(a),b}class ar{constructor(a,b,c){this.lock=b,this.view=c,this.index=0,this.stack=[],this.changed=!1,this.top=a,this.preMatch=function(a,b){let c=b,d=c.children.length,e=a.childCount,f=new Map,g=[];a:for(;e>0;){let h;for(;;)if(d){let a=c.children[d-1];if(a instanceof ae)c=a,d=a.children.length;else{h=a,d--;break}}else if(c==b)break a;else d=c.parent.children.indexOf(c),c=c.parent;let i=h.node;if(i){if(i!=a.child(e-1))break;--e,f.set(h,e),g.push(h)}}return{index:e,matched:f,matches:g.reverse()}}(a.node.content,a)}destroyBetween(a,b){if(a!=b){for(let c=a;c<b;c++)this.top.children[c].destroy();this.top.children.splice(a,b-a),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(a,b,c,d){let e=0,f=this.stack.length>>1,g=Math.min(f,a.length);for(;e<g&&(e==f-1?this.top:this.stack[e+1<<1]).matchesMark(a[e])&&!1!==a[e].type.spec.spanning;)e++;for(;e<f;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),f--;for(;f<a.length;){this.stack.push(this.top,this.index+1);let e=-1,g=this.top.children.length;d<this.preMatch.index&&(g=Math.min(this.index+3,g));for(let b=this.index;b<g;b++){let c=this.top.children[b];if(c.matchesMark(a[f])&&!this.isLocked(c.dom)){e=b;break}}if(e>-1)e>this.index&&(this.changed=!0,this.destroyBetween(this.index,e)),this.top=this.top.children[this.index];else{let d=ae.create(this.top,a[f],b,c);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,f++}}findNodeMatch(a,b,c,d){let e=-1,f;if(d>=this.preMatch.index&&(f=this.preMatch.matches[d-this.preMatch.index]).parent==this.top&&f.matchesNode(a,b,c))e=this.top.children.indexOf(f,this.index);else for(let d=this.index,f=Math.min(this.top.children.length,d+5);d<f;d++){let f=this.top.children[d];if(f.matchesNode(a,b,c)&&!this.preMatch.matched.has(f)){e=d;break}}return!(e<0)&&(this.destroyBetween(this.index,e),this.index++,!0)}updateNodeAt(a,b,c,d,e){let f=this.top.children[d];return 3==f.dirty&&f.dom==f.contentDOM&&(f.dirty=2),!!f.update(a,b,c,e)&&(this.destroyBetween(this.index,d),this.index++,!0)}findIndexWithChild(a){for(;;){let b=a.parentNode;if(!b)return -1;if(b==this.top.contentDOM){let b=a.pmViewDesc;if(b){for(let a=this.index;a<this.top.children.length;a++)if(this.top.children[a]==b)return a}return -1}a=b}}updateNextNode(a,b,c,d,e,f){for(let g=this.index;g<this.top.children.length;g++){let h=this.top.children[g];if(h instanceof af){let i=this.preMatch.matched.get(h);if(null!=i&&i!=e)return!1;let j=h.dom,k,l=this.isLocked(j)&&!(a.isText&&h.node&&h.node.isText&&h.nodeDOM.nodeValue==a.text&&3!=h.dirty&&ap(b,h.outerDeco));if(!l&&h.update(a,b,c,d))return this.destroyBetween(this.index,g),h.dom!=j&&(this.changed=!0),this.index++,!0;if(!l&&(k=this.recreateWrapper(h,a,b,c,d,f)))return this.destroyBetween(this.index,g),this.top.children[this.index]=k,k.contentDOM&&(k.dirty=2,k.updateChildren(d,f+1),k.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(a,b,c,d,e,f){if(a.dirty||b.isAtom||!a.children.length||!a.node.content.eq(b.content)||!ap(c,a.outerDeco)||!d.eq(a.innerDeco))return null;let g=af.create(this.top,b,c,d,e,f);if(g.contentDOM)for(let b of(g.children=a.children,a.children=[],g.children))b.parent=g;return a.destroy(),g}addNode(a,b,c,d,e){let f=af.create(this.top,a,b,c,d,e);f.contentDOM&&f.updateChildren(d,e+1),this.top.children.splice(this.index++,0,f),this.changed=!0}placeWidget(a,b,c){let d=this.index<this.top.children.length?this.top.children[this.index]:null;if(d&&d.matchesWidget(a)&&(a==d.widget||!d.widget.type.toDOM.parentNode))this.index++;else{let d=new ac(this.top,a,b,c);this.top.children.splice(this.index++,0,d),this.changed=!0}}addTextblockHacks(){let a=this.top.children[this.index-1],b=this.top;for(;a instanceof ae;)a=(b=a).children[b.children.length-1];(!a||!(a instanceof ah)||/\n$/.test(a.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(a.node.text))&&((E||C)&&a&&"false"==a.dom.contentEditable&&this.addHackNode("IMG",b),this.addHackNode("BR",this.top))}addHackNode(a,b){if(b==this.top&&this.index<b.children.length&&b.children[this.index].matchesHack(a))this.index++;else{let c=document.createElement(a);"IMG"==a&&(c.className="ProseMirror-separator",c.alt=""),"BR"==a&&(c.className="ProseMirror-trailingBreak");let d=new ai(this.top,[],c,null);b!=this.top?b.children.push(d):b.children.splice(this.index++,0,d),this.changed=!0}}isLocked(a){return this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))}}function as(a,b){return a.type.side-b.type.side}function at(a,b,c,d,e){let f=[];for(let g=0,h=0;g<a.length;g++){let i=a[g],j=h,k=h+=i.size;j>=c||k<=b?f.push(i):(j<b&&f.push(i.slice(0,b-j,d)),e&&(f.push(e),e=void 0),k>c&&f.push(i.slice(c-j,i.size,d)))}return f}function au(a,b=null){let c=a.domSelectionRange(),e=a.state.doc;if(!c.focusNode)return null;let f=a.docView.nearestDesc(c.focusNode),h=f&&0==f.size,i=a.docView.posFromDOM(c.focusNode,c.focusOffset,1);if(i<0)return null;let j=e.resolve(i),k,l;if(q(c)){for(k=i;f&&!f.node;)f=f.parent;let a=f.node;if(f&&a.isAtom&&d.nh.isSelectable(a)&&f.parent&&!(a.isInline&&function(a,b,c){for(let d=0==b,e=b==o(a);d||e;){if(a==c)return!0;let b=g(a);if(!(a=a.parentNode))return!1;d=d&&0==b,e=e&&b==o(a)}}(c.focusNode,c.focusOffset,f.dom))){let a=f.posBefore;l=new d.nh(i==a?j:e.resolve(a))}}else{if(c instanceof a.dom.ownerDocument.defaultView.Selection&&c.rangeCount>1){let b=i,d=i;for(let e=0;e<c.rangeCount;e++){let f=c.getRangeAt(e);b=Math.min(b,a.docView.posFromDOM(f.startContainer,f.startOffset,1)),d=Math.max(d,a.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(b<0)return null;[k,i]=d==a.state.selection.anchor?[d,b]:[b,d],j=e.resolve(i)}else k=a.docView.posFromDOM(c.anchorNode,c.anchorOffset,1);if(k<0)return null}let m=e.resolve(k);if(!l){let c="pointer"==b||a.state.selection.head<j.pos&&!h?1:-1;l=aD(a,m,j,c)}return l}function av(a){return a.editable?a.hasFocus():aF(a)&&document.activeElement&&document.activeElement.contains(a.dom)}function aw(a,b=!1){let c=a.state.selection;if(aB(a,c),av(a)){if(!b&&a.input.mouseDown&&a.input.mouseDown.allowDefault&&C){let b=a.domSelectionRange(),c=a.domObserver.currentSelection;if(b.anchorNode&&c.anchorNode&&l(b.anchorNode,b.anchorOffset,c.anchorNode,c.anchorOffset)){a.input.mouseDown.delayedSelectionSync=!0,a.domObserver.setCurSelection();return}}if(a.domObserver.disconnectSelection(),a.cursorWrapper)!function(a){let b=a.domSelection();if(!b)return;let c=a.cursorWrapper.dom,d="IMG"==c.nodeName;d?b.collapse(c.parentNode,g(c)+1):b.collapse(c,0),!d&&!a.state.selection.visible&&y&&z<=11&&(c.disabled=!0,c.disabled=!1)}(a);else{var e;let f,g,h,i,{anchor:j,head:k}=c,l,m;ax&&!(c instanceof d.U3)&&(c.$from.parent.inlineContent||(l=ay(a,c.from)),c.empty||c.$from.parent.inlineContent||(m=ay(a,c.to))),a.docView.setSelection(j,k,a,b),ax&&(l&&aA(l),m&&aA(m)),c.visible?a.dom.classList.remove("ProseMirror-hideselection"):(a.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((f=(e=a).dom.ownerDocument).removeEventListener("selectionchange",e.input.hideSelectionGuard),h=(g=e.domSelectionRange()).anchorNode,i=g.anchorOffset,f.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(g.anchorNode!=h||g.anchorOffset!=i)&&(f.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!av(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})))}a.domObserver.setCurSelection(),a.domObserver.connectSelection()}}let ax=E||C&&D<63;function ay(a,b){let{node:c,offset:d}=a.docView.domFromPos(b,0),e=d<c.childNodes.length?c.childNodes[d]:null,f=d?c.childNodes[d-1]:null;if(E&&e&&"false"==e.contentEditable)return az(e);if((!e||"false"==e.contentEditable)&&(!f||"false"==f.contentEditable)){if(e)return az(e);else if(f)return az(f)}}function az(a){return a.contentEditable="true",E&&a.draggable&&(a.draggable=!1,a.wasDraggable=!0),a}function aA(a){a.contentEditable="false",a.wasDraggable&&(a.draggable=!0,a.wasDraggable=null)}function aB(a,b){if(b instanceof d.nh){let c=a.docView.descAt(b.from);c!=a.lastSelectedViewDesc&&(aC(a),c&&c.selectNode(),a.lastSelectedViewDesc=c)}else aC(a)}function aC(a){a.lastSelectedViewDesc&&(a.lastSelectedViewDesc.parent&&a.lastSelectedViewDesc.deselectNode(),a.lastSelectedViewDesc=void 0)}function aD(a,b,c,e){return a.someProp("createSelectionBetween",d=>d(a,b,c))||d.U3.between(b,c,e)}function aE(a){return(!a.editable||!!a.hasFocus())&&aF(a)}function aF(a){let b=a.domSelectionRange();if(!b.anchorNode)return!1;try{return a.dom.contains(3==b.anchorNode.nodeType?b.anchorNode.parentNode:b.anchorNode)&&(a.editable||a.dom.contains(3==b.focusNode.nodeType?b.focusNode.parentNode:b.focusNode))}catch(a){return!1}}function aG(a,b){let{$anchor:c,$head:e}=a.selection,f=b>0?c.max(e):c.min(e),g=f.parent.inlineContent?f.depth?a.doc.resolve(b>0?f.after():f.before()):null:f;return g&&d.LN.findFrom(g,b)}function aH(a,b){return a.dispatch(a.state.tr.setSelection(b).scrollIntoView()),!0}function aI(a,b,c){let e=a.state.selection;if(e instanceof d.U3){if(c.indexOf("s")>-1){let{$head:c}=e,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter;if(!f||f.isText||!f.isLeaf)return!1;let g=a.state.doc.resolve(c.pos+f.nodeSize*(b<0?-1:1));return aH(a,new d.U3(e.$anchor,g))}else if(!e.empty)return!1;else if(a.endOfTextblock(b>0?"forward":"backward")){let c=aG(a.state,b);return!!c&&c instanceof d.nh&&aH(a,c)}else if(!(G&&c.indexOf("m")>-1)){let c=e.$head,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter,g;if(!f||f.isText)return!1;let h=b<0?c.pos-f.nodeSize:c.pos;return!!(f.isAtom||(g=a.docView.descAt(h))&&!g.contentDOM)&&(d.nh.isSelectable(f)?aH(a,new d.nh(b<0?a.state.doc.resolve(c.pos-f.nodeSize):c)):!!J&&aH(a,new d.U3(a.state.doc.resolve(b<0?h:h+f.nodeSize))))}}else{if(e instanceof d.nh&&e.node.isInline)return aH(a,new d.U3(b>0?e.$to:e.$from));let c=aG(a.state,b);return!!c&&aH(a,c)}}function aJ(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function aK(a,b){let c=a.pmViewDesc;return c&&0==c.size&&(b<0||a.nextSibling||"BR"!=a.nodeName)}function aL(a,b){return b<0?function(a){let b=a.domSelectionRange(),c=b.focusNode,d=b.focusOffset;if(!c)return;let e,f,h=!1;for(A&&1==c.nodeType&&d<aJ(c)&&aK(c.childNodes[d],-1)&&(h=!0);;)if(d>0)if(1!=c.nodeType)break;else{let a=c.childNodes[d-1];if(aK(a,-1))e=c,f=--d;else if(3==a.nodeType)d=(c=a).nodeValue.length;else break}else if(aM(c))break;else{let b=c.previousSibling;for(;b&&aK(b,-1);)e=c.parentNode,f=g(b),b=b.previousSibling;if(b)d=aJ(c=b);else{if((c=c.parentNode)==a.dom)break;d=0}}h?aN(a,c,d):e&&aN(a,e,f)}(a):function(a){let b,c,d=a.domSelectionRange(),e=d.focusNode,f=d.focusOffset;if(!e)return;let h=aJ(e);for(;;)if(f<h){if(1!=e.nodeType)break;if(aK(e.childNodes[f],1))b=e,c=++f;else break}else if(aM(e))break;else{let d=e.nextSibling;for(;d&&aK(d,1);)b=d.parentNode,c=g(d)+1,d=d.nextSibling;if(d)f=0,h=aJ(e=d);else{if((e=e.parentNode)==a.dom)break;f=h=0}}b&&aN(a,b,c)}(a)}function aM(a){let b=a.pmViewDesc;return b&&b.node&&b.node.isBlock}function aN(a,b,c){if(3!=b.nodeType){let a,d;(d=function(a,b){for(;a&&b==a.childNodes.length&&!p(a);)b=g(a)+1,a=a.parentNode;for(;a&&b<a.childNodes.length;){let c=a.childNodes[b];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;a=c,b=0}}(b,c))?(b=d,c=0):(a=function(a,b){for(;a&&!b&&!p(a);)b=g(a),a=a.parentNode;for(;a&&b;){let c=a.childNodes[b-1];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;b=(a=c).childNodes.length}}(b,c))&&(b=a,c=a.nodeValue.length)}let d=a.domSelection();if(!d)return;if(q(d)){let a=document.createRange();a.setEnd(b,c),a.setStart(b,c),d.removeAllRanges(),d.addRange(a)}else d.extend&&d.extend(b,c);a.domObserver.setCurSelection();let{state:e}=a;setTimeout(()=>{a.state==e&&aw(a)},50)}function aO(a,b){let c=a.state.doc.resolve(b);if(!(C||H)&&c.parent.inlineContent){let d=a.coordsAtPos(b);if(b>c.start()){let c=a.coordsAtPos(b-1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left<d.left?"ltr":"rtl"}if(b<c.end()){let c=a.coordsAtPos(b+1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left>d.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(a.dom).direction?"rtl":"ltr"}function aP(a,b,c){let e=a.state.selection;if(e instanceof d.U3&&!e.empty||c.indexOf("s")>-1||G&&c.indexOf("m")>-1)return!1;let{$from:f,$to:g}=e;if(!f.parent.inlineContent||a.endOfTextblock(b<0?"up":"down")){let c=aG(a.state,b);if(c&&c instanceof d.nh)return aH(a,c)}if(!f.parent.inlineContent){let c=b<0?f:g,h=e instanceof d.i5?d.LN.near(c,b):d.LN.findFrom(c,b);return!!h&&aH(a,h)}return!1}function aQ(a,b){if(!(a.state.selection instanceof d.U3))return!0;let{$head:c,$anchor:e,empty:f}=a.state.selection;if(!c.sameParent(e))return!0;if(!f)return!1;if(a.endOfTextblock(b>0?"forward":"backward"))return!0;let g=!c.textOffset&&(b<0?c.nodeBefore:c.nodeAfter);if(g&&!g.isText){let d=a.state.tr;return b<0?d.delete(c.pos-g.nodeSize,c.pos):d.delete(c.pos,c.pos+g.nodeSize),a.dispatch(d),!0}return!1}function aR(a,b,c){a.domObserver.stop(),b.contentEditable=c,a.domObserver.start()}function aS(a,b){a.someProp("transformCopied",c=>{b=c(b,a)});let c=[],{content:d,openStart:f,openEnd:g}=b;for(;f>1&&g>1&&1==d.childCount&&1==d.firstChild.childCount;){f--,g--;let a=d.firstChild;c.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),d=a.content}let h=a.someProp("clipboardSerializer")||e.ZF.fromSchema(a.state.schema),i=a$(),j=i.createElement("div");j.appendChild(h.serializeFragment(d,{document:i}));let k=j.firstChild,l,m=0;for(;k&&1==k.nodeType&&(l=aY[k.nodeName.toLowerCase()]);){for(let a=l.length-1;a>=0;a--){let b=i.createElement(l[a]);for(;j.firstChild;)b.appendChild(j.firstChild);j.appendChild(b),m++}k=j.firstChild}return k&&1==k.nodeType&&k.setAttribute("data-pm-slice",`${f} ${g}${m?` -${m}`:""} ${JSON.stringify(c)}`),{dom:j,text:a.someProp("clipboardTextSerializer",c=>c(b,a))||b.content.textBetween(0,b.content.size,"\n\n"),slice:b}}function aT(a,b,c,d,f){let g,h,i=f.parent.type.spec.code;if(!c&&!b)return null;let j=!!b&&(d||i||!c);if(j){if(a.someProp("transformPastedText",c=>{b=c(b,i||d,a)}),i)return h=new e.Ji(e.FK.from(a.state.schema.text(b.replace(/\r\n?/g,"\n"))),0,0),a.someProp("transformPasted",b=>{h=b(h,a,!0)}),h;let c=a.someProp("clipboardTextParser",c=>c(b,f,d,a));if(c)h=c;else{let c=f.marks(),{schema:d}=a.state,h=e.ZF.fromSchema(d);g=document.createElement("div"),b.split(/(?:\r\n?|\n)+/).forEach(a=>{let b=g.appendChild(document.createElement("p"));a&&b.appendChild(h.serializeNode(d.text(a,c)))})}}else a.someProp("transformPastedHTML",b=>{c=b(c,a)}),g=function(a){var b;let c,d=/^(\s*<meta [^>]*>)*/.exec(a);d&&(a=a.slice(d[0].length));let e=a$().createElement("div"),f=/<([a-z][^>\s]+)/i.exec(a),g;if((g=f&&aY[f[1].toLowerCase()])&&(a=g.map(a=>"<"+a+">").join("")+a+g.map(a=>"</"+a+">").reverse().join("")),e.innerHTML=(b=a,(c=window.trustedTypes)?(a_||(a_=c.defaultPolicy||c.createPolicy("ProseMirrorClipboard",{createHTML:a=>a})),a_.createHTML(b)):b),g)for(let a=0;a<g.length;a++)e=e.querySelector(g[a])||e;return e}(c),J&&function(a){let b=a.querySelectorAll(C?"span:not([class]):not([style])":"span.Apple-converted-space");for(let c=0;c<b.length;c++){let d=b[c];1==d.childNodes.length&&"\xa0"==d.textContent&&d.parentNode&&d.parentNode.replaceChild(a.ownerDocument.createTextNode(" "),d)}}(g);let k=g&&g.querySelector("[data-pm-slice]"),l=k&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(k.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let a=+l[3];a>0;a--){let a=g.firstChild;for(;a&&1!=a.nodeType;)a=a.nextSibling;if(!a)break;g=a}if(h||(h=(a.someProp("clipboardParser")||a.someProp("domParser")||e.S4.fromSchema(a.state.schema)).parseSlice(g,{preserveWhitespace:!!(j||l),context:f,ruleFromNode:a=>"BR"!=a.nodeName||a.nextSibling||!a.parentNode||aU.test(a.parentNode.nodeName)?null:{ignore:!0}})),l)h=function(a,b){if(!a.size)return a;let c=a.content.firstChild.type.schema,d;try{d=JSON.parse(b)}catch(b){return a}let{content:f,openStart:g,openEnd:h}=a;for(let a=d.length-2;a>=0;a-=2){let b=c.nodes[d[a]];if(!b||b.hasRequiredAttrs())break;f=e.FK.from(b.create(d[a+1],f)),g++,h++}return new e.Ji(f,g,h)}(aX(h,+l[1],+l[2]),l[4]);else if((h=e.Ji.maxOpen(function(a,b){if(a.childCount<2)return a;for(let c=b.depth;c>=0;c--){let d=b.node(c).contentMatchAt(b.index(c)),f,g=[];if(a.forEach(a=>{if(!g)return;let b=d.findWrapping(a.type),c;if(!b)return g=null;if(c=g.length&&f.length&&function a(b,c,d,f,g){if(g<b.length&&g<c.length&&b[g]==c[g]){let h=a(b,c,d,f.lastChild,g+1);if(h)return f.copy(f.content.replaceChild(f.childCount-1,h));if(f.contentMatchAt(f.childCount).matchType(g==b.length-1?d.type:b[g+1]))return f.copy(f.content.append(e.FK.from(aV(d,b,g+1))))}}(b,f,a,g[g.length-1],0))g[g.length-1]=c;else{g.length&&(g[g.length-1]=function a(b,c){if(0==c)return b;let d=b.content.replaceChild(b.childCount-1,a(b.lastChild,c-1)),f=b.contentMatchAt(b.childCount).fillBefore(e.FK.empty,!0);return b.copy(d.append(f))}(g[g.length-1],f.length));let c=aV(a,b);g.push(c),d=d.matchType(c.type),f=b}}),g)return e.FK.from(g)}return a}(h.content,f),!0)).openStart||h.openEnd){let a=0,b=0;for(let b=h.content.firstChild;a<h.openStart&&!b.type.spec.isolating;a++,b=b.firstChild);for(let a=h.content.lastChild;b<h.openEnd&&!a.type.spec.isolating;b++,a=a.lastChild);h=aX(h,a,b)}return a.someProp("transformPasted",b=>{h=b(h,a,j)}),h}let aU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function aV(a,b,c=0){for(let d=b.length-1;d>=c;d--)a=b[d].create(null,e.FK.from(a));return a}function aW(a,b,c,d,f,g){let h=b<0?a.firstChild:a.lastChild,i=h.content;return a.childCount>1&&(g=0),f<d-1&&(i=aW(i,b,c,d,f+1,g)),f>=c&&(i=b<0?h.contentMatchAt(0).fillBefore(i,g<=f).append(i):i.append(h.contentMatchAt(h.childCount).fillBefore(e.FK.empty,!0))),a.replaceChild(b<0?0:a.childCount-1,h.copy(i))}function aX(a,b,c){return b<a.openStart&&(a=new e.Ji(aW(a.content,-1,b,a.openStart,0,a.openEnd),b,a.openEnd)),c<a.openEnd&&(a=new e.Ji(aW(a.content,1,c,a.openEnd,0,0),a.openStart,c)),a}let aY={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},aZ=null;function a$(){return aZ||(aZ=document.implementation.createHTMLDocument("title"))}let a_=null,a0={},a1={},a2={touchstart:!0,touchmove:!0};class a3{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function a4(a,b){a.input.lastSelectionOrigin=b,a.input.lastSelectionTime=Date.now()}function a5(a){a.someProp("handleDOMEvents",b=>{for(let c in b)a.input.eventHandlers[c]||a.dom.addEventListener(c,a.input.eventHandlers[c]=b=>a6(a,b))})}function a6(a,b){return a.someProp("handleDOMEvents",c=>{let d=c[b.type];return!!d&&(d(a,b)||b.defaultPrevented)})}function a7(a){return{left:a.clientX,top:a.clientY}}function a8(a,b,c,d,e){if(-1==d)return!1;let f=a.state.doc.resolve(d);for(let d=f.depth+1;d>0;d--)if(a.someProp(b,b=>d>f.depth?b(a,c,f.nodeAfter,f.before(d),e,!0):b(a,c,f.node(d),f.before(d),e,!1)))return!0;return!1}function a9(a,b,c){if(a.focused||a.focus(),a.state.selection.eq(b))return;let d=a.state.tr.setSelection(b);"pointer"==c&&d.setMeta("pointer",!0),a.dispatch(d)}a1.keydown=(a,b)=>{if((a.input.shiftKey=16==b.keyCode||b.shiftKey,!bc(a,b))&&(a.input.lastKeyCode=b.keyCode,a.input.lastKeyCodeTime=Date.now(),!I||!C||13!=b.keyCode))if(229!=b.keyCode&&a.domObserver.forceFlush(),!F||13!=b.keyCode||b.ctrlKey||b.altKey||b.metaKey)a.someProp("handleKeyDown",c=>c(a,b))||function(a,b){let c,d=b.keyCode,e=(c="",b.ctrlKey&&(c+="c"),b.metaKey&&(c+="m"),b.altKey&&(c+="a"),b.shiftKey&&(c+="s"),c);if(8==d||G&&72==d&&"c"==e)return aQ(a,-1)||aL(a,-1);if(46==d&&!b.shiftKey||G&&68==d&&"c"==e)return aQ(a,1)||aL(a,1);if(13==d||27==d)return!0;if(37==d||G&&66==d&&"c"==e){let b=37==d?"ltr"==aO(a,a.state.selection.from)?-1:1:-1;return aI(a,b,e)||aL(a,b)}if(39==d||G&&70==d&&"c"==e){let b=39==d?"ltr"==aO(a,a.state.selection.from)?1:-1:1;return aI(a,b,e)||aL(a,b)}else if(38==d||G&&80==d&&"c"==e)return aP(a,-1,e)||aL(a,-1);else if(40==d||G&&78==d&&"c"==e)return function(a){if(!E||a.state.selection.$head.parentOffset>0)return!1;let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(b&&1==b.nodeType&&0==c&&b.firstChild&&"false"==b.firstChild.contentEditable){let c=b.firstChild;aR(a,c,"true"),setTimeout(()=>aR(a,c,"false"),20)}return!1}(a)||aP(a,1,e)||aL(a,1);else if(e==(G?"m":"c")&&(66==d||73==d||89==d||90==d))return!0;return!1}(a,b)?b.preventDefault():a4(a,"key");else{let b=Date.now();a.input.lastIOSEnter=b,a.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{a.input.lastIOSEnter==b&&(a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))),a.input.lastIOSEnter=0)},200)}},a1.keyup=(a,b)=>{16==b.keyCode&&(a.input.shiftKey=!1)},a1.keypress=(a,b)=>{if(bc(a,b)||!b.charCode||b.ctrlKey&&!b.altKey||G&&b.metaKey)return;if(a.someProp("handleKeyPress",c=>c(a,b)))return void b.preventDefault();let c=a.state.selection;if(!(c instanceof d.U3)||!c.$from.sameParent(c.$to)){let d=String.fromCharCode(b.charCode),e=()=>a.state.tr.insertText(d).scrollIntoView();/[\r\n]/.test(d)||a.someProp("handleTextInput",b=>b(a,c.$from.pos,c.$to.pos,d,e))||a.dispatch(e()),b.preventDefault()}};let ba=G?"metaKey":"ctrlKey";a0.mousedown=(a,b)=>{a.input.shiftKey=b.shiftKey;let c=bg(a),e=Date.now(),f="singleClick";e-a.input.lastClick.time<500&&function(a,b){let c=b.x-a.clientX,d=b.y-a.clientY;return c*c+d*d<100}(b,a.input.lastClick)&&!b[ba]&&a.input.lastClick.button==b.button&&("singleClick"==a.input.lastClick.type?f="doubleClick":"doubleClick"==a.input.lastClick.type&&(f="tripleClick")),a.input.lastClick={time:e,x:b.clientX,y:b.clientY,type:f,button:b.button};let g=a.posAtCoords(a7(b));g&&("singleClick"==f?(a.input.mouseDown&&a.input.mouseDown.done(),a.input.mouseDown=new bb(a,g,b,!!c)):("doubleClick"==f?function(a,b,c,d){return a8(a,"handleDoubleClickOn",b,c,d)||a.someProp("handleDoubleClick",c=>c(a,b,d))}:function(a,b,c,e){return a8(a,"handleTripleClickOn",b,c,e)||a.someProp("handleTripleClick",c=>c(a,b,e))||function(a,b,c){if(0!=c.button)return!1;let e=a.state.doc;if(-1==b)return!!e.inlineContent&&(a9(a,d.U3.create(e,0,e.content.size),"pointer"),!0);let f=e.resolve(b);for(let b=f.depth+1;b>0;b--){let c=b>f.depth?f.nodeAfter:f.node(b),g=f.before(b);if(c.inlineContent)a9(a,d.U3.create(e,g+1,g+1+c.content.size),"pointer");else{if(!d.nh.isSelectable(c))continue;a9(a,d.nh.create(e,g),"pointer")}return!0}}(a,c,e)})(a,g.pos,g.inside,b)?b.preventDefault():a4(a,"pointer"))};class bb{constructor(a,b,c,e){let f,g;if(this.view=a,this.pos=b,this.event=c,this.flushed=e,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=a.state.doc,this.selectNode=!!c[ba],this.allowDefault=c.shiftKey,b.inside>-1)f=a.state.doc.nodeAt(b.inside),g=b.inside;else{let c=a.state.doc.resolve(b.pos);f=c.parent,g=c.depth?c.before():0}let h=e?null:c.target,i=h?a.docView.nearestDesc(h,!0):null;this.target=i&&1==i.nodeDOM.nodeType?i.nodeDOM:null;let{selection:j}=a.state;(0==c.button&&f.type.spec.draggable&&!1!==f.type.spec.selectable||j instanceof d.nh&&j.from<=g&&j.to>g)&&(this.mightDrag={node:f,pos:g,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&A&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),a.root.addEventListener("mouseup",this.up=this.up.bind(this)),a.root.addEventListener("mousemove",this.move=this.move.bind(this)),a4(a,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>aw(this.view)),this.view.input.mouseDown=null}up(a){if(this.done(),!this.view.dom.contains(a.target))return;let b=this.pos;if(this.view.state.doc!=this.startDoc&&(b=this.view.posAtCoords(a7(a))),this.updateAllowDefault(a),this.allowDefault||!b)a4(this.view,"pointer");else{var c,e,f,g;(c=this.view,e=b.pos,f=b.inside,g=this.selectNode,a8(c,"handleClickOn",e,f,a)||c.someProp("handleClick",b=>b(c,e,a))||(g?function(a,b){if(-1==b)return!1;let c=a.state.selection,e,f;c instanceof d.nh&&(e=c.node);let g=a.state.doc.resolve(b);for(let a=g.depth+1;a>0;a--){let b=a>g.depth?g.nodeAfter:g.node(a);if(d.nh.isSelectable(b)){f=e&&c.$from.depth>0&&a>=c.$from.depth&&g.before(c.$from.depth+1)==c.$from.pos?g.before(c.$from.depth):g.before(a);break}}return null!=f&&(a9(a,d.nh.create(a.state.doc,f),"pointer"),!0)}(c,f):function(a,b){if(-1==b)return!1;let c=a.state.doc.resolve(b),e=c.nodeAfter;return!!(e&&e.isAtom&&d.nh.isSelectable(e))&&(a9(a,new d.nh(c),"pointer"),!0)}(c,f)))?a.preventDefault():0==a.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||C&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(b.pos-this.view.state.selection.from),Math.abs(b.pos-this.view.state.selection.to)))?(a9(this.view,d.LN.near(this.view.state.doc.resolve(b.pos)),"pointer"),a.preventDefault()):a4(this.view,"pointer")}}move(a){this.updateAllowDefault(a),a4(this.view,"pointer"),0==a.buttons&&this.done()}updateAllowDefault(a){!this.allowDefault&&(Math.abs(this.event.x-a.clientX)>4||Math.abs(this.event.y-a.clientY)>4)&&(this.allowDefault=!0)}}function bc(a,b){return!!a.composing||!!(E&&500>Math.abs(b.timeStamp-a.input.compositionEndedAt))&&(a.input.compositionEndedAt=-2e8,!0)}a0.touchstart=a=>{a.input.lastTouch=Date.now(),bg(a),a4(a,"pointer")},a0.touchmove=a=>{a.input.lastTouch=Date.now(),a4(a,"pointer")},a0.contextmenu=a=>bg(a);let bd=I?5e3:-1;function be(a,b){clearTimeout(a.input.composingTimeout),b>-1&&(a.input.composingTimeout=setTimeout(()=>bg(a),b))}function bf(a){let b;for(a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=((b=document.createEvent("Event")).initEvent("event",!0,!0),b.timeStamp));a.input.compositionNodes.length>0;)a.input.compositionNodes.pop().markParentsDirty()}function bg(a,b=!1){if(!I||!(a.domObserver.flushingSoon>=0)){if(a.domObserver.forceFlush(),bf(a),b||a.docView&&a.docView.dirty){let c=au(a),d=a.state.selection;return c&&!c.eq(d)?a.dispatch(a.state.tr.setSelection(c)):(a.markCursor||b)&&!d.$from.node(d.$from.sharedDepth(d.to)).inlineContent?a.dispatch(a.state.tr.deleteSelection()):a.updateState(a.state),!0}return!1}}a1.compositionstart=a1.compositionupdate=a=>{if(!a.composing){a.domObserver.flush();let{state:b}=a,c=b.selection.$to;if(b.selection instanceof d.U3&&(b.storedMarks||!c.textOffset&&c.parentOffset&&c.nodeBefore.marks.some(a=>!1===a.type.spec.inclusive)||C&&H&&function(a){let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(!b||1!=b.nodeType||c>=b.childNodes.length)return!1;let d=b.childNodes[c];return 1==d.nodeType&&"false"==d.contentEditable}(a)))a.markCursor=a.state.storedMarks||c.marks(),bg(a,!0),a.markCursor=null;else if(bg(a,!b.selection.empty),A&&b.selection.empty&&c.parentOffset&&!c.textOffset&&c.nodeBefore.marks.length){let b=a.domSelectionRange();for(let c=b.focusNode,d=b.focusOffset;c&&1==c.nodeType&&0!=d;){let b=d<0?c.lastChild:c.childNodes[d-1];if(!b)break;if(3==b.nodeType){let c=a.domSelection();c&&c.collapse(b,b.nodeValue.length);break}c=b,d=-1}}a.input.composing=!0}be(a,bd)},a1.compositionend=(a,b)=>{a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=b.timeStamp,a.input.compositionPendingChanges=a.domObserver.pendingRecords().length?a.input.compositionID:0,a.input.compositionNode=null,a.input.badSafariComposition?a.domObserver.forceFlush():a.input.compositionPendingChanges&&Promise.resolve().then(()=>a.domObserver.flush()),a.input.compositionID++,be(a,20))};let bh=y&&z<15||F&&K<604;function bi(a,b,c,d,f){let g=aT(a,b,c,d,a.state.selection.$from);if(a.someProp("handlePaste",b=>b(a,f,g||e.Ji.empty)))return!0;if(!g)return!1;let h=0==g.openStart&&0==g.openEnd&&1==g.content.childCount?g.content.firstChild:null,i=h?a.state.tr.replaceSelectionWith(h,d):a.state.tr.replaceSelection(g);return a.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bj(a){let b=a.getData("text/plain")||a.getData("Text");if(b)return b;let c=a.getData("text/uri-list");return c?c.replace(/\r?\n/g," "):""}a0.copy=a1.cut=(a,b)=>{let c=a.state.selection,d="cut"==b.type;if(c.empty)return;let e=bh?null:b.clipboardData,{dom:f,text:g}=aS(a,c.content());e?(b.preventDefault(),e.clearData(),e.setData("text/html",f.innerHTML),e.setData("text/plain",g)):function(a,b){if(!a.dom.parentNode)return;let c=a.dom.parentNode.appendChild(document.createElement("div"));c.appendChild(b),c.style.cssText="position: fixed; left: -10000px; top: 10px";let d=getSelection(),e=document.createRange();e.selectNodeContents(b),a.dom.blur(),d.removeAllRanges(),d.addRange(e),setTimeout(()=>{c.parentNode&&c.parentNode.removeChild(c),a.focus()},50)}(a,f),d&&a.dispatch(a.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},a1.paste=(a,b)=>{if(a.composing&&!I)return;let c=bh?null:b.clipboardData,d=a.input.shiftKey&&45!=a.input.lastKeyCode;c&&bi(a,bj(c),c.getData("text/html"),d,b)?b.preventDefault():function(a,b){if(!a.dom.parentNode)return;let c=a.input.shiftKey||a.state.selection.$from.parent.type.spec.code,d=a.dom.parentNode.appendChild(document.createElement(c?"textarea":"div"));c||(d.contentEditable="true"),d.style.cssText="position: fixed; left: -10000px; top: 10px",d.focus();let e=a.input.shiftKey&&45!=a.input.lastKeyCode;setTimeout(()=>{a.focus(),d.parentNode&&d.parentNode.removeChild(d),c?bi(a,d.value,null,e,b):bi(a,d.textContent,d.innerHTML,e,b)},50)}(a,b)};class bk{constructor(a,b,c){this.slice=a,this.move=b,this.node=c}}let bl=G?"altKey":"ctrlKey";function bm(a,b){let c=a.someProp("dragCopies",a=>!a(b));return null!=c?c:!b[bl]}for(let a in a0.dragstart=(a,b)=>{let c,e=a.input.mouseDown;if(e&&e.done(),!b.dataTransfer)return;let f=a.state.selection,g=f.empty?null:a.posAtCoords(a7(b));if(g&&g.pos>=f.from&&g.pos<=(f instanceof d.nh?f.to-1:f.to));else if(e&&e.mightDrag)c=d.nh.create(a.state.doc,e.mightDrag.pos);else if(b.target&&1==b.target.nodeType){let e=a.docView.nearestDesc(b.target,!0);e&&e.node.type.spec.draggable&&e!=a.docView&&(c=d.nh.create(a.state.doc,e.posBefore))}let h=(c||a.state.selection).content(),{dom:i,text:j,slice:k}=aS(a,h);b.dataTransfer.files.length&&C&&!(D>120)||b.dataTransfer.clearData(),b.dataTransfer.setData(bh?"Text":"text/html",i.innerHTML),b.dataTransfer.effectAllowed="copyMove",bh||b.dataTransfer.setData("text/plain",j),a.dragging=new bk(k,bm(a,b),c)},a0.dragend=a=>{let b=a.dragging;window.setTimeout(()=>{a.dragging==b&&(a.dragging=null)},50)},a1.dragover=a1.dragenter=(a,b)=>b.preventDefault(),a1.drop=(a,b)=>{try{!function(a,b,c){if(!b.dataTransfer)return;let g=a.posAtCoords(a7(b));if(!g)return;let h=a.state.doc.resolve(g.pos),i=c&&c.slice;i?a.someProp("transformPasted",b=>{i=b(i,a,!1)}):i=aT(a,bj(b.dataTransfer),bh?null:b.dataTransfer.getData("text/html"),!1,h);let j=!!(c&&bm(a,b));if(a.someProp("handleDrop",c=>c(a,b,i||e.Ji.empty,j)))return b.preventDefault();if(!i)return;b.preventDefault();let k=i?(0,f.Um)(a.state.doc,h.pos,i):h.pos;null==k&&(k=h.pos);let l=a.state.tr;if(j){let{node:a}=c;a?a.replace(l):l.deleteSelection()}let m=l.mapping.map(k),n=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,o=l.doc;if(n?l.replaceRangeWith(m,m,i.content.firstChild):l.replaceRange(m,m,i),l.doc.eq(o))return;let p=l.doc.resolve(m);if(n&&d.nh.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new d.nh(p));else{let b=l.mapping.map(k);l.mapping.maps[l.mapping.maps.length-1].forEach((a,c,d,e)=>b=e),l.setSelection(aD(a,p,l.doc.resolve(b)))}a.focus(),a.dispatch(l.setMeta("uiEvent","drop"))}(a,b,a.dragging)}finally{a.dragging=null}},a0.focus=a=>{a.input.lastFocus=Date.now(),a.focused||(a.domObserver.stop(),a.dom.classList.add("ProseMirror-focused"),a.domObserver.start(),a.focused=!0,setTimeout(()=>{a.docView&&a.hasFocus()&&!a.domObserver.currentSelection.eq(a.domSelectionRange())&&aw(a)},20))},a0.blur=(a,b)=>{a.focused&&(a.domObserver.stop(),a.dom.classList.remove("ProseMirror-focused"),a.domObserver.start(),b.relatedTarget&&a.dom.contains(b.relatedTarget)&&a.domObserver.currentSelection.clear(),a.focused=!1)},a0.beforeinput=(a,b)=>{if(C&&I&&"deleteContentBackward"==b.inputType){a.domObserver.flushSoon();let{domChangeCount:b}=a.input;setTimeout(()=>{if(a.input.domChangeCount!=b||(a.dom.blur(),a.focus(),a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))))return;let{$cursor:c}=a.state.selection;c&&c.pos>0&&a.dispatch(a.state.tr.delete(c.pos-1,c.pos).scrollIntoView())},50)}},a1)a0[a]=a1[a];function bn(a,b){if(a==b)return!0;for(let c in a)if(a[c]!==b[c])return!1;for(let c in b)if(!(c in a))return!1;return!0}class bo{constructor(a,b){this.toDOM=a,this.spec=b||bt,this.side=this.spec.side||0}map(a,b,c,d){let{pos:e,deleted:f}=a.mapResult(b.from+d,this.side<0?-1:1);return f?null:new br(e-c,e-c,this)}valid(){return!0}eq(a){return this==a||a instanceof bo&&(this.spec.key&&this.spec.key==a.spec.key||this.toDOM==a.toDOM&&bn(this.spec,a.spec))}destroy(a){this.spec.destroy&&this.spec.destroy(a)}}class bp{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.map(b.from+d,this.spec.inclusiveStart?-1:1)-c,f=a.map(b.to+d,this.spec.inclusiveEnd?1:-1)-c;return e>=f?null:new br(e,f,this)}valid(a,b){return b.from<b.to}eq(a){return this==a||a instanceof bp&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}static is(a){return a.type instanceof bp}destroy(){}}class bq{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.mapResult(b.from+d,1);if(e.deleted)return null;let f=a.mapResult(b.to+d,-1);return f.deleted||f.pos<=e.pos?null:new br(e.pos-c,f.pos-c,this)}valid(a,b){let{index:c,offset:d}=a.content.findIndex(b.from),e;return d==b.from&&!(e=a.child(c)).isText&&d+e.nodeSize==b.to}eq(a){return this==a||a instanceof bq&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}destroy(){}}class br{constructor(a,b,c){this.from=a,this.to=b,this.type=c}copy(a,b){return new br(a,b,this.type)}eq(a,b=0){return this.type.eq(a.type)&&this.from+b==a.from&&this.to+b==a.to}map(a,b,c){return this.type.map(a,this,b,c)}static widget(a,b,c){return new br(a,a,new bo(b,c))}static inline(a,b,c,d){return new br(a,b,new bp(c,d))}static node(a,b,c,d){return new br(a,b,new bq(c,d))}get spec(){return this.type.spec}get inline(){return this.type instanceof bp}get widget(){return this.type instanceof bo}}let bs=[],bt={};class bu{constructor(a,b){this.local=a.length?a:bs,this.children=b.length?b:bs}static create(a,b){return b.length?bA(b,a,0,bt):bv}find(a,b,c){let d=[];return this.findInner(null==a?0:a,null==b?1e9:b,d,0,c),d}findInner(a,b,c,d,e){for(let f=0;f<this.local.length;f++){let g=this.local[f];g.from<=b&&g.to>=a&&(!e||e(g.spec))&&c.push(g.copy(g.from+d,g.to+d))}for(let f=0;f<this.children.length;f+=3)if(this.children[f]<b&&this.children[f+1]>a){let g=this.children[f]+1;this.children[f+2].findInner(a-g,b-g,c,d+g,e)}}map(a,b,c){return this==bv||0==a.maps.length?this:this.mapInner(a,b,0,0,c||bt)}mapInner(a,b,c,d,e){let f;for(let g=0;g<this.local.length;g++){let h=this.local[g].map(a,c,d);h&&h.type.valid(b,h)?(f||(f=[])).push(h):e.onRemove&&e.onRemove(this.local[g].spec)}return this.children.length?function(a,b,c,d,e,f,g){let h=a.slice();for(let a=0,b=f;a<c.maps.length;a++){let d=0;c.maps[a].forEach((a,c,e,f)=>{let g=f-e-(c-a);for(let e=0;e<h.length;e+=3){let f=h[e+1];if(f<0||a>f+b-d)continue;let i=h[e]+b-d;c>=i?h[e+1]=a<=i?-2:-1:a>=b&&g&&(h[e]+=g,h[e+1]+=g)}d+=g}),b=c.maps[a].map(b,-1)}let i=!1;for(let b=0;b<h.length;b+=3)if(h[b+1]<0){if(-2==h[b+1]){i=!0,h[b+1]=-1;continue}let j=c.map(a[b]+f),k=j-e;if(k<0||k>=d.content.size){i=!0;continue}let l=c.map(a[b+1]+f,-1)-e,{index:m,offset:n}=d.content.findIndex(k),o=d.maybeChild(m);if(o&&n==k&&n+o.nodeSize==l){let d=h[b+2].mapInner(c,o,j+1,a[b]+f+1,g);d!=bv?(h[b]=k,h[b+1]=l,h[b+2]=d):(h[b+1]=-2,i=!0)}else i=!0}if(i){let i=bA(function(a,b,c,d,e,f,g){for(let h=0;h<a.length;h+=3)-1==a[h+1]&&function a(b,f){for(let a=0;a<b.local.length;a++){let h=b.local[a].map(d,e,f);h?c.push(h):g.onRemove&&g.onRemove(b.local[a].spec)}for(let c=0;c<b.children.length;c+=3)a(b.children[c+2],b.children[c]+f+1)}(a[h+2],b[h]+f+1);return c}(h,a,b,c,e,f,g),d,0,g);b=i.local;for(let a=0;a<h.length;a+=3)h[a+1]<0&&(h.splice(a,3),a-=3);for(let a=0,b=0;a<i.children.length;a+=3){let c=i.children[a];for(;b<h.length&&h[b]<c;)b+=3;h.splice(b,0,i.children[a],i.children[a+1],i.children[a+2])}}return new bu(b.sort(bB),h)}(this.children,f||[],a,b,c,d,e):f?new bu(f.sort(bB),bs):bv}add(a,b){return b.length?this==bv?bu.create(a,b):this.addInner(a,b,0):this}addInner(a,b,c){let d,e=0;a.forEach((a,f)=>{let g=f+c,h;if(h=by(b,a,g)){for(d||(d=this.children.slice());e<d.length&&d[e]<f;)e+=3;d[e]==f?d[e+2]=d[e+2].addInner(a,h,g+1):d.splice(e,0,f,f+a.nodeSize,bA(h,a,g+1,bt)),e+=3}});let f=bx(e?bz(b):b,-c);for(let b=0;b<f.length;b++)f[b].type.valid(a,f[b])||f.splice(b--,1);return new bu(f.length?this.local.concat(f).sort(bB):this.local,d||this.children)}remove(a){return 0==a.length||this==bv?this:this.removeInner(a,0)}removeInner(a,b){let c=this.children,d=this.local;for(let d=0;d<c.length;d+=3){let e,f=c[d]+b,g=c[d+1]+b;for(let b=0,c;b<a.length;b++)(c=a[b])&&c.from>f&&c.to<g&&(a[b]=null,(e||(e=[])).push(c));if(!e)continue;c==this.children&&(c=this.children.slice());let h=c[d+2].removeInner(e,f+1);h!=bv?c[d+2]=h:(c.splice(d,3),d-=3)}if(d.length){for(let c=0,e;c<a.length;c++)if(e=a[c])for(let a=0;a<d.length;a++)d[a].eq(e,b)&&(d==this.local&&(d=this.local.slice()),d.splice(a--,1))}return c==this.children&&d==this.local?this:d.length||c.length?new bu(d,c):bv}forChild(a,b){let c,d;if(this==bv)return this;if(b.isLeaf)return bu.empty;for(let b=0;b<this.children.length;b+=3)if(this.children[b]>=a){this.children[b]==a&&(c=this.children[b+2]);break}let e=a+1,f=e+b.content.size;for(let a=0;a<this.local.length;a++){let b=this.local[a];if(b.from<f&&b.to>e&&b.type instanceof bp){let a=Math.max(e,b.from)-e,c=Math.min(f,b.to)-e;a<c&&(d||(d=[])).push(b.copy(a,c))}}if(d){let a=new bu(d.sort(bB),bs);return c?new bw([a,c]):a}return c||bv}eq(a){if(this==a)return!0;if(!(a instanceof bu)||this.local.length!=a.local.length||this.children.length!=a.children.length)return!1;for(let b=0;b<this.local.length;b++)if(!this.local[b].eq(a.local[b]))return!1;for(let b=0;b<this.children.length;b+=3)if(this.children[b]!=a.children[b]||this.children[b+1]!=a.children[b+1]||!this.children[b+2].eq(a.children[b+2]))return!1;return!0}locals(a){return bC(this.localsInner(a))}localsInner(a){if(this==bv)return bs;if(a.inlineContent||!this.local.some(bp.is))return this.local;let b=[];for(let a=0;a<this.local.length;a++)this.local[a].type instanceof bp||b.push(this.local[a]);return b}forEachSet(a){a(this)}}bu.empty=new bu([],[]),bu.removeOverlap=bC;let bv=bu.empty;class bw{constructor(a){this.members=a}map(a,b){let c=this.members.map(c=>c.map(a,b,bt));return bw.from(c)}forChild(a,b){if(b.isLeaf)return bu.empty;let c=[];for(let d=0;d<this.members.length;d++){let e=this.members[d].forChild(a,b);e!=bv&&(e instanceof bw?c=c.concat(e.members):c.push(e))}return bw.from(c)}eq(a){if(!(a instanceof bw)||a.members.length!=this.members.length)return!1;for(let b=0;b<this.members.length;b++)if(!this.members[b].eq(a.members[b]))return!1;return!0}locals(a){let b,c=!0;for(let d=0;d<this.members.length;d++){let e=this.members[d].localsInner(a);if(e.length)if(b){c&&(b=b.slice(),c=!1);for(let a=0;a<e.length;a++)b.push(e[a])}else b=e}return b?bC(c?b:b.sort(bB)):bs}static from(a){switch(a.length){case 0:return bv;case 1:return a[0];default:return new bw(a.every(a=>a instanceof bu)?a:a.reduce((a,b)=>a.concat(b instanceof bu?b:b.members),[]))}}forEachSet(a){for(let b=0;b<this.members.length;b++)this.members[b].forEachSet(a)}}function bx(a,b){if(!b||!a.length)return a;let c=[];for(let d=0;d<a.length;d++){let e=a[d];c.push(new br(e.from+b,e.to+b,e.type))}return c}function by(a,b,c){if(b.isLeaf)return null;let d=c+b.nodeSize,e=null;for(let b=0,f;b<a.length;b++)(f=a[b])&&f.from>c&&f.to<d&&((e||(e=[])).push(f),a[b]=null);return e}function bz(a){let b=[];for(let c=0;c<a.length;c++)null!=a[c]&&b.push(a[c]);return b}function bA(a,b,c,d){let e=[],f=!1;b.forEach((b,g)=>{let h=by(a,b,g+c);if(h){f=!0;let a=bA(h,b,c+g+1,d);a!=bv&&e.push(g,g+b.nodeSize,a)}});let g=bx(f?bz(a):a,-c).sort(bB);for(let a=0;a<g.length;a++)g[a].type.valid(b,g[a])||(d.onRemove&&d.onRemove(g[a].spec),g.splice(a--,1));return g.length||e.length?new bu(g,e):bv}function bB(a,b){return a.from-b.from||a.to-b.to}function bC(a){let b=a;for(let c=0;c<b.length-1;c++){let d=b[c];if(d.from!=d.to)for(let e=c+1;e<b.length;e++){let f=b[e];if(f.from==d.from){f.to!=d.to&&(b==a&&(b=a.slice()),b[e]=f.copy(f.from,d.to),bD(b,e+1,f.copy(d.to,f.to)));continue}f.from<d.to&&(b==a&&(b=a.slice()),b[c]=d.copy(d.from,f.from),bD(b,e,d.copy(f.from,d.to)));break}}return b}function bD(a,b,c){for(;b<a.length&&bB(c,a[b])>0;)b++;a.splice(b,0,c)}function bE(a){let b=[];return a.someProp("decorations",c=>{let d=c(a.state);d&&d!=bv&&b.push(d)}),a.cursorWrapper&&b.push(bu.create(a.state.doc,[a.cursorWrapper.deco])),bw.from(b)}let bF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bG=y&&z<=11;class bH{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(a){this.anchorNode=a.anchorNode,this.anchorOffset=a.anchorOffset,this.focusNode=a.focusNode,this.focusOffset=a.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(a){return a.anchorNode==this.anchorNode&&a.anchorOffset==this.anchorOffset&&a.focusNode==this.focusNode&&a.focusOffset==this.focusOffset}}class bI{constructor(a,b){this.view=a,this.handleDOMChange=b,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bH,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(b=>{for(let a=0;a<b.length;a++)this.queue.push(b[a]);y&&z<=11&&b.some(a=>"childList"==a.type&&a.removedNodes.length||"characterData"==a.type&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():E&&a.composing&&b.some(a=>"childList"==a.type&&"TR"==a.target.nodeName)?(a.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bG&&(this.onCharData=a=>{this.queue.push({target:a.target,type:"characterData",oldValue:a.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let a=this.observer.takeRecords();if(a.length){for(let b=0;b<a.length;b++)this.queue.push(a[b]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(aE(this.view)){if(this.suppressingSelectionUpdates)return aw(this.view);if(y&&z<=11&&!this.view.state.selection.empty){let a=this.view.domSelectionRange();if(a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(a){if(!a.focusNode)return!0;let b=new Set,c;for(let c=a.focusNode;c;c=h(c))b.add(c);for(let d=a.anchorNode;d;d=h(d))if(b.has(d)){c=d;break}let d=c&&this.view.docView.nearestDesc(c);if(d&&d.ignoreMutation({type:"selection",target:3==c.nodeType?c.parentNode:c}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let a of this.observer.takeRecords())this.queue.push(a);return this.queue}flush(){var a;let{view:b}=this;if(!b.docView||this.flushingSoon>-1)return;let c=this.pendingRecords();c.length&&(this.queue=[]);let e=b.domSelectionRange(),f=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&aE(b)&&!this.ignoreSelectionChange(e),g=-1,h=-1,i=!1,j=[];if(b.editable)for(let a=0;a<c.length;a++){let b=this.registerMutation(c[a],j);b&&(g=g<0?b.from:Math.min(b.from,g),h=h<0?b.to:Math.max(b.to,h),b.typeOver&&(i=!0))}if(j.some(a=>"BR"==a.nodeName)&&(8==b.input.lastKeyCode||46==b.input.lastKeyCode)){for(let a of j)if("BR"==a.nodeName&&a.parentNode){let b=a.nextSibling;b&&1==b.nodeType&&"false"==b.contentEditable&&a.parentNode.removeChild(a)}}else if(A&&j.length){let a=j.filter(a=>"BR"==a.nodeName);if(2==a.length){let[b,c]=a;b.parentNode&&b.parentNode.parentNode==c.parentNode?c.remove():b.remove()}else{let{focusNode:c}=this.currentSelection;for(let d of a){let a=d.parentNode;a&&"LI"==a.nodeName&&(!c||function(a,b){for(let c=b.parentNode;c&&c!=a.dom;c=c.parentNode){let b=a.docView.nearestDesc(c,!0);if(b&&b.node.isBlock)return c}return null}(b,c)!=a)&&d.remove()}}}let k=null;g<0&&f&&b.input.lastFocus>Date.now()-200&&Math.max(b.input.lastTouch,b.input.lastClick.time)<Date.now()-300&&q(e)&&(k=au(b))&&k.eq(d.LN.near(b.state.doc.resolve(0),1))?(b.input.lastFocus=0,aw(b),this.currentSelection.set(e),b.scrollToSelection()):(g>-1||f)&&(g>-1&&(b.docView.markDirty(g,h),a=b,!bJ.has(a)&&(bJ.set(a,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(a.dom).whiteSpace))&&(a.requiresGeckoHackNode=A,bK||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),bK=!0))),b.input.badSafariComposition&&(b.input.badSafariComposition=!1,function(a,b){var c;let{focusNode:d,focusOffset:e}=a.domSelectionRange();for(let f of b)if((null==(c=f.parentNode)?void 0:c.nodeName)=="TR"){let b=f.nextSibling;for(;b&&"TD"!=b.nodeName&&"TH"!=b.nodeName;)b=b.nextSibling;if(b){let c=b;for(;;){let a=c.firstChild;if(!a||1!=a.nodeType||"false"==a.contentEditable||/^(BR|IMG)$/.test(a.nodeName))break;c=a}c.insertBefore(f,c.firstChild),d==f&&a.domSelection().collapse(f,e)}else f.parentNode.removeChild(f)}}(b,j)),this.handleDOMChange(g,h,i,j),b.docView&&b.docView.dirty?b.updateState(b.state):this.currentSelection.eq(e)||aw(b),this.currentSelection.set(e))}registerMutation(a,b){if(b.indexOf(a.target)>-1)return null;let c=this.view.docView.nearestDesc(a.target);if("attributes"==a.type&&(c==this.view.docView||"contenteditable"==a.attributeName||"style"==a.attributeName&&!a.oldValue&&!a.target.getAttribute("style"))||!c||c.ignoreMutation(a))return null;if("childList"==a.type){for(let c=0;c<a.addedNodes.length;c++){let d=a.addedNodes[c];b.push(d),3==d.nodeType&&(this.lastChangedTextNode=d)}if(c.contentDOM&&c.contentDOM!=c.dom&&!c.contentDOM.contains(a.target))return{from:c.posBefore,to:c.posAfter};let d=a.previousSibling,e=a.nextSibling;if(y&&z<=11&&a.addedNodes.length)for(let b=0;b<a.addedNodes.length;b++){let{previousSibling:c,nextSibling:f}=a.addedNodes[b];(!c||0>Array.prototype.indexOf.call(a.addedNodes,c))&&(d=c),(!f||0>Array.prototype.indexOf.call(a.addedNodes,f))&&(e=f)}let f=d&&d.parentNode==a.target?g(d)+1:0,h=c.localPosFromDOM(a.target,f,-1),i=e&&e.parentNode==a.target?g(e):a.target.childNodes.length;return{from:h,to:c.localPosFromDOM(a.target,i,1)}}return"attributes"==a.type?{from:c.posAtStart-c.border,to:c.posAtEnd+c.border}:(this.lastChangedTextNode=a.target,{from:c.posAtStart,to:c.posAtEnd,typeOver:a.target.nodeValue==a.oldValue})}}let bJ=new WeakMap,bK=!1;function bL(a,b){let c=b.startContainer,d=b.startOffset,e=b.endContainer,f=b.endOffset,g=a.domAtPos(a.state.selection.anchor);return l(g.node,g.offset,e,f)&&([c,d,e,f]=[e,f,c,d]),{anchorNode:c,anchorOffset:d,focusNode:e,focusOffset:f}}function bM(a){let b=a.pmViewDesc;if(b)return b.parseRule();if("BR"==a.nodeName&&a.parentNode){if(E&&/^(ul|ol)$/i.test(a.parentNode.nodeName)){let a=document.createElement("div");return a.appendChild(document.createElement("li")),{skip:a}}else if(a.parentNode.lastChild==a||E&&/^(tr|table)$/i.test(a.parentNode.nodeName))return{ignore:!0}}else if("IMG"==a.nodeName&&a.getAttribute("mark-placeholder"))return{ignore:!0};return null}let bN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function bO(a,b,c){return Math.max(c.anchor,c.head)>b.content.size?null:aD(a,b.resolve(c.anchor),b.resolve(c.head))}function bP(a,b,c){let d=a.depth,e=b?a.end():a.pos;for(;d>0&&(b||a.indexAfter(d)==a.node(d).childCount);)d--,e++,b=!1;if(c){let b=a.node(d).maybeChild(a.indexAfter(d));for(;b&&!b.isLeaf;)b=b.firstChild,e++}return e}function bQ(a){if(2!=a.length)return!1;let b=a.charCodeAt(0),c=a.charCodeAt(1);return b>=56320&&b<=57343&&c>=55296&&c<=56319}class bR{constructor(a,b){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new a3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=b,this.state=b.state,this.directPlugins=b.plugins||[],this.directPlugins.forEach(bW),this.dispatch=this.dispatch.bind(this),this.dom=a&&a.mount||document.createElement("div"),a&&(a.appendChild?a.appendChild(this.dom):"function"==typeof a?a(this.dom):a.mount&&(this.mounted=!0)),this.editable=bU(this),bT(this),this.nodeViews=bV(this),this.docView=ag(this.state.doc,bS(this),bE(this),this.dom,this),this.domObserver=new bI(this,(a,b,c,f)=>(function(a,b,c,f,g){let h,i,j,k=a.input.compositionPendingChanges||(a.composing?a.input.compositionID:0);if(a.input.compositionPendingChanges=0,b<0){let b=a.input.lastSelectionTime>Date.now()-50?a.input.lastSelectionOrigin:null,c=au(a,b);if(c&&!a.state.selection.eq(c)){if(C&&I&&13===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))))return;let d=a.state.tr.setSelection(c);"pointer"==b?d.setMeta("pointer",!0):"key"==b&&d.scrollIntoView(),k&&d.setMeta("composition",k),a.dispatch(d)}return}let l=a.state.doc.resolve(b),m=l.sharedDepth(c);b=l.before(m+1),c=a.state.doc.resolve(c).after(m+1);let n=a.state.selection,o=function(a,b,c){let d,{node:f,fromOffset:g,toOffset:h,from:i,to:j}=a.docView.parseRange(b,c),k=a.domSelectionRange(),l=k.anchorNode;if(l&&a.dom.contains(1==l.nodeType?l:l.parentNode)&&(d=[{node:l,offset:k.anchorOffset}],q(k)||d.push({node:k.focusNode,offset:k.focusOffset})),C&&8===a.input.lastKeyCode)for(let a=h;a>g;a--){let b=f.childNodes[a-1],c=b.pmViewDesc;if("BR"==b.nodeName&&!c){h=a;break}if(!c||c.size)break}let m=a.state.doc,n=a.someProp("domParser")||e.S4.fromSchema(a.state.schema),o=m.resolve(i),p=null,r=n.parse(f,{topNode:o.parent,topMatch:o.parent.contentMatchAt(o.index()),topOpen:!0,from:g,to:h,preserveWhitespace:"pre"!=o.parent.type.whitespace||"full",findPositions:d,ruleFromNode:bM,context:o});if(d&&null!=d[0].pos){let a=d[0].pos,b=d[1]&&d[1].pos;null==b&&(b=a),p={anchor:a+i,head:b+i}}return{doc:r,sel:p,from:i,to:j}}(a,b,c),p=a.state.doc,s=p.slice(o.from,o.to);8===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime?(h=a.state.selection.to,i="end"):(h=a.state.selection.from,i="start"),a.input.lastKeyCode=null;let t=function(a,b,c,d,e){let f=a.findDiffStart(b,c);if(null==f)return null;let{a:g,b:h}=a.findDiffEnd(b,c+a.size,c+b.size);if("end"==e){let a=Math.max(0,f-Math.min(g,h));d-=g+a-f}if(g<f&&a.size<b.size){let a=d<=f&&d>=g?f-d:0;(f-=a)&&f<b.size&&bQ(b.textBetween(f-1,f+1))&&(f+=a?1:-1),h=f+(h-g),g=f}else if(h<f){let b=d<=f&&d>=h?f-d:0;(f-=b)&&f<a.size&&bQ(a.textBetween(f-1,f+1))&&(f+=b?1:-1),g=f+(g-h),h=f}return{start:f,endA:g,endB:h}}(s.content,o.doc.content,o.from,h,i);if(t&&a.input.domChangeCount++,(F&&a.input.lastIOSEnter>Date.now()-225||I)&&g.some(a=>1==a.nodeType&&!bN.test(a.nodeName))&&(!t||t.endA>=t.endB)&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(!t)if(f&&n instanceof d.U3&&!n.empty&&n.$head.sameParent(n.$anchor)&&!a.composing&&!(o.sel&&o.sel.anchor!=o.sel.head))t={start:n.from,endA:n.to,endB:n.to};else{if(o.sel){let b=bO(a,a.state.doc,o.sel);if(b&&!b.eq(a.state.selection)){let c=a.state.tr.setSelection(b);k&&c.setMeta("composition",k),a.dispatch(c)}}return}a.state.selection.from<a.state.selection.to&&t.start==t.endB&&a.state.selection instanceof d.U3&&(t.start>a.state.selection.from&&t.start<=a.state.selection.from+2&&a.state.selection.from>=o.from?t.start=a.state.selection.from:t.endA<a.state.selection.to&&t.endA>=a.state.selection.to-2&&a.state.selection.to<=o.to&&(t.endB+=a.state.selection.to-t.endA,t.endA=a.state.selection.to)),y&&z<=11&&t.endB==t.start+1&&t.endA==t.start&&t.start>o.from&&" \xa0"==o.doc.textBetween(t.start-o.from-1,t.start-o.from+1)&&(t.start--,t.endA--,t.endB--);let u=o.doc.resolveNoCache(t.start-o.from),v=o.doc.resolveNoCache(t.endB-o.from),w=p.resolve(t.start),x=u.sameParent(v)&&u.parent.inlineContent&&w.end()>=t.endA;if((F&&a.input.lastIOSEnter>Date.now()-225&&(!x||g.some(a=>"DIV"==a.nodeName||"P"==a.nodeName))||!x&&u.pos<o.doc.content.size&&(!u.sameParent(v)||!u.parent.inlineContent)&&u.pos<v.pos&&!/\S/.test(o.doc.textBetween(u.pos,v.pos,"","")))&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(a.state.selection.anchor>t.start&&function(a,b,c,d,e){if(c-b<=e.pos-d.pos||bP(d,!0,!1)<e.pos)return!1;let f=a.resolve(b);if(!d.parent.isTextblock){let a=f.nodeAfter;return null!=a&&c==b+a.nodeSize}if(f.parentOffset<f.parent.content.size||!f.parent.isTextblock)return!1;let g=a.resolve(bP(f,!0,!0));return!(!g.parent.isTextblock||g.pos>c||bP(g,!0,!1)<c)&&d.parent.content.cut(d.parentOffset).eq(g.parent.content)}(p,t.start,t.endA,u,v)&&a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))){I&&C&&a.domObserver.suppressSelectionUpdates();return}C&&t.endB==t.start&&(a.input.lastChromeDelete=Date.now()),I&&!x&&u.start()!=v.start()&&0==v.parentOffset&&u.depth==v.depth&&o.sel&&o.sel.anchor==o.sel.head&&o.sel.head==t.endA&&(t.endB-=2,v=o.doc.resolveNoCache(t.endB-o.from),setTimeout(()=>{a.someProp("handleKeyDown",function(b){return b(a,r(13,"Enter"))})},20));let A=t.start,B=t.endA,D=b=>{let c=b||a.state.tr.replace(A,B,o.doc.slice(t.start-o.from,t.endB-o.from));if(o.sel){let b=bO(a,c.doc,o.sel);b&&!(C&&a.composing&&b.empty&&(t.start!=t.endB||a.input.lastChromeDelete<Date.now()-100)&&(b.head==A||b.head==c.mapping.map(B)-1)||y&&b.empty&&b.head==A)&&c.setSelection(b)}return k&&c.setMeta("composition",k),c.scrollIntoView()};if(x)if(u.pos==v.pos){y&&z<=11&&0==u.parentOffset&&(a.domObserver.suppressSelectionUpdates(),setTimeout(()=>aw(a),20));let b=D(a.state.tr.delete(A,B)),c=p.resolve(t.start).marksAcross(p.resolve(t.endA));c&&b.ensureMarks(c),a.dispatch(b)}else if(t.endA==t.endB&&(j=function(a,b){let c=a.firstChild.marks,d=b.firstChild.marks,f=c,g=d,h,i,j;for(let a=0;a<d.length;a++)f=d[a].removeFromSet(f);for(let a=0;a<c.length;a++)g=c[a].removeFromSet(g);if(1==f.length&&0==g.length)i=f[0],h="add",j=a=>a.mark(i.addToSet(a.marks));else{if(0!=f.length||1!=g.length)return null;i=g[0],h="remove",j=a=>a.mark(i.removeFromSet(a.marks))}let k=[];for(let a=0;a<b.childCount;a++)k.push(j(b.child(a)));if(e.FK.from(k).eq(a))return{mark:i,type:h}}(u.parent.content.cut(u.parentOffset,v.parentOffset),w.parent.content.cut(w.parentOffset,t.endA-w.start())))){let b=D(a.state.tr);"add"==j.type?b.addMark(A,B,j.mark):b.removeMark(A,B,j.mark),a.dispatch(b)}else if(u.parent.child(u.index()).isText&&u.index()==v.index()-!v.textOffset){let b=u.parent.textBetween(u.parentOffset,v.parentOffset),c=()=>D(a.state.tr.insertText(b,A,B));a.someProp("handleTextInput",d=>d(a,A,B,b,c))||a.dispatch(c())}else a.dispatch(D());else a.dispatch(D())})(this,a,b,c,f)),this.domObserver.start(),function(a){for(let b in a0){let c=a0[b];a.dom.addEventListener(b,a.input.eventHandlers[b]=b=>{!function(a,b){if(!b.bubbles)return!0;if(b.defaultPrevented)return!1;for(let c=b.target;c!=a.dom;c=c.parentNode)if(!c||11==c.nodeType||c.pmViewDesc&&c.pmViewDesc.stopEvent(b))return!1;return!0}(a,b)||a6(a,b)||!a.editable&&b.type in a1||c(a,b)},a2[b]?{passive:!0}:void 0)}E&&a.dom.addEventListener("input",()=>null),a5(a)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let a=this._props;for(let b in this._props={},a)this._props[b]=a[b];this._props.state=this.state}return this._props}update(a){a.handleDOMEvents!=this._props.handleDOMEvents&&a5(this);let b=this._props;this._props=a,a.plugins&&(a.plugins.forEach(bW),this.directPlugins=a.plugins),this.updateStateInner(a.state,b)}setProps(a){let b={};for(let a in this._props)b[a]=this._props[a];for(let c in b.state=this.state,a)b[c]=a[c];this.update(b)}updateState(a){this.updateStateInner(a,this._props)}updateStateInner(a,b){var c,d,e;let f=this.state,h=!1,i=!1;a.storedMarks&&this.composing&&(bf(this),i=!0),this.state=a;let j=f.plugins!=a.plugins||this._props.plugins!=b.plugins;if(j||this._props.plugins!=b.plugins||this._props.nodeViews!=b.nodeViews){let a=bV(this);(function(a,b){let c=0,d=0;for(let d in a){if(a[d]!=b[d])return!0;c++}for(let a in b)d++;return c!=d})(a,this.nodeViews)&&(this.nodeViews=a,h=!0)}(j||b.handleDOMEvents!=this._props.handleDOMEvents)&&a5(this),this.editable=bU(this),bT(this);let k=bE(this),m=bS(this),n=f.plugins==a.plugins||f.doc.eq(a.doc)?a.scrollToSelection>f.scrollToSelection?"to selection":"preserve":"reset",q=h||!this.docView.matchesNode(a.doc,m,k);(q||!a.selection.eq(f.selection))&&(i=!0);let r="preserve"==n&&i&&null==this.dom.style.overflowAnchor&&function(a){let b,c,d=a.dom.getBoundingClientRect(),e=Math.max(0,d.top);for(let f=(d.left+d.right)/2,g=e+1;g<Math.min(innerHeight,d.bottom);g+=5){let d=a.root.elementFromPoint(f,g);if(!d||d==a.dom||!a.dom.contains(d))continue;let h=d.getBoundingClientRect();if(h.top>=e-20){b=d,c=h.top;break}}return{refDOM:b,refTop:c,stack:N(a.dom)}}(this);if(i){let b,c,i;this.domObserver.stop();let j=q&&(y||C)&&!this.composing&&!f.selection.empty&&!a.selection.empty&&(d=f.selection,e=a.selection,i=Math.min(d.$anchor.sharedDepth(d.head),e.$anchor.sharedDepth(e.head)),d.$anchor.start(i)!=e.$anchor.start(i));if(q){let b=C?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(a){let b=a.domSelectionRange();if(!b.focusNode)return null;let c=function(a,b){for(;;){if(3==a.nodeType&&b)return a;if(1==a.nodeType&&b>0){if("false"==a.contentEditable)return null;b=o(a=a.childNodes[b-1])}else{if(!a.parentNode||p(a))return null;b=g(a),a=a.parentNode}}}(b.focusNode,b.focusOffset),d=function(a,b){for(;;){if(3==a.nodeType&&b<a.nodeValue.length)return a;if(1==a.nodeType&&b<a.childNodes.length){if("false"==a.contentEditable)return null;a=a.childNodes[b],b=0}else{if(!a.parentNode||p(a))return null;b=g(a)+1,a=a.parentNode}}}(b.focusNode,b.focusOffset);if(c&&d&&c!=d){let b=d.pmViewDesc,e=a.domObserver.lastChangedTextNode;if(c==e||d==e)return e;if(!b||!b.isText(d.nodeValue))return d;if(a.input.compositionNode==d){let a=c.pmViewDesc;if(!(!a||!a.isText(c.nodeValue)))return d}}return c||d}(this)),(h||!this.docView.update(a.doc,m,k,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=ag(a.doc,m,k,this.dom,this)),!b||this.trackWrites&&this.dom.contains(this.trackWrites)||(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(b=this.docView.domFromPos(this.state.selection.anchor,0),c=this.domSelectionRange(),l(b.node,b.offset,c.anchorNode,c.anchorOffset)))?aw(this,j):(aB(this,a.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(f),(null==(c=this.dragging)?void 0:c.node)&&!f.doc.eq(a.doc)&&this.updateDraggedNode(this.dragging,f),"reset"==n?this.dom.scrollTop=0:"to selection"==n?this.scrollToSelection():r&&function({refDOM:a,refTop:b,stack:c}){let d=a?a.getBoundingClientRect().top:0;O(c,0==d?0:d-b)}(r)}scrollToSelection(){let a=this.domSelectionRange().focusNode;if(a&&this.dom.contains(1==a.nodeType?a:a.parentNode))if(this.someProp("handleScrollToSelection",a=>a(this)));else if(this.state.selection instanceof d.nh){let b=this.docView.domAfterPos(this.state.selection.from);1==b.nodeType&&M(this,b.getBoundingClientRect(),a)}else M(this,this.coordsAtPos(this.state.selection.head,1),a)}destroyPluginViews(){let a;for(;a=this.pluginViews.pop();)a.destroy&&a.destroy()}updatePluginViews(a){if(a&&a.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let b=0;b<this.pluginViews.length;b++){let c=this.pluginViews[b];c.update&&c.update(this,a)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let a=0;a<this.directPlugins.length;a++){let b=this.directPlugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}for(let a=0;a<this.state.plugins.length;a++){let b=this.state.plugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}}}updateDraggedNode(a,b){let c=a.node,e=-1;if(this.state.doc.nodeAt(c.from)==c.node)e=c.from;else{let a=c.from+(this.state.doc.content.size-b.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==c.node&&(e=a)}this.dragging=new bk(a.slice,a.move,e<0?void 0:d.nh.create(this.state.doc,e))}someProp(a,b){let c=this._props&&this._props[a],d;if(null!=c&&(d=b?b(c):c))return d;for(let c=0;c<this.directPlugins.length;c++){let e=this.directPlugins[c].props[a];if(null!=e&&(d=b?b(e):e))return d}let e=this.state.plugins;if(e)for(let c=0;c<e.length;c++){let f=e[c].props[a];if(null!=f&&(d=b?b(f):f))return d}}hasFocus(){if(y){let a=this.root.activeElement;if(a==this.dom)return!0;if(!a||!this.dom.contains(a))return!1;for(;a&&this.dom!=a&&this.dom.contains(a);){if("false"==a.contentEditable)return!1;a=a.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(a){if(a.setActive)return a.setActive();if(P)return a.focus(P);let b=N(a);a.focus(null==P?{get preventScroll(){return P={preventScroll:!0},!0}}:void 0),P||(P=!1,O(b,0))}(this.dom),aw(this),this.domObserver.start()}get root(){let a=this._root;if(null==a){for(let a=this.dom.parentNode;a;a=a.parentNode)if(9==a.nodeType||11==a.nodeType&&a.host)return a.getSelection||(Object.getPrototypeOf(a).getSelection=()=>a.ownerDocument.getSelection()),this._root=a}return a||document}updateRoot(){this._root=null}posAtCoords(a){return function(a,b){var c;let d,e,f=a.dom.ownerDocument,g,i=0,k=function(a,b,c){if(a.caretPositionFromPoint)try{let d=a.caretPositionFromPoint(b,c);if(d)return{node:d.offsetNode,offset:Math.min(o(d.offsetNode),d.offset)}}catch(a){}if(a.caretRangeFromPoint){let d=a.caretRangeFromPoint(b,c);if(d)return{node:d.startContainer,offset:Math.min(o(d.startContainer),d.startOffset)}}}(f,b.left,b.top);k&&({node:g,offset:i}=k);let l=(a.root.elementFromPoint?a.root:f).elementFromPoint(b.left,b.top);if(!l||!a.dom.contains(1!=l.nodeType?l.parentNode:l)){let c=a.dom.getBoundingClientRect();if(!Q(b,c)||!(l=function a(b,c,d){let e=b.childNodes.length;if(e&&d.top<d.bottom)for(let f=Math.max(0,Math.min(e-1,Math.floor(e*(c.top-d.top)/(d.bottom-d.top))-2)),g=f;;){let d=b.childNodes[g];if(1==d.nodeType){let b=d.getClientRects();for(let e=0;e<b.length;e++){let f=b[e];if(Q(c,f))return a(d,c,f)}}if((g=(g+1)%e)==f)break}return b}(a.dom,b,c)))return null}if(E)for(let a=l;g&&a;a=h(a))a.draggable&&(g=void 0);if(l=(d=(c=l).parentNode)&&/^li$/i.test(d.nodeName)&&b.left<c.getBoundingClientRect().left?d:c,g){let c;if(A&&1==g.nodeType&&(i=Math.min(i,g.childNodes.length))<g.childNodes.length){let a=g.childNodes[i],c;"IMG"==a.nodeName&&(c=a.getBoundingClientRect()).right<=b.left&&c.bottom>b.top&&i++}J&&i&&1==g.nodeType&&1==(c=g.childNodes[i-1]).nodeType&&"false"==c.contentEditable&&c.getBoundingClientRect().top>=b.top&&i--,g==a.dom&&i==g.childNodes.length-1&&1==g.lastChild.nodeType&&b.top>g.lastChild.getBoundingClientRect().bottom?e=a.state.doc.content.size:(0==i||1!=g.nodeType||"BR"!=g.childNodes[i-1].nodeName)&&(e=function(a,b,c,d){let e=-1;for(let c=b,f=!1;c!=a.dom;){let b=a.docView.nearestDesc(c,!0),g;if(!b)return null;if(1==b.dom.nodeType&&(b.node.isBlock&&b.parent||!b.contentDOM)&&((g=b.dom.getBoundingClientRect()).width||g.height)&&(b.node.isBlock&&b.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(b.dom.nodeName)&&(!f&&g.left>d.left||g.top>d.top?e=b.posBefore:(!f&&g.right<d.left||g.bottom<d.top)&&(e=b.posAfter),f=!0),!b.contentDOM&&e<0&&!b.node.isText))return(b.node.isBlock?d.top<(g.top+g.bottom)/2:d.left<(g.left+g.right)/2)?b.posBefore:b.posAfter;c=b.dom.parentNode}return e>-1?e:a.docView.posFromDOM(b,c,-1)}(a,g,i,b))}null==e&&(e=function(a,b,c){let{node:d,offset:e}=function a(b,c){let d,e,f,g=2e8,h,i=0,k=c.top,l=c.top;for(let a=b.firstChild,m=0;a;a=a.nextSibling,m++){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a).getClientRects()}for(let j=0;j<b.length;j++){let n=b[j];if(n.top<=k&&n.bottom>=l){k=Math.max(n.bottom,k),l=Math.min(n.top,l);let b=n.left>c.left?n.left-c.left:n.right<c.left?c.left-n.right:0;if(b<g){f=a,g=b,h=b&&3==f.nodeType?{left:n.right<c.left?n.right:n.left,top:c.top}:c,1==a.nodeType&&b&&(i=m+ +(c.left>=(n.left+n.right)/2));continue}}else n.top>c.top&&!d&&n.left<=c.left&&n.right>=c.left&&(d=a,e={left:Math.max(n.left,Math.min(n.right,c.left)),top:n.top});!f&&(c.left>=n.right&&c.top>=n.top||c.left>=n.left&&c.top>=n.bottom)&&(i=m+1)}}return(!f&&d&&(f=d,h=e,g=0),f&&3==f.nodeType)?function(a,b){let c=a.nodeValue.length,d=document.createRange(),e;for(let f=0;f<c;f++){d.setEnd(a,f+1),d.setStart(a,f);let c=S(d,1);if(c.top!=c.bottom&&Q(b,c)){e={node:a,offset:f+ +(b.left>=(c.left+c.right)/2)};break}}return d.detach(),e||{node:a,offset:0}}(f,h):!f||g&&1==f.nodeType?{node:b,offset:i}:a(f,h)}(b,c),f=-1;if(1==d.nodeType&&!d.firstChild){let a=d.getBoundingClientRect();f=a.left!=a.right&&c.left>(a.left+a.right)/2?1:-1}return a.docView.posFromDOM(d,e,f)}(a,l,b));let m=a.docView.nearestDesc(l,!0);return{pos:e,inside:m?m.posAtStart-m.border:-1}}(this,a)}coordsAtPos(a,b=1){return U(this,a,b)}domAtPos(a,b=0){return this.docView.domFromPos(a,b)}nodeDOM(a){let b=this.docView.descAt(a);return b?b.nodeDOM:null}posAtDOM(a,b,c=-1){let d=this.docView.posFromDOM(a,b,c);if(null==d)throw RangeError("DOM position not inside the editor");return d}endOfTextblock(a,b){return function(a,b,c){let d,e;return Z==b&&_==c?aa:(Z=b,_=c,aa="up"==c||"down"==c?(d=b.selection,e="up"==c?d.$from:d.$to,X(a,b,()=>{let{node:b}=a.docView.domFromPos(e.pos,"up"==c?-1:1);for(;;){let c=a.docView.nearestDesc(b,!0);if(!c)break;if(c.node.isBlock){b=c.contentDOM||c.dom;break}b=c.dom.parentNode}let d=U(a,e.pos,1);for(let a=b.firstChild;a;a=a.nextSibling){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a,0,a.nodeValue.length).getClientRects()}for(let a=0;a<b.length;a++){let e=b[a];if(e.bottom>e.top+1&&("up"==c?d.top-e.top>(e.bottom-d.top)*2:e.bottom-d.bottom>(d.bottom-e.top)*2))return!1}}return!0})):function(a,b,c){let{$head:d}=b.selection;if(!d.parent.isTextblock)return!1;let e=d.parentOffset,f=e==d.parent.content.size,g=a.domSelection();return g?Y.test(d.parent.textContent)&&g.modify?X(a,b,()=>{let{focusNode:b,focusOffset:e,anchorNode:f,anchorOffset:h}=a.domSelectionRange(),i=g.caretBidiLevel;g.modify("move",c,"character");let j=d.depth?a.docView.domAfterPos(d.before()):a.dom,{focusNode:k,focusOffset:l}=a.domSelectionRange(),m=k&&!j.contains(1==k.nodeType?k:k.parentNode)||b==k&&e==l;try{g.collapse(f,h),b&&(b!=f||e!=h)&&g.extend&&g.extend(b,e)}catch(a){}return null!=i&&(g.caretBidiLevel=i),m}):"left"==c||"backward"==c?!e:f:d.pos==d.start()||d.pos==d.end()}(a,b,c))}(this,b||this.state,a)}pasteHTML(a,b){return bi(this,"",a,!1,b||new ClipboardEvent("paste"))}pasteText(a,b){return bi(this,a,null,!0,b||new ClipboardEvent("paste"))}serializeForClipboard(a){return aS(this,a)}destroy(){if(this.docView){for(let a in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(a,this.input.eventHandlers[a]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,k()}}get isDestroyed(){return null==this.docView}dispatchEvent(a){!a6(this,a)&&a0[a.type]&&(this.editable||!(a.type in a1))&&a0[a.type](this,a)}domSelectionRange(){let a=this.domSelection();return a?E&&11===this.root.nodeType&&function(a){let b=a.activeElement;for(;b&&b.shadowRoot;)b=b.shadowRoot.activeElement;return b}(this.dom.ownerDocument)==this.dom&&function(a,b){let c;if(b.getComposedRanges){let c=b.getComposedRanges(a.root)[0];if(c)return bL(a,c)}function d(a){a.preventDefault(),a.stopImmediatePropagation(),c=a.getTargetRanges()[0]}return a.dom.addEventListener("beforeinput",d,!0),document.execCommand("indent"),a.dom.removeEventListener("beforeinput",d,!0),c?bL(a,c):null}(this,a)||a:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function bS(a){let b=Object.create(null);return b.class="ProseMirror",b.contenteditable=String(a.editable),a.someProp("attributes",c=>{if("function"==typeof c&&(c=c(a.state)),c)for(let a in c)"class"==a?b.class+=" "+c[a]:"style"==a?b.style=(b.style?b.style+";":"")+c[a]:b[a]||"contenteditable"==a||"nodeName"==a||(b[a]=String(c[a]))}),b.translate||(b.translate="no"),[br.node(0,a.state.doc.content.size,b)]}function bT(a){if(a.markCursor){let b=document.createElement("img");b.className="ProseMirror-separator",b.setAttribute("mark-placeholder","true"),b.setAttribute("alt",""),a.cursorWrapper={dom:b,deco:br.widget(a.state.selection.from,b,{raw:!0,marks:a.markCursor})}}else a.cursorWrapper=null}function bU(a){return!a.someProp("editable",b=>!1===b(a.state))}function bV(a){let b=Object.create(null);function c(a){for(let c in a)Object.prototype.hasOwnProperty.call(b,c)||(b[c]=a[c])}return a.someProp("nodeViews",c),a.someProp("markViews",c),b}function bW(a){if(a.spec.state||a.spec.filterTransaction||a.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}bR.prototype.dispatch=function(a){let b=this._props.dispatchTransaction;b?b.call(this,a):this.updateState(this.state.apply(a))}},670016:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(789253);b.property=function(a){return function(b){return d.get(b,a)}}},673977:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(356103).Or},676029:(a,b,c)=>{"use strict";c.d(b,{q:()=>Y});var d=c(115962);function e(a){return Array.isArray?Array.isArray(a):"[object Array]"===l(a)}let f=1/0;function g(a){return"string"==typeof a}function h(a){return"number"==typeof a}function i(a){return"object"==typeof a}function j(a){return null!=a}function k(a){return!a.trim().length}function l(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":Object.prototype.toString.call(a)}let m=Object.prototype.hasOwnProperty;class n{constructor(a){this._keys=[],this._keyMap={};let b=0;a.forEach(a=>{let c=o(a);this._keys.push(c),this._keyMap[c.id]=c,b+=c.weight}),this._keys.forEach(a=>{a.weight/=b})}get(a){return this._keyMap[a]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function o(a){let b=null,c=null,d=null,f=1,h=null;if(g(a)||e(a))d=a,b=p(a),c=q(a);else{if(!m.call(a,"name"))throw Error("Missing name property in key");let e=a.name;if(d=e,m.call(a,"weight")&&(f=a.weight)<=0)throw Error(`Property 'weight' in key '${e}' must be a positive integer`);b=p(e),c=q(e),h=a.getFn}return{path:b,id:c,weight:f,src:d,getFn:h}}function p(a){return e(a)?a:a.split(".")}function q(a){return e(a)?a.join("."):a}var r={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(a,b)=>a.score===b.score?a.idx<b.idx?-1:1:a.score<b.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(a,b){let c=[],d=!1,k=(a,b,m)=>{if(j(a))if(b[m]){var n,o;let p=a[b[m]];if(!j(p))return;if(m===b.length-1&&(g(p)||h(p)||!0===(n=p)||!1===n||i(o=n)&&null!==o&&"[object Boolean]"==l(n)))c.push(null==p?"":function(a){if("string"==typeof a)return a;let b=a+"";return"0"==b&&1/a==-f?"-0":b}(p));else if(e(p)){d=!0;for(let a=0,c=p.length;a<c;a+=1)k(p[a],b,m+1)}else b.length&&k(p,b,m+1)}else c.push(a)};return k(a,g(b)?b.split("."):b,0),d?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};let s=/[^ ]+/g;class t{constructor({getFn:a=r.getFn,fieldNormWeight:b=r.fieldNormWeight}={}){this.norm=function(a=1,b=3){let c=new Map,d=Math.pow(10,b);return{get(b){let e=b.match(s).length;if(c.has(e))return c.get(e);let f=parseFloat(Math.round(1/Math.pow(e,.5*a)*d)/d);return c.set(e,f),f},clear(){c.clear()}}}(b,3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}setSources(a=[]){this.docs=a}setIndexRecords(a=[]){this.records=a}setKeys(a=[]){this.keys=a,this._keysMap={},a.forEach((a,b)=>{this._keysMap[a.id]=b})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((a,b)=>{this._addString(a,b)}):this.docs.forEach((a,b)=>{this._addObject(a,b)}),this.norm.clear())}add(a){let b=this.size();g(a)?this._addString(a,b):this._addObject(a,b)}removeAt(a){this.records.splice(a,1);for(let b=a,c=this.size();b<c;b+=1)this.records[b].i-=1}getValueForItemAtKeyId(a,b){return a[this._keysMap[b]]}size(){return this.records.length}_addString(a,b){if(!j(a)||k(a))return;let c={v:a,i:b,n:this.norm.get(a)};this.records.push(c)}_addObject(a,b){let c={i:b,$:{}};this.keys.forEach((b,d)=>{let f=b.getFn?b.getFn(a):this.getFn(a,b.path);if(j(f)){if(e(f)){let a=[],b=[{nestedArrIndex:-1,value:f}];for(;b.length;){let{nestedArrIndex:c,value:d}=b.pop();if(j(d))if(g(d)&&!k(d)){let b={v:d,i:c,n:this.norm.get(d)};a.push(b)}else e(d)&&d.forEach((a,c)=>{b.push({nestedArrIndex:c,value:a})})}c.$[d]=a}else if(g(f)&&!k(f)){let a={v:f,n:this.norm.get(f)};c.$[d]=a}}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function u(a,b,{getFn:c=r.getFn,fieldNormWeight:d=r.fieldNormWeight}={}){let e=new t({getFn:c,fieldNormWeight:d});return e.setKeys(a.map(o)),e.setSources(b),e.create(),e}function v(a,{errors:b=0,currentLocation:c=0,expectedLocation:d=0,distance:e=r.distance,ignoreLocation:f=r.ignoreLocation}={}){let g=b/a.length;if(f)return g;let h=Math.abs(d-c);return e?g+h/e:h?1:g}let w=String.prototype.normalize?a=>a.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):a=>a;class x{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){if(this.options={location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j},a=h?a:a.toLowerCase(),a=i?w(a):a,this.pattern=a,this.chunks=[],!this.pattern.length)return;let k=(a,b)=>{this.chunks.push({pattern:a,alphabet:function(a){let b={};for(let c=0,d=a.length;c<d;c+=1){let e=a.charAt(c);b[e]=(b[e]||0)|1<<d-c-1}return b}(a),startIndex:b})},l=this.pattern.length;if(l>32){let a=0,b=l%32,c=l-b;for(;a<c;)k(this.pattern.substr(a,32),a),a+=32;if(b){let a=l-32;k(this.pattern.substr(a),a)}}else k(this.pattern,0)}searchIn(a){let{isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d}=this.options;if(a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern===a){let b={isMatch:!0,score:0};return d&&(b.indices=[[0,a.length-1]]),b}let{location:e,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,ignoreLocation:j}=this.options,k=[],l=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:c,startIndex:n})=>{let{isMatch:o,score:p,indices:q}=function(a,b,c,{location:d=r.location,distance:e=r.distance,threshold:f=r.threshold,findAllMatches:g=r.findAllMatches,minMatchCharLength:h=r.minMatchCharLength,includeMatches:i=r.includeMatches,ignoreLocation:j=r.ignoreLocation}={}){let k;if(b.length>32)throw Error("Pattern length exceeds max of 32.");let l=b.length,m=a.length,n=Math.max(0,Math.min(d,m)),o=f,p=n,q=h>1||i,s=q?Array(m):[];for(;(k=a.indexOf(b,p))>-1;)if(o=Math.min(v(b,{currentLocation:k,expectedLocation:n,distance:e,ignoreLocation:j}),o),p=k+l,q){let a=0;for(;a<l;)s[k+a]=1,a+=1}p=-1;let t=[],u=1,w=l+m,x=1<<l-1;for(let d=0;d<l;d+=1){let f=0,h=w;for(;f<h;)v(b,{errors:d,currentLocation:n+h,expectedLocation:n,distance:e,ignoreLocation:j})<=o?f=h:w=h,h=Math.floor((w-f)/2+f);w=h;let i=Math.max(1,n-h+1),k=g?m:Math.min(n+h,m)+l,r=Array(k+2);r[k+1]=(1<<d)-1;for(let f=k;f>=i;f-=1){let g=f-1,h=c[a.charAt(g)];if(q&&(s[g]=+!!h),r[f]=(r[f+1]<<1|1)&h,d&&(r[f]|=(t[f+1]|t[f])<<1|1|t[f+1]),r[f]&x&&(u=v(b,{errors:d,currentLocation:g,expectedLocation:n,distance:e,ignoreLocation:j}))<=o){if(o=u,(p=g)<=n)break;i=Math.max(1,2*n-p)}}if(v(b,{errors:d+1,currentLocation:n,expectedLocation:n,distance:e,ignoreLocation:j})>o)break;t=r}let y={isMatch:p>=0,score:Math.max(.001,u)};if(q){let a=function(a=[],b=r.minMatchCharLength){let c=[],d=-1,e=-1,f=0;for(let g=a.length;f<g;f+=1){let g=a[f];g&&-1===d?d=f:g||-1===d||((e=f-1)-d+1>=b&&c.push([d,e]),d=-1)}return a[f-1]&&f-d>=b&&c.push([d,f-1]),c}(s,h);a.length?i&&(y.indices=a):y.isMatch=!1}return y}(a,b,c,{location:e+n,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,includeMatches:d,ignoreLocation:j});o&&(m=!0),l+=p,o&&q&&(k=[...k,...q])});let n={isMatch:m,score:m?l/this.chunks.length:1};return m&&d&&(n.indices=k),n}}class y{constructor(a){this.pattern=a}static isMultiMatch(a){return z(a,this.multiRegex)}static isSingleMatch(a){return z(a,this.singleRegex)}search(){}}function z(a,b){let c=a.match(b);return c?c[1]:null}class A extends y{constructor(a){super(a)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(a){let b=a===this.pattern;return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class B extends y{constructor(a){super(a)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(a){let b=-1===a.indexOf(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class C extends y{constructor(a){super(a)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(a){let b=a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class D extends y{constructor(a){super(a)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(a){let b=!a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class E extends y{constructor(a){super(a)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(a){let b=a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[a.length-this.pattern.length,a.length-1]}}}class F extends y{constructor(a){super(a)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(a){let b=!a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class G extends y{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){super(a),this._bitapSearch=new x(a,{location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(a){return this._bitapSearch.searchIn(a)}}class H extends y{constructor(a){super(a)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(a){let b,c=0,d=[],e=this.pattern.length;for(;(b=a.indexOf(this.pattern,c))>-1;)c=b+e,d.push([b,c-1]);let f=!!d.length;return{isMatch:f,score:+!f,indices:d}}}let I=[A,H,C,D,F,E,B,G],J=I.length,K=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,L=new Set([G.type,H.type]);class M{constructor(a,{isCaseSensitive:b=r.isCaseSensitive,ignoreDiacritics:c=r.ignoreDiacritics,includeMatches:d=r.includeMatches,minMatchCharLength:e=r.minMatchCharLength,ignoreLocation:f=r.ignoreLocation,findAllMatches:g=r.findAllMatches,location:h=r.location,threshold:i=r.threshold,distance:j=r.distance}={}){this.query=null,this.options={isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d,minMatchCharLength:e,findAllMatches:g,ignoreLocation:f,location:h,threshold:i,distance:j},a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern=a,this.query=function(a,b={}){return a.split("|").map(a=>{let c=a.trim().split(K).filter(a=>a&&!!a.trim()),d=[];for(let a=0,e=c.length;a<e;a+=1){let e=c[a],f=!1,g=-1;for(;!f&&++g<J;){let a=I[g],c=a.isMultiMatch(e);c&&(d.push(new a(c,b)),f=!0)}if(!f)for(g=-1;++g<J;){let a=I[g],c=a.isSingleMatch(e);if(c){d.push(new a(c,b));break}}}return d})}(this.pattern,this.options)}static condition(a,b){return b.useExtendedSearch}searchIn(a){let b=this.query;if(!b)return{isMatch:!1,score:1};let{includeMatches:c,isCaseSensitive:d,ignoreDiacritics:e}=this.options;a=d?a:a.toLowerCase(),a=e?w(a):a;let f=0,g=[],h=0;for(let d=0,e=b.length;d<e;d+=1){let e=b[d];g.length=0,f=0;for(let b=0,d=e.length;b<d;b+=1){let d=e[b],{isMatch:i,indices:j,score:k}=d.search(a);if(i){if(f+=1,h+=k,c){let a=d.constructor.type;L.has(a)?g=[...g,...j]:g.push(j)}}else{h=0,f=0,g.length=0;break}}if(f){let a={isMatch:!0,score:h/f};return c&&(a.indices=g),a}}return{isMatch:!1,score:1}}}let N=[];function O(a,b){for(let c=0,d=N.length;c<d;c+=1){let d=N[c];if(d.condition(a,b))return new d(a,b)}return new x(a,b)}let P={AND:"$and",OR:"$or"},Q={PATH:"$path",PATTERN:"$val"},R=a=>!!(a[P.AND]||a[P.OR]),S=a=>({[P.AND]:Object.keys(a).map(b=>({[b]:a[b]}))});function T(a,b,{auto:c=!0}={}){let d=a=>{let f=Object.keys(a),h=!!a[Q.PATH];if(!h&&f.length>1&&!R(a))return d(S(a));if(!e(a)&&i(a)&&!R(a)){let d=h?a[Q.PATH]:f[0],e=h?a[Q.PATTERN]:a[d];if(!g(e))throw Error(`Invalid value for key ${d}`);let i={keyId:q(d),pattern:e};return c&&(i.searcher=O(e,b)),i}let j={children:[],operator:f[0]};return f.forEach(b=>{let c=a[b];e(c)&&c.forEach(a=>{j.children.push(d(a))})}),j};return R(a)||(a=S(a)),d(a)}function U(a,b){let c=a.matches;b.matches=[],j(c)&&c.forEach(a=>{if(!j(a.indices)||!a.indices.length)return;let{indices:c,value:d}=a,e={indices:c,value:d};a.key&&(e.key=a.key.src),a.idx>-1&&(e.refIndex=a.idx),b.matches.push(e)})}function V(a,b){b.score=a.score}class W{constructor(a,b={},c){this.options={...r,...b},this.options.useExtendedSearch,this._keyStore=new n(this.options.keys),this.setCollection(a,c)}setCollection(a,b){if(this._docs=a,b&&!(b instanceof t))throw Error("Incorrect 'index' type");this._myIndex=b||u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(a){j(a)&&(this._docs.push(a),this._myIndex.add(a))}remove(a=()=>!1){let b=[];for(let c=0,d=this._docs.length;c<d;c+=1){let e=this._docs[c];a(e,c)&&(this.removeAt(c),c-=1,d-=1,b.push(e))}return b}removeAt(a){this._docs.splice(a,1),this._myIndex.removeAt(a)}getIndex(){return this._myIndex}search(a,{limit:b=-1}={}){let{includeMatches:c,includeScore:d,shouldSort:e,sortFn:f,ignoreFieldNorm:i}=this.options,j=g(a)?g(this._docs[0])?this._searchStringList(a):this._searchObjectList(a):this._searchLogical(a);return!function(a,{ignoreFieldNorm:b=r.ignoreFieldNorm}){a.forEach(a=>{let c=1;a.matches.forEach(({key:a,norm:d,score:e})=>{let f=a?a.weight:null;c*=Math.pow(0===e&&f?Number.EPSILON:e,(f||1)*(b?1:d))}),a.score=c})}(j,{ignoreFieldNorm:i}),e&&j.sort(f),h(b)&&b>-1&&(j=j.slice(0,b)),function(a,b,{includeMatches:c=r.includeMatches,includeScore:d=r.includeScore}={}){let e=[];return c&&e.push(U),d&&e.push(V),a.map(a=>{let{idx:c}=a,d={item:b[c],refIndex:c};return e.length&&e.forEach(b=>{b(a,d)}),d})}(j,this._docs,{includeMatches:c,includeScore:d})}_searchStringList(a){let b=O(a,this.options),{records:c}=this._myIndex,d=[];return c.forEach(({v:a,i:c,n:e})=>{if(!j(a))return;let{isMatch:f,score:g,indices:h}=b.searchIn(a);f&&d.push({item:a,idx:c,matches:[{score:g,value:a,norm:e,indices:h}]})}),d}_searchLogical(a){let b=T(a,this.options),c=(a,b,d)=>{if(!a.children){let{keyId:c,searcher:e}=a,f=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(b,c),searcher:e});return f&&f.length?[{idx:d,item:b,matches:f}]:[]}let e=[];for(let f=0,g=a.children.length;f<g;f+=1){let g=c(a.children[f],b,d);if(g.length)e.push(...g);else if(a.operator===P.AND)return[]}return e},d=this._myIndex.records,e={},f=[];return d.forEach(({$:a,i:d})=>{if(j(a)){let g=c(b,a,d);g.length&&(e[d]||(e[d]={idx:d,item:a,matches:[]},f.push(e[d])),g.forEach(({matches:a})=>{e[d].matches.push(...a)}))}}),f}_searchObjectList(a){let b=O(a,this.options),{keys:c,records:d}=this._myIndex,e=[];return d.forEach(({$:a,i:d})=>{if(!j(a))return;let f=[];c.forEach((c,d)=>{f.push(...this._findMatches({key:c,value:a[d],searcher:b}))}),f.length&&e.push({idx:d,item:a,matches:f})}),e}_findMatches({key:a,value:b,searcher:c}){if(!j(b))return[];let d=[];if(e(b))b.forEach(({v:b,i:e,n:f})=>{if(!j(b))return;let{isMatch:g,score:h,indices:i}=c.searchIn(b);g&&d.push({score:h,key:a,value:b,idx:e,norm:f,indices:i})});else{let{v:e,n:f}=b,{isMatch:g,score:h,indices:i}=c.searchIn(e);g&&d.push({score:h,key:a,value:e,norm:f,indices:i})}return d}}W.version="7.1.0",W.createIndex=u,W.parseIndex=function(a,{getFn:b=r.getFn,fieldNormWeight:c=r.fieldNormWeight}={}){let{keys:d,records:e}=a,f=new t({getFn:b,fieldNormWeight:c});return f.setKeys(d),f.setIndexRecords(e),f},W.config=r,W.parseQuery=T,function(...a){N.push(...a)}(M);let X={keys:[{name:"label",weight:3},{name:"sublabel",weight:1},{name:"objectName",weight:1.5},{name:"fieldValues",weight:2}],threshold:.4,distance:200,includeScore:!0,shouldSort:!0,minMatchCharLength:1};function Y(a){let[b,c]=(0,d.useState)([]),[e,f]=(0,d.useState)(!0),g=(0,d.useRef)(!0);(0,d.useCallback)(async()=>{try{let a=await fetch("/api/workspace/search-index"),b=await a.json();g.current&&(c(b.items??[]),f(!1))}catch{g.current&&f(!1)}},[]);let h=(0,d.useMemo)(()=>0===b.length?null:new W(b.map(a=>({...a,fieldValues:a.fields?Object.values(a.fields).join(" "):void 0})),X),[b]),i=(0,d.useCallback)((a,c=20)=>a.trim()?h?h.search(a,{limit:c}).map(a=>a.item):[]:[...b].toSorted((a,b)=>{let c={object:0,file:1,entry:2};return(c[a.kind]??9)-(c[b.kind]??9)}).slice(0,c),[h,b]),j=(0,d.useRef)(i);return j.current=i,{items:b,loading:e,search:(0,d.useCallback)((a,b)=>j.current(a,b),[])}}},681560:(a,b,c)=>{"use strict";c.d(b,{I:()=>n});var d=c(736927),e=c(115962),f=c(681713),g=c(612563),h=c(379924),i=c(18886),j=c(130526);function k(a){return null==a?"":"string"==typeof a?a:"number"==typeof a||"boolean"==typeof a||"bigint"==typeof a?String(a):"object"==typeof a?JSON.stringify(a):""}function l({entry:a,fields:b,titleField:c,coverField:l,onEntryClick:m}){let n=k(a.entry_id??a.id),o=function(a,b,c){if(c){let b=k(a[c]);if(b)return b}let d=b.find(a=>"text"===a.type&&/name|title/i.test(a.name))??b.find(a=>"text"===a.type);return d?k(a[d.name]):k(a.id)}(a,b,c),p=(0,j.I)(a,b),q=(0,e.useMemo)(()=>b.filter(a=>a.name!==c&&a.name!==l).slice(0,4),[b,c,l]),r=b.find(a=>"enum"===a.type&&a.enum_values?.length),s=r?k(a[r.name]):null,t=r&&s?function(a,b){if(!a||!b.enum_values)return null;let c=b.enum_values.indexOf(a);return{text:a,color:c>=0&&b.enum_colors?.[c]?b.enum_colors[c]:"#94a3b8"}}(s,r):null;return(0,d.jsxs)("button",{type:"button",onClick:()=>m?.(n),className:"text-left rounded-xl border p-4 hover:shadow-md transition-all cursor-pointer w-full group",style:{borderColor:"var(--color-border)",background:"var(--color-surface)"},children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p?.faviconUrl&&(0,d.jsx)(i.A,{src:p.faviconUrl,className:"w-4 h-4 rounded-[4px] shrink-0 mt-0.5"}),(0,d.jsx)("h4",{className:"text-[13px] font-semibold leading-tight line-clamp-2 group-hover:underline",style:{color:"var(--color-text)"},children:o||"Untitled"})]}),t&&(0,d.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full flex-shrink-0 whitespace-nowrap",style:{backgroundColor:t.color,color:"#fff"},children:t.text})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:q.map(b=>{let c=a[b.name];if(null==c||""===k(c))return null;let e="tags"===b.type?(0,h.k)(c):[];return(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[10px] flex-shrink-0 min-w-[60px]",style:{color:"var(--color-text-muted)"},children:b.name}),(0,d.jsx)("div",{className:"text-[12px] whitespace-pre-line line-clamp-2",style:{color:"var(--color-text)"},children:"tags"===b.type?(0,d.jsxs)("span",{className:"flex items-center gap-0.5 flex-wrap",children:[e.slice(0,3).map(a=>{let b=(0,g.KJ)(a),c="link"===b.kind&&b.href,e="url"===b.linkType&&!!b.faviconUrl;return c?(0,d.jsxs)("a",{href:b.href,target:"url"===b.linkType||"file"===b.linkType?"_blank":void 0,rel:"url"===b.linkType||"file"===b.linkType?"noopener noreferrer":void 0,onClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 px-1.5 py-0 rounded text-[11px] font-medium hover:underline underline-offset-2 max-w-[220px]",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-accent)"},children:[e&&(0,d.jsx)(i.A,{src:b.faviconUrl,className:"w-3 h-3 rounded-[2px] shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:b.text})]},a):(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0 rounded text-[11px] font-medium",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-text-muted)"},children:a},a)}),e.length>3&&(0,d.jsxs)("span",{className:"text-[10px]",style:{color:"var(--color-text-muted)"},children:["+",e.length-3]})]}):(0,d.jsx)(f.E,{value:c,fieldType:b.type,mode:"table",showUrlFavicon:!0})})]},b.id)})}),null!=a.created_at&&(0,d.jsx)("div",{className:"mt-3 text-[10px]",style:{color:"var(--color-text-muted)",opacity:.6},children:k(a.created_at).slice(0,10)})]})}function m(){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-2",children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--color-text-muted)",opacity:.4},children:[(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"})]}),(0,d.jsx)("span",{className:"text-sm",style:{color:"var(--color-text-muted)"},children:"No entries to display in gallery view."})]})}function n({objectName:a,fields:b,entries:c,titleField:e,coverField:f,members:g,relationLabels:h,onEntryClick:i}){return 0===c.length?(0,d.jsx)(m,{}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:c.map(a=>(0,d.jsx)(l,{entry:a,fields:b,titleField:e,coverField:f,onEntryClick:i},k(a.entry_id??a.id)))})}},681713:(a,b,c)=>{"use strict";c.d(b,{E:()=>m});var d=c(736927),e=c(115962),f=c(612563),g=c(18886),h=c(545182),i=c(888973);function j(){return(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:"--"})}function k({mediaType:a,url:b,label:c}){return"image"===a?(0,d.jsx)("div",{className:"mt-2 rounded-lg overflow-hidden border",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("img",{src:b,alt:c,className:"max-h-64 w-auto"})}):"video"===a?(0,d.jsx)("video",{src:b,controls:!0,className:"mt-2 w-full max-h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"#000"}}):"audio"===a?(0,d.jsx)("audio",{src:b,controls:!0,className:"mt-2 w-full"}):(0,d.jsx)("iframe",{src:`${b}#toolbar=0&navpanes=0&scrollbar=1`,title:c,className:"mt-2 w-full h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"white"}})}function l({text:a,fieldType:b,showUrlFavicon:c=!1,linkInteractionMode:e="inline",isTableMode:j=!1}){let k=a.trim();if(!k)return(0,d.jsx)(d.Fragment,{children:a});let l=b&&"text"!==b&&"richtext"!==b?b:void 0,m=(0,f.KJ)(k,l);if("link"===m.kind&&m.href){if(!l&&"file"===m.linkType&&k.includes(" "))return(0,d.jsx)(d.Fragment,{children:m.text});let a="url"===m.linkType||"file"===m.linkType,b=c&&"url"===m.linkType&&!!m.faviconUrl;if("button"===e){let c=(0,d.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",style:{color:"var(--color-accent)"},children:[b&&(0,d.jsx)(g.A,{src:m.faviconUrl}),(0,d.jsx)("span",{className:j?"min-w-0 truncate":"min-w-0 break-all",children:m.text}),(0,d.jsx)(h.x,{href:m.href,openInNewTab:a,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-black/5"})]});return"url"===m.linkType?(0,d.jsx)(i.k,{href:m.href,children:c}):c}return(0,d.jsx)(i.U,{href:m.href,text:m.text,linkType:m.linkType??"url",faviconUrl:m.faviconUrl,showFavicon:b})}return"number"===m.kind||"currency"===m.kind?(0,d.jsx)("span",{className:"tabular-nums",children:m.text}):(0,d.jsx)(d.Fragment,{children:m.text})}function m({value:a,fieldType:b,mode:c="table",className:m,showUrlFavicon:n=!1,linkInteractionMode:o="inline"}){let p=(0,f.KJ)(a,b),q="table"===c;if("empty"===p.kind)return(0,d.jsx)(j,{});let r=p.text.replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n").replace(/\\r/g,"\n");if(r.includes("\n")){let a=r.split("\n"),c=m??(q?"block max-w-[300px] line-clamp-3":"break-words");return(0,d.jsx)("span",{className:c,children:a.map((a,c)=>(0,d.jsxs)(e.Fragment,{children:[c>0&&(0,d.jsx)("br",{}),(0,d.jsx)(l,{text:a,fieldType:b,showUrlFavicon:n,linkInteractionMode:o,isTableMode:q})]},c))})}let s=m??(q?"truncate block max-w-[300px]":"break-words");if("link"===p.kind&&p.href){let a="url"===p.linkType||"file"===p.linkType,b=!q&&!!p.embedUrl&&!!p.mediaType,c=n&&"url"===p.linkType&&!!p.faviconUrl;if("button"===o){let e=(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",style:{color:"var(--color-accent)"},children:[c&&(0,d.jsx)(g.A,{src:p.faviconUrl}),(0,d.jsx)("span",{className:q?"min-w-0 truncate":"min-w-0 break-all",children:p.text}),(0,d.jsx)(h.x,{href:p.href,openInNewTab:a})]}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]});return"url"===p.linkType?(0,d.jsx)(i.k,{href:p.href,children:e}):e}return(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsx)(i.U,{href:p.href,text:p.text,linkType:p.linkType??"url",faviconUrl:p.faviconUrl,showFavicon:c,layout:"block",className:q?"truncate":""}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]})}return"number"===p.kind||"currency"===p.kind?(0,d.jsx)("span",{className:`tabular-nums ${s}`,children:p.text}):(0,d.jsx)("span",{className:s,children:r})}},685233:(a,b,c)=>{"use strict";c.d(b,{X:()=>a6,S:()=>a7});var d=c(736927),e=c(115962),f=c(213505),g=c(492081),h=c(755726),i=c(922123),j=c(478105),k=c(363269),l=c(515016),m=c(558287),n=c(631608),o=c(846069),p=c(744277),q=c(68200),r=c(316780),s=c(398367),t=c(405287),u=c(587464),v=c(173961),w=c(760687),x=c(840512);let y=e.createContext(void 0),z=e.createContext(void 0),A=e.createContext(void 0),B=e.createContext("");function C(){let a=e.useContext(y);if(!a)throw Error((0,x.A)(22));return a}function D(){let a=e.useContext(z);if(!a)throw Error((0,x.A)(23));return a}function E(){let a=e.useContext(A);if(!a)throw Error((0,x.A)(24));return a}var F=c(569869);let G=(a,b)=>Object.is(a,b);function H(a,b,c){return null==a||null==b?Object.is(a,b):c(a,b)}function I(a,b,c){return a&&0!==a.length?a.findIndex(a=>void 0!==a&&H(a,b,c)):-1}function J(a){if(null==a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function K(a){return null!=a&&a.length>0&&"object"==typeof a[0]&&null!=a[0]&&"items"in a[0]}function L(a,b){if(b&&null!=a)return b(a)??"";if(a&&"object"==typeof a){if("label"in a&&null!=a.label)return String(a.label);if("value"in a)return String(a.value)}return J(a)}function M(a,b){return b&&null!=a?b(a)??"":a&&"object"==typeof a&&"value"in a&&"label"in a?J(a.value):J(a)}let N={id:(0,F.M)(a=>a.id),query:(0,F.M)(a=>a.query),items:(0,F.M)(a=>a.items),selectedValue:(0,F.M)(a=>a.selectedValue),hasSelectionChips:(0,F.M)(a=>{let b=a.selectedValue;return Array.isArray(b)&&b.length>0}),hasSelectedValue:(0,F.M)(a=>{let{selectedValue:b,selectionMode:c}=a;return null!=b&&(!("multiple"===c&&Array.isArray(b))||b.length>0)}),hasNullItemLabel:(0,F.M)((a,b)=>!!b&&function(a){if(!Array.isArray(a))return null!=a&&!("null"in a);if(K(a)){for(let b of a)for(let a of b.items)if(a&&null==a.value&&null!=a.label)return!0;return!1}for(let b of a)if(b&&null==b.value&&null!=b.label)return!0;return!1}(a.items)),open:(0,F.M)(a=>a.open),mounted:(0,F.M)(a=>a.mounted),forceMounted:(0,F.M)(a=>a.forceMounted),inline:(0,F.M)(a=>a.inline),activeIndex:(0,F.M)(a=>a.activeIndex),selectedIndex:(0,F.M)(a=>a.selectedIndex),isActive:(0,F.M)((a,b)=>a.activeIndex===b),isSelected:(0,F.M)((a,b)=>{let c=a.isItemEqualToValue,d=a.selectedValue;return Array.isArray(d)?d.some(a=>H(b,a,c)):H(b,d,c)}),transitionStatus:(0,F.M)(a=>a.transitionStatus),popupProps:(0,F.M)(a=>a.popupProps),inputProps:(0,F.M)(a=>a.inputProps),triggerProps:(0,F.M)(a=>a.triggerProps),getItemProps:(0,F.M)(a=>a.getItemProps),positionerElement:(0,F.M)(a=>a.positionerElement),listElement:(0,F.M)(a=>a.listElement),triggerElement:(0,F.M)(a=>a.triggerElement),inputElement:(0,F.M)(a=>a.inputElement),popupSide:(0,F.M)(a=>a.popupSide),openMethod:(0,F.M)(a=>a.openMethod),inputInsidePopup:(0,F.M)(a=>a.inputInsidePopup),selectionMode:(0,F.M)(a=>a.selectionMode),listRef:(0,F.M)(a=>a.listRef),labelsRef:(0,F.M)(a=>a.labelsRef),popupRef:(0,F.M)(a=>a.popupRef),emptyRef:(0,F.M)(a=>a.emptyRef),inputRef:(0,F.M)(a=>a.inputRef),keyboardActiveRef:(0,F.M)(a=>a.keyboardActiveRef),chipsContainerRef:(0,F.M)(a=>a.chipsContainerRef),clearRef:(0,F.M)(a=>a.clearRef),valuesRef:(0,F.M)(a=>a.valuesRef),allValuesRef:(0,F.M)(a=>a.allValuesRef),name:(0,F.M)(a=>a.name),disabled:(0,F.M)(a=>a.disabled),readOnly:(0,F.M)(a=>a.readOnly),required:(0,F.M)(a=>a.required),grid:(0,F.M)(a=>a.grid),isGrouped:(0,F.M)(a=>a.isGrouped),virtualized:(0,F.M)(a=>a.virtualized),onOpenChangeComplete:(0,F.M)(a=>a.onOpenChangeComplete),openOnInputClick:(0,F.M)(a=>a.openOnInputClick),itemToStringLabel:(0,F.M)(a=>a.itemToStringLabel),isItemEqualToValue:(0,F.M)(a=>a.isItemEqualToValue),modal:(0,F.M)(a=>a.modal),autoHighlight:(0,F.M)(a=>a.autoHighlight),submitOnItemClick:(0,F.M)(a=>a.submitOnItemClick)};var O=c(230652),P=c(577225);let Q=function(a){return a.disabled="data-disabled",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a}({}),R=e.createContext({invalid:void 0,name:void 0,validityData:{state:{badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},errors:[],error:"",value:"",initialValue:null},setValidityData:P.tE,disabled:void 0,touched:!1,setTouched:P.tE,dirty:!1,setDirty:P.tE,filled:!1,setFilled:P.tE,focused:!1,setFocused:P.tE,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(a=P.t0)=>a,getInputValidationProps:(a=P.t0)=>a,inputRef:{current:null},commit:async()=>{}}});function S(a=!0){let b=e.useContext(R);if(b.setValidityData===P.tE&&!a)throw Error((0,x.A)(28));return b}var T=c(249855);let U=e.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:P.tE,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function V(){return e.useContext(U)}var W=c(725427),X=c(840507);let Y=e.createContext({controlId:void 0,registerControlId:P.tE,labelId:void 0,setLabelId:P.tE,messageIds:[],setMessageIds:P.tE,getDescriptionProps:a=>a});function Z(){return e.useContext(Y)}let _=new Map;var aa=c(735328),ab=c(192083);function ac(a,b){let c=e.useRef(a),d=(0,i.K)(b);(0,g.g)(()=>{c.current!==a&&d(c.current)},[a,d]),(0,g.g)(()=>{c.current=a},[a])}let ad=Symbol("none"),ae={value:ad,index:-1};function af(a){let b,c,x,{id:C,onOpenChangeComplete:D,defaultSelectedValue:E=null,selectedValue:F,onSelectedValueChange:J,defaultInputValue:Q,inputValue:R,selectionMode:U="none",onItemHighlighted:Y,name:af,disabled:ag=!1,readOnly:ah=!1,required:ai=!1,inputRef:aj,grid:ak=!1,items:al,filteredItems:am,filter:an,openOnInputClick:ao=!0,autoHighlight:ap=!1,keepHighlight:aq=!1,highlightItemOnHover:ar=!0,loopFocus:as=!0,itemToStringLabel:at,itemToStringValue:au,isItemEqualToValue:av=G,virtualized:aw=!1,inline:ax=!1,fillInputOnItemPress:ay=!0,modal:az=!1,limit:aA=-1,autoComplete:aB="list",formAutoComplete:aC,locale:aD,submitOnItemClick:aE=!1}=a,{clearErrors:aF}=V(),{setDirty:aG,validityData:aH,shouldValidateOnChange:aI,setFilled:aJ,name:aK,disabled:aL,setTouched:aM,setFocused:aN,validationMode:aO,validation:aP}=S(),aQ=function(a={}){let{id:b,implicit:c=!1,controlRef:d}=a,{controlId:f,registerControlId:h}=Z(),j=(0,X.e)(b),k=c?f:void 0,m=(0,l.j)(()=>Symbol("labelable-control")),n=e.useRef(!1),o=e.useRef(null!=b),p=(0,i.K)(()=>{n.current&&h!==P.tE&&(n.current=!1,h(m.current,void 0))});return(0,g.g)(()=>{let a;if(h!==P.tE){if(c){let c=d?.current;a=(0,W.vq)(c)&&null!=c.closest("label")?b??null:k??j}else if(null!=b)o.current=!0,a=b;else{if(!o.current)return void p();a=j}if(void 0===a)return void p();n.current=!0,h(m.current,a)}},[b,d,k,h,c,j,m,p]),e.useEffect(()=>p,[p]),f??j}({id:C}),aR=function(a={}){let b={usage:"search",sensitivity:"base",ignorePunctuation:!0,...a},c=`${function a(b){return Array.isArray(b)?b.map(b=>a(b)).join(","):null==b?"":String(b)}(a.locale)}|${JSON.stringify(b)}`,d=_.get(c);if(d)return d;let e=new Intl.Collator(a.locale,b),f={contains(a,b,c){if(!b)return!0;let d=L(a,c);for(let a=0;a<=d.length-b.length;a+=1)if(0===e.compare(d.slice(a,a+b.length),b))return!0;return!1},startsWith(a,b,c){if(!b)return!0;let d=L(a,c);return 0===e.compare(d.slice(0,b.length),b)},endsWith(a,b,c){if(!b)return!0;let d=L(a,c),f=b.length;return d.length>=f&&0===e.compare(d.slice(d.length-f),b)}};return _.set(c,f),f}({locale:aD}),[aS,aT]=e.useState(!1),[aU,aV]=e.useState(null),aW=e.useRef([]),aX=e.useRef([]),aY=e.useRef(null),aZ=e.useRef(null),a$=e.useRef(null),a_=e.useRef(!0),a0=e.useRef(!1),a1=e.useRef(null),a2=e.useRef(null),a3=e.useRef(null),a4=e.useRef(ae),a5=e.useRef(null),a6=e.useRef([]),a7=e.useRef([]),a8=aL||ag,a9=aK??af,ba="multiple"===U,bb="single"===U,bc=void 0!==R||void 0!==Q,bd=void 0!==al,be=void 0!==am;b="always"===ap?"always":!!ap&&"input-change";let[bf,bg]=(0,f.q)({controlled:F,default:ba?E??P.Ml:E,name:"Combobox",state:"selectedValue"}),bh=e.useMemo(()=>null===an?()=>!0:void 0!==an?an:bb&&!aS?(a,b)=>{if(null==a)return!1;if(!b)return!0;let c=L(a,at),d=null!=bf?L(bf,at):"";return!!(d&&aR.contains(d,b))&&d.length===b.length||aR.contains(c,b)}:(a,b)=>{if(null==a)return!1;let c=L(a,at);return aR.contains(c,b)},[an,bb,bf,aS,aR,at]),bi=(0,l.j)(()=>bc?Q??"":bb?L(bf,at):"").current,[bj,bk]=(0,f.q)({controlled:R,default:bi,name:"Combobox",state:"inputValue"}),[bl,bm]=(0,f.q)({controlled:a.open,default:a.defaultOpen,name:"Combobox",state:"open"}),bn=K(al),bo=aU??(""===bj?"":String(bj).trim()),bp=bb?L(bf,at):"",bq=bb&&!aS&&""!==bo&&""!==bp&&bp.length===bo.length&&aR.contains(bp,bo),br=bq?"":bo,bs=bd&&be&&bq,bt=e.useMemo(()=>al?bn?al.flatMap(a=>a.items):al:P.Ml,[al,bn]),bu=e.useMemo(()=>{if(am&&!bs)return am;if(!al)return P.Ml;if(bn){let a=[],b=0;for(let c of al){if(aA>-1&&b>=aA)break;let d=""===br?c.items:c.items.filter(a=>bh(a,br,at));if(0===d.length)continue;let e=aA>-1?aA-b:1/0,f=d.slice(0,e);if(f.length>0){let d={...c,items:f};a.push(d),b+=f.length}}return a}if(""===br)return aA>-1?bt.slice(0,aA):bt;let a=[];for(let b of bt){if(aA>-1&&a.length>=aA)break;bh(b,br,at)&&a.push(b)}return a},[am,bs,al,bn,br,aA,bh,at,bt]),bv=e.useMemo(()=>bn?bu.flatMap(a=>a.items):bu,[bu,bn]),bw=(0,l.j)(()=>new m.i({id:aQ,selectedValue:bf,open:bl,filter:bh,query:bo,items:al,selectionMode:U,listRef:aW,labelsRef:aX,popupRef:aY,emptyRef:a$,inputRef:aZ,keyboardActiveRef:a_,chipsContainerRef:a1,clearRef:a2,valuesRef:a6,allValuesRef:a7,selectionEventRef:a3,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,openOnInputClick:ao,itemToStringLabel:at,isItemEqualToValue:av,modal:az,autoHighlight:b,submitOnItemClick:aE,hasInputValue:bc,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:ax,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:D||P.tE,setOpen:P.tE,setInputValue:P.tE,setSelectedValue:P.tE,setIndices:P.tE,onItemHighlighted:P.tE,handleSelection:P.tE,getItemProps:()=>P.t0,forceMount:P.tE,requestSubmit:P.tE})).current,bx="none"===U?bj:bf,by=e.useMemo(()=>"none"===U?bx:Array.isArray(bf)?bf.map(a=>M(a,au)):M(bf,au),[bx,au,U,bf]),bz=(0,i.K)(Y),bA=(0,i.K)(D),bB=(0,n.P)(bw,N.activeIndex),bC=(0,n.P)(bw,N.selectedIndex),bD=(0,n.P)(bw,N.positionerElement),bE=(0,n.P)(bw,N.listElement),bF=(0,n.P)(bw,N.triggerElement),bG=(0,n.P)(bw,N.inputElement),bH=(0,n.P)(bw,N.inline),bI=(0,n.P)(bw,N.inputInsidePopup),bJ=(0,o.u)(bF),{mounted:bK,setMounted:bL,transitionStatus:bM}=(0,aa.$)(bl),{openMethod:bN,triggerProps:bO,reset:bP}=(0,ab.G)(bl);!function(a){let{enabled:b=!0,value:c,id:d,name:e,controlRef:f,commit:h}=a,{formRef:j}=V(),{invalid:k,markedDirtyRef:l,validityData:m,setValidityData:n}=S(),o=(0,i.K)(a.getValue);(0,g.g)(()=>{if(!b)return;let a=c;void 0===a&&(a=o()),null===m.initialValue&&null!==a&&n(b=>({...b,initialValue:a}))},[b,n,c,m.initialValue,o]),(0,g.g)(()=>{b&&d&&j.current.fields.set(d,{getValue:o,name:e,controlRef:f,validityData:{...m,state:{...m.state,valid:!k&&m.state.valid}},validate(a=!0){let b=c;void 0===b&&(b=o()),l.current=!0,a?T.flushSync(()=>h(b)):h(b)}})},[h,f,b,j,o,d,k,l,e,m,c]),(0,g.g)(()=>{let a=j.current.fields;return()=>{d&&a.delete(d)}},[j,d])}({id:aQ,name:a9,commit:aP.commit,value:bx,controlRef:bI?bJ:aZ,getValue:()=>by});let bQ=(0,i.K)(()=>{al?aX.current=bv.map(a=>L(a,at)):bw.set("forceMounted",!0)}),bR=e.useRef(bf);(0,g.g)(()=>{bf!==bR.current&&bQ()},[bQ,bf]);let bS=(0,i.K)(a=>{bw.update(a);let b=a.type||"none";if(void 0!==a.activeIndex)if(null===a.activeIndex)a4.current!==ae&&(a4.current=ae,bz(void 0,(0,v.M)(b,void 0,{index:-1})));else{let c=a6.current[a.activeIndex];a4.current={value:c,index:a.activeIndex},bz(c,(0,v.M)(b,void 0,{index:a.activeIndex}))}}),bT=(0,i.K)((c,d)=>{if(a0.current=d.reason===w.qs,a.onInputValueChange?.(c,d),!d.isCanceled){if(d.reason===w.pf){let a=d.event,e=a.inputType;if("compositionend"===a.type||null!=e&&""!==e&&"insertReplacementText"!==e){let a=""!==c.trim();a&&aT(!0),a5.current={hasQuery:a},a&&b&&null==bw.state.activeIndex&&bw.set("activeIndex",0)}}bk(c)}}),bU=(0,i.K)((b,c)=>{if(bl!==b&&("escape-key"===c.reason&&bd&&0===bv.length&&!bw.state.emptyRef.current&&c.allowPropagation(),a.onOpenChange?.(b,c),!c.isCanceled&&(!b&&aS&&(bb?(bH||aV(bo),""===bo&&aT(!1)):ba&&(bH||bI?bS({activeIndex:null}):aV(bo),bT("",(0,v.d)(w.qs,c.event)))),bm(b),!b&&bI&&(c.reason===w.Xn||c.reason===w.Np))&&(aM(!0),aN(!1),"onBlur"===aO))){let a="none"===U?bj:bf;aP.commit(a)}}),bV=(0,i.K)((a,b)=>{J?.(a,b),!b.isCanceled&&(bg(a),("none"===U&&aY.current&&ay||bb&&!bw.state.inputInsidePopup)&&bT(L(a,at),(0,v.d)(b.reason,b.event)),bb&&null!=a&&b.reason!==w.pf&&aS&&!bH&&aV(bo))}),bW=(0,i.K)((a,b)=>{let c=b;if(void 0===c){if(null===bB)return;c=a6.current[bB]}let d=(0,u.EW)(a),e=a3.current??a;a3.current=null;let f=(0,v.d)(w.Bo,e),g=d?.closest("a")?.getAttribute("href");if(g){g.startsWith("#")&&bU(!1,f);return}if(ba){var h,i,j,k;let a=Array.isArray(bf)?bf:[];if(bV((h=c,i=bw.state.isItemEqualToValue,a&&0!==a.length&&a.some(a=>void 0!==a&&H(h,a,i)))?(j=c,k=bw.state.isItemEqualToValue,a.filter(a=>!H(j,a,k))):[...a,c],f),!(aZ.current&&""!==aZ.current.value.trim()))return;bw.state.inputInsidePopup?bT("",(0,v.d)(w.qs,f.event)):bU(!1,f)}else bV(c,f),bU(!1,f)}),bX=(0,i.K)(()=>{if(!bw.state.submitOnItemClick)return;let a=bw.state.inputElement?.form;a&&"function"==typeof a.requestSubmit&&a.requestSubmit()}),bY=(0,i.K)(()=>{if(bL(!1),bA?.(!1),aT(!1),bP(),aV(null),"none"===U?bS({activeIndex:null,selectedIndex:null}):bS({activeIndex:null}),ba&&aZ.current&&""!==aZ.current.value&&!a0.current&&bT("",(0,v.d)(w.qs)),bb)if(bw.state.inputInsidePopup)aZ.current&&""!==aZ.current.value&&bT("",(0,v.d)(w.qs));else{let a=L(bf,at);if(aZ.current&&aZ.current.value!==a){let b=""===a?w.qs:w.dv;bT(a,(0,v.d)(b))}}}),bZ=e.useMemo(()=>bH&&bD?{current:bD.closest('[role="dialog"]')}:aY,[bH,bD]);(0,O.v)({enabled:!a.actionsRef,open:bl,ref:bZ,onComplete(){bl||bY()}}),e.useImperativeHandle(a.actionsRef,()=>({unmount:bY}),[bY]),(0,g.g)(function(){if(bl||"none"===U)return;let a=al?bt:a7.current;if(ba){let b=Array.isArray(bf)?bf:[],c=I(a,b[b.length-1],av);bS({selectedIndex:-1===c?null:c})}else{let b=I(a,bf,av);bS({selectedIndex:-1===b?null:b})}},[bl,bf,al,U,bt,ba,av,bS]),(0,g.g)(()=>{al&&(a6.current=bv,aW.current.length=bv.length)},[al,bv]),(0,g.g)(()=>{let a=a5.current;if(a&&(a.hasQuery?b&&bw.set("activeIndex",0):"always"===b&&bw.set("activeIndex",0),a5.current=null),!bl&&!bH)return;let c=bd||be?bv:a6.current,d=bw.state.activeIndex;if(null==d)return"always"===b&&c.length>0?void bw.set("activeIndex",0):void(a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))));if(d>=c.length){a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))),bw.set("activeIndex",null);return}let e=c[d],f=a4.current.value,g=f!==ad&&H(e,f,bw.state.isItemEqualToValue);a4.current.index===d&&g||(a4.current={value:e,index:d},bw.state.onItemHighlighted(e,(0,v.M)(w.dv,void 0,{index:d})))},[bB,b,be,bd,bv,bH,bl,bw]),(0,g.g)(()=>{if("none"===U)return void aJ(""!==String(bj));aJ(ba?Array.isArray(bf)&&bf.length>0:null!=bf)},[aJ,U,bj,bf,ba]),e.useEffect(()=>{bd&&b&&0===bv.length&&bS({activeIndex:null})},[bd,b,bv.length,bS]),ac(bo,()=>{bl&&""!==bo&&bo!==String(bi)&&aT(!0)}),ac(bf,()=>{if("none"!==U&&(aF(a9),aG(bf!==aH.initialValue),aI()?aP.commit(bf):aP.commit(bf,!0),bb&&!bc&&!bI)){let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))}}),ac(bj,()=>{"none"===U&&(aF(a9),aG(bj!==aH.initialValue),aI()?aP.commit(bj):aP.commit(bj,!0))}),ac(al,()=>{if(!bb||bc||bI||aS)return;let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))});let b$=(0,p.P)({open:!!bH||bl,onOpenChange:bU,elements:{reference:bI?bF:bG,floating:bD}});bH||(c=ak?"grid":"listbox",x=bl?"true":"false");let b_=e.useMemo(()=>{let a=bG?.tagName==="INPUT",b=a||bl,d=a?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return b&&(d.role="combobox",d["aria-expanded"]=x,d["aria-haspopup"]=c,d["aria-controls"]=bl?bE?.id:void 0,d["aria-autocomplete"]=aB),{reference:d,floating:{role:"presentation"}}},[bG,bl,x,c,bE?.id,aB]),b0=(0,q.k)(b$,{enabled:!ah&&!a8&&ao,event:"mousedown-only",toggle:!1,touchOpenDelay:50*!bI,reason:w._J}),b1=(0,r.s)(b$,{enabled:!ah&&!a8&&!bH,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:!!bH||void 0,outsidePress(a){let b=(0,u.EW)(a);return!(0,u.gR)(bF,b)&&!(0,u.gR)(a2.current,b)&&!(0,u.gR)(a1.current,b)}}),b2=(0,s.C)(b$,{enabled:!ah&&!a8,id:aQ,listRef:aW,activeIndex:bB,selectedIndex:bC,virtual:!0,loopFocus:as,allowEscape:as&&!b,focusItemOnOpen:!aS&&("none"!==U||!!b)&&"auto",focusItemOnHover:ar,resetOnPointerLeave:!aq,cols:ak?2:1,orientation:ak?"horizontal":void 0,disabledIndices:P.Ml,onNavigate(a,b){(b||bl)&&"ending"!==bM&&(b?bS({activeIndex:a,type:a_.current?"keyboard":"pointer"}):bS({activeIndex:a}))}}),{getReferenceProps:b3,getFloatingProps:b4,getItemProps:b5}=(0,t.b)([b_,b0,b1,b2]);(0,h.j)(()=>{bw.update({inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,getItemProps:b5,setOpen:bU,setInputValue:bT,setSelectedValue:bV,setIndices:bS,onItemHighlighted:bz,handleSelection:bW,forceMount:bQ,requestSubmit:bX})}),(0,g.g)(()=>{bw.update({id:aQ,selectedValue:bf,open:bl,mounted:bK,transitionStatus:bM,items:al,inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,openMethod:bN,getItemProps:b5,selectionMode:U,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,onOpenChangeComplete:bA,openOnInputClick:ao,itemToStringLabel:at,modal:az,autoHighlight:b,isItemEqualToValue:av,submitOnItemClick:aE,hasInputValue:bc,requestSubmit:bX})},[bw,aQ,bf,bl,bK,bM,al,b4,b3,b5,bN,bO,U,a9,a8,ah,ai,aP,ak,bn,aw,bA,ao,at,az,av,aE,bc,ax,bX,b]);let b6=(0,j.a)(aj,aP.inputRef),b7=e.useMemo(()=>({query:bo,hasItems:bd,filteredItems:bu,flatFilteredItems:bv}),[bo,bd,bu,bv]),b8=e.useMemo(()=>Array.isArray(bx)?"":M(bx,au),[bx,au]),b9=ba&&Array.isArray(bf)&&bf.length>0,ca=ba||"none"===U?void 0:a9,cb=e.useMemo(()=>ba&&Array.isArray(bf)&&a9?bf.map(a=>{let b=M(a,au);return(0,d.jsx)("input",{type:"hidden",name:a9,value:b},b)}):null,[ba,bf,a9,au]),cc=(0,d.jsxs)(e.Fragment,{children:[a.children,(0,d.jsx)("input",{...aP.getInputValidationProps({onFocus(){if(bI)return void bF?.focus();(aZ.current||bF)?.focus()},onChange(a){if(a.nativeEvent.defaultPrevented)return;let b=a.target.value,c=(0,v.d)(w.dv,a.nativeEvent);function d(){if(ba)return;if("none"===U){aG(b!==aH.initialValue),bT(b,c),aI()&&aP.commit(b);return}let a=a6.current.find(a=>M(a,au).toLowerCase()===b.toLowerCase());null!=a&&(aG(a!==aH.initialValue),bV?.(a,c),aI()&&aP.commit(a))}al?d():(bQ(),queueMicrotask(d))}}),id:aQ&&null==ca?`${aQ}-hidden-input`:void 0,name:ca,autoComplete:aC,disabled:a8,required:ai&&!b9,readOnly:ah,value:b8,ref:b6,style:ca?k.a:k.Q,tabIndex:-1,"aria-hidden":!0}),cb]});return(0,d.jsx)(y.Provider,{value:bw,children:(0,d.jsx)(z.Provider,{value:b$,children:(0,d.jsx)(A.Provider,{value:b7,children:(0,d.jsx)(B.Provider,{value:bj,children:cc})})})})}var ag=c(504745),ah=c(577979),ai=c(654277);let aj={...ai.jL,valid:a=>null===a?null:a?{[Q.valid]:""}:{[Q.invalid]:""},popupSide:a=>a?{"data-popup-side":a}:null,listEmpty:a=>a?{"data-list-empty":""}:null},ak=e.createContext(void 0);var al=c(20960);let am=e.createContext(void 0);function an(a){let b=e.useContext(am);if(void 0===b&&!a)throw Error((0,x.A)(21));return b}var ao=c(729406);let ap=e.forwardRef(function(a,b){let{render:c,className:d,disabled:f=!1,id:g,...h}=a,{state:j,disabled:k,setTouched:l,setFocused:m,validationMode:o,validation:p}=S(),{labelId:q}=Z(),r=e.useContext(ak),s=!!an(!0),t=C(),{filteredItems:u}=E(),x=e.useContext(B),y=(0,ao.j)(),z=(0,n.P)(t,N.required),A=(0,n.P)(t,N.disabled),D=(0,n.P)(t,N.readOnly),F=(0,n.P)(t,N.name),G=(0,n.P)(t,N.selectionMode),H=(0,n.P)(t,N.autoHighlight),I=(0,n.P)(t,N.inputProps),J=(0,n.P)(t,N.triggerProps),K=(0,n.P)(t,N.open),L=(0,n.P)(t,N.mounted),M=(0,n.P)(t,N.selectedValue),O=(0,n.P)(t,N.popupSide),P=(0,n.P)(t,N.positionerElement),Q=(0,n.P)(t,N.id),R=(0,n.P)(t,N.inline),T=!!H,U=k||A||f,V=0===u.length,W=s||R,Y=(0,X.e)(g??(W?void 0:Q)),[_,aa]=e.useState(null),ab=e.useRef(!1),ac=e.useRef(null),ad=e.useRef(!1),ae=(0,i.K)(a=>{let b=s||t.state.inline;b&&!t.state.hasInputValue&&t.state.setInputValue("",(0,v.d)(w.dv)),t.update({inputElement:a,inputInsidePopup:b})}),af={...j,open:K,disabled:U,readOnly:D,popupSide:L&&P?O:null,listEmpty:V};return(0,ah.o)("input",a,{state:af,ref:[b,t.state.inputRef,ae],props:[I,J,{type:"text",value:a.value??_??x,"aria-readonly":D||void 0,"aria-required":z||void 0,"aria-labelledby":q,disabled:U,readOnly:D,required:"none"===G?z:void 0,..."none"===G&&F&&{name:F},id:Y,onFocus(){if(m(!0),!R||!ad.current)return;ad.current=!1;let a=ac.current;null!=a&&Object.hasOwn(t.state.valuesRef.current,a)&&t.state.setIndices({activeIndex:a})},onBlur(){l(!0),m(!1);let a=t.state.activeIndex;if(R&&null!==a&&"always"!==H&&(ac.current=a,ad.current=!0,t.state.setIndices({activeIndex:null})),"onBlur"===o){let a="none"===G?x:M;p.commit(a)}},onCompositionStart(a){ag.m0||(ab.current=!0,aa(a.currentTarget.value))},onCompositionEnd(a){ab.current=!1;let b=a.currentTarget.value;aa(null),t.state.setInputValue(b,(0,v.d)(w.pf,a.nativeEvent))},onChange(a){let b=a.nativeEvent.inputType,c=ab.current||!(!b||"insertReplacementText"===b);if(ab.current){let b=a.currentTarget.value;aa(b),""!==b||t.state.openOnInputClick||t.state.inputInsidePopup||t.state.setOpen(!1,(0,v.d)(w.qs,a.nativeEvent));let d=b.trim();!D&&!U&&d&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!(T&&""!==d)&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"});return}t.state.setInputValue(a.currentTarget.value,(0,v.d)(w.pf,a.nativeEvent));let d=""===a.currentTarget.value,e=(0,v.d)(w.qs,a.nativeEvent);d&&!t.state.inputInsidePopup&&("single"===G&&t.state.setSelectedValue(null,e),t.state.openOnInputClick||t.state.setOpen(!1,e));let f=a.currentTarget.value.trim();!D&&!U&&f&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!T&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(a){if(U||D||a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)return;t.state.keyboardActiveRef.current=!0;let b=a.currentTarget,c=b.scrollWidth-b.clientWidth,d="rtl"===y;if("Home"===a.key){(0,al.jo)(a);let c=ag.gm&&d?b.value.length:0;b.setSelectionRange(c,c),b.scrollLeft=0;return}if("End"===a.key){(0,al.jo)(a);let e=ag.gm&&d?0:b.value.length;b.setSelectionRange(e,e),b.scrollLeft=d?-c:c;return}if(!L&&"Escape"===a.key){let b="multiple"===G&&Array.isArray(M)?0===M.length:null===M,c=(0,v.d)(w.jv,a.nativeEvent);t.state.setInputValue("",c),t.state.setSelectedValue("multiple"===G?[]:null,c),b||t.state.inline||c.isPropagationAllowed||a.stopPropagation();return}if(r&&"Backspace"===a.key&&""===b.value&&void 0===r.highlightedChipIndex&&Array.isArray(M)&&M.length>0){let b=M.slice(0,-1);t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"}),t.state.setSelectedValue(b,(0,v.d)(w.dv,a.nativeEvent));return}let e=r?.highlightedChipIndex!==void 0,f=function(a){let b;if(!r)return;let{highlightedChipIndex:c}=r;if(void 0!==c){if("ArrowLeft"===a.key)a.preventDefault(),b=c>0?c-1:void 0;else if("ArrowRight"===a.key)a.preventDefault(),b=c<M.length-1?c+1:void 0;else if("Backspace"===a.key||"Delete"===a.key){a.preventDefault();let d=c>=M.length-1?M.length-2:c;b=d>=0?d:void 0,t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return b}return"ArrowLeft"===a.key&&(a.currentTarget.selectionStart??0)===0&&M.length>0?(a.preventDefault(),b=Math.max(M.length-1,0)):"Backspace"===a.key&&""===a.currentTarget.value&&M.length>0&&(t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),a.preventDefault()),b}(a);if(r?.setHighlightedChipIndex(f),void 0!==f?r?.chipsRef.current[f]?.focus():e&&t.state.inputRef.current?.focus(),229!==a.which&&"Enter"===a.key&&K){let b=t.state.activeIndex,c=a.nativeEvent;if(null===b)return void t.state.setOpen(!1,(0,v.d)(w.dv,c));(0,al.jo)(a);let d=t.state.listRef.current[b];d&&(t.state.selectionEventRef.current=c,d.click(),t.state.selectionEventRef.current=null)}},onPointerMove(){t.state.keyboardActiveRef.current=!1},onPointerDown(){t.state.keyboardActiveRef.current=!1}},p?p.getValidationProps(h):h],stateAttributesMapping:aj})});var aq=c(402831);let ar=e.createContext(void 0),as=e.forwardRef(function(a,b){let{keepMounted:c=!1,...e}=a,f=C(),g=(0,n.P)(f,N.mounted),h=(0,n.P)(f,N.forceMounted);return g||c||h?(0,d.jsx)(ar.Provider,{value:c,children:(0,d.jsx)(aq.XF,{ref:b,...e})}):null});var at=c(640023),au=c(568069),av=c(275819),aw=c(293863),ax=c(994152),ay=c(929035);let az=e.forwardRef(function(a,b){let{render:c,className:f,anchor:h,positionMethod:j="absolute",side:k="bottom",align:l="center",sideOffset:m=0,alignOffset:o=0,collisionBoundary:p="clipping-ancestors",collisionPadding:q=5,arrowPadding:r=5,sticky:s=!1,disableAnchorTracking:t=!1,collisionAvoidance:u=aw.uD,...v}=a,w=C(),{filteredItems:y}=E(),z=D(),A=function(){let a=e.useContext(ar);if(void 0===a)throw Error((0,x.A)(20));return a}(),B=(0,n.P)(w,N.modal),F=(0,n.P)(w,N.open),G=(0,n.P)(w,N.mounted),H=(0,n.P)(w,N.openMethod),I=(0,n.P)(w,N.triggerElement),J=(0,n.P)(w,N.inputElement),K=(0,n.P)(w,N.inputInsidePopup),L=(0,n.P)(w,N.transitionStatus),M=0===y.length,O=h??(K?I:J),P=(0,av.s)({anchor:O,floatingRootContext:z,positionMethod:j,mounted:G,side:k,sideOffset:m,align:l,alignOffset:o,arrowPadding:r,collisionBoundary:p,collisionPadding:q,sticky:s,disableAnchorTracking:t,keepMounted:A,collisionAvoidance:u,lazyFlip:!0});(0,au.K)(F&&B&&"touch"!==H,I);let Q=e.useMemo(()=>{let a={...P.positionerStyles};return F||(a.pointerEvents="none"),{role:"presentation",hidden:!G,style:a}},[F,G,P.positionerStyles]),R={open:F,side:P.side,align:P.align,anchorHidden:P.anchorHidden,empty:M};(0,g.g)(()=>{w.set("popupSide",P.side)},[w,P.side]);let S=e.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,anchorHidden:P.anchorHidden,isPositioned:P.isPositioned}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.anchorHidden,P.isPositioned]),T=(0,i.K)(a=>{w.set("positionerElement",a)}),U=(0,ah.o)("div",a,{state:R,ref:[b,T],props:[Q,(0,ax.d)(L),v],stateAttributesMapping:ai.GW});return(0,d.jsxs)(am.Provider,{value:S,children:[G&&B&&(0,d.jsx)(ay.W,{inert:(0,at.Y)(!F),cutout:J??I}),U]})});var aA=c(474228),aB=c(238978);let aC={...ai.GW,...aB.G},aD=e.forwardRef(function(a,b){let c,{render:e,className:f,initialFocus:g,finalFocus:h,...i}=a,j=C(),k=an(),l=D(),{filteredItems:m}=E(),o=(0,n.P)(j,N.mounted),p=(0,n.P)(j,N.open),q=(0,n.P)(j,N.openMethod),r=(0,n.P)(j,N.transitionStatus),s=(0,n.P)(j,N.inputInsidePopup),t=(0,n.P)(j,N.inputElement),v=0===m.length;(0,O.v)({open:p,ref:j.state.popupRef,onComplete(){p&&j.state.onOpenChangeComplete(!0)}});let w={open:p,side:k.side,align:k.align,anchorHidden:k.anchorHidden,transitionStatus:r,empty:v},x=(0,ah.o)("div",a,{state:w,ref:[b,j.state.popupRef],props:[{role:s?"dialog":"presentation",tabIndex:-1,onFocus(a){let b=(0,u.EW)(a.nativeEvent);"touch"!==q&&((0,u.gR)(j.state.listElement,b)||b===a.currentTarget)&&j.state.inputRef.current?.focus()}},(0,ax.d)(r),i],stateAttributesMapping:aC}),y=!!s&&(a=>"touch"===a?j.state.popupRef.current:t);return c=null!=h?h:!!s&&void 0,(0,d.jsx)(aA.s,{context:l,disabled:!o,modal:!s,openInteractionType:q,initialFocus:void 0===g?y:g,returnFocus:c,children:x})}),aE=e.createContext(null);function aF(a){let{children:b}=a,{filteredItems:c}=E(),f=e.useContext(aE),g=f?f.items:c;return g?(0,d.jsx)(e.Fragment,{children:g.map(b)}):null}var aG=c(987038);let aH=e.forwardRef(function(a,b){var c;let{render:f,className:g,children:h,...j}=a,k=C(),l=D(),m=!!an(!0),{filteredItems:o}=E(),p=(0,n.P)(k,N.items),q=(0,n.P)(k,N.labelsRef),r=(0,n.P)(k,N.listRef),s=(0,n.P)(k,N.selectionMode),t=(0,n.P)(k,N.grid),u=(0,n.P)(k,N.popupProps),v=(0,n.P)(k,N.disabled),w=(0,n.P)(k,N.readOnly),x=(0,n.P)(k,N.virtualized),y=0===o.length,z=(0,i.K)(a=>{k.set("positionerElement",a)}),A=(0,i.K)(a=>{k.set("listElement",a)}),B=e.useMemo(()=>"function"==typeof h?c||(c=(0,d.jsx)(aF,{children:h})):h,[h]),F=l.useState("floatingId"),G=(0,ah.o)("div",a,{state:{empty:y},ref:[b,A,m?null:z],props:[u,{children:B,tabIndex:-1,id:F,role:t?"grid":"listbox","aria-multiselectable":"multiple"===s?"true":void 0,onKeyDown(a){if(!v&&!w&&"Enter"===a.key){let b=k.state.activeIndex;if(null==b)return;(0,al.jo)(a);let c=a.nativeEvent,d=k.state.listRef.current[b];d&&(k.state.selectionEventRef.current=c,d.click(),k.state.selectionEventRef.current=null)}},onKeyDownCapture(){k.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){k.state.keyboardActiveRef.current=!1}},j]});return x?G:(0,d.jsx)(aG.u,{elementsRef:r,labelsRef:p?void 0:q,children:G})});var aI=c(360412);let aJ=e.createContext(void 0);var aK=c(642228);let aL=e.createContext(!1),aM=e.memo(e.forwardRef(function(a,b){let{render:c,className:f,value:h=null,index:i,disabled:j=!1,nativeButton:k=!1,...l}=a,m=e.useRef(!1),o=e.useRef(null),p=(0,aI.q)({index:i,textRef:o,indexGuessBehavior:aI.G.GuessFromOrder}),q=C(),r=e.useContext(aL),{flatFilteredItems:s,hasItems:t}=E(),u=(0,n.P)(q,N.open),v=(0,n.P)(q,N.selectionMode),w=(0,n.P)(q,N.readOnly),x=(0,n.P)(q,N.virtualized),y=(0,n.P)(q,N.isItemEqualToValue),z="none"!==v,A=i??(x?I(s,h,y):p.index),B=-1!==p.index,D=(0,n.P)(q,N.id),F=(0,n.P)(q,N.isActive,A),G=(0,n.P)(q,N.isSelected,h),J=(0,n.P)(q,N.getItemProps),K=e.useRef(null),L=null!=D&&B?`${D}-${A}`:void 0,M=G&&z;(0,g.g)(()=>{if(!(B&&(x||null!=i)))return;let a=q.state.listRef.current;return a[A]=K.current,()=>{delete a[A]}},[B,x,A,i,q]),(0,g.g)(()=>{if(!B||t)return;let a=q.state.valuesRef.current;return a[A]=h,"none"!==v&&q.state.allValuesRef.current.push(h),()=>{delete a[A]}},[B,t,A,h,q,v]),(0,g.g)(()=>{if(!u){m.current=!1;return}if(!B||t)return;let a=q.state.selectedValue;H(h,Array.isArray(a)?a[a.length-1]:a,y)&&q.set("selectedIndex",A)},[B,t,u,q,A,h,y]);let O=J({active:F,selected:M});O.id=void 0,O.onFocus=void 0;let{getButtonProps:P,buttonRef:Q}=(0,aK.s)({disabled:j,focusableWhenDisabled:!0,native:k});function R(a){function b(){q.state.handleSelection(a,h)}q.state.submitOnItemClick?(T.flushSync(b),q.state.requestSubmit()):b()}let S=(0,ah.o)("div",a,{ref:[Q,b,p.ref,K],state:{disabled:j,selected:M,highlighted:F},props:[O,{id:L,role:r?"gridcell":"option","aria-selected":z?M:void 0,tabIndex:void 0,onPointerDownCapture(a){m.current=!0,a.preventDefault()},onClick(a){j||w||R(a.nativeEvent)},onMouseUp(a){let b=m.current;m.current=!1,j||w||0!==a.button||b||!F||R(a.nativeEvent)}},l,P]}),U=e.useMemo(()=>({selected:M,textRef:o}),[M,o]);return(0,d.jsx)(aJ.Provider,{value:U,children:S})}));var aN=c(165046);let aO=function(a){let{multiple:b=!1,defaultValue:c,value:e,onValueChange:f,autoComplete:g,...h}=a;return(0,d.jsx)(af,{...h,selectionMode:b?"multiple":"single",selectedValue:e,defaultSelectedValue:c,onSelectedValueChange:f,formAutoComplete:g})},aP=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ap,{ref:c,"data-slot":"combobox-input",className:(0,aN.cn)("w-full rounded-xl py-2 text-sm outline-none transition-colors",a),...b}));function aQ({className:a,side:b="bottom",sideOffset:c=8,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(as,{children:(0,d.jsx)(az,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-[10000]",children:(0,d.jsx)(aD,{"data-slot":"combobox-content",className:(0,aN.cn)("bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md text-[var(--color-text)] max-h-[var(--available-height)] w-[calc(var(--anchor-width)+48px)] overflow-hidden rounded-3xl p-1 shadow-[0_0_25px_0_rgba(0,0,0,0.16)] outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",a),...h})})})}function aR({className:a,...b}){return(0,d.jsx)(aH,{"data-slot":"combobox-list",className:(0,aN.cn)("max-h-[300px] overflow-y-auto overscroll-contain thin-scrollbar",a),...b})}function aS({className:a,children:b,...c}){return(0,d.jsx)(aM,{"data-slot":"combobox-item",className:(0,aN.cn)("bg-transparent data-highlighted:bg-neutral-400/15 text-sm transition-all relative flex w-full cursor-pointer items-center gap-2.5 rounded-2xl px-3 py-2 outline-none select-none","data-disabled:pointer-events-none data-disabled:opacity-50",a),...c,children:b})}aP.displayName="ComboboxInput";var aT=c(941809),aU=c(896703),aV=c(490654),aW=c(75567);function aX(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.875 2.292a.114.114 0 0 0-.032.018A7.239 7.239 0 0 0 4.75 8.25a7.248 7.248 0 0 0 3.654 6.297c.57.327.982.955.941 1.682v.002l-.317 6.058a.75.75 0 1 1-1.498-.078l.317-6.062v-.004c.006-.09-.047-.215-.188-.296A8.749 8.749 0 0 1 3.25 8.25a8.738 8.738 0 0 1 3.732-7.169 1.547 1.547 0 0 1 1.709-.064c.484.292.809.835.809 1.46v4.714a.25.25 0 0 0 .119.213l2.25 1.385c.08.05.182.05.262 0l2.25-1.385a.25.25 0 0 0 .119-.213V2.478c0-.626.325-1.169.81-1.461a1.547 1.547 0 0 1 1.708.064 8.741 8.741 0 0 1 3.732 7.17 8.747 8.747 0 0 1-4.41 7.598c-.14.081-.193.206-.188.296v.004l.318 6.062a.75.75 0 1 1-1.498.078l-.317-6.058v-.002c-.041-.727.37-1.355.94-1.682A7.247 7.247 0 0 0 19.25 8.25a7.239 7.239 0 0 0-3.093-5.94.114.114 0 0 0-.032-.018l-.01-.001c-.003 0-.014 0-.031.01-.036.022-.084.079-.084.177V7.19c0 .608-.315 1.172-.833 1.49l-2.25 1.385a1.75 1.75 0 0 1-1.834 0l-2.25-1.384A1.752 1.752 0 0 1 8 7.192V2.477c0-.098-.048-.155-.084-.176a.068.068 0 0 0-.031-.011l-.01.001Z"},child:[]}]})(a)}function aY(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.5 7C2.5 9.48528 4.51472 11.5 7 11.5C9.48528 11.5 11.5 9.48528 11.5 7C11.5 4.51472 9.48528 2.5 7 2.5C4.51472 2.5 2.5 4.51472 2.5 7ZM2.5 17C2.5 19.4853 4.51472 21.5 7 21.5C9.48528 21.5 11.5 19.4853 11.5 17C11.5 14.5147 9.48528 12.5 7 12.5C4.51472 12.5 2.5 14.5147 2.5 17ZM12.5 17C12.5 19.4853 14.5147 21.5 17 21.5C19.4853 21.5 21.5 19.4853 21.5 17C21.5 14.5147 19.4853 12.5 17 12.5C14.5147 12.5 12.5 14.5147 12.5 17ZM9.5 7C9.5 8.38071 8.38071 9.5 7 9.5C5.61929 9.5 4.5 8.38071 4.5 7C4.5 5.61929 5.61929 4.5 7 4.5C8.38071 4.5 9.5 5.61929 9.5 7ZM9.5 17C9.5 18.3807 8.38071 19.5 7 19.5C5.61929 19.5 4.5 18.3807 4.5 17C4.5 15.6193 5.61929 14.5 7 14.5C8.38071 14.5 9.5 15.6193 9.5 17ZM19.5 17C19.5 18.3807 18.3807 19.5 17 19.5C15.6193 19.5 14.5 18.3807 14.5 17C14.5 15.6193 15.6193 14.5 17 14.5C18.3807 14.5 19.5 15.6193 19.5 17ZM17.5252 11.155L17.8026 10.5186C18.297 9.38398 19.1876 8.48059 20.2988 7.98638L21.1534 7.60631C21.6155 7.4008 21.6155 6.7284 21.1534 6.52289L20.3467 6.16406C19.2068 5.65713 18.3002 4.72031 17.8143 3.54712L17.5295 2.85945C17.3309 2.38018 16.669 2.38018 16.4705 2.85945L16.1856 3.54712C15.6997 4.72031 14.7932 5.65713 13.6534 6.16406L12.8466 6.52289C12.3845 6.7284 12.3845 7.4008 12.8466 7.60631L13.7011 7.98638C14.8124 8.48059 15.7029 9.38398 16.1974 10.5186L16.4748 11.155C16.6778 11.6209 17.3222 11.6209 17.5252 11.155Z"},child:[]}]})(a)}var aZ=c(826948),a$=c(57137),a_=c(489619),a0=c(86839),a1=c(981188);function a2(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind?(0,a0.PV)(a.label):c,path:b,type:a.nodeType??("object"===a.kind?"folder":"file")}}function a3(){let{resolvedTheme:a,setTheme:b}=(0,aZ.D)(),[c,f]=(0,e.useState)(!1);if(!c)return(0,d.jsx)("div",{className:"w-[26px] h-[26px]"});let g="dark"===a;return(0,d.jsx)("button",{type:"button",onClick:()=>b(g?"light":"dark"),className:"p-1.5 rounded-lg transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Switch to light mode":"Switch to dark mode",children:g?(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M12 2v2"}),(0,d.jsx)("path",{d:"M12 20v2"}),(0,d.jsx)("path",{d:"m4.93 4.93 1.41 1.41"}),(0,d.jsx)("path",{d:"m17.66 17.66 1.41 1.41"}),(0,d.jsx)("path",{d:"M2 12h2"}),(0,d.jsx)("path",{d:"M20 12h2"}),(0,d.jsx)("path",{d:"m6.34 17.66-1.41 1.41"}),(0,d.jsx)("path",{d:"m19.07 4.93-1.41 1.41"})]}):(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})})}function a4(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"m21 21-4.3-4.3"})]})}function a5({type:a}){switch(a){case"folder":return(0,d.jsx)(aT.A,{size:16,style:{flexShrink:0,color:"#60a5fa"}});case"document":default:return(0,d.jsx)(aU.A,{size:16,style:{flexShrink:0,opacity:.7}});case"database":return(0,d.jsx)(aV.A,{size:16,style:{flexShrink:0}})}}function a6({onSelect:a,searchFn:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),k=(0,e.useRef)(!1),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=(0,e.useCallback)(a=>{if(k.current){k.current=!1;return}if(j(a),!a.trim()){f([]),h(!1);return}b?(f(b(a.trim(),20).map(a2)),h(!0)):(l.current&&clearTimeout(l.current),l.current=setTimeout(async()=>{try{let b=await fetch(`/api/workspace/suggest-files?q=${encodeURIComponent(a.trim())}`),c=await b.json();f(c.items??[]),h(!0)}catch{f([])}},150))},[b]);return(0,d.jsxs)(aO,{value:null,open:g,onOpenChange:a=>{a||h(!1)},onValueChange:b=>{b&&(k.current=!0,a(b),h(!1),j(""),f([]))},onInputValueChange:n,filter:null,itemToStringLabel:()=>"",children:[(0,d.jsxs)("div",{ref:m,className:"relative",children:[(0,d.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none z-10",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a4,{})}),(0,d.jsx)(aP,{placeholder:"Search",className:"w-full pl-9 pr-10 py-1.5 rounded-xl text-sm outline-none transition-colors",style:{background:"var(--color-surface-hover)",color:"var(--color-text)"}})]}),(0,d.jsxs)(aQ,{anchor:m,children:[(0,d.jsx)(aR,{children:c.map(a=>(0,d.jsxs)(aS,{value:a,children:[(0,d.jsx)("span",{className:"flex-shrink-0",style:{color:"var(--color-text-muted)",opacity:.55},children:(0,d.jsx)(a5,{type:a.type})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:a.name}),(0,d.jsx)("div",{className:"truncate text-xs",style:{color:"var(--color-text-muted)"},children:a.path.split("/").slice(0,-1).join("/")})]})]},a.path))}),i.trim()&&0===c.length&&(0,d.jsx)("div",{className:"py-3 text-center text-sm",style:{color:"var(--color-text-muted)"},children:"No files found"})]})]})}function a7({orgName:a,onFileSearchSelect:b,mobile:c,onClose:f,showHidden:g,onToggleHidden:h,width:i,onCollapse:j,compact:k=!1,onToggleCompact:l,activeWorkspace:m,onWorkspaceChanged:n,onNavigate:o,activeCrmTarget:p=null,customCrmObjects:q,activeCrmObjectName:r=null,onNavigateToCrmObject:s,chatsPanel:t,onNewChatSession:u}){let v=c?"280px":i??260,[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)("home"),A=[{id:"crm-people",label:"People",target:"people",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,d.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{id:"crm-companies",label:"Companies",target:"companies",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M3 21h18"}),(0,d.jsx)("path",{d:"M5 21V7l8-4v18"}),(0,d.jsx)("path",{d:"M19 21V11l-6-4"}),(0,d.jsx)("path",{d:"M9 9h0"}),(0,d.jsx)("path",{d:"M9 13h0"}),(0,d.jsx)("path",{d:"M9 17h0"})]})},{id:"crm-inbox",label:"Inbox",target:"inbox",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),(0,d.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z"})]})},{id:"crm-calendar",label:"Calendar",target:"calendar",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}],B=[{id:"cloud",label:"Cloud",icon:(0,d.jsx)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,d.jsx)("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"})})},{id:"integrations",label:"Integrations",icon:(0,d.jsx)(aY,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"skills",label:"Skills",icon:(0,d.jsx)(aX,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"cron",label:"Cron",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}],C=(0,d.jsxs)("aside",{className:"flex flex-col h-screen shrink-0 border-r",style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[l&&(0,d.jsx)("div",{className:"flex items-center justify-center h-[44px] shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Expand sidebar",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M15 3v18"})]})})}),(0,d.jsx)("div",{className:"flex items-center justify-center pb-0.5 shrink-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsx)("button",{type:"button",onClick:b,disabled:e,className:"w-7 h-7 mx-auto rounded-lg overflow-hidden flex items-center justify-center transition-opacity hover:opacity-90",title:`${a||"Workspace"}${c?` — ${c}`:""}`,children:(0,d.jsx)("img",{src:"/dench-workspace-icon.png",alt:"",className:"w-7 h-7 object-cover",draggable:!1})})})}),o&&(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 pt-1 pb-1",children:[A.map(a=>{let b=p===a.target;return(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:a.label,"aria-label":a.label,children:a.icon},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>s(a.name),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,"aria-label":c,children:(0,d.jsx)(a1.P,{name:a.icon,size:16})},`crm-object-${a.name}`)})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"flex flex-col items-center gap-0.5 py-1",children:B.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:a.label,"aria-label":a.label,children:a.icon},a.id))}),(0,d.jsxs)("div",{className:"flex flex-col items-center py-1.5 gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]}),D=(0,d.jsxs)("aside",{className:`flex flex-col h-screen shrink-0 ${c?"drawer-left":"border-r"}`,style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 h-[44px] shrink-0",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsxs)("button",{type:"button",onClick:b,disabled:e,className:"text-[13px] flex items-center gap-1.5 truncate w-full transition-colors rounded-lg px-2 py-1.5",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Switch workspace",children:[(0,d.jsx)("span",{className:"truncate font-semibold",children:a||"Workspace"}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"shrink-0 opacity-40",children:"/"}),(0,d.jsx)("span",{className:"truncate text-[12px]",style:{color:"var(--color-text-muted)"},children:c})]}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]})})}),(l||j)&&(0,d.jsx)("button",{type:"button",onClick:l??j,className:"p-1.5 rounded-lg shrink-0 transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:l?"Collapse to icons":"Hide sidebar (⌘B)",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})})]}),t&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1 flex items-center gap-1",children:[[{id:"home",label:"Home"},{id:"chats",label:"Chats"}].map(a=>{let b=y===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>z(a.id),className:"flex-1 px-2 py-1 rounded-md text-[12px] font-medium transition-colors cursor-pointer",style:{color:b?"var(--color-text)":"var(--color-text-muted)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:a.label},a.id)}),"chats"===y&&u&&(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded-md transition-colors cursor-pointer shrink-0",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"New chat","aria-label":"New chat",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M5 12h14"}),(0,d.jsx)("path",{d:"M12 5v14"})]})})]}),"chats"===y&&t?(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col relative",children:t}):(0,d.jsxs)(d.Fragment,{children:[o&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1",children:[(0,d.jsx)("div",{className:"px-2 pt-2 pb-1 text-[9px] lowercase",style:{color:"var(--color-text-muted)",letterSpacing:"0.05em"},children:"workspace"}),(0,d.jsxs)("div",{className:"space-y-0.5",children:[A.map(a=>{let b=p===a.target;return(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.name),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a1.P,{name:a.icon,size:16})}),c]},`crm-object-${a.name}`)})]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"px-2 py-1 space-y-0.5",children:B.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id))})]}),(0,d.jsxs)("div",{className:"px-2 py-1.5 flex items-center justify-between",children:[(0,d.jsxs)("a",{href:"https://dench.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-2 py-1 rounded-lg text-[11px]",style:{color:"var(--color-text-muted)"},children:["dench.com"," v3.0.0"]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]})]});return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"drawer-backdrop",onClick:()=>void f?.(),children:(0,d.jsx)("div",{onClick:a=>a.stopPropagation(),className:"fixed inset-y-0 left-0 z-50",children:D})}),(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]}):(0,d.jsxs)(d.Fragment,{children:[!c&&k?C:D,(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]})}},685343:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(95253)._0},686937:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},699022:(a,b,c)=>{"use strict";function d(a,b){let c=a[b.tabId];return c&&c.sessionId===b.sessionId&&c.sessionKey===b.sessionKey&&c.isStreaming===b.isStreaming&&c.status===b.status&&c.isReconnecting===b.isReconnecting&&c.loadingSession===b.loadingSession?a:{...a,[b.tabId]:b}}function e(a,b){if(!(b in a))return a;let c={...a};return delete c[b],c}function f(a){return{parentStatuses:new Map(a.parentRuns.map(a=>[a.sessionId,a.status])),subagentStatuses:new Map(a.subagents.map(a=>[a.childSessionKey,a.status]))}}c.d(b,{F8:()=>f,T$:()=>e,ZZ:()=>d})},704092:(a,b,c)=>{"use strict";c.r(b),c.d(b,{Alternation:()=>av,Alternative:()=>ap,CstParser:()=>b_,EMPTY_ALT:()=>bZ,EOF:()=>ai,EarlyExitException:()=>br,EmbeddedActionsParser:()=>b0,GAstVisitor:()=>aB,Lexer:()=>V,LexerDefinitionErrorType:()=>d,MismatchedTokenException:()=>bo,NoViableAltException:()=>bp,NonTerminal:()=>an,NotAllInputParsedException:()=>bq,Option:()=>aq,Parser:()=>ca,ParserDefinitionErrorType:()=>g,Repetition:()=>at,RepetitionMandatory:()=>ar,RepetitionMandatoryWithSeparator:()=>as,RepetitionWithSeparator:()=>au,Rule:()=>ao,Terminal:()=>aw,VERSION:()=>h,assignOccurrenceIndices:()=>bf,clearCache:()=>b9,createSyntaxDiagramsCode:()=>b1,createToken:()=>ag,createTokenInstance:()=>aj,defaultGrammarResolverErrorProvider:()=>aM,defaultGrammarValidatorErrorProvider:()=>aN,defaultLexerErrorProvider:()=>T,defaultParserErrorProvider:()=>aL,generateParserFactory:()=>b7,generateParserModule:()=>b8,isRecognitionException:()=>bm,resolveGrammar:()=>bd,serializeGrammar:()=>ax,serializeProduction:()=>ay,tokenLabel:()=>W,tokenMatcher:()=>ak,tokenName:()=>X,validateGrammar:()=>be});var d,e,f,g,h="7.1.2",i=c(165892),j=c(935407),k={},l=new j.RegExpParser;function m(a){var b=a.toString();if(k.hasOwnProperty(b))return k[b];var c=l.pattern(b);return k[b]=c,c}var n=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),o="Complement Sets are not supported for first char optimization",p='Unable to use "first char" lexer optimizations:\n';function q(a,b,c){var d=J(a);b[d]=d,!0===c&&function(a,b){var c=String.fromCharCode(a),d=c.toUpperCase();if(d!==c){var e=J(d.charCodeAt(0));b[e]=e}else{var f=c.toLowerCase();if(f!==c){var e=J(f.charCodeAt(0));b[e]=e}}}(a,b)}function r(a,b){return(0,i.I6)(a.value,function(a){return"number"==typeof a?(0,i.gR)(b,a):void 0!==(0,i.I6)(b,function(b){return a.from<=b&&b<=a.to})})}var s=function(a){function b(b){var c=a.call(this)||this;return c.targetCharCodes=b,c.found=!1,c}return n(b,a),b.prototype.visitChildren=function(b){if(!0!==this.found){switch(b.type){case"Lookahead":this.visitLookahead(b);return;case"NegativeLookahead":this.visitNegativeLookahead(b);return}a.prototype.visitChildren.call(this,b)}},b.prototype.visitCharacter=function(a){(0,i.gR)(this.targetCharCodes,a.value)&&(this.found=!0)},b.prototype.visitSet=function(a){a.complement?void 0===r(a,this.targetCharCodes)&&(this.found=!0):void 0!==r(a,this.targetCharCodes)&&(this.found=!0)},b}(j.BaseRegExpVisitor);function t(a,b){if(!(b instanceof RegExp))return void 0!==(0,i.I6)(b,function(b){return(0,i.gR)(a,b.charCodeAt(0))});var c=m(b),d=new s(a);return d.visit(c),d.found}var u=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),v="PATTERN",w="defaultMode",x="modes",y="boolean"==typeof RegExp("(?:)").sticky,z=/[^\\][\$]/,A=/[^\\[][\^]|^\^/;function B(a){var b=a.ignoreCase?"i":"";return RegExp("^(?:"+a.source+")",b)}function C(a){var b=a.ignoreCase?"iy":"y";return RegExp(""+a.source,b)}function D(a){var b=a.PATTERN;if((0,i.gd)(b))return!1;if((0,i.Tn)(b))return!0;if((0,i.zy)(b,"exec"))return!0;if((0,i.Kg)(b))return!1;throw Error("non exhaustive match")}function E(a){return!!(0,i.Kg)(a)&&1===a.length&&a.charCodeAt(0)}var F={test:function(a){for(var b=a.length,c=this.lastIndex;c<b;c++){var d=a.charCodeAt(c);if(10===d)return this.lastIndex=c+1,!0;if(13===d)return 10===a.charCodeAt(c+1)?this.lastIndex=c+2:this.lastIndex=c+1,!0}return!1},lastIndex:0};function G(a,b){if((0,i.zy)(a,"LINE_BREAKS"))return!1;if((0,i.gd)(a.PATTERN)){try{t(b,a.PATTERN)}catch(a){return{issue:d.IDENTIFY_TERMINATOR,errMsg:a.message}}return!1}if((0,i.Kg)(a.PATTERN))return!1;if(D(a))return{issue:d.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function H(a){return(0,i.Tj)(a,function(a){return(0,i.Kg)(a)&&a.length>0?a.charCodeAt(0):a})}function I(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}function J(a){return a<256?a:K[a]}var K=[];function L(a,b){var c=a.tokenTypeIdx;return c===b.tokenTypeIdx||!0===b.isParent&&!0===b.categoryMatchesMap[c]}function M(a,b){return a.tokenTypeIdx===b.tokenTypeIdx}var N=1,O={};function P(a){var b,c,d,e=function(a){for(var b=(0,i.T9)(a),c=a,d=!0;d;){c=(0,i.oE)((0,i.Bq)((0,i.Tj)(c,function(a){return a.CATEGORIES})));var e=(0,i.iv)(c,b);b=b.concat(e),(0,i.Im)(e)?d=!1:c=e}return b}(a);b=e,(0,i.jJ)(b,function(a){var b,c;Q(a)||(O[N]=a,a.tokenTypeIdx=N++),R(a)&&!(0,i.cy)(a.CATEGORIES)&&(a.CATEGORIES=[a.CATEGORIES]),R(a)||(a.CATEGORIES=[]),b=a,(0,i.zy)(b,"categoryMatches")||(a.categoryMatches=[]),c=a,(0,i.zy)(c,"categoryMatchesMap")||(a.categoryMatchesMap={})}),c=e,(0,i.jJ)(c,function(a){!function a(b,c){(0,i.jJ)(b,function(a){c.categoryMatchesMap[a.tokenTypeIdx]=!0}),(0,i.jJ)(c.CATEGORIES,function(d){var e=b.concat(c);(0,i.gR)(e,d)||a(e,d)})}([],a)}),d=e,(0,i.jJ)(d,function(a){a.categoryMatches=[],(0,i.jJ)(a.categoryMatchesMap,function(b,c){a.categoryMatches.push(O[c].tokenTypeIdx)})}),(0,i.jJ)(e,function(a){a.isParent=a.categoryMatches.length>0})}function Q(a){return(0,i.zy)(a,"tokenTypeIdx")}function R(a){return(0,i.zy)(a,"CATEGORIES")}function S(a){return(0,i.zy)(a,"tokenTypeIdx")}var T={buildUnableToPopLexerModeMessage:function(a){return"Unable to pop Lexer Mode after encountering Token ->"+a.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(a,b,c,d,e){return"unexpected character: ->"+a.charAt(b)+"<- at offset: "+b+", skipped "+c+" characters."}};!function(a){a[a.MISSING_PATTERN=0]="MISSING_PATTERN",a[a.INVALID_PATTERN=1]="INVALID_PATTERN",a[a.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",a[a.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",a[a.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",a[a.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",a[a.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",a[a.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",a[a.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",a[a.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",a[a.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",a[a.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",a[a.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",a[a.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",a[a.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",a[a.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",a[a.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"}(d||(d={}));var U={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:T,traceInitPerf:!1,skipValidations:!1};Object.freeze(U);var V=function(){function a(a,b){var c=this;if(void 0===b&&(b=U),this.lexerDefinition=a,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof b)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=(0,i.h1)(U,b);var e=this.config.traceInitPerf;!0===e?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof e&&(this.traceInitMaxIdent=e,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var e,f=!0;c.TRACE_INIT("Lexer Config handling",function(){if(c.config.lineTerminatorsPattern===U.lineTerminatorsPattern)c.config.lineTerminatorsPattern=F;else if(c.config.lineTerminatorCharacters===U.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(b.safeMode&&b.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');c.trackStartLines=/full|onlyStart/i.test(c.config.positionTracking),c.trackEndLines=/full/i.test(c.config.positionTracking),(0,i.cy)(a)?((e={modes:{}}).modes[w]=(0,i.T9)(a),e[w]=w):(f=!1,e=(0,i.lR)(a))}),!1===c.config.skipValidations&&(c.TRACE_INIT("performRuntimeChecks",function(){var a,b;c.lexerDefinitionErrors=c.lexerDefinitionErrors.concat((a=e,c.trackStartLines,c.config.lineTerminatorCharacters,b=[],(0,i.zy)(a,w)||b.push({message:"A MultiMode Lexer cannot be initialized without a <"+w+"> property in its definition\n",type:d.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,i.zy)(a,x)||b.push({message:"A MultiMode Lexer cannot be initialized without a <"+x+"> property in its definition\n",type:d.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,i.zy)(a,x)&&(0,i.zy)(a,w)&&!(0,i.zy)(a.modes,a.defaultMode)&&b.push({message:"A MultiMode Lexer cannot be initialized with a "+w+": <"+a.defaultMode+">which does not exist\n",type:d.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,i.zy)(a,x)&&(0,i.jJ)(a.modes,function(a,c){(0,i.jJ)(a,function(a,e){(0,i.b0)(a)&&b.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+c+"> at index: <")+e+">\n",type:d.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),b))}),c.TRACE_INIT("performWarningRuntimeChecks",function(){var a,b,f,g,h,j,k,l;c.lexerDefinitionWarning=c.lexerDefinitionWarning.concat((a=e,b=c.trackStartLines,f=c.config.lineTerminatorCharacters,g=[],h=!1,j=(0,i.oE)((0,i.Bq)((0,i.LG)(a.modes,function(a){return a}))),k=(0,i.ku)(j,function(a){return a[v]===V.NA}),l=H(f),b&&(0,i.jJ)(k,function(a){var b=G(a,l);if(!1!==b){var c={message:function(a,b){if(b.issue===d.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n The problem is in the <"+a.name+"> Token Type\n Root cause: "+b.errMsg+".\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(b.issue===d.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n The problem is in the <"+a.name+"> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}(a,b),type:b.issue,tokenType:a};g.push(c)}else(0,i.zy)(a,"LINE_BREAKS")?!0===a.LINE_BREAKS&&(h=!0):t(l,a.PATTERN)&&(h=!0)}),b&&!h&&g.push({message:"Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.",type:d.NO_LINE_BREAKS_FLAGS}),g))})),e.modes=e.modes?e.modes:{},(0,i.jJ)(e.modes,function(a,b){e.modes[b]=(0,i.ku)(a,function(a){return(0,i.b0)(a)})});var g=(0,i.HP)(e.modes);if((0,i.jJ)(e.modes,function(a,e){c.TRACE_INIT("Mode: <"+e+"> processing",function(){if(c.modes.push(e),!1===c.config.skipValidations&&c.TRACE_INIT("validatePatterns",function(){var b,e,f,h,k,l,n,o,p,q,r,s,t,w,x,y,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R;c.lexerDefinitionErrors=c.lexerDefinitionErrors.concat((b=[],k=a,l=(0,i.pb)(k,function(a){return!(0,i.zy)(a,v)}),e={errors:(0,i.Tj)(l,function(a){return{message:"Token Type: ->"+a.name+"<- missing static 'PATTERN' property",type:d.MISSING_PATTERN,tokenTypes:[a]}}),valid:(0,i.iv)(k,l)},b=b.concat(e.errors),h=(n=e.valid,o=(0,i.pb)(n,function(a){var b=a[v];return!(0,i.gd)(b)&&!(0,i.Tn)(b)&&!(0,i.zy)(b,"exec")&&!(0,i.Kg)(b)}),f={errors:(0,i.Tj)(o,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:d.INVALID_PATTERN,tokenTypes:[a]}}),valid:(0,i.iv)(n,o)}).valid,b=(b=(b=(b=(b=b.concat(f.errors)).concat((p=h,q=[],r=(0,i.pb)(p,function(a){return(0,i.gd)(a[v])}),(q=(q=(q=(q=q.concat((s=r,t=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.found=!1,b}return u(b,a),b.prototype.visitEndAnchor=function(a){this.found=!0},b}(j.BaseRegExpVisitor),w=(0,i.pb)(s,function(a){var b=a[v];try{var c=m(b),d=new t;return d.visit(c),d.found}catch(a){return z.test(b.source)}}),(0,i.Tj)(w,function(a){return{message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+a.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:d.EOI_ANCHOR_FOUND,tokenTypes:[a]}})))).concat((x=r,y=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.found=!1,b}return u(b,a),b.prototype.visitStartAnchor=function(a){this.found=!0},b}(j.BaseRegExpVisitor),B=(0,i.pb)(x,function(a){var b=a[v];try{var c=m(b),d=new y;return d.visit(c),d.found}catch(a){return A.test(b.source)}}),(0,i.Tj)(B,function(a){return{message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+a.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:d.SOI_ANCHOR_FOUND,tokenTypes:[a]}})))).concat((C=r,D=(0,i.pb)(C,function(a){var b=a[v];return b instanceof RegExp&&(b.multiline||b.global)}),(0,i.Tj)(D,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:d.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[a]}})))).concat((E=r,F=[],G=(0,i.Tj)(E,function(a){return(0,i.TS)(E,function(b,c){return a.PATTERN.source!==c.PATTERN.source||(0,i.gR)(F,c)||c.PATTERN===V.NA||(F.push(c),b.push(c)),b},[])}),G=(0,i.oE)(G),H=(0,i.pb)(G,function(a){return a.length>1}),(0,i.Tj)(H,function(a){var b=(0,i.Tj)(a,function(a){return a.name});return{message:"The same RegExp pattern ->"+(0,i.$1)(a).PATTERN+"<-has been used in all of the following Token Types: "+b.join(", ")+" <-",type:d.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})))).concat((I=r,J=(0,i.pb)(I,function(a){return a[v].test("")}),(0,i.Tj)(J,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' must not match an empty string",type:d.EMPTY_MATCH_PATTERN,tokenTypes:[a]}})))))).concat((K=h,L=(0,i.pb)(K,function(a){if(!(0,i.zy)(a,"GROUP"))return!1;var b=a.GROUP;return b!==V.SKIPPED&&b!==V.NA&&!(0,i.Kg)(b)}),(0,i.Tj)(L,function(a){return{message:"Token Type: ->"+a.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:d.INVALID_GROUP_TYPE_FOUND,tokenTypes:[a]}})))).concat((M=h,N=g,O=(0,i.pb)(M,function(a){return void 0!==a.PUSH_MODE&&!(0,i.gR)(N,a.PUSH_MODE)}),(0,i.Tj)(O,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+a.PUSH_MODE+"<-which does not exist",type:d.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[a]}})))).concat((P=h,Q=[],R=(0,i.TS)(P,function(a,b,c){var d,e=b.PATTERN;return e===V.NA||((0,i.Kg)(e)?a.push({str:e,idx:c,tokenType:b}):(0,i.gd)(e)&&(d=e,void 0===(0,i.I6)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],function(a){return -1!==d.source.indexOf(a)}))&&a.push({str:e.source,idx:c,tokenType:b})),a},[]),(0,i.jJ)(P,function(a,b){(0,i.jJ)(R,function(c){var e=c.str,f=c.idx,g=c.tokenType;if(b<f&&function(a,b){if((0,i.gd)(b)){var c=b.exec(a);return null!==c&&0===c.index}if((0,i.Tn)(b))return b(a,0,[],{});if((0,i.zy)(b,"exec"))return b.exec(a,0,[],{});if("string"==typeof b)return b===a;throw Error("non exhaustive match")}(e,a.PATTERN)){var h="Token: ->"+g.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+a.name+"<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE";Q.push({message:h,type:d.UNREACHABLE_PATTERN,tokenTypes:[a,g]})}})}),Q))))}),(0,i.Im)(c.lexerDefinitionErrors)){var f;P(a),c.TRACE_INIT("analyzeTokenTypes",function(){var d,e,g,h,k,l,n,r,s,u,w,x,z,A,F,L,M;d={lineTerminatorCharacters:c.config.lineTerminatorCharacters,positionTracking:b.positionTracking,ensureOptimizations:b.ensureOptimizations,safeMode:b.safeMode,tracer:c.TRACE_INIT.bind(c)},(A=(d=(0,i.NT)(d,{useSticky:y,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(a,b){return b()}})).tracer)("initCharCodeToOptimizedIndexMap",function(){if((0,i.Im)(K)){K=Array(65536);for(var a=0;a<65536;a++)K[a]=a>255?255+~~(a/255):a}}),A("Reject Lexer.NA",function(){e=(0,i.ku)(a,function(a){return a[v]===V.NA})}),F=!1,A("Transform Patterns",function(){F=!1,g=(0,i.Tj)(e,function(a){var b=a[v];if((0,i.gd)(b)){var c=b.source;return 1!==c.length||"^"===c||"$"===c||"."===c||b.ignoreCase?2!==c.length||"\\"!==c[0]||(0,i.gR)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],c[1])?d.useSticky?C(b):B(b):c[1]:c}if((0,i.Tn)(b))return F=!0,{exec:b};if((0,i.zy)(b,"exec"))return F=!0,b;if("string"==typeof b)if(1===b.length)return b;else{var e=new RegExp(b.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"));return d.useSticky?C(e):B(e)}throw Error("non exhaustive match")})}),A("misc mapping",function(){h=(0,i.Tj)(e,function(a){return a.tokenTypeIdx}),k=(0,i.Tj)(e,function(a){var b=a.GROUP;if(b!==V.SKIPPED){if((0,i.Kg)(b))return b;if((0,i.b0)(b))return!1;throw Error("non exhaustive match")}}),l=(0,i.Tj)(e,function(a){var b=a.LONGER_ALT;if(b)return(0,i.qh)(e,b)}),n=(0,i.Tj)(e,function(a){return a.PUSH_MODE}),r=(0,i.Tj)(e,function(a){return(0,i.zy)(a,"POP_MODE")})}),A("Line Terminator Handling",function(){var a=H(d.lineTerminatorCharacters);s=(0,i.Tj)(e,function(a){return!1}),"onlyOffset"!==d.positionTracking&&(s=(0,i.Tj)(e,function(b){return(0,i.zy)(b,"LINE_BREAKS")?b.LINE_BREAKS:!1===G(b,a)?t(a,b.PATTERN):void 0}))}),A("Misc Mapping #2",function(){u=(0,i.Tj)(e,D),w=(0,i.Tj)(g,E),x=(0,i.TS)(e,function(a,b){var c=b.GROUP;return(0,i.Kg)(c)&&c!==V.SKIPPED&&(a[c]=[]),a},{}),z=(0,i.Tj)(g,function(a,b){return{pattern:g[b],longerAlt:l[b],canLineTerminator:s[b],isCustom:u[b],short:w[b],group:k[b],push:n[b],pop:r[b],tokenTypeIdx:h[b],tokenType:e[b]}})}),L=!0,M=[],d.safeMode||A("First Char Optimization",function(){M=(0,i.TS)(e,function(a,b,c){if("string"==typeof b.PATTERN){var e;I(a,J(b.PATTERN.charCodeAt(0)),z[c])}else if((0,i.cy)(b.START_CHARS_HINT))(0,i.jJ)(b.START_CHARS_HINT,function(b){var d=J("string"==typeof b?b.charCodeAt(0):b);e!==d&&(e=d,I(a,d,z[c]))});else if((0,i.gd)(b.PATTERN))if(b.PATTERN.unicode)L=!1,d.ensureOptimizations&&(0,i.Zi)(""+p+" Unable to analyze < "+b.PATTERN.toString()+" > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.\n This will disable the lexer's first char optimizations.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var f=function(a,b){void 0===b&&(b=!1);try{var c=m(a);return function a(b,c,d){switch(b.type){case"Disjunction":for(var e=0;e<b.value.length;e++)a(b.value[e],c,d);break;case"Alternative":for(var f=b.value,e=0;e<f.length;e++){var g=f[e];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}switch(g.type){case"Character":q(g.value,c,d);break;case"Set":if(!0===g.complement)throw Error(o);(0,i.jJ)(g.value,function(a){if("number"==typeof a)q(a,c,d);else if(!0===d)for(var b=a.from;b<=a.to;b++)q(b,c,d);else{for(var b=a.from;b<=a.to&&b<256;b++)q(b,c,d);if(a.to>=256)for(var e=a.from>=256?a.from:256,f=a.to,g=J(e),h=J(f),i=g;i<=h;i++)c[i]=i}});break;case"Group":a(g.value,c,d);break;default:throw Error("Non Exhaustive Match")}var h=void 0!==g.quantifier&&0===g.quantifier.atLeast;if("Group"===g.type&&!1===function a(b){return!!b.quantifier&&0===b.quantifier.atLeast||!!b.value&&((0,i.cy)(b.value)?(0,i.Si)(b.value,a):a(b.value))}(g)||"Group"!==g.type&&!1===h)break}break;default:throw Error("non exhaustive match!")}return(0,i.zu)(c)}(c.value,{},c.flags.ignoreCase)}catch(c){if(c.message===o)b&&(0,i.x5)(""+p+" Unable to optimize: < "+a.toString()+" >\n Complement Sets cannot be automatically optimized.\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var d="";b&&(d="\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),(0,i.Zi)(p+"\n Failed parsing: < "+a.toString()+" >\n Using the regexp-to-ast library version: "+j.VERSION+"\n Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+d)}}return[]}(b.PATTERN,d.ensureOptimizations);(0,i.Im)(f)&&(L=!1),(0,i.jJ)(f,function(b){I(a,b,z[c])})}else d.ensureOptimizations&&(0,i.Zi)(""+p+" TokenType: <"+b.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),L=!1;return a},[])}),A("ArrayPacking",function(){M=(0,i.VS)(M)}),f={emptyGroups:x,patternIdxToConfig:z,charCodeToPatternIdxToConfig:M,hasCustom:F,canBeOptimized:L}}),c.patternIdxToConfig[e]=f.patternIdxToConfig,c.charCodeToPatternIdxToConfig[e]=f.charCodeToPatternIdxToConfig,c.emptyGroups=(0,i.h1)(c.emptyGroups,f.emptyGroups),c.hasCustom=f.hasCustom||c.hasCustom,c.canModeBeOptimized[e]=f.canBeOptimized}})}),c.defaultMode=e.defaultMode,!(0,i.Im)(c.lexerDefinitionErrors)&&!c.config.deferDefinitionErrorsHandling)throw Error("Errors detected in definition of Lexer:\n"+(0,i.Tj)(c.lexerDefinitionErrors,function(a){return a.message}).join("-----------------------\n"));(0,i.jJ)(c.lexerDefinitionWarning,function(a){(0,i.x5)(a.message)}),c.TRACE_INIT("Choosing sub-methods implementations",function(){if(y?(c.chopInput=i.zK,c.match=c.matchWithTest):(c.updateLastIndex=i.tE,c.match=c.matchWithExec),f&&(c.handleModes=i.tE),!1===c.trackStartLines&&(c.computeNewColumn=i.zK),!1===c.trackEndLines&&(c.updateTokenEndLineColumnLocation=i.tE),/full/i.test(c.config.positionTracking))c.createTokenInstance=c.createFullToken;else if(/onlyStart/i.test(c.config.positionTracking))c.createTokenInstance=c.createStartOnlyToken;else if(/onlyOffset/i.test(c.config.positionTracking))c.createTokenInstance=c.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+c.config.positionTracking+'"');c.hasCustom?(c.addToken=c.addTokenUsingPush,c.handlePayload=c.handlePayloadWithCustom):(c.addToken=c.addTokenUsingMemberAccess,c.handlePayload=c.handlePayloadNoCustom)}),c.TRACE_INIT("Failed Optimization Warnings",function(){var a=(0,i.TS)(c.canModeBeOptimized,function(a,b,c){return!1===b&&a.push(c),a},[]);if(b.ensureOptimizations&&!(0,i.Im)(a))throw Error("Lexer Modes: < "+a.join(", ")+' > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n Or inspect the console log for details on how to resolve these issues.')}),c.TRACE_INIT("clearRegExpParserCache",function(){k={}}),c.TRACE_INIT("toFastProperties",function(){(0,i.Bl)(c)})})}return a.prototype.tokenize=function(a,b){if(void 0===b&&(b=this.defaultMode),!(0,i.Im)(this.lexerDefinitionErrors))throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+(0,i.Tj)(this.lexerDefinitionErrors,function(a){return a.message}).join("-----------------------\n"));return this.tokenizeInternal(a,b)},a.prototype.tokenizeInternal=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v=this,w=a,x=w.length,y=0,z=0,A=Array(this.hasCustom?0:Math.floor(a.length/10)),B=[],C=this.trackStartLines?1:void 0,D=this.trackStartLines?1:void 0,E=(c=this.emptyGroups,d={},e=(0,i.HP)(c),(0,i.jJ)(e,function(a){var b=c[a];if((0,i.cy)(b))d[a]=[];else throw Error("non exhaustive match")}),d),F=this.trackStartLines,G=this.config.lineTerminatorsPattern,H=0,I=[],K=[],L=[],M=[];Object.freeze(M);var N=void 0;function O(){return I}function P(a){var b=K[J(a)];return void 0===b?M:b}var Q=function(a){if(1===L.length&&void 0===a.tokenType.PUSH_MODE){var b=v.config.errorMessageProvider.buildUnableToPopLexerModeMessage(a);B.push({offset:a.startOffset,line:void 0!==a.startLine?a.startLine:void 0,column:void 0!==a.startColumn?a.startColumn:void 0,length:a.image.length,message:b})}else{L.pop();var c=(0,i.HV)(L);I=v.patternIdxToConfig[c],K=v.charCodeToPatternIdxToConfig[c],H=I.length;var d=v.canModeBeOptimized[c]&&!1===v.config.safeMode;N=K&&d?P:O}};function R(a){L.push(a),K=this.charCodeToPatternIdxToConfig[a],H=(I=this.patternIdxToConfig[a]).length,H=I.length;var b=this.canModeBeOptimized[a]&&!1===this.config.safeMode;N=K&&b?P:O}for(R.call(this,b);y<x;){k=null;var S=w.charCodeAt(y),T=N(S),U=T.length;for(f=0;f<U;f++){var V=(u=T[f]).pattern;l=null;var W=u.short;if(!1!==W?S===W&&(k=V):!0===u.isCustom?null!==(t=V.exec(w,y,A,E))?(k=t[0],void 0!==t.payload&&(l=t.payload)):k=null:(this.updateLastIndex(V,y),k=this.match(V,a,y)),null!==k){if(void 0!==(j=u.longerAlt)){var X=I[j],Y=X.pattern;m=null,!0===X.isCustom?null!==(t=Y.exec(w,y,A,E))?(h=t[0],void 0!==t.payload&&(m=t.payload)):h=null:(this.updateLastIndex(Y,y),h=this.match(Y,a,y)),h&&h.length>k.length&&(k=h,l=m,u=X)}break}}if(null!==k){if(n=k.length,void 0!==(o=u.group)&&(p=u.tokenTypeIdx,q=this.createTokenInstance(k,y,p,u.tokenType,C,D,n),this.handlePayload(q,l),!1===o?z=this.addToken(A,z,q):E[o].push(q)),a=this.chopInput(a,n),y+=n,D=this.computeNewColumn(D,n),!0===F&&!0===u.canLineTerminator){var Z=0,_=void 0,aa=void 0;G.lastIndex=0;do!0===(_=G.test(k))&&(aa=G.lastIndex-1,Z++);while(!0===_);0!==Z&&(C+=Z,D=n-aa,this.updateTokenEndLineColumnLocation(q,o,aa,Z,C,D,n))}this.handleModes(u,Q,R,q)}else{for(var ab=y,ac=C,ad=D,ae=!1;!ae&&y<x;)for(w.charCodeAt(y),a=this.chopInput(a,1),y++,g=0;g<H;g++){var af=I[g],V=af.pattern,W=af.short;if(!1!==W?w.charCodeAt(y)===W&&(ae=!0):!0===af.isCustom?ae=null!==V.exec(w,y,A,E):(this.updateLastIndex(V,y),ae=null!==V.exec(a)),!0===ae)break}r=y-ab,s=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(w,ab,r,ac,ad),B.push({offset:ab,line:ac,column:ad,length:r,message:s})}}return this.hasCustom||(A.length=z),{tokens:A,groups:E,errors:B}},a.prototype.handleModes=function(a,b,c,d){if(!0===a.pop){var e=a.push;b(d),void 0!==e&&c.call(this,e)}else void 0!==a.push&&c.call(this,a.push)},a.prototype.chopInput=function(a,b){return a.substring(b)},a.prototype.updateLastIndex=function(a,b){a.lastIndex=b},a.prototype.updateTokenEndLineColumnLocation=function(a,b,c,d,e,f,g){var h,i;void 0!==b&&(i=(h=c===g-1)?-1:0,(1!==d||!0!==h)&&(a.endLine=e+i,a.endColumn=f-1+-i))},a.prototype.computeNewColumn=function(a,b){return a+b},a.prototype.createTokenInstance=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];return null},a.prototype.createOffsetOnlyToken=function(a,b,c,d){return{image:a,startOffset:b,tokenTypeIdx:c,tokenType:d}},a.prototype.createStartOnlyToken=function(a,b,c,d,e,f){return{image:a,startOffset:b,startLine:e,startColumn:f,tokenTypeIdx:c,tokenType:d}},a.prototype.createFullToken=function(a,b,c,d,e,f,g){return{image:a,startOffset:b,endOffset:b+g-1,startLine:e,endLine:e,startColumn:f,endColumn:f+g-1,tokenTypeIdx:c,tokenType:d}},a.prototype.addToken=function(a,b,c){return 666},a.prototype.addTokenUsingPush=function(a,b,c){return a.push(c),b},a.prototype.addTokenUsingMemberAccess=function(a,b,c){return a[b]=c,++b},a.prototype.handlePayload=function(a,b){},a.prototype.handlePayloadNoCustom=function(a,b){},a.prototype.handlePayloadWithCustom=function(a,b){null!==b&&(a.payload=b)},a.prototype.match=function(a,b,c){return null},a.prototype.matchWithTest=function(a,b,c){return!0===a.test(b)?b.substring(c,a.lastIndex):null},a.prototype.matchWithExec=function(a,b){var c=a.exec(b);return null!==c?c[0]:c},a.prototype.TRACE_INIT=function(a,b){if(!0!==this.traceInitPerf)return b();this.traceInitIndent++;var c=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(c+"--\x3e <"+a+">");var d=(0,i.O1)(b),e=d.time,f=d.value,g=e>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&g(c+"<-- <"+a+"> time: "+e+"ms"),this.traceInitIndent--,f},a.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",a.NA=/NOT_APPLICABLE/,a}();function W(a){return Y(a)?a.LABEL:a.name}function X(a){return a.name}function Y(a){return(0,i.Kg)(a.LABEL)&&""!==a.LABEL}var Z="categories",_="label",aa="group",ab="push_mode",ac="pop_mode",ad="longer_alt",ae="line_breaks",af="start_chars_hint";function ag(a){return ah(a)}function ah(a){var b=a.pattern,c={};if(c.name=a.name,(0,i.b0)(b)||(c.PATTERN=b),(0,i.zy)(a,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return(0,i.zy)(a,Z)&&(c.CATEGORIES=a[Z]),P([c]),(0,i.zy)(a,_)&&(c.LABEL=a[_]),(0,i.zy)(a,aa)&&(c.GROUP=a[aa]),(0,i.zy)(a,ac)&&(c.POP_MODE=a[ac]),(0,i.zy)(a,ab)&&(c.PUSH_MODE=a[ab]),(0,i.zy)(a,ad)&&(c.LONGER_ALT=a[ad]),(0,i.zy)(a,ae)&&(c.LINE_BREAKS=a[ae]),(0,i.zy)(a,af)&&(c.START_CHARS_HINT=a[af]),c}var ai=ah({name:"EOF",pattern:V.NA});function aj(a,b,c,d,e,f,g,h){return{image:b,startOffset:c,endOffset:d,startLine:e,endLine:f,startColumn:g,endColumn:h,tokenTypeIdx:a.tokenTypeIdx,tokenType:a}}function ak(a,b){return L(a,b)}P([ai]);var al=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),am=function(){function a(a){this._definition=a}return Object.defineProperty(a.prototype,"definition",{get:function(){return this._definition},set:function(a){this._definition=a},enumerable:!1,configurable:!0}),a.prototype.accept=function(a){a.visit(this),(0,i.jJ)(this.definition,function(b){b.accept(a)})},a}(),an=function(a){function b(b){var c=a.call(this,[])||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),Object.defineProperty(b.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(a){},enumerable:!1,configurable:!0}),b.prototype.accept=function(a){a.visit(this)},b}(am),ao=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.orgText="",(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),ap=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.ignoreAmbiguities=!1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),aq=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),ar=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),as=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),at=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),au=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),av=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,c.ignoreAmbiguities=!1,c.hasPredicates=!1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),Object.defineProperty(b.prototype,"definition",{get:function(){return this._definition},set:function(a){this._definition=a},enumerable:!1,configurable:!0}),b}(am),aw=function(){function a(a){this.idx=1,(0,i.kp)(this,(0,i.Up)(a,function(a){return void 0!==a}))}return a.prototype.accept=function(a){a.visit(this)},a}();function ax(a){return(0,i.Tj)(a,ay)}function ay(a){function b(a){return(0,i.Tj)(a,ay)}if(a instanceof an)return{type:"NonTerminal",name:a.nonTerminalName,idx:a.idx};if(a instanceof ap)return{type:"Alternative",definition:b(a.definition)};if(a instanceof aq)return{type:"Option",idx:a.idx,definition:b(a.definition)};if(a instanceof ar)return{type:"RepetitionMandatory",idx:a.idx,definition:b(a.definition)};if(a instanceof as)return{type:"RepetitionMandatoryWithSeparator",idx:a.idx,separator:ay(new aw({terminalType:a.separator})),definition:b(a.definition)};else if(a instanceof au)return{type:"RepetitionWithSeparator",idx:a.idx,separator:ay(new aw({terminalType:a.separator})),definition:b(a.definition)};else if(a instanceof at)return{type:"Repetition",idx:a.idx,definition:b(a.definition)};else if(a instanceof av)return{type:"Alternation",idx:a.idx,definition:b(a.definition)};else if(a instanceof aw){var c={type:"Terminal",name:a.terminalType.name,label:W(a.terminalType),idx:a.idx},d=a.terminalType.PATTERN;return a.terminalType.PATTERN&&(c.pattern=(0,i.gd)(d)?d.source:d),c}else if(a instanceof ao)return{type:"Rule",name:a.name,orgText:a.orgText,definition:b(a.definition)};else throw Error("non exhaustive match")}var az=function(){function a(){}return a.prototype.walk=function(a,b){var c=this;void 0===b&&(b=[]),(0,i.jJ)(a.definition,function(d,e){var f=(0,i.gv)(a.definition,e+1);if(d instanceof an)c.walkProdRef(d,f,b);else if(d instanceof aw)c.walkTerminal(d,f,b);else if(d instanceof ap)c.walkFlat(d,f,b);else if(d instanceof aq)c.walkOption(d,f,b);else if(d instanceof ar)c.walkAtLeastOne(d,f,b);else if(d instanceof as)c.walkAtLeastOneSep(d,f,b);else if(d instanceof au)c.walkManySep(d,f,b);else if(d instanceof at)c.walkMany(d,f,b);else if(d instanceof av)c.walkOr(d,f,b);else throw Error("non exhaustive match")})},a.prototype.walkTerminal=function(a,b,c){},a.prototype.walkProdRef=function(a,b,c){},a.prototype.walkFlat=function(a,b,c){var d=b.concat(c);this.walk(a,d)},a.prototype.walkOption=function(a,b,c){var d=b.concat(c);this.walk(a,d)},a.prototype.walkAtLeastOne=function(a,b,c){var d=[new aq({definition:a.definition})].concat(b,c);this.walk(a,d)},a.prototype.walkAtLeastOneSep=function(a,b,c){var d=aA(a,b,c);this.walk(a,d)},a.prototype.walkMany=function(a,b,c){var d=[new aq({definition:a.definition})].concat(b,c);this.walk(a,d)},a.prototype.walkManySep=function(a,b,c){var d=aA(a,b,c);this.walk(a,d)},a.prototype.walkOr=function(a,b,c){var d=this,e=b.concat(c);(0,i.jJ)(a.definition,function(a){var b=new ap({definition:[a]});d.walk(b,e)})},a}();function aA(a,b,c){return[new aq({definition:[new aw({terminalType:a.separator})].concat(a.definition)})].concat(b,c)}var aB=function(){function a(){}return a.prototype.visit=function(a){switch(a.constructor){case an:return this.visitNonTerminal(a);case ap:return this.visitAlternative(a);case aq:return this.visitOption(a);case ar:return this.visitRepetitionMandatory(a);case as:return this.visitRepetitionMandatoryWithSeparator(a);case au:return this.visitRepetitionWithSeparator(a);case at:return this.visitRepetition(a);case av:return this.visitAlternation(a);case aw:return this.visitTerminal(a);case ao:return this.visitRule(a);default:throw Error("non exhaustive match")}},a.prototype.visitNonTerminal=function(a){},a.prototype.visitAlternative=function(a){},a.prototype.visitOption=function(a){},a.prototype.visitRepetition=function(a){},a.prototype.visitRepetitionMandatory=function(a){},a.prototype.visitRepetitionMandatoryWithSeparator=function(a){},a.prototype.visitRepetitionWithSeparator=function(a){},a.prototype.visitAlternation=function(a){},a.prototype.visitTerminal=function(a){},a.prototype.visitRule=function(a){},a}(),aC=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();function aD(a,b){return void 0===b&&(b=[]),a instanceof aq||a instanceof at||a instanceof au||(a instanceof av?(0,i.zN)(a.definition,function(a){return aD(a,b)}):!(a instanceof an&&(0,i.gR)(b,a))&&a instanceof am&&(a instanceof an&&b.push(a),(0,i.Si)(a.definition,function(a){return aD(a,b)})))}function aE(a){if(a instanceof an)return"SUBRULE";if(a instanceof aq)return"OPTION";if(a instanceof av)return"OR";if(a instanceof ar)return"AT_LEAST_ONE";if(a instanceof as)return"AT_LEAST_ONE_SEP";else if(a instanceof au)return"MANY_SEP";else if(a instanceof at)return"MANY";else if(a instanceof aw)return"CONSUME";else throw Error("non exhaustive match")}var aF=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.separator="-",b.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},b}return aC(b,a),b.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},b.prototype.visitTerminal=function(a){var b=a.terminalType.name+this.separator+"Terminal";(0,i.zy)(this.dslMethods,b)||(this.dslMethods[b]=[]),this.dslMethods[b].push(a)},b.prototype.visitNonTerminal=function(a){var b=a.nonTerminalName+this.separator+"Terminal";(0,i.zy)(this.dslMethods,b)||(this.dslMethods[b]=[]),this.dslMethods[b].push(a)},b.prototype.visitOption=function(a){this.dslMethods.option.push(a)},b.prototype.visitRepetitionWithSeparator=function(a){this.dslMethods.repetitionWithSeparator.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.dslMethods.repetitionMandatory.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.dslMethods.repetitionMandatoryWithSeparator.push(a)},b.prototype.visitRepetition=function(a){this.dslMethods.repetition.push(a)},b.prototype.visitAlternation=function(a){this.dslMethods.alternation.push(a)},b}(aB),aG=new aF;function aH(a){if(a instanceof an)return aH(a.referencedRule);if(a instanceof aw)return[a.terminalType];if(a instanceof ap||a instanceof aq||a instanceof at||a instanceof ar||a instanceof as||a instanceof au||a instanceof aw||a instanceof ao)return function(a){for(var b,c=[],d=a.definition,e=0,f=d.length>e,g=!0;f&&g;)g=aD(b=d[e]),c=c.concat(aH(b)),e+=1,f=d.length>e;return(0,i.sb)(c)}(a);if(a instanceof av){var b,c;return b=a,c=(0,i.Tj)(b.definition,function(a){return aH(a)}),(0,i.sb)((0,i.Bq)(c))}throw Error("non exhaustive match")}var aI="_~IN~_",aJ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aK=function(a){function b(b){var c=a.call(this)||this;return c.topProd=b,c.follows={},c}return aJ(b,a),b.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},b.prototype.walkTerminal=function(a,b,c){},b.prototype.walkProdRef=function(a,b,c){var d,e,f=(d=a.referencedRule,e=a.idx,d.name+e+aI+this.topProd.name),g=aH(new ap({definition:b.concat(c)}));this.follows[f]=g},b}(az),aL={buildMismatchTokenMessage:function(a){var b=a.expected,c=a.actual;return a.previous,a.ruleName,"Expecting "+(Y(b)?"--\x3e "+W(b)+" <--":"token of type --\x3e "+b.name+" <--")+" but found --\x3e '"+c.image+"' <--"},buildNotAllInputParsedMessage:function(a){var b=a.firstRedundant;return a.ruleName,"Redundant input, expecting EOF but found: "+b.image},buildNoViableAltMessage:function(a){var b=a.expectedPathsPerAlt,c=a.actual,d=(a.previous,a.customUserDescription);a.ruleName;var e="Expecting: ",f="\nbut found: '"+(0,i.$1)(c).image+"'";if(d)return e+d+f;var g=(0,i.TS)(b,function(a,b){return a.concat(b)},[]),h=(0,i.Tj)(g,function(a){return"["+(0,i.Tj)(a,function(a){return W(a)}).join(", ")+"]"});return e+"one of these possible Token sequences:\n"+(0,i.Tj)(h,function(a,b){return" "+(b+1)+". "+a}).join("\n")+f},buildEarlyExitMessage:function(a){var b=a.expectedIterationPaths,c=a.actual,d=a.customUserDescription;a.ruleName;var e="Expecting: ",f="\nbut found: '"+(0,i.$1)(c).image+"'";return d?e+d+f:e+("expecting at least one iteration which starts with one of these possible Token sequences::\n <"+(0,i.Tj)(b,function(a){return"["+(0,i.Tj)(a,function(a){return W(a)}).join(",")+"]"}).join(" ,"))+">"+f}};Object.freeze(aL);var aM={buildRuleNotFoundError:function(a,b){return"Invalid grammar, reference to a rule which is not defined: ->"+b.nonTerminalName+"<-\ninside top level rule: ->"+a.name+"<-"}},aN={buildDuplicateFoundError:function(a,b){var c=a.name,d=(0,i.$1)(b),e=d.idx,f=aE(d),g=d instanceof aw?d.terminalType.name:d instanceof an?d.nonTerminalName:"",h="->"+f+(e>0?e:"")+"<- "+(g?"with argument: ->"+g+"<-":"")+"\n appears more than once ("+b.length+" times) in the top level rule: ->"+c+"<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n ";return(h=h.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(a){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+a.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(a){var b=(0,i.Tj)(a.prefixPath,function(a){return W(a)}).join(", "),c=0===a.alternation.idx?"":a.alternation.idx;return"Ambiguous alternatives: <"+a.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\n"+("in <OR"+c+"> inside <")+a.topLevelRule.name+"> Rule,\n<"+b+"> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(a){var b=(0,i.Tj)(a.prefixPath,function(a){return W(a)}).join(", "),c=0===a.alternation.idx?"":a.alternation.idx,d="Ambiguous Alternatives Detected: <"+a.ambiguityIndices.join(" ,")+"> in <OR"+c+"> inside <"+a.topLevelRule.name+"> Rule,\n<"+b+"> may appears as a prefix path in all these alternatives.\n";return d+"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(a){var b=aE(a.repetition);return 0!==a.repetition.idx&&(b+=a.repetition.idx),"The repetition <"+b+"> within Rule <"+a.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(a){return"deprecated"},buildEmptyAlternationError:function(a){return"Ambiguous empty alternative: <"+(a.emptyChoiceIdx+1)+">"+(" in <OR"+a.alternation.idx+"> inside <")+a.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(a){return"An Alternation cannot have more than 256 alternatives:\n"+("<OR"+a.alternation.idx+"> inside <"+a.topLevelRule.name+"> Rule.\n has ")+(a.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(a){var b=a.topLevelRule.name,c=b+" --\x3e "+i.Tj(a.leftRecursionPath,function(a){return a.name}).concat([b]).join(" --\x3e ");return"Left Recursion found in grammar.\nrule: <"+b+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+c+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(a){return"deprecated"},buildDuplicateRuleNameError:function(a){return"Duplicate definition, rule: ->"+(a.topLevelRule instanceof ao?a.topLevelRule.name:a.topLevelRule)+"<- is already defined in the grammar: ->"+a.grammarName+"<-"}},aO=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aP=function(a){function b(b,c){var d=a.call(this)||this;return d.nameToTopRule=b,d.errMsgProvider=c,d.errors=[],d}return aO(b,a),b.prototype.resolveRefs=function(){var a=this;(0,i.jJ)((0,i.zu)(this.nameToTopRule),function(b){a.currTopLevel=b,b.accept(a)})},b.prototype.visitNonTerminal=function(a){var b=this.nameToTopRule[a.nonTerminalName];if(b)a.referencedRule=b;else{var c=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,a);this.errors.push({message:c,type:g.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:a.nonTerminalName})}},b}(aB),aQ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aR=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.path=c,d.nextTerminalName="",d.nextTerminalOccurrence=0,d.nextTerminalName=d.path.lastTok.name,d.nextTerminalOccurrence=d.path.lastTokOccurrence,d}return aQ(b,a),b.prototype.walkTerminal=function(a,b,c){if(this.isAtEndOfPath&&a.terminalType.name===this.nextTerminalName&&a.idx===this.nextTerminalOccurrence&&!this.found){var d=new ap({definition:b.concat(c)});this.possibleTokTypes=aH(d),this.found=!0}},b}(function(a){function b(b,c){var d=a.call(this)||this;return d.topProd=b,d.path=c,d.possibleTokTypes=[],d.nextProductionName="",d.nextProductionOccurrence=0,d.found=!1,d.isAtEndOfPath=!1,d}return aQ(b,a),b.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,i.T9)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,i.T9)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},b.prototype.walk=function(b,c){void 0===c&&(c=[]),this.found||a.prototype.walk.call(this,b,c)},b.prototype.walkProdRef=function(a,b,c){if(a.referencedRule.name===this.nextProductionName&&a.idx===this.nextProductionOccurrence){var d=b.concat(c);this.updateExpectedNext(),this.walk(a.referencedRule,d)}},b.prototype.updateExpectedNext=function(){(0,i.Im)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},b}(az)),aS=function(a){function b(b,c){var d=a.call(this)||this;return d.topRule=b,d.occurrence=c,d.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},d}return aQ(b,a),b.prototype.startWalking=function(){return this.walk(this.topRule),this.result},b}(az),aT=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkMany=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkMany.call(this,b,c,d)},b}(aS),aU=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkManySep=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkManySep.call(this,b,c,d)},b}(aS),aV=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkAtLeastOne=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkAtLeastOne.call(this,b,c,d)},b}(aS),aW=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkAtLeastOneSep=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkAtLeastOneSep.call(this,b,c,d)},b}(aS);function aX(a,b,c){void 0===c&&(c=[]),c=(0,i.T9)(c);var d=[],e=0;function f(f){var g=aX(f.concat((0,i.gv)(a,e+1)),b,c);return d.concat(g)}for(;c.length<b&&e<a.length;){var g=a[e];if(g instanceof ap)return f(g.definition);if(g instanceof an)return f(g.definition);if(g instanceof aq)d=f(g.definition);else if(g instanceof ar){var h=g.definition.concat([new at({definition:g.definition})]);return f(h)}else if(g instanceof as){var h=[new ap({definition:g.definition}),new at({definition:[new aw({terminalType:g.separator})].concat(g.definition)})];return f(h)}else if(g instanceof au){var h=g.definition.concat([new at({definition:[new aw({terminalType:g.separator})].concat(g.definition)})]);d=f(h)}else if(g instanceof at){var h=g.definition.concat([new at({definition:g.definition})]);d=f(h)}else if(g instanceof av)return(0,i.jJ)(g.definition,function(a){!1===(0,i.Im)(a.definition)&&(d=f(a.definition))}),d;else if(g instanceof aw)c.push(g.terminalType);else throw Error("non exhaustive match");e++}return d.push({partialPath:c,suffixDef:(0,i.gv)(a,e)}),d}function aY(a,b,c,d){var e="EXIT_NONE_TERMINAL",f=[e],g="EXIT_ALTERNATIVE",h=!1,j=b.length,k=j-d-1,l=[],m=[];for(m.push({idx:-1,def:a,ruleStack:[],occurrenceStack:[]});!(0,i.Im)(m);){var n=m.pop();if(n===g){h&&(0,i.HV)(m).idx<=k&&m.pop();continue}var o=n.def,p=n.idx,q=n.ruleStack,r=n.occurrenceStack;if(!(0,i.Im)(o)){var s=o[0];if(s===e){var t={idx:p,def:(0,i.gv)(o),ruleStack:(0,i.gc)(q),occurrenceStack:(0,i.gc)(r)};m.push(t)}else if(s instanceof aw)if(p<j-1){var u=p+1;if(c(b[u],s.terminalType)){var t={idx:u,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(t)}}else if(p===j-1)l.push({nextTokenType:s.terminalType,nextTokenOccurrence:s.idx,ruleStack:q,occurrenceStack:r}),h=!0;else throw Error("non exhaustive match");else if(s instanceof an){var v=(0,i.T9)(q);v.push(s.nonTerminalName);var w=(0,i.T9)(r);w.push(s.idx);var t={idx:p,def:s.definition.concat(f,(0,i.gv)(o)),ruleStack:v,occurrenceStack:w};m.push(t)}else if(s instanceof aq){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var y={idx:p,def:s.definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof ar){var z=new at({definition:s.definition,idx:s.idx}),A=s.definition.concat([z],(0,i.gv)(o)),t={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(t)}else if(s instanceof as){var B=new aw({terminalType:s.separator}),z=new at({definition:[B].concat(s.definition),idx:s.idx}),A=s.definition.concat([z],(0,i.gv)(o)),t={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(t)}else if(s instanceof au){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var B=new aw({terminalType:s.separator}),C=new at({definition:[B].concat(s.definition),idx:s.idx}),A=s.definition.concat([C],(0,i.gv)(o)),y={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof at){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var C=new at({definition:s.definition,idx:s.idx}),A=s.definition.concat([C],(0,i.gv)(o)),y={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof av)for(var D=s.definition.length-1;D>=0;D--){var E={idx:p,def:s.definition[D].definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r};m.push(E),m.push(g)}else if(s instanceof ap)m.push({idx:p,def:s.definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r});else if(s instanceof ao)m.push(function(a,b,c,d){var e=(0,i.T9)(c);e.push(a.name);var f=(0,i.T9)(d);return f.push(1),{idx:b,def:a.definition,ruleStack:e,occurrenceStack:f}}(s,p,q,r));else throw Error("non exhaustive match")}}return l}var aZ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();!function(a){a[a.OPTION=0]="OPTION",a[a.REPETITION=1]="REPETITION",a[a.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",a[a.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",a[a.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",a[a.ALTERNATION=5]="ALTERNATION"}(e||(e={}));var a$=function(a){function b(b,c,d){var e=a.call(this)||this;return e.topProd=b,e.targetOccurrence=c,e.targetProdType=d,e}return aZ(b,a),b.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},b.prototype.checkIsTarget=function(a,b,c,d){return a.idx===this.targetOccurrence&&this.targetProdType===b&&(this.restDef=c.concat(d),!0)},b.prototype.walkOption=function(b,c,d){this.checkIsTarget(b,e.OPTION,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkAtLeastOne=function(b,c,d){this.checkIsTarget(b,e.REPETITION_MANDATORY,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkAtLeastOneSep=function(b,c,d){this.checkIsTarget(b,e.REPETITION_MANDATORY_WITH_SEPARATOR,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkMany=function(b,c,d){this.checkIsTarget(b,e.REPETITION,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkManySep=function(b,c,d){this.checkIsTarget(b,e.REPETITION_WITH_SEPARATOR,c,d)||a.prototype.walkOption.call(this,b,c,d)},b}(az),a_=function(a){function b(b,c,d){var e=a.call(this)||this;return e.targetOccurrence=b,e.targetProdType=c,e.targetRef=d,e.result=[],e}return aZ(b,a),b.prototype.checkIsTarget=function(a,b){a.idx===this.targetOccurrence&&this.targetProdType===b&&(void 0===this.targetRef||a===this.targetRef)&&(this.result=a.definition)},b.prototype.visitOption=function(a){this.checkIsTarget(a,e.OPTION)},b.prototype.visitRepetition=function(a){this.checkIsTarget(a,e.REPETITION)},b.prototype.visitRepetitionMandatory=function(a){this.checkIsTarget(a,e.REPETITION_MANDATORY)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.checkIsTarget(a,e.REPETITION_MANDATORY_WITH_SEPARATOR)},b.prototype.visitRepetitionWithSeparator=function(a){this.checkIsTarget(a,e.REPETITION_WITH_SEPARATOR)},b.prototype.visitAlternation=function(a){this.checkIsTarget(a,e.ALTERNATION)},b}(aB);function a0(a){for(var b=Array(a),c=0;c<a;c++)b[c]=[];return b}function a1(a){for(var b=[""],c=0;c<a.length;c++){for(var d=a[c],e=[],f=0;f<b.length;f++){var g=b[f];e.push(g+"_"+d.tokenTypeIdx);for(var h=0;h<d.categoryMatches.length;h++){var i="_"+d.categoryMatches[h];e.push(g+i)}}b=e}return b}function a2(a,b){for(var c=(0,i.Tj)(a,function(a){return aX([a],1)}),d=a0(c.length),e=(0,i.Tj)(c,function(a){var b={};return(0,i.jJ)(a,function(a){var c=a1(a.partialPath);(0,i.jJ)(c,function(a){b[a]=!0})}),b}),f=c,g=1;g<=b;g++){var h=f;f=a0(h.length);for(var j=function(a){for(var c=h[a],j=0;j<c.length;j++){var k=c[j].partialPath,l=c[j].suffixDef,m=a1(k);if(function(a,b,c){for(var d=0;d<a.length;d++)if(d!==c){for(var e=a[d],f=0;f<b.length;f++)if(!0===e[b[f]])return!1}return!0}(e,m,a)||(0,i.Im)(l)||k.length===b){var n=d[a];if(!1===a5(n,k)){n.push(k);for(var o=0;o<m.length;o++){var p=m[o];e[a][p]=!0}}}else{var q=aX(l,g+1,k);f[a]=f[a].concat(q),(0,i.jJ)(q,function(b){var c=a1(b.partialPath);(0,i.jJ)(c,function(b){e[a][b]=!0})})}}},k=0;k<h.length;k++)j(k)}return d}function a3(a,b,c,d){var f=new a_(a,e.ALTERNATION,d);return b.accept(f),a2(f.result,c)}function a4(a,b,c,d){var e=new a_(a,c);b.accept(e);var f=e.result,g=new a$(b,a,c).startWalking();return a2([new ap({definition:f}),new ap({definition:g})],d)}function a5(a,b){f:for(var c=0;c<a.length;c++){var d=a[c];if(d.length===b.length){for(var e=0;e<d.length;e++){var f=b[e],g=d[e];if(!1==(f===g||void 0!==g.categoryMatchesMap[f.tokenTypeIdx]))continue f}return!0}}return!1}function a6(a){return(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return(0,i.Im)(a.categoryMatches)})})})}var a7=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();function a8(a){return aE(a)+"_#_"+a.idx+"_#_"+a9(a)}function a9(a){return a instanceof aw?a.terminalType.name:a instanceof an?a.nonTerminalName:""}var ba=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.allProductions=[],b}return a7(b,a),b.prototype.visitNonTerminal=function(a){this.allProductions.push(a)},b.prototype.visitOption=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetition=function(a){this.allProductions.push(a)},b.prototype.visitAlternation=function(a){this.allProductions.push(a)},b.prototype.visitTerminal=function(a){this.allProductions.push(a)},b}(aB),bb=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.alternations=[],b}return a7(b,a),b.prototype.visitAlternation=function(a){this.alternations.push(a)},b}(aB),bc=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.allProductions=[],b}return a7(b,a),b.prototype.visitRepetitionWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetition=function(a){this.allProductions.push(a)},b}(aB);function bd(a){a=(0,i.NT)(a,{errMsgProvider:aM});var b,c={};return(0,i.jJ)(a.rules,function(a){c[a.name]=a}),(b=new aP(c,a.errMsgProvider)).resolveRefs(),b.errors}function be(a){var b,c,d,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return b=(a=(0,i.NT)(a,{errMsgProvider:aN})).rules,c=a.maxLookahead,d=a.tokenTypes,f=a.errMsgProvider,h=a.grammarName,j=i.Tj(b,function(a){var b,c,d,e,h,j;return b=a,c=f,d=new ba,b.accept(d),e=d.allProductions,h=i.$z(e,a8),j=i.Up(h,function(a){return a.length>1}),i.Tj(i.zu(j),function(a){var d=i.$1(a),e=c.buildDuplicateFoundError(b,a),f=aE(d),h={message:e,type:g.DUPLICATE_PRODUCTIONS,ruleName:b.name,dslName:f,occurrence:d.idx},j=a9(d);return j&&(h.parameter=j),h})}),k=i.Tj(b,function(a){return function a(b,c,d,e){void 0===e&&(e=[]);var f=[],h=function a(b){var c=[];if(i.Im(b))return c;var d=i.$1(b);if(d instanceof an)c.push(d.referencedRule);else if(d instanceof ap||d instanceof aq||d instanceof ar||d instanceof as||d instanceof au||d instanceof at)c=c.concat(a(d.definition));else if(d instanceof av)c=i.Bq(i.Tj(d.definition,function(b){return a(b.definition)}));else if(d instanceof aw);else throw Error("non exhaustive match");var e=aD(d),f=b.length>1;if(!e||!f)return c;var g=i.gv(b);return c.concat(a(g))}(c.definition);if(i.Im(h))return[];var j=b.name;i.gR(h,b)&&f.push({message:d.buildLeftRecursionError({topLevelRule:b,leftRecursionPath:e}),type:g.LEFT_RECURSION,ruleName:j});var k=i.iv(h,e.concat([b])),l=i.Tj(k,function(c){var f=i.T9(e);return f.push(c),a(b,c,d,f)});return f.concat(i.Bq(l))}(a,a,f)}),l=[],m=[],n=[],(0,i.Si)(k,i.Im)&&(l=(0,i.Tj)(b,function(a){var b,c,d,e;return b=a,c=f,d=new bb,b.accept(d),e=d.alternations,i.TS(e,function(a,d){var e=i.gc(d.definition),f=i.Tj(e,function(a,e){var f=aY([a],[],null,1);return i.Im(f)?{message:c.buildEmptyAlternationError({topLevelRule:b,alternation:d,emptyChoiceIdx:e}),type:g.NONE_LAST_EMPTY_ALT,ruleName:b.name,occurrence:d.idx,alternative:e+1}:null});return a.concat(i.oE(f))},[])}),m=(0,i.Tj)(b,function(a){var b,d,e,h,j;return b=a,d=c,e=f,h=new bb,b.accept(h),j=h.alternations,j=(0,i.ku)(j,function(a){return!0===a.ignoreAmbiguities}),i.TS(j,function(a,c){var f,h,j,k,l,m,n,o,p,q,r,s,t=a3(c.idx,b,c.maxLookahead||d,c),u=(f=t,h=c,j=b,k=e,l=[],m=(0,i.TS)(f,function(a,b,c){return!0===h.definition[c].ignoreAmbiguities||(0,i.jJ)(b,function(b){var d=[c];(0,i.jJ)(f,function(a,e){c!==e&&a5(a,b)&&!0!==h.definition[e].ignoreAmbiguities&&d.push(e)}),d.length>1&&!a5(l,b)&&(l.push(b),a.push({alts:d,path:b}))}),a},[]),i.Tj(m,function(a){var b=(0,i.Tj)(a.alts,function(a){return a+1});return{message:k.buildAlternationAmbiguityError({topLevelRule:j,alternation:h,ambiguityIndices:b,prefixPath:a.path}),type:g.AMBIGUOUS_ALTS,ruleName:j.name,occurrence:h.idx,alternatives:[a.alts]}})),v=(n=t,o=c,p=b,q=e,r=[],s=(0,i.TS)(n,function(a,b,c){var d=(0,i.Tj)(b,function(a){return{idx:c,path:a}});return a.concat(d)},[]),(0,i.jJ)(s,function(a){if(!0!==o.definition[a.idx].ignoreAmbiguities){var b=a.idx,c=a.path,d=(0,i.JW)(s,function(a){var d;return!0!==o.definition[a.idx].ignoreAmbiguities&&a.idx<b&&(d=a.path,d.length<c.length&&(0,i.Si)(d,function(a,b){var d=c[b];return a===d||d.categoryMatchesMap[a.tokenTypeIdx]}))}),e=(0,i.Tj)(d,function(a){var c=[a.idx+1,b+1],d=0===o.idx?"":o.idx;return{message:q.buildAlternationPrefixAmbiguityError({topLevelRule:p,alternation:o,ambiguityIndices:c,prefixPath:a.path}),type:g.AMBIGUOUS_PREFIX_ALTS,ruleName:p.name,occurrence:d,alternatives:c}});r=r.concat(e)}}),r);return a.concat(u,v)},[])}),r=b,s=c,t=f,u=[],(0,i.jJ)(r,function(a){var b=new bc;a.accept(b);var c=b.allProductions;(0,i.jJ)(c,function(b){var c=function(a){if(a instanceof aq)return e.OPTION;if(a instanceof at)return e.REPETITION;if(a instanceof ar)return e.REPETITION_MANDATORY;if(a instanceof as)return e.REPETITION_MANDATORY_WITH_SEPARATOR;if(a instanceof au)return e.REPETITION_WITH_SEPARATOR;else if(a instanceof av)return e.ALTERNATION;else throw Error("non exhaustive match")}(b),d=b.maxLookahead||s,f=a4(b.idx,a,c,d)[0];if((0,i.Im)((0,i.Bq)(f))){var h=t.buildEmptyRepetitionError({topLevelRule:a,repetition:b});u.push({message:h,type:g.NO_NON_EMPTY_LOOKAHEAD,ruleName:a.name})}})}),n=u),v=b,w=d,x=f,y=[],z=(0,i.Tj)(w,function(a){return a.name}),(0,i.jJ)(v,function(a){var b=a.name;if((0,i.gR)(z,b)){var c=x.buildNamespaceConflictError(a);y.push({message:c,type:g.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:b})}}),o=y,p=(0,i.Tj)(b,function(a){var b,c,d,e;return b=a,c=f,d=new bb,b.accept(d),e=d.alternations,i.TS(e,function(a,d){return d.definition.length>255&&a.push({message:c.buildTooManyAlternativesError({topLevelRule:b,alternation:d}),type:g.TOO_MANY_ALTS,ruleName:b.name,occurrence:d.idx}),a},[])}),q=(0,i.Tj)(b,function(a){var c=a,d=b,e=h,j=f,k=[];if((0,i.TS)(d,function(a,b){return b.name===c.name?a+1:a},0)>1){var l=j.buildDuplicateRuleNameError({topLevelRule:c,grammarName:e});k.push({message:l,type:g.DUPLICATE_RULE_NAME,ruleName:c.name})}return k}),i.Bq(j.concat(n,k,l,m,o,p,q))}function bf(a){(0,i.jJ)(a.rules,function(a){var b=new aF;a.accept(b),(0,i.jJ)(b.dslMethods,function(a){(0,i.jJ)(a,function(a,b){a.idx=b+1})})})}var bg=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),bh="MismatchedTokenException",bi="NoViableAltException",bj="EarlyExitException",bk="NotAllInputParsedException",bl=[bh,bi,bj,bk];function bm(a){return(0,i.gR)(bl,a.name)}Object.freeze(bl);var bn=function(a){function b(b,c){var d=this.constructor,e=a.call(this,b)||this;return e.token=c,e.resyncedTokens=[],Object.setPrototypeOf(e,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,e.constructor),e}return bg(b,a),b}(Error),bo=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bh,e}return bg(b,a),b}(bn),bp=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bi,e}return bg(b,a),b}(bn),bq=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.name=bk,d}return bg(b,a),b}(bn),br=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bj,e}return bg(b,a),b}(bn),bs={},bt="InRuleRecoveryException";function bu(a){this.name=bt,this.message=a}bu.prototype=Error.prototype;var bv=function(){function a(){}return a.prototype.initRecoverable=function(a){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,i.zy)(a,"recoveryEnabled")?a.recoveryEnabled:bX.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bw)},a.prototype.getTokenToInsert=function(a){var b=aj(a,"",NaN,NaN,NaN,NaN,NaN,NaN);return b.isInsertedInRecovery=!0,b},a.prototype.canTokenTypeBeInsertedInRecovery=function(a){return!0},a.prototype.tryInRepetitionRecovery=function(a,b,c,d){for(var e=this,f=this.findReSyncTokenType(),g=this.exportLexerState(),h=[],j=!1,k=this.LA(1),l=this.LA(1),m=function(){var a=e.LA(0),b=new bo(e.errorMessageProvider.buildMismatchTokenMessage({expected:d,actual:k,previous:a,ruleName:e.getCurrRuleFullName()}),k,e.LA(0));b.resyncedTokens=(0,i.gc)(h),e.SAVE_ERROR(b)};!j;)if(this.tokenMatcher(l,d))return void m();else if(c.call(this)){m(),a.apply(this,b);return}else this.tokenMatcher(l,f)?j=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,h));this.importLexerState(g)},a.prototype.shouldInRepetitionRecoveryBeTried=function(a,b,c){return!(!1===c||void 0===a||void 0===b||this.tokenMatcher(this.LA(1),a)||this.isBackTracking()||this.canPerformInRuleRecovery(a,this.getFollowsForInRuleRecovery(a,b)))},a.prototype.getFollowsForInRuleRecovery=function(a,b){var c=this.getCurrentGrammarPath(a,b);return this.getNextPossibleTokenTypes(c)},a.prototype.tryInRuleRecovery=function(a,b){if(this.canRecoverWithSingleTokenInsertion(a,b))return this.getTokenToInsert(a);if(this.canRecoverWithSingleTokenDeletion(a)){var c=this.SKIP_TOKEN();return this.consumeToken(),c}throw new bu("sad sad panda")},a.prototype.canPerformInRuleRecovery=function(a,b){return this.canRecoverWithSingleTokenInsertion(a,b)||this.canRecoverWithSingleTokenDeletion(a)},a.prototype.canRecoverWithSingleTokenInsertion=function(a,b){var c=this;if(!this.canTokenTypeBeInsertedInRecovery(a)||(0,i.Im)(b))return!1;var d=this.LA(1);return void 0!==(0,i.I6)(b,function(a){return c.tokenMatcher(d,a)})},a.prototype.canRecoverWithSingleTokenDeletion=function(a){return this.tokenMatcher(this.LA(2),a)},a.prototype.isInCurrentRuleReSyncSet=function(a){var b=this.getCurrFollowKey(),c=this.getFollowSetFromFollowKey(b);return(0,i.gR)(c,a)},a.prototype.findReSyncTokenType=function(){for(var a=this.flattenFollowSet(),b=this.LA(1),c=2;;){var d=b.tokenType;if((0,i.gR)(a,d))return d;b=this.LA(c),c++}},a.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return bs;var a=this.getLastExplicitRuleShortName(),b=this.getLastExplicitRuleOccurrenceIndex(),c=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(a),idxInCallingRule:b,inRule:this.shortRuleNameToFullName(c)}},a.prototype.buildFullFollowKeyStack=function(){var a=this,b=this.RULE_STACK,c=this.RULE_OCCURRENCE_STACK;return(0,i.Tj)(b,function(d,e){return 0===e?bs:{ruleName:a.shortRuleNameToFullName(d),idxInCallingRule:c[e],inRule:a.shortRuleNameToFullName(b[e-1])}})},a.prototype.flattenFollowSet=function(){var a=this,b=(0,i.Tj)(this.buildFullFollowKeyStack(),function(b){return a.getFollowSetFromFollowKey(b)});return(0,i.Bq)(b)},a.prototype.getFollowSetFromFollowKey=function(a){if(a===bs)return[ai];var b=a.ruleName+a.idxInCallingRule+aI+a.inRule;return this.resyncFollows[b]},a.prototype.addToResyncTokens=function(a,b){return this.tokenMatcher(a,ai)||b.push(a),b},a.prototype.reSyncTo=function(a){for(var b=[],c=this.LA(1);!1===this.tokenMatcher(c,a);)c=this.SKIP_TOKEN(),this.addToResyncTokens(c,b);return(0,i.gc)(b)},a.prototype.attemptInRepetitionRecovery=function(a,b,c,d,e,f,g){},a.prototype.getCurrentGrammarPath=function(a,b){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:(0,i.T9)(this.RULE_OCCURRENCE_STACK),lastTok:a,lastTokOccurrence:b}},a.prototype.getHumanReadableRuleStack=function(){var a=this;return(0,i.Tj)(this.RULE_STACK,function(b){return a.shortRuleNameToFullName(b)})},a}();function bw(a,b,c,d,e,f,g){var h=this.getKeyForAutomaticLookahead(d,e),i=this.firstAfterRepMap[h];if(void 0===i){var j=this.getCurrRuleFullName();i=new f(this.getGAstProductions()[j],e).startWalking(),this.firstAfterRepMap[h]=i}var k=i.token,l=i.occurrence,m=i.isEndOfRule;1===this.RULE_STACK.length&&m&&void 0===k&&(k=ai,l=1),this.shouldInRepetitionRecoveryBeTried(k,l,g)&&this.tryInRepetitionRecovery(a,b,c,k)}var bx=function(){function a(){}return a.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=(0,i.zy)(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:bX.dynamicTokensEnabled,this.maxLookahead=(0,i.zy)(a,"maxLookahead")?a.maxLookahead:bX.maxLookahead,this.lookAheadFuncsCache=(0,i.rF)()?new Map:[],(0,i.rF)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},a.prototype.preComputeLookaheadFunctions=function(a){var b=this;(0,i.jJ)(a,function(a){b.TRACE_INIT(a.name+" Rule Lookahead",function(){var c,d=(aG.reset(),a.accept(aG),c=aG.dslMethods,aG.reset(),c),f=d.alternation,g=d.repetition,h=d.option,j=d.repetitionMandatory,k=d.repetitionMandatoryWithSeparator,l=d.repetitionWithSeparator;(0,i.jJ)(f,function(c){var d=0===c.idx?"":c.idx;b.TRACE_INIT(""+aE(c)+d,function(){var d,e,f,g,h,i,j,k,l=(d=c.idx,e=c.maxLookahead||b.maxLookahead,f=c.hasPredicates,g=b.dynamicTokensEnabled,h=b.lookAheadBuilderForAlternatives,j=a6(i=a3(d,a,e))?M:L,h(i,f,j,g)),m=(k=b.fullRuleNameToShort[a.name],256|c.idx|k);b.setLaFuncCache(m,l)})}),(0,i.jJ)(g,function(c){b.computeLookaheadFunc(a,c.idx,768,e.REPETITION,c.maxLookahead,aE(c))}),(0,i.jJ)(h,function(c){b.computeLookaheadFunc(a,c.idx,512,e.OPTION,c.maxLookahead,aE(c))}),(0,i.jJ)(j,function(c){b.computeLookaheadFunc(a,c.idx,1024,e.REPETITION_MANDATORY,c.maxLookahead,aE(c))}),(0,i.jJ)(k,function(c){b.computeLookaheadFunc(a,c.idx,1536,e.REPETITION_MANDATORY_WITH_SEPARATOR,c.maxLookahead,aE(c))}),(0,i.jJ)(l,function(c){b.computeLookaheadFunc(a,c.idx,1280,e.REPETITION_WITH_SEPARATOR,c.maxLookahead,aE(c))})})})},a.prototype.computeLookaheadFunc=function(a,b,c,d,e,f){var g=this;this.TRACE_INIT(""+f+(0===b?"":b),function(){var f,h,i,j,k,l=(f=e||g.maxLookahead,h=g.dynamicTokensEnabled,i=g.lookAheadBuilderForOptional,k=a6(j=a4(b,a,d,f))?M:L,i(j[0],k,h)),m=b|c|g.fullRuleNameToShort[a.name];g.setLaFuncCache(m,l)})},a.prototype.lookAheadBuilderForOptional=function(a,b,c){return function(a,b,c){var d=(0,i.Si)(a,function(a){return 1===a.length}),e=a.length;if(!d||c)return function(){g:for(var c=0;c<e;c++){for(var d=a[c],f=d.length,g=0;g<f;g++)if(!1===b(this.LA(g+1),d[g]))continue g;return!0}return!1};var f=(0,i.Bq)(a);if(1===f.length&&(0,i.Im)(f[0].categoryMatches)){var g=f[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===g}}var h=(0,i.TS)(f,function(a,b,c){return a[b.tokenTypeIdx]=!0,(0,i.jJ)(b.categoryMatches,function(b){a[b]=!0}),a},[]);return function(){return!0===h[this.LA(1).tokenTypeIdx]}}(a,b,c)},a.prototype.lookAheadBuilderForAlternatives=function(a,b,c,d){var e=a.length,f=(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return 1===a.length})});if(b)return function(b){for(var d=(0,i.Tj)(b,function(a){return a.GATE}),f=0;f<e;f++){var g=a[f],h=g.length,j=d[f];if(void 0===j||!1!==j.call(this))g:for(var k=0;k<h;k++){for(var l=g[k],m=l.length,n=0;n<m;n++)if(!1===c(this.LA(n+1),l[n]))continue g;return f}}};if(!f||d)return function(){for(var b=0;b<e;b++){var d=a[b],f=d.length;g:for(var g=0;g<f;g++){for(var h=d[g],i=h.length,j=0;j<i;j++)if(!1===c(this.LA(j+1),h[j]))continue g;return b}}};var g=(0,i.Tj)(a,function(a){return(0,i.Bq)(a)}),h=(0,i.TS)(g,function(a,b,c){return(0,i.jJ)(b,function(b){(0,i.zy)(a,b.tokenTypeIdx)||(a[b.tokenTypeIdx]=c),(0,i.jJ)(b.categoryMatches,function(b){(0,i.zy)(a,b)||(a[b]=c)})}),a},[]);return function(){return h[this.LA(1).tokenTypeIdx]}},a.prototype.getKeyForAutomaticLookahead=function(a,b){return b|a|this.getLastExplicitRuleShortName()},a.prototype.getLaFuncFromCache=function(a){},a.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},a.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},a.prototype.setLaFuncCache=function(a,b){},a.prototype.setLaFuncCacheUsingMap=function(a,b){this.lookAheadFuncsCache.set(a,b)},a.prototype.setLaFuncUsingObj=function(a,b){this.lookAheadFuncsCache[a]=b},a}();function by(a,b){!0===isNaN(a.startOffset)?(a.startOffset=b.startOffset,a.endOffset=b.endOffset):a.endOffset<b.endOffset==!0&&(a.endOffset=b.endOffset)}function bz(a,b){!0===isNaN(a.startOffset)?(a.startOffset=b.startOffset,a.startColumn=b.startColumn,a.startLine=b.startLine,a.endOffset=b.endOffset,a.endColumn=b.endColumn,a.endLine=b.endLine):a.endOffset<b.endOffset==!0&&(a.endOffset=b.endOffset,a.endColumn=b.endColumn,a.endLine=b.endLine)}var bA="name";function bB(a){var b=a.name;return b||"anonymous"}function bC(a,b){var c=Object.getOwnPropertyDescriptor(a,bA);return(!!(0,i.b0)(c)||!!c.configurable)&&(Object.defineProperty(a,bA,{enumerable:!1,configurable:!0,writable:!1,value:b}),!0)}function bD(a,b){for(var c=(0,i.HP)(a),d=c.length,e=0;e<d;e++)for(var f=a[c[e]],g=f.length,h=0;h<g;h++){var j=f[h];void 0===j.tokenTypeIdx&&this[j.name](j.children,b)}}!function(a){a[a.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",a[a.MISSING_METHOD=1]="MISSING_METHOD"}(f||(f={}));var bE=["constructor","visit","validateVisitor"],bF=function(){function a(){}return a.prototype.initTreeBuilder=function(a){if(this.CST_STACK=[],this.outputCst=a.outputCst,this.nodeLocationTracking=(0,i.zy)(a,"nodeLocationTracking")?a.nodeLocationTracking:bX.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=bz,this.setNodeLocationFromNode=bz,this.cstPostRule=i.tE,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=by,this.setNodeLocationFromNode=by,this.cstPostRule=i.tE,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=i.tE,this.setInitialNodeLocation=i.tE;else throw Error('Invalid <nodeLocationTracking> config option: "'+a.nodeLocationTracking+'"');else this.cstInvocationStateUpdate=i.tE,this.cstFinallyStateUpdate=i.tE,this.cstPostTerminal=i.tE,this.cstPostNonTerminal=i.tE,this.cstPostRule=i.tE},a.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(a){a.location={startOffset:NaN,endOffset:NaN}},a.prototype.setInitialNodeLocationOnlyOffsetRegular=function(a){a.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},a.prototype.setInitialNodeLocationFullRecovery=function(a){a.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},a.prototype.setInitialNodeLocationFullRegular=function(a){var b=this.LA(1);a.location={startOffset:b.startOffset,startLine:b.startLine,startColumn:b.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},a.prototype.cstInvocationStateUpdate=function(a,b){var c={name:a,children:{}};this.setInitialNodeLocation(c),this.CST_STACK.push(c)},a.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},a.prototype.cstPostRuleFull=function(a){var b=this.LA(0),c=a.location;c.startOffset<=b.startOffset==!0?(c.endOffset=b.endOffset,c.endLine=b.endLine,c.endColumn=b.endColumn):(c.startOffset=NaN,c.startLine=NaN,c.startColumn=NaN)},a.prototype.cstPostRuleOnlyOffset=function(a){var b=this.LA(0),c=a.location;c.startOffset<=b.startOffset==!0?c.endOffset=b.endOffset:c.startOffset=NaN},a.prototype.cstPostTerminal=function(a,b){var c=this.CST_STACK[this.CST_STACK.length-1];void 0===c.children[a]?c.children[a]=[b]:c.children[a].push(b),this.setNodeLocationFromToken(c.location,b)},a.prototype.cstPostNonTerminal=function(a,b){var c=this.CST_STACK[this.CST_STACK.length-1];void 0===c.children[b]?c.children[b]=[a]:c.children[b].push(a),this.setNodeLocationFromNode(c.location,a.location)},a.prototype.getBaseCstVisitorConstructor=function(){if((0,i.b0)(this.baseCstVisitorConstructor)){var a,b,c,d=(a=this.className,b=(0,i.HP)(this.gastProductionsCache),bC(c=function(){},a+"BaseSemantics"),c.prototype={visit:function(a,b){if((0,i.cy)(a)&&(a=a[0]),!(0,i.b0)(a))return this[a.name](a.children,b)},validateVisitor:function(){var a,c,d,e,g,h,j,k=(a=this,c=b,h=(d=a,e=c,g=(0,i.Tj)(e,function(a){if(!(0,i.Tn)(d[a]))return{msg:"Missing visitor method: <"+a+"> on "+bB(d.constructor)+" CST Visitor.",type:f.MISSING_METHOD,methodName:a}}),(0,i.oE)(g)),j=function(a,b){var c=[];for(var d in a)!(0,i.Tn)(a[d])||(0,i.gR)(bE,d)||(0,i.gR)(b,d)||c.push({msg:"Redundant visitor method: <"+d+"> on "+bB(a.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\n",type:f.REDUNDANT_METHOD,methodName:d});return c}(a,c),h.concat(j));if(!(0,i.Im)(k)){var l=(0,i.Tj)(k,function(a){return a.msg});throw Error("Errors Detected in CST Visitor <"+bB(this.constructor)+">:\n "+l.join("\n\n").replace(/\n/g,"\n "))}}},c.prototype.constructor=c,c._RULE_NAMES=b,c);return this.baseCstVisitorConstructor=d,d}return this.baseCstVisitorConstructor},a.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,i.b0)(this.baseCstVisitorWithDefaultsConstructor)){var a,b,c,d,e,f=(a=this.className,b=(0,i.HP)(this.gastProductionsCache),c=this.getBaseCstVisitorConstructor(),bC(d=function(){},a+"BaseSemanticsWithDefaults"),e=Object.create(c.prototype),(0,i.jJ)(b,function(a){e[a]=bD}),d.prototype=e,d.prototype.constructor=d,d);return this.baseCstVisitorWithDefaultsConstructor=f,f}return this.baseCstVisitorWithDefaultsConstructor},a.prototype.getLastExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-1]},a.prototype.getPreviousExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-2]},a.prototype.getLastExplicitRuleOccurrenceIndex=function(){var a=this.RULE_OCCURRENCE_STACK;return a[a.length-1]},a}(),bG=function(){function a(){}return a.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(a.prototype,"input",{get:function(){return this.tokVector},set:function(a){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=a,this.tokVectorLength=a.length},enumerable:!1,configurable:!0}),a.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):bW},a.prototype.LA=function(a){var b=this.currIdx+a;return b<0||this.tokVectorLength<=b?bW:this.tokVector[b]},a.prototype.consumeToken=function(){this.currIdx++},a.prototype.exportLexerState=function(){return this.currIdx},a.prototype.importLexerState=function(a){this.currIdx=a},a.prototype.resetLexerState=function(){this.currIdx=-1},a.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},a.prototype.getLexerPosition=function(){return this.exportLexerState()},a}(),bH=function(){function a(){}return a.prototype.ACTION=function(a){return a.call(this)},a.prototype.consume=function(a,b,c){return this.consumeInternal(b,a,c)},a.prototype.subrule=function(a,b,c){return this.subruleInternal(b,a,c)},a.prototype.option=function(a,b){return this.optionInternal(b,a)},a.prototype.or=function(a,b){return this.orInternal(b,a)},a.prototype.many=function(a,b){return this.manyInternal(a,b)},a.prototype.atLeastOne=function(a,b){return this.atLeastOneInternal(a,b)},a.prototype.CONSUME=function(a,b){return this.consumeInternal(a,0,b)},a.prototype.CONSUME1=function(a,b){return this.consumeInternal(a,1,b)},a.prototype.CONSUME2=function(a,b){return this.consumeInternal(a,2,b)},a.prototype.CONSUME3=function(a,b){return this.consumeInternal(a,3,b)},a.prototype.CONSUME4=function(a,b){return this.consumeInternal(a,4,b)},a.prototype.CONSUME5=function(a,b){return this.consumeInternal(a,5,b)},a.prototype.CONSUME6=function(a,b){return this.consumeInternal(a,6,b)},a.prototype.CONSUME7=function(a,b){return this.consumeInternal(a,7,b)},a.prototype.CONSUME8=function(a,b){return this.consumeInternal(a,8,b)},a.prototype.CONSUME9=function(a,b){return this.consumeInternal(a,9,b)},a.prototype.SUBRULE=function(a,b){return this.subruleInternal(a,0,b)},a.prototype.SUBRULE1=function(a,b){return this.subruleInternal(a,1,b)},a.prototype.SUBRULE2=function(a,b){return this.subruleInternal(a,2,b)},a.prototype.SUBRULE3=function(a,b){return this.subruleInternal(a,3,b)},a.prototype.SUBRULE4=function(a,b){return this.subruleInternal(a,4,b)},a.prototype.SUBRULE5=function(a,b){return this.subruleInternal(a,5,b)},a.prototype.SUBRULE6=function(a,b){return this.subruleInternal(a,6,b)},a.prototype.SUBRULE7=function(a,b){return this.subruleInternal(a,7,b)},a.prototype.SUBRULE8=function(a,b){return this.subruleInternal(a,8,b)},a.prototype.SUBRULE9=function(a,b){return this.subruleInternal(a,9,b)},a.prototype.OPTION=function(a){return this.optionInternal(a,0)},a.prototype.OPTION1=function(a){return this.optionInternal(a,1)},a.prototype.OPTION2=function(a){return this.optionInternal(a,2)},a.prototype.OPTION3=function(a){return this.optionInternal(a,3)},a.prototype.OPTION4=function(a){return this.optionInternal(a,4)},a.prototype.OPTION5=function(a){return this.optionInternal(a,5)},a.prototype.OPTION6=function(a){return this.optionInternal(a,6)},a.prototype.OPTION7=function(a){return this.optionInternal(a,7)},a.prototype.OPTION8=function(a){return this.optionInternal(a,8)},a.prototype.OPTION9=function(a){return this.optionInternal(a,9)},a.prototype.OR=function(a){return this.orInternal(a,0)},a.prototype.OR1=function(a){return this.orInternal(a,1)},a.prototype.OR2=function(a){return this.orInternal(a,2)},a.prototype.OR3=function(a){return this.orInternal(a,3)},a.prototype.OR4=function(a){return this.orInternal(a,4)},a.prototype.OR5=function(a){return this.orInternal(a,5)},a.prototype.OR6=function(a){return this.orInternal(a,6)},a.prototype.OR7=function(a){return this.orInternal(a,7)},a.prototype.OR8=function(a){return this.orInternal(a,8)},a.prototype.OR9=function(a){return this.orInternal(a,9)},a.prototype.MANY=function(a){this.manyInternal(0,a)},a.prototype.MANY1=function(a){this.manyInternal(1,a)},a.prototype.MANY2=function(a){this.manyInternal(2,a)},a.prototype.MANY3=function(a){this.manyInternal(3,a)},a.prototype.MANY4=function(a){this.manyInternal(4,a)},a.prototype.MANY5=function(a){this.manyInternal(5,a)},a.prototype.MANY6=function(a){this.manyInternal(6,a)},a.prototype.MANY7=function(a){this.manyInternal(7,a)},a.prototype.MANY8=function(a){this.manyInternal(8,a)},a.prototype.MANY9=function(a){this.manyInternal(9,a)},a.prototype.MANY_SEP=function(a){this.manySepFirstInternal(0,a)},a.prototype.MANY_SEP1=function(a){this.manySepFirstInternal(1,a)},a.prototype.MANY_SEP2=function(a){this.manySepFirstInternal(2,a)},a.prototype.MANY_SEP3=function(a){this.manySepFirstInternal(3,a)},a.prototype.MANY_SEP4=function(a){this.manySepFirstInternal(4,a)},a.prototype.MANY_SEP5=function(a){this.manySepFirstInternal(5,a)},a.prototype.MANY_SEP6=function(a){this.manySepFirstInternal(6,a)},a.prototype.MANY_SEP7=function(a){this.manySepFirstInternal(7,a)},a.prototype.MANY_SEP8=function(a){this.manySepFirstInternal(8,a)},a.prototype.MANY_SEP9=function(a){this.manySepFirstInternal(9,a)},a.prototype.AT_LEAST_ONE=function(a){this.atLeastOneInternal(0,a)},a.prototype.AT_LEAST_ONE1=function(a){return this.atLeastOneInternal(1,a)},a.prototype.AT_LEAST_ONE2=function(a){this.atLeastOneInternal(2,a)},a.prototype.AT_LEAST_ONE3=function(a){this.atLeastOneInternal(3,a)},a.prototype.AT_LEAST_ONE4=function(a){this.atLeastOneInternal(4,a)},a.prototype.AT_LEAST_ONE5=function(a){this.atLeastOneInternal(5,a)},a.prototype.AT_LEAST_ONE6=function(a){this.atLeastOneInternal(6,a)},a.prototype.AT_LEAST_ONE7=function(a){this.atLeastOneInternal(7,a)},a.prototype.AT_LEAST_ONE8=function(a){this.atLeastOneInternal(8,a)},a.prototype.AT_LEAST_ONE9=function(a){this.atLeastOneInternal(9,a)},a.prototype.AT_LEAST_ONE_SEP=function(a){this.atLeastOneSepFirstInternal(0,a)},a.prototype.AT_LEAST_ONE_SEP1=function(a){this.atLeastOneSepFirstInternal(1,a)},a.prototype.AT_LEAST_ONE_SEP2=function(a){this.atLeastOneSepFirstInternal(2,a)},a.prototype.AT_LEAST_ONE_SEP3=function(a){this.atLeastOneSepFirstInternal(3,a)},a.prototype.AT_LEAST_ONE_SEP4=function(a){this.atLeastOneSepFirstInternal(4,a)},a.prototype.AT_LEAST_ONE_SEP5=function(a){this.atLeastOneSepFirstInternal(5,a)},a.prototype.AT_LEAST_ONE_SEP6=function(a){this.atLeastOneSepFirstInternal(6,a)},a.prototype.AT_LEAST_ONE_SEP7=function(a){this.atLeastOneSepFirstInternal(7,a)},a.prototype.AT_LEAST_ONE_SEP8=function(a){this.atLeastOneSepFirstInternal(8,a)},a.prototype.AT_LEAST_ONE_SEP9=function(a){this.atLeastOneSepFirstInternal(9,a)},a.prototype.RULE=function(a,b,c){if(void 0===c&&(c=bY),(0,i.gR)(this.definedRulesNames,a)){var d={message:aN.buildDuplicateRuleNameError({topLevelRule:a,grammarName:this.className}),type:g.DUPLICATE_RULE_NAME,ruleName:a};this.definitionErrors.push(d)}this.definedRulesNames.push(a);var e=this.defineRule(a,b,c);return this[a]=e,e},a.prototype.OVERRIDE_RULE=function(a,b,c){void 0===c&&(c=bY);var d,e,f,h=[];h=h.concat((d=this.definedRulesNames,e=this.className,f=[],i.gR(d,a)||f.push({message:"Invalid rule override, rule: ->"+a+"<- cannot be overridden in the grammar: ->"+e+"<-as it is not defined in any of the super grammars ",type:g.INVALID_RULE_OVERRIDE,ruleName:a}),f)),this.definitionErrors.push.apply(this.definitionErrors,h);var j=this.defineRule(a,b,c);return this[a]=j,j},a.prototype.BACKTRACK=function(a,b){return function(){this.isBackTrackingStack.push(1);var c=this.saveRecogState();try{return a.apply(this,b),!0}catch(a){if(bm(a))return!1;throw a}finally{this.reloadRecogState(c),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return ax((0,i.zu)(this.gastProductionsCache))},a}(),bI=function(){function a(){}return a.prototype.initRecognizerEngine=function(a,b){if(this.className=bB(this.constructor),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=M,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,i.zy)(b,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details.");if((0,i.cy)(a)){if((0,i.Im)(a))throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0).");if("number"==typeof a[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details.")}if((0,i.cy)(a))this.tokensMap=(0,i.TS)(a,function(a,b){return a[b.name]=b,a},{});else if((0,i.zy)(a,"modes")&&(0,i.Si)((0,i.Bq)((0,i.zu)(a.modes)),S)){var c=(0,i.Bq)((0,i.zu)(a.modes)),d=(0,i.sb)(c);this.tokensMap=(0,i.TS)(d,function(a,b){return a[b.name]=b,a},{})}else if((0,i.Gv)(a))this.tokensMap=(0,i.lR)(a);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ai;var e=(0,i.Si)((0,i.zu)(a),function(a){return(0,i.Im)(a.categoryMatches)});this.tokenMatcher=e?M:L,P((0,i.zu)(this.tokensMap))},a.prototype.defineRule=function(a,b,c){if(this.selfAnalysisDone)throw Error("Grammar rule <"+a+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var d,e=(0,i.zy)(c,"resyncEnabled")?c.resyncEnabled:bY.resyncEnabled,f=(0,i.zy)(c,"recoveryValueFunc")?c.recoveryValueFunc:bY.recoveryValueFunc,g=this.ruleShortNameIdx<<12;function h(a){try{if(!0!==this.outputCst)return b.apply(this,a);b.apply(this,a);var c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(a){return this.invokeRuleCatch(a,e,f)}finally{this.ruleFinallyStateUpdate()}}return this.ruleShortNameIdx++,this.shortRuleNameToFull[g]=a,this.fullRuleNameToShort[a]=g,(d=function(b,c){return void 0===b&&(b=0),this.ruleInvocationStateUpdate(g,a,b),h.call(this,c)}).ruleName=a,d.originalGrammarAction=b,d},a.prototype.invokeRuleCatch=function(a,b,c){var d=1===this.RULE_STACK.length,e=b&&!this.isBackTracking()&&this.recoveryEnabled;if(bm(a)){if(e){var f=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(f)){if(a.resyncedTokens=this.reSyncTo(f),!this.outputCst)return c();var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,a.partialCstResult=g}throw a}if(d)return this.moveToTerminatedState(),c()}throw a},a.prototype.optionInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(512,b);return this.optionInternalLogic(a,b,c)},a.prototype.optionInternalLogic=function(a,b,c){var d,e,f=this,g=this.getLaFuncFromCache(c);if(void 0!==a.DEF){if(d=a.DEF,void 0!==(e=a.GATE)){var h=g;g=function(){return e.call(f)&&h.call(f)}}}else d=a;if(!0===g.call(this))return d.call(this)},a.prototype.atLeastOneInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1024,a);return this.atLeastOneInternalLogic(a,b,c)},a.prototype.atLeastOneInternalLogic=function(a,b,c){var d,f,g=this,h=this.getLaFuncFromCache(c);if(void 0!==b.DEF){if(d=b.DEF,void 0!==(f=b.GATE)){var i=h;h=function(){return f.call(g)&&i.call(g)}}}else d=b;if(!0===h.call(this))for(var j=this.doSingleRepetition(d);!0===h.call(this)&&!0===j;)j=this.doSingleRepetition(d);else throw this.raiseEarlyExitException(a,e.REPETITION_MANDATORY,b.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[a,b],h,1024,a,aV)},a.prototype.atLeastOneSepFirstInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1536,a);this.atLeastOneSepFirstInternalLogic(a,b,c)},a.prototype.atLeastOneSepFirstInternalLogic=function(a,b,c){var d=this,f=b.DEF,g=b.SEP;if(!0===this.getLaFuncFromCache(c).call(this)){f.call(this);for(var h=function(){return d.tokenMatcher(d.LA(1),g)};!0===this.tokenMatcher(this.LA(1),g);)this.CONSUME(g),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,g,h,f,aW],h,1536,a,aW)}else throw this.raiseEarlyExitException(a,e.REPETITION_MANDATORY_WITH_SEPARATOR,b.ERR_MSG)},a.prototype.manyInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(768,a);return this.manyInternalLogic(a,b,c)},a.prototype.manyInternalLogic=function(a,b,c){var d,e,f=this,g=this.getLaFuncFromCache(c);if(void 0!==b.DEF){if(d=b.DEF,void 0!==(e=b.GATE)){var h=g;g=function(){return e.call(f)&&h.call(f)}}}else d=b;for(var i=!0;!0===g.call(this)&&!0===i;)i=this.doSingleRepetition(d);this.attemptInRepetitionRecovery(this.manyInternal,[a,b],g,768,a,aT,i)},a.prototype.manySepFirstInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1280,a);this.manySepFirstInternalLogic(a,b,c)},a.prototype.manySepFirstInternalLogic=function(a,b,c){var d=this,e=b.DEF,f=b.SEP;if(!0===this.getLaFuncFromCache(c).call(this)){e.call(this);for(var g=function(){return d.tokenMatcher(d.LA(1),f)};!0===this.tokenMatcher(this.LA(1),f);)this.CONSUME(f),e.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,f,g,e,aU],g,1280,a,aU)}},a.prototype.repetitionSepSecondInternal=function(a,b,c,d,e){for(;c();)this.CONSUME(b),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,b,c,d,e],c,1536,a,e)},a.prototype.doSingleRepetition=function(a){var b=this.getLexerPosition();return a.call(this),this.getLexerPosition()>b},a.prototype.orInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(256,b),d=(0,i.cy)(a)?a:a.DEF,e=this.getLaFuncFromCache(c).call(this,d);if(void 0!==e)return d[e].ALT.call(this);this.raiseNoAltException(b,a.ERR_MSG)},a.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var a=this.LA(1),b=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:a,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new bq(b,a))}},a.prototype.subruleInternal=function(a,b,c){var d;try{var e=void 0!==c?c.ARGS:void 0;return d=a.call(this,b,e),this.cstPostNonTerminal(d,void 0!==c&&void 0!==c.LABEL?c.LABEL:a.ruleName),d}catch(b){this.subruleInternalError(b,c,a.ruleName)}},a.prototype.subruleInternalError=function(a,b,c){throw bm(a)&&void 0!==a.partialCstResult&&(this.cstPostNonTerminal(a.partialCstResult,void 0!==b&&void 0!==b.LABEL?b.LABEL:c),delete a.partialCstResult),a},a.prototype.consumeInternal=function(a,b,c){var d;try{var e=this.LA(1);!0===this.tokenMatcher(e,a)?(this.consumeToken(),d=e):this.consumeInternalError(a,e,c)}catch(c){d=this.consumeInternalRecovery(a,b,c)}return this.cstPostTerminal(void 0!==c&&void 0!==c.LABEL?c.LABEL:a.name,d),d},a.prototype.consumeInternalError=function(a,b,c){var d,e=this.LA(0);throw d=void 0!==c&&c.ERR_MSG?c.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:a,actual:b,previous:e,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new bo(d,b,e))},a.prototype.consumeInternalRecovery=function(a,b,c){if(this.recoveryEnabled&&"MismatchedTokenException"===c.name&&!this.isBackTracking()){var d=this.getFollowsForInRuleRecovery(a,b);try{return this.tryInRuleRecovery(a,d)}catch(a){if(a.name===bt)throw c;throw a}}throw c},a.prototype.saveRecogState=function(){var a=this.errors,b=(0,i.T9)(this.RULE_STACK);return{errors:a,lexerState:this.exportLexerState(),RULE_STACK:b,CST_STACK:this.CST_STACK}},a.prototype.reloadRecogState=function(a){this.errors=a.errors,this.importLexerState(a.lexerState),this.RULE_STACK=a.RULE_STACK},a.prototype.ruleInvocationStateUpdate=function(a,b,c){this.RULE_OCCURRENCE_STACK.push(c),this.RULE_STACK.push(a),this.cstInvocationStateUpdate(b,a)},a.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},a.prototype.getCurrRuleFullName=function(){var a=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[a]},a.prototype.shortRuleNameToFullName=function(a){return this.shortRuleNameToFull[a]},a.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),ai)},a.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},a}(),bJ=function(){function a(){}return a.prototype.initErrorHandler=function(a){this._errors=[],this.errorMessageProvider=(0,i.zy)(a,"errorMessageProvider")?a.errorMessageProvider:bX.errorMessageProvider},a.prototype.SAVE_ERROR=function(a){if(bm(a))return a.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,i.T9)(this.RULE_OCCURRENCE_STACK)},this._errors.push(a),a;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(a.prototype,"errors",{get:function(){return(0,i.T9)(this._errors)},set:function(a){this._errors=a},enumerable:!1,configurable:!0}),a.prototype.raiseEarlyExitException=function(a,b,c){for(var d=this.getCurrRuleFullName(),e=a4(a,this.getGAstProductions()[d],b,this.maxLookahead)[0],f=[],g=1;g<=this.maxLookahead;g++)f.push(this.LA(g));var h=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:e,actual:f,previous:this.LA(0),customUserDescription:c,ruleName:d});throw this.SAVE_ERROR(new br(h,this.LA(1),this.LA(0)))},a.prototype.raiseNoAltException=function(a,b){for(var c=this.getCurrRuleFullName(),d=a3(a,this.getGAstProductions()[c],this.maxLookahead),e=[],f=1;f<=this.maxLookahead;f++)e.push(this.LA(f));var g=this.LA(0),h=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:d,actual:e,previous:g,customUserDescription:b,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new bp(h,this.LA(1),g))},a}(),bK=function(){function a(){}return a.prototype.initContentAssist=function(){},a.prototype.computeContentAssist=function(a,b){var c=this.gastProductionsCache[a];if((0,i.b0)(c))throw Error("Rule ->"+a+"<- does not exist in this grammar.");return aY([c],b,this.tokenMatcher,this.maxLookahead)},a.prototype.getNextPossibleTokenTypes=function(a){var b=(0,i.$1)(a.ruleStack);return new aR(this.getGAstProductions()[b],a).startWalking()},a}(),bL={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(bL);var bM=ah({name:"RECORDING_PHASE_TOKEN",pattern:V.NA});P([bM]);var bN=aj(bM,"This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(bN);var bO={name:"This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}},bP=function(){function a(){}return a.prototype.initGastRecorder=function(a){this.recordingProdStack=[],this.RECORDING_PHASE=!1},a.prototype.enableRecording=function(){var a=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var b=function(b){var c=b>0?b:"";a["CONSUME"+c]=function(a,c){return this.consumeInternalRecord(a,b,c)},a["SUBRULE"+c]=function(a,c){return this.subruleInternalRecord(a,b,c)},a["OPTION"+c]=function(a){return this.optionInternalRecord(a,b)},a["OR"+c]=function(a){return this.orInternalRecord(a,b)},a["MANY"+c]=function(a){this.manyInternalRecord(b,a)},a["MANY_SEP"+c]=function(a){this.manySepFirstInternalRecord(b,a)},a["AT_LEAST_ONE"+c]=function(a){this.atLeastOneInternalRecord(b,a)},a["AT_LEAST_ONE_SEP"+c]=function(a){this.atLeastOneSepFirstInternalRecord(b,a)}},c=0;c<10;c++)b(c);a.consume=function(a,b,c){return this.consumeInternalRecord(b,a,c)},a.subrule=function(a,b,c){return this.subruleInternalRecord(b,a,c)},a.option=function(a,b){return this.optionInternalRecord(b,a)},a.or=function(a,b){return this.orInternalRecord(b,a)},a.many=function(a,b){this.manyInternalRecord(a,b)},a.atLeastOne=function(a,b){this.atLeastOneInternalRecord(a,b)},a.ACTION=a.ACTION_RECORD,a.BACKTRACK=a.BACKTRACK_RECORD,a.LA=a.LA_RECORD})},a.prototype.disableRecording=function(){var a=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var b=0;b<10;b++){var c=b>0?b:"";delete a["CONSUME"+c],delete a["SUBRULE"+c],delete a["OPTION"+c],delete a["OR"+c],delete a["MANY"+c],delete a["MANY_SEP"+c],delete a["AT_LEAST_ONE"+c],delete a["AT_LEAST_ONE_SEP"+c]}delete a.consume,delete a.subrule,delete a.option,delete a.or,delete a.many,delete a.atLeastOne,delete a.ACTION,delete a.BACKTRACK,delete a.LA})},a.prototype.ACTION_RECORD=function(a){},a.prototype.BACKTRACK_RECORD=function(a,b){return function(){return!0}},a.prototype.LA_RECORD=function(a){return bW},a.prototype.topLevelRuleRecord=function(a,b){try{var c=new ao({definition:[],name:a});return c.name=a,this.recordingProdStack.push(c),b.call(this),this.recordingProdStack.pop(),c}catch(a){if(!0!==a.KNOWN_RECORDER_ERROR)try{a.message=a.message+'\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(a){}throw a}},a.prototype.optionInternalRecord=function(a,b){return bQ.call(this,aq,a,b)},a.prototype.atLeastOneInternalRecord=function(a,b){bQ.call(this,ar,b,a)},a.prototype.atLeastOneSepFirstInternalRecord=function(a,b){bQ.call(this,as,b,a,!0)},a.prototype.manyInternalRecord=function(a,b){bQ.call(this,at,b,a)},a.prototype.manySepFirstInternalRecord=function(a,b){bQ.call(this,au,b,a,!0)},a.prototype.orInternalRecord=function(a,b){return bR.call(this,a,b)},a.prototype.subruleInternalRecord=function(a,b,c){if(bT(b),!a||!1===(0,i.zy)(a,"ruleName")){var d=Error("<SUBRULE"+bS(b)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(a)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw d.KNOWN_RECORDER_ERROR=!0,d}var e=(0,i.se)(this.recordingProdStack),f=new an({idx:b,nonTerminalName:a.ruleName,referencedRule:void 0});return e.definition.push(f),this.outputCst?bO:bL},a.prototype.consumeInternalRecord=function(a,b,c){if(bT(b),!Q(a)){var d=Error("<CONSUME"+bS(b)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(a)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw d.KNOWN_RECORDER_ERROR=!0,d}var e=(0,i.se)(this.recordingProdStack),f=new aw({idx:b,terminalType:a});return e.definition.push(f),bN},a}();function bQ(a,b,c,d){void 0===d&&(d=!1),bT(c);var e=(0,i.se)(this.recordingProdStack),f=(0,i.Tn)(b)?b:b.DEF,g=new a({definition:[],idx:c});return d&&(g.separator=b.SEP),(0,i.zy)(b,"MAX_LOOKAHEAD")&&(g.maxLookahead=b.MAX_LOOKAHEAD),this.recordingProdStack.push(g),f.call(this),e.definition.push(g),this.recordingProdStack.pop(),bL}function bR(a,b){var c=this;bT(b);var d=(0,i.se)(this.recordingProdStack),e=!1===(0,i.cy)(a),f=!1===e?a:a.DEF,g=new av({definition:[],idx:b,ignoreAmbiguities:e&&!0===a.IGNORE_AMBIGUITIES});return(0,i.zy)(a,"MAX_LOOKAHEAD")&&(g.maxLookahead=a.MAX_LOOKAHEAD),g.hasPredicates=(0,i.zN)(f,function(a){return(0,i.Tn)(a.GATE)}),d.definition.push(g),(0,i.jJ)(f,function(a){var b=new ap({definition:[]});g.definition.push(b),(0,i.zy)(a,"IGNORE_AMBIGUITIES")?b.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:(0,i.zy)(a,"GATE")&&(b.ignoreAmbiguities=!0),c.recordingProdStack.push(b),a.ALT.call(c),c.recordingProdStack.pop()}),bL}function bS(a){return 0===a?"":""+a}function bT(a){if(a<0||a>255){var b=Error("Invalid DSL Method idx value: <"+a+">\n Idx value must be a none negative value smaller than "+256);throw b.KNOWN_RECORDER_ERROR=!0,b}}var bU=function(){function a(){}return a.prototype.initPerformanceTracer=function(a){if((0,i.zy)(a,"traceInitPerf")){var b=a.traceInitPerf,c="number"==typeof b;this.traceInitMaxIdent=c?b:1/0,this.traceInitPerf=c?b>0:b}else this.traceInitMaxIdent=0,this.traceInitPerf=bX.traceInitPerf;this.traceInitIndent=-1},a.prototype.TRACE_INIT=function(a,b){if(!0!==this.traceInitPerf)return b();this.traceInitIndent++;var c=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(c+"--\x3e <"+a+">");var d=(0,i.O1)(b),e=d.time,f=d.value,g=e>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&g(c+"<-- <"+a+"> time: "+e+"ms"),this.traceInitIndent--,f},a}(),bV=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),bW=aj(ai,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(bW);var bX=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:aL,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),bY=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});function bZ(a){return void 0===a&&(a=void 0),function(){return a}}!function(a){a[a.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",a[a.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",a[a.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",a[a.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",a[a.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",a[a.LEFT_RECURSION=5]="LEFT_RECURSION",a[a.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",a[a.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",a[a.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",a[a.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",a[a.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",a[a.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",a[a.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(g||(g={}));var b$=function(){function a(a,b){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(b),this.initLexerAdapter(),this.initLooksAhead(b),this.initRecognizerEngine(a,b),this.initRecoverable(b),this.initTreeBuilder(b),this.initContentAssist(),this.initGastRecorder(b),this.initPerformanceTracer(b),(0,i.zy)(b,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=(0,i.zy)(b,"skipValidations")?b.skipValidations:bX.skipValidations}return a.performSelfAnalysis=function(a){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},a.prototype.performSelfAnalysis=function(){var b=this;this.TRACE_INIT("performSelfAnalysis",function(){b.selfAnalysisDone=!0;var c=b.className;b.TRACE_INIT("toFastProps",function(){(0,i.Bl)(b)}),b.TRACE_INIT("Grammar Recording",function(){try{b.enableRecording(),(0,i.jJ)(b.definedRulesNames,function(a){var c=b[a].originalGrammarAction,d=void 0;b.TRACE_INIT(a+" Rule",function(){d=b.topLevelRuleRecord(a,c)}),b.gastProductionsCache[a]=d})}finally{b.disableRecording()}});var d=[];if(b.TRACE_INIT("Grammar Resolving",function(){d=bd({rules:(0,i.zu)(b.gastProductionsCache)}),b.definitionErrors.push.apply(b.definitionErrors,d)}),b.TRACE_INIT("Grammar Validations",function(){if((0,i.Im)(d)&&!1===b.skipValidations){var a=be({rules:(0,i.zu)(b.gastProductionsCache),maxLookahead:b.maxLookahead,tokenTypes:(0,i.zu)(b.tokensMap),errMsgProvider:aN,grammarName:c});b.definitionErrors.push.apply(b.definitionErrors,a)}}),(0,i.Im)(b.definitionErrors)&&(b.recoveryEnabled&&b.TRACE_INIT("computeAllProdsFollows",function(){var a,c,d=(a=(0,i.zu)(b.gastProductionsCache),c={},(0,i.jJ)(a,function(a){var b=new aK(a).startWalking();(0,i.kp)(c,b)}),c);b.resyncFollows=d}),b.TRACE_INIT("ComputeLookaheadFunctions",function(){b.preComputeLookaheadFunctions((0,i.zu)(b.gastProductionsCache))})),!a.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,i.Im)(b.definitionErrors))throw Error("Parser Definition Errors detected:\n "+(0,i.Tj)(b.definitionErrors,function(a){return a.message}).join("\n-------------------------------\n"))})},a.DEFER_DEFINITION_ERRORS_HANDLING=!1,a}();(0,i.XJ)(b$,[bv,bx,bF,bG,bI,bH,bJ,bK,bP,bU]);var b_=function(a){function b(b,c){void 0===c&&(c=bX);var d=(0,i.lR)(c);return d.outputCst=!0,a.call(this,b,d)||this}return bV(b,a),b}(b$),b0=function(a){function b(b,c){void 0===c&&(c=bX);var d=(0,i.lR)(c);return d.outputCst=!1,a.call(this,b,d)||this}return bV(b,a),b}(b$);function b1(a,b){var c=void 0===b?{}:b,d=c.resourceBase,e=void 0===d?"https://unpkg.com/chevrotain@"+h+"/diagrams/":d,f=c.css;return"\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<style>\n body {\n background-color: hsl(30, 20%, 95%)\n }\n</style>\n\n\n<link rel='stylesheet' href='"+(void 0===f?"https://unpkg.com/chevrotain@"+h+"/diagrams/diagrams.css":f)+"'>\n"+("\n<script src='"+e+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+e+"src/diagrams_builder.js'><\/script>\n<script src='"+e+"src/diagrams_behavior.js'><\/script>\n<script src='"+e+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div> \n'+("\n<script>\n window.serializedGrammar = "+JSON.stringify(a,null," ")+";\n<\/script>\n")+'\n<script>\n var diagramsDiv = document.getElementById("diagrams");\n main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}function b2(a){var b;return"\nfunction "+a.name+"(tokenVocabulary, config) {\n // invoke super constructor\n // No support for embedded actions currently, so we can 'hardcode'\n // The use of CstParser.\n chevrotain.CstParser.call(this, tokenVocabulary, config)\n\n const $ = this\n\n "+(b=a.rules,(0,i.Tj)(b,function(a){var b,c,d;return c=1,d=b6(1,'$.RULE("'+(b=a).name+'", function() {')+"\n"+b5(b.definition,c+1)+(b6(c+1,"})")+"\n")}).join("\n"))+"\n\n // very important to call this after all the rules have been defined.\n // otherwise the parser may not work correctly as it will lack information\n // derived during the self analysis phase.\n this.performSelfAnalysis(this)\n}\n\n// inheritance as implemented in javascript in the previous decade... :(\n"+a.name+".prototype = Object.create(chevrotain.CstParser.prototype)\n"+a.name+".prototype.constructor = "+a.name+" \n "}function b3(a,b,c){var d=b6(c,"$."+(a+b.idx)+"(");return b.separator?(d+="{\n",d+=b6(c+1,"SEP: this.tokensMap."+b.separator.name)+",\n",d+="DEF: "+b4(b.definition,c+2)+"\n",d+=b6(c,"}")+"\n"):d+=b4(b.definition,c+1),d+=b6(c,")")+"\n"}function b4(a,b){var c="function() {\n";return c+=b5(a,b),c+=b6(b,"}")+"\n"}function b5(a,b){var c="";return(0,i.jJ)(a,function(a){c+=function(a,b){var c;if(a instanceof an)return b6(b,"$.SUBRULE"+a.idx+"($."+a.nonTerminalName+")\n");if(a instanceof aq)return b3("OPTION",a,b);if(a instanceof ar)return b3("AT_LEAST_ONE",a,b);if(a instanceof as)return b3("AT_LEAST_ONE_SEP",a,b);if(a instanceof au)return b3("MANY_SEP",a,b);else if(a instanceof at)return b3("MANY",a,b);else if(a instanceof av)return b6(b,"$.OR"+a.idx+"([")+"\n"+(0,i.Tj)(a.definition,function(a){var c,d,e;return c=a,e=b6(d=b+1,"{")+"\n"+(b6(d+1,"ALT: function() {")+"\n")+b5(c.definition,d+1)+(b6(d+1,"}")+"\n")+b6(d,"}")}).join(",\n")+"\n"+b6(b,"])\n");else if(a instanceof aw)return c=a.terminalType.name,b6(b,"$.CONSUME"+a.idx+"(this.tokensMap."+c+")\n");else if(a instanceof ap)return b5(a.definition,b);else throw Error("non exhaustive match")}(a,b+1)}),c}function b6(a,b){return Array(4*a+1).join(" ")+b}function b7(a){var b,d=Function("tokenVocabulary","config","chevrotain"," \n"+b2(b={name:a.name,rules:a.rules})+"\nreturn new "+b.name+"(tokenVocabulary, config) \n");return function(b){return d(a.tokenVocabulary,b,c(704092))}}function b8(a){var b;return"\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['chevrotain'], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require('chevrotain'));\n } else {\n // Browser globals (root is window)\n root.returnExports = factory(root.b);\n }\n}(typeof self !== 'undefined' ? self : this, function (chevrotain) {\n\n"+b2(b={name:a.name,rules:a.rules})+"\n \nreturn {\n "+b.name+": "+b.name+" \n}\n}));\n"}function b9(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n It performs no action other than printing this message.\n Please avoid using it as it will be completely removed in the future")}var ca=function(){throw Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead. \nSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0")}},706575:(a,b,c)=>{"use strict";c.d(b,{x:()=>g});var d=c(736927),e=c(115962),f=c(86839);function g({relatedObjectName:a,value:b,multiple:c=!1,onChange:g,placeholder:h,variant:i="modal",autoFocus:j=!1}){let[k,l]=(0,e.useState)(j),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)([]),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(()=>(function(a){if(!a)return[];let b=a.trim();if(!b)return[];if(b.startsWith("["))try{let a=JSON.parse(b);if(Array.isArray(a))return a.map(String).filter(Boolean)}catch{}return[b]})(b)),u=(0,e.useRef)(null),v=(0,e.useRef)(null);(0,e.useRef)(null),(0,e.useCallback)(async b=>{r(!0);try{let c=new URLSearchParams;b&&c.set("q",b);let d=await fetch(`/api/workspace/objects/${encodeURIComponent(a)}/entries/options?${c}`);if(d.ok){let a=await d.json();p(a.options??[])}}catch{}finally{r(!1)}},[a]);let w=s.map(a=>{let b=o.find(b=>b.id===a),c=b?.label??a;return{id:a,label:String(null!=c&&"object"==typeof c?JSON.stringify(c):c??"")}}),x="inline"===i;return(0,d.jsxs)("div",{ref:u,className:"relative w-full",children:[(0,d.jsxs)("div",{onClick:()=>l(!k),className:`w-full flex items-center flex-wrap gap-1 cursor-pointer min-h-[1.5em] ${x?"text-xs":"px-3 py-2 text-sm rounded-lg"}`,style:x?{}:{background:"var(--color-surface)",color:"var(--color-text)",border:"1px solid var(--color-border)"},children:[w.length>0?w.map(({id:a,label:b})=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium",style:{background:"rgba(96, 165, 250, 0.1)",color:"#60a5fa",border:"1px solid rgba(96, 165, 250, 0.2)"},children:[(0,d.jsx)("span",{className:"truncate max-w-[160px]",children:String(b??"")}),(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation();let d=s.filter(b=>b!==a);t(d),c?g(0===d.length?"":JSON.stringify(d)):g("")},className:"ml-0.5 hover:opacity-70",style:{color:"#60a5fa"},children:(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})]},a)):(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:h??`Select ${(0,f.A3)(a)}...`}),(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-auto flex-shrink-0",style:{color:"var(--color-text-muted)",transform:k?"rotate(180deg)":void 0,transition:"transform 0.15s"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]}),k&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full rounded-lg shadow-lg overflow-hidden",style:{background:"var(--color-bg)",border:"1px solid var(--color-border)",maxHeight:260},children:[(0,d.jsx)("div",{className:"p-2 border-b",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("input",{ref:v,type:"text",value:m,onChange:a=>n(a.target.value),placeholder:`Search ${(0,f.PV)(a)}...`,className:"w-full px-2.5 py-1.5 text-xs rounded-md outline-none",style:{background:"var(--color-surface)",color:"var(--color-text)",border:"1px solid var(--color-border)"},onKeyDown:a=>{"Escape"===a.key&&l(!1)}})}),(0,d.jsx)("div",{className:"overflow-y-auto",style:{maxHeight:200},children:q?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-xs",style:{color:"var(--color-text-muted)"},children:"Loading..."}):0===o.length?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-xs",style:{color:"var(--color-text-muted)"},children:m?"No matches found":"No entries"}):o.map(a=>{let b=s.includes(a.id);return(0,d.jsxs)("button",{type:"button",onClick:()=>(a=>{if(c){let b=s.includes(a)?s.filter(b=>b!==a):[...s,a];t(b),g(0===b.length?"":JSON.stringify(b))}else t([a]),g(a),l(!1)})(a.id),className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors",style:{background:b?"var(--color-accent-light, rgba(96, 165, 250, 0.08))":"transparent",color:"var(--color-text)"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover, rgba(255,255,255,0.04))")},onMouseLeave:a=>{a.currentTarget.style.background=b?"var(--color-accent-light, rgba(96, 165, 250, 0.08))":"transparent"},children:[c&&(0,d.jsx)("span",{className:"w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0",style:{borderColor:b?"var(--color-accent)":"var(--color-border)",background:b?"var(--color-accent)":"transparent"},children:b&&(0,d.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),!c&&b&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),(0,d.jsx)("span",{className:"truncate",children:String(null!=a.label&&"object"==typeof a.label?JSON.stringify(a.label):a.label??"")})]},a.id)})})]})]})}},707201:(a,b,c)=>{"use strict";c.d(b,{r:()=>k,y:()=>l});var d=c(736927),e=c(115962);let f={default:{bg:"rgba(148, 163, 184, 0.08)",border:"1px solid rgba(148, 163, 184, 0.2)",text:"var(--color-text)",hoverBg:"rgba(148, 163, 184, 0.15)"},primary:{bg:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",text:"#3b82f6",hoverBg:"rgba(59, 130, 246, 0.15)"},destructive:{bg:"rgba(220, 38, 38, 0.08)",border:"1px solid rgba(220, 38, 38, 0.2)",text:"var(--color-error)",hoverBg:"rgba(220, 38, 38, 0.15)"},success:{bg:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",text:"#22c55e",hoverBg:"rgba(34, 197, 94, 0.15)"},warning:{bg:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",text:"#f59e0b",hoverBg:"rgba(245, 158, 11, 0.15)"}};function g({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"animate-spin",children:(0,d.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function h({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function i({size:a=12}){return(0,d.jsxs)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function j({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polygon",{points:"5 3 19 12 5 21 5 3"})})}function k({action:a,entryId:b,objectName:c,fieldId:k,compact:l=!1,state:m,onExecute:n,onRequestConfirm:o,onToast:p,disabled:q=!1}){let r,s,[t,u]=(0,e.useState)({status:"idle"}),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=m??t,{status:y}=x,z=(0,e.useCallback)(async()=>{if(n)return void n(a,b);u({status:"loading"});let d=new AbortController;w.current=d;try{let e=await fetch(`/api/workspace/objects/${encodeURIComponent(c)}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:a.id,fieldId:k,entryIds:[b]}),signal:d.signal});if(!e.ok){let a=(await e.json().catch(()=>({error:"Request failed"}))).error??"Request failed";u({status:"error",error:a}),p?.(a,{type:"error"});return}let f=e.body?.getReader();if(!f){u({status:"error",error:"No response stream"}),p?.("No response stream",{type:"error"});return}let g=new TextDecoder,h="";for(;;){let{done:b,value:c}=await f.read();if(b)break;let d=(h+=g.decode(c,{stream:!0})).split("\n");for(let b of(h=d.pop()??"",d))if(b.startsWith("data: "))try{let c=JSON.parse(b.slice(6));if("progress"===c.type)u({status:"loading",progress:{percent:c.percent,message:c.message}});else if("log"===c.type)p?.(c.message??"",{type:"error"===c.level?"error":"info"});else if("completed"===c.type)if("success"===c.status)u({status:"success",result:c.result}),p?.(a.successLabel??`${a.label} completed`,{type:"success"}),v.current=setTimeout(()=>{u({status:"idle"})},a.autoResetMs??3e3);else{let b=c.error??"Action failed";u({status:"error",error:b}),p?.(b,{type:"error"}),v.current=setTimeout(()=>{u({status:"idle"})},a.autoResetMs??5e3)}}catch{}}}catch(b){if(d.signal.aborted)return;let a=b instanceof Error?b.message:"Unknown error";u({status:"error",error:a}),p?.(a,{type:"error"})}},[a,b,c,k,n,p]),A=(0,e.useCallback)(c=>{if(c.stopPropagation(),"loading"!==y&&!q){if("error"===y)return void u({status:"idle"});a.confirmMessage&&o?o(a,b,z):z()}},[y,q,a,b,o,z]),B=f[a.variant??"default"]??f.default,C=B.bg,D=B.border,E=B.text;switch(y){case"loading":r=a.loadingLabel??"Running...",s=(0,d.jsx)(g,{size:l?14:12});break;case"success":r=a.successLabel??"Done!",s=(0,d.jsx)(h,{size:l?14:12}),C="rgba(34, 197, 94, 0.1)",D="1px solid rgba(34, 197, 94, 0.3)",E="#22c55e";break;case"error":r=a.errorLabel??"Failed",s=(0,d.jsx)(i,{size:l?14:12}),C="rgba(220, 38, 38, 0.1)",D="1px solid rgba(220, 38, 38, 0.3)",E="var(--color-error)";break;default:r=a.label,s=(0,d.jsx)(j,{size:l?14:12})}let F=x.progress?.percent;return(0,d.jsxs)("button",{type:"button",onClick:A,disabled:"loading"===y||q,className:"relative flex items-center gap-1.5 rounded-lg text-xs font-medium transition-all duration-200 overflow-hidden select-none",style:{padding:l?"4px 6px":"5px 10px",background:C,border:D,color:E,opacity:q?.5:1,cursor:"loading"===y||q?"not-allowed":"pointer"},title:"error"===y?x.error:a.label,onMouseEnter:a=>{"loading"===y||q||(a.currentTarget.style.background=B.hoverBg)},onMouseLeave:a=>{a.currentTarget.style.background=C},children:[null!=F&&"loading"===y&&(0,d.jsx)("div",{className:"absolute inset-0 opacity-15 transition-all duration-300",style:{background:E,width:`${F}%`}}),(0,d.jsxs)("span",{className:"relative z-10 flex items-center gap-1.5",children:[s,!l&&(0,d.jsx)("span",{className:"whitespace-nowrap",children:r})]})]})}function l(){let[a,b]=(0,e.useState)(new Map),[c,d]=(0,e.useState)(new Map),f=(0,e.useCallback)((b,c)=>a.get(`${b}_${c}`)??{status:"idle"},[a]),g=(0,e.useCallback)((a,c,d)=>{b(b=>{let e=new Map(b);return e.set(`${a}_${c}`,d),e})},[]),h=(0,e.useCallback)(async(a,b,c,e,f)=>{let h=e.length,i=0,j=0,k=h;for(let b of e)g(a.id,b,{status:"loading"});d(b=>{let c=new Map(b);return c.set(a.id,{status:"running",running:k,succeeded:i,failed:j,total:h}),c});try{let l=await fetch(`/api/workspace/objects/${encodeURIComponent(c)}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:a.id,fieldId:b,entryIds:e})});if(!l.ok){d(b=>{let c=new Map(b);return c.set(a.id,{status:"done",running:0,succeeded:0,failed:h,total:h}),c}),f?.onToast?.(`${a.label} failed to start`,{type:"error"});return}let m=l.body?.getReader();if(!m)return;let n=new TextDecoder,o="";for(;;){let{done:b,value:c}=await m.read();if(b)break;let e=(o+=n.decode(c,{stream:!0})).split("\n");for(let b of(o=e.pop()??"",e))if(b.startsWith("data: "))try{let c=JSON.parse(b.slice(6));if("progress"===c.type&&c.entryId)g(a.id,c.entryId,{status:"loading",progress:{percent:c.percent,message:c.message}});else if("completed"===c.type&&c.entryId){k--,"success"===c.status?(i++,g(a.id,c.entryId,{status:"success",result:c.result})):(j++,g(a.id,c.entryId,{status:"error",error:c.error})),d(b=>{let c=new Map(b);return c.set(a.id,{status:k>0?"running":"done",running:k,succeeded:i,failed:j,total:h}),c});let b=f?.autoResetMs??a.autoResetMs??3e3;setTimeout(()=>{g(a.id,c.entryId,{status:"idle"})},b)}}catch{}}}catch{}d(b=>{let c=new Map(b);return c.set(a.id,{status:"done",running:0,succeeded:i,failed:j,total:h}),c}),j>0?f?.onToast?.(`${a.label}: ${i} succeeded, ${j} failed`,{type:"error"}):i>0&&f?.onToast?.(`${a.label}: ${i} entries completed`,{type:"success"}),setTimeout(()=>{d(b=>{let c=new Map(b);return c.delete(a.id),c})},5e3)},[g]);return{getState:f,setState:g,executeBulkAction:h,bulkStates:c}}},710846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},712410:(a,b,c)=>{"use strict";c.d(b,{x:()=>e});var d=c(502714);function e(a,...b){let c=d.w.bind(null,a||b.find(a=>"object"==typeof a));return b.map(c)}},712557:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__iconNode:()=>e,default:()=>f});var d=c(863928);let e=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],f=(0,d.A)("rocket",e)},714659:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return e}});let d=c(96309)._(c(629395));function e(a,b){var c;let e={};"function"==typeof a&&(e.loader=a);let f={...e,...b};return(0,d.default)({...f,modules:null==(c=f.loadableGenerated)?void 0:c.modules})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},719771:a=>{"use strict";a.exports=require("process")},720511:(a,b,c)=>{"use strict";c.d(b,{KE:()=>cf,YY:()=>b1,CU:()=>bZ,Db:()=>cx,bP:()=>cy,Yv:()=>cz,Nz:()=>ck,gk:()=>a1,AB:()=>cl,T7:()=>aV,Pi:()=>M,GG:()=>cm,Nx:()=>aW,eL:()=>aX,tp:()=>a$,yQ:()=>bc,gu:()=>bg,FF:()=>bh,iI:()=>aZ,hO:()=>bi,fl:()=>bj,Pg:()=>U,zU:()=>a5,q4:()=>be,iR:()=>bf,QN:()=>bn,J_:()=>bo,rU:()=>aD,Op:()=>br,BQ:()=>bs,eE:()=>ah,OX:()=>cg,Zc:()=>cA,KV:()=>a4,jT:()=>ch,Dd:()=>cu,MG:()=>bw,kj:()=>cv,JJ:()=>ci,tG:()=>cj});var d=c(731626),e=c(331480),f=c(381802);let g=(a,b)=>!a.selection.empty&&(b&&b(a.tr.deleteSelection().scrollIntoView()),!0);function h(a,b){let{$cursor:c}=a.selection;return c&&(b?b.endOfTextblock("backward",a):!(c.parentOffset>0))?c:null}let i=(a,b,c)=>{let g=h(a,c);if(!g)return!1;let i=m(g);if(!i){let c=g.blockRange(),e=c&&(0,d.jP)(c);return null!=e&&(b&&b(a.tr.lift(c,e).scrollIntoView()),!0)}let j=i.nodeBefore;if(w(a,i,b,-1))return!0;if(0==g.parent.content.size&&(k(j,"end")||f.nh.isSelectable(j)))for(let c=g.depth;;c--){let h=(0,d.$L)(a.doc,g.before(c),g.after(c),e.Ji.empty);if(h&&h.slice.size<h.to-h.from){if(b){let c=a.tr.step(h);c.setSelection(k(j,"end")?f.LN.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):f.nh.create(c.doc,i.pos-j.nodeSize)),b(c.scrollIntoView())}return!0}if(1==c||g.node(c-1).childCount>1)break}return!!j.isAtom&&i.depth==g.depth-1&&(b&&b(a.tr.delete(i.pos-j.nodeSize,i.pos).scrollIntoView()),!0)};function j(a,b,c){let g=b.nodeBefore,h=b.pos-1;for(;!g.isTextblock;h--){if(g.type.spec.isolating)return!1;let a=g.lastChild;if(!a)return!1;g=a}let i=b.nodeAfter,j=b.pos+1;for(;!i.isTextblock;j++){if(i.type.spec.isolating)return!1;let a=i.firstChild;if(!a)return!1;i=a}let k=(0,d.$L)(a.doc,h,j,e.Ji.empty);if(!k||k.from!=h||k instanceof d.Ln&&k.slice.size>=j-h)return!1;if(c){let b=a.tr.step(k);b.setSelection(f.U3.create(b.doc,h)),c(b.scrollIntoView())}return!0}function k(a,b,c=!1){for(let d=a;d;d="start"==b?d.firstChild:d.lastChild){if(d.isTextblock)return!0;if(c&&1!=d.childCount)break}return!1}let l=(a,b,c)=>{let{$head:d,empty:e}=a.selection,g=d;if(!e)return!1;if(d.parent.isTextblock){if(c?!c.endOfTextblock("backward",a):d.parentOffset>0)return!1;g=m(d)}let h=g&&g.nodeBefore;return!!h&&!!f.nh.isSelectable(h)&&(b&&b(a.tr.setSelection(f.nh.create(a.doc,g.pos-h.nodeSize)).scrollIntoView()),!0)};function m(a){if(!a.parent.type.spec.isolating)for(let b=a.depth-1;b>=0;b--){if(a.index(b)>0)return a.doc.resolve(a.before(b+1));if(a.node(b).type.spec.isolating)break}return null}function n(a,b){let{$cursor:c}=a.selection;return c&&(b?b.endOfTextblock("forward",a):!(c.parentOffset<c.parent.content.size))?c:null}let o=(a,b,c)=>{let g=n(a,c);if(!g)return!1;let h=q(g);if(!h)return!1;let i=h.nodeAfter;if(w(a,h,b,1))return!0;if(0==g.parent.content.size&&(k(i,"start")||f.nh.isSelectable(i))){let c=(0,d.$L)(a.doc,g.before(),g.after(),e.Ji.empty);if(c&&c.slice.size<c.to-c.from){if(b){let d=a.tr.step(c);d.setSelection(k(i,"start")?f.LN.findFrom(d.doc.resolve(d.mapping.map(h.pos)),1):f.nh.create(d.doc,d.mapping.map(h.pos))),b(d.scrollIntoView())}return!0}}return!!i.isAtom&&h.depth==g.depth-1&&(b&&b(a.tr.delete(h.pos,h.pos+i.nodeSize).scrollIntoView()),!0)},p=(a,b,c)=>{let{$head:d,empty:e}=a.selection,g=d;if(!e)return!1;if(d.parent.isTextblock){if(c?!c.endOfTextblock("forward",a):d.parentOffset<d.parent.content.size)return!1;g=q(d)}let h=g&&g.nodeAfter;return!!h&&!!f.nh.isSelectable(h)&&(b&&b(a.tr.setSelection(f.nh.create(a.doc,g.pos)).scrollIntoView()),!0)};function q(a){if(!a.parent.type.spec.isolating)for(let b=a.depth-1;b>=0;b--){let c=a.node(b);if(a.index(b)+1<c.childCount)return a.doc.resolve(a.after(b+1));if(c.type.spec.isolating)break}return null}let r=(a,b)=>{let{$head:c,$anchor:d}=a.selection;return!!c.parent.type.spec.code&&!!c.sameParent(d)&&(b&&b(a.tr.insertText("\n").scrollIntoView()),!0)};function s(a){for(let b=0;b<a.edgeCount;b++){let{type:c}=a.edge(b);if(c.isTextblock&&!c.hasRequiredAttrs())return c}return null}let t=(a,b)=>{let{$head:c,$anchor:d}=a.selection;if(!c.parent.type.spec.code||!c.sameParent(d))return!1;let e=c.node(-1),g=c.indexAfter(-1),h=s(e.contentMatchAt(g));if(!h||!e.canReplaceWith(g,g,h))return!1;if(b){let d=c.after(),e=a.tr.replaceWith(d,d,h.createAndFill());e.setSelection(f.LN.near(e.doc.resolve(d),1)),b(e.scrollIntoView())}return!0},u=(a,b)=>{let c=a.selection,{$from:d,$to:e}=c;if(c instanceof f.i5||d.parent.inlineContent||e.parent.inlineContent)return!1;let g=s(e.parent.contentMatchAt(e.indexAfter()));if(!g||!g.isTextblock)return!1;if(b){let c=(!d.parentOffset&&e.index()<e.parent.childCount?d:e).pos,h=a.tr.insert(c,g.createAndFill());h.setSelection(f.U3.create(h.doc,c+1)),b(h.scrollIntoView())}return!0},v=(a,b)=>{let{$cursor:c}=a.selection;if(!c||c.parent.content.size)return!1;if(c.depth>1&&c.after()!=c.end(-1)){let e=c.before();if((0,d.zy)(a.doc,e))return b&&b(a.tr.split(e).scrollIntoView()),!0}let e=c.blockRange(),f=e&&(0,d.jP)(e);return null!=f&&(b&&b(a.tr.lift(e,f).scrollIntoView()),!0)};function w(a,b,c,g){let h,i,j,l=b.nodeBefore,m=b.nodeAfter,n,o,p=l.type.spec.isolating||m.type.spec.isolating;if(!p&&(h=b.nodeBefore,i=b.nodeAfter,j=b.index(),h&&i&&h.type.compatibleContent(i.type)&&(!h.content.size&&b.parent.canReplace(j-1,j)?(c&&c(a.tr.delete(b.pos-h.nodeSize,b.pos).scrollIntoView()),!0):!!b.parent.canReplace(j,j+1)&&!!(i.isTextblock||(0,d.n9)(a.doc,b.pos))&&(c&&c(a.tr.join(b.pos).scrollIntoView()),!0))))return!0;let q=!p&&b.parent.canReplace(b.index(),b.index()+1);if(q&&(n=(o=l.contentMatchAt(l.childCount)).findWrapping(m.type))&&o.matchType(n[0]||m.type).validEnd){if(c){let f=b.pos+m.nodeSize,g=e.FK.empty;for(let a=n.length-1;a>=0;a--)g=e.FK.from(n[a].create(null,g));g=e.FK.from(l.copy(g));let h=a.tr.step(new d.Wg(b.pos-1,f,b.pos,f,new e.Ji(g,1,0),n.length,!0)),i=h.doc.resolve(f+2*n.length);i.nodeAfter&&i.nodeAfter.type==l.type&&(0,d.n9)(h.doc,i.pos)&&h.join(i.pos),c(h.scrollIntoView())}return!0}let r=m.type.spec.isolating||g>0&&p?null:f.LN.findFrom(b,1),s=r&&r.$from.blockRange(r.$to),t=s&&(0,d.jP)(s);if(null!=t&&t>=b.depth)return c&&c(a.tr.lift(s,t).scrollIntoView()),!0;if(q&&k(m,"start",!0)&&k(l,"end")){let f=l,g=[];for(;g.push(f),!f.isTextblock;)f=f.lastChild;let h=m,i=1;for(;!h.isTextblock;h=h.firstChild)i++;if(f.canReplace(f.childCount,f.childCount,h.content)){if(c){let f=e.FK.empty;for(let a=g.length-1;a>=0;a--)f=e.FK.from(g[a].copy(f));c(a.tr.step(new d.Wg(b.pos-g.length,b.pos+m.nodeSize,b.pos+i,b.pos+m.nodeSize-i,new e.Ji(f,g.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function x(a){return function(b,c){let d=b.selection,e=a<0?d.$from:d.$to,g=e.depth;for(;e.node(g).isInline;){if(!g)return!1;g--}return!!e.node(g).isTextblock&&(c&&c(b.tr.setSelection(f.U3.create(b.doc,a<0?e.start(g):e.end(g)))),!0)}}let y=x(-1),z=x(1);function A(a,b=null){return function(c,d){let e=!1;for(let d=0;d<c.selection.ranges.length&&!e;d++){let{$from:{pos:f},$to:{pos:g}}=c.selection.ranges[d];c.doc.nodesBetween(f,g,(d,f)=>{if(e)return!1;if(!(!d.isTextblock||d.hasMarkup(a,b)))if(d.type==a)e=!0;else{let b=c.doc.resolve(f),d=b.index();e=b.parent.canReplaceWith(d,d+1,a)}})}if(!e)return!1;if(d){let e=c.tr;for(let d=0;d<c.selection.ranges.length;d++){let{$from:{pos:f},$to:{pos:g}}=c.selection.ranges[d];e.setBlockType(f,g,a,b)}d(e.scrollIntoView())}return!0}}function B(...a){return function(b,c,d){for(let e=0;e<a.length;e++)if(a[e](b,c,d))return!0;return!1}}let C=B(g,i,l),D=B(g,o,p),E={Enter:B(r,u,v,(a,b)=>{let{$from:c,$to:e}=a.selection;if(a.selection instanceof f.nh&&a.selection.node.isBlock)return!!c.parentOffset&&!!(0,d.zy)(a.doc,c.pos)&&(b&&b(a.tr.split(c.pos).scrollIntoView()),!0);if(!c.depth)return!1;let g=[],h,i,j=!1,k=!1;for(let a=c.depth;;a--){if(c.node(a).isBlock){let b;j=c.end(a)==c.pos+(c.depth-a),k=c.start(a)==c.pos-(c.depth-a),i=s(c.node(a-1).contentMatchAt(c.indexAfter(a-1)));g.unshift(b||(j&&i?{type:i}:null)),h=a;break}if(1==a)return!1;g.unshift(null)}let l=a.tr;(a.selection instanceof f.U3||a.selection instanceof f.i5)&&l.deleteSelection();let m=l.mapping.map(c.pos),n=(0,d.zy)(l.doc,m,g.length,g);if(n||(g[0]=i?{type:i}:null,n=(0,d.zy)(l.doc,m,g.length,g)),!n)return!1;if(l.split(m,g.length,g),!j&&k&&c.node(h).type!=i){let a=l.mapping.map(c.before(h)),b=l.doc.resolve(a);i&&c.node(h-1).canReplaceWith(b.index(),b.index()+1,i)&&l.setNodeMarkup(l.mapping.map(c.before(h)),i)}return b&&b(l.scrollIntoView()),!0}),"Mod-Enter":t,Backspace:C,"Mod-Backspace":C,"Shift-Backspace":C,Delete:D,"Mod-Delete":D,"Mod-a":(a,b)=>(b&&b(a.tr.setSelection(new f.i5(a.doc))),!0)},F={"Ctrl-h":E.Backspace,"Alt-Backspace":E["Mod-Backspace"],"Ctrl-d":E.Delete,"Ctrl-Alt-Backspace":E["Mod-Delete"],"Alt-Delete":E["Mod-Delete"],"Alt-d":E["Mod-Delete"],"Ctrl-a":y,"Ctrl-e":z};for(let a in E)F[a]=E[a];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var G=c(669661),H=c(478853),I=Object.defineProperty,J=(a,b)=>{for(var c in b)I(a,c,{get:b[c],enumerable:!0})};function K(a){let{state:b,transaction:c}=a,{selection:d}=c,{doc:e}=c,{storedMarks:f}=c;return{...b,apply:b.apply.bind(b),applyTransaction:b.applyTransaction.bind(b),plugins:b.plugins,schema:b.schema,reconfigure:b.reconfigure.bind(b),toJSON:b.toJSON.bind(b),get storedMarks(){return f},get selection(){return d},get doc(){return e},get tr(){return d=c.selection,e=c.doc,f=c.storedMarks,c}}}var L=class{constructor(a){this.editor=a.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=a.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:a,editor:b,state:c}=this,{view:d}=b,{tr:e}=c,f=this.buildProps(e);return Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(...a)=>{let c=b(...a)(f);return e.getMeta("preventDispatch")||this.hasCustomState||d.dispatch(e),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(a,b=!0){let{rawCommands:c,editor:d,state:e}=this,{view:f}=d,g=[],h=!!a,i=a||e.tr,j=()=>(h||!b||i.getMeta("preventDispatch")||this.hasCustomState||f.dispatch(i),g.every(a=>!0===a)),k={...Object.fromEntries(Object.entries(c).map(([a,c])=>[a,(...a)=>{let d=this.buildProps(i,b),e=c(...a)(d);return g.push(e),k}])),run:j};return k}createCan(a){let{rawCommands:b,state:c}=this,d=a||c.tr,e=this.buildProps(d,!1);return{...Object.fromEntries(Object.entries(b).map(([a,b])=>[a,(...a)=>b(...a)({...e,dispatch:void 0})])),chain:()=>this.createChain(d,!1)}}buildProps(a,b=!0){let{rawCommands:c,editor:d,state:e}=this,{view:f}=d,g={tr:a,editor:d,view:f,state:K({state:e,transaction:a}),dispatch:b?()=>void 0:void 0,chain:()=>this.createChain(a,b),can:()=>this.createCan(a),get commands(){return Object.fromEntries(Object.entries(c).map(([a,b])=>[a,(...a)=>b(...a)(g)]))}};return g}},M={};J(M,{blur:()=>N,clearContent:()=>O,clearNodes:()=>P,command:()=>Q,createParagraphNear:()=>R,cut:()=>S,deleteCurrentNode:()=>T,deleteNode:()=>V,deleteRange:()=>W,deleteSelection:()=>X,enter:()=>Y,exitCode:()=>Z,extendMarkRange:()=>af,first:()=>ag,focus:()=>am,forEach:()=>an,insertContent:()=>ao,insertContentAt:()=>as,joinBackward:()=>av,joinDown:()=>au,joinForward:()=>aw,joinItemBackward:()=>ax,joinItemForward:()=>ay,joinTextblockBackward:()=>az,joinTextblockForward:()=>aA,joinUp:()=>at,keyboardShortcut:()=>aC,lift:()=>aE,liftEmptyBlock:()=>aF,liftListItem:()=>aG,newlineInCode:()=>aH,resetAttributes:()=>aK,scrollIntoView:()=>aL,selectAll:()=>aM,selectNodeBackward:()=>aN,selectNodeForward:()=>aO,selectParentNode:()=>aP,selectTextblockEnd:()=>aQ,selectTextblockStart:()=>aR,setContent:()=>aT,setMark:()=>bx,setMeta:()=>by,setNode:()=>bz,setNodeSelection:()=>bA,setTextDirection:()=>bB,setTextSelection:()=>bC,sinkListItem:()=>bD,splitBlock:()=>bF,splitListItem:()=>bG,toggleList:()=>bJ,toggleMark:()=>bK,toggleNode:()=>bL,toggleWrap:()=>bM,undoInputRule:()=>bN,unsetAllMarks:()=>bO,unsetMark:()=>bP,unsetTextDirection:()=>bQ,updateAttributes:()=>bR,wrapIn:()=>bS,wrapInList:()=>bT});var N=()=>({editor:a,view:b})=>(requestAnimationFrame(()=>{var c;a.isDestroyed||(b.dom.blur(),null==(c=null==window?void 0:window.getSelection())||c.removeAllRanges())}),!0),O=(a=!0)=>({commands:b})=>b.setContent("",{emitUpdate:a}),P=()=>({state:a,tr:b,dispatch:c})=>{let{selection:e}=b,{ranges:f}=e;return!c||(f.forEach(({$from:c,$to:e})=>{a.doc.nodesBetween(c.pos,e.pos,(a,c)=>{if(a.type.isText)return;let{doc:e,mapping:f}=b,g=e.resolve(f.map(c)),h=e.resolve(f.map(c+a.nodeSize)),i=g.blockRange(h);if(!i)return;let j=(0,d.jP)(i);if(a.type.isTextblock){let{defaultType:a}=g.parent.contentMatchAt(g.index());b.setNodeMarkup(i.start,a)}(j||0===j)&&b.lift(i,j)})}),!0)},Q=a=>b=>a(b),R=()=>({state:a,dispatch:b})=>u(a,b),S=(a,b)=>({editor:c,tr:d})=>{let{state:e}=c,g=e.doc.slice(a.from,a.to);d.deleteRange(a.from,a.to);let h=d.mapping.map(b);return d.insert(h,g.content),d.setSelection(new f.U3(d.doc.resolve(Math.max(h-1,0)))),!0},T=()=>({tr:a,dispatch:b})=>{let{selection:c}=a,d=c.$anchor.node();if(d.content.size>0)return!1;let e=a.selection.$anchor;for(let c=e.depth;c>0;c-=1)if(e.node(c).type===d.type){if(b){let b=e.before(c),d=e.after(c);a.delete(b,d).scrollIntoView()}return!0}return!1};function U(a,b){if("string"==typeof a){if(!b.nodes[a])throw Error(`There is no node type named '${a}'. Maybe you forgot to add the extension?`);return b.nodes[a]}return a}var V=a=>({tr:b,state:c,dispatch:d})=>{let e=U(a,c.schema),f=b.selection.$anchor;for(let a=f.depth;a>0;a-=1)if(f.node(a).type===e){if(d){let c=f.before(a),d=f.after(a);b.delete(c,d).scrollIntoView()}return!0}return!1},W=a=>({tr:b,dispatch:c})=>{let{from:d,to:e}=a;return c&&b.delete(d,e),!0},X=()=>({state:a,dispatch:b})=>g(a,b),Y=()=>({commands:a})=>a.keyboardShortcut("Enter"),Z=()=>({state:a,dispatch:b})=>t(a,b);function _(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function aa(a,b,c={strict:!0}){let d=Object.keys(b);return!d.length||d.every(d=>c.strict?b[d]===a[d]:_(b[d])?b[d].test(a[d]):b[d]===a[d])}function ab(a,b,c={}){return a.find(a=>a.type===b&&aa(Object.fromEntries(Object.keys(c).map(b=>[b,a.attrs[b]])),c))}function ac(a,b,c={}){return!!ab(a,b,c)}function ad(a,b,c){var d;if(!a||!b)return;let e=a.parent.childAfter(a.parentOffset);if(e.node&&e.node.marks.some(a=>a.type===b)||(e=a.parent.childBefore(a.parentOffset)),!e.node||!e.node.marks.some(a=>a.type===b)||(c=c||(null==(d=e.node.marks[0])?void 0:d.attrs),!ab([...e.node.marks],b,c)))return;let f=e.index,g=a.start()+e.offset,h=f+1,i=g+e.node.nodeSize;for(;f>0&&ac([...a.parent.child(f-1).marks],b,c);)f-=1,g-=a.parent.child(f).nodeSize;for(;h<a.parent.childCount&&ac([...a.parent.child(h).marks],b,c);)i+=a.parent.child(h).nodeSize,h+=1;return{from:g,to:i}}function ae(a,b){if("string"==typeof a){if(!b.marks[a])throw Error(`There is no mark type named '${a}'. Maybe you forgot to add the extension?`);return b.marks[a]}return a}var af=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let g=ae(a,d.schema),{doc:h,selection:i}=c,{$from:j,from:k,to:l}=i;if(e){let a=ad(j,g,b);if(a&&a.from<=k&&a.to>=l){let b=f.U3.create(h,a.from,a.to);c.setSelection(b)}}return!0},ag=a=>b=>{let c="function"==typeof a?a(b):a;for(let a=0;a<c.length;a+=1)if(c[a](b))return!0;return!1};function ah(a){return a instanceof f.U3}function ai(a=0,b=0,c=0){return Math.min(Math.max(a,b),c)}function aj(a,b=null){if(!b)return null;let c=f.LN.atStart(a),d=f.LN.atEnd(a);if("start"===b||!0===b)return c;if("end"===b)return d;let e=c.from,g=d.to;return"all"===b?f.U3.create(a,ai(0,e,g),ai(a.content.size,e,g)):f.U3.create(a,ai(b,e,g),ai(b,e,g))}function ak(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function al(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var am=(a=null,b={})=>({editor:c,view:d,tr:e,dispatch:f})=>{b={scrollIntoView:!0,...b};let g=()=>{(al()||ak())&&d.dom.focus(),"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!al()&&!ak()&&d.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!c.isDestroyed&&(d.focus(),(null==b?void 0:b.scrollIntoView)&&c.commands.scrollIntoView())})};try{if(d.hasFocus()&&null===a||!1===a)return!0}catch{return!1}if(f&&null===a&&!ah(c.state.selection))return g(),!0;let h=aj(e.doc,a)||c.state.selection,i=c.state.selection.eq(h);return f&&(i||e.setSelection(h),i&&e.storedMarks&&e.setStoredMarks(e.storedMarks),g()),!0},an=(a,b)=>c=>a.every((a,d)=>b(a,{...c,index:d})),ao=(a,b)=>({tr:c,commands:d})=>d.insertContentAt({from:c.selection.from,to:c.selection.to},a,b),ap=a=>{let b=a.childNodes;for(let c=b.length-1;c>=0;c-=1){let d=b[c];3===d.nodeType&&d.nodeValue&&/^(\n\s\s|\n)$/.test(d.nodeValue)?a.removeChild(d):1===d.nodeType&&ap(d)}return a};function aq(a){if("undefined"==typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let b=`<body>${a}</body>`;return ap(new window.DOMParser().parseFromString(b,"text/html").body)}function ar(a,b,c){if(a instanceof e.bP||a instanceof e.FK)return a;c={slice:!0,parseOptions:{},...c};let d="object"==typeof a&&null!==a,f="string"==typeof a;if(d)try{if(Array.isArray(a)&&a.length>0)return e.FK.fromArray(a.map(a=>b.nodeFromJSON(a)));let d=b.nodeFromJSON(a);return c.errorOnInvalidContent&&d.check(),d}catch(d){if(c.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:d});return console.warn("[tiptap warn]: Invalid content.","Passed value:",a,"Error:",d),ar("",b,c)}if(f){if(c.errorOnInvalidContent){let d=!1,f="",g=new e.Sj({topNode:b.spec.topNode,marks:b.spec.marks,nodes:b.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:a=>(d=!0,f="string"==typeof a?a:a.outerHTML,null)}]}})});if(c.slice?e.S4.fromSchema(g).parseSlice(aq(a),c.parseOptions):e.S4.fromSchema(g).parse(aq(a),c.parseOptions),c.errorOnInvalidContent&&d)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${f}`)})}let d=e.S4.fromSchema(b);return c.slice?d.parseSlice(aq(a),c.parseOptions).content:d.parse(aq(a),c.parseOptions)}return ar("",b,c)}var as=(a,b,c)=>({tr:g,dispatch:h,editor:i})=>{var j;if(h){let h,k;c={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...c};let l=a=>{i.emit("contentError",{editor:i,error:a,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...c.parseOptions};if(!c.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ar(b,i.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(a){l(a)}try{h=ar(b,i.schema,{parseOptions:m,errorOnInvalidContent:null!=(j=c.errorOnInvalidContent)?j:i.options.enableContentCheck})}catch(a){return l(a),!1}let{from:n,to:o}="number"==typeof a?{from:a,to:a}:{from:a.from,to:a.to},p=!0,q=!0;if((!("type"in h)?h:[h]).forEach(a=>{a.check(),p=!!p&&a.isText&&0===a.marks.length,q=!!q&&a.isBlock}),n===o&&q){let{parent:a}=g.doc.resolve(n);!a.isTextblock||a.type.spec.code||a.childCount||(n-=1,o+=1)}if(p){if(Array.isArray(b))k=b.map(a=>a.text||"").join("");else if(b instanceof e.FK){let a="";b.forEach(b=>{b.text&&(a+=b.text)}),k=a}else k="object"==typeof b&&b&&b.text?b.text:b;g.insertText(k,n,o)}else{k=h;let a=g.doc.resolve(n),b=a.node(),c=0===a.parentOffset,d=b.isText||b.isTextblock,e=b.content.size>0;c&&d&&e&&(n=Math.max(0,n-1)),g.replaceWith(n,o,k)}c.updateSelection&&function(a,b,c){let e=a.steps.length-1;if(e<b)return;let g=a.steps[e];if(!(g instanceof d.Ln||g instanceof d.Wg))return;let h=a.mapping.maps[e],i=0;h.forEach((a,b,c,d)=>{0===i&&(i=d)}),a.setSelection(f.LN.near(a.doc.resolve(i),-1))}(g,g.steps.length-1,0),c.applyInputRules&&g.setMeta("applyInputRules",{from:n,text:k}),c.applyPasteRules&&g.setMeta("applyPasteRules",{from:n,text:k})}return!0},at=()=>({state:a,dispatch:b})=>((a,b)=>{let c=a.selection,e=c instanceof f.nh,g;if(e){if(c.node.isTextblock||!(0,d.n9)(a.doc,c.from))return!1;g=c.from}else if(null==(g=(0,d.N0)(a.doc,c.from,-1)))return!1;if(b){let c=a.tr.join(g);e&&c.setSelection(f.nh.create(c.doc,g-a.doc.resolve(g).nodeBefore.nodeSize)),b(c.scrollIntoView())}return!0})(a,b),au=()=>({state:a,dispatch:b})=>((a,b)=>{let c=a.selection,e;if(c instanceof f.nh){if(c.node.isTextblock||!(0,d.n9)(a.doc,c.to))return!1;e=c.to}else if(null==(e=(0,d.N0)(a.doc,c.to,1)))return!1;return b&&b(a.tr.join(e).scrollIntoView()),!0})(a,b),av=()=>({state:a,dispatch:b})=>i(a,b),aw=()=>({state:a,dispatch:b})=>o(a,b),ax=()=>({state:a,dispatch:b,tr:c})=>{try{let e=(0,d.N0)(a.doc,a.selection.$from.pos,-1);if(null==e)return!1;return c.join(e,2),b&&b(c),!0}catch{return!1}},ay=()=>({state:a,dispatch:b,tr:c})=>{try{let e=(0,d.N0)(a.doc,a.selection.$from.pos,1);if(null==e)return!1;return c.join(e,2),b&&b(c),!0}catch{return!1}},az=()=>({state:a,dispatch:b})=>((a,b,c)=>{let d=h(a,c);if(!d)return!1;let e=m(d);return!!e&&j(a,e,b)})(a,b),aA=()=>({state:a,dispatch:b})=>((a,b,c)=>{let d=n(a,c);if(!d)return!1;let e=q(d);return!!e&&j(a,e,b)})(a,b);function aB(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var aC=a=>({editor:b,view:c,tr:d,dispatch:e})=>{let f=(function(a){let b,c,d,e,f=a.split(/-(?!$)/),g=f[f.length-1];"Space"===g&&(g=" ");for(let a=0;a<f.length-1;a+=1){let g=f[a];if(/^(cmd|meta|m)$/i.test(g))e=!0;else if(/^a(lt)?$/i.test(g))b=!0;else if(/^(c|ctrl|control)$/i.test(g))c=!0;else if(/^s(hift)?$/i.test(g))d=!0;else if(/^mod$/i.test(g))al()||aB()?e=!0:c=!0;else throw Error(`Unrecognized modifier name: ${g}`)}return b&&(g=`Alt-${g}`),c&&(g=`Ctrl-${g}`),e&&(g=`Meta-${g}`),d&&(g=`Shift-${g}`),g})(a).split(/-(?!$)/),g=f.find(a=>!["Alt","Ctrl","Meta","Shift"].includes(a)),h=new KeyboardEvent("keydown",{key:"Space"===g?" ":g,altKey:f.includes("Alt"),ctrlKey:f.includes("Ctrl"),metaKey:f.includes("Meta"),shiftKey:f.includes("Shift"),bubbles:!0,cancelable:!0}),i=b.captureTransaction(()=>{c.someProp("handleKeyDown",a=>a(c,h))});return null==i||i.steps.forEach(a=>{let b=a.map(d.mapping);b&&e&&d.maybeStep(b)}),!0};function aD(a,b,c={}){let{from:d,to:e,empty:f}=a.selection,g=b?U(b,a.schema):null,h=[];a.doc.nodesBetween(d,e,(a,b)=>{if(a.isText)return;let c=Math.max(d,b),f=Math.min(e,b+a.nodeSize);h.push({node:a,from:c,to:f})});let i=e-d,j=h.filter(a=>!g||g.name===a.node.type.name).filter(a=>aa(a.node.attrs,c,{strict:!1}));return f?!!j.length:j.reduce((a,b)=>a+b.to-b.from,0)>=i}var aE=(a,b={})=>({state:c,dispatch:e})=>{let f=U(a,c.schema);return!!aD(c,f,b)&&((a,b)=>{let{$from:c,$to:e}=a.selection,f=c.blockRange(e),g=f&&(0,d.jP)(f);return null!=g&&(b&&b(a.tr.lift(f,g).scrollIntoView()),!0)})(c,e)},aF=()=>({state:a,dispatch:b})=>v(a,b),aG=a=>({state:b,dispatch:c})=>(function(a){return function(b,c){let{$from:f,$to:g}=b.selection,h=f.blockRange(g,b=>b.childCount>0&&b.firstChild.type==a);return!!h&&(!c||(f.node(h.depth-1).type==a?function(a,b,c,f){let g=a.tr,h=f.end,i=f.$to.end(f.depth);h<i&&(g.step(new d.Wg(h-1,i,h,i,new e.Ji(e.FK.from(c.create(null,f.parent.copy())),1,0),1,!0)),f=new e.u$(g.doc.resolve(f.$from.pos),g.doc.resolve(i),f.depth));let j=(0,d.jP)(f);if(null==j)return!1;g.lift(f,j);let k=g.doc.resolve(g.mapping.map(h,-1)-1);return(0,d.n9)(g.doc,k.pos)&&k.nodeBefore.type==k.nodeAfter.type&&g.join(k.pos),b(g.scrollIntoView()),!0}(b,c,a,h):function(a,b,c){let f=a.tr,g=c.parent;for(let a=c.end,b=c.endIndex-1,d=c.startIndex;b>d;b--)a-=g.child(b).nodeSize,f.delete(a-1,a+1);let h=f.doc.resolve(c.start),i=h.nodeAfter;if(f.mapping.map(c.end)!=c.start+h.nodeAfter.nodeSize)return!1;let j=0==c.startIndex,k=c.endIndex==g.childCount,l=h.node(-1),m=h.index(-1);if(!l.canReplace(m+ +!j,m+1,i.content.append(k?e.FK.empty:e.FK.from(g))))return!1;let n=h.pos,o=n+i.nodeSize;return f.step(new d.Wg(n-!!j,o+ +!!k,n+1,o-1,new e.Ji((j?e.FK.empty:e.FK.from(g.copy(e.FK.empty))).append(k?e.FK.empty:e.FK.from(g.copy(e.FK.empty))),+!j,+!k),+!j)),b(f.scrollIntoView()),!0}(b,c,h)))}})(U(a,b.schema))(b,c),aH=()=>({state:a,dispatch:b})=>r(a,b);function aI(a,b){return b.nodes[a]?"node":b.marks[a]?"mark":null}function aJ(a,b){let c="string"==typeof b?[b]:b;return Object.keys(a).reduce((b,d)=>(c.includes(d)||(b[d]=a[d]),b),{})}var aK=(a,b)=>({tr:c,state:d,dispatch:e})=>{let f=null,g=null,h=aI("string"==typeof a?a:a.name,d.schema);if(!h)return!1;"node"===h&&(f=U(a,d.schema)),"mark"===h&&(g=ae(a,d.schema));let i=!1;return c.selection.ranges.forEach(a=>{d.doc.nodesBetween(a.$from.pos,a.$to.pos,(a,d)=>{f&&f===a.type&&(i=!0,e&&c.setNodeMarkup(d,void 0,aJ(a.attrs,b))),g&&a.marks.length&&a.marks.forEach(f=>{g===f.type&&(i=!0,e&&c.addMark(d,d+a.nodeSize,g.create(aJ(f.attrs,b))))})})}),i},aL=()=>({tr:a,dispatch:b})=>(b&&a.scrollIntoView(),!0),aM=()=>({tr:a,dispatch:b})=>{if(b){let b=new f.i5(a.doc);a.setSelection(b)}return!0},aN=()=>({state:a,dispatch:b})=>l(a,b),aO=()=>({state:a,dispatch:b})=>p(a,b),aP=()=>({state:a,dispatch:b})=>((a,b)=>{let{$from:c,to:d}=a.selection,e,g=c.sharedDepth(d);return 0!=g&&(e=c.before(g),b&&b(a.tr.setSelection(f.nh.create(a.doc,e))),!0)})(a,b),aQ=()=>({state:a,dispatch:b})=>z(a,b),aR=()=>({state:a,dispatch:b})=>y(a,b);function aS(a,b,c={},d={}){return ar(a,b,{slice:!1,parseOptions:c,errorOnInvalidContent:d.errorOnInvalidContent})}var aT=(a,{errorOnInvalidContent:b,emitUpdate:c=!0,parseOptions:d={}}={})=>({editor:e,tr:f,dispatch:g,commands:h})=>{let{doc:i}=f;if("full"!==d.preserveWhitespace){let h=aS(a,e.schema,d,{errorOnInvalidContent:null!=b?b:e.options.enableContentCheck});return g&&f.replaceWith(0,i.content.size,h).setMeta("preventUpdate",!c),!0}return g&&f.setMeta("preventUpdate",!c),h.insertContentAt({from:0,to:i.content.size},a,{parseOptions:d,errorOnInvalidContent:null!=b?b:e.options.enableContentCheck})};function aU(a,b){let c=ae(b,a.schema),{from:d,to:e,empty:f}=a.selection,g=[];f?(a.storedMarks&&g.push(...a.storedMarks),g.push(...a.selection.$head.marks())):a.doc.nodesBetween(d,e,a=>{g.push(...a.marks)});let h=g.find(a=>a.type.name===c.name);return h?{...h.attrs}:{}}function aV(a,b){let c=new d.dL(a);return b.forEach(a=>{a.steps.forEach(a=>{c.step(a)})}),c}function aW(a,b,c){let d=[];return a.nodesBetween(b.from,b.to,(a,b)=>{c(a)&&d.push({node:a,pos:b})}),d}function aX(a,b){for(let c=a.depth;c>0;c-=1){let d=a.node(c);if(b(d))return{pos:c>0?a.before(c):0,start:a.start(c),depth:c,node:d}}}function aY(a){return b=>aX(b.$from,a)}function aZ(a,b,c){return void 0===a.config[b]&&a.parent?aZ(a.parent,b,c):"function"==typeof a.config[b]?a.config[b].bind({...c,parent:a.parent?aZ(a.parent,b,c):null}):a.config[b]}function a$(a){return a.map(a=>{let b={name:a.name,options:a.options,storage:a.storage},c=aZ(a,"addExtensions",b);return c?[a,...a$(c())]:a}).flat(10)}function a_(a,b){let c=e.ZF.fromSchema(b).serializeFragment(a),d=document.implementation.createHTMLDocument().createElement("div");return d.appendChild(c),d.innerHTML}function a0(a){return"function"==typeof a}function a1(a,b,...c){return a0(a)?b?a.bind(b)(...c):a(...c):a}function a2(a){let b=a.filter(a=>"extension"===a.type);return{baseExtensions:b,nodeExtensions:a.filter(a=>"node"===a.type),markExtensions:a.filter(a=>"mark"===a.type)}}function a3(a){let b=[],{nodeExtensions:c,markExtensions:d}=a2(a),e=[...c,...d],f={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return a.forEach(a=>{let c={name:a.name,options:a.options,storage:a.storage,extensions:e},d=aZ(a,"addGlobalAttributes",c);d&&d().forEach(a=>{a.types.forEach(c=>{Object.entries(a.attributes).forEach(([a,d])=>{b.push({type:c,name:a,attribute:{...f,...d}})})})})}),e.forEach(a=>{let c={name:a.name,options:a.options,storage:a.storage},d=aZ(a,"addAttributes",c);d&&Object.entries(d()).forEach(([c,d])=>{let e={...f,...d};"function"==typeof(null==e?void 0:e.default)&&(e.default=e.default()),(null==e?void 0:e.isRequired)&&(null==e?void 0:e.default)===void 0&&delete e.default,b.push({type:a.name,name:c,attribute:e})})}),b}function a4(...a){return a.filter(a=>!!a).reduce((a,b)=>{let c={...a};return Object.entries(b).forEach(([a,b])=>{if(!c[a]){c[a]=b;return}if("class"===a){let d=b?String(b).split(" "):[],e=c[a]?c[a].split(" "):[],f=d.filter(a=>!e.includes(a));c[a]=[...e,...f].join(" ")}else if("style"===a){let d=b?b.split(";").map(a=>a.trim()).filter(Boolean):[],e=c[a]?c[a].split(";").map(a=>a.trim()).filter(Boolean):[],f=new Map;e.forEach(a=>{let[b,c]=a.split(":").map(a=>a.trim());f.set(b,c)}),d.forEach(a=>{let[b,c]=a.split(":").map(a=>a.trim());f.set(b,c)}),c[a]=Array.from(f.entries()).map(([a,b])=>`${a}: ${b}`).join("; ")}else c[a]=b}),c},{})}function a5(a,b){return b.filter(b=>b.type===a.type.name).filter(a=>a.attribute.rendered).map(b=>b.attribute.renderHTML?b.attribute.renderHTML(a.attrs)||{}:{[b.name]:a.attrs[b.name]}).reduce((a,b)=>a4(a,b),{})}function a6(a,b){return"style"in a?a:{...a,getAttrs:c=>{let d=a.getAttrs?a.getAttrs(c):a.attrs;if(!1===d)return!1;let e=b.reduce((a,b)=>{var d;let e=b.attribute.parseHTML?b.attribute.parseHTML(c):"string"!=typeof(d=c.getAttribute(b.name))?d:d.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(d):"true"===d||"false"!==d&&d;return null==e?a:{...a,[b.name]:e}},{});return{...d,...e}}}}function a7(a){return Object.fromEntries(Object.entries(a).filter(([a,b])=>!("attrs"===a&&function(a={}){return 0===Object.keys(a).length&&a.constructor===Object}(b))&&null!=b))}function a8(a){var b,c;let d={};return!(null==(b=null==a?void 0:a.attribute)?void 0:b.isRequired)&&"default"in((null==a?void 0:a.attribute)||{})&&(d.default=a.attribute.default),(null==(c=null==a?void 0:a.attribute)?void 0:c.validate)!==void 0&&(d.validate=a.attribute.validate),[a.name,d]}function a9(a,b){var c;let d=a3(a),{nodeExtensions:f,markExtensions:g}=a2(a),h=null==(c=f.find(a=>aZ(a,"topNode")))?void 0:c.name,i=Object.fromEntries(f.map(c=>{let e=d.filter(a=>a.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:b},g=a7({...a.reduce((a,b)=>{let d=aZ(b,"extendNodeSchema",f);return{...a,...d?d(c):{}}},{}),content:a1(aZ(c,"content",f)),marks:a1(aZ(c,"marks",f)),group:a1(aZ(c,"group",f)),inline:a1(aZ(c,"inline",f)),atom:a1(aZ(c,"atom",f)),selectable:a1(aZ(c,"selectable",f)),draggable:a1(aZ(c,"draggable",f)),code:a1(aZ(c,"code",f)),whitespace:a1(aZ(c,"whitespace",f)),linebreakReplacement:a1(aZ(c,"linebreakReplacement",f)),defining:a1(aZ(c,"defining",f)),isolating:a1(aZ(c,"isolating",f)),attrs:Object.fromEntries(e.map(a8))}),h=a1(aZ(c,"parseHTML",f));h&&(g.parseDOM=h.map(a=>a6(a,e)));let i=aZ(c,"renderHTML",f);i&&(g.toDOM=a=>i({node:a,HTMLAttributes:a5(a,e)}));let j=aZ(c,"renderText",f);return j&&(g.toText=j),[c.name,g]})),j=Object.fromEntries(g.map(c=>{let e=d.filter(a=>a.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:b},g=a7({...a.reduce((a,b)=>{let d=aZ(b,"extendMarkSchema",f);return{...a,...d?d(c):{}}},{}),inclusive:a1(aZ(c,"inclusive",f)),excludes:a1(aZ(c,"excludes",f)),group:a1(aZ(c,"group",f)),spanning:a1(aZ(c,"spanning",f)),code:a1(aZ(c,"code",f)),attrs:Object.fromEntries(e.map(a8))}),h=a1(aZ(c,"parseHTML",f));h&&(g.parseDOM=h.map(a=>a6(a,e)));let i=aZ(c,"renderHTML",f);return i&&(g.toDOM=a=>i({mark:a,HTMLAttributes:a5(a,e)})),[c.name,g]}));return new e.Sj({topNode:h,nodes:i,marks:j})}function ba(a){return a.sort((a,b)=>{let c=aZ(a,"priority")||100,d=aZ(b,"priority")||100;return c>d?-1:+(c<d)})}function bb(a){var b;let c=ba(a$(a)),d=Array.from(new Set((b=c.map(a=>a.name)).filter((a,c)=>b.indexOf(a)!==c)));return d.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${d.map(a=>`'${a}'`).join(", ")}]. This can lead to issues.`),c}function bc(a,b){let c=a9(bb(b),void 0),d=aq(a);return e.S4.fromSchema(c).parse(d).toJSON()}function bd(a,b,c){let{from:d,to:e}=b,{blockSeparator:f="\n\n",textSerializers:g={}}=c||{},h="";return a.nodesBetween(d,e,(a,c,i,j)=>{var k;a.isBlock&&c>d&&(h+=f);let l=null==g?void 0:g[a.type.name];if(l)return i&&(h+=l({node:a,pos:c,parent:i,index:j,range:b})),!1;a.isText&&(h+=null==(k=null==a?void 0:a.text)?void 0:k.slice(Math.max(d,c)-c,e-c))}),h}function be(a,b){let c={from:0,to:a.content.size};return bd(a,c,b)}function bf(a){return Object.fromEntries(Object.entries(a.nodes).filter(([,a])=>a.spec.toText).map(([a,b])=>[a,b.spec.toText]))}function bg(a,b){let c=aI("string"==typeof b?b:b.name,a.schema);if("node"===c){let c=U(b,a.schema),{from:d,to:e}=a.selection,f=[];a.doc.nodesBetween(d,e,a=>{f.push(a)});let g=f.reverse().find(a=>a.type.name===c.name);return g?{...g.attrs}:{}}return"mark"===c?aU(a,b):{}}function bh(a){let{mapping:b,steps:c}=a,d=[];b.maps.forEach((a,e)=>{let f=[];if(a.ranges.length)a.forEach((a,b)=>{f.push({from:a,to:b})});else{let{from:a,to:b}=c[e];if(void 0===a||void 0===b)return;f.push({from:a,to:b})}f.forEach(({from:a,to:c})=>{let f=b.slice(e).map(a,-1),g=b.slice(e).map(c),h=b.invert().map(f,-1),i=b.invert().map(g);d.push({oldRange:{from:h,to:i},newRange:{from:f,to:g}})})});let e=function(a,b=JSON.stringify){let c={};return a.filter(a=>{let d=b(a);return!Object.prototype.hasOwnProperty.call(c,d)&&(c[d]=!0)})}(d);return 1===e.length?e:e.filter((a,b)=>!e.filter((a,c)=>c!==b).some(b=>a.oldRange.from>=b.oldRange.from&&a.oldRange.to<=b.oldRange.to&&a.newRange.from>=b.newRange.from&&a.newRange.to<=b.newRange.to))}function bi(a,b,c){let d=[];return a===b?c.resolve(a).marks().forEach(b=>{let e=ad(c.resolve(a),b.type);e&&d.push({mark:b,...e})}):c.nodesBetween(a,b,(a,b)=>{a&&(null==a?void 0:a.nodeSize)!==void 0&&d.push(...a.marks.map(c=>({from:b,to:b+a.nodeSize,mark:c})))}),d}var bj=(a,b,c,d=20)=>{let e=a.doc.resolve(c),f=d,g=null;for(;f>0&&null===g;){let a=e.node(f);(null==a?void 0:a.type.name)===b?g=a:f-=1}return[g,f]};function bk(a,b){return b.nodes[a]||b.marks[a]||null}function bl(a,b,c){return Object.fromEntries(Object.entries(c).filter(([c])=>{let d=a.find(a=>a.type===b&&a.name===c);return!!d&&d.attribute.keepOnSplit}))}function bm(a,b,c={}){let{empty:d,ranges:e}=a.selection,f=b?ae(b,a.schema):null;if(d)return!!(a.storedMarks||a.selection.$from.marks()).filter(a=>!f||f.name===a.type.name).find(a=>aa(a.attrs,c,{strict:!1}));let g=0,h=[];if(e.forEach(({$from:b,$to:c})=>{let d=b.pos,e=c.pos;a.doc.nodesBetween(d,e,(a,b)=>{if(!a.isText&&!a.marks.length)return;let c=Math.max(d,b),f=Math.min(e,b+a.nodeSize);g+=f-c,h.push(...a.marks.map(a=>({mark:a,from:c,to:f})))})}),0===g)return!1;let i=h.filter(a=>!f||f.name===a.mark.type.name).filter(a=>aa(a.mark.attrs,c,{strict:!1})).reduce((a,b)=>a+b.to-b.from,0),j=h.filter(a=>!f||a.mark.type!==f&&a.mark.type.excludes(f)).reduce((a,b)=>a+b.to-b.from,0);return(i>0?i+j:i)>=g}var bn=(a,b)=>{let{$from:c,$to:d,$anchor:e}=a.selection;if(b){let c=aY(a=>a.type.name===b)(a.selection);if(!c)return!1;let d=a.doc.resolve(c.pos+1);return e.pos+1===d.end()}return!(d.parentOffset<d.parent.nodeSize-2)&&c.pos===d.pos},bo=a=>{let{$from:b,$to:c}=a.selection;return!(b.parentOffset>0)&&b.pos===c.pos};function bp(a,b){return Array.isArray(b)?b.some(b=>("string"==typeof b?b:b.name)===a.name):b}function bq(a,b){let{nodeExtensions:c}=a2(b),d=c.find(b=>b.name===a);if(!d)return!1;let e={name:d.name,options:d.options,storage:d.storage},f=a1(aZ(d,"group",e));return"string"==typeof f&&f.split(" ").includes("list")}function br(a,{checkChildren:b=!0,ignoreWhitespace:c=!1}={}){var d;if(c){if("hardBreak"===a.type.name)return!0;if(a.isText)return/^\s*$/m.test(null!=(d=a.text)?d:"")}if(a.isText)return!a.text;if(a.isAtom||a.isLeaf)return!1;if(0===a.content.childCount)return!0;if(b){let d=!0;return a.content.forEach(a=>{!1!==d&&(br(a,{ignoreWhitespace:c,checkChildren:b})||(d=!1))}),d}return!1}function bs(a){return a instanceof f.nh}var bt=class a{constructor(a){this.position=a}static fromJSON(b){return new a(b.position)}toJSON(){return{position:this.position}}};function bu(a,b){let c=b.mapping.mapResult(a.position);return{position:new bt(c.pos),mapResult:c}}function bv(a){return new bt(a)}function bw(a,b,c){let d=a.state.doc.content.size,e=ai(b,0,d),f=ai(c,0,d),g=a.coordsAtPos(e),h=a.coordsAtPos(f,-1),i=Math.min(g.top,h.top),j=Math.max(g.bottom,h.bottom),k=Math.min(g.left,h.left),l=Math.max(g.right,h.right),m={top:i,bottom:j,left:k,right:l,width:l-k,height:j-i,x:k,y:i};return{...m,toJSON:()=>m}}var bx=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let{selection:f}=c,{empty:g,ranges:h}=f,i=ae(a,d.schema);if(e)if(g){let a=aU(d,i);c.addStoredMark(i.create({...a,...b}))}else h.forEach(a=>{let e=a.$from.pos,f=a.$to.pos;d.doc.nodesBetween(e,f,(a,d)=>{let g=Math.max(d,e),h=Math.min(d+a.nodeSize,f);a.marks.find(a=>a.type===i)?a.marks.forEach(a=>{i===a.type&&c.addMark(g,h,i.create({...a.attrs,...b}))}):c.addMark(g,h,i.create(b))})});return function(a,b,c){var d;let{selection:e}=b,f=null;if(ah(e)&&(f=e.$cursor),f){let b=null!=(d=a.storedMarks)?d:f.marks();return f.parent.type.allowsMarkType(c)&&(!!c.isInSet(b)||!b.some(a=>a.type.excludes(c)))}let{ranges:g}=e;return g.some(({$from:b,$to:d})=>{let e=0===b.depth&&a.doc.inlineContent&&a.doc.type.allowsMarkType(c);return a.doc.nodesBetween(b.pos,d.pos,(a,b,d)=>{if(e)return!1;if(a.isInline){let b=!d||d.type.allowsMarkType(c),f=!!c.isInSet(a.marks)||!a.marks.some(a=>a.type.excludes(c));e=b&&f}return!e}),e})}(d,c,i)},by=(a,b)=>({tr:c})=>(c.setMeta(a,b),!0),bz=(a,b={})=>({state:c,dispatch:d,chain:e})=>{let f,g=U(a,c.schema);return(c.selection.$anchor.sameParent(c.selection.$head)&&(f=c.selection.$anchor.parent.attrs),g.isTextblock)?e().command(({commands:a})=>!!A(g,{...f,...b})(c)||a.clearNodes()).command(({state:a})=>A(g,{...f,...b})(a,d)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bA=a=>({tr:b,dispatch:c})=>{if(c){let{doc:c}=b,d=ai(a,0,c.content.size),e=f.nh.create(c,d);b.setSelection(e)}return!0},bB=(a,b)=>({tr:c,state:d,dispatch:e})=>{let f,g,{selection:h}=d;return"number"==typeof b?(f=b,g=b):b&&"from"in b&&"to"in b?(f=b.from,g=b.to):(f=h.from,g=h.to),e&&c.doc.nodesBetween(f,g,(b,d)=>{b.isText||c.setNodeMarkup(d,void 0,{...b.attrs,dir:a})}),!0},bC=a=>({tr:b,dispatch:c})=>{if(c){let{doc:c}=b,{from:d,to:e}="number"==typeof a?{from:a,to:a}:a,g=f.U3.atStart(c).from,h=f.U3.atEnd(c).to,i=ai(d,g,h),j=ai(e,g,h),k=f.U3.create(c,i,j);b.setSelection(k)}return!0},bD=a=>({state:b,dispatch:c})=>(function(a){return function(b,c){let{$from:f,$to:g}=b.selection,h=f.blockRange(g,b=>b.childCount>0&&b.firstChild.type==a);if(!h)return!1;let i=h.startIndex;if(0==i)return!1;let j=h.parent,k=j.child(i-1);if(k.type!=a)return!1;if(c){let f=k.lastChild&&k.lastChild.type==j.type,g=e.FK.from(f?a.create():null),i=new e.Ji(e.FK.from(a.create(null,e.FK.from(j.type.create(null,g)))),f?3:1,0),l=h.start,m=h.end;c(b.tr.step(new d.Wg(l-(f?3:1),m,l,m,i,1,!0)).scrollIntoView())}return!0}})(U(a,b.schema))(b,c);function bE(a,b){let c=a.storedMarks||a.selection.$to.parentOffset&&a.selection.$from.marks();if(c){let d=c.filter(a=>null==b?void 0:b.includes(a.type.name));a.tr.ensureMarks(d)}}var bF=({keepMarks:a=!0}={})=>({tr:b,state:c,dispatch:e,editor:g})=>{let{selection:h,doc:i}=b,{$from:j,$to:k}=h,l=bl(g.extensionManager.attributes,j.node().type.name,j.node().attrs);if(h instanceof f.nh&&h.node.isBlock)return!!j.parentOffset&&!!(0,d.zy)(i,j.pos)&&(e&&(a&&bE(c,g.extensionManager.splittableMarks),b.split(j.pos).scrollIntoView()),!0);if(!j.parent.isBlock)return!1;let m=k.parentOffset===k.parent.content.size,n=0===j.depth?void 0:function(a){for(let b=0;b<a.edgeCount;b+=1){let{type:c}=a.edge(b);if(c.isTextblock&&!c.hasRequiredAttrs())return c}return null}(j.node(-1).contentMatchAt(j.indexAfter(-1))),o=m&&n?[{type:n,attrs:l}]:void 0,p=(0,d.zy)(b.doc,b.mapping.map(j.pos),1,o);if(!o&&!p&&(0,d.zy)(b.doc,b.mapping.map(j.pos),1,n?[{type:n}]:void 0)&&(p=!0,o=n?[{type:n,attrs:l}]:void 0),e){if(p&&(h instanceof f.U3&&b.deleteSelection(),b.split(b.mapping.map(j.pos),1,o),n&&!m&&!j.parentOffset&&j.parent.type!==n)){let a=b.mapping.map(j.before()),c=b.doc.resolve(a);j.node(-1).canReplaceWith(c.index(),c.index()+1,n)&&b.setNodeMarkup(b.mapping.map(j.before()),n)}a&&bE(c,g.extensionManager.splittableMarks),b.scrollIntoView()}return p},bG=(a,b={})=>({tr:c,state:g,dispatch:h,editor:i})=>{var j;let k=U(a,g.schema),{$from:l,$to:m}=g.selection,n=g.selection.node;if(n&&n.isBlock||l.depth<2||!l.sameParent(m))return!1;let o=l.node(-1);if(o.type!==k)return!1;let p=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==k||l.index(-2)!==l.node(-2).childCount-1)return!1;if(h){let a=e.FK.empty,d=l.index(-1)?1:l.index(-2)?2:3;for(let b=l.depth-d;b>=l.depth-3;b-=1)a=e.FK.from(l.node(b).copy(a));let g=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,h={...bl(p,l.node().type.name,l.node().attrs),...b},i=(null==(j=k.contentMatch.defaultType)?void 0:j.createAndFill(h))||void 0;a=a.append(e.FK.from(k.createAndFill(null,i)||void 0));let m=l.before(l.depth-(d-1));c.replace(m,l.after(-g),new e.Ji(a,4-d,0));let n=-1;c.doc.nodesBetween(m,c.doc.content.size,(a,b)=>{if(n>-1)return!1;a.isTextblock&&0===a.content.size&&(n=b+1)}),n>-1&&c.setSelection(f.U3.near(c.doc.resolve(n))),c.scrollIntoView()}return!0}let q=m.pos===l.end()?o.contentMatchAt(0).defaultType:null,r={...bl(p,o.type.name,o.attrs),...b},s={...bl(p,l.node().type.name,l.node().attrs),...b};c.delete(l.pos,m.pos);let t=q?[{type:k,attrs:r},{type:q,attrs:s}]:[{type:k,attrs:r}];if(!(0,d.zy)(c.doc,l.pos,2))return!1;if(h){let{selection:a,storedMarks:b}=g,{splittableMarks:d}=i.extensionManager,e=b||a.$to.parentOffset&&a.$from.marks();if(c.split(l.pos,2,t).scrollIntoView(),!e||!h)return!0;let f=e.filter(a=>d.includes(a.type.name));c.ensureMarks(f)}return!0},bH=(a,b)=>{let c=aY(a=>a.type===b)(a.selection);if(!c)return!0;let e=a.doc.resolve(Math.max(0,c.pos-1)).before(c.depth);if(void 0===e)return!0;let f=a.doc.nodeAt(e);return!(c.node.type===(null==f?void 0:f.type)&&(0,d.n9)(a.doc,c.pos))||(a.join(c.pos),!0)},bI=(a,b)=>{let c=aY(a=>a.type===b)(a.selection);if(!c)return!0;let e=a.doc.resolve(c.start).after(c.depth);if(void 0===e)return!0;let f=a.doc.nodeAt(e);return!(c.node.type===(null==f?void 0:f.type)&&(0,d.n9)(a.doc,e))||(a.join(e),!0)},bJ=(a,b,c,d={})=>({editor:e,tr:f,state:g,dispatch:h,chain:i,commands:j,can:k})=>{let{extensions:l,splittableMarks:m}=e.extensionManager,n=U(a,g.schema),o=U(b,g.schema),{selection:p,storedMarks:q}=g,{$from:r,$to:s}=p,t=r.blockRange(s),u=q||p.$to.parentOffset&&p.$from.marks();if(!t)return!1;let v=aY(a=>bq(a.type.name,l))(p);if(t.depth>=1&&v&&t.depth-v.depth<=1){if(v.node.type===n)return j.liftListItem(o);if(bq(v.node.type.name,l)&&n.validContent(v.node.content)&&h)return i().command(()=>(f.setNodeMarkup(v.pos,n),!0)).command(()=>bH(f,n)).command(()=>bI(f,n)).run()}return c&&u&&h?i().command(()=>{let a=k().wrapInList(n,d),b=u.filter(a=>m.includes(a.type.name));return f.ensureMarks(b),!!a||j.clearNodes()}).wrapInList(n,d).command(()=>bH(f,n)).command(()=>bI(f,n)).run():i().command(()=>!!k().wrapInList(n,d)||j.clearNodes()).wrapInList(n,d).command(()=>bH(f,n)).command(()=>bI(f,n)).run()},bK=(a,b={},c={})=>({state:d,commands:e})=>{let{extendEmptyMarkRange:f=!1}=c,g=ae(a,d.schema);return bm(d,g,b)?e.unsetMark(g,{extendEmptyMarkRange:f}):e.setMark(g,b)},bL=(a,b,c={})=>({state:d,commands:e})=>{let f,g=U(a,d.schema),h=U(b,d.schema),i=aD(d,g,c);return(d.selection.$anchor.sameParent(d.selection.$head)&&(f=d.selection.$anchor.parent.attrs),i)?e.setNode(h,f):e.setNode(g,{...f,...c})},bM=(a,b={})=>({state:c,commands:d})=>{let e=U(a,c.schema);return aD(c,e,b)?d.lift(e):d.wrapIn(e,b)},bN=()=>({state:a,dispatch:b})=>{let c=a.plugins;for(let d=0;d<c.length;d+=1){let e,f=c[d];if(f.spec.isInputRules&&(e=f.getState(a))){if(b){let b=a.tr,c=e.transform;for(let a=c.steps.length-1;a>=0;a-=1)b.step(c.steps[a].invert(c.docs[a]));if(e.text){let c=b.doc.resolve(e.from).marks();b.replaceWith(e.from,e.to,a.schema.text(e.text,c))}else b.delete(e.from,e.to)}return!0}}return!1},bO=()=>({tr:a,dispatch:b})=>{let{selection:c}=a,{empty:d,ranges:e}=c;return!!d||(b&&e.forEach(b=>{a.removeMark(b.$from.pos,b.$to.pos)}),!0)},bP=(a,b={})=>({tr:c,state:d,dispatch:e})=>{var f;let{extendEmptyMarkRange:g=!1}=b,{selection:h}=c,i=ae(a,d.schema),{$from:j,empty:k,ranges:l}=h;if(!e)return!0;if(k&&g){let{from:a,to:b}=h,d=null==(f=j.marks().find(a=>a.type===i))?void 0:f.attrs,e=ad(j,i,d);e&&(a=e.from,b=e.to),c.removeMark(a,b,i)}else l.forEach(a=>{c.removeMark(a.$from.pos,a.$to.pos,i)});return c.removeStoredMark(i),!0},bQ=a=>({tr:b,state:c,dispatch:d})=>{let e,f,{selection:g}=c;return"number"==typeof a?(e=a,f=a):a&&"from"in a&&"to"in a?(e=a.from,f=a.to):(e=g.from,f=g.to),d&&b.doc.nodesBetween(e,f,(a,c)=>{if(a.isText)return;let d={...a.attrs};delete d.dir,b.setNodeMarkup(c,void 0,d)}),!0},bR=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let f=null,g=null,h=aI("string"==typeof a?a:a.name,d.schema);if(!h)return!1;"node"===h&&(f=U(a,d.schema)),"mark"===h&&(g=ae(a,d.schema));let i=!1;return c.selection.ranges.forEach(a=>{let h,j,k,l,m=a.$from.pos,n=a.$to.pos;c.selection.empty?d.doc.nodesBetween(m,n,(a,b)=>{f&&f===a.type&&(i=!0,k=Math.max(b,m),l=Math.min(b+a.nodeSize,n),h=b,j=a)}):d.doc.nodesBetween(m,n,(a,d)=>{d<m&&f&&f===a.type&&(i=!0,k=Math.max(d,m),l=Math.min(d+a.nodeSize,n),h=d,j=a),d>=m&&d<=n&&(f&&f===a.type&&(i=!0,e&&c.setNodeMarkup(d,void 0,{...a.attrs,...b})),g&&a.marks.length&&a.marks.forEach(f=>{if(g===f.type&&(i=!0,e)){let e=Math.max(d,m),h=Math.min(d+a.nodeSize,n);c.addMark(e,h,g.create({...f.attrs,...b}))}}))}),j&&(void 0!==h&&e&&c.setNodeMarkup(h,void 0,{...j.attrs,...b}),g&&j.marks.length&&j.marks.forEach(a=>{g===a.type&&e&&c.addMark(k,l,g.create({...a.attrs,...b}))}))}),i},bS=(a,b={})=>({state:c,dispatch:e})=>(function(a,b=null){return function(c,e){let{$from:f,$to:g}=c.selection,h=f.blockRange(g),i=h&&(0,d.oM)(h,a,b);return!!i&&(e&&e(c.tr.wrap(h,i).scrollIntoView()),!0)}})(U(a,c.schema),b)(c,e),bT=(a,b={})=>({state:c,dispatch:f})=>(function(a,b=null){return function(c,f){let{$from:g,$to:h}=c.selection,i=g.blockRange(h);if(!i)return!1;let j=f?c.tr:null;return!!function(a,b,c,f=null){let g=!1,h=b,i=b.$from.doc;if(b.depth>=2&&b.$from.node(b.depth-1).type.compatibleContent(c)&&0==b.startIndex){if(0==b.$from.index(b.depth-1))return!1;let a=i.resolve(b.start-2);h=new e.u$(a,a,b.depth),b.endIndex<b.parent.childCount&&(b=new e.u$(b.$from,i.resolve(b.$to.end(b.depth)),b.depth)),g=!0}let j=(0,d.oM)(h,c,f,b);return!!j&&(a&&function(a,b,c,f,g){let h=e.FK.empty;for(let a=c.length-1;a>=0;a--)h=e.FK.from(c[a].type.create(c[a].attrs,h));a.step(new d.Wg(b.start-2*!!f,b.end,b.start,b.end,new e.Ji(h,0,0),c.length,!0));let i=0;for(let a=0;a<c.length;a++)c[a].type==g&&(i=a+1);let j=c.length-i,k=b.start+c.length-2*!!f,l=b.parent;for(let c=b.startIndex,e=b.endIndex,f=!0;c<e;c++,f=!1)!f&&(0,d.zy)(a.doc,k,j)&&(a.split(k,j),k+=2*j),k+=l.child(c).nodeSize}(a,b,j,g,c),!0)}(j,i,a,b)&&(f&&f(j.scrollIntoView()),!0)}})(U(a,c.schema),b)(c,f),bU=class{constructor(){this.callbacks={}}on(a,b){return this.callbacks[a]||(this.callbacks[a]=[]),this.callbacks[a].push(b),this}emit(a,...b){let c=this.callbacks[a];return c&&c.forEach(a=>a.apply(this,b)),this}off(a,b){let c=this.callbacks[a];return c&&(b?this.callbacks[a]=c.filter(a=>a!==b):delete this.callbacks[a]),this}once(a,b){let c=(...d)=>{this.off(a,c),b.apply(this,d)};return this.on(a,c)}removeAllListeners(){this.callbacks={}}},bV=class{constructor(a){var b;this.find=a.find,this.handler=a.handler,this.undoable=null==(b=a.undoable)||b}};function bW(a){var b;let{editor:c,from:d,to:e,text:f,rules:g,plugin:h}=a,{view:i}=c;if(i.composing)return!1;let j=i.state.doc.resolve(d);if(j.parent.type.spec.code||(null==(b=j.nodeBefore||j.nodeAfter)?void 0:b.marks.find(a=>a.type.spec.code)))return!1;let k=!1,l=((a,b=500)=>{let c="",d=a.parentOffset;return a.parent.nodesBetween(Math.max(0,d-b),d,(a,b,e,f)=>{var g,h;let i=(null==(h=(g=a.type.spec).toText)?void 0:h.call(g,{node:a,pos:b,parent:e,index:f}))||a.textContent||"%leaf%";c+=a.isAtom&&!a.isText?i:i.slice(0,Math.max(0,d-b))}),c})(j)+f;return g.forEach(a=>{if(k)return;let b=((a,b)=>{if(_(b))return b.exec(a);let c=b(a);if(!c)return null;let d=[c.text];return d.index=c.index,d.input=a,d.data=c.data,c.replaceWith&&(c.text.includes(c.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),d.push(c.replaceWith)),d})(l,a.find);if(!b)return;let g=i.state.tr,j=K({state:i.state,transaction:g}),m={from:d-(b[0].length-f.length),to:e},{commands:n,chain:o,can:p}=new L({editor:c,state:j});null!==a.handler({state:j,range:m,match:b,commands:n,chain:o,can:p})&&g.steps.length&&(a.undoable&&g.setMeta(h,{transform:g,from:d,to:e,text:f}),i.dispatch(g),k=!0)}),k}function bX(a){return"Object"===Object.prototype.toString.call(a).slice(8,-1)&&a.constructor===Object&&Object.getPrototypeOf(a)===Object.prototype}var bY=class{constructor(a={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...a},this.name=this.config.name}get options(){return{...a1(aZ(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...a1(aZ(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(a={}){let b=this.extend({...this.config,addOptions:()=>(function a(b,c){let d={...b};return bX(b)&&bX(c)&&Object.keys(c).forEach(e=>{bX(c[e])&&bX(b[e])?d[e]=a(b[e],c[e]):d[e]=c[e]}),d})(this.options,a)});return b.name=this.name,b.parent=this.parent,b}extend(a={}){let b=new this.constructor({...this.config,...a});return b.parent=this,this.child=b,b.name="name"in a?a.name:b.parent.name,b}},bZ=class a extends bY{constructor(){super(...arguments),this.type="mark"}static create(b={}){return new a("function"==typeof b?b():b)}static handleExit({editor:a,mark:b}){let{tr:c}=a.state,d=a.state.selection.$from;if(d.pos===d.end()){let e=d.marks();if(!e.find(a=>(null==a?void 0:a.type.name)===b.name))return!1;let f=e.find(a=>(null==a?void 0:a.type.name)===b.name);return f&&c.removeStoredMark(f),c.insertText(" ",d.pos),a.view.dispatch(c),!0}return!1}configure(a){return super.configure(a)}extend(a){let b="function"==typeof a?a():a;return super.extend(b)}},b$=class{constructor(a){this.find=a.find,this.handler=a.handler}},b_=null,b0=class{constructor(a,b){this.splittableMarks=[],this.editor=b,this.baseExtensions=a,this.extensions=bb(a),this.schema=a9(this.extensions,b),this.setupExtensions()}get commands(){return this.extensions.reduce((a,b)=>{let c={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:this.editor,type:bk(b.name,this.schema)},d=aZ(b,"addCommands",c);return d?{...a,...d()}:a},{})}get plugins(){let{editor:a}=this;return ba([...this.extensions].reverse()).flatMap(b=>{let c={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:bk(b.name,this.schema)},d=[],g=aZ(b,"addKeyboardShortcuts",c),h={};if("mark"===b.type&&aZ(b,"exitable",c)&&(h.ArrowRight=()=>bZ.handleExit({editor:a,mark:b})),g){let b=Object.fromEntries(Object.entries(g()).map(([b,c])=>[b,()=>c({editor:a})]));h={...h,...b}}let i=(0,H.w)(h);d.push(i);let j=aZ(b,"addInputRules",c);if(bp(b,a.options.enableInputRules)&&j){let b=j();if(b&&b.length){let c=function(a){let{editor:b,rules:c}=a,d=new f.k_({state:{init:()=>null,apply(a,f,g){let h=a.getMeta(d);if(h)return h;let i=a.getMeta("applyInputRules");return i&&setTimeout(()=>{let{text:a}=i;"string"==typeof a||(a=a_(e.FK.from(a),g.schema));let{from:f}=i,h=f+a.length;bW({editor:b,from:f,to:h,text:a,rules:c,plugin:d})}),a.selectionSet||a.docChanged?null:f}},props:{handleTextInput:(a,e,f,g)=>bW({editor:b,from:e,to:f,text:g,rules:c,plugin:d}),handleDOMEvents:{compositionend:a=>(setTimeout(()=>{let{$cursor:e}=a.state.selection;e&&bW({editor:b,from:e.pos,to:e.pos,text:"",rules:c,plugin:d})}),!1)},handleKeyDown(a,e){if("Enter"!==e.key)return!1;let{$cursor:f}=a.state.selection;return!!f&&bW({editor:b,from:f.pos,to:f.pos,text:"\n",rules:c,plugin:d})}},isInputRules:!0});return d}({editor:a,rules:b}),g=Array.isArray(c)?c:[c];d.push(...g)}}let k=aZ(b,"addPasteRules",c);if(bp(b,a.options.enablePasteRules)&&k){let b=k();if(b&&b.length){let c=function(a){let b,{editor:c,rules:d}=a,g=null,h=!1,i=!1,j="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{b="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{b=null}let k=({state:a,from:d,to:e,rule:f,pasteEvt:g})=>{let h=a.tr;if(function(a){let{editor:b,state:c,from:d,to:e,rule:f,pasteEvent:g,dropEvent:h}=a,{commands:i,chain:j,can:k}=new L({editor:b,state:c}),l=[];return c.doc.nodesBetween(d,e,(a,b)=>{var m,n,o,p,q;if((null==(n=null==(m=a.type)?void 0:m.spec)?void 0:n.code)||!(a.isText||a.isTextblock||a.isInline))return;let r=null!=(q=null!=(p=null==(o=a.content)?void 0:o.size)?p:a.nodeSize)?q:0,s=Math.max(d,b),t=Math.min(e,b+r);s>=t||((a,b,c)=>{if(_(b))return[...a.matchAll(b)];let d=b(a,c);return d?d.map(b=>{let c=[b.text];return c.index=b.index,c.input=a,c.data=b.data,b.replaceWith&&(b.text.includes(b.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),c.push(b.replaceWith)),c}):[]})(a.isText?a.text||"":a.textBetween(s-b,t-b,void 0,""),f.find,g).forEach(a=>{if(void 0===a.index)return;let b=s+a.index+1,d=b+a[0].length,e={from:c.tr.mapping.map(b),to:c.tr.mapping.map(d)},m=f.handler({state:c,range:e,match:a,commands:i,chain:j,can:k,pasteEvent:g,dropEvent:h});l.push(m)})}),l.every(a=>null!==a)}({editor:c,state:K({state:a,transaction:h}),from:Math.max(d-1,0),to:e.b-1,rule:f,pasteEvent:g,dropEvent:b})&&h.steps.length){try{b="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{b=null}return j="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,h}};return d.map(a=>new f.k_({view(a){let b=b=>{var d;(g=(null==(d=a.dom.parentElement)?void 0:d.contains(b.target))?a.dom.parentElement:null)&&(b_=c)},d=()=>{b_&&(b_=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",d),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",d)}}},props:{handleDOMEvents:{drop:(a,c)=>{if(i=g===a.dom.parentElement,b=c,!i){let a=b_;(null==a?void 0:a.isEditable)&&setTimeout(()=>{let b=a.state.selection;b&&a.commands.deleteRange({from:b.from,to:b.to})},10)}return!1},paste:(a,b)=>{var c;let d=null==(c=b.clipboardData)?void 0:c.getData("text/html");return j=b,h=!!(null==d?void 0:d.includes("data-pm-slice")),!1}}},appendTransaction:(b,c,d)=>{let f=b[0],g="paste"===f.getMeta("uiEvent")&&!h,l="drop"===f.getMeta("uiEvent")&&!i,m=f.getMeta("applyPasteRules"),n=!!m;if(!g&&!l&&!n)return;if(n){let{text:b}=m;"string"==typeof b||(b=a_(e.FK.from(b),d.schema));let{from:c}=m,f=c+b.length;return k({rule:a,state:d,from:c,to:{b:f},pasteEvt:(a=>{var b;let c=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(b=c.clipboardData)||b.setData("text/html",a),c})(b)})}let o=c.doc.content.findDiffStart(d.doc.content),p=c.doc.content.findDiffEnd(d.doc.content);if("number"==typeof o&&p&&o!==p.b)return k({rule:a,state:d,from:o,to:p,pasteEvt:j})}}))}({editor:a,rules:b});d.push(...c)}}let l=aZ(b,"addProseMirrorPlugins",c);if(l){let a=l();d.push(...a)}return d})}get attributes(){return a3(this.extensions)}get nodeViews(){let{editor:a}=this,{nodeExtensions:b}=a2(this.extensions);return Object.fromEntries(b.filter(a=>!!aZ(a,"addNodeView")).map(b=>{let c=this.attributes.filter(a=>a.type===b.name),d={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:U(b.name,this.schema)},e=aZ(b,"addNodeView",d);if(!e)return[];let f=e();return f?[b.name,(d,e,g,h,i)=>{let j=a5(d,c);return f({node:d,view:e,getPos:g,decorations:h,innerDecorations:i,editor:a,extension:b,HTMLAttributes:j})}]:[]}))}dispatchTransaction(a){let{editor:b}=this;return ba([...this.extensions].reverse()).reduceRight((a,c)=>{let d={name:c.name,options:c.options,storage:this.editor.extensionStorage[c.name],editor:b,type:bk(c.name,this.schema)},e=aZ(c,"dispatchTransaction",d);return e?b=>{e.call(d,{transaction:b,next:a})}:a},a)}get markViews(){let{editor:a}=this,{markExtensions:b}=a2(this.extensions);return Object.fromEntries(b.filter(a=>!!aZ(a,"addMarkView")).map(b=>{let c=this.attributes.filter(a=>a.type===b.name),d={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:ae(b.name,this.schema)},e=aZ(b,"addMarkView",d);return e?[b.name,(d,f,g)=>{let h=a5(d,c);return e()({mark:d,view:f,inline:g,editor:a,extension:b,HTMLAttributes:h,updateAttributes:b=>{cw(d,a,b)}})}]:[]}))}setupExtensions(){let a=this.extensions;this.editor.extensionStorage=Object.fromEntries(a.map(a=>[a.name,a.storage])),a.forEach(a=>{var b;let c={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:this.editor,type:bk(a.name,this.schema)};"mark"===a.type&&(null==(b=a1(aZ(a,"keepOnSplit",c)))||b)&&this.splittableMarks.push(a.name);let d=aZ(a,"onBeforeCreate",c),e=aZ(a,"onCreate",c),f=aZ(a,"onUpdate",c),g=aZ(a,"onSelectionUpdate",c),h=aZ(a,"onTransaction",c),i=aZ(a,"onFocus",c),j=aZ(a,"onBlur",c),k=aZ(a,"onDestroy",c);d&&this.editor.on("beforeCreate",d),e&&this.editor.on("create",e),f&&this.editor.on("update",f),g&&this.editor.on("selectionUpdate",g),h&&this.editor.on("transaction",h),i&&this.editor.on("focus",i),j&&this.editor.on("blur",j),k&&this.editor.on("destroy",k)})}};b0.resolve=bb,b0.sort=ba,b0.flatten=a$,J({},{ClipboardTextSerializer:()=>b2,Commands:()=>b3,Delete:()=>b4,Drop:()=>b5,Editable:()=>b6,FocusEvents:()=>b8,Keymap:()=>b9,Paste:()=>ca,Tabindex:()=>cb,TextDirection:()=>cc,focusEventsPluginKey:()=>b7});var b1=class a extends bY{constructor(){super(...arguments),this.type="extension"}static create(b={}){return new a("function"==typeof b?b():b)}configure(a){return super.configure(a)}extend(a){let b="function"==typeof a?a():a;return super.extend(b)}},b2=b1.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new f.k_({key:new f.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:a}=this,{state:b,schema:c}=a,{doc:d,selection:e}=b,{ranges:f}=e,g=Math.min(...f.map(a=>a.$from.pos)),h=Math.max(...f.map(a=>a.$to.pos)),i=bf(c);return bd(d,{from:g,to:h},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:i})}}})]}}),b3=b1.create({name:"commands",addCommands:()=>({...M})}),b4=b1.create({name:"delete",onUpdate({transaction:a,appendedTransactions:b}){var c,e,f;let g=()=>{var c,e,f,g;if(null!=(g=null==(f=null==(e=null==(c=this.editor.options.coreExtensionOptions)?void 0:c.delete)?void 0:e.filterTransaction)?void 0:f.call(e,a))?g:a.getMeta("y-sync$"))return;let h=aV(a.before,[a,...b]);bh(h).forEach(b=>{h.mapping.mapResult(b.oldRange.from).deletedAfter&&h.mapping.mapResult(b.oldRange.to).deletedBefore&&h.before.nodesBetween(b.oldRange.from,b.oldRange.to,(c,d)=>{let e=d+c.nodeSize-2,f=b.oldRange.from<=d&&e<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:c,from:d,to:e,newFrom:h.mapping.map(d),newTo:h.mapping.map(e),deletedRange:b.oldRange,newRange:b.newRange,partial:!f,editor:this.editor,transaction:a,combinedTransform:h})})});let i=h.mapping;h.steps.forEach((b,c)=>{var e,f;if(b instanceof d.Ys){let d=i.slice(c).map(b.from,-1),g=i.slice(c).map(b.to),j=i.invert().map(d,-1),k=i.invert().map(g),l=null==(e=h.doc.nodeAt(d-1))?void 0:e.marks.some(a=>a.eq(b.mark)),m=null==(f=h.doc.nodeAt(g))?void 0:f.marks.some(a=>a.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:j,to:k},newRange:{from:d,to:g},partial:!!(m||l),editor:this.editor,transaction:a,combinedTransform:h})}})};null==(f=null==(e=null==(c=this.editor.options.coreExtensionOptions)?void 0:c.delete)?void 0:e.async)||f?setTimeout(g,0):g()}}),b5=b1.create({name:"drop",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tiptapDrop"),props:{handleDrop:(a,b,c,d)=>{this.editor.emit("drop",{editor:this.editor,event:b,slice:c,moved:d})}}})]}}),b6=b1.create({name:"editable",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),b7=new f.hs("focusEvents"),b8=b1.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:a}=this;return[new f.k_({key:b7,props:{handleDOMEvents:{focus:(b,c)=>{a.isFocused=!0;let d=a.state.tr.setMeta("focus",{event:c}).setMeta("addToHistory",!1);return b.dispatch(d),!1},blur:(b,c)=>{a.isFocused=!1;let d=a.state.tr.setMeta("blur",{event:c}).setMeta("addToHistory",!1);return b.dispatch(d),!1}}}})]}}),b9=b1.create({name:"keymap",addKeyboardShortcuts(){let a=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:b})=>{let{selection:c,doc:d}=b,{empty:e,$anchor:g}=c,{pos:h,parent:i}=g,j=g.parent.isTextblock&&h>0?b.doc.resolve(h-1):g,k=j.parent.type.spec.isolating,l=g.pos-g.parentOffset,m=k&&1===j.parent.childCount?l===g.pos:f.LN.atStart(d).from===h;return!!e&&!!i.type.isTextblock&&!i.textContent.length&&!!m&&(!m||"paragraph"!==g.parent.type.name)&&a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),b=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),c={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:a,"Mod-Backspace":a,"Shift-Backspace":a,Delete:b,"Mod-Delete":b,"Mod-a":()=>this.editor.commands.selectAll()},d={...c},e={...c,"Ctrl-h":a,"Alt-Backspace":a,"Ctrl-d":b,"Ctrl-Alt-Backspace":b,"Alt-Delete":b,"Alt-d":b,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return al()||aB()?e:d},addProseMirrorPlugins(){return[new f.k_({key:new f.hs("clearDocument"),appendTransaction:(a,b,c)=>{if(a.some(a=>a.getMeta("composition")))return;let d=a.some(a=>a.docChanged)&&!b.doc.eq(c.doc),e=a.some(a=>a.getMeta("preventClearDocument"));if(!d||e)return;let{empty:g,from:h,to:i}=b.selection,j=f.LN.atStart(b.doc).from,k=f.LN.atEnd(b.doc).to;if(g||h!==j||i!==k||!br(c.doc))return;let l=c.tr,m=K({state:c,transaction:l}),{commands:n}=new L({editor:this.editor,state:m});if(n.clearNodes(),l.steps.length)return l}})]}}),ca=b1.create({name:"paste",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tiptapPaste"),props:{handlePaste:(a,b,c)=>{this.editor.emit("paste",{editor:this.editor,event:b,slice:c})}}})]}}),cb=b1.create({name:"tabindex",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),cc=b1.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:a}=a2(this.extensions);return[{types:a.filter(a=>"text"!==a.name).map(a=>a.name),attributes:{dir:{default:this.options.direction,parseHTML:a=>{let b=a.getAttribute("dir");return b&&("ltr"===b||"rtl"===b||"auto"===b)?b:this.options.direction},renderHTML:a=>a.dir?{dir:a.dir}:{}}}}]},addProseMirrorPlugins(){return[new f.k_({key:new f.hs("textDirection"),props:{attributes:()=>{let a=this.options.direction;return a?{dir:a}:{}}}})]}}),cd=class a{constructor(a,b,c=!1,d=null){this.currentNode=null,this.actualDepth=null,this.isBlock=c,this.resolvedPos=a,this.editor=b,this.currentNode=d}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var a;return null!=(a=this.actualDepth)?a:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(a){let b=this.from,c=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);b=this.from+1,c=this.to-1}this.editor.commands.insertContentAt({from:b,to:c},a)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let b=this.resolvedPos.start(this.resolvedPos.depth-1);return new a(this.resolvedPos.doc.resolve(b),this.editor)}get before(){let b=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return b.depth!==this.depth&&(b=this.resolvedPos.doc.resolve(this.from-3)),new a(b,this.editor)}get after(){let b=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return b.depth!==this.depth&&(b=this.resolvedPos.doc.resolve(this.to+3)),new a(b,this.editor)}get children(){let b=[];return this.node.content.forEach((c,d)=>{let e=c.isBlock&&!c.isTextblock,f=c.isAtom&&!c.isText,g=c.isInline,h=this.pos+d+ +!f;if(h<0||h>this.resolvedPos.doc.nodeSize-2)return;let i=this.resolvedPos.doc.resolve(h);if(!e&&!g&&i.depth<=this.depth)return;let j=new a(i,this.editor,e,e||g?c:null);e&&(j.actualDepth=this.depth+1),b.push(j)}),b}get firstChild(){return this.children[0]||null}get lastChild(){let a=this.children;return a[a.length-1]||null}closest(a,b={}){let c=null,d=this.parent;for(;d&&!c;){if(d.node.type.name===a)if(Object.keys(b).length>0){let a=d.node.attrs,c=Object.keys(b);for(let d=0;d<c.length;d+=1){let e=c[d];if(a[e]!==b[e])break}}else c=d;d=d.parent}return c}querySelector(a,b={}){return this.querySelectorAll(a,b,!0)[0]||null}querySelectorAll(a,b={},c=!1){let d=[];if(!this.children||0===this.children.length)return d;let e=Object.keys(b);return this.children.forEach(f=>{(!c||!(d.length>0))&&(f.node.type.name===a&&e.every(a=>b[a]===f.node.attrs[a])&&d.push(f),c&&d.length>0||(d=d.concat(f.querySelectorAll(a,b,c))))}),d}setAttribute(a){let{tr:b}=this.editor.state;b.setNodeMarkup(this.from,void 0,{...this.node.attrs,...a}),this.editor.view.dispatch(b)}},ce=`.ProseMirror {
|
|
264
|
+
`),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,d.jsx)(m,{isPresent:b,childRef:j,sizeRef:n,pop:h,children:!1===h?a:e.cloneElement(a,{ref:p})})}let o=({children:a,initial:b,isPresent:c,onExitComplete:f,custom:h,presenceAffectsLayout:j,mode:k,anchorX:l,anchorY:m,root:o})=>{let q=(0,g.M)(p),r=(0,e.useId)(),s=!0,t=(0,e.useMemo)(()=>(s=!1,{id:r,initial:b,isPresent:c,custom:h,onExitComplete:a=>{for(let b of(q.set(a,!0),q.values()))if(!b)return;f&&f()},register:a=>(q.set(a,!1),()=>q.delete(a))}),[c,q,f]);return j&&s&&(t={...t}),(0,e.useMemo)(()=>{q.forEach((a,b)=>q.set(b,!1))},[c]),e.useEffect(()=>{c||q.size||!f||f()},[c]),a=(0,d.jsx)(n,{pop:"popLayout"===k,isPresent:c,anchorX:l,anchorY:m,root:o,children:a}),(0,d.jsx)(i.t.Provider,{value:t,children:a})};function p(){return new Map}var q=c(15086);let r=a=>a.key||"";function s(a){let b=[];return e.Children.forEach(a,a=>{(0,e.isValidElement)(a)&&b.push(a)}),b}let t=({children:a,custom:b,initial:c=!0,onExitComplete:i,presenceAffectsLayout:j=!0,mode:k="sync",propagate:l=!1,anchorX:m="left",anchorY:n="top",root:p})=>{let[t,u]=(0,q.xQ)(l),v=(0,e.useMemo)(()=>s(a),[a]),w=l&&!t?[]:v.map(r),x=(0,e.useRef)(!0),y=(0,e.useRef)(v),z=(0,g.M)(()=>new Map),A=(0,e.useRef)(new Set),[B,C]=(0,e.useState)(v),[D,E]=(0,e.useState)(v);(0,h.E)(()=>{x.current=!1,y.current=v;for(let a=0;a<D.length;a++){let b=r(D[a]);w.includes(b)?(z.delete(b),A.current.delete(b)):!0!==z.get(b)&&z.set(b,!1)}},[D,w.length,w.join("-")]);let F=[];if(v!==B){let a=[...v];for(let b=0;b<D.length;b++){let c=D[b],d=r(c);w.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===k&&F.length&&(a=F),E(s(a)),C(v),null}let{forceRender:G}=(0,e.useContext)(f.L);return(0,d.jsx)(d.Fragment,{children:D.map(a=>{let e=r(a),f=(!l||!!t)&&(v===D||w.includes(e));return(0,d.jsx)(o,{isPresent:f,initial:(!x.current||!!c)&&void 0,custom:b,presenceAffectsLayout:j,mode:k,root:p,onExitComplete:f?void 0:()=>{if(A.current.has(e)||(A.current.add(e),!z.has(e)))return;z.set(e,!0);let a=!0;z.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(y.current),l&&u?.(),i&&i())},anchorX:m,anchorY:n,children:a},e)})})}},656159:(a,b)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b.isDeepKey=function(a){switch(typeof a){case"number":case"symbol":return!1;case"string":return a.includes(".")||a.includes("[")||a.includes("]")}}},658422:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(452171),e=c(266196),f=c(606461);b.cloneDeepWith=function(a,b){return d.cloneDeepWith(a,(c,g,h,i)=>{let j=b?.(c,g,h,i);if(void 0!==j)return j;if("object"==typeof a){if(e.getTag(a)===f.objectTag&&"function"!=typeof a.constructor){let b={};return i.set(a,b),d.copyProperties(b,a,h,i),b}switch(Object.prototype.toString.call(a)){case f.numberTag:case f.stringTag:case f.booleanTag:{let b=new a.constructor(a?.valueOf());return d.copyProperties(b,a),b}case f.argumentsTag:{let b={};return d.copyProperties(b,a),b.length=a.length,b[Symbol.iterator]=a[Symbol.iterator],b}default:return}}})}},658556:(a,b,c)=>{"use strict";function d(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}c.d(b,{A:()=>aI});var e=c(972421),f=c(145214),g=c(423721),h=c(348445);let i="phrasing",j=["autolink","link","image","label"];function k(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function l(a){this.config.enter.autolinkProtocol.call(this,a)}function m(a){this.config.exit.autolinkProtocol.call(this,a)}function n(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];(0,e.ok)("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function o(a){this.config.exit.autolinkEmail.call(this,a)}function p(a){this.exit(a)}function q(a){!function(a,b,c){let d=(0,h.C)((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)(0,g.VG)(a,"text",i);function i(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,r],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,s]],{ignore:["link","linkReference"]})}function r(a,b,c,e,f){let g="";if(!t(f)||(/^w/i.test(b)&&(c=b+c,b="",g="http://"),!function(a){let b=a.split(".");return!(b.length<2||b[b.length-1]&&(/_/.test(b[b.length-1])||!/[a-zA-Z\d]/.test(b[b.length-1]))||b[b.length-2]&&(/_/.test(b[b.length-2])||!/[a-zA-Z\d]/.test(b[b.length-2])))}(c)))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],e=c.indexOf(")"),f=d(a,"("),g=d(a,")");for(;-1!==e&&f>g;)a+=c.slice(0,e+1),e=(c=c.slice(e+1)).indexOf(")"),g++;return[a,c]}(c+e);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function s(a,b,c,d){return!(!t(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function t(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||(0,f.Ny)(c)||(0,f.es)(c))&&(!b||47!==c)}var u=c(732347);function v(){this.buffer()}function w(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function x(){this.buffer()}function y(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function z(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteReference"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function A(a){this.exit(a)}function B(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteDefinition"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function C(a){this.exit(a)}function D(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function E(a,b,c){return 0===b?a:F(a,b,c)}function F(a,b,c){return(c?"":" ")+a}D.peek=function(){return"["};let G=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function H(a){this.enter({type:"delete",children:[]},a)}function I(a){this.exit(a)}function J(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function K(a){return a.length}function L(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}J.peek=function(){return"~"};var M=c(294401);c(320608);c(210164);function N(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}N.peek=function(){return"`"};(0,h.C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let O={inlineCode:N,listItem:function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j}};function P(a){let b=a._align;(0,e.ok)(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Q(a){this.exit(a),this.data.inTable=void 0}function R(a){this.enter({type:"tableRow",children:[]},a)}function S(a){this.exit(a)}function T(a){this.enter({type:"tableCell",children:[]},a)}function U(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,V));let c=this.stack[this.stack.length-1];(0,e.ok)("inlineCode"===c.type),c.value=b,this.exit(a)}function V(a,b){return"|"===b?b:a}function W(a){let b=this.stack[this.stack.length-2];(0,e.ok)("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function X(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];(0,e.ok)("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function Y(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=O.listItem(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}var Z=c(161693);let _={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},aa={tokenize:function(a,b,c){let d,e,g;return h;function h(b){return 46===b||95===b?a.check(ac,j,i)(b):null===b||(0,f.Ee)(b)||(0,f.Ny)(b)||45!==b&&(0,f.es)(b)?j(b):(g=!0,a.consume(b),h)}function i(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),h}function j(a){return e||d||!g?c(a):b(a)}},partial:!0},ab={tokenize:function(a,b){let c=0,d=0;return e;function e(h){return 40===h?(c++,a.consume(h),e):41===h&&d<c?g(h):33===h||34===h||38===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||60===h||63===h||93===h||95===h||126===h?a.check(ac,b,g)(h):null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):(a.consume(h),e)}function g(b){return 41===b&&d++,a.consume(b),e}},partial:!0},ac={tokenize:function(a,b,c){return d;function d(h){return 33===h||34===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||63===h||95===h||126===h?(a.consume(h),d):38===h?(a.consume(h),g):93===h?(a.consume(h),e):60===h||null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):c(h)}function e(a){return null===a||40===a||91===a||(0,f.Ee)(a)||(0,f.Ny)(a)?b(a):d(a)}function g(b){return(0,f.CW)(b)?function b(e){return 59===e?(a.consume(e),d):(0,f.CW)(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},ad={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return(0,f.lV)(a)?c(a):b(a)}},partial:!0},ae={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!aj.call(d,d.previous)||an(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(_,a.attempt(aa,a.attempt(ab,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:aj},af={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",g=!1;return function(b){return(72===b||104===b)&&ak.call(d,d.previous)&&!an(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),h):c(b)};function h(b){if((0,f.CW)(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),h;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),i}return c(b)}function i(b){return 47===b?(a.consume(b),g)?j:(g=!0,i):c(b)}function j(b){return null===b||(0,f.JQ)(b)||(0,f.Ee)(b)||(0,f.Ny)(b)||(0,f.es)(b)?c(b):a.attempt(aa,a.attempt(ab,k),c)(b)}function k(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:ak},ag={name:"emailAutolink",tokenize:function(a,b,c){let d,e,g=this;return function(b){return!am(b)||!al.call(g,g.previous)||an(g.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return am(d)?(a.consume(d),b):64===d?(a.consume(d),h):c(d)}(b))};function h(b){return 46===b?a.check(ad,j,i)(b):45===b||95===b||(0,f.lV)(b)?(e=!0,a.consume(b),h):j(b)}function i(b){return a.consume(b),d=!0,h}function j(h){return e&&d&&(0,f.CW)(g.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(h)):c(h)}},previous:al},ah={},ai=48;for(;ai<123;)ah[ai]=ag,58==++ai?ai=65:91===ai&&(ai=97);function aj(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||(0,f.Ee)(a)}function ak(a){return!(0,f.CW)(a)}function al(a){return!(47===a||am(a))}function am(a){return 43===a||45===a||46===a||95===a||(0,f.lV)(a)}function an(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}ah[43]=ag,ah[45]=ag,ah[46]=ag,ah[95]=ag,ah[72]=[ag,af],ah[104]=[ag,af],ah[87]=[ag,ae],ah[119]=[ag,ae];var ao=c(360478),ap=c(621405);let aq={tokenize:function(a,b,c){let d=this;return(0,ap.N)(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ar(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=(0,u.B)(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function as(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function at(a,b,c){let d,e=this,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),i};function i(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",j)}function j(i){if(h>999||93===i&&!d||null===i||91===i||(0,f.Ee)(i))return c(i);if(93===i){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return g.includes((0,u.B)(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(i),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(i)}return(0,f.Ee)(i)||(d=!0),h++,a.consume(i),92===i?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}}function au(a,b,c){let d,e,g=this,h=g.parser.gfmFootnotes||(g.parser.gfmFootnotes=[]),i=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),j};function j(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",k):c(b)}function k(b){if(i>999||93===b&&!e||null===b||91===b||(0,f.Ee)(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=(0,u.B)(g.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),m}return(0,f.Ee)(b)||(e=!0),i++,a.consume(b),92===b?l:k}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}function m(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),h.includes(d)||h.push(d),(0,ap.N)(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function av(a,b,c){return a.check(ao.B,b,a.attempt(aq,b,c))}function aw(a){a.exit("gfmFootnoteDefinition")}var ax=c(962349),ay=c(598525);class az{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function aA(a,b,c){let d,e=this,g=0,h=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:i;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function i(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,h+=1),j(c)}function j(b){return null===b?c(b):(0,f.HP)(b)?h>1?(h=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),m):c(b):(0,f.On)(b)?(0,ap.N)(a,j,"whitespace")(b):(h+=1,d&&(d=!1,g+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,j):(a.enter("data"),k(b))}function k(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),j(b)):(a.consume(b),92===b?l:k)}function l(b){return 92===b||124===b?(a.consume(b),k):k(b)}function m(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,(0,f.On)(b))?(0,ap.N)(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return(0,f.On)(b)?(0,ap.N)(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(h+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(h+=1,q(b)):null===b||(0,f.HP)(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return(0,f.On)(b)?(0,ap.N)(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||(0,f.HP)(e))return d&&g===h?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||(0,f.HP)(c)?(a.exit("tableRow"),b(c)):(0,f.On)(c)?(0,ap.N)(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function aB(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,m=new az;for(;++f<a.length;){let n=a[f],o=n[1];"enter"===n[0]?"tableHead"===o.type?(k=!1,0!==l&&(aD(m,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",c,b]])):"tableRow"===o.type||"tableDelimiterRow"===o.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===o.type?2:d?3:1):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===o.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===o.type?(k=!0,l=f):"tableRow"===o.type||"tableDelimiterRow"===o.type?(l=f,0!==i[1]?(j[0]=j[1],e=aC(m,b,i,h,f,e)):0!==j[1]&&(e=aC(m,b,j,h,f,e)),h=0):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)&&(j[3]=f)}for(0!==l&&aD(m,b,l,c,d),m.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function aC(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},aE(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=aE(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=aE(b.events,c[2]),f=aE(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},aE(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function aD(a,b,c,d,e){let f=[],g=aE(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function aE(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}let aF={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return(0,f.Ee)(b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),g):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),g):c(b)}function g(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),h):c(b)}function h(d){return(0,f.HP)(d)?b(d):(0,f.On)(d)?a.check({tokenize:aG},b,c)(d):c(d)}}};function aG(a,b,c){return(0,ap.N)(a,function(a){return null===a?c(a):b(a)},"whitespace")}let aH={};function aI(a){let b,c=a||aH,d=this.data(),e=d.micromarkExtensions||(d.micromarkExtensions=[]),f=d.fromMarkdownExtensions||(d.fromMarkdownExtensions=[]),g=d.toMarkdownExtensions||(d.toMarkdownExtensions=[]);e.push((0,Z.y)([{text:ah},{document:{91:{name:"gfmFootnoteDefinition",tokenize:au,continuation:{tokenize:av},exit:aw}},text:{91:{name:"gfmFootnoteCall",tokenize:at},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ar,resolveTo:as}}},function(a){let b=(a||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=(0,M.S)(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=(0,M.S)(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&(0,ax.m)(g,g.length,0,(0,ay.W)(h,a.slice(d+1,c),b)),(0,ax.m)(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),(0,ax.m)(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}};return null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}}(c),{flow:{null:{name:"table",tokenize:aA,resolveAll:aB}}},{text:{91:aF}}])),f.push([{transforms:[q],enter:{literalAutolink:k,literalAutolinkEmail:l,literalAutolinkHttp:l,literalAutolinkWww:l},exit:{literalAutolink:p,literalAutolinkEmail:o,literalAutolinkHttp:m,literalAutolinkWww:n}},{enter:{gfmFootnoteCallString:v,gfmFootnoteCall:w,gfmFootnoteDefinitionLabelString:x,gfmFootnoteDefinition:y},exit:{gfmFootnoteCallString:z,gfmFootnoteCall:A,gfmFootnoteDefinitionLabelString:B,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:H},exit:{strikethrough:I}},{enter:{table:P,tableData:T,tableHeader:T,tableRow:R},exit:{codeText:U,table:Q,tableData:S,tableHeader:S,tableRow:S}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:X}}]),g.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:":",before:"[ps]",after:"\\/",inConstruct:i,notInConstruct:j}]},(b=!1,c&&c.firstLineBlank&&(b=!0),{handlers:{footnoteDefinition:function(a,c,d,e){let f=d.createTracker(e),g=f.move("[^"),h=d.enter("footnoteDefinition"),i=d.enter("label");return g+=f.move(d.safe(d.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((b?"\n":" ")+d.indentLines(d.containerFlow(a,f.current()),b?F:E))),h(),g},footnoteReference:D},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G}],handlers:{delete:J}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=O.inlineCode(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||K,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let m=-1;if("object"==typeof d&&"length"in d)for(;++m<j;)f[m]=L(d[m]);else{let a=L(d);for(;++m<j;)f[m]=a}m=-1;let n=[],o=[];for(;++m<j;){let a=f[m],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[m]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[m]&&(i[m]=e),o[m]=e),n[m]=g}g.splice(1,0,n),h.splice(1,0,o),k=-1;let p=[];for(;++k<g.length;){let a=g[k],b=h[k];m=-1;let d=[];for(;++m<j;){let e=a[m]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[m]-(b[m]||0),c=f[m];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||m||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||m)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||m!==j-1)&&d.push("|")}p.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return p.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(c),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y}}]})}},663033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},665466:(a,b,c)=>{"use strict";c.d(b,{E:()=>i,I:()=>j});var d=c(736927),e=c(115962),f=c(437503),g=c(930439),h=c(535798);function i({event:a,expanded:b,onToggle:c,onOpenPerson:e,onOpenCompany:g}){let i=a.start_at?new Date(a.start_at):null,k=a.end_at?new Date(a.end_at):null,l=i?k?`${o(i)} – ${o(k)}`:o(i):"",m=(a.attendees??[]).slice(0,5),p=(a.attendees?.length??0)-m.length;return(0,d.jsxs)("li",{className:"overflow-hidden",style:{background:b?"var(--color-surface-hover)":"transparent",transition:"background 120ms ease"},children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,"aria-expanded":b,onClick:c,onKeyDown:a=>{a.target===a.currentTarget&&("Enter"===a.key||" "===a.key)&&(a.preventDefault(),c())},className:"group/event w-full flex items-center gap-3 px-3 py-2 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] transition-colors",onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("div",{className:"text-[12px] tabular-nums shrink-0 whitespace-nowrap",style:{color:"var(--color-text-muted)",width:"11rem"},children:l||(a.start_at?(0,h.wI)(a.start_at):"")}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[13.5px]",style:{color:"var(--color-text)",fontWeight:500},children:a.title?.trim()||"(no title)"}),a.meeting_type&&(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0 text-[10px] uppercase tracking-[0.06em]",style:{background:"var(--color-surface-hover)",color:"var(--color-text-muted)",fontWeight:600},children:a.meeting_type})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[m.length>0&&(0,d.jsxs)("div",{className:"flex items-center -space-x-1.5",children:[m.slice(0,4).map(a=>(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),e?.(a.id)},disabled:!e,title:a.name??a.email??void 0,className:"disabled:cursor-default rounded-full",style:{boxShadow:"0 0 0 2px var(--color-background)"},children:(0,d.jsx)(f.X,{src:a.avatar_url,name:a.name,seed:a.email??a.id,size:"sm"})},a.id)),p>0&&(0,d.jsxs)("span",{className:"ml-1 text-[11px] tabular-nums",style:{color:"var(--color-text-muted)"},children:["+",p]})]}),(0,d.jsx)(n,{expanded:b})]})]}),(0,d.jsx)("div",{className:"grid transition-[grid-template-rows] duration-[220ms] ease-out motion-reduce:transition-none",style:{gridTemplateRows:b?"1fr":"0fr"},children:(0,d.jsx)("div",{className:"overflow-hidden",children:b&&(0,d.jsx)(j,{eventId:a.id,fallbackEvent:a,onOpenPerson:e,onOpenCompany:g})})})]})}function j({eventId:a,fallbackEvent:b,onOpenPerson:c,onOpenCompany:f}){var g;let[h,i]=(0,e.useState)(null),[j,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(null),r=h?.event.start_at??b.start_at?new Date(h?.event.start_at??b.start_at):null,s=h?.event.end_at??b.end_at?new Date(h?.event.end_at??b.end_at):null,t=r?(g=r,new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(g)):null,u=r?s?`${o(r)} – ${o(s)}`:o(r):null,v=r&&s?function(a,b){let c=b.getTime()-a.getTime();if(c<=0)return"";let d=Math.round(c/6e4);if(d>=1440){let a=Math.round(d/1440);return`${a} day${1===a?"":"s"}`}let e=Math.floor(d/60),f=d%60;return 0===e?`${f} min`:0===f?`${e}h`:`${e}h ${f}m`}(r,s):null,w=h?.organizer??null,x=h?.attendees??b.attendees??[],y=h?.companies??[];return(0,d.jsxs)("div",{className:"border-t px-4 py-4",style:{borderColor:"var(--color-border)",background:"var(--color-background)"},children:[(t||u||v)&&(0,d.jsx)(k,{label:"When",children:(0,d.jsxs)("div",{className:"text-[13px]",style:{color:"var(--color-text)"},children:[t&&(0,d.jsx)("div",{className:"font-medium",children:t}),(u||v)&&(0,d.jsxs)("div",{className:"mt-0.5",style:{color:"var(--color-text-muted)"},children:[u,u&&v&&" \xb7 ",v]})]})}),w&&(0,d.jsx)(k,{label:"Organizer",children:(0,d.jsx)(l,{person:w,onOpenPerson:c})}),x.length>0&&(0,d.jsx)(k,{label:`Attendees \xb7 ${x.length}`,children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:x.map(a=>(0,d.jsx)(l,{person:a,onOpenPerson:c},a.id))})}),y.length>0&&(0,d.jsx)(k,{label:1===y.length?"Company":"Companies",children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:y.map(a=>(0,d.jsx)(m,{company:a,onOpenCompany:f},a.id))})}),j&&!h&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"Loading meeting details…"}),p&&(0,d.jsxs)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:["Couldn’t load meeting details (",p,"). Showing what we have."]}),!j&&!p&&h&&0===x.length&&!w&&0===y.length&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"No additional details for this meeting."})]})}function k({label:a,children:b}){return(0,d.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,d.jsx)("h4",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-[0.16em]",style:{color:"var(--color-text-muted)"},children:a}),b]})}function l({person:a,onOpenPerson:b}){let c=a.name?.trim()||a.email||"Unknown",e=a.name?.trim()&&a.email?a.email:null;return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",style:{color:"var(--color-text)"},onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(f.X,{src:a.avatar_url,name:c,seed:a.email??a.id,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:e})]})]})}function m({company:a,onOpenCompany:b}){let c=a.name?.trim()||a.domain||"Unknown company";return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(g.g,{domain:a.domain,name:a.name,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),a.domain&&a.name&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:a.domain})]})]})}function n({expanded:a}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"motion-reduce:transition-none",style:{color:"var(--color-text-muted)",transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})}function o(a){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}},669661:(a,b,c)=>{"use strict";c.d(b,{Lz:()=>bR,NZ:()=>br,zF:()=>bu});var d=c(381802),e=c(331480),f=c(731626);let g=function(a){for(var b=0;;b++)if(!(a=a.previousSibling))return b},h=function(a){let b=a.assignedSlot||a.parentNode;return b&&11==b.nodeType?b.host:b},i=null,j=function(a,b,c){let d=i||(i=document.createRange());return d.setEnd(a,null==c?a.nodeValue.length:c),d.setStart(a,b||0),d},k=function(){i=null},l=function(a,b,c,d){return c&&(n(a,b,c,d,-1)||n(a,b,c,d,1))},m=/^(img|br|input|textarea|hr)$/i;function n(a,b,c,d,e){for(var f;;){if(a==c&&b==d)return!0;if(b==(e<0?0:o(a))){let c=a.parentNode;if(!c||1!=c.nodeType||p(a)||m.test(a.nodeName)||"false"==a.contentEditable)return!1;b=g(a)+(e<0?0:1),a=c}else{if(1!=a.nodeType)return!1;let c=a.childNodes[b+(e<0?-1:0)];if(1==c.nodeType&&"false"==c.contentEditable)if(null==(f=c.pmViewDesc)||!f.ignoreForSelection)return!1;else b+=e;else a=c,b=e<0?o(a):0}}}function o(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function p(a){let b;for(let c=a;c&&!(b=c.pmViewDesc);c=c.parentNode);return b&&b.node&&b.node.isBlock&&(b.dom==a||b.contentDOM==a)}let q=function(a){return a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset)};function r(a,b){let c=document.createEvent("Event");return c.initEvent("keydown",!0,!0),c.keyCode=a,c.key=c.code=b,c}let s="undefined"!=typeof navigator?navigator:null,t="undefined"!=typeof document?document:null,u=s&&s.userAgent||"",v=/Edge\/(\d+)/.exec(u),w=/MSIE \d/.exec(u),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),y=!!(w||x||v),z=w?document.documentMode:x?+x[1]:v?+v[1]:0,A=!y&&/gecko\/(\d+)/i.test(u);A&&(/Firefox\/(\d+)/.exec(u)||[0,0])[1];let B=!y&&/Chrome\/(\d+)/.exec(u),C=!!B,D=B?+B[1]:0,E=!y&&!!s&&/Apple Computer/.test(s.vendor),F=E&&(/Mobile\/\w+/.test(u)||!!s&&s.maxTouchPoints>2),G=F||!!s&&/Mac/.test(s.platform),H=!!s&&/Win/.test(s.platform),I=/Android \d/.test(u),J=!!t&&"webkitFontSmoothing"in t.documentElement.style,K=J?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L(a,b){return"number"==typeof a?a:a[b]}function M(a,b,c){let d=a.someProp("scrollThreshold")||0,e=a.someProp("scrollMargin")||5,f=a.dom.ownerDocument;for(let g=c||a.dom;g;){if(1!=g.nodeType){g=h(g);continue}let a=g,c=a==f.body,i=c?function(a){let b=a.defaultView&&a.defaultView.visualViewport;return b?{left:0,right:b.width,top:0,bottom:b.height}:{left:0,right:a.documentElement.clientWidth,top:0,bottom:a.documentElement.clientHeight}}(f):function(a){let b=a.getBoundingClientRect(),c=b.width/a.offsetWidth||1,d=b.height/a.offsetHeight||1;return{left:b.left,right:b.left+a.clientWidth*c,top:b.top,bottom:b.top+a.clientHeight*d}}(a),j=0,k=0;if(b.top<i.top+L(d,"top")?k=-(i.top-b.top+L(e,"top")):b.bottom>i.bottom-L(d,"bottom")&&(k=b.bottom-b.top>i.bottom-i.top?b.top+L(e,"top")-i.top:b.bottom-i.bottom+L(e,"bottom")),b.left<i.left+L(d,"left")?j=-(i.left-b.left+L(e,"left")):b.right>i.right-L(d,"right")&&(j=b.right-i.right+L(e,"right")),j||k)if(c)f.defaultView.scrollBy(j,k);else{let c=a.scrollLeft,d=a.scrollTop;k&&(a.scrollTop+=k),j&&(a.scrollLeft+=j);let e=a.scrollLeft-c,f=a.scrollTop-d;b={left:b.left-e,top:b.top-f,right:b.right-e,bottom:b.bottom-f}}let l=c?"fixed":getComputedStyle(g).position;if(/^(fixed|sticky)$/.test(l))break;g="absolute"==l?g.offsetParent:h(g)}}function N(a){let b=[],c=a.ownerDocument;for(let d=a;d&&(b.push({dom:d,top:d.scrollTop,left:d.scrollLeft}),a!=c);d=h(d));return b}function O(a,b){for(let c=0;c<a.length;c++){let{dom:d,top:e,left:f}=a[c];d.scrollTop!=e+b&&(d.scrollTop=e+b),d.scrollLeft!=f&&(d.scrollLeft=f)}}let P=null;function Q(a,b){return a.left>=b.left-1&&a.left<=b.right+1&&a.top>=b.top-1&&a.top<=b.bottom+1}function R(a){return a.top<a.bottom||a.left<a.right}function S(a,b){let c=a.getClientRects();if(c.length){let a=c[b<0?0:c.length-1];if(R(a))return a}return Array.prototype.find.call(c,R)||a.getBoundingClientRect()}let T=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function U(a,b,c){let{node:d,offset:e,atom:f}=a.docView.domFromPos(b,c<0?-1:1),g=J||A;if(3==d.nodeType)if(g&&(T.test(d.nodeValue)||(c<0?!e:e==d.nodeValue.length))){let a=S(j(d,e,e),c);if(A&&e&&/\s/.test(d.nodeValue[e-1])&&e<d.nodeValue.length){let b=S(j(d,e-1,e-1),-1);if(b.top==a.top){let c=S(j(d,e,e+1),-1);if(c.top!=a.top)return V(c,c.left<b.left)}}return a}else{let a=e,b=e,f=c<0?1:-1;return c<0&&!e?(b++,f=-1):c>=0&&e==d.nodeValue.length?(a--,f=1):c<0?a--:b++,V(S(j(d,a,b),f),f<0)}if(!a.state.doc.resolve(b-(f||0)).parent.inlineContent){if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1];if(1==a.nodeType)return W(a.getBoundingClientRect(),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];if(1==a.nodeType)return W(a.getBoundingClientRect(),!0)}return W(d.getBoundingClientRect(),c>=0)}if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1],b=3==a.nodeType?j(a,o(a)-!g):1!=a.nodeType||"BR"==a.nodeName&&a.nextSibling?null:a;if(b)return V(S(b,1),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let b=a?3==a.nodeType?j(a,0,+!g):1==a.nodeType?a:null:null;if(b)return V(S(b,-1),!0)}return V(S(3==d.nodeType?j(d):d,-c),c>=0)}function V(a,b){if(0==a.width)return a;let c=b?a.left:a.right;return{top:a.top,bottom:a.bottom,left:c,right:c}}function W(a,b){if(0==a.height)return a;let c=b?a.top:a.bottom;return{top:c,bottom:c,left:a.left,right:a.right}}function X(a,b,c){let d=a.state,e=a.root.activeElement;d!=b&&a.updateState(b),e!=a.dom&&a.focus();try{return c()}finally{d!=b&&a.updateState(d),e!=a.dom&&e&&e.focus()}}let Y=/[\u0590-\u08ac]/,Z=null,_=null,aa=!1;class ab{constructor(a,b,c,d){this.parent=a,this.children=b,this.dom=c,this.contentDOM=d,this.dirty=0,c.pmViewDesc=this}matchesWidget(a){return!1}matchesMark(a){return!1}matchesNode(a,b,c){return!1}matchesHack(a){return!1}parseRule(){return null}stopEvent(a){return!1}get size(){let a=0;for(let b=0;b<this.children.length;b++)a+=this.children[b].size;return a}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let a=0;a<this.children.length;a++)this.children[a].destroy()}posBeforeChild(a){for(let b=0,c=this.posAtStart;;b++){let d=this.children[b];if(d==a)return c;c+=d.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(a,b,c){let d;if(this.contentDOM&&this.contentDOM.contains(1==a.nodeType?a:a.parentNode))if(c<0){let c,d;if(a==this.contentDOM)c=a.childNodes[b-1];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.previousSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.previousSibling;return c?this.posBeforeChild(d)+d.size:this.posAtStart}else{let c,d;if(a==this.contentDOM)c=a.childNodes[b];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.nextSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.nextSibling;return c?this.posBeforeChild(d):this.posAtEnd}if(a==this.dom&&this.contentDOM)d=b>g(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))d=2&a.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==b)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!1;break}if(b.previousSibling)break}if(null==d&&b==a.childNodes.length)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!0;break}if(b.nextSibling)break}}return(null==d?c>0:d)?this.posAtEnd:this.posAtStart}nearestDesc(a,b=!1){for(let c=!0,d=a;d;d=d.parentNode){let e=this.getDesc(d),f;if(e&&(!b||e.node))if(!c||!(f=e.nodeDOM)||(1==f.nodeType?f.contains(1==a.nodeType?a:a.parentNode):f==a))return e;else c=!1}}getDesc(a){let b=a.pmViewDesc;for(let a=b;a;a=a.parent)if(a==this)return b}posFromDOM(a,b,c){for(let d=a;d;d=d.parentNode){let e=this.getDesc(d);if(e)return e.localPosFromDOM(a,b,c)}return -1}descAt(a){for(let b=0,c=0;b<this.children.length;b++){let d=this.children[b],e=c+d.size;if(c==a&&e!=c){for(;!d.border&&d.children.length;)for(let a=0;a<d.children.length;a++){let b=d.children[a];if(b.size){d=b;break}}return d}if(a<e)return d.descAt(a-c-d.border);c=e}}domFromPos(a,b){if(!this.contentDOM)return{node:this.dom,offset:0,atom:a+1};let c=0,d=0;for(let b=0;c<this.children.length;c++){let e=this.children[c],f=b+e.size;if(f>a||e instanceof ai){d=a-b;break}b=f}if(d)return this.children[c].domFromPos(d-this.children[c].border,b);for(let a;c&&!(a=this.children[c-1]).size&&a instanceof ac&&a.side>=0;c--);if(b<=0){let a,d=!0;for(;(a=c?this.children[c-1]:null)&&a.dom.parentNode!=this.contentDOM;c--,d=!1);return a&&b&&d&&!a.border&&!a.domAtom?a.domFromPos(a.size,b):{node:this.contentDOM,offset:a?g(a.dom)+1:0}}{let a,d=!0;for(;(a=c<this.children.length?this.children[c]:null)&&a.dom.parentNode!=this.contentDOM;c++,d=!1);return a&&d&&!a.border&&!a.domAtom?a.domFromPos(0,b):{node:this.contentDOM,offset:a?g(a.dom):this.contentDOM.childNodes.length}}}parseRange(a,b,c=0){if(0==this.children.length)return{node:this.contentDOM,from:a,to:b,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let d=-1,e=-1;for(let f=c,h=0;;h++){let c=this.children[h],i=f+c.size;if(-1==d&&a<=i){let e=f+c.border;if(a>=e&&b<=i-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(a,b,e);a=f;for(let b=h;b>0;b--){let c=this.children[b-1];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(1)){d=g(c.dom)+1;break}a-=c.size}-1==d&&(d=0)}if(d>-1&&(i>b||h==this.children.length-1)){b=i;for(let a=h+1;a<this.children.length;a++){let c=this.children[a];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(-1)){e=g(c.dom);break}b+=c.size}-1==e&&(e=this.contentDOM.childNodes.length);break}f=i}return{node:this.contentDOM,from:a,to:b,fromOffset:d,toOffset:e}}emptyChildAt(a){if(this.border||!this.contentDOM||!this.children.length)return!1;let b=this.children[a<0?0:this.children.length-1];return 0==b.size||b.emptyChildAt(a)}domAfterPos(a){let{node:b,offset:c}=this.domFromPos(a,0);if(1!=b.nodeType||c==b.childNodes.length)throw RangeError("No node after pos "+a);return b.childNodes[c]}setSelection(a,b,c,d=!1){let e=Math.min(a,b),f=Math.max(a,b);for(let g=0,h=0;g<this.children.length;g++){let i=this.children[g],j=h+i.size;if(e>h&&f<j)return i.setSelection(a-h-i.border,b-h-i.border,c,d);h=j}let h=this.domFromPos(a,a?-1:1),i=b==a?h:this.domFromPos(b,b?-1:1),j=c.root.getSelection(),k=c.domSelectionRange(),m=!1;if((A||E)&&a==b){let{node:a,offset:b}=h;if(3==a.nodeType){if((m=!!(b&&"\n"==a.nodeValue[b-1]))&&b==a.nodeValue.length)for(let b=a,c;b;b=b.parentNode){if(c=b.nextSibling){"BR"==c.nodeName&&(h=i={node:c.parentNode,offset:g(c)+1});break}let a=b.pmViewDesc;if(a&&a.node&&a.node.isBlock)break}}else{let c=a.childNodes[b-1];m=c&&("BR"==c.nodeName||"false"==c.contentEditable)}}if(A&&k.focusNode&&k.focusNode!=i.node&&1==k.focusNode.nodeType){let a=k.focusNode.childNodes[k.focusOffset];a&&"false"==a.contentEditable&&(d=!0)}if(!(d||m&&E)&&l(h.node,h.offset,k.anchorNode,k.anchorOffset)&&l(i.node,i.offset,k.focusNode,k.focusOffset))return;let n=!1;if((j.extend||a==b)&&!(m&&A)){j.collapse(h.node,h.offset);try{a!=b&&j.extend(i.node,i.offset),n=!0}catch(a){}}if(!n){if(a>b){let a=h;h=i,i=a}let c=document.createRange();c.setEnd(i.node,i.offset),c.setStart(h.node,h.offset),j.removeAllRanges(),j.addRange(c)}}ignoreMutation(a){return!this.contentDOM&&"selection"!=a.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(a,b){for(let c=0,d=0;d<this.children.length;d++){let e=this.children[d],f=c+e.size;if(c==f?a<=f&&b>=c:a<f&&b>c){let d=c+e.border,g=f-e.border;if(a>=d&&b<=g){this.dirty=a==c||b==f?2:1,a==d&&b==g&&(e.contentLost||e.dom.parentNode!=this.contentDOM)?e.dirty=3:e.markDirty(a-d,b-d);return}e.dirty=e.dom!=e.contentDOM||e.dom.parentNode!=this.contentDOM||e.children.length?3:2}c=f}this.dirty=2}markParentsDirty(){let a=1;for(let b=this.parent;b;b=b.parent,a++){let c=1==a?2:1;b.dirty<c&&(b.dirty=c)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(a){return!1}}class ac extends ab{constructor(a,b,c,d){let e,f=b.type.toDOM;if("function"==typeof f&&(f=f(c,()=>e?e.parent?e.parent.posBeforeChild(e):void 0:d)),!b.type.spec.raw){if(1!=f.nodeType){let a=document.createElement("span");a.appendChild(f),f=a}f.contentEditable="false",f.classList.add("ProseMirror-widget")}super(a,[],f,null),this.widget=b,this.widget=b,e=this}matchesWidget(a){return 0==this.dirty&&a.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(a){let b=this.widget.spec.stopEvent;return!!b&&b(a)}ignoreMutation(a){return"selection"!=a.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ad extends ab{constructor(a,b,c,d){super(a,[],b,null),this.textDOM=c,this.text=d}get size(){return this.text.length}localPosFromDOM(a,b){return a!=this.textDOM?this.posAtStart+(b?this.size:0):this.posAtStart+b}domFromPos(a){return{node:this.textDOM,offset:a}}ignoreMutation(a){return"characterData"===a.type&&a.target.nodeValue==a.oldValue}}class ae extends ab{constructor(a,b,c,d,e){super(a,[],c,d),this.mark=b,this.spec=e}static create(a,b,c,d){let f=d.nodeViews[b.type.name],g=f&&f(b,d,c);return g&&g.dom||(g=e.ZF.renderSpec(document,b.type.spec.toDOM(b,c),null,b.attrs)),new ae(a,b,g.dom,g.contentDOM||g.dom,g)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(a){return 3!=this.dirty&&this.mark.eq(a)}markDirty(a,b){if(super.markDirty(a,b),0!=this.dirty){let a=this.parent;for(;!a.node;)a=a.parent;a.dirty<this.dirty&&(a.dirty=this.dirty),this.dirty=0}}slice(a,b,c){let d=ae.create(this.parent,this.mark,!0,c),e=this.children,f=this.size;b<f&&(e=at(e,b,f,c)),a>0&&(e=at(e,0,a,c));for(let a=0;a<e.length;a++)e[a].parent=d;return d.children=e,d}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class af extends ab{constructor(a,b,c,d,e,f,g,h,i){super(a,[],e,f),this.node=b,this.outerDeco=c,this.innerDeco=d,this.nodeDOM=g}static create(a,b,c,d,f,g){let h=f.nodeViews[b.type.name],i,j=h&&h(b,f,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:g,c,d),k=j&&j.dom,l=j&&j.contentDOM;if(b.isText)if(k){if(3!=k.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else k=document.createTextNode(b.text);else if(!k){let a=e.ZF.renderSpec(document,b.type.spec.toDOM(b),null,b.attrs);({dom:k,contentDOM:l}=a)}l||b.isText||"BR"==k.nodeName||(k.hasAttribute("contenteditable")||(k.contentEditable="false"),b.type.spec.draggable&&(k.draggable=!0));let m=k;return(k=ao(k,c,b),j)?i=new aj(a,b,c,d,k,l||null,m,j,f,g+1):b.isText?new ah(a,b,c,d,k,m,f):new af(a,b,c,d,k,l||null,m,f,g+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let a={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(a.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let b=this.children.length-1;b>=0;b--){let c=this.children[b];if(this.dom.contains(c.dom.parentNode)){a.contentElement=c.dom.parentNode;break}}a.contentElement||(a.getContent=()=>e.FK.empty)}else a.contentElement=this.contentDOM;else a.getContent=()=>this.node.content;return a}matchesNode(a,b,c){return 0==this.dirty&&a.eq(this.node)&&ap(b,this.outerDeco)&&c.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(a,b){let c=this.node.inlineContent,d=b,f=a.composing?this.localCompositionInfo(a,b):null,g=f&&f.pos>-1?f:null,h=f&&f.pos<0,i=new ar(this,g&&g.node,a);(function(a,b,c,d){let e=b.locals(a),f=0;if(0==e.length){for(let c=0;c<a.childCount;c++){let g=a.child(c);d(g,e,b.forChild(f,g),c),f+=g.nodeSize}return}let g=0,h=[],i=null;for(let j=0;;){let k,l,m,n;for(;g<e.length&&e[g].to==f;){let a=e[g++];a.widget&&(k?(l||(l=[k])).push(a):k=a)}if(k)if(l){l.sort(as);for(let a=0;a<l.length;a++)c(l[a],j,!!i)}else c(k,j,!!i);if(i)n=-1,m=i,i=null;else if(j<a.childCount)n=j,m=a.child(j++);else break;for(let a=0;a<h.length;a++)h[a].to<=f&&h.splice(a--,1);for(;g<e.length&&e[g].from<=f&&e[g].to>f;)h.push(e[g++]);let o=f+m.nodeSize;if(m.isText){let a=o;g<e.length&&e[g].from<a&&(a=e[g].from);for(let b=0;b<h.length;b++)h[b].to<a&&(a=h[b].to);a<o&&(i=m.cut(a-f),m=m.cut(0,a-f),o=a,n=-1)}else for(;g<e.length&&e[g].to<o;)g++;let p=m.isInline&&!m.isLeaf?h.filter(a=>!a.inline):h.slice();d(m,p,b.forChild(f,m),n),f=o}})(this.node,this.innerDeco,(b,f,g)=>{b.spec.marks?i.syncToMarks(b.spec.marks,c,a,f):b.type.side>=0&&!g&&i.syncToMarks(f==this.node.childCount?e.CU.none:this.node.child(f).marks,c,a,f),i.placeWidget(b,a,d)},(b,e,g,j)=>{let k;i.syncToMarks(b.marks,c,a,j),i.findNodeMatch(b,e,g,j)||h&&a.state.selection.from>d&&a.state.selection.to<d+b.nodeSize&&(k=i.findIndexWithChild(f.node))>-1&&i.updateNodeAt(b,e,g,k,a)||i.updateNextNode(b,e,g,a,j,d)||i.addNode(b,e,g,a,d),d+=b.nodeSize}),i.syncToMarks([],c,a,0),this.node.isTextblock&&i.addTextblockHacks(),i.destroyRest(),(i.changed||2==this.dirty)&&(g&&this.protectLocalComposition(a,g),function a(b,c,d){let e=b.firstChild,f=!1;for(let g=0;g<c.length;g++){let h=c[g],i=h.dom;if(i.parentNode==b){for(;i!=e;)e=aq(e),f=!0;e=e.nextSibling}else f=!0,b.insertBefore(i,e);if(h instanceof ae){let c=e?e.previousSibling:b.lastChild;a(h.contentDOM,h.children,d),e=c?c.nextSibling:b.firstChild}}for(;e;)e=aq(e),f=!0;f&&d.trackWrites==b&&(d.trackWrites=null)}(this.contentDOM,this.children,a),F&&function(a){if("UL"==a.nodeName||"OL"==a.nodeName){let b=a.style.cssText;a.style.cssText=b+"; list-style: square !important",window.getComputedStyle(a).listStyle,a.style.cssText=b}}(this.dom))}localCompositionInfo(a,b){let{from:c,to:e}=a.state.selection;if(!(a.state.selection instanceof d.U3)||c<b||e>b+this.node.content.size)return null;let f=a.input.compositionNode;if(!f||!this.dom.contains(f.parentNode))return null;if(!this.node.inlineContent)return{node:f,pos:-1,text:""};{let a=f.nodeValue,d=function(a,b,c,d){for(let e=0,f=0;e<a.childCount&&f<=d;){let g=a.child(e++),h=f;if(f+=g.nodeSize,!g.isText)continue;let i=g.text;for(;e<a.childCount;){let b=a.child(e++);if(f+=b.nodeSize,!b.isText)break;i+=b.text}if(f>=c){if(f>=d&&i.slice(d-b.length-h,d-h)==b)return d-b.length;let a=h<d?i.lastIndexOf(b,d-h-1):-1;if(a>=0&&a+b.length+h>=c)return h+a;if(c==d&&i.length>=d+b.length-h&&i.slice(d-h,d-h+b.length)==b)return d}}return -1}(this.node.content,a,c-b,e-b);return d<0?null:{node:f,pos:d,text:a}}}protectLocalComposition(a,{node:b,pos:c,text:d}){if(this.getDesc(b))return;let e=b;for(;e.parentNode!=this.contentDOM;e=e.parentNode){for(;e.previousSibling;)e.parentNode.removeChild(e.previousSibling);for(;e.nextSibling;)e.parentNode.removeChild(e.nextSibling);e.pmViewDesc&&(e.pmViewDesc=void 0)}let f=new ad(this,e,b,d);a.input.compositionNodes.push(f),this.children=at(this.children,c,c+d.length,a,f)}update(a,b,c,d){return 3!=this.dirty&&!!a.sameMarkup(this.node)&&(this.updateInner(a,b,c,d),!0)}updateInner(a,b,c,d){this.updateOuterDeco(b),this.node=a,this.innerDeco=c,this.contentDOM&&this.updateChildren(d,this.posAtStart),this.dirty=0}updateOuterDeco(a){if(ap(a,this.outerDeco))return;let b=1!=this.nodeDOM.nodeType,c=this.dom;this.dom=an(this.dom,this.nodeDOM,am(this.outerDeco,this.node,b),am(a,this.node,b)),this.dom!=c&&(c.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=a}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ag(a,b,c,d,e){ao(d,b,a);let f=new af(void 0,a,b,c,d,d,d,e,0);return f.contentDOM&&f.updateChildren(e,0),f}class ah extends af{constructor(a,b,c,d,e,f,g){super(a,b,c,d,e,null,f,g,0)}parseRule(){let a=this.nodeDOM.parentNode;for(;a&&a!=this.dom&&!a.pmIsDeco;)a=a.parentNode;return{skip:a||!0}}update(a,b,c,d){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!a.sameMarkup(this.node)&&(this.updateOuterDeco(b),(0!=this.dirty||a.text!=this.node.text)&&a.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=a.text,d.trackWrites==this.nodeDOM&&(d.trackWrites=null)),this.node=a,this.dirty=0,!0)}inParent(){let a=this.parent.contentDOM;for(let b=this.nodeDOM;b;b=b.parentNode)if(b==a)return!0;return!1}domFromPos(a){return{node:this.nodeDOM,offset:a}}localPosFromDOM(a,b,c){return a==this.nodeDOM?this.posAtStart+Math.min(b,this.node.text.length):super.localPosFromDOM(a,b,c)}ignoreMutation(a){return"characterData"!=a.type&&"selection"!=a.type}slice(a,b,c){let d=this.node.cut(a,b),e=document.createTextNode(d.text);return new ah(this.parent,d,this.outerDeco,this.innerDeco,e,e,c)}markDirty(a,b){super.markDirty(a,b),this.dom!=this.nodeDOM&&(0==a||b==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(a){return this.node.text==a}}class ai extends ab{parseRule(){return{ignore:!0}}matchesHack(a){return 0==this.dirty&&this.dom.nodeName==a}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class aj extends af{constructor(a,b,c,d,e,f,g,h,i,j){super(a,b,c,d,e,f,g,i,j),this.spec=h}update(a,b,c,d){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==a.type||this.spec.multiType)){let e=this.spec.update(a,b,c);return e&&this.updateInner(a,b,c,d),e}return(!!this.contentDOM||!!a.isLeaf)&&super.update(a,b,c,d)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(a,b,c,d){this.spec.setSelection?this.spec.setSelection(a,b,c.root):super.setSelection(a,b,c,d)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(a){return!!this.spec.stopEvent&&this.spec.stopEvent(a)}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}}let ak=function(a){a&&(this.nodeName=a)};ak.prototype=Object.create(null);let al=[new ak];function am(a,b,c){if(0==a.length)return al;let d=c?al[0]:new ak,e=[d];for(let f=0;f<a.length;f++){let g=a[f].type.attrs;if(g)for(let a in g.nodeName&&e.push(d=new ak(g.nodeName)),g){let f=g[a];null!=f&&(c&&1==e.length&&e.push(d=new ak(b.isInline?"span":"div")),"class"==a?d.class=(d.class?d.class+" ":"")+f:"style"==a?d.style=(d.style?d.style+";":"")+f:"nodeName"!=a&&(d[a]=f))}}return e}function an(a,b,c,d){if(c==al&&d==al)return b;let e=b;for(let b=0;b<d.length;b++){let f=d[b],g=c[b];if(b){let b;g&&g.nodeName==f.nodeName&&e!=a&&(b=e.parentNode)&&b.nodeName.toLowerCase()==f.nodeName||((b=document.createElement(f.nodeName)).pmIsDeco=!0,b.appendChild(e),g=al[0]),e=b}!function(a,b,c){for(let d in b)"class"==d||"style"==d||"nodeName"==d||d in c||a.removeAttribute(d);for(let d in c)"class"!=d&&"style"!=d&&"nodeName"!=d&&c[d]!=b[d]&&a.setAttribute(d,c[d]);if(b.class!=c.class){let d=b.class?b.class.split(" ").filter(Boolean):[],e=c.class?c.class.split(" ").filter(Boolean):[];for(let b=0;b<d.length;b++)-1==e.indexOf(d[b])&&a.classList.remove(d[b]);for(let b=0;b<e.length;b++)-1==d.indexOf(e[b])&&a.classList.add(e[b]);0==a.classList.length&&a.removeAttribute("class")}if(b.style!=c.style){if(b.style){let c=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,d;for(;d=c.exec(b.style);)a.style.removeProperty(d[1])}c.style&&(a.style.cssText+=c.style)}}(e,g||al[0],f)}return e}function ao(a,b,c){return an(a,a,al,am(b,c,1!=a.nodeType))}function ap(a,b){if(a.length!=b.length)return!1;for(let c=0;c<a.length;c++)if(!a[c].type.eq(b[c].type))return!1;return!0}function aq(a){let b=a.nextSibling;return a.parentNode.removeChild(a),b}class ar{constructor(a,b,c){this.lock=b,this.view=c,this.index=0,this.stack=[],this.changed=!1,this.top=a,this.preMatch=function(a,b){let c=b,d=c.children.length,e=a.childCount,f=new Map,g=[];a:for(;e>0;){let h;for(;;)if(d){let a=c.children[d-1];if(a instanceof ae)c=a,d=a.children.length;else{h=a,d--;break}}else if(c==b)break a;else d=c.parent.children.indexOf(c),c=c.parent;let i=h.node;if(i){if(i!=a.child(e-1))break;--e,f.set(h,e),g.push(h)}}return{index:e,matched:f,matches:g.reverse()}}(a.node.content,a)}destroyBetween(a,b){if(a!=b){for(let c=a;c<b;c++)this.top.children[c].destroy();this.top.children.splice(a,b-a),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(a,b,c,d){let e=0,f=this.stack.length>>1,g=Math.min(f,a.length);for(;e<g&&(e==f-1?this.top:this.stack[e+1<<1]).matchesMark(a[e])&&!1!==a[e].type.spec.spanning;)e++;for(;e<f;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),f--;for(;f<a.length;){this.stack.push(this.top,this.index+1);let e=-1,g=this.top.children.length;d<this.preMatch.index&&(g=Math.min(this.index+3,g));for(let b=this.index;b<g;b++){let c=this.top.children[b];if(c.matchesMark(a[f])&&!this.isLocked(c.dom)){e=b;break}}if(e>-1)e>this.index&&(this.changed=!0,this.destroyBetween(this.index,e)),this.top=this.top.children[this.index];else{let d=ae.create(this.top,a[f],b,c);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,f++}}findNodeMatch(a,b,c,d){let e=-1,f;if(d>=this.preMatch.index&&(f=this.preMatch.matches[d-this.preMatch.index]).parent==this.top&&f.matchesNode(a,b,c))e=this.top.children.indexOf(f,this.index);else for(let d=this.index,f=Math.min(this.top.children.length,d+5);d<f;d++){let f=this.top.children[d];if(f.matchesNode(a,b,c)&&!this.preMatch.matched.has(f)){e=d;break}}return!(e<0)&&(this.destroyBetween(this.index,e),this.index++,!0)}updateNodeAt(a,b,c,d,e){let f=this.top.children[d];return 3==f.dirty&&f.dom==f.contentDOM&&(f.dirty=2),!!f.update(a,b,c,e)&&(this.destroyBetween(this.index,d),this.index++,!0)}findIndexWithChild(a){for(;;){let b=a.parentNode;if(!b)return -1;if(b==this.top.contentDOM){let b=a.pmViewDesc;if(b){for(let a=this.index;a<this.top.children.length;a++)if(this.top.children[a]==b)return a}return -1}a=b}}updateNextNode(a,b,c,d,e,f){for(let g=this.index;g<this.top.children.length;g++){let h=this.top.children[g];if(h instanceof af){let i=this.preMatch.matched.get(h);if(null!=i&&i!=e)return!1;let j=h.dom,k,l=this.isLocked(j)&&!(a.isText&&h.node&&h.node.isText&&h.nodeDOM.nodeValue==a.text&&3!=h.dirty&&ap(b,h.outerDeco));if(!l&&h.update(a,b,c,d))return this.destroyBetween(this.index,g),h.dom!=j&&(this.changed=!0),this.index++,!0;if(!l&&(k=this.recreateWrapper(h,a,b,c,d,f)))return this.destroyBetween(this.index,g),this.top.children[this.index]=k,k.contentDOM&&(k.dirty=2,k.updateChildren(d,f+1),k.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(a,b,c,d,e,f){if(a.dirty||b.isAtom||!a.children.length||!a.node.content.eq(b.content)||!ap(c,a.outerDeco)||!d.eq(a.innerDeco))return null;let g=af.create(this.top,b,c,d,e,f);if(g.contentDOM)for(let b of(g.children=a.children,a.children=[],g.children))b.parent=g;return a.destroy(),g}addNode(a,b,c,d,e){let f=af.create(this.top,a,b,c,d,e);f.contentDOM&&f.updateChildren(d,e+1),this.top.children.splice(this.index++,0,f),this.changed=!0}placeWidget(a,b,c){let d=this.index<this.top.children.length?this.top.children[this.index]:null;if(d&&d.matchesWidget(a)&&(a==d.widget||!d.widget.type.toDOM.parentNode))this.index++;else{let d=new ac(this.top,a,b,c);this.top.children.splice(this.index++,0,d),this.changed=!0}}addTextblockHacks(){let a=this.top.children[this.index-1],b=this.top;for(;a instanceof ae;)a=(b=a).children[b.children.length-1];(!a||!(a instanceof ah)||/\n$/.test(a.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(a.node.text))&&((E||C)&&a&&"false"==a.dom.contentEditable&&this.addHackNode("IMG",b),this.addHackNode("BR",this.top))}addHackNode(a,b){if(b==this.top&&this.index<b.children.length&&b.children[this.index].matchesHack(a))this.index++;else{let c=document.createElement(a);"IMG"==a&&(c.className="ProseMirror-separator",c.alt=""),"BR"==a&&(c.className="ProseMirror-trailingBreak");let d=new ai(this.top,[],c,null);b!=this.top?b.children.push(d):b.children.splice(this.index++,0,d),this.changed=!0}}isLocked(a){return this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))}}function as(a,b){return a.type.side-b.type.side}function at(a,b,c,d,e){let f=[];for(let g=0,h=0;g<a.length;g++){let i=a[g],j=h,k=h+=i.size;j>=c||k<=b?f.push(i):(j<b&&f.push(i.slice(0,b-j,d)),e&&(f.push(e),e=void 0),k>c&&f.push(i.slice(c-j,i.size,d)))}return f}function au(a,b=null){let c=a.domSelectionRange(),e=a.state.doc;if(!c.focusNode)return null;let f=a.docView.nearestDesc(c.focusNode),h=f&&0==f.size,i=a.docView.posFromDOM(c.focusNode,c.focusOffset,1);if(i<0)return null;let j=e.resolve(i),k,l;if(q(c)){for(k=i;f&&!f.node;)f=f.parent;let a=f.node;if(f&&a.isAtom&&d.nh.isSelectable(a)&&f.parent&&!(a.isInline&&function(a,b,c){for(let d=0==b,e=b==o(a);d||e;){if(a==c)return!0;let b=g(a);if(!(a=a.parentNode))return!1;d=d&&0==b,e=e&&b==o(a)}}(c.focusNode,c.focusOffset,f.dom))){let a=f.posBefore;l=new d.nh(i==a?j:e.resolve(a))}}else{if(c instanceof a.dom.ownerDocument.defaultView.Selection&&c.rangeCount>1){let b=i,d=i;for(let e=0;e<c.rangeCount;e++){let f=c.getRangeAt(e);b=Math.min(b,a.docView.posFromDOM(f.startContainer,f.startOffset,1)),d=Math.max(d,a.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(b<0)return null;[k,i]=d==a.state.selection.anchor?[d,b]:[b,d],j=e.resolve(i)}else k=a.docView.posFromDOM(c.anchorNode,c.anchorOffset,1);if(k<0)return null}let m=e.resolve(k);if(!l){let c="pointer"==b||a.state.selection.head<j.pos&&!h?1:-1;l=aD(a,m,j,c)}return l}function av(a){return a.editable?a.hasFocus():aF(a)&&document.activeElement&&document.activeElement.contains(a.dom)}function aw(a,b=!1){let c=a.state.selection;if(aB(a,c),av(a)){if(!b&&a.input.mouseDown&&a.input.mouseDown.allowDefault&&C){let b=a.domSelectionRange(),c=a.domObserver.currentSelection;if(b.anchorNode&&c.anchorNode&&l(b.anchorNode,b.anchorOffset,c.anchorNode,c.anchorOffset)){a.input.mouseDown.delayedSelectionSync=!0,a.domObserver.setCurSelection();return}}if(a.domObserver.disconnectSelection(),a.cursorWrapper)!function(a){let b=a.domSelection();if(!b)return;let c=a.cursorWrapper.dom,d="IMG"==c.nodeName;d?b.collapse(c.parentNode,g(c)+1):b.collapse(c,0),!d&&!a.state.selection.visible&&y&&z<=11&&(c.disabled=!0,c.disabled=!1)}(a);else{var e;let f,g,h,i,{anchor:j,head:k}=c,l,m;ax&&!(c instanceof d.U3)&&(c.$from.parent.inlineContent||(l=ay(a,c.from)),c.empty||c.$from.parent.inlineContent||(m=ay(a,c.to))),a.docView.setSelection(j,k,a,b),ax&&(l&&aA(l),m&&aA(m)),c.visible?a.dom.classList.remove("ProseMirror-hideselection"):(a.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((f=(e=a).dom.ownerDocument).removeEventListener("selectionchange",e.input.hideSelectionGuard),h=(g=e.domSelectionRange()).anchorNode,i=g.anchorOffset,f.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(g.anchorNode!=h||g.anchorOffset!=i)&&(f.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!av(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})))}a.domObserver.setCurSelection(),a.domObserver.connectSelection()}}let ax=E||C&&D<63;function ay(a,b){let{node:c,offset:d}=a.docView.domFromPos(b,0),e=d<c.childNodes.length?c.childNodes[d]:null,f=d?c.childNodes[d-1]:null;if(E&&e&&"false"==e.contentEditable)return az(e);if((!e||"false"==e.contentEditable)&&(!f||"false"==f.contentEditable)){if(e)return az(e);else if(f)return az(f)}}function az(a){return a.contentEditable="true",E&&a.draggable&&(a.draggable=!1,a.wasDraggable=!0),a}function aA(a){a.contentEditable="false",a.wasDraggable&&(a.draggable=!0,a.wasDraggable=null)}function aB(a,b){if(b instanceof d.nh){let c=a.docView.descAt(b.from);c!=a.lastSelectedViewDesc&&(aC(a),c&&c.selectNode(),a.lastSelectedViewDesc=c)}else aC(a)}function aC(a){a.lastSelectedViewDesc&&(a.lastSelectedViewDesc.parent&&a.lastSelectedViewDesc.deselectNode(),a.lastSelectedViewDesc=void 0)}function aD(a,b,c,e){return a.someProp("createSelectionBetween",d=>d(a,b,c))||d.U3.between(b,c,e)}function aE(a){return(!a.editable||!!a.hasFocus())&&aF(a)}function aF(a){let b=a.domSelectionRange();if(!b.anchorNode)return!1;try{return a.dom.contains(3==b.anchorNode.nodeType?b.anchorNode.parentNode:b.anchorNode)&&(a.editable||a.dom.contains(3==b.focusNode.nodeType?b.focusNode.parentNode:b.focusNode))}catch(a){return!1}}function aG(a,b){let{$anchor:c,$head:e}=a.selection,f=b>0?c.max(e):c.min(e),g=f.parent.inlineContent?f.depth?a.doc.resolve(b>0?f.after():f.before()):null:f;return g&&d.LN.findFrom(g,b)}function aH(a,b){return a.dispatch(a.state.tr.setSelection(b).scrollIntoView()),!0}function aI(a,b,c){let e=a.state.selection;if(e instanceof d.U3){if(c.indexOf("s")>-1){let{$head:c}=e,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter;if(!f||f.isText||!f.isLeaf)return!1;let g=a.state.doc.resolve(c.pos+f.nodeSize*(b<0?-1:1));return aH(a,new d.U3(e.$anchor,g))}else if(!e.empty)return!1;else if(a.endOfTextblock(b>0?"forward":"backward")){let c=aG(a.state,b);return!!c&&c instanceof d.nh&&aH(a,c)}else if(!(G&&c.indexOf("m")>-1)){let c=e.$head,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter,g;if(!f||f.isText)return!1;let h=b<0?c.pos-f.nodeSize:c.pos;return!!(f.isAtom||(g=a.docView.descAt(h))&&!g.contentDOM)&&(d.nh.isSelectable(f)?aH(a,new d.nh(b<0?a.state.doc.resolve(c.pos-f.nodeSize):c)):!!J&&aH(a,new d.U3(a.state.doc.resolve(b<0?h:h+f.nodeSize))))}}else{if(e instanceof d.nh&&e.node.isInline)return aH(a,new d.U3(b>0?e.$to:e.$from));let c=aG(a.state,b);return!!c&&aH(a,c)}}function aJ(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function aK(a,b){let c=a.pmViewDesc;return c&&0==c.size&&(b<0||a.nextSibling||"BR"!=a.nodeName)}function aL(a,b){return b<0?function(a){let b=a.domSelectionRange(),c=b.focusNode,d=b.focusOffset;if(!c)return;let e,f,h=!1;for(A&&1==c.nodeType&&d<aJ(c)&&aK(c.childNodes[d],-1)&&(h=!0);;)if(d>0)if(1!=c.nodeType)break;else{let a=c.childNodes[d-1];if(aK(a,-1))e=c,f=--d;else if(3==a.nodeType)d=(c=a).nodeValue.length;else break}else if(aM(c))break;else{let b=c.previousSibling;for(;b&&aK(b,-1);)e=c.parentNode,f=g(b),b=b.previousSibling;if(b)d=aJ(c=b);else{if((c=c.parentNode)==a.dom)break;d=0}}h?aN(a,c,d):e&&aN(a,e,f)}(a):function(a){let b,c,d=a.domSelectionRange(),e=d.focusNode,f=d.focusOffset;if(!e)return;let h=aJ(e);for(;;)if(f<h){if(1!=e.nodeType)break;if(aK(e.childNodes[f],1))b=e,c=++f;else break}else if(aM(e))break;else{let d=e.nextSibling;for(;d&&aK(d,1);)b=d.parentNode,c=g(d)+1,d=d.nextSibling;if(d)f=0,h=aJ(e=d);else{if((e=e.parentNode)==a.dom)break;f=h=0}}b&&aN(a,b,c)}(a)}function aM(a){let b=a.pmViewDesc;return b&&b.node&&b.node.isBlock}function aN(a,b,c){if(3!=b.nodeType){let a,d;(d=function(a,b){for(;a&&b==a.childNodes.length&&!p(a);)b=g(a)+1,a=a.parentNode;for(;a&&b<a.childNodes.length;){let c=a.childNodes[b];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;a=c,b=0}}(b,c))?(b=d,c=0):(a=function(a,b){for(;a&&!b&&!p(a);)b=g(a),a=a.parentNode;for(;a&&b;){let c=a.childNodes[b-1];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;b=(a=c).childNodes.length}}(b,c))&&(b=a,c=a.nodeValue.length)}let d=a.domSelection();if(!d)return;if(q(d)){let a=document.createRange();a.setEnd(b,c),a.setStart(b,c),d.removeAllRanges(),d.addRange(a)}else d.extend&&d.extend(b,c);a.domObserver.setCurSelection();let{state:e}=a;setTimeout(()=>{a.state==e&&aw(a)},50)}function aO(a,b){let c=a.state.doc.resolve(b);if(!(C||H)&&c.parent.inlineContent){let d=a.coordsAtPos(b);if(b>c.start()){let c=a.coordsAtPos(b-1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left<d.left?"ltr":"rtl"}if(b<c.end()){let c=a.coordsAtPos(b+1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left>d.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(a.dom).direction?"rtl":"ltr"}function aP(a,b,c){let e=a.state.selection;if(e instanceof d.U3&&!e.empty||c.indexOf("s")>-1||G&&c.indexOf("m")>-1)return!1;let{$from:f,$to:g}=e;if(!f.parent.inlineContent||a.endOfTextblock(b<0?"up":"down")){let c=aG(a.state,b);if(c&&c instanceof d.nh)return aH(a,c)}if(!f.parent.inlineContent){let c=b<0?f:g,h=e instanceof d.i5?d.LN.near(c,b):d.LN.findFrom(c,b);return!!h&&aH(a,h)}return!1}function aQ(a,b){if(!(a.state.selection instanceof d.U3))return!0;let{$head:c,$anchor:e,empty:f}=a.state.selection;if(!c.sameParent(e))return!0;if(!f)return!1;if(a.endOfTextblock(b>0?"forward":"backward"))return!0;let g=!c.textOffset&&(b<0?c.nodeBefore:c.nodeAfter);if(g&&!g.isText){let d=a.state.tr;return b<0?d.delete(c.pos-g.nodeSize,c.pos):d.delete(c.pos,c.pos+g.nodeSize),a.dispatch(d),!0}return!1}function aR(a,b,c){a.domObserver.stop(),b.contentEditable=c,a.domObserver.start()}function aS(a,b){a.someProp("transformCopied",c=>{b=c(b,a)});let c=[],{content:d,openStart:f,openEnd:g}=b;for(;f>1&&g>1&&1==d.childCount&&1==d.firstChild.childCount;){f--,g--;let a=d.firstChild;c.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),d=a.content}let h=a.someProp("clipboardSerializer")||e.ZF.fromSchema(a.state.schema),i=a$(),j=i.createElement("div");j.appendChild(h.serializeFragment(d,{document:i}));let k=j.firstChild,l,m=0;for(;k&&1==k.nodeType&&(l=aY[k.nodeName.toLowerCase()]);){for(let a=l.length-1;a>=0;a--){let b=i.createElement(l[a]);for(;j.firstChild;)b.appendChild(j.firstChild);j.appendChild(b),m++}k=j.firstChild}return k&&1==k.nodeType&&k.setAttribute("data-pm-slice",`${f} ${g}${m?` -${m}`:""} ${JSON.stringify(c)}`),{dom:j,text:a.someProp("clipboardTextSerializer",c=>c(b,a))||b.content.textBetween(0,b.content.size,"\n\n"),slice:b}}function aT(a,b,c,d,f){let g,h,i=f.parent.type.spec.code;if(!c&&!b)return null;let j=!!b&&(d||i||!c);if(j){if(a.someProp("transformPastedText",c=>{b=c(b,i||d,a)}),i)return h=new e.Ji(e.FK.from(a.state.schema.text(b.replace(/\r\n?/g,"\n"))),0,0),a.someProp("transformPasted",b=>{h=b(h,a,!0)}),h;let c=a.someProp("clipboardTextParser",c=>c(b,f,d,a));if(c)h=c;else{let c=f.marks(),{schema:d}=a.state,h=e.ZF.fromSchema(d);g=document.createElement("div"),b.split(/(?:\r\n?|\n)+/).forEach(a=>{let b=g.appendChild(document.createElement("p"));a&&b.appendChild(h.serializeNode(d.text(a,c)))})}}else a.someProp("transformPastedHTML",b=>{c=b(c,a)}),g=function(a){var b;let c,d=/^(\s*<meta [^>]*>)*/.exec(a);d&&(a=a.slice(d[0].length));let e=a$().createElement("div"),f=/<([a-z][^>\s]+)/i.exec(a),g;if((g=f&&aY[f[1].toLowerCase()])&&(a=g.map(a=>"<"+a+">").join("")+a+g.map(a=>"</"+a+">").reverse().join("")),e.innerHTML=(b=a,(c=window.trustedTypes)?(a_||(a_=c.defaultPolicy||c.createPolicy("ProseMirrorClipboard",{createHTML:a=>a})),a_.createHTML(b)):b),g)for(let a=0;a<g.length;a++)e=e.querySelector(g[a])||e;return e}(c),J&&function(a){let b=a.querySelectorAll(C?"span:not([class]):not([style])":"span.Apple-converted-space");for(let c=0;c<b.length;c++){let d=b[c];1==d.childNodes.length&&"\xa0"==d.textContent&&d.parentNode&&d.parentNode.replaceChild(a.ownerDocument.createTextNode(" "),d)}}(g);let k=g&&g.querySelector("[data-pm-slice]"),l=k&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(k.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let a=+l[3];a>0;a--){let a=g.firstChild;for(;a&&1!=a.nodeType;)a=a.nextSibling;if(!a)break;g=a}if(h||(h=(a.someProp("clipboardParser")||a.someProp("domParser")||e.S4.fromSchema(a.state.schema)).parseSlice(g,{preserveWhitespace:!!(j||l),context:f,ruleFromNode:a=>"BR"!=a.nodeName||a.nextSibling||!a.parentNode||aU.test(a.parentNode.nodeName)?null:{ignore:!0}})),l)h=function(a,b){if(!a.size)return a;let c=a.content.firstChild.type.schema,d;try{d=JSON.parse(b)}catch(b){return a}let{content:f,openStart:g,openEnd:h}=a;for(let a=d.length-2;a>=0;a-=2){let b=c.nodes[d[a]];if(!b||b.hasRequiredAttrs())break;f=e.FK.from(b.create(d[a+1],f)),g++,h++}return new e.Ji(f,g,h)}(aX(h,+l[1],+l[2]),l[4]);else if((h=e.Ji.maxOpen(function(a,b){if(a.childCount<2)return a;for(let c=b.depth;c>=0;c--){let d=b.node(c).contentMatchAt(b.index(c)),f,g=[];if(a.forEach(a=>{if(!g)return;let b=d.findWrapping(a.type),c;if(!b)return g=null;if(c=g.length&&f.length&&function a(b,c,d,f,g){if(g<b.length&&g<c.length&&b[g]==c[g]){let h=a(b,c,d,f.lastChild,g+1);if(h)return f.copy(f.content.replaceChild(f.childCount-1,h));if(f.contentMatchAt(f.childCount).matchType(g==b.length-1?d.type:b[g+1]))return f.copy(f.content.append(e.FK.from(aV(d,b,g+1))))}}(b,f,a,g[g.length-1],0))g[g.length-1]=c;else{g.length&&(g[g.length-1]=function a(b,c){if(0==c)return b;let d=b.content.replaceChild(b.childCount-1,a(b.lastChild,c-1)),f=b.contentMatchAt(b.childCount).fillBefore(e.FK.empty,!0);return b.copy(d.append(f))}(g[g.length-1],f.length));let c=aV(a,b);g.push(c),d=d.matchType(c.type),f=b}}),g)return e.FK.from(g)}return a}(h.content,f),!0)).openStart||h.openEnd){let a=0,b=0;for(let b=h.content.firstChild;a<h.openStart&&!b.type.spec.isolating;a++,b=b.firstChild);for(let a=h.content.lastChild;b<h.openEnd&&!a.type.spec.isolating;b++,a=a.lastChild);h=aX(h,a,b)}return a.someProp("transformPasted",b=>{h=b(h,a,j)}),h}let aU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function aV(a,b,c=0){for(let d=b.length-1;d>=c;d--)a=b[d].create(null,e.FK.from(a));return a}function aW(a,b,c,d,f,g){let h=b<0?a.firstChild:a.lastChild,i=h.content;return a.childCount>1&&(g=0),f<d-1&&(i=aW(i,b,c,d,f+1,g)),f>=c&&(i=b<0?h.contentMatchAt(0).fillBefore(i,g<=f).append(i):i.append(h.contentMatchAt(h.childCount).fillBefore(e.FK.empty,!0))),a.replaceChild(b<0?0:a.childCount-1,h.copy(i))}function aX(a,b,c){return b<a.openStart&&(a=new e.Ji(aW(a.content,-1,b,a.openStart,0,a.openEnd),b,a.openEnd)),c<a.openEnd&&(a=new e.Ji(aW(a.content,1,c,a.openEnd,0,0),a.openStart,c)),a}let aY={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},aZ=null;function a$(){return aZ||(aZ=document.implementation.createHTMLDocument("title"))}let a_=null,a0={},a1={},a2={touchstart:!0,touchmove:!0};class a3{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function a4(a,b){a.input.lastSelectionOrigin=b,a.input.lastSelectionTime=Date.now()}function a5(a){a.someProp("handleDOMEvents",b=>{for(let c in b)a.input.eventHandlers[c]||a.dom.addEventListener(c,a.input.eventHandlers[c]=b=>a6(a,b))})}function a6(a,b){return a.someProp("handleDOMEvents",c=>{let d=c[b.type];return!!d&&(d(a,b)||b.defaultPrevented)})}function a7(a){return{left:a.clientX,top:a.clientY}}function a8(a,b,c,d,e){if(-1==d)return!1;let f=a.state.doc.resolve(d);for(let d=f.depth+1;d>0;d--)if(a.someProp(b,b=>d>f.depth?b(a,c,f.nodeAfter,f.before(d),e,!0):b(a,c,f.node(d),f.before(d),e,!1)))return!0;return!1}function a9(a,b,c){if(a.focused||a.focus(),a.state.selection.eq(b))return;let d=a.state.tr.setSelection(b);"pointer"==c&&d.setMeta("pointer",!0),a.dispatch(d)}a1.keydown=(a,b)=>{if((a.input.shiftKey=16==b.keyCode||b.shiftKey,!bc(a,b))&&(a.input.lastKeyCode=b.keyCode,a.input.lastKeyCodeTime=Date.now(),!I||!C||13!=b.keyCode))if(229!=b.keyCode&&a.domObserver.forceFlush(),!F||13!=b.keyCode||b.ctrlKey||b.altKey||b.metaKey)a.someProp("handleKeyDown",c=>c(a,b))||function(a,b){let c,d=b.keyCode,e=(c="",b.ctrlKey&&(c+="c"),b.metaKey&&(c+="m"),b.altKey&&(c+="a"),b.shiftKey&&(c+="s"),c);if(8==d||G&&72==d&&"c"==e)return aQ(a,-1)||aL(a,-1);if(46==d&&!b.shiftKey||G&&68==d&&"c"==e)return aQ(a,1)||aL(a,1);if(13==d||27==d)return!0;if(37==d||G&&66==d&&"c"==e){let b=37==d?"ltr"==aO(a,a.state.selection.from)?-1:1:-1;return aI(a,b,e)||aL(a,b)}if(39==d||G&&70==d&&"c"==e){let b=39==d?"ltr"==aO(a,a.state.selection.from)?1:-1:1;return aI(a,b,e)||aL(a,b)}else if(38==d||G&&80==d&&"c"==e)return aP(a,-1,e)||aL(a,-1);else if(40==d||G&&78==d&&"c"==e)return function(a){if(!E||a.state.selection.$head.parentOffset>0)return!1;let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(b&&1==b.nodeType&&0==c&&b.firstChild&&"false"==b.firstChild.contentEditable){let c=b.firstChild;aR(a,c,"true"),setTimeout(()=>aR(a,c,"false"),20)}return!1}(a)||aP(a,1,e)||aL(a,1);else if(e==(G?"m":"c")&&(66==d||73==d||89==d||90==d))return!0;return!1}(a,b)?b.preventDefault():a4(a,"key");else{let b=Date.now();a.input.lastIOSEnter=b,a.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{a.input.lastIOSEnter==b&&(a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))),a.input.lastIOSEnter=0)},200)}},a1.keyup=(a,b)=>{16==b.keyCode&&(a.input.shiftKey=!1)},a1.keypress=(a,b)=>{if(bc(a,b)||!b.charCode||b.ctrlKey&&!b.altKey||G&&b.metaKey)return;if(a.someProp("handleKeyPress",c=>c(a,b)))return void b.preventDefault();let c=a.state.selection;if(!(c instanceof d.U3)||!c.$from.sameParent(c.$to)){let d=String.fromCharCode(b.charCode),e=()=>a.state.tr.insertText(d).scrollIntoView();/[\r\n]/.test(d)||a.someProp("handleTextInput",b=>b(a,c.$from.pos,c.$to.pos,d,e))||a.dispatch(e()),b.preventDefault()}};let ba=G?"metaKey":"ctrlKey";a0.mousedown=(a,b)=>{a.input.shiftKey=b.shiftKey;let c=bg(a),e=Date.now(),f="singleClick";e-a.input.lastClick.time<500&&function(a,b){let c=b.x-a.clientX,d=b.y-a.clientY;return c*c+d*d<100}(b,a.input.lastClick)&&!b[ba]&&a.input.lastClick.button==b.button&&("singleClick"==a.input.lastClick.type?f="doubleClick":"doubleClick"==a.input.lastClick.type&&(f="tripleClick")),a.input.lastClick={time:e,x:b.clientX,y:b.clientY,type:f,button:b.button};let g=a.posAtCoords(a7(b));g&&("singleClick"==f?(a.input.mouseDown&&a.input.mouseDown.done(),a.input.mouseDown=new bb(a,g,b,!!c)):("doubleClick"==f?function(a,b,c,d){return a8(a,"handleDoubleClickOn",b,c,d)||a.someProp("handleDoubleClick",c=>c(a,b,d))}:function(a,b,c,e){return a8(a,"handleTripleClickOn",b,c,e)||a.someProp("handleTripleClick",c=>c(a,b,e))||function(a,b,c){if(0!=c.button)return!1;let e=a.state.doc;if(-1==b)return!!e.inlineContent&&(a9(a,d.U3.create(e,0,e.content.size),"pointer"),!0);let f=e.resolve(b);for(let b=f.depth+1;b>0;b--){let c=b>f.depth?f.nodeAfter:f.node(b),g=f.before(b);if(c.inlineContent)a9(a,d.U3.create(e,g+1,g+1+c.content.size),"pointer");else{if(!d.nh.isSelectable(c))continue;a9(a,d.nh.create(e,g),"pointer")}return!0}}(a,c,e)})(a,g.pos,g.inside,b)?b.preventDefault():a4(a,"pointer"))};class bb{constructor(a,b,c,e){let f,g;if(this.view=a,this.pos=b,this.event=c,this.flushed=e,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=a.state.doc,this.selectNode=!!c[ba],this.allowDefault=c.shiftKey,b.inside>-1)f=a.state.doc.nodeAt(b.inside),g=b.inside;else{let c=a.state.doc.resolve(b.pos);f=c.parent,g=c.depth?c.before():0}let h=e?null:c.target,i=h?a.docView.nearestDesc(h,!0):null;this.target=i&&1==i.nodeDOM.nodeType?i.nodeDOM:null;let{selection:j}=a.state;(0==c.button&&f.type.spec.draggable&&!1!==f.type.spec.selectable||j instanceof d.nh&&j.from<=g&&j.to>g)&&(this.mightDrag={node:f,pos:g,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&A&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),a.root.addEventListener("mouseup",this.up=this.up.bind(this)),a.root.addEventListener("mousemove",this.move=this.move.bind(this)),a4(a,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>aw(this.view)),this.view.input.mouseDown=null}up(a){if(this.done(),!this.view.dom.contains(a.target))return;let b=this.pos;if(this.view.state.doc!=this.startDoc&&(b=this.view.posAtCoords(a7(a))),this.updateAllowDefault(a),this.allowDefault||!b)a4(this.view,"pointer");else{var c,e,f,g;(c=this.view,e=b.pos,f=b.inside,g=this.selectNode,a8(c,"handleClickOn",e,f,a)||c.someProp("handleClick",b=>b(c,e,a))||(g?function(a,b){if(-1==b)return!1;let c=a.state.selection,e,f;c instanceof d.nh&&(e=c.node);let g=a.state.doc.resolve(b);for(let a=g.depth+1;a>0;a--){let b=a>g.depth?g.nodeAfter:g.node(a);if(d.nh.isSelectable(b)){f=e&&c.$from.depth>0&&a>=c.$from.depth&&g.before(c.$from.depth+1)==c.$from.pos?g.before(c.$from.depth):g.before(a);break}}return null!=f&&(a9(a,d.nh.create(a.state.doc,f),"pointer"),!0)}(c,f):function(a,b){if(-1==b)return!1;let c=a.state.doc.resolve(b),e=c.nodeAfter;return!!(e&&e.isAtom&&d.nh.isSelectable(e))&&(a9(a,new d.nh(c),"pointer"),!0)}(c,f)))?a.preventDefault():0==a.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||C&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(b.pos-this.view.state.selection.from),Math.abs(b.pos-this.view.state.selection.to)))?(a9(this.view,d.LN.near(this.view.state.doc.resolve(b.pos)),"pointer"),a.preventDefault()):a4(this.view,"pointer")}}move(a){this.updateAllowDefault(a),a4(this.view,"pointer"),0==a.buttons&&this.done()}updateAllowDefault(a){!this.allowDefault&&(Math.abs(this.event.x-a.clientX)>4||Math.abs(this.event.y-a.clientY)>4)&&(this.allowDefault=!0)}}function bc(a,b){return!!a.composing||!!(E&&500>Math.abs(b.timeStamp-a.input.compositionEndedAt))&&(a.input.compositionEndedAt=-2e8,!0)}a0.touchstart=a=>{a.input.lastTouch=Date.now(),bg(a),a4(a,"pointer")},a0.touchmove=a=>{a.input.lastTouch=Date.now(),a4(a,"pointer")},a0.contextmenu=a=>bg(a);let bd=I?5e3:-1;function be(a,b){clearTimeout(a.input.composingTimeout),b>-1&&(a.input.composingTimeout=setTimeout(()=>bg(a),b))}function bf(a){let b;for(a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=((b=document.createEvent("Event")).initEvent("event",!0,!0),b.timeStamp));a.input.compositionNodes.length>0;)a.input.compositionNodes.pop().markParentsDirty()}function bg(a,b=!1){if(!I||!(a.domObserver.flushingSoon>=0)){if(a.domObserver.forceFlush(),bf(a),b||a.docView&&a.docView.dirty){let c=au(a),d=a.state.selection;return c&&!c.eq(d)?a.dispatch(a.state.tr.setSelection(c)):(a.markCursor||b)&&!d.$from.node(d.$from.sharedDepth(d.to)).inlineContent?a.dispatch(a.state.tr.deleteSelection()):a.updateState(a.state),!0}return!1}}a1.compositionstart=a1.compositionupdate=a=>{if(!a.composing){a.domObserver.flush();let{state:b}=a,c=b.selection.$to;if(b.selection instanceof d.U3&&(b.storedMarks||!c.textOffset&&c.parentOffset&&c.nodeBefore.marks.some(a=>!1===a.type.spec.inclusive)||C&&H&&function(a){let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(!b||1!=b.nodeType||c>=b.childNodes.length)return!1;let d=b.childNodes[c];return 1==d.nodeType&&"false"==d.contentEditable}(a)))a.markCursor=a.state.storedMarks||c.marks(),bg(a,!0),a.markCursor=null;else if(bg(a,!b.selection.empty),A&&b.selection.empty&&c.parentOffset&&!c.textOffset&&c.nodeBefore.marks.length){let b=a.domSelectionRange();for(let c=b.focusNode,d=b.focusOffset;c&&1==c.nodeType&&0!=d;){let b=d<0?c.lastChild:c.childNodes[d-1];if(!b)break;if(3==b.nodeType){let c=a.domSelection();c&&c.collapse(b,b.nodeValue.length);break}c=b,d=-1}}a.input.composing=!0}be(a,bd)},a1.compositionend=(a,b)=>{a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=b.timeStamp,a.input.compositionPendingChanges=a.domObserver.pendingRecords().length?a.input.compositionID:0,a.input.compositionNode=null,a.input.badSafariComposition?a.domObserver.forceFlush():a.input.compositionPendingChanges&&Promise.resolve().then(()=>a.domObserver.flush()),a.input.compositionID++,be(a,20))};let bh=y&&z<15||F&&K<604;function bi(a,b,c,d,f){let g=aT(a,b,c,d,a.state.selection.$from);if(a.someProp("handlePaste",b=>b(a,f,g||e.Ji.empty)))return!0;if(!g)return!1;let h=0==g.openStart&&0==g.openEnd&&1==g.content.childCount?g.content.firstChild:null,i=h?a.state.tr.replaceSelectionWith(h,d):a.state.tr.replaceSelection(g);return a.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bj(a){let b=a.getData("text/plain")||a.getData("Text");if(b)return b;let c=a.getData("text/uri-list");return c?c.replace(/\r?\n/g," "):""}a0.copy=a1.cut=(a,b)=>{let c=a.state.selection,d="cut"==b.type;if(c.empty)return;let e=bh?null:b.clipboardData,{dom:f,text:g}=aS(a,c.content());e?(b.preventDefault(),e.clearData(),e.setData("text/html",f.innerHTML),e.setData("text/plain",g)):function(a,b){if(!a.dom.parentNode)return;let c=a.dom.parentNode.appendChild(document.createElement("div"));c.appendChild(b),c.style.cssText="position: fixed; left: -10000px; top: 10px";let d=getSelection(),e=document.createRange();e.selectNodeContents(b),a.dom.blur(),d.removeAllRanges(),d.addRange(e),setTimeout(()=>{c.parentNode&&c.parentNode.removeChild(c),a.focus()},50)}(a,f),d&&a.dispatch(a.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},a1.paste=(a,b)=>{if(a.composing&&!I)return;let c=bh?null:b.clipboardData,d=a.input.shiftKey&&45!=a.input.lastKeyCode;c&&bi(a,bj(c),c.getData("text/html"),d,b)?b.preventDefault():function(a,b){if(!a.dom.parentNode)return;let c=a.input.shiftKey||a.state.selection.$from.parent.type.spec.code,d=a.dom.parentNode.appendChild(document.createElement(c?"textarea":"div"));c||(d.contentEditable="true"),d.style.cssText="position: fixed; left: -10000px; top: 10px",d.focus();let e=a.input.shiftKey&&45!=a.input.lastKeyCode;setTimeout(()=>{a.focus(),d.parentNode&&d.parentNode.removeChild(d),c?bi(a,d.value,null,e,b):bi(a,d.textContent,d.innerHTML,e,b)},50)}(a,b)};class bk{constructor(a,b,c){this.slice=a,this.move=b,this.node=c}}let bl=G?"altKey":"ctrlKey";function bm(a,b){let c=a.someProp("dragCopies",a=>!a(b));return null!=c?c:!b[bl]}for(let a in a0.dragstart=(a,b)=>{let c,e=a.input.mouseDown;if(e&&e.done(),!b.dataTransfer)return;let f=a.state.selection,g=f.empty?null:a.posAtCoords(a7(b));if(g&&g.pos>=f.from&&g.pos<=(f instanceof d.nh?f.to-1:f.to));else if(e&&e.mightDrag)c=d.nh.create(a.state.doc,e.mightDrag.pos);else if(b.target&&1==b.target.nodeType){let e=a.docView.nearestDesc(b.target,!0);e&&e.node.type.spec.draggable&&e!=a.docView&&(c=d.nh.create(a.state.doc,e.posBefore))}let h=(c||a.state.selection).content(),{dom:i,text:j,slice:k}=aS(a,h);b.dataTransfer.files.length&&C&&!(D>120)||b.dataTransfer.clearData(),b.dataTransfer.setData(bh?"Text":"text/html",i.innerHTML),b.dataTransfer.effectAllowed="copyMove",bh||b.dataTransfer.setData("text/plain",j),a.dragging=new bk(k,bm(a,b),c)},a0.dragend=a=>{let b=a.dragging;window.setTimeout(()=>{a.dragging==b&&(a.dragging=null)},50)},a1.dragover=a1.dragenter=(a,b)=>b.preventDefault(),a1.drop=(a,b)=>{try{!function(a,b,c){if(!b.dataTransfer)return;let g=a.posAtCoords(a7(b));if(!g)return;let h=a.state.doc.resolve(g.pos),i=c&&c.slice;i?a.someProp("transformPasted",b=>{i=b(i,a,!1)}):i=aT(a,bj(b.dataTransfer),bh?null:b.dataTransfer.getData("text/html"),!1,h);let j=!!(c&&bm(a,b));if(a.someProp("handleDrop",c=>c(a,b,i||e.Ji.empty,j)))return b.preventDefault();if(!i)return;b.preventDefault();let k=i?(0,f.Um)(a.state.doc,h.pos,i):h.pos;null==k&&(k=h.pos);let l=a.state.tr;if(j){let{node:a}=c;a?a.replace(l):l.deleteSelection()}let m=l.mapping.map(k),n=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,o=l.doc;if(n?l.replaceRangeWith(m,m,i.content.firstChild):l.replaceRange(m,m,i),l.doc.eq(o))return;let p=l.doc.resolve(m);if(n&&d.nh.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new d.nh(p));else{let b=l.mapping.map(k);l.mapping.maps[l.mapping.maps.length-1].forEach((a,c,d,e)=>b=e),l.setSelection(aD(a,p,l.doc.resolve(b)))}a.focus(),a.dispatch(l.setMeta("uiEvent","drop"))}(a,b,a.dragging)}finally{a.dragging=null}},a0.focus=a=>{a.input.lastFocus=Date.now(),a.focused||(a.domObserver.stop(),a.dom.classList.add("ProseMirror-focused"),a.domObserver.start(),a.focused=!0,setTimeout(()=>{a.docView&&a.hasFocus()&&!a.domObserver.currentSelection.eq(a.domSelectionRange())&&aw(a)},20))},a0.blur=(a,b)=>{a.focused&&(a.domObserver.stop(),a.dom.classList.remove("ProseMirror-focused"),a.domObserver.start(),b.relatedTarget&&a.dom.contains(b.relatedTarget)&&a.domObserver.currentSelection.clear(),a.focused=!1)},a0.beforeinput=(a,b)=>{if(C&&I&&"deleteContentBackward"==b.inputType){a.domObserver.flushSoon();let{domChangeCount:b}=a.input;setTimeout(()=>{if(a.input.domChangeCount!=b||(a.dom.blur(),a.focus(),a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))))return;let{$cursor:c}=a.state.selection;c&&c.pos>0&&a.dispatch(a.state.tr.delete(c.pos-1,c.pos).scrollIntoView())},50)}},a1)a0[a]=a1[a];function bn(a,b){if(a==b)return!0;for(let c in a)if(a[c]!==b[c])return!1;for(let c in b)if(!(c in a))return!1;return!0}class bo{constructor(a,b){this.toDOM=a,this.spec=b||bt,this.side=this.spec.side||0}map(a,b,c,d){let{pos:e,deleted:f}=a.mapResult(b.from+d,this.side<0?-1:1);return f?null:new br(e-c,e-c,this)}valid(){return!0}eq(a){return this==a||a instanceof bo&&(this.spec.key&&this.spec.key==a.spec.key||this.toDOM==a.toDOM&&bn(this.spec,a.spec))}destroy(a){this.spec.destroy&&this.spec.destroy(a)}}class bp{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.map(b.from+d,this.spec.inclusiveStart?-1:1)-c,f=a.map(b.to+d,this.spec.inclusiveEnd?1:-1)-c;return e>=f?null:new br(e,f,this)}valid(a,b){return b.from<b.to}eq(a){return this==a||a instanceof bp&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}static is(a){return a.type instanceof bp}destroy(){}}class bq{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.mapResult(b.from+d,1);if(e.deleted)return null;let f=a.mapResult(b.to+d,-1);return f.deleted||f.pos<=e.pos?null:new br(e.pos-c,f.pos-c,this)}valid(a,b){let{index:c,offset:d}=a.content.findIndex(b.from),e;return d==b.from&&!(e=a.child(c)).isText&&d+e.nodeSize==b.to}eq(a){return this==a||a instanceof bq&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}destroy(){}}class br{constructor(a,b,c){this.from=a,this.to=b,this.type=c}copy(a,b){return new br(a,b,this.type)}eq(a,b=0){return this.type.eq(a.type)&&this.from+b==a.from&&this.to+b==a.to}map(a,b,c){return this.type.map(a,this,b,c)}static widget(a,b,c){return new br(a,a,new bo(b,c))}static inline(a,b,c,d){return new br(a,b,new bp(c,d))}static node(a,b,c,d){return new br(a,b,new bq(c,d))}get spec(){return this.type.spec}get inline(){return this.type instanceof bp}get widget(){return this.type instanceof bo}}let bs=[],bt={};class bu{constructor(a,b){this.local=a.length?a:bs,this.children=b.length?b:bs}static create(a,b){return b.length?bA(b,a,0,bt):bv}find(a,b,c){let d=[];return this.findInner(null==a?0:a,null==b?1e9:b,d,0,c),d}findInner(a,b,c,d,e){for(let f=0;f<this.local.length;f++){let g=this.local[f];g.from<=b&&g.to>=a&&(!e||e(g.spec))&&c.push(g.copy(g.from+d,g.to+d))}for(let f=0;f<this.children.length;f+=3)if(this.children[f]<b&&this.children[f+1]>a){let g=this.children[f]+1;this.children[f+2].findInner(a-g,b-g,c,d+g,e)}}map(a,b,c){return this==bv||0==a.maps.length?this:this.mapInner(a,b,0,0,c||bt)}mapInner(a,b,c,d,e){let f;for(let g=0;g<this.local.length;g++){let h=this.local[g].map(a,c,d);h&&h.type.valid(b,h)?(f||(f=[])).push(h):e.onRemove&&e.onRemove(this.local[g].spec)}return this.children.length?function(a,b,c,d,e,f,g){let h=a.slice();for(let a=0,b=f;a<c.maps.length;a++){let d=0;c.maps[a].forEach((a,c,e,f)=>{let g=f-e-(c-a);for(let e=0;e<h.length;e+=3){let f=h[e+1];if(f<0||a>f+b-d)continue;let i=h[e]+b-d;c>=i?h[e+1]=a<=i?-2:-1:a>=b&&g&&(h[e]+=g,h[e+1]+=g)}d+=g}),b=c.maps[a].map(b,-1)}let i=!1;for(let b=0;b<h.length;b+=3)if(h[b+1]<0){if(-2==h[b+1]){i=!0,h[b+1]=-1;continue}let j=c.map(a[b]+f),k=j-e;if(k<0||k>=d.content.size){i=!0;continue}let l=c.map(a[b+1]+f,-1)-e,{index:m,offset:n}=d.content.findIndex(k),o=d.maybeChild(m);if(o&&n==k&&n+o.nodeSize==l){let d=h[b+2].mapInner(c,o,j+1,a[b]+f+1,g);d!=bv?(h[b]=k,h[b+1]=l,h[b+2]=d):(h[b+1]=-2,i=!0)}else i=!0}if(i){let i=bA(function(a,b,c,d,e,f,g){for(let h=0;h<a.length;h+=3)-1==a[h+1]&&function a(b,f){for(let a=0;a<b.local.length;a++){let h=b.local[a].map(d,e,f);h?c.push(h):g.onRemove&&g.onRemove(b.local[a].spec)}for(let c=0;c<b.children.length;c+=3)a(b.children[c+2],b.children[c]+f+1)}(a[h+2],b[h]+f+1);return c}(h,a,b,c,e,f,g),d,0,g);b=i.local;for(let a=0;a<h.length;a+=3)h[a+1]<0&&(h.splice(a,3),a-=3);for(let a=0,b=0;a<i.children.length;a+=3){let c=i.children[a];for(;b<h.length&&h[b]<c;)b+=3;h.splice(b,0,i.children[a],i.children[a+1],i.children[a+2])}}return new bu(b.sort(bB),h)}(this.children,f||[],a,b,c,d,e):f?new bu(f.sort(bB),bs):bv}add(a,b){return b.length?this==bv?bu.create(a,b):this.addInner(a,b,0):this}addInner(a,b,c){let d,e=0;a.forEach((a,f)=>{let g=f+c,h;if(h=by(b,a,g)){for(d||(d=this.children.slice());e<d.length&&d[e]<f;)e+=3;d[e]==f?d[e+2]=d[e+2].addInner(a,h,g+1):d.splice(e,0,f,f+a.nodeSize,bA(h,a,g+1,bt)),e+=3}});let f=bx(e?bz(b):b,-c);for(let b=0;b<f.length;b++)f[b].type.valid(a,f[b])||f.splice(b--,1);return new bu(f.length?this.local.concat(f).sort(bB):this.local,d||this.children)}remove(a){return 0==a.length||this==bv?this:this.removeInner(a,0)}removeInner(a,b){let c=this.children,d=this.local;for(let d=0;d<c.length;d+=3){let e,f=c[d]+b,g=c[d+1]+b;for(let b=0,c;b<a.length;b++)(c=a[b])&&c.from>f&&c.to<g&&(a[b]=null,(e||(e=[])).push(c));if(!e)continue;c==this.children&&(c=this.children.slice());let h=c[d+2].removeInner(e,f+1);h!=bv?c[d+2]=h:(c.splice(d,3),d-=3)}if(d.length){for(let c=0,e;c<a.length;c++)if(e=a[c])for(let a=0;a<d.length;a++)d[a].eq(e,b)&&(d==this.local&&(d=this.local.slice()),d.splice(a--,1))}return c==this.children&&d==this.local?this:d.length||c.length?new bu(d,c):bv}forChild(a,b){let c,d;if(this==bv)return this;if(b.isLeaf)return bu.empty;for(let b=0;b<this.children.length;b+=3)if(this.children[b]>=a){this.children[b]==a&&(c=this.children[b+2]);break}let e=a+1,f=e+b.content.size;for(let a=0;a<this.local.length;a++){let b=this.local[a];if(b.from<f&&b.to>e&&b.type instanceof bp){let a=Math.max(e,b.from)-e,c=Math.min(f,b.to)-e;a<c&&(d||(d=[])).push(b.copy(a,c))}}if(d){let a=new bu(d.sort(bB),bs);return c?new bw([a,c]):a}return c||bv}eq(a){if(this==a)return!0;if(!(a instanceof bu)||this.local.length!=a.local.length||this.children.length!=a.children.length)return!1;for(let b=0;b<this.local.length;b++)if(!this.local[b].eq(a.local[b]))return!1;for(let b=0;b<this.children.length;b+=3)if(this.children[b]!=a.children[b]||this.children[b+1]!=a.children[b+1]||!this.children[b+2].eq(a.children[b+2]))return!1;return!0}locals(a){return bC(this.localsInner(a))}localsInner(a){if(this==bv)return bs;if(a.inlineContent||!this.local.some(bp.is))return this.local;let b=[];for(let a=0;a<this.local.length;a++)this.local[a].type instanceof bp||b.push(this.local[a]);return b}forEachSet(a){a(this)}}bu.empty=new bu([],[]),bu.removeOverlap=bC;let bv=bu.empty;class bw{constructor(a){this.members=a}map(a,b){let c=this.members.map(c=>c.map(a,b,bt));return bw.from(c)}forChild(a,b){if(b.isLeaf)return bu.empty;let c=[];for(let d=0;d<this.members.length;d++){let e=this.members[d].forChild(a,b);e!=bv&&(e instanceof bw?c=c.concat(e.members):c.push(e))}return bw.from(c)}eq(a){if(!(a instanceof bw)||a.members.length!=this.members.length)return!1;for(let b=0;b<this.members.length;b++)if(!this.members[b].eq(a.members[b]))return!1;return!0}locals(a){let b,c=!0;for(let d=0;d<this.members.length;d++){let e=this.members[d].localsInner(a);if(e.length)if(b){c&&(b=b.slice(),c=!1);for(let a=0;a<e.length;a++)b.push(e[a])}else b=e}return b?bC(c?b:b.sort(bB)):bs}static from(a){switch(a.length){case 0:return bv;case 1:return a[0];default:return new bw(a.every(a=>a instanceof bu)?a:a.reduce((a,b)=>a.concat(b instanceof bu?b:b.members),[]))}}forEachSet(a){for(let b=0;b<this.members.length;b++)this.members[b].forEachSet(a)}}function bx(a,b){if(!b||!a.length)return a;let c=[];for(let d=0;d<a.length;d++){let e=a[d];c.push(new br(e.from+b,e.to+b,e.type))}return c}function by(a,b,c){if(b.isLeaf)return null;let d=c+b.nodeSize,e=null;for(let b=0,f;b<a.length;b++)(f=a[b])&&f.from>c&&f.to<d&&((e||(e=[])).push(f),a[b]=null);return e}function bz(a){let b=[];for(let c=0;c<a.length;c++)null!=a[c]&&b.push(a[c]);return b}function bA(a,b,c,d){let e=[],f=!1;b.forEach((b,g)=>{let h=by(a,b,g+c);if(h){f=!0;let a=bA(h,b,c+g+1,d);a!=bv&&e.push(g,g+b.nodeSize,a)}});let g=bx(f?bz(a):a,-c).sort(bB);for(let a=0;a<g.length;a++)g[a].type.valid(b,g[a])||(d.onRemove&&d.onRemove(g[a].spec),g.splice(a--,1));return g.length||e.length?new bu(g,e):bv}function bB(a,b){return a.from-b.from||a.to-b.to}function bC(a){let b=a;for(let c=0;c<b.length-1;c++){let d=b[c];if(d.from!=d.to)for(let e=c+1;e<b.length;e++){let f=b[e];if(f.from==d.from){f.to!=d.to&&(b==a&&(b=a.slice()),b[e]=f.copy(f.from,d.to),bD(b,e+1,f.copy(d.to,f.to)));continue}f.from<d.to&&(b==a&&(b=a.slice()),b[c]=d.copy(d.from,f.from),bD(b,e,d.copy(f.from,d.to)));break}}return b}function bD(a,b,c){for(;b<a.length&&bB(c,a[b])>0;)b++;a.splice(b,0,c)}function bE(a){let b=[];return a.someProp("decorations",c=>{let d=c(a.state);d&&d!=bv&&b.push(d)}),a.cursorWrapper&&b.push(bu.create(a.state.doc,[a.cursorWrapper.deco])),bw.from(b)}let bF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bG=y&&z<=11;class bH{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(a){this.anchorNode=a.anchorNode,this.anchorOffset=a.anchorOffset,this.focusNode=a.focusNode,this.focusOffset=a.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(a){return a.anchorNode==this.anchorNode&&a.anchorOffset==this.anchorOffset&&a.focusNode==this.focusNode&&a.focusOffset==this.focusOffset}}class bI{constructor(a,b){this.view=a,this.handleDOMChange=b,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bH,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(b=>{for(let a=0;a<b.length;a++)this.queue.push(b[a]);y&&z<=11&&b.some(a=>"childList"==a.type&&a.removedNodes.length||"characterData"==a.type&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():E&&a.composing&&b.some(a=>"childList"==a.type&&"TR"==a.target.nodeName)?(a.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bG&&(this.onCharData=a=>{this.queue.push({target:a.target,type:"characterData",oldValue:a.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let a=this.observer.takeRecords();if(a.length){for(let b=0;b<a.length;b++)this.queue.push(a[b]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(aE(this.view)){if(this.suppressingSelectionUpdates)return aw(this.view);if(y&&z<=11&&!this.view.state.selection.empty){let a=this.view.domSelectionRange();if(a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(a){if(!a.focusNode)return!0;let b=new Set,c;for(let c=a.focusNode;c;c=h(c))b.add(c);for(let d=a.anchorNode;d;d=h(d))if(b.has(d)){c=d;break}let d=c&&this.view.docView.nearestDesc(c);if(d&&d.ignoreMutation({type:"selection",target:3==c.nodeType?c.parentNode:c}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let a of this.observer.takeRecords())this.queue.push(a);return this.queue}flush(){var a;let{view:b}=this;if(!b.docView||this.flushingSoon>-1)return;let c=this.pendingRecords();c.length&&(this.queue=[]);let e=b.domSelectionRange(),f=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&aE(b)&&!this.ignoreSelectionChange(e),g=-1,h=-1,i=!1,j=[];if(b.editable)for(let a=0;a<c.length;a++){let b=this.registerMutation(c[a],j);b&&(g=g<0?b.from:Math.min(b.from,g),h=h<0?b.to:Math.max(b.to,h),b.typeOver&&(i=!0))}if(j.some(a=>"BR"==a.nodeName)&&(8==b.input.lastKeyCode||46==b.input.lastKeyCode)){for(let a of j)if("BR"==a.nodeName&&a.parentNode){let b=a.nextSibling;b&&1==b.nodeType&&"false"==b.contentEditable&&a.parentNode.removeChild(a)}}else if(A&&j.length){let a=j.filter(a=>"BR"==a.nodeName);if(2==a.length){let[b,c]=a;b.parentNode&&b.parentNode.parentNode==c.parentNode?c.remove():b.remove()}else{let{focusNode:c}=this.currentSelection;for(let d of a){let a=d.parentNode;a&&"LI"==a.nodeName&&(!c||function(a,b){for(let c=b.parentNode;c&&c!=a.dom;c=c.parentNode){let b=a.docView.nearestDesc(c,!0);if(b&&b.node.isBlock)return c}return null}(b,c)!=a)&&d.remove()}}}let k=null;g<0&&f&&b.input.lastFocus>Date.now()-200&&Math.max(b.input.lastTouch,b.input.lastClick.time)<Date.now()-300&&q(e)&&(k=au(b))&&k.eq(d.LN.near(b.state.doc.resolve(0),1))?(b.input.lastFocus=0,aw(b),this.currentSelection.set(e),b.scrollToSelection()):(g>-1||f)&&(g>-1&&(b.docView.markDirty(g,h),a=b,!bJ.has(a)&&(bJ.set(a,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(a.dom).whiteSpace))&&(a.requiresGeckoHackNode=A,bK||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),bK=!0))),b.input.badSafariComposition&&(b.input.badSafariComposition=!1,function(a,b){var c;let{focusNode:d,focusOffset:e}=a.domSelectionRange();for(let f of b)if((null==(c=f.parentNode)?void 0:c.nodeName)=="TR"){let b=f.nextSibling;for(;b&&"TD"!=b.nodeName&&"TH"!=b.nodeName;)b=b.nextSibling;if(b){let c=b;for(;;){let a=c.firstChild;if(!a||1!=a.nodeType||"false"==a.contentEditable||/^(BR|IMG)$/.test(a.nodeName))break;c=a}c.insertBefore(f,c.firstChild),d==f&&a.domSelection().collapse(f,e)}else f.parentNode.removeChild(f)}}(b,j)),this.handleDOMChange(g,h,i,j),b.docView&&b.docView.dirty?b.updateState(b.state):this.currentSelection.eq(e)||aw(b),this.currentSelection.set(e))}registerMutation(a,b){if(b.indexOf(a.target)>-1)return null;let c=this.view.docView.nearestDesc(a.target);if("attributes"==a.type&&(c==this.view.docView||"contenteditable"==a.attributeName||"style"==a.attributeName&&!a.oldValue&&!a.target.getAttribute("style"))||!c||c.ignoreMutation(a))return null;if("childList"==a.type){for(let c=0;c<a.addedNodes.length;c++){let d=a.addedNodes[c];b.push(d),3==d.nodeType&&(this.lastChangedTextNode=d)}if(c.contentDOM&&c.contentDOM!=c.dom&&!c.contentDOM.contains(a.target))return{from:c.posBefore,to:c.posAfter};let d=a.previousSibling,e=a.nextSibling;if(y&&z<=11&&a.addedNodes.length)for(let b=0;b<a.addedNodes.length;b++){let{previousSibling:c,nextSibling:f}=a.addedNodes[b];(!c||0>Array.prototype.indexOf.call(a.addedNodes,c))&&(d=c),(!f||0>Array.prototype.indexOf.call(a.addedNodes,f))&&(e=f)}let f=d&&d.parentNode==a.target?g(d)+1:0,h=c.localPosFromDOM(a.target,f,-1),i=e&&e.parentNode==a.target?g(e):a.target.childNodes.length;return{from:h,to:c.localPosFromDOM(a.target,i,1)}}return"attributes"==a.type?{from:c.posAtStart-c.border,to:c.posAtEnd+c.border}:(this.lastChangedTextNode=a.target,{from:c.posAtStart,to:c.posAtEnd,typeOver:a.target.nodeValue==a.oldValue})}}let bJ=new WeakMap,bK=!1;function bL(a,b){let c=b.startContainer,d=b.startOffset,e=b.endContainer,f=b.endOffset,g=a.domAtPos(a.state.selection.anchor);return l(g.node,g.offset,e,f)&&([c,d,e,f]=[e,f,c,d]),{anchorNode:c,anchorOffset:d,focusNode:e,focusOffset:f}}function bM(a){let b=a.pmViewDesc;if(b)return b.parseRule();if("BR"==a.nodeName&&a.parentNode){if(E&&/^(ul|ol)$/i.test(a.parentNode.nodeName)){let a=document.createElement("div");return a.appendChild(document.createElement("li")),{skip:a}}else if(a.parentNode.lastChild==a||E&&/^(tr|table)$/i.test(a.parentNode.nodeName))return{ignore:!0}}else if("IMG"==a.nodeName&&a.getAttribute("mark-placeholder"))return{ignore:!0};return null}let bN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function bO(a,b,c){return Math.max(c.anchor,c.head)>b.content.size?null:aD(a,b.resolve(c.anchor),b.resolve(c.head))}function bP(a,b,c){let d=a.depth,e=b?a.end():a.pos;for(;d>0&&(b||a.indexAfter(d)==a.node(d).childCount);)d--,e++,b=!1;if(c){let b=a.node(d).maybeChild(a.indexAfter(d));for(;b&&!b.isLeaf;)b=b.firstChild,e++}return e}function bQ(a){if(2!=a.length)return!1;let b=a.charCodeAt(0),c=a.charCodeAt(1);return b>=56320&&b<=57343&&c>=55296&&c<=56319}class bR{constructor(a,b){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new a3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=b,this.state=b.state,this.directPlugins=b.plugins||[],this.directPlugins.forEach(bW),this.dispatch=this.dispatch.bind(this),this.dom=a&&a.mount||document.createElement("div"),a&&(a.appendChild?a.appendChild(this.dom):"function"==typeof a?a(this.dom):a.mount&&(this.mounted=!0)),this.editable=bU(this),bT(this),this.nodeViews=bV(this),this.docView=ag(this.state.doc,bS(this),bE(this),this.dom,this),this.domObserver=new bI(this,(a,b,c,f)=>(function(a,b,c,f,g){let h,i,j,k=a.input.compositionPendingChanges||(a.composing?a.input.compositionID:0);if(a.input.compositionPendingChanges=0,b<0){let b=a.input.lastSelectionTime>Date.now()-50?a.input.lastSelectionOrigin:null,c=au(a,b);if(c&&!a.state.selection.eq(c)){if(C&&I&&13===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))))return;let d=a.state.tr.setSelection(c);"pointer"==b?d.setMeta("pointer",!0):"key"==b&&d.scrollIntoView(),k&&d.setMeta("composition",k),a.dispatch(d)}return}let l=a.state.doc.resolve(b),m=l.sharedDepth(c);b=l.before(m+1),c=a.state.doc.resolve(c).after(m+1);let n=a.state.selection,o=function(a,b,c){let d,{node:f,fromOffset:g,toOffset:h,from:i,to:j}=a.docView.parseRange(b,c),k=a.domSelectionRange(),l=k.anchorNode;if(l&&a.dom.contains(1==l.nodeType?l:l.parentNode)&&(d=[{node:l,offset:k.anchorOffset}],q(k)||d.push({node:k.focusNode,offset:k.focusOffset})),C&&8===a.input.lastKeyCode)for(let a=h;a>g;a--){let b=f.childNodes[a-1],c=b.pmViewDesc;if("BR"==b.nodeName&&!c){h=a;break}if(!c||c.size)break}let m=a.state.doc,n=a.someProp("domParser")||e.S4.fromSchema(a.state.schema),o=m.resolve(i),p=null,r=n.parse(f,{topNode:o.parent,topMatch:o.parent.contentMatchAt(o.index()),topOpen:!0,from:g,to:h,preserveWhitespace:"pre"!=o.parent.type.whitespace||"full",findPositions:d,ruleFromNode:bM,context:o});if(d&&null!=d[0].pos){let a=d[0].pos,b=d[1]&&d[1].pos;null==b&&(b=a),p={anchor:a+i,head:b+i}}return{doc:r,sel:p,from:i,to:j}}(a,b,c),p=a.state.doc,s=p.slice(o.from,o.to);8===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime?(h=a.state.selection.to,i="end"):(h=a.state.selection.from,i="start"),a.input.lastKeyCode=null;let t=function(a,b,c,d,e){let f=a.findDiffStart(b,c);if(null==f)return null;let{a:g,b:h}=a.findDiffEnd(b,c+a.size,c+b.size);if("end"==e){let a=Math.max(0,f-Math.min(g,h));d-=g+a-f}if(g<f&&a.size<b.size){let a=d<=f&&d>=g?f-d:0;(f-=a)&&f<b.size&&bQ(b.textBetween(f-1,f+1))&&(f+=a?1:-1),h=f+(h-g),g=f}else if(h<f){let b=d<=f&&d>=h?f-d:0;(f-=b)&&f<a.size&&bQ(a.textBetween(f-1,f+1))&&(f+=b?1:-1),g=f+(g-h),h=f}return{start:f,endA:g,endB:h}}(s.content,o.doc.content,o.from,h,i);if(t&&a.input.domChangeCount++,(F&&a.input.lastIOSEnter>Date.now()-225||I)&&g.some(a=>1==a.nodeType&&!bN.test(a.nodeName))&&(!t||t.endA>=t.endB)&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(!t)if(f&&n instanceof d.U3&&!n.empty&&n.$head.sameParent(n.$anchor)&&!a.composing&&!(o.sel&&o.sel.anchor!=o.sel.head))t={start:n.from,endA:n.to,endB:n.to};else{if(o.sel){let b=bO(a,a.state.doc,o.sel);if(b&&!b.eq(a.state.selection)){let c=a.state.tr.setSelection(b);k&&c.setMeta("composition",k),a.dispatch(c)}}return}a.state.selection.from<a.state.selection.to&&t.start==t.endB&&a.state.selection instanceof d.U3&&(t.start>a.state.selection.from&&t.start<=a.state.selection.from+2&&a.state.selection.from>=o.from?t.start=a.state.selection.from:t.endA<a.state.selection.to&&t.endA>=a.state.selection.to-2&&a.state.selection.to<=o.to&&(t.endB+=a.state.selection.to-t.endA,t.endA=a.state.selection.to)),y&&z<=11&&t.endB==t.start+1&&t.endA==t.start&&t.start>o.from&&" \xa0"==o.doc.textBetween(t.start-o.from-1,t.start-o.from+1)&&(t.start--,t.endA--,t.endB--);let u=o.doc.resolveNoCache(t.start-o.from),v=o.doc.resolveNoCache(t.endB-o.from),w=p.resolve(t.start),x=u.sameParent(v)&&u.parent.inlineContent&&w.end()>=t.endA;if((F&&a.input.lastIOSEnter>Date.now()-225&&(!x||g.some(a=>"DIV"==a.nodeName||"P"==a.nodeName))||!x&&u.pos<o.doc.content.size&&(!u.sameParent(v)||!u.parent.inlineContent)&&u.pos<v.pos&&!/\S/.test(o.doc.textBetween(u.pos,v.pos,"","")))&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(a.state.selection.anchor>t.start&&function(a,b,c,d,e){if(c-b<=e.pos-d.pos||bP(d,!0,!1)<e.pos)return!1;let f=a.resolve(b);if(!d.parent.isTextblock){let a=f.nodeAfter;return null!=a&&c==b+a.nodeSize}if(f.parentOffset<f.parent.content.size||!f.parent.isTextblock)return!1;let g=a.resolve(bP(f,!0,!0));return!(!g.parent.isTextblock||g.pos>c||bP(g,!0,!1)<c)&&d.parent.content.cut(d.parentOffset).eq(g.parent.content)}(p,t.start,t.endA,u,v)&&a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))){I&&C&&a.domObserver.suppressSelectionUpdates();return}C&&t.endB==t.start&&(a.input.lastChromeDelete=Date.now()),I&&!x&&u.start()!=v.start()&&0==v.parentOffset&&u.depth==v.depth&&o.sel&&o.sel.anchor==o.sel.head&&o.sel.head==t.endA&&(t.endB-=2,v=o.doc.resolveNoCache(t.endB-o.from),setTimeout(()=>{a.someProp("handleKeyDown",function(b){return b(a,r(13,"Enter"))})},20));let A=t.start,B=t.endA,D=b=>{let c=b||a.state.tr.replace(A,B,o.doc.slice(t.start-o.from,t.endB-o.from));if(o.sel){let b=bO(a,c.doc,o.sel);b&&!(C&&a.composing&&b.empty&&(t.start!=t.endB||a.input.lastChromeDelete<Date.now()-100)&&(b.head==A||b.head==c.mapping.map(B)-1)||y&&b.empty&&b.head==A)&&c.setSelection(b)}return k&&c.setMeta("composition",k),c.scrollIntoView()};if(x)if(u.pos==v.pos){y&&z<=11&&0==u.parentOffset&&(a.domObserver.suppressSelectionUpdates(),setTimeout(()=>aw(a),20));let b=D(a.state.tr.delete(A,B)),c=p.resolve(t.start).marksAcross(p.resolve(t.endA));c&&b.ensureMarks(c),a.dispatch(b)}else if(t.endA==t.endB&&(j=function(a,b){let c=a.firstChild.marks,d=b.firstChild.marks,f=c,g=d,h,i,j;for(let a=0;a<d.length;a++)f=d[a].removeFromSet(f);for(let a=0;a<c.length;a++)g=c[a].removeFromSet(g);if(1==f.length&&0==g.length)i=f[0],h="add",j=a=>a.mark(i.addToSet(a.marks));else{if(0!=f.length||1!=g.length)return null;i=g[0],h="remove",j=a=>a.mark(i.removeFromSet(a.marks))}let k=[];for(let a=0;a<b.childCount;a++)k.push(j(b.child(a)));if(e.FK.from(k).eq(a))return{mark:i,type:h}}(u.parent.content.cut(u.parentOffset,v.parentOffset),w.parent.content.cut(w.parentOffset,t.endA-w.start())))){let b=D(a.state.tr);"add"==j.type?b.addMark(A,B,j.mark):b.removeMark(A,B,j.mark),a.dispatch(b)}else if(u.parent.child(u.index()).isText&&u.index()==v.index()-!v.textOffset){let b=u.parent.textBetween(u.parentOffset,v.parentOffset),c=()=>D(a.state.tr.insertText(b,A,B));a.someProp("handleTextInput",d=>d(a,A,B,b,c))||a.dispatch(c())}else a.dispatch(D());else a.dispatch(D())})(this,a,b,c,f)),this.domObserver.start(),function(a){for(let b in a0){let c=a0[b];a.dom.addEventListener(b,a.input.eventHandlers[b]=b=>{!function(a,b){if(!b.bubbles)return!0;if(b.defaultPrevented)return!1;for(let c=b.target;c!=a.dom;c=c.parentNode)if(!c||11==c.nodeType||c.pmViewDesc&&c.pmViewDesc.stopEvent(b))return!1;return!0}(a,b)||a6(a,b)||!a.editable&&b.type in a1||c(a,b)},a2[b]?{passive:!0}:void 0)}E&&a.dom.addEventListener("input",()=>null),a5(a)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let a=this._props;for(let b in this._props={},a)this._props[b]=a[b];this._props.state=this.state}return this._props}update(a){a.handleDOMEvents!=this._props.handleDOMEvents&&a5(this);let b=this._props;this._props=a,a.plugins&&(a.plugins.forEach(bW),this.directPlugins=a.plugins),this.updateStateInner(a.state,b)}setProps(a){let b={};for(let a in this._props)b[a]=this._props[a];for(let c in b.state=this.state,a)b[c]=a[c];this.update(b)}updateState(a){this.updateStateInner(a,this._props)}updateStateInner(a,b){var c,d,e;let f=this.state,h=!1,i=!1;a.storedMarks&&this.composing&&(bf(this),i=!0),this.state=a;let j=f.plugins!=a.plugins||this._props.plugins!=b.plugins;if(j||this._props.plugins!=b.plugins||this._props.nodeViews!=b.nodeViews){let a=bV(this);(function(a,b){let c=0,d=0;for(let d in a){if(a[d]!=b[d])return!0;c++}for(let a in b)d++;return c!=d})(a,this.nodeViews)&&(this.nodeViews=a,h=!0)}(j||b.handleDOMEvents!=this._props.handleDOMEvents)&&a5(this),this.editable=bU(this),bT(this);let k=bE(this),m=bS(this),n=f.plugins==a.plugins||f.doc.eq(a.doc)?a.scrollToSelection>f.scrollToSelection?"to selection":"preserve":"reset",q=h||!this.docView.matchesNode(a.doc,m,k);(q||!a.selection.eq(f.selection))&&(i=!0);let r="preserve"==n&&i&&null==this.dom.style.overflowAnchor&&function(a){let b,c,d=a.dom.getBoundingClientRect(),e=Math.max(0,d.top);for(let f=(d.left+d.right)/2,g=e+1;g<Math.min(innerHeight,d.bottom);g+=5){let d=a.root.elementFromPoint(f,g);if(!d||d==a.dom||!a.dom.contains(d))continue;let h=d.getBoundingClientRect();if(h.top>=e-20){b=d,c=h.top;break}}return{refDOM:b,refTop:c,stack:N(a.dom)}}(this);if(i){let b,c,i;this.domObserver.stop();let j=q&&(y||C)&&!this.composing&&!f.selection.empty&&!a.selection.empty&&(d=f.selection,e=a.selection,i=Math.min(d.$anchor.sharedDepth(d.head),e.$anchor.sharedDepth(e.head)),d.$anchor.start(i)!=e.$anchor.start(i));if(q){let b=C?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(a){let b=a.domSelectionRange();if(!b.focusNode)return null;let c=function(a,b){for(;;){if(3==a.nodeType&&b)return a;if(1==a.nodeType&&b>0){if("false"==a.contentEditable)return null;b=o(a=a.childNodes[b-1])}else{if(!a.parentNode||p(a))return null;b=g(a),a=a.parentNode}}}(b.focusNode,b.focusOffset),d=function(a,b){for(;;){if(3==a.nodeType&&b<a.nodeValue.length)return a;if(1==a.nodeType&&b<a.childNodes.length){if("false"==a.contentEditable)return null;a=a.childNodes[b],b=0}else{if(!a.parentNode||p(a))return null;b=g(a)+1,a=a.parentNode}}}(b.focusNode,b.focusOffset);if(c&&d&&c!=d){let b=d.pmViewDesc,e=a.domObserver.lastChangedTextNode;if(c==e||d==e)return e;if(!b||!b.isText(d.nodeValue))return d;if(a.input.compositionNode==d){let a=c.pmViewDesc;if(!(!a||!a.isText(c.nodeValue)))return d}}return c||d}(this)),(h||!this.docView.update(a.doc,m,k,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=ag(a.doc,m,k,this.dom,this)),!b||this.trackWrites&&this.dom.contains(this.trackWrites)||(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(b=this.docView.domFromPos(this.state.selection.anchor,0),c=this.domSelectionRange(),l(b.node,b.offset,c.anchorNode,c.anchorOffset)))?aw(this,j):(aB(this,a.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(f),(null==(c=this.dragging)?void 0:c.node)&&!f.doc.eq(a.doc)&&this.updateDraggedNode(this.dragging,f),"reset"==n?this.dom.scrollTop=0:"to selection"==n?this.scrollToSelection():r&&function({refDOM:a,refTop:b,stack:c}){let d=a?a.getBoundingClientRect().top:0;O(c,0==d?0:d-b)}(r)}scrollToSelection(){let a=this.domSelectionRange().focusNode;if(a&&this.dom.contains(1==a.nodeType?a:a.parentNode))if(this.someProp("handleScrollToSelection",a=>a(this)));else if(this.state.selection instanceof d.nh){let b=this.docView.domAfterPos(this.state.selection.from);1==b.nodeType&&M(this,b.getBoundingClientRect(),a)}else M(this,this.coordsAtPos(this.state.selection.head,1),a)}destroyPluginViews(){let a;for(;a=this.pluginViews.pop();)a.destroy&&a.destroy()}updatePluginViews(a){if(a&&a.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let b=0;b<this.pluginViews.length;b++){let c=this.pluginViews[b];c.update&&c.update(this,a)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let a=0;a<this.directPlugins.length;a++){let b=this.directPlugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}for(let a=0;a<this.state.plugins.length;a++){let b=this.state.plugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}}}updateDraggedNode(a,b){let c=a.node,e=-1;if(this.state.doc.nodeAt(c.from)==c.node)e=c.from;else{let a=c.from+(this.state.doc.content.size-b.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==c.node&&(e=a)}this.dragging=new bk(a.slice,a.move,e<0?void 0:d.nh.create(this.state.doc,e))}someProp(a,b){let c=this._props&&this._props[a],d;if(null!=c&&(d=b?b(c):c))return d;for(let c=0;c<this.directPlugins.length;c++){let e=this.directPlugins[c].props[a];if(null!=e&&(d=b?b(e):e))return d}let e=this.state.plugins;if(e)for(let c=0;c<e.length;c++){let f=e[c].props[a];if(null!=f&&(d=b?b(f):f))return d}}hasFocus(){if(y){let a=this.root.activeElement;if(a==this.dom)return!0;if(!a||!this.dom.contains(a))return!1;for(;a&&this.dom!=a&&this.dom.contains(a);){if("false"==a.contentEditable)return!1;a=a.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(a){if(a.setActive)return a.setActive();if(P)return a.focus(P);let b=N(a);a.focus(null==P?{get preventScroll(){return P={preventScroll:!0},!0}}:void 0),P||(P=!1,O(b,0))}(this.dom),aw(this),this.domObserver.start()}get root(){let a=this._root;if(null==a){for(let a=this.dom.parentNode;a;a=a.parentNode)if(9==a.nodeType||11==a.nodeType&&a.host)return a.getSelection||(Object.getPrototypeOf(a).getSelection=()=>a.ownerDocument.getSelection()),this._root=a}return a||document}updateRoot(){this._root=null}posAtCoords(a){return function(a,b){var c;let d,e,f=a.dom.ownerDocument,g,i=0,k=function(a,b,c){if(a.caretPositionFromPoint)try{let d=a.caretPositionFromPoint(b,c);if(d)return{node:d.offsetNode,offset:Math.min(o(d.offsetNode),d.offset)}}catch(a){}if(a.caretRangeFromPoint){let d=a.caretRangeFromPoint(b,c);if(d)return{node:d.startContainer,offset:Math.min(o(d.startContainer),d.startOffset)}}}(f,b.left,b.top);k&&({node:g,offset:i}=k);let l=(a.root.elementFromPoint?a.root:f).elementFromPoint(b.left,b.top);if(!l||!a.dom.contains(1!=l.nodeType?l.parentNode:l)){let c=a.dom.getBoundingClientRect();if(!Q(b,c)||!(l=function a(b,c,d){let e=b.childNodes.length;if(e&&d.top<d.bottom)for(let f=Math.max(0,Math.min(e-1,Math.floor(e*(c.top-d.top)/(d.bottom-d.top))-2)),g=f;;){let d=b.childNodes[g];if(1==d.nodeType){let b=d.getClientRects();for(let e=0;e<b.length;e++){let f=b[e];if(Q(c,f))return a(d,c,f)}}if((g=(g+1)%e)==f)break}return b}(a.dom,b,c)))return null}if(E)for(let a=l;g&&a;a=h(a))a.draggable&&(g=void 0);if(l=(d=(c=l).parentNode)&&/^li$/i.test(d.nodeName)&&b.left<c.getBoundingClientRect().left?d:c,g){let c;if(A&&1==g.nodeType&&(i=Math.min(i,g.childNodes.length))<g.childNodes.length){let a=g.childNodes[i],c;"IMG"==a.nodeName&&(c=a.getBoundingClientRect()).right<=b.left&&c.bottom>b.top&&i++}J&&i&&1==g.nodeType&&1==(c=g.childNodes[i-1]).nodeType&&"false"==c.contentEditable&&c.getBoundingClientRect().top>=b.top&&i--,g==a.dom&&i==g.childNodes.length-1&&1==g.lastChild.nodeType&&b.top>g.lastChild.getBoundingClientRect().bottom?e=a.state.doc.content.size:(0==i||1!=g.nodeType||"BR"!=g.childNodes[i-1].nodeName)&&(e=function(a,b,c,d){let e=-1;for(let c=b,f=!1;c!=a.dom;){let b=a.docView.nearestDesc(c,!0),g;if(!b)return null;if(1==b.dom.nodeType&&(b.node.isBlock&&b.parent||!b.contentDOM)&&((g=b.dom.getBoundingClientRect()).width||g.height)&&(b.node.isBlock&&b.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(b.dom.nodeName)&&(!f&&g.left>d.left||g.top>d.top?e=b.posBefore:(!f&&g.right<d.left||g.bottom<d.top)&&(e=b.posAfter),f=!0),!b.contentDOM&&e<0&&!b.node.isText))return(b.node.isBlock?d.top<(g.top+g.bottom)/2:d.left<(g.left+g.right)/2)?b.posBefore:b.posAfter;c=b.dom.parentNode}return e>-1?e:a.docView.posFromDOM(b,c,-1)}(a,g,i,b))}null==e&&(e=function(a,b,c){let{node:d,offset:e}=function a(b,c){let d,e,f,g=2e8,h,i=0,k=c.top,l=c.top;for(let a=b.firstChild,m=0;a;a=a.nextSibling,m++){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a).getClientRects()}for(let j=0;j<b.length;j++){let n=b[j];if(n.top<=k&&n.bottom>=l){k=Math.max(n.bottom,k),l=Math.min(n.top,l);let b=n.left>c.left?n.left-c.left:n.right<c.left?c.left-n.right:0;if(b<g){f=a,g=b,h=b&&3==f.nodeType?{left:n.right<c.left?n.right:n.left,top:c.top}:c,1==a.nodeType&&b&&(i=m+ +(c.left>=(n.left+n.right)/2));continue}}else n.top>c.top&&!d&&n.left<=c.left&&n.right>=c.left&&(d=a,e={left:Math.max(n.left,Math.min(n.right,c.left)),top:n.top});!f&&(c.left>=n.right&&c.top>=n.top||c.left>=n.left&&c.top>=n.bottom)&&(i=m+1)}}return(!f&&d&&(f=d,h=e,g=0),f&&3==f.nodeType)?function(a,b){let c=a.nodeValue.length,d=document.createRange(),e;for(let f=0;f<c;f++){d.setEnd(a,f+1),d.setStart(a,f);let c=S(d,1);if(c.top!=c.bottom&&Q(b,c)){e={node:a,offset:f+ +(b.left>=(c.left+c.right)/2)};break}}return d.detach(),e||{node:a,offset:0}}(f,h):!f||g&&1==f.nodeType?{node:b,offset:i}:a(f,h)}(b,c),f=-1;if(1==d.nodeType&&!d.firstChild){let a=d.getBoundingClientRect();f=a.left!=a.right&&c.left>(a.left+a.right)/2?1:-1}return a.docView.posFromDOM(d,e,f)}(a,l,b));let m=a.docView.nearestDesc(l,!0);return{pos:e,inside:m?m.posAtStart-m.border:-1}}(this,a)}coordsAtPos(a,b=1){return U(this,a,b)}domAtPos(a,b=0){return this.docView.domFromPos(a,b)}nodeDOM(a){let b=this.docView.descAt(a);return b?b.nodeDOM:null}posAtDOM(a,b,c=-1){let d=this.docView.posFromDOM(a,b,c);if(null==d)throw RangeError("DOM position not inside the editor");return d}endOfTextblock(a,b){return function(a,b,c){let d,e;return Z==b&&_==c?aa:(Z=b,_=c,aa="up"==c||"down"==c?(d=b.selection,e="up"==c?d.$from:d.$to,X(a,b,()=>{let{node:b}=a.docView.domFromPos(e.pos,"up"==c?-1:1);for(;;){let c=a.docView.nearestDesc(b,!0);if(!c)break;if(c.node.isBlock){b=c.contentDOM||c.dom;break}b=c.dom.parentNode}let d=U(a,e.pos,1);for(let a=b.firstChild;a;a=a.nextSibling){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a,0,a.nodeValue.length).getClientRects()}for(let a=0;a<b.length;a++){let e=b[a];if(e.bottom>e.top+1&&("up"==c?d.top-e.top>(e.bottom-d.top)*2:e.bottom-d.bottom>(d.bottom-e.top)*2))return!1}}return!0})):function(a,b,c){let{$head:d}=b.selection;if(!d.parent.isTextblock)return!1;let e=d.parentOffset,f=e==d.parent.content.size,g=a.domSelection();return g?Y.test(d.parent.textContent)&&g.modify?X(a,b,()=>{let{focusNode:b,focusOffset:e,anchorNode:f,anchorOffset:h}=a.domSelectionRange(),i=g.caretBidiLevel;g.modify("move",c,"character");let j=d.depth?a.docView.domAfterPos(d.before()):a.dom,{focusNode:k,focusOffset:l}=a.domSelectionRange(),m=k&&!j.contains(1==k.nodeType?k:k.parentNode)||b==k&&e==l;try{g.collapse(f,h),b&&(b!=f||e!=h)&&g.extend&&g.extend(b,e)}catch(a){}return null!=i&&(g.caretBidiLevel=i),m}):"left"==c||"backward"==c?!e:f:d.pos==d.start()||d.pos==d.end()}(a,b,c))}(this,b||this.state,a)}pasteHTML(a,b){return bi(this,"",a,!1,b||new ClipboardEvent("paste"))}pasteText(a,b){return bi(this,a,null,!0,b||new ClipboardEvent("paste"))}serializeForClipboard(a){return aS(this,a)}destroy(){if(this.docView){for(let a in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(a,this.input.eventHandlers[a]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,k()}}get isDestroyed(){return null==this.docView}dispatchEvent(a){!a6(this,a)&&a0[a.type]&&(this.editable||!(a.type in a1))&&a0[a.type](this,a)}domSelectionRange(){let a=this.domSelection();return a?E&&11===this.root.nodeType&&function(a){let b=a.activeElement;for(;b&&b.shadowRoot;)b=b.shadowRoot.activeElement;return b}(this.dom.ownerDocument)==this.dom&&function(a,b){let c;if(b.getComposedRanges){let c=b.getComposedRanges(a.root)[0];if(c)return bL(a,c)}function d(a){a.preventDefault(),a.stopImmediatePropagation(),c=a.getTargetRanges()[0]}return a.dom.addEventListener("beforeinput",d,!0),document.execCommand("indent"),a.dom.removeEventListener("beforeinput",d,!0),c?bL(a,c):null}(this,a)||a:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function bS(a){let b=Object.create(null);return b.class="ProseMirror",b.contenteditable=String(a.editable),a.someProp("attributes",c=>{if("function"==typeof c&&(c=c(a.state)),c)for(let a in c)"class"==a?b.class+=" "+c[a]:"style"==a?b.style=(b.style?b.style+";":"")+c[a]:b[a]||"contenteditable"==a||"nodeName"==a||(b[a]=String(c[a]))}),b.translate||(b.translate="no"),[br.node(0,a.state.doc.content.size,b)]}function bT(a){if(a.markCursor){let b=document.createElement("img");b.className="ProseMirror-separator",b.setAttribute("mark-placeholder","true"),b.setAttribute("alt",""),a.cursorWrapper={dom:b,deco:br.widget(a.state.selection.from,b,{raw:!0,marks:a.markCursor})}}else a.cursorWrapper=null}function bU(a){return!a.someProp("editable",b=>!1===b(a.state))}function bV(a){let b=Object.create(null);function c(a){for(let c in a)Object.prototype.hasOwnProperty.call(b,c)||(b[c]=a[c])}return a.someProp("nodeViews",c),a.someProp("markViews",c),b}function bW(a){if(a.spec.state||a.spec.filterTransaction||a.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}bR.prototype.dispatch=function(a){let b=this._props.dispatchTransaction;b?b.call(this,a):this.updateState(this.state.apply(a))}},670016:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(789253);b.property=function(a){return function(b){return d.get(b,a)}}},673977:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(356103).Or},676029:(a,b,c)=>{"use strict";c.d(b,{q:()=>Y});var d=c(115962);function e(a){return Array.isArray?Array.isArray(a):"[object Array]"===l(a)}let f=1/0;function g(a){return"string"==typeof a}function h(a){return"number"==typeof a}function i(a){return"object"==typeof a}function j(a){return null!=a}function k(a){return!a.trim().length}function l(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":Object.prototype.toString.call(a)}let m=Object.prototype.hasOwnProperty;class n{constructor(a){this._keys=[],this._keyMap={};let b=0;a.forEach(a=>{let c=o(a);this._keys.push(c),this._keyMap[c.id]=c,b+=c.weight}),this._keys.forEach(a=>{a.weight/=b})}get(a){return this._keyMap[a]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function o(a){let b=null,c=null,d=null,f=1,h=null;if(g(a)||e(a))d=a,b=p(a),c=q(a);else{if(!m.call(a,"name"))throw Error("Missing name property in key");let e=a.name;if(d=e,m.call(a,"weight")&&(f=a.weight)<=0)throw Error(`Property 'weight' in key '${e}' must be a positive integer`);b=p(e),c=q(e),h=a.getFn}return{path:b,id:c,weight:f,src:d,getFn:h}}function p(a){return e(a)?a:a.split(".")}function q(a){return e(a)?a.join("."):a}var r={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(a,b)=>a.score===b.score?a.idx<b.idx?-1:1:a.score<b.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(a,b){let c=[],d=!1,k=(a,b,m)=>{if(j(a))if(b[m]){var n,o;let p=a[b[m]];if(!j(p))return;if(m===b.length-1&&(g(p)||h(p)||!0===(n=p)||!1===n||i(o=n)&&null!==o&&"[object Boolean]"==l(n)))c.push(null==p?"":function(a){if("string"==typeof a)return a;let b=a+"";return"0"==b&&1/a==-f?"-0":b}(p));else if(e(p)){d=!0;for(let a=0,c=p.length;a<c;a+=1)k(p[a],b,m+1)}else b.length&&k(p,b,m+1)}else c.push(a)};return k(a,g(b)?b.split("."):b,0),d?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};let s=/[^ ]+/g;class t{constructor({getFn:a=r.getFn,fieldNormWeight:b=r.fieldNormWeight}={}){this.norm=function(a=1,b=3){let c=new Map,d=Math.pow(10,b);return{get(b){let e=b.match(s).length;if(c.has(e))return c.get(e);let f=parseFloat(Math.round(1/Math.pow(e,.5*a)*d)/d);return c.set(e,f),f},clear(){c.clear()}}}(b,3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}setSources(a=[]){this.docs=a}setIndexRecords(a=[]){this.records=a}setKeys(a=[]){this.keys=a,this._keysMap={},a.forEach((a,b)=>{this._keysMap[a.id]=b})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((a,b)=>{this._addString(a,b)}):this.docs.forEach((a,b)=>{this._addObject(a,b)}),this.norm.clear())}add(a){let b=this.size();g(a)?this._addString(a,b):this._addObject(a,b)}removeAt(a){this.records.splice(a,1);for(let b=a,c=this.size();b<c;b+=1)this.records[b].i-=1}getValueForItemAtKeyId(a,b){return a[this._keysMap[b]]}size(){return this.records.length}_addString(a,b){if(!j(a)||k(a))return;let c={v:a,i:b,n:this.norm.get(a)};this.records.push(c)}_addObject(a,b){let c={i:b,$:{}};this.keys.forEach((b,d)=>{let f=b.getFn?b.getFn(a):this.getFn(a,b.path);if(j(f)){if(e(f)){let a=[],b=[{nestedArrIndex:-1,value:f}];for(;b.length;){let{nestedArrIndex:c,value:d}=b.pop();if(j(d))if(g(d)&&!k(d)){let b={v:d,i:c,n:this.norm.get(d)};a.push(b)}else e(d)&&d.forEach((a,c)=>{b.push({nestedArrIndex:c,value:a})})}c.$[d]=a}else if(g(f)&&!k(f)){let a={v:f,n:this.norm.get(f)};c.$[d]=a}}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function u(a,b,{getFn:c=r.getFn,fieldNormWeight:d=r.fieldNormWeight}={}){let e=new t({getFn:c,fieldNormWeight:d});return e.setKeys(a.map(o)),e.setSources(b),e.create(),e}function v(a,{errors:b=0,currentLocation:c=0,expectedLocation:d=0,distance:e=r.distance,ignoreLocation:f=r.ignoreLocation}={}){let g=b/a.length;if(f)return g;let h=Math.abs(d-c);return e?g+h/e:h?1:g}let w=String.prototype.normalize?a=>a.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):a=>a;class x{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){if(this.options={location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j},a=h?a:a.toLowerCase(),a=i?w(a):a,this.pattern=a,this.chunks=[],!this.pattern.length)return;let k=(a,b)=>{this.chunks.push({pattern:a,alphabet:function(a){let b={};for(let c=0,d=a.length;c<d;c+=1){let e=a.charAt(c);b[e]=(b[e]||0)|1<<d-c-1}return b}(a),startIndex:b})},l=this.pattern.length;if(l>32){let a=0,b=l%32,c=l-b;for(;a<c;)k(this.pattern.substr(a,32),a),a+=32;if(b){let a=l-32;k(this.pattern.substr(a),a)}}else k(this.pattern,0)}searchIn(a){let{isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d}=this.options;if(a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern===a){let b={isMatch:!0,score:0};return d&&(b.indices=[[0,a.length-1]]),b}let{location:e,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,ignoreLocation:j}=this.options,k=[],l=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:c,startIndex:n})=>{let{isMatch:o,score:p,indices:q}=function(a,b,c,{location:d=r.location,distance:e=r.distance,threshold:f=r.threshold,findAllMatches:g=r.findAllMatches,minMatchCharLength:h=r.minMatchCharLength,includeMatches:i=r.includeMatches,ignoreLocation:j=r.ignoreLocation}={}){let k;if(b.length>32)throw Error("Pattern length exceeds max of 32.");let l=b.length,m=a.length,n=Math.max(0,Math.min(d,m)),o=f,p=n,q=h>1||i,s=q?Array(m):[];for(;(k=a.indexOf(b,p))>-1;)if(o=Math.min(v(b,{currentLocation:k,expectedLocation:n,distance:e,ignoreLocation:j}),o),p=k+l,q){let a=0;for(;a<l;)s[k+a]=1,a+=1}p=-1;let t=[],u=1,w=l+m,x=1<<l-1;for(let d=0;d<l;d+=1){let f=0,h=w;for(;f<h;)v(b,{errors:d,currentLocation:n+h,expectedLocation:n,distance:e,ignoreLocation:j})<=o?f=h:w=h,h=Math.floor((w-f)/2+f);w=h;let i=Math.max(1,n-h+1),k=g?m:Math.min(n+h,m)+l,r=Array(k+2);r[k+1]=(1<<d)-1;for(let f=k;f>=i;f-=1){let g=f-1,h=c[a.charAt(g)];if(q&&(s[g]=+!!h),r[f]=(r[f+1]<<1|1)&h,d&&(r[f]|=(t[f+1]|t[f])<<1|1|t[f+1]),r[f]&x&&(u=v(b,{errors:d,currentLocation:g,expectedLocation:n,distance:e,ignoreLocation:j}))<=o){if(o=u,(p=g)<=n)break;i=Math.max(1,2*n-p)}}if(v(b,{errors:d+1,currentLocation:n,expectedLocation:n,distance:e,ignoreLocation:j})>o)break;t=r}let y={isMatch:p>=0,score:Math.max(.001,u)};if(q){let a=function(a=[],b=r.minMatchCharLength){let c=[],d=-1,e=-1,f=0;for(let g=a.length;f<g;f+=1){let g=a[f];g&&-1===d?d=f:g||-1===d||((e=f-1)-d+1>=b&&c.push([d,e]),d=-1)}return a[f-1]&&f-d>=b&&c.push([d,f-1]),c}(s,h);a.length?i&&(y.indices=a):y.isMatch=!1}return y}(a,b,c,{location:e+n,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,includeMatches:d,ignoreLocation:j});o&&(m=!0),l+=p,o&&q&&(k=[...k,...q])});let n={isMatch:m,score:m?l/this.chunks.length:1};return m&&d&&(n.indices=k),n}}class y{constructor(a){this.pattern=a}static isMultiMatch(a){return z(a,this.multiRegex)}static isSingleMatch(a){return z(a,this.singleRegex)}search(){}}function z(a,b){let c=a.match(b);return c?c[1]:null}class A extends y{constructor(a){super(a)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(a){let b=a===this.pattern;return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class B extends y{constructor(a){super(a)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(a){let b=-1===a.indexOf(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class C extends y{constructor(a){super(a)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(a){let b=a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class D extends y{constructor(a){super(a)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(a){let b=!a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class E extends y{constructor(a){super(a)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(a){let b=a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[a.length-this.pattern.length,a.length-1]}}}class F extends y{constructor(a){super(a)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(a){let b=!a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class G extends y{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){super(a),this._bitapSearch=new x(a,{location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(a){return this._bitapSearch.searchIn(a)}}class H extends y{constructor(a){super(a)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(a){let b,c=0,d=[],e=this.pattern.length;for(;(b=a.indexOf(this.pattern,c))>-1;)c=b+e,d.push([b,c-1]);let f=!!d.length;return{isMatch:f,score:+!f,indices:d}}}let I=[A,H,C,D,F,E,B,G],J=I.length,K=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,L=new Set([G.type,H.type]);class M{constructor(a,{isCaseSensitive:b=r.isCaseSensitive,ignoreDiacritics:c=r.ignoreDiacritics,includeMatches:d=r.includeMatches,minMatchCharLength:e=r.minMatchCharLength,ignoreLocation:f=r.ignoreLocation,findAllMatches:g=r.findAllMatches,location:h=r.location,threshold:i=r.threshold,distance:j=r.distance}={}){this.query=null,this.options={isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d,minMatchCharLength:e,findAllMatches:g,ignoreLocation:f,location:h,threshold:i,distance:j},a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern=a,this.query=function(a,b={}){return a.split("|").map(a=>{let c=a.trim().split(K).filter(a=>a&&!!a.trim()),d=[];for(let a=0,e=c.length;a<e;a+=1){let e=c[a],f=!1,g=-1;for(;!f&&++g<J;){let a=I[g],c=a.isMultiMatch(e);c&&(d.push(new a(c,b)),f=!0)}if(!f)for(g=-1;++g<J;){let a=I[g],c=a.isSingleMatch(e);if(c){d.push(new a(c,b));break}}}return d})}(this.pattern,this.options)}static condition(a,b){return b.useExtendedSearch}searchIn(a){let b=this.query;if(!b)return{isMatch:!1,score:1};let{includeMatches:c,isCaseSensitive:d,ignoreDiacritics:e}=this.options;a=d?a:a.toLowerCase(),a=e?w(a):a;let f=0,g=[],h=0;for(let d=0,e=b.length;d<e;d+=1){let e=b[d];g.length=0,f=0;for(let b=0,d=e.length;b<d;b+=1){let d=e[b],{isMatch:i,indices:j,score:k}=d.search(a);if(i){if(f+=1,h+=k,c){let a=d.constructor.type;L.has(a)?g=[...g,...j]:g.push(j)}}else{h=0,f=0,g.length=0;break}}if(f){let a={isMatch:!0,score:h/f};return c&&(a.indices=g),a}}return{isMatch:!1,score:1}}}let N=[];function O(a,b){for(let c=0,d=N.length;c<d;c+=1){let d=N[c];if(d.condition(a,b))return new d(a,b)}return new x(a,b)}let P={AND:"$and",OR:"$or"},Q={PATH:"$path",PATTERN:"$val"},R=a=>!!(a[P.AND]||a[P.OR]),S=a=>({[P.AND]:Object.keys(a).map(b=>({[b]:a[b]}))});function T(a,b,{auto:c=!0}={}){let d=a=>{let f=Object.keys(a),h=!!a[Q.PATH];if(!h&&f.length>1&&!R(a))return d(S(a));if(!e(a)&&i(a)&&!R(a)){let d=h?a[Q.PATH]:f[0],e=h?a[Q.PATTERN]:a[d];if(!g(e))throw Error(`Invalid value for key ${d}`);let i={keyId:q(d),pattern:e};return c&&(i.searcher=O(e,b)),i}let j={children:[],operator:f[0]};return f.forEach(b=>{let c=a[b];e(c)&&c.forEach(a=>{j.children.push(d(a))})}),j};return R(a)||(a=S(a)),d(a)}function U(a,b){let c=a.matches;b.matches=[],j(c)&&c.forEach(a=>{if(!j(a.indices)||!a.indices.length)return;let{indices:c,value:d}=a,e={indices:c,value:d};a.key&&(e.key=a.key.src),a.idx>-1&&(e.refIndex=a.idx),b.matches.push(e)})}function V(a,b){b.score=a.score}class W{constructor(a,b={},c){this.options={...r,...b},this.options.useExtendedSearch,this._keyStore=new n(this.options.keys),this.setCollection(a,c)}setCollection(a,b){if(this._docs=a,b&&!(b instanceof t))throw Error("Incorrect 'index' type");this._myIndex=b||u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(a){j(a)&&(this._docs.push(a),this._myIndex.add(a))}remove(a=()=>!1){let b=[];for(let c=0,d=this._docs.length;c<d;c+=1){let e=this._docs[c];a(e,c)&&(this.removeAt(c),c-=1,d-=1,b.push(e))}return b}removeAt(a){this._docs.splice(a,1),this._myIndex.removeAt(a)}getIndex(){return this._myIndex}search(a,{limit:b=-1}={}){let{includeMatches:c,includeScore:d,shouldSort:e,sortFn:f,ignoreFieldNorm:i}=this.options,j=g(a)?g(this._docs[0])?this._searchStringList(a):this._searchObjectList(a):this._searchLogical(a);return!function(a,{ignoreFieldNorm:b=r.ignoreFieldNorm}){a.forEach(a=>{let c=1;a.matches.forEach(({key:a,norm:d,score:e})=>{let f=a?a.weight:null;c*=Math.pow(0===e&&f?Number.EPSILON:e,(f||1)*(b?1:d))}),a.score=c})}(j,{ignoreFieldNorm:i}),e&&j.sort(f),h(b)&&b>-1&&(j=j.slice(0,b)),function(a,b,{includeMatches:c=r.includeMatches,includeScore:d=r.includeScore}={}){let e=[];return c&&e.push(U),d&&e.push(V),a.map(a=>{let{idx:c}=a,d={item:b[c],refIndex:c};return e.length&&e.forEach(b=>{b(a,d)}),d})}(j,this._docs,{includeMatches:c,includeScore:d})}_searchStringList(a){let b=O(a,this.options),{records:c}=this._myIndex,d=[];return c.forEach(({v:a,i:c,n:e})=>{if(!j(a))return;let{isMatch:f,score:g,indices:h}=b.searchIn(a);f&&d.push({item:a,idx:c,matches:[{score:g,value:a,norm:e,indices:h}]})}),d}_searchLogical(a){let b=T(a,this.options),c=(a,b,d)=>{if(!a.children){let{keyId:c,searcher:e}=a,f=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(b,c),searcher:e});return f&&f.length?[{idx:d,item:b,matches:f}]:[]}let e=[];for(let f=0,g=a.children.length;f<g;f+=1){let g=c(a.children[f],b,d);if(g.length)e.push(...g);else if(a.operator===P.AND)return[]}return e},d=this._myIndex.records,e={},f=[];return d.forEach(({$:a,i:d})=>{if(j(a)){let g=c(b,a,d);g.length&&(e[d]||(e[d]={idx:d,item:a,matches:[]},f.push(e[d])),g.forEach(({matches:a})=>{e[d].matches.push(...a)}))}}),f}_searchObjectList(a){let b=O(a,this.options),{keys:c,records:d}=this._myIndex,e=[];return d.forEach(({$:a,i:d})=>{if(!j(a))return;let f=[];c.forEach((c,d)=>{f.push(...this._findMatches({key:c,value:a[d],searcher:b}))}),f.length&&e.push({idx:d,item:a,matches:f})}),e}_findMatches({key:a,value:b,searcher:c}){if(!j(b))return[];let d=[];if(e(b))b.forEach(({v:b,i:e,n:f})=>{if(!j(b))return;let{isMatch:g,score:h,indices:i}=c.searchIn(b);g&&d.push({score:h,key:a,value:b,idx:e,norm:f,indices:i})});else{let{v:e,n:f}=b,{isMatch:g,score:h,indices:i}=c.searchIn(e);g&&d.push({score:h,key:a,value:e,norm:f,indices:i})}return d}}W.version="7.1.0",W.createIndex=u,W.parseIndex=function(a,{getFn:b=r.getFn,fieldNormWeight:c=r.fieldNormWeight}={}){let{keys:d,records:e}=a,f=new t({getFn:b,fieldNormWeight:c});return f.setKeys(d),f.setIndexRecords(e),f},W.config=r,W.parseQuery=T,function(...a){N.push(...a)}(M);let X={keys:[{name:"label",weight:3},{name:"sublabel",weight:1},{name:"objectName",weight:1.5},{name:"fieldValues",weight:2}],threshold:.4,distance:200,includeScore:!0,shouldSort:!0,minMatchCharLength:1};function Y(a){let[b,c]=(0,d.useState)([]),[e,f]=(0,d.useState)(!0),g=(0,d.useRef)(!0);(0,d.useCallback)(async()=>{try{let a=await fetch("/api/workspace/search-index"),b=await a.json();g.current&&(c(b.items??[]),f(!1))}catch{g.current&&f(!1)}},[]);let h=(0,d.useMemo)(()=>0===b.length?null:new W(b.map(a=>({...a,fieldValues:a.fields?Object.values(a.fields).join(" "):void 0})),X),[b]),i=(0,d.useCallback)((a,c=20)=>a.trim()?h?h.search(a,{limit:c}).map(a=>a.item):[]:[...b].toSorted((a,b)=>{let c={object:0,file:1,entry:2};return(c[a.kind]??9)-(c[b.kind]??9)}).slice(0,c),[h,b]),j=(0,d.useRef)(i);return j.current=i,{items:b,loading:e,search:(0,d.useCallback)((a,b)=>j.current(a,b),[])}}},681560:(a,b,c)=>{"use strict";c.d(b,{I:()=>n});var d=c(736927),e=c(115962),f=c(681713),g=c(612563),h=c(379924),i=c(18886),j=c(130526);function k(a){return null==a?"":"string"==typeof a?a:"number"==typeof a||"boolean"==typeof a||"bigint"==typeof a?String(a):"object"==typeof a?JSON.stringify(a):""}function l({entry:a,fields:b,titleField:c,coverField:l,onEntryClick:m}){let n=k(a.entry_id??a.id),o=function(a,b,c){if(c){let b=k(a[c]);if(b)return b}let d=b.find(a=>"text"===a.type&&/name|title/i.test(a.name))??b.find(a=>"text"===a.type);return d?k(a[d.name]):k(a.id)}(a,b,c),p=(0,j.I)(a,b),q=(0,e.useMemo)(()=>b.filter(a=>a.name!==c&&a.name!==l).slice(0,4),[b,c,l]),r=b.find(a=>"enum"===a.type&&a.enum_values?.length),s=r?k(a[r.name]):null,t=r&&s?function(a,b){if(!a||!b.enum_values)return null;let c=b.enum_values.indexOf(a);return{text:a,color:c>=0&&b.enum_colors?.[c]?b.enum_colors[c]:"#94a3b8"}}(s,r):null;return(0,d.jsxs)("button",{type:"button",onClick:()=>m?.(n),className:"text-left rounded-xl border p-4 hover:shadow-md transition-all cursor-pointer w-full group",style:{borderColor:"var(--color-border)",background:"var(--color-surface)"},children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p?.faviconUrl&&(0,d.jsx)(i.A,{src:p.faviconUrl,className:"w-4 h-4 rounded-[4px] shrink-0 mt-0.5"}),(0,d.jsx)("h4",{className:"text-[13px] font-semibold leading-tight line-clamp-2 group-hover:underline",style:{color:"var(--color-text)"},children:o||"Untitled"})]}),t&&(0,d.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full flex-shrink-0 whitespace-nowrap",style:{backgroundColor:t.color,color:"#fff"},children:t.text})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:q.map(b=>{let c=a[b.name];if(null==c||""===k(c))return null;let e="tags"===b.type?(0,h.k)(c):[];return(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[10px] flex-shrink-0 min-w-[60px]",style:{color:"var(--color-text-muted)"},children:b.name}),(0,d.jsx)("div",{className:"text-[12px] whitespace-pre-line line-clamp-2",style:{color:"var(--color-text)"},children:"tags"===b.type?(0,d.jsxs)("span",{className:"flex items-center gap-0.5 flex-wrap",children:[e.slice(0,3).map(a=>{let b=(0,g.KJ)(a),c="link"===b.kind&&b.href,e="url"===b.linkType&&!!b.faviconUrl;return c?(0,d.jsxs)("a",{href:b.href,target:"url"===b.linkType||"file"===b.linkType?"_blank":void 0,rel:"url"===b.linkType||"file"===b.linkType?"noopener noreferrer":void 0,onClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 px-1.5 py-0 rounded text-[11px] font-medium hover:underline underline-offset-2 max-w-[220px]",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-accent)"},children:[e&&(0,d.jsx)(i.A,{src:b.faviconUrl,className:"w-3 h-3 rounded-[2px] shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:b.text})]},a):(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0 rounded text-[11px] font-medium",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-text-muted)"},children:a},a)}),e.length>3&&(0,d.jsxs)("span",{className:"text-[10px]",style:{color:"var(--color-text-muted)"},children:["+",e.length-3]})]}):(0,d.jsx)(f.E,{value:c,fieldType:b.type,mode:"table",showUrlFavicon:!0})})]},b.id)})}),null!=a.created_at&&(0,d.jsx)("div",{className:"mt-3 text-[10px]",style:{color:"var(--color-text-muted)",opacity:.6},children:k(a.created_at).slice(0,10)})]})}function m(){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-2",children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--color-text-muted)",opacity:.4},children:[(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"})]}),(0,d.jsx)("span",{className:"text-sm",style:{color:"var(--color-text-muted)"},children:"No entries to display in gallery view."})]})}function n({objectName:a,fields:b,entries:c,titleField:e,coverField:f,members:g,relationLabels:h,onEntryClick:i}){return 0===c.length?(0,d.jsx)(m,{}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:c.map(a=>(0,d.jsx)(l,{entry:a,fields:b,titleField:e,coverField:f,onEntryClick:i},k(a.entry_id??a.id)))})}},681713:(a,b,c)=>{"use strict";c.d(b,{E:()=>m});var d=c(736927),e=c(115962),f=c(612563),g=c(18886),h=c(545182),i=c(888973);function j(){return(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:"--"})}function k({mediaType:a,url:b,label:c}){return"image"===a?(0,d.jsx)("div",{className:"mt-2 rounded-lg overflow-hidden border",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("img",{src:b,alt:c,className:"max-h-64 w-auto"})}):"video"===a?(0,d.jsx)("video",{src:b,controls:!0,className:"mt-2 w-full max-h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"#000"}}):"audio"===a?(0,d.jsx)("audio",{src:b,controls:!0,className:"mt-2 w-full"}):(0,d.jsx)("iframe",{src:`${b}#toolbar=0&navpanes=0&scrollbar=1`,title:c,className:"mt-2 w-full h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"white"}})}function l({text:a,fieldType:b,showUrlFavicon:c=!1,linkInteractionMode:e="inline",isTableMode:j=!1}){let k=a.trim();if(!k)return(0,d.jsx)(d.Fragment,{children:a});let l=b&&"text"!==b&&"richtext"!==b?b:void 0,m=(0,f.KJ)(k,l);if("link"===m.kind&&m.href){if(!l&&"file"===m.linkType&&k.includes(" "))return(0,d.jsx)(d.Fragment,{children:m.text});let a="url"===m.linkType||"file"===m.linkType,b=c&&"url"===m.linkType&&!!m.faviconUrl;if("button"===e){let c=(0,d.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",style:{color:"var(--color-accent)"},children:[b&&(0,d.jsx)(g.A,{src:m.faviconUrl}),(0,d.jsx)("span",{className:j?"min-w-0 truncate":"min-w-0 break-all",children:m.text}),(0,d.jsx)(h.x,{href:m.href,openInNewTab:a,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-black/5"})]});return"url"===m.linkType?(0,d.jsx)(i.k,{href:m.href,children:c}):c}return(0,d.jsx)(i.U,{href:m.href,text:m.text,linkType:m.linkType??"url",faviconUrl:m.faviconUrl,showFavicon:b})}return"number"===m.kind||"currency"===m.kind?(0,d.jsx)("span",{className:"tabular-nums",children:m.text}):(0,d.jsx)(d.Fragment,{children:m.text})}function m({value:a,fieldType:b,mode:c="table",className:m,showUrlFavicon:n=!1,linkInteractionMode:o="inline"}){let p=(0,f.KJ)(a,b),q="table"===c;if("empty"===p.kind)return(0,d.jsx)(j,{});let r=p.text.replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n").replace(/\\r/g,"\n");if(r.includes("\n")){let a=r.split("\n"),c=m??(q?"block max-w-[300px] line-clamp-3":"break-words");return(0,d.jsx)("span",{className:c,children:a.map((a,c)=>(0,d.jsxs)(e.Fragment,{children:[c>0&&(0,d.jsx)("br",{}),(0,d.jsx)(l,{text:a,fieldType:b,showUrlFavicon:n,linkInteractionMode:o,isTableMode:q})]},c))})}let s=m??(q?"truncate block max-w-[300px]":"break-words");if("link"===p.kind&&p.href){let a="url"===p.linkType||"file"===p.linkType,b=!q&&!!p.embedUrl&&!!p.mediaType,c=n&&"url"===p.linkType&&!!p.faviconUrl;if("button"===o){let e=(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",style:{color:"var(--color-accent)"},children:[c&&(0,d.jsx)(g.A,{src:p.faviconUrl}),(0,d.jsx)("span",{className:q?"min-w-0 truncate":"min-w-0 break-all",children:p.text}),(0,d.jsx)(h.x,{href:p.href,openInNewTab:a})]}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]});return"url"===p.linkType?(0,d.jsx)(i.k,{href:p.href,children:e}):e}return(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsx)(i.U,{href:p.href,text:p.text,linkType:p.linkType??"url",faviconUrl:p.faviconUrl,showFavicon:c,layout:"block",className:q?"truncate":""}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]})}return"number"===p.kind||"currency"===p.kind?(0,d.jsx)("span",{className:`tabular-nums ${s}`,children:p.text}):(0,d.jsx)("span",{className:s,children:r})}},685233:(a,b,c)=>{"use strict";c.d(b,{X:()=>a6,S:()=>a7});var d=c(736927),e=c(115962),f=c(213505),g=c(492081),h=c(755726),i=c(922123),j=c(478105),k=c(363269),l=c(515016),m=c(558287),n=c(631608),o=c(846069),p=c(744277),q=c(68200),r=c(316780),s=c(398367),t=c(405287),u=c(587464),v=c(173961),w=c(760687),x=c(840512);let y=e.createContext(void 0),z=e.createContext(void 0),A=e.createContext(void 0),B=e.createContext("");function C(){let a=e.useContext(y);if(!a)throw Error((0,x.A)(22));return a}function D(){let a=e.useContext(z);if(!a)throw Error((0,x.A)(23));return a}function E(){let a=e.useContext(A);if(!a)throw Error((0,x.A)(24));return a}var F=c(569869);let G=(a,b)=>Object.is(a,b);function H(a,b,c){return null==a||null==b?Object.is(a,b):c(a,b)}function I(a,b,c){return a&&0!==a.length?a.findIndex(a=>void 0!==a&&H(a,b,c)):-1}function J(a){if(null==a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function K(a){return null!=a&&a.length>0&&"object"==typeof a[0]&&null!=a[0]&&"items"in a[0]}function L(a,b){if(b&&null!=a)return b(a)??"";if(a&&"object"==typeof a){if("label"in a&&null!=a.label)return String(a.label);if("value"in a)return String(a.value)}return J(a)}function M(a,b){return b&&null!=a?b(a)??"":a&&"object"==typeof a&&"value"in a&&"label"in a?J(a.value):J(a)}let N={id:(0,F.M)(a=>a.id),query:(0,F.M)(a=>a.query),items:(0,F.M)(a=>a.items),selectedValue:(0,F.M)(a=>a.selectedValue),hasSelectionChips:(0,F.M)(a=>{let b=a.selectedValue;return Array.isArray(b)&&b.length>0}),hasSelectedValue:(0,F.M)(a=>{let{selectedValue:b,selectionMode:c}=a;return null!=b&&(!("multiple"===c&&Array.isArray(b))||b.length>0)}),hasNullItemLabel:(0,F.M)((a,b)=>!!b&&function(a){if(!Array.isArray(a))return null!=a&&!("null"in a);if(K(a)){for(let b of a)for(let a of b.items)if(a&&null==a.value&&null!=a.label)return!0;return!1}for(let b of a)if(b&&null==b.value&&null!=b.label)return!0;return!1}(a.items)),open:(0,F.M)(a=>a.open),mounted:(0,F.M)(a=>a.mounted),forceMounted:(0,F.M)(a=>a.forceMounted),inline:(0,F.M)(a=>a.inline),activeIndex:(0,F.M)(a=>a.activeIndex),selectedIndex:(0,F.M)(a=>a.selectedIndex),isActive:(0,F.M)((a,b)=>a.activeIndex===b),isSelected:(0,F.M)((a,b)=>{let c=a.isItemEqualToValue,d=a.selectedValue;return Array.isArray(d)?d.some(a=>H(b,a,c)):H(b,d,c)}),transitionStatus:(0,F.M)(a=>a.transitionStatus),popupProps:(0,F.M)(a=>a.popupProps),inputProps:(0,F.M)(a=>a.inputProps),triggerProps:(0,F.M)(a=>a.triggerProps),getItemProps:(0,F.M)(a=>a.getItemProps),positionerElement:(0,F.M)(a=>a.positionerElement),listElement:(0,F.M)(a=>a.listElement),triggerElement:(0,F.M)(a=>a.triggerElement),inputElement:(0,F.M)(a=>a.inputElement),popupSide:(0,F.M)(a=>a.popupSide),openMethod:(0,F.M)(a=>a.openMethod),inputInsidePopup:(0,F.M)(a=>a.inputInsidePopup),selectionMode:(0,F.M)(a=>a.selectionMode),listRef:(0,F.M)(a=>a.listRef),labelsRef:(0,F.M)(a=>a.labelsRef),popupRef:(0,F.M)(a=>a.popupRef),emptyRef:(0,F.M)(a=>a.emptyRef),inputRef:(0,F.M)(a=>a.inputRef),keyboardActiveRef:(0,F.M)(a=>a.keyboardActiveRef),chipsContainerRef:(0,F.M)(a=>a.chipsContainerRef),clearRef:(0,F.M)(a=>a.clearRef),valuesRef:(0,F.M)(a=>a.valuesRef),allValuesRef:(0,F.M)(a=>a.allValuesRef),name:(0,F.M)(a=>a.name),disabled:(0,F.M)(a=>a.disabled),readOnly:(0,F.M)(a=>a.readOnly),required:(0,F.M)(a=>a.required),grid:(0,F.M)(a=>a.grid),isGrouped:(0,F.M)(a=>a.isGrouped),virtualized:(0,F.M)(a=>a.virtualized),onOpenChangeComplete:(0,F.M)(a=>a.onOpenChangeComplete),openOnInputClick:(0,F.M)(a=>a.openOnInputClick),itemToStringLabel:(0,F.M)(a=>a.itemToStringLabel),isItemEqualToValue:(0,F.M)(a=>a.isItemEqualToValue),modal:(0,F.M)(a=>a.modal),autoHighlight:(0,F.M)(a=>a.autoHighlight),submitOnItemClick:(0,F.M)(a=>a.submitOnItemClick)};var O=c(230652),P=c(577225);let Q=function(a){return a.disabled="data-disabled",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a}({}),R=e.createContext({invalid:void 0,name:void 0,validityData:{state:{badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},errors:[],error:"",value:"",initialValue:null},setValidityData:P.tE,disabled:void 0,touched:!1,setTouched:P.tE,dirty:!1,setDirty:P.tE,filled:!1,setFilled:P.tE,focused:!1,setFocused:P.tE,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(a=P.t0)=>a,getInputValidationProps:(a=P.t0)=>a,inputRef:{current:null},commit:async()=>{}}});function S(a=!0){let b=e.useContext(R);if(b.setValidityData===P.tE&&!a)throw Error((0,x.A)(28));return b}var T=c(249855);let U=e.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:P.tE,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function V(){return e.useContext(U)}var W=c(725427),X=c(840507);let Y=e.createContext({controlId:void 0,registerControlId:P.tE,labelId:void 0,setLabelId:P.tE,messageIds:[],setMessageIds:P.tE,getDescriptionProps:a=>a});function Z(){return e.useContext(Y)}let _=new Map;var aa=c(735328),ab=c(192083);function ac(a,b){let c=e.useRef(a),d=(0,i.K)(b);(0,g.g)(()=>{c.current!==a&&d(c.current)},[a,d]),(0,g.g)(()=>{c.current=a},[a])}let ad=Symbol("none"),ae={value:ad,index:-1};function af(a){let b,c,x,{id:C,onOpenChangeComplete:D,defaultSelectedValue:E=null,selectedValue:F,onSelectedValueChange:J,defaultInputValue:Q,inputValue:R,selectionMode:U="none",onItemHighlighted:Y,name:af,disabled:ag=!1,readOnly:ah=!1,required:ai=!1,inputRef:aj,grid:ak=!1,items:al,filteredItems:am,filter:an,openOnInputClick:ao=!0,autoHighlight:ap=!1,keepHighlight:aq=!1,highlightItemOnHover:ar=!0,loopFocus:as=!0,itemToStringLabel:at,itemToStringValue:au,isItemEqualToValue:av=G,virtualized:aw=!1,inline:ax=!1,fillInputOnItemPress:ay=!0,modal:az=!1,limit:aA=-1,autoComplete:aB="list",formAutoComplete:aC,locale:aD,submitOnItemClick:aE=!1}=a,{clearErrors:aF}=V(),{setDirty:aG,validityData:aH,shouldValidateOnChange:aI,setFilled:aJ,name:aK,disabled:aL,setTouched:aM,setFocused:aN,validationMode:aO,validation:aP}=S(),aQ=function(a={}){let{id:b,implicit:c=!1,controlRef:d}=a,{controlId:f,registerControlId:h}=Z(),j=(0,X.e)(b),k=c?f:void 0,m=(0,l.j)(()=>Symbol("labelable-control")),n=e.useRef(!1),o=e.useRef(null!=b),p=(0,i.K)(()=>{n.current&&h!==P.tE&&(n.current=!1,h(m.current,void 0))});return(0,g.g)(()=>{let a;if(h!==P.tE){if(c){let c=d?.current;a=(0,W.vq)(c)&&null!=c.closest("label")?b??null:k??j}else if(null!=b)o.current=!0,a=b;else{if(!o.current)return void p();a=j}if(void 0===a)return void p();n.current=!0,h(m.current,a)}},[b,d,k,h,c,j,m,p]),e.useEffect(()=>p,[p]),f??j}({id:C}),aR=function(a={}){let b={usage:"search",sensitivity:"base",ignorePunctuation:!0,...a},c=`${function a(b){return Array.isArray(b)?b.map(b=>a(b)).join(","):null==b?"":String(b)}(a.locale)}|${JSON.stringify(b)}`,d=_.get(c);if(d)return d;let e=new Intl.Collator(a.locale,b),f={contains(a,b,c){if(!b)return!0;let d=L(a,c);for(let a=0;a<=d.length-b.length;a+=1)if(0===e.compare(d.slice(a,a+b.length),b))return!0;return!1},startsWith(a,b,c){if(!b)return!0;let d=L(a,c);return 0===e.compare(d.slice(0,b.length),b)},endsWith(a,b,c){if(!b)return!0;let d=L(a,c),f=b.length;return d.length>=f&&0===e.compare(d.slice(d.length-f),b)}};return _.set(c,f),f}({locale:aD}),[aS,aT]=e.useState(!1),[aU,aV]=e.useState(null),aW=e.useRef([]),aX=e.useRef([]),aY=e.useRef(null),aZ=e.useRef(null),a$=e.useRef(null),a_=e.useRef(!0),a0=e.useRef(!1),a1=e.useRef(null),a2=e.useRef(null),a3=e.useRef(null),a4=e.useRef(ae),a5=e.useRef(null),a6=e.useRef([]),a7=e.useRef([]),a8=aL||ag,a9=aK??af,ba="multiple"===U,bb="single"===U,bc=void 0!==R||void 0!==Q,bd=void 0!==al,be=void 0!==am;b="always"===ap?"always":!!ap&&"input-change";let[bf,bg]=(0,f.q)({controlled:F,default:ba?E??P.Ml:E,name:"Combobox",state:"selectedValue"}),bh=e.useMemo(()=>null===an?()=>!0:void 0!==an?an:bb&&!aS?(a,b)=>{if(null==a)return!1;if(!b)return!0;let c=L(a,at),d=null!=bf?L(bf,at):"";return!!(d&&aR.contains(d,b))&&d.length===b.length||aR.contains(c,b)}:(a,b)=>{if(null==a)return!1;let c=L(a,at);return aR.contains(c,b)},[an,bb,bf,aS,aR,at]),bi=(0,l.j)(()=>bc?Q??"":bb?L(bf,at):"").current,[bj,bk]=(0,f.q)({controlled:R,default:bi,name:"Combobox",state:"inputValue"}),[bl,bm]=(0,f.q)({controlled:a.open,default:a.defaultOpen,name:"Combobox",state:"open"}),bn=K(al),bo=aU??(""===bj?"":String(bj).trim()),bp=bb?L(bf,at):"",bq=bb&&!aS&&""!==bo&&""!==bp&&bp.length===bo.length&&aR.contains(bp,bo),br=bq?"":bo,bs=bd&&be&&bq,bt=e.useMemo(()=>al?bn?al.flatMap(a=>a.items):al:P.Ml,[al,bn]),bu=e.useMemo(()=>{if(am&&!bs)return am;if(!al)return P.Ml;if(bn){let a=[],b=0;for(let c of al){if(aA>-1&&b>=aA)break;let d=""===br?c.items:c.items.filter(a=>bh(a,br,at));if(0===d.length)continue;let e=aA>-1?aA-b:1/0,f=d.slice(0,e);if(f.length>0){let d={...c,items:f};a.push(d),b+=f.length}}return a}if(""===br)return aA>-1?bt.slice(0,aA):bt;let a=[];for(let b of bt){if(aA>-1&&a.length>=aA)break;bh(b,br,at)&&a.push(b)}return a},[am,bs,al,bn,br,aA,bh,at,bt]),bv=e.useMemo(()=>bn?bu.flatMap(a=>a.items):bu,[bu,bn]),bw=(0,l.j)(()=>new m.i({id:aQ,selectedValue:bf,open:bl,filter:bh,query:bo,items:al,selectionMode:U,listRef:aW,labelsRef:aX,popupRef:aY,emptyRef:a$,inputRef:aZ,keyboardActiveRef:a_,chipsContainerRef:a1,clearRef:a2,valuesRef:a6,allValuesRef:a7,selectionEventRef:a3,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,openOnInputClick:ao,itemToStringLabel:at,isItemEqualToValue:av,modal:az,autoHighlight:b,submitOnItemClick:aE,hasInputValue:bc,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:ax,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:D||P.tE,setOpen:P.tE,setInputValue:P.tE,setSelectedValue:P.tE,setIndices:P.tE,onItemHighlighted:P.tE,handleSelection:P.tE,getItemProps:()=>P.t0,forceMount:P.tE,requestSubmit:P.tE})).current,bx="none"===U?bj:bf,by=e.useMemo(()=>"none"===U?bx:Array.isArray(bf)?bf.map(a=>M(a,au)):M(bf,au),[bx,au,U,bf]),bz=(0,i.K)(Y),bA=(0,i.K)(D),bB=(0,n.P)(bw,N.activeIndex),bC=(0,n.P)(bw,N.selectedIndex),bD=(0,n.P)(bw,N.positionerElement),bE=(0,n.P)(bw,N.listElement),bF=(0,n.P)(bw,N.triggerElement),bG=(0,n.P)(bw,N.inputElement),bH=(0,n.P)(bw,N.inline),bI=(0,n.P)(bw,N.inputInsidePopup),bJ=(0,o.u)(bF),{mounted:bK,setMounted:bL,transitionStatus:bM}=(0,aa.$)(bl),{openMethod:bN,triggerProps:bO,reset:bP}=(0,ab.G)(bl);!function(a){let{enabled:b=!0,value:c,id:d,name:e,controlRef:f,commit:h}=a,{formRef:j}=V(),{invalid:k,markedDirtyRef:l,validityData:m,setValidityData:n}=S(),o=(0,i.K)(a.getValue);(0,g.g)(()=>{if(!b)return;let a=c;void 0===a&&(a=o()),null===m.initialValue&&null!==a&&n(b=>({...b,initialValue:a}))},[b,n,c,m.initialValue,o]),(0,g.g)(()=>{b&&d&&j.current.fields.set(d,{getValue:o,name:e,controlRef:f,validityData:{...m,state:{...m.state,valid:!k&&m.state.valid}},validate(a=!0){let b=c;void 0===b&&(b=o()),l.current=!0,a?T.flushSync(()=>h(b)):h(b)}})},[h,f,b,j,o,d,k,l,e,m,c]),(0,g.g)(()=>{let a=j.current.fields;return()=>{d&&a.delete(d)}},[j,d])}({id:aQ,name:a9,commit:aP.commit,value:bx,controlRef:bI?bJ:aZ,getValue:()=>by});let bQ=(0,i.K)(()=>{al?aX.current=bv.map(a=>L(a,at)):bw.set("forceMounted",!0)}),bR=e.useRef(bf);(0,g.g)(()=>{bf!==bR.current&&bQ()},[bQ,bf]);let bS=(0,i.K)(a=>{bw.update(a);let b=a.type||"none";if(void 0!==a.activeIndex)if(null===a.activeIndex)a4.current!==ae&&(a4.current=ae,bz(void 0,(0,v.M)(b,void 0,{index:-1})));else{let c=a6.current[a.activeIndex];a4.current={value:c,index:a.activeIndex},bz(c,(0,v.M)(b,void 0,{index:a.activeIndex}))}}),bT=(0,i.K)((c,d)=>{if(a0.current=d.reason===w.qs,a.onInputValueChange?.(c,d),!d.isCanceled){if(d.reason===w.pf){let a=d.event,e=a.inputType;if("compositionend"===a.type||null!=e&&""!==e&&"insertReplacementText"!==e){let a=""!==c.trim();a&&aT(!0),a5.current={hasQuery:a},a&&b&&null==bw.state.activeIndex&&bw.set("activeIndex",0)}}bk(c)}}),bU=(0,i.K)((b,c)=>{if(bl!==b&&("escape-key"===c.reason&&bd&&0===bv.length&&!bw.state.emptyRef.current&&c.allowPropagation(),a.onOpenChange?.(b,c),!c.isCanceled&&(!b&&aS&&(bb?(bH||aV(bo),""===bo&&aT(!1)):ba&&(bH||bI?bS({activeIndex:null}):aV(bo),bT("",(0,v.d)(w.qs,c.event)))),bm(b),!b&&bI&&(c.reason===w.Xn||c.reason===w.Np))&&(aM(!0),aN(!1),"onBlur"===aO))){let a="none"===U?bj:bf;aP.commit(a)}}),bV=(0,i.K)((a,b)=>{J?.(a,b),!b.isCanceled&&(bg(a),("none"===U&&aY.current&&ay||bb&&!bw.state.inputInsidePopup)&&bT(L(a,at),(0,v.d)(b.reason,b.event)),bb&&null!=a&&b.reason!==w.pf&&aS&&!bH&&aV(bo))}),bW=(0,i.K)((a,b)=>{let c=b;if(void 0===c){if(null===bB)return;c=a6.current[bB]}let d=(0,u.EW)(a),e=a3.current??a;a3.current=null;let f=(0,v.d)(w.Bo,e),g=d?.closest("a")?.getAttribute("href");if(g){g.startsWith("#")&&bU(!1,f);return}if(ba){var h,i,j,k;let a=Array.isArray(bf)?bf:[];if(bV((h=c,i=bw.state.isItemEqualToValue,a&&0!==a.length&&a.some(a=>void 0!==a&&H(h,a,i)))?(j=c,k=bw.state.isItemEqualToValue,a.filter(a=>!H(j,a,k))):[...a,c],f),!(aZ.current&&""!==aZ.current.value.trim()))return;bw.state.inputInsidePopup?bT("",(0,v.d)(w.qs,f.event)):bU(!1,f)}else bV(c,f),bU(!1,f)}),bX=(0,i.K)(()=>{if(!bw.state.submitOnItemClick)return;let a=bw.state.inputElement?.form;a&&"function"==typeof a.requestSubmit&&a.requestSubmit()}),bY=(0,i.K)(()=>{if(bL(!1),bA?.(!1),aT(!1),bP(),aV(null),"none"===U?bS({activeIndex:null,selectedIndex:null}):bS({activeIndex:null}),ba&&aZ.current&&""!==aZ.current.value&&!a0.current&&bT("",(0,v.d)(w.qs)),bb)if(bw.state.inputInsidePopup)aZ.current&&""!==aZ.current.value&&bT("",(0,v.d)(w.qs));else{let a=L(bf,at);if(aZ.current&&aZ.current.value!==a){let b=""===a?w.qs:w.dv;bT(a,(0,v.d)(b))}}}),bZ=e.useMemo(()=>bH&&bD?{current:bD.closest('[role="dialog"]')}:aY,[bH,bD]);(0,O.v)({enabled:!a.actionsRef,open:bl,ref:bZ,onComplete(){bl||bY()}}),e.useImperativeHandle(a.actionsRef,()=>({unmount:bY}),[bY]),(0,g.g)(function(){if(bl||"none"===U)return;let a=al?bt:a7.current;if(ba){let b=Array.isArray(bf)?bf:[],c=I(a,b[b.length-1],av);bS({selectedIndex:-1===c?null:c})}else{let b=I(a,bf,av);bS({selectedIndex:-1===b?null:b})}},[bl,bf,al,U,bt,ba,av,bS]),(0,g.g)(()=>{al&&(a6.current=bv,aW.current.length=bv.length)},[al,bv]),(0,g.g)(()=>{let a=a5.current;if(a&&(a.hasQuery?b&&bw.set("activeIndex",0):"always"===b&&bw.set("activeIndex",0),a5.current=null),!bl&&!bH)return;let c=bd||be?bv:a6.current,d=bw.state.activeIndex;if(null==d)return"always"===b&&c.length>0?void bw.set("activeIndex",0):void(a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))));if(d>=c.length){a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))),bw.set("activeIndex",null);return}let e=c[d],f=a4.current.value,g=f!==ad&&H(e,f,bw.state.isItemEqualToValue);a4.current.index===d&&g||(a4.current={value:e,index:d},bw.state.onItemHighlighted(e,(0,v.M)(w.dv,void 0,{index:d})))},[bB,b,be,bd,bv,bH,bl,bw]),(0,g.g)(()=>{if("none"===U)return void aJ(""!==String(bj));aJ(ba?Array.isArray(bf)&&bf.length>0:null!=bf)},[aJ,U,bj,bf,ba]),e.useEffect(()=>{bd&&b&&0===bv.length&&bS({activeIndex:null})},[bd,b,bv.length,bS]),ac(bo,()=>{bl&&""!==bo&&bo!==String(bi)&&aT(!0)}),ac(bf,()=>{if("none"!==U&&(aF(a9),aG(bf!==aH.initialValue),aI()?aP.commit(bf):aP.commit(bf,!0),bb&&!bc&&!bI)){let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))}}),ac(bj,()=>{"none"===U&&(aF(a9),aG(bj!==aH.initialValue),aI()?aP.commit(bj):aP.commit(bj,!0))}),ac(al,()=>{if(!bb||bc||bI||aS)return;let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))});let b$=(0,p.P)({open:!!bH||bl,onOpenChange:bU,elements:{reference:bI?bF:bG,floating:bD}});bH||(c=ak?"grid":"listbox",x=bl?"true":"false");let b_=e.useMemo(()=>{let a=bG?.tagName==="INPUT",b=a||bl,d=a?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return b&&(d.role="combobox",d["aria-expanded"]=x,d["aria-haspopup"]=c,d["aria-controls"]=bl?bE?.id:void 0,d["aria-autocomplete"]=aB),{reference:d,floating:{role:"presentation"}}},[bG,bl,x,c,bE?.id,aB]),b0=(0,q.k)(b$,{enabled:!ah&&!a8&&ao,event:"mousedown-only",toggle:!1,touchOpenDelay:50*!bI,reason:w._J}),b1=(0,r.s)(b$,{enabled:!ah&&!a8&&!bH,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:!!bH||void 0,outsidePress(a){let b=(0,u.EW)(a);return!(0,u.gR)(bF,b)&&!(0,u.gR)(a2.current,b)&&!(0,u.gR)(a1.current,b)}}),b2=(0,s.C)(b$,{enabled:!ah&&!a8,id:aQ,listRef:aW,activeIndex:bB,selectedIndex:bC,virtual:!0,loopFocus:as,allowEscape:as&&!b,focusItemOnOpen:!aS&&("none"!==U||!!b)&&"auto",focusItemOnHover:ar,resetOnPointerLeave:!aq,cols:ak?2:1,orientation:ak?"horizontal":void 0,disabledIndices:P.Ml,onNavigate(a,b){(b||bl)&&"ending"!==bM&&(b?bS({activeIndex:a,type:a_.current?"keyboard":"pointer"}):bS({activeIndex:a}))}}),{getReferenceProps:b3,getFloatingProps:b4,getItemProps:b5}=(0,t.b)([b_,b0,b1,b2]);(0,h.j)(()=>{bw.update({inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,getItemProps:b5,setOpen:bU,setInputValue:bT,setSelectedValue:bV,setIndices:bS,onItemHighlighted:bz,handleSelection:bW,forceMount:bQ,requestSubmit:bX})}),(0,g.g)(()=>{bw.update({id:aQ,selectedValue:bf,open:bl,mounted:bK,transitionStatus:bM,items:al,inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,openMethod:bN,getItemProps:b5,selectionMode:U,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,onOpenChangeComplete:bA,openOnInputClick:ao,itemToStringLabel:at,modal:az,autoHighlight:b,isItemEqualToValue:av,submitOnItemClick:aE,hasInputValue:bc,requestSubmit:bX})},[bw,aQ,bf,bl,bK,bM,al,b4,b3,b5,bN,bO,U,a9,a8,ah,ai,aP,ak,bn,aw,bA,ao,at,az,av,aE,bc,ax,bX,b]);let b6=(0,j.a)(aj,aP.inputRef),b7=e.useMemo(()=>({query:bo,hasItems:bd,filteredItems:bu,flatFilteredItems:bv}),[bo,bd,bu,bv]),b8=e.useMemo(()=>Array.isArray(bx)?"":M(bx,au),[bx,au]),b9=ba&&Array.isArray(bf)&&bf.length>0,ca=ba||"none"===U?void 0:a9,cb=e.useMemo(()=>ba&&Array.isArray(bf)&&a9?bf.map(a=>{let b=M(a,au);return(0,d.jsx)("input",{type:"hidden",name:a9,value:b},b)}):null,[ba,bf,a9,au]),cc=(0,d.jsxs)(e.Fragment,{children:[a.children,(0,d.jsx)("input",{...aP.getInputValidationProps({onFocus(){if(bI)return void bF?.focus();(aZ.current||bF)?.focus()},onChange(a){if(a.nativeEvent.defaultPrevented)return;let b=a.target.value,c=(0,v.d)(w.dv,a.nativeEvent);function d(){if(ba)return;if("none"===U){aG(b!==aH.initialValue),bT(b,c),aI()&&aP.commit(b);return}let a=a6.current.find(a=>M(a,au).toLowerCase()===b.toLowerCase());null!=a&&(aG(a!==aH.initialValue),bV?.(a,c),aI()&&aP.commit(a))}al?d():(bQ(),queueMicrotask(d))}}),id:aQ&&null==ca?`${aQ}-hidden-input`:void 0,name:ca,autoComplete:aC,disabled:a8,required:ai&&!b9,readOnly:ah,value:b8,ref:b6,style:ca?k.a:k.Q,tabIndex:-1,"aria-hidden":!0}),cb]});return(0,d.jsx)(y.Provider,{value:bw,children:(0,d.jsx)(z.Provider,{value:b$,children:(0,d.jsx)(A.Provider,{value:b7,children:(0,d.jsx)(B.Provider,{value:bj,children:cc})})})})}var ag=c(504745),ah=c(577979),ai=c(654277);let aj={...ai.jL,valid:a=>null===a?null:a?{[Q.valid]:""}:{[Q.invalid]:""},popupSide:a=>a?{"data-popup-side":a}:null,listEmpty:a=>a?{"data-list-empty":""}:null},ak=e.createContext(void 0);var al=c(20960);let am=e.createContext(void 0);function an(a){let b=e.useContext(am);if(void 0===b&&!a)throw Error((0,x.A)(21));return b}var ao=c(729406);let ap=e.forwardRef(function(a,b){let{render:c,className:d,disabled:f=!1,id:g,...h}=a,{state:j,disabled:k,setTouched:l,setFocused:m,validationMode:o,validation:p}=S(),{labelId:q}=Z(),r=e.useContext(ak),s=!!an(!0),t=C(),{filteredItems:u}=E(),x=e.useContext(B),y=(0,ao.j)(),z=(0,n.P)(t,N.required),A=(0,n.P)(t,N.disabled),D=(0,n.P)(t,N.readOnly),F=(0,n.P)(t,N.name),G=(0,n.P)(t,N.selectionMode),H=(0,n.P)(t,N.autoHighlight),I=(0,n.P)(t,N.inputProps),J=(0,n.P)(t,N.triggerProps),K=(0,n.P)(t,N.open),L=(0,n.P)(t,N.mounted),M=(0,n.P)(t,N.selectedValue),O=(0,n.P)(t,N.popupSide),P=(0,n.P)(t,N.positionerElement),Q=(0,n.P)(t,N.id),R=(0,n.P)(t,N.inline),T=!!H,U=k||A||f,V=0===u.length,W=s||R,Y=(0,X.e)(g??(W?void 0:Q)),[_,aa]=e.useState(null),ab=e.useRef(!1),ac=e.useRef(null),ad=e.useRef(!1),ae=(0,i.K)(a=>{let b=s||t.state.inline;b&&!t.state.hasInputValue&&t.state.setInputValue("",(0,v.d)(w.dv)),t.update({inputElement:a,inputInsidePopup:b})}),af={...j,open:K,disabled:U,readOnly:D,popupSide:L&&P?O:null,listEmpty:V};return(0,ah.o)("input",a,{state:af,ref:[b,t.state.inputRef,ae],props:[I,J,{type:"text",value:a.value??_??x,"aria-readonly":D||void 0,"aria-required":z||void 0,"aria-labelledby":q,disabled:U,readOnly:D,required:"none"===G?z:void 0,..."none"===G&&F&&{name:F},id:Y,onFocus(){if(m(!0),!R||!ad.current)return;ad.current=!1;let a=ac.current;null!=a&&Object.hasOwn(t.state.valuesRef.current,a)&&t.state.setIndices({activeIndex:a})},onBlur(){l(!0),m(!1);let a=t.state.activeIndex;if(R&&null!==a&&"always"!==H&&(ac.current=a,ad.current=!0,t.state.setIndices({activeIndex:null})),"onBlur"===o){let a="none"===G?x:M;p.commit(a)}},onCompositionStart(a){ag.m0||(ab.current=!0,aa(a.currentTarget.value))},onCompositionEnd(a){ab.current=!1;let b=a.currentTarget.value;aa(null),t.state.setInputValue(b,(0,v.d)(w.pf,a.nativeEvent))},onChange(a){let b=a.nativeEvent.inputType,c=ab.current||!(!b||"insertReplacementText"===b);if(ab.current){let b=a.currentTarget.value;aa(b),""!==b||t.state.openOnInputClick||t.state.inputInsidePopup||t.state.setOpen(!1,(0,v.d)(w.qs,a.nativeEvent));let d=b.trim();!D&&!U&&d&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!(T&&""!==d)&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"});return}t.state.setInputValue(a.currentTarget.value,(0,v.d)(w.pf,a.nativeEvent));let d=""===a.currentTarget.value,e=(0,v.d)(w.qs,a.nativeEvent);d&&!t.state.inputInsidePopup&&("single"===G&&t.state.setSelectedValue(null,e),t.state.openOnInputClick||t.state.setOpen(!1,e));let f=a.currentTarget.value.trim();!D&&!U&&f&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!T&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(a){if(U||D||a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)return;t.state.keyboardActiveRef.current=!0;let b=a.currentTarget,c=b.scrollWidth-b.clientWidth,d="rtl"===y;if("Home"===a.key){(0,al.jo)(a);let c=ag.gm&&d?b.value.length:0;b.setSelectionRange(c,c),b.scrollLeft=0;return}if("End"===a.key){(0,al.jo)(a);let e=ag.gm&&d?0:b.value.length;b.setSelectionRange(e,e),b.scrollLeft=d?-c:c;return}if(!L&&"Escape"===a.key){let b="multiple"===G&&Array.isArray(M)?0===M.length:null===M,c=(0,v.d)(w.jv,a.nativeEvent);t.state.setInputValue("",c),t.state.setSelectedValue("multiple"===G?[]:null,c),b||t.state.inline||c.isPropagationAllowed||a.stopPropagation();return}if(r&&"Backspace"===a.key&&""===b.value&&void 0===r.highlightedChipIndex&&Array.isArray(M)&&M.length>0){let b=M.slice(0,-1);t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"}),t.state.setSelectedValue(b,(0,v.d)(w.dv,a.nativeEvent));return}let e=r?.highlightedChipIndex!==void 0,f=function(a){let b;if(!r)return;let{highlightedChipIndex:c}=r;if(void 0!==c){if("ArrowLeft"===a.key)a.preventDefault(),b=c>0?c-1:void 0;else if("ArrowRight"===a.key)a.preventDefault(),b=c<M.length-1?c+1:void 0;else if("Backspace"===a.key||"Delete"===a.key){a.preventDefault();let d=c>=M.length-1?M.length-2:c;b=d>=0?d:void 0,t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return b}return"ArrowLeft"===a.key&&(a.currentTarget.selectionStart??0)===0&&M.length>0?(a.preventDefault(),b=Math.max(M.length-1,0)):"Backspace"===a.key&&""===a.currentTarget.value&&M.length>0&&(t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),a.preventDefault()),b}(a);if(r?.setHighlightedChipIndex(f),void 0!==f?r?.chipsRef.current[f]?.focus():e&&t.state.inputRef.current?.focus(),229!==a.which&&"Enter"===a.key&&K){let b=t.state.activeIndex,c=a.nativeEvent;if(null===b)return void t.state.setOpen(!1,(0,v.d)(w.dv,c));(0,al.jo)(a);let d=t.state.listRef.current[b];d&&(t.state.selectionEventRef.current=c,d.click(),t.state.selectionEventRef.current=null)}},onPointerMove(){t.state.keyboardActiveRef.current=!1},onPointerDown(){t.state.keyboardActiveRef.current=!1}},p?p.getValidationProps(h):h],stateAttributesMapping:aj})});var aq=c(402831);let ar=e.createContext(void 0),as=e.forwardRef(function(a,b){let{keepMounted:c=!1,...e}=a,f=C(),g=(0,n.P)(f,N.mounted),h=(0,n.P)(f,N.forceMounted);return g||c||h?(0,d.jsx)(ar.Provider,{value:c,children:(0,d.jsx)(aq.XF,{ref:b,...e})}):null});var at=c(640023),au=c(568069),av=c(275819),aw=c(293863),ax=c(994152),ay=c(929035);let az=e.forwardRef(function(a,b){let{render:c,className:f,anchor:h,positionMethod:j="absolute",side:k="bottom",align:l="center",sideOffset:m=0,alignOffset:o=0,collisionBoundary:p="clipping-ancestors",collisionPadding:q=5,arrowPadding:r=5,sticky:s=!1,disableAnchorTracking:t=!1,collisionAvoidance:u=aw.uD,...v}=a,w=C(),{filteredItems:y}=E(),z=D(),A=function(){let a=e.useContext(ar);if(void 0===a)throw Error((0,x.A)(20));return a}(),B=(0,n.P)(w,N.modal),F=(0,n.P)(w,N.open),G=(0,n.P)(w,N.mounted),H=(0,n.P)(w,N.openMethod),I=(0,n.P)(w,N.triggerElement),J=(0,n.P)(w,N.inputElement),K=(0,n.P)(w,N.inputInsidePopup),L=(0,n.P)(w,N.transitionStatus),M=0===y.length,O=h??(K?I:J),P=(0,av.s)({anchor:O,floatingRootContext:z,positionMethod:j,mounted:G,side:k,sideOffset:m,align:l,alignOffset:o,arrowPadding:r,collisionBoundary:p,collisionPadding:q,sticky:s,disableAnchorTracking:t,keepMounted:A,collisionAvoidance:u,lazyFlip:!0});(0,au.K)(F&&B&&"touch"!==H,I);let Q=e.useMemo(()=>{let a={...P.positionerStyles};return F||(a.pointerEvents="none"),{role:"presentation",hidden:!G,style:a}},[F,G,P.positionerStyles]),R={open:F,side:P.side,align:P.align,anchorHidden:P.anchorHidden,empty:M};(0,g.g)(()=>{w.set("popupSide",P.side)},[w,P.side]);let S=e.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,anchorHidden:P.anchorHidden,isPositioned:P.isPositioned}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.anchorHidden,P.isPositioned]),T=(0,i.K)(a=>{w.set("positionerElement",a)}),U=(0,ah.o)("div",a,{state:R,ref:[b,T],props:[Q,(0,ax.d)(L),v],stateAttributesMapping:ai.GW});return(0,d.jsxs)(am.Provider,{value:S,children:[G&&B&&(0,d.jsx)(ay.W,{inert:(0,at.Y)(!F),cutout:J??I}),U]})});var aA=c(474228),aB=c(238978);let aC={...ai.GW,...aB.G},aD=e.forwardRef(function(a,b){let c,{render:e,className:f,initialFocus:g,finalFocus:h,...i}=a,j=C(),k=an(),l=D(),{filteredItems:m}=E(),o=(0,n.P)(j,N.mounted),p=(0,n.P)(j,N.open),q=(0,n.P)(j,N.openMethod),r=(0,n.P)(j,N.transitionStatus),s=(0,n.P)(j,N.inputInsidePopup),t=(0,n.P)(j,N.inputElement),v=0===m.length;(0,O.v)({open:p,ref:j.state.popupRef,onComplete(){p&&j.state.onOpenChangeComplete(!0)}});let w={open:p,side:k.side,align:k.align,anchorHidden:k.anchorHidden,transitionStatus:r,empty:v},x=(0,ah.o)("div",a,{state:w,ref:[b,j.state.popupRef],props:[{role:s?"dialog":"presentation",tabIndex:-1,onFocus(a){let b=(0,u.EW)(a.nativeEvent);"touch"!==q&&((0,u.gR)(j.state.listElement,b)||b===a.currentTarget)&&j.state.inputRef.current?.focus()}},(0,ax.d)(r),i],stateAttributesMapping:aC}),y=!!s&&(a=>"touch"===a?j.state.popupRef.current:t);return c=null!=h?h:!!s&&void 0,(0,d.jsx)(aA.s,{context:l,disabled:!o,modal:!s,openInteractionType:q,initialFocus:void 0===g?y:g,returnFocus:c,children:x})}),aE=e.createContext(null);function aF(a){let{children:b}=a,{filteredItems:c}=E(),f=e.useContext(aE),g=f?f.items:c;return g?(0,d.jsx)(e.Fragment,{children:g.map(b)}):null}var aG=c(987038);let aH=e.forwardRef(function(a,b){var c;let{render:f,className:g,children:h,...j}=a,k=C(),l=D(),m=!!an(!0),{filteredItems:o}=E(),p=(0,n.P)(k,N.items),q=(0,n.P)(k,N.labelsRef),r=(0,n.P)(k,N.listRef),s=(0,n.P)(k,N.selectionMode),t=(0,n.P)(k,N.grid),u=(0,n.P)(k,N.popupProps),v=(0,n.P)(k,N.disabled),w=(0,n.P)(k,N.readOnly),x=(0,n.P)(k,N.virtualized),y=0===o.length,z=(0,i.K)(a=>{k.set("positionerElement",a)}),A=(0,i.K)(a=>{k.set("listElement",a)}),B=e.useMemo(()=>"function"==typeof h?c||(c=(0,d.jsx)(aF,{children:h})):h,[h]),F=l.useState("floatingId"),G=(0,ah.o)("div",a,{state:{empty:y},ref:[b,A,m?null:z],props:[u,{children:B,tabIndex:-1,id:F,role:t?"grid":"listbox","aria-multiselectable":"multiple"===s?"true":void 0,onKeyDown(a){if(!v&&!w&&"Enter"===a.key){let b=k.state.activeIndex;if(null==b)return;(0,al.jo)(a);let c=a.nativeEvent,d=k.state.listRef.current[b];d&&(k.state.selectionEventRef.current=c,d.click(),k.state.selectionEventRef.current=null)}},onKeyDownCapture(){k.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){k.state.keyboardActiveRef.current=!1}},j]});return x?G:(0,d.jsx)(aG.u,{elementsRef:r,labelsRef:p?void 0:q,children:G})});var aI=c(360412);let aJ=e.createContext(void 0);var aK=c(642228);let aL=e.createContext(!1),aM=e.memo(e.forwardRef(function(a,b){let{render:c,className:f,value:h=null,index:i,disabled:j=!1,nativeButton:k=!1,...l}=a,m=e.useRef(!1),o=e.useRef(null),p=(0,aI.q)({index:i,textRef:o,indexGuessBehavior:aI.G.GuessFromOrder}),q=C(),r=e.useContext(aL),{flatFilteredItems:s,hasItems:t}=E(),u=(0,n.P)(q,N.open),v=(0,n.P)(q,N.selectionMode),w=(0,n.P)(q,N.readOnly),x=(0,n.P)(q,N.virtualized),y=(0,n.P)(q,N.isItemEqualToValue),z="none"!==v,A=i??(x?I(s,h,y):p.index),B=-1!==p.index,D=(0,n.P)(q,N.id),F=(0,n.P)(q,N.isActive,A),G=(0,n.P)(q,N.isSelected,h),J=(0,n.P)(q,N.getItemProps),K=e.useRef(null),L=null!=D&&B?`${D}-${A}`:void 0,M=G&&z;(0,g.g)(()=>{if(!(B&&(x||null!=i)))return;let a=q.state.listRef.current;return a[A]=K.current,()=>{delete a[A]}},[B,x,A,i,q]),(0,g.g)(()=>{if(!B||t)return;let a=q.state.valuesRef.current;return a[A]=h,"none"!==v&&q.state.allValuesRef.current.push(h),()=>{delete a[A]}},[B,t,A,h,q,v]),(0,g.g)(()=>{if(!u){m.current=!1;return}if(!B||t)return;let a=q.state.selectedValue;H(h,Array.isArray(a)?a[a.length-1]:a,y)&&q.set("selectedIndex",A)},[B,t,u,q,A,h,y]);let O=J({active:F,selected:M});O.id=void 0,O.onFocus=void 0;let{getButtonProps:P,buttonRef:Q}=(0,aK.s)({disabled:j,focusableWhenDisabled:!0,native:k});function R(a){function b(){q.state.handleSelection(a,h)}q.state.submitOnItemClick?(T.flushSync(b),q.state.requestSubmit()):b()}let S=(0,ah.o)("div",a,{ref:[Q,b,p.ref,K],state:{disabled:j,selected:M,highlighted:F},props:[O,{id:L,role:r?"gridcell":"option","aria-selected":z?M:void 0,tabIndex:void 0,onPointerDownCapture(a){m.current=!0,a.preventDefault()},onClick(a){j||w||R(a.nativeEvent)},onMouseUp(a){let b=m.current;m.current=!1,j||w||0!==a.button||b||!F||R(a.nativeEvent)}},l,P]}),U=e.useMemo(()=>({selected:M,textRef:o}),[M,o]);return(0,d.jsx)(aJ.Provider,{value:U,children:S})}));var aN=c(165046);let aO=function(a){let{multiple:b=!1,defaultValue:c,value:e,onValueChange:f,autoComplete:g,...h}=a;return(0,d.jsx)(af,{...h,selectionMode:b?"multiple":"single",selectedValue:e,defaultSelectedValue:c,onSelectedValueChange:f,formAutoComplete:g})},aP=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ap,{ref:c,"data-slot":"combobox-input",className:(0,aN.cn)("w-full rounded-xl py-2 text-sm outline-none transition-colors",a),...b}));function aQ({className:a,side:b="bottom",sideOffset:c=8,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(as,{children:(0,d.jsx)(az,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-[10000]",children:(0,d.jsx)(aD,{"data-slot":"combobox-content",className:(0,aN.cn)("bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md text-[var(--color-text)] max-h-[var(--available-height)] w-[calc(var(--anchor-width)+48px)] overflow-hidden rounded-3xl p-1 shadow-[0_0_25px_0_rgba(0,0,0,0.16)] outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",a),...h})})})}function aR({className:a,...b}){return(0,d.jsx)(aH,{"data-slot":"combobox-list",className:(0,aN.cn)("max-h-[300px] overflow-y-auto overscroll-contain thin-scrollbar",a),...b})}function aS({className:a,children:b,...c}){return(0,d.jsx)(aM,{"data-slot":"combobox-item",className:(0,aN.cn)("bg-transparent data-highlighted:bg-neutral-400/15 text-sm transition-all relative flex w-full cursor-pointer items-center gap-2.5 rounded-2xl px-3 py-2 outline-none select-none","data-disabled:pointer-events-none data-disabled:opacity-50",a),...c,children:b})}aP.displayName="ComboboxInput";var aT=c(941809),aU=c(896703),aV=c(490654),aW=c(75567);function aX(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.875 2.292a.114.114 0 0 0-.032.018A7.239 7.239 0 0 0 4.75 8.25a7.248 7.248 0 0 0 3.654 6.297c.57.327.982.955.941 1.682v.002l-.317 6.058a.75.75 0 1 1-1.498-.078l.317-6.062v-.004c.006-.09-.047-.215-.188-.296A8.749 8.749 0 0 1 3.25 8.25a8.738 8.738 0 0 1 3.732-7.169 1.547 1.547 0 0 1 1.709-.064c.484.292.809.835.809 1.46v4.714a.25.25 0 0 0 .119.213l2.25 1.385c.08.05.182.05.262 0l2.25-1.385a.25.25 0 0 0 .119-.213V2.478c0-.626.325-1.169.81-1.461a1.547 1.547 0 0 1 1.708.064 8.741 8.741 0 0 1 3.732 7.17 8.747 8.747 0 0 1-4.41 7.598c-.14.081-.193.206-.188.296v.004l.318 6.062a.75.75 0 1 1-1.498.078l-.317-6.058v-.002c-.041-.727.37-1.355.94-1.682A7.247 7.247 0 0 0 19.25 8.25a7.239 7.239 0 0 0-3.093-5.94.114.114 0 0 0-.032-.018l-.01-.001c-.003 0-.014 0-.031.01-.036.022-.084.079-.084.177V7.19c0 .608-.315 1.172-.833 1.49l-2.25 1.385a1.75 1.75 0 0 1-1.834 0l-2.25-1.384A1.752 1.752 0 0 1 8 7.192V2.477c0-.098-.048-.155-.084-.176a.068.068 0 0 0-.031-.011l-.01.001Z"},child:[]}]})(a)}function aY(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.5 7C2.5 9.48528 4.51472 11.5 7 11.5C9.48528 11.5 11.5 9.48528 11.5 7C11.5 4.51472 9.48528 2.5 7 2.5C4.51472 2.5 2.5 4.51472 2.5 7ZM2.5 17C2.5 19.4853 4.51472 21.5 7 21.5C9.48528 21.5 11.5 19.4853 11.5 17C11.5 14.5147 9.48528 12.5 7 12.5C4.51472 12.5 2.5 14.5147 2.5 17ZM12.5 17C12.5 19.4853 14.5147 21.5 17 21.5C19.4853 21.5 21.5 19.4853 21.5 17C21.5 14.5147 19.4853 12.5 17 12.5C14.5147 12.5 12.5 14.5147 12.5 17ZM9.5 7C9.5 8.38071 8.38071 9.5 7 9.5C5.61929 9.5 4.5 8.38071 4.5 7C4.5 5.61929 5.61929 4.5 7 4.5C8.38071 4.5 9.5 5.61929 9.5 7ZM9.5 17C9.5 18.3807 8.38071 19.5 7 19.5C5.61929 19.5 4.5 18.3807 4.5 17C4.5 15.6193 5.61929 14.5 7 14.5C8.38071 14.5 9.5 15.6193 9.5 17ZM19.5 17C19.5 18.3807 18.3807 19.5 17 19.5C15.6193 19.5 14.5 18.3807 14.5 17C14.5 15.6193 15.6193 14.5 17 14.5C18.3807 14.5 19.5 15.6193 19.5 17ZM17.5252 11.155L17.8026 10.5186C18.297 9.38398 19.1876 8.48059 20.2988 7.98638L21.1534 7.60631C21.6155 7.4008 21.6155 6.7284 21.1534 6.52289L20.3467 6.16406C19.2068 5.65713 18.3002 4.72031 17.8143 3.54712L17.5295 2.85945C17.3309 2.38018 16.669 2.38018 16.4705 2.85945L16.1856 3.54712C15.6997 4.72031 14.7932 5.65713 13.6534 6.16406L12.8466 6.52289C12.3845 6.7284 12.3845 7.4008 12.8466 7.60631L13.7011 7.98638C14.8124 8.48059 15.7029 9.38398 16.1974 10.5186L16.4748 11.155C16.6778 11.6209 17.3222 11.6209 17.5252 11.155Z"},child:[]}]})(a)}var aZ=c(826948),a$=c(57137),a_=c(489619),a0=c(86839),a1=c(981188);function a2(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind?(0,a0.PV)(a.label):c,path:b,type:a.nodeType??("object"===a.kind?"folder":"file")}}function a3(){let{resolvedTheme:a,setTheme:b}=(0,aZ.D)(),[c,f]=(0,e.useState)(!1);if(!c)return(0,d.jsx)("div",{className:"w-[26px] h-[26px]"});let g="dark"===a;return(0,d.jsx)("button",{type:"button",onClick:()=>b(g?"light":"dark"),className:"p-1.5 rounded-lg transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Switch to light mode":"Switch to dark mode",children:g?(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M12 2v2"}),(0,d.jsx)("path",{d:"M12 20v2"}),(0,d.jsx)("path",{d:"m4.93 4.93 1.41 1.41"}),(0,d.jsx)("path",{d:"m17.66 17.66 1.41 1.41"}),(0,d.jsx)("path",{d:"M2 12h2"}),(0,d.jsx)("path",{d:"M20 12h2"}),(0,d.jsx)("path",{d:"m6.34 17.66-1.41 1.41"}),(0,d.jsx)("path",{d:"m19.07 4.93-1.41 1.41"})]}):(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})})}function a4(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"m21 21-4.3-4.3"})]})}function a5({type:a}){switch(a){case"folder":return(0,d.jsx)(aT.A,{size:16,style:{flexShrink:0,color:"#60a5fa"}});case"document":default:return(0,d.jsx)(aU.A,{size:16,style:{flexShrink:0,opacity:.7}});case"database":return(0,d.jsx)(aV.A,{size:16,style:{flexShrink:0}})}}function a6({onSelect:a,searchFn:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),k=(0,e.useRef)(!1),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=(0,e.useCallback)(a=>{if(k.current){k.current=!1;return}if(j(a),!a.trim()){f([]),h(!1);return}b?(f(b(a.trim(),20).map(a2)),h(!0)):(l.current&&clearTimeout(l.current),l.current=setTimeout(async()=>{try{let b=await fetch(`/api/workspace/suggest-files?q=${encodeURIComponent(a.trim())}`),c=await b.json();f(c.items??[]),h(!0)}catch{f([])}},150))},[b]);return(0,d.jsxs)(aO,{value:null,open:g,onOpenChange:a=>{a||h(!1)},onValueChange:b=>{b&&(k.current=!0,a(b),h(!1),j(""),f([]))},onInputValueChange:n,filter:null,itemToStringLabel:()=>"",children:[(0,d.jsxs)("div",{ref:m,className:"relative",children:[(0,d.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none z-10",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a4,{})}),(0,d.jsx)(aP,{placeholder:"Search",className:"w-full pl-9 pr-10 py-1.5 rounded-xl text-sm outline-none transition-colors",style:{background:"var(--color-surface-hover)",color:"var(--color-text)"}})]}),(0,d.jsxs)(aQ,{anchor:m,children:[(0,d.jsx)(aR,{children:c.map(a=>(0,d.jsxs)(aS,{value:a,children:[(0,d.jsx)("span",{className:"flex-shrink-0",style:{color:"var(--color-text-muted)",opacity:.55},children:(0,d.jsx)(a5,{type:a.type})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:a.name}),(0,d.jsx)("div",{className:"truncate text-xs",style:{color:"var(--color-text-muted)"},children:a.path.split("/").slice(0,-1).join("/")})]})]},a.path))}),i.trim()&&0===c.length&&(0,d.jsx)("div",{className:"py-3 text-center text-sm",style:{color:"var(--color-text-muted)"},children:"No files found"})]})]})}function a7({orgName:a,onFileSearchSelect:b,mobile:c,onClose:f,showHidden:g,onToggleHidden:h,width:i,onCollapse:j,compact:k=!1,onToggleCompact:l,activeWorkspace:m,onWorkspaceChanged:n,onNavigate:o,activeCrmTarget:p=null,customCrmObjects:q,activeCrmObjectName:r=null,onNavigateToCrmObject:s,chatsPanel:t,onNewChatSession:u}){let v=c?"280px":i??260,[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)("home"),A=[{id:"crm-people",label:"People",target:"people",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,d.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{id:"crm-companies",label:"Companies",target:"companies",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M3 21h18"}),(0,d.jsx)("path",{d:"M5 21V7l8-4v18"}),(0,d.jsx)("path",{d:"M19 21V11l-6-4"}),(0,d.jsx)("path",{d:"M9 9h0"}),(0,d.jsx)("path",{d:"M9 13h0"}),(0,d.jsx)("path",{d:"M9 17h0"})]})},{id:"crm-inbox",label:"Inbox",target:"inbox",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),(0,d.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z"})]})},{id:"crm-calendar",label:"Calendar",target:"calendar",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}],B=[{id:"cloud",label:"Cloud",icon:(0,d.jsx)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,d.jsx)("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"})})},{id:"integrations",label:"Integrations",icon:(0,d.jsx)(aY,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"skills",label:"Skills",icon:(0,d.jsx)(aX,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"cron",label:"Cron",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}],C=(0,d.jsxs)("aside",{className:"flex flex-col h-screen shrink-0 border-r",style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[l&&(0,d.jsx)("div",{className:"flex items-center justify-center h-[44px] shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Expand sidebar",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M15 3v18"})]})})}),(0,d.jsx)("div",{className:"flex items-center justify-center pb-0.5 shrink-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsx)("button",{type:"button",onClick:b,disabled:e,className:"w-7 h-7 mx-auto rounded-lg overflow-hidden flex items-center justify-center transition-opacity hover:opacity-90",title:`${a||"Workspace"}${c?` — ${c}`:""}`,children:(0,d.jsx)("img",{src:"/dench-workspace-icon.png",alt:"",className:"w-7 h-7 object-cover",draggable:!1})})})}),o&&(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 pt-1 pb-1",children:[A.map(a=>{let b=p===a.target;return(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:a.label,"aria-label":a.label,children:a.icon},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>s(a.name),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,"aria-label":c,children:(0,d.jsx)(a1.P,{name:a.icon,size:16})},`crm-object-${a.name}`)})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"flex flex-col items-center gap-0.5 py-1",children:B.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:a.label,"aria-label":a.label,children:a.icon},a.id))}),(0,d.jsxs)("div",{className:"flex flex-col items-center py-1.5 gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]}),D=(0,d.jsxs)("aside",{className:`flex flex-col h-screen shrink-0 ${c?"drawer-left":"border-r"}`,style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 h-[44px] shrink-0",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsxs)("button",{type:"button",onClick:b,disabled:e,className:"text-[13px] flex items-center gap-1.5 truncate w-full transition-colors rounded-lg px-2 py-1.5",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Switch workspace",children:[(0,d.jsx)("span",{className:"truncate font-semibold",children:a||"Workspace"}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"shrink-0 opacity-40",children:"/"}),(0,d.jsx)("span",{className:"truncate text-[12px]",style:{color:"var(--color-text-muted)"},children:c})]}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]})})}),(l||j)&&(0,d.jsx)("button",{type:"button",onClick:l??j,className:"p-1.5 rounded-lg shrink-0 transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:l?"Collapse to icons":"Hide sidebar (⌘B)",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})})]}),t&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1 flex items-center gap-1",children:[[{id:"home",label:"Home"},{id:"chats",label:"Chats"}].map(a=>{let b=y===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>z(a.id),className:"flex-1 px-2 py-1 rounded-md text-[12px] font-medium transition-colors cursor-pointer",style:{color:b?"var(--color-text)":"var(--color-text-muted)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:a.label},a.id)}),"chats"===y&&u&&(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded-md transition-colors cursor-pointer shrink-0",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"New chat","aria-label":"New chat",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M5 12h14"}),(0,d.jsx)("path",{d:"M12 5v14"})]})})]}),"chats"===y&&t?(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col relative",children:t}):(0,d.jsxs)(d.Fragment,{children:[o&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1",children:[(0,d.jsx)("div",{className:"px-2 pt-2 pb-1 text-[9px] lowercase",style:{color:"var(--color-text-muted)",letterSpacing:"0.05em"},children:"workspace"}),(0,d.jsxs)("div",{className:"space-y-0.5",children:[A.map(a=>{let b=p===a.target;return(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.name),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a1.P,{name:a.icon,size:16})}),c]},`crm-object-${a.name}`)})]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"px-2 py-1 space-y-0.5",children:B.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id))})]}),(0,d.jsxs)("div",{className:"px-2 py-1.5 flex items-center justify-between",children:[(0,d.jsxs)("a",{href:"https://dench.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-2 py-1 rounded-lg text-[11px]",style:{color:"var(--color-text-muted)"},children:["dench.com"," v3.0.1"]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]})]});return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"drawer-backdrop",onClick:()=>void f?.(),children:(0,d.jsx)("div",{onClick:a=>a.stopPropagation(),className:"fixed inset-y-0 left-0 z-50",children:D})}),(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]}):(0,d.jsxs)(d.Fragment,{children:[!c&&k?C:D,(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]})}},685343:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(95253)._0},686937:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},699022:(a,b,c)=>{"use strict";function d(a,b){let c=a[b.tabId];return c&&c.sessionId===b.sessionId&&c.sessionKey===b.sessionKey&&c.isStreaming===b.isStreaming&&c.status===b.status&&c.isReconnecting===b.isReconnecting&&c.loadingSession===b.loadingSession?a:{...a,[b.tabId]:b}}function e(a,b){if(!(b in a))return a;let c={...a};return delete c[b],c}function f(a){return{parentStatuses:new Map(a.parentRuns.map(a=>[a.sessionId,a.status])),subagentStatuses:new Map(a.subagents.map(a=>[a.childSessionKey,a.status]))}}c.d(b,{F8:()=>f,T$:()=>e,ZZ:()=>d})},704092:(a,b,c)=>{"use strict";c.r(b),c.d(b,{Alternation:()=>av,Alternative:()=>ap,CstParser:()=>b_,EMPTY_ALT:()=>bZ,EOF:()=>ai,EarlyExitException:()=>br,EmbeddedActionsParser:()=>b0,GAstVisitor:()=>aB,Lexer:()=>V,LexerDefinitionErrorType:()=>d,MismatchedTokenException:()=>bo,NoViableAltException:()=>bp,NonTerminal:()=>an,NotAllInputParsedException:()=>bq,Option:()=>aq,Parser:()=>ca,ParserDefinitionErrorType:()=>g,Repetition:()=>at,RepetitionMandatory:()=>ar,RepetitionMandatoryWithSeparator:()=>as,RepetitionWithSeparator:()=>au,Rule:()=>ao,Terminal:()=>aw,VERSION:()=>h,assignOccurrenceIndices:()=>bf,clearCache:()=>b9,createSyntaxDiagramsCode:()=>b1,createToken:()=>ag,createTokenInstance:()=>aj,defaultGrammarResolverErrorProvider:()=>aM,defaultGrammarValidatorErrorProvider:()=>aN,defaultLexerErrorProvider:()=>T,defaultParserErrorProvider:()=>aL,generateParserFactory:()=>b7,generateParserModule:()=>b8,isRecognitionException:()=>bm,resolveGrammar:()=>bd,serializeGrammar:()=>ax,serializeProduction:()=>ay,tokenLabel:()=>W,tokenMatcher:()=>ak,tokenName:()=>X,validateGrammar:()=>be});var d,e,f,g,h="7.1.2",i=c(165892),j=c(935407),k={},l=new j.RegExpParser;function m(a){var b=a.toString();if(k.hasOwnProperty(b))return k[b];var c=l.pattern(b);return k[b]=c,c}var n=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),o="Complement Sets are not supported for first char optimization",p='Unable to use "first char" lexer optimizations:\n';function q(a,b,c){var d=J(a);b[d]=d,!0===c&&function(a,b){var c=String.fromCharCode(a),d=c.toUpperCase();if(d!==c){var e=J(d.charCodeAt(0));b[e]=e}else{var f=c.toLowerCase();if(f!==c){var e=J(f.charCodeAt(0));b[e]=e}}}(a,b)}function r(a,b){return(0,i.I6)(a.value,function(a){return"number"==typeof a?(0,i.gR)(b,a):void 0!==(0,i.I6)(b,function(b){return a.from<=b&&b<=a.to})})}var s=function(a){function b(b){var c=a.call(this)||this;return c.targetCharCodes=b,c.found=!1,c}return n(b,a),b.prototype.visitChildren=function(b){if(!0!==this.found){switch(b.type){case"Lookahead":this.visitLookahead(b);return;case"NegativeLookahead":this.visitNegativeLookahead(b);return}a.prototype.visitChildren.call(this,b)}},b.prototype.visitCharacter=function(a){(0,i.gR)(this.targetCharCodes,a.value)&&(this.found=!0)},b.prototype.visitSet=function(a){a.complement?void 0===r(a,this.targetCharCodes)&&(this.found=!0):void 0!==r(a,this.targetCharCodes)&&(this.found=!0)},b}(j.BaseRegExpVisitor);function t(a,b){if(!(b instanceof RegExp))return void 0!==(0,i.I6)(b,function(b){return(0,i.gR)(a,b.charCodeAt(0))});var c=m(b),d=new s(a);return d.visit(c),d.found}var u=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),v="PATTERN",w="defaultMode",x="modes",y="boolean"==typeof RegExp("(?:)").sticky,z=/[^\\][\$]/,A=/[^\\[][\^]|^\^/;function B(a){var b=a.ignoreCase?"i":"";return RegExp("^(?:"+a.source+")",b)}function C(a){var b=a.ignoreCase?"iy":"y";return RegExp(""+a.source,b)}function D(a){var b=a.PATTERN;if((0,i.gd)(b))return!1;if((0,i.Tn)(b))return!0;if((0,i.zy)(b,"exec"))return!0;if((0,i.Kg)(b))return!1;throw Error("non exhaustive match")}function E(a){return!!(0,i.Kg)(a)&&1===a.length&&a.charCodeAt(0)}var F={test:function(a){for(var b=a.length,c=this.lastIndex;c<b;c++){var d=a.charCodeAt(c);if(10===d)return this.lastIndex=c+1,!0;if(13===d)return 10===a.charCodeAt(c+1)?this.lastIndex=c+2:this.lastIndex=c+1,!0}return!1},lastIndex:0};function G(a,b){if((0,i.zy)(a,"LINE_BREAKS"))return!1;if((0,i.gd)(a.PATTERN)){try{t(b,a.PATTERN)}catch(a){return{issue:d.IDENTIFY_TERMINATOR,errMsg:a.message}}return!1}if((0,i.Kg)(a.PATTERN))return!1;if(D(a))return{issue:d.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function H(a){return(0,i.Tj)(a,function(a){return(0,i.Kg)(a)&&a.length>0?a.charCodeAt(0):a})}function I(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}function J(a){return a<256?a:K[a]}var K=[];function L(a,b){var c=a.tokenTypeIdx;return c===b.tokenTypeIdx||!0===b.isParent&&!0===b.categoryMatchesMap[c]}function M(a,b){return a.tokenTypeIdx===b.tokenTypeIdx}var N=1,O={};function P(a){var b,c,d,e=function(a){for(var b=(0,i.T9)(a),c=a,d=!0;d;){c=(0,i.oE)((0,i.Bq)((0,i.Tj)(c,function(a){return a.CATEGORIES})));var e=(0,i.iv)(c,b);b=b.concat(e),(0,i.Im)(e)?d=!1:c=e}return b}(a);b=e,(0,i.jJ)(b,function(a){var b,c;Q(a)||(O[N]=a,a.tokenTypeIdx=N++),R(a)&&!(0,i.cy)(a.CATEGORIES)&&(a.CATEGORIES=[a.CATEGORIES]),R(a)||(a.CATEGORIES=[]),b=a,(0,i.zy)(b,"categoryMatches")||(a.categoryMatches=[]),c=a,(0,i.zy)(c,"categoryMatchesMap")||(a.categoryMatchesMap={})}),c=e,(0,i.jJ)(c,function(a){!function a(b,c){(0,i.jJ)(b,function(a){c.categoryMatchesMap[a.tokenTypeIdx]=!0}),(0,i.jJ)(c.CATEGORIES,function(d){var e=b.concat(c);(0,i.gR)(e,d)||a(e,d)})}([],a)}),d=e,(0,i.jJ)(d,function(a){a.categoryMatches=[],(0,i.jJ)(a.categoryMatchesMap,function(b,c){a.categoryMatches.push(O[c].tokenTypeIdx)})}),(0,i.jJ)(e,function(a){a.isParent=a.categoryMatches.length>0})}function Q(a){return(0,i.zy)(a,"tokenTypeIdx")}function R(a){return(0,i.zy)(a,"CATEGORIES")}function S(a){return(0,i.zy)(a,"tokenTypeIdx")}var T={buildUnableToPopLexerModeMessage:function(a){return"Unable to pop Lexer Mode after encountering Token ->"+a.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(a,b,c,d,e){return"unexpected character: ->"+a.charAt(b)+"<- at offset: "+b+", skipped "+c+" characters."}};!function(a){a[a.MISSING_PATTERN=0]="MISSING_PATTERN",a[a.INVALID_PATTERN=1]="INVALID_PATTERN",a[a.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",a[a.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",a[a.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",a[a.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",a[a.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",a[a.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",a[a.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",a[a.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",a[a.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",a[a.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",a[a.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",a[a.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",a[a.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",a[a.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",a[a.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"}(d||(d={}));var U={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:T,traceInitPerf:!1,skipValidations:!1};Object.freeze(U);var V=function(){function a(a,b){var c=this;if(void 0===b&&(b=U),this.lexerDefinition=a,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof b)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=(0,i.h1)(U,b);var e=this.config.traceInitPerf;!0===e?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof e&&(this.traceInitMaxIdent=e,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var e,f=!0;c.TRACE_INIT("Lexer Config handling",function(){if(c.config.lineTerminatorsPattern===U.lineTerminatorsPattern)c.config.lineTerminatorsPattern=F;else if(c.config.lineTerminatorCharacters===U.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(b.safeMode&&b.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');c.trackStartLines=/full|onlyStart/i.test(c.config.positionTracking),c.trackEndLines=/full/i.test(c.config.positionTracking),(0,i.cy)(a)?((e={modes:{}}).modes[w]=(0,i.T9)(a),e[w]=w):(f=!1,e=(0,i.lR)(a))}),!1===c.config.skipValidations&&(c.TRACE_INIT("performRuntimeChecks",function(){var a,b;c.lexerDefinitionErrors=c.lexerDefinitionErrors.concat((a=e,c.trackStartLines,c.config.lineTerminatorCharacters,b=[],(0,i.zy)(a,w)||b.push({message:"A MultiMode Lexer cannot be initialized without a <"+w+"> property in its definition\n",type:d.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,i.zy)(a,x)||b.push({message:"A MultiMode Lexer cannot be initialized without a <"+x+"> property in its definition\n",type:d.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,i.zy)(a,x)&&(0,i.zy)(a,w)&&!(0,i.zy)(a.modes,a.defaultMode)&&b.push({message:"A MultiMode Lexer cannot be initialized with a "+w+": <"+a.defaultMode+">which does not exist\n",type:d.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,i.zy)(a,x)&&(0,i.jJ)(a.modes,function(a,c){(0,i.jJ)(a,function(a,e){(0,i.b0)(a)&&b.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+c+"> at index: <")+e+">\n",type:d.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),b))}),c.TRACE_INIT("performWarningRuntimeChecks",function(){var a,b,f,g,h,j,k,l;c.lexerDefinitionWarning=c.lexerDefinitionWarning.concat((a=e,b=c.trackStartLines,f=c.config.lineTerminatorCharacters,g=[],h=!1,j=(0,i.oE)((0,i.Bq)((0,i.LG)(a.modes,function(a){return a}))),k=(0,i.ku)(j,function(a){return a[v]===V.NA}),l=H(f),b&&(0,i.jJ)(k,function(a){var b=G(a,l);if(!1!==b){var c={message:function(a,b){if(b.issue===d.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n The problem is in the <"+a.name+"> Token Type\n Root cause: "+b.errMsg+".\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(b.issue===d.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n The problem is in the <"+a.name+"> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}(a,b),type:b.issue,tokenType:a};g.push(c)}else(0,i.zy)(a,"LINE_BREAKS")?!0===a.LINE_BREAKS&&(h=!0):t(l,a.PATTERN)&&(h=!0)}),b&&!h&&g.push({message:"Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.",type:d.NO_LINE_BREAKS_FLAGS}),g))})),e.modes=e.modes?e.modes:{},(0,i.jJ)(e.modes,function(a,b){e.modes[b]=(0,i.ku)(a,function(a){return(0,i.b0)(a)})});var g=(0,i.HP)(e.modes);if((0,i.jJ)(e.modes,function(a,e){c.TRACE_INIT("Mode: <"+e+"> processing",function(){if(c.modes.push(e),!1===c.config.skipValidations&&c.TRACE_INIT("validatePatterns",function(){var b,e,f,h,k,l,n,o,p,q,r,s,t,w,x,y,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R;c.lexerDefinitionErrors=c.lexerDefinitionErrors.concat((b=[],k=a,l=(0,i.pb)(k,function(a){return!(0,i.zy)(a,v)}),e={errors:(0,i.Tj)(l,function(a){return{message:"Token Type: ->"+a.name+"<- missing static 'PATTERN' property",type:d.MISSING_PATTERN,tokenTypes:[a]}}),valid:(0,i.iv)(k,l)},b=b.concat(e.errors),h=(n=e.valid,o=(0,i.pb)(n,function(a){var b=a[v];return!(0,i.gd)(b)&&!(0,i.Tn)(b)&&!(0,i.zy)(b,"exec")&&!(0,i.Kg)(b)}),f={errors:(0,i.Tj)(o,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:d.INVALID_PATTERN,tokenTypes:[a]}}),valid:(0,i.iv)(n,o)}).valid,b=(b=(b=(b=(b=b.concat(f.errors)).concat((p=h,q=[],r=(0,i.pb)(p,function(a){return(0,i.gd)(a[v])}),(q=(q=(q=(q=q.concat((s=r,t=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.found=!1,b}return u(b,a),b.prototype.visitEndAnchor=function(a){this.found=!0},b}(j.BaseRegExpVisitor),w=(0,i.pb)(s,function(a){var b=a[v];try{var c=m(b),d=new t;return d.visit(c),d.found}catch(a){return z.test(b.source)}}),(0,i.Tj)(w,function(a){return{message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+a.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:d.EOI_ANCHOR_FOUND,tokenTypes:[a]}})))).concat((x=r,y=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.found=!1,b}return u(b,a),b.prototype.visitStartAnchor=function(a){this.found=!0},b}(j.BaseRegExpVisitor),B=(0,i.pb)(x,function(a){var b=a[v];try{var c=m(b),d=new y;return d.visit(c),d.found}catch(a){return A.test(b.source)}}),(0,i.Tj)(B,function(a){return{message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+a.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:d.SOI_ANCHOR_FOUND,tokenTypes:[a]}})))).concat((C=r,D=(0,i.pb)(C,function(a){var b=a[v];return b instanceof RegExp&&(b.multiline||b.global)}),(0,i.Tj)(D,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:d.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[a]}})))).concat((E=r,F=[],G=(0,i.Tj)(E,function(a){return(0,i.TS)(E,function(b,c){return a.PATTERN.source!==c.PATTERN.source||(0,i.gR)(F,c)||c.PATTERN===V.NA||(F.push(c),b.push(c)),b},[])}),G=(0,i.oE)(G),H=(0,i.pb)(G,function(a){return a.length>1}),(0,i.Tj)(H,function(a){var b=(0,i.Tj)(a,function(a){return a.name});return{message:"The same RegExp pattern ->"+(0,i.$1)(a).PATTERN+"<-has been used in all of the following Token Types: "+b.join(", ")+" <-",type:d.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})))).concat((I=r,J=(0,i.pb)(I,function(a){return a[v].test("")}),(0,i.Tj)(J,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PATTERN' must not match an empty string",type:d.EMPTY_MATCH_PATTERN,tokenTypes:[a]}})))))).concat((K=h,L=(0,i.pb)(K,function(a){if(!(0,i.zy)(a,"GROUP"))return!1;var b=a.GROUP;return b!==V.SKIPPED&&b!==V.NA&&!(0,i.Kg)(b)}),(0,i.Tj)(L,function(a){return{message:"Token Type: ->"+a.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:d.INVALID_GROUP_TYPE_FOUND,tokenTypes:[a]}})))).concat((M=h,N=g,O=(0,i.pb)(M,function(a){return void 0!==a.PUSH_MODE&&!(0,i.gR)(N,a.PUSH_MODE)}),(0,i.Tj)(O,function(a){return{message:"Token Type: ->"+a.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+a.PUSH_MODE+"<-which does not exist",type:d.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[a]}})))).concat((P=h,Q=[],R=(0,i.TS)(P,function(a,b,c){var d,e=b.PATTERN;return e===V.NA||((0,i.Kg)(e)?a.push({str:e,idx:c,tokenType:b}):(0,i.gd)(e)&&(d=e,void 0===(0,i.I6)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],function(a){return -1!==d.source.indexOf(a)}))&&a.push({str:e.source,idx:c,tokenType:b})),a},[]),(0,i.jJ)(P,function(a,b){(0,i.jJ)(R,function(c){var e=c.str,f=c.idx,g=c.tokenType;if(b<f&&function(a,b){if((0,i.gd)(b)){var c=b.exec(a);return null!==c&&0===c.index}if((0,i.Tn)(b))return b(a,0,[],{});if((0,i.zy)(b,"exec"))return b.exec(a,0,[],{});if("string"==typeof b)return b===a;throw Error("non exhaustive match")}(e,a.PATTERN)){var h="Token: ->"+g.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+a.name+"<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE";Q.push({message:h,type:d.UNREACHABLE_PATTERN,tokenTypes:[a,g]})}})}),Q))))}),(0,i.Im)(c.lexerDefinitionErrors)){var f;P(a),c.TRACE_INIT("analyzeTokenTypes",function(){var d,e,g,h,k,l,n,r,s,u,w,x,z,A,F,L,M;d={lineTerminatorCharacters:c.config.lineTerminatorCharacters,positionTracking:b.positionTracking,ensureOptimizations:b.ensureOptimizations,safeMode:b.safeMode,tracer:c.TRACE_INIT.bind(c)},(A=(d=(0,i.NT)(d,{useSticky:y,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(a,b){return b()}})).tracer)("initCharCodeToOptimizedIndexMap",function(){if((0,i.Im)(K)){K=Array(65536);for(var a=0;a<65536;a++)K[a]=a>255?255+~~(a/255):a}}),A("Reject Lexer.NA",function(){e=(0,i.ku)(a,function(a){return a[v]===V.NA})}),F=!1,A("Transform Patterns",function(){F=!1,g=(0,i.Tj)(e,function(a){var b=a[v];if((0,i.gd)(b)){var c=b.source;return 1!==c.length||"^"===c||"$"===c||"."===c||b.ignoreCase?2!==c.length||"\\"!==c[0]||(0,i.gR)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],c[1])?d.useSticky?C(b):B(b):c[1]:c}if((0,i.Tn)(b))return F=!0,{exec:b};if((0,i.zy)(b,"exec"))return F=!0,b;if("string"==typeof b)if(1===b.length)return b;else{var e=new RegExp(b.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"));return d.useSticky?C(e):B(e)}throw Error("non exhaustive match")})}),A("misc mapping",function(){h=(0,i.Tj)(e,function(a){return a.tokenTypeIdx}),k=(0,i.Tj)(e,function(a){var b=a.GROUP;if(b!==V.SKIPPED){if((0,i.Kg)(b))return b;if((0,i.b0)(b))return!1;throw Error("non exhaustive match")}}),l=(0,i.Tj)(e,function(a){var b=a.LONGER_ALT;if(b)return(0,i.qh)(e,b)}),n=(0,i.Tj)(e,function(a){return a.PUSH_MODE}),r=(0,i.Tj)(e,function(a){return(0,i.zy)(a,"POP_MODE")})}),A("Line Terminator Handling",function(){var a=H(d.lineTerminatorCharacters);s=(0,i.Tj)(e,function(a){return!1}),"onlyOffset"!==d.positionTracking&&(s=(0,i.Tj)(e,function(b){return(0,i.zy)(b,"LINE_BREAKS")?b.LINE_BREAKS:!1===G(b,a)?t(a,b.PATTERN):void 0}))}),A("Misc Mapping #2",function(){u=(0,i.Tj)(e,D),w=(0,i.Tj)(g,E),x=(0,i.TS)(e,function(a,b){var c=b.GROUP;return(0,i.Kg)(c)&&c!==V.SKIPPED&&(a[c]=[]),a},{}),z=(0,i.Tj)(g,function(a,b){return{pattern:g[b],longerAlt:l[b],canLineTerminator:s[b],isCustom:u[b],short:w[b],group:k[b],push:n[b],pop:r[b],tokenTypeIdx:h[b],tokenType:e[b]}})}),L=!0,M=[],d.safeMode||A("First Char Optimization",function(){M=(0,i.TS)(e,function(a,b,c){if("string"==typeof b.PATTERN){var e;I(a,J(b.PATTERN.charCodeAt(0)),z[c])}else if((0,i.cy)(b.START_CHARS_HINT))(0,i.jJ)(b.START_CHARS_HINT,function(b){var d=J("string"==typeof b?b.charCodeAt(0):b);e!==d&&(e=d,I(a,d,z[c]))});else if((0,i.gd)(b.PATTERN))if(b.PATTERN.unicode)L=!1,d.ensureOptimizations&&(0,i.Zi)(""+p+" Unable to analyze < "+b.PATTERN.toString()+" > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.\n This will disable the lexer's first char optimizations.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var f=function(a,b){void 0===b&&(b=!1);try{var c=m(a);return function a(b,c,d){switch(b.type){case"Disjunction":for(var e=0;e<b.value.length;e++)a(b.value[e],c,d);break;case"Alternative":for(var f=b.value,e=0;e<f.length;e++){var g=f[e];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}switch(g.type){case"Character":q(g.value,c,d);break;case"Set":if(!0===g.complement)throw Error(o);(0,i.jJ)(g.value,function(a){if("number"==typeof a)q(a,c,d);else if(!0===d)for(var b=a.from;b<=a.to;b++)q(b,c,d);else{for(var b=a.from;b<=a.to&&b<256;b++)q(b,c,d);if(a.to>=256)for(var e=a.from>=256?a.from:256,f=a.to,g=J(e),h=J(f),i=g;i<=h;i++)c[i]=i}});break;case"Group":a(g.value,c,d);break;default:throw Error("Non Exhaustive Match")}var h=void 0!==g.quantifier&&0===g.quantifier.atLeast;if("Group"===g.type&&!1===function a(b){return!!b.quantifier&&0===b.quantifier.atLeast||!!b.value&&((0,i.cy)(b.value)?(0,i.Si)(b.value,a):a(b.value))}(g)||"Group"!==g.type&&!1===h)break}break;default:throw Error("non exhaustive match!")}return(0,i.zu)(c)}(c.value,{},c.flags.ignoreCase)}catch(c){if(c.message===o)b&&(0,i.x5)(""+p+" Unable to optimize: < "+a.toString()+" >\n Complement Sets cannot be automatically optimized.\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var d="";b&&(d="\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),(0,i.Zi)(p+"\n Failed parsing: < "+a.toString()+" >\n Using the regexp-to-ast library version: "+j.VERSION+"\n Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+d)}}return[]}(b.PATTERN,d.ensureOptimizations);(0,i.Im)(f)&&(L=!1),(0,i.jJ)(f,function(b){I(a,b,z[c])})}else d.ensureOptimizations&&(0,i.Zi)(""+p+" TokenType: <"+b.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),L=!1;return a},[])}),A("ArrayPacking",function(){M=(0,i.VS)(M)}),f={emptyGroups:x,patternIdxToConfig:z,charCodeToPatternIdxToConfig:M,hasCustom:F,canBeOptimized:L}}),c.patternIdxToConfig[e]=f.patternIdxToConfig,c.charCodeToPatternIdxToConfig[e]=f.charCodeToPatternIdxToConfig,c.emptyGroups=(0,i.h1)(c.emptyGroups,f.emptyGroups),c.hasCustom=f.hasCustom||c.hasCustom,c.canModeBeOptimized[e]=f.canBeOptimized}})}),c.defaultMode=e.defaultMode,!(0,i.Im)(c.lexerDefinitionErrors)&&!c.config.deferDefinitionErrorsHandling)throw Error("Errors detected in definition of Lexer:\n"+(0,i.Tj)(c.lexerDefinitionErrors,function(a){return a.message}).join("-----------------------\n"));(0,i.jJ)(c.lexerDefinitionWarning,function(a){(0,i.x5)(a.message)}),c.TRACE_INIT("Choosing sub-methods implementations",function(){if(y?(c.chopInput=i.zK,c.match=c.matchWithTest):(c.updateLastIndex=i.tE,c.match=c.matchWithExec),f&&(c.handleModes=i.tE),!1===c.trackStartLines&&(c.computeNewColumn=i.zK),!1===c.trackEndLines&&(c.updateTokenEndLineColumnLocation=i.tE),/full/i.test(c.config.positionTracking))c.createTokenInstance=c.createFullToken;else if(/onlyStart/i.test(c.config.positionTracking))c.createTokenInstance=c.createStartOnlyToken;else if(/onlyOffset/i.test(c.config.positionTracking))c.createTokenInstance=c.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+c.config.positionTracking+'"');c.hasCustom?(c.addToken=c.addTokenUsingPush,c.handlePayload=c.handlePayloadWithCustom):(c.addToken=c.addTokenUsingMemberAccess,c.handlePayload=c.handlePayloadNoCustom)}),c.TRACE_INIT("Failed Optimization Warnings",function(){var a=(0,i.TS)(c.canModeBeOptimized,function(a,b,c){return!1===b&&a.push(c),a},[]);if(b.ensureOptimizations&&!(0,i.Im)(a))throw Error("Lexer Modes: < "+a.join(", ")+' > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n Or inspect the console log for details on how to resolve these issues.')}),c.TRACE_INIT("clearRegExpParserCache",function(){k={}}),c.TRACE_INIT("toFastProperties",function(){(0,i.Bl)(c)})})}return a.prototype.tokenize=function(a,b){if(void 0===b&&(b=this.defaultMode),!(0,i.Im)(this.lexerDefinitionErrors))throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+(0,i.Tj)(this.lexerDefinitionErrors,function(a){return a.message}).join("-----------------------\n"));return this.tokenizeInternal(a,b)},a.prototype.tokenizeInternal=function(a,b){var c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v=this,w=a,x=w.length,y=0,z=0,A=Array(this.hasCustom?0:Math.floor(a.length/10)),B=[],C=this.trackStartLines?1:void 0,D=this.trackStartLines?1:void 0,E=(c=this.emptyGroups,d={},e=(0,i.HP)(c),(0,i.jJ)(e,function(a){var b=c[a];if((0,i.cy)(b))d[a]=[];else throw Error("non exhaustive match")}),d),F=this.trackStartLines,G=this.config.lineTerminatorsPattern,H=0,I=[],K=[],L=[],M=[];Object.freeze(M);var N=void 0;function O(){return I}function P(a){var b=K[J(a)];return void 0===b?M:b}var Q=function(a){if(1===L.length&&void 0===a.tokenType.PUSH_MODE){var b=v.config.errorMessageProvider.buildUnableToPopLexerModeMessage(a);B.push({offset:a.startOffset,line:void 0!==a.startLine?a.startLine:void 0,column:void 0!==a.startColumn?a.startColumn:void 0,length:a.image.length,message:b})}else{L.pop();var c=(0,i.HV)(L);I=v.patternIdxToConfig[c],K=v.charCodeToPatternIdxToConfig[c],H=I.length;var d=v.canModeBeOptimized[c]&&!1===v.config.safeMode;N=K&&d?P:O}};function R(a){L.push(a),K=this.charCodeToPatternIdxToConfig[a],H=(I=this.patternIdxToConfig[a]).length,H=I.length;var b=this.canModeBeOptimized[a]&&!1===this.config.safeMode;N=K&&b?P:O}for(R.call(this,b);y<x;){k=null;var S=w.charCodeAt(y),T=N(S),U=T.length;for(f=0;f<U;f++){var V=(u=T[f]).pattern;l=null;var W=u.short;if(!1!==W?S===W&&(k=V):!0===u.isCustom?null!==(t=V.exec(w,y,A,E))?(k=t[0],void 0!==t.payload&&(l=t.payload)):k=null:(this.updateLastIndex(V,y),k=this.match(V,a,y)),null!==k){if(void 0!==(j=u.longerAlt)){var X=I[j],Y=X.pattern;m=null,!0===X.isCustom?null!==(t=Y.exec(w,y,A,E))?(h=t[0],void 0!==t.payload&&(m=t.payload)):h=null:(this.updateLastIndex(Y,y),h=this.match(Y,a,y)),h&&h.length>k.length&&(k=h,l=m,u=X)}break}}if(null!==k){if(n=k.length,void 0!==(o=u.group)&&(p=u.tokenTypeIdx,q=this.createTokenInstance(k,y,p,u.tokenType,C,D,n),this.handlePayload(q,l),!1===o?z=this.addToken(A,z,q):E[o].push(q)),a=this.chopInput(a,n),y+=n,D=this.computeNewColumn(D,n),!0===F&&!0===u.canLineTerminator){var Z=0,_=void 0,aa=void 0;G.lastIndex=0;do!0===(_=G.test(k))&&(aa=G.lastIndex-1,Z++);while(!0===_);0!==Z&&(C+=Z,D=n-aa,this.updateTokenEndLineColumnLocation(q,o,aa,Z,C,D,n))}this.handleModes(u,Q,R,q)}else{for(var ab=y,ac=C,ad=D,ae=!1;!ae&&y<x;)for(w.charCodeAt(y),a=this.chopInput(a,1),y++,g=0;g<H;g++){var af=I[g],V=af.pattern,W=af.short;if(!1!==W?w.charCodeAt(y)===W&&(ae=!0):!0===af.isCustom?ae=null!==V.exec(w,y,A,E):(this.updateLastIndex(V,y),ae=null!==V.exec(a)),!0===ae)break}r=y-ab,s=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(w,ab,r,ac,ad),B.push({offset:ab,line:ac,column:ad,length:r,message:s})}}return this.hasCustom||(A.length=z),{tokens:A,groups:E,errors:B}},a.prototype.handleModes=function(a,b,c,d){if(!0===a.pop){var e=a.push;b(d),void 0!==e&&c.call(this,e)}else void 0!==a.push&&c.call(this,a.push)},a.prototype.chopInput=function(a,b){return a.substring(b)},a.prototype.updateLastIndex=function(a,b){a.lastIndex=b},a.prototype.updateTokenEndLineColumnLocation=function(a,b,c,d,e,f,g){var h,i;void 0!==b&&(i=(h=c===g-1)?-1:0,(1!==d||!0!==h)&&(a.endLine=e+i,a.endColumn=f-1+-i))},a.prototype.computeNewColumn=function(a,b){return a+b},a.prototype.createTokenInstance=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];return null},a.prototype.createOffsetOnlyToken=function(a,b,c,d){return{image:a,startOffset:b,tokenTypeIdx:c,tokenType:d}},a.prototype.createStartOnlyToken=function(a,b,c,d,e,f){return{image:a,startOffset:b,startLine:e,startColumn:f,tokenTypeIdx:c,tokenType:d}},a.prototype.createFullToken=function(a,b,c,d,e,f,g){return{image:a,startOffset:b,endOffset:b+g-1,startLine:e,endLine:e,startColumn:f,endColumn:f+g-1,tokenTypeIdx:c,tokenType:d}},a.prototype.addToken=function(a,b,c){return 666},a.prototype.addTokenUsingPush=function(a,b,c){return a.push(c),b},a.prototype.addTokenUsingMemberAccess=function(a,b,c){return a[b]=c,++b},a.prototype.handlePayload=function(a,b){},a.prototype.handlePayloadNoCustom=function(a,b){},a.prototype.handlePayloadWithCustom=function(a,b){null!==b&&(a.payload=b)},a.prototype.match=function(a,b,c){return null},a.prototype.matchWithTest=function(a,b,c){return!0===a.test(b)?b.substring(c,a.lastIndex):null},a.prototype.matchWithExec=function(a,b){var c=a.exec(b);return null!==c?c[0]:c},a.prototype.TRACE_INIT=function(a,b){if(!0!==this.traceInitPerf)return b();this.traceInitIndent++;var c=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(c+"--\x3e <"+a+">");var d=(0,i.O1)(b),e=d.time,f=d.value,g=e>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&g(c+"<-- <"+a+"> time: "+e+"ms"),this.traceInitIndent--,f},a.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",a.NA=/NOT_APPLICABLE/,a}();function W(a){return Y(a)?a.LABEL:a.name}function X(a){return a.name}function Y(a){return(0,i.Kg)(a.LABEL)&&""!==a.LABEL}var Z="categories",_="label",aa="group",ab="push_mode",ac="pop_mode",ad="longer_alt",ae="line_breaks",af="start_chars_hint";function ag(a){return ah(a)}function ah(a){var b=a.pattern,c={};if(c.name=a.name,(0,i.b0)(b)||(c.PATTERN=b),(0,i.zy)(a,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return(0,i.zy)(a,Z)&&(c.CATEGORIES=a[Z]),P([c]),(0,i.zy)(a,_)&&(c.LABEL=a[_]),(0,i.zy)(a,aa)&&(c.GROUP=a[aa]),(0,i.zy)(a,ac)&&(c.POP_MODE=a[ac]),(0,i.zy)(a,ab)&&(c.PUSH_MODE=a[ab]),(0,i.zy)(a,ad)&&(c.LONGER_ALT=a[ad]),(0,i.zy)(a,ae)&&(c.LINE_BREAKS=a[ae]),(0,i.zy)(a,af)&&(c.START_CHARS_HINT=a[af]),c}var ai=ah({name:"EOF",pattern:V.NA});function aj(a,b,c,d,e,f,g,h){return{image:b,startOffset:c,endOffset:d,startLine:e,endLine:f,startColumn:g,endColumn:h,tokenTypeIdx:a.tokenTypeIdx,tokenType:a}}function ak(a,b){return L(a,b)}P([ai]);var al=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),am=function(){function a(a){this._definition=a}return Object.defineProperty(a.prototype,"definition",{get:function(){return this._definition},set:function(a){this._definition=a},enumerable:!1,configurable:!0}),a.prototype.accept=function(a){a.visit(this),(0,i.jJ)(this.definition,function(b){b.accept(a)})},a}(),an=function(a){function b(b){var c=a.call(this,[])||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),Object.defineProperty(b.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(a){},enumerable:!1,configurable:!0}),b.prototype.accept=function(a){a.visit(this)},b}(am),ao=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.orgText="",(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),ap=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.ignoreAmbiguities=!1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),aq=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),ar=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),as=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),at=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),au=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),b}(am),av=function(a){function b(b){var c=a.call(this,b.definition)||this;return c.idx=1,c.ignoreAmbiguities=!1,c.hasPredicates=!1,(0,i.kp)(c,(0,i.Up)(b,function(a){return void 0!==a})),c}return al(b,a),Object.defineProperty(b.prototype,"definition",{get:function(){return this._definition},set:function(a){this._definition=a},enumerable:!1,configurable:!0}),b}(am),aw=function(){function a(a){this.idx=1,(0,i.kp)(this,(0,i.Up)(a,function(a){return void 0!==a}))}return a.prototype.accept=function(a){a.visit(this)},a}();function ax(a){return(0,i.Tj)(a,ay)}function ay(a){function b(a){return(0,i.Tj)(a,ay)}if(a instanceof an)return{type:"NonTerminal",name:a.nonTerminalName,idx:a.idx};if(a instanceof ap)return{type:"Alternative",definition:b(a.definition)};if(a instanceof aq)return{type:"Option",idx:a.idx,definition:b(a.definition)};if(a instanceof ar)return{type:"RepetitionMandatory",idx:a.idx,definition:b(a.definition)};if(a instanceof as)return{type:"RepetitionMandatoryWithSeparator",idx:a.idx,separator:ay(new aw({terminalType:a.separator})),definition:b(a.definition)};else if(a instanceof au)return{type:"RepetitionWithSeparator",idx:a.idx,separator:ay(new aw({terminalType:a.separator})),definition:b(a.definition)};else if(a instanceof at)return{type:"Repetition",idx:a.idx,definition:b(a.definition)};else if(a instanceof av)return{type:"Alternation",idx:a.idx,definition:b(a.definition)};else if(a instanceof aw){var c={type:"Terminal",name:a.terminalType.name,label:W(a.terminalType),idx:a.idx},d=a.terminalType.PATTERN;return a.terminalType.PATTERN&&(c.pattern=(0,i.gd)(d)?d.source:d),c}else if(a instanceof ao)return{type:"Rule",name:a.name,orgText:a.orgText,definition:b(a.definition)};else throw Error("non exhaustive match")}var az=function(){function a(){}return a.prototype.walk=function(a,b){var c=this;void 0===b&&(b=[]),(0,i.jJ)(a.definition,function(d,e){var f=(0,i.gv)(a.definition,e+1);if(d instanceof an)c.walkProdRef(d,f,b);else if(d instanceof aw)c.walkTerminal(d,f,b);else if(d instanceof ap)c.walkFlat(d,f,b);else if(d instanceof aq)c.walkOption(d,f,b);else if(d instanceof ar)c.walkAtLeastOne(d,f,b);else if(d instanceof as)c.walkAtLeastOneSep(d,f,b);else if(d instanceof au)c.walkManySep(d,f,b);else if(d instanceof at)c.walkMany(d,f,b);else if(d instanceof av)c.walkOr(d,f,b);else throw Error("non exhaustive match")})},a.prototype.walkTerminal=function(a,b,c){},a.prototype.walkProdRef=function(a,b,c){},a.prototype.walkFlat=function(a,b,c){var d=b.concat(c);this.walk(a,d)},a.prototype.walkOption=function(a,b,c){var d=b.concat(c);this.walk(a,d)},a.prototype.walkAtLeastOne=function(a,b,c){var d=[new aq({definition:a.definition})].concat(b,c);this.walk(a,d)},a.prototype.walkAtLeastOneSep=function(a,b,c){var d=aA(a,b,c);this.walk(a,d)},a.prototype.walkMany=function(a,b,c){var d=[new aq({definition:a.definition})].concat(b,c);this.walk(a,d)},a.prototype.walkManySep=function(a,b,c){var d=aA(a,b,c);this.walk(a,d)},a.prototype.walkOr=function(a,b,c){var d=this,e=b.concat(c);(0,i.jJ)(a.definition,function(a){var b=new ap({definition:[a]});d.walk(b,e)})},a}();function aA(a,b,c){return[new aq({definition:[new aw({terminalType:a.separator})].concat(a.definition)})].concat(b,c)}var aB=function(){function a(){}return a.prototype.visit=function(a){switch(a.constructor){case an:return this.visitNonTerminal(a);case ap:return this.visitAlternative(a);case aq:return this.visitOption(a);case ar:return this.visitRepetitionMandatory(a);case as:return this.visitRepetitionMandatoryWithSeparator(a);case au:return this.visitRepetitionWithSeparator(a);case at:return this.visitRepetition(a);case av:return this.visitAlternation(a);case aw:return this.visitTerminal(a);case ao:return this.visitRule(a);default:throw Error("non exhaustive match")}},a.prototype.visitNonTerminal=function(a){},a.prototype.visitAlternative=function(a){},a.prototype.visitOption=function(a){},a.prototype.visitRepetition=function(a){},a.prototype.visitRepetitionMandatory=function(a){},a.prototype.visitRepetitionMandatoryWithSeparator=function(a){},a.prototype.visitRepetitionWithSeparator=function(a){},a.prototype.visitAlternation=function(a){},a.prototype.visitTerminal=function(a){},a.prototype.visitRule=function(a){},a}(),aC=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();function aD(a,b){return void 0===b&&(b=[]),a instanceof aq||a instanceof at||a instanceof au||(a instanceof av?(0,i.zN)(a.definition,function(a){return aD(a,b)}):!(a instanceof an&&(0,i.gR)(b,a))&&a instanceof am&&(a instanceof an&&b.push(a),(0,i.Si)(a.definition,function(a){return aD(a,b)})))}function aE(a){if(a instanceof an)return"SUBRULE";if(a instanceof aq)return"OPTION";if(a instanceof av)return"OR";if(a instanceof ar)return"AT_LEAST_ONE";if(a instanceof as)return"AT_LEAST_ONE_SEP";else if(a instanceof au)return"MANY_SEP";else if(a instanceof at)return"MANY";else if(a instanceof aw)return"CONSUME";else throw Error("non exhaustive match")}var aF=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.separator="-",b.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},b}return aC(b,a),b.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},b.prototype.visitTerminal=function(a){var b=a.terminalType.name+this.separator+"Terminal";(0,i.zy)(this.dslMethods,b)||(this.dslMethods[b]=[]),this.dslMethods[b].push(a)},b.prototype.visitNonTerminal=function(a){var b=a.nonTerminalName+this.separator+"Terminal";(0,i.zy)(this.dslMethods,b)||(this.dslMethods[b]=[]),this.dslMethods[b].push(a)},b.prototype.visitOption=function(a){this.dslMethods.option.push(a)},b.prototype.visitRepetitionWithSeparator=function(a){this.dslMethods.repetitionWithSeparator.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.dslMethods.repetitionMandatory.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.dslMethods.repetitionMandatoryWithSeparator.push(a)},b.prototype.visitRepetition=function(a){this.dslMethods.repetition.push(a)},b.prototype.visitAlternation=function(a){this.dslMethods.alternation.push(a)},b}(aB),aG=new aF;function aH(a){if(a instanceof an)return aH(a.referencedRule);if(a instanceof aw)return[a.terminalType];if(a instanceof ap||a instanceof aq||a instanceof at||a instanceof ar||a instanceof as||a instanceof au||a instanceof aw||a instanceof ao)return function(a){for(var b,c=[],d=a.definition,e=0,f=d.length>e,g=!0;f&&g;)g=aD(b=d[e]),c=c.concat(aH(b)),e+=1,f=d.length>e;return(0,i.sb)(c)}(a);if(a instanceof av){var b,c;return b=a,c=(0,i.Tj)(b.definition,function(a){return aH(a)}),(0,i.sb)((0,i.Bq)(c))}throw Error("non exhaustive match")}var aI="_~IN~_",aJ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aK=function(a){function b(b){var c=a.call(this)||this;return c.topProd=b,c.follows={},c}return aJ(b,a),b.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},b.prototype.walkTerminal=function(a,b,c){},b.prototype.walkProdRef=function(a,b,c){var d,e,f=(d=a.referencedRule,e=a.idx,d.name+e+aI+this.topProd.name),g=aH(new ap({definition:b.concat(c)}));this.follows[f]=g},b}(az),aL={buildMismatchTokenMessage:function(a){var b=a.expected,c=a.actual;return a.previous,a.ruleName,"Expecting "+(Y(b)?"--\x3e "+W(b)+" <--":"token of type --\x3e "+b.name+" <--")+" but found --\x3e '"+c.image+"' <--"},buildNotAllInputParsedMessage:function(a){var b=a.firstRedundant;return a.ruleName,"Redundant input, expecting EOF but found: "+b.image},buildNoViableAltMessage:function(a){var b=a.expectedPathsPerAlt,c=a.actual,d=(a.previous,a.customUserDescription);a.ruleName;var e="Expecting: ",f="\nbut found: '"+(0,i.$1)(c).image+"'";if(d)return e+d+f;var g=(0,i.TS)(b,function(a,b){return a.concat(b)},[]),h=(0,i.Tj)(g,function(a){return"["+(0,i.Tj)(a,function(a){return W(a)}).join(", ")+"]"});return e+"one of these possible Token sequences:\n"+(0,i.Tj)(h,function(a,b){return" "+(b+1)+". "+a}).join("\n")+f},buildEarlyExitMessage:function(a){var b=a.expectedIterationPaths,c=a.actual,d=a.customUserDescription;a.ruleName;var e="Expecting: ",f="\nbut found: '"+(0,i.$1)(c).image+"'";return d?e+d+f:e+("expecting at least one iteration which starts with one of these possible Token sequences::\n <"+(0,i.Tj)(b,function(a){return"["+(0,i.Tj)(a,function(a){return W(a)}).join(",")+"]"}).join(" ,"))+">"+f}};Object.freeze(aL);var aM={buildRuleNotFoundError:function(a,b){return"Invalid grammar, reference to a rule which is not defined: ->"+b.nonTerminalName+"<-\ninside top level rule: ->"+a.name+"<-"}},aN={buildDuplicateFoundError:function(a,b){var c=a.name,d=(0,i.$1)(b),e=d.idx,f=aE(d),g=d instanceof aw?d.terminalType.name:d instanceof an?d.nonTerminalName:"",h="->"+f+(e>0?e:"")+"<- "+(g?"with argument: ->"+g+"<-":"")+"\n appears more than once ("+b.length+" times) in the top level rule: ->"+c+"<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n ";return(h=h.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(a){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+a.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(a){var b=(0,i.Tj)(a.prefixPath,function(a){return W(a)}).join(", "),c=0===a.alternation.idx?"":a.alternation.idx;return"Ambiguous alternatives: <"+a.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\n"+("in <OR"+c+"> inside <")+a.topLevelRule.name+"> Rule,\n<"+b+"> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(a){var b=(0,i.Tj)(a.prefixPath,function(a){return W(a)}).join(", "),c=0===a.alternation.idx?"":a.alternation.idx,d="Ambiguous Alternatives Detected: <"+a.ambiguityIndices.join(" ,")+"> in <OR"+c+"> inside <"+a.topLevelRule.name+"> Rule,\n<"+b+"> may appears as a prefix path in all these alternatives.\n";return d+"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(a){var b=aE(a.repetition);return 0!==a.repetition.idx&&(b+=a.repetition.idx),"The repetition <"+b+"> within Rule <"+a.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(a){return"deprecated"},buildEmptyAlternationError:function(a){return"Ambiguous empty alternative: <"+(a.emptyChoiceIdx+1)+">"+(" in <OR"+a.alternation.idx+"> inside <")+a.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(a){return"An Alternation cannot have more than 256 alternatives:\n"+("<OR"+a.alternation.idx+"> inside <"+a.topLevelRule.name+"> Rule.\n has ")+(a.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(a){var b=a.topLevelRule.name,c=b+" --\x3e "+i.Tj(a.leftRecursionPath,function(a){return a.name}).concat([b]).join(" --\x3e ");return"Left Recursion found in grammar.\nrule: <"+b+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+c+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(a){return"deprecated"},buildDuplicateRuleNameError:function(a){return"Duplicate definition, rule: ->"+(a.topLevelRule instanceof ao?a.topLevelRule.name:a.topLevelRule)+"<- is already defined in the grammar: ->"+a.grammarName+"<-"}},aO=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aP=function(a){function b(b,c){var d=a.call(this)||this;return d.nameToTopRule=b,d.errMsgProvider=c,d.errors=[],d}return aO(b,a),b.prototype.resolveRefs=function(){var a=this;(0,i.jJ)((0,i.zu)(this.nameToTopRule),function(b){a.currTopLevel=b,b.accept(a)})},b.prototype.visitNonTerminal=function(a){var b=this.nameToTopRule[a.nonTerminalName];if(b)a.referencedRule=b;else{var c=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,a);this.errors.push({message:c,type:g.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:a.nonTerminalName})}},b}(aB),aQ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),aR=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.path=c,d.nextTerminalName="",d.nextTerminalOccurrence=0,d.nextTerminalName=d.path.lastTok.name,d.nextTerminalOccurrence=d.path.lastTokOccurrence,d}return aQ(b,a),b.prototype.walkTerminal=function(a,b,c){if(this.isAtEndOfPath&&a.terminalType.name===this.nextTerminalName&&a.idx===this.nextTerminalOccurrence&&!this.found){var d=new ap({definition:b.concat(c)});this.possibleTokTypes=aH(d),this.found=!0}},b}(function(a){function b(b,c){var d=a.call(this)||this;return d.topProd=b,d.path=c,d.possibleTokTypes=[],d.nextProductionName="",d.nextProductionOccurrence=0,d.found=!1,d.isAtEndOfPath=!1,d}return aQ(b,a),b.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,i.T9)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,i.T9)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},b.prototype.walk=function(b,c){void 0===c&&(c=[]),this.found||a.prototype.walk.call(this,b,c)},b.prototype.walkProdRef=function(a,b,c){if(a.referencedRule.name===this.nextProductionName&&a.idx===this.nextProductionOccurrence){var d=b.concat(c);this.updateExpectedNext(),this.walk(a.referencedRule,d)}},b.prototype.updateExpectedNext=function(){(0,i.Im)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},b}(az)),aS=function(a){function b(b,c){var d=a.call(this)||this;return d.topRule=b,d.occurrence=c,d.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},d}return aQ(b,a),b.prototype.startWalking=function(){return this.walk(this.topRule),this.result},b}(az),aT=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkMany=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkMany.call(this,b,c,d)},b}(aS),aU=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkManySep=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkManySep.call(this,b,c,d)},b}(aS),aV=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkAtLeastOne=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkAtLeastOne.call(this,b,c,d)},b}(aS),aW=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return aQ(b,a),b.prototype.walkAtLeastOneSep=function(b,c,d){if(b.idx===this.occurrence){var e=(0,i.$1)(c.concat(d));this.result.isEndOfRule=void 0===e,e instanceof aw&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else a.prototype.walkAtLeastOneSep.call(this,b,c,d)},b}(aS);function aX(a,b,c){void 0===c&&(c=[]),c=(0,i.T9)(c);var d=[],e=0;function f(f){var g=aX(f.concat((0,i.gv)(a,e+1)),b,c);return d.concat(g)}for(;c.length<b&&e<a.length;){var g=a[e];if(g instanceof ap)return f(g.definition);if(g instanceof an)return f(g.definition);if(g instanceof aq)d=f(g.definition);else if(g instanceof ar){var h=g.definition.concat([new at({definition:g.definition})]);return f(h)}else if(g instanceof as){var h=[new ap({definition:g.definition}),new at({definition:[new aw({terminalType:g.separator})].concat(g.definition)})];return f(h)}else if(g instanceof au){var h=g.definition.concat([new at({definition:[new aw({terminalType:g.separator})].concat(g.definition)})]);d=f(h)}else if(g instanceof at){var h=g.definition.concat([new at({definition:g.definition})]);d=f(h)}else if(g instanceof av)return(0,i.jJ)(g.definition,function(a){!1===(0,i.Im)(a.definition)&&(d=f(a.definition))}),d;else if(g instanceof aw)c.push(g.terminalType);else throw Error("non exhaustive match");e++}return d.push({partialPath:c,suffixDef:(0,i.gv)(a,e)}),d}function aY(a,b,c,d){var e="EXIT_NONE_TERMINAL",f=[e],g="EXIT_ALTERNATIVE",h=!1,j=b.length,k=j-d-1,l=[],m=[];for(m.push({idx:-1,def:a,ruleStack:[],occurrenceStack:[]});!(0,i.Im)(m);){var n=m.pop();if(n===g){h&&(0,i.HV)(m).idx<=k&&m.pop();continue}var o=n.def,p=n.idx,q=n.ruleStack,r=n.occurrenceStack;if(!(0,i.Im)(o)){var s=o[0];if(s===e){var t={idx:p,def:(0,i.gv)(o),ruleStack:(0,i.gc)(q),occurrenceStack:(0,i.gc)(r)};m.push(t)}else if(s instanceof aw)if(p<j-1){var u=p+1;if(c(b[u],s.terminalType)){var t={idx:u,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(t)}}else if(p===j-1)l.push({nextTokenType:s.terminalType,nextTokenOccurrence:s.idx,ruleStack:q,occurrenceStack:r}),h=!0;else throw Error("non exhaustive match");else if(s instanceof an){var v=(0,i.T9)(q);v.push(s.nonTerminalName);var w=(0,i.T9)(r);w.push(s.idx);var t={idx:p,def:s.definition.concat(f,(0,i.gv)(o)),ruleStack:v,occurrenceStack:w};m.push(t)}else if(s instanceof aq){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var y={idx:p,def:s.definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof ar){var z=new at({definition:s.definition,idx:s.idx}),A=s.definition.concat([z],(0,i.gv)(o)),t={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(t)}else if(s instanceof as){var B=new aw({terminalType:s.separator}),z=new at({definition:[B].concat(s.definition),idx:s.idx}),A=s.definition.concat([z],(0,i.gv)(o)),t={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(t)}else if(s instanceof au){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var B=new aw({terminalType:s.separator}),C=new at({definition:[B].concat(s.definition),idx:s.idx}),A=s.definition.concat([C],(0,i.gv)(o)),y={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof at){var x={idx:p,def:(0,i.gv)(o),ruleStack:q,occurrenceStack:r};m.push(x),m.push(g);var C=new at({definition:s.definition,idx:s.idx}),A=s.definition.concat([C],(0,i.gv)(o)),y={idx:p,def:A,ruleStack:q,occurrenceStack:r};m.push(y)}else if(s instanceof av)for(var D=s.definition.length-1;D>=0;D--){var E={idx:p,def:s.definition[D].definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r};m.push(E),m.push(g)}else if(s instanceof ap)m.push({idx:p,def:s.definition.concat((0,i.gv)(o)),ruleStack:q,occurrenceStack:r});else if(s instanceof ao)m.push(function(a,b,c,d){var e=(0,i.T9)(c);e.push(a.name);var f=(0,i.T9)(d);return f.push(1),{idx:b,def:a.definition,ruleStack:e,occurrenceStack:f}}(s,p,q,r));else throw Error("non exhaustive match")}}return l}var aZ=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();!function(a){a[a.OPTION=0]="OPTION",a[a.REPETITION=1]="REPETITION",a[a.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",a[a.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",a[a.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",a[a.ALTERNATION=5]="ALTERNATION"}(e||(e={}));var a$=function(a){function b(b,c,d){var e=a.call(this)||this;return e.topProd=b,e.targetOccurrence=c,e.targetProdType=d,e}return aZ(b,a),b.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},b.prototype.checkIsTarget=function(a,b,c,d){return a.idx===this.targetOccurrence&&this.targetProdType===b&&(this.restDef=c.concat(d),!0)},b.prototype.walkOption=function(b,c,d){this.checkIsTarget(b,e.OPTION,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkAtLeastOne=function(b,c,d){this.checkIsTarget(b,e.REPETITION_MANDATORY,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkAtLeastOneSep=function(b,c,d){this.checkIsTarget(b,e.REPETITION_MANDATORY_WITH_SEPARATOR,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkMany=function(b,c,d){this.checkIsTarget(b,e.REPETITION,c,d)||a.prototype.walkOption.call(this,b,c,d)},b.prototype.walkManySep=function(b,c,d){this.checkIsTarget(b,e.REPETITION_WITH_SEPARATOR,c,d)||a.prototype.walkOption.call(this,b,c,d)},b}(az),a_=function(a){function b(b,c,d){var e=a.call(this)||this;return e.targetOccurrence=b,e.targetProdType=c,e.targetRef=d,e.result=[],e}return aZ(b,a),b.prototype.checkIsTarget=function(a,b){a.idx===this.targetOccurrence&&this.targetProdType===b&&(void 0===this.targetRef||a===this.targetRef)&&(this.result=a.definition)},b.prototype.visitOption=function(a){this.checkIsTarget(a,e.OPTION)},b.prototype.visitRepetition=function(a){this.checkIsTarget(a,e.REPETITION)},b.prototype.visitRepetitionMandatory=function(a){this.checkIsTarget(a,e.REPETITION_MANDATORY)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.checkIsTarget(a,e.REPETITION_MANDATORY_WITH_SEPARATOR)},b.prototype.visitRepetitionWithSeparator=function(a){this.checkIsTarget(a,e.REPETITION_WITH_SEPARATOR)},b.prototype.visitAlternation=function(a){this.checkIsTarget(a,e.ALTERNATION)},b}(aB);function a0(a){for(var b=Array(a),c=0;c<a;c++)b[c]=[];return b}function a1(a){for(var b=[""],c=0;c<a.length;c++){for(var d=a[c],e=[],f=0;f<b.length;f++){var g=b[f];e.push(g+"_"+d.tokenTypeIdx);for(var h=0;h<d.categoryMatches.length;h++){var i="_"+d.categoryMatches[h];e.push(g+i)}}b=e}return b}function a2(a,b){for(var c=(0,i.Tj)(a,function(a){return aX([a],1)}),d=a0(c.length),e=(0,i.Tj)(c,function(a){var b={};return(0,i.jJ)(a,function(a){var c=a1(a.partialPath);(0,i.jJ)(c,function(a){b[a]=!0})}),b}),f=c,g=1;g<=b;g++){var h=f;f=a0(h.length);for(var j=function(a){for(var c=h[a],j=0;j<c.length;j++){var k=c[j].partialPath,l=c[j].suffixDef,m=a1(k);if(function(a,b,c){for(var d=0;d<a.length;d++)if(d!==c){for(var e=a[d],f=0;f<b.length;f++)if(!0===e[b[f]])return!1}return!0}(e,m,a)||(0,i.Im)(l)||k.length===b){var n=d[a];if(!1===a5(n,k)){n.push(k);for(var o=0;o<m.length;o++){var p=m[o];e[a][p]=!0}}}else{var q=aX(l,g+1,k);f[a]=f[a].concat(q),(0,i.jJ)(q,function(b){var c=a1(b.partialPath);(0,i.jJ)(c,function(b){e[a][b]=!0})})}}},k=0;k<h.length;k++)j(k)}return d}function a3(a,b,c,d){var f=new a_(a,e.ALTERNATION,d);return b.accept(f),a2(f.result,c)}function a4(a,b,c,d){var e=new a_(a,c);b.accept(e);var f=e.result,g=new a$(b,a,c).startWalking();return a2([new ap({definition:f}),new ap({definition:g})],d)}function a5(a,b){f:for(var c=0;c<a.length;c++){var d=a[c];if(d.length===b.length){for(var e=0;e<d.length;e++){var f=b[e],g=d[e];if(!1==(f===g||void 0!==g.categoryMatchesMap[f.tokenTypeIdx]))continue f}return!0}}return!1}function a6(a){return(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return(0,i.Im)(a.categoryMatches)})})})}var a7=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();function a8(a){return aE(a)+"_#_"+a.idx+"_#_"+a9(a)}function a9(a){return a instanceof aw?a.terminalType.name:a instanceof an?a.nonTerminalName:""}var ba=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.allProductions=[],b}return a7(b,a),b.prototype.visitNonTerminal=function(a){this.allProductions.push(a)},b.prototype.visitOption=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetition=function(a){this.allProductions.push(a)},b.prototype.visitAlternation=function(a){this.allProductions.push(a)},b.prototype.visitTerminal=function(a){this.allProductions.push(a)},b}(aB),bb=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.alternations=[],b}return a7(b,a),b.prototype.visitAlternation=function(a){this.alternations.push(a)},b}(aB),bc=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.allProductions=[],b}return a7(b,a),b.prototype.visitRepetitionWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatory=function(a){this.allProductions.push(a)},b.prototype.visitRepetitionMandatoryWithSeparator=function(a){this.allProductions.push(a)},b.prototype.visitRepetition=function(a){this.allProductions.push(a)},b}(aB);function bd(a){a=(0,i.NT)(a,{errMsgProvider:aM});var b,c={};return(0,i.jJ)(a.rules,function(a){c[a.name]=a}),(b=new aP(c,a.errMsgProvider)).resolveRefs(),b.errors}function be(a){var b,c,d,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return b=(a=(0,i.NT)(a,{errMsgProvider:aN})).rules,c=a.maxLookahead,d=a.tokenTypes,f=a.errMsgProvider,h=a.grammarName,j=i.Tj(b,function(a){var b,c,d,e,h,j;return b=a,c=f,d=new ba,b.accept(d),e=d.allProductions,h=i.$z(e,a8),j=i.Up(h,function(a){return a.length>1}),i.Tj(i.zu(j),function(a){var d=i.$1(a),e=c.buildDuplicateFoundError(b,a),f=aE(d),h={message:e,type:g.DUPLICATE_PRODUCTIONS,ruleName:b.name,dslName:f,occurrence:d.idx},j=a9(d);return j&&(h.parameter=j),h})}),k=i.Tj(b,function(a){return function a(b,c,d,e){void 0===e&&(e=[]);var f=[],h=function a(b){var c=[];if(i.Im(b))return c;var d=i.$1(b);if(d instanceof an)c.push(d.referencedRule);else if(d instanceof ap||d instanceof aq||d instanceof ar||d instanceof as||d instanceof au||d instanceof at)c=c.concat(a(d.definition));else if(d instanceof av)c=i.Bq(i.Tj(d.definition,function(b){return a(b.definition)}));else if(d instanceof aw);else throw Error("non exhaustive match");var e=aD(d),f=b.length>1;if(!e||!f)return c;var g=i.gv(b);return c.concat(a(g))}(c.definition);if(i.Im(h))return[];var j=b.name;i.gR(h,b)&&f.push({message:d.buildLeftRecursionError({topLevelRule:b,leftRecursionPath:e}),type:g.LEFT_RECURSION,ruleName:j});var k=i.iv(h,e.concat([b])),l=i.Tj(k,function(c){var f=i.T9(e);return f.push(c),a(b,c,d,f)});return f.concat(i.Bq(l))}(a,a,f)}),l=[],m=[],n=[],(0,i.Si)(k,i.Im)&&(l=(0,i.Tj)(b,function(a){var b,c,d,e;return b=a,c=f,d=new bb,b.accept(d),e=d.alternations,i.TS(e,function(a,d){var e=i.gc(d.definition),f=i.Tj(e,function(a,e){var f=aY([a],[],null,1);return i.Im(f)?{message:c.buildEmptyAlternationError({topLevelRule:b,alternation:d,emptyChoiceIdx:e}),type:g.NONE_LAST_EMPTY_ALT,ruleName:b.name,occurrence:d.idx,alternative:e+1}:null});return a.concat(i.oE(f))},[])}),m=(0,i.Tj)(b,function(a){var b,d,e,h,j;return b=a,d=c,e=f,h=new bb,b.accept(h),j=h.alternations,j=(0,i.ku)(j,function(a){return!0===a.ignoreAmbiguities}),i.TS(j,function(a,c){var f,h,j,k,l,m,n,o,p,q,r,s,t=a3(c.idx,b,c.maxLookahead||d,c),u=(f=t,h=c,j=b,k=e,l=[],m=(0,i.TS)(f,function(a,b,c){return!0===h.definition[c].ignoreAmbiguities||(0,i.jJ)(b,function(b){var d=[c];(0,i.jJ)(f,function(a,e){c!==e&&a5(a,b)&&!0!==h.definition[e].ignoreAmbiguities&&d.push(e)}),d.length>1&&!a5(l,b)&&(l.push(b),a.push({alts:d,path:b}))}),a},[]),i.Tj(m,function(a){var b=(0,i.Tj)(a.alts,function(a){return a+1});return{message:k.buildAlternationAmbiguityError({topLevelRule:j,alternation:h,ambiguityIndices:b,prefixPath:a.path}),type:g.AMBIGUOUS_ALTS,ruleName:j.name,occurrence:h.idx,alternatives:[a.alts]}})),v=(n=t,o=c,p=b,q=e,r=[],s=(0,i.TS)(n,function(a,b,c){var d=(0,i.Tj)(b,function(a){return{idx:c,path:a}});return a.concat(d)},[]),(0,i.jJ)(s,function(a){if(!0!==o.definition[a.idx].ignoreAmbiguities){var b=a.idx,c=a.path,d=(0,i.JW)(s,function(a){var d;return!0!==o.definition[a.idx].ignoreAmbiguities&&a.idx<b&&(d=a.path,d.length<c.length&&(0,i.Si)(d,function(a,b){var d=c[b];return a===d||d.categoryMatchesMap[a.tokenTypeIdx]}))}),e=(0,i.Tj)(d,function(a){var c=[a.idx+1,b+1],d=0===o.idx?"":o.idx;return{message:q.buildAlternationPrefixAmbiguityError({topLevelRule:p,alternation:o,ambiguityIndices:c,prefixPath:a.path}),type:g.AMBIGUOUS_PREFIX_ALTS,ruleName:p.name,occurrence:d,alternatives:c}});r=r.concat(e)}}),r);return a.concat(u,v)},[])}),r=b,s=c,t=f,u=[],(0,i.jJ)(r,function(a){var b=new bc;a.accept(b);var c=b.allProductions;(0,i.jJ)(c,function(b){var c=function(a){if(a instanceof aq)return e.OPTION;if(a instanceof at)return e.REPETITION;if(a instanceof ar)return e.REPETITION_MANDATORY;if(a instanceof as)return e.REPETITION_MANDATORY_WITH_SEPARATOR;if(a instanceof au)return e.REPETITION_WITH_SEPARATOR;else if(a instanceof av)return e.ALTERNATION;else throw Error("non exhaustive match")}(b),d=b.maxLookahead||s,f=a4(b.idx,a,c,d)[0];if((0,i.Im)((0,i.Bq)(f))){var h=t.buildEmptyRepetitionError({topLevelRule:a,repetition:b});u.push({message:h,type:g.NO_NON_EMPTY_LOOKAHEAD,ruleName:a.name})}})}),n=u),v=b,w=d,x=f,y=[],z=(0,i.Tj)(w,function(a){return a.name}),(0,i.jJ)(v,function(a){var b=a.name;if((0,i.gR)(z,b)){var c=x.buildNamespaceConflictError(a);y.push({message:c,type:g.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:b})}}),o=y,p=(0,i.Tj)(b,function(a){var b,c,d,e;return b=a,c=f,d=new bb,b.accept(d),e=d.alternations,i.TS(e,function(a,d){return d.definition.length>255&&a.push({message:c.buildTooManyAlternativesError({topLevelRule:b,alternation:d}),type:g.TOO_MANY_ALTS,ruleName:b.name,occurrence:d.idx}),a},[])}),q=(0,i.Tj)(b,function(a){var c=a,d=b,e=h,j=f,k=[];if((0,i.TS)(d,function(a,b){return b.name===c.name?a+1:a},0)>1){var l=j.buildDuplicateRuleNameError({topLevelRule:c,grammarName:e});k.push({message:l,type:g.DUPLICATE_RULE_NAME,ruleName:c.name})}return k}),i.Bq(j.concat(n,k,l,m,o,p,q))}function bf(a){(0,i.jJ)(a.rules,function(a){var b=new aF;a.accept(b),(0,i.jJ)(b.dslMethods,function(a){(0,i.jJ)(a,function(a,b){a.idx=b+1})})})}var bg=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),bh="MismatchedTokenException",bi="NoViableAltException",bj="EarlyExitException",bk="NotAllInputParsedException",bl=[bh,bi,bj,bk];function bm(a){return(0,i.gR)(bl,a.name)}Object.freeze(bl);var bn=function(a){function b(b,c){var d=this.constructor,e=a.call(this,b)||this;return e.token=c,e.resyncedTokens=[],Object.setPrototypeOf(e,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,e.constructor),e}return bg(b,a),b}(Error),bo=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bh,e}return bg(b,a),b}(bn),bp=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bi,e}return bg(b,a),b}(bn),bq=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.name=bk,d}return bg(b,a),b}(bn),br=function(a){function b(b,c,d){var e=a.call(this,b,c)||this;return e.previousToken=d,e.name=bj,e}return bg(b,a),b}(bn),bs={},bt="InRuleRecoveryException";function bu(a){this.name=bt,this.message=a}bu.prototype=Error.prototype;var bv=function(){function a(){}return a.prototype.initRecoverable=function(a){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,i.zy)(a,"recoveryEnabled")?a.recoveryEnabled:bX.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bw)},a.prototype.getTokenToInsert=function(a){var b=aj(a,"",NaN,NaN,NaN,NaN,NaN,NaN);return b.isInsertedInRecovery=!0,b},a.prototype.canTokenTypeBeInsertedInRecovery=function(a){return!0},a.prototype.tryInRepetitionRecovery=function(a,b,c,d){for(var e=this,f=this.findReSyncTokenType(),g=this.exportLexerState(),h=[],j=!1,k=this.LA(1),l=this.LA(1),m=function(){var a=e.LA(0),b=new bo(e.errorMessageProvider.buildMismatchTokenMessage({expected:d,actual:k,previous:a,ruleName:e.getCurrRuleFullName()}),k,e.LA(0));b.resyncedTokens=(0,i.gc)(h),e.SAVE_ERROR(b)};!j;)if(this.tokenMatcher(l,d))return void m();else if(c.call(this)){m(),a.apply(this,b);return}else this.tokenMatcher(l,f)?j=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,h));this.importLexerState(g)},a.prototype.shouldInRepetitionRecoveryBeTried=function(a,b,c){return!(!1===c||void 0===a||void 0===b||this.tokenMatcher(this.LA(1),a)||this.isBackTracking()||this.canPerformInRuleRecovery(a,this.getFollowsForInRuleRecovery(a,b)))},a.prototype.getFollowsForInRuleRecovery=function(a,b){var c=this.getCurrentGrammarPath(a,b);return this.getNextPossibleTokenTypes(c)},a.prototype.tryInRuleRecovery=function(a,b){if(this.canRecoverWithSingleTokenInsertion(a,b))return this.getTokenToInsert(a);if(this.canRecoverWithSingleTokenDeletion(a)){var c=this.SKIP_TOKEN();return this.consumeToken(),c}throw new bu("sad sad panda")},a.prototype.canPerformInRuleRecovery=function(a,b){return this.canRecoverWithSingleTokenInsertion(a,b)||this.canRecoverWithSingleTokenDeletion(a)},a.prototype.canRecoverWithSingleTokenInsertion=function(a,b){var c=this;if(!this.canTokenTypeBeInsertedInRecovery(a)||(0,i.Im)(b))return!1;var d=this.LA(1);return void 0!==(0,i.I6)(b,function(a){return c.tokenMatcher(d,a)})},a.prototype.canRecoverWithSingleTokenDeletion=function(a){return this.tokenMatcher(this.LA(2),a)},a.prototype.isInCurrentRuleReSyncSet=function(a){var b=this.getCurrFollowKey(),c=this.getFollowSetFromFollowKey(b);return(0,i.gR)(c,a)},a.prototype.findReSyncTokenType=function(){for(var a=this.flattenFollowSet(),b=this.LA(1),c=2;;){var d=b.tokenType;if((0,i.gR)(a,d))return d;b=this.LA(c),c++}},a.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return bs;var a=this.getLastExplicitRuleShortName(),b=this.getLastExplicitRuleOccurrenceIndex(),c=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(a),idxInCallingRule:b,inRule:this.shortRuleNameToFullName(c)}},a.prototype.buildFullFollowKeyStack=function(){var a=this,b=this.RULE_STACK,c=this.RULE_OCCURRENCE_STACK;return(0,i.Tj)(b,function(d,e){return 0===e?bs:{ruleName:a.shortRuleNameToFullName(d),idxInCallingRule:c[e],inRule:a.shortRuleNameToFullName(b[e-1])}})},a.prototype.flattenFollowSet=function(){var a=this,b=(0,i.Tj)(this.buildFullFollowKeyStack(),function(b){return a.getFollowSetFromFollowKey(b)});return(0,i.Bq)(b)},a.prototype.getFollowSetFromFollowKey=function(a){if(a===bs)return[ai];var b=a.ruleName+a.idxInCallingRule+aI+a.inRule;return this.resyncFollows[b]},a.prototype.addToResyncTokens=function(a,b){return this.tokenMatcher(a,ai)||b.push(a),b},a.prototype.reSyncTo=function(a){for(var b=[],c=this.LA(1);!1===this.tokenMatcher(c,a);)c=this.SKIP_TOKEN(),this.addToResyncTokens(c,b);return(0,i.gc)(b)},a.prototype.attemptInRepetitionRecovery=function(a,b,c,d,e,f,g){},a.prototype.getCurrentGrammarPath=function(a,b){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:(0,i.T9)(this.RULE_OCCURRENCE_STACK),lastTok:a,lastTokOccurrence:b}},a.prototype.getHumanReadableRuleStack=function(){var a=this;return(0,i.Tj)(this.RULE_STACK,function(b){return a.shortRuleNameToFullName(b)})},a}();function bw(a,b,c,d,e,f,g){var h=this.getKeyForAutomaticLookahead(d,e),i=this.firstAfterRepMap[h];if(void 0===i){var j=this.getCurrRuleFullName();i=new f(this.getGAstProductions()[j],e).startWalking(),this.firstAfterRepMap[h]=i}var k=i.token,l=i.occurrence,m=i.isEndOfRule;1===this.RULE_STACK.length&&m&&void 0===k&&(k=ai,l=1),this.shouldInRepetitionRecoveryBeTried(k,l,g)&&this.tryInRepetitionRecovery(a,b,c,k)}var bx=function(){function a(){}return a.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=(0,i.zy)(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:bX.dynamicTokensEnabled,this.maxLookahead=(0,i.zy)(a,"maxLookahead")?a.maxLookahead:bX.maxLookahead,this.lookAheadFuncsCache=(0,i.rF)()?new Map:[],(0,i.rF)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},a.prototype.preComputeLookaheadFunctions=function(a){var b=this;(0,i.jJ)(a,function(a){b.TRACE_INIT(a.name+" Rule Lookahead",function(){var c,d=(aG.reset(),a.accept(aG),c=aG.dslMethods,aG.reset(),c),f=d.alternation,g=d.repetition,h=d.option,j=d.repetitionMandatory,k=d.repetitionMandatoryWithSeparator,l=d.repetitionWithSeparator;(0,i.jJ)(f,function(c){var d=0===c.idx?"":c.idx;b.TRACE_INIT(""+aE(c)+d,function(){var d,e,f,g,h,i,j,k,l=(d=c.idx,e=c.maxLookahead||b.maxLookahead,f=c.hasPredicates,g=b.dynamicTokensEnabled,h=b.lookAheadBuilderForAlternatives,j=a6(i=a3(d,a,e))?M:L,h(i,f,j,g)),m=(k=b.fullRuleNameToShort[a.name],256|c.idx|k);b.setLaFuncCache(m,l)})}),(0,i.jJ)(g,function(c){b.computeLookaheadFunc(a,c.idx,768,e.REPETITION,c.maxLookahead,aE(c))}),(0,i.jJ)(h,function(c){b.computeLookaheadFunc(a,c.idx,512,e.OPTION,c.maxLookahead,aE(c))}),(0,i.jJ)(j,function(c){b.computeLookaheadFunc(a,c.idx,1024,e.REPETITION_MANDATORY,c.maxLookahead,aE(c))}),(0,i.jJ)(k,function(c){b.computeLookaheadFunc(a,c.idx,1536,e.REPETITION_MANDATORY_WITH_SEPARATOR,c.maxLookahead,aE(c))}),(0,i.jJ)(l,function(c){b.computeLookaheadFunc(a,c.idx,1280,e.REPETITION_WITH_SEPARATOR,c.maxLookahead,aE(c))})})})},a.prototype.computeLookaheadFunc=function(a,b,c,d,e,f){var g=this;this.TRACE_INIT(""+f+(0===b?"":b),function(){var f,h,i,j,k,l=(f=e||g.maxLookahead,h=g.dynamicTokensEnabled,i=g.lookAheadBuilderForOptional,k=a6(j=a4(b,a,d,f))?M:L,i(j[0],k,h)),m=b|c|g.fullRuleNameToShort[a.name];g.setLaFuncCache(m,l)})},a.prototype.lookAheadBuilderForOptional=function(a,b,c){return function(a,b,c){var d=(0,i.Si)(a,function(a){return 1===a.length}),e=a.length;if(!d||c)return function(){g:for(var c=0;c<e;c++){for(var d=a[c],f=d.length,g=0;g<f;g++)if(!1===b(this.LA(g+1),d[g]))continue g;return!0}return!1};var f=(0,i.Bq)(a);if(1===f.length&&(0,i.Im)(f[0].categoryMatches)){var g=f[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===g}}var h=(0,i.TS)(f,function(a,b,c){return a[b.tokenTypeIdx]=!0,(0,i.jJ)(b.categoryMatches,function(b){a[b]=!0}),a},[]);return function(){return!0===h[this.LA(1).tokenTypeIdx]}}(a,b,c)},a.prototype.lookAheadBuilderForAlternatives=function(a,b,c,d){var e=a.length,f=(0,i.Si)(a,function(a){return(0,i.Si)(a,function(a){return 1===a.length})});if(b)return function(b){for(var d=(0,i.Tj)(b,function(a){return a.GATE}),f=0;f<e;f++){var g=a[f],h=g.length,j=d[f];if(void 0===j||!1!==j.call(this))g:for(var k=0;k<h;k++){for(var l=g[k],m=l.length,n=0;n<m;n++)if(!1===c(this.LA(n+1),l[n]))continue g;return f}}};if(!f||d)return function(){for(var b=0;b<e;b++){var d=a[b],f=d.length;g:for(var g=0;g<f;g++){for(var h=d[g],i=h.length,j=0;j<i;j++)if(!1===c(this.LA(j+1),h[j]))continue g;return b}}};var g=(0,i.Tj)(a,function(a){return(0,i.Bq)(a)}),h=(0,i.TS)(g,function(a,b,c){return(0,i.jJ)(b,function(b){(0,i.zy)(a,b.tokenTypeIdx)||(a[b.tokenTypeIdx]=c),(0,i.jJ)(b.categoryMatches,function(b){(0,i.zy)(a,b)||(a[b]=c)})}),a},[]);return function(){return h[this.LA(1).tokenTypeIdx]}},a.prototype.getKeyForAutomaticLookahead=function(a,b){return b|a|this.getLastExplicitRuleShortName()},a.prototype.getLaFuncFromCache=function(a){},a.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},a.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},a.prototype.setLaFuncCache=function(a,b){},a.prototype.setLaFuncCacheUsingMap=function(a,b){this.lookAheadFuncsCache.set(a,b)},a.prototype.setLaFuncUsingObj=function(a,b){this.lookAheadFuncsCache[a]=b},a}();function by(a,b){!0===isNaN(a.startOffset)?(a.startOffset=b.startOffset,a.endOffset=b.endOffset):a.endOffset<b.endOffset==!0&&(a.endOffset=b.endOffset)}function bz(a,b){!0===isNaN(a.startOffset)?(a.startOffset=b.startOffset,a.startColumn=b.startColumn,a.startLine=b.startLine,a.endOffset=b.endOffset,a.endColumn=b.endColumn,a.endLine=b.endLine):a.endOffset<b.endOffset==!0&&(a.endOffset=b.endOffset,a.endColumn=b.endColumn,a.endLine=b.endLine)}var bA="name";function bB(a){var b=a.name;return b||"anonymous"}function bC(a,b){var c=Object.getOwnPropertyDescriptor(a,bA);return(!!(0,i.b0)(c)||!!c.configurable)&&(Object.defineProperty(a,bA,{enumerable:!1,configurable:!0,writable:!1,value:b}),!0)}function bD(a,b){for(var c=(0,i.HP)(a),d=c.length,e=0;e<d;e++)for(var f=a[c[e]],g=f.length,h=0;h<g;h++){var j=f[h];void 0===j.tokenTypeIdx&&this[j.name](j.children,b)}}!function(a){a[a.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",a[a.MISSING_METHOD=1]="MISSING_METHOD"}(f||(f={}));var bE=["constructor","visit","validateVisitor"],bF=function(){function a(){}return a.prototype.initTreeBuilder=function(a){if(this.CST_STACK=[],this.outputCst=a.outputCst,this.nodeLocationTracking=(0,i.zy)(a,"nodeLocationTracking")?a.nodeLocationTracking:bX.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=bz,this.setNodeLocationFromNode=bz,this.cstPostRule=i.tE,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=by,this.setNodeLocationFromNode=by,this.cstPostRule=i.tE,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=i.tE,this.setNodeLocationFromNode=i.tE,this.cstPostRule=i.tE,this.setInitialNodeLocation=i.tE;else throw Error('Invalid <nodeLocationTracking> config option: "'+a.nodeLocationTracking+'"');else this.cstInvocationStateUpdate=i.tE,this.cstFinallyStateUpdate=i.tE,this.cstPostTerminal=i.tE,this.cstPostNonTerminal=i.tE,this.cstPostRule=i.tE},a.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(a){a.location={startOffset:NaN,endOffset:NaN}},a.prototype.setInitialNodeLocationOnlyOffsetRegular=function(a){a.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},a.prototype.setInitialNodeLocationFullRecovery=function(a){a.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},a.prototype.setInitialNodeLocationFullRegular=function(a){var b=this.LA(1);a.location={startOffset:b.startOffset,startLine:b.startLine,startColumn:b.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},a.prototype.cstInvocationStateUpdate=function(a,b){var c={name:a,children:{}};this.setInitialNodeLocation(c),this.CST_STACK.push(c)},a.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},a.prototype.cstPostRuleFull=function(a){var b=this.LA(0),c=a.location;c.startOffset<=b.startOffset==!0?(c.endOffset=b.endOffset,c.endLine=b.endLine,c.endColumn=b.endColumn):(c.startOffset=NaN,c.startLine=NaN,c.startColumn=NaN)},a.prototype.cstPostRuleOnlyOffset=function(a){var b=this.LA(0),c=a.location;c.startOffset<=b.startOffset==!0?c.endOffset=b.endOffset:c.startOffset=NaN},a.prototype.cstPostTerminal=function(a,b){var c=this.CST_STACK[this.CST_STACK.length-1];void 0===c.children[a]?c.children[a]=[b]:c.children[a].push(b),this.setNodeLocationFromToken(c.location,b)},a.prototype.cstPostNonTerminal=function(a,b){var c=this.CST_STACK[this.CST_STACK.length-1];void 0===c.children[b]?c.children[b]=[a]:c.children[b].push(a),this.setNodeLocationFromNode(c.location,a.location)},a.prototype.getBaseCstVisitorConstructor=function(){if((0,i.b0)(this.baseCstVisitorConstructor)){var a,b,c,d=(a=this.className,b=(0,i.HP)(this.gastProductionsCache),bC(c=function(){},a+"BaseSemantics"),c.prototype={visit:function(a,b){if((0,i.cy)(a)&&(a=a[0]),!(0,i.b0)(a))return this[a.name](a.children,b)},validateVisitor:function(){var a,c,d,e,g,h,j,k=(a=this,c=b,h=(d=a,e=c,g=(0,i.Tj)(e,function(a){if(!(0,i.Tn)(d[a]))return{msg:"Missing visitor method: <"+a+"> on "+bB(d.constructor)+" CST Visitor.",type:f.MISSING_METHOD,methodName:a}}),(0,i.oE)(g)),j=function(a,b){var c=[];for(var d in a)!(0,i.Tn)(a[d])||(0,i.gR)(bE,d)||(0,i.gR)(b,d)||c.push({msg:"Redundant visitor method: <"+d+"> on "+bB(a.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\n",type:f.REDUNDANT_METHOD,methodName:d});return c}(a,c),h.concat(j));if(!(0,i.Im)(k)){var l=(0,i.Tj)(k,function(a){return a.msg});throw Error("Errors Detected in CST Visitor <"+bB(this.constructor)+">:\n "+l.join("\n\n").replace(/\n/g,"\n "))}}},c.prototype.constructor=c,c._RULE_NAMES=b,c);return this.baseCstVisitorConstructor=d,d}return this.baseCstVisitorConstructor},a.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,i.b0)(this.baseCstVisitorWithDefaultsConstructor)){var a,b,c,d,e,f=(a=this.className,b=(0,i.HP)(this.gastProductionsCache),c=this.getBaseCstVisitorConstructor(),bC(d=function(){},a+"BaseSemanticsWithDefaults"),e=Object.create(c.prototype),(0,i.jJ)(b,function(a){e[a]=bD}),d.prototype=e,d.prototype.constructor=d,d);return this.baseCstVisitorWithDefaultsConstructor=f,f}return this.baseCstVisitorWithDefaultsConstructor},a.prototype.getLastExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-1]},a.prototype.getPreviousExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-2]},a.prototype.getLastExplicitRuleOccurrenceIndex=function(){var a=this.RULE_OCCURRENCE_STACK;return a[a.length-1]},a}(),bG=function(){function a(){}return a.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(a.prototype,"input",{get:function(){return this.tokVector},set:function(a){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=a,this.tokVectorLength=a.length},enumerable:!1,configurable:!0}),a.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):bW},a.prototype.LA=function(a){var b=this.currIdx+a;return b<0||this.tokVectorLength<=b?bW:this.tokVector[b]},a.prototype.consumeToken=function(){this.currIdx++},a.prototype.exportLexerState=function(){return this.currIdx},a.prototype.importLexerState=function(a){this.currIdx=a},a.prototype.resetLexerState=function(){this.currIdx=-1},a.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},a.prototype.getLexerPosition=function(){return this.exportLexerState()},a}(),bH=function(){function a(){}return a.prototype.ACTION=function(a){return a.call(this)},a.prototype.consume=function(a,b,c){return this.consumeInternal(b,a,c)},a.prototype.subrule=function(a,b,c){return this.subruleInternal(b,a,c)},a.prototype.option=function(a,b){return this.optionInternal(b,a)},a.prototype.or=function(a,b){return this.orInternal(b,a)},a.prototype.many=function(a,b){return this.manyInternal(a,b)},a.prototype.atLeastOne=function(a,b){return this.atLeastOneInternal(a,b)},a.prototype.CONSUME=function(a,b){return this.consumeInternal(a,0,b)},a.prototype.CONSUME1=function(a,b){return this.consumeInternal(a,1,b)},a.prototype.CONSUME2=function(a,b){return this.consumeInternal(a,2,b)},a.prototype.CONSUME3=function(a,b){return this.consumeInternal(a,3,b)},a.prototype.CONSUME4=function(a,b){return this.consumeInternal(a,4,b)},a.prototype.CONSUME5=function(a,b){return this.consumeInternal(a,5,b)},a.prototype.CONSUME6=function(a,b){return this.consumeInternal(a,6,b)},a.prototype.CONSUME7=function(a,b){return this.consumeInternal(a,7,b)},a.prototype.CONSUME8=function(a,b){return this.consumeInternal(a,8,b)},a.prototype.CONSUME9=function(a,b){return this.consumeInternal(a,9,b)},a.prototype.SUBRULE=function(a,b){return this.subruleInternal(a,0,b)},a.prototype.SUBRULE1=function(a,b){return this.subruleInternal(a,1,b)},a.prototype.SUBRULE2=function(a,b){return this.subruleInternal(a,2,b)},a.prototype.SUBRULE3=function(a,b){return this.subruleInternal(a,3,b)},a.prototype.SUBRULE4=function(a,b){return this.subruleInternal(a,4,b)},a.prototype.SUBRULE5=function(a,b){return this.subruleInternal(a,5,b)},a.prototype.SUBRULE6=function(a,b){return this.subruleInternal(a,6,b)},a.prototype.SUBRULE7=function(a,b){return this.subruleInternal(a,7,b)},a.prototype.SUBRULE8=function(a,b){return this.subruleInternal(a,8,b)},a.prototype.SUBRULE9=function(a,b){return this.subruleInternal(a,9,b)},a.prototype.OPTION=function(a){return this.optionInternal(a,0)},a.prototype.OPTION1=function(a){return this.optionInternal(a,1)},a.prototype.OPTION2=function(a){return this.optionInternal(a,2)},a.prototype.OPTION3=function(a){return this.optionInternal(a,3)},a.prototype.OPTION4=function(a){return this.optionInternal(a,4)},a.prototype.OPTION5=function(a){return this.optionInternal(a,5)},a.prototype.OPTION6=function(a){return this.optionInternal(a,6)},a.prototype.OPTION7=function(a){return this.optionInternal(a,7)},a.prototype.OPTION8=function(a){return this.optionInternal(a,8)},a.prototype.OPTION9=function(a){return this.optionInternal(a,9)},a.prototype.OR=function(a){return this.orInternal(a,0)},a.prototype.OR1=function(a){return this.orInternal(a,1)},a.prototype.OR2=function(a){return this.orInternal(a,2)},a.prototype.OR3=function(a){return this.orInternal(a,3)},a.prototype.OR4=function(a){return this.orInternal(a,4)},a.prototype.OR5=function(a){return this.orInternal(a,5)},a.prototype.OR6=function(a){return this.orInternal(a,6)},a.prototype.OR7=function(a){return this.orInternal(a,7)},a.prototype.OR8=function(a){return this.orInternal(a,8)},a.prototype.OR9=function(a){return this.orInternal(a,9)},a.prototype.MANY=function(a){this.manyInternal(0,a)},a.prototype.MANY1=function(a){this.manyInternal(1,a)},a.prototype.MANY2=function(a){this.manyInternal(2,a)},a.prototype.MANY3=function(a){this.manyInternal(3,a)},a.prototype.MANY4=function(a){this.manyInternal(4,a)},a.prototype.MANY5=function(a){this.manyInternal(5,a)},a.prototype.MANY6=function(a){this.manyInternal(6,a)},a.prototype.MANY7=function(a){this.manyInternal(7,a)},a.prototype.MANY8=function(a){this.manyInternal(8,a)},a.prototype.MANY9=function(a){this.manyInternal(9,a)},a.prototype.MANY_SEP=function(a){this.manySepFirstInternal(0,a)},a.prototype.MANY_SEP1=function(a){this.manySepFirstInternal(1,a)},a.prototype.MANY_SEP2=function(a){this.manySepFirstInternal(2,a)},a.prototype.MANY_SEP3=function(a){this.manySepFirstInternal(3,a)},a.prototype.MANY_SEP4=function(a){this.manySepFirstInternal(4,a)},a.prototype.MANY_SEP5=function(a){this.manySepFirstInternal(5,a)},a.prototype.MANY_SEP6=function(a){this.manySepFirstInternal(6,a)},a.prototype.MANY_SEP7=function(a){this.manySepFirstInternal(7,a)},a.prototype.MANY_SEP8=function(a){this.manySepFirstInternal(8,a)},a.prototype.MANY_SEP9=function(a){this.manySepFirstInternal(9,a)},a.prototype.AT_LEAST_ONE=function(a){this.atLeastOneInternal(0,a)},a.prototype.AT_LEAST_ONE1=function(a){return this.atLeastOneInternal(1,a)},a.prototype.AT_LEAST_ONE2=function(a){this.atLeastOneInternal(2,a)},a.prototype.AT_LEAST_ONE3=function(a){this.atLeastOneInternal(3,a)},a.prototype.AT_LEAST_ONE4=function(a){this.atLeastOneInternal(4,a)},a.prototype.AT_LEAST_ONE5=function(a){this.atLeastOneInternal(5,a)},a.prototype.AT_LEAST_ONE6=function(a){this.atLeastOneInternal(6,a)},a.prototype.AT_LEAST_ONE7=function(a){this.atLeastOneInternal(7,a)},a.prototype.AT_LEAST_ONE8=function(a){this.atLeastOneInternal(8,a)},a.prototype.AT_LEAST_ONE9=function(a){this.atLeastOneInternal(9,a)},a.prototype.AT_LEAST_ONE_SEP=function(a){this.atLeastOneSepFirstInternal(0,a)},a.prototype.AT_LEAST_ONE_SEP1=function(a){this.atLeastOneSepFirstInternal(1,a)},a.prototype.AT_LEAST_ONE_SEP2=function(a){this.atLeastOneSepFirstInternal(2,a)},a.prototype.AT_LEAST_ONE_SEP3=function(a){this.atLeastOneSepFirstInternal(3,a)},a.prototype.AT_LEAST_ONE_SEP4=function(a){this.atLeastOneSepFirstInternal(4,a)},a.prototype.AT_LEAST_ONE_SEP5=function(a){this.atLeastOneSepFirstInternal(5,a)},a.prototype.AT_LEAST_ONE_SEP6=function(a){this.atLeastOneSepFirstInternal(6,a)},a.prototype.AT_LEAST_ONE_SEP7=function(a){this.atLeastOneSepFirstInternal(7,a)},a.prototype.AT_LEAST_ONE_SEP8=function(a){this.atLeastOneSepFirstInternal(8,a)},a.prototype.AT_LEAST_ONE_SEP9=function(a){this.atLeastOneSepFirstInternal(9,a)},a.prototype.RULE=function(a,b,c){if(void 0===c&&(c=bY),(0,i.gR)(this.definedRulesNames,a)){var d={message:aN.buildDuplicateRuleNameError({topLevelRule:a,grammarName:this.className}),type:g.DUPLICATE_RULE_NAME,ruleName:a};this.definitionErrors.push(d)}this.definedRulesNames.push(a);var e=this.defineRule(a,b,c);return this[a]=e,e},a.prototype.OVERRIDE_RULE=function(a,b,c){void 0===c&&(c=bY);var d,e,f,h=[];h=h.concat((d=this.definedRulesNames,e=this.className,f=[],i.gR(d,a)||f.push({message:"Invalid rule override, rule: ->"+a+"<- cannot be overridden in the grammar: ->"+e+"<-as it is not defined in any of the super grammars ",type:g.INVALID_RULE_OVERRIDE,ruleName:a}),f)),this.definitionErrors.push.apply(this.definitionErrors,h);var j=this.defineRule(a,b,c);return this[a]=j,j},a.prototype.BACKTRACK=function(a,b){return function(){this.isBackTrackingStack.push(1);var c=this.saveRecogState();try{return a.apply(this,b),!0}catch(a){if(bm(a))return!1;throw a}finally{this.reloadRecogState(c),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return ax((0,i.zu)(this.gastProductionsCache))},a}(),bI=function(){function a(){}return a.prototype.initRecognizerEngine=function(a,b){if(this.className=bB(this.constructor),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=M,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,i.zy)(b,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details.");if((0,i.cy)(a)){if((0,i.Im)(a))throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0).");if("number"==typeof a[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details.")}if((0,i.cy)(a))this.tokensMap=(0,i.TS)(a,function(a,b){return a[b.name]=b,a},{});else if((0,i.zy)(a,"modes")&&(0,i.Si)((0,i.Bq)((0,i.zu)(a.modes)),S)){var c=(0,i.Bq)((0,i.zu)(a.modes)),d=(0,i.sb)(c);this.tokensMap=(0,i.TS)(d,function(a,b){return a[b.name]=b,a},{})}else if((0,i.Gv)(a))this.tokensMap=(0,i.lR)(a);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ai;var e=(0,i.Si)((0,i.zu)(a),function(a){return(0,i.Im)(a.categoryMatches)});this.tokenMatcher=e?M:L,P((0,i.zu)(this.tokensMap))},a.prototype.defineRule=function(a,b,c){if(this.selfAnalysisDone)throw Error("Grammar rule <"+a+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var d,e=(0,i.zy)(c,"resyncEnabled")?c.resyncEnabled:bY.resyncEnabled,f=(0,i.zy)(c,"recoveryValueFunc")?c.recoveryValueFunc:bY.recoveryValueFunc,g=this.ruleShortNameIdx<<12;function h(a){try{if(!0!==this.outputCst)return b.apply(this,a);b.apply(this,a);var c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(a){return this.invokeRuleCatch(a,e,f)}finally{this.ruleFinallyStateUpdate()}}return this.ruleShortNameIdx++,this.shortRuleNameToFull[g]=a,this.fullRuleNameToShort[a]=g,(d=function(b,c){return void 0===b&&(b=0),this.ruleInvocationStateUpdate(g,a,b),h.call(this,c)}).ruleName=a,d.originalGrammarAction=b,d},a.prototype.invokeRuleCatch=function(a,b,c){var d=1===this.RULE_STACK.length,e=b&&!this.isBackTracking()&&this.recoveryEnabled;if(bm(a)){if(e){var f=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(f)){if(a.resyncedTokens=this.reSyncTo(f),!this.outputCst)return c();var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,a.partialCstResult=g}throw a}if(d)return this.moveToTerminatedState(),c()}throw a},a.prototype.optionInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(512,b);return this.optionInternalLogic(a,b,c)},a.prototype.optionInternalLogic=function(a,b,c){var d,e,f=this,g=this.getLaFuncFromCache(c);if(void 0!==a.DEF){if(d=a.DEF,void 0!==(e=a.GATE)){var h=g;g=function(){return e.call(f)&&h.call(f)}}}else d=a;if(!0===g.call(this))return d.call(this)},a.prototype.atLeastOneInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1024,a);return this.atLeastOneInternalLogic(a,b,c)},a.prototype.atLeastOneInternalLogic=function(a,b,c){var d,f,g=this,h=this.getLaFuncFromCache(c);if(void 0!==b.DEF){if(d=b.DEF,void 0!==(f=b.GATE)){var i=h;h=function(){return f.call(g)&&i.call(g)}}}else d=b;if(!0===h.call(this))for(var j=this.doSingleRepetition(d);!0===h.call(this)&&!0===j;)j=this.doSingleRepetition(d);else throw this.raiseEarlyExitException(a,e.REPETITION_MANDATORY,b.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[a,b],h,1024,a,aV)},a.prototype.atLeastOneSepFirstInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1536,a);this.atLeastOneSepFirstInternalLogic(a,b,c)},a.prototype.atLeastOneSepFirstInternalLogic=function(a,b,c){var d=this,f=b.DEF,g=b.SEP;if(!0===this.getLaFuncFromCache(c).call(this)){f.call(this);for(var h=function(){return d.tokenMatcher(d.LA(1),g)};!0===this.tokenMatcher(this.LA(1),g);)this.CONSUME(g),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,g,h,f,aW],h,1536,a,aW)}else throw this.raiseEarlyExitException(a,e.REPETITION_MANDATORY_WITH_SEPARATOR,b.ERR_MSG)},a.prototype.manyInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(768,a);return this.manyInternalLogic(a,b,c)},a.prototype.manyInternalLogic=function(a,b,c){var d,e,f=this,g=this.getLaFuncFromCache(c);if(void 0!==b.DEF){if(d=b.DEF,void 0!==(e=b.GATE)){var h=g;g=function(){return e.call(f)&&h.call(f)}}}else d=b;for(var i=!0;!0===g.call(this)&&!0===i;)i=this.doSingleRepetition(d);this.attemptInRepetitionRecovery(this.manyInternal,[a,b],g,768,a,aT,i)},a.prototype.manySepFirstInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(1280,a);this.manySepFirstInternalLogic(a,b,c)},a.prototype.manySepFirstInternalLogic=function(a,b,c){var d=this,e=b.DEF,f=b.SEP;if(!0===this.getLaFuncFromCache(c).call(this)){e.call(this);for(var g=function(){return d.tokenMatcher(d.LA(1),f)};!0===this.tokenMatcher(this.LA(1),f);)this.CONSUME(f),e.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,f,g,e,aU],g,1280,a,aU)}},a.prototype.repetitionSepSecondInternal=function(a,b,c,d,e){for(;c();)this.CONSUME(b),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[a,b,c,d,e],c,1536,a,e)},a.prototype.doSingleRepetition=function(a){var b=this.getLexerPosition();return a.call(this),this.getLexerPosition()>b},a.prototype.orInternal=function(a,b){var c=this.getKeyForAutomaticLookahead(256,b),d=(0,i.cy)(a)?a:a.DEF,e=this.getLaFuncFromCache(c).call(this,d);if(void 0!==e)return d[e].ALT.call(this);this.raiseNoAltException(b,a.ERR_MSG)},a.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var a=this.LA(1),b=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:a,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new bq(b,a))}},a.prototype.subruleInternal=function(a,b,c){var d;try{var e=void 0!==c?c.ARGS:void 0;return d=a.call(this,b,e),this.cstPostNonTerminal(d,void 0!==c&&void 0!==c.LABEL?c.LABEL:a.ruleName),d}catch(b){this.subruleInternalError(b,c,a.ruleName)}},a.prototype.subruleInternalError=function(a,b,c){throw bm(a)&&void 0!==a.partialCstResult&&(this.cstPostNonTerminal(a.partialCstResult,void 0!==b&&void 0!==b.LABEL?b.LABEL:c),delete a.partialCstResult),a},a.prototype.consumeInternal=function(a,b,c){var d;try{var e=this.LA(1);!0===this.tokenMatcher(e,a)?(this.consumeToken(),d=e):this.consumeInternalError(a,e,c)}catch(c){d=this.consumeInternalRecovery(a,b,c)}return this.cstPostTerminal(void 0!==c&&void 0!==c.LABEL?c.LABEL:a.name,d),d},a.prototype.consumeInternalError=function(a,b,c){var d,e=this.LA(0);throw d=void 0!==c&&c.ERR_MSG?c.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:a,actual:b,previous:e,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new bo(d,b,e))},a.prototype.consumeInternalRecovery=function(a,b,c){if(this.recoveryEnabled&&"MismatchedTokenException"===c.name&&!this.isBackTracking()){var d=this.getFollowsForInRuleRecovery(a,b);try{return this.tryInRuleRecovery(a,d)}catch(a){if(a.name===bt)throw c;throw a}}throw c},a.prototype.saveRecogState=function(){var a=this.errors,b=(0,i.T9)(this.RULE_STACK);return{errors:a,lexerState:this.exportLexerState(),RULE_STACK:b,CST_STACK:this.CST_STACK}},a.prototype.reloadRecogState=function(a){this.errors=a.errors,this.importLexerState(a.lexerState),this.RULE_STACK=a.RULE_STACK},a.prototype.ruleInvocationStateUpdate=function(a,b,c){this.RULE_OCCURRENCE_STACK.push(c),this.RULE_STACK.push(a),this.cstInvocationStateUpdate(b,a)},a.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},a.prototype.getCurrRuleFullName=function(){var a=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[a]},a.prototype.shortRuleNameToFullName=function(a){return this.shortRuleNameToFull[a]},a.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),ai)},a.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},a}(),bJ=function(){function a(){}return a.prototype.initErrorHandler=function(a){this._errors=[],this.errorMessageProvider=(0,i.zy)(a,"errorMessageProvider")?a.errorMessageProvider:bX.errorMessageProvider},a.prototype.SAVE_ERROR=function(a){if(bm(a))return a.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,i.T9)(this.RULE_OCCURRENCE_STACK)},this._errors.push(a),a;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(a.prototype,"errors",{get:function(){return(0,i.T9)(this._errors)},set:function(a){this._errors=a},enumerable:!1,configurable:!0}),a.prototype.raiseEarlyExitException=function(a,b,c){for(var d=this.getCurrRuleFullName(),e=a4(a,this.getGAstProductions()[d],b,this.maxLookahead)[0],f=[],g=1;g<=this.maxLookahead;g++)f.push(this.LA(g));var h=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:e,actual:f,previous:this.LA(0),customUserDescription:c,ruleName:d});throw this.SAVE_ERROR(new br(h,this.LA(1),this.LA(0)))},a.prototype.raiseNoAltException=function(a,b){for(var c=this.getCurrRuleFullName(),d=a3(a,this.getGAstProductions()[c],this.maxLookahead),e=[],f=1;f<=this.maxLookahead;f++)e.push(this.LA(f));var g=this.LA(0),h=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:d,actual:e,previous:g,customUserDescription:b,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new bp(h,this.LA(1),g))},a}(),bK=function(){function a(){}return a.prototype.initContentAssist=function(){},a.prototype.computeContentAssist=function(a,b){var c=this.gastProductionsCache[a];if((0,i.b0)(c))throw Error("Rule ->"+a+"<- does not exist in this grammar.");return aY([c],b,this.tokenMatcher,this.maxLookahead)},a.prototype.getNextPossibleTokenTypes=function(a){var b=(0,i.$1)(a.ruleStack);return new aR(this.getGAstProductions()[b],a).startWalking()},a}(),bL={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(bL);var bM=ah({name:"RECORDING_PHASE_TOKEN",pattern:V.NA});P([bM]);var bN=aj(bM,"This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(bN);var bO={name:"This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}},bP=function(){function a(){}return a.prototype.initGastRecorder=function(a){this.recordingProdStack=[],this.RECORDING_PHASE=!1},a.prototype.enableRecording=function(){var a=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var b=function(b){var c=b>0?b:"";a["CONSUME"+c]=function(a,c){return this.consumeInternalRecord(a,b,c)},a["SUBRULE"+c]=function(a,c){return this.subruleInternalRecord(a,b,c)},a["OPTION"+c]=function(a){return this.optionInternalRecord(a,b)},a["OR"+c]=function(a){return this.orInternalRecord(a,b)},a["MANY"+c]=function(a){this.manyInternalRecord(b,a)},a["MANY_SEP"+c]=function(a){this.manySepFirstInternalRecord(b,a)},a["AT_LEAST_ONE"+c]=function(a){this.atLeastOneInternalRecord(b,a)},a["AT_LEAST_ONE_SEP"+c]=function(a){this.atLeastOneSepFirstInternalRecord(b,a)}},c=0;c<10;c++)b(c);a.consume=function(a,b,c){return this.consumeInternalRecord(b,a,c)},a.subrule=function(a,b,c){return this.subruleInternalRecord(b,a,c)},a.option=function(a,b){return this.optionInternalRecord(b,a)},a.or=function(a,b){return this.orInternalRecord(b,a)},a.many=function(a,b){this.manyInternalRecord(a,b)},a.atLeastOne=function(a,b){this.atLeastOneInternalRecord(a,b)},a.ACTION=a.ACTION_RECORD,a.BACKTRACK=a.BACKTRACK_RECORD,a.LA=a.LA_RECORD})},a.prototype.disableRecording=function(){var a=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var b=0;b<10;b++){var c=b>0?b:"";delete a["CONSUME"+c],delete a["SUBRULE"+c],delete a["OPTION"+c],delete a["OR"+c],delete a["MANY"+c],delete a["MANY_SEP"+c],delete a["AT_LEAST_ONE"+c],delete a["AT_LEAST_ONE_SEP"+c]}delete a.consume,delete a.subrule,delete a.option,delete a.or,delete a.many,delete a.atLeastOne,delete a.ACTION,delete a.BACKTRACK,delete a.LA})},a.prototype.ACTION_RECORD=function(a){},a.prototype.BACKTRACK_RECORD=function(a,b){return function(){return!0}},a.prototype.LA_RECORD=function(a){return bW},a.prototype.topLevelRuleRecord=function(a,b){try{var c=new ao({definition:[],name:a});return c.name=a,this.recordingProdStack.push(c),b.call(this),this.recordingProdStack.pop(),c}catch(a){if(!0!==a.KNOWN_RECORDER_ERROR)try{a.message=a.message+'\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(a){}throw a}},a.prototype.optionInternalRecord=function(a,b){return bQ.call(this,aq,a,b)},a.prototype.atLeastOneInternalRecord=function(a,b){bQ.call(this,ar,b,a)},a.prototype.atLeastOneSepFirstInternalRecord=function(a,b){bQ.call(this,as,b,a,!0)},a.prototype.manyInternalRecord=function(a,b){bQ.call(this,at,b,a)},a.prototype.manySepFirstInternalRecord=function(a,b){bQ.call(this,au,b,a,!0)},a.prototype.orInternalRecord=function(a,b){return bR.call(this,a,b)},a.prototype.subruleInternalRecord=function(a,b,c){if(bT(b),!a||!1===(0,i.zy)(a,"ruleName")){var d=Error("<SUBRULE"+bS(b)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(a)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw d.KNOWN_RECORDER_ERROR=!0,d}var e=(0,i.se)(this.recordingProdStack),f=new an({idx:b,nonTerminalName:a.ruleName,referencedRule:void 0});return e.definition.push(f),this.outputCst?bO:bL},a.prototype.consumeInternalRecord=function(a,b,c){if(bT(b),!Q(a)){var d=Error("<CONSUME"+bS(b)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(a)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw d.KNOWN_RECORDER_ERROR=!0,d}var e=(0,i.se)(this.recordingProdStack),f=new aw({idx:b,terminalType:a});return e.definition.push(f),bN},a}();function bQ(a,b,c,d){void 0===d&&(d=!1),bT(c);var e=(0,i.se)(this.recordingProdStack),f=(0,i.Tn)(b)?b:b.DEF,g=new a({definition:[],idx:c});return d&&(g.separator=b.SEP),(0,i.zy)(b,"MAX_LOOKAHEAD")&&(g.maxLookahead=b.MAX_LOOKAHEAD),this.recordingProdStack.push(g),f.call(this),e.definition.push(g),this.recordingProdStack.pop(),bL}function bR(a,b){var c=this;bT(b);var d=(0,i.se)(this.recordingProdStack),e=!1===(0,i.cy)(a),f=!1===e?a:a.DEF,g=new av({definition:[],idx:b,ignoreAmbiguities:e&&!0===a.IGNORE_AMBIGUITIES});return(0,i.zy)(a,"MAX_LOOKAHEAD")&&(g.maxLookahead=a.MAX_LOOKAHEAD),g.hasPredicates=(0,i.zN)(f,function(a){return(0,i.Tn)(a.GATE)}),d.definition.push(g),(0,i.jJ)(f,function(a){var b=new ap({definition:[]});g.definition.push(b),(0,i.zy)(a,"IGNORE_AMBIGUITIES")?b.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:(0,i.zy)(a,"GATE")&&(b.ignoreAmbiguities=!0),c.recordingProdStack.push(b),a.ALT.call(c),c.recordingProdStack.pop()}),bL}function bS(a){return 0===a?"":""+a}function bT(a){if(a<0||a>255){var b=Error("Invalid DSL Method idx value: <"+a+">\n Idx value must be a none negative value smaller than "+256);throw b.KNOWN_RECORDER_ERROR=!0,b}}var bU=function(){function a(){}return a.prototype.initPerformanceTracer=function(a){if((0,i.zy)(a,"traceInitPerf")){var b=a.traceInitPerf,c="number"==typeof b;this.traceInitMaxIdent=c?b:1/0,this.traceInitPerf=c?b>0:b}else this.traceInitMaxIdent=0,this.traceInitPerf=bX.traceInitPerf;this.traceInitIndent=-1},a.prototype.TRACE_INIT=function(a,b){if(!0!==this.traceInitPerf)return b();this.traceInitIndent++;var c=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(c+"--\x3e <"+a+">");var d=(0,i.O1)(b),e=d.time,f=d.value,g=e>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&g(c+"<-- <"+a+"> time: "+e+"ms"),this.traceInitIndent--,f},a}(),bV=function(){var a=function(b,c){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(b,c)};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),bW=aj(ai,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(bW);var bX=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:aL,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),bY=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});function bZ(a){return void 0===a&&(a=void 0),function(){return a}}!function(a){a[a.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",a[a.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",a[a.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",a[a.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",a[a.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",a[a.LEFT_RECURSION=5]="LEFT_RECURSION",a[a.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",a[a.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",a[a.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",a[a.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",a[a.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",a[a.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",a[a.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(g||(g={}));var b$=function(){function a(a,b){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(b),this.initLexerAdapter(),this.initLooksAhead(b),this.initRecognizerEngine(a,b),this.initRecoverable(b),this.initTreeBuilder(b),this.initContentAssist(),this.initGastRecorder(b),this.initPerformanceTracer(b),(0,i.zy)(b,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=(0,i.zy)(b,"skipValidations")?b.skipValidations:bX.skipValidations}return a.performSelfAnalysis=function(a){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},a.prototype.performSelfAnalysis=function(){var b=this;this.TRACE_INIT("performSelfAnalysis",function(){b.selfAnalysisDone=!0;var c=b.className;b.TRACE_INIT("toFastProps",function(){(0,i.Bl)(b)}),b.TRACE_INIT("Grammar Recording",function(){try{b.enableRecording(),(0,i.jJ)(b.definedRulesNames,function(a){var c=b[a].originalGrammarAction,d=void 0;b.TRACE_INIT(a+" Rule",function(){d=b.topLevelRuleRecord(a,c)}),b.gastProductionsCache[a]=d})}finally{b.disableRecording()}});var d=[];if(b.TRACE_INIT("Grammar Resolving",function(){d=bd({rules:(0,i.zu)(b.gastProductionsCache)}),b.definitionErrors.push.apply(b.definitionErrors,d)}),b.TRACE_INIT("Grammar Validations",function(){if((0,i.Im)(d)&&!1===b.skipValidations){var a=be({rules:(0,i.zu)(b.gastProductionsCache),maxLookahead:b.maxLookahead,tokenTypes:(0,i.zu)(b.tokensMap),errMsgProvider:aN,grammarName:c});b.definitionErrors.push.apply(b.definitionErrors,a)}}),(0,i.Im)(b.definitionErrors)&&(b.recoveryEnabled&&b.TRACE_INIT("computeAllProdsFollows",function(){var a,c,d=(a=(0,i.zu)(b.gastProductionsCache),c={},(0,i.jJ)(a,function(a){var b=new aK(a).startWalking();(0,i.kp)(c,b)}),c);b.resyncFollows=d}),b.TRACE_INIT("ComputeLookaheadFunctions",function(){b.preComputeLookaheadFunctions((0,i.zu)(b.gastProductionsCache))})),!a.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,i.Im)(b.definitionErrors))throw Error("Parser Definition Errors detected:\n "+(0,i.Tj)(b.definitionErrors,function(a){return a.message}).join("\n-------------------------------\n"))})},a.DEFER_DEFINITION_ERRORS_HANDLING=!1,a}();(0,i.XJ)(b$,[bv,bx,bF,bG,bI,bH,bJ,bK,bP,bU]);var b_=function(a){function b(b,c){void 0===c&&(c=bX);var d=(0,i.lR)(c);return d.outputCst=!0,a.call(this,b,d)||this}return bV(b,a),b}(b$),b0=function(a){function b(b,c){void 0===c&&(c=bX);var d=(0,i.lR)(c);return d.outputCst=!1,a.call(this,b,d)||this}return bV(b,a),b}(b$);function b1(a,b){var c=void 0===b?{}:b,d=c.resourceBase,e=void 0===d?"https://unpkg.com/chevrotain@"+h+"/diagrams/":d,f=c.css;return"\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<style>\n body {\n background-color: hsl(30, 20%, 95%)\n }\n</style>\n\n\n<link rel='stylesheet' href='"+(void 0===f?"https://unpkg.com/chevrotain@"+h+"/diagrams/diagrams.css":f)+"'>\n"+("\n<script src='"+e+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+e+"src/diagrams_builder.js'><\/script>\n<script src='"+e+"src/diagrams_behavior.js'><\/script>\n<script src='"+e+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div> \n'+("\n<script>\n window.serializedGrammar = "+JSON.stringify(a,null," ")+";\n<\/script>\n")+'\n<script>\n var diagramsDiv = document.getElementById("diagrams");\n main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}function b2(a){var b;return"\nfunction "+a.name+"(tokenVocabulary, config) {\n // invoke super constructor\n // No support for embedded actions currently, so we can 'hardcode'\n // The use of CstParser.\n chevrotain.CstParser.call(this, tokenVocabulary, config)\n\n const $ = this\n\n "+(b=a.rules,(0,i.Tj)(b,function(a){var b,c,d;return c=1,d=b6(1,'$.RULE("'+(b=a).name+'", function() {')+"\n"+b5(b.definition,c+1)+(b6(c+1,"})")+"\n")}).join("\n"))+"\n\n // very important to call this after all the rules have been defined.\n // otherwise the parser may not work correctly as it will lack information\n // derived during the self analysis phase.\n this.performSelfAnalysis(this)\n}\n\n// inheritance as implemented in javascript in the previous decade... :(\n"+a.name+".prototype = Object.create(chevrotain.CstParser.prototype)\n"+a.name+".prototype.constructor = "+a.name+" \n "}function b3(a,b,c){var d=b6(c,"$."+(a+b.idx)+"(");return b.separator?(d+="{\n",d+=b6(c+1,"SEP: this.tokensMap."+b.separator.name)+",\n",d+="DEF: "+b4(b.definition,c+2)+"\n",d+=b6(c,"}")+"\n"):d+=b4(b.definition,c+1),d+=b6(c,")")+"\n"}function b4(a,b){var c="function() {\n";return c+=b5(a,b),c+=b6(b,"}")+"\n"}function b5(a,b){var c="";return(0,i.jJ)(a,function(a){c+=function(a,b){var c;if(a instanceof an)return b6(b,"$.SUBRULE"+a.idx+"($."+a.nonTerminalName+")\n");if(a instanceof aq)return b3("OPTION",a,b);if(a instanceof ar)return b3("AT_LEAST_ONE",a,b);if(a instanceof as)return b3("AT_LEAST_ONE_SEP",a,b);if(a instanceof au)return b3("MANY_SEP",a,b);else if(a instanceof at)return b3("MANY",a,b);else if(a instanceof av)return b6(b,"$.OR"+a.idx+"([")+"\n"+(0,i.Tj)(a.definition,function(a){var c,d,e;return c=a,e=b6(d=b+1,"{")+"\n"+(b6(d+1,"ALT: function() {")+"\n")+b5(c.definition,d+1)+(b6(d+1,"}")+"\n")+b6(d,"}")}).join(",\n")+"\n"+b6(b,"])\n");else if(a instanceof aw)return c=a.terminalType.name,b6(b,"$.CONSUME"+a.idx+"(this.tokensMap."+c+")\n");else if(a instanceof ap)return b5(a.definition,b);else throw Error("non exhaustive match")}(a,b+1)}),c}function b6(a,b){return Array(4*a+1).join(" ")+b}function b7(a){var b,d=Function("tokenVocabulary","config","chevrotain"," \n"+b2(b={name:a.name,rules:a.rules})+"\nreturn new "+b.name+"(tokenVocabulary, config) \n");return function(b){return d(a.tokenVocabulary,b,c(704092))}}function b8(a){var b;return"\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['chevrotain'], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require('chevrotain'));\n } else {\n // Browser globals (root is window)\n root.returnExports = factory(root.b);\n }\n}(typeof self !== 'undefined' ? self : this, function (chevrotain) {\n\n"+b2(b={name:a.name,rules:a.rules})+"\n \nreturn {\n "+b.name+": "+b.name+" \n}\n}));\n"}function b9(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n It performs no action other than printing this message.\n Please avoid using it as it will be completely removed in the future")}var ca=function(){throw Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead. \nSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0")}},706575:(a,b,c)=>{"use strict";c.d(b,{x:()=>g});var d=c(736927),e=c(115962),f=c(86839);function g({relatedObjectName:a,value:b,multiple:c=!1,onChange:g,placeholder:h,variant:i="modal",autoFocus:j=!1}){let[k,l]=(0,e.useState)(j),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)([]),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(()=>(function(a){if(!a)return[];let b=a.trim();if(!b)return[];if(b.startsWith("["))try{let a=JSON.parse(b);if(Array.isArray(a))return a.map(String).filter(Boolean)}catch{}return[b]})(b)),u=(0,e.useRef)(null),v=(0,e.useRef)(null);(0,e.useRef)(null),(0,e.useCallback)(async b=>{r(!0);try{let c=new URLSearchParams;b&&c.set("q",b);let d=await fetch(`/api/workspace/objects/${encodeURIComponent(a)}/entries/options?${c}`);if(d.ok){let a=await d.json();p(a.options??[])}}catch{}finally{r(!1)}},[a]);let w=s.map(a=>{let b=o.find(b=>b.id===a),c=b?.label??a;return{id:a,label:String(null!=c&&"object"==typeof c?JSON.stringify(c):c??"")}}),x="inline"===i;return(0,d.jsxs)("div",{ref:u,className:"relative w-full",children:[(0,d.jsxs)("div",{onClick:()=>l(!k),className:`w-full flex items-center flex-wrap gap-1 cursor-pointer min-h-[1.5em] ${x?"text-xs":"px-3 py-2 text-sm rounded-lg"}`,style:x?{}:{background:"var(--color-surface)",color:"var(--color-text)",border:"1px solid var(--color-border)"},children:[w.length>0?w.map(({id:a,label:b})=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium",style:{background:"rgba(96, 165, 250, 0.1)",color:"#60a5fa",border:"1px solid rgba(96, 165, 250, 0.2)"},children:[(0,d.jsx)("span",{className:"truncate max-w-[160px]",children:String(b??"")}),(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation();let d=s.filter(b=>b!==a);t(d),c?g(0===d.length?"":JSON.stringify(d)):g("")},className:"ml-0.5 hover:opacity-70",style:{color:"#60a5fa"},children:(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})]},a)):(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:h??`Select ${(0,f.A3)(a)}...`}),(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-auto flex-shrink-0",style:{color:"var(--color-text-muted)",transform:k?"rotate(180deg)":void 0,transition:"transform 0.15s"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]}),k&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full rounded-lg shadow-lg overflow-hidden",style:{background:"var(--color-bg)",border:"1px solid var(--color-border)",maxHeight:260},children:[(0,d.jsx)("div",{className:"p-2 border-b",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("input",{ref:v,type:"text",value:m,onChange:a=>n(a.target.value),placeholder:`Search ${(0,f.PV)(a)}...`,className:"w-full px-2.5 py-1.5 text-xs rounded-md outline-none",style:{background:"var(--color-surface)",color:"var(--color-text)",border:"1px solid var(--color-border)"},onKeyDown:a=>{"Escape"===a.key&&l(!1)}})}),(0,d.jsx)("div",{className:"overflow-y-auto",style:{maxHeight:200},children:q?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-xs",style:{color:"var(--color-text-muted)"},children:"Loading..."}):0===o.length?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-xs",style:{color:"var(--color-text-muted)"},children:m?"No matches found":"No entries"}):o.map(a=>{let b=s.includes(a.id);return(0,d.jsxs)("button",{type:"button",onClick:()=>(a=>{if(c){let b=s.includes(a)?s.filter(b=>b!==a):[...s,a];t(b),g(0===b.length?"":JSON.stringify(b))}else t([a]),g(a),l(!1)})(a.id),className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors",style:{background:b?"var(--color-accent-light, rgba(96, 165, 250, 0.08))":"transparent",color:"var(--color-text)"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover, rgba(255,255,255,0.04))")},onMouseLeave:a=>{a.currentTarget.style.background=b?"var(--color-accent-light, rgba(96, 165, 250, 0.08))":"transparent"},children:[c&&(0,d.jsx)("span",{className:"w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0",style:{borderColor:b?"var(--color-accent)":"var(--color-border)",background:b?"var(--color-accent)":"transparent"},children:b&&(0,d.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),!c&&b&&(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),(0,d.jsx)("span",{className:"truncate",children:String(null!=a.label&&"object"==typeof a.label?JSON.stringify(a.label):a.label??"")})]},a.id)})})]})]})}},707201:(a,b,c)=>{"use strict";c.d(b,{r:()=>k,y:()=>l});var d=c(736927),e=c(115962);let f={default:{bg:"rgba(148, 163, 184, 0.08)",border:"1px solid rgba(148, 163, 184, 0.2)",text:"var(--color-text)",hoverBg:"rgba(148, 163, 184, 0.15)"},primary:{bg:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",text:"#3b82f6",hoverBg:"rgba(59, 130, 246, 0.15)"},destructive:{bg:"rgba(220, 38, 38, 0.08)",border:"1px solid rgba(220, 38, 38, 0.2)",text:"var(--color-error)",hoverBg:"rgba(220, 38, 38, 0.15)"},success:{bg:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",text:"#22c55e",hoverBg:"rgba(34, 197, 94, 0.15)"},warning:{bg:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",text:"#f59e0b",hoverBg:"rgba(245, 158, 11, 0.15)"}};function g({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"animate-spin",children:(0,d.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function h({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function i({size:a=12}){return(0,d.jsxs)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function j({size:a=12}){return(0,d.jsx)("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polygon",{points:"5 3 19 12 5 21 5 3"})})}function k({action:a,entryId:b,objectName:c,fieldId:k,compact:l=!1,state:m,onExecute:n,onRequestConfirm:o,onToast:p,disabled:q=!1}){let r,s,[t,u]=(0,e.useState)({status:"idle"}),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=m??t,{status:y}=x,z=(0,e.useCallback)(async()=>{if(n)return void n(a,b);u({status:"loading"});let d=new AbortController;w.current=d;try{let e=await fetch(`/api/workspace/objects/${encodeURIComponent(c)}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:a.id,fieldId:k,entryIds:[b]}),signal:d.signal});if(!e.ok){let a=(await e.json().catch(()=>({error:"Request failed"}))).error??"Request failed";u({status:"error",error:a}),p?.(a,{type:"error"});return}let f=e.body?.getReader();if(!f){u({status:"error",error:"No response stream"}),p?.("No response stream",{type:"error"});return}let g=new TextDecoder,h="";for(;;){let{done:b,value:c}=await f.read();if(b)break;let d=(h+=g.decode(c,{stream:!0})).split("\n");for(let b of(h=d.pop()??"",d))if(b.startsWith("data: "))try{let c=JSON.parse(b.slice(6));if("progress"===c.type)u({status:"loading",progress:{percent:c.percent,message:c.message}});else if("log"===c.type)p?.(c.message??"",{type:"error"===c.level?"error":"info"});else if("completed"===c.type)if("success"===c.status)u({status:"success",result:c.result}),p?.(a.successLabel??`${a.label} completed`,{type:"success"}),v.current=setTimeout(()=>{u({status:"idle"})},a.autoResetMs??3e3);else{let b=c.error??"Action failed";u({status:"error",error:b}),p?.(b,{type:"error"}),v.current=setTimeout(()=>{u({status:"idle"})},a.autoResetMs??5e3)}}catch{}}}catch(b){if(d.signal.aborted)return;let a=b instanceof Error?b.message:"Unknown error";u({status:"error",error:a}),p?.(a,{type:"error"})}},[a,b,c,k,n,p]),A=(0,e.useCallback)(c=>{if(c.stopPropagation(),"loading"!==y&&!q){if("error"===y)return void u({status:"idle"});a.confirmMessage&&o?o(a,b,z):z()}},[y,q,a,b,o,z]),B=f[a.variant??"default"]??f.default,C=B.bg,D=B.border,E=B.text;switch(y){case"loading":r=a.loadingLabel??"Running...",s=(0,d.jsx)(g,{size:l?14:12});break;case"success":r=a.successLabel??"Done!",s=(0,d.jsx)(h,{size:l?14:12}),C="rgba(34, 197, 94, 0.1)",D="1px solid rgba(34, 197, 94, 0.3)",E="#22c55e";break;case"error":r=a.errorLabel??"Failed",s=(0,d.jsx)(i,{size:l?14:12}),C="rgba(220, 38, 38, 0.1)",D="1px solid rgba(220, 38, 38, 0.3)",E="var(--color-error)";break;default:r=a.label,s=(0,d.jsx)(j,{size:l?14:12})}let F=x.progress?.percent;return(0,d.jsxs)("button",{type:"button",onClick:A,disabled:"loading"===y||q,className:"relative flex items-center gap-1.5 rounded-lg text-xs font-medium transition-all duration-200 overflow-hidden select-none",style:{padding:l?"4px 6px":"5px 10px",background:C,border:D,color:E,opacity:q?.5:1,cursor:"loading"===y||q?"not-allowed":"pointer"},title:"error"===y?x.error:a.label,onMouseEnter:a=>{"loading"===y||q||(a.currentTarget.style.background=B.hoverBg)},onMouseLeave:a=>{a.currentTarget.style.background=C},children:[null!=F&&"loading"===y&&(0,d.jsx)("div",{className:"absolute inset-0 opacity-15 transition-all duration-300",style:{background:E,width:`${F}%`}}),(0,d.jsxs)("span",{className:"relative z-10 flex items-center gap-1.5",children:[s,!l&&(0,d.jsx)("span",{className:"whitespace-nowrap",children:r})]})]})}function l(){let[a,b]=(0,e.useState)(new Map),[c,d]=(0,e.useState)(new Map),f=(0,e.useCallback)((b,c)=>a.get(`${b}_${c}`)??{status:"idle"},[a]),g=(0,e.useCallback)((a,c,d)=>{b(b=>{let e=new Map(b);return e.set(`${a}_${c}`,d),e})},[]),h=(0,e.useCallback)(async(a,b,c,e,f)=>{let h=e.length,i=0,j=0,k=h;for(let b of e)g(a.id,b,{status:"loading"});d(b=>{let c=new Map(b);return c.set(a.id,{status:"running",running:k,succeeded:i,failed:j,total:h}),c});try{let l=await fetch(`/api/workspace/objects/${encodeURIComponent(c)}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionId:a.id,fieldId:b,entryIds:e})});if(!l.ok){d(b=>{let c=new Map(b);return c.set(a.id,{status:"done",running:0,succeeded:0,failed:h,total:h}),c}),f?.onToast?.(`${a.label} failed to start`,{type:"error"});return}let m=l.body?.getReader();if(!m)return;let n=new TextDecoder,o="";for(;;){let{done:b,value:c}=await m.read();if(b)break;let e=(o+=n.decode(c,{stream:!0})).split("\n");for(let b of(o=e.pop()??"",e))if(b.startsWith("data: "))try{let c=JSON.parse(b.slice(6));if("progress"===c.type&&c.entryId)g(a.id,c.entryId,{status:"loading",progress:{percent:c.percent,message:c.message}});else if("completed"===c.type&&c.entryId){k--,"success"===c.status?(i++,g(a.id,c.entryId,{status:"success",result:c.result})):(j++,g(a.id,c.entryId,{status:"error",error:c.error})),d(b=>{let c=new Map(b);return c.set(a.id,{status:k>0?"running":"done",running:k,succeeded:i,failed:j,total:h}),c});let b=f?.autoResetMs??a.autoResetMs??3e3;setTimeout(()=>{g(a.id,c.entryId,{status:"idle"})},b)}}catch{}}}catch{}d(b=>{let c=new Map(b);return c.set(a.id,{status:"done",running:0,succeeded:i,failed:j,total:h}),c}),j>0?f?.onToast?.(`${a.label}: ${i} succeeded, ${j} failed`,{type:"error"}):i>0&&f?.onToast?.(`${a.label}: ${i} entries completed`,{type:"success"}),setTimeout(()=>{d(b=>{let c=new Map(b);return c.delete(a.id),c})},5e3)},[g]);return{getState:f,setState:g,executeBulkAction:h,bulkStates:c}}},710846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},712410:(a,b,c)=>{"use strict";c.d(b,{x:()=>e});var d=c(502714);function e(a,...b){let c=d.w.bind(null,a||b.find(a=>"object"==typeof a));return b.map(c)}},712557:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__iconNode:()=>e,default:()=>f});var d=c(863928);let e=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],f=(0,d.A)("rocket",e)},714659:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return e}});let d=c(96309)._(c(629395));function e(a,b){var c;let e={};"function"==typeof a&&(e.loader=a);let f={...e,...b};return(0,d.default)({...f,modules:null==(c=f.loadableGenerated)?void 0:c.modules})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},719771:a=>{"use strict";a.exports=require("process")},720511:(a,b,c)=>{"use strict";c.d(b,{KE:()=>cf,YY:()=>b1,CU:()=>bZ,Db:()=>cx,bP:()=>cy,Yv:()=>cz,Nz:()=>ck,gk:()=>a1,AB:()=>cl,T7:()=>aV,Pi:()=>M,GG:()=>cm,Nx:()=>aW,eL:()=>aX,tp:()=>a$,yQ:()=>bc,gu:()=>bg,FF:()=>bh,iI:()=>aZ,hO:()=>bi,fl:()=>bj,Pg:()=>U,zU:()=>a5,q4:()=>be,iR:()=>bf,QN:()=>bn,J_:()=>bo,rU:()=>aD,Op:()=>br,BQ:()=>bs,eE:()=>ah,OX:()=>cg,Zc:()=>cA,KV:()=>a4,jT:()=>ch,Dd:()=>cu,MG:()=>bw,kj:()=>cv,JJ:()=>ci,tG:()=>cj});var d=c(731626),e=c(331480),f=c(381802);let g=(a,b)=>!a.selection.empty&&(b&&b(a.tr.deleteSelection().scrollIntoView()),!0);function h(a,b){let{$cursor:c}=a.selection;return c&&(b?b.endOfTextblock("backward",a):!(c.parentOffset>0))?c:null}let i=(a,b,c)=>{let g=h(a,c);if(!g)return!1;let i=m(g);if(!i){let c=g.blockRange(),e=c&&(0,d.jP)(c);return null!=e&&(b&&b(a.tr.lift(c,e).scrollIntoView()),!0)}let j=i.nodeBefore;if(w(a,i,b,-1))return!0;if(0==g.parent.content.size&&(k(j,"end")||f.nh.isSelectable(j)))for(let c=g.depth;;c--){let h=(0,d.$L)(a.doc,g.before(c),g.after(c),e.Ji.empty);if(h&&h.slice.size<h.to-h.from){if(b){let c=a.tr.step(h);c.setSelection(k(j,"end")?f.LN.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):f.nh.create(c.doc,i.pos-j.nodeSize)),b(c.scrollIntoView())}return!0}if(1==c||g.node(c-1).childCount>1)break}return!!j.isAtom&&i.depth==g.depth-1&&(b&&b(a.tr.delete(i.pos-j.nodeSize,i.pos).scrollIntoView()),!0)};function j(a,b,c){let g=b.nodeBefore,h=b.pos-1;for(;!g.isTextblock;h--){if(g.type.spec.isolating)return!1;let a=g.lastChild;if(!a)return!1;g=a}let i=b.nodeAfter,j=b.pos+1;for(;!i.isTextblock;j++){if(i.type.spec.isolating)return!1;let a=i.firstChild;if(!a)return!1;i=a}let k=(0,d.$L)(a.doc,h,j,e.Ji.empty);if(!k||k.from!=h||k instanceof d.Ln&&k.slice.size>=j-h)return!1;if(c){let b=a.tr.step(k);b.setSelection(f.U3.create(b.doc,h)),c(b.scrollIntoView())}return!0}function k(a,b,c=!1){for(let d=a;d;d="start"==b?d.firstChild:d.lastChild){if(d.isTextblock)return!0;if(c&&1!=d.childCount)break}return!1}let l=(a,b,c)=>{let{$head:d,empty:e}=a.selection,g=d;if(!e)return!1;if(d.parent.isTextblock){if(c?!c.endOfTextblock("backward",a):d.parentOffset>0)return!1;g=m(d)}let h=g&&g.nodeBefore;return!!h&&!!f.nh.isSelectable(h)&&(b&&b(a.tr.setSelection(f.nh.create(a.doc,g.pos-h.nodeSize)).scrollIntoView()),!0)};function m(a){if(!a.parent.type.spec.isolating)for(let b=a.depth-1;b>=0;b--){if(a.index(b)>0)return a.doc.resolve(a.before(b+1));if(a.node(b).type.spec.isolating)break}return null}function n(a,b){let{$cursor:c}=a.selection;return c&&(b?b.endOfTextblock("forward",a):!(c.parentOffset<c.parent.content.size))?c:null}let o=(a,b,c)=>{let g=n(a,c);if(!g)return!1;let h=q(g);if(!h)return!1;let i=h.nodeAfter;if(w(a,h,b,1))return!0;if(0==g.parent.content.size&&(k(i,"start")||f.nh.isSelectable(i))){let c=(0,d.$L)(a.doc,g.before(),g.after(),e.Ji.empty);if(c&&c.slice.size<c.to-c.from){if(b){let d=a.tr.step(c);d.setSelection(k(i,"start")?f.LN.findFrom(d.doc.resolve(d.mapping.map(h.pos)),1):f.nh.create(d.doc,d.mapping.map(h.pos))),b(d.scrollIntoView())}return!0}}return!!i.isAtom&&h.depth==g.depth-1&&(b&&b(a.tr.delete(h.pos,h.pos+i.nodeSize).scrollIntoView()),!0)},p=(a,b,c)=>{let{$head:d,empty:e}=a.selection,g=d;if(!e)return!1;if(d.parent.isTextblock){if(c?!c.endOfTextblock("forward",a):d.parentOffset<d.parent.content.size)return!1;g=q(d)}let h=g&&g.nodeAfter;return!!h&&!!f.nh.isSelectable(h)&&(b&&b(a.tr.setSelection(f.nh.create(a.doc,g.pos)).scrollIntoView()),!0)};function q(a){if(!a.parent.type.spec.isolating)for(let b=a.depth-1;b>=0;b--){let c=a.node(b);if(a.index(b)+1<c.childCount)return a.doc.resolve(a.after(b+1));if(c.type.spec.isolating)break}return null}let r=(a,b)=>{let{$head:c,$anchor:d}=a.selection;return!!c.parent.type.spec.code&&!!c.sameParent(d)&&(b&&b(a.tr.insertText("\n").scrollIntoView()),!0)};function s(a){for(let b=0;b<a.edgeCount;b++){let{type:c}=a.edge(b);if(c.isTextblock&&!c.hasRequiredAttrs())return c}return null}let t=(a,b)=>{let{$head:c,$anchor:d}=a.selection;if(!c.parent.type.spec.code||!c.sameParent(d))return!1;let e=c.node(-1),g=c.indexAfter(-1),h=s(e.contentMatchAt(g));if(!h||!e.canReplaceWith(g,g,h))return!1;if(b){let d=c.after(),e=a.tr.replaceWith(d,d,h.createAndFill());e.setSelection(f.LN.near(e.doc.resolve(d),1)),b(e.scrollIntoView())}return!0},u=(a,b)=>{let c=a.selection,{$from:d,$to:e}=c;if(c instanceof f.i5||d.parent.inlineContent||e.parent.inlineContent)return!1;let g=s(e.parent.contentMatchAt(e.indexAfter()));if(!g||!g.isTextblock)return!1;if(b){let c=(!d.parentOffset&&e.index()<e.parent.childCount?d:e).pos,h=a.tr.insert(c,g.createAndFill());h.setSelection(f.U3.create(h.doc,c+1)),b(h.scrollIntoView())}return!0},v=(a,b)=>{let{$cursor:c}=a.selection;if(!c||c.parent.content.size)return!1;if(c.depth>1&&c.after()!=c.end(-1)){let e=c.before();if((0,d.zy)(a.doc,e))return b&&b(a.tr.split(e).scrollIntoView()),!0}let e=c.blockRange(),f=e&&(0,d.jP)(e);return null!=f&&(b&&b(a.tr.lift(e,f).scrollIntoView()),!0)};function w(a,b,c,g){let h,i,j,l=b.nodeBefore,m=b.nodeAfter,n,o,p=l.type.spec.isolating||m.type.spec.isolating;if(!p&&(h=b.nodeBefore,i=b.nodeAfter,j=b.index(),h&&i&&h.type.compatibleContent(i.type)&&(!h.content.size&&b.parent.canReplace(j-1,j)?(c&&c(a.tr.delete(b.pos-h.nodeSize,b.pos).scrollIntoView()),!0):!!b.parent.canReplace(j,j+1)&&!!(i.isTextblock||(0,d.n9)(a.doc,b.pos))&&(c&&c(a.tr.join(b.pos).scrollIntoView()),!0))))return!0;let q=!p&&b.parent.canReplace(b.index(),b.index()+1);if(q&&(n=(o=l.contentMatchAt(l.childCount)).findWrapping(m.type))&&o.matchType(n[0]||m.type).validEnd){if(c){let f=b.pos+m.nodeSize,g=e.FK.empty;for(let a=n.length-1;a>=0;a--)g=e.FK.from(n[a].create(null,g));g=e.FK.from(l.copy(g));let h=a.tr.step(new d.Wg(b.pos-1,f,b.pos,f,new e.Ji(g,1,0),n.length,!0)),i=h.doc.resolve(f+2*n.length);i.nodeAfter&&i.nodeAfter.type==l.type&&(0,d.n9)(h.doc,i.pos)&&h.join(i.pos),c(h.scrollIntoView())}return!0}let r=m.type.spec.isolating||g>0&&p?null:f.LN.findFrom(b,1),s=r&&r.$from.blockRange(r.$to),t=s&&(0,d.jP)(s);if(null!=t&&t>=b.depth)return c&&c(a.tr.lift(s,t).scrollIntoView()),!0;if(q&&k(m,"start",!0)&&k(l,"end")){let f=l,g=[];for(;g.push(f),!f.isTextblock;)f=f.lastChild;let h=m,i=1;for(;!h.isTextblock;h=h.firstChild)i++;if(f.canReplace(f.childCount,f.childCount,h.content)){if(c){let f=e.FK.empty;for(let a=g.length-1;a>=0;a--)f=e.FK.from(g[a].copy(f));c(a.tr.step(new d.Wg(b.pos-g.length,b.pos+m.nodeSize,b.pos+i,b.pos+m.nodeSize-i,new e.Ji(f,g.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function x(a){return function(b,c){let d=b.selection,e=a<0?d.$from:d.$to,g=e.depth;for(;e.node(g).isInline;){if(!g)return!1;g--}return!!e.node(g).isTextblock&&(c&&c(b.tr.setSelection(f.U3.create(b.doc,a<0?e.start(g):e.end(g)))),!0)}}let y=x(-1),z=x(1);function A(a,b=null){return function(c,d){let e=!1;for(let d=0;d<c.selection.ranges.length&&!e;d++){let{$from:{pos:f},$to:{pos:g}}=c.selection.ranges[d];c.doc.nodesBetween(f,g,(d,f)=>{if(e)return!1;if(!(!d.isTextblock||d.hasMarkup(a,b)))if(d.type==a)e=!0;else{let b=c.doc.resolve(f),d=b.index();e=b.parent.canReplaceWith(d,d+1,a)}})}if(!e)return!1;if(d){let e=c.tr;for(let d=0;d<c.selection.ranges.length;d++){let{$from:{pos:f},$to:{pos:g}}=c.selection.ranges[d];e.setBlockType(f,g,a,b)}d(e.scrollIntoView())}return!0}}function B(...a){return function(b,c,d){for(let e=0;e<a.length;e++)if(a[e](b,c,d))return!0;return!1}}let C=B(g,i,l),D=B(g,o,p),E={Enter:B(r,u,v,(a,b)=>{let{$from:c,$to:e}=a.selection;if(a.selection instanceof f.nh&&a.selection.node.isBlock)return!!c.parentOffset&&!!(0,d.zy)(a.doc,c.pos)&&(b&&b(a.tr.split(c.pos).scrollIntoView()),!0);if(!c.depth)return!1;let g=[],h,i,j=!1,k=!1;for(let a=c.depth;;a--){if(c.node(a).isBlock){let b;j=c.end(a)==c.pos+(c.depth-a),k=c.start(a)==c.pos-(c.depth-a),i=s(c.node(a-1).contentMatchAt(c.indexAfter(a-1)));g.unshift(b||(j&&i?{type:i}:null)),h=a;break}if(1==a)return!1;g.unshift(null)}let l=a.tr;(a.selection instanceof f.U3||a.selection instanceof f.i5)&&l.deleteSelection();let m=l.mapping.map(c.pos),n=(0,d.zy)(l.doc,m,g.length,g);if(n||(g[0]=i?{type:i}:null,n=(0,d.zy)(l.doc,m,g.length,g)),!n)return!1;if(l.split(m,g.length,g),!j&&k&&c.node(h).type!=i){let a=l.mapping.map(c.before(h)),b=l.doc.resolve(a);i&&c.node(h-1).canReplaceWith(b.index(),b.index()+1,i)&&l.setNodeMarkup(l.mapping.map(c.before(h)),i)}return b&&b(l.scrollIntoView()),!0}),"Mod-Enter":t,Backspace:C,"Mod-Backspace":C,"Shift-Backspace":C,Delete:D,"Mod-Delete":D,"Mod-a":(a,b)=>(b&&b(a.tr.setSelection(new f.i5(a.doc))),!0)},F={"Ctrl-h":E.Backspace,"Alt-Backspace":E["Mod-Backspace"],"Ctrl-d":E.Delete,"Ctrl-Alt-Backspace":E["Mod-Delete"],"Alt-Delete":E["Mod-Delete"],"Alt-d":E["Mod-Delete"],"Ctrl-a":y,"Ctrl-e":z};for(let a in E)F[a]=E[a];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var G=c(669661),H=c(478853),I=Object.defineProperty,J=(a,b)=>{for(var c in b)I(a,c,{get:b[c],enumerable:!0})};function K(a){let{state:b,transaction:c}=a,{selection:d}=c,{doc:e}=c,{storedMarks:f}=c;return{...b,apply:b.apply.bind(b),applyTransaction:b.applyTransaction.bind(b),plugins:b.plugins,schema:b.schema,reconfigure:b.reconfigure.bind(b),toJSON:b.toJSON.bind(b),get storedMarks(){return f},get selection(){return d},get doc(){return e},get tr(){return d=c.selection,e=c.doc,f=c.storedMarks,c}}}var L=class{constructor(a){this.editor=a.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=a.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:a,editor:b,state:c}=this,{view:d}=b,{tr:e}=c,f=this.buildProps(e);return Object.fromEntries(Object.entries(a).map(([a,b])=>[a,(...a)=>{let c=b(...a)(f);return e.getMeta("preventDispatch")||this.hasCustomState||d.dispatch(e),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(a,b=!0){let{rawCommands:c,editor:d,state:e}=this,{view:f}=d,g=[],h=!!a,i=a||e.tr,j=()=>(h||!b||i.getMeta("preventDispatch")||this.hasCustomState||f.dispatch(i),g.every(a=>!0===a)),k={...Object.fromEntries(Object.entries(c).map(([a,c])=>[a,(...a)=>{let d=this.buildProps(i,b),e=c(...a)(d);return g.push(e),k}])),run:j};return k}createCan(a){let{rawCommands:b,state:c}=this,d=a||c.tr,e=this.buildProps(d,!1);return{...Object.fromEntries(Object.entries(b).map(([a,b])=>[a,(...a)=>b(...a)({...e,dispatch:void 0})])),chain:()=>this.createChain(d,!1)}}buildProps(a,b=!0){let{rawCommands:c,editor:d,state:e}=this,{view:f}=d,g={tr:a,editor:d,view:f,state:K({state:e,transaction:a}),dispatch:b?()=>void 0:void 0,chain:()=>this.createChain(a,b),can:()=>this.createCan(a),get commands(){return Object.fromEntries(Object.entries(c).map(([a,b])=>[a,(...a)=>b(...a)(g)]))}};return g}},M={};J(M,{blur:()=>N,clearContent:()=>O,clearNodes:()=>P,command:()=>Q,createParagraphNear:()=>R,cut:()=>S,deleteCurrentNode:()=>T,deleteNode:()=>V,deleteRange:()=>W,deleteSelection:()=>X,enter:()=>Y,exitCode:()=>Z,extendMarkRange:()=>af,first:()=>ag,focus:()=>am,forEach:()=>an,insertContent:()=>ao,insertContentAt:()=>as,joinBackward:()=>av,joinDown:()=>au,joinForward:()=>aw,joinItemBackward:()=>ax,joinItemForward:()=>ay,joinTextblockBackward:()=>az,joinTextblockForward:()=>aA,joinUp:()=>at,keyboardShortcut:()=>aC,lift:()=>aE,liftEmptyBlock:()=>aF,liftListItem:()=>aG,newlineInCode:()=>aH,resetAttributes:()=>aK,scrollIntoView:()=>aL,selectAll:()=>aM,selectNodeBackward:()=>aN,selectNodeForward:()=>aO,selectParentNode:()=>aP,selectTextblockEnd:()=>aQ,selectTextblockStart:()=>aR,setContent:()=>aT,setMark:()=>bx,setMeta:()=>by,setNode:()=>bz,setNodeSelection:()=>bA,setTextDirection:()=>bB,setTextSelection:()=>bC,sinkListItem:()=>bD,splitBlock:()=>bF,splitListItem:()=>bG,toggleList:()=>bJ,toggleMark:()=>bK,toggleNode:()=>bL,toggleWrap:()=>bM,undoInputRule:()=>bN,unsetAllMarks:()=>bO,unsetMark:()=>bP,unsetTextDirection:()=>bQ,updateAttributes:()=>bR,wrapIn:()=>bS,wrapInList:()=>bT});var N=()=>({editor:a,view:b})=>(requestAnimationFrame(()=>{var c;a.isDestroyed||(b.dom.blur(),null==(c=null==window?void 0:window.getSelection())||c.removeAllRanges())}),!0),O=(a=!0)=>({commands:b})=>b.setContent("",{emitUpdate:a}),P=()=>({state:a,tr:b,dispatch:c})=>{let{selection:e}=b,{ranges:f}=e;return!c||(f.forEach(({$from:c,$to:e})=>{a.doc.nodesBetween(c.pos,e.pos,(a,c)=>{if(a.type.isText)return;let{doc:e,mapping:f}=b,g=e.resolve(f.map(c)),h=e.resolve(f.map(c+a.nodeSize)),i=g.blockRange(h);if(!i)return;let j=(0,d.jP)(i);if(a.type.isTextblock){let{defaultType:a}=g.parent.contentMatchAt(g.index());b.setNodeMarkup(i.start,a)}(j||0===j)&&b.lift(i,j)})}),!0)},Q=a=>b=>a(b),R=()=>({state:a,dispatch:b})=>u(a,b),S=(a,b)=>({editor:c,tr:d})=>{let{state:e}=c,g=e.doc.slice(a.from,a.to);d.deleteRange(a.from,a.to);let h=d.mapping.map(b);return d.insert(h,g.content),d.setSelection(new f.U3(d.doc.resolve(Math.max(h-1,0)))),!0},T=()=>({tr:a,dispatch:b})=>{let{selection:c}=a,d=c.$anchor.node();if(d.content.size>0)return!1;let e=a.selection.$anchor;for(let c=e.depth;c>0;c-=1)if(e.node(c).type===d.type){if(b){let b=e.before(c),d=e.after(c);a.delete(b,d).scrollIntoView()}return!0}return!1};function U(a,b){if("string"==typeof a){if(!b.nodes[a])throw Error(`There is no node type named '${a}'. Maybe you forgot to add the extension?`);return b.nodes[a]}return a}var V=a=>({tr:b,state:c,dispatch:d})=>{let e=U(a,c.schema),f=b.selection.$anchor;for(let a=f.depth;a>0;a-=1)if(f.node(a).type===e){if(d){let c=f.before(a),d=f.after(a);b.delete(c,d).scrollIntoView()}return!0}return!1},W=a=>({tr:b,dispatch:c})=>{let{from:d,to:e}=a;return c&&b.delete(d,e),!0},X=()=>({state:a,dispatch:b})=>g(a,b),Y=()=>({commands:a})=>a.keyboardShortcut("Enter"),Z=()=>({state:a,dispatch:b})=>t(a,b);function _(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function aa(a,b,c={strict:!0}){let d=Object.keys(b);return!d.length||d.every(d=>c.strict?b[d]===a[d]:_(b[d])?b[d].test(a[d]):b[d]===a[d])}function ab(a,b,c={}){return a.find(a=>a.type===b&&aa(Object.fromEntries(Object.keys(c).map(b=>[b,a.attrs[b]])),c))}function ac(a,b,c={}){return!!ab(a,b,c)}function ad(a,b,c){var d;if(!a||!b)return;let e=a.parent.childAfter(a.parentOffset);if(e.node&&e.node.marks.some(a=>a.type===b)||(e=a.parent.childBefore(a.parentOffset)),!e.node||!e.node.marks.some(a=>a.type===b)||(c=c||(null==(d=e.node.marks[0])?void 0:d.attrs),!ab([...e.node.marks],b,c)))return;let f=e.index,g=a.start()+e.offset,h=f+1,i=g+e.node.nodeSize;for(;f>0&&ac([...a.parent.child(f-1).marks],b,c);)f-=1,g-=a.parent.child(f).nodeSize;for(;h<a.parent.childCount&&ac([...a.parent.child(h).marks],b,c);)i+=a.parent.child(h).nodeSize,h+=1;return{from:g,to:i}}function ae(a,b){if("string"==typeof a){if(!b.marks[a])throw Error(`There is no mark type named '${a}'. Maybe you forgot to add the extension?`);return b.marks[a]}return a}var af=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let g=ae(a,d.schema),{doc:h,selection:i}=c,{$from:j,from:k,to:l}=i;if(e){let a=ad(j,g,b);if(a&&a.from<=k&&a.to>=l){let b=f.U3.create(h,a.from,a.to);c.setSelection(b)}}return!0},ag=a=>b=>{let c="function"==typeof a?a(b):a;for(let a=0;a<c.length;a+=1)if(c[a](b))return!0;return!1};function ah(a){return a instanceof f.U3}function ai(a=0,b=0,c=0){return Math.min(Math.max(a,b),c)}function aj(a,b=null){if(!b)return null;let c=f.LN.atStart(a),d=f.LN.atEnd(a);if("start"===b||!0===b)return c;if("end"===b)return d;let e=c.from,g=d.to;return"all"===b?f.U3.create(a,ai(0,e,g),ai(a.content.size,e,g)):f.U3.create(a,ai(b,e,g),ai(b,e,g))}function ak(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function al(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var am=(a=null,b={})=>({editor:c,view:d,tr:e,dispatch:f})=>{b={scrollIntoView:!0,...b};let g=()=>{(al()||ak())&&d.dom.focus(),"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!al()&&!ak()&&d.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!c.isDestroyed&&(d.focus(),(null==b?void 0:b.scrollIntoView)&&c.commands.scrollIntoView())})};try{if(d.hasFocus()&&null===a||!1===a)return!0}catch{return!1}if(f&&null===a&&!ah(c.state.selection))return g(),!0;let h=aj(e.doc,a)||c.state.selection,i=c.state.selection.eq(h);return f&&(i||e.setSelection(h),i&&e.storedMarks&&e.setStoredMarks(e.storedMarks),g()),!0},an=(a,b)=>c=>a.every((a,d)=>b(a,{...c,index:d})),ao=(a,b)=>({tr:c,commands:d})=>d.insertContentAt({from:c.selection.from,to:c.selection.to},a,b),ap=a=>{let b=a.childNodes;for(let c=b.length-1;c>=0;c-=1){let d=b[c];3===d.nodeType&&d.nodeValue&&/^(\n\s\s|\n)$/.test(d.nodeValue)?a.removeChild(d):1===d.nodeType&&ap(d)}return a};function aq(a){if("undefined"==typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let b=`<body>${a}</body>`;return ap(new window.DOMParser().parseFromString(b,"text/html").body)}function ar(a,b,c){if(a instanceof e.bP||a instanceof e.FK)return a;c={slice:!0,parseOptions:{},...c};let d="object"==typeof a&&null!==a,f="string"==typeof a;if(d)try{if(Array.isArray(a)&&a.length>0)return e.FK.fromArray(a.map(a=>b.nodeFromJSON(a)));let d=b.nodeFromJSON(a);return c.errorOnInvalidContent&&d.check(),d}catch(d){if(c.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:d});return console.warn("[tiptap warn]: Invalid content.","Passed value:",a,"Error:",d),ar("",b,c)}if(f){if(c.errorOnInvalidContent){let d=!1,f="",g=new e.Sj({topNode:b.spec.topNode,marks:b.spec.marks,nodes:b.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:a=>(d=!0,f="string"==typeof a?a:a.outerHTML,null)}]}})});if(c.slice?e.S4.fromSchema(g).parseSlice(aq(a),c.parseOptions):e.S4.fromSchema(g).parse(aq(a),c.parseOptions),c.errorOnInvalidContent&&d)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${f}`)})}let d=e.S4.fromSchema(b);return c.slice?d.parseSlice(aq(a),c.parseOptions).content:d.parse(aq(a),c.parseOptions)}return ar("",b,c)}var as=(a,b,c)=>({tr:g,dispatch:h,editor:i})=>{var j;if(h){let h,k;c={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...c};let l=a=>{i.emit("contentError",{editor:i,error:a,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...c.parseOptions};if(!c.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ar(b,i.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(a){l(a)}try{h=ar(b,i.schema,{parseOptions:m,errorOnInvalidContent:null!=(j=c.errorOnInvalidContent)?j:i.options.enableContentCheck})}catch(a){return l(a),!1}let{from:n,to:o}="number"==typeof a?{from:a,to:a}:{from:a.from,to:a.to},p=!0,q=!0;if((!("type"in h)?h:[h]).forEach(a=>{a.check(),p=!!p&&a.isText&&0===a.marks.length,q=!!q&&a.isBlock}),n===o&&q){let{parent:a}=g.doc.resolve(n);!a.isTextblock||a.type.spec.code||a.childCount||(n-=1,o+=1)}if(p){if(Array.isArray(b))k=b.map(a=>a.text||"").join("");else if(b instanceof e.FK){let a="";b.forEach(b=>{b.text&&(a+=b.text)}),k=a}else k="object"==typeof b&&b&&b.text?b.text:b;g.insertText(k,n,o)}else{k=h;let a=g.doc.resolve(n),b=a.node(),c=0===a.parentOffset,d=b.isText||b.isTextblock,e=b.content.size>0;c&&d&&e&&(n=Math.max(0,n-1)),g.replaceWith(n,o,k)}c.updateSelection&&function(a,b,c){let e=a.steps.length-1;if(e<b)return;let g=a.steps[e];if(!(g instanceof d.Ln||g instanceof d.Wg))return;let h=a.mapping.maps[e],i=0;h.forEach((a,b,c,d)=>{0===i&&(i=d)}),a.setSelection(f.LN.near(a.doc.resolve(i),-1))}(g,g.steps.length-1,0),c.applyInputRules&&g.setMeta("applyInputRules",{from:n,text:k}),c.applyPasteRules&&g.setMeta("applyPasteRules",{from:n,text:k})}return!0},at=()=>({state:a,dispatch:b})=>((a,b)=>{let c=a.selection,e=c instanceof f.nh,g;if(e){if(c.node.isTextblock||!(0,d.n9)(a.doc,c.from))return!1;g=c.from}else if(null==(g=(0,d.N0)(a.doc,c.from,-1)))return!1;if(b){let c=a.tr.join(g);e&&c.setSelection(f.nh.create(c.doc,g-a.doc.resolve(g).nodeBefore.nodeSize)),b(c.scrollIntoView())}return!0})(a,b),au=()=>({state:a,dispatch:b})=>((a,b)=>{let c=a.selection,e;if(c instanceof f.nh){if(c.node.isTextblock||!(0,d.n9)(a.doc,c.to))return!1;e=c.to}else if(null==(e=(0,d.N0)(a.doc,c.to,1)))return!1;return b&&b(a.tr.join(e).scrollIntoView()),!0})(a,b),av=()=>({state:a,dispatch:b})=>i(a,b),aw=()=>({state:a,dispatch:b})=>o(a,b),ax=()=>({state:a,dispatch:b,tr:c})=>{try{let e=(0,d.N0)(a.doc,a.selection.$from.pos,-1);if(null==e)return!1;return c.join(e,2),b&&b(c),!0}catch{return!1}},ay=()=>({state:a,dispatch:b,tr:c})=>{try{let e=(0,d.N0)(a.doc,a.selection.$from.pos,1);if(null==e)return!1;return c.join(e,2),b&&b(c),!0}catch{return!1}},az=()=>({state:a,dispatch:b})=>((a,b,c)=>{let d=h(a,c);if(!d)return!1;let e=m(d);return!!e&&j(a,e,b)})(a,b),aA=()=>({state:a,dispatch:b})=>((a,b,c)=>{let d=n(a,c);if(!d)return!1;let e=q(d);return!!e&&j(a,e,b)})(a,b);function aB(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var aC=a=>({editor:b,view:c,tr:d,dispatch:e})=>{let f=(function(a){let b,c,d,e,f=a.split(/-(?!$)/),g=f[f.length-1];"Space"===g&&(g=" ");for(let a=0;a<f.length-1;a+=1){let g=f[a];if(/^(cmd|meta|m)$/i.test(g))e=!0;else if(/^a(lt)?$/i.test(g))b=!0;else if(/^(c|ctrl|control)$/i.test(g))c=!0;else if(/^s(hift)?$/i.test(g))d=!0;else if(/^mod$/i.test(g))al()||aB()?e=!0:c=!0;else throw Error(`Unrecognized modifier name: ${g}`)}return b&&(g=`Alt-${g}`),c&&(g=`Ctrl-${g}`),e&&(g=`Meta-${g}`),d&&(g=`Shift-${g}`),g})(a).split(/-(?!$)/),g=f.find(a=>!["Alt","Ctrl","Meta","Shift"].includes(a)),h=new KeyboardEvent("keydown",{key:"Space"===g?" ":g,altKey:f.includes("Alt"),ctrlKey:f.includes("Ctrl"),metaKey:f.includes("Meta"),shiftKey:f.includes("Shift"),bubbles:!0,cancelable:!0}),i=b.captureTransaction(()=>{c.someProp("handleKeyDown",a=>a(c,h))});return null==i||i.steps.forEach(a=>{let b=a.map(d.mapping);b&&e&&d.maybeStep(b)}),!0};function aD(a,b,c={}){let{from:d,to:e,empty:f}=a.selection,g=b?U(b,a.schema):null,h=[];a.doc.nodesBetween(d,e,(a,b)=>{if(a.isText)return;let c=Math.max(d,b),f=Math.min(e,b+a.nodeSize);h.push({node:a,from:c,to:f})});let i=e-d,j=h.filter(a=>!g||g.name===a.node.type.name).filter(a=>aa(a.node.attrs,c,{strict:!1}));return f?!!j.length:j.reduce((a,b)=>a+b.to-b.from,0)>=i}var aE=(a,b={})=>({state:c,dispatch:e})=>{let f=U(a,c.schema);return!!aD(c,f,b)&&((a,b)=>{let{$from:c,$to:e}=a.selection,f=c.blockRange(e),g=f&&(0,d.jP)(f);return null!=g&&(b&&b(a.tr.lift(f,g).scrollIntoView()),!0)})(c,e)},aF=()=>({state:a,dispatch:b})=>v(a,b),aG=a=>({state:b,dispatch:c})=>(function(a){return function(b,c){let{$from:f,$to:g}=b.selection,h=f.blockRange(g,b=>b.childCount>0&&b.firstChild.type==a);return!!h&&(!c||(f.node(h.depth-1).type==a?function(a,b,c,f){let g=a.tr,h=f.end,i=f.$to.end(f.depth);h<i&&(g.step(new d.Wg(h-1,i,h,i,new e.Ji(e.FK.from(c.create(null,f.parent.copy())),1,0),1,!0)),f=new e.u$(g.doc.resolve(f.$from.pos),g.doc.resolve(i),f.depth));let j=(0,d.jP)(f);if(null==j)return!1;g.lift(f,j);let k=g.doc.resolve(g.mapping.map(h,-1)-1);return(0,d.n9)(g.doc,k.pos)&&k.nodeBefore.type==k.nodeAfter.type&&g.join(k.pos),b(g.scrollIntoView()),!0}(b,c,a,h):function(a,b,c){let f=a.tr,g=c.parent;for(let a=c.end,b=c.endIndex-1,d=c.startIndex;b>d;b--)a-=g.child(b).nodeSize,f.delete(a-1,a+1);let h=f.doc.resolve(c.start),i=h.nodeAfter;if(f.mapping.map(c.end)!=c.start+h.nodeAfter.nodeSize)return!1;let j=0==c.startIndex,k=c.endIndex==g.childCount,l=h.node(-1),m=h.index(-1);if(!l.canReplace(m+ +!j,m+1,i.content.append(k?e.FK.empty:e.FK.from(g))))return!1;let n=h.pos,o=n+i.nodeSize;return f.step(new d.Wg(n-!!j,o+ +!!k,n+1,o-1,new e.Ji((j?e.FK.empty:e.FK.from(g.copy(e.FK.empty))).append(k?e.FK.empty:e.FK.from(g.copy(e.FK.empty))),+!j,+!k),+!j)),b(f.scrollIntoView()),!0}(b,c,h)))}})(U(a,b.schema))(b,c),aH=()=>({state:a,dispatch:b})=>r(a,b);function aI(a,b){return b.nodes[a]?"node":b.marks[a]?"mark":null}function aJ(a,b){let c="string"==typeof b?[b]:b;return Object.keys(a).reduce((b,d)=>(c.includes(d)||(b[d]=a[d]),b),{})}var aK=(a,b)=>({tr:c,state:d,dispatch:e})=>{let f=null,g=null,h=aI("string"==typeof a?a:a.name,d.schema);if(!h)return!1;"node"===h&&(f=U(a,d.schema)),"mark"===h&&(g=ae(a,d.schema));let i=!1;return c.selection.ranges.forEach(a=>{d.doc.nodesBetween(a.$from.pos,a.$to.pos,(a,d)=>{f&&f===a.type&&(i=!0,e&&c.setNodeMarkup(d,void 0,aJ(a.attrs,b))),g&&a.marks.length&&a.marks.forEach(f=>{g===f.type&&(i=!0,e&&c.addMark(d,d+a.nodeSize,g.create(aJ(f.attrs,b))))})})}),i},aL=()=>({tr:a,dispatch:b})=>(b&&a.scrollIntoView(),!0),aM=()=>({tr:a,dispatch:b})=>{if(b){let b=new f.i5(a.doc);a.setSelection(b)}return!0},aN=()=>({state:a,dispatch:b})=>l(a,b),aO=()=>({state:a,dispatch:b})=>p(a,b),aP=()=>({state:a,dispatch:b})=>((a,b)=>{let{$from:c,to:d}=a.selection,e,g=c.sharedDepth(d);return 0!=g&&(e=c.before(g),b&&b(a.tr.setSelection(f.nh.create(a.doc,e))),!0)})(a,b),aQ=()=>({state:a,dispatch:b})=>z(a,b),aR=()=>({state:a,dispatch:b})=>y(a,b);function aS(a,b,c={},d={}){return ar(a,b,{slice:!1,parseOptions:c,errorOnInvalidContent:d.errorOnInvalidContent})}var aT=(a,{errorOnInvalidContent:b,emitUpdate:c=!0,parseOptions:d={}}={})=>({editor:e,tr:f,dispatch:g,commands:h})=>{let{doc:i}=f;if("full"!==d.preserveWhitespace){let h=aS(a,e.schema,d,{errorOnInvalidContent:null!=b?b:e.options.enableContentCheck});return g&&f.replaceWith(0,i.content.size,h).setMeta("preventUpdate",!c),!0}return g&&f.setMeta("preventUpdate",!c),h.insertContentAt({from:0,to:i.content.size},a,{parseOptions:d,errorOnInvalidContent:null!=b?b:e.options.enableContentCheck})};function aU(a,b){let c=ae(b,a.schema),{from:d,to:e,empty:f}=a.selection,g=[];f?(a.storedMarks&&g.push(...a.storedMarks),g.push(...a.selection.$head.marks())):a.doc.nodesBetween(d,e,a=>{g.push(...a.marks)});let h=g.find(a=>a.type.name===c.name);return h?{...h.attrs}:{}}function aV(a,b){let c=new d.dL(a);return b.forEach(a=>{a.steps.forEach(a=>{c.step(a)})}),c}function aW(a,b,c){let d=[];return a.nodesBetween(b.from,b.to,(a,b)=>{c(a)&&d.push({node:a,pos:b})}),d}function aX(a,b){for(let c=a.depth;c>0;c-=1){let d=a.node(c);if(b(d))return{pos:c>0?a.before(c):0,start:a.start(c),depth:c,node:d}}}function aY(a){return b=>aX(b.$from,a)}function aZ(a,b,c){return void 0===a.config[b]&&a.parent?aZ(a.parent,b,c):"function"==typeof a.config[b]?a.config[b].bind({...c,parent:a.parent?aZ(a.parent,b,c):null}):a.config[b]}function a$(a){return a.map(a=>{let b={name:a.name,options:a.options,storage:a.storage},c=aZ(a,"addExtensions",b);return c?[a,...a$(c())]:a}).flat(10)}function a_(a,b){let c=e.ZF.fromSchema(b).serializeFragment(a),d=document.implementation.createHTMLDocument().createElement("div");return d.appendChild(c),d.innerHTML}function a0(a){return"function"==typeof a}function a1(a,b,...c){return a0(a)?b?a.bind(b)(...c):a(...c):a}function a2(a){let b=a.filter(a=>"extension"===a.type);return{baseExtensions:b,nodeExtensions:a.filter(a=>"node"===a.type),markExtensions:a.filter(a=>"mark"===a.type)}}function a3(a){let b=[],{nodeExtensions:c,markExtensions:d}=a2(a),e=[...c,...d],f={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return a.forEach(a=>{let c={name:a.name,options:a.options,storage:a.storage,extensions:e},d=aZ(a,"addGlobalAttributes",c);d&&d().forEach(a=>{a.types.forEach(c=>{Object.entries(a.attributes).forEach(([a,d])=>{b.push({type:c,name:a,attribute:{...f,...d}})})})})}),e.forEach(a=>{let c={name:a.name,options:a.options,storage:a.storage},d=aZ(a,"addAttributes",c);d&&Object.entries(d()).forEach(([c,d])=>{let e={...f,...d};"function"==typeof(null==e?void 0:e.default)&&(e.default=e.default()),(null==e?void 0:e.isRequired)&&(null==e?void 0:e.default)===void 0&&delete e.default,b.push({type:a.name,name:c,attribute:e})})}),b}function a4(...a){return a.filter(a=>!!a).reduce((a,b)=>{let c={...a};return Object.entries(b).forEach(([a,b])=>{if(!c[a]){c[a]=b;return}if("class"===a){let d=b?String(b).split(" "):[],e=c[a]?c[a].split(" "):[],f=d.filter(a=>!e.includes(a));c[a]=[...e,...f].join(" ")}else if("style"===a){let d=b?b.split(";").map(a=>a.trim()).filter(Boolean):[],e=c[a]?c[a].split(";").map(a=>a.trim()).filter(Boolean):[],f=new Map;e.forEach(a=>{let[b,c]=a.split(":").map(a=>a.trim());f.set(b,c)}),d.forEach(a=>{let[b,c]=a.split(":").map(a=>a.trim());f.set(b,c)}),c[a]=Array.from(f.entries()).map(([a,b])=>`${a}: ${b}`).join("; ")}else c[a]=b}),c},{})}function a5(a,b){return b.filter(b=>b.type===a.type.name).filter(a=>a.attribute.rendered).map(b=>b.attribute.renderHTML?b.attribute.renderHTML(a.attrs)||{}:{[b.name]:a.attrs[b.name]}).reduce((a,b)=>a4(a,b),{})}function a6(a,b){return"style"in a?a:{...a,getAttrs:c=>{let d=a.getAttrs?a.getAttrs(c):a.attrs;if(!1===d)return!1;let e=b.reduce((a,b)=>{var d;let e=b.attribute.parseHTML?b.attribute.parseHTML(c):"string"!=typeof(d=c.getAttribute(b.name))?d:d.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(d):"true"===d||"false"!==d&&d;return null==e?a:{...a,[b.name]:e}},{});return{...d,...e}}}}function a7(a){return Object.fromEntries(Object.entries(a).filter(([a,b])=>!("attrs"===a&&function(a={}){return 0===Object.keys(a).length&&a.constructor===Object}(b))&&null!=b))}function a8(a){var b,c;let d={};return!(null==(b=null==a?void 0:a.attribute)?void 0:b.isRequired)&&"default"in((null==a?void 0:a.attribute)||{})&&(d.default=a.attribute.default),(null==(c=null==a?void 0:a.attribute)?void 0:c.validate)!==void 0&&(d.validate=a.attribute.validate),[a.name,d]}function a9(a,b){var c;let d=a3(a),{nodeExtensions:f,markExtensions:g}=a2(a),h=null==(c=f.find(a=>aZ(a,"topNode")))?void 0:c.name,i=Object.fromEntries(f.map(c=>{let e=d.filter(a=>a.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:b},g=a7({...a.reduce((a,b)=>{let d=aZ(b,"extendNodeSchema",f);return{...a,...d?d(c):{}}},{}),content:a1(aZ(c,"content",f)),marks:a1(aZ(c,"marks",f)),group:a1(aZ(c,"group",f)),inline:a1(aZ(c,"inline",f)),atom:a1(aZ(c,"atom",f)),selectable:a1(aZ(c,"selectable",f)),draggable:a1(aZ(c,"draggable",f)),code:a1(aZ(c,"code",f)),whitespace:a1(aZ(c,"whitespace",f)),linebreakReplacement:a1(aZ(c,"linebreakReplacement",f)),defining:a1(aZ(c,"defining",f)),isolating:a1(aZ(c,"isolating",f)),attrs:Object.fromEntries(e.map(a8))}),h=a1(aZ(c,"parseHTML",f));h&&(g.parseDOM=h.map(a=>a6(a,e)));let i=aZ(c,"renderHTML",f);i&&(g.toDOM=a=>i({node:a,HTMLAttributes:a5(a,e)}));let j=aZ(c,"renderText",f);return j&&(g.toText=j),[c.name,g]})),j=Object.fromEntries(g.map(c=>{let e=d.filter(a=>a.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:b},g=a7({...a.reduce((a,b)=>{let d=aZ(b,"extendMarkSchema",f);return{...a,...d?d(c):{}}},{}),inclusive:a1(aZ(c,"inclusive",f)),excludes:a1(aZ(c,"excludes",f)),group:a1(aZ(c,"group",f)),spanning:a1(aZ(c,"spanning",f)),code:a1(aZ(c,"code",f)),attrs:Object.fromEntries(e.map(a8))}),h=a1(aZ(c,"parseHTML",f));h&&(g.parseDOM=h.map(a=>a6(a,e)));let i=aZ(c,"renderHTML",f);return i&&(g.toDOM=a=>i({mark:a,HTMLAttributes:a5(a,e)})),[c.name,g]}));return new e.Sj({topNode:h,nodes:i,marks:j})}function ba(a){return a.sort((a,b)=>{let c=aZ(a,"priority")||100,d=aZ(b,"priority")||100;return c>d?-1:+(c<d)})}function bb(a){var b;let c=ba(a$(a)),d=Array.from(new Set((b=c.map(a=>a.name)).filter((a,c)=>b.indexOf(a)!==c)));return d.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${d.map(a=>`'${a}'`).join(", ")}]. This can lead to issues.`),c}function bc(a,b){let c=a9(bb(b),void 0),d=aq(a);return e.S4.fromSchema(c).parse(d).toJSON()}function bd(a,b,c){let{from:d,to:e}=b,{blockSeparator:f="\n\n",textSerializers:g={}}=c||{},h="";return a.nodesBetween(d,e,(a,c,i,j)=>{var k;a.isBlock&&c>d&&(h+=f);let l=null==g?void 0:g[a.type.name];if(l)return i&&(h+=l({node:a,pos:c,parent:i,index:j,range:b})),!1;a.isText&&(h+=null==(k=null==a?void 0:a.text)?void 0:k.slice(Math.max(d,c)-c,e-c))}),h}function be(a,b){let c={from:0,to:a.content.size};return bd(a,c,b)}function bf(a){return Object.fromEntries(Object.entries(a.nodes).filter(([,a])=>a.spec.toText).map(([a,b])=>[a,b.spec.toText]))}function bg(a,b){let c=aI("string"==typeof b?b:b.name,a.schema);if("node"===c){let c=U(b,a.schema),{from:d,to:e}=a.selection,f=[];a.doc.nodesBetween(d,e,a=>{f.push(a)});let g=f.reverse().find(a=>a.type.name===c.name);return g?{...g.attrs}:{}}return"mark"===c?aU(a,b):{}}function bh(a){let{mapping:b,steps:c}=a,d=[];b.maps.forEach((a,e)=>{let f=[];if(a.ranges.length)a.forEach((a,b)=>{f.push({from:a,to:b})});else{let{from:a,to:b}=c[e];if(void 0===a||void 0===b)return;f.push({from:a,to:b})}f.forEach(({from:a,to:c})=>{let f=b.slice(e).map(a,-1),g=b.slice(e).map(c),h=b.invert().map(f,-1),i=b.invert().map(g);d.push({oldRange:{from:h,to:i},newRange:{from:f,to:g}})})});let e=function(a,b=JSON.stringify){let c={};return a.filter(a=>{let d=b(a);return!Object.prototype.hasOwnProperty.call(c,d)&&(c[d]=!0)})}(d);return 1===e.length?e:e.filter((a,b)=>!e.filter((a,c)=>c!==b).some(b=>a.oldRange.from>=b.oldRange.from&&a.oldRange.to<=b.oldRange.to&&a.newRange.from>=b.newRange.from&&a.newRange.to<=b.newRange.to))}function bi(a,b,c){let d=[];return a===b?c.resolve(a).marks().forEach(b=>{let e=ad(c.resolve(a),b.type);e&&d.push({mark:b,...e})}):c.nodesBetween(a,b,(a,b)=>{a&&(null==a?void 0:a.nodeSize)!==void 0&&d.push(...a.marks.map(c=>({from:b,to:b+a.nodeSize,mark:c})))}),d}var bj=(a,b,c,d=20)=>{let e=a.doc.resolve(c),f=d,g=null;for(;f>0&&null===g;){let a=e.node(f);(null==a?void 0:a.type.name)===b?g=a:f-=1}return[g,f]};function bk(a,b){return b.nodes[a]||b.marks[a]||null}function bl(a,b,c){return Object.fromEntries(Object.entries(c).filter(([c])=>{let d=a.find(a=>a.type===b&&a.name===c);return!!d&&d.attribute.keepOnSplit}))}function bm(a,b,c={}){let{empty:d,ranges:e}=a.selection,f=b?ae(b,a.schema):null;if(d)return!!(a.storedMarks||a.selection.$from.marks()).filter(a=>!f||f.name===a.type.name).find(a=>aa(a.attrs,c,{strict:!1}));let g=0,h=[];if(e.forEach(({$from:b,$to:c})=>{let d=b.pos,e=c.pos;a.doc.nodesBetween(d,e,(a,b)=>{if(!a.isText&&!a.marks.length)return;let c=Math.max(d,b),f=Math.min(e,b+a.nodeSize);g+=f-c,h.push(...a.marks.map(a=>({mark:a,from:c,to:f})))})}),0===g)return!1;let i=h.filter(a=>!f||f.name===a.mark.type.name).filter(a=>aa(a.mark.attrs,c,{strict:!1})).reduce((a,b)=>a+b.to-b.from,0),j=h.filter(a=>!f||a.mark.type!==f&&a.mark.type.excludes(f)).reduce((a,b)=>a+b.to-b.from,0);return(i>0?i+j:i)>=g}var bn=(a,b)=>{let{$from:c,$to:d,$anchor:e}=a.selection;if(b){let c=aY(a=>a.type.name===b)(a.selection);if(!c)return!1;let d=a.doc.resolve(c.pos+1);return e.pos+1===d.end()}return!(d.parentOffset<d.parent.nodeSize-2)&&c.pos===d.pos},bo=a=>{let{$from:b,$to:c}=a.selection;return!(b.parentOffset>0)&&b.pos===c.pos};function bp(a,b){return Array.isArray(b)?b.some(b=>("string"==typeof b?b:b.name)===a.name):b}function bq(a,b){let{nodeExtensions:c}=a2(b),d=c.find(b=>b.name===a);if(!d)return!1;let e={name:d.name,options:d.options,storage:d.storage},f=a1(aZ(d,"group",e));return"string"==typeof f&&f.split(" ").includes("list")}function br(a,{checkChildren:b=!0,ignoreWhitespace:c=!1}={}){var d;if(c){if("hardBreak"===a.type.name)return!0;if(a.isText)return/^\s*$/m.test(null!=(d=a.text)?d:"")}if(a.isText)return!a.text;if(a.isAtom||a.isLeaf)return!1;if(0===a.content.childCount)return!0;if(b){let d=!0;return a.content.forEach(a=>{!1!==d&&(br(a,{ignoreWhitespace:c,checkChildren:b})||(d=!1))}),d}return!1}function bs(a){return a instanceof f.nh}var bt=class a{constructor(a){this.position=a}static fromJSON(b){return new a(b.position)}toJSON(){return{position:this.position}}};function bu(a,b){let c=b.mapping.mapResult(a.position);return{position:new bt(c.pos),mapResult:c}}function bv(a){return new bt(a)}function bw(a,b,c){let d=a.state.doc.content.size,e=ai(b,0,d),f=ai(c,0,d),g=a.coordsAtPos(e),h=a.coordsAtPos(f,-1),i=Math.min(g.top,h.top),j=Math.max(g.bottom,h.bottom),k=Math.min(g.left,h.left),l=Math.max(g.right,h.right),m={top:i,bottom:j,left:k,right:l,width:l-k,height:j-i,x:k,y:i};return{...m,toJSON:()=>m}}var bx=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let{selection:f}=c,{empty:g,ranges:h}=f,i=ae(a,d.schema);if(e)if(g){let a=aU(d,i);c.addStoredMark(i.create({...a,...b}))}else h.forEach(a=>{let e=a.$from.pos,f=a.$to.pos;d.doc.nodesBetween(e,f,(a,d)=>{let g=Math.max(d,e),h=Math.min(d+a.nodeSize,f);a.marks.find(a=>a.type===i)?a.marks.forEach(a=>{i===a.type&&c.addMark(g,h,i.create({...a.attrs,...b}))}):c.addMark(g,h,i.create(b))})});return function(a,b,c){var d;let{selection:e}=b,f=null;if(ah(e)&&(f=e.$cursor),f){let b=null!=(d=a.storedMarks)?d:f.marks();return f.parent.type.allowsMarkType(c)&&(!!c.isInSet(b)||!b.some(a=>a.type.excludes(c)))}let{ranges:g}=e;return g.some(({$from:b,$to:d})=>{let e=0===b.depth&&a.doc.inlineContent&&a.doc.type.allowsMarkType(c);return a.doc.nodesBetween(b.pos,d.pos,(a,b,d)=>{if(e)return!1;if(a.isInline){let b=!d||d.type.allowsMarkType(c),f=!!c.isInSet(a.marks)||!a.marks.some(a=>a.type.excludes(c));e=b&&f}return!e}),e})}(d,c,i)},by=(a,b)=>({tr:c})=>(c.setMeta(a,b),!0),bz=(a,b={})=>({state:c,dispatch:d,chain:e})=>{let f,g=U(a,c.schema);return(c.selection.$anchor.sameParent(c.selection.$head)&&(f=c.selection.$anchor.parent.attrs),g.isTextblock)?e().command(({commands:a})=>!!A(g,{...f,...b})(c)||a.clearNodes()).command(({state:a})=>A(g,{...f,...b})(a,d)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bA=a=>({tr:b,dispatch:c})=>{if(c){let{doc:c}=b,d=ai(a,0,c.content.size),e=f.nh.create(c,d);b.setSelection(e)}return!0},bB=(a,b)=>({tr:c,state:d,dispatch:e})=>{let f,g,{selection:h}=d;return"number"==typeof b?(f=b,g=b):b&&"from"in b&&"to"in b?(f=b.from,g=b.to):(f=h.from,g=h.to),e&&c.doc.nodesBetween(f,g,(b,d)=>{b.isText||c.setNodeMarkup(d,void 0,{...b.attrs,dir:a})}),!0},bC=a=>({tr:b,dispatch:c})=>{if(c){let{doc:c}=b,{from:d,to:e}="number"==typeof a?{from:a,to:a}:a,g=f.U3.atStart(c).from,h=f.U3.atEnd(c).to,i=ai(d,g,h),j=ai(e,g,h),k=f.U3.create(c,i,j);b.setSelection(k)}return!0},bD=a=>({state:b,dispatch:c})=>(function(a){return function(b,c){let{$from:f,$to:g}=b.selection,h=f.blockRange(g,b=>b.childCount>0&&b.firstChild.type==a);if(!h)return!1;let i=h.startIndex;if(0==i)return!1;let j=h.parent,k=j.child(i-1);if(k.type!=a)return!1;if(c){let f=k.lastChild&&k.lastChild.type==j.type,g=e.FK.from(f?a.create():null),i=new e.Ji(e.FK.from(a.create(null,e.FK.from(j.type.create(null,g)))),f?3:1,0),l=h.start,m=h.end;c(b.tr.step(new d.Wg(l-(f?3:1),m,l,m,i,1,!0)).scrollIntoView())}return!0}})(U(a,b.schema))(b,c);function bE(a,b){let c=a.storedMarks||a.selection.$to.parentOffset&&a.selection.$from.marks();if(c){let d=c.filter(a=>null==b?void 0:b.includes(a.type.name));a.tr.ensureMarks(d)}}var bF=({keepMarks:a=!0}={})=>({tr:b,state:c,dispatch:e,editor:g})=>{let{selection:h,doc:i}=b,{$from:j,$to:k}=h,l=bl(g.extensionManager.attributes,j.node().type.name,j.node().attrs);if(h instanceof f.nh&&h.node.isBlock)return!!j.parentOffset&&!!(0,d.zy)(i,j.pos)&&(e&&(a&&bE(c,g.extensionManager.splittableMarks),b.split(j.pos).scrollIntoView()),!0);if(!j.parent.isBlock)return!1;let m=k.parentOffset===k.parent.content.size,n=0===j.depth?void 0:function(a){for(let b=0;b<a.edgeCount;b+=1){let{type:c}=a.edge(b);if(c.isTextblock&&!c.hasRequiredAttrs())return c}return null}(j.node(-1).contentMatchAt(j.indexAfter(-1))),o=m&&n?[{type:n,attrs:l}]:void 0,p=(0,d.zy)(b.doc,b.mapping.map(j.pos),1,o);if(!o&&!p&&(0,d.zy)(b.doc,b.mapping.map(j.pos),1,n?[{type:n}]:void 0)&&(p=!0,o=n?[{type:n,attrs:l}]:void 0),e){if(p&&(h instanceof f.U3&&b.deleteSelection(),b.split(b.mapping.map(j.pos),1,o),n&&!m&&!j.parentOffset&&j.parent.type!==n)){let a=b.mapping.map(j.before()),c=b.doc.resolve(a);j.node(-1).canReplaceWith(c.index(),c.index()+1,n)&&b.setNodeMarkup(b.mapping.map(j.before()),n)}a&&bE(c,g.extensionManager.splittableMarks),b.scrollIntoView()}return p},bG=(a,b={})=>({tr:c,state:g,dispatch:h,editor:i})=>{var j;let k=U(a,g.schema),{$from:l,$to:m}=g.selection,n=g.selection.node;if(n&&n.isBlock||l.depth<2||!l.sameParent(m))return!1;let o=l.node(-1);if(o.type!==k)return!1;let p=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==k||l.index(-2)!==l.node(-2).childCount-1)return!1;if(h){let a=e.FK.empty,d=l.index(-1)?1:l.index(-2)?2:3;for(let b=l.depth-d;b>=l.depth-3;b-=1)a=e.FK.from(l.node(b).copy(a));let g=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,h={...bl(p,l.node().type.name,l.node().attrs),...b},i=(null==(j=k.contentMatch.defaultType)?void 0:j.createAndFill(h))||void 0;a=a.append(e.FK.from(k.createAndFill(null,i)||void 0));let m=l.before(l.depth-(d-1));c.replace(m,l.after(-g),new e.Ji(a,4-d,0));let n=-1;c.doc.nodesBetween(m,c.doc.content.size,(a,b)=>{if(n>-1)return!1;a.isTextblock&&0===a.content.size&&(n=b+1)}),n>-1&&c.setSelection(f.U3.near(c.doc.resolve(n))),c.scrollIntoView()}return!0}let q=m.pos===l.end()?o.contentMatchAt(0).defaultType:null,r={...bl(p,o.type.name,o.attrs),...b},s={...bl(p,l.node().type.name,l.node().attrs),...b};c.delete(l.pos,m.pos);let t=q?[{type:k,attrs:r},{type:q,attrs:s}]:[{type:k,attrs:r}];if(!(0,d.zy)(c.doc,l.pos,2))return!1;if(h){let{selection:a,storedMarks:b}=g,{splittableMarks:d}=i.extensionManager,e=b||a.$to.parentOffset&&a.$from.marks();if(c.split(l.pos,2,t).scrollIntoView(),!e||!h)return!0;let f=e.filter(a=>d.includes(a.type.name));c.ensureMarks(f)}return!0},bH=(a,b)=>{let c=aY(a=>a.type===b)(a.selection);if(!c)return!0;let e=a.doc.resolve(Math.max(0,c.pos-1)).before(c.depth);if(void 0===e)return!0;let f=a.doc.nodeAt(e);return!(c.node.type===(null==f?void 0:f.type)&&(0,d.n9)(a.doc,c.pos))||(a.join(c.pos),!0)},bI=(a,b)=>{let c=aY(a=>a.type===b)(a.selection);if(!c)return!0;let e=a.doc.resolve(c.start).after(c.depth);if(void 0===e)return!0;let f=a.doc.nodeAt(e);return!(c.node.type===(null==f?void 0:f.type)&&(0,d.n9)(a.doc,e))||(a.join(e),!0)},bJ=(a,b,c,d={})=>({editor:e,tr:f,state:g,dispatch:h,chain:i,commands:j,can:k})=>{let{extensions:l,splittableMarks:m}=e.extensionManager,n=U(a,g.schema),o=U(b,g.schema),{selection:p,storedMarks:q}=g,{$from:r,$to:s}=p,t=r.blockRange(s),u=q||p.$to.parentOffset&&p.$from.marks();if(!t)return!1;let v=aY(a=>bq(a.type.name,l))(p);if(t.depth>=1&&v&&t.depth-v.depth<=1){if(v.node.type===n)return j.liftListItem(o);if(bq(v.node.type.name,l)&&n.validContent(v.node.content)&&h)return i().command(()=>(f.setNodeMarkup(v.pos,n),!0)).command(()=>bH(f,n)).command(()=>bI(f,n)).run()}return c&&u&&h?i().command(()=>{let a=k().wrapInList(n,d),b=u.filter(a=>m.includes(a.type.name));return f.ensureMarks(b),!!a||j.clearNodes()}).wrapInList(n,d).command(()=>bH(f,n)).command(()=>bI(f,n)).run():i().command(()=>!!k().wrapInList(n,d)||j.clearNodes()).wrapInList(n,d).command(()=>bH(f,n)).command(()=>bI(f,n)).run()},bK=(a,b={},c={})=>({state:d,commands:e})=>{let{extendEmptyMarkRange:f=!1}=c,g=ae(a,d.schema);return bm(d,g,b)?e.unsetMark(g,{extendEmptyMarkRange:f}):e.setMark(g,b)},bL=(a,b,c={})=>({state:d,commands:e})=>{let f,g=U(a,d.schema),h=U(b,d.schema),i=aD(d,g,c);return(d.selection.$anchor.sameParent(d.selection.$head)&&(f=d.selection.$anchor.parent.attrs),i)?e.setNode(h,f):e.setNode(g,{...f,...c})},bM=(a,b={})=>({state:c,commands:d})=>{let e=U(a,c.schema);return aD(c,e,b)?d.lift(e):d.wrapIn(e,b)},bN=()=>({state:a,dispatch:b})=>{let c=a.plugins;for(let d=0;d<c.length;d+=1){let e,f=c[d];if(f.spec.isInputRules&&(e=f.getState(a))){if(b){let b=a.tr,c=e.transform;for(let a=c.steps.length-1;a>=0;a-=1)b.step(c.steps[a].invert(c.docs[a]));if(e.text){let c=b.doc.resolve(e.from).marks();b.replaceWith(e.from,e.to,a.schema.text(e.text,c))}else b.delete(e.from,e.to)}return!0}}return!1},bO=()=>({tr:a,dispatch:b})=>{let{selection:c}=a,{empty:d,ranges:e}=c;return!!d||(b&&e.forEach(b=>{a.removeMark(b.$from.pos,b.$to.pos)}),!0)},bP=(a,b={})=>({tr:c,state:d,dispatch:e})=>{var f;let{extendEmptyMarkRange:g=!1}=b,{selection:h}=c,i=ae(a,d.schema),{$from:j,empty:k,ranges:l}=h;if(!e)return!0;if(k&&g){let{from:a,to:b}=h,d=null==(f=j.marks().find(a=>a.type===i))?void 0:f.attrs,e=ad(j,i,d);e&&(a=e.from,b=e.to),c.removeMark(a,b,i)}else l.forEach(a=>{c.removeMark(a.$from.pos,a.$to.pos,i)});return c.removeStoredMark(i),!0},bQ=a=>({tr:b,state:c,dispatch:d})=>{let e,f,{selection:g}=c;return"number"==typeof a?(e=a,f=a):a&&"from"in a&&"to"in a?(e=a.from,f=a.to):(e=g.from,f=g.to),d&&b.doc.nodesBetween(e,f,(a,c)=>{if(a.isText)return;let d={...a.attrs};delete d.dir,b.setNodeMarkup(c,void 0,d)}),!0},bR=(a,b={})=>({tr:c,state:d,dispatch:e})=>{let f=null,g=null,h=aI("string"==typeof a?a:a.name,d.schema);if(!h)return!1;"node"===h&&(f=U(a,d.schema)),"mark"===h&&(g=ae(a,d.schema));let i=!1;return c.selection.ranges.forEach(a=>{let h,j,k,l,m=a.$from.pos,n=a.$to.pos;c.selection.empty?d.doc.nodesBetween(m,n,(a,b)=>{f&&f===a.type&&(i=!0,k=Math.max(b,m),l=Math.min(b+a.nodeSize,n),h=b,j=a)}):d.doc.nodesBetween(m,n,(a,d)=>{d<m&&f&&f===a.type&&(i=!0,k=Math.max(d,m),l=Math.min(d+a.nodeSize,n),h=d,j=a),d>=m&&d<=n&&(f&&f===a.type&&(i=!0,e&&c.setNodeMarkup(d,void 0,{...a.attrs,...b})),g&&a.marks.length&&a.marks.forEach(f=>{if(g===f.type&&(i=!0,e)){let e=Math.max(d,m),h=Math.min(d+a.nodeSize,n);c.addMark(e,h,g.create({...f.attrs,...b}))}}))}),j&&(void 0!==h&&e&&c.setNodeMarkup(h,void 0,{...j.attrs,...b}),g&&j.marks.length&&j.marks.forEach(a=>{g===a.type&&e&&c.addMark(k,l,g.create({...a.attrs,...b}))}))}),i},bS=(a,b={})=>({state:c,dispatch:e})=>(function(a,b=null){return function(c,e){let{$from:f,$to:g}=c.selection,h=f.blockRange(g),i=h&&(0,d.oM)(h,a,b);return!!i&&(e&&e(c.tr.wrap(h,i).scrollIntoView()),!0)}})(U(a,c.schema),b)(c,e),bT=(a,b={})=>({state:c,dispatch:f})=>(function(a,b=null){return function(c,f){let{$from:g,$to:h}=c.selection,i=g.blockRange(h);if(!i)return!1;let j=f?c.tr:null;return!!function(a,b,c,f=null){let g=!1,h=b,i=b.$from.doc;if(b.depth>=2&&b.$from.node(b.depth-1).type.compatibleContent(c)&&0==b.startIndex){if(0==b.$from.index(b.depth-1))return!1;let a=i.resolve(b.start-2);h=new e.u$(a,a,b.depth),b.endIndex<b.parent.childCount&&(b=new e.u$(b.$from,i.resolve(b.$to.end(b.depth)),b.depth)),g=!0}let j=(0,d.oM)(h,c,f,b);return!!j&&(a&&function(a,b,c,f,g){let h=e.FK.empty;for(let a=c.length-1;a>=0;a--)h=e.FK.from(c[a].type.create(c[a].attrs,h));a.step(new d.Wg(b.start-2*!!f,b.end,b.start,b.end,new e.Ji(h,0,0),c.length,!0));let i=0;for(let a=0;a<c.length;a++)c[a].type==g&&(i=a+1);let j=c.length-i,k=b.start+c.length-2*!!f,l=b.parent;for(let c=b.startIndex,e=b.endIndex,f=!0;c<e;c++,f=!1)!f&&(0,d.zy)(a.doc,k,j)&&(a.split(k,j),k+=2*j),k+=l.child(c).nodeSize}(a,b,j,g,c),!0)}(j,i,a,b)&&(f&&f(j.scrollIntoView()),!0)}})(U(a,c.schema),b)(c,f),bU=class{constructor(){this.callbacks={}}on(a,b){return this.callbacks[a]||(this.callbacks[a]=[]),this.callbacks[a].push(b),this}emit(a,...b){let c=this.callbacks[a];return c&&c.forEach(a=>a.apply(this,b)),this}off(a,b){let c=this.callbacks[a];return c&&(b?this.callbacks[a]=c.filter(a=>a!==b):delete this.callbacks[a]),this}once(a,b){let c=(...d)=>{this.off(a,c),b.apply(this,d)};return this.on(a,c)}removeAllListeners(){this.callbacks={}}},bV=class{constructor(a){var b;this.find=a.find,this.handler=a.handler,this.undoable=null==(b=a.undoable)||b}};function bW(a){var b;let{editor:c,from:d,to:e,text:f,rules:g,plugin:h}=a,{view:i}=c;if(i.composing)return!1;let j=i.state.doc.resolve(d);if(j.parent.type.spec.code||(null==(b=j.nodeBefore||j.nodeAfter)?void 0:b.marks.find(a=>a.type.spec.code)))return!1;let k=!1,l=((a,b=500)=>{let c="",d=a.parentOffset;return a.parent.nodesBetween(Math.max(0,d-b),d,(a,b,e,f)=>{var g,h;let i=(null==(h=(g=a.type.spec).toText)?void 0:h.call(g,{node:a,pos:b,parent:e,index:f}))||a.textContent||"%leaf%";c+=a.isAtom&&!a.isText?i:i.slice(0,Math.max(0,d-b))}),c})(j)+f;return g.forEach(a=>{if(k)return;let b=((a,b)=>{if(_(b))return b.exec(a);let c=b(a);if(!c)return null;let d=[c.text];return d.index=c.index,d.input=a,d.data=c.data,c.replaceWith&&(c.text.includes(c.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),d.push(c.replaceWith)),d})(l,a.find);if(!b)return;let g=i.state.tr,j=K({state:i.state,transaction:g}),m={from:d-(b[0].length-f.length),to:e},{commands:n,chain:o,can:p}=new L({editor:c,state:j});null!==a.handler({state:j,range:m,match:b,commands:n,chain:o,can:p})&&g.steps.length&&(a.undoable&&g.setMeta(h,{transform:g,from:d,to:e,text:f}),i.dispatch(g),k=!0)}),k}function bX(a){return"Object"===Object.prototype.toString.call(a).slice(8,-1)&&a.constructor===Object&&Object.getPrototypeOf(a)===Object.prototype}var bY=class{constructor(a={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...a},this.name=this.config.name}get options(){return{...a1(aZ(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...a1(aZ(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(a={}){let b=this.extend({...this.config,addOptions:()=>(function a(b,c){let d={...b};return bX(b)&&bX(c)&&Object.keys(c).forEach(e=>{bX(c[e])&&bX(b[e])?d[e]=a(b[e],c[e]):d[e]=c[e]}),d})(this.options,a)});return b.name=this.name,b.parent=this.parent,b}extend(a={}){let b=new this.constructor({...this.config,...a});return b.parent=this,this.child=b,b.name="name"in a?a.name:b.parent.name,b}},bZ=class a extends bY{constructor(){super(...arguments),this.type="mark"}static create(b={}){return new a("function"==typeof b?b():b)}static handleExit({editor:a,mark:b}){let{tr:c}=a.state,d=a.state.selection.$from;if(d.pos===d.end()){let e=d.marks();if(!e.find(a=>(null==a?void 0:a.type.name)===b.name))return!1;let f=e.find(a=>(null==a?void 0:a.type.name)===b.name);return f&&c.removeStoredMark(f),c.insertText(" ",d.pos),a.view.dispatch(c),!0}return!1}configure(a){return super.configure(a)}extend(a){let b="function"==typeof a?a():a;return super.extend(b)}},b$=class{constructor(a){this.find=a.find,this.handler=a.handler}},b_=null,b0=class{constructor(a,b){this.splittableMarks=[],this.editor=b,this.baseExtensions=a,this.extensions=bb(a),this.schema=a9(this.extensions,b),this.setupExtensions()}get commands(){return this.extensions.reduce((a,b)=>{let c={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:this.editor,type:bk(b.name,this.schema)},d=aZ(b,"addCommands",c);return d?{...a,...d()}:a},{})}get plugins(){let{editor:a}=this;return ba([...this.extensions].reverse()).flatMap(b=>{let c={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:bk(b.name,this.schema)},d=[],g=aZ(b,"addKeyboardShortcuts",c),h={};if("mark"===b.type&&aZ(b,"exitable",c)&&(h.ArrowRight=()=>bZ.handleExit({editor:a,mark:b})),g){let b=Object.fromEntries(Object.entries(g()).map(([b,c])=>[b,()=>c({editor:a})]));h={...h,...b}}let i=(0,H.w)(h);d.push(i);let j=aZ(b,"addInputRules",c);if(bp(b,a.options.enableInputRules)&&j){let b=j();if(b&&b.length){let c=function(a){let{editor:b,rules:c}=a,d=new f.k_({state:{init:()=>null,apply(a,f,g){let h=a.getMeta(d);if(h)return h;let i=a.getMeta("applyInputRules");return i&&setTimeout(()=>{let{text:a}=i;"string"==typeof a||(a=a_(e.FK.from(a),g.schema));let{from:f}=i,h=f+a.length;bW({editor:b,from:f,to:h,text:a,rules:c,plugin:d})}),a.selectionSet||a.docChanged?null:f}},props:{handleTextInput:(a,e,f,g)=>bW({editor:b,from:e,to:f,text:g,rules:c,plugin:d}),handleDOMEvents:{compositionend:a=>(setTimeout(()=>{let{$cursor:e}=a.state.selection;e&&bW({editor:b,from:e.pos,to:e.pos,text:"",rules:c,plugin:d})}),!1)},handleKeyDown(a,e){if("Enter"!==e.key)return!1;let{$cursor:f}=a.state.selection;return!!f&&bW({editor:b,from:f.pos,to:f.pos,text:"\n",rules:c,plugin:d})}},isInputRules:!0});return d}({editor:a,rules:b}),g=Array.isArray(c)?c:[c];d.push(...g)}}let k=aZ(b,"addPasteRules",c);if(bp(b,a.options.enablePasteRules)&&k){let b=k();if(b&&b.length){let c=function(a){let b,{editor:c,rules:d}=a,g=null,h=!1,i=!1,j="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{b="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{b=null}let k=({state:a,from:d,to:e,rule:f,pasteEvt:g})=>{let h=a.tr;if(function(a){let{editor:b,state:c,from:d,to:e,rule:f,pasteEvent:g,dropEvent:h}=a,{commands:i,chain:j,can:k}=new L({editor:b,state:c}),l=[];return c.doc.nodesBetween(d,e,(a,b)=>{var m,n,o,p,q;if((null==(n=null==(m=a.type)?void 0:m.spec)?void 0:n.code)||!(a.isText||a.isTextblock||a.isInline))return;let r=null!=(q=null!=(p=null==(o=a.content)?void 0:o.size)?p:a.nodeSize)?q:0,s=Math.max(d,b),t=Math.min(e,b+r);s>=t||((a,b,c)=>{if(_(b))return[...a.matchAll(b)];let d=b(a,c);return d?d.map(b=>{let c=[b.text];return c.index=b.index,c.input=a,c.data=b.data,b.replaceWith&&(b.text.includes(b.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),c.push(b.replaceWith)),c}):[]})(a.isText?a.text||"":a.textBetween(s-b,t-b,void 0,""),f.find,g).forEach(a=>{if(void 0===a.index)return;let b=s+a.index+1,d=b+a[0].length,e={from:c.tr.mapping.map(b),to:c.tr.mapping.map(d)},m=f.handler({state:c,range:e,match:a,commands:i,chain:j,can:k,pasteEvent:g,dropEvent:h});l.push(m)})}),l.every(a=>null!==a)}({editor:c,state:K({state:a,transaction:h}),from:Math.max(d-1,0),to:e.b-1,rule:f,pasteEvent:g,dropEvent:b})&&h.steps.length){try{b="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{b=null}return j="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,h}};return d.map(a=>new f.k_({view(a){let b=b=>{var d;(g=(null==(d=a.dom.parentElement)?void 0:d.contains(b.target))?a.dom.parentElement:null)&&(b_=c)},d=()=>{b_&&(b_=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",d),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",d)}}},props:{handleDOMEvents:{drop:(a,c)=>{if(i=g===a.dom.parentElement,b=c,!i){let a=b_;(null==a?void 0:a.isEditable)&&setTimeout(()=>{let b=a.state.selection;b&&a.commands.deleteRange({from:b.from,to:b.to})},10)}return!1},paste:(a,b)=>{var c;let d=null==(c=b.clipboardData)?void 0:c.getData("text/html");return j=b,h=!!(null==d?void 0:d.includes("data-pm-slice")),!1}}},appendTransaction:(b,c,d)=>{let f=b[0],g="paste"===f.getMeta("uiEvent")&&!h,l="drop"===f.getMeta("uiEvent")&&!i,m=f.getMeta("applyPasteRules"),n=!!m;if(!g&&!l&&!n)return;if(n){let{text:b}=m;"string"==typeof b||(b=a_(e.FK.from(b),d.schema));let{from:c}=m,f=c+b.length;return k({rule:a,state:d,from:c,to:{b:f},pasteEvt:(a=>{var b;let c=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(b=c.clipboardData)||b.setData("text/html",a),c})(b)})}let o=c.doc.content.findDiffStart(d.doc.content),p=c.doc.content.findDiffEnd(d.doc.content);if("number"==typeof o&&p&&o!==p.b)return k({rule:a,state:d,from:o,to:p,pasteEvt:j})}}))}({editor:a,rules:b});d.push(...c)}}let l=aZ(b,"addProseMirrorPlugins",c);if(l){let a=l();d.push(...a)}return d})}get attributes(){return a3(this.extensions)}get nodeViews(){let{editor:a}=this,{nodeExtensions:b}=a2(this.extensions);return Object.fromEntries(b.filter(a=>!!aZ(a,"addNodeView")).map(b=>{let c=this.attributes.filter(a=>a.type===b.name),d={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:U(b.name,this.schema)},e=aZ(b,"addNodeView",d);if(!e)return[];let f=e();return f?[b.name,(d,e,g,h,i)=>{let j=a5(d,c);return f({node:d,view:e,getPos:g,decorations:h,innerDecorations:i,editor:a,extension:b,HTMLAttributes:j})}]:[]}))}dispatchTransaction(a){let{editor:b}=this;return ba([...this.extensions].reverse()).reduceRight((a,c)=>{let d={name:c.name,options:c.options,storage:this.editor.extensionStorage[c.name],editor:b,type:bk(c.name,this.schema)},e=aZ(c,"dispatchTransaction",d);return e?b=>{e.call(d,{transaction:b,next:a})}:a},a)}get markViews(){let{editor:a}=this,{markExtensions:b}=a2(this.extensions);return Object.fromEntries(b.filter(a=>!!aZ(a,"addMarkView")).map(b=>{let c=this.attributes.filter(a=>a.type===b.name),d={name:b.name,options:b.options,storage:this.editor.extensionStorage[b.name],editor:a,type:ae(b.name,this.schema)},e=aZ(b,"addMarkView",d);return e?[b.name,(d,f,g)=>{let h=a5(d,c);return e()({mark:d,view:f,inline:g,editor:a,extension:b,HTMLAttributes:h,updateAttributes:b=>{cw(d,a,b)}})}]:[]}))}setupExtensions(){let a=this.extensions;this.editor.extensionStorage=Object.fromEntries(a.map(a=>[a.name,a.storage])),a.forEach(a=>{var b;let c={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:this.editor,type:bk(a.name,this.schema)};"mark"===a.type&&(null==(b=a1(aZ(a,"keepOnSplit",c)))||b)&&this.splittableMarks.push(a.name);let d=aZ(a,"onBeforeCreate",c),e=aZ(a,"onCreate",c),f=aZ(a,"onUpdate",c),g=aZ(a,"onSelectionUpdate",c),h=aZ(a,"onTransaction",c),i=aZ(a,"onFocus",c),j=aZ(a,"onBlur",c),k=aZ(a,"onDestroy",c);d&&this.editor.on("beforeCreate",d),e&&this.editor.on("create",e),f&&this.editor.on("update",f),g&&this.editor.on("selectionUpdate",g),h&&this.editor.on("transaction",h),i&&this.editor.on("focus",i),j&&this.editor.on("blur",j),k&&this.editor.on("destroy",k)})}};b0.resolve=bb,b0.sort=ba,b0.flatten=a$,J({},{ClipboardTextSerializer:()=>b2,Commands:()=>b3,Delete:()=>b4,Drop:()=>b5,Editable:()=>b6,FocusEvents:()=>b8,Keymap:()=>b9,Paste:()=>ca,Tabindex:()=>cb,TextDirection:()=>cc,focusEventsPluginKey:()=>b7});var b1=class a extends bY{constructor(){super(...arguments),this.type="extension"}static create(b={}){return new a("function"==typeof b?b():b)}configure(a){return super.configure(a)}extend(a){let b="function"==typeof a?a():a;return super.extend(b)}},b2=b1.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new f.k_({key:new f.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:a}=this,{state:b,schema:c}=a,{doc:d,selection:e}=b,{ranges:f}=e,g=Math.min(...f.map(a=>a.$from.pos)),h=Math.max(...f.map(a=>a.$to.pos)),i=bf(c);return bd(d,{from:g,to:h},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:i})}}})]}}),b3=b1.create({name:"commands",addCommands:()=>({...M})}),b4=b1.create({name:"delete",onUpdate({transaction:a,appendedTransactions:b}){var c,e,f;let g=()=>{var c,e,f,g;if(null!=(g=null==(f=null==(e=null==(c=this.editor.options.coreExtensionOptions)?void 0:c.delete)?void 0:e.filterTransaction)?void 0:f.call(e,a))?g:a.getMeta("y-sync$"))return;let h=aV(a.before,[a,...b]);bh(h).forEach(b=>{h.mapping.mapResult(b.oldRange.from).deletedAfter&&h.mapping.mapResult(b.oldRange.to).deletedBefore&&h.before.nodesBetween(b.oldRange.from,b.oldRange.to,(c,d)=>{let e=d+c.nodeSize-2,f=b.oldRange.from<=d&&e<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:c,from:d,to:e,newFrom:h.mapping.map(d),newTo:h.mapping.map(e),deletedRange:b.oldRange,newRange:b.newRange,partial:!f,editor:this.editor,transaction:a,combinedTransform:h})})});let i=h.mapping;h.steps.forEach((b,c)=>{var e,f;if(b instanceof d.Ys){let d=i.slice(c).map(b.from,-1),g=i.slice(c).map(b.to),j=i.invert().map(d,-1),k=i.invert().map(g),l=null==(e=h.doc.nodeAt(d-1))?void 0:e.marks.some(a=>a.eq(b.mark)),m=null==(f=h.doc.nodeAt(g))?void 0:f.marks.some(a=>a.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:j,to:k},newRange:{from:d,to:g},partial:!!(m||l),editor:this.editor,transaction:a,combinedTransform:h})}})};null==(f=null==(e=null==(c=this.editor.options.coreExtensionOptions)?void 0:c.delete)?void 0:e.async)||f?setTimeout(g,0):g()}}),b5=b1.create({name:"drop",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tiptapDrop"),props:{handleDrop:(a,b,c,d)=>{this.editor.emit("drop",{editor:this.editor,event:b,slice:c,moved:d})}}})]}}),b6=b1.create({name:"editable",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),b7=new f.hs("focusEvents"),b8=b1.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:a}=this;return[new f.k_({key:b7,props:{handleDOMEvents:{focus:(b,c)=>{a.isFocused=!0;let d=a.state.tr.setMeta("focus",{event:c}).setMeta("addToHistory",!1);return b.dispatch(d),!1},blur:(b,c)=>{a.isFocused=!1;let d=a.state.tr.setMeta("blur",{event:c}).setMeta("addToHistory",!1);return b.dispatch(d),!1}}}})]}}),b9=b1.create({name:"keymap",addKeyboardShortcuts(){let a=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:b})=>{let{selection:c,doc:d}=b,{empty:e,$anchor:g}=c,{pos:h,parent:i}=g,j=g.parent.isTextblock&&h>0?b.doc.resolve(h-1):g,k=j.parent.type.spec.isolating,l=g.pos-g.parentOffset,m=k&&1===j.parent.childCount?l===g.pos:f.LN.atStart(d).from===h;return!!e&&!!i.type.isTextblock&&!i.textContent.length&&!!m&&(!m||"paragraph"!==g.parent.type.name)&&a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),b=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),c={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:a,"Mod-Backspace":a,"Shift-Backspace":a,Delete:b,"Mod-Delete":b,"Mod-a":()=>this.editor.commands.selectAll()},d={...c},e={...c,"Ctrl-h":a,"Alt-Backspace":a,"Ctrl-d":b,"Ctrl-Alt-Backspace":b,"Alt-Delete":b,"Alt-d":b,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return al()||aB()?e:d},addProseMirrorPlugins(){return[new f.k_({key:new f.hs("clearDocument"),appendTransaction:(a,b,c)=>{if(a.some(a=>a.getMeta("composition")))return;let d=a.some(a=>a.docChanged)&&!b.doc.eq(c.doc),e=a.some(a=>a.getMeta("preventClearDocument"));if(!d||e)return;let{empty:g,from:h,to:i}=b.selection,j=f.LN.atStart(b.doc).from,k=f.LN.atEnd(b.doc).to;if(g||h!==j||i!==k||!br(c.doc))return;let l=c.tr,m=K({state:c,transaction:l}),{commands:n}=new L({editor:this.editor,state:m});if(n.clearNodes(),l.steps.length)return l}})]}}),ca=b1.create({name:"paste",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tiptapPaste"),props:{handlePaste:(a,b,c)=>{this.editor.emit("paste",{editor:this.editor,event:b,slice:c})}}})]}}),cb=b1.create({name:"tabindex",addProseMirrorPlugins(){return[new f.k_({key:new f.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),cc=b1.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:a}=a2(this.extensions);return[{types:a.filter(a=>"text"!==a.name).map(a=>a.name),attributes:{dir:{default:this.options.direction,parseHTML:a=>{let b=a.getAttribute("dir");return b&&("ltr"===b||"rtl"===b||"auto"===b)?b:this.options.direction},renderHTML:a=>a.dir?{dir:a.dir}:{}}}}]},addProseMirrorPlugins(){return[new f.k_({key:new f.hs("textDirection"),props:{attributes:()=>{let a=this.options.direction;return a?{dir:a}:{}}}})]}}),cd=class a{constructor(a,b,c=!1,d=null){this.currentNode=null,this.actualDepth=null,this.isBlock=c,this.resolvedPos=a,this.editor=b,this.currentNode=d}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var a;return null!=(a=this.actualDepth)?a:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(a){let b=this.from,c=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);b=this.from+1,c=this.to-1}this.editor.commands.insertContentAt({from:b,to:c},a)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let b=this.resolvedPos.start(this.resolvedPos.depth-1);return new a(this.resolvedPos.doc.resolve(b),this.editor)}get before(){let b=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return b.depth!==this.depth&&(b=this.resolvedPos.doc.resolve(this.from-3)),new a(b,this.editor)}get after(){let b=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return b.depth!==this.depth&&(b=this.resolvedPos.doc.resolve(this.to+3)),new a(b,this.editor)}get children(){let b=[];return this.node.content.forEach((c,d)=>{let e=c.isBlock&&!c.isTextblock,f=c.isAtom&&!c.isText,g=c.isInline,h=this.pos+d+ +!f;if(h<0||h>this.resolvedPos.doc.nodeSize-2)return;let i=this.resolvedPos.doc.resolve(h);if(!e&&!g&&i.depth<=this.depth)return;let j=new a(i,this.editor,e,e||g?c:null);e&&(j.actualDepth=this.depth+1),b.push(j)}),b}get firstChild(){return this.children[0]||null}get lastChild(){let a=this.children;return a[a.length-1]||null}closest(a,b={}){let c=null,d=this.parent;for(;d&&!c;){if(d.node.type.name===a)if(Object.keys(b).length>0){let a=d.node.attrs,c=Object.keys(b);for(let d=0;d<c.length;d+=1){let e=c[d];if(a[e]!==b[e])break}}else c=d;d=d.parent}return c}querySelector(a,b={}){return this.querySelectorAll(a,b,!0)[0]||null}querySelectorAll(a,b={},c=!1){let d=[];if(!this.children||0===this.children.length)return d;let e=Object.keys(b);return this.children.forEach(f=>{(!c||!(d.length>0))&&(f.node.type.name===a&&e.every(a=>b[a]===f.node.attrs[a])&&d.push(f),c&&d.length>0||(d=d.concat(f.querySelectorAll(a,b,c))))}),d}setAttribute(a){let{tr:b}=this.editor.state;b.setNodeMarkup(this.from,void 0,{...this.node.attrs,...a}),this.editor.view.dispatch(b)}},ce=`.ProseMirror {
|
|
265
265
|
position: relative;
|
|
266
266
|
}
|
|
267
267
|
|