@imgly/codesign-mcp 0.7.2 → 0.7.3-next.20261125135902.gfdc6ee3
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/README.md +35 -17
- package/dist/cli/license.js +1 -1
- package/dist/runtime/cli/commands.d.ts +2 -0
- package/dist/runtime/cli/commands.d.ts.map +1 -1
- package/dist/runtime/cli/commands.js +56 -1
- package/dist/runtime/cli/commands.js.map +1 -1
- package/dist/runtime/cli/main.d.ts.map +1 -1
- package/dist/runtime/cli/main.js +5 -0
- package/dist/runtime/cli/main.js.map +1 -1
- package/dist/runtime/codesign-shim/codesign-router/protocol/types.mjs +1 -0
- package/dist/runtime/codesign-shim/codesign-router/release-build.generated.mjs +1 -1
- package/dist/server-client-types/protocol/types.d.ts +25 -3
- package/dist/server-client.mjs +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/node_modules/@imgly/codesign-billing/README.md +138 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.d.ts +30 -5
- package/node_modules/@imgly/codesign-billing/dist/charge.d.ts.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.js +16 -1
- package/node_modules/@imgly/codesign-billing/dist/charge.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.d.ts +71 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.js +198 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/index.d.ts +6 -0
- package/node_modules/@imgly/codesign-billing/dist/index.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/index.js +6 -0
- package/node_modules/@imgly/codesign-billing/dist/index.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts +55 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.js +80 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.js.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.d.ts +9 -1
- package/node_modules/@imgly/codesign-billing/dist/metering.d.ts.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.js +77 -21
- package/node_modules/@imgly/codesign-billing/dist/metering.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts +20 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.js +13 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/package.json +30 -0
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts +13 -5
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.js +18 -12
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/consent.d.ts +6 -2
- package/node_modules/@imgly/codesign-router/dist/consent.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/consent.js +65 -9
- package/node_modules/@imgly/codesign-router/dist/consent.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts +25 -3
- package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/protocol/types.js +1 -0
- package/node_modules/@imgly/codesign-router/dist/protocol/types.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.js +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js +14 -4
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.js +9 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.js.map +1 -1
- package/node_modules/@imgly/codesign-sdk/CHANGELOG.md +24 -0
- package/node_modules/@imgly/codesign-sdk/README.md +8 -7
- package/node_modules/@imgly/codesign-sdk/dist/abort.d.ts +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/abort.js +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/assets/inline.generated.js +12 -12
- package/node_modules/@imgly/codesign-sdk/dist/browser/index.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/browser/worker.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/browser/worker.js +15 -8
- package/node_modules/@imgly/codesign-sdk/dist/cesdk-utils/index.js +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/codesign-error.d.ts +38 -1
- package/node_modules/@imgly/codesign-sdk/dist/codesign-error.js +9 -0
- package/node_modules/@imgly/codesign-sdk/dist/codesign.d.ts +19 -12
- package/node_modules/@imgly/codesign-sdk/dist/codesign.js +268 -43
- package/node_modules/@imgly/codesign-sdk/dist/design/animatable.generated.js +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/capabilities.generated.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/facade.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/facade.js +128 -36
- package/node_modules/@imgly/codesign-sdk/dist/design/keyframes.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/lint.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/lint.js +82 -5
- package/node_modules/@imgly/codesign-sdk/dist/design/props.generated.js +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.d.ts +10 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.js +26 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.d.ts +23 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.js +194 -3
- package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.d.ts +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.js +53 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/variables.d.ts +14 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/variables.js +250 -37
- package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.d.ts +50 -0
- package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.js +116 -0
- package/node_modules/@imgly/codesign-sdk/dist/designs/types.d.ts +79 -3
- package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.d.ts +12 -1
- package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.js +20 -4
- package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.d.ts +20 -7
- package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.js +31 -14
- package/node_modules/@imgly/codesign-sdk/dist/engine/headless.d.ts +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/engine/headless.js +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.d.ts +1 -14
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.js +2 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.d.ts +1 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.js +120 -91
- package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.d.ts +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.js +10 -4
- package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.js +13 -3
- package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.d.ts +6 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.js +14 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/handler.d.ts +47 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/handler.js +519 -8
- package/node_modules/@imgly/codesign-sdk/dist/executor/node.d.ts +42 -6
- package/node_modules/@imgly/codesign-sdk/dist/executor/node.js +231 -9
- package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.d.ts +13 -0
- package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.js +28 -0
- package/node_modules/@imgly/codesign-sdk/dist/exporters/html.d.ts +18 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/html.js +129 -15
- package/node_modules/@imgly/codesign-sdk/dist/exporters/index.d.ts +5 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/index.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/node.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/exporters/node.js +4 -3
- package/node_modules/@imgly/codesign-sdk/dist/exporters/psd.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.js +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.js +4 -2
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.js +31 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.d.ts +15 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.js +26 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/mime.d.ts +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/mime.js +37 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.d.ts +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.js +46 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.d.ts +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.js +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.js +25 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.d.ts +10 -4
- package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.js +205 -79
- package/node_modules/@imgly/codesign-sdk/dist/gateway/client.d.ts +23 -2
- package/node_modules/@imgly/codesign-sdk/dist/gateway/client.js +40 -41
- package/node_modules/@imgly/codesign-sdk/dist/gateway/index.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/index.js +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/types.d.ts +18 -3
- package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.js +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.js +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.d.ts +4 -2
- package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.js +7 -4
- package/node_modules/@imgly/codesign-sdk/dist/host.d.ts +34 -5
- package/node_modules/@imgly/codesign-sdk/dist/host.js +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/fig.d.ts +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/fig.js +57 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/index.d.ts +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/importers/index.js +38 -25
- package/node_modules/@imgly/codesign-sdk/dist/importers/node.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/node.js +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.d.ts +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.js +76 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/shared.d.ts +14 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/shared.js +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/index.d.ts +5 -4
- package/node_modules/@imgly/codesign-sdk/dist/index.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/internal/index.d.ts +24 -17
- package/node_modules/@imgly/codesign-sdk/dist/internal/index.js +19 -10
- package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.js +73 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/engine-child.js +18 -2
- package/node_modules/@imgly/codesign-sdk/dist/node/engine-http.js +8 -2
- package/node_modules/@imgly/codesign-sdk/dist/node/index.d.ts +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/index.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/media-probe.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/sdk-version.generated.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.d.ts +59 -13
- package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.js +19 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.d.ts +1 -14
- package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.js +15 -4
- package/node_modules/@imgly/codesign-sdk/dist/session/file-formats.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.js +18 -7
- package/node_modules/@imgly/codesign-sdk/dist/session/local-engine-session.js +247 -68
- package/node_modules/@imgly/codesign-sdk/dist/session/local-engine.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/multipart.js +10 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/pending-video.js +2 -3
- package/node_modules/@imgly/codesign-sdk/dist/session/read-resolved.js +93 -6
- package/node_modules/@imgly/codesign-sdk/dist/session/remote.d.ts +34 -10
- package/node_modules/@imgly/codesign-sdk/dist/session/remote.js +377 -87
- package/node_modules/@imgly/codesign-sdk/dist/session/render-id.js +11 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/session.d.ts +67 -6
- package/node_modules/@imgly/codesign-sdk/dist/session/session.js +213 -32
- package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.d.ts +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.js +47 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/transfers.d.ts +85 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/transfers.js +80 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.d.ts +30 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.js +187 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-source.d.ts +21 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-source.js +163 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/wire.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/session/wire.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/session-instructions.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/sessions/state.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/sessions/state.js +5 -1
- package/node_modules/@imgly/codesign-sdk/dist/signed-urls.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/signed-urls.js +30 -0
- package/node_modules/@imgly/codesign-sdk/dist/skill-tool.js +12 -12
- package/node_modules/@imgly/codesign-sdk/dist/sources/handshake.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/sources/mime.js +0 -1
- package/node_modules/@imgly/codesign-sdk/dist/sources/route.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/sources/route.js +17 -2
- package/node_modules/@imgly/codesign-sdk/dist/sources/search.js +9 -2
- package/node_modules/@imgly/codesign-sdk/dist/sources/types.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/testing/conformance.js +11 -6
- package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.js +11 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/edit.js +11 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/errors.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.d.ts +4 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.js +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/export.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/tools/export.js +75 -12
- package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.js +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/preview.js +42 -19
- package/node_modules/@imgly/codesign-sdk/dist/tools/source-tools.js +11 -4
- package/node_modules/@imgly/codesign-sdk/package.json +18 -10
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/apps.mjs +5 -5
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/image-gateway.mjs +5 -5
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/version.json +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.js +2 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts +59 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js +127 -23
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts +7 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js +65 -15
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js +15 -5
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js +7 -6
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts +2 -2
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js +14 -4
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js +106 -22
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/connectors.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/connectors.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.js +24 -18
- package/node_modules/@imgly/codesign-server/dist/cli/pack.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/main.js +4 -3
- package/node_modules/@imgly/codesign-server/dist/conversation/main.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.js +13 -0
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts +0 -6
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js +0 -58
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js +84 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts +1 -3
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js +3 -23
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts +59 -8
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js +317 -40
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engine.js +4 -9
- package/node_modules/@imgly/codesign-server/dist/design/engine.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts +5 -0
- package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engines.js +49 -0
- package/node_modules/@imgly/codesign-server/dist/design/engines.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/host.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/design/host.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/host.js +10 -6
- package/node_modules/@imgly/codesign-server/dist/design/host.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js +34 -5
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts +42 -5
- package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-design.js +175 -38
- package/node_modules/@imgly/codesign-server/dist/design/local-design.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts +27 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.js +65 -7
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/main.js +23 -10
- package/node_modules/@imgly/codesign-server/dist/design/main.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js +13 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.js +16 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts +22 -3
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js +123 -32
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/save.d.ts +5 -0
- package/node_modules/@imgly/codesign-server/dist/design/save.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/save.js +9 -0
- package/node_modules/@imgly/codesign-server/dist/design/save.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts +33 -4
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js +121 -43
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts +8 -0
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js +50 -61
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts +24 -2
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js +132 -17
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.js +19 -6
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js +10 -7
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts +3 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js +5 -4
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts +56 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js +218 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js +33 -124
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js +2 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts +9 -5
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js +14 -19
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js +4 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts +5 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js +67 -6
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js +2 -2
- package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts +3 -3
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js +3 -3
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts +15 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js +14 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js +36 -0
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts +2 -2
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js +3 -5
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js +5 -4
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js +0 -64
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js +4 -0
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js +2 -24
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts +4 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js +15 -14
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts +12 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js +42 -12
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js +1 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js +24 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts +47 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js +167 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts +32 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js +79 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts +35 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js +185 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts +74 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js +82 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js +5 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js.map +1 -1
- package/node_modules/@imgly/codesign-server/package.json +13 -11
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts +2 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts.map +1 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js +5 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js.map +1 -1
- package/node_modules/@imgly/design-lint/package.json +2 -2
- package/node_modules/@imgly/figma-exporter/CHANGELOG.md +79 -0
- package/node_modules/@imgly/figma-exporter/LICENSE.md +137 -0
- package/node_modules/@imgly/figma-exporter/README.md +201 -0
- package/node_modules/@imgly/figma-exporter/THIRD_PARTY_NOTICES.md +475 -0
- package/node_modules/@imgly/figma-exporter/dist/index.cjs +1 -0
- package/node_modules/@imgly/figma-exporter/dist/index.d.cts +8833 -0
- package/node_modules/@imgly/figma-exporter/dist/index.d.ts +8833 -0
- package/node_modules/@imgly/figma-exporter/dist/index.js +1 -0
- package/node_modules/@imgly/figma-exporter/package.json +92 -0
- package/node_modules/@imgly/figma-importer/CHANGELOG.md +84 -0
- package/node_modules/@imgly/figma-importer/LICENSE.md +137 -0
- package/node_modules/@imgly/figma-importer/README.md +256 -0
- package/node_modules/@imgly/figma-importer/THIRD_PARTY_NOTICES.md +446 -0
- package/node_modules/@imgly/figma-importer/dist/index.cjs +2 -0
- package/node_modules/@imgly/figma-importer/dist/index.d.cts +12831 -0
- package/node_modules/@imgly/figma-importer/dist/index.d.ts +12831 -0
- package/node_modules/@imgly/figma-importer/dist/index.js +2 -0
- package/node_modules/@imgly/figma-importer/package.json +85 -0
- package/node_modules/@imgly/html-exporter/CHANGELOG.md +35 -0
- package/node_modules/@imgly/html-exporter/README.md +45 -4
- package/node_modules/@imgly/html-exporter/dist/index.cjs +610 -493
- package/node_modules/@imgly/html-exporter/dist/index.d.cts +235 -216
- package/node_modules/@imgly/html-exporter/dist/index.d.ts +235 -216
- package/node_modules/@imgly/html-exporter/dist/index.js +610 -493
- package/node_modules/@imgly/html-exporter/package.json +15 -10
- package/node_modules/@imgly/idml-exporter/CHANGELOG.md +10 -0
- package/node_modules/@imgly/idml-exporter/README.md +17 -18
- package/node_modules/@imgly/idml-exporter/dist/harfbuzz.browser.js +1 -1
- package/node_modules/@imgly/idml-exporter/dist/index.cjs +8 -11
- package/node_modules/@imgly/idml-exporter/dist/index.d.cts +14480 -10275
- package/node_modules/@imgly/idml-exporter/dist/index.d.ts +14480 -10275
- package/node_modules/@imgly/idml-exporter/dist/index.js +8 -10
- package/node_modules/@imgly/idml-exporter/dist/woff2.browser.js +14 -14
- package/node_modules/@imgly/idml-exporter/package.json +17 -12
- package/node_modules/@imgly/idml-importer/CHANGELOG.md +37 -0
- package/node_modules/@imgly/idml-importer/README.md +148 -17
- package/node_modules/@imgly/idml-importer/dist/index.cjs +6 -5
- package/node_modules/@imgly/idml-importer/dist/index.d.cts +1003 -632
- package/node_modules/@imgly/idml-importer/dist/index.d.ts +1003 -632
- package/node_modules/@imgly/idml-importer/dist/index.js +6 -5
- package/node_modules/@imgly/idml-importer/package.json +9 -9
- package/node_modules/@imgly/pdf-importer/CHANGELOG.md +59 -0
- package/node_modules/@imgly/pdf-importer/README.md +71 -7
- package/node_modules/@imgly/pdf-importer/dist/browser.d.ts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/browser.js +17 -15
- package/node_modules/@imgly/pdf-importer/dist/node.cjs +17 -16
- package/node_modules/@imgly/pdf-importer/dist/node.d.cts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/node.d.ts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/node.js +17 -15
- package/node_modules/@imgly/pdf-importer/dist/pdf.worker.mjs +80265 -61990
- package/node_modules/@imgly/pdf-importer/package.json +13 -13
- package/node_modules/@imgly/psd-exporter/CHANGELOG.md +12 -0
- package/node_modules/@imgly/psd-exporter/README.md +50 -7
- package/node_modules/@imgly/psd-exporter/dist/index.cjs +5 -7
- package/node_modules/@imgly/psd-exporter/dist/index.d.cts +14332 -10063
- package/node_modules/@imgly/psd-exporter/dist/index.d.ts +14332 -10063
- package/node_modules/@imgly/psd-exporter/dist/index.js +5 -6
- package/node_modules/@imgly/psd-exporter/dist/wawoff2-LICENSE.txt +19 -0
- package/node_modules/@imgly/psd-exporter/dist/woff2.browser.js +19 -0
- package/node_modules/@imgly/psd-exporter/package.json +26 -9
- package/node_modules/@imgly/psd-importer/CHANGELOG.md +29 -1
- package/node_modules/@imgly/psd-importer/README.md +22 -30
- package/node_modules/@imgly/psd-importer/dist/index.cjs +11 -11
- package/node_modules/@imgly/psd-importer/dist/index.d.cts +10479 -12978
- package/node_modules/@imgly/psd-importer/dist/index.d.ts +10479 -12978
- package/node_modules/@imgly/psd-importer/dist/index.js +11 -11
- package/node_modules/@imgly/psd-importer/package.json +8 -11
- package/package.json +28 -17
- package/node_modules/@imgly/pdf-importer/dist/browser.d.cts +0 -941
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
var __import_meta_url__ = require('url').pathToFileURL(__filename).href;
|
|
2
|
-
"use strict";var ze=Object.create;var Rt=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var qe=(r,t)=>{for(var e in t)Rt(r,e,{get:t[e],enumerable:!0})},re=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of He(t))!Ve.call(r,i)&&i!==e&&Rt(r,i,{get:()=>t[i],enumerable:!(n=Ze(t,i))||n.enumerable});return r};var V=(r,t,e)=>(e=r!=null?ze(We(r)):{},re(t||!r||!r.__esModule?Rt(e,"default",{value:r,enumerable:!0}):e,r)),je=r=>re(Rt({},"__esModule",{value:!0}),r);var Hn={};qe(Hn,{IDMLExporter:()=>Nt,Logger:()=>At,collectDocumentFonts:()=>Pe,exportIdml:()=>Un,exportIdmlPackage:()=>Bn});module.exports=je(Hn);var Ke="0.1.0",Vn=`https://staticimgly.com/imgly/gfonts/${Ke}/dist`;function Ye(r){let t=new TextEncoder().encode(r),e=new Uint8Array(t.length),n=0;for(let i=0;i<t.length;i++){if(t[i]!==37){e[n++]=t[i];continue}let s=String.fromCharCode(t[i+1]??0,t[i+2]??0);if(!/^[0-9a-f]{2}$/i.test(s))return null;e[n++]=Number.parseInt(s,16),i+=2}return e.subarray(0,n)}async function gt(r,t){try{if(t.startsWith("data:")){let i=t.match(/^data:([^,]*),(.*)$/s);if(!i)return null;if(!/;base64$/i.test(i[1]))return Ye(i[2]);let s=atob(decodeURIComponent(i[2]));return Uint8Array.from(s,o=>o.charCodeAt(0))}let e=typeof r.editor?.getAbsoluteURI=="function"?await r.editor.getAbsoluteURI(t):t;if(e!==t&&e.startsWith("data:"))return gt(r,e);if(e.startsWith("buffer://"))return new Uint8Array(r.editor.getBufferData(e,0,r.editor.getBufferLength(e)));if(e.startsWith("file://")){let{readFile:i}=await import("fs/promises"),{fileURLToPath:s}=await import("url");return new Uint8Array(await i(s(e)))}if(/^https?:\/\//.test(e)){let i=await fetch(e);return i.ok?new Uint8Array(await i.arrayBuffer()):null}let n=null;return r.editor.getResourceData(e,0,i=>(n=new Uint8Array(i),!1)),n}catch{return null}}function bt(r,t){if(t==="Lowercase")return r.toLowerCase();if(t==="Uppercase")return r.toUpperCase();if(t!=="Titlecase")return r;let e=new Intl.Segmenter("en-US",{granularity:"word"});return r.split(/([:\uFE55\uFF1A])/u).map(n=>Array.from(e.segment(n),({segment:i,isWordLike:s})=>{if(!s)return i;let o=String.fromCodePoint(i.codePointAt(0)),a=i.toLowerCase();return Qe(o)+a.slice(o.toLowerCase().length)}).join("")).join("")}var Je=new Map([[223,"Ss"],[1415,"\u0535\u0582"],[8114,"\u1FBA\u0345"],[8115,"\u1FBC"],[8116,"\u0386\u0345"],[8119,"\u0391\u0342\u0345"],[8124,"\u1FBC"],[8130,"\u1FCA\u0345"],[8131,"\u1FCC"],[8132,"\u0389\u0345"],[8135,"\u0397\u0342\u0345"],[8140,"\u1FCC"],[8178,"\u1FFA\u0345"],[8179,"\u1FFC"],[8180,"\u038F\u0345"],[8183,"\u03A9\u0342\u0345"],[8188,"\u1FFC"],[64256,"Ff"],[64257,"Fi"],[64258,"Fl"],[64259,"Ffi"],[64260,"Ffl"],[64261,"St"],[64262,"St"],[64275,"\u0544\u0576"],[64276,"\u0544\u0565"],[64277,"\u0544\u056B"],[64278,"\u054E\u0576"],[64279,"\u0544\u056D"]]);function Qe(r){let t=r.codePointAt(0);return t>=452&&t<=460?String.fromCodePoint(t-(t-452)%3+1):t>=497&&t<=499?"\u01F2":t>=4304&&t<=4351?r:t>=8064&&t<=8111?String.fromCodePoint(t|8):Je.get(t)??r.toUpperCase()}function Ot(r,t,e){try{e??=r.block.getTextRuns(t);let n=g=>g==="Lowercase"||g==="Titlecase",i=e.map(g=>n(g.textCase)?bt(g.text,g.textCase):g.text);if(!e.some(g=>n(g.textCase)))return i;if(e.map(g=>g.text).join("")!==r.block.getString(t,"text/text")||!r.block.getTextVisibleLineCount||!r.block.getTextVisibleLineContent)return;let s=g=>g.map((f,d)=>e[d].textCase==="Uppercase"?f.toUpperCase():f).join(""),o=s(i),a=[...i],l=[];for(let g=0;g<e.length;){let f=e[g].textCase,d=g+1;if(n(f)){for(;d<e.length&&e[d].textCase===f;)d++;let T=e.slice(g,d).map(m=>m.text).join(""),A=bt(T,f);l.push({start:g,end:d,raw:T,text:A}),a[g]=A;for(let m=g+1;m<d;m++)a[m]=""}g=d}let c=s(a),u=r.block.getTextVisibleLineCount(t);if(!Number.isInteger(u)||u<0||u>Math.max(o.length,c.length)+1)return;let h=Array.from({length:u},(g,f)=>r.block.getTextVisibleLineContent(t,f)),p=g=>{let f=0;for(let d of h){for(;!g.startsWith(d,f)&&/\p{White_Space}/u.test(g[f]??"");)f++;if(!g.startsWith(d,f))return!1;f+=d.length}for(;/\p{White_Space}/u.test(g[f]??"");)f++;return f===g.length};if(p(o))return i;if(!p(c))return;for(let{start:g,end:f,raw:d,text:T}of l){let A=0,m=0;for(let x=g;x<f;x++){if(A+=e[x].text.length,A<d.length&&/[\uD800-\uDBFF]/u.test(d[A-1]??"")&&/[\uDC00-\uDFFF]/u.test(d[A]??""))return;let w=bt(d.slice(0,A),e[g].textCase).length;if(w<m||w>T.length)return;a[x]=T.slice(m,w),m=w}if(m!==T.length)return}return a}catch{return}}function se(r,t){return Ot(r,t)!==void 0}var tn=[1424,1424,1470,1470,1472,1472,1475,1475,1478,1478,1480,1535,1544,1544,1547,1547,1549,1549,1563,1610,1645,1647,1649,1749,1765,1766,1774,1775,1786,1808,1810,1839,1867,1957,1969,2026,2036,2037,2042,2044,2046,2069,2074,2074,2084,2084,2088,2088,2094,2136,2140,2191,2194,2199,2208,2249,8207,8207,64285,64285,64287,64296,64298,64829,64848,64974,65008,65020,65136,65278,67584,67870,67872,68096,68100,68100,68103,68107,68112,68151,68155,68158,68160,68324,68327,68408,68416,68899,68904,68911,68922,69215,69247,69290,69293,69372,69376,69445,69457,69505,69510,69631,124928,125135,125143,125251,125259,126703,126706,126975],en=[0,64,91,96,123,169,171,180,182,185,187,191,215,215,247,247,697,698,706,719,722,735,741,749,751,879,884,885,894,894,900,901,903,903,1014,1014,1155,1161,1418,1418,1421,1423,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1536,1543,1545,1546,1548,1548,1550,1562,1611,1644,1648,1648,1750,1764,1767,1773,1776,1785,1809,1809,1840,1866,1958,1968,2027,2035,2038,2041,2045,2045,2070,2073,2075,2083,2085,2087,2089,2093,2137,2139,2192,2193,2200,2207,2250,2306,2362,2362,2364,2364,2369,2376,2381,2381,2385,2391,2402,2403,2433,2433,2492,2492,2497,2500,2509,2509,2530,2531,2546,2547,2555,2555,2558,2558,2561,2562,2620,2620,2625,2626,2631,2632,2635,2637,2641,2641,2672,2673,2677,2677,2689,2690,2748,2748,2753,2757,2759,2760,2765,2765,2786,2787,2801,2801,2810,2815,2817,2817,2876,2876,2879,2879,2881,2884,2893,2893,2901,2902,2914,2915,2946,2946,3008,3008,3021,3021,3059,3066,3072,3072,3076,3076,3132,3132,3134,3136,3142,3144,3146,3149,3157,3158,3170,3171,3192,3198,3201,3201,3260,3260,3276,3277,3298,3299,3328,3329,3387,3388,3393,3396,3405,3405,3426,3427,3457,3457,3530,3530,3538,3540,3542,3542,3633,3633,3636,3642,3647,3647,3655,3662,3761,3761,3764,3772,3784,3790,3864,3865,3893,3893,3895,3895,3897,3901,3953,3966,3968,3972,3974,3975,3981,3991,3993,4028,4038,4038,4141,4144,4146,4151,4153,4154,4157,4158,4184,4185,4190,4192,4209,4212,4226,4226,4229,4230,4237,4237,4253,4253,4957,4959,5008,5017,5120,5120,5760,5760,5787,5788,5906,5908,5938,5939,5970,5971,6002,6003,6068,6069,6071,6077,6086,6086,6089,6099,6107,6107,6109,6109,6128,6137,6144,6159,6277,6278,6313,6313,6432,6434,6439,6440,6450,6450,6457,6459,6464,6464,6468,6469,6622,6655,6679,6680,6683,6683,6742,6742,6744,6750,6752,6752,6754,6754,6757,6764,6771,6780,6783,6783,6832,6862,6912,6915,6964,6964,6966,6970,6972,6972,6978,6978,7019,7027,7040,7041,7074,7077,7080,7081,7083,7085,7142,7142,7144,7145,7149,7149,7151,7153,7212,7219,7222,7223,7376,7378,7380,7392,7394,7400,7405,7405,7412,7412,7416,7417,7616,7679,8125,8125,8127,8129,8141,8143,8157,8159,8173,8175,8189,8190,8192,8205,8208,8304,8308,8318,8320,8334,8352,8432,8448,8449,8451,8454,8456,8457,8468,8468,8470,8472,8478,8483,8485,8485,8487,8487,8489,8489,8494,8494,8506,8507,8512,8516,8522,8525,8528,8543,8585,8587,8592,9013,9083,9108,9110,9254,9280,9290,9312,9371,9450,9899,9901,10239,10496,11123,11126,11157,11159,11263,11493,11498,11503,11505,11513,11519,11647,11647,11744,11869,11904,11929,11931,12019,12032,12245,12272,12292,12296,12320,12330,12333,12336,12336,12342,12343,12349,12351,12441,12444,12448,12448,12539,12539,12736,12771,12783,12783,12829,12830,12880,12895,12924,12926,12977,12991,13004,13007,13175,13178,13278,13279,13311,13311,19904,19967,42128,42182,42509,42511,42607,42623,42654,42655,42736,42737,42752,42785,42888,42888,43010,43010,43014,43014,43019,43019,43045,43046,43048,43052,43064,43065,43124,43127,43204,43205,43232,43249,43263,43263,43302,43309,43335,43345,43392,43394,43443,43443,43446,43449,43452,43453,43493,43493,43561,43566,43569,43570,43573,43574,43587,43587,43596,43596,43644,43644,43696,43696,43698,43700,43703,43704,43710,43711,43713,43713,43756,43757,43766,43766,43882,43883,44005,44005,44008,44008,44013,44013,64286,64286,64297,64297,64830,64847,64975,65007,65021,65049,65056,65106,65108,65126,65128,65131,65279,65279,65281,65312,65339,65344,65371,65381,65504,65510,65512,65518,65520,65535,65793,65793,65856,65932,65936,65948,65952,65952,66045,66045,66272,66299,66422,66426,67871,67871,68097,68099,68101,68102,68108,68111,68152,68154,68159,68159,68325,68326,68409,68415,68900,68903,68912,68921,69216,69246,69291,69292,69373,69375,69446,69456,69506,69509,69633,69633,69688,69702,69714,69733,69744,69744,69747,69748,69759,69761,69811,69814,69817,69818,69826,69826,69888,69890,69927,69931,69933,69940,70003,70003,70016,70017,70070,70078,70089,70092,70095,70095,70191,70193,70196,70196,70198,70199,70206,70206,70209,70209,70367,70367,70371,70378,70400,70401,70459,70460,70464,70464,70502,70508,70512,70516,70712,70719,70722,70724,70726,70726,70750,70750,70835,70840,70842,70842,70847,70848,70850,70851,71090,71093,71100,71101,71103,71104,71132,71133,71219,71226,71229,71229,71231,71232,71264,71276,71339,71339,71341,71341,71344,71349,71351,71351,71453,71455,71458,71461,71463,71467,71727,71735,71737,71738,71995,71996,71998,71998,72003,72003,72148,72151,72154,72155,72160,72160,72193,72198,72201,72202,72243,72248,72251,72254,72263,72263,72273,72278,72281,72283,72330,72342,72344,72345,72752,72758,72760,72765,72850,72871,72874,72880,72882,72883,72885,72886,73009,73014,73018,73018,73020,73021,73023,73029,73031,73031,73104,73105,73109,73109,73111,73111,73459,73460,73472,73473,73526,73530,73536,73536,73538,73538,73685,73713,78912,78912,78919,78933,92912,92916,92976,92982,94031,94031,94095,94098,94178,94178,94180,94180,113821,113822,113824,113827,118528,118573,118576,118598,119143,119145,119155,119170,119173,119179,119210,119213,119273,119274,119296,119365,119552,119638,120539,120539,120597,120597,120655,120655,120713,120713,120771,120771,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,123023,123023,123184,123190,123566,123566,123628,123631,123647,123647,124140,124143,125136,125142,125252,125258,126704,126705,126976,127019,127024,127123,127136,127150,127153,127167,127169,127183,127185,127221,127232,127247,127279,127279,127338,127343,127405,127405,127584,127589,127744,128727,128732,128748,128752,128764,128768,128886,128891,128985,128992,129003,129008,129008,129024,129035,129040,129095,129104,129113,129120,129159,129168,129197,129200,129201,129280,129619,129632,129645,129648,129660,129664,129672,129680,129725,129727,129733,129742,129755,129760,129768,129776,129784,129792,129938,129940,129994,130032,130041,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,921599,983038,983039,1048574,1048575,1114110,1114111];function ie(r,t){let e=0,n=t.length/2-1;for(;e<=n;){let i=e+n>>>1;if(r<t[i*2])n=i-1;else if(r>t[i*2+1])e=i+1;else return!0}return!1}function ht(r){let t=0;for(let e of r){let n=e.codePointAt(0);if(n>=8294&&n<=8296){t++;continue}if(n===8297){t=Math.max(0,t-1);continue}if(!(t>0)){if(ie(n,tn))return!0;if(!ie(n,en))return!1}}return!1}function oe(r,t,e=1,n=0){if(!Number.isFinite(r)||r<=0||!Number.isFinite(t.unitsPerEm)||t.unitsPerEm<=0||!Number.isFinite(t.underlineSize)||!Number.isFinite(t.underlineOffset)||!Number.isFinite(e)||e<0||!Number.isFinite(n))return null;let i=Math.abs(r*Math.max(t.underlineSize,10)/t.unitsPerEm)*e,s=-r*t.underlineOffset/t.unitsPerEm*(1+n);return{weight:i,offset:s+i/2}}var Ut="x-adobe-psd",qn=64*1024;var jn=`${Ut}/spot-colors`;var Kn=`${Ut}/editable-text-alternate`,Yn=`${Ut}/editable-text-alternates`;var Yt=V(require("jszip"),1);var ae=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u;function J(r){return ae.test(r)}function $t(r,t,e){return J(r)?r.replace(new RegExp(ae.source,"gu"),(n,i)=>(e?.({...t,codePoint:n.codePointAt(0),offset:i}),"\uFFFD")):r}function le(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function nn(r,t,e){return le($t(r,t,e)).replace(/\r/g," ")}function rn(r,t,e){return le($t(r,t,e)).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ")}var Bt=class{constructor(t){this.text=t}serialize(t,e="#text"){return nn(this.text,{tag:e,kind:"text"},t)}},Xt=class{constructor(t){this.data=t}serialize(t,e="#cdata"){return`<![CDATA[${$t(this.data,{tag:e,kind:"cdata"},t).replace(/\]\]>/g,"]]]]><![CDATA[>").replace(/\r/g,"]]> <![CDATA[")}]]>`}},q=class r{constructor(t){this.tag=t}children=[];attributes=new Map;attr(t,e){return this.attributes.set(t,String(e)),this}element(t){let e=new r(t);return this.children.push(e),e}append(t){return this.children.push(t),this}text(t){return this.children.push(new Bt(t)),this}cdata(t){return this.children.push(new Xt(t)),this}serialize(t){let e=Array.from(this.attributes.entries()).map(([i,s])=>` ${i}="${rn(s,{tag:this.tag,kind:"attribute",attribute:i},t)}"`).join("");if(this.children.length===0)return`<${this.tag}${e}/>`;let n=this.children.map(i=>i instanceof r?i.serialize(t):i.serialize(t,this.tag)).join("");return`<${this.tag}${e}>${n}</${this.tag}>`}},sn='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';function yt(r,t=[],e){return`${[sn,...t].join(`
|
|
3
|
-
`)}
|
|
4
|
-
${r.serialize(e)}
|
|
5
|
-
`}var on="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging";function Q(r){return new q(`idPkg:${r}`).attr("xmlns:idPkg",on).attr("DOMVersion","15.0")}function b(r){if(!Number.isFinite(r))return"0";let t=Math.round(r*1e6)/1e6;return String(t)}var wt=class{constructor(t=()=>null,e=n=>n){this.resolveSpot=t;this.allocateId=e}colors=new Map;gradients=[];tints=new Map;colorCounter=0;tintCounter=0;gradientCounter=0;register(t){if("name"in t)return this.registerSpot(t);let{key:e,space:n,colorValue:i}=an(t),s=this.colors.get(e);if(s)return s.self;let o=this.allocateId(`Color/c${++this.colorCounter}`),a=new q("Color").attr("Self",o).attr("Name",`c${this.colorCounter}`).attr("Space",n).attr("ColorValue",i);return this.colors.set(e,{self:o,element:a}),o}registerSpot(t){let e=`SPOT:${t.name}`,n=this.colors.get(e);if(n)return n.self;let i=this.resolveSpot(t.name)??{r:1,g:0,b:1,a:1},s=this.allocateId(`Color/c${++this.colorCounter}`),o=new q("Color").attr("Self",s).attr("Name",t.name).attr("Model","Spot").attr("Space","RGB").attr("ColorValue",[i.r,i.g,i.b].map(a=>b(_t(a)*255)).join(" "));return this.colors.set(e,{self:s,element:o}),s}registerWithTint(t){let e=this.register(t);if("r"in t)return e;let n=_t(t.tint);if(n===1)return e;let i=b(n*100),s=`${e}:${i}`,o=this.tints.get(s);if(!o){let a=this.allocateId(`Tint/t${++this.tintCounter}`),l=new q("Tint").attr("Self",a).attr("Name",`${"name"in t?t.name:e} ${i}%`).attr("BaseColor",e).attr("TintValue",i);o={self:a,element:l},this.tints.set(s,o)}return o.self}registerGradient(t,e){let n=this.allocateId(`Gradient/g${++this.gradientCounter}`),i=new q("Gradient").attr("Self",n).attr("Name",`g${this.gradientCounter}`).attr("Type",t);return e.forEach((s,o)=>{i.element("GradientStop").attr("Self",this.allocateId(`${n}Stop${o}`)).attr("StopColor",this.registerWithTint(s.color)).attr("Location",b(s.stop*100)).attr("Midpoint","50")}),this.gradients.push(i),n}getResourceElements(){return[...Array.from(this.colors.values()).map(t=>t.element),...Array.from(this.tints.values()).map(t=>t.element),...this.gradients]}};function an(r){if("r"in r){let n=r,i=[n.r,n.g,n.b].map(s=>b(_t(s)*255)).join(" ");return{key:`RGB:${i}`,space:"RGB",colorValue:i}}let t=r,e=[t.c,t.m,t.y,t.k].map(n=>b(_t(n)*100)).join(" ");return{key:`CMYK:${e}`,space:"CMYK",colorValue:e}}function _t(r){return Math.max(0,Math.min(1,r))}function N(r){return"r"in r?r.a:1}function tt(r){return"r"in r&&r.a!==1?{...r,a:1}:r}function ce(r){let t=[];for(let e=0;e<r.length;e++){let n=r[e],i=r[e+1];if(t.push(n),!i||i.location<=n.location)continue;let s=i.opacity-n.opacity,o=Math.ceil(Math.abs(s)/.05-1e-6);for(let a=1;a<o;a++){let l=a/o;t.push({opacity:n.opacity+s*l,location:n.location+(i.location-n.location)*l})}}return t}function ge(r,t){let[e,n,i,s,o,a]=r,[l,c,u,h,p,g]=t;return[e*l+i*c,n*l+s*c,e*u+i*h,n*u+s*h,e*p+i*g+o,n*p+s*g+a]}function he(r){let{x:t,y:e,width:n,height:i,rotation:s,flipHorizontal:o,flipVertical:a}=r,l=Math.cos(s),c=Math.sin(s),u=o?-l:l,h=o?-c:c;return[u,h,a?c:-c,a?-l:l,t+(o?n:0),e+(a?i:0)]}function It(r){return r.map(b).join(" ")}function fe(r){if(r.length!==1||r[0].points.length>256)return!1;let t=r[0].points;if(t.some(a=>!a.anchor.every(Number.isFinite)||a.left[0]!==a.anchor[0]||a.left[1]!==a.anchor[1]||a.right[0]!==a.anchor[0]||a.right[1]!==a.anchor[1]))return!1;let e=t.map(a=>a.anchor).filter((a,l,c)=>l===0||a[0]!==c[l-1][0]||a[1]!==c[l-1][1]);if(e.length>1&&e[0][0]===e.at(-1)[0]&&e[0][1]===e.at(-1)[1]&&e.pop(),e.length<3)return!0;let n=Math.max(1,...e.flat().map(Math.abs)),i=1e-10*n*n;if(!Number.isFinite(i))return!1;let s=(a,l,c)=>(l[0]-a[0])*(c[1]-a[1])-(l[1]-a[1])*(c[0]-a[0]),o=(a,l,c)=>Math.abs(s(a,l,c))<=i&&c[0]>=Math.min(a[0],l[0])&&c[0]<=Math.max(a[0],l[0])&&c[1]>=Math.min(a[1],l[1])&&c[1]<=Math.max(a[1],l[1]);for(let a=0;a<e.length;a++)for(let l=a+1;l<e.length;l++){if(l===a+1||a===0&&l===e.length-1)continue;let c=e[a],u=e[(a+1)%e.length],h=e[l],p=e[(l+1)%e.length],g=s(c,u,h),f=s(c,u,p),d=s(h,p,c),T=s(h,p,u);if(Math.sign(g)!==Math.sign(f)&&Math.sign(d)!==Math.sign(T)||o(c,u,h)||o(c,u,p)||o(h,p,c)||o(h,p,u))return!1}return!0}function ot(r,t){let e=r.element("Properties").element("PathGeometry");for(let n of t){let s=e.element("GeometryPathType").attr("PathOpen",n.open?"true":"false").element("PathPointArray");for(let o of n.points)s.element("PathPointType").attr("Anchor",`${b(o.anchor[0])} ${b(o.anchor[1])}`).attr("LeftDirection",`${b(o.left[0])} ${b(o.left[1])}`).attr("RightDirection",`${b(o.right[0])} ${b(o.right[1])}`)}}function et(r,t){return[{open:!1,points:[[0,0],[r,0],[r,t],[0,t]].map(n=>({anchor:n,left:n,right:n}))}]}var ue=.5522847498307936;function de(r,t){let e=r/2,n=t/2,i=e,s=n,o=e*ue,a=n*ue;return[{open:!1,points:[{anchor:[i,0],left:[i-o,0],right:[i+o,0]},{anchor:[r,s],left:[r,s-a],right:[r,s+a]},{anchor:[i,t],left:[i+o,t],right:[i-o,t]},{anchor:[0,s],left:[0,s+a],right:[0,s-a]}]}]}function pe(r,t,e,n){let i=r/2,s=t/2,o=[];for(let a=0;a<e*2;a++){let l=-Math.PI/2+a*Math.PI/e,c=a%2===0?1:n,u=[i+i*c*Math.cos(l),s+s*c*Math.sin(l)];o.push({anchor:u,left:u,right:u})}return[{open:!1,points:o}]}function me(r,t,e){let n=r/2,i=t/2,s=[],o=Math.PI/2+Math.PI/e;for(let a=0;a<e;a++){let l=o+a*2*Math.PI/e,c=[n+n*Math.cos(l),i+i*Math.sin(l)];s.push({anchor:c,left:c,right:c})}return[{open:!1,points:s}]}var Gt=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function zt(r,t,e){let n=[],i=[],s=!0,o=0,a="",l=[0,0],c=[0,0],u=null,h=null,p=()=>{for(;o<r.length&&/[\s,]/.test(r[o]);)o++},g=()=>{p(),Gt.lastIndex=o;let y=Gt.exec(r);return y?(o=Gt.lastIndex,Number(y[0])):null},f=y=>{let S=g(),E=g();return S==null||E==null?null:y?[l[0]+S,l[1]+E]:[S,E]},d=()=>{p();let y=r[o];return y!=="0"&&y!=="1"?null:(o++,y==="1"?1:0)},T=()=>{i.length>0&&n.push({points:ln(i,s),open:s}),i=[],s=!0},A=y=>{i.length===0&&i.push({anchor:l,left:l,right:l}),i.push({anchor:y,left:y,right:y}),l=y},m=(y,S,E)=>{i.length===0&&i.push({anchor:l,left:l,right:l}),i[i.length-1].right=y,i.push({anchor:E,left:S,right:E}),l=E},x=(y,S)=>{m([l[0]+2/3*(y[0]-l[0]),l[1]+2/3*(y[1]-l[1])],[S[0]+2/3*(y[0]-S[0]),S[1]+2/3*(y[1]-S[1])],S)},w=(y,S,E,D,v,M)=>{let[I,_]=l,[L,U]=M;if(I===L&&_===U)return;let F=Math.abs(y),C=Math.abs(S);if(F===0||C===0){A(M);return}let H=E*Math.PI/180,O=Math.cos(H),$=Math.sin(H),G=(I-L)/2,P=(_-U)/2,B=O*G+$*P,z=-$*G+O*P,dt=B*B/(F*F)+z*z/(C*C);if(dt>1){let X=Math.sqrt(dt);F*=X,C*=X}let pt=Math.max(0,(F*F*C*C-F*F*z*z-C*C*B*B)/(F*F*z*z+C*C*B*B)),mt=D!==v?1:-1,k=mt*Math.sqrt(pt)*(F*z)/C,rt=mt*Math.sqrt(pt)*(-C*B)/F,Y=O*k-$*rt+(I+L)/2,xt=$*k+O*rt+(_+U)/2,it=Math.atan2((z-rt)/C,(B-k)/F),W=Math.atan2((-z-rt)/C,(-B-k)/F)-it;v===0&&W>0&&(W-=2*Math.PI),v===1&&W<0&&(W+=2*Math.PI);let j=X=>[Y+F*Math.cos(X)*O-C*Math.sin(X)*$,xt+F*Math.cos(X)*$+C*Math.sin(X)*O],ct=X=>[-F*Math.sin(X)*O-C*Math.cos(X)*$,-F*Math.sin(X)*$+C*Math.cos(X)*O],st=Math.ceil(Math.abs(W)/(Math.PI/2)),ut=W/st,Z=4/3*Math.tan(ut/4);for(let X=0;X<st;X++){let kt=it+X*ut,Qt=kt+ut,te=j(kt),Mt=X===st-1?M:j(Qt),ee=ct(kt),ne=ct(Qt);m([te[0]+Z*ee[0],te[1]+Z*ee[1]],[Mt[0]-Z*ne[0],Mt[1]-Z*ne[1]],Mt)}};for(;p(),!(o>=r.length);){let y=r[o];if(/[A-Za-z]/.test(y))a=y,o++;else if(a===""||a==="Z"||a==="z")return{error:`unexpected character '${y}' at position ${o}`};if(a!=="M"&&a!=="m"&&n.length===0&&i.length===0)return{error:"path must start with a moveto command"};let S=a>="a";switch(a){case"M":case"m":{let E=f(S);if(!E)return{error:`expected coordinates after '${a}'`};T(),l=E,c=E,i.push({anchor:E,left:E,right:E}),a=S?"l":"L";break}case"L":case"l":{let E=f(S);if(!E)return{error:`expected coordinates after '${a}'`};A(E);break}case"H":case"h":{let E=g();if(E==null)return{error:`expected coordinate after '${a}'`};A([S?l[0]+E:E,l[1]]);break}case"V":case"v":{let E=g();if(E==null)return{error:`expected coordinate after '${a}'`};A([l[0],S?l[1]+E:E]);break}case"C":case"c":case"S":case"s":{let D=a==="S"||a==="s"?u?[2*l[0]-u[0],2*l[1]-u[1]]:l:f(S),v=f(S),M=f(S);if(!D||!v||!M)return{error:`expected coordinates after '${a}'`};m(D,v,M),u=v;break}case"Q":case"q":case"T":case"t":{let D=a==="T"||a==="t"?h?[2*l[0]-h[0],2*l[1]-h[1]]:l:f(S),v=f(S);if(!D||!v)return{error:`expected coordinates after '${a}'`};x(D,v),h=D;break}case"A":case"a":{let E=g(),D=g(),v=g(),M=d(),I=d(),_=f(S);if(E==null||D==null||v==null||!_)return{error:`expected arc parameters after '${a}'`};if(M==null||I==null)return{error:`expected 0/1 arc flag after '${a}'`};w(E,D,v,M,I,_);break}case"Z":case"z":{s=!1,T(),l=c;break}default:return{error:`unsupported command '${a}'`}}a!=="C"&&a!=="c"&&a!=="S"&&a!=="s"&&(u=null),a!=="Q"&&a!=="q"&&a!=="T"&&a!=="t"&&(h=null)}if(T(),n.length===0)return{error:"path contains no coordinates"};let R=y=>{let S=y[0]*t,E=y[1]*e;return!Number.isFinite(S)||!Number.isFinite(E)?null:[S,E]};for(let y of n)for(let S of y.points){let E=R(S.anchor),D=R(S.left),v=R(S.right);if(!E||!D||!v)return{error:"path contains non-finite coordinates"};S.anchor=E,S.left=D,S.right=v}return{subPaths:n}}function ln(r,t){if(t||r.length<2)return r;let e=r[0],n=r[r.length-1],i=1e-6;return Math.abs(e.anchor[0]-n.anchor[0])<i&&Math.abs(e.anchor[1]-n.anchor[1])<i?(e.left=n.left,r.slice(0,-1)):r}async function be(r,t){let e=await gt(r,t);if(!e||e.length===0)return null;let n=cn(e);return n?{bytes:e,mimeType:n,isSvg:n==="image/svg+xml",pixelSize:Zt(e,n)}:null}function Zt(r,t){let e=new DataView(r.buffer,r.byteOffset,r.byteLength);if(t==="image/png"&&r.length>=24)return{width:e.getUint32(16),height:e.getUint32(20)};if(t==="image/jpeg"){let n=2;for(;n+9<r.length;){if(r[n]!==255)return null;let i=r[n+1],s=e.getUint16(n+2);if(i>=192&&i<=207&&i!==196&&i!==200&&i!==204)return{height:e.getUint16(n+5),width:e.getUint16(n+7)};n+=2+s}return null}return null}function at(r){if(typeof Buffer<"u")return Buffer.from(r).toString("base64");let t="",e=32768;for(let n=0;n<r.length;n+=e)t+=String.fromCharCode(...r.subarray(n,n+e));return btoa(t)}function cn(r){if(r.length>=3&&r[0]===255&&r[1]===216)return"image/jpeg";if(r.length>=8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71)return"image/png";if(r.length>=2&&r[0]===66&&r[1]===77)return"image/bmp";if(r.length>=12&&r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r[8]===87&&r[9]===69&&r[10]===66&&r[11]===80)return"image/webp";let t=new TextDecoder("utf-8",{fatal:!1}).decode(r.subarray(0,1024));return/<svg[\s>]/i.test(t)?"image/svg+xml":null}function ye(r){let t;try{t=new TextDecoder().decode(r)}catch{return null}let e=t.match(/<svg\b[^>]*>/i),n=e?e[0]:t,i=l=>{let c=l.trim().match(/^([\d.]+)\s*(px|pt)?$/i);if(!c)return null;let u=parseFloat(c[1]);return u>0?u:null},s=n.match(/\bwidth\s*=\s*["']([^"']+)["']/i),o=n.match(/\bheight\s*=\s*["']([^"']+)["']/i);if(s&&o){let l=i(s[1]),c=i(o[1]);if(l!=null&&c!=null)return{width:l,height:c}}let a=n.match(/viewBox\s*=\s*["']([\d.eE+\-, ]+)["']/i);if(a){let l=a[1].trim().split(/[\s,]+/).map(Number);if(l.length===4&&l[2]>0&&l[3]>0)return{width:l[2],height:l[3]}}return null}function Se(r){switch(r){case"image/jpeg":return"$ID/JPEG";case"image/png":return"$ID/PNG";case"image/bmp":return"$ID/BMP";case"image/webp":return"$ID/WEBP";default:return"$ID/"}}function nt(r,t){for(let e=t;e!==null;e=r.block.getParent(e))if(!r.block.getBool(e,"includedInExport"))return!1;return!0}var un=[1,2,6,16,17],gn=["ExtraLight","UltraLight","SemiBold","DemiBold","ExtraBold","UltraBold","Thin","Light","Medium","Black","Heavy"];function hn(r,t){if(t!=="Regular")return{family:r,subfamily:t};for(let e of gn){let n=` ${e}`;if(r.length>n.length&&r.endsWith(n))return{family:r.slice(0,-n.length),subfamily:e}}return{family:r,subfamily:t}}function lt(r){try{let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return null;let n=t.getUint16(4),i=-1,s=-1;for(let f=0;f<n;f++){let d=12+f*16,T=t.getUint32(d);T===1851878757&&(i=t.getUint32(d+8)),T===1719034226&&(s=t.getUint32(d+8))}if(i<0)return null;let o=s>=0?fn(t,s):null,a=new Set(un);if(o)for(let f of o.instances)a.add(f.nameId);let l=t.getUint16(i+2),c=i+t.getUint16(i+4),u=new Map;for(let f=0;f<l;f++){let d=i+6+f*12,T=t.getUint16(d),A=t.getUint16(d+4),m=t.getUint16(d+6),x=t.getUint16(d+8),w=c+t.getUint16(d+10);if(!a.has(m)||T!==0&&T!==3)continue;let R=T===3?A===1033?0:1:2,y=u.get(m);if(y&&y.rank<=R)continue;let S="";for(let E=0;E+1<x;E+=2)S+=String.fromCharCode(t.getUint16(w+E));S&&u.set(m,{text:S,rank:R})}let h=(u.get(16)??u.get(1))?.text;if(!h)return null;let{family:p,subfamily:g}=hn(h,(u.get(17)??u.get(2))?.text||"Regular");return{family:p,subfamily:g,postScriptName:u.get(6)?.text??"",instances:(o?.instances??[]).flatMap(f=>{let d=u.get(f.nameId)?.text;return d?[{subfamily:d,coordinates:f.coordinates}]:[]}),axisDefaults:o?.axisDefaults??{}}}catch{return null}}function fn(r,t){let e=t+r.getUint16(t+4),n=r.getUint16(t+8),i=r.getUint16(t+10),s=r.getUint16(t+12),o=r.getUint16(t+14),a=p=>String.fromCharCode(r.getUint8(p),r.getUint8(p+1),r.getUint8(p+2),r.getUint8(p+3)),l=[],c={};for(let p=0;p<n;p++){let g=e+p*i,f=a(g);l.push(f),c[f]=r.getInt32(g+8)/65536}let u=[],h=e+n*i;for(let p=0;p<s;p++){let g=h+p*o,f={};for(let d=0;d<n;d++)f[l[d]]=r.getInt32(g+4+d*4)/65536;u.push({nameId:r.getUint16(g),coordinates:f})}return{instances:u,axisDefaults:c}}function St(r){let t=r.split("#")[1];if(!t)return{};let e={};for(let n of t.split("&")){let[i,s]=n.split("=");/^[\x20-\x7e]{4}$/.test(i)&&s&&Number.isFinite(+s)&&(e[i]=+s)}return e}function K(r,t){let e=St(t);if(Object.keys(e).length===0)return null;let n=i=>Object.entries(i.coordinates).every(([s,o])=>{let a=e[s]??r.axisDefaults[s];return a!=null&&Math.abs(a-o)<.01});return r.instances.find(n)?.subfamily??null}function Pt(r){let t=new Map;return e=>{let n=e.split("#")[0],i=t.get(n);return i||(i=(async()=>{try{let s=await r(n);return s&<(s)}catch{return null}})(),t.set(n,i)),i}}var dn={thin:100,extraLight:200,light:300,normal:400,medium:500,semiBold:600,bold:700,extraBold:800,heavy:900};function Ee(r,t,e,n){if(r.length!==1||!n)return r;let i=r[0],s=St(e),o=i.typeface?.fonts.find(a=>a.uri===i.resolvedFontFileUri);return!i.text||i.from!==0||i.text!==t||i.resolvedFontFileUri.includes("#")||i.resolvedFontFileUri!==e.split("#")[0]||!/#wght=(?:100|200|300|400|500|600|700|800|900)$/.test(e)||Object.keys(n.axisDefaults).length!==1||s.wght==null||s.wght!==dn[i.fontWeight]||i.fontStyle!=="normal"||n.axisDefaults.wght!==400||s.wght===n.axisDefaults.wght||o?.weight!=="normal"||o.style!=="normal"||(n.axisDefaults.ital??0)!==0||(n.axisDefaults.slnt??0)!==0||n.axisDefaults.wght==null||n.instances.filter(a=>Object.keys(a.coordinates).length===1&&a.coordinates.wght===s.wght).length!==1||!K(n,e)?r:[{...i,resolvedFontFileUri:e}]}async function Et(r,t){let e=new Map;for(let i of r.block.findByType("//ly.img.ubq/text")){if(!nt(r,i))continue;let s=r.block.getTextRuns(i);if(!(s.length!==1||!s[0].resolvedFontFileUri||s[0].resolvedFontFileUri.includes("#")))try{let o=r.block.getString(i,"text/fontFileUri");if(!o.includes("#")||o.split("#")[0]!==s[0].resolvedFontFileUri)continue;let a=await t(o);Ee(s,r.block.getString(i,"text/text"),o,a)!==s&&a&&e.set(i,{uri:o,names:a})}catch{}}if(e.size===0)return r;let n=new Proxy(r.block,{get(i,s){if(s==="getTextRuns")return(...a)=>{let l=i.getTextRuns(...a),c=e.get(a[0]);if(!c||a.length!==1)return l;try{return i.getString(a[0],"text/fontFileUri")!==c.uri?l:Ee(l,i.getString(a[0],"text/text"),c.uri,c.names)}catch{return l}};let o=Reflect.get(i,s,i);return typeof o=="function"?o.bind(i):o}});return new Proxy(r,{get(i,s){if(s==="block")return n;let o=Reflect.get(i,s,i);return typeof o=="function"?o.bind(i):o}})}var Te=null;async function pn(){try{let r;if(typeof process=="object"&&process.versions?.node){let{createRequire:n}=await import("module"),{default:i}=await import("fs"),s=n(__import_meta_url__);r=i.readFileSync(s.resolve("harfbuzzjs/dist/harfbuzz-subset.wasm"))}else{let{default:n}=await import("harfbuzzjs/dist/harfbuzz-subset.wasm");r=n}let{instance:t}=await WebAssembly.instantiate(new Uint8Array(r),{}),e=t.exports;return e._initialize?.(),e}catch{return null}}function mn(r){return(r.charCodeAt(0)&255)<<24|(r.charCodeAt(1)&255)<<16|(r.charCodeAt(2)&255)<<8|r.charCodeAt(3)&255}function Ae(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(4);for(let n=0;n<e;n++){let i=12+n*16;if(i+4>r.length)return!1;if(String.fromCharCode(...r.subarray(i,i+4))==="fvar")return!0}return!1}async function xe(r,t){Te??=pn();let e=await Te;if(!e)return null;let n=()=>new Uint8Array(e.memory.buffer),i=e.malloc(r.length);n().set(r,i);let s=e.hb_blob_create(i,r.length,2,0,0),o=e.hb_face_create(s,0),a=e.hb_subset_input_create_or_fail();if(a===0)return e.hb_face_destroy(o),e.hb_blob_destroy(s),e.free(i),null;try{e.hb_subset_input_keep_everything(a),e.hb_subset_input_pin_all_axes_to_default(a,o);for(let[f,d]of Object.entries(t))e.hb_subset_input_pin_axis_location(a,o,mn(f),d);let l=e.hb_subset_or_fail(o,a);if(l===0)return null;let c=e.hb_face_reference_blob(l),u=e.malloc(4),h=e.hb_blob_get_data(c,u),p=new DataView(e.memory.buffer).getUint32(u,!0),g=n().slice(h,h+p);return e.free(u),e.hb_blob_destroy(c),e.hb_face_destroy(l),g}finally{e.hb_subset_input_destroy(a),e.hb_face_destroy(o),e.hb_blob_destroy(s),e.free(i)}}var bn=new Set([1,2,4,6,16,17]),yn=3,Sn=1,En=1033;function Re(r){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=t.getUint16(4),n=[];for(let i=0;i<e;i++){let s=12+i*16,o=String.fromCharCode(...r.subarray(s,s+4)),a=t.getUint32(s+8),l=t.getUint32(s+12);n.push({tag:o,data:r.subarray(a,a+l)})}return n}function Tn(r){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=t.getUint16(2),n=t.getUint16(4),i=[];for(let s=0;s<e;s++){let o=6+s*12,a=t.getUint16(o+6);if(bn.has(a))continue;let l=t.getUint16(o+8),c=t.getUint16(o+10);i.push({platform:t.getUint16(o),encoding:t.getUint16(o+2),language:t.getUint16(o+4),nameID:a,value:r.subarray(n+c,n+c+l)})}return i}function An(r){let t=new Uint8Array(r.length*2);for(let e=0;e<r.length;e++){let n=r.charCodeAt(e);t[e*2]=n>>8,t[e*2+1]=n&255}return t}function xn(r,t){let e=[...Tn(r),...[[1,t.family],[2,t.subfamily],[4,t.fullName],[6,t.postScriptName],[16,t.family],[17,t.subfamily]].map(([a,l])=>({platform:yn,encoding:Sn,language:En,nameID:a,value:An(l)}))].sort((a,l)=>a.platform-l.platform||a.encoding-l.encoding||a.language-l.language||a.nameID-l.nameID),n=e.reduce((a,l)=>a+l.value.length,0),i=new Uint8Array(6+e.length*12+n),s=new DataView(i.buffer);s.setUint16(0,0),s.setUint16(2,e.length),s.setUint16(4,6+e.length*12);let o=0;return e.forEach((a,l)=>{let c=6+l*12;s.setUint16(c,a.platform),s.setUint16(c+2,a.encoding),s.setUint16(c+4,a.language),s.setUint16(c+6,a.nameID),s.setUint16(c+8,a.value.length),s.setUint16(c+10,o),i.set(a.value,6+e.length*12+o),o+=a.value.length}),i}function Ht(r){let t=0;for(let n=0;n+3<r.length;n+=4)t=t+(r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3])>>>0;let e=r.length%4;if(e){let n=0;for(let i=0;i<4;i++)n=(n<<8|(i<e?r[r.length-e+i]:0))>>>0;t=t+n>>>0}return t}function Ft(r,t){return _e(r,Re(r).map(e=>e.tag==="name"?{tag:e.tag,data:xn(e.data,t)}:e))}function we(r){let t=Re(r),e=m=>t.find(x=>x.tag===m).data,n=m=>new DataView(m.buffer,m.byteOffset,m.byteLength),i=n(e("CBLC")),s=e("CBDT"),o=n(s),a=n(e("head")).getUint16(18),l=n(e("maxp")).getUint16(4),c=i.getUint32(8),u=i.getUint8(52),h=m=>Number((m*a/u).toPrecision(15)),p=[],g=new TextEncoder;for(let m=0;m<i.getUint32(16);m++){let x=c+m*8,w=i.getUint16(x),R=i.getUint16(x+2),y=c+i.getUint32(x+4),S=i.getUint32(y+4);for(let E=w;E<=R;E++){let D=S+i.getUint32(y+8+(E-w)*4),v=o.getUint8(D),M=o.getUint8(D+1),I=h(o.getInt8(D+2)),_=h(-o.getInt8(D+3)),L=s.subarray(D+9,D+9+o.getUint32(D+5));p.push({glyph:E,bytes:g.encode(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><g id="glyph${E}"><image x="${I}" y="${_}" width="${h(M)}" height="${h(v)}" xlink:href="data:image/png;base64,${at(L)}"/></g></svg>`)})}}let f=2+p.length*12,d=new Uint8Array(10+f+p.reduce((m,x)=>m+x.bytes.length,0)),T=n(d);T.setUint32(2,10),T.setUint16(10,p.length);let A=f;return p.forEach((m,x)=>{let w=12+x*12;T.setUint16(w,m.glyph),T.setUint16(w+2,m.glyph),T.setUint32(w+4,A),T.setUint32(w+8,m.bytes.length),d.set(m.bytes,10+A),A+=m.bytes.length}),_e(r,[...t.filter(m=>m.tag!=="CBDT"&&m.tag!=="CBLC"),{tag:"SVG ",data:d},{tag:"glyf",data:new Uint8Array(0)},{tag:"loca",data:new Uint8Array((l+1)*2)}])}function _e(r,t){t.sort((c,u)=>c.tag<u.tag?-1:c.tag>u.tag?1:0);let e=12+t.length*16,n=t.reduce((c,u)=>c+Math.ceil(u.data.length/4)*4,e),i=new Uint8Array(n),s=new DataView(i.buffer);i.set(r.subarray(0,4),0),s.setUint16(4,t.length);let o=Math.floor(Math.log2(t.length));s.setUint16(6,2**o*16),s.setUint16(8,o),s.setUint16(10,t.length*16-2**o*16);let a=e;t.forEach((c,u)=>{let h=12+u*16;for(let p=0;p<4;p++)i[h+p]=c.tag.charCodeAt(p);s.setUint32(h+4,Ht(c.data)),s.setUint32(h+8,a),s.setUint32(h+12,c.data.length),i.set(c.data,a),a+=Math.ceil(c.data.length/4)*4});let l=t.findIndex(c=>c.tag==="head");if(l>=0){let c=12+l*16,u=s.getUint32(c+8);s.setUint32(u+8,0),s.setUint32(c+4,Ht(i.subarray(u,u+s.getUint32(c+12)))),s.setUint32(u+8,2981146554-Ht(i)>>>0)}return i}function Ie(r){let t=2166136261;for(let e=0;e<r.length;e++)t^=r[e],t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function Rn(r,t,e){return`${(t?`${t.family}-${t.subfamily}`.replace(/[^\w-]+/g,""):"font")||"font"}-${Ie(r)}.${e}`}async function ft(r){let t=String.fromCharCode(...r.subarray(0,4));if(t==="wOF2"){let{decompress:n}=await import("wawoff2"),i=new Uint8Array(await n(r));return ft(i)}if(t==="OTTO")return{bytes:r,ext:"otf"};if(t==="true"||t==="ttcf")return{bytes:r,ext:"ttf"};if(r[0]===0&&r[1]===1&&r[2]===0&&r[3]===0)return{bytes:r,ext:"ttf"};let e=wn(r);return e||null}function wn(r){let t=Math.min(r.length-12,4096);for(let e=4;e<t;e+=4){let n=r[e]===0&&r[e+1]===1&&r[e+2]===0&&r[e+3]===0,i=r[e]===79&&r[e+1]===84&&r[e+2]===84&&r[e+3]===79;if(!n&&!i)continue;let s=r.subarray(e);if(lt(s))return{bytes:s,ext:i?"otf":"ttf"}}return null}async function Pe(r){let{fonts:t,skipped:e}=await Dt(r);return{fonts:t,skipped:e}}function Fe(r){let t=new Set;for(let e of r.block.findByType("//ly.img.ubq/text"))if(nt(r,e))for(let n of r.block.getTextRuns(e))n.resolvedFontFileUri&&t.add(n.resolvedFontFileUri);return t}async function De(r,t){let e=Fe(r);if(e.size<2)return!1;let n=new Map;for(let i of e){let s=await t(i);if(!s)continue;let o=K(s,i)??s.subfamily,a=`${s.family}\0${o}`,l=i.split("#")[0],c=n.get(a);if(c&&c!==l)return!0;n.set(a,l)}return!1}async function Dt(r){r=await Et(r,Pt(async g=>{let f=await Tt(r,g);return f?(await ft(f))?.bytes??null:null}));let t=Fe(r),e=[],n=new Map,i=new Map,s=[];for(let g of t){let f=g.split("#")[0];if(!n.has(f)){let m=await Tt(r,f),x=m?await ft(m):null;n.set(f,x&&{...x,bytes:await _n(x.bytes)})}let d=n.get(f);if(i.set(g,d?lt(d.bytes):null),!d){e.push(g);continue}let T=await In(d.bytes,g);if(!T){e.push(g);continue}let A=s.find(m=>m.bytes.length===T.length&&m.bytes.every((x,w)=>x===T[w]));A?A.uris.push(g):s.push({bytes:T,face:lt(T),ext:d.ext,uris:[g]})}let o=g=>`${g.family}\0${g.subfamily}`,a=new Set(s.flatMap(g=>g.face?[o(g.face)]:[])),l=new Set(s.flatMap(g=>g.face?[g.face.postScriptName]:[])),c=new Map;for(let g of s)g.face&&c.set(o(g.face),(c.get(o(g.face))??0)+1);let u=[],h=new Set,p=0;for(let g of s){if(g.face&&(c.get(o(g.face))??0)>1){p++;let A=Ie(g.bytes),m=A,x=1;for(;a.has(`${g.face.family} [${m}]\0${g.face.subfamily}`)||l.has(`IDML-${m}`);)m=`${A}-${++x}`;let w=`${g.face.family} [${m}]`;a.add(`${w}\0${g.face.subfamily}`),l.add(`IDML-${m}`),g.bytes=Ft(g.bytes,{family:w,subfamily:g.face.subfamily,fullName:`${w} ${g.face.subfamily}`,postScriptName:`IDML-${m}`}),g.face=lt(g.bytes)}for(let A of g.uris){let m=i.get(A);i.set(A,g.face&&m?{...g.face,instances:m.instances,axisDefaults:m.axisDefaults}:g.face)}let f=Rn(g.bytes,g.face,g.ext),d=f,T=1;for(;h.has(d);)d=f.replace(/\.[^.]+$/,`-${++T}.${g.ext}`);h.add(d),u.push({filename:d,bytes:g.bytes})}return{fonts:u,skipped:e,resolveNames:async g=>i.get(g)??null,aliasedFonts:p}}async function _n(r){let t=globalThis.crypto?.subtle;if(r.length!==9867108||!t)return r;try{if(Array.from(new Uint8Array(await t.digest("SHA-256",new Uint8Array(r))),n=>n.toString(16).padStart(2,"0")).join("")==="bf2a8506b80614ba190a34c7b037af1269a7d614fe9f3b613cc15cdeec6f814b")return we(r)}catch{}return r}async function In(r,t){let e=lt(r);if(!e)return r;let n=St(t);if(Object.keys(n).length>0&&Ae(r)){let i=K(e,t),s=i?await xe(r,n):null;return s&&i?Ft(s,{family:e.family,subfamily:i,fullName:`${e.family} ${i}`,postScriptName:`${e.family.replace(/\s+/g,"")}-${i.replace(/\s+/g,"")}`}):null}return Ft(r,{family:e.family,subfamily:e.subfamily,fullName:`${e.family} ${e.subfamily}`,postScriptName:e.postScriptName||`${e.family.replace(/\s+/g,"")}-${e.subfamily.replace(/\s+/g,"")}`})}async function Tt(r,t){let e=await gt(r,t);if(e)return e;if(t.startsWith("bundle://"))try{let{createRequire:n}=await import("module"),{default:i}=await import("path"),{default:s}=await import("fs"),o=n(__import_meta_url__),a=i.dirname(o.resolve("@cesdk/node"));for(;!s.existsSync(i.join(a,"package.json"));)a=i.dirname(a);let l=t.replace(/^bundle:\/\/[^/]*\//,""),c=i.join(a,"assets",l);if(s.existsSync(c))return new Uint8Array(s.readFileSync(c))}catch{return null}return null}function Pn(r){try{let t=new DataView(r.buffer,r.byteOffset,r.byteLength),e=t.getUint32(0);if(![65536,1330926671,1953658213].includes(e))return null;let n=-1,i=0;for(let l=0;l<t.getUint16(4);l++){let c=12+l*16;t.getUint32(c)===1668112752&&(n=t.getUint32(c+8),i=t.getUint32(c+12))}if(n<0||i<4||n+i>r.length)return null;let s=n+i,o=[],a=t.getUint16(n+2);if(n+4+a*8>s)return null;for(let l=0;l<a;l++){let c=n+4+l*8,u=t.getUint16(c),h=t.getUint16(c+2);if(u!==0&&!(u===3&&(h===1||h===10)))continue;let p=n+t.getUint32(c+4);if(p<n+4||p+2>s)return null;let g=t.getUint16(p);if(g===4){let f=t.getUint16(p+2),d=t.getUint16(p+6)/2;if(!Number.isInteger(d)||d<1||f<16||p+f>s)return null;let T=p+14,A=T+d*2+2,m=A+d*2,x=m+d*2;if(x+d*2>p+f)return null;let w=-1;for(let R=0;R<d;R++){let y=t.getUint16(A+R*2),S=t.getUint16(T+R*2),E=t.getUint16(x+R*2);if(y>S||y<=w||E&&x+R*2+E+(S-y)*2+2>p+f)return null;w=S}o.push(R=>{if(R>65535)return 0;for(let y=0;y<d;y++){let S=t.getUint16(A+y*2),E=t.getUint16(T+y*2);if(R<S)return 0;if(R>E)continue;let D=t.getInt16(m+y*2),v=t.getUint16(x+y*2);if(!v)return R+D&65535;let M=t.getUint16(x+y*2+v+(R-S)*2);return M?M+D&65535:0}return 0})}else if(g===12||g===13){let f=t.getUint32(p+4),d=t.getUint32(p+12);if(f<16||p+f>s||16+d*12>f)return null;let T=-1;for(let A=0;A<d;A++){let m=p+16+A*12,x=t.getUint32(m),w=t.getUint32(m+4);if(x>w||w>1114111||x<=T)return null;T=w}o.push(A=>{let m=0,x=d-1;for(;m<=x;){let w=m+x>>>1,R=p+16+w*12,y=t.getUint32(R),S=t.getUint32(R+4);if(A<y)x=w-1;else if(A>S)m=w+1;else return t.getUint32(R+8)+(g===12?A-y:0)}return 0})}}return o.length?o:null}catch{return null}}function Ce(r,t){let e=Pn(r);if(!e)return null;let n=i=>[...i].every(s=>e.some(o=>o(s.codePointAt(0))!==0));for(let i of t.normalize("NFC"))if(!(!/^[\p{Letter}\p{Number}\p{Punctuation}\p{Symbol}]$/u.test(i)||/^\p{Default_Ignorable_Code_Point}$/u.test(i))&&![i,i.normalize("NFD")].some(n))return!0;return!1}function Wt(r,t,e){if(r.block.supportsShape(t)){let s=r.block.getShape(t);if(r.block.isValid(s)&&r.block.getType(s)==="//ly.img.ubq/shape/line"){let o=r.block.getStrokePosition(t);r.block.getStrokePosition(e)!==o&&r.block.setStrokePosition(e,o)}}let n=r.block.getChildren(t),i=r.block.getChildren(e);if(n.length!==i.length)throw new Error("Render copy hierarchy changed");n.forEach((s,o)=>Wt(r,s,i[o]))}async function Vt(r,t){let e=r.block.duplicate(t,!1),n=!1;try{let i=await r.block.saveToString([e],["buffer","bundle","http","https","file","data","blob","archive","workspace","opfs"],async u=>u);if(!i.startsWith("UBQ1"))throw new Error("Unknown block encoding");let s=atob(i.slice(4)),o=Uint8Array.from(s,u=>u.charCodeAt(0)),a=JSON.parse(new TextDecoder().decode(o)),l=a.designElements?.designElements;if(a.format!=="//ly.img.cesdk/elements"||!Array.isArray(l)||l.some(u=>!u||typeof u!="object"))throw new Error("Unknown block structure");if(!l.some(u=>u.has_synced_properties===!0))return Wt(r,t,e),n=!0,e;for(let u of l)u.has_synced_properties===!0&&(u.synced_properties_incoming=[],u.synced_properties_outgoing=[]),u.synced_properties_sync_position_interaction=!1,u.synced_properties_sync_rotation_interaction=!1,u.synced_properties_sync_size_interaction=!1;let c=await r.block.loadFromString("UBQ1"+at(new TextEncoder().encode(JSON.stringify(a))));try{if(c.length!==1)throw new Error("Expected one render copy");return Wt(r,t,c[0]),c[0]}catch(u){for(let h of c)r.block.isValid(h)&&r.block.destroy(h);throw u}}finally{!n&&r.block.isValid(e)&&r.block.destroy(e)}}var Le="HL Composer Optyca",Fn=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,Dn=/[\u0900-\u109F\u1780-\u17FF]/;function Ct(r){return Fn.test(r)||[...r].some(t=>ht(t)&&/[\p{Letter}\p{Mark}]/u.test(t))}function Ne(r){return Ct(r)||Dn.test(r)}var Cn={TEXT_FONT_FALLBACK_RASTERIZED:{type:"warning",message:"Characters unavailable in the declared font require native fallback omitted by the public text runs; the complete native text paint was preserved as an embedded image and is no longer editable."},TEXT_FONT_FALLBACK_RASTERIZATION_FAILED:{type:"warning",message:"Rendering native font fallback failed; editable text retains its declared font and missing characters may be substituted or unavailable in InDesign."},FONT_NAMES_ALIASED:{type:"warning",message:"Distinct fonts sharing a family/style were assigned unique names. Use exportIdmlPackage or write collectDocumentFonts output into the adjacent Document fonts folder so those names resolve."},SHADOW_SIZE_RASTERIZED:{type:"warning",message:"Shadow blur outside IDML's supported 0..144 point range and all object paint were preserved together as an embedded image; the object is no longer editable."},SHADOW_SIZE_RASTERIZATION_FAILED:{type:"warning",message:"Rendering a shadow outside IDML's supported 0..144 point blur range failed; the unsupported shadow was omitted."},SHADOW_OFFSET_RASTERIZED:{type:"warning",message:"Shadow offsets outside IDML's supported -1000..1000 point range and all object paint were preserved together as an embedded image; the object is no longer editable."},SHADOW_OFFSET_RASTERIZATION_FAILED:{type:"warning",message:"Rendering a shadow outside IDML's supported -1000..1000 point offset range failed; the unsupported shadow was omitted."},SHADOW_CLIP_RASTERIZED:{type:"warning",message:"Shape shadow clipping and all object paint were preserved together as an embedded image; the graphic is no longer editable."},SHADOW_CLIP_RASTERIZATION_FAILED:{type:"warning",message:"Clipped shape shadow rendering failed; the editable shadow was exported without its shape/stroke clipping."},TEXT_CASE_RASTERIZED:{type:"warning",message:"Native case conversion could not be reproduced by editable text; the rendered case was preserved as an embedded image and text is no longer editable."},TEXT_CASE_RASTERIZATION_FAILED:{type:"warning",message:"Native case conversion could not be verified or rendered; editable text uses normalized case which may differ from the native glyphs."},TEXT_PARAGRAPH_SPACING_RASTERIZED:{type:"warning",message:"Paragraph spacing with mixed font metrics was preserved from its terminal visual line as an embedded image; the text is no longer editable."},TEXT_LEADING_RASTERIZED:{type:"warning",message:"Combined ascender and descender metrics from different fonts cannot be represented by character leading; native line placement was preserved as an embedded image and the text is no longer editable."},TEXT_LEADING_RASTERIZATION_FAILED:{type:"warning",message:"Rendering combined font leading failed; editable text uses individual character leading and line placement may differ."},TEXT_TABS_RASTERIZED:{type:"warning",message:"Native tab placement was preserved as an embedded image because editable paragraph tab stops cannot retain the native tab rule; the text is no longer editable."},TEXT_TABS_RASTERIZATION_FAILED:{type:"warning",message:"Rendering native tabs failed; editable text retains tab characters but their placement may differ."},TEXT_PARAGRAPH_SPACING_RASTERIZATION_FAILED:{type:"warning",message:"Paragraph spacing with mixed font metrics could not be rendered; editable paragraph gaps were approximated from each paragraph\u2019s first font."},TEXT_RANGE_BACKGROUND_RASTERIZED:{type:"warning",message:"Text range backgrounds and the text's other paint were preserved as an embedded image; the text is no longer editable."},TEXT_RANGE_BACKGROUND_RASTERIZATION_FAILED:{type:"warning",message:"Text range backgrounds could not be rendered; the editable text was exported without its range highlights."},TEXT_DECORATION_RASTERIZED:{type:"warning",message:"Overline and the text's other paint were preserved as an embedded image; the text is no longer editable."},TEXT_DECORATION_RASTERIZATION_FAILED:{type:"warning",message:"Overline could not be rendered; the editable text was exported without its overline."},XML_CHARACTERS_REPLACED:{type:"warning",message:"Characters forbidden by XML 1.0 were replaced with U+FFFD in the exported field; the original name or text cannot be encoded in IDML."},XML_ID_REPLACED:{type:"warning",message:"An imported object ID contained characters forbidden by XML 1.0; a new unique ID was allocated."},TEXT_XML_RASTERIZED:{type:"warning",message:"Text or required font names containing characters forbidden by XML 1.0 were preserved as an embedded image; the text is no longer editable."},TEXT_XML_RASTERIZATION_FAILED:{type:"warning",message:"Text with characters or required font names forbidden by XML 1.0 could not be rendered; those characters were replaced in the editable text or font names."},TEXT_STROKE_RASTERIZED:{type:"warning",message:"Glyph stroke dashes or inside alignment were preserved as an embedded image; the text is no longer editable."},TEXT_STROKE_RASTERIZATION_FAILED:{type:"warning",message:"The glyph stroke could not be rendered; its dashes or inside alignment were approximated by a solid centered stroke."},UNSUPPORTED_FILL_RASTERIZED:{type:"warning",message:"A fill without a native IDML representation was preserved as an embedded image; its content is no longer editable."},UNSUPPORTED_FILL_RASTERIZATION_FAILED:{type:"warning",message:"A fill without a native IDML representation could not be rendered; it was exported without fill paint."},PAGE_APPEARANCE_RASTERIZED:{type:"warning",message:"Page background effects or blur were preserved as an embedded image; foreground objects remain separately editable."},PAGE_APPEARANCE_RASTERIZATION_FAILED:{type:"warning",message:"Page background effects or blur could not be rendered; the background was exported without those effects."},PAGE_STROKE_RASTERIZED:{type:"warning",message:"The page contour and background paint were preserved as an embedded image; foreground objects remain separately editable."},PAGE_STROKE_RASTERIZATION_FAILED:{type:"warning",message:"The page contour could not be rendered; its paint was approximated by native rectangle attributes."},PAGE_VIDEO_RASTERIZED:{type:"warning",message:"The video page background was preserved as a still poster image; foreground objects remain separately editable."},PAGE_VIDEO_RASTERIZATION_FAILED:{type:"warning",message:"The video page background could not be rendered; it was exported without its poster."},STROKE_RASTERIZED:{type:"warning",message:"Graphic stroke dash lengths, phase and endpoint caps were preserved as an embedded image; the graphic is no longer editable."},STROKE_RASTERIZATION_FAILED:{type:"warning",message:"The graphic stroke could not be rendered; its dash lengths, phase or endpoint caps were approximated by native stroke attributes."},FILL_RULE_RASTERIZED:{type:"warning",message:"NonZero path fill coverage was preserved as an embedded image; the compound, curved or self-intersecting path is no longer editable."},FILL_RULE_RASTERIZATION_FAILED:{type:"warning",message:"NonZero path fill could not be rendered; winding-sensitive areas may differ in the editable path."},SHAPE_CORNERS_RASTERIZED:{type:"warning",message:"Nonrectangular corner rounding was preserved as an embedded image; the shape is no longer editable."},SHAPE_CORNERS_RASTERIZATION_FAILED:{type:"warning",message:"The rounded shape could not be rendered; its polygon, star or vector-path corners were exported without rounding."},TEXT_PATH_RASTERIZED:{type:"warning",message:"Text on a path was preserved as an embedded image, including its baseline offset and underside placement; the text is no longer editable."},TEXT_PATH_RASTERIZATION_FAILED:{type:"warning",message:"Text on a path could not be rendered; editable text was exported with a straight baseline."},SHADOW_RASTERIZED:{type:"warning",message:"Different horizontal and vertical shadow blur radii were preserved as an embedded image; the object is no longer editable."},SHADOW_RASTERIZATION_FAILED:{type:"warning",message:"The nonuniform shadow could not be rendered; its vertical blur radius was approximated by the horizontal radius."},TEXT_SCRIPT_RASTERIZED:{type:"warning",message:"Superscript or subscript appearance was preserved as an embedded image; the text is no longer editable."},TEXT_SCRIPT_RASTERIZATION_FAILED:{type:"warning",message:"Superscript or subscript could not be rendered; the editable text was exported without its script position."},UNSUPPORTED_BLOCK_TYPE:{type:"warning",message:"Block type is not supported by the IDML exporter and was skipped."},LINE_SHAPE_RASTERIZED:{type:"warning",message:"Native line paint was preserved as an embedded image instead of a rectangle approximation; the line is no longer editable."},LINE_SHAPE_RASTERIZATION_FAILED:{type:"warning",message:"Rendering the native line failed; its rectangle approximation may differ in InDesign."},UNSUPPORTED_SHAPE_TYPE:{type:"warning",message:"Shape type is not representable in IDML; exported as a plain rectangle."},UNSUPPORTED_PATH_DATA:{type:"warning",message:"Vector path could not be parsed as SVG path data; exported as a plain rectangle."},IMAGE_BYTES_UNAVAILABLE:{type:"warning",message:"Image bytes could not be read; the frame was exported without image content."},FILL_ALPHA_FOLDED:{type:"info",message:"IDML colors carry no alpha; the fill's alpha was written as fill-target opacity."},GRADIENT_ALPHA_AS_FEATHER:{type:"info",message:"Varying gradient stop alpha was written as an InDesign Gradient Feather effect sharing the fill geometry."},DEGENERATE_GRADIENT_AS_SOLID:{type:"info",message:"A gradient with zero span or radius was written as an editable solid in its terminal stop color, preserving the rendered paint."},BLEND_MODE_DROPPED:{type:"warning",message:"IDML cannot represent block blend modes; the blend mode was dropped."},VIDEO_FILL_DROPPED:{type:"warning",message:"Video fills have no IDML form and no poster frame could be rendered; the frame was exported empty."},EFFECTS_BAKED:{type:"info",message:"Block effects/blur have no IDML representation; the rendered appearance was embedded as an image."},EFFECTS_BAKE_FAILED:{type:"warning",message:"Rendering enabled block effects/blur failed; editable source paint was exported without those effects/blur."},CROP_FLIP_ROTATION_APPROX:{type:"warning",message:"Legacy crop-transform approximation diagnostic; current exports preserve crop rotation and frame reflection separately."},STROKE_ALPHA_AS_TRANSPARENCY:{type:"info",message:"IDML stroke colors carry no alpha; the stroke's alpha was written as an InDesign stroke-target opacity effect."},TEXT_FILL_ALPHA_FOLDED:{type:"info",message:"IDML swatches carry no alpha; the text fill alpha was folded into the frame opacity."},TEXT_PAINT_RASTERIZED:{type:"warning",message:"Independent text paint opacity was preserved in an embedded image; the text is no longer editable."},TEXT_BACKGROUND_BLEND_RASTERIZED:{type:"warning",message:"Text and its background were preserved together as an embedded image so their blend mode is applied once; the text is no longer editable."},TEXT_BACKGROUND_BLEND_RASTERIZATION_FAILED:{type:"warning",message:"Text and background blend rasterization failed; separate editable paints may blend differently from the source."},TEXT_PAINT_RASTERIZATION_FAILED:{type:"warning",message:"Text paint rasterization failed; independent glyph fill, stroke or background opacity may be approximated."},TEXT_FILL_ALPHA_DROPPED:{type:"warning",message:"Runs with different fill alphas cannot share one frame opacity, so the alpha was dropped and the text renders solid."},TEXT_STROKE_ALPHA_FOLDED:{type:"info",message:"IDML character stroke colors carry no alpha; the text stroke's alpha was folded into the frame opacity."},TEXT_STROKE_ALPHA_DROPPED:{type:"warning",message:"IDML character stroke colors carry no alpha and the text also paints a fill; the stroke alpha was dropped."},TEXT_WITHOUT_FONT:{type:"warning",message:"Text block has no resolvable font; leading was exported as auto."},UNDERLINE_METRICS_UNAVAILABLE:{type:"warning",message:"Underline font metrics were unavailable; InDesign will use its default weight and position."},TEXT_CASE_NORMALIZED:{type:"info",message:"Lowercase or titlecase styling was materialized as editable text; the original case-transform style is not retained."},FONT_NAMES_UNREADABLE:{type:"warning",message:"Font file could not be read; AppliedFont falls back to the typeface's declared name, which InDesign may not match."},TEXT_BACKGROUND_AS_RECT:{type:"info",message:"IDML text frames have no background fill with padding; the text background was exported as a rounded rectangle behind the frame."},FONT_INSTANCE_UNMATCHED:{type:"warning",message:"No fvar named instance matches the axis values the font URI pins; FontStyle falls back to the run weight, which InDesign may render as the default cut."}},At=class{messages=[];emit(t,e){let{type:n,message:i}=Cn[t];this.messages.push({type:n,code:t,message:i,meta:e})}getMessages(){return[...this.messages]}};var Ln={fillEnabled:!0,stroke:null};function Lt(r,t){let e=0;return r.block.getTextRuns(t).map(n=>{let i=e;e+=n.text.length;try{let s=r.block.getTextDecorations(t,i,e)[0];return s?{...n,textDecoration:s}:n}catch{return n}})}function Me(r){let t;for(let e of r){let n=JSON.stringify([e.fontSize,e.resolvedFontFileUri]),i=e.text.split(/(\r\n|\r|\n)/);for(let s=0;s<i.length;s+=2){let o=i[s+1];if(i[s].length>0||o!==void 0){if(t!==void 0&&t!==n)return!0;t=n}o!==void 0&&(t=void 0)}}return!1}async function Oe(r,t){let e=r.editor.getSettingBool("features/fontLineGapEnabled"),n=new Map,i=0,s=0,o=0,a=()=>i+s>o+1e-6;for(let l of r.block.getTextRuns(t)){if(!l.resolvedFontFileUri)continue;let c=n.get(l.resolvedFontFileUri);if(!c)try{c=await r.editor.getFontMetrics(l.resolvedFontFileUri),n.set(l.resolvedFontFileUri,c)}catch{continue}let u=e?(c.lineGap??0)/2:0,h=l.fontSize*(c.ascender+u)/c.unitsPerEm,p=l.fontSize*(-c.descender+u)/c.unitsPerEm,g=l.text.split(/(\r\n|\r|\n)/);for(let f=0;f<g.length;f+=2){let d=g[f+1];if((g[f].length>0||d!==void 0)&&(i=Math.max(i,h),s=Math.max(s,p),o=Math.max(o,h+p)),d!==void 0){if(a())return!0;i=s=o=0}}}return a()}var Nn={Left:"LeftAlign",Center:"CenterAlign",Right:"RightAlign"};async function Ue(r,t,e,n,i,s,o=Ln,a){let l=r.block,c=[];try{c=Lt(r,t)}catch{c=[]}let u=Q("Story"),h=u.element("Story").attr("Self",e),p=l.getEnum(t,"text/horizontalAlignment"),g=r.block.getBool(t,"text/useKerning"),f=0;try{f=l.getFloat(t,"text/letterSpacing")}catch{}let d=(I,_)=>{let L=h.element("ParagraphStyleRange").attr("AppliedParagraphStyle","ParagraphStyle/$ID/[No paragraph style]").attr("Hyphenation","false"),U=ht(_);(Ne(_)||U)&&(L.attr("Composer",Le),L.attr("ParagraphDirection",U?"RightToLeftDirection":"LeftToRightDirection"));let F=p;try{F=r.block.getTextHorizontalAlignment(t,I)??p}catch{}let C=F==="Justify"?U?"RightJustified":"LeftJustified":F==="Auto"?U?"RightAlign":"LeftAlign":Nn[F];C&&L.attr("Justification",C),F==="Justify"&&L.attr("SingleWordJustification",U?"RightAlign":"LeftAlign");try{let H=r.block,O=H.getTextListStyle(t,I);if(O==="Unordered"||O==="Ordered"){L.attr("BulletsAndNumberingListType",O==="Unordered"?"BulletList":"NumberedList");let $=H.getTextListLevel(t,I);L.attr("NumberingLevel",String($+1))}}catch{}return L};if(c.length===0){let I=l.getString(t,"text/text"),_=d(0,I).element("CharacterStyleRange").attr("AppliedCharacterStyle","CharacterStyle/$ID/[No character style]");return Ct(I)&&_.attr("DigitsType","ArabicDigits"),kn(_,I),yt(u,[],L=>i.emit("XML_CHARACTERS_REPLACED",{...L}))}let T=r.editor,A=new Map,m=I=>{let _=A.get(I);return _||(_=T.getFontMetrics(I),A.set(I,_)),_},x=r.editor.getSettingBool("features/fontLineGapEnabled"),w=r.block,R=async(I,_)=>{if(!_.resolvedFontFileUri)return i.emit("TEXT_WITHOUT_FONT",{block:t}),null;try{let L=typeof w.getTextLineHeight=="function"?w.getTextLineHeight(t,I):l.getFloat(t,"text/lineHeight"),U=await m(_.resolvedFontFileUri);return ve(L,U,x)*_.fontSize}catch{return i.emit("TEXT_WITHOUT_FONT",{block:t}),null}},y=async I=>{if(!I.resolvedFontFileUri)return null;try{let _=l.getFloat(t,"text/paragraphSpacing");if(_>0){let L=await m(I.resolvedFontFileUri);return ve(_,L,x)*I.fontSize}}catch{i.emit("TEXT_WITHOUT_FONT",{block:t})}return null},S=[[]],E=[0],D=0,v=Ot(r,t,c);for(let[I,_]of c.entries()){let L=_.textCase==="Lowercase"||_.textCase==="Titlecase",U=L?v?.[I]??bt(_.text,_.textCase):_.text;L&&i.emit("TEXT_CASE_NORMALIZED",{block:t,textCase:_.textCase});let F=U.split(/(\r\n|\r|\n)/);for(let C=0;C<F.length;C+=2){let H=F[C],O=F[C+1];S[S.length-1].push({run:_,text:H,breakAfter:O!==void 0}),O!==void 0&&(O.includes(`
|
|
6
|
-
`)&&D++,S.push([]),E.push(D))}}let M=new Set;for(let I=0;I<S.length;I++){let _=S[I],L=_.filter(G=>G.text.length>0||G.breakAfter),U=L.length>0?L:_.slice(-1),F=U.map(G=>G.text).join(""),C=Ct(F),H=E[I],O=d(H,F),$=U.length>0?await y(U[0].run):null;$!=null&&O.attr("SpaceAfter",b($));for(let G of U){let{run:P}=G,B=P.resolvedFontFileUri?await s(P.resolvedFontFileUri):null;!B&&P.resolvedFontFileUri&&P.typeface?.name&&!M.has(P.resolvedFontFileUri)&&(M.add(P.resolvedFontFileUri),i.emit("FONT_NAMES_UNREADABLE",{block:t,uri:P.resolvedFontFileUri,typeface:P.typeface.name}));let z=/[#&]wght=/.test(P.resolvedFontFileUri??""),dt=B&&z?K(B,P.resolvedFontFileUri):null;B&&z&&!dt&&!M.has(P.resolvedFontFileUri)&&(M.add(P.resolvedFontFileUri),i.emit("FONT_INSTANCE_UNMATCHED",{block:t,uri:P.resolvedFontFileUri}));let pt=z?dt??ke(P.fontWeight,P.fontStyle):B?B.subfamily:ke(P.fontWeight,P.fontStyle),mt=o.fillEnabled&&N(P.color)>0,k=O.element("CharacterStyleRange").attr("AppliedCharacterStyle","CharacterStyle/$ID/[No character style]").attr("FillColor",mt?n.register(P.color):"Swatch/None").attr("PointSize",b(P.fontSize)).attr("FontStyle",pt);On(G.text)&&k.attr("KerningMethod","$ID/None"),g||k.attr("KerningValue","0"),C&&k.attr("DigitsType","ArabicDigits"),mt&&"tint"in P.color&&P.color.tint<1&&k.attr("FillTint",b(P.color.tint*100)),o.stroke&&(k.attr("StrokeColor",n.register(tt(o.stroke.color))).attr("StrokeWeight",b(o.stroke.weightPt)).attr("StrokeAlignment",o.stroke.position==="Outer"?"OutsideAlignment":"CenterAlignment").attr("EndJoin",`${o.stroke.cornerGeometry??"Miter"}EndJoin`),"tint"in o.stroke.color&&o.stroke.color.tint<1&&k.attr("StrokeTint",b(o.stroke.color.tint*100))),P.textCase==="Uppercase"&&k.attr("Capitalization","AllCaps");let rt=f+(P.kerning??0);rt!==0&&k.attr("Tracking",b(rt*1e3));let Y=P.textDecoration,xt=Y?.lines??[],it=xt.includes("Underline"),W=xt.includes("Strikethrough");if(it){k.attr("Underline","true");try{let Z=oe(P.fontSize,await m(P.resolvedFontFileUri),Y?.underlineThickness,Y?.underlineOffset);if(!Z)throw new Error("Underline metrics unavailable");k.attr("UnderlineWeight",b(Z.weight)),k.attr("UnderlineOffset",b(Z.offset))}catch{i.emit("UNDERLINE_METRICS_UNAVAILABLE",{block:t})}}W&&k.attr("StrikeThru","true");let j=k.element("Properties"),ct=B?.family??P.typeface?.name;ct&&(a?.(ct,pt,B?.postScriptName??""),j.element("AppliedFont").attr("type","string").text(ct));let st=vn(Y?.style);if(st&&(it||W)&&(it&&j.element("UnderlineType").attr("type","object").text(st),W&&j.element("StrikeThroughType").attr("type","object").text(st)),it&&Y?.underlineColor!=null){let Z=Y.underlineColor;"tint"in Z&&Z.tint!==1&&k.attr("UnderlineTint",b(Z.tint*100)),j.element("UnderlineColor").attr("type","object").text(n.register(Z))}let ut=await R(H,P);ut!=null&&j.element("Leading").attr("type","unit").text(b(ut)),j.children.length===0&&k.children.pop(),G.text.length>0&&k.element("Content").text(G.text),G.breakAfter&&k.element("Br")}}return yt(u,[],I=>i.emit("XML_CHARACTERS_REPLACED",{...I}))}function vn(r){switch(r){case"Dashed":return"StrokeStyle/$ID/Dashed";case"Dotted":return"StrokeStyle/$ID/Canned Dotted";case"Double":return"StrokeStyle/$ID/ThinThin";case"Wavy":return"StrokeStyle/$ID/Wavy";default:return null}}function kn(r,t){t.split(/\r\n|\r|\n/).forEach((n,i)=>{i>0&&r.element("Br"),n.length>0&&r.element("Content").text(n)})}function ve(r,t,e){let{ascender:n,descender:i,unitsPerEm:s,lineGap:o=0}=t,a=r;if(e){let l=n-i,c=l+o;l!==0&&(a=a*c/l)}if(s!==0){let l=(n-i)/s;a=a*l}return a}var Mn={thin:"Thin",extraLight:"ExtraLight",light:"Light",normal:"Regular",medium:"Medium",semiBold:"SemiBold",bold:"Bold",extraBold:"ExtraBold",heavy:"Heavy"};function ke(r,t){let e=Mn[r]??"Regular",n=t==="italic";return e==="Regular"&&n?"Italic":n?`${e} Italic`:e}function Be(r,t){let e=r.block,n=0;try{n=e.getFloat(t,"text/letterSpacing")}catch{}let i=[];try{i=e.getTextRuns(t)}catch{return 0}return i.reduce((s,o)=>Math.max(s,(n+(o.kerning??0))*o.fontSize),0)}function Xe(r){switch(r){case"Center":return"CenterPoint";case"Bottom":return"BottomCenterPoint";default:return"TopCenterPoint"}}function $e(r,t){let e=r==="Center"?"Center":r==="Bottom"?"Bottom":"Top",n=t==="Center"?"Center":t==="Right"?"Right":"Left";return e==="Center"?n==="Center"?"CenterPoint":`${n}CenterPoint`:`${e}${n}Point`}function Ge(r){switch(r){case"Top":return"TopAlign";case"Center":return"CenterAlign";case"Bottom":return"BottomAlign";default:return null}}function On(r){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}|[ -〿-]/u.test(r)}function Un(r){return Nt.export(r)}async function Bn(r,t={}){return vt.exportPackage(r,t.name??"design")}var qt=72,Jt="ubs",jt=(r,t,e)=>[r[0]+t,r[1]+e],Xn=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("jszip");c=s(c,1);function l(e){let t=new TextEncoder().encode(e),n=new Uint8Array(t.length),r=0;for(let e=0;e<t.length;e++){if(t[e]!==37){n[r++]=t[e];continue}let i=String.fromCharCode(t[e+1]??0,t[e+2]??0);if(!/^[0-9a-f]{2}$/i.test(i))return null;n[r++]=Number.parseInt(i,16),e+=2}return n.subarray(0,r)}async function u(e,t){try{if(t.startsWith(`data:`)){let e=t.match(/^data:([^,]*),(.*)$/s);if(!e)return null;if(!/;base64$/i.test(e[1]))return l(e[2]);let n=atob(decodeURIComponent(e[2]));return Uint8Array.from(n,e=>e.charCodeAt(0))}let n=typeof e.editor?.getAbsoluteURI==`function`?await e.editor.getAbsoluteURI(t):t;if(n!==t&&n.startsWith(`data:`))return u(e,n);if(n.startsWith(`buffer://`))return new Uint8Array(e.editor.getBufferData(n,0,e.editor.getBufferLength(n)));if(n.startsWith(`file://`)){let{readFile:e}=await import(`fs/promises`),{fileURLToPath:t}=await import(`url`);return new Uint8Array(await e(t(n)))}if(/^https?:\/\//.test(n)){let e=await fetch(n);return e.ok?new Uint8Array(await e.arrayBuffer()):null}let r=null;return e.editor.getResourceData(n,0,e=>(r=new Uint8Array(e),!1)),r}catch{return null}}function d(e,t){if(t===`Lowercase`)return e.toLowerCase();if(t===`Uppercase`)return e.toUpperCase();if(t!==`Titlecase`)return e;let n=new Intl.Segmenter(`en-US`,{granularity:`word`});return e.split(/([:\uFE55\uFF1A])/u).map(e=>Array.from(n.segment(e),({segment:e,isWordLike:t})=>{if(!t)return e;let n=String.fromCodePoint(e.codePointAt(0)),r=e.toLowerCase();return p(n)+r.slice(n.toLowerCase().length)}).join(``)).join(``)}const f=/* @__PURE__ */ new Map([[223,`Ss`],[1415,`Եւ`],[8114,`Ὰͅ`],[8115,`ᾼ`],[8116,`Άͅ`],[8119,`ᾼ͂`],[8124,`ᾼ`],[8130,`Ὴͅ`],[8131,`ῌ`],[8132,`Ήͅ`],[8135,`ῌ͂`],[8140,`ῌ`],[8178,`Ὼͅ`],[8179,`ῼ`],[8180,`Ώͅ`],[8183,`ῼ͂`],[8188,`ῼ`],[64256,`Ff`],[64257,`Fi`],[64258,`Fl`],[64259,`Ffi`],[64260,`Ffl`],[64261,`St`],[64262,`St`],[64275,`Մն`],[64276,`Մե`],[64277,`Մի`],[64278,`Վն`],[64279,`Մխ`]]);function p(e){let t=e.codePointAt(0);return t>=452&&t<=460?String.fromCodePoint(t-(t-452)%3+1):t>=497&&t<=499?`Dz`:t>=4304&&t<=4351?e:t>=8064&&t<=8111?String.fromCodePoint(t|8):f.get(t)??e.toUpperCase()}function m(e,t,n){try{n??=e.block.getTextRuns(t);let r=e=>e===`Lowercase`||e===`Titlecase`,i=n.map(e=>r(e.textCase)?d(e.text,e.textCase):e.text);if(!n.some(e=>r(e.textCase)))return i;if(n.map(e=>e.text).join(``)!==e.block.getString(t,`text/text`)||!e.block.getTextVisibleLineCount||!e.block.getTextVisibleLineContent)return;let a=e=>e.map((e,t)=>n[t].textCase===`Uppercase`?e.toUpperCase():e).join(``),o=a(i),s=[...i],c=[];for(let e=0;e<n.length;){let t=n[e].textCase,i=e+1;if(r(t)){for(;i<n.length&&n[i].textCase===t;)i++;let r=n.slice(e,i).map(e=>e.text).join(``),a=d(r,t);c.push({start:e,end:i,raw:r,text:a}),s[e]=a;for(let t=e+1;t<i;t++)s[t]=``}e=i}let l=a(s),u=e.block.getTextVisibleLineCount(t);if(!Number.isInteger(u)||u<0||u>Math.max(o.length,l.length)+1)return;let f=Array.from({length:u},(n,r)=>e.block.getTextVisibleLineContent(t,r)),p=e=>{let t=0;for(let n of f){for(;!e.startsWith(n,t)&&/\p{White_Space}/u.test(e[t]??``);)t++;if(!e.startsWith(n,t))return!1;t+=n.length}for(;/\p{White_Space}/u.test(e[t]??``);)t++;return t===e.length};if(p(o))return i;if(!p(l))return;for(let{start:e,end:t,raw:r,text:i}of c){let a=0,o=0;for(let c=e;c<t;c++){if(a+=n[c].text.length,a<r.length&&/[\uD800-\uDBFF]/u.test(r[a-1]??``)&&/[\uDC00-\uDFFF]/u.test(r[a]??``))return;let t=d(r.slice(0,a),n[e].textCase).length;if(t<o||t>i.length)return;s[c]=i.slice(o,t),o=t}if(o!==i.length)return}return s}catch{return}}function h(e,t){return m(e,t)!==void 0}const g=[1424,1424,1470,1470,1472,1472,1475,1475,1478,1478,1480,1535,1544,1544,1547,1547,1549,1549,1563,1610,1645,1647,1649,1749,1765,1766,1774,1775,1786,1808,1810,1839,1867,1957,1969,2026,2036,2037,2042,2044,2046,2069,2074,2074,2084,2084,2088,2088,2094,2136,2140,2191,2194,2199,2208,2249,8207,8207,64285,64285,64287,64296,64298,64829,64848,64974,65008,65020,65136,65278,67584,67870,67872,68096,68100,68100,68103,68107,68112,68151,68155,68158,68160,68324,68327,68408,68416,68899,68904,68911,68922,69215,69247,69290,69293,69372,69376,69445,69457,69505,69510,69631,124928,125135,125143,125251,125259,126703,126706,126975],_=[0,64,91,96,123,169,171,180,182,185,187,191,215,215,247,247,697,698,706,719,722,735,741,749,751,879,884,885,894,894,900,901,903,903,1014,1014,1155,1161,1418,1418,1421,1423,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1536,1543,1545,1546,1548,1548,1550,1562,1611,1644,1648,1648,1750,1764,1767,1773,1776,1785,1809,1809,1840,1866,1958,1968,2027,2035,2038,2041,2045,2045,2070,2073,2075,2083,2085,2087,2089,2093,2137,2139,2192,2193,2200,2207,2250,2306,2362,2362,2364,2364,2369,2376,2381,2381,2385,2391,2402,2403,2433,2433,2492,2492,2497,2500,2509,2509,2530,2531,2546,2547,2555,2555,2558,2558,2561,2562,2620,2620,2625,2626,2631,2632,2635,2637,2641,2641,2672,2673,2677,2677,2689,2690,2748,2748,2753,2757,2759,2760,2765,2765,2786,2787,2801,2801,2810,2815,2817,2817,2876,2876,2879,2879,2881,2884,2893,2893,2901,2902,2914,2915,2946,2946,3008,3008,3021,3021,3059,3066,3072,3072,3076,3076,3132,3132,3134,3136,3142,3144,3146,3149,3157,3158,3170,3171,3192,3198,3201,3201,3260,3260,3276,3277,3298,3299,3328,3329,3387,3388,3393,3396,3405,3405,3426,3427,3457,3457,3530,3530,3538,3540,3542,3542,3633,3633,3636,3642,3647,3647,3655,3662,3761,3761,3764,3772,3784,3790,3864,3865,3893,3893,3895,3895,3897,3901,3953,3966,3968,3972,3974,3975,3981,3991,3993,4028,4038,4038,4141,4144,4146,4151,4153,4154,4157,4158,4184,4185,4190,4192,4209,4212,4226,4226,4229,4230,4237,4237,4253,4253,4957,4959,5008,5017,5120,5120,5760,5760,5787,5788,5906,5908,5938,5939,5970,5971,6002,6003,6068,6069,6071,6077,6086,6086,6089,6099,6107,6107,6109,6109,6128,6137,6144,6159,6277,6278,6313,6313,6432,6434,6439,6440,6450,6450,6457,6459,6464,6464,6468,6469,6622,6655,6679,6680,6683,6683,6742,6742,6744,6750,6752,6752,6754,6754,6757,6764,6771,6780,6783,6783,6832,6862,6912,6915,6964,6964,6966,6970,6972,6972,6978,6978,7019,7027,7040,7041,7074,7077,7080,7081,7083,7085,7142,7142,7144,7145,7149,7149,7151,7153,7212,7219,7222,7223,7376,7378,7380,7392,7394,7400,7405,7405,7412,7412,7416,7417,7616,7679,8125,8125,8127,8129,8141,8143,8157,8159,8173,8175,8189,8190,8192,8205,8208,8304,8308,8318,8320,8334,8352,8432,8448,8449,8451,8454,8456,8457,8468,8468,8470,8472,8478,8483,8485,8485,8487,8487,8489,8489,8494,8494,8506,8507,8512,8516,8522,8525,8528,8543,8585,8587,8592,9013,9083,9108,9110,9254,9280,9290,9312,9371,9450,9899,9901,10239,10496,11123,11126,11157,11159,11263,11493,11498,11503,11505,11513,11519,11647,11647,11744,11869,11904,11929,11931,12019,12032,12245,12272,12292,12296,12320,12330,12333,12336,12336,12342,12343,12349,12351,12441,12444,12448,12448,12539,12539,12736,12771,12783,12783,12829,12830,12880,12895,12924,12926,12977,12991,13004,13007,13175,13178,13278,13279,13311,13311,19904,19967,42128,42182,42509,42511,42607,42623,42654,42655,42736,42737,42752,42785,42888,42888,43010,43010,43014,43014,43019,43019,43045,43046,43048,43052,43064,43065,43124,43127,43204,43205,43232,43249,43263,43263,43302,43309,43335,43345,43392,43394,43443,43443,43446,43449,43452,43453,43493,43493,43561,43566,43569,43570,43573,43574,43587,43587,43596,43596,43644,43644,43696,43696,43698,43700,43703,43704,43710,43711,43713,43713,43756,43757,43766,43766,43882,43883,44005,44005,44008,44008,44013,44013,64286,64286,64297,64297,64830,64847,64975,65007,65021,65049,65056,65106,65108,65126,65128,65131,65279,65279,65281,65312,65339,65344,65371,65381,65504,65510,65512,65518,65520,65535,65793,65793,65856,65932,65936,65948,65952,65952,66045,66045,66272,66299,66422,66426,67871,67871,68097,68099,68101,68102,68108,68111,68152,68154,68159,68159,68325,68326,68409,68415,68900,68903,68912,68921,69216,69246,69291,69292,69373,69375,69446,69456,69506,69509,69633,69633,69688,69702,69714,69733,69744,69744,69747,69748,69759,69761,69811,69814,69817,69818,69826,69826,69888,69890,69927,69931,69933,69940,70003,70003,70016,70017,70070,70078,70089,70092,70095,70095,70191,70193,70196,70196,70198,70199,70206,70206,70209,70209,70367,70367,70371,70378,70400,70401,70459,70460,70464,70464,70502,70508,70512,70516,70712,70719,70722,70724,70726,70726,70750,70750,70835,70840,70842,70842,70847,70848,70850,70851,71090,71093,71100,71101,71103,71104,71132,71133,71219,71226,71229,71229,71231,71232,71264,71276,71339,71339,71341,71341,71344,71349,71351,71351,71453,71455,71458,71461,71463,71467,71727,71735,71737,71738,71995,71996,71998,71998,72003,72003,72148,72151,72154,72155,72160,72160,72193,72198,72201,72202,72243,72248,72251,72254,72263,72263,72273,72278,72281,72283,72330,72342,72344,72345,72752,72758,72760,72765,72850,72871,72874,72880,72882,72883,72885,72886,73009,73014,73018,73018,73020,73021,73023,73029,73031,73031,73104,73105,73109,73109,73111,73111,73459,73460,73472,73473,73526,73530,73536,73536,73538,73538,73685,73713,78912,78912,78919,78933,92912,92916,92976,92982,94031,94031,94095,94098,94178,94178,94180,94180,113821,113822,113824,113827,118528,118573,118576,118598,119143,119145,119155,119170,119173,119179,119210,119213,119273,119274,119296,119365,119552,119638,120539,120539,120597,120597,120655,120655,120713,120713,120771,120771,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,123023,123023,123184,123190,123566,123566,123628,123631,123647,123647,124140,124143,125136,125142,125252,125258,126704,126705,126976,127019,127024,127123,127136,127150,127153,127167,127169,127183,127185,127221,127232,127247,127279,127279,127338,127343,127405,127405,127584,127589,127744,128727,128732,128748,128752,128764,128768,128886,128891,128985,128992,129003,129008,129008,129024,129035,129040,129095,129104,129113,129120,129159,129168,129197,129200,129201,129280,129619,129632,129645,129648,129660,129664,129672,129680,129725,129727,129733,129742,129755,129760,129768,129776,129784,129792,129938,129940,129994,130032,130041,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,921599,983038,983039,1048574,1048575,1114110,1114111];function v(e,t){let n=0,r=t.length/2-1;for(;n<=r;){let i=n+r>>>1;if(e<t[i*2])r=i-1;else if(e>t[i*2+1])n=i+1;else return!0}return!1}function y(e){let t=0;for(let n of e){let e=n.codePointAt(0);if(e>=8294&&e<=8296)t++;else if(e===8297)t=Math.max(0,t-1);else if(!(t>0)){if(v(e,g))return!0;if(!v(e,_))return!1}}return!1}function b(e,t,n=1,r=0){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t.unitsPerEm)||t.unitsPerEm<=0||!Number.isFinite(t.underlineSize)||!Number.isFinite(t.underlineOffset)||!Number.isFinite(n)||n<0||!Number.isFinite(r))return null;let i=Math.abs(e*Math.max(t.underlineSize,10)/t.unitsPerEm)*n;return{weight:i,offset:-e*t.underlineOffset/t.unitsPerEm*(1+r)+i/2}}function x(e){return e.scene.get()!==null&&e.scene.getAngleUnit?.()===`Degree`}function S(e,t){return x(e)?t*Math.PI/180:t}function C(e){return Number.isFinite(e)&&e>=0?e:0}const w={id:void 0,exportOptions:e=>e,end:()=>{},cancel:()=>{}};function T(e,t){let n=e.editor;if(typeof n.beginExportTransaction!=`function`||typeof n.endExportTransaction!=`function`||typeof n.cancelExportTransaction!=`function`)return w;let r;try{r=n.beginExportTransaction(t.type,t.format,t.producer,t.block)}catch{return w}let i=t.warn??(e=>console.warn(e)),a=()=>{try{n.cancelExportTransaction(r)}catch(e){i(`The export transaction of a ${t.type} export did not cancel: ${e}`)}};return{id:r,exportOptions:e=>({...e,transactionId:r}),end:(e,o)=>{try{n.endExportTransaction(r,C(e),C(o))}catch(e){i(`The ${t.type} export is complete, but its export transaction did not end: ${e}`),a()}},cancel:a}}var E=`@imgly/idml-exporter`,D=`0.1.1`;const O=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u;function k(e){return O.test(e)}function A(e,t,n){return k(e)?e.replace(new RegExp(O.source,`gu`),(e,r)=>(n?.({...t,codePoint:e.codePointAt(0),offset:r}),`�`)):e}function j(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function ee(e,t,n){return j(A(e,t,n)).replace(/\r/g,` `)}function M(e,t,n){return j(A(e,t,n)).replace(/"/g,`"`).replace(/\t/g,`	`).replace(/\n/g,` `).replace(/\r/g,` `)}var N=class{text;constructor(e){this.text=e}serialize(e,t=`#text`){return ee(this.text,{tag:t,kind:`text`},e)}},P=class{data;constructor(e){this.data=e}serialize(e,t=`#cdata`){return`<![CDATA[${A(this.data,{tag:t,kind:`cdata`},e).replace(/\]\]>/g,`]]]]><![CDATA[>`).replace(/\r/g,`]]> <![CDATA[`)}]]>`}},F=class e{tag;children=[];attributes=/* @__PURE__ */ new Map;constructor(e){this.tag=e}attr(e,t){return this.attributes.set(e,String(t)),this}element(t){let n=new e(t);return this.children.push(n),n}append(e){return this.children.push(e),this}text(e){return this.children.push(new N(e)),this}cdata(e){return this.children.push(new P(e)),this}serialize(t){let n=Array.from(this.attributes.entries()).map(([e,n])=>` ${e}="${M(n,{tag:this.tag,kind:`attribute`,attribute:e},t)}"`).join(``);if(this.children.length===0)return`<${this.tag}${n}/>`;let r=this.children.map(n=>n instanceof e?n.serialize(t):n.serialize(t,this.tag)).join(``);return`<${this.tag}${n}>${r}</${this.tag}>`}};function I(e,t=[],n){return`${[`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`,...t].join(`
|
|
2
|
+
`)}\n${e.serialize(n)}\n`}function L(e){return new F(`idPkg:${e}`).attr(`xmlns:idPkg`,`http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging`).attr(`DOMVersion`,`15.0`)}function R(e){if(!Number.isFinite(e))return`0`;let t=Math.round(e*1e6)/1e6;return String(t)}var te=class{resolveSpot;allocateId;colors=/* @__PURE__ */ new Map;gradients=[];tints=/* @__PURE__ */ new Map;colorCounter=0;tintCounter=0;gradientCounter=0;constructor(e=()=>null,t=e=>e){this.resolveSpot=e,this.allocateId=t}register(e){if(`name`in e)return this.registerSpot(e);let{key:t,space:n,colorValue:r}=ne(e),i=this.colors.get(t);if(i)return i.self;let a=this.allocateId(`Color/c${++this.colorCounter}`),o=new F(`Color`).attr(`Self`,a).attr(`Name`,`c${this.colorCounter}`).attr(`Space`,n).attr(`ColorValue`,r);return this.colors.set(t,{self:a,element:o}),a}registerSpot(e){let t=`SPOT:${e.name}`,n=this.colors.get(t);if(n)return n.self;let r=this.resolveSpot(e.name)??{r:1,g:0,b:1,a:1},i=this.allocateId(`Color/c${++this.colorCounter}`),a=new F(`Color`).attr(`Self`,i).attr(`Name`,e.name).attr(`Model`,`Spot`).attr(`Space`,`RGB`).attr(`ColorValue`,[r.r,r.g,r.b].map(e=>R(z(e)*255)).join(` `));return this.colors.set(t,{self:i,element:a}),i}registerWithTint(e){let t=this.register(e);if(`r`in e)return t;let n=z(e.tint);if(n===1)return t;let r=R(n*100),i=`${t}:${r}`,a=this.tints.get(i);if(!a){let n=this.allocateId(`Tint/t${++this.tintCounter}`);a={self:n,element:new F(`Tint`).attr(`Self`,n).attr(`Name`,`${`name`in e?e.name:t} ${r}%`).attr(`BaseColor`,t).attr(`TintValue`,r)},this.tints.set(i,a)}return a.self}registerGradient(e,t){let n=this.allocateId(`Gradient/g${++this.gradientCounter}`),r=new F(`Gradient`).attr(`Self`,n).attr(`Name`,`g${this.gradientCounter}`).attr(`Type`,e);return t.forEach((e,t)=>{r.element(`GradientStop`).attr(`Self`,this.allocateId(`${n}Stop${t}`)).attr(`StopColor`,this.registerWithTint(e.color)).attr(`Location`,R(e.stop*100)).attr(`Midpoint`,`50`)}),this.gradients.push(r),n}getResourceElements(){return[...Array.from(this.colors.values()).map(e=>e.element),...Array.from(this.tints.values()).map(e=>e.element),...this.gradients]}};function ne(e){if(`r`in e){let t=e,n=[t.r,t.g,t.b].map(e=>R(z(e)*255)).join(` `);return{key:`RGB:${n}`,space:`RGB`,colorValue:n}}let t=e,n=[t.c,t.m,t.y,t.k].map(e=>R(z(e)*100)).join(` `);return{key:`CMYK:${n}`,space:`CMYK`,colorValue:n}}function z(e){return Math.max(0,Math.min(1,e))}function B(e){return`r`in e?e.a:1}function V(e){return`r`in e&&e.a!==1?{...e,a:1}:e}function re(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=e[n+1];if(t.push(r),!i||i.location<=r.location)continue;let a=i.opacity-r.opacity,o=Math.ceil(Math.abs(a)/.05-1e-6);for(let e=1;e<o;e++){let n=e/o;t.push({opacity:r.opacity+a*n,location:r.location+(i.location-r.location)*n})}}return t}function ie(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+i*l,r*c+a*l,n*u+i*d,r*u+a*d,n*f+i*p+o,r*f+a*p+s]}function ae(e){let{x:t,y:n,width:r,height:i,rotation:a,flipHorizontal:o,flipVertical:s}=e,c=Math.cos(a),l=Math.sin(a);return[o?-c:c,o?-l:l,s?l:-l,s?-c:c,t+(o?r:0),n+(s?i:0)]}function H(e){return e.map(R).join(` `)}function oe(e){if(e.length!==1||e[0].points.length>256)return!1;let t=e[0].points;if(t.some(e=>!e.anchor.every(Number.isFinite)||e.left[0]!==e.anchor[0]||e.left[1]!==e.anchor[1]||e.right[0]!==e.anchor[0]||e.right[1]!==e.anchor[1]))return!1;let n=t.map(e=>e.anchor).filter((e,t,n)=>t===0||e[0]!==n[t-1][0]||e[1]!==n[t-1][1]);if(n.length>1&&n[0][0]===n.at(-1)[0]&&n[0][1]===n.at(-1)[1]&&n.pop(),n.length<3)return!0;let r=Math.max(1,...n.flat().map(Math.abs)),i=1e-10*r*r;if(!Number.isFinite(i))return!1;let a=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),o=(e,t,n)=>Math.abs(a(e,t,n))<=i&&n[0]>=Math.min(e[0],t[0])&&n[0]<=Math.max(e[0],t[0])&&n[1]>=Math.min(e[1],t[1])&&n[1]<=Math.max(e[1],t[1]);for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){if(t===e+1||e===0&&t===n.length-1)continue;let r=n[e],i=n[(e+1)%n.length],s=n[t],c=n[(t+1)%n.length],l=a(r,i,s),u=a(r,i,c),d=a(s,c,r),f=a(s,c,i);if(Math.sign(l)!==Math.sign(u)&&Math.sign(d)!==Math.sign(f)||o(r,i,s)||o(r,i,c)||o(s,c,r)||o(s,c,i))return!1}return!0}function U(e,t){let n=e.element(`Properties`).element(`PathGeometry`);for(let e of t){let t=n.element(`GeometryPathType`).attr(`PathOpen`,e.open?`true`:`false`).element(`PathPointArray`);for(let n of e.points)t.element(`PathPointType`).attr(`Anchor`,`${R(n.anchor[0])} ${R(n.anchor[1])}`).attr(`LeftDirection`,`${R(n.left[0])} ${R(n.left[1])}`).attr(`RightDirection`,`${R(n.right[0])} ${R(n.right[1])}`)}}function W(e,t){return[{open:!1,points:[[0,0],[e,0],[e,t],[0,t]].map(e=>({anchor:e,left:e,right:e}))}]}const se=.5522847498307936;function ce(e,t){let n=e/2,r=t/2,i=n,a=r,o=n*se,s=r*se;return[{open:!1,points:[{anchor:[i,0],left:[i-o,0],right:[i+o,0]},{anchor:[e,a],left:[e,a-s],right:[e,a+s]},{anchor:[i,t],left:[i+o,t],right:[i-o,t]},{anchor:[0,a],left:[0,a+s],right:[0,a-s]}]}]}function le(e,t,n,r){let i=e/2,a=t/2,o=[];for(let e=0;e<n*2;e++){let t=-Math.PI/2+e*Math.PI/n,s=e%2==0?1:r,c=[i+i*s*Math.cos(t),a+a*s*Math.sin(t)];o.push({anchor:c,left:c,right:c})}return[{open:!1,points:o}]}function ue(e,t,n){let r=e/2,i=t/2,a=[],o=Math.PI/2+Math.PI/n;for(let e=0;e<n;e++){let t=o+e*2*Math.PI/n,s=[r+r*Math.cos(t),i+i*Math.sin(t)];a.push({anchor:s,left:s,right:s})}return[{open:!1,points:a}]}const G=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function de(e,t,n){let r=[],i=[],a=!0,o=0,s=``,c=[0,0],l=[0,0],u=null,d=null,f=()=>{for(;o<e.length&&/[\s,]/.test(e[o]);)o++},p=()=>{f(),G.lastIndex=o;let t=G.exec(e);return t?(o=G.lastIndex,Number(t[0])):null},m=e=>{let t=p(),n=p();return t==null||n==null?null:e?[c[0]+t,c[1]+n]:[t,n]},h=()=>{f();let t=e[o];return t!==`0`&&t!==`1`?null:(o++,+(t===`1`))},g=()=>{i.length>0&&r.push({points:fe(i,a),open:a}),i=[],a=!0},_=e=>{i.length===0&&i.push({anchor:c,left:c,right:c}),i.push({anchor:e,left:e,right:e}),c=e},v=(e,t,n)=>{i.length===0&&i.push({anchor:c,left:c,right:c}),i[i.length-1].right=e,i.push({anchor:n,left:t,right:n}),c=n},y=(e,t)=>{v([c[0]+2/3*(e[0]-c[0]),c[1]+2/3*(e[1]-c[1])],[t[0]+2/3*(e[0]-t[0]),t[1]+2/3*(e[1]-t[1])],t)},b=(e,t,n,r,i,a)=>{let[o,s]=c,[l,u]=a;if(o===l&&s===u)return;let d=Math.abs(e),f=Math.abs(t);if(d===0||f===0){_(a);return}let p=n*Math.PI/180,m=Math.cos(p),h=Math.sin(p),g=(o-l)/2,y=(s-u)/2,b=m*g+h*y,x=-h*g+m*y,S=b*b/(d*d)+x*x/(f*f);if(S>1){let e=Math.sqrt(S);d*=e,f*=e}let C=Math.max(0,(d*d*f*f-d*d*x*x-f*f*b*b)/(d*d*x*x+f*f*b*b)),w=r===i?-1:1,T=w*Math.sqrt(C)*(d*x)/f,E=w*Math.sqrt(C)*(-f*b)/d,D=m*T-h*E+(o+l)/2,O=h*T+m*E+(s+u)/2,k=Math.atan2((x-E)/f,(b-T)/d),A=Math.atan2((-x-E)/f,(-b-T)/d)-k;i===0&&A>0&&(A-=2*Math.PI),i===1&&A<0&&(A+=2*Math.PI);let j=e=>[D+d*Math.cos(e)*m-f*Math.sin(e)*h,O+d*Math.cos(e)*h+f*Math.sin(e)*m],ee=e=>[-d*Math.sin(e)*m-f*Math.cos(e)*h,-d*Math.sin(e)*h+f*Math.cos(e)*m],M=Math.ceil(Math.abs(A)/(Math.PI/2)),N=A/M,P=4/3*Math.tan(N/4);for(let e=0;e<M;e++){let t=k+e*N,n=t+N,r=j(t),i=e===M-1?a:j(n),o=ee(t),s=ee(n);v([r[0]+P*o[0],r[1]+P*o[1]],[i[0]-P*s[0],i[1]-P*s[1]],i)}};for(;f(),!(o>=e.length);){let t=e[o];if(/[A-Za-z]/.test(t))s=t,o++;else if(s===``||s===`Z`||s===`z`)return{error:`unexpected character '${t}' at position ${o}`};if(s!==`M`&&s!==`m`&&r.length===0&&i.length===0)return{error:`path must start with a moveto command`};let n=s>=`a`;switch(s){case`M`:case`m`:{let e=m(n);if(!e)return{error:`expected coordinates after '${s}'`};g(),c=e,l=e,i.push({anchor:e,left:e,right:e}),s=n?`l`:`L`;break}case`L`:case`l`:{let e=m(n);if(!e)return{error:`expected coordinates after '${s}'`};_(e);break}case`H`:case`h`:{let e=p();if(e==null)return{error:`expected coordinate after '${s}'`};_([n?c[0]+e:e,c[1]]);break}case`V`:case`v`:{let e=p();if(e==null)return{error:`expected coordinate after '${s}'`};_([c[0],n?c[1]+e:e]);break}case`C`:case`c`:case`S`:case`s`:{let e=s===`S`||s===`s`?u?[2*c[0]-u[0],2*c[1]-u[1]]:c:m(n),t=m(n),r=m(n);if(!e||!t||!r)return{error:`expected coordinates after '${s}'`};v(e,t,r),u=t;break}case`Q`:case`q`:case`T`:case`t`:{let e=s===`T`||s===`t`?d?[2*c[0]-d[0],2*c[1]-d[1]]:c:m(n),t=m(n);if(!e||!t)return{error:`expected coordinates after '${s}'`};y(e,t),d=e;break}case`A`:case`a`:{let e=p(),t=p(),r=p(),i=h(),a=h(),o=m(n);if(e==null||t==null||r==null||!o)return{error:`expected arc parameters after '${s}'`};if(i==null||a==null)return{error:`expected 0/1 arc flag after '${s}'`};b(e,t,r,i,a,o);break}case`Z`:case`z`:a=!1,g(),c=l;break;default:return{error:`unsupported command '${s}'`}}s!==`C`&&s!==`c`&&s!==`S`&&s!==`s`&&(u=null),s!==`Q`&&s!==`q`&&s!==`T`&&s!==`t`&&(d=null)}if(g(),r.length===0)return{error:`path contains no coordinates`};let x=e=>{let r=e[0]*t,i=e[1]*n;return!Number.isFinite(r)||!Number.isFinite(i)?null:[r,i]};for(let e of r)for(let t of e.points){let e=x(t.anchor),n=x(t.left),r=x(t.right);if(!e||!n||!r)return{error:`path contains non-finite coordinates`};t.anchor=e,t.left=n,t.right=r}return{subPaths:r}}function fe(e,t){if(t||e.length<2)return e;let n=e[0],r=e[e.length-1],i=1e-6;return Math.abs(n.anchor[0]-r.anchor[0])<i&&Math.abs(n.anchor[1]-r.anchor[1])<i?(n.left=r.left,e.slice(0,-1)):e}async function pe(e,t){let n=await u(e,t);if(!n||n.length===0)return null;let r=he(n);return r?{bytes:n,mimeType:r,isSvg:r===`image/svg+xml`,pixelSize:me(n,r)}:null}function me(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t===`image/png`&&e.length>=24)return{width:n.getUint32(16),height:n.getUint32(20)};if(t===`image/jpeg`){let t=2;for(;t+9<e.length;){if(e[t]!==255)return null;let r=e[t+1],i=n.getUint16(t+2);if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{height:n.getUint16(t+5),width:n.getUint16(t+7)};t+=2+i}return null}return null}function K(e){if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return btoa(t)}function he(e){if(e.length>=3&&e[0]===255&&e[1]===216)return`image/jpeg`;if(e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return`image/png`;if(e.length>=2&&e[0]===66&&e[1]===77)return`image/bmp`;if(e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return`image/webp`;let t=new TextDecoder(`utf-8`,{fatal:!1}).decode(e.subarray(0,1024));return/<svg[\s>]/i.test(t)?`image/svg+xml`:null}function ge(e){let t;try{t=new TextDecoder().decode(e)}catch{return null}let n=t.match(/<svg\b[^>]*>/i),r=n?n[0]:t,i=e=>{let t=e.trim().match(/^([\d.]+)\s*(px|pt)?$/i);if(!t)return null;let n=parseFloat(t[1]);return n>0?n:null},a=r.match(/\bwidth\s*=\s*["']([^"']+)["']/i),o=r.match(/\bheight\s*=\s*["']([^"']+)["']/i);if(a&&o){let e=i(a[1]),t=i(o[1]);if(e!=null&&t!=null)return{width:e,height:t}}let s=r.match(/viewBox\s*=\s*["']([\d.eE+\-, ]+)["']/i);if(s){let e=s[1].trim().split(/[\s,]+/).map(Number);if(e.length===4&&e[2]>0&&e[3]>0)return{width:e[2],height:e[3]}}return null}function _e(e){switch(e){case`image/jpeg`:return`$ID/JPEG`;case`image/png`:return`$ID/PNG`;case`image/bmp`:return`$ID/BMP`;case`image/webp`:return`$ID/WEBP`;default:return`$ID/`}}function q(e,t){for(let n=t;n!==null;n=e.block.getParent(n))if(!e.block.getBool(n,`includedInExport`))return!1;return!0}const ve=[1,2,6,16,17],ye=[`ExtraLight`,`UltraLight`,`SemiBold`,`DemiBold`,`ExtraBold`,`UltraBold`,`Thin`,`Light`,`Medium`,`Black`,`Heavy`];function be(e,t){if(t!==`Regular`)return{family:e,subfamily:t};for(let t of ye){let n=` ${t}`;if(e.length>n.length&&e.endsWith(n))return{family:e.slice(0,-n.length),subfamily:t}}return{family:e,subfamily:t}}function J(e){try{let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(0);if(n!==65536&&n!==1330926671&&n!==1953658213)return null;let r=t.getUint16(4),i=-1,a=-1;for(let e=0;e<r;e++){let n=12+e*16,r=t.getUint32(n);r===1851878757&&(i=t.getUint32(n+8)),r===1719034226&&(a=t.getUint32(n+8))}if(i<0)return null;let o=a>=0?xe(t,a):null,s=new Set(ve);if(o)for(let e of o.instances)s.add(e.nameId);let c=t.getUint16(i+2),l=i+t.getUint16(i+4),u=/* @__PURE__ */ new Map;for(let e=0;e<c;e++){let n=i+6+e*12,r=t.getUint16(n),a=t.getUint16(n+4),o=t.getUint16(n+6),c=t.getUint16(n+8),d=l+t.getUint16(n+10);if(!s.has(o)||r!==0&&r!==3)continue;let f=r===3?a===1033?0:1:2,p=u.get(o);if(p&&p.rank<=f)continue;let m=``;for(let e=0;e+1<c;e+=2)m+=String.fromCharCode(t.getUint16(d+e));m&&u.set(o,{text:m,rank:f})}let d=(u.get(16)??u.get(1))?.text;if(!d)return null;let{family:f,subfamily:p}=be(d,(u.get(17)??u.get(2))?.text||`Regular`);return{family:f,subfamily:p,postScriptName:u.get(6)?.text??``,instances:(o?.instances??[]).flatMap(e=>{let t=u.get(e.nameId)?.text;return t?[{subfamily:t,coordinates:e.coordinates}]:[]}),axisDefaults:o?.axisDefaults??{}}}catch{return null}}function xe(e,t){let n=t+e.getUint16(t+4),r=e.getUint16(t+8),i=e.getUint16(t+10),a=e.getUint16(t+12),o=e.getUint16(t+14),s=t=>String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3)),c=[],l={};for(let t=0;t<r;t++){let r=n+t*i,a=s(r);c.push(a),l[a]=e.getInt32(r+8)/65536}let u=[],d=n+r*i;for(let t=0;t<a;t++){let n=d+t*o,i={};for(let t=0;t<r;t++)i[c[t]]=e.getInt32(n+4+t*4)/65536;u.push({nameId:e.getUint16(n),coordinates:i})}return{instances:u,axisDefaults:l}}function Y(e){let t=e.split(`#`)[1];if(!t)return{};let n={};for(let e of t.split(`&`)){let[t,r]=e.split(`=`);/^[\x20-\x7e]{4}$/.test(t)&&r&&Number.isFinite(+r)&&(n[t]=+r)}return n}function X(e,t){let n=Y(t);return Object.keys(n).length===0?null:e.instances.find(t=>Object.entries(t.coordinates).every(([t,r])=>{let i=n[t]??e.axisDefaults[t];return i!=null&&Math.abs(i-r)<.01}))?.subfamily??null}function Se(e){let t=/* @__PURE__ */ new Map;return n=>{let r=n.split(`#`)[0],i=t.get(r);return i||(i=(async()=>{try{let t=await e(r);return t&&J(t)}catch{return null}})(),t.set(r,i)),i}}const Ce={thin:100,extraLight:200,light:300,normal:400,medium:500,semiBold:600,bold:700,extraBold:800,heavy:900};function we(e,t,n,r){if(e.length!==1||!r)return e;let i=e[0],a=Y(n),o=i.typeface?.fonts.find(e=>e.uri===i.resolvedFontFileUri);return!i.text||i.from!==0||i.text!==t||i.resolvedFontFileUri.includes(`#`)||i.resolvedFontFileUri!==n.split(`#`)[0]||!/#wght=(?:100|200|300|400|500|600|700|800|900)$/.test(n)||Object.keys(r.axisDefaults).length!==1||a.wght==null||a.wght!==Ce[i.fontWeight]||i.fontStyle!==`normal`||r.axisDefaults.wght!==400||a.wght===r.axisDefaults.wght||o?.weight!==`normal`||o.style!==`normal`||(r.axisDefaults.ital??0)!==0||(r.axisDefaults.slnt??0)!==0||r.axisDefaults.wght==null||r.instances.filter(e=>Object.keys(e.coordinates).length===1&&e.coordinates.wght===a.wght).length!==1||!X(r,n)?e:[{...i,resolvedFontFileUri:n}]}async function Z(e,t){let n=/* @__PURE__ */ new Map;for(let r of e.block.findByType(`//ly.img.ubq/text`)){if(!q(e,r))continue;let i=e.block.getTextRuns(r);if(i.length===1&&i[0].resolvedFontFileUri&&!i[0].resolvedFontFileUri.includes(`#`))try{let a=e.block.getString(r,`text/fontFileUri`);if(!a.includes(`#`)||a.split(`#`)[0]!==i[0].resolvedFontFileUri)continue;let o=await t(a);we(i,e.block.getString(r,`text/text`),a,o)!==i&&o&&n.set(r,{uri:a,names:o})}catch{}}if(n.size===0)return e;let r=new Proxy(e.block,{get(e,t){if(t===`getTextRuns`)return(...t)=>{let r=e.getTextRuns(...t),i=n.get(t[0]);if(!i||t.length!==1)return r;try{return e.getString(t[0],`text/fontFileUri`)===i.uri?we(r,e.getString(t[0],`text/text`),i.uri,i.names):r}catch{return r}};let r=Reflect.get(e,t,e);return typeof r==`function`?r.bind(e):r}});return new Proxy(e,{get(e,t){if(t===`block`)return r;let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}})}let Te=null;async function Ee(){try{let e;if(typeof process==`object`&&process.versions?.node){let{createRequire:t}=await import(`module`),{default:n}=await import(`fs`),r=t(require("url").pathToFileURL(__filename).href);e=n.readFileSync(r.resolve(`harfbuzzjs/dist/harfbuzz-subset.wasm`))}else{let{default:t}=await import(`harfbuzzjs/dist/harfbuzz-subset.wasm`);e=t}let{instance:t}=await WebAssembly.instantiate(new Uint8Array(e),{}),n=t.exports;return n._initialize?.(),n}catch{return null}}function De(e){return(e.charCodeAt(0)&255)<<24|(e.charCodeAt(1)&255)<<16|(e.charCodeAt(2)&255)<<8|e.charCodeAt(3)&255}function Oe(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(4);for(let n=0;n<t;n++){let t=12+n*16;if(t+4>e.length)return!1;if(String.fromCharCode(...e.subarray(t,t+4))===`fvar`)return!0}return!1}async function ke(e,t){Te??=Ee();let n=await Te;if(!n)return null;let r=()=>new Uint8Array(n.memory.buffer),i=n.malloc(e.length);r().set(e,i);let a=n.hb_blob_create(i,e.length,2,0,0),o=n.hb_face_create(a,0),s=n.hb_subset_input_create_or_fail();if(s===0)return n.hb_face_destroy(o),n.hb_blob_destroy(a),n.free(i),null;try{n.hb_subset_input_keep_everything(s),n.hb_subset_input_pin_all_axes_to_default(s,o);for(let[e,r]of Object.entries(t))n.hb_subset_input_pin_axis_location(s,o,De(e),r);let e=n.hb_subset_or_fail(o,s);if(e===0)return null;let i=n.hb_face_reference_blob(e),a=n.malloc(4),c=n.hb_blob_get_data(i,a),l=new DataView(n.memory.buffer).getUint32(a,!0),u=r().slice(c,c+l);return n.free(a),n.hb_blob_destroy(i),n.hb_face_destroy(e),u}finally{n.hb_subset_input_destroy(s),n.hb_face_destroy(o),n.hb_blob_destroy(a),n.free(i)}}const Ae=/* @__PURE__ */ new Set([1,2,4,6,16,17]);function je(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(4),r=[];for(let i=0;i<n;i++){let n=12+i*16,a=String.fromCharCode(...e.subarray(n,n+4)),o=t.getUint32(n+8),s=t.getUint32(n+12);r.push({tag:a,data:e.subarray(o,o+s)})}return r}function Me(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(2),r=t.getUint16(4),i=[];for(let a=0;a<n;a++){let n=6+a*12,o=t.getUint16(n+6);if(Ae.has(o))continue;let s=t.getUint16(n+8),c=t.getUint16(n+10);i.push({platform:t.getUint16(n),encoding:t.getUint16(n+2),language:t.getUint16(n+4),nameID:o,value:e.subarray(r+c,r+c+s)})}return i}function Ne(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r>>8,t[n*2+1]=r&255}return t}function Pe(e,t){let n=[...Me(e),...[[1,t.family],[2,t.subfamily],[4,t.fullName],[6,t.postScriptName],[16,t.family],[17,t.subfamily]].map(([e,t])=>({platform:3,encoding:1,language:1033,nameID:e,value:Ne(t)}))].sort((e,t)=>e.platform-t.platform||e.encoding-t.encoding||e.language-t.language||e.nameID-t.nameID),r=n.reduce((e,t)=>e+t.value.length,0),i=new Uint8Array(6+n.length*12+r),a=new DataView(i.buffer);a.setUint16(0,0),a.setUint16(2,n.length),a.setUint16(4,6+n.length*12);let o=0;return n.forEach((e,t)=>{let r=6+t*12;a.setUint16(r,e.platform),a.setUint16(r+2,e.encoding),a.setUint16(r+4,e.language),a.setUint16(r+6,e.nameID),a.setUint16(r+8,e.value.length),a.setUint16(r+10,o),i.set(e.value,6+n.length*12+o),o+=e.value.length}),i}function Fe(e){let t=0;for(let n=0;n+3<e.length;n+=4)t=t+(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0;let n=e.length%4;if(n){let r=0;for(let t=0;t<4;t++)r=(r<<8|(t<n?e[e.length-n+t]:0))>>>0;t=t+r>>>0}return t}function Ie(e,t){return Re(e,je(e).map(e=>e.tag===`name`?{tag:e.tag,data:Pe(e.data,t)}:e))}function Le(e){let t=je(e),n=e=>t.find(t=>t.tag===e).data,r=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),i=r(n(`CBLC`)),a=n(`CBDT`),o=r(a),s=r(n(`head`)).getUint16(18),c=r(n(`maxp`)).getUint16(4),l=i.getUint32(8),u=i.getUint8(52),d=e=>Number((e*s/u).toPrecision(15)),f=[],p=new TextEncoder;for(let e=0;e<i.getUint32(16);e++){let t=l+e*8,n=i.getUint16(t),r=i.getUint16(t+2),s=l+i.getUint32(t+4),c=i.getUint32(s+4);for(let e=n;e<=r;e++){let t=c+i.getUint32(s+8+(e-n)*4),r=o.getUint8(t),l=o.getUint8(t+1),u=d(o.getInt8(t+2)),m=d(-o.getInt8(t+3)),h=a.subarray(t+9,t+9+o.getUint32(t+5));f.push({glyph:e,bytes:p.encode(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><g id="glyph${e}"><image x="${u}" y="${m}" width="${d(l)}" height="${d(r)}" xlink:href="data:image/png;base64,${K(h)}"/></g></svg>`)})}}let m=2+f.length*12,h=new Uint8Array(10+m+f.reduce((e,t)=>e+t.bytes.length,0)),g=r(h);g.setUint32(2,10),g.setUint16(10,f.length);let _=m;return f.forEach((e,t)=>{let n=12+t*12;g.setUint16(n,e.glyph),g.setUint16(n+2,e.glyph),g.setUint32(n+4,_),g.setUint32(n+8,e.bytes.length),h.set(e.bytes,10+_),_+=e.bytes.length}),Re(e,[...t.filter(e=>e.tag!==`CBDT`&&e.tag!==`CBLC`),{tag:`SVG `,data:h},{tag:`glyf`,data:/* @__PURE__ */ new Uint8Array},{tag:`loca`,data:new Uint8Array((c+1)*2)}])}function Re(e,t){t.sort((e,t)=>e.tag<t.tag?-1:+(e.tag>t.tag));let n=12+t.length*16,r=t.reduce((e,t)=>e+Math.ceil(t.data.length/4)*4,n),i=new Uint8Array(r),a=new DataView(i.buffer);i.set(e.subarray(0,4),0),a.setUint16(4,t.length);let o=Math.floor(Math.log2(t.length));a.setUint16(6,2**o*16),a.setUint16(8,o),a.setUint16(10,t.length*16-2**o*16);let s=n;t.forEach((e,t)=>{let n=12+t*16;for(let t=0;t<4;t++)i[n+t]=e.tag.charCodeAt(t);a.setUint32(n+4,Fe(e.data)),a.setUint32(n+8,s),a.setUint32(n+12,e.data.length),i.set(e.data,s),s+=Math.ceil(e.data.length/4)*4});let c=t.findIndex(e=>e.tag===`head`);if(c>=0){let e=12+c*16,t=a.getUint32(e+8);a.setUint32(t+8,0),a.setUint32(e+4,Fe(i.subarray(t,t+a.getUint32(e+12)))),a.setUint32(t+8,2981146554-Fe(i)>>>0)}return i}function ze(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,`0`)}function Be(e,t,n){return`${(t?`${t.family}-${t.subfamily}`.replace(/[^\w-]+/g,``):`font`)||`font`}-${ze(e)}.${n}`}async function Q(e){let t=String.fromCharCode(...e.subarray(0,4));if(t===`wOF2`){let{decompress:t}=await import(`wawoff2`);return Q(new Uint8Array(await t(e)))}return t===`OTTO`?{bytes:e,ext:`otf`}:t===`true`||t===`ttcf`||e[0]===0&&e[1]===1&&e[2]===0&&e[3]===0?{bytes:e,ext:`ttf`}:Ve(e)||null}function Ve(e){let t=Math.min(e.length-12,4096);for(let n=4;n<t;n+=4){let t=e[n]===0&&e[n+1]===1&&e[n+2]===0&&e[n+3]===0,r=e[n]===79&&e[n+1]===84&&e[n+2]===84&&e[n+3]===79;if(!t&&!r)continue;let i=e.subarray(n);if(J(i))return{bytes:i,ext:r?`otf`:`ttf`}}return null}async function He(e){let{fonts:t,skipped:n}=await Ge(e);return{fonts:t,skipped:n}}function Ue(e){let t=/* @__PURE__ */ new Set;for(let n of e.block.findByType(`//ly.img.ubq/text`))if(q(e,n))for(let r of e.block.getTextRuns(n))r.resolvedFontFileUri&&t.add(r.resolvedFontFileUri);return t}async function We(e,t){let n=Ue(e);if(n.size<2)return!1;let r=/* @__PURE__ */ new Map;for(let e of n){let n=await t(e);if(!n)continue;let i=X(n,e)??n.subfamily,a=`${n.family}\u0000${i}`,o=e.split(`#`)[0],s=r.get(a);if(s&&s!==o)return!0;r.set(a,o)}return!1}async function Ge(e){e=await Z(e,Se(async t=>{let n=await $(e,t);return n?(await Q(n))?.bytes??null:null}));let t=Ue(e),n=[],r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[];for(let o of t){let t=o.split(`#`)[0];if(!r.has(t)){let n=await $(e,t),i=n?await Q(n):null;r.set(t,i&&{...i,bytes:await Ke(i.bytes)})}let s=r.get(t);if(i.set(o,s?J(s.bytes):null),!s){n.push(o);continue}let c=await qe(s.bytes,o);if(!c){n.push(o);continue}let l=a.find(e=>e.bytes.length===c.length&&e.bytes.every((e,t)=>e===c[t]));l?l.uris.push(o):a.push({bytes:c,face:J(c),ext:s.ext,uris:[o]})}let o=e=>`${e.family}\u0000${e.subfamily}`,s=new Set(a.flatMap(e=>e.face?[o(e.face)]:[])),c=new Set(a.flatMap(e=>e.face?[e.face.postScriptName]:[])),l=/* @__PURE__ */ new Map;for(let e of a)e.face&&l.set(o(e.face),(l.get(o(e.face))??0)+1);let u=[],d=/* @__PURE__ */ new Set,f=0;for(let e of a){if(e.face&&(l.get(o(e.face))??0)>1){f++;let t=ze(e.bytes),n=t,r=1;for(;s.has(`${e.face.family} [${n}]\u0000${e.face.subfamily}`)||c.has(`IDML-${n}`);)n=`${t}-${++r}`;let i=`${e.face.family} [${n}]`;s.add(`${i}\u0000${e.face.subfamily}`),c.add(`IDML-${n}`),e.bytes=Ie(e.bytes,{family:i,subfamily:e.face.subfamily,fullName:`${i} ${e.face.subfamily}`,postScriptName:`IDML-${n}`}),e.face=J(e.bytes)}for(let t of e.uris){let n=i.get(t);i.set(t,e.face&&n?{...e.face,instances:n.instances,axisDefaults:n.axisDefaults}:e.face)}let t=Be(e.bytes,e.face,e.ext),n=t,r=1;for(;d.has(n);)n=t.replace(/\.[^.]+$/,`-${++r}.${e.ext}`);d.add(n),u.push({filename:n,bytes:e.bytes})}return{fonts:u,skipped:n,resolveNames:async e=>i.get(e)??null,aliasedFonts:f}}async function Ke(e){let t=globalThis.crypto?.subtle;if(e.length!==9867108||!t)return e;try{if(Array.from(new Uint8Array(await t.digest(`SHA-256`,new Uint8Array(e))),e=>e.toString(16).padStart(2,`0`)).join(``)===`bf2a8506b80614ba190a34c7b037af1269a7d614fe9f3b613cc15cdeec6f814b`)return Le(e)}catch{}return e}async function qe(e,t){let n=J(e);if(!n)return e;let r=Y(t);if(Object.keys(r).length>0&&Oe(e)){let i=X(n,t),a=i?await ke(e,r):null;return a&&i?Ie(a,{family:n.family,subfamily:i,fullName:`${n.family} ${i}`,postScriptName:`${n.family.replace(/\s+/g,``)}-${i.replace(/\s+/g,``)}`}):null}return Ie(e,{family:n.family,subfamily:n.subfamily,fullName:`${n.family} ${n.subfamily}`,postScriptName:n.postScriptName||`${n.family.replace(/\s+/g,``)}-${n.subfamily.replace(/\s+/g,``)}`})}async function $(e,t){let n=await u(e,t);if(n)return n;if(t.startsWith(`bundle://`))try{let{createRequire:e}=await import(`module`),{default:n}=await import(`path`),{default:r}=await import(`fs`),i=e(require("url").pathToFileURL(__filename).href),a=n.dirname(i.resolve(`@cesdk/node`));for(;!r.existsSync(n.join(a,`package.json`));)a=n.dirname(a);let o=t.replace(/^bundle:\/\/[^/]*\//,``),s=n.join(a,`assets`,o);if(r.existsSync(s))return new Uint8Array(r.readFileSync(s))}catch{return null}return null}function Je(e){try{let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(0);if(![65536,1330926671,1953658213].includes(n))return null;let r=-1,i=0;for(let e=0;e<t.getUint16(4);e++){let n=12+e*16;t.getUint32(n)===1668112752&&(r=t.getUint32(n+8),i=t.getUint32(n+12))}if(r<0||i<4||r+i>e.length)return null;let a=r+i,o=[],s=t.getUint16(r+2);if(r+4+s*8>a)return null;for(let e=0;e<s;e++){let n=r+4+e*8,i=t.getUint16(n),s=t.getUint16(n+2);if(i!==0&&(i!==3||s!==1&&s!==10))continue;let c=r+t.getUint32(n+4);if(c<r+4||c+2>a)return null;let l=t.getUint16(c);if(l===4){let e=t.getUint16(c+2),n=t.getUint16(c+6)/2;if(!Number.isInteger(n)||n<1||e<16||c+e>a)return null;let r=c+14,i=r+n*2+2,s=i+n*2,l=s+n*2;if(l+n*2>c+e)return null;let u=-1;for(let a=0;a<n;a++){let n=t.getUint16(i+a*2),o=t.getUint16(r+a*2),s=t.getUint16(l+a*2);if(n>o||n<=u||s&&l+a*2+s+(o-n)*2+2>c+e)return null;u=o}o.push(e=>{if(e>65535)return 0;for(let a=0;a<n;a++){let n=t.getUint16(i+a*2),o=t.getUint16(r+a*2);if(e<n)return 0;if(e>o)continue;let c=t.getInt16(s+a*2),u=t.getUint16(l+a*2);if(!u)return e+c&65535;let d=t.getUint16(l+a*2+u+(e-n)*2);return d?d+c&65535:0}return 0})}else if(l===12||l===13){let e=t.getUint32(c+4),n=t.getUint32(c+12);if(e<16||c+e>a||16+n*12>e)return null;let r=-1;for(let e=0;e<n;e++){let n=c+16+e*12,i=t.getUint32(n),a=t.getUint32(n+4);if(i>a||a>1114111||i<=r)return null;r=a}o.push(e=>{let r=0,i=n-1;for(;r<=i;){let n=r+i>>>1,a=c+16+n*12,o=t.getUint32(a),s=t.getUint32(a+4);if(e<o)i=n-1;else if(e>s)r=n+1;else return t.getUint32(a+8)+(l===12?e-o:0)}return 0})}}return o.length?o:null}catch{return null}}function Ye(e,t){let n=Je(e);if(!n)return null;let r=e=>[...e].every(e=>n.some(t=>t(e.codePointAt(0))!==0));for(let e of t.normalize(`NFC`))if(/^[\p{Letter}\p{Number}\p{Punctuation}\p{Symbol}]$/u.test(e)&&!/^\p{Default_Ignorable_Code_Point}$/u.test(e)&&![e,e.normalize(`NFD`)].some(r))return!0;return!1}function Xe(e,t,n){if(e.block.supportsShape(t)){let r=e.block.getShape(t);if(r!=null&&e.block.isValid(r)&&e.block.getType(r)===`//ly.img.ubq/shape/line`){let r=e.block.getStrokePosition(t);e.block.getStrokePosition(n)!==r&&e.block.setStrokePosition(n,r)}}let r=e.block.getChildren(t),i=e.block.getChildren(n);if(r.length!==i.length)throw Error(`Render copy hierarchy changed`);r.forEach((t,n)=>Xe(e,t,i[n]))}async function Ze(e,t){let n=e.block.duplicate(t,!1),r=!1;try{let i=await e.block.saveToString([n],[`buffer`,`bundle`,`http`,`https`,`file`,`data`,`blob`,`archive`,`workspace`,`opfs`],async e=>e);if(!i.startsWith(`UBQ1`))throw Error(`Unknown block encoding`);let a=atob(i.slice(4)),o=Uint8Array.from(a,e=>e.charCodeAt(0)),s=JSON.parse(new TextDecoder().decode(o)),c=s.designElements?.designElements;if(s.format!==`//ly.img.cesdk/elements`||!Array.isArray(c)||c.some(e=>!e||typeof e!=`object`))throw Error(`Unknown block structure`);if(!c.some(e=>e.has_synced_properties===!0))return Xe(e,t,n),r=!0,n;for(let e of c)e.has_synced_properties===!0&&(e.synced_properties_incoming=[],e.synced_properties_outgoing=[]),e.synced_properties_sync_position_interaction=!1,e.synced_properties_sync_rotation_interaction=!1,e.synced_properties_sync_size_interaction=!1;let l=await e.block.loadFromString(`UBQ1`+K(new TextEncoder().encode(JSON.stringify(s))));try{if(l.length!==1)throw Error(`Expected one render copy`);return Xe(e,t,l[0]),l[0]}catch(t){for(let t of l)e.block.isValid(t)&&e.block.destroy(t);throw t}}finally{!r&&e.block.isValid(n)&&e.block.destroy(n)}}const Qe=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,$e=/[\u0900-\u109F\u1780-\u17FF]/;function et(e){return Qe.test(e)||[...e].some(e=>y(e)&&/[\p{Letter}\p{Mark}]/u.test(e))}function tt(e){return et(e)||$e.test(e)}const nt={TEXT_FONT_FALLBACK_RASTERIZED:{type:`warning`,message:`Characters unavailable in the declared font require native fallback omitted by the public text runs; the complete native text paint was preserved as an embedded image and is no longer editable.`},TEXT_FONT_FALLBACK_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering native font fallback failed; editable text retains its declared font and missing characters may be substituted or unavailable in InDesign.`},FONT_NAMES_ALIASED:{type:`warning`,message:`Distinct fonts sharing a family/style were assigned unique names. Use exportIdmlPackage or write collectDocumentFonts output into the adjacent Document fonts folder so those names resolve.`},SHADOW_SIZE_RASTERIZED:{type:`warning`,message:`Shadow blur outside IDML's supported 0..144 point range and all object paint were preserved together as an embedded image; the object is no longer editable.`},SHADOW_SIZE_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering a shadow outside IDML's supported 0..144 point blur range failed; the unsupported shadow was omitted.`},SHADOW_OFFSET_RASTERIZED:{type:`warning`,message:`Shadow offsets outside IDML's supported -1000..1000 point range and all object paint were preserved together as an embedded image; the object is no longer editable.`},SHADOW_OFFSET_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering a shadow outside IDML's supported -1000..1000 point offset range failed; the unsupported shadow was omitted.`},SHADOW_CLIP_RASTERIZED:{type:`warning`,message:`Shape shadow clipping and all object paint were preserved together as an embedded image; the graphic is no longer editable.`},SHADOW_CLIP_RASTERIZATION_FAILED:{type:`warning`,message:`Clipped shape shadow rendering failed; the editable shadow was exported without its shape/stroke clipping.`},TEXT_CASE_RASTERIZED:{type:`warning`,message:`Native case conversion could not be reproduced by editable text; the rendered case was preserved as an embedded image and text is no longer editable.`},TEXT_CASE_RASTERIZATION_FAILED:{type:`warning`,message:`Native case conversion could not be verified or rendered; editable text uses normalized case which may differ from the native glyphs.`},TEXT_PARAGRAPH_SPACING_RASTERIZED:{type:`warning`,message:`Paragraph spacing with mixed font metrics was preserved from its terminal visual line as an embedded image; the text is no longer editable.`},TEXT_LEADING_RASTERIZED:{type:`warning`,message:`Combined ascender and descender metrics from different fonts cannot be represented by character leading; native line placement was preserved as an embedded image and the text is no longer editable.`},TEXT_LEADING_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering combined font leading failed; editable text uses individual character leading and line placement may differ.`},TEXT_TABS_RASTERIZED:{type:`warning`,message:`Native tab placement was preserved as an embedded image because editable paragraph tab stops cannot retain the native tab rule; the text is no longer editable.`},TEXT_TABS_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering native tabs failed; editable text retains tab characters but their placement may differ.`},TEXT_PARAGRAPH_SPACING_RASTERIZATION_FAILED:{type:`warning`,message:`Paragraph spacing with mixed font metrics could not be rendered; editable paragraph gaps were approximated from each paragraph’s first font.`},TEXT_RANGE_BACKGROUND_RASTERIZED:{type:`warning`,message:`Text range backgrounds and the text's other paint were preserved as an embedded image; the text is no longer editable.`},TEXT_RANGE_BACKGROUND_RASTERIZATION_FAILED:{type:`warning`,message:`Text range backgrounds could not be rendered; the editable text was exported without its range highlights.`},TEXT_DECORATION_RASTERIZED:{type:`warning`,message:`Overline and the text's other paint were preserved as an embedded image; the text is no longer editable.`},TEXT_DECORATION_RASTERIZATION_FAILED:{type:`warning`,message:`Overline could not be rendered; the editable text was exported without its overline.`},XML_CHARACTERS_REPLACED:{type:`warning`,message:`Characters forbidden by XML 1.0 were replaced with U+FFFD in the exported field; the original name or text cannot be encoded in IDML.`},XML_ID_REPLACED:{type:`warning`,message:`An imported object ID contained characters forbidden by XML 1.0; a new unique ID was allocated.`},TEXT_XML_RASTERIZED:{type:`warning`,message:`Text or required font names containing characters forbidden by XML 1.0 were preserved as an embedded image; the text is no longer editable.`},TEXT_XML_RASTERIZATION_FAILED:{type:`warning`,message:`Text with characters or required font names forbidden by XML 1.0 could not be rendered; those characters were replaced in the editable text or font names.`},TEXT_STROKE_RASTERIZED:{type:`warning`,message:`Glyph stroke dashes or inside alignment were preserved as an embedded image; the text is no longer editable.`},TEXT_STROKE_RASTERIZATION_FAILED:{type:`warning`,message:`The glyph stroke could not be rendered; its dashes or inside alignment were approximated by a solid centered stroke.`},UNSUPPORTED_FILL_RASTERIZED:{type:`warning`,message:`A fill without a native IDML representation was preserved as an embedded image; its content is no longer editable.`},UNSUPPORTED_FILL_RASTERIZATION_FAILED:{type:`warning`,message:`A fill without a native IDML representation could not be rendered; it was exported without fill paint.`},PAGE_APPEARANCE_RASTERIZED:{type:`warning`,message:`Page background effects or blur were preserved as an embedded image; foreground objects remain separately editable.`},PAGE_APPEARANCE_RASTERIZATION_FAILED:{type:`warning`,message:`Page background effects or blur could not be rendered; the background was exported without those effects.`},PAGE_STROKE_RASTERIZED:{type:`warning`,message:`The page contour and background paint were preserved as an embedded image; foreground objects remain separately editable.`},PAGE_STROKE_RASTERIZATION_FAILED:{type:`warning`,message:`The page contour could not be rendered; its paint was approximated by native rectangle attributes.`},PAGE_VIDEO_RASTERIZED:{type:`warning`,message:`The video page background was preserved as a still poster image; foreground objects remain separately editable.`},PAGE_VIDEO_RASTERIZATION_FAILED:{type:`warning`,message:`The video page background could not be rendered; it was exported without its poster.`},STROKE_RASTERIZED:{type:`warning`,message:`Graphic stroke dash lengths, phase and endpoint caps were preserved as an embedded image; the graphic is no longer editable.`},STROKE_RASTERIZATION_FAILED:{type:`warning`,message:`The graphic stroke could not be rendered; its dash lengths, phase or endpoint caps were approximated by native stroke attributes.`},FILL_RULE_RASTERIZED:{type:`warning`,message:`NonZero path fill coverage was preserved as an embedded image; the compound, curved or self-intersecting path is no longer editable.`},FILL_RULE_RASTERIZATION_FAILED:{type:`warning`,message:`NonZero path fill could not be rendered; winding-sensitive areas may differ in the editable path.`},SHAPE_CORNERS_RASTERIZED:{type:`warning`,message:`Nonrectangular corner rounding was preserved as an embedded image; the shape is no longer editable.`},SHAPE_CORNERS_RASTERIZATION_FAILED:{type:`warning`,message:`The rounded shape could not be rendered; its polygon, star or vector-path corners were exported without rounding.`},TEXT_PATH_RASTERIZED:{type:`warning`,message:`Text on a path was preserved as an embedded image, including its baseline offset and underside placement; the text is no longer editable.`},TEXT_PATH_RASTERIZATION_FAILED:{type:`warning`,message:`Text on a path could not be rendered; editable text was exported with a straight baseline.`},SHADOW_RASTERIZED:{type:`warning`,message:`Different horizontal and vertical shadow blur radii were preserved as an embedded image; the object is no longer editable.`},SHADOW_RASTERIZATION_FAILED:{type:`warning`,message:`The nonuniform shadow could not be rendered; its vertical blur radius was approximated by the horizontal radius.`},TEXT_SCRIPT_RASTERIZED:{type:`warning`,message:`Superscript or subscript size or position differs from an earlier text block. IDML stores one value per document, so this block was preserved as an embedded image; the text is no longer editable.`},TEXT_SCRIPT_RASTERIZATION_FAILED:{type:`warning`,message:`Superscript or subscript with a different size or position could not be rendered; the editable text uses the document script size and position.`},UNSUPPORTED_BLOCK_TYPE:{type:`warning`,message:`Block type is not supported by the IDML exporter and was skipped.`},LINE_SHAPE_RASTERIZED:{type:`warning`,message:`Native line paint was preserved as an embedded image instead of a rectangle approximation; the line is no longer editable.`},LINE_SHAPE_RASTERIZATION_FAILED:{type:`warning`,message:`Rendering the native line failed; its rectangle approximation may differ in InDesign.`},UNSUPPORTED_SHAPE_TYPE:{type:`warning`,message:`Shape type is not representable in IDML; exported as a plain rectangle.`},UNSUPPORTED_PATH_DATA:{type:`warning`,message:`Vector path could not be parsed as SVG path data; exported as a plain rectangle.`},IMAGE_BYTES_UNAVAILABLE:{type:`warning`,message:`Image bytes could not be read; the frame was exported without image content.`},FILL_ALPHA_FOLDED:{type:`info`,message:`IDML colors carry no alpha; the fill's alpha was written as fill-target opacity.`},GRADIENT_ALPHA_AS_FEATHER:{type:`info`,message:`Varying gradient stop alpha was written as an InDesign Gradient Feather effect sharing the fill geometry.`},DEGENERATE_GRADIENT_AS_SOLID:{type:`info`,message:`A gradient with zero span or radius was written as an editable solid in its terminal stop color, preserving the rendered paint.`},BLEND_MODE_DROPPED:{type:`warning`,message:`IDML cannot represent block blend modes; the blend mode was dropped.`},VIDEO_FILL_DROPPED:{type:`warning`,message:`Video fills have no IDML form and no poster frame could be rendered; the frame was exported empty.`},EFFECTS_BAKED:{type:`info`,message:`Block effects/blur have no IDML representation; the rendered appearance was embedded as an image.`},EFFECTS_BAKE_FAILED:{type:`warning`,message:`Rendering enabled block effects/blur failed; editable source paint was exported without those effects/blur.`},CROP_FLIP_ROTATION_APPROX:{type:`warning`,message:`Legacy crop-transform approximation diagnostic; current exports preserve crop rotation and frame reflection separately.`},STROKE_ALPHA_AS_TRANSPARENCY:{type:`info`,message:`IDML stroke colors carry no alpha; the stroke's alpha was written as an InDesign stroke-target opacity effect.`},TEXT_FILL_ALPHA_FOLDED:{type:`info`,message:`IDML swatches carry no alpha; the text fill alpha was folded into the frame opacity.`},TEXT_PAINT_RASTERIZED:{type:`warning`,message:`Independent text paint opacity was preserved in an embedded image; the text is no longer editable.`},TEXT_BACKGROUND_BLEND_RASTERIZED:{type:`warning`,message:`Text and its background were preserved together as an embedded image so their blend mode is applied once; the text is no longer editable.`},TEXT_BACKGROUND_BLEND_RASTERIZATION_FAILED:{type:`warning`,message:`Text and background blend rasterization failed; separate editable paints may blend differently from the source.`},TEXT_PAINT_RASTERIZATION_FAILED:{type:`warning`,message:`Text paint rasterization failed; independent glyph fill, stroke or background opacity may be approximated.`},TEXT_FILL_ALPHA_DROPPED:{type:`warning`,message:`Runs with different fill alphas cannot share one frame opacity, so the alpha was dropped and the text renders solid.`},TEXT_STROKE_ALPHA_FOLDED:{type:`info`,message:`IDML character stroke colors carry no alpha; the text stroke's alpha was folded into the frame opacity.`},TEXT_STROKE_ALPHA_DROPPED:{type:`warning`,message:`IDML character stroke colors carry no alpha and the text also paints a fill; the stroke alpha was dropped.`},TEXT_WITHOUT_FONT:{type:`warning`,message:`Text block has no resolvable font; leading was exported as auto.`},UNDERLINE_METRICS_UNAVAILABLE:{type:`warning`,message:`Underline font metrics were unavailable; InDesign will use its default weight and position.`},TEXT_CASE_NORMALIZED:{type:`info`,message:`Lowercase or titlecase styling was materialized as editable text; the original case-transform style is not retained.`},FONT_NAMES_UNREADABLE:{type:`warning`,message:`Font file could not be read; AppliedFont falls back to the typeface's declared name, which InDesign may not match.`},TEXT_BACKGROUND_AS_RECT:{type:`info`,message:`IDML text frames have no background fill with padding; the text background was exported as a rounded rectangle behind the frame.`},FONT_INSTANCE_UNMATCHED:{type:`warning`,message:`No fvar named instance matches the axis values the font URI pins; FontStyle falls back to the run weight, which InDesign may render as the default cut.`}};var rt=class{messages=[];emit(e,t){let{type:n,message:r}=nt[e];this.messages.push({type:n,code:e,message:r,meta:t})}getMessages(){return[...this.messages]}};const it={fillEnabled:!0,stroke:null};function at(e,t){let n=0;return e.block.getTextRuns(t).map(r=>{let i=n;n+=r.text.length;try{let a=e.block.getTextDecorations(t,i,n)[0];return a?{...r,textDecoration:a}:r}catch{return r}})}function ot(e){let t;for(let n of e){let e=JSON.stringify([n.fontSize,n.resolvedFontFileUri]),r=n.text.split(/(\r\n|\r|\n)/);for(let n=0;n<r.length;n+=2){let i=r[n+1];if(r[n].length>0||i!==void 0){if(t!==void 0&&t!==e)return!0;t=e}i!==void 0&&(t=void 0)}}return!1}async function st(e,t){let n=e.editor.getSettingBool(`features/fontLineGapEnabled`),r=/* @__PURE__ */ new Map,i=0,a=0,o=0,s=()=>i+a>o+1e-6;for(let c of e.block.getTextRuns(t)){if(!c.resolvedFontFileUri)continue;let t=r.get(c.resolvedFontFileUri);if(!t)try{t=await e.editor.getFontMetrics(c.resolvedFontFileUri),r.set(c.resolvedFontFileUri,t)}catch{continue}let l=n?(t.lineGap??0)/2:0,u=c.fontSize*(t.ascender+l)/t.unitsPerEm,d=c.fontSize*(-t.descender+l)/t.unitsPerEm,f=c.text.split(/(\r\n|\r|\n)/);for(let e=0;e<f.length;e+=2){let t=f[e+1];if((f[e].length>0||t!==void 0)&&(i=Math.max(i,u),a=Math.max(a,d),o=Math.max(o,u+d)),t!==void 0){if(s())return!0;i=a=o=0}}}return s()}const ct={Left:`LeftAlign`,Center:`CenterAlign`,Right:`RightAlign`};async function lt(e,t,n,r,i,a,o=it,s){let c=e.block,l=[];try{l=at(e,t)}catch{l=[]}let u=L(`Story`),f=u.element(`Story`).attr(`Self`,n),p=c.getEnum(t,`text/horizontalAlignment`),h=e.block.getBool(t,`text/useKerning`),g=0;try{g=c.getFloat(t,`text/letterSpacing`)}catch{}let _=(n,r)=>{let i=f.element(`ParagraphStyleRange`).attr(`AppliedParagraphStyle`,`ParagraphStyle/$ID/[No paragraph style]`).attr(`Hyphenation`,`false`),a=y(r);(tt(r)||a)&&(i.attr(`Composer`,`HL Composer Optyca`),i.attr(`ParagraphDirection`,a?`RightToLeftDirection`:`LeftToRightDirection`));let o=p;try{o=e.block.getTextHorizontalAlignment(t,n)??p}catch{}let s=o===`Justify`?a?`RightJustified`:`LeftJustified`:o===`Auto`?a?`RightAlign`:`LeftAlign`:ct[o];s&&i.attr(`Justification`,s),o===`Justify`&&i.attr(`SingleWordJustification`,a?`RightAlign`:`LeftAlign`);try{let r=e.block,a=r.getTextListStyle(t,n);if(a===`Unordered`||a===`Ordered`){i.attr(`BulletsAndNumberingListType`,a===`Unordered`?`BulletList`:`NumberedList`);let e=r.getTextListLevel(t,n);i.attr(`NumberingLevel`,String(e+1))}}catch{}return i};if(l.length===0){let e=c.getString(t,`text/text`),n=_(0,e).element(`CharacterStyleRange`).attr(`AppliedCharacterStyle`,`CharacterStyle/$ID/[No character style]`);return et(e)&&n.attr(`DigitsType`,`ArabicDigits`),dt(n,e),I(u,[],e=>i.emit(`XML_CHARACTERS_REPLACED`,{...e}))}let v=e.editor,x=/* @__PURE__ */ new Map,S=e=>{let t=x.get(e);return t||(t=v.getFontMetrics(e),x.set(e,t)),t},C=e.editor.getSettingBool(`features/fontLineGapEnabled`),w=e.block,T=async(e,n)=>{if(!n.resolvedFontFileUri)return i.emit(`TEXT_WITHOUT_FONT`,{block:t}),null;try{return ft(typeof w.getTextLineHeight==`function`?w.getTextLineHeight(t,e):c.getFloat(t,`text/lineHeight`),await S(n.resolvedFontFileUri),C)*n.fontSize}catch{return i.emit(`TEXT_WITHOUT_FONT`,{block:t}),null}},E=async e=>{if(!e.resolvedFontFileUri)return null;try{let n=c.getFloat(t,`text/paragraphSpacing`);if(n>0)return ft(n,await S(e.resolvedFontFileUri),C)*e.fontSize}catch{i.emit(`TEXT_WITHOUT_FONT`,{block:t})}return null},D=[[]],O=[0],k=0,A=m(e,t,l);for(let[e,n]of l.entries()){let r=n.textCase===`Lowercase`||n.textCase===`Titlecase`,a=r?A?.[e]??d(n.text,n.textCase):n.text;r&&i.emit(`TEXT_CASE_NORMALIZED`,{block:t,textCase:n.textCase});let o=a.split(/(\r\n|\r|\n)/);for(let e=0;e<o.length;e+=2){let t=o[e],r=o[e+1];D[D.length-1].push({run:n,text:t,breakAfter:r!==void 0}),r!==void 0&&(r.includes(`
|
|
3
|
+
`)&&k++,D.push([]),O.push(k))}}let j=/* @__PURE__ */ new Set;for(let e=0;e<D.length;e++){let n=D[e],c=n.filter(e=>e.text.length>0||e.breakAfter),l=c.length>0?c:n.slice(-1),u=l.map(e=>e.text).join(``),d=et(u),f=O[e],p=_(f,u),m=l.length>0?await E(l[0].run):null;m!=null&&p.attr(`SpaceAfter`,R(m));for(let e of l){let{run:n}=e,c=n.resolvedFontFileUri?await a(n.resolvedFontFileUri):null;!c&&n.resolvedFontFileUri&&n.typeface?.name&&!j.has(n.resolvedFontFileUri)&&(j.add(n.resolvedFontFileUri),i.emit(`FONT_NAMES_UNREADABLE`,{block:t,uri:n.resolvedFontFileUri,typeface:n.typeface.name}));let l=/[#&]wght=/.test(n.resolvedFontFileUri??``),u=c&&l?X(c,n.resolvedFontFileUri):null;c&&l&&!u&&!j.has(n.resolvedFontFileUri)&&(j.add(n.resolvedFontFileUri),i.emit(`FONT_INSTANCE_UNMATCHED`,{block:t,uri:n.resolvedFontFileUri}));let m=l?u??mt(n.fontWeight,n.fontStyle):c?c.subfamily:mt(n.fontWeight,n.fontStyle),_=o.fillEnabled&&B(n.color)>0,v=p.element(`CharacterStyleRange`).attr(`AppliedCharacterStyle`,`CharacterStyle/$ID/[No character style]`).attr(`FillColor`,_?r.register(n.color):`Swatch/None`).attr(`PointSize`,R(n.fontSize)).attr(`FontStyle`,m);(n.scriptStyle===`Superscript`||n.scriptStyle===`Subscript`)&&v.attr(`Position`,n.scriptStyle),yt(e.text)&&v.attr(`KerningMethod`,`$ID/None`),h||v.attr(`KerningValue`,`0`),d&&v.attr(`DigitsType`,`ArabicDigits`),_&&`tint`in n.color&&n.color.tint<1&&v.attr(`FillTint`,R(n.color.tint*100)),o.stroke&&(v.attr(`StrokeColor`,r.register(V(o.stroke.color))).attr(`StrokeWeight`,R(o.stroke.weightPt)).attr(`StrokeAlignment`,o.stroke.position===`Outer`?`OutsideAlignment`:`CenterAlignment`).attr(`EndJoin`,`${o.stroke.cornerGeometry??`Miter`}EndJoin`),`tint`in o.stroke.color&&o.stroke.color.tint<1&&v.attr(`StrokeTint`,R(o.stroke.color.tint*100))),n.textCase===`Uppercase`&&v.attr(`Capitalization`,`AllCaps`);let y=g+(n.kerning??0);y!==0&&v.attr(`Tracking`,R(y*1e3));let x=n.textDecoration,C=x?.lines??[],w=C.includes(`Underline`),E=C.includes(`Strikethrough`);if(w){v.attr(`Underline`,`true`);try{let e=b(n.fontSize,await S(n.resolvedFontFileUri),x?.underlineThickness,x?.underlineOffset);if(!e)throw Error(`Underline metrics unavailable`);v.attr(`UnderlineWeight`,R(e.weight)),v.attr(`UnderlineOffset`,R(e.offset))}catch{i.emit(`UNDERLINE_METRICS_UNAVAILABLE`,{block:t})}}E&&v.attr(`StrikeThru`,`true`);let D=v.element(`Properties`),O=c?.family??n.typeface?.name;O&&(s?.(O,m,c?.postScriptName??``),D.element(`AppliedFont`).attr(`type`,`string`).text(O));let k=ut(x?.style);if(k&&(w||E)&&(w&&D.element(`UnderlineType`).attr(`type`,`object`).text(k),E&&D.element(`StrikeThroughType`).attr(`type`,`object`).text(k)),w&&x?.underlineColor!=null){let e=x.underlineColor;`tint`in e&&e.tint!==1&&v.attr(`UnderlineTint`,R(e.tint*100)),D.element(`UnderlineColor`).attr(`type`,`object`).text(r.register(e))}let A=await T(f,n);A!=null&&D.element(`Leading`).attr(`type`,`unit`).text(R(A)),D.children.length===0&&v.children.pop(),e.text.length>0&&v.element(`Content`).text(e.text),e.breakAfter&&v.element(`Br`)}}return I(u,[],e=>i.emit(`XML_CHARACTERS_REPLACED`,{...e}))}function ut(e){switch(e){case`Dashed`:return`StrokeStyle/$ID/Dashed`;case`Dotted`:return`StrokeStyle/$ID/Canned Dotted`;case`Double`:return`StrokeStyle/$ID/ThinThin`;case`Wavy`:return`StrokeStyle/$ID/Wavy`;default:return null}}function dt(e,t){t.split(/\r\n|\r|\n/).forEach((t,n)=>{n>0&&e.element(`Br`),t.length>0&&e.element(`Content`).text(t)})}function ft(e,t,n){let{ascender:r,descender:i,unitsPerEm:a,lineGap:o=0}=t,s=e;if(n){let e=r-i,t=e+o;e!==0&&(s=s*t/e)}if(a!==0){let e=(r-i)/a;s*=e}return s}const pt={thin:`Thin`,extraLight:`ExtraLight`,light:`Light`,normal:`Regular`,medium:`Medium`,semiBold:`SemiBold`,bold:`Bold`,extraBold:`ExtraBold`,heavy:`Heavy`};function mt(e,t){let n=pt[e]??`Regular`,r=t===`italic`;return n===`Regular`&&r?`Italic`:r?`${n} Italic`:n}function ht(e,t){let n=e.block,r=0;try{r=n.getFloat(t,`text/letterSpacing`)}catch{}let i=[];try{i=n.getTextRuns(t)}catch{return 0}return i.reduce((e,t)=>Math.max(e,(r+(t.kerning??0))*t.fontSize),0)}function gt(e){switch(e){case`Center`:return`CenterPoint`;case`Bottom`:return`BottomCenterPoint`;default:return`TopCenterPoint`}}function _t(e,t){let n=e===`Center`?`Center`:e===`Bottom`?`Bottom`:`Top`,r=t===`Center`?`Center`:t===`Right`?`Right`:`Left`;return n===`Center`?r===`Center`?`CenterPoint`:`${r}CenterPoint`:`${n}${r}Point`}function vt(e){switch(e){case`Top`:return`TopAlign`;case`Center`:return`CenterAlign`;case`Bottom`:return`BottomAlign`;default:return null}}function yt(e){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}|[ -〿-]/u.test(e)}function bt(e){return Ot.export(e)}async function xt(e,t={}){return kt.exportPackage(e,t.name??`design`)}const St=`application/vnd.adobe.indesign-idml-package`;function Ct(e,t){return T(e,{type:`idml`,format:t,producer:`${E}@${D}`,block:e.scene.get()??-1})}const wt=(e,t,n)=>[e[0]+t,e[1]+n];function Tt(e){let t=R(e);return e>0&&t===`0`?String(e):t}const Et={Dashed:`StrokeStyle/$ID/Dashed`,DashedRound:`StrokeStyle/$ID/Dashed`,LongDashed:`StrokeStyle/$ID/Canned Dashed 3x2`,LongDashedRound:`StrokeStyle/$ID/Canned Dashed 3x2`,Dotted:`StrokeStyle/$ID/Canned Dotted`},Dt=/* @__PURE__ */ new Set([`Multiply`,`Screen`,`Overlay`,`SoftLight`,`HardLight`,`ColorDodge`,`ColorBurn`,`Darken`,`Lighten`,`Difference`,`Exclusion`,`Hue`,`Saturation`,`Color`,`Luminosity`]);var Ot=class{constructor(){}static export(e){return kt.export(e)}},kt=class e{engine;logger=new rt;colors=new te(e=>{try{let[t,n,r]=this.engine.editor.getSpotColorRGBA(e);return{r:t,g:n,b:r,a:1}}catch{return null}},e=>this.allocateUniqueId(e));files=/* @__PURE__ */ new Map;fontNames;fonts=/* @__PURE__ */ new Map;fontBytes=/* @__PURE__ */ new Map;storyIds=[];usedSelfIds=/* @__PURE__ */ new Set([`d`,`ubs`,`di2`,`XMLTag/Root`,`rcsg`,`rpsg`,`rosg`,`CharacterStyle/$ID/[No character style]`,`ParagraphStyle/$ID/[No paragraph style]`,`ObjectStyle/$ID/[None]`,`Swatch/None`]);pointsPerUnit;idCounter=0;currentPage=null;pageContentTransform=[1,0,0,1,0,0];scriptPreferences=/* @__PURE__ */ new Map;transaction;renderedTexts=/* @__PURE__ */ new Set;constructor(e,t){this.engine=e,this.transaction=t,this.pointsPerUnit=this.resolvePointsPerUnit(),this.fontNames=Se(async e=>{let t=await $(this.engine,e);return(t&&await Q(t))?.bytes??null})}static async inTransaction(t,n,r,i){let a=Ct(t,n),o;try{o=await r(new e(t,a))}catch(e){throw a.cancel(),e}return a.end(i(o).byteLength,0),o}static export(t){return e.inTransaction(t,St,async e=>{if(await e.prepareTextFontFallbacks(),e.engine=await Z(t,e.fontNames),await We(e.engine,e.fontNames)){let t=await Ge(e.engine);t.aliasedFonts>0&&(e.fontNames=t.resolveNames,e.logger.emit(`FONT_NAMES_ALIASED`,{fonts:t.aliasedFonts}))}return{idml:await e.run(),logger:e.logger}},e=>e.idml)}static exportPackage(t,n){return e.inTransaction(t,`application/zip`,async e=>{await e.prepareTextFontFallbacks(),e.engine=await Z(t,e.fontNames);let{fonts:r,skipped:i,resolveNames:a}=await Ge(e.engine);e.fontNames=a;let o=await e.run(),s=new c.default;s.file(`${n}/${n}.idml`,o);for(let e of r)s.file(`${n}/Document fonts/${e.filename}`,e.bytes);return{zip:await s.generateAsync({type:`uint8array`,compression:`DEFLATE`}),logger:e.logger,skippedFonts:i}},e=>e.zip)}async renderTextOnce(e){this.renderedTexts.has(e)||(await this.engine.block.export(e,this.transaction.exportOptions({mimeType:`image/png`})),this.renderedTexts.add(e))}async run(){let e=this.engine.scene.getPages(),t=[];for(let n of e){let e=await this.buildSpread(n);t.push(e)}let n=new c.default,r=(e,t)=>n.file(e,t,{createFolders:!1});n.file(`mimetype`,St,{compression:`STORE`,createFolders:!1}),r(`designmap.xml`,this.buildDesignMap(t)),r(`META-INF/container.xml`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
7
4
|
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
|
|
8
5
|
<rootfiles>
|
|
9
6
|
<rootfile full-path="designmap.xml" media-type="text/xml"/>
|
|
10
7
|
</rootfiles>
|
|
11
8
|
</container>
|
|
12
|
-
|
|
9
|
+
`),r(`Resources/Graphic.xml`,this.buildGraphicResources()),r(`Resources/Fonts.xml`,this.buildFontResources()),r(`Resources/Styles.xml`,this.buildStyleResources()),r(`Resources/Preferences.xml`,this.buildPreferences(e[0])),r(`XML/Tags.xml`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
13
10
|
<idPkg:Tags xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="15.0">
|
|
14
11
|
<XMLTag Self="XMLTag/Root" Name="Root">
|
|
15
12
|
<Properties>
|
|
@@ -17,15 +14,15 @@ ${r.serialize(e)}
|
|
|
17
14
|
</Properties>
|
|
18
15
|
</XMLTag>
|
|
19
16
|
</idPkg:Tags>
|
|
20
|
-
|
|
17
|
+
`),r(`XML/BackingStory.xml`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
21
18
|
<idPkg:BackingStory xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="15.0">
|
|
22
|
-
<XmlStory Self="
|
|
19
|
+
<XmlStory Self="ubs" UserText="true" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">
|
|
23
20
|
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
|
|
24
21
|
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
|
|
25
22
|
<XMLElement Self="di2" MarkupTag="XMLTag/Root" />
|
|
26
|
-
<Content
|
|
23
|
+
<Content></Content>
|
|
27
24
|
</CharacterStyleRange>
|
|
28
25
|
</ParagraphStyleRange>
|
|
29
26
|
</XmlStory>
|
|
30
27
|
</idPkg:BackingStory>
|
|
31
|
-
`;function Kt(r){let t=b(r);return r>0&&t==="0"?String(r):t}var zn={Dashed:"StrokeStyle/$ID/Dashed",DashedRound:"StrokeStyle/$ID/Dashed",LongDashed:"StrokeStyle/$ID/Canned Dashed 3x2",LongDashedRound:"StrokeStyle/$ID/Canned Dashed 3x2",Dotted:"StrokeStyle/$ID/Canned Dotted"},Zn=new Set(["Multiply","Screen","Overlay","SoftLight","HardLight","ColorDodge","ColorBurn","Darken","Lighten","Difference","Exclusion","Hue","Saturation","Color","Luminosity"]),Nt=class{constructor(){}static export(t){return vt.export(t)}},vt=class r{engine;logger=new At;colors=new wt(t=>{try{let[e,n,i]=this.engine.editor.getSpotColorRGBA(t);return{r:e,g:n,b:i,a:1}}catch{return null}},t=>this.allocateUniqueId(t));files=new Map;fontNames;fonts=new Map;fontBytes=new Map;storyIds=[];usedSelfIds=new Set(["d",Jt,"di2","XMLTag/Root","rcsg","rpsg","rosg","CharacterStyle/$ID/[No character style]","ParagraphStyle/$ID/[No paragraph style]","ObjectStyle/$ID/[None]","Swatch/None"]);pointsPerUnit;idCounter=0;currentPage=null;pageContentTransform=[1,0,0,1,0,0];constructor(t){this.engine=t,this.pointsPerUnit=this.resolvePointsPerUnit(),this.fontNames=Pt(async e=>{let n=await Tt(this.engine,e);return(n&&await ft(n))?.bytes??null})}static async export(t){let e=new r(t);if(await e.prepareTextFontFallbacks(),e.engine=await Et(t,e.fontNames),await De(e.engine,e.fontNames)){let i=await Dt(e.engine);i.aliasedFonts>0&&(e.fontNames=i.resolveNames,e.logger.emit("FONT_NAMES_ALIASED",{fonts:i.aliasedFonts}))}return{idml:await e.run(),logger:e.logger}}static async exportPackage(t,e){let n=new r(t);await n.prepareTextFontFallbacks(),n.engine=await Et(t,n.fontNames);let{fonts:i,skipped:s,resolveNames:o}=await Dt(n.engine);n.fontNames=o;let a=await n.run(),l=new Yt.default;l.file(`${e}/${e}.idml`,a);for(let c of i)l.file(`${e}/Document fonts/${c.filename}`,c.bytes);return{zip:await l.generateAsync({type:"uint8array",compression:"DEFLATE"}),logger:n.logger,skippedFonts:s}}async run(){let t=this.engine.scene.getPages(),e=[];for(let s of t){let o=await this.buildSpread(s);e.push(o)}let n=new Yt.default,i=(s,o)=>n.file(s,o,{createFolders:!1});n.file("mimetype","application/vnd.adobe.indesign-idml-package",{compression:"STORE",createFolders:!1}),i("designmap.xml",this.buildDesignMap(e)),i("META-INF/container.xml",Xn),i("Resources/Graphic.xml",this.buildGraphicResources()),i("Resources/Fonts.xml",this.buildFontResources()),i("Resources/Styles.xml",this.buildStyleResources()),i("Resources/Preferences.xml",this.buildPreferences(t[0])),i("XML/Tags.xml",$n),i("XML/BackingStory.xml",Gn);for(let[s,o]of this.files)i(s,o);return n.generateAsync({type:"uint8array"})}resolvePointsPerUnit(){let t=this.engine.scene.getDesignUnit();if(t==="Millimeter")return qt/25.4;if(t==="Pixel"){let e=this.engine.scene.get(),n=e!=null?this.engine.block.getFloat(e,"scene/dpi"):300;return n>0?qt/n:1}return qt}toPoints(t){return t*this.pointsPerUnit}allocateSelf(t,e){try{if(this.engine.block.hasMetadata(t,"idml/id")){let i=this.engine.block.getMetadata(t,"idml/id");if(J(i))this.logger.emit("XML_ID_REPLACED",{block:t});else if(i&&!this.usedSelfIds.has(i))return this.usedSelfIds.add(i),i}}catch{}let n;do n=`${e}u${++this.idCounter}`;while(this.usedSelfIds.has(n));return this.usedSelfIds.add(n),n}allocateUniqueId(t){let e=t;for(;this.usedSelfIds.has(e);)e=`${t}_u${++this.idCounter}`;return this.usedSelfIds.add(e),e}serializeXml(t,e=[]){return yt(t,e,n=>this.logger.emit("XML_CHARACTERS_REPLACED",{...n}))}buildDesignMap(t){let e=new q("Document").attr("xmlns:idPkg","http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging").attr("DOMVersion","15.0").attr("Self","d").attr("StoryList",[...this.storyIds,Jt].join(" "));e.element("idPkg:Graphic").attr("src","Resources/Graphic.xml"),e.element("idPkg:Fonts").attr("src","Resources/Fonts.xml"),e.element("idPkg:Styles").attr("src","Resources/Styles.xml"),e.element("idPkg:Preferences").attr("src","Resources/Preferences.xml"),e.element("idPkg:Tags").attr("src","XML/Tags.xml");for(let n of t)e.element("idPkg:Spread").attr("src",n);e.element("idPkg:BackingStory").attr("src","XML/BackingStory.xml");for(let n of this.storyIds)e.element("idPkg:Story").attr("src",`Stories/Story_${n}.xml`);return this.serializeXml(e,['<?aid style="50" type="document" readerVersion="6.0" featureSet="257" product="8.0(370)" ?>'])}buildGraphicResources(){let t=Q("Graphic");for(let e of this.colors.getResourceElements())t.append(e);return this.serializeXml(t)}registerFont(t,e,n){if([t,e,n].some(J))return;let i=JSON.stringify([t,e,n]);this.fonts.set(i,{family:t,style:e,postScriptName:n})}buildFontResources(){let t=Q("Fonts"),e=new Map;for(let{family:n,style:i,postScriptName:s}of this.fonts.values()){let o=e.get(n);o||(o=t.element("FontFamily").attr("Self",this.allocateUniqueId("FontFamily/"+n)).attr("Name",n),e.set(n,o));let a=n+" "+i;o.element("Font").attr("Self",this.allocateUniqueId("Font/"+(s||a))).attr("FontFamily",n).attr("Name",a).attr("PostScriptName",s).attr("FontStyleName",i)}return this.serializeXml(t)}buildStyleResources(){let t=Q("Styles");return t.element("RootCharacterStyleGroup").attr("Self","rcsg").element("CharacterStyle").attr("Self","CharacterStyle/$ID/[No character style]").attr("Name","$ID/[No character style]"),t.element("RootParagraphStyleGroup").attr("Self","rpsg").element("ParagraphStyle").attr("Self","ParagraphStyle/$ID/[No paragraph style]").attr("Name","$ID/[No paragraph style]"),t.element("RootObjectStyleGroup").attr("Self","rosg").element("ObjectStyle").attr("Self","ObjectStyle/$ID/[None]").attr("Name","$ID/[None]"),this.serializeXml(t)}buildPreferences(t){let e=i=>{if(t==null)return 0;try{return this.toPoints(this.engine.block.getFloat(t,i))}catch{return 0}},n=Q("Preferences");return n.element("DocumentPreference").attr("FacingPages","false").attr("DocumentBleedTopOffset",b(e("page/margin/top"))).attr("DocumentBleedBottomOffset",b(e("page/margin/bottom"))).attr("DocumentBleedInsideOrLeftOffset",b(e("page/margin/left"))).attr("DocumentBleedOutsideOrRightOffset",b(e("page/margin/right"))),n.element("TransparencyPreference").attr("BlendingSpace","RGB"),this.serializeXml(n)}async buildSpread(t){this.currentPage=t;let e=this.allocateSelf(t,"page_"),n=`Spreads/Spread_${e.replace(/[^A-Za-z0-9_-]/g,"_")}`,i=`${n}.xml`;for(;this.files.has(i);)i=`${n}_${++this.idCounter}.xml`;let s=this.toPoints(this.engine.block.getWidth(t)),o=this.toPoints(this.engine.block.getHeight(t)),a=this.engine.block.getFlipHorizontal(t),l=this.engine.block.getFlipVertical(t);this.pageContentTransform=[a?-1:1,0,0,l?-1:1,a?s:0,l?o:0];let c=Q("Spread"),u=c.element("Spread").attr("Self",this.allocateUniqueId(`spread_${e}`)).attr("PageCount","1");if(u.element("Page").attr("Self",e).attr("Name",this.engine.block.getName(t)||e).attr("GeometricBounds",`0 0 ${b(o)} ${b(s)}`).attr("ItemTransform","1 0 0 1 0 0"),nt(this.engine,t)){await this.emitPageBackground(t,u,s,o);for(let h of this.engine.block.getChildren(t))await this.emitBlock(h,u)}return this.files.set(i,this.serializeXml(c)),i}async emitPageBackground(t,e,n,i){let s=this.safeGetFill(t),o=s!==null&&this.engine.block.isValid(s)&&this.engine.block.isFillEnabled(t),a=this.hasVisibleStroke(t);if(!o&&!a)return;let l=o?this.engine.block.getType(s):null,c=l==="//ly.img.ubq/fill/video"?["PAGE_VIDEO_RASTERIZED","PAGE_VIDEO_RASTERIZATION_FAILED"]:a?["PAGE_STROKE_RASTERIZED","PAGE_STROKE_RASTERIZATION_FAILED"]:l!==null&&!this.isNativeFill(l)?["UNSUPPORTED_FILL_RASTERIZED","UNSUPPORTED_FILL_RASTERIZATION_FAILED"]:this.hasBakedAppearance(t)?["PAGE_APPEARANCE_RASTERIZED","PAGE_APPEARANCE_RASTERIZATION_FAILED"]:null;if(c){if(await this.emitRasterizedPageBlock(t,e,c[0]))return;this.logger.emit(c[1],{block:t,fillType:l})}if(!a&&l==="//ly.img.ubq/fill/color"){let d=this.engine.block.getColor(s,"fill/color/value");if("r"in d&&d.r>.999&&d.g>.999&&d.b>.999)return}let u={x:0,y:0,width:n,height:i,rotation:0,flipHorizontal:!1};if(l==="//ly.img.ubq/fill/image"){await this.emitImageRectangle(t,e,u,s);return}let h=e.element("Rectangle").attr("Self",this.allocateUniqueId(`pagebg_u${++this.idCounter}`)).attr("Name","Page Background").attr("AppliedObjectStyle","ObjectStyle/$ID/[None]").attr("ContentType","Unassigned").attr("StrokeWeight","0").attr("StrokeColor","Swatch/None").attr("Visible","true").attr("ItemTransform",this.elementTransform(u)),{alphaMultiplier:p,feather:g}=o&&l!==null?this.applyFillAttributes(h,s,l,u):{alphaMultiplier:1};o||h.attr("FillColor","Swatch/None");let f=this.applyStrokeAttributes(t,h);ot(h,et(n,i)),this.applyTransparency(t,h,1,void 0,f),this.appendFillTransparency(h,p,g)}async emitBlock(t,e){if(!nt(this.engine,t))return;let n=this.engine.block.getType(t);if(n==="//ly.img.ubq/group"){let s=e.element("Group").attr("Self",this.allocateSelf(t,"group_")).attr("Name",this.engine.block.getName(t)).attr("AppliedObjectStyle","ObjectStyle/$ID/[None]").attr("Visible",this.engine.block.isVisible(t)?"true":"false").attr("ItemTransform","1 0 0 1 0 0");this.applyTransparency(t,s,1);for(let o of this.engine.block.getChildren(t))await this.emitBlock(o,s);return}let i=this.readLocalLayout(t);if(n==="//ly.img.ubq/graphic"&&this.engine.block.supportsShape(t)&&this.engine.block.supportsDropShadow(t)&&this.engine.block.isDropShadowEnabled(t)&&N(this.engine.block.getDropShadowColor(t))>0&&this.engine.block.getBool(t,"dropShadow/clip")){if(await this.emitRasterizedPageBlock(t,e,"SHADOW_CLIP_RASTERIZED"))return;this.logger.emit("SHADOW_CLIP_RASTERIZATION_FAILED",{block:t})}if((n==="//ly.img.ubq/text"||n==="//ly.img.ubq/graphic")&&this.engine.block.supportsDropShadow(t)&&this.engine.block.isDropShadowEnabled(t)&&N(this.engine.block.getDropShadowColor(t))>0&&!this.isShadowSizeSupported(t)){let s={xPoints:this.toPoints(this.engine.block.getDropShadowBlurRadiusX(t)),yPoints:this.toPoints(this.engine.block.getDropShadowBlurRadiusY(t))};if(await this.emitRasterizedPageBlock(t,e,"SHADOW_SIZE_RASTERIZED",s))return;this.logger.emit("SHADOW_SIZE_RASTERIZATION_FAILED",{block:t,...s})}if((n==="//ly.img.ubq/text"||n==="//ly.img.ubq/graphic")&&this.engine.block.supportsDropShadow(t)&&this.engine.block.isDropShadowEnabled(t)&&Math.abs(this.toPoints(this.engine.block.getDropShadowBlurRadiusX(t))-this.toPoints(this.engine.block.getDropShadowBlurRadiusY(t)))>1e-6){if(await this.emitRasterizedPageBlock(t,e,"SHADOW_RASTERIZED"))return;this.logger.emit("SHADOW_RASTERIZATION_FAILED",{block:t})}if((n==="//ly.img.ubq/text"||n==="//ly.img.ubq/graphic")&&this.engine.block.supportsDropShadow(t)&&this.engine.block.isDropShadowEnabled(t)&&N(this.engine.block.getDropShadowColor(t))>0&&!this.isShadowOffsetSupported(t)){let s={xPoints:this.toPoints(this.engine.block.getDropShadowOffsetX(t)),yPoints:this.toPoints(this.engine.block.getDropShadowOffsetY(t))};if(await this.emitRasterizedPageBlock(t,e,"SHADOW_OFFSET_RASTERIZED",s))return;this.logger.emit("SHADOW_OFFSET_RASTERIZATION_FAILED",{block:t,...s})}switch(n){case"//ly.img.ubq/text":await this.emitTextFrame(t,e,i);return;case"//ly.img.ubq/graphic":await this.emitGraphic(t,e,i);return;default:this.logger.emit("UNSUPPORTED_BLOCK_TYPE",{block:t,type:n})}}readLocalLayout(t){let e=this.toPoints(this.engine.block.getWidth(t)),n=this.toPoints(this.engine.block.getHeight(t)),i=this.engine.block.getFlipHorizontal(t),s=this.engine.block.getFlipVertical(t);return{x:this.toPoints(this.engine.block.getPositionX(t))-(i?e:0),y:this.toPoints(this.engine.block.getPositionY(t))-(s?n:0),width:e,height:n,rotation:this.engine.block.getRotation(t),flipHorizontal:i,flipVertical:s}}startElement(t,e,n,i,s){return n.element(t).attr("Self",this.allocateSelf(e,s)).attr("Name",this.engine.block.getName(e)).attr("AppliedObjectStyle","ObjectStyle/$ID/[None]").attr("Visible",this.engine.block.isVisible(e)?"true":"false").attr("ItemTransform",this.elementTransform(i))}elementTransform(t){return It(ge(this.pageContentTransform,he(t)))}async emitTextFrame(t,e,n){if(await this.requiresTextXmlRaster(t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_XML_RASTERIZED"))return;this.logger.emit("TEXT_XML_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getTextRuns(t).some(R=>R.textCase==="Lowercase"||R.textCase==="Titlecase")){let R=!1;try{await this.engine.block.export(t,{mimeType:"image/png"}),R=se(this.engine,t)}catch{}if(!R){if(await this.emitRasterizedPageBlock(t,e,"TEXT_CASE_RASTERIZED"))return;this.logger.emit("TEXT_CASE_RASTERIZATION_FAILED",{block:t})}}if(await this.requiresTextFontFallbackRaster(t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_FONT_FALLBACK_RASTERIZED"))return;this.logger.emit("TEXT_FONT_FALLBACK_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getTextBackgroundColors?.(t,0,this.engine.block.getString(t,"text/text").length)?.some(R=>N(R)>0)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_RANGE_BACKGROUND_RASTERIZED"))return;this.logger.emit("TEXT_RANGE_BACKGROUND_RASTERIZATION_FAILED",{block:t})}if(this.requiresTextStrokeRaster(t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_STROKE_RASTERIZED"))return;this.logger.emit("TEXT_STROKE_RASTERIZATION_FAILED",{block:t})}if(Lt(this.engine,t).some(R=>R.textDecoration?.lines?.includes("Overline"))){if(await this.emitRasterizedPageBlock(t,e,"TEXT_DECORATION_RASTERIZED"))return;this.logger.emit("TEXT_DECORATION_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getTextOnPath(t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_PATH_RASTERIZED"))return;this.logger.emit("TEXT_PATH_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getTextRuns(t).some(R=>R.scriptStyle==="Superscript"||R.scriptStyle==="Subscript")){if(await this.emitRasterizedPageBlock(t,e,"TEXT_SCRIPT_RASTERIZED"))return;this.logger.emit("TEXT_SCRIPT_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getFloat(t,"text/paragraphSpacing")>0&&Me(this.engine.block.getTextRuns(t))){if(await this.emitRasterizedPageBlock(t,e,"TEXT_PARAGRAPH_SPACING_RASTERIZED"))return;this.logger.emit("TEXT_PARAGRAPH_SPACING_RASTERIZATION_FAILED",{block:t})}let o=this.engine.block.getString(t,"text/text");if(!(!/[\r\n]/.test(o)&&this.isSingleLine(t)&&(!this.engine.block.getBool(t,"text/clipLinesOutsideOfFrame")||this.engine.block.getTextVisibleLineCount(t)===1&&this.engine.block.getTextVisibleLineContent(t,0)===o))&&await Oe(this.engine,t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_LEADING_RASTERIZED"))return;this.logger.emit("TEXT_LEADING_RASTERIZATION_FAILED",{block:t})}let l=this.engine.block.getBlendMode(t);if(l!=="Normal"&&l!=="PassThrough"&&this.engine.block.getBool(t,"backgroundColor/enabled")&&N(this.engine.block.getColor(t,"backgroundColor/color"))>0){if(await this.emitRasterizedPageBlock(t,e,"TEXT_BACKGROUND_BLEND_RASTERIZED",{blendMode:l}))return;this.logger.emit("TEXT_BACKGROUND_BLEND_RASTERIZATION_FAILED",{block:t,blendMode:l})}if(this.requiresTextPaintRaster(t)){if(await this.emitRasterizedPageBlock(t,e,"TEXT_PAINT_RASTERIZED"))return;this.logger.emit("TEXT_PAINT_RASTERIZATION_FAILED",{block:t})}if(this.engine.block.getString(t,"text/text").includes(" ")){if(await this.emitRasterizedPageBlock(t,e,"TEXT_TABS_RASTERIZED"))return;this.logger.emit("TEXT_TABS_RASTERIZATION_FAILED",{block:t})}this.emitTextBackground(t,e,n);let{paint:c,alphaMultiplier:u}=this.textPaint(t),h=this.allocateUniqueId(`s${++this.idCounter}`);this.storyIds.push(h),this.files.set(`Stories/Story_${h}.xml`,await Ue(this.engine,t,h,this.colors,this.logger,this.fontNames,c,(R,y,S)=>this.registerFont(R,y,S)));let p=this.engine.block.getBool(t,"text/clipLinesOutsideOfFrame"),g=null,f=!1;if(p)try{if(!this.engine.block.getBool(t,"text/hasClippedLines")){let R=this.engine.block.getEnum(t,"width/mode")==="Auto",y=this.engine.block.getEnum(t,"height/mode")==="Auto";f=R,g=R?y?"HeightAndWidth":"WidthOnly":y?"HeightOnly":null}}catch{}(!p||f)&&(n=this.withTrackingAllowance(t,n));let d=this.startElement("TextFrame",t,e,n,"text_").attr("ParentStory",h).attr("ContentType","TextType"),T=this.engine.block.getEnum(t,"text/verticalAlignment"),A=Ge(T);ot(d,et(n.width,n.height));let m=this.isSingleLine(t),x=d.element("TextFramePreference").attr("AutoSizingType",g??(p?"Off":m?"HeightAndWidth":"HeightOnly")).attr("AutoSizingReferencePoint",m||f?$e(T,this.effectiveTextAlignment(t)):Xe(T));(f||m&&!p)&&x.attr("UseNoLineBreaksForAutoSizing","true");let w=A==="CenterAlign"||A==="BottomAlign"?null:this.firstBaselineOffset(t);w!=null&&x.attr("FirstBaselineOffset","FixedHeight").attr("MinimumFirstBaselineOffset",String(w)),A&&x.attr("VerticalJustification",A),this.applyTransparency(t,d,u)}async prepareTextFontFallbacks(){for(let t of this.engine.block.findByType("text"))if(!(!nt(this.engine,t)||!await this.requiresTextFontFallbackRaster(t)))try{await this.engine.block.export(t,{mimeType:"image/png"})}catch{}}async requiresTextFontFallbackRaster(t){for(let e of this.engine.block.getTextRuns(t)){if(!e.resolvedFontFileUri||!/[\p{Letter}\p{Number}\p{Punctuation}\p{Symbol}]/u.test(e.text))continue;let n=e.resolvedFontFileUri.split("#")[0];this.fontBytes.has(n)||this.fontBytes.set(n,(async()=>{try{let s=await Tt(this.engine,n);return s?(await ft(s))?.bytes??null:null}catch{return null}})());let i=await this.fontBytes.get(n);if(i&&Ce(i,e.text)===!0)return!0}return!1}async requiresTextXmlRaster(t){if(J(this.engine.block.getString(t,"text/text")))return!0;for(let e of this.engine.block.getTextRuns(t)){let n=e.resolvedFontFileUri?await this.fontNames(e.resolvedFontFileUri):null,i=n?.family??e.typeface?.name??"",s=n&&/[#&]wght=/.test(e.resolvedFontFileUri??"")?K(n,e.resolvedFontFileUri)??"":n?.subfamily??"";if(J(i)||J(s)||J(n?.postScriptName??""))return!0}return!1}requiresTextStrokeRaster(t){return this.hasVisibleStroke(t)&&(this.engine.block.getStrokeStyle(t)!=="Solid"||this.engine.block.getStrokeDashArray(t).some(e=>e>0)||this.engine.block.getStrokePosition(t)==="Inner")}hasVisibleStroke(t){return this.engine.block.supportsStroke(t)&&this.engine.block.isStrokeEnabled(t)&&this.engine.block.getStrokeWidth(t)>0&&N(this.engine.block.getStrokeColor(t))>0}requiresGraphicStrokeRaster(t,e){return this.hasVisibleStroke(t)?this.engine.block.getStrokeStyle(t)!=="Solid"||this.engine.block.getStrokeDashArray(t).some(n=>n>0)?!0:this.engine.block.getStrokeStartCap(t)==="Butt"&&this.engine.block.getStrokeEndCap(t)==="Butt"?!1:this.resolveShapeGeometry(t,e).subPaths.some(n=>n.open):!1}strokeDetails(t){return{dashArray:this.engine.block.getStrokeDashArray(t),dashOffset:this.engine.block.getStrokeDashOffset(t),startCap:this.engine.block.getStrokeStartCap(t),endCap:this.engine.block.getStrokeEndCap(t),dashStartCap:this.engine.block.getStrokeDashStartCap(t),dashEndCap:this.engine.block.getStrokeDashEndCap(t)}}requiresTextPaintRaster(t){let e=Lt(this.engine,t),n=this.engine.block.isFillEnabled(t)?e.map(u=>N(u.color)).filter(u=>u>0):[],i=this.engine.block.isStrokeEnabled(t)&&this.engine.block.getStrokeWidth(t)>0&&N(this.engine.block.getStrokeColor(t))>0,s=i?N(this.engine.block.getStrokeColor(t)):1,o=n.some(u=>u<1),a=new Set(n).size>1,l=this.engine.block.getBool(t,"backgroundColor/enabled")&&N(this.engine.block.getColor(t,"backgroundColor/color"))>0,c=e.some(u=>u.textDecoration?.underlineColor&&N(u.textDecoration.underlineColor)!==N(u.color));return a||i&&n.length>0&&(o||s<1)||l&&(s<1||this.engine.block.getOpacity(t)<1)||c}async emitRasterizedPageBlock(t,e,n,i={}){if(this.currentPage===null)return!1;let s=this.engine.block.getParent(this.currentPage);if(s===null)return!1;let o=null,a=null,l,c,u=this.engine.block.getWidth(this.currentPage),h=this.engine.block.getHeight(this.currentPage),p=this.toPoints(u),g=this.toPoints(h);try{if(t===this.currentPage){o=await Vt(this.engine,t);for(let x of this.engine.block.getChildren(o))this.engine.block.destroy(x);this.engine.block.appendChild(s,o)}else o=this.engine.block.create("page"),this.engine.block.setWidth(o,u),this.engine.block.setHeight(o,h),this.engine.block.setFillEnabled(o,!1),this.engine.block.appendChild(s,o),a=await Vt(this.engine,t),this.engine.block.appendChild(o,a),this.engine.block.setVisible(a,!0),this.engine.block.setOpacity(a,1);let A=Math.min(4,2600/Math.max(p,g,1)),m=await this.engine.block.export(o,{mimeType:"image/png",targetWidth:Math.max(1,Math.round(p*A)),targetHeight:Math.max(1,Math.round(g*A))});if(l=new Uint8Array(await m.arrayBuffer()),c=Zt(l,"image/png"),c===null||c.width<=0||c.height<=0)return!1}catch{return!1}finally{a!==null&&this.engine.block.isValid(a)&&this.engine.block.destroy(a),o!==null&&this.engine.block.isValid(o)&&this.engine.block.destroy(o)}let f=this.startElement("Rectangle",t,e,{x:0,y:0,width:p,height:g,rotation:0,flipHorizontal:!1,flipVertical:!1},"baked_").attr("ContentType","GraphicType").attr("FillColor","Swatch/None").attr("StrokeColor","Swatch/None").attr("StrokeWeight","0");t===this.currentPage&&f.attr("ItemTransform","1 0 0 1 0 0"),ot(f,et(p,g)),this.applyTransparency(t,f,1,void 0,1,!1);let d=f.element("Image").attr("Self",this.allocateUniqueId(`img_u${++this.idCounter}`)).attr("ItemTransform",It([p/c.width,0,0,g/c.height,0,0])).attr("ImageTypeName","$ID/PNG"),T=d.element("Properties");return T.element("GraphicBounds").attr("Left","0").attr("Top","0").attr("Right",b(c.width)).attr("Bottom",b(c.height)),T.element("Contents").cdata(at(l)),d.element("Link").attr("Self",this.allocateUniqueId(`link_u${++this.idCounter}`)).attr("StoredState","Embedded").attr("LinkResourceURI","file:embedded"),this.logger.emit(n,{block:t,...i}),!0}isSingleLine(t){try{if(Math.abs(this.engine.block.getRotation(t))>1e-6||this.engine.block.getFlipVertical(t)||this.engine.block.getFlipHorizontal(t))return!1;let e=this.engine.block.getTextCharacterInkBoxes(t).filter(i=>i.width>0&&i.height>0);if(e.length===0)return!1;let n=e[0].baselineY;return e.every(i=>Math.abs(i.baselineY-n)<.01)}catch{return!1}}firstBaselineOffset(t){let e=this.currentPage,n=null;try{if(Math.abs(this.engine.block.getRotation(t))>1e-6||this.engine.block.getFlipVertical(t))return null;if(e!==null){let l=this.engine.block.getRotation(e);l!==0&&(this.engine.block.setRotation(e,0),n=l)}let[i]=this.engine.block.getTextCharacterInkBoxes(t,0,1);if(!i)return null;let s=this.engine.block.getGlobalBoundingBoxY(t),o=i.baselineY-s,a=this.toPoints(this.pageContentTransform[3]<0?this.engine.block.getHeight(t)-o:o);return a>0?Number(a.toFixed(4)):null}catch{return null}finally{e!==null&&n!==null&&this.engine.block.setRotation(e,n)}}emitTextBackground(t,e,n){let i;try{if(!this.engine.block.getBool(t,"backgroundColor/enabled"))return;i=this.engine.block.getColor(t,"backgroundColor/color")}catch{return}let s=N(i);if(s<=0)return;this.logger.emit("TEXT_BACKGROUND_AS_RECT",{block:t});let o=f=>this.toPoints(this.engine.block.getFloat(t,`backgroundColor/padding${f}`)),[a,l,c,u]=[o("Left"),o("Top"),o("Right"),o("Bottom")],h=e.element("Rectangle").attr("Self",this.allocateUniqueId(`textbg_u${++this.idCounter}`)).attr("Name",this.engine.block.getName(t)).attr("AppliedObjectStyle","ObjectStyle/$ID/[None]").attr("Visible",this.engine.block.isVisible(t)?"true":"false").attr("ItemTransform",this.elementTransform(n)).attr("ContentType","Unassigned").attr("FillColor",this.colors.register(tt(i))).attr("StrokeWeight","0").attr("StrokeColor","Swatch/None");"tint"in i&&i.tint!==1&&h.attr("FillTint",b(Math.max(0,Math.min(1,i.tint))*100));let p=this.toPoints(this.engine.block.getFloat(t,"backgroundColor/cornerRadius"));if(p>0)for(let f of["TopLeft","TopRight","BottomLeft","BottomRight"])h.attr(`${f}CornerOption`,"RoundedCorner").attr(`${f}CornerRadius`,b(p));let g=et(n.width+a+c,n.height+l+u).map(f=>({...f,points:f.points.map(d=>({anchor:jt(d.anchor,-a,-l),left:jt(d.left,-a,-l),right:jt(d.right,-a,-l)}))}));ot(h,g),this.applyTransparency(t,h,1,void 0,1,!1),this.appendFillTransparency(h,s)}textPaint(t){let e=!0;try{e=this.engine.block.isFillEnabled(t)}catch{}let n=null,i=1;try{if(this.engine.block.supportsStroke(t)&&this.engine.block.isStrokeEnabled(t)){let s=this.engine.block.getStrokeWidth(t);if(s>0){let o=this.engine.block.getStrokeColor(t);n=N(o)>0?{color:o,weightPt:this.toPoints(s),position:this.engine.block.getStrokePosition(t),cornerGeometry:this.engine.block.getStrokeCornerGeometry(t)}:null;let a=N(o);if(a>0&&a<1){let l=this.engine.block.getTextRuns(t);!(e&&l.some(u=>N(u.color)>0))&&l.length>0?(i=a,this.logger.emit("TEXT_STROKE_ALPHA_FOLDED",{block:t})):this.logger.emit("TEXT_STROKE_ALPHA_DROPPED",{block:t})}}}}catch{n=null,i=1}if(e&&i===1)try{let s=this.engine.block.getTextRuns(t),o=[...new Set(s.map(a=>N(a.color)).filter(a=>a>0))];o.length===1&&o[0]<1?(i=o[0],this.logger.emit("TEXT_FILL_ALPHA_FOLDED",{block:t})):o.some(a=>a<1)&&this.logger.emit("TEXT_FILL_ALPHA_DROPPED",{block:t})}catch{}return{paint:{fillEnabled:e,stroke:n},alphaMultiplier:i}}withTrackingAllowance(t,e){if(e.rotation!==0||e.flipHorizontal||this.engine.block.getEnum(t,"width/mode")!=="Auto")return e;let n=Be(this.engine,t);if(n<=0)return e;let s={Left:0,Center:.5,Right:1}[this.isSingleLine(t)?this.effectiveTextAlignment(t):this.engine.block.getEnum(t,"text/horizontalAlignment")]??0;return{...e,width:e.width+n,x:e.x-n*s}}effectiveTextAlignment(t){let e=this.engine.block.getEnum(t,"text/horizontalAlignment");try{e=this.engine.block.getTextHorizontalAlignment(t,0)??e}catch{}return e==="Auto"||e==="Justify"?ht(this.engine.block.getString(t,"text/text"))?"Right":"Left":e}async emitGraphic(t,e,n){if(this.engine.block.supportsShape(t)){let o=this.engine.block.getShape(t);if(this.engine.block.isValid(o)&&this.engine.block.getType(o)==="//ly.img.ubq/shape/line"){if(await this.emitRasterizedPageBlock(t,e,"LINE_SHAPE_RASTERIZED"))return;this.logger.emit("LINE_SHAPE_RASTERIZATION_FAILED",{block:t})}}if(this.requiresFillRuleRaster(t)){if(await this.emitRasterizedPageBlock(t,e,"FILL_RULE_RASTERIZED"))return;this.logger.emit("FILL_RULE_RASTERIZATION_FAILED",{block:t})}if(this.hasRoundedNonRectShape(t)){if(await this.emitRasterizedPageBlock(t,e,"SHAPE_CORNERS_RASTERIZED"))return;this.logger.emit("SHAPE_CORNERS_RASTERIZATION_FAILED",{block:t})}if(this.requiresGraphicStrokeRaster(t,n)){let o=this.strokeDetails(t);if(await this.emitRasterizedPageBlock(t,e,"STROKE_RASTERIZED",o))return;this.logger.emit("STROKE_RASTERIZATION_FAILED",{block:t,...o})}let i=this.safeGetFill(t),s=i!=null&&this.engine.block.isValid(i)?this.engine.block.getType(i):null;if(s!==null&&!this.isNativeFill(s)&&this.engine.block.isFillEnabled(t)){if(await this.emitRasterizedPageBlock(t,e,"UNSUPPORTED_FILL_RASTERIZED"))return;this.logger.emit("UNSUPPORTED_FILL_RASTERIZATION_FAILED",{block:t,fillType:s})}if(this.hasBakedAppearance(t)){if(await this.emitRasterizedPageBlock(t,e,"EFFECTS_BAKED"))return;this.logger.emit("EFFECTS_BAKE_FAILED",{block:t})}if(s==="//ly.img.ubq/fill/video"&&this.engine.block.isFillEnabled(t)){if(await this.emitRasterizedPageBlock(t,e,"EFFECTS_BAKED"))return;this.logger.emit("VIDEO_FILL_DROPPED",{block:t})}s==="//ly.img.ubq/fill/image"&&this.engine.block.isFillEnabled(t)&&await this.emitImageRectangle(t,e,n,i)||this.emitShape(t,e,n,i,s)}isNativeFill(t){return["//ly.img.ubq/fill/color","//ly.img.ubq/fill/image","//ly.img.ubq/fill/video","//ly.img.ubq/fill/gradient/linear","//ly.img.ubq/fill/gradient/radial"].includes(t)}hasRoundedNonRectShape(t){if(!this.engine.block.supportsShape(t))return!1;let e=this.engine.block.getShape(t);if(!this.engine.block.isValid(e))return!1;let n=this.engine.block.getType(e),s={"//ly.img.ubq/shape/polygon":"shape/polygon/cornerRadius","//ly.img.ubq/shape/star":"shape/star/cornerRadius","//ly.img.ubq/shape/vector_path":"shape/vector_path/cornerRadius"}[n];return s!==void 0&&this.engine.block.getFloat(e,s)>0}requiresFillRuleRaster(t){if(!this.engine.block.supportsShape(t)||!this.engine.block.isFillEnabled(t))return!1;let e=this.engine.block.getShape(t);if(!this.engine.block.isValid(e)||this.engine.block.getType(e)!=="//ly.img.ubq/shape/vector_path"||this.engine.block.getEnum(e,"shape/vector_path/fillRule")!=="NonZero")return!1;let n=zt(this.engine.block.getString(e,"vector_path/path"),1,1);return"error"in n||!fe(n.subPaths)}hasBakedAppearance(t){try{return this.engine.block.supportsBlur(t)&&this.engine.block.isBlurEnabled(t)&&this.engine.block.isValid(this.engine.block.getBlur(t))?!0:this.engine.block.supportsEffects(t)&&this.engine.block.getEffects(t).some(e=>this.engine.block.isValid(e)&&this.engine.block.isEffectEnabled(e))}catch{return!1}}safeGetFill(t){try{return this.engine.block.supportsFill(t)?this.engine.block.getFill(t):null}catch{return null}}emitShape(t,e,n,i,s){let{tag:o,subPaths:a}=this.resolveShapeGeometry(t,n),l=this.startElement(o,t,e,n,"shape_").attr("ContentType","Unassigned"),c={alphaMultiplier:1};i!=null&&s!=null&&s!=="//ly.img.ubq/fill/image"&&this.engine.block.isFillEnabled(t)?c=this.applyFillAttributes(l,i,s,n):l.attr("FillColor","Swatch/None");let u=this.applyStrokeAttributes(t,l);this.applyCornerRadii(t,l),ot(l,a),this.applyTransparency(t,l,1,void 0,u),this.appendFillTransparency(l,c.alphaMultiplier,c.feather)}resolveShapeGeometry(t,e){let n=null;try{n=this.engine.block.supportsShape(t)?this.engine.block.getShape(t):null}catch{n=null}let i=n!=null&&this.engine.block.isValid(n)?this.engine.block.getType(n):null;switch(i){case"//ly.img.ubq/shape/ellipse":return{tag:"Oval",subPaths:de(e.width,e.height)};case"//ly.img.ubq/shape/rect":case null:return{tag:"Rectangle",subPaths:et(e.width,e.height)};case"//ly.img.ubq/shape/star":{let s=this.engine.block.getInt(n,"shape/star/points"),o=this.engine.block.getFloat(n,"shape/star/innerDiameter");return{tag:"Polygon",subPaths:pe(e.width,e.height,s,o)}}case"//ly.img.ubq/shape/polygon":{let s=this.engine.block.getInt(n,"shape/polygon/sides");return{tag:"Polygon",subPaths:me(e.width,e.height,s)}}case"//ly.img.ubq/shape/vector_path":{let s=this.engine.block.getString(n,"vector_path/path"),o=this.engine.block.getFloat(n,"vector_path/width"),a=this.engine.block.getFloat(n,"vector_path/height"),l=o>0?e.width/o:1,c=a>0?e.height/a:1,u=zt(s,l,c);return"subPaths"in u?{tag:"Polygon",subPaths:u.subPaths}:(this.logger.emit("UNSUPPORTED_PATH_DATA",{block:t,reason:u.error}),{tag:"Rectangle",subPaths:et(e.width,e.height)})}default:return this.logger.emit("UNSUPPORTED_SHAPE_TYPE",{block:t,shapeType:i}),{tag:"Rectangle",subPaths:et(e.width,e.height)}}}applyFillAttributes(t,e,n,i){if(n==="//ly.img.ubq/fill/color"){let s=this.engine.block.getColor(e,"fill/color/value"),o=N(s);return o<=0?(t.attr("FillColor","Swatch/None"),{alphaMultiplier:1}):(t.attr("FillColor",this.colors.register(tt(s))),"tint"in s&&s.tint<1&&t.attr("FillTint",b(s.tint*100)),o<1&&this.logger.emit("FILL_ALPHA_FOLDED"),{alphaMultiplier:o})}if(n==="//ly.img.ubq/fill/gradient/linear"||n==="//ly.img.ubq/fill/gradient/radial"){let s=this.engine.block.getGradientColorStops(e,"fill/gradient/colors"),o=n==="//ly.img.ubq/fill/gradient/linear",a=o?this.applyLinearGradientGeometry(t,e,i):this.applyRadialGradientGeometry(t,e,i);if(a.length===0&&s.length>0){let h=s[s.length-1].color,p=N(h);return this.logger.emit("DEGENERATE_GRADIENT_AS_SOLID"),p<=0?(t.attr("FillColor","Swatch/None"),{alphaMultiplier:1}):(t.attr("FillColor",this.colors.register(tt(h))),"tint"in h&&h.tint<1&&t.attr("FillTint",b(h.tint*100)),p<1&&this.logger.emit("FILL_ALPHA_FOLDED"),{alphaMultiplier:p})}t.attr("FillColor",this.colors.registerGradient(o?"Linear":"Radial",s));let l=s.map(h=>N(h.color)),c=Math.min(...l);return Math.max(...l)-c<.001?(c<1&&this.logger.emit("FILL_ALPHA_FOLDED"),{alphaMultiplier:c}):(this.logger.emit("GRADIENT_ALPHA_AS_FEATHER"),{alphaMultiplier:1,feather:{type:o?"Linear":"Radial",geometry:a,stops:ce(s.map((h,p)=>({opacity:l[p],location:h.stop})))}})}return t.attr("FillColor","Swatch/None"),{alphaMultiplier:1}}applyLinearGradientGeometry(t,e,n){let i={x:this.engine.block.getFloat(e,"fill/gradient/linear/startPointX"),y:this.engine.block.getFloat(e,"fill/gradient/linear/startPointY")},s={x:this.engine.block.getFloat(e,"fill/gradient/linear/endPointX"),y:this.engine.block.getFloat(e,"fill/gradient/linear/endPointY")},o={x:i.x*n.width,y:i.y*n.height},a={x:s.x*n.width,y:s.y*n.height},l=a.x-o.x,c=a.y-o.y,u=Math.hypot(l,c);if(u===0)return{start:{x:0,y:0},angle:0,length:0};let h=Math.atan2(-c,l)*180/Math.PI;return t.attr("GradientFillStart",`${b(o.x)} ${b(o.y)}`).attr("GradientFillAngle",b(h)).attr("GradientFillLength",Kt(u)),{start:o,angle:h,length:u}}applyRadialGradientGeometry(t,e,n){let i=this.engine.block.getFloat(e,"fill/gradient/radial/centerPointX"),s=this.engine.block.getFloat(e,"fill/gradient/radial/centerPointY"),a=this.engine.block.getFloat(e,"fill/gradient/radial/radius")*Math.min(n.width,n.height),l={start:{x:i*n.width,y:s*n.height},angle:0,length:a};return a===0||t.attr("GradientFillStart",`${b(i*n.width)} ${b(s*n.height)}`).attr("GradientFillLength",Kt(a)),l}applyStrokeAttributes(t,e){let n=()=>(e.attr("StrokeWeight","0").attr("StrokeColor","Swatch/None"),1);try{if(!this.engine.block.supportsStroke(t)||!this.engine.block.isStrokeEnabled(t))return n()}catch{return n()}let i=this.engine.block.getStrokeWidth(t);if(i<=0)return n();let s=this.engine.block.getStrokeColor(t);e.attr("StrokeColor",this.colors.register(tt(s))).attr("StrokeWeight",b(this.toPoints(i))),"tint"in s&&s.tint<1&&e.attr("StrokeTint",b(s.tint*100));let o=this.engine.block.getStrokePosition(t),a=o==="Inner"?"InsideAlignment":o==="Outer"?"OutsideAlignment":"CenterAlignment";e.attr("StrokeAlignment",a).attr("EndJoin",`${this.engine.block.getStrokeCornerGeometry(t)}EndJoin`);let l=zn[this.engine.block.getStrokeStyle(t)];return l&&e.attr("StrokeType",l),N(s)}applyCornerRadii(t,e){let n=null;try{n=this.engine.block.supportsShape(t)?this.engine.block.getShape(t):null}catch{return}if(n==null||!this.engine.block.isValid(n)||this.engine.block.getType(n)!=="//ly.img.ubq/shape/rect")return;let i=[["TL","TopLeft"],["TR","TopRight"],["BL","BottomLeft"],["BR","BottomRight"]];for(let[s,o]of i){let a=0;try{a=this.engine.block.getFloat(n,`shape/rect/cornerRadius${s}`)}catch{continue}a>0&&e.attr(`${o}CornerOption`,"RoundedCorner").attr(`${o}CornerRadius`,b(this.toPoints(a)))}}applyTransparency(t,e,n,i,s=1,o=!0){let a=null;try{let h=this.engine.block.getBlendMode(t);h==="Normal"&&e.tag==="Group"?a=h:h!=="Normal"&&h!=="PassThrough"&&(Zn.has(h)?a=h:this.logger.emit("BLEND_MODE_DROPPED",{block:t,blendMode:h}))}catch{}let l=(this.engine.block.supportsOpacity(t)?this.engine.block.getOpacity(t):1)*n,c=o&&this.engine.block.supportsDropShadow(t)&&this.engine.block.isDropShadowEnabled(t)&&this.isShadowSizeSupported(t)&&this.isShadowOffsetSupported(t);if(l>=1&&!c&&!i&&a==null&&s>=1)return;if(s<1&&this.logger.emit("STROKE_ALPHA_AS_TRANSPARENCY",{block:t}),l>=1&&!c&&!i&&a==null){this.appendStrokeTransparency(e,s);return}let u=e.element("TransparencySetting");if(l<1||a!=null){let h=u.element("BlendingSetting");a!=null&&(h.attr("BlendMode",a),e.tag==="Group"&&a==="Normal"&&h.attr("IsolateBlending","true")),l<1&&h.attr("Opacity",b(Math.max(0,l)*100))}if(c){let h=this.engine.block.getDropShadowColor(t),p=N(h);u.element("DropShadowSetting").attr("Mode","Drop").attr("XOffset",b(this.toPoints(this.engine.block.getDropShadowOffsetX(t)))).attr("YOffset",b(this.toPoints(this.engine.block.getDropShadowOffsetY(t)))).attr("Size",b(this.toPoints(this.engine.block.getDropShadowBlurRadiusX(t)))).attr("Opacity",b(p*100)).attr("EffectColor",this.colors.registerWithTint(tt(h)))}i&&this.appendGradientFeather(u,i),this.appendStrokeTransparency(e,s)}isShadowSizeSupported(t){let e=this.toPoints(this.engine.block.getDropShadowBlurRadiusX(t)),n=this.toPoints(this.engine.block.getDropShadowBlurRadiusY(t));return e>=0&&e<=144&&n>=0&&n<=144}isShadowOffsetSupported(t){let e=this.toPoints(this.engine.block.getDropShadowOffsetX(t)),n=this.toPoints(this.engine.block.getDropShadowOffsetY(t));return Number.isFinite(e)&&Number.isFinite(n)&&Math.abs(e)<=1e3&&Math.abs(n)<=1e3}appendStrokeTransparency(t,e){e>=1||t.element("StrokeTransparencySetting").element("BlendingSetting").attr("Opacity",b(Math.max(0,e)*100))}appendFillTransparency(t,e,n){if(e>=1&&!n)return;let i=t.element("FillTransparencySetting");e<1&&i.element("BlendingSetting").attr("Opacity",b(Math.max(0,e)*100)),n&&this.appendGradientFeather(i,n)}appendGradientFeather(t,e){let n=t.element("GradientFeatherSetting").attr("Applied","true").attr("Type",e.type).attr("GradientStart",`${b(e.geometry.start.x)} ${b(e.geometry.start.y)}`).attr("Length",Kt(e.geometry.length));e.type==="Linear"&&n.attr("Angle",b(e.geometry.angle)),e.stops.forEach((i,s)=>{n.element("OpacityGradientStop").attr("Self",this.allocateUniqueId(`feather_u${++this.idCounter}s${s}`)).attr("Opacity",b(i.opacity*100)).attr("Location",b(i.location*100))})}async emitImageRectangle(t,e,n,i){let s=this.resolveImageUri(i),o=s?await be(this.engine,s):null;if(!o)return this.logger.emit("IMAGE_BYTES_UNAVAILABLE",{block:t,uri:s}),!1;let{tag:a,subPaths:l}=this.resolveShapeGeometry(t,n),c=this.startElement(a,t,e,n,"image_").attr("ContentType","GraphicType").attr("FillColor","Swatch/None"),u=this.applyStrokeAttributes(t,c);this.applyCornerRadii(t,c),ot(c,l);let h=o.isSvg?ye(o.bytes):o.pixelSize,{matrix:p,naturalWidth:g,naturalHeight:f}=this.computeImageContentTransform(t,n,h);this.applyTransparency(t,c,1,void 0,u);let d=c.element(o.isSvg?"SVG":"Image").attr("Self",this.allocateUniqueId(`img_u${++this.idCounter}`)).attr("ItemTransform",It(p));o.isSvg||d.attr("ImageTypeName",Se(o.mimeType));let T=d.element("Properties");return T.element("GraphicBounds").attr("Left","0").attr("Top","0").attr("Right",b(g)).attr("Bottom",b(f)),T.element("Contents").cdata(at(o.bytes)),d.element("Link").attr("Self",this.allocateUniqueId(`link_u${++this.idCounter}`)).attr("StoredState","Embedded").attr("LinkResourceURI","file:embedded"),!0}resolveImageUri(t){try{let e=this.engine.block.getSourceSet(t,"fill/image/sourceSet");if(e.length>0)return e[0].uri}catch{}try{return this.engine.block.getString(t,"fill/image/imageFileURI")||null}catch{return null}}computeImageContentTransform(t,e,n){let i;try{i=this.engine.block.supportsCrop(t)}catch{i=!1}let s=e.width,o=e.height,a=0,l=0,c=0;i&&(s=Math.max(this.engine.block.getCropScaleX(t)*e.width,1e-6),o=Math.max(this.engine.block.getCropScaleY(t)*e.height,1e-6),a=this.engine.block.getCropTranslationX(t)*e.width,l=this.engine.block.getCropTranslationY(t)*e.height,c=this.engine.block.getCropRotation(t));let u=n?.width??s,h=n?.height??o,p=s/u,g=o/h,f=Math.cos(c),d=Math.sin(c);return{matrix:[f*p,d*p,-d*g,f*g,a,l],naturalWidth:u,naturalHeight:h}}};0&&(module.exports={IDMLExporter,Logger,collectDocumentFonts,exportIdml,exportIdmlPackage});
|
|
28
|
+
`);for(let[e,t]of this.files)r(e,t);return n.generateAsync({type:`uint8array`})}resolvePointsPerUnit(){let e=this.engine.scene.getDesignUnit();if(e===`Millimeter`)return 72/25.4;if(e===`Pixel`){let e=this.engine.scene.get(),t=e==null?300:this.engine.block.getFloat(e,`scene/dpi`);return t>0?72/t:1}return 72}toPoints(e){return e*this.pointsPerUnit}allocateSelf(e,t){try{if(this.engine.block.hasMetadata(e,`idml/id`)){let t=this.engine.block.getMetadata(e,`idml/id`);if(k(t))this.logger.emit(`XML_ID_REPLACED`,{block:e});else if(t&&!this.usedSelfIds.has(t))return this.usedSelfIds.add(t),t}}catch{}let n;do n=`${t}u${++this.idCounter}`;while(this.usedSelfIds.has(n));return this.usedSelfIds.add(n),n}allocateUniqueId(e){let t=e;for(;this.usedSelfIds.has(t);)t=`${e}_u${++this.idCounter}`;return this.usedSelfIds.add(t),t}serializeXml(e,t=[]){return I(e,t,e=>this.logger.emit(`XML_CHARACTERS_REPLACED`,{...e}))}buildDesignMap(e){let t=new F(`Document`).attr(`xmlns:idPkg`,`http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging`).attr(`DOMVersion`,`15.0`).attr(`Self`,`d`).attr(`StoryList`,[...this.storyIds,`ubs`].join(` `));t.element(`idPkg:Graphic`).attr(`src`,`Resources/Graphic.xml`),t.element(`idPkg:Fonts`).attr(`src`,`Resources/Fonts.xml`),t.element(`idPkg:Styles`).attr(`src`,`Resources/Styles.xml`),t.element(`idPkg:Preferences`).attr(`src`,`Resources/Preferences.xml`),t.element(`idPkg:Tags`).attr(`src`,`XML/Tags.xml`);for(let n of e)t.element(`idPkg:Spread`).attr(`src`,n);t.element(`idPkg:BackingStory`).attr(`src`,`XML/BackingStory.xml`);for(let e of this.storyIds)t.element(`idPkg:Story`).attr(`src`,`Stories/Story_${e}.xml`);return this.serializeXml(t,[`<?aid style="50" type="document" readerVersion="6.0" featureSet="257" product="8.0(370)" ?>`])}buildGraphicResources(){let e=L(`Graphic`);for(let t of this.colors.getResourceElements())e.append(t);return this.serializeXml(e)}registerFont(e,t,n){if([e,t,n].some(k))return;let r=JSON.stringify([e,t,n]);this.fonts.set(r,{family:e,style:t,postScriptName:n})}buildFontResources(){let e=L(`Fonts`),t=/* @__PURE__ */ new Map;for(let{family:n,style:r,postScriptName:i}of this.fonts.values()){let a=t.get(n);a||(a=e.element(`FontFamily`).attr(`Self`,this.allocateUniqueId(`FontFamily/`+n)).attr(`Name`,n),t.set(n,a));let o=n+` `+r;a.element(`Font`).attr(`Self`,this.allocateUniqueId(`Font/`+(i||o))).attr(`FontFamily`,n).attr(`Name`,o).attr(`PostScriptName`,i).attr(`FontStyleName`,r)}return this.serializeXml(e)}buildStyleResources(){let e=L(`Styles`);return e.element(`RootCharacterStyleGroup`).attr(`Self`,`rcsg`).element(`CharacterStyle`).attr(`Self`,`CharacterStyle/$ID/[No character style]`).attr(`Name`,`$ID/[No character style]`),e.element(`RootParagraphStyleGroup`).attr(`Self`,`rpsg`).element(`ParagraphStyle`).attr(`Self`,`ParagraphStyle/$ID/[No paragraph style]`).attr(`Name`,`$ID/[No paragraph style]`),e.element(`RootObjectStyleGroup`).attr(`Self`,`rosg`).element(`ObjectStyle`).attr(`Self`,`ObjectStyle/$ID/[None]`).attr(`Name`,`$ID/[None]`),this.serializeXml(e)}claimScriptPreferences(e){let t=new Set(this.engine.block.getTextRuns(e).map(e=>e.scriptStyle).filter(e=>e===`Superscript`||e===`Subscript`)),n={Superscript:`superscript`,Subscript:`subscript`},r=[...t].map(t=>({script:t,scale:this.engine.block.getFloat(e,`text/${n[t]}FontScale`),shift:this.engine.block.getFloat(e,`text/${n[t]}VerticalShift`)})),i=r.every(({script:e,scale:t,shift:n})=>{let r=this.scriptPreferences.get(e);return!r||r.scale===t&&r.shift===n});if(i)for(let{script:e,scale:t,shift:n}of r)this.scriptPreferences.set(e,{scale:t,shift:n});return i}buildPreferences(e){let t=t=>{if(e==null)return 0;try{return this.toPoints(this.engine.block.getFloat(e,t))}catch{return 0}},n=L(`Preferences`),r=e=>R(Math.round(e*1e6)/1e4),i=this.scriptPreferences.get(`Superscript`),a=this.scriptPreferences.get(`Subscript`);if(i||a){let e=n.element(`TextPreference`);i&&e.attr(`SuperscriptSize`,r(i.scale)).attr(`SuperscriptPosition`,r(i.shift)),a&&e.attr(`SubscriptSize`,r(a.scale)).attr(`SubscriptPosition`,r(a.shift))}return n.element(`DocumentPreference`).attr(`FacingPages`,`false`).attr(`DocumentBleedTopOffset`,R(t(`page/margin/top`))).attr(`DocumentBleedBottomOffset`,R(t(`page/margin/bottom`))).attr(`DocumentBleedInsideOrLeftOffset`,R(t(`page/margin/left`))).attr(`DocumentBleedOutsideOrRightOffset`,R(t(`page/margin/right`))),n.element(`TransparencyPreference`).attr(`BlendingSpace`,`RGB`),this.serializeXml(n)}async buildSpread(e){this.currentPage=e;let t=this.allocateSelf(e,`page_`),n=`Spreads/Spread_${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`,r=`${n}.xml`;for(;this.files.has(r);)r=`${n}_${++this.idCounter}.xml`;let i=this.toPoints(this.engine.block.getWidth(e)),a=this.toPoints(this.engine.block.getHeight(e)),o=this.engine.block.getFlipHorizontal(e),s=this.engine.block.getFlipVertical(e);this.pageContentTransform=[o?-1:1,0,0,s?-1:1,o?i:0,s?a:0];let c=L(`Spread`),l=c.element(`Spread`).attr(`Self`,this.allocateUniqueId(`spread_${t}`)).attr(`PageCount`,`1`);if(l.element(`Page`).attr(`Self`,t).attr(`Name`,this.engine.block.getName(e)||t).attr(`GeometricBounds`,`0 0 ${R(a)} ${R(i)}`).attr(`ItemTransform`,`1 0 0 1 0 0`),q(this.engine,e)){await this.emitPageBackground(e,l,i,a);for(let t of this.engine.block.getChildren(e))await this.emitBlock(t,l)}return this.files.set(r,this.serializeXml(c)),r}async emitPageBackground(e,t,n,r){let i=this.safeGetFill(e),a=i!==null&&this.engine.block.isValid(i)&&this.engine.block.isFillEnabled(e),o=this.hasVisibleStroke(e);if(!a&&!o)return;let s=a?this.engine.block.getType(i):null,c=s===`//ly.img.ubq/fill/video`?[`PAGE_VIDEO_RASTERIZED`,`PAGE_VIDEO_RASTERIZATION_FAILED`]:o?[`PAGE_STROKE_RASTERIZED`,`PAGE_STROKE_RASTERIZATION_FAILED`]:s!==null&&!this.isNativeFill(s)?[`UNSUPPORTED_FILL_RASTERIZED`,`UNSUPPORTED_FILL_RASTERIZATION_FAILED`]:this.hasBakedAppearance(e)?[`PAGE_APPEARANCE_RASTERIZED`,`PAGE_APPEARANCE_RASTERIZATION_FAILED`]:null;if(c){if(await this.emitRasterizedPageBlock(e,t,c[0]))return;this.logger.emit(c[1],{block:e,fillType:s})}if(!o&&s===`//ly.img.ubq/fill/color`){let e=this.engine.block.getColor(i,`fill/color/value`);if(`r`in e&&e.r>.999&&e.g>.999&&e.b>.999)return}let l={x:0,y:0,width:n,height:r,rotation:0,flipHorizontal:!1};if(s===`//ly.img.ubq/fill/image`){await this.emitImageRectangle(e,t,l,i);return}let u=t.element(`Rectangle`).attr(`Self`,this.allocateUniqueId(`pagebg_u${++this.idCounter}`)).attr(`Name`,`Page Background`).attr(`AppliedObjectStyle`,`ObjectStyle/$ID/[None]`).attr(`ContentType`,`Unassigned`).attr(`StrokeWeight`,`0`).attr(`StrokeColor`,`Swatch/None`).attr(`Visible`,`true`).attr(`ItemTransform`,this.elementTransform(l)),{alphaMultiplier:d,feather:f}=a&&s!==null?this.applyFillAttributes(u,i,s,l):{alphaMultiplier:1};a||u.attr(`FillColor`,`Swatch/None`);let p=this.applyStrokeAttributes(e,u);U(u,W(n,r)),this.applyTransparency(e,u,1,void 0,p),this.appendFillTransparency(u,d,f)}async emitBlock(e,t){if(!q(this.engine,e))return;let n=this.engine.block.getType(e);if(n===`//ly.img.ubq/group`){let n=t.element(`Group`).attr(`Self`,this.allocateSelf(e,`group_`)).attr(`Name`,this.engine.block.getName(e)).attr(`AppliedObjectStyle`,`ObjectStyle/$ID/[None]`).attr(`Visible`,this.engine.block.isVisible(e)?`true`:`false`).attr(`ItemTransform`,`1 0 0 1 0 0`);this.applyTransparency(e,n,1);for(let t of this.engine.block.getChildren(e))await this.emitBlock(t,n);return}let r=this.readLocalLayout(e);if(n===`//ly.img.ubq/graphic`&&this.engine.block.supportsShape(e)&&this.engine.block.supportsDropShadow(e)&&this.engine.block.isDropShadowEnabled(e)&&B(this.engine.block.getDropShadowColor(e))>0&&this.engine.block.getBool(e,`dropShadow/clip`)){if(await this.emitRasterizedPageBlock(e,t,`SHADOW_CLIP_RASTERIZED`))return;this.logger.emit(`SHADOW_CLIP_RASTERIZATION_FAILED`,{block:e})}if((n===`//ly.img.ubq/text`||n===`//ly.img.ubq/graphic`)&&this.engine.block.supportsDropShadow(e)&&this.engine.block.isDropShadowEnabled(e)&&B(this.engine.block.getDropShadowColor(e))>0&&!this.isShadowSizeSupported(e)){let n={xPoints:this.toPoints(this.engine.block.getDropShadowBlurRadiusX(e)),yPoints:this.toPoints(this.engine.block.getDropShadowBlurRadiusY(e))};if(await this.emitRasterizedPageBlock(e,t,`SHADOW_SIZE_RASTERIZED`,n))return;this.logger.emit(`SHADOW_SIZE_RASTERIZATION_FAILED`,{block:e,...n})}if((n===`//ly.img.ubq/text`||n===`//ly.img.ubq/graphic`)&&this.engine.block.supportsDropShadow(e)&&this.engine.block.isDropShadowEnabled(e)&&Math.abs(this.toPoints(this.engine.block.getDropShadowBlurRadiusX(e))-this.toPoints(this.engine.block.getDropShadowBlurRadiusY(e)))>1e-6){if(await this.emitRasterizedPageBlock(e,t,`SHADOW_RASTERIZED`))return;this.logger.emit(`SHADOW_RASTERIZATION_FAILED`,{block:e})}if((n===`//ly.img.ubq/text`||n===`//ly.img.ubq/graphic`)&&this.engine.block.supportsDropShadow(e)&&this.engine.block.isDropShadowEnabled(e)&&B(this.engine.block.getDropShadowColor(e))>0&&!this.isShadowOffsetSupported(e)){let n={xPoints:this.toPoints(this.engine.block.getDropShadowOffsetX(e)),yPoints:this.toPoints(this.engine.block.getDropShadowOffsetY(e))};if(await this.emitRasterizedPageBlock(e,t,`SHADOW_OFFSET_RASTERIZED`,n))return;this.logger.emit(`SHADOW_OFFSET_RASTERIZATION_FAILED`,{block:e,...n})}switch(n){case`//ly.img.ubq/text`:await this.emitTextFrame(e,t,r);return;case`//ly.img.ubq/graphic`:await this.emitGraphic(e,t,r);return;default:this.logger.emit(`UNSUPPORTED_BLOCK_TYPE`,{block:e,type:n})}}readLocalLayout(e){let t=this.toPoints(this.engine.block.getWidth(e)),n=this.toPoints(this.engine.block.getHeight(e)),r=this.engine.block.getFlipHorizontal(e),i=this.engine.block.getFlipVertical(e);return{x:this.toPoints(this.engine.block.getPositionX(e))-(r?t:0),y:this.toPoints(this.engine.block.getPositionY(e))-(i?n:0),width:t,height:n,rotation:S(this.engine,this.engine.block.getRotation(e)),flipHorizontal:r,flipVertical:i}}startElement(e,t,n,r,i){return n.element(e).attr(`Self`,this.allocateSelf(t,i)).attr(`Name`,this.engine.block.getName(t)).attr(`AppliedObjectStyle`,`ObjectStyle/$ID/[None]`).attr(`Visible`,this.engine.block.isVisible(t)?`true`:`false`).attr(`ItemTransform`,this.elementTransform(r))}elementTransform(e){return H(ie(this.pageContentTransform,ae(e)))}async emitTextFrame(e,t,n){if(await this.requiresTextXmlRaster(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_XML_RASTERIZED`))return;this.logger.emit(`TEXT_XML_RASTERIZATION_FAILED`,{block:e})}if(this.engine.block.getTextRuns(e).some(e=>e.textCase===`Lowercase`||e.textCase===`Titlecase`)){let n=!1;try{await this.renderTextOnce(e),n=h(this.engine,e)}catch{}if(!n){if(await this.emitRasterizedPageBlock(e,t,`TEXT_CASE_RASTERIZED`))return;this.logger.emit(`TEXT_CASE_RASTERIZATION_FAILED`,{block:e})}}if(await this.requiresTextFontFallbackRaster(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_FONT_FALLBACK_RASTERIZED`))return;this.logger.emit(`TEXT_FONT_FALLBACK_RASTERIZATION_FAILED`,{block:e})}if((this.engine.block.getTextBackgroundColors?.(e,0,this.engine.block.getString(e,`text/text`).length))?.some(e=>B(e)>0)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_RANGE_BACKGROUND_RASTERIZED`))return;this.logger.emit(`TEXT_RANGE_BACKGROUND_RASTERIZATION_FAILED`,{block:e})}if(this.requiresTextStrokeRaster(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_STROKE_RASTERIZED`))return;this.logger.emit(`TEXT_STROKE_RASTERIZATION_FAILED`,{block:e})}if(at(this.engine,e).some(e=>e.textDecoration?.lines?.includes(`Overline`))){if(await this.emitRasterizedPageBlock(e,t,`TEXT_DECORATION_RASTERIZED`))return;this.logger.emit(`TEXT_DECORATION_RASTERIZATION_FAILED`,{block:e})}if(this.engine.block.getTextOnPath(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_PATH_RASTERIZED`))return;this.logger.emit(`TEXT_PATH_RASTERIZATION_FAILED`,{block:e})}if(this.engine.block.getFloat(e,`text/paragraphSpacing`)>0&&ot(this.engine.block.getTextRuns(e))){if(await this.emitRasterizedPageBlock(e,t,`TEXT_PARAGRAPH_SPACING_RASTERIZED`))return;this.logger.emit(`TEXT_PARAGRAPH_SPACING_RASTERIZATION_FAILED`,{block:e})}let r=this.engine.block.getString(e,`text/text`);if((/[\r\n]/.test(r)||!this.isSingleLine(e)||this.engine.block.getBool(e,`text/clipLinesOutsideOfFrame`)&&(this.engine.block.getTextVisibleLineCount(e)!==1||this.engine.block.getTextVisibleLineContent(e,0)!==r))&&await st(this.engine,e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_LEADING_RASTERIZED`))return;this.logger.emit(`TEXT_LEADING_RASTERIZATION_FAILED`,{block:e})}let i=this.engine.block.getBlendMode(e);if(i!==`Normal`&&i!==`PassThrough`&&this.engine.block.getBool(e,`backgroundColor/enabled`)&&B(this.engine.block.getColor(e,`backgroundColor/color`))>0){if(await this.emitRasterizedPageBlock(e,t,`TEXT_BACKGROUND_BLEND_RASTERIZED`,{blendMode:i}))return;this.logger.emit(`TEXT_BACKGROUND_BLEND_RASTERIZATION_FAILED`,{block:e,blendMode:i})}if(this.requiresTextPaintRaster(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_PAINT_RASTERIZED`))return;this.logger.emit(`TEXT_PAINT_RASTERIZATION_FAILED`,{block:e})}if(this.engine.block.getString(e,`text/text`).includes(` `)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_TABS_RASTERIZED`))return;this.logger.emit(`TEXT_TABS_RASTERIZATION_FAILED`,{block:e})}if(!this.claimScriptPreferences(e)){if(await this.emitRasterizedPageBlock(e,t,`TEXT_SCRIPT_RASTERIZED`))return;this.logger.emit(`TEXT_SCRIPT_RASTERIZATION_FAILED`,{block:e})}this.emitTextBackground(e,t,n);let{paint:a,alphaMultiplier:o}=this.textPaint(e),s=this.allocateUniqueId(`s${++this.idCounter}`);this.storyIds.push(s),this.files.set(`Stories/Story_${s}.xml`,await lt(this.engine,e,s,this.colors,this.logger,this.fontNames,a,(e,t,n)=>this.registerFont(e,t,n)));let c=this.engine.block.getBool(e,`text/clipLinesOutsideOfFrame`),l=null,u=!1;if(c)try{if(!this.engine.block.getBool(e,`text/hasClippedLines`)){let t=this.engine.block.getEnum(e,`width/mode`)===`Auto`,n=this.engine.block.getEnum(e,`height/mode`)===`Auto`;u=t,l=t?n?`HeightAndWidth`:`WidthOnly`:n?`HeightOnly`:null}}catch{}(!c||u)&&(n=this.withTrackingAllowance(e,n));let d=this.startElement(`TextFrame`,e,t,n,`text_`).attr(`ParentStory`,s).attr(`ContentType`,`TextType`),f=this.engine.block.getEnum(e,`text/verticalAlignment`),p=vt(f);U(d,W(n.width,n.height));let m=this.isSingleLine(e),g=d.element(`TextFramePreference`).attr(`AutoSizingType`,l??(c?`Off`:m?`HeightAndWidth`:`HeightOnly`)).attr(`AutoSizingReferencePoint`,m||u?_t(f,this.effectiveTextAlignment(e)):gt(f));(u||m&&!c)&&g.attr(`UseNoLineBreaksForAutoSizing`,`true`);let _=p===`CenterAlign`||p===`BottomAlign`?null:this.firstBaselineOffset(e);_!=null&&g.attr(`FirstBaselineOffset`,`FixedHeight`).attr(`MinimumFirstBaselineOffset`,String(_)),p&&g.attr(`VerticalJustification`,p),this.applyTransparency(e,d,o)}async prepareTextFontFallbacks(){for(let e of this.engine.block.findByType(`text`))if(q(this.engine,e)&&await this.requiresTextFontFallbackRaster(e))try{await this.renderTextOnce(e)}catch{}}async requiresTextFontFallbackRaster(e){for(let t of this.engine.block.getTextRuns(e)){if(!t.resolvedFontFileUri||!/[\p{Letter}\p{Number}\p{Punctuation}\p{Symbol}]/u.test(t.text))continue;let e=t.resolvedFontFileUri.split(`#`)[0];this.fontBytes.has(e)||this.fontBytes.set(e,(async()=>{try{let t=await $(this.engine,e);return t?(await Q(t))?.bytes??null:null}catch{return null}})());let n=await this.fontBytes.get(e);if(n&&Ye(n,t.text)===!0)return!0}return!1}async requiresTextXmlRaster(e){if(k(this.engine.block.getString(e,`text/text`)))return!0;for(let t of this.engine.block.getTextRuns(e)){let e=t.resolvedFontFileUri?await this.fontNames(t.resolvedFontFileUri):null,n=e?.family??t.typeface?.name??``,r=e&&/[#&]wght=/.test(t.resolvedFontFileUri??``)?X(e,t.resolvedFontFileUri)??``:e?.subfamily??``;if(k(n)||k(r)||k(e?.postScriptName??``))return!0}return!1}requiresTextStrokeRaster(e){return this.hasVisibleStroke(e)&&(this.engine.block.getStrokeStyle(e)!==`Solid`||this.engine.block.getStrokeDashArray(e).some(e=>e>0)||this.engine.block.getStrokePosition(e)===`Inner`)}hasVisibleStroke(e){return this.engine.block.supportsStroke(e)&&this.engine.block.isStrokeEnabled(e)&&this.engine.block.getStrokeWidth(e)>0&&B(this.engine.block.getStrokeColor(e))>0}requiresGraphicStrokeRaster(e,t){return this.hasVisibleStroke(e)?this.engine.block.getStrokeStyle(e)!==`Solid`||this.engine.block.getStrokeDashArray(e).some(e=>e>0)?!0:this.engine.block.getStrokeStartCap(e)===`Butt`&&this.engine.block.getStrokeEndCap(e)===`Butt`?!1:this.resolveShapeGeometry(e,t).subPaths.some(e=>e.open):!1}strokeDetails(e){return{dashArray:this.engine.block.getStrokeDashArray(e),dashOffset:this.engine.block.getStrokeDashOffset(e),startCap:this.engine.block.getStrokeStartCap(e),endCap:this.engine.block.getStrokeEndCap(e),dashStartCap:this.engine.block.getStrokeDashStartCap(e),dashEndCap:this.engine.block.getStrokeDashEndCap(e)}}requiresTextPaintRaster(e){let t=at(this.engine,e),n=this.engine.block.isFillEnabled(e)?t.map(e=>B(e.color)).filter(e=>e>0):[],r=this.engine.block.isStrokeEnabled(e)&&this.engine.block.getStrokeWidth(e)>0&&B(this.engine.block.getStrokeColor(e))>0,i=r?B(this.engine.block.getStrokeColor(e)):1,a=n.some(e=>e<1),o=new Set(n).size>1,s=this.engine.block.getBool(e,`backgroundColor/enabled`)&&B(this.engine.block.getColor(e,`backgroundColor/color`))>0,c=t.some(e=>e.textDecoration?.underlineColor&&B(e.textDecoration.underlineColor)!==B(e.color));return o||r&&n.length>0&&(a||i<1)||s&&(i<1||this.engine.block.getOpacity(e)<1)||c}async emitRasterizedPageBlock(e,t,n,r={}){if(this.currentPage===null)return!1;let i=this.engine.block.getParent(this.currentPage);if(i===null)return!1;let a=null,o=null,s,c,l=this.engine.block.getWidth(this.currentPage),u=this.engine.block.getHeight(this.currentPage),d=this.toPoints(l),f=this.toPoints(u);try{if(e===this.currentPage){a=await Ze(this.engine,e);for(let e of this.engine.block.getChildren(a))this.engine.block.destroy(e);this.engine.block.appendChild(i,a)}else a=this.engine.block.create(`page`),this.engine.block.setWidth(a,l),this.engine.block.setHeight(a,u),this.engine.block.setFillEnabled(a,!1),this.engine.block.appendChild(i,a),o=await Ze(this.engine,e),this.engine.block.appendChild(a,o),this.engine.block.setVisible(o,!0),this.engine.block.setOpacity(o,1);let t=Math.min(4,2600/Math.max(d,f,1)),n=await this.engine.block.export(a,this.transaction.exportOptions({mimeType:`image/png`,targetWidth:Math.max(1,Math.round(d*t)),targetHeight:Math.max(1,Math.round(f*t))}));if(s=new Uint8Array(await n.arrayBuffer()),c=me(s,`image/png`),c===null||c.width<=0||c.height<=0)return!1}catch{return!1}finally{o!==null&&this.engine.block.isValid(o)&&this.engine.block.destroy(o),a!==null&&this.engine.block.isValid(a)&&this.engine.block.destroy(a)}let p=this.startElement(`Rectangle`,e,t,{x:0,y:0,width:d,height:f,rotation:0,flipHorizontal:!1,flipVertical:!1},`baked_`).attr(`ContentType`,`GraphicType`).attr(`FillColor`,`Swatch/None`).attr(`StrokeColor`,`Swatch/None`).attr(`StrokeWeight`,`0`);e===this.currentPage&&p.attr(`ItemTransform`,`1 0 0 1 0 0`),U(p,W(d,f)),this.applyTransparency(e,p,1,void 0,1,!1);let m=p.element(`Image`).attr(`Self`,this.allocateUniqueId(`img_u${++this.idCounter}`)).attr(`ItemTransform`,H([d/c.width,0,0,f/c.height,0,0])).attr(`ImageTypeName`,`$ID/PNG`),h=m.element(`Properties`);return h.element(`GraphicBounds`).attr(`Left`,`0`).attr(`Top`,`0`).attr(`Right`,R(c.width)).attr(`Bottom`,R(c.height)),h.element(`Contents`).cdata(K(s)),m.element(`Link`).attr(`Self`,this.allocateUniqueId(`link_u${++this.idCounter}`)).attr(`StoredState`,`Embedded`).attr(`LinkResourceURI`,`file:embedded`),this.logger.emit(n,{block:e,...r}),!0}isSingleLine(e){try{if(Math.abs(this.engine.block.getRotation(e))>1e-6||this.engine.block.getFlipVertical(e)||this.engine.block.getFlipHorizontal(e))return!1;let t=this.engine.block.getTextCharacterInkBoxes(e).filter(e=>e.width>0&&e.height>0);if(t.length===0)return!1;let n=t[0].baselineY;return t.every(e=>Math.abs(e.baselineY-n)<.01)}catch{return!1}}firstBaselineOffset(e){let t=this.currentPage,n=null;try{if(Math.abs(this.engine.block.getRotation(e))>1e-6||this.engine.block.getFlipVertical(e))return null;if(t!==null){let e=this.engine.block.getRotation(t);e!==0&&(this.engine.block.setRotation(t,0),n=e)}let[r]=this.engine.block.getTextCharacterInkBoxes(e,0,1);if(!r)return null;let i=this.engine.block.getGlobalBoundingBoxY(e),a=r.baselineY-i,o=this.toPoints(this.pageContentTransform[3]<0?this.engine.block.getHeight(e)-a:a);return o>0?Number(o.toFixed(4)):null}catch{return null}finally{t!==null&&n!==null&&this.engine.block.setRotation(t,n)}}emitTextBackground(e,t,n){let r;try{if(!this.engine.block.getBool(e,`backgroundColor/enabled`))return;r=this.engine.block.getColor(e,`backgroundColor/color`)}catch{return}let i=B(r);if(i<=0)return;this.logger.emit(`TEXT_BACKGROUND_AS_RECT`,{block:e});let a=t=>this.toPoints(this.engine.block.getFloat(e,`backgroundColor/padding${t}`)),[o,s,c,l]=[a(`Left`),a(`Top`),a(`Right`),a(`Bottom`)],u=t.element(`Rectangle`).attr(`Self`,this.allocateUniqueId(`textbg_u${++this.idCounter}`)).attr(`Name`,this.engine.block.getName(e)).attr(`AppliedObjectStyle`,`ObjectStyle/$ID/[None]`).attr(`Visible`,this.engine.block.isVisible(e)?`true`:`false`).attr(`ItemTransform`,this.elementTransform(n)).attr(`ContentType`,`Unassigned`).attr(`FillColor`,this.colors.register(V(r))).attr(`StrokeWeight`,`0`).attr(`StrokeColor`,`Swatch/None`);`tint`in r&&r.tint!==1&&u.attr(`FillTint`,R(Math.max(0,Math.min(1,r.tint))*100));let d=this.toPoints(this.engine.block.getFloat(e,`backgroundColor/cornerRadius`));if(d>0)for(let e of[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`])u.attr(`${e}CornerOption`,`RoundedCorner`).attr(`${e}CornerRadius`,R(d));U(u,W(n.width+o+c,n.height+s+l).map(e=>({...e,points:e.points.map(e=>({anchor:wt(e.anchor,-o,-s),left:wt(e.left,-o,-s),right:wt(e.right,-o,-s)}))}))),this.applyTransparency(e,u,1,void 0,1,!1),this.appendFillTransparency(u,i)}textPaint(e){let t=!0;try{t=this.engine.block.isFillEnabled(e)}catch{}let n=null,r=1;try{if(this.engine.block.supportsStroke(e)&&this.engine.block.isStrokeEnabled(e)){let i=this.engine.block.getStrokeWidth(e);if(i>0){let a=this.engine.block.getStrokeColor(e);n=B(a)>0?{color:a,weightPt:this.toPoints(i),position:this.engine.block.getStrokePosition(e),cornerGeometry:this.engine.block.getStrokeCornerGeometry(e)}:null;let o=B(a);if(o>0&&o<1){let n=this.engine.block.getTextRuns(e);!(t&&n.some(e=>B(e.color)>0))&&n.length>0?(r=o,this.logger.emit(`TEXT_STROKE_ALPHA_FOLDED`,{block:e})):this.logger.emit(`TEXT_STROKE_ALPHA_DROPPED`,{block:e})}}}}catch{n=null,r=1}if(t&&r===1)try{let t=this.engine.block.getTextRuns(e),n=[...new Set(t.map(e=>B(e.color)).filter(e=>e>0))];n.length===1&&n[0]<1?(r=n[0],this.logger.emit(`TEXT_FILL_ALPHA_FOLDED`,{block:e})):n.some(e=>e<1)&&this.logger.emit(`TEXT_FILL_ALPHA_DROPPED`,{block:e})}catch{}return{paint:{fillEnabled:t,stroke:n},alphaMultiplier:r}}withTrackingAllowance(e,t){if(t.rotation!==0||t.flipHorizontal||this.engine.block.getEnum(e,`width/mode`)!==`Auto`)return t;let n=ht(this.engine,e);if(n<=0)return t;let r={Left:0,Center:.5,Right:1}[this.isSingleLine(e)?this.effectiveTextAlignment(e):this.engine.block.getEnum(e,`text/horizontalAlignment`)]??0;return{...t,width:t.width+n,x:t.x-n*r}}effectiveTextAlignment(e){let t=this.engine.block.getEnum(e,`text/horizontalAlignment`);try{t=this.engine.block.getTextHorizontalAlignment(e,0)??t}catch{}return t===`Auto`||t===`Justify`?y(this.engine.block.getString(e,`text/text`))?`Right`:`Left`:t}async emitGraphic(e,t,n){if(this.engine.block.supportsShape(e)){let n=this.engine.block.getShape(e);if(n!=null&&this.engine.block.isValid(n)&&this.engine.block.getType(n)===`//ly.img.ubq/shape/line`){if(await this.emitRasterizedPageBlock(e,t,`LINE_SHAPE_RASTERIZED`))return;this.logger.emit(`LINE_SHAPE_RASTERIZATION_FAILED`,{block:e})}}if(this.requiresFillRuleRaster(e)){if(await this.emitRasterizedPageBlock(e,t,`FILL_RULE_RASTERIZED`))return;this.logger.emit(`FILL_RULE_RASTERIZATION_FAILED`,{block:e})}if(this.hasRoundedNonRectShape(e)){if(await this.emitRasterizedPageBlock(e,t,`SHAPE_CORNERS_RASTERIZED`))return;this.logger.emit(`SHAPE_CORNERS_RASTERIZATION_FAILED`,{block:e})}if(this.requiresGraphicStrokeRaster(e,n)){let n=this.strokeDetails(e);if(await this.emitRasterizedPageBlock(e,t,`STROKE_RASTERIZED`,n))return;this.logger.emit(`STROKE_RASTERIZATION_FAILED`,{block:e,...n})}let r=this.safeGetFill(e),i=r!=null&&this.engine.block.isValid(r)?this.engine.block.getType(r):null;if(i!==null&&!this.isNativeFill(i)&&this.engine.block.isFillEnabled(e)){if(await this.emitRasterizedPageBlock(e,t,`UNSUPPORTED_FILL_RASTERIZED`))return;this.logger.emit(`UNSUPPORTED_FILL_RASTERIZATION_FAILED`,{block:e,fillType:i})}if(this.hasBakedAppearance(e)){if(await this.emitRasterizedPageBlock(e,t,`EFFECTS_BAKED`))return;this.logger.emit(`EFFECTS_BAKE_FAILED`,{block:e})}if(i===`//ly.img.ubq/fill/video`&&this.engine.block.isFillEnabled(e)){if(await this.emitRasterizedPageBlock(e,t,`EFFECTS_BAKED`))return;this.logger.emit(`VIDEO_FILL_DROPPED`,{block:e})}i===`//ly.img.ubq/fill/image`&&this.engine.block.isFillEnabled(e)&&await this.emitImageRectangle(e,t,n,r)||this.emitShape(e,t,n,r,i)}isNativeFill(e){return[`//ly.img.ubq/fill/color`,`//ly.img.ubq/fill/image`,`//ly.img.ubq/fill/video`,`//ly.img.ubq/fill/gradient/linear`,`//ly.img.ubq/fill/gradient/radial`].includes(e)}hasRoundedNonRectShape(e){if(!this.engine.block.supportsShape(e))return!1;let t=this.engine.block.getShape(e);if(t==null||!this.engine.block.isValid(t))return!1;let n={"//ly.img.ubq/shape/polygon":`shape/polygon/cornerRadius`,"//ly.img.ubq/shape/star":`shape/star/cornerRadius`,"//ly.img.ubq/shape/vector_path":`shape/vector_path/cornerRadius`}[this.engine.block.getType(t)];return n!==void 0&&this.engine.block.getFloat(t,n)>0}requiresFillRuleRaster(e){if(!this.engine.block.supportsShape(e)||!this.engine.block.isFillEnabled(e))return!1;let t=this.engine.block.getShape(e);if(t==null||!this.engine.block.isValid(t)||this.engine.block.getType(t)!==`//ly.img.ubq/shape/vector_path`||this.engine.block.getEnum(t,`shape/vector_path/fillRule`)!==`NonZero`)return!1;let n=de(this.engine.block.getString(t,`vector_path/path`),1,1);return`error`in n||!oe(n.subPaths)}hasBakedAppearance(e){try{if(this.engine.block.supportsBlur(e)&&this.engine.block.isBlurEnabled(e)){let t=this.engine.block.getBlur(e);if(t!=null&&this.engine.block.isValid(t))return!0}return this.engine.block.supportsEffects(e)&&this.engine.block.getEffects(e).some(e=>this.engine.block.isValid(e)&&this.engine.block.isEffectEnabled(e))}catch{return!1}}safeGetFill(e){try{return this.engine.block.supportsFill(e)?this.engine.block.getFill(e):null}catch{return null}}emitShape(e,t,n,r,i){let{tag:a,subPaths:o}=this.resolveShapeGeometry(e,n),s=this.startElement(a,e,t,n,`shape_`).attr(`ContentType`,`Unassigned`),c={alphaMultiplier:1};r!=null&&i!=null&&i!==`//ly.img.ubq/fill/image`&&this.engine.block.isFillEnabled(e)?c=this.applyFillAttributes(s,r,i,n):s.attr(`FillColor`,`Swatch/None`);let l=this.applyStrokeAttributes(e,s);this.applyCornerRadii(e,s),U(s,o),this.applyTransparency(e,s,1,void 0,l),this.appendFillTransparency(s,c.alphaMultiplier,c.feather)}resolveShapeGeometry(e,t){let n=null;try{n=this.engine.block.supportsShape(e)?this.engine.block.getShape(e):null}catch{n=null}let r=n!=null&&this.engine.block.isValid(n)?this.engine.block.getType(n):null;switch(r){case`//ly.img.ubq/shape/ellipse`:return{tag:`Oval`,subPaths:ce(t.width,t.height)};case`//ly.img.ubq/shape/rect`:case null:return{tag:`Rectangle`,subPaths:W(t.width,t.height)};case`//ly.img.ubq/shape/star`:{let e=this.engine.block.getInt(n,`shape/star/points`),r=this.engine.block.getFloat(n,`shape/star/innerDiameter`);return{tag:`Polygon`,subPaths:le(t.width,t.height,e,r)}}case`//ly.img.ubq/shape/polygon`:{let e=this.engine.block.getInt(n,`shape/polygon/sides`);return{tag:`Polygon`,subPaths:ue(t.width,t.height,e)}}case`//ly.img.ubq/shape/vector_path`:{let r=this.engine.block.getString(n,`vector_path/path`),i=this.engine.block.getFloat(n,`vector_path/width`),a=this.engine.block.getFloat(n,`vector_path/height`),o=de(r,i>0?t.width/i:1,a>0?t.height/a:1);return`subPaths`in o?{tag:`Polygon`,subPaths:o.subPaths}:(this.logger.emit(`UNSUPPORTED_PATH_DATA`,{block:e,reason:o.error}),{tag:`Rectangle`,subPaths:W(t.width,t.height)})}default:return this.logger.emit(`UNSUPPORTED_SHAPE_TYPE`,{block:e,shapeType:r}),{tag:`Rectangle`,subPaths:W(t.width,t.height)}}}applyFillAttributes(e,t,n,r){if(n===`//ly.img.ubq/fill/color`){let n=this.engine.block.getColor(t,`fill/color/value`),r=B(n);return r<=0?(e.attr(`FillColor`,`Swatch/None`),{alphaMultiplier:1}):(e.attr(`FillColor`,this.colors.register(V(n))),`tint`in n&&n.tint<1&&e.attr(`FillTint`,R(n.tint*100)),r<1&&this.logger.emit(`FILL_ALPHA_FOLDED`),{alphaMultiplier:r})}if(n===`//ly.img.ubq/fill/gradient/linear`||n===`//ly.img.ubq/fill/gradient/radial`){let i=this.engine.block.getGradientColorStops(t,`fill/gradient/colors`),a=n===`//ly.img.ubq/fill/gradient/linear`,o=a?this.applyLinearGradientGeometry(e,t,r):this.applyRadialGradientGeometry(e,t,r);if(o.length===0&&i.length>0){let t=i[i.length-1].color,n=B(t);return this.logger.emit(`DEGENERATE_GRADIENT_AS_SOLID`),n<=0?(e.attr(`FillColor`,`Swatch/None`),{alphaMultiplier:1}):(e.attr(`FillColor`,this.colors.register(V(t))),`tint`in t&&t.tint<1&&e.attr(`FillTint`,R(t.tint*100)),n<1&&this.logger.emit(`FILL_ALPHA_FOLDED`),{alphaMultiplier:n})}e.attr(`FillColor`,this.colors.registerGradient(a?`Linear`:`Radial`,i));let s=i.map(e=>B(e.color)),c=Math.min(...s);return Math.max(...s)-c<.001?(c<1&&this.logger.emit(`FILL_ALPHA_FOLDED`),{alphaMultiplier:c}):(this.logger.emit(`GRADIENT_ALPHA_AS_FEATHER`),{alphaMultiplier:1,feather:{type:a?`Linear`:`Radial`,geometry:o,stops:re(i.map((e,t)=>({opacity:s[t],location:e.stop})))}})}return e.attr(`FillColor`,`Swatch/None`),{alphaMultiplier:1}}applyLinearGradientGeometry(e,t,n){let r={x:this.engine.block.getFloat(t,`fill/gradient/linear/startPointX`),y:this.engine.block.getFloat(t,`fill/gradient/linear/startPointY`)},i={x:this.engine.block.getFloat(t,`fill/gradient/linear/endPointX`),y:this.engine.block.getFloat(t,`fill/gradient/linear/endPointY`)},a={x:r.x*n.width,y:r.y*n.height},o={x:i.x*n.width,y:i.y*n.height},s=o.x-a.x,c=o.y-a.y,l=Math.hypot(s,c);if(l===0)return{start:{x:0,y:0},angle:0,length:0};let u=Math.atan2(-c,s)*180/Math.PI;return e.attr(`GradientFillStart`,`${R(a.x)} ${R(a.y)}`).attr(`GradientFillAngle`,R(u)).attr(`GradientFillLength`,Tt(l)),{start:a,angle:u,length:l}}applyRadialGradientGeometry(e,t,n){let r=this.engine.block.getFloat(t,`fill/gradient/radial/centerPointX`),i=this.engine.block.getFloat(t,`fill/gradient/radial/centerPointY`),a=this.engine.block.getFloat(t,`fill/gradient/radial/radius`)*Math.min(n.width,n.height),o={start:{x:r*n.width,y:i*n.height},angle:0,length:a};return a===0||e.attr(`GradientFillStart`,`${R(r*n.width)} ${R(i*n.height)}`).attr(`GradientFillLength`,Tt(a)),o}applyStrokeAttributes(e,t){let n=()=>(t.attr(`StrokeWeight`,`0`).attr(`StrokeColor`,`Swatch/None`),1);try{if(!this.engine.block.supportsStroke(e)||!this.engine.block.isStrokeEnabled(e))return n()}catch{return n()}let r=this.engine.block.getStrokeWidth(e);if(r<=0)return n();let i=this.engine.block.getStrokeColor(e);t.attr(`StrokeColor`,this.colors.register(V(i))).attr(`StrokeWeight`,R(this.toPoints(r))),`tint`in i&&i.tint<1&&t.attr(`StrokeTint`,R(i.tint*100));let a=this.engine.block.getStrokePosition(e),o=a===`Inner`?`InsideAlignment`:a===`Outer`?`OutsideAlignment`:`CenterAlignment`;t.attr(`StrokeAlignment`,o).attr(`EndJoin`,`${this.engine.block.getStrokeCornerGeometry(e)}EndJoin`);let s=Et[this.engine.block.getStrokeStyle(e)];return s&&t.attr(`StrokeType`,s),B(i)}applyCornerRadii(e,t){let n=null;try{n=this.engine.block.supportsShape(e)?this.engine.block.getShape(e):null}catch{return}if(n!=null&&this.engine.block.isValid(n)&&this.engine.block.getType(n)===`//ly.img.ubq/shape/rect`)for(let[e,r]of[[`TL`,`TopLeft`],[`TR`,`TopRight`],[`BL`,`BottomLeft`],[`BR`,`BottomRight`]]){let i=0;try{i=this.engine.block.getFloat(n,`shape/rect/cornerRadius${e}`)}catch{continue}i>0&&t.attr(`${r}CornerOption`,`RoundedCorner`).attr(`${r}CornerRadius`,R(this.toPoints(i)))}}applyTransparency(e,t,n,r,i=1,a=!0){let o=null;try{let n=this.engine.block.getBlendMode(e);n===`Normal`&&t.tag===`Group`?o=n:n!==`Normal`&&n!==`PassThrough`&&(Dt.has(n)?o=n:this.logger.emit(`BLEND_MODE_DROPPED`,{block:e,blendMode:n}))}catch{}let s=(this.engine.block.supportsOpacity(e)?this.engine.block.getOpacity(e):1)*n,c=a&&this.engine.block.supportsDropShadow(e)&&this.engine.block.isDropShadowEnabled(e)&&this.isShadowSizeSupported(e)&&this.isShadowOffsetSupported(e);if(s>=1&&!c&&!r&&o==null&&i>=1)return;if(i<1&&this.logger.emit(`STROKE_ALPHA_AS_TRANSPARENCY`,{block:e}),s>=1&&!c&&!r&&o==null){this.appendStrokeTransparency(t,i);return}let l=t.element(`TransparencySetting`);if(s<1||o!=null){let e=l.element(`BlendingSetting`);o!=null&&(e.attr(`BlendMode`,o),t.tag===`Group`&&o===`Normal`&&e.attr(`IsolateBlending`,`true`)),s<1&&e.attr(`Opacity`,R(Math.max(0,s)*100))}if(c){let t=this.engine.block.getDropShadowColor(e),n=B(t);l.element(`DropShadowSetting`).attr(`Mode`,`Drop`).attr(`XOffset`,R(this.toPoints(this.engine.block.getDropShadowOffsetX(e)))).attr(`YOffset`,R(this.toPoints(this.engine.block.getDropShadowOffsetY(e)))).attr(`Size`,R(this.toPoints(this.engine.block.getDropShadowBlurRadiusX(e)))).attr(`Opacity`,R(n*100)).attr(`EffectColor`,this.colors.registerWithTint(V(t)))}r&&this.appendGradientFeather(l,r),this.appendStrokeTransparency(t,i)}isShadowSizeSupported(e){let t=this.toPoints(this.engine.block.getDropShadowBlurRadiusX(e)),n=this.toPoints(this.engine.block.getDropShadowBlurRadiusY(e));return t>=0&&t<=144&&n>=0&&n<=144}isShadowOffsetSupported(e){let t=this.toPoints(this.engine.block.getDropShadowOffsetX(e)),n=this.toPoints(this.engine.block.getDropShadowOffsetY(e));return Number.isFinite(t)&&Number.isFinite(n)&&Math.abs(t)<=1e3&&Math.abs(n)<=1e3}appendStrokeTransparency(e,t){t>=1||e.element(`StrokeTransparencySetting`).element(`BlendingSetting`).attr(`Opacity`,R(Math.max(0,t)*100))}appendFillTransparency(e,t,n){if(t>=1&&!n)return;let r=e.element(`FillTransparencySetting`);t<1&&r.element(`BlendingSetting`).attr(`Opacity`,R(Math.max(0,t)*100)),n&&this.appendGradientFeather(r,n)}appendGradientFeather(e,t){let n=e.element(`GradientFeatherSetting`).attr(`Applied`,`true`).attr(`Type`,t.type).attr(`GradientStart`,`${R(t.geometry.start.x)} ${R(t.geometry.start.y)}`).attr(`Length`,Tt(t.geometry.length));t.type===`Linear`&&n.attr(`Angle`,R(t.geometry.angle)),t.stops.forEach((e,t)=>{n.element(`OpacityGradientStop`).attr(`Self`,this.allocateUniqueId(`feather_u${++this.idCounter}s${t}`)).attr(`Opacity`,R(e.opacity*100)).attr(`Location`,R(e.location*100))})}async emitImageRectangle(e,t,n,r){let i=this.resolveImageUri(r),a=i?await pe(this.engine,i):null;if(!a)return this.logger.emit(`IMAGE_BYTES_UNAVAILABLE`,{block:e,uri:i}),!1;let{tag:o,subPaths:s}=this.resolveShapeGeometry(e,n),c=this.startElement(o,e,t,n,`image_`).attr(`ContentType`,`GraphicType`).attr(`FillColor`,`Swatch/None`),l=this.applyStrokeAttributes(e,c);this.applyCornerRadii(e,c),U(c,s);let u=a.isSvg?ge(a.bytes):a.pixelSize,{matrix:d,naturalWidth:f,naturalHeight:p}=this.computeImageContentTransform(e,n,u);this.applyTransparency(e,c,1,void 0,l);let m=c.element(a.isSvg?`SVG`:`Image`).attr(`Self`,this.allocateUniqueId(`img_u${++this.idCounter}`)).attr(`ItemTransform`,H(d));a.isSvg||m.attr(`ImageTypeName`,_e(a.mimeType));let h=m.element(`Properties`);return h.element(`GraphicBounds`).attr(`Left`,`0`).attr(`Top`,`0`).attr(`Right`,R(f)).attr(`Bottom`,R(p)),h.element(`Contents`).cdata(K(a.bytes)),m.element(`Link`).attr(`Self`,this.allocateUniqueId(`link_u${++this.idCounter}`)).attr(`StoredState`,`Embedded`).attr(`LinkResourceURI`,`file:embedded`),!0}resolveImageUri(e){try{let t=this.engine.block.getSourceSet(e,`fill/image/sourceSet`);if(t.length>0)return t[0].uri}catch{}try{return this.engine.block.getString(e,`fill/image/imageFileURI`)||null}catch{return null}}computeImageContentTransform(e,t,n){let r;try{r=this.engine.block.supportsCrop(e)}catch{r=!1}let i=t.width,a=t.height,o=0,s=0,c=0;r&&(i=Math.max(this.engine.block.getCropScaleX(e)*t.width,1e-6),a=Math.max(this.engine.block.getCropScaleY(e)*t.height,1e-6),o=this.engine.block.getCropTranslationX(e)*t.width,s=this.engine.block.getCropTranslationY(e)*t.height,c=S(this.engine,this.engine.block.getCropRotation(e)));let l=n?.width??i,u=n?.height??a,d=i/l,f=a/u,p=Math.cos(c),m=Math.sin(c);return{matrix:[p*d,m*d,-m*f,p*f,o,s],naturalWidth:l,naturalHeight:u}}};exports.IDMLExporter=Ot,exports.Logger=rt,exports.collectDocumentFonts=He,exports.exportIdml=bt,exports.exportIdmlPackage=xt;
|