dorkos 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dorian Collier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # dorkos
2
+
3
+ Web-based interface and REST/SSE API for [Claude Code](https://docs.anthropic.com/en/docs/claude-code), built with the [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk).
4
+
5
+ Provides a chat UI for interacting with Claude Code sessions, with tool approval flows, slash command discovery, and real-time session sync across multiple clients.
6
+
7
+ ## Prerequisites
8
+
9
+ - **Node.js** >= 18
10
+ - **Claude Code CLI** installed and available in your PATH:
11
+ ```bash
12
+ npm install -g @anthropic-ai/claude-code
13
+ ```
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install -g dorkos
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ # Start DorkOS (opens on http://localhost:6942)
25
+ dorkos
26
+
27
+ # Custom port
28
+ dorkos --port 8080
29
+
30
+ # Set working directory
31
+ dorkos --dir ~/projects/myapp
32
+
33
+ # Enable ngrok tunnel for remote access
34
+ NGROK_AUTHTOKEN=your_token dorkos --tunnel
35
+ ```
36
+
37
+ ## Options
38
+
39
+ | Flag | Short | Description | Default |
40
+ |------|-------|-------------|---------|
41
+ | `--port <port>` | `-p` | Port to listen on | `6942` |
42
+ | `--tunnel` | `-t` | Enable ngrok tunnel | `false` |
43
+ | `--dir <path>` | `-d` | Working directory | Current directory |
44
+ | `--help` | `-h` | Show help message | |
45
+ | `--version` | `-v` | Show version number | |
46
+
47
+ ## Environment Variables
48
+
49
+ | Variable | Description |
50
+ |----------|-------------|
51
+ | `NGROK_AUTHTOKEN` | ngrok auth token (required for `--tunnel`) |
52
+ | `TUNNEL_AUTH` | HTTP basic auth for tunnel (`user:pass`) |
53
+ | `TUNNEL_DOMAIN` | Custom ngrok domain |
54
+
55
+ ## Features
56
+
57
+ - Chat UI for Claude Code with rich markdown rendering
58
+ - Tool approval/deny flow for safe AI interactions
59
+ - Slash command discovery from `.claude/commands/`
60
+ - SSE streaming for real-time responses
61
+ - Session sync across multiple clients (including CLI)
62
+ - REST API with OpenAPI docs at `/api/docs`
63
+
64
+ ## API
65
+
66
+ Once running, DorkOS exposes:
67
+
68
+ - **`GET /api/sessions`** - List all sessions
69
+ - **`POST /api/sessions`** - Create a new session
70
+ - **`GET /api/sessions/:id/messages`** - Get message history
71
+ - **`POST /api/sessions/:id/messages`** - Send a message (SSE stream)
72
+ - **`GET /api/sessions/:id/stream`** - Subscribe to session changes (SSE)
73
+ - **`GET /api/docs`** - Interactive API documentation (Scalar)
74
+ - **`GET /api/openapi.json`** - OpenAPI specification
75
+
76
+ ## License
77
+
78
+ MIT
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli.ts
4
+ import { parseArgs } from "node:util";
5
+ import os from "os";
6
+ import path from "path";
7
+ import { fileURLToPath } from "url";
8
+ import fs from "fs";
9
+
10
+ // src/check-claude.ts
11
+ import { execSync } from "child_process";
12
+ function checkClaude() {
13
+ try {
14
+ execSync("claude --version", { stdio: "pipe" });
15
+ } catch {
16
+ console.error("Error: Claude Code CLI not found in PATH.");
17
+ console.error("");
18
+ console.error("DorkOS requires the Claude Code CLI to function.");
19
+ console.error("Install it with: npm install -g @anthropic-ai/claude-code");
20
+ console.error("");
21
+ console.error("More info: https://docs.anthropic.com/en/docs/claude-code");
22
+ process.exit(1);
23
+ }
24
+ }
25
+
26
+ // src/cli.ts
27
+ var __dirname = path.dirname(fileURLToPath(import.meta.url));
28
+ var { values } = parseArgs({
29
+ options: {
30
+ port: { type: "string", short: "p", default: "6942" },
31
+ tunnel: { type: "boolean", short: "t", default: false },
32
+ dir: { type: "string", short: "d", default: process.cwd() },
33
+ help: { type: "boolean", short: "h" },
34
+ version: { type: "boolean", short: "v" }
35
+ },
36
+ allowPositionals: false
37
+ });
38
+ if (values.help) {
39
+ console.log(`
40
+ Usage: dorkos [options]
41
+
42
+ Web-based interface and REST/SSE API for Claude Code
43
+
44
+ Options:
45
+ -p, --port <port> Port to listen on (default: 6942)
46
+ -t, --tunnel Enable ngrok tunnel
47
+ -d, --dir <path> Working directory (default: current directory)
48
+ -h, --help Show this help message
49
+ -v, --version Show version number
50
+
51
+ Environment:
52
+ NGROK_AUTHTOKEN ngrok auth token (required for --tunnel)
53
+ TUNNEL_AUTH HTTP basic auth for tunnel (user:pass)
54
+ TUNNEL_DOMAIN Custom ngrok domain
55
+
56
+ Examples:
57
+ dorkos
58
+ dorkos --tunnel
59
+ dorkos --port 8080 --dir ~/projects/myapp
60
+ `);
61
+ process.exit(0);
62
+ }
63
+ if (values.version) {
64
+ console.log("0.1.0");
65
+ process.exit(0);
66
+ }
67
+ checkClaude();
68
+ var DORK_HOME = path.join(os.homedir(), ".dork");
69
+ fs.mkdirSync(DORK_HOME, { recursive: true });
70
+ process.env.DORK_HOME = DORK_HOME;
71
+ process.env.GATEWAY_PORT = values.port;
72
+ process.env.NODE_ENV = "production";
73
+ process.env.CLIENT_DIST_PATH = path.join(__dirname, "../client");
74
+ if (values.tunnel) process.env.TUNNEL_ENABLED = "true";
75
+ var resolvedDir = path.resolve(values.dir);
76
+ process.env.GATEWAY_CWD = resolvedDir;
77
+ var envPath = path.join(resolvedDir, ".env");
78
+ if (fs.existsSync(envPath)) {
79
+ const dotenv = await import("dotenv");
80
+ dotenv.config({ path: envPath });
81
+ }
82
+ await import("../server/index.js");
File without changes
@@ -0,0 +1,2 @@
1
+ import{r as n,N as h,c as x,j as r,a as f,b as u}from"./index-CkhDDYrb.js";var k=u("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),p=n.memo(({children:a,result:e,language:o,className:c,...m})=>{let i=n.useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]);return r.jsx("pre",{className:u(c,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":o,"data-streamdown":"code-block-body",style:i,...m,children:r.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:e.tokens.map((d,s)=>r.jsx("span",{className:k,children:d.map((t,l)=>r.jsx("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:t.color,backgroundColor:t.bgColor,...t.htmlStyle},...t.htmlAttrs,children:t.content},l))},s))})})},(a,e)=>a.result===e.result&&a.language===e.language&&a.className===e.className),j=({className:a,language:e,style:o,...c})=>r.jsx("div",{className:u("my-4 w-full overflow-hidden rounded-xl border border-border",a),"data-language":e,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...c}),N=({language:a,children:e})=>r.jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":a,"data-streamdown":"code-block-header",children:[r.jsx("span",{className:"ml-1 font-mono lowercase",children:a}),r.jsx("div",{className:"flex items-center gap-2",children:e})]}),y=({code:a,language:e,className:o,children:c,...m})=>{let{shikiTheme:i}=n.useContext(h),d=x(),s=n.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:a.split(`
2
+ `).map(g=>[{content:g,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[a]),[t,l]=n.useState(s);return n.useEffect(()=>{if(!d){l(s);return}let g=d.highlight({code:a,language:e,themes:i},b=>{l(b)});if(g){l(g);return}l(s)},[a,e,i,d,s]),r.jsx(f.Provider,{value:{code:a},children:r.jsxs(j,{language:e,children:[r.jsx(N,{language:e,children:c}),r.jsx(p,{className:o,language:e,result:t,...m})]})})};export{y as CodeBlock};
@@ -0,0 +1,2 @@
1
+ var R={};(function _(M,T,B,I){var k=!!(M.Worker&&M.Blob&&M.Promise&&M.OffscreenCanvas&&M.OffscreenCanvasRenderingContext2D&&M.HTMLCanvasElement&&M.HTMLCanvasElement.prototype.transferControlToOffscreen&&M.URL&&M.URL.createObjectURL),A=typeof Path2D=="function"&&typeof DOMMatrix=="function",V=(function(){if(!M.OffscreenCanvas)return!1;try{var e=new OffscreenCanvas(1,1),r=e.getContext("2d");r.fillRect(0,0,1,1);var a=e.transferToImageBitmap();r.createPattern(a,"no-repeat")}catch{return!1}return!0})();function L(){}function P(e){var r=T.exports.Promise,a=r!==void 0?r:M.Promise;return typeof a=="function"?new a(e):(e(L,L),null)}var x=(function(e,r){return{transform:function(a){if(e)return a;if(r.has(a))return r.get(a);var t=new OffscreenCanvas(a.width,a.height),o=t.getContext("2d");return o.drawImage(a,0,0),r.set(a,t),t},clear:function(){r.clear()}}})(V,new Map),F=(function(){var e=Math.floor(16.666666666666668),r,a,t={},o=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(r=function(i){var l=Math.random();return t[l]=requestAnimationFrame(function n(s){o===s||o+e-1<s?(o=s,delete t[l],i()):t[l]=requestAnimationFrame(n)}),l},a=function(i){t[i]&&cancelAnimationFrame(t[i])}):(r=function(i){return setTimeout(i,e)},a=function(i){return clearTimeout(i)}),{frame:r,cancel:a}})(),Z=(function(){var e,r,a={};function t(o){function i(l,n){o.postMessage({options:l||{},callback:n})}o.init=function(n){var s=n.transferControlToOffscreen();o.postMessage({canvas:s},[s])},o.fire=function(n,s,h){if(r)return i(n,null),r;var d=Math.random().toString(36).slice(2);return r=P(function(u){function f(m){m.data.callback===d&&(delete a[d],o.removeEventListener("message",f),r=null,x.clear(),h(),u())}o.addEventListener("message",f),i(n,d),a[d]=f.bind(null,{data:{callback:d}})}),r},o.reset=function(){o.postMessage({reset:!0});for(var n in a)a[n](),delete a[n]}}return function(){if(e)return e;if(!B&&k){var o=["var CONFETTI, SIZE = {}, module = {};","("+_.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
2
+ `);try{e=new Worker(URL.createObjectURL(new Blob([o])))}catch(i){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",i),null}t(e)}return e}})(),q={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function H(e,r){return r?r(e):e}function $(e){return e!=null}function v(e,r,a){return H(e&&$(e[r])?e[r]:q[r],a)}function G(e){return e<0?0:Math.floor(e)}function J(e,r){return Math.floor(Math.random()*(r-e))+e}function E(e){return parseInt(e,16)}function K(e){return e.map(Q)}function Q(e){var r=String(e).replace(/[^0-9a-f]/gi,"");return r.length<6&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),{r:E(r.substring(0,2)),g:E(r.substring(2,4)),b:E(r.substring(4,6))}}function X(e){var r=v(e,"origin",Object);return r.x=v(r,"x",Number),r.y=v(r,"y",Number),r}function Y(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function rr(e){var r=e.getBoundingClientRect();e.width=r.width,e.height=r.height}function er(e){var r=document.createElement("canvas");return r.style.position="fixed",r.style.top="0px",r.style.left="0px",r.style.pointerEvents="none",r.style.zIndex=e,r}function ar(e,r,a,t,o,i,l,n,s){e.save(),e.translate(r,a),e.rotate(i),e.scale(t,o),e.arc(0,0,1,l,n,s),e.restore()}function nr(e){var r=e.angle*(Math.PI/180),a=e.spread*(Math.PI/180);return{x:e.x,y:e.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:e.startVelocity*.5+Math.random()*e.startVelocity,angle2D:-r+(.5*a-Math.random()*a),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:e.color,shape:e.shape,tick:0,totalTicks:e.ticks,decay:e.decay,drift:e.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:e.gravity*3,ovalScalar:.6,scalar:e.scalar,flat:e.flat}}function tr(e,r){r.x+=Math.cos(r.angle2D)*r.velocity+r.drift,r.y+=Math.sin(r.angle2D)*r.velocity+r.gravity,r.velocity*=r.decay,r.flat?(r.wobble=0,r.wobbleX=r.x+10*r.scalar,r.wobbleY=r.y+10*r.scalar,r.tiltSin=0,r.tiltCos=0,r.random=1):(r.wobble+=r.wobbleSpeed,r.wobbleX=r.x+10*r.scalar*Math.cos(r.wobble),r.wobbleY=r.y+10*r.scalar*Math.sin(r.wobble),r.tiltAngle+=.1,r.tiltSin=Math.sin(r.tiltAngle),r.tiltCos=Math.cos(r.tiltAngle),r.random=Math.random()+2);var a=r.tick++/r.totalTicks,t=r.x+r.random*r.tiltCos,o=r.y+r.random*r.tiltSin,i=r.wobbleX+r.random*r.tiltCos,l=r.wobbleY+r.random*r.tiltSin;if(e.fillStyle="rgba("+r.color.r+", "+r.color.g+", "+r.color.b+", "+(1-a)+")",e.beginPath(),A&&r.shape.type==="path"&&typeof r.shape.path=="string"&&Array.isArray(r.shape.matrix))e.fill(ir(r.shape.path,r.shape.matrix,r.x,r.y,Math.abs(i-t)*.1,Math.abs(l-o)*.1,Math.PI/10*r.wobble));else if(r.shape.type==="bitmap"){var n=Math.PI/10*r.wobble,s=Math.abs(i-t)*.1,h=Math.abs(l-o)*.1,d=r.shape.bitmap.width*r.scalar,u=r.shape.bitmap.height*r.scalar,f=new DOMMatrix([Math.cos(n)*s,Math.sin(n)*s,-Math.sin(n)*h,Math.cos(n)*h,r.x,r.y]);f.multiplySelf(new DOMMatrix(r.shape.matrix));var m=e.createPattern(x.transform(r.shape.bitmap),"no-repeat");m.setTransform(f),e.globalAlpha=1-a,e.fillStyle=m,e.fillRect(r.x-d/2,r.y-u/2,d,u),e.globalAlpha=1}else if(r.shape==="circle")e.ellipse?e.ellipse(r.x,r.y,Math.abs(i-t)*r.ovalScalar,Math.abs(l-o)*r.ovalScalar,Math.PI/10*r.wobble,0,2*Math.PI):ar(e,r.x,r.y,Math.abs(i-t)*r.ovalScalar,Math.abs(l-o)*r.ovalScalar,Math.PI/10*r.wobble,0,2*Math.PI);else if(r.shape==="star")for(var c=Math.PI/2*3,g=4*r.scalar,p=8*r.scalar,y=r.x,w=r.y,C=5,b=Math.PI/C;C--;)y=r.x+Math.cos(c)*p,w=r.y+Math.sin(c)*p,e.lineTo(y,w),c+=b,y=r.x+Math.cos(c)*g,w=r.y+Math.sin(c)*g,e.lineTo(y,w),c+=b;else e.moveTo(Math.floor(r.x),Math.floor(r.y)),e.lineTo(Math.floor(r.wobbleX),Math.floor(o)),e.lineTo(Math.floor(i),Math.floor(l)),e.lineTo(Math.floor(t),Math.floor(r.wobbleY));return e.closePath(),e.fill(),r.tick<r.totalTicks}function or(e,r,a,t,o){var i=r.slice(),l=e.getContext("2d"),n,s,h=P(function(d){function u(){n=s=null,l.clearRect(0,0,t.width,t.height),x.clear(),o(),d()}function f(){B&&!(t.width===I.width&&t.height===I.height)&&(t.width=e.width=I.width,t.height=e.height=I.height),!t.width&&!t.height&&(a(e),t.width=e.width,t.height=e.height),l.clearRect(0,0,t.width,t.height),i=i.filter(function(m){return tr(l,m)}),i.length?n=F.frame(f):u()}n=F.frame(f),s=u});return{addFettis:function(d){return i=i.concat(d),h},canvas:e,promise:h,reset:function(){n&&F.cancel(n),s&&s()}}}function N(e,r){var a=!e,t=!!v(r||{},"resize"),o=!1,i=v(r,"disableForReducedMotion",Boolean),l=k&&!!v(r||{},"useWorker"),n=l?Z():null,s=a?Y:rr,h=e&&n?!!e.__confetti_initialized:!1,d=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,u;function f(c,g,p){for(var y=v(c,"particleCount",G),w=v(c,"angle",Number),C=v(c,"spread",Number),b=v(c,"startVelocity",Number),cr=v(c,"decay",Number),hr=v(c,"gravity",Number),ur=v(c,"drift",Number),j=v(c,"colors",K),dr=v(c,"ticks",Number),D=v(c,"shapes"),fr=v(c,"scalar"),vr=!!v(c,"flat"),U=X(c),z=y,O=[],mr=e.width*U.x,gr=e.height*U.y;z--;)O.push(nr({x:mr,y:gr,angle:w,spread:C,startVelocity:b,color:j[z%j.length],shape:D[J(0,D.length)],ticks:dr,decay:cr,gravity:hr,drift:ur,scalar:fr,flat:vr}));return u?u.addFettis(O):(u=or(e,O,s,g,p),u.promise)}function m(c){var g=i||v(c,"disableForReducedMotion",Boolean),p=v(c,"zIndex",Number);if(g&&d)return P(function(b){b()});a&&u?e=u.canvas:a&&!e&&(e=er(p),document.body.appendChild(e)),t&&!h&&s(e);var y={width:e.width,height:e.height};n&&!h&&n.init(e),h=!0,n&&(e.__confetti_initialized=!0);function w(){if(n){var b={getBoundingClientRect:function(){if(!a)return e.getBoundingClientRect()}};s(b),n.postMessage({resize:{width:b.width,height:b.height}});return}y.width=y.height=null}function C(){u=null,t&&(o=!1,M.removeEventListener("resize",w)),a&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,h=!1)}return t&&!o&&(o=!0,M.addEventListener("resize",w,!1)),n?n.fire(c,y,C):f(c,y,C)}return m.reset=function(){n&&n.reset(),u&&u.reset()},m}var S;function W(){return S||(S=N(null,{useWorker:!0,resize:!0})),S}function ir(e,r,a,t,o,i,l){var n=new Path2D(e),s=new Path2D;s.addPath(n,new DOMMatrix(r));var h=new Path2D;return h.addPath(s,new DOMMatrix([Math.cos(l)*o,Math.sin(l)*o,-Math.sin(l)*i,Math.cos(l)*i,a,t])),h}function lr(e){if(!A)throw new Error("path confetti are not supported in this browser");var r,a;typeof e=="string"?r=e:(r=e.path,a=e.matrix);var t=new Path2D(r),o=document.createElement("canvas"),i=o.getContext("2d");if(!a){for(var l=1e3,n=l,s=l,h=0,d=0,u,f,m=0;m<l;m+=2)for(var c=0;c<l;c+=2)i.isPointInPath(t,m,c,"nonzero")&&(n=Math.min(n,m),s=Math.min(s,c),h=Math.max(h,m),d=Math.max(d,c));u=h-n,f=d-s;var g=10,p=Math.min(g/u,g/f);a=[p,0,0,p,-Math.round(u/2+n)*p,-Math.round(f/2+s)*p]}return{type:"path",path:r,matrix:a}}function sr(e){var r,a=1,t="#000000",o='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof e=="string"?r=e:(r=e.text,a="scalar"in e?e.scalar:a,o="fontFamily"in e?e.fontFamily:o,t="color"in e?e.color:t);var i=10*a,l=""+i+"px "+o,n=new OffscreenCanvas(i,i),s=n.getContext("2d");s.font=l;var h=s.measureText(r),d=Math.ceil(h.actualBoundingBoxRight+h.actualBoundingBoxLeft),u=Math.ceil(h.actualBoundingBoxAscent+h.actualBoundingBoxDescent),f=2,m=h.actualBoundingBoxLeft+f,c=h.actualBoundingBoxAscent+f;d+=f+f,u+=f+f,n=new OffscreenCanvas(d,u),s=n.getContext("2d"),s.font=l,s.fillStyle=t,s.fillText(r,m,c);var g=1/a;return{type:"bitmap",bitmap:n.transferToImageBitmap(),matrix:[g,0,0,g,-d*g/2,-u*g/2]}}T.exports=function(){return W().apply(this,arguments)},T.exports.reset=function(){W().reset()},T.exports.create=N,T.exports.shapeFromPath=lr,T.exports.shapeFromText=sr})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),R,!1);const Mr=R.exports;R.exports.create;export{Mr as default};