diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8626d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,152 @@ +#------------------------- +# Operating Specific Junk Files +#------------------------- + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# OS X Thumbnails +._* + +# Windows image file caches +Thumbs.db +ehthumbs.db +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Linux +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +#------------------------- +# Environment Files +#------------------------- +# These should never be under version control, +# as it poses a security risk. +.env +.vagrant +Vagrantfile + +#------------------------- +# Temporary Files +#------------------------- +writable/cache/* +!writable/cache/index.html + +writable/logs/* +!writable/logs/index.html + +writable/session/* +!writable/session/index.html + +writable/uploads/* +!writable/uploads/index.html + +writable/debugbar/* + +php_errors.log + +#mapurl 결과물 +public/mapurl/index.html + +#추가 upload/download 파일 +writable/HPILO/* +!writable/HPILO/index.html + +writable/api/* +!writable/api/index.html + +writable/billing/* +!writable/billing/index.html + +writable/download/* +!writable/download/index.html + +writable/excel/* +!writable/excel/index.html + +public/uploads/* +public/upload_images/* + +#leftmenu 파일 +Views/layouts/front/left_menu/* +Views/layouts/main/board.php + +#------------------------- +# User Guide Temp Files +#------------------------- +user_guide_src/build/* +user_guide_src/cilexer/build/* +user_guide_src/cilexer/dist/* +user_guide_src/cilexer/pycilexer.egg-info/* + +#------------------------- +# Test Files +#------------------------- +tests/coverage* + +# Don't save phpunit under version control. +phpunit + +#------------------------- +# Composer +#------------------------- +composer.lock +vendor/ + +#------------------------- +# IDE / Development Files +#------------------------- + +# Modules Testing +_modules/* + +# phpenv local config +.php-version + +# Jetbrains editors (PHPStorm, etc) +.idea/ +*.iml + +# Netbeans +nbproject/ +build/ +nbbuild/ +nbdist/ +nbactions.xml +nb-configuration.xml +.nb-gradle/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +.phpintel +/api/ + +# Visual Studio Code +.vscode/ + +/results/ +/phpunit*.xml +/.phpunit.*.cache \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0119e5f --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014-2019 British Columbia Institute of Technology +Copyright (c) 2019-2023 CodeIgniter Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ccbcf47 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +#Tips +#참고 : https://github.com/bundanining/Shopping-Cart-Solution-CodeIgniter +vscode와 Git의 대소문자 구분시키기 +git config core.ignorecase false + +# 1. CodeIgniter 4 Application Starter + +`composer create-project codeigniter4/appstarter 프로젝트명` + +## 2. Setup + +php.ini에 extension=intl 필요 +apache의 DocumentRoot "패키지명/public" 수정 후 restart 필요 +Copy `env` to `.env` and tailor for your app, specifically the baseURL and any database settings. +.env 수정 +CI_ENVIRONMENT = development + +# 3. 필요한 추가 패키지 + +composer require saleh7/proxmox-ve_php_api + +## 4. Running Development Server + +php spark serve + +## 5. Web접속 + +개발용 -> localhost:8080 +실서버 -> https://proxmox.idcjp.jp + +## 6. new Controller추가시 Config\Routes.php에 Routing설정 필요 + +$routes->get('/ProxmoxAPI', 'ProxmoxAPI::index'); + +## 7. composer.json의 "psr-4" 수정시 reload + +"psr-4": { +"Tests\\Support\\": "tests/\_support" +"APP\\": "app" +} +composer dump-autoload + +## 8. php spark 사용법 (https://onlinewebtutorblog.com/how-to-work-with-codeigniter-4-model-and-entity-tutorial/) + +- User Table 관련 + php spark migrate:create create_user_table --> table 생성 + php spark migrate --> table 적용 + php spark make:migration update_and_addfield_to_users_table --> 기존 table 내용변경없이 column변경시 + php spark migrate:refresh --> table 수정후 재생성 + php spark migrate:rollback + php spark migrate:status --> 상태보기 + +- 초기 데이터 넣기 + php spark make:seeder user --suffix + php spark db:seed UsersSeeder + +- mvc 생성 --suffix 추가필요 + php spark make:model user --suffix + php spark make:controller user --suffix + php spark make:entity user --suffix + +- auth용 + php spark make:filter AuthGuard + +## 9. Login관련 참조 + +https://www.jurisic.org/post/2022/11/28/How-to-make-simple-Authentication-with-CodeIgniter-4 diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..f24db0a --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + diff --git a/app/Common.php b/app/Common.php new file mode 100644 index 0000000..23e3e61 --- /dev/null +++ b/app/Common.php @@ -0,0 +1,15 @@ + + */ + public array $allowedHostnames = []; + + /** + * -------------------------------------------------------------------------- + * Index File + * -------------------------------------------------------------------------- + * + * Typically this will be your index.php file, unless you've renamed it to + * something else. If you are using mod_rewrite to remove the page set this + * variable so that it is blank. + */ + //public string $indexPage = 'index.php'; + public string $indexPage = ''; + /** + * -------------------------------------------------------------------------- + * URI PROTOCOL + * -------------------------------------------------------------------------- + * + * This item determines which server global should be used to retrieve the + * URI string. The default setting of 'REQUEST_URI' works for most servers. + * If your links do not seem to work, try one of the other delicious flavors: + * + * 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] + * 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] + * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] + * + * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! + */ + public string $uriProtocol = 'REQUEST_URI'; + + /** + * -------------------------------------------------------------------------- + * Default Locale + * -------------------------------------------------------------------------- + * + * The Locale roughly represents the language and location that your visitor + * is viewing the site from. It affects the language strings and other + * strings (like currency markers, numbers, etc), that your program + * should run under for this request. + */ + public string $defaultLocale = 'en'; + + /** + * -------------------------------------------------------------------------- + * Negotiate Locale + * -------------------------------------------------------------------------- + * + * If true, the current Request object will automatically determine the + * language to use based on the value of the Accept-Language header. + * + * If false, no automatic detection will be performed. + */ + public bool $negotiateLocale = false; + + /** + * -------------------------------------------------------------------------- + * Supported Locales + * -------------------------------------------------------------------------- + * + * If $negotiateLocale is true, this array lists the locales supported + * by the application in descending order of priority. If no match is + * found, the first locale will be used. + * + * @var string[] + */ + public array $supportedLocales = ['en']; + + /** + * -------------------------------------------------------------------------- + * Application Timezone + * -------------------------------------------------------------------------- + * + * The default timezone that will be used in your application to display + * dates with the date helper, and can be retrieved through app_timezone() + */ + public string $appTimezone = 'UTC'; + + /** + * -------------------------------------------------------------------------- + * Default Character Set + * -------------------------------------------------------------------------- + * + * This determines which character set is used by default in various methods + * that require a character set to be provided. + * + * @see http://php.net/htmlspecialchars for a list of supported charsets. + */ + public string $charset = 'UTF-8'; + + /** + * -------------------------------------------------------------------------- + * URI PROTOCOL + * -------------------------------------------------------------------------- + * + * If true, this will force every request made to this application to be + * made via a secure connection (HTTPS). If the incoming request is not + * secure, the user will be redirected to a secure version of the page + * and the HTTP Strict Transport Security header will be set. + */ + public bool $forceGlobalSecureRequests = false; + + /** + * -------------------------------------------------------------------------- + * Session Driver + * -------------------------------------------------------------------------- + * + * The session storage driver to use: + * - `CodeIgniter\Session\Handlers\FileHandler` + * - `CodeIgniter\Session\Handlers\DatabaseHandler` + * - `CodeIgniter\Session\Handlers\MemcachedHandler` + * - `CodeIgniter\Session\Handlers\RedisHandler` + * + * @deprecated use Config\Session::$driver instead. + */ + public string $sessionDriver = FileHandler::class; + + /** + * -------------------------------------------------------------------------- + * Session Cookie Name + * -------------------------------------------------------------------------- + * + * The session cookie name, must contain only [0-9a-z_-] characters + * + * @deprecated use Config\Session::$cookieName instead. + */ + public string $sessionCookieName = 'ci_session'; + + /** + * -------------------------------------------------------------------------- + * Session Expiration + * -------------------------------------------------------------------------- + * + * The number of SECONDS you want the session to last. + * Setting to 0 (zero) means expire when the browser is closed. + * + * @deprecated use Config\Session::$expiration instead. + */ + public int $sessionExpiration = 7200; + + /** + * -------------------------------------------------------------------------- + * Session Save Path + * -------------------------------------------------------------------------- + * + * The location to save sessions to and is driver dependent. + * + * For the 'files' driver, it's a path to a writable directory. + * WARNING: Only absolute paths are supported! + * + * For the 'database' driver, it's a table name. + * Please read up the manual for the format with other session drivers. + * + * IMPORTANT: You are REQUIRED to set a valid save path! + * + * @deprecated use Config\Session::$savePath instead. + */ + public string $sessionSavePath = WRITEPATH . 'session'; + + /** + * -------------------------------------------------------------------------- + * Session Match IP + * -------------------------------------------------------------------------- + * + * Whether to match the user's IP address when reading the session data. + * + * WARNING: If you're using the database driver, don't forget to update + * your session table's PRIMARY KEY when changing this setting. + * + * @deprecated use Config\Session::$matchIP instead. + */ + public bool $sessionMatchIP = false; + + /** + * -------------------------------------------------------------------------- + * Session Time to Update + * -------------------------------------------------------------------------- + * + * How many seconds between CI regenerating the session ID. + * + * @deprecated use Config\Session::$timeToUpdate instead. + */ + public int $sessionTimeToUpdate = 300; + + /** + * -------------------------------------------------------------------------- + * Session Regenerate Destroy + * -------------------------------------------------------------------------- + * + * Whether to destroy session data associated with the old session ID + * when auto-regenerating the session ID. When set to FALSE, the data + * will be later deleted by the garbage collector. + * + * @deprecated use Config\Session::$regenerateDestroy instead. + */ + public bool $sessionRegenerateDestroy = false; + + /** + * -------------------------------------------------------------------------- + * Session Database Group + * -------------------------------------------------------------------------- + * + * DB Group for the database session. + * + * @deprecated use Config\Session::$DBGroup instead. + */ + public ?string $sessionDBGroup = null; + + /** + * -------------------------------------------------------------------------- + * Cookie Prefix + * -------------------------------------------------------------------------- + * + * Set a cookie name prefix if you need to avoid collisions. + * + * @deprecated use Config\Cookie::$prefix property instead. + */ + public string $cookiePrefix = ''; + + /** + * -------------------------------------------------------------------------- + * Cookie Domain + * -------------------------------------------------------------------------- + * + * Set to `.your-domain.com` for site-wide cookies. + * + * @deprecated use Config\Cookie::$domain property instead. + */ + public string $cookieDomain = ''; + + /** + * -------------------------------------------------------------------------- + * Cookie Path + * -------------------------------------------------------------------------- + * + * Typically will be a forward slash. + * + * @deprecated use Config\Cookie::$path property instead. + */ + public string $cookiePath = '/'; + + /** + * -------------------------------------------------------------------------- + * Cookie Secure + * -------------------------------------------------------------------------- + * + * Cookie will only be set if a secure HTTPS connection exists. + * + * @deprecated use Config\Cookie::$secure property instead. + */ + public bool $cookieSecure = false; + + /** + * -------------------------------------------------------------------------- + * Cookie HttpOnly + * -------------------------------------------------------------------------- + * + * Cookie will only be accessible via HTTP(S) (no JavaScript). + * + * @deprecated use Config\Cookie::$httponly property instead. + */ + public bool $cookieHTTPOnly = true; + + /** + * -------------------------------------------------------------------------- + * Cookie SameSite + * -------------------------------------------------------------------------- + * + * Configure cookie SameSite setting. Allowed values are: + * - None + * - Lax + * - Strict + * - '' + * + * Alternatively, you can use the constant names: + * - `Cookie::SAMESITE_NONE` + * - `Cookie::SAMESITE_LAX` + * - `Cookie::SAMESITE_STRICT` + * + * Defaults to `Lax` for compatibility with modern browsers. Setting `''` + * (empty string) means default SameSite attribute set by browsers (`Lax`) + * will be set on cookies. If set to `None`, `$cookieSecure` must also be set. + * + * @deprecated use Config\Cookie::$samesite property instead. + */ + public ?string $cookieSameSite = 'Lax'; + + /** + * -------------------------------------------------------------------------- + * Reverse Proxy IPs + * -------------------------------------------------------------------------- + * + * If your server is behind a reverse proxy, you must whitelist the proxy + * IP addresses from which CodeIgniter should trust headers such as + * X-Forwarded-For or Client-IP in order to properly identify + * the visitor's IP address. + * + * You need to set a proxy IP address or IP address with subnets and + * the HTTP header for the client IP address. + * + * Here are some examples: + * [ + * '10.0.1.200' => 'X-Forwarded-For', + * '192.168.5.0/24' => 'X-Real-IP', + * ] + * + * @var array + */ + public array $proxyIPs = []; + + /** + * -------------------------------------------------------------------------- + * CSRF Token Name + * -------------------------------------------------------------------------- + * + * The token name. + * + * @deprecated Use `Config\Security` $tokenName property instead of using this property. + */ + public string $CSRFTokenName = 'csrf_test_name'; + + /** + * -------------------------------------------------------------------------- + * CSRF Header Name + * -------------------------------------------------------------------------- + * + * The header name. + * + * @deprecated Use `Config\Security` $headerName property instead of using this property. + */ + public string $CSRFHeaderName = 'X-CSRF-TOKEN'; + + /** + * -------------------------------------------------------------------------- + * CSRF Cookie Name + * -------------------------------------------------------------------------- + * + * The cookie name. + * + * @deprecated Use `Config\Security` $cookieName property instead of using this property. + */ + public string $CSRFCookieName = 'csrf_cookie_name'; + + /** + * -------------------------------------------------------------------------- + * CSRF Expire + * -------------------------------------------------------------------------- + * + * The number in seconds the token should expire. + * + * @deprecated Use `Config\Security` $expire property instead of using this property. + */ + public int $CSRFExpire = 7200; + + /** + * -------------------------------------------------------------------------- + * CSRF Regenerate + * -------------------------------------------------------------------------- + * + * Regenerate token on every submission? + * + * @deprecated Use `Config\Security` $regenerate property instead of using this property. + */ + public bool $CSRFRegenerate = true; + + /** + * -------------------------------------------------------------------------- + * CSRF Redirect + * -------------------------------------------------------------------------- + * + * Redirect to previous page with error on failure? + * + * @deprecated Use `Config\Security` $redirect property instead of using this property. + */ + public bool $CSRFRedirect = false; + + /** + * -------------------------------------------------------------------------- + * CSRF SameSite + * -------------------------------------------------------------------------- + * + * Setting for CSRF SameSite cookie token. Allowed values are: + * - None + * - Lax + * - Strict + * - '' + * + * Defaults to `Lax` as recommended in this link: + * + * @see https://portswigger.net/web-security/csrf/samesite-cookies + * + * @deprecated `Config\Cookie` $samesite property is used. + */ + public string $CSRFSameSite = 'Lax'; + + /** + * -------------------------------------------------------------------------- + * Content Security Policy + * -------------------------------------------------------------------------- + * + * Enables the Response's Content Secure Policy to restrict the sources that + * can be used for images, scripts, CSS files, audio, video, etc. If enabled, + * the Response object will populate default values for the policy from the + * `ContentSecurityPolicy.php` file. Controllers can always add to those + * restrictions at run time. + * + * For a better understanding of CSP, see these documents: + * + * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ + * @see http://www.w3.org/TR/CSP/ + */ + public bool $CSPEnabled = false; +} diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php new file mode 100644 index 0000000..abd9df9 --- /dev/null +++ b/app/Config/Autoload.php @@ -0,0 +1,97 @@ + SYSTEMPATH, + * 'App' => APPPATH + * ]; + * + * @var array|string> + * @phpstan-var array> + */ + public $psr4 = [ + APP_NAMESPACE => APPPATH, // For custom app namespace + 'Config' => APPPATH . 'Config', + ]; + + /** + * ------------------------------------------------------------------- + * Class Map + * ------------------------------------------------------------------- + * The class map provides a map of class names and their exact + * location on the drive. Classes loaded in this manner will have + * slightly faster performance because they will not have to be + * searched for within one or more directories as they would if they + * were being autoloaded through a namespace. + * + * Prototype: + * $classmap = [ + * 'MyClass' => '/path/to/class/file.php' + * ]; + * + * @var array + */ + public $classmap = []; + + /** + * ------------------------------------------------------------------- + * Files + * ------------------------------------------------------------------- + * The files array provides a list of paths to __non-class__ files + * that will be autoloaded. This can be useful for bootstrap operations + * or for loading functions. + * + * Prototype: + * $files = [ + * '/path/to/my/file.php', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $files = []; + + /** + * ------------------------------------------------------------------- + * Helpers + * ------------------------------------------------------------------- + * Prototype: + * $helpers = [ + * 'form', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $helpers = []; +} diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php new file mode 100644 index 0000000..05a8612 --- /dev/null +++ b/app/Config/Boot/development.php @@ -0,0 +1,32 @@ + + */ + public array $file = [ + 'storePath' => WRITEPATH . 'cache/', + 'mode' => 0640, + ]; + + /** + * ------------------------------------------------------------------------- + * Memcached settings + * ------------------------------------------------------------------------- + * Your Memcached servers can be specified below, if you are using + * the Memcached drivers. + * + * @see https://codeigniter.com/user_guide/libraries/caching.html#memcached + * + * @var array + */ + public array $memcached = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1, + 'raw' => false, + ]; + + /** + * ------------------------------------------------------------------------- + * Redis settings + * ------------------------------------------------------------------------- + * Your Redis server can be specified below, if you are using + * the Redis or Predis drivers. + * + * @var array + */ + public array $redis = [ + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'timeout' => 0, + 'database' => 0, + ]; + + /** + * -------------------------------------------------------------------------- + * Available Cache Handlers + * -------------------------------------------------------------------------- + * + * This is an array of cache engine alias' and class names. Only engines + * that are listed here are allowed to be used. + * + * @var array + */ + public array $validHandlers = [ + 'dummy' => DummyHandler::class, + 'file' => FileHandler::class, + 'memcached' => MemcachedHandler::class, + 'predis' => PredisHandler::class, + 'redis' => RedisHandler::class, + 'wincache' => WincacheHandler::class, + ]; +} diff --git a/app/Config/Constants.php b/app/Config/Constants.php new file mode 100644 index 0000000..b05e584 --- /dev/null +++ b/app/Config/Constants.php @@ -0,0 +1,297 @@ + [ + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty', + 'stylesheets' => [ + '', + '', + '', + ], + 'javascripts' => [ + '', + ] + ], + 'front' => [ + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front', + 'stylesheets' => [ + '', + '', + '', + '', + '', + '', + '', + '', + ], + 'javascripts' => [ + '', + '', + '', + '', + '', + ] + ], + 'admin' => [ + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin', + 'stylesheets' => [ + '', + '', + '', + '', + '', + '', + '', + '', + ], + 'javascripts' => [ + '', + '', + '', + '', + '', + ] + ], + 'main' => [ + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'main', + 'stylesheets' => [ + '', + '', + '', + '', + '', + '', + '', + '', + ], + 'javascripts' => [ + '', + '', + '', + '', + '', + ] + ], +]); + +//URL +define('URLS', [ + 'LOGIN' => '/front/user/login', + 'SIGNUP' => '/front/user/signup', + 'LOGOUT' => '/front/user/logout', + 'Order' => '/front/order', + 'addCart' => '/front/order/addCart', + 'cancelCart' => '/front/order/cancelCart', + 'cardPayment' => '/front/order/payment/card', + 'depositPayment' => '/front/order/payment/deposit', +]); +//SESSION 관련 +define('SESSION_NAMES', [ + 'RETURN_URL' => "return_url", + 'ISLOGIN' => "islogined", + 'AUTH' => 'auth', + 'CART' => 'cart' +]); +define('AUTH_FIELDS', ['ID' => 'id', 'TITLE' => 'title', 'ROLE' => 'role']); +//월이용권 상품의 Category번호 +define('RENTAL_PRODUCT_CATEGORYS', [5, 8]); +//인증 관련 +define('AUTH_ADAPTERS', [ + 'Local' => [ + 'DEBUG' => getenv("auth.loca.debug") ?: false, + ], + 'Google' => [ + 'DEBUG' => getenv("auth.google.debug") ?: false, + 'ICON' => getenv("auth.google.icon") ?: '', + 'CLIENT_ID' => getenv("auth.google.client.id"), + 'CLIENT_KEY' => getenv("auth.google.client.key"), + 'CALLBACK_URL' => getenv("auth.google.client.callback_url"), + 'TOKEN_NAME' => getenv('auth.google.client.token_name') ?: "access_token", + ], +]); + +define("MALLS", [ + "support" => "support@idcjp.jp", + "master" => "master@idcjp.jp", + "title" => "Mall Master" +]); + +//Upload , Download 관련 +define('PATHS', [ + 'EXCEL' => WRITEPATH . "excel/", + 'BILLING' => WRITEPATH . "billing/", + 'UPLOAD' => WRITEPATH . "uploads/", + 'UPLOAD_IMAGE' => FCPATH . 'upload_images/', + 'DOWNLOAD' => WRITEPATH . "download/", + 'API' => WRITEPATH . "api/", +]); +foreach (PATHS as $key => $path) { + if (!is_dir($path)) { + mkdir($path, 0755); + } +} + +//아이콘 및 Sound관련 +define('ICONS', [ + 'LOGIN' => '', + 'LOGOUT' => '', + 'LOCK' => '', + 'NEW' => '', + 'REPLY' => '', + 'DELETE' => '', + 'RELOAD' => '', + 'SETUP' => '', + 'FLAG' => '', + 'SEARCH' => '', + 'EXCEL' => '', + 'HOME' => '', + 'PLAY' => '', + 'CART' => '', + 'CARD' => '', + 'DEPOSIT' => '', + 'UP' => '', + 'DOWN' => '', + 'LEFT' => '', + 'RIGHT' => '', + 'IMAGE_FILE' => '', +]); +define('CLASS_ICONS', [ + 'USER' => '', + 'USERSNS' => '', + 'BOARD' => '', + 'SITEPAGE' => '', + 'CATEGORY' => '', + 'PRODUCT' => '', + 'ORDER' => '', + 'BILLING' => '', + 'CART' => '', + 'CARD' => '', + 'DEPOSIT' => '', +]); +define('CLASS_TOP_BANNER', [ + 'USER' => '', + 'USERSNS' => '', + 'ORDER' => '', + 'BILLING' => '', + 'CARD' => '', + 'DEPOSIT' => '', + 'PRODUCT' => '', + 'SITEPAGE' => '', + 'BOARD' => '', +]); +define('AUDIOS', [ + 'Alram_GetEmail' => '', +]); + +//Default값 정의 +define('DEFAULTS', [ + 'CATEGORY_USER' => getenv('default.category.user') ?: 22, + 'CATEGORY_ORDER' => getenv('default.category.order') ?: 11, + 'CATEGORY_BILLING' => getenv('default.category.billing') ?: 28, + 'ROLE' => getenv('default.role') ?: "guest", + 'STATUS' => getenv('default.status') ?: "use", + 'EMPTY' => getenv('default.empty') ?: "", + 'PERPAGE' => getenv('default.perpage') ?: 20, + 'DELIMITER_FILE' => getenv('default.delimiter.file') ?: "||", + 'DELIMITER_ROLE' => getenv('default.delimiter.role') ?: ",", +]); + +//API Adapter초기갑 정의 +define('API', [ + 'SSL_VERIFY' => getenv('api.ssl') == 'true' ? true : false, + 'COOKIE_FILE' => PATHS['API'] . getenv('api.cookie.file') ?: "api-cookie_" . date("Ymd") . ".log", + 'DEBUG_FILE' => PATHS['API'] . getenv('api.debug.file') ?: "api-debug_" . date("Ymd") . ".log", +]); diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php new file mode 100644 index 0000000..18612e1 --- /dev/null +++ b/app/Config/ContentSecurityPolicy.php @@ -0,0 +1,176 @@ +` element. + * + * Will default to self if not overridden + * + * @var string|string[]|null + */ + public $baseURI; + + /** + * Lists the URLs for workers and embedded frame contents + * + * @var string|string[] + */ + public $childSrc = 'self'; + + /** + * Limits the origins that you can connect to (via XHR, + * WebSockets, and EventSource). + * + * @var string|string[] + */ + public $connectSrc = 'self'; + + /** + * Specifies the origins that can serve web fonts. + * + * @var string|string[] + */ + public $fontSrc; + + /** + * Lists valid endpoints for submission from `
` tags. + * + * @var string|string[] + */ + public $formAction = 'self'; + + /** + * Specifies the sources that can embed the current page. + * This directive applies to ``, `'; + } + }; + const getFlashHtml = data => { + let html = ''; + if (data.poster) { + html += ''; + } + html += ''; + return html; + }; + const getAudioHtml = (data, audioTemplateCallback) => { + if (audioTemplateCallback) { + return audioTemplateCallback(data); + } else { + return ''; + } + }; + const getVideoHtml = (data, videoTemplateCallback) => { + if (videoTemplateCallback) { + return videoTemplateCallback(data); + } else { + return ''; + } + }; + const getScriptHtml = data => { + return ''; + }; + const dataToHtml = (editor, dataIn) => { + var _a; + const data = global$5.extend({}, dataIn); + if (!data.source) { + global$5.extend(data, htmlToData((_a = data.embed) !== null && _a !== void 0 ? _a : '', editor.schema)); + if (!data.source) { + return ''; + } + } + if (!data.altsource) { + data.altsource = ''; + } + if (!data.poster) { + data.poster = ''; + } + data.source = editor.convertURL(data.source, 'source'); + data.altsource = editor.convertURL(data.altsource, 'source'); + data.sourcemime = guess(data.source); + data.altsourcemime = guess(data.altsource); + data.poster = editor.convertURL(data.poster, 'poster'); + const pattern = matchPattern(data.source); + if (pattern) { + data.source = pattern.url; + data.type = pattern.type; + data.allowfullscreen = pattern.allowFullscreen; + data.width = data.width || String(pattern.w); + data.height = data.height || String(pattern.h); + } + if (data.embed) { + return updateHtml(data.embed, data, true, editor.schema); + } else { + const audioTemplateCallback = getAudioTemplateCallback(editor); + const videoTemplateCallback = getVideoTemplateCallback(editor); + const iframeTemplateCallback = getIframeTemplateCallback(editor); + data.width = data.width || '300'; + data.height = data.height || '150'; + global$5.each(data, (value, key) => { + data[key] = editor.dom.encode('' + value); + }); + if (data.type === 'iframe') { + return getIframeHtml(data, iframeTemplateCallback); + } else if (data.sourcemime === 'application/x-shockwave-flash') { + return getFlashHtml(data); + } else if (data.sourcemime.indexOf('audio') !== -1) { + return getAudioHtml(data, audioTemplateCallback); + } else if (data.type === 'script') { + return getScriptHtml(data); + } else { + return getVideoHtml(data, videoTemplateCallback); + } + } + }; + + const isMediaElement = element => element.hasAttribute('data-mce-object') || element.hasAttribute('data-ephox-embed-iri'); + const setup$2 = editor => { + editor.on('click keyup touchend', () => { + const selectedNode = editor.selection.getNode(); + if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) { + if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) { + selectedNode.setAttribute('data-mce-selected', '2'); + } + } + }); + editor.on('ObjectSelected', e => { + const objectType = e.target.getAttribute('data-mce-object'); + if (objectType === 'script') { + e.preventDefault(); + } + }); + editor.on('ObjectResized', e => { + const target = e.target; + if (target.getAttribute('data-mce-object')) { + let html = target.getAttribute('data-mce-html'); + if (html) { + html = unescape(html); + target.setAttribute('data-mce-html', escape(updateHtml(html, { + width: String(e.width), + height: String(e.height) + }, false, editor.schema))); + } + } + }); + }; + + const cache = {}; + const embedPromise = (data, dataToHtml, handler) => { + return new Promise((res, rej) => { + const wrappedResolve = response => { + if (response.html) { + cache[data.source] = response; + } + return res({ + url: data.source, + html: response.html ? response.html : dataToHtml(data) + }); + }; + if (cache[data.source]) { + wrappedResolve(cache[data.source]); + } else { + handler({ url: data.source }, wrappedResolve, rej); + } + }); + }; + const defaultPromise = (data, dataToHtml) => Promise.resolve({ + html: dataToHtml(data), + url: data.source + }); + const loadedData = editor => data => dataToHtml(editor, data); + const getEmbedHtml = (editor, data) => { + const embedHandler = getUrlResolver(editor); + return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor)); + }; + const isCached = url => has(cache, url); + + const extractMeta = (sourceInput, data) => get$1(data, sourceInput).bind(mainData => get$1(mainData, 'meta')); + const getValue = (data, metaData, sourceInput) => prop => { + const getFromData = () => get$1(data, prop); + const getFromMetaData = () => get$1(metaData, prop); + const getNonEmptyValue = c => get$1(c, 'value').bind(v => v.length > 0 ? Optional.some(v) : Optional.none()); + const getFromValueFirst = () => getFromData().bind(child => isObject(child) ? getNonEmptyValue(child).orThunk(getFromMetaData) : getFromMetaData().orThunk(() => Optional.from(child))); + const getFromMetaFirst = () => getFromMetaData().orThunk(() => getFromData().bind(child => isObject(child) ? getNonEmptyValue(child) : Optional.from(child))); + return { [prop]: (prop === sourceInput ? getFromValueFirst() : getFromMetaFirst()).getOr('') }; + }; + const getDimensions = (data, metaData) => { + const dimensions = {}; + get$1(data, 'dimensions').each(dims => { + each$1([ + 'width', + 'height' + ], prop => { + get$1(metaData, prop).orThunk(() => get$1(dims, prop)).each(value => dimensions[prop] = value); + }); + }); + return dimensions; + }; + const unwrap = (data, sourceInput) => { + const metaData = sourceInput && sourceInput !== 'dimensions' ? extractMeta(sourceInput, data).getOr({}) : {}; + const get = getValue(data, metaData, sourceInput); + return { + ...get('source'), + ...get('altsource'), + ...get('poster'), + ...get('embed'), + ...getDimensions(data, metaData) + }; + }; + const wrap = data => { + const wrapped = { + ...data, + source: { value: get$1(data, 'source').getOr('') }, + altsource: { value: get$1(data, 'altsource').getOr('') }, + poster: { value: get$1(data, 'poster').getOr('') } + }; + each$1([ + 'width', + 'height' + ], prop => { + get$1(data, prop).each(value => { + const dimensions = wrapped.dimensions || {}; + dimensions[prop] = value; + wrapped.dimensions = dimensions; + }); + }); + return wrapped; + }; + const handleError = editor => error => { + const errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.'; + editor.notificationManager.open({ + type: 'error', + text: errorMessage + }); + }; + const getEditorData = editor => { + const element = editor.selection.getNode(); + const snippet = isMediaElement(element) ? editor.serializer.serialize(element, { selection: true }) : ''; + const data = htmlToData(snippet, editor.schema); + const getDimensionsOfElement = () => { + if (isEmbedIframe(data.source, data.type)) { + const rect = editor.dom.getRect(element); + return { + width: rect.w.toString().replace(/px$/, ''), + height: rect.h.toString().replace(/px$/, '') + }; + } else { + return {}; + } + }; + const dimensions = getDimensionsOfElement(); + return { + embed: snippet, + ...data, + ...dimensions + }; + }; + const addEmbedHtml = (api, editor) => response => { + if (isString(response.url) && response.url.trim().length > 0) { + const html = response.html; + const snippetData = htmlToData(html, editor.schema); + const nuData = { + ...snippetData, + source: response.url, + embed: html + }; + api.setData(wrap(nuData)); + } + }; + const selectPlaceholder = (editor, beforeObjects) => { + const afterObjects = editor.dom.select('*[data-mce-object]'); + for (let i = 0; i < beforeObjects.length; i++) { + for (let y = afterObjects.length - 1; y >= 0; y--) { + if (beforeObjects[i] === afterObjects[y]) { + afterObjects.splice(y, 1); + } + } + } + editor.selection.select(afterObjects[0]); + }; + const handleInsert = (editor, html) => { + const beforeObjects = editor.dom.select('*[data-mce-object]'); + editor.insertContent(html); + selectPlaceholder(editor, beforeObjects); + editor.nodeChanged(); + }; + const isEmbedIframe = (url, mediaDataType) => isNonNullable(mediaDataType) && mediaDataType === 'ephox-embed-iri' && isNonNullable(matchPattern(url)); + const shouldInsertAsNewIframe = (prevData, newData) => { + const hasDimensionsChanged = (prevData, newData) => prevData.width !== newData.width || prevData.height !== newData.height; + return hasDimensionsChanged(prevData, newData) && isEmbedIframe(newData.source, prevData.type); + }; + const submitForm = (prevData, newData, editor) => { + var _a; + newData.embed = shouldInsertAsNewIframe(prevData, newData) && hasDimensions(editor) ? dataToHtml(editor, { + ...newData, + embed: '' + }) : updateHtml((_a = newData.embed) !== null && _a !== void 0 ? _a : '', newData, false, editor.schema); + if (newData.embed && (prevData.source === newData.source || isCached(newData.source))) { + handleInsert(editor, newData.embed); + } else { + getEmbedHtml(editor, newData).then(response => { + handleInsert(editor, response.html); + }).catch(handleError(editor)); + } + }; + const showDialog = editor => { + const editorData = getEditorData(editor); + const currentData = Cell(editorData); + const initialData = wrap(editorData); + const handleSource = (prevData, api) => { + const serviceData = unwrap(api.getData(), 'source'); + if (prevData.source !== serviceData.source) { + addEmbedHtml(win, editor)({ + url: serviceData.source, + html: '' + }); + getEmbedHtml(editor, serviceData).then(addEmbedHtml(win, editor)).catch(handleError(editor)); + } + }; + const handleEmbed = api => { + var _a; + const data = unwrap(api.getData()); + const dataFromEmbed = htmlToData((_a = data.embed) !== null && _a !== void 0 ? _a : '', editor.schema); + api.setData(wrap(dataFromEmbed)); + }; + const handleUpdate = (api, sourceInput, prevData) => { + const dialogData = unwrap(api.getData(), sourceInput); + const data = shouldInsertAsNewIframe(prevData, dialogData) && hasDimensions(editor) ? { + ...dialogData, + embed: '' + } : dialogData; + const embed = dataToHtml(editor, data); + api.setData(wrap({ + ...data, + embed + })); + }; + const mediaInput = [{ + name: 'source', + type: 'urlinput', + filetype: 'media', + label: 'Source' + }]; + const sizeInput = !hasDimensions(editor) ? [] : [{ + type: 'sizeinput', + name: 'dimensions', + label: 'Constrain proportions', + constrain: true + }]; + const generalTab = { + title: 'General', + name: 'general', + items: flatten([ + mediaInput, + sizeInput + ]) + }; + const embedTextarea = { + type: 'textarea', + name: 'embed', + label: 'Paste your embed code below:' + }; + const embedTab = { + title: 'Embed', + items: [embedTextarea] + }; + const advancedFormItems = []; + if (hasAltSource(editor)) { + advancedFormItems.push({ + name: 'altsource', + type: 'urlinput', + filetype: 'media', + label: 'Alternative source URL' + }); + } + if (hasPoster(editor)) { + advancedFormItems.push({ + name: 'poster', + type: 'urlinput', + filetype: 'image', + label: 'Media poster (Image URL)' + }); + } + const advancedTab = { + title: 'Advanced', + name: 'advanced', + items: advancedFormItems + }; + const tabs = [ + generalTab, + embedTab + ]; + if (advancedFormItems.length > 0) { + tabs.push(advancedTab); + } + const body = { + type: 'tabpanel', + tabs + }; + const win = editor.windowManager.open({ + title: 'Insert/Edit Media', + size: 'normal', + body, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + onSubmit: api => { + const serviceData = unwrap(api.getData()); + submitForm(currentData.get(), serviceData, editor); + api.close(); + }, + onChange: (api, detail) => { + switch (detail.name) { + case 'source': + handleSource(currentData.get(), api); + break; + case 'embed': + handleEmbed(api); + break; + case 'dimensions': + case 'altsource': + case 'poster': + handleUpdate(api, detail.name, currentData.get()); + break; + } + currentData.set(unwrap(api.getData())); + }, + initialData + }); + }; + + const get = editor => { + const showDialog$1 = () => { + showDialog(editor); + }; + return { showDialog: showDialog$1 }; + }; + + const register$1 = editor => { + const showDialog$1 = () => { + showDialog(editor); + }; + editor.addCommand('mceMedia', showDialog$1); + }; + + const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; + const startsWith = (str, prefix) => { + return checkRange(str, prefix, 0); + }; + + var global = tinymce.util.Tools.resolve('tinymce.Env'); + + const isLiveEmbedNode = node => { + const name = node.name; + return name === 'iframe' || name === 'video' || name === 'audio'; + }; + const getDimension = (node, styles, dimension, defaultValue = null) => { + const value = node.attr(dimension); + if (isNonNullable(value)) { + return value; + } else if (!has(styles, dimension)) { + return defaultValue; + } else { + return null; + } + }; + const setDimensions = (node, previewNode, styles) => { + const useDefaults = previewNode.name === 'img' || node.name === 'video'; + const defaultWidth = useDefaults ? '300' : null; + const fallbackHeight = node.name === 'audio' ? '30' : '150'; + const defaultHeight = useDefaults ? fallbackHeight : null; + previewNode.attr({ + width: getDimension(node, styles, 'width', defaultWidth), + height: getDimension(node, styles, 'height', defaultHeight) + }); + }; + const appendNodeContent = (editor, nodeName, previewNode, html) => { + const newNode = Parser(editor.schema).parse(html, { context: nodeName }); + while (newNode.firstChild) { + previewNode.append(newNode.firstChild); + } + }; + const createPlaceholderNode = (editor, node) => { + const name = node.name; + const placeHolder = new global$2('img', 1); + retainAttributesAndInnerHtml(editor, node, placeHolder); + setDimensions(node, placeHolder, {}); + placeHolder.attr({ + 'style': node.attr('style'), + 'src': global.transparentSrc, + 'data-mce-object': name, + 'class': 'mce-object mce-object-' + name + }); + return placeHolder; + }; + const createPreviewNode = (editor, node) => { + var _a; + const name = node.name; + const previewWrapper = new global$2('span', 1); + previewWrapper.attr({ + 'contentEditable': 'false', + 'style': node.attr('style'), + 'data-mce-object': name, + 'class': 'mce-preview-object mce-object-' + name + }); + retainAttributesAndInnerHtml(editor, node, previewWrapper); + const styles = editor.dom.parseStyle((_a = node.attr('style')) !== null && _a !== void 0 ? _a : ''); + const previewNode = new global$2(name, 1); + setDimensions(node, previewNode, styles); + previewNode.attr({ + src: node.attr('src'), + style: node.attr('style'), + class: node.attr('class') + }); + if (name === 'iframe') { + previewNode.attr({ + allowfullscreen: node.attr('allowfullscreen'), + frameborder: '0' + }); + } else { + const attrs = [ + 'controls', + 'crossorigin', + 'currentTime', + 'loop', + 'muted', + 'poster', + 'preload' + ]; + each$1(attrs, attrName => { + previewNode.attr(attrName, node.attr(attrName)); + }); + const sanitizedHtml = previewWrapper.attr('data-mce-html'); + if (isNonNullable(sanitizedHtml)) { + appendNodeContent(editor, name, previewNode, unescape(sanitizedHtml)); + } + } + const shimNode = new global$2('span', 1); + shimNode.attr('class', 'mce-shim'); + previewWrapper.append(previewNode); + previewWrapper.append(shimNode); + return previewWrapper; + }; + const retainAttributesAndInnerHtml = (editor, sourceNode, targetNode) => { + var _a; + const attribs = (_a = sourceNode.attributes) !== null && _a !== void 0 ? _a : []; + let ai = attribs.length; + while (ai--) { + const attrName = attribs[ai].name; + let attrValue = attribs[ai].value; + if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style' && !startsWith(attrName, 'data-mce-')) { + if (attrName === 'data' || attrName === 'src') { + attrValue = editor.convertURL(attrValue, attrName); + } + targetNode.attr('data-mce-p-' + attrName, attrValue); + } + } + const serializer = global$1({ inner: true }, editor.schema); + const tempNode = new global$2('div', 1); + each$1(sourceNode.children(), child => tempNode.append(child)); + const innerHtml = serializer.serialize(tempNode); + if (innerHtml) { + targetNode.attr('data-mce-html', escape(innerHtml)); + targetNode.empty(); + } + }; + const isPageEmbedWrapper = node => { + const nodeClass = node.attr('class'); + return isString(nodeClass) && /\btiny-pageembed\b/.test(nodeClass); + }; + const isWithinEmbedWrapper = node => { + let tempNode = node; + while (tempNode = tempNode.parent) { + if (tempNode.attr('data-ephox-embed-iri') || isPageEmbedWrapper(tempNode)) { + return true; + } + } + return false; + }; + const placeHolderConverter = editor => nodes => { + let i = nodes.length; + let node; + while (i--) { + node = nodes[i]; + if (!node.parent) { + continue; + } + if (node.parent.attr('data-mce-object')) { + continue; + } + if (isLiveEmbedNode(node) && hasLiveEmbeds(editor)) { + if (!isWithinEmbedWrapper(node)) { + node.replace(createPreviewNode(editor, node)); + } + } else { + if (!isWithinEmbedWrapper(node)) { + node.replace(createPlaceholderNode(editor, node)); + } + } + } + }; + + const parseAndSanitize = (editor, context, html) => { + const getEditorOption = editor.options.get; + const sanitize = getEditorOption('xss_sanitization'); + const validate = shouldFilterHtml(editor); + return Parser(editor.schema, { + sanitize, + validate + }).parse(html, { context }); + }; + + const setup$1 = editor => { + editor.on('PreInit', () => { + const {schema, serializer, parser} = editor; + const boolAttrs = schema.getBoolAttrs(); + each$1('webkitallowfullscreen mozallowfullscreen'.split(' '), name => { + boolAttrs[name] = {}; + }); + each({ embed: ['wmode'] }, (attrs, name) => { + const rule = schema.getElementRule(name); + if (rule) { + each$1(attrs, attr => { + rule.attributes[attr] = {}; + rule.attributesOrder.push(attr); + }); + } + }); + parser.addNodeFilter('iframe,video,audio,object,embed,script', placeHolderConverter(editor)); + serializer.addAttributeFilter('data-mce-object', (nodes, name) => { + var _a; + let i = nodes.length; + while (i--) { + const node = nodes[i]; + if (!node.parent) { + continue; + } + const realElmName = node.attr(name); + const realElm = new global$2(realElmName, 1); + if (realElmName !== 'audio' && realElmName !== 'script') { + const className = node.attr('class'); + if (className && className.indexOf('mce-preview-object') !== -1 && node.firstChild) { + realElm.attr({ + width: node.firstChild.attr('width'), + height: node.firstChild.attr('height') + }); + } else { + realElm.attr({ + width: node.attr('width'), + height: node.attr('height') + }); + } + } + realElm.attr({ style: node.attr('style') }); + const attribs = (_a = node.attributes) !== null && _a !== void 0 ? _a : []; + let ai = attribs.length; + while (ai--) { + const attrName = attribs[ai].name; + if (attrName.indexOf('data-mce-p-') === 0) { + realElm.attr(attrName.substr(11), attribs[ai].value); + } + } + if (realElmName === 'script') { + realElm.attr('type', 'text/javascript'); + } + const innerHtml = node.attr('data-mce-html'); + if (innerHtml) { + const fragment = parseAndSanitize(editor, realElmName, unescape(innerHtml)); + each$1(fragment.children(), child => realElm.append(child)); + } + node.replace(realElm); + } + }); + }); + editor.on('SetContent', () => { + const dom = editor.dom; + each$1(dom.select('span.mce-preview-object'), elm => { + if (dom.select('span.mce-shim', elm).length === 0) { + dom.add(elm, 'span', { class: 'mce-shim' }); + } + }); + }); + }; + + const setup = editor => { + editor.on('ResolveName', e => { + let name; + if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) { + e.name = name; + } + }); + }; + + const onSetupEditable = editor => api => { + const nodeChanged = () => { + api.setEnabled(editor.selection.isEditable()); + }; + editor.on('NodeChange', nodeChanged); + nodeChanged(); + return () => { + editor.off('NodeChange', nodeChanged); + }; + }; + const register = editor => { + const onAction = () => editor.execCommand('mceMedia'); + editor.ui.registry.addToggleButton('media', { + tooltip: 'Insert/edit media', + icon: 'embed', + onAction, + onSetup: buttonApi => { + const selection = editor.selection; + buttonApi.setActive(isMediaElement(selection.getNode())); + const unbindSelectorChanged = selection.selectorChangedWithUnbind('img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]', buttonApi.setActive).unbind; + const unbindEditable = onSetupEditable(editor)(buttonApi); + return () => { + unbindSelectorChanged(); + unbindEditable(); + }; + } + }); + editor.ui.registry.addMenuItem('media', { + icon: 'embed', + text: 'Media...', + onAction, + onSetup: onSetupEditable(editor) + }); + }; + + var Plugin = () => { + global$6.add('media', editor => { + register$2(editor); + register$1(editor); + register(editor); + setup(editor); + setup$1(editor); + setup$2(editor); + return get(editor); + }); + }; + + Plugin(); + +})(); diff --git a/public/vendors/tinymce/tinymce/plugins/media/plugin.min.js b/public/vendors/tinymce/tinymce/plugins/media/plugin.min.js new file mode 100644 index 0000000..78ec5b0 --- /dev/null +++ b/public/vendors/tinymce/tinymce/plugins/media/plugin.min.js @@ -0,0 +1,4 @@ +/** + * TinyMCE version 6.6.0 (2023-07-12) + */ +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":t;var r,o,a,s})(t)===e,r=t("string"),o=t("object"),a=t("array"),s=e=>!(e=>null==e)(e);class i{constructor(e,t){this.tag=e,this.value=t}static some(e){return new i(!0,e)}static none(){return i.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?i.some(e(this.value)):i.none()}bind(e){return this.tag?e(this.value):i.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:i.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return s(e)?i.some(e):i.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}i.singletonNone=new i(!1);const n=Array.prototype.push,c=(e,t)=>{for(let r=0,o=e.length;r{const t=[];for(let r=0,o=e.length;rh(e,t)?i.from(e[t]):i.none(),h=(e,t)=>u.call(e,t),p=e=>t=>t.options.get(e),g=p("audio_template_callback"),b=p("video_template_callback"),w=p("iframe_template_callback"),v=p("media_live_embeds"),y=p("media_filter_html"),f=p("media_url_resolver"),x=p("media_alt_source"),_=p("media_poster"),j=p("media_dimensions");var k=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),A=tinymce.util.Tools.resolve("tinymce.html.DomParser");const S=O.DOM,$=e=>e.replace(/px$/,""),C=e=>{const t=e.attr("style"),r=t?S.parseStyle(t):{};return{type:"ephox-embed-iri",source:e.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:d(r,"max-width").map($).getOr(""),height:d(r,"max-height").map($).getOr("")}},D=(e,t)=>{let r={};for(let o=A({validate:!1,forced_root_block:!1},t).parse(e);o;o=o.walk())if(1===o.type){const e=o.name;if(o.attr("data-ephox-embed-iri")){r=C(o);break}r.source||"param"!==e||(r.source=o.attr("movie")),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(r.type||(r.type=e),r=k.extend(o.attributes.map,r)),"script"===e&&(r={type:"script",source:o.attr("src")}),"source"===e&&(r.source?r.altsource||(r.altsource=o.attr("src")):r.source=o.attr("src")),"img"!==e||r.poster||(r.poster=o.attr("src"))}return r.source=r.source||r.src||"",r.altsource=r.altsource||"",r.poster=r.poster||"",r},T=e=>{var t;const r=null!==(t=e.toLowerCase().split(".").pop())&&void 0!==t?t:"";return d({mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"},r).getOr("")};var z=tinymce.util.Tools.resolve("tinymce.html.Node"),F=tinymce.util.Tools.resolve("tinymce.html.Serializer");const M=(e,t={})=>A({forced_root_block:!1,validate:!1,allow_conditional_comments:!0,...t},e),N=O.DOM,R=e=>/^[0-9.]+$/.test(e)?e+"px":e,E=(e,t)=>{const r=t.attr("style"),o=r?N.parseStyle(r):{};s(e.width)&&(o["max-width"]=R(e.width)),s(e.height)&&(o["max-height"]=R(e.height)),t.attr("style",N.serializeStyle(o))},U=["source","altsource"],P=(e,t,r,o)=>{let a=0,s=0;const i=M(o);i.addNodeFilter("source",(e=>a=e.length));const n=i.parse(e);for(let e=n;e;e=e.walk())if(1===e.type){const o=e.name;if(e.attr("data-ephox-embed-iri")){E(t,e);break}switch(o){case"video":case"object":case"embed":case"img":case"iframe":void 0!==t.height&&void 0!==t.width&&(e.attr("width",t.width),e.attr("height",t.height))}if(r)switch(o){case"video":e.attr("poster",t.poster),e.attr("src",null);for(let r=a;r<2;r++)if(t[U[r]]){const o=new z("source",1);o.attr("src",t[U[r]]),o.attr("type",t[U[r]+"mime"]||null),e.append(o)}break;case"iframe":e.attr("src",t.source);break;case"object":const r=e.getAll("img").length>0;if(t.poster&&!r){e.attr("src",t.poster);const r=new z("img",1);r.attr("src",t.poster),r.attr("width",t.width),r.attr("height",t.height),e.append(r)}break;case"source":if(s<2&&(e.attr("src",t[U[s]]),e.attr("type",t[U[s]+"mime"]||null),!t[U[s]])){e.remove();continue}s++;break;case"img":t.poster||e.remove()}}return F({},o).serialize(n)},L=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?h=$2&title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?h=$3&title=0&byline=0",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],I=(e,t)=>{const r=(e=>{const t=e.match(/^(https?:\/\/|www\.)(.+)$/i);return t&&t.length>1?"www."===t[1]?"https://":t[1]:"https://"})(t),o=e.regex.exec(t);let a=r+e.url;if(s(o))for(let e=0;eo[e]?o[e]:""));return a.replace(/\?$/,"")},B=e=>{const t=L.filter((t=>t.regex.test(e)));return t.length>0?k.extend({},t[0],{url:I(t[0],e)}):null},G=(e,t)=>{var r;const o=k.extend({},t);if(!o.source&&(k.extend(o,D(null!==(r=o.embed)&&void 0!==r?r:"",e.schema)),!o.source))return"";o.altsource||(o.altsource=""),o.poster||(o.poster=""),o.source=e.convertURL(o.source,"source"),o.altsource=e.convertURL(o.altsource,"source"),o.sourcemime=T(o.source),o.altsourcemime=T(o.altsource),o.poster=e.convertURL(o.poster,"poster");const a=B(o.source);if(a&&(o.source=a.url,o.type=a.type,o.allowfullscreen=a.allowFullscreen,o.width=o.width||String(a.w),o.height=o.height||String(a.h)),o.embed)return P(o.embed,o,!0,e.schema);{const t=g(e),r=b(e),a=w(e);return o.width=o.width||"300",o.height=o.height||"150",k.each(o,((t,r)=>{o[r]=e.dom.encode(""+t)})),"iframe"===o.type?((e,t)=>{if(t)return t(e);{const t=e.allowfullscreen?' allowFullscreen="1"':"";return'"}})(o,a):"application/x-shockwave-flash"===o.sourcemime?(e=>{let t='';return e.poster&&(t+=''),t+="",t})(o):-1!==o.sourcemime.indexOf("audio")?((e,t)=>t?t(e):'")(o,t):"script"===o.type?(e=>' '; + const directionality = editor.getBody().dir; + const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; + const previewHtml = '' + '' + '' + headHtml + '' + '' + editor.getContent() + preventClicksOnLinksScript + '' + ''; + return previewHtml; + }; + + const open = editor => { + const content = getPreviewHtml(editor); + const dataApi = editor.windowManager.open({ + title: 'Preview', + size: 'large', + body: { + type: 'panel', + items: [{ + name: 'preview', + type: 'iframe', + sandboxed: true, + transparent: false + }] + }, + buttons: [{ + type: 'cancel', + name: 'close', + text: 'Close', + primary: true + }], + initialData: { preview: content } + }); + dataApi.focus('close'); + }; + + const register$1 = editor => { + editor.addCommand('mcePreview', () => { + open(editor); + }); + }; + + const register = editor => { + const onAction = () => editor.execCommand('mcePreview'); + editor.ui.registry.addButton('preview', { + icon: 'preview', + tooltip: 'Preview', + onAction + }); + editor.ui.registry.addMenuItem('preview', { + icon: 'preview', + text: 'Preview', + onAction + }); + }; + + var Plugin = () => { + global$2.add('preview', editor => { + register$1(editor); + register(editor); + }); + }; + + Plugin(); + +})(); diff --git a/public/vendors/tinymce/tinymce/plugins/preview/plugin.min.js b/public/vendors/tinymce/tinymce/plugins/preview/plugin.min.js new file mode 100644 index 0000000..941319a --- /dev/null +++ b/public/vendors/tinymce/tinymce/plugins/preview/plugin.min.js @@ -0,0 +1,4 @@ +/** + * TinyMCE version 6.6.0 (2023-07-12) + */ +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),o=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=e=>t=>t.options.get(e),i=n("content_style"),s=n("content_css_cors"),c=n("body_class"),r=n("body_id");e.add("preview",(e=>{(e=>{e.addCommand("mcePreview",(()=>{(e=>{const n=(e=>{var n;let l="";const a=e.dom.encode,d=null!==(n=i(e))&&void 0!==n?n:"";l+='';const m=s(e)?' crossorigin="anonymous"':"";o.each(e.contentCSS,(t=>{l+='"})),d&&(l+='");const y=r(e),u=c(e),v=' '; + const directionality = editor.getBody().dir; + const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : ''; + previewHtml = '' + '' + '' + '' + contentCssEntries + preventClicksOnLinksScript + '' + '' + previewHtml + '' + ''; + } + return replaceTemplateValues(previewHtml, getPreviewReplaceValues(editor)); + }; + const open = (editor, templateList) => { + const createTemplates = () => { + if (!templateList || templateList.length === 0) { + const message = editor.translate('No templates defined.'); + editor.notificationManager.open({ + text: message, + type: 'info' + }); + return Optional.none(); + } + return Optional.from(global$2.map(templateList, (template, index) => { + const isUrlTemplate = t => t.url !== undefined; + return { + selected: index === 0, + text: template.title, + value: { + url: isUrlTemplate(template) ? Optional.from(template.url) : Optional.none(), + content: !isUrlTemplate(template) ? Optional.from(template.content) : Optional.none(), + description: template.description + } + }; + })); + }; + const createSelectBoxItems = templates => map(templates, t => ({ + text: t.text, + value: t.text + })); + const findTemplate = (templates, templateTitle) => find(templates, t => t.text === templateTitle); + const loadFailedAlert = api => { + editor.windowManager.alert('Could not load the specified template.', () => api.focus('template')); + }; + const getTemplateContent = t => t.value.url.fold(() => Promise.resolve(t.value.content.getOr('')), url => fetch(url).then(res => res.ok ? res.text() : Promise.reject())); + const onChange = (templates, updateDialog) => (api, change) => { + if (change.name === 'template') { + const newTemplateTitle = api.getData().template; + findTemplate(templates, newTemplateTitle).each(t => { + api.block('Loading...'); + getTemplateContent(t).then(previewHtml => { + updateDialog(api, t, previewHtml); + }).catch(() => { + updateDialog(api, t, ''); + api.setEnabled('save', false); + loadFailedAlert(api); + }); + }); + } + }; + const onSubmit = templates => api => { + const data = api.getData(); + findTemplate(templates, data.template).each(t => { + getTemplateContent(t).then(previewHtml => { + editor.execCommand('mceInsertTemplate', false, previewHtml); + api.close(); + }).catch(() => { + api.setEnabled('save', false); + loadFailedAlert(api); + }); + }); + }; + const openDialog = templates => { + const selectBoxItems = createSelectBoxItems(templates); + const buildDialogSpec = (bodyItems, initialData) => ({ + title: 'Insert Template', + size: 'large', + body: { + type: 'panel', + items: bodyItems + }, + initialData, + buttons: [ + { + type: 'cancel', + name: 'cancel', + text: 'Cancel' + }, + { + type: 'submit', + name: 'save', + text: 'Save', + primary: true + } + ], + onSubmit: onSubmit(templates), + onChange: onChange(templates, updateDialog) + }); + const updateDialog = (dialogApi, template, previewHtml) => { + const content = getPreviewContent(editor, previewHtml); + const bodyItems = [ + { + type: 'listbox', + name: 'template', + label: 'Templates', + items: selectBoxItems + }, + { + type: 'htmlpanel', + html: `

${ htmlEscape(template.value.description) }

` + }, + { + label: 'Preview', + type: 'iframe', + name: 'preview', + sandboxed: false, + transparent: false + } + ]; + const initialData = { + template: template.text, + preview: content + }; + dialogApi.unblock(); + dialogApi.redial(buildDialogSpec(bodyItems, initialData)); + dialogApi.focus('template'); + }; + const dialogApi = editor.windowManager.open(buildDialogSpec([], { + template: '', + preview: '' + })); + dialogApi.block('Loading...'); + getTemplateContent(templates[0]).then(previewHtml => { + updateDialog(dialogApi, templates[0], previewHtml); + }).catch(() => { + updateDialog(dialogApi, templates[0], ''); + dialogApi.setEnabled('save', false); + loadFailedAlert(dialogApi); + }); + }; + const optTemplates = createTemplates(); + optTemplates.each(openDialog); + }; + + const showDialog = editor => templates => { + open(editor, templates); + }; + const register$1 = editor => { + editor.addCommand('mceInsertTemplate', curry(insertTemplate, editor)); + editor.addCommand('mceTemplate', createTemplateList(editor, showDialog(editor))); + }; + + const setup = editor => { + editor.on('PreProcess', o => { + const dom = editor.dom, dateFormat = getMdateFormat(editor); + global$2.each(dom.select('div', o.node), e => { + if (dom.hasClass(e, 'mceTmpl')) { + global$2.each(dom.select('*', e), e => { + if (hasAnyClasses(dom, e, getModificationDateClasses(editor))) { + e.innerHTML = getDateTime(editor, dateFormat); + } + }); + replaceVals(editor, e); + } + }); + }); + }; + + const onSetupEditable = editor => api => { + const nodeChanged = () => { + api.setEnabled(editor.selection.isEditable()); + }; + editor.on('NodeChange', nodeChanged); + nodeChanged(); + return () => { + editor.off('NodeChange', nodeChanged); + }; + }; + const register = editor => { + const onAction = () => editor.execCommand('mceTemplate'); + editor.ui.registry.addButton('template', { + icon: 'template', + tooltip: 'Insert template', + onSetup: onSetupEditable(editor), + onAction + }); + editor.ui.registry.addMenuItem('template', { + icon: 'template', + text: 'Insert template...', + onSetup: onSetupEditable(editor), + onAction + }); + }; + + var Plugin = () => { + global$3.add('template', editor => { + register$2(editor); + register(editor); + register$1(editor); + setup(editor); + }); + }; + + Plugin(); + +})(); diff --git a/public/vendors/tinymce/tinymce/plugins/template/plugin.min.js b/public/vendors/tinymce/tinymce/plugins/template/plugin.min.js new file mode 100644 index 0000000..528dd06 --- /dev/null +++ b/public/vendors/tinymce/tinymce/plugins/template/plugin.min.js @@ -0,0 +1,4 @@ +/** + * TinyMCE version 6.6.0 (2023-07-12) + */ +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(a=n=e,(r=String).prototype.isPrototypeOf(a)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var a,n,r,s})(t)===e,a=t("string"),n=t("object"),r=t("array"),s=("function",e=>"function"==typeof e);const l=(!1,()=>false);var o=tinymce.util.Tools.resolve("tinymce.util.Tools");const c=e=>t=>t.options.get(e),i=c("template_cdate_classes"),u=c("template_mdate_classes"),m=c("template_selected_content_classes"),p=c("template_preview_replace_values"),d=c("template_replace_values"),h=c("templates"),g=c("template_cdate_format"),v=c("template_mdate_format"),f=c("content_style"),y=c("content_css_cors"),b=c("body_class"),_=(e,t)=>{if((e=""+e).length{const n="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),l="January February March April May June July August September October November December".split(" ");return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+a.getFullYear())).replace("%y",""+a.getYear())).replace("%m",_(a.getMonth()+1,2))).replace("%d",_(a.getDate(),2))).replace("%H",""+_(a.getHours(),2))).replace("%M",""+_(a.getMinutes(),2))).replace("%S",""+_(a.getSeconds(),2))).replace("%I",""+((a.getHours()+11)%12+1))).replace("%p",a.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(l[a.getMonth()]))).replace("%b",""+e.translate(s[a.getMonth()]))).replace("%A",""+e.translate(r[a.getDay()]))).replace("%a",""+e.translate(n[a.getDay()]))).replace("%%","%")};class T{constructor(e,t){this.tag=e,this.value=t}static some(e){return new T(!0,e)}static none(){return T.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?T.some(e(this.value)):T.none()}bind(e){return this.tag?e(this.value):T.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:T.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return null==e?T.none():T.some(e)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}T.singletonNone=new T(!1);const S=Object.hasOwnProperty;var x=tinymce.util.Tools.resolve("tinymce.html.Serializer");const C={'"':""","<":"<",">":">","&":"&","'":"'"},w=e=>e.replace(/["'<>&]/g,(e=>{return(t=C,a=e,((e,t)=>S.call(e,t))(t,a)?T.from(t[a]):T.none()).getOr(e);var t,a})),O=(e,t,a)=>((a,n)=>{for(let n=0,s=a.length;nx({validate:!0},e.schema).serialize(e.parser.parse(t,{insert:!0})),D=(e,t)=>(o.each(t,((t,a)=>{s(t)&&(t=t(a)),e=e.replace(new RegExp("\\{\\$"+a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\}","g"),t)})),e),N=(e,t)=>{const a=e.dom,n=d(e);o.each(a.select("*",t),(e=>{o.each(n,((t,n)=>{a.hasClass(e,n)&&s(t)&&t(e)}))}))},I=(e,t,a)=>{const n=e.dom,r=e.selection.getContent();a=D(a,d(e));let s=n.create("div",{},A(e,a));const l=n.select(".mceTmpl",s);l&&l.length>0&&(s=n.create("div"),s.appendChild(l[0].cloneNode(!0))),o.each(n.select("*",s),(t=>{O(n,t,i(e))&&(t.innerHTML=M(e,g(e))),O(n,t,u(e))&&(t.innerHTML=M(e,v(e))),O(n,t,m(e))&&(t.innerHTML=r)})),N(e,s),e.execCommand("mceInsertContent",!1,s.innerHTML),e.addVisual()};var E=tinymce.util.Tools.resolve("tinymce.Env");const k=(e,t)=>{const a=(e,t)=>((e,t,a)=>{for(let n=0,r=e.length;ne.text===t),l),n=t=>{e.windowManager.alert("Could not load the specified template.",(()=>t.focus("template")))},r=e=>e.value.url.fold((()=>Promise.resolve(e.value.content.getOr(""))),(e=>fetch(e).then((e=>e.ok?e.text():Promise.reject())))),s=(e,t)=>(s,l)=>{if("template"===l.name){const l=s.getData().template;a(e,l).each((e=>{s.block("Loading..."),r(e).then((a=>{t(s,e,a)})).catch((()=>{t(s,e,""),s.setEnabled("save",!1),n(s)}))}))}},c=t=>s=>{const l=s.getData();a(t,l.template).each((t=>{r(t).then((t=>{e.execCommand("mceInsertTemplate",!1,t),s.close()})).catch((()=>{s.setEnabled("save",!1),n(s)}))}))};(()=>{if(!t||0===t.length){const t=e.translate("No templates defined.");return e.notificationManager.open({text:t,type:"info"}),T.none()}return T.from(o.map(t,((e,t)=>{const a=e=>void 0!==e.url;return{selected:0===t,text:e.title,value:{url:a(e)?T.from(e.url):T.none(),content:a(e)?T.none():T.from(e.content),description:e.description}}})))})().each((t=>{const a=(e=>((e,t)=>{const a=e.length,n=new Array(a);for(let t=0;t({title:"Insert Template",size:"large",body:{type:"panel",items:e},initialData:a,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:c(t),onChange:s(t,i)}),i=(t,n,r)=>{const s=((e,t)=>{var a;let n=A(e,t);if(-1===t.indexOf("")){let t="";const r=null!==(a=f(e))&&void 0!==a?a:"",s=y(e)?' crossorigin="anonymous"':"";o.each(e.contentCSS,(a=>{t+='"})),r&&(t+='");const l=b(e),c=e.dom.encode,i='