diff --git a/base/lib/index.js b/base/lib/index.js
index a17bbd89..60f3f48d 100644
--- a/base/lib/index.js
+++ b/base/lib/index.js
@@ -499,6 +499,15 @@ setReadOnly( ns, 'removeSingletonDimensions', require( './../../base/remove-sing
*/
setReadOnly( ns, 'serializeMetaData', require( './../../base/serialize-meta-data' ) );
+/**
+* @name shape
+* @memberof ns
+* @readonly
+* @type {Function}
+* @see {@link module:@stdlib/ndarray/base/shape}
+*/
+setReadOnly( ns, 'shape', require( './../../base/shape' ) );
+
/**
* @name shape2strides
* @memberof ns
diff --git a/base/shape/README.md b/base/shape/README.md
new file mode 100644
index 00000000..0f172957
--- /dev/null
+++ b/base/shape/README.md
@@ -0,0 +1,160 @@
+
+
+# shape
+
+> Return the shape of a provided [ndarray][@stdlib/ndarray/base/ctor].
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var shape = require( '@stdlib/ndarray/base/shape' );
+```
+
+#### shape( x, copy )
+
+Returns the shape of a provided [ndarray][@stdlib/ndarray/base/ctor].
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+var x = zeros( [ 3, 2, 3 ] );
+// returns
+
+var sh = shape( x, false );
+// returns [ 3, 2, 3 ]
+```
+
+When `copy` is `false`, changes to the returned shape array may mutate the input [ndarray][@stdlib/ndarray/base/ctor] shape. If there is a chance that the returned shape will be mutated (either directly or by downstream consumers), set `copy` to `true` to prevent unintended side effects.
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+var x = zeros( [ 3, 2, 3 ] );
+// returns
+
+var sh = shape( x, true );
+// returns [ 3, 2, 3 ]
+
+var bool = ( x.shape === sh );
+// returns false
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+var slice = require( '@stdlib/ndarray/slice' );
+var E = require( '@stdlib/slice/multi' );
+var S = require( '@stdlib/slice/ctor' );
+var shape = require( '@stdlib/ndarray/base/shape' );
+
+// Create an array:
+var x = zeros( [ 10, 10, 10, 10 ] );
+// returns
+
+// Define some slices:
+var slices = [
+ // :,:,:,:
+ E( null, null, null, null ),
+
+ // 5:10,4,2:4,::-1
+ E( S( 5, 10 ), 4, S( 2, 4 ), S( null, null, -1 ) ),
+
+ // :,:,2,:
+ E( null, null, 2, null ),
+
+ // 1,2,3,:
+ E( 1, 2, 3, null ),
+
+ // 1,3,::2,4::2
+ E( 1, 3, S( null, null, 2 ), S( 4, null, 2 ) )
+];
+
+// Determine the shape of each slice...
+var s;
+var i;
+for ( i = 0; i < slices.length; i++ ) {
+ s = slice( x, slices[ i ] );
+ console.log( 'slice(%s) => %s', x.shape.join( 'x' ), shape( s, false ).join( 'x' ) );
+}
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/ndarray/base/ctor]: https://github.com/stdlib-js/ndarray/tree/main/base/ctor
+
+
+
+
diff --git a/base/shape/benchmark/benchmark.js b/base/shape/benchmark/benchmark.js
new file mode 100644
index 00000000..a0eeb3d4
--- /dev/null
+++ b/base/shape/benchmark/benchmark.js
@@ -0,0 +1,82 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var zeros = require( './../../../zeros' );
+var isCollection = require( '@stdlib/assert/is-collection' );
+var pkg = require( './../package.json' ).name;
+var shape = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg+':copy=false', function benchmark( b ) {
+ var values;
+ var out;
+ var i;
+
+ values = [
+ zeros( [ 10, 10, 10, 1 ] ),
+ zeros( [ 5, 5, 5, 1, 1 ] ),
+ zeros( [ 3, 4, 5 ] )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = shape( values[ i%values.length ], false );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an array' );
+ }
+ }
+ b.toc();
+ if ( !isCollection( out ) ) {
+ b.fail( 'should return an array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':copy=true', function benchmark( b ) {
+ var values;
+ var out;
+ var i;
+
+ values = [
+ zeros( [ 10, 10, 10, 1 ] ),
+ zeros( [ 5, 5, 5, 1, 1 ] ),
+ zeros( [ 3, 4, 5 ] )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = shape( values[ i%values.length ], true );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an array' );
+ }
+ }
+ b.toc();
+ if ( !isCollection( out ) ) {
+ b.fail( 'should return an array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/base/shape/docs/repl.txt b/base/shape/docs/repl.txt
new file mode 100644
index 00000000..bd37dd07
--- /dev/null
+++ b/base/shape/docs/repl.txt
@@ -0,0 +1,30 @@
+
+{{alias}}( x, copy )
+ Returns the shape of a provided ndarray.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input ndarray.
+
+ copy: boolean
+ Boolean indicating whether to explicitly copy the value assigned to the
+ input ndarray's `shape` property. When `copy` is `false`, changes to the
+ returned shape array may mutate the input ndarray shape. If there is a
+ chance that the returned shape will be mutated (either directly or by
+ downstream consumers), set `copy` to `true` to prevent unintended side
+ effects.
+
+ Returns
+ -------
+ out: Array
+ Shape.
+
+ Examples
+ --------
+ > var out = {{alias}}( {{alias:@stdlib/ndarray/zeros}}( [ 3, 3, 3 ] ), false )
+ [ 3, 3, 3 ]
+
+ See Also
+ --------
+
diff --git a/base/shape/docs/types/index.d.ts b/base/shape/docs/types/index.d.ts
new file mode 100644
index 00000000..1d011d6f
--- /dev/null
+++ b/base/shape/docs/types/index.d.ts
@@ -0,0 +1,47 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { ndarray, Shape } from '@stdlib/types/ndarray';
+
+/**
+* Returns the shape of a provided ndarray.
+*
+* ## Notes
+*
+* - When `copy` is `false`, changes to the returned shape array may mutate the input ndarray shape. If there is a chance that the returned shape will be mutated (either directly or by downstream consumers), set `copy` to `true` to prevent unintended side effects.
+*
+* @param x - input ndarray
+* @param copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property
+* @returns shape
+*
+* @example
+* var zeros = require( `@stdlib/ndarray/zeros` );
+*
+* var sh = shape( zeros( [ 3, 3, 3 ] ), false );
+* // returns [ 3, 3, 3 ]
+*/
+declare function shape( x: ndarray, copy: boolean ): Shape;
+
+
+// EXPORTS //
+
+export = shape;
diff --git a/base/shape/docs/types/test.ts b/base/shape/docs/types/test.ts
new file mode 100644
index 00000000..73ae939c
--- /dev/null
+++ b/base/shape/docs/types/test.ts
@@ -0,0 +1,60 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import zeros = require( './../../../../zeros' );
+import shape = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray shape...
+{
+ shape( zeros( [ 3, 2, 1 ] ), false ); // $ExpectType Shape
+ shape( zeros( [ 3, 2, 1 ] ), true ); // $ExpectType Shape
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ shape( '5', false ); // $ExpectError
+ shape( 5, false ); // $ExpectError
+ shape( true, false ); // $ExpectError
+ shape( false, false ); // $ExpectError
+ shape( null, false ); // $ExpectError
+ shape( undefined, false ); // $ExpectError
+ shape( [ '1', '2' ], false ); // $ExpectError
+ shape( {}, false ); // $ExpectError
+ shape( ( x: number ): number => x, false ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a boolean...
+{
+ shape( zeros( [ 3, 2, 1 ] ), '5' ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), 5 ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), null ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), undefined ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), [ '1', '2' ] ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), {} ); // $ExpectError
+ shape( zeros( [ 3, 2, 1 ] ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ shape(); // $ExpectError
+ shape( zeros( [ 2, 2 ] ) ); // $ExpectError
+ shape( zeros( [ 2, 2 ] ), false, {} ); // $ExpectError
+}
diff --git a/base/shape/examples/index.js b/base/shape/examples/index.js
new file mode 100644
index 00000000..d8750a55
--- /dev/null
+++ b/base/shape/examples/index.js
@@ -0,0 +1,57 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable new-cap */
+
+'use strict';
+
+var zeros = require( './../../../zeros' );
+var slice = require( './../../../slice' );
+var E = require( '@stdlib/slice/multi' );
+var S = require( '@stdlib/slice/ctor' );
+var shape = require( './../lib' );
+
+// Create an array:
+var x = zeros( [ 10, 10, 10, 10 ] );
+// returns
+
+// Define some slices:
+var slices = [
+ // :,:,:,:
+ E( null, null, null, null ),
+
+ // 5:10,4,2:4,::-1
+ E( S( 5, 10 ), 4, S( 2, 4 ), S( null, null, -1 ) ),
+
+ // :,:,2,:
+ E( null, null, 2, null ),
+
+ // 1,2,3,:
+ E( 1, 2, 3, null ),
+
+ // 1,3,::2,4::2
+ E( 1, 3, S( null, null, 2 ), S( 4, null, 2 ) )
+];
+
+// Determine the shape of each slice...
+var s;
+var i;
+for ( i = 0; i < slices.length; i++ ) {
+ s = slice( x, slices[ i ] );
+ console.log( 'slice(%s) => %s', x.shape.join( 'x' ), shape( s, false ).join( 'x' ) );
+}
diff --git a/base/shape/lib/index.js b/base/shape/lib/index.js
new file mode 100644
index 00000000..9ebcb80e
--- /dev/null
+++ b/base/shape/lib/index.js
@@ -0,0 +1,41 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Return the shape of a provided ndarray.
+*
+* @module @stdlib/ndarray/base/shape
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var shape = require( '@stdlib/ndarray/base/shape' );
+*
+* var sh = shape( zeros( [ 3, 3, 3 ] ), false );
+* // returns [ 3, 3, 3 ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/base/shape/lib/main.js b/base/shape/lib/main.js
new file mode 100644
index 00000000..bc402cc1
--- /dev/null
+++ b/base/shape/lib/main.js
@@ -0,0 +1,52 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
+
+
+// MAIN //
+
+/**
+* Returns the shape of a provided ndarray.
+*
+* @param {ndarrayLike} x - input ndarray
+* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property
+* @returns {NonNegativeIntegerArray} shape
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+*
+* var out = shape( zeros( [ 3, 3, 3 ] ), false );
+* // returns [ 3, 3, 3 ]
+*/
+function shape( x, copy ) {
+ var sh = x.shape;
+ if ( copy ) {
+ return copyIndexed( sh );
+ }
+ return sh;
+}
+
+
+// EXPORTS //
+
+module.exports = shape;
diff --git a/base/shape/package.json b/base/shape/package.json
new file mode 100644
index 00000000..86d00374
--- /dev/null
+++ b/base/shape/package.json
@@ -0,0 +1,69 @@
+{
+ "name": "@stdlib/ndarray/base/shape",
+ "version": "0.0.0",
+ "description": "Return the shape of a provided ndarray.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdtypes",
+ "types",
+ "base",
+ "ndarray",
+ "shape",
+ "dimensions",
+ "dims",
+ "dimensionality",
+ "multidimensional",
+ "array",
+ "utilities",
+ "utility",
+ "utils",
+ "util"
+ ],
+ "__stdlib__": {}
+}
diff --git a/base/shape/test/test.js b/base/shape/test/test.js
new file mode 100644
index 00000000..a06901fc
--- /dev/null
+++ b/base/shape/test/test.js
@@ -0,0 +1,147 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var zeros = require( './../../../zeros' );
+var shape = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof shape, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'if provided a zero-dimensional ndarray, the function returns an empty array', function test( t ) {
+ t.deepEqual( shape( zeros( [] ), false ), [], 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns the shape of an ndarray', function test( t ) {
+ var expected;
+ var values;
+ var out;
+ var i;
+
+ values = [
+ zeros( [ 3, 3, 3 ] ),
+ zeros( [ 1, 1 ] ),
+ zeros( [ 3, 3, 0, 3 ] ),
+ zeros( [ 1, 2, 3, 4 ] ),
+ zeros( [ 5 ] )
+ ];
+
+ expected = [
+ values[ 0 ].shape,
+ values[ 1 ].shape,
+ values[ 2 ].shape,
+ values[ 3 ].shape,
+ values[ 4 ].shape
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ out = shape( values[ i ], false );
+ t.deepEqual( out, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
+ }
+ t.end();
+});
+
+tape( 'the function accepts minimal ndarray-like objects (shape)', function test( t ) {
+ var expected;
+ var values;
+ var out;
+ var i;
+
+ values = [
+ {
+ 'shape': [ 3, 3, 3 ]
+ },
+ {
+ 'shape': [ 1, 1 ]
+ },
+ {
+ 'shape': [ 3, 3, 0, 3 ]
+ },
+ {
+ 'shape': [ 1, 2, 3, 4 ]
+ },
+ {
+ 'shape': [ 5 ]
+ }
+ ];
+
+ expected = [
+ values[ 0 ].shape,
+ values[ 1 ].shape,
+ values[ 2 ].shape,
+ values[ 3 ].shape,
+ values[ 4 ].shape
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ out = shape( values[ i ], false );
+ t.deepEqual( out, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
+ }
+ t.end();
+});
+
+tape( 'the function supports returning a guaranteed copy of an input ndarray shape', function test( t ) {
+ var expected;
+ var values;
+ var out;
+ var i;
+
+ values = [
+ {
+ 'shape': [ 3, 3, 3 ]
+ },
+ {
+ 'shape': [ 1, 1 ]
+ },
+ {
+ 'shape': [ 3, 3, 0, 3 ]
+ },
+ {
+ 'shape': [ 1, 2, 3, 4 ]
+ },
+ {
+ 'shape': [ 5 ]
+ }
+ ];
+
+ expected = [
+ values[ 0 ].shape,
+ values[ 1 ].shape,
+ values[ 2 ].shape,
+ values[ 3 ].shape,
+ values[ 4 ].shape
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ out = shape( values[ i ], true );
+ t.notEqual( out, values[ i ].shape, 'returns expected value' );
+ t.deepEqual( out, expected[ i ], 'returns expected value for shape '+values[ i ].shape.join( 'x' ) );
+ }
+ t.end();
+});
diff --git a/dist/index.js b/dist/index.js
index 289c8dcf..55e85f95 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,4 +1,4 @@
-"use strict";var A=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var nt=A(function(lz,ot){"use strict";function yg(r){var e,a,i,s;for(e=r.length,a=[],s=0;s=0;s--)a[s]=i,i*=r[s];return a}function pg(r){var e,a,i;for(e=[],a=1,i=0;i=0;s--)e[s]=i,i*=r[s];return e}function gg(r,e){var a,i;for(a=1,i=0;is&&(i=!1),i||e)s=t;else return 0;return i&&e?3:i?1:2}xt.exports=jg});var De=A(function(gz,ht){"use strict";var _g=gt();ht.exports=_g});var bt=A(function(hz,qt){"use strict";function Eg(r){var e,a,i;if(e=r.length,e===0)return 0;for(a=1,i=0;i0?t+=o*(r[v]-1):o<0&&(s+=o*(r[v]-1))}return[s,t]}Zt.exports=Wg});var Wt=A(function(Lz,Xt){"use strict";function Qg(r,e,a,i){var s,t,o,v,u;for(s=r.length,t=a,o=a,u=0;u0?o+=v*(r[u]-1):v<0&&(t+=v*(r[u]-1))}return i[0]=t,i[1]=o,i}Xt.exports=Qg});var ue=A(function(Dz,Ht){"use strict";var Hg=require("@stdlib/utils/define-nonenumerable-read-only-property"),Qt=Jt(),$g=Wt();Hg(Qt,"assign",$g);Ht.exports=Qt});var rs=A(function(zz,$t){"use strict";var rh=ue();function eh(r,e,a,i){var s=rh(e,a,i);return s[0]>=0&&s[1]=0;o--)t=r%a[o],r-=t,r/=a[o],s+=t*e[o];return this._accessors?this._buffer.get(s):this._buffer[s]}xs.exports=yh});var qs=A(function(Xz,hs){"use strict";function ph(r,e){var a,i,s,t,o,v;if(s=this._ndims,s===0)return this._accessors?this._buffer.set(r,this._offset):this._buffer[this._offset]=r,this;if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(this._iterationOrder===1)return this._accessors?this._buffer.set(e,this._offset+r):this._buffer[this._offset+r]=e,this;if(this._iterationOrder===-1)return this._accessors?this._buffer.set(e,this._offset-r):this._buffer[this._offset-r]=e,this}if(i=this._shape,a=this._strides,t=this._offset,this._order==="column-major"){for(v=0;v=0;v--)o=r%i[v],r-=o,r/=i[v],t+=o*a[v];return this._accessors?this._buffer.set(e,t):this._buffer[t]=e,this}hs.exports=ph});var Ss=A(function(Wz,bs){"use strict";function mh(){var r,e;for(r=this._offset,e=0;e=0;o--)t=this.iget(this._length-1-o),r+=Ga(t)+", "+Za(t),o>0&&(r+=", ");else for(o=2;o>=0;o--)r+=this.iget(this._length-1-o),o>0&&(r+=", ")}if(a=Sh[this.dtype],i+=bh(a,"{{data}}",r),i+=", ",e===0?i+="[]":i+="[ "+this._shape.join(", ")+" ]",i+=", ",i+="[ ",e===0)i+="0";else for(o=0;oe?e:r}Ws.exports=xq});var Wa=A(function(lP,Hs){"use strict";var gq=Qs();Hs.exports=gq});var rv=A(function(cP,$s){"use strict";function hq(r,e){var a=e+1;return r<0?(r+=a,r<0&&(r%=a,r!==0&&(r+=a)),r):(r>e&&(r-=a,r>e&&(r%=a)),r)}$s.exports=hq});var Qa=A(function(yP,ev){"use strict";var qq=rv();ev.exports=qq});var iv=A(function(pP,av){"use strict";var bq=Wa(),Sq=Qa(),wq=require("@stdlib/string/format");function jq(r,e,a){if(a==="clamp")return bq(r,e);if(a==="wrap")return Sq(r,e);if(r<0||r>e)throw new RangeError(wq("invalid argument. Index must be on the interval: [0, %d]. Value: `%d`.",e,r));return r}av.exports=jq});var _e=A(function(mP,tv){"use strict";var _q=iv();tv.exports=_q});var ov=A(function(xP,vv){"use strict";var Eq=require("@stdlib/assert/is-integer").isPrimitive,Oq=_e(),Tq=$r(),Iq=require("@stdlib/string/format"),sv=Tq.prototype.iget;function kq(r){if(this._ndims>0){if(!Eq(r))throw new TypeError(Iq("invalid argument. Index must be an integer. Value: `%s`.",r));return r=Oq(r,this._length-1,this._mode),sv.call(this,r)}return sv.call(this)}vv.exports=kq});var fv=A(function(gP,uv){"use strict";var Aq=require("@stdlib/assert/is-integer").isPrimitive,Nq=_e(),Rq=$r(),Cq=require("@stdlib/string/format"),nv=Rq.prototype.iset;function Lq(r,e){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!Aq(r))throw new TypeError(Cq("invalid argument. Index must be an integer. Value: `%s`.",r));r=Nq(r,this._length-1,this._mode),nv.call(this,r,e)}else nv.call(this,r);return this}uv.exports=Lq});var cv=A(function(hP,lv){"use strict";var Dq=require("@stdlib/assert/is-integer").isPrimitive,zq=_e(),dv=require("@stdlib/string/format");function Pq(){var r,e,a,i;if(arguments.length!==this._ndims)throw new RangeError(dv("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(r=this._offset,a=this._submode.length,i=0;i0))throw new TypeError(re("invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.",a));if(v=a.length,v>Iv)throw new RangeError(re("invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.",Iv,v));if(!$q(i))throw new TypeError(re("invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.",i));if(v>0){if(i.length!==v)throw new RangeError(re("invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.",v,i.length))}else{if(i.length!==1)throw new RangeError("invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.");if(i[0]!==0)throw new RangeError(re("invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.",i[0]))}if(!Hq(s))throw new TypeError(re("invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.",s));if(!r4(t))throw new TypeError(re("invalid argument. Sixth argument must be a supported order. Value: `%s`.",t));if(v>0&&!a4(e.length,a,i,s)&&i4(a)>0)throw new Error("invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.");if(u={},u.mode=d4,u.readonly=l4,arguments.length>6&&(f=f4(u,o),f))throw f;return this._mode=u.mode,u.submode===void 0&&(u.submode=[this._mode]),this._submode=u.submode,n=Tv(a,v),d=Tv(i,v||1),kv.call(this,r,e,n,d,s,t),this._flags.READONLY=u.readonly,this}s4(ee,kv);Be(ee,"name","ndarray");Be(ee.prototype,"get",n4);Be(ee.prototype,"iget",v4);Be(ee.prototype,"set",u4);Be(ee.prototype,"iset",o4);Av.exports=ee});var ae=A(function(EP,Rv){"use strict";var c4=Nv();Rv.exports=c4});var Cv=A(function(OP,y4){y4.exports=["none","equiv","safe","same-kind","unsafe"]});var Dv=A(function(TP,Lv){"use strict";var p4=Cv();function m4(){return p4.slice()}Lv.exports=m4});var Pv=A(function(IP,zv){"use strict";function x4(){return{none:0,equiv:1,safe:2,"same-kind":3,unsafe:4}}zv.exports=x4});var $a=A(function(kP,Mv){"use strict";var g4=require("@stdlib/utils/define-nonenumerable-read-only-property"),Vv=Dv(),h4=Pv();g4(Vv,"enum",h4);Mv.exports=Vv});var Fv=A(function(AP,Uv){"use strict";var q4=$a(),Bv=q4(),b4=Bv.length;function S4(r){var e;for(e=0;e0}so.exports=G4});var Fe=A(function(FP,oo){"use strict";var Z4=vo();oo.exports=Z4});var no=A(function(YP,J4){J4.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var lo=A(function(KP,fo){"use strict";var uo=require("@stdlib/utils/keys"),X4=require("@stdlib/assert/has-own-property"),W4=ie(),fa=no(),ua;function Q4(){var r,e,a,i,s,t,o,v,u;for(a={},r=uo(fa),e=r.length,u=0;u0}yo.exports=ib});var da=A(function(JP,mo){"use strict";var tb=po();mo.exports=tb});var go=A(function(XP,xo){"use strict";var sb=Fe(),vb=da();function ob(r,e,a){return a==="unsafe"||r===e?!0:a==="none"||a==="equiv"?!1:a==="safe"?sb(r,e):vb(r,e)}xo.exports=ob});var ii=A(function(WP,ho){"use strict";var nb=go();ho.exports=nb});var bo=A(function(QP,qo){"use strict";var ub=require("@stdlib/buffer/ctor"),fb=require("@stdlib/array/float64"),db=require("@stdlib/array/float32"),lb=require("@stdlib/array/int16"),cb=require("@stdlib/array/int32"),yb=require("@stdlib/array/int8"),pb=require("@stdlib/array/uint16"),mb=require("@stdlib/array/uint32"),xb=require("@stdlib/array/uint8"),gb=require("@stdlib/array/uint8c"),hb=require("@stdlib/array/complex64"),qb=require("@stdlib/array/complex128"),bb={binary:ub,float64:fb,float32:db,generic:Array,int16:lb,int32:cb,int8:yb,uint16:pb,uint32:mb,uint8:xb,uint8c:gb,complex64:hb,complex128:qb};qo.exports=bb});var wo=A(function(HP,So){"use strict";var Sb=bo();function wb(r){return Sb[r]||null}So.exports=wb});var Ye=A(function($P,jo){"use strict";var jb=wo();jo.exports=jb});var Eo=A(function(r9,_o){"use strict";function _b(r){var e;for(e=0;e=0&&r.length=V6(e)}on.exports=M6});var fn=A(function(x9,un){"use strict";var B6=nn();un.exports=B6});var cn=A(function(g9,ln){"use strict";var dn=require("@stdlib/math/base/special/abs");function U6(r){var e,a,i,s;if(e=r.length,e===0)return!1;for(a=dn(r[0]),s=1;sa)return!1;a=i}return!0}Jn.exports=I5});var ni=A(function(B9,Wn){"use strict";var k5=Xn();Wn.exports=k5});var Hn=A(function(U9,Qn){"use strict";var A5=Ke(),N5=se(),R5=ni();function C5(r,e,a){return N5(e)!==0&&R5(e)&&A5(r,e,a)}Qn.exports=C5});var ru=A(function(F9,$n){"use strict";var L5=Hn();$n.exports=L5});var au=A(function(Y9,eu){"use strict";var D5=require("@stdlib/array/base/assert/contains").factory,z5=Fr(),P5=D5(z5("signed_integer"));eu.exports=P5});var ma=A(function(K9,iu){"use strict";var V5=au();iu.exports=V5});var su=A(function(G9,tu){"use strict";var M5=require("@stdlib/array/base/assert/contains").factory,B5=Fr(),U5=M5(B5("unsigned_integer"));tu.exports=U5});var xa=A(function(Z9,vu){"use strict";var F5=su();vu.exports=F5});var nu=A(function(J9,ou){"use strict";var Pr=require("@stdlib/utils/define-read-only-property"),zr={};Pr(zr,"isAllowedDataTypeCast",ii());Pr(zr,"isBufferLengthCompatible",Ka());Pr(zr,"isBufferLengthCompatibleShape",fn());Pr(zr,"isCastingMode",ri());Pr(zr,"isColumnMajor",ti());Pr(zr,"isColumnMajorContiguous",bn());Pr(zr,"isComplexFloatingPointDataType",Ge());Pr(zr,"isContiguous",Tn());Pr(zr,"isDataType",ze());Pr(zr,"isFloatingPointDataType",Ze());Pr(zr,"isIndexMode",Me());Pr(zr,"isIntegerDataType",si());Pr(zr,"isNumericDataType",vi());Pr(zr,"isOrder",te());Pr(zr,"isReadOnly",ce());Pr(zr,"isRealDataType",pa());Pr(zr,"isRealFloatingPointDataType",oi());Pr(zr,"isRowMajor",ni());Pr(zr,"isRowMajorContiguous",ru());Pr(zr,"isSafeDataTypeCast",Fe());Pr(zr,"isSameKindDataTypeCast",da());Pr(zr,"isSignedIntegerDataType",ma());Pr(zr,"isSingleSegmentCompatible",Ke());Pr(zr,"isUnsignedIntegerDataType",xa());ou.exports=zr});var fu=A(function(X9,uu){"use strict";function Y5(r,e){var a,i,s,t,o,v,u,f,n,d;for(s=1,t=1,d=1;d=0&&(n=r[o],i=n<0?-n:n,!(i<=a));)r[o+1]=n,e[v+1]=e[v],o-=1,v-=1;r[o+1]=u,e[v+1]=f,s+=1,t+=1}}uu.exports=Y5});var cu=A(function(W9,lu){"use strict";var K5=require("@stdlib/array/base/zero-to"),G5=require("@stdlib/array/base/copy-indexed"),ga=require("@stdlib/array/base/take"),Z5=require("@stdlib/array/base/filled"),ui=De(),J5=fu(),du=3;function X5(r,e,a,i){var s,t,o,v,u,f,n,d,y,x;if(s=K5(r.length),f=ui(e),n=ui(a),d=ui(i),t=Z5([],4),t[f].push(e),t[n].push(a),t[d].push(i),o=t[0].length,o===du)u=e;else if(o===du-1){for(y=1;y<4;y++)if(t[y].length){u=t[y][0];break}}else{for(x=0,y=1;y<4;y++)v=t[y].length,v>=o&&(o=v,x=y);u=t[x][0]}return u=G5(u),J5(u,s),r=ga(r,s),e=e===u?u:ga(e,s),a=a===u?u:ga(a,s),i=i===u?u:ga(i,s),{sh:r,sx:e,sy:a,sz:i}}lu.exports=X5});var pu=A(function(Q9,yu){"use strict";var W5=cu();yu.exports=W5});var xu=A(function(H9,mu){"use strict";var Q5={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};mu.exports=Q5});var hu=A(function($9,gu){"use strict";var fi=fe(),ha=xu();function H5(r,e,a){var i,s,t;return i=fi(r),s=fi(e),t=fi(a),i===null||s===null||t===null?ha.BLOCK_SIZE_IN_ELEMENTS:i>s&&i>t?ha.BLOCK_SIZE_IN_BYTES/i|0:s>t?ha.BLOCK_SIZE_IN_BYTES/s|0:ha.BLOCK_SIZE_IN_BYTES/t|0}gu.exports=H5});var bu=A(function(rV,qu){"use strict";var $5=hu();qu.exports=$5});var ju=A(function(eV,wu){"use strict";var rS=require("@stdlib/string/format"),qa=require("@stdlib/math/base/special/trunc"),Su=require("@stdlib/math/base/special/abs");function eS(r,e,a,i,s,t){var o,v,u,f,n,d;for(o=r.length,v=1,d=0;d=v&&(s=v-1);else if(t==="wrap")s<0?(s+=v,s<0&&(s%=v,s!==0&&(s+=v))):s>=v&&(s-=v,s>=v&&(s%=v));else if(s<0||s>=v)throw new RangeError(rS("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",v,s));if(u=0,i==="column-major"){for(d=o-1;d>=0;d--)n=e[d],n<0?(f=qa(s/n),s-=f*n,f+=r[d]-1):(f=qa(s/n),s-=f*n),u+=f*Su(n);return u}for(d=0;d=0;f--)if(n=v-o+f,!(n<0)){if(u=s[n],i=e[f],i!==0&&if&&(f=e[n]);for(n=0;n=0;){for(t=e[0]-f+n,t>=0?i=s[t]:i=1,d=1;d=0?v=r[d][o]:v=1,i===1){i=v;continue}if(!(v===1||i===v))return null}a[n]=i,n-=1}return a}Lu.exports=pS});var Pu=A(function(nV,zu){"use strict";var mS=Du();zu.exports=mS});var Mu=A(function(uV,Vu){"use strict";var xS=Ue(),gS=la();function hS(r){var e=gS(r);return e?xS(e):null}Vu.exports=hS});var Uu=A(function(fV,Bu){"use strict";var qS=Mu();Bu.exports=qS});var Yu=A(function(dV,Fu){"use strict";function bS(){return{binary:"r",bool:"x",complex64:"c",complex128:"z",float16:"h",bfloat16:"e",float32:"f",float64:"d",float128:"g",generic:"o",int8:"s",int16:"k",int32:"i",int64:"l",int128:"m",int256:"n",uint8:"b",uint8c:"a",uint16:"t",uint32:"u",uint64:"v",uint128:"w",uint256:"y"}}Fu.exports=bS});var Zu=A(function(lV,Gu){"use strict";var SS=ie(),Ku=Yu(),di;function wS(r){return arguments.length===0?Ku():(di===void 0&&(di=Ku()),di[SS(r)]||null)}Gu.exports=wS});var li=A(function(cV,Ju){"use strict";var jS=Zu();Ju.exports=jS});var Hu=A(function(yV,Qu){"use strict";var Xu=require("@stdlib/utils/object-inverse"),Wu=li(),ci;function _S(r){return arguments.length===0?Xu(Wu()):(ci===void 0&&(ci=Xu(Wu())),ci[r]||null)}Qu.exports=_S});var rf=A(function(pV,$u){"use strict";var ES=Hu();$u.exports=ES});var af=A(function(mV,ef){"use strict";function OS(){return{binary:"byte",bool:"boolean",complex64:"single-precision floating-point complex number",complex128:"double-precision floating-point complex number",float16:"half-precision floating-point number",bfloat16:"brain floating-point number",float32:"single-precision floating-point number",float64:"double-precision floating-point number",float128:"quadruple-precision floating-point number",generic:"generic array value",int8:"signed 8-bit integer",int16:"signed 16-bit integer",int32:"signed 32-bit integer",int64:"signed 64-bit integer",int128:"signed 128-bit integer",int256:"signed 256-bit integer",uint8:"unsigned 8-bit integer",uint8c:"unsigned 8-bit integer (clamped)",uint16:"unsigned 16-bit integer",uint32:"unsigned 32-bit integer",uint64:"unsigned 64-bit integer",uint128:"unsigned 128-bit integer",uint256:"unsigned 256-bit integer"}}ef.exports=OS});var vf=A(function(xV,sf){"use strict";var TS=ie(),tf=af(),yi;function IS(r){return arguments.length===0?tf():(yi===void 0&&(yi=tf()),yi[TS(r)]||null)}sf.exports=IS});var nf=A(function(gV,of){"use strict";var kS=vf();of.exports=kS});var ff=A(function(hV,uf){"use strict";var AS=va(),NS=Ue();function RS(r){var e=typeof r;return e==="number"?AS(r)?r:null:e==="string"?NS(r):null}uf.exports=RS});var pi=A(function(qV,df){"use strict";var CS=ff();df.exports=CS});var lf=A(function(bV,LS){LS.exports={binary:null,bool:"bool",complex64:"stdlib_complex64_t",complex128:"stdlib_complex128_t",float16:null,bfloat16:null,float32:"float",float64:"double",float128:null,generic:null,int8:"int8_t",int16:"int16_t",int32:"int32_t",int64:"int64_t",int128:null,int256:null,uint8:"uint8_t",uint8c:null,uint16:"uint16_t",uint32:"uint32_t",uint64:"uint64_t",uint128:null,uint256:null}});var yf=A(function(SV,cf){"use strict";var DS=ie(),zS=lf();function PS(r){return zS[DS(r)]||null}cf.exports=PS});var mf=A(function(wV,pf){"use strict";var VS=yf();pf.exports=VS});var hf=A(function(jV,gf){"use strict";var MS=require("@stdlib/assert/is-array-like-object"),xf=require("@stdlib/assert/is-nonnegative-integer").isPrimitive,BS=ie(),mi=require("@stdlib/string/format");function US(r,e,a){var i,s,t,o,v,u,f,n;if(!MS(r))throw new TypeError(mi("invalid argument. First argument must be an array-like object. Value: `%s`.",r));if(!xf(e))throw new TypeError(mi("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",e));if(!xf(a))throw new TypeError(mi("invalid argument. Third argument must be a nonnegative integer. Value: `%s`.",a));if(i=r.length,i===0)throw new RangeError("invalid argument. First argument must contain at least one element.");if(v=e+a,i%v!==0)throw new RangeError("invalid arguments. Length of the first argument is incompatible with the second and third arguments.");for(s=[],t=[],u=2*v,n=2*e,f=0;f<=u;f++)f===0?f===n?t.push("() => ("):t.push("("):f===u?f===n?t.push(") => ()"):t.push(")"):f===n?t.push(") => ("):f%2===1?t.push(""):t.push(", ");for(f=0;f0?(t=ZS(e),o=YS(e,a)):(t=1,o=[0]),r==="binary"?s=XS(t):s=JS(t,r),new GS(r,s,e,o,KS(e,o),a)}bf.exports=WS});var jf=A(function(OV,wf){"use strict";var QS=Sf();wf.exports=QS});var Ef=A(function(TV,_f){"use strict";var HS=Yr(),$S=Kr(),rw=Lr(),ew=require("@stdlib/array/empty"),aw=require("@stdlib/buffer/alloc-unsafe");function iw(r){var e,a,i,s,t,o,v;return v=r.dtype,t=r.shape,s=r.order,e=t.length,e>0?(a=rw(t),o=HS(t,s)):(a=1,o=[0]),v==="binary"?i=aw(a):i=ew(a,v),new r.constructor(v,i,t,o,$S(t,o),s)}_f.exports=iw});var Tf=A(function(IV,Of){"use strict";var tw=Ef();Of.exports=tw});var Af=A(function(kV,kf){"use strict";var sw=ce(),If=require("@stdlib/string/format");function vw(r,e){var a,i,s,t,o,v,u;if(t=r.shape,o=r.strides,s=r.order,v=t.length,a=[],i=[],e<0){if(e<-v-1)throw new RangeError(If("invalid argument. Specified axis is out-of-bounds. Must be on the interval: [-%u-1, %u]. Value: `%d`.",v,v,e));e+=v+1}else if(e>v)throw new RangeError(If("invalid argument. Specified axis is out-of-bounds. Must be on the interval: [-%u-1, %u]. Value: `%d`.",v,v,e));if(e===0)for(i.push(1),a.push(o[0]),u=0;u=u&&(s=u-1);else if(t==="wrap")s<0?(s+=u,s<0&&(s%=u,s!==0&&(s+=u))):s>=u&&(s-=u,s>=u&&(s%=u));else if(s<0||s>=u)throw new RangeError(mw("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",u,s));if(a===0){if(i==="column-major"){for(d=0;d=0;d--)n=s%r[d],s-=n,s/=r[d],o[d]=n;return o}if(i==="column-major"){for(d=v-1;d>=0;d--)n=e[d],n<0?(f=Sa(s/n),s-=f*n,o[d]=r[d]-1+f):(f=Sa(s/n),s-=f*n,o[d]=f);return o}for(d=0;d0&&(s+=e[t]*(r[t]-1))}return s}Ff.exports=Sw});var Gf=A(function(PV,Kf){"use strict";var ww=Yf();Kf.exports=ww});var Xf=A(function(VV,Jf){"use strict";var Zf=ba();function jw(r,e){var a,i,s;if(i=e.length,a=r.shape,a.length===i){for(s=0;si;t--)s[t]=a[t];for(t=i;t>=0&&(o=(a[t]+1)%e[t],s[t]=o,!(o>0));t--);for(t-=1;t>=0;t--)s[t]=a[t];return s}function Yw(r,e,a,i,s){var t,o;for(t=0;t0));t++);for(t+=1;t=t)return null;return e===Uw?Fw(t,r,a,i,s):Yw(t,r,a,i,s)}cd.exports=Kw});var pd=A(function(WV,yd){"use strict";var Gw=require("@stdlib/array/base/zeros"),Zw=qi();function Jw(r,e,a,i){return Zw(r,e,a,i,Gw(r.length))}yd.exports=Jw});var qe=A(function(QV,xd){"use strict";var Xw=require("@stdlib/utils/define-nonenumerable-read-only-property"),md=pd(),Ww=qi();Xw(md,"assign",Ww);xd.exports=md});var hd=A(function(HV,gd){"use strict";function Qw(r){var e,a;for(e=0,a=0;a=0&&(n=r[o],i=n<0?-n:n,!(i<=a));)r[o+1]=n,e[v+1]=e[v],o-=1,v-=1;r[o+1]=u,e[v+1]=f,s+=1,t+=1}}Sd.exports=$w});var _d=A(function(eM,jd){"use strict";var r8=require("@stdlib/array/base/zero-to"),e8=require("@stdlib/array/base/copy-indexed"),a8=require("@stdlib/array/base/take"),i8=wd();function t8(r,e){var a;return a=r8(r.length),e=e8(e),i8(e,a),r=a8(r,a),{sh:r,sx:e}}jd.exports=t8});var Mr=A(function(aM,Ed){"use strict";var s8=_d();Ed.exports=s8});var Td=A(function(iM,Od){"use strict";var v8={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};Od.exports=v8});var Ad=A(function(tM,kd){"use strict";var o8=fe(),Id=Td();function n8(r){var e=o8(r);return e===null?Id.BLOCK_SIZE_IN_ELEMENTS:Id.BLOCK_SIZE_IN_BYTES/e|0}kd.exports=n8});var Br=A(function(sM,Nd){"use strict";var u8=Ad();Nd.exports=u8});var Cd=A(function(vM,Rd){"use strict";var f8=Mr(),d8=Br();function l8(r,e){var a,i,s,t,o,v,u,f,n,d,y,x,h,p,q,m,b;for(b=f8(r.shape,r.strides),u=b.sh,d=b.sx,a=d8(r.dtype),y=r.offset,i=r.data,t=d[0],s=r.accessors[1],m=u[1];m>0;)for(m0;)for(q0;)for(E0;)for(g0;)for(S0;)for(w0;)for(O0;)for(l0;)for(_0;)for(I0;)for(R0;)for(N0;)for(T0;)for(k0;)for(V0;)for(z0;)for(C0;)for(D0;)for(L0;)for(I0;)for(F0;)for(U0;)for(B0;)for(M0;)for(P0;)for(V0;)for(z0;)for(G0;)for(J0;)for(K0;)for(Z0;)for(Y0;)for(F0;)for(U0;)for(B0;)for(H0;)for($0;)for(W0;)for(Q0;)for(X0;)for(G0;)for(J0;)for(K0;)for(Z0;)for(ar0;)for(sr0;)for(er0;)for(ir0;)for(rr0;)for(H0;)for($0;)for(W0;)for(Q0;)for(X0;)for(q0;)for(p0;)for(g0;)for(S0;)for(j0;)for(O0;)for(l0;)for(_0;)for(c0;)for(R0;)for(N0;)for(T0;)for(k0;)for(w0;)for(z0;)for(C0;)for(D0;)for(L0;)for(I0;)for(R0;)for(U0;)for(B0;)for(M0;)for(P0;)for(V0;)for(z0;)for(C0;)for(J0;)for(K0;)for(Z0;)for(Y0;)for(F0;)for(U0;)for(B0;)for(M0;)for($0;)for(W0;)for(Q0;)for(X0;)for(G0;)for(J0;)for(K0;)for(Z0;)for(Y0;)for(sr0;)for(er0;)for(ir0;)for(rr0;)for(H0;)for($0;)for(W0;)for(Q0;)for(X0;)for(G=v&&(s=v-1);else if(t==="wrap")s<0?(s+=v,s<0&&(s%=v,s!==0&&(s+=v))):s>=v&&(s-=v,s>=v&&(s%=v));else if(s<0||s>=v)throw new RangeError(bj("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",v,s));if(u=a,i==="column-major"){for(n=0;n=0;n--)f=s%r[n],s-=f,s/=r[n],u+=f*e[n];return u}z0.exports=Sj});var ye=A(function(DM,V0){"use strict";var wj=P0();V0.exports=wj});var B0=A(function(zM,M0){"use strict";var jj=Lr(),_j=ye(),Ej="throw";function Oj(r,e){var a,i,s,t,o,v,u,f,n;for(o=r.shape,s=jj(o),a=r.data,v=r.strides,u=r.offset,i=r.order,t=r.accessors[1],n=0;n0&&(y=X7(y.length))}else y=xc(x);return gc(y)===0?H7(d,o,ji(y,f),u,!i):(t=W7(x,s,t),y=ji(y,f),y.length===0?new d(o,r.data,[],[0],t,u,{readonly:!i}):(s=Q7(x,s,f),new d(o,r.data,y,s,t,u,{readonly:!i})))}qc.exports=$7});var be=A(function(EB,Sc){"use strict";var rE=bc();Sc.exports=rE});var jc=A(function(OB,wc){"use strict";function eE(r,e){var a,i,s,t,o,v,u,f,n,d;for(s=1,t=1,d=1;d=0&&(n=r[o],i=n<0?-n:n,!(i<=a));)r[o+1]=n,e[v+1]=e[v],o-=1,v-=1;r[o+1]=u,e[v+1]=f,s+=1,t+=1}}wc.exports=eE});var Oc=A(function(TB,Ec){"use strict";var aE=require("@stdlib/array/base/zero-to"),iE=require("@stdlib/array/base/copy-indexed"),_c=require("@stdlib/array/base/take"),tE=jc();function sE(r,e,a){var i;return i=aE(r.length),e=iE(e),tE(e,i),r=_c(r,i),a=_c(a,i),{sh:r,sx:e,sy:a}}Ec.exports=sE});var kr=A(function(IB,Tc){"use strict";var vE=Oc();Tc.exports=vE});var kc=A(function(kB,Ic){"use strict";var oE={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};Ic.exports=oE});var Rc=A(function(AB,Nc){"use strict";var Ac=fe(),_i=kc();function nE(r,e){var a,i;return a=Ac(r),i=Ac(e),a===null||i===null?_i.BLOCK_SIZE_IN_ELEMENTS:a>i?_i.BLOCK_SIZE_IN_BYTES/a|0:_i.BLOCK_SIZE_IN_BYTES/i|0}Nc.exports=nE});var Ar=A(function(NB,Cc){"use strict";var uE=Rc();Cc.exports=uE});var Dc=A(function(RB,Lc){"use strict";var fE=kr(),dE=Ar();function lE(r,e,a){var i,s,t,o,v,u,f,n,d,y,x,h,p,q,m,b,j,S,g,E,c,_,l,O,w;for(w=fE(r.shape,r.strides,e.strides),h=w.sh,m=w.sx,b=w.sy,i=dE(r.dtype,e.dtype),j=r.offset,S=e.offset,s=r.data,t=e.data,u=m[0],n=b[0],o=r.accessors[0],v=e.accessors[1],O=h[1];O>0;)for(O0;)for(l0;)for(L0;)for(I0;)for(R0;)for(B0;)for(M0;)for(P0;)for(V0;)for(G0;)for(J0;)for(K0;)for(Z0;)for(Y0;)for(ir0;)for(rr0;)for(H0;)for($0;)for(W0;)for(Q0;)for(nr0;)for(or0;)for(vr0;)for(tr0;)for(ar0;)for(sr0;)for(er0;)for(pr0;)for(lr0;)for(yr0;)for(cr0;)for(dr0;)for(fr0;)for(ur0;)for(nr0;)for(wr0;)for(Sr0;)for(xr0;)for(jr0;)for(qr0;)for(br0;)for(mr0;)for(pr0;)for(lr0;)for(Dr0;)for(Cr0;)for(Ir0;)for(Tr0;)for(Or0;)for(Er0;)for(_r0;)for(wr0;)for(Sr0;)for(xr0;)for(_0;)for(c0;)for(R0;)for(N0;)for(T0;)for(P0;)for(V0;)for(z0;)for(C0;)for(K0;)for(Z0;)for(Y0;)for(F0;)for(U0;)for(H0;)for($0;)for(W0;)for(Q0;)for(X0;)for(G0;)for(vr0;)for(tr0;)for(ar0;)for(sr0;)for(er0;)for(ir0;)for(rr0;)for(yr0;)for(cr0;)for(dr0;)for(fr0;)for(ur0;)for(nr0;)for(or0;)for(vr0;)for(xr0;)for(jr0;)for(qr0;)for(br0;)for(mr0;)for(pr0;)for(lr0;)for(yr0;)for(cr0;)for(Ir0;)for(Tr0;)for(Or0;)for(Er0;)for(_r0;)for(wr0;)for(Sr0;)for(xr0;)for(jr0;)for(qr=u&&(n=u-1);else if(o==="wrap")n<0?(n+=u,n<0&&(n%=u,n!==0&&(n+=u))):n>=u&&(n-=u,n>=u&&(n%=u));else if(n<0||n>=u)throw new RangeError(BT("invalid argument. Subscripts must not exceed array dimensions. Subscript: `%u`. Value: `%d`.",d,n));f=r[d],f<0&&e===0?v-=n*f:v+=n*f}return v}_y.exports=UT});var Ti=A(function(EU,Oy){"use strict";var FT=Ey();Oy.exports=FT});var ky=A(function(OU,Iy){"use strict";function Ty(r,e,a,i,s,t){var o,v,u,f,n;if(t>=e.length)return r.accessors[0](r.data,i);for(u=[],f=e[t],o=a[t],n=0;n0;)for(k0;)for(w0;)for(C0;)for(D0;)for(L0;)for(F0;)for(U0;)for(B0;)for(M0;)for(Q0;)for(X0;)for(G0;)for(J0;)for(K0;)for(sr0;)for(er0;)for(ir0;)for(rr0;)for(H0;)for($0;)for(fr0;)for(ur0;)for(nr0;)for(or0;)for(vr0;)for(tr0;)for(ar0;)for(br0;)for(mr0;)for(pr0;)for(lr0;)for(yr0;)for(cr0;)for(dr0;)for(fr0;)for(Er0;)for(_r0;)for(wr0;)for(Sr0;)for(xr0;)for(jr0;)for(qr0;)for(br0;)for(mr0;)for(Gr0;)for(Ur0;)for(Dr0;)for(Cr0;)for(Ir0;)for(Tr0;)for(Or0;)for(Er0;)for(_r0;)for(wr0;)for(O0;)for(l0;)for(L0;)for(I0;)for(R0;)for(B0;)for(M0;)for(P0;)for(V0;)for(G0;)for(J0;)for(K0;)for(Z0;)for(Y0;)for(ir0;)for(rr0;)for(H0;)for($0;)for(W0;)for(Q0;)for(nr0;)for(or0;)for(vr0;)for(tr0;)for(ar0;)for(sr0;)for(er0;)for(pr0;)for(lr0;)for(yr0;)for(cr0;)for(dr0;)for(fr0;)for(ur0;)for(nr0;)for(wr0;)for(Sr0;)for(xr0;)for(jr0;)for(qr0;)for(br0;)for(mr0;)for(pr0;)for(lr0;)for(Dr0;)for(Cr0;)for(Ir0;)for(Tr0;)for(Or0;)for(Er0;)for(_r0;)for(wr0;)for(Sr0;)for(xr0?(t=CA(e),o=IA(e,a)):(t=1,o=[0]),s=AA(r,t),s===null)throw new TypeError(NA("invalid argument. First argument must be a recognized data type. Value: `%s`.",r));return new RA(r,s,e,o,kA(e,o),a)}k2.exports=LA});var R2=A(function(_F,N2){"use strict";var DA=A2();N2.exports=DA});var L2=A(function(EF,C2){"use strict";var zA=Yr(),PA=Kr(),VA=Wr(),MA=require("@stdlib/string/format"),BA=Lr();function UA(r){var e,a,i,s,t,o,v;if(v=r.dtype,t=r.shape,s=r.order,e=t.length,e>0?(a=BA(t),o=zA(t,s)):(a=1,o=[0]),i=VA(v,a),i===null)throw new TypeError(MA("invalid argument. First argument must have a recognized data type. Value: `%s`.",v));return new r.constructor(v,i,t,o,PA(t,o),s)}C2.exports=UA});var z2=A(function(OF,D2){"use strict";var FA=L2();D2.exports=FA});var V2=A(function(TF,P2){"use strict";var hr=require("@stdlib/utils/define-read-only-property"),gr={};hr(gr,"assert",nu());hr(gr,"binaryLoopOrder",pu());hr(gr,"binaryBlockSize",bu());hr(gr,"bind2vind",Eu());hr(gr,"broadcastArray",ba());hr(gr,"broadcastScalar",Cu());hr(gr,"broadcastShapes",Pu());hr(gr,"buffer",Wr());hr(gr,"bufferCtors",Ye());hr(gr,"bufferDataType",la());hr(gr,"bufferDataTypeEnum",Uu());hr(gr,"bytesPerElement",fe());hr(gr,"char2dtype",rf());hr(gr,"clampIndex",Wa());hr(gr,"ndarray",$r());hr(gr,"dtypeChar",li());hr(gr,"dtypeDesc",nf());hr(gr,"dtypeEnum2Str",va());hr(gr,"dtypeResolveEnum",pi());hr(gr,"dtypeResolveStr",ie());hr(gr,"dtypeStr2Enum",Ue());hr(gr,"dtype2c",mf());hr(gr,"dtypes2signatures",xi());hr(gr,"empty",jf());hr(gr,"emptyLike",Tf());hr(gr,"expandDimensions",Rf());hr(gr,"scalar2ndarray",zf());hr(gr,"ind",_e());hr(gr,"ind2sub",wa());hr(gr,"iterationOrder",se());hr(gr,"maxViewBufferIndex",Gf());hr(gr,"maybeBroadcastArray",Qf());hr(gr,"metaDataProps",ed());hr(gr,"minViewBufferIndex",sd());hr(gr,"minmaxViewBufferIndex",ue());hr(gr,"ndarraylike2object",Xe());hr(gr,"ndims",ld());hr(gr,"nextCartesianIndex",qe());hr(gr,"nonsingletonDimensions",bd());hr(gr,"nullary",ml());hr(gr,"nullaryLoopOrder",Mr());hr(gr,"nullaryBlockSize",Br());hr(gr,"numel",Lr());hr(gr,"offset",ql());hr(gr,"outputPolicyEnum2Str",_a());hr(gr,"outputPolicyResolveEnum",Vl());hr(gr,"outputPolicyResolveStr",Fl());hr(gr,"outputPolicyStr2Enum",Ea());hr(gr,"prependSingletonDimensions",Zl());hr(gr,"removeSingletonDimensions",Ql());hr(gr,"serializeMetaData",sc());hr(gr,"shape2strides",Yr());hr(gr,"singletonDimensions",uc());hr(gr,"slice",be());hr(gr,"sliceAssign",Oa());hr(gr,"strides2offset",Kr());hr(gr,"strides2order",De());hr(gr,"sub2ind",Ti());hr(gr,"ndarray2array",Ii());hr(gr,"transpose",zy());hr(gr,"unary",Ei());hr(gr,"unaryBy",_2());hr(gr,"unaryLoopOrder",kr());hr(gr,"unaryOutputDataType",I2());hr(gr,"unaryBlockSize",Ar());hr(gr,"vind2bind",ye());hr(gr,"wrapIndex",Qa());hr(gr,"zeros",R2());hr(gr,"zerosLike",z2());P2.exports=gr});var B2=A(function(IF,M2){"use strict";var YA=require("@stdlib/assert/is-ndarray-like"),KA=require("@stdlib/assert/is-collection"),GA=require("@stdlib/assert/is-nonnegative-integer").isPrimitive,ea=require("@stdlib/array/base/copy-indexed"),aa=require("@stdlib/string/format");function ZA(r,e){var a,i,s,t,o,v,u,f,n;if(!YA(r))throw new TypeError(aa("invalid argument. First argument must be an ndarray. Value: `%s`.",r));if(!KA(e))throw new TypeError(aa("invalid argument. Second argument must be an array of nonnegative integers. Value: `%s`.",e));if(o=e.length,s=r.shape,v=s.length,o=0;f--)if(n=v-o+f,!(n<0)){if(u=s[n],i=e[f],!GA(i))throw new TypeError(aa("invalid argument. Second argument must be an array of nonnegative integers. Value: `%s`.","["+e.join(",")+"]"));if(i!==0&&i1){if(e=arguments[1],!sN(e))throw new TypeError(Ai("invalid argument. Options argument must be an object. Value: `%s`.",e));Ta(e,"dtype")?a=e.dtype:a=H2,Ta(e,"order")?i=e.order:i=$2,Ta(e,"mode")&&(t.mode=e.mode),Ta(e,"submode")&&(t.submode=e.submode)}else a=H2,i=$2;if(typeof r=="number")f=[r];else if(vN(r))f=r;else throw new TypeError(Ai("invalid argument. First argument must be either a nonnegative integer or an array of nonnegative integers. Value: `%s`.",r));if(s=f.length,s>0){if(v=dN(f),v!==v||v<0)throw new TypeError(Ai("invalid argument. First argument must be either a nonnegative integer or an array of nonnegative integers. Value: `%s`.",r));u=oN(f,i)}else v=1,u=[0];return a==="binary"?o=fN(v):o=uN(v,a),new lN(a,o,f,u,nN(f,u),i,t)}em.exports=cN});var tm=A(function(LF,im){"use strict";var yN=am();im.exports=yN});var vm=A(function(DF,sm){"use strict";var pN=require("@stdlib/assert/is-ndarray-like"),mN=require("@stdlib/assert/is-plain-object"),xN=require("@stdlib/assert/is-nonnegative-integer-array").primitives,ia=require("@stdlib/assert/has-own-property"),gN=Yr(),hN=Kr(),qN=Lr(),bN=ae(),SN=require("@stdlib/array/empty"),wN=require("@stdlib/buffer/alloc-unsafe"),Ni=require("@stdlib/string/format");function jN(r){var e,a,i,s,t,o,v,u,f;if(!pN(r))throw new TypeError(Ni("invalid argument. First argument must be an ndarray-like object. Value: `%s`.",r));if(t={},arguments.length>1){if(e=arguments[1],!mN(e))throw new TypeError(Ni("invalid argument. Options argument must be an object. Value: `%s`.",e));if(ia(e,"dtype")?a=e.dtype:a=r.dtype,ia(e,"shape")){if(f=e.shape,typeof f=="number"&&(f=[f]),!xN(f))throw new TypeError(Ni("invalid option. `%s` option must be a nonnegative integer or an array of nonnegative integers. Option: `%s`.","shape",f))}else f=r.shape;ia(e,"order")?i=e.order:i=r.order,ia(e,"mode")&&(t.mode=e.mode),ia(e,"submode")&&(t.submode=e.submode)}else a=r.dtype,f=r.shape,i=r.order;return s=f.length,s>0?(v=qN(f),v<0&&(v=0),u=gN(f,i)):(v=1,u=[0]),a==="binary"?o=wN(v):o=SN(v,a),new bN(a,o,f,u,hN(f,u),i,t)}sm.exports=jN});var nm=A(function(zF,om){"use strict";var _N=vm();om.exports=_N});var Ri=A(function(PF,um){"use strict";var EN=/^-?[0-9]+$/;um.exports=EN});var Ci=A(function(VF,fm){"use strict";var ON=/:/;fm.exports=ON});var lm=A(function(MF,dm){"use strict";var TN=require("@stdlib/string/base/trim"),IN=require("@stdlib/string/base/replace"),Li=require("@stdlib/slice/multi"),kN=require("@stdlib/slice/base/str2multislice"),AN=require("@stdlib/slice/base/seq2multislice"),NN=require("@stdlib/slice/base/str2slice"),Se=require("@stdlib/string/format"),RN=Ri(),CN=Ci();function LN(r,e){var a,i,s,t;if(i=TN(e),s=i[0],s==="S"){if(t=NN(e),t===null)throw new Error(Se("invalid operation. Unsupported slice operation. Value: `%s`.",e));t=new Li(t)}else if(s==="M"){if(t=kN(i),t===null)throw new Error(Se("invalid operation. Unsupported slice operation. Value: `%s`.",e))}else if(RN.test(i))t=parseInt(i,10),t=new Li(t);else if(CN.test(i)){if(a=r.shape,t=AN(i,a,!0),t.code)throw t.code==="ERR_SLICE_INVALID_INCREMENT"?new Error(Se("invalid operation. A subsequence increment must be a non-zero integer. Value: `%s`.",e)):t.code==="ERR_SLICE_INVALID_ELLIPSIS"?new Error(Se("invalid operation. A subsequence may only include a single ellipsis. Value: `%s`.",e)):t.code==="ERR_SLICE_INVALID_SUBSEQUENCE"?new Error(Se("invalid operation. Unsupported slice operation. Value: `%s`.",e)):new RangeError(Se("invalid operation. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u.",a.join(","),IN(i,/\.\.\.,/,"").split(",").length))}else if(i.length===0||i==="...")t=new Li;else throw new Error(Se("invalid operation. Unsupported slice operation. Value: `%s`.",e));return t}dm.exports=LN});var mm=A(function(BF,pm){"use strict";var DN=require("@stdlib/string/base/trim"),zN=require("@stdlib/string/base/replace"),cm=require("@stdlib/slice/multi"),PN=require("@stdlib/slice/base/str2multislice"),ym=require("@stdlib/slice/base/seq2multislice"),VN=require("@stdlib/slice/base/str2slice"),xe=require("@stdlib/string/format"),MN=Ri();function BN(r,e,a){var i,s,t,o;if(s=DN(e),t=s[0],t==="S"){if(o=VN(e),o===null)throw new Error(xe("invalid operation. Unsupported slice operation. Value: `%s`.",e));o=new cm(o)}else if(t==="M"){if(o=PN(s),o===null)throw new Error(xe("invalid operation. Unsupported slice operation. Value: `%s`.",e))}else if(MN.test(s))o=parseInt(s,10),o=new cm(o);else if(s.length>0){if(i=r.shape,o=ym(s,i,!0),o.code){if(o.code==="ERR_SLICE_INVALID_INCREMENT")throw new Error(xe("invalid operation. A subsequence increment must be a non-zero integer. Value: `%s`.",e));if(o.code==="ERR_SLICE_INVALID_ELLIPSIS")throw new Error(xe("invalid operation. A subsequence may only include a single ellipsis. Value: `%s`.",e));if(o.code==="ERR_SLICE_INVALID_SUBSEQUENCE")throw new Error(xe("invalid operation. Unsupported slice operation. Value: `%s`.",e));if(o.code==="ERR_SLICE_TOO_MANY_DIMENSIONS")throw new RangeError(xe("invalid operation. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u.",r.shape.join(","),zN(s,/\.\.\.,/,"").split(",").length));if(o.code==="ERR_SLICE_OUT_OF_BOUNDS"){if(a)throw new RangeError(xe("invalid operation. Slice exceeds array bounds. Array shape: (%s).",i.join(",")));o=ym(s,i,!1)}}}else throw new RangeError(xe("invalid operation. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u.",r.shape.join(","),0));return o}pm.exports=BN});var hm=A(function(UF,gm){"use strict";var UN=require("@stdlib/string/base/trim"),FN=require("@stdlib/slice/base/str2multislice"),xm=require("@stdlib/slice/base/seq2multislice"),YN=require("@stdlib/slice/base/sargs2multislice"),ke=require("@stdlib/string/format"),KN=Ci();function GN(r,e,a){var i,s,t,o;if(s=UN(e),t=s[0],t==="M"){if(o=FN(s),o===null)throw new Error(ke("invalid operation. Unsupported slice operation. Value: `%s`.",e))}else if(KN.test(s)||s==="..."){if(i=r.shape,o=xm(s,i,!0),o.code){if(o.code==="ERR_SLICE_INVALID_INCREMENT")throw new Error(ke("invalid operation. A subsequence increment must be a non-zero integer. Value: `%s`.",e));if(o.code==="ERR_SLICE_INVALID_ELLIPSIS")throw new Error(ke("invalid operation. A subsequence may only include a single ellipsis. Value: `%s`.",e));if(o.code==="ERR_SLICE_INVALID_SUBSEQUENCE")throw new Error(ke("invalid operation. Unsupported slice operation. Value: `%s`.",e));if(o.code==="ERR_SLICE_OUT_OF_BOUNDS"){if(a)throw new RangeError(ke("invalid operation. Slice exceeds array bounds. Array shape: (%s).",i.join(",")));o=xm(s,i,!1)}}}else if(o=YN(s),o===null)throw new Error(ke("invalid operation. Unsupported slice operation. Value: `%s`.",e));return o}gm.exports=GN});var Di=A(function(FF,qm){"use strict";var ZN=require("@stdlib/utils/properties-in"),JN=require("@stdlib/array/base/assert/contains").factory,XN=ae(),WN=ve(),QN=JN(ZN(new XN("generic",[0],[],[0],0,WN.get("order"))));qm.exports=QN});var Sm=A(function(YF,bm){"use strict";var HN=require("@stdlib/assert/is-function");function $N(r,e,a){var i=r[e];if(HN(i))return s;return i;function s(){var t,o;for(t=[],o=0;o