@imgly/plugin-ai-image-generation-web 0.2.6 → 0.2.8

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/icons/formats.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/CustomAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/IndexedDBAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/AggregatedAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/metadata/Metadata.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalArrays.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalByTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalObjects.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqualDeep.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqual.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqual.js", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/metadata/FillProcessingMetadata.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/fillProcessing.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/constants.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/initializeFillProcessing.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/registerFillProcessingComponents.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/colors.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/upload.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/uuid.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/images.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/isDefined.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/toArray.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/translationHelpers.ts", "../../../../node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/index.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/common/renderImageUrlProperty.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/icons/formats.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/CustomAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/IndexedDBAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/assetSources/AggregatedAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/metadata/Metadata.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalArrays.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalByTag.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalObjects.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqualDeep.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqual.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqual.js", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/metadata/FillProcessingMetadata.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/fillProcessing.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/constants.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/initializeFillProcessing.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/processing/registerFillProcessingComponents.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/colors.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/upload.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/uuid.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/images.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/isDefined.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/utils/toArray.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/translationHelpers.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/node_modules/.pnpm/@imgly+plugin-utils@file+packages+plugin-utils_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-utils/src/index.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/common/renderStyleTransferProperty.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/integrateIntoDefaultAssetLibraryEntry.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/core/ActionRegistry.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/core/ProviderRegistry.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/middleware/middleware.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/middleware/loggingMiddleware.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/utils.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/middleware/uploadMiddleware.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/mergeQuickActionsConfig.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/middleware/rateLimitMiddleware.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/checkAiPluginVersion.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/components/registerDockComponent.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/quickActions/enableImageFill.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/generation/handleGenerationError.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/previewUri.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/getAssetResultForPlaceholder.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/getAssetResultForGenerated.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/generation/handleGenerateFromPanel.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/components/renderGenerationComponents.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/panels/createPanelRenderFunctionFromCustom.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/dereferenceDocument.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/isOpenAPISchema.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/getProperties.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/renderProperty.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/defaultTranslations.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/openapi/extractSchemaTranslations.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/panels/createPanelRenderFunctionFromSchema.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/panels/createPanelRenderFunction.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/initializeHistoryAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/initializeHistoryAssetLibraryEntry.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/icons.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/middleware/dryRunMiddleware.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/core/constants.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/generation/createGenerateFunction.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/providers/initializeProvider.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/assets/initializeHistoryCompositeAssetSource.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/providers/initializeProviders.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/quickActions/utils.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/panels/createConfirmationRenderFunction.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/compactSeparators.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/providers/getCanvasMenuComponentId.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/quickActions/getQuickActionOrder.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/providers/getApplyCallbacks.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/lockSelectionToEditMode.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/generation/CallbacksRegistry.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/generation/handleGenerateFromQuickAction.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/quickActions/createQuickActionMenuRenderFunction.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/ui/quickActions/initializeQuickActionComponents.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/utils/translationHelpers.ts", "../../../../node_modules/.pnpm/@imgly+plugin-ai-generation-web@file+packages+plugin-ai-generation-web_@cesdk+cesdk-js@1.49.1_react@18.3.1_/node_modules/@imgly/plugin-ai-generation-web/src/index.ts", "../../src/open-ai/GptImage1.text2image.json", "../../src/open-ai/utils.ts", "../../src/open-ai/GptImage1.styles.ts", "../../src/open-ai/GptImage1.text2image.ts", "../../src/open-ai/GptImage1.image2image.json", "../../src/open-ai/GptImage1.image2image.ts", "../../src/open-ai/quickActions/ChangeStyleLibrary.ts", "../../src/open-ai/index.ts"],
4
- "sourcesContent": ["export default `\n<svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/plugin/formats/ratioFree\"\n >\n <path d=\"M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z\" fill=\"currentColor\"/>\n <path d=\"M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z\" fill=\"currentColor\"/>\n <path d=\"M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z\" fill=\"currentColor\"/>\n <path d=\"M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z\" 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/plugin/formats/ratio4by3\"\n >\n <path d=\"M6.5 13H8V15H10V16.5H6.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M14 9V7.5H17.5V11H16V9H14Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z\" 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/plugin/formats/ratio16by9\"\n >\n <path d=\"M4.5 13H6V15H8V16.5H4.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M16 9V7.5H19.5V11H18V9H16Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z\" 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/plugin/formats/ratio9by16\"\n >\n <path d=\"M7.5 16H9V18H11V19.5H7.5V16Z\" fill=\"currentColor\"/>\n <path d=\"M13 6V4.5H16.5V8H15V6H13Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z\" 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/plugin/formats/ratio3by4\"\n >\n <path d=\"M11 17.5V16H9V14H7.5V17.5H11Z\" fill=\"currentColor\"/>\n <path d=\"M15 10H16.5V6.5H13V8H15V10Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z\" 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/plugin/formats/ratio1by1\"\n >\n <path d=\"M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z\" fill=\"currentColor\"/>\n <path d=\"M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z\" fill=\"currentColor\"/>\n <path d=\"M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z\" fill=\"currentColor\"/>\n <path d=\"M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z\" fill=\"currentColor\"/>\n </symbol>\n</svg>\n`;\n", "import type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/engine';\n\n/**\n * Simplified value type for select inputs that can be converted to asset definitions\n */\nexport type SelectValue = {\n id: string;\n label: string;\n thumbUri?: string;\n meta?: { [key: string]: any };\n};\n\n/**\n * Options for CustomAssetSource constructor\n */\nexport interface CustomAssetSourceOptions {\n /**\n * Optional callback function to translate asset labels\n * @param assetId - The ID of the asset to translate\n * @param fallbackLabel - The fallback label to use if translation is not available\n * @param locale - The current locale\n * @returns The translated label or fallback\n */\n translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n}\n\n/**\n * A custom AssetSource implementation that manages assets from an array\n * and provides additional functionality like to mark assets as active or changing\n * labels.\n */\nexport class CustomAssetSource implements AssetSource {\n /** The unique id of the asset source */\n id: string;\n\n /** Array of assets to be served by this source */\n private assets: AssetDefinition[];\n\n /** Set of IDs for active assets */\n private activeAssetIds: Set<string>;\n\n /** Optional translation callback function */\n private translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n\n /**\n * Creates a new instance of CustomAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n */\n constructor(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n ) {\n this.id = id;\n this.translateLabel = options?.translateLabel;\n this.assets = assets.map((asset) => {\n // Check if the asset is a SelectValue by looking for the label property as a string\n if (\n typeof (asset as SelectValue).label === 'string' &&\n !(\n (asset as AssetDefinition).label &&\n typeof (asset as AssetDefinition).label === 'object'\n )\n ) {\n const selectValue = asset as SelectValue;\n // Convert SelectValue to AssetDefinition\n return {\n id: selectValue.id,\n label: { en: selectValue.label },\n meta: selectValue.thumbUri\n ? { ...(selectValue.meta ?? {}), thumbUri: selectValue.thumbUri }\n : selectValue.meta\n } as AssetDefinition;\n }\n return asset as AssetDefinition;\n });\n this.activeAssetIds = new Set<string>();\n\n // Automatically set first asset as active if available\n if (this.assets.length > 0) {\n this.activeAssetIds.add(this.assets[0].id);\n }\n }\n\n /**\n * Find assets based on the provided query data\n * Supports pagination, searching, filtering, and active-first sorting\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n const {\n page,\n perPage,\n locale = 'en',\n sortActiveFirst,\n query,\n tags,\n groups,\n excludeGroups,\n sortingOrder,\n sortKey\n } = queryData;\n\n // Start with all assets\n let filteredAssets = [...this.assets];\n\n // Filter by groups if provided\n if (groups && groups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n asset.groups && groups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter out excluded groups if provided\n if (excludeGroups && excludeGroups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n !asset.groups ||\n !excludeGroups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter by query (search in label and tags)\n if (query) {\n const lowerQuery = query.toLowerCase();\n filteredAssets = filteredAssets.filter((asset) => {\n const label = asset.label?.[locale]?.toLowerCase();\n const assetTags = asset.tags?.[locale] || [];\n\n return (\n (label && label.includes(lowerQuery)) ||\n assetTags.some((tag) => tag.toLowerCase().includes(lowerQuery))\n );\n });\n }\n\n // Filter by exact tags if provided\n if (tags && tags.length > 0) {\n const tagArray = Array.isArray(tags) ? tags : [tags];\n filteredAssets = filteredAssets.filter((asset) => {\n const assetTags = asset.tags?.[locale] || [];\n return tagArray.some((tag) => assetTags.includes(tag));\n });\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n filteredAssets.sort((a, b) => {\n const aActive = this.activeAssetIds.has(a.id);\n const bActive = this.activeAssetIds.has(b.id);\n\n if (aActive && !bActive) return -1;\n if (!aActive && bActive) return 1;\n return 0;\n });\n }\n\n // Sort by sortKey if provided\n if (sortKey && sortKey !== 'id') {\n filteredAssets.sort((a, b) => {\n // Sort by metadata field\n const aValue = a.meta?.[sortKey];\n const bValue = b.meta?.[sortKey];\n\n if (aValue === undefined) return 1;\n if (bValue === undefined) return -1;\n\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n return sortingOrder === 'Descending'\n ? bValue.localeCompare(aValue)\n : aValue.localeCompare(bValue);\n }\n\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortingOrder === 'Descending'\n ? bValue - aValue\n : aValue - bValue;\n }\n\n return 0;\n });\n } else if (sortKey === 'id') {\n // Sort by id\n filteredAssets.sort((a, b) => {\n return sortingOrder === 'Descending'\n ? b.id.localeCompare(a.id)\n : a.id.localeCompare(b.id);\n });\n }\n\n // Calculate pagination\n const total = filteredAssets.length;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = filteredAssets.slice(startIndex, endIndex);\n\n // Transform AssetDefinition objects to AssetResult objects\n const resultAssets: AssetResult[] = paginatedAssets.map((asset) => {\n // Use translation callback if provided, otherwise use default label\n const fallbackLabel = asset.label?.[locale] || '';\n const label = this.translateLabel\n ? this.translateLabel(asset.id, fallbackLabel, locale)\n : fallbackLabel;\n\n return {\n id: asset.id,\n groups: asset.groups,\n meta: asset.meta,\n payload: asset.payload,\n locale,\n label,\n tags: asset.tags?.[locale],\n active: this.activeAssetIds.has(asset.id)\n };\n });\n\n // Calculate next page if there are more assets\n const nextPage = endIndex < total ? page + 1 : undefined;\n\n return {\n assets: resultAssets,\n currentPage: page,\n nextPage,\n total\n };\n }\n\n updateLabel(assetId: string, label: string, locale: string): void {\n this.assets.forEach((asset) => {\n if (asset.id === assetId) {\n asset.label = asset.label || {};\n asset.label[locale] = label;\n }\n });\n }\n\n /**\n * Get the asset select value by its ID\n *\n * @param assetId - The ID of the asset to retrieve\n * @returns The SelectValue object for the asset or undefined if not found\n */\n getAssetSelectValue(assetId: string): SelectValue | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n return undefined;\n }\n\n /**\n * Get the currently active asset as a SelectValue\n *\n * @returns The SelectValue object for the active asset or undefined if no asset is active\n */\n getActiveSelectValue(): SelectValue | undefined {\n const activeIds = this.getActiveAssetIds();\n if (activeIds.length > 0) {\n const asset = this.assets.find(({ id }) => id === activeIds[0]);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n }\n return undefined;\n }\n\n /**\n * Get the translated label for an asset by its ID\n *\n * @param assetId - The ID of the asset\n * @returns The translated label or undefined if asset not found\n */\n getTranslatedLabel(assetId: string): string | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n return this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n }\n return undefined;\n }\n\n /**\n * Get an asset by its ID\n */\n getAsset(id: string): AssetDefinition | undefined {\n return this.assets.find((asset) => asset.id === id);\n }\n\n /**\n * Set an asset as active by its ID\n *\n * @param assetId - The ID of the asset to mark as active\n */\n setAssetActive(assetId: string): void {\n this.activeAssetIds.add(assetId);\n }\n\n /**\n * Get all active asset IDs\n *\n * @returns Array of active asset IDs\n */\n getActiveAssetIds(): string[] {\n return Array.from(this.activeAssetIds);\n }\n\n /**\n * Set multiple assets as active by their IDs\n *\n * @param assetIds - Array of asset IDs to mark as active\n */\n setAssetsActive(assetIds: string[]): void {\n assetIds.forEach((id) => this.activeAssetIds.add(id));\n }\n\n /**\n * Set an asset as inactive by its ID\n *\n * @param assetId - The ID of the asset to mark as inactive\n */\n setAssetInactive(assetId: string): void {\n this.activeAssetIds.delete(assetId);\n }\n\n /**\n * Clear all active assets\n */\n clearActiveAssets(): void {\n this.activeAssetIds.clear();\n }\n\n /**\n * Check if an asset is marked as active\n *\n * @param assetId - The ID of the asset to check\n * @returns True if the asset is active, false otherwise\n */\n isAssetActive(assetId: string): boolean {\n return this.activeAssetIds.has(assetId);\n }\n\n /**\n * Add an asset to this source\n *\n * @param asset - The asset definition to add\n */\n addAsset(asset: AssetDefinition): void {\n // Check if asset with this ID already exists\n const existingIndex = this.assets.findIndex((a) => a.id === asset.id);\n if (existingIndex >= 0) {\n // Replace existing asset\n this.assets[existingIndex] = asset;\n } else {\n // Add new asset\n this.assets.push(asset);\n }\n }\n\n /**\n * Remove an asset from this source\n *\n * @param assetId - The ID of the asset to remove\n */\n removeAsset(assetId: string): void {\n const index = this.assets.findIndex((asset) => asset.id === assetId);\n if (index !== -1) {\n this.assets.splice(index, 1);\n this.activeAssetIds.delete(assetId);\n }\n }\n\n /**\n * Get all available groups from the assets\n *\n * @returns Array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groups = new Set<string>();\n this.assets.forEach((asset) => {\n if (asset.groups) {\n asset.groups.forEach((group) => groups.add(group));\n }\n });\n return Array.from(groups);\n }\n\n /**\n * Returns the supported MIME types for this asset source\n *\n * @returns Array of supported MIME types\n */\n getSupportedMimeTypes(): string[] {\n return [\n 'image/jpeg',\n 'image/png',\n 'image/svg+xml',\n 'image/webp',\n 'video/mp4',\n 'audio/mpeg'\n ];\n }\n}\n\n/**\n * Helper function to create a CustomAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n * @returns A new CustomAssetSource instance\n */\nexport function createCustomAssetSource(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n): CustomAssetSource {\n return new CustomAssetSource(id, assets, options);\n}\n\nexport default CustomAssetSource;\n", "/* eslint-disable no-console */\nimport {\n CreativeEngine,\n type AssetDefinition,\n type AssetQueryData,\n type AssetResult,\n type AssetSource,\n type AssetsQueryResult\n} from '@cesdk/cesdk-js';\n\ntype BlobEntry = {\n id: string;\n blob: Blob;\n};\n\n// Asset definition with meta containing insertedAt timestamp\ntype AssetEntryWithMeta = AssetDefinition;\n\n/**\n * IndexedDBAssetSource implements the AssetSource interface using IndexedDB as the storage backend.\n */\nexport class IndexedDBAssetSource implements AssetSource {\n /** The unique id of the API */\n public readonly id: string;\n\n public readonly engine: CreativeEngine;\n\n private readonly dbName: string;\n\n private readonly dbVersion: number;\n\n private readonly assetStoreName: string = 'assets';\n\n private readonly blobStoreName: string = 'blobs';\n\n private db: IDBDatabase | null = null;\n\n /**\n * Creates a new IndexedDBAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param {Object} [options] - Optional configuration options.\n * @param {string} [options.dbName] - The name of the database.\n * @param {number} [options.dbVersion] - The version number of the database.\n */\n constructor(\n id: string,\n engine: CreativeEngine,\n options?: {\n dbName?: string;\n dbVersion?: number;\n }\n ) {\n this.id = id;\n this.engine = engine;\n this.dbName = options?.dbName ?? `ly.img.assetSource/${id}`;\n this.dbVersion = options?.dbVersion ?? 1;\n }\n\n /**\n * Initialize the database connection and create object stores if needed\n */\n public async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n reject(\n new Error(\n `Failed to open IndexedDB: ${(event.target as IDBRequest).error}`\n )\n );\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n\n // Create asset store if it doesn't exist\n if (!db.objectStoreNames.contains(this.assetStoreName)) {\n db.createObjectStore(this.assetStoreName, {\n keyPath: 'id'\n });\n }\n // Create blob store if it doesn't exist\n if (!db.objectStoreNames.contains(this.blobStoreName)) {\n db.createObjectStore(this.blobStoreName, {\n keyPath: 'id'\n });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n resolve();\n };\n });\n }\n\n /**\n * Close the database connection\n */\n public close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n\n /**\n * Find all assets for the given type and the provided query data.\n *\n * @param queryData - The query parameters for filtering assets\n * @param insertionSortOrder - Optional parameter to sort by insertion time: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to the query results or undefined if there was an error\n */\n public async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n try {\n // Get all assets from the store with specified insertion order\n const assetDefinitions = await this.getAllAssets('asc');\n\n let assetResults = assetDefinitions.reduce((acc, assetDefinition) => {\n const locale = queryData.locale ?? 'en';\n let label = '';\n let tags: string[] = [];\n\n // Handle localized label if available\n if (\n assetDefinition.label != null &&\n typeof assetDefinition.label === 'object' &&\n assetDefinition.label[locale]\n ) {\n label = assetDefinition.label[locale];\n }\n\n // Handle localized tags if available\n if (\n assetDefinition.tags != null &&\n typeof assetDefinition.tags === 'object' &&\n assetDefinition.tags[locale]\n ) {\n tags = assetDefinition.tags[locale];\n }\n\n const result: AssetResult = {\n ...assetDefinition,\n label,\n tags\n };\n\n if (this.filterAsset(result, queryData)) {\n acc.push(result);\n }\n\n return acc;\n }, [] as AssetResult[]);\n\n assetResults = await this.restoreBlobUrls(assetResults);\n\n // Apply sorting\n assetResults = this.sortAssets(assetResults, queryData);\n\n // Apply pagination\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = assetResults.slice(startIndex, endIndex);\n\n // Determine if there's a next page\n const nextPage = endIndex < assetResults.length ? page + 1 : undefined;\n\n const result = {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: assetResults.length\n };\n\n return result;\n } catch (error) {\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n public async getGroups(): Promise<string[]> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const allGroups = new Set<string>();\n\n // Extract all groups from all assets\n (request.result as AssetResult[]).forEach((asset) => {\n if (asset.groups && Array.isArray(asset.groups)) {\n asset.groups.forEach((group) => allGroups.add(group));\n }\n });\n\n const uniqueGroups = [...allGroups];\n resolve(uniqueGroups);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get groups: ${request.error}`));\n };\n });\n }\n\n /**\n * Adds the given asset to this source. Part of the AssetSource interface.\n *\n * @param asset - The asset definition to add\n */\n public addAsset(asset: AssetDefinition): void {\n this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const assetStore = transaction.objectStore(this.assetStoreName);\n\n const blobsToStore = new Set<string>();\n processBlobUrls(asset, (value) => {\n blobsToStore.add(value);\n });\n\n setTimeout(() => {\n this.storeBlobUrls([...blobsToStore]);\n });\n\n // Ensure asset has meta object with insertedAt timestamp\n const assetWithMeta: AssetEntryWithMeta = {\n ...asset,\n meta: {\n ...asset.meta,\n insertedAt: asset.meta?.insertedAt || Date.now()\n }\n };\n\n // Store the asset in the database\n assetStore.put(assetWithMeta);\n\n transaction.onerror = () => {\n console.error(`Failed to add asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeAsset(assetId: string): Promise<void> {\n const asset = await this.getAsset(assetId);\n\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.assetStoreName);\n store.delete(assetId);\n\n transaction.oncomplete = () => {\n processBlobUrls(asset, (value) => {\n this.removeBlob(value);\n });\n this.engine.asset.assetSourceContentsChanged(this.id);\n };\n\n transaction.onerror = () => {\n console.error(`Failed to remove asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeBlob(blobId: string): Promise<void> {\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.blobStoreName);\n store.delete(blobId);\n\n transaction.onerror = () => {\n console.error(`Failed to remove blob: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Get all assets from the database sorted by insertion order (newest to oldest)\n *\n * @param sortOrder - Optional parameter to specify sort order: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to an array of all assets\n */\n private async getAllAssets(\n sortOrder: 'asc' | 'desc' = 'desc'\n ): Promise<AssetDefinition[]> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const assets = request.result as AssetEntryWithMeta[];\n\n // Sort by insertion timestamp\n assets.sort((a, b) => {\n // Default to current time if insertedAt is missing (for backward compatibility)\n // First check in meta.insertedAt, then fallback to legacy _insertedAt for backward compatibility\n const timeA =\n a.meta?.insertedAt || (a as any)._insertedAt || Date.now();\n const timeB =\n b.meta?.insertedAt || (b as any)._insertedAt || Date.now();\n\n // Sort based on requested order\n return sortOrder === 'asc'\n ? timeA - timeB // oldest first\n : timeB - timeA; // newest first (default)\n });\n\n resolve(assets);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get assets: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getAsset(id: string): Promise<AssetResult | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as AssetResult);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getBlob(id: string): Promise<BlobEntry | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.blobStoreName, 'readonly');\n const store = transaction.objectStore(this.blobStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as BlobEntry);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n async createBlobUrlFromStore(blobUrl: string): Promise<string> {\n const blobEntry = await this.getBlob(blobUrl);\n if (blobEntry != null) {\n return URL.createObjectURL(blobEntry.blob);\n }\n return blobUrl;\n }\n\n async storeBlobUrls(urls: string[]): Promise<void> {\n const blobsToStore: { [key: string]: Blob } = {};\n await Promise.all(\n urls.map(async (blobUrl) => {\n const blobResponse = await fetch(blobUrl);\n const blob = await blobResponse.blob();\n blobsToStore[blobUrl] = blob;\n })\n );\n\n return this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const blobStore = transaction.objectStore(this.blobStoreName);\n\n // Store the asset in the database\n Object.entries(blobsToStore).forEach(([key, blob]) => {\n const asset: BlobEntry = { id: key, blob };\n blobStore.put(asset);\n });\n\n transaction.onerror = () => {\n console.error(`Failed to add blobs: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n async restoreBlobUrls(assets: AssetResult[]): Promise<AssetResult[]> {\n const blobReplaced: { [key: string]: string } = {};\n const blobUrls: Set<string> = new Set();\n processBlobUrls(assets, (value) => {\n blobUrls.add(value);\n });\n\n await Promise.all(\n [...blobUrls].map(async (value) => {\n const newUrl = await this.createBlobUrlFromStore(value);\n blobReplaced[value] = newUrl;\n })\n );\n\n return processBlobUrls(assets, (value) => {\n return blobReplaced[value] ?? value;\n });\n }\n\n /**\n * Returns if the given asset should be filtered based on query data\n *\n * @param asset - The asset to filter\n * @param queryData - The query parameters to filter by\n * @returns true if the asset should be included, false otherwise\n */\n private filterAsset(asset: AssetResult, queryData: AssetQueryData): boolean {\n const { query, tags, groups, excludeGroups } = queryData;\n\n // Filter by query string (search on label and tags)\n if (query && query.trim() !== '') {\n const lowerQuery = query.trim().toLowerCase().split(' ');\n\n const lowerLabel = asset.label?.toLowerCase() ?? '';\n const lowerTags = asset.tags?.map((tag) => tag.toLowerCase()) ?? [];\n\n const matchLabelOrTag = lowerQuery.every((word) => {\n return (\n lowerLabel.includes(word) ||\n lowerTags.some((tag) => tag.includes(word))\n );\n });\n\n if (!matchLabelOrTag) {\n return false;\n }\n }\n\n // Filter by exact tags if provided by the query\n if (tags) {\n const tagList = Array.isArray(tags) ? tags : [tags];\n if (\n tagList.length > 0 &&\n (!asset.tags || !tagList.every((tag) => asset.tags?.includes(tag)))\n ) {\n return false;\n }\n }\n\n // Filter by groups\n if (groups && groups.length > 0) {\n if (\n !asset.groups ||\n !groups.some((group) => asset.groups?.includes(group))\n ) {\n return false;\n }\n }\n\n // Filter by excluded groups\n if (excludeGroups && excludeGroups.length > 0) {\n if (\n asset.groups &&\n asset.groups.some((group) => excludeGroups.includes(group))\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Sort assets based on query data\n *\n * @param assets - The assets to sort\n * @param queryData - The query parameters with sorting information\n * @returns The sorted assets\n */\n private sortAssets(\n assets: AssetResult[],\n queryData: AssetQueryData\n ): AssetResult[] {\n const { sortingOrder, sortKey, sortActiveFirst } = queryData;\n\n // Clone the array to avoid modifying the original\n const sortedAssets = [...assets];\n\n // If no sorting order specified or set to 'None', return the current order\n if (!sortingOrder || sortingOrder === 'None') {\n return sortedAssets;\n }\n\n // Sort by the specified key\n if (sortKey) {\n sortedAssets.sort((a, b) => {\n let valueA;\n let valueB;\n\n if (sortKey === 'id') {\n valueA = a.id;\n valueB = b.id;\n } else {\n // Handle metadata sorting (assuming metadata is stored in a 'metadata' field)\n valueA = a.meta?.[sortKey] ?? null;\n valueB = b.meta?.[sortKey] ?? null;\n }\n\n // Handle null/undefined values\n if (valueA === null || valueA === undefined)\n return sortingOrder === 'Ascending' ? -1 : 1;\n if (valueB === null || valueB === undefined)\n return sortingOrder === 'Ascending' ? 1 : -1;\n\n // Compare values based on sorting order\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return sortingOrder === 'Ascending'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n } else {\n return sortingOrder === 'Ascending'\n ? valueA < valueB\n ? -1\n : valueA > valueB\n ? 1\n : 0\n : valueA > valueB\n ? -1\n : valueA < valueB\n ? 1\n : 0;\n }\n });\n } else if (sortingOrder === 'Descending') {\n // If no sort key is specified, and sorting order set\n // to Descending, just reverse original order\n sortedAssets.reverse();\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n sortedAssets.sort((a, b) => {\n if (a.active && !b.active) return -1;\n if (!a.active && b.active) return 1;\n return 0;\n });\n }\n\n return sortedAssets;\n }\n}\n\n/**\n * Goes through an object and calls a callback for every string value that starts with 'blob:'\n * The callback can return a string to replace the original value\n * @param obj The object to traverse\n * @param callback Function to call when a blob URL is found, can return a replacement value\n * @param path Current path in the object (used for recursion)\n * @returns The modified object (or the original if no replacements were made)\n */\nfunction processBlobUrls<T>(\n obj: T,\n callback: (value: string, path: string) => string | void,\n path: string = ''\n): T {\n // Return the object as is if it's null or not an object\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n for (let index = 0; index < obj.length; index++) {\n const currentPath = path ? `${path}[${index}]` : `[${index}]`;\n\n if (typeof obj[index] === 'string' && obj[index].startsWith('blob:')) {\n const replacement = callback(obj[index], currentPath);\n if (typeof replacement === 'string') {\n obj[index] = replacement;\n }\n } else {\n obj[index] = processBlobUrls(obj[index], callback, currentPath);\n }\n }\n return obj;\n }\n\n // Handle regular objects\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const currentPath = path ? `${path}.${key}` : key;\n\n if (typeof value === 'string' && value.startsWith('blob:')) {\n const replacement = callback(value, currentPath);\n if (typeof replacement === 'string') {\n // @ts-ignore\n obj[key] = replacement;\n }\n } else {\n obj[key] = processBlobUrls(value, callback, currentPath);\n }\n }\n }\n\n return obj;\n}\n\nexport default IndexedDBAssetSource;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/cesdk-js';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * AggregatedAssetSource implements the AssetSource interface by aggregating\n * multiple asset sources via the cesdk API and combining their results.\n *\n * This asset source is read-only - it does not support adding or removing assets.\n */\nexport class AggregatedAssetSource implements AssetSource {\n /** The unique id of the asset source */\n public readonly id: string;\n\n /** The Creative Editor SDK instance */\n private cesdk: CreativeEditorSDK;\n\n /** The IDs of asset sources to aggregate */\n private assetSourceIds: string[];\n\n /**\n * Creates a new AggregatedAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n */\n constructor(id: string, cesdk: CreativeEditorSDK, assetSourceIds: string[]) {\n this.id = id;\n this.cesdk = cesdk;\n this.assetSourceIds = assetSourceIds;\n }\n\n /**\n * Find assets across all aggregated sources based on the provided query data\n * Results are sorted by the insertedAt timestamp in meta field\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n try {\n // Query all asset sources via cesdk\n const queryPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.findAssets(sourceId, {\n ...queryData,\n // Increase page size to get all assets from each source\n // We'll handle pagination after merging\n perPage: 9999,\n page: 0\n })\n );\n\n // Wait for all queries to complete\n const results = await Promise.all(queryPromises);\n\n // Combine all assets from all sources\n let allAssets: AssetResult[] = [];\n results.forEach((result) => {\n if (result?.assets) {\n allAssets = allAssets.concat(result.assets);\n }\n });\n\n // Sort by insertedAt timestamp\n allAssets.sort((a, b) => {\n const timeA = (a.meta?.insertedAt as number) || 0;\n const timeB = (b.meta?.insertedAt as number) || 0;\n\n // Sort newest first (descending)\n return timeB - timeA;\n });\n\n // Apply pagination after merging\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = allAssets.slice(startIndex, endIndex);\n\n // Calculate if there is a next page\n const nextPage = endIndex < allAssets.length ? page + 1 : undefined;\n\n return {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: allAssets.length\n };\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n /**\n * Retrieves all groups from all aggregated asset sources using cesdk\n * @returns Promise with an array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groupPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.getGroups(sourceId)\n );\n\n const groupArrays = await Promise.all(groupPromises);\n\n // Combine and deduplicate groups\n const uniqueGroups = new Set<string>();\n groupArrays.forEach((groups) => {\n groups.forEach((group) => uniqueGroups.add(group));\n });\n\n return Array.from(uniqueGroups);\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n addAsset(_asset: AssetDefinition): void {\n throw new Error('AggregatedAssetSource does not support adding assets');\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n removeAsset(_assetId: string): void {\n throw new Error('AggregatedAssetSource does not support removing assets');\n }\n}\n\n/**\n * Helper function to create an AggregatedAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n * @returns A new AggregatedAssetSource instance\n */\nexport function createAggregatedAssetSource(\n id: string,\n cesdk: CreativeEditorSDK,\n assetSourceIds: string[]\n): AggregatedAssetSource {\n return new AggregatedAssetSource(id, cesdk, assetSourceIds);\n}\n\nexport default AggregatedAssetSource;\n", "import { type CreativeEngine } from '@cesdk/cesdk-js';\n\nclass Metadata<V> {\n engine: CreativeEngine;\n\n key: string;\n\n constructor(engine: CreativeEngine, key: string) {\n this.engine = engine;\n this.key = key;\n }\n\n hasData(blockId: number): boolean {\n return (\n this.engine.block.isValid(blockId) &&\n this.engine.block.hasMetadata(blockId, this.key)\n );\n }\n\n get(blockId: number): V | undefined {\n if (this.hasData(blockId)) {\n return JSON.parse(this.engine.block.getMetadata(blockId, this.key));\n }\n return undefined;\n }\n\n set(blockId: number, value: V) {\n this.engine.block.setMetadata(blockId, this.key, JSON.stringify(value));\n }\n\n clear(blockId: number) {\n if (this.engine.block.hasMetadata(blockId, this.key)) {\n this.engine.block.removeMetadata(blockId, this.key);\n }\n }\n}\n\nexport default Metadata;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import baseIsEqual from './_baseIsEqual.js';\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nexport default isEqual;\n", "import { isEqual } from 'lodash-es';\n\nimport Metadata from './Metadata';\nimport {\n PluginStatusError,\n PluginStatusMetadata,\n PluginStatusProcessed,\n PluginStatusProcessing\n} from './types';\n\nclass ImageProcessingMetadata extends Metadata<PluginStatusMetadata> {\n get(blockId: number): PluginStatusMetadata {\n return super.get(blockId) ?? { status: 'IDLE' };\n }\n\n /**\n * Detect if the block has been duplicated with processed or processing\n * fill processing. In that case the processing state is still\n * valid, but blockId and fillId have changed.\n */\n isDuplicate(blockId: number): boolean {\n if (!this.engine.block.isValid(blockId)) return false;\n\n const metadata = this.get(blockId);\n\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return false;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n\n // It cannot be a duplicate if the blockId or fillId are the same\n if (metadata.blockId === blockId || metadata.fillId === fillId)\n return false;\n\n return true;\n }\n\n /**\n * Fixes the metadata if the block has been duplicated, i.e. the blockId and\n * fillId will be updated to the current block/fill.\n *\n * Please note: Call this method only on duplicates (see isDuplicate).\n */\n fixDuplicate(blockId: number) {\n const fillId = this.engine.block.getFill(blockId);\n const metadata = this.get(blockId);\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return;\n this.set(blockId, {\n ...metadata,\n blockId,\n fillId\n });\n\n // If it is currently processing the best we can do is to just recover\n // the initial image data, since no processing will update this block and\n // it will be stuck in the processing state.\n if (metadata.status === 'PROCESSING') {\n this.recoverInitialImageData(blockId);\n this.clear(blockId);\n }\n }\n\n /**\n * Check if the image has a consisten metadata state. A inconsistent state is\n * caused by outside changes of the fill data.\n *\n * @returns true if the metadata is consistent, false otherwise\n */\n isConsistent(blockId: number): boolean {\n // In case the block was removed, we just abort and mark it\n // as reset by returning true\n if (!this.engine.block.isValid(blockId)) return false;\n const metadata = this.get(blockId);\n if (metadata.status === 'IDLE' || metadata.status === 'PENDING')\n return true;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n if (fillId == null) return false;\n\n if (blockId !== metadata.blockId || fillId !== metadata.fillId)\n return false;\n\n const sourceSet = this.engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const imageFileURI = this.engine.block.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n\n if (\n sourceSet.length === 0 &&\n !imageFileURI &&\n metadata.status === 'PROCESSING'\n ) {\n // While we process it is OK to have no image file URI and no source set\n // (which we cleared to show the spinning loader)\n return true;\n }\n\n // Source sets have precedence over imageFileURI so if we have a source set,\n // we only need to check if it has changed to something else.\n if (sourceSet?.length > 0) {\n const initialSourceSet = metadata.initialSourceSet;\n // If we have already processed the image, we need to check if the source set\n // we need to check against both source sets, the removed and the initial\n if (metadata.status !== 'PROCESSED') {\n if (!isEqual(sourceSet, initialSourceSet)) {\n return false;\n }\n }\n } else {\n if (metadata.status !== 'PROCESSED') {\n if (imageFileURI !== metadata.initialImageFileURI) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Recover the initial values to avoid the loading spinner and have the same\n * state as before the fill processing was started.\n */\n recoverInitialImageData(blockId: number) {\n const blockApi = this.engine.block;\n if (!blockApi.hasFill(blockId)) return; // Nothing to recover (no fill anymore)\n\n const metadata = this.get(blockId);\n\n if (metadata.status === 'PENDING' || metadata.status === 'IDLE') {\n return;\n }\n\n const initialSourceSet = metadata.initialSourceSet;\n const initialImageFileURI = metadata.initialImageFileURI;\n const initialPreviewFileURI = metadata.initialPreviewFileURI;\n\n const fillId = this.getValidFill(blockId, metadata);\n if (fillId == null) return;\n\n if (initialImageFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/imageFileURI',\n initialImageFileURI\n );\n }\n if (initialPreviewFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/previewFileURI',\n initialPreviewFileURI\n );\n }\n if (initialSourceSet.length > 0) {\n this.engine.block.setSourceSet(\n fillId,\n 'fill/image/sourceSet',\n initialSourceSet\n );\n }\n }\n\n /**\n * Returns the fill id of the block if it has a valid fill that was used for\n * fill processing. Returns undefined otherwise.\n */\n private getValidFill(\n blockId: number,\n metadata: PluginStatusProcessing | PluginStatusError | PluginStatusProcessed\n ): number | undefined {\n if (\n !this.engine.block.isValid(blockId) ||\n !this.engine.block.hasFill(blockId) ||\n blockId !== metadata.blockId\n ) {\n return undefined;\n }\n const fillId = this.engine.block.getFill(blockId);\n if (fillId !== metadata.fillId) {\n return undefined;\n }\n\n return fillId;\n }\n}\n\nexport default ImageProcessingMetadata;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n PluginStatusProcessed,\n PluginStatusProcessing\n} from '../metadata/types';\n\ninterface FillProcessor<T> {\n processFill(metadataState: PluginStatusProcessing): Promise<T>;\n\n commitProcessing(\n data: T,\n metadataState: PluginStatusProcessed\n ): number | void;\n}\n\nasync function fillProcessing<T>(\n blockId: number,\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n processor: FillProcessor<T>\n) {\n const blockApi = cesdk.engine.block;\n if (!blockApi.hasFill(blockId))\n throw new Error('Block does not support fill');\n\n const fillId = blockApi.getFill(blockId);\n\n // Get the current image URI and source set as initial values.\n const initialSourceSet = blockApi.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const initialImageFileURI = blockApi.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n const initialPreviewFileURI = blockApi.getString(\n fillId,\n 'fill/image/previewFileURI'\n );\n try {\n cesdk.engine.block.setState(fillId, {\n type: 'Pending',\n progress: 0\n });\n\n const status: PluginStatusProcessing = {\n ...metadata.get(blockId),\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSING'\n };\n\n metadata.set(blockId, status);\n\n const processedData = await processor.processFill(status);\n // Check for externally changed state while we were applying the mask and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n // Check for externally changed state while we were uploading and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n if (processedData == null) return;\n\n const metadataStateProcessed: PluginStatusProcessed = {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSED'\n };\n\n const blockIdOrVoid = processor.commitProcessing(\n processedData,\n metadataStateProcessed\n );\n\n // If a new block was created, we do not update the metadata.\n if (blockIdOrVoid == null || blockIdOrVoid === blockId) {\n metadata.set(blockId, metadataStateProcessed);\n }\n\n // Finally, create an undo step\n cesdk.engine.editor.addUndoStep();\n } catch (error) {\n if (cesdk.engine.block.isValid(blockId)) {\n metadata.set(blockId, {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'ERROR'\n });\n\n metadata.recoverInitialImageData(blockId);\n }\n\n if (\n error != null &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n const message =\n error.message === 'signal timed out'\n ? 'Processing canceled due to timeout'\n : error.message;\n cesdk.ui.showNotification({\n type: 'error',\n message\n });\n }\n\n // eslint-disable-next-line no-console\n console.log(error);\n } finally {\n if (cesdk.engine.block.isValid(fillId)) {\n cesdk.engine.block.setState(fillId, { type: 'Ready' });\n }\n }\n}\n\nexport default fillProcessing;\n", "export function getFeatureId(pluginId: string): string {\n return `${pluginId}.fillProcessing.feature`;\n}\n\nexport function getCanvasMenuComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasMenu`, `${pluginId}.fillProcessing.canvasMenu`];\n}\n\nexport function getDockComponentIds(pluginId: string): string[] {\n return [`${pluginId}.dock`, `${pluginId}.fillProcessing.dock`];\n}\n\nexport function getInspectorBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.inspectorBar`,\n `${pluginId}.fillProcessing.inspectorBar`\n ];\n}\n\nexport function getNavigationBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.navigationBar`,\n `${pluginId}.fillProcessing.navigationBar`\n ];\n}\n\nexport function getCanvasBarComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasBar`, `${pluginId}.fillProcessing.canvasBar`];\n}\n\nexport function getI18nCanvasMenuLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasMenu.button.label`;\n}\n\nexport function getI18nDockLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.dock.button.label`;\n}\n\nexport function getI18nInspectorBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.inspectorBar.button.label`;\n}\n\nexport function getI18nNavigationBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.navigationBar.button.label`;\n}\n\nexport function getI18nCanvasBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasBar.button.label`;\n}\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\nimport { FillProcessingMetadata } from '..';\nimport { getFeatureId } from './constants';\n\nexport default function handleFillProcessing(\n cesdk: CreativeEditorSDK,\n {\n pluginId,\n process\n }: {\n pluginId: string;\n icon?: string;\n process: (blockId: number, metadata: FillProcessingMetadata) => void;\n }\n): {\n featureId: string;\n} {\n const featureId = getFeatureId(pluginId);\n\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n enableFeatures(cesdk, metadata, featureId);\n\n cesdk.engine.event.subscribe([], async (events) => {\n events.forEach((e) => {\n const id = e.block;\n if (!cesdk.engine.block.isValid(id) || !metadata.hasData(id)) {\n return;\n }\n\n if (e.type === 'Created') {\n if (metadata.isDuplicate(id)) {\n metadata.fixDuplicate(id);\n }\n } else if (e.type === 'Updated') {\n switch (metadata.get(id).status) {\n case 'PENDING': {\n if (\n cesdk.feature.isEnabled(featureId, {\n engine: cesdk.engine\n }) &&\n cesdk.engine.block.isAllowedByScope(id, 'fill/change') &&\n cesdk.engine.block.getState(id).type !== 'Pending'\n ) {\n process(id, metadata);\n }\n break;\n }\n\n case 'PROCESSING':\n case 'PROCESSED': {\n if (!metadata.isConsistent(id)) {\n metadata.clear(id);\n }\n break;\n }\n\n default: {\n // We do not care about other states\n }\n }\n }\n });\n });\n\n return { featureId };\n}\n\n/**\n * Defines the feature that determines in which context (on which block)\n * fill processing is allowed/enabled.\n */\nfunction enableFeatures(\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n featureId: string\n) {\n cesdk.feature.enable(featureId, ({ engine }) => {\n const selectedIds = engine.block.findAllSelected();\n if (selectedIds.length !== 1) {\n return false;\n }\n const [selectedId] = selectedIds;\n\n if (!cesdk.engine.block.isVisible(selectedId)) return false;\n\n if (cesdk.engine.block.hasFill(selectedId)) {\n const kind = cesdk.engine.block.getKind(selectedId);\n if (kind === 'sticker') return false;\n\n const fillId = cesdk.engine.block.getFill(selectedId);\n const fillType = cesdk.engine.block.getType(fillId);\n\n if (fillType !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n const fileUri = engine.block.getString(fillId, 'fill/image/imageFileURI');\n const sourceSet = engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n\n if (sourceSet.length > 0 || fileUri !== '') return true;\n\n // If we are in a processing state we do not have a imageFileURI or\n // source set set (to show the loading spinner), but the feature is still\n // enabled.\n return metadata.get(selectedId).status === 'PROCESSING';\n }\n\n return false;\n });\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n getCanvasBarComponentIds,\n getCanvasMenuComponentIds,\n getDockComponentIds,\n getFeatureId,\n getI18nCanvasBarLabel,\n getI18nCanvasMenuLabel,\n getI18nDockLabel,\n getI18nInspectorBarLabel,\n getI18nNavigationBarLabel,\n getInspectorBarComponentIds,\n getNavigationBarComponentIds\n} from './constants';\n\nexport type Location =\n | 'inspectorBar'\n | 'navigationBar'\n | 'canvasBarTop'\n | 'canvasBarBottom'\n | 'canvasMenu'\n | 'dock';\n\n/**\n * Registers the components that can be used to process the fill of\n * a block.\n */\nexport default function registerFillProcessingComponents(\n cesdk: CreativeEditorSDK,\n options: {\n pluginId: string;\n icon?: string;\n locations?: Location | Location[];\n }\n): {\n canvasMenuComponentId: string;\n dockComponentId: string;\n\n translationsKeys: {\n inspectorBarLabel: string;\n navigationBarLabel: string;\n canvasBarLabel: string;\n canvasMenuLabel: string;\n dockLabel: string;\n };\n} {\n const { pluginId, locations } = options;\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n const canvasMenuLabel = getI18nCanvasMenuLabel(pluginId);\n const canvasMenuComponentIds = getCanvasMenuComponentIds(pluginId);\n const canvasMenuComponentId = canvasMenuComponentIds[0];\n\n const dockLabel = getI18nDockLabel(pluginId);\n const dockComponentIds = getDockComponentIds(pluginId);\n const dockComponentId = dockComponentIds[0];\n\n const inspectorBarLabel = getI18nInspectorBarLabel(pluginId);\n const inspectorBarComponentIds = getInspectorBarComponentIds(pluginId);\n const inspectorBarComponentId = inspectorBarComponentIds[0];\n\n const navigationBarLabel = getI18nNavigationBarLabel(pluginId);\n const navigationBarComponentIds = getNavigationBarComponentIds(pluginId);\n const navigationBarComponentId = navigationBarComponentIds[0];\n\n const canvasBarLabel = getI18nCanvasBarLabel(pluginId);\n const canvasBarComponentIds = getCanvasBarComponentIds(pluginId);\n const canvasBarComponentId = canvasBarComponentIds[0];\n\n const featureId = getFeatureId(pluginId);\n\n if (locations?.includes('inspectorBar')) {\n cesdk.ui.setInspectorBarOrder([\n inspectorBarComponentId,\n ...cesdk.ui.getInspectorBarOrder()\n ]);\n }\n\n if (locations?.includes('navigationBar')) {\n cesdk.ui.setNavigationBarOrder([\n navigationBarComponentId,\n ...cesdk.ui.getNavigationBarOrder()\n ]);\n }\n\n if (locations?.includes('canvasBarTop')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('top')],\n 'top'\n );\n }\n\n if (locations?.includes('canvasBarBottom')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('bottom')],\n 'bottom'\n );\n }\n\n if (locations?.includes('canvasMenu')) {\n cesdk.ui.setCanvasMenuOrder([\n canvasMenuComponentId,\n ...cesdk.ui.getCanvasMenuOrder()\n ]);\n }\n\n if (locations?.includes('dock')) {\n cesdk.ui.setDockOrder([...cesdk.ui.getDockOrder(), dockComponentId]);\n }\n\n cesdk.ui.registerComponent(\n dockComponentIds,\n ({ builder: { Button }, engine }) => {\n const [id] = engine.block.findAllSelected();\n\n let isDisabled = false;\n let isLoading = false;\n let loadingProgress: number | undefined;\n\n if (id == null) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.engine.block.isAllowedByScope(id, 'fill/change')\n ) {\n isDisabled = true;\n }\n\n if (!isDisabled && engine.block.getState(id)?.type === 'Pending') {\n isDisabled = true;\n }\n\n if (!isDisabled) {\n const currentMetadata = metadata.get(id);\n\n isLoading = currentMetadata.status === 'PROCESSING';\n isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING';\n\n if (\n currentMetadata.status === 'PROCESSING' &&\n currentMetadata.progress\n ) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n }\n\n const buttonId = `${dockComponentId}.button`;\n Button(buttonId, {\n label: dockLabel,\n icon: options.icon,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n const currentMetadata = metadata.get(id);\n\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n\n const buttonComponents: {\n componentIds: string[];\n label: string;\n variant: 'plain' | 'regular';\n }[] = [\n {\n componentIds: inspectorBarComponentIds,\n variant: 'plain',\n label: inspectorBarLabel\n },\n {\n componentIds: navigationBarComponentIds,\n variant: 'regular',\n label: navigationBarLabel\n },\n {\n componentIds: canvasBarComponentIds,\n variant: 'regular',\n label: canvasBarLabel\n },\n {\n componentIds: canvasMenuComponentIds,\n variant: 'plain',\n label: canvasMenuLabel\n }\n ];\n\n buttonComponents.forEach(({ componentIds, label, variant }) => {\n const componentId = componentIds[0];\n cesdk.ui.registerComponent(\n componentIds,\n ({ builder: { Button }, engine }) => {\n if (\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n return;\n }\n\n const [id] = engine.block.findAllSelected();\n\n if (!cesdk.engine.block.isAllowedByScope(id, 'fill/change')) return;\n\n const currentMetadata = metadata.get(id);\n\n const isLoading = currentMetadata.status === 'PROCESSING';\n const isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING' ||\n engine.block.getState(id)?.type === 'Pending';\n\n let loadingProgress: number | undefined;\n if (isLoading && currentMetadata.progress) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n\n const buttonId = `${componentId}.button`;\n Button(buttonId, {\n icon: options.icon,\n label,\n variant,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n });\n\n return {\n canvasMenuComponentId,\n dockComponentId,\n translationsKeys: {\n inspectorBarLabel,\n navigationBarLabel,\n canvasBarLabel,\n canvasMenuLabel,\n dockLabel\n }\n };\n}\n", "import { type RGBAColor } from '@cesdk/cesdk-js';\n\nconst HEX_COLOR_PATTERN = new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'i');\nconst HEX_SINGLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{1}/, 'g');\nconst HEX_DOUBLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{2}/, 'g');\n\n/** @public */\nexport const rgbaToHex = (rgba: RGBAColor, includeAlpha = false): string => {\n const { r, g, b, a } = rgba;\n const rByte = Math.round(255 * r);\n const gByte = Math.round(255 * g);\n const bByte = Math.round(255 * b);\n const aByte = Math.round(255 * a);\n const byteToHex = (byte: number) => {\n return byte.toString(16).padStart(2, '0');\n };\n return `#${byteToHex(rByte)}${byteToHex(gByte)}${byteToHex(bByte)}${\n includeAlpha ? byteToHex(aByte) : ''\n }`;\n};\n\n/** @public */\nexport const hexToRgba = (hexString: string): RGBAColor => {\n const rgbaHexToColor = (\n r: string,\n g: string,\n b: string,\n a: string | undefined,\n max: number\n ) => {\n return {\n r: parseInt(r, 16) / max,\n g: parseInt(g, 16) / max,\n b: parseInt(b, 16) / max,\n a: a === undefined ? 1 : parseInt(a, 16) / max\n };\n };\n\n if (hexString.startsWith('#')) {\n if (hexString.length === 4 || hexString.length === 5) {\n const hexMatch = hexString.match(HEX_SINGLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 15);\n }\n }\n if (hexString.length === 7 || hexString.length === 8) {\n const hexMatch = hexString.match(HEX_DOUBLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 255);\n }\n }\n }\n\n throw new Error(\n 'Invalid hex string! Allowed RGB formats are \"#FFF\" and \"#FFFFFF\". Allowed RGBA formats are \"#FFFF\" and \"#FFFFFFFF'\n );\n};\n\n/** @public */\nexport const isValidHexColor = (hexString: string): boolean => {\n return HEX_COLOR_PATTERN.test(hexString);\n};\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Uploads a blob with the help of CE.SDK\n */\nexport async function uploadBlob(\n blob: Blob,\n initialUri: string,\n cesdk: CreativeEditorSDK\n) {\n const pathname = new URL(initialUri).pathname;\n const parts = pathname.split('/');\n const extension = mimeTypeToExtension(blob.type);\n const filename = parts[parts.length - 1]?.split('.')?.[0] ?? 'asset';\n const filenameWithExtension = `${filename}.${extension}`;\n\n const uploadedAssets = await cesdk.unstable_upload(\n new File([blob], filenameWithExtension, { type: blob.type }),\n () => {\n // TODO Delegate process to UI component\n }\n );\n\n const url = uploadedAssets.meta?.uri;\n if (url == null) {\n throw new Error('Could not upload processed fill');\n }\n return url;\n}\n\n/**\n * Returns the file extension for a given mime type.\n */\nexport function mimeTypeToExtension(mimeType: string): string {\n const extensions: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/webp': 'webp',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg'\n };\n return extensions[mimeType] ?? 'png';\n}\n\nexport async function fetchImageBlob(uri: string): Promise<Blob> {\n return fetch(uri).then((response) => response.blob());\n}\n\n/**\n * Converts a buffer URI to a object url.\n */\nexport async function bufferURIToObjectURL(\n uri: string,\n engine: CreativeEngine\n): Promise<string> {\n if (uri.startsWith('buffer:')) {\n const mimeType = await engine.editor.getMimeType(uri);\n const length = engine.editor.getBufferLength(uri);\n const data = engine.editor.getBufferData(uri, 0, length);\n const buffer = new Uint8Array(data);\n const blob = new Blob([buffer], { type: mimeType });\n return URL.createObjectURL(blob);\n } else {\n return uri;\n }\n}\n", "function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\nexport default uuid4;\n", "import { bufferURIToObjectURL } from './upload';\nimport { type CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Get the dimensions of an image from its URL\n *\n * @param url - The URL of the image\n * @returns A promise that resolves to an object containing the width and height of the image\n */\nexport async function getImageDimensionsFromURL(\n url: string,\n engine: CreativeEngine\n): Promise<{ width: number; height: number }> {\n const resolvedUrl = await bufferURIToObjectURL(url, engine);\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n img.src = resolvedUrl;\n });\n}\n\n/**\n * Get the URI of an image from a block ID, either the first source of a source set or\n * the image file URI. Will handle buffer URIs and convert them to object URLs.\n */\nexport async function getImageUri(\n blockId: number,\n engine: CreativeEngine,\n options?: { throwErrorIfSvg?: boolean }\n): Promise<string> {\n let uri;\n const fillBlock = engine.block.getFill(blockId);\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) throw new Error('No image source/uri found');\n } else {\n uri = source.uri;\n }\n\n // Check if the image is SVG (not supported)\n if (options?.throwErrorIfSvg) {\n const mimeType = await engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n }\n\n return bufferURIToObjectURL(uri, engine);\n}\n\n/**\n * Returns if the given fill block is an SVG image fill.\n */\nexport async function isSvgFill(\n fillBlock: number,\n engine: CreativeEngine\n): Promise<boolean> {\n if (engine.block.getType(fillBlock) !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n let uri;\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) return false;\n } else {\n uri = source.uri;\n }\n\n const mimeType = await engine.editor.getMimeType(uri);\n return mimeType === 'image/svg+xml';\n}\n", "/**\n * Checks if a value is defined (not undefined).\n *\n * Helpful to filter out undefined values from an array or collection\n * while keeping the type information intact.\n *\n * ```\n * array.filter(isDefined)\n * ```\n */\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined;\n}\n\nexport default isDefined;\n", "/**\n * Converts a value to an array format.\n *\n * @template T The type of the array elements\n * @param value - The value to convert. Can be a single item, an array, null, or undefined\n * @returns An array containing the value(s). Returns empty array if value is null/undefined,\n * the original array if value is already an array, or a single-element array if value is a single item\n *\n * @example\n * ```typescript\n * toArray('hello') // ['hello']\n * toArray(['a', 'b']) // ['a', 'b']\n * toArray(null) // []\n * toArray(undefined) // []\n * toArray(42) // [42]\n * ```\n */\nfunction toArray<T>(value?: T | T[]): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nexport default toArray;\n", "/**\n * Interface for objects that have translation capabilities\n */\ninterface TranslationAPI {\n translate(key: string | string[]): string;\n}\n\n/**\n * Check if CE.SDK supports the translate API (version 1.59.0 or higher)\n * @param cesdk - The CE.SDK instance to check\n * @returns True if the translate API is supported\n */\nexport function supportsTranslateAPI(cesdk: any): boolean {\n if (!cesdk?.version) return false;\n\n // Use localeCompare for semantic version comparison\n // Returns >= 0 when cesdk.version is 1.59.0 or higher\n const comparison = cesdk.version.localeCompare('1.59.0', undefined, {\n numeric: true,\n sensitivity: 'base'\n });\n\n return comparison >= 0 && typeof cesdk.i18n?.translate === 'function';\n}\n\n/**\n * Type guard to check if an object has the translate API\n * @param i18n - The object to check\n * @returns True if the object has a translate function\n */\nexport function hasTranslateAPI(i18n: any): i18n is TranslationAPI {\n return typeof i18n?.translate === 'function';\n}\n", "import formatsIconSprite from './icons/formats';\n\nconst Icons = {\n Formats: formatsIconSprite\n};\n\nexport { Icons };\n\nexport {\n CustomAssetSource,\n type CustomAssetSourceOptions,\n type SelectValue\n} from './assetSources/CustomAssetSource';\n\nexport { IndexedDBAssetSource } from './assetSources/IndexedDBAssetSource';\n\nexport { AggregatedAssetSource } from './assetSources/AggregatedAssetSource';\n\nexport { default as Metadata } from './metadata/Metadata';\n\nexport { default as FillProcessingMetadata } from './metadata/FillProcessingMetadata';\n\nexport { default as fillProcessing } from './processing/fillProcessing';\n\nexport { default as initializeFillProcessing } from './processing/initializeFillProcessing';\n\nexport { default as registerFillProcessingComponents } from './processing/registerFillProcessingComponents';\n\nexport { type Optional } from './types/Optional';\n\nexport {\n type Location,\n type UserInterfaceConfiguration\n} from './types/UserInterfaceConfiguration';\n\nexport { hexToRgba, isValidHexColor, rgbaToHex } from './utils/colors';\n\nexport {\n uploadBlob,\n fetchImageBlob,\n bufferURIToObjectURL,\n mimeTypeToExtension\n} from './utils/upload';\n\nexport { default as uuid } from './utils/uuid';\n\nexport {\n getImageDimensionsFromURL,\n getImageUri,\n isSvgFill\n} from './utils/images';\n\nexport { default as isDefined } from './utils/isDefined';\n\nexport { default as toArray } from './utils/toArray';\n\nexport { supportsTranslateAPI, hasTranslateAPI } from './translationHelpers';\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { RenderCustomProperty } from '../../core/provider';\n\n/**\n * Provides render function for a image url property that allows\n * to select an image from the library with a MediaPreview\n *\n * By default this expects the property key to be `image_url`. This can be changed in the options.\n */\nfunction renderImageUrlProperty(\n provderId: string,\n options: {\n cesdk: CreativeEditorSDK;\n propertyKey?: string;\n defaultUrl?: string;\n }\n): RenderCustomProperty {\n const { cesdk } = options;\n const propertyKey = options.propertyKey ?? 'image_url';\n const panelIdForImageSelection = getImageSelectionPanelId(provderId);\n\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${panelIdForImageSelection}`]: 'Select Image To Change'\n }\n });\n\n createPanels(provderId, cesdk);\n\n const customProperties: RenderCustomProperty = {\n [propertyKey]: (context, property) => {\n const {\n builder,\n experimental: { global },\n payload\n } = context;\n const defaultUrl = payload?.url ?? options.defaultUrl;\n const stateValue = global<string>(\n `${provderId}.${property.id}`,\n defaultUrl\n );\n\n builder.MediaPreview(property.id, {\n preview: {\n type: 'image',\n uri: stateValue.value\n },\n action: {\n label: 'Select Image',\n onClick: () => {\n if (cesdk == null) return;\n\n cesdk.ui.openPanel(panelIdForImageSelection, {\n payload: {\n onSelect: (assetResult: AssetResult) => {\n if (assetResult.meta?.uri != null) {\n stateValue.setValue(assetResult.meta?.uri);\n }\n }\n }\n });\n }\n }\n });\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: stateValue.value\n };\n };\n }\n };\n\n return customProperties;\n}\n\nfunction createPanels(providerId: string, cesdk?: CreativeEditorSDK) {\n if (cesdk == null) return;\n\n cesdk.ui.registerPanel<{\n onSelect: (assetResult: AssetResult) => void;\n }>(getImageSelectionPanelId(providerId), ({ builder, payload }) => {\n builder.Library(`${providerId}.library.image`, {\n entries: ['ly.img.image'],\n onSelect: async (asset) => {\n const uri = asset?.meta?.uri;\n if (uri == null) return;\n\n const mimeType = await cesdk.engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n cesdk.ui.showNotification({\n type: 'warning',\n message:\n 'SVG images are not supported. Please choose a different image.'\n });\n } else if (mimeType.startsWith('image/')) {\n payload?.onSelect(asset);\n cesdk?.ui.closePanel(getImageSelectionPanelId(providerId));\n } else {\n cesdk.ui.showNotification({\n type: 'warning',\n message: `Only images are supported. Found '${mimeType}'. Please choose a different image.`\n });\n }\n }\n });\n });\n}\n\nfunction getImageSelectionPanelId(providerId: string) {\n return `ly.img.ai.${providerId}.imageSelection`;\n}\n\nexport default renderImageUrlProperty;\n", "export default `\n<svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/plugin/formats/ratioFree\"\n >\n <path d=\"M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z\" fill=\"currentColor\"/>\n <path d=\"M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z\" fill=\"currentColor\"/>\n <path d=\"M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z\" fill=\"currentColor\"/>\n <path d=\"M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z\" 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/plugin/formats/ratio4by3\"\n >\n <path d=\"M6.5 13H8V15H10V16.5H6.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M14 9V7.5H17.5V11H16V9H14Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z\" 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/plugin/formats/ratio16by9\"\n >\n <path d=\"M4.5 13H6V15H8V16.5H4.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M16 9V7.5H19.5V11H18V9H16Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z\" 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/plugin/formats/ratio9by16\"\n >\n <path d=\"M7.5 16H9V18H11V19.5H7.5V16Z\" fill=\"currentColor\"/>\n <path d=\"M13 6V4.5H16.5V8H15V6H13Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z\" 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/plugin/formats/ratio3by4\"\n >\n <path d=\"M11 17.5V16H9V14H7.5V17.5H11Z\" fill=\"currentColor\"/>\n <path d=\"M15 10H16.5V6.5H13V8H15V10Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z\" 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/plugin/formats/ratio1by1\"\n >\n <path d=\"M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z\" fill=\"currentColor\"/>\n <path d=\"M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z\" fill=\"currentColor\"/>\n <path d=\"M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z\" fill=\"currentColor\"/>\n <path d=\"M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z\" fill=\"currentColor\"/>\n </symbol>\n</svg>\n`;\n", "import type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/engine';\n\n/**\n * Simplified value type for select inputs that can be converted to asset definitions\n */\nexport type SelectValue = {\n id: string;\n label: string;\n thumbUri?: string;\n meta?: { [key: string]: any };\n};\n\n/**\n * Options for CustomAssetSource constructor\n */\nexport interface CustomAssetSourceOptions {\n /**\n * Optional callback function to translate asset labels\n * @param assetId - The ID of the asset to translate\n * @param fallbackLabel - The fallback label to use if translation is not available\n * @param locale - The current locale\n * @returns The translated label or fallback\n */\n translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n}\n\n/**\n * A custom AssetSource implementation that manages assets from an array\n * and provides additional functionality like to mark assets as active or changing\n * labels.\n */\nexport class CustomAssetSource implements AssetSource {\n /** The unique id of the asset source */\n id: string;\n\n /** Array of assets to be served by this source */\n private assets: AssetDefinition[];\n\n /** Set of IDs for active assets */\n private activeAssetIds: Set<string>;\n\n /** Optional translation callback function */\n private translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n\n /**\n * Creates a new instance of CustomAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n */\n constructor(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n ) {\n this.id = id;\n this.translateLabel = options?.translateLabel;\n this.assets = assets.map((asset) => {\n // Check if the asset is a SelectValue by looking for the label property as a string\n if (\n typeof (asset as SelectValue).label === 'string' &&\n !(\n (asset as AssetDefinition).label &&\n typeof (asset as AssetDefinition).label === 'object'\n )\n ) {\n const selectValue = asset as SelectValue;\n // Convert SelectValue to AssetDefinition\n return {\n id: selectValue.id,\n label: { en: selectValue.label },\n meta: selectValue.thumbUri\n ? { ...(selectValue.meta ?? {}), thumbUri: selectValue.thumbUri }\n : selectValue.meta\n } as AssetDefinition;\n }\n return asset as AssetDefinition;\n });\n this.activeAssetIds = new Set<string>();\n\n // Automatically set first asset as active if available\n if (this.assets.length > 0) {\n this.activeAssetIds.add(this.assets[0].id);\n }\n }\n\n /**\n * Find assets based on the provided query data\n * Supports pagination, searching, filtering, and active-first sorting\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n const {\n page,\n perPage,\n locale = 'en',\n sortActiveFirst,\n query,\n tags,\n groups,\n excludeGroups,\n sortingOrder,\n sortKey\n } = queryData;\n\n // Start with all assets\n let filteredAssets = [...this.assets];\n\n // Filter by groups if provided\n if (groups && groups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n asset.groups && groups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter out excluded groups if provided\n if (excludeGroups && excludeGroups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n !asset.groups ||\n !excludeGroups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter by query (search in label and tags)\n if (query) {\n const lowerQuery = query.toLowerCase();\n filteredAssets = filteredAssets.filter((asset) => {\n const label = asset.label?.[locale]?.toLowerCase();\n const assetTags = asset.tags?.[locale] || [];\n\n return (\n (label && label.includes(lowerQuery)) ||\n assetTags.some((tag) => tag.toLowerCase().includes(lowerQuery))\n );\n });\n }\n\n // Filter by exact tags if provided\n if (tags && tags.length > 0) {\n const tagArray = Array.isArray(tags) ? tags : [tags];\n filteredAssets = filteredAssets.filter((asset) => {\n const assetTags = asset.tags?.[locale] || [];\n return tagArray.some((tag) => assetTags.includes(tag));\n });\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n filteredAssets.sort((a, b) => {\n const aActive = this.activeAssetIds.has(a.id);\n const bActive = this.activeAssetIds.has(b.id);\n\n if (aActive && !bActive) return -1;\n if (!aActive && bActive) return 1;\n return 0;\n });\n }\n\n // Sort by sortKey if provided\n if (sortKey && sortKey !== 'id') {\n filteredAssets.sort((a, b) => {\n // Sort by metadata field\n const aValue = a.meta?.[sortKey];\n const bValue = b.meta?.[sortKey];\n\n if (aValue === undefined) return 1;\n if (bValue === undefined) return -1;\n\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n return sortingOrder === 'Descending'\n ? bValue.localeCompare(aValue)\n : aValue.localeCompare(bValue);\n }\n\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortingOrder === 'Descending'\n ? bValue - aValue\n : aValue - bValue;\n }\n\n return 0;\n });\n } else if (sortKey === 'id') {\n // Sort by id\n filteredAssets.sort((a, b) => {\n return sortingOrder === 'Descending'\n ? b.id.localeCompare(a.id)\n : a.id.localeCompare(b.id);\n });\n }\n\n // Calculate pagination\n const total = filteredAssets.length;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = filteredAssets.slice(startIndex, endIndex);\n\n // Transform AssetDefinition objects to AssetResult objects\n const resultAssets: AssetResult[] = paginatedAssets.map((asset) => {\n // Use translation callback if provided, otherwise use default label\n const fallbackLabel = asset.label?.[locale] || '';\n const label = this.translateLabel\n ? this.translateLabel(asset.id, fallbackLabel, locale)\n : fallbackLabel;\n\n return {\n id: asset.id,\n groups: asset.groups,\n meta: asset.meta,\n payload: asset.payload,\n locale,\n label,\n tags: asset.tags?.[locale],\n active: this.activeAssetIds.has(asset.id)\n };\n });\n\n // Calculate next page if there are more assets\n const nextPage = endIndex < total ? page + 1 : undefined;\n\n return {\n assets: resultAssets,\n currentPage: page,\n nextPage,\n total\n };\n }\n\n updateLabel(assetId: string, label: string, locale: string): void {\n this.assets.forEach((asset) => {\n if (asset.id === assetId) {\n asset.label = asset.label || {};\n asset.label[locale] = label;\n }\n });\n }\n\n /**\n * Get the asset select value by its ID\n *\n * @param assetId - The ID of the asset to retrieve\n * @returns The SelectValue object for the asset or undefined if not found\n */\n getAssetSelectValue(assetId: string): SelectValue | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n return undefined;\n }\n\n /**\n * Get the currently active asset as a SelectValue\n *\n * @returns The SelectValue object for the active asset or undefined if no asset is active\n */\n getActiveSelectValue(): SelectValue | undefined {\n const activeIds = this.getActiveAssetIds();\n if (activeIds.length > 0) {\n const asset = this.assets.find(({ id }) => id === activeIds[0]);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n }\n return undefined;\n }\n\n /**\n * Get the translated label for an asset by its ID\n *\n * @param assetId - The ID of the asset\n * @returns The translated label or undefined if asset not found\n */\n getTranslatedLabel(assetId: string): string | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n return this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n }\n return undefined;\n }\n\n /**\n * Get an asset by its ID\n */\n getAsset(id: string): AssetDefinition | undefined {\n return this.assets.find((asset) => asset.id === id);\n }\n\n /**\n * Set an asset as active by its ID\n *\n * @param assetId - The ID of the asset to mark as active\n */\n setAssetActive(assetId: string): void {\n this.activeAssetIds.add(assetId);\n }\n\n /**\n * Get all active asset IDs\n *\n * @returns Array of active asset IDs\n */\n getActiveAssetIds(): string[] {\n return Array.from(this.activeAssetIds);\n }\n\n /**\n * Set multiple assets as active by their IDs\n *\n * @param assetIds - Array of asset IDs to mark as active\n */\n setAssetsActive(assetIds: string[]): void {\n assetIds.forEach((id) => this.activeAssetIds.add(id));\n }\n\n /**\n * Set an asset as inactive by its ID\n *\n * @param assetId - The ID of the asset to mark as inactive\n */\n setAssetInactive(assetId: string): void {\n this.activeAssetIds.delete(assetId);\n }\n\n /**\n * Clear all active assets\n */\n clearActiveAssets(): void {\n this.activeAssetIds.clear();\n }\n\n /**\n * Check if an asset is marked as active\n *\n * @param assetId - The ID of the asset to check\n * @returns True if the asset is active, false otherwise\n */\n isAssetActive(assetId: string): boolean {\n return this.activeAssetIds.has(assetId);\n }\n\n /**\n * Add an asset to this source\n *\n * @param asset - The asset definition to add\n */\n addAsset(asset: AssetDefinition): void {\n // Check if asset with this ID already exists\n const existingIndex = this.assets.findIndex((a) => a.id === asset.id);\n if (existingIndex >= 0) {\n // Replace existing asset\n this.assets[existingIndex] = asset;\n } else {\n // Add new asset\n this.assets.push(asset);\n }\n }\n\n /**\n * Remove an asset from this source\n *\n * @param assetId - The ID of the asset to remove\n */\n removeAsset(assetId: string): void {\n const index = this.assets.findIndex((asset) => asset.id === assetId);\n if (index !== -1) {\n this.assets.splice(index, 1);\n this.activeAssetIds.delete(assetId);\n }\n }\n\n /**\n * Get all available groups from the assets\n *\n * @returns Array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groups = new Set<string>();\n this.assets.forEach((asset) => {\n if (asset.groups) {\n asset.groups.forEach((group) => groups.add(group));\n }\n });\n return Array.from(groups);\n }\n\n /**\n * Returns the supported MIME types for this asset source\n *\n * @returns Array of supported MIME types\n */\n getSupportedMimeTypes(): string[] {\n return [\n 'image/jpeg',\n 'image/png',\n 'image/svg+xml',\n 'image/webp',\n 'video/mp4',\n 'audio/mpeg'\n ];\n }\n}\n\n/**\n * Helper function to create a CustomAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n * @returns A new CustomAssetSource instance\n */\nexport function createCustomAssetSource(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n): CustomAssetSource {\n return new CustomAssetSource(id, assets, options);\n}\n\nexport default CustomAssetSource;\n", "/* eslint-disable no-console */\nimport {\n CreativeEngine,\n type AssetDefinition,\n type AssetQueryData,\n type AssetResult,\n type AssetSource,\n type AssetsQueryResult\n} from '@cesdk/cesdk-js';\n\ntype BlobEntry = {\n id: string;\n blob: Blob;\n};\n\n// Asset definition with meta containing insertedAt timestamp\ntype AssetEntryWithMeta = AssetDefinition;\n\n/**\n * IndexedDBAssetSource implements the AssetSource interface using IndexedDB as the storage backend.\n */\nexport class IndexedDBAssetSource implements AssetSource {\n /** The unique id of the API */\n public readonly id: string;\n\n public readonly engine: CreativeEngine;\n\n private readonly dbName: string;\n\n private readonly dbVersion: number;\n\n private readonly assetStoreName: string = 'assets';\n\n private readonly blobStoreName: string = 'blobs';\n\n private db: IDBDatabase | null = null;\n\n /**\n * Creates a new IndexedDBAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param {Object} [options] - Optional configuration options.\n * @param {string} [options.dbName] - The name of the database.\n * @param {number} [options.dbVersion] - The version number of the database.\n */\n constructor(\n id: string,\n engine: CreativeEngine,\n options?: {\n dbName?: string;\n dbVersion?: number;\n }\n ) {\n this.id = id;\n this.engine = engine;\n this.dbName = options?.dbName ?? `ly.img.assetSource/${id}`;\n this.dbVersion = options?.dbVersion ?? 1;\n }\n\n /**\n * Initialize the database connection and create object stores if needed\n */\n public async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n reject(\n new Error(\n `Failed to open IndexedDB: ${(event.target as IDBRequest).error}`\n )\n );\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n\n // Create asset store if it doesn't exist\n if (!db.objectStoreNames.contains(this.assetStoreName)) {\n db.createObjectStore(this.assetStoreName, {\n keyPath: 'id'\n });\n }\n // Create blob store if it doesn't exist\n if (!db.objectStoreNames.contains(this.blobStoreName)) {\n db.createObjectStore(this.blobStoreName, {\n keyPath: 'id'\n });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n resolve();\n };\n });\n }\n\n /**\n * Close the database connection\n */\n public close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n\n /**\n * Find all assets for the given type and the provided query data.\n *\n * @param queryData - The query parameters for filtering assets\n * @param insertionSortOrder - Optional parameter to sort by insertion time: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to the query results or undefined if there was an error\n */\n public async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n try {\n // Get all assets from the store with specified insertion order\n const assetDefinitions = await this.getAllAssets('asc');\n\n let assetResults = assetDefinitions.reduce((acc, assetDefinition) => {\n const locale = queryData.locale ?? 'en';\n let label = '';\n let tags: string[] = [];\n\n // Handle localized label if available\n if (\n assetDefinition.label != null &&\n typeof assetDefinition.label === 'object' &&\n assetDefinition.label[locale]\n ) {\n label = assetDefinition.label[locale];\n }\n\n // Handle localized tags if available\n if (\n assetDefinition.tags != null &&\n typeof assetDefinition.tags === 'object' &&\n assetDefinition.tags[locale]\n ) {\n tags = assetDefinition.tags[locale];\n }\n\n const result: AssetResult = {\n ...assetDefinition,\n label,\n tags\n };\n\n if (this.filterAsset(result, queryData)) {\n acc.push(result);\n }\n\n return acc;\n }, [] as AssetResult[]);\n\n assetResults = await this.restoreBlobUrls(assetResults);\n\n // Apply sorting\n assetResults = this.sortAssets(assetResults, queryData);\n\n // Apply pagination\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = assetResults.slice(startIndex, endIndex);\n\n // Determine if there's a next page\n const nextPage = endIndex < assetResults.length ? page + 1 : undefined;\n\n const result = {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: assetResults.length\n };\n\n return result;\n } catch (error) {\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n public async getGroups(): Promise<string[]> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const allGroups = new Set<string>();\n\n // Extract all groups from all assets\n (request.result as AssetResult[]).forEach((asset) => {\n if (asset.groups && Array.isArray(asset.groups)) {\n asset.groups.forEach((group) => allGroups.add(group));\n }\n });\n\n const uniqueGroups = [...allGroups];\n resolve(uniqueGroups);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get groups: ${request.error}`));\n };\n });\n }\n\n /**\n * Adds the given asset to this source. Part of the AssetSource interface.\n *\n * @param asset - The asset definition to add\n */\n public addAsset(asset: AssetDefinition): void {\n this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const assetStore = transaction.objectStore(this.assetStoreName);\n\n const blobsToStore = new Set<string>();\n processBlobUrls(asset, (value) => {\n blobsToStore.add(value);\n });\n\n setTimeout(() => {\n this.storeBlobUrls([...blobsToStore]);\n });\n\n // Ensure asset has meta object with insertedAt timestamp\n const assetWithMeta: AssetEntryWithMeta = {\n ...asset,\n meta: {\n ...asset.meta,\n insertedAt: asset.meta?.insertedAt || Date.now()\n }\n };\n\n // Store the asset in the database\n assetStore.put(assetWithMeta);\n\n transaction.onerror = () => {\n console.error(`Failed to add asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeAsset(assetId: string): Promise<void> {\n const asset = await this.getAsset(assetId);\n\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.assetStoreName);\n store.delete(assetId);\n\n transaction.oncomplete = () => {\n processBlobUrls(asset, (value) => {\n this.removeBlob(value);\n });\n this.engine.asset.assetSourceContentsChanged(this.id);\n };\n\n transaction.onerror = () => {\n console.error(`Failed to remove asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeBlob(blobId: string): Promise<void> {\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.blobStoreName);\n store.delete(blobId);\n\n transaction.onerror = () => {\n console.error(`Failed to remove blob: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Get all assets from the database sorted by insertion order (newest to oldest)\n *\n * @param sortOrder - Optional parameter to specify sort order: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to an array of all assets\n */\n private async getAllAssets(\n sortOrder: 'asc' | 'desc' = 'desc'\n ): Promise<AssetDefinition[]> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const assets = request.result as AssetEntryWithMeta[];\n\n // Sort by insertion timestamp\n assets.sort((a, b) => {\n // Default to current time if insertedAt is missing (for backward compatibility)\n // First check in meta.insertedAt, then fallback to legacy _insertedAt for backward compatibility\n const timeA =\n a.meta?.insertedAt || (a as any)._insertedAt || Date.now();\n const timeB =\n b.meta?.insertedAt || (b as any)._insertedAt || Date.now();\n\n // Sort based on requested order\n return sortOrder === 'asc'\n ? timeA - timeB // oldest first\n : timeB - timeA; // newest first (default)\n });\n\n resolve(assets);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get assets: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getAsset(id: string): Promise<AssetResult | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as AssetResult);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getBlob(id: string): Promise<BlobEntry | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.blobStoreName, 'readonly');\n const store = transaction.objectStore(this.blobStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as BlobEntry);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n async createBlobUrlFromStore(blobUrl: string): Promise<string> {\n const blobEntry = await this.getBlob(blobUrl);\n if (blobEntry != null) {\n return URL.createObjectURL(blobEntry.blob);\n }\n return blobUrl;\n }\n\n async storeBlobUrls(urls: string[]): Promise<void> {\n const blobsToStore: { [key: string]: Blob } = {};\n await Promise.all(\n urls.map(async (blobUrl) => {\n const blobResponse = await fetch(blobUrl);\n const blob = await blobResponse.blob();\n blobsToStore[blobUrl] = blob;\n })\n );\n\n return this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const blobStore = transaction.objectStore(this.blobStoreName);\n\n // Store the asset in the database\n Object.entries(blobsToStore).forEach(([key, blob]) => {\n const asset: BlobEntry = { id: key, blob };\n blobStore.put(asset);\n });\n\n transaction.onerror = () => {\n console.error(`Failed to add blobs: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n async restoreBlobUrls(assets: AssetResult[]): Promise<AssetResult[]> {\n const blobReplaced: { [key: string]: string } = {};\n const blobUrls: Set<string> = new Set();\n processBlobUrls(assets, (value) => {\n blobUrls.add(value);\n });\n\n await Promise.all(\n [...blobUrls].map(async (value) => {\n const newUrl = await this.createBlobUrlFromStore(value);\n blobReplaced[value] = newUrl;\n })\n );\n\n return processBlobUrls(assets, (value) => {\n return blobReplaced[value] ?? value;\n });\n }\n\n /**\n * Returns if the given asset should be filtered based on query data\n *\n * @param asset - The asset to filter\n * @param queryData - The query parameters to filter by\n * @returns true if the asset should be included, false otherwise\n */\n private filterAsset(asset: AssetResult, queryData: AssetQueryData): boolean {\n const { query, tags, groups, excludeGroups } = queryData;\n\n // Filter by query string (search on label and tags)\n if (query && query.trim() !== '') {\n const lowerQuery = query.trim().toLowerCase().split(' ');\n\n const lowerLabel = asset.label?.toLowerCase() ?? '';\n const lowerTags = asset.tags?.map((tag) => tag.toLowerCase()) ?? [];\n\n const matchLabelOrTag = lowerQuery.every((word) => {\n return (\n lowerLabel.includes(word) ||\n lowerTags.some((tag) => tag.includes(word))\n );\n });\n\n if (!matchLabelOrTag) {\n return false;\n }\n }\n\n // Filter by exact tags if provided by the query\n if (tags) {\n const tagList = Array.isArray(tags) ? tags : [tags];\n if (\n tagList.length > 0 &&\n (!asset.tags || !tagList.every((tag) => asset.tags?.includes(tag)))\n ) {\n return false;\n }\n }\n\n // Filter by groups\n if (groups && groups.length > 0) {\n if (\n !asset.groups ||\n !groups.some((group) => asset.groups?.includes(group))\n ) {\n return false;\n }\n }\n\n // Filter by excluded groups\n if (excludeGroups && excludeGroups.length > 0) {\n if (\n asset.groups &&\n asset.groups.some((group) => excludeGroups.includes(group))\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Sort assets based on query data\n *\n * @param assets - The assets to sort\n * @param queryData - The query parameters with sorting information\n * @returns The sorted assets\n */\n private sortAssets(\n assets: AssetResult[],\n queryData: AssetQueryData\n ): AssetResult[] {\n const { sortingOrder, sortKey, sortActiveFirst } = queryData;\n\n // Clone the array to avoid modifying the original\n const sortedAssets = [...assets];\n\n // If no sorting order specified or set to 'None', return the current order\n if (!sortingOrder || sortingOrder === 'None') {\n return sortedAssets;\n }\n\n // Sort by the specified key\n if (sortKey) {\n sortedAssets.sort((a, b) => {\n let valueA;\n let valueB;\n\n if (sortKey === 'id') {\n valueA = a.id;\n valueB = b.id;\n } else {\n // Handle metadata sorting (assuming metadata is stored in a 'metadata' field)\n valueA = a.meta?.[sortKey] ?? null;\n valueB = b.meta?.[sortKey] ?? null;\n }\n\n // Handle null/undefined values\n if (valueA === null || valueA === undefined)\n return sortingOrder === 'Ascending' ? -1 : 1;\n if (valueB === null || valueB === undefined)\n return sortingOrder === 'Ascending' ? 1 : -1;\n\n // Compare values based on sorting order\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return sortingOrder === 'Ascending'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n } else {\n return sortingOrder === 'Ascending'\n ? valueA < valueB\n ? -1\n : valueA > valueB\n ? 1\n : 0\n : valueA > valueB\n ? -1\n : valueA < valueB\n ? 1\n : 0;\n }\n });\n } else if (sortingOrder === 'Descending') {\n // If no sort key is specified, and sorting order set\n // to Descending, just reverse original order\n sortedAssets.reverse();\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n sortedAssets.sort((a, b) => {\n if (a.active && !b.active) return -1;\n if (!a.active && b.active) return 1;\n return 0;\n });\n }\n\n return sortedAssets;\n }\n}\n\n/**\n * Goes through an object and calls a callback for every string value that starts with 'blob:'\n * The callback can return a string to replace the original value\n * @param obj The object to traverse\n * @param callback Function to call when a blob URL is found, can return a replacement value\n * @param path Current path in the object (used for recursion)\n * @returns The modified object (or the original if no replacements were made)\n */\nfunction processBlobUrls<T>(\n obj: T,\n callback: (value: string, path: string) => string | void,\n path: string = ''\n): T {\n // Return the object as is if it's null or not an object\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n for (let index = 0; index < obj.length; index++) {\n const currentPath = path ? `${path}[${index}]` : `[${index}]`;\n\n if (typeof obj[index] === 'string' && obj[index].startsWith('blob:')) {\n const replacement = callback(obj[index], currentPath);\n if (typeof replacement === 'string') {\n obj[index] = replacement;\n }\n } else {\n obj[index] = processBlobUrls(obj[index], callback, currentPath);\n }\n }\n return obj;\n }\n\n // Handle regular objects\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const currentPath = path ? `${path}.${key}` : key;\n\n if (typeof value === 'string' && value.startsWith('blob:')) {\n const replacement = callback(value, currentPath);\n if (typeof replacement === 'string') {\n // @ts-ignore\n obj[key] = replacement;\n }\n } else {\n obj[key] = processBlobUrls(value, callback, currentPath);\n }\n }\n }\n\n return obj;\n}\n\nexport default IndexedDBAssetSource;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/cesdk-js';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * AggregatedAssetSource implements the AssetSource interface by aggregating\n * multiple asset sources via the cesdk API and combining their results.\n *\n * This asset source is read-only - it does not support adding or removing assets.\n */\nexport class AggregatedAssetSource implements AssetSource {\n /** The unique id of the asset source */\n public readonly id: string;\n\n /** The Creative Editor SDK instance */\n private cesdk: CreativeEditorSDK;\n\n /** The IDs of asset sources to aggregate */\n private assetSourceIds: string[];\n\n /**\n * Creates a new AggregatedAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n */\n constructor(id: string, cesdk: CreativeEditorSDK, assetSourceIds: string[]) {\n this.id = id;\n this.cesdk = cesdk;\n this.assetSourceIds = assetSourceIds;\n }\n\n /**\n * Find assets across all aggregated sources based on the provided query data\n * Results are sorted by the insertedAt timestamp in meta field\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n try {\n // Query all asset sources via cesdk\n const queryPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.findAssets(sourceId, {\n ...queryData,\n // Increase page size to get all assets from each source\n // We'll handle pagination after merging\n perPage: 9999,\n page: 0\n })\n );\n\n // Wait for all queries to complete\n const results = await Promise.all(queryPromises);\n\n // Combine all assets from all sources\n let allAssets: AssetResult[] = [];\n results.forEach((result) => {\n if (result?.assets) {\n allAssets = allAssets.concat(result.assets);\n }\n });\n\n // Sort by insertedAt timestamp\n allAssets.sort((a, b) => {\n const timeA = (a.meta?.insertedAt as number) || 0;\n const timeB = (b.meta?.insertedAt as number) || 0;\n\n // Sort newest first (descending)\n return timeB - timeA;\n });\n\n // Apply pagination after merging\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = allAssets.slice(startIndex, endIndex);\n\n // Calculate if there is a next page\n const nextPage = endIndex < allAssets.length ? page + 1 : undefined;\n\n return {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: allAssets.length\n };\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n /**\n * Retrieves all groups from all aggregated asset sources using cesdk\n * @returns Promise with an array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groupPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.getGroups(sourceId)\n );\n\n const groupArrays = await Promise.all(groupPromises);\n\n // Combine and deduplicate groups\n const uniqueGroups = new Set<string>();\n groupArrays.forEach((groups) => {\n groups.forEach((group) => uniqueGroups.add(group));\n });\n\n return Array.from(uniqueGroups);\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n addAsset(_asset: AssetDefinition): void {\n throw new Error('AggregatedAssetSource does not support adding assets');\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n removeAsset(_assetId: string): void {\n throw new Error('AggregatedAssetSource does not support removing assets');\n }\n}\n\n/**\n * Helper function to create an AggregatedAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n * @returns A new AggregatedAssetSource instance\n */\nexport function createAggregatedAssetSource(\n id: string,\n cesdk: CreativeEditorSDK,\n assetSourceIds: string[]\n): AggregatedAssetSource {\n return new AggregatedAssetSource(id, cesdk, assetSourceIds);\n}\n\nexport default AggregatedAssetSource;\n", "import { type CreativeEngine } from '@cesdk/cesdk-js';\n\nclass Metadata<V> {\n engine: CreativeEngine;\n\n key: string;\n\n constructor(engine: CreativeEngine, key: string) {\n this.engine = engine;\n this.key = key;\n }\n\n hasData(blockId: number): boolean {\n return (\n this.engine.block.isValid(blockId) &&\n this.engine.block.hasMetadata(blockId, this.key)\n );\n }\n\n get(blockId: number): V | undefined {\n if (this.hasData(blockId)) {\n return JSON.parse(this.engine.block.getMetadata(blockId, this.key));\n }\n return undefined;\n }\n\n set(blockId: number, value: V) {\n this.engine.block.setMetadata(blockId, this.key, JSON.stringify(value));\n }\n\n clear(blockId: number) {\n if (this.engine.block.hasMetadata(blockId, this.key)) {\n this.engine.block.removeMetadata(blockId, this.key);\n }\n }\n}\n\nexport default Metadata;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import baseIsEqual from './_baseIsEqual.js';\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nexport default isEqual;\n", "import { isEqual } from 'lodash-es';\n\nimport Metadata from './Metadata';\nimport {\n PluginStatusError,\n PluginStatusMetadata,\n PluginStatusProcessed,\n PluginStatusProcessing\n} from './types';\n\nclass ImageProcessingMetadata extends Metadata<PluginStatusMetadata> {\n get(blockId: number): PluginStatusMetadata {\n return super.get(blockId) ?? { status: 'IDLE' };\n }\n\n /**\n * Detect if the block has been duplicated with processed or processing\n * fill processing. In that case the processing state is still\n * valid, but blockId and fillId have changed.\n */\n isDuplicate(blockId: number): boolean {\n if (!this.engine.block.isValid(blockId)) return false;\n\n const metadata = this.get(blockId);\n\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return false;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n\n // It cannot be a duplicate if the blockId or fillId are the same\n if (metadata.blockId === blockId || metadata.fillId === fillId)\n return false;\n\n return true;\n }\n\n /**\n * Fixes the metadata if the block has been duplicated, i.e. the blockId and\n * fillId will be updated to the current block/fill.\n *\n * Please note: Call this method only on duplicates (see isDuplicate).\n */\n fixDuplicate(blockId: number) {\n const fillId = this.engine.block.getFill(blockId);\n const metadata = this.get(blockId);\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return;\n this.set(blockId, {\n ...metadata,\n blockId,\n fillId\n });\n\n // If it is currently processing the best we can do is to just recover\n // the initial image data, since no processing will update this block and\n // it will be stuck in the processing state.\n if (metadata.status === 'PROCESSING') {\n this.recoverInitialImageData(blockId);\n this.clear(blockId);\n }\n }\n\n /**\n * Check if the image has a consisten metadata state. A inconsistent state is\n * caused by outside changes of the fill data.\n *\n * @returns true if the metadata is consistent, false otherwise\n */\n isConsistent(blockId: number): boolean {\n // In case the block was removed, we just abort and mark it\n // as reset by returning true\n if (!this.engine.block.isValid(blockId)) return false;\n const metadata = this.get(blockId);\n if (metadata.status === 'IDLE' || metadata.status === 'PENDING')\n return true;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n if (fillId == null) return false;\n\n if (blockId !== metadata.blockId || fillId !== metadata.fillId)\n return false;\n\n const sourceSet = this.engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const imageFileURI = this.engine.block.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n\n if (\n sourceSet.length === 0 &&\n !imageFileURI &&\n metadata.status === 'PROCESSING'\n ) {\n // While we process it is OK to have no image file URI and no source set\n // (which we cleared to show the spinning loader)\n return true;\n }\n\n // Source sets have precedence over imageFileURI so if we have a source set,\n // we only need to check if it has changed to something else.\n if (sourceSet?.length > 0) {\n const initialSourceSet = metadata.initialSourceSet;\n // If we have already processed the image, we need to check if the source set\n // we need to check against both source sets, the removed and the initial\n if (metadata.status !== 'PROCESSED') {\n if (!isEqual(sourceSet, initialSourceSet)) {\n return false;\n }\n }\n } else {\n if (metadata.status !== 'PROCESSED') {\n if (imageFileURI !== metadata.initialImageFileURI) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Recover the initial values to avoid the loading spinner and have the same\n * state as before the fill processing was started.\n */\n recoverInitialImageData(blockId: number) {\n const blockApi = this.engine.block;\n if (!blockApi.hasFill(blockId)) return; // Nothing to recover (no fill anymore)\n\n const metadata = this.get(blockId);\n\n if (metadata.status === 'PENDING' || metadata.status === 'IDLE') {\n return;\n }\n\n const initialSourceSet = metadata.initialSourceSet;\n const initialImageFileURI = metadata.initialImageFileURI;\n const initialPreviewFileURI = metadata.initialPreviewFileURI;\n\n const fillId = this.getValidFill(blockId, metadata);\n if (fillId == null) return;\n\n if (initialImageFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/imageFileURI',\n initialImageFileURI\n );\n }\n if (initialPreviewFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/previewFileURI',\n initialPreviewFileURI\n );\n }\n if (initialSourceSet.length > 0) {\n this.engine.block.setSourceSet(\n fillId,\n 'fill/image/sourceSet',\n initialSourceSet\n );\n }\n }\n\n /**\n * Returns the fill id of the block if it has a valid fill that was used for\n * fill processing. Returns undefined otherwise.\n */\n private getValidFill(\n blockId: number,\n metadata: PluginStatusProcessing | PluginStatusError | PluginStatusProcessed\n ): number | undefined {\n if (\n !this.engine.block.isValid(blockId) ||\n !this.engine.block.hasFill(blockId) ||\n blockId !== metadata.blockId\n ) {\n return undefined;\n }\n const fillId = this.engine.block.getFill(blockId);\n if (fillId !== metadata.fillId) {\n return undefined;\n }\n\n return fillId;\n }\n}\n\nexport default ImageProcessingMetadata;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n PluginStatusProcessed,\n PluginStatusProcessing\n} from '../metadata/types';\n\ninterface FillProcessor<T> {\n processFill(metadataState: PluginStatusProcessing): Promise<T>;\n\n commitProcessing(\n data: T,\n metadataState: PluginStatusProcessed\n ): number | void;\n}\n\nasync function fillProcessing<T>(\n blockId: number,\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n processor: FillProcessor<T>\n) {\n const blockApi = cesdk.engine.block;\n if (!blockApi.hasFill(blockId))\n throw new Error('Block does not support fill');\n\n const fillId = blockApi.getFill(blockId);\n\n // Get the current image URI and source set as initial values.\n const initialSourceSet = blockApi.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const initialImageFileURI = blockApi.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n const initialPreviewFileURI = blockApi.getString(\n fillId,\n 'fill/image/previewFileURI'\n );\n try {\n cesdk.engine.block.setState(fillId, {\n type: 'Pending',\n progress: 0\n });\n\n const status: PluginStatusProcessing = {\n ...metadata.get(blockId),\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSING'\n };\n\n metadata.set(blockId, status);\n\n const processedData = await processor.processFill(status);\n // Check for externally changed state while we were applying the mask and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n // Check for externally changed state while we were uploading and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n if (processedData == null) return;\n\n const metadataStateProcessed: PluginStatusProcessed = {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSED'\n };\n\n const blockIdOrVoid = processor.commitProcessing(\n processedData,\n metadataStateProcessed\n );\n\n // If a new block was created, we do not update the metadata.\n if (blockIdOrVoid == null || blockIdOrVoid === blockId) {\n metadata.set(blockId, metadataStateProcessed);\n }\n\n // Finally, create an undo step\n cesdk.engine.editor.addUndoStep();\n } catch (error) {\n if (cesdk.engine.block.isValid(blockId)) {\n metadata.set(blockId, {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'ERROR'\n });\n\n metadata.recoverInitialImageData(blockId);\n }\n\n if (\n error != null &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n const message =\n error.message === 'signal timed out'\n ? 'Processing canceled due to timeout'\n : error.message;\n cesdk.ui.showNotification({\n type: 'error',\n message\n });\n }\n\n // eslint-disable-next-line no-console\n console.log(error);\n } finally {\n if (cesdk.engine.block.isValid(fillId)) {\n cesdk.engine.block.setState(fillId, { type: 'Ready' });\n }\n }\n}\n\nexport default fillProcessing;\n", "export function getFeatureId(pluginId: string): string {\n return `${pluginId}.fillProcessing.feature`;\n}\n\nexport function getCanvasMenuComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasMenu`, `${pluginId}.fillProcessing.canvasMenu`];\n}\n\nexport function getDockComponentIds(pluginId: string): string[] {\n return [`${pluginId}.dock`, `${pluginId}.fillProcessing.dock`];\n}\n\nexport function getInspectorBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.inspectorBar`,\n `${pluginId}.fillProcessing.inspectorBar`\n ];\n}\n\nexport function getNavigationBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.navigationBar`,\n `${pluginId}.fillProcessing.navigationBar`\n ];\n}\n\nexport function getCanvasBarComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasBar`, `${pluginId}.fillProcessing.canvasBar`];\n}\n\nexport function getI18nCanvasMenuLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasMenu.button.label`;\n}\n\nexport function getI18nDockLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.dock.button.label`;\n}\n\nexport function getI18nInspectorBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.inspectorBar.button.label`;\n}\n\nexport function getI18nNavigationBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.navigationBar.button.label`;\n}\n\nexport function getI18nCanvasBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasBar.button.label`;\n}\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\nimport { FillProcessingMetadata } from '..';\nimport { getFeatureId } from './constants';\n\nexport default function handleFillProcessing(\n cesdk: CreativeEditorSDK,\n {\n pluginId,\n process\n }: {\n pluginId: string;\n icon?: string;\n process: (blockId: number, metadata: FillProcessingMetadata) => void;\n }\n): {\n featureId: string;\n} {\n const featureId = getFeatureId(pluginId);\n\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n enableFeatures(cesdk, metadata, featureId);\n\n cesdk.engine.event.subscribe([], async (events) => {\n events.forEach((e) => {\n const id = e.block;\n if (!cesdk.engine.block.isValid(id) || !metadata.hasData(id)) {\n return;\n }\n\n if (e.type === 'Created') {\n if (metadata.isDuplicate(id)) {\n metadata.fixDuplicate(id);\n }\n } else if (e.type === 'Updated') {\n switch (metadata.get(id).status) {\n case 'PENDING': {\n if (\n cesdk.feature.isEnabled(featureId, {\n engine: cesdk.engine\n }) &&\n cesdk.engine.block.isAllowedByScope(id, 'fill/change') &&\n cesdk.engine.block.getState(id).type !== 'Pending'\n ) {\n process(id, metadata);\n }\n break;\n }\n\n case 'PROCESSING':\n case 'PROCESSED': {\n if (!metadata.isConsistent(id)) {\n metadata.clear(id);\n }\n break;\n }\n\n default: {\n // We do not care about other states\n }\n }\n }\n });\n });\n\n return { featureId };\n}\n\n/**\n * Defines the feature that determines in which context (on which block)\n * fill processing is allowed/enabled.\n */\nfunction enableFeatures(\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n featureId: string\n) {\n cesdk.feature.enable(featureId, ({ engine }) => {\n const selectedIds = engine.block.findAllSelected();\n if (selectedIds.length !== 1) {\n return false;\n }\n const [selectedId] = selectedIds;\n\n if (!cesdk.engine.block.isVisible(selectedId)) return false;\n\n if (cesdk.engine.block.hasFill(selectedId)) {\n const kind = cesdk.engine.block.getKind(selectedId);\n if (kind === 'sticker') return false;\n\n const fillId = cesdk.engine.block.getFill(selectedId);\n const fillType = cesdk.engine.block.getType(fillId);\n\n if (fillType !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n const fileUri = engine.block.getString(fillId, 'fill/image/imageFileURI');\n const sourceSet = engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n\n if (sourceSet.length > 0 || fileUri !== '') return true;\n\n // If we are in a processing state we do not have a imageFileURI or\n // source set set (to show the loading spinner), but the feature is still\n // enabled.\n return metadata.get(selectedId).status === 'PROCESSING';\n }\n\n return false;\n });\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n getCanvasBarComponentIds,\n getCanvasMenuComponentIds,\n getDockComponentIds,\n getFeatureId,\n getI18nCanvasBarLabel,\n getI18nCanvasMenuLabel,\n getI18nDockLabel,\n getI18nInspectorBarLabel,\n getI18nNavigationBarLabel,\n getInspectorBarComponentIds,\n getNavigationBarComponentIds\n} from './constants';\n\nexport type Location =\n | 'inspectorBar'\n | 'navigationBar'\n | 'canvasBarTop'\n | 'canvasBarBottom'\n | 'canvasMenu'\n | 'dock';\n\n/**\n * Registers the components that can be used to process the fill of\n * a block.\n */\nexport default function registerFillProcessingComponents(\n cesdk: CreativeEditorSDK,\n options: {\n pluginId: string;\n icon?: string;\n locations?: Location | Location[];\n }\n): {\n canvasMenuComponentId: string;\n dockComponentId: string;\n\n translationsKeys: {\n inspectorBarLabel: string;\n navigationBarLabel: string;\n canvasBarLabel: string;\n canvasMenuLabel: string;\n dockLabel: string;\n };\n} {\n const { pluginId, locations } = options;\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n const canvasMenuLabel = getI18nCanvasMenuLabel(pluginId);\n const canvasMenuComponentIds = getCanvasMenuComponentIds(pluginId);\n const canvasMenuComponentId = canvasMenuComponentIds[0];\n\n const dockLabel = getI18nDockLabel(pluginId);\n const dockComponentIds = getDockComponentIds(pluginId);\n const dockComponentId = dockComponentIds[0];\n\n const inspectorBarLabel = getI18nInspectorBarLabel(pluginId);\n const inspectorBarComponentIds = getInspectorBarComponentIds(pluginId);\n const inspectorBarComponentId = inspectorBarComponentIds[0];\n\n const navigationBarLabel = getI18nNavigationBarLabel(pluginId);\n const navigationBarComponentIds = getNavigationBarComponentIds(pluginId);\n const navigationBarComponentId = navigationBarComponentIds[0];\n\n const canvasBarLabel = getI18nCanvasBarLabel(pluginId);\n const canvasBarComponentIds = getCanvasBarComponentIds(pluginId);\n const canvasBarComponentId = canvasBarComponentIds[0];\n\n const featureId = getFeatureId(pluginId);\n\n if (locations?.includes('inspectorBar')) {\n cesdk.ui.setInspectorBarOrder([\n inspectorBarComponentId,\n ...cesdk.ui.getInspectorBarOrder()\n ]);\n }\n\n if (locations?.includes('navigationBar')) {\n cesdk.ui.setNavigationBarOrder([\n navigationBarComponentId,\n ...cesdk.ui.getNavigationBarOrder()\n ]);\n }\n\n if (locations?.includes('canvasBarTop')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('top')],\n 'top'\n );\n }\n\n if (locations?.includes('canvasBarBottom')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('bottom')],\n 'bottom'\n );\n }\n\n if (locations?.includes('canvasMenu')) {\n cesdk.ui.setCanvasMenuOrder([\n canvasMenuComponentId,\n ...cesdk.ui.getCanvasMenuOrder()\n ]);\n }\n\n if (locations?.includes('dock')) {\n cesdk.ui.setDockOrder([...cesdk.ui.getDockOrder(), dockComponentId]);\n }\n\n cesdk.ui.registerComponent(\n dockComponentIds,\n ({ builder: { Button }, engine }) => {\n const [id] = engine.block.findAllSelected();\n\n let isDisabled = false;\n let isLoading = false;\n let loadingProgress: number | undefined;\n\n if (id == null) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.engine.block.isAllowedByScope(id, 'fill/change')\n ) {\n isDisabled = true;\n }\n\n if (!isDisabled && engine.block.getState(id)?.type === 'Pending') {\n isDisabled = true;\n }\n\n if (!isDisabled) {\n const currentMetadata = metadata.get(id);\n\n isLoading = currentMetadata.status === 'PROCESSING';\n isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING';\n\n if (\n currentMetadata.status === 'PROCESSING' &&\n currentMetadata.progress\n ) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n }\n\n const buttonId = `${dockComponentId}.button`;\n Button(buttonId, {\n label: dockLabel,\n icon: options.icon,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n const currentMetadata = metadata.get(id);\n\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n\n const buttonComponents: {\n componentIds: string[];\n label: string;\n variant: 'plain' | 'regular';\n }[] = [\n {\n componentIds: inspectorBarComponentIds,\n variant: 'plain',\n label: inspectorBarLabel\n },\n {\n componentIds: navigationBarComponentIds,\n variant: 'regular',\n label: navigationBarLabel\n },\n {\n componentIds: canvasBarComponentIds,\n variant: 'regular',\n label: canvasBarLabel\n },\n {\n componentIds: canvasMenuComponentIds,\n variant: 'plain',\n label: canvasMenuLabel\n }\n ];\n\n buttonComponents.forEach(({ componentIds, label, variant }) => {\n const componentId = componentIds[0];\n cesdk.ui.registerComponent(\n componentIds,\n ({ builder: { Button }, engine }) => {\n if (\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n return;\n }\n\n const [id] = engine.block.findAllSelected();\n\n if (!cesdk.engine.block.isAllowedByScope(id, 'fill/change')) return;\n\n const currentMetadata = metadata.get(id);\n\n const isLoading = currentMetadata.status === 'PROCESSING';\n const isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING' ||\n engine.block.getState(id)?.type === 'Pending';\n\n let loadingProgress: number | undefined;\n if (isLoading && currentMetadata.progress) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n\n const buttonId = `${componentId}.button`;\n Button(buttonId, {\n icon: options.icon,\n label,\n variant,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n });\n\n return {\n canvasMenuComponentId,\n dockComponentId,\n translationsKeys: {\n inspectorBarLabel,\n navigationBarLabel,\n canvasBarLabel,\n canvasMenuLabel,\n dockLabel\n }\n };\n}\n", "import { type RGBAColor } from '@cesdk/cesdk-js';\n\nconst HEX_COLOR_PATTERN = new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'i');\nconst HEX_SINGLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{1}/, 'g');\nconst HEX_DOUBLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{2}/, 'g');\n\n/** @public */\nexport const rgbaToHex = (rgba: RGBAColor, includeAlpha = false): string => {\n const { r, g, b, a } = rgba;\n const rByte = Math.round(255 * r);\n const gByte = Math.round(255 * g);\n const bByte = Math.round(255 * b);\n const aByte = Math.round(255 * a);\n const byteToHex = (byte: number) => {\n return byte.toString(16).padStart(2, '0');\n };\n return `#${byteToHex(rByte)}${byteToHex(gByte)}${byteToHex(bByte)}${\n includeAlpha ? byteToHex(aByte) : ''\n }`;\n};\n\n/** @public */\nexport const hexToRgba = (hexString: string): RGBAColor => {\n const rgbaHexToColor = (\n r: string,\n g: string,\n b: string,\n a: string | undefined,\n max: number\n ) => {\n return {\n r: parseInt(r, 16) / max,\n g: parseInt(g, 16) / max,\n b: parseInt(b, 16) / max,\n a: a === undefined ? 1 : parseInt(a, 16) / max\n };\n };\n\n if (hexString.startsWith('#')) {\n if (hexString.length === 4 || hexString.length === 5) {\n const hexMatch = hexString.match(HEX_SINGLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 15);\n }\n }\n if (hexString.length === 7 || hexString.length === 8) {\n const hexMatch = hexString.match(HEX_DOUBLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 255);\n }\n }\n }\n\n throw new Error(\n 'Invalid hex string! Allowed RGB formats are \"#FFF\" and \"#FFFFFF\". Allowed RGBA formats are \"#FFFF\" and \"#FFFFFFFF'\n );\n};\n\n/** @public */\nexport const isValidHexColor = (hexString: string): boolean => {\n return HEX_COLOR_PATTERN.test(hexString);\n};\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Uploads a blob with the help of CE.SDK\n */\nexport async function uploadBlob(\n blob: Blob,\n initialUri: string,\n cesdk: CreativeEditorSDK\n) {\n const pathname = new URL(initialUri).pathname;\n const parts = pathname.split('/');\n const extension = mimeTypeToExtension(blob.type);\n const filename = parts[parts.length - 1]?.split('.')?.[0] ?? 'asset';\n const filenameWithExtension = `${filename}.${extension}`;\n\n const uploadedAssets = await cesdk.unstable_upload(\n new File([blob], filenameWithExtension, { type: blob.type }),\n () => {\n // TODO Delegate process to UI component\n }\n );\n\n const url = uploadedAssets.meta?.uri;\n if (url == null) {\n throw new Error('Could not upload processed fill');\n }\n return url;\n}\n\n/**\n * Returns the file extension for a given mime type.\n */\nexport function mimeTypeToExtension(mimeType: string): string {\n const extensions: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/webp': 'webp',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg'\n };\n return extensions[mimeType] ?? 'png';\n}\n\nexport async function fetchImageBlob(uri: string): Promise<Blob> {\n return fetch(uri).then((response) => response.blob());\n}\n\n/**\n * Converts a buffer URI to a object url.\n */\nexport async function bufferURIToObjectURL(\n uri: string,\n engine: CreativeEngine\n): Promise<string> {\n if (uri.startsWith('buffer:')) {\n const mimeType = await engine.editor.getMimeType(uri);\n const length = engine.editor.getBufferLength(uri);\n const data = engine.editor.getBufferData(uri, 0, length);\n const buffer = new Uint8Array(data);\n const blob = new Blob([buffer], { type: mimeType });\n return URL.createObjectURL(blob);\n } else {\n return uri;\n }\n}\n", "function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\nexport default uuid4;\n", "import { bufferURIToObjectURL } from './upload';\nimport { type CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Get the dimensions of an image from its URL\n *\n * @param url - The URL of the image\n * @returns A promise that resolves to an object containing the width and height of the image\n */\nexport async function getImageDimensionsFromURL(\n url: string,\n engine: CreativeEngine\n): Promise<{ width: number; height: number }> {\n const resolvedUrl = await bufferURIToObjectURL(url, engine);\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n img.src = resolvedUrl;\n });\n}\n\n/**\n * Get the URI of an image from a block ID, either the first source of a source set or\n * the image file URI. Will handle buffer URIs and convert them to object URLs.\n */\nexport async function getImageUri(\n blockId: number,\n engine: CreativeEngine,\n options?: { throwErrorIfSvg?: boolean }\n): Promise<string> {\n let uri;\n const fillBlock = engine.block.getFill(blockId);\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) throw new Error('No image source/uri found');\n } else {\n uri = source.uri;\n }\n\n // Check if the image is SVG (not supported)\n if (options?.throwErrorIfSvg) {\n const mimeType = await engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n }\n\n return bufferURIToObjectURL(uri, engine);\n}\n\n/**\n * Returns if the given fill block is an SVG image fill.\n */\nexport async function isSvgFill(\n fillBlock: number,\n engine: CreativeEngine\n): Promise<boolean> {\n if (engine.block.getType(fillBlock) !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n let uri;\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) return false;\n } else {\n uri = source.uri;\n }\n\n const mimeType = await engine.editor.getMimeType(uri);\n return mimeType === 'image/svg+xml';\n}\n", "/**\n * Checks if a value is defined (not undefined).\n *\n * Helpful to filter out undefined values from an array or collection\n * while keeping the type information intact.\n *\n * ```\n * array.filter(isDefined)\n * ```\n */\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined;\n}\n\nexport default isDefined;\n", "/**\n * Converts a value to an array format.\n *\n * @template T The type of the array elements\n * @param value - The value to convert. Can be a single item, an array, null, or undefined\n * @returns An array containing the value(s). Returns empty array if value is null/undefined,\n * the original array if value is already an array, or a single-element array if value is a single item\n *\n * @example\n * ```typescript\n * toArray('hello') // ['hello']\n * toArray(['a', 'b']) // ['a', 'b']\n * toArray(null) // []\n * toArray(undefined) // []\n * toArray(42) // [42]\n * ```\n */\nfunction toArray<T>(value?: T | T[]): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nexport default toArray;\n", "/**\n * Interface for objects that have translation capabilities\n */\ninterface TranslationAPI {\n translate(key: string | string[]): string;\n}\n\n/**\n * Check if CE.SDK supports the translate API (version 1.59.0 or higher)\n * @param cesdk - The CE.SDK instance to check\n * @returns True if the translate API is supported\n */\nexport function supportsTranslateAPI(cesdk: any): boolean {\n if (!cesdk?.version) return false;\n\n // Use localeCompare for semantic version comparison\n // Returns >= 0 when cesdk.version is 1.59.0 or higher\n const comparison = cesdk.version.localeCompare('1.59.0', undefined, {\n numeric: true,\n sensitivity: 'base'\n });\n\n return comparison >= 0 && typeof cesdk.i18n?.translate === 'function';\n}\n\n/**\n * Type guard to check if an object has the translate API\n * @param i18n - The object to check\n * @returns True if the object has a translate function\n */\nexport function hasTranslateAPI(i18n: any): i18n is TranslationAPI {\n return typeof i18n?.translate === 'function';\n}\n", "import formatsIconSprite from './icons/formats';\n\nconst Icons = {\n Formats: formatsIconSprite\n};\n\nexport { Icons };\n\nexport {\n CustomAssetSource,\n type CustomAssetSourceOptions,\n type SelectValue\n} from './assetSources/CustomAssetSource';\n\nexport { IndexedDBAssetSource } from './assetSources/IndexedDBAssetSource';\n\nexport { AggregatedAssetSource } from './assetSources/AggregatedAssetSource';\n\nexport { default as Metadata } from './metadata/Metadata';\n\nexport { default as FillProcessingMetadata } from './metadata/FillProcessingMetadata';\n\nexport { default as fillProcessing } from './processing/fillProcessing';\n\nexport { default as initializeFillProcessing } from './processing/initializeFillProcessing';\n\nexport { default as registerFillProcessingComponents } from './processing/registerFillProcessingComponents';\n\nexport { type Optional } from './types/Optional';\n\nexport {\n type Location,\n type UserInterfaceConfiguration\n} from './types/UserInterfaceConfiguration';\n\nexport { hexToRgba, isValidHexColor, rgbaToHex } from './utils/colors';\n\nexport {\n uploadBlob,\n fetchImageBlob,\n bufferURIToObjectURL,\n mimeTypeToExtension\n} from './utils/upload';\n\nexport { default as uuid } from './utils/uuid';\n\nexport {\n getImageDimensionsFromURL,\n getImageUri,\n isSvgFill\n} from './utils/images';\n\nexport { default as isDefined } from './utils/isDefined';\n\nexport { default as toArray } from './utils/toArray';\n\nexport { supportsTranslateAPI, hasTranslateAPI } from './translationHelpers';\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { RenderCustomProperty } from '../../core/provider';\nimport { CustomAssetSource, isDefined } from '@imgly/plugin-utils';\nimport { SelectValue } from '@imgly/plugin-utils/dist/assetSources/CustomAssetSource';\n\ntype StyleSelectionPayload = {\n onSelect: (asset: AssetResult) => Promise<void>;\n};\n\ntype Style = {\n id: 'none' | (string & {});\n label: string;\n prompt: string;\n thumbUri: string;\n};\n\n/**\n * Provides render function for a style transfer property that allows\n * to change a style (of an image) from a library.\n *\n * The style will be appended to the prompt property, so the model does\n * not need to support style transfer directly.\n *\n * By default this expects the property key to be `style`. This can be changed with the option\n * `propertyKey`.\n */\nfunction renderStyleTransferProperty(\n providerId: string,\n options: {\n cesdk?: CreativeEditorSDK;\n /**\n * Base URL used for the UI assets used in the plugin.\n */\n baseURL?: string;\n\n /**\n * What property key to use for the style property.\n */\n propertyKey?: string;\n\n /**\n * What property key to use for the prompt property.\n */\n propertyKeyForPrompt?: string;\n\n /**\n * Override the default styles\n */\n styles?: Style[] | ((defaultStyles: Style[]) => Style[]);\n\n /**\n * Overrides the default i18n translations for the prompt input.\n */\n i18n?: {\n prompt?: {\n inputLabel?: string;\n placeholder?: string;\n };\n };\n }\n): RenderCustomProperty {\n const { cesdk } = options;\n if (cesdk == null) return {};\n\n const propertyKey = options.propertyKey ?? 'style';\n const panelIdForStyleSelection = getStyleSelectionPanelId(providerId);\n\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${panelIdForStyleSelection}`]: 'Select Style',\n [`${providerId}.${propertyKey}`]: 'Style'\n }\n });\n\n const defaultStyles = getDefaultStyles({\n baseURL:\n options.baseURL ??\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/',\n includeNone: true\n });\n let styles = defaultStyles;\n if (options.styles != null) {\n if (Array.isArray(options.styles)) {\n styles = options.styles;\n } else if (typeof options.styles === 'function') {\n styles = options.styles(defaultStyles);\n }\n }\n const styleAssetSource = createStyleAssetSource({\n cesdk,\n providerId,\n styles\n });\n const styleAssetSourceId = styleAssetSource.id;\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n createPanels({\n providerId,\n cesdk,\n panelId: panelIdForStyleSelection,\n entryId: styleAssetSourceId\n });\n\n const customProperties: RenderCustomProperty = {\n [options.propertyKeyForPrompt ?? 'prompt']: (context, property) => {\n const promptState = context.state<string>('prompt', '');\n context.builder.TextArea(`${property.id}`, {\n inputLabel:\n options.i18n?.prompt?.inputLabel ??\n options.propertyKeyForPrompt ??\n 'prompt',\n placeholder: options.i18n?.prompt?.placeholder,\n ...promptState\n });\n\n return () => {\n const [activeAssetId] = styleAssetSource.getActiveAssetIds();\n const asset = styleAssetSource.getAsset(activeAssetId);\n return {\n id: property.id,\n type: 'string',\n value:\n asset?.meta?.prompt == null\n ? promptState.value\n : `${promptState.value}; ${asset.meta.prompt}`\n };\n };\n },\n [propertyKey]: (context, property) => {\n const { builder, state } = context;\n\n if (styles.length > 0) {\n const styleState = state<{\n id: string;\n label: string;\n }>('style', styles[0]);\n\n builder.Button(`${property.id}`, {\n inputLabel: `${providerId}.${property.id}`,\n icon: '@imgly/Appearance',\n isDisabled: styles.length === 0,\n trailingIcon: '@imgly/ChevronRight',\n label: styleState.value.label,\n labelAlignment: 'left',\n onClick: () => {\n const payload: StyleSelectionPayload = {\n onSelect: async (asset) => {\n styleAssetSource.clearActiveAssets();\n styleAssetSource.setAssetActive(asset.id);\n styleState.setValue({\n id: asset.id,\n label: asset.label ?? asset.id\n });\n cesdk.ui.closePanel(panelIdForStyleSelection);\n }\n };\n\n cesdk.ui.openPanel(panelIdForStyleSelection, {\n payload\n });\n }\n });\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: styleState.value.id\n };\n };\n }\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: 'none'\n };\n };\n }\n };\n\n return customProperties;\n}\n\nfunction createPanels(options: {\n providerId: string;\n panelId: string;\n entryId: string;\n cesdk?: CreativeEditorSDK;\n}) {\n const { providerId, cesdk, panelId, entryId } = options;\n if (cesdk == null) return;\n\n cesdk.ui.registerPanel<{\n onSelect: (assetResult: AssetResult) => void;\n }>(panelId, ({ builder, payload }) => {\n if (payload?.onSelect == null) {\n builder.Section(`${providerId}.error`, {\n children: () => {\n builder.Text('error', {\n content:\n 'No onSelect function provided for the style selection panel.'\n });\n }\n });\n }\n builder.Library(`${providerId}.library.image`, {\n entries: [entryId],\n onSelect: async (asset) => {\n payload?.onSelect?.(asset);\n }\n });\n });\n}\n\nfunction getStyleSelectionPanelId(providerId: string) {\n return `ly.img.ai.${providerId}.styleSelection`;\n}\n\nconst STYLES: Omit<Style, 'thumbUri'>[] = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\nfunction getDefaultStyles(options: {\n baseURL: string;\n includeNone?: boolean;\n}): Style[] {\n return STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n ...style,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n ...style,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n}\n\nconst createStyleAssetSource = (options: {\n cesdk: CreativeEditorSDK;\n providerId: string;\n styles: Style[];\n}) => {\n const styleValues: SelectValue[] = options.styles.map((style) => {\n return {\n ...style,\n meta: { prompt: style.prompt }\n };\n });\n\n const allSourceIds = options.cesdk.engine.asset.findAllSources();\n let assetSourceId = `${options.providerId}/styles`;\n while (allSourceIds.includes(assetSourceId)) {\n assetSourceId += `-${Math.random().toString(36).substring(2, 5)}`;\n }\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = options.styles[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\nconst addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n\nexport default renderStyleTransferProperty;\n", "import { OutputKind } from '../core/provider';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Integrates the asset sources into the default asset library entry for the\n * given kind.\n */\nfunction integrateIntoDefaultAssetLibraryEntry<K extends OutputKind>(\n kind: K,\n historAssetSourceIds: string[],\n cesdk: CreativeEditorSDK\n): string | undefined {\n const entryId = `ly.img.${kind}`;\n const entry = cesdk.ui.getAssetLibraryEntry(entryId);\n if (entry != null) {\n cesdk.ui.updateAssetLibraryEntry(entryId, {\n sourceIds: [...entry.sourceIds, ...historAssetSourceIds]\n });\n return entry.id;\n }\n}\n\nexport default integrateIntoDefaultAssetLibraryEntry;\n", "import {\n BuilderRenderFunctionContext,\n CreativeEngine,\n SceneMode,\n Scope\n} from '@cesdk/cesdk-js';\nimport { OutputKind, Output } from './provider';\nimport { Result } from '../generation/createGenerateFunction';\n\n/**\n * Base properties shared by all action definitions.\n */\ninterface BaseActionDefinition {\n /** Unique identifier for the action */\n id: string;\n /** Human-readable label for the action */\n label?: string;\n /** Detailed description of what the action does */\n description?: string;\n /** Optional metadata for additional information */\n meta?: Record<string, any>;\n /** The scene mode for which this action is only applicable */\n sceneMode?: SceneMode;\n}\n\n/**\n * Definition for a plugin action - a global action that can be invoked from apps, command palettes, etc.\n */\nexport interface PluginActionDefinition extends BaseActionDefinition {\n /** Action type discriminator */\n type: 'plugin';\n /** ID of the plugin that registered this action */\n pluginId: string;\n /** Function to execute the action */\n execute: () => void;\n}\n\n/**\n * Render context for quick actions with generation capability.\n */\nexport interface QuickActionRenderContext<Q = Record<string, any>> {\n /** Toggle between collapsed and expanded state */\n toggleExpand: () => void;\n /** Whether the quick action is currently expanded */\n isExpanded: boolean;\n /** Close the entire quick action popover */\n close: () => void;\n /** Generate output using the quick action input */\n generate: (\n input: Q,\n options?: { blockIds?: number[] }\n ) => Promise<Result<Output>>;\n /** The ID of the provider used for this quick action */\n providerId: string;\n}\n\n/**\n * Definition for a quick action - a context-sensitive action that operates on selected blocks.\n */\nexport interface QuickActionDefinition<Q extends Record<string, any>>\n extends BaseActionDefinition {\n /** Action type discriminator */\n type: 'quick';\n /** The kind of block this action operates on */\n kind: OutputKind;\n /**\n * Defines if the quick action is enabled or not by using the\n * feature api.\n */\n enable: boolean | ((context: { engine: CreativeEngine }) => boolean);\n /**\n * Define the necessary scopes for this quick action.\n */\n scopes?: Scope[];\n\n /**\n * Overrides the defaults for this quick action.\n */\n defaults?: {\n /** Should the generation be directly applied or does it need confirmation */\n confirmation?: boolean;\n /** Whether the block should be locked */\n lock?: boolean;\n };\n\n /** Render function for the quick action UI */\n render: (\n context: BuilderRenderFunctionContext<any> & QuickActionRenderContext<Q>\n ) => void;\n}\n\n/**\n * Union type of all supported action definitions.\n */\nexport type ActionDefinition =\n | PluginActionDefinition\n | QuickActionDefinition<Record<string, any>>;\n\n/**\n * Event types for ActionRegistry subscriptions.\n */\nexport type ActionRegistryEventType = 'registered' | 'unregistered';\n\n/**\n * Callback function for ActionRegistry subscriptions.\n */\nexport type ActionRegistrySubscriberCallback = (\n action: ActionDefinition,\n event: ActionRegistryEventType\n) => void;\n\n/**\n * Filters for querying and subscribing to specific types of actions.\n * Used by both getBy() and subscribeBy() methods.\n */\nexport interface ActionRegistryFilters {\n /** Filter by action type */\n type?: ActionDefinition['type'];\n /** Filter by plugin ID */\n pluginId?: string;\n /** Filter by action ID */\n id?: string;\n /** Filter by kind (only applicable for quick actions) */\n kind?: OutputKind;\n}\n\n/**\n * Global registry for managing plugin actions and quick actions.\n * Uses singleton pattern to ensure a single source of truth across the application.\n */\nexport class ActionRegistry {\n /** Map storing all registered actions by their ID */\n private actions: Map<string, ActionDefinition> = new Map();\n\n /** Map storing subscribers with their filters (null = subscribe to all) */\n private subscribers: Map<\n ActionRegistrySubscriberCallback,\n ActionRegistryFilters | null\n > = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the ActionRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n * @returns The ActionRegistry instance\n */\n public static get(): ActionRegistry {\n const globalKey = '__imgly_action_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new ActionRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers an action in the registry.\n * @param action The action definition to register\n * @returns A disposer function that unregisters the action when called\n */\n public register(action: ActionDefinition): () => void {\n this.actions.set(action.id, action);\n this.notifySubscribers(action, 'registered');\n\n return () => {\n if (this.actions.get(action.id) === action) {\n this.actions.delete(action.id);\n this.notifySubscribers(action, 'unregistered');\n }\n };\n }\n\n /**\n * Gets all registered actions.\n * @returns Array of all action definitions\n */\n public getAll(): ActionDefinition[] {\n return Array.from(this.actions.values());\n }\n\n /**\n * Gets actions matching the specified filters with full type safety.\n * @param filters Object containing optional filters for type, pluginId, and id\n * @returns Array of matching actions, typed based on the type filter\n * @example\n * // Get all plugin actions\n * registry.getBy({ type: 'plugin' }) // Returns PluginActionDefinition[]\n *\n * // Get all actions from a specific plugin\n * registry.getBy({ pluginId: 'ai-image-generation' }) // Returns ActionDefinition[]\n *\n * // Get specific action by ID\n * registry.getBy({ id: 'generate-image' }) // Returns ActionDefinition[]\n *\n * // Combine filters\n * registry.getBy({ type: 'quick', pluginId: 'ai-text' }) // Returns QuickActionDefinition[]\n *\n * // Filter quick actions by kind\n * registry.getBy({ type: 'quick', kind: 'image' }) // Returns QuickActionDefinition[]\n */\n public getBy<\n T extends ActionDefinition['type'] | undefined = undefined\n >(filters: {\n /** Filter by action type */\n type?: T;\n /** Filter by plugin ID */\n pluginId?: string;\n /** Filter by action ID */\n id?: string;\n /** Filter by kind (only applicable for quick actions) */\n kind?: OutputKind;\n }): T extends ActionDefinition['type']\n ? Extract<ActionDefinition, { type: T }>[]\n : ActionDefinition[] {\n const results = this.getAll().filter((action) =>\n this.matchesFilters(action, filters)\n );\n\n return results as T extends ActionDefinition['type']\n ? Extract<ActionDefinition, { type: T }>[]\n : ActionDefinition[];\n }\n\n /**\n * Subscribes to all registry events (register/unregister).\n * @param callback Function to call when any action is registered or unregistered\n * @returns Unsubscribe function\n */\n public subscribe(callback: ActionRegistrySubscriberCallback): () => void {\n this.subscribers.set(callback, null);\n return () => {\n this.subscribers.delete(callback);\n };\n }\n\n /**\n * Subscribes to registry events for actions matching the specified filters.\n * @param filters Filters to match actions against\n * @param callback Function to call when matching actions are registered or unregistered\n * @returns Unsubscribe function\n * @example\n * // Subscribe to plugin actions only\n * registry.subscribeBy({ type: 'plugin' }, (action, event) => {\n * console.log(`Plugin action ${action.id} was ${event}`);\n * });\n *\n * // Subscribe to actions from specific plugin\n * registry.subscribeBy({ pluginId: 'ai-image' }, (action, event) => {\n * updateUIForPlugin(action, event);\n * });\n */\n public subscribeBy(\n filters: ActionRegistryFilters,\n callback: ActionRegistrySubscriberCallback\n ): () => void {\n this.subscribers.set(callback, filters);\n return () => {\n this.subscribers.delete(callback);\n };\n }\n\n /**\n * Notifies all relevant subscribers about an action event.\n * @param action The action that was registered or unregistered\n * @param event The type of event that occurred\n */\n private notifySubscribers(\n action: ActionDefinition,\n event: ActionRegistryEventType\n ): void {\n this.subscribers.forEach((filters, callback) => {\n // If no filters (null), notify for all actions\n if (filters === null) {\n callback(action, event);\n return;\n }\n\n // Check if action matches the filters\n if (this.matchesFilters(action, filters)) {\n callback(action, event);\n }\n });\n }\n\n /**\n * Checks if an action matches the given filters.\n * Used by both getBy() and subscribeBy() methods.\n * @param action The action to check\n * @param filters The filters to match against\n * @returns True if the action matches all filters\n */\n private matchesFilters(\n action: ActionDefinition,\n filters: ActionRegistryFilters\n ): boolean {\n if (filters.type && action.type !== filters.type) return false;\n if (\n filters.pluginId &&\n action.type === 'plugin' &&\n action.pluginId !== filters.pluginId\n )\n return false;\n if (filters.id && action.id !== filters.id) return false;\n if (filters.kind) {\n // Kind filter only applies to quick actions\n if (action.type !== 'quick') return false;\n if (action.kind !== filters.kind) return false;\n }\n return true;\n }\n}\n", "import { ProviderInitializationResult } from '../providers/initializeProvider';\nimport { OutputKind } from './provider';\n\n/**\n * Global registry for managing AI generation providers across all plugins.\n * Uses singleton pattern to ensure cross-plugin provider discovery.\n */\nexport class ProviderRegistry {\n /** Map storing all registered providers by their ID */\n private providers: Map<string, ProviderInitializationResult<any, any, any>> =\n new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the ProviderRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n * @returns The ProviderRegistry instance\n */\n public static get(): ProviderRegistry {\n const globalKey = '__imgly_provider_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new ProviderRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers a provider in the registry.\n * @param providerInitializationResult The provider to register\n * @returns A disposer function that unregisters the provider when called\n */\n public register(\n providerInitializationResult: ProviderInitializationResult<any, any, any>\n ): () => void {\n if (this.providers.has(providerInitializationResult.provider.id)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Provider with ID \"${providerInitializationResult.provider.id}\" is already registered`\n );\n }\n\n this.providers.set(\n providerInitializationResult.provider.id,\n providerInitializationResult\n );\n\n return () => {\n if (\n this.providers.get(providerInitializationResult.provider.id) ===\n providerInitializationResult\n ) {\n this.providers.delete(providerInitializationResult.provider.id);\n }\n };\n }\n\n /**\n * Gets all registered providers.\n * @returns Array of all provider instances\n */\n public getAll(): ProviderInitializationResult<any, any, any>[] {\n return Array.from(this.providers.values());\n }\n\n /**\n * Gets a provider by its ID.\n * @param id The provider ID to look up\n * @returns The provider instance or undefined if not found\n */\n public getById(\n id: string\n ): ProviderInitializationResult<any, any, any> | undefined {\n return this.providers.get(id);\n }\n\n /**\n * Gets all providers of a specific kind.\n * @param kind The output kind to filter by\n * @returns Array of providers matching the specified kind\n */\n public getByKind<K extends OutputKind>(\n kind: K\n ): ProviderInitializationResult<K, any, any>[] {\n return this.getAll().filter(({ provider }) => provider.kind === kind);\n }\n}\n", "import { GenerationOptions, GenerationResult, Output } from '../core/provider';\n\n/**\n * Result of the generation with a dispose function to clean up\n */\nexport interface DisposableGenerationResult<O extends Output> {\n /**\n * The actual generation result\n */\n result: GenerationResult<O>;\n\n /**\n * Function to dispose/clean up resources created during generation\n * This should be called when the generation is cancelled or completely\n * finished including the confirmation of the generation if applicable.\n */\n dispose: () => Promise<void>;\n}\n\n/**\n * Define the type for middleware functions\n */\nexport type Middleware<I, O extends Output> = (\n input: I,\n options: GenerationOptions & {\n /**\n * The block ids the generation is applied on\n * If this value is undefined, the selected blocks will be used.\n * Setting this value to null will explicitly tell every\n * middleware that no block shall be used.\n */\n blockIds?: number[] | null;\n\n /**\n * Adds a disposer function to this genereation which is called\n * when the generation is cancelled or completely finished\n * including the confirmation of the generation if applicable.\n */\n addDisposer: (dispose: () => Promise<void>) => void;\n },\n next: (input: I, options: GenerationOptions) => Promise<GenerationResult<O>>\n) => Promise<GenerationResult<O>>;\n\nexport function composeMiddlewares<I, O extends Output>(\n middlewares: (Middleware<I, O> | false | undefined | null)[]\n) {\n // Filter out false, undefined, and null middlewares\n const validMiddlewares = middlewares.filter(\n (middleware): middleware is Middleware<I, O> => !!middleware\n );\n // Start with the base handler\n return (\n baseHandler: (\n input: I,\n options: GenerationOptions\n ) => Promise<GenerationResult<O>>\n ) => {\n // We need to build a chain where each step is a function with the signature:\n // (input, options) => Promise<Result>\n\n // The composed function that will be returned\n return async (\n input: I,\n options: GenerationOptions\n ): Promise<DisposableGenerationResult<O>> => {\n // Store disposer functions that will be called when dispose() is called\n const disposers: Array<() => Promise<void>> = [];\n\n // Function to add a disposer\n const addDisposer = (dispose: () => Promise<void>) => {\n disposers.push(dispose);\n };\n\n // Define a function to process each middleware in sequence\n const runMiddleware = async (\n index: number,\n currentInput: I,\n currentOptions: GenerationOptions\n ): Promise<GenerationResult<O>> => {\n // If we've processed all middlewares, call the base handler\n if (index >= validMiddlewares.length) {\n return baseHandler(currentInput, currentOptions);\n }\n\n // Get the current middleware\n const currentMiddleware = validMiddlewares[index];\n\n // Create a next function for this middleware that calls the next middleware in line\n const next = async (\n nextInput: I,\n nextOptions: GenerationOptions\n ): Promise<GenerationResult<O>> => {\n return runMiddleware(index + 1, nextInput, nextOptions);\n };\n\n // Enhanced options with addDisposer\n const enhancedOptions = {\n ...currentOptions,\n addDisposer\n };\n\n // Call the current middleware with the input, enhanced options, and next function\n return currentMiddleware(currentInput, enhancedOptions, next);\n };\n\n // Create enhanced options with addDisposer for base handler as well\n const enhancedOptions = {\n ...options,\n addDisposer\n };\n\n // Run the middleware chain\n const result = await runMiddleware(0, input, enhancedOptions);\n\n // Create the dispose function that will call all collected disposers in reverse order\n const dispose = async (): Promise<void> => {\n // Execute disposers in reverse order (last added, first disposed)\n /* eslint-disable no-await-in-loop */\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n await disposers[i]();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error in disposer:', error);\n }\n }\n // Clear the disposers array after all are executed\n disposers.length = 0;\n };\n\n // Return both the result and the dispose function\n return {\n result,\n dispose\n };\n };\n };\n}\n", "/* eslint-disable no-console */\nimport { GenerationResult, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\nfunction loggingMiddleware<I, O extends Output>({\n enable = true\n}: {\n enable: boolean | undefined;\n}) {\n const middleware: Middleware<I, O> = async (input, options, next) => {\n if (!enable) return next(input, options);\n\n console.group('[GENERATION]');\n console.log(`Generating with input:`, JSON.stringify(input, null, 2));\n let result: GenerationResult<O> | undefined;\n const start = Date.now();\n try {\n result = await next(input, options);\n return result;\n } finally {\n if (result != null) {\n console.log(`Generation took ${Date.now() - start}ms`);\n console.log(`Generation result:`, JSON.stringify(result, null, 2));\n }\n console.groupEnd();\n }\n };\n\n return middleware;\n}\n\nexport default loggingMiddleware;\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { GenerationResult, Output } from '../core/provider';\n\nexport const AI_PANEL_ID_PREFIX = 'ly.img.ai';\n\nconst TEMP_ASSET_SOURCE_ID = 'ly.img.ai.temp';\n\n/**\n * Adding asset to the scene.\n *\n * NOTE: Will use a temporary asset source so that\n * our asset source middleware trigger. This is necessary since there is\n * a lot of extra logic in the video middlewares regarding trim, position etc.\n *\n * These will only trigger via an asset source, not by calling\n * `defaultApplyAsset` directly.\n */\nexport async function addAssetToScene(\n cesdk: CreativeEditorSDK,\n assetResult: AssetResult\n) {\n if (!cesdk.engine.asset.findAllSources().includes(TEMP_ASSET_SOURCE_ID)) {\n cesdk.engine.asset.addLocalSource(TEMP_ASSET_SOURCE_ID);\n }\n\n return cesdk.engine.asset.apply(TEMP_ASSET_SOURCE_ID, assetResult);\n}\n\n/**\n * Returns a consistent panel ID for a provider ID\n */\nexport function getPanelId(providerId: string): string {\n return `${AI_PANEL_ID_PREFIX}.${providerId}`;\n}\n\nexport default getPanelId;\n/**\n * Extracts a readable error message from an unknown error\n *\n * @param error The error caught in a try/catch block\n * @param fallbackMessage Optional fallback message if error is not an Error object\n * @returns A string representation of the error\n */\nexport function extractErrorMessage(\n error: unknown,\n fallbackMessage = 'We encountered an unknown error while generating the asset. Please try again.'\n): string {\n if (error === null) {\n return fallbackMessage;\n }\n\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === 'object') {\n // Try to get message property if it exists\n const errorObj = error as Record<string, unknown>;\n if ('message' in errorObj && typeof errorObj.message === 'string') {\n return errorObj.message;\n }\n if ('cause' in errorObj && typeof errorObj.cause === 'string') {\n return errorObj.cause;\n }\n\n /*\n * Elevenlabs for instance uses the following structure for errors:\n * {\n * \"detail\": {\n * \"status\": \"error_code\",\n * \"message\": \"Explanation of the rate limit issue.\"\n * }\n * }\n */\n if (\n 'detail' in errorObj &&\n typeof errorObj.detail === 'object' &&\n errorObj.detail !== null &&\n 'message' in errorObj.detail &&\n typeof errorObj.detail.message === 'string'\n ) {\n return errorObj.detail.message;\n }\n\n /*\n * Used by e.g. Anthropic\n */\n if (\n 'error' in errorObj &&\n typeof errorObj.error === 'object' &&\n errorObj.error !== null &&\n 'message' in errorObj.error &&\n typeof errorObj.error.message === 'string'\n ) {\n return errorObj.error.message;\n }\n\n return fallbackMessage;\n }\n\n if (typeof error === 'string') {\n return error;\n }\n\n // For any other type, convert to string\n return String(error) || fallbackMessage;\n}\n\n/**\n * Generates a random UUID v4\n */\nexport function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\n/**\n * Gets the duration of a video from a URL\n * @param url - The URL of the video\n * @returns A promise that resolves to the duration of the video in seconds\n */\nexport function getDurationForVideo(url: string): Promise<number> {\n return new Promise((resolve, reject) => {\n try {\n const video = document.createElement('video');\n video.style.display = 'none';\n\n // Set up event handlers\n video.addEventListener('loadedmetadata', () => {\n if (video.duration === Infinity) {\n // Some videos might initially report Infinity\n video.currentTime = 1e101;\n // Wait for currentTime to update\n setTimeout(() => {\n video.currentTime = 0;\n resolve(video.duration);\n document.body.removeChild(video);\n }, 50);\n } else {\n resolve(video.duration);\n document.body.removeChild(video);\n }\n });\n\n video.addEventListener('error', () => {\n document.body.removeChild(video);\n reject(new Error(`Failed to load video from ${url}`));\n });\n\n // Set source and begin loading\n video.src = url;\n document.body.appendChild(video);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Gets a thumbnail image from a video URL\n * @param url - The URL of the video\n * @param seekTime - Time in seconds to capture the thumbnail (default: 0)\n * @param format - Image format for the thumbnail (default: 'image/jpeg')\n * @param quality - Image quality between 0 and 1 (default: 0.8)\n * @returns A promise that resolves to the thumbnail data URL\n */\nexport function getThumbnailForVideo(\n url: string,\n seekTime = 0,\n format = 'image/jpeg',\n quality = 0.8\n): Promise<string> {\n return new Promise((resolve, reject) => {\n try {\n const video = document.createElement('video');\n // Set crossOrigin to anonymous to prevent tainted canvas issues\n video.crossOrigin = 'anonymous';\n video.style.display = 'none';\n\n // Set up event handlers\n video.addEventListener('loadedmetadata', () => {\n // Seek to the specified time\n video.currentTime = Math.min(seekTime, video.duration);\n\n video.addEventListener(\n 'seeked',\n () => {\n // Create a canvas to draw the video frame\n const canvas = document.createElement('canvas');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n // Draw the video frame to the canvas\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n document.body.removeChild(video);\n reject(new Error('Failed to create canvas context'));\n return;\n }\n\n ctx.drawImage(video, 0, 0, canvas.width, canvas.height);\n\n try {\n // Convert canvas to data URL\n const dataURL = canvas.toDataURL(format, quality);\n // Clean up\n document.body.removeChild(video);\n resolve(dataURL);\n } catch (e) {\n document.body.removeChild(video);\n reject(\n new Error(\n `Failed to create thumbnail: ${\n e instanceof Error ? e.message : String(e)\n }`\n )\n );\n }\n },\n { once: true }\n );\n });\n\n video.addEventListener('error', () => {\n document.body.removeChild(video);\n reject(new Error(`Failed to load video from ${url}`));\n });\n\n // Set source and begin loading\n video.src = url;\n document.body.appendChild(video);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Converts an ID string to a human-readable label\n * @param id - The ID string to convert\n * @returns A human-readable label derived from the ID\n *\n * Examples:\n * - snake_case_id \u2192 Snake Case Id\n * - kebab-case-id \u2192 Kebab Case Id\n * - camelCaseId \u2192 Camel Case Id\n * - PascalCaseId \u2192 Pascal Case Id\n */\nexport function getLabelFromId(id: string): string {\n if (!id) return '';\n\n // Handle snake_case, kebab-case, camelCase, and PascalCase\n return (\n id\n // Replace underscores and hyphens with spaces (for snake_case and kebab-case)\n .replace(/[_-]/g, ' ')\n // Add spaces before uppercase letters (for camelCase and PascalCase)\n .replace(/([A-Z])/g, ' $1')\n // Trim any extra spaces and ensure first letter is capitalized\n .trim()\n .split(' ')\n .filter((word) => word.length > 0) // Remove empty strings from multiple spaces\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n );\n}\n\n/**\n * Type guard to check if a value is an AsyncGenerator rather than a Promise\n *\n * @param value - Value of type Promise<O> | AsyncGenerator<O, C>\n * @returns Boolean indicating if the value is an AsyncGenerator\n */\nexport function isAsyncGenerator<O extends Output, C>(\n value: GenerationResult<O, C>\n): value is AsyncGenerator<O, C> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'next' in value &&\n 'return' in value &&\n 'throw' in value &&\n typeof value.next === 'function' &&\n typeof value.return === 'function' &&\n typeof value.throw === 'function' &&\n Symbol.asyncIterator in value &&\n typeof value[Symbol.asyncIterator] === 'function'\n );\n}\n\nexport function isAbortError(error: unknown): error is Error {\n return error instanceof Error && error.name === 'AbortError';\n}\n\n/**\n * Adds an icon set to the CreativeEditorSDK UI only once. Marks\n * it as added in the global state to prevent multiple additions.\n */\nexport function addIconSetOnce(\n cesdk: CreativeEditorSDK,\n id: string,\n icons: string\n): void {\n const globalStateIconSetAddedId = `${id}.iconSetAdded`;\n if (!cesdk.ui.experimental.hasGlobalStateValue(globalStateIconSetAddedId)) {\n cesdk.ui.addIconSet(id, icons);\n cesdk.ui.experimental.setGlobalStateValue(globalStateIconSetAddedId, true);\n }\n}\n", "import { isAsyncGenerator } from '../utils/utils';\nimport { GenerationResult, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\n/**\n * Middleware to upload the output of a generation process.\n *\n * Sometimes it is not possible to use the result of a provider or\n * not even allowed to use it directly. This middleware allows you to upload\n * the result of a generation process to a server or a cloud storage.\n *\n * @param upload The function to upload the output. It should return a promise\n */\nfunction uploadMiddleware<I, O extends Output>(\n upload: (output: O) => Promise<O>\n) {\n const middleware: Middleware<I, O> = async (input, options, next) => {\n const result: GenerationResult<O> | undefined = await next(input, options);\n if (isAsyncGenerator(result)) {\n // No reupload needed, just return the async generator\n return result;\n }\n\n const uploaded = await upload(result);\n return uploaded;\n };\n\n return middleware;\n}\n\nexport default uploadMiddleware;\n", "/**\n * Merge quick actions configuration by combining provider defaults with user configuration overrides\n *\n * @param providerDefaults - The default quick actions from the provider\n * @param userConfig - The user's configuration overrides\n * @returns Merged quick actions configuration\n */\nexport function mergeQuickActionsConfig<T extends Record<string, any>>(\n providerDefaults: T,\n userConfig?: {\n [quickActionId: string]: any | false | null;\n }\n): T {\n // Always return a copy to avoid mutating the original\n const result: any = { ...providerDefaults };\n\n if (!userConfig) return result as T;\n\n for (const [actionId, config] of Object.entries(userConfig)) {\n if (config === false || config === null || config === undefined) {\n // Remove the quick action\n delete result[actionId];\n } else if (config === true) {\n // Keep provider's default if it exists, otherwise add true\n if (!(actionId in providerDefaults)) {\n result[actionId] = true;\n }\n // If it exists in defaults, we already have it from the spread above\n } else {\n // Override with user configuration\n result[actionId] = config;\n }\n }\n\n return result as T;\n}\n", "import { GenerationOptions, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\nexport interface RateLimitOptions<I> {\n /**\n * Maximum number of requests allowed in the time window\n */\n maxRequests: number;\n\n /**\n * Time window in milliseconds\n */\n timeWindowMs: number;\n\n /**\n * Optional key function or string to create different rate limits for different inputs\n * - If not provided, all requests share the same 'global' rate limit\n * - If a string is provided, that string is used as a static key\n * - If a function is provided, it generates a key based on input and options\n */\n keyFn?: string | ((input: I, options: GenerationOptions) => string);\n\n /**\n * Callback function that is called when rate limit is exceeded\n * Return value determines if the operation should be rejected (throw error) or allowed\n * If true is returned, the operation will proceed despite exceeding the rate limit\n * If false or undefined is returned, the operation will be rejected with a default error\n */\n onRateLimitExceeded?: (\n input: I,\n options: GenerationOptions,\n rateLimitInfo: {\n key: string;\n currentCount: number;\n maxRequests: number;\n timeWindowMs: number;\n remainingTimeMs: number;\n }\n ) => boolean | Promise<boolean> | void;\n\n /**\n * Optional database name for the IndexedDB store\n * If not provided, a default name will be used\n */\n dbName?: string;\n\n /**\n * Disable the rate limit middleware\n */\n disable?: boolean | (() => boolean);\n}\n\n// Store for tracking requests per key\ninterface RequestTracker {\n timestamps: number[];\n lastCleanup: number;\n}\n\n// In-memory fallback store for rate limits for environments without IndexedDB\n// Export for testing purposes\n// This is now a Map of middleware instances to their respective stores\n// The key can be either a symbol (for unique instances with prefix) or a string (for shared instances without prefix)\nexport const inMemoryStores: Map<\n symbol | string,\n Record<string, RequestTracker>\n> = new Map();\n\n/**\n * IndexedDB store for rate limiting\n */\nclass RateLimitStore {\n private db: IDBDatabase | null = null;\n\n private readonly dbName: string;\n\n private readonly storeName: string;\n\n private readonly dbVersion: number = 1;\n\n private isInitializing: boolean = false;\n\n private initPromise: Promise<void> | null = null;\n\n private readonly instanceId: symbol | string;\n\n constructor(\n instanceId: symbol | string,\n dbName?: string,\n storeName?: string\n ) {\n this.instanceId = instanceId;\n this.dbName = dbName ?? 'ly.img.ai.rateLimit';\n this.storeName = storeName ?? 'rateLimits';\n }\n\n /**\n * Initialize the database connection\n */\n async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n if (this.isInitializing) {\n return this.initPromise!;\n }\n\n this.isInitializing = true;\n this.initPromise = new Promise<void>((resolve, reject) => {\n try {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n this.isInitializing = false;\n\n // eslint-disable-next-line no-console\n console.error('Failed to open IndexedDB for rate limiting:', event);\n reject(new Error('Failed to open IndexedDB for rate limiting'));\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName, { keyPath: 'id' });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n this.isInitializing = false;\n resolve();\n };\n } catch (error) {\n this.isInitializing = false;\n // eslint-disable-next-line no-console\n console.error('Error initializing IndexedDB:', error);\n reject(error);\n }\n });\n\n return this.initPromise;\n }\n\n /**\n * Get a request tracker by key\n */\n async getTracker(key: string): Promise<RequestTracker | null> {\n try {\n await this.initialize();\n\n // Create a combined key that includes the instance ID to ensure isolation\n const instanceIdStr =\n typeof this.instanceId === 'symbol'\n ? this.instanceId.description || ''\n : this.instanceId;\n const combinedKey = `${instanceIdStr}_${key}`;\n\n return await new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.storeName, 'readonly');\n const store = transaction.objectStore(this.storeName);\n const request = store.get(combinedKey);\n\n request.onsuccess = () => {\n if (request.result) {\n resolve(request.result.data);\n } else {\n resolve(null);\n }\n };\n\n request.onerror = () => {\n // eslint-disable-next-line no-console\n console.error(\n `Failed to get tracker for key ${combinedKey}:`,\n request.error\n );\n reject(request.error);\n };\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error getting tracker from IndexedDB:', error);\n return Promise.reject(error);\n }\n }\n\n /**\n * Save a request tracker by key\n */\n async saveTracker(key: string, tracker: RequestTracker): Promise<void> {\n try {\n await this.initialize();\n\n // Create a combined key that includes the instance ID to ensure isolation\n const instanceIdStr =\n typeof this.instanceId === 'symbol'\n ? this.instanceId.description || ''\n : this.instanceId;\n const combinedKey = `${instanceIdStr}_${key}`;\n\n return await new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.storeName, 'readwrite');\n const store = transaction.objectStore(this.storeName);\n store.put({ id: combinedKey, data: tracker });\n\n transaction.oncomplete = () => {\n resolve();\n };\n\n transaction.onerror = () => {\n // eslint-disable-next-line no-console\n console.error(\n `Failed to save tracker for key ${combinedKey}:`,\n transaction.error\n );\n reject(transaction.error);\n };\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error saving tracker to IndexedDB:', error);\n return Promise.reject(error);\n }\n }\n\n /**\n * Check if IndexedDB is available\n */\n static isAvailable(): boolean {\n return typeof indexedDB !== 'undefined';\n }\n\n /**\n * Close the database connection\n */\n close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n}\n\n/**\n * Middleware that implements rate limiting for AI generation requests\n * Uses IndexedDB for storage when available, with in-memory fallback\n * Each middleware instance has its own isolated set of rate limits\n */\nfunction rateLimitMiddleware<I, O extends Output>(\n middlewareOptions: RateLimitOptions<I>\n) {\n const {\n maxRequests,\n timeWindowMs,\n keyFn = () => 'global',\n onRateLimitExceeded,\n dbName\n } = middlewareOptions;\n\n // Create an identifier for this middleware instance based on its configuration\n // This ensures persistence across page reloads and sharing between identical configurations\n const configStr = `rate-limit-middleware-${maxRequests}-${timeWindowMs}`;\n\n // Use a string key for the configuration so identical configurations share the same limits\n const instanceId = configStr;\n\n // Create the store with the instance ID\n const useIndexedDB = RateLimitStore.isAvailable();\n const store = useIndexedDB ? new RateLimitStore(instanceId, dbName) : null;\n\n // Initialize this middleware's in-memory store\n if (!inMemoryStores.has(instanceId)) {\n inMemoryStores.set(instanceId, {});\n }\n // Get this middleware's in-memory store\n const inMemoryStore = inMemoryStores.get(instanceId)!;\n\n const middleware: Middleware<I, O> = async (input, options, next) => {\n if (\n typeof middlewareOptions.disable === 'function'\n ? middlewareOptions.disable()\n : middlewareOptions.disable\n ) {\n return next(input, options);\n }\n // Get rate limit key based on input using the provided keyFn\n // If keyFn is a string, use it directly; otherwise call the function\n const key = typeof keyFn === 'string' ? keyFn : keyFn(input, options);\n const now = Date.now();\n\n let tracker: RequestTracker;\n\n // Get tracker from IndexedDB or create a new one\n if (useIndexedDB && store) {\n try {\n const storedTracker = await store.getTracker(key);\n if (storedTracker) {\n tracker = storedTracker;\n } else {\n tracker = {\n timestamps: [],\n lastCleanup: now\n };\n }\n } catch (error) {\n // Fallback to in-memory store if IndexedDB fails\n // eslint-disable-next-line no-console\n console.error(\n 'IndexedDB access failed, using in-memory fallback:',\n error\n );\n if (!inMemoryStore[key]) {\n inMemoryStore[key] = {\n timestamps: [],\n lastCleanup: now\n };\n }\n tracker = inMemoryStore[key];\n }\n } else {\n // Use in-memory store if IndexedDB is not available\n if (!inMemoryStore[key]) {\n inMemoryStore[key] = {\n timestamps: [],\n lastCleanup: now\n };\n }\n tracker = inMemoryStore[key];\n }\n\n // Clean up old timestamps that are outside the time window\n if (now - tracker.lastCleanup > timeWindowMs) {\n tracker.timestamps = tracker.timestamps.filter(\n (timestamp) => now - timestamp < timeWindowMs\n );\n tracker.lastCleanup = now;\n }\n\n // Check if rate limit is exceeded\n if (tracker.timestamps.length >= maxRequests) {\n // Calculate the time until the oldest request expires\n const oldestTimestamp = Math.min(...tracker.timestamps);\n const remainingTimeMs = Math.max(\n 0,\n timeWindowMs - (now - oldestTimestamp)\n );\n\n // Call the rate limit exceeded callback if provided\n if (onRateLimitExceeded) {\n const rateLimitInfo = {\n key, // This is the baseKey from keyFn\n currentCount: tracker.timestamps.length,\n maxRequests,\n timeWindowMs,\n remainingTimeMs\n };\n\n // If callback returns true, allow the request to proceed\n const shouldProceed = await onRateLimitExceeded(\n input,\n options,\n rateLimitInfo\n );\n if (!shouldProceed) {\n // The callback should indicate the error, so we throw\n // an abort error instead of a generic error to indicate\n // the generation was aborted and we do not show any further\n // error notification.\n throw new DOMException(\n 'Operation aborted: Rate limit exceeded',\n 'AbortError'\n );\n }\n } else {\n // Default behavior: throw an error\n throw new Error('Rate limit exceeded. Please try again later.');\n }\n }\n\n // Add current timestamp to the tracker\n tracker.timestamps.push(now);\n\n // Save the updated tracker\n if (useIndexedDB && store) {\n try {\n await store.saveTracker(key, tracker);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to save tracker to IndexedDB:', error);\n // In case of IndexedDB failure, update the in-memory store as fallback\n inMemoryStore[key] = tracker;\n }\n } else {\n inMemoryStore[key] = tracker;\n }\n\n // Continue with the next middleware\n return next(input, options);\n };\n\n return middleware;\n}\n\nexport default rateLimitMiddleware;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Checks if the current AI plugin version matches the shared version across all AI plugins.\n * Issues a console warning if versions don't match.\n *\n * @param cesdk - The CreativeEditorSDK instance\n * @param pluginId - The ID of the current plugin\n * @param currentVersion - The version of the current plugin\n */\nexport function checkAiPluginVersion(\n cesdk: CreativeEditorSDK,\n pluginId: string,\n currentVersion: string\n): void {\n const AI_PLUGIN_VERSION_KEY = 'ai-plugin-version';\n const AI_PLUGIN_VERSION_WARNING_KEY = 'ai-plugin-version-warning-shown';\n\n try {\n const sharedVersion = cesdk.ui.experimental.getGlobalStateValue<string>(\n AI_PLUGIN_VERSION_KEY\n );\n\n if (!sharedVersion) {\n // First AI plugin sets the shared version\n cesdk.ui.experimental.setGlobalStateValue(\n AI_PLUGIN_VERSION_KEY,\n currentVersion\n );\n } else if (sharedVersion !== currentVersion) {\n // Version mismatch detected\n const warningShown = cesdk.ui.experimental.getGlobalStateValue<boolean>(\n AI_PLUGIN_VERSION_WARNING_KEY,\n false\n );\n\n if (!warningShown) {\n // eslint-disable-next-line no-console\n console.warn(\n `[IMG.LY AI Plugins] Version mismatch detected!\\n` +\n `Plugin \"${pluginId}\" is using version ${currentVersion}, but other AI plugins are using version ${sharedVersion}.\\n` +\n `This may cause compatibility issues. Please ensure all AI plugins (@imgly/plugin-ai-*) use the same version.\\n` +\n `Consider updating all AI plugins to the same version for optimal compatibility.`\n );\n\n // Set flag to prevent duplicate warnings\n cesdk.ui.experimental.setGlobalStateValue(\n AI_PLUGIN_VERSION_WARNING_KEY,\n true\n );\n }\n }\n } catch (error) {\n // Fail silently if global state access fails\n // eslint-disable-next-line no-console\n console.debug(\n '[IMG.LY AI Plugins] Could not check plugin version consistency:',\n error\n );\n }\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Registers a dock component for AI generation that opens\n * the AI generation panel and closes any other AI panels.\n */\nfunction registerDockComponent(options: {\n cesdk: CreativeEditorSDK;\n panelId: string;\n}) {\n const { cesdk, panelId } = options;\n if (!panelId.startsWith('ly.img.ai.')) {\n // eslint-disable-next-line no-console\n console.warn(\n `Dock components for AI generation should open a panel with an id starting with \"ly.img.ai.\" \u2013 \"${panelId}\" was provided.`\n );\n }\n\n const dockComponentId = `${panelId}.dock`;\n cesdk.ui.registerComponent(dockComponentId, ({ builder }) => {\n const isOpen = cesdk.ui.isPanelOpen(panelId);\n\n builder.Button(`${panelId}.dock.button`, {\n label: `${panelId}.dock.label`,\n isSelected: isOpen,\n icon: '@imgly/Sparkle',\n onClick: () => {\n cesdk.ui.findAllPanels().forEach((panel) => {\n if (panel.startsWith('ly.img.ai.')) {\n cesdk.ui.closePanel(panel);\n }\n if (!isOpen && panel === '//ly.img.panel/assetLibrary') {\n cesdk.ui.closePanel(panel);\n }\n });\n\n if (!isOpen) {\n cesdk.ui.openPanel(panelId);\n } else {\n cesdk.ui.closePanel(panelId);\n }\n }\n });\n });\n}\n\nexport default registerDockComponent;\n", "import type CreativeEngine from '@cesdk/engine';\n\n/**\n * Enable function for a single image fill block selected.\n */\nfunction enableImageFill() {\n return ({ engine }: { engine: CreativeEngine }) => {\n const blockIds = engine.block.findAllSelected();\n if (blockIds == null || blockIds.length !== 1) return false;\n\n const [blockId] = blockIds;\n\n if (!engine.block.supportsFill(blockId)) return false;\n\n if (engine.block.getKind(blockId) === 'sticker') return false;\n\n if (\n !['//ly.img.ubq/graphic', '//ly.img.ubq/page'].includes(\n engine.block.getType(blockId)\n )\n ) {\n return false;\n }\n\n const fillBlock = engine.block.getFill(blockId);\n return engine.block.getType(fillBlock) === '//ly.img.ubq/fill/image';\n };\n}\n\nexport default enableImageFill;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport Provider, { GetInput, Output, OutputKind } from '../core/provider';\nimport { extractErrorMessage } from '../utils/utils';\n\nfunction handleGenerationError<K extends OutputKind, I, O extends Output>(\n error: unknown,\n options: {\n cesdk: CreativeEditorSDK;\n provider: Provider<K, I, O>;\n getInput?: GetInput<I>;\n }\n) {\n const { cesdk, provider, getInput } = options;\n\n // eslint-disable-next-line no-console\n console.error('Generation failed:', error);\n const shown = showErrorNotification(\n cesdk,\n provider.output.notification,\n () => ({\n input: getInput?.().input,\n error\n })\n );\n if (!shown) {\n cesdk.ui.showNotification({\n type: 'error',\n message: extractErrorMessage(error)\n });\n }\n}\n\nfunction showErrorNotification<I, O extends Output>(\n cesdk: CreativeEditorSDK,\n notifications: Provider<any, I, O>['output']['notification'],\n createContext: () => { input?: I; error: unknown }\n): boolean {\n const errorNotification = notifications?.error;\n if (errorNotification == null) return false;\n\n const showOnSuccess =\n typeof errorNotification.show === 'function'\n ? errorNotification.show(createContext())\n : errorNotification.show;\n\n if (!showOnSuccess) return false;\n\n const message =\n typeof errorNotification.message === 'function'\n ? errorNotification.message(createContext())\n : errorNotification.message ?? 'common.ai-generation.failed';\n\n const action =\n errorNotification.action != null\n ? {\n label:\n typeof errorNotification.action.label === 'function'\n ? errorNotification.action.label(createContext())\n : errorNotification.action.label,\n onClick: () => {\n errorNotification?.action?.onClick(createContext());\n }\n }\n : undefined;\n\n cesdk.ui.showNotification({\n type: 'error',\n message,\n action\n });\n return true;\n}\n\nexport default handleGenerationError;\n", "const previewUri =\n 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIzIiBoZWlnaHQ9IjMyMyIgdmlld0JveD0iMCAwIDMyMyAzMjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIzMjMiIGhlaWdodD0iMzIzIiBmaWxsPSIjRTlFQkVEIi8+CjxnIG9wYWNpdHk9IjAuMyI+CjxwYXRoIGQ9Ik0xMTYgMTg0VjE5MS41QzExNiAxOTkuNzg0IDEyMi43MTYgMjA2LjUgMTMxIDIwNi41SDE5MUMxOTkuMjg0IDIwNi41IDIwNiAxOTkuNzg0IDIwNiAxOTEuNVYxMzEuNUMyMDYgMTIzLjIxNiAxOTkuMjg0IDExNi41IDE5MSAxMTYuNUwxOTAuOTk1IDEyNi41QzE5My43NTcgMTI2LjUgMTk2IDEyOC43MzkgMTk2IDEzMS41VjE5MS41QzE5NiAxOTQuMjYxIDE5My43NjEgMTk2LjUgMTkxIDE5Ni41SDEzMUMxMjguMjM5IDE5Ni41IDEyNiAxOTQuMjYxIDEyNiAxOTEuNVYxODRIMTE2WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTY2LjQ5NCAxMDUuOTI0QzE2NS44NjkgMTA0LjM0MiAxNjMuNjI5IDEwNC4zNDIgMTYzLjAwNSAxMDUuOTI0TDE1OS43NDUgMTE0LjE5MUMxNTkuNTU0IDExNC42NzQgMTU5LjE3MiAxMTUuMDU3IDE1OC42ODggMTE1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ljk1MSAxMjcuMDUgMTU3LjU2OCAxMjYuNTY3IDE1Ny4zNzhMMTEyLjkyMiAxNTEuOTk2QzExMS4zMzkgMTUxLjM3MiAxMTEuMzM5IDE0OS4xMzIgMTEyLjkyMiAxNDguNTA4TDEyNi41NjcgMTQzLjEyNkMxMjcuMDUgMTQyLjkzNSAxMjcuNDMzIDE0Mi41NTMgMTI3LjYyMyAxNDIuMDdMMTMzLjAwNSAxMjguNDI0WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTk1Ljk5OSAxODQuMDA0VjE5MS41MDJDMTk1Ljk5OSAxOTQuMjYzIDE5My43NjEgMTk2LjUwMiAxOTAuOTk5IDE5Ni41MDJIMTQ3LjY2OEwxNzIuODc5IDE1OC42ODRDMTc0LjM2MyAxNTYuNDU4IDE3Ny42MzUgMTU2LjQ1OCAxNzkuMTIgMTU4LjY4NEwxOTUuOTk5IDE4NC4wMDRaIiBmaWxsPSIjOEY4RjhGIi8+CjwvZz4KPC9zdmc+Cg==';\n\nexport default previewUri;\n", "import { type AssetResult } from '@cesdk/cesdk-js';\nimport {\n type OutputKind,\n GetBlockInputResult,\n InputByKind\n} from '../core/provider';\nimport previewUri from './previewUri';\n\nfunction getAssetResultForPlaceholder<K extends OutputKind>(\n id: string,\n kind: K,\n blockInput: GetBlockInputResult<K>\n): AssetResult {\n switch (kind) {\n case 'image': {\n return getImageAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['image']\n );\n }\n case 'video': {\n return getVideoAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['video']\n );\n }\n case 'sticker': {\n return getStickerAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['sticker']\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating placeholder block: ${kind}`\n );\n }\n }\n}\n\nfunction getImageAssetResultForPlaceholder(\n id: string,\n input: InputByKind['image']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n meta: {\n previewUri,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'image',\n\n width,\n height\n }\n };\n}\n\nfunction getVideoAssetResultForPlaceholder(\n id: string,\n input: InputByKind['video']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n previewUri,\n mimeType: 'video/mp4',\n kind: 'video',\n fillType: '//ly.img.ubq/fill/video',\n\n duration: input.duration.toString(),\n\n width,\n height\n }\n };\n}\n\nfunction getStickerAssetResultForPlaceholder(\n id: string,\n input: InputByKind['sticker']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n meta: {\n previewUri,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'sticker',\n\n width,\n height\n }\n };\n}\n\nexport default getAssetResultForPlaceholder;\n", "import { type AssetResult } from '@cesdk/cesdk-js';\nimport {\n type OutputKind,\n AudioOutput,\n GetBlockInputResult,\n ImageOutput,\n InputByKind,\n Output,\n StickerOutput,\n VideoOutput\n} from '../core/provider';\nimport { getThumbnailForVideo } from '../utils/utils';\n\nasync function getAssetResultForGenerated<K extends OutputKind>(\n id: string,\n kind: K,\n blockInputs: GetBlockInputResult<K>,\n output: Output\n): Promise<AssetResult> {\n switch (kind) {\n case 'image': {\n if (output.kind !== 'image') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: image)`\n );\n }\n\n return getImageAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['image'],\n output\n );\n }\n\n case 'video': {\n if (output.kind !== 'video') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: video)`\n );\n }\n\n return getVideoAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['video'],\n output\n );\n }\n\n case 'audio': {\n if (output.kind !== 'audio') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: audio)`\n );\n }\n\n return getAudioAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['audio'],\n output\n );\n }\n\n case 'sticker': {\n if (output.kind !== 'sticker') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: sticker)`\n );\n }\n\n return getStickerAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['sticker'],\n output\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating placeholder block: ${kind}`\n );\n }\n }\n}\n\nfunction getImageAssetResultForGenerated(\n id: string,\n input: InputByKind['image'],\n output: ImageOutput\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.url,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'image',\n\n width,\n height\n },\n payload: {\n sourceSet: [\n {\n uri: output.url,\n width,\n height\n }\n ]\n }\n };\n}\n\nasync function getVideoAssetResultForGenerated(\n id: string,\n input: InputByKind['video'],\n output: VideoOutput\n): Promise<AssetResult> {\n const width = input.width;\n const height = input.height;\n\n const thumbUri = await getThumbnailForVideo(output.url, 0);\n\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri,\n\n mimeType: 'video/mp4',\n kind: 'video',\n fillType: '//ly.img.ubq/fill/video',\n\n duration: input.duration.toString(),\n\n width,\n height\n }\n };\n}\n\nfunction getAudioAssetResultForGenerated(\n id: string,\n input: InputByKind['audio'],\n output: AudioOutput\n): AssetResult {\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.thumbnailUrl,\n blockType: '//ly.img.ubq/audio',\n mimeType: 'audio/x-m4a',\n duration: output.duration.toString()\n }\n };\n}\n\nfunction getStickerAssetResultForGenerated(\n id: string,\n input: InputByKind['sticker'],\n output: StickerOutput\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.url,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'sticker',\n\n width,\n height\n },\n payload: {\n sourceSet: [\n {\n uri: output.url,\n width,\n height\n }\n ]\n }\n };\n}\n\nexport default getAssetResultForGenerated;\n", "import type { AssetDefinition } from '@cesdk/cesdk-js';\nimport { addAssetToScene, isAbortError, uuid4 } from '../utils/utils';\nimport { type GetBlockInput, OutputKind, type Output } from '../core/provider';\nimport { Generate, Result } from './createGenerateFunction';\nimport getAssetResultForPlaceholder from '../assets/getAssetResultForPlaceholder';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { Middleware } from '../middleware/middleware';\nimport getAssetResultForGenerated from '../assets/getAssetResultForGenerated';\n\ntype PanelGenerationOptions<K extends OutputKind, I, O extends Output> = {\n /**\n * The kind to generate.\n */\n kind: K;\n\n /**\n * Initialized generate function\n */\n generate: Generate<I, O>;\n\n /**\n * The user flow for the generation process.\n */\n userFlow: 'placeholder' | 'generation-only';\n\n /**\n * Function to get block input from the generated input.\n */\n getBlockInput: GetBlockInput<K, I>;\n\n /**\n * Asset source id of the history library where a generated asset\n * will be added.\n */\n historyAssetSourceId?: string;\n\n /**\n * Additional middlewares added to the generation process.\n */\n middlewares?: Middleware<I, O>[];\n\n /**\n * Print debug information to the console.\n */\n debug?: boolean;\n\n /**\n * Enable dry run mode for testing.\n */\n dryRun?: boolean;\n\n /**\n * Signal to check if process was aborted.\n */\n abortSignal: AbortSignal;\n\n cesdk: CreativeEditorSDK;\n};\n\n/**\n * Handler for generating content from a panel interface.\n * Creates placeholder blocks and manages the generation process.\n */\nfunction handleGenerateFromPanel<K extends OutputKind, I, O extends Output>(\n options: PanelGenerationOptions<K, I, O>\n): (input: I) => Promise<Result<O>> {\n switch (options.userFlow) {\n case 'placeholder':\n return handleGeneratePlaceholderUserFlow(options);\n case 'generation-only':\n return handleGenerateGenerationOnlyUserFlow(options);\n default:\n throw new Error(\n `Unknown user flow: ${options.userFlow}. Expected 'placeholder' or 'generation-only'.`\n );\n }\n}\n\nfunction handleGenerateGenerationOnlyUserFlow<\n K extends OutputKind,\n I,\n O extends Output\n>(options: PanelGenerationOptions<K, I, O>): (input: I) => Promise<Result<O>> {\n const { cesdk, abortSignal } = options;\n\n return async (input: I) => {\n try {\n const kind = options.kind;\n const blockInputs = await options.getBlockInput(input);\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n const result = await options.generate(input, {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n });\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n if (result.status !== 'success') {\n return result;\n }\n\n if (result.type === 'async') {\n // If the result is an async generator, we need to handle it differently.\n // This is a placeholder for handling sync results.\n // You might want to implement logic to handle async results here.\n throw new Error(\n 'Async generation is not supported in this context yet.'\n );\n }\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n if (options.historyAssetSourceId != null) {\n const assetId = uuid4();\n const generatedAssetResult = await getAssetResultForGenerated(\n assetId,\n kind,\n blockInputs,\n result.output\n );\n const assetDefinition: AssetDefinition = {\n ...generatedAssetResult,\n id: `${Date.now()}-${generatedAssetResult.id}`,\n label:\n generatedAssetResult.label != null\n ? {\n en: generatedAssetResult.label\n }\n : {},\n tags: {}\n };\n cesdk.engine.asset.addAssetToSource(\n options.historyAssetSourceId,\n assetDefinition\n );\n } else {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.log(\n 'No asset source ID found in history and generation only was requested. Doing nothing. If no middleware is adding functionality this could be a bug.'\n );\n }\n }\n\n return result;\n } catch (error) {\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\n/**\n * Handles generation from a panel with a placeholder block.\n */\nfunction handleGeneratePlaceholderUserFlow<\n K extends OutputKind,\n I,\n O extends Output\n>(options: PanelGenerationOptions<K, I, O>): (input: I) => Promise<Result<O>> {\n const { cesdk, abortSignal } = options;\n\n let placeholderBlock: number | undefined;\n return async (input: I) => {\n try {\n const kind = options.kind;\n const blockInputs = await options.getBlockInput(input);\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n const assetId = uuid4();\n const assetResult = getAssetResultForPlaceholder(\n assetId,\n kind,\n blockInputs\n );\n\n placeholderBlock = await addAssetToScene(cesdk, assetResult);\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n // This is a workaround. The middleware in the video timeline\n // is calling APIs that will render the block in an error\n // state if it does not have an URI set. It's difficult to\n // recover from that. A bug report has been created for this.\n // As a workaround: Duplicating the block will remove the error state\n // but you will still see an error in the web console.\n // TODO: Remove this workaround when the bug is fixed.\n if (placeholderBlock != null && options.kind === 'video') {\n const positionX = cesdk.engine.block.getPositionX(placeholderBlock);\n const positionY = cesdk.engine.block.getPositionY(placeholderBlock);\n const duplicated = cesdk.engine.block.duplicate(placeholderBlock);\n cesdk.engine.block.setPositionX(duplicated, positionX);\n cesdk.engine.block.setPositionY(duplicated, positionY);\n cesdk.engine.block.destroy(placeholderBlock);\n placeholderBlock = duplicated;\n }\n\n if (placeholderBlock == null)\n throw new Error('Could not create placeholder block');\n\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Pending',\n progress: 0\n });\n\n const result = await options.generate(input, {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n });\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (result.status !== 'success') {\n return result;\n }\n\n if (result.type === 'async') {\n // If the result is an async generator, we need to handle it differently.\n // This is a placeholder for handling sync results.\n // You might want to implement logic to handle async results here.\n throw new Error(\n 'Async generation is not supported in this context yet.'\n );\n }\n\n if (!cesdk.engine.block.isValid(placeholderBlock)) {\n return {\n status: 'aborted',\n message:\n 'Placeholder block was destroyed before generation completed.'\n };\n }\n\n const generatedAssetResult = await getAssetResultForGenerated(\n assetId,\n kind,\n blockInputs,\n result.output\n );\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (options.debug)\n // eslint-disable-next-line no-console\n console.log(\n 'Updating placeholder in scene:',\n JSON.stringify(generatedAssetResult, undefined, 2)\n );\n\n await cesdk.engine.asset.defaultApplyAssetToBlock(\n generatedAssetResult,\n placeholderBlock\n );\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (options.historyAssetSourceId != null) {\n const assetDefinition: AssetDefinition = {\n ...generatedAssetResult,\n id: `${Date.now()}-${generatedAssetResult.id}`,\n label:\n generatedAssetResult.label != null\n ? {\n en: generatedAssetResult.label\n }\n : {},\n tags: {}\n };\n cesdk.engine.asset.addAssetToSource(\n options.historyAssetSourceId,\n assetDefinition\n );\n }\n\n if (cesdk.engine.block.isValid(placeholderBlock)) {\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Ready'\n });\n }\n\n return result;\n } catch (error) {\n if (\n placeholderBlock != null &&\n cesdk.engine.block.isValid(placeholderBlock)\n ) {\n if (isAbortError(error)) {\n cesdk.engine.block.destroy(placeholderBlock);\n } else {\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Error',\n error: 'Unknown'\n });\n }\n }\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\n/**\n * Check the given abort signal and destroy the placeholder block if it is aborted.\n * @returns `true` if the signal is aborted, `false` otherwise.\n */\nfunction checkAbortSignal(\n cesdk: CreativeEditorSDK,\n abortSignal: AbortSignal,\n placeholderBlock?: number\n) {\n if (abortSignal.aborted) {\n if (\n placeholderBlock != null &&\n cesdk.engine.block.isValid(placeholderBlock)\n ) {\n cesdk.engine.block.destroy(placeholderBlock);\n }\n return true;\n }\n return false;\n}\n\nexport default handleGenerateFromPanel;\n", "import CreativeEditorSDK, {\n type BuilderRenderFunctionContext\n} from '@cesdk/cesdk-js';\nimport type Provider from '../../core/provider';\nimport {\n type GetInput,\n type OutputKind,\n type Output,\n type GetBlockInput\n} from '../../core/provider';\nimport { UIOptions, CommonConfiguration } from '../../types';\nimport { isAbortError } from '../../utils/utils';\nimport handleGenerationError from '../../generation/handleGenerationError';\nimport handleGenerateFromPanel from '../../generation/handleGenerateFromPanel';\nimport { Generate } from '../../generation/createGenerateFunction';\n\nexport function isGeneratingStateKey(providerId: string): string {\n return `${providerId}.generating`;\n}\n\nexport function abortGenerationStateKey(providerId: string): string {\n return `${providerId}.abort`;\n}\n\n/**\n * Renders the generation UI components and sets up event handlers\n */\nfunction renderGenerationComponents<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n provider: Provider<K, I, O>,\n generate: Generate<I, O>,\n getInput: GetInput<I>,\n getBlockInput: GetBlockInput<K, I>,\n options: UIOptions & {\n createPlaceholderBlock?: boolean;\n includeHistoryLibrary?: boolean;\n requiredInputs?: string[];\n },\n config: CommonConfiguration<I, O>\n): void {\n const { builder, experimental } = context;\n const { cesdk, includeHistoryLibrary = true } = options;\n const {\n id: providerId,\n output: { abortable }\n } = provider;\n const abortState = experimental.global<() => void>(\n abortGenerationStateKey(providerId),\n () => {}\n );\n const generatingState = experimental.global<boolean>(\n isGeneratingStateKey(providerId),\n false\n );\n\n let abortController: AbortController | undefined;\n const canAbortNow = generatingState.value && abortable;\n const abort = () => {\n if (canAbortNow) {\n abortState.value();\n generatingState.setValue(false);\n abortState.setValue(() => {});\n }\n };\n\n let isDisabled: boolean | undefined;\n if (options.requiredInputs != null && options.requiredInputs.length > 0) {\n const inputs = getInput();\n isDisabled = options.requiredInputs.every((input) => {\n // @ts-ignore\n const hasInput = !inputs.input[input];\n return hasInput;\n });\n }\n\n const confirmCancelDialogId = experimental.global<string | undefined>(\n `${providerId}.confirmationDialogId`,\n undefined\n );\n\n builder.Section(`${providerId}.generate.section`, {\n children: () => {\n builder.Button(`${providerId}.generate`, {\n label: ['common.generate', `panel.${providerId}.generate`],\n isLoading: generatingState.value,\n color: 'accent',\n isDisabled,\n suffix: canAbortNow\n ? {\n icon: '@imgly/Cross',\n color: 'danger',\n tooltip: [`panel.${providerId}.abort`, 'common.cancel'],\n onClick: () => {\n const confirmationDialogId = cesdk.ui.showDialog({\n type: 'warning',\n content: 'panel.ly.img.ai.generation.confirmCancel.content',\n cancel: {\n label: 'common.close',\n onClick: ({ id }) => {\n cesdk.ui.closeDialog(id);\n confirmCancelDialogId.setValue(undefined);\n }\n },\n actions: {\n label: 'panel.ly.img.ai.generation.confirmCancel.confirm',\n color: 'danger',\n onClick: ({ id }) => {\n abort();\n cesdk.ui.closeDialog(id);\n confirmCancelDialogId.setValue(undefined);\n }\n }\n });\n confirmCancelDialogId.setValue(confirmationDialogId);\n }\n }\n : undefined,\n onClick: async () => {\n abortController = new AbortController();\n const abortSignal = abortController.signal;\n\n const triggerGeneration = async () => {\n try {\n generatingState.setValue(true);\n abortState.setValue(() => {\n if (config.debug)\n // eslint-disable-next-line no-console\n console.log('Aborting generation');\n abortController?.abort();\n });\n\n const result = await handleGenerateFromPanel({\n kind: provider.kind,\n generate,\n historyAssetSourceId: options.historyAssetSourceId,\n // TODO: Replace with a merged configuration\n userFlow: options.createPlaceholderBlock\n ? 'placeholder'\n : 'generation-only',\n getBlockInput,\n abortSignal,\n cesdk,\n debug: config.debug,\n dryRun: config.dryRun\n })(getInput().input);\n\n if (result.status === 'aborted') {\n return;\n }\n\n if (result.status === 'error') {\n handleGenerationError(result.message, {\n cesdk,\n provider,\n getInput\n });\n return;\n }\n\n if (result.status === 'success' && result.type === 'sync') {\n const notification = provider.output.notification;\n showSuccessNotification(cesdk, notification, () => ({\n input: getInput().input,\n output: result.output\n }));\n }\n } catch (error) {\n // Do not treat abort errors as errors\n if (isAbortError(error)) {\n return;\n }\n\n handleGenerationError(error, {\n cesdk,\n provider,\n getInput\n });\n } finally {\n abortController = undefined;\n generatingState.setValue(false);\n abortState.setValue(() => {});\n\n if (confirmCancelDialogId.value != null) {\n cesdk.ui.closeDialog(confirmCancelDialogId.value);\n confirmCancelDialogId.setValue(undefined);\n }\n }\n };\n\n await triggerGeneration();\n }\n });\n if (provider.output.generationHintText != null) {\n builder.Text(`${providerId}.generation-hint`, {\n align: 'center',\n content: provider.output.generationHintText\n });\n }\n }\n });\n\n if (includeHistoryLibrary && options.historyAssetLibraryEntryId != null) {\n builder.Library(`${providerId}.history.library`, {\n entries: [options.historyAssetLibraryEntryId]\n });\n }\n}\n\nfunction showSuccessNotification<I, O extends Output>(\n cesdk: CreativeEditorSDK,\n notifications: Provider<any, I, O>['output']['notification'],\n createContext: () => { input: I; output: O }\n): boolean {\n const successNotification = notifications?.success;\n if (successNotification == null) return false;\n\n const showOnSuccess =\n typeof successNotification.show === 'function'\n ? successNotification.show(createContext())\n : successNotification.show;\n\n if (!showOnSuccess) return false;\n\n const message =\n typeof successNotification.message === 'function'\n ? successNotification.message(createContext())\n : successNotification.message ?? 'common.ai-generation.success';\n\n const action =\n successNotification.action != null\n ? {\n label:\n typeof successNotification.action.label === 'function'\n ? successNotification.action.label(createContext())\n : successNotification.action.label,\n onClick: () => {\n successNotification?.action?.onClick(createContext());\n }\n }\n : undefined;\n\n cesdk.ui.showNotification({\n type: 'success',\n message,\n action,\n duration: successNotification.duration\n });\n return true;\n}\n\nexport default renderGenerationComponents;\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { OutputKind, PanelInputCustom, type Output } from '../../core/provider';\nimport renderGenerationComponents, {\n isGeneratingStateKey\n} from '../components/renderGenerationComponents';\nimport { InitializationContext } from '../../types';\nimport { Generate } from '../../generation/createGenerateFunction';\n\nasync function createPanelRenderFunctionFromCustom<\n K extends OutputKind,\n I,\n O extends Output\n>(\n {\n options,\n provider,\n panelInput,\n config\n }: InitializationContext<K, I, O, PanelInputCustom<K, I>>,\n\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n if (panelInput == null) {\n return undefined;\n }\n\n const { cesdk } = options;\n const { id: providerId } = provider;\n\n const render = panelInput.render;\n\n const builderRenderFunction: BuilderRenderFunction<any> = (context) => {\n const { state } = context;\n\n const isGenerating = state(isGeneratingStateKey(providerId), {\n isGenerating: false,\n abort: () => {}\n }).value.isGenerating;\n\n const { getInput, getBlockInput } = render(context, {\n cesdk,\n isGenerating\n });\n renderGenerationComponents(\n context,\n provider,\n generate,\n getInput,\n getBlockInput,\n {\n ...options,\n includeHistoryLibrary: panelInput.includeHistoryLibrary ?? true,\n createPlaceholderBlock: panelInput.userFlow === 'placeholder'\n },\n config\n );\n\n return getInput;\n };\n\n return builderRenderFunction;\n}\n\nexport default createPanelRenderFunctionFromCustom;\n", "import { type OpenAPIV3 } from 'openapi-types';\n\n/**\n * Resolves a JSON reference path within a document\n * @param document The OpenAPI document\n * @param refPath The reference path (e.g. \"#/components/schemas/MySchema\")\n * @returns The resolved object from the document\n */\nexport function resolveReference(\n document: OpenAPIV3.Document,\n refPath: string\n): unknown {\n // Only handle internal references\n if (!refPath.startsWith('#/')) {\n throw new Error(`External references are not supported: ${refPath}`);\n }\n\n // Remove the leading #/\n const path = refPath.substring(2).split('/');\n let current: any = document;\n\n // Navigate through the path\n for (const segment of path) {\n if (current === undefined || current === null) {\n throw new Error(`Invalid reference path: ${refPath}`);\n }\n current = current[segment];\n }\n\n if (current === undefined) {\n throw new Error(`Reference not found: ${refPath}`);\n }\n\n return current;\n}\n\n/**\n * Recursively dereferences all $ref properties in an object\n * @param document The original document for resolving references\n * @param obj The object to dereference\n * @param visited Set of visited objects to prevent circular references\n * @returns The dereferenced object\n */\nfunction dereferenceObject(\n document: OpenAPIV3.Document,\n obj: any,\n visited = new Set<any>()\n): any {\n // Handle null or undefined\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n // If we've seen this object before, return it to avoid circular references\n if (visited.has(obj)) {\n return obj;\n }\n\n // Add the current object to the visited set\n visited.add(obj);\n\n // Handle $ref\n if (obj.$ref && typeof obj.$ref === 'string') {\n // Get the referenced object\n const referenced = resolveReference(document, obj.$ref);\n // Dereference the referenced object\n const dereferenced = dereferenceObject(document, referenced, visited);\n\n // Merge other properties from the original object\n const result = { ...dereferenced };\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && key !== '$ref') {\n result[key] = dereferenceObject(document, obj[key], visited);\n }\n }\n return result;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => dereferenceObject(document, item, visited));\n }\n\n // Handle objects\n if (typeof obj === 'object') {\n const result: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = dereferenceObject(document, obj[key], visited);\n }\n }\n return result;\n }\n\n // Return primitives as is\n return obj;\n}\n\n/**\n * Dereferences all $ref properties in an OpenAPI document\n * @param document The OpenAPI document to dereference\n * @returns A new document with all references resolved\n */\nexport default function dereferenceDocument(\n document: OpenAPIV3.Document\n): OpenAPIV3.Document {\n return dereferenceObject(document, { ...document }) as OpenAPIV3.Document;\n}\n", "import { OpenAPIV3 } from 'openapi-types';\n\n/**\n * Checks if an unknown object is an OpenAPI schema (first level only)\n *\n * @param obj - The object to check (potentially undefined)\n * @param debug - If true, log the reason when validation fails\n * @returns A boolean indicating whether the object is an OpenAPI schema\n */\nexport function isOpenAPISchema(\n obj: unknown,\n debug: boolean = false\n): obj is OpenAPIV3.SchemaObject {\n // Helper function to log debug messages and return false\n const fail = (reason: string): false => {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(`OpenAPI Schema validation failed: ${reason}`);\n }\n return false;\n };\n\n // Check if obj is an object and not null\n if (typeof obj !== 'object' || obj === null) {\n return fail(\n `Input is ${obj === null ? 'null' : typeof obj}, not an object`\n );\n }\n\n const schema = obj as Record<string, any>;\n\n // Basic property validation - most schemas have at least one of these properties\n const hasSchemaTypeProperties =\n typeof schema.type === 'string' ||\n Array.isArray(schema.enum) ||\n typeof schema.properties === 'object' ||\n typeof schema.items === 'object' ||\n typeof schema.allOf === 'object' ||\n typeof schema.anyOf === 'object' ||\n typeof schema.oneOf === 'object' ||\n typeof schema.not === 'object';\n\n if (!hasSchemaTypeProperties) {\n return fail(\n 'Missing required schema-defining properties (type, enum, properties, items, allOf, anyOf, oneOf, not)'\n );\n }\n\n // If it has a type, validate it's one of the allowed OpenAPI schema types\n if (schema.type !== undefined) {\n const validTypes = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'array',\n 'object',\n 'null'\n ];\n\n // Type can be a string or an array of strings\n if (typeof schema.type === 'string') {\n if (!validTypes.includes(schema.type)) {\n return fail(\n `Invalid type: ${schema.type}. Must be one of ${validTypes.join(\n ', '\n )}`\n );\n }\n } else if (Array.isArray(schema.type)) {\n for (const type of schema.type) {\n if (typeof type !== 'string' || !validTypes.includes(type)) {\n return fail(\n `Array of types contains invalid value: ${type}. Must be one of ${validTypes.join(\n ', '\n )}`\n );\n }\n }\n } else {\n return fail(\n `Type must be a string or array of strings, got ${typeof schema.type}`\n );\n }\n }\n\n // If it has items (for array type), validate that items is an object (without recursion)\n if (schema.items !== undefined) {\n if (typeof schema.items !== 'object' || schema.items === null) {\n return fail(\n `Items must be an object, got ${\n schema.items === null ? 'null' : typeof schema.items\n }`\n );\n }\n }\n\n // If it has properties (for object type), validate that properties is an object (without recursion)\n if (schema.properties !== undefined) {\n if (typeof schema.properties !== 'object' || schema.properties === null) {\n return fail(\n `Properties must be an object, got ${\n schema.properties === null ? 'null' : typeof schema.properties\n }`\n );\n }\n }\n\n // Check if advanced schema constructs are valid (without recursion)\n const schemaArrays = ['allOf', 'anyOf', 'oneOf'];\n for (const arrayType of schemaArrays) {\n if (schema[arrayType] !== undefined) {\n if (!Array.isArray(schema[arrayType])) {\n return fail(\n `${arrayType} must be an array, got ${typeof schema[arrayType]}`\n );\n }\n\n // Just check that each item is an object (without recursion)\n for (let i = 0; i < schema[arrayType].length; i++) {\n const subSchema = schema[arrayType][i];\n if (typeof subSchema !== 'object' || subSchema === null) {\n return fail(\n `Item ${i} in ${arrayType} must be an object, got ${\n subSchema === null ? 'null' : typeof subSchema\n }`\n );\n }\n }\n }\n }\n\n // Check if 'not' is an object\n if (schema.not !== undefined) {\n if (typeof schema.not !== 'object' || schema.not === null) {\n return fail(\n `'not' must be an object, got ${\n schema.not === null ? 'null' : typeof schema.not\n }`\n );\n }\n }\n\n // If we have additionalProperties, make sure it's a boolean or an object\n if (schema.additionalProperties !== undefined) {\n if (\n typeof schema.additionalProperties !== 'boolean' &&\n (typeof schema.additionalProperties !== 'object' ||\n schema.additionalProperties === null)\n ) {\n return fail(\n `additionalProperties must be a boolean or an object, got ${\n schema.additionalProperties === null\n ? 'null'\n : typeof schema.additionalProperties\n }`\n );\n }\n }\n\n // Check basic format if present (for string type)\n if (schema.format !== undefined && typeof schema.format !== 'string') {\n return fail(`format must be a string, got ${typeof schema.format}`);\n }\n\n // Check number constraints\n const numberConstraints = [\n 'minimum',\n 'maximum',\n 'exclusiveMinimum',\n 'exclusiveMaximum',\n 'multipleOf'\n ];\n for (const constraint of numberConstraints) {\n if (\n schema[constraint] !== undefined &&\n typeof schema[constraint] !== 'number'\n ) {\n return fail(\n `${constraint} must be a number, got ${typeof schema[constraint]}`\n );\n }\n }\n\n // Check string constraints\n if (\n schema.minLength !== undefined &&\n (typeof schema.minLength !== 'number' || schema.minLength < 0)\n ) {\n return fail(\n `minLength must be a non-negative number, got ${\n typeof schema.minLength === 'number'\n ? schema.minLength\n : typeof schema.minLength\n }`\n );\n }\n if (\n schema.maxLength !== undefined &&\n (typeof schema.maxLength !== 'number' || schema.maxLength < 0)\n ) {\n return fail(\n `maxLength must be a non-negative number, got ${\n typeof schema.maxLength === 'number'\n ? schema.maxLength\n : typeof schema.maxLength\n }`\n );\n }\n if (schema.pattern !== undefined && typeof schema.pattern !== 'string') {\n return fail(`pattern must be a string, got ${typeof schema.pattern}`);\n }\n\n // Check array constraints\n if (\n schema.minItems !== undefined &&\n (typeof schema.minItems !== 'number' || schema.minItems < 0)\n ) {\n return fail(\n `minItems must be a non-negative number, got ${\n typeof schema.minItems === 'number'\n ? schema.minItems\n : typeof schema.minItems\n }`\n );\n }\n if (\n schema.maxItems !== undefined &&\n (typeof schema.maxItems !== 'number' || schema.maxItems < 0)\n ) {\n return fail(\n `maxItems must be a non-negative number, got ${\n typeof schema.maxItems === 'number'\n ? schema.maxItems\n : typeof schema.maxItems\n }`\n );\n }\n if (\n schema.uniqueItems !== undefined &&\n typeof schema.uniqueItems !== 'boolean'\n ) {\n return fail(\n `uniqueItems must be a boolean, got ${typeof schema.uniqueItems}`\n );\n }\n\n // Check object constraints\n if (\n schema.minProperties !== undefined &&\n (typeof schema.minProperties !== 'number' || schema.minProperties < 0)\n ) {\n return fail(\n `minProperties must be a non-negative number, got ${\n typeof schema.minProperties === 'number'\n ? schema.minProperties\n : typeof schema.minProperties\n }`\n );\n }\n if (\n schema.maxProperties !== undefined &&\n (typeof schema.maxProperties !== 'number' || schema.maxProperties < 0)\n ) {\n return fail(\n `maxProperties must be a non-negative number, got ${\n typeof schema.maxProperties === 'number'\n ? schema.maxProperties\n : typeof schema.maxProperties\n }`\n );\n }\n if (schema.required !== undefined) {\n if (!Array.isArray(schema.required)) {\n return fail(`required must be an array, got ${typeof schema.required}`);\n }\n for (let i = 0; i < schema.required.length; i++) {\n const prop = schema.required[i];\n if (typeof prop !== 'string') {\n return fail(\n `Item ${i} in required array must be a string, got ${typeof prop}`\n );\n }\n }\n }\n\n // It has passed all the first-level checks\n return true;\n}\n", "import { OpenAPIV3 } from 'openapi-types';\nimport { OutputKind, PanelInputSchema } from '../core/provider';\nimport { Property } from './types';\n\nfunction getProperties<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): Property[] {\n if (inputSchema.properties == null) {\n throw new Error('Input schema must have properties');\n }\n const propertiesFromSchema = inputSchema.properties;\n const properties: Property[] = [];\n\n const order = getOrder(inputSchema, panelInput);\n order.forEach((propertyKey) => {\n const id = propertyKey;\n const schema =\n (propertiesFromSchema[propertyKey] as OpenAPIV3.SchemaObject) ??\n undefined;\n properties.push({ id, schema });\n });\n\n return properties;\n}\n\nfunction getOrder<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): string[] {\n const panelInputOrder = panelInput.order;\n if (panelInputOrder != null && Array.isArray(panelInputOrder)) {\n return panelInputOrder;\n }\n\n if (inputSchema.properties == null) {\n throw new Error('Input schema must have properties');\n }\n const propertiesFromSchema = inputSchema.properties;\n const orderFromKeys = Object.keys(propertiesFromSchema);\n const orderFromExtensionKeyword = getOrderFromExtensionKeyword(\n inputSchema,\n panelInput\n );\n\n let order = orderFromExtensionKeyword ?? orderFromKeys;\n\n if (panelInputOrder != null && typeof panelInputOrder === 'function') {\n order = panelInputOrder(order);\n }\n\n // Return order with no duplicates\n return [...new Set(order)];\n}\n\n/**\n * Get the order from an extension keyword in the input schema (e.g. x-order) if it exists.\n */\nfunction getOrderFromExtensionKeyword<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): string[] | undefined {\n if (panelInput.orderExtensionKeyword == null) {\n return undefined;\n }\n\n if (\n typeof panelInput.orderExtensionKeyword !== 'string' &&\n !Array.isArray(panelInput.orderExtensionKeyword)\n ) {\n throw new Error(\n 'orderExtensionKeyword must be a string or an array of strings'\n );\n }\n const orderExtensionKeywords =\n typeof panelInput.orderExtensionKeyword === 'string'\n ? [panelInput.orderExtensionKeyword]\n : panelInput.orderExtensionKeyword;\n\n const orderExtensionKeyword = orderExtensionKeywords.find(\n (extensionKeyword) => {\n return extensionKeyword in inputSchema;\n }\n );\n\n if (orderExtensionKeyword == null) {\n return undefined;\n }\n const order =\n // @ts-ignore\n inputSchema[orderExtensionKeyword] as string[];\n\n return order;\n}\n\nexport default getProperties;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { BuilderRenderFunctionContext } from '@cesdk/cesdk-js';\nimport {\n EnumValue,\n ExtensionImglyBuilder,\n GetPropertyInput,\n Property,\n PropertyInput\n} from './types';\nimport Provider, {\n Output,\n OutputKind,\n PanelInputSchema\n} from '../core/provider';\nimport { UIOptions, CommonConfiguration } from '../types';\nimport { OpenAPIV3 } from 'openapi-types';\nimport getProperties from './getProperties';\nimport { getLabelFromId } from '../utils/utils';\n\nfunction createInputLabelArray<K extends OutputKind, I, O extends Output>(\n property: Property,\n provider: Provider<K, I, O>,\n kind: K,\n valueId?: string\n): string[] {\n const baseKey = `property.${property.id}${valueId ? `.${valueId}` : ''}`;\n return [\n `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.${baseKey}`,\n `ly.img.plugin-ai-generation-web.${baseKey}`,\n `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.${baseKey}`,\n `ly.img.plugin-ai-generation-web.defaults.${baseKey}`\n ];\n}\n\nfunction extractEnumMetadata(schema: any): {\n labels: Record<string, string>;\n icons: Record<string, string>;\n} {\n const labels =\n 'x-imgly-enum-labels' in schema &&\n typeof schema['x-imgly-enum-labels'] === 'object'\n ? (schema['x-imgly-enum-labels'] as Record<string, string>)\n : {};\n\n const icons =\n 'x-imgly-enum-icons' in schema &&\n typeof schema['x-imgly-enum-icons'] === 'object'\n ? (schema['x-imgly-enum-icons'] as Record<string, string>)\n : {};\n\n return { labels, icons };\n}\n\nfunction renderProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Property,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput | undefined {\n if (property.schema == null) {\n if (\n panelInput.renderCustomProperty != null &&\n panelInput.renderCustomProperty[property.id] != null\n ) {\n return panelInput.renderCustomProperty[property.id](context, property);\n } else {\n return undefined;\n }\n }\n const propertyWithSchema: Required<Property> = property as Required<Property>;\n const type = property.schema.type;\n\n if (\n panelInput.renderCustomProperty != null &&\n panelInput.renderCustomProperty[property.id] != null\n ) {\n return panelInput.renderCustomProperty[property.id](context, property);\n }\n\n switch (type) {\n case 'string': {\n if (property.schema.enum != null) {\n return renderEnumProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n } else {\n return renderStringProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n }\n }\n\n case 'boolean': {\n return renderBooleanProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n }\n\n case 'number':\n case 'integer': {\n return renderIntegerProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n }\n\n case 'object': {\n return renderObjectProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n }\n\n case 'array': {\n // not supported yet\n break;\n }\n\n case undefined: {\n if (\n property.schema.anyOf != null &&\n Array.isArray(property.schema.anyOf)\n ) {\n return renderAnyOfProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n }\n break;\n }\n\n default: {\n // eslint-disable-next-line no-console\n console.error(`Unsupported property type: ${type}`);\n }\n }\n}\n\nfunction renderObjectProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput {\n const properties = getProperties(property.schema ?? {}, panelInput);\n\n const childInputs = properties.reduce((acc, childProperty) => {\n const getInput = renderProperty(\n context,\n childProperty,\n provider,\n panelInput,\n options,\n config,\n kind\n );\n if (getInput != null) {\n acc[childProperty.id] = getInput();\n }\n return acc;\n }, {} as Record<string, PropertyInput>);\n\n return () => ({\n id: property.id,\n type: 'object',\n value: childInputs\n });\n}\n\nfunction renderStringProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput {\n const {\n builder,\n experimental: { global }\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const propertyState = global(id, property.schema.default ?? '');\n\n const extension = getImglyExtensionBuilder(property.schema);\n const builderComponent =\n extension?.component != null && extension?.component === 'TextArea'\n ? 'TextArea'\n : 'TextInput';\n\n builder[builderComponent](id, {\n inputLabel,\n placeholder: options.i18n?.prompt,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'string',\n value: propertyState.value\n });\n}\n\nfunction renderEnumProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput {\n const {\n builder,\n experimental: { global }\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const { labels: enumLabels, icons } = extractEnumMetadata(property.schema);\n\n const values: EnumValue[] = (property.schema.enum ?? []).map((valueId) => ({\n id: valueId,\n label: createInputLabelArray(property, provider, kind, valueId),\n icon: icons[valueId]\n }));\n const defaultValue =\n property.schema.default != null\n ? values.find((v) => v.id === property.schema.default) ?? values[0]\n : values[0];\n\n const propertyState = global<EnumValue>(id, defaultValue);\n\n builder.Select(id, {\n inputLabel,\n values,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'string',\n value: propertyState.value.id\n });\n}\n\nfunction renderBooleanProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput {\n const {\n builder,\n experimental: { global }\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const defaultValue = !!property.schema.default;\n const propertyState = global<boolean>(id, defaultValue);\n\n builder.Checkbox(id, {\n inputLabel,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'boolean',\n value: propertyState.value\n });\n}\n\nfunction renderIntegerProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput {\n const {\n builder,\n experimental: { global }\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const minValue = property.schema.minimum;\n const maxValue = property.schema.maximum;\n\n let defaultValue = property.schema.default;\n if (defaultValue == null) {\n if (minValue != null) {\n defaultValue = minValue;\n } else if (maxValue != null) {\n defaultValue = maxValue;\n } else {\n defaultValue = 0;\n }\n }\n\n const propertyState = global<number>(id, defaultValue);\n\n if (minValue != null && maxValue != null) {\n let step = property.schema.type === 'number' ? 0.1 : 1;\n if (\n 'x-imgly-step' in property.schema &&\n typeof property.schema['x-imgly-step'] === 'number'\n ) {\n step = property.schema['x-imgly-step'];\n }\n\n builder.Slider(id, {\n inputLabel,\n min: minValue,\n max: maxValue,\n step,\n ...propertyState\n });\n } else {\n builder.NumberInput(id, {\n inputLabel,\n min: minValue,\n max: maxValue,\n ...propertyState\n });\n }\n\n return () => ({\n id: property.id,\n type: 'integer',\n value: propertyState.value\n });\n}\n\nfunction renderAnyOfProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K\n): GetPropertyInput | undefined {\n const {\n builder,\n experimental: { global }\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const anyOf = (property.schema.anyOf ?? []) as OpenAPIV3.SchemaObject[];\n const values: EnumValue[] = [];\n const conditionalRender: Record<string, () => GetPropertyInput> = {};\n const conditionalInputs: Record<string, () => PropertyInput> = {};\n const { labels, icons } = extractEnumMetadata(property.schema);\n\n const renderFunctionMap: Record<string, Function> = {\n string: renderStringProperty,\n boolean: renderBooleanProperty,\n integer: renderIntegerProperty,\n object: renderObjectProperty\n };\n\n const extractValueId = (anySchema: any, schemaId: string): string =>\n (anySchema as any).$ref\n ? (anySchema as any).$ref.split('/').pop()\n : schemaId.split('.').pop() ?? schemaId;\n\n const createEnumValue = (enumId: string, valueId: string): EnumValue => ({\n id: enumId,\n label: createInputLabelArray(property, provider, kind, valueId),\n icon: icons[valueId] ?? icons[enumId]\n });\n\n anyOf.forEach((anySchema, index) => {\n const schemaId = `${provider.id}.${propertyId}.anyOf[${index}]`;\n\n if ((anySchema as any).$ref || anySchema.title) {\n const refName = (anySchema as any).$ref\n ? (anySchema as any).$ref.split('/').pop()\n : anySchema.title;\n\n conditionalRender[schemaId] = () =>\n renderObjectProperty(\n context,\n {\n id: schemaId,\n schema: { ...anySchema, title: labels[refName] || refName }\n },\n provider,\n panelInput,\n options,\n config,\n kind\n );\n\n values.push(createEnumValue(schemaId, refName));\n } else if (anySchema.type === 'string' && anySchema.enum) {\n anySchema.enum.forEach((valueId) => {\n values.push(createEnumValue(valueId, valueId));\n });\n } else if (anySchema.type && renderFunctionMap[anySchema.type]) {\n const renderFunction = renderFunctionMap[anySchema.type];\n conditionalRender[schemaId] = () =>\n renderFunction(\n context,\n { id: schemaId, schema: { ...anySchema, title: anySchema.title } },\n provider,\n panelInput,\n options,\n config,\n kind\n );\n\n const valueId = extractValueId(anySchema, schemaId);\n values.push(\n anySchema.type === 'string' && !anySchema.enum\n ? {\n id: schemaId,\n label: anySchema.title || valueId,\n icon:\n (anySchema.title && icons[anySchema.title]) || icons[valueId]\n }\n : createEnumValue(schemaId, valueId)\n );\n }\n });\n\n const defaultValue =\n property.schema.default != null\n ? values.find((value) => value.id === property.schema.default) ??\n values[0]\n : values[0];\n\n const propertyState = global<EnumValue>(id, defaultValue);\n\n builder.Select(id, {\n inputLabel,\n values,\n ...propertyState\n });\n\n if (propertyState.value.id in conditionalRender) {\n const inputs = conditionalRender[propertyState.value.id]();\n conditionalInputs[propertyState.value.id] = inputs;\n }\n\n return () => {\n const conditionalInput = conditionalInputs[propertyState.value.id];\n\n if (conditionalInput != null) {\n return {\n ...conditionalInput(),\n id: property.id\n };\n }\n\n return {\n id: property.id,\n type: 'string',\n value: propertyState.value.id\n };\n };\n}\n\nfunction getImglyExtensionBuilder(\n schema: OpenAPIV3.SchemaObject\n): ExtensionImglyBuilder | undefined {\n if ('x-imgly-builder' in schema) {\n const extension = schema['x-imgly-builder'] as ExtensionImglyBuilder;\n return extension;\n }\n\n return undefined;\n}\n\nexport default renderProperty;\n", "/**\n * Default translations for AI generation properties and enum values.\n * These are automatically applied as fallback translations for all AI providers.\n *\n * Structure:\n * - Property translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}`\n * - Enum value translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}.${enumValue}`\n *\n * Based on actual OpenAPI Input schemas from all AI provider packages.\n */\nexport const defaultTranslations: Record<string, string> = {\n // Core generation properties (found in all Input schemas)\n 'ly.img.plugin-ai-generation-web.defaults.property.prompt': 'Prompt',\n 'ly.img.plugin-ai-generation-web.defaults.property.style': 'Style',\n\n // Common properties\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size': 'Image Size',\n 'ly.img.plugin-ai-generation-web.defaults.property.size': 'Image Size',\n 'ly.img.plugin-ai-generation-web.defaults.property.colors': 'Colors',\n 'ly.img.plugin-ai-generation-web.defaults.property.background': 'Background',\n\n // Common dimension properties\n 'ly.img.plugin-ai-generation-web.defaults.property.width': 'Width',\n 'ly.img.plugin-ai-generation-web.defaults.property.height': 'Height',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio':\n 'Aspect Ratio',\n\n // Common temporal properties\n 'ly.img.plugin-ai-generation-web.defaults.property.duration': 'Duration',\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution': 'Resolution',\n 'ly.img.plugin-ai-generation-web.defaults.property.generate_audio':\n 'Generate Audio',\n\n // Common audio properties\n 'ly.img.plugin-ai-generation-web.defaults.property.voice_id': 'Voice',\n 'ly.img.plugin-ai-generation-web.defaults.property.speed': 'Speed',\n 'ly.img.plugin-ai-generation-web.defaults.property.text': 'Text',\n 'ly.img.plugin-ai-generation-web.defaults.property.duration_seconds':\n 'Duration (seconds)',\n\n // Custom renderer translations for Recraft providers\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type': 'Type',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.image': 'Image',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.vector':\n 'Vector',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.icon': 'Icon',\n\n // Enum value translations - common formats\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.square':\n 'Square',\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.portrait':\n 'Portrait',\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.landscape':\n 'Landscape',\n\n // Enum value translations - background\n 'ly.img.plugin-ai-generation-web.defaults.property.background.auto': 'Auto',\n 'ly.img.plugin-ai-generation-web.defaults.property.background.transparent':\n 'Transparent',\n\n // Enum value translations - common aspect ratios\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.1:1':\n '1:1 (Square)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.16:9':\n '16:9 (Widescreen)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.9:16':\n '9:16 (Vertical)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.4:3': '4:3',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.3:4': '3:4',\n\n // Enum value translations - common resolutions\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution.720p':\n '720p HD',\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution.1080p':\n '1080p Full HD'\n};\n", "import { Property } from './types';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport { UIOptions } from '../types';\nimport { defaultTranslations } from './defaultTranslations';\n\nfunction formatEnumLabel(enumValue: string): string {\n return (\n enumValue\n // Replace underscores with spaces\n .replace(/_/g, ' ')\n // Handle specific cases first\n .replace(/\\b3d\\b/gi, '3D')\n .replace(/\\b2d\\b/gi, '2D')\n // Capitalize each word\n .replace(/\\b\\w/g, (char) => char.toUpperCase())\n );\n}\n\n/**\n * Extracts translations from OpenAPI schema properties and sets them via cesdk.i18n\n * This includes:\n * - Schema property titles as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}`\n * - Enum value labels as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}.${valueId}`\n * - AnyOf enum value labels with the same pattern\n */\nexport function extractAndSetSchemaTranslations<\n K extends OutputKind,\n I,\n O extends Output\n>(\n properties: Property[],\n provider: Provider<K, I, O>,\n options: UIOptions,\n kind: K\n): void {\n const translations: Record<string, string> = {};\n\n const createTranslationKey = (propertyId: string, valueId?: string): string =>\n `ly.img.plugin-ai-${kind}-generation-web.${\n provider.id\n }.defaults.property.${propertyId}${valueId ? `.${valueId}` : ''}`;\n\n const extractEnumLabels = (schema: any): Record<string, string> =>\n 'x-imgly-enum-labels' in schema &&\n typeof schema['x-imgly-enum-labels'] === 'object'\n ? (schema['x-imgly-enum-labels'] as Record<string, string>)\n : {};\n\n const addEnumTranslations = (\n enumValues: any[],\n propertyId: string,\n enumLabels: Record<string, string>\n ): void => {\n enumValues.forEach((enumValue) => {\n const valueId = String(enumValue);\n const labelValue = enumLabels[valueId] || formatEnumLabel(valueId);\n translations[createTranslationKey(propertyId, valueId)] = labelValue;\n });\n };\n\n properties.forEach((property) => {\n if (property.schema?.title) {\n translations[createTranslationKey(property.id)] = property.schema.title;\n }\n\n if (property.schema?.enum) {\n const enumLabels = extractEnumLabels(property.schema);\n addEnumTranslations(property.schema.enum, property.id, enumLabels);\n }\n\n if (property.schema?.anyOf && Array.isArray(property.schema.anyOf)) {\n const enumLabels = extractEnumLabels(property.schema);\n\n property.schema.anyOf.forEach((anySchema) => {\n const schema = anySchema as any;\n if (schema.enum && Array.isArray(schema.enum)) {\n addEnumTranslations(schema.enum, property.id, enumLabels);\n } else if (schema.$ref) {\n const refName = schema.$ref.split('/').pop();\n if (refName && enumLabels[refName]) {\n translations[createTranslationKey(property.id, refName)] =\n enumLabels[refName];\n }\n } else if (schema.title) {\n const refName = schema.title;\n const labelValue = enumLabels[refName] || formatEnumLabel(refName);\n translations[createTranslationKey(property.id, refName)] = labelValue;\n }\n });\n }\n });\n\n const allTranslations = { ...defaultTranslations, ...translations };\n\n if (Object.keys(allTranslations).length > 0) {\n options.cesdk.i18n.setTranslations({\n en: allTranslations\n });\n }\n}\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { OutputKind, PanelInputSchema, type Output } from '../../core/provider';\nimport renderGenerationComponents from '../components/renderGenerationComponents';\nimport { InitializationContext } from '../../types';\nimport dereferenceDocument, {\n resolveReference\n} from '../../openapi/dereferenceDocument';\nimport { isOpenAPISchema } from '../../openapi/isOpenAPISchema';\nimport { OpenAPIV3 } from 'openapi-types';\nimport getProperties from '../../openapi/getProperties';\nimport { GetPropertyInput, PropertyInput } from '../../openapi/types';\nimport renderProperty from '../../openapi/renderProperty';\nimport { Generate } from '../../generation/createGenerateFunction';\nimport { extractAndSetSchemaTranslations } from '../../openapi/extractSchemaTranslations';\n\n/**\n * Creates a panel render function based on the schema definition in the provider.\n */\nasync function createPanelRenderFunctionFromSchema<\n K extends OutputKind,\n I,\n O extends Output\n>(\n {\n options,\n provider,\n panelInput,\n config\n }: InitializationContext<K, I, O, PanelInputSchema<K, I>>,\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n const { id: providerId } = provider;\n\n if (panelInput == null) {\n return undefined;\n }\n\n if (config.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `Registering schema-based panel input for provider ${providerId}`\n );\n }\n\n const schemaDocument = dereferenceDocument(panelInput.document);\n const resolvedInputReference = resolveReference(\n schemaDocument,\n panelInput.inputReference\n );\n\n if (!isOpenAPISchema(resolvedInputReference, config.debug)) {\n throw new Error(\n `Input reference '${panelInput.inputReference}' does not resolve to a valid OpenAPI schema`\n );\n }\n\n const inputSchema: OpenAPIV3.SchemaObject = resolvedInputReference;\n const properties = getProperties(inputSchema, panelInput);\n\n // Extract and set translations from schema\n extractAndSetSchemaTranslations(properties, provider, options, provider.kind);\n\n const builderRenderFunction: BuilderRenderFunction<any> = (context) => {\n const { builder } = context;\n\n const getInputs: GetPropertyInput[] = [];\n builder.Section(`${providerId}.schema.section`, {\n children: () => {\n properties.forEach((property) => {\n const getInput = renderProperty(\n context,\n property,\n provider,\n panelInput,\n options,\n config,\n provider.kind\n );\n if (getInput != null) {\n if (Array.isArray(getInput)) {\n getInputs.push(...getInput);\n } else {\n getInputs.push(getInput);\n }\n }\n });\n }\n });\n\n const inputs = getInputs.map((getInput) => {\n const input = getInput();\n return input;\n });\n\n const resolveInput = (input: PropertyInput) => {\n if (input.type === 'object') {\n return Object.entries(input.value).reduce((acc, [key, value]) => {\n acc[key] = resolveInput(value);\n\n return acc;\n }, {} as Record<string, any>);\n }\n\n return input.value;\n };\n const input = inputs.reduce((acc, propertyInput) => {\n acc[propertyInput.id] = resolveInput(propertyInput);\n return acc;\n }, {} as Record<string, any>) as I;\n\n renderGenerationComponents(\n context,\n provider,\n generate,\n () => {\n return { input };\n },\n () => {\n return panelInput.getBlockInput(input);\n },\n {\n ...options,\n requiredInputs: inputSchema.required,\n createPlaceholderBlock: panelInput.userFlow === 'placeholder'\n },\n config\n );\n };\n\n return builderRenderFunction;\n}\n\nexport default createPanelRenderFunctionFromSchema;\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport {\n Output,\n OutputKind,\n PanelInputCustom,\n PanelInputSchema\n} from '../../core/provider';\nimport { InitializationContext } from '../../types';\nimport createPanelRenderFunctionFromCustom from './createPanelRenderFunctionFromCustom';\nimport createPanelRenderFunctionFromSchema from './createPanelRenderFunctionFromSchema';\nimport { Generate } from '../../generation/createGenerateFunction';\n\n/**\n * Creates a panel render function based on the provided context, i.e. on the provider.\n */\nasync function createPanelRenderFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(\n context: InitializationContext<K, I, O>,\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n if (context.panelInput == null) {\n return undefined;\n }\n\n switch (context.panelInput.type) {\n case 'custom': {\n return createPanelRenderFunctionFromCustom<K, I, O>(\n context as InitializationContext<K, I, O, PanelInputCustom<K, I>>,\n generate\n );\n }\n\n case 'schema': {\n return createPanelRenderFunctionFromSchema<K, I, O>(\n context as InitializationContext<K, I, O, PanelInputSchema<K, I>>,\n generate\n );\n }\n\n default: {\n if (context.config.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n // @ts-ignore\n `Invalid panel input type '${panelInput.type}' - skipping`\n );\n }\n }\n }\n}\n\nexport default createPanelRenderFunction;\n", "import { IndexedDBAssetSource } from '@imgly/plugin-utils';\nimport { OutputKind, Output } from '../core/provider';\nimport { InitializationContext } from '../types';\n\n/**\n * Initializes the history asset source for the given provider.\n */\nfunction initializeHistoryAssetSource<\n K extends OutputKind,\n I,\n O extends Output\n>(context: InitializationContext<K, I, O>): string | undefined {\n const {\n provider,\n options: { engine }\n } = context;\n\n const history = provider.output.history ?? '@imgly/local';\n if (history == null || history === false) return undefined;\n\n const currentAssetSourceIds = engine.asset.findAllSources();\n\n function getUniqueHistoryId(): string {\n let id = `${provider.id}.history`;\n while (currentAssetSourceIds.includes(id)) {\n id += `-${Math.random().toString(36).substring(2, 6)}`;\n }\n return id;\n }\n\n if (history === '@imgly/local') {\n const historyId = getUniqueHistoryId();\n engine.asset.addLocalSource(historyId);\n return historyId;\n }\n if (history === '@imgly/indexedDB') {\n const historyId = getUniqueHistoryId();\n engine.asset.addSource(new IndexedDBAssetSource(historyId, engine));\n return historyId;\n }\n\n return history;\n}\n\nexport default initializeHistoryAssetSource;\n", "import { OutputKind, Output } from '../core/provider';\nimport { InitializationContext } from '../types';\n\n/**\n * Initializes the history asset source for the given provider.\n */\nfunction initializeHistoryAssetLibraryEntry<\n K extends OutputKind,\n I,\n O extends Output\n>(\n context: InitializationContext<K, I, O>,\n historyAssetSourceId?: string\n): string | undefined {\n if (historyAssetSourceId == null || !historyAssetSourceId) return;\n\n const historyAssetLibraryEntryId = `${context.provider.id}.history`;\n\n context.options.cesdk.ui.addAssetLibraryEntry({\n id: historyAssetLibraryEntryId,\n sourceIds: [historyAssetSourceId],\n sortBy: {\n sortKey: 'insertedAt',\n sortingOrder: 'Descending'\n },\n canRemove: true,\n gridItemHeight: 'square',\n gridBackgroundType: 'cover'\n });\n\n return historyAssetLibraryEntryId;\n}\n\nexport default initializeHistoryAssetLibraryEntry;\n", "export const PLUGIN_ICON_SET_ID = '@imgly/plugin-ai-generation';\n\nexport const ICON_SPRITE = `\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\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/image\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/video\"\n >\n<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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/audio\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/MixingPlate\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n\n </symbol>\n</svg>\n`;\n\nexport default ICON_SPRITE;\n", "/* eslint-disable no-console */\nimport { getImageDimensionsFromURL, getImageUri } from '@imgly/plugin-utils';\nimport {\n type Output,\n type OutputKind,\n type GetBlockInputResult,\n VideoOutput,\n ImageOutput,\n TextOutput,\n AudioOutput,\n GenerationOptions,\n GenerationResult\n} from '../core/provider';\nimport { Middleware } from './middleware';\n\ninterface DryRunOptions<K extends OutputKind> {\n enable?: boolean;\n kind: K;\n\n // Is only defined with generation from a panel where we create a complete new block\n blockInputs?: GetBlockInputResult<K>;\n\n // Is only defined with quick action generation on a given block(s).\n blockIds?: number[];\n}\n\nfunction dryRunMiddleware<I, K extends OutputKind, O extends Output>(\n options: DryRunOptions<K>\n) {\n const middleware: Middleware<I, O> = async (\n generationInput,\n generationOptions,\n next\n ) => {\n if (!options.enable) {\n return next(generationInput, generationOptions);\n }\n console.log(\n `[DRY RUN]: Requesting dummy AI generation for kind '${options.kind}' with inputs: `,\n JSON.stringify(generationInput, undefined, 2)\n );\n await wait(2000);\n const output = await getDryRunOutput(\n generationInput,\n options,\n generationOptions\n );\n return output as O;\n };\n\n return middleware;\n}\n\nasync function getDryRunOutput<K extends OutputKind, I>(\n generationInput: I,\n options: DryRunOptions<K>,\n generationOptions: GenerationOptions\n): Promise<GenerationResult<Output>> {\n switch (options.kind) {\n case 'image': {\n return getImageDryRunOutput(\n generationInput,\n options as DryRunOptions<'image'>,\n generationOptions\n );\n }\n case 'video': {\n return getVideoDryRunOutput(\n generationInput,\n options as DryRunOptions<'video'>,\n generationOptions\n );\n }\n case 'text': {\n return getTextDryRunOutput(\n generationInput,\n options as DryRunOptions<'text'>,\n generationOptions\n );\n }\n case 'audio': {\n return getAudioDryRunOutput(\n generationInput,\n options as DryRunOptions<'audio'>,\n generationOptions\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating dry run output: ${options.kind}`\n );\n }\n }\n}\n\nasync function getImageDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'image'>,\n { engine }: GenerationOptions\n): Promise<ImageOutput> {\n let width;\n let height;\n\n const prompt: string =\n generationInput != null &&\n typeof generationInput === 'object' &&\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ? generationInput.prompt\n : 'AI Generated Image';\n\n // If prompt includes something that looks like a dimension\n // e.g. 512x512, 1024x768, etc. than we will use this as the\n // output image size for testing purposes.\n const promptDimension = prompt.match(/(\\d+)x(\\d+)/);\n if (promptDimension != null) {\n width = parseInt(promptDimension[1], 10);\n height = parseInt(promptDimension[2], 10);\n } else {\n if (options.blockInputs != null) {\n width = options.blockInputs.image.width;\n height = options.blockInputs.image.height;\n }\n if (\n options.blockIds != null &&\n Array.isArray(options.blockIds) &&\n options.blockIds.length > 0\n ) {\n const [blockId] = options.blockIds;\n const url = await getImageUri(blockId, engine);\n const dimension = await getImageDimensionsFromURL(url, engine);\n width = dimension.width;\n height = dimension.height;\n } else {\n width = 512;\n height = 512;\n }\n }\n\n const url = `https://placehold.co/${width}x${height}/000000/FFF?text=${prompt\n .replace(' ', '+')\n .replace('\\n', '+')}`;\n\n return {\n kind: 'image',\n url\n };\n}\n\nasync function getVideoDryRunOutput<I>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _generationInput: I,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: DryRunOptions<'video'>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _generationOptions: GenerationOptions\n): Promise<VideoOutput> {\n return Promise.resolve({\n kind: 'video',\n url: 'https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4'\n });\n}\n\nasync function getTextDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'text'>,\n generationOptions: GenerationOptions\n): Promise<AsyncGenerator<TextOutput>> {\n // Extract original text from the blocks or prompt\n let originalText = '';\n\n // Try to get original text from blocks first\n if (options.blockIds && options.blockIds.length > 0) {\n const [blockId] = options.blockIds;\n if (generationOptions.engine.block.isValid(blockId)) {\n originalText = generationOptions.engine.block.getString(\n blockId,\n 'text/text'\n );\n }\n }\n\n // If no original text from blocks, try to extract from prompt\n if (!originalText) {\n if (\n generationInput != null &&\n typeof generationInput === 'object' &&\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ) {\n // Try to extract original text from prompt patterns\n const promptStr = generationInput.prompt;\n const textMatch =\n promptStr.match(/text:\\s*\"([^\"]+)\"/i) ||\n promptStr.match(/content:\\s*\"([^\"]+)\"/i) ||\n promptStr.match(/\"([^\"]+)\"/);\n if (textMatch && textMatch[1]) {\n originalText = textMatch[1];\n }\n }\n }\n\n // Generate dummy text with similar length\n const targetLength = originalText.length || 50; // Default to 50 chars if no original text\n let dryRunText = '';\n\n // Analyze input for specific text generation types and create appropriate dummy text\n if (generationInput != null && typeof generationInput === 'object') {\n if (\n 'language' in generationInput &&\n typeof generationInput.language === 'string'\n ) {\n dryRunText = generateDummyText(targetLength, 'translation');\n } else if (\n 'type' in generationInput &&\n typeof generationInput.type === 'string'\n ) {\n const tone = generationInput.type;\n dryRunText = generateDummyText(targetLength, tone);\n } else if ('customPrompt' in generationInput) {\n dryRunText = generateDummyText(targetLength, 'custom');\n } else {\n dryRunText = generateDummyText(targetLength, 'improved');\n }\n } else {\n dryRunText = generateDummyText(targetLength, 'generated');\n }\n\n // Return an async generator that streams the text in chunks\n return createStreamingTextGenerator(\n dryRunText,\n generationOptions.abortSignal\n );\n}\n\nasync function* createStreamingTextGenerator(\n finalText: string,\n abortSignal?: AbortSignal\n): AsyncGenerator<TextOutput> {\n const chunkSize = Math.max(1, Math.ceil(finalText.length / 20)); // Split into ~20 chunks\n\n // Generate and yield text progressively\n let currentLength = 0;\n\n while (currentLength < finalText.length) {\n if (abortSignal?.aborted) {\n return;\n }\n\n // Calculate next chunk end\n const nextLength = Math.min(currentLength + chunkSize, finalText.length);\n const currentText = finalText.substring(0, nextLength);\n\n yield {\n kind: 'text',\n text: currentText\n };\n\n currentLength = nextLength;\n\n // Only add delay if there are more chunks to come\n if (currentLength < finalText.length) {\n // eslint-disable-next-line no-await-in-loop\n await wait(100);\n }\n }\n\n // Return the final complete text\n return {\n kind: 'text',\n text: finalText\n };\n}\n\nfunction generateDummyText(targetLength: number, style: string): string {\n const prefix = '[DRY RUN - Dummy Text] ';\n const prefixLength = prefix.length;\n\n // If target length is shorter than the prefix, just return truncated prefix\n if (targetLength <= prefixLength) {\n return prefix.substring(0, targetLength);\n }\n\n const remainingLength = targetLength - prefixLength;\n\n const baseTexts = {\n translation:\n 'Ceci est un texte fictif traduit qui maintient la longueur approximative.',\n professional:\n 'Enhanced professional content with improved clarity and structure.',\n casual: 'Relaxed, friendly text that keeps things simple and approachable.',\n formal: 'Refined formal documentation that preserves original structure.',\n humorous: 'Amusing content that brings lighthearted fun to the text.',\n improved: 'Enhanced text that demonstrates better clarity and readability.',\n custom: 'Customized content reflecting the requested modifications.',\n generated: 'AI-generated content maintaining original length and structure.'\n };\n\n const baseText =\n baseTexts[style as keyof typeof baseTexts] || baseTexts.generated;\n\n let contentText = '';\n if (remainingLength <= baseText.length) {\n contentText = baseText.substring(0, remainingLength);\n } else {\n // For longer text, repeat and vary the content\n contentText = baseText;\n const variations = [\n ' Additional content continues with similar phrasing.',\n ' Further elaboration maintains the established tone.',\n ' Extended content preserves the original style.',\n ' Continued text follows the same pattern.'\n ];\n\n let variationIndex = 0;\n while (contentText.length < remainingLength) {\n const nextVariation = variations[variationIndex % variations.length];\n if (contentText.length + nextVariation.length <= remainingLength) {\n contentText += nextVariation;\n } else {\n contentText += nextVariation.substring(\n 0,\n remainingLength - contentText.length\n );\n break;\n }\n variationIndex++;\n }\n }\n\n return prefix + contentText;\n}\n\nasync function getAudioDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'audio'>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n generationOptions: GenerationOptions\n): Promise<AudioOutput> {\n // Extract duration from generation input or use default\n let duration = 3; // Default to 3 seconds\n\n // Try to extract duration from input\n if (generationInput != null && typeof generationInput === 'object') {\n if (\n 'duration' in generationInput &&\n typeof generationInput.duration === 'number'\n ) {\n duration = generationInput.duration;\n } else if (\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ) {\n // Try to extract duration from prompt (e.g., \"5 seconds\", \"10s\", etc.)\n const promptStr = generationInput.prompt;\n const durationMatch = promptStr.match(/(\\d+)\\s*(?:seconds?|secs?|s)\\b/i);\n if (durationMatch) {\n duration = parseInt(durationMatch[1], 10);\n }\n }\n }\n\n // Try to get duration from block inputs\n if (options.blockInputs?.audio?.duration) {\n duration = options.blockInputs.audio.duration;\n }\n\n // Generate tone audio data\n const audioUrl = generateTone(220, duration); // 220Hz tone (A3 - deeper, more pleasant)\n\n return {\n kind: 'audio',\n url: audioUrl,\n duration,\n thumbnailUrl: undefined\n };\n}\n\nfunction generateTone(frequency: number, duration: number): string {\n const sampleRate = 44100;\n const numSamples = Math.floor(sampleRate * duration);\n\n // Generate sine wave PCM data\n const pcmData = new Float32Array(numSamples);\n for (let i = 0; i < numSamples; i++) {\n pcmData[i] = Math.sin((2 * Math.PI * frequency * i) / sampleRate);\n }\n\n return createWAVDataURI(pcmData, sampleRate);\n}\n\nfunction createWAVDataURI(pcmData: Float32Array, sampleRate: number): string {\n const numSamples = pcmData.length;\n const bytesPerSample = 2; // 16-bit\n const numChannels = 1; // Mono\n const blockAlign = numChannels * bytesPerSample;\n const byteRate = sampleRate * blockAlign;\n const dataSize = numSamples * bytesPerSample;\n const fileSize = 44 + dataSize; // 44 bytes for WAV header\n\n // Create WAV file buffer\n const buffer = new ArrayBuffer(fileSize);\n const view = new DataView(buffer);\n\n // WAV header\n const writeString = (offset: number, str: string) => {\n for (let i = 0; i < str.length; i++) {\n view.setUint8(offset + i, str.charCodeAt(i));\n }\n };\n\n writeString(0, 'RIFF');\n view.setUint32(4, fileSize - 8, true);\n writeString(8, 'WAVE');\n writeString(12, 'fmt ');\n view.setUint32(16, 16, true); // PCM chunk size\n view.setUint16(20, 1, true); // PCM format\n view.setUint16(22, numChannels, true);\n view.setUint32(24, sampleRate, true);\n view.setUint32(28, byteRate, true);\n view.setUint16(32, blockAlign, true);\n view.setUint16(34, 16, true); // Bits per sample\n writeString(36, 'data');\n view.setUint32(40, dataSize, true);\n\n // Convert float32 PCM to int16 and write to buffer\n let offset = 44;\n for (let i = 0; i < numSamples; i++) {\n const sample = Math.max(-1, Math.min(1, pcmData[i]));\n const intSample = Math.round(sample * 32767);\n view.setInt16(offset, intSample, true);\n offset += 2;\n }\n\n // Convert to base64\n const uint8Array = new Uint8Array(buffer);\n let binaryString = '';\n for (let i = 0; i < uint8Array.length; i++) {\n binaryString += String.fromCharCode(uint8Array[i]);\n }\n const base64 = btoa(binaryString);\n\n return `data:audio/wav;base64,${base64}`;\n}\n\nasync function wait(ms: number) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport default dryRunMiddleware;\n", "export const ABORT_REASON_USER_CANCEL = 'USER_CANCEL';\n", "import Provider, { Output, OutputKind } from '../core/provider';\nimport { composeMiddlewares, Middleware } from '../middleware/middleware';\nimport loggingMiddleware from '../middleware/loggingMiddleware';\nimport dryRunMiddleware from '../middleware/dryRunMiddleware';\nimport CreativeEditorSDK, { CreativeEngine } from '@cesdk/cesdk-js';\nimport { isAbortError, isAsyncGenerator } from '../utils/utils';\nimport { ABORT_REASON_USER_CANCEL } from '../core/constants';\n\nexport type ResultSuccess<O> =\n | { status: 'success'; type: 'async'; output: AsyncGenerator<O> }\n | { status: 'success'; type: 'sync'; output: O };\n\nexport type Result<O> =\n | ResultSuccess<O>\n | { status: 'error'; message: string }\n | { status: 'aborted' };\n\nexport type Generate<I, O extends Output> = (\n input: I,\n options?: {\n abortSignal?: AbortSignal;\n middlewares?: Middleware<I, O>[];\n debug?: boolean;\n dryRun?: boolean;\n }\n) => Promise<Result<O>>;\n\nfunction createGenerateFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n provider: Provider<K, I, O>;\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n}): Generate<I, O> {\n return async (input: I, options) => {\n if (options?.abortSignal?.aborted) return { status: 'aborted' };\n\n const composedMiddlewares = composeMiddlewares<I, O>([\n ...(context.provider.output.middleware ?? []),\n ...(options?.middlewares ?? []),\n loggingMiddleware({ enable: options?.debug }),\n dryRunMiddleware({\n enable: options?.dryRun,\n kind: context.provider.kind\n })\n ]);\n\n // Trigger the generation\n try {\n const { result: output } = await composedMiddlewares(\n context.provider.output.generate\n )(input, {\n abortSignal: options?.abortSignal,\n engine: context.engine,\n cesdk: context.cesdk\n });\n if (options?.abortSignal?.aborted) return { status: 'aborted' };\n if (output instanceof Error)\n return { status: 'error', message: output.message };\n if (output == null)\n return { status: 'error', message: 'No output generated' };\n\n if (isAsyncGenerator(output)) {\n return { status: 'success', type: 'async', output };\n } else {\n return { status: 'success', type: 'sync', output };\n }\n } catch (error) {\n if (isAbortError(error)) {\n return { status: 'aborted', message: error.message };\n }\n if (error === ABORT_REASON_USER_CANCEL) {\n return { status: 'aborted', message: error };\n }\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\nexport default createGenerateFunction;\n", "import CreativeEditorSDK, { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport createPanelRenderFunction from '../ui/panels/createPanelRenderFunction';\nimport {\n CommonPluginConfiguration,\n InternalPluginConfiguration,\n InitializationContext\n} from '../types';\nimport initializeHistoryAssetSource from '../assets/initializeHistoryAssetSource';\nimport initializeHistoryAssetLibraryEntry from '../assets/initializeHistoryAssetLibraryEntry';\nimport icons from '../ui/icons';\nimport createGenerateFunction, {\n type Generate\n} from '../generation/createGenerateFunction';\nimport { ProviderRegistry } from '../core/ProviderRegistry';\nimport { ActionRegistry } from '../core/ActionRegistry';\nimport { addIconSetOnce } from '../utils/utils';\n\nexport type ProviderInitializationResult<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n provider: Provider<K, I, O>;\n\n panel: {\n builderRenderFunction?: BuilderRenderFunction;\n };\n\n history: {\n assetSourceId?: string;\n assetLibraryEntryId?: string;\n };\n\n generate: Generate<I, O>;\n};\n\n/**\n * Initializes a provider with the given configuration and options.\n */\nasync function initializeProvider<K extends OutputKind, I, O extends Output>(\n _kind: K,\n provider: Provider<K, I, O>,\n options: {\n cesdk: CreativeEditorSDK;\n },\n config: CommonPluginConfiguration<K, I, O>\n): Promise<ProviderInitializationResult<K, I, O>> {\n // Create internal config with provider\n const internalConfig: InternalPluginConfiguration<K, I, O> = {\n ...config,\n provider\n };\n\n const context: InitializationContext<K, I, O> = {\n provider,\n panelInput: provider.input?.panel,\n options: {\n cesdk: options.cesdk,\n engine: options.cesdk.engine\n },\n config: internalConfig\n };\n\n await provider.initialize?.({ ...options, engine: options.cesdk.engine });\n\n // Enable features for custom quick actions defined by this provider\n // Only enable features for quick actions that are not already known/registered by plugins\n if (provider.input?.quickActions?.supported) {\n const kind = provider.kind;\n const actionRegistry = ActionRegistry.get();\n\n Object.keys(provider.input.quickActions.supported).forEach(\n (quickActionId) => {\n // Check if this is a custom quick action (not already registered by a plugin)\n const existingAction = actionRegistry.getBy({\n id: quickActionId,\n type: 'quick'\n })[0];\n if (!existingAction) {\n // This is a custom quick action from the provider, enable its feature\n const featureId = `ly.img.plugin-ai-${kind}-generation-web.quickAction.${quickActionId}`;\n options.cesdk.feature.enable(featureId, true);\n }\n }\n );\n }\n\n const historyAssetSourceId = initializeHistoryAssetSource(context);\n const historyAssetLibraryEntryId = initializeHistoryAssetLibraryEntry(\n context,\n historyAssetSourceId\n );\n\n context.options.historyAssetSourceId = historyAssetSourceId;\n context.options.historyAssetLibraryEntryId = historyAssetLibraryEntryId;\n\n const generate = createGenerateFunction({\n provider,\n cesdk: options.cesdk,\n engine: options.cesdk.engine\n });\n\n const builderRenderFunction: BuilderRenderFunction | undefined =\n await createPanelRenderFunction(context, generate);\n\n addIconSetOnce(options.cesdk, '@imgly/plugin-ai-generation', icons);\n\n const providerInitializationResult: ProviderInitializationResult<K, I, O> = {\n provider,\n panel: {\n builderRenderFunction\n },\n history: {\n assetSourceId: historyAssetSourceId,\n assetLibraryEntryId: historyAssetLibraryEntryId\n },\n generate\n };\n\n ProviderRegistry.get().register(providerInitializationResult);\n\n return providerInitializationResult;\n}\n\nexport default initializeProvider;\n", "import { AggregatedAssetSource } from '@imgly/plugin-utils';\nimport { OutputKind } from '../core/provider';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Initializes the combined history asset source for the given asset sources.\n */\nfunction initializeHistoryCompositeAssetSource<K extends OutputKind>(options: {\n kind: K;\n cesdk: CreativeEditorSDK;\n historAssetSourceIds: string[];\n}): string | undefined {\n const { kind, cesdk, historAssetSourceIds } = options;\n const compositeAssetSourceId = `ly.img.ai.${kind}-generation.history`;\n\n if (cesdk.engine.asset.findAllSources().includes(compositeAssetSourceId)) {\n return compositeAssetSourceId;\n }\n\n const aggregatedImageAssetSource = new AggregatedAssetSource(\n compositeAssetSourceId,\n cesdk,\n historAssetSourceIds\n );\n cesdk.engine.asset.addSource(aggregatedImageAssetSource);\n\n return aggregatedImageAssetSource.id;\n}\n\nexport default initializeHistoryCompositeAssetSource;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n BuilderRenderFunctionContext,\n SelectValue\n} from '@cesdk/cesdk-js';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport initializeProvider, {\n ProviderInitializationResult\n} from './initializeProvider';\nimport { isGeneratingStateKey } from '../ui/components/renderGenerationComponents';\nimport { CommonPluginConfiguration } from '../types';\nimport initializeHistoryCompositeAssetSource from '../assets/initializeHistoryCompositeAssetSource';\nimport { isDefined } from '@imgly/plugin-utils';\n\nfunction createLabelArray<K extends OutputKind>(\n kind: K,\n key: string\n): string[] {\n return [\n `ly.img.plugin-ai-${kind}-generation-web.${key}`,\n `ly.img.plugin-ai-generation-web.${key}`,\n `ly.img.plugin-ai-generation-web.defaults.${key}`\n ];\n}\n\nexport type ProvidersInitializationResult<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * Combined panel render function for all providers.\n */\n panel: {\n builderRenderFunction?: BuilderRenderFunction;\n };\n\n /**\n * Combined history asset source and library entry IDs for the providers.\n */\n history?: {\n assetSourceId?: string;\n assetLibraryEntryId?: string;\n };\n\n /**\n * All individual initialization results of the providers, i.e.\n * the result of `initializeProvider` for every provider.\n */\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n};\n\n/**\n * Initializes the given providers for the specified output kind.\n *\n * - It will create a combined render function for all providers\n * that can be used in a panel\n *\n */\nasync function initializeProviders<K extends OutputKind, I, O extends Output>(\n kind: K,\n providers:\n | {\n fromText: Provider<K, I, O>[];\n fromImage: Provider<K, I, O>[];\n }\n | Provider<K, I, O>[],\n options: {\n cesdk: CreativeEditorSDK;\n },\n config: CommonPluginConfiguration<K, I, O>\n): Promise<ProvidersInitializationResult<K, I, O>> {\n // Set default translations\n const { cesdk } = options;\n cesdk.setTranslations({\n en: {\n 'ly.img.plugin-ai-generation-web.defaults.fromType.label': 'Input',\n 'ly.img.plugin-ai-generation-web.defaults.providerSelect.label':\n 'Provider',\n 'ly.img.plugin-ai-generation-web.defaults.fromText.label': 'Text',\n 'ly.img.plugin-ai-generation-web.defaults.fromImage.label': 'Image'\n }\n });\n\n let builderRenderFunction: BuilderRenderFunction | undefined;\n\n const providerResults: ProviderInitializationResult<K, I, O>[] = [];\n if (!Array.isArray(providers)) {\n const initializedFromTextProviders = await Promise.all(\n providers.fromText.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...initializedFromTextProviders);\n\n const initializedFromImageProviders = await Promise.all(\n providers.fromImage.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...initializedFromImageProviders);\n\n builderRenderFunction = getBuilderRenderFunctionByFromType({\n kind,\n prefix: `ly.img.ai.${kind}-generation`,\n initializedFromTextProviders,\n initializedFromImageProviders,\n cesdk\n });\n } else {\n const results = await Promise.all(\n providers.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...results);\n\n builderRenderFunction = getBuilderRenderFunctionByProvider({\n kind,\n prefix: kind,\n providerInitializationResults: providerResults,\n cesdk\n });\n }\n\n const compositeHistoryAssetSourceId = initializeHistoryCompositeAssetSource({\n kind,\n cesdk: options.cesdk,\n historAssetSourceIds: providerResults\n .map((result) => result.history?.assetSourceId)\n .filter(isDefined)\n });\n\n let compositeHistoryAssetLibraryEntryId: string | undefined;\n\n if (compositeHistoryAssetSourceId != null) {\n compositeHistoryAssetLibraryEntryId = compositeHistoryAssetSourceId;\n options.cesdk.ui.addAssetLibraryEntry({\n id: compositeHistoryAssetLibraryEntryId,\n sourceIds: [compositeHistoryAssetSourceId],\n sortBy: {\n sortKey: 'insertedAt',\n sortingOrder: 'Descending'\n },\n canRemove: true,\n gridItemHeight: 'square',\n gridBackgroundType: 'cover'\n });\n }\n\n return {\n panel: {\n builderRenderFunction\n },\n history: {\n assetSourceId: compositeHistoryAssetSourceId,\n assetLibraryEntryId: compositeHistoryAssetLibraryEntryId\n },\n providerInitializationResults: providerResults\n };\n}\n\n/**\n * Combines the render functions of the initialized providers into a single\n * render function that can be used in a panel. Will add select components\n * to switch between the different providers and input types.\n */\nfunction getBuilderRenderFunctionByFromType<\n K extends OutputKind,\n I,\n O extends Output\n>({\n kind,\n prefix,\n initializedFromTextProviders,\n initializedFromImageProviders,\n cesdk\n}: {\n kind: K;\n prefix: string;\n initializedFromTextProviders: ProviderInitializationResult<K, I, O>[];\n initializedFromImageProviders: ProviderInitializationResult<K, I, O>[];\n cesdk: CreativeEditorSDK;\n}): BuilderRenderFunction<{}> {\n const includeFromSwitch =\n initializedFromTextProviders.length > 0 &&\n initializedFromImageProviders.length > 0;\n\n const builderRenderFunction: BuilderRenderFunction = (context) => {\n const { builder, experimental, engine } = context;\n\n // Check if text and image input are enabled via Feature API\n const textInputFeatureId = `ly.img.plugin-ai-${kind}-generation-web.fromText`;\n const isTextInputEnabled = cesdk.feature.isEnabled(textInputFeatureId, {\n engine\n });\n const imageInputFeatureId = `ly.img.plugin-ai-${kind}-generation-web.fromImage`;\n const isImageInputEnabled = cesdk.feature.isEnabled(imageInputFeatureId, {\n engine\n });\n\n // Determine default input type based on what's enabled\n let defaultInputType: 'fromText' | 'fromImage' | undefined;\n if (\n isTextInputEnabled &&\n initializedFromTextProviders.length > 0 &&\n (!isImageInputEnabled || initializedFromImageProviders.length === 0)\n ) {\n defaultInputType = 'fromText';\n } else if (\n isImageInputEnabled &&\n initializedFromImageProviders.length > 0 &&\n (!isTextInputEnabled || initializedFromTextProviders.length === 0)\n ) {\n defaultInputType = 'fromImage';\n } else if (isTextInputEnabled && isImageInputEnabled && includeFromSwitch) {\n defaultInputType = 'fromText';\n }\n\n const inputTypeState = experimental.global<\n 'fromText' | 'fromImage' | undefined\n >(`${prefix}.fromType`, defaultInputType);\n\n const providerInitializationResults: ProviderInitializationResult<\n K,\n I,\n O\n >[] = [];\n if (inputTypeState.value === 'fromText') {\n providerInitializationResults.push(...initializedFromTextProviders);\n } else if (inputTypeState.value === 'fromImage') {\n providerInitializationResults.push(...initializedFromImageProviders);\n } else {\n providerInitializationResults.push(\n ...initializedFromTextProviders,\n ...initializedFromImageProviders\n );\n }\n\n const providerValuesFromText: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = initializedFromTextProviders.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerValuesFromImage: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = initializedFromImageProviders.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerStateFromText = context.experimental.global(\n `${prefix}.selectedProvider.fromText`,\n providerValuesFromText[0]\n );\n const providerStateFromImage = context.experimental.global(\n `${prefix}.selectedProvider.fromImage`,\n providerValuesFromImage[0]\n );\n\n const providerState =\n inputTypeState.value === 'fromText'\n ? providerStateFromText\n : inputTypeState.value === 'fromImage'\n ? providerStateFromImage\n : undefined;\n\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${kind}-generation-web.providerSelect`;\n const isProviderSelectorEnabled = cesdk.feature.isEnabled(\n providerFeatureId,\n { engine }\n );\n\n // Check if neither text nor image input is enabled\n if (!isTextInputEnabled && !isImageInputEnabled) {\n builder.Section(`${prefix}.noInputWarning.section`, {\n children: () => {\n builder.Text(`${prefix}.noInputWarning.text`, {\n content:\n 'No input types are enabled. Please enable at least one input type (text or image) via the Feature API.'\n });\n }\n });\n return; // Exit early, don't render anything else\n }\n\n // Determine if we need to show the input selector\n // Only show if both types are enabled AND both have providers\n const bothInputsEnabled =\n isTextInputEnabled &&\n isImageInputEnabled &&\n initializedFromTextProviders.length > 0 &&\n initializedFromImageProviders.length > 0;\n const shouldShowInputSelector = includeFromSwitch && bothInputsEnabled;\n const shouldShowProviderSelector =\n providerInitializationResults.length > 1 && isProviderSelectorEnabled;\n\n if (shouldShowInputSelector || shouldShowProviderSelector) {\n builder.Section(`${prefix}.providerSelection.section`, {\n children: () => {\n // RENDER FROM SELECTION - only if both input types are enabled\n if (shouldShowInputSelector) {\n builder.ButtonGroup(`${prefix}.fromType.buttonGroup`, {\n inputLabel: createLabelArray(kind, 'fromType.label'),\n children: () => {\n if (\n isTextInputEnabled &&\n initializedFromTextProviders.length > 0\n ) {\n builder.Button(`${prefix}.fromType.buttonGroup.fromText`, {\n label: createLabelArray(kind, 'fromText.label'),\n icon:\n inputTypeState.value !== 'fromText' &&\n isSomeProviderGenerating(\n initializedFromTextProviders,\n context\n )\n ? '@imgly/LoadingSpinner'\n : undefined,\n isActive: inputTypeState.value === 'fromText',\n onClick: () => {\n inputTypeState.setValue('fromText');\n }\n });\n }\n\n if (\n isImageInputEnabled &&\n initializedFromImageProviders.length > 0\n ) {\n builder.Button(`${prefix}.fromType.buttonGroup.fromImage`, {\n label: createLabelArray(kind, 'fromImage.label'),\n icon:\n inputTypeState.value !== 'fromImage' &&\n isSomeProviderGenerating(\n initializedFromImageProviders,\n context\n )\n ? '@imgly/LoadingSpinner'\n : undefined,\n isActive: inputTypeState.value === 'fromImage',\n onClick: () => {\n inputTypeState.setValue('fromImage');\n }\n });\n }\n }\n });\n }\n\n // RENDER PROVIDER SELECT\n if (shouldShowProviderSelector) {\n const providerValues =\n inputTypeState.value === 'fromText'\n ? providerValuesFromText\n : inputTypeState.value === 'fromImage'\n ? providerValuesFromImage\n : [...providerValuesFromText, ...providerValuesFromImage];\n\n if (providerState != null) {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: createLabelArray(kind, 'providerSelect.label'),\n values: providerValues,\n ...providerState\n });\n }\n }\n }\n });\n }\n\n // Render the provider content\n if (providerInitializationResults.length > 1) {\n providerState?.value.builderRenderFunction?.(context);\n } else {\n const providerInitializationResult = providerInitializationResults[0];\n if (providerInitializationResult) {\n providerInitializationResult.panel?.builderRenderFunction?.(context);\n }\n }\n };\n\n return builderRenderFunction;\n}\n\n/**\n * Combines the render functions of the initialized providers into a single\n * render function that can be used in a panel. Will add select components\n * to switch between the different providers and input types.\n */\nfunction getBuilderRenderFunctionByProvider<\n K extends OutputKind,\n I,\n O extends Output\n>({\n kind,\n prefix,\n providerInitializationResults,\n cesdk\n}: {\n kind: K;\n prefix: string;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n cesdk: CreativeEditorSDK;\n}): BuilderRenderFunction<{}> {\n const builderRenderFunction: BuilderRenderFunction = (context) => {\n const { builder, engine } = context;\n if (providerInitializationResults.length === 0) return;\n\n // Check if provider selector is enabled via Feature API\n // Audio plugin has special cases for speech and sound providers\n let providerFeatureId = `ly.img.plugin-ai-${kind}-generation-web.providerSelect`;\n // For audio, we check prefix to determine if it's speech or sound\n if (kind === 'audio' && prefix) {\n if (prefix.includes('speech')) {\n providerFeatureId = `ly.img.plugin-ai-audio-generation-web.speech.providerSelect`;\n } else if (prefix.includes('sound')) {\n providerFeatureId = `ly.img.plugin-ai-audio-generation-web.sound.providerSelect`;\n }\n }\n const isProviderSelectorEnabled = cesdk.feature.isEnabled(\n providerFeatureId,\n { engine }\n );\n\n const providerValues: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = providerInitializationResults.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerState = context.state(\n `${prefix}.selectedProvider`,\n providerValues[0]\n );\n\n if (providerInitializationResults.length > 1 && isProviderSelectorEnabled) {\n if (providerState != null) {\n builder.Section(`${prefix}.providerSelection.section`, {\n children: () => {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: createLabelArray(kind, 'providerSelect.label'),\n values: providerValues,\n ...providerState\n });\n }\n });\n }\n }\n\n // Render the provider content\n providerState.value.builderRenderFunction?.(context);\n };\n\n return builderRenderFunction;\n}\n\n/**\n * Queries the global state to check if any provider from the given\n * list is currently generating.\n */\nfunction isSomeProviderGenerating<K extends OutputKind, I, O extends Output>(\n providerInitializationResults: ProviderInitializationResult<K, I, O>[],\n context: BuilderRenderFunctionContext<any>\n): boolean {\n if (providerInitializationResults.length === 0) return false;\n return providerInitializationResults.some(({ provider }) => {\n if (provider.id == null) return false;\n return context.experimental.global(isGeneratingStateKey(provider.id), false)\n .value;\n });\n}\n\nexport default initializeProviders;\n", "export const AI_EDIT_MODE = 'ly.img.ai.editMode';\n\nexport const AI_METADATA_KEY = 'ly.img.ai.metadata';\n\nexport const AI_CONFIRMATION_COMPONENT_ID = 'ly.img.ai.confirmation.canvasMenu';\n\nexport function getFeatureIdForQuickAction(options: {\n quickActionId: string;\n quickActionMenuId: string;\n}) {\n return `ly.img.ai.quickAction.${options.quickActionMenuId}.${options.quickActionId}`;\n}\n", "import CreativeEditorSDK, { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { InferenceMetadata } from '../quickActions/types';\nimport { Metadata } from '@imgly/plugin-utils';\nimport { AI_METADATA_KEY } from '../quickActions/utils';\nimport { OutputKind } from '../../core/provider';\nimport { Callbacks } from '../../generation/CallbacksRegistry';\n\n/**\n * Creates a render function for the AI inference confirmation component.\n *\n * It will render 'cancel', 'before', 'after', and 'apply' buttons once the\n * inference is done. Until then a loading spinner is shown with a cancel button.\n *\n * The callbacks are provided by the payload from the context.\n */\nasync function createConfirmationRenderFunction<K extends OutputKind>(context: {\n kind: K;\n\n cesdk: CreativeEditorSDK;\n}): Promise<BuilderRenderFunction<Callbacks>> {\n const prefix = `ly.img.ai.${context.kind}.confirmation`;\n context.cesdk?.i18n.setTranslations({\n en: {\n 'ly.img.ai.processing': 'Generating...',\n [`${prefix}.cancel`]: 'Cancel Generation',\n [`${prefix}.apply`]: 'Apply Generation',\n [`${prefix}.before`]: 'Before',\n [`${prefix}.after`]: 'After'\n }\n });\n const builderRenderFunction: BuilderRenderFunction<Callbacks> = (\n builderContext\n ) => {\n const { engine, builder, state, payload } = builderContext;\n if (payload == null) return;\n\n const blockIds = engine.block.findAllSelected();\n if (blockIds.length === 0) return null;\n\n const md = new Metadata<InferenceMetadata>(engine, AI_METADATA_KEY);\n\n // All blocks must have the same metadata\n const metadata = md.get(blockIds[0]);\n if (metadata == null) return null;\n\n const clearMetadata = () => {\n blockIds.forEach((blockId) => {\n md.clear(blockId);\n });\n };\n\n switch (metadata.status) {\n case 'processing': {\n builder.Button(`${prefix}.spinner`, {\n label: [\n `ly.img.ai.${metadata.quickActionId}.processing`,\n `ly.img.ai.processing`\n ],\n isLoading: true\n });\n builder.Separator(`${prefix}.separator`);\n builder.Button(`${prefix}.cancel`, {\n icon: '@imgly/Cross',\n tooltip: `${prefix}.cancel`,\n onClick: () => {\n payload.onCancelGeneration?.();\n clearMetadata();\n }\n });\n\n break;\n }\n\n case 'confirmation': {\n const comparingState = state<'before' | 'after'>(\n `${prefix}.comparing`,\n 'after'\n );\n\n const onCancel = payload.applyCallbacks?.onCancel;\n if (onCancel != null) {\n builder.Button(`${prefix}.cancel`, {\n icon: '@imgly/Cross',\n tooltip: `${prefix}.cancel`,\n onClick: () => {\n onCancel();\n clearMetadata();\n }\n });\n }\n\n const onBefore = payload.applyCallbacks?.onBefore;\n const onAfter = payload.applyCallbacks?.onAfter;\n\n if (onBefore != null && onAfter != null) {\n builder.ButtonGroup(`${prefix}.compare`, {\n children: () => {\n builder.Button(`${prefix}.compare.before`, {\n label: `${prefix}.before`,\n variant: 'regular',\n isActive: comparingState.value === 'before',\n onClick: () => {\n onBefore();\n comparingState.setValue('before');\n }\n });\n builder.Button(`${prefix}.compare.after`, {\n label: `${prefix}.after`,\n variant: 'regular',\n isActive: comparingState.value === 'after',\n onClick: () => {\n onAfter();\n comparingState.setValue('after');\n }\n });\n }\n });\n }\n\n const onApply = payload.applyCallbacks?.onApply;\n if (onApply != null) {\n builder.Button(`${prefix}.apply`, {\n icon: '@imgly/Checkmark',\n tooltip: `${prefix}.apply`,\n color: 'accent',\n isDisabled: comparingState.value !== 'after',\n onClick: () => {\n clearMetadata();\n\n const editor = context.cesdk.engine.editor as any;\n if (typeof editor._update === 'function') {\n // Activating the old history happens in the next update lop.\n editor._update();\n }\n\n onApply();\n }\n });\n }\n\n break;\n }\n\n default: {\n // noop\n }\n }\n };\n return Promise.resolve(builderRenderFunction);\n}\n\nexport default createConfirmationRenderFunction;\n", "/**\n * For the given array that contains strings `ly.img.separator` and other items,\n * this function will remove all leading and trailing separators,\n * as well as any consecutive separators in between.\n */\nfunction compactSeparators<T>(\n quickActions: (T | 'ly.img.separator')[]\n): (T | 'ly.img.separator')[] {\n if (quickActions.length === 0) {\n return [];\n }\n\n // Create a new array for the result\n const result = [...quickActions];\n\n // Remove separators at the beginning\n while (result.length > 0 && result[0] === 'ly.img.separator') {\n result.shift();\n }\n\n // Remove separators at the end\n while (\n result.length > 0 &&\n result[result.length - 1] === 'ly.img.separator'\n ) {\n result.pop();\n }\n\n // Remove consecutive separators\n return result.reduce<(T | 'ly.img.separator')[]>((acc, current) => {\n // Skip if current is a separator and previous was also a separator\n if (\n current === 'ly.img.separator' &&\n acc.length > 0 &&\n acc[acc.length - 1] === 'ly.img.separator'\n ) {\n return acc;\n }\n\n acc.push(current);\n return acc;\n }, []);\n}\n\nexport default compactSeparators;\n", "import { OutputKind } from '../core/provider';\n\nfunction getQuickActionCanvasMenuComponentId<K extends OutputKind>(\n kind: K\n): string {\n return `ly.img.ai.${kind}.canvasMenu`;\n}\n\nexport default getQuickActionCanvasMenuComponentId;\n", "import CreativeEditorSDK, { ComponentPayload } from '@cesdk/cesdk-js';\nimport getQuickActionCanvasMenuComponentId from '../../providers/getCanvasMenuComponentId';\nimport { OutputKind } from '../../core/provider';\n\n/**\n * Returns the current order of quick actions for a particular kind.\n */\nfunction getQuickActionOrder<K extends OutputKind>(context: {\n kind: K;\n cesdk: CreativeEditorSDK;\n payload?: ComponentPayload;\n defaultOrder?: string[];\n}): string[] {\n const { kind, cesdk, payload, defaultOrder } = context;\n const canvasMenuComponentId = getQuickActionCanvasMenuComponentId(kind);\n\n if (payload == null || !Array.isArray(payload.children)) {\n // Fallback to get the children order from the canvas menu order.\n // Happens e.g. for CE.SDK versions < 1.53.0 because the payload\n // is not passed correctly to the render function.\n const canvasMenuOrder = cesdk.ui.getCanvasMenuOrder();\n const component = canvasMenuOrder.find(({ id }) => {\n return id === canvasMenuComponentId;\n });\n\n if (component != null && Array.isArray(component.children)) {\n return component.children;\n } else {\n // Use provided default order or empty array for backwards compatibility\n return defaultOrder ?? [];\n }\n }\n return payload.children.filter(\n (child) => typeof child === 'string'\n ) as string[];\n}\n\nexport default getQuickActionOrder;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport {\n getImageDimensionsFromURL,\n mimeTypeToExtension\n} from '@imgly/plugin-utils';\nimport {\n ImageOutput,\n TextOutput,\n type Output,\n type OutputKind\n} from '../core/provider';\nimport { ResultSuccess } from '../generation/createGenerateFunction';\n\nexport type ApplyCallbacks = {\n onBefore: () => void;\n onAfter: () => void;\n onCancel: () => void;\n onApply: () => void;\n};\n\ntype GetApplyCallbacksOptions = {\n kind: OutputKind;\n blockIds: number[];\n cesdk: CreativeEditorSDK;\n abortSignal?: AbortSignal;\n};\n\ntype ReturnValue = {\n applyCallbacks: ApplyCallbacks;\n};\n\n/**\n * This method is used in the quick action menu to handle the result of the generation\n * and providing methods for the comparision of the result.\n *\n * Different output kinds require different handling. E.g. the text generation\n * is streamed to the text block, while the image generation is applied to the fill\n * block with a source set and the same crop applied.\n */\nfunction getApplyCallbacks<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n if (options.blockIds.some((id) => !options.cesdk.engine.block.isValid(id))) {\n return Promise.resolve({\n applyCallbacks: {\n onBefore: () => {},\n onAfter: () => {},\n onCancel: () => {},\n onApply: () => {}\n }\n });\n }\n switch (options.kind) {\n case 'text':\n return getApplyCallbacksForText(result, options);\n case 'image':\n return getApplyCallbacksForImage(result, options);\n case 'video':\n return getApplyCallbacksForVideo(result, options);\n case 'audio':\n return getApplyCallbacksForAudio(result, options);\n default:\n throw new Error(\n `Unsupported output kind for quick actions: ${options.kind}`\n );\n }\n}\n\nasync function getApplyCallbacksForText<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n const { cesdk, blockIds, abortSignal } = options;\n\n const beforeTexts = blockIds.map((blockId) => {\n return cesdk.engine.block.getString(blockId, 'text/text');\n });\n\n let output: O | undefined;\n if (result.type === 'async') {\n let inferredText = '';\n for await (const chunk of result.output) {\n if (abortSignal?.aborted) {\n break;\n }\n if (typeof chunk === 'string') {\n inferredText = chunk;\n } else if (chunk.kind === 'text') {\n inferredText = chunk.text;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-loop-func\n blockIds.forEach((blockId) => {\n cesdk.engine.block.setString(blockId, 'text/text', inferredText);\n });\n\n const textOutput: TextOutput = {\n kind: 'text',\n text: inferredText\n };\n output = textOutput as O;\n }\n } else {\n output = result.output;\n }\n\n if (output == null || output.kind !== 'text') {\n throw new Error('Output kind from generation is not text');\n }\n\n // For sync results, apply the text immediately (like streaming does)\n if (result.type === 'sync') {\n blockIds.forEach((blockId) => {\n cesdk.engine.block.setString(blockId, 'text/text', output.text);\n });\n }\n\n const onAfter = () => {\n options.blockIds.forEach((blockId) => {\n options.cesdk.engine.block.setString(blockId, 'text/text', output.text);\n });\n };\n const onBefore = () => {\n options.blockIds.forEach((blockId, i) => {\n options.cesdk.engine.block.setString(\n blockId,\n 'text/text',\n beforeTexts[i]\n );\n });\n };\n const onCancel = onBefore;\n const onApply = () => {\n onAfter();\n options.cesdk.engine.editor.addUndoStep();\n };\n\n return {\n applyCallbacks: {\n onBefore,\n onAfter,\n onCancel,\n onApply\n }\n };\n}\n\nasync function getApplyCallbacksForImage<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n const { cesdk, blockIds, abortSignal } = options;\n if (blockIds.length !== 1) {\n throw new Error('Only one block is supported for image generation');\n }\n\n const [block] = blockIds;\n const fillBlock = cesdk.engine.block.getFill(block);\n const sourceSetBefore = cesdk.engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [sourceBefore] = sourceSetBefore;\n let uriBefore: string | undefined;\n if (sourceBefore == null) {\n uriBefore = cesdk.engine.block.getString(\n fillBlock,\n 'fill/image/imageFileURI'\n );\n }\n\n const mimeType = await cesdk.engine.editor.getMimeType(\n sourceBefore?.uri ?? uriBefore\n );\n const originalDimension = await getImageDimensionsFromURL(\n sourceBefore?.uri ?? uriBefore,\n options.cesdk.engine\n );\n const originalAspectRatio =\n originalDimension.width / originalDimension.height;\n abortSignal?.throwIfAborted();\n\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n\n const cropScaleX = cesdk.engine.block.getCropScaleX(block);\n const cropScaleY = cesdk.engine.block.getCropScaleY(block);\n const cropTranslationX = cesdk.engine.block.getCropTranslationX(block);\n const cropTranslationY = cesdk.engine.block.getCropTranslationY(block);\n const cropRotation = cesdk.engine.block.getCropRotation(block);\n\n const applyCrop = () => {\n cesdk.engine.block.setCropScaleX(block, cropScaleX);\n cesdk.engine.block.setCropScaleY(block, cropScaleY);\n cesdk.engine.block.setCropTranslationX(block, cropTranslationX);\n cesdk.engine.block.setCropTranslationY(block, cropTranslationY);\n cesdk.engine.block.setCropRotation(block, cropRotation);\n };\n\n if (result.type === 'async') {\n throw new Error('Streaming generation is not supported yet from a panel');\n }\n\n if (result.output.kind !== 'image' || typeof result.output.url !== 'string') {\n throw new Error('Output kind from generation is not an image');\n }\n\n const url = (result.output as ImageOutput).url;\n const generatedMimeType = await cesdk.engine.editor.getMimeType(url);\n\n const uri = await reuploadImage(cesdk, url, generatedMimeType);\n const generatedDimension = await getImageDimensionsFromURL(\n uri,\n options.cesdk.engine\n );\n const generatedAspectRatio =\n generatedDimension.width / generatedDimension.height;\n\n const differentAspectRatio =\n Math.abs(originalAspectRatio - generatedAspectRatio) > 0.001;\n\n const sourceSetAfter = sourceBefore\n ? [\n {\n uri,\n width: generatedDimension.width,\n height: generatedDimension.height\n }\n ]\n : undefined;\n const uriAfter = uri;\n\n if (sourceSetAfter == null) {\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriAfter\n );\n } else {\n cesdk.engine.block.setString(fillBlock, 'fill/image/imageFileURI', '');\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetAfter\n );\n }\n\n await cesdk.engine.block.forceLoadResources([fillBlock]);\n\n if (differentAspectRatio) {\n cesdk.engine.block.setContentFillMode(block, 'Cover');\n } else {\n applyCrop();\n }\n\n const onBefore = () => {\n if (sourceSetBefore == null || sourceSetBefore.length === 0) {\n if (uriBefore == null) {\n throw new Error('No image URI found');\n }\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriBefore\n );\n } else {\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetBefore\n );\n }\n applyCrop();\n };\n const onAfter = () => {\n if (sourceSetAfter == null) {\n if (uriAfter == null) {\n throw new Error('No image URI found');\n }\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriAfter\n );\n } else {\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetAfter\n );\n }\n if (differentAspectRatio) {\n cesdk.engine.block.setContentFillMode(block, 'Cover');\n } else {\n applyCrop();\n }\n };\n const onCancel = () => {\n onBefore();\n };\n const onApply = () => {\n onAfter();\n options.cesdk.engine.editor.addUndoStep();\n };\n\n return {\n applyCallbacks: {\n onBefore,\n onAfter,\n onCancel,\n onApply\n }\n };\n}\n\nasync function getApplyCallbacksForVideo<O extends Output>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _result: ResultSuccess<O>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n throw new Error('Function not implemented.');\n}\n\nasync function getApplyCallbacksForAudio<O extends Output>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _result: ResultSuccess<O>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n throw new Error('Function not implemented.');\n}\n\nasync function reuploadImage(\n cesdk: CreativeEditorSDK,\n url: string,\n mimeType: string\n): Promise<string> {\n const response = await fetch(url);\n const blob = await response.blob();\n const file = new File([blob], `image.${mimeTypeToExtension(mimeType)}`, {\n type: mimeType\n });\n const assetDefinition = await cesdk.unstable_upload(file, () => {});\n const uploadedUri = assetDefinition?.meta?.uri;\n if (uploadedUri != null) return uploadedUri;\n // eslint-disable-next-line no-console\n console.warn('Failed to upload image:', assetDefinition);\n return url;\n}\n\nexport default getApplyCallbacks;\n", "import { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Locks the selection to the given block ids with the given edit mode.\n *\n * @returns A function to unlock the selection. Will set the edit mode back to what it was before the lock.\n */\nfunction lockSelectionToEditMode(options: {\n engine: CreativeEngine;\n blockIdsToLock: number[];\n editModeToLockTo: string;\n}) {\n const { engine, blockIdsToLock, editModeToLockTo } = options;\n\n function isBoundBlockSelected() {\n const currentlySelectedBlockIds = engine.block.findAllSelected();\n return blockIdsToLock.some((blockId) => {\n return currentlySelectedBlockIds.includes(blockId);\n });\n }\n\n const stateChangeDisposer = engine.editor.onStateChanged(() => {\n const editMode = engine.editor.getEditMode();\n if (editMode !== editModeToLockTo && isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n }\n });\n\n const selectionDisposer = engine.block.onSelectionChanged(() => {\n if (isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n } else {\n engine.editor.setEditMode('Transform');\n }\n });\n\n if (isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n }\n\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n selectionDisposer();\n stateChangeDisposer();\n\n engine.editor.setEditMode('Transform');\n disposed = true;\n };\n\n return dispose;\n}\n\nexport default lockSelectionToEditMode;\n", "import { ApplyCallbacks } from '../providers/getApplyCallbacks';\n\nexport type Callbacks = {\n /**\n * Callbacks for the confirmation process.\n */\n applyCallbacks?: ApplyCallbacks;\n\n /**\n * Callback when generation is cancelled.\n */\n onCancelGeneration?: () => void;\n};\n\n/**\n * Global registry for managing callbacks for quick action menus across different\n * components.\n */\nexport class CallbacksRegistry {\n /** Map storing all registered callbacks by their ID */\n private actions: Map<number, Callbacks> = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the CallbacksRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n */\n public static get(): CallbacksRegistry {\n const globalKey = '__imgly_callbacks_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new CallbacksRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers apply callbacks in the registry.\n */\n public register(blockId: number, callbacks: Partial<Callbacks>) {\n const currentCallbacks = this.actions.get(blockId) ?? {};\n this.actions.set(blockId, {\n ...currentCallbacks,\n ...callbacks\n });\n }\n\n /**\n * Gets the callbacks for the given block id.\n */\n public get(blockId: number): Callbacks {\n return this.actions.get(blockId) ?? {};\n }\n}\n\nexport default CallbacksRegistry;\n", "import { isDefined, Metadata } from '@imgly/plugin-utils';\nimport { QuickActionDefinition } from '../core/ActionRegistry';\nimport { Result } from './createGenerateFunction';\nimport { ProviderInitializationResult } from '../providers/initializeProvider';\nimport { Middleware } from '../middleware/middleware';\nimport { Output, OutputKind } from '../core/provider';\nimport { AI_EDIT_MODE, AI_METADATA_KEY } from '../ui/quickActions/utils';\nimport { InferenceMetadata } from '../ui/quickActions/types';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\nimport getApplyCallbacks from '../providers/getApplyCallbacks';\nimport lockSelectionToEditMode from '../utils/lockSelectionToEditMode';\nimport CallbacksRegistry from './CallbacksRegistry';\nimport { ABORT_REASON_USER_CANCEL } from '../core/constants';\n\ntype GenerationOptions<\n Q extends Record<string, any>,\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * The blocks that this quick action is running on.\n */\n blockIds: number[];\n\n /**\n * The initlaized provider that is used to generate the output.\n */\n providerInitializationResult?: ProviderInitializationResult<K, I, O>;\n\n /**\n * The quick action definition that is used to generate input for the provider\n */\n quickAction: QuickActionDefinition<Q>;\n\n /**\n * Shall the generation be confirmed before applying the result? Or directly applied?\n */\n confirmation?: boolean;\n\n /**\n * Should the blocks be locked to edit mode while the generation is running?\n */\n lock?: boolean;\n\n /**\n * Additional middlewares added to the generation process.\n */\n middlewares?: Middleware<I, O>[];\n\n /**\n * Print debug information to the console.\n */\n debug?: boolean;\n\n /**\n * Enable dry run mode for testing.\n */\n dryRun?: boolean;\n\n /**\n * Signal to check if process was aborted\n */\n abortSignal?: AbortSignal;\n\n /**\n * Close the quick action menu\n */\n close: () => void;\n\n cesdk: CreativeEditorSDK;\n};\n\n/**\n * Handler for generating output from a quick action.\n */\nfunction handleGenerateFromQuickAction<\n Q extends Record<string, any>,\n K extends OutputKind,\n I,\n O extends Output\n>(\n options: GenerationOptions<Q, K, I, O>\n): (input: Q, generateOptions?: { blockIds?: number[] }) => Promise<Result<O>> {\n return async (input: Q, generateOptions?: { blockIds?: number[] }) => {\n // Use provided blockIds or fall back to default selection\n const targetBlockIds = generateOptions?.blockIds ?? options.blockIds;\n if (options.providerInitializationResult == null) {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Generate] No provider initialization result found for quick action. Returning abortion status.'\n );\n }\n return { status: 'aborted' };\n }\n\n const supportValue =\n options.providerInitializationResult?.provider.input?.quickActions\n ?.supported?.[options.quickAction.id];\n\n if (supportValue == null) {\n throw new Error(\n '[Generate] Quick action input mapping failed. Ensure the provider supports this quick action.'\n );\n }\n\n // Handle both `true` and `{ mapInput: ... }` cases\n const mapInput =\n typeof supportValue === 'object' &&\n supportValue !== null &&\n 'mapInput' in supportValue\n ? supportValue.mapInput\n : (i: Q) => i as unknown as I; // Identity function when types are compatible\n\n options.close();\n\n const abortController = new AbortController();\n const abortSignal = AbortSignal.any(\n [options.abortSignal, abortController.signal].filter(isDefined)\n );\n\n const metadata = new Metadata<InferenceMetadata>(\n options.cesdk.engine,\n AI_METADATA_KEY\n );\n\n const unlockFromEditMode =\n options.lock ?? true\n ? lockSelectionToEditMode({\n engine: options.cesdk.engine,\n editModeToLockTo: AI_EDIT_MODE,\n blockIdsToLock: targetBlockIds\n })\n : () => {\n /* No-op if not locking to edit mode */\n };\n targetBlockIds.forEach((blockId) => {\n CallbacksRegistry.get().register(blockId, {\n onCancelGeneration: () => {\n abortController.abort(ABORT_REASON_USER_CANCEL);\n unlockFromEditMode();\n\n if (options.cesdk.engine.block.isValid(blockId)) {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n metadata.clear(blockId);\n }\n }\n });\n });\n\n targetBlockIds?.forEach((blockId) => {\n metadata.set(blockId, {\n status: 'processing',\n quickActionId: options.quickAction.id\n });\n });\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, {\n type: 'Pending',\n progress: 0\n });\n });\n\n try {\n const result = await options.providerInitializationResult.generate(\n mapInput(input),\n {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n }\n );\n\n const resultStatus = result.status;\n switch (resultStatus) {\n case 'success': {\n const { applyCallbacks: initialApplyCallbacks } =\n await getApplyCallbacks(result, {\n kind: options.providerInitializationResult.provider.kind,\n blockIds: targetBlockIds,\n cesdk: options.cesdk,\n abortSignal\n });\n\n // Set the blocks to a ready state AFTER `getApplyCallbacks` was called since\n // it will set the block to the \"after\" image and until then we still want\n // the spinner spinning.\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n });\n\n if (options.confirmation) {\n // For the same as the Ready state, we do this AFTER `getApplyCallbacks` was called\n targetBlockIds.forEach((blockId) => {\n // Metadata will be cleared in the confirmation component\n // see createConfirmationRenderFunction.ts\n metadata.set(blockId, {\n status: 'confirmation',\n quickActionId: options.quickAction.id\n });\n });\n\n const applyCallbacks = {\n ...initialApplyCallbacks,\n onApply: async () => {\n initialApplyCallbacks.onApply();\n unlockFromEditMode();\n },\n onCancel: () => {\n initialApplyCallbacks.onCancel();\n unlockFromEditMode();\n }\n };\n\n targetBlockIds.forEach((blockId) => {\n CallbacksRegistry.get().register(blockId, { applyCallbacks });\n });\n } else {\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n // Apply the result directly\n initialApplyCallbacks.onApply();\n unlockFromEditMode();\n }\n\n return result;\n }\n\n case 'aborted': {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.log('Generation was aborted');\n }\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n return result;\n }\n\n case 'error': {\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n // eslint-disable-next-line no-console\n console.error(`[Generate]: ${result.message}`);\n return result;\n }\n\n default: {\n throw new Error(`[Generate] Unknown result status ${resultStatus}.`);\n }\n }\n } catch (error) {\n options.cesdk.ui.showNotification({\n type: 'error',\n message: 'A technical issue has occurred.'\n });\n\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n throw error;\n } finally {\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n });\n }\n };\n}\n\nexport default handleGenerateFromQuickAction;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n CreativeEngine,\n SelectValue\n} from '@cesdk/cesdk-js';\nimport {\n ActionRegistry,\n QuickActionDefinition\n} from '../../core/ActionRegistry';\nimport { Output, OutputKind } from '../../core/provider';\nimport { isDefined } from '@imgly/plugin-utils';\nimport { AI_EDIT_MODE } from './utils';\nimport compactSeparators from '../../utils/compactSeparators';\nimport getQuickActionOrder from './getQuickActionOrder';\nimport { ProviderInitializationResult } from '../../providers/initializeProvider';\nimport handleGenerateFromQuickAction from '../../generation/handleGenerateFromQuickAction';\nimport { Middleware } from '../../middleware/middleware';\nimport { ProviderRegistry } from '../../core/ProviderRegistry';\n\ntype SupportedQuickAction<K extends OutputKind, I, O extends Output> = {\n definition: QuickActionDefinition<any>;\n /**\n * If defined this provider is used to render the quick action.\n * Otherwise the quick action is rendered with the main provider\n * defined one level up.\n *\n * Used for quick actions that have been defined from a provider\n * that is not the main kind/provider, e.g. a video plugin\n * that defines a quick action for the image provider.\n */\n providerInitializationResult?: ProviderInitializationResult<K, I, O>;\n};\n\ntype SupportedProviderQuickActions<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * The main provider from the provider selection\n */\n providerInitializationResult: ProviderInitializationResult<K, I, O>;\n quickActions: (SupportedQuickAction<K, I, O> | 'ly.img.separator')[];\n}[];\n\nfunction createQuickActionMenuRenderFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n kind: K;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n\n debug?: boolean;\n dryRun?: boolean;\n defaultOrder?: string[];\n}): Promise<BuilderRenderFunction<any>> {\n const prefix = `ly.img.ai.${context.kind}}`;\n\n context.cesdk.i18n.setTranslations({\n en: {\n [`ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`]:\n 'Provider'\n }\n });\n\n const builderRenderFunction: BuilderRenderFunction<{\n children: ('ly.img.separator' | (string & {}))[];\n }> = (builderContext) => {\n if (builderContext.engine.editor.getEditMode() === AI_EDIT_MODE) {\n return;\n }\n\n const blockIds = builderContext.engine.block.findAllSelected();\n if (blockIds.length === 0) return;\n\n // Check if the general quickAction feature is enabled\n const quickActionFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction`;\n const isQuickActionFeatureEnabled = context.cesdk.feature.isEnabled(\n quickActionFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (!isQuickActionFeatureEnabled) {\n // Quick actions are disabled for this plugin\n return;\n }\n\n const { payload } = builderContext;\n const order =\n getQuickActionOrder({\n kind: context.kind,\n cesdk: context.cesdk,\n payload,\n defaultOrder: context.defaultOrder\n }) ?? [];\n\n if (order.length === 0) return;\n\n // Get ordered and filtered list of defined quick actions\n const orderedQuickActions = getOrderedQuickActionDefinitions(order).filter(\n (quickActionDefinition) => {\n if (quickActionDefinition === 'ly.img.separator') return true;\n\n // Check if this individual quick action is enabled via Feature API\n // Remove the 'ly.img.' prefix from the action ID for the feature key\n const actionName = quickActionDefinition.id.replace('ly.img.', '');\n const individualQuickActionFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.${actionName}`;\n const isIndividualQuickActionEnabled = context.cesdk.feature.isEnabled(\n individualQuickActionFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (!isIndividualQuickActionEnabled) {\n return false;\n }\n\n const scopes = quickActionDefinition.scopes;\n if (scopes != null && scopes.length > 0) {\n const isAllowedByScopes = blockIds.every((blockId) => {\n return scopes.every((scope) => {\n return context.engine.block.isAllowedByScope(blockId, scope);\n });\n });\n if (!isAllowedByScopes) return false;\n }\n\n if (quickActionDefinition.enable != null) {\n if (typeof quickActionDefinition.enable === 'function') {\n return quickActionDefinition.enable({\n engine: context.engine\n });\n } else if (typeof quickActionDefinition.enable === 'boolean') {\n return quickActionDefinition.enable;\n }\n }\n\n return true;\n }\n );\n\n // Collect quick actions that are defined by the main provider\n // in case the main provider does not support any quick actions\n // and we just want to render these.\n const quickActionsFromOtherProviders: SupportedQuickAction<K, I, O>[] = [];\n\n // Collect all provider with their supported quick actions\n const supportedProviderQuickActions =\n context.providerInitializationResults.reduce(\n (\n acc: SupportedProviderQuickActions<K, I, O>,\n providerInitializationResult\n ) => {\n if (providerInitializationResult.provider.kind !== context.kind)\n return acc;\n\n let quickActions = orderedQuickActions\n .map((quickAction) => {\n if (quickAction === 'ly.img.separator') return quickAction;\n\n // Check if the main provider supports this quick action\n if (\n providerInitializationResult.provider.input?.quickActions\n ?.supported?.[quickAction.id] != null\n ) {\n return {\n definition: quickAction\n };\n } else {\n // Check if this quick action comes from another provider that\n // is not the main provider.\n const otherProviderInitializationResult = ProviderRegistry.get()\n .getAll()\n .filter((registeredProvider) => {\n return (\n // We are looking for provider from another kind\n // and assume that all provider from the same kind\n // have been passed as main provider\n registeredProvider.provider.kind !== context.kind &&\n registeredProvider.provider.id !==\n providerInitializationResult.provider.id\n );\n })\n .find((registeredProvider) => {\n return (\n registeredProvider.provider.input?.quickActions\n ?.supported?.[quickAction.id] != null\n );\n });\n if (otherProviderInitializationResult != null) {\n const quickActionSupport: SupportedQuickAction<K, I, O> = {\n definition: quickAction,\n providerInitializationResult:\n otherProviderInitializationResult\n };\n quickActionsFromOtherProviders.push(quickActionSupport);\n return quickActionSupport;\n } else {\n return undefined;\n }\n }\n })\n .filter(isDefined);\n // Clean up the quick action list so we can render it directly\n quickActions = compactSeparators(quickActions);\n\n if (\n quickActions.length === 0 ||\n quickActions.every((entry) => entry === 'ly.img.separator')\n )\n return acc;\n\n if (\n quickActions.every(\n (quickAction) =>\n quickAction === 'ly.img.separator' ||\n quickAction.providerInitializationResult != null\n )\n ) {\n // This provider has no quick actions from the current main provider.\n // We do not want to add the main provider to the selection\n // list with just actions from other providers.\n return acc;\n }\n\n acc.push({\n providerInitializationResult,\n quickActions\n });\n\n return acc;\n },\n []\n );\n\n if (supportedProviderQuickActions.length === 0) {\n if (quickActionsFromOtherProviders.length > 0) {\n // Remove duplicates from quickActionsFromOtherProviders\n const seen = new Map<string, SupportedQuickAction<K, I, O>>();\n quickActionsFromOtherProviders.forEach((quickAction) => {\n const id = quickAction.definition.id;\n if (!seen.has(id)) {\n seen.set(id, quickAction);\n }\n });\n const uniqueQuickActions = Array.from(seen.values());\n\n // If we have quick actions from other providers, we can render them\n supportedProviderQuickActions.push({\n // Use the first provider as main but since we do not want to\n // render the provider selection, we do not care what provider it is.\n // The actual provider used is the one defined in the object.\n providerInitializationResult:\n uniqueQuickActions[0].providerInitializationResult ??\n context.providerInitializationResults[0],\n quickActions: uniqueQuickActions\n });\n } else {\n // Noting to do\n return;\n }\n }\n\n const providerValues: SelectValue[] = supportedProviderQuickActions.map(\n ({ providerInitializationResult }) => ({\n id: providerInitializationResult.provider.id,\n label:\n providerInitializationResult.provider.name ??\n providerInitializationResult.provider.id\n })\n );\n\n const currentProviderState = builderContext.experimental.global(\n `${prefix}.currentProvider`,\n providerValues[0]\n );\n const currentSupportedQuickActions = supportedProviderQuickActions.find(\n ({\n providerInitializationResult: {\n provider: { id }\n }\n }) => id === currentProviderState.value?.id\n );\n\n const isEveryBlockInReadyState = blockIds.every((blockId) => {\n return builderContext.engine.block.getState(blockId).type === 'Ready';\n });\n\n const { builder, experimental, state } = builderContext;\n\n const isGeneratingState = state<boolean>(`${prefix}.isGenerating`, false);\n const toggleExpandedState = state<string | undefined>(\n `${prefix}.toggleExpandedState`,\n undefined\n );\n\n // Middleware to track generation status\n const isGeneratingMiddleware: Middleware<I, O> = async (\n input,\n options,\n next\n ) => {\n isGeneratingState.setValue(true);\n try {\n const result = await next(input, options);\n return result;\n } finally {\n isGeneratingState.setValue(false);\n }\n };\n\n experimental.builder.Popover(`${prefix}.popover`, {\n icon: '@imgly/Sparkle',\n variant: 'plain',\n isDisabled: !isEveryBlockInReadyState,\n isLoading: isGeneratingState.value,\n trailingIcon: null,\n children: ({ close }) => {\n if (toggleExpandedState.value !== undefined) {\n // ==========================================\n // === RENDER EXPANDED QUICK ACTION STATE ===\n // ==========================================\n\n const expandedQuickAction =\n currentSupportedQuickActions?.quickActions.find(\n (quickAction) =>\n quickAction !== 'ly.img.separator' &&\n quickAction.definition.id === toggleExpandedState.value\n ) as SupportedQuickAction<K, I, O> | undefined;\n\n if (\n expandedQuickAction == null ||\n expandedQuickAction.definition.render == null\n ) {\n return;\n }\n\n // Use only providers that support the current expanded quick action\n const providerValuesForExpandedQuickAction: SelectValue[] =\n supportedProviderQuickActions\n .filter(({ quickActions }) =>\n quickActions.some(\n (qa) =>\n qa !== 'ly.img.separator' &&\n qa.definition.id === expandedQuickAction.definition.id\n )\n )\n .map(({ providerInitializationResult }) => ({\n id: providerInitializationResult.provider.id,\n label:\n providerInitializationResult.provider.name ??\n providerInitializationResult.provider.id\n }));\n\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect`;\n const isProviderSelectorEnabled = context.cesdk.feature.isEnabled(\n providerFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (\n providerValuesForExpandedQuickAction.length > 1 &&\n isProviderSelectorEnabled\n ) {\n builder.Section(`${prefix}.popover.expanded.header`, {\n children: () => {\n builder.Select(`${prefix}.expanded.providerSelect.select`, {\n inputLabel: [\n `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect.label`,\n `ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`\n ],\n values: providerValuesForExpandedQuickAction,\n ...currentProviderState\n });\n }\n });\n }\n builder.Section(`${prefix}.popover.expanded.section`, {\n children: () => {\n return expandedQuickAction.definition.render({\n ...builderContext,\n toggleExpand: () => {\n toggleExpandedState.setValue(undefined);\n },\n isExpanded: true,\n generate: handleGenerateFromQuickAction({\n blockIds,\n providerInitializationResult:\n expandedQuickAction.providerInitializationResult ??\n currentSupportedQuickActions?.providerInitializationResult,\n quickAction: expandedQuickAction.definition,\n middlewares: [isGeneratingMiddleware],\n\n confirmation:\n expandedQuickAction.definition.defaults?.confirmation ??\n true,\n\n lock: expandedQuickAction.definition.defaults?.lock ?? true,\n\n close,\n cesdk: context.cesdk,\n debug: context.debug,\n dryRun: context.dryRun\n }),\n close,\n providerId: currentProviderState.value.id\n });\n }\n });\n } else {\n // =========================================\n // === RENDER REGULAR QUICK ACTIONS MENU ===\n // =========================================\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect`;\n const isProviderSelectorEnabled = context.cesdk.feature.isEnabled(\n providerFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (providerValues.length > 1 && isProviderSelectorEnabled) {\n builder.Section(`${prefix}.popover.header`, {\n children: () => {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: [\n `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect.label`,\n `ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`\n ],\n values: providerValues,\n ...currentProviderState\n });\n }\n });\n }\n builder.Section(`${prefix}.popover.section`, {\n children: () => {\n experimental.builder.Menu(`${prefix}.menu`, {\n children: () => {\n currentSupportedQuickActions?.quickActions.forEach(\n (quickAction) => {\n if (quickAction === 'ly.img.separator') {\n builder.Separator(\n `${prefix}.separator.${Math.random().toString()}`\n );\n return;\n }\n if (quickAction.definition.render == null) return;\n quickAction.definition.render({\n ...builderContext,\n toggleExpand: () => {\n toggleExpandedState.setValue(\n quickAction.definition.id\n );\n },\n isExpanded: false,\n generate: handleGenerateFromQuickAction({\n blockIds,\n providerInitializationResult:\n quickAction.providerInitializationResult ??\n currentSupportedQuickActions?.providerInitializationResult,\n quickAction: quickAction.definition,\n middlewares: [isGeneratingMiddleware],\n\n confirmation:\n quickAction.definition.defaults?.confirmation ??\n true,\n\n close,\n cesdk: context.cesdk,\n debug: context.debug,\n dryRun: context.dryRun\n }),\n close,\n providerId: currentProviderState.value.id\n });\n }\n );\n }\n });\n }\n });\n }\n }\n });\n };\n return Promise.resolve(builderRenderFunction);\n}\n\nfunction getOrderedQuickActionDefinitions(\n order: string[]\n): (QuickActionDefinition<any> | 'ly.img.separator')[] {\n return order\n .map((quickActionId) => {\n if (quickActionId === 'ly.img.separator')\n return quickActionId as 'ly.img.separator';\n\n const quickAction = ActionRegistry.get().getBy({\n id: quickActionId,\n type: 'quick'\n })[0];\n\n return quickAction;\n })\n .filter(isDefined);\n}\n\nexport default createQuickActionMenuRenderFunction;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n CreativeEngine\n} from '@cesdk/cesdk-js';\nimport { Output, OutputKind } from '../../core/provider';\nimport createConfirmationRenderFunction from '../panels/createConfirmationRenderFunction';\nimport createQuickActionMenuRenderFunction from './createQuickActionMenuRenderFunction';\nimport { AI_EDIT_MODE } from './utils';\nimport { ProviderInitializationResult } from '../../providers/initializeProvider';\nimport CallbacksRegistry from '../../generation/CallbacksRegistry';\n\nasync function initializeQuickActionComponents<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n kind: K;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n debug?: boolean;\n dryRun?: boolean;\n defaultOrder?: string[];\n}) {\n const menuRenderFunction = await createQuickActionMenuRenderFunction({\n kind: context.kind,\n providerInitializationResults: context.providerInitializationResults,\n\n cesdk: context.cesdk,\n engine: context.engine,\n debug: context.debug,\n dryRun: context.dryRun,\n defaultOrder: context.defaultOrder\n });\n const confirmationRenderFunction = await createConfirmationRenderFunction({\n kind: context.kind,\n\n cesdk: context.cesdk\n });\n\n const builderRenderFunction: BuilderRenderFunction<any> = (\n builderContext\n ) => {\n const { engine } = builderContext;\n if (engine.editor.getEditMode() === AI_EDIT_MODE) {\n const blockIds = builderContext.engine.block.findAllSelected();\n confirmationRenderFunction({\n ...builderContext,\n payload: {\n ...(builderContext.payload ?? {}),\n applyCallbacks: {\n onBefore: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onBefore?.();\n });\n },\n onAfter: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onAfter?.();\n });\n },\n onCancel: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onCancel?.();\n });\n },\n onApply: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onApply?.();\n });\n }\n },\n onCancelGeneration: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get().get(blockId).onCancelGeneration?.();\n });\n }\n }\n });\n return;\n }\n\n menuRenderFunction(builderContext);\n };\n\n return {\n renderFunction: builderRenderFunction\n };\n}\n\nexport default initializeQuickActionComponents;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { supportsTranslateAPI, hasTranslateAPI } from '@imgly/plugin-utils';\n\n/**\n * Creates a translation callback function for AI asset sources\n * @param cesdk - The CE.SDK instance\n * @param modelKey - The model/provider key (e.g., 'fal-ai/recraft-v3')\n * @param propertyName - The property name (e.g., 'style', 'aspect_ratio')\n * @param pluginType - The plugin type (e.g., 'image', 'video', 'sticker')\n * @returns A translation callback function for use with CustomAssetSource\n */\nexport function createTranslationCallback(\n cesdk: CreativeEditorSDK,\n modelKey: string,\n propertyName: string = 'style',\n pluginType: string = 'image'\n): (assetId: string, fallbackLabel: string, locale: string) => string {\n return (assetId: string, fallbackLabel: string): string => {\n // Check if CE.SDK supports translation API\n if (!supportsTranslateAPI(cesdk)) {\n return fallbackLabel;\n }\n\n // Build translation keys following established AI plugin pattern\n const translationKeys = buildTranslationKeys(\n modelKey,\n propertyName,\n assetId,\n pluginType\n );\n\n // Use CE.SDK's translate method with fallback array\n if (hasTranslateAPI(cesdk.i18n)) {\n const translated = cesdk.i18n.translate(translationKeys);\n\n // Return translated label or fallback if no translation found\n // (CE.SDK returns the last key if no translation is found)\n return translated !== translationKeys[translationKeys.length - 1]\n ? translated\n : fallbackLabel;\n }\n\n return fallbackLabel;\n };\n}\n\n/**\n * Build translation keys array for AI plugin property values\n * @param modelKey - The model/provider key\n * @param propertyName - The property name\n * @param value - The property value\n * @param pluginType - The plugin type (image, video, sticker, etc.)\n * @returns Array of translation keys in fallback order\n */\nexport function buildTranslationKeys(\n modelKey: string,\n propertyName: string,\n value: string,\n pluginType: string = 'image'\n): string[] {\n return [\n `ly.img.plugin-ai-${pluginType}-generation-web.${modelKey}.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-generation-web.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-${pluginType}-generation-web.${modelKey}.defaults.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-generation-web.defaults.property.${propertyName}.${value}`\n ];\n}\n", "import renderImageUrlProperty from './ui/common/renderImageUrlProperty';\nimport renderStyleTransferProperty from './ui/common/renderStyleTransferProperty';\n\nconst CommonProperties = {\n ImageUrl: renderImageUrlProperty,\n StyleTransfer: renderStyleTransferProperty\n};\n\nexport { CommonProperties };\n\nexport {\n type default as Provider,\n type ImageOutput,\n type VideoOutput,\n type TextOutput,\n type AudioOutput,\n type StickerOutput,\n type Output,\n type OutputKind,\n type PanelInputSchema,\n type RenderCustomProperty,\n type GetBlockInput,\n type GetBlockInputResult,\n type GetInput\n} from './core/provider';\nexport { type GetPropertyInput, type Property } from './openapi/types';\nexport {\n type GetProvider,\n type CommonProviderConfiguration,\n type CommonPluginConfiguration,\n type CommonConfiguration,\n type InternalPluginConfiguration\n} from './types';\n\nexport { default as integrateIntoDefaultAssetLibraryEntry } from './assets/integrateIntoDefaultAssetLibraryEntry';\nexport {\n ActionRegistry,\n type PluginActionDefinition,\n type QuickActionDefinition,\n type ActionDefinition,\n type ActionRegistryEventType,\n type ActionRegistrySubscriberCallback,\n type ActionRegistryFilters\n} from './core/ActionRegistry';\nexport { ProviderRegistry } from './core/ProviderRegistry';\n\n// Export middleware\nexport { composeMiddlewares, type Middleware } from './middleware/middleware';\nexport { default as loggingMiddleware } from './middleware/loggingMiddleware';\nexport { default as uploadMiddleware } from './middleware/uploadMiddleware';\n\n// Export utilities\nexport { mergeQuickActionsConfig } from './utils/mergeQuickActionsConfig';\nexport {\n default as rateLimitMiddleware,\n type RateLimitOptions\n} from './middleware/rateLimitMiddleware';\n\nexport {\n getPanelId,\n getDurationForVideo,\n getThumbnailForVideo,\n getLabelFromId,\n isAsyncGenerator,\n addIconSetOnce\n} from './utils/utils';\n\nexport { checkAiPluginVersion } from './utils/checkAiPluginVersion';\n\nexport { default as registerDockComponent } from './ui/components/registerDockComponent';\n\nexport { default as enableQuickActionForImageFill } from './ui/quickActions/enableImageFill';\n\nexport {\n isGeneratingStateKey,\n abortGenerationStateKey\n} from './ui/components/renderGenerationComponents';\n\nexport { default as initializeProviders } from './providers/initializeProviders';\nexport { default as initializeProvider } from './providers/initializeProvider';\nexport { default as initializeQuickActionComponents } from './ui/quickActions/initializeQuickActionComponents';\n\nexport { extractAndSetSchemaTranslations } from './openapi/extractSchemaTranslations';\n\nexport { AI_EDIT_MODE, AI_METADATA_KEY } from './ui/quickActions/utils';\n\n// Export AI-specific translation helpers\nexport {\n createTranslationCallback,\n buildTranslationKeys\n} from './utils/translationHelpers';\n", "{\n \"openapi\": \"3.0.0\",\n \"components\": {\n \"schemas\": {\n \"GptImage1Input\": {\n \"title\": \"TextToImageInput\",\n \"type\": \"object\",\n \"properties\": {\n \"prompt\": {\n \"title\": \"Prompt\",\n \"type\": \"string\",\n \"x-imgly-builder\": {\n \"component\": \"TextArea\"\n }\n },\n \"style\": {\n \"title\": \"Style\",\n \"type\": \"string\",\n \"description\": \"The style of the generated images.\"\n },\n \"size\": {\n \"enum\": [\"1024x1024\", \"1536x1024\", \"1024x1536\"],\n \"type\": \"string\",\n \"title\": \"Format\",\n \"default\": \"1024x1024\",\n \"x-imgly-enum-labels\": {\n \"1024x1024\": \"Square\",\n \"1536x1024\": \"Landscape\",\n \"1024x1536\": \"Portrait\"\n },\n \"x-imgly-enum-icons\": {\n \"1024x1024\": \"@imgly/plugin/formats/ratio1by1\",\n \"1024x1536\": \"@imgly/plugin/formats/ratio3by4\",\n \"1536x1024\": \"@imgly/plugin/formats/ratio4by3\"\n }\n },\n \"background\": {\n \"enum\": [\"auto\", \"transparent\", \"opaque\"],\n \"type\": \"string\",\n \"title\": \"Background\",\n \"default\": \"auto\",\n \"x-imgly-enum-labels\": {\n \"auto\": \"Auto\",\n \"transparent\": \"Transparent\",\n \"opaque\": \"Opaque\"\n }\n }\n },\n \"x-order-properties\": [\"prompt\", \"style\", \"size\", \"background\"],\n \"required\": [\"prompt\"]\n }\n }\n }\n}\n", "export function b64JsonToBlob(b64_json: string, mimeType: string): Blob {\n const base64Data = b64_json.split(',')[1] || b64_json;\n\n const byteCharacters = atob(base64Data);\n const byteArrays = [];\n\n for (let i = 0; i < byteCharacters.length; i++) {\n byteArrays.push(byteCharacters.charCodeAt(i));\n }\n const byteArray = new Uint8Array(byteArrays);\n const blob = new Blob([byteArray], { type: mimeType });\n\n return blob;\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CustomAssetSource, isDefined } from '@imgly/plugin-utils';\n\nexport const STYLES = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\nexport const createStyleAssetSource = (\n assetSourceId: string,\n options: {\n baseURL: string;\n includeNone?: boolean;\n }\n) => {\n const styleValues = STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = STYLES[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\nexport const addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n", "import { Icons } from '@imgly/plugin-utils';\nimport {\n CommonProviderConfiguration,\n getPanelId,\n type Provider\n} from '@imgly/plugin-ai-generation-web';\nimport GptImage1Schema from './GptImage1.text2image.json';\nimport CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { b64JsonToBlob } from './utils';\nimport {\n addStyleAssetSource,\n createStyleAssetSource,\n STYLES\n} from './GptImage1.styles';\n\ntype StyleSelectionPayload = {\n onSelect: (asset: AssetResult) => Promise<void>;\n};\n\ntype GptImage1Input = {\n prompt: string;\n style?: string;\n size: 'auto' | '1024x1024' | '1536x1024' | '1024x1536';\n background: 'transparent' | 'opaque' | 'auto';\n};\n\ntype GptImage1Output = {\n kind: 'image';\n url: string;\n};\n\ninterface ProviderConfiguration\n extends CommonProviderConfiguration<GptImage1Input, GptImage1Output> {}\n\nexport function GptImage1(\n config: ProviderConfiguration\n): (context: {\n cesdk: CreativeEditorSDK;\n}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>> {\n return async ({ cesdk }: { cesdk: CreativeEditorSDK }) => {\n return getProvider(cesdk, config);\n };\n}\n\nfunction getProvider(\n cesdk: CreativeEditorSDK,\n config: ProviderConfiguration\n): Provider<'image', GptImage1Input, GptImage1Output> {\n const modelKey = 'open-ai/gpt-image-1/text2image';\n const baseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n const styleAssetSourceId = `${modelKey}/styles`;\n const styleAssetSource = createStyleAssetSource(styleAssetSourceId, {\n baseURL,\n includeNone: true\n });\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n cesdk.ui.registerPanel<StyleSelectionPayload>(\n `${getPanelId(modelKey)}.styleSelection`,\n ({ builder, payload }) => {\n if (payload == null) return null;\n\n builder.Library(`${modelKey}.library.style`, {\n entries: [styleAssetSourceId],\n onSelect: async (asset) => {\n payload.onSelect(asset);\n }\n });\n }\n );\n\n cesdk.ui.addIconSet('@imgly/plugin/formats', Icons.Formats);\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${getPanelId(modelKey)}.styleSelection`]: 'Style Selection',\n [`panel.gpt-image-1.imageSelection`]: 'Select Image To Change'\n }\n });\n\n const provider: Provider<'image', GptImage1Input, GptImage1Output> = {\n id: 'open-ai/gpt-image-1/text2image',\n kind: 'image',\n name: 'GPT Image 1',\n input: {\n panel: {\n type: 'schema',\n // @ts-ignore\n document: GptImage1Schema,\n inputReference: '#/components/schemas/GptImage1Input',\n includeHistoryLibrary: true,\n orderExtensionKeyword: 'x-order-properties',\n renderCustomProperty: {\n style: ({ builder, state }, property) => {\n const styleState = state<{\n id: string;\n label: string;\n }>(\n 'style',\n styleAssetSource.getAssetSelectValue(\n styleAssetSource.getActiveAssetIds()[0]\n ) ?? STYLES[0]\n );\n\n // Show the style library for the selected type.\n builder.Button(`${property.id}`, {\n inputLabel: [\n `ly.img.plugin-ai-image-generation-web.${modelKey}.property.${property.id}`,\n `ly.img.plugin-ai-generation-web.property.${property.id}`,\n `ly.img.plugin-ai-image-generation-web.${modelKey}.defaults.property.${property.id}`,\n `ly.img.plugin-ai-generation-web.defaults.property.${property.id}`\n ],\n icon: '@imgly/Appearance',\n trailingIcon: '@imgly/ChevronRight',\n label: styleState.value.label,\n labelAlignment: 'left',\n onClick: () => {\n const payload: StyleSelectionPayload = {\n onSelect: async (asset) => {\n const newValue = {\n id: asset.id,\n label: asset.label ?? asset.id\n };\n\n styleAssetSource.clearActiveAssets();\n styleAssetSource.setAssetActive(asset.id);\n styleState.setValue(newValue);\n\n cesdk.ui.closePanel(\n `${getPanelId(modelKey)}.styleSelection`\n );\n }\n };\n\n cesdk.ui.openPanel(`${getPanelId(modelKey)}.styleSelection`, {\n payload\n });\n }\n });\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value:\n styleState.value.id ?? styleAssetSource.getActiveAssetIds()[0]\n };\n };\n }\n },\n getBlockInput: (input) => {\n switch (input.size) {\n case 'auto':\n return Promise.resolve({ image: { width: 512, height: 512 } });\n case '1024x1024':\n return Promise.resolve({ image: { width: 1024, height: 1024 } });\n case '1536x1024':\n return Promise.resolve({ image: { width: 1536, height: 1024 } });\n case '1024x1536':\n return Promise.resolve({ image: { width: 1024, height: 1536 } });\n default: {\n throw new Error('Invalid image size');\n }\n }\n },\n userFlow: 'placeholder'\n }\n },\n output: {\n abortable: true,\n history: '@imgly/indexedDB',\n middleware: config.middlewares ?? config.middleware ?? [],\n generate: async (\n input: GptImage1Input,\n { abortSignal }: { abortSignal?: AbortSignal }\n ) => {\n const stylePrompt = STYLES.find((style) => style.id === input.style);\n let prompt = input.prompt;\n\n if (\n stylePrompt != null &&\n stylePrompt.id !== 'none' &&\n stylePrompt.prompt\n ) {\n prompt = `${prompt}, ${stylePrompt.prompt}`;\n }\n const hasGlobalAPIKey =\n cesdk.ui.experimental.hasGlobalStateValue('OPENAI_API_KEY');\n\n const baseUrl = hasGlobalAPIKey\n ? 'https://api.openai.com/v1'\n : config.proxyUrl;\n\n const response = await fetch(`${baseUrl}/images/generations`, {\n signal: abortSignal,\n method: 'POST',\n headers: hasGlobalAPIKey\n ? {\n Authorization: `Bearer ${cesdk.ui.experimental.getGlobalStateValue(\n 'OPENAI_API_KEY'\n )}`,\n 'Content-Type': 'application/json',\n ...(config.headers ?? {})\n }\n : {\n 'Content-Type': 'application/json',\n ...(config.headers ?? {})\n },\n body: JSON.stringify({\n model: 'gpt-image-1',\n prompt,\n n: 1,\n size: input.size,\n background: input.background\n })\n });\n const img = await response.json();\n\n const b64_json = img.data?.[0].b64_json;\n if (b64_json == null) {\n throw new Error('No image data returned');\n }\n\n const blob = b64JsonToBlob(b64_json, 'image/png');\n const imageUrl = URL.createObjectURL(blob);\n\n return {\n kind: 'image',\n url: imageUrl\n };\n }\n }\n };\n\n return provider;\n}\n\nexport default getProvider;\n", "{\n \"openapi\": \"3.0.0\",\n \"components\": {\n \"schemas\": {\n \"GptImage1Input\": {\n \"title\": \"ImageToImageInput\",\n \"type\": \"object\",\n \"properties\": {\n \"prompt\": {\n \"title\": \"Prompt\",\n \"type\": \"string\",\n \"x-imgly-builder\": {\n \"component\": \"TextArea\"\n }\n },\n \"image_url\": {\n \"title\": \"Image Url\",\n \"type\": \"string\",\n \"description\": \"Optional URL of an input image for editing.\"\n }\n },\n \"x-order-properties\": [\"image_url\", \"prompt\", \"background\"],\n \"required\": [\"image_url\", \"prompt\"]\n }\n }\n }\n}\n", "import {\n bufferURIToObjectURL,\n getImageDimensionsFromURL,\n Icons,\n mimeTypeToExtension\n} from '@imgly/plugin-utils';\nimport {\n CommonProperties,\n type Provider,\n CommonProviderConfiguration\n} from '@imgly/plugin-ai-generation-web';\nimport GptImage1Schema from './GptImage1.image2image.json';\nimport CreativeEditorSDK, { MimeType } from '@cesdk/cesdk-js';\nimport { b64JsonToBlob } from './utils';\nimport { ActionRegistry } from '@imgly/plugin-ai-generation-web';\nimport ChangeStyleLibrary from './quickActions/ChangeStyleLibrary';\n\ntype GptImage1Input = {\n prompt: string;\n image_url: string | string[];\n exportFromBlockIds?: number[];\n};\n\ntype GptImage1Output = {\n kind: 'image';\n url: string;\n};\n\ninterface ProviderConfiguration\n extends CommonProviderConfiguration<GptImage1Input, GptImage1Output> {}\n\nexport function GptImage1(\n config: ProviderConfiguration\n): (context: {\n cesdk: CreativeEditorSDK;\n}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>> {\n return async ({ cesdk }: { cesdk: CreativeEditorSDK }) => {\n return getProvider(cesdk, config);\n };\n}\n\nfunction getProvider(\n cesdk: CreativeEditorSDK,\n config: ProviderConfiguration\n): Provider<'image', GptImage1Input, GptImage1Output> {\n const modelKey = 'open-ai/gpt-image-1/image2image';\n cesdk.ui.addIconSet('@imgly/plugin/formats', Icons.Formats);\n const baseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n\n ActionRegistry.get().register(\n ChangeStyleLibrary({\n cesdk,\n modelKey,\n baseURL\n })\n );\n\n const provider: Provider<'image', GptImage1Input, GptImage1Output> = {\n id: modelKey,\n kind: 'image',\n name: 'GPT Image 1',\n input: {\n panel: {\n type: 'schema',\n // @ts-ignore\n document: GptImage1Schema,\n inputReference: '#/components/schemas/GptImage1Input',\n includeHistoryLibrary: true,\n orderExtensionKeyword: 'x-order-properties',\n renderCustomProperty: {\n ...(cesdk != null\n ? CommonProperties.ImageUrl('gpt-image-1', {\n cesdk\n })\n : {})\n },\n getBlockInput: async (input) => {\n if (input.image_url == null || Array.isArray(input.image_url)) {\n throw new Error('Cannot process getBlockInput for multiple images');\n }\n\n const { width, height } = await getImageDimensionsFromURL(\n input.image_url,\n cesdk.engine\n );\n return Promise.resolve({\n image: {\n width,\n height\n }\n });\n },\n userFlow: 'placeholder'\n },\n quickActions: {\n supported: {\n 'ly.img.gpt-image-1.changeStyleLibrary': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.editImage': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.swapBackground': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.createVariant': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.combineImages': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uris,\n exportFromBlockIds: input.exportFromBlockIds\n })\n },\n 'ly.img.remixPage': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.remixPageWithPrompt': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n }\n }\n }\n },\n output: {\n abortable: true,\n history: '@imgly/indexedDB',\n middleware: config.middlewares ?? config.middleware ?? [],\n generate: async (\n input: GptImage1Input,\n { abortSignal }: { abortSignal?: AbortSignal }\n ) => {\n const formData = new FormData();\n\n if (Array.isArray(input.image_url)) {\n if (input.exportFromBlockIds != null) {\n await Promise.all(\n input.exportFromBlockIds.map(async (blockId) => {\n const exportedBlob = await cesdk.engine.block.export(\n blockId,\n MimeType.Jpeg,\n {\n targetHeight: 1024,\n targetWidth: 1024\n }\n );\n formData.append(\n 'image[]',\n exportedBlob,\n `image_${blockId}.jpeg`\n );\n })\n );\n } else {\n await Promise.all(\n input.image_url.map(async (image_url) => {\n const mimeType = await cesdk.engine.editor.getMimeType(\n image_url\n );\n const resolvedImageUrl = await bufferURIToObjectURL(\n image_url,\n cesdk.engine\n );\n const imageUrlResponse = await fetch(resolvedImageUrl);\n const imageUrlBlob = await imageUrlResponse.blob();\n formData.append(\n 'image[]',\n imageUrlBlob,\n `image.${mimeTypeToExtension(mimeType)}`\n );\n })\n );\n }\n } else {\n const mimeType = await cesdk.engine.editor.getMimeType(\n input.image_url\n );\n const resolvedImageUrl = await bufferURIToObjectURL(\n input.image_url,\n cesdk.engine\n );\n const imageUrlResponse = await fetch(resolvedImageUrl);\n const imageUrlBlob = await imageUrlResponse.blob();\n formData.append(\n 'image',\n imageUrlBlob,\n `image.${mimeTypeToExtension(mimeType)}`\n );\n }\n\n formData.append('prompt', input.prompt);\n formData.append('model', 'gpt-image-1');\n formData.append('size', 'auto');\n formData.append('n', '1');\n\n const hasGlobalAPIKey =\n cesdk.ui.experimental.hasGlobalStateValue('OPENAI_API_KEY');\n\n const baseUrl = hasGlobalAPIKey\n ? 'https://api.openai.com/v1'\n : config.proxyUrl;\n\n const response = await fetch(`${baseUrl}/images/edits`, {\n signal: abortSignal,\n method: 'POST',\n headers: hasGlobalAPIKey\n ? {\n Authorization: `Bearer ${cesdk.ui.experimental.getGlobalStateValue(\n 'OPENAI_API_KEY'\n )}`,\n ...(config.headers ?? {})\n }\n : {\n ...(config.headers ?? {})\n },\n body: formData\n });\n\n const img = await response.json();\n\n const b64_json = img.data?.[0].b64_json;\n if (b64_json == null) {\n throw new Error('No image data returned');\n }\n\n const blob = b64JsonToBlob(b64_json, 'image/png');\n const imageUrl = URL.createObjectURL(blob);\n\n return {\n kind: 'image',\n url: imageUrl\n };\n }\n }\n };\n\n return provider;\n}\n\nexport default getProvider;\n", "import {\n enableQuickActionForImageFill,\n QuickActionDefinition\n} from '@imgly/plugin-ai-generation-web';\nimport { getImageUri, CustomAssetSource, isDefined } from '@imgly/plugin-utils';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * The action name.\n */\nconst ACTION_NAME = 'gpt-image-1.changeStyleLibrary';\n\n/**\n * The ID of the quick action.\n */\nexport const ID = `ly.img.${ACTION_NAME}`;\n\n/**\n * The i18n prefix for the quick action.\n */\nexport const I18N_PREFIX = `ly.img.plugin-ai-image-generation-web.quickAction.${ACTION_NAME}`;\n\n/**\n * The input generated from this quick action which needs\n * to be mapped to the specific provider.\n */\nexport type InputType = {\n prompt: string;\n uri: string;\n};\n\n/**\n * Available styles for GPT Image 1 style transfer.\n */\nconst STYLES = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\n/**\n * Creates a style asset source for the quick action.\n */\nconst createStyleAssetSource = (\n assetSourceId: string,\n options: {\n baseURL: string;\n includeNone?: boolean;\n }\n) => {\n const styleValues = STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = STYLES[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\n/**\n * Adds the style asset source to the CESDK instance.\n */\nconst addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n\n/**\n * Function to create the ChangeStyleLibrary quick action.\n */\nconst ChangeStyleLibrary = (context: {\n cesdk: CreativeEditorSDK;\n modelKey: string;\n baseURL?: string;\n}): QuickActionDefinition<InputType> => {\n const { cesdk, modelKey, baseURL } = context;\n\n // Setup asset source for styles\n const styleAssetSourceId = `${modelKey}/styles`;\n const defaultBaseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n const styleAssetSource = createStyleAssetSource(styleAssetSourceId, {\n baseURL: baseURL ?? defaultBaseURL\n });\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n cesdk.i18n.setTranslations({\n en: {\n [`${I18N_PREFIX}`]: 'Change Style',\n [`${I18N_PREFIX}.description`]: 'Apply different art styles to your image'\n }\n });\n\n const quickAction: QuickActionDefinition<InputType> = {\n id: ID,\n type: 'quick',\n kind: 'image',\n\n label: `${I18N_PREFIX}`,\n enable: enableQuickActionForImageFill(),\n scopes: ['fill/change'],\n\n render: ({ builder, experimental, generate, engine, close }) => {\n experimental.builder.Popover(`${ID}.popover`, {\n label: `${I18N_PREFIX}`,\n icon: '@imgly/Appearance',\n labelAlignment: 'left',\n variant: 'plain',\n trailingIcon: '@imgly/ChevronRight',\n placement: 'right',\n children: () => {\n builder.Library(`${ID}.popover.library`, {\n entries: [`${modelKey}/styles`],\n onSelect: async (assetResult) => {\n try {\n const [blockId] = engine.block.findAllSelected();\n const uri = await getImageUri(blockId, engine, {\n throwErrorIfSvg: true\n });\n\n const styleId = assetResult.id;\n const style = STYLES.find(({ id }) => id === styleId);\n if (style == null) {\n throw new Error(`Style not found: ${styleId}`);\n }\n\n await generate({\n prompt: style.prompt,\n uri\n });\n\n close();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Generation error:', error);\n }\n }\n });\n }\n });\n }\n };\n return quickAction;\n};\n\n/**\n * Extend ImageQuickActionInputs with this action's input type.\n * This will ensure that the types are correctly recognized\n * in the ImageProvider.\n *\n * COPY this file to other quick action to support type safety\n */\ndeclare module '../../types' {\n interface ImageQuickActionInputs {\n [ID]: InputType;\n }\n}\n\nexport default ChangeStyleLibrary;\n", "import { GptImage1 as GptImage1Text2Image } from './GptImage1.text2image';\nimport { GptImage1 as GptImage1Image2Image } from './GptImage1.image2image';\n\nconst OpenAi = {\n GptImage1: {\n Text2Image: GptImage1Text2Image,\n Image2Image: GptImage1Image2Image\n }\n};\n\nexport default OpenAi;\n"],
5
- "mappings": "AAAA,IAAOA,GAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECyCFC,GAAN,KAA+C,CAwBpD,YACEC,EACAC,EAA4C,CAAC,EAC7CC,EACA,CACA,KAAK,GAAKF,EACV,KAAK,eAAiBE,GAAS,eAC/B,KAAK,OAASD,EAAO,IAAKE,GAAU,CAElC,GACE,OAAQA,EAAsB,OAAU,UACxC,EACGA,EAA0B,OAC3B,OAAQA,EAA0B,OAAU,UAE9C,CACA,IAAMC,EAAcD,EAEpB,MAAO,CACL,GAAIC,EAAY,GAChB,MAAO,CAAE,GAAIA,EAAY,KAAM,EAC/B,KAAMA,EAAY,SACd,CAAE,GAAIA,EAAY,MAAQ,CAAC,EAAI,SAAUA,EAAY,QAAS,EAC9DA,EAAY,IAClB,CACF,CACA,OAAOD,CACT,CAAC,EACD,KAAK,eAAiB,IA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ats_default", "CustomAssetSource", "id", "assets", "options", "asset", "selectValue", "queryData", "page", "perPage", "locale", "sortActiveFirst", "query", "tags", "groups", "excludeGroups", "sortingOrder", "sortKey", "filteredAssets", "group", "lowerQuery", "label", "assetTags", "tag", "tagArray", "a", "b", "aActive", "bActive", "aValue", "bValue", "total", "startIndex", "endIndex", "resultAssets", "fallbackLabel", "nextPage", "assetId", "activeIds", "assetIds", "existingIndex", "index", "freeGlobal", "freeGlobal_default", "freeSelf", "root", "root_default", "Symbol", "Symbol_default", "objectProto", "hasOwnProperty", "nativeObjectToString", "symToStringTag", "getRawTag", "value", "isOwn", "tag", "unmasked", "result", "getRawTag_default", "objectToString", "objectToString_default", "nullTag", "undefinedTag", "baseGetTag", "baseGetTag_default", "isObjectLike", "isObjectLike_default", "isArray", "isObject", "value", "type", "isObject_default", "asyncTag", "funcTag", "genTag", "proxyTag", "isFunction", "tag", "baseGetTag_default", "isFunction_default", "coreJsData", "root_default", "coreJsData_default", "maskSrcKey", "uid", "isMasked", "func", "isMasked_default", "funcProto", "funcToString", "toSource", "toSource_default", "reRegExpChar", "reIsHostCtor", "objectProto", "hasOwnProperty", "reIsNative", "baseIsNative", "pattern", "baseIsNative_default", "getValue", "object", "key", "getValue_default", "getNative", "getNative_default", "WeakMap", "WeakMap_default", "eq", "value", "other", "eq_default", "MAX_SAFE_INTEGER", "isLength", "isLength_default", "objectProto", "argsTag", "baseIsArguments", "value", "isObjectLike_default", "baseGetTag_default", "baseIsArguments_default", "objectProto", "hasOwnProperty", "propertyIsEnumerable", "isArguments", "freeExports", "freeModule", "moduleExports", "Buffer", "root_default", "nativeIsBuffer", "argsTag", "arrayTag", "boolTag", "dateTag", "errorTag", "funcTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "typedArrayTags", "baseIsTypedArray", "value", "isObjectLike_default", "isLength_default", "baseGetTag_default", "baseIsTypedArray_default", "baseUnary", "func", "baseUnary_default", "freeExports", "freeModule", "moduleExports", "freeProcess", "freeGlobal_default", "nodeUtil", "types", "nodeUtil_default", "nodeIsTypedArray", "isTypedArray", "objectProto", "hasOwnProperty", "overArg", "func", "transform", "arg", "overArg_default", "nativeKeys", "objectProto", "hasOwnProperty", "nativeCreate", "getNative_default", "nativeCreate_default", "hashClear", "hashClear_default", "hashDelete", "key", "result", "hashDelete_default", "HASH_UNDEFINED", "objectProto", "hasOwnProperty", "hashGet", "data", "hashGet_default", "hashHas", "hashHas_default", "hashSet", "value", "hashSet_default", "Hash", "entries", "index", "length", "entry", "Hash_default", "listCacheClear", "listCacheClear_default", "assocIndexOf", "array", "eq_default", "assocIndexOf_default", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheDelete_default", "listCacheGet", "listCacheGet_default", "listCacheHas", "listCacheHas_default", "listCacheSet", "listCacheSet_default", "ListCache", "ListCache_default", "Map", "root_default", "Map_default", "mapCacheClear", "mapCacheClear_default", "isKeyable", "type", "isKeyable_default", "getMapData", "map", "getMapData_default", "mapCacheDelete", "mapCacheDelete_default", "mapCacheGet", "mapCacheGet_default", "mapCacheHas", "mapCacheHas_default", "mapCacheSet", "size", "mapCacheSet_default", "MapCache", "MapCache_default", "stackClear", "ListCache_default", "stackClear_default", "stackDelete", "key", "data", "result", "stackDelete_default", "stackGet", "stackGet_default", "stackHas", "stackHas_default", "LARGE_ARRAY_SIZE", "stackSet", "value", "pairs", "Map_default", "MapCache_default", "stackSet_default", "Stack", "entries", "objectProto", "propertyIsEnumerable", "DataView", "getNative_default", "root_default", "DataView_default", "Promise", "Promise_default", "Set", "Set_default", "mapTag", "objectTag", "promiseTag", "setTag", "weakMapTag", "dataViewTag", "dataViewCtorString", "toSource_default", "mapCtorString", "Map_default", "promiseCtorString", "setCtorString", "weakMapCtorString", "WeakMap_default", "getTag", "baseGetTag_default", "value", "result", "Ctor", "ctorString", "Uint8Array", "root_default", "HASH_UNDEFINED", "setCacheAdd", "value", "setCacheAdd_default", "setCacheHas", "setCacheHas_default", "SetCache", "values", "index", "length", "MapCache_default", "symbolProto", "Symbol_default", "symbolValueOf", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "HEX_COLOR_PATTERN", "HEX_SINGLE_CHAR_COMPONENTS_PATTERN", "HEX_DOUBLE_CHAR_COMPONENTS_PATTERN", "mimeTypeToExtension", "mimeType", "bufferURIToObjectURL", "uri", "engine", "mimeType", "length", "data", "buffer", "blob", "getImageDimensionsFromURL", "url", "engine", "resolvedUrl", "bufferURIToObjectURL", "resolve", "reject", "img", "getImageUri", "blockId", "options", "uri", "fillBlock", "sourceSet", "source", "isDefined", "value", "isDefined_default", "Icons", "formats_default", "renderImageUrlProperty", "provderId", "options", "cesdk", "propertyKey", "panelIdForImageSelection", "getImageSelectionPanelId", "createPanels", "context", "property", "builder", "global", "payload", "defaultUrl", "stateValue", "assetResult", "providerId", "asset", "uri", "mimeType", "renderImageUrlProperty_default", "CustomAssetSource", "id", "assets", "selectValue", "queryData", "page", "perPage", "locale", "sortActiveFirst", "query", "tags", "groups", "excludeGroups", "sortingOrder", "sortKey", "filteredAssets", "group", "lowerQuery", "label", "assetTags", "tag", "tagArray", "a", "b", "aActive", "bActive", "aValue", "bValue", "total", "startIndex", "endIndex", "resultAssets", "fallbackLabel", "nextPage", "assetId", "activeIds", "assetIds", "existingIndex", "index", "freeGlobal", "freeGlobal_default", "freeSelf", "root", "root_default", "Symbol", "Symbol_default", "objectProto", "hasOwnProperty", "nativeObjectToString", "symToStringTag", "getRawTag", "value", "isOwn", "tag", "unmasked", "result", "getRawTag_default", "objectToString", "objectToString_default", "nullTag", "undefinedTag", "baseGetTag", "baseGetTag_default", "isObjectLike", "isObjectLike_default", "isArray", "isObject", "type", "isObject_default", "asyncTag", "funcTag", "genTag", "proxyTag", "isFunction", "isFunction_default", "coreJsData", "coreJsData_default", "maskSrcKey", "uid", "isMasked", "func", "isMasked_default", "funcProto", "funcToString", "toSource", "toSource_default", "reRegExpChar", "reIsHostCtor", "reIsNative", "baseIsNative", "pattern", "baseIsNative_default", "getValue", "object", "key", "getValue_default", "getNative", "getNative_default", "WeakMap", "WeakMap_default", "eq", "other", "eq_default", "MAX_SAFE_INTEGER", "isLength", "isLength_default", "argsTag", "baseIsArguments", "baseIsArguments_default", "propertyIsEnumerable", "isArguments", "freeExports", "freeModule", "moduleExports", "Buffer", "nativeIsBuffer", "arrayTag", "boolTag", "dateTag", "errorTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "typedArrayTags", "baseIsTypedArray", "baseIsTypedArray_default", "baseUnary", "baseUnary_default", "freeProcess", "nodeUtil", "types", "nodeUtil_default", "nodeIsTypedArray", "isTypedArray", "overArg", "transform", "arg", "overArg_default", "nativeKeys", "nativeCreate", "nativeCreate_default", "hashClear", "hashClear_default", "hashDelete", "hashDelete_default", "HASH_UNDEFINED", "hashGet", "data", "hashGet_default", "hashHas", "hashHas_default", "hashSet", "hashSet_default", "Hash", "entries", "index", "length", "entry", "Hash_default", "listCacheClear", "listCacheClear_default", "assocIndexOf", "array", "assocIndexOf_default", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheDelete_default", "listCacheGet", "listCacheGet_default", "listCacheHas", "listCacheHas_default", "listCacheSet", "listCacheSet_default", "ListCache", "ListCache_default", "Map", "Map_default", "mapCacheClear", "mapCacheClear_default", "isKeyable", "isKeyable_default", "getMapData", "map", "getMapData_default", "mapCacheDelete", "mapCacheDelete_default", "mapCacheGet", "mapCacheGet_default", "mapCacheHas", "mapCacheHas_default", "mapCacheSet", "size", "mapCacheSet_default", "MapCache", "MapCache_default", "stackClear", "stackClear_default", "stackDelete", "stackDelete_default", "stackGet", "stackGet_default", "stackHas", "stackHas_default", "LARGE_ARRAY_SIZE", "stackSet", "pairs", "stackSet_default", "Stack", "DataView", "DataView_default", "Promise", "Promise_default", "Set", "Set_default", "promiseTag", "dataViewCtorString", "mapCtorString", "promiseCtorString", "setCtorString", "weakMapCtorString", "getTag", "Ctor", "ctorString", "Uint8Array", "setCacheAdd", "setCacheAdd_default", "setCacheHas", "setCacheHas_default", "SetCache", "values", "symbolProto", "symbolValueOf", "HEX_COLOR_PATTERN", "HEX_SINGLE_CHAR_COMPONENTS_PATTERN", "HEX_DOUBLE_CHAR_COMPONENTS_PATTERN", "isDefined", "value", "isDefined_default", "renderStyleTransferProperty", "providerId", "options", "cesdk", "propertyKey", "panelIdForStyleSelection", "getStyleSelectionPanelId", "defaultStyles", "getDefaultStyles", "styles", "styleAssetSource", "createStyleAssetSource", "styleAssetSourceId", "addStyleAssetSource", "createPanels", "context", "property", "promptState", "activeAssetId", "asset", "builder", "state", "styleState", "payload", "panelId", "entryId", "STYLES", "style", "Ys", "styleValues", "allSourceIds", "assetSourceId", "ye", "defaultStyle", "label", "renderStyleTransferProperty_default", "ActionRegistry", "_ActionRegistry", "globalKey", "globalObj", "action", "filters", "callback", "event", "AI_PANEL_ID_PREFIX", "getPanelId", "providerId", "AI_PANEL_ID_PREFIX", "enableImageFill", "engine", "blockIds", "blockId", "fillBlock", "enableImageFill_default", "PLUGIN_ICON_SET_ID", "ICON_SPRITE", "CommonProperties", "renderImageUrlProperty_default", "renderStyleTransferProperty_default", "GptImage1_text2image_default", "b64JsonToBlob", "b64_json", "mimeType", "base64Data", "byteCharacters", "byteArrays", "i", "byteArray", "STYLES", "createStyleAssetSource", "assetSourceId", "options", "styleValues", "style", "Ys", "styleAssetSource", "ye", "defaultStyle", "addStyleAssetSource", "label", "GptImage1", "config", "cesdk", "getProvider", "modelKey", "baseURL", "styleAssetSourceId", "styleAssetSource", "createStyleAssetSource", "addStyleAssetSource", "co", "builder", "payload", "asset", "Uu", "GptImage1_text2image_default", "state", "property", "styleState", "STYLES", "newValue", "input", "abortSignal", "stylePrompt", "style", "prompt", "hasGlobalAPIKey", "baseUrl", "b64_json", "blob", "b64JsonToBlob", "GptImage1_image2image_default", "MimeType", "ACTION_NAME", "ID", "I18N_PREFIX", "STYLES", "createStyleAssetSource", "assetSourceId", "options", "styleValues", "style", "Ys", "styleAssetSource", "ye", "defaultStyle", "addStyleAssetSource", "label", "ChangeStyleLibrary", "context", "cesdk", "modelKey", "baseURL", "styleAssetSourceId", "ko", "builder", "experimental", "generate", "engine", "close", "assetResult", "blockId", "uri", "Qs", "styleId", "id", "error", "ChangeStyleLibrary_default", "GptImage1", "config", "cesdk", "getProvider", "modelKey", "Uu", "L", "ChangeStyleLibrary_default", "GptImage1_image2image_default", "du", "input", "width", "height", "Zs", "abortSignal", "formData", "blockId", "exportedBlob", "MimeType", "image_url", "mimeType", "resolvedImageUrl", "he", "imageUrlBlob", "gr", "hasGlobalAPIKey", "baseUrl", "b64_json", "blob", "b64JsonToBlob", "OpenAi", "GptImage1", "open_ai_default"]
3
+ "sources": ["../../../plugin-utils/src/icons/formats.ts", "../../../plugin-utils/src/assetSources/CustomAssetSource.ts", "../../../plugin-utils/src/assetSources/IndexedDBAssetSource.ts", "../../../plugin-utils/src/assetSources/AggregatedAssetSource.ts", "../../../plugin-utils/src/metadata/Metadata.ts", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalArrays.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalByTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalObjects.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqualDeep.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqual.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqual.js", "../../../plugin-utils/src/metadata/FillProcessingMetadata.ts", "../../../plugin-utils/src/processing/fillProcessing.ts", "../../../plugin-utils/src/processing/constants.ts", "../../../plugin-utils/src/processing/initializeFillProcessing.ts", "../../../plugin-utils/src/processing/registerFillProcessingComponents.ts", "../../../plugin-utils/src/utils/colors.ts", "../../../plugin-utils/src/utils/upload.ts", "../../../plugin-utils/src/utils/uuid.ts", "../../../plugin-utils/src/utils/images.ts", "../../../plugin-utils/src/utils/isDefined.ts", "../../../plugin-utils/src/utils/toArray.ts", "../../../plugin-utils/src/translationHelpers.ts", "../../../plugin-utils/src/index.ts", "../../../plugin-ai-generation-web/src/ui/common/renderImageUrlProperty.ts", "../../../plugin-utils/src/icons/formats.ts", "../../../plugin-utils/src/assetSources/CustomAssetSource.ts", "../../../plugin-utils/src/assetSources/IndexedDBAssetSource.ts", "../../../plugin-utils/src/assetSources/AggregatedAssetSource.ts", "../../../plugin-utils/src/metadata/Metadata.ts", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySome.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalArrays.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalByTag.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_equalObjects.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqualDeep.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsEqual.js", "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqual.js", "../../../plugin-utils/src/metadata/FillProcessingMetadata.ts", "../../../plugin-utils/src/processing/fillProcessing.ts", "../../../plugin-utils/src/processing/constants.ts", "../../../plugin-utils/src/processing/initializeFillProcessing.ts", "../../../plugin-utils/src/processing/registerFillProcessingComponents.ts", "../../../plugin-utils/src/utils/colors.ts", "../../../plugin-utils/src/utils/upload.ts", "../../../plugin-utils/src/utils/uuid.ts", "../../../plugin-utils/src/utils/images.ts", "../../../plugin-utils/src/utils/isDefined.ts", "../../../plugin-utils/src/utils/toArray.ts", "../../../plugin-utils/src/translationHelpers.ts", "../../../plugin-utils/src/index.ts", "../../../plugin-ai-generation-web/src/ui/common/renderStyleTransferProperty.ts", "../../../plugin-ai-generation-web/src/utils/propertyContext.ts", "../../../plugin-ai-generation-web/src/utils/propertyResolver.ts", "../../../plugin-ai-generation-web/src/assets/integrateIntoDefaultAssetLibraryEntry.ts", "../../../plugin-ai-generation-web/src/core/ActionRegistry.ts", "../../../plugin-ai-generation-web/src/core/ProviderRegistry.ts", "../../../plugin-ai-generation-web/src/middleware/middleware.ts", "../../../plugin-ai-generation-web/src/middleware/loggingMiddleware.ts", "../../../plugin-ai-generation-web/src/utils/utils.ts", "../../../plugin-ai-generation-web/src/middleware/uploadMiddleware.ts", "../../../plugin-ai-generation-web/src/utils/mergeQuickActionsConfig.ts", "../../../plugin-ai-generation-web/src/middleware/rateLimitMiddleware.ts", "../../../plugin-ai-generation-web/src/utils/checkAiPluginVersion.ts", "../../../plugin-ai-generation-web/src/ui/components/registerDockComponent.ts", "../../../plugin-ai-generation-web/src/ui/quickActions/enableImageFill.ts", "../../../plugin-ai-generation-web/src/generation/handleGenerationError.ts", "../../../plugin-ai-generation-web/src/assets/previewUri.ts", "../../../plugin-ai-generation-web/src/assets/getAssetResultForPlaceholder.ts", "../../../plugin-ai-generation-web/src/assets/getAssetResultForGenerated.ts", "../../../plugin-ai-generation-web/src/generation/handleGenerateFromPanel.ts", "../../../plugin-ai-generation-web/src/ui/components/renderGenerationComponents.ts", "../../../plugin-ai-generation-web/src/ui/panels/createPanelRenderFunctionFromCustom.ts", "../../../plugin-ai-generation-web/src/openapi/dereferenceDocument.ts", "../../../plugin-ai-generation-web/src/openapi/isOpenAPISchema.ts", "../../../plugin-ai-generation-web/src/openapi/getProperties.ts", "../../../plugin-ai-generation-web/src/openapi/renderProperty.ts", "../../../plugin-ai-generation-web/src/openapi/defaultTranslations.ts", "../../../plugin-ai-generation-web/src/openapi/extractSchemaTranslations.ts", "../../../plugin-ai-generation-web/src/ui/panels/createPanelRenderFunctionFromSchema.ts", "../../../plugin-ai-generation-web/src/ui/panels/createPanelRenderFunction.ts", "../../../plugin-ai-generation-web/src/assets/initializeHistoryAssetSource.ts", "../../../plugin-ai-generation-web/src/assets/initializeHistoryAssetLibraryEntry.ts", "../../../plugin-ai-generation-web/src/ui/icons.ts", "../../../plugin-ai-generation-web/src/middleware/dryRunMiddleware.ts", "../../../plugin-ai-generation-web/src/core/constants.ts", "../../../plugin-ai-generation-web/src/generation/createGenerateFunction.ts", "../../../plugin-ai-generation-web/src/providers/initializeProvider.ts", "../../../plugin-ai-generation-web/src/assets/initializeHistoryCompositeAssetSource.ts", "../../../plugin-ai-generation-web/src/providers/initializeProviders.ts", "../../../plugin-ai-generation-web/src/ui/quickActions/utils.ts", "../../../plugin-ai-generation-web/src/ui/panels/createConfirmationRenderFunction.ts", "../../../plugin-ai-generation-web/src/utils/compactSeparators.ts", "../../../plugin-ai-generation-web/src/providers/getCanvasMenuComponentId.ts", "../../../plugin-ai-generation-web/src/ui/quickActions/getQuickActionOrder.ts", "../../../plugin-ai-generation-web/src/providers/getApplyCallbacks.ts", "../../../plugin-ai-generation-web/src/utils/lockSelectionToEditMode.ts", "../../../plugin-ai-generation-web/src/generation/CallbacksRegistry.ts", "../../../plugin-ai-generation-web/src/generation/handleGenerateFromQuickAction.ts", "../../../plugin-ai-generation-web/src/ui/quickActions/createQuickActionMenuRenderFunction.ts", "../../../plugin-ai-generation-web/src/ui/quickActions/initializeQuickActionComponents.ts", "../../../plugin-ai-generation-web/src/utils/translationHelpers.ts", "../../../plugin-ai-generation-web/src/index.ts", "../../src/open-ai/GptImage1.text2image.json", "../../src/open-ai/utils.ts", "../../src/open-ai/GptImage1.styles.ts", "../../src/open-ai/GptImage1.text2image.ts", "../../src/open-ai/GptImage1.image2image.json", "../../src/open-ai/GptImage1.image2image.ts", "../../src/open-ai/quickActions/ChangeStyleLibrary.ts", "../../src/open-ai/index.ts"],
4
+ "sourcesContent": ["export default `\n<svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/plugin/formats/ratioFree\"\n >\n <path d=\"M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z\" fill=\"currentColor\"/>\n <path d=\"M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z\" fill=\"currentColor\"/>\n <path d=\"M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z\" fill=\"currentColor\"/>\n <path d=\"M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z\" 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/plugin/formats/ratio4by3\"\n >\n <path d=\"M6.5 13H8V15H10V16.5H6.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M14 9V7.5H17.5V11H16V9H14Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z\" 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/plugin/formats/ratio16by9\"\n >\n <path d=\"M4.5 13H6V15H8V16.5H4.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M16 9V7.5H19.5V11H18V9H16Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z\" 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/plugin/formats/ratio9by16\"\n >\n <path d=\"M7.5 16H9V18H11V19.5H7.5V16Z\" fill=\"currentColor\"/>\n <path d=\"M13 6V4.5H16.5V8H15V6H13Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z\" 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/plugin/formats/ratio3by4\"\n >\n <path d=\"M11 17.5V16H9V14H7.5V17.5H11Z\" fill=\"currentColor\"/>\n <path d=\"M15 10H16.5V6.5H13V8H15V10Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z\" 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/plugin/formats/ratio1by1\"\n >\n <path d=\"M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z\" fill=\"currentColor\"/>\n <path d=\"M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z\" fill=\"currentColor\"/>\n <path d=\"M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z\" fill=\"currentColor\"/>\n <path d=\"M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z\" fill=\"currentColor\"/>\n </symbol>\n</svg>\n`;\n", "import type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/engine';\n\n/**\n * Simplified value type for select inputs that can be converted to asset definitions\n */\nexport type SelectValue = {\n id: string;\n label: string;\n thumbUri?: string;\n meta?: { [key: string]: any };\n};\n\n/**\n * Options for CustomAssetSource constructor\n */\nexport interface CustomAssetSourceOptions {\n /**\n * Optional callback function to translate asset labels\n * @param assetId - The ID of the asset to translate\n * @param fallbackLabel - The fallback label to use if translation is not available\n * @param locale - The current locale\n * @returns The translated label or fallback\n */\n translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n}\n\n/**\n * A custom AssetSource implementation that manages assets from an array\n * and provides additional functionality like to mark assets as active or changing\n * labels.\n */\nexport class CustomAssetSource implements AssetSource {\n /** The unique id of the asset source */\n id: string;\n\n /** Array of assets to be served by this source */\n private assets: AssetDefinition[];\n\n /** Set of IDs for active assets */\n private activeAssetIds: Set<string>;\n\n /** Optional translation callback function */\n private translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n\n /**\n * Creates a new instance of CustomAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n */\n constructor(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n ) {\n this.id = id;\n this.translateLabel = options?.translateLabel;\n this.assets = assets.map((asset) => {\n // Check if the asset is a SelectValue by looking for the label property as a string\n if (\n typeof (asset as SelectValue).label === 'string' &&\n !(\n (asset as AssetDefinition).label &&\n typeof (asset as AssetDefinition).label === 'object'\n )\n ) {\n const selectValue = asset as SelectValue;\n // Convert SelectValue to AssetDefinition\n return {\n id: selectValue.id,\n label: { en: selectValue.label },\n meta: selectValue.thumbUri\n ? { ...(selectValue.meta ?? {}), thumbUri: selectValue.thumbUri }\n : selectValue.meta\n } as AssetDefinition;\n }\n return asset as AssetDefinition;\n });\n this.activeAssetIds = new Set<string>();\n\n // Automatically set first asset as active if available\n if (this.assets.length > 0) {\n this.activeAssetIds.add(this.assets[0].id);\n }\n }\n\n /**\n * Find assets based on the provided query data\n * Supports pagination, searching, filtering, and active-first sorting\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n const {\n page,\n perPage,\n locale = 'en',\n sortActiveFirst,\n query,\n tags,\n groups,\n excludeGroups,\n sortingOrder,\n sortKey\n } = queryData;\n\n // Start with all assets\n let filteredAssets = [...this.assets];\n\n // Filter by groups if provided\n if (groups && groups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n asset.groups && groups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter out excluded groups if provided\n if (excludeGroups && excludeGroups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n !asset.groups ||\n !excludeGroups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter by query (search in label and tags)\n if (query) {\n const lowerQuery = query.toLowerCase();\n filteredAssets = filteredAssets.filter((asset) => {\n const label = asset.label?.[locale]?.toLowerCase();\n const assetTags = asset.tags?.[locale] || [];\n\n return (\n (label && label.includes(lowerQuery)) ||\n assetTags.some((tag) => tag.toLowerCase().includes(lowerQuery))\n );\n });\n }\n\n // Filter by exact tags if provided\n if (tags && tags.length > 0) {\n const tagArray = Array.isArray(tags) ? tags : [tags];\n filteredAssets = filteredAssets.filter((asset) => {\n const assetTags = asset.tags?.[locale] || [];\n return tagArray.some((tag) => assetTags.includes(tag));\n });\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n filteredAssets.sort((a, b) => {\n const aActive = this.activeAssetIds.has(a.id);\n const bActive = this.activeAssetIds.has(b.id);\n\n if (aActive && !bActive) return -1;\n if (!aActive && bActive) return 1;\n return 0;\n });\n }\n\n // Sort by sortKey if provided\n if (sortKey && sortKey !== 'id') {\n filteredAssets.sort((a, b) => {\n // Sort by metadata field\n const aValue = a.meta?.[sortKey];\n const bValue = b.meta?.[sortKey];\n\n if (aValue === undefined) return 1;\n if (bValue === undefined) return -1;\n\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n return sortingOrder === 'Descending'\n ? bValue.localeCompare(aValue)\n : aValue.localeCompare(bValue);\n }\n\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortingOrder === 'Descending'\n ? bValue - aValue\n : aValue - bValue;\n }\n\n return 0;\n });\n } else if (sortKey === 'id') {\n // Sort by id\n filteredAssets.sort((a, b) => {\n return sortingOrder === 'Descending'\n ? b.id.localeCompare(a.id)\n : a.id.localeCompare(b.id);\n });\n }\n\n // Calculate pagination\n const total = filteredAssets.length;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = filteredAssets.slice(startIndex, endIndex);\n\n // Transform AssetDefinition objects to AssetResult objects\n const resultAssets: AssetResult[] = paginatedAssets.map((asset) => {\n // Use translation callback if provided, otherwise use default label\n const fallbackLabel = asset.label?.[locale] || '';\n const label = this.translateLabel\n ? this.translateLabel(asset.id, fallbackLabel, locale)\n : fallbackLabel;\n\n return {\n id: asset.id,\n groups: asset.groups,\n meta: asset.meta,\n payload: asset.payload,\n locale,\n label,\n tags: asset.tags?.[locale],\n active: this.activeAssetIds.has(asset.id)\n };\n });\n\n // Calculate next page if there are more assets\n const nextPage = endIndex < total ? page + 1 : undefined;\n\n return {\n assets: resultAssets,\n currentPage: page,\n nextPage,\n total\n };\n }\n\n updateLabel(assetId: string, label: string, locale: string): void {\n this.assets.forEach((asset) => {\n if (asset.id === assetId) {\n asset.label = asset.label || {};\n asset.label[locale] = label;\n }\n });\n }\n\n /**\n * Get the asset select value by its ID\n *\n * @param assetId - The ID of the asset to retrieve\n * @returns The SelectValue object for the asset or undefined if not found\n */\n getAssetSelectValue(assetId: string): SelectValue | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n return undefined;\n }\n\n /**\n * Get the currently active asset as a SelectValue\n *\n * @returns The SelectValue object for the active asset or undefined if no asset is active\n */\n getActiveSelectValue(): SelectValue | undefined {\n const activeIds = this.getActiveAssetIds();\n if (activeIds.length > 0) {\n const asset = this.assets.find(({ id }) => id === activeIds[0]);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n }\n return undefined;\n }\n\n /**\n * Get the translated label for an asset by its ID\n *\n * @param assetId - The ID of the asset\n * @returns The translated label or undefined if asset not found\n */\n getTranslatedLabel(assetId: string): string | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n return this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n }\n return undefined;\n }\n\n /**\n * Get an asset by its ID\n */\n getAsset(id: string): AssetDefinition | undefined {\n return this.assets.find((asset) => asset.id === id);\n }\n\n /**\n * Set an asset as active by its ID\n *\n * @param assetId - The ID of the asset to mark as active\n */\n setAssetActive(assetId: string): void {\n this.activeAssetIds.add(assetId);\n }\n\n /**\n * Get all active asset IDs\n *\n * @returns Array of active asset IDs\n */\n getActiveAssetIds(): string[] {\n return Array.from(this.activeAssetIds);\n }\n\n /**\n * Set multiple assets as active by their IDs\n *\n * @param assetIds - Array of asset IDs to mark as active\n */\n setAssetsActive(assetIds: string[]): void {\n assetIds.forEach((id) => this.activeAssetIds.add(id));\n }\n\n /**\n * Set an asset as inactive by its ID\n *\n * @param assetId - The ID of the asset to mark as inactive\n */\n setAssetInactive(assetId: string): void {\n this.activeAssetIds.delete(assetId);\n }\n\n /**\n * Clear all active assets\n */\n clearActiveAssets(): void {\n this.activeAssetIds.clear();\n }\n\n /**\n * Check if an asset is marked as active\n *\n * @param assetId - The ID of the asset to check\n * @returns True if the asset is active, false otherwise\n */\n isAssetActive(assetId: string): boolean {\n return this.activeAssetIds.has(assetId);\n }\n\n /**\n * Add an asset to this source\n *\n * @param asset - The asset definition to add\n */\n addAsset(asset: AssetDefinition): void {\n // Check if asset with this ID already exists\n const existingIndex = this.assets.findIndex((a) => a.id === asset.id);\n if (existingIndex >= 0) {\n // Replace existing asset\n this.assets[existingIndex] = asset;\n } else {\n // Add new asset\n this.assets.push(asset);\n }\n }\n\n /**\n * Remove an asset from this source\n *\n * @param assetId - The ID of the asset to remove\n */\n removeAsset(assetId: string): void {\n const index = this.assets.findIndex((asset) => asset.id === assetId);\n if (index !== -1) {\n this.assets.splice(index, 1);\n this.activeAssetIds.delete(assetId);\n }\n }\n\n /**\n * Get all available groups from the assets\n *\n * @returns Array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groups = new Set<string>();\n this.assets.forEach((asset) => {\n if (asset.groups) {\n asset.groups.forEach((group) => groups.add(group));\n }\n });\n return Array.from(groups);\n }\n\n /**\n * Returns the supported MIME types for this asset source\n *\n * @returns Array of supported MIME types\n */\n getSupportedMimeTypes(): string[] {\n return [\n 'image/jpeg',\n 'image/png',\n 'image/svg+xml',\n 'image/webp',\n 'video/mp4',\n 'audio/mpeg'\n ];\n }\n}\n\n/**\n * Helper function to create a CustomAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n * @returns A new CustomAssetSource instance\n */\nexport function createCustomAssetSource(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n): CustomAssetSource {\n return new CustomAssetSource(id, assets, options);\n}\n\nexport default CustomAssetSource;\n", "/* eslint-disable no-console */\nimport {\n CreativeEngine,\n type AssetDefinition,\n type AssetQueryData,\n type AssetResult,\n type AssetSource,\n type AssetsQueryResult\n} from '@cesdk/cesdk-js';\n\ntype BlobEntry = {\n id: string;\n blob: Blob;\n};\n\n// Asset definition with meta containing insertedAt timestamp\ntype AssetEntryWithMeta = AssetDefinition;\n\n/**\n * IndexedDBAssetSource implements the AssetSource interface using IndexedDB as the storage backend.\n */\nexport class IndexedDBAssetSource implements AssetSource {\n /** The unique id of the API */\n public readonly id: string;\n\n public readonly engine: CreativeEngine;\n\n private readonly dbName: string;\n\n private readonly dbVersion: number;\n\n private readonly assetStoreName: string = 'assets';\n\n private readonly blobStoreName: string = 'blobs';\n\n private db: IDBDatabase | null = null;\n\n /**\n * Creates a new IndexedDBAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param {Object} [options] - Optional configuration options.\n * @param {string} [options.dbName] - The name of the database.\n * @param {number} [options.dbVersion] - The version number of the database.\n */\n constructor(\n id: string,\n engine: CreativeEngine,\n options?: {\n dbName?: string;\n dbVersion?: number;\n }\n ) {\n this.id = id;\n this.engine = engine;\n this.dbName = options?.dbName ?? `ly.img.assetSource/${id}`;\n this.dbVersion = options?.dbVersion ?? 1;\n }\n\n /**\n * Initialize the database connection and create object stores if needed\n */\n public async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n reject(\n new Error(\n `Failed to open IndexedDB: ${(event.target as IDBRequest).error}`\n )\n );\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n\n // Create asset store if it doesn't exist\n if (!db.objectStoreNames.contains(this.assetStoreName)) {\n db.createObjectStore(this.assetStoreName, {\n keyPath: 'id'\n });\n }\n // Create blob store if it doesn't exist\n if (!db.objectStoreNames.contains(this.blobStoreName)) {\n db.createObjectStore(this.blobStoreName, {\n keyPath: 'id'\n });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n resolve();\n };\n });\n }\n\n /**\n * Close the database connection\n */\n public close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n\n /**\n * Find all assets for the given type and the provided query data.\n *\n * @param queryData - The query parameters for filtering assets\n * @param insertionSortOrder - Optional parameter to sort by insertion time: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to the query results or undefined if there was an error\n */\n public async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n try {\n // Get all assets from the store with specified insertion order\n const assetDefinitions = await this.getAllAssets('asc');\n\n let assetResults = assetDefinitions.reduce((acc, assetDefinition) => {\n const locale = queryData.locale ?? 'en';\n let label = '';\n let tags: string[] = [];\n\n // Handle localized label if available\n if (\n assetDefinition.label != null &&\n typeof assetDefinition.label === 'object' &&\n assetDefinition.label[locale]\n ) {\n label = assetDefinition.label[locale];\n }\n\n // Handle localized tags if available\n if (\n assetDefinition.tags != null &&\n typeof assetDefinition.tags === 'object' &&\n assetDefinition.tags[locale]\n ) {\n tags = assetDefinition.tags[locale];\n }\n\n const result: AssetResult = {\n ...assetDefinition,\n label,\n tags\n };\n\n if (this.filterAsset(result, queryData)) {\n acc.push(result);\n }\n\n return acc;\n }, [] as AssetResult[]);\n\n assetResults = await this.restoreBlobUrls(assetResults);\n\n // Apply sorting\n assetResults = this.sortAssets(assetResults, queryData);\n\n // Apply pagination\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = assetResults.slice(startIndex, endIndex);\n\n // Determine if there's a next page\n const nextPage = endIndex < assetResults.length ? page + 1 : undefined;\n\n const result = {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: assetResults.length\n };\n\n return result;\n } catch (error) {\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n public async getGroups(): Promise<string[]> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const allGroups = new Set<string>();\n\n // Extract all groups from all assets\n (request.result as AssetResult[]).forEach((asset) => {\n if (asset.groups && Array.isArray(asset.groups)) {\n asset.groups.forEach((group) => allGroups.add(group));\n }\n });\n\n const uniqueGroups = [...allGroups];\n resolve(uniqueGroups);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get groups: ${request.error}`));\n };\n });\n }\n\n /**\n * Adds the given asset to this source. Part of the AssetSource interface.\n *\n * @param asset - The asset definition to add\n */\n public addAsset(asset: AssetDefinition): void {\n this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const assetStore = transaction.objectStore(this.assetStoreName);\n\n const blobsToStore = new Set<string>();\n processBlobUrls(asset, (value) => {\n blobsToStore.add(value);\n });\n\n setTimeout(() => {\n this.storeBlobUrls([...blobsToStore]);\n });\n\n // Ensure asset has meta object with insertedAt timestamp\n const assetWithMeta: AssetEntryWithMeta = {\n ...asset,\n meta: {\n ...asset.meta,\n insertedAt: asset.meta?.insertedAt || Date.now()\n }\n };\n\n // Store the asset in the database\n assetStore.put(assetWithMeta);\n\n transaction.onerror = () => {\n console.error(`Failed to add asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeAsset(assetId: string): Promise<void> {\n const asset = await this.getAsset(assetId);\n\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.assetStoreName);\n store.delete(assetId);\n\n transaction.oncomplete = () => {\n processBlobUrls(asset, (value) => {\n this.removeBlob(value);\n });\n this.engine.asset.assetSourceContentsChanged(this.id);\n };\n\n transaction.onerror = () => {\n console.error(`Failed to remove asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeBlob(blobId: string): Promise<void> {\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.blobStoreName);\n store.delete(blobId);\n\n transaction.onerror = () => {\n console.error(`Failed to remove blob: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Get all assets from the database sorted by insertion order (newest to oldest)\n *\n * @param sortOrder - Optional parameter to specify sort order: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to an array of all assets\n */\n private async getAllAssets(\n sortOrder: 'asc' | 'desc' = 'desc'\n ): Promise<AssetDefinition[]> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const assets = request.result as AssetEntryWithMeta[];\n\n // Sort by insertion timestamp\n assets.sort((a, b) => {\n // Default to current time if insertedAt is missing (for backward compatibility)\n // First check in meta.insertedAt, then fallback to legacy _insertedAt for backward compatibility\n const timeA =\n a.meta?.insertedAt || (a as any)._insertedAt || Date.now();\n const timeB =\n b.meta?.insertedAt || (b as any)._insertedAt || Date.now();\n\n // Sort based on requested order\n return sortOrder === 'asc'\n ? timeA - timeB // oldest first\n : timeB - timeA; // newest first (default)\n });\n\n resolve(assets);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get assets: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getAsset(id: string): Promise<AssetResult | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as AssetResult);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getBlob(id: string): Promise<BlobEntry | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.blobStoreName, 'readonly');\n const store = transaction.objectStore(this.blobStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as BlobEntry);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n async createBlobUrlFromStore(blobUrl: string): Promise<string> {\n const blobEntry = await this.getBlob(blobUrl);\n if (blobEntry != null) {\n return URL.createObjectURL(blobEntry.blob);\n }\n return blobUrl;\n }\n\n async storeBlobUrls(urls: string[]): Promise<void> {\n const blobsToStore: { [key: string]: Blob } = {};\n await Promise.all(\n urls.map(async (blobUrl) => {\n const blobResponse = await fetch(blobUrl);\n const blob = await blobResponse.blob();\n blobsToStore[blobUrl] = blob;\n })\n );\n\n return this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const blobStore = transaction.objectStore(this.blobStoreName);\n\n // Store the asset in the database\n Object.entries(blobsToStore).forEach(([key, blob]) => {\n const asset: BlobEntry = { id: key, blob };\n blobStore.put(asset);\n });\n\n transaction.onerror = () => {\n console.error(`Failed to add blobs: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n async restoreBlobUrls(assets: AssetResult[]): Promise<AssetResult[]> {\n const blobReplaced: { [key: string]: string } = {};\n const blobUrls: Set<string> = new Set();\n processBlobUrls(assets, (value) => {\n blobUrls.add(value);\n });\n\n await Promise.all(\n [...blobUrls].map(async (value) => {\n const newUrl = await this.createBlobUrlFromStore(value);\n blobReplaced[value] = newUrl;\n })\n );\n\n return processBlobUrls(assets, (value) => {\n return blobReplaced[value] ?? value;\n });\n }\n\n /**\n * Returns if the given asset should be filtered based on query data\n *\n * @param asset - The asset to filter\n * @param queryData - The query parameters to filter by\n * @returns true if the asset should be included, false otherwise\n */\n private filterAsset(asset: AssetResult, queryData: AssetQueryData): boolean {\n const { query, tags, groups, excludeGroups } = queryData;\n\n // Filter by query string (search on label and tags)\n if (query && query.trim() !== '') {\n const lowerQuery = query.trim().toLowerCase().split(' ');\n\n const lowerLabel = asset.label?.toLowerCase() ?? '';\n const lowerTags = asset.tags?.map((tag) => tag.toLowerCase()) ?? [];\n\n const matchLabelOrTag = lowerQuery.every((word) => {\n return (\n lowerLabel.includes(word) ||\n lowerTags.some((tag) => tag.includes(word))\n );\n });\n\n if (!matchLabelOrTag) {\n return false;\n }\n }\n\n // Filter by exact tags if provided by the query\n if (tags) {\n const tagList = Array.isArray(tags) ? tags : [tags];\n if (\n tagList.length > 0 &&\n (!asset.tags || !tagList.every((tag) => asset.tags?.includes(tag)))\n ) {\n return false;\n }\n }\n\n // Filter by groups\n if (groups && groups.length > 0) {\n if (\n !asset.groups ||\n !groups.some((group) => asset.groups?.includes(group))\n ) {\n return false;\n }\n }\n\n // Filter by excluded groups\n if (excludeGroups && excludeGroups.length > 0) {\n if (\n asset.groups &&\n asset.groups.some((group) => excludeGroups.includes(group))\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Sort assets based on query data\n *\n * @param assets - The assets to sort\n * @param queryData - The query parameters with sorting information\n * @returns The sorted assets\n */\n private sortAssets(\n assets: AssetResult[],\n queryData: AssetQueryData\n ): AssetResult[] {\n const { sortingOrder, sortKey, sortActiveFirst } = queryData;\n\n // Clone the array to avoid modifying the original\n const sortedAssets = [...assets];\n\n // If no sorting order specified or set to 'None', return the current order\n if (!sortingOrder || sortingOrder === 'None') {\n return sortedAssets;\n }\n\n // Sort by the specified key\n if (sortKey) {\n sortedAssets.sort((a, b) => {\n let valueA;\n let valueB;\n\n if (sortKey === 'id') {\n valueA = a.id;\n valueB = b.id;\n } else {\n // Handle metadata sorting (assuming metadata is stored in a 'metadata' field)\n valueA = a.meta?.[sortKey] ?? null;\n valueB = b.meta?.[sortKey] ?? null;\n }\n\n // Handle null/undefined values\n if (valueA === null || valueA === undefined)\n return sortingOrder === 'Ascending' ? -1 : 1;\n if (valueB === null || valueB === undefined)\n return sortingOrder === 'Ascending' ? 1 : -1;\n\n // Compare values based on sorting order\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return sortingOrder === 'Ascending'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n } else {\n return sortingOrder === 'Ascending'\n ? valueA < valueB\n ? -1\n : valueA > valueB\n ? 1\n : 0\n : valueA > valueB\n ? -1\n : valueA < valueB\n ? 1\n : 0;\n }\n });\n } else if (sortingOrder === 'Descending') {\n // If no sort key is specified, and sorting order set\n // to Descending, just reverse original order\n sortedAssets.reverse();\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n sortedAssets.sort((a, b) => {\n if (a.active && !b.active) return -1;\n if (!a.active && b.active) return 1;\n return 0;\n });\n }\n\n return sortedAssets;\n }\n}\n\n/**\n * Goes through an object and calls a callback for every string value that starts with 'blob:'\n * The callback can return a string to replace the original value\n * @param obj The object to traverse\n * @param callback Function to call when a blob URL is found, can return a replacement value\n * @param path Current path in the object (used for recursion)\n * @returns The modified object (or the original if no replacements were made)\n */\nfunction processBlobUrls<T>(\n obj: T,\n callback: (value: string, path: string) => string | void,\n path: string = ''\n): T {\n // Return the object as is if it's null or not an object\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n for (let index = 0; index < obj.length; index++) {\n const currentPath = path ? `${path}[${index}]` : `[${index}]`;\n\n if (typeof obj[index] === 'string' && obj[index].startsWith('blob:')) {\n const replacement = callback(obj[index], currentPath);\n if (typeof replacement === 'string') {\n obj[index] = replacement;\n }\n } else {\n obj[index] = processBlobUrls(obj[index], callback, currentPath);\n }\n }\n return obj;\n }\n\n // Handle regular objects\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const currentPath = path ? `${path}.${key}` : key;\n\n if (typeof value === 'string' && value.startsWith('blob:')) {\n const replacement = callback(value, currentPath);\n if (typeof replacement === 'string') {\n // @ts-ignore\n obj[key] = replacement;\n }\n } else {\n obj[key] = processBlobUrls(value, callback, currentPath);\n }\n }\n }\n\n return obj;\n}\n\nexport default IndexedDBAssetSource;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/cesdk-js';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * AggregatedAssetSource implements the AssetSource interface by aggregating\n * multiple asset sources via the cesdk API and combining their results.\n *\n * This asset source is read-only - it does not support adding or removing assets.\n */\nexport class AggregatedAssetSource implements AssetSource {\n /** The unique id of the asset source */\n public readonly id: string;\n\n /** The Creative Editor SDK instance */\n private cesdk: CreativeEditorSDK;\n\n /** The IDs of asset sources to aggregate */\n private assetSourceIds: string[];\n\n /**\n * Creates a new AggregatedAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n */\n constructor(id: string, cesdk: CreativeEditorSDK, assetSourceIds: string[]) {\n this.id = id;\n this.cesdk = cesdk;\n this.assetSourceIds = assetSourceIds;\n }\n\n /**\n * Find assets across all aggregated sources based on the provided query data\n * Results are sorted by the insertedAt timestamp in meta field\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n try {\n // Query all asset sources via cesdk\n const queryPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.findAssets(sourceId, {\n ...queryData,\n // Increase page size to get all assets from each source\n // We'll handle pagination after merging\n perPage: 9999,\n page: 0\n })\n );\n\n // Wait for all queries to complete\n const results = await Promise.all(queryPromises);\n\n // Combine all assets from all sources\n let allAssets: AssetResult[] = [];\n results.forEach((result) => {\n if (result?.assets) {\n allAssets = allAssets.concat(result.assets);\n }\n });\n\n // Sort by insertedAt timestamp\n allAssets.sort((a, b) => {\n const timeA = (a.meta?.insertedAt as number) || 0;\n const timeB = (b.meta?.insertedAt as number) || 0;\n\n // Sort newest first (descending)\n return timeB - timeA;\n });\n\n // Apply pagination after merging\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = allAssets.slice(startIndex, endIndex);\n\n // Calculate if there is a next page\n const nextPage = endIndex < allAssets.length ? page + 1 : undefined;\n\n return {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: allAssets.length\n };\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n /**\n * Retrieves all groups from all aggregated asset sources using cesdk\n * @returns Promise with an array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groupPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.getGroups(sourceId)\n );\n\n const groupArrays = await Promise.all(groupPromises);\n\n // Combine and deduplicate groups\n const uniqueGroups = new Set<string>();\n groupArrays.forEach((groups) => {\n groups.forEach((group) => uniqueGroups.add(group));\n });\n\n return Array.from(uniqueGroups);\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n addAsset(_asset: AssetDefinition): void {\n throw new Error('AggregatedAssetSource does not support adding assets');\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n removeAsset(_assetId: string): void {\n throw new Error('AggregatedAssetSource does not support removing assets');\n }\n}\n\n/**\n * Helper function to create an AggregatedAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n * @returns A new AggregatedAssetSource instance\n */\nexport function createAggregatedAssetSource(\n id: string,\n cesdk: CreativeEditorSDK,\n assetSourceIds: string[]\n): AggregatedAssetSource {\n return new AggregatedAssetSource(id, cesdk, assetSourceIds);\n}\n\nexport default AggregatedAssetSource;\n", "import { type CreativeEngine } from '@cesdk/cesdk-js';\n\nclass Metadata<V> {\n engine: CreativeEngine;\n\n key: string;\n\n constructor(engine: CreativeEngine, key: string) {\n this.engine = engine;\n this.key = key;\n }\n\n hasData(blockId: number): boolean {\n return (\n this.engine.block.isValid(blockId) &&\n this.engine.block.hasMetadata(blockId, this.key)\n );\n }\n\n get(blockId: number): V | undefined {\n if (this.hasData(blockId)) {\n return JSON.parse(this.engine.block.getMetadata(blockId, this.key));\n }\n return undefined;\n }\n\n set(blockId: number, value: V) {\n this.engine.block.setMetadata(blockId, this.key, JSON.stringify(value));\n }\n\n clear(blockId: number) {\n if (this.engine.block.hasMetadata(blockId, this.key)) {\n this.engine.block.removeMetadata(blockId, this.key);\n }\n }\n}\n\nexport default Metadata;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import baseIsEqual from './_baseIsEqual.js';\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nexport default isEqual;\n", "import { isEqual } from 'lodash-es';\n\nimport Metadata from './Metadata';\nimport {\n PluginStatusError,\n PluginStatusMetadata,\n PluginStatusProcessed,\n PluginStatusProcessing\n} from './types';\n\nclass ImageProcessingMetadata extends Metadata<PluginStatusMetadata> {\n get(blockId: number): PluginStatusMetadata {\n return super.get(blockId) ?? { status: 'IDLE' };\n }\n\n /**\n * Detect if the block has been duplicated with processed or processing\n * fill processing. In that case the processing state is still\n * valid, but blockId and fillId have changed.\n */\n isDuplicate(blockId: number): boolean {\n if (!this.engine.block.isValid(blockId)) return false;\n\n const metadata = this.get(blockId);\n\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return false;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n\n // It cannot be a duplicate if the blockId or fillId are the same\n if (metadata.blockId === blockId || metadata.fillId === fillId)\n return false;\n\n return true;\n }\n\n /**\n * Fixes the metadata if the block has been duplicated, i.e. the blockId and\n * fillId will be updated to the current block/fill.\n *\n * Please note: Call this method only on duplicates (see isDuplicate).\n */\n fixDuplicate(blockId: number) {\n const fillId = this.engine.block.getFill(blockId);\n const metadata = this.get(blockId);\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return;\n this.set(blockId, {\n ...metadata,\n blockId,\n fillId\n });\n\n // If it is currently processing the best we can do is to just recover\n // the initial image data, since no processing will update this block and\n // it will be stuck in the processing state.\n if (metadata.status === 'PROCESSING') {\n this.recoverInitialImageData(blockId);\n this.clear(blockId);\n }\n }\n\n /**\n * Check if the image has a consisten metadata state. A inconsistent state is\n * caused by outside changes of the fill data.\n *\n * @returns true if the metadata is consistent, false otherwise\n */\n isConsistent(blockId: number): boolean {\n // In case the block was removed, we just abort and mark it\n // as reset by returning true\n if (!this.engine.block.isValid(blockId)) return false;\n const metadata = this.get(blockId);\n if (metadata.status === 'IDLE' || metadata.status === 'PENDING')\n return true;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n if (fillId == null) return false;\n\n if (blockId !== metadata.blockId || fillId !== metadata.fillId)\n return false;\n\n const sourceSet = this.engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const imageFileURI = this.engine.block.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n\n if (\n sourceSet.length === 0 &&\n !imageFileURI &&\n metadata.status === 'PROCESSING'\n ) {\n // While we process it is OK to have no image file URI and no source set\n // (which we cleared to show the spinning loader)\n return true;\n }\n\n // Source sets have precedence over imageFileURI so if we have a source set,\n // we only need to check if it has changed to something else.\n if (sourceSet?.length > 0) {\n const initialSourceSet = metadata.initialSourceSet;\n // If we have already processed the image, we need to check if the source set\n // we need to check against both source sets, the removed and the initial\n if (metadata.status !== 'PROCESSED') {\n if (!isEqual(sourceSet, initialSourceSet)) {\n return false;\n }\n }\n } else {\n if (metadata.status !== 'PROCESSED') {\n if (imageFileURI !== metadata.initialImageFileURI) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Recover the initial values to avoid the loading spinner and have the same\n * state as before the fill processing was started.\n */\n recoverInitialImageData(blockId: number) {\n const blockApi = this.engine.block;\n if (!blockApi.hasFill(blockId)) return; // Nothing to recover (no fill anymore)\n\n const metadata = this.get(blockId);\n\n if (metadata.status === 'PENDING' || metadata.status === 'IDLE') {\n return;\n }\n\n const initialSourceSet = metadata.initialSourceSet;\n const initialImageFileURI = metadata.initialImageFileURI;\n const initialPreviewFileURI = metadata.initialPreviewFileURI;\n\n const fillId = this.getValidFill(blockId, metadata);\n if (fillId == null) return;\n\n if (initialImageFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/imageFileURI',\n initialImageFileURI\n );\n }\n if (initialPreviewFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/previewFileURI',\n initialPreviewFileURI\n );\n }\n if (initialSourceSet.length > 0) {\n this.engine.block.setSourceSet(\n fillId,\n 'fill/image/sourceSet',\n initialSourceSet\n );\n }\n }\n\n /**\n * Returns the fill id of the block if it has a valid fill that was used for\n * fill processing. Returns undefined otherwise.\n */\n private getValidFill(\n blockId: number,\n metadata: PluginStatusProcessing | PluginStatusError | PluginStatusProcessed\n ): number | undefined {\n if (\n !this.engine.block.isValid(blockId) ||\n !this.engine.block.hasFill(blockId) ||\n blockId !== metadata.blockId\n ) {\n return undefined;\n }\n const fillId = this.engine.block.getFill(blockId);\n if (fillId !== metadata.fillId) {\n return undefined;\n }\n\n return fillId;\n }\n}\n\nexport default ImageProcessingMetadata;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n PluginStatusProcessed,\n PluginStatusProcessing\n} from '../metadata/types';\n\ninterface FillProcessor<T> {\n processFill(metadataState: PluginStatusProcessing): Promise<T>;\n\n commitProcessing(\n data: T,\n metadataState: PluginStatusProcessed\n ): number | void;\n}\n\nasync function fillProcessing<T>(\n blockId: number,\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n processor: FillProcessor<T>\n) {\n const blockApi = cesdk.engine.block;\n if (!blockApi.hasFill(blockId))\n throw new Error('Block does not support fill');\n\n const fillId = blockApi.getFill(blockId);\n\n // Get the current image URI and source set as initial values.\n const initialSourceSet = blockApi.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const initialImageFileURI = blockApi.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n const initialPreviewFileURI = blockApi.getString(\n fillId,\n 'fill/image/previewFileURI'\n );\n try {\n cesdk.engine.block.setState(fillId, {\n type: 'Pending',\n progress: 0\n });\n\n const status: PluginStatusProcessing = {\n ...metadata.get(blockId),\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSING'\n };\n\n metadata.set(blockId, status);\n\n const processedData = await processor.processFill(status);\n // Check for externally changed state while we were applying the mask and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n // Check for externally changed state while we were uploading and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n if (processedData == null) return;\n\n const metadataStateProcessed: PluginStatusProcessed = {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSED'\n };\n\n const blockIdOrVoid = processor.commitProcessing(\n processedData,\n metadataStateProcessed\n );\n\n // If a new block was created, we do not update the metadata.\n if (blockIdOrVoid == null || blockIdOrVoid === blockId) {\n metadata.set(blockId, metadataStateProcessed);\n }\n\n // Finally, create an undo step\n cesdk.engine.editor.addUndoStep();\n } catch (error) {\n if (cesdk.engine.block.isValid(blockId)) {\n metadata.set(blockId, {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'ERROR'\n });\n\n metadata.recoverInitialImageData(blockId);\n }\n\n if (\n error != null &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n const message =\n error.message === 'signal timed out'\n ? 'Processing canceled due to timeout'\n : error.message;\n cesdk.ui.showNotification({\n type: 'error',\n message\n });\n }\n\n // eslint-disable-next-line no-console\n console.log(error);\n } finally {\n if (cesdk.engine.block.isValid(fillId)) {\n cesdk.engine.block.setState(fillId, { type: 'Ready' });\n }\n }\n}\n\nexport default fillProcessing;\n", "export function getFeatureId(pluginId: string): string {\n return `${pluginId}.fillProcessing.feature`;\n}\n\nexport function getCanvasMenuComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasMenu`, `${pluginId}.fillProcessing.canvasMenu`];\n}\n\nexport function getDockComponentIds(pluginId: string): string[] {\n return [`${pluginId}.dock`, `${pluginId}.fillProcessing.dock`];\n}\n\nexport function getInspectorBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.inspectorBar`,\n `${pluginId}.fillProcessing.inspectorBar`\n ];\n}\n\nexport function getNavigationBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.navigationBar`,\n `${pluginId}.fillProcessing.navigationBar`\n ];\n}\n\nexport function getCanvasBarComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasBar`, `${pluginId}.fillProcessing.canvasBar`];\n}\n\nexport function getI18nCanvasMenuLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasMenu.button.label`;\n}\n\nexport function getI18nDockLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.dock.button.label`;\n}\n\nexport function getI18nInspectorBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.inspectorBar.button.label`;\n}\n\nexport function getI18nNavigationBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.navigationBar.button.label`;\n}\n\nexport function getI18nCanvasBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasBar.button.label`;\n}\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\nimport { FillProcessingMetadata } from '..';\nimport { getFeatureId } from './constants';\n\nexport default function handleFillProcessing(\n cesdk: CreativeEditorSDK,\n {\n pluginId,\n process\n }: {\n pluginId: string;\n icon?: string;\n process: (blockId: number, metadata: FillProcessingMetadata) => void;\n }\n): {\n featureId: string;\n} {\n const featureId = getFeatureId(pluginId);\n\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n enableFeatures(cesdk, metadata, featureId);\n\n cesdk.engine.event.subscribe([], async (events) => {\n events.forEach((e) => {\n const id = e.block;\n if (!cesdk.engine.block.isValid(id) || !metadata.hasData(id)) {\n return;\n }\n\n if (e.type === 'Created') {\n if (metadata.isDuplicate(id)) {\n metadata.fixDuplicate(id);\n }\n } else if (e.type === 'Updated') {\n switch (metadata.get(id).status) {\n case 'PENDING': {\n if (\n cesdk.feature.isEnabled(featureId, {\n engine: cesdk.engine\n }) &&\n cesdk.engine.block.isAllowedByScope(id, 'fill/change') &&\n cesdk.engine.block.getState(id).type !== 'Pending'\n ) {\n process(id, metadata);\n }\n break;\n }\n\n case 'PROCESSING':\n case 'PROCESSED': {\n if (!metadata.isConsistent(id)) {\n metadata.clear(id);\n }\n break;\n }\n\n default: {\n // We do not care about other states\n }\n }\n }\n });\n });\n\n return { featureId };\n}\n\n/**\n * Defines the feature that determines in which context (on which block)\n * fill processing is allowed/enabled.\n */\nfunction enableFeatures(\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n featureId: string\n) {\n cesdk.feature.enable(featureId, ({ engine }) => {\n const selectedIds = engine.block.findAllSelected();\n if (selectedIds.length !== 1) {\n return false;\n }\n const [selectedId] = selectedIds;\n\n if (!cesdk.engine.block.isVisible(selectedId)) return false;\n\n if (cesdk.engine.block.hasFill(selectedId)) {\n const kind = cesdk.engine.block.getKind(selectedId);\n if (kind === 'sticker') return false;\n\n const fillId = cesdk.engine.block.getFill(selectedId);\n const fillType = cesdk.engine.block.getType(fillId);\n\n if (fillType !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n const fileUri = engine.block.getString(fillId, 'fill/image/imageFileURI');\n const sourceSet = engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n\n if (sourceSet.length > 0 || fileUri !== '') return true;\n\n // If we are in a processing state we do not have a imageFileURI or\n // source set set (to show the loading spinner), but the feature is still\n // enabled.\n return metadata.get(selectedId).status === 'PROCESSING';\n }\n\n return false;\n });\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n getCanvasBarComponentIds,\n getCanvasMenuComponentIds,\n getDockComponentIds,\n getFeatureId,\n getI18nCanvasBarLabel,\n getI18nCanvasMenuLabel,\n getI18nDockLabel,\n getI18nInspectorBarLabel,\n getI18nNavigationBarLabel,\n getInspectorBarComponentIds,\n getNavigationBarComponentIds\n} from './constants';\n\nexport type Location =\n | 'inspectorBar'\n | 'navigationBar'\n | 'canvasBarTop'\n | 'canvasBarBottom'\n | 'canvasMenu'\n | 'dock';\n\n/**\n * Registers the components that can be used to process the fill of\n * a block.\n */\nexport default function registerFillProcessingComponents(\n cesdk: CreativeEditorSDK,\n options: {\n pluginId: string;\n icon?: string;\n locations?: Location | Location[];\n }\n): {\n canvasMenuComponentId: string;\n dockComponentId: string;\n\n translationsKeys: {\n inspectorBarLabel: string;\n navigationBarLabel: string;\n canvasBarLabel: string;\n canvasMenuLabel: string;\n dockLabel: string;\n };\n} {\n const { pluginId, locations } = options;\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n const canvasMenuLabel = getI18nCanvasMenuLabel(pluginId);\n const canvasMenuComponentIds = getCanvasMenuComponentIds(pluginId);\n const canvasMenuComponentId = canvasMenuComponentIds[0];\n\n const dockLabel = getI18nDockLabel(pluginId);\n const dockComponentIds = getDockComponentIds(pluginId);\n const dockComponentId = dockComponentIds[0];\n\n const inspectorBarLabel = getI18nInspectorBarLabel(pluginId);\n const inspectorBarComponentIds = getInspectorBarComponentIds(pluginId);\n const inspectorBarComponentId = inspectorBarComponentIds[0];\n\n const navigationBarLabel = getI18nNavigationBarLabel(pluginId);\n const navigationBarComponentIds = getNavigationBarComponentIds(pluginId);\n const navigationBarComponentId = navigationBarComponentIds[0];\n\n const canvasBarLabel = getI18nCanvasBarLabel(pluginId);\n const canvasBarComponentIds = getCanvasBarComponentIds(pluginId);\n const canvasBarComponentId = canvasBarComponentIds[0];\n\n const featureId = getFeatureId(pluginId);\n\n if (locations?.includes('inspectorBar')) {\n cesdk.ui.setInspectorBarOrder([\n inspectorBarComponentId,\n ...cesdk.ui.getInspectorBarOrder()\n ]);\n }\n\n if (locations?.includes('navigationBar')) {\n cesdk.ui.setNavigationBarOrder([\n navigationBarComponentId,\n ...cesdk.ui.getNavigationBarOrder()\n ]);\n }\n\n if (locations?.includes('canvasBarTop')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('top')],\n 'top'\n );\n }\n\n if (locations?.includes('canvasBarBottom')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('bottom')],\n 'bottom'\n );\n }\n\n if (locations?.includes('canvasMenu')) {\n cesdk.ui.setCanvasMenuOrder([\n canvasMenuComponentId,\n ...cesdk.ui.getCanvasMenuOrder()\n ]);\n }\n\n if (locations?.includes('dock')) {\n cesdk.ui.setDockOrder([...cesdk.ui.getDockOrder(), dockComponentId]);\n }\n\n cesdk.ui.registerComponent(\n dockComponentIds,\n ({ builder: { Button }, engine }) => {\n const [id] = engine.block.findAllSelected();\n\n let isDisabled = false;\n let isLoading = false;\n let loadingProgress: number | undefined;\n\n if (id == null) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.engine.block.isAllowedByScope(id, 'fill/change')\n ) {\n isDisabled = true;\n }\n\n if (!isDisabled && engine.block.getState(id)?.type === 'Pending') {\n isDisabled = true;\n }\n\n if (!isDisabled) {\n const currentMetadata = metadata.get(id);\n\n isLoading = currentMetadata.status === 'PROCESSING';\n isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING';\n\n if (\n currentMetadata.status === 'PROCESSING' &&\n currentMetadata.progress\n ) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n }\n\n const buttonId = `${dockComponentId}.button`;\n Button(buttonId, {\n label: dockLabel,\n icon: options.icon,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n const currentMetadata = metadata.get(id);\n\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n\n const buttonComponents: {\n componentIds: string[];\n label: string;\n variant: 'plain' | 'regular';\n }[] = [\n {\n componentIds: inspectorBarComponentIds,\n variant: 'plain',\n label: inspectorBarLabel\n },\n {\n componentIds: navigationBarComponentIds,\n variant: 'regular',\n label: navigationBarLabel\n },\n {\n componentIds: canvasBarComponentIds,\n variant: 'regular',\n label: canvasBarLabel\n },\n {\n componentIds: canvasMenuComponentIds,\n variant: 'plain',\n label: canvasMenuLabel\n }\n ];\n\n buttonComponents.forEach(({ componentIds, label, variant }) => {\n const componentId = componentIds[0];\n cesdk.ui.registerComponent(\n componentIds,\n ({ builder: { Button }, engine }) => {\n if (\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n return;\n }\n\n const [id] = engine.block.findAllSelected();\n\n if (!cesdk.engine.block.isAllowedByScope(id, 'fill/change')) return;\n\n const currentMetadata = metadata.get(id);\n\n const isLoading = currentMetadata.status === 'PROCESSING';\n const isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING' ||\n engine.block.getState(id)?.type === 'Pending';\n\n let loadingProgress: number | undefined;\n if (isLoading && currentMetadata.progress) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n\n const buttonId = `${componentId}.button`;\n Button(buttonId, {\n icon: options.icon,\n label,\n variant,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n });\n\n return {\n canvasMenuComponentId,\n dockComponentId,\n translationsKeys: {\n inspectorBarLabel,\n navigationBarLabel,\n canvasBarLabel,\n canvasMenuLabel,\n dockLabel\n }\n };\n}\n", "import { type RGBAColor } from '@cesdk/cesdk-js';\n\nconst HEX_COLOR_PATTERN = new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'i');\nconst HEX_SINGLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{1}/, 'g');\nconst HEX_DOUBLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{2}/, 'g');\n\n/** @public */\nexport const rgbaToHex = (rgba: RGBAColor, includeAlpha = false): string => {\n const { r, g, b, a } = rgba;\n const rByte = Math.round(255 * r);\n const gByte = Math.round(255 * g);\n const bByte = Math.round(255 * b);\n const aByte = Math.round(255 * a);\n const byteToHex = (byte: number) => {\n return byte.toString(16).padStart(2, '0');\n };\n return `#${byteToHex(rByte)}${byteToHex(gByte)}${byteToHex(bByte)}${\n includeAlpha ? byteToHex(aByte) : ''\n }`;\n};\n\n/** @public */\nexport const hexToRgba = (hexString: string): RGBAColor => {\n const rgbaHexToColor = (\n r: string,\n g: string,\n b: string,\n a: string | undefined,\n max: number\n ) => {\n return {\n r: parseInt(r, 16) / max,\n g: parseInt(g, 16) / max,\n b: parseInt(b, 16) / max,\n a: a === undefined ? 1 : parseInt(a, 16) / max\n };\n };\n\n if (hexString.startsWith('#')) {\n if (hexString.length === 4 || hexString.length === 5) {\n const hexMatch = hexString.match(HEX_SINGLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 15);\n }\n }\n if (hexString.length === 7 || hexString.length === 8) {\n const hexMatch = hexString.match(HEX_DOUBLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 255);\n }\n }\n }\n\n throw new Error(\n 'Invalid hex string! Allowed RGB formats are \"#FFF\" and \"#FFFFFF\". Allowed RGBA formats are \"#FFFF\" and \"#FFFFFFFF'\n );\n};\n\n/** @public */\nexport const isValidHexColor = (hexString: string): boolean => {\n return HEX_COLOR_PATTERN.test(hexString);\n};\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Uploads a blob with the help of CE.SDK\n */\nexport async function uploadBlob(\n blob: Blob,\n initialUri: string,\n cesdk: CreativeEditorSDK\n) {\n const pathname = new URL(initialUri).pathname;\n const parts = pathname.split('/');\n const extension = mimeTypeToExtension(blob.type);\n const filename = parts[parts.length - 1]?.split('.')?.[0] ?? 'asset';\n const filenameWithExtension = `${filename}.${extension}`;\n\n const uploadedAssets = await cesdk.unstable_upload(\n new File([blob], filenameWithExtension, { type: blob.type }),\n () => {\n // TODO Delegate process to UI component\n }\n );\n\n const url = uploadedAssets.meta?.uri;\n if (url == null) {\n throw new Error('Could not upload processed fill');\n }\n return url;\n}\n\n/**\n * Returns the file extension for a given mime type.\n */\nexport function mimeTypeToExtension(mimeType: string): string {\n const extensions: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/webp': 'webp',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg'\n };\n return extensions[mimeType] ?? 'png';\n}\n\nexport async function fetchImageBlob(uri: string): Promise<Blob> {\n return fetch(uri).then((response) => response.blob());\n}\n\n/**\n * Converts a buffer URI to a object url.\n */\nexport async function bufferURIToObjectURL(\n uri: string,\n engine: CreativeEngine\n): Promise<string> {\n if (uri.startsWith('buffer:')) {\n const mimeType = await engine.editor.getMimeType(uri);\n const length = engine.editor.getBufferLength(uri);\n const data = engine.editor.getBufferData(uri, 0, length);\n const buffer = new Uint8Array(data);\n const blob = new Blob([buffer], { type: mimeType });\n return URL.createObjectURL(blob);\n } else {\n return uri;\n }\n}\n", "function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\nexport default uuid4;\n", "import { bufferURIToObjectURL } from './upload';\nimport { type CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Get the dimensions of an image from its URL\n *\n * @param url - The URL of the image\n * @returns A promise that resolves to an object containing the width and height of the image\n */\nexport async function getImageDimensionsFromURL(\n url: string,\n engine: CreativeEngine\n): Promise<{ width: number; height: number }> {\n const resolvedUrl = await bufferURIToObjectURL(url, engine);\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n img.src = resolvedUrl;\n });\n}\n\n/**\n * Get the URI of an image from a block ID, either the first source of a source set or\n * the image file URI. Will handle buffer URIs and convert them to object URLs.\n */\nexport async function getImageUri(\n blockId: number,\n engine: CreativeEngine,\n options?: { throwErrorIfSvg?: boolean }\n): Promise<string> {\n let uri;\n const fillBlock = engine.block.getFill(blockId);\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) throw new Error('No image source/uri found');\n } else {\n uri = source.uri;\n }\n\n // Check if the image is SVG (not supported)\n if (options?.throwErrorIfSvg) {\n const mimeType = await engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n }\n\n return bufferURIToObjectURL(uri, engine);\n}\n\n/**\n * Returns if the given fill block is an SVG image fill.\n */\nexport async function isSvgFill(\n fillBlock: number,\n engine: CreativeEngine\n): Promise<boolean> {\n if (engine.block.getType(fillBlock) !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n let uri;\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) return false;\n } else {\n uri = source.uri;\n }\n\n const mimeType = await engine.editor.getMimeType(uri);\n return mimeType === 'image/svg+xml';\n}\n", "/**\n * Checks if a value is defined (not undefined).\n *\n * Helpful to filter out undefined values from an array or collection\n * while keeping the type information intact.\n *\n * ```\n * array.filter(isDefined)\n * ```\n */\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined;\n}\n\nexport default isDefined;\n", "/**\n * Converts a value to an array format.\n *\n * @template T The type of the array elements\n * @param value - The value to convert. Can be a single item, an array, null, or undefined\n * @returns An array containing the value(s). Returns empty array if value is null/undefined,\n * the original array if value is already an array, or a single-element array if value is a single item\n *\n * @example\n * ```typescript\n * toArray('hello') // ['hello']\n * toArray(['a', 'b']) // ['a', 'b']\n * toArray(null) // []\n * toArray(undefined) // []\n * toArray(42) // [42]\n * ```\n */\nfunction toArray<T>(value?: T | T[]): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nexport default toArray;\n", "/**\n * Interface for objects that have translation capabilities\n */\ninterface TranslationAPI {\n translate(key: string | string[]): string;\n}\n\n/**\n * Check if CE.SDK supports the translate API (version 1.59.0 or higher)\n * @param cesdk - The CE.SDK instance to check\n * @returns True if the translate API is supported\n */\nexport function supportsTranslateAPI(cesdk: any): boolean {\n if (!cesdk?.version) return false;\n\n // Use localeCompare for semantic version comparison\n // Returns >= 0 when cesdk.version is 1.59.0 or higher\n const comparison = cesdk.version.localeCompare('1.59.0', undefined, {\n numeric: true,\n sensitivity: 'base'\n });\n\n return comparison >= 0 && typeof cesdk.i18n?.translate === 'function';\n}\n\n/**\n * Type guard to check if an object has the translate API\n * @param i18n - The object to check\n * @returns True if the object has a translate function\n */\nexport function hasTranslateAPI(i18n: any): i18n is TranslationAPI {\n return typeof i18n?.translate === 'function';\n}\n", "import formatsIconSprite from './icons/formats';\n\nconst Icons = {\n Formats: formatsIconSprite\n};\n\nexport { Icons };\n\nexport {\n CustomAssetSource,\n type CustomAssetSourceOptions,\n type SelectValue\n} from './assetSources/CustomAssetSource';\n\nexport { IndexedDBAssetSource } from './assetSources/IndexedDBAssetSource';\n\nexport { AggregatedAssetSource } from './assetSources/AggregatedAssetSource';\n\nexport { default as Metadata } from './metadata/Metadata';\n\nexport { default as FillProcessingMetadata } from './metadata/FillProcessingMetadata';\n\nexport { default as fillProcessing } from './processing/fillProcessing';\n\nexport { default as initializeFillProcessing } from './processing/initializeFillProcessing';\n\nexport { default as registerFillProcessingComponents } from './processing/registerFillProcessingComponents';\n\nexport { type Optional } from './types/Optional';\n\nexport {\n type Location,\n type UserInterfaceConfiguration\n} from './types/UserInterfaceConfiguration';\n\nexport { hexToRgba, isValidHexColor, rgbaToHex } from './utils/colors';\n\nexport {\n uploadBlob,\n fetchImageBlob,\n bufferURIToObjectURL,\n mimeTypeToExtension\n} from './utils/upload';\n\nexport { default as uuid } from './utils/uuid';\n\nexport {\n getImageDimensionsFromURL,\n getImageUri,\n isSvgFill\n} from './utils/images';\n\nexport { default as isDefined } from './utils/isDefined';\n\nexport { default as toArray } from './utils/toArray';\n\nexport { supportsTranslateAPI, hasTranslateAPI } from './translationHelpers';\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { RenderCustomProperty } from '../../core/provider';\n\n/**\n * Provides render function for a image url property that allows\n * to select an image from the library with a MediaPreview\n *\n * By default this expects the property key to be `image_url`. This can be changed in the options.\n */\nfunction renderImageUrlProperty(\n provderId: string,\n options: {\n cesdk: CreativeEditorSDK;\n propertyKey?: string;\n defaultUrl?: string;\n }\n): RenderCustomProperty {\n const { cesdk } = options;\n const propertyKey = options.propertyKey ?? 'image_url';\n const panelIdForImageSelection = getImageSelectionPanelId(provderId);\n\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${panelIdForImageSelection}`]: 'Select Image To Change'\n }\n });\n\n createPanels(provderId, cesdk);\n\n const customProperties: RenderCustomProperty = {\n [propertyKey]: (context, property) => {\n const {\n builder,\n experimental: { global },\n payload\n } = context;\n\n // Check for provider configuration defaults\n let configuredDefault: string | undefined;\n const providerConfig = (context as any).providerConfig;\n const pluginConfig = (context as any).config;\n\n // Check provider config first, then plugin config\n const propertyConfig =\n providerConfig?.properties?.[property.id] ??\n (pluginConfig as any)?.properties?.[property.id];\n\n if (propertyConfig?.default) {\n if (typeof propertyConfig.default === 'function') {\n // If it's a function, call it with a basic context\n configuredDefault = propertyConfig.default({}) as string;\n } else {\n configuredDefault = propertyConfig.default as string;\n }\n }\n\n // Use configured default, then payload url, then static default\n const defaultUrl =\n configuredDefault ?? payload?.url ?? options.defaultUrl;\n const stateValue = global<string>(\n `${provderId}.${property.id}`,\n defaultUrl\n );\n\n builder.MediaPreview(property.id, {\n preview: {\n type: 'image',\n uri: stateValue.value\n },\n action: {\n label: 'Select Image',\n onClick: () => {\n if (cesdk == null) return;\n\n cesdk.ui.openPanel(panelIdForImageSelection, {\n payload: {\n onSelect: (assetResult: AssetResult) => {\n if (assetResult.meta?.uri != null) {\n stateValue.setValue(assetResult.meta?.uri);\n }\n }\n }\n });\n }\n }\n });\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: stateValue.value\n };\n };\n }\n };\n\n return customProperties;\n}\n\nfunction createPanels(providerId: string, cesdk?: CreativeEditorSDK) {\n if (cesdk == null) return;\n\n cesdk.ui.registerPanel<{\n onSelect: (assetResult: AssetResult) => void;\n }>(getImageSelectionPanelId(providerId), ({ builder, payload }) => {\n builder.Library(`${providerId}.library.image`, {\n entries: ['ly.img.image'],\n onSelect: async (asset) => {\n const uri = asset?.meta?.uri;\n if (uri == null) return;\n\n const mimeType = await cesdk.engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n cesdk.ui.showNotification({\n type: 'warning',\n message:\n 'SVG images are not supported. Please choose a different image.'\n });\n } else if (mimeType.startsWith('image/')) {\n payload?.onSelect(asset);\n cesdk?.ui.closePanel(getImageSelectionPanelId(providerId));\n } else {\n cesdk.ui.showNotification({\n type: 'warning',\n message: `Only images are supported. Found '${mimeType}'. Please choose a different image.`\n });\n }\n }\n });\n });\n}\n\nfunction getImageSelectionPanelId(providerId: string) {\n return `ly.img.ai.${providerId}.imageSelection`;\n}\n\nexport default renderImageUrlProperty;\n", "export default `\n<svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/plugin/formats/ratioFree\"\n >\n <path d=\"M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z\" fill=\"currentColor\"/>\n <path d=\"M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z\" fill=\"currentColor\"/>\n <path d=\"M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z\" fill=\"currentColor\"/>\n <path d=\"M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z\" 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/plugin/formats/ratio4by3\"\n >\n <path d=\"M6.5 13H8V15H10V16.5H6.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M14 9V7.5H17.5V11H16V9H14Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z\" 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/plugin/formats/ratio16by9\"\n >\n <path d=\"M4.5 13H6V15H8V16.5H4.5V13Z\" fill=\"currentColor\"/>\n <path d=\"M16 9V7.5H19.5V11H18V9H16Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z\" 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/plugin/formats/ratio9by16\"\n >\n <path d=\"M7.5 16H9V18H11V19.5H7.5V16Z\" fill=\"currentColor\"/>\n <path d=\"M13 6V4.5H16.5V8H15V6H13Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z\" 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/plugin/formats/ratio3by4\"\n >\n <path d=\"M11 17.5V16H9V14H7.5V17.5H11Z\" fill=\"currentColor\"/>\n <path d=\"M15 10H16.5V6.5H13V8H15V10Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z\" 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/plugin/formats/ratio1by1\"\n >\n <path d=\"M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z\" fill=\"currentColor\"/>\n <path d=\"M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z\" fill=\"currentColor\"/>\n <path d=\"M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z\" fill=\"currentColor\"/>\n <path d=\"M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z\" fill=\"currentColor\"/>\n </symbol>\n</svg>\n`;\n", "import type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/engine';\n\n/**\n * Simplified value type for select inputs that can be converted to asset definitions\n */\nexport type SelectValue = {\n id: string;\n label: string;\n thumbUri?: string;\n meta?: { [key: string]: any };\n};\n\n/**\n * Options for CustomAssetSource constructor\n */\nexport interface CustomAssetSourceOptions {\n /**\n * Optional callback function to translate asset labels\n * @param assetId - The ID of the asset to translate\n * @param fallbackLabel - The fallback label to use if translation is not available\n * @param locale - The current locale\n * @returns The translated label or fallback\n */\n translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n}\n\n/**\n * A custom AssetSource implementation that manages assets from an array\n * and provides additional functionality like to mark assets as active or changing\n * labels.\n */\nexport class CustomAssetSource implements AssetSource {\n /** The unique id of the asset source */\n id: string;\n\n /** Array of assets to be served by this source */\n private assets: AssetDefinition[];\n\n /** Set of IDs for active assets */\n private activeAssetIds: Set<string>;\n\n /** Optional translation callback function */\n private translateLabel?: (\n assetId: string,\n fallbackLabel: string,\n locale: string\n ) => string;\n\n /**\n * Creates a new instance of CustomAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n */\n constructor(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n ) {\n this.id = id;\n this.translateLabel = options?.translateLabel;\n this.assets = assets.map((asset) => {\n // Check if the asset is a SelectValue by looking for the label property as a string\n if (\n typeof (asset as SelectValue).label === 'string' &&\n !(\n (asset as AssetDefinition).label &&\n typeof (asset as AssetDefinition).label === 'object'\n )\n ) {\n const selectValue = asset as SelectValue;\n // Convert SelectValue to AssetDefinition\n return {\n id: selectValue.id,\n label: { en: selectValue.label },\n meta: selectValue.thumbUri\n ? { ...(selectValue.meta ?? {}), thumbUri: selectValue.thumbUri }\n : selectValue.meta\n } as AssetDefinition;\n }\n return asset as AssetDefinition;\n });\n this.activeAssetIds = new Set<string>();\n\n // Automatically set first asset as active if available\n if (this.assets.length > 0) {\n this.activeAssetIds.add(this.assets[0].id);\n }\n }\n\n /**\n * Find assets based on the provided query data\n * Supports pagination, searching, filtering, and active-first sorting\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n const {\n page,\n perPage,\n locale = 'en',\n sortActiveFirst,\n query,\n tags,\n groups,\n excludeGroups,\n sortingOrder,\n sortKey\n } = queryData;\n\n // Start with all assets\n let filteredAssets = [...this.assets];\n\n // Filter by groups if provided\n if (groups && groups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n asset.groups && groups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter out excluded groups if provided\n if (excludeGroups && excludeGroups.length > 0) {\n filteredAssets = filteredAssets.filter(\n (asset) =>\n !asset.groups ||\n !excludeGroups.some((group) => asset.groups?.includes(group))\n );\n }\n\n // Filter by query (search in label and tags)\n if (query) {\n const lowerQuery = query.toLowerCase();\n filteredAssets = filteredAssets.filter((asset) => {\n const label = asset.label?.[locale]?.toLowerCase();\n const assetTags = asset.tags?.[locale] || [];\n\n return (\n (label && label.includes(lowerQuery)) ||\n assetTags.some((tag) => tag.toLowerCase().includes(lowerQuery))\n );\n });\n }\n\n // Filter by exact tags if provided\n if (tags && tags.length > 0) {\n const tagArray = Array.isArray(tags) ? tags : [tags];\n filteredAssets = filteredAssets.filter((asset) => {\n const assetTags = asset.tags?.[locale] || [];\n return tagArray.some((tag) => assetTags.includes(tag));\n });\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n filteredAssets.sort((a, b) => {\n const aActive = this.activeAssetIds.has(a.id);\n const bActive = this.activeAssetIds.has(b.id);\n\n if (aActive && !bActive) return -1;\n if (!aActive && bActive) return 1;\n return 0;\n });\n }\n\n // Sort by sortKey if provided\n if (sortKey && sortKey !== 'id') {\n filteredAssets.sort((a, b) => {\n // Sort by metadata field\n const aValue = a.meta?.[sortKey];\n const bValue = b.meta?.[sortKey];\n\n if (aValue === undefined) return 1;\n if (bValue === undefined) return -1;\n\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n return sortingOrder === 'Descending'\n ? bValue.localeCompare(aValue)\n : aValue.localeCompare(bValue);\n }\n\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortingOrder === 'Descending'\n ? bValue - aValue\n : aValue - bValue;\n }\n\n return 0;\n });\n } else if (sortKey === 'id') {\n // Sort by id\n filteredAssets.sort((a, b) => {\n return sortingOrder === 'Descending'\n ? b.id.localeCompare(a.id)\n : a.id.localeCompare(b.id);\n });\n }\n\n // Calculate pagination\n const total = filteredAssets.length;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = filteredAssets.slice(startIndex, endIndex);\n\n // Transform AssetDefinition objects to AssetResult objects\n const resultAssets: AssetResult[] = paginatedAssets.map((asset) => {\n // Use translation callback if provided, otherwise use default label\n const fallbackLabel = asset.label?.[locale] || '';\n const label = this.translateLabel\n ? this.translateLabel(asset.id, fallbackLabel, locale)\n : fallbackLabel;\n\n return {\n id: asset.id,\n groups: asset.groups,\n meta: asset.meta,\n payload: asset.payload,\n locale,\n label,\n tags: asset.tags?.[locale],\n active: this.activeAssetIds.has(asset.id)\n };\n });\n\n // Calculate next page if there are more assets\n const nextPage = endIndex < total ? page + 1 : undefined;\n\n return {\n assets: resultAssets,\n currentPage: page,\n nextPage,\n total\n };\n }\n\n updateLabel(assetId: string, label: string, locale: string): void {\n this.assets.forEach((asset) => {\n if (asset.id === assetId) {\n asset.label = asset.label || {};\n asset.label[locale] = label;\n }\n });\n }\n\n /**\n * Get the asset select value by its ID\n *\n * @param assetId - The ID of the asset to retrieve\n * @returns The SelectValue object for the asset or undefined if not found\n */\n getAssetSelectValue(assetId: string): SelectValue | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n return undefined;\n }\n\n /**\n * Get the currently active asset as a SelectValue\n *\n * @returns The SelectValue object for the active asset or undefined if no asset is active\n */\n getActiveSelectValue(): SelectValue | undefined {\n const activeIds = this.getActiveAssetIds();\n if (activeIds.length > 0) {\n const asset = this.assets.find(({ id }) => id === activeIds[0]);\n if (asset) {\n // Get translated label if translation callback is available\n const label = this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n\n return {\n id: asset.id,\n label,\n thumbUri: asset.meta?.thumbUri\n };\n }\n }\n return undefined;\n }\n\n /**\n * Get the translated label for an asset by its ID\n *\n * @param assetId - The ID of the asset\n * @returns The translated label or undefined if asset not found\n */\n getTranslatedLabel(assetId: string): string | undefined {\n const asset = this.assets.find(({ id }) => id === assetId);\n if (asset) {\n return this.translateLabel\n ? this.translateLabel(asset.id, asset.label?.en || '', '')\n : asset.label?.en || '';\n }\n return undefined;\n }\n\n /**\n * Get an asset by its ID\n */\n getAsset(id: string): AssetDefinition | undefined {\n return this.assets.find((asset) => asset.id === id);\n }\n\n /**\n * Set an asset as active by its ID\n *\n * @param assetId - The ID of the asset to mark as active\n */\n setAssetActive(assetId: string): void {\n this.activeAssetIds.add(assetId);\n }\n\n /**\n * Get all active asset IDs\n *\n * @returns Array of active asset IDs\n */\n getActiveAssetIds(): string[] {\n return Array.from(this.activeAssetIds);\n }\n\n /**\n * Set multiple assets as active by their IDs\n *\n * @param assetIds - Array of asset IDs to mark as active\n */\n setAssetsActive(assetIds: string[]): void {\n assetIds.forEach((id) => this.activeAssetIds.add(id));\n }\n\n /**\n * Set an asset as inactive by its ID\n *\n * @param assetId - The ID of the asset to mark as inactive\n */\n setAssetInactive(assetId: string): void {\n this.activeAssetIds.delete(assetId);\n }\n\n /**\n * Clear all active assets\n */\n clearActiveAssets(): void {\n this.activeAssetIds.clear();\n }\n\n /**\n * Check if an asset is marked as active\n *\n * @param assetId - The ID of the asset to check\n * @returns True if the asset is active, false otherwise\n */\n isAssetActive(assetId: string): boolean {\n return this.activeAssetIds.has(assetId);\n }\n\n /**\n * Add an asset to this source\n *\n * @param asset - The asset definition to add\n */\n addAsset(asset: AssetDefinition): void {\n // Check if asset with this ID already exists\n const existingIndex = this.assets.findIndex((a) => a.id === asset.id);\n if (existingIndex >= 0) {\n // Replace existing asset\n this.assets[existingIndex] = asset;\n } else {\n // Add new asset\n this.assets.push(asset);\n }\n }\n\n /**\n * Remove an asset from this source\n *\n * @param assetId - The ID of the asset to remove\n */\n removeAsset(assetId: string): void {\n const index = this.assets.findIndex((asset) => asset.id === assetId);\n if (index !== -1) {\n this.assets.splice(index, 1);\n this.activeAssetIds.delete(assetId);\n }\n }\n\n /**\n * Get all available groups from the assets\n *\n * @returns Array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groups = new Set<string>();\n this.assets.forEach((asset) => {\n if (asset.groups) {\n asset.groups.forEach((group) => groups.add(group));\n }\n });\n return Array.from(groups);\n }\n\n /**\n * Returns the supported MIME types for this asset source\n *\n * @returns Array of supported MIME types\n */\n getSupportedMimeTypes(): string[] {\n return [\n 'image/jpeg',\n 'image/png',\n 'image/svg+xml',\n 'image/webp',\n 'video/mp4',\n 'audio/mpeg'\n ];\n }\n}\n\n/**\n * Helper function to create a CustomAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param assets - Array of asset definitions or SelectValue objects to include in this source\n * @param options - Optional configuration for the asset source\n * @returns A new CustomAssetSource instance\n */\nexport function createCustomAssetSource(\n id: string,\n assets: (AssetDefinition | SelectValue)[] = [],\n options?: CustomAssetSourceOptions\n): CustomAssetSource {\n return new CustomAssetSource(id, assets, options);\n}\n\nexport default CustomAssetSource;\n", "/* eslint-disable no-console */\nimport {\n CreativeEngine,\n type AssetDefinition,\n type AssetQueryData,\n type AssetResult,\n type AssetSource,\n type AssetsQueryResult\n} from '@cesdk/cesdk-js';\n\ntype BlobEntry = {\n id: string;\n blob: Blob;\n};\n\n// Asset definition with meta containing insertedAt timestamp\ntype AssetEntryWithMeta = AssetDefinition;\n\n/**\n * IndexedDBAssetSource implements the AssetSource interface using IndexedDB as the storage backend.\n */\nexport class IndexedDBAssetSource implements AssetSource {\n /** The unique id of the API */\n public readonly id: string;\n\n public readonly engine: CreativeEngine;\n\n private readonly dbName: string;\n\n private readonly dbVersion: number;\n\n private readonly assetStoreName: string = 'assets';\n\n private readonly blobStoreName: string = 'blobs';\n\n private db: IDBDatabase | null = null;\n\n /**\n * Creates a new IndexedDBAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param {Object} [options] - Optional configuration options.\n * @param {string} [options.dbName] - The name of the database.\n * @param {number} [options.dbVersion] - The version number of the database.\n */\n constructor(\n id: string,\n engine: CreativeEngine,\n options?: {\n dbName?: string;\n dbVersion?: number;\n }\n ) {\n this.id = id;\n this.engine = engine;\n this.dbName = options?.dbName ?? `ly.img.assetSource/${id}`;\n this.dbVersion = options?.dbVersion ?? 1;\n }\n\n /**\n * Initialize the database connection and create object stores if needed\n */\n public async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n reject(\n new Error(\n `Failed to open IndexedDB: ${(event.target as IDBRequest).error}`\n )\n );\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n\n // Create asset store if it doesn't exist\n if (!db.objectStoreNames.contains(this.assetStoreName)) {\n db.createObjectStore(this.assetStoreName, {\n keyPath: 'id'\n });\n }\n // Create blob store if it doesn't exist\n if (!db.objectStoreNames.contains(this.blobStoreName)) {\n db.createObjectStore(this.blobStoreName, {\n keyPath: 'id'\n });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n resolve();\n };\n });\n }\n\n /**\n * Close the database connection\n */\n public close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n\n /**\n * Find all assets for the given type and the provided query data.\n *\n * @param queryData - The query parameters for filtering assets\n * @param insertionSortOrder - Optional parameter to sort by insertion time: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to the query results or undefined if there was an error\n */\n public async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n try {\n // Get all assets from the store with specified insertion order\n const assetDefinitions = await this.getAllAssets('asc');\n\n let assetResults = assetDefinitions.reduce((acc, assetDefinition) => {\n const locale = queryData.locale ?? 'en';\n let label = '';\n let tags: string[] = [];\n\n // Handle localized label if available\n if (\n assetDefinition.label != null &&\n typeof assetDefinition.label === 'object' &&\n assetDefinition.label[locale]\n ) {\n label = assetDefinition.label[locale];\n }\n\n // Handle localized tags if available\n if (\n assetDefinition.tags != null &&\n typeof assetDefinition.tags === 'object' &&\n assetDefinition.tags[locale]\n ) {\n tags = assetDefinition.tags[locale];\n }\n\n const result: AssetResult = {\n ...assetDefinition,\n label,\n tags\n };\n\n if (this.filterAsset(result, queryData)) {\n acc.push(result);\n }\n\n return acc;\n }, [] as AssetResult[]);\n\n assetResults = await this.restoreBlobUrls(assetResults);\n\n // Apply sorting\n assetResults = this.sortAssets(assetResults, queryData);\n\n // Apply pagination\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = assetResults.slice(startIndex, endIndex);\n\n // Determine if there's a next page\n const nextPage = endIndex < assetResults.length ? page + 1 : undefined;\n\n const result = {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: assetResults.length\n };\n\n return result;\n } catch (error) {\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n public async getGroups(): Promise<string[]> {\n await this.initialize();\n\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const allGroups = new Set<string>();\n\n // Extract all groups from all assets\n (request.result as AssetResult[]).forEach((asset) => {\n if (asset.groups && Array.isArray(asset.groups)) {\n asset.groups.forEach((group) => allGroups.add(group));\n }\n });\n\n const uniqueGroups = [...allGroups];\n resolve(uniqueGroups);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get groups: ${request.error}`));\n };\n });\n }\n\n /**\n * Adds the given asset to this source. Part of the AssetSource interface.\n *\n * @param asset - The asset definition to add\n */\n public addAsset(asset: AssetDefinition): void {\n this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const assetStore = transaction.objectStore(this.assetStoreName);\n\n const blobsToStore = new Set<string>();\n processBlobUrls(asset, (value) => {\n blobsToStore.add(value);\n });\n\n setTimeout(() => {\n this.storeBlobUrls([...blobsToStore]);\n });\n\n // Ensure asset has meta object with insertedAt timestamp\n const assetWithMeta: AssetEntryWithMeta = {\n ...asset,\n meta: {\n ...asset.meta,\n insertedAt: asset.meta?.insertedAt || Date.now()\n }\n };\n\n // Store the asset in the database\n assetStore.put(assetWithMeta);\n\n transaction.onerror = () => {\n console.error(`Failed to add asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeAsset(assetId: string): Promise<void> {\n const asset = await this.getAsset(assetId);\n\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.assetStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.assetStoreName);\n store.delete(assetId);\n\n transaction.oncomplete = () => {\n processBlobUrls(asset, (value) => {\n this.removeBlob(value);\n });\n this.engine.asset.assetSourceContentsChanged(this.id);\n };\n\n transaction.onerror = () => {\n console.error(`Failed to remove asset: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Removes the given asset from this source. Part of the AssetSource interface.\n *\n * @param assetId - The ID of the asset to remove\n */\n public async removeBlob(blobId: string): Promise<void> {\n return this.initialize()\n .then(() => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const store = transaction.objectStore(this.blobStoreName);\n store.delete(blobId);\n\n transaction.onerror = () => {\n console.error(`Failed to remove blob: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n /**\n * Get all assets from the database sorted by insertion order (newest to oldest)\n *\n * @param sortOrder - Optional parameter to specify sort order: 'asc' for oldest first, 'desc' for newest first (default)\n * @returns A promise that resolves to an array of all assets\n */\n private async getAllAssets(\n sortOrder: 'asc' | 'desc' = 'desc'\n ): Promise<AssetDefinition[]> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.getAll();\n\n request.onsuccess = () => {\n const assets = request.result as AssetEntryWithMeta[];\n\n // Sort by insertion timestamp\n assets.sort((a, b) => {\n // Default to current time if insertedAt is missing (for backward compatibility)\n // First check in meta.insertedAt, then fallback to legacy _insertedAt for backward compatibility\n const timeA =\n a.meta?.insertedAt || (a as any)._insertedAt || Date.now();\n const timeB =\n b.meta?.insertedAt || (b as any)._insertedAt || Date.now();\n\n // Sort based on requested order\n return sortOrder === 'asc'\n ? timeA - timeB // oldest first\n : timeB - timeA; // newest first (default)\n });\n\n resolve(assets);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get assets: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getAsset(id: string): Promise<AssetResult | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.assetStoreName, 'readonly');\n const store = transaction.objectStore(this.assetStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as AssetResult);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n // Retrieve a blob by ID\n async getBlob(id: string): Promise<BlobEntry | undefined> {\n return new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.blobStoreName, 'readonly');\n const store = transaction.objectStore(this.blobStoreName);\n const request = store.get(id);\n\n request.onsuccess = () => {\n resolve(request.result as BlobEntry);\n };\n\n request.onerror = () => {\n reject(new Error(`Failed to get blob: ${request.error}`));\n };\n });\n }\n\n async createBlobUrlFromStore(blobUrl: string): Promise<string> {\n const blobEntry = await this.getBlob(blobUrl);\n if (blobEntry != null) {\n return URL.createObjectURL(blobEntry.blob);\n }\n return blobUrl;\n }\n\n async storeBlobUrls(urls: string[]): Promise<void> {\n const blobsToStore: { [key: string]: Blob } = {};\n await Promise.all(\n urls.map(async (blobUrl) => {\n const blobResponse = await fetch(blobUrl);\n const blob = await blobResponse.blob();\n blobsToStore[blobUrl] = blob;\n })\n );\n\n return this.initialize()\n .then(async () => {\n if (!this.db) {\n throw new Error('Database not initialized');\n }\n\n const transaction = this.db.transaction(\n this.blobStoreName,\n 'readwrite'\n );\n const blobStore = transaction.objectStore(this.blobStoreName);\n\n // Store the asset in the database\n Object.entries(blobsToStore).forEach(([key, blob]) => {\n const asset: BlobEntry = { id: key, blob };\n blobStore.put(asset);\n });\n\n transaction.onerror = () => {\n console.error(`Failed to add blobs: ${transaction.error}`);\n };\n })\n .catch((error) => {\n console.error('Error initializing database:', error);\n });\n }\n\n async restoreBlobUrls(assets: AssetResult[]): Promise<AssetResult[]> {\n const blobReplaced: { [key: string]: string } = {};\n const blobUrls: Set<string> = new Set();\n processBlobUrls(assets, (value) => {\n blobUrls.add(value);\n });\n\n await Promise.all(\n [...blobUrls].map(async (value) => {\n const newUrl = await this.createBlobUrlFromStore(value);\n blobReplaced[value] = newUrl;\n })\n );\n\n return processBlobUrls(assets, (value) => {\n return blobReplaced[value] ?? value;\n });\n }\n\n /**\n * Returns if the given asset should be filtered based on query data\n *\n * @param asset - The asset to filter\n * @param queryData - The query parameters to filter by\n * @returns true if the asset should be included, false otherwise\n */\n private filterAsset(asset: AssetResult, queryData: AssetQueryData): boolean {\n const { query, tags, groups, excludeGroups } = queryData;\n\n // Filter by query string (search on label and tags)\n if (query && query.trim() !== '') {\n const lowerQuery = query.trim().toLowerCase().split(' ');\n\n const lowerLabel = asset.label?.toLowerCase() ?? '';\n const lowerTags = asset.tags?.map((tag) => tag.toLowerCase()) ?? [];\n\n const matchLabelOrTag = lowerQuery.every((word) => {\n return (\n lowerLabel.includes(word) ||\n lowerTags.some((tag) => tag.includes(word))\n );\n });\n\n if (!matchLabelOrTag) {\n return false;\n }\n }\n\n // Filter by exact tags if provided by the query\n if (tags) {\n const tagList = Array.isArray(tags) ? tags : [tags];\n if (\n tagList.length > 0 &&\n (!asset.tags || !tagList.every((tag) => asset.tags?.includes(tag)))\n ) {\n return false;\n }\n }\n\n // Filter by groups\n if (groups && groups.length > 0) {\n if (\n !asset.groups ||\n !groups.some((group) => asset.groups?.includes(group))\n ) {\n return false;\n }\n }\n\n // Filter by excluded groups\n if (excludeGroups && excludeGroups.length > 0) {\n if (\n asset.groups &&\n asset.groups.some((group) => excludeGroups.includes(group))\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Sort assets based on query data\n *\n * @param assets - The assets to sort\n * @param queryData - The query parameters with sorting information\n * @returns The sorted assets\n */\n private sortAssets(\n assets: AssetResult[],\n queryData: AssetQueryData\n ): AssetResult[] {\n const { sortingOrder, sortKey, sortActiveFirst } = queryData;\n\n // Clone the array to avoid modifying the original\n const sortedAssets = [...assets];\n\n // If no sorting order specified or set to 'None', return the current order\n if (!sortingOrder || sortingOrder === 'None') {\n return sortedAssets;\n }\n\n // Sort by the specified key\n if (sortKey) {\n sortedAssets.sort((a, b) => {\n let valueA;\n let valueB;\n\n if (sortKey === 'id') {\n valueA = a.id;\n valueB = b.id;\n } else {\n // Handle metadata sorting (assuming metadata is stored in a 'metadata' field)\n valueA = a.meta?.[sortKey] ?? null;\n valueB = b.meta?.[sortKey] ?? null;\n }\n\n // Handle null/undefined values\n if (valueA === null || valueA === undefined)\n return sortingOrder === 'Ascending' ? -1 : 1;\n if (valueB === null || valueB === undefined)\n return sortingOrder === 'Ascending' ? 1 : -1;\n\n // Compare values based on sorting order\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return sortingOrder === 'Ascending'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n } else {\n return sortingOrder === 'Ascending'\n ? valueA < valueB\n ? -1\n : valueA > valueB\n ? 1\n : 0\n : valueA > valueB\n ? -1\n : valueA < valueB\n ? 1\n : 0;\n }\n });\n } else if (sortingOrder === 'Descending') {\n // If no sort key is specified, and sorting order set\n // to Descending, just reverse original order\n sortedAssets.reverse();\n }\n\n // Sort by active first if requested\n if (sortActiveFirst) {\n sortedAssets.sort((a, b) => {\n if (a.active && !b.active) return -1;\n if (!a.active && b.active) return 1;\n return 0;\n });\n }\n\n return sortedAssets;\n }\n}\n\n/**\n * Goes through an object and calls a callback for every string value that starts with 'blob:'\n * The callback can return a string to replace the original value\n * @param obj The object to traverse\n * @param callback Function to call when a blob URL is found, can return a replacement value\n * @param path Current path in the object (used for recursion)\n * @returns The modified object (or the original if no replacements were made)\n */\nfunction processBlobUrls<T>(\n obj: T,\n callback: (value: string, path: string) => string | void,\n path: string = ''\n): T {\n // Return the object as is if it's null or not an object\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n for (let index = 0; index < obj.length; index++) {\n const currentPath = path ? `${path}[${index}]` : `[${index}]`;\n\n if (typeof obj[index] === 'string' && obj[index].startsWith('blob:')) {\n const replacement = callback(obj[index], currentPath);\n if (typeof replacement === 'string') {\n obj[index] = replacement;\n }\n } else {\n obj[index] = processBlobUrls(obj[index], callback, currentPath);\n }\n }\n return obj;\n }\n\n // Handle regular objects\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const currentPath = path ? `${path}.${key}` : key;\n\n if (typeof value === 'string' && value.startsWith('blob:')) {\n const replacement = callback(value, currentPath);\n if (typeof replacement === 'string') {\n // @ts-ignore\n obj[key] = replacement;\n }\n } else {\n obj[key] = processBlobUrls(value, callback, currentPath);\n }\n }\n }\n\n return obj;\n}\n\nexport default IndexedDBAssetSource;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type {\n AssetDefinition,\n AssetQueryData,\n AssetResult,\n AssetSource,\n AssetsQueryResult\n} from '@cesdk/cesdk-js';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * AggregatedAssetSource implements the AssetSource interface by aggregating\n * multiple asset sources via the cesdk API and combining their results.\n *\n * This asset source is read-only - it does not support adding or removing assets.\n */\nexport class AggregatedAssetSource implements AssetSource {\n /** The unique id of the asset source */\n public readonly id: string;\n\n /** The Creative Editor SDK instance */\n private cesdk: CreativeEditorSDK;\n\n /** The IDs of asset sources to aggregate */\n private assetSourceIds: string[];\n\n /**\n * Creates a new AggregatedAssetSource\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n */\n constructor(id: string, cesdk: CreativeEditorSDK, assetSourceIds: string[]) {\n this.id = id;\n this.cesdk = cesdk;\n this.assetSourceIds = assetSourceIds;\n }\n\n /**\n * Find assets across all aggregated sources based on the provided query data\n * Results are sorted by the insertedAt timestamp in meta field\n *\n * @param queryData - Query parameters to filter and sort assets\n * @returns Promise with the query results\n */\n async findAssets(\n queryData: AssetQueryData\n ): Promise<AssetsQueryResult | undefined> {\n try {\n // Query all asset sources via cesdk\n const queryPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.findAssets(sourceId, {\n ...queryData,\n // Increase page size to get all assets from each source\n // We'll handle pagination after merging\n perPage: 9999,\n page: 0\n })\n );\n\n // Wait for all queries to complete\n const results = await Promise.all(queryPromises);\n\n // Combine all assets from all sources\n let allAssets: AssetResult[] = [];\n results.forEach((result) => {\n if (result?.assets) {\n allAssets = allAssets.concat(result.assets);\n }\n });\n\n // Sort by insertedAt timestamp\n allAssets.sort((a, b) => {\n const timeA = (a.meta?.insertedAt as number) || 0;\n const timeB = (b.meta?.insertedAt as number) || 0;\n\n // Sort newest first (descending)\n return timeB - timeA;\n });\n\n // Apply pagination after merging\n const { page, perPage } = queryData;\n const startIndex = page * perPage;\n const endIndex = startIndex + perPage;\n const paginatedAssets = allAssets.slice(startIndex, endIndex);\n\n // Calculate if there is a next page\n const nextPage = endIndex < allAssets.length ? page + 1 : undefined;\n\n return {\n assets: paginatedAssets,\n currentPage: page,\n nextPage,\n total: allAssets.length\n };\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error finding assets:', error);\n return undefined;\n }\n }\n\n /**\n * Retrieves all groups from all aggregated asset sources using cesdk\n * @returns Promise with an array of unique group names\n */\n async getGroups(): Promise<string[]> {\n const groupPromises = this.assetSourceIds.map((sourceId) =>\n this.cesdk.engine.asset.getGroups(sourceId)\n );\n\n const groupArrays = await Promise.all(groupPromises);\n\n // Combine and deduplicate groups\n const uniqueGroups = new Set<string>();\n groupArrays.forEach((groups) => {\n groups.forEach((group) => uniqueGroups.add(group));\n });\n\n return Array.from(uniqueGroups);\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n addAsset(_asset: AssetDefinition): void {\n throw new Error('AggregatedAssetSource does not support adding assets');\n }\n\n /**\n * This operation is not supported in AggregatedAssetSource\n * @throws Error - This method is not supported\n */\n removeAsset(_assetId: string): void {\n throw new Error('AggregatedAssetSource does not support removing assets');\n }\n}\n\n/**\n * Helper function to create an AggregatedAssetSource instance\n *\n * @param id - The unique identifier for this asset source\n * @param cesdk - The Creative Editor SDK instance\n * @param assetSourceIds - The IDs of asset sources to aggregate\n * @returns A new AggregatedAssetSource instance\n */\nexport function createAggregatedAssetSource(\n id: string,\n cesdk: CreativeEditorSDK,\n assetSourceIds: string[]\n): AggregatedAssetSource {\n return new AggregatedAssetSource(id, cesdk, assetSourceIds);\n}\n\nexport default AggregatedAssetSource;\n", "import { type CreativeEngine } from '@cesdk/cesdk-js';\n\nclass Metadata<V> {\n engine: CreativeEngine;\n\n key: string;\n\n constructor(engine: CreativeEngine, key: string) {\n this.engine = engine;\n this.key = key;\n }\n\n hasData(blockId: number): boolean {\n return (\n this.engine.block.isValid(blockId) &&\n this.engine.block.hasMetadata(blockId, this.key)\n );\n }\n\n get(blockId: number): V | undefined {\n if (this.hasData(blockId)) {\n return JSON.parse(this.engine.block.getMetadata(blockId, this.key));\n }\n return undefined;\n }\n\n set(blockId: number, value: V) {\n this.engine.block.setMetadata(blockId, this.key, JSON.stringify(value));\n }\n\n clear(blockId: number) {\n if (this.engine.block.hasMetadata(blockId, this.key)) {\n this.engine.block.removeMetadata(blockId, this.key);\n }\n }\n}\n\nexport default Metadata;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import baseIsEqual from './_baseIsEqual.js';\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nexport default isEqual;\n", "import { isEqual } from 'lodash-es';\n\nimport Metadata from './Metadata';\nimport {\n PluginStatusError,\n PluginStatusMetadata,\n PluginStatusProcessed,\n PluginStatusProcessing\n} from './types';\n\nclass ImageProcessingMetadata extends Metadata<PluginStatusMetadata> {\n get(blockId: number): PluginStatusMetadata {\n return super.get(blockId) ?? { status: 'IDLE' };\n }\n\n /**\n * Detect if the block has been duplicated with processed or processing\n * fill processing. In that case the processing state is still\n * valid, but blockId and fillId have changed.\n */\n isDuplicate(blockId: number): boolean {\n if (!this.engine.block.isValid(blockId)) return false;\n\n const metadata = this.get(blockId);\n\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return false;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n\n // It cannot be a duplicate if the blockId or fillId are the same\n if (metadata.blockId === blockId || metadata.fillId === fillId)\n return false;\n\n return true;\n }\n\n /**\n * Fixes the metadata if the block has been duplicated, i.e. the blockId and\n * fillId will be updated to the current block/fill.\n *\n * Please note: Call this method only on duplicates (see isDuplicate).\n */\n fixDuplicate(blockId: number) {\n const fillId = this.engine.block.getFill(blockId);\n const metadata = this.get(blockId);\n if (\n metadata.status === 'IDLE' ||\n metadata.status === 'PENDING' ||\n metadata.status === 'ERROR'\n )\n return;\n this.set(blockId, {\n ...metadata,\n blockId,\n fillId\n });\n\n // If it is currently processing the best we can do is to just recover\n // the initial image data, since no processing will update this block and\n // it will be stuck in the processing state.\n if (metadata.status === 'PROCESSING') {\n this.recoverInitialImageData(blockId);\n this.clear(blockId);\n }\n }\n\n /**\n * Check if the image has a consisten metadata state. A inconsistent state is\n * caused by outside changes of the fill data.\n *\n * @returns true if the metadata is consistent, false otherwise\n */\n isConsistent(blockId: number): boolean {\n // In case the block was removed, we just abort and mark it\n // as reset by returning true\n if (!this.engine.block.isValid(blockId)) return false;\n const metadata = this.get(blockId);\n if (metadata.status === 'IDLE' || metadata.status === 'PENDING')\n return true;\n\n if (!this.engine.block.hasFill(blockId)) return false;\n const fillId = this.engine.block.getFill(blockId);\n if (fillId == null) return false;\n\n if (blockId !== metadata.blockId || fillId !== metadata.fillId)\n return false;\n\n const sourceSet = this.engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const imageFileURI = this.engine.block.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n\n if (\n sourceSet.length === 0 &&\n !imageFileURI &&\n metadata.status === 'PROCESSING'\n ) {\n // While we process it is OK to have no image file URI and no source set\n // (which we cleared to show the spinning loader)\n return true;\n }\n\n // Source sets have precedence over imageFileURI so if we have a source set,\n // we only need to check if it has changed to something else.\n if (sourceSet?.length > 0) {\n const initialSourceSet = metadata.initialSourceSet;\n // If we have already processed the image, we need to check if the source set\n // we need to check against both source sets, the removed and the initial\n if (metadata.status !== 'PROCESSED') {\n if (!isEqual(sourceSet, initialSourceSet)) {\n return false;\n }\n }\n } else {\n if (metadata.status !== 'PROCESSED') {\n if (imageFileURI !== metadata.initialImageFileURI) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Recover the initial values to avoid the loading spinner and have the same\n * state as before the fill processing was started.\n */\n recoverInitialImageData(blockId: number) {\n const blockApi = this.engine.block;\n if (!blockApi.hasFill(blockId)) return; // Nothing to recover (no fill anymore)\n\n const metadata = this.get(blockId);\n\n if (metadata.status === 'PENDING' || metadata.status === 'IDLE') {\n return;\n }\n\n const initialSourceSet = metadata.initialSourceSet;\n const initialImageFileURI = metadata.initialImageFileURI;\n const initialPreviewFileURI = metadata.initialPreviewFileURI;\n\n const fillId = this.getValidFill(blockId, metadata);\n if (fillId == null) return;\n\n if (initialImageFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/imageFileURI',\n initialImageFileURI\n );\n }\n if (initialPreviewFileURI) {\n this.engine.block.setString(\n fillId,\n 'fill/image/previewFileURI',\n initialPreviewFileURI\n );\n }\n if (initialSourceSet.length > 0) {\n this.engine.block.setSourceSet(\n fillId,\n 'fill/image/sourceSet',\n initialSourceSet\n );\n }\n }\n\n /**\n * Returns the fill id of the block if it has a valid fill that was used for\n * fill processing. Returns undefined otherwise.\n */\n private getValidFill(\n blockId: number,\n metadata: PluginStatusProcessing | PluginStatusError | PluginStatusProcessed\n ): number | undefined {\n if (\n !this.engine.block.isValid(blockId) ||\n !this.engine.block.hasFill(blockId) ||\n blockId !== metadata.blockId\n ) {\n return undefined;\n }\n const fillId = this.engine.block.getFill(blockId);\n if (fillId !== metadata.fillId) {\n return undefined;\n }\n\n return fillId;\n }\n}\n\nexport default ImageProcessingMetadata;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n PluginStatusProcessed,\n PluginStatusProcessing\n} from '../metadata/types';\n\ninterface FillProcessor<T> {\n processFill(metadataState: PluginStatusProcessing): Promise<T>;\n\n commitProcessing(\n data: T,\n metadataState: PluginStatusProcessed\n ): number | void;\n}\n\nasync function fillProcessing<T>(\n blockId: number,\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n processor: FillProcessor<T>\n) {\n const blockApi = cesdk.engine.block;\n if (!blockApi.hasFill(blockId))\n throw new Error('Block does not support fill');\n\n const fillId = blockApi.getFill(blockId);\n\n // Get the current image URI and source set as initial values.\n const initialSourceSet = blockApi.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n const initialImageFileURI = blockApi.getString(\n fillId,\n 'fill/image/imageFileURI'\n );\n const initialPreviewFileURI = blockApi.getString(\n fillId,\n 'fill/image/previewFileURI'\n );\n try {\n cesdk.engine.block.setState(fillId, {\n type: 'Pending',\n progress: 0\n });\n\n const status: PluginStatusProcessing = {\n ...metadata.get(blockId),\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSING'\n };\n\n metadata.set(blockId, status);\n\n const processedData = await processor.processFill(status);\n // Check for externally changed state while we were applying the mask and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n // Check for externally changed state while we were uploading and\n // do not proceed if the state was reset.\n if (\n metadata.get(blockId).status !== 'PROCESSING' ||\n !metadata.isConsistent(blockId)\n )\n return;\n\n if (processedData == null) return;\n\n const metadataStateProcessed: PluginStatusProcessed = {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'PROCESSED'\n };\n\n const blockIdOrVoid = processor.commitProcessing(\n processedData,\n metadataStateProcessed\n );\n\n // If a new block was created, we do not update the metadata.\n if (blockIdOrVoid == null || blockIdOrVoid === blockId) {\n metadata.set(blockId, metadataStateProcessed);\n }\n\n // Finally, create an undo step\n cesdk.engine.editor.addUndoStep();\n } catch (error) {\n if (cesdk.engine.block.isValid(blockId)) {\n metadata.set(blockId, {\n version: PLUGIN_VERSION,\n initialSourceSet,\n initialImageFileURI,\n initialPreviewFileURI,\n blockId,\n fillId,\n status: 'ERROR'\n });\n\n metadata.recoverInitialImageData(blockId);\n }\n\n if (\n error != null &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n const message =\n error.message === 'signal timed out'\n ? 'Processing canceled due to timeout'\n : error.message;\n cesdk.ui.showNotification({\n type: 'error',\n message\n });\n }\n\n // eslint-disable-next-line no-console\n console.log(error);\n } finally {\n if (cesdk.engine.block.isValid(fillId)) {\n cesdk.engine.block.setState(fillId, { type: 'Ready' });\n }\n }\n}\n\nexport default fillProcessing;\n", "export function getFeatureId(pluginId: string): string {\n return `${pluginId}.fillProcessing.feature`;\n}\n\nexport function getCanvasMenuComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasMenu`, `${pluginId}.fillProcessing.canvasMenu`];\n}\n\nexport function getDockComponentIds(pluginId: string): string[] {\n return [`${pluginId}.dock`, `${pluginId}.fillProcessing.dock`];\n}\n\nexport function getInspectorBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.inspectorBar`,\n `${pluginId}.fillProcessing.inspectorBar`\n ];\n}\n\nexport function getNavigationBarComponentIds(pluginId: string): string[] {\n return [\n `${pluginId}.navigationBar`,\n `${pluginId}.fillProcessing.navigationBar`\n ];\n}\n\nexport function getCanvasBarComponentIds(pluginId: string): string[] {\n return [`${pluginId}.canvasBar`, `${pluginId}.fillProcessing.canvasBar`];\n}\n\nexport function getI18nCanvasMenuLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasMenu.button.label`;\n}\n\nexport function getI18nDockLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.dock.button.label`;\n}\n\nexport function getI18nInspectorBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.inspectorBar.button.label`;\n}\n\nexport function getI18nNavigationBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.navigationBar.button.label`;\n}\n\nexport function getI18nCanvasBarLabel(pluginId: string): string {\n return `plugin.${pluginId}.fillProcessing.canvasBar.button.label`;\n}\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\nimport { FillProcessingMetadata } from '..';\nimport { getFeatureId } from './constants';\n\nexport default function handleFillProcessing(\n cesdk: CreativeEditorSDK,\n {\n pluginId,\n process\n }: {\n pluginId: string;\n icon?: string;\n process: (blockId: number, metadata: FillProcessingMetadata) => void;\n }\n): {\n featureId: string;\n} {\n const featureId = getFeatureId(pluginId);\n\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n enableFeatures(cesdk, metadata, featureId);\n\n cesdk.engine.event.subscribe([], async (events) => {\n events.forEach((e) => {\n const id = e.block;\n if (!cesdk.engine.block.isValid(id) || !metadata.hasData(id)) {\n return;\n }\n\n if (e.type === 'Created') {\n if (metadata.isDuplicate(id)) {\n metadata.fixDuplicate(id);\n }\n } else if (e.type === 'Updated') {\n switch (metadata.get(id).status) {\n case 'PENDING': {\n if (\n cesdk.feature.isEnabled(featureId, {\n engine: cesdk.engine\n }) &&\n cesdk.engine.block.isAllowedByScope(id, 'fill/change') &&\n cesdk.engine.block.getState(id).type !== 'Pending'\n ) {\n process(id, metadata);\n }\n break;\n }\n\n case 'PROCESSING':\n case 'PROCESSED': {\n if (!metadata.isConsistent(id)) {\n metadata.clear(id);\n }\n break;\n }\n\n default: {\n // We do not care about other states\n }\n }\n }\n });\n });\n\n return { featureId };\n}\n\n/**\n * Defines the feature that determines in which context (on which block)\n * fill processing is allowed/enabled.\n */\nfunction enableFeatures(\n cesdk: CreativeEditorSDK,\n metadata: FillProcessingMetadata,\n featureId: string\n) {\n cesdk.feature.enable(featureId, ({ engine }) => {\n const selectedIds = engine.block.findAllSelected();\n if (selectedIds.length !== 1) {\n return false;\n }\n const [selectedId] = selectedIds;\n\n if (!cesdk.engine.block.isVisible(selectedId)) return false;\n\n if (cesdk.engine.block.hasFill(selectedId)) {\n const kind = cesdk.engine.block.getKind(selectedId);\n if (kind === 'sticker') return false;\n\n const fillId = cesdk.engine.block.getFill(selectedId);\n const fillType = cesdk.engine.block.getType(fillId);\n\n if (fillType !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n const fileUri = engine.block.getString(fillId, 'fill/image/imageFileURI');\n const sourceSet = engine.block.getSourceSet(\n fillId,\n 'fill/image/sourceSet'\n );\n\n if (sourceSet.length > 0 || fileUri !== '') return true;\n\n // If we are in a processing state we do not have a imageFileURI or\n // source set set (to show the loading spinner), but the feature is still\n // enabled.\n return metadata.get(selectedId).status === 'PROCESSING';\n }\n\n return false;\n });\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { FillProcessingMetadata } from '..';\nimport {\n getCanvasBarComponentIds,\n getCanvasMenuComponentIds,\n getDockComponentIds,\n getFeatureId,\n getI18nCanvasBarLabel,\n getI18nCanvasMenuLabel,\n getI18nDockLabel,\n getI18nInspectorBarLabel,\n getI18nNavigationBarLabel,\n getInspectorBarComponentIds,\n getNavigationBarComponentIds\n} from './constants';\n\nexport type Location =\n | 'inspectorBar'\n | 'navigationBar'\n | 'canvasBarTop'\n | 'canvasBarBottom'\n | 'canvasMenu'\n | 'dock';\n\n/**\n * Registers the components that can be used to process the fill of\n * a block.\n */\nexport default function registerFillProcessingComponents(\n cesdk: CreativeEditorSDK,\n options: {\n pluginId: string;\n icon?: string;\n locations?: Location | Location[];\n }\n): {\n canvasMenuComponentId: string;\n dockComponentId: string;\n\n translationsKeys: {\n inspectorBarLabel: string;\n navigationBarLabel: string;\n canvasBarLabel: string;\n canvasMenuLabel: string;\n dockLabel: string;\n };\n} {\n const { pluginId, locations } = options;\n const metadata = new FillProcessingMetadata(cesdk.engine, pluginId);\n\n const canvasMenuLabel = getI18nCanvasMenuLabel(pluginId);\n const canvasMenuComponentIds = getCanvasMenuComponentIds(pluginId);\n const canvasMenuComponentId = canvasMenuComponentIds[0];\n\n const dockLabel = getI18nDockLabel(pluginId);\n const dockComponentIds = getDockComponentIds(pluginId);\n const dockComponentId = dockComponentIds[0];\n\n const inspectorBarLabel = getI18nInspectorBarLabel(pluginId);\n const inspectorBarComponentIds = getInspectorBarComponentIds(pluginId);\n const inspectorBarComponentId = inspectorBarComponentIds[0];\n\n const navigationBarLabel = getI18nNavigationBarLabel(pluginId);\n const navigationBarComponentIds = getNavigationBarComponentIds(pluginId);\n const navigationBarComponentId = navigationBarComponentIds[0];\n\n const canvasBarLabel = getI18nCanvasBarLabel(pluginId);\n const canvasBarComponentIds = getCanvasBarComponentIds(pluginId);\n const canvasBarComponentId = canvasBarComponentIds[0];\n\n const featureId = getFeatureId(pluginId);\n\n if (locations?.includes('inspectorBar')) {\n cesdk.ui.setInspectorBarOrder([\n inspectorBarComponentId,\n ...cesdk.ui.getInspectorBarOrder()\n ]);\n }\n\n if (locations?.includes('navigationBar')) {\n cesdk.ui.setNavigationBarOrder([\n navigationBarComponentId,\n ...cesdk.ui.getNavigationBarOrder()\n ]);\n }\n\n if (locations?.includes('canvasBarTop')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('top')],\n 'top'\n );\n }\n\n if (locations?.includes('canvasBarBottom')) {\n cesdk.ui.setCanvasBarOrder(\n [canvasBarComponentId, ...cesdk.ui.getCanvasBarOrder('bottom')],\n 'bottom'\n );\n }\n\n if (locations?.includes('canvasMenu')) {\n cesdk.ui.setCanvasMenuOrder([\n canvasMenuComponentId,\n ...cesdk.ui.getCanvasMenuOrder()\n ]);\n }\n\n if (locations?.includes('dock')) {\n cesdk.ui.setDockOrder([...cesdk.ui.getDockOrder(), dockComponentId]);\n }\n\n cesdk.ui.registerComponent(\n dockComponentIds,\n ({ builder: { Button }, engine }) => {\n const [id] = engine.block.findAllSelected();\n\n let isDisabled = false;\n let isLoading = false;\n let loadingProgress: number | undefined;\n\n if (id == null) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n isDisabled = true;\n }\n\n if (\n !isDisabled &&\n !cesdk.engine.block.isAllowedByScope(id, 'fill/change')\n ) {\n isDisabled = true;\n }\n\n if (!isDisabled && engine.block.getState(id)?.type === 'Pending') {\n isDisabled = true;\n }\n\n if (!isDisabled) {\n const currentMetadata = metadata.get(id);\n\n isLoading = currentMetadata.status === 'PROCESSING';\n isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING';\n\n if (\n currentMetadata.status === 'PROCESSING' &&\n currentMetadata.progress\n ) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n }\n\n const buttonId = `${dockComponentId}.button`;\n Button(buttonId, {\n label: dockLabel,\n icon: options.icon,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n const currentMetadata = metadata.get(id);\n\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n\n const buttonComponents: {\n componentIds: string[];\n label: string;\n variant: 'plain' | 'regular';\n }[] = [\n {\n componentIds: inspectorBarComponentIds,\n variant: 'plain',\n label: inspectorBarLabel\n },\n {\n componentIds: navigationBarComponentIds,\n variant: 'regular',\n label: navigationBarLabel\n },\n {\n componentIds: canvasBarComponentIds,\n variant: 'regular',\n label: canvasBarLabel\n },\n {\n componentIds: canvasMenuComponentIds,\n variant: 'plain',\n label: canvasMenuLabel\n }\n ];\n\n buttonComponents.forEach(({ componentIds, label, variant }) => {\n const componentId = componentIds[0];\n cesdk.ui.registerComponent(\n componentIds,\n ({ builder: { Button }, engine }) => {\n if (\n !cesdk.feature.isEnabled(featureId, {\n engine\n })\n ) {\n return;\n }\n\n const [id] = engine.block.findAllSelected();\n\n if (!cesdk.engine.block.isAllowedByScope(id, 'fill/change')) return;\n\n const currentMetadata = metadata.get(id);\n\n const isLoading = currentMetadata.status === 'PROCESSING';\n const isDisabled =\n currentMetadata.status === 'PENDING' ||\n currentMetadata.status === 'PROCESSING' ||\n engine.block.getState(id)?.type === 'Pending';\n\n let loadingProgress: number | undefined;\n if (isLoading && currentMetadata.progress) {\n const { current, total } = currentMetadata.progress;\n loadingProgress = (current / total) * 100;\n }\n\n const buttonId = `${componentId}.button`;\n Button(buttonId, {\n icon: options.icon,\n label,\n variant,\n isLoading,\n isDisabled,\n loadingProgress,\n onClick: () => {\n if (\n currentMetadata.status === 'IDLE' ||\n currentMetadata.status === 'ERROR' ||\n currentMetadata.status === 'PROCESSED'\n ) {\n metadata.set(id, {\n status: 'PENDING'\n });\n }\n }\n });\n }\n );\n });\n\n return {\n canvasMenuComponentId,\n dockComponentId,\n translationsKeys: {\n inspectorBarLabel,\n navigationBarLabel,\n canvasBarLabel,\n canvasMenuLabel,\n dockLabel\n }\n };\n}\n", "import { type RGBAColor } from '@cesdk/cesdk-js';\n\nconst HEX_COLOR_PATTERN = new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'i');\nconst HEX_SINGLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{1}/, 'g');\nconst HEX_DOUBLE_CHAR_COMPONENTS_PATTERN = new RegExp(/[A-Fa-f0-9]{2}/, 'g');\n\n/** @public */\nexport const rgbaToHex = (rgba: RGBAColor, includeAlpha = false): string => {\n const { r, g, b, a } = rgba;\n const rByte = Math.round(255 * r);\n const gByte = Math.round(255 * g);\n const bByte = Math.round(255 * b);\n const aByte = Math.round(255 * a);\n const byteToHex = (byte: number) => {\n return byte.toString(16).padStart(2, '0');\n };\n return `#${byteToHex(rByte)}${byteToHex(gByte)}${byteToHex(bByte)}${\n includeAlpha ? byteToHex(aByte) : ''\n }`;\n};\n\n/** @public */\nexport const hexToRgba = (hexString: string): RGBAColor => {\n const rgbaHexToColor = (\n r: string,\n g: string,\n b: string,\n a: string | undefined,\n max: number\n ) => {\n return {\n r: parseInt(r, 16) / max,\n g: parseInt(g, 16) / max,\n b: parseInt(b, 16) / max,\n a: a === undefined ? 1 : parseInt(a, 16) / max\n };\n };\n\n if (hexString.startsWith('#')) {\n if (hexString.length === 4 || hexString.length === 5) {\n const hexMatch = hexString.match(HEX_SINGLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 15);\n }\n }\n if (hexString.length === 7 || hexString.length === 8) {\n const hexMatch = hexString.match(HEX_DOUBLE_CHAR_COMPONENTS_PATTERN);\n if (hexMatch) {\n const [r, g, b, a] = hexMatch;\n return rgbaHexToColor(r, g, b, a, 255);\n }\n }\n }\n\n throw new Error(\n 'Invalid hex string! Allowed RGB formats are \"#FFF\" and \"#FFFFFF\". Allowed RGBA formats are \"#FFFF\" and \"#FFFFFFFF'\n );\n};\n\n/** @public */\nexport const isValidHexColor = (hexString: string): boolean => {\n return HEX_COLOR_PATTERN.test(hexString);\n};\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Uploads a blob with the help of CE.SDK\n */\nexport async function uploadBlob(\n blob: Blob,\n initialUri: string,\n cesdk: CreativeEditorSDK\n) {\n const pathname = new URL(initialUri).pathname;\n const parts = pathname.split('/');\n const extension = mimeTypeToExtension(blob.type);\n const filename = parts[parts.length - 1]?.split('.')?.[0] ?? 'asset';\n const filenameWithExtension = `${filename}.${extension}`;\n\n const uploadedAssets = await cesdk.unstable_upload(\n new File([blob], filenameWithExtension, { type: blob.type }),\n () => {\n // TODO Delegate process to UI component\n }\n );\n\n const url = uploadedAssets.meta?.uri;\n if (url == null) {\n throw new Error('Could not upload processed fill');\n }\n return url;\n}\n\n/**\n * Returns the file extension for a given mime type.\n */\nexport function mimeTypeToExtension(mimeType: string): string {\n const extensions: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/webp': 'webp',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg'\n };\n return extensions[mimeType] ?? 'png';\n}\n\nexport async function fetchImageBlob(uri: string): Promise<Blob> {\n return fetch(uri).then((response) => response.blob());\n}\n\n/**\n * Converts a buffer URI to a object url.\n */\nexport async function bufferURIToObjectURL(\n uri: string,\n engine: CreativeEngine\n): Promise<string> {\n if (uri.startsWith('buffer:')) {\n const mimeType = await engine.editor.getMimeType(uri);\n const length = engine.editor.getBufferLength(uri);\n const data = engine.editor.getBufferData(uri, 0, length);\n const buffer = new Uint8Array(data);\n const blob = new Blob([buffer], { type: mimeType });\n return URL.createObjectURL(blob);\n } else {\n return uri;\n }\n}\n", "function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\nexport default uuid4;\n", "import { bufferURIToObjectURL } from './upload';\nimport { type CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Get the dimensions of an image from its URL\n *\n * @param url - The URL of the image\n * @returns A promise that resolves to an object containing the width and height of the image\n */\nexport async function getImageDimensionsFromURL(\n url: string,\n engine: CreativeEngine\n): Promise<{ width: number; height: number }> {\n const resolvedUrl = await bufferURIToObjectURL(url, engine);\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n img.src = resolvedUrl;\n });\n}\n\n/**\n * Get the URI of an image from a block ID, either the first source of a source set or\n * the image file URI. Will handle buffer URIs and convert them to object URLs.\n */\nexport async function getImageUri(\n blockId: number,\n engine: CreativeEngine,\n options?: { throwErrorIfSvg?: boolean }\n): Promise<string> {\n let uri;\n const fillBlock = engine.block.getFill(blockId);\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) throw new Error('No image source/uri found');\n } else {\n uri = source.uri;\n }\n\n // Check if the image is SVG (not supported)\n if (options?.throwErrorIfSvg) {\n const mimeType = await engine.editor.getMimeType(uri);\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n }\n\n return bufferURIToObjectURL(uri, engine);\n}\n\n/**\n * Returns if the given fill block is an SVG image fill.\n */\nexport async function isSvgFill(\n fillBlock: number,\n engine: CreativeEngine\n): Promise<boolean> {\n if (engine.block.getType(fillBlock) !== '//ly.img.ubq/fill/image') {\n return false;\n }\n\n let uri;\n const sourceSet = engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [source] = sourceSet;\n if (source == null) {\n uri = engine.block.getString(fillBlock, 'fill/image/imageFileURI');\n if (uri == null) return false;\n } else {\n uri = source.uri;\n }\n\n const mimeType = await engine.editor.getMimeType(uri);\n return mimeType === 'image/svg+xml';\n}\n", "/**\n * Checks if a value is defined (not undefined).\n *\n * Helpful to filter out undefined values from an array or collection\n * while keeping the type information intact.\n *\n * ```\n * array.filter(isDefined)\n * ```\n */\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined;\n}\n\nexport default isDefined;\n", "/**\n * Converts a value to an array format.\n *\n * @template T The type of the array elements\n * @param value - The value to convert. Can be a single item, an array, null, or undefined\n * @returns An array containing the value(s). Returns empty array if value is null/undefined,\n * the original array if value is already an array, or a single-element array if value is a single item\n *\n * @example\n * ```typescript\n * toArray('hello') // ['hello']\n * toArray(['a', 'b']) // ['a', 'b']\n * toArray(null) // []\n * toArray(undefined) // []\n * toArray(42) // [42]\n * ```\n */\nfunction toArray<T>(value?: T | T[]): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nexport default toArray;\n", "/**\n * Interface for objects that have translation capabilities\n */\ninterface TranslationAPI {\n translate(key: string | string[]): string;\n}\n\n/**\n * Check if CE.SDK supports the translate API (version 1.59.0 or higher)\n * @param cesdk - The CE.SDK instance to check\n * @returns True if the translate API is supported\n */\nexport function supportsTranslateAPI(cesdk: any): boolean {\n if (!cesdk?.version) return false;\n\n // Use localeCompare for semantic version comparison\n // Returns >= 0 when cesdk.version is 1.59.0 or higher\n const comparison = cesdk.version.localeCompare('1.59.0', undefined, {\n numeric: true,\n sensitivity: 'base'\n });\n\n return comparison >= 0 && typeof cesdk.i18n?.translate === 'function';\n}\n\n/**\n * Type guard to check if an object has the translate API\n * @param i18n - The object to check\n * @returns True if the object has a translate function\n */\nexport function hasTranslateAPI(i18n: any): i18n is TranslationAPI {\n return typeof i18n?.translate === 'function';\n}\n", "import formatsIconSprite from './icons/formats';\n\nconst Icons = {\n Formats: formatsIconSprite\n};\n\nexport { Icons };\n\nexport {\n CustomAssetSource,\n type CustomAssetSourceOptions,\n type SelectValue\n} from './assetSources/CustomAssetSource';\n\nexport { IndexedDBAssetSource } from './assetSources/IndexedDBAssetSource';\n\nexport { AggregatedAssetSource } from './assetSources/AggregatedAssetSource';\n\nexport { default as Metadata } from './metadata/Metadata';\n\nexport { default as FillProcessingMetadata } from './metadata/FillProcessingMetadata';\n\nexport { default as fillProcessing } from './processing/fillProcessing';\n\nexport { default as initializeFillProcessing } from './processing/initializeFillProcessing';\n\nexport { default as registerFillProcessingComponents } from './processing/registerFillProcessingComponents';\n\nexport { type Optional } from './types/Optional';\n\nexport {\n type Location,\n type UserInterfaceConfiguration\n} from './types/UserInterfaceConfiguration';\n\nexport { hexToRgba, isValidHexColor, rgbaToHex } from './utils/colors';\n\nexport {\n uploadBlob,\n fetchImageBlob,\n bufferURIToObjectURL,\n mimeTypeToExtension\n} from './utils/upload';\n\nexport { default as uuid } from './utils/uuid';\n\nexport {\n getImageDimensionsFromURL,\n getImageUri,\n isSvgFill\n} from './utils/images';\n\nexport { default as isDefined } from './utils/isDefined';\n\nexport { default as toArray } from './utils/toArray';\n\nexport { supportsTranslateAPI, hasTranslateAPI } from './translationHelpers';\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { RenderCustomProperty } from '../../core/provider';\nimport { CustomAssetSource, isDefined } from '@imgly/plugin-utils';\nimport { SelectValue } from '@imgly/plugin-utils/dist/assetSources/CustomAssetSource';\n\ntype StyleSelectionPayload = {\n onSelect: (asset: AssetResult) => Promise<void>;\n};\n\ntype Style = {\n id: 'none' | (string & {});\n label: string;\n prompt: string;\n thumbUri: string;\n};\n\n/**\n * Provides render function for a style transfer property that allows\n * to change a style (of an image) from a library.\n *\n * The style will be appended to the prompt property, so the model does\n * not need to support style transfer directly.\n *\n * By default this expects the property key to be `style`. This can be changed with the option\n * `propertyKey`.\n */\nfunction renderStyleTransferProperty(\n providerId: string,\n options: {\n cesdk?: CreativeEditorSDK;\n /**\n * Base URL used for the UI assets used in the plugin.\n */\n baseURL?: string;\n\n /**\n * What property key to use for the style property.\n */\n propertyKey?: string;\n\n /**\n * What property key to use for the prompt property.\n */\n propertyKeyForPrompt?: string;\n\n /**\n * Override the default styles\n */\n styles?: Style[] | ((defaultStyles: Style[]) => Style[]);\n\n /**\n * Overrides the default i18n translations for the prompt input.\n */\n i18n?: {\n prompt?: {\n inputLabel?: string;\n placeholder?: string;\n };\n };\n }\n): RenderCustomProperty {\n const { cesdk } = options;\n if (cesdk == null) return {};\n\n const propertyKey = options.propertyKey ?? 'style';\n const panelIdForStyleSelection = getStyleSelectionPanelId(providerId);\n\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${panelIdForStyleSelection}`]: 'Select Style',\n [`${providerId}.${propertyKey}`]: 'Style'\n }\n });\n\n const defaultStyles = getDefaultStyles({\n baseURL:\n options.baseURL ??\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/',\n includeNone: true\n });\n let styles = defaultStyles;\n if (options.styles != null) {\n if (Array.isArray(options.styles)) {\n styles = options.styles;\n } else if (typeof options.styles === 'function') {\n styles = options.styles(defaultStyles);\n }\n }\n const styleAssetSource = createStyleAssetSource({\n cesdk,\n providerId,\n styles\n });\n const styleAssetSourceId = styleAssetSource.id;\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n createPanels({\n providerId,\n cesdk,\n panelId: panelIdForStyleSelection,\n entryId: styleAssetSourceId\n });\n\n const customProperties: RenderCustomProperty = {\n [options.propertyKeyForPrompt ?? 'prompt']: (context, property) => {\n const promptState = context.state<string>('prompt', '');\n context.builder.TextArea(`${property.id}`, {\n inputLabel:\n options.i18n?.prompt?.inputLabel ??\n options.propertyKeyForPrompt ??\n 'prompt',\n placeholder: options.i18n?.prompt?.placeholder,\n ...promptState\n });\n\n return () => {\n const [activeAssetId] = styleAssetSource.getActiveAssetIds();\n const asset = styleAssetSource.getAsset(activeAssetId);\n return {\n id: property.id,\n type: 'string',\n value:\n asset?.meta?.prompt == null\n ? promptState.value\n : `${promptState.value}; ${asset.meta.prompt}`\n };\n };\n },\n [propertyKey]: (context, property) => {\n const { builder, state } = context;\n\n if (styles.length > 0) {\n const styleState = state<{\n id: string;\n label: string;\n }>('style', styles[0]);\n\n builder.Button(`${property.id}`, {\n inputLabel: `${providerId}.${property.id}`,\n icon: '@imgly/Appearance',\n isDisabled: styles.length === 0,\n trailingIcon: '@imgly/ChevronRight',\n label: styleState.value.label,\n labelAlignment: 'left',\n onClick: () => {\n const payload: StyleSelectionPayload = {\n onSelect: async (asset) => {\n styleAssetSource.clearActiveAssets();\n styleAssetSource.setAssetActive(asset.id);\n styleState.setValue({\n id: asset.id,\n label: asset.label ?? asset.id\n });\n cesdk.ui.closePanel(panelIdForStyleSelection);\n }\n };\n\n cesdk.ui.openPanel(panelIdForStyleSelection, {\n payload\n });\n }\n });\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: styleState.value.id\n };\n };\n }\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value: 'none'\n };\n };\n }\n };\n\n return customProperties;\n}\n\nfunction createPanels(options: {\n providerId: string;\n panelId: string;\n entryId: string;\n cesdk?: CreativeEditorSDK;\n}) {\n const { providerId, cesdk, panelId, entryId } = options;\n if (cesdk == null) return;\n\n cesdk.ui.registerPanel<{\n onSelect: (assetResult: AssetResult) => void;\n }>(panelId, ({ builder, payload }) => {\n if (payload?.onSelect == null) {\n builder.Section(`${providerId}.error`, {\n children: () => {\n builder.Text('error', {\n content:\n 'No onSelect function provided for the style selection panel.'\n });\n }\n });\n }\n builder.Library(`${providerId}.library.image`, {\n entries: [entryId],\n onSelect: async (asset) => {\n payload?.onSelect?.(asset);\n }\n });\n });\n}\n\nfunction getStyleSelectionPanelId(providerId: string) {\n return `ly.img.ai.${providerId}.styleSelection`;\n}\n\nconst STYLES: Omit<Style, 'thumbUri'>[] = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\nfunction getDefaultStyles(options: {\n baseURL: string;\n includeNone?: boolean;\n}): Style[] {\n return STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n ...style,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n ...style,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n}\n\nconst createStyleAssetSource = (options: {\n cesdk: CreativeEditorSDK;\n providerId: string;\n styles: Style[];\n}) => {\n const styleValues: SelectValue[] = options.styles.map((style) => {\n return {\n ...style,\n meta: { prompt: style.prompt }\n };\n });\n\n const allSourceIds = options.cesdk.engine.asset.findAllSources();\n let assetSourceId = `${options.providerId}/styles`;\n while (allSourceIds.includes(assetSourceId)) {\n assetSourceId += `-${Math.random().toString(36).substring(2, 5)}`;\n }\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = options.styles[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\nconst addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n\nexport default renderStyleTransferProperty;\n", "import type { CreativeEngine } from '@cesdk/cesdk-js';\nimport type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport type { PropertyContext } from '../core/propertyConfiguration';\n\n/**\n * Build the base property context from available sources\n */\nexport function buildPropertyContext(\n engine: CreativeEngine,\n cesdk?: CreativeEditorSDK\n): PropertyContext {\n // Get locale from cesdk or default to 'en'\n const locale = cesdk?.i18n?.getLocale?.() || 'en';\n\n return {\n engine,\n cesdk,\n locale\n };\n}\n\n/**\n * Context cache for performance optimization\n */\nexport class PropertyContextCache {\n private cache: PropertyContext | null = null;\n\n /**\n * Get cached context or build new one\n */\n getContext(\n engine: CreativeEngine,\n cesdk?: CreativeEditorSDK\n ): PropertyContext {\n if (!this.cache) {\n this.cache = buildPropertyContext(engine, cesdk);\n }\n return this.cache;\n }\n\n /**\n * Clear the cache (e.g., when locale changes)\n */\n clear(): void {\n this.cache = null;\n }\n}\n", "import type {\n PropertyConfig,\n PropertyContext\n} from '../core/propertyConfiguration';\n\n/**\n * Resolve the default value for a property\n * @template T - The property value type\n * @template C - The context type\n */\nexport function resolvePropertyDefault<\n T,\n C extends PropertyContext = PropertyContext\n>(\n propertyId: string,\n propertyConfig: PropertyConfig<T, C> | undefined,\n context: C,\n schemaDefault?: T,\n fallback?: T\n): T | undefined {\n // 1. Check property configuration\n if (propertyConfig?.default !== undefined) {\n const defaultValue = propertyConfig.default;\n\n // 2a. Static value\n if (typeof defaultValue !== 'function') {\n return defaultValue;\n }\n\n // 2b. Dynamic value - call function with context\n return (defaultValue as (context: C) => T)(context);\n }\n\n // 3. Schema default\n if (schemaDefault !== undefined) {\n return schemaDefault;\n }\n\n // 4. Fallback\n return fallback;\n}\n\n/**\n * Batch resolve multiple property defaults\n */\nexport function resolvePropertyDefaults<\n I,\n C extends PropertyContext = PropertyContext\n>(\n properties: Array<{\n id: keyof I;\n config?: PropertyConfig<I[keyof I], C>;\n schemaDefault?: I[keyof I];\n fallback?: I[keyof I];\n }>,\n context: C\n): Partial<I> {\n const resolved: Partial<I> = {};\n\n for (const prop of properties) {\n const value = resolvePropertyDefault(\n prop.id as string,\n prop.config,\n context,\n prop.schemaDefault,\n prop.fallback\n );\n\n if (value !== undefined) {\n resolved[prop.id] = value;\n }\n }\n\n return resolved;\n}\n", "import { OutputKind } from '../core/provider';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Integrates the asset sources into the default asset library entry for the\n * given kind.\n */\nfunction integrateIntoDefaultAssetLibraryEntry<K extends OutputKind>(\n kind: K,\n historAssetSourceIds: string[],\n cesdk: CreativeEditorSDK\n): string | undefined {\n const entryId = `ly.img.${kind}`;\n const entry = cesdk.ui.getAssetLibraryEntry(entryId);\n if (entry != null) {\n cesdk.ui.updateAssetLibraryEntry(entryId, {\n sourceIds: [...entry.sourceIds, ...historAssetSourceIds]\n });\n return entry.id;\n }\n}\n\nexport default integrateIntoDefaultAssetLibraryEntry;\n", "import {\n BuilderRenderFunctionContext,\n CreativeEngine,\n SceneMode,\n Scope\n} from '@cesdk/cesdk-js';\nimport { OutputKind, Output } from './provider';\nimport { Result } from '../generation/createGenerateFunction';\n\n/**\n * Base properties shared by all action definitions.\n */\ninterface BaseActionDefinition {\n /** Unique identifier for the action */\n id: string;\n /** Human-readable label for the action */\n label?: string;\n /** Detailed description of what the action does */\n description?: string;\n /** Optional metadata for additional information */\n meta?: Record<string, any>;\n /** The scene mode for which this action is only applicable */\n sceneMode?: SceneMode;\n}\n\n/**\n * Definition for a plugin action - a global action that can be invoked from apps, command palettes, etc.\n */\nexport interface PluginActionDefinition extends BaseActionDefinition {\n /** Action type discriminator */\n type: 'plugin';\n /** ID of the plugin that registered this action */\n pluginId: string;\n /** Function to execute the action */\n execute: () => void;\n}\n\n/**\n * Render context for quick actions with generation capability.\n */\nexport interface QuickActionRenderContext<Q = Record<string, any>> {\n /** Toggle between collapsed and expanded state */\n toggleExpand: () => void;\n /** Whether the quick action is currently expanded */\n isExpanded: boolean;\n /** Close the entire quick action popover */\n close: () => void;\n /** Generate output using the quick action input */\n generate: (\n input: Q,\n options?: { blockIds?: number[] }\n ) => Promise<Result<Output>>;\n /** The ID of the provider used for this quick action */\n providerId: string;\n}\n\n/**\n * Definition for a quick action - a context-sensitive action that operates on selected blocks.\n */\nexport interface QuickActionDefinition<Q extends Record<string, any>>\n extends BaseActionDefinition {\n /** Action type discriminator */\n type: 'quick';\n /** The kind of block this action operates on */\n kind: OutputKind;\n /**\n * Defines if the quick action is enabled or not by using the\n * feature api.\n */\n enable: boolean | ((context: { engine: CreativeEngine }) => boolean);\n /**\n * Define the necessary scopes for this quick action.\n */\n scopes?: Scope[];\n\n /**\n * Overrides the defaults for this quick action.\n */\n defaults?: {\n /** Should the generation be directly applied or does it need confirmation */\n confirmation?: boolean;\n /** Whether the block should be locked */\n lock?: boolean;\n };\n\n /** Render function for the quick action UI */\n render: (\n context: BuilderRenderFunctionContext<any> & QuickActionRenderContext<Q>\n ) => void;\n}\n\n/**\n * Union type of all supported action definitions.\n */\nexport type ActionDefinition =\n | PluginActionDefinition\n | QuickActionDefinition<Record<string, any>>;\n\n/**\n * Event types for ActionRegistry subscriptions.\n */\nexport type ActionRegistryEventType = 'registered' | 'unregistered';\n\n/**\n * Callback function for ActionRegistry subscriptions.\n */\nexport type ActionRegistrySubscriberCallback = (\n action: ActionDefinition,\n event: ActionRegistryEventType\n) => void;\n\n/**\n * Filters for querying and subscribing to specific types of actions.\n * Used by both getBy() and subscribeBy() methods.\n */\nexport interface ActionRegistryFilters {\n /** Filter by action type */\n type?: ActionDefinition['type'];\n /** Filter by plugin ID */\n pluginId?: string;\n /** Filter by action ID */\n id?: string;\n /** Filter by kind (only applicable for quick actions) */\n kind?: OutputKind;\n}\n\n/**\n * Global registry for managing plugin actions and quick actions.\n * Uses singleton pattern to ensure a single source of truth across the application.\n */\nexport class ActionRegistry {\n /** Map storing all registered actions by their ID */\n private actions: Map<string, ActionDefinition> = new Map();\n\n /** Map storing subscribers with their filters (null = subscribe to all) */\n private subscribers: Map<\n ActionRegistrySubscriberCallback,\n ActionRegistryFilters | null\n > = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the ActionRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n * @returns The ActionRegistry instance\n */\n public static get(): ActionRegistry {\n const globalKey = '__imgly_action_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new ActionRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers an action in the registry.\n * @param action The action definition to register\n * @returns A disposer function that unregisters the action when called\n */\n public register(action: ActionDefinition): () => void {\n this.actions.set(action.id, action);\n this.notifySubscribers(action, 'registered');\n\n return () => {\n if (this.actions.get(action.id) === action) {\n this.actions.delete(action.id);\n this.notifySubscribers(action, 'unregistered');\n }\n };\n }\n\n /**\n * Gets all registered actions.\n * @returns Array of all action definitions\n */\n public getAll(): ActionDefinition[] {\n return Array.from(this.actions.values());\n }\n\n /**\n * Gets actions matching the specified filters with full type safety.\n * @param filters Object containing optional filters for type, pluginId, and id\n * @returns Array of matching actions, typed based on the type filter\n * @example\n * // Get all plugin actions\n * registry.getBy({ type: 'plugin' }) // Returns PluginActionDefinition[]\n *\n * // Get all actions from a specific plugin\n * registry.getBy({ pluginId: 'ai-image-generation' }) // Returns ActionDefinition[]\n *\n * // Get specific action by ID\n * registry.getBy({ id: 'generate-image' }) // Returns ActionDefinition[]\n *\n * // Combine filters\n * registry.getBy({ type: 'quick', pluginId: 'ai-text' }) // Returns QuickActionDefinition[]\n *\n * // Filter quick actions by kind\n * registry.getBy({ type: 'quick', kind: 'image' }) // Returns QuickActionDefinition[]\n */\n public getBy<\n T extends ActionDefinition['type'] | undefined = undefined\n >(filters: {\n /** Filter by action type */\n type?: T;\n /** Filter by plugin ID */\n pluginId?: string;\n /** Filter by action ID */\n id?: string;\n /** Filter by kind (only applicable for quick actions) */\n kind?: OutputKind;\n }): T extends ActionDefinition['type']\n ? Extract<ActionDefinition, { type: T }>[]\n : ActionDefinition[] {\n const results = this.getAll().filter((action) =>\n this.matchesFilters(action, filters)\n );\n\n return results as T extends ActionDefinition['type']\n ? Extract<ActionDefinition, { type: T }>[]\n : ActionDefinition[];\n }\n\n /**\n * Subscribes to all registry events (register/unregister).\n * @param callback Function to call when any action is registered or unregistered\n * @returns Unsubscribe function\n */\n public subscribe(callback: ActionRegistrySubscriberCallback): () => void {\n this.subscribers.set(callback, null);\n return () => {\n this.subscribers.delete(callback);\n };\n }\n\n /**\n * Subscribes to registry events for actions matching the specified filters.\n * @param filters Filters to match actions against\n * @param callback Function to call when matching actions are registered or unregistered\n * @returns Unsubscribe function\n * @example\n * // Subscribe to plugin actions only\n * registry.subscribeBy({ type: 'plugin' }, (action, event) => {\n * console.log(`Plugin action ${action.id} was ${event}`);\n * });\n *\n * // Subscribe to actions from specific plugin\n * registry.subscribeBy({ pluginId: 'ai-image' }, (action, event) => {\n * updateUIForPlugin(action, event);\n * });\n */\n public subscribeBy(\n filters: ActionRegistryFilters,\n callback: ActionRegistrySubscriberCallback\n ): () => void {\n this.subscribers.set(callback, filters);\n return () => {\n this.subscribers.delete(callback);\n };\n }\n\n /**\n * Notifies all relevant subscribers about an action event.\n * @param action The action that was registered or unregistered\n * @param event The type of event that occurred\n */\n private notifySubscribers(\n action: ActionDefinition,\n event: ActionRegistryEventType\n ): void {\n this.subscribers.forEach((filters, callback) => {\n // If no filters (null), notify for all actions\n if (filters === null) {\n callback(action, event);\n return;\n }\n\n // Check if action matches the filters\n if (this.matchesFilters(action, filters)) {\n callback(action, event);\n }\n });\n }\n\n /**\n * Checks if an action matches the given filters.\n * Used by both getBy() and subscribeBy() methods.\n * @param action The action to check\n * @param filters The filters to match against\n * @returns True if the action matches all filters\n */\n private matchesFilters(\n action: ActionDefinition,\n filters: ActionRegistryFilters\n ): boolean {\n if (filters.type && action.type !== filters.type) return false;\n if (\n filters.pluginId &&\n action.type === 'plugin' &&\n action.pluginId !== filters.pluginId\n )\n return false;\n if (filters.id && action.id !== filters.id) return false;\n if (filters.kind) {\n // Kind filter only applies to quick actions\n if (action.type !== 'quick') return false;\n if (action.kind !== filters.kind) return false;\n }\n return true;\n }\n}\n", "import { ProviderInitializationResult } from '../providers/initializeProvider';\nimport { OutputKind } from './provider';\n\n/**\n * Global registry for managing AI generation providers across all plugins.\n * Uses singleton pattern to ensure cross-plugin provider discovery.\n */\nexport class ProviderRegistry {\n /** Map storing all registered providers by their ID */\n private providers: Map<string, ProviderInitializationResult<any, any, any>> =\n new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the ProviderRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n * @returns The ProviderRegistry instance\n */\n public static get(): ProviderRegistry {\n const globalKey = '__imgly_provider_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new ProviderRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers a provider in the registry.\n * @param providerInitializationResult The provider to register\n * @returns A disposer function that unregisters the provider when called\n */\n public register(\n providerInitializationResult: ProviderInitializationResult<any, any, any>\n ): () => void {\n if (this.providers.has(providerInitializationResult.provider.id)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Provider with ID \"${providerInitializationResult.provider.id}\" is already registered`\n );\n }\n\n this.providers.set(\n providerInitializationResult.provider.id,\n providerInitializationResult\n );\n\n return () => {\n if (\n this.providers.get(providerInitializationResult.provider.id) ===\n providerInitializationResult\n ) {\n this.providers.delete(providerInitializationResult.provider.id);\n }\n };\n }\n\n /**\n * Gets all registered providers.\n * @returns Array of all provider instances\n */\n public getAll(): ProviderInitializationResult<any, any, any>[] {\n return Array.from(this.providers.values());\n }\n\n /**\n * Gets a provider by its ID.\n * @param id The provider ID to look up\n * @returns The provider instance or undefined if not found\n */\n public getById(\n id: string\n ): ProviderInitializationResult<any, any, any> | undefined {\n return this.providers.get(id);\n }\n\n /**\n * Gets all providers of a specific kind.\n * @param kind The output kind to filter by\n * @returns Array of providers matching the specified kind\n */\n public getByKind<K extends OutputKind>(\n kind: K\n ): ProviderInitializationResult<K, any, any>[] {\n return this.getAll().filter(({ provider }) => provider.kind === kind);\n }\n}\n", "import { GenerationOptions, GenerationResult, Output } from '../core/provider';\n\n/**\n * Result of the generation with a dispose function to clean up\n */\nexport interface DisposableGenerationResult<O extends Output> {\n /**\n * The actual generation result\n */\n result: GenerationResult<O>;\n\n /**\n * Function to dispose/clean up resources created during generation\n * This should be called when the generation is cancelled or completely\n * finished including the confirmation of the generation if applicable.\n */\n dispose: () => Promise<void>;\n}\n\n/**\n * Define the type for middleware functions\n */\nexport type Middleware<I, O extends Output> = (\n input: I,\n options: GenerationOptions & {\n /**\n * The block ids the generation is applied on\n * If this value is undefined, the selected blocks will be used.\n * Setting this value to null will explicitly tell every\n * middleware that no block shall be used.\n */\n blockIds?: number[] | null;\n\n /**\n * Adds a disposer function to this genereation which is called\n * when the generation is cancelled or completely finished\n * including the confirmation of the generation if applicable.\n */\n addDisposer: (dispose: () => Promise<void>) => void;\n },\n next: (input: I, options: GenerationOptions) => Promise<GenerationResult<O>>\n) => Promise<GenerationResult<O>>;\n\nexport function composeMiddlewares<I, O extends Output>(\n middlewares: (Middleware<I, O> | false | undefined | null)[]\n) {\n // Filter out false, undefined, and null middlewares\n const validMiddlewares = middlewares.filter(\n (middleware): middleware is Middleware<I, O> => !!middleware\n );\n // Start with the base handler\n return (\n baseHandler: (\n input: I,\n options: GenerationOptions\n ) => Promise<GenerationResult<O>>\n ) => {\n // We need to build a chain where each step is a function with the signature:\n // (input, options) => Promise<Result>\n\n // The composed function that will be returned\n return async (\n input: I,\n options: GenerationOptions\n ): Promise<DisposableGenerationResult<O>> => {\n // Store disposer functions that will be called when dispose() is called\n const disposers: Array<() => Promise<void>> = [];\n\n // Function to add a disposer\n const addDisposer = (dispose: () => Promise<void>) => {\n disposers.push(dispose);\n };\n\n // Define a function to process each middleware in sequence\n const runMiddleware = async (\n index: number,\n currentInput: I,\n currentOptions: GenerationOptions\n ): Promise<GenerationResult<O>> => {\n // If we've processed all middlewares, call the base handler\n if (index >= validMiddlewares.length) {\n return baseHandler(currentInput, currentOptions);\n }\n\n // Get the current middleware\n const currentMiddleware = validMiddlewares[index];\n\n // Create a next function for this middleware that calls the next middleware in line\n const next = async (\n nextInput: I,\n nextOptions: GenerationOptions\n ): Promise<GenerationResult<O>> => {\n return runMiddleware(index + 1, nextInput, nextOptions);\n };\n\n // Enhanced options with addDisposer\n const enhancedOptions = {\n ...currentOptions,\n addDisposer\n };\n\n // Call the current middleware with the input, enhanced options, and next function\n return currentMiddleware(currentInput, enhancedOptions, next);\n };\n\n // Create enhanced options with addDisposer for base handler as well\n const enhancedOptions = {\n ...options,\n addDisposer\n };\n\n // Run the middleware chain\n const result = await runMiddleware(0, input, enhancedOptions);\n\n // Create the dispose function that will call all collected disposers in reverse order\n const dispose = async (): Promise<void> => {\n // Execute disposers in reverse order (last added, first disposed)\n /* eslint-disable no-await-in-loop */\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n await disposers[i]();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error in disposer:', error);\n }\n }\n // Clear the disposers array after all are executed\n disposers.length = 0;\n };\n\n // Return both the result and the dispose function\n return {\n result,\n dispose\n };\n };\n };\n}\n", "/* eslint-disable no-console */\nimport { GenerationResult, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\nfunction loggingMiddleware<I, O extends Output>({\n enable = true\n}: {\n enable: boolean | undefined;\n}) {\n const middleware: Middleware<I, O> = async (input, options, next) => {\n if (!enable) return next(input, options);\n\n console.group('[GENERATION]');\n console.log(`Generating with input:`, JSON.stringify(input, null, 2));\n let result: GenerationResult<O> | undefined;\n const start = Date.now();\n try {\n result = await next(input, options);\n return result;\n } finally {\n if (result != null) {\n console.log(`Generation took ${Date.now() - start}ms`);\n console.log(`Generation result:`, JSON.stringify(result, null, 2));\n }\n console.groupEnd();\n }\n };\n\n return middleware;\n}\n\nexport default loggingMiddleware;\n", "import CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { GenerationResult, Output } from '../core/provider';\n\nexport const AI_PANEL_ID_PREFIX = 'ly.img.ai';\n\nconst TEMP_ASSET_SOURCE_ID = 'ly.img.ai.temp';\n\n/**\n * Adding asset to the scene.\n *\n * NOTE: Will use a temporary asset source so that\n * our asset source middleware trigger. This is necessary since there is\n * a lot of extra logic in the video middlewares regarding trim, position etc.\n *\n * These will only trigger via an asset source, not by calling\n * `defaultApplyAsset` directly.\n */\nexport async function addAssetToScene(\n cesdk: CreativeEditorSDK,\n assetResult: AssetResult\n) {\n if (!cesdk.engine.asset.findAllSources().includes(TEMP_ASSET_SOURCE_ID)) {\n cesdk.engine.asset.addLocalSource(TEMP_ASSET_SOURCE_ID);\n }\n\n return cesdk.engine.asset.apply(TEMP_ASSET_SOURCE_ID, assetResult);\n}\n\n/**\n * Returns a consistent panel ID for a provider ID\n */\nexport function getPanelId(providerId: string): string {\n return `${AI_PANEL_ID_PREFIX}.${providerId}`;\n}\n\nexport default getPanelId;\n/**\n * Extracts a readable error message from an unknown error\n *\n * @param error The error caught in a try/catch block\n * @param fallbackMessage Optional fallback message if error is not an Error object\n * @returns A string representation of the error\n */\nexport function extractErrorMessage(\n error: unknown,\n fallbackMessage = 'We encountered an unknown error while generating the asset. Please try again.'\n): string {\n if (error === null) {\n return fallbackMessage;\n }\n\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === 'object') {\n // Try to get message property if it exists\n const errorObj = error as Record<string, unknown>;\n if ('message' in errorObj && typeof errorObj.message === 'string') {\n return errorObj.message;\n }\n if ('cause' in errorObj && typeof errorObj.cause === 'string') {\n return errorObj.cause;\n }\n\n /*\n * Elevenlabs for instance uses the following structure for errors:\n * {\n * \"detail\": {\n * \"status\": \"error_code\",\n * \"message\": \"Explanation of the rate limit issue.\"\n * }\n * }\n */\n if (\n 'detail' in errorObj &&\n typeof errorObj.detail === 'object' &&\n errorObj.detail !== null &&\n 'message' in errorObj.detail &&\n typeof errorObj.detail.message === 'string'\n ) {\n return errorObj.detail.message;\n }\n\n /*\n * Used by e.g. Anthropic\n */\n if (\n 'error' in errorObj &&\n typeof errorObj.error === 'object' &&\n errorObj.error !== null &&\n 'message' in errorObj.error &&\n typeof errorObj.error.message === 'string'\n ) {\n return errorObj.error.message;\n }\n\n return fallbackMessage;\n }\n\n if (typeof error === 'string') {\n return error;\n }\n\n // For any other type, convert to string\n return String(error) || fallbackMessage;\n}\n\n/**\n * Generates a random UUID v4\n */\nexport function uuid4() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n\n/**\n * Gets the duration of a video from a URL\n * @param url - The URL of the video\n * @returns A promise that resolves to the duration of the video in seconds\n */\nexport function getDurationForVideo(url: string): Promise<number> {\n return new Promise((resolve, reject) => {\n try {\n const video = document.createElement('video');\n video.style.display = 'none';\n\n // Set up event handlers\n video.addEventListener('loadedmetadata', () => {\n if (video.duration === Infinity) {\n // Some videos might initially report Infinity\n video.currentTime = 1e101;\n // Wait for currentTime to update\n setTimeout(() => {\n video.currentTime = 0;\n resolve(video.duration);\n document.body.removeChild(video);\n }, 50);\n } else {\n resolve(video.duration);\n document.body.removeChild(video);\n }\n });\n\n video.addEventListener('error', () => {\n document.body.removeChild(video);\n reject(new Error(`Failed to load video from ${url}`));\n });\n\n // Set source and begin loading\n video.src = url;\n document.body.appendChild(video);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Gets a thumbnail image from a video URL\n * @param url - The URL of the video\n * @param seekTime - Time in seconds to capture the thumbnail (default: 0)\n * @param format - Image format for the thumbnail (default: 'image/jpeg')\n * @param quality - Image quality between 0 and 1 (default: 0.8)\n * @returns A promise that resolves to the thumbnail data URL\n */\nexport function getThumbnailForVideo(\n url: string,\n seekTime = 0,\n format = 'image/jpeg',\n quality = 0.8\n): Promise<string> {\n return new Promise((resolve, reject) => {\n try {\n const video = document.createElement('video');\n // Set crossOrigin to anonymous to prevent tainted canvas issues\n video.crossOrigin = 'anonymous';\n video.style.display = 'none';\n\n // Set up event handlers\n video.addEventListener('loadedmetadata', () => {\n // Seek to the specified time\n video.currentTime = Math.min(seekTime, video.duration);\n\n video.addEventListener(\n 'seeked',\n () => {\n // Create a canvas to draw the video frame\n const canvas = document.createElement('canvas');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n // Draw the video frame to the canvas\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n document.body.removeChild(video);\n reject(new Error('Failed to create canvas context'));\n return;\n }\n\n ctx.drawImage(video, 0, 0, canvas.width, canvas.height);\n\n try {\n // Convert canvas to data URL\n const dataURL = canvas.toDataURL(format, quality);\n // Clean up\n document.body.removeChild(video);\n resolve(dataURL);\n } catch (e) {\n document.body.removeChild(video);\n reject(\n new Error(\n `Failed to create thumbnail: ${\n e instanceof Error ? e.message : String(e)\n }`\n )\n );\n }\n },\n { once: true }\n );\n });\n\n video.addEventListener('error', () => {\n document.body.removeChild(video);\n reject(new Error(`Failed to load video from ${url}`));\n });\n\n // Set source and begin loading\n video.src = url;\n document.body.appendChild(video);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Converts an ID string to a human-readable label\n * @param id - The ID string to convert\n * @returns A human-readable label derived from the ID\n *\n * Examples:\n * - snake_case_id \u2192 Snake Case Id\n * - kebab-case-id \u2192 Kebab Case Id\n * - camelCaseId \u2192 Camel Case Id\n * - PascalCaseId \u2192 Pascal Case Id\n */\nexport function getLabelFromId(id: string): string {\n if (!id) return '';\n\n // Handle snake_case, kebab-case, camelCase, and PascalCase\n return (\n id\n // Replace underscores and hyphens with spaces (for snake_case and kebab-case)\n .replace(/[_-]/g, ' ')\n // Add spaces before uppercase letters (for camelCase and PascalCase)\n .replace(/([A-Z])/g, ' $1')\n // Trim any extra spaces and ensure first letter is capitalized\n .trim()\n .split(' ')\n .filter((word) => word.length > 0) // Remove empty strings from multiple spaces\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n );\n}\n\n/**\n * Type guard to check if a value is an AsyncGenerator rather than a Promise\n *\n * @param value - Value of type Promise<O> | AsyncGenerator<O, C>\n * @returns Boolean indicating if the value is an AsyncGenerator\n */\nexport function isAsyncGenerator<O extends Output, C>(\n value: GenerationResult<O, C>\n): value is AsyncGenerator<O, C> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'next' in value &&\n 'return' in value &&\n 'throw' in value &&\n typeof value.next === 'function' &&\n typeof value.return === 'function' &&\n typeof value.throw === 'function' &&\n Symbol.asyncIterator in value &&\n typeof value[Symbol.asyncIterator] === 'function'\n );\n}\n\nexport function isAbortError(error: unknown): error is Error {\n return error instanceof Error && error.name === 'AbortError';\n}\n\n/**\n * Adds an icon set to the CreativeEditorSDK UI only once. Marks\n * it as added in the global state to prevent multiple additions.\n */\nexport function addIconSetOnce(\n cesdk: CreativeEditorSDK,\n id: string,\n icons: string\n): void {\n const globalStateIconSetAddedId = `${id}.iconSetAdded`;\n if (!cesdk.ui.experimental.hasGlobalStateValue(globalStateIconSetAddedId)) {\n cesdk.ui.addIconSet(id, icons);\n cesdk.ui.experimental.setGlobalStateValue(globalStateIconSetAddedId, true);\n }\n}\n", "import { isAsyncGenerator } from '../utils/utils';\nimport { GenerationResult, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\n/**\n * Middleware to upload the output of a generation process.\n *\n * Sometimes it is not possible to use the result of a provider or\n * not even allowed to use it directly. This middleware allows you to upload\n * the result of a generation process to a server or a cloud storage.\n *\n * @param upload The function to upload the output. It should return a promise\n */\nfunction uploadMiddleware<I, O extends Output>(\n upload: (output: O) => Promise<O>\n) {\n const middleware: Middleware<I, O> = async (input, options, next) => {\n const result: GenerationResult<O> | undefined = await next(input, options);\n if (isAsyncGenerator(result)) {\n // No reupload needed, just return the async generator\n return result;\n }\n\n const uploaded = await upload(result);\n return uploaded;\n };\n\n return middleware;\n}\n\nexport default uploadMiddleware;\n", "/**\n * Merge quick actions configuration by combining provider defaults with user configuration overrides\n *\n * @param providerDefaults - The default quick actions from the provider\n * @param userConfig - The user's configuration overrides\n * @returns Merged quick actions configuration\n */\nexport function mergeQuickActionsConfig<T extends Record<string, any>>(\n providerDefaults: T,\n userConfig?: {\n [quickActionId: string]: any | false | null;\n }\n): T {\n // Always return a copy to avoid mutating the original\n const result: any = { ...providerDefaults };\n\n if (!userConfig) return result as T;\n\n for (const [actionId, config] of Object.entries(userConfig)) {\n if (config === false || config === null || config === undefined) {\n // Remove the quick action\n delete result[actionId];\n } else if (config === true) {\n // Keep provider's default if it exists, otherwise add true\n if (!(actionId in providerDefaults)) {\n result[actionId] = true;\n }\n // If it exists in defaults, we already have it from the spread above\n } else {\n // Override with user configuration\n result[actionId] = config;\n }\n }\n\n return result as T;\n}\n", "import { GenerationOptions, Output } from '../core/provider';\nimport { Middleware } from './middleware';\n\nexport interface RateLimitOptions<I> {\n /**\n * Maximum number of requests allowed in the time window\n */\n maxRequests: number;\n\n /**\n * Time window in milliseconds\n */\n timeWindowMs: number;\n\n /**\n * Optional key function or string to create different rate limits for different inputs\n * - If not provided, all requests share the same 'global' rate limit\n * - If a string is provided, that string is used as a static key\n * - If a function is provided, it generates a key based on input and options\n */\n keyFn?: string | ((input: I, options: GenerationOptions) => string);\n\n /**\n * Callback function that is called when rate limit is exceeded\n * Return value determines if the operation should be rejected (throw error) or allowed\n * If true is returned, the operation will proceed despite exceeding the rate limit\n * If false or undefined is returned, the operation will be rejected with a default error\n */\n onRateLimitExceeded?: (\n input: I,\n options: GenerationOptions,\n rateLimitInfo: {\n key: string;\n currentCount: number;\n maxRequests: number;\n timeWindowMs: number;\n remainingTimeMs: number;\n }\n ) => boolean | Promise<boolean> | void;\n\n /**\n * Optional database name for the IndexedDB store\n * If not provided, a default name will be used\n */\n dbName?: string;\n\n /**\n * Disable the rate limit middleware\n */\n disable?: boolean | (() => boolean);\n}\n\n// Store for tracking requests per key\ninterface RequestTracker {\n timestamps: number[];\n lastCleanup: number;\n}\n\n// In-memory fallback store for rate limits for environments without IndexedDB\n// Export for testing purposes\n// This is now a Map of middleware instances to their respective stores\n// The key can be either a symbol (for unique instances with prefix) or a string (for shared instances without prefix)\nexport const inMemoryStores: Map<\n symbol | string,\n Record<string, RequestTracker>\n> = new Map();\n\n/**\n * IndexedDB store for rate limiting\n */\nclass RateLimitStore {\n private db: IDBDatabase | null = null;\n\n private readonly dbName: string;\n\n private readonly storeName: string;\n\n private readonly dbVersion: number = 1;\n\n private isInitializing: boolean = false;\n\n private initPromise: Promise<void> | null = null;\n\n private readonly instanceId: symbol | string;\n\n constructor(\n instanceId: symbol | string,\n dbName?: string,\n storeName?: string\n ) {\n this.instanceId = instanceId;\n this.dbName = dbName ?? 'ly.img.ai.rateLimit';\n this.storeName = storeName ?? 'rateLimits';\n }\n\n /**\n * Initialize the database connection\n */\n async initialize(): Promise<void> {\n if (this.db) {\n return;\n }\n\n if (this.isInitializing) {\n return this.initPromise!;\n }\n\n this.isInitializing = true;\n this.initPromise = new Promise<void>((resolve, reject) => {\n try {\n const request = indexedDB.open(this.dbName, this.dbVersion);\n\n request.onerror = (event) => {\n this.isInitializing = false;\n\n // eslint-disable-next-line no-console\n console.error('Failed to open IndexedDB for rate limiting:', event);\n reject(new Error('Failed to open IndexedDB for rate limiting'));\n };\n\n request.onupgradeneeded = (event) => {\n const db = (event.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName, { keyPath: 'id' });\n }\n };\n\n request.onsuccess = (event) => {\n this.db = (event.target as IDBOpenDBRequest).result;\n this.isInitializing = false;\n resolve();\n };\n } catch (error) {\n this.isInitializing = false;\n // eslint-disable-next-line no-console\n console.error('Error initializing IndexedDB:', error);\n reject(error);\n }\n });\n\n return this.initPromise;\n }\n\n /**\n * Get a request tracker by key\n */\n async getTracker(key: string): Promise<RequestTracker | null> {\n try {\n await this.initialize();\n\n // Create a combined key that includes the instance ID to ensure isolation\n const instanceIdStr =\n typeof this.instanceId === 'symbol'\n ? this.instanceId.description || ''\n : this.instanceId;\n const combinedKey = `${instanceIdStr}_${key}`;\n\n return await new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.storeName, 'readonly');\n const store = transaction.objectStore(this.storeName);\n const request = store.get(combinedKey);\n\n request.onsuccess = () => {\n if (request.result) {\n resolve(request.result.data);\n } else {\n resolve(null);\n }\n };\n\n request.onerror = () => {\n // eslint-disable-next-line no-console\n console.error(\n `Failed to get tracker for key ${combinedKey}:`,\n request.error\n );\n reject(request.error);\n };\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error getting tracker from IndexedDB:', error);\n return Promise.reject(error);\n }\n }\n\n /**\n * Save a request tracker by key\n */\n async saveTracker(key: string, tracker: RequestTracker): Promise<void> {\n try {\n await this.initialize();\n\n // Create a combined key that includes the instance ID to ensure isolation\n const instanceIdStr =\n typeof this.instanceId === 'symbol'\n ? this.instanceId.description || ''\n : this.instanceId;\n const combinedKey = `${instanceIdStr}_${key}`;\n\n return await new Promise((resolve, reject) => {\n const transaction = this.db!.transaction(this.storeName, 'readwrite');\n const store = transaction.objectStore(this.storeName);\n store.put({ id: combinedKey, data: tracker });\n\n transaction.oncomplete = () => {\n resolve();\n };\n\n transaction.onerror = () => {\n // eslint-disable-next-line no-console\n console.error(\n `Failed to save tracker for key ${combinedKey}:`,\n transaction.error\n );\n reject(transaction.error);\n };\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error saving tracker to IndexedDB:', error);\n return Promise.reject(error);\n }\n }\n\n /**\n * Check if IndexedDB is available\n */\n static isAvailable(): boolean {\n return typeof indexedDB !== 'undefined';\n }\n\n /**\n * Close the database connection\n */\n close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n}\n\n/**\n * Middleware that implements rate limiting for AI generation requests\n * Uses IndexedDB for storage when available, with in-memory fallback\n * Each middleware instance has its own isolated set of rate limits\n */\nfunction rateLimitMiddleware<I, O extends Output>(\n middlewareOptions: RateLimitOptions<I>\n) {\n const {\n maxRequests,\n timeWindowMs,\n keyFn = () => 'global',\n onRateLimitExceeded,\n dbName\n } = middlewareOptions;\n\n // Create an identifier for this middleware instance based on its configuration\n // This ensures persistence across page reloads and sharing between identical configurations\n const configStr = `rate-limit-middleware-${maxRequests}-${timeWindowMs}`;\n\n // Use a string key for the configuration so identical configurations share the same limits\n const instanceId = configStr;\n\n // Create the store with the instance ID\n const useIndexedDB = RateLimitStore.isAvailable();\n const store = useIndexedDB ? new RateLimitStore(instanceId, dbName) : null;\n\n // Initialize this middleware's in-memory store\n if (!inMemoryStores.has(instanceId)) {\n inMemoryStores.set(instanceId, {});\n }\n // Get this middleware's in-memory store\n const inMemoryStore = inMemoryStores.get(instanceId)!;\n\n const middleware: Middleware<I, O> = async (input, options, next) => {\n if (\n typeof middlewareOptions.disable === 'function'\n ? middlewareOptions.disable()\n : middlewareOptions.disable\n ) {\n return next(input, options);\n }\n // Get rate limit key based on input using the provided keyFn\n // If keyFn is a string, use it directly; otherwise call the function\n const key = typeof keyFn === 'string' ? keyFn : keyFn(input, options);\n const now = Date.now();\n\n let tracker: RequestTracker;\n\n // Get tracker from IndexedDB or create a new one\n if (useIndexedDB && store) {\n try {\n const storedTracker = await store.getTracker(key);\n if (storedTracker) {\n tracker = storedTracker;\n } else {\n tracker = {\n timestamps: [],\n lastCleanup: now\n };\n }\n } catch (error) {\n // Fallback to in-memory store if IndexedDB fails\n // eslint-disable-next-line no-console\n console.error(\n 'IndexedDB access failed, using in-memory fallback:',\n error\n );\n if (!inMemoryStore[key]) {\n inMemoryStore[key] = {\n timestamps: [],\n lastCleanup: now\n };\n }\n tracker = inMemoryStore[key];\n }\n } else {\n // Use in-memory store if IndexedDB is not available\n if (!inMemoryStore[key]) {\n inMemoryStore[key] = {\n timestamps: [],\n lastCleanup: now\n };\n }\n tracker = inMemoryStore[key];\n }\n\n // Clean up old timestamps that are outside the time window\n if (now - tracker.lastCleanup > timeWindowMs) {\n tracker.timestamps = tracker.timestamps.filter(\n (timestamp) => now - timestamp < timeWindowMs\n );\n tracker.lastCleanup = now;\n }\n\n // Check if rate limit is exceeded\n if (tracker.timestamps.length >= maxRequests) {\n // Calculate the time until the oldest request expires\n const oldestTimestamp = Math.min(...tracker.timestamps);\n const remainingTimeMs = Math.max(\n 0,\n timeWindowMs - (now - oldestTimestamp)\n );\n\n // Call the rate limit exceeded callback if provided\n if (onRateLimitExceeded) {\n const rateLimitInfo = {\n key, // This is the baseKey from keyFn\n currentCount: tracker.timestamps.length,\n maxRequests,\n timeWindowMs,\n remainingTimeMs\n };\n\n // If callback returns true, allow the request to proceed\n const shouldProceed = await onRateLimitExceeded(\n input,\n options,\n rateLimitInfo\n );\n if (!shouldProceed) {\n // The callback should indicate the error, so we throw\n // an abort error instead of a generic error to indicate\n // the generation was aborted and we do not show any further\n // error notification.\n throw new DOMException(\n 'Operation aborted: Rate limit exceeded',\n 'AbortError'\n );\n }\n } else {\n // Default behavior: throw an error\n throw new Error('Rate limit exceeded. Please try again later.');\n }\n }\n\n // Add current timestamp to the tracker\n tracker.timestamps.push(now);\n\n // Save the updated tracker\n if (useIndexedDB && store) {\n try {\n await store.saveTracker(key, tracker);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to save tracker to IndexedDB:', error);\n // In case of IndexedDB failure, update the in-memory store as fallback\n inMemoryStore[key] = tracker;\n }\n } else {\n inMemoryStore[key] = tracker;\n }\n\n // Continue with the next middleware\n return next(input, options);\n };\n\n return middleware;\n}\n\nexport default rateLimitMiddleware;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Checks if the current AI plugin version matches the shared version across all AI plugins.\n * Issues a console warning if versions don't match.\n *\n * @param cesdk - The CreativeEditorSDK instance\n * @param pluginId - The ID of the current plugin\n * @param currentVersion - The version of the current plugin\n */\nexport function checkAiPluginVersion(\n cesdk: CreativeEditorSDK,\n pluginId: string,\n currentVersion: string\n): void {\n const AI_PLUGIN_VERSION_KEY = 'ai-plugin-version';\n const AI_PLUGIN_VERSION_WARNING_KEY = 'ai-plugin-version-warning-shown';\n\n try {\n const sharedVersion = cesdk.ui.experimental.getGlobalStateValue<string>(\n AI_PLUGIN_VERSION_KEY\n );\n\n if (!sharedVersion) {\n // First AI plugin sets the shared version\n cesdk.ui.experimental.setGlobalStateValue(\n AI_PLUGIN_VERSION_KEY,\n currentVersion\n );\n } else if (sharedVersion !== currentVersion) {\n // Version mismatch detected\n const warningShown = cesdk.ui.experimental.getGlobalStateValue<boolean>(\n AI_PLUGIN_VERSION_WARNING_KEY,\n false\n );\n\n if (!warningShown) {\n // eslint-disable-next-line no-console\n console.warn(\n `[IMG.LY AI Plugins] Version mismatch detected!\\n` +\n `Plugin \"${pluginId}\" is using version ${currentVersion}, but other AI plugins are using version ${sharedVersion}.\\n` +\n `This may cause compatibility issues. Please ensure all AI plugins (@imgly/plugin-ai-*) use the same version.\\n` +\n `Consider updating all AI plugins to the same version for optimal compatibility.`\n );\n\n // Set flag to prevent duplicate warnings\n cesdk.ui.experimental.setGlobalStateValue(\n AI_PLUGIN_VERSION_WARNING_KEY,\n true\n );\n }\n }\n } catch (error) {\n // Fail silently if global state access fails\n // eslint-disable-next-line no-console\n console.debug(\n '[IMG.LY AI Plugins] Could not check plugin version consistency:',\n error\n );\n }\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Registers a dock component for AI generation that opens\n * the AI generation panel and closes any other AI panels.\n */\nfunction registerDockComponent(options: {\n cesdk: CreativeEditorSDK;\n panelId: string;\n}) {\n const { cesdk, panelId } = options;\n if (!panelId.startsWith('ly.img.ai.')) {\n // eslint-disable-next-line no-console\n console.warn(\n `Dock components for AI generation should open a panel with an id starting with \"ly.img.ai.\" \u2013 \"${panelId}\" was provided.`\n );\n }\n\n const dockComponentId = `${panelId}.dock`;\n cesdk.ui.registerComponent(dockComponentId, ({ builder }) => {\n const isOpen = cesdk.ui.isPanelOpen(panelId);\n\n builder.Button(`${panelId}.dock.button`, {\n label: `${panelId}.dock.label`,\n isSelected: isOpen,\n icon: '@imgly/Sparkle',\n onClick: () => {\n cesdk.ui.findAllPanels().forEach((panel) => {\n if (panel.startsWith('ly.img.ai.')) {\n cesdk.ui.closePanel(panel);\n }\n if (!isOpen && panel === '//ly.img.panel/assetLibrary') {\n cesdk.ui.closePanel(panel);\n }\n });\n\n if (!isOpen) {\n cesdk.ui.openPanel(panelId);\n } else {\n cesdk.ui.closePanel(panelId);\n }\n }\n });\n });\n}\n\nexport default registerDockComponent;\n", "import type CreativeEngine from '@cesdk/engine';\n\n/**\n * Enable function for a single image fill block selected.\n */\nfunction enableImageFill() {\n return ({ engine }: { engine: CreativeEngine }) => {\n const blockIds = engine.block.findAllSelected();\n if (blockIds == null || blockIds.length !== 1) return false;\n\n const [blockId] = blockIds;\n\n if (!engine.block.supportsFill(blockId)) return false;\n\n if (engine.block.getKind(blockId) === 'sticker') return false;\n\n if (\n !['//ly.img.ubq/graphic', '//ly.img.ubq/page'].includes(\n engine.block.getType(blockId)\n )\n ) {\n return false;\n }\n\n const fillBlock = engine.block.getFill(blockId);\n return engine.block.getType(fillBlock) === '//ly.img.ubq/fill/image';\n };\n}\n\nexport default enableImageFill;\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport Provider, { GetInput, Output, OutputKind } from '../core/provider';\nimport { extractErrorMessage } from '../utils/utils';\n\nfunction handleGenerationError<K extends OutputKind, I, O extends Output>(\n error: unknown,\n options: {\n cesdk: CreativeEditorSDK;\n provider: Provider<K, I, O>;\n getInput?: GetInput<I>;\n }\n) {\n const { cesdk, provider, getInput } = options;\n\n // eslint-disable-next-line no-console\n console.error('Generation failed:', error);\n const shown = showErrorNotification(\n cesdk,\n provider.output.notification,\n () => ({\n input: getInput?.().input,\n error\n })\n );\n if (!shown) {\n cesdk.ui.showNotification({\n type: 'error',\n message: extractErrorMessage(error)\n });\n }\n}\n\nfunction showErrorNotification<I, O extends Output>(\n cesdk: CreativeEditorSDK,\n notifications: Provider<any, I, O>['output']['notification'],\n createContext: () => { input?: I; error: unknown }\n): boolean {\n const errorNotification = notifications?.error;\n if (errorNotification == null) return false;\n\n const showOnSuccess =\n typeof errorNotification.show === 'function'\n ? errorNotification.show(createContext())\n : errorNotification.show;\n\n if (!showOnSuccess) return false;\n\n const message =\n typeof errorNotification.message === 'function'\n ? errorNotification.message(createContext())\n : errorNotification.message ?? 'common.ai-generation.failed';\n\n const action =\n errorNotification.action != null\n ? {\n label:\n typeof errorNotification.action.label === 'function'\n ? errorNotification.action.label(createContext())\n : errorNotification.action.label,\n onClick: () => {\n errorNotification?.action?.onClick(createContext());\n }\n }\n : undefined;\n\n cesdk.ui.showNotification({\n type: 'error',\n message,\n action\n });\n return true;\n}\n\nexport default handleGenerationError;\n", "const previewUri =\n 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIzIiBoZWlnaHQ9IjMyMyIgdmlld0JveD0iMCAwIDMyMyAzMjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIzMjMiIGhlaWdodD0iMzIzIiBmaWxsPSIjRTlFQkVEIi8+CjxnIG9wYWNpdHk9IjAuMyI+CjxwYXRoIGQ9Ik0xMTYgMTg0VjE5MS41QzExNiAxOTkuNzg0IDEyMi43MTYgMjA2LjUgMTMxIDIwNi41SDE5MUMxOTkuMjg0IDIwNi41IDIwNiAxOTkuNzg0IDIwNiAxOTEuNVYxMzEuNUMyMDYgMTIzLjIxNiAxOTkuMjg0IDExNi41IDE5MSAxMTYuNUwxOTAuOTk1IDEyNi41QzE5My43NTcgMTI2LjUgMTk2IDEyOC43MzkgMTk2IDEzMS41VjE5MS41QzE5NiAxOTQuMjYxIDE5My43NjEgMTk2LjUgMTkxIDE5Ni41SDEzMUMxMjguMjM5IDE5Ni41IDEyNiAxOTQuMjYxIDEyNiAxOTEuNVYxODRIMTE2WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTY2LjQ5NCAxMDUuOTI0QzE2NS44NjkgMTA0LjM0MiAxNjMuNjI5IDEwNC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DMTM1Ljg2OSAxNzMuNjYyIDEzMy42MjkgMTczLjY2MiAxMzMuMDA1IDE3Mi4wNzlMMTI3LjYyMyAxNTguNDM0QzEyNy40MzMgMTU3Ljk1MSAxMjcuMDUgMTU3LjU2OCAxMjYuNTY3IDE1Ny4zNzhMMTEyLjkyMiAxNTEuOTk2QzExMS4zMzkgMTUxLjM3MiAxMTEuMzM5IDE0OS4xMzIgMTEyLjkyMiAxNDguNTA4TDEyNi41NjcgMTQzLjEyNkMxMjcuMDUgMTQyLjkzNSAxMjcuNDMzIDE0Mi41NTMgMTI3LjYyMyAxNDIuMDdMMTMzLjAwNSAxMjguNDI0WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTk1Ljk5OSAxODQuMDA0VjE5MS41MDJDMTk1Ljk5OSAxOTQuMjYzIDE5My43NjEgMTk2LjUwMiAxOTAuOTk5IDE5Ni41MDJIMTQ3LjY2OEwxNzIuODc5IDE1OC42ODRDMTc0LjM2MyAxNTYuNDU4IDE3Ny42MzUgMTU2LjQ1OCAxNzkuMTIgMTU4LjY4NEwxOTUuOTk5IDE4NC4wMDRaIiBmaWxsPSIjOEY4RjhGIi8+CjwvZz4KPC9zdmc+Cg==';\n\nexport default previewUri;\n", "import { type AssetResult } from '@cesdk/cesdk-js';\nimport {\n type OutputKind,\n GetBlockInputResult,\n InputByKind\n} from '../core/provider';\nimport previewUri from './previewUri';\n\nfunction getAssetResultForPlaceholder<K extends OutputKind>(\n id: string,\n kind: K,\n blockInput: GetBlockInputResult<K>\n): AssetResult {\n switch (kind) {\n case 'image': {\n return getImageAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['image']\n );\n }\n case 'video': {\n return getVideoAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['video']\n );\n }\n case 'sticker': {\n return getStickerAssetResultForPlaceholder(\n id,\n blockInput[kind] as InputByKind['sticker']\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating placeholder block: ${kind}`\n );\n }\n }\n}\n\nfunction getImageAssetResultForPlaceholder(\n id: string,\n input: InputByKind['image']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n meta: {\n previewUri,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'image',\n\n width,\n height\n }\n };\n}\n\nfunction getVideoAssetResultForPlaceholder(\n id: string,\n input: InputByKind['video']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n previewUri,\n mimeType: 'video/mp4',\n kind: 'video',\n fillType: '//ly.img.ubq/fill/video',\n\n duration: input.duration.toString(),\n\n width,\n height\n }\n };\n}\n\nfunction getStickerAssetResultForPlaceholder(\n id: string,\n input: InputByKind['sticker']\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n meta: {\n previewUri,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'sticker',\n\n width,\n height\n }\n };\n}\n\nexport default getAssetResultForPlaceholder;\n", "import { type AssetResult } from '@cesdk/cesdk-js';\nimport {\n type OutputKind,\n AudioOutput,\n GetBlockInputResult,\n ImageOutput,\n InputByKind,\n Output,\n StickerOutput,\n VideoOutput\n} from '../core/provider';\nimport { getThumbnailForVideo } from '../utils/utils';\n\nasync function getAssetResultForGenerated<K extends OutputKind>(\n id: string,\n kind: K,\n blockInputs: GetBlockInputResult<K>,\n output: Output\n): Promise<AssetResult> {\n switch (kind) {\n case 'image': {\n if (output.kind !== 'image') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: image)`\n );\n }\n\n return getImageAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['image'],\n output\n );\n }\n\n case 'video': {\n if (output.kind !== 'video') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: video)`\n );\n }\n\n return getVideoAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['video'],\n output\n );\n }\n\n case 'audio': {\n if (output.kind !== 'audio') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: audio)`\n );\n }\n\n return getAudioAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['audio'],\n output\n );\n }\n\n case 'sticker': {\n if (output.kind !== 'sticker') {\n throw new Error(\n `Output kind does not match the expected type: ${output.kind} (expected: sticker)`\n );\n }\n\n return getStickerAssetResultForGenerated(\n id,\n blockInputs[kind] as InputByKind['sticker'],\n output\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating placeholder block: ${kind}`\n );\n }\n }\n}\n\nfunction getImageAssetResultForGenerated(\n id: string,\n input: InputByKind['image'],\n output: ImageOutput\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.url,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'image',\n\n width,\n height\n },\n payload: {\n sourceSet: [\n {\n uri: output.url,\n width,\n height\n }\n ]\n }\n };\n}\n\nasync function getVideoAssetResultForGenerated(\n id: string,\n input: InputByKind['video'],\n output: VideoOutput\n): Promise<AssetResult> {\n const width = input.width;\n const height = input.height;\n\n const thumbUri = await getThumbnailForVideo(output.url, 0);\n\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri,\n\n mimeType: 'video/mp4',\n kind: 'video',\n fillType: '//ly.img.ubq/fill/video',\n\n duration: input.duration.toString(),\n\n width,\n height\n }\n };\n}\n\nfunction getAudioAssetResultForGenerated(\n id: string,\n input: InputByKind['audio'],\n output: AudioOutput\n): AssetResult {\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.thumbnailUrl,\n blockType: '//ly.img.ubq/audio',\n mimeType: 'audio/x-m4a',\n duration: output.duration.toString()\n }\n };\n}\n\nfunction getStickerAssetResultForGenerated(\n id: string,\n input: InputByKind['sticker'],\n output: StickerOutput\n): AssetResult {\n const width = input.width;\n const height = input.height;\n return {\n id,\n label: input.label,\n meta: {\n uri: output.url,\n thumbUri: output.url,\n fillType: '//ly.img.ubq/fill/image',\n kind: 'sticker',\n\n width,\n height\n },\n payload: {\n sourceSet: [\n {\n uri: output.url,\n width,\n height\n }\n ]\n }\n };\n}\n\nexport default getAssetResultForGenerated;\n", "import type { AssetDefinition } from '@cesdk/cesdk-js';\nimport { addAssetToScene, isAbortError, uuid4 } from '../utils/utils';\nimport { type GetBlockInput, OutputKind, type Output } from '../core/provider';\nimport { Generate, Result } from './createGenerateFunction';\nimport getAssetResultForPlaceholder from '../assets/getAssetResultForPlaceholder';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { Middleware } from '../middleware/middleware';\nimport getAssetResultForGenerated from '../assets/getAssetResultForGenerated';\n\ntype PanelGenerationOptions<K extends OutputKind, I, O extends Output> = {\n /**\n * The kind to generate.\n */\n kind: K;\n\n /**\n * Initialized generate function\n */\n generate: Generate<I, O>;\n\n /**\n * The user flow for the generation process.\n */\n userFlow: 'placeholder' | 'generation-only';\n\n /**\n * Function to get block input from the generated input.\n */\n getBlockInput: GetBlockInput<K, I>;\n\n /**\n * Asset source id of the history library where a generated asset\n * will be added.\n */\n historyAssetSourceId?: string;\n\n /**\n * Additional middlewares added to the generation process.\n */\n middlewares?: Middleware<I, O>[];\n\n /**\n * Print debug information to the console.\n */\n debug?: boolean;\n\n /**\n * Enable dry run mode for testing.\n */\n dryRun?: boolean;\n\n /**\n * Signal to check if process was aborted.\n */\n abortSignal: AbortSignal;\n\n cesdk: CreativeEditorSDK;\n};\n\n/**\n * Handler for generating content from a panel interface.\n * Creates placeholder blocks and manages the generation process.\n */\nfunction handleGenerateFromPanel<K extends OutputKind, I, O extends Output>(\n options: PanelGenerationOptions<K, I, O>\n): (input: I) => Promise<Result<O>> {\n switch (options.userFlow) {\n case 'placeholder':\n return handleGeneratePlaceholderUserFlow(options);\n case 'generation-only':\n return handleGenerateGenerationOnlyUserFlow(options);\n default:\n throw new Error(\n `Unknown user flow: ${options.userFlow}. Expected 'placeholder' or 'generation-only'.`\n );\n }\n}\n\nfunction handleGenerateGenerationOnlyUserFlow<\n K extends OutputKind,\n I,\n O extends Output\n>(options: PanelGenerationOptions<K, I, O>): (input: I) => Promise<Result<O>> {\n const { cesdk, abortSignal } = options;\n\n return async (input: I) => {\n try {\n const kind = options.kind;\n const blockInputs = await options.getBlockInput(input);\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n const result = await options.generate(input, {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n });\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n if (result.status !== 'success') {\n return result;\n }\n\n if (result.type === 'async') {\n // If the result is an async generator, we need to handle it differently.\n // This is a placeholder for handling sync results.\n // You might want to implement logic to handle async results here.\n throw new Error(\n 'Async generation is not supported in this context yet.'\n );\n }\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n if (options.historyAssetSourceId != null) {\n const assetId = uuid4();\n const generatedAssetResult = await getAssetResultForGenerated(\n assetId,\n kind,\n blockInputs,\n result.output\n );\n const assetDefinition: AssetDefinition = {\n ...generatedAssetResult,\n id: `${Date.now()}-${generatedAssetResult.id}`,\n label:\n generatedAssetResult.label != null\n ? {\n en: generatedAssetResult.label\n }\n : {},\n tags: {}\n };\n cesdk.engine.asset.addAssetToSource(\n options.historyAssetSourceId,\n assetDefinition\n );\n } else {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.log(\n 'No asset source ID found in history and generation only was requested. Doing nothing. If no middleware is adding functionality this could be a bug.'\n );\n }\n }\n\n return result;\n } catch (error) {\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\n/**\n * Handles generation from a panel with a placeholder block.\n */\nfunction handleGeneratePlaceholderUserFlow<\n K extends OutputKind,\n I,\n O extends Output\n>(options: PanelGenerationOptions<K, I, O>): (input: I) => Promise<Result<O>> {\n const { cesdk, abortSignal } = options;\n\n let placeholderBlock: number | undefined;\n return async (input: I) => {\n try {\n const kind = options.kind;\n const blockInputs = await options.getBlockInput(input);\n\n if (checkAbortSignal(cesdk, abortSignal)) return { status: 'aborted' };\n\n const assetId = uuid4();\n const assetResult = getAssetResultForPlaceholder(\n assetId,\n kind,\n blockInputs\n );\n\n placeholderBlock = await addAssetToScene(cesdk, assetResult);\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n // This is a workaround. The middleware in the video timeline\n // is calling APIs that will render the block in an error\n // state if it does not have an URI set. It's difficult to\n // recover from that. A bug report has been created for this.\n // As a workaround: Duplicating the block will remove the error state\n // but you will still see an error in the web console.\n // TODO: Remove this workaround when the bug is fixed.\n if (placeholderBlock != null && options.kind === 'video') {\n const positionX = cesdk.engine.block.getPositionX(placeholderBlock);\n const positionY = cesdk.engine.block.getPositionY(placeholderBlock);\n const duplicated = cesdk.engine.block.duplicate(placeholderBlock);\n cesdk.engine.block.setPositionX(duplicated, positionX);\n cesdk.engine.block.setPositionY(duplicated, positionY);\n cesdk.engine.block.destroy(placeholderBlock);\n placeholderBlock = duplicated;\n }\n\n if (placeholderBlock == null)\n throw new Error('Could not create placeholder block');\n\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Pending',\n progress: 0\n });\n\n const result = await options.generate(input, {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n });\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (result.status !== 'success') {\n return result;\n }\n\n if (result.type === 'async') {\n // If the result is an async generator, we need to handle it differently.\n // This is a placeholder for handling sync results.\n // You might want to implement logic to handle async results here.\n throw new Error(\n 'Async generation is not supported in this context yet.'\n );\n }\n\n if (!cesdk.engine.block.isValid(placeholderBlock)) {\n return {\n status: 'aborted',\n message:\n 'Placeholder block was destroyed before generation completed.'\n };\n }\n\n const generatedAssetResult = await getAssetResultForGenerated(\n assetId,\n kind,\n blockInputs,\n result.output\n );\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (options.debug)\n // eslint-disable-next-line no-console\n console.log(\n 'Updating placeholder in scene:',\n JSON.stringify(generatedAssetResult, undefined, 2)\n );\n\n await cesdk.engine.asset.defaultApplyAssetToBlock(\n generatedAssetResult,\n placeholderBlock\n );\n\n if (checkAbortSignal(cesdk, abortSignal, placeholderBlock))\n return { status: 'aborted' };\n\n if (options.historyAssetSourceId != null) {\n const assetDefinition: AssetDefinition = {\n ...generatedAssetResult,\n id: `${Date.now()}-${generatedAssetResult.id}`,\n label:\n generatedAssetResult.label != null\n ? {\n en: generatedAssetResult.label\n }\n : {},\n tags: {}\n };\n cesdk.engine.asset.addAssetToSource(\n options.historyAssetSourceId,\n assetDefinition\n );\n }\n\n if (cesdk.engine.block.isValid(placeholderBlock)) {\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Ready'\n });\n }\n\n return result;\n } catch (error) {\n if (\n placeholderBlock != null &&\n cesdk.engine.block.isValid(placeholderBlock)\n ) {\n if (isAbortError(error)) {\n cesdk.engine.block.destroy(placeholderBlock);\n } else {\n cesdk.engine.block.setState(placeholderBlock, {\n type: 'Error',\n error: 'Unknown'\n });\n }\n }\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\n/**\n * Check the given abort signal and destroy the placeholder block if it is aborted.\n * @returns `true` if the signal is aborted, `false` otherwise.\n */\nfunction checkAbortSignal(\n cesdk: CreativeEditorSDK,\n abortSignal: AbortSignal,\n placeholderBlock?: number\n) {\n if (abortSignal.aborted) {\n if (\n placeholderBlock != null &&\n cesdk.engine.block.isValid(placeholderBlock)\n ) {\n cesdk.engine.block.destroy(placeholderBlock);\n }\n return true;\n }\n return false;\n}\n\nexport default handleGenerateFromPanel;\n", "import CreativeEditorSDK, {\n type BuilderRenderFunctionContext\n} from '@cesdk/cesdk-js';\nimport type Provider from '../../core/provider';\nimport {\n type GetInput,\n type OutputKind,\n type Output,\n type GetBlockInput\n} from '../../core/provider';\nimport { UIOptions, CommonConfiguration } from '../../types';\nimport { isAbortError } from '../../utils/utils';\nimport handleGenerationError from '../../generation/handleGenerationError';\nimport handleGenerateFromPanel from '../../generation/handleGenerateFromPanel';\nimport { Generate } from '../../generation/createGenerateFunction';\n\nexport function isGeneratingStateKey(providerId: string): string {\n return `${providerId}.generating`;\n}\n\nexport function abortGenerationStateKey(providerId: string): string {\n return `${providerId}.abort`;\n}\n\n/**\n * Renders the generation UI components and sets up event handlers\n */\nfunction renderGenerationComponents<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n provider: Provider<K, I, O>,\n generate: Generate<I, O>,\n getInput: GetInput<I>,\n getBlockInput: GetBlockInput<K, I>,\n options: UIOptions & {\n createPlaceholderBlock?: boolean;\n includeHistoryLibrary?: boolean;\n requiredInputs?: string[];\n },\n config: CommonConfiguration<I, O>\n): void {\n const { builder, experimental } = context;\n const { cesdk, includeHistoryLibrary = true } = options;\n const {\n id: providerId,\n output: { abortable }\n } = provider;\n const abortState = experimental.global<() => void>(\n abortGenerationStateKey(providerId),\n () => {}\n );\n const generatingState = experimental.global<boolean>(\n isGeneratingStateKey(providerId),\n false\n );\n\n let abortController: AbortController | undefined;\n const canAbortNow = generatingState.value && abortable;\n const abort = () => {\n if (canAbortNow) {\n abortState.value();\n generatingState.setValue(false);\n abortState.setValue(() => {});\n }\n };\n\n let isDisabled: boolean | undefined;\n if (options.requiredInputs != null && options.requiredInputs.length > 0) {\n const inputs = getInput();\n isDisabled = options.requiredInputs.every((input) => {\n // @ts-ignore\n const hasInput = !inputs.input[input];\n return hasInput;\n });\n }\n\n const confirmCancelDialogId = experimental.global<string | undefined>(\n `${providerId}.confirmationDialogId`,\n undefined\n );\n\n builder.Section(`${providerId}.generate.section`, {\n children: () => {\n builder.Button(`${providerId}.generate`, {\n label: ['common.generate', `panel.${providerId}.generate`],\n isLoading: generatingState.value,\n color: 'accent',\n isDisabled,\n suffix: canAbortNow\n ? {\n icon: '@imgly/Cross',\n color: 'danger',\n tooltip: [`panel.${providerId}.abort`, 'common.cancel'],\n onClick: () => {\n const confirmationDialogId = cesdk.ui.showDialog({\n type: 'warning',\n content: 'panel.ly.img.ai.generation.confirmCancel.content',\n cancel: {\n label: 'common.close',\n onClick: ({ id }) => {\n cesdk.ui.closeDialog(id);\n confirmCancelDialogId.setValue(undefined);\n }\n },\n actions: {\n label: 'panel.ly.img.ai.generation.confirmCancel.confirm',\n color: 'danger',\n onClick: ({ id }) => {\n abort();\n cesdk.ui.closeDialog(id);\n confirmCancelDialogId.setValue(undefined);\n }\n }\n });\n confirmCancelDialogId.setValue(confirmationDialogId);\n }\n }\n : undefined,\n onClick: async () => {\n abortController = new AbortController();\n const abortSignal = abortController.signal;\n\n const triggerGeneration = async () => {\n try {\n generatingState.setValue(true);\n abortState.setValue(() => {\n if (config.debug)\n // eslint-disable-next-line no-console\n console.log('Aborting generation');\n abortController?.abort();\n });\n\n const result = await handleGenerateFromPanel({\n kind: provider.kind,\n generate,\n historyAssetSourceId: options.historyAssetSourceId,\n // TODO: Replace with a merged configuration\n userFlow: options.createPlaceholderBlock\n ? 'placeholder'\n : 'generation-only',\n getBlockInput,\n abortSignal,\n cesdk,\n debug: config.debug,\n dryRun: config.dryRun\n })(getInput().input);\n\n if (result.status === 'aborted') {\n return;\n }\n\n if (result.status === 'error') {\n handleGenerationError(result.message, {\n cesdk,\n provider,\n getInput\n });\n return;\n }\n\n if (result.status === 'success' && result.type === 'sync') {\n const notification = provider.output.notification;\n showSuccessNotification(cesdk, notification, () => ({\n input: getInput().input,\n output: result.output\n }));\n }\n } catch (error) {\n // Do not treat abort errors as errors\n if (isAbortError(error)) {\n return;\n }\n\n handleGenerationError(error, {\n cesdk,\n provider,\n getInput\n });\n } finally {\n abortController = undefined;\n generatingState.setValue(false);\n abortState.setValue(() => {});\n\n if (confirmCancelDialogId.value != null) {\n cesdk.ui.closeDialog(confirmCancelDialogId.value);\n confirmCancelDialogId.setValue(undefined);\n }\n }\n };\n\n await triggerGeneration();\n }\n });\n if (provider.output.generationHintText != null) {\n builder.Text(`${providerId}.generation-hint`, {\n align: 'center',\n content: provider.output.generationHintText\n });\n }\n }\n });\n\n if (includeHistoryLibrary && options.historyAssetLibraryEntryId != null) {\n builder.Library(`${providerId}.history.library`, {\n entries: [options.historyAssetLibraryEntryId]\n });\n }\n}\n\nfunction showSuccessNotification<I, O extends Output>(\n cesdk: CreativeEditorSDK,\n notifications: Provider<any, I, O>['output']['notification'],\n createContext: () => { input: I; output: O }\n): boolean {\n const successNotification = notifications?.success;\n if (successNotification == null) return false;\n\n const showOnSuccess =\n typeof successNotification.show === 'function'\n ? successNotification.show(createContext())\n : successNotification.show;\n\n if (!showOnSuccess) return false;\n\n const message =\n typeof successNotification.message === 'function'\n ? successNotification.message(createContext())\n : successNotification.message ?? 'common.ai-generation.success';\n\n const action =\n successNotification.action != null\n ? {\n label:\n typeof successNotification.action.label === 'function'\n ? successNotification.action.label(createContext())\n : successNotification.action.label,\n onClick: () => {\n successNotification?.action?.onClick(createContext());\n }\n }\n : undefined;\n\n cesdk.ui.showNotification({\n type: 'success',\n message,\n action,\n duration: successNotification.duration\n });\n return true;\n}\n\nexport default renderGenerationComponents;\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { OutputKind, PanelInputCustom, type Output } from '../../core/provider';\nimport renderGenerationComponents, {\n isGeneratingStateKey\n} from '../components/renderGenerationComponents';\nimport { InitializationContext } from '../../types';\nimport { Generate } from '../../generation/createGenerateFunction';\n\nasync function createPanelRenderFunctionFromCustom<\n K extends OutputKind,\n I,\n O extends Output\n>(\n {\n options,\n provider,\n panelInput,\n config\n }: InitializationContext<K, I, O, PanelInputCustom<K, I>>,\n\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n if (panelInput == null) {\n return undefined;\n }\n\n const { cesdk } = options;\n const { id: providerId } = provider;\n\n const render = panelInput.render;\n\n const builderRenderFunction: BuilderRenderFunction<any> = (context) => {\n const { state } = context;\n\n const isGenerating = state(isGeneratingStateKey(providerId), {\n isGenerating: false,\n abort: () => {}\n }).value.isGenerating;\n\n const { getInput, getBlockInput } = render(context, {\n cesdk,\n isGenerating\n });\n renderGenerationComponents(\n context,\n provider,\n generate,\n getInput,\n getBlockInput,\n {\n ...options,\n includeHistoryLibrary: panelInput.includeHistoryLibrary ?? true,\n createPlaceholderBlock: panelInput.userFlow === 'placeholder'\n },\n config\n );\n\n return getInput;\n };\n\n return builderRenderFunction;\n}\n\nexport default createPanelRenderFunctionFromCustom;\n", "import { type OpenAPIV3 } from 'openapi-types';\n\n/**\n * Resolves a JSON reference path within a document\n * @param document The OpenAPI document\n * @param refPath The reference path (e.g. \"#/components/schemas/MySchema\")\n * @returns The resolved object from the document\n */\nexport function resolveReference(\n document: OpenAPIV3.Document,\n refPath: string\n): unknown {\n // Only handle internal references\n if (!refPath.startsWith('#/')) {\n throw new Error(`External references are not supported: ${refPath}`);\n }\n\n // Remove the leading #/\n const path = refPath.substring(2).split('/');\n let current: any = document;\n\n // Navigate through the path\n for (const segment of path) {\n if (current === undefined || current === null) {\n throw new Error(`Invalid reference path: ${refPath}`);\n }\n current = current[segment];\n }\n\n if (current === undefined) {\n throw new Error(`Reference not found: ${refPath}`);\n }\n\n return current;\n}\n\n/**\n * Recursively dereferences all $ref properties in an object\n * @param document The original document for resolving references\n * @param obj The object to dereference\n * @param visited Set of visited objects to prevent circular references\n * @returns The dereferenced object\n */\nfunction dereferenceObject(\n document: OpenAPIV3.Document,\n obj: any,\n visited = new Set<any>()\n): any {\n // Handle null or undefined\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n // If we've seen this object before, return it to avoid circular references\n if (visited.has(obj)) {\n return obj;\n }\n\n // Add the current object to the visited set\n visited.add(obj);\n\n // Handle $ref\n if (obj.$ref && typeof obj.$ref === 'string') {\n // Get the referenced object\n const referenced = resolveReference(document, obj.$ref);\n // Dereference the referenced object\n const dereferenced = dereferenceObject(document, referenced, visited);\n\n // Merge other properties from the original object\n const result = { ...dereferenced };\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && key !== '$ref') {\n result[key] = dereferenceObject(document, obj[key], visited);\n }\n }\n return result;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => dereferenceObject(document, item, visited));\n }\n\n // Handle objects\n if (typeof obj === 'object') {\n const result: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = dereferenceObject(document, obj[key], visited);\n }\n }\n return result;\n }\n\n // Return primitives as is\n return obj;\n}\n\n/**\n * Dereferences all $ref properties in an OpenAPI document\n * @param document The OpenAPI document to dereference\n * @returns A new document with all references resolved\n */\nexport default function dereferenceDocument(\n document: OpenAPIV3.Document\n): OpenAPIV3.Document {\n return dereferenceObject(document, { ...document }) as OpenAPIV3.Document;\n}\n", "import { OpenAPIV3 } from 'openapi-types';\n\n/**\n * Checks if an unknown object is an OpenAPI schema (first level only)\n *\n * @param obj - The object to check (potentially undefined)\n * @param debug - If true, log the reason when validation fails\n * @returns A boolean indicating whether the object is an OpenAPI schema\n */\nexport function isOpenAPISchema(\n obj: unknown,\n debug: boolean = false\n): obj is OpenAPIV3.SchemaObject {\n // Helper function to log debug messages and return false\n const fail = (reason: string): false => {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(`OpenAPI Schema validation failed: ${reason}`);\n }\n return false;\n };\n\n // Check if obj is an object and not null\n if (typeof obj !== 'object' || obj === null) {\n return fail(\n `Input is ${obj === null ? 'null' : typeof obj}, not an object`\n );\n }\n\n const schema = obj as Record<string, any>;\n\n // Basic property validation - most schemas have at least one of these properties\n const hasSchemaTypeProperties =\n typeof schema.type === 'string' ||\n Array.isArray(schema.enum) ||\n typeof schema.properties === 'object' ||\n typeof schema.items === 'object' ||\n typeof schema.allOf === 'object' ||\n typeof schema.anyOf === 'object' ||\n typeof schema.oneOf === 'object' ||\n typeof schema.not === 'object';\n\n if (!hasSchemaTypeProperties) {\n return fail(\n 'Missing required schema-defining properties (type, enum, properties, items, allOf, anyOf, oneOf, not)'\n );\n }\n\n // If it has a type, validate it's one of the allowed OpenAPI schema types\n if (schema.type !== undefined) {\n const validTypes = [\n 'string',\n 'number',\n 'integer',\n 'boolean',\n 'array',\n 'object',\n 'null'\n ];\n\n // Type can be a string or an array of strings\n if (typeof schema.type === 'string') {\n if (!validTypes.includes(schema.type)) {\n return fail(\n `Invalid type: ${schema.type}. Must be one of ${validTypes.join(\n ', '\n )}`\n );\n }\n } else if (Array.isArray(schema.type)) {\n for (const type of schema.type) {\n if (typeof type !== 'string' || !validTypes.includes(type)) {\n return fail(\n `Array of types contains invalid value: ${type}. Must be one of ${validTypes.join(\n ', '\n )}`\n );\n }\n }\n } else {\n return fail(\n `Type must be a string or array of strings, got ${typeof schema.type}`\n );\n }\n }\n\n // If it has items (for array type), validate that items is an object (without recursion)\n if (schema.items !== undefined) {\n if (typeof schema.items !== 'object' || schema.items === null) {\n return fail(\n `Items must be an object, got ${\n schema.items === null ? 'null' : typeof schema.items\n }`\n );\n }\n }\n\n // If it has properties (for object type), validate that properties is an object (without recursion)\n if (schema.properties !== undefined) {\n if (typeof schema.properties !== 'object' || schema.properties === null) {\n return fail(\n `Properties must be an object, got ${\n schema.properties === null ? 'null' : typeof schema.properties\n }`\n );\n }\n }\n\n // Check if advanced schema constructs are valid (without recursion)\n const schemaArrays = ['allOf', 'anyOf', 'oneOf'];\n for (const arrayType of schemaArrays) {\n if (schema[arrayType] !== undefined) {\n if (!Array.isArray(schema[arrayType])) {\n return fail(\n `${arrayType} must be an array, got ${typeof schema[arrayType]}`\n );\n }\n\n // Just check that each item is an object (without recursion)\n for (let i = 0; i < schema[arrayType].length; i++) {\n const subSchema = schema[arrayType][i];\n if (typeof subSchema !== 'object' || subSchema === null) {\n return fail(\n `Item ${i} in ${arrayType} must be an object, got ${\n subSchema === null ? 'null' : typeof subSchema\n }`\n );\n }\n }\n }\n }\n\n // Check if 'not' is an object\n if (schema.not !== undefined) {\n if (typeof schema.not !== 'object' || schema.not === null) {\n return fail(\n `'not' must be an object, got ${\n schema.not === null ? 'null' : typeof schema.not\n }`\n );\n }\n }\n\n // If we have additionalProperties, make sure it's a boolean or an object\n if (schema.additionalProperties !== undefined) {\n if (\n typeof schema.additionalProperties !== 'boolean' &&\n (typeof schema.additionalProperties !== 'object' ||\n schema.additionalProperties === null)\n ) {\n return fail(\n `additionalProperties must be a boolean or an object, got ${\n schema.additionalProperties === null\n ? 'null'\n : typeof schema.additionalProperties\n }`\n );\n }\n }\n\n // Check basic format if present (for string type)\n if (schema.format !== undefined && typeof schema.format !== 'string') {\n return fail(`format must be a string, got ${typeof schema.format}`);\n }\n\n // Check number constraints\n const numberConstraints = [\n 'minimum',\n 'maximum',\n 'exclusiveMinimum',\n 'exclusiveMaximum',\n 'multipleOf'\n ];\n for (const constraint of numberConstraints) {\n if (\n schema[constraint] !== undefined &&\n typeof schema[constraint] !== 'number'\n ) {\n return fail(\n `${constraint} must be a number, got ${typeof schema[constraint]}`\n );\n }\n }\n\n // Check string constraints\n if (\n schema.minLength !== undefined &&\n (typeof schema.minLength !== 'number' || schema.minLength < 0)\n ) {\n return fail(\n `minLength must be a non-negative number, got ${\n typeof schema.minLength === 'number'\n ? schema.minLength\n : typeof schema.minLength\n }`\n );\n }\n if (\n schema.maxLength !== undefined &&\n (typeof schema.maxLength !== 'number' || schema.maxLength < 0)\n ) {\n return fail(\n `maxLength must be a non-negative number, got ${\n typeof schema.maxLength === 'number'\n ? schema.maxLength\n : typeof schema.maxLength\n }`\n );\n }\n if (schema.pattern !== undefined && typeof schema.pattern !== 'string') {\n return fail(`pattern must be a string, got ${typeof schema.pattern}`);\n }\n\n // Check array constraints\n if (\n schema.minItems !== undefined &&\n (typeof schema.minItems !== 'number' || schema.minItems < 0)\n ) {\n return fail(\n `minItems must be a non-negative number, got ${\n typeof schema.minItems === 'number'\n ? schema.minItems\n : typeof schema.minItems\n }`\n );\n }\n if (\n schema.maxItems !== undefined &&\n (typeof schema.maxItems !== 'number' || schema.maxItems < 0)\n ) {\n return fail(\n `maxItems must be a non-negative number, got ${\n typeof schema.maxItems === 'number'\n ? schema.maxItems\n : typeof schema.maxItems\n }`\n );\n }\n if (\n schema.uniqueItems !== undefined &&\n typeof schema.uniqueItems !== 'boolean'\n ) {\n return fail(\n `uniqueItems must be a boolean, got ${typeof schema.uniqueItems}`\n );\n }\n\n // Check object constraints\n if (\n schema.minProperties !== undefined &&\n (typeof schema.minProperties !== 'number' || schema.minProperties < 0)\n ) {\n return fail(\n `minProperties must be a non-negative number, got ${\n typeof schema.minProperties === 'number'\n ? schema.minProperties\n : typeof schema.minProperties\n }`\n );\n }\n if (\n schema.maxProperties !== undefined &&\n (typeof schema.maxProperties !== 'number' || schema.maxProperties < 0)\n ) {\n return fail(\n `maxProperties must be a non-negative number, got ${\n typeof schema.maxProperties === 'number'\n ? schema.maxProperties\n : typeof schema.maxProperties\n }`\n );\n }\n if (schema.required !== undefined) {\n if (!Array.isArray(schema.required)) {\n return fail(`required must be an array, got ${typeof schema.required}`);\n }\n for (let i = 0; i < schema.required.length; i++) {\n const prop = schema.required[i];\n if (typeof prop !== 'string') {\n return fail(\n `Item ${i} in required array must be a string, got ${typeof prop}`\n );\n }\n }\n }\n\n // It has passed all the first-level checks\n return true;\n}\n", "import { OpenAPIV3 } from 'openapi-types';\nimport { OutputKind, PanelInputSchema } from '../core/provider';\nimport { Property } from './types';\n\nfunction getProperties<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): Property[] {\n if (inputSchema.properties == null) {\n throw new Error('Input schema must have properties');\n }\n const propertiesFromSchema = inputSchema.properties;\n const properties: Property[] = [];\n\n const order = getOrder(inputSchema, panelInput);\n order.forEach((propertyKey) => {\n const id = propertyKey;\n const schema =\n (propertiesFromSchema[propertyKey] as OpenAPIV3.SchemaObject) ??\n undefined;\n properties.push({ id, schema });\n });\n\n return properties;\n}\n\nfunction getOrder<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): string[] {\n const panelInputOrder = panelInput.order;\n if (panelInputOrder != null && Array.isArray(panelInputOrder)) {\n return panelInputOrder;\n }\n\n if (inputSchema.properties == null) {\n throw new Error('Input schema must have properties');\n }\n const propertiesFromSchema = inputSchema.properties;\n const orderFromKeys = Object.keys(propertiesFromSchema);\n const orderFromExtensionKeyword = getOrderFromExtensionKeyword(\n inputSchema,\n panelInput\n );\n\n let order = orderFromExtensionKeyword ?? orderFromKeys;\n\n if (panelInputOrder != null && typeof panelInputOrder === 'function') {\n order = panelInputOrder(order);\n }\n\n // Return order with no duplicates\n return [...new Set(order)];\n}\n\n/**\n * Get the order from an extension keyword in the input schema (e.g. x-order) if it exists.\n */\nfunction getOrderFromExtensionKeyword<K extends OutputKind, I>(\n inputSchema: OpenAPIV3.SchemaObject,\n panelInput: PanelInputSchema<K, I>\n): string[] | undefined {\n if (panelInput.orderExtensionKeyword == null) {\n return undefined;\n }\n\n if (\n typeof panelInput.orderExtensionKeyword !== 'string' &&\n !Array.isArray(panelInput.orderExtensionKeyword)\n ) {\n throw new Error(\n 'orderExtensionKeyword must be a string or an array of strings'\n );\n }\n const orderExtensionKeywords =\n typeof panelInput.orderExtensionKeyword === 'string'\n ? [panelInput.orderExtensionKeyword]\n : panelInput.orderExtensionKeyword;\n\n const orderExtensionKeyword = orderExtensionKeywords.find(\n (extensionKeyword) => {\n return extensionKeyword in inputSchema;\n }\n );\n\n if (orderExtensionKeyword == null) {\n return undefined;\n }\n const order =\n // @ts-ignore\n inputSchema[orderExtensionKeyword] as string[];\n\n return order;\n}\n\nexport default getProperties;\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { BuilderRenderFunctionContext } from '@cesdk/cesdk-js';\nimport {\n EnumValue,\n ExtensionImglyBuilder,\n GetPropertyInput,\n Property,\n PropertyInput\n} from './types';\nimport Provider, {\n Output,\n OutputKind,\n PanelInputSchema\n} from '../core/provider';\nimport { UIOptions, CommonConfiguration } from '../types';\nimport { OpenAPIV3 } from 'openapi-types';\nimport getProperties from './getProperties';\nimport { getLabelFromId } from '../utils/utils';\nimport { buildPropertyContext } from '../utils/propertyContext';\nimport { resolvePropertyDefault } from '../utils/propertyResolver';\n\nfunction createInputLabelArray<K extends OutputKind, I, O extends Output>(\n property: Property,\n provider: Provider<K, I, O>,\n kind: K,\n valueId?: string\n): string[] {\n const baseKey = `property.${property.id}${valueId ? `.${valueId}` : ''}`;\n return [\n `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.${baseKey}`,\n `ly.img.plugin-ai-generation-web.${baseKey}`,\n `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.${baseKey}`,\n `ly.img.plugin-ai-generation-web.defaults.${baseKey}`\n ];\n}\n\nfunction extractEnumMetadata(schema: any): {\n labels: Record<string, string>;\n icons: Record<string, string>;\n} {\n const labels =\n 'x-imgly-enum-labels' in schema &&\n typeof schema['x-imgly-enum-labels'] === 'object'\n ? (schema['x-imgly-enum-labels'] as Record<string, string>)\n : {};\n\n const icons =\n 'x-imgly-enum-icons' in schema &&\n typeof schema['x-imgly-enum-icons'] === 'object'\n ? (schema['x-imgly-enum-icons'] as Record<string, string>)\n : {};\n\n return { labels, icons };\n}\n\nfunction renderProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Property,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput | undefined {\n if (property.schema == null) {\n if (\n panelInput.renderCustomProperty != null &&\n panelInput.renderCustomProperty[property.id] != null\n ) {\n // Extend context with provider configuration for custom properties\n const extendedContext = {\n ...context,\n providerConfig,\n config\n };\n return panelInput.renderCustomProperty[property.id](\n extendedContext,\n property\n );\n } else {\n return undefined;\n }\n }\n const propertyWithSchema: Required<Property> = property as Required<Property>;\n const type = property.schema.type;\n\n if (\n panelInput.renderCustomProperty != null &&\n panelInput.renderCustomProperty[property.id] != null\n ) {\n // Extend context with provider configuration for custom properties\n const extendedContext = {\n ...context,\n providerConfig,\n config\n };\n return panelInput.renderCustomProperty[property.id](\n extendedContext,\n property\n );\n }\n\n switch (type) {\n case 'string': {\n if (property.schema.enum != null) {\n return renderEnumProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n } else {\n return renderStringProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n }\n }\n\n case 'boolean': {\n return renderBooleanProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n }\n\n case 'number':\n case 'integer': {\n return renderIntegerProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n }\n\n case 'object': {\n return renderObjectProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n }\n\n case 'array': {\n // not supported yet\n break;\n }\n\n case undefined: {\n if (\n property.schema.anyOf != null &&\n Array.isArray(property.schema.anyOf)\n ) {\n return renderAnyOfProperty(\n context,\n propertyWithSchema,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n }\n break;\n }\n\n default: {\n // eslint-disable-next-line no-console\n console.error(`Unsupported property type: ${type}`);\n }\n }\n}\n\nfunction renderObjectProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput {\n const properties = getProperties(property.schema ?? {}, panelInput);\n\n const childInputs = properties.reduce((acc, childProperty) => {\n const getInput = renderProperty(\n context,\n childProperty,\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n if (getInput != null) {\n acc[childProperty.id] = getInput();\n }\n return acc;\n }, {} as Record<string, PropertyInput>);\n\n return () => ({\n id: property.id,\n type: 'object',\n value: childInputs\n });\n}\n\nfunction renderStringProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput {\n const {\n builder,\n experimental: { global },\n engine\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n // Resolve default value from property configuration\n const propertyContext = buildPropertyContext(engine, options.cesdk);\n const propertyConfig =\n providerConfig?.properties?.[propertyId] ??\n (config as any).properties?.[propertyId];\n const defaultValue = resolvePropertyDefault(\n propertyId,\n propertyConfig,\n propertyContext,\n property.schema.default,\n ''\n );\n\n const propertyState = global(id, defaultValue);\n\n const extension = getImglyExtensionBuilder(property.schema);\n const builderComponent =\n extension?.component != null && extension?.component === 'TextArea'\n ? 'TextArea'\n : 'TextInput';\n\n builder[builderComponent](id, {\n inputLabel,\n placeholder: options.i18n?.prompt,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'string',\n value: propertyState.value\n });\n}\n\nfunction renderEnumProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput {\n const {\n builder,\n experimental: { global },\n engine\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const { labels: enumLabels, icons } = extractEnumMetadata(property.schema);\n\n const values: EnumValue[] = (property.schema.enum ?? []).map((valueId) => ({\n id: valueId,\n label: createInputLabelArray(property, provider, kind, valueId),\n icon: icons[valueId]\n }));\n\n // Resolve default value from property configuration\n const propertyContext = buildPropertyContext(engine, options.cesdk);\n const propertyConfig =\n providerConfig?.properties?.[propertyId] ??\n (config as any).properties?.[propertyId];\n const resolvedDefault = resolvePropertyDefault(\n propertyId,\n propertyConfig,\n propertyContext,\n property.schema.default,\n values[0]?.id\n );\n\n const defaultValue =\n resolvedDefault != null\n ? values.find((v) => v.id === resolvedDefault) ?? values[0]\n : values[0];\n\n const propertyState = global<EnumValue>(id, defaultValue);\n\n builder.Select(id, {\n inputLabel,\n values,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'string',\n value: propertyState.value.id\n });\n}\n\nfunction renderBooleanProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput {\n const {\n builder,\n experimental: { global },\n engine\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n // Resolve default value from property configuration\n const propertyContext = buildPropertyContext(engine, options.cesdk);\n const propertyConfig =\n providerConfig?.properties?.[propertyId] ??\n (config as any).properties?.[propertyId];\n const defaultValue = !!resolvePropertyDefault(\n propertyId,\n propertyConfig,\n propertyContext,\n property.schema.default,\n false\n );\n const propertyState = global<boolean>(id, defaultValue);\n\n builder.Checkbox(id, {\n inputLabel,\n ...propertyState\n });\n\n return () => ({\n id: property.id,\n type: 'boolean',\n value: propertyState.value\n });\n}\n\nfunction renderIntegerProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput {\n const {\n builder,\n experimental: { global },\n engine\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const minValue = property.schema.minimum;\n const maxValue = property.schema.maximum;\n\n // Resolve default value from property configuration\n const propertyContext = buildPropertyContext(engine, options.cesdk);\n const propertyConfig =\n providerConfig?.properties?.[propertyId] ??\n (config as any).properties?.[propertyId];\n let schemaDefault = property.schema.default;\n if (schemaDefault == null) {\n if (minValue != null) {\n schemaDefault = minValue;\n } else if (maxValue != null) {\n schemaDefault = maxValue;\n } else {\n schemaDefault = 0;\n }\n }\n const defaultValue = resolvePropertyDefault(\n propertyId,\n propertyConfig,\n propertyContext,\n schemaDefault,\n schemaDefault\n );\n\n const propertyState = global<number>(id, defaultValue);\n\n if (minValue != null && maxValue != null) {\n let step = property.schema.type === 'number' ? 0.1 : 1;\n if (\n 'x-imgly-step' in property.schema &&\n typeof property.schema['x-imgly-step'] === 'number'\n ) {\n step = property.schema['x-imgly-step'];\n }\n\n builder.Slider(id, {\n inputLabel,\n min: minValue,\n max: maxValue,\n step,\n ...propertyState\n });\n } else {\n builder.NumberInput(id, {\n inputLabel,\n min: minValue,\n max: maxValue,\n ...propertyState\n });\n }\n\n return () => ({\n id: property.id,\n type: 'integer',\n value: propertyState.value\n });\n}\n\nfunction renderAnyOfProperty<K extends OutputKind, I, O extends Output>(\n context: BuilderRenderFunctionContext<any>,\n property: Required<Property>,\n provider: Provider<K, I, O>,\n panelInput: PanelInputSchema<K, I>,\n options: UIOptions,\n config: CommonConfiguration<I, O>,\n kind: K,\n providerConfig?: any\n): GetPropertyInput | undefined {\n const {\n builder,\n experimental: { global },\n engine\n } = context;\n const { id: propertyId } = property;\n\n const id = `${provider.id}.${propertyId}`;\n const inputLabel = createInputLabelArray(property, provider, kind);\n\n const anyOf = (property.schema.anyOf ?? []) as OpenAPIV3.SchemaObject[];\n const values: EnumValue[] = [];\n const conditionalRender: Record<string, () => GetPropertyInput> = {};\n const conditionalInputs: Record<string, () => PropertyInput> = {};\n const { labels, icons } = extractEnumMetadata(property.schema);\n\n // Resolve default value from property configuration\n const propertyContext = buildPropertyContext(engine, options.cesdk);\n const propertyConfig =\n providerConfig?.properties?.[propertyId] ??\n (config as any).properties?.[propertyId];\n\n const renderFunctionMap: Record<string, Function> = {\n string: renderStringProperty,\n boolean: renderBooleanProperty,\n integer: renderIntegerProperty,\n object: renderObjectProperty\n };\n\n const extractValueId = (anySchema: any, schemaId: string): string =>\n (anySchema as any).$ref\n ? (anySchema as any).$ref.split('/').pop()\n : schemaId.split('.').pop() ?? schemaId;\n\n const createEnumValue = (enumId: string, valueId: string): EnumValue => ({\n id: enumId,\n label: createInputLabelArray(property, provider, kind, valueId),\n icon: icons[valueId] ?? icons[enumId]\n });\n\n anyOf.forEach((anySchema, index) => {\n const schemaId = `${provider.id}.${propertyId}.anyOf[${index}]`;\n\n if ((anySchema as any).$ref || anySchema.title) {\n const refName = (anySchema as any).$ref\n ? (anySchema as any).$ref.split('/').pop()\n : anySchema.title;\n\n conditionalRender[schemaId] = () =>\n renderObjectProperty(\n context,\n {\n id: schemaId,\n schema: { ...anySchema, title: labels[refName] || refName }\n },\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n\n values.push(createEnumValue(schemaId, refName));\n } else if (anySchema.type === 'string' && anySchema.enum) {\n anySchema.enum.forEach((valueId) => {\n values.push(createEnumValue(valueId, valueId));\n });\n } else if (anySchema.type && renderFunctionMap[anySchema.type]) {\n const renderFunction = renderFunctionMap[anySchema.type];\n conditionalRender[schemaId] = () =>\n renderFunction(\n context,\n { id: schemaId, schema: { ...anySchema, title: anySchema.title } },\n provider,\n panelInput,\n options,\n config,\n kind,\n providerConfig\n );\n\n const valueId = extractValueId(anySchema, schemaId);\n values.push(\n anySchema.type === 'string' && !anySchema.enum\n ? {\n id: schemaId,\n label: anySchema.title || valueId,\n icon:\n (anySchema.title && icons[anySchema.title]) || icons[valueId]\n }\n : createEnumValue(schemaId, valueId)\n );\n }\n });\n\n // Resolve the default using property configuration\n const resolvedDefault = resolvePropertyDefault(\n propertyId,\n propertyConfig,\n propertyContext,\n property.schema.default,\n null\n );\n\n const defaultValue =\n resolvedDefault != null\n ? values.find((value) => value.id === resolvedDefault) ?? values[0]\n : values[0];\n\n const propertyState = global<EnumValue>(id, defaultValue);\n\n builder.Select(id, {\n inputLabel,\n values,\n ...propertyState\n });\n\n if (propertyState.value.id in conditionalRender) {\n const inputs = conditionalRender[propertyState.value.id]();\n conditionalInputs[propertyState.value.id] = inputs;\n }\n\n return () => {\n const conditionalInput = conditionalInputs[propertyState.value.id];\n\n if (conditionalInput != null) {\n return {\n ...conditionalInput(),\n id: property.id\n };\n }\n\n return {\n id: property.id,\n type: 'string',\n value: propertyState.value.id\n };\n };\n}\n\nfunction getImglyExtensionBuilder(\n schema: OpenAPIV3.SchemaObject\n): ExtensionImglyBuilder | undefined {\n if ('x-imgly-builder' in schema) {\n const extension = schema['x-imgly-builder'] as ExtensionImglyBuilder;\n return extension;\n }\n\n return undefined;\n}\n\nexport default renderProperty;\n", "/**\n * Default translations for AI generation properties and enum values.\n * These are automatically applied as fallback translations for all AI providers.\n *\n * Structure:\n * - Property translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}`\n * - Enum value translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}.${enumValue}`\n *\n * Based on actual OpenAPI Input schemas from all AI provider packages.\n */\nexport const defaultTranslations: Record<string, string> = {\n // Core generation properties (found in all Input schemas)\n 'ly.img.plugin-ai-generation-web.defaults.property.prompt': 'Prompt',\n 'ly.img.plugin-ai-generation-web.defaults.property.style': 'Style',\n\n // Common properties\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size': 'Image Size',\n 'ly.img.plugin-ai-generation-web.defaults.property.size': 'Image Size',\n 'ly.img.plugin-ai-generation-web.defaults.property.colors': 'Colors',\n 'ly.img.plugin-ai-generation-web.defaults.property.background': 'Background',\n\n // Common dimension properties\n 'ly.img.plugin-ai-generation-web.defaults.property.width': 'Width',\n 'ly.img.plugin-ai-generation-web.defaults.property.height': 'Height',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio':\n 'Aspect Ratio',\n\n // Common temporal properties\n 'ly.img.plugin-ai-generation-web.defaults.property.duration': 'Duration',\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution': 'Resolution',\n 'ly.img.plugin-ai-generation-web.defaults.property.generate_audio':\n 'Generate Audio',\n\n // Common audio properties\n 'ly.img.plugin-ai-generation-web.defaults.property.voice_id': 'Voice',\n 'ly.img.plugin-ai-generation-web.defaults.property.speed': 'Speed',\n 'ly.img.plugin-ai-generation-web.defaults.property.text': 'Text',\n 'ly.img.plugin-ai-generation-web.defaults.property.duration_seconds':\n 'Duration (seconds)',\n\n // Custom renderer translations for Recraft providers\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type': 'Type',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.image': 'Image',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.vector':\n 'Vector',\n 'ly.img.plugin-ai-generation-web.defaults.property.style.type.icon': 'Icon',\n\n // Enum value translations - common formats\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.square':\n 'Square',\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.portrait':\n 'Portrait',\n 'ly.img.plugin-ai-generation-web.defaults.property.image_size.landscape':\n 'Landscape',\n\n // Enum value translations - background\n 'ly.img.plugin-ai-generation-web.defaults.property.background.auto': 'Auto',\n 'ly.img.plugin-ai-generation-web.defaults.property.background.transparent':\n 'Transparent',\n\n // Enum value translations - common aspect ratios\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.1:1':\n '1:1 (Square)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.16:9':\n '16:9 (Widescreen)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.9:16':\n '9:16 (Vertical)',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.4:3': '4:3',\n 'ly.img.plugin-ai-generation-web.defaults.property.aspect_ratio.3:4': '3:4',\n\n // Enum value translations - common resolutions\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution.720p':\n '720p HD',\n 'ly.img.plugin-ai-generation-web.defaults.property.resolution.1080p':\n '1080p Full HD'\n};\n", "import { Property } from './types';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport { UIOptions } from '../types';\nimport { defaultTranslations } from './defaultTranslations';\n\nfunction formatEnumLabel(enumValue: string): string {\n return (\n enumValue\n // Replace underscores with spaces\n .replace(/_/g, ' ')\n // Handle specific cases first\n .replace(/\\b3d\\b/gi, '3D')\n .replace(/\\b2d\\b/gi, '2D')\n // Capitalize each word\n .replace(/\\b\\w/g, (char) => char.toUpperCase())\n );\n}\n\n/**\n * Extracts translations from OpenAPI schema properties and sets them via cesdk.i18n\n * This includes:\n * - Schema property titles as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}`\n * - Enum value labels as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}.${valueId}`\n * - AnyOf enum value labels with the same pattern\n */\nexport function extractAndSetSchemaTranslations<\n K extends OutputKind,\n I,\n O extends Output\n>(\n properties: Property[],\n provider: Provider<K, I, O>,\n options: UIOptions,\n kind: K\n): void {\n const translations: Record<string, string> = {};\n\n const createTranslationKey = (propertyId: string, valueId?: string): string =>\n `ly.img.plugin-ai-${kind}-generation-web.${\n provider.id\n }.defaults.property.${propertyId}${valueId ? `.${valueId}` : ''}`;\n\n const extractEnumLabels = (schema: any): Record<string, string> =>\n 'x-imgly-enum-labels' in schema &&\n typeof schema['x-imgly-enum-labels'] === 'object'\n ? (schema['x-imgly-enum-labels'] as Record<string, string>)\n : {};\n\n const addEnumTranslations = (\n enumValues: any[],\n propertyId: string,\n enumLabels: Record<string, string>\n ): void => {\n enumValues.forEach((enumValue) => {\n const valueId = String(enumValue);\n const labelValue = enumLabels[valueId] || formatEnumLabel(valueId);\n translations[createTranslationKey(propertyId, valueId)] = labelValue;\n });\n };\n\n properties.forEach((property) => {\n if (property.schema?.title) {\n translations[createTranslationKey(property.id)] = property.schema.title;\n }\n\n if (property.schema?.enum) {\n const enumLabels = extractEnumLabels(property.schema);\n addEnumTranslations(property.schema.enum, property.id, enumLabels);\n }\n\n if (property.schema?.anyOf && Array.isArray(property.schema.anyOf)) {\n const enumLabels = extractEnumLabels(property.schema);\n\n property.schema.anyOf.forEach((anySchema) => {\n const schema = anySchema as any;\n if (schema.enum && Array.isArray(schema.enum)) {\n addEnumTranslations(schema.enum, property.id, enumLabels);\n } else if (schema.$ref) {\n const refName = schema.$ref.split('/').pop();\n if (refName && enumLabels[refName]) {\n translations[createTranslationKey(property.id, refName)] =\n enumLabels[refName];\n }\n } else if (schema.title) {\n const refName = schema.title;\n const labelValue = enumLabels[refName] || formatEnumLabel(refName);\n translations[createTranslationKey(property.id, refName)] = labelValue;\n }\n });\n }\n });\n\n const allTranslations = { ...defaultTranslations, ...translations };\n\n if (Object.keys(allTranslations).length > 0) {\n options.cesdk.i18n.setTranslations({\n en: allTranslations\n });\n }\n}\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { OutputKind, PanelInputSchema, type Output } from '../../core/provider';\nimport renderGenerationComponents from '../components/renderGenerationComponents';\nimport { InitializationContext } from '../../types';\nimport dereferenceDocument, {\n resolveReference\n} from '../../openapi/dereferenceDocument';\nimport { isOpenAPISchema } from '../../openapi/isOpenAPISchema';\nimport { OpenAPIV3 } from 'openapi-types';\nimport getProperties from '../../openapi/getProperties';\nimport { GetPropertyInput, PropertyInput } from '../../openapi/types';\nimport renderProperty from '../../openapi/renderProperty';\nimport { Generate } from '../../generation/createGenerateFunction';\nimport { extractAndSetSchemaTranslations } from '../../openapi/extractSchemaTranslations';\n\n/**\n * Creates a panel render function based on the schema definition in the provider.\n */\nasync function createPanelRenderFunctionFromSchema<\n K extends OutputKind,\n I,\n O extends Output\n>(\n {\n options,\n provider,\n panelInput,\n config,\n providerConfig\n }: InitializationContext<K, I, O, PanelInputSchema<K, I>>,\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n const { id: providerId } = provider;\n\n if (panelInput == null) {\n return undefined;\n }\n\n if (config.debug) {\n // eslint-disable-next-line no-console\n console.log(\n `Registering schema-based panel input for provider ${providerId}`\n );\n }\n\n const schemaDocument = dereferenceDocument(panelInput.document);\n const resolvedInputReference = resolveReference(\n schemaDocument,\n panelInput.inputReference\n );\n\n if (!isOpenAPISchema(resolvedInputReference, config.debug)) {\n throw new Error(\n `Input reference '${panelInput.inputReference}' does not resolve to a valid OpenAPI schema`\n );\n }\n\n const inputSchema: OpenAPIV3.SchemaObject = resolvedInputReference;\n const properties = getProperties(inputSchema, panelInput);\n\n // Extract and set translations from schema\n extractAndSetSchemaTranslations(properties, provider, options, provider.kind);\n\n const builderRenderFunction: BuilderRenderFunction<any> = (context) => {\n const { builder } = context;\n\n const getInputs: GetPropertyInput[] = [];\n builder.Section(`${providerId}.schema.section`, {\n children: () => {\n properties.forEach((property) => {\n const getInput = renderProperty(\n context,\n property,\n provider,\n panelInput,\n options,\n config,\n provider.kind,\n providerConfig\n );\n if (getInput != null) {\n if (Array.isArray(getInput)) {\n getInputs.push(...getInput);\n } else {\n getInputs.push(getInput);\n }\n }\n });\n }\n });\n\n const inputs = getInputs.map((getInput) => {\n const input = getInput();\n return input;\n });\n\n const resolveInput = (input: PropertyInput) => {\n if (input.type === 'object') {\n return Object.entries(input.value).reduce((acc, [key, value]) => {\n acc[key] = resolveInput(value);\n\n return acc;\n }, {} as Record<string, any>);\n }\n\n return input.value;\n };\n const input = inputs.reduce((acc, propertyInput) => {\n acc[propertyInput.id] = resolveInput(propertyInput);\n return acc;\n }, {} as Record<string, any>) as I;\n\n renderGenerationComponents(\n context,\n provider,\n generate,\n () => {\n return { input };\n },\n () => {\n return panelInput.getBlockInput(input);\n },\n {\n ...options,\n requiredInputs: inputSchema.required,\n createPlaceholderBlock: panelInput.userFlow === 'placeholder'\n },\n config\n );\n };\n\n return builderRenderFunction;\n}\n\nexport default createPanelRenderFunctionFromSchema;\n", "import { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport {\n Output,\n OutputKind,\n PanelInputCustom,\n PanelInputSchema\n} from '../../core/provider';\nimport { InitializationContext } from '../../types';\nimport createPanelRenderFunctionFromCustom from './createPanelRenderFunctionFromCustom';\nimport createPanelRenderFunctionFromSchema from './createPanelRenderFunctionFromSchema';\nimport { Generate } from '../../generation/createGenerateFunction';\n\n/**\n * Creates a panel render function based on the provided context, i.e. on the provider.\n */\nasync function createPanelRenderFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(\n context: InitializationContext<K, I, O>,\n generate: Generate<I, O>\n): Promise<BuilderRenderFunction<any> | undefined> {\n if (context.panelInput == null) {\n return undefined;\n }\n\n switch (context.panelInput.type) {\n case 'custom': {\n return createPanelRenderFunctionFromCustom<K, I, O>(\n context as InitializationContext<K, I, O, PanelInputCustom<K, I>>,\n generate\n );\n }\n\n case 'schema': {\n return createPanelRenderFunctionFromSchema<K, I, O>(\n context as InitializationContext<K, I, O, PanelInputSchema<K, I>>,\n generate\n );\n }\n\n default: {\n if (context.config.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n // @ts-ignore\n `Invalid panel input type '${panelInput.type}' - skipping`\n );\n }\n }\n }\n}\n\nexport default createPanelRenderFunction;\n", "import { IndexedDBAssetSource } from '@imgly/plugin-utils';\nimport { OutputKind, Output } from '../core/provider';\nimport { InitializationContext } from '../types';\n\n/**\n * Initializes the history asset source for the given provider.\n */\nfunction initializeHistoryAssetSource<\n K extends OutputKind,\n I,\n O extends Output\n>(context: InitializationContext<K, I, O>): string | undefined {\n const {\n provider,\n options: { engine }\n } = context;\n\n const history = provider.output.history ?? '@imgly/local';\n if (history == null || history === false) return undefined;\n\n const currentAssetSourceIds = engine.asset.findAllSources();\n\n function getUniqueHistoryId(): string {\n let id = `${provider.id}.history`;\n while (currentAssetSourceIds.includes(id)) {\n id += `-${Math.random().toString(36).substring(2, 6)}`;\n }\n return id;\n }\n\n if (history === '@imgly/local') {\n const historyId = getUniqueHistoryId();\n engine.asset.addLocalSource(historyId);\n return historyId;\n }\n if (history === '@imgly/indexedDB') {\n const historyId = getUniqueHistoryId();\n engine.asset.addSource(new IndexedDBAssetSource(historyId, engine));\n return historyId;\n }\n\n return history;\n}\n\nexport default initializeHistoryAssetSource;\n", "import { OutputKind, Output } from '../core/provider';\nimport { InitializationContext } from '../types';\n\n/**\n * Initializes the history asset source for the given provider.\n */\nfunction initializeHistoryAssetLibraryEntry<\n K extends OutputKind,\n I,\n O extends Output\n>(\n context: InitializationContext<K, I, O>,\n historyAssetSourceId?: string\n): string | undefined {\n if (historyAssetSourceId == null || !historyAssetSourceId) return;\n\n const historyAssetLibraryEntryId = `${context.provider.id}.history`;\n\n context.options.cesdk.ui.addAssetLibraryEntry({\n id: historyAssetLibraryEntryId,\n sourceIds: [historyAssetSourceId],\n sortBy: {\n sortKey: 'insertedAt',\n sortingOrder: 'Descending'\n },\n canRemove: true,\n gridItemHeight: 'square',\n gridBackgroundType: 'cover'\n });\n\n return historyAssetLibraryEntryId;\n}\n\nexport default initializeHistoryAssetLibraryEntry;\n", "export const PLUGIN_ICON_SET_ID = '@imgly/plugin-ai-generation';\n\nexport const ICON_SPRITE = `\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\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/image\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/video\"\n >\n<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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"${PLUGIN_ICON_SET_ID}/audio\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n </symbol>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/MixingPlate\"\n >\n <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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n<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\"/>\n\n </symbol>\n</svg>\n`;\n\nexport default ICON_SPRITE;\n", "/* eslint-disable no-console */\nimport { getImageDimensionsFromURL, getImageUri } from '@imgly/plugin-utils';\nimport {\n type Output,\n type OutputKind,\n type GetBlockInputResult,\n VideoOutput,\n ImageOutput,\n TextOutput,\n AudioOutput,\n GenerationOptions,\n GenerationResult\n} from '../core/provider';\nimport { Middleware } from './middleware';\n\ninterface DryRunOptions<K extends OutputKind> {\n enable?: boolean;\n kind: K;\n\n // Is only defined with generation from a panel where we create a complete new block\n blockInputs?: GetBlockInputResult<K>;\n\n // Is only defined with quick action generation on a given block(s).\n blockIds?: number[];\n}\n\nfunction dryRunMiddleware<I, K extends OutputKind, O extends Output>(\n options: DryRunOptions<K>\n) {\n const middleware: Middleware<I, O> = async (\n generationInput,\n generationOptions,\n next\n ) => {\n if (!options.enable) {\n return next(generationInput, generationOptions);\n }\n console.log(\n `[DRY RUN]: Requesting dummy AI generation for kind '${options.kind}' with inputs: `,\n JSON.stringify(generationInput, undefined, 2)\n );\n await wait(2000);\n const output = await getDryRunOutput(\n generationInput,\n options,\n generationOptions\n );\n return output as O;\n };\n\n return middleware;\n}\n\nasync function getDryRunOutput<K extends OutputKind, I>(\n generationInput: I,\n options: DryRunOptions<K>,\n generationOptions: GenerationOptions\n): Promise<GenerationResult<Output>> {\n switch (options.kind) {\n case 'image': {\n return getImageDryRunOutput(\n generationInput,\n options as DryRunOptions<'image'>,\n generationOptions\n );\n }\n case 'video': {\n return getVideoDryRunOutput(\n generationInput,\n options as DryRunOptions<'video'>,\n generationOptions\n );\n }\n case 'text': {\n return getTextDryRunOutput(\n generationInput,\n options as DryRunOptions<'text'>,\n generationOptions\n );\n }\n case 'audio': {\n return getAudioDryRunOutput(\n generationInput,\n options as DryRunOptions<'audio'>,\n generationOptions\n );\n }\n\n default: {\n throw new Error(\n `Unsupported output kind for creating dry run output: ${options.kind}`\n );\n }\n }\n}\n\nasync function getImageDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'image'>,\n { engine }: GenerationOptions\n): Promise<ImageOutput> {\n let width;\n let height;\n\n const prompt: string =\n generationInput != null &&\n typeof generationInput === 'object' &&\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ? generationInput.prompt\n : 'AI Generated Image';\n\n // If prompt includes something that looks like a dimension\n // e.g. 512x512, 1024x768, etc. than we will use this as the\n // output image size for testing purposes.\n const promptDimension = prompt.match(/(\\d+)x(\\d+)/);\n if (promptDimension != null) {\n width = parseInt(promptDimension[1], 10);\n height = parseInt(promptDimension[2], 10);\n } else {\n if (options.blockInputs != null) {\n width = options.blockInputs.image.width;\n height = options.blockInputs.image.height;\n }\n if (\n options.blockIds != null &&\n Array.isArray(options.blockIds) &&\n options.blockIds.length > 0\n ) {\n const [blockId] = options.blockIds;\n const url = await getImageUri(blockId, engine);\n const dimension = await getImageDimensionsFromURL(url, engine);\n width = dimension.width;\n height = dimension.height;\n } else {\n width = 512;\n height = 512;\n }\n }\n\n const url = `https://placehold.co/${width}x${height}/000000/FFF?text=${prompt\n .replace(' ', '+')\n .replace('\\n', '+')}`;\n\n return {\n kind: 'image',\n url\n };\n}\n\nasync function getVideoDryRunOutput<I>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _generationInput: I,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: DryRunOptions<'video'>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _generationOptions: GenerationOptions\n): Promise<VideoOutput> {\n return Promise.resolve({\n kind: 'video',\n url: 'https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4'\n });\n}\n\nasync function getTextDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'text'>,\n generationOptions: GenerationOptions\n): Promise<AsyncGenerator<TextOutput>> {\n // Extract original text from the blocks or prompt\n let originalText = '';\n\n // Try to get original text from blocks first\n if (options.blockIds && options.blockIds.length > 0) {\n const [blockId] = options.blockIds;\n if (generationOptions.engine.block.isValid(blockId)) {\n originalText = generationOptions.engine.block.getString(\n blockId,\n 'text/text'\n );\n }\n }\n\n // If no original text from blocks, try to extract from prompt\n if (!originalText) {\n if (\n generationInput != null &&\n typeof generationInput === 'object' &&\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ) {\n // Try to extract original text from prompt patterns\n const promptStr = generationInput.prompt;\n const textMatch =\n promptStr.match(/text:\\s*\"([^\"]+)\"/i) ||\n promptStr.match(/content:\\s*\"([^\"]+)\"/i) ||\n promptStr.match(/\"([^\"]+)\"/);\n if (textMatch && textMatch[1]) {\n originalText = textMatch[1];\n }\n }\n }\n\n // Generate dummy text with similar length\n const targetLength = originalText.length || 50; // Default to 50 chars if no original text\n let dryRunText = '';\n\n // Analyze input for specific text generation types and create appropriate dummy text\n if (generationInput != null && typeof generationInput === 'object') {\n if (\n 'language' in generationInput &&\n typeof generationInput.language === 'string'\n ) {\n dryRunText = generateDummyText(targetLength, 'translation');\n } else if (\n 'type' in generationInput &&\n typeof generationInput.type === 'string'\n ) {\n const tone = generationInput.type;\n dryRunText = generateDummyText(targetLength, tone);\n } else if ('customPrompt' in generationInput) {\n dryRunText = generateDummyText(targetLength, 'custom');\n } else {\n dryRunText = generateDummyText(targetLength, 'improved');\n }\n } else {\n dryRunText = generateDummyText(targetLength, 'generated');\n }\n\n // Return an async generator that streams the text in chunks\n return createStreamingTextGenerator(\n dryRunText,\n generationOptions.abortSignal\n );\n}\n\nasync function* createStreamingTextGenerator(\n finalText: string,\n abortSignal?: AbortSignal\n): AsyncGenerator<TextOutput> {\n const chunkSize = Math.max(1, Math.ceil(finalText.length / 20)); // Split into ~20 chunks\n\n // Generate and yield text progressively\n let currentLength = 0;\n\n while (currentLength < finalText.length) {\n if (abortSignal?.aborted) {\n return;\n }\n\n // Calculate next chunk end\n const nextLength = Math.min(currentLength + chunkSize, finalText.length);\n const currentText = finalText.substring(0, nextLength);\n\n yield {\n kind: 'text',\n text: currentText\n };\n\n currentLength = nextLength;\n\n // Only add delay if there are more chunks to come\n if (currentLength < finalText.length) {\n // eslint-disable-next-line no-await-in-loop\n await wait(100);\n }\n }\n\n // Return the final complete text\n return {\n kind: 'text',\n text: finalText\n };\n}\n\nfunction generateDummyText(targetLength: number, style: string): string {\n const prefix = '[DRY RUN - Dummy Text] ';\n const prefixLength = prefix.length;\n\n // If target length is shorter than the prefix, just return truncated prefix\n if (targetLength <= prefixLength) {\n return prefix.substring(0, targetLength);\n }\n\n const remainingLength = targetLength - prefixLength;\n\n const baseTexts = {\n translation:\n 'Ceci est un texte fictif traduit qui maintient la longueur approximative.',\n professional:\n 'Enhanced professional content with improved clarity and structure.',\n casual: 'Relaxed, friendly text that keeps things simple and approachable.',\n formal: 'Refined formal documentation that preserves original structure.',\n humorous: 'Amusing content that brings lighthearted fun to the text.',\n improved: 'Enhanced text that demonstrates better clarity and readability.',\n custom: 'Customized content reflecting the requested modifications.',\n generated: 'AI-generated content maintaining original length and structure.'\n };\n\n const baseText =\n baseTexts[style as keyof typeof baseTexts] || baseTexts.generated;\n\n let contentText = '';\n if (remainingLength <= baseText.length) {\n contentText = baseText.substring(0, remainingLength);\n } else {\n // For longer text, repeat and vary the content\n contentText = baseText;\n const variations = [\n ' Additional content continues with similar phrasing.',\n ' Further elaboration maintains the established tone.',\n ' Extended content preserves the original style.',\n ' Continued text follows the same pattern.'\n ];\n\n let variationIndex = 0;\n while (contentText.length < remainingLength) {\n const nextVariation = variations[variationIndex % variations.length];\n if (contentText.length + nextVariation.length <= remainingLength) {\n contentText += nextVariation;\n } else {\n contentText += nextVariation.substring(\n 0,\n remainingLength - contentText.length\n );\n break;\n }\n variationIndex++;\n }\n }\n\n return prefix + contentText;\n}\n\nasync function getAudioDryRunOutput<I>(\n generationInput: I,\n options: DryRunOptions<'audio'>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n generationOptions: GenerationOptions\n): Promise<AudioOutput> {\n // Extract duration from generation input or use default\n let duration = 3; // Default to 3 seconds\n\n // Try to extract duration from input\n if (generationInput != null && typeof generationInput === 'object') {\n if (\n 'duration' in generationInput &&\n typeof generationInput.duration === 'number'\n ) {\n duration = generationInput.duration;\n } else if (\n 'prompt' in generationInput &&\n typeof generationInput.prompt === 'string'\n ) {\n // Try to extract duration from prompt (e.g., \"5 seconds\", \"10s\", etc.)\n const promptStr = generationInput.prompt;\n const durationMatch = promptStr.match(/(\\d+)\\s*(?:seconds?|secs?|s)\\b/i);\n if (durationMatch) {\n duration = parseInt(durationMatch[1], 10);\n }\n }\n }\n\n // Try to get duration from block inputs\n if (options.blockInputs?.audio?.duration) {\n duration = options.blockInputs.audio.duration;\n }\n\n // Generate tone audio data\n const audioUrl = generateTone(220, duration); // 220Hz tone (A3 - deeper, more pleasant)\n\n return {\n kind: 'audio',\n url: audioUrl,\n duration,\n thumbnailUrl: undefined\n };\n}\n\nfunction generateTone(frequency: number, duration: number): string {\n const sampleRate = 44100;\n const numSamples = Math.floor(sampleRate * duration);\n\n // Generate sine wave PCM data\n const pcmData = new Float32Array(numSamples);\n for (let i = 0; i < numSamples; i++) {\n pcmData[i] = Math.sin((2 * Math.PI * frequency * i) / sampleRate);\n }\n\n return createWAVDataURI(pcmData, sampleRate);\n}\n\nfunction createWAVDataURI(pcmData: Float32Array, sampleRate: number): string {\n const numSamples = pcmData.length;\n const bytesPerSample = 2; // 16-bit\n const numChannels = 1; // Mono\n const blockAlign = numChannels * bytesPerSample;\n const byteRate = sampleRate * blockAlign;\n const dataSize = numSamples * bytesPerSample;\n const fileSize = 44 + dataSize; // 44 bytes for WAV header\n\n // Create WAV file buffer\n const buffer = new ArrayBuffer(fileSize);\n const view = new DataView(buffer);\n\n // WAV header\n const writeString = (offset: number, str: string) => {\n for (let i = 0; i < str.length; i++) {\n view.setUint8(offset + i, str.charCodeAt(i));\n }\n };\n\n writeString(0, 'RIFF');\n view.setUint32(4, fileSize - 8, true);\n writeString(8, 'WAVE');\n writeString(12, 'fmt ');\n view.setUint32(16, 16, true); // PCM chunk size\n view.setUint16(20, 1, true); // PCM format\n view.setUint16(22, numChannels, true);\n view.setUint32(24, sampleRate, true);\n view.setUint32(28, byteRate, true);\n view.setUint16(32, blockAlign, true);\n view.setUint16(34, 16, true); // Bits per sample\n writeString(36, 'data');\n view.setUint32(40, dataSize, true);\n\n // Convert float32 PCM to int16 and write to buffer\n let offset = 44;\n for (let i = 0; i < numSamples; i++) {\n const sample = Math.max(-1, Math.min(1, pcmData[i]));\n const intSample = Math.round(sample * 32767);\n view.setInt16(offset, intSample, true);\n offset += 2;\n }\n\n // Convert to base64\n const uint8Array = new Uint8Array(buffer);\n let binaryString = '';\n for (let i = 0; i < uint8Array.length; i++) {\n binaryString += String.fromCharCode(uint8Array[i]);\n }\n const base64 = btoa(binaryString);\n\n return `data:audio/wav;base64,${base64}`;\n}\n\nasync function wait(ms: number) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport default dryRunMiddleware;\n", "export const ABORT_REASON_USER_CANCEL = 'USER_CANCEL';\n", "import Provider, { Output, OutputKind } from '../core/provider';\nimport { composeMiddlewares, Middleware } from '../middleware/middleware';\nimport loggingMiddleware from '../middleware/loggingMiddleware';\nimport dryRunMiddleware from '../middleware/dryRunMiddleware';\nimport CreativeEditorSDK, { CreativeEngine } from '@cesdk/cesdk-js';\nimport { isAbortError, isAsyncGenerator } from '../utils/utils';\nimport { ABORT_REASON_USER_CANCEL } from '../core/constants';\n\nexport type ResultSuccess<O> =\n | { status: 'success'; type: 'async'; output: AsyncGenerator<O> }\n | { status: 'success'; type: 'sync'; output: O };\n\nexport type Result<O> =\n | ResultSuccess<O>\n | { status: 'error'; message: string }\n | { status: 'aborted' };\n\nexport type Generate<I, O extends Output> = (\n input: I,\n options?: {\n abortSignal?: AbortSignal;\n middlewares?: Middleware<I, O>[];\n debug?: boolean;\n dryRun?: boolean;\n }\n) => Promise<Result<O>>;\n\nfunction createGenerateFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n provider: Provider<K, I, O>;\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n}): Generate<I, O> {\n return async (input: I, options) => {\n if (options?.abortSignal?.aborted) return { status: 'aborted' };\n\n const composedMiddlewares = composeMiddlewares<I, O>([\n ...(context.provider.output.middleware ?? []),\n ...(options?.middlewares ?? []),\n loggingMiddleware({ enable: options?.debug }),\n dryRunMiddleware({\n enable: options?.dryRun,\n kind: context.provider.kind\n })\n ]);\n\n // Trigger the generation\n try {\n const { result: output } = await composedMiddlewares(\n context.provider.output.generate\n )(input, {\n abortSignal: options?.abortSignal,\n engine: context.engine,\n cesdk: context.cesdk\n });\n if (options?.abortSignal?.aborted) return { status: 'aborted' };\n if (output instanceof Error)\n return { status: 'error', message: output.message };\n if (output == null)\n return { status: 'error', message: 'No output generated' };\n\n if (isAsyncGenerator(output)) {\n return { status: 'success', type: 'async', output };\n } else {\n return { status: 'success', type: 'sync', output };\n }\n } catch (error) {\n if (isAbortError(error)) {\n return { status: 'aborted', message: error.message };\n }\n if (error === ABORT_REASON_USER_CANCEL) {\n return { status: 'aborted', message: error };\n }\n return {\n status: 'error',\n message: error instanceof Error ? error.message : String(error)\n };\n }\n };\n}\n\nexport default createGenerateFunction;\n", "import CreativeEditorSDK, { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport createPanelRenderFunction from '../ui/panels/createPanelRenderFunction';\nimport {\n CommonPluginConfiguration,\n InternalPluginConfiguration,\n InitializationContext\n} from '../types';\nimport initializeHistoryAssetSource from '../assets/initializeHistoryAssetSource';\nimport initializeHistoryAssetLibraryEntry from '../assets/initializeHistoryAssetLibraryEntry';\nimport icons from '../ui/icons';\nimport createGenerateFunction, {\n type Generate\n} from '../generation/createGenerateFunction';\nimport { ProviderRegistry } from '../core/ProviderRegistry';\nimport { ActionRegistry } from '../core/ActionRegistry';\nimport { addIconSetOnce } from '../utils/utils';\n\nexport type ProviderInitializationResult<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n provider: Provider<K, I, O>;\n\n panel: {\n builderRenderFunction?: BuilderRenderFunction;\n };\n\n history: {\n assetSourceId?: string;\n assetLibraryEntryId?: string;\n };\n\n generate: Generate<I, O>;\n};\n\n/**\n * Initializes a provider with the given configuration and options.\n */\nasync function initializeProvider<K extends OutputKind, I, O extends Output>(\n _kind: K,\n provider: Provider<K, I, O>,\n options: {\n cesdk: CreativeEditorSDK;\n },\n config: CommonPluginConfiguration<K, I, O>\n): Promise<ProviderInitializationResult<K, I, O>> {\n // Create internal config with provider\n const internalConfig: InternalPluginConfiguration<K, I, O> = {\n ...config,\n provider\n };\n\n const context: InitializationContext<K, I, O> = {\n provider,\n panelInput: provider.input?.panel,\n options: {\n cesdk: options.cesdk,\n engine: options.cesdk.engine\n },\n config: internalConfig,\n providerConfig: provider.configuration\n };\n\n await provider.initialize?.({ ...options, engine: options.cesdk.engine });\n\n // Enable features for custom quick actions defined by this provider\n // Only enable features for quick actions that are not already known/registered by plugins\n if (provider.input?.quickActions?.supported) {\n const kind = provider.kind;\n const actionRegistry = ActionRegistry.get();\n\n Object.keys(provider.input.quickActions.supported).forEach(\n (quickActionId) => {\n // Check if this is a custom quick action (not already registered by a plugin)\n const existingAction = actionRegistry.getBy({\n id: quickActionId,\n type: 'quick'\n })[0];\n if (!existingAction) {\n // This is a custom quick action from the provider, enable its feature\n const featureId = `ly.img.plugin-ai-${kind}-generation-web.quickAction.${quickActionId}`;\n options.cesdk.feature.enable(featureId, true);\n }\n }\n );\n }\n\n const historyAssetSourceId = initializeHistoryAssetSource(context);\n const historyAssetLibraryEntryId = initializeHistoryAssetLibraryEntry(\n context,\n historyAssetSourceId\n );\n\n context.options.historyAssetSourceId = historyAssetSourceId;\n context.options.historyAssetLibraryEntryId = historyAssetLibraryEntryId;\n\n const generate = createGenerateFunction({\n provider,\n cesdk: options.cesdk,\n engine: options.cesdk.engine\n });\n\n const builderRenderFunction: BuilderRenderFunction | undefined =\n await createPanelRenderFunction(context, generate);\n\n addIconSetOnce(options.cesdk, '@imgly/plugin-ai-generation', icons);\n\n const providerInitializationResult: ProviderInitializationResult<K, I, O> = {\n provider,\n panel: {\n builderRenderFunction\n },\n history: {\n assetSourceId: historyAssetSourceId,\n assetLibraryEntryId: historyAssetLibraryEntryId\n },\n generate\n };\n\n ProviderRegistry.get().register(providerInitializationResult);\n\n return providerInitializationResult;\n}\n\nexport default initializeProvider;\n", "import { AggregatedAssetSource } from '@imgly/plugin-utils';\nimport { OutputKind } from '../core/provider';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * Initializes the combined history asset source for the given asset sources.\n */\nfunction initializeHistoryCompositeAssetSource<K extends OutputKind>(options: {\n kind: K;\n cesdk: CreativeEditorSDK;\n historAssetSourceIds: string[];\n}): string | undefined {\n const { kind, cesdk, historAssetSourceIds } = options;\n const compositeAssetSourceId = `ly.img.ai.${kind}-generation.history`;\n\n if (cesdk.engine.asset.findAllSources().includes(compositeAssetSourceId)) {\n return compositeAssetSourceId;\n }\n\n const aggregatedImageAssetSource = new AggregatedAssetSource(\n compositeAssetSourceId,\n cesdk,\n historAssetSourceIds\n );\n cesdk.engine.asset.addSource(aggregatedImageAssetSource);\n\n return aggregatedImageAssetSource.id;\n}\n\nexport default initializeHistoryCompositeAssetSource;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n BuilderRenderFunctionContext,\n SelectValue\n} from '@cesdk/cesdk-js';\nimport Provider, { Output, OutputKind } from '../core/provider';\nimport initializeProvider, {\n ProviderInitializationResult\n} from './initializeProvider';\nimport { isGeneratingStateKey } from '../ui/components/renderGenerationComponents';\nimport { CommonPluginConfiguration } from '../types';\nimport initializeHistoryCompositeAssetSource from '../assets/initializeHistoryCompositeAssetSource';\nimport { isDefined } from '@imgly/plugin-utils';\n\nfunction createLabelArray<K extends OutputKind>(\n kind: K,\n key: string\n): string[] {\n return [\n `ly.img.plugin-ai-${kind}-generation-web.${key}`,\n `ly.img.plugin-ai-generation-web.${key}`,\n `ly.img.plugin-ai-generation-web.defaults.${key}`\n ];\n}\n\nexport type ProvidersInitializationResult<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * Combined panel render function for all providers.\n */\n panel: {\n builderRenderFunction?: BuilderRenderFunction;\n };\n\n /**\n * Combined history asset source and library entry IDs for the providers.\n */\n history?: {\n assetSourceId?: string;\n assetLibraryEntryId?: string;\n };\n\n /**\n * All individual initialization results of the providers, i.e.\n * the result of `initializeProvider` for every provider.\n */\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n};\n\n/**\n * Initializes the given providers for the specified output kind.\n *\n * - It will create a combined render function for all providers\n * that can be used in a panel\n *\n */\nasync function initializeProviders<K extends OutputKind, I, O extends Output>(\n kind: K,\n providers:\n | {\n fromText: Provider<K, I, O>[];\n fromImage: Provider<K, I, O>[];\n }\n | Provider<K, I, O>[],\n options: {\n cesdk: CreativeEditorSDK;\n },\n config: CommonPluginConfiguration<K, I, O>\n): Promise<ProvidersInitializationResult<K, I, O>> {\n // Set default translations\n const { cesdk } = options;\n cesdk.setTranslations({\n en: {\n 'ly.img.plugin-ai-generation-web.defaults.fromType.label': 'Input',\n 'ly.img.plugin-ai-generation-web.defaults.providerSelect.label':\n 'Provider',\n 'ly.img.plugin-ai-generation-web.defaults.fromText.label': 'Text',\n 'ly.img.plugin-ai-generation-web.defaults.fromImage.label': 'Image'\n }\n });\n\n let builderRenderFunction: BuilderRenderFunction | undefined;\n\n const providerResults: ProviderInitializationResult<K, I, O>[] = [];\n if (!Array.isArray(providers)) {\n const initializedFromTextProviders = await Promise.all(\n providers.fromText.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...initializedFromTextProviders);\n\n const initializedFromImageProviders = await Promise.all(\n providers.fromImage.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...initializedFromImageProviders);\n\n builderRenderFunction = getBuilderRenderFunctionByFromType({\n kind,\n prefix: `ly.img.ai.${kind}-generation`,\n initializedFromTextProviders,\n initializedFromImageProviders,\n cesdk\n });\n } else {\n const results = await Promise.all(\n providers.map((provider) => {\n return initializeProvider(kind, provider, options, config);\n })\n );\n providerResults.push(...results);\n\n builderRenderFunction = getBuilderRenderFunctionByProvider({\n kind,\n prefix: kind,\n providerInitializationResults: providerResults,\n cesdk\n });\n }\n\n const compositeHistoryAssetSourceId = initializeHistoryCompositeAssetSource({\n kind,\n cesdk: options.cesdk,\n historAssetSourceIds: providerResults\n .map((result) => result.history?.assetSourceId)\n .filter(isDefined)\n });\n\n let compositeHistoryAssetLibraryEntryId: string | undefined;\n\n if (compositeHistoryAssetSourceId != null) {\n compositeHistoryAssetLibraryEntryId = compositeHistoryAssetSourceId;\n options.cesdk.ui.addAssetLibraryEntry({\n id: compositeHistoryAssetLibraryEntryId,\n sourceIds: [compositeHistoryAssetSourceId],\n sortBy: {\n sortKey: 'insertedAt',\n sortingOrder: 'Descending'\n },\n canRemove: true,\n gridItemHeight: 'square',\n gridBackgroundType: 'cover'\n });\n }\n\n return {\n panel: {\n builderRenderFunction\n },\n history: {\n assetSourceId: compositeHistoryAssetSourceId,\n assetLibraryEntryId: compositeHistoryAssetLibraryEntryId\n },\n providerInitializationResults: providerResults\n };\n}\n\n/**\n * Combines the render functions of the initialized providers into a single\n * render function that can be used in a panel. Will add select components\n * to switch between the different providers and input types.\n */\nfunction getBuilderRenderFunctionByFromType<\n K extends OutputKind,\n I,\n O extends Output\n>({\n kind,\n prefix,\n initializedFromTextProviders,\n initializedFromImageProviders,\n cesdk\n}: {\n kind: K;\n prefix: string;\n initializedFromTextProviders: ProviderInitializationResult<K, I, O>[];\n initializedFromImageProviders: ProviderInitializationResult<K, I, O>[];\n cesdk: CreativeEditorSDK;\n}): BuilderRenderFunction<{}> {\n const includeFromSwitch =\n initializedFromTextProviders.length > 0 &&\n initializedFromImageProviders.length > 0;\n\n const builderRenderFunction: BuilderRenderFunction = (context) => {\n const { builder, experimental, engine } = context;\n\n // Check if text and image input are enabled via Feature API\n const textInputFeatureId = `ly.img.plugin-ai-${kind}-generation-web.fromText`;\n const isTextInputEnabled = cesdk.feature.isEnabled(textInputFeatureId, {\n engine\n });\n const imageInputFeatureId = `ly.img.plugin-ai-${kind}-generation-web.fromImage`;\n const isImageInputEnabled = cesdk.feature.isEnabled(imageInputFeatureId, {\n engine\n });\n\n // Determine default input type based on what's enabled\n let defaultInputType: 'fromText' | 'fromImage' | undefined;\n if (\n isTextInputEnabled &&\n initializedFromTextProviders.length > 0 &&\n (!isImageInputEnabled || initializedFromImageProviders.length === 0)\n ) {\n defaultInputType = 'fromText';\n } else if (\n isImageInputEnabled &&\n initializedFromImageProviders.length > 0 &&\n (!isTextInputEnabled || initializedFromTextProviders.length === 0)\n ) {\n defaultInputType = 'fromImage';\n } else if (isTextInputEnabled && isImageInputEnabled && includeFromSwitch) {\n defaultInputType = 'fromText';\n }\n\n const inputTypeState = experimental.global<\n 'fromText' | 'fromImage' | undefined\n >(`${prefix}.fromType`, defaultInputType);\n\n const providerInitializationResults: ProviderInitializationResult<\n K,\n I,\n O\n >[] = [];\n if (inputTypeState.value === 'fromText') {\n providerInitializationResults.push(...initializedFromTextProviders);\n } else if (inputTypeState.value === 'fromImage') {\n providerInitializationResults.push(...initializedFromImageProviders);\n } else {\n providerInitializationResults.push(\n ...initializedFromTextProviders,\n ...initializedFromImageProviders\n );\n }\n\n const providerValuesFromText: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = initializedFromTextProviders.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerValuesFromImage: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = initializedFromImageProviders.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerStateFromText = context.experimental.global(\n `${prefix}.selectedProvider.fromText`,\n providerValuesFromText[0]\n );\n const providerStateFromImage = context.experimental.global(\n `${prefix}.selectedProvider.fromImage`,\n providerValuesFromImage[0]\n );\n\n const providerState =\n inputTypeState.value === 'fromText'\n ? providerStateFromText\n : inputTypeState.value === 'fromImage'\n ? providerStateFromImage\n : undefined;\n\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${kind}-generation-web.providerSelect`;\n const isProviderSelectorEnabled = cesdk.feature.isEnabled(\n providerFeatureId,\n { engine }\n );\n\n // Check if neither text nor image input is enabled\n if (!isTextInputEnabled && !isImageInputEnabled) {\n builder.Section(`${prefix}.noInputWarning.section`, {\n children: () => {\n builder.Text(`${prefix}.noInputWarning.text`, {\n content:\n 'No input types are enabled. Please enable at least one input type (text or image) via the Feature API.'\n });\n }\n });\n return; // Exit early, don't render anything else\n }\n\n // Determine if we need to show the input selector\n // Only show if both types are enabled AND both have providers\n const bothInputsEnabled =\n isTextInputEnabled &&\n isImageInputEnabled &&\n initializedFromTextProviders.length > 0 &&\n initializedFromImageProviders.length > 0;\n const shouldShowInputSelector = includeFromSwitch && bothInputsEnabled;\n const shouldShowProviderSelector =\n providerInitializationResults.length > 1 && isProviderSelectorEnabled;\n\n if (shouldShowInputSelector || shouldShowProviderSelector) {\n builder.Section(`${prefix}.providerSelection.section`, {\n children: () => {\n // RENDER FROM SELECTION - only if both input types are enabled\n if (shouldShowInputSelector) {\n builder.ButtonGroup(`${prefix}.fromType.buttonGroup`, {\n inputLabel: createLabelArray(kind, 'fromType.label'),\n children: () => {\n if (\n isTextInputEnabled &&\n initializedFromTextProviders.length > 0\n ) {\n builder.Button(`${prefix}.fromType.buttonGroup.fromText`, {\n label: createLabelArray(kind, 'fromText.label'),\n icon:\n inputTypeState.value !== 'fromText' &&\n isSomeProviderGenerating(\n initializedFromTextProviders,\n context\n )\n ? '@imgly/LoadingSpinner'\n : undefined,\n isActive: inputTypeState.value === 'fromText',\n onClick: () => {\n inputTypeState.setValue('fromText');\n }\n });\n }\n\n if (\n isImageInputEnabled &&\n initializedFromImageProviders.length > 0\n ) {\n builder.Button(`${prefix}.fromType.buttonGroup.fromImage`, {\n label: createLabelArray(kind, 'fromImage.label'),\n icon:\n inputTypeState.value !== 'fromImage' &&\n isSomeProviderGenerating(\n initializedFromImageProviders,\n context\n )\n ? '@imgly/LoadingSpinner'\n : undefined,\n isActive: inputTypeState.value === 'fromImage',\n onClick: () => {\n inputTypeState.setValue('fromImage');\n }\n });\n }\n }\n });\n }\n\n // RENDER PROVIDER SELECT\n if (shouldShowProviderSelector) {\n const providerValues =\n inputTypeState.value === 'fromText'\n ? providerValuesFromText\n : inputTypeState.value === 'fromImage'\n ? providerValuesFromImage\n : [...providerValuesFromText, ...providerValuesFromImage];\n\n if (providerState != null) {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: createLabelArray(kind, 'providerSelect.label'),\n values: providerValues,\n ...providerState\n });\n }\n }\n }\n });\n }\n\n // Render the provider content\n if (providerInitializationResults.length > 1) {\n providerState?.value.builderRenderFunction?.(context);\n } else {\n const providerInitializationResult = providerInitializationResults[0];\n if (providerInitializationResult) {\n providerInitializationResult.panel?.builderRenderFunction?.(context);\n }\n }\n };\n\n return builderRenderFunction;\n}\n\n/**\n * Combines the render functions of the initialized providers into a single\n * render function that can be used in a panel. Will add select components\n * to switch between the different providers and input types.\n */\nfunction getBuilderRenderFunctionByProvider<\n K extends OutputKind,\n I,\n O extends Output\n>({\n kind,\n prefix,\n providerInitializationResults,\n cesdk\n}: {\n kind: K;\n prefix: string;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n cesdk: CreativeEditorSDK;\n}): BuilderRenderFunction<{}> {\n const builderRenderFunction: BuilderRenderFunction = (context) => {\n const { builder, engine } = context;\n if (providerInitializationResults.length === 0) return;\n\n // Check if provider selector is enabled via Feature API\n // Audio plugin has special cases for speech and sound providers\n let providerFeatureId = `ly.img.plugin-ai-${kind}-generation-web.providerSelect`;\n // For audio, we check prefix to determine if it's speech or sound\n if (kind === 'audio' && prefix) {\n if (prefix.includes('speech')) {\n providerFeatureId = `ly.img.plugin-ai-audio-generation-web.speech.providerSelect`;\n } else if (prefix.includes('sound')) {\n providerFeatureId = `ly.img.plugin-ai-audio-generation-web.sound.providerSelect`;\n }\n }\n const isProviderSelectorEnabled = cesdk.feature.isEnabled(\n providerFeatureId,\n { engine }\n );\n\n const providerValues: (SelectValue & {\n builderRenderFunction?: BuilderRenderFunction;\n })[] = providerInitializationResults.map(({ provider, panel }) => ({\n id: provider.id,\n label: provider.name ?? provider.id,\n builderRenderFunction: panel?.builderRenderFunction\n }));\n\n const providerState = context.state(\n `${prefix}.selectedProvider`,\n providerValues[0]\n );\n\n if (providerInitializationResults.length > 1 && isProviderSelectorEnabled) {\n if (providerState != null) {\n builder.Section(`${prefix}.providerSelection.section`, {\n children: () => {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: createLabelArray(kind, 'providerSelect.label'),\n values: providerValues,\n ...providerState\n });\n }\n });\n }\n }\n\n // Render the provider content\n providerState.value.builderRenderFunction?.(context);\n };\n\n return builderRenderFunction;\n}\n\n/**\n * Queries the global state to check if any provider from the given\n * list is currently generating.\n */\nfunction isSomeProviderGenerating<K extends OutputKind, I, O extends Output>(\n providerInitializationResults: ProviderInitializationResult<K, I, O>[],\n context: BuilderRenderFunctionContext<any>\n): boolean {\n if (providerInitializationResults.length === 0) return false;\n return providerInitializationResults.some(({ provider }) => {\n if (provider.id == null) return false;\n return context.experimental.global(isGeneratingStateKey(provider.id), false)\n .value;\n });\n}\n\nexport default initializeProviders;\n", "export const AI_EDIT_MODE = 'ly.img.ai.editMode';\n\nexport const AI_METADATA_KEY = 'ly.img.ai.metadata';\n\nexport const AI_CONFIRMATION_COMPONENT_ID = 'ly.img.ai.confirmation.canvasMenu';\n\nexport function getFeatureIdForQuickAction(options: {\n quickActionId: string;\n quickActionMenuId: string;\n}) {\n return `ly.img.ai.quickAction.${options.quickActionMenuId}.${options.quickActionId}`;\n}\n", "import CreativeEditorSDK, { BuilderRenderFunction } from '@cesdk/cesdk-js';\nimport { InferenceMetadata } from '../quickActions/types';\nimport { Metadata } from '@imgly/plugin-utils';\nimport { AI_METADATA_KEY } from '../quickActions/utils';\nimport { OutputKind } from '../../core/provider';\nimport { Callbacks } from '../../generation/CallbacksRegistry';\n\n/**\n * Creates a render function for the AI inference confirmation component.\n *\n * It will render 'cancel', 'before', 'after', and 'apply' buttons once the\n * inference is done. Until then a loading spinner is shown with a cancel button.\n *\n * The callbacks are provided by the payload from the context.\n */\nasync function createConfirmationRenderFunction<K extends OutputKind>(context: {\n kind: K;\n\n cesdk: CreativeEditorSDK;\n}): Promise<BuilderRenderFunction<Callbacks>> {\n const prefix = `ly.img.ai.${context.kind}.confirmation`;\n context.cesdk?.i18n.setTranslations({\n en: {\n 'ly.img.ai.processing': 'Generating...',\n [`${prefix}.cancel`]: 'Cancel Generation',\n [`${prefix}.apply`]: 'Apply Generation',\n [`${prefix}.before`]: 'Before',\n [`${prefix}.after`]: 'After'\n }\n });\n const builderRenderFunction: BuilderRenderFunction<Callbacks> = (\n builderContext\n ) => {\n const { engine, builder, state, payload } = builderContext;\n if (payload == null) return;\n\n const blockIds = engine.block.findAllSelected();\n if (blockIds.length === 0) return null;\n\n const md = new Metadata<InferenceMetadata>(engine, AI_METADATA_KEY);\n\n // All blocks must have the same metadata\n const metadata = md.get(blockIds[0]);\n if (metadata == null) return null;\n\n const clearMetadata = () => {\n blockIds.forEach((blockId) => {\n md.clear(blockId);\n });\n };\n\n switch (metadata.status) {\n case 'processing': {\n builder.Button(`${prefix}.spinner`, {\n label: [\n `ly.img.ai.${metadata.quickActionId}.processing`,\n `ly.img.ai.processing`\n ],\n isLoading: true\n });\n builder.Separator(`${prefix}.separator`);\n builder.Button(`${prefix}.cancel`, {\n icon: '@imgly/Cross',\n tooltip: `${prefix}.cancel`,\n onClick: () => {\n payload.onCancelGeneration?.();\n clearMetadata();\n }\n });\n\n break;\n }\n\n case 'confirmation': {\n const comparingState = state<'before' | 'after'>(\n `${prefix}.comparing`,\n 'after'\n );\n\n const onCancel = payload.applyCallbacks?.onCancel;\n if (onCancel != null) {\n builder.Button(`${prefix}.cancel`, {\n icon: '@imgly/Cross',\n tooltip: `${prefix}.cancel`,\n onClick: () => {\n onCancel();\n clearMetadata();\n }\n });\n }\n\n const onBefore = payload.applyCallbacks?.onBefore;\n const onAfter = payload.applyCallbacks?.onAfter;\n\n if (onBefore != null && onAfter != null) {\n builder.ButtonGroup(`${prefix}.compare`, {\n children: () => {\n builder.Button(`${prefix}.compare.before`, {\n label: `${prefix}.before`,\n variant: 'regular',\n isActive: comparingState.value === 'before',\n onClick: () => {\n onBefore();\n comparingState.setValue('before');\n }\n });\n builder.Button(`${prefix}.compare.after`, {\n label: `${prefix}.after`,\n variant: 'regular',\n isActive: comparingState.value === 'after',\n onClick: () => {\n onAfter();\n comparingState.setValue('after');\n }\n });\n }\n });\n }\n\n const onApply = payload.applyCallbacks?.onApply;\n if (onApply != null) {\n builder.Button(`${prefix}.apply`, {\n icon: '@imgly/Checkmark',\n tooltip: `${prefix}.apply`,\n color: 'accent',\n isDisabled: comparingState.value !== 'after',\n onClick: () => {\n clearMetadata();\n\n const editor = context.cesdk.engine.editor as any;\n if (typeof editor._update === 'function') {\n // Activating the old history happens in the next update lop.\n editor._update();\n }\n\n onApply();\n }\n });\n }\n\n break;\n }\n\n default: {\n // noop\n }\n }\n };\n return Promise.resolve(builderRenderFunction);\n}\n\nexport default createConfirmationRenderFunction;\n", "/**\n * For the given array that contains strings `ly.img.separator` and other items,\n * this function will remove all leading and trailing separators,\n * as well as any consecutive separators in between.\n */\nfunction compactSeparators<T>(\n quickActions: (T | 'ly.img.separator')[]\n): (T | 'ly.img.separator')[] {\n if (quickActions.length === 0) {\n return [];\n }\n\n // Create a new array for the result\n const result = [...quickActions];\n\n // Remove separators at the beginning\n while (result.length > 0 && result[0] === 'ly.img.separator') {\n result.shift();\n }\n\n // Remove separators at the end\n while (\n result.length > 0 &&\n result[result.length - 1] === 'ly.img.separator'\n ) {\n result.pop();\n }\n\n // Remove consecutive separators\n return result.reduce<(T | 'ly.img.separator')[]>((acc, current) => {\n // Skip if current is a separator and previous was also a separator\n if (\n current === 'ly.img.separator' &&\n acc.length > 0 &&\n acc[acc.length - 1] === 'ly.img.separator'\n ) {\n return acc;\n }\n\n acc.push(current);\n return acc;\n }, []);\n}\n\nexport default compactSeparators;\n", "import { OutputKind } from '../core/provider';\n\nfunction getQuickActionCanvasMenuComponentId<K extends OutputKind>(\n kind: K\n): string {\n return `ly.img.ai.${kind}.canvasMenu`;\n}\n\nexport default getQuickActionCanvasMenuComponentId;\n", "import CreativeEditorSDK, { ComponentPayload } from '@cesdk/cesdk-js';\nimport getQuickActionCanvasMenuComponentId from '../../providers/getCanvasMenuComponentId';\nimport { OutputKind } from '../../core/provider';\n\n/**\n * Returns the current order of quick actions for a particular kind.\n */\nfunction getQuickActionOrder<K extends OutputKind>(context: {\n kind: K;\n cesdk: CreativeEditorSDK;\n payload?: ComponentPayload;\n defaultOrder?: string[];\n}): string[] {\n const { kind, cesdk, payload, defaultOrder } = context;\n const canvasMenuComponentId = getQuickActionCanvasMenuComponentId(kind);\n\n if (payload == null || !Array.isArray(payload.children)) {\n // Fallback to get the children order from the canvas menu order.\n // Happens e.g. for CE.SDK versions < 1.53.0 because the payload\n // is not passed correctly to the render function.\n const canvasMenuOrder = cesdk.ui.getCanvasMenuOrder();\n const component = canvasMenuOrder.find(({ id }) => {\n return id === canvasMenuComponentId;\n });\n\n if (component != null && Array.isArray(component.children)) {\n return component.children;\n } else {\n // Use provided default order or empty array for backwards compatibility\n return defaultOrder ?? [];\n }\n }\n return payload.children.filter(\n (child) => typeof child === 'string'\n ) as string[];\n}\n\nexport default getQuickActionOrder;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport {\n getImageDimensionsFromURL,\n mimeTypeToExtension\n} from '@imgly/plugin-utils';\nimport {\n ImageOutput,\n TextOutput,\n type Output,\n type OutputKind\n} from '../core/provider';\nimport { ResultSuccess } from '../generation/createGenerateFunction';\n\nexport type ApplyCallbacks = {\n onBefore: () => void;\n onAfter: () => void;\n onCancel: () => void;\n onApply: () => void;\n};\n\ntype GetApplyCallbacksOptions = {\n kind: OutputKind;\n blockIds: number[];\n cesdk: CreativeEditorSDK;\n abortSignal?: AbortSignal;\n};\n\ntype ReturnValue = {\n applyCallbacks: ApplyCallbacks;\n};\n\n/**\n * This method is used in the quick action menu to handle the result of the generation\n * and providing methods for the comparision of the result.\n *\n * Different output kinds require different handling. E.g. the text generation\n * is streamed to the text block, while the image generation is applied to the fill\n * block with a source set and the same crop applied.\n */\nfunction getApplyCallbacks<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n if (options.blockIds.some((id) => !options.cesdk.engine.block.isValid(id))) {\n return Promise.resolve({\n applyCallbacks: {\n onBefore: () => {},\n onAfter: () => {},\n onCancel: () => {},\n onApply: () => {}\n }\n });\n }\n switch (options.kind) {\n case 'text':\n return getApplyCallbacksForText(result, options);\n case 'image':\n return getApplyCallbacksForImage(result, options);\n case 'video':\n return getApplyCallbacksForVideo(result, options);\n case 'audio':\n return getApplyCallbacksForAudio(result, options);\n default:\n throw new Error(\n `Unsupported output kind for quick actions: ${options.kind}`\n );\n }\n}\n\nasync function getApplyCallbacksForText<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n const { cesdk, blockIds, abortSignal } = options;\n\n const beforeTexts = blockIds.map((blockId) => {\n return cesdk.engine.block.getString(blockId, 'text/text');\n });\n\n let output: O | undefined;\n if (result.type === 'async') {\n let inferredText = '';\n for await (const chunk of result.output) {\n if (abortSignal?.aborted) {\n break;\n }\n if (typeof chunk === 'string') {\n inferredText = chunk;\n } else if (chunk.kind === 'text') {\n inferredText = chunk.text;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-loop-func\n blockIds.forEach((blockId) => {\n cesdk.engine.block.setString(blockId, 'text/text', inferredText);\n });\n\n const textOutput: TextOutput = {\n kind: 'text',\n text: inferredText\n };\n output = textOutput as O;\n }\n } else {\n output = result.output;\n }\n\n if (output == null || output.kind !== 'text') {\n throw new Error('Output kind from generation is not text');\n }\n\n // For sync results, apply the text immediately (like streaming does)\n if (result.type === 'sync') {\n blockIds.forEach((blockId) => {\n cesdk.engine.block.setString(blockId, 'text/text', output.text);\n });\n }\n\n const onAfter = () => {\n options.blockIds.forEach((blockId) => {\n options.cesdk.engine.block.setString(blockId, 'text/text', output.text);\n });\n };\n const onBefore = () => {\n options.blockIds.forEach((blockId, i) => {\n options.cesdk.engine.block.setString(\n blockId,\n 'text/text',\n beforeTexts[i]\n );\n });\n };\n const onCancel = onBefore;\n const onApply = () => {\n onAfter();\n options.cesdk.engine.editor.addUndoStep();\n };\n\n return {\n applyCallbacks: {\n onBefore,\n onAfter,\n onCancel,\n onApply\n }\n };\n}\n\nasync function getApplyCallbacksForImage<O extends Output>(\n result: ResultSuccess<O>,\n options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n const { cesdk, blockIds, abortSignal } = options;\n if (blockIds.length !== 1) {\n throw new Error('Only one block is supported for image generation');\n }\n\n const [block] = blockIds;\n const fillBlock = cesdk.engine.block.getFill(block);\n const sourceSetBefore = cesdk.engine.block.getSourceSet(\n fillBlock,\n 'fill/image/sourceSet'\n );\n const [sourceBefore] = sourceSetBefore;\n let uriBefore: string | undefined;\n if (sourceBefore == null) {\n uriBefore = cesdk.engine.block.getString(\n fillBlock,\n 'fill/image/imageFileURI'\n );\n }\n\n const mimeType = await cesdk.engine.editor.getMimeType(\n sourceBefore?.uri ?? uriBefore\n );\n const originalDimension = await getImageDimensionsFromURL(\n sourceBefore?.uri ?? uriBefore,\n options.cesdk.engine\n );\n const originalAspectRatio =\n originalDimension.width / originalDimension.height;\n abortSignal?.throwIfAborted();\n\n if (mimeType === 'image/svg+xml') {\n throw new Error('SVG images are not supported');\n }\n\n const cropScaleX = cesdk.engine.block.getCropScaleX(block);\n const cropScaleY = cesdk.engine.block.getCropScaleY(block);\n const cropTranslationX = cesdk.engine.block.getCropTranslationX(block);\n const cropTranslationY = cesdk.engine.block.getCropTranslationY(block);\n const cropRotation = cesdk.engine.block.getCropRotation(block);\n\n const applyCrop = () => {\n cesdk.engine.block.setCropScaleX(block, cropScaleX);\n cesdk.engine.block.setCropScaleY(block, cropScaleY);\n cesdk.engine.block.setCropTranslationX(block, cropTranslationX);\n cesdk.engine.block.setCropTranslationY(block, cropTranslationY);\n cesdk.engine.block.setCropRotation(block, cropRotation);\n };\n\n if (result.type === 'async') {\n throw new Error('Streaming generation is not supported yet from a panel');\n }\n\n if (result.output.kind !== 'image' || typeof result.output.url !== 'string') {\n throw new Error('Output kind from generation is not an image');\n }\n\n const url = (result.output as ImageOutput).url;\n const generatedMimeType = await cesdk.engine.editor.getMimeType(url);\n\n const uri = await reuploadImage(cesdk, url, generatedMimeType);\n const generatedDimension = await getImageDimensionsFromURL(\n uri,\n options.cesdk.engine\n );\n const generatedAspectRatio =\n generatedDimension.width / generatedDimension.height;\n\n const differentAspectRatio =\n Math.abs(originalAspectRatio - generatedAspectRatio) > 0.001;\n\n const sourceSetAfter = sourceBefore\n ? [\n {\n uri,\n width: generatedDimension.width,\n height: generatedDimension.height\n }\n ]\n : undefined;\n const uriAfter = uri;\n\n if (sourceSetAfter == null) {\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriAfter\n );\n } else {\n cesdk.engine.block.setString(fillBlock, 'fill/image/imageFileURI', '');\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetAfter\n );\n }\n\n await cesdk.engine.block.forceLoadResources([fillBlock]);\n\n if (differentAspectRatio) {\n cesdk.engine.block.setContentFillMode(block, 'Cover');\n } else {\n applyCrop();\n }\n\n const onBefore = () => {\n if (sourceSetBefore == null || sourceSetBefore.length === 0) {\n if (uriBefore == null) {\n throw new Error('No image URI found');\n }\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriBefore\n );\n } else {\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetBefore\n );\n }\n applyCrop();\n };\n const onAfter = () => {\n if (sourceSetAfter == null) {\n if (uriAfter == null) {\n throw new Error('No image URI found');\n }\n cesdk.engine.block.setString(\n fillBlock,\n 'fill/image/imageFileURI',\n uriAfter\n );\n } else {\n cesdk.engine.block.setSourceSet(\n fillBlock,\n 'fill/image/sourceSet',\n sourceSetAfter\n );\n }\n if (differentAspectRatio) {\n cesdk.engine.block.setContentFillMode(block, 'Cover');\n } else {\n applyCrop();\n }\n };\n const onCancel = () => {\n onBefore();\n };\n const onApply = () => {\n onAfter();\n options.cesdk.engine.editor.addUndoStep();\n };\n\n return {\n applyCallbacks: {\n onBefore,\n onAfter,\n onCancel,\n onApply\n }\n };\n}\n\nasync function getApplyCallbacksForVideo<O extends Output>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _result: ResultSuccess<O>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n throw new Error('Function not implemented.');\n}\n\nasync function getApplyCallbacksForAudio<O extends Output>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _result: ResultSuccess<O>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _options: GetApplyCallbacksOptions\n): Promise<ReturnValue> {\n throw new Error('Function not implemented.');\n}\n\nasync function reuploadImage(\n cesdk: CreativeEditorSDK,\n url: string,\n mimeType: string\n): Promise<string> {\n const response = await fetch(url);\n const blob = await response.blob();\n const file = new File([blob], `image.${mimeTypeToExtension(mimeType)}`, {\n type: mimeType\n });\n const assetDefinition = await cesdk.unstable_upload(file, () => {});\n const uploadedUri = assetDefinition?.meta?.uri;\n if (uploadedUri != null) return uploadedUri;\n // eslint-disable-next-line no-console\n console.warn('Failed to upload image:', assetDefinition);\n return url;\n}\n\nexport default getApplyCallbacks;\n", "import { CreativeEngine } from '@cesdk/cesdk-js';\n\n/**\n * Locks the selection to the given block ids with the given edit mode.\n *\n * @returns A function to unlock the selection. Will set the edit mode back to what it was before the lock.\n */\nfunction lockSelectionToEditMode(options: {\n engine: CreativeEngine;\n blockIdsToLock: number[];\n editModeToLockTo: string;\n}) {\n const { engine, blockIdsToLock, editModeToLockTo } = options;\n\n function isBoundBlockSelected() {\n const currentlySelectedBlockIds = engine.block.findAllSelected();\n return blockIdsToLock.some((blockId) => {\n return currentlySelectedBlockIds.includes(blockId);\n });\n }\n\n const stateChangeDisposer = engine.editor.onStateChanged(() => {\n const editMode = engine.editor.getEditMode();\n if (editMode !== editModeToLockTo && isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n }\n });\n\n const selectionDisposer = engine.block.onSelectionChanged(() => {\n if (isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n } else {\n engine.editor.setEditMode('Transform');\n }\n });\n\n if (isBoundBlockSelected()) {\n engine.editor.setEditMode(editModeToLockTo);\n }\n\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n selectionDisposer();\n stateChangeDisposer();\n\n engine.editor.setEditMode('Transform');\n disposed = true;\n };\n\n return dispose;\n}\n\nexport default lockSelectionToEditMode;\n", "import { ApplyCallbacks } from '../providers/getApplyCallbacks';\n\nexport type Callbacks = {\n /**\n * Callbacks for the confirmation process.\n */\n applyCallbacks?: ApplyCallbacks;\n\n /**\n * Callback when generation is cancelled.\n */\n onCancelGeneration?: () => void;\n};\n\n/**\n * Global registry for managing callbacks for quick action menus across different\n * components.\n */\nexport class CallbacksRegistry {\n /** Map storing all registered callbacks by their ID */\n private actions: Map<number, Callbacks> = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * Gets the singleton instance of the CallbacksRegistry.\n * Uses global object storage to ensure singleton across different bundle contexts.\n */\n public static get(): CallbacksRegistry {\n const globalKey = '__imgly_callbacks_registry__';\n const globalObj = (\n typeof window !== 'undefined' ? window : globalThis\n ) as any;\n\n if (!globalObj[globalKey]) {\n globalObj[globalKey] = new CallbacksRegistry();\n }\n return globalObj[globalKey];\n }\n\n /**\n * Registers apply callbacks in the registry.\n */\n public register(blockId: number, callbacks: Partial<Callbacks>) {\n const currentCallbacks = this.actions.get(blockId) ?? {};\n this.actions.set(blockId, {\n ...currentCallbacks,\n ...callbacks\n });\n }\n\n /**\n * Gets the callbacks for the given block id.\n */\n public get(blockId: number): Callbacks {\n return this.actions.get(blockId) ?? {};\n }\n}\n\nexport default CallbacksRegistry;\n", "import { isDefined, Metadata } from '@imgly/plugin-utils';\nimport { QuickActionDefinition } from '../core/ActionRegistry';\nimport { Result } from './createGenerateFunction';\nimport { ProviderInitializationResult } from '../providers/initializeProvider';\nimport { Middleware } from '../middleware/middleware';\nimport { Output, OutputKind } from '../core/provider';\nimport { AI_EDIT_MODE, AI_METADATA_KEY } from '../ui/quickActions/utils';\nimport { InferenceMetadata } from '../ui/quickActions/types';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\nimport getApplyCallbacks from '../providers/getApplyCallbacks';\nimport lockSelectionToEditMode from '../utils/lockSelectionToEditMode';\nimport CallbacksRegistry from './CallbacksRegistry';\nimport { ABORT_REASON_USER_CANCEL } from '../core/constants';\n\ntype GenerationOptions<\n Q extends Record<string, any>,\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * The blocks that this quick action is running on.\n */\n blockIds: number[];\n\n /**\n * The initlaized provider that is used to generate the output.\n */\n providerInitializationResult?: ProviderInitializationResult<K, I, O>;\n\n /**\n * The quick action definition that is used to generate input for the provider\n */\n quickAction: QuickActionDefinition<Q>;\n\n /**\n * Shall the generation be confirmed before applying the result? Or directly applied?\n */\n confirmation?: boolean;\n\n /**\n * Should the blocks be locked to edit mode while the generation is running?\n */\n lock?: boolean;\n\n /**\n * Additional middlewares added to the generation process.\n */\n middlewares?: Middleware<I, O>[];\n\n /**\n * Print debug information to the console.\n */\n debug?: boolean;\n\n /**\n * Enable dry run mode for testing.\n */\n dryRun?: boolean;\n\n /**\n * Signal to check if process was aborted\n */\n abortSignal?: AbortSignal;\n\n /**\n * Close the quick action menu\n */\n close: () => void;\n\n cesdk: CreativeEditorSDK;\n};\n\n/**\n * Handler for generating output from a quick action.\n */\nfunction handleGenerateFromQuickAction<\n Q extends Record<string, any>,\n K extends OutputKind,\n I,\n O extends Output\n>(\n options: GenerationOptions<Q, K, I, O>\n): (input: Q, generateOptions?: { blockIds?: number[] }) => Promise<Result<O>> {\n return async (input: Q, generateOptions?: { blockIds?: number[] }) => {\n // Use provided blockIds or fall back to default selection\n const targetBlockIds = generateOptions?.blockIds ?? options.blockIds;\n if (options.providerInitializationResult == null) {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Generate] No provider initialization result found for quick action. Returning abortion status.'\n );\n }\n return { status: 'aborted' };\n }\n\n const supportValue =\n options.providerInitializationResult?.provider.input?.quickActions\n ?.supported?.[options.quickAction.id];\n\n if (supportValue == null) {\n throw new Error(\n '[Generate] Quick action input mapping failed. Ensure the provider supports this quick action.'\n );\n }\n\n // Handle both `true` and `{ mapInput: ... }` cases\n const mapInput =\n typeof supportValue === 'object' &&\n supportValue !== null &&\n 'mapInput' in supportValue\n ? supportValue.mapInput\n : (i: Q) => i as unknown as I; // Identity function when types are compatible\n\n options.close();\n\n const abortController = new AbortController();\n const abortSignal = AbortSignal.any(\n [options.abortSignal, abortController.signal].filter(isDefined)\n );\n\n const metadata = new Metadata<InferenceMetadata>(\n options.cesdk.engine,\n AI_METADATA_KEY\n );\n\n const unlockFromEditMode =\n options.lock ?? true\n ? lockSelectionToEditMode({\n engine: options.cesdk.engine,\n editModeToLockTo: AI_EDIT_MODE,\n blockIdsToLock: targetBlockIds\n })\n : () => {\n /* No-op if not locking to edit mode */\n };\n targetBlockIds.forEach((blockId) => {\n CallbacksRegistry.get().register(blockId, {\n onCancelGeneration: () => {\n abortController.abort(ABORT_REASON_USER_CANCEL);\n unlockFromEditMode();\n\n if (options.cesdk.engine.block.isValid(blockId)) {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n metadata.clear(blockId);\n }\n }\n });\n });\n\n targetBlockIds?.forEach((blockId) => {\n metadata.set(blockId, {\n status: 'processing',\n quickActionId: options.quickAction.id\n });\n });\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, {\n type: 'Pending',\n progress: 0\n });\n });\n\n try {\n const result = await options.providerInitializationResult.generate(\n mapInput(input),\n {\n middlewares: [...(options.middlewares ?? [])],\n debug: options.debug,\n dryRun: options.dryRun,\n abortSignal\n }\n );\n\n const resultStatus = result.status;\n switch (resultStatus) {\n case 'success': {\n const { applyCallbacks: initialApplyCallbacks } =\n await getApplyCallbacks(result, {\n kind: options.providerInitializationResult.provider.kind,\n blockIds: targetBlockIds,\n cesdk: options.cesdk,\n abortSignal\n });\n\n // Set the blocks to a ready state AFTER `getApplyCallbacks` was called since\n // it will set the block to the \"after\" image and until then we still want\n // the spinner spinning.\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n });\n\n if (options.confirmation) {\n // For the same as the Ready state, we do this AFTER `getApplyCallbacks` was called\n targetBlockIds.forEach((blockId) => {\n // Metadata will be cleared in the confirmation component\n // see createConfirmationRenderFunction.ts\n metadata.set(blockId, {\n status: 'confirmation',\n quickActionId: options.quickAction.id\n });\n });\n\n const applyCallbacks = {\n ...initialApplyCallbacks,\n onApply: async () => {\n initialApplyCallbacks.onApply();\n unlockFromEditMode();\n },\n onCancel: () => {\n initialApplyCallbacks.onCancel();\n unlockFromEditMode();\n }\n };\n\n targetBlockIds.forEach((blockId) => {\n CallbacksRegistry.get().register(blockId, { applyCallbacks });\n });\n } else {\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n // Apply the result directly\n initialApplyCallbacks.onApply();\n unlockFromEditMode();\n }\n\n return result;\n }\n\n case 'aborted': {\n if (options.debug) {\n // eslint-disable-next-line no-console\n console.log('Generation was aborted');\n }\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n return result;\n }\n\n case 'error': {\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n // eslint-disable-next-line no-console\n console.error(`[Generate]: ${result.message}`);\n return result;\n }\n\n default: {\n throw new Error(`[Generate] Unknown result status ${resultStatus}.`);\n }\n }\n } catch (error) {\n options.cesdk.ui.showNotification({\n type: 'error',\n message: 'A technical issue has occurred.'\n });\n\n unlockFromEditMode();\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId)) {\n metadata.clear(blockId);\n }\n });\n throw error;\n } finally {\n targetBlockIds.forEach((blockId) => {\n if (options.cesdk.engine.block.isValid(blockId))\n options.cesdk.engine.block.setState(blockId, { type: 'Ready' });\n });\n }\n };\n}\n\nexport default handleGenerateFromQuickAction;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n CreativeEngine,\n SelectValue\n} from '@cesdk/cesdk-js';\nimport {\n ActionRegistry,\n QuickActionDefinition\n} from '../../core/ActionRegistry';\nimport { Output, OutputKind } from '../../core/provider';\nimport { isDefined } from '@imgly/plugin-utils';\nimport { AI_EDIT_MODE } from './utils';\nimport compactSeparators from '../../utils/compactSeparators';\nimport getQuickActionOrder from './getQuickActionOrder';\nimport { ProviderInitializationResult } from '../../providers/initializeProvider';\nimport handleGenerateFromQuickAction from '../../generation/handleGenerateFromQuickAction';\nimport { Middleware } from '../../middleware/middleware';\nimport { ProviderRegistry } from '../../core/ProviderRegistry';\n\ntype SupportedQuickAction<K extends OutputKind, I, O extends Output> = {\n definition: QuickActionDefinition<any>;\n /**\n * If defined this provider is used to render the quick action.\n * Otherwise the quick action is rendered with the main provider\n * defined one level up.\n *\n * Used for quick actions that have been defined from a provider\n * that is not the main kind/provider, e.g. a video plugin\n * that defines a quick action for the image provider.\n */\n providerInitializationResult?: ProviderInitializationResult<K, I, O>;\n};\n\ntype SupportedProviderQuickActions<\n K extends OutputKind,\n I,\n O extends Output\n> = {\n /**\n * The main provider from the provider selection\n */\n providerInitializationResult: ProviderInitializationResult<K, I, O>;\n quickActions: (SupportedQuickAction<K, I, O> | 'ly.img.separator')[];\n}[];\n\nfunction createQuickActionMenuRenderFunction<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n kind: K;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n\n debug?: boolean;\n dryRun?: boolean;\n defaultOrder?: string[];\n}): Promise<BuilderRenderFunction<any>> {\n const prefix = `ly.img.ai.${context.kind}}`;\n\n context.cesdk.i18n.setTranslations({\n en: {\n [`ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`]:\n 'Provider'\n }\n });\n\n const builderRenderFunction: BuilderRenderFunction<{\n children: ('ly.img.separator' | (string & {}))[];\n }> = (builderContext) => {\n if (builderContext.engine.editor.getEditMode() === AI_EDIT_MODE) {\n return;\n }\n\n const blockIds = builderContext.engine.block.findAllSelected();\n if (blockIds.length === 0) return;\n\n // Check if the general quickAction feature is enabled\n const quickActionFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction`;\n const isQuickActionFeatureEnabled = context.cesdk.feature.isEnabled(\n quickActionFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (!isQuickActionFeatureEnabled) {\n // Quick actions are disabled for this plugin\n return;\n }\n\n const { payload } = builderContext;\n const order =\n getQuickActionOrder({\n kind: context.kind,\n cesdk: context.cesdk,\n payload,\n defaultOrder: context.defaultOrder\n }) ?? [];\n\n if (order.length === 0) return;\n\n // Get ordered and filtered list of defined quick actions\n const orderedQuickActions = getOrderedQuickActionDefinitions(order).filter(\n (quickActionDefinition) => {\n if (quickActionDefinition === 'ly.img.separator') return true;\n\n // Check if this individual quick action is enabled via Feature API\n // Remove the 'ly.img.' prefix from the action ID for the feature key\n const actionName = quickActionDefinition.id.replace('ly.img.', '');\n const individualQuickActionFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.${actionName}`;\n const isIndividualQuickActionEnabled = context.cesdk.feature.isEnabled(\n individualQuickActionFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (!isIndividualQuickActionEnabled) {\n return false;\n }\n\n const scopes = quickActionDefinition.scopes;\n if (scopes != null && scopes.length > 0) {\n const isAllowedByScopes = blockIds.every((blockId) => {\n return scopes.every((scope) => {\n return context.engine.block.isAllowedByScope(blockId, scope);\n });\n });\n if (!isAllowedByScopes) return false;\n }\n\n if (quickActionDefinition.enable != null) {\n if (typeof quickActionDefinition.enable === 'function') {\n return quickActionDefinition.enable({\n engine: context.engine\n });\n } else if (typeof quickActionDefinition.enable === 'boolean') {\n return quickActionDefinition.enable;\n }\n }\n\n return true;\n }\n );\n\n // Collect quick actions that are defined by the main provider\n // in case the main provider does not support any quick actions\n // and we just want to render these.\n const quickActionsFromOtherProviders: SupportedQuickAction<K, I, O>[] = [];\n\n // Collect all provider with their supported quick actions\n const supportedProviderQuickActions =\n context.providerInitializationResults.reduce(\n (\n acc: SupportedProviderQuickActions<K, I, O>,\n providerInitializationResult\n ) => {\n if (providerInitializationResult.provider.kind !== context.kind)\n return acc;\n\n let quickActions = orderedQuickActions\n .map((quickAction) => {\n if (quickAction === 'ly.img.separator') return quickAction;\n\n // Check if the main provider supports this quick action\n if (\n providerInitializationResult.provider.input?.quickActions\n ?.supported?.[quickAction.id] != null\n ) {\n return {\n definition: quickAction\n };\n } else {\n // Check if this quick action comes from another provider that\n // is not the main provider.\n const otherProviderInitializationResult = ProviderRegistry.get()\n .getAll()\n .filter((registeredProvider) => {\n return (\n // We are looking for provider from another kind\n // and assume that all provider from the same kind\n // have been passed as main provider\n registeredProvider.provider.kind !== context.kind &&\n registeredProvider.provider.id !==\n providerInitializationResult.provider.id\n );\n })\n .find((registeredProvider) => {\n return (\n registeredProvider.provider.input?.quickActions\n ?.supported?.[quickAction.id] != null\n );\n });\n if (otherProviderInitializationResult != null) {\n const quickActionSupport: SupportedQuickAction<K, I, O> = {\n definition: quickAction,\n providerInitializationResult:\n otherProviderInitializationResult\n };\n quickActionsFromOtherProviders.push(quickActionSupport);\n return quickActionSupport;\n } else {\n return undefined;\n }\n }\n })\n .filter(isDefined);\n // Clean up the quick action list so we can render it directly\n quickActions = compactSeparators(quickActions);\n\n if (\n quickActions.length === 0 ||\n quickActions.every((entry) => entry === 'ly.img.separator')\n )\n return acc;\n\n if (\n quickActions.every(\n (quickAction) =>\n quickAction === 'ly.img.separator' ||\n quickAction.providerInitializationResult != null\n )\n ) {\n // This provider has no quick actions from the current main provider.\n // We do not want to add the main provider to the selection\n // list with just actions from other providers.\n return acc;\n }\n\n acc.push({\n providerInitializationResult,\n quickActions\n });\n\n return acc;\n },\n []\n );\n\n if (supportedProviderQuickActions.length === 0) {\n if (quickActionsFromOtherProviders.length > 0) {\n // Remove duplicates from quickActionsFromOtherProviders\n const seen = new Map<string, SupportedQuickAction<K, I, O>>();\n quickActionsFromOtherProviders.forEach((quickAction) => {\n const id = quickAction.definition.id;\n if (!seen.has(id)) {\n seen.set(id, quickAction);\n }\n });\n const uniqueQuickActions = Array.from(seen.values());\n\n // If we have quick actions from other providers, we can render them\n supportedProviderQuickActions.push({\n // Use the first provider as main but since we do not want to\n // render the provider selection, we do not care what provider it is.\n // The actual provider used is the one defined in the object.\n providerInitializationResult:\n uniqueQuickActions[0].providerInitializationResult ??\n context.providerInitializationResults[0],\n quickActions: uniqueQuickActions\n });\n } else {\n // Noting to do\n return;\n }\n }\n\n const providerValues: SelectValue[] = supportedProviderQuickActions.map(\n ({ providerInitializationResult }) => ({\n id: providerInitializationResult.provider.id,\n label:\n providerInitializationResult.provider.name ??\n providerInitializationResult.provider.id\n })\n );\n\n const currentProviderState = builderContext.experimental.global(\n `${prefix}.currentProvider`,\n providerValues[0]\n );\n const currentSupportedQuickActions = supportedProviderQuickActions.find(\n ({\n providerInitializationResult: {\n provider: { id }\n }\n }) => id === currentProviderState.value?.id\n );\n\n const isEveryBlockInReadyState = blockIds.every((blockId) => {\n return builderContext.engine.block.getState(blockId).type === 'Ready';\n });\n\n const { builder, experimental, state } = builderContext;\n\n const isGeneratingState = state<boolean>(`${prefix}.isGenerating`, false);\n const toggleExpandedState = state<string | undefined>(\n `${prefix}.toggleExpandedState`,\n undefined\n );\n\n // Middleware to track generation status\n const isGeneratingMiddleware: Middleware<I, O> = async (\n input,\n options,\n next\n ) => {\n isGeneratingState.setValue(true);\n try {\n const result = await next(input, options);\n return result;\n } finally {\n isGeneratingState.setValue(false);\n }\n };\n\n experimental.builder.Popover(`${prefix}.popover`, {\n icon: '@imgly/Sparkle',\n variant: 'plain',\n isDisabled: !isEveryBlockInReadyState,\n isLoading: isGeneratingState.value,\n trailingIcon: null,\n children: ({ close }) => {\n if (toggleExpandedState.value !== undefined) {\n // ==========================================\n // === RENDER EXPANDED QUICK ACTION STATE ===\n // ==========================================\n\n const expandedQuickAction =\n currentSupportedQuickActions?.quickActions.find(\n (quickAction) =>\n quickAction !== 'ly.img.separator' &&\n quickAction.definition.id === toggleExpandedState.value\n ) as SupportedQuickAction<K, I, O> | undefined;\n\n if (\n expandedQuickAction == null ||\n expandedQuickAction.definition.render == null\n ) {\n return;\n }\n\n // Use only providers that support the current expanded quick action\n const providerValuesForExpandedQuickAction: SelectValue[] =\n supportedProviderQuickActions\n .filter(({ quickActions }) =>\n quickActions.some(\n (qa) =>\n qa !== 'ly.img.separator' &&\n qa.definition.id === expandedQuickAction.definition.id\n )\n )\n .map(({ providerInitializationResult }) => ({\n id: providerInitializationResult.provider.id,\n label:\n providerInitializationResult.provider.name ??\n providerInitializationResult.provider.id\n }));\n\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect`;\n const isProviderSelectorEnabled = context.cesdk.feature.isEnabled(\n providerFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (\n providerValuesForExpandedQuickAction.length > 1 &&\n isProviderSelectorEnabled\n ) {\n builder.Section(`${prefix}.popover.expanded.header`, {\n children: () => {\n builder.Select(`${prefix}.expanded.providerSelect.select`, {\n inputLabel: [\n `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect.label`,\n `ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`\n ],\n values: providerValuesForExpandedQuickAction,\n ...currentProviderState\n });\n }\n });\n }\n builder.Section(`${prefix}.popover.expanded.section`, {\n children: () => {\n return expandedQuickAction.definition.render({\n ...builderContext,\n toggleExpand: () => {\n toggleExpandedState.setValue(undefined);\n },\n isExpanded: true,\n generate: handleGenerateFromQuickAction({\n blockIds,\n providerInitializationResult:\n expandedQuickAction.providerInitializationResult ??\n currentSupportedQuickActions?.providerInitializationResult,\n quickAction: expandedQuickAction.definition,\n middlewares: [isGeneratingMiddleware],\n\n confirmation:\n expandedQuickAction.definition.defaults?.confirmation ??\n true,\n\n lock: expandedQuickAction.definition.defaults?.lock ?? true,\n\n close,\n cesdk: context.cesdk,\n debug: context.debug,\n dryRun: context.dryRun\n }),\n close,\n providerId: currentProviderState.value.id\n });\n }\n });\n } else {\n // =========================================\n // === RENDER REGULAR QUICK ACTIONS MENU ===\n // =========================================\n // Check if provider selector is enabled via Feature API\n const providerFeatureId = `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect`;\n const isProviderSelectorEnabled = context.cesdk.feature.isEnabled(\n providerFeatureId,\n {\n engine: context.engine\n }\n );\n\n if (providerValues.length > 1 && isProviderSelectorEnabled) {\n builder.Section(`${prefix}.popover.header`, {\n children: () => {\n builder.Select(`${prefix}.providerSelect.select`, {\n inputLabel: [\n `ly.img.plugin-ai-${context.kind}-generation-web.quickAction.providerSelect.label`,\n `ly.img.plugin-ai-generation-web.defaults.quickAction.providerSelect.label`\n ],\n values: providerValues,\n ...currentProviderState\n });\n }\n });\n }\n builder.Section(`${prefix}.popover.section`, {\n children: () => {\n experimental.builder.Menu(`${prefix}.menu`, {\n children: () => {\n currentSupportedQuickActions?.quickActions.forEach(\n (quickAction) => {\n if (quickAction === 'ly.img.separator') {\n builder.Separator(\n `${prefix}.separator.${Math.random().toString()}`\n );\n return;\n }\n if (quickAction.definition.render == null) return;\n quickAction.definition.render({\n ...builderContext,\n toggleExpand: () => {\n toggleExpandedState.setValue(\n quickAction.definition.id\n );\n },\n isExpanded: false,\n generate: handleGenerateFromQuickAction({\n blockIds,\n providerInitializationResult:\n quickAction.providerInitializationResult ??\n currentSupportedQuickActions?.providerInitializationResult,\n quickAction: quickAction.definition,\n middlewares: [isGeneratingMiddleware],\n\n confirmation:\n quickAction.definition.defaults?.confirmation ??\n true,\n\n close,\n cesdk: context.cesdk,\n debug: context.debug,\n dryRun: context.dryRun\n }),\n close,\n providerId: currentProviderState.value.id\n });\n }\n );\n }\n });\n }\n });\n }\n }\n });\n };\n return Promise.resolve(builderRenderFunction);\n}\n\nfunction getOrderedQuickActionDefinitions(\n order: string[]\n): (QuickActionDefinition<any> | 'ly.img.separator')[] {\n return order\n .map((quickActionId) => {\n if (quickActionId === 'ly.img.separator')\n return quickActionId as 'ly.img.separator';\n\n const quickAction = ActionRegistry.get().getBy({\n id: quickActionId,\n type: 'quick'\n })[0];\n\n return quickAction;\n })\n .filter(isDefined);\n}\n\nexport default createQuickActionMenuRenderFunction;\n", "import CreativeEditorSDK, {\n BuilderRenderFunction,\n CreativeEngine\n} from '@cesdk/cesdk-js';\nimport { Output, OutputKind } from '../../core/provider';\nimport createConfirmationRenderFunction from '../panels/createConfirmationRenderFunction';\nimport createQuickActionMenuRenderFunction from './createQuickActionMenuRenderFunction';\nimport { AI_EDIT_MODE } from './utils';\nimport { ProviderInitializationResult } from '../../providers/initializeProvider';\nimport CallbacksRegistry from '../../generation/CallbacksRegistry';\n\nasync function initializeQuickActionComponents<\n K extends OutputKind,\n I,\n O extends Output\n>(context: {\n kind: K;\n providerInitializationResults: ProviderInitializationResult<K, I, O>[];\n\n cesdk: CreativeEditorSDK;\n engine: CreativeEngine;\n debug?: boolean;\n dryRun?: boolean;\n defaultOrder?: string[];\n}) {\n const menuRenderFunction = await createQuickActionMenuRenderFunction({\n kind: context.kind,\n providerInitializationResults: context.providerInitializationResults,\n\n cesdk: context.cesdk,\n engine: context.engine,\n debug: context.debug,\n dryRun: context.dryRun,\n defaultOrder: context.defaultOrder\n });\n const confirmationRenderFunction = await createConfirmationRenderFunction({\n kind: context.kind,\n\n cesdk: context.cesdk\n });\n\n const builderRenderFunction: BuilderRenderFunction<any> = (\n builderContext\n ) => {\n const { engine } = builderContext;\n if (engine.editor.getEditMode() === AI_EDIT_MODE) {\n const blockIds = builderContext.engine.block.findAllSelected();\n confirmationRenderFunction({\n ...builderContext,\n payload: {\n ...(builderContext.payload ?? {}),\n applyCallbacks: {\n onBefore: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onBefore?.();\n });\n },\n onAfter: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onAfter?.();\n });\n },\n onCancel: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onCancel?.();\n });\n },\n onApply: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get()\n .get(blockId)\n .applyCallbacks?.onApply?.();\n });\n }\n },\n onCancelGeneration: () => {\n blockIds.forEach((blockId) => {\n CallbacksRegistry.get().get(blockId).onCancelGeneration?.();\n });\n }\n }\n });\n return;\n }\n\n menuRenderFunction(builderContext);\n };\n\n return {\n renderFunction: builderRenderFunction\n };\n}\n\nexport default initializeQuickActionComponents;\n", "import type CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { supportsTranslateAPI, hasTranslateAPI } from '@imgly/plugin-utils';\n\n/**\n * Creates a translation callback function for AI asset sources\n * @param cesdk - The CE.SDK instance\n * @param modelKey - The model/provider key (e.g., 'fal-ai/recraft-v3')\n * @param propertyName - The property name (e.g., 'style', 'aspect_ratio')\n * @param pluginType - The plugin type (e.g., 'image', 'video', 'sticker')\n * @returns A translation callback function for use with CustomAssetSource\n */\nexport function createTranslationCallback(\n cesdk: CreativeEditorSDK,\n modelKey: string,\n propertyName: string = 'style',\n pluginType: string = 'image'\n): (assetId: string, fallbackLabel: string, locale: string) => string {\n return (assetId: string, fallbackLabel: string): string => {\n // Check if CE.SDK supports translation API\n if (!supportsTranslateAPI(cesdk)) {\n return fallbackLabel;\n }\n\n // Build translation keys following established AI plugin pattern\n const translationKeys = buildTranslationKeys(\n modelKey,\n propertyName,\n assetId,\n pluginType\n );\n\n // Use CE.SDK's translate method with fallback array\n if (hasTranslateAPI(cesdk.i18n)) {\n const translated = cesdk.i18n.translate(translationKeys);\n\n // Return translated label or fallback if no translation found\n // (CE.SDK returns the last key if no translation is found)\n return translated !== translationKeys[translationKeys.length - 1]\n ? translated\n : fallbackLabel;\n }\n\n return fallbackLabel;\n };\n}\n\n/**\n * Build translation keys array for AI plugin property values\n * @param modelKey - The model/provider key\n * @param propertyName - The property name\n * @param value - The property value\n * @param pluginType - The plugin type (image, video, sticker, etc.)\n * @returns Array of translation keys in fallback order\n */\nexport function buildTranslationKeys(\n modelKey: string,\n propertyName: string,\n value: string,\n pluginType: string = 'image'\n): string[] {\n return [\n `ly.img.plugin-ai-${pluginType}-generation-web.${modelKey}.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-generation-web.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-${pluginType}-generation-web.${modelKey}.defaults.property.${propertyName}.${value}`,\n `ly.img.plugin-ai-generation-web.defaults.property.${propertyName}.${value}`\n ];\n}\n", "import renderImageUrlProperty from './ui/common/renderImageUrlProperty';\nimport renderStyleTransferProperty from './ui/common/renderStyleTransferProperty';\n\nconst CommonProperties = {\n ImageUrl: renderImageUrlProperty,\n StyleTransfer: renderStyleTransferProperty\n};\n\nexport { CommonProperties };\n\nexport {\n type default as Provider,\n type ImageOutput,\n type VideoOutput,\n type TextOutput,\n type AudioOutput,\n type StickerOutput,\n type Output,\n type OutputKind,\n type PanelInputSchema,\n type RenderCustomProperty,\n type GetBlockInput,\n type GetBlockInputResult,\n type GetInput\n} from './core/provider';\nexport { type GetPropertyInput, type Property } from './openapi/types';\nexport {\n type GetProvider,\n type CommonProviderConfiguration,\n type CommonPluginConfiguration,\n type CommonConfiguration,\n type InternalPluginConfiguration\n} from './types';\n\nexport type {\n PropertyContext,\n PropertyConfig,\n PropertiesConfiguration,\n ExtendPropertyContexts\n} from './core/propertyConfiguration';\n\nexport {\n buildPropertyContext,\n PropertyContextCache\n} from './utils/propertyContext';\n\nexport {\n resolvePropertyDefault,\n resolvePropertyDefaults\n} from './utils/propertyResolver';\n\nexport { default as integrateIntoDefaultAssetLibraryEntry } from './assets/integrateIntoDefaultAssetLibraryEntry';\nexport {\n ActionRegistry,\n type PluginActionDefinition,\n type QuickActionDefinition,\n type ActionDefinition,\n type ActionRegistryEventType,\n type ActionRegistrySubscriberCallback,\n type ActionRegistryFilters\n} from './core/ActionRegistry';\nexport { ProviderRegistry } from './core/ProviderRegistry';\n\n// Export middleware\nexport { composeMiddlewares, type Middleware } from './middleware/middleware';\nexport { default as loggingMiddleware } from './middleware/loggingMiddleware';\nexport { default as uploadMiddleware } from './middleware/uploadMiddleware';\n\n// Export utilities\nexport { mergeQuickActionsConfig } from './utils/mergeQuickActionsConfig';\nexport {\n default as rateLimitMiddleware,\n type RateLimitOptions\n} from './middleware/rateLimitMiddleware';\n\nexport {\n getPanelId,\n getDurationForVideo,\n getThumbnailForVideo,\n getLabelFromId,\n isAsyncGenerator,\n addIconSetOnce\n} from './utils/utils';\n\nexport { checkAiPluginVersion } from './utils/checkAiPluginVersion';\n\nexport { default as registerDockComponent } from './ui/components/registerDockComponent';\n\nexport { default as enableQuickActionForImageFill } from './ui/quickActions/enableImageFill';\n\nexport {\n isGeneratingStateKey,\n abortGenerationStateKey\n} from './ui/components/renderGenerationComponents';\n\nexport { default as initializeProviders } from './providers/initializeProviders';\nexport { default as initializeProvider } from './providers/initializeProvider';\nexport { default as initializeQuickActionComponents } from './ui/quickActions/initializeQuickActionComponents';\n\nexport { extractAndSetSchemaTranslations } from './openapi/extractSchemaTranslations';\n\nexport { AI_EDIT_MODE, AI_METADATA_KEY } from './ui/quickActions/utils';\n\n// Export AI-specific translation helpers\nexport {\n createTranslationCallback,\n buildTranslationKeys\n} from './utils/translationHelpers';\n", "{\n \"openapi\": \"3.0.0\",\n \"components\": {\n \"schemas\": {\n \"GptImage1Input\": {\n \"title\": \"TextToImageInput\",\n \"type\": \"object\",\n \"properties\": {\n \"prompt\": {\n \"title\": \"Prompt\",\n \"type\": \"string\",\n \"x-imgly-builder\": {\n \"component\": \"TextArea\"\n }\n },\n \"style\": {\n \"title\": \"Style\",\n \"type\": \"string\",\n \"description\": \"The style of the generated images.\"\n },\n \"size\": {\n \"enum\": [\"1024x1024\", \"1536x1024\", \"1024x1536\"],\n \"type\": \"string\",\n \"title\": \"Format\",\n \"default\": \"1024x1024\",\n \"x-imgly-enum-labels\": {\n \"1024x1024\": \"Square\",\n \"1536x1024\": \"Landscape\",\n \"1024x1536\": \"Portrait\"\n },\n \"x-imgly-enum-icons\": {\n \"1024x1024\": \"@imgly/plugin/formats/ratio1by1\",\n \"1024x1536\": \"@imgly/plugin/formats/ratio3by4\",\n \"1536x1024\": \"@imgly/plugin/formats/ratio4by3\"\n }\n },\n \"background\": {\n \"enum\": [\"auto\", \"transparent\", \"opaque\"],\n \"type\": \"string\",\n \"title\": \"Background\",\n \"default\": \"auto\",\n \"x-imgly-enum-labels\": {\n \"auto\": \"Auto\",\n \"transparent\": \"Transparent\",\n \"opaque\": \"Opaque\"\n }\n }\n },\n \"x-order-properties\": [\"prompt\", \"style\", \"size\", \"background\"],\n \"required\": [\"prompt\"]\n }\n }\n }\n}\n", "export function b64JsonToBlob(b64_json: string, mimeType: string): Blob {\n const base64Data = b64_json.split(',')[1] || b64_json;\n\n const byteCharacters = atob(base64Data);\n const byteArrays = [];\n\n for (let i = 0; i < byteCharacters.length; i++) {\n byteArrays.push(byteCharacters.charCodeAt(i));\n }\n const byteArray = new Uint8Array(byteArrays);\n const blob = new Blob([byteArray], { type: mimeType });\n\n return blob;\n}\n", "import CreativeEditorSDK from '@cesdk/cesdk-js';\nimport { CustomAssetSource, isDefined } from '@imgly/plugin-utils';\n\nexport const STYLES = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\nexport const createStyleAssetSource = (\n assetSourceId: string,\n options: {\n baseURL: string;\n includeNone?: boolean;\n }\n) => {\n const styleValues = STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = STYLES[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\nexport const addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n", "import { Icons } from '@imgly/plugin-utils';\nimport {\n CommonProviderConfiguration,\n getPanelId,\n type Provider\n} from '@imgly/plugin-ai-generation-web';\nimport GptImage1Schema from './GptImage1.text2image.json';\nimport CreativeEditorSDK, { AssetResult } from '@cesdk/cesdk-js';\nimport { b64JsonToBlob } from './utils';\nimport {\n addStyleAssetSource,\n createStyleAssetSource,\n STYLES\n} from './GptImage1.styles';\n\ntype StyleSelectionPayload = {\n onSelect: (asset: AssetResult) => Promise<void>;\n};\n\ntype GptImage1Input = {\n prompt: string;\n style?: string;\n size: 'auto' | '1024x1024' | '1536x1024' | '1024x1536';\n background: 'transparent' | 'opaque' | 'auto';\n};\n\ntype GptImage1Output = {\n kind: 'image';\n url: string;\n};\n\ninterface ProviderConfiguration\n extends CommonProviderConfiguration<GptImage1Input, GptImage1Output> {}\n\nexport function GptImage1(\n config: ProviderConfiguration\n): (context: {\n cesdk: CreativeEditorSDK;\n}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>> {\n return async ({ cesdk }: { cesdk: CreativeEditorSDK }) => {\n return getProvider(cesdk, config);\n };\n}\n\nfunction getProvider(\n cesdk: CreativeEditorSDK,\n config: ProviderConfiguration\n): Provider<'image', GptImage1Input, GptImage1Output> {\n const modelKey = 'open-ai/gpt-image-1/text2image';\n const baseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n const styleAssetSourceId = `${modelKey}/styles`;\n const styleAssetSource = createStyleAssetSource(styleAssetSourceId, {\n baseURL,\n includeNone: true\n });\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n cesdk.ui.registerPanel<StyleSelectionPayload>(\n `${getPanelId(modelKey)}.styleSelection`,\n ({ builder, payload }) => {\n if (payload == null) return null;\n\n builder.Library(`${modelKey}.library.style`, {\n entries: [styleAssetSourceId],\n onSelect: async (asset) => {\n payload.onSelect(asset);\n }\n });\n }\n );\n\n cesdk.ui.addIconSet('@imgly/plugin/formats', Icons.Formats);\n cesdk.i18n.setTranslations({\n en: {\n [`panel.${getPanelId(modelKey)}.styleSelection`]: 'Style Selection',\n [`panel.gpt-image-1.imageSelection`]: 'Select Image To Change'\n }\n });\n\n const provider: Provider<'image', GptImage1Input, GptImage1Output> = {\n id: 'open-ai/gpt-image-1/text2image',\n kind: 'image',\n name: 'GPT Image 1',\n input: {\n panel: {\n type: 'schema',\n // @ts-ignore\n document: GptImage1Schema,\n inputReference: '#/components/schemas/GptImage1Input',\n includeHistoryLibrary: true,\n orderExtensionKeyword: 'x-order-properties',\n renderCustomProperty: {\n style: ({ builder, state }, property) => {\n const styleState = state<{\n id: string;\n label: string;\n }>(\n 'style',\n styleAssetSource.getAssetSelectValue(\n styleAssetSource.getActiveAssetIds()[0]\n ) ?? STYLES[0]\n );\n\n // Show the style library for the selected type.\n builder.Button(`${property.id}`, {\n inputLabel: [\n `ly.img.plugin-ai-image-generation-web.${modelKey}.property.${property.id}`,\n `ly.img.plugin-ai-generation-web.property.${property.id}`,\n `ly.img.plugin-ai-image-generation-web.${modelKey}.defaults.property.${property.id}`,\n `ly.img.plugin-ai-generation-web.defaults.property.${property.id}`\n ],\n icon: '@imgly/Appearance',\n trailingIcon: '@imgly/ChevronRight',\n label: styleState.value.label,\n labelAlignment: 'left',\n onClick: () => {\n const payload: StyleSelectionPayload = {\n onSelect: async (asset) => {\n const newValue = {\n id: asset.id,\n label: asset.label ?? asset.id\n };\n\n styleAssetSource.clearActiveAssets();\n styleAssetSource.setAssetActive(asset.id);\n styleState.setValue(newValue);\n\n cesdk.ui.closePanel(\n `${getPanelId(modelKey)}.styleSelection`\n );\n }\n };\n\n cesdk.ui.openPanel(`${getPanelId(modelKey)}.styleSelection`, {\n payload\n });\n }\n });\n\n return () => {\n return {\n id: property.id,\n type: 'string',\n value:\n styleState.value.id ?? styleAssetSource.getActiveAssetIds()[0]\n };\n };\n }\n },\n getBlockInput: (input) => {\n switch (input.size) {\n case 'auto':\n return Promise.resolve({ image: { width: 512, height: 512 } });\n case '1024x1024':\n return Promise.resolve({ image: { width: 1024, height: 1024 } });\n case '1536x1024':\n return Promise.resolve({ image: { width: 1536, height: 1024 } });\n case '1024x1536':\n return Promise.resolve({ image: { width: 1024, height: 1536 } });\n default: {\n throw new Error('Invalid image size');\n }\n }\n },\n userFlow: 'placeholder'\n }\n },\n output: {\n abortable: true,\n history: '@imgly/indexedDB',\n middleware: config.middlewares ?? config.middleware ?? [],\n generate: async (\n input: GptImage1Input,\n { abortSignal }: { abortSignal?: AbortSignal }\n ) => {\n const stylePrompt = STYLES.find((style) => style.id === input.style);\n let prompt = input.prompt;\n\n if (\n stylePrompt != null &&\n stylePrompt.id !== 'none' &&\n stylePrompt.prompt\n ) {\n prompt = `${prompt}, ${stylePrompt.prompt}`;\n }\n const hasGlobalAPIKey =\n cesdk.ui.experimental.hasGlobalStateValue('OPENAI_API_KEY');\n\n const baseUrl = hasGlobalAPIKey\n ? 'https://api.openai.com/v1'\n : config.proxyUrl;\n\n const response = await fetch(`${baseUrl}/images/generations`, {\n signal: abortSignal,\n method: 'POST',\n headers: hasGlobalAPIKey\n ? {\n Authorization: `Bearer ${cesdk.ui.experimental.getGlobalStateValue(\n 'OPENAI_API_KEY'\n )}`,\n 'Content-Type': 'application/json',\n ...(config.headers ?? {})\n }\n : {\n 'Content-Type': 'application/json',\n ...(config.headers ?? {})\n },\n body: JSON.stringify({\n model: 'gpt-image-1',\n prompt,\n n: 1,\n size: input.size,\n background: input.background\n })\n });\n const img = await response.json();\n\n const b64_json = img.data?.[0].b64_json;\n if (b64_json == null) {\n throw new Error('No image data returned');\n }\n\n const blob = b64JsonToBlob(b64_json, 'image/png');\n const imageUrl = URL.createObjectURL(blob);\n\n return {\n kind: 'image',\n url: imageUrl\n };\n }\n }\n };\n\n return provider;\n}\n\nexport default getProvider;\n", "{\n \"openapi\": \"3.0.0\",\n \"components\": {\n \"schemas\": {\n \"GptImage1Input\": {\n \"title\": \"ImageToImageInput\",\n \"type\": \"object\",\n \"properties\": {\n \"prompt\": {\n \"title\": \"Prompt\",\n \"type\": \"string\",\n \"x-imgly-builder\": {\n \"component\": \"TextArea\"\n }\n },\n \"image_url\": {\n \"title\": \"Image Url\",\n \"type\": \"string\",\n \"description\": \"Optional URL of an input image for editing.\"\n }\n },\n \"x-order-properties\": [\"image_url\", \"prompt\", \"background\"],\n \"required\": [\"image_url\", \"prompt\"]\n }\n }\n }\n}\n", "import {\n bufferURIToObjectURL,\n getImageDimensionsFromURL,\n Icons,\n mimeTypeToExtension\n} from '@imgly/plugin-utils';\nimport {\n CommonProperties,\n type Provider,\n CommonProviderConfiguration\n} from '@imgly/plugin-ai-generation-web';\nimport GptImage1Schema from './GptImage1.image2image.json';\nimport CreativeEditorSDK, { MimeType } from '@cesdk/cesdk-js';\nimport { b64JsonToBlob } from './utils';\nimport { ActionRegistry } from '@imgly/plugin-ai-generation-web';\nimport ChangeStyleLibrary from './quickActions/ChangeStyleLibrary';\n\ntype GptImage1Input = {\n prompt: string;\n image_url: string | string[];\n exportFromBlockIds?: number[];\n};\n\ntype GptImage1Output = {\n kind: 'image';\n url: string;\n};\n\ninterface ProviderConfiguration\n extends CommonProviderConfiguration<GptImage1Input, GptImage1Output> {}\n\nexport function GptImage1(\n config: ProviderConfiguration\n): (context: {\n cesdk: CreativeEditorSDK;\n}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>> {\n return async ({ cesdk }: { cesdk: CreativeEditorSDK }) => {\n return getProvider(cesdk, config);\n };\n}\n\nfunction getProvider(\n cesdk: CreativeEditorSDK,\n config: ProviderConfiguration\n): Provider<'image', GptImage1Input, GptImage1Output> {\n const modelKey = 'open-ai/gpt-image-1/image2image';\n cesdk.ui.addIconSet('@imgly/plugin/formats', Icons.Formats);\n const baseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n\n ActionRegistry.get().register(\n ChangeStyleLibrary({\n cesdk,\n modelKey,\n baseURL\n })\n );\n\n const provider: Provider<'image', GptImage1Input, GptImage1Output> = {\n id: modelKey,\n kind: 'image',\n name: 'GPT Image 1',\n input: {\n panel: {\n type: 'schema',\n // @ts-ignore\n document: GptImage1Schema,\n inputReference: '#/components/schemas/GptImage1Input',\n includeHistoryLibrary: true,\n orderExtensionKeyword: 'x-order-properties',\n renderCustomProperty: {\n ...(cesdk != null\n ? CommonProperties.ImageUrl('gpt-image-1', {\n cesdk\n })\n : {})\n },\n getBlockInput: async (input) => {\n if (input.image_url == null || Array.isArray(input.image_url)) {\n throw new Error('Cannot process getBlockInput for multiple images');\n }\n\n const { width, height } = await getImageDimensionsFromURL(\n input.image_url,\n cesdk.engine\n );\n return Promise.resolve({\n image: {\n width,\n height\n }\n });\n },\n userFlow: 'placeholder'\n },\n quickActions: {\n supported: {\n 'ly.img.gpt-image-1.changeStyleLibrary': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.editImage': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.swapBackground': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.createVariant': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.combineImages': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uris,\n exportFromBlockIds: input.exportFromBlockIds\n })\n },\n 'ly.img.remixPage': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n },\n 'ly.img.remixPageWithPrompt': {\n mapInput: (input) => ({\n prompt: input.prompt,\n image_url: input.uri\n })\n }\n }\n }\n },\n output: {\n abortable: true,\n history: '@imgly/indexedDB',\n middleware: config.middlewares ?? config.middleware ?? [],\n generate: async (\n input: GptImage1Input,\n { abortSignal }: { abortSignal?: AbortSignal }\n ) => {\n const formData = new FormData();\n\n if (Array.isArray(input.image_url)) {\n if (input.exportFromBlockIds != null) {\n await Promise.all(\n input.exportFromBlockIds.map(async (blockId) => {\n const exportedBlob = await cesdk.engine.block.export(\n blockId,\n MimeType.Jpeg,\n {\n targetHeight: 1024,\n targetWidth: 1024\n }\n );\n formData.append(\n 'image[]',\n exportedBlob,\n `image_${blockId}.jpeg`\n );\n })\n );\n } else {\n await Promise.all(\n input.image_url.map(async (image_url) => {\n const mimeType = await cesdk.engine.editor.getMimeType(\n image_url\n );\n const resolvedImageUrl = await bufferURIToObjectURL(\n image_url,\n cesdk.engine\n );\n const imageUrlResponse = await fetch(resolvedImageUrl);\n const imageUrlBlob = await imageUrlResponse.blob();\n formData.append(\n 'image[]',\n imageUrlBlob,\n `image.${mimeTypeToExtension(mimeType)}`\n );\n })\n );\n }\n } else {\n const mimeType = await cesdk.engine.editor.getMimeType(\n input.image_url\n );\n const resolvedImageUrl = await bufferURIToObjectURL(\n input.image_url,\n cesdk.engine\n );\n const imageUrlResponse = await fetch(resolvedImageUrl);\n const imageUrlBlob = await imageUrlResponse.blob();\n formData.append(\n 'image',\n imageUrlBlob,\n `image.${mimeTypeToExtension(mimeType)}`\n );\n }\n\n formData.append('prompt', input.prompt);\n formData.append('model', 'gpt-image-1');\n formData.append('size', 'auto');\n formData.append('n', '1');\n\n const hasGlobalAPIKey =\n cesdk.ui.experimental.hasGlobalStateValue('OPENAI_API_KEY');\n\n const baseUrl = hasGlobalAPIKey\n ? 'https://api.openai.com/v1'\n : config.proxyUrl;\n\n const response = await fetch(`${baseUrl}/images/edits`, {\n signal: abortSignal,\n method: 'POST',\n headers: hasGlobalAPIKey\n ? {\n Authorization: `Bearer ${cesdk.ui.experimental.getGlobalStateValue(\n 'OPENAI_API_KEY'\n )}`,\n ...(config.headers ?? {})\n }\n : {\n ...(config.headers ?? {})\n },\n body: formData\n });\n\n const img = await response.json();\n\n const b64_json = img.data?.[0].b64_json;\n if (b64_json == null) {\n throw new Error('No image data returned');\n }\n\n const blob = b64JsonToBlob(b64_json, 'image/png');\n const imageUrl = URL.createObjectURL(blob);\n\n return {\n kind: 'image',\n url: imageUrl\n };\n }\n }\n };\n\n return provider;\n}\n\nexport default getProvider;\n", "import {\n enableQuickActionForImageFill,\n QuickActionDefinition\n} from '@imgly/plugin-ai-generation-web';\nimport { getImageUri, CustomAssetSource, isDefined } from '@imgly/plugin-utils';\nimport CreativeEditorSDK from '@cesdk/cesdk-js';\n\n/**\n * The action name.\n */\nconst ACTION_NAME = 'gpt-image-1.changeStyleLibrary';\n\n/**\n * The ID of the quick action.\n */\nexport const ID = `ly.img.${ACTION_NAME}`;\n\n/**\n * The i18n prefix for the quick action.\n */\nexport const I18N_PREFIX = `ly.img.plugin-ai-image-generation-web.quickAction.${ACTION_NAME}`;\n\n/**\n * The input generated from this quick action which needs\n * to be mapped to the specific provider.\n */\nexport type InputType = {\n prompt: string;\n uri: string;\n};\n\n/**\n * Available styles for GPT Image 1 style transfer.\n */\nconst STYLES = [\n {\n id: 'none',\n label: 'None',\n prompt: ''\n },\n {\n id: 'anime-celshaded',\n label: 'Anime',\n prompt:\n 'anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art '\n },\n {\n id: 'cyberpunk-neon',\n label: 'Cyberpunk',\n prompt:\n 'cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere'\n },\n {\n id: 'kodak-portra-400',\n label: 'Kodak 400',\n prompt:\n 'shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo'\n },\n {\n id: 'watercolor-storybook',\n label: 'Watercolor',\n prompt: 'loose watercolor washes, gentle gradients, dreamy storybook feel'\n },\n {\n id: 'dark-fantasy-realism',\n label: 'Dark Fantasy',\n prompt:\n 'dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures'\n },\n {\n id: 'vaporwave-retrofuturism',\n label: 'Vaporwave',\n prompt:\n 'retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines'\n },\n {\n id: 'minimal-vector-flat',\n label: 'Vector Flat',\n prompt:\n 'minimalist flat vector illustration, bold geometry, two\u2011tone palette'\n },\n {\n id: 'pixarstyle-3d-render',\n label: '3D Animation',\n prompt:\n 'Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting'\n },\n {\n id: 'ukiyoe-woodblock',\n label: 'Ukiyo\u2011e',\n prompt:\n 'ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink'\n },\n {\n id: 'surreal-dreamscape',\n label: 'Surreal',\n prompt:\n 'surreal dreamscape, floating objects, impossible architecture, vivid clouds'\n },\n {\n id: 'steampunk-victorian',\n label: 'Steampunk',\n prompt:\n 'Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog'\n },\n {\n id: 'nightstreet-photo-bokeh',\n label: 'Night Bokeh',\n prompt:\n 'night\u2011time street shot, large aperture bokeh lights, candid urban mood'\n },\n {\n id: 'comicbook-pop-art',\n label: 'Pop Art',\n prompt:\n 'classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors'\n }\n];\n\n/**\n * Creates a style asset source for the quick action.\n */\nconst createStyleAssetSource = (\n assetSourceId: string,\n options: {\n baseURL: string;\n includeNone?: boolean;\n }\n) => {\n const styleValues = STYLES.map((style) => {\n if (style.id === 'none') {\n if (!options.includeNone) {\n return undefined;\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/None.svg`\n };\n }\n return {\n id: style.id,\n label: style.label,\n thumbUri: `${options.baseURL}/thumbnails/${style.id}.jpeg`\n };\n }).filter(isDefined);\n\n const styleAssetSource = new CustomAssetSource(assetSourceId, styleValues);\n\n const defaultStyle = STYLES[0];\n styleAssetSource.setAssetActive(defaultStyle.id);\n\n return styleAssetSource;\n};\n\n/**\n * Adds the style asset source to the CESDK instance.\n */\nconst addStyleAssetSource = (\n styleAssetSource: CustomAssetSource,\n options: {\n cesdk: CreativeEditorSDK;\n }\n) => {\n options.cesdk.engine.asset.addSource(styleAssetSource);\n options.cesdk.ui.addAssetLibraryEntry({\n id: styleAssetSource.id,\n sourceIds: [styleAssetSource.id],\n gridItemHeight: 'square',\n gridBackgroundType: 'cover',\n cardLabel: ({ label }) => label,\n cardLabelPosition: () => 'below'\n });\n};\n\n/**\n * Function to create the ChangeStyleLibrary quick action.\n */\nconst ChangeStyleLibrary = (context: {\n cesdk: CreativeEditorSDK;\n modelKey: string;\n baseURL?: string;\n}): QuickActionDefinition<InputType> => {\n const { cesdk, modelKey, baseURL } = context;\n\n // Setup asset source for styles\n const styleAssetSourceId = `${modelKey}/styles`;\n const defaultBaseURL =\n 'https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/';\n const styleAssetSource = createStyleAssetSource(styleAssetSourceId, {\n baseURL: baseURL ?? defaultBaseURL\n });\n addStyleAssetSource(styleAssetSource, { cesdk });\n\n cesdk.i18n.setTranslations({\n en: {\n [`${I18N_PREFIX}`]: 'Change Style',\n [`${I18N_PREFIX}.description`]: 'Apply different art styles to your image'\n }\n });\n\n const quickAction: QuickActionDefinition<InputType> = {\n id: ID,\n type: 'quick',\n kind: 'image',\n\n label: `${I18N_PREFIX}`,\n enable: enableQuickActionForImageFill(),\n scopes: ['fill/change'],\n\n render: ({ builder, experimental, generate, engine, close }) => {\n experimental.builder.Popover(`${ID}.popover`, {\n label: `${I18N_PREFIX}`,\n icon: '@imgly/Appearance',\n labelAlignment: 'left',\n variant: 'plain',\n trailingIcon: '@imgly/ChevronRight',\n placement: 'right',\n children: () => {\n builder.Library(`${ID}.popover.library`, {\n entries: [`${modelKey}/styles`],\n onSelect: async (assetResult) => {\n try {\n const [blockId] = engine.block.findAllSelected();\n const uri = await getImageUri(blockId, engine, {\n throwErrorIfSvg: true\n });\n\n const styleId = assetResult.id;\n const style = STYLES.find(({ id }) => id === styleId);\n if (style == null) {\n throw new Error(`Style not found: ${styleId}`);\n }\n\n await generate({\n prompt: style.prompt,\n uri\n });\n\n close();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Generation error:', error);\n }\n }\n });\n }\n });\n }\n };\n return quickAction;\n};\n\n/**\n * Extend ImageQuickActionInputs with this action's input type.\n * This will ensure that the types are correctly recognized\n * in the ImageProvider.\n *\n * COPY this file to other quick action to support type safety\n */\ndeclare module '../../types' {\n interface ImageQuickActionInputs {\n [ID]: InputType;\n }\n}\n\nexport default ChangeStyleLibrary;\n", "import { GptImage1 as GptImage1Text2Image } from './GptImage1.text2image';\nimport { GptImage1 as GptImage1Image2Image } from './GptImage1.image2image';\n\nconst OpenAi = {\n GptImage1: {\n Text2Image: GptImage1Text2Image,\n Image2Image: GptImage1Image2Image\n }\n};\n\nexport default OpenAi;\n"],
5
+ "mappings": "AAAA,IAAOA,GAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECyCFC,GAAN,KAA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A,EAAS,OAAO,OAAQ,MAAM,EAC9BA,EAAS,OAAO,IAAK,GAAG,EAExB,IAAMU,EACJvB,EAAM,GAAG,aAAa,oBAAoB,gBAAgB,EAEtDwB,EAAUD,EACZ,4BACAxB,EAAO,SAoBL0B,GAFM,MAhBK,MAAM,MAAM,GAAGD,CAAO,gBAAiB,CACtD,OAAQZ,EACR,OAAQ,OACR,QAASW,EACL,CACE,cAAe,UAAUvB,EAAM,GAAG,aAAa,oBAC7C,gBACF,CAAC,GACD,GAAID,EAAO,SAAW,CAAC,CACzB,EACA,CACE,GAAIA,EAAO,SAAW,CAAC,CACzB,EACJ,KAAMc,CACR,CAAC,GAE0B,KAAK,GAEX,OAAO,CAAC,EAAE,SAC/B,GAAIY,GAAY,KACd,MAAM,IAAI,MAAM,wBAAwB,EAG1C,IAAMC,EAAOC,GAAcF,EAAU,WAAW,EAGhD,MAAO,CACL,KAAM,QACN,IAJe,IAAI,gBAAgBC,CAAI,CAKzC,CACF,CACF,CACF,CAGF,CE7PA,IAAME,GAAS,CACb,UAAW,CACT,WAAYC,GACZ,YAAaA,EACf,CACF,EAEOC,GAAQF",
6
+ "names": ["formats_default", "CustomAssetSource", "id", "assets", "options", "asset", "selectValue", "queryData", "page", "perPage", "locale", "sortActiveFirst", "query", "tags", "groups", "excludeGroups", "sortingOrder", "sortKey", "filteredAssets", "group", "lowerQuery", "label", "assetTags", "tag", "tagArray", "a", "b", "aActive", "bActive", "aValue", "bValue", "total", "startIndex", "endIndex", "resultAssets", "fallbackLabel", "nextPage", "assetId", "activeIds", "assetIds", "existingIndex", "index", "freeGlobal", "freeGlobal_default", "freeSelf", "root", "root_default", "Symbol", "Symbol_default", "objectProto", "hasOwnProperty", "nativeObjectToString", "symToStringTag", "getRawTag", "value", "isOwn", "tag", "unmasked", "result", "getRawTag_default", "objectToString", "objectToString_default", "nullTag", "undefinedTag", "baseGetTag", "baseGetTag_default", "isObjectLike", "isObjectLike_default", "isArray", "isObject", "value", "type", "isObject_default", "asyncTag", "funcTag", "genTag", "proxyTag", "isFunction", "tag", "baseGetTag_default", "isFunction_default", "coreJsData", "root_default", "coreJsData_default", "maskSrcKey", "uid", "isMasked", "func", "isMasked_default", "funcProto", "funcToString", "toSource", "toSource_default", "reRegExpChar", "reIsHostCtor", "objectProto", "hasOwnProperty", "reIsNative", "baseIsNative", "pattern", "baseIsNative_default", "getValue", "object", "key", "getValue_default", "getNative", "getNative_default", "WeakMap", "WeakMap_default", "eq", "value", "other", "eq_default", "MAX_SAFE_INTEGER", "isLength", "isLength_default", "objectProto", "argsTag", "baseIsArguments", "value", "isObjectLike_default", "baseGetTag_default", "baseIsArguments_default", "objectProto", "hasOwnProperty", "propertyIsEnumerable", "isArguments", "freeExports", "freeModule", "moduleExports", "Buffer", "root_default", "nativeIsBuffer", "argsTag", "arrayTag", "boolTag", "dateTag", "errorTag", "funcTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "typedArrayTags", "baseIsTypedArray", "value", "isObjectLike_default", "isLength_default", "baseGetTag_default", "baseIsTypedArray_default", "baseUnary", "func", "baseUnary_default", "freeExports", "freeModule", "moduleExports", "freeProcess", "freeGlobal_default", "nodeUtil", "types", "nodeUtil_default", "nodeIsTypedArray", "isTypedArray", "objectProto", "hasOwnProperty", "overArg", "func", "transform", "arg", "overArg_default", "nativeKeys", "objectProto", "hasOwnProperty", "nativeCreate", "getNative_default", "nativeCreate_default", "hashClear", "hashClear_default", "hashDelete", "key", "result", "hashDelete_default", "HASH_UNDEFINED", "objectProto", "hasOwnProperty", "hashGet", "data", "hashGet_default", "hashHas", "hashHas_default", "hashSet", "value", "hashSet_default", "Hash", "entries", "index", "length", "entry", "Hash_default", "listCacheClear", "listCacheClear_default", "assocIndexOf", "array", "eq_default", "assocIndexOf_default", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheDelete_default", "listCacheGet", "listCacheGet_default", "listCacheHas", "listCacheHas_default", "listCacheSet", "listCacheSet_default", "ListCache", "ListCache_default", "Map", "root_default", "Map_default", "mapCacheClear", "mapCacheClear_default", "isKeyable", "type", "isKeyable_default", "getMapData", "map", "getMapData_default", "mapCacheDelete", "mapCacheDelete_default", "mapCacheGet", "mapCacheGet_default", "mapCacheHas", "mapCacheHas_default", "mapCacheSet", "size", "mapCacheSet_default", "MapCache", "MapCache_default", "stackClear", "ListCache_default", "stackClear_default", "stackDelete", "key", "data", "result", "stackDelete_default", "stackGet", "stackGet_default", "stackHas", "stackHas_default", "LARGE_ARRAY_SIZE", "stackSet", "value", "pairs", "Map_default", "MapCache_default", "stackSet_default", "Stack", "entries", "objectProto", "propertyIsEnumerable", "DataView", "getNative_default", "root_default", "DataView_default", "Promise", "Promise_default", "Set", "Set_default", "mapTag", "objectTag", "promiseTag", "setTag", "weakMapTag", "dataViewTag", "dataViewCtorString", "toSource_default", "mapCtorString", "Map_default", "promiseCtorString", "setCtorString", "weakMapCtorString", "WeakMap_default", "getTag", "baseGetTag_default", "value", "result", "Ctor", "ctorString", "Uint8Array", "root_default", "HASH_UNDEFINED", "setCacheAdd", "value", "setCacheAdd_default", "setCacheHas", "setCacheHas_default", "SetCache", "values", "index", "length", "MapCache_default", "symbolProto", "Symbol_default", "symbolValueOf", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "HEX_COLOR_PATTERN", "HEX_SINGLE_CHAR_COMPONENTS_PATTERN", "HEX_DOUBLE_CHAR_COMPONENTS_PATTERN", "mimeTypeToExtension", "mimeType", "bufferURIToObjectURL", "uri", "engine", "mimeType", "length", "data", "buffer", "blob", "getImageDimensionsFromURL", "url", "engine", "resolvedUrl", "bufferURIToObjectURL", "resolve", "reject", "img", "getImageUri", "blockId", "options", "uri", "fillBlock", "sourceSet", "source", "isDefined", "value", "isDefined_default", "Icons", "formats_default", "renderImageUrlProperty", "provderId", "options", "cesdk", "propertyKey", "panelIdForImageSelection", "getImageSelectionPanelId", "createPanels", "context", "property", "builder", "global", "payload", "configuredDefault", "providerConfig", "pluginConfig", "propertyConfig", "defaultUrl", "stateValue", "assetResult", "providerId", "asset", "uri", "mimeType", "renderImageUrlProperty_default", "CustomAssetSource", "id", "assets", "selectValue", "queryData", "page", "perPage", "locale", "sortActiveFirst", "query", "tags", "groups", "excludeGroups", "sortingOrder", "sortKey", "filteredAssets", "group", "lowerQuery", "label", "assetTags", "tag", "tagArray", "a", "b", "aActive", "bActive", "aValue", "bValue", "total", "startIndex", "endIndex", "resultAssets", "fallbackLabel", "nextPage", "assetId", "activeIds", "assetIds", "existingIndex", "index", "freeGlobal", "freeGlobal_default", "freeSelf", "root", "root_default", "Symbol", "Symbol_default", "objectProto", "hasOwnProperty", "nativeObjectToString", "symToStringTag", "getRawTag", "value", "isOwn", "tag", "unmasked", "result", "getRawTag_default", "objectToString", "objectToString_default", "nullTag", "undefinedTag", "baseGetTag", "baseGetTag_default", "isObjectLike", "isObjectLike_default", "isArray", "isObject", "type", "isObject_default", "asyncTag", "funcTag", "genTag", "proxyTag", "isFunction", "isFunction_default", "coreJsData", "coreJsData_default", "maskSrcKey", "uid", "isMasked", "func", "isMasked_default", "funcProto", "funcToString", "toSource", "toSource_default", "reRegExpChar", "reIsHostCtor", "reIsNative", "baseIsNative", "pattern", "baseIsNative_default", "getValue", "object", "key", "getValue_default", "getNative", "getNative_default", "WeakMap", "WeakMap_default", "eq", "other", "eq_default", "MAX_SAFE_INTEGER", "isLength", "isLength_default", "argsTag", "baseIsArguments", "baseIsArguments_default", "propertyIsEnumerable", "isArguments", "freeExports", "freeModule", "moduleExports", "Buffer", "nativeIsBuffer", "arrayTag", "boolTag", "dateTag", "errorTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "typedArrayTags", "baseIsTypedArray", "baseIsTypedArray_default", "baseUnary", "baseUnary_default", "freeProcess", "nodeUtil", "types", "nodeUtil_default", "nodeIsTypedArray", "isTypedArray", "overArg", "transform", "arg", "overArg_default", "nativeKeys", "nativeCreate", "nativeCreate_default", "hashClear", "hashClear_default", "hashDelete", "hashDelete_default", "HASH_UNDEFINED", "hashGet", "data", "hashGet_default", "hashHas", "hashHas_default", "hashSet", "hashSet_default", "Hash", "entries", "index", "length", "entry", "Hash_default", "listCacheClear", "listCacheClear_default", "assocIndexOf", "array", "assocIndexOf_default", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheDelete_default", "listCacheGet", "listCacheGet_default", "listCacheHas", "listCacheHas_default", "listCacheSet", "listCacheSet_default", "ListCache", "ListCache_default", "Map", "Map_default", "mapCacheClear", "mapCacheClear_default", "isKeyable", "isKeyable_default", "getMapData", "map", "getMapData_default", "mapCacheDelete", "mapCacheDelete_default", "mapCacheGet", "mapCacheGet_default", "mapCacheHas", "mapCacheHas_default", "mapCacheSet", "size", "mapCacheSet_default", "MapCache", "MapCache_default", "stackClear", "stackClear_default", "stackDelete", "stackDelete_default", "stackGet", "stackGet_default", "stackHas", "stackHas_default", "LARGE_ARRAY_SIZE", "stackSet", "pairs", "stackSet_default", "Stack", "DataView", "DataView_default", "Promise", "Promise_default", "Set", "Set_default", "promiseTag", "dataViewCtorString", "mapCtorString", "promiseCtorString", "setCtorString", "weakMapCtorString", "getTag", "Ctor", "ctorString", "Uint8Array", "setCacheAdd", "setCacheAdd_default", "setCacheHas", "setCacheHas_default", "SetCache", "values", "symbolProto", "symbolValueOf", "HEX_COLOR_PATTERN", "HEX_SINGLE_CHAR_COMPONENTS_PATTERN", "HEX_DOUBLE_CHAR_COMPONENTS_PATTERN", "isDefined", "value", "isDefined_default", "renderStyleTransferProperty", "providerId", "options", "cesdk", "propertyKey", "panelIdForStyleSelection", "getStyleSelectionPanelId", "defaultStyles", "getDefaultStyles", "styles", "styleAssetSource", "createStyleAssetSource", "styleAssetSourceId", "addStyleAssetSource", "createPanels", "context", "property", "promptState", "activeAssetId", "asset", "builder", "state", "styleState", "payload", "panelId", "entryId", "STYLES", "style", "Ys", "styleValues", "allSourceIds", "assetSourceId", "ye", "defaultStyle", "label", "renderStyleTransferProperty_default", "ActionRegistry", "_ActionRegistry", "globalKey", "globalObj", "action", "filters", "callback", "event", "AI_PANEL_ID_PREFIX", "getPanelId", "providerId", "AI_PANEL_ID_PREFIX", "enableImageFill", "engine", "blockIds", "blockId", "fillBlock", "enableImageFill_default", "PLUGIN_ICON_SET_ID", "ICON_SPRITE", "CommonProperties", "renderImageUrlProperty_default", "renderStyleTransferProperty_default", "GptImage1_text2image_default", "b64JsonToBlob", "b64_json", "mimeType", "base64Data", "byteCharacters", "byteArrays", "i", "byteArray", "STYLES", "createStyleAssetSource", "assetSourceId", "options", "styleValues", "style", "Ys", "styleAssetSource", "ye", "defaultStyle", "addStyleAssetSource", "label", "GptImage1", "config", "cesdk", "getProvider", "modelKey", "baseURL", "styleAssetSourceId", "styleAssetSource", "createStyleAssetSource", "addStyleAssetSource", "ho", "builder", "payload", "asset", "Uu", "GptImage1_text2image_default", "state", "property", "styleState", "STYLES", "newValue", "input", "abortSignal", "stylePrompt", "style", "prompt", "hasGlobalAPIKey", "baseUrl", "b64_json", "blob", "b64JsonToBlob", "GptImage1_image2image_default", "MimeType", "ACTION_NAME", "ID", "I18N_PREFIX", "STYLES", "createStyleAssetSource", "assetSourceId", "options", "styleValues", "style", "Ys", "styleAssetSource", "ye", "defaultStyle", "addStyleAssetSource", "label", "ChangeStyleLibrary", "context", "cesdk", "modelKey", "baseURL", "styleAssetSourceId", "Ro", "builder", "experimental", "generate", "engine", "close", "assetResult", "blockId", "uri", "Qs", "styleId", "id", "error", "ChangeStyleLibrary_default", "GptImage1", "config", "cesdk", "getProvider", "modelKey", "Uu", "B", "ChangeStyleLibrary_default", "GptImage1_image2image_default", "Ou", "input", "width", "height", "Zs", "abortSignal", "formData", "blockId", "exportedBlob", "MimeType", "image_url", "mimeType", "resolvedImageUrl", "he", "imageUrlBlob", "gr", "hasGlobalAPIKey", "baseUrl", "b64_json", "blob", "b64JsonToBlob", "OpenAi", "GptImage1", "open_ai_default"]
7
7
  }