You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1306 lines
35 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyConfirm = {}));
  5. }(this, (function (exports) { 'use strict';
  6. function _typeof(obj) {
  7. "@babel/helpers - typeof";
  8. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  9. _typeof = function (obj) {
  10. return typeof obj;
  11. };
  12. } else {
  13. _typeof = function (obj) {
  14. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  15. };
  16. }
  17. return _typeof(obj);
  18. }
  19. function _classCallCheck(instance, Constructor) {
  20. if (!(instance instanceof Constructor)) {
  21. throw new TypeError("Cannot call a class as a function");
  22. }
  23. }
  24. function _defineProperties(target, props) {
  25. for (var i = 0; i < props.length; i++) {
  26. var descriptor = props[i];
  27. descriptor.enumerable = descriptor.enumerable || false;
  28. descriptor.configurable = true;
  29. if ("value" in descriptor) descriptor.writable = true;
  30. Object.defineProperty(target, descriptor.key, descriptor);
  31. }
  32. }
  33. function _createClass(Constructor, protoProps, staticProps) {
  34. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  35. if (staticProps) _defineProperties(Constructor, staticProps);
  36. return Constructor;
  37. }
  38. function _inherits(subClass, superClass) {
  39. if (typeof superClass !== "function" && superClass !== null) {
  40. throw new TypeError("Super expression must either be null or a function");
  41. }
  42. subClass.prototype = Object.create(superClass && superClass.prototype, {
  43. constructor: {
  44. value: subClass,
  45. writable: true,
  46. configurable: true
  47. }
  48. });
  49. if (superClass) _setPrototypeOf(subClass, superClass);
  50. }
  51. function _getPrototypeOf(o) {
  52. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  53. return o.__proto__ || Object.getPrototypeOf(o);
  54. };
  55. return _getPrototypeOf(o);
  56. }
  57. function _setPrototypeOf(o, p) {
  58. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  59. o.__proto__ = p;
  60. return o;
  61. };
  62. return _setPrototypeOf(o, p);
  63. }
  64. function _isNativeReflectConstruct() {
  65. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  66. if (Reflect.construct.sham) return false;
  67. if (typeof Proxy === "function") return true;
  68. try {
  69. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  70. return true;
  71. } catch (e) {
  72. return false;
  73. }
  74. }
  75. function _assertThisInitialized(self) {
  76. if (self === void 0) {
  77. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  78. }
  79. return self;
  80. }
  81. function _possibleConstructorReturn(self, call) {
  82. if (call && (typeof call === "object" || typeof call === "function")) {
  83. return call;
  84. }
  85. return _assertThisInitialized(self);
  86. }
  87. function _createSuper(Derived) {
  88. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  89. return function _createSuperInternal() {
  90. var Super = _getPrototypeOf(Derived),
  91. result;
  92. if (hasNativeReflectConstruct) {
  93. var NewTarget = _getPrototypeOf(this).constructor;
  94. result = Reflect.construct(Super, arguments, NewTarget);
  95. } else {
  96. result = Super.apply(this, arguments);
  97. }
  98. return _possibleConstructorReturn(this, result);
  99. };
  100. }
  101. function _slicedToArray(arr, i) {
  102. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  103. }
  104. function _toConsumableArray(arr) {
  105. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  106. }
  107. function _arrayWithoutHoles(arr) {
  108. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  109. }
  110. function _arrayWithHoles(arr) {
  111. if (Array.isArray(arr)) return arr;
  112. }
  113. function _iterableToArray(iter) {
  114. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  115. }
  116. function _iterableToArrayLimit(arr, i) {
  117. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  118. var _arr = [];
  119. var _n = true;
  120. var _d = false;
  121. var _e = undefined;
  122. try {
  123. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  124. _arr.push(_s.value);
  125. if (i && _arr.length === i) break;
  126. }
  127. } catch (err) {
  128. _d = true;
  129. _e = err;
  130. } finally {
  131. try {
  132. if (!_n && _i["return"] != null) _i["return"]();
  133. } finally {
  134. if (_d) throw _e;
  135. }
  136. }
  137. return _arr;
  138. }
  139. function _unsupportedIterableToArray(o, minLen) {
  140. if (!o) return;
  141. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  142. var n = Object.prototype.toString.call(o).slice(8, -1);
  143. if (n === "Object" && o.constructor) n = o.constructor.name;
  144. if (n === "Map" || n === "Set") return Array.from(o);
  145. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  146. }
  147. function _arrayLikeToArray(arr, len) {
  148. if (len == null || len > arr.length) len = arr.length;
  149. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  150. return arr2;
  151. }
  152. function _nonIterableSpread() {
  153. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  154. }
  155. function _nonIterableRest() {
  156. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  157. }
  158. function noop() {}
  159. function run(fn) {
  160. return fn();
  161. }
  162. function blank_object() {
  163. return Object.create(null);
  164. }
  165. function run_all(fns) {
  166. fns.forEach(run);
  167. }
  168. function is_function(thing) {
  169. return typeof thing === 'function';
  170. }
  171. function safe_not_equal(a, b) {
  172. return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function';
  173. }
  174. function is_empty(obj) {
  175. return Object.keys(obj).length === 0;
  176. }
  177. function append(target, node) {
  178. target.appendChild(node);
  179. }
  180. function insert(target, node, anchor) {
  181. target.insertBefore(node, anchor || null);
  182. }
  183. function detach(node) {
  184. node.parentNode.removeChild(node);
  185. }
  186. function destroy_each(iterations, detaching) {
  187. for (var i = 0; i < iterations.length; i += 1) {
  188. if (iterations[i]) iterations[i].d(detaching);
  189. }
  190. }
  191. function element(name) {
  192. return document.createElement(name);
  193. }
  194. function text(data) {
  195. return document.createTextNode(data);
  196. }
  197. function space() {
  198. return text(' ');
  199. }
  200. function empty() {
  201. return text('');
  202. }
  203. function listen(node, event, handler, options) {
  204. node.addEventListener(event, handler, options);
  205. return function () {
  206. return node.removeEventListener(event, handler, options);
  207. };
  208. }
  209. function attr(node, attribute, value) {
  210. if (value == null) node.removeAttribute(attribute);else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
  211. }
  212. function children(element) {
  213. return Array.from(element.childNodes);
  214. }
  215. function set_data(text, data) {
  216. data = '' + data;
  217. if (text.wholeText !== data) text.data = data;
  218. }
  219. function set_input_value(input, value) {
  220. input.value = value == null ? '' : value;
  221. }
  222. var HtmlTag = /*#__PURE__*/function () {
  223. function HtmlTag() {
  224. var anchor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  225. _classCallCheck(this, HtmlTag);
  226. this.a = anchor;
  227. this.e = this.n = null;
  228. }
  229. _createClass(HtmlTag, [{
  230. key: "m",
  231. value: function m(html, target) {
  232. var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  233. if (!this.e) {
  234. this.e = element(target.nodeName);
  235. this.t = target;
  236. this.h(html);
  237. }
  238. this.i(anchor);
  239. }
  240. }, {
  241. key: "h",
  242. value: function h(html) {
  243. this.e.innerHTML = html;
  244. this.n = Array.from(this.e.childNodes);
  245. }
  246. }, {
  247. key: "i",
  248. value: function i(anchor) {
  249. for (var i = 0; i < this.n.length; i += 1) {
  250. insert(this.t, this.n[i], anchor);
  251. }
  252. }
  253. }, {
  254. key: "p",
  255. value: function p(html) {
  256. this.d();
  257. this.h(html);
  258. this.i(this.a);
  259. }
  260. }, {
  261. key: "d",
  262. value: function d() {
  263. this.n.forEach(detach);
  264. }
  265. }]);
  266. return HtmlTag;
  267. }();
  268. var current_component;
  269. function set_current_component(component) {
  270. current_component = component;
  271. }
  272. var dirty_components = [];
  273. var binding_callbacks = [];
  274. var render_callbacks = [];
  275. var flush_callbacks = [];
  276. var resolved_promise = Promise.resolve();
  277. var update_scheduled = false;
  278. function schedule_update() {
  279. if (!update_scheduled) {
  280. update_scheduled = true;
  281. resolved_promise.then(flush);
  282. }
  283. }
  284. function add_render_callback(fn) {
  285. render_callbacks.push(fn);
  286. }
  287. var flushing = false;
  288. var seen_callbacks = new Set();
  289. function flush() {
  290. if (flushing) return;
  291. flushing = true;
  292. do {
  293. // first, call beforeUpdate functions
  294. // and update components
  295. for (var i = 0; i < dirty_components.length; i += 1) {
  296. var component = dirty_components[i];
  297. set_current_component(component);
  298. update(component.$$);
  299. }
  300. set_current_component(null);
  301. dirty_components.length = 0;
  302. while (binding_callbacks.length) {
  303. binding_callbacks.pop()();
  304. } // then, once components are updated, call
  305. // afterUpdate functions. This may cause
  306. // subsequent updates...
  307. for (var _i = 0; _i < render_callbacks.length; _i += 1) {
  308. var callback = render_callbacks[_i];
  309. if (!seen_callbacks.has(callback)) {
  310. // ...so guard against infinite loops
  311. seen_callbacks.add(callback);
  312. callback();
  313. }
  314. }
  315. render_callbacks.length = 0;
  316. } while (dirty_components.length);
  317. while (flush_callbacks.length) {
  318. flush_callbacks.pop()();
  319. }
  320. update_scheduled = false;
  321. flushing = false;
  322. seen_callbacks.clear();
  323. }
  324. function update($$) {
  325. if ($$.fragment !== null) {
  326. $$.update();
  327. run_all($$.before_update);
  328. var dirty = $$.dirty;
  329. $$.dirty = [-1];
  330. $$.fragment && $$.fragment.p($$.ctx, dirty);
  331. $$.after_update.forEach(add_render_callback);
  332. }
  333. }
  334. var outroing = new Set();
  335. function transition_in(block, local) {
  336. if (block && block.i) {
  337. outroing["delete"](block);
  338. block.i(local);
  339. }
  340. }
  341. function mount_component(component, target, anchor) {
  342. var _component$$$ = component.$$,
  343. fragment = _component$$$.fragment,
  344. on_mount = _component$$$.on_mount,
  345. on_destroy = _component$$$.on_destroy,
  346. after_update = _component$$$.after_update;
  347. fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate
  348. add_render_callback(function () {
  349. var new_on_destroy = on_mount.map(run).filter(is_function);
  350. if (on_destroy) {
  351. on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy));
  352. } else {
  353. // Edge case - component was destroyed immediately,
  354. // most likely as a result of a binding initialising
  355. run_all(new_on_destroy);
  356. }
  357. component.$$.on_mount = [];
  358. });
  359. after_update.forEach(add_render_callback);
  360. }
  361. function destroy_component(component, detaching) {
  362. var $$ = component.$$;
  363. if ($$.fragment !== null) {
  364. run_all($$.on_destroy);
  365. $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to
  366. // preserve final state?)
  367. $$.on_destroy = $$.fragment = null;
  368. $$.ctx = [];
  369. }
  370. }
  371. function make_dirty(component, i) {
  372. if (component.$$.dirty[0] === -1) {
  373. dirty_components.push(component);
  374. schedule_update();
  375. component.$$.dirty.fill(0);
  376. }
  377. component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
  378. }
  379. function init(component, options, instance, create_fragment, not_equal, props) {
  380. var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1];
  381. var parent_component = current_component;
  382. set_current_component(component);
  383. var prop_values = options.props || {};
  384. var $$ = component.$$ = {
  385. fragment: null,
  386. ctx: null,
  387. // state
  388. props: props,
  389. update: noop,
  390. not_equal: not_equal,
  391. bound: blank_object(),
  392. // lifecycle
  393. on_mount: [],
  394. on_destroy: [],
  395. before_update: [],
  396. after_update: [],
  397. context: new Map(parent_component ? parent_component.$$.context : []),
  398. // everything else
  399. callbacks: blank_object(),
  400. dirty: dirty,
  401. skip_bound: false
  402. };
  403. var ready = false;
  404. $$.ctx = instance ? instance(component, prop_values, function (i, ret) {
  405. var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret;
  406. if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
  407. if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
  408. if (ready) make_dirty(component, i);
  409. }
  410. return ret;
  411. }) : [];
  412. $$.update();
  413. ready = true;
  414. run_all($$.before_update); // `false` as a special case of no DOM component
  415. $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
  416. if (options.target) {
  417. if (options.hydrate) {
  418. var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  419. $$.fragment && $$.fragment.l(nodes);
  420. nodes.forEach(detach);
  421. } else {
  422. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  423. $$.fragment && $$.fragment.c();
  424. }
  425. if (options.intro) transition_in(component.$$.fragment);
  426. mount_component(component, options.target, options.anchor);
  427. flush();
  428. }
  429. set_current_component(parent_component);
  430. }
  431. var SvelteComponent = /*#__PURE__*/function () {
  432. function SvelteComponent() {
  433. _classCallCheck(this, SvelteComponent);
  434. }
  435. _createClass(SvelteComponent, [{
  436. key: "$destroy",
  437. value: function $destroy() {
  438. destroy_component(this, 1);
  439. this.$destroy = noop;
  440. }
  441. }, {
  442. key: "$on",
  443. value: function $on(type, callback) {
  444. var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
  445. callbacks.push(callback);
  446. return function () {
  447. var index = callbacks.indexOf(callback);
  448. if (index !== -1) callbacks.splice(index, 1);
  449. };
  450. }
  451. }, {
  452. key: "$set",
  453. value: function $set($$props) {
  454. if (this.$$set && !is_empty($$props)) {
  455. this.$$.skip_bound = true;
  456. this.$$set($$props);
  457. this.$$.skip_bound = false;
  458. }
  459. }
  460. }]);
  461. return SvelteComponent;
  462. }();
  463. function get_each_context(ctx, list, i) {
  464. var child_ctx = ctx.slice();
  465. child_ctx[21] = list[i];
  466. return child_ctx;
  467. } // (107:0) {#if confirm || prompt}
  468. function create_if_block(ctx) {
  469. var div1;
  470. var t;
  471. var div0;
  472. var div0_class_value;
  473. var div0_style_value;
  474. var div1_class_value;
  475. var if_block =
  476. /*prompt*/
  477. ctx[3] && create_if_block_2(ctx);
  478. var each_value =
  479. /*buttons*/
  480. ctx[7];
  481. var each_blocks = [];
  482. for (var i = 0; i < each_value.length; i += 1) {
  483. each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
  484. }
  485. return {
  486. c: function c() {
  487. div1 = element("div");
  488. if (if_block) if_block.c();
  489. t = space();
  490. div0 = element("div");
  491. for (var _i = 0; _i < each_blocks.length; _i += 1) {
  492. each_blocks[_i].c();
  493. }
  494. attr(div0, "class", div0_class_value = "pnotify-action-bar ".concat(
  495. /*self*/
  496. ctx[1].getStyle("action-bar")));
  497. attr(div0, "style", div0_style_value = "justify-content: ".concat(
  498. /*align*/
  499. ctx[6], ";"));
  500. attr(div1, "class", div1_class_value = "pnotify-confirm ".concat(
  501. /*self*/
  502. ctx[1].getStyle("text"), " ").concat(
  503. /*self*/
  504. ctx[1].getStyle("confirm")));
  505. },
  506. m: function m(target, anchor) {
  507. insert(target, div1, anchor);
  508. if (if_block) if_block.m(div1, null);
  509. append(div1, t);
  510. append(div1, div0);
  511. for (var _i2 = 0; _i2 < each_blocks.length; _i2 += 1) {
  512. each_blocks[_i2].m(div0, null);
  513. }
  514. /*div0_binding*/
  515. ctx[19](div0);
  516. },
  517. p: function p(ctx, dirty) {
  518. if (
  519. /*prompt*/
  520. ctx[3]) {
  521. if (if_block) {
  522. if_block.p(ctx, dirty);
  523. } else {
  524. if_block = create_if_block_2(ctx);
  525. if_block.c();
  526. if_block.m(div1, t);
  527. }
  528. } else if (if_block) {
  529. if_block.d(1);
  530. if_block = null;
  531. }
  532. if (dirty &
  533. /*self, buttons, handleClick*/
  534. 2178) {
  535. each_value =
  536. /*buttons*/
  537. ctx[7];
  538. var _i3;
  539. for (_i3 = 0; _i3 < each_value.length; _i3 += 1) {
  540. var child_ctx = get_each_context(ctx, each_value, _i3);
  541. if (each_blocks[_i3]) {
  542. each_blocks[_i3].p(child_ctx, dirty);
  543. } else {
  544. each_blocks[_i3] = create_each_block(child_ctx);
  545. each_blocks[_i3].c();
  546. each_blocks[_i3].m(div0, null);
  547. }
  548. }
  549. for (; _i3 < each_blocks.length; _i3 += 1) {
  550. each_blocks[_i3].d(1);
  551. }
  552. each_blocks.length = each_value.length;
  553. }
  554. if (dirty &
  555. /*self*/
  556. 2 && div0_class_value !== (div0_class_value = "pnotify-action-bar ".concat(
  557. /*self*/
  558. ctx[1].getStyle("action-bar")))) {
  559. attr(div0, "class", div0_class_value);
  560. }
  561. if (dirty &
  562. /*align*/
  563. 64 && div0_style_value !== (div0_style_value = "justify-content: ".concat(
  564. /*align*/
  565. ctx[6], ";"))) {
  566. attr(div0, "style", div0_style_value);
  567. }
  568. if (dirty &
  569. /*self*/
  570. 2 && div1_class_value !== (div1_class_value = "pnotify-confirm ".concat(
  571. /*self*/
  572. ctx[1].getStyle("text"), " ").concat(
  573. /*self*/
  574. ctx[1].getStyle("confirm")))) {
  575. attr(div1, "class", div1_class_value);
  576. }
  577. },
  578. d: function d(detaching) {
  579. if (detaching) detach(div1);
  580. if (if_block) if_block.d();
  581. destroy_each(each_blocks, detaching);
  582. /*div0_binding*/
  583. ctx[19](null);
  584. }
  585. };
  586. } // (111:4) {#if prompt}
  587. function create_if_block_2(ctx) {
  588. var div;
  589. var div_class_value;
  590. function select_block_type(ctx, dirty) {
  591. if (
  592. /*promptMultiLine*/
  593. ctx[5]) return create_if_block_3;
  594. return create_else_block_1;
  595. }
  596. var current_block_type = select_block_type(ctx);
  597. var if_block = current_block_type(ctx);
  598. return {
  599. c: function c() {
  600. div = element("div");
  601. if_block.c();
  602. attr(div, "class", div_class_value = "pnotify-prompt-bar ".concat(
  603. /*self*/
  604. ctx[1].getStyle("prompt-bar")));
  605. },
  606. m: function m(target, anchor) {
  607. insert(target, div, anchor);
  608. if_block.m(div, null);
  609. },
  610. p: function p(ctx, dirty) {
  611. if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
  612. if_block.p(ctx, dirty);
  613. } else {
  614. if_block.d(1);
  615. if_block = current_block_type(ctx);
  616. if (if_block) {
  617. if_block.c();
  618. if_block.m(div, null);
  619. }
  620. }
  621. if (dirty &
  622. /*self*/
  623. 2 && div_class_value !== (div_class_value = "pnotify-prompt-bar ".concat(
  624. /*self*/
  625. ctx[1].getStyle("prompt-bar")))) {
  626. attr(div, "class", div_class_value);
  627. }
  628. },
  629. d: function d(detaching) {
  630. if (detaching) detach(div);
  631. if_block.d();
  632. }
  633. };
  634. } // (121:8) {:else}
  635. function create_else_block_1(ctx) {
  636. var input;
  637. var input_class_value;
  638. var mounted;
  639. var dispose;
  640. return {
  641. c: function c() {
  642. input = element("input");
  643. attr(input, "type", "text");
  644. attr(input, "class", input_class_value = "pnotify-prompt-input ".concat(
  645. /*self*/
  646. ctx[1].getStyle("input"), " ").concat(
  647. /*promptClass*/
  648. ctx[4]));
  649. },
  650. m: function m(target, anchor) {
  651. insert(target, input, anchor);
  652. /*input_binding*/
  653. ctx[16](input);
  654. set_input_value(input,
  655. /*promptValue*/
  656. ctx[0]);
  657. if (!mounted) {
  658. dispose = [listen(input, "keypress",
  659. /*handleKeyPress*/
  660. ctx[12]), listen(input, "input",
  661. /*input_input_handler*/
  662. ctx[17])];
  663. mounted = true;
  664. }
  665. },
  666. p: function p(ctx, dirty) {
  667. if (dirty &
  668. /*self, promptClass*/
  669. 18 && input_class_value !== (input_class_value = "pnotify-prompt-input ".concat(
  670. /*self*/
  671. ctx[1].getStyle("input"), " ").concat(
  672. /*promptClass*/
  673. ctx[4]))) {
  674. attr(input, "class", input_class_value);
  675. }
  676. if (dirty &
  677. /*promptValue*/
  678. 1 && input.value !==
  679. /*promptValue*/
  680. ctx[0]) {
  681. set_input_value(input,
  682. /*promptValue*/
  683. ctx[0]);
  684. }
  685. },
  686. d: function d(detaching) {
  687. if (detaching) detach(input);
  688. /*input_binding*/
  689. ctx[16](null);
  690. mounted = false;
  691. run_all(dispose);
  692. }
  693. };
  694. } // (113:8) {#if promptMultiLine}
  695. function create_if_block_3(ctx) {
  696. var textarea;
  697. var textarea_class_value;
  698. var mounted;
  699. var dispose;
  700. return {
  701. c: function c() {
  702. textarea = element("textarea");
  703. attr(textarea, "rows", "5");
  704. attr(textarea, "class", textarea_class_value = "pnotify-prompt-input ".concat(
  705. /*self*/
  706. ctx[1].getStyle("input"), " ").concat(
  707. /*promptClass*/
  708. ctx[4]));
  709. },
  710. m: function m(target, anchor) {
  711. insert(target, textarea, anchor);
  712. /*textarea_binding*/
  713. ctx[14](textarea);
  714. set_input_value(textarea,
  715. /*promptValue*/
  716. ctx[0]);
  717. if (!mounted) {
  718. dispose = [listen(textarea, "keypress",
  719. /*handleKeyPress*/
  720. ctx[12]), listen(textarea, "input",
  721. /*textarea_input_handler*/
  722. ctx[15])];
  723. mounted = true;
  724. }
  725. },
  726. p: function p(ctx, dirty) {
  727. if (dirty &
  728. /*self, promptClass*/
  729. 18 && textarea_class_value !== (textarea_class_value = "pnotify-prompt-input ".concat(
  730. /*self*/
  731. ctx[1].getStyle("input"), " ").concat(
  732. /*promptClass*/
  733. ctx[4]))) {
  734. attr(textarea, "class", textarea_class_value);
  735. }
  736. if (dirty &
  737. /*promptValue*/
  738. 1) {
  739. set_input_value(textarea,
  740. /*promptValue*/
  741. ctx[0]);
  742. }
  743. },
  744. d: function d(detaching) {
  745. if (detaching) detach(textarea);
  746. /*textarea_binding*/
  747. ctx[14](null);
  748. mounted = false;
  749. run_all(dispose);
  750. }
  751. };
  752. } // (145:10) {:else}
  753. function create_else_block(ctx) {
  754. var t_value =
  755. /*button*/
  756. ctx[21].text + "";
  757. var t;
  758. return {
  759. c: function c() {
  760. t = text(t_value);
  761. },
  762. m: function m(target, anchor) {
  763. insert(target, t, anchor);
  764. },
  765. p: function p(ctx, dirty) {
  766. if (dirty &
  767. /*buttons*/
  768. 128 && t_value !== (t_value =
  769. /*button*/
  770. ctx[21].text + "")) set_data(t, t_value);
  771. },
  772. d: function d(detaching) {
  773. if (detaching) detach(t);
  774. }
  775. };
  776. } // (143:10) {#if button.textTrusted}
  777. function create_if_block_1(ctx) {
  778. var html_tag;
  779. var raw_value =
  780. /*button*/
  781. ctx[21].text + "";
  782. var html_anchor;
  783. return {
  784. c: function c() {
  785. html_anchor = empty();
  786. html_tag = new HtmlTag(html_anchor);
  787. },
  788. m: function m(target, anchor) {
  789. html_tag.m(raw_value, target, anchor);
  790. insert(target, html_anchor, anchor);
  791. },
  792. p: function p(ctx, dirty) {
  793. if (dirty &
  794. /*buttons*/
  795. 128 && raw_value !== (raw_value =
  796. /*button*/
  797. ctx[21].text + "")) html_tag.p(raw_value);
  798. },
  799. d: function d(detaching) {
  800. if (detaching) detach(html_anchor);
  801. if (detaching) html_tag.d();
  802. }
  803. };
  804. } // (137:6) {#each buttons as button}
  805. function create_each_block(ctx) {
  806. var button;
  807. var t;
  808. var button_class_value;
  809. var mounted;
  810. var dispose;
  811. function select_block_type_1(ctx, dirty) {
  812. if (
  813. /*button*/
  814. ctx[21].textTrusted) return create_if_block_1;
  815. return create_else_block;
  816. }
  817. var current_block_type = select_block_type_1(ctx);
  818. var if_block = current_block_type(ctx);
  819. function click_handler() {
  820. var _ctx;
  821. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  822. args[_key] = arguments[_key];
  823. }
  824. return (
  825. /*click_handler*/
  826. (_ctx = ctx)[18].apply(_ctx, [
  827. /*button*/
  828. ctx[21]].concat(args))
  829. );
  830. }
  831. return {
  832. c: function c() {
  833. button = element("button");
  834. if_block.c();
  835. t = space();
  836. attr(button, "type", "button");
  837. attr(button, "class", button_class_value = "pnotify-action-button ".concat(
  838. /*self*/
  839. ctx[1].getStyle("btn"), " ").concat(
  840. /*button*/
  841. ctx[21].primary ?
  842. /*self*/
  843. ctx[1].getStyle("btn-primary") :
  844. /*self*/
  845. ctx[1].getStyle("btn-secondary"), " ").concat(
  846. /*button*/
  847. ctx[21].addClass ?
  848. /*button*/
  849. ctx[21].addClass : ""));
  850. },
  851. m: function m(target, anchor) {
  852. insert(target, button, anchor);
  853. if_block.m(button, null);
  854. append(button, t);
  855. if (!mounted) {
  856. dispose = listen(button, "click", click_handler);
  857. mounted = true;
  858. }
  859. },
  860. p: function p(new_ctx, dirty) {
  861. ctx = new_ctx;
  862. if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) {
  863. if_block.p(ctx, dirty);
  864. } else {
  865. if_block.d(1);
  866. if_block = current_block_type(ctx);
  867. if (if_block) {
  868. if_block.c();
  869. if_block.m(button, t);
  870. }
  871. }
  872. if (dirty &
  873. /*self, buttons*/
  874. 130 && button_class_value !== (button_class_value = "pnotify-action-button ".concat(
  875. /*self*/
  876. ctx[1].getStyle("btn"), " ").concat(
  877. /*button*/
  878. ctx[21].primary ?
  879. /*self*/
  880. ctx[1].getStyle("btn-primary") :
  881. /*self*/
  882. ctx[1].getStyle("btn-secondary"), " ").concat(
  883. /*button*/
  884. ctx[21].addClass ?
  885. /*button*/
  886. ctx[21].addClass : ""))) {
  887. attr(button, "class", button_class_value);
  888. }
  889. },
  890. d: function d(detaching) {
  891. if (detaching) detach(button);
  892. if_block.d();
  893. mounted = false;
  894. dispose();
  895. }
  896. };
  897. }
  898. function create_fragment(ctx) {
  899. var if_block_anchor;
  900. var if_block = (
  901. /*confirm*/
  902. ctx[2] ||
  903. /*prompt*/
  904. ctx[3]) && create_if_block(ctx);
  905. return {
  906. c: function c() {
  907. if (if_block) if_block.c();
  908. if_block_anchor = empty();
  909. },
  910. m: function m(target, anchor) {
  911. if (if_block) if_block.m(target, anchor);
  912. insert(target, if_block_anchor, anchor);
  913. },
  914. p: function p(ctx, _ref) {
  915. var _ref2 = _slicedToArray(_ref, 1),
  916. dirty = _ref2[0];
  917. if (
  918. /*confirm*/
  919. ctx[2] ||
  920. /*prompt*/
  921. ctx[3]) {
  922. if (if_block) {
  923. if_block.p(ctx, dirty);
  924. } else {
  925. if_block = create_if_block(ctx);
  926. if_block.c();
  927. if_block.m(if_block_anchor.parentNode, if_block_anchor);
  928. }
  929. } else if (if_block) {
  930. if_block.d(1);
  931. if_block = null;
  932. }
  933. },
  934. i: noop,
  935. o: noop,
  936. d: function d(detaching) {
  937. if (if_block) if_block.d(detaching);
  938. if (detaching) detach(if_block_anchor);
  939. }
  940. };
  941. }
  942. var position = "AppendContent";
  943. var defaults = {
  944. confirm: false,
  945. prompt: false,
  946. promptClass: "",
  947. promptValue: "",
  948. promptMultiLine: false,
  949. focus: null,
  950. align: "flex-end",
  951. buttons: [{
  952. text: "Ok",
  953. primary: true,
  954. promptTrigger: true,
  955. click: function click(notice, value) {
  956. notice.close();
  957. notice.fire("pnotify:confirm", {
  958. notice: notice,
  959. value: value
  960. });
  961. }
  962. }, {
  963. text: "Cancel",
  964. click: function click(notice) {
  965. notice.close();
  966. notice.fire("pnotify:cancel", {
  967. notice: notice
  968. });
  969. }
  970. }]
  971. };
  972. function instance($$self, $$props, $$invalidate) {
  973. var _$$props$self = $$props.self,
  974. self = _$$props$self === void 0 ? null : _$$props$self;
  975. var _$$props$confirm = $$props.confirm,
  976. confirm = _$$props$confirm === void 0 ? defaults.confirm : _$$props$confirm;
  977. var _$$props$prompt = $$props.prompt,
  978. prompt = _$$props$prompt === void 0 ? defaults.prompt : _$$props$prompt;
  979. var _$$props$promptClass = $$props.promptClass,
  980. promptClass = _$$props$promptClass === void 0 ? defaults.promptClass : _$$props$promptClass;
  981. var _$$props$promptValue = $$props.promptValue,
  982. promptValue = _$$props$promptValue === void 0 ? defaults.promptValue : _$$props$promptValue;
  983. var _$$props$promptMultiL = $$props.promptMultiLine,
  984. promptMultiLine = _$$props$promptMultiL === void 0 ? defaults.promptMultiLine : _$$props$promptMultiL;
  985. var _$$props$focus = $$props.focus,
  986. focus = _$$props$focus === void 0 ? defaults.focus : _$$props$focus;
  987. var _$$props$align = $$props.align,
  988. align = _$$props$align === void 0 ? defaults.align : _$$props$align;
  989. var _$$props$buttons = $$props.buttons,
  990. buttons = _$$props$buttons === void 0 ? defaults.buttons : _$$props$buttons;
  991. var promptMultiElem;
  992. var promptSingleElem;
  993. var buttonsElem;
  994. var focusNextChange = false;
  995. self.on("pnotify:afterOpen", function () {
  996. $$invalidate(20, focusNextChange = true);
  997. });
  998. function handleClick(button, event) {
  999. if (button.click) {
  1000. button.click(self, prompt ? promptValue : null, event);
  1001. }
  1002. }
  1003. function handleKeyPress(event) {
  1004. if (event.keyCode === 13 && !event.shiftKey) {
  1005. event.preventDefault();
  1006. var _this$get = this.get(),
  1007. _buttons = _this$get.buttons;
  1008. for (var i = 0; i < _buttons.length; i++) {
  1009. if (_buttons[i].promptTrigger && _buttons[i].click) {
  1010. _buttons[i].click(self, prompt ? promptValue : null, event);
  1011. }
  1012. }
  1013. }
  1014. }
  1015. function textarea_binding($$value) {
  1016. binding_callbacks[$$value ? "unshift" : "push"](function () {
  1017. promptMultiElem = $$value;
  1018. $$invalidate(8, promptMultiElem);
  1019. });
  1020. }
  1021. function textarea_input_handler() {
  1022. promptValue = this.value;
  1023. $$invalidate(0, promptValue);
  1024. }
  1025. function input_binding($$value) {
  1026. binding_callbacks[$$value ? "unshift" : "push"](function () {
  1027. promptSingleElem = $$value;
  1028. $$invalidate(9, promptSingleElem);
  1029. });
  1030. }
  1031. function input_input_handler() {
  1032. promptValue = this.value;
  1033. $$invalidate(0, promptValue);
  1034. }
  1035. var click_handler = function click_handler(button, event) {
  1036. return handleClick(button, event);
  1037. };
  1038. function div0_binding($$value) {
  1039. binding_callbacks[$$value ? "unshift" : "push"](function () {
  1040. buttonsElem = $$value;
  1041. $$invalidate(10, buttonsElem);
  1042. });
  1043. }
  1044. $$self.$$set = function ($$props) {
  1045. if ("self" in $$props) $$invalidate(1, self = $$props.self);
  1046. if ("confirm" in $$props) $$invalidate(2, confirm = $$props.confirm);
  1047. if ("prompt" in $$props) $$invalidate(3, prompt = $$props.prompt);
  1048. if ("promptClass" in $$props) $$invalidate(4, promptClass = $$props.promptClass);
  1049. if ("promptValue" in $$props) $$invalidate(0, promptValue = $$props.promptValue);
  1050. if ("promptMultiLine" in $$props) $$invalidate(5, promptMultiLine = $$props.promptMultiLine);
  1051. if ("focus" in $$props) $$invalidate(13, focus = $$props.focus);
  1052. if ("align" in $$props) $$invalidate(6, align = $$props.align);
  1053. if ("buttons" in $$props) $$invalidate(7, buttons = $$props.buttons);
  1054. };
  1055. $$self.$$.update = function () {
  1056. if ($$self.$$.dirty &
  1057. /*focusNextChange, prompt, focus, promptMultiLine, promptMultiElem, promptSingleElem, confirm, self, buttons, buttonsElem*/
  1058. 1058734) {
  1059. {
  1060. if (focusNextChange) {
  1061. if (prompt && focus !== false) {
  1062. if (promptMultiLine) {
  1063. if (promptMultiElem) {
  1064. promptMultiElem.focus();
  1065. $$invalidate(20, focusNextChange = false);
  1066. }
  1067. } else {
  1068. if (promptSingleElem) {
  1069. promptSingleElem.focus();
  1070. $$invalidate(20, focusNextChange = false);
  1071. }
  1072. }
  1073. } else if (confirm && (focus === true || focus === null && self.stack.modal === true)) {
  1074. if (buttons.length && buttonsElem) {
  1075. var i = buttons.length - 1;
  1076. while (i > 0) {
  1077. if (buttons[i].promptTrigger) {
  1078. break;
  1079. }
  1080. i--;
  1081. }
  1082. buttonsElem.children[i].focus();
  1083. $$invalidate(20, focusNextChange = false);
  1084. }
  1085. }
  1086. }
  1087. }
  1088. }
  1089. };
  1090. return [promptValue, self, confirm, prompt, promptClass, promptMultiLine, align, buttons, promptMultiElem, promptSingleElem, buttonsElem, handleClick, handleKeyPress, focus, textarea_binding, textarea_input_handler, input_binding, input_input_handler, click_handler, div0_binding];
  1091. }
  1092. var Confirm = /*#__PURE__*/function (_SvelteComponent) {
  1093. _inherits(Confirm, _SvelteComponent);
  1094. var _super = _createSuper(Confirm);
  1095. function Confirm(options) {
  1096. var _this;
  1097. _classCallCheck(this, Confirm);
  1098. _this = _super.call(this);
  1099. init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, {
  1100. self: 1,
  1101. confirm: 2,
  1102. prompt: 3,
  1103. promptClass: 4,
  1104. promptValue: 0,
  1105. promptMultiLine: 5,
  1106. focus: 13,
  1107. align: 6,
  1108. buttons: 7
  1109. });
  1110. return _this;
  1111. }
  1112. return Confirm;
  1113. }(SvelteComponent);
  1114. exports.default = Confirm;
  1115. exports.defaults = defaults;
  1116. exports.position = position;
  1117. Object.defineProperty(exports, '__esModule', { value: true });
  1118. })));