@marimo-team/frontend 0.25.3-dev78 → 0.25.3-dev79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{edit-page-4qZ3DZjt.js → edit-page-D5LKeAwW.js} +1 -1
- package/dist/assets/{index-CDWL5dyB.js → index-BU1n9Awq.js} +2 -2
- package/dist/assets/{panels-Cez8PgGB.js → panels-D1i80TGn.js} +15 -15
- package/dist/assets/{run-page-Bn5ccbSI.js → run-page-CLP1s8uX.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@ it cannot parse or whose version it does not support. It also
|
|
|
9
9
|
checks that the file and its directory belong to the current user
|
|
10
10
|
and cannot be read by others, and that \`url\` points at this
|
|
11
11
|
machine.
|
|
12
|
-
`),j([`host`,`project`,`notebook`,`document`,`
|
|
12
|
+
`),j([`host`,`project`,`notebook`,`document`,`cell`,`runtime`,`attachment`,`run`,`execution`,`console`,`display`,`variable`,`custom`,`analysis`]).describe(`The kinds a stream carries, and the values \`types\` accepts. The
|
|
13
13
|
catalog stream carries host, project, notebook, runtime, and
|
|
14
14
|
attachment. A notebook's stream carries notebook, document,
|
|
15
|
-
|
|
15
|
+
cell, runtime, attachment, run, execution, console,
|
|
16
16
|
display, variable, and custom. Custom events describe occurrences
|
|
17
17
|
rather than object state.
|
|
18
18
|
`);var Ln=E({type:T().min(1).describe("A namespaced event type under a namespace the producer controls, such as `marimo.pair.agent-message`. Clients ignore types they do not recognize while retaining the stream cursor."),data:M().describe(`Any JSON value, including null. The producer defines its schema and consumers of the type validate it.`)}).describe(`A notebook occurrence with a producer-defined payload. It is replayed
|
|
@@ -64,7 +64,7 @@ the same id. Hosts publish a cell execution's variables before its
|
|
|
64
64
|
\`completed\` status, and remove a cell's previous execution and
|
|
65
65
|
its items before publishing the next one. A scratch execution's
|
|
66
66
|
names live only while it runs, so it publishes no variables.
|
|
67
|
-
`),$n=E({line:C().min(0).describe(`Zero-based line within the code.`),character:C().min(0).describe(`Zero-based offset in the line, in UTF-16 code units.`)}).describe(`A position within code, using LSP coordinates.`),er=E({start:$n,end:$n.describe(`Exclusive end. Equal to start when only a point is known.`)}).describe(`A span within code.`),tr=E({cell_id:Z,range:D([er,k()]).describe(`Where in that cell, when known.`),message:T().describe("What that cell contributes, such as `reads x from C`.")}).describe(`A cell involved in an error, possibly the one carrying it.`),nr=E({kind:T().describe("The producer's identifier, scoped by source. Open; this protocol defines `exception`, `interrupted`, and `internal` for executions
|
|
67
|
+
`),$n=E({line:C().min(0).describe(`Zero-based line within the code.`),character:C().min(0).describe(`Zero-based offset in the line, in UTF-16 code units.`)}).describe(`A position within code, using LSP coordinates.`),er=E({start:$n,end:$n.describe(`Exclusive end. Equal to start when only a point is known.`)}).describe(`A span within code.`),tr=E({cell_id:Z,range:D([er,k()]).describe(`Where in that cell, when known.`),message:T().describe("What that cell contributes, such as `reads x from C`.")}).describe(`A cell involved in an error, possibly the one carrying it.`),nr=E({kind:T().describe("The producer's identifier, scoped by source. Open; this protocol defines `exception`, `interrupted`, and `internal` for executions. Clients show unrecognized kinds as plain errors."),message:T().describe(`A description of the error to show people.`),source:T().nullable().describe("Who produced it, such as `marimo` or a SQL analyzer. Scopes kind."),severity:j([`error`,`warning`,`information`,`hint`]).describe(`Error unless the producer says otherwise. Only error affects scheduling.`),range:D([er,k()]).describe(`Where in the code, when known.`),name:T().nullable().describe("The exception class, such as `ZeroDivisionError`. Set when kind is exception, null otherwise."),traceback:D([Xn,k()]).describe(`The traceback as rendered by the runtime, plain text or HTML by its mimetype. Null when unavailable or not shown.`),related:O(tr).describe(`Every involved cell, including this one, in canonical order. Each copy of a cross-cell error carries the same list; clients deduplicate on kind and related cell ids. Empty when the error involves this code alone.`)}).describe(`A problem shaped like an LSP diagnostic. Further members are
|
|
68
68
|
kind-specific, as in Problem Details, and a client ignores
|
|
69
69
|
members it does not know.
|
|
70
70
|
`),rr=E({kind:j([`value`]),display:D([Xn,k()]).describe(`The value as last rendered. Replaced as it grows. Null when the code produced no value.`)}),ir=E({kind:j([`error`]),error:nr}),ar=E({kind:j([`interrupted`])}),or=D([rr,ir,ar]).describe("How an execution ended, tagged on `kind`. A `value` carries the\nexecution's value as last rendered; while the execution is\nrunning it is the value so far, and it is final once the\nexecution is `completed`. An `error` carries the error that ended it.\nAn `interrupted` execution was cancelled before or during execution. Other\nkinds are defined by later versions of this protocol.\n"),Q=T().describe(`An identifier derived from content, so that every host, kernel,
|
|
@@ -80,28 +80,28 @@ same id, and items are removed with their execution.
|
|
|
80
80
|
`),lr=E({id:Fn,execution_id:X,seq:C().min(0).describe(`Position among the execution's items, increasing in the order they were produced.`),mimetype:T().describe("The format of `data`, such as `image/png`."),data:T().describe(`The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.`)}).describe(`A value an execution showed as a side effect, such as a figure
|
|
81
81
|
from \`plt.show()\`. A producer replaces one by sending it again
|
|
82
82
|
with the same id, which is how a progress bar updates in place.
|
|
83
|
-
`),ur=E({column:C().nullable().describe(`The column the cell sits in, for multi-column layouts. Null in a single column.`),disabled:S().describe(`Whether the cell is kept from running.`),hide_code:S().describe("Whether clients hide the code by default. This is a presentation preference; source availability is represented by `Cell.code`."),expand_output:S().describe(`Whether clients show the full output rather than a scrolled box.`)}).describe(`How a cell is laid out and whether it runs. Every field is always present, so a cell's etag is well defined.`),dr=E({
|
|
84
|
-
are the edges of the dependency graph, and the errors found in the
|
|
85
|
-
text alone or across the set of cells. A pure function of the
|
|
86
|
-
code, so two producers compute the same values.
|
|
87
|
-
`),fr=E({notebook_id:jn.describe(`The notebook this analysis belongs to.`),document_etag:Q.describe("The document revision this analysis describes. Equal to the document's `etag` while the analysis is current."),cells:w(T(),dr).describe(`Every cell of that revision, by id.`)}).describe(`What a document's cells imply, computed together over one
|
|
88
|
-
revision of the document so that cross-cell errors agree. One
|
|
89
|
-
per notebook, and removed with it. It follows the document it
|
|
90
|
-
describes, and \`document_etag\` says which revision that is.
|
|
91
|
-
`),pr=E({id:Z,notebook_id:jn,code:T().nullable().describe(`The cell's source code, with newline line endings, or null when the host does not expose source to this client. An empty string is an empty cell. A host normalizes other line endings when it loads a file. Source availability does not grant editing permission; see the notebook's operations.`),name:T().describe("The cell's name. `_` for an anonymous cell; otherwise a Python identifier, unique within the notebook."),config:ur,etag:Q.describe("Identifies code, name, and config together, and is the precondition for editing the cell. Its text is `code_hash`, `name`, and the config values `column`, `disabled`, `hide_code`, and `expand_output` in that order, each written as a JSON scalar such as `null`, `0`, or `true`."),code_hash:Q.describe("Identifies the code alone. Its text is the actual source, even when `code` is null. Withholding source does not change this hash, the cell or document etags, or their versions. Unchanged by renaming the cell or editing its config. Compare with an execution's `code_hash` to tell whether a result came from the current code without needing the source."),version:C().min(1).describe(`The document version at which the cell was created or last changed.`)}).describe(`A unit of code and configuration in the document. A cell event
|
|
83
|
+
`),ur=E({column:C().nullable().describe(`The column the cell sits in, for multi-column layouts. Null in a single column.`),disabled:S().describe(`Whether the cell is kept from running.`),hide_code:S().describe("Whether clients hide the code by default. This is a presentation preference; source availability is represented by `Cell.code`."),expand_output:S().describe(`Whether clients show the full output rather than a scrolled box.`)}).describe(`How a cell is laid out and whether it runs. Every field is always present, so a cell's etag is well defined.`),dr=E({id:Z,notebook_id:jn,code:T().nullable().describe(`The cell's source code, with newline line endings, or null when the host does not expose source to this client. An empty string is an empty cell. A host normalizes other line endings when it loads a file. Source availability does not grant editing permission; see the notebook's operations.`),name:T().describe("The cell's name. `_` for an anonymous cell; otherwise a Python identifier, unique within the notebook."),config:ur,etag:Q.describe("Identifies code, name, and config together, and is the precondition for editing the cell. Its text is `code_hash`, `name`, and the config values `column`, `disabled`, `hide_code`, and `expand_output` in that order, each written as a JSON scalar such as `null`, `0`, or `true`."),code_hash:Q.describe("Identifies the code alone. Its text is the actual source, even when `code` is null. Withholding source does not change this hash, the cell or document etags, or their versions. Unchanged by renaming the cell or editing its config. Compare with an execution's `code_hash` to tell whether a result came from the current code without needing the source."),version:C().min(1).describe(`The document version at which the cell was created or last changed.`)}).describe(`A unit of code and configuration in the document. A cell event
|
|
92
84
|
fires when its code, name, or config changes. Markdown and SQL
|
|
93
85
|
cells are code that calls \`mo.md\` or \`mo.sql\`; a client chooses
|
|
94
86
|
the editor to show.
|
|
95
|
-
`),
|
|
87
|
+
`),fr=E({notebook_id:jn.describe(`The notebook this document belongs to.`),order:O(Z).describe(`Cell ids in display order. A permutation of the notebook's cells, each appearing exactly once.`),app_config:w(T(),M()).describe("Notebook-level settings, the keyword arguments to `marimo.App` such as `width` and `app_title`. Informational for now; no change sets it over this protocol."),etag:Q.describe("Identifies the document as currently applied. Its text is `order_etag`, `app_config_etag`, and every cell's `etag` in order, so it changes when any of them does."),saved_etag:D([Q,k()]).describe("Identifies the document as last written to the host's store, computed the same way over that state. Equal to `etag` when every accepted change has been persisted. Null when nothing has been persisted, which is the case for a scratch copy."),order_etag:Q.describe(`Identifies the order alone. Its text is the cell IDs in order as a JSON array, with no whitespace and strings carrying only the escapes JSON requires. Editing a cell does not change it.`),app_config_etag:Q.describe(`Identifies the app config alone. Its text is the app config as canonical JSON, with keys sorted by code point, no whitespace, and strings carrying only the escapes JSON requires.`),version:C().min(1).describe(`Counts changes to the cells, the order, or the app config. A save does not advance it. Comparable only within one notebook while it is in the catalog.`)}).describe(`The document as a whole, without its cells, which are their own
|
|
96
88
|
objects: the cell order and app config. One per notebook,
|
|
97
89
|
and removed with it. The order and the app
|
|
98
90
|
config carry their own etags, so an edit to one does not conflict
|
|
99
91
|
with an edit to the other, or with edits to cells.
|
|
100
|
-
`),hr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),host:Rn}).describe("The data of a `host` event. The host object, plus which request caused the event and when."),gr=E({event:j([`host`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:hr}).describe("A `host` event from a host stream."),_r=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),project:Bn}).describe("The data of a `project` event. The project as it now is."),vr=E({event:j([`project`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:_r}).describe("A `project` event from a host stream."),yr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),notebook:Vn}).describe("The data of a `notebook` event. The notebook as it now is."),br=E({event:j([`notebook`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:yr}).describe("A `notebook` event from a host stream."),xr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),document:mr}).describe("The data of a `document` event. The document as it now is."),Sr=E({event:j([`document`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:xr}).describe("A `document` event from a host stream."),Cr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),analysis:fr}).describe("The data of an `analysis` event. The analysis as it now is."),wr=E({event:j([`analysis`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Cr}).describe("A `analysis` event from a host stream."),Tr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),cell:pr}).describe("The data of a `cell` event. The cell as it now is."),Er=E({event:j([`cell`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Tr}).describe("A `cell` event from a host stream."),Dr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),runtime:Un}).describe("The data of a `runtime` event. The runtime as it now is."),Or=E({event:j([`runtime`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Dr}).describe("A `runtime` event from a host stream."),kr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),attachment:Kn}).describe("The data of an `attachment` event. The attachment as it now is."),Ar=E({event:j([`attachment`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:kr}).describe("A `attachment` event from a host stream."),jr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),run:Yn}).describe("The data of a `run` event. The run as it now is."),Mr=E({event:j([`run`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:jr}).describe("A `run` event from a host stream."),Nr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),execution:sr}).describe("The data of an `execution` event. The execution as it now is."),Pr=E({event:j([`execution`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Nr}).describe("A `execution` event from a host stream."),Fr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),console:cr}).describe("The data of a `console` event. The item as it now is."),Ir=E({event:j([`console`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Fr}).describe("A `console` event from a host stream."),Lr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),display:lr}).describe("The data of a `display` event. The item as it now is."),Rr=E({event:j([`display`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Lr}).describe("A `display` event from a host stream."),zr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),variable:Qn}).describe("The data of a `variable` event. The item as it now is."),Br=E({event:j([`variable`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:zr}).describe("A `variable` event from a host stream."),Vr=E({custom:Ln,request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).describe(`When the host emitted this event. Preserved on replay.`)}).describe("The data of a `custom` event. This envelope is standardized; the custom type and payload are defined by their producer."),Hr=E({event:j([`custom`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Vr}).describe("A `custom` event from a host stream."),$=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),id:T().describe(`The id of the object that was removed.`)}).describe("The data of a `project.removed`, `notebook.removed`,\n`cell.removed`, `runtime.removed`, `attachment.removed`,\n`run.removed`, `execution.removed`, `console.removed`,\n`display.removed`, or `variable.removed` event. The client deletes the object with this\nid; the event name says which kind it is. Removing a notebook\nremoves its document and cells with it, without events of their\nown; the document never has one.\n"),Ur=E({event:j([`project.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `project.removed` event from a host stream."),Wr=E({event:j([`notebook.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `notebook.removed` event from a host stream."),Gr=E({event:j([`cell.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `cell.removed` event from a host stream."),Kr=E({event:j([`runtime.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `runtime.removed` event from a host stream."),qr=E({event:j([`attachment.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `attachment.removed` event from a host stream."),Jr=E({event:j([`run.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `run.removed` event from a host stream."),Yr=E({event:j([`execution.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `execution.removed` event from a host stream."),Xr=E({event:j([`console.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `console.removed` event from a host stream."),Zr=E({event:j([`display.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `display.removed` event from a host stream."),Qr=E({event:j([`variable.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `variable.removed` event from a host stream."),$r=E({event:j([`reset`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:E({})}).describe("A `reset` event from a host stream."),ei=E({event:j([`ready`]),id:T().min(1).describe(`The resume cursor. Omitted on snapshot and reset events.`),data:E({})}).describe("A `ready` event from a host stream."),ti=D([gr,vr,br,Sr,wr,Er,Or,Ar,Mr,Pr,Ir,Rr,Br,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei]).describe(`A record, removal, or control message from a host stream.
|
|
92
|
+
`),pr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),host:Rn}).describe("The data of a `host` event. The host object, plus which request caused the event and when."),mr=E({event:j([`host`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:pr}).describe("A `host` event from a host stream."),hr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),project:Bn}).describe("The data of a `project` event. The project as it now is."),gr=E({event:j([`project`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:hr}).describe("A `project` event from a host stream."),_r=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),notebook:Vn}).describe("The data of a `notebook` event. The notebook as it now is."),vr=E({event:j([`notebook`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:_r}).describe("A `notebook` event from a host stream."),yr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),document:fr}).describe("The data of a `document` event. The document as it now is."),br=E({event:j([`document`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:yr}).describe("A `document` event from a host stream."),xr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),cell:dr}).describe("The data of a `cell` event. The cell as it now is."),Sr=E({event:j([`cell`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:xr}).describe("A `cell` event from a host stream."),Cr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),runtime:Un}).describe("The data of a `runtime` event. The runtime as it now is."),wr=E({event:j([`runtime`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Cr}).describe("A `runtime` event from a host stream."),Tr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),attachment:Kn}).describe("The data of an `attachment` event. The attachment as it now is."),Er=E({event:j([`attachment`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Tr}).describe("A `attachment` event from a host stream."),Dr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),run:Yn}).describe("The data of a `run` event. The run as it now is."),Or=E({event:j([`run`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Dr}).describe("A `run` event from a host stream."),kr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),execution:sr}).describe("The data of an `execution` event. The execution as it now is."),Ar=E({event:j([`execution`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:kr}).describe("A `execution` event from a host stream."),jr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),console:cr}).describe("The data of a `console` event. The item as it now is."),Mr=E({event:j([`console`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:jr}).describe("A `console` event from a host stream."),Nr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),display:lr}).describe("The data of a `display` event. The item as it now is."),Pr=E({event:j([`display`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Nr}).describe("A `display` event from a host stream."),Fr=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),variable:Qn}).describe("The data of a `variable` event. The item as it now is."),Ir=E({event:j([`variable`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Fr}).describe("A `variable` event from a host stream."),Lr=E({custom:Ln,request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).describe(`When the host emitted this event. Preserved on replay.`)}).describe("The data of a `custom` event. This envelope is standardized; the custom type and payload are defined by their producer."),Rr=E({event:j([`custom`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Lr}).describe("A `custom` event from a host stream."),$=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),id:T().describe(`The id of the object that was removed.`)}).describe("The data of a `project.removed`, `notebook.removed`,\n`cell.removed`, `runtime.removed`, `attachment.removed`,\n`run.removed`, `execution.removed`, `console.removed`,\n`display.removed`, or `variable.removed` event. The client deletes the object with this\nid; the event name says which kind it is. Removing a notebook\nremoves its document and cells with it, without events of their\nown; the document never has one.\n"),zr=E({event:j([`project.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `project.removed` event from a host stream."),Br=E({event:j([`notebook.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `notebook.removed` event from a host stream."),Vr=E({event:j([`cell.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `cell.removed` event from a host stream."),Hr=E({event:j([`runtime.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `runtime.removed` event from a host stream."),Ur=E({event:j([`attachment.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `attachment.removed` event from a host stream."),Wr=E({event:j([`run.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `run.removed` event from a host stream."),Gr=E({event:j([`execution.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `execution.removed` event from a host stream."),Kr=E({event:j([`console.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `console.removed` event from a host stream."),qr=E({event:j([`display.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `display.removed` event from a host stream."),Jr=E({event:j([`variable.removed`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$}).describe("A `variable.removed` event from a host stream."),Yr=E({event:j([`reset`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:E({})}).describe("A `reset` event from a host stream."),Xr=E({event:j([`ready`]),id:T().min(1).describe(`The resume cursor. Omitted on snapshot and reset events.`),data:E({})}).describe("A `ready` event from a host stream."),Zr=E({defs:O(T()).describe(`Names this cell defines.`),refs:O(T()).describe(`Names this cell reads from other cells.`),errors:O(nr).describe("Diagnostics about the code. Only an `error` affects scheduling. `multiple-definitions` lists the definers in `related`, each `range` at its definition; `cycle-dependencies` lists the cycle. Both are reported on every cell involved, differing only in `range`. Every other kind belongs to the analyzer named in `source`.")}).describe(`Experimental (analysis). What a cell's text implies: the names it defines and reads, which
|
|
93
|
+
are the edges of the dependency graph, and the errors found in the
|
|
94
|
+
text alone or across the set of cells. A pure function of the
|
|
95
|
+
code, so two producers compute the same values.
|
|
96
|
+
`),Qr=E({notebook_id:jn.describe(`The notebook this analysis belongs to.`),document_etag:Q.describe("The document revision this analysis describes. Equal to the document's `etag` while the analysis is current."),cells:w(T(),Zr).describe(`Every cell of that revision, by id.`)}).describe(`Experimental (analysis). What a document's cells imply, computed together over one
|
|
97
|
+
revision of the document so that cross-cell errors agree. One
|
|
98
|
+
per notebook, and removed with it. It follows the document it
|
|
99
|
+
describes, and \`document_etag\` says which revision that is.
|
|
100
|
+
`),$r=E({request_id:T().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:K({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),analysis:Qr}).describe("Experimental (analysis). The data of an `analysis` event. The analysis as it now is."),ei=E({event:j([`analysis`]),id:T().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:$r}).describe("Experimental (analysis). A `analysis` event from a host stream."),ti=D([mr,gr,vr,br,Sr,wr,Er,Or,Ar,Mr,Pr,Ir,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,ei]).describe(`A record, removal, or control message from a host stream.
|
|
101
101
|
The data is decoded JSON. Snapshot records and reset events omit
|
|
102
102
|
the cursor; ready and live events carry it. Unknown event names
|
|
103
103
|
belong to later versions or host extensions.
|
|
104
|
-
`),ni=E({id:T().describe(`Identifies this answer.`),label:T().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),ri=E({id:T().describe(`Identifies the question when the client answers it.`),prompt:T().describe(`The question, worded for a person.`),options:O(ni).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),ii=E({change:C().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:D([pr,k()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:mr}).describe(`The first stale change of an edit or run, and the state the host holds.`);E({type:T().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:T().describe(`A short, human-readable name for the kind of problem.`),status:C().min(400).max(599).describe(`The HTTP status code of the response.`),detail:T().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:O(ri).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:ii.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"),E({project_id:An,path:T().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:T().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),E({path:T().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:T().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),E({url:T().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),E({decisions:w(T(),T()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")});var ai=E({column:C().nullish().default(null),disabled:S().default(!1),hide_code:S().default(!1),expand_output:S().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),oi=E({id:Z.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:T().describe(`The cell's source code.`),name:T().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:ai.optional()}).describe(`A cell as a client writes it. Code must be a string, even when the host withholds source in cell records. Null is not an edit or a request to preserve existing source. The host derives the etags and the analysis.`),si=E({kind:j([`put_cell`]),base_etag:T().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:oi,after:Z.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:Z.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),ci=E({kind:j([`delete_cell`]),id:Z.describe(`The cell to remove.`),base_etag:T().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),li=E({kind:j([`set_order`]),base_etag:T().describe("The document's `order_etag` as last read, or `*`."),order:O(Z).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),ui=D([si,ci,li]).describe("One change to the document, tagged on `kind`.");E({changes:O(ui).describe(`The changes, applied in order as one unit.`)});var di=E({etag:Q,code_hash:Q,version:C().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`);E({document:mr,cells:w(T(),D([di,k()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document as an edit or save left it, or at a later revision, and the cells it touched.`),E({decisions:w(T(),T()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");var fi=E({id:Z,code_hash:Q.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")});E({code:T().optional().describe(`Python code to run as scratch code.`),cells:O(fi).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`.");function pi(e){let t=Object.keys(e);return{initial:Object.fromEntries(t.map(t=>[t,e[t].initial])),reduce(n,r,i){let a=n;for(let n of t){let t=e[n].on[r.event];if(t===void 0)continue;let o=a[n],s=t(o,r,i);s!==o&&(a={...a,[n]:s})}return a}}}function mi(e){switch(e.event){case`document`:return e.data.document.notebook_id;case`cell`:return e.data.cell.notebook_id;case`analysis`:return e.data.analysis.notebook_id;case`runtime`:return e.data.runtime.notebook_id;case`attachment`:return e.data.attachment.notebook_id;case`run`:return e.data.run.notebook_id;default:return}}function hi(e){let t=pi(e),n=t.initial,r={phase:`snapshot`,notebookId:null,notebook:null,resources:n};function i(e,t){if(e.notebookId===t)return e;if(e.notebookId!==null)throw Error(`Notebook stream changed identity`);return{...e,notebookId:t}}function a(e){return e.resources===n&&e.notebook===null?e:{...e,notebook:null,resources:n}}function o(e,n){let r=t.reduce(e.resources,n,{phase:e.phase});return r===e.resources?e:{...e,resources:r}}return{initial:r,reduce(e,t){switch(t.event){case`reset`:return r;case`ready`:return{...o(e,t),phase:`live`};case`notebook`:return{...i(e,t.data.notebook.id),notebook:t.data.notebook};case`host`:case`project`:case`project.removed`:return e;case`notebook.removed`:return e.notebookId!==null&&t.data.id!==e.notebookId?e:a(e);default:{let n=mi(t);return o(n===void 0?e:i(e,n),t)}}}}}var gi=E({event:T().min(1),data:M(),id:T().min(1).optional()}),_i=new Set(ti.options.flatMap(e=>e.shape.event.options)),vi=E({event:_e(`marimo`),id:T().min(1).optional(),data:E({marimo:M()})}),yi=E({data:M()});function bi(e){if(typeof e==`object`&&e&&!(`event`in e))return{event:`marimo`,data:{marimo:yi.parse(e).data}};let t=gi.parse(e);return t.event===`marimo`?vi.parse(t):_i.has(t.event)?ti.parse(t):{event:`unknown`,name:t.event,id:t.id}}var xi={initial:[],on:{attachment:(e,{data:{attachment:t}})=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t],"attachment.removed":(e,{data:t})=>e.some(e=>e.id===t.id)?e.filter(e=>e.id!==t.id):e}};function Si(e){return e.pending??{revision:e.current?.revision??null,cells:e.current?.cells??new Map}}function Ci(e,t){let n=new Set(e.order);if(n.size!==e.order.length||n.size!==t.size||[...n].some(e=>!t.has(e))||[...t.values()].some(t=>t.version>e.version))throw Error(`Document records do not match its revision and order`);return{current:{revision:e,cells:t},pending:null}}var wi={initial:{current:null,pending:null},on:{cell:(e,{data:t})=>{let n=Si(e);return{...e,pending:{revision:n.revision,cells:new Map(n.cells).set(t.cell.id,t.cell)}}},"cell.removed":(e,{data:t})=>{let n=Si(e);if(!n.cells.has(t.id))return e;let r=new Map(n.cells);return r.delete(t.id),{...e,pending:{...n,cells:r}}},document:(e,{data:t},{phase:n})=>{let{cells:r}=Si(e);return n===`snapshot`?{...e,pending:{revision:t.document,cells:r}}:Ci(t.document,r)},ready:(e,t,{phase:n})=>{if(e.pending===null)return e;if(n===`live`)throw Error(`Stream ended with an incomplete document update`);return e.pending.revision===null?{current:null,pending:null}:Ci(e.pending.revision,e.pending.cells)}}},Ti=new Set([`reset`,`marimo`,`unknown`]);function Ei(e){let t=r({state:R.NOT_STARTED}),n=hi({document:wi,attachments:xi}),i=r(n.initial),a=r(!1),o=r(e=>e(a)&&e(t).state===R.OPEN?e(i).notebook:null),s=r(e=>e(i).resources.document.current),c=r(e=>e(a)&&e(t).state===R.OPEN?e(i).resources.attachments:xi.initial),l,u={connectionAtom:t,notebookAtom:o,documentAtom:s,attachmentsAtom:c,reconnect:async()=>l?.()};function d({createTransport:r,url:o,signal:s,waitUntilReady:c,checkHealth:u,onNotification:d,decodeJson:f,classifyClose:p}){if(s.aborted)return;let m=!0,h=!1,g=!1,ee,_=null,v=r(()=>{let t=new URL(o());if(t.searchParams.delete(`cursor`),s.aborted)return t.toString();let r=new URL(t);r.searchParams.delete(`access_token`),r.searchParams.sort();let c=r.toString(),l=e.get(i),u=c!==ee||l.phase===`snapshot`?n.initial:l;return u.phase===`snapshot`&&(_=null),ee=c,e.set(a,!1),e.set(i,u),_!==null&&t.searchParams.set(`cursor`,_),t.toString()}),y=n=>{e.set(a,!1),e.set(t,n)},b={state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`};function te(e,t){!s.aborted&&!h&&m&&(m=!1,v.reconnect(e,t))}function x(){s.aborted||h||(m=!0,y({state:R.OPEN}))}function ne(e){if(s.aborted||h)return;F.warn(`Notebook connection closed`,e.code,e.reason);let t=p(e);y(t.status),t.kind===`terminal`?(h=!0,v.close()):t.kind===`retry`?te(e.code,e.reason):h=!0}function re(e){s.aborted||h||(F.warn(`Notebook connection error`,e),y(b),te())}function ie(t){if(s.aborted||h)return;let r;try{r=bi(f(t.data));let o=e.get(i);if(o.phase===`live`&&r.id===void 0&&!Ti.has(r.event))throw Error(`Live notebook event is missing its cursor`);r.event!==`marimo`&&r.event!==`unknown`&&e.set(i,n.reduce(o,r)),r.event===`reset`?_=null:(r.event===`ready`||o.phase===`live`)&&(_=r.id??_),(r.event===`ready`||r.event===`reset`)&&e.set(a,r.event===`ready`)}catch(t){F.error(`Failed to decode notebook message`,t),e.set(i,n.initial),_=null,h=!0,y({...b,reason:`Failed to decode notebook message`}),v.close();return}r.event===`marimo`&&d(r.data.marimo)}l=async()=>{if(!(s.aborted||g||v.readyState===L.OPEN||v.readyState===L.CONNECTING)){g=!0,y({state:R.CONNECTING});try{let e=await u();if(s.aborted)return;if(!e){m=!1,y(b);return}h=!1,m=!0,v.reconnect()}catch(e){s.aborted||(F.error(`Notebook health check failed`,e),m=!1,y(b))}finally{g=!1}}},s.addEventListener(`abort`,()=>{v.removeEventListener(`open`,x),v.removeEventListener(`close`,ne),v.removeEventListener(`error`,re),v.removeEventListener(`message`,ie),v.close(),l=void 0,e.set(i,n.initial),y({state:R.NOT_STARTED})},{once:!0}),v.addEventListener(`open`,x),v.addEventListener(`close`,ne),v.addEventListener(`error`,re),v.addEventListener(`message`,ie),v.readyState===L.CLOSED&&(y({state:R.CONNECTING}),c().then(()=>{s.aborted||v.reconnect()}).catch(e=>{s.aborted||(F.error(`Healthy connection never made`,e),h=!0,y(b),v.close())}))}return{client:u,connect:d}}var Di=`MARIMO_TRANSPORT_EXHAUSTED`,Oi=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new Rt(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:Di,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}};function ki(e){switch(e.reason){case Di:return{kind:`gave-up`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_NO_FILE_KEY`:case`MARIMO_NO_SESSION_ID`:case`MARIMO_NO_SESSION`:case`MARIMO_SHUTDOWN`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_UNAUTHORIZED`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`not authorized`}};case`MARIMO_KIOSK_NOT_ALLOWED`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kiosk mode is not available for this session`}};case`MARIMO_KERNEL_STARTUP_ERROR`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_STARTUP_ERROR,reason:`Failed to start kernel sandbox`}};default:e.reason&&F.warn(`Unrecognized connection close reason`,e.reason)}return{kind:`retry`,status:{state:R.CONNECTING}}}var Ai=1e4,ji=1e3,Mi=1e4,Ni=1.3,Pi=1006,Fi=class{subscriptions=new Se;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){F.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),Ai),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;F.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??Pi,reason:r?Di:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(ji*Ni**this.retryCount,Mi);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=null,o=[],s=()=>{if(o.length===0)return i=null,a=null,null;let e=o.join(`
|
|
104
|
+
`),ni=E({id:T().describe(`Identifies this answer.`),label:T().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),ri=E({id:T().describe(`Identifies the question when the client answers it.`),prompt:T().describe(`The question, worded for a person.`),options:O(ni).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),ii=E({change:C().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:D([dr,k()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:fr}).describe(`The first stale change of an edit or run, and the state the host holds.`);E({type:T().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:T().describe(`A short, human-readable name for the kind of problem.`),status:C().min(400).max(599).describe(`The HTTP status code of the response.`),detail:T().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:O(ri).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:ii.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"),E({project_id:An,path:T().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:T().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),E({path:T().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:T().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),E({url:T().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),E({decisions:w(T(),T()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")});var ai=E({column:C().nullish().default(null),disabled:S().default(!1),hide_code:S().default(!1),expand_output:S().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),oi=E({id:Z.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:T().describe(`The cell's source code.`),name:T().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:ai.optional()}).describe(`A cell as a client writes it. Code must be a string, even when the host withholds source in cell records. Null is not an edit or a request to preserve existing source. The host derives the etags.`),si=E({kind:j([`put_cell`]),base_etag:T().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:oi,after:Z.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:Z.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),ci=E({kind:j([`delete_cell`]),id:Z.describe(`The cell to remove.`),base_etag:T().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),li=E({kind:j([`set_order`]),base_etag:T().describe("The document's `order_etag` as last read, or `*`."),order:O(Z).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),ui=D([si,ci,li]).describe("One change to the document, tagged on `kind`.");E({changes:O(ui).describe(`The changes, applied in order as one unit.`)});var di=E({etag:Q,code_hash:Q,version:C().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`);E({document:fr,cells:w(T(),D([di,k()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document as an edit or save left it, or at a later revision, and the cells it touched.`),E({decisions:w(T(),T()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");var fi=E({id:Z,code_hash:Q.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")});E({code:T().optional().describe(`Python code to run as scratch code.`),cells:O(fi).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`.");function pi(e){let t=Object.keys(e);return{initial:Object.fromEntries(t.map(t=>[t,e[t].initial])),reduce(n,r,i){let a=n;for(let n of t){let t=e[n].on[r.event];if(t===void 0)continue;let o=a[n],s=t(o,r,i);s!==o&&(a={...a,[n]:s})}return a}}}function mi(e){switch(e.event){case`document`:return e.data.document.notebook_id;case`cell`:return e.data.cell.notebook_id;case`analysis`:return e.data.analysis.notebook_id;case`runtime`:return e.data.runtime.notebook_id;case`attachment`:return e.data.attachment.notebook_id;case`run`:return e.data.run.notebook_id;default:return}}function hi(e){let t=pi(e),n=t.initial,r={phase:`snapshot`,notebookId:null,notebook:null,resources:n};function i(e,t){if(e.notebookId===t)return e;if(e.notebookId!==null)throw Error(`Notebook stream changed identity`);return{...e,notebookId:t}}function a(e){return e.resources===n&&e.notebook===null?e:{...e,notebook:null,resources:n}}function o(e,n){let r=t.reduce(e.resources,n,{phase:e.phase});return r===e.resources?e:{...e,resources:r}}return{initial:r,reduce(e,t){switch(t.event){case`reset`:return r;case`ready`:return{...o(e,t),phase:`live`};case`notebook`:return{...i(e,t.data.notebook.id),notebook:t.data.notebook};case`host`:case`project`:case`project.removed`:return e;case`notebook.removed`:return e.notebookId!==null&&t.data.id!==e.notebookId?e:a(e);default:{let n=mi(t);return o(n===void 0?e:i(e,n),t)}}}}}var gi=E({event:T().min(1),data:M(),id:T().min(1).optional()}),_i=new Set(ti.options.flatMap(e=>e.shape.event.options)),vi=E({event:_e(`marimo`),id:T().min(1).optional(),data:E({marimo:M()})}),yi=E({data:M()});function bi(e){if(typeof e==`object`&&e&&!(`event`in e))return{event:`marimo`,data:{marimo:yi.parse(e).data}};let t=gi.parse(e);return t.event===`marimo`?vi.parse(t):_i.has(t.event)?ti.parse(t):{event:`unknown`,name:t.event,id:t.id}}var xi={initial:[],on:{attachment:(e,{data:{attachment:t}})=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t],"attachment.removed":(e,{data:t})=>e.some(e=>e.id===t.id)?e.filter(e=>e.id!==t.id):e}};function Si(e){return e.pending??{revision:e.current?.revision??null,cells:e.current?.cells??new Map}}function Ci(e,t){let n=new Set(e.order);if(n.size!==e.order.length||n.size!==t.size||[...n].some(e=>!t.has(e))||[...t.values()].some(t=>t.version>e.version))throw Error(`Document records do not match its revision and order`);return{current:{revision:e,cells:t},pending:null}}var wi={initial:{current:null,pending:null},on:{cell:(e,{data:t})=>{let n=Si(e);return{...e,pending:{revision:n.revision,cells:new Map(n.cells).set(t.cell.id,t.cell)}}},"cell.removed":(e,{data:t})=>{let n=Si(e);if(!n.cells.has(t.id))return e;let r=new Map(n.cells);return r.delete(t.id),{...e,pending:{...n,cells:r}}},document:(e,{data:t},{phase:n})=>{let{cells:r}=Si(e);return n===`snapshot`?{...e,pending:{revision:t.document,cells:r}}:Ci(t.document,r)},ready:(e,t,{phase:n})=>{if(e.pending===null)return e;if(n===`live`)throw Error(`Stream ended with an incomplete document update`);return e.pending.revision===null?{current:null,pending:null}:Ci(e.pending.revision,e.pending.cells)}}},Ti=new Set([`reset`,`marimo`,`unknown`]);function Ei(e){let t=r({state:R.NOT_STARTED}),n=hi({document:wi,attachments:xi}),i=r(n.initial),a=r(!1),o=r(e=>e(a)&&e(t).state===R.OPEN?e(i).notebook:null),s=r(e=>e(i).resources.document.current),c=r(e=>e(a)&&e(t).state===R.OPEN?e(i).resources.attachments:xi.initial),l,u={connectionAtom:t,notebookAtom:o,documentAtom:s,attachmentsAtom:c,reconnect:async()=>l?.()};function d({createTransport:r,url:o,signal:s,waitUntilReady:c,checkHealth:u,onNotification:d,decodeJson:f,classifyClose:p}){if(s.aborted)return;let m=!0,h=!1,g=!1,ee,_=null,v=r(()=>{let t=new URL(o());if(t.searchParams.delete(`cursor`),s.aborted)return t.toString();let r=new URL(t);r.searchParams.delete(`access_token`),r.searchParams.sort();let c=r.toString(),l=e.get(i),u=c!==ee||l.phase===`snapshot`?n.initial:l;return u.phase===`snapshot`&&(_=null),ee=c,e.set(a,!1),e.set(i,u),_!==null&&t.searchParams.set(`cursor`,_),t.toString()}),y=n=>{e.set(a,!1),e.set(t,n)},b={state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`};function te(e,t){!s.aborted&&!h&&m&&(m=!1,v.reconnect(e,t))}function x(){s.aborted||h||(m=!0,y({state:R.OPEN}))}function ne(e){if(s.aborted||h)return;F.warn(`Notebook connection closed`,e.code,e.reason);let t=p(e);y(t.status),t.kind===`terminal`?(h=!0,v.close()):t.kind===`retry`?te(e.code,e.reason):h=!0}function re(e){s.aborted||h||(F.warn(`Notebook connection error`,e),y(b),te())}function ie(t){if(s.aborted||h)return;let r;try{r=bi(f(t.data));let o=e.get(i);if(o.phase===`live`&&r.id===void 0&&!Ti.has(r.event))throw Error(`Live notebook event is missing its cursor`);r.event!==`marimo`&&r.event!==`unknown`&&e.set(i,n.reduce(o,r)),r.event===`reset`?_=null:(r.event===`ready`||o.phase===`live`)&&(_=r.id??_),(r.event===`ready`||r.event===`reset`)&&e.set(a,r.event===`ready`)}catch(t){F.error(`Failed to decode notebook message`,t),e.set(i,n.initial),_=null,h=!0,y({...b,reason:`Failed to decode notebook message`}),v.close();return}r.event===`marimo`&&d(r.data.marimo)}l=async()=>{if(!(s.aborted||g||v.readyState===L.OPEN||v.readyState===L.CONNECTING)){g=!0,y({state:R.CONNECTING});try{let e=await u();if(s.aborted)return;if(!e){m=!1,y(b);return}h=!1,m=!0,v.reconnect()}catch(e){s.aborted||(F.error(`Notebook health check failed`,e),m=!1,y(b))}finally{g=!1}}},s.addEventListener(`abort`,()=>{v.removeEventListener(`open`,x),v.removeEventListener(`close`,ne),v.removeEventListener(`error`,re),v.removeEventListener(`message`,ie),v.close(),l=void 0,e.set(i,n.initial),y({state:R.NOT_STARTED})},{once:!0}),v.addEventListener(`open`,x),v.addEventListener(`close`,ne),v.addEventListener(`error`,re),v.addEventListener(`message`,ie),v.readyState===L.CLOSED&&(y({state:R.CONNECTING}),c().then(()=>{s.aborted||v.reconnect()}).catch(e=>{s.aborted||(F.error(`Healthy connection never made`,e),h=!0,y(b),v.close())}))}return{client:u,connect:d}}var Di=`MARIMO_TRANSPORT_EXHAUSTED`,Oi=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new Rt(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:Di,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}};function ki(e){switch(e.reason){case Di:return{kind:`gave-up`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_NO_FILE_KEY`:case`MARIMO_NO_SESSION_ID`:case`MARIMO_NO_SESSION`:case`MARIMO_SHUTDOWN`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_UNAUTHORIZED`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`not authorized`}};case`MARIMO_KIOSK_NOT_ALLOWED`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_DISCONNECTED,reason:`kiosk mode is not available for this session`}};case`MARIMO_KERNEL_STARTUP_ERROR`:return{kind:`terminal`,status:{state:R.CLOSED,code:z.KERNEL_STARTUP_ERROR,reason:`Failed to start kernel sandbox`}};default:e.reason&&F.warn(`Unrecognized connection close reason`,e.reason)}return{kind:`retry`,status:{state:R.CONNECTING}}}var Ai=1e4,ji=1e3,Mi=1e4,Ni=1.3,Pi=1006,Fi=class{subscriptions=new Se;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){F.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),Ai),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;F.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??Pi,reason:r?Di:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(ji*Ni**this.retryCount,Mi);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=null,o=[],s=()=>{if(o.length===0)return i=null,a=null,null;let e=o.join(`
|
|
105
105
|
`),t=i,n=a;if(i=null,a=null,o=[],t===`close`)return Ii(e);this.retryCount=0;let r=t===null?e:`{"event":${JSON.stringify(t)},"data":${e}${n===null?``:`,"id":${JSON.stringify(n)}`}}`;return this.subscriptions.notify(`message`,new MessageEvent(`message`,{data:r})),null};for(;;){let{done:e,value:c}=await t.read();if(e)return null;r+=n.decode(c,{stream:!0});let l=0,u=r.indexOf(`
|
|
106
106
|
`,l);for(;u!==-1;){let e=r.slice(l,u);if(l=u+1,u=r.indexOf(`
|
|
107
107
|
`,l),e.endsWith(`\r`)&&(e=e.slice(0,-1)),e===``){let e=s();if(e!==null)return e;continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),c=t===-1?``:e.slice(t+1);c.startsWith(` `)&&(c=c.slice(1)),n===`data`?o.push(c):n===`event`?i=c:n===`id`&&(a=c)}l>0&&(r=r.slice(l))}}};function Ii(e){try{let t=JSON.parse(e);return{code:typeof t.code==`number`?t.code:1e3,reason:typeof t.reason==`string`?t.reason:``}}catch{return F.warn(`Failed to parse SSE close event`,e),{code:1e3,reason:``}}}function Li(e){return e.static?we.empty():Re()?Ee():e.transportType===`sse`?new Fi(e.url,e.headers):new Oi(e.url)}function Ri(e){let t=(0,J.c)(13),r=n(),{static:i,transportType:a}=e,s;t[0]===r?s=t[1]:(s=Ei(r),t[0]=r,t[1]=s);let c=s,l=o(e.url),u=o(e.headers),d=o(e.waitUntilReady),f=o(e.checkHealth),p=o(e.onNotification),m,h;return t[2]!==f||t[3]!==c||t[4]!==u||t[5]!==i||t[6]!==p||t[7]!==r||t[8]!==a||t[9]!==l||t[10]!==d?(m=()=>{let e=new AbortController;return r.set(bt,c.client),c.connect({createTransport:e=>Li({url:e,headers:u,static:i,transportType:a}),url:l,signal:e.signal,waitUntilReady:d,checkHealth:f,onNotification:e=>p({data:e}),decodeJson:b,classifyClose:ki}),()=>{e.abort(),r.get(bt)===c.client&&r.set(bt,null)}},h=[c,r,i,a,l,u,d,f,p],t[2]=f,t[3]=c,t[4]=u,t[5]=i,t[6]=p,t[7]=r,t[8]=a,t[9]=l,t[10]=d,t[11]=m,t[12]=h):(m=t[11],h=t[12]),(0,q.useEffect)(m,h),c.client}function zi(e){let{codes:t,names:n,configs:r,cell_ids:i,last_executed_code:a,last_execution_time:o}=e,s=a||{},c=o||{};return t.map((e,t)=>{let a=i[t],o=s[a];return x({id:a,code:e,edited:o?o!==e:!1,name:n[t],lastCodeRun:s[a]??null,lastExecutionTime:c[a]??null,config:r[t]})})}function Bi(e,t,n){let{layout:r}=e,i=ft(r,t);return r&&r.type===i.selectedLayout&&n({layoutView:i.selectedLayout,data:i.layoutData[i.selectedLayout]}),i}function Vi(){let e=[],t=[];return Oe.entries.forEach((n,r)=>{e.push(r),t.push(n.value)}),{objectIds:e,values:t}}function Hi(e,t){let{existingCells:n,autoInstantiate:r,setCells:i,setLayoutData:a,setAppConfig:o,setCapabilities:s,setKernelState:c,onError:l}=t,{resumed:u,ui_values:d,app_config:f,capabilities:p,auto_instantiated:m}=e,h=n&&n.length>0,g=h&&!u?n:zi(e);i(g,Bi(e,g,a));let ee=ye.safeParse(f);if(ee.success?o(ee.data):F.error(`Failed to parse app config`,ee.error),s(p),m)return;if(u){for(let[e,t]of I.entries(d||{})){let n=e;Oe.set(n,t)}return}let{objectIds:_,values:v}=Vi(),y=h?Object.fromEntries(n.map(e=>[e.id,e.code])):void 0;Ct().sendInstantiate({objectIds:_,values:v,autoRun:r,codes:y}).then(()=>{c({isInstantiated:!0,error:null})}).catch(e=>{c({isInstantiated:!1,error:e}),l(Error(`Failed to instantiate`,{cause:e}))})}function Ui(e){let t=e.cell_id;Oe.removeElementsByCell(t),ut.INSTANCE.removeForCellId(t)}function Wi(e,t){t(e),ut.INSTANCE.track(e)}var Gi={append:e=>{let t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},set:e=>{let t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach(n=>t.searchParams.append(e.key,n))):t.searchParams.set(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},delete:e=>{let t=new URL(window.location.href);e.value==null?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},clear:()=>{let e=new URL(window.location.href);e.search=``,window.history.pushState({},``,`${e.pathname}${e.search}`)}};function Ki(){return Object.values(ue().cellData).filter(e=>e.id!==ne)}function qi(e){let r=(0,J.c)(68),{autoInstantiate:a,sessionId:o,setCells:c}=e,{showBoundary:g}=qe(),{handleCellMessage:b}=d(),x;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={skipMiddleware:!0},r[0]=x):x=r[0];let ne=d(x),ie;r[1]===ne?ie=r[2]:(ie=e=>{l(e.changes,ne,$i)},r[1]=ne,r[2]=ie);let se=ie,{addCellNotification:le}=zt(),de=s(We),he=s(Ke),S=xe(),{setVariables:C,setMetadata:w}=ce(),{addColumnPreview:T}=ae(),{addDatasets:ge,filterDatasetsFromVariables:E}=ae(),{addDataSourceConnection:_e,filterDataSourcesFromVariables:D}=ee(),{setLayoutData:O}=_t(),[k,A]=t(ze),j=s(He),{addBanner:M}=Ft(),{addMissingPackageAlert:ve,updateEnvironment:ye,setEnvironment:Se,addStartupLog:we}=It(),Ee=s(Fe),De=s(Ie),ke=s(h),N=Ve(),P=i(be),je=s(Pt),I=s(Lt),{setNamespaces:Me,filterFromVariables:Ne}=re(),Pe;r[3]!==M||r[4]!==le||r[5]!==T||r[6]!==_e||r[7]!==ge||r[8]!==ve||r[9]!==we||r[10]!==a||r[11]!==D||r[12]!==E||r[13]!==Ne||r[14]!==b||r[15]!==se||r[16]!==S||r[17]!==je||r[18]!==ke||r[19]!==c||r[20]!==A||r[21]!==Se||r[22]!==he||r[23]!==I||r[24]!==de||r[25]!==Ee||r[26]!==O||r[27]!==w||r[28]!==De||r[29]!==Me||r[30]!==C||r[31]!==g||r[32]!==ye||r[33]!==j?(Pe=e=>{switch(e.data.op){case`reload`:Ot();return;case`startup-progress`:{let{phase:t}=e.data;j(e.data),A(e=>e.state===R.OPEN||e.state===R.CONNECTING&&e.phase===t?e:{state:R.CONNECTING,phase:t});return}case`kernel-ready`:{I(null),A({state:R.OPEN}),he(!!(e.data.resumed||e.data.auto_instantiated));let t=Ki();Hi(e.data,{autoInstantiate:a,setCells:c,setLayoutData:O,setAppConfig:S,setCapabilities:ke,setKernelState:de,onError:g,existingCells:t}),e.data.resumed||te(),Ee(e.data.kiosk),De(e.data.stable_session_id??null),fe(null),pe();return}case`completed-run`:he(!0);return;case`execution`:return;case`interrupted`:return;case`kernel-startup-error`:I(e.data.error);return;case`send-ui-element-message`:{let t=e.data.ui_element;if(t){let n=pt(e.data);Oe.broadcastMessage(t,e.data.message,n)}return}case`model-lifecycle`:Ce(Ae,e.data);return;case`remove-ui-elements`:Ui(e.data);return;case`completion-result`:y.resolve(e.data.completion_id,e.data);return;case`function-call-result`:Te.resolve(e.data.function_call_id,e.data);return;case`cell-op`:{Wi(e.data,b);let t=ue().cellData[e.data.cell_id];if(!t)return;le({cellNotification:e.data,code:t.code});return}case`variables`:{let t=e.data.variables.map(Qi);C(e.data.variables.map(Zi)),E(t),D(t),Ne(t);return}case`variable-values`:w(e.data.variables.map(Xi));return;case`alert`:xt({title:e.data.title,description:Et({html:e.data.description}),variant:e.data.variant});return;case`banner`:M(e.data);return;case`missing-package-alert`:ve({...e.data,kind:`missing`});return;case`environment-operation`:e.data.source===`kernel`&&e.data.status.kind!==`running`&&Dt(),ye(e.data);return;case`environment-state`:Se(e.data),e.data.source===`kernel`&&Dt();return;case`startup-logs`:we({content:e.data.content,status:e.data.status});return;case`query-params-append`:Gi.append(e.data);return;case`query-params-set`:Gi.set(e.data);return;case`query-params-delete`:Gi.delete(e.data);return;case`query-params-clear`:Gi.clear();return;case`datasets`:ge(e.data);return;case`data-column-preview`:T(e.data);return;case`sql-table-preview`:v.resolve(e.data.request_id,e.data);return;case`sql-table-list-preview`:me.resolve(e.data.request_id,e.data);return;case`sql-schema-list-preview`:m.resolve(e.data.request_id,e.data);return;case`validate-sql-result`:_.resolve(e.data.request_id,e.data);return;case`data-source-discovery-result`:oe.resolve(e.data.request_id,e.data);return;case`secret-keys-result`:ht.resolve(e.data.request_id,e.data);return;case`cache-info`:je(e.data);return;case`cache-cleared`:return;case`data-source-connections`:_e({connections:e.data.connections.map(Yi)});return;case`storage-namespaces`:Me(e.data);return;case`storage-entries`:f.resolve(e.data.request_id,e.data);return;case`storage-download-ready`:p.resolve(e.data.request_id,e.data);return;case`reconnected`:I(null),A({state:R.OPEN});return;case`focus-cell`:u(e.data.cell_id);return;case`active-line`:fe(e.data.line==null?null:{cellId:e.data.cell_id,line:e.data.line});return;case`notebook-document-transaction`:se(e.data.transaction);return;case`consumer-capabilities`:Ee(!e.data.consumer_capabilities.edit);return;default:St(e.data)}},r[3]=M,r[4]=le,r[5]=T,r[6]=_e,r[7]=ge,r[8]=ve,r[9]=we,r[10]=a,r[11]=D,r[12]=E,r[13]=Ne,r[14]=b,r[15]=se,r[16]=S,r[17]=je,r[18]=ke,r[19]=c,r[20]=A,r[21]=Se,r[22]=he,r[23]=I,r[24]=de,r[25]=Ee,r[26]=O,r[27]=w,r[28]=De,r[29]=Me,r[30]=C,r[31]=g,r[32]=ye,r[33]=j,r[34]=Pe):Pe=r[34];let Le=Pe,L=n(),Ue=Ji,Ge;r[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=Be(),r[35]=Ge):Ge=r[35];let B;r[36]!==N||r[37]!==o||r[38]!==P?(B=()=>P===`sse`?N.getSseURL(o).toString():N.getWsURL(o).toString(),r[36]=N,r[37]=o,r[38]=P,r[39]=B):B=r[39];let V,H,U;r[40]===N?(V=r[41],H=r[42],U=r[43]):(V=()=>N.headers(),H=async()=>{!Be()&&!Re()&&!N.isSameOrigin&&await N.waitForHealthy()},U=()=>N.reconcileFromHealth(),r[40]=N,r[41]=V,r[42]=H,r[43]=U);let W;r[44]===Le?W=r[45]:(W=e=>{try{Le(e)}catch(t){let n=t;F.error(`Failed to handle notification`,e,n),Ue(n)}},r[44]=Le,r[45]=W);let Je;r[46]!==B||r[47]!==V||r[48]!==H||r[49]!==U||r[50]!==W||r[51]!==P?(Je={static:Ge,transportType:P,url:B,headers:V,waitUntilReady:H,checkHealth:U,onNotification:W},r[46]=B,r[47]=V,r[48]=H,r[49]=U,r[50]=W,r[51]=P,r[52]=Je):Je=r[52];let G=Ri(Je),Ye;r[53]!==G.connectionAtom||r[54]!==A||r[55]!==I||r[56]!==L||r[57]!==j?(Ye=()=>{let e=()=>{let e=L.get(G.connectionAtom);if(e.state!==R.NOT_STARTED){if(e.state===R.OPEN){j(null);return}e.state===R.CONNECTING&&I(null),A(t=>e.state===R.CLOSED&&e.code===z.KERNEL_STARTUP_ERROR&&(t.state===R.CONNECTING||t.state===R.CLOSED)?{...e,phase:t.phase}:e.state===R.CONNECTING&&(t.state===R.OPEN||t.state===R.CONNECTING&&t.phase===`reconnecting`)?{...e,phase:`reconnecting`}:e)}},t=L.sub(G.connectionAtom,e);return e(),t},r[53]=G.connectionAtom,r[54]=A,r[55]=I,r[56]=L,r[57]=j,r[58]=Ye):Ye=r[58];let Xe;r[59]!==G||r[60]!==A||r[61]!==I||r[62]!==L||r[63]!==j?(Xe=[G,L,A,I,j],r[59]=G,r[60]=A,r[61]=I,r[62]=L,r[63]=j,r[64]=Xe):Xe=r[64],(0,q.useLayoutEffect)(Ye,Xe);let Ze;return r[65]!==k||r[66]!==G?(Ze={notebook:G,connection:k,reconnect:G.reconnect},r[65]=k,r[66]=G,r[67]=Ze):Ze=r[67],Ze}function Ji(e){xt({title:`Failed to handle message`,description:kt(e),variant:`danger`})}function Yi(e){return{...e,name:e.name}}function Xi(e){return{name:e.name,dataType:e.datatype,value:e.value}}function Zi(e){return{name:e.name,declaredBy:e.declared_by,usedBy:e.used_by}}function Qi(e){return e.name}function $i(){return ue().cellIds.inOrderIds}var ea=e=>{let t=(0,J.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{"data-testid":`chrome-wrapper`,className:`flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative`,children:n}),t[0]=n,t[1]=r),r};export{En as a,Dn as i,qi as n,Ut as o,kn as r,Vt as s,ea as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-T9_Y4Jlv.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./panels-Cez8PgGB.js";import{t as g}from"./compiler-runtime-BrajqUja.js";import{C as _}from"./config-DGX7JYor.js";import{r as v}from"./utils-B4K466FK.js";import{t as y}from"./session-B8Y-GJnS.js";import{T as b,_ as x,l as S,p as C}from"./config-DzdxZb17.js";import{t as w}from"./cn-ldLVeaqm.js";import{t as T}from"./jsx-runtime-B74pBk57.js";import{a as E,c as D,i as O,l as k,n as A,s as j,t as M}from"./alert-dialog-C-sWmKva.js";import{F as N,Ft as ee}from"./JsonOutput-Pm6OCP3J.js";import{n as te}from"./download-C8Gw-D0Y.js";import{i as P,n as F,r as ne,t as re}from"./tabs-CY8E4r9U.js";import{n as I,t as L}from"./button-D8gVKwe-.js";import{n as ie}from"./paths-bkIFVj8h.js";import{t as ae}from"./arrow-left-BaPN-xbg.js";import{t as R}from"./copy-Djr5m5ac.js";import{t as oe}from"./house-CpsMWsLL.js";import{t as z}from"./spinner-DyNE-o8o.js";import{l as B,s as V}from"./readonly-python-code-B81AjzXM.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-BZdRe7pb.js";import{n as J}from"./copy-KlhazlhB.js";import{t as Y}from"./use-toast-Wu434mLr.js";import{r as se}from"./requests-lt0JK8Jt.js";import{t as ce}from"./shell-Fj8a65ii.js";import{t as le}from"./share-BZW3tzEX.js";import{a as X}from"./cell-link-DFqfW-Ym.js";import{n as ue,t as de}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{n as fe}from"./code-visibility-CV3S4xuf.js";import{n as pe,t as me}from"./marimo-icons-CqliHyTr.js";import{t as he}from"./state-Ck7FMD5A.js";var ge=e(i(),1),Z=g(),Q=T(),_e=()=>{let e=(0,Z.c)(25),[n,r]=t(he);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ve,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(D,{children:[(0,Q.jsxs)(k,{className:`flex items-center gap-2 text-destructive`,children:[(0,Q.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Q.jsx)(E,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(R,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Q.jsxs)(L,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Q.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsxs)(L,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Q.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Q.jsxs)(j,{children:[_,(0,Q.jsx)(A,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Q.jsxs)(O,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let b;return e[22]!==y||e[23]!==u?(b=(0,Q.jsx)(M,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=b):b=e[24],b};function ve(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var ye=e=>{let t=(0,Z.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Q.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},be=e=>{let t=(0,Z.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===b.CLOSED&&(0,Q.jsx)(ye,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},xe=n(e=>e(s)||!C(e(x).state)),Se=e=>{let t=(0,Z.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(m.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[2]=h):h=t[2],(0,ge.useEffect)(c,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=y(),t[3]=g):g=t[3];let _;t[4]===o?_=t[5]:(_={autoInstantiate:!0,setCells:o,sessionId:g},t[4]=o,t[5]=_);let{connection:v,reconnect:b}=f(_),x=r(l),S;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){S=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){S=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();S=t?`${e.pathname}?${t}`:e.pathname}t[6]=S}else S=t[6];let C=S,T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(_e,{}),t[7]=T):T=t[7];let E=i?`hidden`:`sm:pt-8`,D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=C&&(0,Q.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Q.jsxs)(`a`,{href:C,"aria-label":`Back to gallery`,className:w(I({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:`Back`})]})}),t[8]=D):D=t[8];let O;t[9]!==v||t[10]!==E?(O=(0,Q.jsx)(be,{connection:v,className:E,children:D}),t[9]=v,t[10]=E,t[11]=O):O=t[11];let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=k):k=t[12];let A;t[13]===n?A=t[14]:(A=(0,Q.jsx)(p,{requires:xe,delay:2e3,fallback:k,children:(0,Q.jsx)(d,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=A);let j;return t[15]!==n.width||t[16]!==v||t[17]!==x||t[18]!==b||t[19]!==A||t[20]!==O?(j=(0,Q.jsxs)(u,{connection:v,isRunning:x,width:n.width,onReconnect:b,children:[T,O,A]}),t[15]=n.width,t[16]=v,t[17]=x,t[18]=b,t[19]=A,t[20]=O,t[21]=j):j=t[21],j};function Ce(){m.INSTANCE.stop()}var we=()=>{let e=(0,Z.c)(3),t=r(o);if(!S()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`span`,{children:[`Static`,` `,(0,Q.jsx)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Q.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Q.jsx)(`span`,{className:`shrink-0`,children:(0,Q.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,Z.c)(44),{code:n}=e,r=ie.basename(X()||`notebook.py`),[i]=_(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(L,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Q.jsx)(q,{children:r}),t[1]=r,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=d):d=t[3];let f=s?`Run it`:`Download it, then run it`,p;t[4]===f?p=t[5]:(p=(0,Q.jsxs)(`p`,{children:[`This is a static`,` `,d,` `,`notebook. `,f,` `,`locally for full interactivity.`]}),t[4]=f,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Q.jsx)(P,{value:`uv`,children:`uv`}),(0,Q.jsx)(P,{value:`pip`,children:`pip`}),(0,Q.jsx)(P,{value:`conda`,children:`conda`})]}),t[6]=m):m=t[6];let h=`uvx marimo edit --sandbox ${c}`,g;t[7]===h?g=t[8]:(g=(0,Q.jsx)(F,{value:`uv`,children:(0,Q.jsx)($,{command:h})}),t[7]=h,t[8]=g);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Q.jsx)(F,{value:`pip`,children:(0,Q.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Q.jsx)(F,{value:`conda`,children:(0,Q.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==g?(C=(0,Q.jsxs)(re,{defaultValue:`uv`,children:[m,g,b,S]}),t[13]=b,t[14]=S,t[15]=g,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Q.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==p?(T=(0,Q.jsx)(W,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[p,C,w]})}),t[20]=C,t[21]=w,t[22]=p,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Q.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let O;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(R,{className:`w-3 h-3 mr-2`}),t[29]=O):O=t[29];let k;t[30]===D?k=t[31]:(k=(0,Q.jsxs)(L,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[O,`Copy code`]}),t[30]=D,t[31]=k);let A;t[32]!==n||t[33]!==r?(A=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=j):j=t[35];let M;t[36]===A?M=t[37]:(M=(0,Q.jsxs)(L,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:A,children:[j,`Download`]}),t[36]=A,t[37]=M);let N;t[38]!==k||t[39]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[k,M]}),t[38]=k,t[39]=M,t[40]=N):N=t[40];let I;return t[41]!==E||t[42]!==N?(I=(0,Q.jsxs)(H,{children:[l,(0,Q.jsxs)(G,{children:[E,N]})]}),t[41]=E,t[42]=N,t[43]=I):I=t[43],I};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,Z.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(R,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Q.jsx)(L,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,Z.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${v.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(pe,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsx)(L,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Q.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Q.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,Z.c)(17),n=r(fe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Q.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Q.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Q.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(de,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(N,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Q.jsx)(h,{children:(0,Q.jsxs)(ue,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Q.jsxs)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`made with marimo`}),(0,Q.jsx)(me,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-T9_Y4Jlv.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./panels-D1i80TGn.js";import{t as g}from"./compiler-runtime-BrajqUja.js";import{C as _}from"./config-DGX7JYor.js";import{r as v}from"./utils-B4K466FK.js";import{t as y}from"./session-B8Y-GJnS.js";import{T as b,_ as x,l as S,p as C}from"./config-DzdxZb17.js";import{t as w}from"./cn-ldLVeaqm.js";import{t as T}from"./jsx-runtime-B74pBk57.js";import{a as E,c as D,i as O,l as k,n as A,s as j,t as M}from"./alert-dialog-C-sWmKva.js";import{F as N,Ft as ee}from"./JsonOutput-Pm6OCP3J.js";import{n as te}from"./download-C8Gw-D0Y.js";import{i as P,n as F,r as ne,t as re}from"./tabs-CY8E4r9U.js";import{n as I,t as L}from"./button-D8gVKwe-.js";import{n as ie}from"./paths-bkIFVj8h.js";import{t as ae}from"./arrow-left-BaPN-xbg.js";import{t as R}from"./copy-Djr5m5ac.js";import{t as oe}from"./house-CpsMWsLL.js";import{t as z}from"./spinner-DyNE-o8o.js";import{l as B,s as V}from"./readonly-python-code-B81AjzXM.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-BZdRe7pb.js";import{n as J}from"./copy-KlhazlhB.js";import{t as Y}from"./use-toast-Wu434mLr.js";import{r as se}from"./requests-lt0JK8Jt.js";import{t as ce}from"./shell-Fj8a65ii.js";import{t as le}from"./share-BZW3tzEX.js";import{a as X}from"./cell-link-DFqfW-Ym.js";import{n as ue,t as de}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{n as fe}from"./code-visibility-CV3S4xuf.js";import{n as pe,t as me}from"./marimo-icons-CqliHyTr.js";import{t as he}from"./state-Ck7FMD5A.js";var ge=e(i(),1),Z=g(),Q=T(),_e=()=>{let e=(0,Z.c)(25),[n,r]=t(he);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ve,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(D,{children:[(0,Q.jsxs)(k,{className:`flex items-center gap-2 text-destructive`,children:[(0,Q.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Q.jsx)(E,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(R,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Q.jsxs)(L,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Q.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsxs)(L,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Q.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Q.jsxs)(j,{children:[_,(0,Q.jsx)(A,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Q.jsxs)(O,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let b;return e[22]!==y||e[23]!==u?(b=(0,Q.jsx)(M,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=b):b=e[24],b};function ve(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var ye=e=>{let t=(0,Z.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Q.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},be=e=>{let t=(0,Z.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===b.CLOSED&&(0,Q.jsx)(ye,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},xe=n(e=>e(s)||!C(e(x).state)),Se=e=>{let t=(0,Z.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(m.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[2]=h):h=t[2],(0,ge.useEffect)(c,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=y(),t[3]=g):g=t[3];let _;t[4]===o?_=t[5]:(_={autoInstantiate:!0,setCells:o,sessionId:g},t[4]=o,t[5]=_);let{connection:v,reconnect:b}=f(_),x=r(l),S;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){S=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){S=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();S=t?`${e.pathname}?${t}`:e.pathname}t[6]=S}else S=t[6];let C=S,T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(_e,{}),t[7]=T):T=t[7];let E=i?`hidden`:`sm:pt-8`,D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=C&&(0,Q.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Q.jsxs)(`a`,{href:C,"aria-label":`Back to gallery`,className:w(I({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:`Back`})]})}),t[8]=D):D=t[8];let O;t[9]!==v||t[10]!==E?(O=(0,Q.jsx)(be,{connection:v,className:E,children:D}),t[9]=v,t[10]=E,t[11]=O):O=t[11];let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=k):k=t[12];let A;t[13]===n?A=t[14]:(A=(0,Q.jsx)(p,{requires:xe,delay:2e3,fallback:k,children:(0,Q.jsx)(d,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=A);let j;return t[15]!==n.width||t[16]!==v||t[17]!==x||t[18]!==b||t[19]!==A||t[20]!==O?(j=(0,Q.jsxs)(u,{connection:v,isRunning:x,width:n.width,onReconnect:b,children:[T,O,A]}),t[15]=n.width,t[16]=v,t[17]=x,t[18]=b,t[19]=A,t[20]=O,t[21]=j):j=t[21],j};function Ce(){m.INSTANCE.stop()}var we=()=>{let e=(0,Z.c)(3),t=r(o);if(!S()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`span`,{children:[`Static`,` `,(0,Q.jsx)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Q.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Q.jsx)(`span`,{className:`shrink-0`,children:(0,Q.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,Z.c)(44),{code:n}=e,r=ie.basename(X()||`notebook.py`),[i]=_(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(L,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Q.jsx)(q,{children:r}),t[1]=r,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=d):d=t[3];let f=s?`Run it`:`Download it, then run it`,p;t[4]===f?p=t[5]:(p=(0,Q.jsxs)(`p`,{children:[`This is a static`,` `,d,` `,`notebook. `,f,` `,`locally for full interactivity.`]}),t[4]=f,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Q.jsx)(P,{value:`uv`,children:`uv`}),(0,Q.jsx)(P,{value:`pip`,children:`pip`}),(0,Q.jsx)(P,{value:`conda`,children:`conda`})]}),t[6]=m):m=t[6];let h=`uvx marimo edit --sandbox ${c}`,g;t[7]===h?g=t[8]:(g=(0,Q.jsx)(F,{value:`uv`,children:(0,Q.jsx)($,{command:h})}),t[7]=h,t[8]=g);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Q.jsx)(F,{value:`pip`,children:(0,Q.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Q.jsx)(F,{value:`conda`,children:(0,Q.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==g?(C=(0,Q.jsxs)(re,{defaultValue:`uv`,children:[m,g,b,S]}),t[13]=b,t[14]=S,t[15]=g,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Q.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==p?(T=(0,Q.jsx)(W,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[p,C,w]})}),t[20]=C,t[21]=w,t[22]=p,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Q.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let O;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(R,{className:`w-3 h-3 mr-2`}),t[29]=O):O=t[29];let k;t[30]===D?k=t[31]:(k=(0,Q.jsxs)(L,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[O,`Copy code`]}),t[30]=D,t[31]=k);let A;t[32]!==n||t[33]!==r?(A=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=j):j=t[35];let M;t[36]===A?M=t[37]:(M=(0,Q.jsxs)(L,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:A,children:[j,`Download`]}),t[36]=A,t[37]=M);let N;t[38]!==k||t[39]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[k,M]}),t[38]=k,t[39]=M,t[40]=N):N=t[40];let I;return t[41]!==E||t[42]!==N?(I=(0,Q.jsxs)(H,{children:[l,(0,Q.jsxs)(G,{children:[E,N]})]}),t[41]=E,t[42]=N,t[43]=I):I=t[43],I};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,Z.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(R,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Q.jsx)(L,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,Z.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${v.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(pe,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsx)(L,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Q.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Q.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,Z.c)(17),n=r(fe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Q.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Q.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Q.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(de,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(N,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Q.jsx)(h,{children:(0,Q.jsxs)(ue,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Q.jsxs)(`a`,{href:v.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`made with marimo`}),(0,Q.jsx)(me,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-BU1n9Awq.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/react-DVplv7_D.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-BrajqUja.js">
|