@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,14 +1,12 @@
|
|
|
1
|
-
var Be="0.1.0",Nn=`https://staticimgly.com/imgly/gfonts/${Be}/dist`;function Xe(i){let t=new TextEncoder().encode(i),e=new Uint8Array(t.length),n=0;for(let r=0;r<t.length;r++){if(t[r]!==37){e[n++]=t[r];continue}let s=String.fromCharCode(t[r+1]??0,t[r+2]??0);if(!/^[0-9a-f]{2}$/i.test(s))return null;e[n++]=Number.parseInt(s,16),r+=2}return e.subarray(0,n)}async function ut(i,t){try{if(t.startsWith("data:")){let r=t.match(/^data:([^,]*),(.*)$/s);if(!r)return null;if(!/;base64$/i.test(r[1]))return Xe(r[2]);let s=atob(decodeURIComponent(r[2]));return Uint8Array.from(s,o=>o.charCodeAt(0))}let e=typeof i.editor?.getAbsoluteURI=="function"?await i.editor.getAbsoluteURI(t):t;if(e!==t&&e.startsWith("data:"))return ut(i,e);if(e.startsWith("buffer://"))return new Uint8Array(i.editor.getBufferData(e,0,i.editor.getBufferLength(e)));if(e.startsWith("file://")){let{readFile:r}=await import("fs/promises"),{fileURLToPath:s}=await import("url");return new Uint8Array(await r(s(e)))}if(/^https?:\/\//.test(e)){let r=await fetch(e);return r.ok?new Uint8Array(await r.arrayBuffer()):null}let n=null;return i.editor.getResourceData(e,0,r=>(n=new Uint8Array(r),!1)),n}catch{return null}}function mt(i,t){if(t==="Lowercase")return i.toLowerCase();if(t==="Uppercase")return i.toUpperCase();if(t!=="Titlecase")return i;let e=new Intl.Segmenter("en-US",{granularity:"word"});return i.split(/([:\uFE55\uFF1A])/u).map(n=>Array.from(e.segment(n),({segment:r,isWordLike:s})=>{if(!s)return r;let o=String.fromCodePoint(r.codePointAt(0)),a=r.toLowerCase();return Ge(o)+a.slice(o.toLowerCase().length)}).join("")).join("")}var $e=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 Ge(i){let t=i.codePointAt(0);return t>=452&&t<=460?String.fromCodePoint(t-(t-452)%3+1):t>=497&&t<=499?"\u01F2":t>=4304&&t<=4351?i:t>=8064&&t<=8111?String.fromCodePoint(t|8):$e.get(t)??i.toUpperCase()}function vt(i,t,e){try{e??=i.block.getTextRuns(t);let n=g=>g==="Lowercase"||g==="Titlecase",r=e.map(g=>n(g.textCase)?mt(g.text,g.textCase):g.text);if(!e.some(g=>n(g.textCase)))return r;if(e.map(g=>g.text).join("")!==i.block.getString(t,"text/text")||!i.block.getTextVisibleLineCount||!i.block.getTextVisibleLineContent)return;let s=g=>g.map((f,d)=>e[d].textCase==="Uppercase"?f.toUpperCase():f).join(""),o=s(r),a=[...r],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=mt(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=i.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)=>i.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 r;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=mt(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 ee(i,t){return vt(i,t)!==void 0}var ze=[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],Ze=[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 te(i,t){let e=0,n=t.length/2-1;for(;e<=n;){let r=e+n>>>1;if(i<t[r*2])n=r-1;else if(i>t[r*2+1])e=r+1;else return!0}return!1}function gt(i){let t=0;for(let e of i){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(te(n,ze))return!0;if(!te(n,Ze))return!1}}return!1}function ne(i,t,e=1,n=0){if(!Number.isFinite(i)||i<=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 r=Math.abs(i*Math.max(t.underlineSize,10)/t.unitsPerEm)*e,s=-i*t.underlineOffset/t.unitsPerEm*(1+n);return{weight:r,offset:s+r/2}}var kt="x-adobe-psd",vn=64*1024;var kn=`${kt}/spot-colors`;var Mn=`${kt}/editable-text-alternate`,On=`${kt}/editable-text-alternates`;import Ue from"jszip";var re=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u;function Y(i){return re.test(i)}function Ut(i,t,e){return Y(i)?i.replace(new RegExp(re.source,"gu"),(n,r)=>(e?.({...t,codePoint:n.codePointAt(0),offset:r}),"\uFFFD")):i}function ie(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function He(i,t,e){return ie(Ut(i,t,e)).replace(/\r/g," ")}function We(i,t,e){return ie(Ut(i,t,e)).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ")}var Mt=class{constructor(t){this.text=t}serialize(t,e="#text"){return He(this.text,{tag:e,kind:"text"},t)}},Ot=class{constructor(t){this.data=t}serialize(t,e="#cdata"){return`<![CDATA[${Ut(this.data,{tag:e,kind:"cdata"},t).replace(/\]\]>/g,"]]]]><![CDATA[>").replace(/\r/g,"]]> <![CDATA[")}]]>`}},V=class i{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 i(t);return this.children.push(e),e}append(t){return this.children.push(t),this}text(t){return this.children.push(new Mt(t)),this}cdata(t){return this.children.push(new Ot(t)),this}serialize(t){let e=Array.from(this.attributes.entries()).map(([r,s])=>` ${r}="${We(s,{tag:this.tag,kind:"attribute",attribute:r},t)}"`).join("");if(this.children.length===0)return`<${this.tag}${e}/>`;let n=this.children.map(r=>r instanceof i?r.serialize(t):r.serialize(t,this.tag)).join("");return`<${this.tag}${e}>${n}</${this.tag}>`}},Ve='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';function bt(i,t=[],e){return`${[Ve,...t].join(`
|
|
2
|
-
`)}
|
|
3
|
-
${i.
|
|
4
|
-
`}var qe="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging";function J(i){return new V(`idPkg:${i}`).attr("xmlns:idPkg",qe).attr("DOMVersion","15.0")}function b(i){if(!Number.isFinite(i))return"0";let t=Math.round(i*1e6)/1e6;return String(t)}var At=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:r}=je(t),s=this.colors.get(e);if(s)return s.self;let o=this.allocateId(`Color/c${++this.colorCounter}`),a=new V("Color").attr("Self",o).attr("Name",`c${this.colorCounter}`).attr("Space",n).attr("ColorValue",r);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 r=this.resolveSpot(t.name)??{r:1,g:0,b:1,a:1},s=this.allocateId(`Color/c${++this.colorCounter}`),o=new V("Color").attr("Self",s).attr("Name",t.name).attr("Model","Spot").attr("Space","RGB").attr("ColorValue",[r.r,r.g,r.b].map(a=>b(xt(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=xt(t.tint);if(n===1)return e;let r=b(n*100),s=`${e}:${r}`,o=this.tints.get(s);if(!o){let a=this.allocateId(`Tint/t${++this.tintCounter}`),l=new V("Tint").attr("Self",a).attr("Name",`${"name"in t?t.name:e} ${r}%`).attr("BaseColor",e).attr("TintValue",r);o={self:a,element:l},this.tints.set(s,o)}return o.self}registerGradient(t,e){let n=this.allocateId(`Gradient/g${++this.gradientCounter}`),r=new V("Gradient").attr("Self",n).attr("Name",`g${this.gradientCounter}`).attr("Type",t);return e.forEach((s,o)=>{r.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(r),n}getResourceElements(){return[...Array.from(this.colors.values()).map(t=>t.element),...Array.from(this.tints.values()).map(t=>t.element),...this.gradients]}};function je(i){if("r"in i){let n=i,r=[n.r,n.g,n.b].map(s=>b(xt(s)*255)).join(" ");return{key:`RGB:${r}`,space:"RGB",colorValue:r}}let t=i,e=[t.c,t.m,t.y,t.k].map(n=>b(xt(n)*100)).join(" ");return{key:`CMYK:${e}`,space:"CMYK",colorValue:e}}function xt(i){return Math.max(0,Math.min(1,i))}function N(i){return"r"in i?i.a:1}function Q(i){return"r"in i&&i.a!==1?{...i,a:1}:i}function se(i){let t=[];for(let e=0;e<i.length;e++){let n=i[e],r=i[e+1];if(t.push(n),!r||r.location<=n.location)continue;let s=r.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+(r.location-n.location)*l})}}return t}function ae(i,t){let[e,n,r,s,o,a]=i,[l,c,u,h,p,g]=t;return[e*l+r*c,n*l+s*c,e*u+r*h,n*u+s*h,e*p+r*g+o,n*p+s*g+a]}function le(i){let{x:t,y:e,width:n,height:r,rotation:s,flipHorizontal:o,flipVertical:a}=i,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?r:0)]}function Rt(i){return i.map(b).join(" ")}function ce(i){if(i.length!==1||i[0].points.length>256)return!1;let t=i[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)),r=1e-10*n*n;if(!Number.isFinite(r))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))<=r&&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 st(i,t){let e=i.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 tt(i,t){return[{open:!1,points:[[0,0],[i,0],[i,t],[0,t]].map(n=>({anchor:n,left:n,right:n}))}]}var oe=.5522847498307936;function ue(i,t){let e=i/2,n=t/2,r=e,s=n,o=e*oe,a=n*oe;return[{open:!1,points:[{anchor:[r,0],left:[r-o,0],right:[r+o,0]},{anchor:[i,s],left:[i,s-a],right:[i,s+a]},{anchor:[r,t],left:[r+o,t],right:[r-o,t]},{anchor:[0,s],left:[0,s+a],right:[0,s-a]}]}]}function ge(i,t,e,n){let r=i/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=[r+r*c*Math.cos(l),s+s*c*Math.sin(l)];o.push({anchor:u,left:u,right:u})}return[{open:!1,points:o}]}function he(i,t,e){let n=i/2,r=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),r+r*Math.sin(l)];s.push({anchor:c,left:c,right:c})}return[{open:!1,points:s}]}var Bt=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Xt(i,t,e){let n=[],r=[],s=!0,o=0,a="",l=[0,0],c=[0,0],u=null,h=null,p=()=>{for(;o<i.length&&/[\s,]/.test(i[o]);)o++},g=()=>{p(),Bt.lastIndex=o;let y=Bt.exec(i);return y?(o=Bt.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=i[o];return y!=="0"&&y!=="1"?null:(o++,y==="1"?1:0)},T=()=>{r.length>0&&n.push({points:Ke(r,s),open:s}),r=[],s=!0},A=y=>{r.length===0&&r.push({anchor:l,left:l,right:l}),r.push({anchor:y,left:y,right:y}),l=y},m=(y,S,E)=>{r.length===0&&r.push({anchor:l,left:l,right:l}),r[r.length-1].right=y,r.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,ft=B*B/(F*F)+z*z/(C*C);if(ft>1){let X=Math.sqrt(ft);F*=X,C*=X}let dt=Math.max(0,(F*F*C*C-F*F*z*z-C*C*B*B)/(F*F*z*z+C*C*B*B)),pt=D!==v?1:-1,k=pt*Math.sqrt(dt)*(F*z)/C,nt=pt*Math.sqrt(dt)*(-C*B)/F,K=O*k-$*nt+(I+L)/2,Tt=$*k+O*nt+(_+U)/2,rt=Math.atan2((z-nt)/C,(B-k)/F),W=Math.atan2((-z-nt)/C,(-B-k)/F)-rt;v===0&&W>0&&(W-=2*Math.PI),v===1&&W<0&&(W+=2*Math.PI);let q=X=>[K+F*Math.cos(X)*O-C*Math.sin(X)*$,Tt+F*Math.cos(X)*$+C*Math.sin(X)*O],lt=X=>[-F*Math.sin(X)*O-C*Math.cos(X)*$,-F*Math.sin(X)*$+C*Math.cos(X)*O],it=Math.ceil(Math.abs(W)/(Math.PI/2)),ct=W/it,Z=4/3*Math.tan(ct/4);for(let X=0;X<it;X++){let Lt=rt+X*ct,Kt=Lt+ct,Yt=q(Lt),Nt=X===it-1?M:q(Kt),Jt=lt(Lt),Qt=lt(Kt);m([Yt[0]+Z*Jt[0],Yt[1]+Z*Jt[1]],[Nt[0]-Z*Qt[0],Nt[1]-Z*Qt[1]],Nt)}};for(;p(),!(o>=i.length);){let y=i[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&&r.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,r.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 Ke(i,t){if(t||i.length<2)return i;let e=i[0],n=i[i.length-1],r=1e-6;return Math.abs(e.anchor[0]-n.anchor[0])<r&&Math.abs(e.anchor[1]-n.anchor[1])<r?(e.left=n.left,i.slice(0,-1)):i}async function fe(i,t){let e=await ut(i,t);if(!e||e.length===0)return null;let n=Ye(e);return n?{bytes:e,mimeType:n,isSvg:n==="image/svg+xml",pixelSize:$t(e,n)}:null}function $t(i,t){let e=new DataView(i.buffer,i.byteOffset,i.byteLength);if(t==="image/png"&&i.length>=24)return{width:e.getUint32(16),height:e.getUint32(20)};if(t==="image/jpeg"){let n=2;for(;n+9<i.length;){if(i[n]!==255)return null;let r=i[n+1],s=e.getUint16(n+2);if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{height:e.getUint16(n+5),width:e.getUint16(n+7)};n+=2+s}return null}return null}function ot(i){if(typeof Buffer<"u")return Buffer.from(i).toString("base64");let t="",e=32768;for(let n=0;n<i.length;n+=e)t+=String.fromCharCode(...i.subarray(n,n+e));return btoa(t)}function Ye(i){if(i.length>=3&&i[0]===255&&i[1]===216)return"image/jpeg";if(i.length>=8&&i[0]===137&&i[1]===80&&i[2]===78&&i[3]===71)return"image/png";if(i.length>=2&&i[0]===66&&i[1]===77)return"image/bmp";if(i.length>=12&&i[0]===82&&i[1]===73&&i[2]===70&&i[3]===70&&i[8]===87&&i[9]===69&&i[10]===66&&i[11]===80)return"image/webp";let t=new TextDecoder("utf-8",{fatal:!1}).decode(i.subarray(0,1024));return/<svg[\s>]/i.test(t)?"image/svg+xml":null}function de(i){let t;try{t=new TextDecoder().decode(i)}catch{return null}let e=t.match(/<svg\b[^>]*>/i),n=e?e[0]:t,r=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=r(s[1]),c=r(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 pe(i){switch(i){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 et(i,t){for(let e=t;e!==null;e=i.block.getParent(e))if(!i.block.getBool(e,"includedInExport"))return!1;return!0}var Je=[1,2,6,16,17],Qe=["ExtraLight","UltraLight","SemiBold","DemiBold","ExtraBold","UltraBold","Thin","Light","Medium","Black","Heavy"];function tn(i,t){if(t!=="Regular")return{family:i,subfamily:t};for(let e of Qe){let n=` ${e}`;if(i.length>n.length&&i.endsWith(n))return{family:i.slice(0,-n.length),subfamily:e}}return{family:i,subfamily:t}}function at(i){try{let t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return null;let n=t.getUint16(4),r=-1,s=-1;for(let f=0;f<n;f++){let d=12+f*16,T=t.getUint32(d);T===1851878757&&(r=t.getUint32(d+8)),T===1719034226&&(s=t.getUint32(d+8))}if(r<0)return null;let o=s>=0?en(t,s):null,a=new Set(Je);if(o)for(let f of o.instances)a.add(f.nameId);let l=t.getUint16(r+2),c=r+t.getUint16(r+4),u=new Map;for(let f=0;f<l;f++){let d=r+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}=tn(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 en(i,t){let e=t+i.getUint16(t+4),n=i.getUint16(t+8),r=i.getUint16(t+10),s=i.getUint16(t+12),o=i.getUint16(t+14),a=p=>String.fromCharCode(i.getUint8(p),i.getUint8(p+1),i.getUint8(p+2),i.getUint8(p+3)),l=[],c={};for(let p=0;p<n;p++){let g=e+p*r,f=a(g);l.push(f),c[f]=i.getInt32(g+8)/65536}let u=[],h=e+n*r;for(let p=0;p<s;p++){let g=h+p*o,f={};for(let d=0;d<n;d++)f[l[d]]=i.getInt32(g+4+d*4)/65536;u.push({nameId:i.getUint16(g),coordinates:f})}return{instances:u,axisDefaults:c}}function yt(i){let t=i.split("#")[1];if(!t)return{};let e={};for(let n of t.split("&")){let[r,s]=n.split("=");/^[\x20-\x7e]{4}$/.test(r)&&s&&Number.isFinite(+s)&&(e[r]=+s)}return e}function j(i,t){let e=yt(t);if(Object.keys(e).length===0)return null;let n=r=>Object.entries(r.coordinates).every(([s,o])=>{let a=e[s]??i.axisDefaults[s];return a!=null&&Math.abs(a-o)<.01});return i.instances.find(n)?.subfamily??null}function wt(i){let t=new Map;return e=>{let n=e.split("#")[0],r=t.get(n);return r||(r=(async()=>{try{let s=await i(n);return s&&at(s)}catch{return null}})(),t.set(n,r)),r}}var nn={thin:100,extraLight:200,light:300,normal:400,medium:500,semiBold:600,bold:700,extraBold:800,heavy:900};function me(i,t,e,n){if(i.length!==1||!n)return i;let r=i[0],s=yt(e),o=r.typeface?.fonts.find(a=>a.uri===r.resolvedFontFileUri);return!r.text||r.from!==0||r.text!==t||r.resolvedFontFileUri.includes("#")||r.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!==nn[r.fontWeight]||r.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||!j(n,e)?i:[{...r,resolvedFontFileUri:e}]}async function St(i,t){let e=new Map;for(let r of i.block.findByType("//ly.img.ubq/text")){if(!et(i,r))continue;let s=i.block.getTextRuns(r);if(!(s.length!==1||!s[0].resolvedFontFileUri||s[0].resolvedFontFileUri.includes("#")))try{let o=i.block.getString(r,"text/fontFileUri");if(!o.includes("#")||o.split("#")[0]!==s[0].resolvedFontFileUri)continue;let a=await t(o);me(s,i.block.getString(r,"text/text"),o,a)!==s&&a&&e.set(r,{uri:o,names:a})}catch{}}if(e.size===0)return i;let n=new Proxy(i.block,{get(r,s){if(s==="getTextRuns")return(...a)=>{let l=r.getTextRuns(...a),c=e.get(a[0]);if(!c||a.length!==1)return l;try{return r.getString(a[0],"text/fontFileUri")!==c.uri?l:me(l,r.getString(a[0],"text/text"),c.uri,c.names)}catch{return l}};let o=Reflect.get(r,s,r);return typeof o=="function"?o.bind(r):o}});return new Proxy(i,{get(r,s){if(s==="block")return n;let o=Reflect.get(r,s,r);return typeof o=="function"?o.bind(r):o}})}var be=null;async function rn(){try{let i;if(typeof process=="object"&&process.versions?.node){let{createRequire:n}=await import("module"),{default:r}=await import("fs"),s=n(import.meta.url);i=r.readFileSync(s.resolve("harfbuzzjs/dist/harfbuzz-subset.wasm"))}else{let{default:n}=await import("harfbuzzjs/dist/harfbuzz-subset.wasm");i=n}let{instance:t}=await WebAssembly.instantiate(new Uint8Array(i),{}),e=t.exports;return e._initialize?.(),e}catch{return null}}function sn(i){return(i.charCodeAt(0)&255)<<24|(i.charCodeAt(1)&255)<<16|(i.charCodeAt(2)&255)<<8|i.charCodeAt(3)&255}function ye(i){let e=new DataView(i.buffer,i.byteOffset,i.byteLength).getUint16(4);for(let n=0;n<e;n++){let r=12+n*16;if(r+4>i.length)return!1;if(String.fromCharCode(...i.subarray(r,r+4))==="fvar")return!0}return!1}async function Se(i,t){be??=rn();let e=await be;if(!e)return null;let n=()=>new Uint8Array(e.memory.buffer),r=e.malloc(i.length);n().set(i,r);let s=e.hb_blob_create(r,i.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(r),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,sn(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(r)}}var on=new Set([1,2,4,6,16,17]),an=3,ln=1,cn=1033;function Ee(i){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint16(4),n=[];for(let r=0;r<e;r++){let s=12+r*16,o=String.fromCharCode(...i.subarray(s,s+4)),a=t.getUint32(s+8),l=t.getUint32(s+12);n.push({tag:o,data:i.subarray(a,a+l)})}return n}function un(i){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint16(2),n=t.getUint16(4),r=[];for(let s=0;s<e;s++){let o=6+s*12,a=t.getUint16(o+6);if(on.has(a))continue;let l=t.getUint16(o+8),c=t.getUint16(o+10);r.push({platform:t.getUint16(o),encoding:t.getUint16(o+2),language:t.getUint16(o+4),nameID:a,value:i.subarray(n+c,n+c+l)})}return r}function gn(i){let t=new Uint8Array(i.length*2);for(let e=0;e<i.length;e++){let n=i.charCodeAt(e);t[e*2]=n>>8,t[e*2+1]=n&255}return t}function hn(i,t){let e=[...un(i),...[[1,t.family],[2,t.subfamily],[4,t.fullName],[6,t.postScriptName],[16,t.family],[17,t.subfamily]].map(([a,l])=>({platform:an,encoding:ln,language:cn,nameID:a,value:gn(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),r=new Uint8Array(6+e.length*12+n),s=new DataView(r.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),r.set(a.value,6+e.length*12+o),o+=a.value.length}),r}function Gt(i){let t=0;for(let n=0;n+3<i.length;n+=4)t=t+(i[n]<<24|i[n+1]<<16|i[n+2]<<8|i[n+3])>>>0;let e=i.length%4;if(e){let n=0;for(let r=0;r<4;r++)n=(n<<8|(r<e?i[i.length-e+r]:0))>>>0;t=t+n>>>0}return t}function _t(i,t){return Ae(i,Ee(i).map(e=>e.tag==="name"?{tag:e.tag,data:hn(e.data,t)}:e))}function Te(i){let t=Ee(i),e=m=>t.find(x=>x.tag===m).data,n=m=>new DataView(m.buffer,m.byteOffset,m.byteLength),r=n(e("CBLC")),s=e("CBDT"),o=n(s),a=n(e("head")).getUint16(18),l=n(e("maxp")).getUint16(4),c=r.getUint32(8),u=r.getUint8(52),h=m=>Number((m*a/u).toPrecision(15)),p=[],g=new TextEncoder;for(let m=0;m<r.getUint32(16);m++){let x=c+m*8,w=r.getUint16(x),R=r.getUint16(x+2),y=c+r.getUint32(x+4),S=r.getUint32(y+4);for(let E=w;E<=R;E++){let D=S+r.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,${ot(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}),Ae(i,[...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 Ae(i,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),r=new Uint8Array(n),s=new DataView(r.buffer);r.set(i.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++)r[h+p]=c.tag.charCodeAt(p);s.setUint32(h+4,Gt(c.data)),s.setUint32(h+8,a),s.setUint32(h+12,c.data.length),r.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,Gt(r.subarray(u,u+s.getUint32(c+12)))),s.setUint32(u+8,2981146554-Gt(r)>>>0)}return r}function xe(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i[e],t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function fn(i,t,e){return`${(t?`${t.family}-${t.subfamily}`.replace(/[^\w-]+/g,""):"font")||"font"}-${xe(i)}.${e}`}async function ht(i){let t=String.fromCharCode(...i.subarray(0,4));if(t==="wOF2"){let{decompress:n}=await import("wawoff2"),r=new Uint8Array(await n(i));return ht(r)}if(t==="OTTO")return{bytes:i,ext:"otf"};if(t==="true"||t==="ttcf")return{bytes:i,ext:"ttf"};if(i[0]===0&&i[1]===1&&i[2]===0&&i[3]===0)return{bytes:i,ext:"ttf"};let e=dn(i);return e||null}function dn(i){let t=Math.min(i.length-12,4096);for(let e=4;e<t;e+=4){let n=i[e]===0&&i[e+1]===1&&i[e+2]===0&&i[e+3]===0,r=i[e]===79&&i[e+1]===84&&i[e+2]===84&&i[e+3]===79;if(!n&&!r)continue;let s=i.subarray(e);if(at(s))return{bytes:s,ext:r?"otf":"ttf"}}return null}async function pn(i){let{fonts:t,skipped:e}=await It(i);return{fonts:t,skipped:e}}function Re(i){let t=new Set;for(let e of i.block.findByType("//ly.img.ubq/text"))if(et(i,e))for(let n of i.block.getTextRuns(e))n.resolvedFontFileUri&&t.add(n.resolvedFontFileUri);return t}async function we(i,t){let e=Re(i);if(e.size<2)return!1;let n=new Map;for(let r of e){let s=await t(r);if(!s)continue;let o=j(s,r)??s.subfamily,a=`${s.family}\0${o}`,l=r.split("#")[0],c=n.get(a);if(c&&c!==l)return!0;n.set(a,l)}return!1}async function It(i){i=await St(i,wt(async g=>{let f=await Et(i,g);return f?(await ht(f))?.bytes??null:null}));let t=Re(i),e=[],n=new Map,r=new Map,s=[];for(let g of t){let f=g.split("#")[0];if(!n.has(f)){let m=await Et(i,f),x=m?await ht(m):null;n.set(f,x&&{...x,bytes:await mn(x.bytes)})}let d=n.get(f);if(r.set(g,d?at(d.bytes):null),!d){e.push(g);continue}let T=await bn(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:at(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=xe(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=_t(g.bytes,{family:w,subfamily:g.face.subfamily,fullName:`${w} ${g.face.subfamily}`,postScriptName:`IDML-${m}`}),g.face=at(g.bytes)}for(let A of g.uris){let m=r.get(A);r.set(A,g.face&&m?{...g.face,instances:m.instances,axisDefaults:m.axisDefaults}:g.face)}let f=fn(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=>r.get(g)??null,aliasedFonts:p}}async function mn(i){let t=globalThis.crypto?.subtle;if(i.length!==9867108||!t)return i;try{if(Array.from(new Uint8Array(await t.digest("SHA-256",new Uint8Array(i))),n=>n.toString(16).padStart(2,"0")).join("")==="bf2a8506b80614ba190a34c7b037af1269a7d614fe9f3b613cc15cdeec6f814b")return Te(i)}catch{}return i}async function bn(i,t){let e=at(i);if(!e)return i;let n=yt(t);if(Object.keys(n).length>0&&ye(i)){let r=j(e,t),s=r?await Se(i,n):null;return s&&r?_t(s,{family:e.family,subfamily:r,fullName:`${e.family} ${r}`,postScriptName:`${e.family.replace(/\s+/g,"")}-${r.replace(/\s+/g,"")}`}):null}return _t(i,{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 Et(i,t){let e=await ut(i,t);if(e)return e;if(t.startsWith("bundle://"))try{let{createRequire:n}=await import("module"),{default:r}=await import("path"),{default:s}=await import("fs"),o=n(import.meta.url),a=r.dirname(o.resolve("@cesdk/node"));for(;!s.existsSync(r.join(a,"package.json"));)a=r.dirname(a);let l=t.replace(/^bundle:\/\/[^/]*\//,""),c=r.join(a,"assets",l);if(s.existsSync(c))return new Uint8Array(s.readFileSync(c))}catch{return null}return null}function yn(i){try{let t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint32(0);if(![65536,1330926671,1953658213].includes(e))return null;let n=-1,r=0;for(let l=0;l<t.getUint16(4);l++){let c=12+l*16;t.getUint32(c)===1668112752&&(n=t.getUint32(c+8),r=t.getUint32(c+12))}if(n<0||r<4||n+r>i.length)return null;let s=n+r,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 _e(i,t){let e=yn(i);if(!e)return null;let n=r=>[...r].every(s=>e.some(o=>o(s.codePointAt(0))!==0));for(let r of t.normalize("NFC"))if(!(!/^[\p{Letter}\p{Number}\p{Punctuation}\p{Symbol}]$/u.test(r)||/^\p{Default_Ignorable_Code_Point}$/u.test(r))&&![r,r.normalize("NFD")].some(n))return!0;return!1}function zt(i,t,e){if(i.block.supportsShape(t)){let s=i.block.getShape(t);if(i.block.isValid(s)&&i.block.getType(s)==="//ly.img.ubq/shape/line"){let o=i.block.getStrokePosition(t);i.block.getStrokePosition(e)!==o&&i.block.setStrokePosition(e,o)}}let n=i.block.getChildren(t),r=i.block.getChildren(e);if(n.length!==r.length)throw new Error("Render copy hierarchy changed");n.forEach((s,o)=>zt(i,s,r[o]))}async function Zt(i,t){let e=i.block.duplicate(t,!1),n=!1;try{let r=await i.block.saveToString([e],["buffer","bundle","http","https","file","data","blob","archive","workspace","opfs"],async u=>u);if(!r.startsWith("UBQ1"))throw new Error("Unknown block encoding");let s=atob(r.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 zt(i,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 i.block.loadFromString("UBQ1"+ot(new TextEncoder().encode(JSON.stringify(a))));try{if(c.length!==1)throw new Error("Expected one render copy");return zt(i,t,c[0]),c[0]}catch(u){for(let h of c)i.block.isValid(h)&&i.block.destroy(h);throw u}}finally{!n&&i.block.isValid(e)&&i.block.destroy(e)}}var Ie="HL Composer Optyca",Sn=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,En=/[\u0900-\u109F\u1780-\u17FF]/;function Pt(i){return Sn.test(i)||[...i].some(t=>gt(t)&&/[\p{Letter}\p{Mark}]/u.test(t))}function Pe(i){return Pt(i)||En.test(i)}var Tn={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."}},Ft=class{messages=[];emit(t,e){let{type:n,message:r}=Tn[t];this.messages.push({type:n,code:t,message:r,meta:e})}getMessages(){return[...this.messages]}};var An={fillEnabled:!0,stroke:null};function Dt(i,t){let e=0;return i.block.getTextRuns(t).map(n=>{let r=e;e+=n.text.length;try{let s=i.block.getTextDecorations(t,r,e)[0];return s?{...n,textDecoration:s}:n}catch{return n}})}function Ce(i){let t;for(let e of i){let n=JSON.stringify([e.fontSize,e.resolvedFontFileUri]),r=e.text.split(/(\r\n|\r|\n)/);for(let s=0;s<r.length;s+=2){let o=r[s+1];if(r[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 Le(i,t){let e=i.editor.getSettingBool("features/fontLineGapEnabled"),n=new Map,r=0,s=0,o=0,a=()=>r+s>o+1e-6;for(let l of i.block.getTextRuns(t)){if(!l.resolvedFontFileUri)continue;let c=n.get(l.resolvedFontFileUri);if(!c)try{c=await i.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)&&(r=Math.max(r,h),s=Math.max(s,p),o=Math.max(o,h+p)),d!==void 0){if(a())return!0;r=s=o=0}}}return a()}var xn={Left:"LeftAlign",Center:"CenterAlign",Right:"RightAlign"};async function Ne(i,t,e,n,r,s,o=An,a){let l=i.block,c=[];try{c=Dt(i,t)}catch{c=[]}let u=J("Story"),h=u.element("Story").attr("Self",e),p=l.getEnum(t,"text/horizontalAlignment"),g=i.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=gt(_);(Pe(_)||U)&&(L.attr("Composer",Ie),L.attr("ParagraphDirection",U?"RightToLeftDirection":"LeftToRightDirection"));let F=p;try{F=i.block.getTextHorizontalAlignment(t,I)??p}catch{}let C=F==="Justify"?U?"RightJustified":"LeftJustified":F==="Auto"?U?"RightAlign":"LeftAlign":xn[F];C&&L.attr("Justification",C),F==="Justify"&&L.attr("SingleWordJustification",U?"RightAlign":"LeftAlign");try{let H=i.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 Pt(I)&&_.attr("DigitsType","ArabicDigits"),wn(_,I),bt(u,[],L=>r.emit("XML_CHARACTERS_REPLACED",{...L}))}let T=i.editor,A=new Map,m=I=>{let _=A.get(I);return _||(_=T.getFontMetrics(I),A.set(I,_)),_},x=i.editor.getSettingBool("features/fontLineGapEnabled"),w=i.block,R=async(I,_)=>{if(!_.resolvedFontFileUri)return r.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 Fe(L,U,x)*_.fontSize}catch{return r.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 Fe(_,L,x)*I.fontSize}}catch{r.emit("TEXT_WITHOUT_FONT",{block:t})}return null},S=[[]],E=[0],D=0,v=vt(i,t,c);for(let[I,_]of c.entries()){let L=_.textCase==="Lowercase"||_.textCase==="Titlecase",U=L?v?.[I]??mt(_.text,_.textCase):_.text;L&&r.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(`
|
|
5
|
-
`)&&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=Pt(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),r.emit("FONT_NAMES_UNREADABLE",{block:t,uri:P.resolvedFontFileUri,typeface:P.typeface.name}));let z=/[#&]wght=/.test(P.resolvedFontFileUri??""),ft=B&&z?j(B,P.resolvedFontFileUri):null;B&&z&&!ft&&!M.has(P.resolvedFontFileUri)&&(M.add(P.resolvedFontFileUri),r.emit("FONT_INSTANCE_UNMATCHED",{block:t,uri:P.resolvedFontFileUri}));let dt=z?ft??De(P.fontWeight,P.fontStyle):B?B.subfamily:De(P.fontWeight,P.fontStyle),pt=o.fillEnabled&&N(P.color)>0,k=O.element("CharacterStyleRange").attr("AppliedCharacterStyle","CharacterStyle/$ID/[No character style]").attr("FillColor",pt?n.register(P.color):"Swatch/None").attr("PointSize",b(P.fontSize)).attr("FontStyle",dt);In(G.text)&&k.attr("KerningMethod","$ID/None"),g||k.attr("KerningValue","0"),C&&k.attr("DigitsType","ArabicDigits"),pt&&"tint"in P.color&&P.color.tint<1&&k.attr("FillTint",b(P.color.tint*100)),o.stroke&&(k.attr("StrokeColor",n.register(Q(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 nt=f+(P.kerning??0);nt!==0&&k.attr("Tracking",b(nt*1e3));let K=P.textDecoration,Tt=K?.lines??[],rt=Tt.includes("Underline"),W=Tt.includes("Strikethrough");if(rt){k.attr("Underline","true");try{let Z=ne(P.fontSize,await m(P.resolvedFontFileUri),K?.underlineThickness,K?.underlineOffset);if(!Z)throw new Error("Underline metrics unavailable");k.attr("UnderlineWeight",b(Z.weight)),k.attr("UnderlineOffset",b(Z.offset))}catch{r.emit("UNDERLINE_METRICS_UNAVAILABLE",{block:t})}}W&&k.attr("StrikeThru","true");let q=k.element("Properties"),lt=B?.family??P.typeface?.name;lt&&(a?.(lt,dt,B?.postScriptName??""),q.element("AppliedFont").attr("type","string").text(lt));let it=Rn(K?.style);if(it&&(rt||W)&&(rt&&q.element("UnderlineType").attr("type","object").text(it),W&&q.element("StrikeThroughType").attr("type","object").text(it)),rt&&K?.underlineColor!=null){let Z=K.underlineColor;"tint"in Z&&Z.tint!==1&&k.attr("UnderlineTint",b(Z.tint*100)),q.element("UnderlineColor").attr("type","object").text(n.register(Z))}let ct=await R(H,P);ct!=null&&q.element("Leading").attr("type","unit").text(b(ct)),q.children.length===0&&k.children.pop(),G.text.length>0&&k.element("Content").text(G.text),G.breakAfter&&k.element("Br")}}return bt(u,[],I=>r.emit("XML_CHARACTERS_REPLACED",{...I}))}function Rn(i){switch(i){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 wn(i,t){t.split(/\r\n|\r|\n/).forEach((n,r)=>{r>0&&i.element("Br"),n.length>0&&i.element("Content").text(n)})}function Fe(i,t,e){let{ascender:n,descender:r,unitsPerEm:s,lineGap:o=0}=t,a=i;if(e){let l=n-r,c=l+o;l!==0&&(a=a*c/l)}if(s!==0){let l=(n-r)/s;a=a*l}return a}var _n={thin:"Thin",extraLight:"ExtraLight",light:"Light",normal:"Regular",medium:"Medium",semiBold:"SemiBold",bold:"Bold",extraBold:"ExtraBold",heavy:"Heavy"};function De(i,t){let e=_n[i]??"Regular",n=t==="italic";return e==="Regular"&&n?"Italic":n?`${e} Italic`:e}function ve(i,t){let e=i.block,n=0;try{n=e.getFloat(t,"text/letterSpacing")}catch{}let r=[];try{r=e.getTextRuns(t)}catch{return 0}return r.reduce((s,o)=>Math.max(s,(n+(o.kerning??0))*o.fontSize),0)}function ke(i){switch(i){case"Center":return"CenterPoint";case"Bottom":return"BottomCenterPoint";default:return"TopCenterPoint"}}function Me(i,t){let e=i==="Center"?"Center":i==="Bottom"?"Bottom":"Top",n=t==="Center"?"Center":t==="Right"?"Right":"Left";return e==="Center"?n==="Center"?"CenterPoint":`${n}CenterPoint`:`${e}${n}Point`}function Oe(i){switch(i){case"Top":return"TopAlign";case"Center":return"CenterAlign";case"Bottom":return"BottomAlign";default:return null}}function In(i){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}|[ -〿-]/u.test(i)}function Xr(i){return jt.export(i)}async function $r(i,t={}){return Ct.exportPackage(i,t.name??"design")}var Ht=72,qt="ubs",Wt=(i,t,e)=>[i[0]+t,i[1]+e],Pn=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1
|
+
import e from"jszip";function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(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 o(e,t){try{if(t.startsWith(`data:`)){let e=t.match(/^data:([^,]*),(.*)$/s);if(!e)return null;if(!/;base64$/i.test(e[1]))return a(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 o(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 s(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 l(n)+r.slice(n.toLowerCase().length)}).join(``)).join(``)}const c=/* @__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 l(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):c.get(t)??e.toUpperCase()}function u(e,t,n){try{n??=e.block.getTextRuns(t);let r=e=>e===`Lowercase`||e===`Titlecase`,i=n.map(e=>r(e.textCase)?s(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),c=[...i],l=[];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=s(r,t);l.push({start:e,end:i,raw:r,text:a}),c[e]=a;for(let t=e+1;t<i;t++)c[t]=``}e=i}let u=a(c),d=e.block.getTextVisibleLineCount(t);if(!Number.isInteger(d)||d<0||d>Math.max(o.length,u.length)+1)return;let f=Array.from({length:d},(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(u))return;for(let{start:e,end:t,raw:r,text:i}of l){let a=0,o=0;for(let l=e;l<t;l++){if(a+=n[l].text.length,a<r.length&&/[\uD800-\uDBFF]/u.test(r[a-1]??``)&&/[\uDC00-\uDFFF]/u.test(r[a]??``))return;let t=s(r.slice(0,a),n[e].textCase).length;if(t<o||t>i.length)return;c[l]=i.slice(o,t),o=t}if(o!==i.length)return}return c}catch{return}}function d(e,t){return u(e,t)!==void 0}const f=[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],p=[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 m(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 h(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(m(e,f))return!0;if(!m(e,p))return!1}}return!1}function g(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 _(e){return e.scene.get()!==null&&e.scene.getAngleUnit?.()===`Degree`}function v(e,t){return _(e)?t*Math.PI/180:t}function y(e){return Number.isFinite(e)&&e>=0?e:0}const b={id:void 0,exportOptions:e=>e,end:()=>{},cancel:()=>{}};function x(e,t){let n=e.editor;if(typeof n.beginExportTransaction!=`function`||typeof n.endExportTransaction!=`function`||typeof n.cancelExportTransaction!=`function`)return b;let r;try{r=n.beginExportTransaction(t.type,t.format,t.producer,t.block)}catch{return b}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,y(e),y(o))}catch(e){i(`The ${t.type} export is complete, but its export transaction did not end: ${e}`),a()}},cancel:a}}var S=`@imgly/idml-exporter`,C=`0.1.1`;const w=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u;function T(e){return w.test(e)}function E(e,t,n){return T(e)?e.replace(new RegExp(w.source,`gu`),(e,r)=>(n?.({...t,codePoint:e.codePointAt(0),offset:r}),`�`)):e}function D(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function O(e,t,n){return D(E(e,t,n)).replace(/\r/g,` `)}function k(e,t,n){return D(E(e,t,n)).replace(/"/g,`"`).replace(/\t/g,`	`).replace(/\n/g,` `).replace(/\r/g,` `)}var A=class{constructor(e){this.text=e}serialize(e,t=`#text`){return O(this.text,{tag:t,kind:`text`},e)}},j=class{constructor(e){this.data=e}serialize(e,t=`#cdata`){return`<![CDATA[${E(this.data,{tag:t,kind:`cdata`},e).replace(/\]\]>/g,`]]]]><![CDATA[>`).replace(/\r/g,`]]> <![CDATA[`)}]]>`}},M=class e{constructor(e){this.tag=e,i(this,`children`,[]),i(this,`attributes`,/* @__PURE__ */ new Map)}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 A(e)),this}cdata(e){return this.children.push(new j(e)),this}serialize(t){let n=Array.from(this.attributes.entries()).map(([e,n])=>` ${e}="${k(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 N(e,t=[],n){return`${[`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`,...t].join(`
|
|
2
|
+
`)}\n${e.serialize(n)}\n`}function P(e){return new M(`idPkg:${e}`).attr(`xmlns:idPkg`,`http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging`).attr(`DOMVersion`,`15.0`)}function F(e){if(!Number.isFinite(e))return`0`;let t=Math.round(e*1e6)/1e6;return String(t)}var ee=class{constructor(e=()=>null,t=e=>e){this.resolveSpot=e,this.allocateId=t,i(this,`colors`,/* @__PURE__ */ new Map),i(this,`gradients`,[]),i(this,`tints`,/* @__PURE__ */ new Map),i(this,`colorCounter`,0),i(this,`tintCounter`,0),i(this,`gradientCounter`,0)}register(e){if(`name`in e)return this.registerSpot(e);let{key:t,space:n,colorValue:r}=te(e),i=this.colors.get(t);if(i)return i.self;let a=this.allocateId(`Color/c${++this.colorCounter}`),o=new M(`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 M(`Color`).attr(`Self`,i).attr(`Name`,e.name).attr(`Model`,`Spot`).attr(`Space`,`RGB`).attr(`ColorValue`,[r.r,r.g,r.b].map(e=>F(I(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=I(e.tint);if(n===1)return t;let r=F(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 M(`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 M(`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`,F(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 te(e){if(`r`in e){let t=e,n=[t.r,t.g,t.b].map(e=>F(I(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=>F(I(e)*100)).join(` `);return{key:`CMYK:${n}`,space:`CMYK`,colorValue:n}}function I(e){return Math.max(0,Math.min(1,e))}function L(e){return`r`in e?e.a:1}function R(e){return`r`in e&&e.a!==1?{...e,a:1}:e}function ne(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 re(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 ie(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 z(e){return e.map(F).join(` `)}function ae(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 B(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`,`${F(n.anchor[0])} ${F(n.anchor[1])}`).attr(`LeftDirection`,`${F(n.left[0])} ${F(n.left[1])}`).attr(`RightDirection`,`${F(n.right[0])} ${F(n.right[1])}`)}}function V(e,t){return[{open:!1,points:[[0,0],[e,0],[e,t],[0,t]].map(e=>({anchor:e,left:e,right:e}))}]}const oe=.5522847498307936;function se(e,t){let n=e/2,r=t/2,i=n,a=r,o=n*oe,s=r*oe;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 ce(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 le(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 ue=/[+-]?(?:\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(),ue.lastIndex=o;let t=ue.exec(e);return t?(o=ue.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],M=e=>[-d*Math.sin(e)*m-f*Math.cos(e)*h,-d*Math.sin(e)*h+f*Math.cos(e)*m],N=Math.ceil(Math.abs(A)/(Math.PI/2)),P=A/N,F=4/3*Math.tan(P/4);for(let e=0;e<N;e++){let t=k+e*P,n=t+P,r=j(t),i=e===N-1?a:j(n),o=M(t),s=M(n);v([r[0]+F*o[0],r[1]+F*o[1]],[i[0]-F*s[0],i[1]-F*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 o(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 H(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 U(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 W(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 G(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 K(e,t){let n=G(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&&W(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=G(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||!K(r,n)?e:[{...i,resolvedFontFileUri:n}]}async function q(e,t){let n=/* @__PURE__ */ new Map;for(let r of e.block.findByType(`//ly.img.ubq/text`)){if(!U(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(import.meta.url);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 J(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 Y(e,t){return Ie(e,je(e).map(e=>e.tag===`name`?{tag:e.tag,data:Pe(e.data,t)}:e))}function Fe(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,${H(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}),Ie(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 Ie(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,J(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,J(i.subarray(t,t+a.getUint32(e+12)))),a.setUint32(t+8,2981146554-J(i)>>>0)}return i}function Le(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 Re(e,t,n){return`${(t?`${t.family}-${t.subfamily}`.replace(/[^\w-]+/g,``):`font`)||`font`}-${Le(e)}.${n}`}async function X(e){let t=String.fromCharCode(...e.subarray(0,4));if(t===`wOF2`){let{decompress:t}=await import(`wawoff2`);return X(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`}:ze(e)||null}function ze(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(W(i))return{bytes:i,ext:r?`otf`:`ttf`}}return null}async function Be(e){let{fonts:t,skipped:n}=await Z(e);return{fonts:t,skipped:n}}function Ve(e){let t=/* @__PURE__ */ new Set;for(let n of e.block.findByType(`//ly.img.ubq/text`))if(U(e,n))for(let r of e.block.getTextRuns(n))r.resolvedFontFileUri&&t.add(r.resolvedFontFileUri);return t}async function He(e,t){let n=Ve(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=K(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 Z(e){e=await q(e,Se(async t=>{let n=await Q(e,t);return n?(await X(n))?.bytes??null:null}));let t=Ve(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 Q(e,t),i=n?await X(n):null;r.set(t,i&&{...i,bytes:await Ue(i.bytes)})}let s=r.get(t);if(i.set(o,s?W(s.bytes):null),!s){n.push(o);continue}let c=await We(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:W(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=Le(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=Y(e.bytes,{family:i,subfamily:e.face.subfamily,fullName:`${i} ${e.face.subfamily}`,postScriptName:`IDML-${n}`}),e.face=W(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=Re(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 Ue(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 Fe(e)}catch{}return e}async function We(e,t){let n=W(e);if(!n)return e;let r=G(t);if(Object.keys(r).length>0&&Oe(e)){let i=K(n,t),a=i?await ke(e,r):null;return a&&i?Y(a,{family:n.family,subfamily:i,fullName:`${n.family} ${i}`,postScriptName:`${n.family.replace(/\s+/g,``)}-${i.replace(/\s+/g,``)}`}):null}return Y(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 Q(e,t){let n=await o(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(import.meta.url),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 Ge(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 Ke(e,t){let n=Ge(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 qe(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)=>qe(e,t,i[n]))}async function Je(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 qe(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`+H(new TextEncoder().encode(JSON.stringify(s))));try{if(l.length!==1)throw Error(`Expected one render copy`);return qe(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 Ye=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,Xe=/[\u0900-\u109F\u1780-\u17FF]/;function Ze(e){return Ye.test(e)||[...e].some(e=>h(e)&&/[\p{Letter}\p{Mark}]/u.test(e))}function Qe(e){return Ze(e)||Xe.test(e)}const $e={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 et=class{constructor(){i(this,`messages`,[])}emit(e,t){let{type:n,message:r}=$e[e];this.messages.push({type:n,code:e,message:r,meta:t})}getMessages(){return[...this.messages]}};const tt={fillEnabled:!0,stroke:null};function $(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 nt(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 rt(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 it={Left:`LeftAlign`,Center:`CenterAlign`,Right:`RightAlign`};async function at(e,t,n,r,i,a,o=tt,c){let l=e.block,d=[];try{d=$(e,t)}catch{d=[]}let f=P(`Story`),p=f.element(`Story`).attr(`Self`,n),m=l.getEnum(t,`text/horizontalAlignment`),_=e.block.getBool(t,`text/useKerning`),v=0;try{v=l.getFloat(t,`text/letterSpacing`)}catch{}let y=(n,r)=>{let i=p.element(`ParagraphStyleRange`).attr(`AppliedParagraphStyle`,`ParagraphStyle/$ID/[No paragraph style]`).attr(`Hyphenation`,`false`),a=h(r);(Qe(r)||a)&&(i.attr(`Composer`,`HL Composer Optyca`),i.attr(`ParagraphDirection`,a?`RightToLeftDirection`:`LeftToRightDirection`));let o=m;try{o=e.block.getTextHorizontalAlignment(t,n)??m}catch{}let s=o===`Justify`?a?`RightJustified`:`LeftJustified`:o===`Auto`?a?`RightAlign`:`LeftAlign`:it[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(d.length===0){let e=l.getString(t,`text/text`),n=y(0,e).element(`CharacterStyleRange`).attr(`AppliedCharacterStyle`,`CharacterStyle/$ID/[No character style]`);return Ze(e)&&n.attr(`DigitsType`,`ArabicDigits`),st(n,e),N(f,[],e=>i.emit(`XML_CHARACTERS_REPLACED`,{...e}))}let b=e.editor,x=/* @__PURE__ */ new Map,S=e=>{let t=x.get(e);return t||(t=b.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 ct(typeof w.getTextLineHeight==`function`?w.getTextLineHeight(t,e):l.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=l.getFloat(t,`text/paragraphSpacing`);if(n>0)return ct(n,await S(e.resolvedFontFileUri),C)*e.fontSize}catch{i.emit(`TEXT_WITHOUT_FONT`,{block:t})}return null},D=[[]],O=[0],k=0,A=u(e,t,d);for(let[e,n]of d.entries()){let r=n.textCase===`Lowercase`||n.textCase===`Titlecase`,a=r?A?.[e]??s(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],s=n.filter(e=>e.text.length>0||e.breakAfter),l=s.length>0?s:n.slice(-1),u=l.map(e=>e.text).join(``),d=Ze(u),f=O[e],p=y(f,u),m=l.length>0?await E(l[0].run):null;m!=null&&p.attr(`SpaceAfter`,F(m));for(let e of l){let{run:n}=e,s=n.resolvedFontFileUri?await a(n.resolvedFontFileUri):null;!s&&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=s&&l?K(s,n.resolvedFontFileUri):null;s&&l&&!u&&!j.has(n.resolvedFontFileUri)&&(j.add(n.resolvedFontFileUri),i.emit(`FONT_INSTANCE_UNMATCHED`,{block:t,uri:n.resolvedFontFileUri}));let m=l?u??ut(n.fontWeight,n.fontStyle):s?s.subfamily:ut(n.fontWeight,n.fontStyle),h=o.fillEnabled&&L(n.color)>0,y=p.element(`CharacterStyleRange`).attr(`AppliedCharacterStyle`,`CharacterStyle/$ID/[No character style]`).attr(`FillColor`,h?r.register(n.color):`Swatch/None`).attr(`PointSize`,F(n.fontSize)).attr(`FontStyle`,m);(n.scriptStyle===`Superscript`||n.scriptStyle===`Subscript`)&&y.attr(`Position`,n.scriptStyle),ht(e.text)&&y.attr(`KerningMethod`,`$ID/None`),_||y.attr(`KerningValue`,`0`),d&&y.attr(`DigitsType`,`ArabicDigits`),h&&`tint`in n.color&&n.color.tint<1&&y.attr(`FillTint`,F(n.color.tint*100)),o.stroke&&(y.attr(`StrokeColor`,r.register(R(o.stroke.color))).attr(`StrokeWeight`,F(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&&y.attr(`StrokeTint`,F(o.stroke.color.tint*100))),n.textCase===`Uppercase`&&y.attr(`Capitalization`,`AllCaps`);let b=v+(n.kerning??0);b!==0&&y.attr(`Tracking`,F(b*1e3));let x=n.textDecoration,C=x?.lines??[],w=C.includes(`Underline`),E=C.includes(`Strikethrough`);if(w){y.attr(`Underline`,`true`);try{let e=g(n.fontSize,await S(n.resolvedFontFileUri),x?.underlineThickness,x?.underlineOffset);if(!e)throw Error(`Underline metrics unavailable`);y.attr(`UnderlineWeight`,F(e.weight)),y.attr(`UnderlineOffset`,F(e.offset))}catch{i.emit(`UNDERLINE_METRICS_UNAVAILABLE`,{block:t})}}E&&y.attr(`StrikeThru`,`true`);let D=y.element(`Properties`),O=s?.family??n.typeface?.name;O&&(c?.(O,m,s?.postScriptName??``),D.element(`AppliedFont`).attr(`type`,`string`).text(O));let k=ot(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&&y.attr(`UnderlineTint`,F(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(F(A)),D.children.length===0&&y.children.pop(),e.text.length>0&&y.element(`Content`).text(e.text),e.breakAfter&&y.element(`Br`)}}return N(f,[],e=>i.emit(`XML_CHARACTERS_REPLACED`,{...e}))}function ot(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 st(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 ct(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 lt={thin:`Thin`,extraLight:`ExtraLight`,light:`Light`,normal:`Regular`,medium:`Medium`,semiBold:`SemiBold`,bold:`Bold`,extraBold:`ExtraBold`,heavy:`Heavy`};function ut(e,t){let n=lt[e]??`Regular`,r=t===`italic`;return n===`Regular`&&r?`Italic`:r?`${n} Italic`:n}function dt(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 ft(e){switch(e){case`Center`:return`CenterPoint`;case`Bottom`:return`BottomCenterPoint`;default:return`TopCenterPoint`}}function pt(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 mt(e){switch(e){case`Top`:return`TopAlign`;case`Center`:return`CenterAlign`;case`Bottom`:return`BottomAlign`;default:return null}}function ht(e){return/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Hangul}|[ -〿-]/u.test(e)}function gt(e){return wt.export(e)}async function _t(e,t={}){return Tt.exportPackage(e,t.name??`design`)}const vt=`application/vnd.adobe.indesign-idml-package`;function yt(e,t){return x(e,{type:`idml`,format:t,producer:`${S}@${C}`,block:e.scene.get()??-1})}const bt=(e,t,n)=>[e[0]+t,e[1]+n];function xt(e){let t=F(e);return e>0&&t===`0`?String(e):t}const St={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`},Ct=/* @__PURE__ */ new Set([`Multiply`,`Screen`,`Overlay`,`SoftLight`,`HardLight`,`ColorDodge`,`ColorBurn`,`Darken`,`Lighten`,`Difference`,`Exclusion`,`Hue`,`Saturation`,`Color`,`Luminosity`]);var wt=class{constructor(){}static export(e){return Tt.export(e)}},Tt=class t{constructor(e,t){i(this,`engine`,void 0),i(this,`logger`,new et),i(this,`colors`,new ee(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))),i(this,`files`,/* @__PURE__ */ new Map),i(this,`fontNames`,void 0),i(this,`fonts`,/* @__PURE__ */ new Map),i(this,`fontBytes`,/* @__PURE__ */ new Map),i(this,`storyIds`,[]),i(this,`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`])),i(this,`pointsPerUnit`,void 0),i(this,`idCounter`,0),i(this,`currentPage`,null),i(this,`pageContentTransform`,[1,0,0,1,0,0]),i(this,`scriptPreferences`,/* @__PURE__ */ new Map),i(this,`transaction`,void 0),i(this,`renderedTexts`,/* @__PURE__ */ new Set),this.engine=e,this.transaction=t,this.pointsPerUnit=this.resolvePointsPerUnit(),this.fontNames=Se(async e=>{let t=await Q(this.engine,e);return(t&&await X(t))?.bytes??null})}static async inTransaction(e,n,r,i){let a=yt(e,n),o;try{o=await r(new t(e,a))}catch(e){throw a.cancel(),e}return a.end(i(o).byteLength,0),o}static export(e){return t.inTransaction(e,vt,async t=>{if(await t.prepareTextFontFallbacks(),t.engine=await q(e,t.fontNames),await He(t.engine,t.fontNames)){let e=await Z(t.engine);e.aliasedFonts>0&&(t.fontNames=e.resolveNames,t.logger.emit(`FONT_NAMES_ALIASED`,{fonts:e.aliasedFonts}))}return{idml:await t.run(),logger:t.logger}},e=>e.idml)}static exportPackage(n,r){return t.inTransaction(n,`application/zip`,async t=>{await t.prepareTextFontFallbacks(),t.engine=await q(n,t.fontNames);let{fonts:i,skipped:a,resolveNames:o}=await Z(t.engine);t.fontNames=o;let s=await t.run(),c=new e;c.file(`${r}/${r}.idml`,s);for(let e of i)c.file(`${r}/Document fonts/${e.filename}`,e.bytes);return{zip:await c.generateAsync({type:`uint8array`,compression:`DEFLATE`}),logger:t.logger,skippedFonts:a}},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 t=this.engine.scene.getPages(),n=[];for(let e of t){let t=await this.buildSpread(e);n.push(t)}let r=new e,i=(e,t)=>r.file(e,t,{createFolders:!1});r.file(`mimetype`,vt,{compression:`STORE`,createFolders:!1}),i(`designmap.xml`,this.buildDesignMap(n)),i(`META-INF/container.xml`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
6
4
|
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
|
|
7
5
|
<rootfiles>
|
|
8
6
|
<rootfile full-path="designmap.xml" media-type="text/xml"/>
|
|
9
7
|
</rootfiles>
|
|
10
8
|
</container>
|
|
11
|
-
`,
|
|
9
|
+
`),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`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
12
10
|
<idPkg:Tags xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="15.0">
|
|
13
11
|
<XMLTag Self="XMLTag/Root" Name="Root">
|
|
14
12
|
<Properties>
|
|
@@ -16,15 +14,15 @@ ${i.serialize(e)}
|
|
|
16
14
|
</Properties>
|
|
17
15
|
</XMLTag>
|
|
18
16
|
</idPkg:Tags>
|
|
19
|
-
|
|
17
|
+
`),i(`XML/BackingStory.xml`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
20
18
|
<idPkg:BackingStory xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="15.0">
|
|
21
|
-
<XmlStory Self="
|
|
19
|
+
<XmlStory Self="ubs" UserText="true" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">
|
|
22
20
|
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
|
|
23
21
|
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
|
|
24
22
|
<XMLElement Self="di2" MarkupTag="XMLTag/Root" />
|
|
25
|
-
<Content
|
|
23
|
+
<Content></Content>
|
|
26
24
|
</CharacterStyleRange>
|
|
27
25
|
</ParagraphStyleRange>
|
|
28
26
|
</XmlStory>
|
|
29
27
|
</idPkg:BackingStory>
|
|
30
|
-
`;function Vt(i){let t=b(i);return i>0&&t==="0"?String(i):t}var Cn={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"},Ln=new Set(["Multiply","Screen","Overlay","SoftLight","HardLight","ColorDodge","ColorBurn","Darken","Lighten","Difference","Exclusion","Hue","Saturation","Color","Luminosity"]),jt=class{constructor(){}static export(t){return Ct.export(t)}},Ct=class i{engine;logger=new Ft;colors=new At(t=>{try{let[e,n,r]=this.engine.editor.getSpotColorRGBA(t);return{r:e,g:n,b:r,a:1}}catch{return null}},t=>this.allocateUniqueId(t));files=new Map;fontNames;fonts=new Map;fontBytes=new Map;storyIds=[];usedSelfIds=new Set(["d",qt,"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=wt(async e=>{let n=await Et(this.engine,e);return(n&&await ht(n))?.bytes??null})}static async export(t){let e=new i(t);if(await e.prepareTextFontFallbacks(),e.engine=await St(t,e.fontNames),await we(e.engine,e.fontNames)){let r=await It(e.engine);r.aliasedFonts>0&&(e.fontNames=r.resolveNames,e.logger.emit("FONT_NAMES_ALIASED",{fonts:r.aliasedFonts}))}return{idml:await e.run(),logger:e.logger}}static async exportPackage(t,e){let n=new i(t);await n.prepareTextFontFallbacks(),n.engine=await St(t,n.fontNames);let{fonts:r,skipped:s,resolveNames:o}=await It(n.engine);n.fontNames=o;let a=await n.run(),l=new Ue;l.file(`${e}/${e}.idml`,a);for(let c of r)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 Ue,r=(s,o)=>n.file(s,o,{createFolders:!1});n.file("mimetype","application/vnd.adobe.indesign-idml-package",{compression:"STORE",createFolders:!1}),r("designmap.xml",this.buildDesignMap(e)),r("META-INF/container.xml",Pn),r("Resources/Graphic.xml",this.buildGraphicResources()),r("Resources/Fonts.xml",this.buildFontResources()),r("Resources/Styles.xml",this.buildStyleResources()),r("Resources/Preferences.xml",this.buildPreferences(t[0])),r("XML/Tags.xml",Fn),r("XML/BackingStory.xml",Dn);for(let[s,o]of this.files)r(s,o);return n.generateAsync({type:"uint8array"})}resolvePointsPerUnit(){let t=this.engine.scene.getDesignUnit();if(t==="Millimeter")return Ht/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?Ht/n:1}return Ht}toPoints(t){return t*this.pointsPerUnit}allocateSelf(t,e){try{if(this.engine.block.hasMetadata(t,"idml/id")){let r=this.engine.block.getMetadata(t,"idml/id");if(Y(r))this.logger.emit("XML_ID_REPLACED",{block:t});else if(r&&!this.usedSelfIds.has(r))return this.usedSelfIds.add(r),r}}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 bt(t,e,n=>this.logger.emit("XML_CHARACTERS_REPLACED",{...n}))}buildDesignMap(t){let e=new V("Document").attr("xmlns:idPkg","http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging").attr("DOMVersion","15.0").attr("Self","d").attr("StoryList",[...this.storyIds,qt].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=J("Graphic");for(let e of this.colors.getResourceElements())t.append(e);return this.serializeXml(t)}registerFont(t,e,n){if([t,e,n].some(Y))return;let r=JSON.stringify([t,e,n]);this.fonts.set(r,{family:t,style:e,postScriptName:n})}buildFontResources(){let t=J("Fonts"),e=new Map;for(let{family:n,style:r,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+" "+r;o.element("Font").attr("Self",this.allocateUniqueId("Font/"+(s||a))).attr("FontFamily",n).attr("Name",a).attr("PostScriptName",s).attr("FontStyleName",r)}return this.serializeXml(t)}buildStyleResources(){let t=J("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=r=>{if(t==null)return 0;try{return this.toPoints(this.engine.block.getFloat(t,r))}catch{return 0}},n=J("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,"_")}`,r=`${n}.xml`;for(;this.files.has(r);)r=`${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=J("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"),et(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(r,this.serializeXml(c)),r}async emitPageBackground(t,e,n,r){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:r,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);st(h,tt(n,r)),this.applyTransparency(t,h,1,void 0,f),this.appendFillTransparency(h,p,g)}async emitBlock(t,e){if(!et(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 r=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,r);return;case"//ly.img.ubq/graphic":await this.emitGraphic(t,e,r);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)),r=this.engine.block.getFlipHorizontal(t),s=this.engine.block.getFlipVertical(t);return{x:this.toPoints(this.engine.block.getPositionX(t))-(r?e:0),y:this.toPoints(this.engine.block.getPositionY(t))-(s?n:0),width:e,height:n,rotation:this.engine.block.getRotation(t),flipHorizontal:r,flipVertical:s}}startElement(t,e,n,r,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(r))}elementTransform(t){return Rt(ae(this.pageContentTransform,le(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=ee(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(Dt(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&&Ce(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 Le(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 Ne(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=Oe(T);st(d,tt(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?Me(T,this.effectiveTextAlignment(t)):ke(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(!(!et(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 Et(this.engine,n);return s?(await ht(s))?.bytes??null:null}catch{return null}})());let r=await this.fontBytes.get(n);if(r&&_e(r,e.text)===!0)return!0}return!1}async requiresTextXmlRaster(t){if(Y(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,r=n?.family??e.typeface?.name??"",s=n&&/[#&]wght=/.test(e.resolvedFontFileUri??"")?j(n,e.resolvedFontFileUri)??"":n?.subfamily??"";if(Y(r)||Y(s)||Y(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=Dt(this.engine,t),n=this.engine.block.isFillEnabled(t)?e.map(u=>N(u.color)).filter(u=>u>0):[],r=this.engine.block.isStrokeEnabled(t)&&this.engine.block.getStrokeWidth(t)>0&&N(this.engine.block.getStrokeColor(t))>0,s=r?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||r&&n.length>0&&(o||s<1)||l&&(s<1||this.engine.block.getOpacity(t)<1)||c}async emitRasterizedPageBlock(t,e,n,r={}){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 Zt(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 Zt(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=$t(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"),st(f,tt(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",Rt([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(ot(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,...r}),!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(r=>r.width>0&&r.height>0);if(e.length===0)return!1;let n=e[0].baselineY;return e.every(r=>Math.abs(r.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[r]=this.engine.block.getTextCharacterInkBoxes(t,0,1);if(!r)return null;let s=this.engine.block.getGlobalBoundingBoxY(t),o=r.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 r;try{if(!this.engine.block.getBool(t,"backgroundColor/enabled"))return;r=this.engine.block.getColor(t,"backgroundColor/color")}catch{return}let s=N(r);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(Q(r))).attr("StrokeWeight","0").attr("StrokeColor","Swatch/None");"tint"in r&&r.tint!==1&&h.attr("FillTint",b(Math.max(0,Math.min(1,r.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=tt(n.width+a+c,n.height+l+u).map(f=>({...f,points:f.points.map(d=>({anchor:Wt(d.anchor,-a,-l),left:Wt(d.left,-a,-l),right:Wt(d.right,-a,-l)}))}));st(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,r=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?(r=a,this.logger.emit("TEXT_STROKE_ALPHA_FOLDED",{block:t})):this.logger.emit("TEXT_STROKE_ALPHA_DROPPED",{block:t})}}}}catch{n=null,r=1}if(e&&r===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?(r=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:r}}withTrackingAllowance(t,e){if(e.rotation!==0||e.flipHorizontal||this.engine.block.getEnum(t,"width/mode")!=="Auto")return e;let n=ve(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"?gt(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 r=this.safeGetFill(t),s=r!=null&&this.engine.block.isValid(r)?this.engine.block.getType(r):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,r)||this.emitShape(t,e,n,r,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=Xt(this.engine.block.getString(e,"vector_path/path"),1,1);return"error"in n||!ce(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,r,s){let{tag:o,subPaths:a}=this.resolveShapeGeometry(t,n),l=this.startElement(o,t,e,n,"shape_").attr("ContentType","Unassigned"),c={alphaMultiplier:1};r!=null&&s!=null&&s!=="//ly.img.ubq/fill/image"&&this.engine.block.isFillEnabled(t)?c=this.applyFillAttributes(l,r,s,n):l.attr("FillColor","Swatch/None");let u=this.applyStrokeAttributes(t,l);this.applyCornerRadii(t,l),st(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 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:ue(e.width,e.height)};case"//ly.img.ubq/shape/rect":case null:return{tag:"Rectangle",subPaths:tt(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:ge(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:he(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=Xt(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:tt(e.width,e.height)})}default:return this.logger.emit("UNSUPPORTED_SHAPE_TYPE",{block:t,shapeType:r}),{tag:"Rectangle",subPaths:tt(e.width,e.height)}}}applyFillAttributes(t,e,n,r){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(Q(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,r):this.applyRadialGradientGeometry(t,e,r);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(Q(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:se(s.map((h,p)=>({opacity:l[p],location:h.stop})))}})}return t.attr("FillColor","Swatch/None"),{alphaMultiplier:1}}applyLinearGradientGeometry(t,e,n){let r={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:r.x*n.width,y:r.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",Vt(u)),{start:o,angle:h,length:u}}applyRadialGradientGeometry(t,e,n){let r=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:r*n.width,y:s*n.height},angle:0,length:a};return a===0||t.attr("GradientFillStart",`${b(r*n.width)} ${b(s*n.height)}`).attr("GradientFillLength",Vt(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 r=this.engine.block.getStrokeWidth(t);if(r<=0)return n();let s=this.engine.block.getStrokeColor(t);e.attr("StrokeColor",this.colors.register(Q(s))).attr("StrokeWeight",b(this.toPoints(r))),"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=Cn[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 r=[["TL","TopLeft"],["TR","TopRight"],["BL","BottomLeft"],["BR","BottomRight"]];for(let[s,o]of r){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,r,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"&&(Ln.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&&!r&&a==null&&s>=1)return;if(s<1&&this.logger.emit("STROKE_ALPHA_AS_TRANSPARENCY",{block:t}),l>=1&&!c&&!r&&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(Q(h)))}r&&this.appendGradientFeather(u,r),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 r=t.element("FillTransparencySetting");e<1&&r.element("BlendingSetting").attr("Opacity",b(Math.max(0,e)*100)),n&&this.appendGradientFeather(r,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",Vt(e.geometry.length));e.type==="Linear"&&n.attr("Angle",b(e.geometry.angle)),e.stops.forEach((r,s)=>{n.element("OpacityGradientStop").attr("Self",this.allocateUniqueId(`feather_u${++this.idCounter}s${s}`)).attr("Opacity",b(r.opacity*100)).attr("Location",b(r.location*100))})}async emitImageRectangle(t,e,n,r){let s=this.resolveImageUri(r),o=s?await fe(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),st(c,l);let h=o.isSvg?de(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",Rt(p));o.isSvg||d.attr("ImageTypeName",pe(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(ot(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 r;try{r=this.engine.block.supportsCrop(t)}catch{r=!1}let s=e.width,o=e.height,a=0,l=0,c=0;r&&(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}}};export{jt as IDMLExporter,Ft as Logger,pn as collectDocumentFonts,Xr as exportIdml,$r as exportIdmlPackage};
|
|
28
|
+
`);for(let[e,t]of this.files)i(e,t);return r.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(T(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 N(e,t,e=>this.logger.emit(`XML_CHARACTERS_REPLACED`,{...e}))}buildDesignMap(e){let t=new M(`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=P(`Graphic`);for(let t of this.colors.getResourceElements())e.append(t);return this.serializeXml(e)}registerFont(e,t,n){if([e,t,n].some(T))return;let r=JSON.stringify([e,t,n]);this.fonts.set(r,{family:e,style:t,postScriptName:n})}buildFontResources(){let e=P(`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=P(`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=P(`Preferences`),r=e=>F(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`,F(t(`page/margin/top`))).attr(`DocumentBleedBottomOffset`,F(t(`page/margin/bottom`))).attr(`DocumentBleedInsideOrLeftOffset`,F(t(`page/margin/left`))).attr(`DocumentBleedOutsideOrRightOffset`,F(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=P(`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 ${F(a)} ${F(i)}`).attr(`ItemTransform`,`1 0 0 1 0 0`),U(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);B(u,V(n,r)),this.applyTransparency(e,u,1,void 0,p),this.appendFillTransparency(u,d,f)}async emitBlock(e,t){if(!U(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)&&L(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)&&L(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)&&L(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:v(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 z(re(this.pageContentTransform,ie(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=d(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=>L(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($(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&&nt(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 rt(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`)&&L(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 at(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 f=this.startElement(`TextFrame`,e,t,n,`text_`).attr(`ParentStory`,s).attr(`ContentType`,`TextType`),p=this.engine.block.getEnum(e,`text/verticalAlignment`),m=mt(p);B(f,V(n.width,n.height));let h=this.isSingleLine(e),g=f.element(`TextFramePreference`).attr(`AutoSizingType`,l??(c?`Off`:h?`HeightAndWidth`:`HeightOnly`)).attr(`AutoSizingReferencePoint`,h||u?pt(p,this.effectiveTextAlignment(e)):ft(p));(u||h&&!c)&&g.attr(`UseNoLineBreaksForAutoSizing`,`true`);let _=m===`CenterAlign`||m===`BottomAlign`?null:this.firstBaselineOffset(e);_!=null&&g.attr(`FirstBaselineOffset`,`FixedHeight`).attr(`MinimumFirstBaselineOffset`,String(_)),m&&g.attr(`VerticalJustification`,m),this.applyTransparency(e,f,o)}async prepareTextFontFallbacks(){for(let e of this.engine.block.findByType(`text`))if(U(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 Q(this.engine,e);return t?(await X(t))?.bytes??null:null}catch{return null}})());let n=await this.fontBytes.get(e);if(n&&Ke(n,t.text)===!0)return!0}return!1}async requiresTextXmlRaster(e){if(T(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??``)?K(e,t.resolvedFontFileUri)??``:e?.subfamily??``;if(T(n)||T(r)||T(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&&L(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=$(this.engine,e),n=this.engine.block.isFillEnabled(e)?t.map(e=>L(e.color)).filter(e=>e>0):[],r=this.engine.block.isStrokeEnabled(e)&&this.engine.block.getStrokeWidth(e)>0&&L(this.engine.block.getStrokeColor(e))>0,i=r?L(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`)&&L(this.engine.block.getColor(e,`backgroundColor/color`))>0,c=t.some(e=>e.textDecoration?.underlineColor&&L(e.textDecoration.underlineColor)!==L(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 Je(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 Je(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`),B(p,V(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`,z([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`,F(c.width)).attr(`Bottom`,F(c.height)),h.element(`Contents`).cdata(H(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=L(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(R(r))).attr(`StrokeWeight`,`0`).attr(`StrokeColor`,`Swatch/None`);`tint`in r&&r.tint!==1&&u.attr(`FillTint`,F(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`,F(d));B(u,V(n.width+o+c,n.height+s+l).map(e=>({...e,points:e.points.map(e=>({anchor:bt(e.anchor,-o,-s),left:bt(e.left,-o,-s),right:bt(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=L(a)>0?{color:a,weightPt:this.toPoints(i),position:this.engine.block.getStrokePosition(e),cornerGeometry:this.engine.block.getStrokeCornerGeometry(e)}:null;let o=L(a);if(o>0&&o<1){let n=this.engine.block.getTextRuns(e);!(t&&n.some(e=>L(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=>L(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=dt(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`?h(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||!ae(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),B(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:se(t.width,t.height)};case`//ly.img.ubq/shape/rect`:case null:return{tag:`Rectangle`,subPaths:V(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:ce(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:le(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:V(t.width,t.height)})}default:return this.logger.emit(`UNSUPPORTED_SHAPE_TYPE`,{block:e,shapeType:r}),{tag:`Rectangle`,subPaths:V(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=L(n);return r<=0?(e.attr(`FillColor`,`Swatch/None`),{alphaMultiplier:1}):(e.attr(`FillColor`,this.colors.register(R(n))),`tint`in n&&n.tint<1&&e.attr(`FillTint`,F(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=L(t);return this.logger.emit(`DEGENERATE_GRADIENT_AS_SOLID`),n<=0?(e.attr(`FillColor`,`Swatch/None`),{alphaMultiplier:1}):(e.attr(`FillColor`,this.colors.register(R(t))),`tint`in t&&t.tint<1&&e.attr(`FillTint`,F(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=>L(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:ne(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`,`${F(a.x)} ${F(a.y)}`).attr(`GradientFillAngle`,F(u)).attr(`GradientFillLength`,xt(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`,`${F(r*n.width)} ${F(i*n.height)}`).attr(`GradientFillLength`,xt(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(R(i))).attr(`StrokeWeight`,F(this.toPoints(r))),`tint`in i&&i.tint<1&&t.attr(`StrokeTint`,F(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=St[this.engine.block.getStrokeStyle(e)];return s&&t.attr(`StrokeType`,s),L(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`,F(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`&&(Ct.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`,F(Math.max(0,s)*100))}if(c){let t=this.engine.block.getDropShadowColor(e),n=L(t);l.element(`DropShadowSetting`).attr(`Mode`,`Drop`).attr(`XOffset`,F(this.toPoints(this.engine.block.getDropShadowOffsetX(e)))).attr(`YOffset`,F(this.toPoints(this.engine.block.getDropShadowOffsetY(e)))).attr(`Size`,F(this.toPoints(this.engine.block.getDropShadowBlurRadiusX(e)))).attr(`Opacity`,F(n*100)).attr(`EffectColor`,this.colors.registerWithTint(R(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`,F(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`,F(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`,`${F(t.geometry.start.x)} ${F(t.geometry.start.y)}`).attr(`Length`,xt(t.geometry.length));t.type===`Linear`&&n.attr(`Angle`,F(t.geometry.angle)),t.stops.forEach((e,t)=>{n.element(`OpacityGradientStop`).attr(`Self`,this.allocateUniqueId(`feather_u${++this.idCounter}s${t}`)).attr(`Opacity`,F(e.opacity*100)).attr(`Location`,F(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),B(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`,z(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`,F(f)).attr(`Bottom`,F(p)),h.element(`Contents`).cdata(H(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=v(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}}};export{wt as IDMLExporter,et as Logger,Be as collectDocumentFonts,gt as exportIdml,_t as exportIdmlPackage};
|