@stlite/desktop 0.27.3 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var O=Object.create;var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $(t))!F.call(e,o)&&o!==r&&h(e,o,{get:()=>t[o],enumerable:!(i=P(t,o))||i.enumerable});return e};var n=(e,t,r)=>(r=e!=null?O(j(e)):{},x(t||!e||!e.__esModule?h(r,"default",{value:e,enumerable:!0}):r,e));var w=g(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.parseRequirementsTxt=void 0;function C(e){return e.split(`
3
- `).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var v=g(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(w(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),m=n(require("fs-extra")),f=n(require("node-fetch")),k=require("pyodide"),T=n(v());global.fetch=f.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await m.default.copy(t,e.copyTo)}async function _(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),l=`emfs:${i}`;console.log(`Install ${l}`),await o.install.callKwargs(l,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let l=a.default.dirname(require.resolve("@stlite/kernel")),p=a.default.resolve(l,"../py");await _(t,a.default.join(p,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await _(t,a.default.join(p,"streamlit/lib/dist/streamlit-1.18.1-py2.py3-none-any.whl"))}else{let p=require(a.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${p}/flat`,y=(await(await(0,f.default)(S)).json()).files.filter(d=>d.name.endsWith(".whl")).map(d=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${p}${d.name}`),q=t.pyimport("micropip");console.log("Install",y),await q.install.callKwargs(y,{keep_going:!0})}console.log(`Install the requirements ${JSON.stringify(e.requirements)}`),await t.pyimport("micropip").install.callKwargs(e.requirements,{keep_going:!0}),console.log("Archive the site-packages director(y|ies)");let i="/tmp/site-packages-snapshot.tar.gz";await t.runPythonAsync(`
3
+ `).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var v=g(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(w(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),m=n(require("fs-extra")),f=n(require("node-fetch")),k=require("pyodide"),T=n(v());global.fetch=f.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await m.default.copy(t,e.copyTo)}async function _(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),l=`emfs:${i}`;console.log(`Install ${l}`),await o.install.callKwargs(l,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let l=a.default.dirname(require.resolve("@stlite/kernel")),p=a.default.resolve(l,"../py");await _(t,a.default.join(p,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await _(t,a.default.join(p,"streamlit/lib/dist/streamlit-1.19.0-py2.py3-none-any.whl"))}else{let p=require(a.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${p}/flat`,y=(await(await(0,f.default)(S)).json()).files.filter(d=>d.name.endsWith(".whl")).map(d=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${p}${d.name}`),q=t.pyimport("micropip");console.log("Install",y),await q.install.callKwargs(y,{keep_going:!0})}console.log(`Install the requirements ${JSON.stringify(e.requirements)}`),await t.pyimport("micropip").install.callKwargs(e.requirements,{keep_going:!0}),console.log("Archive the site-packages director(y|ies)");let i="/tmp/site-packages-snapshot.tar.gz";await t.runPythonAsync(`
4
4
  import tarfile
5
5
  import site
6
6
 
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "/static/css/main.b43a24ba.css",
4
- "main.js": "/static/js/main.1d4d9c5e.js",
4
+ "main.js": "/static/js/main.6d52d203.js",
5
5
  "static/js/7073.ac05e1ad.chunk.js": "/static/js/7073.ac05e1ad.chunk.js",
6
- "static/js/4994.8f0118ec.chunk.js": "/static/js/4994.8f0118ec.chunk.js",
7
- "static/js/9462.02aa4a97.chunk.js": "/static/js/9462.02aa4a97.chunk.js",
6
+ "static/js/4994.551c87ac.chunk.js": "/static/js/4994.551c87ac.chunk.js",
7
+ "static/js/9462.ebffc855.chunk.js": "/static/js/9462.ebffc855.chunk.js",
8
8
  "static/js/1367.9dcea0bc.chunk.js": "/static/js/1367.9dcea0bc.chunk.js",
9
9
  "static/js/5865.90a40692.chunk.js": "/static/js/5865.90a40692.chunk.js",
10
- "static/css/3683.60b7ada4.chunk.css": "/static/css/3683.60b7ada4.chunk.css",
11
- "static/js/3683.68da2452.chunk.js": "/static/js/3683.68da2452.chunk.js",
10
+ "static/css/3376.60b7ada4.chunk.css": "/static/css/3376.60b7ada4.chunk.css",
11
+ "static/js/3376.839fa3bf.chunk.js": "/static/js/3376.839fa3bf.chunk.js",
12
12
  "static/js/8461.87a9a578.chunk.js": "/static/js/8461.87a9a578.chunk.js",
13
13
  "static/js/5752.d5d30939.chunk.js": "/static/js/5752.d5d30939.chunk.js",
14
14
  "static/js/8565.f27e3917.chunk.js": "/static/js/8565.f27e3917.chunk.js",
15
15
  "static/js/2116.2e449b06.chunk.js": "/static/js/2116.2e449b06.chunk.js",
16
16
  "static/js/6097.56c4b02a.chunk.js": "/static/js/6097.56c4b02a.chunk.js",
17
17
  "static/js/91.f23bbeac.chunk.js": "/static/js/91.f23bbeac.chunk.js",
18
- "static/js/2632.2ce818e2.chunk.js": "/static/js/2632.2ce818e2.chunk.js",
18
+ "static/js/2632.1bb45c13.chunk.js": "/static/js/2632.1bb45c13.chunk.js",
19
19
  "static/js/9735.0e70600f.chunk.js": "/static/js/9735.0e70600f.chunk.js",
20
20
  "static/js/5678.b7f865a0.chunk.js": "/static/js/5678.b7f865a0.chunk.js",
21
- "static/js/9551.d488bda4.chunk.js": "/static/js/9551.d488bda4.chunk.js",
21
+ "static/js/9551.f6ae672e.chunk.js": "/static/js/9551.f6ae672e.chunk.js",
22
22
  "static/js/7937.a3bc5cdb.chunk.js": "/static/js/7937.a3bc5cdb.chunk.js",
23
- "static/js/3392.fc9c3f49.chunk.js": "/static/js/3392.fc9c3f49.chunk.js",
23
+ "static/js/3392.7b32c75f.chunk.js": "/static/js/3392.7b32c75f.chunk.js",
24
24
  "static/js/7496.37614377.chunk.js": "/static/js/7496.37614377.chunk.js",
25
25
  "static/js/3977.8a9ac9d7.chunk.js": "/static/js/3977.8a9ac9d7.chunk.js",
26
26
  "static/js/6242.5e6f91ac.chunk.js": "/static/js/6242.5e6f91ac.chunk.js",
@@ -54,8 +54,8 @@
54
54
  "static/js/142.85e6074f.chunk.js": "/static/js/142.85e6074f.chunk.js",
55
55
  "static/js/8910.e6dda87e.chunk.js": "/static/js/8910.e6dda87e.chunk.js",
56
56
  "static/js/6865.b0803b6b.chunk.js": "/static/js/6865.b0803b6b.chunk.js",
57
- "static/js/6679.d28318d1.chunk.js": "/static/js/6679.d28318d1.chunk.js",
58
- "pypi/streamlit-1.18.1-py2.py3-none-any.whl": "/pypi/streamlit-1.18.1-py2.py3-none-any.whl",
57
+ "static/js/6679.e766940b.chunk.js": "/static/js/6679.e766940b.chunk.js",
58
+ "pypi/streamlit-1.19.0-py2.py3-none-any.whl": "/pypi/streamlit-1.19.0-py2.py3-none-any.whl",
59
59
  "static/media/SourceSansPro-Regular.ttf": "/static/media/SourceSansPro-Regular.efa76f8326aa5cee3bdd.ttf",
60
60
  "static/media/SourceSansPro-SemiBold.ttf": "/static/media/SourceSansPro-SemiBold.43cc81b496222dc9ce3c.ttf",
61
61
  "static/media/SourceSansPro-Bold.ttf": "/static/media/SourceSansPro-Bold.12e6acd2589d00c9d0aa.ttf",
@@ -151,6 +151,6 @@
151
151
  },
152
152
  "entrypoints": [
153
153
  "static/css/main.b43a24ba.css",
154
- "static/js/main.1d4d9c5e.js"
154
+ "static/js/main.6d52d203.js"
155
155
  ]
156
156
  }
package/build/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.1d4d9c5e.js"></script><link href="/static/css/main.b43a24ba.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.6d52d203.js"></script><link href="/static/css/main.b43a24ba.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2632],{86926:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>p});var r=e(5057),n=e(89733),o=e(9301),a=e(85493),s=e(62658),l=e(22199),d=e(45490);const h=(0,d.Z)("div",{target:"etr89bj2"})((({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg})),""),c=(0,d.Z)("div",{target:"etr89bj1"})((({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0})),""),g=(0,d.Z)("div",{target:"etr89bj0"})((({theme:t})=>({fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,color:t.colors.fadedText60,textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:"0.125rem"})),"");var u,m=e(96266);!function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth"}(u||(u={}));const p=(0,s.Z)((function({width:t,isFullScreen:i,element:e,height:s}){const{getBaseUriParts:d}=(0,r.useContext)(a.Z),p=(0,o.$R)(e.imgs);let f;const x=e.width;if(x===u.OriginalWidth||x===u.AutoWidth)f=void 0;else if(x===u.ColumnWidth)f=t;else{if(!(x>0))throw Error(`Invalid image width: ${x}`);f=x}const w={};return s&&i?(w.maxHeight=s,w["object-fit"]="contain"):(w.width=f,x===u.AutoWidth&&(w.maxWidth="100%")),(0,m.jsx)(h,{style:{width:t},children:p.map(((t,i)=>{const e=t;return(0,m.jsxs)(c,{"data-testid":"stImage",children:[e.markup?(0,n.ZP)((0,l.kB)(e.markup)):(0,m.jsx)("img",{style:w,src:(0,l.Bz)(e.url,d()),alt:i.toString()}),e.caption&&(0,m.jsx)(g,{"data-testid":"caption",style:w,children:` ${e.caption} `})]},i)}))})}))},24875:()=>{}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3376],{15310:(e,t,n)=>{n.r(t),n.d(t,{default:()=>pe});var i=n(5057),o=n(66751),r=n(55783),l=n(27179),s=n(56846),a=n(62658),d=n(32291),u=n(34422);const c=class{constructor(e){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[],this.numRows=0,this.numRows=e}toJson(e){const t=new Map;e.forEach((e=>{t.set(e.indexNumber,e)}));const n={edited_cells:{},added_rows:[],deleted_rows:[]};this.editedCells.forEach(((e,i,o)=>{e.forEach(((e,o,r)=>{const l=t.get(o);l&&(n.edited_cells[`${i}:${o}`]=l.getCellValue(e))}))})),this.addedRows.forEach((e=>{const i={};e.forEach(((e,n,o)=>{const r=t.get(n);if(r){const t=r.getCellValue(e);(0,u.bb)(t)&&(i[n]=t)}})),n.added_rows.push(i)})),n.deleted_rows=this.deletedRows;return JSON.stringify(n,((e,t)=>void 0===t?null:t))}fromJson(e,t){const n=JSON.parse(e),i=new Map;t.forEach((e=>{i.set(e.indexNumber,e)})),Object.keys(n.edited_cells).forEach((e=>{const[t,o]=e.split(":").map(Number),r=i.get(o);if(r){const i=r.getCell(n.edited_cells[e]);var l;if(i)0==this.editedCells.has(t)&&this.editedCells.set(t,new Map),null===(l=this.editedCells.get(t))||void 0===l||l.set(o,i)}})),n.added_rows.forEach((e=>{const n=new Map;t.forEach((e=>{n.set(e.indexNumber,e.getCell(void 0))})),Object.keys(e).forEach((t=>{const o=i.get(Number(t));if(o){const i=o.getCell(e[Number(t)]);i&&n.set(Number(t),i)}})),this.addedRows.push(n)})),this.deletedRows=n.deleted_rows}isAddedRow(e){return e>=this.numRows}getCell(e,t){if(this.isAddedRow(t))return this.addedRows[t-this.numRows].get(e);const n=this.editedCells.get(t);return void 0!==n?n.get(e):void 0}setCell(e,t,n){if(this.isAddedRow(t)){if(t-this.numRows>=this.addedRows.length)return;this.addedRows[t-this.numRows].set(e,n)}else{void 0===this.editedCells.get(t)&&this.editedCells.set(t,new Map);this.editedCells.get(t).set(e,n)}}addRow(e){this.addedRows.push(e)}deleteRows(e){e.sort(((e,t)=>t-e)).forEach((e=>{this.deleteRow(e)}))}deleteRow(e){(0,u.le)(e)||e<0||(this.isAddedRow(e)?this.addedRows.splice(e-this.numRows,1):(this.deletedRows.includes(e)||(this.deletedRows.push(e),this.deletedRows=this.deletedRows.sort(((e,t)=>e-t))),this.editedCells.delete(e)))}getOriginalRowIndex(e){let t=e;for(let n=0;n<this.deletedRows.length&&!(this.deletedRows[n]>t);n++)t+=1;return t}getNumRows(){return this.numRows+this.addedRows.length-this.deletedRows.length}};var h=n(59990),g=n(31476);const m=function(){const e=(0,g.u)();return{accentColor:e.colors.primary,accentFg:e.colors.white,accentLight:(0,h.DZ)(e.colors.primary,.9),borderColor:e.colors.fadedText05,horizontalBorderColor:e.colors.fadedText05,fontFamily:e.genericFonts.bodyFont,bgSearchResult:(0,h.DZ)(e.colors.primary,.9),bgIconHeader:e.colors.fadedText60,fgIconHeader:e.colors.white,bgHeader:e.colors.bgMix,bgHeaderHasFocus:e.colors.secondaryBg,bgHeaderHovered:e.colors.bgMix,textHeader:e.colors.fadedText60,textHeaderSelected:e.colors.white,textGroupHeader:e.colors.fadedText60,headerFontStyle:`${e.fontSizes.sm}`,baseFontStyle:e.fontSizes.sm,editorFontSize:e.fontSizes.sm,textDark:e.colors.bodyText,textMedium:(0,h.DZ)(e.colors.bodyText,.2),textLight:e.colors.fadedText40,textBubble:e.colors.fadedText60,bgCell:e.colors.bgColor,bgCellMedium:e.colors.bgColor,cellHorizontalPadding:8,cellVerticalPadding:3,bgBubble:e.colors.secondaryBg,bgBubbleSelected:e.colors.secondaryBg,linkColor:e.colors.linkText,drilldownBorder:e.colors.darkenedBgMix25,tableBorderRadius:e.radii.md}};var f=n(52801),b=n(89163),p=n(65873),w=n(61918),y=n.n(w);function C(e,t=""){return e=`\u26a0\ufe0f ${e}`,{kind:o.p6.Text,readonly:!0,allowOverlay:!0,data:e+(t?`\n\n${t}\n`:""),displayData:e,isError:!0}}function x(e){return e.hasOwnProperty("isError")&&e.isError}function v(e,t){const n=t?"faded":"normal";return{kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}function M(e){return{id:e.id,title:e.title,hasMenu:!1,themeOverride:e.themeOverride,...e.isStretched&&{grow:e.isIndex?1:3},...e.width&&{width:e.width}}}function R(e,t){return(0,u.le)(e)?t||{}:(0,u.le)(t)?e||{}:(0,p.merge)(e,t)}function E(e){if((0,u.le)(e))return[];if("number"===typeof e||"boolean"===typeof e)return[e];if("string"===typeof e){if(""===e)return[];if(!e.trim().startsWith("[")||!e.trim().endsWith("]"))return e.split(",");try{return JSON.parse(e)}catch(t){return[e]}}try{const t=JSON.parse(JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t)));return(0,p.isArray)(t)?t.map((e=>["string","number","boolean","null"].includes(typeof e)?e:N(e))):[N(t)]}catch(t){return[N(e)]}}function N(e){try{try{return(0,p.toString)(e)}catch(t){return JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t))}}catch(t){return`[${typeof e}]`}}function k(e,t=4,n=!1){return!Number.isNaN(e)&&Number.isFinite(e)?(0===t&&(e=Math.round(e)),y()(e).format(n?`0,0.${"0".repeat(t)}`:`0,0.[${"0".repeat(t)}]`)):""}function T(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!0,style:e.isIndex?"faded":"normal"};return{...e,kind:"object",sortMode:"default",isEditable:!1,getCell(e){try{const n=(0,u.bb)(e)?N(e):null,i=(0,u.bb)(n)?n:"";return{...t,data:n,displayData:i,isMissingValue:(0,u.le)(e)}}catch(n){return C(N(e),`The value cannot be interpreted as a string. Error: ${n}`)}},getCellValue:e=>void 0===e.data?null:e.data}}T.isEditableType=!1;const S=T;function O(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"text",sortMode:"default",getCell(e){try{const n=(0,u.bb)(e)?N(e):null,i=(0,u.bb)(n)?n:"";return{...t,isMissingValue:(0,u.le)(n),data:n,displayData:i}}catch(n){return C("Incompatible value",`The value cannot be interpreted as string. Error: ${n}`)}},getCellValue:e=>void 0===e.data?null:e.data}}O.isEditableType=!0;const D=O,A=["true","t","yes","y","on","1"],H=["false","f","no","n","off","0"];function I(e){const t={kind:o.p6.Boolean,data:!1,allowOverlay:!1,contentAlign:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"boolean",sortMode:"default",getCell(e){let n=null;if((0,u.bb)(e))if("boolean"===typeof e)n=e;else{const t=String(e).toLowerCase().trim();if(""===t)n=null;else if(A.includes(t))n=!0;else{if(!H.includes(t))return C(N(e),"The value cannot be interpreted as boolean.");n=!1}}return{...t,data:n}},getCellValue:e=>void 0===e.data?null:e.data}}I.isEditableType=!0;const V=I;function z(e){const t=R({options:"bool"===b.fu.getTypeName(e.arrowType)?["true","false"]:[]},e.columnTypeMetadata),n={kind:o.p6.Custom,allowOverlay:e.isEditable,copyData:"",contentAlign:e.contentAlignment,data:{kind:"dropdown-cell",allowedValues:["",...t.options.filter((e=>""!==e))],value:"",readonly:!e.isEditable}};return{...e,kind:"categorical",sortMode:"default",getCell(e){let t="";return(0,u.bb)(e)&&(t=N(e)),n.data.allowedValues.includes(t)?{...n,isMissingValue:""===t,copyData:t,data:{...n.data,value:t}}:C(N(t),"The value is not part of the allowed options.")},getCellValue(e){var t,n,i;return void 0===(null===(t=e.data)||void 0===t?void 0:t.value)||""===(null===(n=e.data)||void 0===n?void 0:n.value)?null:null===(i=e.data)||void 0===i?void 0:i.value}}}z.isEditableType=!0;const $=z;function W(e){const t={kind:o.p6.Bubble,data:[],allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal"};return{...e,kind:"list",sortMode:"default",isEditable:!1,getCell:e=>({...t,data:E(e),isMissingValue:(0,u.le)(e)}),getCellValue:e=>void 0===e.data?null:e.data}}W.isEditableType=!1;const L=W;function _(e){const t=b.fu.getTypeName(e.arrowType),n=R({precision:t.startsWith("int")||"range"===t||t.startsWith("uint")?0:void 0,min:t.startsWith("uint")?0:void 0},e.columnTypeMetadata),i=(0,u.le)(n.min)||n.min<0,r=(0,u.bb)(n.precision)?n.precision:void 0,l={kind:o.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:i,fixedDecimals:r};return{...e,kind:"number",sortMode:"smart",getCell(e){let t=function(e){if((0,u.le)(e))return null;if((0,p.isArray)(e))return NaN;if("string"===typeof e){if(0===e.trim().length)return null;try{const t=y().unformat(e.trim());if((0,u.bb)(t))return t}catch(t){}}else if(e instanceof Int32Array)return Number(e[0]);return Number(e)}(e);if((0,u.bb)(t)){if(Number.isNaN(t))return C(N(e),"The value cannot be interpreted as a number.");(0,u.bb)(n.precision)&&(t=0===n.precision?Math.trunc(t):Math.trunc(t*10**n.precision)/10**n.precision),(0,u.bb)(n.min)&&(t=Math.max(t,n.min)),(0,u.bb)(n.max)&&(t=Math.min(t,n.max))}return{...l,data:t,displayData:(0,u.bb)(t)?k(t):"",isMissingValue:(0,u.le)(t)}},getCellValue:e=>void 0===e.data?null:e.data}}_.isEditableType=!0;const F=_,B=new Map(Object.entries({object:S,text:D,boolean:V,categorical:$,list:L,number:F}));function j(e,t,n){const i=new RegExp(`${e}[,\\s].*{(?:[^}]*[\\s;]{1})?${t}:\\s*([^;}]+)[;]?.*}`,"gm");n=n.replace(/{/g," {");const o=i.exec(n);if(o)return o[1].trim()}function J(e){return e.replace(/(\r\n|\n|\r)/gm," ")}function P(e,t){const n=e.types.index[t],i=e.indexNames[t];let o=!0;return"range"===b.fu.getTypeName(n)&&(o=!1),{id:`index-${t}`,isEditable:o,title:i,arrowType:n,isIndex:!0,isHidden:!1}}function Y(e,t){const n=e.columns[0][t];let i,o=e.types.data[t];if((0,u.le)(o)&&(o={meta:null,numpy_type:"object",pandas_type:"object"}),"categorical"===b.fu.getTypeName(o)){const n=e.getCategoricalOptions(t);(0,u.bb)(n)&&(i={options:["",...n.filter((e=>""!==e))]})}return{id:`column-${n}-${t}`,isEditable:!0,title:n,arrowType:o,columnTypeMetadata:i,isIndex:!1,isHidden:!1}}function Z(e,t,n){let i;if(i="object"===e.kind?e.getCell((0,u.bb)(t.content)?J(b.fu.format(t.content,t.contentType,t.field)):null):e.getCell(t.content),x(i))return i;if((0,u.bb)(t.displayContent)){const e=J(t.displayContent);(i.kind===o.p6.Text||i.kind===o.p6.Number)&&(i={...i,displayData:e})}return n&&t.cssId&&(i=function(e,t,n){const i={},o=j(t,"color",n);o&&(i.textDark=o);const r=j(t,"background-color",n);return r&&(i.bgCell=r),"yellow"===r&&void 0===o&&(i.textDark="#31333F"),i?{...e,themeOverride:i}:e}(i,t.cssId,n)),i}const U=function(e,t,n,o){return{getCellContent:i.useCallback((([i,r])=>{if(i>t.length-1)return C("Column index out of bounds.","This should never happen. Please report this bug.");if(r>n-1)return C("Row index out of bounds.","This should never happen. Please report this bug.");const l=t[i],s=l.indexNumber,a=o.current.getOriginalRowIndex(r);if(l.isEditable||o.current.isAddedRow(a)){const e=o.current.getCell(s,a);if(void 0!==e)return e}try{return Z(l,e.getCell(a+1,s),e.cssStyles)}catch(d){return(0,f.H)(d),C("Error during cell creation.",`This should never happen. Please report this bug. \nError: ${d}`)}}),[t,n,e,o])}},G=35,X=52,K=2*G+3,q=400;const Q=function(e,t,n,o,r){let l,s=function(e){return Math.max(e*G+1+2,K)}(t+1+(e.editingMode===d.Eh.EditingMode.DYNAMIC?1:0)),a=Math.min(s,q);e.height&&(a=Math.max(e.height,K),s=Math.max(e.height,s)),o&&(a=Math.min(a,o),s=Math.min(s,o),e.height||(a=s));let c=n;e.useContainerWidth?l=n:e.width&&(l=Math.min(Math.max(e.width,X),n),c=Math.min(Math.max(e.width,c),n));const[h,g]=i.useState({width:l||"100%",height:a});return i.useLayoutEffect((()=>{e.useContainerWidth&&"100%"===h.width&&g({width:n,height:h.height})}),[n]),i.useLayoutEffect((()=>{g({width:h.width,height:a})}),[t]),i.useLayoutEffect((()=>{g({width:l||"100%",height:h.height})}),[l]),i.useLayoutEffect((()=>{g({width:h.width,height:a})}),[a]),i.useLayoutEffect((()=>{if(r){const t=e.useContainerWidth||(0,u.bb)(e.width)&&e.width>0;g({width:t?c:"100%",height:s})}else g({width:l||"100%",height:a})}),[r]),{rowHeight:G,minHeight:K,maxHeight:s,minWidth:X,maxWidth:c,resizableSize:h,setResizableSize:g}};const ee=function(e,t,n,o,r,l,s){const a=i.useCallback((([t,i],l)=>{const a=e[t],d=a.indexNumber,u=n.current.getOriginalRowIndex(r(i)),c=o([t,i]),h=a.getCellValue(c),g=a.getCellValue(l);if(!x(c)&&g===h)return;const m=a.getCell(g);n.current.setCell(d,u,{...m,lastUpdated:performance.now()}),s()}),[e,n,r,o,s]),d=i.useCallback((()=>{if(t)return;const i=new Map;e.forEach((e=>{i.set(e.indexNumber,e.getCell(void 0))})),n.current.addRow(i),s(!1,!1)}),[e,n,t]),u=i.useCallback((i=>{var o;if(i.rows.length>0){if(t)return!0;const e=i.rows.toArray().map((e=>n.current.getOriginalRowIndex(r(e))));return n.current.deleteRows(e),s(!0),!1}if(null!==(o=i.current)&&void 0!==o&&o.range){const t=[],n=i.current.range;for(let i=n.y;i<n.y+n.height;i++)for(let o=n.x;o<n.x+n.width;o++){const n=e[o];n.isEditable&&(t.push({cell:[o,i]}),a([o,i],n.getCell(null)))}return t.length>0&&(s(),l(t)),!1}return!0}),[e,n,t,l,r,s]),c=i.useCallback(((i,a)=>{const[u,c]=i,h=[];for(let g=0;g<a.length;g++){const i=a[g];if(g+c>=n.current.getNumRows()){if(t)break;d()}for(let t=0;t<i.length;t++){const l=i[t],s=g+c,a=t+u;if(a>=e.length)break;const d=e[a];if(d.isEditable){const e=d.getCell(l);if(!x(e)){const t=d.indexNumber,i=n.current.getOriginalRowIndex(r(s)),l=d.getCellValue(o([a,s]));d.getCellValue(e)!==l&&(n.current.setCell(t,i,{...e,lastUpdated:performance.now()}),h.push({cell:[a,s]}))}}}h.length>0&&(s(),l(h))}return!1}),[e,n,t,r,o,d,s,l]);return{onCellEdited:a,onPaste:c,onRowAppended:d,onDelete:u}};const te=function(e){const[t,n]=(0,i.useState)((()=>new Map)),o=i.useCallback(((e,i,o,r)=>{e.id&&n(new Map(t).set(e.id,r))}),[t]);return{columns:e.map((e=>e.id&&t.has(e.id)&&void 0!==t.get(e.id)?{...e,width:t.get(e.id),grow:0}:e)),onColumnResize:o}};var ne=n(33256);const ie=function(e,t,n){const[o,r]=i.useState(),{getCellContent:l,getOriginalIndex:s}=(0,ne.fF)({columns:t.map((e=>M(e))),getCellContent:n,rows:e,sort:o}),a=function(e,t){return void 0===t?e:e.map((e=>e.id===t.column.id?{...e,title:"asc"===t.direction?`\u2191 ${e.title}`:`\u2193 ${e.title}`}:e))}(t,o),d=i.useCallback((e=>{let t="asc";const n=a[e];if(o&&o.column.id===n.id){if("asc"!==o.direction)return void r(void 0);t="desc"}r({column:M(n),direction:t,mode:n.sortMode})}),[o,a]);return{columns:a,sortColumn:d,getOriginalIndex:s,getCellContent:l}},oe="index",re="col:";function le(e,t){var n;if(!t)return e;let i;return t.has(e.title)?i=t.get(e.title):t.has(`${re}${e.indexNumber}`)?i=t.get(`${re}${e.indexNumber}`):e.isIndex&&t.has(oe)&&(i=t.get(oe)),i?(0,p.merge)({...e},{title:i.title,width:i.width,customType:null===(n=i.type)||void 0===n?void 0:n.toLowerCase().trim(),isEditable:i.editable,isHidden:i.hidden,columnTypeMetadata:i.metadata,contentAlignment:i.alignment}):e}function se(e){let t;return(0,u.bb)(e.customType)&&(B.has(e.customType)?t=B.get(e.customType):(0,f.KE)(`Unknown column type configured in column configuration: ${e.customType}`)),(0,u.le)(t)&&(t=function(e){let t=e?b.fu.getTypeName(e):null;return t?(t=t.toLowerCase().trim(),["unicode","empty"].includes(t)?D:["object","date","time","datetime","datetimetz","decimal","bytes"].includes(t)?S:["bool"].includes(t)?V:["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","float96","float128","range"].includes(t)?F:"categorical"===t?$:t.startsWith("list")?L:S):S}(e.arrowType)),t}const ae=function(e,t,n){const i=function(e){if(!e.columns)return new Map;try{return new Map(Object.entries(JSON.parse(e.columns)))}catch(t){return(0,f.H)(t),new Map}}(e),o=e.useContainerWidth||(0,u.bb)(e.width)&&e.width>0,r=function(e){var t,n,i,o,r,l;const s=[],a=null!==(t=null===(n=e.types)||void 0===n||null===(i=n.index)||void 0===i?void 0:i.length)&&void 0!==t?t:0,d=null!==(o=null===(r=e.columns)||void 0===r||null===(l=r[0])||void 0===l?void 0:l.length)&&void 0!==o?o:0;if(0===a&&0===d)return s.push({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0}),s;for(let u=0;u<a;u++){const t={...P(e,u),indexNumber:u};s.push(t)}for(let u=0;u<d;u++){const t={...Y(e,u),indexNumber:u+a};s.push(t)}return s}(t).map((t=>{let r={...t,...le(t,i),isStretched:o};const l=se(r);return(e.editingMode===d.Eh.EditingMode.READ_ONLY||n||!1===l.isEditableType)&&(r={...r,isEditable:!1}),l(r)})).filter((e=>!e.isHidden));return{columns:r.length>0?r:[S({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0})]}};const de=(0,n(45490).Z)("div",{target:"e17g77xh0"})((({theme:e})=>({position:"relative",display:"inline-block","& .glideDataEditor":{height:"100%",minWidth:"100%",borderRadius:e.radii.md},"& .dvn-scroller":{scrollbarWidth:"thin",overflowX:"overlay !important",overflowY:"overlay !important"}})),"");n(27235);var ue=n(96266);const ce=50,he=1e3,ge=500,me=100,fe=15e4,be=e=>{const{cell:t,theme:n}=e;return!!function(e){return e.hasOwnProperty("isMissingValue")&&e.isMissingValue}(t)&&((0,o.uN)({...e,theme:{...n,textDark:n.textLight,textMedium:n.textLight},spriteManager:{},hyperWrapping:!1},"None",t.contentAlign),!0)};const pe=(0,a.Z)((function({element:e,data:t,width:n,height:a,disabled:h,widgetMgr:g,isFullScreen:f}){const b=i.useRef(null),p=i.useRef(null),w=(0,r.Bn)(),y=m(),[C,x]=i.useState(!0),[R,E]=i.useState({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0}),N=i.useCallback((()=>{E({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0})}),[]),k=i.useCallback((e=>{var t;null===(t=p.current)||void 0===t||t.updateCells(e)}),[]);(0,u.le)(e.editingMode)&&(e.editingMode=d.Eh.EditingMode.READ_ONLY);const{READ_ONLY:T,DYNAMIC:S}=d.Eh.EditingMode,O=t.dimensions,D=Math.max(0,O.rows-1),A=0===D&&!(e.editingMode===S&&O.dataColumns>0),H=D>fe,I=i.useRef(new c(D)),[V,z]=i.useState(I.current.getNumRows());i.useEffect((()=>{I.current=new c(D),z(I.current.getNumRows())}),[D]);const $=i.useCallback((()=>{I.current=new c(D),z(I.current.getNumRows())}),[D]),{columns:W}=ae(e,t,h);i.useEffect((()=>{if(e.editingMode!==T){const t=g.getStringValue(e);t&&(I.current.fromJson(t,W),z(I.current.getNumRows()))}}),[]);const{getCellContent:L}=U(t,W,V,I),{columns:_,sortColumn:F,getOriginalIndex:B,getCellContent:j}=ie(D,W,L),J=i.useCallback(((t=!1,n=!0)=>{V!==I.current.getNumRows()&&z(I.current.getNumRows()),t&&N(),(0,u.Ds)(me,(()=>{const t=I.current.toJson(_);let i=g.getStringValue(e);void 0===i&&(i=new c(0).toJson([])),t!==i&&g.setStringValue(e,t,{fromUi:n})}))()}),[g,e,V]),{onCellEdited:P,onPaste:Y,onRowAppended:Z,onDelete:G}=ee(_,e.editingMode!==S,I,j,B,k,J),{columns:X,onColumnResize:K}=te(_.map((e=>M(e)))),{rowHeight:q,minHeight:ne,maxHeight:oe,minWidth:re,maxWidth:le,resizableSize:se,setResizableSize:pe}=Q(e,V,n,a,f),we=i.useCallback((([e,t])=>({...v(!0,!1),displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:y.textLight},span:[0,Math.max(_.length-1,0)]})),[_]);return i.useEffect((()=>{const t=new s.Kz;return t.manageFormClearListener(g,e.formId,$),()=>{t.disconnect()}}),[]),(0,ue.jsx)(de,{className:"stDataFrame",onBlur:()=>{C||N()},children:(0,ue.jsx)(l.e,{"data-testid":"stDataFrameResizable",ref:b,defaultSize:se,style:{border:`1px solid ${y.borderColor}`,borderRadius:`${y.tableBorderRadius}`},minHeight:ne,maxHeight:oe,minWidth:re,maxWidth:le,size:se,enable:{top:!1,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1},grid:[1,q],snapGap:q/3,onResizeStop:(e,t,n,i)=>{b.current&&pe({width:b.current.size.width,height:oe-b.current.size.height===3?b.current.size.height+3:b.current.size.height})},children:(0,ue.jsx)(o.Nd,{className:"glideDataEditor",ref:p,columns:X,rows:A?1:V,minColumnWidth:ce,maxColumnWidth:he,maxColumnAutoWidth:ge,rowHeight:q,headerHeight:q,getCellContent:A?we:j,onColumnResize:K,freezeColumns:A?0:_.filter((e=>e.isIndex)).length,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:t=>!(t>=_.length&&(e.useContainerWidth||"100%"===se.width)),getCellsForSelection:!0,rowMarkers:"none",rangeSelect:"rect",columnSelect:"none",rowSelect:"none",keybindings:{search:!0,downFill:!0},onHeaderClicked:A||H?void 0:F,gridSelection:R,onGridSelectionChange:E,drawCell:be,theme:y,onMouseMove:e=>{"out-of-bounds"===e.kind&&C?x(!1):"out-of-bounds"===e.kind||C||x(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:1},customRenderers:w.customRenderers,onPaste:!1,...!A&&e.editingMode!==T&&!h&&{fillHandle:!0,onCellEdited:P,onPaste:Y,onDelete:G},...!A&&e.editingMode===S&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:y.bgHeader,bgCellMedium:y.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"auto",rowSelect:h?"none":"multi",onRowAppended:h?void 0:Z,onHeaderClicked:void 0}})})})}))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3392],{23392:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(5057),l=i(85493),n=i(92445),r=i(46540),d=i(22199),o=i(9301),u=i(96266);const a=function(t){const{disabled:e,element:i,widgetMgr:a,width:c}=t,h={width:c},{getBaseUriParts:b}=(0,s.useContext)(l.Z),k=(0,o.v_)();return(0,u.jsx)("div",{className:"row-widget stDownloadButton",style:h,children:(0,u.jsx)(n.uD,{help:i.help,children:(0,u.jsx)(n.ZP,{kind:n.hY.SECONDARY,size:n.$u.SMALL,disabled:e,onClick:()=>{if(a.setTriggerValue(i,{fromUi:!0}),i.url.startsWith("/media"))return void(0,o.uP)(k,i.url);const t=document.createElement("a"),e=`${(0,d.Bz)(i.url,b())}?title=${encodeURIComponent(document.title)}`;t.setAttribute("href",e),t.setAttribute("target","_blank"),t.click()},fluidWidth:i.useContainerWidth||!1,children:(0,u.jsx)(r.Z,{source:i.label,allowHTML:!1,isButton:!0})})})})}}}]);
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4994],{54994:e=>{!function(t){if("undefined"!==typeof window){var n=!0,o=10,i="",r=0,a="",u=null,c="",s=!1,d={resize:1,click:1},l=128,f=!0,m=1,h="bodyOffset",g=h,p=!0,v="",y={},w=32,b=null,T=!1,E=!1,O="[iFrameSizer]",S=O.length,M="",I={max:1,min:1,bodyScroll:1,documentElementScroll:1},N="child",k=!0,A=window.parent,C="*",z=0,R=!1,x=null,L=16,F=1,P="scroll",D=P,j=window,q=function(){ee("onMessage function not defined")},H=function(){},W=function(){},B={height:function(){return ee("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return ee("Custom width calculation function not defined"),document.body.scrollWidth}},J={},U=!1;try{var _=Object.create({},{passive:{get:function(){U=!0}}});window.addEventListener("test",K,_),window.removeEventListener("test",K,_)}catch(Oe){}var V={bodyOffset:function(){return document.body.offsetHeight+le("marginTop")+le("marginBottom")},offset:function(){return V.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return B.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,me(V))},min:function(){return Math.min.apply(null,me(V))},grow:function(){return V.max()},lowestElement:function(){return Math.max(V.bodyOffset()||V.documentElementOffset(),fe("bottom",ge()))},taggedElement:function(){return he("bottom","data-iframe-height")}},X={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return B.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(X.bodyScroll(),X.documentElementScroll())},max:function(){return Math.max.apply(null,me(X))},min:function(){return Math.min.apply(null,me(X))},rightMostElement:function(){return fe("right",ge())},taggedElement:function(){return he("right","data-iframe-width")}},Y=function(e){var t,n,o,i=null,r=0,a=function(){r=Date.now(),i=null,o=e.apply(t,n),i||(t=n=null)};return function(){var u=Date.now();r||(r=u);var c=L-(u-r);return t=this,n=arguments,c<=0||c>L?(i&&(clearTimeout(i),i=null),r=u,o=e.apply(t,n),i||(t=n=null)):i||(i=setTimeout(a,c)),o}}(pe);Q(window,"message",(function(n){var o={init:function(){v=n.data,A=n.source,te(),f=!1,setTimeout((function(){p=!1}),l)},reset:function(){p?$("Page reset ignored by init"):($("Page size reset by host page"),we("resetPage"))},resize:function(){ve("resizeParent","Parent window requested size check")},moveToAnchor:function(){y.findTarget(r())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=r();$("PageInfoFromParent called from parent: "+e),W(JSON.parse(e)),$(" --")},message:function(){var e=r();$("onMessage called from parent: "+e),q(JSON.parse(e)),$(" --")}};function i(){return n.data.split("]")[1].split(":")[0]}function r(){return n.data.slice(n.data.indexOf(":")+1)}function a(){return n.data.split(":")[2]in{true:1,false:1}}function u(){var r=i();r in o?o[r]():!e.exports&&"iFrameResize"in window||window.jQuery!==t&&"iFrameResize"in window.jQuery.prototype||a()||ee("Unexpected message ("+n.data+")")}O===(""+n.data).slice(0,S)&&(!1===f?u():a()?o.init():$('Ignored message of type "'+i()+'". Received before initialization.'))})),Q(window,"readystatechange",Ee),Ee()}function K(){}function Q(e,t,n,o){e.addEventListener(t,n,!!U&&(o||{}))}function G(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Z(e){return O+"["+M+"] "+e}function $(e){T&&"object"===typeof window.console&&console.log(Z(e))}function ee(e){"object"===typeof window.console&&console.warn(Z(e))}function te(){!function(){function e(e){return"true"===e}var o=v.slice(S).split(":");M=o[0],r=t===o[1]?r:Number(o[1]),s=t===o[2]?s:e(o[2]),T=t===o[3]?T:e(o[3]),w=t===o[4]?w:Number(o[4]),n=t===o[6]?n:e(o[6]),a=o[7],g=t===o[8]?g:o[8],i=o[9],c=o[10],z=t===o[11]?z:Number(o[11]),y.enable=t!==o[12]&&e(o[12]),N=t===o[13]?N:o[13],D=t===o[14]?D:o[14],E=t===o[15]?E:e(o[15])}(),$("Initialising iFrame ("+window.location.href+")"),function(){function e(){var e=window.iFrameResizer;$("Reading data from page: "+JSON.stringify(e)),Object.keys(e).forEach(ne,e),q="onMessage"in e?e.onMessage:q,H="onReady"in e?e.onReady:H,C="targetOrigin"in e?e.targetOrigin:C,g="heightCalculationMethod"in e?e.heightCalculationMethod:g,D="widthCalculationMethod"in e?e.widthCalculationMethod:D}function t(e,t){return"function"===typeof e&&($("Setup custom "+t+"CalcMethod"),B[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),g=t(g,"height"),D=t(D,"width"));$("TargetOrigin for parent set to: "+C)}(),function(){t===a&&(a=r+"px");oe("margin",function(e,t){-1!==t.indexOf("-")&&(ee("Negative CSS value ignored for "+e),t="");return t}("margin",a))}(),oe("background",i),oe("padding",c),function(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e)}(),ue(),ce(),document.documentElement.style.height="",document.body.style.height="",$('HTML & body height set to "auto"'),$("Enable public methods"),j.parentIFrame={autoResize:function(e){return!0===e&&!1===n?(n=!0,se()):!1===e&&!0===n&&(n=!1,re("remove"),null!==u&&u.disconnect(),clearInterval(b)),Te(0,0,"autoResize",JSON.stringify(n)),n},close:function(){Te(0,0,"close")},getId:function(){return M},getPageInfo:function(e){"function"===typeof e?(W=e,Te(0,0,"pageInfo")):(W=function(){},Te(0,0,"pageInfoStop"))},moveToAnchor:function(e){y.findTarget(e)},reset:function(){be("parentIFrame.reset")},scrollTo:function(e,t){Te(t,e,"scrollTo")},scrollToOffset:function(e,t){Te(t,e,"scrollToOffset")},sendMessage:function(e,t){Te(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){g=e,ue()},setWidthCalculationMethod:function(e){D=e,ce()},setTargetOrigin:function(e){$("Set targetOrigin: "+e),C=e},size:function(e,t){ve("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}},function(){if(!0!==E)return;function e(e){Te(0,0,e.type,e.screenY+":"+e.screenX)}function t(t,n){$("Add event listener: "+n),Q(window.document,t,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}(),se(),y=function(){function e(){return{x:window.pageXOffset===t?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===t?document.documentElement.scrollTop:window.pageYOffset}}function n(t){var n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,10)+parseInt(o.x,10),y:parseInt(n.top,10)+parseInt(o.y,10)}}function o(e){function o(e){var t=n(e);$("Moving to in page link (#"+i+") at x: "+t.x+" y: "+t.y),Te(t.y,t.x,"scrollToOffset")}var i=e.split("#")[1]||e,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];t===a?($("In page link (#"+i+") not found in iFrame, so sending to parent"),Te(0,0,"inPageLink","#"+i)):o(a)}function i(){var e=window.location.hash,t=window.location.href;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&Q(e,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function a(){Q(window,"hashchange",i)}function u(){setTimeout(i,l)}function c(){Array.prototype.forEach&&document.querySelectorAll?($("Setting up location.hash handlers"),r(),a(),u()):ee("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}y.enable?c():$("In page linking not enabled");return{findTarget:o}}(),ve("init","Init message from host page"),H()}function ne(e){var t=e.split("Callback");if(2===t.length){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],ee("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function oe(e,n){t!==n&&""!==n&&"null"!==n&&(document.body.style[e]=n,$("Body "+e+' set to "'+n+'"'))}function ie(e){var t={add:function(t){function n(){ve(e.eventName,e.eventType)}J[t]=n,Q(window,t,n,{passive:!0})},remove:function(e){var t,n,o,i=J[e];delete J[e],t=window,n=e,o=i,t.removeEventListener(n,o,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),$(G(e.method)+" event listener: "+e.eventType)}function re(e){ie({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),ie({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),ie({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),ie({method:e,eventType:"Input",eventName:"input"}),ie({method:e,eventType:"Mouse Up",eventName:"mouseup"}),ie({method:e,eventType:"Mouse Down",eventName:"mousedown"}),ie({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),ie({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),ie({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),ie({method:e,eventType:"Touch Start",eventName:"touchstart"}),ie({method:e,eventType:"Touch End",eventName:"touchend"}),ie({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),ie({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),ie({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),ie({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===N&&ie({method:e,eventType:"IFrame Resized",eventName:"resize"})}function ae(e,t,n,o){return t!==e&&(e in n||(ee(e+" is not a valid option for "+o+"CalculationMethod."),e=t),$(o+' calculation method set to "'+e+'"')),e}function ue(){g=ae(g,h,V,"height")}function ce(){D=ae(D,P,X,"width")}function se(){!0===n?(re("add"),function(){var e=0>w;window.MutationObserver||window.WebKitMutationObserver?e?de():u=function(){function e(e){function t(e){!1===e.complete&&($("Attach listeners to "+e.src),e.addEventListener("load",i,!1),e.addEventListener("error",r,!1),c.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function t(e){c.splice(c.indexOf(e),1)}function n(e){$("Remove listeners from "+e.src),e.removeEventListener("load",i,!1),e.removeEventListener("error",r,!1),t(e)}function o(e,t,o){n(e.target),ve(t,o+": "+e.target.src)}function i(e){o(e,"imageLoad","Image loaded")}function r(e){o(e,"imageLoadFailed","Image load failed")}function a(t){ve("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(e)}function u(){var e=document.querySelector("body"),t={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return d=new s(a),$("Create body MutationObserver"),d.observe(e,t),d}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,d=u();return{disconnect:function(){"disconnect"in d&&($("Disconnect body MutationObserver"),d.disconnect(),c.forEach(n))}}}():($("MutationObserver not supported in this browser!"),de())}()):$("Auto Resize disabled")}function de(){0!==w&&($("setInterval: "+w+"ms"),b=setInterval((function(){ve("interval","setInterval: "+w)}),Math.abs(w)))}function le(e,t){var n=0;return t=t||document.body,n=null===(n=document.defaultView.getComputedStyle(t,null))?0:n[e],parseInt(n,o)}function fe(e,t){for(var n=t.length,o=0,i=0,r=G(e),a=Date.now(),u=0;u<n;u++)(o=t[u].getBoundingClientRect()[e]+le("margin"+r,t[u]))>i&&(i=o);return a=Date.now()-a,$("Parsed "+n+" HTML elements"),$("Element position calculated in "+a+"ms"),function(e){e>L/2&&$("Event throttle increased to "+(L=2*e)+"ms")}(a),i}function me(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function he(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length&&(ee("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),fe(e,n)}function ge(){return document.querySelectorAll("body *")}function pe(e,n,o,i){var r,a;!function(){function e(e,t){return!(Math.abs(e-t)<=z)}return r=t===o?V[g]():o,a=t===i?X[D]():i,e(m,r)||s&&e(F,a)}()&&"init"!==e?!(e in{init:1,interval:1,size:1})&&(g in I||s&&D in I)?be(n):e in{interval:1}||$("No change in size detected"):(ye(),Te(m=r,F=a,e))}function ve(e,t,n,o){R&&e in d?$("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||$("Trigger event: "+t),"init"===e?pe(e,t,n,o):Y(e,t,n,o))}function ye(){R||(R=!0,$("Trigger event lock on")),clearTimeout(x),x=setTimeout((function(){R=!1,$("Trigger event lock off"),$("--")}),l)}function we(e){m=V[g](),F=X[D](),Te(m,F,e)}function be(e){var t=g;g=h,$("Reset trigger event: "+e),ye(),we("reset"),g=t}function Te(e,n,o,i,r){!0===k&&(t===r?r=C:$("Message targetOrigin: "+r),function(){var a=M+":"+e+":"+n+":"+o+(t===i?"":":"+i);$("Sending message to host page ("+a+")"),A.postMessage(O+a,r)}())}function Ee(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}}]);