@imgly/plugin-ai-text-generation-web 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +652 -0
- package/README.md +126 -0
- package/dist/anthropic/AnthropicProvider.d.ts +21 -0
- package/dist/anthropic/index.d.ts +5 -0
- package/dist/anthropic/index.mjs +206 -0
- package/dist/anthropic/index.mjs.map +7 -0
- package/dist/anthropic/prompts/changeTextTo.d.ts +2 -0
- package/dist/anthropic/prompts/changeTone.d.ts +2 -0
- package/dist/anthropic/prompts/fix.d.ts +2 -0
- package/dist/anthropic/prompts/generateTextForSpeech.d.ts +2 -0
- package/dist/anthropic/prompts/improve.d.ts +2 -0
- package/dist/anthropic/prompts/longer.d.ts +2 -0
- package/dist/anthropic/prompts/shorter.d.ts +2 -0
- package/dist/anthropic/prompts/translate.d.ts +16 -0
- package/dist/anthropic/sendPrompt.d.ts +19 -0
- package/dist/constants.d.ts +1 -0
- package/dist/iconSprite.d.ts +3 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +161 -0
- package/dist/index.mjs.map +7 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/types.d.ts +14 -0
- package/package.json +78 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const LANGUAGES: {
|
|
2
|
+
readonly en_US: "English (US)";
|
|
3
|
+
readonly en_UK: "English (UK)";
|
|
4
|
+
readonly es: "Spanish";
|
|
5
|
+
readonly fr: "French";
|
|
6
|
+
readonly de: "German";
|
|
7
|
+
readonly pt: "Portuguese";
|
|
8
|
+
readonly it: "Italian";
|
|
9
|
+
readonly ru: "Russian";
|
|
10
|
+
readonly zh: "Mandarin Chinese";
|
|
11
|
+
readonly ja: "Japanese";
|
|
12
|
+
};
|
|
13
|
+
export declare const LOCALES: Locale[];
|
|
14
|
+
export type Locale = keyof typeof LANGUAGES;
|
|
15
|
+
declare function translate(text: string, locale: Locale): string;
|
|
16
|
+
export default translate;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
|
+
export declare const DEFAULT_ANTHROPIC_PARAMS: {
|
|
3
|
+
model: string;
|
|
4
|
+
max_tokens: number;
|
|
5
|
+
temperature: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const DEFAULT_ANTHROPIC_OPTIONS: {
|
|
8
|
+
headers: {
|
|
9
|
+
'x-api-key': null;
|
|
10
|
+
authorization: null;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare function sendPrompt(anthropic: Anthropic, config: {
|
|
14
|
+
proxyUrl: string;
|
|
15
|
+
model?: string;
|
|
16
|
+
maxTokens?: number;
|
|
17
|
+
temperature?: number;
|
|
18
|
+
}, prompt: string, signal: AbortSignal): Promise<AsyncGenerator<string, void, unknown>>;
|
|
19
|
+
export default sendPrompt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PLUGIN_ID = "@imgly/plugin-ai-text-generation-web";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const PLUGIN_ICON_SET_ID = "@imgly/plugin-ai-text-generation";
|
|
2
|
+
declare const iconSprite = "\n <svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/Sparkle\"\n >\n <path d=\"M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z\" fill=\"currentColor\"/>\n<path d=\"M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z\" fill=\"currentColor\"/>\n<path d=\"M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z\" fill=\"currentColor\"/>\n\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/Language\"\n >\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.1188 12.8768L11.4719 14.6133L9.1 12.2414L5.35 15.9914L4.14309 14.7845L7.96452 11.0156C7.04982 9.98423 6.31561 8.84524 5.77623 7.64087L5.71314 7.5H7.42861L7.45649 7.55438C7.89377 8.40744 8.44158 9.21897 9.09989 9.96235C10.1004 8.82939 10.8479 7.5455 11.336 6.1925H3V4.5H8.25V3H9.95V4.5H15.2V6.2H12.976C12.4276 7.93841 11.5121 9.58156 10.2367 11.017L12.1188 12.8768Z\" fill=\"currentColor\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M16.5371 11.0469L20.2764 21H18.2803L17.5324 18.7852H13.8155L13.0713 21H11.082L14.8008 11.0469H16.5371ZM14.314 17.3018H17.0316L15.6695 13.2679L14.314 17.3018Z\" fill=\"currentColor\"/>\n\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/Microphone\"\n >\n <path d=\"M22.0009 8C22.0009 9.42939 21.5011 10.742 20.6667 11.7727C19.2294 10.8473 17.4614 9.56645 15.9479 8.053C14.4345 6.53955 13.1536 4.77155 12.2282 3.33426C13.2589 2.49984 14.5715 2 16.0009 2C19.3146 2 22.0009 4.68629 22.0009 8Z\" fill=\"currentColor\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.0009 8C10.0009 6.67122 10.4329 5.44332 11.164 4.44907C12.1058 5.88166 13.3791 7.60552 14.8873 9.11366C16.3954 10.6218 18.1193 11.8951 19.5519 12.8369C18.5576 13.568 17.3297 14 16.0009 14C15.7709 14 15.5439 13.9871 15.3206 13.9619L11.9933 16.876C11.9983 16.9166 12.0009 16.958 12.0009 17V22C12.0009 22.5523 11.5532 23 11.0009 23C10.4486 23 10.0009 22.5523 10.0009 22V18.621L6.70661 21.5063C5.91426 22.2002 4.71947 22.1607 3.97468 21.4159L2.58384 20.0251C1.83905 19.2803 1.79955 18.0855 2.49353 17.2932L10.0388 8.67822C10.0138 8.4556 10.0009 8.2293 10.0009 8ZM10.7488 10.9032L3.99805 18.6109L5.38889 20.0017L13.0963 13.2513C12.1106 12.7049 11.2949 11.889 10.7488 10.9032Z\" fill=\"currentColor\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/TextLonger\"\n >\n <path d=\"M21 3H3V5H21V3Z\" fill=\"currentColor\"/>\n<path d=\"M21 8H3V10H21V8Z\" fill=\"currentColor\"/>\n<path d=\"M3 13H21V15H3V13Z\" fill=\"currentColor\"/>\n<path d=\"M14 18H3V20H14V18Z\" fill=\"currentColor\"/\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/TextShorter\"\n >\n <path d=\"M21 8H3V10H21V8Z\" fill=\"currentColor\"/>\n<path d=\"M13 13H3V15H13V13Z\" fill=\"currentColor\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/CheckmarkAll\"\n >\n <path d=\"M16.4052 6.84412L14.8434 5.59473L6.82422 15.6187L2.79961 12.6003L1.59961 14.2003L6.39961 17.8003C6.83171 18.1244 7.44307 18.0468 7.78048 17.625L16.4052 6.84412Z\" fill=\"currentColor\"/>\n<path d=\"M22.4052 6.84412L20.8434 5.59473L12.8242 15.6187L11.7996 14.8503L10.5996 16.4503L12.3996 17.8003C12.8317 18.1244 13.4431 18.0468 13.7805 17.625L22.4052 6.84412Z\" fill=\"currentColor\"/>\n\n </symbol>\n\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/MagicWand\"\n >\n <path d=\"M7.27597 1.94728C7.3681 1.76302 7.63105 1.76302 7.72318 1.94728L8.46231 3.42553C8.4865 3.47391 8.52573 3.51314 8.57411 3.53733L10.0524 4.27646C10.2366 4.36859 10.2366 4.63154 10.0524 4.72367L8.57411 5.4628C8.52573 5.48699 8.4865 5.52622 8.46231 5.5746L7.72318 7.05285C7.63105 7.23711 7.3681 7.23711 7.27597 7.05285L6.53685 5.57461C6.51266 5.52622 6.47342 5.48699 6.42503 5.4628L4.94681 4.72382C4.76254 4.63171 4.76252 4.36875 4.94677 4.27661L6.42505 3.53733C6.47343 3.51314 6.51265 3.47391 6.53684 3.42554L7.27597 1.94728Z\" fill=\"currentColor\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.99943 9.0857C8.21838 9.86675 8.21838 11.1331 8.99943 11.9141L18.0854 21.0001C18.8665 21.7812 20.1329 21.7811 20.9139 21L22.4996 19.4141C23.2805 18.633 23.2805 17.3668 22.4995 16.5858L13.4136 7.49991C12.6326 6.71886 11.3663 6.71887 10.5852 7.49991L8.99943 9.0857ZM10.4136 10.4999L11.9994 8.91413L15.0427 11.9574L13.4569 13.5432L10.4136 10.4999Z\" fill=\"currentColor\"/>\n<path d=\"M4.72318 10.4473C4.63105 10.263 4.3681 10.263 4.27597 10.4473L3.70351 11.5922C3.67932 11.6406 3.64009 11.6798 3.59172 11.704L2.44677 12.2766C2.26252 12.3687 2.26254 12.6317 2.44681 12.7238L3.5917 13.2961C3.64009 13.3203 3.67932 13.3596 3.70352 13.4079L4.27597 14.5529C4.3681 14.7371 4.63105 14.7371 4.72318 14.5529L5.29564 13.4079C5.31983 13.3596 5.35906 13.3203 5.40745 13.2961L6.55236 12.7237C6.73663 12.6315 6.73662 12.3686 6.55236 12.2765L5.40745 11.704C5.35906 11.6798 5.31983 11.6406 5.29564 11.5922L4.72318 10.4473Z\" fill=\"currentColor\"/>\n<path d=\"M13.276 3.44728C13.3681 3.26302 13.6311 3.26302 13.7232 3.44728L13.9623 3.92553C13.9865 3.97391 14.0257 4.01314 14.0741 4.03733L14.5524 4.27646C14.7366 4.36859 14.7366 4.63154 14.5524 4.72367L14.0741 4.9628C14.0257 4.98699 13.9865 5.02622 13.9623 5.0746L13.7232 5.55285C13.6311 5.73711 13.3681 5.73711 13.276 5.55285L13.0368 5.07461C13.0127 5.02622 12.9734 4.98699 12.925 4.9628L12.4468 4.72373C12.2625 4.63161 12.2625 4.36866 12.4468 4.27652L12.9251 4.03733C12.9734 4.01314 13.0127 3.97391 13.0368 3.92554L13.276 3.44728Z\" fill=\"currentColor\"/>\n<path d=\"M3.72318 6.44728C3.63105 6.26302 3.3681 6.26302 3.27597 6.44728L3.03684 6.92554C3.01265 6.97392 2.97343 7.01314 2.92505 7.03733L2.44677 7.27652C2.26252 7.36866 2.26254 7.63161 2.44681 7.72373L2.92503 7.9628C2.97342 7.98699 3.01266 8.02622 3.03685 8.07461L3.27597 8.55285C3.3681 8.73711 3.63105 8.73711 3.72318 8.55285L3.96231 8.0746C3.9865 8.02622 4.02573 7.98699 4.07411 7.9628L4.55236 7.72367C4.73663 7.63154 4.73663 7.36859 4.55236 7.27646L4.07411 7.03733C4.02573 7.01314 3.9865 6.97391 3.96231 6.92553L3.72318 6.44728Z\" fill=\"currentColor\"/>\n </symbol>\n </svg>\n";
|
|
3
|
+
export default iconSprite;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PluginConfiguration } from './types';
|
|
2
|
+
declare const Plugin: (pluginConfiguration: PluginConfiguration) => {
|
|
3
|
+
initialize: (context: import("@cesdk/cesdk-js").EnginePluginContext & {
|
|
4
|
+
cesdk?: import("@cesdk/cesdk-js").default;
|
|
5
|
+
}) => void;
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
export default Plugin;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var ue="@imgly/plugin-ai-text-generation",tt=`
|
|
2
|
+
<svg>
|
|
3
|
+
<symbol
|
|
4
|
+
fill="none"
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
id="@imgly/Sparkle"
|
|
8
|
+
>
|
|
9
|
+
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
|
|
10
|
+
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
|
|
11
|
+
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
|
|
12
|
+
|
|
13
|
+
</symbol>
|
|
14
|
+
<symbol
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
id="@imgly/Language"
|
|
19
|
+
>
|
|
20
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1188 12.8768L11.4719 14.6133L9.1 12.2414L5.35 15.9914L4.14309 14.7845L7.96452 11.0156C7.04982 9.98423 6.31561 8.84524 5.77623 7.64087L5.71314 7.5H7.42861L7.45649 7.55438C7.89377 8.40744 8.44158 9.21897 9.09989 9.96235C10.1004 8.82939 10.8479 7.5455 11.336 6.1925H3V4.5H8.25V3H9.95V4.5H15.2V6.2H12.976C12.4276 7.93841 11.5121 9.58156 10.2367 11.017L12.1188 12.8768Z" fill="currentColor"/>
|
|
21
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5371 11.0469L20.2764 21H18.2803L17.5324 18.7852H13.8155L13.0713 21H11.082L14.8008 11.0469H16.5371ZM14.314 17.3018H17.0316L15.6695 13.2679L14.314 17.3018Z" fill="currentColor"/>
|
|
22
|
+
|
|
23
|
+
</symbol>
|
|
24
|
+
<symbol
|
|
25
|
+
fill="none"
|
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
id="@imgly/Microphone"
|
|
29
|
+
>
|
|
30
|
+
<path d="M22.0009 8C22.0009 9.42939 21.5011 10.742 20.6667 11.7727C19.2294 10.8473 17.4614 9.56645 15.9479 8.053C14.4345 6.53955 13.1536 4.77155 12.2282 3.33426C13.2589 2.49984 14.5715 2 16.0009 2C19.3146 2 22.0009 4.68629 22.0009 8Z" fill="currentColor"/>
|
|
31
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0009 8C10.0009 6.67122 10.4329 5.44332 11.164 4.44907C12.1058 5.88166 13.3791 7.60552 14.8873 9.11366C16.3954 10.6218 18.1193 11.8951 19.5519 12.8369C18.5576 13.568 17.3297 14 16.0009 14C15.7709 14 15.5439 13.9871 15.3206 13.9619L11.9933 16.876C11.9983 16.9166 12.0009 16.958 12.0009 17V22C12.0009 22.5523 11.5532 23 11.0009 23C10.4486 23 10.0009 22.5523 10.0009 22V18.621L6.70661 21.5063C5.91426 22.2002 4.71947 22.1607 3.97468 21.4159L2.58384 20.0251C1.83905 19.2803 1.79955 18.0855 2.49353 17.2932L10.0388 8.67822C10.0138 8.4556 10.0009 8.2293 10.0009 8ZM10.7488 10.9032L3.99805 18.6109L5.38889 20.0017L13.0963 13.2513C12.1106 12.7049 11.2949 11.889 10.7488 10.9032Z" fill="currentColor"/>
|
|
32
|
+
</symbol>
|
|
33
|
+
<symbol
|
|
34
|
+
fill="none"
|
|
35
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
36
|
+
viewBox="0 0 24 24"
|
|
37
|
+
id="@imgly/TextLonger"
|
|
38
|
+
>
|
|
39
|
+
<path d="M21 3H3V5H21V3Z" fill="currentColor"/>
|
|
40
|
+
<path d="M21 8H3V10H21V8Z" fill="currentColor"/>
|
|
41
|
+
<path d="M3 13H21V15H3V13Z" fill="currentColor"/>
|
|
42
|
+
<path d="M14 18H3V20H14V18Z" fill="currentColor"/
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol
|
|
45
|
+
fill="none"
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
viewBox="0 0 24 24"
|
|
48
|
+
id="@imgly/TextShorter"
|
|
49
|
+
>
|
|
50
|
+
<path d="M21 8H3V10H21V8Z" fill="currentColor"/>
|
|
51
|
+
<path d="M13 13H3V15H13V13Z" fill="currentColor"/>
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol
|
|
54
|
+
fill="none"
|
|
55
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
56
|
+
viewBox="0 0 24 24"
|
|
57
|
+
id="@imgly/CheckmarkAll"
|
|
58
|
+
>
|
|
59
|
+
<path d="M16.4052 6.84412L14.8434 5.59473L6.82422 15.6187L2.79961 12.6003L1.59961 14.2003L6.39961 17.8003C6.83171 18.1244 7.44307 18.0468 7.78048 17.625L16.4052 6.84412Z" fill="currentColor"/>
|
|
60
|
+
<path d="M22.4052 6.84412L20.8434 5.59473L12.8242 15.6187L11.7996 14.8503L10.5996 16.4503L12.3996 17.8003C12.8317 18.1244 13.4431 18.0468 13.7805 17.625L22.4052 6.84412Z" fill="currentColor"/>
|
|
61
|
+
|
|
62
|
+
</symbol>
|
|
63
|
+
|
|
64
|
+
<symbol
|
|
65
|
+
fill="none"
|
|
66
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
+
viewBox="0 0 24 24"
|
|
68
|
+
id="@imgly/MagicWand"
|
|
69
|
+
>
|
|
70
|
+
<path d="M7.27597 1.94728C7.3681 1.76302 7.63105 1.76302 7.72318 1.94728L8.46231 3.42553C8.4865 3.47391 8.52573 3.51314 8.57411 3.53733L10.0524 4.27646C10.2366 4.36859 10.2366 4.63154 10.0524 4.72367L8.57411 5.4628C8.52573 5.48699 8.4865 5.52622 8.46231 5.5746L7.72318 7.05285C7.63105 7.23711 7.3681 7.23711 7.27597 7.05285L6.53685 5.57461C6.51266 5.52622 6.47342 5.48699 6.42503 5.4628L4.94681 4.72382C4.76254 4.63171 4.76252 4.36875 4.94677 4.27661L6.42505 3.53733C6.47343 3.51314 6.51265 3.47391 6.53684 3.42554L7.27597 1.94728Z" fill="currentColor"/>
|
|
71
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99943 9.0857C8.21838 9.86675 8.21838 11.1331 8.99943 11.9141L18.0854 21.0001C18.8665 21.7812 20.1329 21.7811 20.9139 21L22.4996 19.4141C23.2805 18.633 23.2805 17.3668 22.4995 16.5858L13.4136 7.49991C12.6326 6.71886 11.3663 6.71887 10.5852 7.49991L8.99943 9.0857ZM10.4136 10.4999L11.9994 8.91413L15.0427 11.9574L13.4569 13.5432L10.4136 10.4999Z" fill="currentColor"/>
|
|
72
|
+
<path d="M4.72318 10.4473C4.63105 10.263 4.3681 10.263 4.27597 10.4473L3.70351 11.5922C3.67932 11.6406 3.64009 11.6798 3.59172 11.704L2.44677 12.2766C2.26252 12.3687 2.26254 12.6317 2.44681 12.7238L3.5917 13.2961C3.64009 13.3203 3.67932 13.3596 3.70352 13.4079L4.27597 14.5529C4.3681 14.7371 4.63105 14.7371 4.72318 14.5529L5.29564 13.4079C5.31983 13.3596 5.35906 13.3203 5.40745 13.2961L6.55236 12.7237C6.73663 12.6315 6.73662 12.3686 6.55236 12.2765L5.40745 11.704C5.35906 11.6798 5.31983 11.6406 5.29564 11.5922L4.72318 10.4473Z" fill="currentColor"/>
|
|
73
|
+
<path d="M13.276 3.44728C13.3681 3.26302 13.6311 3.26302 13.7232 3.44728L13.9623 3.92553C13.9865 3.97391 14.0257 4.01314 14.0741 4.03733L14.5524 4.27646C14.7366 4.36859 14.7366 4.63154 14.5524 4.72367L14.0741 4.9628C14.0257 4.98699 13.9865 5.02622 13.9623 5.0746L13.7232 5.55285C13.6311 5.73711 13.3681 5.73711 13.276 5.55285L13.0368 5.07461C13.0127 5.02622 12.9734 4.98699 12.925 4.9628L12.4468 4.72373C12.2625 4.63161 12.2625 4.36866 12.4468 4.27652L12.9251 4.03733C12.9734 4.01314 13.0127 3.97391 13.0368 3.92554L13.276 3.44728Z" fill="currentColor"/>
|
|
74
|
+
<path d="M3.72318 6.44728C3.63105 6.26302 3.3681 6.26302 3.27597 6.44728L3.03684 6.92554C3.01265 6.97392 2.97343 7.01314 2.92505 7.03733L2.44677 7.27652C2.26252 7.36866 2.26254 7.63161 2.44681 7.72373L2.92503 7.9628C2.97342 7.98699 3.01266 8.02622 3.03685 8.07461L3.27597 8.55285C3.3681 8.73711 3.63105 8.73711 3.72318 8.55285L3.96231 8.0746C3.9865 8.02622 4.02573 7.98699 4.07411 7.9628L4.55236 7.72367C4.73663 7.63154 4.73663 7.36859 4.55236 7.27646L4.07411 7.03733C4.02573 7.01314 3.9865 6.97391 3.96231 6.92553L3.72318 6.44728Z" fill="currentColor"/>
|
|
75
|
+
</symbol>
|
|
76
|
+
</svg>
|
|
77
|
+
`,ce=tt;function je(e,t){if(!t.startsWith("#/"))throw new Error(`External references are not supported: ${t}`);let n=t.substring(2).split("/"),r=e;for(let a of n){if(r==null)throw new Error(`Invalid reference path: ${t}`);r=r[a]}if(r===void 0)throw new Error(`Reference not found: ${t}`);return r}function z(e,t,n=new Set){if(t==null||n.has(t))return t;if(n.add(t),t.$ref&&typeof t.$ref=="string"){let r=je(e,t.$ref),a={...z(e,r,n)};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&o!=="$ref"&&(a[o]=z(e,t[o],n));return a}if(Array.isArray(t))return t.map(r=>z(e,r,n));if(typeof t=="object"){let r={};for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=z(e,t[a],n));return r}return t}function rt(e){return z(e,{...e})}function nt(e,t=!1){let n=i=>(t&&console.log(`OpenAPI Schema validation failed: ${i}`),!1);if(typeof e!="object"||e===null)return n(`Input is ${e===null?"null":typeof e}, not an object`);let r=e;if(!(typeof r.type=="string"||Array.isArray(r.enum)||typeof r.properties=="object"||typeof r.items=="object"||typeof r.allOf=="object"||typeof r.anyOf=="object"||typeof r.oneOf=="object"||typeof r.not=="object"))return n("Missing required schema-defining properties (type, enum, properties, items, allOf, anyOf, oneOf, not)");if(r.type!==void 0){let i=["string","number","integer","boolean","array","object","null"];if(typeof r.type=="string"){if(!i.includes(r.type))return n(`Invalid type: ${r.type}. Must be one of ${i.join(", ")}`)}else if(Array.isArray(r.type)){for(let l of r.type)if(typeof l!="string"||!i.includes(l))return n(`Array of types contains invalid value: ${l}. Must be one of ${i.join(", ")}`)}else return n(`Type must be a string or array of strings, got ${typeof r.type}`)}if(r.items!==void 0&&(typeof r.items!="object"||r.items===null))return n(`Items must be an object, got ${r.items===null?"null":typeof r.items}`);if(r.properties!==void 0&&(typeof r.properties!="object"||r.properties===null))return n(`Properties must be an object, got ${r.properties===null?"null":typeof r.properties}`);let a=["allOf","anyOf","oneOf"];for(let i of a)if(r[i]!==void 0){if(!Array.isArray(r[i]))return n(`${i} must be an array, got ${typeof r[i]}`);for(let l=0;l<r[i].length;l++){let u=r[i][l];if(typeof u!="object"||u===null)return n(`Item ${l} in ${i} must be an object, got ${u===null?"null":typeof u}`)}}if(r.not!==void 0&&(typeof r.not!="object"||r.not===null))return n(`'not' must be an object, got ${r.not===null?"null":typeof r.not}`);if(r.additionalProperties!==void 0&&typeof r.additionalProperties!="boolean"&&(typeof r.additionalProperties!="object"||r.additionalProperties===null))return n(`additionalProperties must be a boolean or an object, got ${r.additionalProperties===null?"null":typeof r.additionalProperties}`);if(r.format!==void 0&&typeof r.format!="string")return n(`format must be a string, got ${typeof r.format}`);let o=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"];for(let i of o)if(r[i]!==void 0&&typeof r[i]!="number")return n(`${i} must be a number, got ${typeof r[i]}`);if(r.minLength!==void 0&&(typeof r.minLength!="number"||r.minLength<0))return n(`minLength must be a non-negative number, got ${typeof r.minLength=="number"?r.minLength:typeof r.minLength}`);if(r.maxLength!==void 0&&(typeof r.maxLength!="number"||r.maxLength<0))return n(`maxLength must be a non-negative number, got ${typeof r.maxLength=="number"?r.maxLength:typeof r.maxLength}`);if(r.pattern!==void 0&&typeof r.pattern!="string")return n(`pattern must be a string, got ${typeof r.pattern}`);if(r.minItems!==void 0&&(typeof r.minItems!="number"||r.minItems<0))return n(`minItems must be a non-negative number, got ${typeof r.minItems=="number"?r.minItems:typeof r.minItems}`);if(r.maxItems!==void 0&&(typeof r.maxItems!="number"||r.maxItems<0))return n(`maxItems must be a non-negative number, got ${typeof r.maxItems=="number"?r.maxItems:typeof r.maxItems}`);if(r.uniqueItems!==void 0&&typeof r.uniqueItems!="boolean")return n(`uniqueItems must be a boolean, got ${typeof r.uniqueItems}`);if(r.minProperties!==void 0&&(typeof r.minProperties!="number"||r.minProperties<0))return n(`minProperties must be a non-negative number, got ${typeof r.minProperties=="number"?r.minProperties:typeof r.minProperties}`);if(r.maxProperties!==void 0&&(typeof r.maxProperties!="number"||r.maxProperties<0))return n(`maxProperties must be a non-negative number, got ${typeof r.maxProperties=="number"?r.maxProperties:typeof r.maxProperties}`);if(r.required!==void 0){if(!Array.isArray(r.required))return n(`required must be an array, got ${typeof r.required}`);for(let i=0;i<r.required.length;i++){let l=r.required[i];if(typeof l!="string")return n(`Item ${i} in required array must be a string, got ${typeof l}`)}}return!0}function it(e,t){if(e.properties==null)throw new Error("Input schema must have properties");let n=[];return ot(e,t)??(Object.entries(e.properties).forEach(a=>{let o=a[0],i=a[1];n.push({id:o,schema:i})}),n)}function ot(e,t){if(t.orderExtensionKeyword==null)return;let n=[];if(typeof t.orderExtensionKeyword!="string"&&!Array.isArray(t.orderExtensionKeyword))throw new Error("orderExtensionKeyword must be a string or an array of strings");let r=typeof t.orderExtensionKeyword=="string"?[t.orderExtensionKeyword]:t.orderExtensionKeyword,a=r.find(i=>i in e);if(a==null)return;let o=e[a];if(o==null||Array.isArray(o)===!1)throw new Error(`Extension keyword ${a} must be an array of strings`);if([...new Set(o)].forEach(i=>{let l=e.properties?.[i];l!=null&&n.push({id:i,schema:l})}),n.length===0)throw new Error(`Could not find any properties with order extension keyword(s) ${r.join(", ")}`);return n}var Ae=it,at="ly.img.ai",Y="ly.img.ai/temp";async function lt(e,t){return e.engine.asset.findAllSources().includes(Y)||e.engine.asset.addLocalSource(Y),e.engine.asset.apply(Y,t)}function Se(e){return`${at}/${e}`}function st(e,t="We encountered an unknown error while generating the asset. Please try again."){if(e===null)return t;if(e instanceof Error)return e.message;if(typeof e=="object"){let n=e;return"message"in n&&typeof n.message=="string"?n.message:"cause"in n&&typeof n.cause=="string"?n.cause:"detail"in n&&typeof n.detail=="object"&&n.detail!==null&&"message"in n.detail&&typeof n.detail.message=="string"?n.detail.message:"error"in n&&typeof n.error=="object"&&n.error!==null&&"message"in n.error&&typeof n.error.message=="string"?n.error.message:t}return typeof e=="string"?e:String(e)||t}function ut(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ct(e,t=0,n="image/jpeg",r=.8){return new Promise((a,o)=>{try{let i=document.createElement("video");i.crossOrigin="anonymous",i.style.display="none",i.addEventListener("loadedmetadata",()=>{i.currentTime=Math.min(t,i.duration),i.addEventListener("seeked",()=>{let l=document.createElement("canvas");l.width=i.videoWidth,l.height=i.videoHeight;let u=l.getContext("2d");if(!u){document.body.removeChild(i),o(new Error("Failed to create canvas context"));return}u.drawImage(i,0,0,l.width,l.height);try{let s=l.toDataURL(n,r);document.body.removeChild(i),a(s)}catch(s){document.body.removeChild(i),o(new Error(`Failed to create thumbnail: ${s instanceof Error?s.message:String(s)}`))}},{once:!0})}),i.addEventListener("error",()=>{document.body.removeChild(i),o(new Error(`Failed to load video from ${e}`))}),i.src=e,document.body.appendChild(i)}catch(i){o(i)}})}function Te(e){return e?e.replace(/[_-]/g," ").replace(/([A-Z])/g," $1").trim().split(" ").filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" "):""}function oe(e){return typeof e=="object"&&e!==null&&"next"in e&&"return"in e&&"throw"in e&&typeof e.next=="function"&&typeof e.return=="function"&&typeof e.throw=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function A(e){return e instanceof Error&&e.name==="AbortError"}function Ne(e,t,n,r,a,o){let i=t.schema.type;if(r.renderCustomProperty!=null&&r.renderCustomProperty[t.id]!=null)return r.renderCustomProperty[t.id](e,t);switch(i){case"string":return t.schema.enum!=null?dt(e,t,n,r,a,o):Oe(e,t,n,r,a,o);case"boolean":return De(e,t,n,r,a,o);case"number":case"integer":return _e(e,t,n,r,a,o);case"object":return $e(e,t,n,r,a,o);case"array":break;case void 0:{if(t.schema.anyOf!=null&&Array.isArray(t.schema.anyOf))return pt(e,t,n,r,a,o);break}default:console.error(`Unsupported property type: ${i}`)}}function $e(e,t,n,r,a,o){let i=Ae(t.schema??{},r).reduce((l,u)=>{let s=Ne(e,u,n,r,a,o);return s!=null&&(l[u.id]=s()),l},{});return()=>({id:t.id,type:"object",value:i})}function Oe(e,t,n,r,a,o){let{builder:i,experimental:{global:l}}=e,{id:u}=t,s=`${n.id}.${u}`,c=t.schema.title??s,p=l(s,t.schema.default??""),g=gt(t.schema),m=g?.component!=null&&g?.component==="TextArea"?"TextArea":"TextInput";return i[m](s,{inputLabel:c,placeholder:a.i18n?.prompt,...p}),()=>({id:t.id,type:"string",value:p.value})}function dt(e,t,n,r,a,o){let{builder:i,experimental:{global:l}}=e,{id:u}=t,s=`${n.id}.${u}`,c=t.schema.title??s,p=t.schema.enum!=null&&"x-imgly-enum-labels"in t.schema.enum&&typeof t.schema.enum["x-imgly-enum-labels"]=="object"?t.schema.enum["x-imgly-enum-labels"]:{},g=(t.schema.enum??[]).map(v=>({id:v,label:p[v]??Te(v)})),m=t.schema.default!=null?g.find(v=>v.id===t.schema.default)??g[0]:g[0],C=l(s,m);return i.Select(s,{inputLabel:c,values:g,...C}),()=>({id:t.id,type:"string",value:C.value.id})}function De(e,t,n,r,a,o){let{builder:i,experimental:{global:l}}=e,{id:u}=t,s=`${n.id}.${u}`,c=t.schema.title??s,p=!!t.schema.default,g=l(s,p);return i.Checkbox(s,{inputLabel:c,...g}),()=>({id:t.id,type:"boolean",value:g.value})}function _e(e,t,n,r,a,o){let{builder:i,experimental:{global:l}}=e,{id:u}=t,s=`${n.id}.${u}`,c=t.schema.title??s,p=t.schema.minimum,g=t.schema.maximum,m=t.schema.default;m==null&&(p!=null?m=p:g!=null?m=g:m=0);let C=l(s,m);if(p!=null&&g!=null){let v=t.schema.type==="number"?.1:1;"x-imgly-step"in t.schema&&typeof t.schema["x-imgly-step"]=="number"&&(v=t.schema["x-imgly-step"]),i.Slider(s,{inputLabel:c,min:p,max:g,step:v,...C})}else i.NumberInput(s,{inputLabel:c,min:p,max:g,...C});return()=>({id:t.id,type:"integer",value:C.value})}function pt(e,t,n,r,a,o){let{builder:i,experimental:{global:l}}=e,{id:u}=t,s=`${n.id}.${u}`,c=t.schema.title??s,p=t.schema.anyOf??[],g=[],m={},C={};p.forEach((d,f)=>{let h=d.title??"common.custom",y=`${n.id}.${u}.anyOf[${f}]`,M="x-imgly-enum-labels"in t.schema&&typeof t.schema["x-imgly-enum-labels"]=="object"?t.schema["x-imgly-enum-labels"]:{},k="x-imgly-enum-icons"in t.schema&&typeof t.schema["x-imgly-enum-icons"]=="object"?t.schema["x-imgly-enum-icons"]:{};d.type==="string"?d.enum!=null?d.enum.forEach(x=>{g.push({id:x,label:M[x]??Te(x),icon:k[x]})}):(m[y]=()=>Oe(e,{id:y,schema:{...d,title:h}},n,r,a,o),g.push({id:y,label:M[h]??h,icon:k[h]})):d.type==="boolean"?(m[y]=()=>De(e,{id:y,schema:{...d,title:h}},n,r,a,o),g.push({id:y,label:M[h]??h,icon:k[h]})):d.type==="integer"?(m[y]=()=>_e(e,{id:y,schema:{...d,title:h}},n,r,a,o),g.push({id:y,label:M[h]??h,icon:k[h]})):d.type==="array"||d.type==="object"&&(m[y]=()=>$e(e,{id:y,schema:{...d,title:h}},n,r,a,o),g.push({id:y,label:M[h]??h,icon:k[h]}))});let v=t.schema.default!=null?g.find(d=>d.id===t.schema.default)??g[0]:g[0],b=l(s,v);if(i.Select(s,{inputLabel:c,values:g,...b}),b.value.id in m){let d=m[b.value.id]();C[b.value.id]=d}return()=>{let d=C[b.value.id];return d!=null?{...d(),id:t.id}:{id:t.id,type:"string",value:b.value.id}}}function gt(e){if("x-imgly-builder"in e)return e["x-imgly-builder"]}var mt=Ne,ft="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIzIiBoZWlnaHQ9IjMyMyIgdmlld0JveD0iMCAwIDMyMyAzMjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIzMjMiIGhlaWdodD0iMzIzIiBmaWxsPSIjRTlFQkVEIi8+CjxnIG9wYWNpdHk9IjAuMyI+CjxwYXRoIGQ9Ik0xMTYgMTg0VjE5MS41QzExNiAxOTkuNzg0IDEyMi43MTYgMjA2LjUgMTMxIDIwNi41SDE5MUMxOTkuMjg0IDIwNi41IDIwNiAxOTkuNzg0IDIwNiAxOTEuNVYxMzEuNUMyMDYgMTIzLjIxNiAxOTkuMjg0IDExNi41IDE5MSAxMTYuNUwxOTAuOTk1IDEyNi41QzE5My43NTcgMTI2LjUgMTk2IDEyOC43MzkgMTk2IDEzMS41VjE5MS41QzE5NiAxOTQuMjYxIDE5My43NjEgMTk2LjUgMTkxIDE5Ni41SDEzMUMxMjguMjM5IDE5Ni41IDEyNiAxOTQuMjYxIDEyNiAxOTEuNVYxODRIMTE2WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTY2LjQ5NCAxMDUuOTI0QzE2NS44NjkgMTA0LjM0MiAxNjMuNjI5IDEwNC4zNDIgMTYzLjAwNSAxMDUuOTI0TDE1OS43NDUgMTE0LjE5MUMxNTkuNTU0IDExNC42NzQgMTU5LjE3MiAxMTUuMDU3IDE1OC42ODggMTE1LjI0N0wxNTAuNDIyIDExOC41MDhDMTQ4LjgzOSAxMTkuMTMyIDE0OC44MzkgMTIxLjM3MiAxNTAuNDIyIDEyMS45OTZMMTU4LjY4OCAxMjUuMjU2QzE1OS4xNzIgMTI1LjQ0NyAxNTkuNTU0IDEyNS44MjkgMTU5Ljc0NSAxMjYuMzEzTDE2My4wMDUgMTM0LjU3OUMxNjMuNjI5IDEzNi4xNjIgMTY1Ljg2OSAxMzYuMTYyIDE2Ni40OTQgMTM0LjU3OUwxNjkuNzU0IDEyNi4zMTNDMTY5Ljk0NCAxMjUuODI5IDE3MC4zMjcgMTI1LjQ0NyAxNzAuODEgMTI1LjI1NkwxNzkuMDc3IDEyMS45OTZDMTgwLjY2IDEyMS4zNzIgMTgwLjY2IDExOS4xMzIgMTc5LjA3NyAxMTguNTA4TDE3MC44MSAxMTUuMjQ3QzE3MC4zMjcgMTE1LjA1NyAxNjkuOTQ0IDExNC42NzQgMTY5Ljc1NCAxMTQuMTkxTDE2Ni40OTQgMTA1LjkyNFoiIGZpbGw9IiM4RjhGOEYiLz4KPHBhdGggZD0iTTEzMy4wMDUgMTI4LjQyNEMxMzMuNjI5IDEyNi44NDIgMTM1Ljg2OSAxMjYuODQyIDEzNi40OTQgMTI4LjQyNEwxNDEuODc1IDE0Mi4wN0MxNDIuMDY2IDE0Mi41NTMgMTQyLjQ0OCAxNDIuOTM1IDE0Mi45MzIgMTQzLjEyNkwxNTYuNTc3IDE0OC41MDhDMTU4LjE2IDE0OS4xMzIgMTU4LjE2IDE1MS4zNzIgMTU2LjU3NyAxNTEuOTk2TDE0Mi45MzIgMTU3LjM3OEMxNDIuNDQ4IDE1Ny41NjggMTQyLjA2NiAxNTcuOTUxIDE0MS44NzUgMTU4LjQzNEwxMzYuNDk0IDE3Mi4wNzlDMTM1Ljg2OSAxNzMuNjYyIDEzMy42MjkgMTczLjY2MiAxMzMuMDA1IDE3Mi4wNzlMMTI3LjYyMyAxNTguNDM0QzEyNy40MzMgMTU3Ljk1MSAxMjcuMDUgMTU3LjU2OCAxMjYuNTY3IDE1Ny4zNzhMMTEyLjkyMiAxNTEuOTk2QzExMS4zMzkgMTUxLjM3MiAxMTEuMzM5IDE0OS4xMzIgMTEyLjkyMiAxNDguNTA4TDEyNi41NjcgMTQzLjEyNkMxMjcuMDUgMTQyLjkzNSAxMjcuNDMzIDE0Mi41NTMgMTI3LjYyMyAxNDIuMDdMMTMzLjAwNSAxMjguNDI0WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTk1Ljk5OSAxODQuMDA0VjE5MS41MDJDMTk1Ljk5OSAxOTQuMjYzIDE5My43NjEgMTk2LjUwMiAxOTAuOTk5IDE5Ni41MDJIMTQ3LjY2OEwxNzIuODc5IDE1OC42ODRDMTc0LjM2MyAxNTYuNDU4IDE3Ny42MzUgMTU2LjQ1OCAxNzkuMTIgMTU4LjY4NEwxOTUuOTk5IDE4NC4wMDRaIiBmaWxsPSIjOEY4RjhGIi8+CjwvZz4KPC9zdmc+Cg==",ze=ft;function yt(e,t,n){switch(t){case"image":return ht(e,n[t]);case"video":return bt(e,n[t]);default:throw new Error(`Unsupported output kind for creating placeholder block: ${t}`)}}function ht(e,t){let n=t.width,r=t.height;return{id:e,meta:{previewUri:ze,fillType:"//ly.img.ubq/fill/image",kind:"image",width:n,height:r}}}function bt(e,t){let n=t.width,r=t.height;return{id:e,label:t.label,meta:{previewUri:ze,mimeType:"video/mp4",kind:"video",fillType:"//ly.img.ubq/fill/video",duration:t.duration.toString(),width:n,height:r}}}var Ct=yt;function vt(e,t){switch(e){case"image":return wt(t[e]);case"video":return Mt(t[e]);default:throw new Error(`Unsupported output kind for creating dry run output: ${e}`)}}function wt(e){let t=e.width,n=e.height,r=e!=null&&typeof e=="object"&&"prompt"in e&&typeof e.prompt=="string"?e.prompt:"AI Generated Image";return{kind:"image",url:`https://placehold.co/${t}x${n}/000000/FFF?text=${r.replace(" ","+").replace(`
|
|
78
|
+
`,"+")}`}}function Mt(e){return{kind:"video",url:"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"}}var kt=vt;async function xt(e,t,n,r){switch(t){case"image":{if(r.kind!=="image")throw new Error(`Output kind does not match the expected type: ${r.kind} (expected: image)`);return Lt(e,n[t],r)}case"video":{if(r.kind!=="video")throw new Error(`Output kind does not match the expected type: ${r.kind} (expected: video)`);return It(e,n[t],r)}case"audio":{if(r.kind!=="audio")throw new Error(`Output kind does not match the expected type: ${r.kind} (expected: audio)`);return Et(e,n[t],r)}default:throw new Error(`Unsupported output kind for creating placeholder block: ${t}`)}}function Lt(e,t,n){let r=t.width,a=t.height;return{id:e,label:t.label,meta:{uri:n.url,thumbUri:n.url,fillType:"//ly.img.ubq/fill/image",kind:"image",width:r,height:a},payload:{sourceSet:[{uri:n.url,width:r,height:a}]}}}async function It(e,t,n){let r=t.width,a=t.height,o=await ct(n.url,0);return{id:e,label:t.label,meta:{uri:n.url,thumbUri:o,mimeType:"video/mp4",kind:"video",fillType:"//ly.img.ubq/fill/video",duration:t.duration.toString(),width:r,height:a}}}function Et(e,t,n){return{id:e,label:t.label,meta:{uri:n.url,thumbUri:n.thumbnailUrl,blockType:"//ly.img.ubq/audio",mimeType:"audio/x-m4a",duration:n.duration.toString()}}}var de=xt;function Pe(e){let t=e.filter(n=>!!n);return n=>async(r,a)=>{let o=[],i=s=>{o.push(s)},l=async(s,c,p)=>{if(s>=t.length)return n(c,p);let g=t[s],m=async(v,b)=>l(s+1,v,b),C={...p,addDisposer:i};return g(c,C,m)},u={...a,addDisposer:i};return{result:await l(0,r,u),dispose:async()=>{for(let s=o.length-1;s>=0;s--)try{await o[s]()}catch(c){console.error("Error in disposer:",c)}o.length=0}}}}function jt(){return async(e,t,n)=>{console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(e,null,2));let r,a=Date.now();try{return r=await n(e,t),r}finally{r!=null&&(console.log(`Generation took ${Date.now()-a}ms`),console.log("Generation result:",JSON.stringify(r,null,2))),console.groupEnd()}}}var Ue=jt;async function At(e,t,n,r,a,o,i){let{cesdk:l,createPlaceholderBlock:u,historyAssetSourceId:s}=a,c;try{o.debug&&console.group(`Starting Generation for '${e}'`);let p=t(),g=await n(p.input),m=ut(),C;if(u){if(C=Ct(m,e,g),o.debug&&console.log("Adding as asset to scene:",JSON.stringify(C,void 0,2)),c=await lt(l,C),c!=null&&r.kind==="video"){let f=l.engine.block.getPositionX(c),h=l.engine.block.getPositionY(c),y=l.engine.block.duplicate(c);l.engine.block.setPositionX(y,f),l.engine.block.setPositionY(y,h),l.engine.block.destroy(c),c=y}if(q(l,i,c))return{status:"aborted"};if(c==null)throw new Error("Could not create placeholder block");l.engine.block.setState(c,{type:"Pending",progress:0})}let v=Pe([...r.output.middleware??[],o.debug?Ue():void 0]),b;if(o.dryRun?b=await St(e,g):b=(await v(r.output.generate)(p.input,{abortSignal:i,engine:a.engine,cesdk:l})).result,oe(b))throw new Error("Streaming generation is not supported yet from a panel");if(q(l,i,c))return{status:"aborted"};if(b==null)throw new Error("Generation failed");o.debug&&console.log("Generated output:",JSON.stringify(b,void 0,2));let d;if(c!=null&&l.engine.block.isValid(c)&&(d=await de(m,e,g,b),o.debug&&console.log("Updating asset in scene:",JSON.stringify(d,void 0,2)),await l.engine.asset.defaultApplyAssetToBlock(d,c)),q(l,i,c))return{status:"aborted"};if(s!=null){if(d==null&&(d=await de(m,e,g,b),q(l,i,c)))return{status:"aborted"};let f={...d,id:`${Date.now()}-${d.id}`,label:d.label!=null?{en:d.label}:{},tags:{}};l.engine.asset.addAssetToSource(s,f)}return c!=null&&l.engine.block.isValid(c)&&l.engine.block.setState(c,{type:"Ready"}),{status:"success",output:b}}catch(p){throw c!=null&&l.engine.block.isValid(c)&&(A(p)?l.engine.block.destroy(c):l.engine.block.setState(c,{type:"Error",error:"Unknown"})),p}finally{o.debug&&console.groupEnd()}}function q(e,t,n){return t.aborted?(n!=null&&e.engine.block.isValid(n)&&e.engine.block.destroy(n),!0):!1}async function St(e,t){console.log("[DRY RUN]: Requesting dummy AI generation with block inputs: ",JSON.stringify(t,void 0,2));let n=kt(e,t);return await Tt(3e3),n}async function Tt(e){return new Promise(t=>{setTimeout(t,e)})}var Nt=At;function $t(e,t,n){let{cesdk:r,provider:a,getInput:o}=t;n.onError!=null&&typeof n.onError=="function"?n.onError(e):(console.error("Generation failed:",e),Ot(r,a.output.notification,()=>({input:o?.().input,error:e}))||r.ui.showNotification({type:"error",message:st(e)}))}function Ot(e,t,n){let r=t?.error;if(r==null||!(typeof r.show=="function"?r.show(n()):r.show))return!1;let a=typeof r.message=="function"?r.message(n()):r.message??"common.ai-generation.failed",o=r.action!=null?{label:typeof r.action.label=="function"?r.action.label(n()):r.action.label,onClick:()=>{r?.action?.onClick(n())}}:void 0;return e.ui.showNotification({type:"error",message:a,action:o}),!0}var P=$t;function Ve(e){return`${e}.generating`}function Dt(e){return`${e}.abort`}function _t(e,t,n,r,a,o){let{builder:i,experimental:l}=e,{cesdk:u,includeHistoryLibrary:s=!0}=a,{id:c,output:{abortable:p}}=t,g=l.global(Dt(c),()=>{}),m=l.global(Ve(c),!1),C,v=m.value&&p,b=()=>{v&&(g.value(),m.setValue(!1),g.setValue(()=>{}))},d;if(a.requiredInputs!=null&&a.requiredInputs.length>0){let h=n();d=a.requiredInputs.every(y=>!h.input[y])}let f=l.global(`${c}.confirmationDialogId`,void 0);i.Section(`${c}.generate.section`,{children:()=>{i.Button(`${c}.generate`,{label:["common.ai-generation.generate",`panel.${c}.generate`],isLoading:m.value,color:"accent",isDisabled:d,suffix:v?{icon:"@imgly/Cross",color:"danger",tooltip:[`panel.${c}.abort`,"common.cancel"],onClick:()=>{let h=u.ui.showDialog({type:"warning",content:"panel.ly.img.ai.generation.confirmCancel.content",cancel:{label:"common.close",onClick:({id:y})=>{u.ui.closeDialog(y),f.setValue(void 0)}},actions:{label:"panel.ly.img.ai.generation.confirmCancel.confirm",color:"danger",onClick:({id:y})=>{b(),u.ui.closeDialog(y),f.setValue(void 0)}}});f.setValue(h)}}:void 0,onClick:async()=>{C=new AbortController;let h=C.signal,y=async()=>{try{m.setValue(!0),g.setValue(()=>{o.debug&&console.log("Aborting generation"),C?.abort()});let M=await Nt(t.kind,n,r,t,a,o,h);if(M.status==="aborted")return;let k=t.output.notification;zt(u,k,()=>({input:n().input,output:M.output}))}catch(M){if(A(M))return;P(M,{cesdk:u,provider:t,getInput:n},o)}finally{C=void 0,m.setValue(!1),g.setValue(()=>{}),f.value!=null&&(u.ui.closeDialog(f.value),f.setValue(void 0))}};o.middleware!=null?await o.middleware(y,{provider:t,abort:b}):await y()}}),t.output.generationHintText!=null&&i.Text(`${c}.generation-hint`,{align:"center",content:t.output.generationHintText})}}),s&&a.historyAssetLibraryEntryId!=null&&i.Library(`${c}.history.library`,{entries:[a.historyAssetLibraryEntryId]})}function zt(e,t,n){let r=t?.success;if(r==null||!(typeof r.show=="function"?r.show(n()):r.show))return!1;let a=typeof r.message=="function"?r.message(n()):r.message??"common.ai-generation.success",o=r.action!=null?{label:typeof r.action.label=="function"?r.action.label(n()):r.action.label,onClick:()=>{r?.action?.onClick(n())}}:void 0;return e.ui.showNotification({type:"success",message:a,action:o,duration:r.duration}),!0}var Ge=_t;async function Pt(e,t,n,r){let{cesdk:a}=n,{id:o}=e;r.debug&&console.log(`Registering schema-based panel input for provider ${o}`);let i=rt(t.document),l=je(i,t.inputReference);if(!nt(l,r.debug))throw new Error(`Input reference '${t.inputReference}' does not resolve to a valid OpenAPI schema`);let u=l,s=Ae(u,t),c=p=>{let{builder:g}=p,m=[];g.Section(`${o}.schema.section`,{children:()=>{s.forEach(d=>{let f=mt(p,d,e,t,n,r);f!=null&&(Array.isArray(f)?m.push(...f):m.push(f))})}});let C=m.map(d=>d()),v=d=>d.type==="object"?Object.entries(d.value).reduce((f,[h,y])=>(f[h]=v(y),f),{}):d.value,b=C.reduce((d,f)=>(d[f.id]=v(f),d),{});Ge(p,e,()=>({input:b}),()=>t.getBlockInput(b),{...n,requiredInputs:u.required,createPlaceholderBlock:t.userFlow==="placeholder"},r)};return a.ui.registerPanel(Se(o),c),c}var Ut=Pt;async function Vt(e,t,n,r){let{cesdk:a}=n,{id:o}=e,i=t.render,l=u=>{let{state:s}=u,c=s(Ve(o),{isGenerating:!1,abort:()=>{}}).value.isGenerating,{getInput:p,getBlockInput:g}=i(u,{cesdk:a,isGenerating:c});return Ge(u,e,p,g,{...n,includeHistoryLibrary:t.includeHistoryLibrary??!0,createPlaceholderBlock:t.userFlow==="placeholder"},r),p};return a.ui.registerPanel(Se(o),l),l}var Gt=Vt,Bt=class{constructor(e,t,n){this.assetStoreName="assets",this.blobStoreName="blobs",this.db=null,this.id=e,this.engine=t,this.dbName=n?.dbName??`ly.img.assetSource/${e}`,this.dbVersion=n?.dbVersion??1}async initialize(){if(!this.db)return new Promise((e,t)=>{let n=indexedDB.open(this.dbName,this.dbVersion);n.onerror=r=>{t(new Error(`Failed to open IndexedDB: ${r.target.error}`))},n.onupgradeneeded=r=>{let a=r.target.result;a.objectStoreNames.contains(this.assetStoreName)||a.createObjectStore(this.assetStoreName,{keyPath:"id"}),a.objectStoreNames.contains(this.blobStoreName)||a.createObjectStore(this.blobStoreName,{keyPath:"id"})},n.onsuccess=r=>{this.db=r.target.result,e()}})}close(){this.db&&(this.db.close(),this.db=null)}async findAssets(e){if(await this.initialize(),!this.db)throw new Error("Database not initialized");try{let t=(await this.getAllAssets("asc")).reduce((u,s)=>{let c=e.locale??"en",p="",g=[];s.label!=null&&typeof s.label=="object"&&s.label[c]&&(p=s.label[c]),s.tags!=null&&typeof s.tags=="object"&&s.tags[c]&&(g=s.tags[c]);let m={...s,label:p,tags:g};return this.filterAsset(m,e)&&u.push(m),u},[]);t=await this.restoreBlobUrls(t),t=this.sortAssets(t,e);let{page:n,perPage:r}=e,a=n*r,o=a+r,i=t.slice(a,o),l=o<t.length?n+1:void 0;return{assets:i,currentPage:n,nextPage:l,total:t.length}}catch(t){console.error("Error finding assets:",t);return}}async getGroups(){if(await this.initialize(),!this.db)throw new Error("Database not initialized");return new Promise((e,t)=>{let n=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).getAll();n.onsuccess=()=>{let r=new Set;n.result.forEach(o=>{o.groups&&Array.isArray(o.groups)&&o.groups.forEach(i=>r.add(i))});let a=[...r];e(a)},n.onerror=()=>{t(new Error(`Failed to get groups: ${n.error}`))}})}addAsset(e){this.initialize().then(async()=>{if(!this.db)throw new Error("Database not initialized");let t=this.db.transaction(this.assetStoreName,"readwrite"),n=t.objectStore(this.assetStoreName),r=new Set;j(e,o=>{r.add(o)}),setTimeout(()=>{this.storeBlobUrls([...r])});let a={...e,meta:{...e.meta,insertedAt:e.meta?.insertedAt||Date.now()}};n.put(a),t.onerror=()=>{console.error(`Failed to add asset: ${t.error}`)}}).catch(t=>{console.error("Error initializing database:",t)})}async removeAsset(e){let t=await this.getAsset(e);return this.initialize().then(()=>{if(!this.db)throw new Error("Database not initialized");let n=this.db.transaction(this.assetStoreName,"readwrite");n.objectStore(this.assetStoreName).delete(e),n.oncomplete=()=>{j(t,r=>{this.removeBlob(r)}),this.engine.asset.assetSourceContentsChanged(this.id)},n.onerror=()=>{console.error(`Failed to remove asset: ${n.error}`)}}).catch(n=>{console.error("Error initializing database:",n)})}async removeBlob(e){return this.initialize().then(()=>{if(!this.db)throw new Error("Database not initialized");let t=this.db.transaction(this.blobStoreName,"readwrite");t.objectStore(this.blobStoreName).delete(e),t.onerror=()=>{console.error(`Failed to remove blob: ${t.error}`)}}).catch(t=>{console.error("Error initializing database:",t)})}async getAllAssets(e="desc"){return new Promise((t,n)=>{let r=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).getAll();r.onsuccess=()=>{let a=r.result;a.sort((o,i)=>{let l=o.meta?.insertedAt||o._insertedAt||Date.now(),u=i.meta?.insertedAt||i._insertedAt||Date.now();return e==="asc"?l-u:u-l}),t(a)},r.onerror=()=>{n(new Error(`Failed to get assets: ${r.error}`))}})}async getAsset(e){return new Promise((t,n)=>{let r=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).get(e);r.onsuccess=()=>{t(r.result)},r.onerror=()=>{n(new Error(`Failed to get blob: ${r.error}`))}})}async getBlob(e){return new Promise((t,n)=>{let r=this.db.transaction(this.blobStoreName,"readonly").objectStore(this.blobStoreName).get(e);r.onsuccess=()=>{t(r.result)},r.onerror=()=>{n(new Error(`Failed to get blob: ${r.error}`))}})}async createBlobUrlFromStore(e){let t=await this.getBlob(e);return t!=null?URL.createObjectURL(t.blob):e}async storeBlobUrls(e){let t={};return await Promise.all(e.map(async n=>{let r=await(await fetch(n)).blob();t[n]=r})),this.initialize().then(async()=>{if(!this.db)throw new Error("Database not initialized");let n=this.db.transaction(this.blobStoreName,"readwrite"),r=n.objectStore(this.blobStoreName);Object.entries(t).forEach(([a,o])=>{let i={id:a,blob:o};r.put(i)}),n.onerror=()=>{console.error(`Failed to add blobs: ${n.error}`)}}).catch(n=>{console.error("Error initializing database:",n)})}async restoreBlobUrls(e){let t={},n=new Set;return j(e,r=>{n.add(r)}),await Promise.all([...n].map(async r=>{let a=await this.createBlobUrlFromStore(r);t[r]=a})),j(e,r=>t[r]??r)}filterAsset(e,t){let{query:n,tags:r,groups:a,excludeGroups:o}=t;if(n&&n.trim()!==""){let i=n.trim().toLowerCase().split(" "),l=e.label?.toLowerCase()??"",u=e.tags?.map(s=>s.toLowerCase())??[];if(!i.every(s=>l.includes(s)||u.some(c=>c.includes(s))))return!1}if(r){let i=Array.isArray(r)?r:[r];if(i.length>0&&(!e.tags||!i.every(l=>e.tags?.includes(l))))return!1}return!(a&&a.length>0&&(!e.groups||!a.some(i=>e.groups?.includes(i)))||o&&o.length>0&&e.groups&&e.groups.some(i=>o.includes(i)))}sortAssets(e,t){let{sortingOrder:n,sortKey:r,sortActiveFirst:a}=t,o=[...e];return!n||n==="None"||(r?o.sort((i,l)=>{let u,s;return r==="id"?(u=i.id,s=l.id):(u=i.meta?.[r]??null,s=l.meta?.[r]??null),u==null?n==="Ascending"?-1:1:s==null?n==="Ascending"?1:-1:typeof u=="string"&&typeof s=="string"?n==="Ascending"?u.localeCompare(s):s.localeCompare(u):n==="Ascending"?u<s?-1:u>s?1:0:u>s?-1:u<s?1:0}):n==="Descending"&&o.reverse(),a&&o.sort((i,l)=>i.active&&!l.active?-1:!i.active&&l.active?1:0)),o}};function j(e,t,n=""){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){for(let r=0;r<e.length;r++){let a=n?`${n}[${r}]`:`[${r}]`;if(typeof e[r]=="string"&&e[r].startsWith("blob:")){let o=t(e[r],a);typeof o=="string"&&(e[r]=o)}else e[r]=j(e[r],t,a)}return e}for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let a=e[r],o=n?`${n}.${r}`:r;if(typeof a=="string"&&a.startsWith("blob:")){let i=t(a,o);typeof i=="string"&&(e[r]=i)}else e[r]=j(a,t,o)}return e}var Zt=class{constructor(e,t){this.engine=e,this.key=t}hasData(e){return this.engine.block.isValid(e)&&this.engine.block.hasMetadata(e,this.key)}get(e){if(this.hasData(e))return JSON.parse(this.engine.block.getMetadata(e,this.key))}set(e,t){this.engine.block.setMetadata(e,this.key,JSON.stringify(t))}clear(e){this.engine.block.hasMetadata(e,this.key)&&this.engine.block.removeMetadata(e,this.key)}},Be=Zt,qt=typeof global=="object"&&global&&global.Object===Object&&global,Ze=qt,Ht=typeof self=="object"&&self&&self.Object===Object&&self,Ft=Ze||Ht||Function("return this")(),L=Ft,Qt=L.Symbol,S=Qt,qe=Object.prototype,Rt=qe.hasOwnProperty,Yt=qe.toString,D=S?S.toStringTag:void 0;function Wt(e){var t=Rt.call(e,D),n=e[D];try{e[D]=void 0;var r=!0}catch{}var a=Yt.call(e);return r&&(t?e[D]=n:delete e[D]),a}var Jt=Wt,Kt=Object.prototype,Xt=Kt.toString;function er(e){return Xt.call(e)}var tr=er,rr="[object Null]",nr="[object Undefined]",pe=S?S.toStringTag:void 0;function ir(e){return e==null?e===void 0?nr:rr:pe&&pe in Object(e)?Jt(e):tr(e)}var B=ir;function or(e){return e!=null&&typeof e=="object"}var ae=or,vo=Array.isArray;function ar(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var He=ar,lr="[object AsyncFunction]",sr="[object Function]",ur="[object GeneratorFunction]",cr="[object Proxy]";function dr(e){if(!He(e))return!1;var t=B(e);return t==sr||t==ur||t==lr||t==cr}var pr=dr,gr=L["__core-js_shared__"],W=gr,ge=function(){var e=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function mr(e){return!!ge&&ge in e}var fr=mr,yr=Function.prototype,hr=yr.toString;function br(e){if(e!=null){try{return hr.call(e)}catch{}try{return e+""}catch{}}return""}var I=br,Cr=/[\\^$.*+?()[\]{}|]/g,vr=/^\[object .+?Constructor\]$/,wr=Function.prototype,Mr=Object.prototype,kr=wr.toString,xr=Mr.hasOwnProperty,Lr=RegExp("^"+kr.call(xr).replace(Cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ir(e){if(!He(e)||fr(e))return!1;var t=pr(e)?Lr:vr;return t.test(I(e))}var Er=Ir;function jr(e,t){return e?.[t]}var Ar=jr;function Sr(e,t){var n=Ar(e,t);return Er(n)?n:void 0}var T=Sr,Tr=T(L,"WeakMap"),ee=Tr;function Nr(e,t){return e===t||e!==e&&t!==t}var $r=Nr,Or=9007199254740991;function Dr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Or}var _r=Dr,wo=Object.prototype,zr="[object Arguments]";function Pr(e){return ae(e)&&B(e)==zr}var me=Pr,Fe=Object.prototype,Ur=Fe.hasOwnProperty,Vr=Fe.propertyIsEnumerable,Mo=me(function(){return arguments}())?me:function(e){return ae(e)&&Ur.call(e,"callee")&&!Vr.call(e,"callee")},Qe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fe=Qe&&typeof module=="object"&&module&&!module.nodeType&&module,Gr=fe&&fe.exports===Qe,ye=Gr?L.Buffer:void 0,ko=ye?ye.isBuffer:void 0,Br="[object Arguments]",Zr="[object Array]",qr="[object Boolean]",Hr="[object Date]",Fr="[object Error]",Qr="[object Function]",Rr="[object Map]",Yr="[object Number]",Wr="[object Object]",Jr="[object RegExp]",Kr="[object Set]",Xr="[object String]",en="[object WeakMap]",tn="[object ArrayBuffer]",rn="[object DataView]",nn="[object Float32Array]",on="[object Float64Array]",an="[object Int8Array]",ln="[object Int16Array]",sn="[object Int32Array]",un="[object Uint8Array]",cn="[object Uint8ClampedArray]",dn="[object Uint16Array]",pn="[object Uint32Array]",w={};w[nn]=w[on]=w[an]=w[ln]=w[sn]=w[un]=w[cn]=w[dn]=w[pn]=!0;w[Br]=w[Zr]=w[tn]=w[qr]=w[rn]=w[Hr]=w[Fr]=w[Qr]=w[Rr]=w[Yr]=w[Wr]=w[Jr]=w[Kr]=w[Xr]=w[en]=!1;function gn(e){return ae(e)&&_r(e.length)&&!!w[B(e)]}var mn=gn;function fn(e){return function(t){return e(t)}}var yn=fn,Re=typeof exports=="object"&&exports&&!exports.nodeType&&exports,U=Re&&typeof module=="object"&&module&&!module.nodeType&&module,hn=U&&U.exports===Re,J=hn&&Ze.process,bn=function(){try{var e=U&&U.require&&U.require("util").types;return e||J&&J.binding&&J.binding("util")}catch{}}(),he=bn,be=he&&he.isTypedArray,xo=be?yn(be):mn,Cn=Object.prototype,Lo=Cn.hasOwnProperty;function vn(e,t){return function(n){return e(t(n))}}var wn=vn,Io=wn(Object.keys,Object),Mn=Object.prototype,Eo=Mn.hasOwnProperty,kn=T(Object,"create"),V=kn;function xn(){this.__data__=V?V(null):{},this.size=0}var Ln=xn;function In(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var En=In,jn="__lodash_hash_undefined__",An=Object.prototype,Sn=An.hasOwnProperty;function Tn(e){var t=this.__data__;if(V){var n=t[e];return n===jn?void 0:n}return Sn.call(t,e)?t[e]:void 0}var Nn=Tn,$n=Object.prototype,On=$n.hasOwnProperty;function Dn(e){var t=this.__data__;return V?t[e]!==void 0:On.call(t,e)}var _n=Dn,zn="__lodash_hash_undefined__";function Pn(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=V&&t===void 0?zn:t,this}var Un=Pn;function N(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}N.prototype.clear=Ln;N.prototype.delete=En;N.prototype.get=Nn;N.prototype.has=_n;N.prototype.set=Un;var Ce=N;function Vn(){this.__data__=[],this.size=0}var Gn=Vn;function Bn(e,t){for(var n=e.length;n--;)if($r(e[n][0],t))return n;return-1}var H=Bn,Zn=Array.prototype,qn=Zn.splice;function Hn(e){var t=this.__data__,n=H(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():qn.call(t,n,1),--this.size,!0}var Fn=Hn;function Qn(e){var t=this.__data__,n=H(t,e);return n<0?void 0:t[n][1]}var Rn=Qn;function Yn(e){return H(this.__data__,e)>-1}var Wn=Yn;function Jn(e,t){var n=this.__data__,r=H(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Kn=Jn;function $(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$.prototype.clear=Gn;$.prototype.delete=Fn;$.prototype.get=Rn;$.prototype.has=Wn;$.prototype.set=Kn;var F=$,Xn=T(L,"Map"),G=Xn;function ei(){this.size=0,this.__data__={hash:new Ce,map:new(G||F),string:new Ce}}var ti=ei;function ri(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ni=ri;function ii(e,t){var n=e.__data__;return ni(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Q=ii;function oi(e){var t=Q(this,e).delete(e);return this.size-=t?1:0,t}var ai=oi;function li(e){return Q(this,e).get(e)}var si=li;function ui(e){return Q(this,e).has(e)}var ci=ui;function di(e,t){var n=Q(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var pi=di;function O(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}O.prototype.clear=ti;O.prototype.delete=ai;O.prototype.get=si;O.prototype.has=ci;O.prototype.set=pi;var Ye=O;function gi(){this.__data__=new F,this.size=0}var mi=gi;function fi(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var yi=fi;function hi(e){return this.__data__.get(e)}var bi=hi;function Ci(e){return this.__data__.has(e)}var vi=Ci,wi=200;function Mi(e,t){var n=this.__data__;if(n instanceof F){var r=n.__data__;if(!G||r.length<wi-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ye(r)}return n.set(e,t),this.size=n.size,this}var ki=Mi;function Z(e){var t=this.__data__=new F(e);this.size=t.size}Z.prototype.clear=mi;Z.prototype.delete=yi;Z.prototype.get=bi;Z.prototype.has=vi;Z.prototype.set=ki;var xi=Object.prototype,jo=xi.propertyIsEnumerable,Li=T(L,"DataView"),te=Li,Ii=T(L,"Promise"),re=Ii,Ei=T(L,"Set"),ne=Ei,ve="[object Map]",ji="[object Object]",we="[object Promise]",Me="[object Set]",ke="[object WeakMap]",xe="[object DataView]",Ai=I(te),Si=I(G),Ti=I(re),Ni=I(ne),$i=I(ee),E=B;(te&&E(new te(new ArrayBuffer(1)))!=xe||G&&E(new G)!=ve||re&&E(re.resolve())!=we||ne&&E(new ne)!=Me||ee&&E(new ee)!=ke)&&(E=function(e){var t=B(e),n=t==ji?e.constructor:void 0,r=n?I(n):"";if(r)switch(r){case Ai:return xe;case Si:return ve;case Ti:return we;case Ni:return Me;case $i:return ke}return t});var Ao=L.Uint8Array,Oi="__lodash_hash_undefined__";function Di(e){return this.__data__.set(e,Oi),this}var _i=Di;function zi(e){return this.__data__.has(e)}var Pi=zi;function ie(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ye;++t<n;)this.add(e[t])}ie.prototype.add=ie.prototype.push=_i;ie.prototype.has=Pi;var Le=S?S.prototype:void 0,So=Le?Le.valueOf:void 0,Ui=Object.prototype,To=Ui.hasOwnProperty,Vi=Object.prototype,No=Vi.hasOwnProperty,$o=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Oo=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Do=new RegExp(/[A-Fa-f0-9]{2}/,"g"),K="@imgly/plugin-ai-generation",Gi=`
|
|
79
|
+
<svg>
|
|
80
|
+
<symbol
|
|
81
|
+
fill="none"
|
|
82
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
83
|
+
viewBox="0 0 24 24"
|
|
84
|
+
id="@imgly/Sparkle"
|
|
85
|
+
>
|
|
86
|
+
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
|
|
87
|
+
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
|
|
88
|
+
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
|
|
89
|
+
|
|
90
|
+
</symbol>
|
|
91
|
+
|
|
92
|
+
<symbol
|
|
93
|
+
fill="none"
|
|
94
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
95
|
+
viewBox="0 0 24 24"
|
|
96
|
+
id="${K}/image"
|
|
97
|
+
>
|
|
98
|
+
<path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
|
|
99
|
+
<path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
|
|
100
|
+
<path d="M6.40053 5.38488C6.52538 5.06832 6.97338 5.06832 7.09823 5.38488L8.17455 8.11392C8.21267 8.21057 8.28917 8.28707 8.38582 8.32519L11.1149 9.40151C11.4314 9.52636 11.4314 9.97436 11.1149 10.0992L8.38582 11.1755C8.28917 11.2136 8.21267 11.2901 8.17455 11.3868L7.09823 14.1158C6.97338 14.4324 6.52538 14.4324 6.40053 14.1158L5.32421 11.3868C5.2861 11.2901 5.20959 11.2136 5.11295 11.1755L2.3839 10.0992C2.06735 9.97436 2.06735 9.52636 2.3839 9.40151L5.11295 8.32519C5.20959 8.28707 5.2861 8.21057 5.32421 8.11392L6.40053 5.38488Z" fill="currentColor"/>
|
|
101
|
+
<path d="M18.9994 16.5008V18.0004C18.9994 18.5526 18.5517 19.0004 17.9994 19.0004H9.33302L14.3753 11.4369C14.6722 10.9916 15.3266 10.9916 15.6234 11.4369L18.9994 16.5008Z" fill="currentColor"/>
|
|
102
|
+
|
|
103
|
+
</symbol>
|
|
104
|
+
<symbol
|
|
105
|
+
fill="none"
|
|
106
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
107
|
+
viewBox="0 0 24 24"
|
|
108
|
+
id="${K}/video"
|
|
109
|
+
>
|
|
110
|
+
<path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
|
|
111
|
+
<path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
|
|
112
|
+
<path d="M18.9019 3.3845C19.0267 3.06795 19.4747 3.06795 19.5996 3.3845L20.6759 6.11355C20.714 6.2102 20.7905 6.2867 20.8872 6.32482L23.6162 7.40114C23.9328 7.52598 23.9328 7.97399 23.6162 8.09883L20.8872 9.17515C20.7905 9.21327 20.714 9.28977 20.6759 9.38642L19.5996 12.1155C19.4747 12.432 19.0267 12.432 18.9019 12.1155L17.8255 9.38642C17.7874 9.28977 17.7109 9.21327 17.6143 9.17515L14.8852 8.09883C14.5687 7.97399 14.5687 7.52598 14.8852 7.40114L17.6143 6.32482C17.7109 6.2867 17.7874 6.2102 17.8255 6.11355L18.9019 3.3845Z" fill="currentColor"/>
|
|
113
|
+
<path d="M14.9994 13.2862C15.5089 12.8859 15.5089 12.1141 14.9995 11.7137L10.618 8.27047C9.96188 7.75485 9.00011 8.22225 9.00011 9.05673L9.00011 15.9429C9.00011 16.7773 9.96185 17.2448 10.618 16.7292L14.9994 13.2862Z" fill="currentColor"/>
|
|
114
|
+
</symbol>
|
|
115
|
+
<symbol
|
|
116
|
+
fill="none"
|
|
117
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
118
|
+
viewBox="0 0 24 24"
|
|
119
|
+
id="${K}/audio"
|
|
120
|
+
>
|
|
121
|
+
<path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
|
|
122
|
+
<path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
|
|
123
|
+
<path d="M19.5996 4.3845C19.4747 4.06795 19.0267 4.06795 18.9019 4.3845L17.8255 7.11355C17.7874 7.2102 17.7109 7.2867 17.6143 7.32482L14.8852 8.40114C14.5687 8.52598 14.5687 8.97399 14.8852 9.09883L17.6143 10.1752C17.7109 10.2133 17.7874 10.2898 17.8255 10.3864L18.9019 13.1155C19.0267 13.432 19.4747 13.432 19.5996 13.1155L20.6759 10.3864C20.714 10.2898 20.7905 10.2133 20.8872 10.1752L23.6162 9.09883C23.9328 8.97399 23.9328 8.52598 23.6162 8.40114L20.8872 7.32482C20.7905 7.2867 20.714 7.2102 20.6759 7.11355L19.5996 4.3845Z" fill="currentColor"/>
|
|
124
|
+
</symbol>
|
|
125
|
+
<symbol
|
|
126
|
+
fill="none"
|
|
127
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
+
viewBox="0 0 24 24"
|
|
129
|
+
id="@imgly/MixingPlate"
|
|
130
|
+
>
|
|
131
|
+
<path d="M9.75 9C10.5784 9 11.25 8.32843 11.25 7.5C11.25 6.67157 10.5784 6 9.75 6C8.92157 6 8.25 6.67157 8.25 7.5C8.25 8.32843 8.92157 9 9.75 9Z" fill="currentColor"/>
|
|
132
|
+
<path d="M7 13C7.82843 13 8.5 12.3284 8.5 11.5C8.5 10.6716 7.82843 10 7 10C6.17157 10 5.5 10.6716 5.5 11.5C5.5 12.3284 6.17157 13 7 13Z" fill="currentColor"/>
|
|
133
|
+
<path d="M15.75 7.5C15.75 8.32843 15.0784 9 14.25 9C13.4216 9 12.75 8.32843 12.75 7.5C12.75 6.67157 13.4216 6 14.25 6C15.0784 6 15.75 6.67157 15.75 7.5Z" fill="currentColor"/>
|
|
134
|
+
<path d="M17 13C17.8284 13 18.5 12.3284 18.5 11.5C18.5 10.6716 17.8284 10 17 10C16.1716 10 15.5 10.6716 15.5 11.5C15.5 12.3284 16.1716 13 17 13Z" fill="currentColor"/>
|
|
135
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26309 2.77709C10.6681 1.77921 13.4829 1.7322 15.9209 2.64297C18.1572 3.47923 20.0876 5.09285 21.1766 7.28598C22.3395 9.62772 22.4889 13.1077 20.3864 15.2982C19.2693 16.4621 17.7657 16.9982 16.0026 16.9997C15.7897 16.9997 15.5555 16.9864 15.3497 16.9745C15.309 16.9722 15.2694 16.9699 15.2313 16.9679C14.9817 16.9542 14.761 16.9455 14.5569 16.9539C14.124 16.9718 13.9598 17.0612 13.89 17.1324C13.718 17.3081 13.6946 17.6672 13.8854 17.8895C14.2899 18.3608 14.5016 18.9277 14.5016 19.5497C14.5016 20.2206 14.3086 20.9011 13.7542 21.3896C13.2471 21.837 12.6082 21.9997 11.9635 21.9997C10.6049 21.9997 9.31155 21.7367 8.0934 21.2067C6.89058 20.6831 5.84501 19.9687 4.94363 19.0666C4.04281 18.1651 3.31836 17.107 2.79369 15.8978C1.72761 13.4409 1.72662 10.5261 2.81247 8.07034C3.88024 5.65548 5.84206 3.78161 8.26309 2.77709ZM15.2207 4.51639C13.2556 3.78239 10.9651 3.82132 9.02956 4.62439C7.06888 5.43791 5.49559 6.94785 4.64163 8.87914C3.78373 10.8194 3.78253 13.1522 4.62841 15.1017C5.05312 16.0805 5.63511 16.9291 6.35838 17.6529C7.08102 18.3761 7.91671 18.9484 8.89123 19.3728C9.8492 19.7895 10.87 19.9997 11.9635 19.9997C12.2815 19.9997 12.394 19.9225 12.431 19.8899L12.4319 19.8891C12.4367 19.8849 12.4487 19.8743 12.4631 19.8359C12.4799 19.7911 12.5016 19.7024 12.5016 19.5497C12.5016 19.4091 12.4633 19.3034 12.3677 19.192C11.5353 18.222 11.5272 16.6868 12.4611 15.7331C13.0741 15.1071 13.8844 14.98 14.4745 14.9556C14.7819 14.943 15.085 14.9568 15.3409 14.9709C15.3906 14.9736 15.4379 14.9763 15.4832 14.9788C15.6876 14.9904 15.8508 14.9997 16.0009 14.9997C17.3405 14.9986 18.2792 14.6054 18.9435 13.9133C20.2633 12.5382 20.3186 10.055 19.3853 8.1755C18.5436 6.48051 17.0293 5.19281 15.2207 4.51639Z" fill="currentColor"/>
|
|
136
|
+
|
|
137
|
+
</symbol>
|
|
138
|
+
</svg>
|
|
139
|
+
`,Bi=Gi,Ie="ly.img.ai.quickAction.order",_="ly.img.ai.quickAction.actions";function Zi(e,t){return{id:t,setQuickActionMenuOrder:n=>{e.ui.experimental.setGlobalStateValue(`${Ie}.${t}`,n)},getQuickActionMenuOrder:()=>e.ui.experimental.getGlobalStateValue(`${Ie}.${t}`,[]),registerQuickAction:n=>{if(!e.ui.experimental.hasGlobalStateValue(`${_}.${t}`))e.ui.experimental.setGlobalStateValue(`${_}.${t}`,{[n.id]:n});else{let r=e.ui.experimental.getGlobalStateValue(`${_}.${t}`,{});e.ui.experimental.setGlobalStateValue(`${_}.${t}`,{...r,[n.id]:n})}},getQuickAction:n=>e.ui.experimental.getGlobalStateValue(`${_}.${t}`,{})[n]}}var le=Zi,X="ly.img.ai.inference.editMode",We="ly.img.ai.inference.metadata";function Je(e){return`ly.img.ai.quickAction.${e.quickActionMenuId}.${e.quickActionId}`}function qi(e){if(e.length===0)return[];let t=[...e];for(;t.length>0&&t[0]==="ly.img.separator";)t.shift();for(;t.length>0&&t[t.length-1]==="ly.img.separator";)t.pop();return t.reduce((n,r)=>(r==="ly.img.separator"&&n.length>0&&n[n.length-1]==="ly.img.separator"||n.push(r),n),[])}function Hi({alwaysOnTop:e=!0,disableClipping:t=!0}){return async(n,r,a)=>{let o={},i={},l=e||t?r.blockIds??r.engine.block.findAllSelected():[];return l.forEach(u=>{if(r.engine.block.isValid(u)&&e&&(o[u]=r.engine.block.isAlwaysOnTop(u),r.engine.block.setAlwaysOnTop(u,!0)),t){let s=r.engine.block.getParent(u);s!=null&&r.engine.block.getType(s)!=="//ly.img.ubq/scene"&&(i[s]=r.engine.block.isClipped(s),r.engine.block.setClipped(s,!1))}}),r.addDisposer(async()=>{l.forEach(u=>{if(r.engine.block.isValid(u)&&e&&r.engine.block.setAlwaysOnTop(u,o[u]),t){let s=r.engine.block.getParent(u);s!=null&&r.engine.block.getType(s)!=="//ly.img.ubq/scene"&&i[s]!=null&&r.engine.block.setClipped(s,i[s])}})}),await a(n,r)}}var Fi=Hi;function Qi({pending:e=!0}){return async(t,n,r)=>{let a=e?n.blockIds??n.engine.block.findAllSelected():[];try{return a.forEach(o=>{n.engine.block.isValid(o)&&n.engine.block.setState(o,{type:"Pending",progress:0})}),await r(t,n)}finally{a.forEach(o=>{n.engine.block.isValid(o)&&n.engine.block.setState(o,{type:"Ready"})})}}}var Ri=Qi;function Yi({editMode:e,automaticallyUnlock:t=!1}){return async(n,r,a)=>{let o=r.blockIds??r.engine.block.findAllSelected(),i=()=>{};t||r.addDisposer(async()=>{i?.()});try{return i=Wi(r.engine,o,e),await a(n,r)}catch(l){throw A(l)&&i(),l}finally{t&&i()}}}function Wi(e,t,n){let r=e.editor.getGlobalScope("editor/select"),a=e.editor.getEditMode();l(),e.editor.setGlobalScope("editor/select","Deny"),e.editor.setEditMode(n);let o=e.editor.createHistory(),i=e.editor.getActiveHistory();e.editor.setActiveHistory(o);function l(){e.block.findAllSelected().forEach(c=>{t.includes(c)||e.block.setSelected(c,!1)}),t.forEach(c=>{e.block.setSelected(c,!0)})}let u=e.editor.onStateChanged(()=>{e.editor.getEditMode()!==n&&e.editor.setEditMode(n)}),s=e.block.onSelectionChanged(l);return()=>{r!=null&&e.editor.setGlobalScope("editor/select",r),e.editor.setEditMode(a),e.editor.setActiveHistory(i),e.editor.destroyHistory(o),s(),u()}}var Ji=Yi;function Ki(e,t){switch(t.kind){case"text":return Xi(e,t);case"image":return eo(e,t);case"video":return to(e,t);case"audio":return ro(e,t);default:throw new Error(`Unsupported output kind for quick actions: ${t.kind}`)}}async function Xi(e,t){let{cesdk:n,blockIds:r,abortSignal:a}=t,o=r.map(s=>n.engine.block.getString(s,"text/text")),i;if(oe(e)){let s="";for await(let c of e){if(a.aborted)break;typeof c=="string"?s=c:c.kind==="text"&&(s=c.text),r.forEach(p=>{n.engine.block.setString(p,"text/text",s)}),i={kind:"text",text:s}}}else i=e;if(i==null||i.kind!=="text")throw new Error("Output kind from generation is not text");let l=()=>{t.blockIds.forEach(s=>{t.cesdk.engine.block.setString(s,"text/text",i.text)})},u=()=>{t.blockIds.forEach((s,c)=>{t.cesdk.engine.block.setString(s,"text/text",o[c])})};return{consumedGenerationResult:i,applyCallbacks:{onBefore:u,onAfter:l,onCancel:u,onApply:l}}}async function eo(e,t){let{cesdk:n,blockIds:r,abortSignal:a}=t;if(r.length!==1)throw new Error("Only one block is supported for image generation");let[o]=r,i=n.engine.block.getFill(o),l=n.engine.block.getSourceSet(i,"fill/image/sourceSet"),[u]=l,s=await n.engine.editor.getMimeType(u.uri);if(a.throwIfAborted(),s==="image/svg+xml")throw new Error("SVG images are not supported");let c=n.engine.block.getCropScaleX(o),p=n.engine.block.getCropScaleY(o),g=n.engine.block.getCropTranslationX(o),m=n.engine.block.getCropTranslationY(o),C=n.engine.block.getCropRotation(o),v=()=>{n.engine.block.setCropScaleX(o,c),n.engine.block.setCropScaleY(o,p),n.engine.block.setCropTranslationX(o,g),n.engine.block.setCropTranslationY(o,m),n.engine.block.setCropRotation(o,C)};if(oe(e))throw new Error("Streaming generation is not supported yet from a panel");if(e.kind!=="image"||typeof e.url!="string")throw new Error("Output kind from generation is not an image");let b=e.url,d=await n.engine.editor.getMimeType(b),f=[{uri:await no(n,b,d),width:u.width,height:u.height}];n.engine.block.setSourceSet(i,"fill/image/sourceSet",f),v();let h=()=>{n.engine.block.setSourceSet(i,"fill/image/sourceSet",l),v()},y=()=>{n.engine.block.setSourceSet(i,"fill/image/sourceSet",f),v()};return{consumedGenerationResult:e,applyCallbacks:{onBefore:h,onAfter:y,onCancel:()=>{h()},onApply:()=>{y()}}}}async function to(e,t){throw new Error("Function not implemented.")}async function ro(e,t){throw new Error("Function not implemented.")}async function no(e,t,n){let r=await(await fetch(t)).blob(),a=new File([r],`image.${io(n)}`,{type:n}),o=await e.unstable_upload(a,()=>{});return o?.meta?.uri??(console.warn("Failed to upload image:",o),t)}function io(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}var oo=Ki;function ao({editMode:e,automaticallyUnlock:t=!1,showNotification:n=!0}){return async(r,a,o)=>{let i=a.blockIds??a.engine.block.findAllSelected(),l=()=>{};t||a.addDisposer(async()=>{l?.()});try{l=lo(a.engine,i,e);let u=await o(r,a);if(n){let s=a.engine.block.findAllSelected();i.some(c=>s.includes(c))||a.cesdk?.ui.showNotification({type:"success",message:"AI generation complete",action:{label:"Select",onClick:()=>{i.forEach(c=>{a.engine.block.select(c)})}}})}return u}catch(u){throw A(u)&&l(),u}finally{t&&l()}}}function lo(e,t,n){function r(){let i=e.block.findAllSelected();return t.some(l=>i.includes(l))}let a=e.editor.onStateChanged(()=>{e.editor.getEditMode()!==n&&r()&&e.editor.setEditMode(n)}),o=e.block.onSelectionChanged(()=>{r()?e.editor.setEditMode(n):e.editor.setEditMode("Transform")});return r()&&e.editor.setEditMode(n),()=>{o(),a(),e.editor.setEditMode("Transform")}}var so=ao;function uo(e,t){let{cesdk:n,quickActionMenu:r,provider:a}=e,o=`ly.img.ai.${r.id}`,i=`${o}.confirmation`;n.setTranslations({en:{[`${i}.apply`]:"Apply",[`${i}.before`]:"Before",[`${i}.after`]:"After",[`${o}.cancel`]:"Cancel",[`${o}.processing`]:"Generating..."}});let l=`${i}.canvasnMenu`,u={unlock:()=>{},abort:()=>{},applyCallbacks:void 0},s=()=>{let p=new AbortController,g=p.signal;return u.abort=()=>{p.abort()},g};n.ui.registerComponent(l,({builder:p,engine:g,state:m})=>{let C=g.block.findAllSelected();if(C.length===0)return null;let v=new Be(n.engine,We),b=v.get(C[0]);if(b==null)return null;let d=()=>{C.forEach(f=>{v.clear(f)})};switch(b.status){case"processing":{p.Button(`${o}.spinner`,{label:[`ly.img.ai.inference.${b.quickActionId}.processing`,`${o}.cancel`],isLoading:!0}),p.Separator(`${o}.separator`),p.Button(`${o}.cancel`,{icon:"@imgly/Cross",tooltip:`${o}.cancel`,onClick:()=>{u.abort(),d()}});break}case"confirmation":{let f=m(`${i}.comparing`,"after"),h=u.applyCallbacks?.onCancel;h!=null&&p.Button(`${i}.cancel`,{icon:"@imgly/Cross",tooltip:`${o}.cancel`,onClick:()=>{u.unlock(),h(),d()}});let y=u.applyCallbacks?.onBefore,M=u.applyCallbacks?.onAfter;y!=null&&M!=null&&p.ButtonGroup(`${i}.compare`,{children:()=>{p.Button(`${i}.compare.before`,{label:`${i}.before`,variant:"regular",isActive:f.value==="before",onClick:()=>{y(),f.setValue("before")}}),p.Button(`${i}.compare.after`,{label:`${i}.after`,variant:"regular",isActive:f.value==="after",onClick:()=>{M(),f.setValue("after")}})}});let k=u.applyCallbacks?.onApply;k!=null&&p.Button(`${i}.apply`,{icon:"@imgly/Checkmark",tooltip:`${i}.apply`,color:"accent",isDisabled:f.value!=="after",onClick:()=>{u.unlock(),d(),n.engine.editor._update(),k(),g.editor.addUndoStep()}});break}default:}});let c=`${o}.canvasMenu`;return n.ui.registerComponent(c,p=>{let g=p.engine.block.findAllSelected(),m=r.getQuickActionMenuOrder().map(f=>{if(f==="ly.img.separator")return f;let h=r.getQuickAction(f);if(h==null||!n.feature.isEnabled(Je({quickActionId:f,quickActionMenuId:r.id}),{engine:p.engine}))return null;let y=h.scopes;return y!=null&&y.length>0&&!g.every(M=>y.every(k=>p.engine.block.isAllowedByScope(M,k)))?null:h}).filter(f=>f!=null);if(m=qi(m),m.length===0||m.every(f=>f==="ly.img.separator"))return null;let{builder:C,experimental:v,state:b}=p,d=b(`${o}.toggleExpandedState`,void 0);v.builder.Popover(`${o}.popover`,{icon:"@imgly/Sparkle",variant:"plain",trailingIcon:null,children:({close:f})=>{C.Section(`${o}.popover.section`,{children:()=>{if(d.value!=null){let h=d.value,y=r.getQuickAction(h);if(y!=null&&y.renderExpanded!=null){y.renderExpanded(p,{blockIds:g,closeMenu:f,toggleExpand:()=>{d.setValue(void 0)},handleGenerationError:M=>{P(M,{cesdk:n,provider:a},t)},generate:async(M,k)=>{try{let{returnValue:x,applyCallbacks:R,dispose:et}=await Ee({input:M,quickAction:y,quickActionMenu:r,provider:a,cesdk:n,abortSignal:s(),blockIds:k?.blockIds??g,confirmationComponentId:l},t);return u.unlock=et,u.applyCallbacks=R,x}catch(x){throw A(x)||P(x,{cesdk:n,provider:a},t),x}}});return}}v.builder.Menu(`${o}.menu`,{children:()=>{m.forEach(h=>{h==="ly.img.separator"?C.Separator(`${o}.separator.${Math.random().toString()}`):h.render(p,{blockIds:g,closeMenu:f,handleGenerationError:y=>{P(y,{cesdk:n,provider:a},t)},toggleExpand:()=>{d.setValue(h.id)},generate:async(y,M)=>{try{let{returnValue:k,applyCallbacks:x,dispose:R}=await Ee({input:y,quickAction:h,quickActionMenu:r,provider:a,cesdk:n,abortSignal:s(),blockIds:M?.blockIds??g,confirmationComponentId:l},t);return u.unlock=R,u.applyCallbacks=x,k}catch(k){throw A(k)||P(k,{cesdk:n,provider:a},t),k}}})})}})}})}})}),{canvasMenuComponentId:c}}async function Ee(e,t){let{cesdk:n,input:r,blockIds:a,provider:o,quickAction:i,confirmationComponentId:l,abortSignal:u}=e;i.confirmation&&n.ui.setCanvasMenuOrder([l],{editMode:X});let s=new Be(n.engine,We);a.forEach(d=>{s.set(d,{status:"processing",quickActionId:i.id})});let c={cesdk:n,engine:n.engine,abortSignal:u},p=Pe([...o.output.middleware??[],t.debug?Ue():void 0,Ri({}),...i.confirmation?[i.lockDuringConfirmation?Ji({editMode:X}):so({editMode:X}),i.confirmation&&Fi({})]:[]]),{result:g,dispose:m}=await p(o.output.generate)(r,c),{consumedGenerationResult:C,applyCallbacks:v}=await oo(g,{abortSignal:u,kind:o.kind,blockIds:a,cesdk:n});i.confirmation?a.forEach(d=>{s.set(d,{status:"confirmation",quickActionId:i.id})}):a.forEach(d=>{s.clear(d)});let b=()=>{m(),a.forEach(d=>{s.clear(d)})};return u.addEventListener("abort",b),{dispose:b,returnValue:C,applyCallbacks:v}}var co=uo;async function po(e,t,n){await e.initialize(t);let r=await mo(t.engine,e.id,e.output.history??"@imgly/local");if(t.cesdk==null)return{};let a=r?`${e.id}.history.entry`:void 0,o={...t,cesdk:t.cesdk,historyAssetSourceId:r,historyAssetLibraryEntryId:a,i18n:{prompt:"common.ai-generation.prompt.placeholder"}};a!=null&&r!=null&&t.cesdk.ui.addAssetLibraryEntry({id:a,sourceIds:[r],sortBy:{sortKey:"insertedAt",sortingOrder:"Descending"},canRemove:!0,gridItemHeight:"square",gridBackgroundType:"cover"}),t.cesdk.i18n.setTranslations({en:{"common.ai-generation.success":"Generation Successful","common.ai-generation.failed":"Generation Failed","common.ai-generation.generate":"Generate","common.ai-generation.prompt.placeholder":"Describe what you want to create...",[`panel.${e.id}`]:go(e)}});let i="@imgly/plugin-ai-generation.iconSetAdded";return t.cesdk.ui.experimental.hasGlobalStateValue(i)||(t.cesdk.ui.addIconSet("@imgly/plugin-ai-generation",Bi),t.cesdk.ui.experimental.setGlobalStateValue(i,!0)),{renderBuilderFunctions:await fo(e,o,n)}}function go(e){if(e.name!=null)return e.name;switch(e.kind){case"image":return"Generate Image";case"video":return"Generate Video";case"audio":return"Generate Audio";default:return"Generate Asset"}}async function mo(e,t,n){if(!(n==null||n===!1)){if(n==="@imgly/local"){let r=`${t}.history`;return e.asset.addLocalSource(r),r}if(n==="@imgly/indexedDB"){let r=`${t}.history`;return e.asset.addSource(new Bt(r,e)),r}return n}}async function fo(e,t,n){let r={panel:void 0};return e.input?.panel!=null&&(r.panel=await yo(e,e.input.panel,t,n)),e.input?.quickActions!=null&&(n.debug&&console.log(`Initializing quick actions for provider '${e.kind}' (${e.id})`),ho(e,e.input.quickActions,t,n)),r}async function yo(e,t,n,r){switch(t.type){case"custom":return Gt(e,t,n,r);case"schema":return Ut(e,t,n,r);default:r.debug&&console.warn(`Invalid panel input type '${t.type}' - skipping`)}}async function ho(e,t,n,r){let{cesdk:a}=n,o=e.kind,i=le(a,o);t.actions.forEach(u=>{let s=u.enable??!0;a.feature.enable(Je({quickActionId:u.id,quickActionMenuId:o}),s),i.registerQuickAction(u),r.debug&&console.log(`Registered quick action: '${u.id}' (v${u.version}) to menu '${o}'`)});let{canvasMenuComponentId:l}=co({cesdk:a,quickActionMenu:i,provider:e},r);r.debug&&console.log(`Registered quick action menu component: ${l}`)}var Ke=po;var se="@imgly/plugin-ai-text-generation-web";var Xe=e=>({async initialize({cesdk:t}){if(t==null)return;let n=await e.provider?.({cesdk:t});Ke(n,{cesdk:t,engine:t.engine},{debug:!0,dryRun:!1});let r=le(t,"text");r.setQuickActionMenuOrder(["improve","fix","shorter","longer","ly.img.separator","changeTone","translate","ly.img.separator","changeTextTo",...r.getQuickActionMenuOrder()]),t.ui.addIconSet(ue,ce),t.setTranslations({en:{"ly.img.ai.inference.apply":"Apply","ly.img.ai.inference.cancel":"Cancel","ly.img.ai.inference.improve":"Improve Writing","ly.img.ai.inference.improve.processing":"Improving Writing...","ly.img.ai.inference.fix":"Fix Spelling & Grammar","ly.img.ai.inference.fix.processing":"Fixing spelling & grammar...","ly.img.ai.inference.longer":"Make Longer","ly.img.ai.inference.longer.processing":"Making longer...","ly.img.ai.inference.shorter":"Make Shorter","ly.img.ai.inference.shorter.processing":"Making shorter...","ly.img.ai.inference.changeTone":"Change Tone","ly.img.ai.inference.changeTone.processing":"Changing tone...","ly.img.ai.inference.changeTone.type.professional":"Professional","ly.img.ai.inference.changeTone.type.casual":"Casual","ly.img.ai.inference.changeTone.type.friendly":"Friendly","ly.img.ai.inference.changeTone.type.serious":"Serious","ly.img.ai.inference.changeTone.type.humorous":"Humorous","ly.img.ai.inference.changeTone.type.optimistic":"Optimistic","ly.img.ai.inference.translate":"Translate","ly.img.ai.inference.translate.processing":"Translating...","ly.img.ai.inference.changeTextTo":"Change Text to...","ly.img.ai.inference.changeTextTo.processing":"Changing text..."}})}});var bo=e=>({name:se,version:"0.1.0-rc.0",...Xe(e)}),Ho=bo;export{Ho as default};
|
|
140
|
+
/*! Bundled license information:
|
|
141
|
+
|
|
142
|
+
@imgly/plugin-ai-generation-web/dist/index.mjs:
|
|
143
|
+
(*! Bundled license information:
|
|
144
|
+
|
|
145
|
+
@imgly/plugin-utils/dist/index.mjs:
|
|
146
|
+
(*! Bundled license information:
|
|
147
|
+
|
|
148
|
+
lodash-es/lodash.js:
|
|
149
|
+
(**
|
|
150
|
+
* @license
|
|
151
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
152
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
153
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
154
|
+
* Released under MIT license <https://lodash.com/license>
|
|
155
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
156
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
157
|
+
*)
|
|
158
|
+
*)
|
|
159
|
+
*)
|
|
160
|
+
*/
|
|
161
|
+
//# sourceMappingURL=index.mjs.map
|