retold-data-service 2.0.21 → 2.0.23

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.
Files changed (37) hide show
  1. package/.quackage-comprehension-loader.json +19 -0
  2. package/bin/retold-data-service-clone.js +4 -1
  3. package/generate-bookstore-comprehension.js +645 -0
  4. package/package.json +7 -7
  5. package/source/Retold-Data-Service.js +30 -2
  6. package/source/services/comprehension-loader/ComprehensionLoader-Command-Load.js +345 -0
  7. package/source/services/comprehension-loader/ComprehensionLoader-Command-Schema.js +97 -0
  8. package/source/services/comprehension-loader/ComprehensionLoader-Command-Session.js +221 -0
  9. package/source/services/comprehension-loader/ComprehensionLoader-Command-WebUI.js +57 -0
  10. package/source/services/comprehension-loader/Retold-Data-Service-ComprehensionLoader.js +536 -0
  11. package/source/services/comprehension-loader/pict-app/Pict-Application-ComprehensionLoader-Configuration.json +9 -0
  12. package/source/services/comprehension-loader/pict-app/Pict-Application-ComprehensionLoader.js +86 -0
  13. package/source/services/comprehension-loader/pict-app/Pict-ComprehensionLoader-Bundle.js +6 -0
  14. package/source/services/comprehension-loader/pict-app/providers/Pict-Provider-ComprehensionLoader.js +760 -0
  15. package/source/services/comprehension-loader/pict-app/views/PictView-ComprehensionLoader-Layout.js +360 -0
  16. package/source/services/comprehension-loader/pict-app/views/PictView-ComprehensionLoader-Load.js +472 -0
  17. package/source/services/comprehension-loader/pict-app/views/PictView-ComprehensionLoader-Schema.js +119 -0
  18. package/source/services/comprehension-loader/pict-app/views/PictView-ComprehensionLoader-Session.js +269 -0
  19. package/source/services/comprehension-loader/pict-app/views/PictView-ComprehensionLoader-Source.js +330 -0
  20. package/source/services/comprehension-loader/web/comprehension-loader.js +6794 -0
  21. package/source/services/comprehension-loader/web/comprehension-loader.js.map +1 -0
  22. package/source/services/comprehension-loader/web/comprehension-loader.min.js +2 -0
  23. package/source/services/comprehension-loader/web/comprehension-loader.min.js.map +1 -0
  24. package/source/services/comprehension-loader/web/index.html +17 -0
  25. package/source/services/data-cloner/DataCloner-Command-Schema.js +407 -15
  26. package/source/services/data-cloner/Retold-Data-Service-DataCloner.js +59 -1
  27. package/source/services/data-cloner/pict-app/Pict-Application-DataCloner.js +1 -0
  28. package/source/services/data-cloner/pict-app/providers/Pict-Provider-DataCloner.js +125 -5
  29. package/source/services/data-cloner/pict-app/views/PictView-DataCloner-Connection.js +18 -8
  30. package/source/services/data-cloner/pict-app/views/PictView-DataCloner-Deploy.js +104 -1
  31. package/source/services/data-cloner/pict-app/views/PictView-DataCloner-Export.js +1 -1
  32. package/source/services/data-cloner/pict-app/views/PictView-DataCloner-Layout.js +12 -0
  33. package/source/services/data-cloner/web/data-cloner.js +201 -139
  34. package/source/services/data-cloner/web/data-cloner.js.map +1 -1
  35. package/source/services/data-cloner/web/data-cloner.min.js +1 -1
  36. package/source/services/data-cloner/web/data-cloner.min.js.map +1 -1
  37. package/test/RetoldDataService_tests.js +225 -0
@@ -0,0 +1,2 @@
1
+ "use strict";!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).comprehensionLoader=t()}}(function(){return function t(e,i,o){function s(r,a){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(n)return n(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var d=i[r]={exports:{}};e[r][0].call(d.exports,function(t){return s(e[r][1][t]||t)},d,d.exports,t,e,i,o)}return i[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)s(o[r]);return s}({1:[function(t,e,i){e.exports={name:"fable-serviceproviderbase",version:"3.0.19",description:"Simple base classes for fable services.",main:"source/Fable-ServiceProviderBase.js",scripts:{start:"node source/Fable-ServiceProviderBase.js",test:"npx quack test",tests:"npx quack test -g",coverage:"npx quack coverage",build:"npx quack build",types:"tsc -p ./tsconfig.build.json",check:"tsc -p . --noEmit"},types:"types/source/Fable-ServiceProviderBase.d.ts",mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},repository:{type:"git",url:"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},keywords:["entity","behavior"],author:"Steven Velozo <steven@velozo.com> (http://velozo.com/)",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},homepage:"https://github.com/stevenvelozo/fable-serviceproviderbase",devDependencies:{"@types/mocha":"^10.0.10",fable:"^3.1.62",quackage:"^1.0.58",typescript:"^5.9.3"}}},{}],2:[function(t,e,i){const o=t("../package.json");class s{constructor(t,e,i){this.fable,this.UUID,this.options,this.services,this.servicesMap,"object"==typeof t&&t.isFable?this.connectFable(t):this.fable=!1,this._PackageFableServiceProvider=o,this.fable?(this.UUID=t.getUUID(),this.options="object"==typeof e?e:{}):(this.options="object"!=typeof t||t.isFable?"object"==typeof e?e:{}:t,this.UUID=`CORE-SVC-${Math.floor(89999*Math.random()+1e4)}`),this.serviceType=`Unknown-${this.UUID}`,this.Hash="string"==typeof i?i:this.fable||"string"!=typeof e?`${this.UUID}`:e}connectFable(t){if("object"!=typeof t||!t.isFable){let e=`Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof t}].}`;return console.log(e),new Error(e)}return this.fable||(this.fable=t),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}static isFableService=!0}e.exports=s,e.exports.CoreServiceProviderBase=s},{"../package.json":1}],3:[function(t,e,i){e.exports={name:"pict-application",version:"1.0.33",description:"Application base class for a pict view-based application",main:"source/Pict-Application.js",scripts:{test:"npx quack test",start:"node source/Pict-Application.js",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-application-image:local","docker-dev-run":'docker run -it -d --name pict-application-dev -p 30001:8080 -p 38086:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-application" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-application-image:local',"docker-dev-shell":"docker exec -it pict-application-dev /bin/bash",tests:"npx quack test -g",lint:"eslint source/**",types:"tsc -p ."},types:"types/source/Pict-Application.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-application.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-application/issues"},homepage:"https://github.com/stevenvelozo/pict-application#readme",devDependencies:{"@eslint/js":"^9.28.0","browser-env":"^3.3.0",eslint:"^9.28.0",pict:"^1.0.348","pict-provider":"^1.0.10","pict-view":"^1.0.66",quackage:"^1.0.58",typescript:"^5.9.3"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},dependencies:{"fable-serviceproviderbase":"^3.0.19"}}},{}],4:[function(t,e,i){const o=t("fable-serviceproviderbase"),s=t("../package.json"),n={Name:"DefaultPictApplication",MainViewportViewIdentifier:"Default-View",MainViewportRenderableHash:!1,MainViewportDestinationAddress:!1,MainViewportDefaultDataAddress:!1,AutoSolveAfterInitialize:!0,AutoRenderMainViewportViewAfterInitialize:!0,AutoRenderViewsAfterInitialize:!1,AutoLoginAfterInitialize:!1,AutoLoadDataAfterLogin:!1,ConfigurationOnlyViews:[],Manifests:{},IdentifierAddressPrefix:"PICT-"};e.exports=class extends o{constructor(t,e,i){let o="object"==typeof t.settings.PictApplicationConfiguration?t.settings.PictApplicationConfiguration:{};super(t,Object.assign({},JSON.parse(JSON.stringify(n)),o,e),i),this.options,this.log,this.fable,this.UUID,this.Hash,this.servicesMap,this.serviceType="PictApplication",this._Package=s,this.pict=this.fable,this.AppData=this.fable.AppData,this.Bundle=this.fable.Bundle,this.initializeTimestamp,this.lastSolvedTimestamp,this.lastLoginTimestamp,this.lastMarshalFromViewsTimestamp,this.lastMarshalToViewsTimestamp,this.lastAutoRenderTimestamp,this.lastLoadDataTimestamp;let r=Object.keys(this.options.Manifests);if(r.length>0)for(let t=0;t<r.length;t++){let e=r[t];this.fable.instantiateServiceProvider("Manifest",this.options.Manifests[e],e)}}onPreSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onPreSolve:`),!0}onPreSolveAsync(t){return this.onPreSolve(),t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeSolve:`),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onSolve:`),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing solve() function...`);let t=Object.keys(this.pict.providers),e=[];for(let i=0;i<t.length;i++){let o=this.pict.providers[t[i]];o.options.AutoSolveWithApp&&e.push(o)}e.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<e.length;t++)e[t].solve(e[t]);this.onBeforeSolve();let i=Object.keys(this.pict.views),o=[];for(let t=0;t<i.length;t++){let e=this.pict.views[i[t]];e.options.AutoInitialize&&o.push(e)}o.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<o.length;t++)o[t].solve();return this.onSolve(),this.onAfterSolve(),this.lastSolvedTimestamp=this.fable.log.getTimeStamp(),!0}solveAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");e.anticipate(this.onBeforeSolveAsync.bind(this));let i="function"==typeof t&&t;i||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync Auto Callback Error: ${t}`,t)});let o=Object.keys(this.pict.providers),s=[];for(let t=0;t<o.length;t++){let e=this.pict.providers[o[t]];e.options.AutoSolveWithApp&&s.push(e)}s.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<s.length;t++)e.anticipate(s[t].solveAsync.bind(s[t]));let n=Object.keys(this.pict.views),r=[];for(let t=0;t<n.length;t++){let e=this.pict.views[n[t]];e.options.AutoSolveWithApp&&r.push(e)}r.sort((t,e)=>t.options.AutoSolveOrdinal-e.options.AutoSolveOrdinal);for(let t=0;t<r.length;t++)e.anticipate(r[t].solveAsync.bind(r[t]));e.anticipate(this.onSolveAsync.bind(this)),e.anticipate(this.onAfterSolveAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync() complete.`),this.lastSolvedTimestamp=this.fable.log.getTimeStamp(),i(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterSolve:`),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeLoginAsync:`),t()}onLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onLoginAsync:`),t()}loginAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let i=t;"function"!=typeof i&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeLoginAsync.bind(this)),e.anticipate(this.onLoginAsync.bind(this)),e.anticipate(this.onAfterLoginAsync.bind(this)),this.options.AutoLoadDataAfterLogin&&e.anticipate(t=>{if(!this.isLoggedIn())return t();this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto loading data after login...`),this.loadDataAsync(e=>{t(e)})}),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loginAsync() complete.`),this.lastLoginTimestamp=this.fable.log.getTimeStamp(),i(t)))}isLoggedIn(){return!0}onAfterLoginAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterLoginAsync:`),t()}onBeforeLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeLoadDataAsync:`),t()}onLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onLoadDataAsync:`),t()}loadDataAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let i=t;"function"!=typeof i&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeLoadDataAsync.bind(this));let o=Object.keys(this.pict.providers),s=[];for(let t=0;t<o.length;t++){let e=this.pict.providers[o[t]];e.options.AutoLoadDataWithApp&&s.push(e)}s.sort((t,e)=>t.options.AutoLoadDataOrdinal-e.options.AutoLoadDataOrdinal);for(const t of s)e.anticipate(t.onBeforeLoadDataAsync.bind(t));e.anticipate(this.onLoadDataAsync.bind(this));for(const t of s)e.anticipate(t.onLoadDataAsync.bind(t));e.anticipate(this.onAfterLoadDataAsync.bind(this));for(const t of s)e.anticipate(t.onAfterLoadDataAsync.bind(t));e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} loadDataAsync() complete.`),this.lastLoadDataTimestamp=this.fable.log.getTimeStamp(),i(t)))}onAfterLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterLoadDataAsync:`),t()}onBeforeSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeSaveDataAsync:`),t()}onSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onSaveDataAsync:`),t()}saveDataAsync(t){const e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");let i=t;"function"!=typeof i&&(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeSaveDataAsync.bind(this));let o=Object.keys(this.pict.providers),s=[];for(let t=0;t<o.length;t++){let e=this.pict.providers[o[t]];e.options.AutoSaveDataWithApp&&s.push(e)}s.sort((t,e)=>t.options.AutoSaveDataOrdinal-e.options.AutoSaveDataOrdinal);for(const t of s)e.anticipate(t.onBeforeSaveDataAsync.bind(t));e.anticipate(this.onSaveDataAsync.bind(this));for(const t of s)e.anticipate(t.onSaveDataAsync.bind(t));e.anticipate(this.onAfterSaveDataAsync.bind(this));for(const t of s)e.anticipate(t.onAfterSaveDataAsync.bind(t));e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} saveDataAsync() complete.`),this.lastSaveDataTimestamp=this.fable.log.getTimeStamp(),i(t)))}onAfterSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterSaveDataAsync:`),t()}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialize:`),this.initializeTimestamp)return this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialize called but initialization is already completed. Aborting.`),!1;{if(this.onBeforeInitialize(),"ConfigurationOnlyViews"in this.options)for(let t=0;t<this.options.ConfigurationOnlyViews.length;t++){let e=void 0===this.options.ConfigurationOnlyViews[t].ViewIdentifier?`AutoView-${this.fable.getUUID()}`:this.options.ConfigurationOnlyViews[t].ViewIdentifier;this.log.info(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} adding configuration only view: ${e}`),this.pict.addView(e,this.options.ConfigurationOnlyViews[t])}this.onInitialize();let t=Object.keys(this.pict.providers),e=[];for(let i=0;i<t.length;i++){let o=this.pict.providers[t[i]];o.options.AutoInitialize&&e.push(o)}e.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<e.length;t++)e[t].initialize();let i=Object.keys(this.pict.views),o=[];for(let t=0;t<i.length;t++){let e=this.pict.views[i[t]];e.options.AutoInitialize&&o.push(e)}o.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let t=0;t<o.length;t++)o[t].initialize();return this.onAfterInitialize(),this.options.AutoSolveAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto solving after initialization...`),this.solve()),this.options.AutoRenderMainViewportViewAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto rendering after initialization...`),this.render()),this.initializeTimestamp=this.fable.log.getTimeStamp(),this.onCompletionOfInitialize(),!0}}initializeAsync(t){this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync:`);let e="function"==typeof t&&t;if(e||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),e=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync Auto Callback Error: ${t}`,t)}),this.initializeTimestamp)return this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} async initialize called but initialization is already completed. Aborting.`),this.onCompletionOfInitializeAsync(e);{let t=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate");if(this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning initialization...`),"ConfigurationOnlyViews"in this.options)for(let t=0;t<this.options.ConfigurationOnlyViews.length;t++){let e=void 0===this.options.ConfigurationOnlyViews[t].ViewIdentifier?`AutoView-${this.fable.getUUID()}`:this.options.ConfigurationOnlyViews[t].ViewIdentifier;this.log.info(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} adding configuration only view: ${e}`),this.pict.addView(e,this.options.ConfigurationOnlyViews[t])}t.anticipate(this.onBeforeInitializeAsync.bind(this)),t.anticipate(this.onInitializeAsync.bind(this));let i=Object.keys(this.pict.providers),o=[];for(let t=0;t<i.length;t++){let e=this.pict.providers[i[t]];e.options.AutoInitialize&&o.push(e)}o.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let e=0;e<o.length;e++)t.anticipate(o[e].initializeAsync.bind(o[e]));let s=Object.keys(this.pict.views),n=[];for(let t=0;t<s.length;t++){let e=this.pict.views[s[t]];e.options.AutoInitialize&&n.push(e)}n.sort((t,e)=>t.options.AutoInitializeOrdinal-e.options.AutoInitializeOrdinal);for(let e=0;e<n.length;e++){let i=n[e];t.anticipate(i.initializeAsync.bind(i))}t.anticipate(this.onAfterInitializeAsync.bind(this)),this.options.AutoLoginAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto login (asynchronously) after initialization...`),t.anticipate(this.loginAsync.bind(this))),this.options.AutoSolveAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto solving (asynchronously) after initialization...`),t.anticipate(this.solveAsync.bind(this))),this.options.AutoRenderMainViewportViewAfterInitialize&&(this.pict.LogNoisiness>1&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} auto rendering (asynchronously) after initialization...`),t.anticipate(this.renderMainViewportAsync.bind(this))),t.wait(t=>(t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initializeAsync Error: ${t.message||t}`,{stack:t.stack}),this.initializeTimestamp=this.fable.log.getTimeStamp(),this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} initialization complete.`),e()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onCompletionOfInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onCompletionOfInitialize:`),!0}onCompletionOfInitializeAsync(t){return this.onCompletionOfInitialize(),t()}onBeforeMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeMarshalFromViews:`),!0}onBeforeMarshalFromViewsAsync(t){return this.onBeforeMarshalFromViews(),t()}onMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onMarshalFromViews:`),!0}onMarshalFromViewsAsync(t){return this.onMarshalFromViews(),t()}marshalFromViews(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing marshalFromViews() function...`),this.onBeforeMarshalFromViews();let t=Object.keys(this.pict.views),e=[];for(let i=0;i<t.length;i++){let o=this.pict.views[t[i]];e.push(o)}for(let t=0;t<e.length;t++)e[t].marshalFromView();return this.onMarshalFromViews(),this.onAfterMarshalFromViews(),this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp(),!0}marshalFromViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t&&t;i||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalFromViewsAsync.bind(this));let o=Object.keys(this.pict.views),s=[];for(let t=0;t<o.length;t++){let e=this.pict.views[o[t]];s.push(e)}for(let t=0;t<s.length;t++)e.anticipate(s[t].marshalFromViewAsync.bind(s[t]));e.anticipate(this.onMarshalFromViewsAsync.bind(this)),e.anticipate(this.onAfterMarshalFromViewsAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewsAsync() complete.`),this.lastMarshalFromViewsTimestamp=this.fable.log.getTimeStamp(),i(t)))}onAfterMarshalFromViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterMarshalFromViews:`),!0}onAfterMarshalFromViewsAsync(t){return this.onAfterMarshalFromViews(),t()}onBeforeMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeMarshalToViews:`),!0}onBeforeMarshalToViewsAsync(t){return this.onBeforeMarshalToViews(),t()}onMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onMarshalToViews:`),!0}onMarshalToViewsAsync(t){return this.onMarshalToViews(),t()}marshalToViews(){this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} executing marshalToViews() function...`),this.onBeforeMarshalToViews();let t=Object.keys(this.pict.views),e=[];for(let i=0;i<t.length;i++){let o=this.pict.views[t[i]];e.push(o)}for(let t=0;t<e.length;t++)e[t].marshalToView();return this.onMarshalToViews(),this.onAfterMarshalToViews(),this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp(),!0}marshalToViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t&&t;i||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalToViewsAsync.bind(this));let o=Object.keys(this.pict.views),s=[];for(let t=0;t<o.length;t++){let e=this.pict.views[o[t]];s.push(e)}for(let t=0;t<s.length;t++)e.anticipate(s[t].marshalToViewAsync.bind(s[t]));e.anticipate(this.onMarshalToViewsAsync.bind(this)),e.anticipate(this.onAfterMarshalToViewsAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewsAsync() complete.`),this.lastMarshalToViewsTimestamp=this.fable.log.getTimeStamp(),i(t)))}onAfterMarshalToViews(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterMarshalToViews:`),!0}onAfterMarshalToViewsAsync(t){return this.onAfterMarshalToViews(),t()}onBeforeRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onBeforeRender:`),!0}onBeforeRenderAsync(t){return this.onBeforeRender(),t()}render(t,e,i,o){let s="string"!=typeof t?this.options.MainViewportViewIdentifier:t,n="string"!=typeof e?this.options.MainViewportRenderableHash:e,r="string"!=typeof i?this.options.MainViewportDestinationAddress:i,a="string"!=typeof o?this.options.MainViewportDefaultDataAddress:o;this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} VIEW Renderable[${n}] Destination[${r}] TemplateDataAddress[${a}] render:`),this.onBeforeRender();let l="string"==typeof s&&this.servicesMap.PictView[s];return l?(this.onRender(),l.render(n,r,a),this.onAfterRender(),!0):(this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} could not render from View ${s} because it is not a valid view.`),!1)}onRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onRender:`),!0}onRenderAsync(t){return this.onRender(),t()}renderAsync(t,e,i,o,s){let n="string"!=typeof t?this.options.MainViewportViewIdentifier:t,r="string"!=typeof e?this.options.MainViewportRenderableHash:e,a="string"!=typeof i?this.options.MainViewportDestinationAddress:i,l="string"!=typeof o?this.options.MainViewportDefaultDataAddress:o,c="function"==typeof s?s:"function"==typeof o?o:"function"==typeof i?i:"function"==typeof e?e:"function"==typeof t&&t;c||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),c=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync Auto Callback Error: ${t}`,t)}),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} VIEW Renderable[${r}] Destination[${a}] TemplateDataAddress[${l}] renderAsync:`);let d=this.fable.newAnticipate();d.anticipate(this.onBeforeRenderAsync.bind(this));let h="string"==typeof n&&this.servicesMap.PictView[n];if(!h){let t=`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} could not asynchronously render from View ${n} because it is not a valid view.`;return this.pict.LogNoisiness>3&&this.log.error(t),c(new Error(t))}return d.anticipate(this.onRenderAsync.bind(this)),d.anticipate(t=>{h.renderAsync.call(h,r,a,l,t)}),d.anticipate(this.onAfterRenderAsync.bind(this)),d.wait(c)}onAfterRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} onAfterRender:`),!0}onAfterRenderAsync(t){return this.onAfterRender(),t()}renderMainViewport(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderMainViewport:`),this.render()}renderMainViewportAsync(t){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow APPLICATION [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderMainViewportAsync:`),this.renderAsync(t)}renderAutoViews(){this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning renderAutoViews...`);let t=Object.keys(this.pict.views);t.sort((t,e)=>this.pict.views[t].options.AutoRenderOrdinal-this.pict.views[e].options.AutoRenderOrdinal);for(let e=0;e<t.length;e++){let i=this.pict.views[t[e]];i.options.AutoRender&&i.render()}this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync complete.`)}renderAutoViewsAsync(t){let e=this.fable.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t&&t;i||(this.log.warn(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync Auto Callback Error: ${t}`,t)}),this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} beginning renderAutoViewsAsync...`);let o=Object.keys(this.pict.views);o.sort((t,e)=>this.pict.views[t].options.AutoRenderOrdinal-this.pict.views[e].options.AutoRenderOrdinal);for(let t=0;t<o.length;t++){let i=this.pict.views[o[t]];i.options.AutoRender&&e.anticipate(i.renderAsync.bind(i))}e.wait(t=>(this.lastAutoRenderTimestamp=this.fable.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.trace(`PictApp [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAutoViewsAsync complete.`),i(t)))}get isPictApplication(){return!0}}},{"../package.json":3,"fable-serviceproviderbase":2}],5:[function(t,e,i){e.exports={name:"pict-provider",version:"1.0.12",description:"Pict Provider Base Class",main:"source/Pict-Provider.js",scripts:{start:"node source/Pict-Provider.js",test:"npx quack test",tests:"npx quack test -g",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-provider-image:local","docker-dev-run":'docker run -it -d --name pict-provider-dev -p 24125:8080 -p 30027:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-provider" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-provider-image:local',"docker-dev-shell":"docker exec -it pict-provider-dev /bin/bash",lint:"eslint source/**",types:"tsc -p ."},types:"types/source/Pict-Provider.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-provider.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-provider/issues"},homepage:"https://github.com/stevenvelozo/pict-provider#readme",devDependencies:{"@eslint/js":"^9.39.1",eslint:"^9.39.1",pict:"^1.0.351",quackage:"^1.0.58",typescript:"^5.9.3"},dependencies:{"fable-serviceproviderbase":"^3.0.19"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]}}},{}],6:[function(t,e,i){const o=t("fable-serviceproviderbase"),s=t("../package.json"),n={ProviderIdentifier:!1,AutoInitialize:!0,AutoInitializeOrdinal:0,AutoLoadDataWithApp:!0,AutoLoadDataOrdinal:0,AutoSolveWithApp:!0,AutoSolveOrdinal:0,Manifests:{},Templates:[]};e.exports=class extends o{constructor(t,e,i){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),i),this.fable,this.pict,this.log,this.options,this.UUID,this.Hash,this.options.ProviderIdentifier||(this.options.ProviderIdentifier=`AutoProviderID-${this.fable.getUUID()}`),this.serviceType="PictProvider",this._Package=s,this.pict=this.fable,this.AppData=this.pict.AppData,this.Bundle=this.pict.Bundle,this.initializeTimestamp=!1,this.lastSolvedTimestamp=!1;for(let t=0;t<this.options.Templates.length;t++){let e=this.options.Templates[t];e.hasOwnProperty("Postfix")&&e.hasOwnProperty("Template")?(e.Source||(e.Source=`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} options object.`),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} could not load Default Template ${t} in the options array.`,e)}}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow PROVIDER [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialize:`),this.initializeTimestamp?(this.log.warn(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialize called but initialization is already completed. Aborting.`),!1):(this.onBeforeInitialize(),this.onInitialize(),this.onAfterInitialize(),this.initializeTimestamp=this.pict.log.getTimeStamp(),!0)}initializeAsync(t){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow PROVIDER [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initializeAsync:`),this.initializeTimestamp)return this.log.warn(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} async initialize called but initialization is already completed. Aborting.`),t();{let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate");this.pict.LogNoisiness>0&&this.log.info(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} beginning initialization...`),e.anticipate(this.onBeforeInitializeAsync.bind(this)),e.anticipate(this.onInitializeAsync.bind(this)),e.anticipate(this.onAfterInitializeAsync.bind(this)),e.wait(e=>(this.initializeTimestamp=this.pict.log.getTimeStamp(),e?this.log.error(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialization failed: ${e.message||e}`,{Stack:e.stack}):this.pict.LogNoisiness>0&&this.log.info(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} initialization complete.`),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onPreRender(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onPreRender:`),!0}onPreRenderAsync(t){return this.onPreRender(),t()}render(){return this.onPreRender()}renderAsync(t){return this.onPreRender(),t()}onPreSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onPreSolve:`),!0}onPreSolveAsync(t){return this.onPreSolve(),t()}solve(){return this.onPreSolve()}solveAsync(t){return this.onPreSolve(),t()}onBeforeLoadDataAsync(t){return t()}onLoadDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onLoadDataAsync:`),t()}onAfterLoadDataAsync(t){return t()}onBeforeSaveDataAsync(t){return t()}onSaveDataAsync(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictProvider [${this.UUID}]::[${this.Hash}] ${this.options.ProviderIdentifier} onSaveDataAsync:`),t()}onAfterSaveDataAsync(t){return t()}}},{"../package.json":5,"fable-serviceproviderbase":2}],7:[function(t,e,i){e.exports={RenderOnLoad:!0,DefaultRenderable:"Histogram-Wrap",DefaultDestinationAddress:"#Histogram-Container-Div",Templates:[{Hash:"Histogram-Container",Template:"\x3c!-- Histogram Container Rendering Soon --\x3e"}],Renderables:[{RenderableHash:"Histogram-Wrap",TemplateHash:"Histogram-Container",DestinationAddress:"#Histogram-Container-Div"}],TargetElementAddress:"#Histogram-Container-Div",DataAddress:!1,Bins:[],LabelProperty:"Label",ValueProperty:"Value",Orientation:"vertical",RenderMode:"browser",MaxBarSize:200,BarThickness:30,BarGap:4,FillContainer:!1,ShowValues:!0,ShowLabels:!0,LabelInterval:0,BarColor:"#4A90D9",SelectedBarColor:"#2ECC71",SelectionRangeColor:"#85C1E9",Selectable:!1,SelectionMode:"range",SelectionDataAddress:!1,InitialSelection:null,BarCharacter:"█",BarPartialCharacters:[" ","▁","▂","▃","▄","▅","▆","▇","█"],EmptyCharacter:" ",SliderCharacter:"│",SliderHandleCharacter:"◆",TextWidth:60,TextHeight:15,CSS:".pict-histogram-container\n{\n\tdisplay: inline-block;\n\tposition: relative;\n\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n\tfont-size: 12px;\n\tuser-select: none;\n}\n.pict-histogram-chart\n{\n\tdisplay: flex;\n\talign-items: flex-end;\n\tposition: relative;\n}\n.pict-histogram-container.pict-histogram-horizontal\n{\n\tdisplay: inline-flex;\n\tflex-direction: row;\n\talign-items: stretch;\n}\n.pict-histogram-chart.pict-histogram-horizontal\n{\n\tflex-direction: column;\n\talign-items: flex-start;\n}\n.pict-histogram-bar-group\n{\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tcursor: default;\n\tflex-shrink: 0;\n}\n.pict-histogram-horizontal .pict-histogram-bar-group\n{\n\tflex-direction: row;\n\talign-items: center;\n}\n.pict-histogram-bar\n{\n\ttransition: background-color 0.15s ease, height 0.2s ease, width 0.2s ease;\n\tborder-radius: 2px 2px 0 0;\n\tmin-width: 1px;\n\tmin-height: 1px;\n}\n.pict-histogram-horizontal .pict-histogram-bar\n{\n\tborder-radius: 0 2px 2px 0;\n}\n.pict-histogram-bar.pict-histogram-selectable\n{\n\tcursor: pointer;\n}\n.pict-histogram-bar.pict-histogram-selectable:hover\n{\n\topacity: 0.8;\n}\n.pict-histogram-bar.pict-histogram-selected\n{\n\tbox-shadow: 0 0 0 2px rgba(46, 204, 113, 0.4);\n}\n.pict-histogram-bar.pict-histogram-in-range\n{\n\topacity: 0.9;\n}\n.pict-histogram-value-label\n{\n\ttext-align: center;\n\tcolor: #666;\n\tfont-size: 11px;\n\tpadding: 2px 0;\n\twhite-space: nowrap;\n}\n.pict-histogram-horizontal .pict-histogram-value-label\n{\n\tpadding: 0 4px;\n}\n.pict-histogram-bin-label\n{\n\ttext-align: center;\n\tcolor: #333;\n\tfont-size: 11px;\n\tpadding: 4px 2px 0 2px;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n.pict-histogram-horizontal .pict-histogram-bin-label\n{\n\tpadding: 0 4px 0 0;\n\ttext-align: right;\n\tmin-width: 40px;\n}\n.pict-histogram-range-slider-container\n{\n\tposition: relative;\n\twidth: 100%;\n\theight: 24px;\n\tmargin-top: 4px;\n}\n.pict-histogram-horizontal .pict-histogram-range-slider-container\n{\n\twidth: 24px;\n\theight: auto;\n\talign-self: stretch;\n\tmargin-top: 0;\n\tmargin-left: 4px;\n}\n.pict-histogram-range-track\n{\n\tposition: absolute;\n\ttop: 10px;\n\tleft: 0;\n\tright: 0;\n\theight: 4px;\n\tbackground: #E0E0E0;\n\tborder-radius: 2px;\n}\n.pict-histogram-horizontal .pict-histogram-range-track\n{\n\ttop: 0;\n\tleft: 10px;\n\tright: auto;\n\tbottom: 0;\n\twidth: 4px;\n\theight: auto;\n}\n.pict-histogram-range-fill\n{\n\tposition: absolute;\n\ttop: 10px;\n\theight: 4px;\n\tbackground: #4A90D9;\n\tborder-radius: 2px;\n}\n.pict-histogram-horizontal .pict-histogram-range-fill\n{\n\ttop: auto;\n\tleft: 10px;\n\twidth: 4px;\n\theight: auto;\n}\n.pict-histogram-range-handle\n{\n\tposition: absolute;\n\ttop: 4px;\n\twidth: 16px;\n\theight: 16px;\n\tbackground: #fff;\n\tborder: 2px solid #4A90D9;\n\tborder-radius: 50%;\n\tcursor: grab;\n\tz-index: 2;\n\ttransform: translateX(-50%);\n}\n.pict-histogram-horizontal .pict-histogram-range-handle\n{\n\ttop: auto;\n\tleft: 4px;\n\ttransform: translateY(-50%);\n}\n.pict-histogram-range-handle:active\n{\n\tcursor: grabbing;\n\tbackground: #4A90D9;\n}\n.pict-histogram-range-handle:active,\n.pict-histogram-range-handle:focus\n{\n\tbox-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);\n\toutline: none;\n}\n.pict-histogram-container.pict-histogram-fill\n{\n\tdisplay: block;\n\twidth: 100%;\n}\n.pict-histogram-fill .pict-histogram-chart\n{\n\twidth: 100%;\n}\n.pict-histogram-fill .pict-histogram-bar-group\n{\n\tflex: 1 1 0%;\n\tmin-width: 0;\n}\n.pict-histogram-fill .pict-histogram-bar\n{\n\twidth: 100%;\n}\n.pict-histogram-axis-line\n{\n\twidth: 100%;\n\theight: 1px;\n\tbackground: #ccc;\n}\n.pict-histogram-label-row\n{\n\tdisplay: flex;\n\twidth: 100%;\n}\n.pict-histogram-fill-label\n{\n\tfont-size: 10px;\n\tcolor: #666;\n\ttext-align: center;\n\twhite-space: nowrap;\n\toverflow: visible;\n\tline-height: 16px;\n}\n"}},{}],8:[function(t,e,i){const o=t("pict-view"),s=t("./Pict-Section-Histogram-DefaultConfiguration.js"),n=t("./renderers/Pict-Histogram-Renderer-Browser.js"),r=t("./renderers/Pict-Histogram-Renderer-ConsoleUI.js"),a=t("./renderers/Pict-Histogram-Renderer-CLI.js");e.exports=class extends o{constructor(t,e,i){super(t,Object.assign({},s,e),i),this.initialRenderComplete=!1,this._selectedIndices=new Set,this._selectionRangeStart=0,this._selectionRangeEnd=0,this._renderer=this._resolveRenderer(),this._applyInitialSelection()}_applyInitialSelection(){if(this.options.InitialSelection)this.setSelection(this.options.InitialSelection);else if(this.options.Selectable&&"range"===this.options.SelectionMode){let t=this.getBins();this._selectionRangeStart=0,this._selectionRangeEnd=Math.max(0,t.length-1),this._syncSelectionFromRange()}}_resolveRenderer(){switch(this.options.RenderMode){case"consoleui":return r;case"cli":return a;default:return n}}getBins(){if(this.options.DataAddress){const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};let e=this.fable.manifest.getValueByHash(t,this.options.DataAddress);if(Array.isArray(e))return e;this.log.warn(`PICT-Histogram DataAddress [${this.options.DataAddress}] did not return an array.`)}return this.options.Bins||[]}setBins(t){if(Array.isArray(t)){if(this.options.Bins=t,this.options.DataAddress){const e={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(e,this.options.DataAddress,t)}}else this.log.warn("PICT-Histogram setBins requires an array.")}isIndexSelected(t){return!!this.options.Selectable&&("range"===this.options.SelectionMode?t===this._selectionRangeStart||t===this._selectionRangeEnd:this._selectedIndices.has(t))}isIndexInRange(t){return!(!this.options.Selectable||"range"!==this.options.SelectionMode)&&(t>this._selectionRangeStart&&t<this._selectionRangeEnd)}getSelection(){if("range"===this.options.SelectionMode){let t=this.getBins(),e=[];for(let t=this._selectionRangeStart;t<=this._selectionRangeEnd;t++)e.push(t);return{Mode:"range",RangeStart:this._selectionRangeStart,RangeEnd:this._selectionRangeEnd,SelectedIndices:e,StartLabel:(t[this._selectionRangeStart]||{})[this.options.LabelProperty],EndLabel:(t[this._selectionRangeEnd]||{})[this.options.LabelProperty]}}return{Mode:this.options.SelectionMode,SelectedIndices:Array.from(this._selectedIndices).sort((t,e)=>t-e)}}setSelection(t){"range"===this.options.SelectionMode?t&&"number"==typeof t.Start&&"number"==typeof t.End&&(this._selectionRangeStart=t.Start,this._selectionRangeEnd=t.End,this._syncSelectionFromRange()):Array.isArray(t)&&(this._selectedIndices=new Set(t)),this._writeSelectionToAddress()}handleBarClick(t){"single"===this.options.SelectionMode?(this._selectedIndices.clear(),this._selectedIndices.add(t)):"multiple"===this.options.SelectionMode&&(this._selectedIndices.has(t)?this._selectedIndices.delete(t):this._selectedIndices.add(t)),this._writeSelectionToAddress(),this.onSelectionChange(this.getSelection()),this.renderHistogram()}handleRangeBarClick(t){Math.abs(t-this._selectionRangeStart)<=Math.abs(t-this._selectionRangeEnd)?this._selectionRangeStart=Math.min(t,this._selectionRangeEnd):this._selectionRangeEnd=Math.max(t,this._selectionRangeStart),this._syncSelectionFromRange(),this._writeSelectionToAddress(),this.onSelectionChange(this.getSelection()),this.renderHistogram()}_syncSelectionFromRange(){this._selectedIndices.clear();for(let t=this._selectionRangeStart;t<=this._selectionRangeEnd;t++)this._selectedIndices.add(t)}_writeSelectionToAddress(){if(!this.options.SelectionDataAddress)return;const t={Fable:this.fable,Pict:this.fable,AppData:this.AppData,Bundle:this.Bundle,Options:this.options};this.fable.manifest.setValueByHash(t,this.options.SelectionDataAddress,this.getSelection())}onSelectionChange(t){}onBeforeInitialize(){return super.onBeforeInitialize(),super.onBeforeInitialize()}onAfterRender(t){return this.pict.CSSMap.injectCSS(),this.initialRenderComplete||(this.onAfterInitialRender(),this.initialRenderComplete=!0),super.onAfterRender(t)}onAfterInitialRender(){this.renderHistogram()}renderHistogram(){this.pict.CSSMap&&this.pict.CSSMap.injectCSS(),this._renderer.render(this),this._renderer.wireEvents(this),this.initialRenderComplete=!0}marshalToView(){super.marshalToView(),this.initialRenderComplete&&this.renderHistogram()}marshalFromView(){super.marshalFromView(),this._writeSelectionToAddress()}setOrientation(t){"vertical"===t||"horizontal"===t?(this.options.Orientation=t,this.initialRenderComplete&&this.renderHistogram()):this.log.warn(`PICT-Histogram invalid orientation: ${t}`)}setRenderMode(t){this.options.RenderMode=t,this._renderer=this._resolveRenderer(),this.initialRenderComplete&&this.renderHistogram()}toText(){return"vertical"===this.options.Orientation?r.renderVertical(this):r.renderHorizontal(this)}},e.exports.default_configuration=s,e.exports.renderers={browser:n,consoleui:r,cli:a}},{"./Pict-Section-Histogram-DefaultConfiguration.js":7,"./renderers/Pict-Histogram-Renderer-Browser.js":9,"./renderers/Pict-Histogram-Renderer-CLI.js":10,"./renderers/Pict-Histogram-Renderer-ConsoleUI.js":11,"pict-view":13}],9:[function(t,e,i){function o(t,e,i,o,s,n,r){let a=t[o.LabelProperty]||"",l=t[o.ValueProperty]||0,c="vertical"===o.Orientation,d=s?o.SelectedBarColor:n?o.SelectionRangeColor:o.BarColor,h=o.Selectable?" pict-histogram-selectable":"",p=s?" pict-histogram-selected":"",u=n?" pict-histogram-in-range":"",m=o.FillContainer,g="";g=c?m?`height:${i}px;background-color:${d};`:`height:${i}px;width:${o.BarThickness}px;background-color:${d};`:m?`width:${i}px;background-color:${d};`:`width:${i}px;height:${o.BarThickness}px;background-color:${d};`;let f=o.BarThickness+o.BarGap,v="";v=m?"":c?`margin:0 ${o.BarGap/2}px;width:${f}px;`:`margin:${o.BarGap/2}px 0;`;let b=`<div class="pict-histogram-bar-group" style="${v}" data-histogram-index="${e}">`;if(c)o.ShowValues&&!m&&(b+=`<div class="pict-histogram-value-label" style="width:${f}px;">${l}</div>`),b+=`<div class="pict-histogram-bar${h}${p}${u}" style="${g}" data-histogram-index="${e}"></div>`,o.ShowLabels&&!m&&(b+=`<div class="pict-histogram-bin-label" style="width:${f}px;">${a}</div>`);else{if(o.ShowLabels){b+=`<div class="pict-histogram-bin-label" style="${r?`width:${r}px;min-width:${r}px;`:""}">${a}</div>`}b+=`<div class="pict-histogram-bar${h}${p}${u}" style="${g}" data-histogram-index="${e}"></div>`,o.ShowValues&&(b+=`<div class="pict-histogram-value-label">${l}</div>`)}return b+="</div>",b}function s(t,e,i){let o=e.getAttribute("data-handle"),s="vertical"===t.options.Orientation,n=!1;function r(e){if(!n)return;let r=t.getBins();if(!r||0===r.length)return;let a=function(){let t=i.querySelector(".pict-histogram-range-slider-container");if(!t)return{start:0,size:1};let e=t.getBoundingClientRect();return s?{start:e.left,size:e.width||1}:{start:e.top,size:e.height||1}}(),l=((s?e.clientX:e.clientY)-a.start)/a.size;l=Math.max(0,Math.min(1,l));let c=Math.round(l*(r.length-1));"start"===o?(c>t._selectionRangeEnd&&(c=t._selectionRangeEnd),t._selectionRangeStart=c):(c<t._selectionRangeStart&&(c=t._selectionRangeStart),t._selectionRangeEnd=c),t._syncSelectionFromRange(),t.renderHistogram()}function a(){n&&(n=!1,"undefined"!=typeof document&&(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a)))}e.addEventListener("mousedown",t=>{t.preventDefault(),n=!0,"undefined"!=typeof document&&(document.addEventListener("mousemove",r),document.addEventListener("mouseup",a))})}e.exports={render:function(t){let e=t.getBins();if(!e||0===e.length)return void t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,'<div class="pict-histogram-container"><em>No histogram data</em></div>');let i=0;for(let o=0;o<e.length;o++){let s=e[o][t.options.ValueProperty]||0;s>i&&(i=s)}0===i&&(i=1);let s="vertical"===t.options.Orientation,n=s?"pict-histogram-vertical":"pict-histogram-horizontal",r=t.options.FillContainer?" pict-histogram-fill":"",a=0;if(!s&&t.options.ShowLabels&&!t.options.FillContainer){for(let i=0;i<e.length;i++){let o=6.5*String(e[i][t.options.LabelProperty]||"").length+8;o>a&&(a=o)}a=Math.max(a,40)}let l=`<div class="pict-histogram-container ${n}${r}">`;l+=`<div class="pict-histogram-chart ${n}${r}">`;for(let s=0;s<e.length;s++){let n=e[s][t.options.ValueProperty]||0,r=Math.round(n/i*t.options.MaxBarSize);n>0&&r<1&&(r=1);let c=t.isIndexSelected(s),d=!c&&t.isIndexInRange(s);l+=o(e[s],s,r,t.options,c,d,a)}l+="</div>",t.options.FillContainer&&s&&t.options.ShowLabels&&(l+='<div class="pict-histogram-axis-line"></div>',l+=function(t,e){if(!e||0===e.length)return"";let i=t.options.LabelInterval||0;if(i<=0){let o=t.services.ContentAssignment.getElement(t.options.TargetElementAddress),s=800;if(o&&o.length>0&&o[0]&&(s=o[0].clientWidth||800),e.length>0){let t=s/e.length;i=Math.max(1,Math.ceil(80/t))}else i=1}let o='<div class="pict-histogram-label-row">';for(let s=0;s<e.length;s++)if(s%i===0){let n=e[s][t.options.LabelProperty]||"",r=Math.min(i,e.length-s);o+=`<div class="pict-histogram-fill-label" style="flex:${r};">${n}</div>`,s+=r-1}return o+="</div>",o}(t,e)),t.options.Selectable&&"range"===t.options.SelectionMode&&(l+=function(t){let e=t.getBins();if(!e||0===e.length)return"";let i=t._selectionRangeStart,o=t._selectionRangeEnd,s=e.length-1,n=s>0?i/s*100:0,r=s>0?o/s*100:100,a='<div class="pict-histogram-range-slider-container">';return a+='<div class="pict-histogram-range-track"></div>',"vertical"===t.options.Orientation?(a+=`<div class="pict-histogram-range-fill" style="left:${n}%;right:${100-r}%;"></div>`,a+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-start" tabindex="0" style="left:${n}%;" data-handle="start"></div>`,a+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-end" tabindex="0" style="left:${r}%;" data-handle="end"></div>`):(a+=`<div class="pict-histogram-range-fill" style="top:${n}%;bottom:${100-r}%;"></div>`,a+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-start" tabindex="0" style="top:${n}%;" data-handle="start"></div>`,a+=`<div class="pict-histogram-range-handle pict-histogram-range-handle-end" tabindex="0" style="top:${r}%;" data-handle="end"></div>`),a+="</div>",a}(t)),l+="</div>",t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,l)},wireEvents:function(t){if(!t.options.Selectable)return;let e=t.services.ContentAssignment.getElement(t.options.TargetElementAddress);if(!e||e.length<1)return;let i=e[0];if(i){if("single"===t.options.SelectionMode||"multiple"===t.options.SelectionMode){let e=i.querySelectorAll(".pict-histogram-bar[data-histogram-index]");for(let i=0;i<e.length;i++)e[i].addEventListener("click",e=>{let i=parseInt(e.currentTarget.getAttribute("data-histogram-index"),10);isNaN(i)||t.handleBarClick(i)})}if("range"===t.options.SelectionMode){let e=i.querySelectorAll(".pict-histogram-bar[data-histogram-index]");for(let i=0;i<e.length;i++)e[i].addEventListener("click",e=>{let i=parseInt(e.currentTarget.getAttribute("data-histogram-index"),10);isNaN(i)||t.handleRangeBarClick(i)});let o=i.querySelectorAll(".pict-histogram-range-handle");for(let e=0;e<o.length;e++)s(t,o[e],i)}}}}},{}],10:[function(t,e,i){(function(t){(function(){const i={black:"",red:"",green:"",yellow:"",blue:"",magenta:"",cyan:"",white:"",reset:"",bold:"",dim:""};function o(t){if(!t)return i.blue;let e=t.toLowerCase();if(i[e])return i[e];if("#"===e.charAt(0)&&e.length>=7){let t=parseInt(e.substring(1,3),16),o=parseInt(e.substring(3,5),16),s=parseInt(e.substring(5,7),16);if(o>t&&o>s)return i.green;if(t>o&&t>s)return i.red;if(s>t&&s>o)return i.blue;if(t>200&&o>200)return i.yellow;if(t>200&&s>200)return i.magenta;if(o>200&&s>200)return i.cyan}return i.blue}function s(t){let e=t.getBins(),s=t.options,n=s.TextHeight||15,a=s.BarCharacter,c=s.BarPartialCharacters,d=o(s.BarColor),h=o(s.SelectedBarColor),p=o(s.SelectionRangeColor),u=i.reset;if(!e||0===e.length)return"(no data)\n";let m=0;for(let t=0;t<e.length;t++){let i=e[t][s.ValueProperty]||0;i>m&&(m=i)}0===m&&(m=1);let g=String(m).length+1,f=[];for(let o=n;o>=1;o--){let l="";o===n?l+=i.dim+r(String(m),g)+"|"+u:1===o?l+=i.dim+r("0",g)+"|"+u:o===Math.ceil(n/2)?l+=i.dim+r(String(Math.round(m/2)),g)+"|"+u:l+=i.dim+r("",g)+"|"+u;for(let i=0;i<e.length;i++){let r=(e[i][s.ValueProperty]||0)/m*n,g=Math.floor(r),f=r-g,v=t.isIndexSelected(i),b=!v&&t.isIndexInRange(i),y=v?h:b?p:d,w=" ";if(o<=g)w=a;else if(o===g+1&&f>0){w=c[Math.round(f*(c.length-1))]}l+=" "!==w?" "+y+w+w+w+u:" "}f.push(l)}let v=i.dim+r("",g)+"+";for(let t=0;t<e.length;t++)v+="----";if(v+=u,f.push(v),s.ShowLabels){let t=r("",g)+" ";for(let i=0;i<e.length;i++){t+=l(String(e[i][s.LabelProperty]||"").substring(0,4),4)}f.push(t)}if(s.Selectable&&"range"===s.SelectionMode){let o=t._selectionRangeStart,n=t._selectionRangeEnd,r=e[o]?e[o][s.LabelProperty]:o,a=e[n]?e[n][s.LabelProperty]:n;f.push(""),f.push(i.bold+" Selection: "+r+" - "+a+u)}return f.join("\n")+"\n"}function n(t){let e=t.getBins(),s=t.options,n=s.TextWidth||60,r=s.BarCharacter,l=o(s.BarColor),c=o(s.SelectedBarColor),d=o(s.SelectionRangeColor),h=i.reset;if(!e||0===e.length)return"(no data)\n";let p=0,u=0;for(let t=0;t<e.length;t++){let i=e[t][s.ValueProperty]||0;i>p&&(p=i);let o=String(e[t][s.LabelProperty]||"");o.length>u&&(u=o.length)}0===p&&(p=1);let m=Math.min(u,12),g=n-m-String(p).length-4;g<10&&(g=10);let f=[];for(let o=0;o<e.length;o++){let n=e[o][s.ValueProperty]||0,u=String(e[o][s.LabelProperty]||""),v=Math.round(n/p*g),b=t.isIndexSelected(o),y=!b&&t.isIndexInRange(o),w=b?c:y?d:l,A="";for(let t=0;t<v;t++)A+=r;let S=i.dim+a(u.substring(0,m),m)+" |"+h;S+=w+A+h,S+=" "+n,b?S+=i.bold+" *"+h:y&&(S+=i.dim+" ~"+h),f.push(S)}if(s.Selectable&&"range"===s.SelectionMode){let o=t._selectionRangeStart,n=t._selectionRangeEnd,r=e[o]?e[o][s.LabelProperty]:o,a=e[n]?e[n][s.LabelProperty]:n;f.push(""),f.push(i.bold+" Selection: "+r+" - "+a+h)}return f.join("\n")+"\n"}function r(t,e){let i=String(t);for(;i.length<e;)i=" "+i;return i}function a(t,e){let i=String(t);for(;i.length<e;)i+=" ";return i}function l(t,e){let i=String(t);for(;i.length<e;)i=i.length%2==0?i+" ":" "+i;return i}e.exports={render:function(e){let i;i="vertical"===e.options.Orientation?s(e):n(e),e.services&&e.services.ContentAssignment?e.services.ContentAssignment.assignContent(e.options.TargetElementAddress,i):void 0!==t&&t.stdout&&t.stdout.write(i)},wireEvents:function(){},renderVertical:s,renderHorizontal:n,colorToAnsi:o,ANSI_COLORS:i}}).call(this)}).call(this,t("_process"))},{_process:14}],11:[function(t,e,i){function o(t){let e=t.getBins(),i=t.options,o=i.TextHeight||15,s=i.BarCharacter,r=i.BarPartialCharacters,l=i.EmptyCharacter;if(!e||0===e.length)return"(no data)";let c=0;for(let t=0;t<e.length;t++){let o=e[t][i.ValueProperty]||0;o>c&&(c=o)}0===c&&(c=1);let d=String(c).length+1,h=[];for(let a=o;a>=1;a--){let p="";a===o?p+=n(String(c),d)+"|":1===a?p+=n("0",d)+"|":a===Math.ceil(o/2)?p+=n(String(Math.round(c/2)),d)+"|":p+=n("",d)+"|";for(let n=0;n<e.length;n++){let d=(e[n][i.ValueProperty]||0)/c*o,h=Math.floor(d),u=d-h,m=l;if(a<=h)m=s;else if(a===h+1&&u>0){m=r[Math.round(u*(r.length-1))]}let g=t.isIndexSelected(n),f=!g&&t.isIndexInRange(n);g&&m!==l?m="*":f&&m!==l&&(m="#"),p+=" "+m+m+m}h.push(p)}let p=n("",d)+"+";for(let t=0;t<e.length;t++)p+="----";if(h.push(p),i.ShowLabels){let t=n("",d)+" ";for(let o=0;o<e.length;o++){t+=a(String(e[o][i.LabelProperty]||"").substring(0,4),4)}h.push(t)}if(i.Selectable&&"range"===i.SelectionMode){let i=n("",d)+" ";for(let o=0;o<e.length;o++)o===t._selectionRangeStart?i+=" [ ":o===t._selectionRangeEnd?i+=" ] ":o>t._selectionRangeStart&&o<t._selectionRangeEnd?i+=" - ":i+=" ";h.push(i)}return h.join("\n")}function s(t){let e=t.getBins(),i=t.options,o=i.TextWidth||60,s=i.BarCharacter,n=i.BarPartialCharacters;if(!e||0===e.length)return"(no data)";let a=0,l=0;for(let t=0;t<e.length;t++){let o=e[t][i.ValueProperty]||0;o>a&&(a=o);let s=String(e[t][i.LabelProperty]||"");s.length>l&&(l=s.length)}0===a&&(a=1);let c=Math.min(l,12),d=o-c-2;d<10&&(d=10);let h=[];for(let o=0;o<e.length;o++){let l=e[o][i.ValueProperty]||0,p=String(e[o][i.LabelProperty]||""),u=l/a*d,m=Math.floor(u),g=u-m,f="";for(let t=0;t<m;t++)f+=s;if(g>0&&m<d){f+=n[Math.round(g*(n.length-1))]}let v=t.isIndexSelected(o),b=!v&&t.isIndexInRange(o),y=v?"*":b?"~":"",w=i.ShowValues?" "+l:"",A=r(p.substring(0,c),c)+" |"+f+w+y;h.push(A)}return i.Selectable&&"range"===i.SelectionMode&&(h.push(""),h.push(r("",c)+" Range: ["+t._selectionRangeStart+" - "+t._selectionRangeEnd+"]")),h.join("\n")}function n(t,e){let i=String(t);for(;i.length<e;)i=" "+i;return i}function r(t,e){let i=String(t);for(;i.length<e;)i+=" ";return i}function a(t,e){let i=String(t);for(;i.length<e;)i=i.length%2==0?i+" ":" "+i;return i}e.exports={render:function(t){let e;e="vertical"===t.options.Orientation?o(t):s(t),t.services.ContentAssignment.assignContent(t.options.TargetElementAddress,e)},wireEvents:function(){},renderVertical:o,renderHorizontal:s}},{}],12:[function(t,e,i){e.exports={name:"pict-view",version:"1.0.67",description:"Pict View Base Class",main:"source/Pict-View.js",scripts:{test:"npx quack test",tests:"npx quack test -g",start:"node source/Pict-View.js",coverage:"npx quack coverage",build:"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-view-image:local","docker-dev-run":'docker run -it -d --name pict-view-dev -p 30001:8080 -p 38086:8086 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/pict-view" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" pict-view-image:local',"docker-dev-shell":"docker exec -it pict-view-dev /bin/bash",types:"tsc -p .",lint:"eslint source/**"},types:"types/source/Pict-View.d.ts",repository:{type:"git",url:"git+https://github.com/stevenvelozo/pict-view.git"},author:"steven velozo <steven@velozo.com>",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/pict-view/issues"},homepage:"https://github.com/stevenvelozo/pict-view#readme",devDependencies:{"@eslint/js":"^9.39.1","browser-env":"^3.3.0",eslint:"^9.39.1",pict:"^1.0.348",quackage:"^1.0.58",typescript:"^5.9.3"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},dependencies:{fable:"^3.1.63","fable-serviceproviderbase":"^3.0.19"}}},{}],13:[function(t,e,i){const o=t("fable-serviceproviderbase"),s=t("../package.json"),n={DefaultRenderable:!1,DefaultDestinationAddress:!1,DefaultTemplateRecordAddress:!1,ViewIdentifier:!1,AutoInitialize:!0,AutoInitializeOrdinal:0,AutoRender:!0,AutoRenderOrdinal:0,AutoSolveWithApp:!0,AutoSolveOrdinal:0,CSSHash:!1,CSS:!1,CSSProvider:!1,CSSPriority:500,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};e.exports=class extends o{constructor(t,e,i){super(t,Object.assign({},JSON.parse(JSON.stringify(n)),e),i),this.fable,this.options,this.UUID,this.Hash,this.log;const o=this.Hash===this.UUID;this.UUID=`V-${this.UUID}`,o&&(this.Hash=this.UUID),this.options.ViewIdentifier||(this.options.ViewIdentifier=`AutoViewID-${this.fable.getUUID()}`),this.serviceType="PictView",this._Package=s,this.pict=this.fable,this.AppData=this.pict.AppData,this.Bundle=this.pict.Bundle,this.initializeTimestamp=!1,this.lastSolvedTimestamp=!1,this.lastRenderedTimestamp=!1,this.lastMarshalFromViewTimestamp=!1,this.lastMarshalToViewTimestamp=!1,this.pict.instantiateServiceProviderIfNotExists("TransactionTracking");for(let t=0;t<this.options.Templates.length;t++){let e=this.options.Templates[t];"Hash"in e&&"Template"in e?(e.Source||(e.Source=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} options object.`),this.pict.TemplateProvider.addTemplate(e.Hash,e.Template,e.Source)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Template ${t} in the options array.`,e)}for(let t=0;t<this.options.DefaultTemplates.length;t++){let e=this.options.DefaultTemplates[t];"Postfix"in e&&"Template"in e?(e.Source||(e.Source=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} options object.`),this.pict.TemplateProvider.addDefaultTemplate(e.Prefix,e.Postfix,e.Template,e.Source)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Default Template ${t} in the options array.`,e)}if(this.options.CSS){let t=this.options.CSSHash?this.options.CSSHash:`View-${this.options.ViewIdentifier}`,e=this.options.CSSProvider?this.options.CSSProvider:t;this.pict.CSSMap.addCSS(t,this.options.CSS,e,this.options.CSSPriority)}this.renderables={};for(let t=0;t<this.options.Renderables.length;t++){let e=this.options.Renderables[t];this.addRenderable(e)}}addRenderable(t,e,i,o,s){let n;if("object"==typeof t)n=t;else{n={RenderableHash:t,TemplateHash:e,DefaultTemplateRecordAddress:i,ContentDestinationAddress:o,RenderMethod:"string"!=typeof s?s:"replace"}}"string"!=typeof n.RenderableHash||"string"!=typeof n.TemplateHash?this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not load Renderable; RenderableHash or TemplateHash are invalid.`,n):(this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} adding renderable [${n.RenderableHash}] pointed to template ${n.TemplateHash}.`),this.renderables[n.RenderableHash]=n)}onBeforeInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeInitialize:`),!0}onBeforeInitializeAsync(t){return this.onBeforeInitialize(),t()}onInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onInitialize:`),!0}onInitializeAsync(t){return this.onInitialize(),t()}initialize(){return this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialize:`),this.initializeTimestamp?(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialize called but initialization is already completed. Aborting.`),!1):(this.onBeforeInitialize(),this.onInitialize(),this.onAfterInitialize(),this.initializeTimestamp=this.pict.log.getTimeStamp(),!0)}initializeAsync(t){if(this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initializeAsync:`),this.initializeTimestamp)return this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} async initialize called but initialization is already completed. Aborting.`),t();{let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate");this.pict.LogNoisiness>0&&this.log.info(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} beginning initialization...`),e.anticipate(this.onBeforeInitializeAsync.bind(this)),e.anticipate(this.onInitializeAsync.bind(this)),e.anticipate(this.onAfterInitializeAsync.bind(this)),e.wait(e=>(e&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialization failed: ${e.message||e}`,{stack:e.stack}),this.initializeTimestamp=this.pict.log.getTimeStamp(),this.pict.LogNoisiness>0&&this.log.info(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} initialization complete.`),t()))}}onAfterInitialize(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterInitialize:`),!0}onAfterInitializeAsync(t){return this.onAfterInitialize(),t()}onBeforeRender(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeRender:`),!0}onBeforeRenderAsync(t,e){return this.onBeforeRender(e),t()}onBeforeProject(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeProject:`),!0}onBeforeProjectAsync(t,e){return this.onBeforeProject(e),t()}buildRenderOptions(t,e,i){let o={Valid:!0};return o.RenderableHash="string"==typeof t?t:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,o.RenderableHash||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not find a suitable RenderableHash ${o.RenderableHash} (param ${t}because it is not a valid renderable.`),o.Valid=!1),o.Renderable=this.renderables[o.RenderableHash],o.Renderable||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${o.RenderableHash} (param ${t}) because it does not exist.`),o.Valid=!1),o.DestinationAddress="string"==typeof e?e:"string"==typeof o.Renderable.ContentDestinationAddress?o.Renderable.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress&&this.options.DefaultDestinationAddress,o.DestinationAddress||(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${o.RenderableHash} (param ${t}) because it does not have a valid destination address (param ${e}).`),o.Valid=!1),"object"==typeof i?(o.RecordAddress="Passed in as object",o.Record=i):(o.RecordAddress="string"==typeof i?i:"string"==typeof o.Renderable.DefaultTemplateRecordAddress?o.Renderable.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,o.Record="string"==typeof o.RecordAddress?this.pict.DataProvider.getDataByAddress(o.RecordAddress):void 0),o}assignRenderContent(t,e,i){return this.pict.ContentAssignment.projectContent(t.RenderMethod,e,i,t.TestAddress)}render(t,e,i,o){return this.renderWithScope(this,t,e,i,o)}renderWithScope(t,e,i,o,s){let n,r,a,l="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable;return l?("__Virtual"==l?n={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof i?i:"string"==typeof n.ContentDestinationAddress?n.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:s&&s.TransactionHash,RootRenderableViewHash:s&&s.RootRenderableViewHash}:(n=Object.assign({},this.renderables[l]),n.ContentDestinationAddress="string"==typeof i?i:"string"==typeof n.ContentDestinationAddress?n.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),n.TransactionHash||(n.TransactionHash=`ViewRender-V-${this.options.ViewIdentifier}-R-${l}-U-${this.pict.getUUID()}`,n.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(n.TransactionHash)),n?n.ContentDestinationAddress?("object"==typeof o?(a=o,r="Passed in as object"):(r="string"==typeof o?o:"string"==typeof n.DefaultTemplateRecordAddress?n.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,a="string"==typeof r?this.pict.DataProvider.getDataByAddress(r):void 0),this.onBeforeRender(n),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] Renderable[${l}] Destination[${n.ContentDestinationAddress}] TemplateRecordAddress[${r}] render:`),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Beginning Render of Renderable[${l}] to Destination [${n.ContentDestinationAddress}]...`),n.Content=this.pict.parseTemplateByHash(n.TemplateHash,a,null,[this],t,{RootRenderable:"object"==typeof s?s:n}),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Assigning Renderable[${l}] content length ${n.Content.length} to Destination [${n.ContentDestinationAddress}] using render method [${n.RenderMethod}].`),this.onBeforeProject(n),this.onProject(n),"virtual-assignment"!==n.RenderMethod&&(this.onAfterProject(n),this.onAfterRender(n)),!0):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it does not have a valid destination address.`),!1):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it does not exist.`),!1)):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${l} (param ${e}) because it is not a valid renderable.`),!1)}renderAsync(t,e,i,o,s){return this.renderWithScopeAsync(this,t,e,i,o,s)}renderWithScopeAsync(t,e,i,o,s,n){let r,a,l,c="string"==typeof e?e:"string"==typeof this.options.DefaultRenderable&&this.options.DefaultRenderable,d="function"==typeof n?n:"function"==typeof o?o:"function"==typeof i?i:"function"==typeof e?e:"function"==typeof s?s:null;if(d||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),d=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} renderAsync Auto Callback Error: ${t}`,t)}),!c)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not asynchronously render ${c} (param ${e}because it is not a valid renderable.`),d(new Error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not asynchronously render ${c} (param ${e}because it is not a valid renderable.`));if("__Virtual"==c?r={RenderableHash:"__Virtual",TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,ContentDestinationAddress:"string"==typeof i?i:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null,RenderMethod:"virtual-assignment",TransactionHash:s&&"function"!=typeof s&&s.TransactionHash,RootRenderableViewHash:s&&"function"!=typeof s&&s.RootRenderableViewHash}:(r=Object.assign({},this.renderables[c]),r.ContentDestinationAddress="string"==typeof i?i:"string"==typeof r.ContentDestinationAddress?r.ContentDestinationAddress:"string"==typeof this.options.DefaultDestinationAddress?this.options.DefaultDestinationAddress:null),r.TransactionHash||(r.TransactionHash=`ViewRender-V-${this.options.ViewIdentifier}-R-${c}-U-${this.pict.getUUID()}`,r.RootRenderableViewHash=this.Hash,this.pict.TransactionTracking.registerTransaction(r.TransactionHash)),!r)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not exist.`),d(new Error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not exist.`));if(!r.ContentDestinationAddress)return this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render ${c} (param ${e}) because it does not have a valid destination address.`),d(new Error(`Could not render ${c}`));"object"==typeof o?(l=o,a="Passed in as object"):(a="string"==typeof o?o:"string"==typeof r.DefaultTemplateRecordAddress?r.DefaultTemplateRecordAddress:"string"==typeof this.options.DefaultTemplateRecordAddress&&this.options.DefaultTemplateRecordAddress,l="string"==typeof a?this.pict.DataProvider.getDataByAddress(a):void 0),this.pict.LogControlFlow&&this.log.trace(`PICT-ControlFlow VIEW [${this.UUID}]::[${this.Hash}] Renderable[${c}] Destination[${r.ContentDestinationAddress}] TemplateRecordAddress[${a}] renderAsync:`),this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Beginning Asynchronous Render (callback-style)...`);let h=this.fable.newAnticipate();h.anticipate(t=>{this.onBeforeRenderAsync(t,r)}),h.anticipate(i=>{this.pict.parseTemplateByHash(r.TemplateHash,l,(t,o)=>t?(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render (asynchronously) ${c} (param ${e}) because it did not parse the template.`,t),i(t)):(r.Content=o,i()),[this],t,{RootRenderable:"object"==typeof s?s:r})}),h.anticipate(t=>{this.onBeforeProjectAsync(t,r)}),h.anticipate(t=>{this.onProjectAsync(t,r)}),"virtual-assignment"!==r.RenderMethod&&(h.anticipate(t=>{this.onAfterProjectAsync(t,r)}),h.anticipate(t=>{this.onAfterRenderAsync(t,r)})),h.wait(d)}renderDefaultAsync(t){this.renderAsync(t)}basicRender(t,e,i){return this.basicRenderWithScope(this,t,e,i)}basicRenderWithScope(t,e,i,o){let s=this.buildRenderOptions(e,i,o);return s.Valid?(this.assignRenderContent(s.Renderable,s.DestinationAddress,this.pict.parseTemplateByHash(s.Renderable.TemplateHash,s.Record,null,[this],t,{RootRenderable:s.Renderable})),!0):(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not perform a basic render of ${s.RenderableHash} because it is not valid.`),!1)}basicRenderAsync(t,e,i,o){return this.basicRenderWithScopeAsync(this,t,e,i,o)}basicRenderWithScopeAsync(t,e,i,o,s){let n="function"==typeof s?s:"function"==typeof o?o:"function"==typeof i?i:"function"==typeof e?e:null;n||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} basicRenderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),n=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} basicRenderAsync Auto Callback Error: ${t}`,t)});const r=this.buildRenderOptions(e,i,o);if(!r.Valid){let t=`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not perform a basic render of ${r.RenderableHash} because it is not valid.`;return this.log.error(t),n(new Error(t))}this.pict.parseTemplateByHash(r.Renderable.TemplateHash,r.Record,(t,e)=>t?(this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} could not render (asynchronously) ${r.RenderableHash} because it did not parse the template.`,t),n(t)):(this.assignRenderContent(r.Renderable,r.DestinationAddress,e),n()),[this],t,{RootRenderable:r.Renderable})}onProject(t){this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onProject:`),"virtual-assignment"===t.RenderMethod&&this.pict.TransactionTracking.pushToTransactionQueue(t.TransactionHash,{ViewHash:this.Hash,Renderable:t},"Deferred-Post-Content-Assignment"),this.pict.LogNoisiness>0&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} Assigning Renderable[${t.RenderableHash}] content length ${t.Content.length} to Destination [${t.ContentDestinationAddress}] using Async render method ${t.RenderMethod}.`),this.pict.ContentAssignment.projectContent(t.RenderMethod,t.ContentDestinationAddress,t.Content,t.TestAddress),this.lastRenderedTimestamp=this.pict.log.getTimeStamp()}onProjectAsync(t,e){return this.onProject(e),t()}onAfterRender(t){if(this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRender:`),t&&t.RootRenderableViewHash===this.Hash){const e=this.pict.TransactionTracking.clearTransactionQueue(t.TransactionHash)||[];for(const i of e){const e=this.pict.views[i.Data.ViewHash];e?(e.onAfterProject(),e.onAfterRender(i.Data.Renderable)):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRender: Could not find view for transaction hash ${t.TransactionHash} and ViewHash ${i.Data.ViewHash}.`)}}return!0}onAfterRenderAsync(t,e){this.onAfterRender(e);const i=this.fable.newAnticipate();if(e&&e.RootRenderableViewHash===this.Hash){const t=this.pict.TransactionTracking.clearTransactionQueue(e.TransactionHash)||[];for(const o of t){const t=this.pict.views[o.Data.ViewHash];t?(i.anticipate(t.onAfterProjectAsync.bind(t)),i.anticipate(e=>{t.onAfterRenderAsync(e,o.Data.Renderable)})):this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterRenderAsync: Could not find view for transaction hash ${e.TransactionHash} and ViewHash ${o.Data.ViewHash}.`)}}return i.wait(t)}onAfterProject(t){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterProject:`),!0}onAfterProjectAsync(t,e){return t()}onBeforeSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeSolve:`),!0}onBeforeSolveAsync(t){return this.onBeforeSolve(),t()}onSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onSolve:`),!0}onSolveAsync(t){return this.onSolve(),t()}solve(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeSolve(),this.onSolve(),this.onAfterSolve(),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),!0}solveAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t?t:null;i||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} solveAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeSolveAsync.bind(this)),e.anticipate(this.onSolveAsync.bind(this)),e.anticipate(this.onAfterSolveAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} solveAsync() complete.`),this.lastSolvedTimestamp=this.pict.log.getTimeStamp(),i(t)))}onAfterSolve(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterSolve:`),!0}onAfterSolveAsync(t){return this.onAfterSolve(),t()}onBeforeMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeMarshalFromView:`),!0}onBeforeMarshalFromViewAsync(t){return this.onBeforeMarshalFromView(),t()}onMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onMarshalFromView:`),!0}onMarshalFromViewAsync(t){return this.onMarshalFromView(),t()}marshalFromView(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeMarshalFromView(),this.onMarshalFromView(),this.onAfterMarshalFromView(),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),!0}marshalFromViewAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t?t:null;i||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalFromViewAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalFromViewAsync.bind(this)),e.anticipate(this.onMarshalFromViewAsync.bind(this)),e.anticipate(this.onAfterMarshalFromViewAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} marshalFromViewAsync() complete.`),this.lastMarshalFromViewTimestamp=this.pict.log.getTimeStamp(),i(t)))}onAfterMarshalFromView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterMarshalFromView:`),!0}onAfterMarshalFromViewAsync(t){return this.onAfterMarshalFromView(),t()}onBeforeMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onBeforeMarshalToView:`),!0}onBeforeMarshalToViewAsync(t){return this.onBeforeMarshalToView(),t()}onMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onMarshalToView:`),!0}onMarshalToViewAsync(t){return this.onMarshalToView(),t()}marshalToView(){return this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} executing solve() function...`),this.onBeforeMarshalToView(),this.onMarshalToView(),this.onAfterMarshalToView(),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),!0}marshalToViewAsync(t){let e=this.pict.instantiateServiceProviderWithoutRegistration("Anticipate"),i="function"==typeof t?t:null;i||(this.log.warn(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions.`),i=t=>{t&&this.log.error(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.Name} marshalToViewAsync Auto Callback Error: ${t}`,t)}),e.anticipate(this.onBeforeMarshalToViewAsync.bind(this)),e.anticipate(this.onMarshalToViewAsync.bind(this)),e.anticipate(this.onAfterMarshalToViewAsync.bind(this)),e.wait(t=>(this.pict.LogNoisiness>2&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} marshalToViewAsync() complete.`),this.lastMarshalToViewTimestamp=this.pict.log.getTimeStamp(),i(t)))}onAfterMarshalToView(){return this.pict.LogNoisiness>3&&this.log.trace(`PictView [${this.UUID}]::[${this.Hash}] ${this.options.ViewIdentifier} onAfterMarshalToView:`),!0}onAfterMarshalToViewAsync(t){return this.onAfterMarshalToView(),t()}get isPictView(){return!0}}},{"../package.json":12,"fable-serviceproviderbase":2}],14:[function(t,e,i){var o,s,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(o===setTimeout)return setTimeout(t,0);if((o===r||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:r}catch(t){o=r}try{s="function"==typeof clearTimeout?clearTimeout:a}catch(t){s=a}}();var c,d=[],h=!1,p=-1;function u(){h&&c&&(h=!1,c.length?d=c.concat(d):p=-1,d.length&&m())}function m(){if(!h){var t=l(u);h=!0;for(var e=d.length;e;){for(c=d,d=[];++p<e;)c&&c[p].run();p=-1,e=d.length}c=null,h=!1,function(t){if(s===clearTimeout)return clearTimeout(t);if((s===a||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{return s(t)}catch(e){try{return s.call(null,t)}catch(e){return s.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function f(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];d.push(new g(t,e)),1!==d.length||h||l(m)},g.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=f,n.addListener=f,n.once=f,n.off=f,n.removeListener=f,n.removeAllListeners=f,n.emit=f,n.prependListener=f,n.prependOnceListener=f,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],15:[function(t,e,i){e.exports={Name:"Retold Comprehension Loader",Hash:"ComprehensionLoader",MainViewportViewIdentifier:"ComprehensionLoader-Layout",MainViewportDestinationAddress:"#ComprehensionLoader-Application-Container",MainViewportDefaultDataAddress:"AppData.ComprehensionLoader",pict_configuration:{Product:"ComprehensionLoader"},AutoRenderMainViewportViewAfterInitialize:!1}},{}],16:[function(t,e,i){const o=t("pict-application"),s=t("./providers/Pict-Provider-ComprehensionLoader.js"),n=t("./views/PictView-ComprehensionLoader-Layout.js"),r=t("./views/PictView-ComprehensionLoader-Session.js"),a=t("./views/PictView-ComprehensionLoader-Schema.js"),l=t("./views/PictView-ComprehensionLoader-Source.js"),c=t("./views/PictView-ComprehensionLoader-Load.js"),d=t("pict-section-histogram");e.exports=class extends o{constructor(t,e,i){super(t,e,i),this.pict.addProvider("ComprehensionLoader",s.default_configuration,s),this.pict.addView("ComprehensionLoader-Layout",n.default_configuration,n),this.pict.addView("ComprehensionLoader-Session",r.default_configuration,r),this.pict.addView("ComprehensionLoader-Schema",a.default_configuration,a),this.pict.addView("ComprehensionLoader-Source",l.default_configuration,l),this.pict.addView("ComprehensionLoader-Load",c.default_configuration,c),this.pict.addView("ComprehensionLoader-StatusHistogram",{ViewIdentifier:"ComprehensionLoader-StatusHistogram",TargetElementAddress:"#ComprehensionLoader-Throughput-Histogram",DefaultDestinationAddress:"#ComprehensionLoader-Throughput-Histogram",RenderOnLoad:!1,Selectable:!1,Orientation:"vertical",FillContainer:!0,ShowValues:!1,ShowLabels:!0,MaxBarSize:80,BarColor:"#4a90d9",Bins:[]},d)}onAfterInitializeAsync(t){return this.pict.AppData.ComprehensionLoader={FetchedEntities:[],LastReport:null,ServerBusyAtLoad:!1,LoadPollTimer:null,LiveStatusTimer:null,StatusDetailExpanded:!1,StatusDetailTimer:null,StatusDetailData:null,LastLiveStatus:null,PersistFields:["serverURL","authMethod","authURI","checkURI","cookieName","cookieValueAddr","cookieValueTemplate","loginMarker","userName","password","schemaURL","comprehensionSourceMode","comprehensionURL"]},window.pict=this.pict,this.pict.views["ComprehensionLoader-Layout"].render(),this.pict.providers.ComprehensionLoader.initPersistence(),this.pict.providers.ComprehensionLoader.startLiveStatusPolling(),this.pict.providers.ComprehensionLoader.initAccordionPreviews(),this.pict.providers.ComprehensionLoader.updateAllPreviews(),this.pict.views["ComprehensionLoader-Layout"].collapseAllSections(),this.pict.providers.ComprehensionLoader.initAutoProcess(),t()}},e.exports.default_configuration=t("./Pict-Application-ComprehensionLoader-Configuration.json")},{"./Pict-Application-ComprehensionLoader-Configuration.json":15,"./providers/Pict-Provider-ComprehensionLoader.js":18,"./views/PictView-ComprehensionLoader-Layout.js":19,"./views/PictView-ComprehensionLoader-Load.js":20,"./views/PictView-ComprehensionLoader-Schema.js":21,"./views/PictView-ComprehensionLoader-Session.js":22,"./views/PictView-ComprehensionLoader-Source.js":23,"pict-application":4,"pict-section-histogram":8}],17:[function(t,e,i){e.exports={ComprehensionLoaderApplication:t("./Pict-Application-ComprehensionLoader.js")},"undefined"!=typeof window&&(window.ComprehensionLoaderApplication=e.exports.ComprehensionLoaderApplication)},{"./Pict-Application-ComprehensionLoader.js":16}],18:[function(t,e,i){const o=t("pict-provider");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}api(t,e,i){let o={method:t,headers:{}};return i&&(o.headers["Content-Type"]="application/json",o.body=JSON.stringify(i)),fetch(e,o).then(function(t){return t.json()})}setStatus(t,e,i){let o=document.getElementById(t);o&&(o.className="status "+(i||"info"),o.textContent=e,o.style.display="block")}escapeHtml(t){let e=document.createElement("div");return e.appendChild(document.createTextNode(t)),e.innerHTML}setSectionPhase(t,e){let i=document.getElementById("phase"+t);i&&(i.className="accordion-phase","ok"===e?(i.innerHTML="&#10003;",i.classList.add("visible","accordion-phase-ok")):"error"===e?(i.innerHTML="&#10007;",i.classList.add("visible","accordion-phase-error")):"busy"===e?(i.innerHTML='<span class="phase-spinner"></span>',i.classList.add("visible","accordion-phase-busy")):i.innerHTML="")}updateAllPreviews(){let t=document.getElementById("serverURL");if(!t)return;t=t.value;let e=document.getElementById("userName").value;if(t){let i=t;e&&(i+=" as "+e),document.getElementById("preview1").textContent=i}else document.getElementById("preview1").textContent="Configure remote server URL and credentials";let i=this.pict.AppData.ComprehensionLoader.FetchedEntities||[];if(i.length>0)document.getElementById("preview2").textContent=i.length+" entit"+(1===i.length?"y":"ies")+" discovered";else{let t=document.getElementById("schemaURL").value;document.getElementById("preview2").textContent=t?"Schema from "+t:"Fetch entity schema from the remote server"}let o=document.querySelector('input[name="comprehensionSourceMode"]:checked');if("url"===(o?o.value:"url")){let t=document.getElementById("comprehensionURL").value;document.getElementById("preview3").textContent=t?"URL: "+t:"Provide a comprehension JSON URL or upload files"}else document.getElementById("preview3").textContent="File upload mode";let s=document.getElementById("preview4");s&&(s.textContent="Push comprehension data to the remote server")}initAccordionPreviews(){let t=this,e=["serverURL","userName","schemaURL","comprehensionURL"],i=function(){t.updateAllPreviews()};for(let t=0;t<e.length;t++){let o=document.getElementById(e[t]);o&&(o.addEventListener("input",i),o.addEventListener("change",i))}document.querySelectorAll('input[name="comprehensionSourceMode"]').forEach(function(t){t.addEventListener("change",i)})}saveField(t){let e=document.getElementById(t);e&&localStorage.setItem("comprehensionLoader_"+t,e.value)}restoreFields(){let t=this.pict.AppData.ComprehensionLoader.PersistFields;for(let e=0;e<t.length;e++){let i=t[e],o=localStorage.getItem("comprehensionLoader_"+i);if(null!==o){let t=document.getElementById(i);t&&(t.value=o)}}if("file"===localStorage.getItem("comprehensionLoader_comprehensionSourceMode")){let t=document.getElementById("sourceMode_file");t&&(t.checked=!0)}}initPersistence(){let t=this;this.restoreFields();let e=this.pict.AppData.ComprehensionLoader.PersistFields;for(let i=0;i<e.length;i++)(function(e){let i=document.getElementById(e);i&&(i.addEventListener("input",function(){t.saveField(e)}),i.addEventListener("change",function(){t.saveField(e)}))})(e[i]);document.querySelectorAll('input[name="comprehensionSourceMode"]').forEach(function(t){t.addEventListener("change",function(){localStorage.setItem("comprehensionLoader_comprehensionSourceMode",this.value)})});let i=["auto1","auto2","auto3","auto4"];for(let t=0;t<i.length;t++)(function(t){let e=document.getElementById(t);if(e){let i=localStorage.getItem("comprehensionLoader_"+t);null!==i&&(e.checked="true"===i),e.addEventListener("change",function(){localStorage.setItem("comprehensionLoader_"+t,this.checked)})}})(i[t])}startLiveStatusPolling(){let t=this.pict.AppData.ComprehensionLoader;t.LiveStatusTimer&&clearInterval(t.LiveStatusTimer),this.pollLiveStatus();let e=this;t.LiveStatusTimer=setInterval(function(){e.pollLiveStatus()},1500)}pollLiveStatus(){let t=this;this.api("GET","/comprehension_load/load/live-status").then(function(e){t.renderLiveStatus(e)}).catch(function(){t.renderLiveStatus({Phase:"disconnected",Message:"Cannot reach server",TotalPushed:0,TotalRecords:0})})}renderLiveStatus(t){this.pict.AppData.ComprehensionLoader.LastLiveStatus=t;let e=document.getElementById("liveStatusBar"),i=document.getElementById("liveStatusMessage"),o=document.getElementById("liveStatusMeta"),s=document.getElementById("liveStatusProgressFill");if(!e)return;let n=e.classList.contains("expanded");e.className="live-status-bar phase-"+(t.Phase||"idle"),n&&e.classList.add("expanded"),i.textContent=t.Message||"Idle";let r=[];if("loading"===t.Phase||"stopping"===t.Phase){if(t.Elapsed&&r.push('<span class="live-status-meta-item">⏱ '+t.Elapsed+"</span>"),t.ETA&&r.push('<span class="live-status-meta-item">~'+t.ETA+" remaining</span>"),t.TotalEntities>0&&r.push('<span class="live-status-meta-item"><strong>'+t.Completed+"</strong> / "+t.TotalEntities+" entities</span>"),t.TotalPushed>0){let e=t.TotalPushed.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t.TotalRecords>0){let i=t.TotalRecords.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");r.push('<span class="live-status-meta-item"><strong>'+e+"</strong> / "+i+" records</span>")}else r.push('<span class="live-status-meta-item"><strong>'+e+"</strong> records</span>")}t.Errors>0&&r.push('<span class="live-status-meta-item" style="color:#dc3545"><strong>'+t.Errors+"</strong> error"+(1===t.Errors?"":"s")+"</span>")}else if("complete"===t.Phase&&t.TotalPushed>0){let e=t.TotalPushed.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");r.push('<span class="live-status-meta-item"><strong>'+e+"</strong> records pushed</span>")}o.innerHTML=r.join("");let a=0;if("loading"===t.Phase&&t.TotalRecords>0&&t.TotalPushed>0?a=Math.min(t.TotalPushed/t.TotalRecords*100,99.9):"loading"===t.Phase&&t.TotalEntities>0?a=t.Completed/t.TotalEntities*100:"complete"===t.Phase&&(a=100),s.style.width=Math.min(100,Math.round(a))+"%",("loading"===t.Phase||"stopping"===t.Phase)&&!this.pict.AppData.ComprehensionLoader.StatusDetailExpanded){let t=this.pict.views["ComprehensionLoader-Layout"];t&&"function"==typeof t.toggleStatusDetail&&t.toggleStatusDetail()}if(this.pict.AppData.ComprehensionLoader.StatusDetailExpanded&&this.renderStatusDetail(),"complete"===t.Phase&&!this.pict.AppData.ComprehensionLoader.LastReport){let t=this;this.api("GET","/comprehension_load/load/report").then(function(e){e&&e.ReportVersion&&(t.pict.AppData.ComprehensionLoader.LastReport=e,t.pict.AppData.ComprehensionLoader.StatusDetailExpanded&&t.renderStatusDetail())}).catch(function(){})}}onStatusDetailExpanded(){let t=this.pict.AppData.ComprehensionLoader;t.StatusDetailExpanded=!0,this.renderStatusDetail(),t.StatusDetailTimer&&clearInterval(t.StatusDetailTimer);let e=this;t.StatusDetailTimer=setInterval(function(){e.pollStatusDetail()},2e3),this.pollStatusDetail()}onStatusDetailCollapsed(){let t=this.pict.AppData.ComprehensionLoader;t.StatusDetailExpanded=!1,t.StatusDetailTimer&&(clearInterval(t.StatusDetailTimer),t.StatusDetailTimer=null)}pollStatusDetail(){let t=this;this.api("GET","/comprehension_load/load/status").then(function(e){t.pict.AppData.ComprehensionLoader.StatusDetailData=e,t.renderStatusDetail()}).catch(function(){})}renderStatusDetail(){let t=document.getElementById("ComprehensionLoader-StatusDetail-Container");if(!t)return;let e=this.pict.AppData.ComprehensionLoader,i=e.LastLiveStatus,o=e.StatusDetailData,s=e.LastReport,n={},r=[],a=!1;if(!i||"loading"!==i.Phase&&"stopping"!==i.Phase)if(s&&s.ReportVersion){for(let t=0;t<s.Entities.length;t++){let e=s.Entities[t];n[e.Name]=e}r=s.ThroughputSamples||[]}else o&&o.Entities&&(n=o.Entities,i&&i.ThroughputSamples&&(r=i.ThroughputSamples));else a=!0,o&&o.Entities&&(n=o.Entities),i.ThroughputSamples&&(r=i.ThroughputSamples);let l=[],c=[],d=[],h=[],p=Object.keys(n);for(let t=0;t<p.length;t++){let e=p[t],i=n[e];"Pushing"===i.Status?l.push({Name:e,Data:i}):"Pending"===i.Status?c.push(e):"Complete"===i.Status?d.push({Name:e,Data:i}):"Error"===i.Status&&h.push({Name:e,Data:i})}let u="";if(l.length>0||c.length>0){u+='<div class="status-detail-section">',u+='<div class="status-detail-section-title">Running</div>';for(let t=0;t<l.length;t++){let e=l[t],i=e.Data.Total>0?Math.round(e.Data.Pushed/e.Data.Total*100):0,o=this.formatNumber(e.Data.Pushed||0),s=this.formatNumber(e.Data.Total||0);u+='<div class="running-op-row">',u+=' <div class="running-op-name">'+this.escapeHtml(e.Name)+"</div>",u+=' <div class="running-op-bar"><div class="running-op-bar-fill" style="width:'+i+'%"></div></div>',u+=' <div class="running-op-count">'+o+" / "+s+" ("+i+"%)</div>",u+="</div>"}c.length>0&&(u+='<div class="running-op-pending">'+c.length+" entit"+(1===c.length?"y":"ies")+" waiting</div>"),u+="</div>"}if(d.length>0){u+='<div class="status-detail-section">',u+='<div class="status-detail-section-title">Completed ('+d.length+")</div>";for(let t=0;t<d.length;t++){let e=d[t],i=this.formatNumber(e.Data.Pushed||e.Data.Total||0);u+='<div class="completed-op-row">',u+='<div class="completed-op-header">',u+=' <span class="completed-op-checkmark">✓</span>',u+=' <span class="completed-op-name">'+this.escapeHtml(e.Name)+"</span>",u+=' <span class="completed-op-stats">'+i+" records</span>",u+="</div>",u+="</div>"}u+="</div>"}if(h.length>0){u+='<div class="status-detail-section">',u+='<div class="status-detail-section-title">Errors ('+h.length+")</div>";for(let t=0;t<h.length;t++){let e=h[t],i=this.formatNumber(e.Data.Pushed||0),o=this.formatNumber(e.Data.Total||0);u+='<div class="error-op-row">',u+='<div class="error-op-header">',u+=' <span style="color:#dc3545">✗</span>',u+=' <span class="error-op-name">'+this.escapeHtml(e.Name)+"</span>",u+=' <span class="error-op-status">'+i+" / "+o+"</span>",u+="</div>",e.Data.ErrorMessage&&(u+='<div class="error-op-message">'+this.escapeHtml(e.Data.ErrorMessage)+"</div>"),u+="</div>"}u+="</div>"}""===u&&(u=a?'<div style="font-size:0.9em; color:#888; padding:8px 0">Load in progress, waiting for entity data…</div>':'<div style="font-size:0.9em; color:#888; padding:8px 0">No load data available. Run a load to see operation details here.</div>'),t.innerHTML=u,this.updateThroughputHistogram(r)}updateThroughputHistogram(t){let e=document.getElementById("ComprehensionLoader-Throughput-Histogram");if(!e)return;if(!t||t.length<2)return void(e.style.display="none");let i=[];for(let e=1;e<t.length;e++){let o=t[e].pushed-t[e-1].pushed;o<0&&(o=0),i.push({delta:o,t:t[e].t})}let o=e.clientWidth||800,s=Math.max(20,Math.floor(o/6)),n=i;if(i.length>s){let t=Math.ceil(i.length/s);n=[];for(let e=0;e<i.length;e+=t){let o=0,s=0;for(let n=e;n<Math.min(e+t,i.length);n++)o+=i[n].delta,s=i[n].t;n.push({delta:o,t:s})}}let r=!1;for(let t=0;t<n.length;t++)if(n[t].delta>0){r=!0;break}if(!r)return void(e.style.display="none");let a=t[0].t,l=[];for(let t=0;t<n.length;t++){let e=Math.round((n[t].t-a)/1e3);l.push({Label:this.formatElapsed(e),Value:n[t].delta})}e.style.display="";let c=this.pict.views["ComprehensionLoader-StatusHistogram"];c&&(c.setBins(l),c.renderHistogram())}formatElapsed(t){if(t<60)return t+"s";if(t<3600){let e=t%60;return Math.floor(t/60)+":"+(e<10?"0":"")+e}let e=Math.floor(t/3600),i=Math.floor(t%3600/60);return e+"h"+(i<10?"0":"")+i}formatCompact(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e4?(t/1e3).toFixed(0)+"K":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString()}formatNumber(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}initAutoProcess(){let t=this;this.api("GET","/comprehension_load/load/live-status").then(function(e){if("loading"===e.Phase||"stopping"===e.Phase)return t.pict.AppData.ComprehensionLoader.ServerBusyAtLoad=!0,t.setSectionPhase(4,"busy"),void t.pict.views["ComprehensionLoader-Load"].startPolling();t.runAutoProcessChain()}).catch(function(){})}runAutoProcessChain(){let t=this,e=0,i=2e3;document.getElementById("auto1")&&document.getElementById("auto1").checked&&(setTimeout(function(){t.pict.views["ComprehensionLoader-Session"].goAction()},e),e+=3500),document.getElementById("auto2")&&document.getElementById("auto2").checked&&(setTimeout(function(){t.pict.views["ComprehensionLoader-Schema"].fetchSchema()},e),e+=i),document.getElementById("auto3")&&document.getElementById("auto3").checked&&(setTimeout(function(){t.pict.views["ComprehensionLoader-Source"].goAction()},e),e+=i),document.getElementById("auto4")&&document.getElementById("auto4").checked&&setTimeout(function(){t.pict.views["ComprehensionLoader-Load"].startLoad()},e)}},e.exports.default_configuration={ProviderIdentifier:"ComprehensionLoader",AutoInitialize:!0,AutoInitializeOrdinal:0}},{"pict-provider":6}],19:[function(t,e,i){const o=t("pict-view");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}onAfterRender(){this.pict.views["ComprehensionLoader-Session"].render(),this.pict.views["ComprehensionLoader-Schema"].render(),this.pict.views["ComprehensionLoader-Source"].render(),this.pict.views["ComprehensionLoader-Load"].render(),this.pict.CSSMap.injectCSS()}toggleSection(t){let e=document.getElementById(t);e&&e.classList.toggle("open")}expandAllSections(){let t=document.querySelectorAll(".accordion-card");for(let e=0;e<t.length;e++)t[e].classList.add("open")}collapseAllSections(){let t=document.querySelectorAll(".accordion-card");for(let e=0;e<t.length;e++)t[e].classList.remove("open")}toggleStatusDetail(){let t=document.getElementById("liveStatusDetail"),e=document.getElementById("liveStatusMeta"),i=document.getElementById("liveStatusMessage"),o=document.getElementById("liveStatusToggle"),s=document.getElementById("liveStatusBar");t&&("none"!==t.style.display?(t.style.display="none",e.style.display="",i.style.display="",o.innerHTML="&#9660;",s.classList.remove("expanded"),this.pict.providers.ComprehensionLoader.onStatusDetailCollapsed()):(t.style.display="",e.style.display="none",i.style.display="none",o.innerHTML="&#9650;",s.classList.add("expanded"),this.pict.providers.ComprehensionLoader.onStatusDetailExpanded()))}},e.exports.default_configuration={ViewIdentifier:"ComprehensionLoader-Layout",DefaultRenderable:"ComprehensionLoader-Layout",DefaultDestinationAddress:"#ComprehensionLoader-Application-Container",CSS:'\n* { box-sizing: border-box; margin: 0; padding: 0; }\nbody { font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif; background: #f5f5f5; color: #333; padding: 20px; }\nh1 { margin-bottom: 20px; color: #1a1a1a; }\nh2 { margin-bottom: 12px; color: #444; font-size: 1.2em; border-bottom: 2px solid #ddd; padding-bottom: 6px; }\n\n.section { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n\n/* Accordion layout */\n.accordion-row { display: flex; gap: 0; margin-bottom: 16px; align-items: stretch; }\n.accordion-number {\n\tflex: 0 0 48px; display: flex; align-items: flex-start; justify-content: center;\n\tpadding-top: 16px; font-size: 1.6em; font-weight: 700; color: #4a90d9;\n\tuser-select: none;\n}\n.accordion-card {\n\tflex: 1; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);\n\toverflow: hidden; min-width: 0;\n}\n.accordion-header {\n\tdisplay: flex; align-items: center; padding: 14px 20px; cursor: pointer;\n\tuser-select: none; gap: 12px; transition: background 0.15s; line-height: 1.4;\n}\n.accordion-header:hover { background: #fafafa; }\n.accordion-title { font-weight: 600; color: #333; font-size: 1.05em; white-space: nowrap; }\n.accordion-preview { flex: 1; font-style: italic; color: #888; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n.accordion-toggle {\n\tflex: 0 0 20px; display: flex; align-items: center; justify-content: center;\n\tborder-radius: 4px; transition: background 0.15s, transform 0.25s; font-size: 0.7em; color: #888;\n}\n.accordion-header:hover .accordion-toggle { background: #eee; color: #555; }\n.accordion-card.open .accordion-toggle { transform: rotate(180deg); }\n.accordion-body { padding: 0 20px 20px; display: none; }\n.accordion-card.open .accordion-body { display: block; }\n.accordion-card.open .accordion-header { border-bottom: 1px solid #eee; }\n.accordion-card.open .accordion-preview { display: none; }\n\n/* Action controls (go link + auto checkbox) */\n.accordion-actions { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }\n.accordion-card.open .accordion-actions { display: none; }\n.accordion-go {\n\tfont-size: 0.82em; color: #4a90d9; cursor: pointer; text-decoration: none;\n\tfont-weight: 500; white-space: nowrap; padding: 2px 6px; border-radius: 3px;\n\ttransition: background 0.15s;\n}\n.accordion-go:hover { background: #e8f0fe; text-decoration: underline; }\n.accordion-auto {\n\tfont-size: 0.82em; color: #999; white-space: nowrap; cursor: pointer;\n}\n.accordion-auto .auto-label { display: none; }\n.accordion-auto:hover .auto-label { display: inline; }\n.accordion-auto input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; vertical-align: middle; position: relative; top: 0px; opacity: 0.75; transition: opacity 0.15s; }\n.accordion-auto:hover input[type="checkbox"] { opacity: 1; }\n.accordion-auto:hover { color: #666; }\n\n/* Phase status indicator */\n.accordion-phase {\n\tflex: 0 0 auto; display: none; align-items: center; justify-content: center;\n\tfont-size: 0.85em; line-height: 1;\n}\n.accordion-phase.visible { display: flex; }\n.accordion-phase-ok { color: #28a745; }\n.accordion-phase-error { color: #dc3545; }\n.accordion-phase-busy { color: #28a745; }\n.accordion-phase-busy .phase-spinner {\n\tdisplay: inline-block; width: 14px; height: 14px;\n\tborder: 2px solid #28a745; border-top-color: transparent; border-radius: 50%;\n\tanimation: phase-spin 0.8s linear infinite; vertical-align: middle;\n}\n@keyframes phase-spin {\n\tto { transform: rotate(360deg); }\n}\n\n.accordion-controls {\n\tdisplay: flex; gap: 8px; margin-bottom: 12px; justify-content: flex-end;\n}\n.accordion-controls button {\n\tpadding: 4px 10px; font-size: 0.82em; font-weight: 500; background: none;\n\tborder: 1px solid #ccc; border-radius: 4px; color: #666; cursor: pointer; margin: 0;\n}\n.accordion-controls button:hover { background: #f0f0f0; border-color: #aaa; color: #333; }\n\nlabel { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9em; }\ninput[type="text"], input[type="password"], input[type="number"] {\n\twidth: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px;\n\tfont-size: 0.95em; margin-bottom: 10px;\n}\ninput[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus {\n\toutline: none; border-color: #4a90d9;\n}\n\nbutton {\n\tpadding: 8px 16px; border: none; border-radius: 4px; cursor: pointer;\n\tfont-size: 0.9em; font-weight: 600; margin-right: 8px; margin-bottom: 8px;\n}\nbutton.primary { background: #4a90d9; color: #fff; }\nbutton.primary:hover { background: #357abd; }\nbutton.secondary { background: #6c757d; color: #fff; }\nbutton.secondary:hover { background: #5a6268; }\nbutton.danger { background: #dc3545; color: #fff; }\nbutton.danger:hover { background: #c82333; }\nbutton.success { background: #28a745; color: #fff; }\nbutton.success:hover { background: #218838; }\nbutton:disabled { opacity: 0.5; cursor: not-allowed; }\n\n.status { padding: 8px 12px; border-radius: 4px; margin-top: 10px; font-size: 0.9em; }\n.status.ok { background: #d4edda; color: #155724; }\n.status.error { background: #f8d7da; color: #721c24; }\n.status.info { background: #d1ecf1; color: #0c5460; }\n.status.warn { background: #fff3cd; color: #856404; }\n\n.inline-group { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }\n.inline-group > div { flex: 1; }\n\na { color: #4a90d9; }\n\nselect { background: #fff; width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95em; margin-bottom: 10px; }\n\n.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }\n.checkbox-row input[type="checkbox"] { width: auto; margin: 0; }\n.checkbox-row label { display: inline; margin: 0; font-weight: normal; cursor: pointer; }\n\n/* Live Status Bar */\n.live-status-bar {\n\tbackground: #fff; border-radius: 8px; margin-bottom: 16px;\n\tbox-shadow: 0 1px 3px rgba(0,0,0,0.1);\n\tposition: sticky; top: 0; z-index: 100; border-left: 4px solid #6c757d;\n}\n.live-status-bar.phase-idle { border-left-color: #6c757d; }\n.live-status-bar.phase-disconnected { border-left-color: #dc3545; }\n.live-status-bar.phase-ready { border-left-color: #4a90d9; }\n.live-status-bar.phase-loading { border-left-color: #28a745; }\n.live-status-bar.phase-stopping { border-left-color: #ffc107; }\n.live-status-bar.phase-complete { border-left-color: #28a745; }\n\n.live-status-dot {\n\twidth: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;\n\tbackground: #6c757d;\n}\n.live-status-bar.phase-idle .live-status-dot { background: #6c757d; }\n.live-status-bar.phase-disconnected .live-status-dot { background: #dc3545; }\n.live-status-bar.phase-ready .live-status-dot { background: #4a90d9; }\n.live-status-bar.phase-loading .live-status-dot {\n\tbackground: #28a745;\n\tanimation: live-pulse 1.5s ease-in-out infinite;\n}\n.live-status-bar.phase-stopping .live-status-dot {\n\tbackground: #ffc107;\n\tanimation: live-pulse 0.8s ease-in-out infinite;\n}\n.live-status-bar.phase-complete .live-status-dot { background: #28a745; }\n\n@keyframes live-pulse {\n\t0%, 100% { opacity: 1; transform: scale(1); }\n\t50% { opacity: 0.4; transform: scale(0.8); }\n}\n\n.live-status-message { flex: 1; font-size: 0.92em; color: #333; line-height: 1.4; }\n\n.live-status-meta {\n\tdisplay: flex; gap: 16px; flex-shrink: 0; font-size: 0.82em; color: #666;\n}\n.live-status-meta-item { white-space: nowrap; }\n.live-status-meta-item strong { color: #333; }\n\n.live-status-progress-bar {\n\theight: 3px; background: #e9ecef; border-radius: 2px; overflow: hidden;\n\tposition: absolute; bottom: 0; left: 0; right: 0;\n}\n.live-status-progress-fill {\n\theight: 100%; background: #28a745; transition: width 1s ease;\n}\n/* Expandable status bar */\n.live-status-header {\n\tdisplay: flex; align-items: center; gap: 14px; cursor: pointer;\n\tpadding: 14px 20px; user-select: none;\n}\n.live-status-bar.expanded .live-status-header {\n\tborder-bottom: 1px solid #e9ecef; padding-bottom: 10px;\n}\n.live-status-expand-toggle {\n\tflex: 0 0 20px; display: flex; align-items: center; justify-content: center;\n\tfont-size: 0.7em; color: #888; transition: transform 0.25s;\n}\n.live-status-bar.expanded .live-status-expand-toggle { transform: rotate(180deg); }\n\n.live-status-detail {\n\tpadding: 12px 20px 16px; max-height: 60vh; overflow-y: auto;\n}\n\n/* Status Detail Sections */\n.status-detail-section { margin-bottom: 14px; }\n.status-detail-section:last-child { margin-bottom: 0; }\n.status-detail-section-title {\n\tfont-size: 0.85em; font-weight: 600; color: #555; text-transform: uppercase;\n\tletter-spacing: 0.5px; margin-bottom: 8px; padding-bottom: 4px;\n\tborder-bottom: 1px solid #eee;\n}\n\n/* Running Operations */\n.running-op-row {\n\tdisplay: flex; align-items: center; gap: 12px; padding: 6px 0;\n\tfont-size: 0.9em;\n}\n.running-op-name { font-weight: 600; min-width: 180px; }\n.running-op-bar {\n\tflex: 1; height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden;\n\tmin-width: 120px;\n}\n.running-op-bar-fill { height: 100%; background: #4a90d9; transition: width 0.5s ease; }\n.running-op-count { font-size: 0.85em; color: #666; white-space: nowrap; }\n.running-op-pending { color: #888; font-size: 0.85em; font-style: italic; padding: 4px 0; }\n\n/* Completed Operations */\n.completed-op-row { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }\n.completed-op-row:last-child { border-bottom: none; }\n.completed-op-header {\n\tdisplay: flex; align-items: center; gap: 10px; font-size: 0.9em; margin-bottom: 4px;\n}\n.completed-op-name { font-weight: 600; }\n.completed-op-stats { color: #666; font-size: 0.85em; }\n.completed-op-checkmark { color: #28a745; }\n\n/* Error Operations */\n.error-op-row { padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9em; }\n.error-op-row:last-child { border-bottom: none; }\n.error-op-header { display: flex; align-items: center; gap: 8px; }\n.error-op-name { font-weight: 600; color: #dc3545; }\n.error-op-status { font-size: 0.82em; color: #dc3545; }\n.error-op-message { font-size: 0.82em; color: #888; margin-top: 2px; padding-left: 18px; }\n',Templates:[{Hash:"ComprehensionLoader-Layout",Template:'\n<h1>Retold Comprehension Loader</h1>\n\n\x3c!-- Live Status Bar (Expandable) --\x3e\n<div id="liveStatusBar" class="live-status-bar phase-idle" style="position:relative">\n\t<div class="live-status-header" onclick="pict.views[\'ComprehensionLoader-Layout\'].toggleStatusDetail()">\n\t\t<div class="live-status-dot"></div>\n\t\t<div class="live-status-message" id="liveStatusMessage">Idle</div>\n\t\t<div class="live-status-meta" id="liveStatusMeta"></div>\n\t\t<div class="live-status-expand-toggle" id="liveStatusToggle">&#9660;</div>\n\t</div>\n\t<div class="live-status-detail" id="liveStatusDetail" style="display:none">\n\t\t<div id="ComprehensionLoader-Throughput-Histogram"></div>\n\t\t<div id="ComprehensionLoader-StatusDetail-Container"></div>\n\t</div>\n\t<div class="live-status-progress-bar"><div class="live-status-progress-fill" id="liveStatusProgressFill" style="width:0%"></div></div>\n</div>\n\n\x3c!-- Expand / Collapse All --\x3e\n<div class="accordion-controls">\n\t<button onclick="pict.views[\'ComprehensionLoader-Layout\'].expandAllSections()">Expand All</button>\n\t<button onclick="pict.views[\'ComprehensionLoader-Layout\'].collapseAllSections()">Collapse All</button>\n</div>\n\n\x3c!-- Section containers --\x3e\n<div id="ComprehensionLoader-Section-Session"></div>\n<div id="ComprehensionLoader-Section-Schema"></div>\n<div id="ComprehensionLoader-Section-Source"></div>\n<div id="ComprehensionLoader-Section-Load"></div>\n'}],Renderables:[{RenderableHash:"ComprehensionLoader-Layout",TemplateHash:"ComprehensionLoader-Layout",DestinationAddress:"#ComprehensionLoader-Application-Container"}]}},{"pict-view":13}],20:[function(t,e,i){const o=t("pict-view");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}startLoad(){this.pict.providers.ComprehensionLoader.setSectionPhase(4,"busy"),this.pict.providers.ComprehensionLoader.setStatus("loadStatus","Starting load...","info"),this.pict.AppData.ComprehensionLoader.LastReport=null;let t=this;this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/load/start").then(function(e){if(e.Success){let i="Load started for "+e.Entities.length+" entities ("+t.pict.providers.ComprehensionLoader.formatNumber(e.TotalRecords)+" records).";t.pict.providers.ComprehensionLoader.setStatus("loadStatus",i,"ok"),t.startPolling()}else t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Load start failed: "+(e.Error||"Unknown error"),"error"),t.pict.providers.ComprehensionLoader.setSectionPhase(4,"error")}).catch(function(e){t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Request failed: "+e.message,"error"),t.pict.providers.ComprehensionLoader.setSectionPhase(4,"error")})}stopLoad(){let t=this;this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/load/stop").then(function(e){t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Load stop requested.","warn")}).catch(function(e){t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Request failed: "+e.message,"error")})}startPolling(){this.pict.AppData.ComprehensionLoader.LoadPollTimer&&clearInterval(this.pict.AppData.ComprehensionLoader.LoadPollTimer);let t=this;this.pict.AppData.ComprehensionLoader.LoadPollTimer=setInterval(function(){t.pollLoadStatus()},2e3),this.pollLoadStatus()}stopPolling(){this.pict.AppData.ComprehensionLoader.LoadPollTimer&&(clearInterval(this.pict.AppData.ComprehensionLoader.LoadPollTimer),this.pict.AppData.ComprehensionLoader.LoadPollTimer=null)}pollLoadStatus(){let t=this;this.pict.providers.ComprehensionLoader.api("GET","/comprehension_load/load/status").then(function(e){if(t.renderLoadProgress(e),!e.Running){t.stopPolling();let i=e.Entities||{},o=Object.keys(i);if(o.length>0){let e=!1;for(let t=0;t<o.length;t++)"Error"===i[o[t]].Status&&(e=!0);e?(t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Load finished with errors.","error"),t.pict.providers.ComprehensionLoader.setSectionPhase(4,"error")):(t.pict.providers.ComprehensionLoader.setStatus("loadStatus","Load complete.","ok"),t.pict.providers.ComprehensionLoader.setSectionPhase(4,"ok")),t.fetchLoadReport()}}}).catch(function(t){})}fetchLoadReport(){let t=this;this.pict.providers.ComprehensionLoader.api("GET","/comprehension_load/load/report").then(function(e){e&&e.ReportVersion&&(t.pict.AppData.ComprehensionLoader.LastReport=e,t.renderLoadReport(e))}).catch(function(t){})}renderLoadReport(t){let e=document.getElementById("loadReportSection");if(!e)return;e.style.display="";let i=document.getElementById("reportSummaryCards"),o="outcome-"+t.Outcome.toLowerCase(),s={Success:"#28a745",Partial:"#ffc107",Error:"#dc3545",Stopped:"#6c757d"}[t.Outcome]||"#666",n=t.RunTimestamps.DurationSeconds||0,r=n<60?n+"s":Math.floor(n/60)+"m "+n%60+"s",a=this.pict.providers.ComprehensionLoader.formatNumber(t.Summary.TotalPushed),l=this.pict.providers.ComprehensionLoader.formatNumber(t.Summary.TotalRecords);i.innerHTML='<div class="report-card '+o+'"> <div class="card-label">Outcome</div> <div class="card-value" style="color:'+s+'">'+t.Outcome+'</div></div><div class="report-card"> <div class="card-label">Duration</div> <div class="card-value">'+r+'</div></div><div class="report-card"> <div class="card-label">Entities</div> <div class="card-value">'+t.Summary.Complete+" / "+t.Summary.TotalEntities+'</div></div><div class="report-card"> <div class="card-label">Records Pushed</div> <div class="card-value">'+a+'</div> <div style="font-size:0.75em; color:#888">of '+l+"</div></div>";let c=document.getElementById("reportAnomalies");if(0===t.Anomalies.length)c.innerHTML='<div style="color:#28a745; font-weight:600; font-size:0.9em">No anomalies detected.</div>';else{let e='<h4 style="margin:0 0 8px; color:#dc3545; font-size:0.95em">Anomalies ('+t.Anomalies.length+")</h4>";e+='<table class="progress-table">',e+="<tr><th>Entity</th><th>Type</th><th>Message</th></tr>";for(let i=0;i<t.Anomalies.length;i++){let o=t.Anomalies[i],s="Error"===o.Type?"#dc3545":"#6c757d";e+="<tr>",e+="<td><strong>"+this.pict.providers.ComprehensionLoader.escapeHtml(o.Entity)+"</strong></td>",e+='<td style="color:'+s+'">'+o.Type+"</td>",e+="<td>"+this.pict.providers.ComprehensionLoader.escapeHtml(o.Message)+"</td>",e+="</tr>"}e+="</table>",c.innerHTML=e}let d=document.getElementById("reportEntityDetails");if(t.Entities&&t.Entities.length>0){let e='<h4 style="margin:0 0 8px; font-size:0.95em; color:#444">Entity Details</h4>';e+='<table class="progress-table">',e+="<tr><th>Entity</th><th>Duration</th><th>Records</th><th>Status</th></tr>";for(let i=0;i<t.Entities.length;i++){let o=t.Entities[i],s=o.DurationSeconds<60?o.DurationSeconds+"s":Math.floor(o.DurationSeconds/60)+"m "+o.DurationSeconds%60+"s",n=this.pict.providers.ComprehensionLoader.formatNumber(o.Pushed),r={Complete:"#28a745",Error:"#dc3545"}[o.Status]||"#666";e+="<tr>",e+="<td><strong>"+this.pict.providers.ComprehensionLoader.escapeHtml(o.Name)+"</strong></td>",e+="<td>"+s+"</td>",e+="<td>"+n+"</td>",e+='<td style="color:'+r+'">'+o.Status+"</td>",e+="</tr>"}e+="</table>",d.innerHTML=e}}downloadReport(){if(!this.pict.AppData.ComprehensionLoader.LastReport)return void this.pict.providers.ComprehensionLoader.setStatus("reportStatus","No report available.","warn");let t=JSON.stringify(this.pict.AppData.ComprehensionLoader.LastReport,null,"\t"),e=new Blob([t],{type:"application/json"}),i=document.createElement("a");i.href=URL.createObjectURL(e);let o=(new Date).toISOString().replace(/[:.]/g,"-").slice(0,19);i.download="ComprehensionLoader-Report-"+o+".json",i.click(),URL.revokeObjectURL(i.href),this.pict.providers.ComprehensionLoader.setStatus("reportStatus","Report downloaded.","ok")}copyReport(){if(!this.pict.AppData.ComprehensionLoader.LastReport)return void this.pict.providers.ComprehensionLoader.setStatus("reportStatus","No report available.","warn");let t=JSON.stringify(this.pict.AppData.ComprehensionLoader.LastReport,null,"\t"),e=this;navigator.clipboard.writeText(t).then(function(){e.pict.providers.ComprehensionLoader.setStatus("reportStatus","Report copied to clipboard.","ok")})}renderLoadProgress(t){let e=document.getElementById("loadProgress"),i=t.Entities||{},o=Object.keys(i);if(0===o.length)return void(e.innerHTML="");let s=[],n=[],r=[],a=[];for(let t=0;t<o.length;t++){let e=o[t],l=i[e];"Pushing"===l.Status?s.push({Name:e,Data:l}):"Pending"===l.Status?n.push({Name:e,Data:l}):"Complete"===l.Status?r.push({Name:e,Data:l}):a.push({Name:e,Data:l})}let l="",c=this,d=function(t,e){let i=0;0===e.Total&&"Complete"===e.Status?i=100:e.Total>0&&(i=Math.round(e.Pushed/e.Total*100));let o="#28a745";"Error"===e.Status?o="#dc3545":"Pushing"===e.Status?o="#4a90d9":"Pending"===e.Status&&(o="#adb5bd");let s="<tr>";return s+="<td><strong>"+t+"</strong></td>",s+="<td>"+e.Status+"</td>",s+="<td>",s+='<div class="progress-bar-container"><div class="progress-bar-fill" style="width:'+i+"%; background:"+o+'"></div></div>',s+=" "+i+"%",s+="</td>",s+="<td>"+(e.Pushed||0)+" / "+(e.Total||0)+"</td>",s+="</tr>",s};if(s.length>0){l+='<div class="sync-section-header">Pushing</div>',l+='<table class="progress-table">',l+="<tr><th>Entity</th><th>Status</th><th>Progress</th><th>Pushed</th></tr>";for(let t=0;t<s.length;t++)l+=d(s[t].Name,s[t].Data);l+="</table>"}if(n.length>0){l+='<div class="sync-section-header">Next Up <span class="sync-section-count">'+n.length+"</span></div>";let t=Math.min(8,n.length);l+='<table class="progress-table progress-table-muted">';for(let e=0;e<t;e++)l+="<tr><td>"+n[e].Name+"</td>",n[e].Data.Total>0?l+='<td class="sync-pending-count">'+c.pict.providers.ComprehensionLoader.formatNumber(n[e].Data.Total)+" records</td>":l+='<td class="sync-pending-count">—</td>',l+="</tr>";l+="</table>",n.length>t&&(l+='<div class="sync-section-overflow">+ '+(n.length-t)+" more</div>")}if(a.length>0){l+='<div class="sync-section-header sync-section-header-error">Errors <span class="sync-section-count">'+a.length+"</span></div>",l+='<table class="progress-table">',l+="<tr><th>Entity</th><th>Status</th><th>Progress</th><th>Pushed</th></tr>";for(let t=0;t<a.length;t++)l+=d(a[t].Name,a[t].Data);l+="</table>"}if(r.length>0){l+='<div class="sync-section-header sync-section-header-ok">Completed <span class="sync-section-count">'+r.length+"</span></div>",l+='<table class="progress-table">',l+="<tr><th>Entity</th><th>Status</th><th>Progress</th><th>Pushed</th></tr>";for(let t=0;t<r.length;t++)l+=d(r[t].Name,r[t].Data);l+="</table>"}e.innerHTML=l}},e.exports.default_configuration={ViewIdentifier:"ComprehensionLoader-Load",DefaultRenderable:"ComprehensionLoader-Load",DefaultDestinationAddress:"#ComprehensionLoader-Section-Load",CSS:"\n.progress-table { width: 100%; border-collapse: collapse; margin-top: 4px; margin-bottom: 4px; }\n.progress-table th, .progress-table td { text-align: left; padding: 6px 12px; border-bottom: 1px solid #eee; font-size: 0.9em; }\n.progress-table th { background: #f8f9fa; font-weight: 600; }\n.progress-table-muted td { color: #888; padding: 3px 12px; font-size: 0.85em; border-bottom: 1px solid #f4f5f6; }\n.progress-bar-container { width: 120px; height: 16px; background: #e9ecef; border-radius: 8px; overflow: hidden; display: inline-block; vertical-align: middle; }\n.progress-bar-fill { height: 100%; background: #28a745; transition: width 0.3s; }\n.sync-section-header { font-size: 0.8em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #4a90d9; padding: 10px 0 2px 0; margin-top: 6px; border-top: 1px solid #e0e0e0; }\n.sync-section-header:first-child { border-top: none; margin-top: 10px; }\n.sync-section-header-error { color: #dc3545; }\n.sync-section-header-ok { color: #28a745; }\n.sync-section-count { font-weight: 400; color: #999; font-size: 0.95em; }\n.sync-section-overflow { font-size: 0.8em; color: #aaa; padding: 2px 12px 6px; }\n.sync-pending-count { text-align: right; color: #aaa; font-size: 0.85em; }\n.report-card { background: #f8f9fa; border-radius: 8px; padding: 12px 16px; min-width: 140px; text-align: center; border: 1px solid #e9ecef; }\n.report-card .card-label { font-size: 0.8em; color: #666; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }\n.report-card .card-value { font-size: 1.4em; font-weight: 700; }\n.report-card.outcome-success { border-left: 4px solid #28a745; }\n.report-card.outcome-partial { border-left: 4px solid #ffc107; }\n.report-card.outcome-error { border-left: 4px solid #dc3545; }\n.report-card.outcome-stopped { border-left: 4px solid #6c757d; }\n",Templates:[{Hash:"ComprehensionLoader-Load",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">4</div>\n\t<div class="accordion-card" id="section4" data-section="4">\n\t\t<div class="accordion-header" onclick="pict.views[\'ComprehensionLoader-Layout\'].toggleSection(\'section4\')">\n\t\t\t<div class="accordion-title">Load</div>\n\t\t\t<span class="accordion-phase" id="phase4"></span>\n\t\t\t<div class="accordion-preview" id="preview4">Push comprehension data to the remote server</div>\n\t\t\t<div class="accordion-actions">\n\t\t\t\t<span class="accordion-go" onclick="event.stopPropagation(); pict.views[\'ComprehensionLoader-Load\'].startLoad()">go</span>\n\t\t\t\t<label class="accordion-auto" onclick="event.stopPropagation()"><input type="checkbox" id="auto4"> <span class="auto-label">auto</span></label>\n\t\t\t</div>\n\t\t\t<div class="accordion-toggle">&#9660;</div>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<div style="display:flex; gap:8px; margin-bottom:10px">\n\t\t\t\t<button class="success" style="margin:0" onclick="pict.views[\'ComprehensionLoader-Load\'].startLoad()">Start Load</button>\n\t\t\t\t<button class="danger" style="margin:0" onclick="pict.views[\'ComprehensionLoader-Load\'].stopLoad()">Stop Load</button>\n\t\t\t</div>\n\n\t\t\t<div id="loadStatus"></div>\n\t\t\t<div id="loadProgress"></div>\n\n\t\t\t\x3c!-- Load Report (appears after load completes) --\x3e\n\t\t\t<div id="loadReportSection" style="display:none; margin-top:16px; padding-top:16px; border-top:2px solid #ddd">\n\t\t\t\t<h3 style="margin:0 0 12px; font-size:1.1em">Load Report</h3>\n\n\t\t\t\t<div id="reportSummaryCards" style="display:flex; gap:12px; flex-wrap:wrap; margin-bottom:16px"></div>\n\t\t\t\t<div id="reportAnomalies" style="margin-bottom:16px"></div>\n\t\t\t\t<div id="reportEntityDetails" style="margin-bottom:16px"></div>\n\n\t\t\t\t<div style="display:flex; gap:8px">\n\t\t\t\t\t<button class="secondary" onclick="pict.views[\'ComprehensionLoader-Load\'].downloadReport()">Download Report JSON</button>\n\t\t\t\t\t<button class="secondary" onclick="pict.views[\'ComprehensionLoader-Load\'].copyReport()">Copy Report</button>\n\t\t\t\t</div>\n\t\t\t\t<div id="reportStatus"></div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ComprehensionLoader-Load",TemplateHash:"ComprehensionLoader-Load",DestinationAddress:"#ComprehensionLoader-Section-Load"}]}},{"pict-view":13}],21:[function(t,e,i){const o=t("pict-view");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}fetchSchema(){let t=document.getElementById("schemaURL").value.trim(),e={};t&&(e.SchemaURL=t),this.pict.providers.ComprehensionLoader.setSectionPhase(2,"busy"),this.pict.providers.ComprehensionLoader.setStatus("schemaStatus","Fetching schema...","info"),this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/schema/fetch",e).then(t=>{t.Success?(this.pict.AppData.ComprehensionLoader.FetchedEntities=t.Entities||[],this.pict.providers.ComprehensionLoader.setStatus("schemaStatus","Fetched schema with "+t.EntityCount+" entities from "+t.SchemaURL,"ok"),this.pict.providers.ComprehensionLoader.setSectionPhase(2,"ok"),this.renderEntityList(),this.pict.providers.ComprehensionLoader.updateAllPreviews()):(this.pict.providers.ComprehensionLoader.setStatus("schemaStatus","Fetch failed: "+(t.Error||"Unknown error"),"error"),this.pict.providers.ComprehensionLoader.setSectionPhase(2,"error"))}).catch(t=>{this.pict.providers.ComprehensionLoader.setStatus("schemaStatus","Request failed: "+t.message,"error"),this.pict.providers.ComprehensionLoader.setSectionPhase(2,"error")})}renderEntityList(){let t=this.pict.AppData.ComprehensionLoader.FetchedEntities||[],e=document.getElementById("entityList");if(!e)return;if(0===t.length)return void(e.innerHTML='<div style="color:#888; font-size:0.9em">No entities found.</div>');let i='<div style="font-size:0.9em; color:#555">';for(let e=0;e<t.length;e++)i+='<span style="display:inline-block; background:#f0f0f0; border-radius:4px; padding:2px 8px; margin:2px 4px 2px 0; font-size:0.9em">',i+=this.pict.providers.ComprehensionLoader.escapeHtml(t[e]),i+="</span>";i+="</div>",e.innerHTML=i}},e.exports.default_configuration={ViewIdentifier:"ComprehensionLoader-Schema",DefaultRenderable:"ComprehensionLoader-Schema",DefaultDestinationAddress:"#ComprehensionLoader-Section-Schema",Templates:[{Hash:"ComprehensionLoader-Schema",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">2</div>\n\t<div class="accordion-card" id="section2" data-section="2">\n\t\t<div class="accordion-header" onclick="pict.views[\'ComprehensionLoader-Layout\'].toggleSection(\'section2\')">\n\t\t\t<div class="accordion-title">Remote Schema</div>\n\t\t\t<span class="accordion-phase" id="phase2"></span>\n\t\t\t<div class="accordion-preview" id="preview2">Fetch entity schema from the remote server</div>\n\t\t\t<div class="accordion-actions">\n\t\t\t\t<span class="accordion-go" onclick="event.stopPropagation(); pict.views[\'ComprehensionLoader-Schema\'].fetchSchema()">go</span>\n\t\t\t\t<label class="accordion-auto" onclick="event.stopPropagation()"><input type="checkbox" id="auto2"> <span class="auto-label">auto</span></label>\n\t\t\t</div>\n\t\t\t<div class="accordion-toggle">&#9660;</div>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<label for="schemaURL">Schema URL (leave blank for default: ServerURL + Retold/Models)</label>\n\t\t\t<input type="text" id="schemaURL" placeholder="http://remote-server:8086/1.0/Retold/Models">\n\n\t\t\t<button class="primary" onclick="pict.views[\'ComprehensionLoader-Schema\'].fetchSchema()">Fetch Schema</button>\n\t\t\t<div id="schemaStatus"></div>\n\n\t\t\t<div id="entityList" style="margin-top:12px"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ComprehensionLoader-Schema",TemplateHash:"ComprehensionLoader-Schema",DestinationAddress:"#ComprehensionLoader-Section-Schema"}]}},{"pict-view":13}],22:[function(t,e,i){const o=t("pict-view");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}configureSession(){let t=document.getElementById("serverURL").value.trim();if(!t)return void this.pict.providers.ComprehensionLoader.setStatus("sessionConfigStatus","Server URL is required.","error");let e={ServerURL:t.replace(/\/+$/,"")+"/1.0/"},i=document.getElementById("authMethod").value.trim();i&&(e.AuthenticationMethod=i);let o=document.getElementById("authURI").value.trim();o&&(e.AuthenticationURITemplate=o);let s=document.getElementById("checkURI").value.trim();s&&(e.CheckSessionURITemplate=s);let n=document.getElementById("cookieName").value.trim();n&&(e.CookieName=n);let r=document.getElementById("cookieValueAddr").value.trim();r&&(e.CookieValueAddress=r);let a=document.getElementById("cookieValueTemplate").value.trim();a&&(e.CookieValueTemplate=a);let l=document.getElementById("loginMarker").value.trim();l&&(e.CheckSessionLoginMarker=l),this.pict.providers.ComprehensionLoader.setStatus("sessionConfigStatus","Configuring session...","info"),this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/session/configure",e).then(t=>{t.Success?this.pict.providers.ComprehensionLoader.setStatus("sessionConfigStatus","Session configured for "+t.ServerURL+" (domain: "+t.DomainMatch+")","ok"):this.pict.providers.ComprehensionLoader.setStatus("sessionConfigStatus","Configuration failed: "+(t.Error||"Unknown error"),"error")}).catch(t=>{this.pict.providers.ComprehensionLoader.setStatus("sessionConfigStatus","Request failed: "+t.message,"error")})}authenticate(){let t=document.getElementById("userName").value.trim(),e=document.getElementById("password").value.trim();if(!t||!e)return this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Username and password are required.","error"),void this.pict.providers.ComprehensionLoader.setSectionPhase(1,"error");this.pict.providers.ComprehensionLoader.setSectionPhase(1,"busy"),this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Authenticating...","info"),this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/session/authenticate",{UserName:t,Password:e}).then(t=>{t.Success&&t.Authenticated?(this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Authenticated successfully.","ok"),this.pict.providers.ComprehensionLoader.setSectionPhase(1,"ok")):(this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Authentication failed: "+(t.Error||"Not authenticated"),"error"),this.pict.providers.ComprehensionLoader.setSectionPhase(1,"error"))}).catch(t=>{this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Request failed: "+t.message,"error"),this.pict.providers.ComprehensionLoader.setSectionPhase(1,"error")})}checkSession(){this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Checking session...","info"),this.pict.providers.ComprehensionLoader.api("GET","/comprehension_load/session/check").then(t=>{t.Authenticated?this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Session is active. Server: "+(t.ServerURL||"N/A"),"ok"):t.Configured?this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Session configured but not authenticated.","warn"):this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","No session configured.","warn")}).catch(t=>{this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Request failed: "+t.message,"error")})}deauthenticate(){this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/session/deauthenticate").then(t=>{this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Session deauthenticated.","info"),this.pict.providers.ComprehensionLoader.setSectionPhase(1,"")}).catch(t=>{this.pict.providers.ComprehensionLoader.setStatus("sessionAuthStatus","Request failed: "+t.message,"error")})}goAction(){this.pict.providers.ComprehensionLoader.setSectionPhase(1,"busy"),this.configureSession(),setTimeout(()=>{this.authenticate()},1500)}},e.exports.default_configuration={ViewIdentifier:"ComprehensionLoader-Session",DefaultRenderable:"ComprehensionLoader-Session",DefaultDestinationAddress:"#ComprehensionLoader-Section-Session",Templates:[{Hash:"ComprehensionLoader-Session",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">1</div>\n\t<div class="accordion-card" id="section1" data-section="1">\n\t\t<div class="accordion-header" onclick="pict.views[\'ComprehensionLoader-Layout\'].toggleSection(\'section1\')">\n\t\t\t<div class="accordion-title">Remote Session</div>\n\t\t\t<span class="accordion-phase" id="phase1"></span>\n\t\t\t<div class="accordion-preview" id="preview1">Configure remote server URL and credentials</div>\n\t\t\t<div class="accordion-actions">\n\t\t\t\t<span class="accordion-go" onclick="event.stopPropagation(); pict.views[\'ComprehensionLoader-Session\'].goAction()">go</span>\n\t\t\t\t<label class="accordion-auto" onclick="event.stopPropagation()"><input type="checkbox" id="auto1"> <span class="auto-label">auto</span></label>\n\t\t\t</div>\n\t\t\t<div class="accordion-toggle">&#9660;</div>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<div class="inline-group">\n\t\t\t\t<div style="flex:2">\n\t\t\t\t\t<label for="serverURL">Remote Server URL</label>\n\t\t\t\t\t<input type="text" id="serverURL" placeholder="http://remote-server:8086" value="">\n\t\t\t\t</div>\n\t\t\t\t<div style="flex:1">\n\t\t\t\t\t<label for="authMethod">Auth Method</label>\n\t\t\t\t\t<input type="text" id="authMethod" placeholder="get" value="get">\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<details style="margin-bottom:10px">\n\t\t\t\t<summary style="cursor:pointer; font-size:0.9em; color:#666">Advanced Session Options</summary>\n\t\t\t\t<div style="padding:10px 0">\n\t\t\t\t\t<label for="authURI">Authentication URI Template (leave blank for default)</label>\n\t\t\t\t\t<input type="text" id="authURI" placeholder="Authenticate/{~D:Record.UserName~}/{~D:Record.Password~}">\n\t\t\t\t\t<label for="checkURI">Check Session URI Template</label>\n\t\t\t\t\t<input type="text" id="checkURI" placeholder="CheckSession">\n\t\t\t\t\t<label for="cookieName">Cookie Name</label>\n\t\t\t\t\t<input type="text" id="cookieName" placeholder="SessionID" value="SessionID">\n\t\t\t\t\t<label for="cookieValueAddr">Cookie Value Address</label>\n\t\t\t\t\t<input type="text" id="cookieValueAddr" placeholder="SessionID" value="SessionID">\n\t\t\t\t\t<label for="cookieValueTemplate">Cookie Value Template (overrides Address if set)</label>\n\t\t\t\t\t<input type="text" id="cookieValueTemplate" placeholder="{~D:Record.SessionID~}">\n\t\t\t\t\t<label for="loginMarker">Login Marker</label>\n\t\t\t\t\t<input type="text" id="loginMarker" placeholder="LoggedIn" value="LoggedIn">\n\t\t\t\t</div>\n\t\t\t</details>\n\n\t\t\t<button class="primary" onclick="pict.views[\'ComprehensionLoader-Session\'].configureSession()">Configure Session</button>\n\t\t\t<div id="sessionConfigStatus"></div>\n\n\t\t\t<hr style="margin:16px 0; border:none; border-top:1px solid #eee">\n\n\t\t\t<div class="inline-group">\n\t\t\t\t<div>\n\t\t\t\t\t<label for="userName">Username</label>\n\t\t\t\t\t<input type="text" id="userName" placeholder="username">\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<label for="password">Password</label>\n\t\t\t\t\t<input type="password" id="password" placeholder="password">\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<button class="success" onclick="pict.views[\'ComprehensionLoader-Session\'].authenticate()">Authenticate</button>\n\t\t\t<button class="secondary" onclick="pict.views[\'ComprehensionLoader-Session\'].checkSession()">Check Session</button>\n\t\t\t<button class="danger" onclick="pict.views[\'ComprehensionLoader-Session\'].deauthenticate()">Deauthenticate</button>\n\t\t\t<div id="sessionAuthStatus"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ComprehensionLoader-Session",TemplateHash:"ComprehensionLoader-Session",DestinationAddress:"#ComprehensionLoader-Section-Session"}]}},{"pict-view":13}],23:[function(t,e,i){const o=t("pict-view");e.exports=class extends o{constructor(t,e,i){super(t,e,i)}onAfterRender(){if("file"===localStorage.getItem("comprehensionLoader_comprehensionSourceMode")){let t=document.getElementById("sourceMode_file");t&&(t.checked=!0)}this.onSourceModeChange()}onSourceModeChange(){let t=document.querySelector('input[name="comprehensionSourceMode"]:checked'),e=t?t.value:"url",i=document.getElementById("sourceURLSection"),o=document.getElementById("sourceFileSection");i&&(i.style.display="url"===e?"":"none"),o&&(o.style.display="file"===e?"":"none"),this.pict.providers.ComprehensionLoader.updateAllPreviews()}fetchFromURL(){let t=document.getElementById("comprehensionURL").value.trim();if(!t)return void this.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Comprehension URL is required.","error");this.pict.providers.ComprehensionLoader.setSectionPhase(3,"busy"),this.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Fetching comprehension...","info");let e=this;fetch(t).then(function(t){if(!t.ok)throw new Error("HTTP "+t.status);return t.json()}).then(function(t){e.sendComprehensionToServer(t)}).catch(function(i){e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Direct fetch failed ("+i.message+"), trying server proxy...","info"),e.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/comprehension/proxy-fetch",{URL:t}).then(function(t){t.Success?(e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Loaded via proxy: "+t.EntityCount+" entities, "+e.pict.providers.ComprehensionLoader.formatNumber(t.TotalRecords)+" records.","ok"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"ok"),e.renderComprehensionSummary(t)):(e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Proxy fetch failed: "+(t.Error||"Unknown error"),"error"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error"))}).catch(function(t){e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Proxy request failed: "+t.message,"error"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error")})})}loadFromFiles(){let t=document.getElementById("comprehensionFiles");if(!t||0===t.files.length)return void this.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Please select one or more JSON files.","error");this.pict.providers.ComprehensionLoader.setSectionPhase(3,"busy"),this.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Reading files...","info");let e=this,i=t.files,o={},s=0;for(let t=0;t<i.length;t++)(function(t){let n=new FileReader;n.onload=function(n){try{let t=JSON.parse(n.target.result),e=Object.keys(t);for(let i=0;i<e.length;i++){let s=e[i];Array.isArray(t[s])?(o[s]||(o[s]=[]),o[s]=o[s].concat(t[s])):o[s]=t[s]}}catch(i){return e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Error parsing "+t.name+": "+i.message,"error"),void e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error")}s++,s===i.length&&e.sendComprehensionToServer(o)},n.onerror=function(){e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Error reading "+t.name,"error"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error")},n.readAsText(t)})(i[t])}sendComprehensionToServer(t){let e=this;this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/comprehension/receive",{Comprehension:t}).then(function(t){t.Success?(e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Loaded: "+t.EntityCount+" entities, "+e.pict.providers.ComprehensionLoader.formatNumber(t.TotalRecords)+" records.","ok"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"ok"),e.renderComprehensionSummary(t)):(e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Failed: "+(t.Error||"Unknown error"),"error"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error"))}).catch(function(t){e.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Request failed: "+t.message,"error"),e.pict.providers.ComprehensionLoader.setSectionPhase(3,"error")})}renderComprehensionSummary(t){let e=document.getElementById("comprehensionSummary");if(!e)return;let i='<table style="width:100%; border-collapse:collapse; margin-top:8px; font-size:0.9em">';i+='<thead><tr><th style="text-align:left; padding:6px 12px; border-bottom:2px solid #ddd">Entity</th>',i+='<th style="text-align:right; padding:6px 12px; border-bottom:2px solid #ddd">Records</th></tr></thead>',i+="<tbody>";let o=t.EntityList||[],s=t.RecordCounts||{};for(let t=0;t<o.length;t++){let e=o[t],n=s[e]||0;i+="<tr>",i+='<td style="padding:4px 12px; border-bottom:1px solid #f0f0f0">'+this.pict.providers.ComprehensionLoader.escapeHtml(e)+"</td>",i+='<td style="padding:4px 12px; border-bottom:1px solid #f0f0f0; text-align:right; font-variant-numeric:tabular-nums">'+this.pict.providers.ComprehensionLoader.formatNumber(n)+"</td>",i+="</tr>"}i+="</tbody>",i+="<tfoot><tr>",i+='<td style="padding:6px 12px; font-weight:600">Total</td>',i+='<td style="padding:6px 12px; text-align:right; font-weight:600; font-variant-numeric:tabular-nums">'+this.pict.providers.ComprehensionLoader.formatNumber(t.TotalRecords)+"</td>",i+="</tr></tfoot>",i+="</table>",e.innerHTML=i,e.style.display=""}clearComprehension(){let t=this;this.pict.providers.ComprehensionLoader.api("POST","/comprehension_load/comprehension/clear").then(function(e){if(e.Success){t.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Comprehension data cleared.","info"),t.pict.providers.ComprehensionLoader.setSectionPhase(3,"");let e=document.getElementById("comprehensionSummary");e&&(e.innerHTML="",e.style.display="none")}}).catch(function(e){t.pict.providers.ComprehensionLoader.setStatus("sourceStatus","Request failed: "+e.message,"error")})}goAction(){let t=document.querySelector('input[name="comprehensionSourceMode"]:checked');"url"===(t?t.value:"url")?this.fetchFromURL():this.loadFromFiles()}},e.exports.default_configuration={ViewIdentifier:"ComprehensionLoader-Source",DefaultRenderable:"ComprehensionLoader-Source",DefaultDestinationAddress:"#ComprehensionLoader-Section-Source",Templates:[{Hash:"ComprehensionLoader-Source",Template:'\n<div class="accordion-row">\n\t<div class="accordion-number">3</div>\n\t<div class="accordion-card" id="section3" data-section="3">\n\t\t<div class="accordion-header" onclick="pict.views[\'ComprehensionLoader-Layout\'].toggleSection(\'section3\')">\n\t\t\t<div class="accordion-title">Comprehension Source</div>\n\t\t\t<span class="accordion-phase" id="phase3"></span>\n\t\t\t<div class="accordion-preview" id="preview3">Provide a comprehension JSON URL or upload files</div>\n\t\t\t<div class="accordion-actions">\n\t\t\t\t<span class="accordion-go" onclick="event.stopPropagation(); pict.views[\'ComprehensionLoader-Source\'].goAction()">go</span>\n\t\t\t\t<label class="accordion-auto" onclick="event.stopPropagation()"><input type="checkbox" id="auto3"> <span class="auto-label">auto</span></label>\n\t\t\t</div>\n\t\t\t<div class="accordion-toggle">&#9660;</div>\n\t\t</div>\n\t\t<div class="accordion-body">\n\t\t\t<div style="margin-bottom:12px">\n\t\t\t\t<label style="margin-bottom:6px">Source Mode</label>\n\t\t\t\t<div style="display:flex; gap:16px; align-items:center">\n\t\t\t\t\t<label style="font-weight:normal; margin:0; cursor:pointer">\n\t\t\t\t\t\t<input type="radio" name="comprehensionSourceMode" id="sourceMode_url" value="url" checked onchange="pict.views[\'ComprehensionLoader-Source\'].onSourceModeChange()"> URL\n\t\t\t\t\t\t<span style="color:#888; font-size:0.85em">(fetch from a URL)</span>\n\t\t\t\t\t</label>\n\t\t\t\t\t<label style="font-weight:normal; margin:0; cursor:pointer">\n\t\t\t\t\t\t<input type="radio" name="comprehensionSourceMode" id="sourceMode_file" value="file" onchange="pict.views[\'ComprehensionLoader-Source\'].onSourceModeChange()"> File Upload\n\t\t\t\t\t\t<span style="color:#888; font-size:0.85em">(load JSON from local files)</span>\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div id="sourceURLSection">\n\t\t\t\t<label for="comprehensionURL">Comprehension JSON URL</label>\n\t\t\t\t<input type="text" id="comprehensionURL" placeholder="http://example.com/comprehension.json">\n\t\t\t\t<button class="primary" onclick="pict.views[\'ComprehensionLoader-Source\'].fetchFromURL()">Fetch Comprehension</button>\n\t\t\t</div>\n\n\t\t\t<div id="sourceFileSection" style="display:none">\n\t\t\t\t<label for="comprehensionFiles">Comprehension JSON File(s)</label>\n\t\t\t\t<input type="file" id="comprehensionFiles" multiple accept=".json" style="margin-bottom:10px">\n\t\t\t\t<div style="font-size:0.8em; color:#888; margin-bottom:10px">Multiple files will be merged (entity keys combined).</div>\n\t\t\t\t<button class="primary" onclick="pict.views[\'ComprehensionLoader-Source\'].loadFromFiles()">Load Files</button>\n\t\t\t</div>\n\n\t\t\t<button class="secondary" onclick="pict.views[\'ComprehensionLoader-Source\'].clearComprehension()" style="margin-left:0">Clear Comprehension</button>\n\t\t\t<div id="sourceStatus"></div>\n\n\t\t\t<div id="comprehensionSummary" style="display:none"></div>\n\t\t</div>\n\t</div>\n</div>\n'}],Renderables:[{RenderableHash:"ComprehensionLoader-Source",TemplateHash:"ComprehensionLoader-Source",DestinationAddress:"#ComprehensionLoader-Section-Source"}]}},{"pict-view":13}]},{},[17])(17)});
2
+ //# sourceMappingURL=comprehension-loader.min.js.map